TITLE: Is a torsion-free abelian group finitely generated, if all of its localizations at primes $p$ are finitely generated over $\mathbb{Z}_p$?
QUESTION [6 upvotes]: Background: When proving that the group of $k$-isogenies $\mathrm{Hom}_k(A,B)$ between two abelian varieties is finitely generated, one first shows that the Tate map $$\mathbb{Z}_\ell\otimes_{\mathbb{Z}} M \to \mathrm{Hom}_{\mathbb{Z}_\ell}(T_\ell A,T_\ell B)$$ is injective. Since each Tate module is free of finite rank over $\mathbb{Z}_\ell$, it follows that the localization $M_\ell$ is $\mathbb{Z}_\ell$-finite. One then uses a little trick to deduce the $\mathbb{Z}$-finiteness of $M$ itself. (See Silverman I, for example.)
The above proof needs only a single prime $\ell$,
but disregarding issues of the characteristic of the field (which are apparently surmountable) we actually have an injective Tate map at every prime. Thus...
Question: Can the $\mathbb{Z}$-finiteness of $M$ be deduced directly from the $\mathbb{Z}_\ell$-finiteness of  $M_\ell$ for all primes $\ell$?
One can consider this a question about general torsion-free abelian groups $M$. A non-counterexample to keep in mind is $M=\mathbb{Z}[1/p]$,
for which $M_\ell$ is $\mathbb{Z}_\ell$-finite for all $\ell\neq p$.
(A google search shows that there is actually quite a body of literature on torsion-free abelian groups, so perhaps the answer to this question is well-known, but I'm not sure where to look...)

REPLY [2 votes]: I had the same question when reading Silverman, and want to follow up on Jeremy's answer and explain "Step 4" of his proof in more detail. Corollary 1.6 in these notes was also very helpful.
So let's prove that if $N$ is a $\mathbb{Z}$-module such that

$N$ is torsion-free,
For every finitely generated $\mathbb{Z}$-submodule $M$ of $N$, the set $M^{\text{div}} := \{n \in N ~|~ \exists k \in \mathbb{Z} \text{ such that } kn\in M\}$ is a finitely generated $\mathbb{Z}$-module,
For one prime $\ell$ the $\mathbb{Z}_\ell$-module $N \otimes_{\mathbb{Z}} \mathbb{Z}_\ell$ is finitely generated,

then $N$ is finitely generated. (The rank estimate for $N=\text{Hom}(E_1,E_2)$ follows then precisely as in Silverman, Cor. III.7.5)
By 3. we know that $N\otimes_{\mathbb{Z}} \mathbb{Q}_\ell = (N\otimes_{\mathbb{Z}} \mathbb{Z}_\ell) \otimes_{\mathbb{Z}_\ell} \mathbb{Q}_\ell$ is a finite-dimensional $\mathbb{Q}_\ell$-vector space. But also $N\otimes_{\mathbb{Z}} \mathbb{Q}_\ell = (N\otimes_{\mathbb{Z}} \mathbb{Q}) \otimes_{\mathbb{Q}} \mathbb{Q}_\ell$, thus the $\mathbb{Q}$-vector space $N\otimes_{\mathbb{Z}} \mathbb{Q}$ is finite-dimensional as well. Let $n_1,\dots,n_d$ be a basis of the vector space $N\otimes_{\mathbb{Z}} \mathbb{Q}$. By clearing denominators we may assume that $n_i \in N$ for all $i$. Let $M$ be the $\mathbb{Z}$-submodule of $N$ generated by $n_1,\dots,n_d$. We claim that $M^{\text{div}} = N$, which by 2. completes the proof.
Clearly $M^{\text{div}} \subset N$, so take $n \in N$. Then $n = \sum_i n_i \otimes \lambda_i$ for $\lambda_i \in \mathbb{Q}$. By clearing denominators of the $\lambda_i$ we see that some $\mathbb{Z}$-multiple of $n$ is a $\mathbb{Z}$-linear combination of the $n_i$ and thus lives in $M$, i.e. $n \in M^{\text{div}}$.