Often times in these posts, the main focus is some big/nice theorem/result; however, this time there’s a nice lemma about Dedekind domains that I think merits its own post. This is partially because I’m still shocked that it’s true, and partially because I don’t know where else it is written down. After proving it, I will (maybe briefly ^{1}) mention one of its uses ^{2}. However, I think this use is less exciting than the lemma itself. The gist of the lemma is that lattices over Dedekind domains can be modified at a single prime.
The Lemma
I guess I might as well start with stating this thing. Before I can do that though, it’s probably worthwhile to define what I mean by a lattice.
Notice above that we have hard equalities. These aren’t abstract isomorphisms; all of these lattices are literal subsets of our fixed vector space $F^n$, and these are literal equalties of sets.
What freaks me out about this lemma is that it (almost) tells us that we can consider some global $R$lattice as a collection of local $R_\mfp$lattices, make arbitrary changes to the local lattices, and then stitch all these changes together to get some global transformation of the lattice we started with. I feel like you generally don’t have this much global control at the local level.
Anyways, let’s prove this thing. The first thing we’ll want to do is reduce the statement of the lemma to something more manageable. Right now, we have infinitely many local conditions we need our fabled lattice $L’$ to satisfy (one for each prime of $R$), and infinity is a pretty big number. It would be nice if we only had finitely many constraints instead. This brings us to our first step. ^{3}
Now, it's harmless to replace $s\in R[1/\pi]$ with its numerator in some fractional expression, so we can form $r=s\pi\in R\sm\{0\}$. We have $M_r=L_r$ as $R_r$lattices inside $F^n$. Now, let $M'=L\cap M$, an $R$lattice in $F^n$, and observe that $M'_r=L_r=M_r$. We claim that, for proving the main lemma, it suffices to find an $R$lattice $L'$ containing $M'$ such that (i) $L'_r=M_r'$ and (ii) for each of the finitely many primes $\mfq\mid(r)$, we have $L'_\mfq=L_\mfq$ if $\mfq\neq\mfp$ and $L'_\mfp=L_0$ (i.e. $M_\mfp$) otherwise. This is because for $\mfq\nmid(r)$, we also would have $L'_\mfq=L_\mfq$ since $L'_r=M_r'=L'_r$ (i.e. $L'_\mfq=(L'_r)_{\mfq'}$ where $\mfq'=\mfq L_r$).
Hence, we’ve reduced proving the main lemma to constructing this $R$lattice $L’$ mentioned at the end of the above argument. Writing $V=F^n$ for ease of notation, we can view $L’$ as a finitely generated $R$submodule of the (huge) $R$module $V/M’$. While $V/M’$ may seem largely unwildly, we actually have some hope of being able to understand/work with it since it is torsion (e.g. think of $\qz$). To see that it’s torsion, note that $M_F’=V$, so every element of $V$ looks like $\frac mr$ with $m\in M’$ and $r\in R$, and so is killed (in $V/M’$) when multiplied by its denominator. Now, to make working with $V/M’$ easy, we’ll prove a general fact that torsion $R$modules decompose into sums of (some of) their localizations.
In our particular case, the above says that
Now, we’re practically done. Using the description on the RHS, take $L’$ to be the $R$submodule of $V/M’$ given by inserting the chosen $R_\mfq$submodule of each $(V/M’)_ \mfq$ for $\mfq\mid(r)$ (and $0$ for $(V/M’)[1/r]$). One needs to check that this module is finitely generated over $R$. However, this is clear since a finitely generated torsion $R_\mfq$module is just a finitely generated module over $R_\mfq/(\mfq R_\mfq)^N=R/\mfq^N$ for some large $N$ (and hence also finitely generated over $R$). There are only finitely many primes dividing $(r)$, so we win.
There we have it. Lattices over Dedekind domains can be modified one prime at a time.
Its Use
For this part of the post, you’ll probably want to have some familiarity with completions of rings (e.g. be comfortable with inverse limits) and adeles (e.g. know what a restricted direct product is).
We’ll switch up notation in this section. Previously, given a Dedeking domain $R$ with prime ideal $\mfp$, we used $R_\mfp$ to denote its localization at $\mfp$. From now on, we’ll instead let $R_\mfp$ denote $R$’s completion at $\mfp$. That is,
is the valuation ring (i.e. elements with norm $\le1$) of the (analytic) completion $F_\mfp$ of $F$ with respect to the absolute value $\abs x_\mfp=\eps^{v_\mfp(x)}$ where $0<\eps<1$ and $v_\mfp(x)$ is the largest power of $\mfp$ dividing $(x)$.
The point of this section will be to use the main lemma to prove that (isomorphism classes of) finitely generated projective $R$modules of rank $n$ are classified via a certain double coset space. ^{4} Before stating this, it will be useful to define/prove a few things.
Our next definition will be that of the adele ring $\A_R=F\otimes_R\wh R$, where $F=\Frac(R)$. Note that when $R=\Z$ (or, more generally $R=\ints K$ for $K$ a number field), this is just the ring of finite adeles instead of the usual adele ring over $\Q$ (or $K$) which also contains information about $R$’s infinite places. Now, if you’ve seen adeles before, you’re probably used to seeing them defined via some kind of restricted direct product instead of this weird tensor. The two definitions are equivalent.
Showing that $\GL_n(\A_R)$ is also a restricted direct product is left as an exercise.
Cool. Now that we know something about adeles, we can prove the thing we alluded to at the beginning of this section. Recall that an $R$module $P$ is called projective if any of the following hold
 Every short exact sequence $0\too K\too E\too P\too 0$ splits
 There exists an $R$module $Q$ such that $P\oplus Q$ is $R$free
 The (covariant) function $\Hom_R(P,)$ is exact
