I am reading Serre's book on Lie Algebras and Lie Groups. On Lemma 4.3, he states that
If $E$ is a finitely generated $\mathbb{Z}$-module and $\dim(E \otimes_{\mathbb{Z}} \mathbb{F}_p)$ over $\mathbb{F} = \mathbb{Z} / p\mathbb{Z}$ is independent of $p$, for all primes $p$, then $E$ is a $\mathbb{Z}$-free module with rank equal to the dimension of $E \otimes_{\mathbb{Z}} \mathbb{F}_p$ over $\mathbb{F}_p$.
Serra says that "this lemma is an easy consequence of the structure theorem of abelian groups". I have no idea on how to pass from $\mathbb{F}_p$ to $\mathbb{Z}$.
How can this be proved? Also, is there a nice "categorical" argument behind?
The quoted theorem states that for a finitely generated $\Bbb Z$-module $M$, there are finitely many primes $p_1, ..., p_r$, as well as a number $k$, such that
$$ M \simeq \Bbb Z^k \oplus \bigoplus_{i=1}^r M_{p_i}$$
where $M_{p_i}$ is $p_i$-torsion.
Now notice that for two different primes $\ell \neq p$ and a $p$-torsion $M_p$, we have $\Bbb F_\ell \otimes M_p=0$, whereas $dim_{\Bbb F_p} \Bbb F_p \otimes M_p \ge 1$ iff $M_p \neq 0$.