Let $M$ be a finitely generated torsion module over a Dedekind domain $R$. Show that there exist nonzero ideals $I_1 \supseteq \cdots \supseteq I_n$ of $R$ such that $M \cong \bigoplus\limits_{i=1}^n R/I_i$.
I'm stuck on this problem. Since $M$ is torsion and finitely generated, the annhilator $\mathfrak a:= \textrm{ann}_RM$ of $M$ is a nonzero ideal, which we can write as a product of primes $P_1^{e_1} \cdots P_s^{e_s}$. The hint given in the problem is to show that $S^{-1}R$ is a principal ideal domain, where $S = R \setminus (P_1 \cup \cdots \cup P_s)$.
This is pretty clear, since the localization of a Dedekind domain remains a Dedekind domain, and the prime avoidance theorem plus the fact that every prime ideal is maximal implies that $S^{-1}P_1, ... , S^{-1}P_s$ are the only prime ideals of $S^{-1}R$. And a semilocal Dedekind domain is automatically a principal ideal domain.
Now $S^{-1}M$ is a finitely generated $S^{-1}R$-module, so we can apply the structure theorem for finitely generated modules over PIDs: there exist $d_1, ... , d_n \in S^{-1}R$ such that $Rd_1 \supseteq \cdots \supseteq Rd_n$ and $$S^{-1}M \cong \bigoplus\limits_{i=1}^n \frac{S^{-1}R}{S^{-1}Rd_i}$$ Also if we let $S^{-1}Rp_i = S^{-1} P_i$, then the principal ideals $S^{-1}Rd_i$ are localizations of ideals $I_i$ of $R$, where we can ensure that the localization of $I_i$ at $S$ is $(d_i)$, as long as $\nu_{P_j}(I_i) = \nu_{P_j}(d_i)$ for $j = 1, ... , n$. That's nice, but I don't know how to relate the localized module $S^{-1}M$ to the original module $M$. Any hints would be appreciated.
Someone can dodge the question by applying the Invariant factor theorem for f.g. modules over the Dedekind domains.
On the other hand, I think the following lemma should be enough (devote if I suck).
$\bf{Lemma}$. Let $S$ and $R$ be those in the question and $P$ one of $P_{i}.$ For any element $s^{-1}\overline{a}\in S^{-1}R/P^{i}$ with $s\in S,$ there exists $\overline{b}\in R/P^{i}$ such that $s^{-1}\overline{a}=\overline{b}.$
$\it{Proof}$. It suffices to show $s\cdot-:R/P^{i}\to R/P^{i}$ is surjective, i.e. bijective or injective. Thus we look at the kernel of $$s\cdot-:R\to R/P^{i}\,\, \text{(denote this map by }\hat{s}\text{ then).}$$ Clearly $P^{i}\subset \text{ker}(\hat{s}).$ Let $x$ be an element of $\text{ker}(\hat{s})$ satisfying $sx\in P^{i}.$ Since $s^{j}\notin P$ for $j=1,...$ and $P^{i}$ is a primary ideal (as a power of a maximum ideal), we know $x\in P^{i}$ and $P^{i}=\text{ker}(\hat{s}).$ $\square$