When $R$ is a Dedekind domain (and $P$ is finitely generated), this is just a fancy way to say that $P$ is torsionfree ^{5}. Given a projective $R$module $P$, its rank is $\dim_F(P\otimes_RF)$ where $F=\Frac(R)$ ^{6}.
One last thing: for proving the below theorem, it will be helpful to know that (finitely presented) projective modules are “locally free” in the below sense. ^{7}
 $M$ is projective.
 There exists $r_1,\dots,r_k\in R$ s.t. $(r_1,\dots,r_k)=R$ and $M[\frac1{r_i}]$ is a free $R[\frac1{r_i}]$module for all $i$.
Finally, the one use of our main lemma I know is proving the following:
Let $\phi:M\to N$ be an isomorphism of projective $R$modules. Then, we get a commutative diagram $$\begin{CD} F\otimes_RM @>f>> F^n\\ @V{1\otimes\phi}VV @VVTV\\ F\otimes_RN @>g>> F^n \end{CD}$$ where $T\in\GL_n(F)$. Now, using the composition $g\circ(1\otimes\phi)$ in place of $F$ has the effect of turning $\ith T$ into $\ith T\inv T$ as one sees by staring at the below commutative diagram $$\begin{CD} F\otimes_RM @>g>> F^n\\ @A{1\otimes\phi}AA @AATA\\ F\otimes_RM @>f_\mfp>> F^n\\ @VVV @VV\ith TV\\ F\otimes_{R\sqbracks{\frac1{r_i}}}M\sqbracks{\frac1{r_i}} @>\ith g>> F^n \end{CD}$$ Hence, changing our isomorphism really does correspond to an action of $\GL_n(F)$ on the right.
Now, fix a prime $\mfp\subset R$ and an $R_\mfp$basis $\bracks{f_j}_{j=1}^n$ for $M_\mfp$. What would happen to $\Ith Tk_\mfp$ if we used this basis instead of $\bracks{\Ith ek_j}_{j=1}^n$? Well, this alternate choice of basis gives rise to a map $g_\mfp:F_\mfp\otimes_{R_\mfp}M_\mfp\iso F_\mfp^n$, and then again, you stare at a diagram and see that this would have the effect of replacing $\Ith Tk_\mfp$ with $T_\mfp\Ith Tk_\mfp$ where $T_\mfp$ is what makes the below commute $$\begin{CD} F_\mfp\otimes_{R_\mfp}M_\mfp @>f>> F^n_\mfp\\ @VVV @VV{\Ith Tk_\mfp}V\\ F_\mfp\otimes_{R_\mfp}M_\mfp @>\Ith gk_\mfp>> F^n_\mfp\\ @VVV @VV{T_\mfp}V\\ F_\mfp\otimes_{R_\mfp}M_\mfp @>g_\mfp>> F^n_\mfp \end{CD}$$ Clearly, $T_\mfp\in\GL_n(\mfp)$ since it corresponds to changing $R_\mfp$bases from our original choice to our new choice, so changing all local bases at once corresponds to an action of $\GL_n(\wh R)$ on the left as desired.
So far, all we've done is defined this map; we still need to show that it's a bijection. We start with surjectivity. Fix some representative $(T_\mfp)_\mfp$ of an element of $\GL_n(\wh R)\sm\GL_n(\A_R)\,/\,\GL_n(F)$ (i.e. $T_\mfp\in\GL_n(F_\mfp)$). Since $T_\mfp\in\GL_n(R_\mfp)$ almost always, we can act by $\GL_n(\wh R)$ on the left to assume that $T_\mfp=I$, the identity for all but finitely many $\mfp$. The point of doing this is that taking $L=R^n$ and letting $f:F\otimes_RL\iso F^n$ be the natural isomorphism, we get that $\psi(f)$ is represented by the identity in every slot. Hence, $\psi(f)_\mfp=T_\mfp$ for all but finitely many $\mfp$, and we use our main lemma to change $L$, one prime at a time, in the finiely many differing slots to arrive at a new lattice $L'$ for which $\psi(L')=(T_\mfp)_\mfp$, proving surjectivity.
I'll leave injectivity for the reader because I mainly just cared about applying the main lemma, and I've done that now.
I don’t actually know why this theorem is useful, but it probably is for something. I guess, geometrically, rank $n$ projective $R$modules correspond to rank $n$ vector bundles over $\spec R$, so this gives some characterization of vector bundles in terms of this double coset space. ^{8} When $n=1$, we see that the Picard group $\Pic(R)$ is $\units{\wh R}\sm\units{\A_R}\,/\,\units F$. Maybe one could use this to prove finiteness of class groups when $R=\ints K$ is the ring of integers of some number field or something; I really don’t know.
An Exercise
The simplest Dedekind domains are PIDs. Try proving the results of this post just for PIDs to see if you can make the proofs much simpler.

Spoiler: I accidentally ended up spending most of my time on this one use instead of keeping focus on the lemma throughout ↩

If you know other uses of this lemma, please let me know. ↩

This is like a lemma for a lemma. What do you call that? ↩

Assuming I’m not remembering things incorrectly, when $n=1$, this gives the Picard group of $R$. ↩

Exercise: prove this (hint: use the fact that $R$ is locally a PID and (finitely generated) torsionfree modules over PIDs are free) ↩

Secretly, the rank of a projective $R$module $P$ is supposed to be a function $r:\spec(R)\to\N_{\ge0}$ given by $r(\mfp)=\dim_{R/\mfp}(P\otimes_RR/\mfp)$, but this function is constant (and equal to what I wrote outside this footnote) when $R$ is not stupid (e.g. when $R$ is an integral domain) ↩

We say an $R$module $M$ is finitely presented if there exists a short exact sequence $0\to A\to F\to M\to 0$ with $F$ a finitely generated free $R$module and $A$ finitely generated. When $R$ is Noetherian, this is equivalent to being finitely generated. ↩

Something something the geometry of Dedekind domains is controlled by adeles something something? ↩