A wrong proof about Dedekind domains I "proved" that a Dedekind domain is a PID, but as we know this is wrong (for example $\mathbb{Z}[\sqrt{-5}]$). I do not know what is wrong in my proof: 

Suppose $R$ is a Dedekind domain, $I$ is any nonzero ideal of $R$, $\mathfrak p_i$  all the primes of $I$. If $r_i$ is the $\mathfrak p_i$-adic value of $I$, we can find an element $x\in R$ with its $\mathfrak p_i$-adic value $r_i$, so $I=(x)$ is principal.

Who can tell me what is wrong in my "proof"?
 A: First, your presentation seems slightly muddled.  I think you are arguing the following:
Let $I$ be a nonzero ideal in a Dedekind domain $R$.  Then $I$ admits a factorization into primes $I = \mathfrak{p}_1^{a_1} \cdots \mathfrak{p}_r^{a_r}$.  Now you observe that (for instance by the Chinese Remainder Theorem, or Artin-Whaples approximation) there exists an element $x \in R$ such that for all $1 \leq i \leq r$, $\operatorname{ord}_{\mathfrak{p}_i}(x) = a_i$.  Finally you want to claim that $I = (x)$.  (I hope I am understanding correctly.)
The problem is with the very last step: it need not be the case that $I = (x)$.  You have enforced that for all $1 \leq i \leq r$, $\operatorname{ord}_{\mathfrak{p}_i}(x) = \operatorname{ord}_{\mathfrak{p}_i}(I) = a_i$.  But what about all the other prime ideals of $R$?  The Chinese Remainder Theorem does not say that you can find such an $x$ which is divisible by the given set of primes to prescribed multiplicities and is not divisible by any other prime ideals of $R$: indeed, as you have noticed, this is necessarily false in any Dedekind domain which is not a PID.
Nevertheless the argument above does prove something.  In fact it proves several things:

*

*("Moving Lemma") Given any nonzero ideal $I$ in a Dedekind domain and any finite set $S$ of nonzero prime ideals of $R$, there exists $0 \neq x$ in the fraction field $K$ such that the fractional ideal $(x) I$ is not divisible by any $\mathfrak{p} \in S$.

This implies:


*If $R$ has only finitely many prime ideals, then it is a PID.

In fact it also implies:


*If all but finitely many prime ideals of $R$ are principal, then all prime ideals of $R$ are principal and thus $R$ is a PID.

Fact 2) above is a standard exercise in this subject.  For some reason 3) is not: it seems to have first been recorded by Luther Claborn in the 1960's: see Corollary 1.6 here. I "rediscovered it" a few years ago when teaching a course on algebraic number theory.  To better appreciate the result, note that the ring $\mathbb{Z}[\sqrt{-3}]$ has infinitely many prime ideals, exactly one of which is not principal.  But it is not a Dedekind domain, since it is not integrally closed in its fraction field.
