The following theorem is well-known in commutative algebra:
Let $A$ be a ring. Suppose that, for all prime ideals $\frak p$ of $A$, the module $M_\frak p$ is flat over $A_\frak p$. Then $M$ is flat over $A$.
Up until now, I never used this theorem but always:
free modules are flat
if a module is torsion over a domain, then it is not flat
extension of scalars preserves flatness
etc. I would like to see some concrete, non-trivial examples of the above theorem in use, where using this theorem is favorable over using any three of the above.
Any help would be appreciated.
Let $R=\mathbb Z$ and $M=\{a/b\in\mathbb Q\mid b\text{ is squarefree}\}$. Let $p$ be a prime. We claim that $M_{(p)}\cong\Bbb Z_{(p)}$. To this end, let $m\in M_{(p)}$. Then we can write $$m=\frac{a}{bp^{n}},$$ where $b\notin(p)$ and $n\in\{0,1\}$. Define a linear map $\phi:M_{(p)}\to\Bbb Z_{(p)}$ by $\phi(m)=pm$. Conversely, define $\psi:\Bbb Z_{(p)}\to M_{(p)}$ by $\psi(f)=f/p$. Notice that $$\frac{f}p=\frac{(a/p)}{b}$$ for some $b\notin (p)$ and $a/p\in M$. Verify that $\psi$ and $\phi$ are inverses of each other.
Thus $M_{(p)}$ is free and hence flat as a $\mathbb Z_{(p)}$-module. It follows that $M$ is a flat $\mathbb Z$ module.