\chapter{Flatness revisited}

In the past, we have already encountered the notion of \emph{flatness}. We
shall now study it in more detail.
We shall start by introducing the notion of \emph{faithful} flatness and
introduce the idea of ``descent.'' Later, we shall consider other criteria for
(normal) flatness that we have not yet explored.

We recall (\cref{flatdefn}) that a module $M$ over a commutative ring $R$ is
\emph{flat} if the functor $N \mapsto N \otimes_R M$ is an exact functor. An
$R$-algebra is flat if it is flat as a module. For instance, we have seen that
any localization of $R$ is a flat algebra, because localization is an exact
functor.


\textbf{All this has not been added yet!}

\section{Faithful flatness}



\subsection{Faithfully flat modules}
Let $R$ be a commutative ring.

\begin{definition} 
The $R$-module $M$ is \textbf{faithfully flat} if  any complex $N' \to N
\to N''$ of $R$-modules is exact if and only if the tensored sequence $N'
\otimes_R M \to N \otimes_R M \to N'' \otimes_R M$ is exact.
\end{definition} 

Clearly, a faithfully flat module is flat.


\begin{example} 
The direct sum of faithfully flat modules is faithfully flat.
\end{example} 
\begin{example} 
A (nonzero)  free module is faithfully flat, because $R$ itself is flat
(tensoring with $R$ is the identity functor).
\end{example} 

We shall now prove several useful criteria about faithfully flat modules.

\begin{proposition}  \label{easyffcriterion}
An $R$-module $M$ is faithfully flat if and only if it is flat and if $M
\otimes_R N = 0$ implies $N=0$ for any $N$.
\end{proposition} 
\begin{proof} Suppose $M$ faithfully flat
Then $M$ is flat, clearly. In addition, if $N$ is any $R$-module, consider the
sequence
\[ 0 \to N \to 0;  \]
it is exact if and only if
\[ 0 \to M \otimes_R N \to 0  \]
is exact. Thus $N=0$ if and only if $M \otimes_R N = 0$.

Conversely, suppose $M$ is flat and satisfies the additional condition. We
need to show that if $N'
\otimes_R M \to N \otimes_R M \to N'' \otimes_R M$ is exact, so is $N' \to N
\to N''$. Since $M$ is flat, taking homology commutes with tensoring with $M$.
In particular, if $H$ is the homology of $N' \to N \to N''$, then $H \otimes_R
M$ is the homology of 
$N'
\otimes_R M \to N \otimes_R M \to N'' \otimes_R M$. It follows that $H
\otimes_R M = 0$, so $H=0$, and the initial complex is exact.
\end{proof} 

\begin{example} 
Another illustration of the above technique is the following observation: if
$M$ is faithfully flat and $N \to N'$ is any morphism, then $N \to N'$ is an
isomorphism if and only if $M \otimes N' \to M \otimes N$ is an isomorphism.
This follows because the condition that a map be an isomorphism can be phrased
as the exactness of a certain (uninteresting) complex.
\end{example} 
\begin{exercise} 
The direct sum of a flat module and a faithfully flat module is faithfully flat.
\end{exercise} 


From the above result, we can get an important example of a faithfully flat
algebra over a ring.
\begin{example} 
Let $R$ be a commutative ring, and $\left\{f_i\right\}$ a finite set of
elements that generate the unit ideal in $R$ (or equivalently, the basic open
sets $D(f_i) = \spec R_{f_i}$ form a covering of $\spec R$). 
Then the algebra $\prod R_{f_i}$ is faithfully flat over $R$ (i.e., is so as a
module). Indeed, as a
product of localizations, it is certainly flat.

So by \cref{easyffcriterion}, we are left with showing that if $M$ is any
$R$-module and $M_{f_i} =0 $ for all $i$, then $M = 0$. 
Fix $m \in M$, and consider the ideal $\ann(m)$ of elements annihilating $m$.
Since $m$ maps to zero in each localization $M_{f_i}$, there is a power of
$f_i$ in $\ann(m)$ for each $i$. 
This easily implies that $\ann(m) = R$, so $m=0$. (We used the fact that if the
$\left\{f_i\right\}$ generate the unit ideal, so do $\left\{f_i^N\right\}$ for
any $N \in \mathbb{Z}_{\geq 0}$.)
\end{example} 

A functor $F$ between two categories is said to be \textbf{faithful} if the
induced map on the hom-sets $\hom(x,y) \to \hom(Fx, Fy)$ is always injective.
The following result explains the use of the term ``faithful.''

\begin{proposition} 
A module $M$ is faithfully flat if and only if it is flat and the functor $N \to N
\otimes_R M$ is faithful.
\end{proposition} 
\begin{proof} Let $M$ be flat.
We need to check that $M$ is faithfully flat if and only if the natural map
\[ \hom_R(N, N') \to \hom_R(N \otimes_R M, N' \otimes_R M)  \]
is injective.
Suppose first $M$ is faithfully flat and $f: N \to N'$ goes to zero $f \otimes
1_M: N \otimes_R M \to  N' \otimes_R M$. We know by flatness that
\[ \im(f) \otimes_R M = \im(f \otimes 1_M)  \]
so that if $f \otimes 1_M = 0$, then $\im(f) \otimes M = 0$. Thus by faithful
flatness, $\im(f) = 0$ by \rref{easyffcriterion}.

Conversely, let us suppose $M$ flat and the functor $N \to N \otimes_R M$
faithful. Let $N \neq 0$; then $1_N \neq 0$ as maps $N \to N$. 
It follows that $1_N \otimes 1_M$ and $0 \otimes 1_M = 0$ are different as
endomorphisms of $M \otimes_R N$. Thus $M \otimes_R N \neq 0$. By
\rref{easyffcriterion}, we are done again.
\end{proof} 

\begin{example} 
Note, however, that $\mathbb{Z} \oplus \mathbb{Z}/2$ is a $\mathbb{Z}$-module
such that tensoring by it is a faithful but not exact functor.
\end{example} 

Finally, we prove one last criterion:

\begin{proposition} \label{ffmaximal} 
$M$ is faithfully flat if and only if $M$ is flat and $\mathfrak{m}M \neq M$ for all
maximal ideals $\mathfrak{m} \subset R$.
\end{proposition} 
\begin{proof} 
If $M$ is faithfully flat, then $M$ is flat, and $M \otimes_R R/\mathfrak{m} =
M/\mathfrak{m}M \neq 0$ for all $\mathfrak{m}$ as $R/\mathfrak{m} \neq 0$, by
\rref{easyffcriterion}. So we get one direction.

Alternatively, suppose $M$ is flat and $M \otimes_R R/\mathfrak{m} \neq 0$ for
all maximal $\mathfrak{m}$. Since every proper ideal is contained in a maximal
ideal, it follows that $M \otimes_R R/I \neq 0$ for all proper ideals $I$. We
shall use this and \rref{easyffcriterion} to prove that $M$ is faithfully flat

Let $N$ now be any nonzero module. Then $N$ contains a \emph{cyclic} submodule, i.e.
one isomorphic to $R/I$ for some proper $I$. The injection
\[ R/I \hookrightarrow N  \]
becomes an injection
\[ R/I \otimes_R M \hookrightarrow N \otimes_R M,  \]
and since $R/I \otimes_R M \neq 0$, we find that $N \otimes_R M \neq 0$. By
\rref{easyffcriterion}, it follows that $M$ is faithfully flat
\end{proof} 

\begin{corollary} 
A nonzero finitely generated flat module over a \emph{local} ring is faithfully flat.
\end{corollary} 
\begin{proof} 
This follows from \cref{ffmaximal} and Nakayama's lemma. 
\end{proof} 

A \emph{finitely presented} flat module over a local ring is in fact free, but we do not prove
this (except when the ring is noetherian, see \cref{}).
\begin{proof} 
Indeed, let $R$ be a local ring with maximal ideal $\mathfrak{m}$, and $M$ a
finitely generated flat $R$-module. Then by Nakayama's lemma, $M/\mathfrak{m}M
\neq 0$, so that $M$ must be faithfully flat.
\end{proof} 

\begin{proposition} 
Faithfully flat modules are closed under direct sums and tensor products.
\end{proposition} 

\begin{proof} 
Exercise.
\end{proof} 




\subsection{Faithfully flat algebras}

Let $\phi: R \to S$ be a morphism of rings, making $S$ into an $R$-algebra.

\begin{definition} 
$S$ is a \textbf{faithfully flat $R$-algebra} if it is faithfully flat as an
$R$-module.
\end{definition} 

\begin{example} 
The map $R \to R[x]$ from a ring into its polynomial ring is always faithfully
flat. This is clear.
\end{example}

Next, we indicate the usual ``sorite'' for faithfully flat morphisms:
\begin{proposition} \label{ffsorite}
Faithfully flat morphisms are closed under composition and base change.
\end{proposition} 
That is, if $R \to S$, $S \to T$ are faithfully flat, so is $R \to T$.
Similarly, if $R \to S$ is faithfully flat and $R'$ any $R$-algebra, then $R'
\to S \otimes_R R'$ is faithfully flat.

The reader may wish to try this proof as an exercise.
\begin{proof} 
The first result follows because the composite of the two faithful and exact
functors (tensoring  $ \otimes_R S$ and tensoring  $ \otimes_S T$ gives the
composite $\otimes_R T$) yields a faithful and exact functor. 

In the second case, let $M$ be an $R'$-module. Then $M \otimes_{R'} (R'
\otimes_R S)$ is canonically isomorphic to $M \otimes_R S$. From this it is
clear if the functor $M \mapsto M \otimes_R S$ is faithful and
exact, so is 
$M \mapsto M \otimes_{R'} (R'
\otimes_R S)$.
\end{proof} 

Flat maps are usually injective, but they need not be. For instance, if $R$ is a
product $R_1 \times R_2$, then the projection map $R \to R_1$ is flat.
This never happens for faithfully flat maps.
In particular, a quotient can never be faithfully flat.

\begin{proposition}  \label{ffinjective}
If $S$ is a faithfully flat $R$-algebra, then the structure map $R \to S$ is injective.
\end{proposition} 
\begin{proof} 
Indeed, let us tensor the map $R \to S $ with $S$, over $R$. We get a morphism
of $S$-modules
\[ S \to S \otimes_R S ,  \]
sending $s \mapsto  1 \otimes s$.
This morphism has an obvious section $S \otimes_R S \to S$ sending $a \otimes b
\mapsto ab$. Since it has a section, it is injective. But faithful flatness says
that the original map $R \to S$ must be injective itself.
\end{proof} 

\begin{example} 
The converse of \cref{ffinjective} definitely fails. Consider the localization $\mathbb{Z}_{(2)}$;
it is a flat $\mathbb{Z}$-algebra, but not faithfully flat (for instance,
tensoring with $\mathbb{Z}/3$ yields zero).
\end{example} 

