I'm reading through a proof of the following theorem in Lang's Algebra:
Let $E \neq 0$ be a finitely generated torsion module over PID $R$. Then $E$ is isomorphic to a direct sum of non-zero factors: $$ R/(q_1) \oplus \ldots \oplus R/(q_r) $$ where $q_1, \ldots, q_r$ are non-zero elements of $R$ such that $q_1 | q_2 | \ldots | q_r$. The sequence of ideals $(q_1), \ldots, (q_r)$ is uniquely determined.
Lang's proof of uniqueness is somewhat unclear to me in one particular point, and I think I can do it in a bit quicker way. I would be thankful if someone could check my thinking:
Lang's proof of uniqueness of ideals goes through following steps:
Let $E_p = \ker p$ (kernel of multiplying by a prime $p \in R$). $E_p$ is a vector space over a field $R/(p)$. Also, $E = E_1 \oplus E_2$ implies $E_p = (E_1)_p \oplus (E_2)_p$.
If $p | q_i$, then $(R/(q_i)_p \simeq R/p$. Otherwise, $(R/(q_i)_p \simeq 0$.
Then, if $$ E \simeq R/(q_1) \oplus \ldots \oplus R/(q_r)$$ $ \dim_{R/(p)} E_p$ counts number of $q_i$ such that $p$ divides $q_i$.
So if we have $$ E \simeq R/(q_1) \oplus \ldots \oplus R/(q_r) \simeq R/(q_1') \oplus \ldots \oplus R/(q_s')$$ let's choose $p$ such that $p|q_1$. Because of $q_1 | \ldots | q_r$ condition $ r = \dim E_p \leq s $. By symmetry, $r = s$.
This is where our paths diverge. Lang goes on:
Consider the module $pE$. By a preceding remark, if we write $q_i = pb_i$, then $$pE \simeq R/(b_1) \oplus \ldots \oplus R/(b_r)$$ and $b_1 | \ldots |b_r$. Some of the $b_i$ may be units, but those which are not units determine their principal ideal uniquely, by induction. Hence if $(b_1) = \ldots = (b_j) = 1$, but $(b_{j+1}) \neq 1$ Then the sequence of ideals $(b_{j+1}), \ldots, (b_r)$ is uniquely determined. This proves our uniqueness statement.
If I'm not mistaken, Lang thinks about induction by prime factors of $q_r$?
But couldn't we just notice (after proving that $r = s$ part) that if we have $ E \simeq R/(q_1) \oplus \ldots \oplus R/(q_r)$ and $\dim E_p = d \neq 0$ that this means that $p$ divides $q_{r - d + 1}, \ldots, q_r$ (because of the $q_1 | \ldots | q_r$ condition).
Looking at $\dim E_p$ for various prime $p$, we get the prime decomposition of $q_i$, and from it uniqueness of ideals.
Am I missing something in this argument?