Finiteness is not a local property

In this post, we consider the following question:

Question. Let A be a Noetherian ring, and M and A-module. If M_\mathfrak p is a finite A_\mathfrak p-module for all primes \mathfrak p \subseteq A, is M finite?

That is, is finiteness a local property?

For the statement where local means the property is true on a cover by Zariski opens, see Tag 01XZ. Some properties (e.g. flatness) can also be checked at the level of local rings; however, we show that this is not true for finiteness.

Example 1. Let A = \mathbb Z, and let M = \bigoplus_{p \text{ prime}} \mathbb Z/p\mathbb Z. Then M_{(p)} = \mathbb Z/p\mathbb Z, because localisation commutes with direct sums and (\mathbb Z/q\mathbb Z)_{(p)} = 0 if q \neq p is prime. Thus, M_{(p)} is finitely generated for all primes p. Finally, M_{(0)} = 0, because M is torsion. But M is obviously not finitely generated.

Example 2. Again, let A = \mathbb Z, and let M \subseteq \mathbb Q be the subgroup of fractions \frac{a}{b} with \gcd(a,b) = 1 such that b is squarefree. This is a subgroup because \frac{a}{b} + \frac{c}{d} can be written with denominator \lcm(b,d), and that number is squarefree if b and d are. Clearly M is not finitely generated, because the denominators can be arbitrarily large. But M_{(0)} = \mathbb Q, which is finitely generated over \mathbb Q. If p is a prime, then M_{(p)} \subseteq \mathbb Z_{(p)} is the submodule \frac{1}{p}\mathbb Z_{(p)}, which is finitely generated over \mathbb Z_{(p)}.

Another way to write M is \sum_{p \text{ prime}} \frac{1}{p}\mathbb Z \subseteq \mathbb Q.

Remark. The second example shows that over a PID, the property that M is free of rank 1 can not be checked at the stalks. Of course it can be if M is finitely generated, for then M is finite projective [Tag 00NX] of rank 1, hence free since A is a PID.