\begin{exercise} 
Suppose $\phi: R \to S$ is a flat, injective morphism of rings such that $S/\phi(R)$ is a
flat $R$-module. Then show that $\phi$ is faithfully flat. 
\end{exercise} 

Flat morphisms need not be injective, but they are locally injective. We shall see this using:
\begin{proposition}  \label{flatlocal}
A flat local homomorphism of local rings is faithfully flat. In particular, it
is injective.
\end{proposition} 
\begin{proof} 
Let $\phi: R \to S$ be a local homomorphism of local rings with maximal ideals
$\mathfrak{m}, \mathfrak{n}$. Then by definition $\phi(\mathfrak{m}) \subset
\mathfrak{n}$. It follows that $S \neq \phi(\mathfrak{m})S$, so by
\rref{ffmaximal} we win.
\end{proof} 
The point of the above proof was, of course, the fact that the
ring-homomorphism was \emph{local}. If we just had that $\phi( \mathfrak{m})S
\subsetneq S$ for every maximal ideal $\mathfrak{m} \subset R$, that would be
sufficient for the argument.

\begin{corollary} 
Let $\phi: R \to S$ be a flat morphism. Let $\mathfrak{q} \in \spec S$,
$\mathfrak{p} = \phi^{-1}(\mathfrak{q})$ the image in $\spec R$. Then 
$R_{\mathfrak{p}} \to S_{\mathfrak{q}}$ is faithfully flat, hence injective.
\end{corollary} 
\begin{proof} 
We only need to show that the map is flat by \cref{flatlocal}. 
Let $M' \hookrightarrow M$ be an injection of $R_{\mathfrak{p}} \to
S_{\mathfrak{q}}$-modules. Note that $M', M$ are then $R$-modules as well.
Then 
$$M' \otimes_{R_{\mathfrak{p}}} S_{\mathfrak{q}} = (M' \otimes_R
R_{\mathfrak{p}}) \otimes_{R_{\mathfrak{p}}} S_{\mathfrak{q}} = M' \otimes_R
S_{\mathfrak{q}}.$$
Similarly for $M$.
This shows that tensoring over $R_{\mathfrak{p}}$ with $S_{\mathfrak{q}}$ is
the same as tensoring over $R$ with $S_{\mathfrak{q}}$. But $S_{\mathfrak{q}}$
is flat over $S$, and $S$ is flat over $R$, so by \cref{ffsorite},
$S_{\mathfrak{q}}$ is flat over $R$. Thus the result is clear.
\end{proof} 

\subsection{Descent of properties under faithfully flat base change}

Let $S$ be an $R$-algebra. Often, things that are true about objects over $R$
(for instance, $R$-modules) will remain true after base-change to $S$. 
For instance, if $M$ is a finitely generated $R$-module, then $M \otimes_R S$
is a finitely generated $S$-module.
In this section, we will show that we can conclude the \emph{reverse}
implication when $S$ is \emph{faithfully flat} over $R$.

\begin{exercise} 
Let $R \to S$ be a faithfully flat morphism of rings. If $S$ is noetherian, so
is $R$. The converse is false!
\end{exercise} 


\begin{exercise} Many properties of morphisms of rings are such that if they hold after
one makes a faithfully flat base change, then they hold for the original
morphism.
Here is a simple example.
Suppose $S$ is a faithfully flat $R$-algebra. Let $R'$ be any $R$-algebra.
Suppose $S'  =S \otimes_R R'$ is finitely generated over $R'$. Then $S$ is
finitely generated over $R$. 

To see that, note that $R'$ is the colimit of its finitely generated
$R$-subalgebras $R_\alpha$. Thus $S'$ is the colimit of the $R_\alpha
\otimes_R S$, which inject into $S'$; finite generation implies that one of
the $R_\alpha \otimes_R S \to S'$ is an isomorphism. Now use the fact that
isomorphisms ``descend'' under faithfully flat morphisms.

In algebraic geometry, one can show that many properties of morphisms of
\emph{schemes} allow for descent under faithfully flat base-change. See
\cite{EGA}, volume IV-2.
\end{exercise} 


\subsection{Topological consequences}

There are many topological consequences of faithful flatness on the $\spec$'s.
These are
explored in detail in volume 4-2 of \cite{EGA}. We shall only scratch the
surface.
The reader 
should bear in mind the usual intuition that flatness means that the fibers
``look similar'' to one other. 

\begin{proposition} 
Let $R \to S$ be a faithfully flat morphism of rings. Then the map $\spec S
\to \spec R$ is surjective.
\end{proposition} 

\begin{proof} Since $R \to S$ is injective, we may regard $R$ as a subring of $S$.
We shall first show that:

\begin{lemma} \label{intideal}
If $I \subset R$ is any ideal, then $R \cap IS = I$.
\end{lemma}
\begin{proof} 
To see this, note that the morphism
\[ R/I \to S/IS  \]
is faithfully flat, since faithful flatness is preserved by base-change, and
this is the base-change of $R \to S$ via $R \to R/I$.
In particular, it is injective. Thus $IS \cap R = I$.
\end{proof} 


Now to see surjectivity, we use a general criterion:

\begin{lemma} \label{imagespec}
Let $\phi: R \to S$ be a morphism of rings and suppose $\mathfrak{p} \in \spec
R$. Then $\mathfrak{p}$ is in the image of $\spec S \to \spec R$ if and only if 
$\phi^{-1}( \phi(\mathfrak{p}) S) = \mathfrak{p}$.
\end{lemma} 

This lemma will prove the proposition.
\begin{proof} 
Suppose first that $\mathfrak{p}$ is in the image of $\spec S \to \spec R$. In
this case, there is $\mathfrak{q} \in \spec S$ such that
$ \mathfrak{p}$ is the preimage of $\mathfrak{q}$.
In particular, $\mathfrak{q} \supset \phi(\mathfrak{p})S$, so that, if we take
pre-images,
\[ \mathfrak{p} \supset \phi^{-1}(\phi(\mathfrak{p}) S),  \]
while the other inclusion is obviously true.

Conversely, suppose that $\mathfrak{p} \subset \phi^{-1}(\phi(\mathfrak{p})
S)$. In this case, we know that 
\[ \phi(R  - \mathfrak{p}) \cap \phi(\mathfrak{p})S = \emptyset.  \]
Now $T = \phi(R - \mathfrak{p})$ is a multiplicatively closed subset.
There is a morphism
\begin{equation} \label{randomequationwhichidonthaveanamefor}
R_{\mathfrak{p}} \to T^{-1}S 
\end{equation} 
which sends elements of $\mathfrak{p}$ into non-units, by
\eqref{randomequationwhichidonthaveanamefor} so it is a \emph{local}
homomorphism. The maximal ideal of $T^{-1} S$ pulls back to that of
$R_{\mathfrak{p}}$. By the usual commutative diagrams, it follows that
$\mathfrak{p}$ is the preimage of something in $\spec S$.
\end{proof} 
\end{proof} 

\begin{remark} 
The converse also holds. If $\phi: R \to S$ is a flat morphism of rings such
that $\spec S \to \spec R$ is surjective, then $\phi$ is faithfully flat.
Indeed, \cref{imagespec} shows then that for any prime ideal $\mathfrak{p}
\subset R$, $\phi(\mathfrak{p})$ fails to generate $S$. 
This is sufficient to imply that $S$ is faithfully flat by \cref{ffmaximal}.
\end{remark} 

\begin{remark} 
A ``slicker'' argument that faithful flatness implies surjectiveness on spectra
can be given as follows. Let $R \to S$ be faithfully flat. Let $\mathfrak{p}
\in \spec R$; we want to show that $\mathfrak{p}$ is in the image of $\spec S$.
Now \emph{base change preserves faithful flatness.} So we can replace $R$ by
$R/\mathfrak{p}$, $S$ by $S/\mathfrak{p}S$, and assume that $R$ is a domain and
$\mathfrak{p}  = 0$.
Indeed, the commutative diagram
\[ \xymatrix{
\spec S/\mathfrak{p}S \ar[d] \ar[r] &  \spec R/\mathfrak{p} \ar[d]  \\
\spec S \ar[r] &  \spec R
}\]
shows that $\mathfrak{p}$ is in the image of $\spec S \to \spec R$ if and only
if $\left\{0\right\}$ is in the image of $\spec S/\mathfrak{p}S \to \spec
R/\mathfrak{p}$.

We can make another reduction: by localizing at $\mathfrak{p}$ (that is,
$\left\{0\right\}$), we may assume that $R$ is local and thus a field.
So we have to show that if $R$ is a field and $S$ a faithfully flat
$R$-algebra, then $\spec S \to \spec R$ is surjective. But since $S$ is not the
zero ring (by \emph{faithful} flatness!), it is clear that $S$ has a prime
ideal and $\spec S \to \spec R$ is thus surjective.
\end{remark} 

In fact, one can show that the morphism $\spec S \to \spec R$ is actually an
\emph{identification,} that is, a quotient map. This is true more generally
for faithfully flat and quasi-compact morphisms of schemes; see \cite{EGA},
volume 4-2.

\begin{theorem} 
Let $\phi: R \to S$ be a faithfully flat morphism of rings. Then $\spec S \to
\spec R$ is a quotient map of topological spaces.
\end{theorem} 

In other words, a subset of $\spec R$ is closed if and only if its pre-image
in $\spec S$ is closed.

\begin{proof} 
We need to show that if $F \subset \spec R$ is such that its pre-image in
$\spec S$ is closed, then $F$ itself is closed.  \textbf{ADD THIS PROOF}
\end{proof} 


\section{Faithfully flat descent}

Fix a ring $R$, and let $S$ be an $R$-algebra. Then there is a natural functor
from $R$-modules to $S$-modules sending $N \mapsto S \otimes_R N$.
In this section, we shall be interested in going in the opposite direction,
or in characterizing the image of this functor.
Namely, given an $S$-module, we want to ``descend'' to an $R$-module when
possible; given a morphism of $S$-modules, we want to know when it comes from a
morphism of $R$-modules by base change.

\add{this entire section!}


\subsection{The Amitsur complex}
\add{citation needed}

Suppose $B$ is an $A$-algebra. 
Then we can construct a complex of $A$-modules
\[ 0 \to A \to B \to B \otimes_A B \to B \otimes_A B \otimes_A B \to \dots  \]
as follows. 
For each $n$, we denote by $B^{\otimes n}$ the tensor product of $B$ with
itself $n$ times (over $A$).
There are morphisms of $A$-algebras
\[ d_i: B^{\otimes n} \to B^{\otimes n+1} , \quad 0 \leq i \leq n+1 \]
where the map sends
\[ b_1 \otimes \dots \otimes b_n \mapsto b_1 \otimes \dots \otimes b_{i-1}
\otimes  1 \otimes  b_i \otimes \dots \otimes b_n,  \]
so that the $1$ is placed in the $i$th spot.
Then the coboundary 
$\partial: B^{\otimes n} \to B^{\otimes n+1}$ is defined as $\sum (-1)^i d_i$.
It is easy to check that this forms a complex of $A$-modules.

\begin{definition} 
The above complex of $B$-modules is called the \textbf{Amitsur complex} of $B$
over $A$, and we denote it $\mathcal{A}_{B/A}$. It is clearly functorial in
$B$; a map of $A$-algebras $B \to C$ induces a morphism of complexes
$\mathcal{A}_{B/A} \to \mathcal{A}_{C/A}$.
\end{definition} 

Note that the Amitsur complex behaves very nicely with respect to base-change.
If $A'$ is an $A$-algebra and $B' = B \otimes_A A'$ is the base extension, then 
$\mathcal{A}_{B'/A'}  = \mathcal{A}_{B/A} \otimes_A A'$, which follows easily
from the fact that base-change commutes with tensor products.

In general, the Amitsur complex is not even exact. 
For instance, if it is exact in degree one, then the map $A \to B$ is necessarily injective.
If, however, the morphism is \emph{faithfully flat}, then we do get exactness:

\begin{theorem} 
If $B$ is a faithfully flat $A$-algebra, then the Amitsur complex of $B/A$ is
exact.  In fact, if $M$ is any $A$-module, then $\mathcal{A}_{B/A} \otimes_A
M$ is exact.
\end{theorem} 
\begin{proof} 
We prove this first under the assumption that $A \to B$ has a section. 
In this case, we will even have:

\begin{lemma} 
Suppose $A \to B$ is a morphism of rings with a section $B \to A$. Then the
Amitsur complex $\mathcal{A}_{B/A}$ is homotopically trivial. (In particular,
$\mathcal{A}_{B/A} \otimes_A M$ is acyclic for all $M$.)
\end{lemma} 
\begin{proof} 
Let $s: B \to A$ be the section; by assumption, this is a morphism of
$A$-algebras. We shall define a chain contraction of $\mathcal{A}_{B/A}$. 
To do this, we must define a collection of morphisms of $A$-modules
\( h_{n+1} : B^{\otimes n+1} \to B^{\otimes n},  \)
and this we do by sending 
\[ b_1 \otimes \dots \otimes b_{n+1} \mapsto s(b_{n+1}) \left( b_1 \otimes
\dots \otimes b_n \right).  \]
It is still necessary to check that the $\left\{h_{n+1}\right\}$ form a chain
contraction; in other words, that $\partial h_{n} + h_{n+1} \partial =
1_{B^{\otimes n}}$. 
By linearity, we need only check this on elements of the form $b_1 \otimes
\dots \otimes b_n$. Then we find
\[ \partial h_n (b_1 \otimes b_n) = s(b_1) \sum (-1)^i b_2 \otimes \dots \otimes 1
\otimes \dots \otimes b_n  \]
where the $1$ is in the $i$th place,
while
\[ h_{n+1} \partial ( b_1 \otimes \dots \otimes  b_n) = b_1 \otimes \dots \otimes b_n +
\sum_{i>0} s(b_1) (-1)^{i-1}b_2 \otimes \dots \otimes 1 \otimes \dots \otimes b_n  \]
where again the $1$ is in the $i$th place. The assertion is from this clear.
Note that if $\mathcal{A}_{B/A}$ is contractible, we can tensor the chain
homotopy with $M$ to see that $\mathcal{A}_{B/A} \otimes_A M$ is chain contractible
for any $M$.
\end{proof} 

With this lemma proved, we see that the Amitsur complex $\mathcal{A}_{B/A}$
(or even $\mathcal{A}_{B/A} \otimes_A M$) is acyclic whenever $B/A$ admits a
section. Now if we make the base-change by the morphism $A \to B$, we get the
morphism $B \to B \otimes_A B$. That is,
\[  B \otimes_A \left( \mathcal{A}_{B/A} \otimes_A M \right)= \mathcal{A}_{B
\otimes_A B/B} \otimes_B (M \otimes_A B). \]
The latter is acyclic because $B \to B \otimes_A B$ admits a section (namely,
$b_1 \otimes b_2 \mapsto b_1 b_2$). So the complex $\mathcal{A}_{B/A}
\otimes_A M$ becomes acyclic after base-changing to $B$; this, however, is a
faithfully flat base-extension, so the original complex was itself exact.
\end{proof} 

\begin{remark} 
A powerful use of the Amitsur complex in algebraic geometry is to show that
the cohomology of a quasi-coherent sheaf on an affine scheme is trivial. In
this case, the Cech complex (of a suitable covering) turns out to be precisely
the Amitsur complex (with the faithfully flat morphism $A \to \prod A_{f_i}$
for the $\left\{f_i\right\}$ a family generating the unit ideal). This
argument generalizes to showing that the \emph{{\'e}tale}
cohomology of a quasi-coherent sheaf on an affine is trivial; cf. \cite{Ta94}.
\end{remark} 

\subsection{Descent for modules}
Let $A \to B$ be a faithfully flat morphism of rings.
Given an $A$-module $M$, we have a natural way of getting a $B$-module $M_B = M
\otimes_A B$. We want to describe the image of this functor; alternatively,
given a $B$-module, we want to describe the image of this functor. 

Given an $A$-module $M$ and the associated $B$-module $M_B = M \otimes_A B$,
there are two ways of getting $B \otimes_A B$-modules from $M_B$, namely 
the two tensor products $M_B \otimes_B (B \otimes_A B)$ according as we pick
the first map $b \mapsto b \otimes 1$ from $B \to B \otimes_A B$ or the
second $b \mapsto 1 \otimes b$.
We shall denote these by $M_B \otimes_A B$ and $B \otimes_A M_B$ with the
action clear.
But these are naturally isomorphic because both are obtained from $M$ by
base-extension $A \rightrightarrows B \otimes_A B$, and the two maps are the
same. Alternatively, these two tensor products are 
$M \otimes_A B \otimes_A B$ and $B \otimes_A M \otimes_A B$ and these are
clearly isomorphic by the braiding isomorphism\footnote{It is \emph{not} the
braiding isomorphism $M_B \otimes_A B \simeq B \otimes_A M_B$, which is not an
isomorphism of $B \otimes_A B$-modules.
This is the isomorphism that sends $m \otimes b \otimes b'$ to $b \otimes m
\otimes b'$.
} of the first two factors as $B \otimes_A B$-modules (with the $B \otimes_A B$ part
acting on the $B$'s in the above tensor product!).

\begin{definition} 
The \textbf{category of descent data} for the faithfully flat extension $A \to
B$ is defined as follows. An object in this category consists of the following
data:
\begin{enumerate}
\item A $B$-module $N$. 
\item An isomorphism of $B \otimes_A B$-modules $\phi: N \otimes_A B \simeq B \otimes_A N$.
This isomorphism is required to make the following diagram\footnote{This is
the cocycle condition.} of $B \otimes_A B
\otimes_A B$-modules commutative:
\begin{equation} \label{dc} \xymatrix{
B \otimes_A B \otimes_A N \ar[rr]^{\phi_{23}} \ar[rd]^{\phi_{13}} & &  B \otimes_A N \otimes_A B
\ar[ld]^{\phi_{12}} \\
&  N \otimes_A B \otimes_A B 
}\end{equation}
Here $\phi_{ij}$ means that the permutation of the $i$th and $j$th factors of
the tensor product is done using the isomorphism $\phi$.
\end{enumerate}
A morphism between objects $(N, \phi), (N', \psi)$ is a morphism of
$B$-modules $f: N \to N'$ that makes the diagram
\begin{equation} \label{dc2}  \xymatrix{
N \otimes_A B \ar[d]^{f \otimes 1}  \ar[r]^{\phi} &  B \otimes_A N
\ar[d]^{1 \otimes f} \\
N' \otimes_A B \ar[r]^{\psi} &  B \otimes_A N' \\
}\end{equation}
\end{definition} 

As we have seen, there is a functor  $F$ from $A$-modules 
to descent data. 
Strictly speaking, we should check the commutativity of \eqref{dc}, but this
is clear: for $N= M\otimes_A B$,  \eqref{dc} looks like
$$
\xymatrix{
B \otimes_A B \otimes_A M \otimes_A B  \ar[rr]^{\phi_{23}} \ar[rd]^{\phi_{13}} &
&  B \otimes_A M \otimes_A B  \otimes_A B
\ar[ld]^{\phi_{12}} \\
&  M \otimes_A B \otimes_A B \otimes_A B 
}$$
Here all the maps are just permutations of the factors (that is, the braiding
isomorphisms in the structure of symmetric tensor category on the category of
$A$-modules), so it clearly commutes.

The main theorem is:

\begin{theorem}[Descent for modules]
The above functor from $A$-modules to descent data for $A \to B$ is an
equivalence of categories.
\end{theorem} 

We follow \cite{Vi08} in the proof.
\begin{proof} 
We start by describing the inverse functor from descent data to $A$-modules.
Recall that if $M$ is an $A$-module, then $M$ can be characterized as the
submodule of $M_B$ consisting of $m \in M_B$ such that $1
\otimes m$ and $m \otimes 1$ corresponded to the same thing in $M_B \otimes_A B
\simeq B \otimes_A M_B$.
(The case $M = A$ was particularly transparent: elements of $A$ were elements
$x \in B$ such that $x \otimes 1 = 1 \otimes x$ in $B \otimes_A B$.)
In other words, we had the exact sequence
\[ 0 \to M \to M_B \to M_B \otimes_A B . \]

We want to imitate this for descent data.
Namely, we want to construct a functor $G$ from descent data to $A$-modules. 
Given descent data $(N, \phi)$ where $\phi: N \otimes_A B \simeq B \otimes_A
N$ is an isomorphism of $B \otimes_A B$-modules, we define $GN$ to be 
\[ GN = \ker ( N \stackrel{n \mapsto 1 \otimes n - \psi(n \otimes 1) }{\to} B
\otimes_A N).  \]
It is clear that this is an $A$-module, and that it is functorial in the
descent data.
We have also shown that $GF (M)$ is naturally isomorphic to $M$ for any
$A$-module $M$. 

We need to show the analog for $FG(N, \phi)$; in other words, we need to show
that any descent data arises via the $F$-construction. Even before that, we
need to describe a natural transformation from $FG(N, \phi)$ to the identity.
Fix a  descent data $(N, \phi)$.
Then $G(N, \phi)$ gives an $A$-submodule $M \subset N$.
We get a morphism 
\[ f:  M_B = M \otimes_A B \to N  \]
by the universal property. This sends $m \otimes b \mapsto bm$.
The claim is that 
this is a map of descent data.
In other words, we have to show that \eqref{dc2} commutes.
The diagram looks like
\[ \xymatrix{
M_B \otimes_A B \ar[d]^{f \otimes 1} \ar[r] &  B \otimes_A M_B \ar[d]^{1
\otimes f}  \\
N \otimes_A B \ar[r]^{\phi} &  B \otimes_A N
}.\]
In other words, if $m\otimes b \in M_B$ and $b' \in B$, we have to show that
$\phi(  bm  \otimes b' ) =  (1 \otimes f)( b \otimes m \otimes b') = b \otimes
b' m$.

However, 
\[ \phi(bm \otimes b') = (b \otimes b') \phi(m \otimes 1) = (b \otimes b')(1
\otimes m) = b \otimes b'm  \]
in view of the definition of $M = GN$ as the set of elements such that $\phi(m
\otimes 1) = 1 \otimes m$, and the fact that $\phi$ is an isomorphism of $B
\otimes_A B$-modules. The equality we wanted to prove is thus clear.

So we have the two natural transformations between $FG, GF$ and the respective
identity functors. We have already shown that one of them is an isomorphism. 
Now we need to show that if $(N, \phi)$ is descent data as above, and $M =
G(N, \phi)$, the map $F(M) \to (N, \phi)$ is an \emph{isomorphism}.
In other words, we have to show that the map
\[ M \otimes_A B \to N  \]
is an isomorphism. 


Here we shall draw a commutative diagram. Namely, we shall essentially use the Amitsur
complex for the faithfully flat map $B \to B \otimes_A B$. We shall obtain a
commutative an exact diagram:
\[ \xymatrix{
0 \ar[r] &  M \otimes_A B \ar[d]   \ar[r] &  N  \otimes_A B
\ar[d]^{\phi}  \ar[r] &  N \otimes_A B \otimes_A B  \ar[d]^{\phi_{13}^{-1}}  \\
0 \ar[r] &  N   \ar[r] &  B \otimes_A N
  \ar[r] &  B \otimes_A B \otimes_A N
}.\]
Here the map $$N \otimes_A B \to N \otimes_A B \otimes_A B$$ sends $n \otimes b
\mapsto n \otimes 1 \otimes b - \phi(1 \otimes n) \otimes b$.
Consequently the first row is exact, $B$ being flat over $A$.
The bottom map
$$B \otimes_A N \to B \otimes_A N \otimes_A N$$
sends $b \otimes n \mapsto b \otimes 1 \otimes n - 1 \otimes b \otimes n$.
It follows by the Amitsur complex that the bottom row is exact too.
We need to check that the diagram commutes. Since the two vertical maps on the
right are isomorphisms, it will follow that $M \otimes_A B \to N$ is an
isomorphism, and we shall be done.

Fix $n \otimes b \in N \otimes_A B$. We need to figure out where it goes in $B
\otimes_A B \otimes_A N$ under the two maps.  Going right gives $n \otimes 1 \otimes b - \phi_{12}( 1 \otimes n \otimes
b)$.
Going down then gives
$\phi_{13}^{-1}(n \otimes 1 \otimes b) - \phi_{13}^{-1}\phi_{12}( 1 \otimes n \otimes
b) = 
\phi_{13}^{-1}(n \otimes 1 \otimes b) - \phi_{23}^{-1}(1 \otimes n \otimes
b)$, where we have used the cocycle condition.
So this is one of the maps $N \otimes_A B \to B \otimes_A B \otimes_A N$.

Now we consider the other way $n \otimes b$ can map to $B \otimes_A B \otimes_A N$.

Going down gives $\phi(n \otimes
b)$, and then going right gives the difference of two maps $N \otimes_A B \to B
\otimes_A B \otimes_A N$, which are the same as above.
\end{proof} 

\subsection{Example: Galois descent}
\add{this section}


\section{The $\tor$ functor}
 

\subsection{Introduction}
Fix $M$. The functor $N \mapsto N \otimes_R M$ is a right-exact functor on the
category of $R$-modules. We can thus consider its \emph{left-derived functors}
as in \cref{homological}. 
Recall:

\begin{definition} 
The derived functors of the tensor product functor $N \mapsto N \otimes_R M$ are denoted by
$\mathrm{Tor} _R^i( N, M), i \geq 0$.  We shall sometimes denote omit the
subscript $R$.
\end{definition} 

So in particular, $\mathrm{Tor} _R^0(M,N) = M \otimes N$.  
A priori, $\tor$ is only a functor of the first variable, but in fact, it is
not hard to see that $\tor$ is a covariant functor of two variables $M, N$. 
In fact, $\tor_R^i(M, N) \simeq \tor_R^i(N, M)$ for any two $R$-modules $M, N$.
For proofs, we refer to \cref{homological}. \textbf{ADD: THEY ARE NOT IN THAT
CHAPTER YET.}

Let us recall the basic properties of $\tor$ that follow from general facts
about derived functors. Given an exact sequence
\[ 0 \to N' \to N \to N'' \to 0 \]
we have a long exact sequence
\[ \mathrm{Tor} ^i(N',M) \to \mathrm{Tor} ^i(N,M) \to \mathrm{Tor} ^i(N'',M ) \to \mathrm{Tor} ^{i-1}(N',M) \to \dots \]
Since $\tor$ is symmetric, we can similarly get a long exact sequence if we
are given a short exact sequence of $M$'s.

Recall, moreover, that $\tor$ can be  computed explicitly (in theory). 
If we have modules $M, N$, and a projective resolution $P_* \to N$, then
$\tor_R^i(M,N)$ is the $i$th homology of the complex $M \otimes P_*$. 
We can use this to compute $\tor$ in the case of abelian groups.

\begin{example} We compute $\tor_{\mathbb{Z}}^*(A, B)$ whenever $A, B $ are abelian groups
and $B$ is finitely generated. This immediately reduces to the case of $B$
either $\mathbb{Z}$ or $\mathbb{Z}/d\mathbb{Z}$ for some $d$ by the
structure theorem. When $B= \mathbb{Z}$, there is nothing to
compute (derived functors are not very interesting on projective objects!).
Let us compute $\tor_{\mathbb{Z}}^*(A, \mathbb{Z}/d\mathbb{Z})$ for an abelian group $A$.


Actually, let us be more general and consider the case where the ring is
replaced by $\mathbb{Z}/m$ for some $m$ such that $d \mid m$. Then we will
compute $\tor_{\mathbb{Z}/m}^*(A, \mathbb{Z}/d)$ for any
$\mathbb{Z}/m$-module $A$.  The case $m = 0$
will handle the ring $\mathbb{Z}$.
Consider the projective resolution
\[ 
\xymatrix{
\cdots \ar[r]^{m/d} & \mathbb{Z}/m\mathbb{Z} \ar[r]^d & \mathbb{Z}/m\mathbb{Z} \ar[r]^{m/d} 
	%& \mathbb{Z}/m\mathbb{Z} \ar[r]^d & \mathbb{Z}/m\mathbb{Z} \ar[r]^{m/d} 
	& \mathbb{Z}/m\mathbb{Z} \ar[r]^{d} & \mathbb{Z}/m\mathbb{Z} \ar[r] & \mathbb{Z}/d\mathbb{Z} \ar[r] & 0.
}
\]
We apply $A \otimes_{\mathbb{Z}/m\mathbb{Z}} \cdot$. Since tensoring (over
$\mathbb{Z}/m$!) with $\mathbb{Z}/m\mathbb{Z}$ does nothing, we  obtain the complex
\[ 
\xymatrix{
\cdots \ar[r]^{m/d} & A \ar[r]^d & A \ar[r]^{m/d} 
	& A \ar[r]^{d} & A \ar[r] & 0.
}
\]
The groups $\Tor_n^{\mathbb{Z}/m\mathbb{Z}} (A, \mathbb{Z}/d\mathbb{Z})$ are simply the homology groups
(ker/im) of
the complex, which are simply 
\begin{align*} 
\Tor_0^{\mathbb{Z} / m\mathbb{Z}} (A, \mathbb{Z}/d\mathbb{Z}) &\cong A / dA \\
\Tor_n^{\mathbb{Z} / m\mathbb{Z}} (A, \mathbb{Z}/d\mathbb{Z}) &\cong {}_dA/(m/d)A 
			\quad \text{$n$ odd, $n \ge 1$} \\
\Tor_n^{\mathbb{Z} / m\mathbb{Z}} (A, \mathbb{Z}/d\mathbb{Z}) &\cong {}_{m/d}A/dA 
			\quad \text{$n$ even, $n \ge 2$},
\end{align*} 
where ${}_kA = \{ a \in A \mid ka = 0 \}$ denotes the set of elements of $A$
killed by $k$.
\end{example} 


The symmetry of the tensor product also provides with a simple proof that
$\tor$ commutes with filtered colimits. 
\begin{proposition} \label{torfilteredcolim}
Let $M$ be an $R$-module, $\left\{N_i\right\}$ a filtered system of
$R$-modules. Then the natural morphism
\[  \varinjlim_i \tor_R^i(M, N_i) \to \tor^i_R(M, \varinjlim_i N_i)   \]
is an isomorphism.
\end{proposition} 
\begin{proof} 
We can see this explicitly. Let us compute the $\tor$ functors by choosing a
projective resolution $P_* \to M$ of $M$ (note that which factor we use is irrelevant, by
symmetry!). Then the left side is the colimit
\( \varinjlim H(P_* \otimes N_i)  \), while the right side is $H(P_* \otimes
\varinjlim N_i)$. But tensor products commute with filtered (or arbitrary)
colimits, since the tensor product admits a right adjoint. Moreover, we know
that homology commutes with filtered colimits. Thus the natural map is an
isomorphism.
\end{proof} 


\subsection{$\tor$ and flatness}

$\tor$ provides a simple way of detecting flatness. Indeed, one of the basic applications of this is that for a flat module $M$, the tor-functors vanish for $i \geq 1$ (whatever be $N$).
Indeed, recall that $\mathrm{Tor} (M,N)$ is computed by taking a projective resolution of $N$,
\[ \dots \to P_2 \to P_1 \to P_0 \to M \to 0 \]
tensoring with $M$, and taking the homology.  But tensoring with $M$ is exact if we have flatness, so the higher $\mathrm{Tor} $ modules vanish.

The converse is also true. In fact, something even stronger holds:
\begin{proposition} $M$ is flat iff $\mathrm{Tor} ^1(M,R/I)=0$ for all finitely generated ideals $I \subset R$.
\end{proposition}
\begin{proof}
We have just seen one direction. 
Conversely, suppose $\mathrm{Tor} ^i(M,R/I) = 0$ for all finitely generated
ideals $I$ and $i>0$. 
Then the result holds, first of all, for all ideals $I$, because of
\cref{torfilteredcolim} and the fact that $R/I$ is always the colimit of $R/J$
as $J$ ranges over finitely generated ideals $J \subset I$.

We now show that $\tor^i(M, N) = 0$ whenever $N$ is finitely generated. To do
this, we induct on the number of generators of $N$. When $N$ has one
generator, it is cyclic and we are done. Suppose we have proved the result
whenever for modules that have $n-1$ generators or less, and suppose $N$ has
$n$ generators.
Then we can consider an exact sequence of the form
\[ 0 \to N' \hookrightarrow N \twoheadrightarrow N'' \to 0  \]
where $N'$ has $n-1$ generators and $N''$ is cyclic. Then the long exact
sequence shows that $\tor^i(M, N) = 0$ for all $i \geq 1$.

Thus we see that $\tor^i(M, N)  = 0$ whenever $N$ is finitely generated. Since
any module is a filtered colimit of finitely generated ones, we are done by
\cref{torfilteredcolim}.
\end{proof}


Note that there is an exact sequence $0 \to I \to R \to R/I \to 0$ and
so
\[ \mathrm{Tor} _1(M,R)=0 \to \mathrm{Tor} _1(M,R/I) \to I \otimes M \to M \]
is exact, and by this:

\begin{corollary} 
If the map
\[ I \otimes M \to M \]
is injective for all ideals $I$, then $M$ is flat.
\end{corollary} 


\section{Flatness over noetherian rings}

We shall be able to obtain simpler criterion for flatness when the ring in
question is noetherian local. For instance, we have already seen:

\begin{theorem} 
If $M$ is a finitely generated module over a noetherian local ring $R$ (with
residue field $k$), then $M$ is free if and only if
$\tor_1(k, M) = 0$.
\end{theorem} 

In particular, flatness is the same thing as the vanishing of \emph{one}
$\tor$ module, and it equates to freeness. Now, we want to generalize this
result to the case where $M$ is not necessarily finitely generated over $R$,
but finitely generated over an $R$-algebra that is also noetherian local. In
particular, we shall get useful criteria for when an extension of
noetherian local \emph{rings}
(which in general is not finite, or even finitely generated)
is flat.

We shall prove two main criteria. The \emph{local criterion} is a direct
generalization of the above result (the vanishing of one $\tor$ group). The
\emph{infinitesimal criterion} reduces checking flatness of $M$ to checking
flatness of $M \otimes_R R/\mathfrak{m}^t$ over $R/\mathfrak{m}^t$; in
particular, it reduces to the case where the base ring is \emph{artinian.}
Armed with these, we will be able to prove a rather difficult theorem that
states that we can always find lots of flat extensions of noetherian local
rings. 

\subsection{Flatness over a noetherian local ring}

We shall place ourselves in the following situation. $R, S$ are noetherian
local rings with maximal ideals $\mathfrak{m} \subset R, \mathfrak{n} \subset
S$, and $S$ is an $R$-algebra (and the morphism $R \to S$ is \emph{local}, so
$\mathfrak{m}S \subset \mathfrak{n}$).
We will want to know when a $S$-module is flat over $R$. In particular, we
want a criterion for when $S$ is flat over $R$.

\begin{theorem} \label{localcrit} The finitely generated $S$-module $M$ is flat over $R$ iff
\[ \mathrm{Tor} ^1_R( k, M) = 0.\]
In this case, $M$ is even free.
\end{theorem}

It is actually striking how little the condition that $M$ is a finitely
generated $S$-module enters, or how irrelevant it seems in the statement. The
argument will, however, use the fact that $M$ is \emph{separated} with respect
to the $\mathfrak{m}$-adic topology, which relies on Krull's intersection
theorem (note that since $\mathfrak{m} S \subset \mathfrak{n}$, the
$\mathfrak{m}$-adic topology on $M$ is separated).

\begin{proof} 
Necessity is immediate.  What we have to prove is sufficiency.

First, we claim that if $N$ is an $R$-module of finite length, then
\begin{equation} \label{vanishingtorlocal} \mathrm{Tor} ^1_R( N,
M)=0.\end{equation}
This is because $N$ has by d{\'e}vissage (\cref{filtrationlemma}) a finite  filtration
$N_i$ whose quotients are of the form $R/\mathfrak{p}$ for $\mathfrak{p}$
prime and (by finite length hypothesis) $\mathfrak{p}= \mathfrak{m}$. So we
have a filtration on $M$ whose successive quotients are isomorphic to $k$. 
We can then climb up the filtration to argue that $\tor^1(N_i, M) = 0$ for
each $i$.

Indeed, the claim \eqref{vanishingtorlocal} is true $N_0=0 \subset N$ trivially.  We climb up the filtration piece by piece inductively; if $\mathrm{Tor} ^1_R(N_i, M)=0$, then the exact sequence
\[ 0 \to N_i \to N_{i+1} \to k \to 0 \]
yields an exact sequence
\[ \mathrm{Tor} ^1_R(N_i, M) \to \mathrm{Tor} ^1_R(N_{i+1}, M) \to 0 \]
from the long exact sequence of $\mathrm{Tor} $ and the hypothesis on $M$.
The claim is proved.


Now we want to prove that $M$ is flat. The idea is to show that $I \otimes_RM
\to M$ is injective for any ideal $I \subset R$.  We will use some diagram chasing and the Krull intersection theorem on the kernel $K$ of this map, to interpolate between it and various quotients by powers of $\mathfrak{m}$.
First we write some exact sequences.

We have an exact sequence
\[ 0 \to \mathfrak{m}^t \cap I \to I \to I/I \cap \mathfrak{m}^t \to 0\]
which we tensor with $M$:
\[   \mathfrak{m}^t \cap I \otimes M \to I \otimes M \to I/I \cap \mathfrak{m}^t \otimes M \to 0.\]

The sequence
\[ 0 \to  I/I  \cap \mathfrak{m}^t \to R/\mathfrak{m}^t \to R/(I+\mathfrak{m}^t) \to 0\]
is also exact, and tensoring with $M$ yields an exact sequence:
\[ 0 \to  I/I  \cap \mathfrak{m}^t \otimes M  \to M/\mathfrak{m}^tM  \to M/(\mathfrak{m}^t  + I) M \to 0\]
because $\mathrm{Tor} ^1_R(M,   R/(I+\mathfrak{m}^t))=0$ by
\eqref{vanishingtorlocal}, as $R/(I + \mathfrak{m}^t)$ is of finite length.

Let us draw the following commutative diagram:
\begin{equation} \label{keyflatnessdiag}
\xymatrix{
& & 0 \ar[d] \\
\mathfrak{m}^t \cap I \otimes M \ar[r] & I \otimes M \ar[r] & I/I \cap \mathfrak{m}^t \otimes M \ar[d] \\
& & M/\mathfrak{m}^t M 
} \end{equation}

Here the column and the row are exact.
As a result, if an element in $I \otimes M$ goes to zero in $M$ (a fortiori
in  $M/\mathfrak{m}^tM$) it must come from $\mathfrak{m}^t \cap I \otimes M$
for all $t$.  Thus, by the Artin-Rees lemma, it belongs to $\mathfrak{m}^t(I \otimes M)$ for all $t$, and the Krull intersection theorem (applied to $S$, since $\mathfrak{m}S \subset \mathfrak{n}$) implies it is zero.

\end{proof} 

\subsection{The infinitesimal criterion for flatness}

\begin{theorem} \label{infcriterion} Let $R$ be a noetherian local ring, $S$ a noetherian local
$R$-algebra. Let $M$ be a finitely generated module over $S$.  Then $M$ is
flat over $R$ iff $M/\mathfrak{m}^tM$ is flat over $R/\mathfrak{m}^t$ for all $t>0$.
\end{theorem}
\begin{proof} 
One direction is easy, because flatness is preserved under base-change $R \to
R/\mathfrak{m}^t$. 
For the other direction, suppose $M/\mathfrak{m}^t M$ is flat over
$R/\mathfrak{m}^t$ for all $t$. Then, we need to show that if $I \subset R$ is any ideal,
then the map $I \otimes_R M \to M$ is injective. We shall argue that the
kernel is zero using the Krull intersection theorem.

Fix $t \in \mathbb{N}$. As before, the short exact sequence of
$R/\mathfrak{m}^t$-modules  $0 \to
I/(\mathfrak{m}^t \cap I) \cap R/\mathfrak{m}^t  \to R/(\mathfrak{m}^t \cap I) \to 0$ gives an exact
sequence (because $M/\mathfrak{m}^t M$ is $R/\mathfrak{m}^t$-flat)
\[ 0 \to  I/I  \cap \mathfrak{m}^t \otimes M  \to M/\mathfrak{m}^tM  \to M/(\mathfrak{m}^t  + I) M \to 0\]
which we can fit into a diagram, as in \eqref{keyflatnessdiag}
$$\xymatrix{
& & 0 \ar[d] \\
\mathfrak{m}^t \cap I \otimes M \ar[r] & I \otimes M \ar[r] & I/I \cap \mathfrak{m}^t \otimes M \ar[d] \\
& & M/\mathfrak{m}^t M 
}.$$

The horizontal sequence was always exact, as before.  The vertical sequence can be argued to be exact by tensoring the exact sequence 
\[ 0 \to  I/I  \cap \mathfrak{m}^t \to R/\mathfrak{m}^t \to R/(I+\mathfrak{m}^t) \to 0\]
of $R/\mathfrak{m}^t$-modules with $M/\mathfrak{m}^tM$, and using flatness of
$M/\mathfrak{m}^t M$ over $R/\mathfrak{m}^t$ (and \cref{}).
Thus we get flatness of $M$ as before.
\end{proof} 

Incidentally, if we combine the local and infinitesimal criteria for flatness, we get a little more.

\begin{comment}
%% THIS IS NOT ADDED YEt
\subsection{The $\gr$ criterion for flatness}

Suppose $(R, \mathfrak{m})$ is a noetherian local ring and $(S, \mathfrak{n})$
a local $R$-algebra.
As usual, we are interested in criteria for when a finitely generated
$S$-module $M$ is flat over $R$.

We can, of course, endow $M$ with the $\mathfrak{m}$-adic topology. 
Then $M$ is a filtered module over the filtered ring $R$ (with the
$\mathfrak{m}$-adic topology).
We have morphisms for each $i$,
\[ \mathfrak{m}^i/\mathfrak{m}^{i +1} \otimes_{R/\mathfrak{m}}
M/\mathfrak{m}M \to \mathfrak{m}^i M/\mathfrak{m}^{i+1} M  \]
that induce map
\[ \gr(R) \otimes_{R/\mathfrak{m}}  M/\mathfrak{m}M \to \gr(M). \]

If $M$ is flat over 
\end{comment}

\subsection{Generalizations of the local and infinitesimal criteria}
In the previous subsections, we obtained results that gave criteria for when,
given a local homomorphism of noetherian local rings $(R, \mathfrak{m}) \to
(S, \mathfrak{n})$, a finitely generated $S$-module was $R$-flat. 
These criteria generally were related to the $\tor$ groups of the module with
respect to $R/\mathfrak{m}$.
We are now interested in generalizing the above results to the setting where
$\mathfrak{m}$ is replaced by an ideal that \emph{maps into the Jacobson radical of $S$.}
In other words, 
\[ \phi: R \to S  \]
will be a homomorphism of noetherian rings, and $J \subset R$ will be an ideal
such that $\phi(J)$ is contained in every maximal ideal of $S$. 

Ideally, we are aiming for results of the following type:
\begin{theorem}[Generalized local criterion for flatness] \label{localcritg}
Let $\phi: R \to S$ be a morphism of noetherian rings, $J \subset R$ an ideal
with $\phi(J) $ contained in the Jacobson radical of $S$.
Let $M$ be a finitely generated $S$-module. Then $M$ is $R$-flat if and only if
$M /JM$ is $R/J$-flat and $\tor_1^R(R/J, M) = 0$.
\end{theorem} 

Note that this is a generalization of \cref{localcrit}. In that case, $R/J$ was
a field and the $R/J$-flatness of $M/JM$ was automatic.
One key step in the proof of \cref{localcrit} was to go from the hypothesis
that $\tor_1(M, k) = 0$ to $\tor_1(M, N) =0 $ whenever $N$ was an $R$-module of
\emph{finite length.}
We now want to do the same in this generalized case; the analogy would be
that, under the hypotheses of \cref{localcritg}, we would like to conclude
that $\tor_1^R(M, N) = 0$ whenever $N$ is a finitely generated $R$-module
\emph{annihilated by $I$}. 
This is not quite as obvious because we cannot generally find a filtration on
$N$ whose successive quotients are $R/J$ (unlike in the case where $J$ was
maximal).
Therefore we shall need two lemmas.

\begin{remark} 
One situation where the strong form of the local criterion, \cref{localcritg},
is used is in Grothendieck's proof (cf. EGA IV-11, \cite{EGA}) that the locus of points where a coherent
sheaf is flat is open (in commutative algebra language, if $A$ is noetherian
and $M$ finitely generated over a finitely generated $A$-algebra $B$, then the
set of primes $\mathfrak{q} \in \spec B$ such that $M_{\mathfrak{q}}$ is
$A$-flat is open in $\spec  B$).
\end{remark} 

\begin{lemma}[Serre] \label{serrelemma}
Suppose $R$ is a ring, $S$ an $R$-algebra, and $M$ an $S$-module. 
Then the following are equivalent:
\begin{enumerate}
\item $M \otimes_R S$ is $S$-flat and $\tor_1^R(M, S) = 0$. 
\item $\tor_1^R(M, N) = 0$ whenever $N$ is any  $S$-module.
\end{enumerate}
\end{lemma} 
We follow \cite{SGA1}.
\begin{proof} 
Let $P$ be an $S$-module (considered as fixed), and $Q$ any (variable) $R$-module.
Recall that there is a homology spectral sequence
\[ \tor_p^S(\tor_q^R(Q, S), P) \implies \tor_{p+q}^R(Q,P).  \]
Recall that this is the Grothendieck spectral sequence of the composite functors
\[ Q \mapsto Q \otimes_R S, \quad Q' \mapsto Q' \otimes_S P  \]
because
\[ (Q \otimes_R S) \otimes_S P \simeq Q \otimes_R P.  \]
\add{This, and generalities on spectral sequences, need to be added!}
From this spectral sequence, it will be relatively easy to deduce
the result.
\begin{enumerate}
\item Suppose $M \otimes_R S$ is $S$-flat and $\tor_1^R(M, S) = 0$.
We want to show that 2 holds, so let $N$ be any $S$-module.
Consider the $E_2$ page of the above spectral sequence
 $\tor_p^S(\tor_q^R(M, S), N) \implies \tor_{p+q}^R(M, N)$.
 In the terms such that $p+q = 1$, we have the two terms 
$\tor_0^S(\tor_1^R(M, S), N), \tor_1^S(\tor_0^R(M, S),N)$.
But by hypotheses these are both zero. It follows that $\tor_1^R(M, N) = 0$.
\item Suppose $\tor_1^R(M, N) = 0$ for each $S$-module $N$.
Since this is a {homology} spectral sequence, this implies that the 
$E_2^{10}$ term vanishes (since nothing will be able to hit this term).
In particular $\tor_1^S(M \otimes_R  S, N) = 0$ for each $S$-module $N$.
It follows that $M \otimes_R S$ is $S$-flat.
Hence the higher terms $\tor_p^S(M \otimes_R S, N) = 0$ as well, so the botton row of
the $E_2$ page (except $(0,0)$) is thus entirely zero. It follows that the
$E_{01}^2$ term vanishes if $E_{\infty}^{01}$ is trivial.
This gives that $\tor_1^R(M, S) \otimes_S N = 0$ for every $S$-module $N$,
which clearly implies $\tor_1^R(M, S) = 0$.
\end{enumerate}
\end{proof} 

As a result, we shall be able to deduce the result alluded to in the motivation
following the statement of \cref{localcritg}.

\begin{lemma} 
Let $R$ be a noetherian ring, $J \subset R$ an ideal, $M$ an $R$-module. Then TFAE:
\begin{enumerate}
\item $\tor_1^R(M, R/J) = 0$ and $M/JM$ is $R/J$-flat. 
\item $\tor_1^R(M, N) = 0$ for any finitely generated $R$-module $N$
annihilated by a power of $J$.
\end{enumerate}
\end{lemma} 
\begin{proof} 
This is immediate from \cref{serrelemma}, once one notes that any $N$ as in the
statement admits a finite filtration whose successive quotients are annihilated
by $J$.
\end{proof} 
\begin{proof}[Proof of \cref{localcritg}]
Only one direction is nontrivial, so suppose $M$ is a finitely generated
$S$-module, with $M/JM$ flat over $R/J$ and $\tor_1^R(M, R/J) = 0$.
We know by the lemma that $\tor_1^R(M, N) = 0$ whenever $N$ is finitely
generated and annihilated by a power of $J$.


So as to avoid repeating the same argument over and over, we encapsulate it in
the following lemma.
\begin{lemma} \label{flatlemma} Let the hypotheses be as in \cref{localcritg}
Suppose for every ideal $I \subset R$, and every $t \in \mathbb{N}$, the map
\[ I/I \cap J^t \otimes M \to M/J^t M  \]
is an injection. Then $M$ is $R$-flat.
\end{lemma} 
\begin{proof} 
Indeed, then as before, the kernel of $I \otimes_R M \to M$ lives inside the image of $(I \cap J^t)
\otimes M \to I \otimes_R M$ for \emph{every} $t$; by the Artin-Rees lemma, and the Krull
intersection theorem (since $\bigcap J^t(I \otimes_R M) = \{0\}$), it follows that this kernel is zero.
\end{proof} 

It is now easy to finish the proof. Indeed, we can verify the hypotheses of the
lemma by noting that
\[ I /I \cap J^t \otimes M \to I \otimes M  \]
is obtained by tensoring with $M$ the sequence
\[ 0 \to I/I \cap J^t \to R/(I \cap J^t) \to R/(I + J^t) \to 0.  \]
Since $\tor_1^R(M, R/(I + J^t)) = 0$, we find that the map as in the lemma is
an injection, and so we are done.
\end{proof} 

The reader can similarly formulate a version of the infinitesimal criterion in
this more general case using \cref{flatlemma} and the argument in
\cref{infcriterion}. (In fact, the spectral sequence argument of this section
is not necessary.) We shall not state it here, as it will appear as a
component of \cref{bigflatcriterion}. We leave the details of the proof to the reader.

\subsection{The final statement of the flatness criterion}

We shall now bundle the various criteria for flatness into one big result,
following \cite{SGA1}:

\begin{theorem} \label{bigflatcriterion}
Let $A, B$ be noetherian rings, $\phi: A \to B$ a morphism making $B$ into an
$A$-algebra. Let $I$ be an ideal of $A$ such that $\phi(I)$ is contained in the
Jacobson radical of $B$.
Let $M$ be a finitely generated $B$-module.
Then the following are equivalent:
\begin{enumerate}
\item $M$ is $A$-flat. 
\item (Local criterion) $M/IM$ is $A/I$-flat and $\tor_1^A(M, A/I) = 0$.
\item (Infinitesimal criterion)  $M/I^n M$ is $A/I^n$-flat for each $n$.
\item (Associated graded criterion)  $M/IM$ is $A/I$-flat and $M/IM \otimes_{A/I} I^n/I^{n+1} \to I^n
M/I^{n+1}M$ is an isomorphism for each $n$.
\end{enumerate}
\end{theorem} 

The last criterion can be phrased as saying that the $I$-adic \emph{associated
graded} of $M$ is determined by $M/IM$.
\begin{proof} 
We have already proved that the first three are equivalent. It is easy to see
that flatness of $M$ implies that
\begin{equation} \label{flatwantiso} M/IM \otimes_{A/I} I^n/I^{n+1} \to I^n
M/I^{n+1}M  \end{equation}
is an isomorphism for each $n$.
Indeed, this easily comes out to be the quotient of $M \otimes_A I^n$ by the
image of $M \otimes_A I^{n+1}$, which is $I^n M/I^{n+1}M$ since the map $M
\otimes_A I^n \to I^n M$ is an isomorphism.
Now we need to show that this last condition implies flatness.
To do this, we may (in view of the infinitesimal criterion) assume that $I$ is
\emph{nilpotent}, by base-changing to $A/I^n$.
We are then reduced to showing that $\tor_1^A(M, A/I) = 0$ (by the local
criterion).
Then we are, finally, reduced to showing:

\begin{lemma} 
Let $A$ be a ring, $I \subset A$ be a nilpotent ideal, and $M$ any $A$-module.
If \eqref{flatwantiso} is an isomorphism for each $n$, then 
$\tor_1^A(M, A/I) = 0$.
\end{lemma} 
\begin{proof} 
This is equivalent to the assertion, by a diagram chase, that
\[ I \otimes_A M \to M  \]
is an injection.
We shall show more generally that $I^n \otimes_A M \to M$ is an injection for
each $n$. When $n \gg 0$, this is immediate, $I$ being nilpotent. So we can use
descending induction on $n$.

Suppose $I^{n+1} \otimes_A M \to I^{n+1}M$ is an isomorphism.
Consider the diagram
\[ \xymatrix{
& I^{n+1} \otimes_A M \ar[r] \ar[d]  &  I^n \otimes_A M \ar[r]  \ar[d]  &
I^n/I^{n+1}  \otimes_A M \ar[d] \to
0 \\
0 \ar[r] &  I^{n+1}M \ar[r] & I^n M \ar[r] & I^nM/I^{n+1}M \ar[r] &  0.
}\]
By hypothesis, the outer two vertical arrows are isomorphisms. Thus the middle
vertical arrow is an isomorphism as well. This completes the induction
hypothesis.
\end{proof} 
\end{proof} 

Here is an example of the above techniques:
\begin{proposition} 
\label{fiberwiseflat}
Let $(A, \mathfrak{m}), (B, \mathfrak{n}), (C, \mathfrak{n}')$ be noetherian
local rings. Suppose given a commutative diagram of local homomorphisms
\[ \xymatrix{
B \ar[rr]  & & C \\
& A \ar[ru] \ar[lu].
}\]
Suppose $B, C$ are flat $A$-algebras, and $B/\mathfrak{m}B \to C/\mathfrak{m}C$
is a flat morphism. Then $B \to C$ is flat.
\end{proposition} 
Geometrically, this means that flatness can be checked fiberwise if both
objects are flat over the base.
This will be  a useful technical fact.
\begin{proof} 
We will use the associated graded criterion for flatness with the ideal
$I = \mathfrak{m}B \subset B$. (Note that we are \emph{not} using the criterion
with the maximal ideal here!) Namely, we shall show
that
\begin{equation} \label{monkey}  I^n/I^{n+1} \otimes_{B/I} C/IC \to I^n
C/I^{n+1}C \end{equation}
is an isomorphism. By \cref{bigflatcriterion}, this will do it. Now we have: 
\begin{align*}  
 I^n/I^{n+1} \otimes_{B/I} C/IC & \simeq 
\mathfrak{m}^nB/\mathfrak{m}^{n+1}B \otimes_{B/\mathfrak{m}B}
C/\mathfrak{m}C  \\ & \simeq
(\mathfrak{m}^n/\mathfrak{m}^{n+1})\otimes_{A} B/\mathfrak{m}B \otimes_B
C/\mathfrak{m}C  \\
& \simeq (\mathfrak{m}^n/\mathfrak{m}^{n+1})\otimes_{A} B \otimes_B
C/\mathfrak{m}C \\
& \simeq (\mathfrak{m}^n/\mathfrak{m}^{n+1})\otimes_{A} C/\mathfrak{m}C \\
& \simeq \mathfrak{m}^nC/\mathfrak{m}^{n+1} C \simeq I^n C/I^{n+1}C.
\end{align*}
In this chain of equalities, we have used the fact that $B, C$ were flat over
$A$, so their associated gradeds with respect to $\mathfrak{m} \subset A$
behave nicely. It follows that \eqref{monkey} is an isomorphism, completing the
proof.
\end{proof} 

\subsection{Flatness over regular local rings}

Here we shall prove a result that implies geometrically, for instance, that a
finite morphism between smooth varieties is always flat.

\begin{theorem}[``Miracle'' flatness theorem]
Let $(A, \mathfrak{m})$  be a regular local (noetherian) ring. Let $(B,
\mathfrak{n})$ be a Cohen-Macaulay, local $A$-algebra such that 
\[ \dim B = \dim A + \dim B/\mathfrak{m}B . \]
Then $B$ is flat over $A$.
\end{theorem} 
Recall that \emph{inequality} $\leq$ always holds in the above for any
morphism of noetherian local rings (\cref{}), and
equality always holds with flatness supposed. 
We get a partial converse.

\begin{proof} 
We shall work by induction on $\dim A$. 
Let $x \in \mathfrak{m}$ be a non-zero divisor, so the first element in a
regular sequence of parameters. 
We are going to show that $(A/(x), B/(x))$ satisfies the same hypotheses. 
Indeed, note that 
\[ \dim B/(x) \leq \dim A/(x) + \dim B/\mathfrak{m}B  \]
by the usual inequality. Since $\dim A/(x) = \dim A - 1$, 
we find that quotienting by $x$ drops the dimension of $B$ by at least one: that is,
$\dim B/(x) \leq \dim B - 1$. By the principal ideal theorem, we have equality,
\[ \dim B/(x) = \dim B - 1.  \]

The claim is that $x$ is a non-zero divisor in $B$, and consequently we can
argue by induction.
Indeed, but $B$ is \emph{Cohen-Macaulay}. Thus, any zero-divisor in $B$ lies in a
\emph{minimal} prime (since all associated primes of $B$ are minimal); thus
quotienting by a zero-divisor would not bring down the degree. So $x$ is a
nonzerodivisor in $B$.

In other words, we have found $x \in A$ which is both $A$-regular and
$B$-regular (i.e. nonzerodivisors on both), and such that the hypotheses of the theorem apply to the pair
$(A/(x), B/(x))$. It follows that $B/(x)$ is flat over $A/(x)$ by the 
inductive hypothesis. The next lemma will complete the proof.
\end{proof} 


\begin{lemma} 
Suppose $(A, \mathfrak{m})$ is a noetherian local ring, $(B, \mathfrak{n})$ a
noetherian local $A$-algebra, and $M$ a finite $B$-module. Suppose $x \in A$ is
a regular element of $A$ which is also regular on $M$.
Suppose moreover $M/xM$ is $A/(x)$-flat. Then $M$ is flat over $A$.
\end{lemma} 
\begin{proof} 
This follows from the associated graded criterion for flatness (see the
omnibus result \cref{bigflatcriterion}).
Indeed, if we use the notation of that result, we take $I = (x)$.
We are given that $M/xM$ is $A/(x)$-flat. So we need to show that
\[ M/xM \otimes_{A/(x)}  (x^n)/(x^{n+1}) \to x^n M/x^{n+1}M \]
is an isomorphism for each $n$. This, however, is implied because
$(x^n)/(x^{n+1})$ is isomorphic to $A/(x)$ by regularity, and multiplication 
\[ M \stackrel{x^n}{\to} x^n M, \quad xM \stackrel{x^n}{\to} x^{n+1}M \]
are isomorphisms by $M$-regularity. 
\end{proof} 
\subsection{Example: construction of flat extensions}

As an illustration of several of the techniques in this chapter and previous
ones, we shall show, following \cite{EGA} (volume III, chapter 0) that, given a
local ring and an extension of its residue field, one may find a flat
extension of this local ring with the bigger field as \emph{its} residue
field. One application of this is in showing (in the context of Zariski's
Main Theorem) that the fibers of a birational
projective morphism of noetherian schemes (where the target is normal) are
\emph{geometrically} connected.
We shall later give another application in the theory of \'etale morphisms.

\begin{theorem} 
Let $(R, \mathfrak{m})$ be a noetherian local ring with residue field $k$.
Suppose $K$ is an extension of $k$. Then there is a noetherian local
$R$-algebra $(S,
\mathfrak{n})$ with residue field $K$ such that $S$ is flat over $R$ and $\mathfrak{n} =
\mathfrak{m}S$.
\end{theorem} 

\begin{proof} 
Let us start by motivating the theorem when $K$ is generated over $k$ by
\emph{one} element. 
This case can be handled directly, but the general case will require a
somewhat tricky passage to the limit.
There are two cases.

\begin{enumerate}
\item  
First, suppose $K = k(t)$ for $t \in K$ \emph{transcendental} over $k$. In
this case, we will take $S$ to be a suitable localization of $R[t]$. Namely,
we consider the prime\footnote{It is prime because the quotient is the domain
$k[t]$.} ideal $\mathfrak{m} R[t] \subset R[t]$, and let
$S = (R[t])_{\mathfrak{m} R[t]}$. 
Then $S$ is clearly noetherian and local, and moreover $\mathfrak{m}S$ is the
maximal ideal of $S$. The residue field of $S$ is $S/\mathfrak{m}S $, which is
easily seen to be the quotient field of $R[t]/\mathfrak{m}R[t] = k[t]$, and is
thus isomorphic to $K$. Moreover, as a localization of a polynomial ring, $S$
is flat over $R$.
Thus we have handled the case of a purely transcendental extension generated
by one element.

\item 
Let us now suppose $K = k(a)$ for $a \in K$ \emph{algebraic} over $k$. Then
$a$ satisfies a monic irreducible polynomial $\overline{p}(T)$ with coefficients in $k$.
We lift $\overline{p}$ to a monic polynomial $p(T) \in R[T]$. The claim is
that then, $S = R[T]/(p(T))$ will suffice.

Indeed, $S$ is clearly flat over $R$ (in fact, it is free of rank $\deg p$).
As it is finite over $R$, $S$ is noetherian. Moreover, $S/\mathfrak{m}S = k[T]/
(p(T)) \simeq K$. It follows that $\mathfrak{m}S \subset S$ is a maximal ideal
and that the residue field is $K$. Since any maximal ideal of $S$ contains
$\mathfrak{m}S$ by Nakayama,\footnote{\add{citation needed}} we see that $S$
is local as well. Thus we have showed that $S$ satisfies all the conditions we
want.
\end{enumerate}

So we have proved the theorem when $K$ is generated by one element over $k$.
In general, we can iterate this procedure finitely many times, so that the
assertion is clear when $K$ is a finitely generated extension of $k$.
Extending to infinitely generated extensions is trickier.

Let us first argue that we can write $K/k$ as a ``transfinite limit'' of
monogenic extensions. Consider the set of   well-ordered collections
$\mathcal{C}'$ of subfields between $k$ and $K$ (containing $k$) such that if $L \in
\mathcal{C}'$ has an immediate predecessor $L'$, then $L/L'$ is generated by
one element. First, such collections $\mathcal{C}'$ clearly exist; we can take
the one consisting only of $k$. The set of such collections is clearly a
partially ordered set such that every chain has an upper bound. 
By Zorn's lemma, there is a \emph{maximal} such collection of subfields, which
we now call $\mathcal{C}$.

The claim is that $\mathcal{C}$ has a maximal field, which is $K$. Indeed, if
it had no maximal element, we could adjoin the union $\bigcup_{F \in
\mathcal{C}} F$ to $\mathcal{C}$ and make $\mathcal{C}$ bigger, contradicting
maximality. If this maximal field of $\mathcal{C}$ were not $K$, then we could add another
element to this maximal subfield and get a bigger collection than
$\mathcal{C}$, contradiction.

So thus we have a  set of fields $K_\alpha$ (with $\alpha$, the
index, ranging over a well-ordered set) between $k$ and $K$,
such that if $\alpha$ has a successor $\alpha'$, then 
$K_\alpha'$ is generated by one element over $K_\alpha$. Moreover $K$ is the
largest of the $K_\alpha$, and $k$ is the smallest. 

We are now going to define a collection of rings $R_\alpha$ by transfinite
induction on $\alpha$. We start the induction with $R_0 = R$ (where $0$ is the
smallest allowed $\alpha$). The inductive hypothesis that we will want to
maintain is that $R_\alpha$ is a noetherian local ring with maximal ideal
$\mathfrak{m}_\alpha$, flat over $R$ and
satisfying $\mathfrak{m} R_\alpha = \mathfrak{m}_\alpha$; we require,
moreover, that the residue field of $R_\alpha$ be $K_\alpha$. Thus if we can
do this at each step, we will be able to work up to $K$ and get the ring $S$
that we want. 
We are, moreover, going to construct the $R_\alpha$ such that whenever $\beta <
\alpha$, $R_\alpha$ is a $R_\beta$-algebra.

Let us assume that $R_\beta$ has been defined for all $\beta < \alpha$ and
satisfies the conditions. Then
we want to define $R_\alpha$ in an appropriate way. If we can do this, then we
will have proved the result. 
There are two cases:
\begin{enumerate}
\item $\alpha$ has an immediate predecessor $\alpha_{pre} $. In this case, we
can define $R_\alpha$ from $R_{\alpha_{pre}}$ as above (because
$K_\alpha/K_{\alpha_{pre}}$ is monogenic).
\item $\alpha$ has no immediate predecessor. Then we define $R_\alpha =
\varinjlim_{\beta < \alpha} R_\beta$. The following lemma will show that
$R_\alpha$ satisfies the appropriate hypotheses.
\end{enumerate}
This completes the proof, modulo \cref{indlimnoetherianlocal}.
\end{proof} 

We shall need the following lemma to see that we preserve noetherianness when
we pass to the limit.
\begin{lemma}\label{indlimnoetherianlocal} 
Suppose given an inductive system $\left\{(A_\alpha,
\mathfrak{m}_{\alpha})\right\}$ of noetherian
rings and flat local homomorphisms, starting with $A_0$.
Suppose moreover that $\mathfrak{m}_{\alpha} A_{\beta} = \mathfrak{m}_{\beta}$
whenever $\alpha < \beta$.

Then $A = \varinjlim A_\alpha$ is a
noetherian local ring, flat over each $A_\alpha$. Moreover, if $\mathfrak{m} \subset A$
is the maximal ideal, then $\mathfrak{m}_\alpha A = \mathfrak{m}$. The residue
field of $A$ is $\varinjlim A_\alpha/\mathfrak{m}_\alpha$.
\end{lemma}
\begin{proof} 
First, it is clear that $A$ is a local ring (\cref{} \add{reference!}) with
maximal ideal equal to $\mathfrak{m}_\alpha A$ for any $\alpha $ in the
indexing set, and that $A$ has the appropriate residue field. Since filtered colimits preserve flatness, flatness of $A$ is
also clear. 
We need to show that $A$ is noetherian; this is the crux of the lemma. 

To prove that $A$ is noetherian, we are going to show that its
$\mathfrak{m}$-adic completion $\hat{A}$ is noetherian. Fortunately, we have a
convenient criterion for this. If $\hat{\mathfrak{m}}=
\mathfrak{m}\hat{A}$, then $\hat{A}$ is complete with respect to the
$\hat{\mathfrak{m}}$-adic topology. So if we show that
$\hat{A}/\hat{\mathfrak{m}}$ is noetherian and
$\hat{\mathfrak{m}}/\hat{\mathfrak{m}^2}$ is a finitely generated
$\hat{A}$-module, we will have shown that $\hat{A}$ is noetherian by
\cref{completenoetherian}.

But $\hat{A}/\hat{\mathfrak{m}}$ is a field, so obviously noetherian. 
Also, $\hat{\mathfrak{m}}/\hat{\mathfrak{m}}^2 = \mathfrak{m}/\mathfrak{m}^2$,
and by flatness of $A$, this is 
\[ A \otimes_{A_\alpha} \mathfrak{m}_\alpha/\mathfrak{m}_\alpha^2  \]
for any $\alpha$. Since $A_\alpha$ is noetherian, we see that this is finitely
generated. The criterion \cref{completenoetherian} now shows that the completion $\hat{A}$ is
noetherian.

Finally, we need to deduce that $A$ is itself noetherian. 
To do this,
we shall show that $\hat{A}$ is faithfully flat over $A$. Since noetherianness
``descends'' under faithfully flat extensions (\add{citation needed}), this
will be enough. It suffices to show that $\hat{A}$ is \emph{flat} over each
$A_\alpha$. For this, we use the infinitesimal criterion; we have that
\[ \hat{A} \otimes_{A_\alpha} A_\alpha/\mathfrak{m}_\alpha^t =
\hat{A}/\hat{\mathfrak{m}^t} = A/\mathfrak{m}^t = A/A\mathfrak{m}_\alpha^t,  \]
which is flat over $A_\alpha/\mathfrak{m}_\alpha^t$ since $A$ is flat over
$A_\alpha$.

It follows that $\hat{A}$ is flat over each $A_\alpha$. 
If we want to see that $A \to \hat{A}$ is flat, we let $I \subset A$ be a
finitely generated
ideal; we shall prove that $I \otimes_A \hat{A} \to \hat{A}$ is injective
(which will establish flatness). We know that there is an ideal $I_\alpha \subset A_\alpha$ for some
$A_\alpha$ such that
\[ I = I_\alpha A = I_\alpha \otimes_{A_\alpha} A.  \]
Then
\[ I \otimes_A \hat{A} = I_\alpha \otimes_{A_\alpha} \hat{A}  \]
which injects into $\hat{A}$ as $A_\alpha \to \hat{A}$ is flat. 

\begin{comment}
Let us first show that $A$ is \emph{separated} with respect to the
$\mathfrak{m}$-adic topology. Fix $x \in A$. Then $x$ lies in the subring
$A_\alpha$ for some fixed $\alpha$ depending on $\alpha$ (note that $A_\alpha
\to A$ is injective since a flat morphism of local rings is \emph{faithfully
flat}). If $x \in \mathfrak{m}^n = A \mathfrak{m}_\alpha^n$, then $x \in
\mathfrak{m}_\alpha^n$ by faithful flatness and \cref{intideal}.
So if $x \in \mathfrak{m}^n$ for all $n$, then $x \in \mathfrak{m}_\alpha^n$
for all $n$; the separatedness of $A_\alpha$ with respect to the
$\mathfrak{m}_\alpha$-adic topology now shows $x=0$.
\end{comment}


\end{proof} 


\subsection{Generic flatness}

Suppose given a module $M$ over a noetherian \emph{domain} $R$. Then $M
\otimes_R K(R)$ is a finitely generated free module over the field $K(R)$.
Since $K(R)$ is the inductive limit $\varinjlim R_f$ as $f$ ranges over $(R -
\left\{0\right\})/R^*$ and $K(R) \otimes_R M \simeq \varinjlim_{f \in (R -
\left\{0\right\})/R^*} M_f$, it follows by the general theory of \cref{} that
there exists $f \in R - \left\{0\right\}$ such that $M_f$ is free over $R_f$.

Here $\spec R_f = D(f) \subset \spec R$ should be thought of as a ``big''
subset of $\spec R$ (in fact, as one can check, it is \emph{dense} and open).
So the moral of this argument is that $M$ is ``generically free.'' If we had
the language of schemes, we could make this more precise.
But the idea is that localizing at $M$ corresponds to restricting the
\emph{sheaf} associated to $M$ to $D(f) \subset \spec R$; on this dense open subset, we
get a free sheaf.
(The reader not comfortable with such ``finitely presented'' arguments will
find another one below, that also works more generally.)

Now we want to generalize this to the case where $M$ is finitely generated not
over $R$, but over a finitely generated $R$-algebra. In particular, $M$ could
itself be a finitely generated $R$-algebra! 

\begin{theorem}[Generic freeness]
Let $S$ be a finitely generated algebra over the noetherian domain $R$, and
let $M$ be a finitely generated $S$-module. Then there is $f \in R -
\left\{0\right\}$ such that $M_f$ is a free (in particular, flat) $R$-module.
\end{theorem} 
\begin{proof} We shall first reduce the result to one about rings instead of
modules. By Hilbert's basis theorem, we know that $S$ is noetherian. 
By d\'evissage (\cref{devissage}), there is a finite filtration of $M$ by
$S$-submodules, 
\[ 0 = M_0 \subset M_1 \subset \dots \subset M_k = M  \]
such that the quotients $M_{i+1}/M_i$ are isomorphic to quotients
$S/\mathfrak{p}_i$ for the $\mathfrak{p}_i \in \spec S$.

Since localization is an exact functor, it will suffice to show that there
exists an $f$ such that $(S/\mathfrak{p}_i)_f$ is a free $R$-module for each
$f$. Indeed, it is clear that if a module admits a finite filtration all of
whose successive quotients are free, then the module itself is free.
We may thus even reduce to the case where $M = S/\mathfrak{p}$.

So we are reduced to showing that if we have a finitely generated
\emph{domain} $T$ over $R$, then there exists $f \in R - \left\{0\right\}$
such that $T_f$ is a free $R$-module. 
If $R \to T$ is not injective, then the result is obvious (localize at
something nonzero in the kernel), so we need only handle the case where $R \to
T$ is a monomorphism.


By the Noether normalization theorem, there are $d$  elements of $T \otimes_R K(R)$, which we
denote by $t_1, \dots, t_d$, which are algebraically independent over $K(R)$
and such that $T \otimes_R K(R)$ is integral over $K(R)[t_1, \dots, t_d]$.
(Here $d$ is the transcendence degree of $K(T)/
K(R)$.)
If we localize at some highly divisible element, we can assume that $t_1,
\dots, t_d$ all lie in $T$ itself. \emph{Let us assume that the result for
domains is true whenever the transcendence degree is $< d$, so that we can
induct.}

Then we know that $R[t_1, \dots, t_d] \subset T$ is  a polynomial ring.
Moreover, each of the finitely many generators of $T/R$ satisfies a monic polynomial
equation over $K(R)[t_1, \dots, t_d]$ (by the integrality part of Noether
normalization). If we localize $R$ at a highly divisible element, we may
assume that the coefficients of these polynomials belong to $R[t_1, \dots,
t_d]$. 
We have thus reduced to the following case. $T$ is a finitely generated domain
over $R$, \emph{integral} over the polynomial ring $R[t_1, \dots, t_d]$. In
particular, it is a finitely generated module over the polynomial ring $R[t_1,
\dots, t_d]$.
Thus we have some $r$ and an exact sequence
\[ 0 \to R[t_1, \dots, t_d]^r \to T \to Q \to 0,  \]
where $Q$ is a torsion $R[t_1, \dots, t_d]^r$-module. Since the polynomial
ring is free, we are reduced to showing that by localizing at a suitable
element of $R$, we can make  $Q$ free. 

But now we can do an inductive argument. $Q$ has a  finite filtration by
$T$-modules whose
quotients are isomorphic to $T/\mathfrak{p}$ for nonzero primes
$\mathfrak{p}$ with $\mathfrak{p} \neq 0$ as $T$ is torsion; these are still domains finitely generated over $R$, but such
that the associated transcendence degree is \emph{less} than $d$. We have
already assumed the statement proven for domains where the transcendence
degree is $< d$. Thus we can
find a suitable localization that makes all these  free, and thus $Q$ free; it
follows that with this localization, $T$ becomes free too.
\end{proof} 



