\input{preamble}

% OK, start here.
%
\begin{document}

\title{More on Algebra}


\maketitle

\phantomsection
\label{section-phantom}

\tableofcontents



\section{Introduction}
\label{section-introduction}

\noindent
In this chapter we prove some results in commutative algebra which
are less elementary than those in the first chapter on commutative
algebra, see
Algebra, Section \ref{algebra-section-introduction}.
A reference is \cite{MatCA}.






\section{Advice for the reader}
\label{section-advice}

\noindent
More than in the chapter on commutative algebra, each of the sections in
this chapter stands on its own. Starting with
Section \ref{section-derived-modules}
we freely use the (unbounded) derived category of modules over rings and all
the machinery that comes with it.




\section{Stably free modules}
\label{section-stably-free}

\noindent
Here is what seems to be the generally accepted definition.

\begin{definition}
\label{definition-stably-free}
Let $R$ be a ring. 
\begin{enumerate}
\item Two modules $M$, $N$ over $R$ are said to be
{\it stably isomorphic} if there exist $n, m \geq 0$ such
that $M \oplus R^{\oplus m} \cong N \oplus R^{\oplus n}$
as $R$-modules.
\item A module $M$ is {\it stably free} if it is stably isomorphic
to a free module.
\end{enumerate}
\end{definition}

\noindent
Observe that a stably free module is projective.

\begin{lemma}
\label{lemma-exact-category-stably-free}
Let $R$ be a ring. Let $0 \to P' \to P \to P'' \to 0$ be a short
exact sequence of finite projective $R$-modules. If $2$ out of $3$
of these modules are stably free, then so is the third.
\end{lemma}

\begin{proof}
Since the modules are projective, the sequence is split. Thus we can
choose an isomorphism $P = P' \oplus P''$. If $P' \oplus R^{\oplus n}$
and $P'' \oplus R^{\oplus m}$ are free, then we see that
$P \oplus R^{\oplus n + m}$ is free. Suppose that $P'$ and $P$ are
stably free, say $P \oplus R^{\oplus n}$ is free and $P' \oplus R^{\oplus m}$
is free. Then
$$
P'' \oplus (P' \oplus R^{\oplus m}) \oplus R^{\oplus n} =
(P'' \oplus P') \oplus R^{\oplus m} \oplus R^{\oplus n} =
(P \oplus R^{\oplus n}) \oplus R^{\oplus m}
$$
is free. Thus $P''$ is stably free. By symmetry we get the last of the
three cases.
\end{proof}

\begin{lemma}
\label{lemma-lift-stably-free}
Let $R$ be a ring. Let $I \subset R$ be an ideal. Assume that
every element of $1 + I$ is a unit (in other words $I$ is contained
in the Jacobson radical of $R$). For every finite stably free $R/I$-module $E$
there exists a finite stably free $R$-module $M$ such that $M/IM \cong E$.
\end{lemma}

\begin{proof}
Choose a $n$ and $m$ and an isomorphism
$E \oplus (R/I)^{\oplus n} \cong (R/I)^{\oplus m}$.
Choose $R$-linear maps $\varphi : R^{\oplus m} \to R^{\oplus n}$
and $\psi : R^{\oplus n} \to R^{\oplus m}$ lifting the
projection $(R/I)^{\oplus m} \to (R/I)^{\oplus n}$
and injection $(R/I)^{\oplus n} \to (R/I)^{\oplus m}$.
Then $\varphi \circ \psi : R^{\oplus n} \to R^{\oplus n}$
reduces to the identity modulo $I$. Thus the determinant of
this map is invertible by our assumption on $I$. Hence
$P = \Ker(\varphi)$ is stably free and lifts $E$.
\end{proof}

\begin{lemma}
\label{lemma-lift-projective}
Let $R$ be a ring. Let $I \subset R$ be an ideal.
Assume that every element of $1 + I$ is a unit
(in other words $I$ is contained in the Jacobson radical of $R$).
Let $M$ be a finite flat $R$-module such that
$M/IM$ is a projective $R/I$-module.
Then $M$ is a finite projective $R$-module.
\end{lemma}

\begin{proof}
By Algebra, Lemma \ref{algebra-lemma-finite-flat-local}
we see that $M_\mathfrak p$ is finite free for all prime ideals
$\mathfrak p \subset R$.
By
Algebra, Lemma \ref{algebra-lemma-finite-projective}
it suffices to show that the function $\rho_M : \mathfrak p \mapsto
\dim_{\kappa(\mathfrak p)} M \otimes_R \kappa(\mathfrak p)$
is locally constant on $\Spec(R)$. Because $M/IM$ is finite projective, this
is true on $V(I) \subset \Spec(R)$. Since every closed point
of $\Spec(R)$ is in $V(I)$ and since
$\rho_M(\mathfrak p) = \rho_M(\mathfrak q)$
whenever $\mathfrak p \subset \mathfrak q \subset R$
are prime ideals, we conclude by
an elementary argument on topological spaces which we omit.
\end{proof}

\noindent
The lift of Lemma \ref{lemma-lift-stably-free}
is unique up to isomorphism by the following lemma.

\begin{lemma}
\label{lemma-isomorphic-finite-projective-lifts}
Let $R$ be a ring. Let $I \subset R$ be an ideal. Assume that
every element of $1 + I$ is a unit (in other words $I$ is contained
in the Jacobson radical of $R$). If $P$ and $P'$ are finite
projective $R$-modules, then
\begin{enumerate}
\item if $\varphi : P \to P'$ is an $R$-module map inducing an
isomorphism $\overline{\varphi} : P/IP \to P'/IP'$, then $\varphi$
is an isomorphism,
\item if $P/IP \cong P'/IP'$, then $P \cong P'$.
\end{enumerate}
\end{lemma}

\begin{proof}
Proof of (1). As $P'$ is projective as an $R$-module we may
choose a lift $\psi : P' \to P$ of the map
$P' \to P'/IP' \xrightarrow{\overline{\varphi}^{-1}} P/IP$.
By Nakayama's lemma (Algebra, Lemma \ref{algebra-lemma-NAK})
$\psi \circ \varphi$ and $\varphi \circ \psi$ are surjective.
Hence these maps are isomorphisms (Algebra, Lemma \ref{algebra-lemma-fun}).
Thus $\varphi$ is an isomorphism.

\medskip\noindent
Proof of (2). Choose an isomorphism $P/IP \cong P'/IP'$.
Since $P$ is projective we can choose a lift $\varphi : P \to P'$ of the map
$P \to P/IP \to P'/IP'$. Then $\varphi$ is an isomorphism by (1).
\end{proof}




\section{A comment on the Artin-Rees property}
\label{section-artin-rees}

\noindent
Some of this material is taken from \cite{conrad-dejong}. A general
discussion with additional references can be found in
\cite[Section 1]{Eis}.

\medskip\noindent
Let $A$ be a Noetherian ring and let $I \subset A$ be an ideal. Given a
homomorphism $f : M \to N$ of finite $A$-modules there exists a $c \geq 0$
such that
$$
f(M) \cap I^nN \subset f(I^{n - c}M)
$$
for all $n \geq c$, see Algebra, Lemma \ref{algebra-lemma-map-AR}. In this
situation we will say {\it $c$ works for $f$ in the Artin-Rees lemma}.

\begin{lemma}
\label{lemma-approximate-complex}
Let $A$ be a Noetherian ring. Let $I \subset A$ be an ideal contained in
the Jacobson radical of $A$. Let
$$
S : L \xrightarrow{f} M \xrightarrow{g} N
\quad\text{and}\quad
S' : L \xrightarrow{f'} M \xrightarrow{g'} N
$$
be two complexes of finite $A$-modules as shown. Assume that
\begin{enumerate}
\item $c$ works in the Artin-Rees lemma for $f$ and $g$,
\item the complex $S$ is exact, and
\item $f' = f \bmod I^{c + 1}M$ and $g' = g \bmod I^{c + 1}N$.
\end{enumerate}
Then $c$ works in the Artin-Rees lemma for $g'$ and the
complex $S'$ is exact.
\end{lemma}

\begin{proof}
We first show that $g'(M) \cap I^nN \subset g'(I^{n - c}M)$ for $n \geq c$.
Let $a$ be an element of $M$ such that $g'(a) \in I^nN$. We want to
adjust $a$ by an element of $f'(L)$, i.e, without changing $g'(a)$, so
that $a \in I^{n-c}M$. Assume that $a \in I^rM$, where $r < n - c$.
Then
$$
g(a) = g'(a) + (g - g')(a) \in
I^n N + I^{r + c + 1}N = I^{r + c + 1}N.
$$
By Artin-Rees for $g$ we have $g(a) \in g(I^{r + 1}M)$. Say $g(a) = g(a_1)$
with $a_1 \in I^{r + 1}M$. Since the sequence $S$ is exact, $a - a_1 \in f(L)$.
Accordingly, we write $a = f(b) + a_1$ for some $b \in L$.
Then $f(b) = a - a_1 \in I^rM$. Artin-Rees for $f$ shows that
if $r \geq c$, we may replace $b$ by an element of $I^{r - c}L$.
Then in all cases, $a = f'(b) + a_2$, where
$a_2 = (f - f')(b) + a_1 \in I^{r + 1}M$. (Namely, either $c \geq r$
and $(f - f')(b) \in I^{r + 1}M$ by assumption, or $c < r$ and
$b \in I^{r - c}$, whence again $(f - f')(b) \in I^{c + 1} I^{r - c} M =
I^{r + 1}M$.) So we can adjust $a$ by the element $f'(b) \in f'(L)$ to
increase $r$ by $1$.

\medskip\noindent
In fact, the argument above shows that
$(g')^{-1}(I^nN) \subset f'(L) + I^{n - c}M$ for all $n \geq c$.
Hence $S'$ is exact because
$$
(g')^{-1}(0) = (g')^{-1}(\bigcap I^nN) \subset
\bigcap f'(L) + I^{n - c}M = f'(L)
$$
as $I$ is contained in the Jacobson radical of $A$, see Algebra, Lemma
\ref{algebra-lemma-intersection-powers-ideal-module}.
\end{proof}

\noindent
Given an ideal $I \subset A$ of a ring $A$ and an $A$-module $M$
we set
$$
\text{Gr}_I(M) = \bigoplus I^nM/I^{n + 1}M.
$$
We think of this as a graded $\text{Gr}_I(A)$-module.

\begin{lemma}
\label{lemma-approximate-complex-graded}
Assumptions as in Lemma \ref{lemma-approximate-complex}.
Let $Q = \Coker(g)$ and $Q' = \Coker(g')$. Then
$\text{Gr}_I(Q) \cong \text{Gr}_I(Q')$
as graded $\text{Gr}_I(A)$-modules.
\end{lemma}

\begin{proof}
In degree $n$ we have
$\text{Gr}_I(Q)_n = I^nN/(I^{n + 1}N + g(M) \cap I^nN)$
and similarly for $Q'$. We claim that
$$
g(M) \cap I^nN \subset I^{n + 1}N + g'(M) \cap I^nN.
$$
By symmetry (the proof of the claim will only use that $c$ works
for $g$ which also holds for $g'$ by the lemma) this will imply that
$$
I^{n + 1}N + g(M) \cap I^nN = I^{n + 1}N + g'(M) \cap I^nN
$$
whence $\text{Gr}_I(Q)_n$ and $\text{Gr}_I(Q')_n$ agree as subquotients
of $N$, implying the lemma. Observe that the claim is clear for
$n \leq c$ as $f = f' \bmod I^{c + 1}N$. If $n > c$, then suppose
$b \in g(M) \cap I^nN$. Write $b = g(a)$ for $a \in I^{n - c}M$.
Set $b' = g'(a)$. We have $b - b' = (g - g')(a) \in I^{n + 1}N$
as desired.
\end{proof}

\begin{lemma}
\label{lemma-works-flat-extension}
Let $A \to B$ be a flat map of Noetherian rings. Let $I \subset A$ be
an ideal. Let $f : M \to N$ be a homomorphism of finite $A$-modules.
Assume that $c$ works for $f$ in the Artin-Rees lemma. Then $c$ works for
$f \otimes 1 : M \otimes_A B \to N \otimes_A B$ in the Artin-Rees lemma
for the ideal $IB$.
\end{lemma}

\begin{proof}
Note that
$$
(f \otimes 1)(M) \cap I^n N \otimes_A B
= (f \otimes 1)\left((f \otimes 1)^{-1}(I^n N \otimes_A B)\right)
$$
On the other hand,
\begin{align*}
(f \otimes 1)^{-1}(I^n N \otimes_A B) &
= \Ker(M \otimes_A B \to N \otimes_A B/(I^n N \otimes_A B)) \\
& =
\Ker(M \otimes_A B \to (N/I^nN) \otimes_A B)
\end{align*}
As $A \to B$ is flat taking kernels and cokernels commutes with
tensoring with $B$, whence this is equal to
$f^{-1}(I^nN) \otimes_A B$. By assumption $f^{-1}(I^nN)$ is contained in
$\Ker(f) + I^{n - c}M$. Thus the lemma holds.
\end{proof}








\section{Fibre products of rings, I}
\label{section-fibre-products-rings}

\noindent
Fibre products of rings have to do with pushouts of schemes. Some
cases of pushouts of schemes are discussed in
More on Morphisms, Section \ref{more-morphisms-section-pushouts}.

\begin{lemma}
\label{lemma-fibre-product-finite-type}
Let $R$ be a ring. Let $A \to B$ and $C \to B$ be $R$-algebra maps.
Assume
\begin{enumerate}
\item $R$ is Noetherian,
\item $A$, $B$, $C$ are of finite type over $R$,
\item $A \to B$ is surjective, and
\item $B$ is finite over $C$.
\end{enumerate}
Then $A \times_B C$ is of finite type over $R$.
\end{lemma}

\begin{proof}
Set $D = A \times_B C$. There is a commutative diagram
$$
\xymatrix{
0 &
B \ar[l] &
A \ar[l] &
I \ar[l] &
0 \ar[l] \\
0 &
C \ar[l] \ar[u] &
D \ar[l] \ar[u] &
I \ar[l] \ar[u] &
0 \ar[l]
}
$$
with exact rows. Choose $y_1, \ldots, y_n \in B$ which are generators for
$B$ as a $C$-module. Choose $x_i \in A$ mapping to $y_i$.
Then $1, x_1, \ldots, x_n$ are generators for $A$ as a $D$-module.
The map $D \to A \times C$ is injective, and the ring $A \times C$ is finite
as a $D$-module (because it is the direct sum of the finite $D$-modules
$A$ and $C$). Hence the lemma follows from the Artin-Tate lemma
(Algebra, Lemma \ref{algebra-lemma-Artin-Tate}).
\end{proof}

\begin{lemma}
\label{lemma-formal-consequence}
Let $R$ be a Noetherian ring. Let $I$ be a finite set. Suppose given a
cartesian diagram
$$
\xymatrix{
\prod B_i &
\prod A_i \ar[l]^{\prod \varphi_i} \\
Q \ar[u]^{\prod \psi_i} &
P \ar[u] \ar[l]
}
$$
with $\psi_i$ and $\varphi_i$ surjective, and $Q$, $A_i$, $B_i$ of
finite type over $R$. Then $P$ is of finite type over $R$.
\end{lemma}

\begin{proof}
Follows from Lemma \ref{lemma-fibre-product-finite-type}
and induction on the size of $I$.
Namely, let $I = I' \amalg \{i_0\}$. Let $P'$ be the ring defined
by the diagram of the lemma using $I'$. Then $P'$ is of finite type
by induction hypothesis. Finally, $P$ sits in a fibre product diagram
$$
\xymatrix{
B_{i_0} &
A_{i_0} \ar[l] \\
P' \ar[u] &
P \ar[u] \ar[l] &
}
$$
to which the lemma applies.
\end{proof}

\begin{lemma}
\label{lemma-diagram-localize}
Suppose given a cartesian diagram of rings
$$
\xymatrix{
R &
R' \ar[l]^t \\
B \ar[u]_s &
B'\ar[u] \ar[l]
}
$$
i.e., $B' = B \times_R R'$. If $h \in B'$ corresponds to $g \in B$
and $f \in R'$ such that $s(g) = t(f)$, then the diagram
$$
\xymatrix{
R_{s(g)} = R_{t(f)} &
(R')_f \ar[l]^-t \\
B_g \ar[u]_s &
(B')_h \ar[u] \ar[l]
}
$$
is cartesian too.
\end{lemma}

\begin{proof}
The equality $B' = B \times_R R'$ tells us that
$$
0 \to B' \to B \oplus R' \xrightarrow{s, -t} R
$$
is an exact sequence of $B'$-modules. We have $B_g = B_h$,
$R'_f = R'_h$, and $R_{s(g)} = R_{t(f)} = R_h$ as $B'$-modules.
By exactness of localization
(Algebra, Proposition \ref{algebra-proposition-localization-exact})
we find that
$$
0 \to B'_h \to B_g \oplus R'_f \xrightarrow{s, -t} R_{s(g)} = R_{t(f)}
$$
is an exact sequence. This proves the lemma.
\end{proof}

\noindent
Consider a commutative diagram of rings
$$
\xymatrix{
R &
R' \ar[l] \\
B \ar[u] &
B' \ar[u] \ar[l]
}
$$
Consider the functor (where the fibre product of categories is
as constructed in
Categories, Example \ref{categories-example-2-fibre-product-categories})
\begin{equation}
\label{equation-modules}
\text{Mod}_{B'} \longrightarrow
\text{Mod}_B \times_{\text{Mod}_R} \text{Mod}_{R'},\quad
L' \longmapsto (L' \otimes_{B'} B, L' \otimes_{B'} R', can)
\end{equation}
where $can$ is the canonical identification
$L' \otimes_{B'} B \otimes_B R = L' \otimes_{B'} R' \otimes_{R'} R$.
In the following we will write $(N, M', \varphi)$ for an object
of the right hand side, i.e., $N$ is a $B$-module, $M'$ is an $R'$-module
and $\varphi : N \otimes_B R \to M' \otimes_{R'} R$ is an isomorphism.

\begin{lemma}
\label{lemma-modules}
Given a commutative diagram of rings
$$
\xymatrix{
R &
R' \ar[l] \\
B \ar[u] &
B' \ar[u] \ar[l]
}
$$
the functor (\ref{equation-modules}) has a right adjoint,
namely the functor
$$
F : (N, M', \varphi) \longmapsto N \times_\varphi M'
$$
(see proof for elucidation).
\end{lemma}

\begin{proof}
Given an object $(N, M', \varphi)$ of the category
$\text{Mod}_B \times_{\text{Mod}_R} \text{Mod}_{R'}$
we set
$$
N \times_\varphi M' = \{(n, m') \in N \times M' \mid
\varphi(n \otimes 1) = m' \otimes 1\text{ in }M' \otimes_{R'} R\}
$$
viewed as a $B'$-module.
The adjointness statement is that for a $B'$-module $L'$ and
a triple $(N, M', \varphi)$ we have
$$
\Hom_{B'}(L', N \times_\varphi M') =
\Hom_B(L' \otimes_{B'} B, N)
\times_{\Hom_R(L' \otimes_{B'} R, M' \otimes_{R'} R)}
\Hom_{R'}(L' \otimes_{B'} R', M')
$$
By Algebra, Lemma \ref{algebra-lemma-adjoint-tensor-restrict}
the right hand side is equal to
$$
\Hom_{B'}(L', N) \times_{\Hom_{B'}(L', M' \otimes_{R'} R)} \Hom_{B'}(L', M')
$$
Thus it is clear that for a pair $(g, f')$ of elements
of this fibre product we get an $B'$-linear map
$L' \to N \times_\varphi M'$, $l' \mapsto (g(l'), f'(l'))$.
Conversely, given a $B'$ linear map $g' : L' \to N \times_\varphi M'$
we can set $g$ equal to the composition $L' \to N \times_\varphi M' \to N$
and $f'$ equal to the composition $L' \to N \times_\varphi M' \to M'$.
These constructions are mutually inverse to each other and
define the desired isomorphism.
\end{proof}






\section{Fibre products of rings, II}
\label{section-fibre-products-rings-II}

\noindent
In this section we discuss fibre products in the following situation.

\begin{situation}
\label{situation-module-over-fibre-product}
In the following we will consider ring maps
$$
\xymatrix{
B \ar[r] & A & A' \ar[l]
}
$$
where we assume $A' \to A$ is surjective with kernel $I$.
In this situation we set $B' = B \times_A A'$ to
obtain a cartesian square
$$
\xymatrix{
A & A' \ar[l] \\
B \ar[u] & B' \ar[l] \ar[u]
}
$$
\end{situation}

\begin{lemma}
\label{lemma-points-of-fibre-product}
In Situation \ref{situation-module-over-fibre-product}
we have
$$
\Spec(B') = \Spec(B) \amalg_{\Spec(A)} \Spec(A')
$$
as topological spaces.
\end{lemma}

\begin{proof}
Since $B' = B \times_A A'$ we obtain a commutative square of
spectra, which induces a continuous map
$$
can : \Spec(B) \amalg_{\Spec(A)} \Spec(A') \longrightarrow \Spec(B')
$$
as the source is a pushout in the category
of topological spaces (which exists by
Topology, Section \ref{topology-section-colimits}).

\medskip\noindent
To show the map $can$ is surjective, let $\mathfrak q' \subset B'$ be a prime
ideal. If $I \subset \mathfrak q'$ (here and below we take the liberty
of considering $I$ as an ideal of $B'$ as well as an ideal of $A'$),
then $\mathfrak q'$ corresponds to a prime ideal of $B$ and is in the image.
If not, then pick $h \in I$, $h \not \in \mathfrak q'$.
In this case $B_h = A_h = 0$
and the ring map $B'_h \to A'_h$ is an isomorphism, see
Lemma \ref{lemma-diagram-localize}. Thus we see that
$\mathfrak q'$ corresponds to a unique prime ideal $\mathfrak p' \subset A'$
which does not contain $I$.

\medskip\noindent
Since $B' \to B$ is surjective, we see that $can$ is injective on
the summand $\Spec(B)$. We have seen above that $\Spec(A') \to \Spec(B')$
is injective on the complement of $V(I) \subset \Spec(A')$. Since
$V(I) \subset \Spec(A')$ is exactly the image of $\Spec(A) \to \Spec(A')$
a trivial set theoretic argument shows that $can$ is injective.

\medskip\noindent
To finish the proof we have to show that $can$ is open. To do this, observe
that an open of the pushout is of the form $V \amalg U'$ where
$V \subset \Spec(B)$ and $U' \subset \Spec(A')$ are opens whose inverse
images in $\Spec(A)$ agree. Let $v \in V$. We can find a $g \in B$
such that $v \in D(g) \subset V$. Let $f \in A$ be the image.
Pick $f' \in A'$ mapping to $f$. Then
$D(f') \cap U' \cap V(I) = D(f') \cap V(I)$.
Hence $V(I) \cap D(f')$ and $D(f') \cap (U')^c$ are disjoint closed
subsets of $D(f') = \Spec(A'_{f'})$. Write $(U')^c = V(J)$
for some ideal $J \subset A'$. Since
$A'_{f'} \to A'_{f'}/IA'_{f'} \times A'_{f'}/JA'_{f'}$
is surjective by the disjointness just shown, we can find an $a'' \in A'_{f'}$
mapping to $1$ in $A'_{f'}/IA'_{f'}$ and mapping to zero in
$A'_{f'}/JA'_{f'}$. Clearing denominators, we find an element
$a' \in J$ mapping to $f^n$ in $A$. Then $D(a'f') \subset U'$.
Let $h' = (g^{n + 1}, a'f') \in B'$.
Since $B'_{h'} = B_{g^{n + 1}} \times_{A_{f^{n + 1}}} A'_{a'f'}$ by a previously
cited lemma, we see that $D(h')$ pulls back to an open neighbourhood
of $v$ in the pushout, i.e., the image of $V \amalg U'$ contains
an open neighbourhood of the image of $v$. We omit the (easier) proof that
the same thing is true for $u' \in U'$ with $u' \not \in V(I)$.
\end{proof}

\begin{lemma}
\label{lemma-fibre-product-integral}
In Situation \ref{situation-module-over-fibre-product}
if $B \to A$ is integral, then $B' \to A'$ is integral.
\end{lemma}

\begin{proof}
Let $a' \in A'$ with image $a \in A$. Let $x^d + b_1 x^{d - 1} + \ldots + b_d$
be a monical polynomial with coefficients in $B$ satisfied by $a$.
Choose $b'_i \in B'$ mapping to $b_i \in B$ (possible).
Then $(a')^d + b'_1 (a')^{d - 1} + \ldots + b'_d$ is in the kernel
of $A' \to A$. Since $\Ker(B' \to B) = \Ker(A' \to A)$ we can
modify our choice of $b'_d$ to get
$(a')^d + b'_1 (a')^{d - 1} + \ldots + b'_d = 0$ as desired.
\end{proof}

\noindent
In Situation \ref{situation-module-over-fibre-product}
we'd like to understand $B'$-modules in terms of modules over $A'$, $A$,
and $B$. In order to do this we consider the functor (where the
fibre product of categories as constructed in
Categories, Example \ref{categories-example-2-fibre-product-categories})
\begin{equation}
\label{equation-functor}
\text{Mod}_{B'} \longrightarrow
\text{Mod}_B \times_{\text{Mod}_A} \text{Mod}_{A'},\quad
L' \longmapsto (L' \otimes_{B'} B, L' \otimes_{B'} A', can)
\end{equation}
where $can$ is the canonical identification
$L' \otimes_{B'} B \otimes_B A = L' \otimes_{B'} A' \otimes_{A'} A$.
In the following we will write $(N, M', \varphi)$ for an object
of the right hand side, i.e., $N$ is a $B$-module, $M'$ is an $A'$-module
and $\varphi : N \otimes_B A \to M' \otimes_{A'} A$ is an isomorphism.
However, it is often more convenient think of $\varphi$ as a $B$-linear
map $\varphi : N \to M'/IM'$ which induces an isomorphism
$N \otimes_B A \to M' \otimes_{A'} A = M'/IM'$.

\begin{lemma}
\label{lemma-module-over-fibre-product}
In Situation \ref{situation-module-over-fibre-product}
the functor (\ref{equation-functor}) has a right adjoint, namely
the functor
$$
F : (N, M', \varphi) \longmapsto N \times_{\varphi, M} M'
$$
where $M = M'/IM'$. Moreover, the composition of $F$ with
(\ref{equation-functor}) is the identity functor on
$\text{Mod}_B \times_{\text{Mod}_A} \text{Mod}_{A'}$. In other words,
setting $N' = N \times_{\varphi, M} M'$ we have
$N' \otimes_{B'} B = N$ and $N' \otimes_{B'} A' = M'$.
\end{lemma}

\begin{proof}
The adjointness statement follows from the more general
Lemma \ref{lemma-modules}.
To prove the final assertion, recall that
$B' = B \times_A A'$ and $N' = N \times_{\varphi, M} M'$ and extend
these equalities to 
$$
\vcenter{
\xymatrix{
A & A' \ar[l] & I \ar[l] \\
B \ar[u] & B' \ar[l] \ar[u] & J \ar[l] \ar[u]
}
}
\quad\text{and}\quad
\vcenter{
\xymatrix{
M & M' \ar[l] & K \ar[l] \\
N \ar[u]_\varphi & N' \ar[l] \ar[u] & L \ar[l] \ar[u]
}
}
$$
where $I, J, K, L$ are the kernels of the horizontal maps of the original
diagrams. We present the proof as a sequence of observations:
\begin{enumerate}
\item $K = IM'$ (see statement lemma),
\item $B' \to B$ is surjective with kernel $J$ and $J \to I$ is bijective,
\item $N' \to N$ is surjective with kernel $L$ and $L \to K$ is bijective,
\item $JN' \subset L$,
\item $\Im(N \to M)$ generates $M$ as an $A$-module
(because $N \otimes_B A = M$),
\item $\Im(N' \to M')$ generates $M'$ as an $A'$-module
(because it holds modulo $K$ and $L$ maps isomorphically to $K$),
\item $JN' = L$ (because $L \cong K = I M'$
is generated by images of elements $x n'$ with $x \in I$ and
$n' \in N'$ by the previous statement),
\item $N' \otimes_{B'} B = N$ (because $N = N'/L$, $B = B'/J$, and
the previous statement),
\item there is a map $\gamma : N' \otimes_{B'} A' \to M'$,
\item $\gamma$ is surjective (see above),
\item the kernel of the composition $N' \otimes_{B'} A' \to M' \to M$ 
is generated by elements $l \otimes 1$ and $n' \otimes x$ with
$l \in K$, $n' \in N'$, $x \in I$ (because $M = N \otimes_B A$ by assumption
and because $N' \to N$ and $A' \to A$ are surjective with kernels
$L$ and $I$),
\item any element of $N' \otimes_{B'} A'$ in the submodule generated
by the elements $l \otimes 1$ and $n' \otimes x$ with
$l \in L$, $n' \in N'$, $x \in I$ can be written as $l \otimes 1$
for some $l \in L$ (because $J$ maps isomorphically to $I$ we see
that $n' \otimes x = n'x \otimes 1$ in $N' \otimes_{B'} A'$;
similarly $x n' \otimes a' = n' \otimes xa' = n'(xa') \otimes 1$
in $N' \otimes_{B'} A'$ when $n' \in N'$, $x \in J$ and $a' \in A'$;
since we have seen that $JN' = L$ this proves the assertion),
\item the kernel of $\gamma$ is zero (because by (10) and (11) any element of
the kernel is of the form $l \otimes 1$ with $l \in L$ which
is mapped to $l \in K \subset M'$ by $\gamma$).
\end{enumerate}
This finishes the proof.
\end{proof}

\begin{lemma}
\label{lemma-module-over-fibre-product-bis}
In the situation of Lemma \ref{lemma-module-over-fibre-product}
for a $B'$-module $L'$ the adjunction map
$$
L' \longrightarrow 
(L' \otimes_{B'} B) \times_{(L' \otimes_{B'} A)} (L' \otimes_{B'} A')
$$
is surjective but in general not injective.
\end{lemma}

\begin{proof}
As in the proof of Lemma \ref{lemma-module-over-fibre-product}
let $J \subset B'$ be the kernel of the map $B' \to B$.
Then $L' \otimes_{B'} B = L'/JL'$. Hence to prove surjectivity it suffices
to show that elements of the form $(0, z)$ of the fibre product are in the
image of the map of the lemma. The kernel of the map
$L' \otimes_{B'} A' \to L' \otimes_{B'} A$ is the image of
$L' \otimes_{B'} I \to L' \otimes_{B'} A'$. Since the map $J \to I$
induced by $B' \to A'$ is an isomorphism
the composition
$$
L' \otimes_{B'} J \to L' \to
(L' \otimes_{B'} B) \times_{(L' \otimes_{B'} A)} (L' \otimes_{B'} A')
$$
induces a surjection of $L' \otimes_{B'} J$ onto the set of elements
of the form $(0, z)$. To see the map is not injective in general we
present a simple example. Namely, take a field $k$,
set $B' = k[x, y]/(xy)$, $A' = B'/(x)$, $B = B'/(y)$, $A = B'/(x, y)$
and $L' = B'/(x - y)$. In that case the class of $x$ in $L'$ is nonzero
but is mapped to zero under the displayed arrow.
\end{proof}

\begin{lemma}
\label{lemma-surjection-module-over-fibre-product}
In Situation \ref{situation-module-over-fibre-product}
let $(N_1, M'_1, \varphi_1) \to (N_2, M'_2, \varphi_2)$ be a morphism
of $\text{Mod}_B \times_{\text{Mod}_A} \text{Mod}_{A'}$
with $N_1 \to N_2$ and $M'_1 \to M'_2$ surjective. Then
$$
N_1 \times_{\varphi_1, M_1} M'_1 \to N_2 \times_{\varphi_2, M_2} M'_2
$$
where $M_1 = M'_1/IM'_1$ and $M_2 = M'_2/IM'_2$ is surjective.
\end{lemma}

\begin{proof}
Pick $(x_2, y_2) \in N_2 \times_{\varphi_2, M_2} M'_2$. Choose $x_1 \in N_1$
mapping to $x_2$. Since $M'_1 \to M_1$ is surjective we can find
$y_1 \in M'_1$ mapping to $\varphi_1(x_1)$. Then $(x_1, y_1)$
maps to $(x_2, y'_2)$ in $N_2 \times_{\varphi_2, M_2} M'_2$. Thus it suffices
to show that elements of the form $(0, y_2)$ are in the image of the map.
Here we see that $y_2 \in IM'_2$. Write $y_2 = \sum t_i y_{2, i}$
with $t_i \in I$. Choose $y_{1, i} \in M'_1$ mapping to $y_{2, i}$.
Then $y_1 = \sum t_iy_{1, i} \in IM'_1$ and the element $(0, y_1)$
does the job.
\end{proof}

\begin{lemma}
\label{lemma-finite-module-over-fibre-product}
Let $A, A', B, B', I, M, M', N, \varphi$ be as in
Lemma \ref{lemma-module-over-fibre-product}.
If $N$ finite over $B$ and $M'$ finite over $A'$, then
$N' = N \times_{\varphi, M} M'$ is finite over $B'$.
\end{lemma}

\begin{proof}
We will use the results of
Lemma \ref{lemma-module-over-fibre-product}
without further mention. Choose generators $y_1, \ldots, y_r$ of $N$ over $B$
and generators $x_1, \ldots, x_s$ of $M'$ over $A'$. Using that
$N = N' \otimes_{B'} B$ and $B' \to B$ is surjective we can find
$u_1, \ldots, u_r \in N'$ mapping to $y_1, \ldots, y_r$ in $N$.
Using that $M' = N' \otimes_{B'} A'$ we can find $v_1, \ldots, v_t \in N'$
such that $x_i = \sum v_j \otimes a'_{ij}$ for some $a'_{ij} \in A'$.
In particular we see that the images $\overline{v}_j \in M'$
of the $v_j$ generate $M'$ over $A'$.
We claim that $u_1, \ldots, u_r, v_1, \ldots, v_t$
generate $N'$ as a $B'$-module. Namely, pick $\xi \in N'$. We first choose
$b'_1, \ldots, b'_r \in B'$ such that $\xi$ and $\sum b'_i u_i$ map
to the same element of $N$. This is possible because $B' \to B$
is surjective and $y_1, \ldots, y_r$ generate $N$ over $B$.
The difference $\xi - \sum b'_i u_i$ is of the form $(0, \theta)$
for some $\theta$ in $IM'$. Say $\theta$ is $\sum t_j\overline{v}_j$
with $t_j \in I$. As $J = \Ker(B' \to B)$ maps isomorphically to $I$
we can choose $s_j \in J \subset B'$ mapping to $t_j$.
Because $N' = N \times_{\varphi, M} M'$ it follows
that $\xi = \sum b'_i u_i + \sum s_j v_j$ as desired.
\end{proof}

\begin{lemma}
\label{lemma-flat-module-over-fibre-product}
With $A, A', B, B', I$ as in
Situation \ref{situation-module-over-fibre-product}.
\begin{enumerate}
\item Let $(N, M', \varphi)$ be an object of
$\text{Mod}_B \times_{\text{Mod}_A} \text{Mod}_{A'}$.
If $M'$ is flat over $A'$ and $N$ is flat over $B$, then
$N' = N \times_{\varphi, M} M'$ is flat over $B'$.
\item If $L'$ is a flat $B'$-module, then
$L' = (L \otimes_{B'} B) \times_{(L \otimes_{B'} A)} (L \otimes_{B'} A')$.
\item The category of flat $B'$-modules is equivalent to the
full subcategory of $\text{Mod}_B \times_{\text{Mod}_A} \text{Mod}_{A'}$
consisting of triples
$(N, M', \varphi)$ with $N$ flat over $B$ and $M'$ flat over $A'$.
\end{enumerate}
\end{lemma}

\begin{proof}
In the proof we will use Lemma \ref{lemma-module-over-fibre-product}
without further mention.

\medskip\noindent
Proof of (1). Set $J = \Ker(B' \to B)$. This is an ideal of $B'$
mapping isomorphically to $I = \Ker(A' \to A)$.
Let $\mathfrak b' \subset B'$ be an ideal.
We have to show that $\mathfrak b' \otimes_{B'} N' \to N'$
is injective, see Algebra, Lemma \ref{algebra-lemma-flat}.
We know that
$$
\mathfrak b'/(\mathfrak b' \cap J) \otimes_{B'} N' =
\mathfrak b'/(\mathfrak b' \cap J) \otimes_B N \to N
$$
is injective as $N$ is flat over $B$. As
$\mathfrak b' \cap J \to \mathfrak b' \to
\mathfrak b'/(\mathfrak b' \cap J) \to 0$ is exact, we
conclude that it suffices to show that
$(\mathfrak b' \cap J) \otimes_{B'} N' \to N'$
is injective. Thus we may assume that $\mathfrak b' \subset J$.
Next, since $J \to I$ is an isomorphism we have
$$
J \otimes_{B'} N' =
I \otimes_{A'} A' \otimes_{B'} N' =
I \otimes_{A'} M'
$$
which maps injectively into $M'$ as $M'$ is a flat $A'$-module.
Hence $J \otimes_{B'} N' \to N'$ is injective and we conclude
that $\text{Tor}_1^{B'}(B'/J, N') = 0$, see
Algebra, Remark \ref{algebra-remark-Tor-ring-mod-ideal}.
Thus we may apply Algebra, Lemma \ref{algebra-lemma-what-does-it-mean}
to $N'$ over $B'$ and the ideal $J$.
Going back to our ideal $\mathfrak b' \subset J$, let
$\mathfrak b' \subset \mathfrak b'' \subset J$ be the smallest ideal
whose image in $I$ is an $A'$-submodule of $I$. In other words,
we have $\mathfrak b'' = A' \mathfrak b'$ if we view $J = I$
as $A'$-module. Then $\mathfrak b''/\mathfrak b'$ is killed
by $J$ and we get a short exact sequence
$$
0 \to \mathfrak b' \otimes_{B'} N' \to
\mathfrak b'' \otimes_{B'} N' \to
\mathfrak b''/\mathfrak b' \otimes_{B'} N' \to 0
$$
by the vanishing of $\text{Tor}_1^{B'}(\mathfrak b''/\mathfrak b', N')$
we get from the application of the lemma.
Thus we may replace $\mathfrak b'$ by $\mathfrak b''$.
In particular we may assume $\mathfrak b'$ is an $A'$-module
and maps to an ideal of $A'$. Then
$$
\mathfrak b' \otimes_{B'} N' =
\mathfrak b' \otimes_{A'} A' \otimes_{B'} N' =
\mathfrak b' \otimes_{A'} M'
$$
This tensor product maps injectively into $M'$ by our assumption that
$M'$ is flat over $A'$. We conclude that
$\mathfrak b' \otimes_{B'} N' \to N' \to M'$ is injective
and hence the first map is injective as desired.

\medskip\noindent
Proof of (2). This follows by tensoring the short exact sequence
$0 \to B' \to B \oplus A' \to A \to 0$ with $L'$ over $B'$.

\medskip\noindent
Proof of (3). Immediate consequence of (1) and (2).
\end{proof}

\begin{lemma}
\label{lemma-finitely-presented-module-over-fibre-product}
Let $A, A', B, B', I$ be as in
Situation \ref{situation-module-over-fibre-product}.
The category of finite projective $B'$-modules
is equivalent to the full subcategory
of $\text{Mod}_B \times_{\text{Mod}_A} \text{Mod}_{A'}$
consisting of triples $(N, M', \varphi)$
with $N$ finite projective over $B$ and $M'$ finite projective over $A'$.
\end{lemma}

\begin{proof}
Recall that a module is finite projective if and only if
it is finitely presented and flat, see
Algebra, Lemma \ref{algebra-lemma-finite-projective}.
Using Lemmas \ref{lemma-flat-module-over-fibre-product} and
\ref{lemma-finite-module-over-fibre-product}
we reduce to showing that $N' = N \times_{\varphi, M} M'$ is
a $B'$-module of finite presentation if
$N$ finite projective over $B$
and $M'$ finite projective over $A'$.

\medskip\noindent
By Lemma \ref{lemma-finite-module-over-fibre-product}
the module $N'$ is finite over $B'$. Choose a surjection
$(B')^{\oplus n} \to N'$ with kernel $K'$. By base change we obtain maps
$B^{\oplus n} \to N$, $(A')^{\oplus n} \to M'$, and $A^{\oplus n} \to M$
with kernels $K_B$, $K_{A'}$, and $K_A$. There is a canonical map
$$
K' \longrightarrow K_B \times_{K_A} K_{A'}
$$
On the other hand, since $N' = N \times_{\varphi, M} M'$ and
$B' = B \times_A A'$ there is also a
canonical map $K_B \times_{K_A} K_{A'} \to K'$ inverse to the displayed
arrow. Hence the displayed map is an isomorphism. By
Algebra, Lemma \ref{algebra-lemma-extension}
the modules $K_B$ and $K_{A'}$ are finite. We conclude from
Lemma \ref{lemma-finite-module-over-fibre-product}
that $K'$ is a finite $B'$-module provided that $K_B \to K_A$ and
$K_{A'} \to K_A$ induce isomorphisms
$K_B \otimes_B A = K_A = K_{A'} \otimes_{A'} A$.
This is true because the flatness assumptions implies the sequences
$$
0 \to K_B \to B^{\oplus n} \to N \to 0
\quad\text{and}\quad
0 \to K_{A'} \to (A')^{\oplus n} \to M' \to 0
$$
stay exact upon tensoring, see
Algebra, Lemma \ref{algebra-lemma-flat-tor-zero}.
\end{proof}





\section{Fibre products of rings, III}
\label{section-fibre-products-rings-III}

\noindent
In this section we discuss fibre products in the following situation.

\begin{situation}
\label{situation-relative-module-over-fibre-product}
Let $A, A', B, B', I$ be as in
Situation \ref{situation-module-over-fibre-product}.
Let $B' \to D'$ be a ring map. Set $D = D' \otimes_{B'} B$,
$C' = D' \otimes_{B'} A'$, and $C = D' \otimes_{B'} A$. This leads
to a big commutative diagram
$$
\xymatrix{
C & & & C' \ar[lll] \\
& A \ar[ul] & A' \ar[l] \ar[ru] \\
& B \ar[u] \ar[ld] & B' \ar[l] \ar[u] \ar[rd] \\
D \ar[uuu] & & & D' \ar[lll] \ar[uuu]
}
$$
of rings.
Observe that we do {\bf not} assume that the map $D' \to D \times_C C'$
is an isomorphism\footnote{But $D' \to D \times_C C'$ is surjective
by Lemma \ref{lemma-module-over-fibre-product-bis}.}.
In this situation we have the functor
\begin{equation}
\label{equation-relative-functor}
\text{Mod}_{D'} \longrightarrow
\text{Mod}_D \times_{\text{Mod}_C} \text{Mod}_{C'},\quad
L' \longmapsto (L' \otimes_{D'} D, L' \otimes_{D'} C', can)
\end{equation}
analogous to (\ref{equation-functor}). Note that
$L' \otimes_{D'} D = L \otimes_{D'} (D' \otimes_{B'} B) = L \otimes_{B'} B$
and similarly
$L' \otimes_{D'} C' = L \otimes_{D'} (D' \otimes_{B'} A') = L \otimes_{B'} A'$
hence the diagram
$$
\xymatrix{
\text{Mod}_{D'} \ar[r] \ar[d] &
\text{Mod}_D \times_{\text{Mod}_C} \text{Mod}_{C'} \ar[d] \\
\text{Mod}_{B'} \ar[r] &
\text{Mod}_B \times_{\text{Mod}_A} \text{Mod}_{A'}
}
$$
is commutative. In the following we will write $(N, M', \varphi)$ for an
object of $\text{Mod}_D \times_{\text{Mod}_C} \text{Mod}_{C'}$,
i.e., $N$ is a $D$-module, $M'$ is an $C'$-module
and $\varphi : N \otimes_B A \to M' \otimes_{A'} A$ is an isomorphism
of $C$-modules.
However, it is often more convenient think of $\varphi$ as a $D$-linear
map $\varphi : N \to M'/IM'$ which induces an isomorphism
$N \otimes_B A \to M' \otimes_{A'} A = M'/IM'$.
\end{situation}

\begin{lemma}
\label{lemma-relative-module-over-fibre-product}
In Situation \ref{situation-relative-module-over-fibre-product}
the functor (\ref{equation-relative-functor}) has a right adjoint, namely
the functor
$$
F : (N, M', \varphi) \longmapsto N \times_{\varphi, M} M'
$$
where $M = M'/IM'$. Moreover, the composition of $F$ with
(\ref{equation-relative-functor}) is the identity functor on
$\text{Mod}_D \times_{\text{Mod}_C} \text{Mod}_{C'}$. In other words,
setting $N' = N \times_{\varphi, M} M'$ we have
$N' \otimes_{D'} D = N$ and $N' \otimes_{D'} C' = M'$.
\end{lemma}

\begin{proof}
The adjointness statement follows from the more general
Lemma \ref{lemma-modules}.
The final assertion follows from the corresponding assertion of
Lemma \ref{lemma-module-over-fibre-product}
because
$N' \otimes_{D'} D = N' \otimes_{D'} D' \otimes_{B'} B = N' \otimes_{B'} B$
and
$N' \otimes_{D'} C' = N' \otimes_{D'} D' \otimes_{B'} A' = N' \otimes_{B'} A'$.
\end{proof}

\begin{lemma}
\label{lemma-relative-surjection-ideals}
In Situation \ref{situation-relative-module-over-fibre-product}
the map $JD' \to IC'$ is surjective where $J = \Ker(B' \to B)$.
\end{lemma}

\begin{proof}
Since $C' = D' \otimes_{B'} A'$ we have that $IC'$ is the image
of $D' \otimes_{B'} I = C' \otimes_{A'} I \to C'$. As the ring
map $B' \to A'$ induces an isomorphism $J \to I$ the lemma follows.
\end{proof}

\begin{lemma}
\label{lemma-relative-finite-module-over-fibre-product}
Let $A, A', B, B', C, C', D, D', I, M', M, N, \varphi$ be as in
Lemma \ref{lemma-relative-module-over-fibre-product}.
If $N$ finite over $D$ and $M'$ finite over $C'$, then
$N' = N \times_{\varphi, M} M'$ is finite over $D'$.
\end{lemma}

\begin{proof}
Recall that $D' \to D \times_C C'$ is surjective by
Lemma \ref{lemma-module-over-fibre-product-bis}.
Observe that $N' = N \times_{\varphi, M} M'$ is a module
over $D \times_C C'$. We can apply
Lemma \ref{lemma-finite-module-over-fibre-product}
to the data $C, C', D, D', IC', M', M, N, \varphi$
to see that $N' = N \times_{\varphi, M} M'$ is finite
over $D \times_C C'$. Thus it is finite over $D'$.
\end{proof}

\begin{lemma}
\label{lemma-relative-flat-module-over-fibre-product}
With $A, A', B, B', C, C', D, D', I$ as in
Situation \ref{situation-relative-module-over-fibre-product}.
\begin{enumerate}
\item Let $(N, M', \varphi)$ be an object of
$\text{Mod}_D \times_{\text{Mod}_C} \text{Mod}_{C'}$.
If $M'$ is flat over $A'$ and $N$ is flat over $B$, then
$N' = N \times_{\varphi, M} M'$ is flat over $B'$.
\item If $L'$ is a $D'$-module flat over $B'$, then
$L' = (L \otimes_{D'} D) \times_{(L \otimes_{D'} C)} (L \otimes_{D'} C')$.
\item The category of $D'$-modules flat over $B'$
is equivalent to the categories of objects $(N, M', \varphi)$
of $\text{Mod}_D \times_{\text{Mod}_C} \text{Mod}_{C'}$
with $N$ flat over $B$ and $M'$ flat over $A'$.
\end{enumerate}
\end{lemma}

\begin{proof}
Part (1) follows from part (1) of
Lemma \ref{lemma-flat-module-over-fibre-product}.

\medskip\noindent
Part (2) follows from part (2) of
Lemma \ref{lemma-flat-module-over-fibre-product}
using that $L' \otimes_{D'} D = L' \otimes_{B'} B$,
$L' \otimes_{D'} C' = L' \otimes_{B'} A'$, and
$L' \otimes_{D'} C = L' \otimes_{B'} A$, see discussion in
Situation \ref{situation-relative-module-over-fibre-product}.

\medskip\noindent
Part (3) is an immediate consequence of (1) and (2).
\end{proof}

\noindent
The following lemma is a good deal more interesting than its
counter part in the absolute case
(Lemma \ref{lemma-finitely-presented-module-over-fibre-product}),
although the proof is essentially the same.

\begin{lemma}
\label{lemma-relative-finitely-presented-module-over-fibre-product}
Let $A, A', B, B', C, C', D, D', I, M', M, N, \varphi$ be as in
Lemma \ref{lemma-relative-module-over-fibre-product}. If
\begin{enumerate}
\item $N$ is finitely presented over $D$ and flat over $B$,
\item $M'$ finitely presented over $C'$ and flat over $A'$, and
\item the ring map $B' \to D'$ factors as $B' \to D'' \to D'$
with $B' \to D''$ flat and $D'' \to D'$ of finite presentation,
\end{enumerate}
then $N' = N \times_M M'$ is finitely presented over $D'$.
\end{lemma}

\begin{proof}
Choose a surjection $D''' = D''[x_1, \ldots, x_n] \to D'$ with
finitely generated kernel $J$.
By Algebra, Lemma \ref{algebra-lemma-finite-finitely-presented-extension}
it suffices to show that $N'$ is finitely presented as a
$D'''$-module. Moreover, $D''' \otimes_{B'} B \to D' \otimes_{B'} B = D$
and $D''' \otimes_{B'} A' \to D' \otimes_{B'} A' = C'$ are surjections
whose kernels are generated by the image of $J$, hence $N$ is a
finitely presented $D''' \otimes_{B'} B$-module and
$M'$ is a finitely presented $D''' \otimes_{B'} A'$-module by
Algebra, Lemma \ref{algebra-lemma-finite-finitely-presented-extension}
again. Thus we may replace $D'$ by $D'''$ and $D$ by
$D''' \otimes_{B'} B$, etc. Since $D'''$ is
flat over $B'$, it follows that we may assume that $B' \to D'$ is flat.

\medskip\noindent
Assume $B' \to D'$ is flat.
By Lemma \ref{lemma-relative-finite-module-over-fibre-product}
the module $N'$ is finite over $D'$. Choose a surjection
$(D')^{\oplus n} \to N'$ with kernel $K'$. By base change we obtain maps
$D^{\oplus n} \to N$, $(C')^{\oplus n} \to M'$, and $C^{\oplus n} \to M$
with kernels $K_D$, $K_{C'}$, and $K_C$. There is a canonical map
$$
K' \longrightarrow K_D \times_{K_C} K_{C'}
$$
On the other hand, since $N' = N \times_M M'$ and
$D' = D \times_C C'$ (by Lemma \ref{lemma-flat-module-over-fibre-product};
applied to the flat $B'$-module $D'$)
there is also a
canonical map $K_D \times_{K_C} K_{C'} \to K'$ inverse to the displayed
arrow. Hence the displayed map is an isomorphism. By
Algebra, Lemma \ref{algebra-lemma-extension}
the modules $K_D$ and $K_{C'}$ are finite. We conclude from
Lemma \ref{lemma-relative-finite-module-over-fibre-product}
that $K'$ is a finite $D'$-module provided that $K_D \to K_C$ and
$K_{C'} \to K_C$ induce isomorphisms
$K_D \otimes_B A = K_C = K_{C'} \otimes_{A'} A$.
This is true because the flatness assumptions implies the sequences
$$
0 \to K_D \to D^{\oplus n} \to N \to 0
\quad\text{and}\quad
0 \to K_{C'} \to (C')^{\oplus n} \to M' \to 0
$$
stay exact upon tensoring, see
Algebra, Lemma \ref{algebra-lemma-flat-tor-zero}.
\end{proof}

\begin{lemma}
\label{lemma-properties-algebras-over-fibre-product}
Let $A, A', B, B', I$ be as in
Situation \ref{situation-module-over-fibre-product}.
Let $(D, C', \varphi)$ be a system consisting of an $B$-algebra $D$,
a $A'$-algebra $C'$ and an isomorphism $D \otimes_B A \to C'/IC' = C$.
Set $D' = D \times_C C'$ (as in
Lemma \ref{lemma-module-over-fibre-product}). Then
\begin{enumerate}
\item $B' \to D'$ is finite type if and only if $B \to D$ and
$A' \to C'$ are finite type,
\item $B' \to D'$ is flat if and only if $B \to D$ and $A' \to C'$ are flat,
\item $B' \to D'$ is flat and of finite presentation if and only if
$B \to D$ and $A' \to C'$ are flat and of finite presentation,
\item $B' \to D'$ is smooth if and only if $B \to D$ and $A' \to C'$ are smooth,
\item $B' \to D'$ is \'etale if and only if $B \to D$ and $A' \to C'$
are \'etale.
\end{enumerate}
Moreover, if $D'$ is a flat $B'$-algebra, then
$D' \to (D' \otimes_{B'} B) \times_{(D' \otimes_{B'} A)} (D' \otimes_{B'} A')$
is an isomorphism. In this way the category of flat $B'$-algebras
is equivalent to the categories of systems $(D, C', \varphi)$ as above
with $D$ flat over $B$ and $C'$ flat over $A'$.
\end{lemma}

\begin{proof}
The implication ``$\Rightarrow$'' follows from
Algebra, Lemmas \ref{algebra-lemma-base-change-finiteness},
\ref{algebra-lemma-flat-base-change},
\ref{algebra-lemma-base-change-smooth}, and
\ref{algebra-lemma-etale} because we have
$D' \otimes_{B'} B = D$ and $D' \otimes_{B'} A' = C'$
by Lemma \ref{lemma-module-over-fibre-product}.
Thus it suffices to prove the implications in the other direction.

\medskip\noindent
Ad (1). Assume $D$ of finite type over $B$ and $C'$ of finite type over $A'$.
We will use the results of
Lemma \ref{lemma-module-over-fibre-product}
without further mention. Choose generators $x_1, \ldots, x_r$ of $D$ over $B$
and generators $y_1, \ldots, y_s$ of $C'$ over $A'$. Using that
$D = D' \otimes_{B'} B$ and $B' \to B$ is surjective we can find
$u_1, \ldots, u_r \in D'$ mapping to $x_1, \ldots, x_r$ in $D$.
Using that $C' = D' \otimes_{B'} A'$ we can find $v_1, \ldots, v_t \in D'$
such that $y_i = \sum v_j \otimes a'_{ij}$ for some $a'_{ij} \in A'$.
In particular, the images of $v_j$ in $C'$ generate $C'$ as an
$A'$-algebra. Set $N = r + t$ and consider the cube of rings
$$
\xymatrix{
A[x_1, \ldots, x_N] & & A'[x_1, \ldots, x_N] \ar[ll] \\
& A \ar[lu] & & A' \ar[ll] \ar[lu] \\
B[x_1, \ldots, x_N] \ar[uu] & & B'[x_1, \ldots, x_N] \ar[uu] \ar[ll] \\
& B \ar[uu] \ar[lu] & & B' \ar[ll] \ar[uu] \ar[lu]
}
$$
Observe that the back square is cartesian as well.
Consider the ring map
$$
B'[x_1, \ldots, x_N] \to D',\quad
x_i \mapsto u_i \quad\text{and}\quad x_{r + j} \mapsto v_j.
$$
Then we see that the induced maps $B[x_1, \ldots, x_N] \to D$ and
$A'[x_1, \ldots, x_N] \to C'$
are surjective, in particular finite. We conclude from
Lemma \ref{lemma-relative-finite-module-over-fibre-product}
that $B'[x_1, \ldots, x_N] \to D'$ is finite, which implies that $D'$
is of finite type over $B'$ for example by
Algebra, Lemma \ref{algebra-lemma-compose-finite-type}.

\medskip\noindent
Ad (2). The implication ``$\Leftarrow$'' follows from
Lemma \ref{lemma-relative-flat-module-over-fibre-product}.
Moreover, the final statement follows from the final
statement of Lemma \ref{lemma-relative-flat-module-over-fibre-product}.

\medskip\noindent
Ad (3). Assume $B \to D$ and $A' \to C'$ are flat and of finite presentation.
The flatness of $B' \to D'$ we've seen in (2). We know $B' \to D'$
is of finite type by (1). Choose a surjection $B'[x_1, \ldots, x_N] \to D'$.
By Algebra, Lemma \ref{algebra-lemma-finite-presentation-independent}
the ring $D$ is of finite presentation as a $B[x_1, \ldots, x_N]$-module
and the ring $C'$ is of finite presentation as a
$A'[x_1, \ldots, x_N]$-module. By
Lemma \ref{lemma-relative-finitely-presented-module-over-fibre-product}
we see that $D'$ is of finite presentation as a $B'[x_1, \ldots, x_N]$-module,
i.e., $B' \to D'$ is of finite presentation.

\medskip\noindent
Ad (4). Assume $B \to D$ and $A' \to C'$ smooth.
By (3) we see that $B' \to D'$ is flat and of finite presentation.
By Algebra, Lemma \ref{algebra-lemma-flat-fibre-smooth}
it suffices to check that $D' \otimes_{B'} k$ is smooth for any
field $k$ over $B'$. If the composition $J \to B' \to k$ is zero,
then $B' \to k$ factors as $B' \to B \to k$ and we see that
$$
D' \otimes_{B'} k = D' \otimes_{B'} B \otimes_B k
= D \otimes_B k
$$
is smooth as $B \to D$ is smooth. If the composition $J \to B' \to k$
is nonzero, then there exists an $h \in J$ which does not map to zero
in $k$. Then $B' \to k$ factors as $B' \to B'_h \to k$.
Observe that $h$ maps to zero in $B$, hence $B_h = 0$.
Thus by Lemma \ref{lemma-diagram-localize} we have $B'_h = A'_h$ and we get
$$
D' \otimes_{B'} k = D' \otimes_{B'} B'_h \otimes_{B'_h} k
= C'_h \otimes_{A'_h} k
$$
is smooth as $A' \to C'$ is smooth.

\medskip\noindent
Ad (5). Assume $B \to D$ and $A' \to C'$ are \'etale. By (4) we see that
$B' \to D'$ is smooth. As we can read off whether or not a smooth
map is \'etale from the dimension of fibres we see that (5) holds
(argue as in the proof of (4) to identify fibres -- some details omitted).
\end{proof}

\begin{remark}
\label{remark-relative-modules-over-fibre-product}
In Situation \ref{situation-relative-module-over-fibre-product}.
Assume $B' \to D'$ is of finite presentation and
suppose we are given a $D'$-module $L'$.
We claim there is a bijective correspondence between
\begin{enumerate}
\item surjections of $D'$-modules $L' \to Q'$ with $Q'$ of finite presentation
over $D'$ and flat over $B'$, and
\item pairs of surjections of modules
$(L' \otimes_{D'} D \to Q_1, L' \otimes_{D'} C' \to Q_2)$
with
\begin{enumerate}
\item $Q_1$ of finite presentation over $D$ and flat over $B$,
\item $Q_2$ of finite presentation over $C'$ and flat over $A'$,
\item $Q_1 \otimes_D C = Q_2 \otimes_{C'} C$ as quotients of
$L' \otimes_{D'} C$.
\end{enumerate}
\end{enumerate}
The correspondence between these is given by $Q \mapsto (Q_1, Q_2)$ with
$Q_1 = Q \otimes_{D'} D$ and $Q_2 = Q \otimes_{D'} C'$. And for the converse
we use $Q = Q_1 \times_{Q_{12}} Q_2$ where $Q_{12}$ the common quotient
$Q_1 \otimes_D C = Q_2 \otimes_{C'} C$ of $L' \otimes_{D'} C$. As quotient
map we use
$$
L' \longrightarrow
(L' \otimes_{D'} D) \times_{(L' \otimes_{D'} C)} (L' \otimes_{D'} C')
\longrightarrow Q_1 \times_{Q_{12}} Q_2 = Q
$$
where the first arrow is surjective by
Lemma \ref{lemma-module-over-fibre-product-bis}
and the second by Lemma \ref{lemma-surjection-module-over-fibre-product}.
The claim follows by
Lemmas \ref{lemma-relative-flat-module-over-fibre-product} and
\ref{lemma-relative-finitely-presented-module-over-fibre-product}.
\end{remark}








\section{Fitting ideals}
\label{section-fitting-ideals}

\noindent
The Fitting ideals of a finite module are the ideals determined
by the construction of Lemma \ref{lemma-fitting-ideal}.

\begin{lemma}
\label{lemma-ideals-generated-by-minors}
Let $R$ be a ring. Let $A$ be an $n \times m$ matrix with coefficients
in $R$. Let $I_r(A)$ be the ideal generated by the $r \times r$-minors
of $A$ with the convention that $I_0(A) = R$ and $I_r(A) = 0$ if
$r > \min(n, m)$. Then
\begin{enumerate}
\item $I_0(A) \supset I_1(A) \supset I_2(A) \supset \ldots$,
\item if $B$ is an $(n + n') \times m$ matrix, and $A$ is the first
$n$ rows of $B$, then $I_{r + n'}(B) \subset I_r(A)$,
\item if $C$ is an $n \times n$ matrix then $I_r(CA) \subset I_r(A)$.
\item If $A$ is a block matrix
$$
\left(
\begin{matrix}
A_1 & 0 \\
0 & A_2 
\end{matrix}
\right)
$$
then $I_r(A) = \sum_{r_1 + r_2 = r} I_{r_1}(A_1) I_{r_2}(A_2)$.
\item Add more here.
\end{enumerate}
\end{lemma}

\begin{proof}
Omitted. (Hint: Use that a determinant can be computed by expanding
along a column or a row.)
\end{proof}

\begin{lemma}
\label{lemma-fitting-ideal}
Let $R$ be a ring. Let $M$ be a finite $R$-module. Choose a presentation
$$
\bigoplus\nolimits_{j \in J} R \longrightarrow R^{\oplus n}
\longrightarrow M \longrightarrow 0.
$$
of $M$. Let $A = (a_{ij})_{i = 1, \ldots, n, j \in J}$ be the matrix
of the map $\bigoplus_{j \in J} R \to R^{\oplus n}$.
The ideal $\text{Fit}_k(M)$ generated by the
$(n - k) \times (n - k)$ minors of
$A$ is independent of the choice of the presentation.
\end{lemma}

\begin{proof}
Let $K \subset R^{\oplus n}$ be the kernel of the surjection
$R^{\oplus n} \to M$. Pick $z_1, \ldots, z_{n - k} \in K$
and write $z_j = (z_{1j}, \ldots, z_{nj})$.
Another description of the ideal $\text{Fit}_k(M)$
is that it is the ideal generated by the $(n - k) \times (n - k)$ minors of
all the matrices $(z_{ij})$ we obtain in this way.

\medskip\noindent
Suppose we change the surjection into the surjection
$R^{\oplus n + n'} \to M$ with kernel $K'$ where we use the original
map on the first $n$ standard basis elements of $R^{\oplus n + n'}$
and $0$ on the last $n'$ basis vectors. Then the corresponding ideals
are the same. Namely, if $z_1, \ldots, z_{n - k} \in K$ as above,
let $z'_j = (z_{1j}, \ldots, z_{nj}, 0, \ldots, 0) \in K'$ for
$j = 1, \ldots, n - k$ and
$z'_{n + j'} = (0, \ldots, 0, 1, 0, \ldots, 0) \in K'$. Then we see that
the ideal of $(n - k) \times (n - k)$ minors of $(z_{ij})$ agrees
with the ideal of $(n + n' - k) \times (n + n' - k)$ minors of
$(z'_{ij})$. This gives one of the inclusions.
Conversely, given  $z'_1, \ldots, z'_{n + n' - k}$
in $K'$ we can project these to $R^{\oplus n}$ to get
$z_1, \ldots, z_{n + n' - k}$ in $K$. By
Lemma \ref{lemma-ideals-generated-by-minors}
we see that the ideal generated by the
$(n + n' - k) \times (n + n' - k)$ minors of
$(z'_{ij})$ is contained in the ideal generated by the
$(n - k) \times (n - k)$ minors of $(z_{ij})$. This gives the
other inclusion.

\medskip\noindent
Let $R^{\oplus m} \to M$ be another surjection with kernel $L$.
By Schanuel's lemma (Algebra, Lemma \ref{algebra-lemma-Schanuel})
and the results of the previous paragraph, we may assume $m = n$
and that there is an isomorphism $R^{\oplus n} \to R^{\oplus m}$
commuting with the surjections to $M$. Let $C = (c_{li})$ be the
(invertible) matrix of this map (it is a square matrix as $n = m$).
Then given $z'_1, \ldots, z'_{n - k} \in L$ as above we can find
$z_1, \ldots, z_{n - k} \in K$ with
$z_1' = Cz_1, \ldots, z'_{n - k} = Cz_{n - k}$. By
Lemma \ref{lemma-ideals-generated-by-minors} we get one of the
inclusions. By symmetry we get the other.
\end{proof}

\begin{definition}
\label{definition-fitting-ideal}
Let $R$ be a ring. Let $M$ be a finite $R$-module. Let $k \geq 0$.
The {\it $k$th Fitting ideal} of $M$ is the ideal $\text{Fit}_k(M)$
constructed in Lemma \ref{lemma-fitting-ideal}. Set $\text{Fit}_{-1}(M) = 0$.
\end{definition}

\noindent
Since the Fitting ideals are the ideals of minors of a big matrix
(numbered in reverse ordering from the ordering in
Lemma \ref{lemma-ideals-generated-by-minors})
we see that
$$
0 = \text{Fit}_{-1}(M) \subset \text{Fit}_0(M) \subset \text{Fit}_1(M)
\subset \ldots \subset \text{Fit}_t(M) = R
$$
for some $t \gg 0$. Here are some basic properties of Fitting ideals.

\begin{lemma}
\label{lemma-fitting-ideal-basics}
Let $R$ be a ring. Let $M$ be a finite $R$-module.
\begin{enumerate}
\item If $M$ can be generated by $n$ elements, then
$\text{Fit}_n(M) = R$.
\item Given a second finite $R$-module $M'$ we have
$$
\text{Fit}_l(M \oplus M') =
\sum\nolimits_{k + k' = l} \text{Fit}_k(M)\text{Fit}_{k'}(M')
$$
\item If $R \to R'$ is a ring map, then $\text{Fit}_k(M \otimes_R R')$
is the ideal of $R'$ generated by the image of $\text{Fit}_k(M)$.
\item If $M$ is of finite presentation, then $\text{Fit}_k(M)$
is a finitely generated ideal.
\item If $M \to M'$ is a surjection, then
$\text{Fit}_k(M) \subset \text{Fit}_k(M')$.
\item We have $\text{Fit}_0(M) \subset \text{Ann}_R(M)$.
\item We have $V(\text{Fit}_0(M)) = \text{Supp}(M)$.
\item Add more here.
\end{enumerate}
\end{lemma}

\begin{proof}
Part (1) follows from the fact that $I_0(A) = R$ in
Lemma \ref{lemma-ideals-generated-by-minors}.

\medskip\noindent
Part (2) follows form the corresponding statement in
Lemma \ref{lemma-ideals-generated-by-minors}.

\medskip\noindent
Part (3) follows from the fact that $\otimes_R R'$ is right exact,
so the base change of a presentation of $M$ is a presentation of
$M \otimes_R R'$.

\medskip\noindent
Proof of (4). Let $R^{\oplus m} \xrightarrow{A} R^{\oplus n} \to M \to 0$
be a presentation. Then $\text{Fit}_k(M)$ is the ideal generated by the
$n - k \times n - k$ minors of the matrix $A$.

\medskip\noindent
Part (5) is immediate from the definition.

\medskip\noindent
Proof of (6). Choose a presentation of $M$ with matrix $A$
as in Lemma \ref{lemma-fitting-ideal}.
Let $J' \subset J$ be a subset of cardinality $n$.
It suffices to show that
$f = \det(a_{ij})_{i = 1, \ldots, n, j \in J'}$
annihilates $M$.
This is clear because the cokernel of
$$
R^{\oplus n} \xrightarrow{A' = (a_{ij})_{i = 1, \ldots, n, j \in J'}}
R^{\oplus n} \to M \to 0
$$
is killed by $f$ as there is a matrix $B$ with $A' B = f1_{n \times n}$.

\medskip\noindent
Proof of (7). Choose a presentation of $M$ with matrix $A$
as in Lemma \ref{lemma-fitting-ideal}.
By Nakayama's lemma (Algebra, Lemma \ref{algebra-lemma-NAK})
we have
$$
M_\mathfrak p \not = 0
\Leftrightarrow
M \otimes_R \kappa(\mathfrak p) \not = 0
\Leftrightarrow
\text{rank}(\text{image }A\text{ in }\kappa(\mathfrak p)) < n
$$
Clearly $\text{Fit}_0(M)$ exactly cuts out the set of primes
with this property.
\end{proof}

\begin{example}
\label{example-fitting-free}
Let $R$ be a ring.
The Fitting ideals of the finite free module $M = R^{\oplus n}$
are $\text{Fit}_k(M) = 0$ for $k < n$ and $\text{Fit}_k(M) = R$
for $k \geq n$.
\end{example}

\begin{example}
\label{example-laurent}
Let $R$ be a ring and let $I, J\subset R$ be ideals.
Then $\text{Fit}_0(R/I) = I$, $\text{Fit}_0(R/I \oplus R/J) = IJ$,
$\text{Fit}_1(R/I\oplus R/J) = I+J$.
\end{example}

\begin{lemma}
\label{lemma-fitting-ideal-generate-locally}
Let $R$ be a ring. Let $M$ be a finite $R$-module. Let $k \geq 0$.
Let $\mathfrak p \subset R$ be a prime ideal. The following
are equivalent
\begin{enumerate}
\item $\text{Fit}_k(M) \not \subset \mathfrak p$,
\item $\dim_{\kappa(\mathfrak p)} M \otimes_R \kappa(\mathfrak p) \leq k$,
\item $M_\mathfrak p$ can be generated by $k$ elements over $R_\mathfrak p$, and
\item $M_f$ can be generated by $k$ elements over $R_f$
for some $f \in R$, $f \not \in \mathfrak p$.
\end{enumerate}
\end{lemma}

\begin{proof}
By Nakayama's lemma (Algebra, Lemma \ref{algebra-lemma-NAK}) we see that
$M_f$ can be generated by $k$ elements over $R_f$ for some
$f \in R$, $f \not \in \mathfrak p$ if $M \otimes_R \kappa(\mathfrak p)$
can be generated by $k$ elements. Hence (2), (3), and (4)
are equivalent. Using
Lemma \ref{lemma-fitting-ideal-basics} part (3)
this reduces the problem to the
case where $R$ is a field and $\mathfrak p = (0)$. In this case
the result follows from Example \ref{example-fitting-free}.
\end{proof}

\begin{lemma}
\label{lemma-fitting-ideal-finite-locally-free}
Let $R$ be a ring. Let $M$ be a finite $R$-module. Let $r \geq 0$.
The following are equivalent
\begin{enumerate}
\item $M$ is finite locally free of rank $r$
(Algebra, Definition \ref{algebra-definition-locally-free}),
\item $\text{Fit}_{r - 1}(M) = 0$ and $\text{Fit}_r(M) = R$, and
\item $\text{Fit}_k(M) = 0$ for $k < r$ and $\text{Fit}_k(M) = R$
for $k \geq r$.
\end{enumerate}
\end{lemma}

\begin{proof}
It is immediate that (2) is equivalent to (3) because the Fitting ideals
form an increasing sequence of ideals.
Since the formation of $\text{Fit}_k(M)$ commutes with base change
(Lemma \ref{lemma-fitting-ideal-basics}) we see that (1) implies (2) by
Example \ref{example-fitting-free}
and glueing results (Algebra, Section \ref{algebra-section-more-glueing}).
Conversely, assume (2). By
Lemma \ref{lemma-fitting-ideal-generate-locally} we may assume that $M$
is generated by $r$ elements. Thus a presentation
$\bigoplus_{j \in J} R \to R^{\oplus r} \to M \to 0$.
But now the assumption that $\text{Fit}_{r - 1}(M) = 0$ implies
that all entries of the matrix of the map
$\bigoplus_{j \in J} R \to R^{\oplus r}$ are zero.
Thus $M$ is free.
\end{proof}

\begin{lemma}
\label{lemma-principal-fitting-ideal}
Let $R$ be a local ring. Let $M$ be a finite $R$-module. Let $k \geq 0$.
Assume that $\text{Fit}_k(M) = (f)$ for some $f \in R$.
Let $M'$ be the quotient of $M$ by $\{x \in M \mid fx = 0\}$. Then
$M'$ can be generated by $k$ elements.
\end{lemma}

\begin{proof}
Choose generators $x_1, \ldots, x_n \in M$ corresponding to the
surjection $R^{\oplus n} \to M$. Since $R$ is local if a set
of elements $E \subset (f)$ generates $(f)$, then some $e \in E$ generates
$(f)$, see Algebra, Lemma \ref{algebra-lemma-NAK}. Hence we may pick
$z_1, \ldots, z_{n - k}$ in the kernel of $R^{\oplus n} \to M$ such
that some $(n - k) \times (n - k)$ minor of the $n \times (n - k)$
matrix $A = (z_{ij})$ generates $(f)$. After renumbering the $x_i$ we may
assume the first minor $\det(z_{ij})_{1 \leq i, j \leq n - k}$
generates $(f)$, i.e., $\det(z_{ij})_{1 \leq i, j \leq n - k} = uf$
for some unit $u \in R$. Every other minor is a multiple of $f$.
By Algebra, Lemma \ref{algebra-lemma-matrix-right-inverse} there exists a
$n - k \times n - k$ matrix $B$ such that
$$
AB = f
\left(
\begin{matrix}
u 1_{n - k \times n - k} \\
C
\end{matrix}
\right)
$$
for some matrix $C$ with coefficients in $R$. This implies that for every
$i \leq n - k$ the element $y_i = ux_i + \sum_j c_{ji}x_j$ is annihilated
by $f$. Since $M/\sum Ry_i$ is generated by the images of
$x_{n - k + 1}, \ldots, x_n$ we win.
\end{proof}

\begin{lemma}
\label{lemma-fitting-ideals-and-pd1}
Let $R$ be a ring. Let $M$ be a finitely presented $R$-module. Let $k \geq 0$.
Assume that $\text{Fit}_k(M) = (f)$ for some nonzerodivisor $f \in R$
and $\text{Fit}_{k - 1}(M) = 0$. Then
\begin{enumerate}
\item $M$ has projective dimension $\leq 1$,
\item $M' = \Ker(f : M \to M)$ is the $f$-power torsion submodule of $M$,
\item $M'$ has projective dimension $\leq 1$,
\item $M/M'$ is finite locally free of rank $k$, and
\item $M \cong M/M' \oplus M'$.
\end{enumerate}
\end{lemma}

\begin{proof}
Choose a presentation
$$
R^{\oplus m} \xrightarrow{A} R^{\oplus n} \to M \to 0
$$
for some matrix $A$ with coefficients in $R$.

\medskip\noindent
We first prove the lemma when $R$ is local.
Set $M' = \{x \in M \mid fx = 0\}$ as in the statement. By
Lemma \ref{lemma-principal-fitting-ideal} we can choose
$x_1, \ldots, x_k \in M$ which generate $M/M'$. Then
$x_1, \ldots, x_k$ generate $M_f = (M/M')_f$. Hence,
if there is a relation $\sum a_ix_i = 0$ in $M$,
then we see that $a_1, \ldots, a_k$ map to zero in $R_f$
since otherwise $\text{Fit}_{k - 1}(M) R_f = \text{Fit}_{k - 1}(M_f)$
would be nonzero.
Since $f$ is a nonzerodivisor, we conclude $a_1 = \ldots = a_k = 0$.
Thus $M \cong R^{\oplus k} \oplus M'$. After a change of basis
in our presentation above, we may assume the first $n - k$
basis vectors of $R^{\oplus n}$ map into the summand $M'$ of $M$
and the last $k$-basis vectors of $R^{\oplus n}$ map to
basis elements of the summand $R^{\oplus k}$ of $M$.
Having done so, the last $k$ rows of the matrix $A$ vanish.
In this way we see that, replacing $M$ by $M'$, $k$ by $0$,
$n$ by $n - k$, and $A$ by the submatrix where we
delete the last $k$ rows, we reduce to the case discussed
in the next paragraph.

\medskip\noindent
Assume $R$ is local, $k = 0$, and $M$ annihilated by $f$.
Now the $0$th Fitting ideal of $M$ is $(f)$ and is generated by the
$n \times n$ minors of the matrix $A$ of size $n \times m$.
(This in particular implies $m \geq n$.)
Since $R$ is local, some $n \times n$ minor of $A$ is $uf$
for a unit $u \in R$.
After renumbering we may assume this minor is the first one.
Moreover, we know all other $n \times n$ minors of $A$ are
divisible by $f$. Write $A = (A_1 A_2)$ in block form where
$A_1$ is an $n \times n$ matrix and $A_2$ is an
$n \times (m - n)$ matrix. By
Algebra, Lemma \ref{algebra-lemma-matrix-right-inverse}
applied to the transpose of $A$ (!) we find there exists an
$n \times n$ matrix $B$ such that
$$
BA = B(A_1 A_2) = f
\left(
\begin{matrix}
u 1_{n \times n} & C
\end{matrix}
\right)
$$
for some $n \times (m - n)$ matrix $C$ with coefficients in $R$.
Then we first conclude $BA_1 = fu 1_{n \times n}$.
Thus
$$
BA_2 = fC = u^{-1}fuC = u^{-1}BA_1C
$$
Since the determinant of $B$ is a nonzerodivisor we conclude
that $A_2 = u^{-1}A_1C$. Therefore the image of $A$ is equal
to the image of $A_1$ which is isomorphic to $R^{\oplus n}$
because the determinant of $A_1$ is a nonzerodivisor.
Hence $M$ has projective dimension $\leq 1$.

\medskip\noindent
We return to the case of a general ring $R$. By the local case
we see that $M/M'$ is a finite locally free module of rank $k$, see
Algebra, Lemma \ref{algebra-lemma-finite-projective}. Hence the extension
$0 \to M' \to M \to M/M' \to 0$ splits. It follows that $M'$
is a finitely presented module. Choose a short exact sequence
$0 \to K \to R^{\oplus a} \to M' \to 0$. Then $K$ is a finite
$R$-module, see Algebra, Lemma \ref{algebra-lemma-extension}.
By the local case we see that $K_\mathfrak p \cong R_\mathfrak p^{\oplus a}$
for all primes. Hence by
Algebra, Lemma \ref{algebra-lemma-finite-projective}
again we see that $K$ is finite locally free of rank $a$.
It follows that $M'$ has projective dimension $\leq 1$
and the lemma is proved.
\end{proof}










\section{Lifting}
\label{section-lifting}

\noindent
In this section we collection some lemmas concerning lifting
statements of the following kind: If $A$ is a ring and $I \subset A$
is an ideal, and $\overline{\xi}$ is some kind of structure over
$A/I$, then we can lift $\overline{\xi}$ to a similar kind of structure
$\xi$ over $A$ or over some \'etale extension of $A$. Here are some types
of structure for which we have already proved some results:
\begin{enumerate}
\item idempotents, see
Algebra, Lemmas \ref{algebra-lemma-lift-idempotents} and
\ref{algebra-lemma-lift-idempotents-noncommutative},
\item projective modules, see
Algebra, Lemmas \ref{algebra-lemma-lift-projective-module} and
\ref{algebra-lemma-lift-finite-projective-module},
\item finite stably free modules, see Lemma \ref{lemma-lift-stably-free},
\item basis elements, see
Algebra, Lemmas \ref{algebra-lemma-local-artinian-basis-when-flat} and
\ref{algebra-lemma-lift-basis},
\item ring maps, i.e., proving certain algebras are formally smooth, see
Algebra, Lemma \ref{algebra-lemma-polynomial-ring-formally-smooth},
Proposition \ref{algebra-proposition-smooth-formally-smooth}, and
Lemma \ref{algebra-lemma-smooth-strong-lift},
\item syntomic ring maps, see
Algebra, Lemma \ref{algebra-lemma-lift-syntomic},
\item smooth ring maps, see
Algebra, Lemma \ref{algebra-lemma-lift-smooth},
\item \'etale ring maps, see
Algebra, Lemma \ref{algebra-lemma-lift-etale},
\item factoring polynomials, see
Algebra, Lemma \ref{algebra-lemma-factor-mod-lift-etale}, and
\item Algebra, Section \ref{algebra-section-henselian} discusses henselian
local rings.
\end{enumerate}
The interested reader will find more results of this nature in
Smoothing Ring Maps, Section \ref{smoothing-section-presentations}
in particular
Smoothing Ring Maps, Proposition \ref{smoothing-proposition-lift-smooth}.

\medskip\noindent
Let $A$ be a ring and let $I \subset A$ be an ideal. Let $\overline{\xi}$
be some kind of structure over $A/I$. In the following lemmas we look for
\'etale ring maps $A \to A'$ which induce isomorphisms $A/I \to A'/IA'$
and objects $\xi'$ over $A'$ lifting $\overline{\xi}$. A general remark is
that given \'etale ring maps $A \to A' \to A''$ such that
$A/I \cong A'/IA'$ and $A'/IA' \cong A''/IA''$ the composition
$A \to A''$ is also \'etale (Algebra, Lemma \ref{algebra-lemma-etale})
and also satisfies $A/I \cong A''/IA''$.
We will frequently use this in the following lemmas without further mention.
Here is a trivial example of the type of result we are looking for.

\begin{lemma}
\label{lemma-lift-invertible-element}
Let $A$ be a ring, let $I \subset A$ be an ideal, let $\overline{u} \in A/I$
be an invertible element. There exists an \'etale ring map $A \to A'$ which
induces an isomorphism $A/I \to A'/IA'$ and an invertible element $u' \in A'$
lifting $\overline{u}$.
\end{lemma}

\begin{proof}
Choose any lift $f \in A$ of $\overline{u}$ and set $A' = A_f$ and $u$
the image of $f$ in $A'$.
\end{proof}

\begin{lemma}
\label{lemma-lift-idempotent}
Let $A$ be a ring, let $I \subset A$ be an ideal, let $\overline{e} \in A/I$
be an idempotent. There exists an \'etale ring map $A \to A'$ which
induces an isomorphism $A/I \to A'/IA'$ and an idempotent $e' \in A'$
lifting $\overline{e}$.
\end{lemma}

\begin{proof}
Choose any lift $x \in A$ of $\overline{e}$. Set
$$
A' = A[t]/(t^2 - t)\left[\frac{1}{t - 1 + x}\right].
$$
The ring map $A \to A'$ is \'etale because $(2t - 1)\text{d}t = 0$
and $(2t - 1)(2t - 1) = 1$ which is invertible. We have
$A'/IA' = A/I[t]/(t^2 - t)[\frac{1}{t - 1 + \overline{e}}] \cong A/I$
the last map sending $t$ to $\overline{e}$ which works as
$\overline{e}$ is a root of $t^2 - t$. This also shows that setting
$e'$ equal to the class of $t$ in $A'$ works.
\end{proof}

\begin{lemma}
\label{lemma-lift-open-covering}
Let $A$ be a ring, let $I \subset A$ be an ideal. Let
$\Spec(A/I) = \coprod_{j \in J} \overline{U}_j$ be a finite disjoint open
covering. Then there exists an \'etale ring map $A \to A'$ which
induces an isomorphism $A/I \to A'/IA'$ and a finite disjoint open covering
$\Spec(A') = \coprod_{j \in J} U'_j$ lifting the given covering.
\end{lemma}

\begin{proof}
This follows from Lemma \ref{lemma-lift-idempotent} and
the fact that open and closed subsets of Spectra correspond
to idempotents, see Algebra, Lemma \ref{algebra-lemma-disjoint-decomposition}.
\end{proof}

\begin{lemma}
\label{lemma-localize-upstairs}
Let $A \to B$ be a ring map and $J \subset B$ an ideal. If
$A \to B$ is \'etale at every prime of $V(J)$, then there exists
a $g \in B$ mapping to an invertible element
of $B/J$ such that $A' = B_g$ is \'etale over $A$.
\end{lemma}

\begin{proof}
The set of points of $\Spec(B)$ where $A \to B$ is not \'etale is a
closed subset of $\Spec(B)$, see
Algebra, Definition \ref{algebra-definition-etale}.
Write this as $V(J')$ for some ideal $J' \subset B$. Then
$V(J') \cap V(J) = \emptyset$ hence $J + J' = B$ by
Algebra, Lemma \ref{algebra-lemma-Zariski-topology}.
Write $1 = f + g$ with $f \in J$ and $g \in J'$.
Then $g$ works.
\end{proof}

\noindent
Next we have three lemmas saying we can lift factorizations of
polynomials.

\begin{lemma}
\label{lemma-lift-factorization-monic}
Let $A$ be a ring, let $I \subset A$ be an ideal. Let $f \in A[x]$ be a
monic polynomial. Let $\overline{f} = \overline{g} \overline{h}$ be a
factorization of $f$ in $A/I[x]$ such that $\overline{g}$ and $\overline{h}$
are monic and generate the unit ideal in $A/I[x]$. Then there exists an
\'etale ring map $A \to A'$ which induces an isomorphism $A/I \to A'/IA'$
and a factorization $f = g' h'$ in $A'[x]$ with $g'$, $h'$ monic
lifting the given factorization over $A/I$.
\end{lemma}

\begin{proof}
We will deduce this from results on the universal factorization proved
earlier; however, we encourage the reader to find their own proof not
using this trick. Say $\deg(\overline{g}) = n$ and $\deg(\overline{h}) = m$ so
that $\deg(f) = n + m$. Write $f = x^{n + m} + \sum \alpha_i x^{n + m - i}$
for some $\alpha_1, \ldots, \alpha_{n + m} \in A$. Consider the ring map
$$
R = \mathbf{Z}[a_1, \ldots, a_{n + m}]
\longrightarrow
S = \mathbf{Z}[b_1, \ldots, b_n, c_1, \ldots, c_m]
$$
of Algebra, Example \ref{algebra-example-factor-polynomials-etale}.
Let $R \to A$ be the ring map which sends $a_i$ to $\alpha_i$.
Set
$$
B = A \otimes_R S
$$
By construction the image $f_B$ of $f$ in $B[x]$ factors, say
$f_B = g_B h_B$ with $g_B = x^n + \sum (1 \otimes b_i) x^{n - i}$
and similarly for $h_B$.
Write $\overline{g} = x^n + \sum \overline{\beta}_i x^{n - i}$ and
$\overline{h} = x^m + \sum \overline{\gamma}_i x^{m - i}$.
The $A$-algebra map
$$
B \longrightarrow A/I, \quad
1 \otimes b_i \mapsto \overline{\beta}_i, \quad
1 \otimes c_i \mapsto \overline{\gamma}_i
$$
maps $g_B$ and $h_B$ to $\overline{g}$ and $\overline{h}$ in $A/I[x]$.
The displayed map is surjective; denote $J \subset B$ its kernel.
From the discussion in 
Algebra, Example \ref{algebra-example-factor-polynomials-etale}
it is clear that $A \to B$ is etale at all points of $V(J) \subset \Spec(B)$.
Choose $g \in B$ as in Lemma \ref{lemma-localize-upstairs} and
consider the $A$-algebra $B_g$. Since $g$ maps to a unit
in $B/J = A/I$ we obtain also a map $B_g/I B_g \to A/I$ of $A/I$-algebras.
Since $A/I \to B_g/I B_g$ is \'etale, also $B_g/IB_g \to A/I$ is \'etale
(Algebra, Lemma \ref{algebra-lemma-map-between-etale}). Hence there exists an
idempotent $e \in B_g/I B_g$ such that $A/I = (B_g/I B_g)_e$
(Algebra, Lemma \ref{algebra-lemma-surjective-flat-finitely-presented}).
Choose a lift $h \in B_g$ of $e$. Then $A \to A' = (B_g)_h$ with
factorization given by the image of the factorization $f_B = g_B h_B$
in $A'$ is a solution to the problem posed by the lemma.
\end{proof}

\noindent
The assumption on the leading coefficient in the following lemma
will be removed in Lemma \ref{lemma-lift-factorization}.

\begin{lemma}
\label{lemma-lift-factorization-easy}
Let $A$ be a ring, let $I \subset A$ be an ideal. Let $f \in A[x]$ be a
monic polynomial. Let $\overline{f} = \overline{g} \overline{h}$ be a
factorization of $f$ in $A/I[x]$ and assume
\begin{enumerate}
\item the leading coefficient of $\overline{g}$ is an invertible element
of $A/I$, and
\item $\overline{g}$, $\overline{h}$ generate the unit ideal in $A/I[x]$.
\end{enumerate}
Then there exists an \'etale ring map $A \to A'$ which induces an
isomorphism $A/I \to A'/IA'$ and a factorization $f = g' h'$ in $A'[x]$
lifting the given factorization over $A/I$.
\end{lemma}

\begin{proof}
Applying Lemma \ref{lemma-lift-invertible-element} we may assume that
the leading coefficient of $\overline{g}$ is the reduction of an
invertible element $u \in A$. Then we may replace $\overline{g}$ by
$\overline{u}^{-1}\overline{g}$ and $\overline{h}$ by
$\overline{u}\overline{h}$. Thus we may assume that $\overline{g}$
is monic. Since $f$ is monic we conclude that $\overline{h}$ is monic
too. In this case the result follows from
Lemma \ref{lemma-lift-factorization-monic}.
\end{proof}

\begin{lemma}
\label{lemma-lift-factorization}
Let $A$ be a ring, let $I \subset A$ be an ideal.
Let $f \in A[x]$ be a monic polynomial.
Let $\overline{f} = \overline{g} \overline{h}$ be a factorization of $f$
in $A/I[x]$ and assume that  $\overline{g}$, $\overline{h}$ generate
the unit ideal in $A/I[x]$. Then there exists an \'etale ring map
$A \to A'$ which induces an isomorphism $A/I \to A'/IA'$ and a factorization
$f = g' h'$ in $A'[x]$ lifting the given factorization over $A/I$.
\end{lemma}

\begin{proof}
Say $f = x^d + a_1 x^{d - 1} + \ldots + a_d$ has degree $d$.
Write $\overline{g} = \sum \overline{b}_j x^j$ and
$\overline{h} = \sum \overline{c}_j x^j$. Then we see that
$1 = \sum \overline{b}_j \overline{c}_{d - j}$. It follows that
$\Spec(A/I)$ is covered by the standard opens
$D(\overline{b}_j \overline{c}_{d - j})$. However, each point
$\mathfrak p$ of $\Spec(A/I)$ is contained in at most one of these as
by looking at the induced factorization of $f$ over the field
$\kappa(\mathfrak p)$ we see that $\deg(\overline{g} \bmod \mathfrak p) +
\deg(\overline{h} \bmod \mathfrak p) = d$. Hence our open covering
is a disjoint open covering. Applying Lemma \ref{lemma-lift-open-covering}
(and replacing $A$ by $A'$) we see that we may assume there is a
corresponding disjoint open covering of $\Spec(A)$. This disjoint open
covering corresponds to a product decomposition of $A$, see
Algebra, Lemma \ref{algebra-lemma-disjoint-implies-product}. It follows that
$$
A = A_0 \times \ldots \times A_d,
\quad
I = I_0 \times \ldots \times I_d,
$$
where the image of $\overline{g}$, resp.\ $\overline{h}$ in $A_j/I_j$
has degree $j$, resp.\ $d - j$ with invertible leading coefficient.
Clearly, it suffices to prove the result for each factor $A_j$
separatedly. Hence the lemma follows from
Lemma \ref{lemma-lift-factorization-easy}.
\end{proof}

\begin{lemma}
\label{lemma-separate-image-closed-from-closed}
Let $R \to S$ be a ring map. Let $I \subset R$ be an ideal of $R$
and let $J \subset S$ be an ideal of $S$. If the closure of the image
of $V(J)$ in $\Spec(R)$ is disjoint from $V(I)$, then there exists
an element $f \in R$ which maps to $1$ in $R/I$ and to an element
of $J$ in $S$.
\end{lemma}

\begin{proof}
Let $I' \subset R$ be an ideal such that $V(I')$ is the closure of
the image of $V(J)$. Then $V(I) \cap V(I') = \emptyset$ by assumption
and hence $I + I' = R$ by
Algebra, Lemma \ref{algebra-lemma-Zariski-topology}.
Write $1 = g + f$ with $g \in I$ and $f \in I'$.
We have $V(f') \supset V(J)$ where $f'$ is the image of $f$ in $S$.
Hence $(f')^n \in J$ for some $n$, see
Algebra, Lemma \ref{algebra-lemma-Zariski-topology}.
Replacing $f$ by $f^n$ we win.
\end{proof}

\begin{lemma}
\label{lemma-helper-integral}
Let $I$ be an ideal of a ring $A$. Let $A \to B$ be an integral ring map.
Let $b \in B$ map to an idempotent in $B/IB$. Then there exists a
monic $f \in A[x]$ with $f(b) = 0$ and $f \bmod I = x^d(x - 1)^d$
for some $d \geq 1$.
\end{lemma}

\begin{proof}
Observe that $z = b^2 - b$ is an element of $IB$. By
Algebra, Lemma \ref{algebra-lemma-integral-integral-over-ideal}
there exist a monic polynomial
$g(x) = x^d + \sum a_j x^j$ of degree $d$ with $a_j \in I$ such that
$g(z) = 0$ in $B$. Hence $f(x) = g(x^2 - x) \in A[x]$ is a monic
polynomial such that $f(x) \equiv x^d(x - 1)^d \bmod I$
and such that $f(b) = 0$ in $B$.
\end{proof}

\begin{lemma}
\label{lemma-lift-idempotent-upstairs}
Let $A$ be a ring, let $I \subset A$ be an ideal.
Let $A \to B$ be an integral ring map.
Let $\overline{e} \in B/IB$ be an idempotent.
Then there exists an \'etale ring map $A \to A'$
which induces an isomorphism $A/I \to A'/IA'$ and an idempotent
$e' \in B \otimes_A A'$ lifting $\overline{e}$.
\end{lemma}

\begin{proof}
Choose an element $y \in B$ lifting $\overline{e}$.
Choose $f \in A[x]$ as in Lemma \ref{lemma-helper-integral} for $y$.
By Lemma \ref{lemma-lift-factorization-easy}
we can find an \'etale ring map $A \to A'$ which induces
an isomorphism $A/I \to A'/IA'$ and such that $f = gh$
in $A[x]$ with $g(x) = x^d \bmod IA'$ and $h(x) = (x - 1)^d \bmod IA'$.
After replacing $A$ by $A'$ we may assume that the factorization
is defined over $A$. In that case we see that
$b_1 = g(y) \in B$ is a lift of $\overline{e}^d = \overline{e}$ and
$b_2 = h(y) \in B$ is a lift of
$(\overline{e} - 1)^d = (-1)^d (1 - \overline{e})^d = (-1)^d(1 - \overline{e})$
and moreover $b_1b_2 = 0$. Thus $(b_1, b_2)B/IB = B/IB$ and
$V(b_1, b_2) \subset \Spec(B)$ is disjoint from $V(IB)$. Since
$\Spec(B) \to \Spec(A)$ is closed (see
Algebra, Lemmas \ref{algebra-lemma-integral-going-up} and
\ref{algebra-lemma-going-up-closed})
we can find an $a \in A$ which maps to an invertible element
of $A/I$ whose image in $B$ lies in $(b_1, b_2)$, see
Lemma \ref{lemma-separate-image-closed-from-closed}.
After replacing $A$ by the localization $A_a$ we get that
$(b_1, b_2) = B$. Then $\Spec(B) = D(b_1) \amalg D(b_2)$;
disjoint union because $b_1b_2 = 0$ and covers
$\Spec(B)$ because $(b_1, b_2) = B$. Let $e \in B$ be the idempotent
corresponding to the open and closed subset $D(b_1)$, see
Algebra, Lemma \ref{algebra-lemma-disjoint-decomposition}.
Since $b_1$ is a lift of $\overline{e}$ and $b_2$ is a
lift of $\pm (1 - \overline{e})$ we conclude that $e$ is
a lift of $\overline{e}$ by the uniqueness statement in
Algebra, Lemma \ref{algebra-lemma-disjoint-decomposition}.
\end{proof}

\begin{lemma}
\label{lemma-lift-projective-module}
Let $A$ be a ring, let $I \subset A$ be an ideal.
Let $\overline{P}$ be a finite projective $A/I$-module.
Then there exists an \'etale ring map $A \to A'$ which induces
an isomorphism $A/I \to A'/IA'$ and a finite projective
$A'$-module $P'$ lifting $\overline{P}$.
\end{lemma}

\begin{proof}
We can choose an integer $n$ and a direct sum decomposition
$(A/I)^{\oplus n} = \overline{P} \oplus \overline{K}$
for some $R/I$-module $\overline{K}$. Choose a lift
$\varphi : A^{\oplus n} \to A^{\oplus n}$ of the projector $\overline{p}$
associated to the direct summand $\overline{P}$.
Let $f \in A[x]$ be the characteristic polynomial of $\varphi$.
Set $B = A[x]/(f)$. By Cayley-Hamilton
(Algebra, Lemma \ref{algebra-lemma-charpoly}) there is a map
$B \to \text{End}_A(A^{\oplus n})$ mapping $x$ to $\varphi$.
For every prime $\mathfrak p \supset I$ the image of $f$ in
$\kappa(\mathfrak p)$ is $(x - 1)^rx^{n - r}$ where $r$ is the
dimension of $\overline{P} \otimes_{A/I} \kappa(\mathfrak p)$.
Hence $(x - 1)^nx^n$ maps to zero in $B \otimes_A \kappa(\mathfrak p)$
for all $\mathfrak p \supset I$. Thus $x(1 - x)$ is contained
in every prime ideal of $B/IB$. Hence $x^N(1 - x)^N$ is
contained in $IB$ for some $N \geq 1$.
It follows that $x^N + (1 - x)^N$ is a unit in $B/IB$ and that
$$
\overline{e} = \text{image of }\frac{x^N}{x^N + (1 - x)^N}\text{ in }B/IB
$$
is an idempotent as both assertions hold in $\mathbf{Z}[x]/(x^N(x - 1)^N)$.
The image of $\overline{e}$ in $\text{End}_{A/I}((A/I)^{\oplus n})$ is
$$
\frac{\overline{p}^N}{\overline{p}^N + (1 - \overline{p})^N} = \overline{p}
$$
as $\overline{p}$ is an idempotent. After replacing $A$ by an \'etale
extension $A'$ as in the lemma, we may assume there exists an idempotent
$e \in B$ which maps to $\overline{e}$ in $B/IB$, see
Lemma \ref{lemma-lift-idempotent-upstairs}.
Then the image of $e$ under the map
$$
B = A[x]/(f) \longrightarrow \text{End}_A(A^{\oplus n}).
$$
is an idempotent element $p$ which lifts $\overline{p}$.
Setting $P = \Im(p)$ we win.
\end{proof}

\begin{lemma}
\label{lemma-cotangent-complex-symmetric-algebra}
Let $A$ be a ring. Let $0 \to K \to A^{\oplus m} \to M \to 0$
be a sequence of $A$-modules. Consider the $A$-algebra
$C = \text{Sym}^*_A(M)$ with its presentation
$\alpha : A[y_1, \ldots, y_m] \to C$
coming from the surjection $A^{\oplus m} \to M$. Then
$$
\NL(\alpha) =
(K \otimes_A C \to \bigoplus\nolimits_{j = 1, \ldots, m} C \text{d}y_j)
$$
(see Algebra, Section \ref{algebra-section-netherlander})
in particular $\Omega_{C/A} = M \otimes_A C$.
\end{lemma}

\begin{proof}
Let $J = \Ker(\alpha)$. The lemma asserts that
$J/J^2 \cong K \otimes_A C$. Note that $\alpha$ is a homomorphism
of graded algebras. We will prove that in degree $d$ we have
$(J/J^2)_d = K \otimes_A C_{d - 1}$. Note that
$$
J_d = \Ker(\text{Sym}^d_A(A^{\oplus m}) \to \text{Sym}^d_A(M))
= \Im(K \otimes_A \text{Sym}^{d - 1}_A(A^{\oplus m})
\to \text{Sym}^d_A(A^{\oplus m})),
$$
see Algebra, Lemma \ref{algebra-lemma-presentation-sym-exterior}.
It follows that $(J^2)_d = \sum_{a + b = d} J_a \cdot J_b$ is the image of
$$
K \otimes_A K \otimes_A \text{Sym}^{d - 2}_A(A^{\otimes m})
\to \text{Sym}^d_A(A^{\oplus m}).
$$
The cokernel of the map $K \otimes_A \text{Sym}^{d - 2}_A(A^{\otimes m}) \to
\text{Sym}^{d - 1}_A(A^{\oplus m})$ is $\text{Sym}^{d - 1}_A(M)$ by
the lemma referenced above.
Hence it is clear that $(J/J^2)_d = J_d/(J^2)_d$ is equal to
\begin{align*}
\Coker(
K \otimes_A K \otimes_A \text{Sym}^{d - 2}_A(A^{\otimes m})
\to K \otimes_A \text{Sym}^{d - 1}_A(A^{\otimes m}))
& = K \otimes_A \text{Sym}^{d - 1}_A(M) \\
& = K \otimes_A C_{d -1}
\end{align*}
as desired.
\end{proof}

\begin{lemma}
\label{lemma-symmetric-algebra-smooth}
Let $A$ be a ring. Let $M$ be an $A$-module. Then $C = \text{Sym}_A^*(M)$
is smooth over $A$ if and only if $M$ is a finite projective $A$-module.
\end{lemma}

\begin{proof}
Let $\sigma : C \to A$ be the projection onto the degree $0$ part of $C$.
Then $J = \Ker(\sigma)$ is the part of degree $> 0$ and we see that
$J/J^2 = M$ as an $A$-module. Hence if $A \to C$ is smooth then $M$ is
a finite projective $A$-module by
Algebra, Lemma \ref{algebra-lemma-section-smooth}.

\medskip\noindent
Conversely, assume that $M$ is finite projective and choose a surjection
$A^{\oplus n} \to M$ with kernel $K$. Of course the sequence
$0 \to K \to A^{\oplus n} \to M \to 0$ is split as $M$ is projective.
In particular we see that $K$ is a finite $A$-module and hence
$C$ is of finite presentation over $A$ as $C$ is a quotient of
$A[x_1, \ldots, x_n]$ by the ideal generated by $K \subset \bigoplus Ax_i$.
The computation of Lemma \ref{lemma-cotangent-complex-symmetric-algebra}
shows that $\NL_{C/A}$ is homotopy equivalent to $(K \to M) \otimes_A C$.
Hence $\NL_{C/A}$ is quasi-isomorphic to $C \otimes_A M$ placed in degree
$0$ which means that $C$ is smooth over $A$ by
Algebra, Definition \ref{algebra-definition-smooth}.
\end{proof}

\begin{lemma}
\label{lemma-lift-section-smooth-morphism}
Let $A$ be a ring, let $I \subset A$ be an ideal. Consider a commutative
diagram
$$
\xymatrix{
B \ar[rd] \\
A \ar[u] \ar[r] & A/I
}
$$
where $B$ is a smooth $A$-algebra. Then there exists an \'etale ring
map $A \to A'$ which induces an isomorphism $A/I \to A'/IA'$ and an
$A$-algebra map $B \to A'$ lifting the ring map $B \to A/I$.
\end{lemma}

\begin{proof}
Let $J \subset B$ be the kernel of $B \to A/I$ so that $B/J = A/I$. By
Algebra, Lemma \ref{algebra-lemma-application-NL-smooth} the sequence
$$
0 \to I/I^2 \to J/J^2 \to \Omega_{B/A} \otimes_B B/J \to 0
$$
is split exact. Thus $\overline{P} = J/(J^2 + IB) = \Omega_{B/A} \otimes_B B/J$
is a finite projective $A/I$-module. Choose an integer $n$ and a direct sum
decomposition $A/I^{\oplus n} = \overline{P} \oplus \overline{K}$.
By Lemma \ref{lemma-lift-projective-module} we can find an
\'etale ring map $A \to A'$ which induces an isomorphism
$A/I \to A'/IA'$ and a finite projective $A$-module $K$ which
lifts $\overline{K}$. We may and do replace $A$ by $A'$.
Set $B' = B \otimes_A \text{Sym}_A^*(K)$. Since $A \to \text{Sym}_A^*(K)$
is smooth by Lemma \ref{lemma-symmetric-algebra-smooth} we see that
$B \to B'$ is smooth which in turn implies that $A \to B'$ is smooth (see
Algebra, Lemmas \ref{algebra-lemma-base-change-smooth} and
\ref{algebra-lemma-locally-smooth}).
Moreover the section $\text{Sym}^*_A(K) \to A$ determines a section
$B' \to B$ and we let $B' \to A/I$ be the composition $B' \to B \to A/I$.
Let $J' \subset B'$ be the kernel of $B' \to A/I$. We have
$JB' \subset J'$ and $B \otimes_A K \subset J'$. These maps combine
to give an isomorphism
$$
(A/I)^{\oplus n} \cong J/J^2 \oplus \overline{K}
\longrightarrow
J'/((J')^2 + IB')
$$
Thus, after replacing $B$ by $B'$ we may assume that
$J/(J^2 + IB) = \Omega_{B/A} \otimes_B B/J$ is a free
$A/I$-module of rank $n$.

\medskip\noindent
In this case, choose $f_1, \ldots, f_n \in J$ which map to a
basis of $J/(J^2 + IB)$. Consider the finitely presented $A$-algebra
$C = B/(f_1, \ldots, f_n)$. Note that we have an exact sequence
$$
0 \to H_1(L_{C/A}) \to (f_1, \ldots, f_n)/(f_1, \ldots, f_n)^2
\to \Omega_{B/A} \otimes_B C \to \Omega_{C/A} \to 0
$$
see Algebra, Lemma \ref{algebra-lemma-exact-sequence-NL} (note that
$H_1(L_{B/A}) = 0$ and that $\Omega_{B/A}$ is finite projective,
in particular flat so the Tor group vanishes). For any prime
$\mathfrak q \supset J$ of $B$ the module $\Omega_{B/A, \mathfrak q}$
is free of rank $n$ because $\Omega_{B/A}$ is finite projective and
because $\Omega_{B/A} \otimes_B B/J$ is free of rank $n$
(see Algebra, Lemma \ref{algebra-lemma-finite-projective}). By our choice
of $f_1, \ldots, f_n$ the map
$$
\left((f_1, \ldots, f_n)/(f_1, \ldots, f_n)^2\right)_{\mathfrak q}
\to
\Omega_{B/A, \mathfrak q}
$$
is surjective modulo $J$. Hence we see that this map of modules over
the local ring $C_{\mathfrak q}$ has to be an isomorphism
(this is because by Nakayama's Algebra, Lemma \ref{algebra-lemma-NAK}
the map is surjective and then for example by
Algebra, Lemma \ref{algebra-lemma-fun}
because $((f_1, \ldots, f_n)/(f_1, \ldots, f_n)^2)_{\mathfrak q}$
is generated by $n$ elements the map is injective). Thus
$H_1(L_{C/A})_{\mathfrak q} = 0$ and $\Omega_{C/A, \mathfrak q} = 0$. By
Algebra, Lemma \ref{algebra-lemma-smooth-at-point}
we see that $A \to C$ is smooth at the prime $\overline{\mathfrak q}$
of $C$ corresponding to $\mathfrak q$. Since
$\Omega_{C/A, \mathfrak q} = 0$ it is actually \'etale at
$\overline{\mathfrak q}$. Thus $A \to C$ is \'etale at all primes
of $C$ containing $JC$. By Lemma \ref{lemma-localize-upstairs}
we can find an $f \in C$ mapping to an invertible element of $C/JC$ such that
$A \to C_f$ is \'etale. By our choice of $f$ it is still true that
$C_f/JC_f = A/I$. The map $C_f/IC_f \to A/I$ is surjective and
\'etale by Algebra, Lemma \ref{algebra-lemma-map-between-etale}.
Hence $A/I$ is isomorphic to the localization of $C_f/IC_f$ at
some element $g \in C$, see
Algebra, Lemma \ref{algebra-lemma-surjective-flat-finitely-presented}.
Set $A' = C_{fg}$ to conclude the proof.
\end{proof}








\section{Zariski pairs}
\label{section-zariski-pairs}

\noindent
In this section and the next a {\it pair} is a pair $(A, I)$ where $A$
is a ring and $I \subset A$ is an ideal. A {\it morphism of pairs}
$(A, I) \to (B, J)$ is a ring map $\varphi : A \to B$ with
$\varphi(I) \subset J$.

\begin{definition}
\label{definition-zariski-pair}
A {\it Zariski pair} is a pair $(A, I)$ such that
$I$ is contained in the Jacobson radical of $A$.
\end{definition}

\begin{lemma}
\label{lemma-idempotents-determined-modulo-radical}
Let $(A, I)$ be a Zariski pair. Then the map from
idempotents of $A$ to idempotents of $A/I$ is injective.
\end{lemma}

\begin{proof}
An idempotent of a local ring is either $0$ or $1$.
Thus an idempotent is determined by the set of maximal ideals
where it vanishes, by
Algebra, Lemma \ref{algebra-lemma-characterize-zero-local}.
\end{proof}

\begin{lemma}
\label{lemma-check-isomorphism-zariski}
Let $(A, I)$ be a Zariski pair. Let $A \to B$ be a flat,
integral, finitely presented ring map such that $A/I \to B/IB$
is an isomorphism. Then $A \to B$ is an isomorphism.
\end{lemma}

\begin{proof}
The ring map $A \to B$ is finite by
Algebra, Lemma \ref{algebra-lemma-characterize-finite-in-terms-of-integral}.
Hence $B$ is finitely presented as an $A$-module by
Algebra, Lemma \ref{algebra-lemma-finite-finitely-presented-extension}.
Hence $B$ is a finite locally free $A$-module by
Algebra, Lemma \ref{algebra-lemma-finite-projective}.
Since the module $B$ has rank $1$
along $V(I)$ (see rank function described in
Algebra, Lemma \ref{algebra-lemma-finite-projective}),
and as $(A, I)$ is a Zariski pair, we conclude that the
rank is $1$ everywhere.
It follows that $A \to B$ is an isomorphism:
it is a pleasant exercise to show that
a ring map $R \to S$ such that $S$ is a locally free $R$-module
of rank $1$ is an isomorphism (hint: look at local rings).
\end{proof}

\begin{lemma}
\label{lemma-helper-finite}
Let $(A, I)$ be a Zariski pair. Let $A \to B$ be a finite ring map.
Assume
\begin{enumerate}
\item $B/IB = B_1 \times B_2$ is a product of $A/I$-algebras
\item $A/I \to B_1/IB_1$ is surjective,
\item $b \in B$ maps to $(1, 0)$ in the product.
\end{enumerate}
Then there exists a monic $f \in A[x]$ with $f(b) = 0$ and
$f \bmod I = (x - 1)x^d$ for some $d \geq 1$.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-lift-idempotent-upstairs} we can find an
\'etale ring map $A \to A'$ inducing an isomorphism $A/I \to A'/IA'$
such that $B' = B \otimes_A A'$ contains
an idempotent $e'$ lifting the image of $b$ in $B'/IB'$.
Consider the corresponding $A'$-algebra decomposition
$$
B' = B'_1 \times B'_2
$$
which is compatible with the one given in the lemma upon
reduction modulo $I$.
The map $A' \to B'_1$ is surjective modulo $IA'$. By Nakayama's lemma
(Algebra, Lemma \ref{algebra-lemma-NAK})
we can find $i \in IA'$ such that after replacing $A'$
by $A'_{1 + i}$ the map $A' \to B'_1$ is surjective.
Observe that the image $b'_1 \in B'_1$ of $b$ 
satisfies $b'_1 - 1 \in IB'_1$.
Thus we may pick $a' \in IA'$ mapping to $b'_1 - 1$.
On the other hand, the image $b'_2 \in B'_2$ of $b$ is in $IB'_2$. By
Algebra, Lemma \ref{algebra-lemma-integral-integral-over-ideal}
there exist a monic polynomial
$g(x) = x^d + \sum a'_j x^j$ of degree $d$ with $a'_j \in IA'$ such that
$g(b'_2) = 0$ in $B'_2$. Thus the image $b' = (b'_1, b'_2) \in B'$
of $b$ is a root of the polynomial $(x - 1 - a')g(x)$. We conclude that
$$
(b' - 1)(b')^d \in \sum\nolimits_{j = 0, \ldots, d} IA' \cdot (b')^j
$$
We claim that this implies
$$
(b - 1)b^d \in \sum\nolimits_{j = 0, \ldots, d} I \cdot b^j
$$
in $B$. For this it is enough to see that the ring map
$A \to A'$ is faithfully flat, because the condition is that
the image of $(b - 1)b^d$ is zero in $B/\sum_{j = 0, \ldots, d} Ib^j$
(use Algebra, Lemma \ref{algebra-lemma-faithfully-flat-universally-injective}).
The map $A \to A'$ flat because it is \'etale
(Algebra, Lemma \ref{algebra-lemma-etale}).
On the other hand, the induced map on spectra is open
(see Algebra, Proposition \ref{algebra-proposition-fppf-open} and use
previous lemma referenced) and the image
contains $V(I)$. Since $I$ is contained in the Jacobson radical of $A$
we conclude.
\end{proof}

\begin{lemma}
\label{lemma-noetherian-zariski-jacobson-complement}
Let $(A, I)$ be a Zariski pair with $A$ Noetherian. Let $f \in I$.
Then $A_f$ is a Jacobson ring.
\end{lemma}

\begin{proof}
We will use the criterion of
Algebra, Lemma \ref{algebra-lemma-noetherian-dim-1-Jacobson}.
Let $\mathfrak p \subset A$ be a prime ideal such that
$\mathfrak p_f = \mathfrak p A_f$ is prime and not maximal. We have to
show that $A_f/\mathfrak p_f = (A/\mathfrak p)_f$
has infinitely many prime ideals. After replacing $A$ by $A/\mathfrak p$
we may assume $A$ is a domain, $\dim A_f > 0$, and our goal is to
show that $\Spec(A_f)$ is infinite. Since $\dim A_f > 0$ we can
find a nonzero prime ideal $\mathfrak q \subset A$ not containing $f$.
Choose a maximal ideal $\mathfrak m \subset A$ containing $\mathfrak q$.
Since $(A, I)$ is a Zariski pair, we see $I \subset \mathfrak m$.
Hence $\mathfrak m \not = \mathfrak q$ and $\dim(A_\mathfrak m) > 1$.
Hence $\Spec((A_\mathfrak m)_f) \subset \Spec(A_f)$ is infinite by
Algebra, Lemma \ref{algebra-lemma-Noetherian-local-domain-dim-2-infinite-opens}
and we win.
\end{proof}











\section{Henselian pairs}
\label{section-henselian-pairs}

\noindent
Some of the results of Section \ref{section-lifting} may be viewed as results
about henselian pairs. In this section a {\it pair} is a pair $(A, I)$
where $A$ is a ring and $I \subset A$ is an ideal. A {\it morphism of pairs}
$(A, I) \to (B, J)$ is a ring map $\varphi : A \to B$ with
$\varphi(I) \subset J$. As in
Section \ref{section-lifting} given an object $\xi$ over $A$ we denote
$\overline{\xi}$ the ``base change'' of $\xi$ to an object over $A/I$
(provided this makes sense).

\begin{definition}
\label{definition-henselian-pair}
A {\it henselian pair} is a pair $(A, I)$ satisfying
\begin{enumerate}
\item $I$ is contained in the Jacobson radical of $A$, and
\item for any monic polynomial $f \in A[T]$ and factorization
$\overline{f} = g_0h_0$ with $g_0, h_0 \in A/I[T]$ monic
generating the unit ideal in $A/I[T]$, there
exists a factorization $f = gh$ in $A[T]$ with $g, h$ monic
and $g_0 = \overline{g}$ and $h_0 = \overline{h}$.
\end{enumerate}
\end{definition}

\noindent
Observe that if $A$ is a local ring and $I = \mathfrak m$ is the maximal
ideal, then $(A, I)$ is a henselian pair if and only if $A$ is a henselian
local ring, see
Algebra, Lemma \ref{algebra-lemma-characterize-henselian}.
In Lemma \ref{lemma-characterize-henselian-pair} we give a number of
equivalent characterizations of
henselian pairs (and we will add more as time goes on).

\begin{lemma}
\label{lemma-locally-nilpotent-henselian}
Let $(A, I)$ be a pair with $I$ locally nilpotent. Then the functor
$B \mapsto B/IB$ induces an equivalence between the category of
\'etale algebras over $A$ and the category of \'etale algebras over $A/I$.
Moreover, the pair is henselian.
\end{lemma}

\begin{proof}
Essential surjectivity holds by Algebra, Lemma \ref{algebra-lemma-lift-etale}.
If $B$, $B'$ are \'etale over $A$ and $B/IB \to B'/IB'$ is a morphism
of $A/I$-algebras, then we can lift this by
Algebra, Lemma \ref{algebra-lemma-smooth-strong-lift}.
Finally, suppose that $f, g : B \to B'$ are two $A$-algebra
maps with $f \bmod I = g \bmod I$. Choose an idempotent $e \in B \otimes_A B$
generating the kernel of the multiplication map $B \otimes_A B \to B$,
see Algebra, Lemmas \ref{algebra-lemma-diagonal-unramified}
and \ref{algebra-lemma-unramified} (to see that \'etale is unramified).
Then $(f \otimes g)(e) \in IB'$. Since $IB'$ is locally nilpotent
(Algebra, Lemma \ref{algebra-lemma-locally-nilpotent}) this implies
$(f \otimes g)(e) = 0$ by Algebra, Lemma \ref{algebra-lemma-lift-idempotents}.
Thus $f = g$.

\medskip\noindent
It is clear that $I$ is contained in the Jacobson radical of $A$.
Let $f \in A[T]$ be a monic polynomial and let
$\overline{f} = g_0h_0$ be a factorization
of $\overline{f} = f \bmod I$ with $g_0, h_0 \in A/I[T]$ monic
generating the unit ideal in $A/I[T]$. By
Lemma \ref{lemma-lift-factorization-monic}
there exists an \'etale ring map $A \to A'$ which
induces an isomorphism $A/I \to A'/IA'$ such that
the factorization lifts to a factorization into monic polynomials
over $A'$. By the above we have $A = A'$ and the factorization
is over $A$.
\end{proof}

\begin{lemma}
\label{lemma-limit-henselian}
Let $A = \lim A_n$ where $(A_n)$ is an inverse system of rings
whose transition maps are surjective and have locally nilpotent kernels.
Then $(A, I_n)$ is a henselian pair, where $I_n = \Ker(A \to A_n)$.
\end{lemma}

\begin{proof}
Fix $n$. Let $a \in A$ be an element which maps to $1$ in $A_n$.
By Algebra, Lemma \ref{algebra-lemma-locally-nilpotent-unit}
we see that $a$ maps to a unit in $A_m$ for all $m \geq n$.
Hence $a$ is a unit in $A$. Thus by
Algebra, Lemma \ref{algebra-lemma-contained-in-radical}
the ideal $I_n$ is contained in the Jacobson radical of $A$.
Let $f \in A[T]$ be a monic polynomial and let
$\overline{f} = g_nh_n$ be a factorization
of $\overline{f} = f \bmod I_n$ with $g_n, h_n \in A_n[T]$ monic
generating the unit ideal in $A_n[T]$. By
Lemma \ref{lemma-locally-nilpotent-henselian}
we can successively lift this factorization to
$f \bmod I_m = g_m h_m$ with $g_m, h_m$ monic
in $A_m[T]$ for all $m \geq n$. At each step we have
to verify that our lifts $g_m, h_m$ generate the unit ideal in
$A_n[T]$; this follows from the corresponding fact for
$g_n, h_n$ and the fact that $\Spec(A_n[T]) = \Spec(A_m[T])$
because the kernel of $A_m \to A_n$ is locally nilpotent.
As $A = \lim A_m$ this finishes the proof.
\end{proof}

\begin{lemma}
\label{lemma-complete-henselian}
Let $(A, I)$ be a pair. If $A$ is $I$-adically complete, then
the pair is henselian.
\end{lemma}

\begin{proof}
By Algebra, Lemma \ref{algebra-lemma-radical-completion}
the ideal $I$ is contained in the Jacobson radical of $A$.
Let $f \in A[T]$ be a monic polynomial and let
$\overline{f} = g_0h_0$ be a factorization
of $\overline{f} = f \bmod I$ with $g_0, h_0 \in A/I[T]$ monic
generating the unit ideal in $A/I[T]$. By
Lemma \ref{lemma-locally-nilpotent-henselian}
we can successively lift this factorization to
$f \bmod I^n = g_n h_n$ with $g_n, h_n$ monic
in $A/I^n[T]$ for all $n \geq 1$.
As $A = \lim A/I^n$ this finishes the proof.
\end{proof}

\begin{lemma}
\label{lemma-helper-finite-type}
Let $(A, I)$ be a pair. Let $A \to B$ be a finite type ring map
such that $B/IB = C_1 \times C_2$ with $A/I \to C_1$ finite.
Let $B'$ be the integral closure of $A$ in $B$.
Then we can write $B'/IB' = C_1 \times C'_2$ such that
the map $B'/IB' \to B/IB$ preserves product decompositions
and there exists a $g \in B'$ mapping to $(1, 0)$ in
$C_1 \times C'_2$ with $B'_g \to B_g$ an isomorphism.
\end{lemma}

\begin{proof}
Observe that $A \to B$ is quasi-finite at every prime of the
closed subset $T = \Spec(C_1) \subset \Spec(B)$ (this follows
by looking at fibre rings, see
Algebra, Definition \ref{algebra-definition-quasi-finite}).
Consider the diagram of topological spaces
$$
\xymatrix{
\Spec(B) \ar[rr]_\phi \ar[rd]_\psi & & \Spec(B') \ar[ld]^{\psi'} \\
& \Spec(A)
}
$$
By Algebra, Theorem \ref{algebra-theorem-main-theorem}
for every $\mathfrak p \in T$ there is a $h_\mathfrak p \in B'$,
$h_\mathfrak p \not \in \mathfrak p$ such that $B'_h \to B_h$ is
an isomorphism. The union $U = \bigcup D(h_\mathfrak p)$ gives an open
$U \subset \Spec(B')$ such that $\phi^{-1}(U) \to U$ is a homeomorphism
and $T \subset \phi^{-1}(U)$. Since $T$ is open in $\psi^{-1}(V(I))$
we conclude that $\phi(T)$ is open in $U \cap (\psi')^{-1}(V(I))$.
Thus $\phi(T)$ is open in $(\psi')^{-1}(V(I))$.
On the other hand, since $C_1$ is finite over $A/I$ it is
finite over $B'$. Hence $\phi(T)$ is a closed subset of $\Spec(B')$
by Algebra, Lemmas \ref{algebra-lemma-going-up-closed} and
\ref{algebra-lemma-integral-going-up}. We conclude that
$\Spec(B'/IB') \supset \phi(T)$ is open and closed. By
Algebra, Lemma \ref{algebra-lemma-disjoint-implies-product}
we get a corresponding product decomposition $B'/IB' = C'_1 \times C'_2$.
The map $B'/IB' \to B/IB$ maps $C'_1$ into $C_1$ and $C'_2$ into $C_2$
as one sees by looking at what happens on spectra (hint: the inverse
image of $\phi(T)$ is exactly $T$; some details omitted).
Pick a $g \in B'$ mapping to $(1, 0)$ in $C'_1 \times C'_2$
such that $D(g) \subset U$; this is possible because $\Spec(C'_1)$
and $\Spec(C'_2)$ are disjoint and closed in $\Spec(B')$ and
$\Spec(C'_1)$ is contained in $U$. Then $B'_g \to B_g$ defines a homeomorphism
on spectra and an isomorphism on local rings (by our choice of $U$ above).
Hence it is an isomorphism, as follows for example from
Algebra, Lemma \ref{algebra-lemma-characterize-zero-local}.
Finally, it follows that $C'_1 = C_1$ and the proof is complete.
\end{proof}

\begin{lemma}
\label{lemma-characterize-henselian-pair}
\begin{reference}
\cite[Chapter XI]{Henselian} and \cite[Proposition 1]{Gabber-henselian}
\end{reference}
Let $(A, I)$ be a pair. The following are equivalent
\begin{enumerate}
\item $(A, I)$ is a henselian pair,
\item given an \'etale ring map $A \to A'$ and an $A$-algebra map
$\sigma : A' \to A/I$, there exists an $A$-algebra map $A' \to A$
lifting $\sigma$,
\item for any finite $A$-algebra $B$ the map $B \to B/IB$ induces
a bijection on idempotents,
\item for any integral $A$-algebra $B$ the map $B \to B/IB$ induces
a bijection on idempotents, and
\item (Gabber) $I$ is contained in the Jacobson radical of $A$ and
every monic polynomial $f(T) \in A[T]$ of the form
$$
f(T) = T^n(T - 1) + a_n T^n + \ldots + a_1 T + a_0
$$
with $a_n, \ldots, a_0 \in I$ and $n \ge 1$ has a root $\alpha \in 1 + I$.
\end{enumerate}
Moreover, in part (5) the root is unique.
\end{lemma}

\begin{proof}
Assume (2) holds. Then $I$ is contained in the Jacobson radical of $A$, since
otherwise there would be a nonunit $f \in A$ congruent to $1$ modulo $I$
and the map $A \to A_f$ would contradict (2). Hence $IB \subset B$
is contained in the Jacobson radical of $B$ for $B$ integral over $A$
because $\Spec(B) \to \Spec(A)$ is closed by
Algebra, Lemmas \ref{algebra-lemma-going-up-closed} and
\ref{algebra-lemma-integral-going-up}.
Thus the map from idempotents of $B$ to idempotents of $B/IB$
is injective by Lemma \ref{lemma-idempotents-determined-modulo-radical}.
On the other hand, since (2) holds, every idempotent
of $B/IB$ lifts to an idempotent of $B$
by Lemma \ref{lemma-lift-idempotent-upstairs}.
In this way we see that (2) implies (4).

\medskip\noindent
The implication (4) $\Rightarrow$ (3) is trivial.

\medskip\noindent
Assume (3). Let $\mathfrak m$ be a maximal ideal and consider the
finite map $A \to B = A/(I \cap \mathfrak m)$. The condition that
$B \to B/IB$ induces a bijection on idempotents implies that
$I \subset \mathfrak m$ (if not, then $B = A/I \times A/\mathfrak m$
and $B/IB = A/I$). Thus we see that $I$ is contained in the Jacobson
radical of $A$. Let $f \in A[T]$ be monic and suppose given a
factorization $\overline{f} = g_0h_0$ with $g_0, h_0 \in A/I[T]$ monic.
Set $B = A[T]/(f)$. Let $\overline{e}$ be the idempotent
of $B/IB$ corresponding to the decomposition
$$
B/IB = A/I[T]/(g_0) \times A[T]/(h_0)
$$
of $A$-algebras. Let $e \in B$ be an idempotent lifting $\overline{e}$
which exists as we assumed (3). This gives a product decomposition
$$
B = eB \times (1 - e)B
$$
Note that $B$ is free of rank $\deg(f)$ as an $A$-module.
Hence $eB$ and $(1 - e)B$ are finite locally free $A$-modules.
However, since $eB$ and $(1 - e)B$ have constant rank
$\deg(g_0)$ and $\deg(h_0)$ over $A/I$ we find that the same
is true over $\Spec(A)$. We conclude that
\begin{align*}
f & = \text{CharPol}_A(T : B \to B) \\
& =
\text{CharPol}_A(T : eB \to eB)
\text{CharPol}_A(T : (1 - e)B \to (1 - e)B)
\end{align*}
is a factorization into monic polynomials reducing to the given
factorization modulo $I$. Here $\text{CharPol}_A$ denotes the characteristic
polynomial of an endomorphism of a finite locally free module over $A$.
If the module is free the $\text{CharPol}_A$ is defined as the
characteristic polynomial of the corresponding matrix and in
general one uses Algebra, Lemma \ref{algebra-lemma-standard-covering} to
glue. Details omitted. Thus (3) implies (1).

\medskip\noindent
Assume (1). Let $f$ be as in (5). The factorization of $f \bmod I$
as $T^n$ times $T - 1$ lifts to a factorization $f = gh$ with $g$
and $h$ monic by Definition \ref{definition-henselian-pair}.
Then $h$ has to have degree $1$
and we see that $f$ has a root reducing to $1$ modulo $1$.
Finally, $I$ is contained in the Jacobson radical by
the definition of a henselian pair.
Thus (1) implies (5).

\medskip\noindent
Before we give the proof of the last step, let us show that
the root $\alpha$ in (5), if it exists, is unique. Namely,
Due to the explicit shape of $f(T)$, we have
$f'(\alpha) \in 1 + I$ where $f'$ is the derivative of $f$ with
respect to $T$. An elementary argument shows that
$$
f(T) = f(\alpha + T - \alpha) =
f(\alpha) + f'(\alpha) \cdot (T - \alpha) \bmod
(T - \alpha)^2 A[T]
$$
This shows that any other root $\alpha' \in 1 + I$ of $f(T)$
satisfies $0 = f(\alpha') - f(\alpha) = (\alpha' - \alpha)(1 + i)$
for some $i \in I$, so that, since $1 + i$ is a unit in $A$,
we have $\alpha = \alpha'$.

\medskip\noindent
Assume (5). We will show that (2) holds, in other words, that
for every \'etale map $A \to A'$, every section $\sigma : A' \to A/I$
modulo $I$ lifts to a section $A' \to A$.
Since $A \to A'$ is \'etale, the section $\sigma$
determines a decomposition
\begin{equation}
\label{equation-GCHP}
A'/IA' \cong A/I \times C
\end{equation}
of $A/I$-algebras. Namely, the surjective ring map
$A'/IA' \to A/I$ is \'etale by
Algebra, Lemma \ref{algebra-lemma-map-between-etale}
and then we get the desired idempotent by
Algebra, Lemma \ref{algebra-lemma-surjective-flat-finitely-presented}.
We will show that this decomposition lifts to a decomposition 
\begin{equation}
\label{equation-GCHP-want}
A' \cong A'_1 \times A'_2
\end{equation}
of $A$-algebras with $A'_1$ integral over $A$. Then $A \to A'_1$
is integral and \'etale and $A/I \to A'_1/IA'_1$ is an isomorphism,
thus $A \to A'_1$ is an isomorphism by
Lemma \ref{lemma-check-isomorphism-zariski}
(here we also use that an \'etale ring map is flat
and of finite presentation, see Algebra, Lemma \ref{algebra-lemma-etale}).

\medskip\noindent
Let $B'$ be the integral closure of $A$ in $A'$. By
Lemma \ref{lemma-helper-finite-type}
we may decompose 
\begin{equation}
\label{equation-dec-mod-I}
B'/IB' \cong A/I \times C'
\end{equation}
as $A/I$-algebras compatibly with (\ref{equation-GCHP})
and we may find $b \in B'$ that lifts $(1, 0)$ such that
$B'_b \to A'_b$ is an isomorphism. If the decomposition
(\ref{equation-dec-mod-I}) lifts to a decomposition
\begin{equation}
\label{equation-want-2}
B' \cong B'_1 \times B'_2
\end{equation}
of $A$-algebras, then the induced decomposition
$A' = A'_1 \times A'_2$ will give the
desired (\ref{equation-GCHP-want}): indeed, since $b$ is a unit in $B'_1$
(details omitted),
we will have $B'_1 \cong A'_1$, so that $A'_1$ will be integral over $A$. 

\medskip\noindent
Choose a finite $A$-subalgebra $B'' \subset B'$ containing $b$
(observe that any finitely generated $A$-subalgebra of $B'$
is finite over $A$). After enlarging $B''$ we may assume
$b$ maps to an idempotent in $B''/IB''$ producing
\begin{equation}
\label{equation-again-dec-mod-I}
B''/IB'' \cong C''_1 \times C''_2
\end{equation}
Since $B'_b \cong A'_b$ we see that $B'_b$ is of finite type over $A$.
Say $B'_b$ is generated by $b_1/b^n, \ldots, b_t/b^n$ over $A$
and enlarge $B''$ so that $b_1, \ldots, b_t \in B''$. Then
$B''_b \to B'_b$ is surjective as well as injective, hence an isomorphism.
In particular, we see that $C''_1 = A/I$! Therefore $A/I \to C''_1$
is an isomorphism, in particular surjective.
By Lemma \ref{lemma-helper-finite} we can find
an $f(T) \in A[T]$ of the form
$$
f(T) = T^n(T - 1) + a_n T^n + \ldots + a_1 T + a_0
$$
with $a_n, \ldots, a_0 \in I$ and $n \ge 1$ such that $f(b) = 0$.
In particular, we find that $B'$ is a $A[T]/(f)$-algebra.
By (5) we deduce there is a root $a \in 1 + I$ of $f$.
This produces a product decomposition $A[T]/(f) = A[T]/(T - a) \times D$
compatible with the splitting (\ref{equation-dec-mod-I}) of $B'/IB'$.
The induced splitting of $B'$ is then a desired (\ref{equation-want-2}).
\end{proof}

\begin{lemma}
\label{lemma-change-ideal-henselian-pair}
Let $A$ be a ring. Let $I, J \subset A$ be ideals with $V(I) = V(J)$.
Then $(A, I)$ is henselian if and only if $(A, J)$ is henselian.
\end{lemma}

\begin{proof}
For any integral ring map $A \to B$ we see that $V(IB) = V(JB)$.
Hence idempotents of $B/IB$ and $B/JB$ are in bijective correspondence
(Algebra, Lemma \ref{algebra-lemma-disjoint-decomposition}).
It follows that $B \to B/IB$ induces a bijection on sets of
idempotents if and only if $B \to B/JB$ induces a bijection on sets
of idempotents. Thus we conclude by
Lemma \ref{lemma-characterize-henselian-pair}.
\end{proof}

\begin{lemma}
\label{lemma-integral-over-henselian-pair}
Let $(A, I)$ be a henselian pair and let $A \to B$ be an integral ring
map. Then $(B, IB)$ is a henselian pair.
\end{lemma}

\begin{proof}
Immediate from the fourth characterization of henselian pairs in
Lemma \ref{lemma-characterize-henselian-pair} and the fact that the
composition of integral ring maps is integral.
\end{proof}

\begin{lemma}
\label{lemma-henselian-henselian-pair}
Let $I \subset J \subset A$ be ideals of a ring $A$.
The following are equivalent
\begin{enumerate}
\item $(A, I)$ and $(A/I, J/I)$ are henselian pairs, and
\item $(A, J)$ is an henselian pair.
\end{enumerate}
\end{lemma}

\begin{proof}
Assume (1). Let $B$ be an integral $A$-algebra. Consider the ring maps
$$
B \to B/IB \to B/JB
$$
By Lemma \ref{lemma-characterize-henselian-pair} we find that
both arrows induce bijections on idempotents. Hence so does the
composition. Whence $(A, J)$ is a henselian pair
by Lemma \ref{lemma-characterize-henselian-pair}.

\medskip\noindent
Conversely, assume (2) holds. Then $(A/I, J/I)$ is a henselian pair
by Lemma \ref{lemma-integral-over-henselian-pair}. Let $B$ be an
integral $A$-algebra. Consider the ring maps
$$
B \to B/IB \to B/JB
$$
By Lemma \ref{lemma-characterize-henselian-pair} we find that the composition
and the second arrow induce bijections on idempotents.
Hence so does the first arrow. It follows that $(A, I)$ is a henselian
pair (by the lemma again).
\end{proof}

\begin{lemma}
\label{lemma-sum-henselian}
Let $A$ be a ring and let $(A, I)$ and $(A, I')$ be henselian pairs.
Then $(A, I + I')$ is an henselian pair.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-integral-over-henselian-pair} the pair
$(A/I, (I' + I)/I)$ is henselian. Thus we get the conclusion from
Lemma \ref{lemma-henselian-henselian-pair}.
\end{proof}

\begin{lemma}
\label{lemma-product-henselian-pairs}
Let $J$ be a set and let $\{ (A_j, I_j)\}_{j \in J}$ be a collection
of pairs. Then $(\prod_{j \in J} A_j, \prod_{j\in J} I_j)$ is Henselian
if and only if so is each $(A_j, I_j)$.
\end{lemma}
 
\begin{proof}
For every $j \in J$, the projection $\prod_{j \in J} A_j \rightarrow A_j$
is an integral ring map, so Lemma \ref{lemma-integral-over-henselian-pair}
proves that each $(A_j, I_j)$ is Henselian if
$(\prod_{j \in J} A_j, \prod_{j\in J} I_j)$ is Henselian.

\medskip\noindent
Conversely, suppose that each $(A_j, I_j)$ is a Henselian pair.
Then every $1 + x$ with $x \in \prod_{j \in J} I_j$  is a unit
in $\prod_{j \in J} A_j$ because it is so componentwise by
Algebra, Lemma \ref{algebra-lemma-contained-in-radical} and
Definition \ref{definition-henselian-pair}.
Thus, by Algebra, Lemma \ref{algebra-lemma-contained-in-radical}
again, $\prod_{j \in J} I_j$ is contained in the Jacobson radical
of $\prod_{j \in J} A_j$. Continuing to work componentwise, it
likewise follows that for every monic $f \in (\prod_{j \in J} A_j)[T]$
and every factorization $\overline{f} = g_0h_0$ with monic
$g_0, h_0 \in (\prod_{j \in J} A_j / \prod_{j \in J} I_j)[T] =
(\prod_{j \in J} A_j/I_j)[T]$ that generate the unit ideal in
$(\prod_{j \in J} A_j / \prod_{j \in J} I_j)[T]$, there exists a
factorization $f = gh$ in $(\prod_{j \in J} A_j)[T]$ with $g$, $h$ monic
and reducing to $g_0$, $h_0$. In conclusion, according to
Definition \ref{definition-henselian-pair}
$(\prod_{j \in J} A_j, \prod_{j\in J} I_j)$ is a Henselian pair.
\end{proof}

\begin{lemma}
\label{lemma-limits-henselian}
The property of being Henselian is preserved under limits of pairs.
More precisely, let $J$ be a preordered set and let $(A_j, I_j)$
be an inverse system of henselian pairs over $J$.
Then $A = \lim A_j$ equipped with the ideal $I = \lim I_j$
is a henselian pair $(A, I)$.
\end{lemma}

\begin{proof}
By Categories, Lemma \ref{categories-lemma-limits-products-equalizers},
we only need to consider products and equalizers.
For products, the claim follows from
Lemma \ref{lemma-product-henselian-pairs}.
Thus, consider an equalizer diagram
$$
\xymatrix{
(A, I) \ar[r] & (A', I')
\ar@<1ex>[r]^{\varphi} \ar@<-1ex>[r]_{\psi}
&
(A'', I'')  
}
$$
in which the pairs $(A', I')$ and $(A'', I'')$ are henselian.
To check that the pair $(A, I)$ is also henselian, we will use the
Gabber's criterion in Lemma \ref{lemma-characterize-henselian-pair}.
Every element of $1 + I$ is a unit in $A$ because,
due to the uniqueness of the inverses of units,
this may be checked in $(A', I')$.
Thus $I$ is contained in the Jacobson radical of $A$, see
Algebra, Lemma \ref{algebra-lemma-contained-in-radical}.
Thus, let 
$$
f(T) = T^{N - 1}(T - 1) + a_{N - 1} T^{N - 1} + \dotsb + a_1 T + a_0
$$
be a polynomial in $A[T]$ with $a_{N - 1}, \dotsc, a_0 \in I$ and $N \ge 1$.
The image of $f(T)$ in $A'[T]$ has a unique root $\alpha' \in 1 + I'$
and likewise for the further image in $A''[T]$.
Thus, due to the uniqueness, $\varphi(\alpha') = \psi(\alpha')$,
to the effect that $\alpha'$ defines a root of $f(T)$ in $1 + I$, as desired.
\end{proof}

\begin{lemma}
\label{lemma-filtered-colimits-henselian}
The property of being Henselian is preserved under filtered colimits of pairs.
More precisely, let $J$ be a directed set and let $(A_j, I_j)$
be a system of henselian pairs over $J$.
Then $A = \colim A_j$ equipped with the ideal $I = \colim I_j$
is a henselian pair $(A, I)$.
\end{lemma}

\begin{proof}
If $u \in 1 + I$ then for some $j \in J$ we see that $u$ is the
image of some $u_j \in 1 + I_j$. Then $u_j$ is invertible in $A_j$ by
Algebra, Lemma \ref{algebra-lemma-contained-in-radical}
and the assumption that $I_j$ is contained in the Jacobson radical of $A_j$.
Hence $u$ is invertible in $A$. Thus $I$
is contained in the Jacobson radical of $A$ (by the lemma).

\medskip\noindent
Let $f \in A[T]$ be a monic polynomial and let $\overline{f} = g_0 h_0$
be a factorization with $g_0, h_0 \in A/I[T]$ monic generating the unit
ideal in $A/I[T]$. Write $1 = g_0 g'_0 + h_0 h'_0$ for some
$g'_0, h'_0 \in A/I[T]$. Since $A = \colim A_j$ and $A/I = \colim A_j/I_j$
are filterd colimits we can find a $j \in J$ and $f_j \in A_j$ and
a factorization $\overline{f}_j = g_{j, 0} h_{j, 0}$
with $g_{j, 0}, h_{j, 0} \in A_j/I_j[T]$ monic
and $1 = g_{j, 0} g'_{j, 0} + h_{j, 0} h'_{j, 0}$
for some $g'_{j, 0}, h'_{j, 0} \in A_j/I_j[T]$ with
$f_j, g_{j, 0}, h_{j, 0}, g'_{j, 0}, h'_{j, 0}$
mapping to $f, g_0, h_0, g'_0, h'_0$.
Since $(A_j, I_j)$ is a henselian pair, we can lift
$\overline{f}_j = g_{j, 0} h_{j, 0}$ to a factorization
over $A_j$ and taking the image in $A$ we obtain a
corresponding factorization in $A$. Hence $(A, I)$ is henselian.
\end{proof}

\begin{example}[Moret-Bailly]
\label{example-moret-bailly}
Lemma \ref{lemma-filtered-colimits-henselian} is wrong if the colimit
isn't filtered. For example, if we take the coproduct of the
henselian pairs $(\mathbf{Z}_p, (p))$ and $(\mathbf{Z}_p, (p))$, then we 
obtain $(A, pA)$ with $A = \mathbf{Z}_p \otimes_\mathbf{Z} \mathbf{Z}_p$.
This isn't a henselian pair: $A/pA = \mathbf{F}_p$ hence if $(A, pA)$
where henselian, then $A$ would have to be local. However, $\Spec(A)$
is disconnected; for example for odd primes $p$ we have the nontrivial
idempotent
$$
(1/2 \otimes 1)
\left(1 \otimes 1 - (1 + p)^{-1}u \otimes u\right)
$$
where $u \in \mathbf{Z}_p$ is a square root of $1 + p$. Some details omitted.
\end{example}

\begin{lemma}
\label{lemma-largest-ideal-henselian}
Let $A$ be a ring. There exists a largest ideal $I \subset A$ such that
$(A, I)$ is a henselian pair.
\end{lemma}

\begin{proof}
Combine Lemmas \ref{lemma-henselian-henselian-pair}, \ref{lemma-sum-henselian},
and \ref{lemma-filtered-colimits-henselian}.
\end{proof}

\begin{lemma}
\label{lemma-irreducible-henselian-pair-connected}
Let $(A, I)$ be a henselian pair. Let $\mathfrak p \subset A$
be a prime ideal. Then $V(\mathfrak p + I)$ is connected.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-integral-over-henselian-pair} we see that
$(A/\mathfrak p, I + \mathfrak p/\mathfrak p)$ is a henselian pair.
Thus it suffices to prove: If $(A, I)$ is a henselian pair and
$A$ is a domain, then $\Spec(A/I) = V(I)$ is connected. If not,
then $A/I$ has a nontrivial idempotent by
Algebra, Lemma \ref{algebra-lemma-characterize-spec-connected}.
By Lemma \ref{lemma-characterize-henselian-pair}
this would imply $A$ has a nontrivial idempotent. This is a contradiction.
\end{proof}









\section{Henselization of pairs}
\label{section-henselization}

\noindent
We continue the discussion started in
Section \ref{section-henselian-pairs}.

\begin{lemma}
\label{lemma-henselization}
The inclusion functor
$$
\text{category of henselian pairs}
\longrightarrow
\text{category of pairs}
$$
has a left adjoint $(A, I) \mapsto (A^h, I^h)$.
\end{lemma}

\begin{proof}
Let $(A, I)$ be a pair. Consider the category $\mathcal{C}$ consisting
of \'etale ring maps $A \to B$ such that $A/I \to B/IB$ is an isomorphism.
We will show that the category $\mathcal{C}$ is directed and that
$A^h = \colim_{B \in \mathcal{C}} B$ with ideal $I^h = IA^h$ gives
the desired adjoint.

\medskip\noindent
We first prove that $\mathcal{C}$ is directed
(Categories, Definition \ref{categories-definition-directed}).
It is nonempty because $\text{id} : A \to A$ is an object.
If $B$ and $B'$ are two objects of $\mathcal{C}$, then
$B'' = B \otimes_A B'$ is an object of $\mathcal{C}$
(use Algebra, Lemma \ref{algebra-lemma-etale})
and there are morphisms $B \to B''$ and $B' \to B''$.
Suppose that $f, g : B \to B'$ are two maps between
objects of $\mathcal{C}$. Then a coequalizer is
$$
(B' \otimes_{f, B, g} B') \otimes_{(B' \otimes_A B')} B'
$$
which is \'etale over $A$ by
Algebra, Lemmas \ref{algebra-lemma-etale} and
\ref{algebra-lemma-map-between-etale}.
Thus the category $\mathcal{C}$ is directed.

\medskip\noindent
Since $B/IB = A/I$ for all objects $B$ of $\mathcal{C}$ we
see that $A^h/I^h = A^h/IA^h = \colim B/IB = \colim A/I = A/I$.

\medskip\noindent
Next, we show that $A^h = \colim_{B \in \mathcal{C}} B$ with
$I^h = IA^h$ is a henselian pair. To do this we will verify
condition (2) of Lemma \ref{lemma-characterize-henselian-pair}.
Namely, suppose given an \'etale ring map $A^h \to A'$
and $A^h$-algebra map $\sigma : A' \to A^h/I^h$. Then there exists a
$B \in \mathcal{C}$ and an \'etale ring map $B \to B'$ such that
$A' = B' \otimes_B A^h$. See Algebra, Lemma \ref{algebra-lemma-etale}.
Since $A^h/I^h = A/IB$, the map $\sigma$ induces an $A$-algebra
map $s : B' \to A/I$. Then $B'/IB' = A/I \times C$ as $A/I$-algebra,
where $C$ is the kernel of the map $B'/IB' \to A/I$ induced by $s$.
Let $g \in B'$ map to $(1, 0) \in A/I \times C$. Then $B \to B'_g$
is \'etale and $A/I \to B'_g/IB'_g$ is an isomorphism, i.e.,
$B'_g$ is an object of $\mathcal{C}$. Thus we obtain a canonical
map $B'_g \to A^h$ such that
$$
\vcenter{
\xymatrix{
B'_g \ar[r] & A^h \\
B \ar[u] \ar[ur]
}
}
\quad\text{and}\quad
\vcenter{
\xymatrix{
B' \ar[r] \ar[rrd]_s & B'_g \ar[r] & A^h \ar[d] \\
& & A/I
}
}
$$
commute. This induces a map $A' = B' \otimes_B A^h \to A^h$
compatible with $\sigma$ as desired.

\medskip\noindent
Let $(A, I) \to (A', I')$ be a morphism of pairs with $(A', I')$ henselian.
We will show there is a unique factorization $A \to A^h \to A'$ which will
finish the proof. Namely, for each $A \to B$ in $\mathcal{C}$
the ring map $A' \to B' = A' \otimes_A B$ is \'etale and induces
an isomorphism $A'/I' \to B'/I'B'$. Hence there is a section
$\sigma_B : B' \to A'$ by Lemma \ref{lemma-characterize-henselian-pair}.
Given a morphism $B_1 \to B_2$ in $\mathcal{C}$ we claim the diagram
$$
\xymatrix{
B'_1 \ar[rr] \ar[rd]_{\sigma_{B_1}} & &
B'_2 \ar[ld]^{\sigma_{B_2}} \\
& A'
}
$$
commutes. This follows once we prove that for every $B$ in $\mathcal{C}$
the section $\sigma_B$ is the unique $A'$-algebra map $B' \to A'$.
We have $B' \otimes_{A'} B' = B' \times R$ for some ring $R$, see
Algebra, Lemma \ref{algebra-lemma-diagonal-unramified}. In our case
$R/I'R = 0$ as $B'/I'B' = A'/I'$. Thus given two $A'$-algebra maps
$\sigma_B, \sigma_B' : B' \to A'$ then
$e = (\sigma_B \otimes \sigma_B')(0, 1) \in A'$
is an idempotent contained in $I'$. We conclude that $e = 0$
by Lemma \ref{lemma-idempotents-determined-modulo-radical}.
Hence $\sigma_B = \sigma_B'$ as desired.
Using the commutativity we obtain
$$
A^h = \colim_{B \in \mathcal{C}} B \to
\colim_{B \in \mathcal{C}} A' \otimes_A B \xrightarrow{\colim \sigma_B} A'
$$
as desired. The uniqueness of the maps $\sigma_B$ also guarantees that
this map is unique. Hence $(A, I) \mapsto (A^h, I^h)$ is the desired adjoint.
\end{proof}

\begin{lemma}
\label{lemma-henselization-flat}
Let $(A, I)$ be a pair. Let $(A^h, I^h)$ be as in 
Lemma \ref{lemma-henselization}. Then $A \to A^h$ is flat,
$I^h = IA^h$ and $A/I^n \to A^h/I^nA^h$ is an isomorphism
for all $n$.
\end{lemma}

\begin{proof}
In the proof of Lemma \ref{lemma-henselization} we have seen that
$A^h$ is a filtered colimit of \'etale $A$-algebras $B$ such that
$A/I \to B/IB$ is an isomorphism and we have seen that
$I^h = IA^h$. As an \'etale ring map is flat
(Algebra, Lemma \ref{algebra-lemma-etale}) we conclude that
$A \to A^h$ is flat by Algebra, Lemma \ref{algebra-lemma-colimit-flat}.
Since each $A \to B$ is flat we find that the maps
$A/I^n \to B/I^nB$ are isomorphisms as well (for example by
Algebra, Lemma \ref{algebra-lemma-lift-basis}).
Taking the colimit we find that $A/I^n = A^h/I^nA^h$
as desired.
\end{proof}

\begin{lemma}
\label{lemma-henselization-local-ring}
\begin{slogan}
Compatibility henselization of pairs and of local rings.
\end{slogan}
The functor of Lemma \ref{lemma-henselization} associates to a local ring
$(A, \mathfrak m)$ its henselization.
\end{lemma}

\begin{proof}
Let $(A^h, \mathfrak m^h)$ be the henselization of the pair $(A, \mathfrak m)$
constructed in Lemma \ref{lemma-henselization}. Then
$\mathfrak m^h = \mathfrak m A^h$ is a maximal ideal
by Lemma \ref{lemma-henselization-flat} and since it
is contained in the Jacobson radical, we conclude $A^h$ is
local with maximal ideal $\mathfrak m^h$. Having said this
there are two ways to finish the proof.

\medskip\noindent
First proof: observe that the construction in the proof of
Algebra, Lemma \ref{algebra-lemma-henselization} as a colimit
is the same as the colimit used to construct $A^h$ in
Lemma \ref{lemma-henselization}.
Second proof: Both the henselization $A \to S$ and $A \to A^h$ of
Lemma \ref{lemma-henselization} are local ring homomorphisms,
both $S$ and $A^h$ are filtered colimits of \'etale $A$-algebras,
both $S$ and $A^h$ are henselian local rings, and both $S$ and $A^h$
have residue fields equal to $\kappa(\mathfrak m)$ (by
Lemma \ref{lemma-henselization-flat} for the second case).
Hence they are canonically isomorphic by
Algebra, Lemma \ref{algebra-lemma-uniqueness-henselian}.
\end{proof}

\begin{lemma}
\label{lemma-henselization-Noetherian-pair}
\begin{slogan}
The henselization of a Noetherian pair is a Noetherian pair
with the same completion
\end{slogan}
Let $(A, I)$ be a pair with $A$ Noetherian.  Let $(A^h, I^h)$ be as in 
Lemma \ref{lemma-henselization}. Then the map of $I$-adic completions
$$
A^\wedge \to (A^h)^\wedge
$$
is an isomorphism. Moreover, $A^h$ is Noetherian, the maps
$A \to A^h \to A^\wedge$ are flat, and $A^h \to A^\wedge$ is
faithfully flat.
\end{lemma}

\begin{proof}
The first statement is an immediate consequence of
Lemma \ref{lemma-henselization-flat}
and in fact holds without assuming $A$ is Noetherian.
In the proof of Lemma \ref{lemma-henselization} we have seen that
$A^h$ is a filtered colimit of \'etale $A$-algebras $B$ such that
$A/I \to B/IB$ is an isomorphism. For each such $A \to B$
the induced map $A^\wedge \to B^\wedge$ is an isomorphism
(see proof of Lemma \ref{lemma-henselization-flat}).
By Algebra, Lemma \ref{algebra-lemma-completion-flat} the ring map
$B \to A^\wedge = B^\wedge = (A^h)^\wedge$ is flat for each $B$.
Thus $A^h \to A^\wedge = (A^h)^\wedge$ is flat by
Algebra, Lemma \ref{algebra-lemma-colimit-rings-flat}.
Since $I^h = IA^h$ is contained in the Jacobson radical of $A^h$
and since $A^h \to A^\wedge$ induces an isomorphism $A^h/I^h \to A/I$
we see that $A^h \to A^\wedge$ is faithfully flat by
Algebra, Lemma \ref{algebra-lemma-ff}.
By Algebra, Lemma \ref{algebra-lemma-completion-Noetherian-Noetherian}
the ring $A^\wedge$ is Noetherian.
Hence we conclude that $A^h$ is Noetherian by
Algebra, Lemma \ref{algebra-lemma-descent-Noetherian}.
\end{proof}

\begin{lemma}
\label{lemma-henselization-colimit}
Let $(A, I) = \colim (A_i, I_i)$ be a filtered colimit of pairs. The functor of
Lemma \ref{lemma-henselization} gives
$A^h = \colim A_i^h$ and $I^h = \colim I_i^h$.
\end{lemma}

\noindent
This lemma is false for non-filtered colimits, see
Example \ref{example-moret-bailly}.

\begin{proof}
By Categories, Lemma \ref{categories-lemma-adjoint-exact}
we see that $(A^h, I^h)$ is the colimit of the system $(A_i^h, I_i^h)$
in the category of henselian pairs. Thus for a henselian pair $(B, J)$
we have
$$
\Mor((A^h, I^h), (B, J)) =
\lim \Mor((A_i^h, I_i^h), (B, J)) =
\Mor(\colim (A_i^h, I_i^h), (B, J))
$$
Here the colimit is in the category of pairs. Since the colimit is
filtered we obtain $\colim (A_i^h, I_i^h) = (\colim A_i^h, \colim I_i^h)$
in the category of pairs; details omitted. Again using the colimit is filtered,
this is a henselian pair (Lemma \ref{lemma-filtered-colimits-henselian}).
Hence by the Yoneda lemma we
find $(A^h, I^h) = (\colim A_i^h, \colim I_i^h)$.
\end{proof}

\begin{lemma}
\label{lemma-henselization-change-ideal}
\begin{slogan}
The henselization of a pair only depends on the radical of the ideal
\end{slogan}
Let $A$ be a ring with ideals $I$ and $J$. If $V(I) = V(J)$ then the functor
of Lemma \ref{lemma-henselization} produces the same ring for the pair
$(A, I)$ as for the pair $(A, J)$.
\end{lemma}

\begin{proof}
Let $(A', IA')$ be the pair produced by Lemma \ref{lemma-henselization}
starting with the pair $(A, I)$, see Lemma \ref{lemma-henselization-flat}.
Let $(A'', JA'')$ be the pair produced by Lemma \ref{lemma-henselization}
starting with the pair $(A, J)$. By
Lemma \ref{lemma-change-ideal-henselian-pair} we see that
$(A', JA')$ is a henselian pair and $(A'', IA'')$ is a henselian pair.
By the universal property of the construction we obtain
unique $A$-algebra maps $A'' \to A'$ and $A' \to A''$. The
uniqueness shows that these are mutually inverse.
\end{proof}

\begin{lemma}
\label{lemma-henselization-integral}
\begin{slogan}
Henselization commutes with integral base change
\end{slogan}
Let $(A, I) \to (B, J)$ be a map of pairs such that $V(J) = V(IB)$.
Let $(A^h , I^h) \to (B^h, J^h)$ be the induced map
on henselizations (Lemma \ref{lemma-henselization}).
If $A \to B$ is integral, then the induced map
$A^h \otimes_A B \to B^h$ is an isomorphism.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-henselization-change-ideal} we may assume $J = IB$.
By Lemma \ref{lemma-integral-over-henselian-pair}
the pair $(A^h \otimes_A B, I^h(A^h \otimes_A B))$ is henselian.
By the universal property of $(B^h, IB^h)$ we obtain a map
$B^h \to A^h \otimes_A B$. We omit the proof
that this map is the inverse of the map in the lemma.
\end{proof}







\section{Lifting and henselian pairs}
\label{section-lifting-henselian-pairs}

\noindent
In this section we mostly combine results from
Sections \ref{section-lifting} and \ref{section-henselian-pairs}.

\begin{lemma}
\label{lemma-lift-finite-projective-module}
Let $(R, I)$ be a henselian pair. The map
$$
P \longrightarrow P/IP
$$
induces a bijection between the sets of isomorphism classes of finite
projective $R$-modules and finite projective $R/I$-modules. In particular,
any finite projective $R/I$-module is isomorphic to $P/IP$
for some finite projective $R$-module $P$.
\end{lemma}

\begin{proof}
We first prove the final statement. Let $\overline{P}$ be a finite
projective $R/I$-module. We can find a finite projective module $P'$
over some $R'$ \'etale over $R$ with $R/I = R'/IR'$ such that
$P'/IP'$ is isomorphic to $\overline{P}$, see
Lemma \ref{lemma-lift-projective-module}.
Then, since $(R, I)$ is a henselian pair, the \'etale ring map $R \to R'$ has
a section $\tau : R' \to R$ (Lemma \ref{lemma-characterize-henselian-pair}).
Setting $P = P' \otimes_{R', \tau} R$ we conclude that $P/IP$
is isomorphic to $\overline{P}$. Of course, this tells us that
the map in the statement of the lemma is surjective.

\medskip\noindent
Injectivity. Suppose that $P_1$ and $P_2$ are finite projective $R$-modules such
that $P_1/IP_1 \cong P_2/IP_2$ as $R/I$-modules. Since $P_1$ is projective,
we can find an $R$-module map $u : P_1 \to P_2$ lifting the given isomorphism.
Then $u$ is surjective by Nakayama's lemma
(Algebra, Lemma \ref{algebra-lemma-NAK}).
We similarly find a surjection $v : P_2 \to P_1$.
By Algebra, Lemma \ref{algebra-lemma-fun} the map $v \circ u$
is an isomorphism and we conclude $u$ is an isomorphism.
\end{proof}

\begin{lemma}
\label{lemma-finite-etale-equivalence}
Let $(A, I)$ be a henselian pair. The functor $B \to B/IB$ determines
an equivalence between finite \'etale $A$-algebras and finite \'etale
$A/I$-algebras.
\end{lemma}

\begin{proof}
Let $B, B'$ be two $A$-algebras finite \'etale over $A$.
Then $B' \to B'' = B \otimes_A B'$ is finite \'etale as well
(Algebra, Lemmas \ref{algebra-lemma-etale} and
\ref{algebra-lemma-base-change-integral}).
Now we have $1$-to-$1$ correspondences between
\begin{enumerate}
\item $A$-algebra maps $B \to B'$,
\item sections of $B' \to B''$, and
\item idempotents $e$ of $B''$ such that $B' \to B'' \to eB''$ is
an isomorphism.
\end{enumerate}
The bijection between (2) and (3) sends $\sigma : B'' \to B'$
to $e$ such that $(1 - e)$ is the idempotent
that generates the kernel of $\sigma$ which exists by
Algebra, Lemmas \ref{algebra-lemma-map-between-etale} and
\ref{algebra-lemma-surjective-flat-finitely-presented}.
There is a similar correspondence between
$A/I$-algebra maps $B/IB \to B'/IB'$ and idempotents
$\overline{e}$ of $B''/IB''$ such that
$B'/IB' \to B''/IB'' \to \overline{e}(B''/IB'')$ is
an isomorphism. However every idempotent $\overline{e}$ of $B''/IB''$
lifts uniquely to an idempotent $e$ of $B''$
(Lemma \ref{lemma-characterize-henselian-pair}).
Moreover, if $B'/IB' \to \overline{e}(B''/IB'')$ is an isomorphism,
then $B' \to eB''$ is an isomorphism too by Nakayama's lemma
(Algebra, Lemma \ref{algebra-lemma-NAK}).
In this way we see that the functor is fully faithful.

\medskip\noindent
Essential surjectivity. Let $A/I \to C$ be a finite \'etale map.
By Algebra, Lemma \ref{algebra-lemma-lift-etale}
there exists an \'etale map $A \to B$ such that $B/IB \cong C$.
Let $B'$ be the integral closure of $A$ in $B$. 
By Lemma \ref{lemma-helper-finite-type} we have
$B'/IB' = C \times C'$ for some ring $C'$
and $B'_g \cong B_g$ for some $g \in B'$ mapping to $(1, 0) \in C \times C'$.
Since idempotents lift
(Lemma \ref{lemma-characterize-henselian-pair})
we get $B' = B'_1 \times B'_2$ with $C = B'_1/IB'_1$ and $C' = B'_2/IB'_2$.
The image of $g$ in $B'_1$ is invertible.
Then $B_g = B'_g = B'_1 \times (B_2)_g$ and this implies
that $A \to B'_1$ is \'etale.
We conclude that $B'_1$ is finite \'etale over $A$
(integral \'etale implies finite \'etale by
Algebra, Lemma \ref{algebra-lemma-characterize-finite-in-terms-of-integral}
for example)
and the proof is done.
\end{proof}

\begin{lemma}
\label{lemma-lim-finite-projective-gives-finite-projective}
Let $A = \lim A_n$ be a limit of an inverse system $(A_n)$ of rings.
Suppose given $A_n$-modules $M_n$ and $A_{n + 1}$-module maps
$M_{n + 1} \to M_n$. Assume
\begin{enumerate}
\item the transition maps $A_{n + 1} \to A_n$ are surjective
with locally nilpotent kernels,
\item $M_1$ is a finite projective $A_1$-module,
\item $M_n$ is a finite flat $A_n$-module, and
\item the maps induce isomorphisms
$M_{n + 1} \otimes_{A_{n + 1}} A_n \to M_n$.
\end{enumerate}
Then $M = \lim M_n$ is a finite projective $A$-module
and $M \otimes_A A_n \to M_n$ is an isomorphism for all $n$.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-limit-henselian} the pair $(A, \Ker(A \to A_1))$ is
henselian. By Lemma \ref{lemma-lift-finite-projective-module}
we can choose a finite projective $A$-module $P$ and an isomorphism
$P \otimes_A A_1 \to M_1$. Since $P$ is projective, we can successively lift
the $A$-module map $P \to M_1$ to $A$-module maps
$P \to M_2$, $P \to M_3$, and so on. Thus we obtain a map
$$
P \longrightarrow M
$$
Since $P$ is finite projective, we can write $A^{\oplus m} = P \oplus Q$
for some $m \geq 0$ and $A$-module $Q$. Since $A = \lim A_n$ we conclude
that $P = \lim P \otimes_A A_n$. Hence, in order to show that the displayed
$A$-module map is an isomorphism, it suffices to show that the maps
$P \otimes_A A_n \to M_n$ are isomorphisms.
From Lemma \ref{lemma-lift-projective} we see that
$M_n$ is a finite projective module.
By Lemma \ref{lemma-isomorphic-finite-projective-lifts}
the maps $P \otimes_A A_n \to M_n$ are isomorphisms.
\end{proof}






\section{Absolute integral closure}
\label{section-absolute-integral-closure}

\noindent
Here is our definition.

\begin{definition}
\label{definition-absolutely-integrally-closed}
A ring $A$ is {\it absolutely integrally closed} if every
monic $f \in A[T]$ is a product of linear factors.
\end{definition}

\noindent
Be careful: it may be possible to write $f$ as a product of
linear factors in many different ways.

\begin{lemma}
\label{lemma-absolutely-integrally-closed}
Let $A$ be a ring. The following are equivalent
\begin{enumerate}
\item $A$ is absolutely integrally closed, and
\item any monic $f \in A[T]$ has a root in $A$.
\end{enumerate}
\end{lemma}

\begin{proof}
Omitted.
\end{proof}

\begin{lemma}
\label{lemma-absolutely-integrally-closed-quotient-localization}
Let $A$ be absolutely integrally closed.
\begin{enumerate}
\item Any quotient ring $A/I$ of $A$ is absolutely integrally closed.
\item Any localization $S^{-1}A$ is absolutely integrally closed.
\end{enumerate}
\end{lemma}

\begin{proof}
Omitted.
\end{proof}

\begin{lemma}
\label{lemma-integrally-closed-in-absolutely-integrally-closed}
Let $A$ be a ring. Let $S \subset A$ be a multiplicative subset
consisting of nonzerodivisors.
If $S^{-1}A$ is absolutely integrally closed and $A \subset S^{-1}A$
is integrally closed in $S^{-1}A$, then $A$ is absolutely integrally closed.
\end{lemma}

\begin{proof}
Omitted.
\end{proof}

\begin{lemma}
\label{lemma-normal-domain-absolutely-integrally-closed}
Let $A$ be a normal domain. Then $A$ is absolutely integrally closed
if and only if its fraction field is algebraically closed.
\end{lemma}

\begin{proof}
Observe that a field is algebraically closed if and only if
it is absolutely integrally closed as a ring. Hence the lemma follows
from Lemmas \ref{lemma-absolutely-integrally-closed-quotient-localization} and
\ref{lemma-integrally-closed-in-absolutely-integrally-closed}.
\end{proof}

\begin{lemma}
\label{lemma-construct-absolute-integral-closure}
For any ring $A$ there exists an extension $A \subset B$ such that
\begin{enumerate}
\item $B$ is a filtered colimit of finite free $A$-algebras,
\item $B$ is free as an $A$-module, and
\item $B$ is absolutely integrally closed.
\end{enumerate}
\end{lemma}

\begin{proof}
Let $I$ be the set of monic polynomials over $A$. For $i \in I$
denote $x_i$ a variable and $P_i$ the corresponding monic polynomial
in the variable $x_i$. Then we set
$$
F(A) = A[x_i; i \in I]/(P_i; i \in I)
$$
As the notation suggests $F$ is a functor from the category
of rings to itself. Note that $A \subset F(A)$, that $F(A)$ is free
as an $A$-module, and that $F(A)$ is a filtered colimit of
finite free $A$-algebras. Then we take
$$
B = \colim F^n(A)
$$
where the transition maps are the inclusions
$F^n(A) \subset F(F^n(A)) = F^{n + 1}(A)$.
Any monic polynomial with coefficients in $B$
actually has coefficients in $F^n(A)$ for some $n$
and hence has a solution in $F^{n + 1}(A)$ by construction.
This implies that $B$ is absolutely integrally closed by
Lemma \ref{lemma-absolutely-integrally-closed}.
We omit the proof of the other properties.
\end{proof}

\begin{lemma}
\label{lemma-absolutely-integrally-closed-strictly-henselian}
Let $A$ be absolutely integrally closed. Let $\mathfrak p \subset A$
be a prime. Then the local ring $A_\mathfrak p$ is strictly henselian.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-absolutely-integrally-closed-quotient-localization}
we may assume $A$ is a local ring and $\mathfrak p$ is its maximal ideal.
The residue field is algebraically closed by
Lemma \ref{lemma-absolutely-integrally-closed-quotient-localization}.
Every monic polynomial decomposes completely into linear factors
hence Algebra, Definition \ref{algebra-definition-henselian} applies directly.
\end{proof}

\begin{lemma}
\label{lemma-absolutely-integrally-closed-henselian-pair}
Let $A$ be absolutely integrally closed. Let $I \subset A$ be an ideal.
Then $(A, I)$ is a henselian pair if (and only if) the following
conditions hold
\begin{enumerate}
\item $I$ is contained in the Jacobson radical of $A$,
\item $A \to A/I$ induces a bijection on idempotents.
\end{enumerate}
\end{lemma}

\begin{proof}
Let $f \in A[T]$ be a monic polynomial and let
$f \bmod I = g_0 h_0$ be a factorization over $A/I$
with $g_0$, $h_0$ monic such that
$g_0$ and $h_0$ generate the unit ideal of $A/I[T]$.
This means that
$$
A/I[T]/(f) = A/I[T]/(g_0) \times A/I[T]/(h_0)
$$
Denote $e \in A/I[T]/(f)$ the element correspoing to the
idempotent $(1, 0)$ in the ring on the right.
Write $f = (T - a_1) \ldots (T - a_d)$ with $a_i \in A$.
For each $i \in \{1, \ldots, d\}$ we obtain an $A$-algebra map
$\varphi_i : A[T]/(f) \to A$, $T \mapsto a_i$ which induces
a similar $A/I$-algebra map $\overline{\varphi}_i : A/I[T]/(f) \to A/I$.
Denote $e_i = \overline{\varphi}_i(e) \in A/I$. These are idempotents.
By our assumption (2) we can lift $e_i$ to an idempotent in $A$.
This means we can write $A = \prod A_j$ as a finite product of
rings such that in $A_j/IA_j$ each $e_i$ is either $0$ or $1$.
Some details omitted. Observe that $A_j$ is absolutely integrally
closed as a factor ring of $A$. It suffices to lift the factorization
of $f$ over $A_j/IA_j$ to $A_j$.
This reduces us to the situation discussed in the next paragraph.

\medskip\noindent
Assume $e_i = 1$ for $i = 1, \ldots, r$ and $e_i = 0$ for
$i = r + 1, \ldots, d$. From $(g_0, h_0) = A/I[T]$ we have that there are
$k_0, l_0 \in A/I[T]$ such that $g_0 k_0 + h_0 l_0 = 1$.
We see that $e = h_0 l_0$ and $e_i = h_0(a_i) l_0(a_i)$.
We conclude that $h_0(a_i)$ is a unit for $i = 1, \dots ,r$.
Since $f(a_i) = 0$ we find $0 = h_0(a_i)g_0(a_i)$
and we conclude that $g_0(a_i) = 0$ for $i = 1, \ldots, r$.
Thus $(T - a_1)$ divides $g_0$ in $A/I[T]$, say
$g_0 = (T - a_1) g_0'$.
Set $f' = (T - a_2) \ldots (T - a_d)$ and $h'_0 = h_0$.
By induction on $d$ we can lift the factorization $f' \bmod I = g'_0 h'_0$
to a factorization of $f' = g' h'$ over over $A$ which
gives the factorization $f = (T - a_1) g' h'$
lifting the factorization $f \bmod I = g_0 h_0$
as desired.
\end{proof}









\section{Auto-associated rings}
\label{section-auto-ass}

\noindent
Some of this material is in \cite{Autour}.

\begin{definition}
\label{definition-auto-ass}
A ring $R$ is said to be {\it auto-associated} if $R$ is local and its
maximal ideal $\mathfrak m$ is weakly associated to $R$.
\end{definition}

\begin{lemma}
\label{lemma-auto-ass-implies-P}
An auto-associated ring $R$ has the following property: (P)
Every proper finitely generated ideal $I \subset R$ has a nonzero
annihilator.
\end{lemma}

\begin{proof}
By assumption there exists a nonzero element $x \in R$ such that for every
$f \in \mathfrak m$ we have $f^n x = 0$. Say $I = (f_1, \ldots, f_r)$.
Then $x$ is in the kernel of $R \to \bigoplus R_{f_i}$. Hence we see
that there exists a nonzero $y \in R$ such that $f_i y = 0$ for all $i$, see
Algebra, Lemma \ref{algebra-lemma-when-injective-covering}.
As $y \in \text{Ann}_R(I)$ we win.
\end{proof}

\begin{lemma}
\label{lemma-P-universally-injective}
Let $R$ be a ring having property (P) of
Lemma \ref{lemma-auto-ass-implies-P}.
Let $u : N \to M$ be a homomorphism of projective $R$-modules.
Then $u$ is universally injective if and only if $u$ is injective.
\end{lemma}

\begin{proof}
Assume $u$ is injective. Our goal is to show $u$ is universally injective.
First we choose a module $Q$ such that $N \oplus Q$ is free. On considering
the map $N \oplus Q \to M \oplus Q$ we see that it suffices to prove
the lemma in case $N$ is free. In this case $N$ is a directed colimit of
finite free $R$-modules. Thus we reduce to the case that $N$ is a finite
free $R$-module, say $N = R^{\oplus n}$. We prove the lemma by induction
on $n$. The case $n = 0$ is trivial.

\medskip\noindent
Let $u : R^{\oplus n} \to M$ be an injective module map with $M$ projective.
Choose an $R$-module $Q$ such that $M \oplus Q$ is free. After replacing
$u$ by the composition $R^{\oplus n} \to M \to M \oplus Q$ we see that
we may assume that $M$ is free. Then we can find a direct summand
$R^{\oplus m} \subset M$ such that $u(R^{\oplus n}) \subset R^{\oplus m}$.
Hence we may assume that $M = R^{\oplus m}$.
In this case $u$ is given by a matrix $A = (a_{ij})$ so that
$u(x_1, \ldots, x_n) = (\sum x_i a_{i1}, \ldots, \sum x_i a_{im})$.
As $u$ is injective, in particular
$u(x, 0, \ldots, 0) = (xa_{11}, xa_{12}, \ldots, xa_{1m}) \not = 0$ if
$x \not = 0$, and as $R$ has property (P) we see that
$a_{11}R + a_{12}R + \ldots + a_{1m}R = R$. Hence see that
$R(a_{11}, \ldots, a_{1m}) \subset R^{\oplus m}$ is a direct summand
of $R^{\oplus m}$, in particular $R^{\oplus m}/R(a_{11}, \ldots, a_{1m})$
is a projective $R$-module. We get a commutative diagram
$$
\xymatrix{
0 \ar[r] &
R \ar[rr] \ar[d]^1 & & R^{\oplus n} \ar[r] \ar[d]^u &
R^{\oplus n - 1} \ar[r] \ar[d] & 0 \\
0 \ar[r] & R \ar[rr]^{(a_{11}, \ldots, a_{1m})} & &
R^{\oplus m} \ar[r] & R^{\oplus m}/R(a_{11}, \ldots, a_{1m}) \ar[r] & 0
}
$$
with split exact rows. Thus the right vertical arrow is injective
and we may apply the induction hypothesis to conclude that
the right vertical arrow is universally injective. It follows that the
middle vertical arrow is universally injective.
\end{proof}

\begin{lemma}
\label{lemma-P-fPD-zero}
Let $R$ be a ring. The following are equivalent
\begin{enumerate}
\item $R$ has property (P) of
Lemma \ref{lemma-auto-ass-implies-P},
\item any injective map of projective $R$-modules is
universally injective,
\item if $u : N \to M$ is injective and $N$, $M$ are finite projective
$R$-modules then $\Coker(u)$ is a finite projective $R$-module,
\item if $N \subset M$ and $N$, $M$ are finite projective as $R$-modules, then
$N$ is a direct summand of $M$, and
\item any injective map $R \to R^{\oplus n}$ is a split injection.
\end{enumerate}
\end{lemma}

\begin{proof}
The implication (1) $\Rightarrow$ (2) is
Lemma \ref{lemma-P-universally-injective}.
It is clear that (3) and (4) are equivalent.
We have (2) $\Rightarrow$ (3), (4) by
Algebra, Lemma \ref{algebra-lemma-universally-exact-split}.
Part (5) is a special case of (4).
Assume (5). Let $I = (a_1, \ldots, a_n)$ be a proper finitely generated
ideal of $R$. As $I \not = R$ we see that
$R \to R^{\oplus n}$, $x \mapsto (xa_1, \ldots, xa_n)$
is not a split injection. Hence it has a nonzero kernel and we conclude
that $\text{Ann}_R(I) \not = 0$. Thus (1) holds.
\end{proof}

\begin{example}
\label{example-auto-ass-weird-flat}
If the equivalent conditions of
Lemma \ref{lemma-P-fPD-zero}
hold, then it is not always the case that every injective map of
free $R$-modules is a split injection. For example suppose that
$R = k[x_1, x_2, x_3, \ldots]/(x_i^2)$. This is an auto-associated ring.
Consider the map of free $R$-modules
$$
u :
\bigoplus\nolimits_{i \geq 1} Re_i
\longrightarrow
\bigoplus\nolimits_{i \geq 1} Rf_i, \quad
e_i \longmapsto f_i - x_if_{i + 1}.
$$
For any integer $n$ the restriction of $u$ to
$\bigoplus_{i = 1, \ldots, n} Re_i$ is injective as the images
$u(e_1), \ldots, u(e_n)$ are $R$-linearly independent. Hence
$u$ is injective and hence universally injective by the lemma.
Since $u \otimes \text{id}_k$ is bijective we see that if
$u$ were a split injection then $u$ would be surjective. But $u$ is not
surjective because the inverse image of $f_1$ would be the element
$$
\sum\nolimits_{i \geq 0} x_1 \ldots x_ie_{i + 1} =
e_1 + x_1e_2 + x_1x_2e_3 + \ldots
$$
which is not an element of the direct sum. A side remark is that
$\Coker(u)$ is a flat (because $u$ is universally injective),
countably generated $R$-module which is not projective (as $u$ is not
split), hence not Mittag-Leffler (see
Algebra, Lemma \ref{algebra-lemma-countgen-projective}).
\end{example}

\noindent
The following lemma is a special case of
Algebra, Proposition \ref{algebra-proposition-what-exact}
in case the local ring is Noetherian.

\begin{lemma}
\label{lemma-exact-length-1}
Let $(R, \mathfrak m)$ be a local ring.
Suppose that $\varphi : R^m \to R^n$ is a map
of finite free modules. The following are equivalent
\begin{enumerate}
\item $\varphi$ is injective,
\item the rank of $\varphi$ is $m$ and the annihilator of
$I(\varphi)$ in $R$ is zero.
\end{enumerate}
If $R$ is Noetherian these are also equivalent to
\begin{enumerate}
\item[(3)] the rank of $\varphi$ is $m$ and
either $I(\varphi) = R$ or it contains a nonzerodivisor.
\end{enumerate}
Here the rank of $\varphi$ and $I(\varphi)$ are defined
as in Algebra, Definition \ref{algebra-definition-rank}.
\end{lemma}

\begin{proof}
If any matrix coefficient of $\varphi$ is not in $\mathfrak m$, then we apply
Algebra, Lemma \ref{algebra-lemma-add-trivial-complex}
to write $\varphi$ as the sum of $1 : R \to R$ and a map
$\varphi' : R^{m-1} \to R^{n-1}$. It is easy to see that
the lemma for $\varphi'$ implies the lemma for $\varphi$.
Thus we may assume from the outset that all the matrix
coefficients of $\varphi$ are in $\mathfrak m$.

\medskip\noindent
Suppose $\varphi$ is injective. We may assume $m > 0$.
Let $\mathfrak q \in \text{WeakAss}(R)$ so that $R_\mathfrak q$
is an auto-associated ring. Then $\varphi$
induces a injective map $R_\mathfrak q^m \to R_\mathfrak q^n$
which is universally injective by
Lemmas \ref{lemma-auto-ass-implies-P} and \ref{lemma-P-universally-injective}.
Thus $\varphi : \kappa(\mathfrak q)^m \to \kappa(\mathfrak q)^n$
is injective. Hence the rank of $\varphi \bmod \mathfrak q$ is $m$ and
$I(\varphi \otimes \kappa(\mathfrak q))$ is not the zero ideal.
Since $m$ is the maximum rank $\varphi$ can have, we conclude
that $\varphi$ has rank $m$ as well (ranks of matrices
can only drop after base change). Hence
$I(\varphi) \cdot \kappa(\mathfrak q) =
I(\varphi \otimes \kappa(\mathfrak q))$ is not zero.
Thus $I(\varphi)$ is not contained in $\mathfrak q$.
Thus none of the weakly associated primes of $R$
are weakly associated primes of the $R$-module
$\text{Ann}_R I(\varphi)$. Thus $\text{Ann}_R I(\varphi)$
has no weakly associated primes, see
Algebra, Lemma \ref{algebra-lemma-weakly-ass}.
It follows from Algebra, Lemma
\ref{algebra-lemma-weakly-ass-zero}
that $\text{Ann}_R I(\varphi)$ is zero.

\medskip\noindent
Conversely, assume (2). The rank being $m$ implies $n \geq m$.
Write $I(\varphi) = (f_1, \ldots, f_r)$ which is possible as
$I(\varphi)$ is finitely generated. By
Algebra, Lemma \ref{algebra-lemma-matrix-left-inverse}
we can find maps $\psi_i : R^n \to R^m$ such that
$\psi \circ \varphi = f_i \text{id}_{R^m}$. Thus
$\varphi(x) = 0$ implies $f_i x = 0$ for $i = 1, \ldots, r$.
This implies $x = 0$ and hence $\varphi$ is injective.

\medskip\noindent
For the equivalence of (1) and (3) in the Noetherian local case
we refer to Algebra, Proposition \ref{algebra-proposition-what-exact}.
If the ring $R$ is Noetherian but not local, then the reader can
deduce it from the local case; details omitted.
Another option is to redo the argument above using associated
primes, using that there are finitely many of these, using
prime avoidance, and using the characterization of nonzerodivisors
as elements of a Noetherian ring not contained in any associated prime.
\end{proof}

\begin{lemma}
\label{lemma-coker-injective-free}
Let $R$ be a ring. Suppose that $\varphi : R^n \to R^n$ be an injective
map of finite free modules of the same rank. Then
$\Hom_R(\Coker(\varphi), R) = 0$.
\end{lemma}

\begin{proof}
Let $\varphi^t : R^n \to R^n$ be the transpose of $\varphi$.
The lemma claims that $\varphi^t$ is injective.
With notation as in Lemma \ref{lemma-exact-length-1}
we see that the rank of $\varphi^t$ is $n$ and that
$I(\varphi) = I(\varphi^t)$. Thus we conclude by
the equivalence of (1) and (2) of the lemma.
\end{proof}









\section{Flattening stratification}
\label{section-flattening}

\noindent
Let $R \to S$ be a ring map and let $M$ be an $S$-module.
For any $R$-algebra $R'$ we can consider the base changes
$S' = S \otimes_R R'$ and $M' = M \otimes_R R'$.
We say $R \to R'$ {\it flattens} $M$ if the module $M'$ is flat over $R'$.
We would like to understand the structure of the collection of ring maps
$R \to R'$ which flatten $M$. In particular we would like to know
if there exists a {\it universal flattening $R \to R_{univ}$ of $M$},
i.e., a ring map $R \to R_{univ}$ which flattens $M$ and has the property
that any ring map $R \to R'$ which flattens $M$ factors through
$R \to R_{univ}$. It turns out that such a universal solution usually
does not exist.

\medskip\noindent
We will discuss {\it universal flattenings} and
{\it flattening stratifications} in a scheme theoretic
setting $\mathcal{F}/X/S$ in
More on Flatness, Section \ref{flat-section-flattening}.
If the universal flattening $R \to R_{univ}$ exists then the
morphism of schemes $\Spec(R_{univ}) \to \Spec(R)$ is the
universal flattening of the quasi-coherent module
$\widetilde{M}$ on $\Spec(S)$.

\medskip\noindent
In this and the next few sections we prove some basic algebra facts
related to this. The most basic result is perhaps the following.

\begin{lemma}
\label{lemma-intersection-flat}
Let $R$ be a ring. Let $M$ be an $R$-module. Let $I_1$, $I_2$ be ideals of $R$.
If $M/I_1M$ is flat over $R/I_1$ and $M/I_2M$ is flat over $R/I_2$,
then $M/(I_1 \cap I_2)M$ is flat over $R/(I_1 \cap I_2)$.
\end{lemma}

\begin{proof}
By replacing $R$ with $R/(I_1 \cap I_2)$ and $M$ by $M/(I_1 \cap I_2)M$
we may assume that $I_1 \cap I_2 = 0$. Let $J \subset R$ be an ideal.
To prove that $M$ is flat over $R$ we have to show that
$J \otimes_R M \to M$ is injective, see
Algebra, Lemma \ref{algebra-lemma-flat}.
By flatness of $M/I_1M$ over $R/I_1$ the map
$$
J/(J \cap I_1) \otimes_R M =
(J + I_1)/I_1 \otimes_{R/I_1} M/I_1M
\longrightarrow M/I_1M
$$
is injective. As $0 \to (J \cap I_1) \to J \to J/(J \cap I_1) \to 0$
is exact we obtain a diagram
$$
\xymatrix{
(J \cap I_1) \otimes_R M \ar[r] \ar[d] &
J \otimes_R M \ar[r] \ar[d] &
J/(J \cap I_1) \otimes_R M \ar[r] \ar[d] & 0 \\
M \ar@{=}[r] &
M \ar[r] &
M/I_1M
}
$$
hence it suffices to show that $(J \cap I_1) \otimes_R M \to M$ is
injective. Since $I_1 \cap I_2 = 0$ the ideal $J \cap I_1$
maps isomorphically to an ideal $J' \subset R/I_2$ and we see that
$(J \cap I_1) \otimes_R M = J' \otimes_{R/I_2} M/I_2M$. By flatness
of $M/I_2M$ over $R/I_2$ the map $J' \otimes_{R/I_2} M/I_2M \to M/I_2M$
is injective, which clearly implies that $(J \cap I_1) \otimes_R M \to M$ is
injective.
\end{proof}





\section{Flattening over an Artinian ring}
\label{section-flattening-artinian}

\noindent
A universal flattening exists when the base ring is an Artinian local
ring. It exists for an arbitrary module. Hence, as we will see later,
a flatting stratification exists when the base scheme is the spectrum
of an Artinian local ring.

\begin{lemma}
\label{lemma-flattening-artinian}
Let $R$ be an Artinian ring.
Let $M$ be an $R$-module.
Then there exists a smallest ideal $I \subset R$ such that
$M/IM$ is flat over $R/I$.
\end{lemma}

\begin{proof}
This follows directly from
Lemma \ref{lemma-intersection-flat}
and the Artinian property.
\end{proof}

\noindent
This ideal has the following universal property.

\begin{lemma}
\label{lemma-flattening-artinian-universal-property}
Let $R$ be an Artinian ring. Let $M$ be an $R$-module.
Let $I \subset R$ be the smallest ideal $I \subset R$ such that
$M/IM$ is flat over $R/I$.
Then $I$ has the following universal property:
For every ring map $\varphi : R \to R'$ we have
$$
R' \otimes_R M\text{ is flat over }R'
\Leftrightarrow
\text{we have }\varphi(I) = 0.
$$
\end{lemma}

\begin{proof}
Note that $I$ exists by
Lemma \ref{lemma-flattening-artinian}.
The implication $\Rightarrow$ follows from
Algebra, Lemma \ref{algebra-lemma-flat-base-change}.
Let $\varphi : R \to R'$ be such that $M \otimes_R R'$ is flat over $R'$.
Let $J = \Ker(\varphi)$. By
Algebra,
Lemma \ref{algebra-lemma-descent-flatness-injective-map-artinian-rings}
and as $R' \otimes_R M = R' \otimes_{R/J} M/JM$ is
flat over $R'$ we conclude that $M/JM$ is flat over $R/J$.
Hence $I \subset J$ as desired.
\end{proof}











\section{Flattening over a closed subset of the base}
\label{section-flattening-local-base}

\noindent
Let $R \to S$ be a ring map.
Let $I \subset R$ be an ideal.
Let $M$ be an $S$-module.
In the following we will consider the following condition
\begin{equation}
\label{equation-flat-at-primes-over}
\forall \mathfrak q \in V(IS) \subset \Spec(S) :
M_{\mathfrak q}\text{ is flat over }R.
\end{equation}
Geometrically, this means that $M$ is flat over $R$ along the inverse
image of $V(I)$ in $\Spec(S)$. If $R$ and $S$ are Noetherian rings and
$M$ is a finite $S$-module, then (\ref{equation-flat-at-primes-over})
is equivalent to the condition that $M/I^nM$ is flat over $R/I^n$
for all $n \geq 1$, see
Algebra, Lemma \ref{algebra-lemma-flat-module-powers}.

\begin{lemma}
\label{lemma-base-change-flat-at-primes-over}
Let $R \to S$ be a ring map.
Let $I \subset R$ be an ideal.
Let $M$ be an $S$-module.
Let $R \to R'$ be a ring map and $IR' \subset I' \subset R'$ an ideal.
If (\ref{equation-flat-at-primes-over}) holds for
$(R \to S, I, M)$, then (\ref{equation-flat-at-primes-over})
holds for $(R' \to S \otimes_R R', I', M \otimes_R R')$.
\end{lemma}

\begin{proof}
Assume (\ref{equation-flat-at-primes-over}) holds for
$(R \to S, I \subset R, M)$.
Let $I'(S \otimes_R R') \subset \mathfrak q'$ be a prime of $S \otimes_R R'$.
Let $\mathfrak q \subset S$ be the corresponding prime of $S$.
Then $IS \subset \mathfrak q$. Note that $(M \otimes_R R')_{\mathfrak q'}$
is a localization of the base change $M_{\mathfrak q} \otimes_R R'$.
Hence $(M \otimes_R R')_{\mathfrak q'}$ is flat over $R'$ as a localization
of a flat module, see
Algebra, Lemmas \ref{algebra-lemma-flat-base-change} and
\ref{algebra-lemma-flat-localization}.
\end{proof}

\begin{lemma}
\label{lemma-flat-descent-flat-at-primes-over}
Let $R \to S$ be a ring map.
Let $I \subset R$ be an ideal.
Let $M$ be an $S$-module.
Let $R \to R'$ be a ring map and $IR' \subset I' \subset R'$ an ideal
such that
\begin{enumerate}
\item the map $V(I') \to V(I)$ induced by
$\Spec(R') \to \Spec(R)$ is surjective, and
\item $R'_{\mathfrak p'}$ is flat over $R$ for all primes
$\mathfrak p' \in V(I')$.
\end{enumerate}
If (\ref{equation-flat-at-primes-over}) holds for
$(R' \to S \otimes_R R', I', M \otimes_R R')$, then
(\ref{equation-flat-at-primes-over}) holds for $(R \to S, I, M)$.
\end{lemma}

\begin{proof}
Assume (\ref{equation-flat-at-primes-over}) holds for
$(R' \to S \otimes_R R', IR', M \otimes_R R')$. Pick a prime
$IS \subset \mathfrak q \subset S$. Let $I \subset \mathfrak p \subset R$
be the corresponding prime of $R$. By assumption there exists
a prime $\mathfrak p' \in V(I')$ of $R'$ lying over $\mathfrak p$ and
$R_{\mathfrak p} \to R'_{\mathfrak p'}$ is flat. Choose a prime
$\overline{\mathfrak q}' \subset
\kappa(\mathfrak q) \otimes_{\kappa(\mathfrak p)} \kappa(\mathfrak p')$
which corresponds to a prime $\mathfrak q' \subset S \otimes_R R'$ which
lies over $\mathfrak q$ and over $\mathfrak p'$. Note that
$(S \otimes_R R')_{\mathfrak q'}$ is a localization of
$S_{\mathfrak q} \otimes_{R_{\mathfrak p}} R'_{\mathfrak p'}$.
By assumption the module $(M \otimes_R R')_{\mathfrak q'}$ is
flat over $R'_{\mathfrak p'}$. Hence
Algebra, Lemma \ref{algebra-lemma-base-change-flat-up-down}
implies that $M_{\mathfrak q}$ is flat over $R_{\mathfrak p}$
which is what we wanted to prove.
\end{proof}

\begin{lemma}
\label{lemma-limit-preserving-flat-at-primes-over}
Let $R \to S$ be a ring map of finite presentation.
Let $M$ be an $S$-module of finite presentation.
Let $R' = \colim_{\lambda \in \Lambda} R_\lambda$
be a directed colimit of $R$-algebras. Let $I_\lambda \subset R_\lambda$
be ideals such that $I_\lambda R_\mu \subset I_\mu$ for all $\mu \geq \lambda$
and set $I' = \colim_\lambda I_\lambda$.
If (\ref{equation-flat-at-primes-over}) holds for
$(R' \to S \otimes_R R', I', M \otimes_R R')$, then there exists
a $\lambda \in \Lambda$ such that
(\ref{equation-flat-at-primes-over}) holds for
$(R_\lambda \to S \otimes_R R_\lambda, I_\lambda, M \otimes_R R_\lambda)$.
\end{lemma}

\begin{proof}
We are going to write $S_\lambda = S \otimes_R R_\lambda$,
$S' = S \otimes_R R'$, $M_\lambda = M \otimes_R R_\lambda$, and
$M' = M \otimes_R R'$.
The base change $S'$ is of finite presentation over $R'$ and
$M'$ is of finite presentation over $S'$ and similarly for the
versions with subscript $\lambda$, see
Algebra, Lemma \ref{algebra-lemma-base-change-finiteness}.
By
Algebra, Theorem \ref{algebra-theorem-openness-flatness}
the set
$$
U' = \{\mathfrak q' \in \Spec(S') \mid
M'_{\mathfrak q'}\text{ is flat over }R'\}
$$
is open in $\Spec(S')$. Note that $V(I'S')$ is a quasi-compact space
which is contained in $U'$ by assumption. Hence there exist finitely many
$g'_j \in S'$, $j = 1, \ldots, m$ such that $D(g'_j) \subset U'$ and such
that $V(I'S') \subset \bigcup D(g'_j)$.
Note that in particular $(M')_{g'_j}$ is a flat module over $R'$.

\medskip\noindent
We are going to pick increasingly large elements $\lambda \in \Lambda$.
First we pick it large enough so that we can find
$g_{j, \lambda} \in S_{\lambda}$ mapping to $g'_j$.
The inclusion $V(I'S') \subset \bigcup D(g'_j)$ means that
$I'S' + (g'_1, \ldots, g'_m) = S'$ which can be expressed as
$1 = \sum z_sh_s + \sum f_jg'_j$ for some $z_s \in I'$, $h_s, f_j \in S'$.
After increasing $\lambda$ we may assume such an equation holds in
$S_\lambda$. Hence we may assume that
$V(I_\lambda S_\lambda) \subset \bigcup D(g_{j, \lambda})$. By
Algebra, Lemma \ref{algebra-lemma-flat-finite-presentation-limit-flat}
we see that for some sufficiently large $\lambda$ the modules
$(M_\lambda)_{g_{j, \lambda}}$ are flat over $R_\lambda$.
In particular the module $M_\lambda$ is flat over $R_\lambda$
at all the primes lying over the ideal $I_\lambda$.
\end{proof}









\section{Flattening over a closed subsets of source and base}
\label{section-flattening-local-source-base}

\noindent
In this section we slightly generalize the discussion in
Section \ref{section-flattening-local-base}.
We strongly suggest the reader first read and understand
that section.

\begin{situation}
\label{situation-flattening-general}
Let $R \to S$ be a ring map. Let $J \subset S$ be an ideal.
Let $M$ be an $S$-module.
\end{situation}

\noindent
In this situation, given an $R$-algebra $R'$ and an ideal $I' \subset R'$
we set $S' = S \otimes_R R'$ and $M' = M \otimes_R R'$.
We will consider the condition
\begin{equation}
\label{equation-flat-at-primes}
\forall \mathfrak q' \in V(I'S' + JS') \subset \Spec(S') :
M'_{\mathfrak q'}\text{ is flat over }R'.
\end{equation}
Geometrically, this means that $M'$ is flat over $R'$ along the intersection
of the inverse image of $V(I')$ with the inverse image of $V(J)$.
Since $(R \to S, J, M)$ are fixed, condition (\ref{equation-flat-at-primes})
only depends on the pair $(R', I')$ where $R'$ is viewed as an $R$-algebra.

\begin{lemma}
\label{lemma-base-change-flat-at-primes}
In Situation \ref{situation-flattening-general}
let $R' \to R''$ be an $R$-algebra map.
Let $I' \subset R'$ and $I'R'' \subset I'' \subset R''$ be ideals.
If (\ref{equation-flat-at-primes}) holds for
$(R', I')$, then (\ref{equation-flat-at-primes})
holds for $(R'', I'')$.
\end{lemma}

\begin{proof}
Assume (\ref{equation-flat-at-primes}) holds for $(R', I')$.
Let $I''S'' + JS'' \subset \mathfrak q''$ be a prime of $S''$.
Let $\mathfrak q' \subset S'$ be the corresponding prime of $S'$.
Then both $I'S' \subset \mathfrak q'$ and $JS' \subset \mathfrak q'$
because the corresponding conditions hold for $\mathfrak q''$.
Note that $(M'')_{\mathfrak q''}$
is a localization of the base change $M'_{\mathfrak q'} \otimes_R R''$.
Hence $(M'')_{\mathfrak q''}$ is flat over $R''$ as a localization
of a flat module, see
Algebra, Lemmas \ref{algebra-lemma-flat-base-change} and
\ref{algebra-lemma-flat-localization}.
\end{proof}

\begin{lemma}
\label{lemma-flat-descent-flat-at-primes}
In Situation \ref{situation-flattening-general}
let $R' \to R''$ be an $R$-algebra map.
Let $I' \subset R'$ and $I'R'' \subset I'' \subset R''$ be ideals.
Assume
\begin{enumerate}
\item the map $V(I'') \to V(I')$ induced by
$\Spec(R'') \to \Spec(R')$ is surjective, and
\item $R''_{\mathfrak p''}$ is flat over $R'$ for all primes
$\mathfrak p'' \in V(I'')$.
\end{enumerate}
If (\ref{equation-flat-at-primes}) holds for
$(R'', I'')$, then (\ref{equation-flat-at-primes}) holds for $(R', I')$.
\end{lemma}

\begin{proof}
Assume (\ref{equation-flat-at-primes}) holds for $(R'', I'')$. Pick a prime
$I'S' + JS' \subset \mathfrak q' \subset S'$. Let
$I' \subset \mathfrak p' \subset R'$ be the corresponding prime of $R'$.
By assumption there exists a prime $\mathfrak p'' \in V(I'')$ of $R''$
lying over $\mathfrak p'$ and $R'_{\mathfrak p'} \to R''_{\mathfrak p''}$
is flat. Choose a prime
$\overline{\mathfrak q}'' \subset
\kappa(\mathfrak q') \otimes_{\kappa(\mathfrak p')} \kappa(\mathfrak p'')$.
This corresponds to a prime $\mathfrak q'' \subset S'' = S' \otimes_{R'} R''$
which lies over $\mathfrak q'$ and over $\mathfrak p''$. In particular
we see that $I''S'' \subset \mathfrak q''$ and that
$JS'' \subset \mathfrak q''$. Note that
$(S' \otimes_{R'} R'')_{\mathfrak q''}$ is a localization of
$S'_{\mathfrak q'} \otimes_{R'_{\mathfrak p'}} R''_{\mathfrak p''}$.
By assumption the module $(M' \otimes_{R'} R'')_{\mathfrak q''}$ is
flat over $R''_{\mathfrak p''}$. Hence
Algebra, Lemma \ref{algebra-lemma-base-change-flat-up-down}
implies that $M'_{\mathfrak q'}$ is flat over $R'_{\mathfrak p'}$
which is what we wanted to prove.
\end{proof}

\begin{lemma}
\label{lemma-limit-preserving-flat-at-primes}
In Situation \ref{situation-flattening-general}
assume $R \to S$ is essentially of finite presentation
and $M$ is an $S$-module of finite presentation. Let
$R' = \colim_{\lambda \in \Lambda} R_\lambda$
be a directed colimit of $R$-algebras. Let $I_\lambda \subset R_\lambda$
be ideals such that $I_\lambda R_\mu \subset I_\mu$ for all
$\mu \geq \lambda$ and set $I' = \colim_\lambda I_\lambda$.
If (\ref{equation-flat-at-primes}) holds for
$(R', I')$, then there exists a $\lambda \in \Lambda$ such that
(\ref{equation-flat-at-primes}) holds for $(R_\lambda, I_\lambda)$.
\end{lemma}

\begin{proof}
We first prove the lemma in case $R \to S$ is of finite presentation
and then we explain what needs to be changed in the general case.
We are going to write $S_\lambda = S \otimes_R R_\lambda$,
$S' = S \otimes_R R'$, $M_\lambda = M \otimes_R R_\lambda$, and
$M' = M \otimes_R R'$.
The base change $S'$ is of finite presentation over $R'$ and
$M'$ is of finite presentation over $S'$ and similarly for the
versions with subscript $\lambda$, see
Algebra, Lemma \ref{algebra-lemma-base-change-finiteness}.
By
Algebra, Theorem \ref{algebra-theorem-openness-flatness}
the set
$$
U' = \{\mathfrak q' \in \Spec(S') \mid
M'_{\mathfrak q'}\text{ is flat over }R'\}
$$
is open in $\Spec(S')$. Note that $V(I'S' + JS')$
is a quasi-compact space which is contained in $U'$ by assumption.
Hence there exist finitely many $g'_j \in S'$, $j = 1, \ldots, m$
such that $D(g'_j) \subset U'$ and such
that $V(I'S' + JS') \subset \bigcup D(g'_j)$.
Note that in particular $(M')_{g'_j}$ is a flat module over $R'$.

\medskip\noindent
We are going to pick increasingly large elements $\lambda \in \Lambda$.
First we pick it large enough so that we can find
$g_{j, \lambda} \in S_{\lambda}$ mapping to $g'_j$.
The inclusion $V(I'S' + JS') \subset \bigcup D(g'_j)$ means that
$I'S' + JS' + (g'_1, \ldots, g'_m) = S'$ which can be expressed as
$$
1 = \sum y_tk_t + \sum z_sh_s + \sum f_jg'_j
$$
for some $z_s \in I'$, $y_t \in J$, $k_t, h_s, f_j \in S'$.
After increasing $\lambda$ we may assume such an equation holds in
$S_\lambda$. Hence we may assume that
$V(I_\lambda S_\lambda + J S_\lambda) \subset \bigcup D(g_{j, \lambda})$. By
Algebra, Lemma \ref{algebra-lemma-flat-finite-presentation-limit-flat}
we see that for some sufficiently large $\lambda$ the modules
$(M_\lambda)_{g_{j, \lambda}}$ are flat over $R_\lambda$.
In particular the module $M_\lambda$ is flat over $R_\lambda$
at all the primes corresponding to points of
$V(I_\lambda S_\lambda + J S_\lambda)$.

\medskip\noindent
In the case that $S$ is essentially of finite presentation, we can write
$S = \Sigma^{-1}C$ where $R \to C$ is of finite presentation and
$\Sigma \subset C$ is a multiplicative subset. We can also write
$M = \Sigma^{-1}N$ for some finitely presented $C$-module $N$, see
Algebra, Lemma \ref{algebra-lemma-construct-fp-module}.
At this point we introduce $C_\lambda$, $C'$, $N_\lambda$, $N'$. Then in
the discussion above we obtain an open $U' \subset \Spec(C')$
over which $N'$ is flat over $R'$. The assumption that
(\ref{equation-flat-at-primes}) is true means that $V(I'S' + JS')$ maps
into $U'$, because for a prime $\mathfrak q' \subset S'$, corresponding
to a prime $\mathfrak r' \subset C'$ we have
$M'_{\mathfrak q'} = N'_{\mathfrak r'}$. Thus we can find
$g'_j \in C'$ such that $\bigcup D(g'_j)$ contains the image of
$V(I'S' + JS')$. The rest of the proof is exactly the same as before.
\end{proof}

\begin{lemma}
\label{lemma-flat-module-powers-variant}
In Situation \ref{situation-flattening-general}.
Let $I \subset R$ be an ideal. Assume
\begin{enumerate}
\item $R$ is a Noetherian ring,
\item $S$ is a Noetherian ring,
\item $M$ is a finite $S$-module, and
\item for each $n \geq 1$ and any prime
$\mathfrak q \in V(J + IS)$ the module $(M/I^n M)_{\mathfrak q}$
is flat over $R/I^n$.
\end{enumerate}
Then (\ref{equation-flat-at-primes}) holds for $(R, I)$, i.e.,
for every prime $\mathfrak q \in V(J + IS)$
the localization $M_{\mathfrak q}$ is flat over $R$.
\end{lemma}

\begin{proof}
Let $\mathfrak q \in V(J + IS)$. Then
Algebra, Lemma \ref{algebra-lemma-flat-module-powers}
applied to $R \to S_{\mathfrak q}$ and $M_{\mathfrak q}$
implies that $M_{\mathfrak q}$ is flat over $R$.
\end{proof}










\section{Flattening over a Noetherian complete local ring}
\label{section-flattening-Noetherian-complete-local}

\noindent
The following three lemmas give a completely algebraic proof of the existence
of the ``local'' flattening stratification when the base is a complete
local Noetherian ring $R$ and the given module is finite over a finite
type $R$-algebra $S$.

\begin{lemma}
\label{lemma-flattening-complete-local-noetherian}
Let $R \to S$ be a ring map.
Let $M$ be an $S$-module.
Assume
\begin{enumerate}
\item $(R, \mathfrak m)$ is a complete local Noetherian ring,
\item $S$ is a Noetherian ring, and
\item $M$ is finite over $S$.
\end{enumerate}
Then there exists an ideal $I \subset \mathfrak m$ such that
\begin{enumerate}
\item $(M/IM)_{\mathfrak q}$ is flat over $R/I$ for all
primes $\mathfrak q$ of $S/IS$ lying over $\mathfrak m$, and
\item if $J \subset R$ is an ideal such that $(M/JM)_{\mathfrak q}$
is flat over $R/J$ for all primes $\mathfrak q$ lying over
$\mathfrak m$, then $I \subset J$.
\end{enumerate}
In other words, $I$ is the smallest ideal of $R$ such that
(\ref{equation-flat-at-primes-over}) holds for
$(\overline{R} \to \overline{S}, \overline{\mathfrak m}, \overline{M})$
where $\overline{R} = R/I$, $\overline{S} = S/IS$,
$\overline{\mathfrak m} = \mathfrak m/I$ and $\overline{M} = M/IM$.
\end{lemma}

\begin{proof}
Let $J \subset R$ be an ideal. Apply
Algebra, Lemma \ref{algebra-lemma-flat-module-powers}
to the module $M/JM$ over the ring $R/J$.
Then we see that $(M/JM)_{\mathfrak q}$
is flat over $R/J$ for all primes $\mathfrak q$ of $S/JS$
if and only if $M/(J + \mathfrak m^n)M$ is flat over
$R/(J + \mathfrak m^n)$ for all $n \geq 1$.
We will use this remark below.

\medskip\noindent
For every $n \geq 1$ the local ring $R/\mathfrak m^n$ is Artinian.
Hence, by
Lemma \ref{lemma-flattening-artinian}
there exists a smallest ideal $I_n \supset \mathfrak m^n$ such that
$M/I_nM$ is flat over $R/I_n$. It is clear that $I_{n + 1} + \mathfrak m^n$
is contains $I_n$ and applying
Lemma \ref{lemma-intersection-flat}
we see that $I_n = I_{n + 1} + \mathfrak m^n$. Since
$R = \lim_n\ R/\mathfrak m^n$ we see that $I = \lim_n\ I_n/\mathfrak m^n$
is an ideal in $R$ such that $I_n = I + \mathfrak m^n$ for all $n \geq 1$.
By the initial remarks of the proof we see that $I$ verifies (1)
and (2). Some details omitted.
\end{proof}

\begin{lemma}
\label{lemma-flattening-complete-local-noetherian-property-by-finite-type}
With notation $R \to S$, $M$, and $I$ and assumptions as in
Lemma \ref{lemma-flattening-complete-local-noetherian}.
Consider a local homomorphism of local rings
$\varphi : (R, \mathfrak m) \to (R', \mathfrak m')$
such that $R'$ is Noetherian. Then the following are equivalent
\begin{enumerate}
\item condition (\ref{equation-flat-at-primes-over}) holds
for $(R' \to S \otimes_R R', \mathfrak m', M \otimes_R R')$, and
\item $\varphi(I) = 0$.
\end{enumerate}
\end{lemma}

\begin{proof}
The implication (2) $\Rightarrow$ (1) follows from
Lemma \ref{lemma-base-change-flat-at-primes-over}.
Let $\varphi : R \to R'$ be as in the lemma satisfying (1).
We have to show that $\varphi(I) = 0$.
This is equivalent to the condition that $\varphi(I)R' = 0$.
By Artin-Rees in the Noetherian local ring $R'$ (see
Algebra, Lemma \ref{algebra-lemma-intersect-powers-ideal-module-zero})
this is equivalent to the condition that
$\varphi(I)R' + (\mathfrak m')^n = (\mathfrak m')^n$ for all $n > 0$.
Hence this is equivalent to the condition that the composition
$\varphi_n : R \to R' \to R'/(\mathfrak m')^n$ annihilates $I$ for each $n$.
Now assumption (1) for $\varphi$ implies assumption (1) for
$\varphi_n$ by
Lemma \ref{lemma-base-change-flat-at-primes-over}.
This reduces us to the case where $R'$ is Artinian local.

\medskip\noindent
Assume $R'$ Artinian. Let $J = \Ker(\varphi)$. We have to show that
$I \subset J$. By the construction of $I$ in
Lemma \ref{lemma-flattening-complete-local-noetherian}
it suffices to show that $(M/JM)_{\mathfrak q}$ is flat over $R/J$
for every prime $\mathfrak q$ of $S/JS$ lying over $\mathfrak m$.
As $R'$ is Artinian, condition (1) signifies that $M \otimes_R R'$
is flat over $R'$. As $R'$ is Artinian and $R/J \to R'$ is a local
injective ring map, it follows that $R/J$ is Artinian
too. Hence the flatness of $M \otimes_R R' = M/JM \otimes_{R/J} R'$ over
$R'$ implies that $M/JM$ is flat over $R/J$ by
Algebra,
Lemma \ref{algebra-lemma-descent-flatness-injective-map-artinian-rings}.
This concludes the proof.
\end{proof}

\begin{lemma}
\label{lemma-flattening-complete-local-universal-property}
With notation $R \to S$, $M$, and $I$ and assumptions as in
Lemma \ref{lemma-flattening-complete-local-noetherian}.
In addition assume that $R \to S$ is of finite type.
Then for any local homomorphism of local rings
$\varphi : (R, \mathfrak m) \to (R', \mathfrak m')$
the following are equivalent
\begin{enumerate}
\item condition (\ref{equation-flat-at-primes-over}) holds
for $(R' \to S \otimes_R R', \mathfrak m', M \otimes_R R')$, and
\item $\varphi(I) = 0$.
\end{enumerate}
\end{lemma}

\begin{proof}
The implication (2) $\Rightarrow$ (1) follows from
Lemma \ref{lemma-base-change-flat-at-primes-over}.
Let $\varphi : R \to R'$ be as in the lemma satisfying (1).
As $R$ is Noetherian we see that $R \to S$ is of finite presentation
and $M$ is an $S$-module of finite presentation.
Write $R' = \colim_\lambda R_\lambda$
as a directed colimit of local $R$-subalgebras $R_\lambda \subset R'$,
with maximal ideals $\mathfrak m_\lambda = R_\lambda \cap \mathfrak m'$
such that each $R_\lambda$ is essentially of finite type over $R$. By
Lemma \ref{lemma-limit-preserving-flat-at-primes-over}
we see that condition (\ref{equation-flat-at-primes-over}) holds for
$(R_\lambda \to S \otimes_R R_\lambda, \mathfrak m_\lambda,
M \otimes_R R_\lambda)$ for some $\lambda$. Hence
Lemma \ref{lemma-flattening-complete-local-noetherian-property-by-finite-type}
applies to the ring map $R \to R_\lambda$ and we see that
$I$ maps to zero in $R_\lambda$, a fortiori it maps to zero in $R'$.
\end{proof}




\section{Descent of flatness along integral maps}
\label{section-descent-flatness-integral}

\noindent
First a few simple lemmas.

\begin{lemma}
\label{lemma-have-one-root}
Let $R$ be a ring. Let $P(T)$ be a monic polynomial with coefficients
in $R$. Let $\alpha \in R$ be such that $P(\alpha) = 0$. Then
$P(T) = (T - \alpha)Q(T)$ for some monic polynomial $Q(T) \in R[T]$.
\end{lemma}

\begin{proof}
By induction on the degree of $P$. If $\deg(P) = 1$, then
$P(T) = T - \alpha$ and the result is true. If $\deg(P) > 1$, then
we can write $P(T) = (T - \alpha)Q(T) + r$ for some polynomial
$Q \in R[T]$ of degree $< \deg(P)$ and some $r \in R$ by long
division. By assumption $0 = P(\alpha) = (\alpha - \alpha)Q(\alpha) + r = r$
and we conclude that $r = 0$ as desired.
\end{proof}

\begin{lemma}
\label{lemma-adjoin-one-root}
Let $R$ be a ring. Let $P(T)$ be a monic polynomial with coefficients
in $R$. There exists a finite free ring map $R \to R'$ such that
$P(T) = (T - \alpha)Q(T)$ for some $\alpha \in R'$ and some
monic polynomial $Q(T) \in R'[T]$.
\end{lemma}

\begin{proof}
Write $P(T) = T^d + a_1T^{d - 1} + \ldots + a_0$.
Set $R' = R[x]/(x^d + a_1x^{d - 1} + \ldots + a_0)$.
Set $\alpha$ equal to the congruence class of $x$.
Then it is clear that $P(\alpha) = 0$. Thus we win by
Lemma \ref{lemma-have-one-root}.
\end{proof}

\begin{lemma}
\label{lemma-finite-split}
Let $R \to S$ be a finite ring map.
There exists a finite free ring extension $R \subset R'$ such
that $S \otimes_R R'$ is a quotient of a ring of the form
$$
R'[T_1, \ldots, T_n]/(P_1(T_1), \ldots, P_n(T_n))
$$
with $P_i(T) = \prod_{j = 1, \ldots, d_i} (T - \alpha_{ij})$ for some
$\alpha_{ij} \in R'$.
\end{lemma}

\begin{proof}
Let $x_1, \ldots, x_n \in S$ be generators of $S$ over $R$.
For each $i$ we can choose a monic polynomial $P_i(T) \in R[T]$
such that $P_i(x_i) = 0$ in $S$, see
Algebra, Lemma \ref{algebra-lemma-finite-is-integral}.
Say $\deg(P_i) = d_i$. By
Lemma \ref{lemma-adjoin-one-root}
(applied $\sum d_i$ times) there exists a finite free ring
extension $R \subset R'$ such that each $P_i$ splits completely:
$$
P_i(T) = \prod\nolimits_{j = 1, \ldots, d_i} (T - \alpha_{ij})
$$
for certain $\alpha_{ik} \in R'$. Let
$R'[T_1, \ldots, T_n] \to S \otimes_R R'$ be the $R'$-algebra map
which maps $T_i$ to $x_i \otimes 1$. As this maps $P_i(T_i)$ to zero,
this induces the desired surjection.
\end{proof}

\begin{lemma}
\label{lemma-split-image}
Let $R$ be a ring.
Let $S = R[T_1, \ldots, T_n]/J$.
Assume $J$ contains elements of the form $P_i(T_i)$
with $P_i(T) = \prod_{j = 1, \ldots, d_i} (T - \alpha_{ij})$ for some
$\alpha_{ij} \in R$. For $\underline{k} = (k_1, \ldots, k_n)$
with $1 \leq k_i \leq d_i$ consider the ring map
$$
\Phi_{\underline{k}} : R[T_1, \ldots, T_n] \to R,
\quad
T_i \longmapsto \alpha_{ik_i}
$$
Set $J_{\underline{k}} = \Phi_{\underline{k}}(J)$.
Then the image of $\Spec(S) \to \Spec(R)$ is equal to
$V(\bigcap J_{\underline{k}})$.
\end{lemma}

\begin{proof}
This lemma proves itself. Hint:
$V(\bigcap J_{\underline{k}}) = \bigcup V(J_{\underline{k}})$.
\end{proof}

\noindent
The following result is due to Ferrand, see \cite{Ferrand}.

\begin{lemma}
\label{lemma-descent-flatness-injective-finite-Noetherian-rings}
Let $R \to S$ be a finite injective homomorphism of Noetherian rings.
Let $M$ be an $R$-module. If $M \otimes_R S$ is a flat $S$-module,
then $M$ is a flat $R$-module.
\end{lemma}

\begin{proof}
Let $M$ be an $R$-module such that $M \otimes_R S$ is flat over $S$. By
Algebra, Lemma \ref{algebra-lemma-flatness-descends}
in order to prove that $M$ is flat we may replace $R$ by any faithfully flat
ring extension. By
Lemma \ref{lemma-finite-split}
we can find a finite locally free ring extension $R \subset R'$ such
that $S' = S \otimes_R R' = R'[T_1, \ldots, T_n]/J$ for some ideal
$J \subset R'[T_1, \ldots, T_n]$ which contains the  elements of the form
$P_i(T_i)$ with $P_i(T) = \prod_{j = 1, \ldots, d_i} (T - \alpha_{ij})$
for some $\alpha_{ij} \in R'$. Note that $R'$ is Noetherian
and that $R' \subset S'$ is a finite extension of rings. Hence we may
replace $R$ by $R'$ and assume that $S$ has a presentation as in
Lemma \ref{lemma-split-image}.
Note that $\Spec(S) \to \Spec(R)$ is surjective, see
Algebra, Lemma \ref{algebra-lemma-integral-overring-surjective}.
Thus, using
Lemma \ref{lemma-split-image}
we conclude that $I = \bigcap J_{\underline{k}}$ is an ideal
such that $V(I) = \Spec(R)$. This means that
$I \subset \sqrt{(0)}$, and since $R$ is Noetherian that $I$
is nilpotent. The maps $\Phi_{\underline{k}}$ induce commutative
diagrams
$$
\xymatrix{
S \ar[rr] & & R/J_{\underline{k}} \\
& R \ar[lu] \ar[ru]
}
$$
from which we conclude that $M/J_{\underline{k}}M$ is flat over
$R/J_{\underline{k}}$. By
Lemma \ref{lemma-intersection-flat}
we see that $M/IM$ is flat over $R/I$. Finally, applying
Algebra, Lemma \ref{algebra-lemma-lift-flatness}
we conclude that $M$ is flat over $R$.
\end{proof}

\begin{lemma}
\label{lemma-descent-flatness-injective-integral}
Let $R \to S$ be an injective integral ring map.
Let $M$ be a finitely presented module over $R[x_1, \ldots, x_n]$.
If $M \otimes_R S$ is flat over $S$, then $M$ is flat over $R$.
\end{lemma}

\begin{proof}
Choose a presentation
$$
R[x_1, \ldots, x_n]^{\oplus t} \to R[x_1, \ldots, x_n]^{\oplus r} \to M \to 0.
$$
Let's say that the first map is given by the $r \times t$-matrix
$T = (f_{ij})$ with $f_{ij} \in R[x_1, \ldots, x_n]$. Write
$f_{ij} = \sum f_{ij, I} x^I$ with $f_{ij, I} \in R$ (multi-index notation).
Consider diagrams
$$
\xymatrix{
R \ar[r] & S \\
R_\lambda \ar[u] \ar[r] & S_\lambda \ar[u]
}
$$
where $R_\lambda$ is a finitely generated $\mathbf{Z}$-subalgebra of
$R$ containing all $f_{ij, I}$ and $S_\lambda$ is a finite
$R_\lambda$-subalgebra of $S$. Let $M_\lambda$ be the finite
$R_\lambda[x_1, \ldots, x_n]$-module defined by a presentation
as above, using the same matrix $T$ but now viewed as a matrix
over $R_\lambda[x_1, \ldots, x_n]$. Note that $S$ is the directed colimit
of the $S_\lambda$ (details omitted). By
Algebra, Lemma \ref{algebra-lemma-flat-finite-presentation-limit-flat}
we see that for some $\lambda$ the module
$M_\lambda \otimes_{R_\lambda} S_\lambda$ is flat over $S_\lambda$. By
Lemma \ref{lemma-descent-flatness-injective-finite-Noetherian-rings}
we conclude that $M_\lambda$ is flat over $R_\lambda$. Since
$M = M_\lambda \otimes_{R_\lambda} R$ we win by
Algebra, Lemma \ref{algebra-lemma-flat-base-change}.
\end{proof}




\section{Torsion free modules}
\label{section-torsion-flat}

\noindent
In this section we discuss torsion free modules and the relationship
with flatness (especially over dimension 1 rings).

\begin{definition}
\label{definition-torsion}
Let $R$ be a domain. Let $M$ be an $R$-module.
\begin{enumerate}
\item We say an element $x \in M$ is {\it torsion} if there exists
a nonzero $f \in R$ such that $fx = 0$.
\item We say $M$ is {\it torsion free} if the only torsion element of $M$
is $0$.
\end{enumerate}
\end{definition}

\noindent
Let $R$ be a domain and let $S = R \setminus \{0\}$ be the multiplicative
set of nonzero elements of $R$. Then an $R$-module $M$ is torsion free if
and only if $M \to S^{-1}M$ is injective. In other words, if and only if
the map $M \to M \otimes_R K$ is injective where $K = S^{-1}R$ is the fraction
field of $R$.

\begin{lemma}
\label{lemma-torsion}
Let $R$ be a domain. Let $M$ be an $R$-module.
The set of torsion elements of $M$ forms a submodule $M_{tors} \subset M$.
The quotient module $M/M_{tors}$ is torsion free.
\end{lemma}

\begin{proof}
Omitted.
\end{proof}

\begin{lemma}
\label{lemma-localize-torsion}
Let $R$ be a domain. Let $M$ be a torsion free $R$-module.
For any multiplicative set $S \subset R$ the module
$S^{-1}M$ is a torsion free $S^{-1}R$-module.
\end{lemma}

\begin{proof}
Omitted.
\end{proof}

\begin{lemma}
\label{lemma-flat-pullback-torsion}
Let $R \to R'$ be a flat homomorphism of domains. If $M$ is a torsion
free $R$-module, then $M \otimes_R R'$ is a torsion free $R'$-module.
\end{lemma}

\begin{proof}
If $M$ is torsion free, then $M \subset M \otimes_R K$ is injective
where $K$ is the fraction field of $R$. Since $R'$ is flat over $R$
we see that $M \otimes_R R' \to (M \otimes_R K) \otimes_R R'$ is injective.
Since $M \otimes_R K$ is isomorphic to a direct sum of copies of $K$,
it suffices to see that $K \otimes_R R'$ is torsion free. This is true
because it is a localization of $R'$.
\end{proof}

\begin{lemma}
\label{lemma-extension-torsion-free}
Let $R$ be a domain. Let $0 \to M \to M' \to M'' \to 0$
be a short exact sequence of $R$-modules. If $M$ and $M''$
are torsion free, then $M'$ is torsion free.
\end{lemma}

\begin{proof}
Omitted.
\end{proof}

\begin{lemma}
\label{lemma-check-torsion}
Let $R$ be a domain. Let $M$ be an $R$-module.
Then $M$ is torsion free if and only if $M_\mathfrak m$ is a
torsion free $R_\mathfrak m$-module for all maximal ideals
$\mathfrak m$ of $R$.
\end{lemma}

\begin{proof}
Omitted. Hint: Use Lemma \ref{lemma-localize-torsion} and
Algebra, Lemma \ref{algebra-lemma-characterize-zero-local}.
\end{proof}

\begin{lemma}
\label{lemma-finite-torsion-free-submodule-free}
Let $R$ be a domain. Let $M$ be a finite $R$-module.
Then $M$ is torsion free if and only if $M$ is a
submodule of a finite free module.
\end{lemma}

\begin{proof}
If $M$ is a submodule of $R^{\oplus n}$, then $M$ is torsion free.
For the converse, assume $M$ is torsion free. Let $K$ be the
fraction field of $R$. Then $M \otimes_R K$ is a finite dimensional
$K$-vector space. Choose a basis $e_1, \ldots, e_r$ for this vector
space. Let $x_1, \ldots, x_n$ be generators of $M$. Write
$x_i = \sum (a_{ij}/b_{ij}) e_j$ for some $a_{ij}, b_{ij} \in R$
with $b_{ij} \not = 0$. Set $b = \prod_{i, j} b_{ij}$.
Since $M$ is torsion free the map
$M \to M \otimes_R K$ is injective and the image is contained
in $R^{\oplus r} = R e_1/b \oplus \ldots \oplus Re_r/b$.
\end{proof}

\begin{lemma}
\label{lemma-torsion-free-finite-noetherian-domain}
Let $R$ be a Noetherian domain. Let $M$ be a nonzero finite $R$-module.
The following are equivalent
\begin{enumerate}
\item $M$ is torsion free,
\item $M$ is a submodule of a finite free module,
\item $(0)$ is the only associated prime of $M$,
\item $(0)$ is in the support of $M$ and $M$ has property $(S_1)$, and
\item $(0)$ is in the support of $M$ and $M$ has no embedded associated prime.
\end{enumerate}
\end{lemma}

\begin{proof}
We have seen the equivalence of (1) and (2) in
Lemma \ref{lemma-finite-torsion-free-submodule-free}.
We have seen the equivalence of (4) and (5) in
Algebra, Lemma \ref{algebra-lemma-criterion-no-embedded-primes}.
The equivalence between (3) and (5) is immediate from the definition.
A localization of a torsion free module is torsion free
(Lemma \ref{lemma-localize-torsion}), hence it is clear that a
$M$ has no associated primes different from $(0)$. Thus (1)
implies (5). Conversely, assume (5). If $M$ has torsion,
then there exists an embedding $R/I \subset M$ for some nonzero
ideal $I$ of $R$. Hence $M$ has an associated prime different
from $(0)$
(see Algebra, Lemmas \ref{algebra-lemma-ass} and \ref{algebra-lemma-ass-zero}).
This is an embedded associated prime which contradicts the assumption.
\end{proof}

\begin{lemma}
\label{lemma-flat-torsion-free}
Let $R$ be a domain. Any flat $R$-module is torsion free.
\end{lemma}

\begin{proof}
If $x \in R$ is nonzero, then $x : R \to R$ is injective, and hence if $M$
is flat over $R$, then $x : M \to M$ is injective. Thus if $M$ is flat over
$R$, then $M$ is torsion free.
\end{proof}

\begin{lemma}
\label{lemma-valuation-ring-torsion-free-flat}
Let $A$ be a valuation ring.
An $A$-module $M$ is flat over $A$ if and only if $M$ is torsion free.
\end{lemma}

\begin{proof}
The implication ``flat $\Rightarrow$ torsion free'' is
Lemma \ref{lemma-flat-torsion-free}.
For the converse, assume $M$ is torsion free.
By the equational criterion of flatness (see
Algebra, Lemma \ref{algebra-lemma-flat-eq})
we have to show that every relation in $M$ is trivial. To do this assume that
$\sum_{i = 1, \ldots, n} a_i x_i = 0$ with $x_i \in M$ and $a_i \in A$.
After renumbering we may assume that $v(a_1) \leq v(a_i)$ for all $i$.
Hence we can write $a_i = a'_i a_1$ for some $a'_i \in A$. Note that
$a'_1 = 1$. As $M$ is torsion free we see that
$x_1 = - \sum_{i \geq 2} a'_i x_i$. Thus, if we choose
$y_i = x_i$, $i = 2, \ldots, n$ then
$$
x_1 = \sum\nolimits_{j \geq 2} -a'_j y_j, \quad
x_i = y_i, (i \geq 2)\quad
0 = a_1 \cdot (-a'_j) + a_j \cdot 1 (j \geq 2)
$$
shows that the relation was trivial (to be explicit the elements
$a_{ij}$ are defined by setting $a_{11} = 0$, $a_{1j} = -a'_j$
for $j > 1$, and $a_{ij} = \delta_{ij}$ for $i, j \geq 2$).
\end{proof}

\begin{lemma}
\label{lemma-dedekind-torsion-free-flat}
Let $A$ be a Dedekind domain (for example a discrete valuation ring
or more generally a PID).
\begin{enumerate}
\item An $A$-module is flat if and only if it is torsion free.
\item A finite torsion free $A$-module is finite locally free.
\item A finite torsion free $A$-module is finite free if
$A$ is a PID.
\end{enumerate}
\end{lemma}

\begin{proof}
(For the parenthetical remark in the statement of the lemma, see
Algebra, Lemma \ref{algebra-lemma-PID-dedekind}.) Proof of (1).
By Lemma \ref{lemma-check-torsion}
and Algebra, Lemma \ref{algebra-lemma-flat-localization}
it suffices to check the statement over $A_\mathfrak m$
for $\mathfrak m \subset A$ maximal. Since $A_\mathfrak m$
is a discrete valuation ring
(Algebra, Lemma \ref{algebra-lemma-characterize-Dedekind})
we win by Lemma \ref{lemma-valuation-ring-torsion-free-flat}.

\medskip\noindent
Proof of (2). Follows from
Algebra, Lemma \ref{algebra-lemma-finite-projective}
and (1).

\medskip\noindent
Proof of (3). Let $A$ be a PID and let $M$ be a finite
torsion free module. By Lemma \ref{lemma-finite-torsion-free-submodule-free}
we see that $M \subset A^{\oplus n}$ for some $n$. We argue that
$M$ is free by induction on $n$. The case $n = 1$ expresses exactly the
fact that $A$ is a PID. If $n > 1$ let $M' \subset R^{\oplus n - 1}$
be the image of the projection onto the last $n - 1$ summands of
$R^{\oplus n}$. Then we obtain a short exact sequence
$0 \to I \to M \to M' \to 0$ where $I$ is the intersection of $M$
with the first summand $R$ of $R^{\oplus n}$. By induction we
see that $M$ is an extension of finite free $R$-modules, whence
finite free.
\end{proof}

\begin{lemma}
\label{lemma-hom-into-torsion-free}
Let $R$ be a domain. Let $M$, $N$ be $R$-modules.
If $N$ is torsion free, so is $\Hom_R(M, N)$.
\end{lemma}

\begin{proof}
Choose a surjection $\bigoplus_{i \in I} R \to M$.
Then $\Hom_R(M, N) \subset \prod_{i \in I} N$.
\end{proof}




\section{Reflexive modules}
\label{section-reflexive}

\noindent
Here is our definition.

\begin{definition}
\label{definition-reflexive}
Let $R$ be a domain. We say an $R$-module $M$ is {\it reflexive} if
the natural map
$$
j : M \longrightarrow \Hom_R(\Hom_R(M, R), R)
$$
which sends $m \in M$ to the map sending $\varphi \in \Hom_R(M, R)$
to $\varphi(m) \in R$ is an isomorphism.
\end{definition}

\noindent
We can make this definition for more general rings, but already the
definition above has drawbacks. It would be wise to restrict
to Noetherian domains and finite torsion free modules and (perhaps)
impose some regularity conditions on $R$ (e.g., $R$ is normal).

\begin{lemma}
\label{lemma-reflexive-torsion-free}
Let $R$ be a domain and let $M$ be an $R$-module.
\begin{enumerate}
\item If $M$ is reflexive, then $M$ is torsion free.
\item If $M$ is finite, then $j : M \to \Hom_R(\Hom_R(M, R), R)$ is injective
if and only if $M$ is torsion free
\end{enumerate}
\end{lemma}

\begin{proof}
Follows immediately from Lemmas \ref{lemma-hom-into-torsion-free} and
\ref{lemma-finite-torsion-free-submodule-free}.
\end{proof}

\begin{lemma}
\label{lemma-cokernel-map-double-dual-dvr}
Let $R$ be a discrete valuation ring and let $M$ be a finite $R$-module.
Then the map $j : M \to \Hom_R(\Hom_R(M, R), R)$ is surjective.
\end{lemma}

\begin{proof}
Let $M_{tors} \subset M$ be the torsion submodule. Then we have
$\Hom_R(M, R) = \Hom_R(M/M_{tors}, R)$ (holds over any domain).
Hence we may assume that $M$ is torsion free. Then $M$ is free
by Lemma \ref{lemma-dedekind-torsion-free-flat} and the lemma is clear.
\end{proof}

\begin{lemma}
\label{lemma-check-reflexive}
Let $R$ be a Noetherian domain. Let $M$ be a finite $R$-module.
The following are equivalent:
\begin{enumerate}
\item $M$ is reflexive,
\item $M_\mathfrak p$ is a reflexive $R_\mathfrak p$-module
for all primes $\mathfrak p \subset R$, and
\item $M_\mathfrak m$ is a reflexive $R_\mathfrak m$-module
for all maximal ideals $\mathfrak m$ of $R$.
\end{enumerate}
\end{lemma}

\begin{proof}
The localization of $j : M \to \Hom_R(\Hom_R(M, R), R)$
at a prime $\mathfrak p$ is the corresponding map for the module
$M_\mathfrak p$ over the Noetherian local domain $R_\mathfrak p$.
See Algebra, Lemma \ref{algebra-lemma-hom-from-finitely-presented}.
Thus the lemma holds by
Algebra, Lemma \ref{algebra-lemma-characterize-zero-local}.
\end{proof}

\begin{lemma}
\label{lemma-sequence-reflexive}
Let $R$ be a Noetherian domain. Let $0 \to M \to M' \to M''$
an exact sequence of finite $R$-modules. If $M'$ is reflexive
and $M''$ is torsion free, then $M$ is reflexive.
\end{lemma}

\begin{proof}
We will use without further mention that $\Hom_R(N, N')$ is a finite
$R$-module for any finite $R$-modules $N$ and $N'$, see
Algebra, Lemma \ref{algebra-lemma-ext-noetherian}.
We take duals to get a sequence
$$
\Hom_R(M, R) \leftarrow \Hom_R(M', R) \leftarrow \Hom_R(M'', R)
$$
Dualizing again we obtain a commutative diagram
$$
\xymatrix{
\Hom_R(\Hom_R(M, R), R) \ar[r]_j &
\Hom_R(\Hom_R(M', R), R) \ar[r] &
\Hom_R(\Hom_R(M'', R), R) \\
M \ar[u] \ar[r] & M' \ar[u] \ar[r] & M'' \ar[u]
}
$$
We do not know the top row is exact. But, by assumption
the middle vertical arrow is an isomorphism and the right
vertical arrow is injective (Lemma \ref{lemma-reflexive-torsion-free}).
We claim $j$ is injective. Assuming the claim
a diagram chase shows that the left vertical
arrow is an isomorphism, i.e., $M$ is reflexive.

\medskip\noindent
Proof of the claim. Consider the exact sequence
$\Hom_R(M',R)\to \Hom_R(M,R)\to Q \to 0$
defining $Q$. One applies
Algebra, Lemma \ref{algebra-lemma-hom-from-finitely-presented}
to obtain
$$
\Hom_K(M'\otimes_R K,K) \to
\Hom_K(M\otimes_R K,K) \to
Q\otimes_R K\to 0
$$
But $M \otimes_R K \to M' \otimes_R K$ is an injective map of vector spaces,
hence split injective, so $Q \otimes_R K = 0$, that is, $Q$ is torsion.
Then one gets the exact sequence 
$$
0 \to \Hom_R(Q,R) \to
\Hom_R(\Hom_R(M,R),R) \to
\Hom_R(\Hom_R(M',R),R)
$$
and $\Hom_R(Q,R)=0$ because $Q$ is torsion.
\end{proof}

\begin{lemma}
\label{lemma-characterize-reflexive}
Let $R$ be a Noetherian domain. Let $M$ be a finite $R$-module.
The following are equivalent
\begin{enumerate}
\item $M$ is reflexive,
\item there exists a short exact sequence $0 \to M \to F \to N \to 0$
with $F$ finite free and $N$ torsion free.
\end{enumerate}
\end{lemma}

\begin{proof}
Observe that a finite free module is reflexive.
By Lemma \ref{lemma-sequence-reflexive} we see
that (2) implies (1). Assume $M$ is reflexive. Choose a presentation
$R^{\oplus m} \to R^{\oplus n} \to \Hom_R(M, R) \to 0$.
Dualizing we get an exact sequence
$$
0 \to \Hom_R(\Hom_R(M, R), R) \to R^{\oplus n} \to N \to 0
$$
with $N = \Im(R^{\oplus n} \to R^{\oplus m})$ a torsion free module.
As $M = \Hom_R(\Hom_R(M, R), R)$ we get an exact sequence as in (2).
\end{proof}

\begin{lemma}
\label{lemma-flat-pullback-reflexive}
Let $R \to R'$ be a flat homomorphism of Noetherian domains.
If $M$ is a finite reflexive $R$-module, then $M \otimes_R R'$
is a finite reflexive $R'$-module.
\end{lemma}

\begin{proof}
Choose a short exact sequence $0 \to M \to F \to N \to 0$
with $F$ finite free and $N$ torsion free, see
Lemma \ref{lemma-characterize-reflexive}. Since $R \to R'$ is flat
we obtain a short exact sequence
$0 \to M \otimes_R R' \to F \otimes_R R' \to N \otimes_R R' \to 0$
with $F \otimes_R R'$ finite free and $N \otimes_R R'$ torsion
free (Lemma \ref{lemma-flat-pullback-torsion}). Thus $M \otimes_R R'$
is reflexive by Lemma \ref{lemma-characterize-reflexive}.
\end{proof}

\begin{lemma}
\label{lemma-dual-reflexive}
Let $R$ be a Noetherian domain. Let $M$ be a finite $R$-module.
Let $N$ be a finite reflexive $R$-module. Then $\Hom_R(M, N)$ is reflexive.
\end{lemma}

\begin{proof}
Choose a presentation $R^{\oplus m} \to R^{\oplus n} \to M \to 0$.
Then we obtain
$$
0 \to \Hom_R(M, N) \to N^{\oplus n} \to N' \to 0
$$
with $N' = \Im(N^{\oplus n} \to N^{\oplus m})$ torsion free.
We conclude by Lemma \ref{lemma-sequence-reflexive}.
\end{proof}

\begin{definition}
\label{definition-reflexive-hull}
Let $R$ be a Noetherian domain. Let $M$ be a finite $R$-module.
The module $M^{**} = \Hom_R(\Hom_R(M, R), R)$ is called the
{\it reflexive hull} of $M$.
\end{definition}

\noindent
This makes sense because the reflexive hull is reflexive by
Lemma \ref{lemma-dual-reflexive}. The assignment $M \mapsto M^{**}$
is a functor. If $\varphi : M \to N$ is an $R$-module map into a reflexive
$R$-module $N$, then $\varphi$ factors $M \to M^{**} \to N$
through the reflexive hull of $M$. Another way to say this is that
taking the reflexive hull is the left adjoint to the inclusion functor
$$
\text{finite reflexive modules} \subset
\text{finite modules}
$$
over a Noetherian domain $R$.

\begin{lemma}
\label{lemma-hom-into-depth}
Let $R$ be a Noetherian local ring. Let $M$, $N$ be finite $R$-modules.
\begin{enumerate}
\item If $N$ has depth $\geq 1$, then $\Hom_R(M, N)$ has depth $\geq 1$.
\item If $N$ has depth $\geq 2$, then $\Hom_R(M, N)$ has depth $\geq 2$.
\end{enumerate}
\end{lemma}

\begin{proof}
Choose a presentation $R^{\oplus m} \to R^{\oplus n} \to M \to 0$.
Dualizing we get an exact sequence
$$
0 \to \Hom_R(M, N) \to N^{\oplus n} \to N' \to 0
$$
with $N' = \Im(N^{\oplus n} \to N^{\oplus m})$. A submodule of a module
with depth $\geq 1$ has depth $\geq 1$; this follows immediately from
the definition. Thus part (1) is clear. For (2) note that here the
assumption and the previous remark implies $N'$ has depth $\geq 1$.
The module $N^{\oplus n}$ has depth $\geq 2$.
From Algebra, Lemma \ref{algebra-lemma-depth-in-ses}
we conclude $\Hom_R(M, N)$ has depth $\geq 2$.
\end{proof}

\begin{lemma}
\label{lemma-hom-into-S2}
Let $R$ be a Noetherian ring. Let $M$, $N$ be finite $R$-modules.
\begin{enumerate}
\item If $N$ has property $(S_1)$, then $\Hom_R(M, N)$ has property $(S_1)$.
\item If $N$ has property $(S_2)$, then $\Hom_R(M, N)$ has property $(S_2)$.
\item If $R$ is a domain, $N$ is torsion free and $(S_2)$, then
$\Hom_R(M, N)$ is torsion free and has property $(S_2)$.
\end{enumerate}
\end{lemma}

\begin{proof}
Since localizing at primes commutes with taking $\Hom_R$ for finite
$R$-modules (Algebra, Lemma \ref{algebra-lemma-ext-noetherian})
parts (1) and (2) follow immediately from Lemma \ref{lemma-hom-into-depth}.
Part (3) follows from (2) and
Lemma \ref{lemma-hom-into-torsion-free}.
\end{proof}

\begin{lemma}
\label{lemma-check-injective-on-ass}
Let $R$ be a Noetherian ring. Let $\varphi : M \to N$ be a map of
$R$-modules. Assume that for every prime $\mathfrak p$
of $R$ at least one of the following happens
\begin{enumerate}
\item $M_\mathfrak p \to N_\mathfrak p$ is injective, or
\item $\mathfrak p \not \in \text{Ass}(M)$.
\end{enumerate}
Then $\varphi$ is injective.
\end{lemma}

\begin{proof}
Let $\mathfrak p$ be an associated prime of $\Ker(\varphi)$.
Then there exists an element $x \in M_\mathfrak p$ which is
in the kernel of $M_\mathfrak p \to N_\mathfrak p$ and whose
annihilator is $\mathfrak pR_\mathfrak p$
(Algebra, Lemma \ref{algebra-lemma-associated-primes-localize}).
This is impossible in both cases. Hence
$\text{Ass}(\Ker(\varphi)) = \emptyset$ and we conclude $\Ker(\varphi) = 0$ by
Algebra, Lemma \ref{algebra-lemma-ass-zero}.
\end{proof}

\begin{lemma}
\label{lemma-check-isomorphism-via-depth-and-ass}
Let $R$ be a Noetherian ring. Let $\varphi : M \to N$ be a map of
$R$-modules. Assume $M$ is finite and that for every prime $\mathfrak p$
of $R$ one of the following happens
\begin{enumerate}
\item $M_\mathfrak p \to N_\mathfrak p$ is an isomorphism, or
\item $\text{depth}(M_\mathfrak p) \geq 2$ and
$\mathfrak p \not \in \text{Ass}(N)$.
\end{enumerate}
Then $\varphi$ is an isomorphism.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-check-injective-on-ass} we see that $\varphi$ is injective.
Let $N' \subset N$ be an finitely generated $R$-module containing
the image of $M$. Then $\text{Ass}(N_\mathfrak p) = \emptyset$ implies
$\text{Ass}(N'_\mathfrak p) = \emptyset$.
Hence the assumptions of the lemma hold for $M \to N'$.
In order to prove that $\varphi$ is an isomorphism, it suffices
to prove the same thing for every such $N' \subset N$. Thus we may
assume $N$ is a finite $R$-module. In this case,
$\mathfrak p \not \in \text{Ass}(N) \Rightarrow
\text{depth}(N_\mathfrak p) \geq 1$, see
Algebra, Lemma \ref{algebra-lemma-ideal-nonzerodivisor}.
Consider the short exact sequence
$$
0 \to M \to N \to Q \to 0
$$
defining $Q$.
Looking at the conditions we see that either $Q_\mathfrak p = 0$
in case (1) or $\text{depth}(Q_\mathfrak p) \geq 1$ in case (2)
by Algebra, Lemma \ref{algebra-lemma-depth-in-ses}.
This implies that $Q$ does not have any associated primes, hence $Q = 0$ by
Algebra, Lemma \ref{algebra-lemma-ass-zero}.
\end{proof}

\begin{lemma}
\label{lemma-isom-depth-2-torsion-free}
Let $R$ be a Noetherian domain. Let $\varphi : M \to N$ be a map of
$R$-modules. Assume $M$ is finite, $N$ is torsion free, and
that for every prime $\mathfrak p$ of $R$ one of the following happens
\begin{enumerate}
\item $M_\mathfrak p \to N_\mathfrak p$ is an isomorphism, or
\item $\text{depth}(M_\mathfrak p) \geq 2$.
\end{enumerate}
Then $\varphi$ is an isomorphism.
\end{lemma}

\begin{proof}
This is a special case of
Lemma \ref{lemma-check-isomorphism-via-depth-and-ass}.
\end{proof}

\begin{lemma}
\label{lemma-reflexive-depth-2}
Let $R$ be a Noetherian domain. Let $M$ be a finite $R$-module.
The following are equivalent
\begin{enumerate}
\item $M$ is reflexive,
\item for every prime $\mathfrak p$ of $R$ one of the following happens
\begin{enumerate}
\item $M_\mathfrak p$ is a reflexive $R_\mathfrak p$-module, or
\item $\text{depth}(M_\mathfrak p) \geq 2$.
\end{enumerate}
\end{enumerate}
\end{lemma}

\begin{proof}
If (1) is true, then $M_\mathfrak p$ is a reflexive module
for all primes of $\mathfrak p$ by Lemma \ref{lemma-check-reflexive}.
Thus (1) $\Rightarrow$ (2). Assume (2). Set $N = \Hom_R(\Hom_R(M, R), R)$
so that
$$
N_\mathfrak p =
\Hom_{R_\mathfrak p}(
\Hom_{R_\mathfrak p}(M_\mathfrak p, R_\mathfrak p), R_\mathfrak p)
$$
for every prime $\mathfrak p$ of $R$.
See Algebra, Lemma \ref{algebra-lemma-hom-from-finitely-presented}.
We apply Lemma \ref{lemma-isom-depth-2-torsion-free} to the map
$j : M \to N$. This is allowed because $M$ is finite and
$N$ is torsion free by Lemma \ref{lemma-hom-into-torsion-free}.
In case (2)(a) the map $M_\mathfrak p \to N_\mathfrak p$ is an
isomorphism and in case (2)(b) we have $\text{depth}(M_\mathfrak p) \geq 2$.
\end{proof}

\begin{lemma}
\label{lemma-reflexive-S2}
Let $R$ be a Noetherian domain. Let $M$ be a finite reflexive $R$-module.
Let $\mathfrak p \subset R$ be a prime ideal.
\begin{enumerate}
\item If $\text{depth}(R_\mathfrak p) \geq 2$, then
$\text{depth}(M_\mathfrak p) \geq 2$.
\item If $R$ is $(S_2)$, then $M$ is $(S_2)$.
\end{enumerate}
\end{lemma}

\begin{proof}
Since formation of reflexive hull $\Hom_R(\Hom_R(M, R), R)$
commutes with localization
(Algebra, Lemma \ref{algebra-lemma-hom-from-finitely-presented})
part (1) follows from Lemma \ref{lemma-hom-into-depth}.
Part (2) is immediate from Lemma \ref{lemma-hom-into-S2}.
\end{proof}

\begin{example}
\label{example-ring-not-S2}
The results above and below suggest reflexivity is related to the $(S_2)$
condition; here is an example to prevent too optimistic conjectures.
Let $k$ be a field. Let $R$ be the $k$-subalgebra of $k[x, y]$
generated by $1, y, x^2, xy, x^3$. Then $R$ is not $(S_2)$. So
$R$ as an $R$-module is an example of a reflexive $R$-module
which is not $(S_2)$. Let $M = k[x, y]$ viewed as an $R$-module.
Then $M$ is a reflexive $R$-module because
$$
\Hom_R(M, R) = \mathfrak m = (y, x^2, xy, x^3)
\quad\text{and}\quad
\Hom_R(\mathfrak m, R) = M
$$
and $M$ is $(S_2)$ as an $R$-module (computations omitted).
Thus $R$ is a Noetherian domain possessing
a reflexive $(S_2)$ module but $R$ is not $(S_2)$ itself.
\end{example}

\begin{lemma}
\label{lemma-reflexive-over-normal}
Let $R$ be a Noetherian normal domain with fraction field $K$.
Let $M$ be a finite $R$-module. The following are equivalent
\begin{enumerate}
\item $M$ is reflexive,
\item $M$ is torsion free and has property $(S_2)$,
\item $M$ is torsion free and
$M = \bigcap_{\text{height}(\mathfrak p) = 1} M_{\mathfrak p}$
where the intersection happens in $M_K = M \otimes_R K$.
\end{enumerate}
\end{lemma}

\begin{proof}
By Algebra, Lemma \ref{algebra-lemma-criterion-normal}
we see that $R$ satisfies $(R_1)$ and $(S_2)$.

\medskip\noindent
Assume (1). Then $M$ is torsion free by Lemma \ref{lemma-reflexive-torsion-free}
and satisfies $(S_2)$ by Lemma \ref{lemma-reflexive-S2}.
Thus (2) holds.

\medskip\noindent
Assume (2). By definition
$M' = \bigcap_{\text{height}(\mathfrak p) = 1} M_{\mathfrak p}$
is the kernel of the map
$$
M_K
\longrightarrow
\bigoplus\nolimits_{\text{height}(\mathfrak p) = 1} M_K/M_\mathfrak p
\subset
\prod\nolimits_{\text{height}(\mathfrak p) = 1} M_K/M_\mathfrak p
$$
Observe that our map indeed factors through the direct sum as indicated
since given
$a/b \in K$ there are at most finitely many height $1$ primes $\mathfrak p$
with $b \in \mathfrak p$. Let $\mathfrak p_0$ be a prime of height $1$.
Then $(M_K/M_\mathfrak p)_{\mathfrak p_0} = 0$ unless
$\mathfrak p = \mathfrak p_0$ in which case we get
$(M_K/M_\mathfrak p)_{\mathfrak p_0} = M_K/M_{\mathfrak p_0}$.
Thus by exactness of localization and the fact that localization
commutes with direct sums, we see that
$M'_{\mathfrak p_0} = M_{\mathfrak p_0}$.
Since $M$ has depth $\geq 2$ at primes of height $> 1$,
we see that $M \to M'$ is an isomorphism by
Lemma \ref{lemma-isom-depth-2-torsion-free}. Hence (3) holds.

\medskip\noindent
Assume (3). Let $\mathfrak p$ be a prime of height $1$.
Then $R_\mathfrak p$ is a discrete valuation ring by $(R_1)$.
By Lemma \ref{lemma-dedekind-torsion-free-flat}
we see that $M_\mathfrak p$ is finite free, in particular
reflexive. Hence the map $M \to M^{**}$ induces an isomorphism at all
the primes $\mathfrak p$ of height $1$. Thus the condition
$M = \bigcap_{\text{height}(\mathfrak p) = 1} M_{\mathfrak p}$
implies that $M = M^{**}$ and (1) holds.
\end{proof}

\begin{lemma}
\label{lemma-describe-reflexive-hull}
Let $R$ be a Noetherian normal domain. Let $M$ be a finite $R$-module.
Then the reflexive hull of $M$ is the intersection
$$
M^{**} =
\bigcap\nolimits_{\text{height}(\mathfrak p) = 1}
M_{\mathfrak p}/(M_\mathfrak p)_{tors} =
\bigcap\nolimits_{\text{height}(\mathfrak p) = 1}
(M/M_{tors})_\mathfrak p
$$
taken in $M \otimes_R K$.
\end{lemma}

\begin{proof}
Let $\mathfrak p$ be a prime of height $1$.
The kernel of $M_\mathfrak p \to M \otimes_R K$ is the
torsion submodule $(M_\mathfrak p)_{tors}$ of $M_\mathfrak p$.
Moreover, we have
$(M/M_{tors})_\mathfrak p = M_\mathfrak p/(M_\mathfrak p)_{tors}$
and this is a finite free module over the discrete valuation ring
$R_\mathfrak p$
(Lemma \ref{lemma-dedekind-torsion-free-flat}).
Then $M_\mathfrak p/(M_\mathfrak p)_{tors} \to
(M_\mathfrak p)^{**} = (M^{**})_\mathfrak p$
is an isomorphism, hence the lemma is a consequence of
Lemma \ref{lemma-reflexive-over-normal}.
\end{proof}

\begin{lemma}
\label{lemma-integral-closure-reflexive}
Let $A$ be a Noetherian normal domain with fraction field $K$.
Let $L$ be a finite extension of $K$. If the integral closure
$B$ of $A$ in $L$ is finite over $A$, then $B$ is reflexive as an $A$-module.
\end{lemma}

\begin{proof}
It suffices to show that $B = \bigcap B_\mathfrak p$ where the intersection
is over height $1$ primes $\mathfrak p \subset A$, see
Lemma \ref{lemma-reflexive-over-normal}.
Let $b \in \bigcap B_\mathfrak p$. Let $x^d + a_1x^{d - 1} + \ldots + a_d$
be the minimal polynomial of $b$ over $K$.
We want to show $a_i \in A$.
By Algebra, Lemma \ref{algebra-lemma-minimal-polynomial-normal-domain}
we see that $a_i \in A_\mathfrak p$ for all $i$ and all height one primes
$\mathfrak p$. Hence we get what we want from
Algebra, Lemma
\ref{algebra-lemma-normal-domain-intersection-localizations-height-1}
(or the lemma already cited as $A$ is a reflexive module over itself).
\end{proof}








\section{Content ideals}
\label{section-content}

\noindent
The definition may not be what you expect.

\begin{definition}
\label{definition-content-ideal}
Let $A$ be a ring. Let $M$ be a flat $A$-module. Let $x \in M$.
If the set of ideals $I$ in $A$ such that $x \in IM$ has a
smallest element, we call it the {\it content ideal of $x$}.
\end{definition}

\noindent
Note that since $M$ is flat over $A$, for a pair of ideals $I, I'$
of $A$ we have $IM \cap I'M = (I \cap I')M$
as can be seen by tensoring the exact sequence
$0 \to I \cap I' \to I \oplus I' \to I + I' \to 0$ by $M$.

\begin{lemma}
\label{lemma-content-finitely-generated}
Let $A$ be a ring. Let $M$ be a flat $A$-module. Let $x \in M$.
The content ideal of $x$, if it exists, is finitely generated.
\end{lemma}

\begin{proof}
Say $x \in IM$. Then we can write $x = \sum_{i = 1, \ldots, n} f_i x_i$ with
$f_i \in I$ and $x_i \in M$. Hence $x \in I'M$ with
$I' = (f_1, \ldots, f_n)$.
\end{proof}

\begin{lemma}
\label{lemma-equal-content}
Let $(A, \mathfrak m)$ be a local ring. Let $u : M \to N$ be a map of flat
$A$-modules such that $\overline{u} : M/\mathfrak m M \to N/\mathfrak m N$
is injective. If $x \in M$ has content ideal $I$, then $u(x)$ has content
ideal $I$ as well.
\end{lemma}

\begin{proof}
It is clear that $u(x) \in IN$. If $u(x) \in I'N$, then
$u(x) \in (I' \cap I)N$, see discussion following
Definition \ref{definition-content-ideal}. Hence it suffices to
show: if $x \in I'N$ and $I' \subset I$, $I' \not =  I$, then
$u(x) \not \in I'N$. Since $I/I'$ is a nonzero finite $A$-module
(Lemma \ref{lemma-content-finitely-generated}) there is a nonzero map
$\chi : I/I' \to A/\mathfrak m$ of $A$-modules
by Nakayama's lemma (Algebra, Lemma \ref{algebra-lemma-NAK}).
Since $I$ is the content ideal of $x$ we see that
$x \not \in I''M$ where $I'' = \Ker(\chi)$.
Hence $x$ is not in the kernel of the map
$$
IM = I \otimes_A M \xrightarrow{\chi \otimes 1}
A/\mathfrak m \otimes M \cong M/\mathfrak m M
$$
Applying our hypothesis on $\overline{u}$ we conclude that
$u(x)$ does not map to zero under the map
$$
IN = I \otimes_A N \xrightarrow{\chi \otimes 1}
A/\mathfrak m \otimes N \cong N/\mathfrak m N
$$
and we conclude.
\end{proof}

\begin{lemma}
\label{lemma-content-exists-flat-Mittag-Leffler}
Let $A$ be a ring. Let $M$ be a flat Mittag-Leffler module.
Then every element of $M$ has a content ideal.
\end{lemma}

\begin{proof}
This is a special case of Algebra, Lemma \ref{algebra-lemma-flat-ML-criterion}.
\end{proof}








\section{Flatness and finiteness conditions}
\label{section-flat-finite}

\noindent
In this section we discuss some implications of the type
``flat $+$ finite type $\Rightarrow$ finite presentation''.
We will revisit this result in the chapter on flatness, see
More on Flatness, Section \ref{flat-section-introduction}.
A first result of this type was proved in
Algebra, Lemma \ref{algebra-lemma-finite-flat-module-finitely-presented}.

\begin{lemma}
\label{lemma-flat-finite-type-finite-presentation-local-module}
Let $R$ be a ring. Let $S = R[x_1, \ldots, x_n]$ be a polynomial
ring over $R$. Let $M$ be an $S$-module.
Assume
\begin{enumerate}
\item there exist finitely many primes $\mathfrak p_1, \ldots, \mathfrak p_m$
of $R$ such that the map $R \to \prod R_{\mathfrak p_j}$ is injective,
\item $M$ is a finite $S$-module,
\item $M$ flat over $R$, and
\item for every prime $\mathfrak p$ of $R$ the module $M_{\mathfrak p}$
is of finite presentation over $S_{\mathfrak p}$.
\end{enumerate}
Then $M$ is of finite presentation over $S$.
\end{lemma}

\begin{proof}
Choose a presentation
$$
0 \to K \to S^{\oplus r} \to M \to 0
$$
of $M$ as an $S$-module. Let $\mathfrak q$ be a prime ideal of $S$
lying over a prime $\mathfrak p$ of $R$. By assumption there exist
finitely many elements $k_1, \ldots, k_t \in K$ such that if we set
$K' = \sum Sk_j \subset K$ then
$K'_{\mathfrak p} = K_{\mathfrak p}$ and
$K'_{\mathfrak p_j} = K_{\mathfrak p_j}$ for $j = 1, \ldots, m$.
Setting $M' = S^{\oplus r}/K'$ we deduce that in particular
$M'_{\mathfrak q} = M_{\mathfrak q}$. By openness of flatness, see
Algebra, Theorem \ref{algebra-theorem-openness-flatness}
we conclude that there exists a $g \in S$, $g \not \in \mathfrak q$
such that $M'_g$ is flat over $R$. Thus $M'_g \to M_g$ is a surjective
map of flat $R$-modules. Consider the commutative diagram
$$
\xymatrix{
M'_g \ar[r] \ar[d] & M_g \ar[d] \\
\prod (M'_g)_{\mathfrak p_j} \ar[r] & \prod (M_g)_{\mathfrak p_j}
}
$$
The bottom arrow is an isomorphism by choice of $k_1, \ldots, k_t$.
The left vertical arrow is an injective map as
$R \to \prod R_{\mathfrak p_j}$ is injective and $M'_g$ is flat over $R$.
Hence the top horizontal arrow is injective, hence an isomorphism.
This proves that $M_g$ is of finite presentation over $S_g$.
We conclude by applying
Algebra, Lemma \ref{algebra-lemma-cover}.
\end{proof}

\begin{lemma}
\label{lemma-flat-finite-type-finite-presentation-local}
Let $R \to S$ be a ring homomorphism.
Assume
\begin{enumerate}
\item there exist finitely many primes
$\mathfrak p_1, \ldots, \mathfrak p_m$ of $R$ such that
the map $R \to \prod R_{\mathfrak p_j}$ is injective,
\item $R \to S$ is of finite type,
\item $S$ flat over $R$, and
\item for every prime $\mathfrak p$ of $R$ the ring $S_{\mathfrak p}$
is of finite presentation over $R_{\mathfrak p}$.
\end{enumerate}
Then $S$ is of finite presentation over $R$.
\end{lemma}

\begin{proof}
By assumption $S$ is a quotient of a polynomial ring over $R$.
Thus the result follows directly from
Lemma \ref{lemma-flat-finite-type-finite-presentation-local-module}.
\end{proof}

\begin{lemma}
\label{lemma-flat-graded-finite-type-finite-presentation-module}
Let $R$ be a ring.
Let $S = R[x_1, \ldots, x_n]$ be a graded polynomial algebra over $R$,
i.e., $\deg(x_i) > 0$ but not necessarily equal to $1$.
Let $M$ be a graded $S$-module.
Assume
\begin{enumerate}
\item $R$ is a local ring,
\item $M$ is a finite $S$-module, and
\item $M$ is flat over $R$.
\end{enumerate}
Then $M$ is finitely presented as an $S$-module.
\end{lemma}

\begin{proof}
Let $M = \bigoplus M_d$ be the grading on $M$.
Pick homogeneous generators $m_1, \ldots, m_r \in M$ of $M$.
Say $\deg(m_i) = d_i \in \mathbf{Z}$. This gives us a presentation
$$
0 \to K \to \bigoplus\nolimits_{i = 1, \ldots, r} S(-d_i) \to M \to 0
$$
which in each degree $d$ leads to the short exact sequence
$$
0 \to K_d \to \bigoplus\nolimits_{i = 1, \ldots, r} S_{d - d_i} \to
M_d \to 0.
$$
By assumption each $M_d$ is a finite flat $R$-module. By
Algebra, Lemma \ref{algebra-lemma-finite-flat-local}
this implies each $M_d$ is a finite free $R$-module. Hence
we see each $K_d$ is a finite $R$-module. Also each $K_d$ is flat
over $R$ by
Algebra, Lemma \ref{algebra-lemma-flat-ses}.
Hence we conclude that each $K_d$ is finite free by
Algebra, Lemma \ref{algebra-lemma-finite-flat-local}
again.

\medskip\noindent
Let $\mathfrak m$ be the maximal ideal of $R$. By the flatness of $M$
over $R$ the short exact sequences above remain short exact after tensoring
with $\kappa = \kappa(\mathfrak m)$. As the ring $S \otimes_R \kappa$ is
Noetherian we see that there exist homogeneous elements
$k_1, \ldots, k_t \in K$ such that the images $\overline{k}_j$
generate $K \otimes_R \kappa$ over $S \otimes_R \kappa$. Say $\deg(k_j) = e_j$.
Thus for any $d$ the map
$$
\bigoplus\nolimits_{j = 1, \ldots, t} S_{d - e_j}
\longrightarrow
K_d
$$
becomes surjective after tensoring with $\kappa$. By
Nakayama's lemma
(Algebra, Lemma \ref{algebra-lemma-NAK})
this implies the map is surjective over $R$. Hence $K$ is generated
by $k_1, \ldots, k_t$ over $S$ and we win.
\end{proof}

\begin{lemma}
\label{lemma-flat-graded-finite-type-finite-presentation}
Let $R$ be a ring. Let $S = \bigoplus_{n \geq 0} S_n$ be a graded $R$-algebra.
Let $M = \bigoplus_{d \in \mathbf{Z}} M_d$ be a graded $S$-module.
Assume $S$ is finitely generated as an $R$-algebra, assume $S_0$ is a finite
$R$-algebra, and assume there exist finitely many primes
$\mathfrak p_j$, $i = 1, \ldots, m$ such that
$R \to \prod R_{\mathfrak p_j}$ is injective.
\begin{enumerate}
\item If $S$ is flat over $R$, then $S$ is a finitely presented $R$-algebra.
\item If $M$ is flat as an $R$-module and finite as an $S$-module,
then $M$ is finitely presented as an $S$-module.
\end{enumerate}
\end{lemma}

\begin{proof}
As $S$ is finitely generated as an $R$-algebra, it is finitely generated
as an $S_0$ algebra, say by homogeneous elements $t_1, \ldots, t_n \in S$
of degrees $d_1, \ldots, d_n > 0$. Set $P = R[x_1, \ldots, x_n]$ with
$\deg(x_i) = d_i$. The ring map $P \to S$, $x_i \to t_i$ is finite
as $S_0$ is a finite $R$-module. To prove (1) it suffices to prove
that $S$ is a finitely presented $P$-module.  To prove (2) it suffices
to prove that $M$ is a finitely presented $P$-module. Thus it suffices
to prove that if $S = P$ is a graded polynomial ring and $M$ is a finite
$S$-module flat over $R$, then $M$ is finitely presented as an $S$-module. By
Lemma \ref{lemma-flat-graded-finite-type-finite-presentation-module}
we see $M_{\mathfrak p}$ is a finitely presented $S_{\mathfrak p}$-module
for every prime $\mathfrak p$ of $R$. Thus the result follows from
Lemma \ref{lemma-flat-finite-type-finite-presentation-local-module}.
\end{proof}

\begin{remark}
\label{remark-when-does-condition-hold}
Let $R$ be a ring. When does $R$ satisfy the condition mentioned in
Lemmas \ref{lemma-flat-finite-type-finite-presentation-local-module},
\ref{lemma-flat-finite-type-finite-presentation-local}, and
\ref{lemma-flat-graded-finite-type-finite-presentation}?
This holds if
\begin{enumerate}
\item $R$ is local,
\item $R$ is Noetherian,
\item $R$ is a domain,
\item $R$ is a reduced ring with finitely many minimal primes, or
\item $R$ has finitely many weakly associated primes, see
Algebra, Lemma \ref{algebra-lemma-zero-at-weakly-ass-zero}.
\end{enumerate}
Thus these lemmas hold in all cases listed above.
\end{remark}

\noindent
The following lemma will be improved on in
More on Flatness, Proposition
\ref{flat-proposition-flat-finite-type-finite-presentation-domain}.

\begin{lemma}
\label{lemma-flat-finite-type-valuation-ring-finite-presentation}
\begin{reference}
\cite[Theorem 3]{Nagata-Finitely}
\end{reference}
Let $A$ be a valuation ring. Let $A \to B$ be a ring map of finite type.
Let $M$ be a finite $B$-module.
\begin{enumerate}
\item If $B$ is flat over $A$, then $B$ is a finitely presented $A$-algebra.
\item If $M$ is flat as an $A$-module, then $M$ is finitely presented
as a $B$-module.
\end{enumerate}
\end{lemma}

\begin{proof}
We are going to use that an $A$-module is flat if and only if it is
torsion free, see
Lemma \ref{lemma-valuation-ring-torsion-free-flat}.
By
Algebra, Lemma \ref{algebra-lemma-homogenize}
we can find a graded $A$-algebra $S$ with $S_0 = A$ and generated
by finitely many elements in degree $1$, an element $f \in S_1$ and a
finite graded $S$-module $N$ such that $B \cong S_{(f)}$ and
$M \cong N_{(f)}$. If $M$ is torsion free, then we can take $N$ torsion
free by replacing it by $N/N_{tors}$, see
Lemma \ref{lemma-torsion}.
Similarly, if $B$ is torsion free, then we can take
$S$ torsion free by replacing it by $S/S_{tors}$.
Hence in case (1), we may apply
Lemma \ref{lemma-flat-graded-finite-type-finite-presentation}
to see that $S$ is a finitely presented
$A$-algebra, which implies that $B = S_{(f)}$ is a finitely
presented $A$-algebra. To see (2) we may first replace $S$ by
a graded polynomial ring, and then we may apply
Lemma \ref{lemma-flat-graded-finite-type-finite-presentation-module}
to conclude.
\end{proof}

\begin{lemma}
\label{lemma-valuation-ring-flat-essentially-finite-type}
Let $A$ be a valuation ring. Let $A \to B$ be a local homomorphism
which is essentially of finite type. Let $M$ be a finite $B$-module.
\begin{enumerate}
\item If $B$ is flat over $A$, then $B$ is essentially of finite
presentation over $A$.
\item If $M$ is flat as an $A$-module, then $M$ is finitely presented
as a $B$-module.
\end{enumerate}
\end{lemma}

\begin{proof}
By assumption we can write $B$ as a quotient of the localization of
a polynomial algebra $P = A[x_1, \ldots, x_n]$ at a prime ideal $\mathfrak q$.
In case (1) we consider $M = B$ as a finite module over
$P_\mathfrak q$ and in case (2) we consider $M$ as a finite module over
$P_\mathfrak q$. In both cases, we have to show that this is a
finitely presented $P_\mathfrak q$-module, see
Algebra, Lemma \ref{algebra-lemma-finitely-presented-over-subring}
for case (2).

\medskip\noindent
Choose a presentation $0 \to K \to P_\mathfrak q^{\oplus r} \to M \to 0$
which is possible because $M$ is finite over $P_\mathfrak q$.
Let $L = P^{\oplus r} \cap K$. Then $K = L_\mathfrak q$, see
Algebra, Lemma \ref{algebra-lemma-submodule-localization}.
Then $N = P^{\oplus r}/L$ is a submodule of $M$ and hence flat by
Lemma \ref{lemma-valuation-ring-torsion-free-flat}.
Since also $N$ is a finite $P$-module, we see that $N$ is finitely
presented as a $P$-module by
Lemma \ref{lemma-flat-finite-type-valuation-ring-finite-presentation}.
Since localization is exact
(Algebra, Proposition \ref{algebra-proposition-localization-exact})
we see that $N_\mathfrak q = M$ and we conclude.
\end{proof}











\section{Blowing up and flatness}
\label{section-blowup-flat}

\noindent
In this section we begin our discussion of results of the form: ``After a
blowup the strict transform becomes flat''. More results of this type may
be found in Divisors, Section \ref{divisors-section-blowup-flat} and
More on Flatness, Section \ref{flat-section-blowup-flat}.

\begin{definition}
\label{definition-strict-transform}
Let $R$ be a ring. Let $I \subset R$ be an ideal and $a \in I$.
Let $R[\frac{I}{a}]$ be the affine blowup algebra, see
Algebra, Definition \ref{algebra-definition-blow-up}.
Let $M$ be an $R$-module.
The {\it strict transform of $M$ along $R \to R[\frac{I}{a}]$} is
the $R[\frac{I}{a}]$-module
$$
M' = \left(M \otimes_R R[\textstyle{\frac{I}{a}}]\right)/a\text{-power torsion}
$$
\end{definition}

\noindent
The following is a very weak version of flattening by blowing up, but
it is already sometimes a useful result.

\begin{lemma}
\label{lemma-flatten-on-affine-blowup}
Let $(R, \mathfrak m)$ be a local domain with fraction field $K$.
Let $S$ be a finite type $R$-algebra.
Let $M$ be a finite $S$-module.
For every valuation ring $A \subset K$ dominating $R$
there exists an ideal $I \subset \mathfrak m$ and a nonzero
element $a \in I$ such that
\begin{enumerate}
\item $I$ is finitely generated,
\item $A$ has center on $R[\frac{I}{a}]$,
\item the fibre ring of $R \to R[\frac{I}{a}]$ at $\mathfrak m$
is not zero, and
\item the strict transform $S_{I, a}$ of $S$ along $R \to R[\frac{I}{a}]$
is flat and of finite presentation over $R$, and the strict transform
$M_{I, a}$ of $M$ along $R \to R[\frac{I}{a}]$ is flat over $R$ and
finitely presented over $S_{I, a}$.
\end{enumerate}
\end{lemma}

\begin{proof}
Write $S = R[x_1, \ldots, x_n]/J$ and denote $N = S \oplus M$
viewed as a module over $P = R[x_1, \ldots, x_n]$. If we can prove the
lemma in case $S$ is a polynomial algebra over $R$, then we can
find $I, a$ satisfying (1), (2), (3) such that the strict transform
$N_{I, a}$ of $N$ along $R \to R[\frac{I}{a}]$ is flat over
$R$ and finitely presented as a module over the strict transform $P_{I, a}]$
of $P$. Since $P_{I, a} = R[\frac{I}{a}][x_1, \ldots, x_n]$
(small detail omitted)
we find that the summand $S_{I, a} \subset N_{I, a}$ is flat over $R$
and finitely presented as a module over $R[\frac{I}{a}][x_1, \ldots, x_n]$.
Hence $S_{I, a}$ is finitely presented as an $R[\frac{I}{a}]$-algebra.
Moreover, the summand $M_{I, a} \subset N_{I, a}$ is flat over $R$
and finitely presented as a module over $P_{I, a}$ hence also
finitely presented as a module over $S_{I, a}$, see
Algebra, Lemma \ref{algebra-lemma-finitely-presented-over-subring}.
This reduces us to the case discussed in the next paragraph.

\medskip\noindent
Assume $S = R[x_1, \ldots, x_n]$. Choose a presentation
$$
0 \to K \to S^{\oplus r} \to M \to 0.
$$
Let $M_A$ be the quotient of $M \otimes_R A$ by its torsion submodule, see
Lemma \ref{lemma-torsion}. Then $M_A$ is a finite module over
$S_A = A[x_1, \ldots, x_n]$. By
Lemma \ref{lemma-valuation-ring-torsion-free-flat}
we see that $M_A$ is flat over $A$. By
Lemma \ref{lemma-flat-finite-type-valuation-ring-finite-presentation}
we see that $M_A$ is finitely presented. Hence there exist finitely many
elements $k_1, \ldots, k_t \in S_A^{\oplus r}$ which generate the
kernel of the presentation $S_A^{\oplus r} \to M_A$ as
an $S_A$-module. For any choice of $a \in I \subset \mathfrak m$
satisfying (1), (2), and (3) we denote $M_{I, a}$ the strict transform of
$M$ along $R \to R[\frac{I}{a}]$. It is a finite module over
$S_{I, a} = R[\frac{I}{a}][x_1, \ldots, x_n]$. By
Algebra, Lemma \ref{algebra-lemma-valuation-ring-colimit-affine-blowups}
we have $A = \colim_{I, a} R[\frac{I}{a}]$.
This implies that $S_A = \colim S_{I, a}$ and
$$
\colim M \otimes_R R[\textstyle{\frac{I}{a}}] = M \otimes_R A
$$
Choose $I, a$ and lifts $k_1, \ldots, k_t \in S_{I, a}^{\oplus r}$.
Since $M_A$ is the quotient of $M \otimes_R A$
by torsion, we see that the images of $k_1, \ldots, k_t$ in $M \otimes_R A$
are annihilated by a nonzero element $\alpha \in A$.
After replacing $I, a$ by a different pair
(recall that the colimit is filtered),
we may assume $\alpha = x/a^n$ for some $x \in I^n$ nonzero.
Then we find that $x k_1, \ldots, x k_t$ map to zero in $M \otimes_R A$.
Hence after replacing $I, a$ by a different pair
we may assume $x k_1, \ldots, x k_t$ map to zero in
$M \otimes_R R[\frac{I}{a}]$ for some nonzero $x \in R$.
Then finally replacing $I, a$ by $xI, xa$ we find that we may assume
$k_1, \ldots, k_t$ map to $a$-power torsion elements of
$M \otimes_R R[\frac{I}{a}]$. For any such pair $(I, a)$ we set
$$
M'_{I, a} = S_{I, a}^{\oplus r}/ \sum S_{I, a}k_j.
$$
Since $M_A = S_A^{\oplus r}/ \sum S_Ak_j$ we see that
$M_A = \colim_{I, a} M'_{I, a}$. At this point we finally apply
Algebra, Lemma \ref{algebra-lemma-flat-finite-presentation-limit-flat} (3)
to conclude that $M'_{I, a}$ is flat for some pair $(I, a)$ as above.
This lemma does not apply a priori to the system of strict transforms
$$
M_{I, a} = (M \otimes_R R[\textstyle{\frac{I}{a}}])/a\text{-power torsion}
$$
as the transition maps may not satisfy the assumptions of the lemma.
But now, since flatness implies torsion free
(Lemma \ref{lemma-flat-torsion-free}) and since $M_{I, a}$
is the quotient of $M'_{I, a}$ (because we arranged it so the
elements $k_1, \ldots, k_t$ map to zero in $M_{I, a}$)
by the $a$-power torsion submodule
we also conclude that $M'_{I, a} = M_{I, a}$ for such a pair and we win.
\end{proof}

\begin{lemma}
\label{lemma-blowup-fitting-ideal}
Let $R$ be a ring. Let $M$ be a finite $R$-module.
Let $k \geq 0$ and $I = \text{Fit}_k(M)$. For every $a \in I$
with $R' = R[\frac{I}{a}]$ the strict transform
$$
M' = (M \otimes_R R')/a\text{-power torsion}
$$
has $\text{Fit}_k(M') = R'$.
\end{lemma}

\begin{proof}
First observe that $\text{Fit}_k(M \otimes_R R') = IR' = aR'$.
The first equality by Lemma \ref{lemma-fitting-ideal-basics} part (3)
and the second equality by
Algebra, Lemma \ref{algebra-lemma-affine-blowup}.
From Lemma \ref{lemma-principal-fitting-ideal}
and exactness of localization
we see that $M'_{\mathfrak p'}$
can be generated by $\leq k$ elements for every prime $\mathfrak p'$
of $R'$. Then $\text{Fit}_k(M') = R'$ for example by
Lemma \ref{lemma-fitting-ideal-generate-locally}.
\end{proof}

\begin{lemma}
\label{lemma-blowup-fitting-ideal-locally-free}
Let $R$ be a ring. Let $M$ be a finite $R$-module.
Let $k \geq 0$ and $I = \text{Fit}_k(M)$. Asssume that
$M_\mathfrak p$ is free of rank $k$ for every
$\mathfrak p \not \in V(I)$. Then for every $a \in I$
with $R' = R[\frac{I}{a}]$ the strict transform
$$
M' = (M \otimes_R R')/a\text{-power torsion}
$$
is locally free of rank $k$.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-blowup-fitting-ideal} we have
$\text{Fit}_k(M') = R'$. By Lemma \ref{lemma-fitting-ideal-finite-locally-free}
it suffices to show that $\text{Fit}_{k - 1}(M') = 0$.
Recall that $R' \subset R'_a = R_a$, see
Algebra, Lemma \ref{algebra-lemma-affine-blowup}.
Hence it suffices to prove that $\text{Fit}_{k - 1}(M')$
maps to zero in $R'_a = R_a$.
Since clearly $(M')_a = M_a$ this reduces us to showing
that $\text{Fit}_{k - 1}(M_a) = 0$
because formation of Fitting ideals commutes with base
change according to Lemma \ref{lemma-fitting-ideal-basics} part (3).
This is true by our assumption that
$M_a$ is finite locally free of rank $k$
(see Algebra, Lemma \ref{algebra-lemma-finite-projective})
and the already cited Lemma \ref{lemma-fitting-ideal-finite-locally-free}.
\end{proof}

\begin{lemma}
\label{lemma-blowup-module}
Let $R$ be a ring. Let $M$ be a finite $R$-module. Let $f \in R$
be an element such that $M_f$ is finite locally free of rank $r$.
Then there exists a finitely generated ideal $I \subset R$ with
$V(f) = V(I)$ such that for all $a \in I$ with $R' = R[\frac{I}{a}]$
the strict transform
$$
M' = (M \otimes_R R')/a\text{-power torsion}
$$
is locally free of rank $r$.
\end{lemma}

\begin{proof}
Choose a surjection $R^{\oplus n} \to M$. Choose a finite submodule
$K \subset \Ker(R^{\oplus n} \to M)$ such that $R^{\oplus n}/K \to M$
becomes an isomorphism after inverting $f$. This is possible because
$M_f$ is of finite presentation for example by
Algebra, Lemma \ref{algebra-lemma-finite-projective}.
Set $M_1 = R^{\oplus n}/K$
and suppose we can prove the lemma for $M_1$. Say $I \subset R$ is the
corresponding ideal. Then for $a \in I$ the map
$$
M_1' = (M_1 \otimes_R R')/a\text{-power torsion}
\longrightarrow
M' = (M \otimes_R R')/a\text{-power torsion}
$$
is surjective. It is also an isomorphism after inverting $a$ in $R'$
as $R'_a = R_f$, see Algebra, Lemma \ref{algebra-lemma-blowup-in-principal}.
But $a$ is a nonzerodivisor on $M'_1$, whence the displayed map is an
isomorphism. Thus it suffices to prove the lemma in case $M$ is a finitely
presented $R$-module.

\medskip\noindent
Assume $M$ is a finitely presented $R$-module.
Then $J = \text{Fit}_r(M) \subset S$ is a finitely generated ideal.
We claim that $I = fJ$ works.

\medskip\noindent
We first check that $V(f) = V(I)$. The inclusion $V(f) \subset V(I)$ is
clear. Conversely, if $f \not \in \mathfrak p$, then
$\mathfrak p$ is not an element of $V(J)$ by 
Lemma \ref{lemma-fitting-ideal-generate-locally}.
Thus $\mathfrak p \not \in V(fJ) = V(I)$.

\medskip\noindent
Let $a \in I$ and set $R' = R[\frac{I}{a}]$. We may write $a = fb$
for some $b \in J$. By Algebra, Lemmas \ref{algebra-lemma-affine-blowup} and
\ref{algebra-lemma-blowup-add-principal} we see that $J R' = b R'$
and $b$ is a nonzerodivisor in $R'$. 
Let $\mathfrak p' \subset R' = R[\frac{I}{a}]$ be
a prime ideal. Then $JR'_{\mathfrak p'}$ is generated by $b$.
It follows from
Lemma \ref{lemma-principal-fitting-ideal}
that $M'_{\mathfrak p'}$ can be generated by $r$ elements.
Since $M'$ is finite, there exist $m_1, \ldots, m_r \in M'$ and
$g \in R'$, $g \not \in \mathfrak p'$ such that the corresponding map
$(R')^{\oplus r} \to M'$ becomes surjective after inverting $g$.

\medskip\noindent
Finally, consider the ideal $J' = \text{Fit}_{k - 1}(M')$.
Note that $J' R'_g$ is generated by the coefficients of relations between
$m_1, \ldots, m_r$ (compatibility of Fitting ideal with base change).
Thus it suffices to show that $J' = 0$, see
Lemma \ref{lemma-fitting-ideal-finite-locally-free}.
Since $R'_a = R_f$ (Algebra, Lemma \ref{algebra-lemma-blowup-in-principal})
and $M'_a = M_f$ is free of rank $r$ we see that $J'_a = 0$.
Since $a$ is a nonzerodivisor in $R'$ we
conclude that $J' = 0$ and we win.
\end{proof}












\section{Completion and flatness}
\label{section-completion-flat}

\noindent
In this section we discuss when the completion of a ``big'' flat module
is flat.

\begin{lemma}
\label{lemma-ui-completion-direct-sum-into-product}
Let $R$ be a ring.
Let $I \subset R$ be an ideal.
Let $A$ be a set.
Assume $R$ is Noetherian and complete with respect to $I$. There is a
canonical map
$$
\left(\bigoplus\nolimits_{\alpha \in A} R\right)^\wedge
\longrightarrow
\prod\nolimits_{\alpha \in A} R
$$
from the $I$-adic completion of the direct sum into the product
which is universally injective.
\end{lemma}

\begin{proof}
By definition an element $x$ of the left hand side is $x = (x_n)$ where
$x_n = (x_{n, \alpha}) \in \bigoplus\nolimits_{\alpha \in A} R/I^n$
such that $x_{n, \alpha} = x_{n + 1, \alpha} \bmod I^n$.
As $R = R^\wedge$ we see that for any $\alpha$ there exists a $y_\alpha \in R$
such that $x_{n, \alpha} = y_\alpha \bmod I^n$. Note that for each $n$ there
are only finitely many $\alpha$ such that the elements $x_{n, \alpha}$ are
nonzero. Conversely, given $(y_\alpha) \in \prod_\alpha R$ such that for each
$n$ there are only finitely many $\alpha$ such that $y_{\alpha} \bmod I^n$
is nonzero, then this defines an element of the left hand side.
Hence we can think of an element of the left hand side as infinite
``convergent sums'' $\sum_\alpha y_\alpha$ with $y_\alpha \in R$
such that for each $n$ there are only finitely many $y_\alpha$
which are nonzero modulo $I^n$. The displayed map maps this element
to the element to $(y_\alpha)$ in the product.
In particular the map is injective.

\medskip\noindent
Let $Q$ be a finite $R$-module. We have to show that the map
$$
Q \otimes_R \left(\bigoplus\nolimits_{\alpha \in A} R\right)^\wedge
\longrightarrow
Q \otimes_R \left(\prod\nolimits_{\alpha \in A} R\right)
$$
is injective, see
Algebra, Theorem \ref{algebra-theorem-universally-exact-criteria}.
Choose a presentation $R^{\oplus k} \to R^{\oplus m} \to Q \to 0$
and denote $q_1, \ldots, q_m \in Q$ the corresponding generators for $Q$.
By Artin-Rees
(Algebra, Lemma \ref{algebra-lemma-Artin-Rees})
there exists a constant $c$ such that
$\Im(R^{\oplus k} \to R^{\oplus m}) \cap (I^N)^{\oplus m}
\subset \Im((I^{N - c})^{\oplus k} \to R^{\oplus m})$.
Let us contemplate the diagram
$$
\xymatrix{
\bigoplus_{l = 1}^k \left(\bigoplus\nolimits_{\alpha \in A} R\right)^\wedge
\ar[r] \ar[d] &
\bigoplus_{j = 1}^m \left(\bigoplus\nolimits_{\alpha \in A} R\right)^\wedge
\ar[r] \ar[d] &
Q \otimes_R \left(\bigoplus\nolimits_{\alpha \in A} R\right)^\wedge
\ar[r] \ar[d] &
0 \\
\bigoplus_{l = 1}^k \left(\prod\nolimits_{\alpha \in A} R\right)
\ar[r] &
\bigoplus_{j = 1}^m \left(\prod\nolimits_{\alpha \in A} R\right)
\ar[r] &
Q \otimes_R \left(\prod\nolimits_{\alpha \in A} R\right)
\ar[r] &
0
}
$$
with exact rows. Pick an element $\sum_j \sum_\alpha y_{j, \alpha}$ of
$\bigoplus_{j = 1, \ldots, m}
\left(\bigoplus\nolimits_{\alpha \in A} R\right)^\wedge$.
If this element maps to zero in the module
$Q \otimes_R \left(\prod\nolimits_{\alpha \in A} R\right)$,
then we see in particular that
$\sum_j q_j \otimes y_{j, \alpha} = 0$ in $Q$ for each $\alpha$.
Thus we can find an element
$(z_{1, \alpha}, \ldots, z_{k, \alpha}) \in \bigoplus_{l = 1, \ldots, k} R$
which maps to
$(y_{1, \alpha}, \ldots, y_{m, \alpha}) \in \bigoplus_{j = 1, \ldots, m} R$.
Moreover, if $y_{j, \alpha} \in I^{N_\alpha}$ for $j = 1, \ldots, m$, then
we may assume that $z_{l, \alpha} \in I^{N_\alpha - c}$ for
$l = 1, \ldots, k$.
Hence the sum $\sum_l \sum_\alpha z_{l, \alpha}$ is ``convergent'' and
defines an element of
$\bigoplus_{l = 1, \ldots, k}
\left(\bigoplus\nolimits_{\alpha \in A} R\right)^\wedge$
which maps to the element $\sum_j \sum_\alpha y_{j, \alpha}$ we started
out with. Thus the right vertical arrow is injective and we win.
\end{proof}

\noindent
The following lemma can also be deduced from
Lemma \ref{lemma-limit-flat} below.

\begin{lemma}
\label{lemma-completed-direct-sum-flat}
Let $R$ be a ring. Let $I \subset R$ be an ideal. Let $A$ be a set.
Assume $R$ is Noetherian. The completion
$(\bigoplus\nolimits_{\alpha \in A} R)^\wedge$
is a flat $R$-module.
\end{lemma}

\begin{proof}
Denote $R^\wedge$ the completion of $R$ with respect to $I$. As
$R \to R^\wedge$ is flat by
Algebra, Lemma \ref{algebra-lemma-completion-flat}
it suffices to prove that
$(\bigoplus\nolimits_{\alpha \in A} R)^\wedge$ is a flat
$R^\wedge$-module (use
Algebra, Lemma \ref{algebra-lemma-composition-flat}).
Since
$$
(\bigoplus\nolimits_{\alpha \in A} R)^\wedge
=
(\bigoplus\nolimits_{\alpha \in A} R^\wedge)^\wedge
$$
we may replace $R$ by $R^\wedge$ and assume that $R$ is complete with
respect to $I$ (see
Algebra, Lemma \ref{algebra-lemma-completion-complete}).
In this case
Lemma \ref{lemma-ui-completion-direct-sum-into-product}
tells us the map
$(\bigoplus\nolimits_{\alpha \in A} R)^\wedge \to \prod_{\alpha \in A} R$
is universally injective. Thus, by
Algebra, Lemma \ref{algebra-lemma-ui-flat-domain}
it suffices to show that $\prod_{\alpha \in A} R$ is flat. By
Algebra, Proposition \ref{algebra-proposition-characterize-coherent}
(and
Algebra, Lemma \ref{algebra-lemma-Noetherian-coherent})
we see that $\prod_{\alpha \in A} R$ is flat.
\end{proof}

\begin{lemma}
\label{lemma-tor-strictly-pro-zero}
\begin{reference}
This is \cite[Lemma 9.9]{quillenhomology}; note that
the author forgot the word ``strict'' in the statement
although it was clearly intended.
\end{reference}
Let $A$ be a Noetherian ring. Let $I$ be an ideal of $A$.
Let $M$ be a finite $A$-module. For every $p > 0$ there exists a $c > 0$
such that $\text{Tor}_p^A(M, A/I^n) \to \text{Tor}_p^A(M, A/I^{n - c})$
is zero for all $n \geq c$.
\end{lemma}

\begin{proof}
Proof for $p = 1$. Choose a short exact sequence
$0 \to K \to A^{\oplus t} \to M \to 0$. Then
$\text{Tor}_1^A(M, A/I^n) = K \cap (I^n)^{\oplus t}/I^nK$.
By Artin-Rees (Algebra, Lemma \ref{algebra-lemma-Artin-Rees})
there is a constant $c \geq 0$ such that
$K \cap (I^n)^{\oplus t} \subset I^{n - c}K$ for $n \geq c$. Thus the result
for $p = 1$. For $p > 1$ we have
$\text{Tor}_p^A(M, A/I^n) = \text{Tor}^A_{p - 1}(K, A/I^n)$.
Thus the lemma follows by induction.
\end{proof}

\begin{lemma}
\label{lemma-limit-flat}
Let $A$ be a Noetherian ring. Let $I$ be an ideal of $A$. Let
$(M_n)$ be an inverse system of $A$-modules such that
\begin{enumerate}
\item $M_n$ is a flat $A/I^n$-module,
\item $M_{n + 1} \to M_n$ is surjective.
\end{enumerate}
Then $M = \lim M_n$ is a flat $A$-module and
$Q \otimes_A M = \lim Q \otimes_A M_n$ for every finite $A$-module $Q$.
\end{lemma}

\begin{proof}
We first show that $Q \otimes_A M = \lim Q \otimes_A M_n$ for every finite
$A$-module $Q$. Choose a resolution $F_2 \to F_1 \to F_0 \to Q \to 0$
by finite free $A$-modules $F_i$. Then
$$
F_2 \otimes_A M_n \to F_1 \otimes_A M_n \to F_0 \otimes_A M_n
$$
is a chain complex whose homology in degree $0$ is $Q \otimes_A M_n$
and whose homology in degree $1$ is
$$
\text{Tor}_1^A(Q, M_n) = \text{Tor}_1^A(Q, A/I^n) \otimes_{A/I^n} M_n
$$
as $M_n$ is flat over $A/I^n$. By Lemma \ref{lemma-tor-strictly-pro-zero}
we see that this system is essentially constant (with value $0$).
It follows from Homology, Lemma \ref{homology-lemma-apply-Mittag-Leffler-again}
that $\lim Q \otimes_A M_n =
\Coker(\lim F_1 \otimes_A M_n \to \lim F_0 \otimes_A M_n)$.
Since $F_i$ is finite free this equals
$\Coker(F_1 \otimes_A M \to F_0 \otimes_A M) = Q \otimes_A M$.

\medskip\noindent
Next, let $Q \to Q'$ be an injective map of finite $A$-modules.
We have to show that $Q \otimes_A M \to Q' \otimes_A M$ is injective
(Algebra, Lemma \ref{algebra-lemma-flat}). By the above we see
$$
\Ker(Q \otimes_A M \to Q' \otimes_A M) =
\Ker(\lim Q \otimes_A M_n \to \lim Q' \otimes_A M_n).
$$
For each $n$ we have an exact sequence
$$
\text{Tor}_1^A(Q', M_n) \to \text{Tor}_1^A(Q'', M_n) \to
Q \otimes_A M_n \to Q' \otimes_A M_n
$$
where $Q'' = \Coker(Q \to Q')$. Above we have seen that the
inverse systems of Tor's are essentially constant with value $0$.
It follows from
Homology, Lemma \ref{homology-lemma-apply-Mittag-Leffler-again}
that the inverse limit of the right most maps is injective.
\end{proof}

\begin{lemma}
\label{lemma-flat-after-completion}
Let $R$ be a ring. Let $I \subset R$ be an ideal. Let $M$ be
an $R$-module. Assume
\begin{enumerate}
\item $I$ is finitely generated,
\item $R/I$ is Noetherian,
\item $M/IM$ is flat over $R/I$,
\item $\text{Tor}_1^R(M, R/I) = 0$.
\end{enumerate}
Then the $I$-adic completion $R^\wedge$
is a Noetherian ring and $M^\wedge$ is flat over $R^\wedge$.
\end{lemma}

\begin{proof}
By Algebra, Lemma \ref{algebra-lemma-what-does-it-mean}
the modules $M/I^nM$ are flat over $R/I^n$ for all $n$.
By Algebra, Lemma \ref{algebra-lemma-hathat-finitely-generated} we have
(a) $R^\wedge$ and $M^\wedge$ are $I$-adically complete and
(b) $R/I^n = R^\wedge/I^nR^\wedge$ for all $n$.
By Algebra, Lemma \ref{algebra-lemma-completion-Noetherian}
the ring $R^\wedge$ is Noetherian.
Applying Lemma \ref{lemma-limit-flat} we conclude that
$M^\wedge = \lim M/I^nM$ is flat as an $R^\wedge$-module.
\end{proof}








\section{The Koszul complex}
\label{section-koszul}

\noindent
We define the Koszul complex as follows.

\begin{definition}
\label{definition-koszul}
Let $R$ be a ring. Let $\varphi : E \to R$ be an $R$-module map. The
{\it Koszul complex} $K_\bullet(\varphi)$ associated to $\varphi$
is the commutative differential graded algebra defined as follows:
\begin{enumerate}
\item the underlying graded algebra is the exterior algebra
$K_\bullet(\varphi) = \wedge(E)$,
\item the differential $d : K_\bullet(\varphi) \to K_\bullet(\varphi)$
is the unique derivation such that $d(e) = \varphi(e)$ for all
$e \in E = K_1(\varphi)$.
\end{enumerate}
\end{definition}

\noindent
Explicitly, if $e_1 \wedge \ldots \wedge e_n$ is one of the generators of
degree $n$ in $K_\bullet(\varphi)$, then
$$
d(e_1 \wedge \ldots \wedge e_n) =
\sum\nolimits_{i = 1, \ldots, n} (-1)^{i + 1}
\varphi(e_i)e_1 \wedge \ldots \wedge \widehat{e_i} \wedge \ldots \wedge e_n.
$$
It is straightforward to see that this gives a well defined derivation
on the tensor algebra, which annihilates $e \otimes e$ and hence factors
through the exterior algebra.

\medskip\noindent
We often assume that $E$ is a finite free module, say $E = R^{\oplus n}$.
In this case the map $\varphi$ is given by a sequence of elements
$f_1, \ldots, f_n \in R$.

\begin{definition}
\label{definition-koszul-complex}
Let $R$ be a ring and let $f_1, \ldots, f_r \in R$. The
{\it Koszul complex on $f_1, \ldots, f_r$} is the Koszul complex
associated to the map $(f_1, \ldots, f_r) : R^{\oplus r} \to R$.
Notation $K_\bullet(f_\bullet)$, $K_\bullet(f_1, \ldots, f_r)$,
$K_\bullet(R, f_1, \ldots, f_r)$, or $K_\bullet(R, f_\bullet)$.
\end{definition}

\noindent
Of course, if $E$ is finite locally free, then $K_\bullet(\varphi)$ is
locally on $\Spec(R)$ isomorphic to a Koszul complex
$K_\bullet(f_1, \ldots, f_r)$.
This complex has many interesting formal properties.

\begin{lemma}
\label{lemma-functorial}
Let $\varphi : E \to R$ and $\varphi' : E' \to R$ be $R$-module maps.
Let $\psi : E \to E'$ be an $R$-module map such that
$\varphi' \circ \psi = \varphi$. Then $\psi$ induces a
homomorphism of differential graded algebras
$K_\bullet(\varphi) \to K_\bullet(\varphi')$.
\end{lemma}

\begin{proof}
This is immediate from the definitions.
\end{proof}

\begin{lemma}
\label{lemma-change-basis}
Let $f_1, \ldots, f_r \in R$ be a sequence.
Let $(x_{ij})$ be an invertible $r \times r$-matrix with
coefficients in $R$. Then the complexes
$K_\bullet(f_\bullet)$ and
$$
K_\bullet(\sum x_{1j}f_j, \sum x_{2j}f_j, \ldots, \sum x_{rj}f_j)
$$
are isomorphic.
\end{lemma}

\begin{proof}
Set $g_i = \sum x_{ij}f_j$.
The matrix $(x_{ji})$ gives an isomorphism $x : R^{\oplus r} \to R^{\oplus r}$
such that $(g_1, \ldots, g_r) = (f_1, \ldots, f_r) \circ x$.
Hence this follows from the functoriality of the Koszul complex
described in
Lemma \ref{lemma-functorial}.
\end{proof}

\begin{lemma}
\label{lemma-homotopy-koszul-abstract}
Let $R$ be a ring. Let $\varphi : E \to R$ be an $R$-module map.
Let $e \in E$ with image $f = \varphi(e)$ in $R$. Then
$$
f = de + ed
$$
as endomorphisms of $K_\bullet(\varphi)$.
\end{lemma}

\begin{proof}
This is true because $d(ea) = d(e)a - ed(a) = fa - ed(a)$.
\end{proof}

\begin{lemma}
\label{lemma-homotopy-koszul}
Let $R$ be a ring. Let $f_1, \ldots, f_r \in R$ be a sequence.
Multiplication by $f_i$ on $K_\bullet(f_\bullet)$ is homotopic to
zero, and in particular the cohomology modules $H_i(K_\bullet(f_\bullet))$
are annihilated by the ideal $(f_1, \ldots, f_r)$.
\end{lemma}

\begin{proof}
Special case of
Lemma \ref{lemma-homotopy-koszul-abstract}.
\end{proof}

\noindent
In
Derived Categories, Section \ref{derived-section-cones}
we defined the cone of a morphism of cochain complexes.
The cone $C(f)_\bullet$ of a morphism of chain complexes
$f : A_\bullet \to B_\bullet$ is the complex $C(f)_\bullet$ given by
$C(f)_n = B_n \oplus A_{n - 1}$ and differential
\begin{equation}
\label{equation-differential-cone}
d_{C(f), n} =
\left(
\begin{matrix}
d_{B, n} & f_{n - 1} \\
0 & -d_{A, n - 1}
\end{matrix}
\right)
\end{equation}
It comes equipped with canonical morphisms of complexes
$i : B_\bullet \to C(f)_\bullet$ and
$p : C(f)_\bullet \to A_\bullet[-1]$
induced by the obvious maps $B_n \to C(f)_n \to A_{n - 1}$.

\begin{lemma}
\label{lemma-cone-koszul-abstract}
Let $R$ be a ring. Let $\varphi : E \to R$ be an $R$-module map.
Let $f \in R$. Set $E' = E \oplus R$ and define $\varphi' : E' \to R$
by $\varphi$ on $E$ and multiplication by $f$ on $R$.
The complex $K_\bullet(\varphi')$ is isomorphic to the
cone of the map of complexes
$$
f :
K_\bullet(\varphi)
\longrightarrow
K_\bullet(\varphi).
$$
\end{lemma}

\begin{proof}
Denote $e_0 \in E'$ the element $1 \in R \subset R \oplus E$.
By our definition of the cone above we see that
$$
C(f)_n = K_n(\varphi) \oplus K_{n - 1}(\varphi) =
\wedge^n(E) \oplus \wedge^{n - 1}(E) = \wedge^n(E')
$$
where in the last $=$ we map $(0, e_1 \wedge \ldots \wedge e_{n - 1})$
to $e_0 \wedge e_1 \wedge \ldots \wedge e_{n - 1}$ in $\wedge^n(E')$.
A computation shows that this isomorphism is compatible with
differentials. Namely, this is clear for elements of the first
summand as $\varphi'|_E = \varphi$ and $d_{C(f)}$ restricted to
the first summand is just $d_{K_\bullet(\varphi)}$.
On the other hand, if $e_1 \wedge \ldots \wedge e_{n - 1}$
is in the second summand, then
$$
d_{C(f)}(0, e_1 \wedge \ldots \wedge e_{n - 1}) =
fe_1 \wedge \ldots \wedge e_{n - 1}
- d_{K_\bullet(\varphi)}(e_1 \wedge \ldots \wedge e_{n - 1})
$$
and on the other hand
\begin{align*}
& d_{K_\bullet(\varphi')}(0, e_0 \wedge e_1 \wedge \ldots \wedge e_{n - 1}) \\
& =
\sum\nolimits_{i = 0, \ldots, n - 1}
(-1)^i \varphi'(e_i)e_0 \wedge \ldots \wedge \widehat{e_i}
\wedge \ldots \wedge e_{n - 1} \\
& =
fe_1 \wedge \ldots \wedge e_{n - 1} +
\sum\nolimits_{i = 1, \ldots, n - 1}
(-1)^i \varphi(e_i)e_0 \wedge \ldots \wedge \widehat{e_i}
\wedge \ldots \wedge e_{n - 1} \\
& =
fe_1 \wedge \ldots \wedge e_{n - 1} -
e_0 \left(\sum\nolimits_{i = 1, \ldots, n - 1}
(-1)^{i + 1} \varphi(e_i)e_1 \wedge \ldots \wedge \widehat{e_i}
\wedge \ldots \wedge e_{n - 1}\right)
\end{align*}
which is the image of the result of the previous computation.
\end{proof}

\begin{lemma}
\label{lemma-cone-koszul}
Let $R$ be a ring. Let $f_1, \ldots, f_r$ be a sequence of elements
of $R$. The complex $K_\bullet(f_1, \ldots, f_r)$ is isomorphic to the
cone of the map of complexes
$$
f_r :
K_\bullet(f_1, \ldots, f_{r - 1})
\longrightarrow
K_\bullet(f_1, \ldots, f_{r - 1}).
$$
\end{lemma}

\begin{proof}
Special case of
Lemma \ref{lemma-cone-koszul-abstract}.
\end{proof}

\begin{lemma}
\label{lemma-cone-squared}
Let $R$ be a ring. Let $A_\bullet$ be a complex of $R$-modules.
Let $f, g \in R$. Let $C(f)_\bullet$ be the cone of
$f : A_\bullet \to A_\bullet$. Define similarly $C(g)_\bullet$ and
$C(fg)_\bullet$. Then $C(fg)_\bullet$ is homotopy equivalent to the
cone of a map
$$
C(f)_\bullet[1] \longrightarrow C(g)_\bullet
$$
\end{lemma}

\begin{proof}
We first prove this if $A_\bullet$ is the complex consisting of $R$ placed
in degree $0$. In this case the complex $C(f)_\bullet$ is the
complex
$$
\ldots \to 0 \to R \xrightarrow{f} R \to 0 \to \ldots
$$
with $R$ placed in (homological) degrees $1$ and $0$. The map
of complexes we use is
$$
\xymatrix{
0 \ar[r] \ar[d] &
0 \ar[r] \ar[d] &
R \ar[r]^f \ar[d]^1 &
R \ar[r] \ar[d] & 0 \ar[d] \\
0 \ar[r] & R \ar[r]^g & R \ar[r] & 0 \ar[r] & 0
}
$$
The cone of this is the chain complex consisting of $R^{\oplus 2}$ placed in
degrees $1$ and $0$ and differential (\ref{equation-differential-cone})
$$
\left(
\begin{matrix}
g & 1 \\
0 & -f
\end{matrix}
\right) :
R^{\oplus 2} \longrightarrow R^{\oplus 2}
$$
To see this chain complex is homotopic to
$C(fg)_\bullet$, i.e., to $R \xrightarrow{fg} R$,
consider the maps of complexes
$$
\xymatrix{
R \ar[d]_{(1, -g)} \ar[r]_{fg} & R \ar[d]^{(0, 1)} \\
R^{\oplus 2} \ar[r] & R^{\oplus 2}
}
\quad\quad
\xymatrix{
R^{\oplus 2} \ar[d]_{(1, 0)} \ar[r] & R^{\oplus 2} \ar[d]^{(f, 1)} \\
R \ar[r]^{fg} & R
}
$$
with obvious notation.
The composition of these two maps in one direction is the
identity on $C(fg)_\bullet$, but in the other direction
it isn't the identity. We omit writing out the required homotopy.

\medskip\noindent
To see the result holds in general, we use that we have a functor
$K_\bullet \mapsto \text{Tot}(A_\bullet \otimes_R K_\bullet)$
on the category of complexes which is compatible with homotopies
and cones. Then we write $C(f)_\bullet$ and $C(g)_\bullet$
as the total complex of the double complexes
$$
(R \xrightarrow{f} R) \otimes_R A_\bullet
\quad\text{and}\quad
(R \xrightarrow{g} R) \otimes_R A_\bullet
$$
and in this way we deduce the result from the special case discussed above.
Some details omitted.
\end{proof}

\begin{lemma}
\label{lemma-koszul-mult-abstract}
Let $R$ be a ring. Let $\varphi : E \to R$ be an $R$-module map.
Let $f, g \in R$. Set $E' = E \oplus R$ and define
$\varphi'_f, \varphi'_g, \varphi'_{fg} : E' \to R$
by $\varphi$ on $E$ and multiplication by $f, g, fg$ on $R$.
The complex $K_\bullet(\varphi'_{fg})$ is homotopy equivalent to the
cone of a map of complexes
$$
K_\bullet(\varphi'_f)[1]
\longrightarrow
K_\bullet(\varphi'_g).
$$
\end{lemma}

\begin{proof}
By
Lemma \ref{lemma-cone-koszul-abstract}
the complex $K_\bullet(\varphi'_f)$ is isomorphic to the cone of
multiplication by $f$ on $K_\bullet(\varphi)$ and similarly
for the other two cases. Hence the lemma follows from
Lemma \ref{lemma-cone-squared}.
\end{proof}

\begin{lemma}
\label{lemma-koszul-mult}
Let $R$ be a ring. Let $f_1, \ldots, f_{r - 1}$ be a sequence of elements
of $R$. Let $f, g \in R$. The complex
$K_\bullet(f_1, \ldots, f_{r - 1}, fg)$
is homotopy equivalent to the cone of a map of complexes
$$
K_\bullet(f_1, \ldots, f_{r - 1}, f)[1]
\longrightarrow
K_\bullet(f_1, \ldots, f_{r - 1}, g)
$$
\end{lemma}

\begin{proof}
Special case of
Lemma \ref{lemma-koszul-mult-abstract}.
\end{proof}

\begin{lemma}
\label{lemma-join-sequences-koszul-complex}
Let $R$ be a ring.
Let $f_1, \ldots, f_r$, $g_1, \ldots, g_s$ be elements of $R$.
Then there is an isomorphism of Koszul complexes
$$
K_\bullet(R, f_1, \ldots, f_r, g_1, \ldots, g_s) =
\text{Tot}(K_\bullet(R, f_1, \ldots, f_r) \otimes_R
K_\bullet(R, g_1, \ldots, g_s)).
$$
\end{lemma}

\begin{proof}
Omitted. Hint: If $K_\bullet(R, f_1, \ldots, f_r)$ is generated as a
differential graded algebra by $x_1, \ldots, x_r$ with $\text{d}(x_i) = f_i$
and $K_\bullet(R, g_1, \ldots, g_s)$ is generated as a
differential graded algebra by $y_1, \ldots, y_s$ with $\text{d}(y_j) = g_j$,
then we can think of $K_\bullet(R, f_1, \ldots, f_r, g_1, \ldots, g_s)$
as the differential graded algebra generated by the sequence of elements
$x_1, \ldots, x_r, y_1, \ldots, y_s$ with $\text{d}(x_i) = f_i$
and $\text{d}(y_j) = g_j$.
\end{proof}





\section{The extended alternating {\v C}ech complex}
\label{section-alternating-cech}

\noindent
Let $R$ be a ring. Let $f_1, \ldots, f_r \in R$. The extended alternating
{\v C}ech complex of $R$ is the cochain complex
$$
R \to \bigoplus\nolimits_{i_0} R_{f_{i_0}} \to
\bigoplus\nolimits_{i_0 < i_1} R_{f_{i_0}f_{i_1}} \to
\ldots \to R_{f_1\ldots f_r}
$$
where $R$ is in degree $0$, the term $\bigoplus_{i_0} R_{f_{i_0}}$
is in degre $1$, and so on. The maps are defined as follows
\begin{enumerate}
\item The map $R \to \bigoplus\nolimits_{i_0} R_{f_{i_0}}$
is given by the canonical maps $R \to R_{f_{i_0}}$.
\item Given $1 \leq i_0 < \ldots < i_{p + 1} \leq r$ and
$0 \leq j \leq p + 1$ we have the canonical localization map
$$
R_{f_{i_0} \ldots \hat f_{i_j} \ldots f_{i_{p + 1}}} \to
R_{f_{i_0} \ldots f_{i_{p + 1}}}
$$
\item The differentials use the canonical maps of (2) with sign $(-1)^j$.
\end{enumerate}
If $M$ is any $R$-module, the extended alternating {\v C}ech complex
of $M$ is the similarly constructed cochain complex
$$
M \to \bigoplus\nolimits_{i_0} M_{f_{i_0}} \to
\bigoplus\nolimits_{i_0 < i_1} M_{f_{i_0}f_{i_1}} \to
\ldots \to M_{f_1\ldots f_r}
$$
where $M$ is in degree $0$ as before.

\begin{lemma}
\label{lemma-extended-alternating-is-complex}
The extended alternating {\v C}ech complexes defined above
are complexes of $R$-modules.
\end{lemma}

\begin{proof}
Omitted.
\end{proof}

\begin{lemma}
\label{lemma-extended-alternating-form-module}
Let $R$ be a ring. Let $f_1, \ldots, f_r \in R$. Let $M$ be an $R$-module.
The extended alternating {\v C}ech complex of $M$ is the tensor product
over $R$ of $M$ with the extended alternating {\v C}ech complex of $R$.
\end{lemma}

\begin{proof}
Omitted.
\end{proof}

\begin{lemma}
\label{lemma-extended-alternating-base-change}
Let $R$ be a ring. Let $f_1, \ldots, f_r \in R$. Let $M$ be an $R$-module.
Let $R \to S$ be a ring map, denote $g_1, \ldots, g_r \in S$ the images
of $f_1, \ldots, f_r$, and set $N = M \otimes_R S$.
The extended alternating {\v C}ech complex constructed using
$S$, $g_1, \ldots, g_r$, and $N$ is the tensor product of the
extended alternating {\v C}ech complex of $M$ with $S$ over $R$.
\end{lemma}

\begin{proof}
Omitted.
\end{proof}

\begin{lemma}
\label{lemma-extended-alternating-homotopy-zero}
Let $R$ be a ring. Let $f_1, \ldots, f_r \in R$. Let $M$ be an $R$-module.
If there exists an $i \in \{1, \ldots, r\}$ such that $f_i$ is a unit, then
the extended alternating {\v C}ech
complex of $M$ is homotopy equivalent to $0$.
\end{lemma}

\begin{proof}
We will use the following notation: a cochain $x$ of degree $p + 1$
in the extended alternating {\v C}ech complex of $M$ is
$x = (x_{i_0 \ldots i_p})$ where $x_{i_0 \ldots i_p}$ is in
$M_{f_{i_0} \ldots f_{i_p}}$. With this notation we have
$$
d(x)_{i_0 \ldots i_{p + 1}} =
\sum\nolimits_j (-1)^j x_{i_0 \ldots \hat i_j \ldots i_{p + 1}}
$$
As homotopy we use the maps
$$
h : \text{cochains of degree }p + 2 \to \text{cochains of degree }p + 1
$$
given by the rule
$$
h(x)_{i_0 \ldots i_p} = 0 \text{ if } i \in \{i_0, \ldots, i_p\}
\text{ and }
h(x)_{i_0 \ldots i_p} = 
(-1)^j x_{i_0 \ldots i_j i i_{j + 1} \ldots i_p} \text{ if not}
$$
Here $j$ is the unique index such that $i_j < i < i_{j + 1}$ in the
second case; also, since $f_i$ is a unit we have the equality
$$
M_{f_{i_0} \ldots f_{i_p}} =
M_{f_{i_0} \ldots f_{i_j} f_i f_{i_{j + 1}} \ldots f_{i_p}}
$$
which we can use to make sense of thinking of
$(-1)^j x_{i_0 \ldots i_j i i_{j + 1} \ldots i_p}$
as an element of $M_{f_{i_0} \ldots f_{i_p}}$.
We will show by a computation that $d h + h d$ equals
the negative of the identity map which finishes the proof.
To do this fix $x$ a cochain of degree $p + 1$ and let
$1 \leq i_0 < \ldots < i_p \leq r$.

\medskip\noindent
Case I: $i \in \{i_0, \ldots, i_p\}$. Say $i = i_t$. Then we have
$h(d(x))_{i_0 \ldots i_p} = 0$. On the other hand we have
$$
d(h(x))_{i_0 \ldots i_p} =
\sum (-1)^j h(x)_{i_0 \ldots \hat i_j \ldots i_p} =
(-1)^t h(x)_{i_0 \ldots \hat i \ldots i_p} =
(-1)^t (-1)^{t - 1} x_{i_0 \ldots i_p}
$$
Thus $(dh + hd)(x)_{i_0 \ldots i_p} = -x_{i_0 \ldots i_p}$ as desired.

\medskip\noindent
Case II: $i \not \in \{i_0, \ldots, i_p\}$. Let $j$ be such that
$i_j < i < i_{j + 1}$. Then we see that
\begin{align*}
h(d(x))_{i_0 \ldots i_p}
& =
(-1)^j d(x)_{i_0 \ldots i_j i i_{j + 1} \ldots i_p} \\
& =
\sum\nolimits_{j' \leq j} (-1)^{j + j'}
x_{i_0 \ldots \hat i_{j'} \ldots i_j i i_{j + 1} \ldots i_p} -
x_{i_0 \ldots i_p} \\
&
+ \sum\nolimits_{j' > j} (-1)^{j + j' + 1}
x_{i_0 \ldots i_j i i_{j + 1} \ldots \hat i_{j'} \ldots i_p}
\end{align*}
On the other hand we have
\begin{align*}
d(h(x))_{i_0 \ldots i_p}
& =
\sum\nolimits_{j'} (-1)^{j'} h(x)_{i_0 \ldots \hat i_{j'} \ldots i_p} \\
& =
\sum\nolimits_{j' \leq j} (-1)^{j' + j - 1}
x_{i_0 \ldots \hat i_{j'} \ldots i_j i i_{j + 1} \ldots i_p} \\
& +
\sum\nolimits_{j' > j} (-1)^{j' + j}
x_{i_0 \ldots i_j i i_{j + 1} \ldots \hat i_{j'} \ldots i_p}
\end{align*}
Adding these up we obtain
$(dh + hd)(x)_{i_0 \ldots i_p} = - x_{i_0 \ldots i_p}$
as desired.
\end{proof}

\begin{lemma}
\label{lemma-extended-alternating-torsion}
Let $R$ be a ring. Let $f_1, \ldots, f_r \in R$. Let $M$ be an $R$-module.
Let $H^q$ be the $q$th cohomology module of the extended alternation
{\v C}ech complex of $M$. Then
\begin{enumerate}
\item $H^q = 0$ if $q \not \in [0, r]$,
\item for $x \in H^i$ there exists an $n \geq 1$ such that $f_i^n x = 0$
for $i = 1, \ldots, r$,
\item the support of $H^q$ is contained in $V(f_1, \ldots, f_r)$,
\item if there is an $f \in (f_1, \ldots, f_r)$ which acts invertibly
on $M$, then $H^q = 0$.
\end{enumerate}
\end{lemma}

\begin{proof}
Part (1) follows from the fact that the extended alternating {\v C}ech complex
is zero in degrees $< 0$ and $> r$. To prove (2) it suffices to show that
for each $i$ there exists an $n \geq 1$ such that $f_i^n x = 0$. To see
this it suffices to show that $(H^q)_{f_i} = 0$. Since localization is
exact, $(H^q)_{f_i}$ is the $q$th cohomology module of the localization
of the extended alternating complex of $M$ at $f_i$. By
Lemma \ref{lemma-extended-alternating-base-change}
this localization is the extended alternating {\v C}ech complex
of $M_{f_i}$ over $R_{f_i}$ with respect to the images of
$f_1, \ldots, f_r$ in $R_{f_i}$. Thus
we reduce to showing that $H^q$ is zero if $f_i$ is invertible, which
follows from Lemma \ref{lemma-extended-alternating-homotopy-zero}.
Part (3) follows from the observation that $(H^q)_{f_i} = 0$
for all $i$ that we just proved. To see part (4) note that in this
case $f$ acts invertibly on $H^q$ and $H^q$ is supported on $V(f)$
by (3). This forces $H^q$ to be zero (small detail omitted).
\end{proof}

\begin{lemma}
\label{lemma-extended-alternating-Cech-is-colimit-koszul}
Let $R$ be a ring. Let $f_1, \ldots, f_r \in R$. The extended alternating
{\v C}ech complex
$$
R \to \bigoplus\nolimits_{i_0} R_{f_{i_0}} \to
\bigoplus\nolimits_{i_0 < i_1} R_{f_{i_0}f_{i_1}} \to
\ldots \to R_{f_1\ldots f_r}
$$
is a colimit of the Koszul complexes $K(R, f_1^n, \ldots, f_r^n)$; see
proof for a precise statement.
\end{lemma}

\begin{proof}
We urge the reader to prove this for themselves.
Denote $K(R, f_1^n, \ldots, f_r^n)$ the Koszul complex of
Definition \ref{definition-koszul-complex} viewed as a cochain complex
sitting in degrees $0, \ldots, r$. Thus we have
$$
K(R, f_1^n, \ldots, f_r^n) :
0 \to \wedge^r(R^{\oplus r}) \to
\wedge^{r - 1}(R^{\oplus r}) \to \ldots \to
R^{\oplus r} \to R \to 0
$$
with the term $\wedge^r(R^{\oplus r})$ sitting in degree $0$.
Let $e^n_1, \ldots, e^n_r$ be the standard basis of $R^{\oplus r}$.
Then the elements $e^n_{j_1} \wedge \ldots \wedge e^n_{j_{r - p}}$ for
$1 \leq j_1 < \ldots < j_{r - p} \leq r$ form a basis for the term in
degree $p$ of the Koszul complex. Further, observe that
$$
d(e^n_{j_1} \wedge \ldots \wedge e^n_{j_{r - p}}) =
\sum (-1)^{a + 1} f_{j_a}^n e^n_{j_1} \wedge \ldots \wedge \hat e^n_{j_a} \wedge
\ldots \wedge e^n_{j_{r - p}}
$$
by our construction of the Koszul complex in Section \ref{section-koszul}.
The transition maps of our system
$$
K(R, f_1^n, \ldots, f_r^n) \to K(R, f_1^{n + 1}, \ldots, f_r^{n + 1})
$$
are given by the rule
$$
e^n_{j_1} \wedge \ldots \wedge e^n_{j_{r - p}}
\longmapsto
f_{i_0} \ldots f_{i_{p - 1}}
e^{n + 1}_{j_1} \wedge \ldots \wedge e^{n + 1}_{j_{r - p}}
$$
where the indices $1 \leq i_0 < \ldots < i_{p - 1} \leq r$ are such that
$\{1, \ldots r\} =
\{i_0, \ldots, i_{p - 1}\} \amalg \{j_1, \ldots, j_{r - p}\}$.
We omit the short computation that shows this is compatible with differentials.
Observe that the transition maps are always $1$ in degree $0$
and equal to $f_1 \ldots f_r$ in degree $r$.

\medskip\noindent
Denote $K^p(R, f_1^n, \ldots, f_r^n)$ the term of degree $p$ in the Koszul
complex. Observe that for any $f \in R$ we have
$$
R_f = \colim (R \xrightarrow{f} R \xrightarrow{f} R \to \ldots )
$$
Hence we see that in degree $p$ we obtain
$$
\colim K^p(R, f_1^n, \ldots f_r^n) =
\bigoplus\nolimits_{1 \leq i_0 < \ldots < i_{p - 1} \leq r}
R_{f_{i_0} \ldots f_{i_{p - 1}}}
$$
Here the element $e^n_{j_1} \wedge \ldots \wedge e^n_{j_{r - p}}$
of the Koszul complex above maps in the colimit
to the element $(f_{i_0} \ldots f_{i_{p - 1}})^{-n}$ in the
summand $R_{f_{i_0} \ldots f_{i_{p - 1}}}$
where the indices are chosen such that
$\{1, \ldots r\} = \{i_0, \ldots, i_{p - 1}\}
\amalg \{j_1, \ldots, j_{r - p}\}$.
Thus the differential on this complex is given by
$$
d(1\text{ in }R_{f_{i_0} \ldots f_{i_{p - 1}}}) =
\sum\nolimits_{i \not \in \{i_0, \ldots, i_{p - 1}\}}
(-1)^{i - t}\text{ in }
R_{f_{i_0} \ldots f_{i_t} f_i f_{i_{t + 1}} \ldots f_{i_{p - 1}}}
$$
Thus if we consider the map of complexes given in degree $p$
by the map
$$
\bigoplus\nolimits_{1 \leq i_0 < \ldots < i_{p - 1} \leq r}
R_{f_{i_0} \ldots f_{i_{p - 1}}}
\longrightarrow
\bigoplus\nolimits_{1 \leq i_0 < \ldots < i_{p - 1} \leq r}
R_{f_{i_0} \ldots f_{i_{p - 1}}}
$$
determined by the rule
$$
1\text{ in }R_{f_{i_0} \ldots f_{i_{p - 1}}}
\longmapsto
(-1)^{i_0 + \ldots + i_{p - 1} + p}\text{ in }R_{f_{i_0} \ldots f_{i_{p - 1}}}
$$
then we get an isomorphism of complexes from
$\colim K(R, f_1^n, \ldots, f_r^n)$ to the
extended alternating {\v C}ech complex defined in this section.
We omit the verification that the signs work out.
\end{proof}








\section{Koszul regular sequences}
\label{section-koszul-regular}

\noindent
Please take a look at
Algebra, Sections \ref{algebra-section-regular-sequences},
\ref{algebra-section-quasi-regular}, and
\ref{algebra-section-depth}
before looking at this one.

\begin{definition}
\label{definition-koszul-regular-sequence}
Let $R$ be a ring. Let $r \geq 0$ and let $f_1, \ldots, f_r \in R$
be a sequence of elements. Let $M$ be an $R$-module.
The sequence $f_1, \ldots, f_r$ is called
\begin{enumerate}
\item {\it $M$-Koszul-regular} if
$H_i(K_\bullet(f_1, \ldots, f_r) \otimes_R M) = 0$ for
all $i \not = 0$,
\item {\it $M$-$H_1$-regular} if
$H_1(K_\bullet(f_1, \ldots, f_r) \otimes_R M) = 0$,
\item {\it Koszul-regular} if $H_i(K_\bullet(f_1, \ldots, f_r)) = 0$ for
all $i \not = 0$, and
\item {\it $H_1$-regular} if $H_1(K_\bullet(f_1, \ldots, f_r)) = 0$.
\end{enumerate}
\end{definition}

\noindent
We will see in Lemmas \ref{lemma-regular-koszul-regular},
\ref{lemma-koszul-regular-H1-regular}, and
\ref{lemma-H1-regular-quasi-regular} that for elements
$f_1, \ldots, f_r$ of a ring $R$ we have the following implications
\begin{align*}
f_1, \ldots, f_r\text{ is a regular sequence}
& \Rightarrow f_1, \ldots, f_r\text{ is a Koszul-regular sequence} \\
& \Rightarrow f_1, \ldots, f_r\text{ is an }H_1\text{-regular sequence} \\
& \Rightarrow f_1, \ldots, f_r\text{ is a quasi-regular sequence.}
\end{align*}
In general none of these implications can be reversed, but if $R$ is
a Noetherian local ring and $f_1, \ldots, f_r \in \mathfrak m_R$,
then the four conditions are all equivalent
(Lemma \ref{lemma-noetherian-finite-all-equivalent}).
If $f = f_1 \in R$ is a length $1$ sequence and $f$ is not a unit of $R$
then it is clear that the following are all equivalent
\begin{enumerate}
\item $f$ is a regular sequence of length one,
\item $f$ is a Koszul-regular sequence of length one, and
\item $f$ is a $H_1$-regular sequence of length one.
\end{enumerate}
It is also clear that these imply that $f$ is a quasi-regular sequence
of length one. But there do exist quasi-regular sequences of length $1$
which are not regular sequences. Namely, let
$$
R = k[x, y_0, y_1, \ldots]/(xy_0, xy_1 - y_0, xy_2 - y_1, \ldots)
$$
and let $f$ be the image of $x$ in $R$. Then $f$ is a zerodivisor, but
$\bigoplus_{n \geq 0} (f^n)/(f^{n + 1}) \cong k[x]$ is a polynomial ring.

\begin{lemma}
\label{lemma-regular-koszul-regular}
An $M$-regular sequence is $M$-Koszul-regular.
A regular sequence is Koszul-regular.
\end{lemma}

\begin{proof}
Let $R$ be a ring and let $M$ be an $R$-module.
It is immediate that an $M$-regular sequence of length $1$ is
$M$-Koszul-regular.
Let $f_1, \ldots, f_r$ be an $M$-regular sequence.
Then $f_1$ is a nonzerodivisor on $M$. Hence
$$
0 \to K_\bullet(f_2, \ldots, f_r) \otimes M
\xrightarrow{f_1}
K_\bullet(f_2, \ldots, f_r) \otimes M \to
K_\bullet(\overline{f}_2, \ldots, \overline{f}_r) \otimes M/f_1M \to 0
$$
is a short exact sequence of complexes where $\overline{f}_i$
is the image of $f_i$ in $R/(f_1)$. By
Lemma \ref{lemma-cone-koszul}
the complex $K_\bullet(R, f_1, \ldots, f_r)$
is isomorphic to the cone of multiplication by $f_1$
on $K_\bullet(f_2, \ldots, f_r)$. Thus
$K_\bullet(R, f_1, \ldots, f_r) \otimes M$ is isomorphic
to the cone on the first map. Hence
$K_\bullet(\overline{f}_2, \ldots, \overline{f}_r) \otimes M/f_1M$
is quasi-isomorphic to $K_\bullet(f_1, \ldots, f_r) \otimes M$.
As $\overline{f}_2, \ldots, \overline{f}_r$ is an $M/f_1M$-regular sequence
in $R/(f_1)$ the result follows from the case $r = 1$ and induction.
\end{proof}

\begin{lemma}
\label{lemma-koszul-regular-H1-regular}
A $M$-Koszul-regular sequence is $M$-$H_1$-regular.
A Koszul-regular sequence is $H_1$-regular.
\end{lemma}

\begin{proof}
This is immediate from the definition.
\end{proof}

\begin{lemma}
\label{lemma-mult-koszul-regular}
Let $f_1, \ldots, f_{r - 1} \in R$ be a sequence and $f, g \in R$.
Let $M$ be an $R$-module.
\begin{enumerate}
\item If $f_1, \ldots, f_{r - 1}, f$ and $f_1, \ldots, f_{r - 1}, g$
are $M$-$H_1$-regular then $f_1, \ldots, f_{r - 1}, fg$ is
$M$-$H_1$-regular too.
\item If $f_1, \ldots, f_{r - 1}, f$ and $f_1, \ldots, f_{r - 1}, g$
are $M$-Koszul-regular then $f_1, \ldots, f_{r - 1}, fg$ is
$M$-Koszul-regular too.
\end{enumerate}
\end{lemma}

\begin{proof}
By
Lemma \ref{lemma-koszul-mult}
we have exact sequences
$$
H_i(K_\bullet(f_1, \ldots, f_{r - 1}, f) \otimes M) \to
H_i(K_\bullet(f_1, \ldots, f_{r - 1}, fg) \otimes M) \to
H_i(K_\bullet(f_1, \ldots, f_{r - 1}, g) \otimes M)
$$
for all $i$.
\end{proof}

\begin{lemma}
\label{lemma-koszul-regular-flat-base-change}
Let $\varphi : R \to S$ be a flat ring map. Let $f_1, \ldots, f_r \in R$.
Let $M$ be an $R$-module and set $N = M \otimes_R S$.
\begin{enumerate}
\item If $f_1, \ldots, f_r$ in $R$ is an $M$-$H_1$-regular sequence, then
$\varphi(f_1), \ldots, \varphi(f_r)$ is an $N$-$H_1$-regular
sequence in $S$.
\item If $f_1, \ldots, f_r$ is an $M$-Koszul-regular sequence in $R$, then
$\varphi(f_1), \ldots, \varphi(f_r)$ is an $N$-Koszul-regular
sequence in $S$.
\end{enumerate}
\end{lemma}

\begin{proof}
This is true because
$K_\bullet(f_1, \ldots, f_r) \otimes_R S =
K_\bullet(\varphi(f_1), \ldots, \varphi(f_r))$
and therefore
$(K_\bullet(f_1, \ldots, f_r) \otimes_R M) \otimes_R S =
K_\bullet(\varphi(f_1), \ldots, \varphi(f_r)) \otimes_S N$.
\end{proof}

\begin{lemma}
\label{lemma-H1-regular-quasi-regular}
An $M$-$H_1$-regular sequence is $M$-quasi-regular.
\end{lemma}

\begin{proof}
Let $R$ be a ring and let $M$ be an $R$-module.
Let $f_1, \ldots, f_r$ be an $M$-$H_1$-regular sequence.
Denote $J = (f_1, \ldots, f_r)$. The assumption means that we have
an exact sequence
$$
\wedge^2(R^r) \otimes M \to R^{\oplus r} \otimes M \to JM \to 0
$$
where the first arrow is given by
$e_i \wedge e_j \otimes m \mapsto (f_ie_j - f_je_i) \otimes m$.
Tensoring the sequence with $R/J$ we see that
$$
JM/J^2M = (R/J)^{\oplus r} \otimes_R M = (M/JM)^{\oplus r}
$$
is a finite free module. To finish the proof we have to prove
for every $n \geq 2$ the following: if
$$
\xi = \sum\nolimits_{|I| = n, I = (i_1, \ldots, i_r)}
m_I f_1^{i_1} \ldots f_r^{i_r} \in J^{n + 1}M
$$
then $m_I \in JM$ for all $I$. In the next paragraph, we prove
$m_I \in JM$ for $I = (0, \ldots, 0, n)$ and in the last paragraph
we deduce the general case from this special case.

\medskip\noindent
Let $I = (0, \ldots, 0, n)$. Let $\xi$ be as above. We can write
$\xi = m_1 f_1 + \ldots + m_{r - 1}f_{r - 1} + m_I f_r^n$.
As we have assumed $\xi \in J^{n + 1}M$, we can also write
$\xi = \sum_{1 \leq i \leq j \leq r - 1} m_{ij}f_if_j +
\sum_{1 \leq i \leq r - 1}m'_i f_if_r^n + m'' f_r^{n + 1}$.
Then we see that
$$
\begin{matrix}
(m_1 - m_{11}f_1 - m'_1f_r^n)f_1 + \\
(m_2 - m_{12}f_1 - m_{22}f_2 - m'_2f_r^n)f_2 + \\
\ldots + \\
(m_{r - 1} - m_{1 r - 1}f_1 - \ldots - m_{r - 1 r - 1}f_{r - 1}
- m'_{r - 1}f_r^n)f_{r - 1} + \\
(m_I - m'' f_r)f_r^n = 0
\end{matrix}
$$
Since $f_1, \ldots, f_{r - 1}, f_r^n$ is $M$-$H_1$-regular by
Lemma \ref{lemma-mult-koszul-regular} we see that $m_I - m'' f_r$
is in the submodule $f_1M + \ldots + f_{r - 1}M + f_r^nM$.
Thus $m_I \in f_1M + \ldots + f_rM$.

\medskip\noindent
Let $S = R[x_1, x_2, \ldots, x_r, 1/x_r]$. The ring map $R \to S$ is faithfully
flat, hence $f_1, \ldots, f_r$ is an $M$-$H_1$-regular sequence in $S$, see
Lemma \ref{lemma-koszul-regular-flat-base-change}.
By
Lemma \ref{lemma-change-basis}
we see that
$$
g_1 = f_1 - \frac{x_1}{x_r} f_r,
\ \ldots,
\ g_{r - 1} = f_{r - 1} - \frac{x_{r - 1}}{x_r} f_r,
\ g_r = \frac{1}{x_r}f_r
$$
is an $M$-$H_1$-regular sequence in $S$. Finally, note that our element
$\xi$ can be rewritten
$$
\xi = \sum\nolimits_{|I| = n, I = (i_1, \ldots, i_r)}
m_I (g_1 + x_i g_r)^{i_1} \ldots (g_{r - 1} + x_i g_r)^{i_{r - 1}}
(x_rg_r)^{i_r}
$$
and the coefficient of $g_r^n$ in this expression is
$$
\sum m_I x_1^{i_1} \ldots x_r^{i_r}
$$
By the case discussed in the previous paragraph this sum is in
$J(M \otimes_R S)$. Since the monomials $x_1^{i_1} \ldots x_r^{i_r}$
form part of an $R$-basis of $S$ over $R$ we conclude that $m_I \in J$
for all $I$ as desired.
\end{proof}

\noindent
For nonzero finite modules over Noetherian local rings all of the types of
regular sequences introduced so far are equivalent.

\begin{lemma}
\label{lemma-noetherian-finite-all-equivalent}
Let $(R, \mathfrak m)$ be a Noetherian local ring. Let $M$ be a nonzero
finite $R$-module. Let $f_1, \ldots, f_r \in \mathfrak m$. The following
are equivalent
\begin{enumerate}
\item $f_1, \ldots, f_r$ is an $M$-regular sequence,
\item $f_1, \ldots, f_r$ is a $M$-Koszul-regular sequence,
\item $f_1, \ldots, f_r$ is an $M$-$H_1$-regular sequence,
\item $f_1, \ldots, f_r$ is an $M$-quasi-regular sequence.
\end{enumerate}
In particular the sequence $f_1, \ldots, f_r$ is a regular sequence
in $R$ if and only if it is a Koszul regular sequence, if and only if
it is a $H_1$-regular sequence, if and only if it is a quasi-regular sequence.
\end{lemma}

\begin{proof}
The implication (1) $\Rightarrow$ (2) is 
Lemma \ref{lemma-regular-koszul-regular}.
The implication (2) $\Rightarrow$ (3) is
Lemma \ref{lemma-koszul-regular-H1-regular}.
The implication (3) $\Rightarrow$ (4) is 
Lemma \ref{lemma-H1-regular-quasi-regular}.
The implication (4) $\Rightarrow$ (1) is
Algebra, Lemma \ref{algebra-lemma-quasi-regular-regular}.
\end{proof}

\begin{lemma}
\label{lemma-H1-regular-in-quotient}
Let $A$ be a ring. Let $I \subset A$ be an ideal.
Let $g_1, \ldots, g_m$ be a sequence in $A$ whose image in
$A/I$ is $H_1$-regular. Then $I \cap (g_1, \ldots, g_m) =
I(g_1, \ldots, g_m)$.
\end{lemma}

\begin{proof}
Consider the exact sequence of complexes
$$
0 \to I \otimes_A K_\bullet(A, g_1, \ldots, g_m)
\to K_\bullet(A, g_1, \ldots, g_m) \to
K_\bullet(A/I, g_1, \ldots, g_m) \to 0
$$
Since the complex on the right has $H_1 = 0$ by assumption we
see that
$$
\Coker(I^{\oplus m} \to I)
\longrightarrow
\Coker(A^{\oplus m} \to A)
$$
is injective. This is equivalent to the assertion of the lemma.
\end{proof}

\begin{lemma}
\label{lemma-conormal-sequence-H1-regular}
Let $A$ be a ring. Let $I \subset J \subset A$ be ideals.
Assume that $J/I \subset A/I$ is generated by an $H_1$-regular sequence.
Then $I \cap J^2 = IJ$.
\end{lemma}

\begin{proof}
To prove this choose $g_1, \ldots, g_m \in J$
whose images in $A/I$ form a $H_1$-regular sequence which generates $J/I$.
In particular $J = I + (g_1, \ldots, g_m)$.
Suppose that $x \in I \cap J^2$. Because $x \in J^2$ can write
$$
x =
\sum a_{ij} g_ig_j +
\sum a_j g_j +
a
$$
with $a_{ij} \in A$, $a_j \in I$ and $a \in I^2$.
Then $\sum a_{ij}g_ig_j \in I \cap (g_1, \ldots, g_m)$
hence by
Lemma \ref{lemma-H1-regular-in-quotient}
we see that $\sum a_{ij}g_ig_j \in I(g_1, \ldots, g_m)$.
Thus $x \in IJ$ as desired.
\end{proof}

\begin{lemma}
\label{lemma-join-quasi-regular-H1-regular}
Let $A$ be a ring. Let $I$ be an ideal generated by a quasi-regular
sequence $f_1, \ldots, f_n$ in $A$. Let $g_1, \ldots, g_m \in A$ be
elements whose images $\overline{g}_1, \ldots, \overline{g}_m$ form an
$H_1$-regular sequence in $A/I$. Then $f_1, \ldots, f_n, g_1, \ldots, g_m$
is a quasi-regular sequence in $A$.
\end{lemma}

\begin{proof}
We claim that $g_1, \ldots, g_m$ forms an $H_1$-regular sequence in
$A/I^d$ for every $d$. By induction assume that this holds in
$A/I^{d - 1}$. We have a short exact sequence of complexes
$$
0 \to K_\bullet(A, g_\bullet) \otimes_A I^{d - 1}/I^d
\to K_\bullet(A/I^d, g_\bullet) \to
K_\bullet(A/I^{d - 1}, g_\bullet) \to 0
$$
Since $f_1, \ldots, f_n$ is quasi-regular we see that the first complex
is a direct sum of copies of $K_\bullet(A/I, g_1, \ldots, g_m)$
hence acyclic in degree $1$. By induction hypothesis the last complex is
acyclic in degree $1$. Hence also the middle complex is.
In particular, the sequence $g_1, \ldots, g_m$ forms a quasi-regular
sequence in $A/I^d$ for every $d \geq 1$, see
Lemma \ref{lemma-H1-regular-quasi-regular}.
Now we are ready to prove that $f_1, \ldots, f_n, g_1, \ldots, g_m$
is a quasi-regular sequence in $A$.
Namely, set $J = (f_1, \ldots, f_n, g_1, \ldots, g_m)$ and suppose
that (with multinomial notation)
$$
\sum\nolimits_{|N| + |M| = d} a_{N, M} f^N g^M \in J^{d + 1}
$$
for some $a_{N, M} \in A$. We have to show that $a_{N, M} \in J$
for all $N, M$. Let $e \in \{0, 1, \ldots, d\}$. Then
$$
\sum\nolimits_{|N| = d - e, \ |M| = e} a_{N, M} f^N g^M \in
(g_1, \ldots, g_m)^{e + 1} + I^{d - e + 1}
$$
Because $g_1, \ldots, g_m$ is a quasi-regular sequence in $A/I^{d - e + 1}$
we deduce
$$
\sum\nolimits_{|N| = d - e} a_{N, M} f^N \in
(g_1, \ldots, g_m) + I^{d - e + 1}
$$
for each $M$ with $|M| = e$. By
Lemma \ref{lemma-H1-regular-in-quotient}
applied to $I^{d - e}/I^{d - e + 1}$ in the ring $A/I^{d - e + 1}$
this implies $\sum_{|N| = d - e} a_{N, M} f^N \in I^{d - e}(g_1, \ldots, g_m)$.
Since $f_1, \ldots, f_n$ is quasi-regular in $A$ this implies
that $a_{N, M} \in J$ for each $N, M$ with $|N| = d - e$ and $|M| = e$.
This proves the lemma.
\end{proof}

\begin{lemma}
\label{lemma-join-H1-regular-sequences}
Let $A$ be a ring. Let $I$ be an ideal generated by an
$H_1$-regular sequence $f_1, \ldots, f_n$ in $A$.
Let $g_1, \ldots, g_m \in A$ be elements whose images
$\overline{g}_1, \ldots, \overline{g}_m$ form an $H_1$-regular sequence
in $A/I$. Then $f_1, \ldots, f_n, g_1, \ldots, g_m$ is an $H_1$-regular
sequence in $A$.
\end{lemma}

\begin{proof}
We have to show that $H_1(A, f_1, \ldots, f_n, g_1, \ldots, g_m) = 0$.
To do this consider the commutative diagram
$$
\xymatrix{
\wedge^2(A^{\oplus n + m}) \ar[r] \ar[d] &
A^{\oplus n + m} \ar[r] \ar[d] &
A \ar[r] \ar[d] & 0 \\
\wedge^2(A/I^{\oplus m}) \ar[r] &
A/I^{\oplus m} \ar[r] &
A/I \ar[r] & 0
}
$$
Consider an element $(a_1, \ldots, a_{n + m}) \in A^{\oplus n + m}$
which maps to zero in $A$. Because $\overline{g}_1, \ldots, \overline{g}_m$
form an $H_1$-regular sequence in $A/I$ we see that
$(\overline{a}_{n + 1}, \ldots, \overline{a}_{n + m})$ is the image
of some element $\overline{\alpha}$ of $\wedge^2(A/I^{\oplus m})$.
We can lift $\overline{\alpha}$ to an element
$\alpha \in \wedge^2(A^{\oplus n + m})$ and substract the image of it
in $A^{\oplus n + m}$ from our element $(a_1, \ldots, a_{n + m})$.
Thus we may assume that $a_{n + 1}, \ldots, a_{n + m} \in I$.
Since $I = (f_1, \ldots, f_n)$ we can modify our element
$(a_1, \ldots, a_{n + m})$ by linear combinations of the elements
$$
(0, \ldots, g_j, 0, \ldots, 0, f_i, 0, \ldots, 0)
$$
in the image of the top left horizontal arrow to reduce to the case
that $a_{n + 1}, \ldots, a_{n + m}$ are zero. In this case
$(a_1, \ldots, a_n, 0, \ldots, 0)$ defines an element of
$H_1(A, f_1, \ldots, f_n)$ which we assumed to be zero.
\end{proof}

\begin{lemma}
\label{lemma-truncate-H1-regular}
Let $A$ be a ring. Let $f_1, \ldots, f_n, g_1, \ldots, g_m \in A$
be an $H_1$-regular sequence. Then the images
$\overline{g}_1, \ldots, \overline{g}_m$ in $A/(f_1, \ldots, f_n)$
form an $H_1$-regular sequence.
\end{lemma}

\begin{proof}
Set $I = (f_1, \ldots, f_n)$. We have to show that any relation
$\sum_{j = 1, \ldots, m} \overline{a}_j \overline{g}_j$ in $A/I$
is a linear combination of trivial relations. Because
$I = (f_1, \ldots, f_n)$ we can lift this relation to a relation
$$
\sum\nolimits_{j = 1, \ldots, m} a_j g_j +
\sum\nolimits_{i = 1, \ldots, n} b_if_i = 0
$$
in $A$. By assumption this relation in $A$ is a linear combination of
trivial relations. Taking the image in $A/I$ we obtain what we want.
\end{proof}

\begin{lemma}
\label{lemma-join-koszul-regular-sequences}
Let $A$ be a ring. Let $I$ be an ideal generated by a Koszul-regular
sequence $f_1, \ldots, f_n$ in $A$. Let $g_1, \ldots, g_m \in A$ be
elements whose images $\overline{g}_1, \ldots, \overline{g}_m$ form a
Koszul-regular sequence in $A/I$. Then $f_1, \ldots, f_n, g_1, \ldots, g_m$
is a Koszul-regular sequence in $A$.
\end{lemma}

\begin{proof}
Our assumptions say that $K_\bullet(A, f_1, \ldots, f_n)$ is a finite free
resolution of $A/I$ and
$K_\bullet(A/I, \overline{g}_1, \ldots, \overline{g}_m)$ is a
finite free resolution of $A/(f_i, g_j)$ over $A/I$. Then
\begin{align*}
K_\bullet(A, f_1, \ldots, f_n, g_1, \ldots, g_m)
& = \text{Tot}(K_\bullet(A, f_1, \ldots, f_n) \otimes_A
K_\bullet(A, g_1, \ldots, g_m)) \\
& \cong A/I \otimes_A K_\bullet(A, g_1, \ldots, g_m) \\
& = K_\bullet(A/I, \overline{g}_1, \ldots, \overline{g}_m) \\
& \cong A/(f_i, g_j)
\end{align*}
The first equality by
Lemma \ref{lemma-join-sequences-koszul-complex}.
The first quasi-isomorphism $\cong$ by (the dual of)
Homology, Lemma \ref{homology-lemma-double-complex-gives-resolution}
as the $q$th row of the double complex
$K_\bullet(A, f_1, \ldots, f_n) \otimes_A K_\bullet(A, g_1, \ldots, g_m)$
is a resolution of $A/I \otimes_A K_q(A, g_1, \ldots, g_m)$.
The second equality is clear. The last quasi-isomorphism by assumption.
Hence we win.
\end{proof}

\noindent
To conclude in the following lemma it is necessary to assume that both
$f_1, \ldots, f_n$ and $f_1, \ldots, f_n, g_1, \ldots, g_m$
are Koszul-regular. A counter example to dropping the assumption
that $f_1, \ldots, f_n$ is Koszul-regular is
Examples, Lemma \ref{examples-lemma-strange-regular-sequence}.

\begin{lemma}
\label{lemma-truncate-koszul-regular}
Let $A$ be a ring. Let $f_1, \ldots, f_n, g_1, \ldots, g_m \in A$.
If both $f_1, \ldots, f_n$ and $f_1, \ldots, f_n, g_1, \ldots, g_m$
are Koszul-regular sequences in $A$, then
$\overline{g}_1, \ldots, \overline{g}_m$ in $A/(f_1, \ldots, f_n)$
form a Koszul-regular sequence.
\end{lemma}

\begin{proof}
Set $I = (f_1, \ldots, f_n)$.
Our assumptions say that $K_\bullet(A, f_1, \ldots, f_n)$ is a finite free
resolution of $A/I$ and
$K_\bullet(A, f_1, \ldots, f_n, g_1, \ldots, g_m)$ is a
finite free resolution of $A/(f_i, g_j)$ over $A$. Then
\begin{align*}
A/(f_i, g_j) & \cong K_\bullet(A, f_1, \ldots, f_n, g_1, \ldots, g_m) \\
& = \text{Tot}(K_\bullet(A, f_1, \ldots, f_n) \otimes_A
K_\bullet(A, g_1, \ldots, g_m)) \\
& \cong A/I \otimes_A K_\bullet(A, g_1, \ldots, g_m) \\
& = K_\bullet(A/I, \overline{g}_1, \ldots, \overline{g}_m)
\end{align*}
The first quasi-isomorphism $\cong$ by assumption. The first equality by
Lemma \ref{lemma-join-sequences-koszul-complex}.
The second quasi-isomorphism by (the dual of)
Homology, Lemma \ref{homology-lemma-double-complex-gives-resolution}
as the $q$th row of the double complex
$K_\bullet(A, f_1, \ldots, f_n) \otimes_A K_\bullet(A, g_1, \ldots, g_m)$
is a resolution of $A/I \otimes_A K_q(A, g_1, \ldots, g_m)$.
The second equality is clear. Hence we win.
\end{proof}

\begin{lemma}
\label{lemma-independence-of-generators}
Let $R$ be a ring. Let $I$ be an ideal generated by $f_1, \ldots, f_r \in R$.
\begin{enumerate}
\item If $I$ can be generated by a quasi-regular sequence of length $r$,
then $f_1, \ldots, f_r$ is a quasi-regular sequence.
\item If $I$ can be generated by an $H_1$-regular sequence of length $r$,
then $f_1, \ldots, f_r$ is an $H_1$-regular sequence.
\item If $I$ can be generated by a Koszul-regular sequence of length $r$,
then $f_1, \ldots, f_r$ is a Koszul-regular sequence.
\end{enumerate}
\end{lemma}

\begin{proof}
If $I$ can be generated by a quasi-regular sequence of length $r$,
then $I/I^2$ is free of rank $r$ over $R/I$. Since $f_1, \ldots, f_r$
generate by assumption we see that the images $\overline{f}_i$ form a basis of
$I/I^2$ over $R/I$. It follows that $f_1, \ldots, f_r$ is a quasi-regular
sequence as all this means, besides the freeness of $I/I^2$, is that the maps
$\text{Sym}^n_{R/I}(I/I^2) \to I^n/I^{n + 1}$ are isomorphisms.

\medskip\noindent
We continue to assume that $I$ can be generated by a
quasi-regular sequence, say
$g_1, \ldots, g_r$. Write $g_j = \sum a_{ij}f_i$. As $f_1, \ldots, f_r$
is quasi-regular according to the previous paragraph, we see that
$\det(a_{ij})$ is invertible mod $I$. The matrix
$a_{ij}$ gives a map $R^{\oplus r} \to R^{\oplus r}$ which induces
a map of Koszul complexes
$\alpha : K_\bullet(R, f_1, \ldots, f_r) \to K_\bullet(R, g_1, \ldots, g_r)$,
see
Lemma \ref{lemma-functorial}.
This map becomes an isomorphism on inverting $\det(a_{ij})$.
Since the cohomology modules of both $K_\bullet(R, f_1, \ldots, f_r)$ and
$K_\bullet(R, g_1, \ldots, g_r)$ are annihilated by $I$, see
Lemma \ref{lemma-homotopy-koszul},
we see that $\alpha$ is a quasi-isomorphism.

\medskip\noindent
Now assume that $g_1, \ldots, g_r$ is a $H_1$-regular sequence generating $I$.
Then $g_1, \ldots, g_r$ is a quasi-regular sequence by
Lemma \ref{lemma-H1-regular-quasi-regular}. By the previous paragraph
we conclude that $f_1, \ldots, f_r$ is a $H_1$-regular sequence.
Similarly for Koszul-regular sequences.
\end{proof}

\begin{lemma}
\label{lemma-make-nonzero-divisor}
\begin{reference}
This is a particular case of \cite[Corollary]{McCoy}
\end{reference}
Let $R$ be a ring. Let $a_1, \ldots, a_n \in R$ be elements such
that $R \to R^{\oplus n}$, $x \mapsto (xa_1, \ldots, xa_n)$ is injective.
Then the element $\sum a_i t_i$ of the polynomial ring $R[t_1, \ldots, t_n]$
is a nonzerodivisor.
\end{lemma}

\begin{proof}
If one of the $a_i$ is a unit this is just the statement that any
element of the form $t_1 + a_2 t_2 + \ldots + a_n t_n$ is a nonzerodivisor
in the polynomial ring over $R$.

\medskip\noindent
Case I: $R$ is Noetherian. Let $\mathfrak q_j$, $j = 1, \ldots, m$
be the associated primes of $R$. We have to show that
each of the maps
$$
\sum a_i t_i :
\text{Sym}^d(R^{\oplus n})
\longrightarrow
\text{Sym}^{d + 1}(R^{\oplus n})
$$
is injective. As $\text{Sym}^d(R^{\oplus n})$ is a free $R$-module its
associated primes are $\mathfrak q_j$, $j = 1, \ldots, m$. For each $j$
there exists an $i = i(j)$ such that $a_i \not \in \mathfrak q_j$ because
there exists an $x \in R$ with $\mathfrak q_jx = 0$ but $a_i x \not = 0$
for some $i$ by assumption. Hence $a_i$ is a unit in $R_{\mathfrak q_j}$
and the map is injective after localizing at $\mathfrak q_j$. Thus the map
is injective, see
Algebra, Lemma \ref{algebra-lemma-zero-at-ass-zero}.

\medskip\noindent
Case II: $R$ general. We can write $R$ as the union of Noetherian
rings $R_\lambda$ with $a_1, \ldots, a_n \in R_\lambda$. For each $R_\lambda$
the result holds, hence the result holds for $R$.
\end{proof}

\begin{lemma}
\label{lemma-Koszul-regular-flat-locally-regular}
Let $R$ be a ring. Let $f_1, \ldots, f_n$ be a Koszul-regular sequence
in $R$ such that $(f_1, \ldots, f_n) \not = R$.
Consider the faithfully flat, smooth ring map
$$
R \longrightarrow
S = R[\{t_{ij}\}_{i \leq j}, t_{11}^{-1}, t_{22}^{-1}, \ldots, t_{nn}^{-1}]
$$
For $1 \leq i \leq n$ set
$$
g_i = \sum\nolimits_{i \leq j} t_{ij} f_j \in S.
$$
Then $g_1, \ldots, g_n$ is a regular sequence in $S$ and
$(f_1, \ldots, f_n)S = (g_1, \ldots, g_n)$.
\end{lemma}

\begin{proof}
The equality of ideals is obvious as the matrix
$$
\left(
\begin{matrix}
t_{11} & t_{12} & t_{13} & \ldots \\
0 & t_{22} & t_{23} & \ldots \\
0 & 0 & t_{33} & \ldots \\
\ldots & \ldots & \ldots & \ldots
\end{matrix}
\right)
$$
is invertible in $S$.
Because $f_1, \ldots, f_n$ is a Koszul-regular sequence we see that
the kernel of
$R \to R^{\oplus n}$, $x \mapsto (xf_1, \ldots, xf_n)$ is zero (as it
computes the $n$the Koszul homology of $R$ w.r.t.\ $f_1, \ldots, f_n$).
Hence by
Lemma \ref{lemma-make-nonzero-divisor}
we see that $g_1 = f_1 t_{11} + \ldots + f_n t_{1n}$ is a nonzerodivisor
in $S' = R[t_{11}, t_{12}, \ldots, t_{1n}, t_{11}^{-1}]$. We see that
$g_1, f_2, \ldots, f_n$ is a Koszul-sequence in $S'$ by
Lemma \ref{lemma-koszul-regular-flat-base-change} and
\ref{lemma-independence-of-generators}.
We conclude that
$\overline{f}_2, \ldots, \overline{f}_n$ is a Koszul-regular sequence
in $S'/(g_1)$ by
Lemma \ref{lemma-truncate-koszul-regular}.
Hence by induction on $n$ we see that the images
$\overline{g}_2, \ldots, \overline{g}_n$ of $g_2, \ldots, g_n$ in
$S'/(g_1)[\{t_{ij}\}_{2 \leq i \leq j}, t_{22}^{-1}, \ldots, t_{nn}^{-1}]$
form a regular sequence. This in turn means that
$g_1, \ldots, g_n$ forms a regular sequence in $S$.
\end{proof}







\section{More on Koszul regular sequences}
\label{section-more-koszul-regular}

\noindent
We continue the discussion from Section \ref{section-koszul-regular}.

\begin{lemma}
\label{lemma-vanishing-extended-alternating-koszul}
Let $R$ be a ring. Let $f_1, \ldots, f_r \in R$ be an
Koszul-regular sequence. Then the extended alternating
{\v C}ech complex $R \to \bigoplus\nolimits_{i_0} R_{f_{i_0}} \to
\bigoplus\nolimits_{i_0 < i_1} R_{f_{i_0}f_{i_1}} \to
\ldots \to R_{f_1\ldots f_r}$ from Section \ref{section-alternating-cech}
only has cohomology in degree $r$.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-mult-koszul-regular} and induction the sequence
$f_1, \ldots, f_{r - 1}, f_r^n$ is Koszul regular for all $n \geq 1$.
By Lemma \ref{lemma-change-basis} any permutation of a Koszul regular
sequence is a Koszul regular sequence. Hence we see that we may replace
any (or all) $f_i$ by its $n$th power and still have a Koszul regular
sequence. Thus $K_\bullet(R, f_1^n, \ldots, f_r^n)$ has nonzero
cohomology only in homological degree $0$. This implies what we want by
Lemma \ref{lemma-extended-alternating-Cech-is-colimit-koszul}.
\end{proof}

\begin{lemma}
\label{lemma-blowup-regular-sequence}
Let $a, a_2, \ldots, a_r$ be an $H_1$-regular sequence in a ring $R$
(for example a Koszul regular sequence or a regular sequence, see
Lemmas \ref{lemma-regular-koszul-regular} and
\ref{lemma-koszul-regular-H1-regular}).
With $I = (a, a_2, \ldots, a_r)$ the blowup algebra $R' = R[\frac{I}{a}]$
is isomorphic to $R'' = R[y_2, \ldots, y_r]/(a y_i - a_i)$.
\end{lemma}

\begin{proof}
By Algebra, Lemma \ref{algebra-lemma-affine-blowup-quotient-description}
it suffices to show that $R''$ is $a$-torsion free.

\medskip\noindent
We claim $a, ay_2 - a_2, \ldots, ay_n - a_r$ is a $H_1$-regular
sequence in $R[y_2, \ldots, y_r]$. Namely, the map
$$
(a, ay_2 - a_2, \ldots, ay_n - a_r) :
R[y_2, \ldots, y_r]^{\oplus r}
\longrightarrow
R[y_2, \ldots, y_r]
$$
used to define the Koszul complex on $a, ay_2 - a_2, \ldots, ay_n - a_r$
is isomorphic to the map
$$
(a, a_2, \ldots, a_r) :
R[y_2, \ldots, y_r]^{\oplus r} \longrightarrow
R[y_2, \ldots, y_r]
$$
used to the define the Koszul complex on $a, a_2, \ldots, a_r$
via the isomorphism
$$
R[y_2, \ldots, y_r]^{\oplus r}
\longrightarrow
R[y_2, \ldots, y_r]^{\oplus r}
$$
sending $(b_1, \ldots, b_r)$ to
$(b_1 - b_2y_2 \ldots - b_ry_r, -b_2, \ldots, - b_r)$.
By Lemma \ref{lemma-functorial} these Koszul complexes are isomorphic.
By Lemma \ref{lemma-koszul-regular-flat-base-change}
applied to the flat ring map $R \to R[y_2, \ldots, y_r]$
we conclude our claim is true. By Lemma \ref{lemma-cone-koszul}
we see that the Koszul complex $K$ on $a, ay_2 - a_2, \ldots, ay_n - a_r$
is the cone on $a : L \to L$ where $L$ is the Koszul complex
on $ay_2 - a_2, \ldots, ay_n - a_r$. Since $H_1(K) = 0$ by the claim,
we conclude that $a : H_0(L) \to H_0(L)$ is injective, in other words that
$R'' = R[y_2, \ldots, y_r]/(a y_i - a_i)$
has no nonzero $a$-torsion elements as desired.
\end{proof}

\begin{lemma}
\label{lemma-base-change-H1-regular}
Let $A \to B$ be a ring map.
Let $f_1, \ldots, f_r$ be a sequence in $B$ such that $B/(f_1, \ldots, f_r)$
is $A$-flat. Let $A \to A'$ be a ring map. Then the canonical map
$$
H_1(K_\bullet(B, f_1, \ldots, f_r)) \otimes_A A'
\longrightarrow
H_1(K_\bullet(B', f'_1, \ldots, f'_r))
$$
is surjective. Here $B' = B \otimes_A A'$ and $f_i' \in B'$ is the image
of $f_i$.
\end{lemma}

\begin{proof}
The sequence
$$
\wedge^2(B^{\oplus r}) \to B^{\oplus r} \to B \to B/J \to 0
$$
is a complex of $A$-modules with $B/J$ flat over $A$ and
cohomology group $H_1 = H_1(K_\bullet(B, f_1, \ldots, f_r))$ in the spot
$B^{\oplus r}$. If we tensor this with $A'$ we obtain a complex
$$
\wedge^2((B')^{\oplus r}) \to (B')^{\oplus r} \to B' \to B'/J' \to 0
$$
which is exact at $B'$ and $B'/J'$. In order to compute its
cohomology group $H'_1 = H_1(K_\bullet(B', f'_1, \ldots, f'_r))$
at $(B')^{\oplus r}$ we split the first sequence above into
the exact sequences $0 \to J \to B \to B/J \to 0$,
$0 \to K \to B^{\oplus r} \to J \to 0$, and
$\wedge^2(B^{\oplus r}) \to K \to H_1 \to 0$.
Tensoring over $A$ with $A'$ we obtain the exact sequences
$$
\begin{matrix}
0 \to J \otimes_A A' \to B \otimes_A A' \to (B/J) \otimes_A A' \to 0 \\
K \otimes_A A' \to B^{\oplus r} \otimes_A A' \to J \otimes_A A' \to 0 \\
\wedge^2(B^{\oplus r}) \otimes_A A' \to K \otimes_A A' \to H_1 \otimes_A A'
\to 0
\end{matrix}
$$
where the first one is exact as $B/J$ is flat over $A$, see
Algebra, Lemma \ref{algebra-lemma-flat-tor-zero}. We conclude
that $J' = J \otimes_A A' \subset B'$ and that
$K \otimes_A A' \to \Ker((B')^{\oplus r} \to B')$ is
surjective. Thus
\begin{align*}
H_1 \otimes_A A'
& =
\Coker\left(\wedge^2(B^{\oplus r}) \otimes_A A' \to K \otimes_A A'\right) \\
& \to
\Coker\left(
\wedge^2((B')^{\oplus r})  \to \Ker((B')^{\oplus r} \to B')
\right) = H'_1
\end{align*}
is surjective too.
\end{proof}

\begin{lemma}
\label{lemma-relative-regular-immersion-algebra}
Let $A \to B$ and $A \to A'$ be ring maps. Set $B' = B \otimes_A A'$.
Let $f_1, \ldots, f_r \in B$. Assume $B/(f_1, \ldots, f_r)B$ is flat over $A$
\begin{enumerate}
\item If $f_1, \ldots, f_r$ is a quasi-regular sequence, then
the image in $B'$ is a quasi-regular sequence.
\item If $f_1, \ldots, f_r$ is a $H_1$-regular sequence, then
the image in $B'$ is a $H_1$-regular sequence.
\end{enumerate}
\end{lemma}

\begin{proof}
Assume $f_1, \ldots, f_r$ is quasi-regular. Set $J = (f_1, \ldots, f_r)$.
By assumption $J^n/J^{n + 1}$ is isomorphic to a direct sum of copies of
$B/J$ hence flat over $A$. By induction and
Algebra, Lemma \ref{algebra-lemma-flat-ses}
we conclude that $B/J^n$ is flat over $A$. The ideal $(J')^n$ is equal to
$J^n \otimes_A A'$, see
Algebra, Lemma \ref{algebra-lemma-flat-tor-zero}.
Hence $(J')^n/(J')^{n + 1} = J^n/J^{n + 1} \otimes_A A'$ which clearly
implies that $f_1, \ldots, f_r$ is a quasi-regular sequence in $B'$.

\medskip\noindent
Assume $f_1, \ldots, f_r$ is $H_1$-regular. By
Lemma \ref{lemma-base-change-H1-regular}
the vanishing of the Koszul homology group
$H_1(K_\bullet(B, f_1, \ldots, f_r))$
implies the vanishing of $H_1(K_\bullet(B', f'_1, \ldots, f'_r))$
and we win.
\end{proof}

\begin{lemma}
\label{lemma-cut-by-koszul-flat}
Let $A' \to B'$ be a ring map. Let $I \subset A'$ be an ideal.
Set $A = A'/I$ and $B = B'/IB'$. Let $f'_1, \ldots, f'_r \in B'$. Assume
\begin{enumerate}
\item $A' \to B'$ is flat and of finite presentation,
\item $I$ is locally nilpotent,
\item the images $f_1, \ldots, f_r \in B$ form a quasi-regular sequence,
\item $B/(f_1, \ldots, f_r)$ is flat over $A$.
\end{enumerate}
Then $B'/(f'_1, \ldots, f'_r)$ is flat over $A'$.
\end{lemma}

\begin{proof}
Set $C' = B'/(f'_1, \ldots, f'_r)$. We have to show $A' \to C'$ is flat.
Let $\mathfrak r' \subset C'$ be a prime ideal lying over
$\mathfrak p' \subset A'$. We let $\mathfrak q' \subset B'$
be the inverse image of $\mathfrak r'$.
By Algebra, Lemma \ref{algebra-lemma-flat-localization}
it suffices to show that $A'_{\mathfrak p'} \to C'_{\mathfrak q'}$ is flat.
Algebra, Lemma \ref{algebra-lemma-grothendieck-regular-sequence-general}
tells us it suffices to show that $f'_1, \ldots, f'_r$ map to
a regular sequence in
$$
B'_{\mathfrak q'}/\mathfrak p'B'_{\mathfrak q'} =
B_\mathfrak q/\mathfrak p B_\mathfrak q =
(B \otimes_A \kappa(\mathfrak p))_\mathfrak q
$$
with obvious notation. What we know is that $f_1, \ldots, f_r$
is a quasi-regular sequence in $B$ and that $B/(f_1, \ldots, f_r)$
is flat over $A$. By Lemma \ref{lemma-relative-regular-immersion-algebra}
the images $\overline{f}_1, \ldots, \overline{f}_r$
of $f'_1, \ldots, f'_r$ in $B \otimes_A \kappa(\mathfrak p)$ form a
quasi-regular sequence. Since $(B \otimes_A \kappa(\mathfrak p))_\mathfrak q$
is a Noetherian local ring, we conclude by Lemma
\ref{lemma-noetherian-finite-all-equivalent}.
\end{proof}

\begin{lemma}
\label{lemma-cut-by-koszul}
Let $A' \to B'$ be a ring map. Let $I \subset A'$ be an ideal.
Set $A = A'/I$ and $B = B'/IB'$. Let $f'_1, \ldots, f'_r \in B'$. Assume
\begin{enumerate}
\item $A' \to B'$ is flat and of finite presentation (for example smooth),
\item $I$ is locally nilpotent,
\item the images $f_1, \ldots, f_r \in B$ form a quasi-regular sequence,
\item $B/(f_1, \ldots, f_r)$ is smooth over $A$.
\end{enumerate}
Then $B'/(f'_1, \ldots, f'_r)$ is smooth over $A'$.
\end{lemma}

\begin{proof}
Set $C' = B'/(f'_1, \ldots, f'_r)$ and $C = B/(f_1, \ldots, f_r)$.
Then $A' \to C'$ is of finite presentation.
By Lemma \ref{lemma-cut-by-koszul-flat} we see that $A' \to C'$ is flat.
The fibre rings of $A' \to C'$ are equal to the fibre rings of $A \to C$
and hence smooth by assumption (4). It follows that
$A' \to C'$ is smooth by
Algebra, Lemma \ref{algebra-lemma-flat-fibre-smooth}.
\end{proof}








\section{Regular ideals}
\label{section-ideals}

\noindent
We will discuss the notion of a regular ideal sheaf in great generality in
Divisors, Section \ref{divisors-section-regular-ideal-sheaves}.
Here we define the corresponding notion in the affine case, i.e., in
the case of an ideal in a ring.

\begin{definition}
\label{definition-regular-ideal}
Let $R$ be a ring and let $I \subset R$ be an ideal.
\begin{enumerate}
\item We say $I$ is a {\it regular ideal} if for every
$\mathfrak p \in V(I)$ there exists a $g \in R$, $g \not \in \mathfrak p$
and a regular sequence $f_1, \ldots, f_r \in R_g$ such that $I_g$
is generated by $f_1, \ldots, f_r$.
\item We say $I$ is a {\it Koszul-regular ideal} if for every
$\mathfrak p \in V(I)$ there exists a $g \in R$, $g \not \in \mathfrak p$
and a Koszul-regular sequence $f_1, \ldots, f_r \in R_g$ such that $I_g$
is generated by $f_1, \ldots, f_r$.
\item We say $I$ is a {\it $H_1$-regular ideal} if for every
$\mathfrak p \in V(I)$ there exists a $g \in R$, $g \not \in \mathfrak p$
and an $H_1$-regular sequence $f_1, \ldots, f_r \in R_g$ such that $I_g$
is generated by $f_1, \ldots, f_r$.
\item We say $I$ is a {\it quasi-regular ideal} if for every
$\mathfrak p \in V(I)$ there exists a $g \in R$, $g \not \in \mathfrak p$
and a quasi-regular sequence $f_1, \ldots, f_r \in R_g$ such that $I_g$
is generated by $f_1, \ldots, f_r$.
\end{enumerate}
\end{definition}

\noindent
It is clear that given $I \subset R$ we have the implications
\begin{align*}
I\text{ is a regular ideal}
& \Rightarrow
I\text{ is a Koszul-regular ideal} \\
& \Rightarrow
I\text{ is a }H_1\text{-regular ideal} \\
& \Rightarrow
I\text{ is a quasi-regular ideal}
\end{align*}
see Lemmas \ref{lemma-regular-koszul-regular},
\ref{lemma-koszul-regular-H1-regular}, and
\ref{lemma-H1-regular-quasi-regular}. Such an ideal is always finitely
generated.

\begin{lemma}
\label{lemma-quasi-regular-ideal-finite}
A quasi-regular ideal is finitely generated.
\end{lemma}

\begin{proof}
Let $I \subset R$ be a quasi-regular ideal. Since $V(I)$ is quasi-compact,
there exist $g_1, \ldots, g_m \in R$ such that
$V(I) \subset D(g_1) \cup \ldots \cup D(g_m)$
and such that $I_{g_j}$ is generated by a quasi-regular sequence
$g_{j1}, \ldots, g_{jr_j} \in R_{g_j}$. Write $g_{ji} = g'_{ji}/g_j^{e_{ij}}$
for some $g'_{ij} \in I$. Write $1 + x = \sum g_j h_j$
for some $x \in I$ which is possible as
$V(I) \subset D(g_1) \cup \ldots \cup D(g_m)$.
Note that $\Spec(R) = D(g_1) \cup \ldots \cup D(g_m) \bigcup D(x)$
Then $I$ is generated by the elements $g'_{ij}$ and $x$ as
these generate on each of the pieces of the cover, see
Algebra, Lemma \ref{algebra-lemma-cover}.
\end{proof}

\begin{lemma}
\label{lemma-quasi-regular-ideal-finite-projective}
Let $I \subset R$ be a quasi-regular ideal of a ring.
Then $I/I^2$ is a finite projective $R/I$-module.
\end{lemma}

\begin{proof}
This follows from Algebra, Lemma \ref{algebra-lemma-finite-projective}
and the definitions.
\end{proof}

\noindent
We prove flat descent for Koszul-regular, $H_1$-regular, quasi-regular
ideals.

\begin{lemma}
\label{lemma-flat-descent-regular-ideal}
Let $A \to B$ be a faithfully flat ring map. Let $I \subset A$ be an ideal.
If $IB$ is a Koszul-regular
(resp.\ $H_1$-regular, resp.\ quasi-regular) ideal in $B$, then
$I$ is a Koszul-regular (resp.\ $H_1$-regular, resp.\ quasi-regular)
ideal in $A$.
\end{lemma}

\begin{proof}
We fix the prime $\mathfrak p \supset I$ throughout the proof.
Assume $IB$ is quasi-regular. By
Lemma \ref{lemma-quasi-regular-ideal-finite}
$IB$ is a finite module, hence $I$ is a finite $A$-module by
Algebra, Lemma \ref{algebra-lemma-descend-properties-modules}.
As $A \to B$ is flat we see that
$$
I/I^2 \otimes_{A/I} B/IB = I/I^2 \otimes_A B = IB/(IB)^2.
$$
As $IB$ is quasi-regular, the $B/IB$-module $IB/(IB)^2$ is finite
locally free. Hence $I/I^2$ is finite projective, see
Algebra, Proposition \ref{algebra-proposition-ffdescent-finite-projectivity}.
In particular, after replacing $A$ by $A_f$ for some
$f \in A$, $f \not \in \mathfrak p$ we may assume that $I/I^2$ is free of
rank $r$. Pick $f_1, \ldots, f_r \in I$ which
give a basis of $I/I^2$. By Nakayama's lemma (see
Algebra, Lemma \ref{algebra-lemma-NAK})
we see that, after another replacement $A \leadsto A_f$ as above,
$I$ is generated by $f_1, \ldots, f_r$.

\medskip\noindent
Proof of the ``quasi-regular'' case. Above we have seen that
$I/I^2$ is free on the $r$-generators $f_1, \ldots, f_r$.
To finish the proof in this case we have to show that the maps
$\text{Sym}^d(I/I^2) \to I^d/I^{d + 1}$ are isomorphisms
for each $d \geq 2$. This is clear as the faithfully flat
base changes $\text{Sym}^d(IB/(IB)^2) \to (IB)^d/(IB)^{d + 1}$
are isomorphisms locally on $B$ by assumption.
Details omitted.

\medskip\noindent
Proof of the ``$H_1$-regular'' and ``Koszul-regular'' case.
Consider the sequence of elements $f_1, \ldots, f_r$ generating
$I$ we constructed above. By
Lemma \ref{lemma-independence-of-generators}
we see that $f_1, \ldots, f_r$ map to a $H_1$-regular or Koszul-regular
sequence in $B_g$ for any $g \in B$ such that $IB$ is generated by
an $H_1$-regular or Koszul-regular sequence. Hence
$K_\bullet(A, f_1, \ldots, f_r) \otimes_A B_g$ has vanishing
$H_1$ or $H_i$, $i > 0$. Since the homology of
$K_\bullet(B, f_1, \ldots, f_r) = K_\bullet(A, f_1, \ldots, f_r) \otimes_A B$
is annihilated by $IB$ (see
Lemma \ref{lemma-homotopy-koszul})
and since $V(IB) \subset \bigcup_{g\text{ as above}} D(g)$ we conclude that
$K_\bullet(A, f_1, \ldots, f_r) \otimes_A B$ has vanishing homology in
degree $1$ or all positive degrees. Using that $A \to B$ is faithfully
flat we conclude that the same is true for
$K_\bullet(A, f_1, \ldots, f_r)$.
\end{proof}

\begin{lemma}
\label{lemma-conormal-sequence-H1-regular-ideal}
Let $A$ be a ring. Let $I \subset J \subset A$ be ideals.
Assume that $J/I \subset A/I$ is a $H_1$-regular ideal.
Then $I \cap J^2 = IJ$.
\end{lemma}

\begin{proof}
Follows immediately from Lemma \ref{lemma-conormal-sequence-H1-regular}
by localizing.
\end{proof}







\section{Local complete intersection maps}
\label{section-lci}

\noindent
We can use the material above to define a local complete intersection
map between rings using presentations by (finite) polynomial algebras.

\begin{lemma}
\label{lemma-koszul-independence-presentation}
Let $A \to B$ be a finite type ring map. If for some presentation
$\alpha : A[x_1, \ldots, x_n] \to B$ the kernel $I$ is a Koszul-regular ideal
then for any presentation $\beta : A[y_1, \ldots, y_m] \to B$ the kernel
$J$ is a Koszul-regular ideal.
\end{lemma}

\begin{proof}
Choose $f_j \in A[x_1, \ldots, x_n]$ with $\alpha(f_j) = \beta(y_j)$
and $g_i \in A[y_1, \ldots, y_m]$ with $\beta(g_i) = \alpha(x_i)$.
Then we get a commutative diagram
$$
\xymatrix{
A[x_1, \ldots, x_n, y_1, \ldots, y_m]
\ar[d]^{x_i \mapsto g_i} \ar[rr]_-{y_j \mapsto f_j} & &
A[x_1, \ldots, x_n] \ar[d] \\
A[y_1, \ldots, y_m] \ar[rr] & & B
}
$$
Note that the kernel $K$ of $A[x_i, y_j] \to B$ is equal to
$K = (I, y_j - f_j) = (J, x_i - f_i)$. In particular, as
$I$ is finitely generated by
Lemma \ref{lemma-quasi-regular-ideal-finite}
we see that $J = K/(x_i - f_i)$ is finitely generated too.

\medskip\noindent
Pick a prime $\mathfrak q \subset B$. Since
$I/I^2 \oplus B^{\oplus m} = J/J^2 \oplus B^{\oplus n}$
(Algebra, Lemma \ref{algebra-lemma-conormal-module})
we see that
$$
\dim J/J^2 \otimes_B \kappa(\mathfrak q) + n =
\dim I/I^2 \otimes_B \kappa(\mathfrak q) + m.
$$
Pick $p_1, \ldots, p_t \in I$ which map to a basis of
$I/I^2 \otimes \kappa(\mathfrak q) = I \otimes_{A[x_i]} \kappa(\mathfrak q)$.
Pick $q_1, \ldots, q_s \in J$ which map to a basis of
$J/J^2 \otimes \kappa(\mathfrak q) = J \otimes_{A[y_j]} \kappa(\mathfrak q)$.
So $s + n = t + m$. By Nakayama's lemma there exist $h \in A[x_i]$ and
$h' \in A[y_j]$ both mapping to a nonzero element of $\kappa(\mathfrak q)$
such that $I_h = (p_1, \ldots, p_t)$ in $A[x_i, 1/h]$ and
$J_{h'} = (q_1, \ldots, q_s)$ in $A[y_j, 1/h']$.
As $I$ is Koszul-regular we may also assume that $I_h$ is generated
by a Koszul regular sequence. This sequence must necessarily have length
$t = \dim I/I^2 \otimes_B \kappa(\mathfrak q)$, hence we see that
$p_1, \ldots, p_t$ is a Koszul-regular sequence by
Lemma \ref{lemma-independence-of-generators}.
As also $y_1 - f_1, \ldots, y_m - f_m$ is a regular sequence we
conclude
$$
y_1 - f_1, \ldots, y_m - f_m, p_1, \ldots, p_t
$$
is a Koszul-regular sequence in $A[x_i, y_j, 1/h]$
(see Lemma \ref{lemma-join-koszul-regular-sequences}).
This sequence generates the ideal $K_h$. Hence the
ideal $K_{hh'}$ is generated by a Koszul-regular sequence
of length $m + t = n + s$. But it is also generated by the sequence
$$
x_1 - g_1, \ldots, x_n - g_n, q_1, \ldots, q_s
$$
of the same length which is thus a Koszul-regular sequence by
Lemma \ref{lemma-independence-of-generators}.
Finally, by
Lemma \ref{lemma-truncate-koszul-regular}
we conclude that the images of $q_1, \ldots, q_s$ in
$$
A[x_i, y_j, 1/hh']/(x_1 - g_1, \ldots, x_n - g_n)
\cong A[y_j, 1/h'']
$$
form a Koszul-regular sequence generating $J_{h''}$. Since $h''$
is the image of $hh'$ it doesn't map to zero in $\kappa(\mathfrak q)$
and we win.
\end{proof}

\noindent
This lemma allows us to make the following definition.

\begin{definition}
\label{definition-local-complete-intersection}
A ring map $A \to B$ is called a {\it local complete intersection}
if it is of finite type and for some (equivalently any) presentation
$B = A[x_1, \ldots, x_n]/I$ the ideal $I$ is Koszul-regular.
\end{definition}

\noindent
This notion is local.

\begin{lemma}
\label{lemma-lci-local}
Let $R \to S$ be a ring map. Let $g_1, \ldots, g_m \in S$
generate the unit ideal. If each $R \to S_{g_j}$ is a local
complete intersection so is $R \to S$.
\end{lemma}

\begin{proof}
Let $S = R[x_1, \ldots, x_n]/I$ be a presentation. Pick
$h_j \in R[x_1, \ldots, x_n]$ mapping to $g_j$ in $S$.
Then $R[x_1, \ldots, x_n, x_{n + 1}]/(I, x_{n + 1}h_j - 1)$
is a presentation of $S_{g_j}$. Hence
$I_j = (I, x_{n + 1}h_j - 1)$ is a Koszul-regular ideal in
$R[x_1, \ldots, x_n, x_{n + 1}]$. Pick a prime
$I \subset \mathfrak q \subset R[x_1, \ldots, x_n]$.
Then $h_j \not \in \mathfrak q$ for some $j$ and
$\mathfrak q_j = (\mathfrak q, x_{n + 1}h_j - 1)$ is a prime
ideal of $V(I_j)$ lying over $\mathfrak q$.
Pick $f_1, \ldots, f_r \in I$ which map to a basis of
$I/I^2 \otimes \kappa(\mathfrak q)$. Then
$x_{n + 1}h_j - 1, f_1, \ldots, f_r$ is a sequence of elements of $I_j$
which map to a basis of $I_j \otimes \kappa(\mathfrak q_j)$.
By Nakayama's lemma there exists an $h \in R[x_1, \ldots, x_n, x_{n + 1}]$
such that $(I_j)_h$ is generated by $x_{n + 1}h_j - 1, f_1, \ldots, f_r$.
We may also assume that $(I_j)_h$ is generated by a Koszul regular
sequence of some length $e$. Looking at the dimension of
$I_j \otimes \kappa(\mathfrak q_j)$ we see that $e = r + 1$.
Hence by
Lemma \ref{lemma-independence-of-generators}
we see that $x_{n + 1}h_j - 1, f_1, \ldots, f_r$ is a
Koszul-regular sequence generating $(I_j)_h$ for some
$h \in R[x_1, \ldots, x_n, x_{n + 1}]$, $h \not \in \mathfrak q_j$. By
Lemma \ref{lemma-truncate-koszul-regular}
we see that $I_{h'}$ is generated by a Koszul-regular sequence for some
$h' \in R[x_1, \ldots, x_n]$, $h' \not \in \mathfrak q$ as desired.
\end{proof}

\begin{lemma}
\label{lemma-relative-global-complete-intersection-koszul}
Let $R$ be a ring. If $R[x_1, \ldots, x_n]/(f_1, \ldots, f_c)$
is a relative global complete intersection, then $f_1, \ldots, f_c$
is a Koszul regular sequence.
\end{lemma}

\begin{proof}
Recall that the homology groups $H_i(K_\bullet(f_\bullet))$ are
annihilated by the ideal $(f_1, \ldots, f_c)$. Hence it suffices
to show that $H_i(K_\bullet(f_\bullet))_\mathfrak q$ is zero for
all primes $\mathfrak q \subset R[x_1, \ldots, x_n]$
containing $(f_1, \ldots, f_c)$. This follows from
Algebra, Lemma
\ref{algebra-lemma-relative-global-complete-intersection-conormal}
and the fact that a regular sequence is Koszul regular
(Lemma \ref{lemma-regular-koszul-regular}).
\end{proof}

\begin{lemma}
\label{lemma-syntomic-lci}
Let $R \to S$ be a ring map. The following are equivalent
\begin{enumerate}
\item $R \to S$ is syntomic
(Algebra, Definition \ref{algebra-definition-lci}), and
\item $R \to S$ is flat and a local complete intersection.
\end{enumerate}
\end{lemma}

\begin{proof}
Assume (1). Then $R \to S$ is flat by definition.
By Algebra, Lemma \ref{algebra-lemma-syntomic} and
Lemma \ref{lemma-lci-local} we see that it suffices to
show a relative global complete intersection is
a local complete intersection homomorphism which is
Lemma \ref{lemma-relative-global-complete-intersection-koszul}.

\medskip\noindent
Assume (2). A local complete intersection is of finite presentation
because a Koszul-regular ideal is finitely generated.
Let $R \to k$ be a map to a field. It suffices to show that
$S' = S \otimes_R k$ is a local complete intersection over $k$, see
Algebra, Definition \ref{algebra-definition-lci-field}.
Choose a prime $\mathfrak q' \subset S'$.
Write $S = R[x_1, \ldots, x_n]/I$.
Then $S' = k[x_1, \ldots, x_n]/I'$ where
$I' \subset k[x_1, \ldots, x_n]$ is the image of $I$.
Let $\mathfrak p' \subset k[x_1, \ldots, x_n]$,
$\mathfrak q \subset S$,
and $\mathfrak p \subset R[x_1, \ldots, x_n]$
be the corresponding primes.
By Definition \ref{definition-regular-ideal}
exists an $g \in R[x_1, \ldots, x_n]$, $g \not \in \mathfrak p$
and $f_1, \ldots, f_r \in R[x_1, \ldots, x_n]_g$ which form
a Koszul-regular sequence generating $I_g$.
Since $S$ and hence $S_g$ is flat over $R$
we see that the images $f'_1, \ldots, f'_r$ in
$k[x_1, \ldots, x_n]_g$ form a $H_1$-regular sequence
generating $I'_g$, see
Lemma \ref{lemma-relative-regular-immersion-algebra}.
Thus $f'_1, \ldots, f'_r$ map to a regular sequence in
$k[x_1, \ldots, x_n]_{\mathfrak p'}$ generating
$I'_{\mathfrak p'}$ by Lemma \ref{lemma-noetherian-finite-all-equivalent}.
Applying Algebra, Lemma \ref{algebra-lemma-lci}
we conclude $S'_{gg'}$ for some $g' \in S$, $g' \not \in \mathfrak q'$
is a global complete intersection over $k$ as desired.
\end{proof}

\noindent
For a local complete intersection $R \to S$ we have $H_n(L_{S/R}) = 0$ for
$n \geq 2$. Since we haven't (yet) defined the full cotangent complex
we can't state and prove this, but we can deduce one of the consequences.

\begin{lemma}
\label{lemma-transitive-lci-at-end}
Let $A \to B \to C$ be ring maps. Assume $B \to C$ is a local complete
intersection homomorphism. Choose a presentation
$\alpha : A[x_s, s \in S] \to B$ with kernel $I$. Choose a presentation
$\beta : B[y_1, \ldots, y_m] \to C$ with kernel $J$. Let
$\gamma : A[x_s, y_t] \to C$ be the induced presentation of $C$ with kernel
$K$. Then we get a canonical commutative diagram
$$
\xymatrix{
0 \ar[r] &
\Omega_{A[x_s]/A} \otimes C \ar[r] &
\Omega_{A[x_s, y_t]/A} \otimes C \ar[r] &
\Omega_{B[y_t]/B} \otimes C \ar[r] &
0 \\
0 \ar[r] &
I/I^2 \otimes C \ar[r] \ar[u] &
K/K^2 \ar[r] \ar[u] &
J/J^2 \ar[r] \ar[u] &
0
}
$$
with exact rows. In particular, the six term exact sequence of
Algebra, Lemma \ref{algebra-lemma-exact-sequence-NL}
can be completed with a zero on the left, i.e., the sequence
$$
0 \to H_1(\NL_{B/A} \otimes_B C) \to
H_1(L_{C/A}) \to
H_1(L_{C/B}) \to
\Omega_{B/A} \otimes_B C \to
\Omega_{C/A} \to
\Omega_{C/B} \to 0
$$
is exact.
\end{lemma}

\begin{proof}
The only thing to prove is the injectivity of the map
$I/I^2 \otimes C \to K/K^2$.
By assumption the ideal $J$ is Koszul-regular.
Hence we have $IA[x_s, y_j] \cap K^2 = IK$ by
Lemma \ref{lemma-conormal-sequence-H1-regular-ideal}.
This means that the kernel of $K/K^2 \to J/J^2$ is
isomorphic to $IA[x_s, y_j]/IK$. Since
$I/I^2 \otimes_A C = IA[x_s, y_j]/IK$ by right exactness
of tensor product, this provides us with the desired injectivity of
$I/I^2 \otimes_A C \to K/K^2$.
\end{proof}

\begin{lemma}
\label{lemma-transitive-colimit-lci-at-end}
Let $A \to B \to C$ be ring maps.
If $B \to C$ is a filtered colimit of local complete intersection
homomorphisms then the conclusion of
Lemma \ref{lemma-transitive-lci-at-end}
remains valid.
\end{lemma}

\begin{proof}
Follows from
Lemma \ref{lemma-transitive-lci-at-end}
and
Algebra, Lemma \ref{algebra-lemma-colimits-NL}.
\end{proof}

\begin{lemma}
\label{lemma-henselization-NL}
Let $A \to B$ be a local homomorphism of local rings.
Let $A^h \to B^h$, resp.\ $A^{sh} \to B^{sh}$ be the induced
map on henselizations, resp.\ strict henselizations
(Algebra, Lemma \ref{algebra-lemma-henselian-functorial},
resp.\ Lemma \ref{algebra-lemma-strictly-henselian-functorial}).
Then $\NL_{B/A} \otimes_B B^h \to \NL_{B^h/A^h}$ and
$\NL_{B/A} \otimes_B B^{sh} \to \NL_{B^{sh}/A^{sh}}$
induce isomorphisms on cohomology groups.
\end{lemma}

\begin{proof}
Since $A^h$ is a filtered colimit of \'etale algebras over $A$
we see that $\NL_{A^h/A}$ is an acyclic complex by
Algebra, Lemma \ref{algebra-lemma-colimits-NL} and
Algebra, Definition \ref{algebra-definition-etale}.
The same is true for $B^h/B$.
Using the Jacobi-Zariski sequence
(Algebra, Lemma \ref{algebra-lemma-exact-sequence-NL})
for $A \to A^h \to B^h$ we find that
$\NL_{B^h/A} \to \NL_{B^h/A^h}$ induces isomorphisms
on cohomology groups. Moreover, an \'etale ring map is
a local complete intersection as it is even a global complete
intersection, see Algebra, Lemma \ref{algebra-lemma-etale-standard-smooth}.
By Lemma \ref{lemma-transitive-colimit-lci-at-end}
we get a six term exact Jacobi-Zariski sequence
associated to $A \to B \to B^h$ which proves that
$\NL_{B/A} \otimes_B B^h \to \NL_{B^h/A}$ induces isomorphisms
on cohomology groups. This finishes the proof in the
case of the map on henselizations. The case of strict henselization
is proved in exactly the same manner.
\end{proof}







\section{Cartier's equality and geometric regularity}
\label{section-cartier-equality}

\noindent
A reference for this section and the next is \cite[Section 39]{MatCA}.
In order to comfortably read this section the reader should be
familiar with the naive cotangent complex and its properties, see
Algebra, Section \ref{algebra-section-netherlander}.

\begin{lemma}[Cartier equality]
\label{lemma-cartier-equality}
Let $K/k$ be a finitely generated field extension.
Then $\Omega_{K/k}$ and $H_1(L_{K/k})$ are finite dimensional and
$\text{trdeg}_k(K) = \dim_K \Omega_{K/k} - \dim_K H_1(L_{K/k})$.
\end{lemma}

\begin{proof}
We can find a global complete intersection
$A = k[x_1, \ldots, x_n]/(f_1, \ldots, f_c)$
over $k$ such that
$K$ is isomorphic to the fraction field of $A$, see
Algebra, Lemma \ref{algebra-lemma-colimit-syntomic}
and its proof. In this case we see that $\NL_{K/k}$ is homotopy
equivalent to the complex
$$
\bigoplus\nolimits_{j = 1, \ldots, c} K \longrightarrow
\bigoplus\nolimits_{i = 1, \ldots, n} K\text{d}x_i
$$
by Algebra, Lemmas \ref{algebra-lemma-NL-homotopy} and
\ref{algebra-lemma-localize-NL}.
The transcendence degree of $K$ over $k$ is the dimension of $A$
(by Algebra, Lemma \ref{algebra-lemma-dimension-prime-polynomial-ring})
which is $n - c$ and we win.
\end{proof}

\begin{lemma}
\label{lemma-transitivity-gamma}
Let $M/L/K$ be field extensions. Then the Jacobi-Zariski
sequence
$$
0 \to H_1(L_{L/K}) \otimes_L M \to
H_1(L_{M/K}) \to
H_1(L_{M/L}) \to
\Omega_{L/K} \otimes_L M \to
\Omega_{M/K} \to
\Omega_{M/L} \to 0
$$
is exact.
\end{lemma}

\begin{proof}
Combine
Lemma \ref{lemma-transitive-colimit-lci-at-end}
with
Algebra, Lemma \ref{algebra-lemma-colimit-syntomic}.
\end{proof}

\begin{lemma}
\label{lemma-gamma-commutative-diagram}
Given a commutative diagram of fields
$$
\xymatrix{
K \ar[r] & K' \\
k \ar[u] \ar[r] & k' \ar[u]
}
$$
with $k'/k$ and $K'/K$ finitely generated field extensions
the kernel and cokernel of the maps
$$
\alpha : \Omega_{K/k} \otimes_K K' \to \Omega_{K'/k'}
\quad\text{and}\quad
\beta : H_1(L_{K/k}) \otimes_K K' \to H_1(L_{K'/k'})
$$
are finite dimensional and
$$
\dim \Ker(\alpha) - \dim \Coker(\alpha)
-\dim \Ker(\beta) + \dim \Coker(\beta)
=
\text{trdeg}_k(k') - \text{trdeg}_K(K')
$$
\end{lemma}

\begin{proof}
The Jacobi-Zariski sequences for $k \subset k' \subset K'$ and
$k \subset K \subset K'$ are
$$
0 \to H_1(L_{k'/k}) \otimes K'  \to
H_1(L_{K'/k}) \to
H_1(L_{K'/k'}) \to
\Omega_{k'/k} \otimes K' \to
\Omega_{K'/k} \to
\Omega_{K'/k'} \to 0
$$
and
$$
0 \to H_1(L_{K/k}) \otimes K' \to
H_1(L_{K'/k}) \to
H_1(L_{K'/K}) \to
\Omega_{K/k} \otimes K' \to
\Omega_{K'/k} \to
\Omega_{K'/K} \to 0
$$
By
Lemma \ref{lemma-cartier-equality}
the vector spaces $\Omega_{k'/k}$, $\Omega_{K'/K}$, $H_1(L_{K'/K})$, and
$H_1(L_{k'/k})$ are finite dimensional and the alternating sum of their
dimensions is $\text{trdeg}_k(k') - \text{trdeg}_K(K')$.
The lemma follows.
\end{proof}





\section{Geometric regularity}
\label{section-geometrically-regular}

\noindent
Let $k$ be a field. Let $(A, \mathfrak m, K)$ be a Noetherian local
$k$-algebra. The Jacobi-Zariski sequence
(Algebra, Lemma \ref{algebra-lemma-exact-sequence-NL})
is a canonical exact sequence
$$
H_1(L_{K/k}) \to \mathfrak m/\mathfrak m^2 \to \Omega_{A/k} \otimes_A K \to
\Omega_{K/k} \to 0
$$
because $H_1(L_{K/A}) = \mathfrak m/\mathfrak m^2$ by
Algebra, Lemma \ref{algebra-lemma-NL-surjection}.
We will show that exactness on the left of this sequence characterizes
whether or not a regular local ring $A$ is geometrically regular over $k$.
We will link this to the notion of formal smoothness in
Section \ref{section-regular-fs}.

\begin{proposition}
\label{proposition-characterization-geometrically-regular}
Let $k$ be a field of characteristic $p > 0$.
Let $(A, \mathfrak m, K)$ be a Noetherian local
$k$-algebra. The following are equivalent
\begin{enumerate}
\item $A$ is geometrically regular over $k$,
\item for all $k \subset k' \subset k^{1/p}$
finite over $k$ the ring $A \otimes_k k'$ is regular,
\item $A$ is regular and the canonical map
$H_1(L_{K/k}) \to \mathfrak m/\mathfrak m^2$ is injective, and
\item $A$ is regular and the map
$\Omega_{k/\mathbf{F}_p} \otimes_k K \to \Omega_{A/\mathbf{F}_p} \otimes_A K$
is injective.
\end{enumerate}
\end{proposition}

\begin{proof}
Proof of (3) $\Rightarrow$ (1).
Assume (3). Let $k'/k$ be a finite purely inseparable extension.
Set $A' = A \otimes_k k'$. This is a local ring with maximal ideal
$\mathfrak m'$. Set $K' = A'/\mathfrak m'$. We get a commutative
diagram
$$
\xymatrix{
0 \ar[r] &
H_1(L_{K/k}) \otimes K' \ar[r] \ar[d]_\beta &
\mathfrak m/\mathfrak m^2 \otimes K' \ar[r] \ar[d] &
\Omega_{A/k} \otimes_A K' \ar[r] \ar[d]_{\cong} &
\Omega_{K/k} \otimes K' \ar[r] \ar[d]_\alpha &
0
\\
 &
H_1(L_{K'/k'}) \ar[r] &
\mathfrak m'/(\mathfrak m')^2 \ar[r] &
\Omega_{A'/k'} \otimes_{A'} K' \ar[r] &
\Omega_{K'/k'} \ar[r] &
0
}
$$
with exact rows. The third vertical arrow is an isomorphism by base
change for modules of differentials
(Algebra, Lemma \ref{algebra-lemma-differentials-base-change}).
Thus $\alpha$ is surjective. By
Lemma \ref{lemma-gamma-commutative-diagram} we have
$$
\dim \Ker(\alpha) - \dim \Ker(\beta) + \dim \Coker(\beta) = 0
$$
(and these dimensions are all finite). A diagram chase shows that
$\dim \mathfrak m'/(\mathfrak m')^2 \leq \dim \mathfrak m/\mathfrak m^2$.
However, since $A \to A'$ is finite flat we see that
$\dim(A) = \dim(A')$, see
Algebra, Lemma \ref{algebra-lemma-dimension-base-fibre-total}.
Hence $A'$ is regular by definition.

\medskip\noindent
Equivalence of (3) and (4). Consider the Jacobi-Zariski sequences
for rows of the commutative diagram
$$
\xymatrix{
\mathbf{F}_p \ar[r] & A \ar[r] & K \\
\mathbf{F}_p \ar[r] \ar[u] & k \ar[r] \ar[u] & K \ar[u]
}
$$
to get a commutative diagram
$$
\xymatrix{
0 \ar[r] &
\mathfrak m/\mathfrak m^2 \ar[r] &
\Omega_{A/\mathbf{F}_p} \otimes_A K \ar[r] &
\Omega_{K/\mathbf{F}_p} \ar[r] & 0 & \\
0 \ar[r] &
H_1(L_{K/k}) \ar[r] \ar[u] &
\Omega_{k/\mathbf{F}_p} \otimes_k K \ar[r] \ar[u] &
\Omega_{K/\mathbf{F}_p} \ar[r] \ar[u] &
\Omega_{K/k} \ar[r] \ar[u] &
0
}
$$
with exact rows. We have used that $H_1(L_{K/A}) = \mathfrak m/\mathfrak m^2$
and that $H_1(L_{K/\mathbf{F}_p}) = 0$ as $K/\mathbf{F}_p$ is separable, see
Algebra, Proposition
\ref{algebra-proposition-characterize-separable-field-extensions}.
Thus it is clear that the kernels of
$H_1(L_{K/k}) \to \mathfrak m/\mathfrak m^2$
and
$\Omega_{k/\mathbf{F}_p} \otimes_k K \to \Omega_{A/\mathbf{F}_p} \otimes_A K$
have the same dimension.

\medskip\noindent
Proof of (2) $\Rightarrow$ (4) following Faltings, see
\cite{Faltings-einfacher}. Let $a_1, \ldots, a_n \in k$ be elements
such that $\text{d}a_1, \ldots, \text{d}a_n$ are linearly independent
in $\Omega_{k/\mathbf{F}_p}$. Consider the field extension
$k' = k(a_1^{1/p}, \ldots, a_n^{1/p})$. By
Algebra, Lemma \ref{algebra-lemma-size-extension-pth-roots}
we see that $k' = k[x_1, \ldots, x_n]/(x_1^p - a_1, \ldots, x_n^p - a_n)$.
In particular we see that the naive cotangent complex of $k'/k$
is homotopic to the complex
$\bigoplus_{j = 1, \ldots, n} k' \rightarrow \bigoplus_{i = 1, \ldots, n} k'$
with the zero differential as
$\text{d}(x_j^p - a_j) = 0$ in $\Omega_{k[x_1, \ldots, x_n]/k}$.
Set $A' = A \otimes_k k'$ and $K' = A'/\mathfrak m'$ as above.
By Algebra, Lemma \ref{algebra-lemma-change-base-NL}
we see that $\NL_{A'/A}$ is homotopy equivalent to the complex
$\bigoplus_{j = 1, \ldots, n} A' \rightarrow \bigoplus_{i = 1, \ldots, n} A'$
with the zero differential, i.e., $H_1(L_{A'/A})$ and
$\Omega_{A'/A}$ are free of rank $n$. The Jacobi-Zariski sequence for
$\mathbf{F}_p \to A \to A'$ is
$$
H_1(L_{A'/A}) \to \Omega_{A/\mathbf{F}_p} \otimes_A A'
\to \Omega_{A'/\mathbf{F}_p} \to \Omega_{A'/A} \to 0
$$
Using the presentation $A[x_1, \ldots, x_n] \to A'$ with
kernel $(x_j^p - a_j)$ we see, unwinding the maps in
Algebra, Lemma \ref{algebra-lemma-exact-sequence-NL},
that the $j$th basis vector of $H_1(L_{A'/A})$ maps to
$\text{d}a_j \otimes 1$ in $\Omega_{A/\mathbf{F}_p} \otimes A'$.
As $\Omega_{A'/A}$ is free (hence flat) we get on tensoring with $K'$
an exact sequence
$$
K'^{\oplus n} \to \Omega_{A/\mathbf{F}_p} \otimes_A K'
\xrightarrow{\beta} \Omega_{A'/\mathbf{F}_p} \otimes_{A'} K' \to
K'^{\oplus n} \to 0
$$
We conclude that the elements $\text{d}a_j \otimes 1$ generate
$\Ker(\beta)$ and we have to show that are linearly independent, i.e.,
we have to show $\dim(\Ker(\beta)) = n$.
Consider the following big diagram
$$
\xymatrix{
0 \ar[r] &
\mathfrak m'/(\mathfrak m')^2 \ar[r] &
\Omega_{A'/\mathbf{F}_p} \otimes K' \ar[r] &
\Omega_{K'/\mathbf{F}_p} \ar[r] & 0 \\
0 \ar[r] &
\mathfrak m/\mathfrak m^2 \otimes K' \ar[r] \ar[u]^\alpha &
\Omega_{A/\mathbf{F}_p} \otimes K' \ar[r] \ar[u]^\beta &
\Omega_{K/\mathbf{F}_p} \otimes K' \ar[r] \ar[u]^\gamma & 0
}
$$
By Lemma \ref{lemma-cartier-equality} and the Jacobi-Zariski sequence for
$\mathbf{F}_p \to K \to K'$ we see that the kernel and cokernel of
$\gamma$ have the same finite dimension.
By assumption $A'$ is regular (and of the same dimension as $A$, see
above) hence the kernel and cokernel of $\alpha$ have the same dimension.
It follows that the kernel and cokernel of $\beta$ have the same
dimension which is what we wanted to show.

\medskip\noindent
The implication (1) $\Rightarrow$ (2) is trivial. This finishes
the proof of the proposition.
\end{proof}

\begin{lemma}
\label{lemma-geometrically-regular-over-field}
Let $k$ be a field of characteristic $p > 0$. Let $(A, \mathfrak m, K)$
be a Noetherian local $k$-algebra. Assume $A$ is geometrically regular
over $k$. Let $K/F/k$ be a finitely generated subextension.
Let $\varphi : k[y_1, \ldots, y_m] \to A$ be a $k$-algebra map
such that $y_i$ maps to an element of $F$ in $K$ and such that
$\text{d}y_1, \ldots, \text{d}y_m$ map to a basis of $\Omega_{F/k}$.
Set $\mathfrak p = \varphi^{-1}(\mathfrak m)$. Then
$$
k[y_1, \ldots, y_m]_\mathfrak p \to A
$$
is flat and $A/\mathfrak pA$ is regular.
\end{lemma}

\begin{proof}
Set $A_0 = k[y_1, \ldots, y_m]_\mathfrak p$ with maximal ideal
$\mathfrak m_0$ and residue field $K_0$. Note that
$\Omega_{A_0/k}$ is free of rank $m$ and
$\Omega_{A_0/k} \otimes K_0 \to \Omega_{K_0/k}$ is an isomorphism.
It is clear that $A_0$ is geometrically regular over $k$. Hence
$H_1(L_{K_0/k}) \to \mathfrak m_0/\mathfrak m_0^2$ is an isomorphism, see
Proposition \ref{proposition-characterization-geometrically-regular}.
Now consider
$$
\xymatrix{
H_1(L_{K_0/k}) \otimes K \ar[d] \ar[r] &
\mathfrak m_0/\mathfrak m_0^2 \otimes K \ar[d] \\
H_1(L_{K/k}) \ar[r] & \mathfrak m/\mathfrak m^2
}
$$
Since the left vertical arrow is injective by
Lemma \ref{lemma-transitivity-gamma}
and the lower horizontal by
Proposition \ref{proposition-characterization-geometrically-regular}
we conclude that the right vertical one is too.
Hence a regular system of parameters in $A_0$ maps to
part of a regular system of parameters in $A$.
We win by
Algebra, Lemmas \ref{algebra-lemma-flat-over-regular} and
\ref{algebra-lemma-regular-ring-CM}.
\end{proof}












\section{Topological rings and modules}
\label{section-topological-ring}

\noindent
Let's quickly discuss some properties of topological abelian groups.
An abelian group $M$ is a {\it topological abelian group} if $M$ is
endowed with a topology such that addition $M \times M \to M$,
$(x, y) \mapsto x + y$ and inverse $M \to M$, $x \mapsto -x$ are
continuous. A {\it homomorphism of topological abelian groups}
is just a homomorphism of abelian groups which is continuous.
The category of commutative topological groups is additive and
has kernels and cokernels, but is not abelian (as the axiom
$\Im = \Coim$ doesn't hold). If $N \subset M$ is a
subgroup, then we think of $N$ and $M/N$ as topological groups
also, namely using the induced topology on $N$ and the quotient
topology on $M/N$ (i.e., such that $M \to M/N$ is submersive).
Note that if $N \subset M$ is an open subgroup, then the topology
on $M/N$ is discrete.

\medskip\noindent
We say the topology on $M$ is {\it linear} if there exists a fundamental
system of neighbourhoods of $0$ consisting of subgroups. If so then these
subgroups are also open. An example is the following. Let $I$ be a directed set
and let $G_i$ be an inverse system of (discrete)
abelian groups over $I$. Then
$$
G = \lim_{i \in I} G_i
$$
with the inverse limit topology is linearly topologized with a fundamental
system of neighbourhoods of $0$ given by $\Ker(G \to G_i)$.
Conversely, let $M$ be a linearly topologized abelian group.
Choose any fundamental system of open subgroups $U_i \subset M$, $i \in I$
(i.e., the $U_i$ form a fundamental system of open neighbourhoods and
each $U_i$ is a subgroup of $M$). Setting
$i \geq i' \Leftrightarrow U_i \subset U_{i'}$ we see that $I$
is a directed set. We obtain a homomorphism of
linearly topologized abelian groups
$$
c : M \longrightarrow \lim_{i \in I} M/U_i.
$$
It is clear that $M$ is {\it separated} (as a topological space)
if and only if $c$ is injective. We say that $M$ is {\it complete}
if $c$ is an isomorphism\footnote{We include being separated as part
of being complete as we'd like to have a unique limits in complete
groups. There is a definition of completeness for any topological group,
agreeing, modulo the separation issue, with this one in our special case.}.
We leave it to the reader to check that this condition is independent of
the choice of fundamental system of open subgroups $\{U_i\}_{i \in I}$
chosen above. In fact the topological abelian group
$M^\wedge = \lim_{i \in I} M/U_i$ is independent of this
choice and is sometimes called the {\it completion} of $M$.
Any $G = \lim G_i$ as above is complete, in particular,
the completion $M^\wedge$ is always complete.

\begin{definition}[Topological rings]
\label{definition-topological-ring}
\begin{reference}
\cite[Chapter 0, Sections 7.1 and 7.2]{EGA1}
\end{reference}
Let $R$ be a ring and let $M$ be an $R$-module.
\begin{enumerate}
\item We say $R$ is a {\it topological ring} if $R$ is endowed with a topology
such that both addition and multiplication are continuous as maps
$R \times R \to R$ where $R \times R$ has the product topology.
In this case we say $M$ is a {\it topological module} if $M$ is endowed
with a topology such that addition $M \times M \to M$ and
scalar multiplication $R \times M \to M$ are continuous.
\item A {\it homomorphism of topological modules} is just a continuous
$R$-module map. A {\it homomorphism of topological rings} is a
ring homomorphism which is continuous for the given topologies.
\item We say $M$ is {\it linearly topologized} if $0$ has a fundamental
system of neighbourhoods consisting of submodules. We say $R$ is
{\it linearly topologized} if $0$ has a fundamental system of neighbourhoods
consisting of ideals.
\item If $R$ is linearly topologized, we say that $I \subset R$ is an
{\it ideal of definition} if $I$ is open and if every neighbourhood
of $0$ contains $I^n$ for some $n$.
\item If $R$ is linearly topologized, we say that $R$ is {\it pre-admissible}
if $R$ has an ideal of definition.
\item If $R$ is linearly topologized, we say that $R$ is {\it admissible} if
it is pre-admissible and
complete\footnote{By our conventions this includes separated.}.
\item If $R$ is linearly topologized, we say that $R$ is {\it pre-adic} if
there exists an ideal of definition $I$ such that $\{I^n\}_{n \geq 0}$
forms a fundamental system of neighbourhoods of $0$.
\item If $R$ is linearly topologized, we say that $R$ is {\it adic} if
$R$ is pre-adic and complete.
\end{enumerate}
Note that a (pre)adic topological ring is the same thing as a (pre)admissible
topological ring which has an ideal of definition $I$ such that $I^n$ is
open for all $n \geq 1$.
\end{definition}

\noindent
Let $R$ be a ring and let $M$ be an $R$-module. Let $I \subset R$ be
an ideal. Then we can consider the linear topology on $R$ which has
$\{I^n\}_{n \geq 0}$ as a fundamental system of neighbourhoods of $0$.
This topology is called the $I$-adic topology; $R$ is a pre-adic
topological ring in the $I$-adic topology\footnote{Thus the $I$-adic
topology is sometimes called the $I$-pre-adic topology.}. Moreover, the
linear topology
on $M$ which has $\{I^nM\}_{n \geq 0}$ as a fundamental system of open
neighbourhoods of $0$ turns $M$ into a topological $R$-module.
This is called the {\it $I$-adic topology} on $M$. We see that
$M$ is $I$-adically complete (as defined in
Algebra, Definition \ref{algebra-definition-complete})
if and only if $M$ is complete in the $I$-adic topology\footnote{
It may happen that the $I$-adic completion $M^\wedge$
is not $I$-adically complete, even though $M^\wedge$
is always complete with respect to the limit topology. If $I$ is finitely
generated then the $I$-adic topology and the limit topology on $M^\wedge$
agree, see Algebra, Lemma \ref{algebra-lemma-hathat-finitely-generated} and
its proof.}.
In particular, we see that $R$ is $I$-adically complete if and
only if $R$ is an adic topological ring in the $I$-adic topology.

\medskip\noindent
As a special case, note that the discrete topology is the $0$-adic
topology and that any ring in the discrete topology is adic.

\begin{lemma}
\label{lemma-continuous}
Let $\varphi : R \to S$ be a ring map.
Let $I \subset R$ and $J \subset S$ be ideals
and endow $R$ with the $I$-adic topology and $S$ with the $J$-adic
topology. Then $\varphi$ is a homomorphism of topological rings
if and only if $\varphi(I^n) \subset J$ for some $n \geq 1$.
\end{lemma}

\begin{proof}
Omitted.
\end{proof}

\begin{lemma}[Baire category theorem]
\label{lemma-baire-category-complete-module}
Let $M$ be a topological abelian group. Assume $M$ is linearly
topologized, complete, and has a countable fundamental system of
neighbourhoods of $0$. If $U_n \subset M$, $n \geq 1$
are open dense subsets, then $\bigcap_{n \geq 1} U_n$ is dense.
\end{lemma}

\begin{proof}
Let $U_n$ be as in the statement of the lemma. After replacing $U_n$ by
$U_1 \cap \ldots \cap U_n$, we may assume that
$U_1 \supset U_2 \supset \ldots$.
Let $M_n$, $n \in \mathbf{N}$ be a fundamental
system of neighbourhoods of $0$. We may assume that
$M_{n + 1} \subset M_n$. Pick $x \in M$. We will show that
for every $k \geq 1$ there exists a $y \in \bigcap_{n \geq 1} U_n$
with $x - y \in M_k$.

\medskip\noindent
To construct $y$ we argue as follows.
First, we pick a $y_1 \in U_1$ with $y_1 \in x + M_k$.
This is possible because $U_1$ is dense and $x + M_k$ is open.
Then we pick a $k_1 > k$ such that $y_1 + M_{k_1} \subset U_1$.
This is possible because $U_1$ is open.
Next, we pick a $y_2 \in U_2$ with $y_2 \in y_1 + M_{k_1}$.
This is possible because $U_2$ is dense and $y_2 + M_{k_1}$ is open.
Then we pick a $k_2 > k_1$ such that $y_2 + M_{k_2} \subset U_2$.
This is possible because $U_2$ is open.

\medskip\noindent
Continuing in this fashion we get a converging sequence
$y_i$ of elements of $M$ with limit $y$. By construction
$x - y \in M_k$. Since
$$
y - y_i = (y_{i + 1} - y_i) + (y_{i + 2} - y_{i + 1}) + \ldots
$$
is in $M_{k_i}$ we see that $y \in y_i + M_{k_i} \subset U_i$
for all $i$ as desired.
\end{proof}

\begin{lemma}
\label{lemma-consequence-baire-complete-module}
With same assumptions as Lemma \ref{lemma-baire-category-complete-module}
if $M = \bigcup_{n \geq 1} N_n$ for some closed subgroups $N_n$,
then $N_n$ is open for some $n$.
\end{lemma}

\begin{proof}
If not, then $U_n = M \setminus N_n$ is dense for all $n$ and
we get a contradiction with Lemma \ref{lemma-baire-category-complete-module}.
\end{proof}

\begin{lemma}[Open mapping lemma]
\label{lemma-open-mapping}
Let $u : N \to M$ be a continuous map of linearly topologized
abelian groups. Assume that $N$ is complete, $M$ separated,
and $N$ has a countable fundamental system of neighbourhoods of $0$.
Then exactly one of the following holds
\begin{enumerate}
\item $u$ is open, or
\item for some open subgroup $N' \subset N$ the image
$u(N')$ is nowhere dense in $M$.
\end{enumerate}
\end{lemma}

\begin{proof}
Let $N_n$, $n \in \mathbf{N}$ be a fundamental system of neighbourhoods of $0$.
We may assume that $N_{n + 1} \subset N_n$. If (2) does not hold, then
the closure $M_n$ of $u(N_n)$ is an open subgroup for $n = 1, 2, 3, \ldots$.
Since $u$ is continuous, we see that $M_n$, $n \in \mathbf{N}$
must be a fundamental system of open neighbourhoods of $0$ in $M$.
Also, since $M_n$ is the closure of $u(N_n)$ we see that
$$
u(N_n) + M_{n + 1} = M_n
$$
for all $n \geq 1$. Pick $x_1 \in M_1$. Then we can inductively choose
$y_i \in N_i$ and $x_{i + 1} \in M_{i + 1}$ such that
$$
u(y_i) + x_{i + 1} = x_i
$$
The element $y = y_1 + y_2 + y_3 + \ldots$ of $N$ exists because
$N$ is complete. Whereupon we see that $x = u(y)$ because $M$ is separated.
Thus $M_1 = u(N_1)$. In exactly the same way the reader shows that
$M_i = u(N_i)$ for all $i \geq 2$ and we see that $u$ is open.
\end{proof}









\section{Formally smooth maps of topological rings}
\label{section-formally-smooth}

\noindent
There is a version of formal smoothness which applies to
homomorphisms of topological rings.

\begin{definition}
\label{definition-formally-smooth}
Let $R \to S$ be a homomorphism of topological rings with $R$ and $S$
linearly topologized. We say $S$ is {\it formally smooth over $R$} if
for every commutative solid diagram
$$
\xymatrix{
S \ar[r] \ar@{-->}[rd] & A/J \\
R \ar[r] \ar[u] & A \ar[u]
}
$$
of homomorphisms of topological rings where $A$ is a discrete ring and
$J \subset A$ is an ideal of square zero, a dotted arrow exists which
makes the diagram commute.
\end{definition}

\noindent
We will mostly use this notion when given ideals $\mathfrak m \subset R$
and $\mathfrak n \subset S$ and we endow $R$ with the $\mathfrak m$-adic
topology and $S$ with the $\mathfrak n$-adic topology. Continuity of
$\varphi : R \to S$ holds if and only if
$\varphi(\mathfrak m^m) \subset  \mathfrak n$ for some $m \geq 1$, see
Lemma \ref{lemma-continuous}. It turns out that
in this case only the topology on $S$ is relevant.

\begin{lemma}
\label{lemma-formally-smooth}
Let $\varphi : R \to S$ be a ring map.
\begin{enumerate}
\item If $R \to S$ is formally smooth in
the sense of Algebra, Definition \ref{algebra-definition-formally-smooth},
then $R \to S$ is formally smooth for any linear topology on $R$ and
any pre-adic topology on $S$ such that $R \to S$ is continuous.
\item Let $\mathfrak n \subset S$ and $\mathfrak m \subset R$
ideals such that $\varphi$ is continuous for the $\mathfrak m$-adic
topology on $R$ and the $\mathfrak n$-adic topology
on $S$. Then the following are equivalent
\begin{enumerate}
\item $\varphi$ is formally smooth for the $\mathfrak m$-adic topology on
$R$ and the $\mathfrak n$-adic topology on $S$, and
\item $\varphi$ is formally smooth for the discrete topology
on $R$ and the $\mathfrak n$-adic topology on $S$.
\end{enumerate}
\end{enumerate}
\end{lemma}

\begin{proof}
Assume $R \to S$ is formally smooth in
the sense of Algebra, Definition \ref{algebra-definition-formally-smooth}.
If $S$ has a pre-adic topology, then
there exists an ideal $\mathfrak n \subset S$ such that $S$ has the
$\mathfrak n$-adic topology. Suppose given a solid commutative diagram as in
Definition \ref{definition-formally-smooth}.
Continuity of $S \to A/J$ means that $\mathfrak n^k$ maps to zero
in $A/J$ for some $k \geq 1$, see Lemma \ref{lemma-continuous}.
We obtain a ring map $\psi : S \to A$ from the assumed formal smoothness of
$S$ over $R$. Then $\psi(\mathfrak n^k) \subset J$ hence
$\psi(\mathfrak n^{2k}) = 0$ as $J^2 = 0$. Hence $\psi$ is continuous by
Lemma \ref{lemma-continuous}. This proves (1).

\medskip\noindent
The proof of (2)(b) $\Rightarrow$ (2)(a) is the same as the proof of (1).
Assume (2)(a). Suppose given a solid commutative diagram as in
Definition \ref{definition-formally-smooth} where we use the discrete
topology on $R$. Since $\varphi$ is continuous we see that
$\varphi(\mathfrak m^n) \subset \mathfrak n$ for some $n \geq 1$.
As $S \to A/J$ is continuous we see that $\mathfrak n^k$ maps to
zero in $A/J$ for some $k \geq 1$. Hence $\mathfrak m^{nk}$ maps
into $J$ under the map $R \to A$. Thus $\mathfrak m^{2nk}$ maps to zero
in $A$ and we see that $R \to A$ is continuous in the $\mathfrak m$-adic
topology. Thus (2)(a) gives a dotted arrow as desired.
\end{proof}

\begin{definition}
\label{definition-formally-smooth-adic}
Let $R \to S$ be a ring map. Let $\mathfrak n \subset S$ be an
ideal. If the equivalent conditions (2)(a) and (2)(b) of
Lemma \ref{lemma-formally-smooth} hold, then we say
$R \to S$ is {\it formally smooth for the $\mathfrak n$-adic topology}.
\end{definition}

\noindent
This property is inherited by the completions.

\begin{lemma}
\label{lemma-formally-smooth-completion}
Let $(R, \mathfrak m)$ and $(S, \mathfrak n)$ be rings endowed
with finitely generated ideals. Endow $R$ and $S$ with the
$\mathfrak m$-adic and $\mathfrak n$-adic topologies.
Let $R \to S$ be a homomorphism of topological rings.
The following are equivalent
\begin{enumerate}
\item $R \to S$ is formally smooth for the $\mathfrak n$-adic topology,
\item $R \to S^\wedge$ is formally smooth for the $\mathfrak n^\wedge$-adic
topology,
\item $R^\wedge \to S^\wedge$ is formally smooth for the
$\mathfrak n^\wedge$-adic topology.
\end{enumerate}
Here $R^\wedge$ and $S^\wedge$ are the $\mathfrak m$-adic and
$\mathfrak n$-adic completions of $R$ and $S$.
\end{lemma}

\begin{proof}
The assumption that $\mathfrak m$ is finitely generated implies that
$R^\wedge$ is $\mathfrak mR^\wedge$-adically complete, that
$\mathfrak mR^\wedge = \mathfrak m^\wedge$ and that
$R^\wedge/\mathfrak m^nR^\wedge = R/\mathfrak m^n$,
see Algebra, Lemma \ref{algebra-lemma-hathat-finitely-generated}
and its proof. Similarly for $(S, \mathfrak n)$. Thus it is clear that
diagrams as in Definition \ref{definition-formally-smooth}
for the cases (1), (2), and (3) are in 1-to-1 correspondence.
\end{proof}

\noindent
The advantage of working with adic rings is that one gets a
stronger lifting property.

\begin{lemma}
\label{lemma-lift-continuous}
Let $R \to S$ be a ring map. Let $\mathfrak n$ be an ideal of $S$.
Assume that $R \to S$ is formally smooth in the $\mathfrak n$-adic
topology. Consider a solid commutative diagram
$$
\xymatrix{
S \ar[r]_\psi \ar@{-->}[rd] & A/J \\
R \ar[r] \ar[u] & A \ar[u]
}
$$
of homomorphisms of topological rings where $A$ is adic
and $A/J$ is the quotient (as topological ring) of $A$ by a closed ideal
$J \subset A$ such that $J^t$ is contained in an ideal of definition
of $A$ for some $t \geq 1$. Then there exists a dotted arrow in the category of
topological rings which makes the diagram commute.
\end{lemma}

\begin{proof}
Let $I \subset A$ be an ideal of definition so that $I \supset J^t$
for some $n$. Then $A = \lim A/I^n$ and $A/J = \lim A/J + I^n$
because $J$ is assumed closed. Consider the following diagram of
discrete $R$ algebras $A_{n, m} = A/J^n + I^m$:
$$
\xymatrix{
A/J^3 + I^3 \ar[r] \ar[d] &
A/J^2 + I^3 \ar[r] \ar[d] &
A/J + I^3 \ar[d] \\
A/J^3 + I^2 \ar[r] \ar[d] &
A/J^2 + I^2 \ar[r] \ar[d] &
A/J + I^2 \ar[d] \\
A/J^3 + I \ar[r] &
A/J^2 + I \ar[r] &
A/J + I
}
$$
Note that each of the commutative squares defines a surjection
$$
A_{n + 1, m + 1} \longrightarrow A_{n + 1, m} \times_{A_{n, m}} A_{n, m + 1}
$$
of $R$-algebras whose kernel has square zero.
We will inductively construct $R$-algebra maps
$\varphi_{n, m} : S \to A_{n, m}$.
Namely, we have the maps $\varphi_{1, m} = \psi \bmod J + I^m$.
Note that each of these maps is continuous as $\psi$ is.
We can inductively choose the maps $\varphi_{n, 1}$ by starting
with our choice of $\varphi_{1, 1}$ and lifting up, using the
formal smoothness of $S$ over $R$, along the right column of the
diagram above. We construct the remaining maps $\varphi_{n, m}$
by induction on $n + m$. Namely, we choose $\varphi_{n + 1, m + 1}$
by lifting the pair $(\varphi_{n + 1, m}, \varphi_{n, m + 1})$
along the displayed surjection above (again using the formal smoothness
of $S$ over $R$). In this way all of the maps $\varphi_{n, m}$ are
compatible with the transition maps of the system.
As $J^t \subset I$ we see that for example
$\varphi_n = \varphi_{nt, n} \bmod I^n$ induces a map $S \to A/I^n$.
Taking the limit $\varphi = \lim \varphi_n$ we obtain a map
$S \to A = \lim A/I^n$. The composition into $A/J$ agrees
with $\psi$ as we have seen that $A/J = \lim A/J + I^n$.
Finally we show that $\varphi$ is continuous. Namely, we know that
$\psi(\mathfrak n^r) \subset J + I/J$ for some $r \geq 1$ by our
assumption that $\psi$ is a morphism of topological rings, see
Lemma \ref{lemma-continuous}. Hence $\varphi(\mathfrak n^r) \subset J + I$
hence $\varphi(\mathfrak n^{rt}) \subset I$ as desired.
\end{proof}

\begin{lemma}
\label{lemma-increase-ideal}
Let $R \to S$ be a ring map. Let $\mathfrak n \subset \mathfrak n' \subset S$
be ideals. If $R \to S$ is formally smooth for the $\mathfrak n$-adic
topology, then $R \to S$ is formally smooth for the $\mathfrak n'$-adic
topology.
\end{lemma}

\begin{proof}
Omitted.
\end{proof}

\begin{lemma}
\label{lemma-compose-formally-smooth}
A composition of formally smooth continuous homomorphisms of linearly
topologized rings is formally smooth.
\end{lemma}

\begin{proof}
Omitted. (Hint: This is completely formal, and follows from considering
a suitable diagram.)
\end{proof}

\begin{lemma}
\label{lemma-base-change-fs}
Let $R$, $S$ be rings. Let $\mathfrak n \subset S$ be an ideal.
Let $R \to S$ be formally smooth for the $\mathfrak n$-adic topology.
Let $R \to R'$ be any ring map. Then $R' \to S' = S \otimes_R R'$
is formally smooth in the $\mathfrak n' = \mathfrak nS'$-adic
topology.
\end{lemma}

\begin{proof}
Let a solid diagram
$$
\xymatrix{
S \ar[r] \ar@{-->}[rrd] & S' \ar[r] \ar@{-->}[rd] & A/J \\
R  \ar[u] \ar[r] & R' \ar[r] \ar[u] & A \ar[u]
}
$$
as in Definition \ref{definition-formally-smooth} be given.
Then the composition $S \to S' \to A/J$ is continuous.
By assumption the longer dotted arrow exists. By the universal
property of tensor product we obtain the shorter dotted arrow.
\end{proof}

\noindent
We have seen descent for formal smoothness along faithfully flat ring
maps in Algebra, Lemma \ref{algebra-lemma-descent-formally-smooth}.
Something similar holds in the current setting of topological rings.
However, here we just prove the following very simple and easy to prove
version which is already quite useful.

\begin{lemma}
\label{lemma-descent-fs}
Let $R$, $S$ be rings. Let $\mathfrak n \subset S$ be an ideal.
Let $R \to R'$ be a ring map. Set $S' = S \otimes_R R'$ and
$\mathfrak n' = \mathfrak nS$. If
\begin{enumerate}
\item the map $R \to R'$ embeds $R$ as a direct summand of $R'$
as an $R$-module, and
\item $R' \to S'$ is formally smooth for the $\mathfrak n'$-adic topology,
\end{enumerate}
then $R \to S$ is formally smooth in the $\mathfrak n$-adic topology.
\end{lemma}

\begin{proof}
Let a solid diagram
$$
\xymatrix{
S \ar[r] & A/J \\
R \ar[u] \ar[r] & A \ar[u]
}
$$
as in Definition \ref{definition-formally-smooth} be given.
Set $A' = A \otimes_R R'$ and $J' = \Im(J \otimes_R R' \to A')$.
The base change of the diagram above is the diagram
$$
\xymatrix{
S' \ar[r] \ar@{-->}[rd]^{\psi'} & A'/J' \\
R' \ar[u] \ar[r] & A' \ar[u]
}
$$
with continuous arrows. By condition (2) we obtain the dotted arrow
$\psi' : S' \to A'$. Using condition (1) choose a direct summand decomposition
$R' = R \oplus C$ as $R$-modules. (Warning: $C$ isn't an ideal in $R'$.)
Then $A' = A \oplus A \otimes_R C$. Set
$$
J'' = \Im(J \otimes_R C \to A \otimes_R C) \subset J' \subset A'.
$$
Then $J' = J \oplus J''$ as $A$-modules. The image of the composition
$\psi : S \to A'$ of $\psi'$ with $S \to S'$ is contained in
$A + J' = A \oplus J''$. However, in the ring $A + J' = A \oplus J''$
the $A$-submodule $J''$ is an ideal! (Use that $J^2 = 0$.) Hence the
composition $S \to A + J' \to (A + J')/J'' = A$ is the arrow we were
looking for.
\end{proof}








\section{Formally smooth maps of local rings}
\label{section-formally-smooth-local}

\noindent
In the case of a local homomorphism of local rings one can
limit the diagrams for which the lifting property has to be checked.
Please compare with Algebra, Lemma \ref{algebra-lemma-smooth-test-artinian}.

\begin{lemma}
\label{lemma-fs-local}
Let $(R, \mathfrak m) \to (S, \mathfrak n)$ be a local homomorphism
of local rings. The following are equivalent
\begin{enumerate}
\item $R \to S$ is formally smooth in the $\mathfrak n$-adic topology,
\item for every solid commutative diagram
$$
\xymatrix{
S \ar[r] \ar@{-->}[rd] & A/J \\
R \ar[r] \ar[u] & A \ar[u]
}
$$
of local homomorphisms of local rings where $J \subset A$ is
an ideal of square zero, $\mathfrak m_A^n = 0$ for some $n > 0$, and
$S \to A/J$ induces an isomorphism on residue fields, a dotted
arrow exists which makes the diagram commute.
\end{enumerate}
If $S$ is Noetherian these conditions are also equivalent to
\begin{enumerate}
\item[(3)] same as in (2) but only for diagrams where in addition
$A \to A/J$ is a small extension
(Algebra, Definition \ref{algebra-definition-small-extension}).
\end{enumerate}
\end{lemma}

\begin{proof}
The implication (1) $\Rightarrow$ (2) follows from the definitions.
Consider a diagram
$$
\xymatrix{
S \ar[r] \ar@{-->}[rd] & A/J \\
R \ar[r] \ar[u] & A \ar[u]
}
$$
as in Definition \ref{definition-formally-smooth} for the
$\mathfrak m$-adic topology on $R$ and the $\mathfrak n$-adic topology on $S$.
Pick $m > 0$ with $\mathfrak n^m(A/J) = 0$
(possible by continuity of maps in diagram).
Consider the subring $A'$ of $A$ which is the inverse image
of the image of $S$ in $A/J$. Set $J' = J$ viewed as an ideal in $A'$.
Then $J'$ is an ideal of square zero in $A'$ and $A'/J'$
is a quotient of $S/\mathfrak n^m$. Hence $A'$ is local
and $\mathfrak m_{A'}^{2m} = 0$. Thus we get a diagram
$$
\xymatrix{
S \ar[r] \ar@{-->}[rd] & A'/J' \\
R \ar[r] \ar[u] & A' \ar[u]
}
$$
as in (2). If we can construct the dotted arrow in this diagram,
then we obtain the dotted arrow in the original one by composing
with $A' \to A$. In this way we see that (2) implies (1).

\medskip\noindent
Assume $S$ Noetherian. The implication (1) $\Rightarrow$ (3) is immediate.
Assume (3) and suppose a diagram as in (2) is given.
Then $\mathfrak m_A^n J = 0$ for some $n > 0$.
Considering the maps
$$
A \to A/\mathfrak m_A^{n - 1}J \to \ldots \to A/\mathfrak mJ \to A/J
$$
we see that it suffices to produce the lifting if $\mathfrak m_A J = 0$.
Assume $\mathfrak m_A J = 0$ and let $A' \subset A$ be the ring
constructed above. Then $A'/J'$ is Artinian
as a quotient of the Artinian local ring $S/\mathfrak n^m$.
Thus it suffices to show that given property (3) we can find the dotted
arrow in diagrams as in (2) with $A/J$ Artinian and
$\mathfrak m_A J = 0$.
Let $\kappa$ be the common residue field of $A$,
$A/J$, and $S$. By (3), if $J_0 \subset J$ is an ideal with
$\dim_\kappa(J/J_0) = 1$, then we can produce a dotted arrow
$S \to A/J_0$. Taking the product we obtain
$$
S \longrightarrow \prod\nolimits_{J_0 \text{ as above}} A/J_0
$$
Clearly the image of this arrow is contained in the sub $R$-algebra
$A'$ of elements which map into the small diagonal
$A/J \subset \prod_{J_0} A/J$.
Let $J' \subset A'$ be the elements mapping to zero in $A/J$.
Then $J'$ is an ideal of square zero and as $\kappa$-vector space
equal to
$$
J' = \prod\nolimits_{J_0 \text{ as above}} J/J_0
$$
Thus the map $J \to J'$ is injective. By the theory of vector spaces
we can choose a splitting $J' = J \oplus M$. It follows that
$$
A' = A \oplus M
$$
as an $R$-algebra. Hence the map $S \to A'$ can be composed with
the projection $A' \to A$ to give the desired dotted arrow thereby
finishing the proof of the lemma.
\end{proof}

\noindent
The following lemma will be improved on in
Section \ref{section-regular-fs}.

\begin{lemma}
\label{lemma-fs-implies-regular}
Let $k$ be a field and let $(A, \mathfrak m, K)$ be a Noetherian
local $k$-algebra. If $k \to A$ is formally smooth for the
$\mathfrak m$-adic topology, then $A$ is a regular local ring.
\end{lemma}

\begin{proof}
Let $k_0 \subset k$ be the prime field. Then $k_0$ is perfect, hence
$k / k_0$ is separable, hence formally smooth by
Algebra, Lemma \ref{algebra-lemma-formally-smooth-extensions-easy}. By
Lemmas \ref{lemma-formally-smooth} and \ref{lemma-compose-formally-smooth}
we see that $k_0 \to A$ is formally smooth for the $\mathfrak m$-adic
topology on $A$. Hence we may assume $k = \mathbf{Q}$ or $k = \mathbf{F}_p$.

\medskip\noindent
By Algebra, Lemmas \ref{algebra-lemma-completion-faithfully-flat} and
\ref{algebra-lemma-flat-under-regular} it
suffices to prove the completion $A^\wedge$ is regular.
By Lemma \ref{lemma-formally-smooth-completion} we may replace
$A$ by $A^\wedge$. Thus we may assume that $A$ is a Noetherian
complete local ring. By the Cohen structure theorem
(Algebra, Theorem \ref{algebra-theorem-cohen-structure-theorem})
there exist a map $K \to A$. As $k$ is the prime field we see that
$K \to A$ is a $k$-algebra map.

\medskip\noindent
Let $x_1, \ldots, x_n \in \mathfrak m$ be elements whose images
form a basis of $\mathfrak m/\mathfrak m^2$.
Set $T = K[[X_1, \ldots, X_n]]$. Note that
$$
A/\mathfrak m^2 \cong K[x_1, \ldots, x_n]/(x_ix_j)
$$
and
$$
T/\mathfrak m_T^2 \cong K[X_1, \ldots, X_n]/(X_iX_j).
$$
Let $A/\mathfrak m^2 \to T/m_T^2$ be the local $K$-algebra isomorphism
given by mapping the class of $x_i$ to the class of $X_i$.
Denote $f_1 : A \to T/\mathfrak m_T^2$ the composition of this
isomorphism with the quotient map $A \to A/\mathfrak m^2$.
The assumption that $k \to A$ is formally smooth in the $\mathfrak m$-adic
topology means we can lift $f_1$ to a map
$f_2 : A \to T/\mathfrak{m}_T^3$, then to a map
$f_3 : A \to T/\mathfrak{m}_T^4$, and so on, for all $n \geq 1$.
Warning: the maps $f_n$ are continuous $k$-algebra maps and may not
be $K$-algebra maps. We get an induced map
$f : A \to T = \lim T/\mathfrak m_T^n$ of local $k$-algebras.
By our choice of $f_1$, the map $f$ induces an
isomorphism $\mathfrak m/\mathfrak m^2 \to \mathfrak m_T/\mathfrak m_T^2$
hence each $f_n$ is surjective and we conclude $f$ is surjective as $A$ is
complete. This implies $\dim(A) \geq \dim(T) = n$. Hence $A$ is regular
by definition. (It also follows that $f$ is an isomorphism.)
\end{proof}

\begin{lemma}
\label{lemma-lift-residue-field}
Let $k$ be a field. Let $(A, \mathfrak m, \kappa)$ be a complete
local $k$-algebra. If $\kappa/k$ is separable, then there exists
a $k$-algebra map $\kappa \to A$ such that $\kappa \to A \to \kappa$
is $\text{id}_\kappa$.
\end{lemma}

\begin{proof}
By Algebra, Proposition
\ref{algebra-proposition-characterize-separable-field-extensions}
the extension $\kappa/k$ is formally smooth. By
Lemma \ref{lemma-formally-smooth}
$k \to \kappa$ is formally smooth in the sense of
Definition \ref{definition-formally-smooth}.
Then we get $\kappa \to A$ from Lemma \ref{lemma-lift-continuous}.
\end{proof}

\begin{lemma}
\label{lemma-power-series-over-residue-field}
Let $k$ be a field. Let $(A, \mathfrak m, \kappa)$ be a complete
local $k$-algebra. If $\kappa/k$ is separable and $A$ regular, then
there exists an isomorphism of $A \cong \kappa[[t_1, \ldots, t_d]]$
as $k$-algebras.
\end{lemma}

\begin{proof}
Choose $\kappa \to A$ as in Lemma \ref{lemma-lift-residue-field}
and apply Algebra, Lemma
\ref{algebra-lemma-regular-complete-containing-coefficient-field}.
\end{proof}

\noindent
The following result will be improved on in
Section \ref{section-regular-fs}

\begin{lemma}
\label{lemma-regular-implies-fs}
Let $k$ be a field. Let $(A, \mathfrak m, K)$ be a regular local
$k$-algebra such that $K/k$ is separable. Then $k \to A$
is formally smooth in the $\mathfrak m$-adic topology.
\end{lemma}

\begin{proof}
It suffices to prove that the completion of $A$ is formally
smooth over $k$, see Lemma \ref{lemma-formally-smooth-completion}.
Hence we may assume that $A$ is a complete local regular $k$-algebra
with residue field $K$ separable over $k$.
By Lemma \ref{lemma-power-series-over-residue-field} we see that
$A = K[[x_1, \ldots, x_n]]$.

\medskip\noindent
The power series ring $K[[x_1, \ldots, x_n]]$ is formally
smooth over $k$. Namely, $K$ is formally smooth over $k$ and
$K[x_1, \ldots, x_n]$ is formally smooth over $K$ as a polynomial algebra.
Hence $K[x_1, \ldots, x_n]$ is formally smooth over $k$ by
Algebra, Lemma \ref{algebra-lemma-compose-formally-smooth}.
It follows that $k \to K[x_1, \ldots, x_n]$ is formally smooth
for the $(x_1, \ldots, x_n)$-adic topology by
Lemma \ref{lemma-formally-smooth}.
Finally, it follows that $k \to K[[x_1, \ldots, x_n]]$ is formally
smooth for the $(x_1, \ldots, x_n)$-adic topology by
Lemma \ref{lemma-formally-smooth-completion}.
\end{proof}

\begin{lemma}
\label{lemma-formally-smooth-finite-type}
Let $A \to B$ be a finite type ring map with $A$ Noetherian.
Let $\mathfrak q \subset B$ be a prime ideal lying over
$\mathfrak p \subset A$. The following are equivalent
\begin{enumerate}
\item $A \to B$ is smooth at $\mathfrak q$, and
\item $A_\mathfrak p \to B_\mathfrak q$ is formally smooth in
the $\mathfrak q$-adic topology.
\end{enumerate}
\end{lemma}

\begin{proof}
The implication (2) $\Rightarrow$ (1) follows from
Algebra, Lemma \ref{algebra-lemma-smooth-test-artinian}.
Conversely, if $A \to B$ is smooth at $\mathfrak q$, then
$A \to B_g$ is smooth for some $g \in B$, $g \not \in \mathfrak q$.
Then $A \to B_g$ is formally smooth by
Algebra, Proposition \ref{algebra-proposition-smooth-formally-smooth}.
Hence $A_\mathfrak p \to B_\mathfrak q$ is formally smooth
as localization preserves formal smoothness (for example by
the criterion of Algebra, Proposition
\ref{algebra-proposition-characterize-formally-smooth}
and the fact that the cotangent complex behaves well with respect to
localization, see
Algebra, Lemmas \ref{algebra-lemma-NL-localize-bottom} and
\ref{algebra-lemma-localize-NL}).
Finally, Lemma \ref{lemma-formally-smooth} implies that
$A_\mathfrak p \to B_\mathfrak q$ is formally smooth in the
$\mathfrak q$-adic topology.
\end{proof}









\section{Some results on power series rings}
\label{section-power-series}

\noindent
Questions on formally smooth maps between Noetherian local rings
can often be reduced to questions on maps between power series
rings. In this section we prove some helper lemmas to facilitate
this kind of argument.

\begin{lemma}
\label{lemma-power-series-ring-over-Cohen-fs}
Let $K$ be a field of characteristic $0$ and $A = K[[x_1, \ldots, x_n]]$.
Let $L$ be a field of characteristic $p > 0$ and $B = L[[x_1, \ldots, x_n]]$.
Let $\Lambda$ be a Cohen ring. Let $C = \Lambda[[x_1, \ldots, x_n]]$.
\begin{enumerate}
\item $\mathbf{Q} \to A$ is formally smooth in the 
$\mathfrak m$-adic topology.
\item $\mathbf{F}_p \to B$ is formally smooth in the 
$\mathfrak m$-adic topology.
\item $\mathbf{Z} \to C$ is formally smooth in the
$\mathfrak m$-adic topology.
\end{enumerate}
\end{lemma}

\begin{proof}
By the universal property of power series rings it suffices to prove:
\begin{enumerate}
\item $\mathbf{Q} \to K$ is formally smooth.
\item $\mathbf{F}_p \to L$ is formally smooth.
\item $\mathbf{Z} \to \Lambda$ is formally smooth in the
$\mathfrak m$-adic topology.
\end{enumerate}
The first two are
Algebra, Proposition
\ref{algebra-proposition-characterize-separable-field-extensions}.
The third follows from
Algebra, Lemma \ref{algebra-lemma-cohen-ring-formally-smooth}
since for any test diagram as in Definition \ref{definition-formally-smooth}
some power of $p$ will be zero in $A/J$ and hence some power of $p$ will
be zero in $A$.
\end{proof}

\begin{lemma}
\label{lemma-quotient-power-series-ring-over-Cohen}
Let $K$ be a field and $A = K[[x_1, \ldots, x_n]]$.
Let $\Lambda$ be a Cohen ring and let $B = \Lambda[[x_1, \ldots, x_n]]$.
\begin{enumerate}
\item If $y_1, \ldots, y_n \in A$ is a regular system of parameters
then $K[[y_1, \ldots, y_n]] \to A$ is an isomorphism.
\item If $z_1, \ldots, z_r \in A$ form part of a regular system of
parameters for $A$, then $r \leq n$ and
$A/(z_1, \ldots, z_r) \cong K[[y_1, \ldots, y_{n - r}]]$.
\item If $p, y_1, \ldots, y_n \in B$ is a regular system of parameters
then $\Lambda[[y_1, \ldots, y_n]] \to B$ is an isomorphism.
\item If $p, z_1, \ldots, z_r \in B$ form part of a regular system of
parameters for $B$, then $r \leq n$ and
$B/(z_1, \ldots, z_r) \cong \Lambda[[y_1, \ldots, y_{n - r}]]$.
\end{enumerate}
\end{lemma}

\begin{proof}
Proof of (1). Set $A' = K[[y_1, \ldots, y_n]]$. It is clear that
the map $A' \to A$ induces an isomorphism
$A'/\mathfrak m_{A'}^n \to A/\mathfrak m_A^n$ for all $n \geq 1$.
Since $A$ and $A'$ are both complete we deduce that $A' \to A$ is an
isomorphism.
Proof of (2). Extend $z_1, \ldots, z_r$ to a regular system of parameters
$z_1, \ldots, z_r, y_1, \ldots, y_{n - r}$ of $A$. Consider the map
$A' = K[[z_1, \ldots, z_r, y_1, \ldots, y_{n - r}]] \to A$.
This is an isomorphism by (1). Hence (2) follows as it is clear that
$A'/(z_1, \ldots, z_r) \cong K[[y_1, \ldots, y_{n - r}]]$.
The proofs of (3) and (4) are exactly the same as the proofs of (1) and (2).
\end{proof}

\begin{lemma}
\label{lemma-embed-map-Noetherian-complete-local-rings}
Let $A \to B$ be a local homomorphism of Noetherian complete local rings.
Then there exists a commutative diagram
$$
\xymatrix{
S \ar[r] & B \\
R \ar[u] \ar[r] & A \ar[u]
}
$$
with the following properties:
\begin{enumerate}
\item the horizontal arrows are surjective,
\item if the characteristic of $A/\mathfrak m_A$ is zero, then $S$ and $R$
are power series rings over fields,
\item if the characteristic of $A/\mathfrak m_A$ is $p > 0$, then $S$ and $R$
are power series rings over Cohen rings, and
\item $R \to S$ maps a regular system of parameters of $R$ to part of a
regular system of parameters of $S$.
\end{enumerate}
In particular $R \to S$ is flat (see Algebra,
Lemma \ref{algebra-lemma-flat-over-regular}) with regular fibre
$S/\mathfrak m_R S$ (see Algebra, Lemma \ref{algebra-lemma-regular-ring-CM}).
\end{lemma}

\begin{proof}
Use the Cohen structure theorem
(Algebra, Theorem \ref{algebra-theorem-cohen-structure-theorem})
to choose a surjection $S \to B$ as in the statement of the lemma
where we choose $S$ to be a power series over a Cohen ring if the
residue characteristic is $p > 0$ and a power series over a field else.
Let $J \subset S$ be the kernel of $S \to B$.
Next, choose a surjection $R = \Lambda[[x_1, \ldots, x_n]] \to A$ where
we choose $\Lambda$ to be a Cohen ring if the residue characteristic of
$A$ is $p > 0$ and $\Lambda$ equal to the residue field of $A$ otherwise.
We lift the composition $\Lambda[[x_1, \ldots, x_n]] \to A \to B$
to a map $\varphi : R \to S$. This is possible because
$\Lambda[[x_1, \ldots, x_n]]$ is formally smooth over $\mathbf{Z}$
in the $\mathfrak m$-adic topology (see
Lemma \ref{lemma-power-series-ring-over-Cohen-fs})
by an application of Lemma \ref{lemma-lift-continuous}.
Finally, we replace $\varphi$ by the map
$\varphi' : R = \Lambda[[x_1, \ldots, x_n]] \to S' = S[[y_1, \ldots, y_n]]$
with $\varphi'|_\Lambda = \varphi|_\Lambda$ and
$\varphi'(x_i) = \varphi(x_i) + y_i$. We also replace $S \to B$
by the map $S' \to B$ which maps $y_i$ to zero. After this replacement
it is clear that a regular system of parameters of $R$ maps to part of a
regular sequence in $S'$ and we win.
\end{proof}

\noindent
There should be an elementary proof of the following lemma.

\begin{lemma}
\label{lemma-dominate-two-surjections}
Let $S \to R$ and $S' \to R$ be surjective maps of complete Noetherian local
rings. Then $S \times_R S'$ is a complete Noetherian local ring.
\end{lemma}

\begin{proof}
Let $k$ be the residue field of $R$. If the characteristic of
$k$ is $p > 0$, then we denote $\Lambda$ a Cohen ring
(Algebra, Definition \ref{algebra-definition-cohen-ring})
with residue field $k$ (Algebra, Lemma \ref{algebra-lemma-cohen-rings-exist}).
If the characteristic of $k$ is $0$ we set $\Lambda = k$.
Choose a surjection $\Lambda[[x_1, \ldots, x_n]] \to R$
(as in the Cohen structure theorem, see
Algebra, Theorem \ref{algebra-theorem-cohen-structure-theorem})
and lift this to maps $\Lambda[[x_1, \ldots, x_n]] \to S$ and
$\varphi : \Lambda[[x_1, \ldots, x_n]] \to S$ and
$\varphi' : \Lambda[[x_1, \ldots, x_n]] \to S'$ using
Lemmas \ref{lemma-power-series-ring-over-Cohen-fs} and
\ref{lemma-lift-continuous}.
Next, choose $f_1, \ldots, f_m \in S$ generating the kernel
of $S \to R$ and $f'_1, \ldots, f'_{m'} \in S'$ generating the
kernel of $S' \to R$. Then the map
$$
\Lambda[[x_1, \ldots, x_n, y_1, \ldots, y_m, z_1, \ldots, z_{m'}]]
\longrightarrow S \times_R S,
$$
which sends $x_i$ to $(\varphi(x_i), \varphi'(x_i))$ and
$y_j$ to $(f_j, 0)$ and
$z_{j'}$ to $(0, f'_j)$
is surjective. Thus $S \times_R S'$ is a quotient of a complete
local ring, whence complete.
\end{proof}






\section{Geometric regularity and formal smoothness}
\label{section-regular-fs}

\noindent
In this section we combine the results of the previous
sections to prove the following characterization of geometrically
regular local rings over fields. We then recycle some of our
arguments to prove a characterization of formally smooth
maps in the $\mathfrak m$-adic topology between Noetherian local
rings.

\begin{theorem}
\label{theorem-regular-fs}
Let $k$ be a field. Let $(A, \mathfrak m, K)$ be a Noetherian local
$k$-algebra. If the characteristic of $k$ is zero then the following
are equivalent
\begin{enumerate}
\item $A$ is a regular local ring, and
\item $k \to A$ is formally smooth in the $\mathfrak m$-adic topology.
\end{enumerate}
If the characteristic of $k$ is $p > 0$ then the following are equivalent
\begin{enumerate}
\item $A$ is geometrically regular over $k$,
\item $k \to A$ is formally smooth in the $\mathfrak m$-adic topology.
\item for all $k \subset k' \subset k^{1/p}$
finite over $k$ the ring $A \otimes_k k'$ is regular,
\item $A$ is regular and the canonical map
$H_1(L_{K/k}) \to \mathfrak m/\mathfrak m^2$ is injective, and
\item $A$ is regular and the map
$\Omega_{k/\mathbf{F}_p} \otimes_k K \to \Omega_{A/\mathbf{F}_p} \otimes_A K$
is injective.
\end{enumerate}
\end{theorem}

\begin{proof}
If the characteristic of $k$ is zero, then the equivalence of (1) and (2)
follows from
Lemmas \ref{lemma-fs-implies-regular} and \ref{lemma-regular-implies-fs}.

\medskip\noindent
If the characteristic of $k$ is $p > 0$, then it follows from
Proposition \ref{proposition-characterization-geometrically-regular}
that (1), (3), (4), and (5) are equivalent. Assume (2) holds.
By Lemma \ref{lemma-base-change-fs} we see that
$k' \to A' = A \otimes_k k'$ is formally smooth for the
$\mathfrak m' = \mathfrak mA'$-adic topology. Hence if $k \subset k'$ is
finite purely inseparable, then $A'$ is a regular local ring by
Lemma \ref{lemma-fs-implies-regular}. Thus we see that (1) holds.

\medskip\noindent
Finally, we will prove that (5) implies (2). Choose a solid diagram
$$
\xymatrix{
A \ar[r]_{\bar\psi} \ar@{-->}[rd] & B/J \\
k \ar[u]^i \ar[r]^\varphi & B \ar[u]_\pi
}
$$
as in Definition \ref{definition-formally-smooth}. As $J^2 = 0$ we see
that $J$ has a canonical $B/J$ module structure and via $\bar\psi$ an
$A$-module structure. As $\bar\psi$ is continuous for the
$\mathfrak m$-adic topology we see that $\mathfrak m^nJ = 0$ for some $n$.
Hence we can filter $J$ by $B/J$-submodules
$0 \subset J_1 \subset J_2 \subset \ldots \subset J_n = J$
such that each quotient $J_{t + 1}/J_t$ is annihilated by $\mathfrak m$.
Considering the sequence of ring maps
$B \to B/J_1 \to B/J_2 \to \ldots \to B/J$
we see that it suffices to prove the existence of the dotted arrow when
$J$ is annihilated by $\mathfrak m$, i.e., when $J$ is a $K$-vector space.

\medskip\noindent
Assume given a diagram as above such that $J$ is annihilated by $\mathfrak m$.
By Lemma \ref{lemma-regular-implies-fs} we see that $\mathbf{F}_p \to A$ is
formally smooth in the $\mathfrak m$-adic topology. Hence we can find a ring
map $\psi : A \to B$ such that $\pi \circ \psi = \bar \psi$. Then
$\psi \circ i, \varphi : k \to B$ are two maps whose compositions with $\pi$
are equal. Hence $D = \psi \circ i - \varphi : k \to J$ is a derivation.
By Algebra, Lemma \ref{algebra-lemma-universal-omega} we can write
$D = \xi \circ \text{d}$ for some $k$-linear map
$\xi : \Omega_{k/\mathbf{F}_p} \to J$. Using the $K$-vector space structure
on $J$ we extend $\xi$ to a $K$-linear map
$\xi' : \Omega_{k/\mathbf{F}_p} \otimes_k K \to J$.
Using (5) we can find a $K$-linear map
$\xi'' : \Omega_{A/\mathbf{F}_p} \otimes_A K$ whose restriction to
$\Omega_{k/\mathbf{F}_p} \otimes_k K$ is $\xi'$. Write
$$
D' : A \xrightarrow{\text{d}} \Omega_{A/\mathbf{F}_p}
\to \Omega_{A/\mathbf{F}_p} \otimes_A K \xrightarrow{\xi''} J.
$$
Finally, set $\psi' = \psi - D' : A \to B$. The reader verifies that $\psi'$
is a ring map such that $\pi \circ \psi' = \bar \psi$ and such that
$\psi' \circ i = \varphi$ as desired.
\end{proof}

\begin{example}
\label{example-fs}
Let $k$ be a field of characteristic $p > 0$. Suppose that $a \in k$
is an element which is not a $p$th power. A standard example of a
geometrically regular local $k$-algebra whose residue field is
purely inseparable over $k$ is the ring
$$
A = k[x, y]_{(x, y^p - a)}/(y^p - a - x)
$$
Namely, $A$ is a localization of a smooth algebra over $k$ hence $k \to A$
is formally smooth, hence $k \to A$ is formally smooth for the
$\mathfrak m$-adic topology. A closely related example
is the following. Let $k = \mathbf{F}_p(s)$ and $K = \mathbf{F}_p(t)^{perf}$.
We claim the ring map
$$
k \longrightarrow A = K[[x]],\quad s \longmapsto t + x
$$
is formally smooth for the $(x)$-adic topology on $A$. Namely,
$\Omega_{k/\mathbf{F}_p}$ is $1$-dimensional with basis $\text{d}s$.
It maps to the element
$\text{d}x + \text{d}t = \text{d}x$ in $\Omega_{A/\mathbf{F}_p}$.
We leave it to the reader to show that $\Omega_{A/\mathbf{F}_p}$ is
free on $\text{d}x$ as an $A$-module. Hence we see that condition (5)
of Theorem \ref{theorem-regular-fs} holds and we conclude that $k \to A$
is formally smooth in the $(x)$-adic topology.
\end{example}

\begin{lemma}
\label{lemma-formally-smooth-flat}
Let $A \to B$ be a local homomorphism of Noetherian local rings.
Assume $A \to B$ is formally smooth in the $\mathfrak m_B$-adic
topology. Then $A \to B$ is flat.
\end{lemma}

\begin{proof}
We may assume that $A$ and $B$ a Noetherian complete local rings
by Lemma \ref{lemma-formally-smooth-completion} and
Algebra, Lemma \ref{algebra-lemma-completion-Noetherian-Noetherian}
(this also uses
Algebra, Lemma \ref{algebra-lemma-flatness-descends-more-general} and
\ref{algebra-lemma-completion-faithfully-flat}
to see that flatness of the map on completions implies flatness of
$A \to B$).
Choose a commutative diagram
$$
\xymatrix{
S \ar[r] & B \\
R \ar[u] \ar[r] & A \ar[u]
}
$$
as in Lemma \ref{lemma-embed-map-Noetherian-complete-local-rings}
with $R \to S$ flat. Let $I \subset R$ be the kernel of $R \to A$.
Because $B$ is formally smooth over $A$ we see that the $A$-algebra map
$$
S/IS \longrightarrow B
$$
has a section, see Lemma \ref{lemma-lift-continuous}.
Hence $B$ is a direct summand of the flat $A$-module $S/IS$
(by base change of flatness, see
Algebra, Lemma \ref{algebra-lemma-flat-base-change}),
whence flat.
\end{proof}

\begin{lemma}
\label{lemma-formally-smooth-JZ}
Let $A \to B$ be a local homomorphism of Noetherian local rings.
Assume $A \to B$ is formally smooth in the $\mathfrak m_B$-adic
topology. Let $K$ be the residue field of $B$. Then
the Jacobi-Zariski sequence for $A \to B \to K$ gives an exact sequence
$$
0 \to H_1(\NL_{K/A}) \to \mathfrak m_B/\mathfrak m_B^2
\to \Omega_{B/A} \otimes_B K \to \Omega_{K/A} \to 0
$$
\end{lemma}

\begin{proof}
Observe that $\mathfrak m_B/\mathfrak m_B^2 = H_1(\NL_{K/B})$
by Algebra, Lemma \ref{algebra-lemma-NL-surjection}.
By Algebra, Lemma \ref{algebra-lemma-exact-sequence-NL}
it remains to show injectivity of
$H_1(\NL_{K/A}) \to \mathfrak m_B/\mathfrak m_B^2$.
With $k$ the residue field of $A$, the Jacobi-Zariski sequence
for $A \to k \to K$ gives $\Omega_{K/A} = \Omega_{K/k}$ and
an exact sequence
$$
\mathfrak m_A/\mathfrak m_A^2 \otimes_k K \to
H_1(\NL_{K/A}) \to
H_1(\NL_{K/k}) \to 0
$$
Set $\overline{B} = B \otimes_A k$. Since $\overline{B}$ is
regular the ideal $\mathfrak m_{\overline{B}}$ is generated
by a regular sequence. Applying
Lemmas \ref{lemma-conormal-sequence-H1-regular} and
\ref{lemma-noetherian-finite-all-equivalent}
to $\mathfrak m_A B \subset \mathfrak m_B$
we find $\mathfrak m_A B / (\mathfrak m_AB \cap \mathfrak m_B^2) =
\mathfrak m_A B / \mathfrak m_A \mathfrak m_B$ which is
equal to $\mathfrak m_A/\mathfrak m_A^2 \otimes_k K$
as $A \to B$ is flat by Lemma \ref{lemma-formally-smooth-flat}.
Thus we obtain a short exact sequence
$$
0 \to
\mathfrak m_A/\mathfrak m_A^2 \otimes_k K \to
\mathfrak m_B/\mathfrak m_B^2 \to
\mathfrak m_{\overline{B}}/\mathfrak m_{\overline{B}}^2 \to 0
$$
Functoriality of the Jacobi-Zariski sequences shows that
we obtain a commutative diagram
$$
\xymatrix{
&
\mathfrak m_A/\mathfrak m_A^2 \otimes_k K \ar[d] \ar[r] &
H_1(\NL_{K/A}) \ar[d] \ar[r] &
H_1(\NL_{K/k}) \ar[d] \ar[r] & 0 \\
0 \ar[r] &
\mathfrak m_A/\mathfrak m_A^2 \otimes_k K \ar[r] &
\mathfrak m_B/\mathfrak m_B^2 \ar[r] &
\mathfrak m_{\overline{B}}/\mathfrak m_{\overline{B}}^2 \ar[r] & 0
}
$$
The left vertical arrow is injective by Theorem \ref{theorem-regular-fs}
as $k \to \overline{B}$ is formally smooth in
the $\mathfrak m_{\overline{B}}$-adic topology by
Lemma \ref{lemma-base-change-fs}.
This finishes the proof by the snake lemma.
\end{proof}

\begin{proposition}
\label{proposition-fs-flat-fibre-fs}
Let $A \to B$ be a local homomorphism of Noetherian local rings.
Let $k$ be the residue field of $A$ and $\overline{B} = B \otimes_A k$
the special fibre. The following are equivalent
\begin{enumerate}
\item $A \to B$ is flat and $\overline{B}$ is geometrically regular
over $k$,
\item $A \to B$ is flat and $k \to \overline{B}$ is formally smooth
in the $\mathfrak m_{\overline{B}}$-adic topology, and
\item $A \to B$ is formally smooth in the $\mathfrak m_B$-adic
topology.
\end{enumerate}
\end{proposition}

\begin{proof}
The equivalence of (1) and (2) follows from Theorem \ref{theorem-regular-fs}.

\medskip\noindent
Assume (3). By Lemma \ref{lemma-formally-smooth-flat} we see that
$A \to B$ is flat. By Lemma \ref{lemma-base-change-fs} we see that
$k \to \overline{B}$ is formally smooth in the
$\mathfrak m_{\overline{B}}$-adic topology. Thus (2) holds.

\medskip\noindent
Assume (2). Lemma \ref{lemma-formally-smooth-completion}
tells us formal smoothness is preserved under completion. The same is true
for flatness by Algebra, Lemma \ref{algebra-lemma-completion-faithfully-flat}.
Hence we may replace $A$ and $B$ by their respective completions and
assume that $A$ and $B$ are Noetherian complete local rings.
In this case choose a diagram
$$
\xymatrix{
S \ar[r] & B \\
R \ar[u] \ar[r] & A \ar[u]
}
$$
as in Lemma \ref{lemma-embed-map-Noetherian-complete-local-rings}.
We will use all of the properties of this diagram without further mention.
Fix a regular system of parameters $t_1, \ldots, t_d$ of $R$
with $t_1 = p$ in case the characteristic of $k$ is $p > 0$.
Set $\overline{S} = S \otimes_R k$. Consider the short exact sequence
$$
0 \to J \to S \to B \to 0
$$
As $\overline{B}$ and $\overline{S}$ are regular, the kernel of
$\overline{S} \to \overline{B}$ is generated by elements
$\overline{x}_1, \ldots, \overline{x}_r$ which form part of a regular
system of parameters of $\overline{S}$, see
Algebra, Lemma \ref{algebra-lemma-regular-quotient-regular}.
Lift these elements to $x_1, \ldots, x_r \in J$. Then
$t_1, \ldots, t_d, x_1, \ldots, x_r$ is part of a regular system of
parameters for $S$. Hence $S/(x_1, \ldots, x_r)$ is a power
series ring over a field (if the characteristic of $k$ is zero)
or a power series ring over a Cohen ring (if the characteristic of
$k$ is $p > 0$), see
Lemma \ref{lemma-quotient-power-series-ring-over-Cohen}.
Moreover, it is still the case that $R \to S/(x_1, \ldots, x_r)$
maps $t_1, \ldots, t_d$ to a part of a regular system of parameters
of $S/(x_1, \ldots, x_r)$. In other words, we may replace $S$ by
$S/(x_1, \ldots, x_r)$ and assume we have a diagram
$$
\xymatrix{
S \ar[r] & B \\
R \ar[u] \ar[r] & A \ar[u]
}
$$
as in Lemma \ref{lemma-embed-map-Noetherian-complete-local-rings}
with moreover $\overline{S} = \overline{B}$. In this case the map
$$
S \otimes_R A \longrightarrow B
$$
is an isomorphism as it is surjective, an isomorphism on special
fibres, and source and target are flat over $A$ (for example use
Algebra, Lemma \ref{algebra-lemma-mod-injective} or use that
tensoring the short exact sequence $0 \to I \to S \otimes_R A \to B \to 0$
over $A$ with $k$ we find $I \otimes_A k = 0$ hence $I = 0$ by Nakayama).
Thus by Lemma \ref{lemma-base-change-fs}
it suffices to show that $R \to S$ is formally
smooth in the $\mathfrak m_S$-adic topology.
Of course, since $\overline{S} = \overline{B}$, we have
that $\overline{S}$ is formally smooth over $k = R/\mathfrak m_R$.

\medskip\noindent
Choose elements $y_1, \ldots, y_m \in S$ such that
$t_1, \ldots, t_d, y_1, \ldots, y_m$ is a regular system of parameters
for $S$. If the characteristic of $k$ is zero, choose a coefficient
field $K \subset S$ and if the characteristic of $k$ is $p > 0$
choose a Cohen ring $\Lambda \subset S$ with residue field $K$.
At this point the map $K[[t_1, \ldots, t_d, y_1, \ldots, y_m]] \to S$
(characteristic zero case) or
$\Lambda[[t_2, \ldots, t_d, y_1, \ldots, y_m]] \to S$
(characteristic $p > 0$ case) is an isomorphism, see
Lemma \ref{lemma-quotient-power-series-ring-over-Cohen}.
From now on we think of $S$ as the above power series ring.

\medskip\noindent
The rest of the proof is analogous to the argument
in the proof of Theorem \ref{theorem-regular-fs}. Choose a solid diagram
$$
\xymatrix{
S \ar[r]_{\bar\psi} \ar@{-->}[rd] & N/J \\
R \ar[u]^i \ar[r]^\varphi & N \ar[u]_\pi
}
$$
as in Definition \ref{definition-formally-smooth}. As $J^2 = 0$ we see
that $J$ has a canonical $N/J$ module structure and via $\bar\psi$ a
$S$-module structure. As $\bar\psi$ is continuous for the
$\mathfrak m_S$-adic topology we see that $\mathfrak m_S^nJ = 0$ for some
$n$. Hence we can filter $J$ by $N/J$-submodules
$0 \subset J_1 \subset J_2 \subset \ldots \subset J_n = J$
such that each quotient $J_{t + 1}/J_t$ is annihilated by $\mathfrak m_S$.
Considering the sequence of ring maps
$N \to N/J_1 \to N/J_2 \to \ldots \to N/J$
we see that it suffices to prove the existence of the dotted arrow when
$J$ is annihilated by $\mathfrak m_S$, i.e., when $J$ is a
$K$-vector space.

\medskip\noindent
Assume given a diagram as above such that $J$ is annihilated by
$\mathfrak m_S$. As $\mathbf{Q} \to S$ (characteristic zero case)
or $\mathbf{Z} \to S$ (characteristic $p > 0$ case)
is formally smooth in the $\mathfrak m_S$-adic topology (see
Lemma \ref{lemma-power-series-ring-over-Cohen-fs}), we can find
a ring map $\psi : S \to N$ such that $\pi \circ \psi = \bar \psi$.
Since $S$ is a power series ring in $t_1, \ldots, t_d$ (characteristic zero)
or $t_2, \ldots, t_d$ (characteristic $p > 0$) over
a subring, it follows from the universal property of power series rings
that we can change our choice of $\psi$ so that $\psi(t_i)$ equals
$\varphi(t_i)$ (automatic for $t_1 = p$ in the characteristic $p$ case).
Then $\psi \circ i$ and $\varphi : R \to N$ are two maps whose
compositions with $\pi$ are equal and which agree on $t_1, \ldots, t_d$.
Hence $D = \psi \circ i - \varphi : R \to J$ is a derivation which
annihilates $t_1, \ldots, t_d$.
By Algebra, Lemma \ref{algebra-lemma-universal-omega} we can write
$D = \xi \circ \text{d}$ for some $R$-linear map
$\xi : \Omega_{R/\mathbf{Z}} \to J$ which annihilates
$\text{d}t_1, \ldots, \text{d}t_d$ (by construction) and
$\mathfrak m_R \Omega_{R/\mathbf{Z}}$ (as $J$ is annihilated by
$\mathfrak m_R$). Hence $\xi$ factors as a composition
$$
\Omega_{R/\mathbf{Z}} \to \Omega_{k/\mathbf{Z}} \xrightarrow{\xi'} J
$$
where $\xi'$ is $k$-linear. Using the $K$-vector space structure on $J$ we
extend $\xi'$ to a $K$-linear map
$$
\xi'' : \Omega_{k/\mathbf{Z}} \otimes_k K \longrightarrow J.
$$
Using that $\overline{S}/k$ is formally smooth we see that
$$
\Omega_{k/\mathbf{Z}} \otimes_k K \to
\Omega_{\overline{S}/\mathbf{Z}} \otimes_S K
$$
is injective by Theorem \ref{theorem-regular-fs} (this is true also
in the characteristic zero case as it is even true that
$\Omega_{k/\mathbf{Z}} \to \Omega_{K/\mathbf{Z}}$ is injective
in characteristic zero, see Algebra,
Proposition \ref{algebra-proposition-characterize-separable-field-extensions}).
Hence we can find a $K$-linear map
$\xi''' : \Omega_{\overline{S}/\mathbf{Z}} \otimes_S K \to J$ whose
restriction to $\Omega_{k/\mathbf{Z}} \otimes_k K$ is $\xi''$. Write
$$
D' : S \xrightarrow{\text{d}} \Omega_{S/\mathbf{Z}}
\to \Omega_{\overline{S}/\mathbf{Z}} \to
\Omega_{\overline{S}/\mathbf{Z}} \otimes_S K \xrightarrow{\xi'''} J.
$$
Finally, set $\psi' = \psi - D' : S \to N$. The reader verifies that $\psi'$
is a ring map such that $\pi \circ \psi' = \bar \psi$ and such that
$\psi' \circ i = \varphi$ as desired.
\end{proof}

\noindent
As an application of the result above we prove that deformations
of formally smooth algebras are unobstructed.

\begin{lemma}
\label{lemma-lift-fs}
Let $A$ be a Noetherian complete local ring with residue field $k$.
Let $B$ be a Noetherian complete local $k$-algebra. Assume $k \to B$
is formally smooth in the $\mathfrak m_B$-adic topology.
Then there exists a Noetherian complete local ring $C$
and a local homomorphism $A \to C$ which is formally smooth
in the $\mathfrak m_C$-adic topology such that $C \otimes_A k \cong B$.
\end{lemma}

\begin{proof}
Choose a diagram
$$
\xymatrix{
S \ar[r] & B \\
R \ar[u] \ar[r] & A \ar[u]
}
$$
as in Lemma \ref{lemma-embed-map-Noetherian-complete-local-rings}.
Let $t_1, \ldots, t_d$ be a regular system of parameters for $R$
with $t_1 = p$ in case the characteristic of $k$ is $p > 0$.
As $B$ and $\overline{S} = S \otimes_R k$
are regular we see that $\Ker(\overline{S} \to B)$ is generated by
elements $\overline{x}_1, \ldots, \overline{x}_r$ which form part of a
regular system of parameters of $\overline{S}$, see
Algebra, Lemma \ref{algebra-lemma-regular-quotient-regular}.
Lift these elements to $x_1, \ldots, x_r \in S$. Then
$t_1, \ldots, t_d, x_1, \ldots, x_r$ is part of a regular system of
parameters for $S$. Hence $S/(x_1, \ldots, x_r)$ is a power
series ring over a field (if the characteristic of $k$ is zero)
or a power series ring over a Cohen ring (if the characteristic of
$k$ is $p > 0$), see
Lemma \ref{lemma-quotient-power-series-ring-over-Cohen}.
Moreover, it is still the case that $R \to S/(x_1, \ldots, x_r)$
maps $t_1, \ldots, t_d$ to a part of a regular system of parameters
of $S/(x_1, \ldots, x_r)$. In other words, we may replace $S$ by
$S/(x_1, \ldots, x_r)$ and assume we have a diagram
$$
\xymatrix{
S \ar[r] & B \\
R \ar[u] \ar[r] & A \ar[u]
}
$$
as in Lemma \ref{lemma-embed-map-Noetherian-complete-local-rings}
with moreover $\overline{S} = B$. In this case $R \to S$ is
formally smooth in the $\mathfrak m_S$-adic topology by
Proposition \ref{proposition-fs-flat-fibre-fs}.
Hence the base change $C = S \otimes_R A$ is formally smooth
over $A$ in the $\mathfrak m_C$-adic topology by
Lemma \ref{lemma-base-change-fs}.
\end{proof}

\begin{remark}
\label{remark-what-does-it-mean}
The assertion of Lemma \ref{lemma-lift-fs} is quite strong. Namely,
suppose that we have a diagram
$$
\xymatrix{
& B \\
A \ar[r] & A' \ar[u]
}
$$
of local homomorphisms of Noetherian complete local rings where
$A \to A'$ induces an isomorphism of residue fields
$k = A/\mathfrak m_A = A'/\mathfrak m_{A'}$ and with
$B \otimes_{A'} k$ formally smooth over $k$.
Then we can extend this to a commutative diagram
$$
\xymatrix{
C \ar[r] & B \\
A \ar[r] \ar[u] & A' \ar[u]
}
$$
of local homomorphisms of Noetherian complete local rings
where $A \to C$ is formally smooth in the $\mathfrak m_C$-adic
topology and where $C \otimes_A k \cong B \otimes_{A'} k$.
Namely, pick $A \to C$ as in Lemma \ref{lemma-lift-fs}
lifting $B \otimes_{A'} k$ over $k$. By formal smoothness we
can find the arrow $C \to B$, see
Lemma \ref{lemma-lift-continuous}.
Denote $C \otimes_A^\wedge A'$ the completion of
$C \otimes_A A'$ with respect to the ideal $C \otimes_A \mathfrak m_{A'}$.
Note that $C \otimes_A^\wedge A'$ is a Noetherian complete local
ring (see Algebra, Lemma \ref{algebra-lemma-completion-Noetherian})
which is flat over $A'$ (see
Algebra, Lemma \ref{algebra-lemma-flat-module-powers}).
We have moreover
\begin{enumerate}
\item $C \otimes_A^\wedge A' \to B$ is surjective,
\item if $A \to A'$ is surjective, then $C \to B$ is surjective,
\item if $A \to A'$ is finite, then $C \to B$ is finite, and
\item if $A' \to B$ is flat, then $C \otimes_A^\wedge A' \cong B$.
\end{enumerate}
Namely, by Nakayama's lemma for nilpotent ideals (see
Algebra, Lemma \ref{algebra-lemma-NAK}) we see that
$C \otimes_A k \cong B \otimes_{A'} k$ implies that
$C \otimes_A A'/\mathfrak m_{A'}^n \to B/\mathfrak m_{A'}^nB$
is surjective for all $n$. This proves (1). Parts (2) and (3) follow
from part (1). Part (4) follows from
Algebra, Lemma \ref{algebra-lemma-mod-injective}.
\end{remark}




\section{Regular ring maps}
\label{section-regular}

\noindent
Let $k$ be a field. Recall that a Noetherian $k$-algebra $A$ is
said to be {\it geometrically regular} over $k$ if and only if
$A \otimes_k k'$ is regular for all finite purely inseparable
extensions $k'$ of $k$, see
Algebra, Definition \ref{algebra-definition-geometrically-regular}.
Moreover, if this is the case then $A \otimes_k k'$ is regular
for every finitely generated field extension $k'/k$, see
Algebra, Lemma \ref{algebra-lemma-geometrically-regular}.
We use this notion in the following definition.

\begin{definition}
\label{definition-regular}
A ring map $R \to \Lambda$ is {\it regular} if it is flat and
for every prime $\mathfrak p \subset R$ the fibre ring
$$
\Lambda \otimes_R \kappa(\mathfrak p) =
\Lambda_\mathfrak p/\mathfrak p\Lambda_\mathfrak p
$$
is Noetherian and geometrically regular over $\kappa(\mathfrak p)$.
\end{definition}

\noindent
If $R \to \Lambda$ is a ring map with $\Lambda$ Noetherian, then the
fibre rings are always Noetherian.

\begin{lemma}[Regular is a local property]
\label{lemma-regular-local}
Let $R \to \Lambda$ be a ring map with $\Lambda$ Noetherian.
The following are equivalent
\begin{enumerate}
\item $R \to \Lambda$ is regular,
\item $R_\mathfrak p \to \Lambda_\mathfrak q$ is regular for all
$\mathfrak q \subset \Lambda$ lying over $\mathfrak p \subset R$, and
\item $R_\mathfrak m \to \Lambda_{\mathfrak m'}$ is regular for
all maximal ideals $\mathfrak m' \subset \Lambda$
lying over $\mathfrak m$ in $R$.
\end{enumerate}
\end{lemma}

\begin{proof}
This is true because a Noetherian ring is regular if and only if
all the local rings are regular local rings, see
Algebra, Definition \ref{algebra-definition-regular}
and a ring map is flat if and only if all the induced maps of local
rings are flat, see
Algebra, Lemma \ref{algebra-lemma-flat-localization}.
\end{proof}

\begin{lemma}[Regular maps and base change]
\label{lemma-regular-base-change}
Let $R \to \Lambda$ be a regular ring map.
For any finite type ring map $R \to R'$ the base change
$R' \to \Lambda \otimes_R R'$ is regular too.
\end{lemma}

\begin{proof}
Flatness is preserved under any base change, see
Algebra, Lemma \ref{algebra-lemma-flat-base-change}.
Consider a prime $\mathfrak p' \subset R'$ lying over
$\mathfrak p \subset R$. The residue field extension
$\kappa(\mathfrak p')/\kappa(\mathfrak p)$ is
finitely generated as $R'$ is of finite type over $R$.
Hence the fibre ring
$$
(\Lambda \otimes_R R') \otimes_{R'} \kappa(\mathfrak p') =
\Lambda \otimes_R \kappa(\mathfrak p) \otimes_{\kappa(\mathfrak p)} 
\kappa(\mathfrak p')
$$
is Noetherian by
Algebra, Lemma \ref{algebra-lemma-Noetherian-field-extension}
and the assumption on the fibre rings of $R \to \Lambda$.
Geometric regularity of the fibres is preserved by
Algebra, Lemma \ref{algebra-lemma-geometrically-regular}.
\end{proof}

\begin{lemma}[Composition of regular maps]
\label{lemma-regular-composition}
Let $A \to B$ and $B \to C$ be regular ring maps.
If the fibre rings of $A \to C$ are Noetherian, then
$A \to C$ is regular.
\end{lemma}

\begin{proof}
Let $\mathfrak p \subset A$ be a prime. Let $\kappa(\mathfrak p) \subset k$
be a finite purely inseparable extension. We have to show that
$C \otimes_A k$ is regular. By Lemma \ref{lemma-regular-base-change}
we may assume that $A = k$ and we reduce to proving that $C$ is regular.
The assumption is that $B$ is regular and that $B \to C$ is flat
with regular fibres. Then $C$ is regular by Algebra, Lemma
\ref{algebra-lemma-flat-over-regular-with-regular-fibre}.
Some details omitted.
\end{proof}

\begin{lemma}
\label{lemma-colimit-smooth-regular}
Let $R$ be a ring. Let $(A_i, \varphi_{ii'})$ be a directed system
of smooth $R$-algebras. Set $\Lambda = \colim A_i$. If the fibre
rings $\Lambda \otimes_R \kappa(\mathfrak p)$ are Noetherian for all
$\mathfrak p \subset R$, then $R \to \Lambda$ is regular.
\end{lemma}

\begin{proof}
Note that $\Lambda$ is flat over $R$ by
Algebra, Lemmas \ref{algebra-lemma-colimit-flat} and
\ref{algebra-lemma-smooth-syntomic}.
Let $\kappa(\mathfrak p) \subset k$ be a finite purely inseparable
extension. Note that
$$
\Lambda \otimes_R \kappa(\mathfrak p) \otimes_{\kappa(\mathfrak p)} k =
\Lambda \otimes_R k = \colim A_i \otimes_R k
$$
is a colimit of smooth $k$-algebras, see
Algebra, Lemma \ref{algebra-lemma-base-change-smooth}.
Since each local ring of a smooth $k$-algebra is regular by
Algebra, Lemma \ref{algebra-lemma-characterize-smooth-over-field}
we conclude that all local rings of $\Lambda \otimes_R k$ are
regular by
Algebra, Lemma \ref{algebra-lemma-colimit-regular}.
This proves the lemma.
\end{proof}

\noindent
Let's see when a field extension defines a regular ring map.

\begin{lemma}
\label{lemma-regular-field-extension}
Let $K/k$ be a field extension. Then $k \to K$ is a regular
ring map if and only if $K$ is a separable field extension of $k$.
\end{lemma}

\begin{proof}
If $k \to K$ is regular, then $K$ is geometrically reduced over $k$,
hence $K$ is separable over $k$ by
Algebra, Proposition
\ref{algebra-proposition-characterize-separable-field-extensions}.
Conversely, if $K/k$ is separable, then $K$ is a colimit of smooth
$k$-algebras, see
Algebra, Lemma \ref{algebra-lemma-colimit-syntomic}
hence is regular by
Lemma \ref{lemma-colimit-smooth-regular}.
\end{proof}

\begin{lemma}
\label{lemma-regular-permanence}
Let $A \to B \to C$ be ring maps. If $A \to C$ is regular and $B \to C$
is flat and surjective on spectra, then $A \to B$ is regular.
\end{lemma}

\begin{proof}
By Algebra, Lemma \ref{algebra-lemma-flat-permanence} we see that
$A \to B$ is flat. Let $\mathfrak p \subset A$ be a prime. The ring
map $B \otimes_A \kappa(\mathfrak p) \to C \otimes_A \kappa(\mathfrak p)$
is flat and surjective on spectra. Hence $B \otimes_A \kappa(\mathfrak p)$
is geometrically regular by
Algebra, Lemma \ref{algebra-lemma-geometrically-regular-descent}.
\end{proof}




\section{Ascending properties along regular ring maps}
\label{section-ascending-properties}

\noindent
This section is the analogue of
Algebra, Section \ref{algebra-section-ascending-properties}
but where the ring map $R \to S$ is regular.

\begin{lemma}
\label{lemma-reduced-goes-up}
Let $\varphi : R \to S$ be a ring map. Assume
\begin{enumerate}
\item $\varphi$ is regular,
\item $S$ is Noetherian, and
\item $R$ is Noetherian and reduced.
\end{enumerate}
Then $S$ is reduced.
\end{lemma}

\begin{proof}
For Noetherian rings being reduced is the same as having properties
$(S_1)$ and $(R_0)$, see
Algebra, Lemma \ref{algebra-lemma-criterion-reduced}.
Hence we may apply
Algebra, Lemmas \ref{algebra-lemma-Sk-goes-up} and
\ref{algebra-lemma-Rk-goes-up}.
\end{proof}

\begin{lemma}
\label{lemma-normal-goes-up}
Let $\varphi : R \to S$ be a ring map. Assume
\begin{enumerate}
\item $\varphi$ is regular,
\item $S$ is Noetherian, and
\item $R$ is Noetherian and normal.
\end{enumerate}
Then $S$ is normal.
\end{lemma}

\begin{proof}
For Noetherian rings being normal is the same as having properties
$(S_2)$ and $(R_1)$, see
Algebra, Lemma \ref{algebra-lemma-criterion-normal}.
Hence we may apply
Algebra, Lemmas \ref{algebra-lemma-Sk-goes-up} and
\ref{algebra-lemma-Rk-goes-up}.
\end{proof}






\section{Permanence of properties under completion}
\label{section-permanence-completion}

\noindent
Given a Noetherian local ring $(A, \mathfrak m)$ we denote $A^\wedge$
the completion of $A$ with respect to $\mathfrak m$. We will use
without further mention that $A^\wedge$ is a Noetherian complete local ring
with maximal ideal $\mathfrak m^\wedge = \mathfrak m A^\wedge$
and that $A \to A^\wedge$ is faithfully flat.
See Algebra, Lemmas
\ref{algebra-lemma-completion-Noetherian-Noetherian},
\ref{algebra-lemma-completion-complete}, and
\ref{algebra-lemma-completion-faithfully-flat}.

\begin{lemma}
\label{lemma-completion-dimension}
Let $A$ be a Noetherian local ring.
Then $\dim(A) = \dim(A^\wedge)$.
\end{lemma}

\begin{proof}
By Algebra, Lemma \ref{algebra-lemma-completion-complete} the map
$A \to A^\wedge$ induces isomorphisms
$A/\mathfrak m^n = A^\wedge/(\mathfrak m^\wedge)^n$ for $n \geq 1$.
By Algebra, Lemma \ref{algebra-lemma-pushdown-module} this implies that
$$
\text{length}_A(A/\mathfrak m^n) =
\text{length}_{A^\wedge}(A^\wedge/(\mathfrak m^\wedge)^n)
$$
for all $n \geq 1$. Thus $d(A) = d(A^\wedge)$ and we conclude
by Algebra, Proposition \ref{algebra-proposition-dimension}.
An alternative proof is to use
Algebra, Lemma \ref{algebra-lemma-dimension-base-fibre-equals-total}.
\end{proof}

\begin{lemma}
\label{lemma-completion-depth}
Let $A$ be a Noetherian local ring. Then
$\text{depth}(A) = \text{depth}(A^\wedge)$.
\end{lemma}

\begin{proof}
See Algebra, Lemma \ref{algebra-lemma-apply-grothendieck}.
\end{proof}

\begin{lemma}
\label{lemma-completion-CM}
Let $A$ be a Noetherian local ring.
Then $A$ is Cohen-Macaulay if and only if $A^\wedge$ is so.
\end{lemma}

\begin{proof}
A local ring $A$ is Cohen-Macaulay if and only if $\dim(A) = \text{depth}(A)$.
As both of these invariants are preserved under completion
(Lemmas \ref{lemma-completion-dimension} and \ref{lemma-completion-depth})
the claim follows.
\end{proof}

\begin{lemma}
\label{lemma-completion-regular}
Let $A$ be a Noetherian local ring.
Then $A$ is regular if and only if $A^\wedge$ is so.
\end{lemma}

\begin{proof}
If $A^\wedge$ is regular, then $A$ is regular by
Algebra, Lemma \ref{algebra-lemma-flat-under-regular}.
Assume $A$ is regular. Let $\mathfrak m$ be the maximal ideal
of $A$. Then $\dim_{\kappa(\mathfrak m)} \mathfrak m/\mathfrak m^2 =
\dim(A) = \dim(A^\wedge)$ (Lemma \ref{lemma-completion-dimension}).
On the other hand, $\mathfrak mA^\wedge$ is the maximal ideal of
$A^\wedge$ and hence $\mathfrak m_{A^\wedge}$
is generated by at most $\dim(A^\wedge)$ elements. Thus $A^\wedge$ is regular.
(You can also use
Algebra, Lemma \ref{algebra-lemma-flat-over-regular-with-regular-fibre}.)
\end{proof}

\begin{lemma}
\label{lemma-completion-dvr}
Let $A$ be a Noetherian local ring.
Then $A$ is a discrete valuation ring if and only if $A^\wedge$ is so.
\end{lemma}

\begin{proof}
This follows from Lemmas \ref{lemma-completion-dimension} and
\ref{lemma-completion-regular} and
Algebra, Lemma \ref{algebra-lemma-characterize-dvr}.
\end{proof}

\begin{lemma}
\label{lemma-completion-reduced}
Let $A$ be a Noetherian local ring.
\begin{enumerate}
\item If $A^\wedge$ is reduced, then so is $A$.
\item In general $A$ reduced does not imply $A^\wedge$ is reduced.
\item If $A$ is Nagata, then $A$ is reduced if and only if $A^\wedge$
is reduced.
\end{enumerate}
\end{lemma}

\begin{proof}
As $A \to A^\wedge$ is faithfully flat we have (1) by
Algebra, Lemma \ref{algebra-lemma-descent-reduced}.
For (2) see Algebra, Example \ref{algebra-example-bad-dvr-char-p}
(there are also examples in characteristic zero, see
Algebra, Remark \ref{algebra-remark-resolution-dim-1}).
For (3) see Algebra, Lemmas
\ref{algebra-lemma-local-nagata-domain-analytically-unramified} and
\ref{algebra-lemma-analytically-unramified-easy}.
\end{proof}

\begin{lemma}
\label{lemma-completion-normal}
Let $A$ be a Noetherian local ring. If $A^\wedge$ is normal, then so is $A$.
\end{lemma}

\begin{proof}
As $A \to A^\wedge$ is faithfully flat this follows from
Algebra, Lemma \ref{algebra-lemma-descent-normal}.
\end{proof}

\begin{lemma}
\label{lemma-flat-completion}
Let $A \to B$ be a local homomorphism of Noetherian local rings.
Then the induced map of completions $A^\wedge \to B^\wedge$
is flat if and only if $A \to B$ is flat.
\end{lemma}

\begin{proof}
Consider the commutative diagram
$$
\xymatrix{
A^\wedge \ar[r] & B^\wedge \\
A \ar[r] \ar[u] & B \ar[u]
}
$$
The vertical arrows are faithfully flat.
Assume that $A^\wedge \to B^\wedge$ is flat. Then $A \to B^\wedge$ is flat.
Hence $B$ is flat over $A$ by
Algebra, Lemma \ref{algebra-lemma-flatness-descends-more-general}.

\medskip\noindent
Assume that $A \to B$ is flat. Then $A \to B^\wedge$ is flat.
Hence $B^\wedge/\mathfrak m_A^n B^\wedge$ is flat over
$A/\mathfrak m_A^n$ for all $n \geq 1$. Note that
$\mathfrak m_A^n A^\wedge$ is the $n$th power of
the maximal ideal $\mathfrak m_A^\wedge$ of $A^\wedge$ and
$A/\mathfrak m_A^n = A^\wedge/(\mathfrak m_A^\wedge)^n$.
Thus we see that $B^\wedge$ is flat over $A^\wedge$ by applying
Algebra, Lemma \ref{algebra-lemma-flat-module-powers}
(with $R = A^\wedge$, $I = \mathfrak m_A^\wedge$,
$S = B^\wedge$, $M = S$).
\end{proof}

\begin{lemma}
\label{lemma-flat-unramified}
Let $A \to B$ be a flat local homomorphism of Noetherian local rings
such that $\mathfrak m_A B = \mathfrak m_B$ and
$\kappa(\mathfrak m_A) = \kappa(\mathfrak m_B)$.
Then $A \to B$ induces an isomorphism $A^\wedge \to B^\wedge$
of completions.
\end{lemma}

\begin{proof}
By Algebra, Lemma \ref{algebra-lemma-finite-after-completion} we see that
$B^\wedge$ is the $\mathfrak m_A$-adic
completion of $B$ and that $A^\wedge \to B^\wedge$ is finite.
Since $A \to B$ is flat we have $\text{Tor}_1^A(B, \kappa(\mathfrak m_A)) = 0$.
Hence we see that $B^\wedge$ is flat over $A^\wedge$ by
Lemma \ref{lemma-flat-after-completion}.
Thus $B^\wedge$ is a free $A^\wedge$-module by
Algebra, Lemma \ref{algebra-lemma-finite-flat-local}.
Since $A^\wedge \to B^\wedge$ induces an isomorphism
$\kappa(\mathfrak m_A) = A^\wedge/\mathfrak m_A A^\wedge \to
B^\wedge/\mathfrak m_A B^\wedge = B^\wedge/\mathfrak m_B B^\wedge =
\kappa(\mathfrak m_B)$ by our assumptions
(and Algebra, Lemma \ref{algebra-lemma-hathat-finitely-generated}),
we see that $B^\wedge$ is free of rank $1$. Thus $A^\wedge \to B^\wedge$
is an isomorphism.
\end{proof}





\section{Permanence of properties under \'etale maps}
\label{section-permanence-etale}

\noindent
In this section we consider an \'etale ring map $\varphi : A \to B$
and we study which properties of $A$ are inherited by $B$
and which properties of the local ring of $B$ at $\mathfrak q$
are inherited by the local ring of $A$ at
$\mathfrak p = \varphi^{-1}(\mathfrak q)$.
Basically, this section reviews and collects earlier results
and does not add any new material.

\medskip\noindent
We will use without further mention that an \'etale ring map
is flat (Algebra, Lemma \ref{algebra-lemma-etale}) and that a
flat local homomorphism of local rings is faithfully flat
(Algebra, Lemma \ref{algebra-lemma-local-flat-ff}).

\begin{lemma}
\label{lemma-Noetherian-etale-extension}
If $A \to B$ is an \'etale ring map and $\mathfrak q$ is a prime of
$B$ lying over $\mathfrak p \subset A$, then
$A_{\mathfrak p}$ is Noetherian if and only if $B_{\mathfrak q}$ is
Noetherian.
\end{lemma}

\begin{proof}
Since $A_\mathfrak p \to B_\mathfrak q$ is faithfully flat
we see that $B_\mathfrak q$ Noetherian implies that $A_\mathfrak p$
is Noetherian, see
Algebra, Lemma \ref{algebra-lemma-descent-Noetherian}.
Conversely, if $A_\mathfrak p$ is Noetherian, then $B_\mathfrak q$
is Noetherian as it is a localization of a finite type
$A_\mathfrak p$-algebra.
\end{proof}

\begin{lemma}
\label{lemma-dimension-etale-extension}
If $A \to B$ is an \'etale ring map and $\mathfrak q$ is a prime of
$B$ lying over $\mathfrak p \subset A$, then
$\dim(A_{\mathfrak p}) = \dim(B_{\mathfrak q})$.
\end{lemma}

\begin{proof}
Namely, because $A_{\mathfrak p} \to B_{\mathfrak q}$ is flat we have
going down, and hence the inequality
$\dim(A_{\mathfrak p}) \leq \dim(B_{\mathfrak q})$, see
Algebra, Lemma \ref{algebra-lemma-dimension-going-up}.
On the other hand, suppose that
$\mathfrak q_0 \subset \mathfrak q_1 \subset \ldots \subset \mathfrak q_n$
is a chain of primes in $B_{\mathfrak q}$. Then the corresponding
sequence of primes
$\mathfrak p_0 \subset \mathfrak p_1 \subset \ldots \subset \mathfrak p_n$
(with $\mathfrak p_i = \mathfrak q_i \cap A_{\mathfrak p}$) is chain
also (i.e., no equalities in the sequence) as an
\'etale ring map is quasi-finite (see
Algebra, Lemma \ref{algebra-lemma-etale-quasi-finite})
and a quasi-finite ring map induces a map of spectra with
discrete fibres (by definition).
This means that $\dim(A_{\mathfrak p}) \geq \dim(B_{\mathfrak q})$ as
desired.
\end{proof}

\begin{lemma}
\label{lemma-regular-etale-extension}
If $A \to B$ is an \'etale ring map and $\mathfrak q$ is a prime of
$B$ lying over $\mathfrak p \subset A$, then
$A_{\mathfrak p}$ is regular if and only if $B_{\mathfrak q}$ is regular.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-Noetherian-etale-extension}
we may assume both $A_\mathfrak p$ and $B_\mathfrak q$
are Noetherian in order to prove the equivalence.
Let $x_1, \ldots, x_t \in \mathfrak pA_\mathfrak p$
be a minimal set of generators. As $A_\mathfrak p \to B_\mathfrak q$
is faithfully flat we see that the images $y_1, \ldots, y_t$
in $B_\mathfrak q$ form a minimal system of generators for
$\mathfrak pB_\mathfrak q = \mathfrak q B_\mathfrak q$
(Algebra, Lemma \ref{algebra-lemma-etale-at-prime}).
Regularity of $A_\mathfrak p$ by definition means $t = \dim(A_\mathfrak p)$
and similarly for $B_\mathfrak q$. Hence the lemma follows from
the equality $\dim(A_\mathfrak p) = \dim(B_\mathfrak q)$
of Lemma \ref{lemma-dimension-etale-extension}.
\end{proof}

\begin{lemma}
\label{lemma-Dedekind-etale-extension}
If $A \to B$ is an \'etale ring map and $A$ is a Dedekind domain, then
$B$ is a finite product of Dedekind domains. In particular, the
localizations $B_\mathfrak q$ for $\mathfrak q \subset B$ maximal
are discrete valuation rings.
\end{lemma}

\begin{proof}
The statement on the local rings follows from
Lemmas \ref{lemma-dimension-etale-extension} and
\ref{lemma-regular-etale-extension}
and Algebra, Lemma \ref{algebra-lemma-characterize-dvr}.
It follows that $B$ is a Noetherian normal ring of dimension $1$.
By Algebra, Lemma \ref{algebra-lemma-characterize-reduced-ring-normal}
we conclude that $B$ is a finite product of normal domains of
dimension $1$. These are Dedekind domains by
Algebra, Lemma \ref{algebra-lemma-characterize-Dedekind}.
\end{proof}



\section{Permanence of properties under henselization}
\label{section-permanence-henselization}

\noindent
Given a local ring $R$ we denote $R^h$, resp.\ $R^{sh}$ the henselization,
resp.\ strict henselization of $R$, see
Algebra, Definition \ref{algebra-definition-henselization}.
Many of the properties of $R$ are
reflected in $R^h$ and $R^{sh}$ as we will show in this section.

\begin{lemma}
\label{lemma-dumb-properties-henselization}
Let $(R, \mathfrak m, \kappa)$ be a local ring. Then we have the following
\begin{enumerate}
\item $R \to R^h \to R^{sh}$ are faithfully flat ring maps,
\item $\mathfrak m R^h = \mathfrak m^h$ and
$\mathfrak m R^{sh} = \mathfrak m^h R^{sh} = \mathfrak m^{sh}$,
\item $R/\mathfrak m^n = R^h/\mathfrak m^nR^h$ for all $n$,
\item there exist elements $x_i \in R^{sh}$ such that
$R^{sh}/\mathfrak m^nR^{sh}$ is a free $R/\mathfrak m^n$-module
on $x_i \bmod \mathfrak m^nR^{sh}$.
\end{enumerate}
\end{lemma}

\begin{proof}
By construction $R^h$ is a colimit of \'etale $R$-algebras, see
Algebra, Lemma \ref{algebra-lemma-henselization}. Since \'etale
ring maps are flat (Algebra, Lemma \ref{algebra-lemma-etale}) we see that
$R^h$ is flat over $R$ by
Algebra, Lemma \ref{algebra-lemma-colimit-flat}.
As a flat local ring homomorphism is faithfully flat
(Algebra, Lemma \ref{algebra-lemma-local-flat-ff})
we see that $R \to R^h$ is faithfully flat.
The ring map $R^h \to R^{sh}$ is a colimit of finite \'etale ring
maps, see proof of Algebra, Lemma \ref{algebra-lemma-strict-henselization}.
Hence the same arguments as above show that $R^h \to R^{sh}$ is
faithfully flat.

\medskip\noindent
Part (2) follows from Algebra, Lemmas \ref{algebra-lemma-henselization} and
\ref{algebra-lemma-strict-henselization}. Part (3) follows from
Algebra, Lemma \ref{algebra-lemma-local-artinian-basis-when-flat}
because $R/\mathfrak m \to R^h/\mathfrak mR^h$ is an isomorphism and
$R/\mathfrak m^n \to R^h/\mathfrak m^nR^h$ is flat as a base change of
the flat ring map $R \to R^h$
(Algebra, Lemma \ref{algebra-lemma-flat-base-change}).
Let $\kappa^{sep}$ be the residue field of $R^{sh}$ (it is a
separable algebraic closure of $\kappa$). Choose $x_i \in R^{sh}$
mapping to a basis of $\kappa^{sep}$ as a $\kappa$-vector space.
Then (4) follows from
Algebra, Lemma \ref{algebra-lemma-local-artinian-basis-when-flat}
in exactly the same way as above.
\end{proof}

\begin{lemma}
\label{lemma-henselization-formally-smooth}
Let $(R, \mathfrak m, \kappa)$ be a local ring. Then
\begin{enumerate}
\item $R \to R^h$, $R^h \to R^{sh}$, and $R \to R^{sh}$ are formally \'etale,
\item $R \to R^h$, $R^h \to R^{sh}$, resp.\ $R \to R^{sh}$ are formally
smooth in the $\mathfrak m^h$, $\mathfrak m^{sh}$,
resp.\ $\mathfrak m^{sh}$-topology.
\end{enumerate}
\end{lemma}

\begin{proof}
Part (1) follows from the fact that $R^h$ and $R^{sh}$ are directed
colimits of \'etale algebras (by construction), that \'etale algebras
are formally \'etale
(Algebra, Lemma \ref{algebra-lemma-formally-etale-etale}),
and that colimits of formally \'etale algebras are formally \'etale
(Algebra, Lemma \ref{algebra-lemma-colimit-formally-etale}).
Part (2) follows from the fact that a formally \'etale ring
map is formally smooth and Lemma \ref{lemma-formally-smooth}.
\end{proof}

\begin{lemma}
\label{lemma-henselization-noetherian}
\begin{reference}
\cite[IV, Theorem 18.6.6 and Proposition 18.8.8]{EGA}
\end{reference}
Let $R$ be a local ring. The following are equivalent
\begin{enumerate}
\item $R$ is Noetherian,
\item $R^h$ is Noetherian, and
\item $R^{sh}$ is Noetherian.
\end{enumerate}
In this case we have
\begin{enumerate}
\item[(a)] $(R^h)^\wedge$ and $(R^{sh})^\wedge$ are Noetherian complete
local rings,
\item[(b)] $R^\wedge \to (R^h)^\wedge$ is an isomorphism,
\item[(c)] $R^h \to (R^h)^\wedge$ and $R^{sh} \to (R^{sh})^\wedge$ are flat,
\item[(d)] $R^\wedge \to (R^{sh})^\wedge$ is formally smooth in
the $\mathfrak m_{(R^{sh})^\wedge}$-adic topology,
\item[(e)] $(R^\wedge)^{sh} = R^\wedge \otimes_{R^h} R^{sh}$, and
\item[(f)] $((R^\wedge)^{sh})^\wedge = (R^{sh})^\wedge$.
\end{enumerate}
\end{lemma}

\begin{proof}
Since $R \to R^h \to R^{sh}$ are faithfully flat
(Lemma \ref{lemma-dumb-properties-henselization}),
we see that $R^h$ or $R^{sh}$ being Noetherian implies that $R$
is Noetherian, see Algebra, Lemma \ref{algebra-lemma-descent-Noetherian}.
In the rest of the proof we assume $R$ is Noetherian.

\medskip\noindent
As $\mathfrak m \subset R$ is finitely generated it follows that
$\mathfrak m^h = \mathfrak m R^h$ and $\mathfrak m^{sh} = \mathfrak mR^{sh}$
are finitely generated, see Lemma \ref{lemma-dumb-properties-henselization}.
Hence $(R^h)^\wedge$ and $(R^{sh})^\wedge$ are Noetherian by
Algebra, Lemma \ref{algebra-lemma-complete-local-ring-Noetherian}.
This proves (a).

\medskip\noindent
Note that (b) is immediate from
Lemma \ref{lemma-dumb-properties-henselization}.
In particular we see that $(R^h)^\wedge$ is flat over $R$, see
Algebra, Lemma \ref{algebra-lemma-completion-faithfully-flat}.

\medskip\noindent
Next, we show that $R^h \to (R^h)^\wedge$ is flat.
Write $R^h = \colim_i R_i$ as a directed colimit of
localizations of \'etale $R$-algebras. By
Algebra, Lemma \ref{algebra-lemma-colimit-rings-flat}
if $(R^h)^\wedge$ is flat over each $R_i$, then $R^h \to (R^h)^\wedge$ is
flat. Note that $R^h = R_i^h$ (by construction).
Hence $R_i^\wedge = (R^h)^\wedge$
by part (b) is flat over $R_i$ as desired. To finish the proof of (c)
we show that $R^{sh} \to (R^{sh})^\wedge$ is flat. To do this, by a
limit argument as above, it suffices to show that $(R^{sh})^\wedge$
is flat over $R$. Note that it follows from
Lemma \ref{lemma-dumb-properties-henselization}
that $(R^{sh})^\wedge$ is the completion of a free $R$-module.
By Lemma \ref{lemma-completed-direct-sum-flat}
we see this is flat over $R$ as desired. This finishes the proof of (c).

\medskip\noindent
At this point we know (c) is true and that $(R^h)^\wedge$ and
$(R^{sh})^\wedge$ are Noetherian. It follows from
Algebra, Lemma \ref{algebra-lemma-descent-Noetherian}
that $R^h$ and $R^{sh}$ are Noetherian.

\medskip\noindent
Part (d) follows from Lemma \ref{lemma-henselization-formally-smooth}
and Lemma \ref{lemma-formally-smooth-completion}.

\medskip\noindent
Part (e) follows from Algebra, Lemma \ref{algebra-lemma-sh-from-h-map}
and the fact that $R^\wedge$ is henselian by
Algebra, Lemma \ref{algebra-lemma-complete-henselian}.

\medskip\noindent
Proof of (f). Using (e) there is a map $R^{sh} \to (R^\wedge)^{sh}$
which induces a map $(R^{sh})^\wedge \to ((R^\wedge)^{sh})^\wedge$
upon completion. Using (e) there is a map $R^\wedge \to (R^{sh})^\wedge$.
Since $(R^{sh})^\wedge$ is strictly henselian (see above) this map
induces a map $(R^\wedge)^{sh} \to (R^{sh})^\wedge$ by
Algebra, Lemma \ref{algebra-lemma-strictly-henselian-functorial}.
Completing we obtain a map $((R^\wedge)^{sh})^\wedge \to (R^{sh})^\wedge$.
We omit the verification that these two maps are mutually inverse.
\end{proof}

\begin{lemma}
\label{lemma-henselization-reduced}
\begin{slogan}
Reducedness passes to the (strict) henselization.
\end{slogan}
Let $R$ be a local ring.
The following are equivalent: $R$ is reduced,
the henselization $R^h$ of $R$ is reduced, and
the strict henselization $R^{sh}$ of $R$ is reduced.
\end{lemma}

\begin{proof}
The ring maps $R \to R^h \to R^{sh}$ are faithfully flat.
Hence one direction of the implications follows from
Algebra, Lemma \ref{algebra-lemma-descent-reduced}.
Conversely, assume $R$ is reduced. Since $R^h$ and $R^{sh}$
are filtered colimits of \'etale, hence smooth $R$-algebras, the
result follows from
Algebra, Lemma \ref{algebra-lemma-reduced-goes-up}.
\end{proof}

\begin{lemma}
\label{lemma-henselization-nil}
Let $R$ be a local ring. Let $nil(R)$ denote the ideal of
nilpotent elements of $R$. Then $nil(R)R^h = nil(R^h)$ and
$nil(R)R^{sh} = nil(R^{sh})$.
\end{lemma}

\begin{proof}
Note that $nil(R)$ is the biggest ideal consisting of nilpotent elements
such that the quotient $R/nil(R)$ is reduced. Note that $nil(R)R^h$
consists of nilpotent elements by
Algebra, Lemma \ref{algebra-lemma-locally-nilpotent}.
Also, note that $R^h/nil(R) R^h$ is the
henselization of $R/nil(R)$ by
Algebra, Lemma \ref{algebra-lemma-quotient-henselization}.
Hence $R^h/nil(R)R^h$ is reduced by
Lemma \ref{lemma-henselization-reduced}.
We conclude that $nil(R) R^h = nil(R^h)$ as desired.
Similarly for the strict henselization but using
Algebra, Lemma \ref{algebra-lemma-quotient-strict-henselization}.
\end{proof}

\begin{lemma}
\label{lemma-henselization-normal}
Let $R$ be a local ring.
The following are equivalent: $R$ is a normal domain,
the henselization $R^h$ of $R$ is a normal domain, and
the strict henselization $R^{sh}$ of $R$ is a normal domain.
\end{lemma}

\begin{proof}
A preliminary remark is that a local ring is normal if and only if it is
a normal domain (see
Algebra, Definition \ref{algebra-definition-ring-normal}).
The ring maps $R \to R^h \to R^{sh}$ are faithfully flat.
Hence one direction of the implications follows from
Algebra, Lemma \ref{algebra-lemma-descent-normal}.
Conversely, assume $R$ is normal. Since $R^h$ and $R^{sh}$
are filtered colimits of \'etale hence smooth $R$-algebras, the
result follows from
Algebra, Lemmas \ref{algebra-lemma-normal-goes-up} and
\ref{algebra-lemma-colimit-normal-ring}.
\end{proof}

\begin{lemma}
\label{lemma-henselization-dimension}
Given any local ring $R$ we have $\dim(R) = \dim(R^h) = \dim(R^{sh})$.
\end{lemma}

\begin{proof}
Since $R \to R^{sh}$ is faithfully flat
(Lemma \ref{lemma-dumb-properties-henselization})
we see that $\dim(R^{sh}) \geq \dim(R)$ by going down, see
Algebra, Lemma \ref{algebra-lemma-dimension-going-up}.
For the converse, we write $R^{sh} = \colim R_i$ as
a directed colimit of local rings $R_i$ each of which is a
localization of an \'etale $R$-algebra. Now if
$\mathfrak q_0 \subset \mathfrak q_1 \subset \ldots \subset \mathfrak q_n$
is a chain of prime ideals in $R^{sh}$, then for some sufficiently
large $i$ the sequence
$$
R_i \cap \mathfrak q_0 \subset
R_i \cap \mathfrak q_1 \subset \ldots \subset
R_i \cap \mathfrak q_n
$$
is a chain of primes in $R_i$. Thus we see that
$\dim(R^{sh}) \leq \sup_i \dim(R_i)$.
But by the result of
Lemma \ref{lemma-dimension-etale-extension}
we have $\dim(R_i) = \dim(R)$ for each $i$ and we win.
\end{proof}

\begin{lemma}
\label{lemma-henselization-depth}
Given a Noetherian local ring $R$ we have
$\text{depth}(R) = \text{depth}(R^h) = \text{depth}(R^{sh})$.
\end{lemma}

\begin{proof}
By
Lemma \ref{lemma-henselization-noetherian}
we know that $R^h$ and $R^{sh}$ are Noetherian. Hence the lemma follows
from
Algebra, Lemma \ref{algebra-lemma-apply-grothendieck}.
\end{proof}

\begin{lemma}
\label{lemma-henselization-CM}
Let $R$ be a Noetherian local ring. The following are equivalent:
$R$ is Cohen-Macaulay, the henselization $R^h$ of $R$ is Cohen-Macaulay,
and the strict henselization $R^{sh}$ of $R$ is Cohen-Macaulay.
\end{lemma}

\begin{proof}
By
Lemma \ref{lemma-henselization-noetherian}
we know that $R^h$ and $R^{sh}$ are Noetherian, hence the lemma makes
sense. Since we have
$\text{depth}(R) = \text{depth}(R^h) = \text{depth}(R^{sh})$
and
$\dim(R) = \dim(R^h) = \dim(R^{sh})$
by
Lemmas \ref{lemma-henselization-depth} and
\ref{lemma-henselization-dimension}
we conclude.
\end{proof}

\begin{lemma}
\label{lemma-henselization-regular}
Let $R$ be a Noetherian local ring. The following are equivalent:
$R$ is a regular local ring, the henselization $R^h$ of $R$ is a regular
local ring, and the strict henselization $R^{sh}$ of $R$ is a regular
local ring.
\end{lemma}

\begin{proof}
By
Lemma \ref{lemma-henselization-noetherian}
we know that $R^h$ and $R^{sh}$ are Noetherian, hence the lemma makes
sense. Let $\mathfrak m$ be the maximal ideal of $R$.
Let $x_1, \ldots, x_t \in \mathfrak m$ be a minimal system of
generators of $\mathfrak m$, i.e., such that the images in
$\mathfrak m/\mathfrak m^2$ form a basis over $\kappa = R/\mathfrak m$.
Because $R \to R^h$ and $R \to R^{sh}$ are faithfully flat, it follows
that the images $x_1^h, \ldots, x_t^h$ in $R^h$,
resp.\  $x_1^{sh}, \ldots, x_t^{sh}$ in $R^{sh}$
are a minimal system of generators for
$\mathfrak m^h = \mathfrak mR^h$,
resp.\ $\mathfrak m^{sh} = \mathfrak mR^{sh}$.
Regularity of $R$ by definition means $t = \dim(R)$ and similarly
for $R^h$ and $R^{sh}$. Hence the lemma follows from the equality
of dimensions $\dim(R) = \dim(R^h) = \dim(R^{sh})$ of
Lemma \ref{lemma-henselization-dimension}
\end{proof}

\begin{lemma}
\label{lemma-henselization-dvr}
Let $R$ be a Noetherian local ring. Then $R$ is a discrete valuation ring
if and only if $R^h$ is a discrete valuation ring if and only if
$R^{sh}$ is a discrete valuation ring.
\end{lemma}

\begin{proof}
This follows from Lemmas \ref{lemma-henselization-dimension} and
\ref{lemma-henselization-regular} and
Algebra, Lemma \ref{algebra-lemma-characterize-dvr}.
\end{proof}

\begin{lemma}
\label{lemma-filtered-colimit-etale-noetherian-fibres}
Let $A$ be a ring. Let $B$ be a filtered colimit of \'etale $A$-algebras.
Let $\mathfrak p$ be a prime of $A$. If $B$ is Noetherian, then
there are finitely many primes $\mathfrak q_1, \ldots, \mathfrak q_r$
lying over $\mathfrak p$, we have
$B \otimes_A \kappa(\mathfrak p) = \prod \kappa(\mathfrak q_i)$, and
each of the field extensions
$\kappa(\mathfrak q_i)/\kappa(\mathfrak p)$ is separable algebraic.
\end{lemma}

\begin{proof}
Write $B$ as a filtered colimit $B = \colim B_i$ with $A \to B_i$ \'etale.
Then on the one hand
$B \otimes_A \kappa(\mathfrak p) = \colim B_i \otimes_A \kappa(\mathfrak p)$
is a filtered colimit of \'etale $\kappa(\mathfrak p)$-algebras, and
on the other hand it is Noetherian. An \'etale
$\kappa(\mathfrak p)$-algebra is a finite product of finite separable field
extensions (Algebra, Lemma \ref{algebra-lemma-etale-over-field}).
Hence there are no nontrivial specializations between the primes
(which are all maximal and minimal primes) of the algebras
$B_i \otimes_A \kappa(\mathfrak p)$ and hence there are no
nontrivial specializations between the primes of
$B \otimes_A \kappa(\mathfrak p)$. Thus
$B \otimes_A \kappa(\mathfrak p)$ is reduced and
has finitely many primes which all minimal.
Thus it is a finite product of fields (use
Algebra, Lemma \ref{algebra-lemma-total-ring-fractions-no-embedded-points}
or
Algebra, Proposition \ref{algebra-proposition-dimension-zero-ring}).
Each of these fields is a colimit of finite separable extensions
and hence the final statement of the lemma follows.
\end{proof}

\begin{lemma}
\label{lemma-fibres-henselization}
Let $R$ be a Noetherian local ring. Let $\mathfrak p \subset R$ be a prime.
Then
$$
R^h \otimes_R \kappa(\mathfrak p) =
\prod\nolimits_{i = 1, \ldots, t} \kappa(\mathfrak q_i)
\quad\text{resp.}\quad
R^{sh} \otimes_R \kappa(\mathfrak p) =
\prod\nolimits_{i = 1, \ldots, s} \kappa(\mathfrak r_i)
$$
where $\mathfrak q_1, \ldots, \mathfrak q_t$,
resp.\ $\mathfrak r_1, \ldots, \mathfrak r_s$
are the prime of $R^h$, resp.\ $R^{sh}$ lying over $\mathfrak p$.
Moreover, the field extensions
$\kappa(\mathfrak q_i)/\kappa(\mathfrak p)$
resp.\ $\kappa(\mathfrak r_i)/\kappa(\mathfrak p)$
are separable algebraic.
\end{lemma}

\begin{proof}
This can be deduced from the more general
Lemma \ref{lemma-filtered-colimit-etale-noetherian-fibres}
using that the henselization and strict henselization are Noetherian
(as we've seen above). But we also give a direct proof as follows.

\medskip\noindent
We will use without further mention the results of
Lemmas \ref{lemma-dumb-properties-henselization} and
\ref{lemma-henselization-noetherian}.
Note that $R^h/\mathfrak pR^h$, resp.\ $R^{sh}/\mathfrak pR^{sh}$
is the henselization, resp.\ strict henselization of $R/\mathfrak p$,
see Algebra, Lemma \ref{algebra-lemma-quotient-henselization}
resp.\ Algebra, Lemma \ref{algebra-lemma-quotient-strict-henselization}.
Hence we may replace $R$ by $R/\mathfrak p$ and assume that $R$
is a Noetherian local domain and that $\mathfrak p = (0)$.
Since $R^h$, resp.\ $R^{sh}$ is Noetherian, it has finitely many
minimal primes $\mathfrak q_1, \ldots, \mathfrak q_t$,
resp.\ $\mathfrak r_1, \ldots, \mathfrak r_s$.
Since $R \to R^h$, resp.\ $R \to R^{sh}$ is flat these are exactly
the primes lying over $\mathfrak p = (0)$ (by going down).
Finally, as $R$ is a domain, we see that $R^h$, resp.\ $R^{sh}$
is reduced, see Lemma \ref{lemma-henselization-reduced}.
Thus we see that $R^h \otimes_R \kappa(\mathfrak p)$
resp.\ $R^{sh} \otimes_R \kappa(\mathfrak p)$
is a reduced Noetherian ring with finitely many primes, all of which
are minimal (and hence maximal). Thus these rings are Artinian and are
products of their localizations at maximal ideals, each necessarily a field
(see Algebra, Proposition \ref{algebra-proposition-dimension-zero-ring} and
Algebra, Lemma \ref{algebra-lemma-minimal-prime-reduced-ring}).

\medskip\noindent
The final statement follows from the fact that $R \to R^h$,
resp.\ $R \to R^{sh}$ is a colimit of \'etale ring maps and hence
the induced residue field extensions are colimits of finite separable
extensions, see
Algebra, Lemma \ref{algebra-lemma-etale-at-prime}.
\end{proof}









\section{Field extensions, revisited}
\label{section-p-bases}

\noindent
In this section we study some peculiarities of field extensions in
characteristic $p > 0$.

\begin{definition}
\label{definition-p-basis}
Let $p$ be a prime number. Let $k \to K$ be an extension of fields
of characteristic $p$. Denote $kK^p$ the compositum of $k$ and $K^p$
in $K$.
\begin{enumerate}
\item A subset $\{x_i\} \subset K$ is called {\it p-independent
over $k$} if the elements $x^E = \prod x_i^{e_i}$ where
$0 \leq e_i < p$ are linearly independent over $kK^p$.
\item A subset $\{x_i\}$ of $K$ is called a
{\it p-basis of $K$ over $k$} if the elements
$x^E$ form a basis of $K$ over $kK^p$.
\end{enumerate}
\end{definition}

\noindent
This is related to the notion of a $p$-basis of a $\mathbf{F}_p$-algebra
which we will discuss later (insert future reference here).

\begin{lemma}
\label{lemma-p-basis}
Let $K/k$ be a field extension. Assume $k$ has characteristic
$p > 0$. Let $\{x_i\}$ be a subset of $K$. The following are equivalent
\begin{enumerate}
\item the elements $\{x_i\}$ are $p$-independent over $k$, and
\item the elements $\text{d}x_i$ are $K$-linearly independent
in $\Omega_{K/k}$.
\end{enumerate}
Any $p$-independent collection can be extended to a $p$-basis of $K$ over $k$.
In particular, the field $K$ has a $p$-basis over $k$.
Moreover, the following are equivalent:
\begin{enumerate}
\item[(a)] $\{x_i\}$ is a $p$-basis of $K$ over $k$, and
\item[(b)] $\text{d}x_i$ is a basis of the $K$-vector space $\Omega_{K/k}$.
\end{enumerate}
\end{lemma}

\begin{proof}
Assume (2) and suppose that $\sum a_E x^E = 0$ is a linear relation
with $a_E \in k K^p$. Let $\theta_i : K \to K$ be a $k$-derivation such that
$\theta_i(x_j) = \delta_{ij}$ (Kronecker delta). Note that any $k$-derivation
of $K$ annihilates $kK^p$. Applying $\theta_i$ to the given relation we
obtain new relations
$$
\sum\nolimits_{E, e_i > 0}
e_i a_E x_1^{e_1}\ldots x_i^{e_i - 1} \ldots x_n^{e_n} = 0
$$
Hence if we pick $\sum a_E x^E$ as the relation with minimal
total degree $|E| = \sum e_i$ for some $a_E \not = 0$, then we
get a contradiction. Hence (1) holds.

\medskip\noindent
If $\{x_i\}$ is a $p$-basis for $K$ over $k$, then
$K \cong kK^p[X_i]/(X_i^p - x_i^p)$. Hence we see that
$\text{d}x_i$ forms a basis for $\Omega_{K/k}$ over $K$.
Thus (a) implies (b).

\medskip\noindent
Let $\{x_i\}$ be a $p$-independent subset of $K$ over $k$. An application
of Zorn's lemma shows that we can enlarge this to a maximal $p$-independent
subset of $K$ over $k$. We claim that any maximal $p$-independent subset
$\{x_i\}$ of $K$ is a $p$-basis of $K$ over $k$. The claim will imply
that (1) implies (2) and establish the existence of $p$-bases.
To prove the claim let $L$ be the subfield of $K$ generated by
$kK^p$ and the $x_i$. We have to show that $L = K$. If $x \in K$
but $x \not \in L$, then $x^p \in L$ and $L(x) \cong L[z]/(z^p - x)$.
Hence $\{x_i\} \cup \{x\}$ is $p$-independent over $k$, a contradiction.

\medskip\noindent
Finally, we have to show that (b) implies (a). By the equivalence of (1)
and (2) we see that $\{x_i\}$ is a maximal $p$-independent subset
of $K$ over $k$. Hence by the claim above it is a $p$-basis.
\end{proof}

\begin{lemma}
\label{lemma-intersection-subfields-subspace}
Let $K/k$ be a field extension. Let $\{K_\alpha\}_{\alpha \in A}$
be a collection of subfields of $K$ with the following properties
\begin{enumerate}
\item $k \subset K_\alpha$ for all $\alpha \in A$,
\item $k = \bigcap_{\alpha \in A} K_\alpha$,
\item for $\alpha, \alpha' \in A$ there exists an $\alpha'' \in A$
such that $K_{\alpha''} \subset K_\alpha \cap K_{\alpha'}$.
\end{enumerate}
Then for $n \geq 1$ and $V \subset K^{\oplus n}$ a $K$-vector space
we have $V \cap k^{\oplus n} \not = 0$ if and only if
$V \cap K_\alpha^{\oplus n} \not = 0$ for all $\alpha \in A$.
\end{lemma}

\begin{proof}
By induction on $n$. The case $n = 1$ follows from the assumptions.
Assume the result proven for subspaces of $K^{\oplus n - 1}$.
Assume that $V \subset K^{\oplus n}$ has nonzero intersection with
$K_\alpha^{\oplus n}$ for all $\alpha \in A$. If
$V \cap 0 \oplus k^{\oplus n - 1}$ is nonzero then we win. Hence we may
assume this is not the case. By induction hypothesis we can find
an $\alpha$ such that $V \cap 0 \oplus K_\alpha^{\oplus n - 1}$
is zero. Let $v = (x_1, \ldots, x_n) \in V \cap K_\alpha^{\oplus n}$
be a nonzero element.
By our choice of $\alpha$ we see that $x_1$ is not zero.
Replace $v$ by $x_1^{-1}v$ so that $v = (1, x_2, \ldots, x_n)$.
Note that if $v' = (x_1', \ldots, x'_n) \in V \cap K_\alpha$, then
$v' - x_1'v = 0$ by our choice of $\alpha$. Hence we see that
$V \cap K_\alpha^{\oplus n} = K_\alpha v$. If we choose some
$\alpha'$ such that $K_{\alpha'} \subset K_\alpha$, then we
see that necessarily $v \in V \cap K_{\alpha'}^{\oplus n}$ (by the
same arguments applied to $\alpha'$). Hence
$$
x_2, \ldots, x_n \in
\bigcap\nolimits_{\alpha' \in A, K_{\alpha'} \subset K_\alpha} K_{\alpha'}
$$
which equals $k$ by (2) and (3).
\end{proof}

\begin{lemma}
\label{lemma-intersection-subfields}
Let $K$ be a field of characteristic $p$. Let $\{K_\alpha\}_{\alpha \in A}$
be a collection of subfields of $K$ with the following properties
\begin{enumerate}
\item $K^p \subset K_\alpha$ for all $\alpha \in A$,
\item $K^p = \bigcap_{\alpha \in A} K_\alpha$,
\item for $\alpha, \alpha' \in A$ there exists an $\alpha'' \in A$
such that $K_{\alpha''} \subset K_\alpha \cap K_{\alpha'}$.
\end{enumerate}
Then
\begin{enumerate}
\item the intersection of the kernels of the maps
$\Omega_{K/\mathbf{F}_p} \to \Omega_{K/K_\alpha}$ is zero,
\item for any finite extension $L/K$ we have
$L^p = \bigcap_{\alpha \in A} L^pK_\alpha$.
\end{enumerate}
\end{lemma}

\begin{proof}
Proof of (1).
Choose a $p$-basis $\{x_i\}$ for $K$ over $\mathbf{F}_p$.
Suppose that $\eta = \sum_{i \in I'} y_i \text{d}x_i$ maps to zero in
$\Omega_{K/K_\alpha}$ for every $\alpha \in A$. Here the index set
$I'$ is finite. By Lemma \ref{lemma-p-basis}
this means that for every $\alpha$ there exists a relation
$$
\sum\nolimits_E a_{E, \alpha} x^E,\quad a_{E, \alpha} \in K_\alpha
$$
where $E$ runs over multi-indices $E = (e_i)_{i \in I'}$ with
$0 \leq e_i < p$. On the other hand, Lemma \ref{lemma-p-basis}
guarantees there is no such relation $\sum a_E x^E = 0$ with
$a_E \in K^p$. This is a contradiction by
Lemma \ref{lemma-intersection-subfields-subspace}.

\medskip\noindent
Proof of (2). Suppose that we have a tower $L/M/K$
of finite extensions of fields. Set $M_\alpha = M^p K_\alpha$
and $L_\alpha = L^p K_\alpha = L^p M_\alpha$. Then we can first prove that
$M^p = \bigcap_{\alpha \in A} M_\alpha$, and after that prove
that $L^p = \bigcap_{\alpha \in A} L_\alpha$. Hence it suffices to
prove (2) for primitive field extensions having no nontrivial subfields.
First, assume that $L = K(\theta)$ is separable over $K$. Then
$L$ is generated by $\theta^p$ over $K$, hence we may assume that
$\theta \in L^p$. In this case we see that
$$
L^p = K^p \oplus K^p\theta \oplus \ldots K^p\theta^{d - 1}
\quad\text{and}\quad
L^pK_\alpha =
K_\alpha \oplus K_\alpha \theta \oplus \ldots K_\alpha\theta^{d - 1}
$$
where $d = [L : K]$. Thus the conclusion is clear in this case. The other
case is where $L = K(\theta)$ with $\theta^p = t \in K$, $t \not \in K^p$.
In this case we have
$$
L^p = K^p \oplus K^pt \oplus \ldots K^pt^{p - 1}
\quad\text{and}\quad
L^pK_\alpha =
K_\alpha \oplus K_\alpha t \oplus \ldots K_\alpha t^{p - 1}
$$
Again the result is clear.
\end{proof}

\begin{lemma}
\label{lemma-power-series-ring-subfields}
Let $k$ be a field of characteristic $p > 0$. Let $n, m \geq 0$.
Let $K$ be the fraction field of $k[[x_1, \ldots, x_n]][y_1, \ldots, y_m]$.
As $k'$ ranges through all subfields $k/k'/k^p$
with $[k : k'] < \infty$ the subfields
$$
\text{fraction field of }
k'[[x_1^p, \ldots, x_n^p]][y_1^p, \ldots, y_m^p]
\subset
K
$$
form a family of subfields as in Lemma \ref{lemma-intersection-subfields}.
Moreover, each of the ring extensions
$k'[[x_1^p, \ldots, x_n^p]][y_1^p, \ldots, y_m^p] \subset
k[[x_1, \ldots, x_n]][y_1, \ldots, y_m]$ is finite.
\end{lemma}

\begin{proof}
Write $A = k[[x_1, \ldots, x_n]][y_1, \ldots, y_m]$
and $A' = k'[[x_1^p, \ldots, x_n^p]][y_1^p, \ldots, y_m^p]$.
We also denote $K'$ the fraction field of $A'$. The ring extension
$k'[[x_1^p, \ldots, x_d^p]] \subset k[[x_1, \ldots, x_d]]$ is finite
by Algebra, Lemma \ref{algebra-lemma-finite-after-completion}
which implies that $A' \to A$ is finite.
For $f \in A$ we see that $f^p \in A'$. Hence $K^p \subset K'$.
Any element of $K'$ can be written as $a/b^p$ with $a \in A'$ and $b \in A$
nonzero. Suppose that $f/g^p \in K$, $f, g \in A$, $g \not = 0$
is contained in $K'$ for every choice of $k'$.
Fix a choice of $k'$ for the moment. By the above we see
$f/g^p = a/b^p$ for some $a \in A'$ and some nonzero $b \in A$.
Hence $b^p f \in A'$. For any $A'$-derivation $D : A \to A$ we see
that $0 = D(b^pf) = b^p D(f)$ hence $D(f) = 0$ as $A$ is a domain.
Taking $D = \partial_{x_i}$ and $D = \partial_{y_j}$ we conclude
that $f \in k[[x_1^p, \ldots, x_n^p]][y_1^p, \ldots, y_d^p]$.
Applying a $k'$-derivation $\theta : k \to k$
we similarly conclude that all coefficients of $f$ are in $k'$, i.e.,
$f \in A'$. Since it is clear that
$A^p = \bigcap\nolimits_{k'} A'$ where $k'$ ranges over all subfields
as in the lemma we win.
\end{proof}





\section{The singular locus}
\label{section-singular-locus}

\noindent
Let $R$ be a Noetherian ring. The {\it regular locus} $\text{Reg}(X)$
of $X = \Spec(R)$ is the set of primes $\mathfrak p$ such that
$R_\mathfrak p$ is a regular local ring. The {\it singular locus}
$\text{Sing}(X)$ of $X = \Spec(R)$ is the complement
$X \setminus \text{Reg}(X)$, i.e., the set of primes $\mathfrak p$ such that
$R_\mathfrak p$ is not a regular local ring. By the discussion preceding
Algebra, Definition \ref{algebra-definition-regular}
we see that $\text{Reg}(X)$ is stable under generalization.
In this section we study conditions that guarantee that $\text{Reg}(X)$
is open.

\begin{definition}
\label{definition-J}
\begin{reference}
\cite[(32.B)]{MatCA}
\end{reference}
Let $R$ be a Noetherian ring. Let $X = \Spec(R)$.
\begin{enumerate}
\item We say $R$ is {\it J-0} if $\text{Reg}(X)$ contains a nonempty open.
\item We say $R$ is {\it J-1} if $\text{Reg}(X)$ is open.
\item We say $R$ is {\it J-2} if any finite type $R$-algebra is J-1.
\end{enumerate}
\end{definition}

\noindent
The ring $\mathbf{Q}[x]/(x^2)$ does not satisfy J-0, but it does satisfy J-1.
On the other hand, J-1 implies J-0 for Noetherian domains and more generally
nonzero reduced Noetherian rings as such a ring is regular at the minimal
primes. Here is a characterization of the J-1 property.

\begin{lemma}
\label{lemma-J-1}
Let $R$ be a Noetherian ring. Let $X = \Spec(R)$.
The ring $R$ is J-1 if and only if $V(\mathfrak p) \cap \text{Reg}(X)$
contains a nonempty open subset of $V(\mathfrak p)$ for all
$\mathfrak p \in \text{Reg}(X)$.
\end{lemma}

\begin{proof}
This follows from
Topology, Lemma \ref{topology-lemma-characterize-open-Noetherian}
and the fact that $\text{Reg}(X)$ is stable under generalization by
Algebra, Lemma \ref{algebra-lemma-localization-of-regular-local-is-regular}.
\end{proof}

\begin{lemma}
\label{lemma-intersection-regular-with-closed}
Let $R$ be a Noetherian ring. Let $X = \Spec(R)$. Assume that for all primes
$\mathfrak p \subset R$ the ring $R/\mathfrak p$ is J-0.
Then $R$ is J-1.
\end{lemma}

\begin{proof}
We will show that the criterion of Lemma \ref{lemma-J-1} applies.
Let $\mathfrak p \in \text{Reg}(X)$ be a prime of height $r$.
Pick $f_1, \ldots, f_r \in \mathfrak p$ which map to generators
of $\mathfrak pR_\mathfrak p$. Since $\mathfrak p \in \text{Reg}(X)$
we see that $f_1, \ldots, f_r$ maps to a regular sequence in $R_\mathfrak p$,
see Algebra, Lemma \ref{algebra-lemma-regular-ring-CM}. Thus by
Algebra, Lemma \ref{algebra-lemma-regular-sequence-in-neighbourhood}
we see that after replacing $R$ by $R_g$ for some $g \in R$,
$g \not \in \mathfrak p$ the sequence $f_1, \ldots, f_r$ is a
regular sequence in $R$. After another replacement we may also
assume $f_1, \ldots, f_r$ generate $\mathfrak p$.
Next, let $\mathfrak p \subset \mathfrak q$
be a prime ideal such that $(R/\mathfrak p)_\mathfrak q$ is
a regular local ring. By the assumption of the lemma there
exists a non-empty open subset of $V(\mathfrak p)$ consisting
of such primes, hence it suffices to prove $R_\mathfrak q$ is regular.
Note that $f_1, \ldots, f_r$ is a regular sequence in $R_\mathfrak q$
such that $R_\mathfrak q/(f_1, \ldots, f_r)R_\mathfrak q$ is regular.
Hence $R_\mathfrak q$ is regular by
Algebra, Lemma \ref{algebra-lemma-regular-mod-x}.
\end{proof}

\begin{lemma}
\label{lemma-J-0-goes-down}
Let $R \to S$ be a ring map. Assume that
\begin{enumerate}
\item $R$ is a Noetherian domain,
\item $R \to S$ is injective and of finite type, and
\item $S$ is a domain and J-0.
\end{enumerate}
Then $R$ is J-0.
\end{lemma}

\begin{proof}
After replacing $S$ by $S_g$ for some nonzero $g \in S$ we may assume
that $S$ is a regular ring. By generic flatness we may assume that also
$R \to S$ is faithfully flat, see
Algebra, Lemma \ref{algebra-lemma-generic-flatness-Noetherian}.
Then $R$ is regular by
Algebra, Lemma \ref{algebra-lemma-descent-regular}.
\end{proof}

\begin{lemma}
\label{lemma-J-0-goes-up}
Let $R \to S$ be a ring map. Assume that
\begin{enumerate}
\item $R$ is a Noetherian domain and J-0,
\item $R \to S$ is injective and of finite type, and
\item $S$ is a domain, and
\item the induced extension of fraction fields is separable.
\end{enumerate}
Then $S$ is J-0.
\end{lemma}

\begin{proof}
We may replace $R$ by a principal localization and assume $R$ is
a regular ring. By Algebra, Lemma \ref{algebra-lemma-smooth-at-generic-point}
the ring map $R \to S$ is smooth at $(0)$.
Hence after replacing $S$ by a principal localization
we may assume that $S$ is smooth over $R$.
Then $S$ is regular too, see
Algebra, Lemma \ref{algebra-lemma-regular-goes-up}.
\end{proof}

\begin{lemma}
\label{lemma-J-2}
Let $R$ be a Noetherian ring. The following are equivalent
\begin{enumerate}
\item $R$ is J-2,
\item every finite type $R$-algebra which is a domain is J-0,
\item every finite $R$-algebra is J-1,
\item for every prime $\mathfrak p$ and every finite purely inseparable
extension $L/\kappa(\mathfrak p)$ there exists a finite
$R$-algebra $R'$ which is a domain, which is J-0, and whose field
of fractions is $L$.
\end{enumerate}
\end{lemma}

\begin{proof}
It is clear that we have the implications (1) $\Rightarrow$ (2) and
(2) $\Rightarrow$ (4). Recall that a domain which is
J-1 is J-0. Hence we also have the implications
(1) $\Rightarrow$ (3) and (3) $\Rightarrow$ (4).

\medskip\noindent
Let $R \to S$ be a finite type ring map and let's try to show $S$ is J-1. By
Lemma \ref{lemma-intersection-regular-with-closed} it suffices
to prove that $S/\mathfrak q$ is J-0 for every prime $\mathfrak q$
of $S$. In this way we see (2) $\Rightarrow$ (1).

\medskip\noindent
Assume (4). We will show that (2) holds which will finish the proof.
Let $R \to S$ be a finite type ring map with $S$ a domain.
Let $\mathfrak p = \Ker(R \to S)$. Let $K$ be the fraction field of $S$.
There exists a diagram of fields
$$
\xymatrix{
K \ar[r] & K' \\
\kappa(\mathfrak p) \ar[u] \ar[r] & L \ar[u]
}
$$
where the horizontal arrows are finite purely inseparable field extensions
and where $K'/L$ is separable, see
Algebra, Lemma \ref{algebra-lemma-make-separably-generated}.
Choose $R' \subset L$ as in (4) and let
$S'$ be the image of the map $S \otimes_R R' \to K'$.
Then $S'$ is a domain whose fraction field is $K'$, hence
$S'$ is J-0 by Lemma \ref{lemma-J-0-goes-up} and our choice of $R'$.
Then we apply Lemma \ref{lemma-J-0-goes-down} to see that $S$
is J-0 as desired.
\end{proof}



\section{Regularity and derivations}
\label{section-regularity-derivations}

\noindent
Let $R \to S$ be a ring map. Let $D : R \to R$ be a derivation.
We say that $D$ {\it extends to} $S$
if there exists a derivation $D' : S \to S$ such that
$$
\xymatrix{
S \ar[r]_{D'} & S \\
R \ar[u] \ar[r]^D & R \ar[u]
}
$$
is commutative.

\begin{lemma}
\label{lemma-derivation-extends}
Let $R$ be a ring. Let $D : R \to R$ be a derivation.
\begin{enumerate}
\item For any ideal $I \subset R$ the derivation $D$ extends
canonically to a derivation $D^\wedge : R^\wedge \to R^\wedge$
on the $I$-adic completion.
\item For any multiplicative subset $S \subset R$ the derivation
$D$ extends uniquely to the localization $S^{-1}R$ of $R$.
\end{enumerate}
If $R \subset R'$ is a finite type extension of rings such that
$R_g \cong R'_g$ for some $g \in R$ which is a nonzerodivisor in $R'$,
then $g^ND$ extends to $R'$ for some $N \geq 0$.
\end{lemma}

\begin{proof}
Proof of (1). For $n \geq 2$ we have $D(I^n) \subset I^{n - 1}$
by the Leibniz rule. Hence $D$ induces maps $D_n : R/I^n \to R/I^{n - 1}$.
Taking the limit we obtain $D^\wedge$. We omit the verification that
$D^\wedge$ is a derivation.

\medskip\noindent
Proof of (2). To extend $D$ to $S^{-1}R$ just set
$D(r/s) = D(r)/s - rD(s)/s^2$ and check the axioms.

\medskip\noindent
Proof of the final statement. Let $x_1, \ldots, x_n \in R'$ be generators
of $R'$ over $R$. Choose an $N$ such that $g^Nx_i \in R$.
Consider $g^{N + 1}D$. By (2) this extends to $R_g$. Moreover, by
the Leibniz rule and our construction of the extension above we have
$$
g^{N + 1}D(x_i) = g^{N + 1}D(g^{-N} g^Nx_i) = -Ng^Nx_iD(g) +
gD(g^Nx_i)
$$
and both terms are in $R$. This implies that
$$
g^{N + 1}D(x_1^{e_1} \ldots x_n^{e_n}) =
\sum e_i x_1^{e_1} \ldots x_i^{e_i - 1} \ldots x_n^{e_n} g^{N + 1}D(x_i)
$$
is an element of $R'$. Hence every element of $R'$ (which can be written
as a sum of monomials in the $x_i$ with coefficients in $R$) is mapped to an
element of $R'$ by $g^{N + 1}D$ and we win.
\end{proof}

\begin{lemma}
\label{lemma-quotient-regular}
\begin{slogan}
The Jacobian criterion for hypersurfaces, done right.
\end{slogan}
Let $R$ be a regular ring. Let $f \in R$. Assume there exists a
derivation $D : R \to R$ such that $D(f)$ is a unit of $R/(f)$.
Then $R/(f)$ is regular.
\end{lemma}

\begin{proof}
It suffices to prove this when $R$ is a local ring with maximal ideal
$\mathfrak m$ and residue field $\kappa$. In this case it suffices
to prove that $f \not \in \mathfrak m^2$, see
Algebra, Lemma \ref{algebra-lemma-regular-ring-CM}.
However, if $f \in \mathfrak m^2$ then $D(f) \in \mathfrak m$
by the Leibniz rule, a contradiction.
\end{proof}

\begin{lemma}
\label{lemma-quotient-sequence-regular}
Let $(R, \mathfrak m, \kappa)$ be a regular local ring. Let $m \geq 1$. Let
$f_1, \ldots, f_m \in \mathfrak m$. Assume there exist derivations
$D_1, \ldots, D_m : R \to R$ such that
$\det_{1 \leq i, j \leq m}(D_i(f_j))$ is a unit of $R$.
Then $R/(f_1, \ldots, f_m)$ is regular and $f_1, \ldots, f_m$
is a regular sequence.
\end{lemma}

\begin{proof}
It suffices to prove that $f_1, \ldots, f_m$ are $\kappa$-linearly
independent in $\mathfrak m/\mathfrak m^2$, see
Algebra, Lemma \ref{algebra-lemma-regular-ring-CM}.
However, if there is a nontrivial linear relation the we get
$\sum a_i f_i \in \mathfrak m^2$ for some $a_i \in R$
but not all $a_i \in \mathfrak m$. Observe that
$D_i(\mathfrak m^2) \subset \mathfrak m$ and
$D_i(a_j f_j) \equiv a_j D_i(f_j) \bmod \mathfrak m$
by the Leibniz rule for derivations. Hence
this would imply
$$
\sum a_j D_i(f_j) \in \mathfrak m
$$
which would contradict the assumption on the determinant.
\end{proof}

\begin{lemma}
\label{lemma-degree-p-extension-regular}
Let $R$ be a regular ring. Let $f \in R$.
Assume there exists a derivation $D : R \to R$ such that $D(f)$ is a unit
of $R$. Then $R[z]/(z^n - f)$ is regular for any integer $n \geq 1$.
More generally, $R[z]/(p(z) - f)$ is regular for any $p \in \mathbf{Z}[z]$.
\end{lemma}

\begin{proof}
By Algebra, Lemma \ref{algebra-lemma-regular-goes-up} we see that
$R[z]$ is a regular ring. Apply Lemma \ref{lemma-quotient-regular}
to the extension of $D$ to $R[z]$ which maps $z$ to zero.
This works because $D$ annihilates any polynomial with
integer coefficients and sends $f$ to a unit.
\end{proof}

\begin{lemma}
\label{lemma-find-D}
Let $p$ be a prime number. Let $B$ be a domain with $p = 0$ in $B$.
Let $f \in B$ be an element which is not a $p$th power in the fraction
field of $B$. If $B$ is of finite type over a Noetherian complete
local ring, then there exists a derivation $D : B \to B$ such that $D(f)$
is not zero.
\end{lemma}

\begin{proof}
Let $R$ be a Noetherian complete local ring such that there exists
a finite type ring map $R \to B$. Of course we may replace $R$ by
its image in $B$, hence we may assume $R$ is a domain of characteristic
$p > 0$ (as well as Noetherian complete local). By Algebra, Lemma
\ref{algebra-lemma-complete-local-Noetherian-domain-finite-over-regular}
we can write $R$ as a finite extension of $k[[x_1, \ldots, x_n]]$ for some
field $k$ and integer $n$. Hence we may replace $R$ by $k[[x_1, \ldots, x_n]]$.
Next, we use
Algebra, Lemma \ref{algebra-lemma-Noether-normalization-over-a-domain}
to factor $R \to B$ as
$$
R \subset R[y_1, \ldots, y_d] \subset B' \subset B
$$
with $B'$ finite over $R[y_1, \ldots, y_d]$ and $B'_g \cong B_g$
for some nonzero $g \in R$. Note that $f' = g^{pN} f \in B'$ for some
large integer $N$. It is clear that $f'$ is not a $p$th power in
the fraction field of $B'$. If we can find a derivation
$D' : B' \to B'$ with $D'(f') \not = 0$, then
Lemma \ref{lemma-derivation-extends}
guarantees that $D = g^MD'$ extends to $B$ for some $M > 0$. Then
$D(f) = g^ND'(f) = g^MD'(g^{-pN}f') = g^{M - pN}D'(f')$ is nonzero.
Thus it suffices to prove the lemma in case
$B$ is a finite extension of $A = k[[x_1, \ldots, x_n]][y_1, \ldots, y_m]$.

\medskip\noindent
Assume $B$ is a finite extension of
$A = k[[x_1, \ldots, x_n]][y_1, \ldots, y_m]$.
Denote $L$ the fraction field of $B$.
Note that $\text{d}f$ is not zero in $\Omega_{L/\mathbf{F}_p}$, see
Algebra, Lemma \ref{algebra-lemma-derivative-zero-pth-power}.
We apply Lemma \ref{lemma-power-series-ring-subfields} to find a subfield
$k' \subset k$ of finite index such that with
$A' = k'[[x_1^p, \ldots, x_n^p]][y_1^p, \ldots, y_m^p]$
the element $\text{d}f$ does not map to zero in $\Omega_{L/K'}$
where $K'$ is the fraction field of $A'$.
Thus we can choose a $K'$-derivation $D' : L \to L$
with $D'(f) \not = 0$. Since $A' \subset A$ and $A \subset B$ are
finite by construction we see that $A' \subset B$ is finite.
Choose $b_1, \ldots, b_t \in B$ which generate $B$ as an $A'$-module.
Then $D'(b_i) = f_i/g_i$ for some $f_i, g_i \in B$ with $g_i \not = 0$.
Setting $D = g_1 \ldots g_t D'$ we win.
\end{proof}

\begin{lemma}
\label{lemma-complete-Noetherian-domain-J-0}
Let $A$ be a Noetherian complete local domain. Then $A$ is J-0.
\end{lemma}

\begin{proof}
By Algebra, Lemma
\ref{algebra-lemma-complete-local-Noetherian-domain-finite-over-regular}
we can find a regular subring $A_0 \subset A$ with $A$ finite over $A_0$.
The induced extension $K/K_0$ of fraction fields is finite.
If $K/K_0$ is separable, then we are done by
Lemma \ref{lemma-J-0-goes-up}. If not, then $A_0$ and $A$
have characteristic $p > 0$. For any subextension $K/M/K_0$
there exists a finite subextension $A_0 \subset B \subset A$
whose fraction field is $M$. Hence, arguing by induction on
$[K : K_0]$ we may assume there exists $A_0 \subset B \subset A$ such that
$B$ is J-0 and $K/M$ has no nontrivial subextensions.
In this case, if $K/M$ is separable, then we
see that $A$ is J-0 by Lemma \ref{lemma-J-0-goes-up}.
If not, then $K = M[z]/(z^p - b_1/b_2)$ for some $b_1, b_2 \in B$
with $b_2 \not = 0$ and $b_1/b_2$ not a $p$th power in $M$.
Choose $a \in A$ nonzero such that $az \in A$. After replacing
$z$ by $b_2 a^p z$ we obtain $K = M[z]/(z^p - b)$ with
$z \in A$ and $b \in B$ not a $p$th power in $M$.
By Lemma \ref{lemma-find-D}
we can find a derivation $D : B \to B$ with $D(b) \not = 0$.
Applying Lemma \ref{lemma-degree-p-extension-regular}
we see that $A_\mathfrak p$ is regular for any prime
$\mathfrak p$ of $A$ lying over a regular prime of $B$
and not containing $D(b)$. As $B$ is J-0 we conclude $A$ is too.
\end{proof}

\begin{proposition}
\label{proposition-ubiquity-J-2}
The following types of rings are J-2:
\begin{enumerate}
\item fields,
\item Noetherian complete local rings,
\item $\mathbf{Z}$,
\item Noetherian local rings of dimension $1$,
\item Nagata rings of dimension $1$,
\item Dedekind domains with fraction field of characteristic zero,
\item finite type ring extensions of any of the above.
\end{enumerate}
\end{proposition}

\begin{proof}
For cases (1), (3), (5), and (6) this is proved by checking
condition (4) of Lemma \ref{lemma-J-2}. We will only do this
in case $R$ is a Nagata ring of dimension $1$. Let $\mathfrak p \subset R$
be a prime ideal and let $L/\kappa(\mathfrak p)$ be a finite
purely inseparable extension. If $\mathfrak p \subset R$ is a
maximal ideal, then $R \to L$ is finite and $L$ is a regular ring
and we've checked the condition. If $\mathfrak p \subset R$ is a
minimal prime, then the Nagata condition insures that the
integral closure $R' \subset L$ of $R$ in $L$ is finite over $R$.
Then $R'$ is a normal domain of dimension $1$
(Algebra, Lemma \ref{algebra-lemma-integral-dim-up})
hence regular (Algebra, Lemma \ref{algebra-lemma-criterion-normal})
and we've checked the condition in this case as well.

\medskip\noindent
For case (2), we will use condition (3) of Lemma \ref{lemma-J-2}.
Let $R$ be a Noetherian complete local ring.
Note that if $R \to R'$ is finite, then $R'$ is a product of
Noetherian complete local rings, see
Algebra, Lemma \ref{algebra-lemma-quotient-complete-local}.
Hence it suffices to prove that a Noetherian complete local ring
which is a domain is J-0, which is
Lemma \ref{lemma-complete-Noetherian-domain-J-0}.

\medskip\noindent
For case (4), we also use condition (3) of Lemma \ref{lemma-J-2}.
Namely, if $R$ is a local Noetherian ring of dimension $1$ and
$R \to R'$ is finite, then $\Spec(R')$ is finite. Since the
regular locus is stable under generalization, we see
that $R'$ is J-1.
\end{proof}





\section{Formal smoothness and regularity}
\label{section-fs-regular}

\noindent
The title of this section refers to Proposition \ref{proposition-fs-regular}.

\begin{lemma}
\label{lemma-lift-derivation-through-fs}
Let $A \to B$ be a local homomorphism of Noetherian local rings.
Let $D : A \to A$ be a derivation. Assume that $B$ is complete
and $A \to B$ is formally smooth in the $\mathfrak m_B$-adic topology.
Then there exists an extension $D' : B \to B$ of $D$.
\end{lemma}

\begin{proof}
Denote $B[\epsilon] = B[x]/(x^2)$ the ring of dual numbers over $B$.
Consider the ring map $\psi : A \to B[\epsilon]$,
$a \mapsto a + \epsilon D(a)$.
Consider the commutative diagram
$$
\xymatrix{
B \ar[r]_1 & B \\
A \ar[u] \ar[r]^\psi & B[\epsilon] \ar[u]
}
$$
By Lemma \ref{lemma-lift-continuous} and the assumption of formal
smoothness of $B/A$ we find a map $\varphi : B \to B[\epsilon]$ fitting into
the diagram. Write $\varphi(b) = b + \epsilon D'(b)$. Then $D' : B \to B$
is the desired extension.
\end{proof}

\begin{proposition}
\label{proposition-fs-regular}
Let $A \to B$ be a local homomorphism of Noetherian complete local rings.
Let $k$ be the residue field of $A$ and $\overline{B} = B \otimes_A k$
the special fibre.
The following are equivalent
\begin{enumerate}
\item $A \to B$ is regular,
\item $A \to B$ is flat and $\overline{B}$ is geometrically regular
over $k$,
\item $A \to B$ is flat and $k \to \overline{B}$ is formally smooth
in the $\mathfrak m_{\overline{B}}$-adic topology, and
\item $A \to B$ is formally smooth in the $\mathfrak m_B$-adic
topology.
\end{enumerate}
\end{proposition}

\begin{proof}
We have seen the equivalence of (2), (3), and (4) in
Proposition \ref{proposition-fs-flat-fibre-fs}.
It is clear that (1) implies (2).
Thus we assume the equivalent conditions (2), (3), and (4) hold
and we prove (1).

\medskip\noindent
Let $\mathfrak p$ be a prime of $A$. We will show that
$B \otimes_A \kappa(\mathfrak p)$ is geometrically regular
over $\kappa(\mathfrak p)$.
By Lemma \ref{lemma-base-change-fs}
we may replace $A$ by $A/\mathfrak p$ and $B$ by $B/\mathfrak pB$.
Thus we may assume that $A$ is a domain and that $\mathfrak p = (0)$.

\medskip\noindent
Choose $A_0 \subset A$ as in Algebra, Lemma
\ref{algebra-lemma-complete-local-Noetherian-domain-finite-over-regular}.
We will use all the properties stated in that lemma without further mention.
As $A_0 \to A$ induces an isomorphism on residue fields, and as
$B/\mathfrak m_A B$ is geometrically regular over $A/\mathfrak m_A$
we can find a diagram
$$
\xymatrix{
C \ar[r] & B \\
A_0 \ar[r] \ar[u] & A \ar[u]
}
$$
with $A_0 \to C$ formally smooth in the $\mathfrak m_C$-adic topology
such that $B = C \otimes_{A_0} A$, see Remark \ref{remark-what-does-it-mean}.
(Completion in the tensor product is not needed as $A_0 \to A$ is
finite, see Algebra, Lemma \ref{algebra-lemma-completion-tensor}.)
Hence it suffices to show that $C \otimes_{A_0} K_0$
is a geometrically regular algebra over the fraction field $K_0$ of $A_0$.

\medskip\noindent
The upshot of the preceding paragraph is that we may assume that
$A = k[[x_1, \ldots, x_n]]$ where $k$ is a field or
$A = \Lambda[[x_1, \ldots, x_n]]$ where $\Lambda$ is a Cohen ring.
In this case $B$ is a regular ring, see
Algebra, Lemma \ref{algebra-lemma-flat-over-regular-with-regular-fibre}.
Hence $B \otimes_A K$ is a regular ring too (where $K$ is the
fraction field of $A$) and we win
if the characteristic of $K$ is zero.

\medskip\noindent
Thus we are left with the case where $A = k[[x_1, \ldots, x_n]]$
and $k$ is a field of characteristic $p > 0$.
Let $L/K$ be a finite purely inseparable field extension.
We will show by induction on $[L : K]$ that $B \otimes_A L$
is regular. The base case is $L = K$ which we've seen above.
Let $K \subset M \subset L$ be a subfield such that
$L$ is a degree $p$ extension of $M$ obtained by adjoining a $p$th root
of an element $f \in M$. Let $A'$ be a finite $A$-subalgebra
of $M$ with fraction field $M$. Clearing denominators, we may and do assume
$f \in A'$. Set $A'' = A'[z]/(z^p -f)$ and note that $A' \subset A''$
is finite and that the fraction field of $A''$ is $L$.
By induction we know that $B \otimes_A M$ ring is regular.
We have
$$
B \otimes_A L = B \otimes_A M[z]/(z^p - f)
$$
By Lemma \ref{lemma-find-D} we know there exists a derivation
$D : A' \to A'$ such that $D(f) \not = 0$. As $A' \to B \otimes_A A'$
is formally smooth in the $\mathfrak m$-adic topology by
Lemma \ref{lemma-descent-fs}
we can use
Lemma \ref{lemma-lift-derivation-through-fs}
to extend $D$ to a derivation $D' : B \otimes_A A' \to B \otimes_A A'$.
Note that $D'(f) = D(f)$ is a unit in $B \otimes_A M$ as $D(f)$
is not zero in $A' \subset M$. Hence $B \otimes_A L$ is regular by
Lemma \ref{lemma-degree-p-extension-regular} and we win.
\end{proof}





\section{G-rings}
\label{section-G-ring}

\noindent
Let $A$ be a Noetherian local ring $A$. In
Section \ref{section-permanence-completion}
we have seen that some but not all properties of $A$ are reflected in
the completion $A^\wedge$ of $A$. To study this further we introduce
some terminology. For a prime $\mathfrak q$ of $A$ the fibre ring
$$
A^\wedge \otimes_A \kappa(\mathfrak q) =
(A^\wedge)_\mathfrak q/\mathfrak q(A^\wedge)_\mathfrak q =
(A/\mathfrak q)^\wedge \otimes_{A/q} \kappa(\mathfrak q)
$$
is called a {\it formal fibre} of $A$. We think of the formal
fibre as an algebra over $\kappa(\mathfrak q)$. Thus $A \to A^\wedge$
is a regular ring homomorphism if and only if all the formal fibres are
geometrically regular algebras.

\begin{definition}
\label{definition-G-ring}
A ring $R$ is called a {\it G-ring} if $R$ is Noetherian and for every
prime $\mathfrak p$ of $R$ the ring map
$R_\mathfrak p \to (R_\mathfrak p)^\wedge$ is regular.
\end{definition}

\noindent
By the discussion above we see that $R$ is a G-ring if and only if
every local ring $R_\mathfrak p$ has geometrically regular formal fibres.
Note that if $\mathbf{Q} \subset R$, then it suffices to check the
formal fibres are regular.
Another way to express the G-ring condition is described in the
following lemma.

\begin{lemma}
\label{lemma-check-G-ring-easy}
Let $R$ be a Noetherian ring. Then $R$ is a G-ring if and only if
for every pair of primes $\mathfrak q \subset \mathfrak p \subset R$
the algebra
$$
(R/\mathfrak q)_\mathfrak p^\wedge \otimes_{R/\mathfrak q} \kappa(\mathfrak q)
$$
is geometrically regular over $\kappa(\mathfrak q)$.
\end{lemma}

\begin{proof}
This follows from the fact that
$$
R_\mathfrak p^\wedge \otimes_R \kappa(\mathfrak q) =
(R/\mathfrak q)_\mathfrak p^\wedge \otimes_{R/\mathfrak q} \kappa(\mathfrak q)
$$
as algebras over $\kappa(\mathfrak q)$.
\end{proof}

\begin{lemma}
\label{lemma-G-ring-goes-up-quasi-finite}
Let $R \to R'$ be a finite type map of Noetherian rings and let
$$
\xymatrix{
\mathfrak q' \ar[r] & \mathfrak p' \ar[r] & R' \\
\mathfrak q \ar[r] \ar@{-}[u] &
\mathfrak p \ar[r] \ar@{-}[u] & R \ar[u]
}
$$
be primes. Assume $R \to R'$ is quasi-finite at $\mathfrak p'$.
\begin{enumerate}
\item If the formal fibre $R_\mathfrak p^\wedge \otimes_R \kappa(\mathfrak q)$
is geometrically regular over $\kappa(\mathfrak q)$, then the formal fibre
$R'_{\mathfrak p'} \otimes_{R'} \kappa(\mathfrak q')$ is geometrically regular
over $\kappa(\mathfrak q')$.
\item If the formal fibres of $R_\mathfrak p$ are geometrically regular,
then the formal fibres of $R'_{\mathfrak p'}$ are geometrically regular.
\item If $R \to R'$ is quasi-finite and $R$ is a G-ring, then $R'$ is
a G-ring.
\end{enumerate}
\end{lemma}

\begin{proof}
It is clear that (1) $\Rightarrow$ (2) $\Rightarrow$ (3).
Assume $R_\mathfrak p^\wedge \otimes_R \kappa(\mathfrak q)$
is geometrically regular over $\kappa(\mathfrak q)$.
By Algebra, Lemma \ref{algebra-lemma-completion-at-quasi-finite-prime}
we see that
$$
R_\mathfrak p^\wedge \otimes_R R'
=
(R'_{\mathfrak p'})^\wedge \times B
$$
for some $R_\mathfrak p^\wedge$-algebra $B$. Hence
$R'_{\mathfrak p'} \to (R'_{\mathfrak p'})^\wedge$ is a factor of
a base change of the map $R_\mathfrak p \to R_\mathfrak p^\wedge$.
It follows that $(R'_{\mathfrak p'})^\wedge \otimes_{R'} \kappa(\mathfrak q')$
is a factor of
$$
R_\mathfrak p^\wedge \otimes_R R' \otimes_{R'} \kappa(\mathfrak q') =
R_\mathfrak p^\wedge \otimes_R \kappa(\mathfrak q)
\otimes_{\kappa(\mathfrak q)} \kappa(\mathfrak q').
$$
Thus the result follows as extension of base field preserves
geometric regularity, see
Algebra, Lemma \ref{algebra-lemma-geometrically-regular}.
\end{proof}

\begin{lemma}
\label{lemma-check-G-ring}
Let $R$ be a Noetherian ring. Then $R$ is a G-ring if and only if
for every finite free ring map $R \to S$ the formal fibres of $S$
are regular rings.
\end{lemma}

\begin{proof}
Assume that for any finite free ring map $R \to S$ the ring $S$ has
regular formal fibres. Let $\mathfrak q \subset \mathfrak p \subset R$
be primes and let $\kappa(\mathfrak q) \subset L$ be a finite purely
inseparable extension. To show that $R$ is a G-ring it suffices to
show that
$$
R_\mathfrak p^\wedge \otimes_R \kappa(\mathfrak q)
\otimes_{\kappa(\mathfrak q)} L
$$
is a regular ring. Choose a finite free extension $R \to R'$ such that
$\mathfrak q' = \mathfrak qR'$ is a prime and such that $\kappa(\mathfrak q')$
is isomorphic to $L$ over $\kappa(\mathfrak q)$, see
Algebra, Lemma \ref{algebra-lemma-finite-free-given-residue-field-extension}.
By
Algebra, Lemma \ref{algebra-lemma-completion-finite-extension}
we have
$$
R_\mathfrak p^\wedge \otimes_R R' = \prod (R'_{\mathfrak p_i'})^\wedge
$$
where $\mathfrak p_i'$ are the primes of $R'$ lying over $\mathfrak p$.
Thus we have
$$
R_\mathfrak p^\wedge \otimes_R \kappa(\mathfrak q)
\otimes_{\kappa(\mathfrak q)} L =
R_\mathfrak p^\wedge \otimes_R R'
\otimes_{R'} \kappa(\mathfrak q')
=
\prod (R'_{\mathfrak p_i'})^\wedge
\otimes_{R'_{\mathfrak p'_i}} \kappa(\mathfrak q')
$$
Our assumption is that the rings on the right are regular, hence the
ring on the left is regular too. Thus $R$ is a G-ring. The converse
follows from Lemma \ref{lemma-G-ring-goes-up-quasi-finite}.
\end{proof}

\begin{lemma}
\label{lemma-helper-G-ring}
Let $k$ be a field of characteristic $p$.
Let $A = k[[x_1, \ldots, x_n]][y_1, \ldots, y_n]$ and denote $K$
the fraction field of $A$.
Let $\mathfrak p \subset A$ be a prime. Then
$A_\mathfrak p^\wedge \otimes_A K$ is geometrically regular over $K$.
\end{lemma}

\begin{proof}
Let $L/K$ be a finite purely inseparable field extension.
We will show by induction on $[L : K]$ that $A_\mathfrak p^\wedge \otimes L$
is regular. The base case is $L = K$: as $A$ is regular,
$A_\mathfrak p^\wedge$ is regular (Lemma \ref{lemma-completion-regular}),
hence the localization $A_\mathfrak p^\wedge \otimes K$ is regular.
Let $K \subset M \subset L$ be a subfield such that
$L$ is a degree $p$ extension of $M$ obtained by adjoining a $p$th root
of an element $f \in M$. Let $B$ be a finite $A$-subalgebra
of $M$ with fraction field $M$. Clearing denominators, we may and do assume
$f \in B$. Set $C = B[z]/(z^p -f)$ and note that $B \subset C$
is finite and that the fraction field of $C$ is $L$. Since
$A \subset B \subset C$ are finite and $L/M/K$ are purely
inseparable we see that for every element of $B$ or $C$ some power of
it lies in $A$. Hence there is a unique prime $\mathfrak r \subset B$,
resp.\ $\mathfrak q \subset C$ lying over $\mathfrak p$. Note that
$$
A_\mathfrak p^\wedge \otimes_A M = B_\mathfrak r^\wedge \otimes_B M
$$
see Algebra, Lemma \ref{algebra-lemma-completion-finite-extension}.
By induction we know that this ring is regular. In the same manner we have
$$
A_\mathfrak p^\wedge \otimes_A L =
C_\mathfrak r^\wedge \otimes_C L =
B_\mathfrak r^\wedge \otimes_B M[z]/(z^p - f)
$$
the last equality because the completion of
$C = B[z]/(z^p - f)$ equals $B_\mathfrak r^\wedge[z]/(z^p -f)$.
By Lemma \ref{lemma-find-D} we know there exists a derivation
$D : B \to B$ such that $D(f) \not = 0$. In other words, $g = D(f)$
is a unit in $M$! By Lemma \ref{lemma-derivation-extends}
$D$ extends to a derivation of $B_\mathfrak r$, $B_\mathfrak r^\wedge$
and $B_\mathfrak r^\wedge \otimes_B M$ (successively extending through a
localization, a completion, and a localization). Since it is an
extension we end up with a derivation of $B_\mathfrak r^\wedge \otimes_B M$
which maps $f$ to $g$ and $g$ is a unit of the ring
$B_\mathfrak r^\wedge \otimes_B M$.
Hence $A_\mathfrak p^\wedge \otimes_A L$ is regular by
Lemma \ref{lemma-degree-p-extension-regular} and we win.
\end{proof}

\begin{proposition}
\label{proposition-Noetherian-complete-G-ring}
A Noetherian complete local ring is a G-ring.
\end{proposition}

\begin{proof}
Let $A$ be a Noetherian complete local ring. By
Lemma \ref{lemma-check-G-ring-easy}
it suffices to check that $B = A/\mathfrak q$ has geometrically regular
formal fibres over the minimal prime $(0)$ of $B$. Thus we may assume
that $A$ is a domain and it suffices to check the condition for
the formal fibres over the minimal prime $(0)$ of $A$.
Let $K$ be the fraction field of $A$.

\medskip\noindent
We can choose a subring $A_0 \subset A$ which is a regular complete local
ring such that $A$ is finite over $A_0$, see Algebra, Lemma
\ref{algebra-lemma-complete-local-Noetherian-domain-finite-over-regular}.
Moreover, we may assume that $A_0$ is a power series ring over a
field or a Cohen ring. By Lemma \ref{lemma-G-ring-goes-up-quasi-finite}
we see that it suffices to prove the result for $A_0$.

\medskip\noindent
Assume that $A$ is a power series ring over a field or a Cohen ring.
Since $A$ is regular the localizations $A_\mathfrak p$ are regular
(see Algebra, Definition \ref{algebra-definition-regular} and the
discussion preceding it).
Hence the completions $A_\mathfrak p^\wedge$ are regular, see
Lemma \ref{lemma-completion-regular}.
Hence the fibre $A_{\mathfrak p}^\wedge \otimes_A K$ is, as a localization
of $A_\mathfrak p^\wedge$, also regular. Thus we are done if the
characteristic of $K$ is $0$. The positive characteristic case
is the case $A = k[[x_1, \ldots, x_d]]$ which is a special case of
Lemma \ref{lemma-helper-G-ring}.
\end{proof}

\begin{lemma}
\label{lemma-check-G-ring-maximal-ideals}
Let $R$ be a Noetherian ring. Then $R$ is a G-ring if and only if
$R_\mathfrak m$ has geometrically regular formal fibres for every
maximal ideal $\mathfrak m$ of $R$.
\end{lemma}

\begin{proof}
Assume $R_\mathfrak m \to R_\mathfrak m^\wedge$ is regular for every
maximal ideal $\mathfrak m$ of $R$. Let $\mathfrak p$ be a prime of
$R$ and choose a maximal ideal $\mathfrak p \subset \mathfrak m$.
Since $R_\mathfrak m \to R_\mathfrak m^\wedge$ is faithfully flat
we can choose a prime $\mathfrak p'$ if $R_\mathfrak m^\wedge$
lying over $\mathfrak pR_\mathfrak m$. Consider the commutative diagram
$$
\xymatrix{
R_\mathfrak m^\wedge \ar[r] &
(R_\mathfrak m^\wedge)_{\mathfrak p'} \ar[r] &
(R_\mathfrak m^\wedge)_{\mathfrak p'}^\wedge
\\
R_\mathfrak m \ar[u] \ar[r] & R_\mathfrak p \ar[u] \ar[r] &
R_\mathfrak p^\wedge \ar[u]
}
$$
By assumption the ring map $R_\mathfrak m \to R_\mathfrak m^\wedge$ is
regular. By Proposition \ref{proposition-Noetherian-complete-G-ring}
$(R_\mathfrak m^\wedge)_{\mathfrak p'} \to
(R_\mathfrak m^\wedge)_{\mathfrak p'}^\wedge$ is regular.
The localization
$R_\mathfrak m^\wedge \to (R_\mathfrak m^\wedge)_{\mathfrak p'}$ is regular.
Hence $R_\mathfrak m \to (R_\mathfrak m^\wedge)_{\mathfrak p'}^\wedge$
is regular by Lemma \ref{lemma-regular-composition}.
Since it factors through the localization $R_\mathfrak p$, also the ring map
$R_\mathfrak p \to (R_\mathfrak m^\wedge)_{\mathfrak p'}^\wedge$
is regular. Thus we may apply Lemma \ref{lemma-regular-permanence} to see that
$R_\mathfrak p \to R_\mathfrak p^\wedge$ is regular.
\end{proof}

\begin{lemma}
\label{lemma-henselization-G-ring}
Let $R$ be a Noetherian local ring which is a G-ring.
Then the henselization $R^h$ and the strict henselization $R^{sh}$
are G-rings.
\end{lemma}

\begin{proof}
We will use the criterion of Lemma \ref{lemma-check-G-ring-maximal-ideals}.
Let $\mathfrak q \subset R^h$ be a prime and set
$\mathfrak p = R \cap \mathfrak q$. Set $\mathfrak q_1 = \mathfrak q$
and let $\mathfrak q_2, \ldots, \mathfrak q_t$
be the other primes of $R^h$ lying over $\mathfrak p$, so that
$R^h \otimes_R \kappa(\mathfrak p) =
\prod\nolimits_{i = 1, \ldots, t} \kappa(\mathfrak q_i)$, see
Lemma \ref{lemma-fibres-henselization}.
Using that $(R^h)^\wedge = R^\wedge$
(Lemma \ref{lemma-henselization-noetherian}) we see
$$
\prod\nolimits_{i = 1, \ldots, t}
(R^h)^\wedge \otimes_{R^h} \kappa(\mathfrak q_i) =
(R^h)^\wedge \otimes_{R^h} (R^h \otimes_R \kappa(\mathfrak p)) =
R^\wedge \otimes_R \kappa(\mathfrak p)
$$
Hence $(R^h)^\wedge \otimes_{R^h} \kappa(\mathfrak q_i)$
is geometrically regular over $\kappa(\mathfrak p)$ by assumption.
Since $\kappa(\mathfrak q_i)$ is separable algebraic over $\kappa(\mathfrak p)$
it follows from Algebra, Lemma
\ref{algebra-lemma-geometrically-regular-over-separable-algebraic} that
$(R^h)^\wedge \otimes_{R^h} \kappa(\mathfrak q_i)$ is
geometrically regular over $\kappa(\mathfrak q_i)$.

\medskip\noindent
Let $\mathfrak r \subset R^{sh}$ be a prime and set
$\mathfrak p = R \cap \mathfrak r$. Set $\mathfrak r_1 = \mathfrak r$
and let $\mathfrak r_2, \ldots, \mathfrak r_s$
be the other primes of $R^{sh}$ lying over $\mathfrak p$, so that
$R^{sh} \otimes_R \kappa(\mathfrak p) =
\prod\nolimits_{i = 1, \ldots, s} \kappa(\mathfrak r_i)$, see
Lemma \ref{lemma-fibres-henselization}.
Then we see that
$$
\prod\nolimits_{i = 1, \ldots, s}
(R^{sh})^\wedge \otimes_{R^{sh}} \kappa(\mathfrak r_i) =
(R^{sh})^\wedge \otimes_{R^{sh}} (R^{sh} \otimes_R \kappa(\mathfrak p)) =
(R^{sh})^\wedge \otimes_R \kappa(\mathfrak p)
$$
Note that $R^\wedge \to (R^{sh})^\wedge$ is formally smooth
in the $\mathfrak m_{(R^{sh})^\wedge}$-adic topology, see
Lemma \ref{lemma-henselization-noetherian}.
Hence $R^\wedge \to (R^{sh})^\wedge$ is regular by
Proposition \ref{proposition-fs-regular}.
We conclude that $(R^{sh})^\wedge \otimes_{R^{sh}} \kappa(\mathfrak r_i)$
is regular over $\kappa(\mathfrak p)$ by
Lemma \ref{lemma-regular-composition} as
$R^\wedge \otimes_R \kappa(\mathfrak p)$ is regular over $\kappa(\mathfrak p)$
by assumption. Since $\kappa(\mathfrak r_i)$ is separable algebraic over
$\kappa(\mathfrak p)$
it follows from Algebra, Lemma
\ref{algebra-lemma-geometrically-regular-over-separable-algebraic} that
$(R^{sh})^\wedge \otimes_{R^{sh}} \kappa(\mathfrak r_i)$ is
geometrically regular over $\kappa(\mathfrak r_i)$.
\end{proof}

\begin{lemma}
\label{lemma-another-helper-G-ring}
Let $p$ be a prime number. Let $A$ be a Noetherian complete local domain
with fraction field $K$ of characteristic $p$. Let $\mathfrak q \subset A[x]$
be a maximal ideal lying over the maximal ideal of $A$ and let
$(0) \not = \mathfrak r \subset \mathfrak q$ be a prime lying over
$(0) \subset A$. Then
$A[x]_\mathfrak q^\wedge \otimes_{A[x]} \kappa(\mathfrak r)$ is geometrically
regular over $\kappa(\mathfrak r)$.
\end{lemma}

\begin{proof}
Note that $K \subset \kappa(\mathfrak r)$ is finite.
Hence, given a finite purely
inseparable extension $L/\kappa(\mathfrak r)$ there exists a finite
extension of Noetherian complete local domains $A \subset B$ such that
$\kappa(\mathfrak r) \otimes_A B$ surjects onto $L$.
Namely, you take $B \subset L$
a finite $A$-subalgebra whose field of fractions is $L$. Denote
$\mathfrak r' \subset B[x]$ the kernel of the map
$B[x] = A[x] \otimes_A B \to \kappa(\mathfrak r) \otimes_A B \to L$
so that $\kappa(\mathfrak r') = L$. Then
$$
A[x]_\mathfrak q^\wedge \otimes_{A[x]} L =
A[x]_\mathfrak q^\wedge \otimes_{A[x]} B[x]
\otimes_{B[x]} \kappa(\mathfrak r') =
\prod B[x]_{\mathfrak q_i}^\wedge \otimes_{B[x]} \kappa(\mathfrak r')
$$
where $\mathfrak q_1, \ldots, \mathfrak q_t$ are the primes of $B[x]$
lying over $\mathfrak q$, see
Algebra, Lemma \ref{algebra-lemma-completion-finite-extension}.
Thus we see that it suffices to prove the rings
$B[x]_{\mathfrak q_i}^\wedge \otimes_{B[x]} \kappa(\mathfrak r')$
are regular. This reduces us to showing that
$A[x]_\mathfrak q^\wedge \otimes_{A[x]} \kappa(\mathfrak r)$
is regular in the special case that $K = \kappa(\mathfrak r)$.

\medskip\noindent
Assume $K = \kappa(\mathfrak r)$. In this case we see that
$\mathfrak r K[x]$ is generated by $x - f$ for some $f \in K$
and
$$
A[x]_\mathfrak q^\wedge \otimes_{A[x]} \kappa(\mathfrak r)
=
(A[x]_\mathfrak q^\wedge \otimes_A K)/(x - f)
$$
The derivation $D = \text{d}/\text{d}x$ of $A[x]$ extends to $K[x]$ and
maps $x - f$ to a unit of $K[x]$. Moreover $D$ extends to
$A[x]_\mathfrak q^\wedge \otimes_A K$ by Lemma \ref{lemma-derivation-extends}.
As $A \to A[x]_\mathfrak q^\wedge$ is formally smooth (see
Lemmas \ref{lemma-formally-smooth} and
\ref{lemma-formally-smooth-completion})
the ring $A[x]_\mathfrak q^\wedge \otimes_A K$ is regular by
Proposition \ref{proposition-fs-regular} (the arguments of the
proof of that proposition simplify significantly in this particular case).
We conclude by Lemma \ref{lemma-quotient-regular}.
\end{proof}

\begin{proposition}
\label{proposition-finite-type-over-G-ring}
Let $R$ be a G-ring. If $R \to S$ is essentially of finite type
then $S$ is a G-ring.
\end{proposition}

\begin{proof}
Since being a G-ring is a property of the local rings it is clear
that a localization of a G-ring is a G-ring. Conversely, if every
localization at a prime is a G-ring, then the ring is a G-ring.
Thus it suffices to show that $S_\mathfrak q$ is a G-ring for every
finite type $R$-algebra $S$ and every prime $\mathfrak q$ of $S$.
Writing $S$ as a quotient of $R[x_1, \ldots, x_n]$ we see from
Lemma \ref{lemma-G-ring-goes-up-quasi-finite} that it suffices to prove
that $R[x_1, \ldots, x_n]$ is a G-ring. By induction on $n$ it
suffices to prove that $R[x]$ is a G-ring. Let $\mathfrak q \subset R[x]$
be a maximal ideal. By Lemma \ref{lemma-check-G-ring-maximal-ideals}
it suffices to show that
$$
R[x]_\mathfrak q \longrightarrow R[x]_\mathfrak q^\wedge
$$
is regular. If $\mathfrak q$ lies over $\mathfrak p \subset R$, then
we may replace $R$ by $R_\mathfrak p$. Hence we may assume that $R$
is a Noetherian local G-ring with maximal ideal $\mathfrak m$ and
that $\mathfrak q \subset R[x]$ lies over $\mathfrak m$. Note that
there is a unique prime $\mathfrak q' \subset R^\wedge[x]$
lying over $\mathfrak q$. Consider the diagram
$$
\xymatrix{
R[x]_\mathfrak q^\wedge \ar[r] &
(R^\wedge[x]_{\mathfrak q'})^\wedge \\
R[x]_\mathfrak q \ar[r] \ar[u] & R^\wedge[x]_{\mathfrak q'} \ar[u]
}
$$
Since $R$ is a G-ring the lower horizontal arrow is regular
(as a localization of a base change of the regular ring map
$R \to R^\wedge$). Suppose we can prove the right vertical arrow
is regular. Then it follows that the composition
$R[x]_\mathfrak q \to (R^\wedge[x]_{\mathfrak q'})^\wedge$
is regular, and hence the left vertical arrow is regular by
Lemma \ref{lemma-regular-permanence}.
Hence we see that we may assume $R$ is a Noetherian complete
local ring and $\mathfrak q$ a prime lying over the maximal
ideal of $R$.

\medskip\noindent
Let $R$ be a Noetherian complete local ring and let $\mathfrak q \subset R[x]$
be a maximal ideal lying over the maximal ideal of $R$. Let
$\mathfrak r \subset \mathfrak q$ be a prime ideal. We want to show that
$R[x]_\mathfrak q^\wedge \otimes_{R[x]} \kappa(\mathfrak r)$ is
a geometrically regular algebra over $\kappa(\mathfrak r)$.
Set $\mathfrak p = R \cap \mathfrak r$. Then we can replace $R$
by $R/\mathfrak p$ and $\mathfrak q$ and $\mathfrak r$ by their
images in $R/\mathfrak p[x]$, see
Lemma \ref{lemma-check-G-ring-easy}.
Hence we may assume that $R$ is a domain and that $\mathfrak r \cap R = (0)$.

\medskip\noindent
By  Algebra, Lemma
\ref{algebra-lemma-complete-local-Noetherian-domain-finite-over-regular}
we can find $R_0 \subset R$ which is regular and such that $R$ is
finite over $R_0$. Applying Lemma \ref{lemma-G-ring-goes-up-quasi-finite}
we see that it suffices to prove
$R[x]_\mathfrak q^\wedge \otimes_{R[x]} \kappa(\mathfrak r)$
is geometrically regular over $\kappa(r)$ when, in addition to the above,
$R$ is a regular complete local ring.

\medskip\noindent
Now $R$ is a regular complete local ring, we have
$\mathfrak q \subset \mathfrak r \subset R[x]$, we have
$(0) = R \cap \mathfrak r$ and $\mathfrak q$ is a maximal ideal
lying over the maximal ideal of $R$. Since $R$ is regular the
ring $R[x]$ is regular (Algebra, Lemma \ref{algebra-lemma-regular-goes-up}).
Hence the localization $R[x]_\mathfrak q$ is regular.
Hence the completions $R[x]_\mathfrak q^\wedge$ are regular, see
Lemma \ref{lemma-completion-regular}.
Hence the fibre $R[x]_{\mathfrak q}^\wedge \otimes_{R[x]} \kappa(\mathfrak r)$
is, as a localization of $R[x]_\mathfrak q^\wedge$, also regular.
Thus we are done if the characteristic of the fraction field of $R$ is $0$.

\medskip\noindent
If the characteristic of $R$ is positive, then $R = k[[x_1, \ldots, x_n]]$.
In this case we split the argument in two subcases:
\begin{enumerate}
\item The case $\mathfrak r = (0)$. The result is a direct consequence
of Lemma \ref{lemma-helper-G-ring}.
\item The case $\mathfrak r \not = (0)$. This is
Lemma \ref{lemma-another-helper-G-ring}.
\end{enumerate}
\end{proof}

\begin{remark}
\label{remark-G-does-not-survive-completion}
Let $R$ be a G-ring and let $I \subset R$ be an ideal.
In general it is not the case that the $I$-adic completion $R^\wedge$
is a G-ring. An example was given by Nishimura in \cite{Nishimura}.
A generalization and, in some sense, clarification of this example can
be found in the last section of \cite{Dumitrescu}.
\end{remark}

\begin{proposition}
\label{proposition-ubiquity-G-ring}
The following types of rings are G-rings:
\begin{enumerate}
\item fields,
\item Noetherian complete local rings,
\item $\mathbf{Z}$,
\item Dedekind domains with fraction field of characteristic zero,
\item finite type ring extensions of any of the above.
\end{enumerate}
\end{proposition}

\begin{proof}
For fields, $\mathbf{Z}$ and Dedekind domains of characteristic zero
this follows immediately from the definition and the fact that the
completion of a discrete valuation ring is a discrete valuation ring.
A Noetherian complete local ring is a G-ring by
Proposition \ref{proposition-Noetherian-complete-G-ring}.
The statement on finite type overrings is
Proposition \ref{proposition-finite-type-over-G-ring}.
\end{proof}

\begin{lemma}
\label{lemma-henselian-local-limit-G-rings}
Let $(A, \mathfrak m)$ be a henselian local ring.
Then $A$ is a filtered colimit of a system
of henselian local G-rings with local
transition maps.
\end{lemma}

\begin{proof}
Write $A = \colim A_i$ as a filtered colimit of finite type
$\mathbf{Z}$-algebras. Let $\mathfrak p_i$ be the prime ideal of
$A_i$ lying under $\mathfrak m$. We may replace $A_i$ by the
localization of $A_i$ at $\mathfrak p_i$. Then $A_i$ is a
Noetherian local G-ring (Proposition \ref{proposition-ubiquity-G-ring}).
By Lemma \ref{lemma-henselization-colimit}
we see that $A = \colim A_i^h$. By
Lemma \ref{lemma-henselization-G-ring}
the rings $A_i^h$ are G-rings.
\end{proof}

\begin{lemma}
\label{lemma-map-G-ring-to-completion-regular}
\begin{reference}
\cite[Theorem 79]{MatCA}
\end{reference}
Let $A$ be a G-ring. Let $I \subset A$ be an ideal
and let $A^\wedge$ be the completion of $A$ with respect to $I$.
Then $A \to A^\wedge$ is regular.
\end{lemma}

\begin{proof}
The ring map $A \to A^\wedge$ is flat by
Algebra, Lemma \ref{algebra-lemma-completion-flat}.
The ring $A^\wedge$ is Noetherian by
Algebra, Lemma \ref{algebra-lemma-completion-Noetherian-Noetherian}.
Thus it suffices to check the third condition of
Lemma \ref{lemma-regular-local}.
Let $\mathfrak m' \subset A^\wedge$ be a maximal ideal lying over
$\mathfrak m \subset A$.
By Algebra, Lemma \ref{algebra-lemma-radical-completion}
we have $IA^\wedge \subset \mathfrak m'$.
Since $A^\wedge/IA^\wedge = A/I$ we see that
$I \subset \mathfrak m$, $\mathfrak m/I = \mathfrak m'/IA^\wedge$, and
$A/\mathfrak m = A^\wedge/\mathfrak m'$. Since $A^\wedge/\mathfrak m'$
is a field, we conclude that $\mathfrak m$ is a maximal ideal as well.
Then $A_\mathfrak m \to A^\wedge_{\mathfrak m'}$ is a flat local
ring homomorphism of Noetherian local rings
which identifies residue fields and such that
$\mathfrak m A^\wedge_{\mathfrak m'} = \mathfrak m'A^\wedge_{\mathfrak m'}$.
Thus it induces an isomorphism on complete local rings, see
Lemma \ref{lemma-flat-unramified}.
Let $(A_\mathfrak m)^\wedge$ be the completion of $A_\mathfrak m$
with respect to its maximal ideal.
The ring map
$$
(A^\wedge)_{\mathfrak m'} \to
((A^\wedge)_{\mathfrak m'})^\wedge = (A_\mathfrak m)^\wedge
$$
is faithfully flat (Algebra, Lemma
\ref{algebra-lemma-completion-faithfully-flat}). Thus we can apply
Lemma \ref{lemma-regular-permanence} to the ring maps
$$
A_\mathfrak m \to (A^\wedge)_{\mathfrak m'} \to (A_\mathfrak m)^\wedge
$$
to conclude because $A_\mathfrak m \to (A_\mathfrak m)^\wedge$
is regular as $A$ is a G-ring.
\end{proof}

\begin{lemma}
\label{lemma-henselization-pair-G-ring}
\begin{slogan}
Being a G-ring is stable under Henselizations along ideals
\end{slogan}
\begin{reference}
\cite[Theorem 5.3 i)]{Greco}
\end{reference}
Let $A$ be a G-ring. Let $I \subset A$ be an ideal.
Let $(A^h, I^h)$ be the henselization of the pair $(A, I)$, see
Lemma \ref{lemma-henselization}.
Then $A^h$ is a G-ring.
\end{lemma}

\begin{proof}
Let $\mathfrak m^h \subset A^h$ be a maximal ideal. We have to show
that the map from $A^h_{\mathfrak m^h}$ to its completion has
geometrically regular fibres, see
Lemma \ref{lemma-check-G-ring-maximal-ideals}.
Let $\mathfrak m$ be the inverse image of $\mathfrak m^h$ in $A$.
Note that $I^h \subset \mathfrak m^h$ and hence $I \subset \mathfrak m$
as $(A^h, I^h)$ is a henselian pair. Recall that $A^h$ is Noetherian,
$I^h = IA^h$, and that $A \to A^h$ induces an isomorphism on
$I$-adic completions, see
Lemma \ref{lemma-henselization-Noetherian-pair}.
Then the local homomorphism of Noetherian local rings
$$
A_\mathfrak m \to A^h_{\mathfrak m^h}
$$
induces an isomorphism on completions at maximal ideals by
Lemma \ref{lemma-flat-unramified} (details omitted).
Let $\mathfrak q^h$ be a prime of $A^h_{\mathfrak m^h}$ lying
over $\mathfrak q \subset A_\mathfrak m$.
Set $\mathfrak q_1 = \mathfrak q^h$
and let $\mathfrak q_2, \ldots, \mathfrak q_t$
be the other primes of $A^h$ lying over $\mathfrak q$, so that
$A^h \otimes_A \kappa(\mathfrak q) =
\prod\nolimits_{i = 1, \ldots, t} \kappa(\mathfrak q_i)$, see
Lemma \ref{lemma-filtered-colimit-etale-noetherian-fibres}.
Using that $(A^h)_{\mathfrak m^h}^\wedge = (A_\mathfrak m)^\wedge$
as discussed above we see
$$
\prod\nolimits_{i = 1, \ldots, t}
(A^h_{\mathfrak m^h})^\wedge \otimes_{A^h_{\mathfrak m^h}}
\kappa(\mathfrak q_i) =
(A^h_{\mathfrak m^h})^\wedge \otimes_{A^h_{\mathfrak m^h}}
(A^h_{\mathfrak m^h} \otimes_{A_{\mathfrak m}} \kappa(\mathfrak q)) =
(A_{\mathfrak m})^\wedge \otimes_{A_{\mathfrak m}} \kappa(\mathfrak q)
$$
Hence, as one of the components, the ring
$$
(A^h_{\mathfrak m^h})^\wedge \otimes_{A^h_{\mathfrak m^h}}
\kappa(\mathfrak q^h)
$$
is geometrically regular over $\kappa(\mathfrak q)$ by assumption on $A$.
Since $\kappa(\mathfrak q^h)$ is separable algebraic over
$\kappa(\mathfrak q)$
it follows from Algebra, Lemma
\ref{algebra-lemma-geometrically-regular-over-separable-algebraic} that
$$
(A^h_{\mathfrak m^h})^\wedge \otimes_{A^h_{\mathfrak m^h}}
\kappa(\mathfrak q^h)
$$
is geometrically regular over $\kappa(\mathfrak q^h)$ as desired.
\end{proof}







\section{Properties of formal fibres}
\label{section-properties-formal-fibres}

\noindent
In this section we redo some of the arguments of Section \ref{section-G-ring}
for to be able to talk intelligently about
properties of the formal fibres of Noetherian rings.

\medskip\noindent
Let $P$ be a property of ring maps $k \to R$ where $k$ is a field and
$R$ is Noetherian. We say $P$ holds for the fibres of a ring homomorphism
$A \to B$ with $B$ Noetherian if $P$ holds for
$\kappa(\mathfrak q) \to B \otimes_A \kappa(\mathfrak q)$
for all primes $\mathfrak q$ of $A$.
In the following we will use the following assertions
\begin{enumerate}
\item[(A)] $P(k \to R) \Rightarrow P(k' \to R \otimes_k k')$ for
finitely generated field extensions $k'/k$,
\item[(B)] $P(k \to R_\mathfrak p),\ \forall \mathfrak p \in \Spec(R)
\Leftrightarrow P(k \to R)$,
\item[(C)] given flat maps $A \to B \to C$ of Noetherian
rings, if the fibres of $A \to B$ have $P$ and $B \to C$ is regular,
then the fibres of $A \to C$ have $P$,
\item[(D)] given flat maps $A \to B \to C$ of Noetherian
rings if the fibres of $A \to C$ have $P$ and $B \to C$ is faithfully
flat, then the fibres of $A \to B$ have $P$,
\item[(E)] given $k \to k' \to R$ with $R$ Noetherian if $k'/k$ is
separable algebraic and $P(k \to R)$, then $P(k' \to R)$, and
\item[(F)] add more here.
\end{enumerate}
Given a Noetherian local ring $A$ we say
``{\it the formal fibres of $A$ have $P$}'' if $P$ holds for
the fibres of $A \to A^\wedge$.
We say that {\it $R$ is a $P$-ring} if $R$ is Noetherian and for all
primes $\mathfrak p$ of $R$ the formal fibres of $R_\mathfrak p$ have $P$.

\begin{lemma}
\label{lemma-check-P-ring-easy}
Let $R$ be a Noetherian ring. Let $P$ be a property as above.
Then $R$ is a $P$-ring if and only if
for every pair of primes $\mathfrak q \subset \mathfrak p \subset R$
the $\kappa(\mathfrak q)$-algebra
$$
(R/\mathfrak q)_\mathfrak p^\wedge \otimes_{R/\mathfrak q} \kappa(\mathfrak q)
$$
has property $P$.
\end{lemma}

\begin{proof}
This follows from the fact that
$$
R_\mathfrak p^\wedge \otimes_R \kappa(\mathfrak q) =
(R/\mathfrak q)_\mathfrak p^\wedge \otimes_{R/\mathfrak q} \kappa(\mathfrak q)
$$
as algebras over $\kappa(\mathfrak q)$.
\end{proof}

\begin{lemma}
\label{lemma-P-local}
Let $R \to \Lambda$ be a homomorphism of Noetherian rings.
Assume $P$ has property (B). The following are equivalent
\begin{enumerate}
\item the fibres of $R \to \Lambda$ have $P$,
\item the fibres of $R_\mathfrak p \to \Lambda_\mathfrak q$ have $P$
for all $\mathfrak q \subset \Lambda$ lying over $\mathfrak p \subset R$, and
\item the fibres of $R_\mathfrak m \to \Lambda_{\mathfrak m'}$ have $P$
for all maximal ideals $\mathfrak m' \subset \Lambda$
lying over $\mathfrak m$ in $R$.
\end{enumerate}
\end{lemma}

\begin{proof}
Let $\mathfrak p \subset R$ be a prime. Then the fibre over
$\mathfrak p$ is the ring $\Lambda \otimes_R \kappa(\mathfrak p)$
whose spectrum maps bijectively onto the subset of $\Spec(\Lambda)$
consisting of primes $\mathfrak q$ lying over $\mathfrak p$, see
Algebra, Remark \ref{algebra-remark-fundamental-diagram}.
For such a prime $\mathfrak q$ choose a maximal
ideal $\mathfrak q \subset \mathfrak m'$ and set
$\mathfrak m = R \cap \mathfrak m'$.
Then $\mathfrak p \subset \mathfrak m$ and we have
$$
(\Lambda \otimes_R \kappa(\mathfrak p))_\mathfrak q \cong
(\Lambda_{\mathfrak m'} \otimes_{R_\mathfrak m}
\kappa(\mathfrak p))_\mathfrak q
$$
as $\kappa(\mathfrak q)$-algebras. Thus (1), (2), and (3) are equivalent
because by (B) we can check property $P$ on local rings.
\end{proof}

\begin{lemma}
\label{lemma-P-ring-goes-up-quasi-finite}
Let $R \to R'$ be a finite type map of Noetherian rings and let
$$
\xymatrix{
\mathfrak q' \ar[r] & \mathfrak p' \ar[r] & R' \\
\mathfrak q \ar[r] \ar@{-}[u] &
\mathfrak p \ar[r] \ar@{-}[u] & R \ar[u]
}
$$
be primes. Assume $R \to R'$ is quasi-finite at $\mathfrak p'$.
Assume $P$ satisfies (A) and (B).
\begin{enumerate}
\item If $\kappa(\mathfrak q) \to
R_\mathfrak p^\wedge \otimes_R \kappa(\mathfrak q)$
has $P$, then
$\kappa(\mathfrak q') \to R'_{\mathfrak p'} \otimes_{R'} \kappa(\mathfrak q')$
has $P$.
\item If the formal fibres of $R_\mathfrak p$ have $P$,
then the formal fibres of $R'_{\mathfrak p'}$ have $P$.
\item If $R \to R'$ is quasi-finite and $R$ is a $P$-ring, then $R'$ is
a $P$-ring.
\end{enumerate}
\end{lemma}

\begin{proof}
It is clear that (1) $\Rightarrow$ (2) $\Rightarrow$ (3).
Assume $P$ holds for
$\kappa(\mathfrak q) \to R_\mathfrak p^\wedge \otimes_R \kappa(\mathfrak q)$.
By Algebra, Lemma \ref{algebra-lemma-completion-at-quasi-finite-prime}
we see that
$$
R_\mathfrak p^\wedge \otimes_R R'
=
(R'_{\mathfrak p'})^\wedge \times B
$$
for some $R_\mathfrak p^\wedge$-algebra $B$. Hence
$R'_{\mathfrak p'} \to (R'_{\mathfrak p'})^\wedge$ is a factor of
a base change of the map $R_\mathfrak p \to R_\mathfrak p^\wedge$.
It follows that $(R'_{\mathfrak p'})^\wedge \otimes_{R'} \kappa(\mathfrak q')$
is a factor of
$$
R_\mathfrak p^\wedge \otimes_R R' \otimes_{R'} \kappa(\mathfrak q') =
R_\mathfrak p^\wedge \otimes_R \kappa(\mathfrak q)
\otimes_{\kappa(\mathfrak q)} \kappa(\mathfrak q').
$$
Thus the result follows from the assumptions on $P$.
\end{proof}

\begin{lemma}
\label{lemma-check-P-ring-maximal-ideals}
Let $R$ be a Noetherian ring. Assume $P$ satisfies (C) and (D).
Then $R$ is a $P$-ring if and only if the formal fibres of
$R_\mathfrak m$ have $P$ for every
maximal ideal $\mathfrak m$ of $R$.
\end{lemma}

\begin{proof}
Assume the formal fibres of $R_\mathfrak m$ have $P$ for all
maximal ideals $\mathfrak m$ of $R$. Let $\mathfrak p$ be a prime of
$R$ and choose a maximal ideal $\mathfrak p \subset \mathfrak m$.
Since $R_\mathfrak m \to R_\mathfrak m^\wedge$ is faithfully flat
we can choose a prime $\mathfrak p'$ if $R_\mathfrak m^\wedge$
lying over $\mathfrak pR_\mathfrak m$. Consider the commutative diagram
$$
\xymatrix{
R_\mathfrak m^\wedge \ar[r] &
(R_\mathfrak m^\wedge)_{\mathfrak p'} \ar[r] &
(R_\mathfrak m^\wedge)_{\mathfrak p'}^\wedge
\\
R_\mathfrak m \ar[u] \ar[r] & R_\mathfrak p \ar[u] \ar[r] &
R_\mathfrak p^\wedge \ar[u]
}
$$
By assumption the fibres of the ring map
$R_\mathfrak m \to R_\mathfrak m^\wedge$ have $P$.
By Proposition \ref{proposition-Noetherian-complete-G-ring}
$(R_\mathfrak m^\wedge)_{\mathfrak p'} \to
(R_\mathfrak m^\wedge)_{\mathfrak p'}^\wedge$ is regular.
The localization
$R_\mathfrak m^\wedge \to (R_\mathfrak m^\wedge)_{\mathfrak p'}$ is regular.
Hence $R_\mathfrak m^\wedge \to (R_\mathfrak m^\wedge)_{\mathfrak p'}^\wedge$
is regular by Lemma \ref{lemma-regular-composition}.
Hence the fibres of
$R_\mathfrak m \to (R_\mathfrak m^\wedge)_{\mathfrak p'}^\wedge$
have $P$ by (C). Since
$R_\mathfrak m \to (R_\mathfrak m^\wedge)_{\mathfrak p'}^\wedge$
factors through the localization
$R_\mathfrak p$, also the fibres of
$R_\mathfrak p \to (R_\mathfrak m^\wedge)_{\mathfrak p'}^\wedge$
have $P$. Thus we may apply (D) to see that the fibres of
$R_\mathfrak p \to R_\mathfrak p^\wedge$ have $P$.
\end{proof}

\begin{proposition}
\label{proposition-finite-type-over-P-ring}
Let $R$ be a $P$-ring where $P$ satisfies (A), (B), (C), and (D).
If $R \to S$ is essentially of finite type then $S$ is a $P$-ring.
\end{proposition}

\begin{proof}
Since being a $P$-ring is a property of the local rings it is clear
that a localization of a $P$-ring is a $P$-ring. Conversely, if every
localization at a prime is a $P$-ring, then the ring is a $P$-ring.
Thus it suffices to show that $S_\mathfrak q$ is a $P$-ring for every
finite type $R$-algebra $S$ and every prime $\mathfrak q$ of $S$.
Writing $S$ as a quotient of $R[x_1, \ldots, x_n]$ we see from
Lemma \ref{lemma-P-ring-goes-up-quasi-finite} that it suffices to prove
that $R[x_1, \ldots, x_n]$ is a $P$-ring. By induction on $n$ it
suffices to prove that $R[x]$ is a $P$-ring. Let $\mathfrak q \subset R[x]$
be a maximal ideal. By Lemma \ref{lemma-check-P-ring-maximal-ideals}
it suffices to show that the fibres of
$$
R[x]_\mathfrak q \longrightarrow R[x]_\mathfrak q^\wedge
$$
have $P$. If $\mathfrak q$ lies over $\mathfrak p \subset R$, then
we may replace $R$ by $R_\mathfrak p$. Hence we may assume that $R$
is a Noetherian local $P$-ring with maximal ideal $\mathfrak m$ and
that $\mathfrak q \subset R[x]$ lies over $\mathfrak m$. Note that
there is a unique prime $\mathfrak q' \subset R^\wedge[x]$
lying over $\mathfrak q$. Consider the diagram
$$
\xymatrix{
R[x]_\mathfrak q^\wedge \ar[r] &
(R^\wedge[x]_{\mathfrak q'})^\wedge \\
R[x]_\mathfrak q \ar[r] \ar[u] & R^\wedge[x]_{\mathfrak q'} \ar[u]
}
$$
Since $R$ is a $P$-ring the fibres of $R[x] \to R^\wedge[x]$ have
$P$ because they are base changes of the fibres of $R \to R^\wedge$
by a finitely generated field extension so (A) applies. Hence
the fibres of the lower horizontal arrow have $P$ for example by
Lemma \ref{lemma-P-local}.
The right vertical arrow is regular because $R^\wedge$ is
a G-ring (Propositions \ref{proposition-Noetherian-complete-G-ring} and
\ref{proposition-finite-type-over-G-ring}).
It follows that the fibres of the composition
$R[x]_\mathfrak q \to (R^\wedge[x]_{\mathfrak q'})^\wedge$
have $P$ by (C). Hence
the fibres of the left vertical arrow have $P$ by (D) and the
proof is complete.
\end{proof}

\begin{lemma}
\label{lemma-map-P-ring-to-completion-P}
Let $A$ be a $P$-ring where $P$ satisfies (B) and (D).
Let $I \subset A$ be an ideal and let $A^\wedge$ be the completion of $A$
with respect to $I$. Then the fibres of $A \to A^\wedge$ have $P$.
\end{lemma}

\begin{proof}
The ring map $A \to A^\wedge$ is flat by
Algebra, Lemma \ref{algebra-lemma-completion-flat}.
The ring $A^\wedge$ is Noetherian by
Algebra, Lemma \ref{algebra-lemma-completion-Noetherian-Noetherian}.
Thus it suffices to check the third condition of
Lemma \ref{lemma-P-local}.
Let $\mathfrak m' \subset A^\wedge$ be a maximal ideal lying over
$\mathfrak m \subset A$.
By Algebra, Lemma \ref{algebra-lemma-radical-completion}
we have $IA^\wedge \subset \mathfrak m'$.
Since $A^\wedge/IA^\wedge = A/I$ we see that
$I \subset \mathfrak m$, $\mathfrak m/I = \mathfrak m'/IA^\wedge$, and
$A/\mathfrak m = A^\wedge/\mathfrak m'$. Since $A^\wedge/\mathfrak m'$
is a field, we conclude that $\mathfrak m$ is a maximal ideal as well.
Then $A_\mathfrak m \to A^\wedge_{\mathfrak m'}$ is a flat local
ring homomorphism of Noetherian local rings
which identifies residue fields and such that
$\mathfrak m A^\wedge_{\mathfrak m'} = \mathfrak m'A^\wedge_{\mathfrak m'}$.
Thus it induces an isomorphism on complete local rings, see
Lemma \ref{lemma-flat-unramified}.
Let $(A_\mathfrak m)^\wedge$ be the completion of $A_\mathfrak m$
with respect to its maximal ideal.
The ring map
$$
(A^\wedge)_{\mathfrak m'} \to
((A^\wedge)_{\mathfrak m'})^\wedge = (A_\mathfrak m)^\wedge
$$
is faithfully flat (Algebra, Lemma
\ref{algebra-lemma-completion-faithfully-flat}). Thus we can apply
(D) to the ring maps
$$
A_\mathfrak m \to (A^\wedge)_{\mathfrak m'} \to (A_\mathfrak m)^\wedge
$$
to conclude because the fibres of
$A_\mathfrak m \to (A_\mathfrak m)^\wedge$
have $P$ as $A$ is a $P$-ring.
\end{proof}

\begin{lemma}
\label{lemma-henselization-pair-P-ring}
\begin{slogan}
Henselization of a ring inherits good properties of formal fibers
\end{slogan}
Let $A$ be a $P$-ring where $P$ satisfies (B), (C), (D), and (E).
Let $I \subset A$ be an ideal. Let $(A^h, I^h)$ be the henselization
of the pair $(A, I)$, see Lemma \ref{lemma-henselization}.
Then $A^h$ is a $P$-ring.
\end{lemma}

\begin{proof}
Let $\mathfrak m^h \subset A^h$ be a maximal ideal. We have to show
that the fibres of $A^h_{\mathfrak m^h} \to (A^h_{\mathfrak m^h})^\wedge$
have $P$, see Lemma \ref{lemma-check-P-ring-maximal-ideals}.
Let $\mathfrak m$ be the inverse image of $\mathfrak m^h$ in $A$.
Note that $I^h \subset \mathfrak m^h$ and hence $I \subset \mathfrak m$
as $(A^h, I^h)$ is a henselian pair. Recall that $A^h$ is Noetherian,
$I^h = IA^h$, and that $A \to A^h$ induces an isomorphism on
$I$-adic completions, see
Lemma \ref{lemma-henselization-Noetherian-pair}.
Then the local homomorphism of Noetherian local rings
$$
A_\mathfrak m \to A^h_{\mathfrak m^h}
$$
induces an isomorphism on completions at maximal ideals by
Lemma \ref{lemma-flat-unramified} (details omitted).
Let $\mathfrak q^h$ be a prime of $A^h_{\mathfrak m^h}$ lying
over $\mathfrak q \subset A_\mathfrak m$.
Set $\mathfrak q_1 = \mathfrak q^h$
and let $\mathfrak q_2, \ldots, \mathfrak q_t$
be the other primes of $A^h$ lying over $\mathfrak q$, so that
$A^h \otimes_A \kappa(\mathfrak q) =
\prod\nolimits_{i = 1, \ldots, t} \kappa(\mathfrak q_i)$, see
Lemma \ref{lemma-filtered-colimit-etale-noetherian-fibres}.
Using that $(A^h)_{\mathfrak m^h}^\wedge = (A_\mathfrak m)^\wedge$
as discussed above we see
$$
\prod\nolimits_{i = 1, \ldots, t}
(A^h_{\mathfrak m^h})^\wedge \otimes_{A^h_{\mathfrak m^h}}
\kappa(\mathfrak q_i) =
(A^h_{\mathfrak m^h})^\wedge \otimes_{A^h_{\mathfrak m^h}}
(A^h_{\mathfrak m^h} \otimes_{A_{\mathfrak m}} \kappa(\mathfrak q)) =
(A_{\mathfrak m})^\wedge \otimes_{A_{\mathfrak m}} \kappa(\mathfrak q)
$$
Hence, looking at local rings and using (B), we see that
$$
\kappa(\mathfrak q) \longrightarrow
(A^h_{\mathfrak m^h})^\wedge \otimes_{A^h_{\mathfrak m^h}}
\kappa(\mathfrak q^h)
$$
has $P$ as
$\kappa(\mathfrak q) \to
(A_\mathfrak m)^\wedge \otimes_{A_\mathfrak m} \kappa(\mathfrak q)$
does by assumption on $A$. Since $\kappa(\mathfrak q^h)/\kappa(\mathfrak q)$
is separable algebraic, by (E) we find that
$\kappa(\mathfrak q^h) \to
(A^h_{\mathfrak m^h})^\wedge \otimes_{A^h_{\mathfrak m^h}}
\kappa(\mathfrak q^h)$ has $P$ as desired.
\end{proof}

\begin{lemma}
\label{lemma-henselization-P-ring}
Let $R$ be a Noetherian local ring which is a $P$-ring where $P$
satisfies (B), (C), (D), and (E). Then the henselization $R^h$
and the strict henselization $R^{sh}$ are $P$-rings.
\end{lemma}

\begin{proof}
We have seen this for the henselization in
Lemma \ref{lemma-henselization-pair-P-ring}.
To prove it for the strict henselization, it suffices to
show that the formal fibres of $R^{sh}$ have $P$, see
Lemma \ref{lemma-check-P-ring-maximal-ideals}.
Let $\mathfrak r \subset R^{sh}$ be a prime and set
$\mathfrak p = R \cap \mathfrak r$. Set $\mathfrak r_1 = \mathfrak r$
and let $\mathfrak r_2, \ldots, \mathfrak r_s$
be the other primes of $R^{sh}$ lying over $\mathfrak p$, so that
$R^{sh} \otimes_R \kappa(\mathfrak p) =
\prod\nolimits_{i = 1, \ldots, s} \kappa(\mathfrak r_i)$, see
Lemma \ref{lemma-fibres-henselization}.
Then we see that
$$
\prod\nolimits_{i = 1, \ldots, t}
(R^{sh})^\wedge \otimes_{R^{sh}} \kappa(\mathfrak r_i) =
(R^{sh})^\wedge \otimes_{R^{sh}} (R^{sh} \otimes_R \kappa(\mathfrak p)) =
(R^{sh})^\wedge \otimes_R \kappa(\mathfrak p)
$$
Note that $R^\wedge \to (R^{sh})^\wedge$ is formally smooth
in the $\mathfrak m_{(R^{sh})^\wedge}$-adic topology, see
Lemma \ref{lemma-henselization-noetherian}.
Hence $R^\wedge \to (R^{sh})^\wedge$ is regular by
Proposition \ref{proposition-fs-regular}.
We conclude that property $P$ holds for
$\kappa(\mathfrak p) \to (R^{sh})^\wedge \otimes_R \kappa(\mathfrak p)$
by (C) and our assumption on $R$. Using property (B), using the
decomposition above, and looking
at local rings we conclude that property $P$ holds for
$\kappa(\mathfrak p) \to (R^{sh})^\wedge \otimes_{R^{sh}} \kappa(\mathfrak r)$.
Since $\kappa(\mathfrak r)/\kappa(\mathfrak p)$ is separable algebraic,
it follows from (E) that $P$ holds for
$\kappa(\mathfrak r) \to (R^{sh})^\wedge \otimes_{R^{sh}} \kappa(\mathfrak r)$.
\end{proof}

\begin{lemma}
\label{lemma-formal-fibres-reduced}
Properties (A), (B), (C), (D), and (E) hold for
$P(k \to R) =$``$R$ is geometrically reduced over $k$''.
\end{lemma}

\begin{proof}
Part (A) follows from the definition of geometrically reduced
algebras (Algebra, Definition \ref{algebra-definition-geometrically-reduced}).
Part (B) follows too: a ring is reduced if and only if
all local rings are reduced.
Part (C). This follows from Lemma \ref{lemma-reduced-goes-up}.
Part (D). This follows from Algebra, Lemma \ref{algebra-lemma-descent-reduced}.
Part (E). This follows from Algebra, Lemma
\ref{algebra-lemma-geometrically-reduced-over-separable-algebraic}.
\end{proof}

\begin{lemma}
\label{lemma-formal-fibres-normal}
Properties (A), (B), (C), (D), and (E) hold for
$P(k \to R) =$``$R$ is geometrically normal over $k$''.
\end{lemma}

\begin{proof}
Part (A) follows from the definition of geometrically normal
algebras (Algebra, Definition \ref{algebra-definition-geometrically-normal}).
Part (B) follows too: a ring is normal if and only if all of its
local rings are normal.
Part (C). This follows from Lemma \ref{lemma-normal-goes-up}.
Part (D). This follows from Algebra, Lemma \ref{algebra-lemma-descent-normal}.
Part (E). This follows from Algebra, Lemma
\ref{algebra-lemma-geometrically-normal-over-separable-algebraic}.
\end{proof}

\begin{lemma}
\label{lemma-formal-fibres-Sk}
Fix $n \geq 1$. Properties (A), (B), (C), (D), and (E) hold for
$P(k \to R) =$``$R$ has $(S_n)$''.
\end{lemma}

\begin{proof}
Let $k \to R$ be a ring map where $k$ is a field and $R$ a Noetherian
ring. Let $k'/k$ be a finitely generated field extension.
Then the fibres of the ring map $R \to R \otimes_k k'$ are
Cohen-Macaulay by Algebra, Lemma \ref{algebra-lemma-tensor-fields-CM}.
Hence we may apply Algebra, Lemma \ref{algebra-lemma-Sk-goes-up}
to the ring map $R \to R \otimes_k k'$ to see that if $R$ has $(S_n)$
so does $R \otimes_k k'$. This proves (A).
Part (B) follows too: a Noetherian rings has $(S_n)$ if and only if
all of its local rings have $(S_n)$.
Part (C). This follows from
Algebra, Lemma \ref{algebra-lemma-Sk-goes-up}
as the fibres of a regular homomorphism are regular and in particular
Cohen-Macaulay.
Part (D). This follows from
Algebra, Lemma \ref{algebra-lemma-descent-Sk}.
Part (E). This is immediate as the condition does not refer to
the ground field.
\end{proof}

\begin{lemma}
\label{lemma-formal-fibres-CM}
Properties (A), (B), (C), (D), and (E) hold for
$P(k \to R) =$``$R$ is Cohen-Macaulay''.
\end{lemma}

\begin{proof}
Follows immediately from Lemma \ref{lemma-formal-fibres-Sk}
and the fact that a Noetherian ring is Cohen-Macaulay if
and only if it satisfies conditions $(S_n)$ for all $n$.
\end{proof}

\begin{lemma}
\label{lemma-formal-fibres-Rk}
Fix $n \geq 0$. Properties (A), (B), (C), (D), and (E) hold for
$P(k \to R) =$``$R \otimes_k k'$ has $(R_n)$ for all finite
extensions $k'/k$''.
\end{lemma}

\begin{proof}
Let $k \to R$ be a ring map where $k$ is a field and $R$ a Noetherian
ring. Assume $P(k \to R)$ is true.
Let $K/k$ be a finitely generated field extension.
By Algebra, Lemma \ref{algebra-lemma-make-separable} we can find a diagram
$$
\xymatrix{
K \ar[r] & K' \\
k \ar[u] \ar[r] & k' \ar[u]
}
$$
where $k'/k$, $K'/K$ are finite purely inseparable field
extensions such that $K'/k'$ is separable. By
Algebra, Lemma \ref{algebra-lemma-localization-smooth-separable}
there exists a smooth $k'$-algebra $B$ such that $K'$ is the
fraction field of $B$. Now we can argue as follows:
Step 1: $R \otimes_k k'$ satisfies $(S_n)$ because we assumed $P$
for $k \to R$.
Step 2: $R \otimes_k k' \to R \otimes_k k' \otimes_{k'} B$ is a
smooth ring map (Algebra, Lemma \ref{algebra-lemma-base-change-smooth})
and we conclude $R \otimes_k k' \otimes_{k'} B$ satisfies $(S_n)$
by Algebra, Lemma \ref{algebra-lemma-Rk-goes-up}
(and using Algebra, Lemma \ref{algebra-lemma-characterize-smooth-over-field}
to see that the hypotheses are satisfied).
Step 3. $R \otimes_k k' \otimes_{k'} K' = R \otimes_k K'$ satisfies
$(R_n)$ as it is a localization of a ring having $(R_n)$.
Step 4. Finally $R \otimes_k K$ satisfies $(R_n)$ by descent of
$(R_n)$ along the faithfully flat ring map
$K \otimes_k A \to K' \otimes_k A$
(Algebra, Lemma \ref{algebra-lemma-descent-Rk}).
This proves (A).
Part (B) follows too: a Noetherian ring has $(R_n)$ if and only if
all of its local rings have $(R_n)$.
Part (C). This follows from Algebra, Lemma \ref{algebra-lemma-Rk-goes-up}
as the fibres of a regular homomorphism are regular (small detail omitted).
Part (D). This follows from Algebra, Lemma \ref{algebra-lemma-descent-Rk}
(small detail omitted).

\medskip\noindent
Part (E). Let $l/k$ be a separable algebraic extension of fields and
let $l \to R$ be a ring map with $R$ Noetherian. Assume that
$k \to R$ has $P$. We have to show that $l \to R$ has $P$.
Let $l'/l$ be a finite extension. First observe that there exists a
finite subextension $l/m/k$ and a finite extension $m'/m$
such that $l' = l \otimes_m m'$. Then $R \otimes_l l' = R \otimes_m m'$.
Hence it suffices to prove that $m \to R$ has property $P$, i.e.,
we may assume that $l/k$ is finite. If $l/k$ is finite, then $l'/k$
is finite and we see that
$$
l' \otimes_l R = (l' \otimes_k R) \otimes_{l \otimes_k l} l
$$
is a localization
(by Algebra, Lemma \ref{algebra-lemma-separable-algebraic-diagonal})
of the Noetherian ring $l' \otimes_k R$ which has property $(R_n)$
by assumption $P$ for $k \to R$. This proves that $l' \otimes_l R$
has property $(R_n)$ as desired.
\end{proof}








\section{Excellent rings}
\label{section-excellent}

\noindent
In this section we discuss Grothendieck's notion of excellent rings.
For the definitions of G-rings, J-2 rings, and universally catenary rings
we refer to Definition \ref{definition-G-ring},
Definition \ref{definition-J}, and
Algebra, Definition \ref{algebra-definition-universally-catenary}.

\begin{definition}
\label{definition-excellent}
Let $R$ be a ring.
\begin{enumerate}
\item We say $R$ is {\it quasi-excellent} if $R$ is Noetherian,
a G-ring, and J-2.
\item We say $R$ is {\it excellent} if $R$ is quasi-excellent
and universally catenary.
\end{enumerate}
\end{definition}

\noindent
Thus a Noetherian ring is quasi-excellent if it has geometrically regular
formal fibres and if any finite type algebra over it has closed singular
set. For such a ring to be excellent we require in addition that there
exists (locally) a good dimension function. We will see later
(Section \ref{section-formally-catenary})
that to be universally catenary can be formulated
as a condition on the maps $R_\mathfrak m \to R_\mathfrak m^\wedge$
for maximal ideals $\mathfrak m$ of $R$.

\begin{lemma}
\label{lemma-finite-type-over-excellent}
Any localization of a finite type ring over a (quasi-)excellent ring
is (quasi-)excellent.
\end{lemma}

\begin{proof}
For finite type algebras this follows from the definitions for
the properties J-2 and universally catenary. For G-rings, see
Proposition \ref{proposition-finite-type-over-G-ring}. We omit
the proof that localization preserves (quasi-)excellency.
\end{proof}

\begin{proposition}
\label{proposition-ubiquity-excellent}
The following types of rings are excellent:
\begin{enumerate}
\item fields,
\item Noetherian complete local rings,
\item $\mathbf{Z}$,
\item Dedekind domains with fraction field of characteristic zero,
\item finite type ring extensions of any of the above.
\end{enumerate}
\end{proposition}

\begin{proof}
See Propositions \ref{proposition-ubiquity-G-ring} and
\ref{proposition-ubiquity-J-2} to see that these rings are
G-rings and have J-2. Any Cohen-Macaulay ring is universally
catenary, see Algebra, Lemma \ref{algebra-lemma-CM-ring-catenary}.
In particular fields, Dedekind rings, and more generally
regular rings are universally catenary. Via the Cohen structure theorem 
we see that complete local rings are universally catenary, see
Algebra, Remark
\ref{algebra-remark-Noetherian-complete-local-ring-universally-catenary}.
\end{proof}

\noindent
The material developed above has some consequences for Nagata rings.

\begin{lemma}
\label{lemma-Nagata-local-ring}
Let $(A, \mathfrak m)$ be a Noetherian local ring.
The following are equivalent
\begin{enumerate}
\item $A$ is Nagata, and
\item the formal fibres of $A$ are geometrically reduced.
\end{enumerate}
\end{lemma}

\begin{proof}
Assume (2). By
Algebra, Lemma \ref{algebra-lemma-local-nagata-and-analytically-unramified}
we have to show that if $A \to B$ is finite, $B$ is a domain,
and $\mathfrak m' \subset B$ is a maximal ideal, then $B_{\mathfrak m'}$
is analytically unramified.
Combining Lemmas \ref{lemma-formal-fibres-reduced} and
\ref{lemma-check-P-ring-maximal-ideals} and
Proposition \ref{proposition-finite-type-over-P-ring}
we see that the formal fibres of $B_{\mathfrak m'}$ are
geometrically reduced. In particular
$B_{\mathfrak m'}^\wedge \otimes_B L$ is reduced
where $L$ is the fraction field of $B$.
It follows that $B_{\mathfrak m'}^\wedge$ is reduced, i.e.,
$B_{\mathfrak m'}$ is analytically unramified.

\medskip\noindent
Assume (1). Let $\mathfrak q \subset A$ be a prime ideal
and let $K/\kappa(\mathfrak q)$ be a finite extension.
We have to show that $A^\wedge \otimes_A K$ is reduced.
Let $A/\mathfrak q \subset B \subset K$ be a local subring
finite over $A$ whose fraction field is $K$.
To construct $B$ choose $x_1, \ldots, x_n \in K$
which generate $K$ over $\kappa(\mathfrak q)$
and which satisfy monic polynomials
$P_i(T) = T^{d_i} + a_{i, 1} T^{d_i - 1} + \ldots + a_{i, d_i} = 0$
with $a_{i, j} \in \mathfrak m$. Then let $B$ be the $A$-subalgebra
of $K$ generated by $x_1, \ldots, x_n$. (For more details see
the proof of Algebra, Lemma
\ref{algebra-lemma-local-nagata-and-analytically-unramified}.)
Then
$$
A^\wedge \otimes_A K =
(A^\wedge \otimes_A B)_\mathfrak q =
B^\wedge_\mathfrak q
$$
Since $B^\wedge$ is reduced by  Algebra, Lemma
\ref{algebra-lemma-local-nagata-and-analytically-unramified}
the proof is complete.
\end{proof}

\begin{lemma}
\label{lemma-quasi-excellent-nagata}
A quasi-excellent ring is Nagata.
\end{lemma}

\begin{proof}
Let $R$ be quasi-excellent.
Using that a finite type algebra over $R$ is quasi-excellent
(Lemma \ref{lemma-finite-type-over-excellent}) we see that
it suffices to show that any quasi-excellent domain is N-1, see
Algebra, Lemma \ref{algebra-lemma-check-universally-japanese}.
Applying Algebra, Lemma \ref{algebra-lemma-characterize-N-1}
(and using that a quasi-excellent ring is J-2) we reduce
to showing that a quasi-excellent local domain $R$ is N-1.
As $R \to R^\wedge$ is regular we see that $R^\wedge$
is reduced by Lemma \ref{lemma-reduced-goes-up}.
In other words, $R$ is analytically unramified.
Hence $R$ is N-1 by
Algebra, Lemma \ref{algebra-lemma-analytically-unramified-easy}.
\end{proof}

\begin{lemma}
\label{lemma-completion-normal-local-ring}
Let $(A, \mathfrak m)$ be a Noetherian local ring. If $A$ is normal
and the formal fibres of $A$ are normal (for example if $A$
is excellent or quasi-excellent), then $A^\wedge$ is normal.
\end{lemma}

\begin{proof}
Follows immediately from
Algebra, Lemma \ref{algebra-lemma-normal-goes-up-noetherian}.
\end{proof}





\section{Abelian categories of modules}
\label{section-abelian-categories-modules}

\noindent
Let $R$ be a ring. The category $\text{Mod}_R$ of $R$-modules is an
abelian category. Here are some examples of subcategories
of $\text{Mod}_R$ which are abelian (we use the terminology introduced in
Homology, Definition \ref{homology-definition-serre-subcategory}
as well as
Homology, Lemmas \ref{homology-lemma-characterize-serre-subcategory} and
\ref{homology-lemma-characterize-weak-serre-subcategory}):
\begin{enumerate}
\item The category of coherent $R$-modules is a weak Serre subcategory
of $\text{Mod}_R$. This follows from
Algebra, Lemma \ref{algebra-lemma-coherent}.
\item Let $S \subset R$ be a multiplicative subset. The full subcategory 
consisting of $R$-modules $M$ such that multiplication by $s \in S$
is an isomorphism on $M$ is a Serre subcategory of $\text{Mod}_R$.
This follows from Algebra, Lemma \ref{algebra-lemma-localization-and-modules}.
\item Let $I \subset R$ be a finitely generated ideal. The full subcategory of
$I$-power torsion modules is a Serre subcategory of $\text{Mod}_R$.
See Lemma \ref{lemma-I-power-torsion}.
\item In some texts a {\it torsion module} is defined as a module $M$
such that for all $x \in M$ there exists a nonzerodivisor $f \in R$
such that $fx = 0$. The full subcategory of torsion modules is a
Serre subcategory of $\text{Mod}_R$.
\item If $R$ is not Noetherian, then the category $\text{Mod}^{fg}_R$
of finitely generated $R$-modules is {\bf not} abelian. Namely,
if $I \subset R$ is a non-finitely generated ideal, then the
map $R \to R/I$ does not have a kernel in $\text{Mod}^{fg}_R$.
\item If $R$ is Noetherian, then coherent $R$-modules agree with
finitely generated (i.e., finite) $R$-modules, see
Algebra, Lemmas \ref{algebra-lemma-Noetherian-coherent},
\ref{algebra-lemma-coherent-ring}, and
\ref{algebra-lemma-Noetherian-finite-type-is-finite-presentation}.
Hence $\text{Mod}^{fg}_R$ is abelian by (1) above, but
in fact,in this case the category $\text{Mod}_R^{fg}$
is a (strong) Serre subcategory of $\text{Mod}_R$.
\end{enumerate}




\section{Injective abelian groups}
\label{section-abelian-groups}

\noindent
In this section we show the category of abelian groups has enough
injectives. Recall that an abelian group $M$ is {\it divisible}
if and only if for every $x \in M$ and every $n \in \mathbf{N}$
there exists a $y \in M$ such that $n y = x$.

\begin{lemma}
\label{lemma-injective-abelian}
An abelian group $J$ is an injective object in
the category of abelian groups if and only if $J$
is divisible.
\end{lemma}

\begin{proof}
Suppose that $J$ is not divisible. Then there exists
an $x \in J$ and $n \in \mathbf{N}$ such that there
is no $y \in J$ with $n y = x$. Then the morphism
$\mathbf{Z} \to J$, $m \mapsto mx$ does not extend
to $\frac{1}{n}\mathbf{Z} \supset \mathbf{Z}$. Hence
$J$ is not injective.

\medskip\noindent
Let $A \subset B$ be abelian groups.
Assume that $J$ is a divisible abelian group.
Let $\varphi : A \to J$ be a morphism.
Consider the set of homomorphisms $\varphi' : A' \to J$
with $A \subset A' \subset B$ and $\varphi'|_A = \varphi$.
Define $(A', \varphi') \geq (A'', \varphi'')$ if
and only if $A' \supset A''$ and $\varphi'|_{A''} = \varphi''$.
If $(A_i, \varphi_i)_{i \in I}$ is a totally
ordered collection of such pairs, then we obtain a map
$\bigcup_{i \in I} A_i \to J$ defined by $a \in A_i$
maps to $\varphi_i(a)$. Thus Zorn's lemma applies.
To conclude we have to show that if the pair
$(A', \varphi')$ is maximal then $A' = B$.
In other words, it suffices to show, given
any subgroup $A \subset B$, $A \not = B$ and
any $\varphi : A \to J$, then we can find
$\varphi' : A' \to J$ with $A \subset A' \subset B$
such that (a) the inclusion $A \subset A'$ is strict, and
(b) the morphism $\varphi'$ extends $\varphi$.

\medskip\noindent
To prove this, pick $x \in B$, $x \not \in A$.
If there exists no $n\in \mathbf{N}$ such that
$nx \in A$, then $A \oplus \mathbf{Z} \cong A + \mathbf{Z}x$.
Hence we can extend $\varphi$ to $A' = A + \mathbf{Z}x$
by using $\varphi$ on $A$ and mapping $x$ to zero for example.
If there does exist an $n \in \mathbf{N}$ such that
$nx \in A$, then let $n$ be the minimal such integer.
Let $z \in J$ be an element such that $nz = \varphi(nx)$.
Define a morphism $\tilde\varphi : A \oplus \mathbf{Z} \to J$ by
$(a, m) \mapsto \varphi(a) + mz$. By our choice of
$z$ the kernel of $\tilde \varphi$ contains the kernel
of the map $A \oplus \mathbf{Z} \to B$,
$(a, m) \mapsto a + mx$. Hence $\tilde \varphi$ factors
through the image $A' = A + \mathbf{Z}x$, and this extends the morphism
$\varphi$.
\end{proof}

\noindent
We can use this lemma to show that every abelian
group can be embedded in a injective abelian
group. But this is a special case of the result of
the following section.





\section{Injective modules}
\label{section-injectives-modules}

\noindent
Some lemmas on injective modules.

\begin{definition}
\label{definition-projective}
Let $R$ be a ring. An $R$-module $J$ is {\it injective} if and only if
the functor $\Hom_R(-, J) : \text{Mod}_R \to \text{Mod}_R$ is
an exact functor.
\end{definition}

\noindent
The functor $\Hom_R(- , M)$ is left exact for any $R$-module $M$, see
Algebra, Lemma \ref{algebra-lemma-hom-exact}.
Hence the condition for $J$ to be injective really signifies that given
an injection of $R$-modules $M \to M'$ the map
$\Hom_R(M', J) \to \Hom_R(M, J)$ is surjective.

\medskip\noindent
Before we reformulate this in terms of ${Ext}$-modules we discuss the
relationship between $\Ext^1_R(M, N)$ and extensions as in
Homology, Section \ref{homology-section-extensions}.

\begin{lemma}
\label{lemma-relation-ext-ext}
Let $R$ be a ring. Let $\mathcal{A}$ be the abelian category of
$R$-modules. There is a canonical isomorphism
$\Ext_\mathcal{A}(M, N) = \Ext^1_R(M, N)$
compatible with the long exact sequences of
Algebra, Lemmas \ref{algebra-lemma-long-exact-seq-ext} and
\ref{algebra-lemma-reverse-long-exact-seq-ext}
and the $6$-term exact sequences of
Homology, Lemma \ref{homology-lemma-six-term-sequence-ext}.
\end{lemma}

\begin{proof}
Omitted.
\end{proof}

\begin{lemma}
\label{lemma-characterize-injective}
Let $R$ be a ring. Let $J$ be an $R$-module.
The following are equivalent
\begin{enumerate}
\item $J$ is injective,
\item $\Ext^1_R(M, J) = 0$ for every $R$-module $M$.
\end{enumerate}
\end{lemma}

\begin{proof}
Let $0 \to M'' \to M' \to M \to 0$ be a short exact sequence of $R$-modules.
Consider the long exact sequence
$$
\begin{matrix}
0
\to \Hom_R(M, J)
\to \Hom_R(M', J)
\to \Hom_R(M'', J)
\\
\phantom{0\ }
\to \Ext^1_R(M, J)
\to \Ext^1_R(M', J)
\to \Ext^1_R(M'', J)
\to \ldots
\end{matrix}
$$
of Algebra, Lemma \ref{algebra-lemma-reverse-long-exact-seq-ext}.
Thus we see that (2) implies (1). Conversely, if $J$ is injective
then the $\Ext$-group is zero by
Homology, Lemma \ref{homology-lemma-characterize-injectives} and
Lemma \ref{lemma-relation-ext-ext}.
\end{proof}

\begin{lemma}
\label{lemma-characterize-injective-bis}
Let $R$ be a ring. Let $J$ be an $R$-module.
The following are equivalent
\begin{enumerate}
\item $J$ is injective,
\item $\Ext^1_R(R/I, J) = 0$ for every ideal $I \subset R$, and
\item for an ideal $I \subset R$ and module map $I \to J$
there exists an extension $R \to J$.
\end{enumerate}
\end{lemma}

\begin{proof}
If $I \subset R$ is an ideal, then the short exact sequence
$0 \to I \to R \to R/I \to 0$ gives an exact sequence
$$
\Hom_R(R, J) \to
\Hom_R(I, J) \to
\Ext^1_R(R/I, J) \to 0
$$
by Algebra, Lemma \ref{algebra-lemma-reverse-long-exact-seq-ext}
and the fact that $\Ext^1_R(R, J) = 0$ as $R$ is projective
(Algebra, Lemma \ref{algebra-lemma-characterize-projective}).
Thus (2) and (3) are equivalent. In this proof
we will show that (1) $\Leftrightarrow$ (3) which is known
as Baer's criterion.

\medskip\noindent
Assume (1). Given a module map $I \to J$ as in (3) we find
the extension $R \to J$ because the map
$\Hom_R(R, J) \to \Hom_R(I, J)$ is surjective
by definition.

\medskip\noindent
Assume (3). Let $M \subset N$ be an inclusion of $R$-modules.
Let $\varphi : M \to J$ be a homomorphism. We will show that $\varphi$
extends to $N$ which finishes the proof of the lemma.
Consider the set of homomorphisms $\varphi' : M' \to J$
with $M \subset M' \subset N$ and $\varphi'|_M = \varphi$.
Define $(M', \varphi') \geq (M'', \varphi'')$ if
and only if $M' \supset M''$ and $\varphi'|_{M''} = \varphi''$.
If $(M_i, \varphi_i)_{i \in I}$ is a totally
ordered collection of such pairs, then we obtain a map
$\bigcup_{i \in I} M_i \to J$ defined by $a \in M_i$
maps to $\varphi_i(a)$. Thus Zorn's lemma applies.
To conclude we have to show that if the pair
$(M', \varphi')$ is maximal then $M' = N$.
In other words, it suffices to show, given
any subgroup $M \subset N$, $M \not = N$ and
any $\varphi : M \to J$, then we can find
$\varphi' : M' \to J$ with $M \subset M' \subset N$
such that (a) the inclusion $M \subset M'$ is strict, and
(b) the morphism $\varphi'$ extends $\varphi$.

\medskip\noindent
To prove this, pick $x \in N$, $x \not \in M$.
Let $I = \{f \in R \mid fx \in M\}$. This is an ideal of $R$.
Define a homomorphism $\psi : I \to J$ by $f \mapsto \varphi(fx)$.
Extend to a map $\tilde\psi : R \to J$ which is possible by assumption (3).
By our choice of $I$ the kernel of
$M \oplus R \to J$, $(y, f) \mapsto y - \tilde\psi(f)$
contains the kernel of the map $M \oplus R \to N$,
$(y, f) \mapsto y + fx$. Hence this homomorphism factors
through the image $M' = M + Rx$ and this extends the given homomorphism
as desired.
\end{proof}

\noindent
In the rest of this section we prove that there are enough injective
modules over a ring $R$. We start with the fact that $\mathbf{Q}/\mathbf{Z}$
is an injective abelian group. This follows from
Lemma \ref{lemma-injective-abelian}.

\begin{definition}
\label{definition-simple-functors}
Let $R$ be a ring.
\begin{enumerate}
\item For any $R$-module $M$ over $R$ we denote
$M^\vee = \Hom(M, \mathbf{Q}/\mathbf{Z})$
with its natural $R$-module structure. We think
of {\it $M \mapsto M^\vee$} as a contravariant functor
from the category of $R$-modules to itself.
\item For any $R$-module $M$ we denote
$$
F(M) = \bigoplus\nolimits_{m \in M} R[m]
$$
the {\it free module} with basis given by the elements $[m]$ with
$m \in M$. We let $F(M)\to M$, $\sum f_i [m_i] \mapsto \sum f_i m_i$
be the natural surjection of $R$-modules.
We think of $M \mapsto (F(M) \to M)$ as a functor from
the category of $R$-modules to the category of
arrows in $R$-modules.
\end{enumerate}
\end{definition}

\begin{lemma}
\label{lemma-vee-exact}
Let $R$ be a ring.
The functor $M \mapsto M^\vee$ is exact.
\end{lemma}

\begin{proof}
This because $\mathbf{Q}/\mathbf{Z}$
is an injective abelian group by Lemma \ref{lemma-injective-abelian}.
\end{proof}

\noindent
There is a canonical map $ev : M \to (M^\vee)^\vee$
given by evaluation: given $x \in M$ we let
$ev(x) \in (M^\vee)^\vee = \Hom(M^\vee, \mathbf{Q}/\mathbf{Z})$
be the map $\varphi \mapsto \varphi(x)$.

\begin{lemma}
\label{lemma-ev-injective}
For any $R$-module $M$ the evaluation map
$ev : M \to (M^\vee)^\vee$ is injective.
\end{lemma}

\begin{proof}
You can check this using that $\mathbf{Q}/\mathbf{Z}$ is an injective
abelian group. Namely, if $x \in M$ is not zero, then let
$M' \subset M$ be the cyclic group it generates. There exists
a nonzero map $M' \to \mathbf{Q}/\mathbf{Z}$ which necessarily does
not annihilate $x$. This extends to
a map $\varphi : M \to \mathbf{Q}/\mathbf{Z}$
and then $ev(x)(\varphi) = \varphi(x) \not = 0$.
\end{proof}

\noindent
The canonical surjection $F(M) \to M$ of $R$-modules turns into
a canonical injection, see above, of $R$-modules
$$
(M^\vee)^\vee \longrightarrow (F(M^\vee))^\vee.
$$
Set $J(M) = (F(M^\vee))^\vee$. The composition of $ev$ with this
the displayed map gives $M \to J(M)$ functorially in $M$.

\begin{lemma}
\label{lemma-JM-injective}
Let $R$ be a ring. For every $R$-module $M$ the
$R$-module $J(M)$ is injective.
\end{lemma}

\begin{proof}
Note that $J(M) \cong \prod_{\varphi \in M^\vee} R^\vee$ as an $R$-module.
As the product of injective modules is injective, it suffices to
show that $R^\vee$ is injective. For this we use that
$$
\Hom_R(N, R^\vee) =
\Hom_R(N, \Hom_{\mathbf{Z}}(R, \mathbf{Q}/\mathbf{Z})) =
N^\vee
$$
and the
fact that $(-)^\vee$ is an exact functor by Lemma
\ref{lemma-vee-exact}.
\end{proof}

\begin{lemma}
\label{lemma-injectives-modules}
Let $R$ be a ring.
The construction above defines a covariant functor
$M \mapsto (M \to J(M))$ from the category of
$R$-modules to the category of arrows of $R$-modules
such that for every module $M$ the output
$M \to J(M)$ is an injective map of $M$ into
an injective $R$-module $J(M)$.
\end{lemma}

\begin{proof}
Follows from the above.
\end{proof}

\noindent
In particular, for any map of $R$-modules $M \to N$
there is an associated morphism $J(M) \to J(N)$
making the following diagram commute:
$$
\xymatrix{
M \ar[d] \ar[r] & N \ar[d] \\
J(M) \ar[r] & J(N) }
$$
This is the kind of construction we would like to have in general.
In Homology, Section \ref{homology-section-injectives}
we introduced terminology to express this. Namely,
we say this means that the category of $R$-modules
has functorial injective embeddings.











\section{Derived categories of modules}
\label{section-derived-modules}

\noindent
In this section we put some generalities concerning the
derived category of modules over a ring.

\medskip\noindent
Let $A$ be a ring. The category of $A$-modules is denoted $\text{Mod}_A$.
We will use the symbol $K(A)$ to denote the homotopy category of complexes
of $A$-modules, i.e., we set $K(A) = K(\text{Mod}_A)$ as a category, see
Derived Categories, Section \ref{derived-section-homotopy}. The bounded
versions are $K^+(A)$, $K^-(A)$, and $K^b(A)$.
We view $K(A)$ as a triangulated category as in
Derived Categories, Section \ref{derived-section-homotopy-triangulated}.
The {\it derived category} of $A$, denoted $D(A)$, is the category
obtained from $K(A)$ by inverting quasi-isomorphisms, i.e., we set
$D(A) = D(\text{Mod}_A)$, see
Derived Categories, Section
\ref{derived-section-derived-categories}\footnote{See also
Injectives, Remark \ref{injectives-remark-existence-D}.}.
The bounded versions are $D^+(A)$, $D^-(A)$, and $D^b(A)$.

\medskip\noindent
Let $A$ be a ring. The category of $A$-modules has products and products are
exact. The category of $A$-modules has enough injectives by
Lemma \ref{lemma-injectives-modules}. Hence every complex of $A$-modules
is quasi-isomorphic to a K-injective complex
(Derived Categories, Lemma \ref{derived-lemma-enough-K-injectives-Ab4-star}).
It follows that $D(A)$ has countable products
(Derived Categories, Lemma \ref{derived-lemma-products})
and in fact arbitrary products
(Injectives, Lemma \ref{injectives-lemma-derived-products}).
This implies that every inverse system of objects of $D(A)$
has a derived limit (well defined up to isomorphism), see
Derived Categories, Section \ref{derived-section-derived-limit}.

\begin{lemma}
\label{lemma-K-injective-flat}
Let $R \to S$ be a flat ring map. If $I^\bullet$ is a K-injective
complex of $S$-modules, then $I^\bullet$ is K-injective as a
complex of $R$-modules.
\end{lemma}

\begin{proof}
This is true because
$\Hom_{K(R)}(M^\bullet, I^\bullet) =
\Hom_{K(S)}(M^\bullet \otimes_R S, I^\bullet)$
by Algebra, Lemma \ref{algebra-lemma-adjoint-tensor-restrict}
and the fact that tensoring with $S$ is exact.
\end{proof}

\begin{lemma}
\label{lemma-K-injective-epimorphism}
Let $R \to S$ be an epimorphism of rings. Let $I^\bullet$ be a complex
of $S$-modules. If $I^\bullet$ is K-injective as a complex of
$R$-modules, then $I^\bullet$ is a K-injective complex of $S$-modules.
\end{lemma}

\begin{proof}
This is true because
$\Hom_{K(R)}(N^\bullet, I^\bullet) =
\Hom_{K(S)}(N^\bullet, I^\bullet)$ for any complex of $S$-modules
$N^\bullet$,
see Algebra, Lemma \ref{algebra-lemma-epimorphism-modules}.
\end{proof}

\begin{lemma}
\label{lemma-hom-K-injective}
Let $A \to B$ be a ring map. If $I^\bullet$ is a K-injective complex of
$A$-modules, then $\Hom_A(B, I^\bullet)$ is a K-injective complex of
$B$-modules.
\end{lemma}

\begin{proof}
This is true because
$\Hom_{K(B)}(N^\bullet, \Hom_A(B, I^\bullet)) =
\Hom_{K(A)}(N^\bullet, I^\bullet)$
by Algebra, Lemma \ref{algebra-lemma-adjoint-hom-restrict}.
\end{proof}










\section{Computing Tor}
\label{section-computing-tor}

\noindent
Let $R$ be a ring. We denote $D(R)$ the derived category of the
abelian category $\text{Mod}_R$ of $R$-modules. Note that $\text{Mod}_R$
has enough projectives as every free $R$-module is projective.
Thus we can define the left derived functors of any additive functor
from $\text{Mod}_R$ to any abelian category.

\medskip\noindent
This applies in particular to the functor
$ - \otimes_R M : \text{Mod}_R \to \text{Mod}_R$
whose left derived functors are the Tor functors $\text{Tor}_i^R(-, M)$, see
Algebra, Section \ref{algebra-section-tor}.
There is also a total left derived functor
\begin{equation}
\label{equation-derived-tensor-module}
-\otimes_R^{\mathbf{L}} M :
D^{-}(R)
\longrightarrow
D^{-}(R)
\end{equation}
which is denoted $-\otimes_R^{\mathbf{L}} M$. Its satellites are the
Tor modules, i.e., we have
$$
H^{-p}(N \otimes_R^{\mathbf{L}} M) = \text{Tor}_p^R(N, M).
$$

\medskip\noindent
A special situation occurs when we consider the tensor product with
an $R$-algebra $A$. In this case we think of $- \otimes_R A$
as a functor from $\text{Mod}_R$ to $\text{Mod}_A$. Hence the total
right derived functor
\begin{equation}
\label{equation-derived-tensor-algebra}
-\otimes_R^{\mathbf{L}} A :
D^{-}(R)
\longrightarrow
D^{-}(A)
\end{equation}
which is denoted $-\otimes_R^{\mathbf{L}} A$. Its satellites are the
tor groups, i.e., we have
$$
H^{-p}(N \otimes_R^{\mathbf{L}} A) = \text{Tor}_p^R(N, A).
$$
In particular these Tor groups naturally have the structure of $A$-modules.

\medskip\noindent
We will generalize the material in this section to unbounded
complexes in the next few sections.






\section{Tensor products of complexes}
\label{section-symmetric-monoidal}

\noindent
Let $R$ be a ring. The category $\text{Comp}(R)$ of complexes of $R$-modules
has a symmetric monoidal structure. Namely, suppose that we have two
complexes of $R$-modules $L^\bullet$ and $M^\bullet$. Using Homology, Example
\ref{homology-example-double-complex-as-tensor-product-of} and
Homology, Definition \ref{homology-definition-associated-simple-complex}
we obtain a third complex of $R$-modules, namely
$$
\text{Tot}(L^\bullet \otimes_R M^\bullet)
$$
Clearly this construction is functorial in both $L^\bullet$ and $M^\bullet$.
The associativity constraint will be the canonical isomorphism of complexes
$$
\text{Tot}(\text{Tot}(K^\bullet \otimes_R L^\bullet) \otimes_R M^\bullet)
\longrightarrow
\text{Tot}(K^\bullet \otimes_R \text{Tot}(L^\bullet \otimes_R M^\bullet))
$$
constructed in Homology, Remark \ref{homology-remark-triple-complex}
from the triple complex $K^\bullet \otimes_R L^\bullet \otimes_R M^\bullet$.
The commutativity constraint is the canonical isomorphism
$$
\text{Tot}(L^\bullet \otimes_R M^\bullet) \to
\text{Tot}(M^\bullet \otimes_R L^\bullet)
$$
which uses the sign $(-1)^{pq}$ on the summand $L^p \otimes_R M^q$.
To see that it is a map of complexes we compute for
$x \in L^p$ and $y \in M^q$ that
$$
\text{d}(x \otimes y) =
\text{d}_L(x) \otimes y + (-1)^px \otimes \text{d}_M(y)
$$
Our rule says the right hand side is mapped to
$$
(-1)^{(p + 1)q}y \otimes \text{d}_L(x) +
(-1)^{p + p(q + 1)} \text{d}_M(y) \otimes x
$$
On the other hand, we see that
$$
\text{d}((-1)^{pq}y \otimes x) =
(-1)^{pq} \text{d}_M(y) \otimes x +
(-1)^{pq + q} y \otimes \text{d}_L(x)
$$
These two expressions agree by inspection as desired.

\begin{lemma}
\label{lemma-symmetric-monoidal-cat-complexes}
Let $R$ be a ring. The category $\text{Comp}(R)$ of complexes of $R$-modules
endowed with the functor
$(L^\bullet, M^\bullet) \mapsto \text{Tot}(L^\bullet \otimes_R M^\bullet)$
and associativity and commutativity constraints as above is a symmetric
monoidal category.
\end{lemma}

\begin{proof}
Omitted. Hints: as unit $\mathbf{1}$ we take the complex having
$R$ in degree $0$ and zero in other degrees with obvious isomorphisms
$\text{Tot}(\mathbf{1} \otimes_R M^\bullet) = M^\bullet$ and
$\text{Tot}(K^\bullet \otimes_R \mathbf{1}) = K^\bullet$.
to prove the lemma you have to check the commutativity
of various diagrams, see Categories, Definitions
\ref{categories-definition-monoidal-category} and
\ref{categories-definition-symmetric-monoidal-category}.
The verifications are straightforward in each case.
\end{proof}

\begin{lemma}
\label{lemma-derived-tor-homotopy}
Let $R$ be a ring. Let $P^\bullet$ be a complex of $R$-modules.
Let $\alpha, \beta : L^\bullet \to M^\bullet$ be homotopic
maps of complexes. Then $\alpha$ and $\beta$ induce homotopic maps
$$
\text{Tot}(\alpha \otimes \text{id}_P),
\text{Tot}(\beta \otimes \text{id}_P) :
\text{Tot}(L^\bullet \otimes_R P^\bullet)
\longrightarrow
\text{Tot}(M^\bullet \otimes_R P^\bullet).
$$
In particular the construction
$L^\bullet \mapsto \text{Tot}(L^\bullet \otimes_R P^\bullet)$
defines an endo-functor of the homotopy category of complexes.
\end{lemma}

\begin{proof}
Say $\alpha = \beta + dh + hd$ for some homotopy $h$ defined by
$h^n : L^n \to M^{n - 1}$. Set
$$
H^n = \bigoplus\nolimits_{a + b = n} h^a \otimes \text{id}_{P^b} :
\bigoplus\nolimits_{a + b = n} L^a \otimes_R P^b
\longrightarrow
\bigoplus\nolimits_{a + b = n} M^{a - 1} \otimes_R P^b
$$
Then a straightforward computation shows that
$$
\text{Tot}(\alpha \otimes \text{id}_P) =
\text{Tot}(\beta \otimes \text{id}_P) + dH + Hd
$$
as maps $\text{Tot}(L^\bullet \otimes_R P^\bullet) \to
\text{Tot}(M^\bullet \otimes_R P^\bullet)$.
\end{proof}

\begin{lemma}
\label{lemma-symmetric-monoidal-homotopy-category}
Let $R$ be a ring. The homotopy category $K(R)$ of complexes of $R$-modules
endowed with the functor
$(L^\bullet, M^\bullet) \mapsto \text{Tot}(L^\bullet \otimes_R M^\bullet)$
and associativity and commutativity constraints as above is a symmetric
monoidal category.
\end{lemma}

\begin{proof}
This follows from Lemmas \ref{lemma-symmetric-monoidal-cat-complexes} and
\ref{lemma-derived-tor-homotopy}. Details omitted.
\end{proof}

\begin{lemma}
\label{lemma-derived-tor-exact}
Let $R$ be a ring. Let $P^\bullet$ be a complex of $R$-modules.
The functors
$$
K(R) \longrightarrow K(R), \quad
L^\bullet \longmapsto \text{Tot}(P^\bullet \otimes_R L^\bullet)
$$
and
$$
K(R) \longrightarrow K(R), \quad
L^\bullet \longmapsto \text{Tot}(L^\bullet \otimes_R P^\bullet)
$$
are exact functors of triangulated categories.
\end{lemma}

\begin{proof}
This follows from Derived Categories, Remark
\ref{derived-remark-double-complex-as-tensor-product-of}.
\end{proof}




\section{Derived tensor product}
\label{section-derived-tensor-product}

\noindent
We can construct the derived tensor product in greater generality.
In fact, it turns out that the boundedness assumptions are not
necessary, provided we choose K-flat resolutions.

\begin{definition}
\label{definition-K-flat}
Let $R$ be a ring. A complex $K^\bullet$ is called {\it K-flat}
if for every acyclic complex $M^\bullet$ the total complex
$\text{Tot}(M^\bullet \otimes_R K^\bullet)$ is acyclic.
\end{definition}

\begin{lemma}
\label{lemma-K-flat-quasi-isomorphism}
Let $R$ be a ring. Let $K^\bullet$ be a K-flat complex.
Then the functor
$$
K(R) \longrightarrow K(R), \quad
L^\bullet \longmapsto \text{Tot}(L^\bullet \otimes_R K^\bullet)
$$
transforms quasi-isomorphisms into quasi-isomorphisms.
\end{lemma}

\begin{proof}
Follows from
Lemma \ref{lemma-derived-tor-exact}
and the fact that quasi-isomorphisms in $K(R)$
are characterized by having acyclic cones.
\end{proof}

\begin{lemma}
\label{lemma-base-change-K-flat}
Let $R \to R'$ be a ring map. If $K^\bullet$ is a K-flat complex
of $R$-modules, then $K^\bullet \otimes_R R'$ is a K-flat complex
of $R'$-modules.
\end{lemma}

\begin{proof}
Follows from the definitions and the fact that
$(K^\bullet \otimes_R R') \otimes_{R'} L^\bullet =
K^\bullet \otimes_R L^\bullet$ for any complex
$L^\bullet$ of $R'$-modules.
\end{proof}

\begin{lemma}
\label{lemma-tensor-product-K-flat}
Let $R$ be a ring. If $K^\bullet$, $L^\bullet$ are K-flat complexes
of $R$-modules, then $\text{Tot}(K^\bullet \otimes_R L^\bullet)$ is a
K-flat complex of $R$-modules.
\end{lemma}

\begin{proof}
Follows from the isomorphism
$$
\text{Tot}(M^\bullet \otimes_R \text{Tot}(K^\bullet \otimes_R L^\bullet))
=
\text{Tot}(\text{Tot}(M^\bullet \otimes_R K^\bullet) \otimes_R L^\bullet)
$$
and the definition.
\end{proof}

\begin{lemma}
\label{lemma-K-flat-two-out-of-three}
Let $R$ be a ring. Let $(K_1^\bullet, K_2^\bullet, K_3^\bullet)$ be
a distinguished triangle in $K(R)$. If two out of three
of $K_i^\bullet$ are K-flat, so is the third.
\end{lemma}

\begin{proof}
Follows from
Lemma \ref{lemma-derived-tor-exact}
and the fact that in a distinguished triangle in
$K(R)$ if two out of three are acyclic, so is the third.
\end{proof}

\begin{lemma}
\label{lemma-K-flat-two-out-of-three-ses}
Let $R$ be a ring. Let
$0 \to K_1^\bullet \to K_2^\bullet \to K_3^\bullet \to 0$ be
a short exact sequence of complexes. If $K_3^n$ is flat for
all $n \in \mathbf{Z}$ and two out of three
of $K_i^\bullet$ are K-flat, so is the third.
\end{lemma}

\begin{proof}
Let $L^\bullet$ be a complex of $R$-modules. Then
$$
0 \to
\text{Tot}(L^\bullet \otimes_R K_1^\bullet) \to
\text{Tot}(L^\bullet \otimes_R K_2^\bullet) \to
\text{Tot}(L^\bullet \otimes_R K_3^\bullet) \to 0
$$
is a short exact sequence of complexes. Namely, for each
$n, m$ the sequence of modules
$0 \to L^n \otimes_R K_1^m \to
L^n \otimes_R K_2^m \to
L^n \otimes_R K_3^m \to 0$
is exact by Algebra, Lemma \ref{algebra-lemma-flat-tor-zero}
and the sequence of complexes is a direct sum of these.
Thus the lemma follows from this
and the fact that in a short exact sequence of complexes
if two out of three are acyclic, so is the third.
\end{proof}

\begin{lemma}
\label{lemma-derived-tor-quasi-isomorphism}
Let $R$ be a ring. Let $P^\bullet$ be a bounded above complex of
flat $R$-modules. Then $P^\bullet$ is K-flat.
\end{lemma}

\begin{proof}
Let $L^\bullet$ be an acyclic complex of $R$-modules.
Let $\xi \in H^n(\text{Tot}(L^\bullet \otimes_R P^\bullet))$.
We have to show that $\xi = 0$.
Since $\text{Tot}^n(L^\bullet \otimes_R P^\bullet)$ is a direct
sum with terms $L^a \otimes_R P^b$ we see that $\xi$ comes from
an element in $H^n(\text{Tot}(\tau_{\leq m}L^\bullet \otimes_R P^\bullet))$
for some $m \in \mathbf{Z}$. Since $\tau_{\leq m}L^\bullet$ is also
acyclic we may replace $L^\bullet$ by $\tau_{\leq m}L^\bullet$.
Hence we may assume that $L^\bullet$ is bounded above.
In this case the spectral sequence of
Homology, Lemma \ref{homology-lemma-first-quadrant-ss}
has
$$
{}'E_1^{p, q} = H^p(L^\bullet \otimes_R P^q)
$$
which is zero as $P^q$ is flat and $L^\bullet$ acyclic. Hence
$H^*(\text{Tot}(L^\bullet \otimes_R P^\bullet)) = 0$.
\end{proof}

\noindent
In the following lemma by a colimit of a system of complexes we mean
the termwise colimit.

\begin{lemma}
\label{lemma-colimit-K-flat}
Let $R$ be a ring.
Let $K_1^\bullet \to K_2^\bullet \to \ldots$
be a system of K-flat complexes.
Then $\colim_i K_i^\bullet$ is K-flat.
More generally any filtered colimit of K-flat complexes
is K-flat.
\end{lemma}

\begin{proof}
Because we are taking termwise colimits we have
$$
\colim_i \text{Tot}(M^\bullet \otimes_R K_i^\bullet) =
\text{Tot}(M^\bullet \otimes_R \colim_i K_i^\bullet)
$$
by Algebra, Lemma \ref{algebra-lemma-tensor-products-commute-with-limits}.
Hence the lemma follows from the fact that filtered colimits are
exact, see Algebra, Lemma \ref{algebra-lemma-directed-colimit-exact}.
\end{proof}

\begin{lemma}
\label{lemma-universally-acyclic-K-flat}
Let $R$ be a ring. Let $K^\bullet$ be a complex of $R$-modules.
If $K^\bullet \otimes_R M$ is acyclic for all finitely presented
$R$-modules $M$, then $K^\bullet$ is K-flat.
\end{lemma}

\begin{proof}
We will use repeatedly that tensor product commute with colimits
(Algebra, Lemma \ref{algebra-lemma-tensor-products-commute-with-limits}).
Thus we see that $K^\bullet \otimes_R M$ is acyclic for
any $R$-module $M$, because any $R$-module is a filtered colimit
of finitely presented $R$-modules $M$, see
Algebra, Lemma \ref{algebra-lemma-module-colimit-fp}.
Let $M^\bullet$ be an acyclic complex of $R$-modules.
We have to show that $\text{Tot}(M^\bullet \otimes_R K^\bullet)$
is acyclic. Since $M^\bullet = \colim \tau_{\leq n} M^\bullet$ (termwise
colimit) we have
$$
\text{Tot}(M^\bullet \otimes_R K^\bullet) =
\colim \text{Tot}(\tau_{\leq n} M^\bullet \otimes_R K^\bullet)
$$
with truncations as in Homology, Section \ref{homology-section-truncations}.
As filtered colimits are exact
(Algebra, Lemma \ref{algebra-lemma-directed-colimit-exact})
we may replace $M^\bullet$ by $\tau_{\leq n}M^\bullet$ and
assume that $M^\bullet$ is bounded above.
In the bounded above case, we can write
$M^\bullet = \colim \sigma_{\geq -n} M^\bullet$
where the complexes $\sigma_{\geq -n} M^\bullet$ are bounded
but possibly no longer acyclic.
Arguing as above we reduce to the case where $M^\bullet$
is a bounded complex.
Finally, for a bounded complex $M^a \to \ldots \to M^b$
we can argue by induction on the length $b - a$ of the complex.
The case $b - a = 1$ we have seen above.
For $b - a > 1$ we consider the split short exact sequence
of complexes
$$
0 \to \sigma_{\geq a + 1}M^\bullet \to M^\bullet \to M^a[-a] \to 0
$$
and we apply Lemma \ref{lemma-derived-tor-exact}
to do the induction step. Some details omitted.
\end{proof}

\begin{lemma}
\label{lemma-K-flat-resolution}
Let $R$ be a ring. For any complex $M^\bullet$ there exists a
K-flat complex $K^\bullet$ whose terms are flat $R$-modules
and a quasi-isomorphism $K^\bullet \to M^\bullet$ which is termwise
surjective.
\end{lemma}

\begin{proof}
Let $\mathcal{P} \subset \Ob(\text{Mod}_R)$ be the
class of flat $R$-modules. By
Derived Categories, Lemma \ref{derived-lemma-special-direct-system}
there exists a system
$K_1^\bullet \to K_2^\bullet \to \ldots$
and a diagram
$$
\xymatrix{
K_1^\bullet \ar[d] \ar[r] &
K_2^\bullet \ar[d] \ar[r] & \ldots \\
\tau_{\leq 1}M^\bullet \ar[r] &
\tau_{\leq 2}M^\bullet \ar[r] & \ldots
}
$$
with the properties (1), (2), (3) listed in that lemma.
These properties imply each complex $K_i^\bullet$ is a bounded
above complex of flat modules. Hence $K_i^\bullet$ is K-flat by
Lemma \ref{lemma-derived-tor-quasi-isomorphism}.
The induced map $\colim_i K_i^\bullet \to M^\bullet$
is a quasi-isomorphism and termwise surjective by construction. The complex
$\colim_i K_i^\bullet$ is K-flat by
Lemma \ref{lemma-colimit-K-flat}.
The terms $\colim K_i^n$ are flat because filtered colimits of
flat modules are flat, see
Algebra, Lemma \ref{algebra-lemma-colimit-flat}.
\end{proof}

\begin{remark}
\label{remark-P-resolution}
In fact, we can do better than Lemma \ref{lemma-K-flat-resolution}.
Namely, we can find a quasi-isomorphism
$P^\bullet \to M^\bullet$ where $P^\bullet$ is a complex of $R$-modules
endowed with a filtration
$$
0 = F_{-1}P^\bullet \subset F_0P^\bullet \subset
F_1P^\bullet \subset \ldots \subset P^\bullet
$$
by subcomplexes such that
\begin{enumerate}
\item $P^\bullet = \bigcup F_pP^\bullet$,
\item the inclusions $F_iP^\bullet \to F_{i + 1}P^\bullet$
are termwise split injections,
\item the quotients $F_{i + 1}P^\bullet/F_iP^\bullet$ are isomorphic to direct
sums of shifts $R[k]$ (as complexes, so differentials are zero).
\end{enumerate}
This will be shown in
Differential Graded Algebra, Lemma \ref{dga-lemma-resolve}.
Moreover, given such a complex we obtain a distinguished triangle
$$
\bigoplus F_iP^\bullet \to \bigoplus F_iP^\bullet \to M^\bullet
\to \bigoplus F_iP^\bullet[1]
$$
in $D(R)$. Using this we can sometimes reduce statements about general
complexes to statements about $R[k]$ (this of course only works if the
statement is preserved under taking direct sums). More precisely, let
$T$ be a property of objects of $D(R)$. Suppose that
\begin{enumerate}
\item if $K_i \in D(R)$, $i \in I$ is a family of objects with
$T(K_i)$ for all $i \in I$, then $T(\bigoplus K_i)$,
\item if $K \to L \to M \to K[1]$ is a distinguished triangle and
$T$ holds for two, then $T$ holds for the third object,
\item $T(R[k])$ holds for all $k$.
\end{enumerate}
Then $T$ holds for all objects of $D(R)$.
\end{remark}

\begin{lemma}
\label{lemma-derived-tor-quasi-isomorphism-other-side}
Let $R$ be a ring. Let
$\alpha : P^\bullet \to Q^\bullet$ be a quasi-isomorphism of
K-flat complexes of $R$-modules. For every complex $L^\bullet$
of $R$-modules the induced map
$$
\text{Tot}(\text{id}_L \otimes \alpha) :
\text{Tot}(L^\bullet \otimes_R P^\bullet)
\longrightarrow
\text{Tot}(L^\bullet \otimes_R Q^\bullet)
$$
is a quasi-isomorphism.
\end{lemma}

\begin{proof}
Choose a quasi-isomorphism $K^\bullet \to L^\bullet$ with
$K^\bullet$ a K-flat complex, see
Lemma \ref{lemma-K-flat-resolution}.
Consider the commutative diagram
$$
\xymatrix{
\text{Tot}(K^\bullet \otimes_R P^\bullet) \ar[r] \ar[d] &
\text{Tot}(K^\bullet \otimes_R Q^\bullet) \ar[d] \\
\text{Tot}(L^\bullet \otimes_R P^\bullet) \ar[r] &
\text{Tot}(L^\bullet \otimes_R Q^\bullet)
}
$$
The result follows as by
Lemma \ref{lemma-K-flat-quasi-isomorphism}
the vertical arrows and the top horizontal arrow are quasi-isomorphisms.
\end{proof}

\noindent
Let $R$ be a ring.
Let $M^\bullet$ be an object of $D(R)$.
Choose a K-flat resolution $K^\bullet \to M^\bullet$, see
Lemma \ref{lemma-K-flat-resolution}.
By
Lemmas \ref{lemma-derived-tor-homotopy} and \ref{lemma-derived-tor-exact}
we obtain an exact functor of triangulated categories
$$
K(R) \longrightarrow K(R), \quad
L^\bullet \longmapsto \text{Tot}(L^\bullet \otimes_R K^\bullet)
$$
By
Lemma \ref{lemma-K-flat-quasi-isomorphism}
this functor induces a functor $D(R) \to D(R)$ simply because
$D(R)$ is the localization of $K(R)$ at quasi-isomorphism.
By
Lemma \ref{lemma-derived-tor-quasi-isomorphism-other-side}
the resulting functor (up to isomorphism)
does not depend on the choice of the K-flat resolution.

\begin{definition}
\label{definition-derived-tor}
Let $R$ be a ring. Let $M^\bullet$ be an object of $D(R)$.
The {\it derived tensor product}
$$
- \otimes_R^{\mathbf{L}} M^\bullet : D(R) \longrightarrow D(R)
$$
is the exact functor of triangulated categories described above.
\end{definition}

\noindent
This functor extends the functor (\ref{equation-derived-tensor-module}).
It is clear from our explicit constructions that
there is an isomorphism (involving a choice of signs, see below)
$$
M^\bullet \otimes_R^{\mathbf{L}} L^\bullet
\cong
L^\bullet \otimes_R^{\mathbf{L}} M^\bullet
$$
whenever both $L^\bullet$ and $M^\bullet$ are in $D(R)$.
Hence when we write $M^\bullet \otimes_R^{\mathbf{L}} L^\bullet$
we will usually be agnostic about which variable we are using to
define the derived tensor product with.

\begin{lemma}
\label{lemma-flip-douoble-tensor-product}
Let $R$ be a ring. Let $K^\bullet, L^\bullet$ be complexes of $R$-modules.
There is a canonical isomorphism
$$
K^\bullet \otimes_R^\mathbf{L} L^\bullet \longrightarrow
L^\bullet \otimes_R^\mathbf{L} K^\bullet
$$
functorial in both complexes which uses a sign of $(-1)^{pq}$
for the map $K^p \otimes_R L^q \to L^q \otimes_R K^p$ (see proof
for explanation).
\end{lemma}

\begin{proof}
We may and do replace the complexes by K-flat complexes $K^\bullet$ and
$L^\bullet$ and then we use the commutativity constraint discussed
in Section \ref{section-symmetric-monoidal}.
\end{proof}

\begin{lemma}
\label{lemma-triple-tensor-product}
Let $R$ be a ring. Let $K^\bullet, L^\bullet, M^\bullet$
be complexes of $R$-modules. There is a canonical isomorphism
$$
(K^\bullet \otimes_R^\mathbf{L} L^\bullet) \otimes_R^\mathbf{L} M^\bullet
=
K^\bullet \otimes_R^\mathbf{L} (L^\bullet \otimes_R^\mathbf{L} M^\bullet)
$$
functorial in all three complexes.
\end{lemma}

\begin{proof}
Replace the complexes by K-flat complexes and use the
associativity constraint in Section \ref{section-symmetric-monoidal}.
\end{proof}

\begin{lemma}
\label{lemma-factor-through-K-flat}
Let $R$ be a ring. Let $a : K^\bullet \to L^\bullet$ be a map of complexes
of $R$-modules. If $K^\bullet$ is K-flat, then there exist a complex
$N^\bullet$ and maps of complexes $b : K^\bullet \to N^\bullet$
and $c : N^\bullet \to L^\bullet$ such that
\begin{enumerate}
\item $N^\bullet$ is K-flat,
\item $c$ is a quasi-isomorphism,
\item $a$ is homotopic to $c \circ b$.
\end{enumerate}
If the terms of $K^\bullet$ are flat, then we may choose
$N^\bullet$, $b$, and $c$
such that the same is true for $N^\bullet$.
\end{lemma}

\begin{proof}
We will use that the homotopy category $K(R)$
is a triangulated category, see Derived Categories, Proposition
\ref{derived-proposition-homotopy-category-triangulated}.
Choose a distinguished triangle
$K^\bullet \to L^\bullet \to C^\bullet \to K^\bullet[1]$.
Choose a quasi-isomorphism $M^\bullet \to C^\bullet$ with
$M^\bullet$ K-flat with flat terms, see Lemma \ref{lemma-K-flat-resolution}.
By the axioms of triangulated categories,
we may fit the composition $M^\bullet \to C^\bullet \to K^\bullet[1]$
into a distinguished triangle
$K^\bullet \to N^\bullet \to M^\bullet \to K^\bullet[1]$.
By Lemma \ref{lemma-K-flat-two-out-of-three} we see that $N^\bullet$ is K-flat.
Again using the axioms of triangulated categories,
we can choose a map $N^\bullet \to L^\bullet$ fitting into
the following morphism of distinghuised triangles
$$
\xymatrix{
K^\bullet \ar[r] \ar[d] &
N^\bullet \ar[r] \ar[d] &
M^\bullet \ar[r] \ar[d] &
K^\bullet[1] \ar[d] \\
K^\bullet \ar[r] &
L^\bullet \ar[r] &
C^\bullet \ar[r] &
K^\bullet[1]
}
$$
Since two out of three of the arrows are quasi-isomorphisms, so is
the third arrow $N^\bullet \to L^\bullet$ by the long exact sequences
of cohomology associated to these distinguished triangles
(or you can look at the image of this diagram in $D(R)$ and use
Derived Categories, Lemma \ref{derived-lemma-third-isomorphism-triangle}
if you like). This finishes the proof of (1), (2), and (3).
To prove the final assertion, we may choose $N^\bullet$
such that $N^n \cong M^n \oplus K^n$, see
Derived Categories, Lemma
\ref{derived-lemma-improve-distinguished-triangle-homotopy}.
Hence we get the desired flatness
if the terms of $K^\bullet$ are flat.
\end{proof}








\section{Derived change of rings}
\label{section-derived-base-change}

\noindent
Let $R \to A$ be a ring map. Let $N^\bullet$ be a complex of $A$-modules.
We can also use K-flat resolutions to define a functor
$$
- \otimes_R^{\mathbf{L}} N^\bullet : D(R) \to D(A)
$$
as the left derived functor of the functor $K(R) \to K(A)$,
$M^\bullet \mapsto \text{Tot}(M^\bullet \otimes_R N^\bullet)$.
In particular, taking $N^\bullet = A[0]$ we obtain a
derived base change functor
$$
- \otimes_R^{\mathbf{L}} A : D(R) \to D(A)
$$
extending the functor (\ref{equation-derived-tensor-algebra}).
Namely, for every complex of $R$-modules $M^\bullet$ we can
choose a K-flat resolution $K^\bullet \to M^\bullet$ and set
$$
M^\bullet \otimes_R^{\mathbf{L}} N^\bullet =
\text{Tot}(K^\bullet \otimes_R N^\bullet).
$$
You can use
Lemmas \ref{lemma-K-flat-resolution} and
\ref{lemma-derived-tor-quasi-isomorphism-other-side}
to see that this is well defined. However, to cross all the t's and dot all
the i's it is perhaps more convenient to use some general theory.

\begin{lemma}
\label{lemma-derived-base-change}
The construction above is independent of choices and defines an exact
functor of triangulated categories
$- \otimes_R^\mathbf{L} N^\bullet : D(R) \to D(A)$.
There is a functorial isomorphism
$$
E^\bullet \otimes_R^\mathbf{L} N^\bullet =
(E^\bullet \otimes_R^\mathbf{L} A) \otimes_A^\mathbf{L} N^\bullet
$$
for $E^\bullet$ in $D(R)$.
\end{lemma}

\begin{proof}
To prove the existence of the derived functor
$- \otimes_R^\mathbf{L} N^\bullet$
we use the general theory developed in
Derived Categories, Section \ref{derived-section-derived-functors}.
Set $\mathcal{D} = K(R)$ and $\mathcal{D}' = D(A)$.
Let us write $F : \mathcal{D} \to \mathcal{D}'$ the exact functor
of triangulated categories defined by the rule
$F(M^\bullet) = \text{Tot}(M^\bullet \otimes_R N^\bullet)$.
To prove the stated properties of $F$ use
Lemmas \ref{lemma-derived-tor-homotopy} and \ref{lemma-derived-tor-exact}.
We let $S$ be the set of
quasi-isomorphisms in $\mathcal{D} = K(R)$.
This gives a situation as in
Derived Categories, Situation \ref{derived-situation-derived-functor}
so that
Derived Categories, Definition
\ref{derived-definition-right-derived-functor-defined}
applies. We claim that $LF$ is everywhere defined.
This follows from
Derived Categories, Lemma \ref{derived-lemma-find-existence-computes}
with $\mathcal{P} \subset \Ob(\mathcal{D})$ the collection
of K-flat complexes: (1) follows from
Lemma \ref{lemma-K-flat-resolution}
and (2) follows from
Lemma \ref{lemma-derived-tor-quasi-isomorphism-other-side}.
Thus we obtain a derived functor
$$
LF : D(R) = S^{-1}\mathcal{D} \longrightarrow \mathcal{D}' = D(A)
$$
see
Derived Categories, Equation (\ref{derived-equation-everywhere}).
Finally,
Derived Categories, Lemma \ref{derived-lemma-find-existence-computes}
guarantees that $LF(K^\bullet) = F(K^\bullet) =
\text{Tot}(K^\bullet \otimes_R N^\bullet)$
when $K^\bullet$ is K-flat, i.e., $LF$ is indeed computed in the way
described above. Moreover, by Lemma \ref{lemma-base-change-K-flat}
the complex $K^\bullet \otimes_R A$ is a K-flat complex of $A$-modules.
Hence
$$
(K^\bullet \otimes_R^\mathbf{L} A) \otimes_A^\mathbf{L} N^\bullet =
\text{Tot}((K^\bullet \otimes_R A) \otimes_A N^\bullet) =
\text{Tot}(K^\bullet \otimes_A N^\bullet) =
K^\bullet \otimes_A^\mathbf{L} N^\bullet
$$
which proves the final statement of the lemma.
\end{proof}

\begin{lemma}
\label{lemma-functoriality-derived-base-change}
Let $R \to A$ be a ring map. Let $f : L^\bullet \to N^\bullet$ be a
map of complexes of $A$-modules. Then $f$ induces a transformation
of functors
$$
1 \otimes f :
- \otimes_A^\mathbf{L} L^\bullet
\longrightarrow
- \otimes_A^\mathbf{L} N^\bullet
$$
If $f$ is a quasi-isomorphism, then $1 \otimes f$ is an isomorphism
of functors.
\end{lemma}

\begin{proof}
Since the functors are computing by evaluating on K-flat complexes
$K^\bullet$ we can simply use the functoriality
$$
\text{Tot}(K^\bullet \otimes_R L^\bullet) \to
\text{Tot}(K^\bullet \otimes_R N^\bullet)
$$
to define the transformation. The last statement follows from
Lemma \ref{lemma-K-flat-quasi-isomorphism}.
\end{proof}

\begin{lemma}
\label{lemma-tensor-hom-adjoint}
Let $R \to A$ be a ring map. The functor
$D(R) \to D(A)$, $E \mapsto E \otimes_R^\mathbf{L} A$
of Lemma \ref{lemma-derived-base-change}
is left adjoint to the restriction functor
$D(A) \to D(R)$.
\end{lemma}

\begin{proof}
This follows from Derived Categories, Lemma
\ref{derived-lemma-pre-derived-adjoint-functors-general}
and the fact that $- \otimes_R A$ and restriction are adjoint by
Algebra, Lemma \ref{algebra-lemma-adjoint-tensor-restrict}.
\end{proof}

\begin{remark}[Warning]
\label{remark-warning-compute-base-change}
Let $R \to A$ be a ring map, and let $N$ and $N'$ be $A$-modules.
Denote $N_R$ and $N'_R$ the restriction of $N$ and $N'$ to $R$-modules,
see Algebra, Section \ref{algebra-section-base-change}.
In this situation, the objects $N_R \otimes_R^\mathbf{L} N'$
and $N \otimes_R^\mathbf{L} N'_R$ of $D(A)$ are in general
not isomorphic! In other words, one has to pay careful attention
as to which of the two sides is being used to provide the
$A$-module structure.

\medskip\noindent
For a specific example, set $R = k[x, y]$, $A = R/(xy)$, $N = R/(x)$
and $N' = A = R/(xy)$. The resolution
$0 \to R \xrightarrow{xy} R \to N'_R \to 0$
shows that $N \otimes_R^\mathbf{L} N'_R = N[1] \oplus N$ in $D(A)$.
The resolution
$0 \to R \xrightarrow{x} R \to N_R \to 0$
shows that $N_R \otimes_R^\mathbf{L} N'$ is represented by
the complex $A \xrightarrow{x} A$. To see these two complexes
are not isomorphic, one can show that the second complex is
not isomorphic in $D(A)$ to the direct sum of its cohomology groups,
or one can show that the first complex is not a perfect object of $D(A)$
whereas the second one is. Some details omitted.
\end{remark}

\begin{lemma}
\label{lemma-double-base-change}
Let $A \to B \to C$ be ring maps. Let $N^\bullet$ be a complex of
$B$-modules and $K^\bullet$ a complex of $C$-modules.
The compositions of the functors
$$
D(A) \xrightarrow{- \otimes_A^\mathbf{L} N^\bullet}
D(B) \xrightarrow{- \otimes_B^\mathbf{L} K^\bullet} D(C)
$$
is the functor
$- \otimes_A^\mathbf{L} (N^\bullet \otimes_B^\mathbf{L} K^\bullet) :
D(A) \to D(C)$. If $M$, $N$, $K$ are modules over $A$, $B$, $C$, then
we have
$$
(M \otimes_A^\mathbf{L} N) \otimes_B^\mathbf{L} K =
M \otimes_A^\mathbf{L} (N \otimes_B^\mathbf{L} K) =
(M \otimes_A^\mathbf{L} C) \otimes_C^\mathbf{L} (N \otimes_B^\mathbf{L} K)
$$
in $D(C)$. We also have a canonical isomorphism
$$
(M \otimes_A^\mathbf{L} N) \otimes_B^\mathbf{L} K \longrightarrow
(M \otimes_A^\mathbf{L} K) \otimes_C^\mathbf{L} (N \otimes_B^\mathbf{L} C)
$$
using signs. Similar results holds for complexes.
\end{lemma}

\begin{proof}
Choose a K-flat complex $P^\bullet$ of $B$-modules and a quasi-isomorphism
$P^\bullet \to N^\bullet$ (Lemma \ref{lemma-K-flat-resolution}).
Let $M^\bullet$ be a K-flat complex of $A$-modules representing an
arbitrary object of $D(A)$. Then we see that
$$
(M^\bullet \otimes_A^\mathbf{L} P^\bullet) \otimes_B^\mathbf{L} K^\bullet
\longrightarrow
(M^\bullet \otimes_A^\mathbf{L} N^\bullet) \otimes_B^\mathbf{L} K^\bullet
$$
is an isomorphism by Lemma \ref{lemma-functoriality-derived-base-change}
applied to the material inside the brackets. By
Lemmas \ref{lemma-base-change-K-flat} and \ref{lemma-tensor-product-K-flat}
the complex
$$
\text{Tot}(M^\bullet \otimes_A P^\bullet) =
\text{Tot}((M^\bullet \otimes_R A) \otimes_A P^\bullet
$$
is K-flat as a complex of $B$-modules and it represents
the derived tensor product in $D(B)$ by construction.
Hence we see that
$(M^\bullet \otimes_A^\mathbf{L} P^\bullet) \otimes_B^\mathbf{L} K^\bullet$
is represented by the complex
$$
\text{Tot}(\text{Tot}(M^\bullet \otimes_A P^\bullet)\otimes_B K^\bullet) =
\text{Tot}(M^\bullet \otimes_A \text{Tot}(P^\bullet \otimes_B K^\bullet))
$$
of $C$-modules. Equality by
Homology, Remark \ref{homology-remark-triple-complex}.
Going back the way we came we see that this is equal to
$$
M^\bullet \otimes_A^\mathbf{L} (P^\bullet \otimes_B^\mathbf{L} K^\bullet)
\longleftarrow
M^\bullet \otimes_A^\mathbf{L} (N^\bullet \otimes_B^\mathbf{L} K^\bullet)
$$
The arrow is an isomorphism by definition of the functor
$-\otimes_B^\mathbf{L} K^\bullet$. All of these constructions
are functorial in the complex $M^\bullet$ and hence we obtain
our isomorphism of functors.

\medskip\noindent
By the above we have the first equality in
$$
(M \otimes_A^\mathbf{L} N) \otimes_B^\mathbf{L} K =
M \otimes_A^\mathbf{L} (N \otimes_B^\mathbf{L} K) =
(M \otimes_A^\mathbf{L} C) \otimes_C^\mathbf{L} (N \otimes_B^\mathbf{L} K)
$$
The second equality follows from the final statement of
Lemma \ref{lemma-derived-base-change}.
The same thing allows us to write
$N \otimes_B^\mathbf{L} K = (N \otimes_B^\mathbf{L} C) \otimes_C^\mathbf{L} K$
and substituting we get
\begin{align*}
(M \otimes_A^\mathbf{L} N) \otimes_B^\mathbf{L} K
& =
(M \otimes_A^\mathbf{L} C) \otimes_C^\mathbf{L}
((N \otimes_B^\mathbf{L} C) \otimes_C^\mathbf{L} K) \\
& =
(M \otimes_A^\mathbf{L} C) \otimes_C^\mathbf{L}
(K \otimes_C^\mathbf{L} (N \otimes_B^\mathbf{L} C)) \\
& =
((M \otimes_A^\mathbf{L} C) \otimes_C^\mathbf{L} K)
\otimes_C^\mathbf{L} (N \otimes_B^\mathbf{L} C)) \\
& =
(M \otimes_C^\mathbf{L} K)
\otimes_C^\mathbf{L} (N \otimes_B^\mathbf{L} C)
\end{align*}
by Lemmas \ref{lemma-flip-douoble-tensor-product} and
\ref{lemma-triple-tensor-product}
as well as the previously mentioned lemma.
\end{proof}






\section{Tor independence}
\label{section-tor-independence}

\noindent
Consider a commutative diagram
$$
\xymatrix{
A \ar[r] & A' \\
R \ar[r] \ar[u] & R' \ar[u]
}
$$
of rings. Given an object $K$ of $D(A)$ we can consider its derived
base change $K \otimes_A^\mathbf{L} A'$ to an object of $D(A')$.
Or we can take the restriction of $K$ to an object of $D(R)$ and
consider the derived base change of this to an object of $D(R')$,
denoted $K \otimes_R^\mathbf{L} R'$
We claim there is a functorial comparison map
\begin{equation}
\label{equation-comparison-map}
K \otimes_R^{\mathbf{L}} R'
\longrightarrow
K \otimes_A^{\mathbf{L}} A'
\end{equation}
in $D(R')$. To construct this comparison map choose a K-flat
complex $K^\bullet$ of $A$-modules representing $K$. Next, choose
a quasi-isomorphism $E^\bullet \to K^\bullet$ where $E^\bullet$
is a K-flat complex of $R$-modules. The map above is the map
$$
K \otimes_R^{\mathbf{L}} R' =
E^\bullet \otimes_R R'
\longrightarrow
K^\bullet \otimes_A A' =
K \otimes_A^{\mathbf{L}} A'
$$
In general there is no chance that this map is an isomorphism.

\medskip\noindent
However, we often encounter the situation where the diagram above
is a ``base change'' diagram of rings, i.e., $A' = A \otimes_R R'$.
In this situation, for any $A$-module $M$ we have
$M \otimes_A A' = M \otimes_R R'$. Thus $- \otimes_R R'$
is equal to $- \otimes_A A'$ as a functor $\text{Mod}_A \to \text{Mod}_{A'}$.
In general this equality {\bf does not extend} to derived tensor products.
In other words, the comparison map is not an isomorphism.
A simple example is to take
$R = k[x]$, $A = R' = A' = k[x]/(x) = k$ and $K^\bullet = A[0]$.
Clearly, a necessary condition is that $\text{Tor}_p^R(A, R') = 0$
for all $p > 0$.

\begin{definition}
\label{definition-tor-independent}
Let $R$ be a ring. Let $A$, $B$ be $R$-algebras. We say
$A$ and $B$ are {\it Tor independent over $R$} if
$\text{Tor}_p^R(A, B) = 0$ for all $p > 0$.
\end{definition}

\begin{lemma}
\label{lemma-base-change-comparison}
The comparison map (\ref{equation-comparison-map}) is an isomorphism
if $A' = A \otimes_R R'$ and $A$ and $R'$ are Tor independent over $R$.
\end{lemma}

\begin{proof}
To prove this we choose a free resolution $F^\bullet \to R'$
of $R'$ as an $R$-module. Because $A$ and $R'$ are Tor independent over $R$
we see that $F^\bullet \otimes_R A$ is a free $A$-module resolution of $A'$
over $A$. By our general construction of the derived tensor product
above we see that
$$
K^\bullet \otimes_A A' \cong
\text{Tot}(K^\bullet \otimes_A (F^\bullet \otimes_R A)) =
\text{Tot}(K^\bullet \otimes_R F^\bullet) \cong
\text{Tot}(E^\bullet \otimes_R F^\bullet) \cong
E^\bullet \otimes_R R'
$$
as desired.
\end{proof}

\begin{lemma}
\label{lemma-tor-independent-flat}
Consider a commutative diagram of rings
$$
\xymatrix{
A' & R' \ar[r] \ar[l] & B' \\
A \ar[u] & R \ar[l] \ar[u] \ar[r] & B \ar[u]
}
$$
Assume that $R'$ is flat over $R$ and $A'$ is flat over $A \otimes_R R'$
and $B'$ is flat over $R' \otimes_R B$. Then
$$
\text{Tor}_i^R(A, B) \otimes_{(A \otimes_R B)} (A' \otimes_{R'} B') =
\text{Tor}_i^{R'}(A', B')
$$
\end{lemma}

\begin{proof}
By Algebra, Section \ref{algebra-section-functoriality-tor} there are
canonical maps
$$
\text{Tor}_i^R(A, B) \longrightarrow
\text{Tor}_i^{R'}(A \otimes_R R', B \otimes_R R') \longrightarrow
\text{Tor}_i^{R'}(A', B')
$$
These induce a map from left to right in the formula of the lemma.

\medskip\noindent
Take a free resolution $F_\bullet \to A$ of $A$ as an $R$-module.
Then we see that $F_\bullet \otimes_R R'$ is a resolution of $A \otimes_R R'$.
Hence $\text{Tor}_i^{R'}(A \otimes_R R', B \otimes_R R')$ is computed
by $F_\bullet \otimes_R B \otimes_R R'$. By our assumption that $R'$
is flat over $R$, this computes $\text{Tor}_i^R(A, B) \otimes_R R'$.
Thus $\text{Tor}_i^{R'}(A \otimes_R R', B \otimes_R R') =
\text{Tor}_i^R(A, B) \otimes_R R'$ (uses only flatness of $R'$ over $R$).

\medskip\noindent
By Lazard's theorem (Algebra, Theorem \ref{algebra-theorem-lazard})
we can write $A'$, resp.\ $B'$ as a filtered colimit of finite free
$A \otimes_R R'$, resp.\ $B \otimes_R R'$-modules. Say
$A' = \colim M_i$ and $B' = \colim N_j$. The result above gives
$$
\text{Tor}_i^{R'}(M_i, N_j) =
\text{Tor}_i^R(A, B) \otimes_{A \otimes_R B} (M_i \otimes_{R'} N_j)
$$
as one can see by writing everything out in terms of bases.
Taking the colimit we get the result of the lemma.
\end{proof}

\begin{lemma}
\label{lemma-flat-base-change-tor-independent}
Let $R \to A$ and $R \to B$ be ring maps. Let $R \to R'$ be a
ring map and set $A' = A \otimes_R R'$ and $B' = B \otimes_R R'$.
If $A$ and $B$ are tor independent over $R$ and $R \to R'$ is flat,
then $A'$ and $B'$ are tor independent over $R'$.
\end{lemma}

\begin{proof}
Follows immediately from Lemma \ref{lemma-tor-independent-flat}
and Definition \ref{definition-tor-independent}.
\end{proof}

\begin{lemma}
\label{lemma-lemma-tor-independent-flat-compare}
Assumptions as in Lemma \ref{lemma-tor-independent-flat}.
For $M \in D(A)$ there are canonical isomorphisms
$$
H^i((M \otimes_A^\mathbf{L} A') \otimes_{R'}^\mathbf{L} B') =
H^i(M \otimes_R^\mathbf{L} B) \otimes_{(A \otimes_R B)} (A' \otimes_{R'} B')
$$
of $A' \otimes_{R'} B'$-modules.
\end{lemma}

\begin{proof}
Let us elucidate the two sides of the equation. On the left hand side
we have the composition of the functors
$D(A) \to D(A') \to D(R') \to D(B')$ with the functor
$H^i : D(B') \to \text{Mod}_{B'}$. Since there is
a map from $A'$ to the endomorphisms of the object
$(M \otimes_A^\mathbf{L} A') \otimes_{R'}^\mathbf{L} B'$
in $D(B')$, we see that the left hand side is indeed
an $A' \otimes_{R'} B'$-module. By the same arguments
we see that $H^i(M \otimes_R^\mathbf{L} B)$
has an $A \otimes_R B$-module structure.

\medskip\noindent
We first prove the result in case $B' = R' \otimes_R B$.
In this case we choose a resolution $F^\bullet \to B$
by free $R$-modules. We also choose a K-flat complex
$M^\bullet$ of $A$-modules representing $M$.
Then the left hand side is represented by
\begin{align*}
H^i(\text{Tot}((M^\bullet \otimes_A A') \otimes_{R'} (R' \otimes_R F^\bullet)))
& =
H^i(\text{Tot}(M^\bullet \otimes_A A' \otimes_R F^\bullet)) \\
& =
H^i(\text{Tot}(M^\bullet \otimes_R F^\bullet) \otimes_A A') \\
& =
H^i(M \otimes_R^\mathbf{L} B) \otimes_A A'
\end{align*}
The final equality because $A \to A'$ is flat. The final module
is the desired module because $A' \otimes_{R'} B' = A' \otimes_R B$
since we've assumed $B' = R' \otimes_R B$ in this paragraph.

\medskip\noindent
General case. Suppose that $B' \to B''$ is a flat ring map.
Then it is easy to see that
$$
H^i((M \otimes_A^\mathbf{L} A') \otimes_{R'}^\mathbf{L} B'') =
H^i((M \otimes_A^\mathbf{L} A') \otimes_{R'}^\mathbf{L} B')
\otimes_{B'} B''
$$
and
$$
H^i(M \otimes_R^\mathbf{L} B) \otimes_{(A \otimes_R B)} (A' \otimes_{R'} B'')
=
\left(
H^i(M \otimes_R^\mathbf{L} B) \otimes_{(A \otimes_R B)} (A' \otimes_{R'} B')
\right) \otimes_{B'} B''
$$
Thus the result for $B'$ implies the result for $B''$. Since we've
proven the result for $R' \otimes_R B$ in the previous paragraph,
this implies the result in general.
\end{proof}

\begin{lemma}
\label{lemma-tor-independent}
Let $R$ be a ring. Let $A$, $B$ be $R$-algebras. The following are equivalent
\begin{enumerate}
\item $A$ and $B$ are Tor independent over $R$,
\item for every pair of primes $\mathfrak p \subset A$ and
$\mathfrak q \subset B$ lying over the same prime $\mathfrak r \subset R$
the rings $A_\mathfrak p$ and $B_\mathfrak q$ are Tor independent over
$R_\mathfrak r$, and
\item For every prime $\mathfrak s$ of $A \otimes_R B$ the module
$$
\text{Tor}_i^R(A, B)_\mathfrak s =
\text{Tor}_i^{R_\mathfrak r}(A_\mathfrak p, B_\mathfrak q)_\mathfrak s
$$
(where $\mathfrak p = A \cap \mathfrak s$, $\mathfrak q = B \cap \mathfrak s$
and $\mathfrak r = R \cap \mathfrak s$) is zero.
\end{enumerate}
\end{lemma}

\begin{proof}
Let $\mathfrak s$ be a prime of $A \otimes_R B$ as in (3).
The equality
$$
\text{Tor}_i^R(A, B)_\mathfrak s =
\text{Tor}_i^{R_\mathfrak r}(A_\mathfrak p, B_\mathfrak q)_\mathfrak s
$$
where $\mathfrak p = A \cap \mathfrak s$, $\mathfrak q = B \cap \mathfrak s$
and $\mathfrak r = R \cap \mathfrak s$ follows from
Lemma \ref{lemma-tor-independent-flat}.
Hence (2) implies (3).
Since we can test the vanishing of modules by localizing at primes
(Algebra, Lemma \ref{algebra-lemma-characterize-zero-local})
we conclude that (3) implies (1). For
(1) $\Rightarrow$ (2) we use that
$$
\text{Tor}_i^{R_\mathfrak r}(A_\mathfrak p, B_\mathfrak q) =
\text{Tor}_i^R(A, B) \otimes_{(A \otimes_R B)}
(A_\mathfrak p \otimes_{R_{\mathfrak r}} B_\mathfrak q)
$$
again by Lemma \ref{lemma-tor-independent-flat}.
\end{proof}








\section{Spectral sequences for Tor}
\label{section-spectral-sequence-tor}


\noindent
In this section we collect various spectral sequences that come up
when considering the Tor functors.

\begin{example}
\label{example-cohomology-complex-tensored}
Let $R$ be a ring. Let $K_\bullet$ be a chain complex of $R$-modules
with $K_n = 0$ for $n \ll 0$.
Let $M$ be an $R$-module. Choose a resolution $P_\bullet \to M$ of
$M$ by free $R$-modules. We obtain a double chain complex
$K_\bullet \otimes_R P_\bullet$.
Applying the material in
Homology, Section \ref{homology-section-double-complex}
(especially Homology, Lemma \ref{homology-lemma-first-quadrant-ss})
translated into the language of chain complexes
we find two spectral sequences converging to
$H_*(K_\bullet \otimes_R^\mathbf{L} M)$. Namely, on the one hand a
spectral sequence with $E_2$-page
$$
(E_2)_{i, j} = \text{Tor}^R_j(H_i(K_\bullet), M)
\Rightarrow
H_{i + j}(K_\bullet \otimes^{\mathbf{L}}_R M)
$$
and differential $d_2$ given by maps
$\text{Tor}^R_j(H_i(K_\bullet), M) \to
\text{Tor}^R_{j - 2}(H_{i + 1}(K_\bullet), M)$.
Another spectral sequence with $E_1$-page
$$
(E_1)_{i, j} = \text{Tor}^R_j(K_i, M)
\Rightarrow
H_{i + j}(K_\bullet \otimes^{\mathbf{L}}_R M)
$$
with differential $d_1$ given by maps
$\text{Tor}^R_j(K_i, M) \to \text{Tor}^R_j(K_{i - 1}, M)$
induced by $K_i \to K_{i - 1}$.
\end{example}

\begin{example}
\label{example-tor-change-rings}
Let $R \to S$ be a ring map. Let $M$ be an $R$-module and let
$N$ be an $S$-module. Then there is a spectral sequence
$$
\text{Tor}^S_n(\text{Tor}^R_m(M, S), N) \Rightarrow
\text{Tor}^R_{n + m}(M, N).
$$
To construct it choose a $R$-free resolution $P_\bullet$ of $M$. Then we have
$$
M \otimes_R^{\mathbf{L}} N = P^\bullet \otimes_R N =
(P^\bullet \otimes_R S) \otimes_S N
$$
and then apply the first spectral sequence of
Example \ref{example-cohomology-complex-tensored}.
\end{example}

\begin{example}
\label{example-tor-base-change}
Consider a commutative diagram
$$
\xymatrix{
B \ar[r] & B' = B \otimes_A A' \\
A \ar[r] \ar[u] & A' \ar[u]
}
$$
and $B$-modules $M, N$. Set $M' = M \otimes_A A' = M \otimes_B B'$
and $N' = N \otimes_A A' = N \otimes_B B'$.
{\it Assume that $A \to B$ is flat and that $M$ and $N$ are $A$-flat.}
Then there is a spectral sequence
$$
\text{Tor}^A_i(\text{Tor}_j^B(M, N), A')
\Rightarrow
\text{Tor}^{B'}_{i + j}(M', N')
$$
The reason is as follows. Choose free resolution
$F_\bullet \to M$ as a $B$-module. As $B$ and $M$ are $A$-flat we see
that $F_\bullet \otimes_A A'$ is a free $B'$-resolution of $M'$.
Hence we see that the groups $\text{Tor}^{B'}_n(M', N')$ are
computed by the complex
$$
(F_\bullet \otimes_A A') \otimes_{B'} N' =
(F_\bullet \otimes_B N) \otimes_A A' =
(F_\bullet \otimes_B N) \otimes^{\mathbf{L}}_A A'
$$
the last equality because $F_\bullet \otimes_B N$ is a complex
of flat $A$-modules as $N$ is flat over $A$. Hence we obtain the
spectral sequence by applying the spectral sequence of
Example \ref{example-cohomology-complex-tensored}.
\end{example}

\begin{example}
\label{example-tor}
Let $K^\bullet, L^\bullet$ be objects of $D^{-}(R)$.
Then there are spectral sequences
$$
E_2^{p, q} = H^p(K^\bullet \otimes_R^{\mathbf{L}} H^q(L^\bullet))
\Rightarrow H^{p + q}(K^\bullet \otimes_R^{\mathbf{L}} L^\bullet)
$$
with $d_2^{p, q} : E_2^{p, q} \to E_2^{p + 2, q - 1}$
and
$$
H^q(H^p(K^\bullet) \otimes_R^{\mathbf{L}} L^\bullet)
\Rightarrow H^{p + q}(K^\bullet \otimes_R^{\mathbf{L}} L^\bullet)
$$
After replacing $K^\bullet$ and $L^\bullet$ by bounded above complexes
of projectives, these spectral sequences are simply the two spectral
sequences for computing the cohomology of
$\text{Tot}(K^\bullet \otimes L^\bullet)$ discussed in
Homology, Section \ref{homology-section-double-complex}.
\end{example}









\section{Products and Tor}
\label{section-products-tor}

\noindent
The simplest example of the product maps comes from the following situation.
Suppose that $K^\bullet, L^\bullet \in D(R)$. Then there are maps
\begin{equation}
\label{equation-simple-tor-product}
H^i(K^\bullet) \otimes_R H^j(L^\bullet)
\longrightarrow
H^{i + j}(K^\bullet \otimes_R^{\mathbf{L}} L^\bullet)
\end{equation}
Namely, to define these maps we may assume that one of $K^\bullet, L^\bullet$
is a K-flat complex of $R$-modules (for example a bounded
above complex of free or projective $R$-modules). In that case
$K^\bullet \otimes_R^{\mathbf{L}} L^\bullet$ is represented by the
complex $\text{Tot}(K^\bullet \otimes_R L^\bullet)$, see
Section \ref{section-derived-tensor-product} (or
Section \ref{section-computing-tor}).
Next, suppose that $\xi \in H^i(K^\bullet)$ and $\zeta \in H^j(L^\bullet)$.
Choose $k \in \Ker(K^i \to K^{i + 1})$ and
$l \in \Ker(L^j \to L^{j + 1})$ representing $\xi$ and $\zeta$.
Then we set
$$
\xi \cup \zeta =
\text{class of }k \otimes l\text{ in }
H^{i + j}(\text{Tot}(K^\bullet \otimes_R L^\bullet)).
$$
This make sense because the formula (see
Homology, Definition \ref{homology-definition-associated-simple-complex})
for the differential $\text{d}$ on the total complex shows that
$k \otimes l$ is a cocycle. Moreover, if $k' = d_K(k'')$ for some
$k'' \in K^{i - 1}$, then $k' \otimes l = \text{d}(k'' \otimes l)$
because $l$ is a cocycle. Similarly, altering the choice of $l$
representing $\zeta$ does not change the class of $k \otimes l$.
It is equally clear that $\cup$ is bilinear, and hence
to a general element of $H^i(K^\bullet) \otimes_R H^j(L^\bullet)$
we assign
$$
\sum \xi_i \otimes \zeta_i \longmapsto \sum \xi_i \cup \zeta_i
$$
in $H^{i + j}(\text{Tot}(K^\bullet \otimes_R L^\bullet))$.

\medskip\noindent
Let $R \to A$ be a ring map. Let $K^\bullet, L^\bullet \in D(R)$.
Then we have a canonical identification
\begin{equation}
\label{equation-pullback-derived-tensor-product}
(K^\bullet \otimes_R^{\mathbf{L}} A)
\otimes_A^{\mathbf{L}}
(L^\bullet \otimes_R^{\mathbf{L}} A)
=
(K^\bullet \otimes_R^{\mathbf{L}} L^\bullet) \otimes_R^{\mathbf{L}} A
\end{equation}
in $D(A)$. It is constructed as follows. First, choose K-flat resolutions
$P^\bullet \to K^\bullet$ and $Q^\bullet \to L^\bullet$
over $R$. Then the left hand side is represented by the complex
$\text{Tot}((P^\bullet \otimes_R A) \otimes_A (Q^\bullet \otimes_R A))$
and the right hand side by the complex
$\text{Tot}(P^\bullet \otimes_R Q^\bullet) \otimes_R A$. These
complexes are canonically isomorphic. Thus the construction above
induces products
$$
\text{Tor}^R_n(K^\bullet, A) \otimes_A \text{Tor}^R_m(L^\bullet, A)
\longrightarrow
\text{Tor}_{n + m}^R(K^\bullet \otimes_R^\mathbf{L} L^\bullet, A)
$$
which are occasionally useful.

\medskip\noindent
Let $M$, $N$ be $R$-modules. Using the general construction above,
the canonical map $M \otimes_R^\mathbf{L} N \to M \otimes_R N$ and
functoriality of $\text{Tor}$ we obtain canonical maps
\begin{equation}
\label{equation-tor-product}
\text{Tor}^R_n(M, A) \otimes_A \text{Tor}^R_m(N, A)
\longrightarrow \text{Tor}_{n + m}^R(M \otimes_R N, A)
\end{equation}
Here is a direct construction using projective resolutions. First, choose
projective resolutions
$$
P_\bullet \to M, \quad Q_\bullet \to N, \quad T_\bullet \to M \otimes_R N
$$
over $R$. We have
$H_0(\text{Tot}(P_\bullet \otimes_R Q_\bullet)) = M \otimes_R N$ by
right exactness of $\otimes_R$. Hence
Derived Categories, Lemmas \ref{derived-lemma-morphisms-lift-projective} and
\ref{derived-lemma-morphisms-equal-up-to-homotopy-projective}
guarantee the existence and uniqueness of a map of complexes
$\mu : \text{Tot}(P_\bullet \otimes_R Q_\bullet) \to T_\bullet$ such that
$H_0(\mu) = \text{id}_{M \otimes_R N}$. This induces a canonical map
\begin{align*}
(M \otimes_R^{\mathbf{L}} A) \otimes_A^{\mathbf{L}}
(N \otimes_R^{\mathbf{L}} A)
& =
\text{Tot}((P_\bullet \otimes_R A) \otimes_A (Q_\bullet \otimes_R A)) \\
& =
\text{Tot}(P_\bullet \otimes_R Q_\bullet) \otimes_R A \\
& \to
T_\bullet \otimes_R A \\
& = (M \otimes_R N) \otimes_R^{\mathbf{L}} A
\end{align*}
in $D(A)$. Hence the products (\ref{equation-tor-product}) above are
constructed using (\ref{equation-simple-tor-product}) over $A$ to construct
$$
\text{Tor}^R_n(M, A) \otimes_A \text{Tor}^R_m(N, A) \to
H^{-n-m}((M \otimes_R^{\mathbf{L}} A) \otimes_A^{\mathbf{L}}
(N \otimes_R^{\mathbf{L}} A))
$$
and then composing by the displayed map above to end up in
$\text{Tor}_{n + m}^R(M \otimes_R N, A)$.

\medskip\noindent
An interesting special case of the above occurs when $M = N = B$
where $B$ is an $R$-algebra. In this case we obtain maps
$$
\text{Tor}_n^R(B, A) \otimes_A \text{Tor}_m^R(B, A)
\longrightarrow
\text{Tor}_{n + m}^R(B \otimes_R B, A)
\longrightarrow
\text{Tor}_{n + m}^R(B, A)
$$
the second arrow being induced by the multiplication map
$B \otimes_R B \to B$ via functoriality for $\text{Tor}$.
In other words we obtain an $A$-algebra structure on
$\text{Tor}^R_{\star}(B, A)$. This algebra structure has many intriguing
properties (associativity, graded commutative, $B$-algebra structure,
divided powers in some case, etc) which we will discuss elsewhere (insert
future reference here).

\begin{lemma}
\label{lemma-functoriality-product-tor}
Let $R$ be a ring. Let $A, B, C$ be $R$-algebras and let $B \to C$ be an
$R$-algebra map. Then the induced map
$$
\text{Tor}^R_{\star}(B, A)
\longrightarrow
\text{Tor}^R_{\star}(C, A)
$$
is an $A$-algebra homomorphism.
\end{lemma}

\begin{proof}
Omitted. Hint: You can prove this by working through the definitions,
writing all the complexes explicitly.
\end{proof}










\section{Pseudo-coherent modules, I}
\label{section-pseudo-coherent}

\noindent
Suppose that $R$ is a ring. Recall that an $R$-module $M$ is of finite type
if there exists a surjection $R^{\oplus a} \to M$ and of finite presentation
if there exists a presentation
$R^{\oplus a_1} \to R^{\oplus a_0} \to M \to 0$.
Similarly, we can consider those $R$-modules for which there exists
a length $n$ resolution
\begin{equation}
\label{equation-pseudo-coherent}
R^{\oplus a_n} \to R^{\oplus a_{n - 1}} \to \ldots \to R^{\oplus a_0} \to
M \to 0
\end{equation}
by finite free $R$-modules. A module is called {\it pseudo-coherent}
if we can find such a resolution for every $n$. Here is the formal
definition.

\begin{definition}
\label{definition-pseudo-coherent}
Let $R$ be a ring. Denote $D(R)$ its derived category.
Let $m \in \mathbf{Z}$.
\begin{enumerate}
\item An object $K^\bullet$ of $D(R)$ is {\it $m$-pseudo-coherent}
if there exists a bounded complex $E^\bullet$ of finite free $R$-modules
and a morphism $\alpha : E^\bullet \to K^\bullet$ such that
$H^i(\alpha)$ is an isomorphism for $i > m$ and $H^m(\alpha)$
is surjective.
\item An object $K^\bullet$ of $D(R)$ is {\it pseudo-coherent}
if it is quasi-isomorphic to a bounded above complex of finite
free $R$-modules.
\item An $R$-module $M$ is called {\it $m$-pseudo-coherent}
if $M[0]$ is an $m$-pseudo-coherent object of $D(R)$.
\item An $R$-module $M$ is called
{\it pseudo-coherent}\footnote{This clashes with what is meant by
a pseudo-coherent module in \cite{Bourbaki-CA}.}
if $M[0]$ is a pseudo-coherent object of $D(R)$.
\end{enumerate}
\end{definition}

\noindent
As usual we apply this terminology also to complexes of $R$-modules.
Since any morphism $E^\bullet \to K^\bullet$ in $D(R)$ is represented
by an actual map of complexes, see
Derived Categories, Lemma \ref{derived-lemma-morphisms-from-projective-complex},
there is no ambiguity.
It turns out that $K^\bullet$ is pseudo-coherent if and only if
$K^\bullet$ is $m$-pseudo-coherent for all $m \in \mathbf{Z}$, see
Lemma \ref{lemma-pseudo-coherent}.
Also, if the ring is Noetherian the condition can be understood
as a finite generation condition on the cohomology, see
Lemma \ref{lemma-Noetherian-pseudo-coherent}.
Let us first relate this to the informal discussion above.

\begin{lemma}
\label{lemma-cone-pseudo-coherent}
Let $R$ be a ring and $m \in \mathbf{Z}$.
Let $(K^\bullet, L^\bullet, M^\bullet, f, g, h)$ be a distinguished
triangle in $D(R)$.
\begin{enumerate}
\item If $K^\bullet$ is $(m + 1)$-pseudo-coherent and
$L^\bullet$ is $m$-pseudo-coherent then $M^\bullet$ is
$m$-pseudo-coherent.
\item If $K^\bullet, M^\bullet$ are $m$-pseudo-coherent, then
$L^\bullet$ is $m$-pseudo-coherent.
\item If $L^\bullet$ is $(m + 1)$-pseudo-coherent and $M^\bullet$
is $m$-pseudo-coherent, then $K^\bullet$ is $(m + 1)$-pseudo-coherent.
\end{enumerate}
\end{lemma}

\begin{proof}
Proof of (1). Choose $\alpha : P^\bullet \to K^\bullet$
with $P^\bullet$ a bounded complex of finite free modules
such that $H^i(\alpha)$ is an isomorphism for $i > m + 1$ and
surjective for $i = m + 1$. We may replace $P^\bullet$ by
$\sigma_{\geq m + 1}P^\bullet$ and hence we may assume that $P^i = 0$
for $i < m + 1$. Choose $\beta : E^\bullet \to L^\bullet$ with $E^\bullet$
a bounded complex of finite free modules such that
$H^i(\beta)$ is an isomorphism for $i > m$ and
surjective for $i = m$. By
Derived Categories,
Lemma \ref{derived-lemma-lift-map}
we can find a map $\gamma : P^\bullet \to E^\bullet$ such that the diagram
$$
\xymatrix{
K^\bullet \ar[r] & L^\bullet \\
P^\bullet \ar[u] \ar[r]^\gamma & E^\bullet \ar[u]_\beta
}
$$
is commutative in $D(R)$. The cone $C(\gamma)^\bullet$ is a bounded
complex of finite free $R$-modules, and the commutativity of the
diagram implies that there exists a morphism of distinguished triangles
$$
(P^\bullet, E^\bullet, C(\gamma)^\bullet)
\longrightarrow
(K^\bullet, L^\bullet, M^\bullet).
$$
It follows from the induced map on long exact cohomology sequences and
Homology, Lemmas \ref{homology-lemma-four-lemma} and
\ref{homology-lemma-five-lemma}
that $C(\gamma)^\bullet \to M^\bullet$ induces an isomorphism
on cohomology in degrees $> m$ and a surjection in degree $m$.
Hence $M^\bullet$ is $m$-pseudo-coherent.

\medskip\noindent
Assertions (2) and (3) follow from (1) by rotating the distinguished
triangle.
\end{proof}

\begin{lemma}
\label{lemma-finite-cohomology}
Let $R$ be a ring. Let $K^\bullet$ be a complex of $R$-modules.
Let $m \in \mathbf{Z}$.
\begin{enumerate}
\item If $K^\bullet$ is $m$-pseudo-coherent and $H^i(K^\bullet) = 0$
for $i > m$, then $H^m(K^\bullet)$ is a finite type $R$-module.
\item If $K^\bullet$ is $m$-pseudo-coherent and $H^i(K^\bullet) = 0$
for $i > m + 1$, then $H^{m + 1}(K^\bullet)$ is a finitely presented
$R$-module.
\end{enumerate}
\end{lemma}

\begin{proof}
Proof of (1). Choose a bounded complex $E^\bullet$ of finite projective
$R$-modules and a map $\alpha : E^\bullet \to K^\bullet$ which induces
an isomorphism on cohomology in degrees $> m$ and a surjection in degree $m$.
It is clear that it suffices to prove the result for $E^\bullet$.
Let $n$ be the largest integer such that $E^n \not = 0$.
If $n = m$, then the result is clear.
If $n > m$, then $E^{n - 1} \to E^n$ is surjective as
$H^n(E^\bullet) = 0$. As $E^n$ is finite projective we see that
$E^{n - 1} = E' \oplus E^n$. Hence it suffices to prove the result
for the complex $(E')^\bullet$ which is the same as $E^\bullet$
except has $E'$ in degree $n - 1$ and $0$ in degree $n$.
We win by induction on $n$.

\medskip\noindent
Proof of (2). Choose a bounded complex $E^\bullet$ of finite projective
$R$-modules and a map $\alpha : E^\bullet \to K^\bullet$ which induces
an isomorphism on cohomology in degrees $> m$ and a surjection in degree $m$.
As in the proof of (1) we can reduce to the case that $E^i = 0$ for
$i > m + 1$. Then we see that
$H^{m + 1}(K^\bullet) \cong
H^{m + 1}(E^\bullet) = \Coker(E^m \to E^{m + 1})$
which is of finite presentation.
\end{proof}

\begin{lemma}
\label{lemma-n-pseudo-module}
Let $R$ be a ring. Let $M$ be an $R$-module.
Then
\begin{enumerate}
\item $M$ is $0$-pseudo-coherent if and only if $M$ is a finite
$R$-module,
\item $M$ is $(-1)$-pseudo-coherent if and only if $M$ is a finitely
presented $R$-module,
\item $M$ is $(-d)$-pseudo-coherent if and only if there exists a
resolution
$$
R^{\oplus a_d} \to R^{\oplus a_{d - 1}} \to \ldots \to R^{\oplus a_0} \to
M \to 0
$$
of length $d$, and
\item $M$ is pseudo-coherent if and only if there exists an
infinite resolution
$$
\ldots \to R^{\oplus a_1} \to R^{\oplus a_0} \to M \to 0
$$
by finite free $R$-modules.
\end{enumerate}
\end{lemma}

\begin{proof}
If $M$ is of finite type (resp.\ of finite presentation), then $M$
is $0$-pseudo-coherent (resp.\ $(-1)$-pseudo-coherent) as follows from the
discussion preceding
Definition \ref{definition-pseudo-coherent}.
Conversely, if $M$ is $0$-pseudo-coherent, then $M = H^0(M[0])$
is of finite type by
Lemma \ref{lemma-finite-cohomology}.
If $M$ is $(-1)$-pseudo-coherent, then it is $0$-pseudo-coherent hence
of finite type. Choose a surjection $R^{\oplus a} \to M$ and denote
$K = \Ker(R^{\oplus a} \to M)$. By
Lemma \ref{lemma-cone-pseudo-coherent}
we see that $K$ is $0$-pseudo-coherent, hence of finite type, whence
$M$ is of finite presentation.

\medskip\noindent
To prove the third and fourth statement use
induction and an argument similar to the above (details omitted).
\end{proof}

\begin{lemma}
\label{lemma-pseudo-coherent}
Let $R$ be a ring. Let $K^\bullet$ be a complex of $R$-modules.
The following are equivalent
\begin{enumerate}
\item $K^\bullet$ is pseudo-coherent,
\item $K^\bullet$ is $m$-pseudo-coherent for every $m \in \mathbf{Z}$, and
\item $K^\bullet$ is quasi-isomorphic to a bounded above complex of finite
projective $R$-modules.
\end{enumerate}
If (1), (2), and (3) hold and $H^i(K^\bullet) = 0$ for $i > b$, then
we can find a quasi-isomorphism $F^\bullet \to K^\bullet$ with
$F^i$ finite free $R$-modules and $F^i = 0$ for $i > b$.
\end{lemma}

\begin{proof}
We see that (1) $\Rightarrow$ (3) as a finite free module is a finite
projective $R$-module. Conversely, suppose $P^\bullet$ is a bounded
above complex of finite projective $R$-modules. Say $P^i = 0$ for
$i > n_0$. We choose a direct sum decompositions
$F^{n_0} = P^{n_0} \oplus C^{n_0}$ with $F^{n_0}$ a finite free
$R$-module, and inductively
$$
F^{n - 1} = P^{n - 1} \oplus C^n \oplus C^{n - 1}
$$
for $n \leq n_0$ with $F^{n_0}$ a finite free $R$-module. As a complex
$F^\bullet$ has maps $F^{n - 1} \to F^n$ which agree with $P^{n - 1} \to P^n$,
induce the identity $C^n \to C^n$, and are zero on $C^{n - 1}$. The map
$F^\bullet \to P^\bullet$ is a quasi-isomorphism (even a homotopy equivalence)
and hence (3) implies (1).

\medskip\noindent
Assume (1). Let $E^\bullet$ be a bounded above complex of finite free
$R$-modules and let $E^\bullet \to K^\bullet$ be a
quasi-isomorphism. Then the induced maps
$\sigma_{\geq m}E^\bullet \to K^\bullet$ from the stupid truncation
of $E^\bullet$ to $K^\bullet$ show that $K^\bullet$ is $m$-pseudo-coherent.
Hence (1) implies (2).

\medskip\noindent
Assume (2). Since $K^\bullet$ is $0$-pseudo-coherent we see in particular
that $K^\bullet$ is bounded above. Let $b$ be an integer such that
$H^i(K^\bullet) = 0$ for $i > b$. By descending induction on
$n \in \mathbf{Z}$ we are going to construct finite free $R$-modules
$F^i$ for $i \geq n$, differentials $d^i : F^i \to F^{i + 1}$ for
$i \geq n$, maps $\alpha : F^i \to K^i$ compatible with differentials,
such that (1) $H^i(\alpha)$ is an isomorphism for $i > n$ and surjective for
$i = n$, and (2) $F^i = 0$ for $i > b$. Picture
$$
\xymatrix{
& F^n \ar[r] \ar[d]^\alpha & F^{n + 1} \ar[d]^\alpha \ar[r] & \ldots \\
K^{n - 1} \ar[r] & K^n \ar[r] & K^{n + 1} \ar[r] & \ldots
}
$$
The base case is $n = b + 1$ where we can take $F^i = 0$ for all $i$.
Induction step. Let $C^\bullet$ be the cone on $\alpha$
(Derived Categories, Definition \ref{derived-definition-cone}).
The long exact sequence
of cohomology shows that $H^i(C^\bullet) = 0$ for $i \geq n$.
By Lemma \ref{lemma-cone-pseudo-coherent} we see that $C^\bullet$
is $(n - 1)$-pseudo-coherent. By Lemma \ref{lemma-finite-cohomology}
we see that $H^{n - 1}(C^\bullet)$ is a finite $R$-module.
Choose a finite free $R$-module $F^{n - 1}$ and a map
$\beta : F^{n - 1} \to C^{n - 1}$ such that the composition
$F^{n - 1} \to C^{n - 1} \to C^n$ is zero and such that $F^{n - 1}$
surjects onto $H^{n - 1}(C^\bullet)$. Since $C^{n - 1} = K^{n - 1} \oplus F^n$
we can write $\beta = (\alpha^{n - 1}, -d^{n - 1})$. The vanishing of the
composition $F^{n - 1} \to C^{n - 1} \to C^n$ implies
these maps fit into a morphism of complexes
$$
\xymatrix{
& F^{n - 1} \ar[d]^{\alpha^{n - 1}} \ar[r]_{d^{n - 1}} &
F^n \ar[r] \ar[d]^\alpha &
F^{n + 1} \ar[d]^\alpha \ar[r] & \ldots \\
\ldots \ar[r] &
K^{n - 1} \ar[r] & K^n \ar[r] & K^{n + 1} \ar[r] & \ldots
}
$$
Moreover, these maps define a morphism of distinguished triangles
$$
\xymatrix{
(F^n \to \ldots) \ar[r] \ar[d] &
(F^{n - 1} \to \ldots) \ar[r] \ar[d] &
F^{n - 1} \ar[r] \ar[d]_\beta &
(F^n \to \ldots)[1] \ar[d] \\
(F^n \to \ldots) \ar[r] &
K^\bullet \ar[r] &
C^\bullet \ar[r] &
(F^n \to \ldots)[1]
}
$$
Hence our choice of $\beta$ implies that the map of complexes
$(F^{n - 1} \to \ldots) \to K^\bullet$ induces an isomorphism on
cohomology in degrees $\geq n$ and a surjection in degree $n - 1$.
This finishes the proof of the lemma.
\end{proof}

\begin{lemma}
\label{lemma-two-out-of-three-pseudo-coherent}
Let $R$ be a ring. Let $(K^\bullet, L^\bullet, M^\bullet, f, g, h)$
be a distinguished triangle in $D(R)$. If two out of three of
$K^\bullet, L^\bullet, M^\bullet$ are
pseudo-coherent then the third is also pseudo-coherent.
\end{lemma}

\begin{proof}
Combine
Lemmas \ref{lemma-cone-pseudo-coherent} and \ref{lemma-pseudo-coherent}.
\end{proof}

\begin{lemma}
\label{lemma-recognize-pseudo-coherent}
Let $R$ be a ring. Let $K^\bullet$ be a complex of $R$-modules.
Let $m \in \mathbf{Z}$.
\begin{enumerate}
\item If $H^i(K^\bullet) = 0$ for all $i \geq m$, then
$K^\bullet$ is $m$-pseudo-coherent.
\item If $H^i(K^\bullet) = 0$ for $i > m$ and $H^m(K^\bullet)$ is
a finite $R$-module, then $K^\bullet$ is $m$-pseudo-coherent.
\item If $H^i(K^\bullet) = 0$ for $i > m + 1$, the module
$H^{m + 1}(K^\bullet)$ is of finite presentation, and
$H^m(K^\bullet)$ is of finite type, then $K^\bullet$ is
$m$-pseudo-coherent.
\end{enumerate}
\end{lemma}

\begin{proof}
It suffices to prove (3). Set $M = H^{m + 1}(K^\bullet)$.
Note that $\tau_{\geq m + 1}K^\bullet$ is quasi-isomorphic to
$M[- m - 1]$. By
Lemma \ref{lemma-n-pseudo-module}
we see that $M[- m - 1]$ is $m$-pseudo-coherent. Since we have
the distinguished triangle
$$
(\tau_{\leq m}K^\bullet, K^\bullet, \tau_{\geq m + 1}K^\bullet)
$$
(Derived Categories, Remark
\ref{derived-remark-truncation-distinguished-triangle}) by
Lemma \ref{lemma-cone-pseudo-coherent}
it suffices to prove that $\tau_{\leq m}K^\bullet$ is pseudo-coherent.
By assumption $H^m(\tau_{\leq m}K^\bullet)$ is a finite type $R$-module.
Hence we can find a finite free $R$-module $E$ and a map
$E \to \Ker(d_K^m)$ such that the composition
$E \to \Ker(d_K^m) \to H^m(\tau_{\leq m}K^\bullet)$ is surjective.
Then $E[-m] \to \tau_{\leq m}K^\bullet$ witnesses the fact
that $\tau_{\leq m}K^\bullet$ is $m$-pseudo-coherent.
\end{proof}

\begin{lemma}
\label{lemma-summands-pseudo-coherent}
Let $R$ be a ring. Let $m \in \mathbf{Z}$. If $K^\bullet \oplus L^\bullet$
is $m$-pseudo-coherent (resp.\ pseudo-coherent)
so are $K^\bullet$ and $L^\bullet$.
\end{lemma}

\begin{proof}
In this proof we drop the superscript ${}^\bullet$.
Assume that $K \oplus L$ is $m$-pseudo-coherent.
It is clear that $K, L \in D^{-}(R)$.
Note that there is a distinguished triangle
$$
(K \oplus L, K \oplus L, L \oplus L[1]) =
(K, K, 0) \oplus (L, L, L \oplus L[1])
$$
see
Derived Categories, Lemma \ref{derived-lemma-direct-sum-triangles}.
By
Lemma \ref{lemma-cone-pseudo-coherent}
we see that $L \oplus L[1]$ is $m$-pseudo-coherent.
Hence also $L[1] \oplus L[2]$ is $m$-pseudo-coherent.
By induction $L[n] \oplus L[n + 1]$ is $m$-pseudo-coherent.
By
Lemma \ref{lemma-recognize-pseudo-coherent}
we see that $L[n]$ is $m$-pseudo-coherent for large $n$.
Hence working backwards, using the distinguished triangles
$$
(L[n], L[n] \oplus L[n - 1], L[n - 1])
$$
we conclude that $L[n], L[n - 1], \ldots, L$ are $m$-pseudo-coherent
as desired. The pseudo-coherent case follows from this and
Lemma \ref{lemma-pseudo-coherent}.
\end{proof}

\begin{lemma}
\label{lemma-complex-pseudo-coherent-modules}
Let $R$ be a ring. Let $m \in \mathbf{Z}$. Let $K^\bullet$ be a bounded
above complex of $R$-modules such that $K^i$ is $(m - i)$-pseudo-coherent
for all $i$. Then $K^\bullet$ is $m$-pseudo-coherent.
In particular, if $K^\bullet$ is a bounded above complex of
pseudo-coherent $R$-modules, then $K^\bullet$ is pseudo-coherent.
\end{lemma}

\begin{proof}
We may replace $K^\bullet$ by $\sigma_{\geq m - 1}K^\bullet$ (for example) and
hence assume that $K^\bullet$ is bounded.
Then the complex $K^\bullet$ is $m$-pseudo-coherent as each
$K^i[-i]$ is $m$-pseudo-coherent by induction on the length of the
complex: use Lemma \ref{lemma-cone-pseudo-coherent}
and the stupid truncations.
For the final statement, it suffices to prove that
$K^\bullet$ is $m$-pseudo-coherent for all $m \in \mathbf{Z}$, see
Lemma \ref{lemma-pseudo-coherent}.
This follows from the first part.
\end{proof}

\begin{lemma}
\label{lemma-cohomology-pseudo-coherent}
Let $R$ be a ring. Let $m \in \mathbf{Z}$.
Let $K^\bullet \in D^{-}(R)$ such that $H^i(K^\bullet)$ is
$(m - i)$-pseudo-coherent (resp.\ pseudo-coherent) for all $i$.
Then $K^\bullet$ is $m$-pseudo-coherent (resp.\ pseudo-coherent).
\end{lemma}

\begin{proof}
Assume $K^\bullet$ is an object of $D^{-}(R)$ such that
each $H^i(K^\bullet)$ is $(m - i)$-pseudo-coherent.
Let $n$ be the largest integer such that $H^n(K^\bullet)$ is nonzero.
We will prove the lemma by induction on $n$.
If $n < m$, then $K^\bullet$ is $m$-pseudo-coherent by
Lemma \ref{lemma-recognize-pseudo-coherent}.
If $n \geq m$, then we have the distinguished triangle
$$
(\tau_{\leq n - 1}K^\bullet, K^\bullet, H^n(K^\bullet)[-n])
$$
(Derived Categories, Remark
\ref{derived-remark-truncation-distinguished-triangle})
Since $H^n(K^\bullet)[-n]$ is $m$-pseudo-coherent by assumption, we
can use
Lemma \ref{lemma-cone-pseudo-coherent}
to see that it suffices to prove that $\tau_{\leq n - 1}K^\bullet$
is $m$-pseudo-coherent. By induction on $n$ we win. (The pseudo-coherent
case follows from this and
Lemma \ref{lemma-pseudo-coherent}.)
\end{proof}

\begin{lemma}
\label{lemma-finite-push-pseudo-coherent}
Let $A \to B$ be a ring map. Assume that $B$ is pseudo-coherent as an
$A$-module. Let $K^\bullet$ be a complex of $B$-modules.
The following are equivalent
\begin{enumerate}
\item $K^\bullet$ is $m$-pseudo-coherent
as a complex of $B$-modules, and
\item $K^\bullet$ is $m$-pseudo-coherent
as a complex of $A$-modules.
\end{enumerate}
The same equivalence holds for pseudo-coherence.
\end{lemma}

\begin{proof}
Assume (1). Choose a bounded complex of finite free $B$-modules
$E^\bullet$ and a map $\alpha : E^\bullet \to K^\bullet$ which is
an isomorphism on cohomology in degrees $> m$ and a surjection in degree $m$.
Consider the distinguished triangle
$(E^\bullet, K^\bullet, C(\alpha)^\bullet)$. By
Lemma \ref{lemma-recognize-pseudo-coherent}
$C(\alpha)^\bullet$ is $m$-pseudo-coherent as a complex of
$A$-modules. Hence it suffices to prove that $E^\bullet$ is
pseudo-coherent as a complex of $A$-modules, which follows from
Lemma \ref{lemma-complex-pseudo-coherent-modules}.
The pseudo-coherent case of (1) $\Rightarrow$ (2) follows from this and
Lemma \ref{lemma-pseudo-coherent}.

\medskip\noindent
Assume (2). Let $n$ be the largest integer such that $H^n(K^\bullet) \not = 0$.
We will prove that $K^\bullet$ is $m$-pseudo-coherent as a complex
of $B$-modules by induction on $n - m$. The case $n < m$ follows from
Lemma \ref{lemma-recognize-pseudo-coherent}.
Choose a bounded complex of finite free $A$-modules $E^\bullet$ and a
map $\alpha : E^\bullet \to K^\bullet$ which is an isomorphism on
cohomology in degrees $> m$ and a surjection in degree $m$.
Consider the induced map of complexes
$$
\alpha \otimes 1 : E^\bullet \otimes_A B \to K^\bullet.
$$
Note that $C(\alpha \otimes 1)^\bullet$ is acyclic in degrees
$\geq n$ as $H^n(E) \to H^n(E^\bullet \otimes_A B) \to H^n(K^\bullet)$
is surjective by construction and since $H^i(E^\bullet \otimes_A B) = 0$
for $i > n$ by the spectral sequence of
Example \ref{example-tor}.
On the other hand, $C(\alpha \otimes 1)^\bullet$
is $m$-pseudo-coherent as a complex of $A$-modules because
both $K^\bullet$ and $E^\bullet \otimes_A B$ (see
Lemma \ref{lemma-complex-pseudo-coherent-modules})
are so, see
Lemma \ref{lemma-cone-pseudo-coherent}.
Hence by induction we see that $C(\alpha \otimes 1)^\bullet$
is $m$-pseudo-coherent as a complex of $B$-modules. Finally
another application of
Lemma \ref{lemma-cone-pseudo-coherent}
shows that $K^\bullet$ is $m$-pseudo-coherent as a complex of $B$-modules
(as clearly $E^\bullet \otimes_A B$ is pseudo-coherent as a complex
of $B$-modules). The pseudo-coherent case
of (2) $\Rightarrow$ (1) follows from this and
Lemma \ref{lemma-pseudo-coherent}.
\end{proof}

\begin{lemma}
\label{lemma-pull-pseudo-coherent}
Let $A \to B$ be a ring map.
Let $K^\bullet$ be an $m$-pseudo-coherent (resp.\ pseudo-coherent)
complex of $A$-modules. Then $K^\bullet \otimes_A^{\mathbf{L}} B$
is an $m$-pseudo-coherent (resp.\ pseudo-coherent) complex of $B$-modules.
\end{lemma}

\begin{proof}
First we note that the statement of the lemma makes sense as
$K^\bullet$ is bounded above and hence $K^\bullet \otimes_A^{\mathbf{L}} B$
is defined by Equation (\ref{equation-derived-tensor-algebra}).
Having said this, choose a bounded complex $E^\bullet$
of finite free $A$-modules and $\alpha : E^\bullet \to K^\bullet$
with $H^i(\alpha)$ an isomorphism for $i > m$ and surjective for
$i = m$. Then the cone $C(\alpha)^\bullet$ is acyclic in degrees
$\geq m$. Since $-\otimes_A^{\mathbf{L}} B$ is an exact functor
we get a distinguished triangle
$$
(E^\bullet \otimes_A^{\mathbf{L}} B, K^\bullet \otimes_A^{\mathbf{L}} B,
C(\alpha)^\bullet \otimes_A^{\mathbf{L}} B)
$$
of complexes of $B$-modules. By the dual to
Derived Categories, Lemma \ref{derived-lemma-negative-vanishing}
we see that $H^i(C(\alpha)^\bullet \otimes_A^{\mathbf{L}} B) = 0$
for $i \geq m$. Since $E^\bullet$ is a complex of projective $R$-modules
we see that $E^\bullet \otimes_A^{\mathbf{L}} B = E^\bullet \otimes_A B$
and hence
$$
E^\bullet \otimes_A B
\longrightarrow
K^\bullet \otimes_A^{\mathbf{L}} B
$$
is a morphism of complexes of $B$-modules that witnesses the
fact that $K^\bullet \otimes_A^{\mathbf{L}} B$ is $m$-pseudo-coherent.
The case of pseudo-coherent complexes follows from the case
of $m$-pseudo-coherent complexes via
Lemma \ref{lemma-pseudo-coherent}.
\end{proof}

\begin{lemma}
\label{lemma-flat-base-change-pseudo-coherent}
Let $A \to B$ be a flat ring map.
Let $M$ be an $m$-pseudo-coherent (resp.\ pseudo-coherent)
$A$-module. Then $M \otimes_A B$
is an $m$-pseudo-coherent (resp.\ pseudo-coherent) $B$-module.
\end{lemma}

\begin{proof}
Immediate consequence of
Lemma \ref{lemma-pull-pseudo-coherent}
and the fact that $M \otimes_A^{\mathbf{L}} B = M \otimes_A B$
because $B$ is flat over $A$.
\end{proof}

\noindent
The following lemma also follows from the stronger
Lemma \ref{lemma-flat-descent-pseudo-coherent}.

\begin{lemma}
\label{lemma-glue-pseudo-coherent}
Let $R$ be a ring. Let $f_1, \ldots, f_r \in R$ be elements which
generate the unit ideal. Let $m \in \mathbf{Z}$. Let $K^\bullet$
be a complex of $R$-modules. If for each $i$ the complex
$K^\bullet \otimes_R R_{f_i}$ is $m$-pseudo-coherent
(resp.\ pseudo-coherent), then $K^\bullet$ is $m$-pseudo-coherent
(resp.\ pseudo-coherent).
\end{lemma}

\begin{proof}
We will use without further mention that $- \otimes_R R_{f_i}$ is
an exact functor and that therefore
$$
H^i(K^\bullet)_{f_i} =
H^i(K^\bullet) \otimes_R R_{f_i} = H^i(K^\bullet \otimes_R R_{f_i}).
$$
Assume $K^\bullet \otimes_R R_{f_i}$ is $m$-pseudo-coherent
for $i = 1, \ldots, r$. Let $n \in \mathbf{Z}$ be the largest
integer such that $H^n(K^\bullet \otimes_R R_{f_i})$ is nonzero
for some $i$. This implies in particular that $H^i(K^\bullet) = 0$
for $i > n$ (and that $H^n(K^\bullet) \not = 0$) see
Algebra, Lemma \ref{algebra-lemma-cover}.
We will prove the lemma by induction on $n - m$.
If $n < m$, then the lemma is true by
Lemma \ref{lemma-recognize-pseudo-coherent}.
If $n \geq m$, then $H^n(K^\bullet)_{f_i}$ is a finite $R_{f_i}$-module
for each $i$, see
Lemma \ref{lemma-finite-cohomology}.
Hence $H^n(K^\bullet)$ is a finite $R$-module, see
Algebra, Lemma \ref{algebra-lemma-cover}.
Choose a finite free $R$-module $E$ and a surjection $E \to H^n(K^\bullet)$.
As $E$ is projective we can lift this to a map of complexes
$\alpha : E[-n] \to K^\bullet$. Then the cone $C(\alpha)^\bullet$ has
vanishing cohomology in degrees $\geq n$. On the other hand, the
complexes $C(\alpha)^\bullet \otimes_R R_{f_i}$ are $m$-pseudo-coherent
for each $i$, see
Lemma \ref{lemma-cone-pseudo-coherent}.
Hence by induction we see that $C(\alpha)^\bullet$ is $m$-pseudo-coherent
as a complex of $R$-modules. Applying
Lemma \ref{lemma-cone-pseudo-coherent}
once more we conclude.
\end{proof}

\begin{lemma}
\label{lemma-flat-descent-pseudo-coherent}
Let $R$ be a ring. Let $m \in \mathbf{Z}$. Let $K^\bullet$
be a complex of $R$-modules. Let $R \to R'$ be a faithfully flat
ring map. If the complex $K^\bullet \otimes_R R'$ is $m$-pseudo-coherent
(resp.\ pseudo-coherent), then $K^\bullet$ is $m$-pseudo-coherent
(resp.\ pseudo-coherent).
\end{lemma}

\begin{proof}
We will use without further mention that $- \otimes_R R'$ is
an exact functor and that therefore
$$
H^i(K^\bullet) \otimes_R R' = H^i(K^\bullet \otimes_R R').
$$
Assume $K^\bullet \otimes_R R'$ is $m$-pseudo-coherent.
Let $n \in \mathbf{Z}$ be the largest integer such that
$H^n(K^\bullet)$ is nonzero; then $n$ is also the largest integer
such that $H^n(K^\bullet \otimes_R R')$ is nonzero.
We will prove the lemma by induction on $n - m$.
If $n < m$, then the lemma is true by
Lemma \ref{lemma-recognize-pseudo-coherent}.
If $n \geq m$, then $H^n(K^\bullet) \otimes_R R'$ is a finite
$R'$-module, see
Lemma \ref{lemma-finite-cohomology}.
Hence $H^n(K^\bullet)$ is a finite $R$-module, see
Algebra, Lemma \ref{algebra-lemma-descend-properties-modules}.
Choose a finite free $R$-module $E$ and a surjection $E \to H^n(K^\bullet)$.
As $E$ is projective we can lift this to a map of complexes
$\alpha : E[-n] \to K^\bullet$. Then the cone $C(\alpha)^\bullet$ has
vanishing cohomology in degrees $\geq n$. On the other hand, the
complex $C(\alpha)^\bullet \otimes_R R'$ is $m$-pseudo-coherent, see
Lemma \ref{lemma-cone-pseudo-coherent}.
Hence by induction we see that $C(\alpha)^\bullet$ is $m$-pseudo-coherent
as a complex of $R$-modules. Applying
Lemma \ref{lemma-cone-pseudo-coherent}
once more we conclude.
\end{proof}

\begin{lemma}
\label{lemma-tensor-pseudo-coherent}
Let $R$ be a ring. Let $K, L$ be objects of $D(R)$.
\begin{enumerate}
\item If $K$ is $n$-pseudo-coherent and $H^i(K) = 0$ for $i > a$
and $L$ is $m$-pseudo-coherent and $H^j(L) = 0$ for $j > b$, then
$K \otimes_R^\mathbf{L} L$ is $t$-pseudo-coherent with $t = \max(m + a, n + b)$.
\item If $K$ and $L$ are pseudo-coherent, then
$K \otimes_R^\mathbf{L} L$ is pseudo-coherent.
\end{enumerate}
\end{lemma}

\begin{proof}
Proof of (1). We may assume there exist bounded complexes $K^\bullet$
and $L^\bullet$ of finite free $R$-modules and maps
$\alpha : K^\bullet \to K$ and $\beta : L^\bullet \to L$ with
$H^i(\alpha)$ and isomorphism for $i > n$ and surjective for $i = n$ and with
$H^i(\beta)$ and isomorphism for $i > m$ and surjective for $i = m$.
Then the map
$$
\alpha \otimes^\mathbf{L} \beta :
\text{Tot}(K^\bullet \otimes_R L^\bullet)
\to K \otimes_R^\mathbf{L} L
$$
induces isomorphisms on cohomology in degree $i$ for
$i > t$ and a surjection for $i = t$. This follows from the
spectral sequence of tors (details omitted). Part (2) follows
from part (1) and Lemma \ref{lemma-pseudo-coherent}.
\end{proof}

\begin{lemma}
\label{lemma-Noetherian-pseudo-coherent}
Let $R$ be a Noetherian ring. Then
\begin{enumerate}
\item A complex of $R$-modules $K^\bullet$ is $m$-pseudo-coherent
if and only if $K^\bullet \in D^{-}(R)$ and
$H^i(K^\bullet)$ is a finite $R$-module for $i \geq m$.
\item A complex of $R$-modules $K^\bullet$ is pseudo-coherent
if and only if $K^\bullet \in D^{-}(R)$ and
$H^i(K^\bullet)$ is a finite $R$-module for all $i$.
\item An $R$-module is pseudo-coherent if and only if it is finite.
\end{enumerate}
\end{lemma}

\begin{proof}
In
Algebra, Lemma \ref{algebra-lemma-resolution-by-finite-free}
we have seen that any finite $R$-module is pseudo-coherent.
On the other hand, a pseudo-coherent module is finite, see
Lemma \ref{lemma-n-pseudo-module}.
Hence (3) holds. Suppose that $K^\bullet$ is an $m$-pseudo-coherent complex.
Then there exists a bounded complex of finite free $R$-modules $E^\bullet$
such that $H^i(K^\bullet)$ is isomorphic to $H^i(E^\bullet)$ for
$i > m$ and such that $H^m(K^\bullet)$ is a quotient of $H^m(E^\bullet)$.
Thus it is clear that each $H^i(K^\bullet)$, $i \geq m$ is a finite module.
The converse implication in (1) follows from
Lemma \ref{lemma-cohomology-pseudo-coherent}
and part (3).
Part (2) follows from (1) and
Lemma \ref{lemma-pseudo-coherent}.
\end{proof}

\begin{lemma}
\label{lemma-coherent-pseudo-coherent}
Let $R$ be a coherent ring
(Algebra, Definition \ref{algebra-definition-coherent}).
Let $K \in D^-(R)$. The following are equivalent
\begin{enumerate}
\item $K$ is $m$-pseudo-coherent,
\item $H^m(K)$ is a finite $R$-module and $H^i(K)$ is coherent for $i > m$, and
\item $H^m(K)$ is a finite $R$-module and
$H^i(K)$ is finitely presented for $i > m$.
\end{enumerate}
Thus $K$ is pseudo-coherent if and only if $H^i(K)$
is a coherent module for all $i$.
\end{lemma}

\begin{proof}
Recall that an $R$-module $M$ is coherent if and only if it is of finite
presentation (Algebra, Lemma \ref{algebra-lemma-coherent-ring}).
This explains the equivalence of (2) and (3). If so and if we choose an exact
sequence $0 \to N \to R^{\oplus m} \to M \to 0$, then $N$ is coherent by
Algebra, Lemma \ref{algebra-lemma-coherent}. Thus in this case, repeating
this procedure with $N$ we find a resolution
$$
\ldots \to R^{\oplus n} \to R^{\oplus m} \to M \to 0
$$
by finite free $R$-modules. In other words, $M$ is pseudo-coherent.
The equivalence of (1) and (2) follows from this and
Lemmas \ref{lemma-cohomology-pseudo-coherent} and
\ref{lemma-n-pseudo-module}.
The final assertion follows from the equivalence of (1) and (2)
combined with Lemma \ref{lemma-pseudo-coherent}.
\end{proof}









\section{Pseudo-coherent modules, II}
\label{section-pseudo-coherent-bis}

\noindent
We continue the discussion started in Section \ref{section-pseudo-coherent}.

\begin{lemma}
\label{lemma-pseudo-coherence-colimit-ext}
Let $R$ be a ring. Let $M = \colim M_i$ be a filtered colimit of $R$-modules.
Let $K \in D(R)$ be $m$-pseudo-coherent. Then
$\colim \Ext^n_R(K, M_i) = \Ext^n_R(K, M)$ for $n < -m$ and
$\colim \Ext^{-m}_R(K, M_i) \to \Ext^{-m}_R(K, M)$ is injective.
\end{lemma}

\begin{proof}
By definition we can find a distinguished triangle
$$
E \to K \to L \to E[1]
$$
in $D(R)$ such that $E$ is represented by a bounded complex of finite free
$R$-modules and such that $H^i(L) = 0$ for $i \geq m$. Then
$\Ext^n_R(L, N) = 0$ for any $R$-module $N$ and $n \leq -m$, see
Derived Categories, Lemma \ref{derived-lemma-negative-exts}.
By the long exact sequence of $\Ext$ associated to the distinguished
triangle we see that $\Ext^n_R(K, N) \to \Ext^n_R(E, N)$ is an isomorphism
for $n < -m$ and injective for $n = -m$. Thus it suffices to prove that
$M \mapsto \Ext_R^n(E, M)$ commutes with filtered colimits
when $E$ can be represented by a bounded complex of finite free $R$-modules
$E^\bullet$. The modules $\Ext^n_R(E, M)$ are computed by
the complex $\Hom_R(E^\bullet, M)$, see Derived Categories, Lemma
\ref{derived-lemma-morphisms-from-projective-complex}.
The functor $M \mapsto \Hom_R(E^p, M)$ commutes with filtered colimits
as $E^p$ is finite free. Thus
$\Hom_R(E^\bullet, M) = \colim \Hom_R(E^\bullet, M_i)$ as complexes.
Since filtered colimits are exact (Algebra, Lemma
\ref{algebra-lemma-directed-colimit-exact}) we conclude.
\end{proof}

\begin{lemma}
\label{lemma-characterize-pseudo-coherent-colimit-ext}
Let $R$ be a ring. Let $K \in D^-(R)$. Let $m \in \mathbf{Z}$.
Then $K$ is $m$-pseudo-coherent if and only if
for any filtered colimit $M = \colim M_i$ of $R$-modules we have
$\colim \Ext^n_R(K, M_i) = \Ext^n_R(K, M)$ for $n < -m$ and
$\colim \Ext^{-m}_R(K, M_i) \to \Ext^{-m}_R(K, M)$ is injective.
\end{lemma}

\begin{proof}
One implication was shown in Lemma \ref{lemma-pseudo-coherence-colimit-ext}.
Assume for any filtered colimit $M = \colim M_i$ of $R$-modules we have
$\colim \Ext^n_R(K, M_i) = \Ext^n_R(K, M)$ for $n < -m$ and
$\colim \Ext^{-m}_R(K, M_i) \to \Ext^{-m}_R(K, M)$ is injective.
We will show $K$ is $m$-pseudo-coherent.

\medskip\noindent
Let $t$ be the maximal integer such that $H^t(K)$ is nonzero.
We will use induction on $t$. If $t < m$, then $K$ is $m$-pseudo-coherent
by Lemma \ref{lemma-recognize-pseudo-coherent}.
If $t \geq m$, then since $\Hom_R(H^t(K), M) = \Ext^{-t}_R(K, M)$
we conclude that $\colim \Hom_R(H^t(K), M_i) \to \Hom_R(H^t(K), M)$
is injective for any filtered colimit $M = \colim M_i$.
This implies that $H^t(K)$ is a finite $R$-module by Algebra,
Lemma \ref{algebra-lemma-characterize-finite-module-hom}.
Choose a finite free $R$-module $F$ and a surjection
$F \to H^t(K)$. We can lift this to a morphism $F[-t] \to K$
in $D(R)$ and choose a distinguished triangle
$$
F[-t] \to K \to L \to F[-t + 1]
$$
in $D(R)$. Then $H^i(L) = 0$ for $i \geq t$. Moreover, the long
exact sequence of $\Ext$ associated to this distinguished triangle
shows that $L$ inherts the assumption we made on $K$ by a small
argument we omit. By induction on $t$ we conclude that
$L$ is $m$-pseudo-coherent. Hence $K$ is $m$-pseudo-coherent
by Lemma \ref{lemma-cone-pseudo-coherent}.
\end{proof}

\begin{lemma}
\label{lemma-pseudo-coherence-and-ext}
Let $R$ be a ring. Let $L$, $M$, $N$ be $R$-modules.
\begin{enumerate}
\item If $M$ is finitely presented and $L$ is flat, then the canonical map
$\Hom_R(M, N) \otimes_R L \to \Hom_R(M, N \otimes_R L)$
is an isomorphism.
\item If $M$ is $(-m)$-pseudo-coherent and $L$ is flat, then the canonical map
$\Ext^i_R(M, N) \otimes_R L \to \Ext^i_R(M, N \otimes_R L)$
is an isomorphism for $i < m$.
\end{enumerate}
\end{lemma}

\begin{proof}
Choose a resolution $F_\bullet \to M$ whose terms are free $R$-modules, see
Algebra, Lemma \ref{algebra-lemma-resolution-by-finite-free}. The complex
$\Hom_R(F_\bullet, N)$ computes $\Ext^i_R(M, N)$ and the complex
$\Hom_R(F_\bullet, N \otimes_R L)$ computes $\Ext^i_R(M, N \otimes_R L)$.
There always is a map of cochain complexes
$$
\Hom_R(F_\bullet, N) \otimes_R L
\longrightarrow
\Hom_R(F_\bullet, N \otimes_R L)
$$
which induces canonical maps
$\Ext^i_R(M, N) \otimes_R L \to \Ext^i_R(M, N \otimes_R L)$
for all $i \geq 0$ (canonical for example in the sense that these maps
do not depend on the choice of the resolution $F_\bullet$).
If $L$ is flat, then the complex $\Hom_R(F_\bullet, N) \otimes_R L$
computes $\Ext^i_R(M, N) \otimes_R L$ since taking cohomology commutes
with tensoring by $L$.

\medskip\noindent
Having said all of the above, if $M$ is $(-m)$-pseudo-coherent, then we
may choose $F_\bullet$ such that $F_i$ is finite free for $i = 0, \ldots, m$.
Then the map of cochain complexes displayed above is an isomorphism in degrees
$\leq m$ and hence an isomorphism on cohomology groups in degrees
$< m$. This proves (2). If $M$ is finitely presented, then $M$ is
$(-1)$-pseudo-coherent by Lemma \ref{lemma-n-pseudo-module}
and we get the result because $\Hom = \Ext^0$.
\end{proof}

\begin{lemma}
\label{lemma-pseudo-coherence-and-base-change-ext}
Let $R \to R'$ be a flat ring map. Let $M$, $N$ be $R$-modules.
\begin{enumerate}
\item If $M$ is a finitely presented $R$-module, then
$\Hom_R(M, N) \otimes_R R' = \Hom_{R'}(M \otimes_R R', N \otimes_R R')$.
\item If $M$ is $(-m)$-pseudo-coherent, then
$\Ext^i_R(M, N) \otimes_R R' = \Ext^i_{R'}(M \otimes_R R', N \otimes_R R')$
for $i < m$.
\end{enumerate}
In particular if $R$ is Noetherian and $M$ is a finite module this
holds for all $i$.
\end{lemma}

\begin{proof}
By Algebra, Lemma \ref{algebra-lemma-flat-base-change-ext} we have
$\Ext^i_{R'}(M \otimes_R R', N \otimes_R R') =
\Ext^i_R(M, N \otimes_R R')$.
Combined with Lemma \ref{lemma-pseudo-coherence-and-ext}
we conclude (1) and (2) holds. The final statement follows from this
and Lemma \ref{lemma-Noetherian-pseudo-coherent}.
\end{proof}

\begin{lemma}
\label{lemma-pseudo-coherent-tensor}
Let $R$ be a ring. Let $K \in D^-(R)$. The following are equivalent:
\begin{enumerate}
\item $K$ is pseudo-coherent,
\item for every family $(Q_{\alpha})_{\alpha \in A}$ of $R$-modules, the
canonical map
$$
\alpha :
K \otimes_R^\mathbf{L} \left( \prod\nolimits_\alpha Q_{\alpha} \right)
\longrightarrow
\prod\nolimits_\alpha (K \otimes_R^\mathbf{L} Q_{\alpha})
$$
is an isomorphism in $D(R)$,
\item for every $R$-module $Q$ and every set $A$, the canonical map
$$
\beta : K \otimes_R^\mathbf{L} Q^A \longrightarrow (K \otimes_R^\mathbf{L} Q)^A
$$
is an isomorphism in $D(R)$, and
\item for every set $A$, the canonical map
$$
\gamma : K \otimes_R^\mathbf{L} R^A \longrightarrow K^A
$$
is an isomorphism in $D(R)$.
\end{enumerate}
Given $m \in \mathbf{Z}$ the following are equivalent
\begin{enumerate}
\item[(a)] $K$ is $m$-pseudo-coherent,
\item[(b)] for every family $(Q_{\alpha})_{\alpha \in A}$ of $R$-modules,
with $\alpha$ as above
$H^i(\alpha)$ is an isomorphism for $i > m$ and surjective for $i = m$,
\item[(c)] for every $R$-module $Q$ and every set $A$, with $\beta$ as above
$H^i(\beta)$ is an isomorphism for $i > m$ and surjective for $i = m$,
\item[(d)] for every set $A$, with $\gamma$ as above
$H^i(\gamma)$ is an isomorphism for $i > m$ and surjective for $i = m$.
\end{enumerate}
\end{lemma}

\begin{proof}
If $K$ is pseudo-coherent, then $K$ can be represented by
a bounded above complex of finite free $R$-modules.
Then the derived tensor products are computed by
tensoring with this complex. Also, products in $D(R)$
are given by taking products of any choices of representative
complexes. Hence (1) implies (2), (3), (4) by the corresponding
fact for modules, see Algebra, Proposition \ref{algebra-proposition-fp-tensor}.

\medskip\noindent
In the same way (using the tensor product is right exact)
the reader shows that (a) implies (b), (c), and (d).

\medskip\noindent
Assume (4) holds. To show that $K$ is pseudo-coherent
it suffices to show that $K$ is $m$-pseudo-coherent for
all $m$ (Lemma \ref{lemma-pseudo-coherent}). Hence to finish then proof it
suffices to prove that (d) implies (a).

\medskip\noindent
Assume (d). Let $i$ be the largest integer such that
$H^i(K)$ is nonzero. If $i < m$, then we are done.
If not, then from (d) and the description of products in $D(R)$
given above we find that $H^i(K) \otimes_R R^A \to H^i(K)^A$
is surjective. Hence $H^i(K)$ is a finitely generated $R$-module by
Algebra, Proposition \ref{algebra-proposition-fg-tensor}.
Thus we may choose a complex $L$ consisting of a single finite
free module sitting in degree $i$ and a map of complexes $L \to K$
such that $H^i(L) \to H^i(K)$ is surjective. In particular $L$
satisfies (1), (2), (3), and (4). Choose a distinguished
triangle
$$
L \to K \to M \to L[1]
$$
Then we see that $H^j(M) = 0$ for $j \geq i$.
On the other hand, $M$ still has property (d) by a small argument
which we omit. By induction on $i$ we find that $M$ is
$m$-pseudo-coherent. Hence $K$ is $m$-pseudo-coherent
by Lemma \ref{lemma-cone-pseudo-coherent}.
\end{proof}

\begin{lemma}
\label{lemma-detect-cohomology-pseudo-coherent}
Let $R$ be a ring. Let $K \in D(R)$ be pseudo-coherent.
Let $i \in \mathbf{Z}$. There exists a finitely presented
$R$-module $M$ and a map $K \to M[-i]$ in $D(R)$ which induces
an injection $H^i(K) \to M$.
\end{lemma}

\begin{proof}
By Definition \ref{definition-pseudo-coherent} we may represent
$K$ by a complex $P^\bullet$
of finite free $R$-modules. Set $M = \Coker(P^{i - 1} \to P^i)$.
\end{proof}

\begin{lemma}
\label{lemma-detect-cohomology}
Let $A$ be a Noetherian ring. Let $K \in D(A)$ be pseudo-coherent,
i.e., $K \in D^-(A)$ with finite cohomology modules.
Let $\mathfrak m$ be a maximal ideal of $A$.
If $H^i(K)/\mathfrak m H^i(K) \not = 0$, then there exists a finite
$A$-module $E$ annihilated by a power of $\mathfrak m$
and a map $K \to E[-i]$ which is nonzero on $H^i(K)$.
\end{lemma}

\begin{proof}
(The equivalent formulation of pseudo-coherence in the statement of the
lemma is Lemma \ref{lemma-Noetherian-pseudo-coherent}.)
Choose $K \to M[-i]$ as in Lemma \ref{lemma-detect-cohomology-pseudo-coherent}.
By Artin-Rees (Algebra, Lemma \ref{algebra-lemma-Artin-Rees})
we can find an $n$ such that
$H^i(K) \cap \mathfrak m^n M \subset \mathfrak m H^i(K)$.
Take $E = M/\mathfrak m^n M$.
\end{proof}









\section{Tor dimension}
\label{section-tor}

\noindent
Instead of resolving by projective modules we can look
at resolutions by flat modules. This leads to the following
concept.

\begin{definition}
\label{definition-tor-amplitude}
Let $R$ be a ring. Denote $D(R)$ its derived category.
Let $a, b \in \mathbf{Z}$.
\begin{enumerate}
\item An object $K^\bullet$ of $D(R)$ has
{\it tor-amplitude in $[a, b]$}
if $H^i(K^\bullet \otimes_R^\mathbf{L} M) = 0$ for all $R$-modules
$M$ and all $i \not \in [a, b]$.
\item An object $K^\bullet$ of $D(R)$ has {\it finite tor dimension}
if it has tor-amplitude in $[a, b]$ for some $a, b$.
\item An $R$-module $M$ has {\it tor dimension $\leq d$}
if $M[0]$ as an object of $D(R)$ has tor-amplitude in $[-d, 0]$.
\item An $R$-module $M$ has {\it finite tor dimension}
if $M[0]$ as an object of $D(R)$ has finite tor dimension.
\end{enumerate}
\end{definition}

\noindent
We observe that if $K^\bullet$ has finite tor dimension,
then $K^\bullet \in D^b(R)$.

\begin{lemma}
\label{lemma-last-one-flat}
Let $R$ be a ring. Let $K^\bullet$ be a bounded above complex of
flat $R$-modules with tor-amplitude in $[a, b]$.
Then $\Coker(d_K^{a - 1})$ is a flat $R$-module.
\end{lemma}

\begin{proof}
As $K^\bullet$ is a bounded above complex of flat modules we see
that $K^\bullet \otimes_R M = K^\bullet \otimes_R^{\mathbf{L}} M$.
Hence for every $R$-module $M$ the sequence
$$
K^{a - 2} \otimes_R M \to K^{a - 1} \otimes_R M \to K^a \otimes_R M
$$
is exact in the middle. Since
$K^{a - 2} \to K^{a - 1} \to K^a \to \Coker(d_K^{a - 1}) \to 0$
is a flat resolution this implies that
$\text{Tor}_1^R(\Coker(d_K^{a - 1}), M) = 0$
for all $R$-modules $M$. This means that
$\Coker(d_K^{a - 1})$ is flat, see
Algebra, Lemma \ref{algebra-lemma-characterize-flat}.
\end{proof}

\begin{lemma}
\label{lemma-tor-amplitude}
Let $R$ be a ring. Let $K^\bullet$ be an object of $D(R)$.
Let $a, b \in \mathbf{Z}$. The following are equivalent
\begin{enumerate}
\item $K^\bullet$ has tor-amplitude in $[a, b]$.
\item $K^\bullet$ is quasi-isomorphic to a complex
$E^\bullet$ of flat $R$-modules with $E^i = 0$ for $i \not \in [a, b]$.
\end{enumerate}
\end{lemma}

\begin{proof}
If (2) holds, then we may compute
$K^\bullet \otimes_R^\mathbf{L} M = E^\bullet \otimes_R M$
and it is clear that (1) holds.
Assume that (1) holds. We may replace $K^\bullet$ by
a projective resolution with $K^i = 0$ for $i > b$.
See Derived Categories, Lemma \ref{derived-lemma-projective-resolutions-exist}.
Set $E^\bullet = \tau_{\geq a}K^\bullet$. Everything is clear except
that $E^a$ is flat which follows immediately from
Lemma \ref{lemma-last-one-flat}
and the definitions.
\end{proof}

\begin{lemma}
\label{lemma-bounded-below-tor-amplitude}
Let $R$ be a ring. Let $a \in \mathbf{Z}$ and let $K$ be an object of $D(R)$.
The following are equivalent
\begin{enumerate}
\item $K$ has tor-amplitude in $[a, \infty]$, and
\item $K$ is quasi-isomorphic to a K-flat complex
$E^\bullet$ whose terms are flat $R$-modules with
$E^i = 0$ for $i \not \in [a, \infty]$.
\end{enumerate}
\end{lemma}

\begin{proof}
The implication (2) $\Rightarrow$ (1) is immediate. Assume (1) holds.
First we choose a K-flat complex $K^\bullet$ with flat terms representing
$K$, see Lemma \ref{lemma-K-flat-resolution}.
For any $R$-module $M$ the cohomology of
$$
K^{n - 1} \otimes_R M \to K^n \otimes_R M \to K^{n + 1} \otimes_R M
$$
computes $H^n(K \otimes_R^\mathbf{L} M)$. This is always zero
for $n < a$. Hence if we apply Lemma \ref{lemma-last-one-flat}
to the complex $\ldots \to K^{a - 1} \to K^a \to K^{a + 1}$
we conclude that $N = \Coker(K^{a - 1} \to K^a)$ is a flat $R$-module.
We set
$$
E^\bullet = \tau_{\geq a}K^\bullet =
(\ldots \to 0 \to N \to K^{a + 1} \to \ldots )
$$
The kernel $L^\bullet$ of $K^\bullet \to E^\bullet$ is the complex
$$
L^\bullet = (\ldots \to K^{a - 1} \to I \to 0 \to \ldots)
$$
where $I \subset K^a$ is the image of $K^{a - 1} \to K^a$.
Since we have the short exact sequence $0 \to I \to K^a \to N \to 0$
we see that $I$ is a flat $R$-module. Thus $L^\bullet$ is a bounded
above complex of flat modules, hence K-flat by
Lemma \ref{lemma-derived-tor-quasi-isomorphism}.
It follows that $E^\bullet$ is K-flat by
Lemma \ref{lemma-K-flat-two-out-of-three-ses}.
\end{proof}

\begin{lemma}
\label{lemma-cone-tor-amplitude}
Let $R$ be a ring.
Let $(K^\bullet, L^\bullet, M^\bullet, f, g, h)$ be a distinguished
triangle in $D(R)$. Let $a, b \in \mathbf{Z}$.
\begin{enumerate}
\item If $K^\bullet$ has tor-amplitude in $[a + 1, b + 1]$ and
$L^\bullet$ has tor-amplitude in $[a, b]$ then $M^\bullet$ has
tor-amplitude in $[a, b]$.
\item If $K^\bullet, M^\bullet$ have tor-amplitude in $[a, b]$, then
$L^\bullet$ has tor-amplitude in $[a, b]$.
\item If $L^\bullet$ has tor-amplitude in $[a + 1, b + 1]$
and $M^\bullet$ has tor-amplitude in $[a, b]$, then
$K^\bullet$ has tor-amplitude in $[a + 1, b + 1]$.
\end{enumerate}
\end{lemma}

\begin{proof}
Omitted. Hint: This just follows from the long exact cohomology sequence
associated to a distinguished triangle and the fact that
$- \otimes_R^{\mathbf{L}} M$ preserves distinguished triangles.
The easiest one to prove is (2) and the others follow from it by
translation.
\end{proof}

\begin{lemma}
\label{lemma-tor-dimension}
Let $R$ be a ring. Let $M$ be an $R$-module.
Let $d \geq 0$. The following are equivalent
\begin{enumerate}
\item $M$ has tor dimension $\leq d$, and
\item there exists a resolution
$$
0 \to F_d \to \ldots \to F_1 \to F_0 \to M \to 0
$$
with $F_i$ a flat $R$-module.
\end{enumerate}
In particular an $R$-module has tor dimension $0$ if and only if
it is a flat $R$-module.
\end{lemma}

\begin{proof}
Assume (2). Then the complex $E^\bullet$ with $E^{-i} = F_i$
is quasi-isomorphic to $M$. Hence the Tor dimension of $M$ is
at most $d$ by
Lemma \ref{lemma-tor-amplitude}.
Conversely, assume (1). Let $P^\bullet \to M$ be a projective
resolution of $M$. By
Lemma \ref{lemma-last-one-flat}
we see that $\tau_{\geq -d}P^\bullet$ is a flat resolution of
$M$ of length $d$, i.e., (2) holds.
\end{proof}

\begin{lemma}
\label{lemma-summands-tor-amplitude}
Let $R$ be a ring. Let $a, b \in \mathbf{Z}$.
If $K^\bullet \oplus L^\bullet$ has tor amplitude in $[a, b]$
so do $K^\bullet$ and $L^\bullet$.
\end{lemma}

\begin{proof}
Clear from the fact that the Tor functors are additive.
\end{proof}

\begin{lemma}
\label{lemma-complex-finite-tor-dimension-modules}
Let $R$ be a ring. Let $K^\bullet$ be a bounded complex of $R$-modules
such that $K^i$ has tor amplitude in $[a - i, b - i]$ for all $i$.
Then $K^\bullet$ has tor amplitude in $[a, b]$. In particular
if $K^\bullet$ is a finite complex of $R$-modules of finite tor dimension,
then $K^\bullet$ has finite tor dimension.
\end{lemma}

\begin{proof}
Follows by induction on the length of the finite complex: use
Lemma \ref{lemma-cone-tor-amplitude}
and the stupid truncations.
\end{proof}

\begin{lemma}
\label{lemma-cohomology-tor-amplitude}
Let $R$ be a ring. Let $a, b \in \mathbf{Z}$. Let $K^\bullet \in D^b(R)$
such that $H^i(K^\bullet)$ has tor amplitude in $[a - i, b - i]$
for all $i$. Then $K^\bullet$ has tor amplitude in $[a, b]$. In particular
if $K^\bullet \in D^b(R)$ and all its cohomology groups have finite tor
dimension then $K^\bullet$ has finite tor dimension.
\end{lemma}

\begin{proof}
Follows by induction on the length of the finite complex: use
Lemma \ref{lemma-cone-tor-amplitude}
and the canonical truncations.
\end{proof}

\begin{lemma}
\label{lemma-push-tor-amplitude}
Let $A \to B$ be a ring map. Let $K^\bullet$ and $L^\bullet$ be complexes
of $B$-modules. Let $a, b, c, d \in \mathbf{Z}$. If
\begin{enumerate}
\item $K^\bullet$ as a complex of $B$-modules has tor amplitude in $[a, b]$,
\item $L^\bullet$ as a complex of $A$-modules has tor amplitude in $[c, d]$,
\end{enumerate}
then $K^\bullet \otimes^\mathbf{L}_B L^\bullet$ as a complex of $A$-modules
has tor amplitude in $[a + c, b + d]$.
\end{lemma}

\begin{proof}
We may assume that $K^\bullet$ is a complex of flat $B$-modules with $K^i = 0$
for $i \not \in [a, b]$, see Lemma \ref{lemma-tor-amplitude}.
Let $M$ be an $A$-module. Choose a free resolution $F^\bullet \to M$.
Then
$$
(K^\bullet \otimes_B^\mathbf{L} L^\bullet) \otimes_A^{\mathbf{L}} M =
\text{Tot}(\text{Tot}(K^\bullet \otimes_B L^\bullet) \otimes_A F^\bullet) =
\text{Tot}(K^\bullet \otimes_B \text{Tot}(L^\bullet \otimes_A F^\bullet))
$$
see Homology, Remark \ref{homology-remark-triple-complex} for the second
equality. By assumption (2) the complex
$\text{Tot}(L^\bullet \otimes_A F^\bullet)$
has nonzero cohomology only in degrees $[c, d]$. Hence the spectral sequence of
Homology, Lemma \ref{homology-lemma-ss-double-complex}
for the double complex
$K^\bullet \otimes_B \text{Tot}(L^\bullet \otimes_A F^\bullet)$
proves that
$(K^\bullet \otimes_B^\mathbf{L} L^\bullet) \otimes_A^{\mathbf{L}} M$
has nonzero cohomology only in degrees $[a + c, b + d]$.
\end{proof}

\begin{lemma}
\label{lemma-flat-push-tor-amplitude}
Let $A \to B$ be a ring map. Assume that $B$ is flat as an
$A$-module. Let $K^\bullet$ be a complex of $B$-modules.
Let $a, b \in \mathbf{Z}$. If $K^\bullet$ as a complex of $B$-modules
has tor amplitude in $[a, b]$, then $K^\bullet$ as a complex of
$A$-modules has tor amplitude in $[a, b]$.
\end{lemma}

\begin{proof}
This is a special case of Lemma \ref{lemma-push-tor-amplitude}, but can also
be seen directly as follows. We have
$K^\bullet \otimes_A^{\mathbf{L}} M =
K^\bullet \otimes_B^{\mathbf{L}} (M \otimes_A B)$
since any projective resolution of $K^\bullet$ as a complex of $B$-modules
is a flat resolution of $K^\bullet$ as a complex of $A$-modules and
can be used to compute $K^\bullet \otimes_A^{\mathbf{L}} M$.
\end{proof}

\begin{lemma}
\label{lemma-finite-tor-dimension-push-tor-amplitude}
Let $A \to B$ be a ring map. Assume that $B$ has tor dimension $\leq d$
as an $A$-module. Let $K^\bullet$ be a complex of $B$-modules.
Let $a, b \in \mathbf{Z}$. If $K^\bullet$ as a complex of $B$-modules
has tor amplitude in $[a, b]$, then $K^\bullet$ as a complex of
$A$-modules has tor amplitude in $[a - d, b]$.
\end{lemma}

\begin{proof}
This is a special case of Lemma \ref{lemma-push-tor-amplitude}, but can also
be seen directly as follows.
Let $M$ be an $A$-module. Choose a free resolution $F^\bullet \to M$.
Then
$$
K^\bullet \otimes_A^{\mathbf{L}} M =
\text{Tot}(K^\bullet \otimes_A F^\bullet) =
\text{Tot}(K^\bullet \otimes_B (F^\bullet \otimes_A B)) =
K^\bullet \otimes_B^{\mathbf{L}} (M \otimes_A^{\mathbf{L}} B).
$$
By our assumption on $B$ as an $A$-module we see that
$M \otimes_A^{\mathbf{L}} B$ has cohomology only in degrees
$-d, -d + 1, \ldots, 0$. Because $K^\bullet$ has tor amplitude in
$[a, b]$ we see from the spectral sequence in
Example \ref{example-tor}
that $K^\bullet \otimes_B^{\mathbf{L}} (M \otimes_A^{\mathbf{L}} B)$
has cohomology only in degrees $[-d + a, b]$ as desired.
\end{proof}

\begin{lemma}
\label{lemma-pull-tor-amplitude}
Let $A \to B$ be a ring map.
Let $a, b \in \mathbf{Z}$.
Let $K^\bullet$ be a complex of $A$-modules with tor amplitude in $[a, b]$.
Then $K^\bullet \otimes_A^{\mathbf{L}} B$ as a complex of $B$-modules
has tor amplitude in $[a, b]$.
\end{lemma}

\begin{proof}
By
Lemma \ref{lemma-tor-amplitude}
we can find a quasi-isomorphism $E^\bullet \to K^\bullet$ where
$E^\bullet$ is a complex of flat $A$-modules with $E^i = 0$ for
$i \not \in [a, b]$. Then $E^\bullet \otimes_A B$ computes
$K^\bullet \otimes_A ^{\mathbf{L}} B$ by construction and
each $E^i \otimes_A B$ is a flat $B$-module by
Algebra, Lemma \ref{algebra-lemma-flat-base-change}.
Hence we conclude by
Lemma \ref{lemma-tor-amplitude}.
\end{proof}

\begin{lemma}
\label{lemma-flat-base-change-finite-tor-dimension}
Let $A \to B$ be a flat ring map. Let $d \geq 0$.
Let $M$ be an $A$-module of tor dimension $\leq d$.
Then $M \otimes_A B$ is a $B$-module of tor dimension $\leq d$.
\end{lemma}

\begin{proof}
Immediate consequence of
Lemma \ref{lemma-pull-tor-amplitude}
and the fact that $M \otimes_A^{\mathbf{L}} B = M \otimes_A B$
because $B$ is flat over $A$.
\end{proof}

\begin{lemma}
\label{lemma-tor-amplitude-localization}
Let $A  \to B$ be a ring map. Let $K^\bullet$ be a complex of $B$-modules.
Let $a, b \in \mathbf{Z}$. The following are equivalent
\begin{enumerate}
\item $K^\bullet$ has tor amplitude in $[a, b]$ as a complex of $A$-modules,
\item $K^\bullet_\mathfrak q$ has tor amplitude in $[a, b]$ as a complex
of $A_\mathfrak p$-modules for every prime $\mathfrak q \subset B$
with $\mathfrak p = A \cap \mathfrak q$,
\item $K^\bullet_\mathfrak m$ has tor amplitude in $[a, b]$ as a complex
of $A_\mathfrak p$-modules for every maximal ideal $\mathfrak m \subset B$
with $\mathfrak p = A \cap \mathfrak m$.
\end{enumerate}
\end{lemma}

\begin{proof}
Assume (3) and let $M$ be an $A$-module. Then
$H^i = H^i(K^\bullet \otimes_A^\mathbf{L} M)$ is a $B$-module and
$(H^i)_\mathfrak m =
H^i(K^\bullet_\mathfrak m \otimes_{A_\mathfrak p}^\mathbf{L} M_\mathfrak p)$.
Hence $H^i = 0$ for $i \not \in [a, b]$ by
Algebra, Lemma \ref{algebra-lemma-characterize-zero-local}. Thus
(3) $\Rightarrow$ (1). We omit the proofs of (1) $\Rightarrow$ (2)
and (2) $\Rightarrow$ (3).
\end{proof}

\begin{lemma}
\label{lemma-glue-tor-amplitude}
Let $R$ be a ring. Let $f_1, \ldots, f_r \in R$ be elements which
generate the unit ideal. Let $a, b \in \mathbf{Z}$. Let $K^\bullet$
be a complex of $R$-modules. If for each $i$ the complex
$K^\bullet \otimes_R R_{f_i}$ has tor amplitude in $[a, b]$,
then $K^\bullet$ has tor amplitude in $[a, b]$.
\end{lemma}

\begin{proof}
This follows immediately from Lemma \ref{lemma-tor-amplitude-localization}
but can also be seen directly as follows.
Note that $- \otimes_R R_{f_i}$ is an exact functor and that therefore
$$
H^i(K^\bullet)_{f_i} =
H^i(K^\bullet) \otimes_R R_{f_i} = H^i(K^\bullet \otimes_R R_{f_i}).
$$
and similarly for every $R$-module $M$ we have
$$
H^i(K^\bullet \otimes_R^{\mathbf{L}} M)_{f_i} =
H^i(K^\bullet \otimes_R^{\mathbf{L}} M) \otimes_R R_{f_i} =
H^i(K^\bullet \otimes_R R_{f_i} \otimes_{R_{f_i}}^{\mathbf{L}} M_{f_i}).
$$
Hence the result follows from the fact that an $R$-module $N$
is zero if and only if $N_{f_i}$ is zero for each $i$, see
Algebra, Lemma \ref{algebra-lemma-cover}.
\end{proof}

\begin{lemma}
\label{lemma-flat-descent-tor-amplitude}
Let $R$ be a ring. Let $a, b \in \mathbf{Z}$. Let $K^\bullet$
be a complex of $R$-modules. Let $R \to R'$ be a faithfully flat
ring map. If the complex $K^\bullet \otimes_R R'$ has tor amplitude
in $[a, b]$, then $K^\bullet$ has tor amplitude in $[a, b]$.
\end{lemma}

\begin{proof}
Let $M$ be an $R$-module. Since $R \to R'$ is flat we see that
$$
(M \otimes_R^{\mathbf{L}} K^\bullet) \otimes_R R'
=
((M \otimes_R R') \otimes_{R'}^{\mathbf{L}} (K^\bullet \otimes_R R')
$$
and taking cohomology commutes with tensoring with $R'$.
Hence $\text{Tor}_i^R(M, K^\bullet) \otimes_R R' =
\text{Tor}_i^{R'}(M \otimes_R R', K^\bullet \otimes_R R')$.
Since $R \to R'$ is faithfully flat, the vanishing of
$\text{Tor}_i^{R'}(M \otimes_R R', K^\bullet \otimes_R R')$ for
$i \not \in [a, b]$ implies the same thing for
$\text{Tor}_i^R(M, K^\bullet)$.
\end{proof}

\begin{lemma}
\label{lemma-no-change-tor-amplitude}
Given ring maps $R \to A \to B$ with $A \to B$ faithfully flat
and $K \in D(A)$ the tor amplitude of $K$ over $R$
is the same as the tor amplitude of $K \otimes_A^\mathbf{L} B$
over $R$.
\end{lemma}

\begin{proof}
This is true because for an $R$-module $M$ we have
$H^i(K \otimes_R^\mathbf{L} M) \otimes_A B =
H^i((K \otimes_A^\mathbf{L} B) \otimes_R^\mathbf{L} M)$
for all $i$. Namely, represent $K$ by a complex
$K^\bullet$ of $A$-modules and choose a free resolution
$F^\bullet \to M$. Then we have the equality
$$
\text{Tot}(K^\bullet \otimes_A B \otimes_R F^\bullet) =
\text{Tot}(K^\bullet \otimes_R F^\bullet) \otimes_A B
$$
The cohomology groups of the left hand side are
$H^i((K \otimes_A^\mathbf{L} B) \otimes_R^\mathbf{L} M)$
and on the right hand side we obtain
$H^i(K \otimes_R^\mathbf{L} M) \otimes_A B$.
\end{proof}

\begin{lemma}
\label{lemma-finite-gl-dim-tor-dimension}
Let $R$ be a ring of finite global dimension $d$. Then
\begin{enumerate}
\item every module has tor dimension $\leq d$,
\item a complex of $R$-modules $K^\bullet$ with $H^i(K^\bullet) \not = 0$
only if $i \in [a, b]$ has tor amplitude in $[a - d, b]$, and
\item a complex of $R$-modules $K^\bullet$ has finite tor dimension if and only
if $K^\bullet \in D^b(R)$.
\end{enumerate}
\end{lemma}

\begin{proof}
The assumption on $R$ means that every module has a finite projective
resolution of length at most $d$, in particular every module has
tor dimension $\leq d$. The second statement follows from
Lemma \ref{lemma-cohomology-tor-amplitude}
and the definitions. The third statement is a rephrasing of the second.
\end{proof}






\section{Spectral sequences for Ext}
\label{section-spectral-sequence-ext}

\noindent
In this section we collect various spectral sequences that come up
when considering the Ext functors. For any pair of objects
$L$, $K$ of the derived category $D(R)$ of a ring $R$
we denote
$$
\Ext^n_R(L, K) = \Hom_{D(R)}(L, K[n])
$$
according to our general conventions in
Derived Categories, Section \ref{derived-section-ext}.

\medskip\noindent
For $M$ an $R$-module and $K \in D^+(R)$ there is a spectral sequence
\begin{equation}
\label{equation-first-ss-ext}
E_2^{i, j} = \Ext_R^i(M, H^j(K)) \Rightarrow \Ext_R^{i + j}(M, K)
\end{equation}
and if $K$ is represented by the bounded below complex $K^\bullet$
of $R$-modules there is a spectral sequence
\begin{equation}
\label{equation-second-ss-ext}
E_1^{i, j} = \Ext_R^j(M, K^i) \Rightarrow \Ext_R^{i + j}(M, K)
\end{equation}
These spectral sequences come from applying
Derived Categories, Lemma \ref{derived-lemma-two-ss-complex-functor}
to the functor $\Hom_R(M, -)$.




\section{Projective dimension}
\label{section-projective-dimension}

\noindent
We defined the projective dimension of a module in
Algebra, Definition \ref{algebra-definition-finite-proj-dim}.

\begin{definition}
\label{definition-projective-dimension}
Let $R$ be a ring. Let $K$ be an object of $D(R)$. We say $K$ has
{\it finite projective dimension} if $K$ can be represented by a
bounded complex of projective modules. We say $K$ has
{\it projective-amplitude in $[a, b]$} if  $K$ is quasi-isomorphic
to a complex
$$
\ldots \to 0 \to P^a \to P^{a + 1} \to \ldots \to
P^{b - 1} \to P^b \to 0 \to \ldots
$$
where $P^i$ is a projective $R$-module for all $i \in \mathbf{Z}$.
\end{definition}

\noindent
Clearly, $K$ has finite projective dimension if and only if $K$
has projective-amplitude in $[a, b]$ for some $a, b \in \mathbf{Z}$.
Furthermore, if $K$ has finite projective dimension, then $K$
is bounded. Here is a lemma to detect such objects of $D(R)$.

\begin{lemma}
\label{lemma-projective-amplitude}
Let $R$ be a ring. Let $K$ be an object of $D(R)$. Let $a, b \in \mathbf{Z}$.
The following are equivalent
\begin{enumerate}
\item $K$ has projective-amplitude in $[a, b]$,
\item $\Ext^i_R(K, N) = 0$ for all $R$-modules $N$ and all
$i \not \in [-b, -a]$,
\item $H^n(K) = 0$ for $n > b$ and
$\Ext^i_R(K, N) = 0$ for all $R$-modules $N$ and all $i > -a$, and
\item $H^n(K) = 0$ for $n \not \in [a - 1, b]$ and
$\Ext^{-a + 1}_R(K, N) = 0$ for all $R$-modules $N$.
\end{enumerate}
\end{lemma}

\begin{proof}
Assume (1). We may assume $K$ is the complex
$$
\ldots \to 0 \to P^a \to P^{a + 1} \to \ldots \to
P^{b - 1} \to P^b \to 0 \to \ldots
$$
where $P^i$ is a projective $R$-module for all $i \in \mathbf{Z}$.
In this case we can compute the ext groups by the complex
$$
\ldots \to 0 \to \Hom_R(P^b, N) \to \ldots \to
\Hom_R(P^a, N) \to 0 \to \ldots
$$
and we obtain (2).

\medskip\noindent
Assume (2) holds. Choose an injection $H^n(K) \to I$ where $I$
is an injective $R$-module. Since $\Hom_R(-, I)$ is an exact functor,
we see that $\Ext^{-n}(K, I) = \Hom_R(H^n(K), I)$.
We conclude in particular that $H^n(K)$ is zero for $n > b$.
Thus (2) implies (3).

\medskip\noindent
By the same argument as in (2) implies (3) gives that (3) implies (4).

\medskip\noindent
Assume (4). The same argument as in (2) implies (3) shows that
$H^{a - 1}(K) = 0$, i.e., we have $H^i(K) = 0$ unless $i \in [a, b]$.
In particular, $K$ is bounded above and we can choose a
a complex $P^\bullet$ representing $K$ with $P^i$ projective
(for example free) for all $i \in \mathbf{Z}$ and $P^i = 0$ for $i > b$.
See Derived Categories, Lemma
\ref{derived-lemma-subcategory-left-resolution}.
Let $Q = \Coker(P^{a - 1} \to P^a)$. Then $K$ is quasi-isomorphic
to the complex
$$
\ldots \to 0 \to Q \to P^{a + 1} \to \ldots \to P^b \to 0 \to \ldots
$$
as $H^i(K) = 0$ for $i < a$.
Denote $K' = (P^{a + 1} \to \ldots \to P^b)$ the corresponding object of
$D(R)$. We obtain a distinguished triangle
$$
K' \to K \to Q[-a] \to K'[1]
$$
in $D(R)$. Thus for every $R$-module $N$ an exact sequence
$$
\Ext^{-a}(K', N) \to \Ext^1(Q, N) \to \Ext^{1 - a}(K, N)
$$
By assumption the term on the right vanishes. By the implication
(1) $\Rightarrow$ (2) the term on the left vanishes. Thus $Q$
is a projective $R$-module by
Algebra, Lemma \ref{algebra-lemma-characterize-projective}.
Hence (1) holds and the proof is complete.
\end{proof}

\begin{example}
\label{example-ext-not-bounded}
Let $k$ be a field and let $R$ be the ring of dual numbers
over $k$, i.e., $R = k[x]/(x^2)$. Denote $\epsilon \in R$ the
class of $x$. Let $M = R/(\epsilon)$. Then $M$ is quasi-isomorphic
to the complex
$$
R \xrightarrow{\epsilon} R \xrightarrow{\epsilon} R \to \ldots
$$
but $M$ does not have finite projective dimension as defined in
Algebra, Definition \ref{algebra-definition-finite-proj-dim}.
This explains why we consider bounded (in both directions) complexes
of projective modules in our definition of finite projective dimension
of objects of $D(R)$.
\end{example}






\section{Injective dimension}
\label{section-injective-dimension}

\noindent
This section is the dual of the section on projective dimension.

\begin{definition}
\label{definition-injective-dimension}
Let $R$ be a ring. Let $K$ be an object of $D(R)$.
We say $K$ has {\it finite injective dimension} if $K$ can be
represented by a finite complex of injective $R$-modules.
We say $K$ has {\it injective-amplitude in $[a, b]$}
if $K$ is isomorphic to a complex
$$
\ldots \to 0 \to I^a \to I^{a + 1} \to \ldots \to
I^{b - 1} \to I^b \to 0 \to \ldots
$$
with $I^i$ an injective $R$-module for all $i \in \mathbf{Z}$.
\end{definition}

\noindent
Clearly, $K$ has bounded injective dimension if and only if $K$
has injective-amplitude in $[a, b]$ for some $a, b \in \mathbf{Z}$.
Furthermore, if $K$ has bounded injective dimension, then $K$
is bounded. Here is the obligatory lemma.

\begin{lemma}
\label{lemma-injective-amplitude}
Let $R$ be a ring. Let $K$ be an object of $D(R)$. Let $a, b \in \mathbf{Z}$.
The following are equivalent
\begin{enumerate}
\item $K$ has injective-amplitude in $[a, b]$,
\item $\Ext^i_R(N, K) = 0$ for all $R$-modules $N$ and all
$i \not \in [a, b]$,
\item $\Ext^i(R/I, K) = 0$ for all ideals $I \subset R$ and
all $i \not \in [a, b]$.
\end{enumerate}
\end{lemma}

\begin{proof}
Assume (1). We may assume $K$ is the complex
$$
\ldots \to 0 \to I^a \to I^{a + 1} \to \ldots \to
I^{b - 1} \to I^b \to 0 \to \ldots
$$
where $I^i$ is a injective $R$-module for all $i \in \mathbf{Z}$.
In this case we can compute the ext groups by the complex
$$
\ldots \to 0 \to \Hom_R(N, I^a) \to \ldots \to
\Hom_R(N, I^b) \to 0 \to \ldots
$$
and we obtain (2). It is clear that (2) implies (3).

\medskip\noindent
Assume (3) holds. Choose a nonzero map $R \to H^n(K)$. Since $\Hom_R(R, -)$
is an exact functor, we see that
$\Ext^n_R(R, K) = \Hom_R(R, H^n(K)) = H^n(K)$.
We conclude that $H^n(K)$ is zero for $n \not \in [a, b]$.
In particular, $K$ is bounded below and we can choose a quasi-isomorphism
$$
K \to I^\bullet
$$
with $I^i$ injective for all $i \in \mathbf{Z}$ and
$I^i = 0$ for $i < a$. See Derived Categories, Lemma
\ref{derived-lemma-subcategory-right-resolution}.
Let $J = \Ker(I^b \to I^{b + 1})$. Then $K$ is quasi-isomorphic
to the complex
$$
\ldots \to 0 \to I^a \to \ldots \to I^{b - 1} \to J \to 0 \to \ldots
$$
Denote $K' = (I^a \to \ldots \to I^{b - 1})$ the corresponding object of
$D(R)$. We obtain a distinguished triangle
$$
J[-b] \to K \to K' \to J[1 - b]
$$
in $D(R)$. Thus for every ideal $I \subset R$ an exact sequence
$$
\Ext^b(R/I, K') \to \Ext^1(R/I, J) \to \Ext^{1 + b}(R/I, K)
$$
By assumption the term on the right vanishes. By the implication
(1) $\Rightarrow$ (2) the term on the left vanishes. Thus $J$
is a injective $R$-module by
Lemma \ref{lemma-characterize-injective-bis}.
\end{proof}

\begin{example}
\label{example-finite-injective-finite-global-dimension}
Let $R$ be a Dedekind domain. Then every nonzero ideal $I$ is
a finite projective module, see Lemma \ref{lemma-dedekind-torsion-free-flat}.
Thus $R/I$ has projective dimension $1$. Hence every $R$-module $M$
has injective dimension $\leq 1$ by Lemma \ref{lemma-injective-amplitude}.
Thus $\Ext^i_R(M, N) = 0$ for $i \geq 2$ and any pair of $R$-modules $M, N$.
It follows that any object $K$ in $D^b(R)$ is isomorphic to the direct sum
of its cohomologies: $K \cong \bigoplus H^i(K)[-i]$, see
Derived Categories, Lemma \ref{derived-lemma-ext-2-zero}.
\end{example}

\begin{example}
\label{example-ext-not-bounded-reversed}
Let $k$ be a field and let $R$ be the ring of dual numbers
over $k$, i.e., $R = k[x]/(x^2)$. Denote $\epsilon \in R$ the
class of $x$. Let $M = R/(\epsilon)$. Then $M$ is quasi-isomorphic
to the complex
$$
\ldots \to R \xrightarrow{\epsilon} R \xrightarrow{\epsilon} R
$$
and $R$ is an injective $R$-module. However one usually does not
consider $M$ to have finite injective dimension in this situation.
This explains why we consider bounded (in both directions) complexes
of injective modules in our definition of bounded injective dimension
of objects of $D(R)$.
\end{example}

\begin{lemma}
\label{lemma-finite-injective-dimension}
Let $R$ be a ring. Let $K \in D(R)$.
\begin{enumerate}
\item If $K$ is in $D^b(R)$ and $H^i(K)$ has finite injective dimension
for all $i$, then $K$ has finite injective dimension.
\item If $K^\bullet$ represents $K$, is a bounded complex of $R$-modules,
and $K^i$ has finite injective dimension for all $i$, then $K$ has finite
injective dimension.
\end{enumerate}
\end{lemma}

\begin{proof}
Omitted. Hint: Apply the spectral sequences of
Derived Categories, Lemma \ref{derived-lemma-two-ss-complex-functor}
to the functor $F = \Hom_R(N, -)$ to get a computation of
$\Ext^i_A(N, K)$ and use the criterion of
Lemma \ref{lemma-injective-amplitude}.
\end{proof}

\begin{lemma}
\label{lemma-finite-injective-dimension-Noetherian-radical}
Let $R$ be a Noetherian ring. Let $I \subset R$ be an ideal contained
in the Jacobson radical of $R$. Let $K \in D^+(R)$ have
finite cohomology modules. Then the following are equivalent
\begin{enumerate}
\item $K$ has finite injective dimension, and
\item there exists a $b$ such that $\Ext^i_R(R/J, K) = 0$ for $i > b$
and any ideal $J \supset I$.
\end{enumerate}
\end{lemma}

\begin{proof}
The implication (1) $\Rightarrow$ (2) is immediate. Assume (2).
Say $H^i(K) = 0$ for $i < a$. Then $\Ext^i(M, K) = 0$ for $i < a$ and
all $R$-modules $M$. Thus it suffices to show that
$\Ext^i(M, K) = 0$ for $i > b$ any finite $R$-module $M$, see
Lemma \ref{lemma-injective-amplitude}.
By Algebra, Lemma \ref{algebra-lemma-filter-Noetherian-module}
the module $M$ has a finite filtration whose successive
quotients are of the form $R/\mathfrak p$ where $\mathfrak p$ is
a prime ideal. If $0 \to M_1 \to M \to M_2 \to 0$
is a short exact sequence and $\Ext^i(M_j, K) = 0$ for $i > b$
and $j = 1, 2$, then $\Ext^i(M, K) = 0$ for $i > b$.
Thus we may assume $M = R/\mathfrak p$.
If $I \subset \mathfrak p$, then the vanishing follows
from the assumption. If not, then choose $f \in I$, $f \not \in \mathfrak p$.
Consider the short exact sequence
$$
0 \to R/\mathfrak p \xrightarrow{f} R/\mathfrak p \to R/(\mathfrak p, f) \to 0
$$
The $R$-module $R/(\mathfrak p, f)$ has a filtration whose successive
quotients are $R/\mathfrak q$ with $(\mathfrak p, f) \subset \mathfrak q$.
Thus by Noetherian induction and the argument above
we may assume the vanishing holds for $R/(\mathfrak p, f)$.
On the other hand, the modules
$E^i = \Ext^i(R/\mathfrak p, K)$ are finite by our assumption on $K$
(bounded below with finite cohomology modules), the spectral
sequence (\ref{equation-first-ss-ext}), and
Algebra, Lemma \ref{algebra-lemma-ext-noetherian}.
Thus $E^i$ for $i > b$ is a finite $R$-module
such that $E^i/fE^i = 0$.  We conclude by Nakayama's lemma
(Algebra, Lemma \ref{algebra-lemma-NAK})
that $E^i$ is zero.
\end{proof}

\begin{lemma}
\label{lemma-finite-injective-dimension-Noetherian-local}
Let $(R, \mathfrak m, \kappa)$ be a local Noetherian ring.
Let $K \in D^+(R)$ have finite cohomology modules.
Then the following are equivalent
\begin{enumerate}
\item $K$ has finite injective dimension, and
\item $\Ext^i_R(\kappa, K) = 0$ for $i \gg 0$.
\end{enumerate}
\end{lemma}

\begin{proof}
This is a special case of
Lemma \ref{lemma-finite-injective-dimension-Noetherian-radical}.
\end{proof}






\section{Modules which are close to being projective}
\label{section-near-projective}

\noindent
There seem to be many different of definitions in the literature of
``almost projective modules''. In this section we discuss just one
of the many possibilities.

\begin{lemma}
\label{lemma-ideal-factor-through-projective}
Let $R$ be a ring. Let $M$, $N$ be $R$-modules.
\begin{enumerate}
\item Given an $R$-module map $\varphi : M \to N$ the following are
equivalent: (a) $\varphi$ factors through a projective $R$-module, and
(b) $\varphi$ factors through a free $R$-module.
\item The set of $\varphi : M \to N$ satisfying the equivalent
conditions of (1) is an $R$-submodule of $\Hom_R(M, N)$.
\item Given maps $\psi : M' \to M$ and $\xi : N \to N'$, if
$\varphi : M \to N$ satisfies the equivalent conditions
of (1), then $\xi \circ \varphi \circ \psi : M' \to N'$ does too.
\end{enumerate}
\end{lemma}

\begin{proof}
The equivalence of (1)(a) and (1)(b) follows from
Algebra, Lemma \ref{algebra-lemma-characterize-projective}.
If $\varphi : M \to N$ and $\varphi' : M \to N$ factor through
the modules $P$ and $P'$ then $\varphi + \varphi'$
factors through $P \oplus P'$ and $\lambda \varphi$ factors through
$P$ for all $\lambda \in R$. This proves (2). If $\varphi : M \to N$
factors through the module $P$ and $\psi$ and $\xi$ are as in (3),
then $\xi \circ \varphi \circ \psi$ factors through $P$. This proves (3).
\end{proof}

\begin{lemma}
\label{lemma-factor-through-finite-projective}
Let $R$ be a ring. Let $\varphi : M \to N$ be an $R$-module map.
If $\varphi$ factors through a projective module and $M$ is a
finite $R$-module, then $\varphi$ factors through a finite projective
module.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-ideal-factor-through-projective} we can
factor $\varphi = \tau \circ \sigma$ where the target of $\sigma$
is $\bigoplus_{i \in I} R$ for some set $I$. Choose generators
$x_1, \ldots, x_n$ for $M$. Write $\sigma(x_j) = (a_{ji})_{i \in I}$.
For each $j$ only a finite number of $a_{ij}$ are nonzero.
Hence $\sigma$ has image contained in a finite free $R$-module
and we conclude.
\end{proof}

\noindent
Let $R$ be a ring. Observe that an $R$-module is projective if and
only if the identity on $R$ factors through a projective module.

\begin{lemma}
\label{lemma-near-projective}
Let $R$ be a ring. Let $I \subset R$ be an ideal. Let $M$ be an $R$-module.
The following conditions are equivalent
\begin{enumerate}
\item for every $a \in I$ the map $a : M \to M$ factors through a projective
$R$-module,
\item for every $a \in I$ the map $a : M \to M$ factors through a free
$R$-module, and
\item $\Ext^1_R(M, N)$ is annihilated by $I$ for every $R$-module $N$.
\end{enumerate}
\end{lemma}

\begin{proof}
The equivalence of (1) and (2) follows from
Lemma \ref{lemma-ideal-factor-through-projective}.
If (1) holds, then (3) holds because $\Ext^1_R(P, N)$
for any $N$ and any projective module $P$.
Conversely, assume (3) holds. Choose a short exact sequence
$0 \to N \to P \to M \to 0$ with $P$ projective (or even free).
By assumption the corresponding element of $\Ext^1_R(M, N)$
is annihilated by $I$. Hence for every $a \in I$ the map
$a : M \to M$ can be factored through the surjection $P \to M$
and we conclude (1) holds.
\end{proof}

\noindent
In order to comfortably talk about modules satisfying the equivalent
conditions of Lemma \ref{lemma-near-projective} we give the property a name.

\begin{definition}
\label{definition-near-projective}
Let $R$ be a ring. Let $I \subset R$ be an ideal. Let $M$ be an $R$-module.
We say $M$ is {\it $I$-projective}\footnote{This is nonstandard notation.}
if the equivalent conditions of Lemma \ref{lemma-near-projective} hold.
\end{definition}

\noindent
Modules annihilated by $I$ are $I$-projective.

\begin{lemma}
\label{lemma-torsion-near-projective}
Let $R$ be a ring. Let $I \subset R$ be an ideal. Let $M$ be an $R$-module.
If $M$ is annihilated by $I$, then $M$ is $I$-projective.
\end{lemma}

\begin{proof}
Immediate from the definition and the fact that the zero module is projective.
\end{proof}

\begin{lemma}
\label{lemma-ses-near-projective}
Let $R$ be a ring. Let $I \subset R$ be an ideal. Let
$$
0 \to K \to P \to M \to 0
$$
be a short exact sequence of $R$-modules.
If $M$ is $I$-projective and $P$ is projective, then $K$ is $I$-projective.
\end{lemma}

\begin{proof}
The element $\text{id}_K \in \Hom_R(K, K)$ maps to the class of
the given extension in $\Ext^1_R(M, K)$. Since by assumption this
class is annihilated by any $a \in I$ we see that $a : K \to K$
factors through $K \to P$ and we conclude.
\end{proof}

\begin{lemma}
\label{lemma-dual-near-projective}
Let $R$ be a ring. Let $I \subset R$ be an ideal.
If $M$ is a finite, $I$-projective $R$-module, then
$M^\vee = \Hom_R(M, R)$ is $I$-projective.
\end{lemma}

\begin{proof}
Assume $M$ is finite and $I$-projective.
Choose a short exact sequence $0 \to K \to R^{\oplus r} \to M \to 0$.
This produces an injection $M^\vee \to R^{\oplus r} = (R^{\oplus r})^\vee$.
Since the extension class in $\Ext^1_R(M, K)$ corresponding to
the short exact sequence is annihilated by $I$, we see that
for any $a \in I$ we can find a map $M \to R^{\oplus r}$ such that
the composition with the given map $R^{\oplus r} \to M$ is equal
to $a : M \to M$. Taking duals we find that $a : M^\vee \to M^\vee$
factors through the map $M^\vee \to R^{\oplus r}$ given above and
we conclude.
\end{proof}





\section{Hom complexes}
\label{section-hom-complexes}

\noindent
Let $R$ be a ring. Let $L^\bullet$ and $M^\bullet$ be two complexes
of $R$-modules. We construct a complex $\Hom^\bullet(L^\bullet, M^\bullet)$.
Namely, for each $n$ we set
$$
\Hom^n(L^\bullet, M^\bullet) =
\prod\nolimits_{n = p + q} \Hom_R(L^{-q}, M^p)
$$
It is a good idea to think of $\Hom^n$ as the $R$-module of all $R$-linear
maps from $L^\bullet$ to $M^\bullet$ (viewed as graded modules)
which are homogenous of degree $n$. In this terminology, we define the
differential by the rule
$$
\text{d}(f) = \text{d}_M \circ f - (-1)^n f \circ \text{d}_L
$$
for $f \in \Hom^n(L^\bullet, M^\bullet)$.
We omit the verification that $\text{d}^2 = 0$.
See Section \ref{section-sign-rules} for sign rules.
This construction is a special case of
Differential Graded Algebra, Example \ref{dga-example-category-complexes}.
It follows immediately from the construction that we have
\begin{equation}
\label{equation-cohomology-hom-complex}
H^n(\Hom^\bullet(L^\bullet, M^\bullet)) = \Hom_{K(R)}(L^\bullet, M^\bullet[n])
\end{equation}
for all $n \in \mathbf{Z}$.

\begin{lemma}
\label{lemma-compose}
Let $R$ be a ring. Given complexes $K^\bullet, L^\bullet, M^\bullet$
of $R$-modules there is a canonical isomorphism
$$
\Hom^\bullet(K^\bullet, \Hom^\bullet(L^\bullet, M^\bullet))
=
\Hom^\bullet(\text{Tot}(K^\bullet \otimes_R L^\bullet), M^\bullet)
$$
of complexes of $R$-modules.
\end{lemma}

\begin{proof}
Let $\alpha$ be an element of degree $n$ on the left hand side.
Thus
$$
\alpha = (\alpha^{p, q}) \in
\prod\nolimits_{p + q = n} \Hom_R(K^{-q}, \Hom^p(L^\bullet, M^\bullet))
$$
Each $\alpha^{p, q}$ is an element
$$
\alpha^{p, q} = (\alpha^{r, s, q}) \in
\prod\nolimits_{r + s + q = n} \Hom_R(K^{-q}, \Hom_R(L^{-s}, M^r))
$$
If we make the identifications
\begin{equation}
\label{equation-identification}
\Hom_R(K^{-q}, \Hom_R(L^{-s}, M^r)) = \Hom_R(K^{-q} \otimes_R L^{-s}, M^r)
\end{equation}
then by our sign rules we get
\begin{align*}
\text{d}(\alpha^{r, s, q})
& =
\text{d}_{\Hom^\bullet(L^\bullet, M^\bullet)} \circ \alpha^{r, s, q}
- (-1)^n \alpha^{r, s, q} \circ \text{d}_K \\
& =
\text{d}_M \circ \alpha^{r, s, q}
- (-1)^{r + s} \alpha^{r, s, q} \circ \text{d}_L
- (-1)^{r + s + q} \alpha^{r, s, q} \circ \text{d}_K
\end{align*}
On the other hand, if $\beta$ is an element of degree $n$ of
the right hand side, then
$$
\beta = (\beta^{r, s, q}) \in \prod\nolimits_{r + s + q = n}
\Hom_R(K^{-q} \otimes_R L^{-s}, M^r)
$$
and by our sign rule (Homology, Definition
\ref{homology-definition-associated-simple-complex}) we get
\begin{align*}
\text{d}(\beta^{r, s, q})
& =
\text{d}_M \circ \beta^{r, s, q}
- (-1)^n \beta^{r, s, q} \circ
\text{d}_{\text{Tot}(K^\bullet \otimes L^\bullet)} \\
& =
\text{d}_M \circ \beta^{r, s, q}
- (-1)^{r + s + q} \left(
\beta^{r, s, q} \circ \text{d}_K + (-1)^{-q} \beta^{r, s, q} \circ \text{d}_L
\right)
\end{align*}
Thus we see that the map induced by the identifications
(\ref{equation-identification}) indeed is a morphism of complexes.
\end{proof}

\begin{remark}
\label{remark-internal-hom}
Let $R$ be a ring. The category $\text{Comp}(R)$
of complexes of $R$-modules is a symmetric monoidal category
with tensor product given by $\text{Tot}(- \otimes_R -)$, see
Lemma \ref{lemma-symmetric-monoidal-cat-complexes}.
Given $L^\bullet$ and $M^\bullet$ in $\text{Comp}(R)$
an element $f \in \Hom^0(L^\bullet, M^\bullet)$ defines a
map of complexes $f : L^\bullet \to M^\bullet$ if and only if
$\text{d}(f) = 0$. Hence Lemma \ref{lemma-compose} also tells us that
$$
\Mor_{\text{Comp}(R)}(K^\bullet, \Hom^\bullet(L^\bullet, M^\bullet))
=
\Mor_{\text{Comp}(R)}(\text{Tot}(K^\bullet \otimes_R L^\bullet), M^\bullet)
$$
functorially in $K^\bullet, L^\bullet, M^\bullet$ in $\text{Comp}(R)$.
This means that $\Hom^\bullet( - , -)$ is an internal hom
for the symmetric monoidal category $\text{Comp}(R)$ as discussed in
Categories, Remark \ref{categories-remark-internal-hom-monoidal}.
\end{remark}

\begin{lemma}
\label{lemma-composition}
Let $R$ be a ring. Given complexes
$K^\bullet, L^\bullet, M^\bullet$
of $R$-modules there is a canonical morphism
$$
\text{Tot}\left(
\Hom^\bullet(L^\bullet, M^\bullet) \otimes_R \Hom^\bullet(K^\bullet, L^\bullet)
\right)
\longrightarrow
\Hom^\bullet(K^\bullet, M^\bullet)
$$
of complexes of $R$-modules.
\end{lemma}

\begin{proof}
Via the discussion in Remark \ref{remark-internal-hom} the existence
of such a canonical map follows from
Categories, Remark \ref{categories-remark-internal-hom-monoidal}.
We also give a direct construction.

\medskip\noindent
An element $\alpha$ of degree $n$ of the left hand side is
$$
\alpha = (\alpha^{p, q}) \in \bigoplus\nolimits_{p + q = n}
\Hom^p(L^\bullet, M^\bullet) \otimes_R \Hom^q(K^\bullet, L^\bullet)
$$
The element $\alpha^{p, q}$ is a finite sum
$\alpha^{p, q} = \sum \beta^p_i \otimes \gamma^q_i$
with
$$
\beta^p_i = (\beta^{r, s}_i)
\in \prod\nolimits_{r + s = p} \Hom_R(L^{-s}, M^r)
$$
and
$$
\gamma^q_i = (\gamma^{u, v}_i)
\in \prod\nolimits_{u + v = q} \Hom_R(K^{-v}, L^u)
$$
The map is given by sending $\alpha$ to
$\delta = (\delta^{r, v})$ with
$$
\delta^{r, v} =
\sum\nolimits_{i, s}  \beta^{r, s}_i
\circ \gamma^{-s, v}_i
\in \Hom_R(K^{-v}, M^r)
$$
For given $r + v = n$ this sum is finite as there are only finitely many
nonzero $\alpha^{p, q}$, hence only finitely many nonzero
$\beta^p_i$ and $\gamma^q_i$.
By our sign rules we have
\begin{align*}
\text{d}(\alpha^{p, q})
& =
\text{d}_{\Hom^\bullet(L^\bullet, M^\bullet)}(\alpha^{p, q})
+ (-1)^p \text{d}_{\Hom^\bullet(K^\bullet, L^\bullet)}(\alpha^{p, q}) \\
& =
\sum \Big( \text{d}_M \circ \beta^p_i \circ \gamma^q_i
- (-1)^p \beta^p_i \circ \text{d}_L \circ \gamma^q_i \Big) \\
&
\quad + (-1)^p \sum \Big( \beta^p_i \circ \text{d}_L \circ \gamma^q_i
- (-1)^q \beta^p_i \circ \gamma^q_i \circ \text{d}_K \Big) \\
& =
\sum \Big( \text{d}_M \circ \beta^p_i \circ \gamma^q_i 
-(-1)^n \beta^p_i \circ \gamma^q_i \circ \text{d}_K \Big)
\end{align*}
It follows that the rules $\alpha \mapsto \delta$ is compatible
with differentials and the lemma is proved.
\end{proof}

\begin{lemma}
\label{lemma-diagonal-better}
Let $R$ be a ring. Given complexes $K^\bullet, L^\bullet, M^\bullet$
of $R$-modules there is a canonical morphism
$$
\text{Tot}(K^\bullet \otimes_R \Hom^\bullet(M^\bullet, L^\bullet))
\longrightarrow
\Hom^\bullet(M^\bullet, \text{Tot}(K^\bullet \otimes_R L^\bullet))
$$
of complexes of $R$-modules functorial in all three complexes.
\end{lemma}

\begin{proof}
Via the discussion in Remark \ref{remark-internal-hom} the existence
of such a canonical map follows from
Categories, Remark \ref{categories-remark-internal-hom-monoidal}.
We also give a direct construction.

\medskip\noindent
Let $\alpha$ be an element of degree $n$ of the right hand side.
Thus
$$
\alpha = (\alpha^{p, q}) \in \prod\nolimits_{p + q = n}
\Hom_R(M^{-q}, \text{Tot}^p(K^\bullet \otimes_R L^\bullet))
$$
Each $\alpha^{p, q}$ is an element
$$
\alpha^{p, q} = (\alpha^{r, s, q}) \in
\Hom_R(M^{-q}, \bigoplus\nolimits_{r + s + q = n} K^r \otimes_R L^s)
$$
where we think of $\alpha^{r, s, q}$ as a family of maps such that
for every $x \in M^{-q}$ only a finite number of
$\alpha^{r, s, q}(x)$ are nonzero. By our sign rules we get
\begin{align*}
\text{d}(\alpha^{r, s, q})
& =
\text{d}_{\text{Tot}(K^\bullet \otimes_R L^\bullet)} \circ \alpha^{r, s, q}
- (-1)^n \alpha^{r, s, q} \circ \text{d}_M \\
& =
\text{d}_K \circ \alpha^{r, s, q} + (-1)^r \text{d}_L \circ \alpha^{r, s, q}
- (-1)^n \alpha^{r, s, q} \circ \text{d}_M
\end{align*}
On the other hand, if $\beta$ is an element of degree $n$ of the
left hand side, then
$$
\beta = (\beta^{p, q}) \in
\bigoplus\nolimits_{p + q = n} K^p \otimes_R \Hom^q(M^\bullet, L^\bullet)
$$
and we can write $\beta^{p, q} = \sum \gamma_i^p \otimes \delta_i^q$ with
$\gamma_i^p \in K^p$ and
$$
\delta_i^q = (\delta_i^{r, s}) \in
\prod\nolimits_{r + s = q} \Hom_R(M^{-s}, L^r)
$$
By our sign rules we have
\begin{align*}
\text{d}(\beta^{p, q})
& =
\text{d}_K(\beta^{p, q}) +
(-1)^p \text{d}_{\Hom^\bullet(M^\bullet, L^\bullet)}(\beta^{p, q}) \\
& =
\sum \text{d}_K(\gamma_i^p) \otimes \delta_i^q +
(-1)^p \sum \gamma_i^p \otimes
(\text{d}_L \circ \delta_i^q - (-1)^q \delta_i^q \circ \text{d}_M)
\end{align*}
We send the element $\beta$ to $\alpha$ with
$$
\alpha^{r, s, q} = c^{r, s, q}(\sum \gamma_i^r \otimes \delta_i^{s, q})
$$
where $c^{r, s, q} : K^r \otimes_R \Hom_R(M^{-q}, L^s) \to
\Hom_R(M^{-q}, K^r \otimes_R L^s)$ is the canonical map.
For a given $\beta$ and $r$ there are only finitely many nonzero
$\gamma_i^r$ hence only finitely many nonzero $\alpha^{r, s, q}$
are nonzero (for a given $r$). Thus this family of maps satisfies
the conditions above and the map is well defined.
Comparing signs we see that this is compatible with differentials.
\end{proof}

\begin{lemma}
\label{lemma-diagonal}
Let $R$ be a ring. Given complexes $K^\bullet, L^\bullet$
of $R$-modules there is a canonical morphism
$$
K^\bullet
\longrightarrow
\Hom^\bullet(L^\bullet, \text{Tot}(K^\bullet \otimes_R L^\bullet))
$$
of complexes of $R$-modules functorial in both complexes.
\end{lemma}

\begin{proof}
Via the discussion in Remark \ref{remark-internal-hom} the existence
of such a canonical map follows from
Categories, Remark \ref{categories-remark-internal-hom-monoidal}.
We also give a direct construction.

\medskip\noindent
Let $\alpha$ be an element of degree $n$ of the right hand side.
Thus
$$
\alpha = (\alpha^{p, q}) \in \prod\nolimits_{p + q = n}
\Hom_R(L^{-q}, \text{Tot}^p(K^\bullet \otimes_R L^\bullet))
$$
Each $\alpha^{p, q}$ is an element
$$
\alpha^{p, q} = (\alpha^{r, s, q}) \in
\Hom_R(L^{-q}, \bigoplus\nolimits_{r + s + q = n} K^r \otimes_R L^s)
$$
where we think of $\alpha^{r, s, q}$ as a family of maps such that
for every $x \in L^{-q}$ only a finite number of
$\alpha^{r, s, q}(x)$ are nonzero. By our sign rules we get
\begin{align*}
\text{d}(\alpha^{r, s, q})
& =
\text{d}_{\text{Tot}(K^\bullet \otimes_R L^\bullet)} \circ \alpha^{r, s, q}
- (-1)^n \alpha^{r, s, q} \circ \text{d}_L \\
& =
\text{d}_K \circ \alpha^{r, s, q} + (-1)^r \text{d}_L \circ \alpha^{r, s, q}
- (-1)^n \alpha^{r, s, q} \circ \text{d}_L
\end{align*}
Now an element $\beta \in K^n$ we send to $\alpha$ with
$\alpha^{n, -q, q} = \beta \otimes \text{id}_{L^{-q}}$
and $\alpha^{r, s, q} = 0$ if $r \not = n$. This is indeed
an element as above, as for fixed $q$ there is only one nonzero
$\alpha^{r, s, q}$. The description of
the differential shows this is compatible with differentials.
\end{proof}

\begin{lemma}
\label{lemma-evaluate-and-more}
Let $R$ be a ring. Given complexes $K^\bullet, L^\bullet, M^\bullet$
of $R$-modules there is a canonical morphism
$$
\text{Tot}(\Hom^\bullet(L^\bullet, M^\bullet) \otimes_R K^\bullet)
\longrightarrow
\Hom^\bullet(\Hom^\bullet(K^\bullet, L^\bullet), M^\bullet)
$$
of complexes of $R$-modules functorial in all three complexes.
\end{lemma}

\begin{proof}
Via the discussion in Remark \ref{remark-internal-hom} the existence
of such a canonical map follows from
Categories, Remark \ref{categories-remark-internal-hom-monoidal}.
We also give a direct construction.

\medskip\noindent
Consider an element $\beta$ of degree $n$ of the right hand side.
Then
$$
\beta = (\beta^{p, s}) \in
\prod\nolimits_{p + s = n} \Hom_R(\Hom^{-s}(K^\bullet, L^\bullet), M^p)
$$
Our sign rules tell us that
\begin{align*}
\text{d}(\beta^{p, s})
& =
\text{d}_M \circ \beta^{p, s}
- (-1)^n \beta^{p, s} \circ
\text{d}_{\Hom^\bullet(K^\bullet, L^\bullet)}
\end{align*}
We can describe the last term as follows
$$
(\beta^{p, s} \circ \text{d}_{\Hom^\bullet(K^\bullet, L^\bullet)})(f) =
\beta^{p, s}(\text{d}_L \circ f - (-1)^{s + 1} f \circ \text{d}_K)
$$
if $f \in \Hom^{-s - 1}(K^\bullet, L^\bullet)$. We conclude that in
some unspecified sense $\text{d}(\beta^{p, s})$ is a sum of three terms
with signs as follows
\begin{equation}
\label{equation-beta}
\text{d}(\beta^{p, s}) =
\text{d}_M(\beta^{p, s})
-(-1)^n\text{d}_L(\beta^{p, s}) +
(-1)^{p + 1}\text{d}_K(\beta^{p, s})
\end{equation}

\noindent
Next, we consider an element $\alpha$ of degree $n$ of the left hand side.
We can write it like so
$$
\alpha = (\alpha^{t, r}) \in
\bigoplus\nolimits_{t + r = n} \Hom^t(L^\bullet, M^\bullet) \otimes K^r
$$
Each $\alpha^{t, r}$ maps to an element
$$
\alpha^{t, r} \mapsto (\alpha^{p, q, r}) \in
\prod\nolimits_{p + q = t} \Hom_R(L^{-q}, M^p) \otimes_R K^r
$$
Our sign rules tell us that
\begin{align*}
\text{d}(\alpha^{p, q, r})
& =
\text{d}_{\Hom^\bullet(L^\bullet, M^\bullet)}(\alpha^{p, q, r})
+ (-1)^{p + q} \text{d}_K(\alpha^{p, q, r})
\end{align*}
where if we further write $\alpha^{p, q, r} = \sum g_i^{p, q} \otimes k_i^r$
then we have
$$
\text{d}_{\Hom^\bullet(L^\bullet, M^\bullet)}(\alpha^{p, q, r}) =
\sum (\text{d}_M \circ g_i^{p, q}) \otimes k_i^r
- (-1)^{p + q} \sum (g_i^{p, q} \circ \text{d}_L) \otimes k_i^r
$$
We conclude that in some unspecified sense $\text{d}(\alpha^{p, q, r})$
is a sum of three terms with signs as follows
\begin{equation}
\label{equation-alpha}
\text{d}(\alpha^{p, q, r}) =
\text{d}_M(\alpha^{p, q, r})
-(-1)^{p + q}\text{d}_L(\alpha^{p, q, r}) +
(-1)^{p + q}\text{d}_K(\alpha^{p, q, r})
\end{equation}

\noindent
To define our map we will use the canonical maps
$$
c_{p, q, r} : 
\Hom_R(L^{-q}, M^p) \otimes_R K^r
\longrightarrow
\Hom_R(\Hom_R(K^r, L^{-q}), M^p)
$$
which sends $\varphi \otimes k$ to the map $\psi \mapsto \varphi(\psi(k))$.
This is functorial in all three variables. With $s = q + r$
there is an inclusion
$$
\Hom_R(\Hom_R(K^r, L^{-q}), M^p) \subset
\Hom_R(\Hom^{-s}(K^\bullet, L^\bullet), M^p)
$$
coming from the projection
$\Hom^{-s}(K^\bullet, L^\bullet) \to \Hom_R(K^r, L^{-q})$.
Since $\alpha^{p, q, r}$
is nonzero only for a finite number of $r$ we see that for a given
$s$ there is only a finite number of $q, r$ with $q + r = s$.
Thus we can send $\alpha$ to the element $\beta$ with
$$
\beta^{p, s} =
\sum\nolimits_{q + r = s} \epsilon_{p, q, r} c_{p, q, r}(\alpha^{p, q, r})
$$
where where the sum uses the inclusions given above and where
$\epsilon_{p, q, r} \in \{\pm 1\}$. Comparing signs in the
equations (\ref{equation-beta}) and (\ref{equation-alpha})
we see that
\begin{enumerate}
\item $\epsilon_{p, q, r} = \epsilon_{p + 1, q, r}$
\item $-(-1)^n\epsilon_{p, q, r} = -(-1)^{p + q}\epsilon_{p, q - 1, r}$
or equivalently $\epsilon_{p, q, r} = (-1)^r\epsilon_{p, q - 1, r}$
\item $(-1)^{p + 1}\epsilon_{p, q, r} = (-1)^{p + q}\epsilon_{p, q, r + 1}$
or equivalently
$(-1)^{q + 1}\epsilon_{p, q, r} = \epsilon_{p, q, r + 1}$.
\end{enumerate}
A good solution is to take
$$
\epsilon_{p, r, s} = (-1)^{r + qr}
$$
The choice of this sign is explained in the remark following
the proof.
\end{proof}

\begin{remark}
\label{remark-sign-explanation}
Let us explain why the sign used in the direct construction in the proof
of Lemma \ref{lemma-evaluate-and-more} agrees with the sign we get
from the construction using the discussion in Remark \ref{remark-internal-hom}
and Categories, Remark \ref{categories-remark-internal-hom-monoidal}.
Denote $- \otimes - = \text{Tot}(- \otimes_R -)$ and
$hom(-, -) = \Hom^\bullet(-, -)$. The construction using monoidal
category language tells us to use the arrow
$$
hom(L^\bullet, M^\bullet) \otimes K^\bullet
\longrightarrow
hom(hom(K^\bullet, L^\bullet), M^\bullet)
$$
in $\text{Comp}(R)$ corresponding to the arrow
$$
hom(L^\bullet, M^\bullet) \otimes K^\bullet \otimes hom(K^\bullet, L^\bullet)
\longrightarrow
M^\bullet
$$
gotten by swapping the order of the last two tensor products and
then using the evaluation maps
$hom(K^\bullet, L^\bullet) \otimes K^\bullet \to L^\bullet$ and
$hom(L^\bullet, K^\bullet) \otimes L^\bullet \to M^\bullet$.
Only in swapping does a sign intervene. Namely, in the isomorphism
$$
K^\bullet \otimes hom(K^\bullet, L^\bullet)
\to
hom(K^\bullet, L^\bullet) \otimes K^\bullet
$$
there is a sign $(-1)^{r(q + r')}$ on
$K^r \otimes_R \Hom_R(K^{-r'}, L^q)$, see
Section \ref{section-sign-rules} item (\ref{item-flip-tensor-product}).
The reader can convince themselves that, because of the
correspondence we are using to describe maps into an internal hom,
this sign only matters if $r = r'$ and in this case
we obtain $(-1)^{r(q + r)} = (-1)^{r + qr}$ as in the direct proof.
\end{remark}







\section{Sign rules}
\label{section-sign-rules}

\noindent
In this section we review the sign rules used so far and we discuss
some of their ramifications. It also seems appropriate to discuss
these issues in the setting of the category of complexes of modules
over a ring, as most interesting phenomena already occur in this case.
We sincerely hope the reader will not
need to use the more esoteric aspects of this section.

\medskip\noindent
For the rest of this section, we fix a ring $R$ and we denote
$M^\bullet$ a complex of $R$-modules with differentials
$d^n_M : M^n \to M^{n + 1}$.
\begin{enumerate}
\item The $k$th shifted complex $M^\bullet[k]$ has terms
$(M^\bullet[k])^n = M^{n + k}$ and differentials
$d_{M[k]}^n = (-1)^kd^{n + k}_M$, see
Homology, Definition \ref{homology-definition-shift-cochain}.
\item Given a map $f : M^\bullet \to N^\bullet$ of complexes, we define
$f[k] : M^\bullet[k] \to N^\bullet[k]$ without the intervention of signs, see
Homology, Definition \ref{homology-definition-shift-cochain}.
\item We identify $H^n(M^\bullet[k])$ with $H^{n + k}(M^\bullet)$
without the intervention of signs, see
Homology, Definition \ref{homology-definition-cohomology-shift}.
\item The boundary map of a short exact sequence of complexes
is defined as in the snake lemma without the intervention of signs, see
Homology, Lemma \ref{homology-lemma-long-exact-sequence-cochain}.
\item The distinguished triangle associated to a termwise split
short exact sequence $0 \to K^\bullet \to L^\bullet \to M^\bullet \to 0$
of complexes is given by
$$
K^\bullet \to L^\bullet \to M^\bullet \to K^\bullet[1]
$$
where $M^n \to K^{n + 1}$ is the map $\pi^{n + 1} \circ d^n_L \circ s^n$
if $s$ and $\pi$ are compatible termwise splittings. In other words,
without the intervention of signs. See
Derived Categories, Definitions \ref{derived-definition-distinguished-triangle}
and \ref{derived-definition-split-ses}.
\item The total complex $\text{Tot}(M^\bullet \otimes_R N^\bullet)$
has differential $d$ satisfying the Leibniz rule
$d(x \otimes y) = d(x) \otimes y + (-1)^{\deg(x)}x \otimes d(y)$.
See Homology, Example
\ref{homology-example-double-complex-as-tensor-product-of} and
Homology, Definition \ref{homology-definition-associated-simple-complex}.
\item
\label{item-shift-tensor}
There is a canonical isomorphism
$$
\text{Tot}(M^\bullet \otimes_R N^\bullet)[a + b] \to
\text{Tot}(M^\bullet[a] \otimes_R N^\bullet[b])
$$
which uses the sign $(-1)^{pb}$ on the summand $M^p \otimes_R N^q$,
see Homology, Remark \ref{homology-remark-shift-double-complex}. It
is often more convenient to consider the corresponding shifted map
$\text{Tot}(M^\bullet \otimes_R N^\bullet) \to
\text{Tot}(M^\bullet[a] \otimes_R N^\bullet[b])[-a - b]$.
\item There is a canonical isomorphism of complexes
$$
\text{Tot}(
\text{Tot}(K^\bullet \otimes_R L^\bullet) \otimes_R M^\bullet) \to
\text{Tot}(K^\bullet \otimes_R \text{Tot}(L^\bullet \otimes_R M^\bullet))
$$
defined without the intervention of signs. See
Section \ref{section-symmetric-monoidal}.
\item
\label{item-flip-tensor-product}
There is a canonical isomorphism
$$
\text{Tot}(L^\bullet \otimes_R M^\bullet) \to
\text{Tot}(M^\bullet \otimes_R L^\bullet)
$$
which uses the sign $(-1)^{pq}$ on the summand $L^p \otimes_R M^q$.
See Section \ref{section-symmetric-monoidal}.
\end{enumerate}
Before we get into a discussion of the sign conventions regarding
Hom-complexes, we construct the dual of a complex with respect to
the conventions above.

\begin{lemma}
\label{lemma-left-dual-module}
Let $R$ be a ring. Let $M$ be an $R$-module. Let  $N, \eta, \epsilon$
be a left dual of $M$ in the monoidal category of $R$-modules, see
Categories, Definition \ref{categories-definition-dual}. Then
\begin{enumerate}
\item $M$ and $N$ are finite projective $R$-modules,
\item the map
$e : \Hom_R(M, R) \to N$, $\lambda \mapsto (\lambda \otimes 1)(\eta)$
is an isomorphism,
\item we have $\epsilon(n, m) = e^{-1}(n)(m)$ for $n \in N$ and $m \in M$.
\end{enumerate}
\end{lemma}

\begin{proof}
The assumptions mean that
$$
M \xrightarrow{\eta \otimes 1} M \otimes_R N \otimes_R M
\xrightarrow{1 \otimes \epsilon} M
\quad\text{and}\quad
N \xrightarrow{1 \otimes \eta} N \otimes_R M \otimes_R N
\xrightarrow{\epsilon \otimes 1} N
$$
are the identity map. We can choose a finite free module $F$, an $R$-module
map $F \to M$, and a lift $\tilde \eta : R \to F \otimes_R N$
of $\eta$. We obtain a commutative diagram
$$
\xymatrix{
M \ar[rr]_-{\eta \otimes 1} \ar[rrd]_-{\tilde \eta \otimes 1} & &
M \otimes_R N \otimes_R M \ar[r]_-{1 \otimes \epsilon} &
M \\
& &
F \otimes_R N \otimes_R M \ar[u] \ar[r]^-{1 \otimes \epsilon} &
F \ar[u]
}
$$
This shows that the identity on $M$ factors through a finite free module
and hence $M$ is finite projective. By symmetry we see that $N$ is
finite projective. This proves part (1). Part (2) follows from
Categories, Lemma \ref{categories-lemma-left-dual} and its proof.
Part (3) follows from the first equality of the proof.
\end{proof}

\begin{lemma}
\label{lemma-left-dual-complex}
Let $R$ be a ring. Let $M^\bullet$ be a complex of $R$-modules.
Let $N^\bullet, \eta, \epsilon$ be a left dual of $M^\bullet$
in the monoidal category of complexes of $R$-modules.
Then
\begin{enumerate}
\item $M^\bullet$ and $N^\bullet$ are bounded,
\item $M^n$ and $N^n$ are finite projective $R$-modules,
\item writing $\epsilon = \sum \epsilon_n$
with $\epsilon_n : N^{-n} \otimes_R M^n \to R$ and $\eta = \sum \eta_n$
with $\eta_n : R \to  M^n \otimes_R N^{-n}$ then $(N^{-n}, \eta_n, \epsilon_n)$
is the left dual of $M^n$ as in Lemma \ref{lemma-left-dual-module},
\item the differential $d_N^n : N^n \to N^{n + 1}$ is equal
to $-(-1)^n$ times the map
$$
N^n = \Hom_R(M^{-n}, R)
\xrightarrow{d_M^{-n - 1}}
\Hom_R(M^{-n - 1}, R) = N^{n + 1}
$$
where the equality signs are the identifications from
Lemma \ref{lemma-left-dual-module} part (2).
\end{enumerate}
Conversely, given a bounded complex $M^\bullet$ of finite projective
$R$-modules, setting $N^n = \Hom_R(M^{-n}, R)$ with differentials as above,
setting $\epsilon = \sum \epsilon_n$ with
$\epsilon_n : N^{-n} \otimes_R M^n \to R$ given by evaluation, and
setting $\eta = \sum \eta_n$ with $\eta_n : R \to M^n \otimes_R N^{-n}$
mapping $1$ to $\text{id}_{M_n}$ we obtain a left dual of $M^\bullet$
in the monoidal category of complexes of $R$-modules.
\end{lemma}

\begin{proof}
Since $(1 \otimes \epsilon) \circ (\eta \otimes 1) = \text{id}_{M^\bullet}$
and $(\epsilon \otimes 1) \circ (1 \otimes \eta) = \text{id}_{N^\bullet}$ by
Categories, Definition \ref{categories-definition-dual} we see immediately
that we have
$(1 \otimes \epsilon_n) \circ (\eta_n \otimes 1) = \text{id}_{M^n}$
and $(\epsilon_n \otimes 1) \circ (1 \otimes \eta_n) = \text{id}_{N^{-n}}$
which proves (3). By Lemma \ref{lemma-left-dual-module} we have (2).
Since the sum $\eta = \sum \eta_n$ is finite, we get (1).
Since $\eta = \sum \eta_n$ is a map of complexes
$R \to \text{Tot}(M^\bullet \otimes_R N^\bullet)$ we see that
$$
(d_M^{-n - 1} \otimes 1) \circ \eta_{-n - 1}  +
(-1)^n (1 \otimes d_N^{-n}) \circ \eta_{-n} = 0
$$
by our choice of signs for the differential on
$\text{Tot}(M^\bullet \otimes_R N^\bullet)$.
Unwinding definitions, this proves (4). To see the final statement
of the lemma one reads the above backwards.
\end{proof}

\noindent
We will use the description of the left dual of a complex
in Lemma \ref{lemma-left-dual-complex} as a motivation for our sign rule on the
$\Hom$-complex. Namelly, we choose the signs such that
(\ref{item-compatible}) holds.
We continue with the discussion of various sign rules as above
\begin{enumerate}
\setcounter{enumi}{9}
\item Given complexes $K^\bullet$, $M^\bullet$ we let
$\Hom^\bullet(M^\bullet, K^\bullet)$ be the complex with
terms
$$
\Hom^n(M^\bullet, K^\bullet) = \prod\nolimits_{n = p + q} \Hom_R(M^{-q}, K^p)
$$
and differential given by the rule
$$
d(f) = d_K \circ f - (-1)^n f \circ d_M
$$
\item
\label{item-compatible}
The choice above is such that if $M^\bullet$ has a left
dual $N^\bullet$ as in Lemma \ref{lemma-left-dual-complex},
then we have a canonical isomorphism
$$
\text{Tot}(K^\bullet \otimes_R N^\bullet)
\longrightarrow
\Hom^\bullet(M^\bullet, K^\bullet)
$$
defined without the intervention of signs sending the summand
$K^p \otimes_R N^q$ to the summand $\Hom_R(M^{-q}, K^p)$
via $N^q = \Hom_R(M^{-q}, R)$ and the canonical map
$K^p \otimes_R \Hom_R(M^{-q}, R) \to \Hom_R(M^{-q}, K^p)$.
\item There is a composition
$$
\text{Tot}(
\Hom^\bullet(L^\bullet, K^\bullet) \otimes_R
\Hom^\bullet(M^\bullet, L^\bullet))
\longrightarrow
\Hom^\bullet(M^\bullet, K^\bullet)
$$
defined without the intervention of signs, see
Lemma \ref{lemma-composition}.
\item There is a canonical isomorphism
$$
\Hom^\bullet(K^\bullet, \Hom^\bullet(L^\bullet, M^\bullet))
=
\Hom^\bullet(\text{Tot}(K^\bullet \otimes_R L^\bullet), M^\bullet)
$$
defined without the intervention of signs, see
Lemma \ref{lemma-compose}.
\item There is a canonical map
$$
\text{Tot}(K^\bullet \otimes_R \Hom^\bullet(M^\bullet, L^\bullet))
\longrightarrow
\Hom^\bullet(M^\bullet, \text{Tot}(K^\bullet \otimes_R L^\bullet))
$$
defined without the intervention of signs, see
Lemma \ref{lemma-diagonal-better}.
\item There is a canonical map
$$
K^\bullet
\longrightarrow
\Hom^\bullet(L^\bullet, \text{Tot}(K^\bullet \otimes_R L^\bullet))
$$
defined without the intervention of signs, see
Lemma \ref{lemma-diagonal}.
\item By Lemma \ref{lemma-evaluate-and-more} is a canonical map
$$
\text{Tot}(\Hom^\bullet(L^\bullet, M^\bullet) \otimes_R K^\bullet)
\longrightarrow
\Hom^\bullet(\Hom^\bullet(K^\bullet, L^\bullet), M^\bullet)
$$
which uses a sign $(-1)^{r + qr}$ on the module
$\Hom_R(L^{-q}, M^p) \otimes_R K^r$
whose reason is explained in Remark \ref{remark-sign-explanation}.
\item
\label{item-evaluation}
Taking $L^\bullet = M^\bullet$ and using
$R \to \Hom^\bullet(M^\bullet, M^\bullet)$ the map from the
previous item becomes the evaluation map
$$
ev : K^\bullet \longrightarrow
\Hom^\bullet(\Hom^\bullet(K^\bullet, M^\bullet), M^\bullet)
$$
It sends $x \in K^n$ to the map which sends
$f \in \Hom^m(K^\bullet, M^\bullet)$ to $(-1)^{nm}f(x)$.
\item
\label{item-shift-hom}
There is a canonical identification
$$
\Hom^\bullet(M^\bullet, K^\bullet)[a - b] \to
\Hom^\bullet(M^\bullet[b], K^\bullet[a])
$$
which uses signs. It is defined as the map whose corresponding shifted map
$$
\Hom^\bullet(M^\bullet, K^\bullet) \to
\Hom^\bullet(M^\bullet[b], K^\bullet[a])[b - a]
$$
uses the sign $(-1)^{nb}$ on the module $\Hom_R(M^{-q}, K^p)$
with $p + q = n$. Namely, if $f \in \Hom^n(M^\bullet, K^\bullet)$ then
$$
d(f) = d_K \circ f - (-1)^n f \circ d_M
$$
on the source, whereas on the target $f$ lies in
$\left(\Hom^\bullet(M^\bullet[b], K^\bullet[a])[b - a]\right)^n =
\Hom^{n + b -a}(M^\bullet[b], K^\bullet[a])$ and hence
we get
\begin{align*}
d(f) & =
(-1)^{b - a}
\left(d_{K[a]} \circ f - (-1)^{n + b - a} f \circ d_{M[b]}\right) \\
& =
(-1)^{b - a}
\left((-1)^a d_K \circ f - (-1)^{n + b - a} f \circ (-1)^b d_M \right) \\
& =
(-1)^b d_K \circ f - (-1)^{n + b} f \circ d_M
\end{align*}
and one sees that the chosen sign of $(-1)^{nb}$ in degree $n$
produces a map of complexes for these differentials.
\end{enumerate}








\section{Derived hom}
\label{section-RHom}

\noindent
Let $R$ be a ring. The derived hom we will define in this section is a functor
$$
D(R)^{opp} \times D(R) \longrightarrow D(R),\quad
(K, L) \longmapsto R\Hom_R(K, L)
$$
This is an internal hom in the derived category of
$R$-modules in the sense that it is characterized by the formula
\begin{equation}
\label{equation-internal-hom}
\Hom_{D(R)}(K, R\Hom_R(L, M))
=
\Hom_{D(R)}(K \otimes_R^\mathbf{L} L, M)
\end{equation}
for objects $K, L, M$ of $D(R)$. Note that this formula characterizes
the objects up to unique isomorphism by the Yoneda lemma. A construction
can be given as follows. Choose a K-injective complex $I^\bullet$
of $R$-modules representing $M$, choose a complex $L^\bullet$
representing $L$, and set
$$
R\Hom_R(L, M) = \Hom^\bullet(L^\bullet, I^\bullet)
$$
with notation as in Section \ref{section-hom-complexes}.
A generalization of this construction is discussed in
Differential Graded Algebra, Section \ref{dga-section-restriction}.
From (\ref{equation-cohomology-hom-complex}) and
Derived Categories, Lemma \ref{derived-lemma-K-injective}
that we have
\begin{equation}
\label{equation-h0-RHom}
H^n(R\Hom_R(L, M)) = \Hom_{D(R)}(L, M[n])
\end{equation}
for all $n \in \mathbf{Z}$. In particular, the object
$R\Hom_R(L, M)$ of $D(R)$ is well defined, i.e., independent of
the choice of the K-injective complex $I^\bullet$.

\begin{lemma}
\label{lemma-internal-hom}
Let $R$ be a ring. Let $K, L, M$ be objects of $D(R)$. There is a canonical
isomorphism
$$
R\Hom_R(K, R\Hom_R(L, M)) = R\Hom_R(K \otimes_R^\mathbf{L} L, M)
$$
in $D(R)$ functorial in $K, L, M$ which recovers
(\ref{equation-internal-hom}) by taking $H^0$.
\end{lemma}

\begin{proof}
Choose a K-injective complex $I^\bullet$ representing
$M$ and a K-flat complex of $R$-modules $L^\bullet$
representing $L$. For any complex of $R$-modules $K^\bullet$
we have
$$
\Hom^\bullet(K^\bullet, \Hom^\bullet(L^\bullet, I^\bullet)) =
\Hom^\bullet(\text{Tot}(K^\bullet \otimes_R L^\bullet), I^\bullet)
$$
by Lemma \ref{lemma-compose}. The lemma follows by the definition
of $R\Hom$ and because
$\text{Tot}(K^\bullet \otimes_R L^\bullet)$
represents the derived tensor product.
\end{proof}

\begin{lemma}
\label{lemma-RHom-out-of-projective}
Let $R$ be a ring. Let $P^\bullet$ be a bounded above complex
of projective $R$-modules. Let $L^\bullet$ be a complex of $R$-modules.
Then $R\Hom_R(P^\bullet, L^\bullet)$ is represented by the complex
$\Hom^\bullet(P^\bullet, L^\bullet)$.
\end{lemma}

\begin{proof}
By (\ref{equation-cohomology-hom-complex}) and
Derived Categories, Lemma \ref{derived-lemma-morphisms-from-projective-complex}
the cohomology groups of the complex are ``correct''.
Hence if we choose a quasi-isomorphism $L^\bullet \to I^\bullet$
with $I^\bullet$ a K-injective complex of $R$-modules
then the induced map
$$
\Hom^\bullet(P^\bullet, L^\bullet)
\longrightarrow
\Hom^\bullet(P^\bullet, I^\bullet)
$$
is a quasi-isomorphism. As the right hand side is our definition
of $R\Hom_R(P^\bullet, L^\bullet)$ we win.
\end{proof}

\begin{lemma}
\label{lemma-internal-hom-evaluate}
Let $R$ be a ring. Let $K, L, M$ be objects of $D(R)$.
There is a canonical morphism
$$
R\Hom_R(L, M) \otimes_R^\mathbf{L} K
\longrightarrow
R\Hom_R(R\Hom_R(K, L), M)
$$
in $D(R)$ functorial in $K, L, M$.
\end{lemma}

\begin{proof}
Choose
a K-injective complex $I^\bullet$ representing $M$,
a K-injective complex $J^\bullet$ representing $L$, and
a K-flat complex $K^\bullet$ representing $K$.
The map is defined using the map
$$
\text{Tot}(\Hom^\bullet(J^\bullet, I^\bullet) \otimes_R K^\bullet)
\longrightarrow
\Hom^\bullet(\Hom^\bullet(K^\bullet, J^\bullet), I^\bullet)
$$
of Lemma \ref{lemma-evaluate-and-more}. We omit the proof that
this is functorial in all three objects of $D(R)$.
\end{proof}

\begin{lemma}
\label{lemma-internal-hom-composition}
Let $R$ be a ring. Given $K, L, M$ in $D(R)$ there is a canonical morphism
$$
R\Hom_R(L, M) \otimes_R^\mathbf{L} R\Hom_R(K, L) \longrightarrow R\Hom_R(K, M)
$$
in $D(R)$ functorial in $K, L, M$.
\end{lemma}

\begin{proof}
Choose a K-injective complex $I^\bullet$ representing $M$,
a K-injective complex $J^\bullet$ representing $L$, and
any complex of $R$-modules $K^\bullet$ representing $K$.
By Lemma \ref{lemma-composition} there is a map of complexes
$$
\text{Tot}\left(
\Hom^\bullet(J^\bullet, I^\bullet) \otimes_R \Hom^\bullet(K^\bullet, J^\bullet)
\right)
\longrightarrow
\Hom^\bullet(K^\bullet, I^\bullet)
$$
The complexes of $R$-modules $\Hom^\bullet(J^\bullet, I^\bullet)$,
$\Hom^\bullet(K^\bullet, J^\bullet)$, and $\Hom^\bullet(K^\bullet, I^\bullet)$
represent $R\Hom_R(L, M)$, $R\Hom_R(K, L)$, and $R\Hom_R(K, M)$.
If we choose a K-flat complex $H^\bullet$ and a quasi-isomorphism
$H^\bullet \to \Hom^\bullet(K^\bullet, J^\bullet)$, then there is a map
$$
\text{Tot}\left(
\Hom^\bullet(J^\bullet, I^\bullet) \otimes_R H^\bullet
\right)
\longrightarrow
\text{Tot}\left(
\Hom^\bullet(J^\bullet, I^\bullet) \otimes_R \Hom^\bullet(K^\bullet, J^\bullet)
\right)
$$
whose source represents $R\Hom_R(L, M) \otimes_R^\mathbf{L} R\Hom_R(K, L)$.
Composing the two displayed arrows gives the desired map. We omit the
proof that the construction is functorial.
\end{proof}

\begin{lemma}
\label{lemma-internal-hom-diagonal-better}
Let $R$ be a ring. Given complexes $K, L, M$ in $D(R)$
there is a canonical morphism
$$
K \otimes_R^\mathbf{L} R\Hom_R(M, L)
\longrightarrow
R\Hom_R(M, K \otimes_R^\mathbf{L} L)
$$
in $D(R)$ functorial in $K$, $L$, $M$.
\end{lemma}

\begin{proof}
Choose a K-flat complex $K^\bullet$ representing $K$,
and a K-injective complex $I^\bullet$ representing $L$, and
choose any complex $M^\bullet$ representing $M$.
Choose a quasi-isomorphism
$\text{Tot}(K^\bullet \otimes_R I^\bullet) \to J^\bullet$
where $J^\bullet$ is K-injective. Then we use the map
$$
\text{Tot}\left(
K^\bullet \otimes_R \Hom^\bullet(M^\bullet, I^\bullet)
\right)
\to
\Hom^\bullet(M^\bullet, \text{Tot}(K^\bullet \otimes_R I^\bullet))
\to
\Hom^\bullet(M^\bullet, J^\bullet)
$$
where the first map is the map from Lemma \ref{lemma-diagonal-better}.
\end{proof}

\begin{lemma}
\label{lemma-internal-hom-diagonal}
Let $R$ be a ring. Given complexes $K, L$ in $D(R)$
there is a canonical morphism
$$
K \longrightarrow R\Hom_R(L, K \otimes_R^\mathbf{L} L)
$$
in $D(R)$ functorial in both $K$ and $L$.
\end{lemma}

\begin{proof}
This is a special case of Lemma \ref{lemma-internal-hom-diagonal-better}
but we will also prove it directly.
Choose a K-flat complex $K^\bullet$ representing $K$ and
any complex $L^\bullet$ representing $L$. Choose a quasi-isomorphism
$\text{Tot}(K^\bullet \otimes_R L^\bullet) \to J^\bullet$
where $J^\bullet$ is K-injective. Then we use the map
$$
K^\bullet \to
\Hom^\bullet(L^\bullet, \text{Tot}(K^\bullet \otimes_R L^\bullet))
\to \Hom^\bullet(L^\bullet, J^\bullet)
$$
where the first map is the map from Lemma \ref{lemma-diagonal}.
\end{proof}









\section{Perfect complexes}
\label{section-perfect}

\noindent
A perfect complex is a pseudo-coherent complex of finite tor dimension.
We will not use this as the definition, but define perfect complexes
over a ring directly as follows.

\begin{definition}
\label{definition-perfect}
Let $R$ be a ring. Denote $D(R)$ the derived category of the abelian
category of $R$-modules.
\begin{enumerate}
\item An object $K$ of $D(R)$ is {\it perfect} if it is quasi-isomorphic
to a bounded complex of finite projective $R$-modules.
\item An $R$-module $M$ is {\it perfect} if $M[0]$ is a perfect object
in $D(R)$.
\end{enumerate}
\end{definition}

\noindent
For example, over a Noetherian ring a finite module is perfect if and
only if it has finite projective dimension, see
Lemma \ref{lemma-perfect-module}
and Algebra, Definition \ref{algebra-definition-finite-proj-dim}.

\begin{lemma}
\label{lemma-perfect}
Let $K^\bullet$ be an object of $D(R)$. The following are equivalent
\begin{enumerate}
\item $K^\bullet$ is perfect, and
\item $K^\bullet$ is pseudo-coherent and has finite tor dimension.
\end{enumerate}
If (1) and (2) hold and $K^\bullet$ has tor-amplitude
in $[a, b]$, then $K^\bullet$ is quasi-isomorphic to a complex
$E^\bullet$ of finite projective $R$-modules with $E^i = 0$
for $i \not \in [a, b]$.
\end{lemma}

\begin{proof}
It is clear that (1) implies (2), see
Lemmas \ref{lemma-pseudo-coherent} and \ref{lemma-tor-amplitude}.
Assume (2) holds and that $K^\bullet$ has tor-amplitude in $[a, b]$.
In particular, $H^i(K^\bullet) = 0$ for $i > b$.
Choose a complex $F^\bullet$ of finite free $R$-modules with
$F^i = 0$ for $i > b$ and a quasi-isomorphism $F^\bullet \to K^\bullet$
(Lemma \ref{lemma-pseudo-coherent}).
Set $E^\bullet = \tau_{\geq a}F^\bullet$. Note that $E^i$ is finite
free except $E^a$ which is a finitely presented $R$-module. By
Lemma \ref{lemma-last-one-flat} $E^a$ is flat. Hence by
Algebra, Lemma \ref{algebra-lemma-finite-projective}
we see that $E^a$ is finite projective.
\end{proof}

\begin{lemma}
\label{lemma-perfect-module}
Let $M$ be a module over a ring $R$. The following are equivalent
\begin{enumerate}
\item $M$ is a perfect module, and
\item there exists a resolution
$$
0 \to F_d \to \ldots \to F_1 \to F_0 \to M \to 0
$$
with each $F_i$ a finite projective $R$-module.
\end{enumerate}
\end{lemma}

\begin{proof}
Assume (2). Then the complex $E^\bullet$ with $E^{-i} = F_i$
is quasi-isomorphic to $M[0]$. Hence $M$ is perfect.
Conversely, assume (1). By
Lemmas \ref{lemma-perfect} and \ref{lemma-n-pseudo-module}
we can find resolution $E^\bullet \to M$ with $E^{-i}$ a finite free
$R$-module. By
Lemma \ref{lemma-last-one-flat}
we see that $F_d = \Coker(E^{d - 1} \to E^d)$ is flat for
some $d$ sufficiently large. By
Algebra, Lemma \ref{algebra-lemma-finite-projective}
we see that $F_d$ is finite projective.
Hence
$$
0 \to F_d \to E^{-d+1} \to \ldots \to E^0 \to M \to 0
$$
is the desired resolution.
\end{proof}

\begin{lemma}
\label{lemma-two-out-of-three-perfect}
Let $R$ be a ring. Let $(K^\bullet, L^\bullet, M^\bullet, f, g, h)$
be a distinguished triangle in $D(R)$. If two out of three of
$K^\bullet, L^\bullet, M^\bullet$ are
perfect then the third is also perfect.
\end{lemma}

\begin{proof}
Combine
Lemmas \ref{lemma-perfect}, \ref{lemma-two-out-of-three-pseudo-coherent}, and
\ref{lemma-cone-tor-amplitude}.
\end{proof}

\begin{lemma}
\label{lemma-summands-perfect}
Let $R$ be a ring. If $K^\bullet \oplus L^\bullet$ is perfect, then
so are $K^\bullet$ and $L^\bullet$.
\end{lemma}

\begin{proof}
Follows from
Lemmas \ref{lemma-perfect}, \ref{lemma-summands-pseudo-coherent}, and
\ref{lemma-summands-tor-amplitude}.
\end{proof}

\begin{lemma}
\label{lemma-complex-perfect-modules}
Let $R$ be a ring. Let $K^\bullet$ be a bounded complex of perfect
$R$-modules. Then $K^\bullet$ is a perfect complex.
\end{lemma}

\begin{proof}
Follows by induction on the length of the finite complex: use
Lemma \ref{lemma-two-out-of-three-perfect}
and the stupid truncations.
\end{proof}

\begin{lemma}
\label{lemma-cohomology-perfect}
Let $R$ be a ring. If $K^\bullet \in D^b(R)$ and all its cohomology
modules are perfect, then $K^\bullet$ is perfect.
\end{lemma}

\begin{proof}
Follows by induction on the length of the finite complex: use
Lemma \ref{lemma-two-out-of-three-perfect}
and the canonical truncations.
\end{proof}

\begin{lemma}
\label{lemma-perfect-push-perfect}
Let $A \to B$ be a ring map. Assume that $B$ is perfect as
an $A$-module. Let $K^\bullet$ be a perfect complex of $B$-modules.
Then $K^\bullet$ is perfect as a complex of $A$-modules.
\end{lemma}

\begin{proof}
Using
Lemma \ref{lemma-perfect}
this translates into the corresponding results for pseudo-coherent modules
and modules of finite tor dimension. See
Lemma \ref{lemma-finite-tor-dimension-push-tor-amplitude}
and
Lemma \ref{lemma-finite-push-pseudo-coherent}
for those results.
\end{proof}

\begin{lemma}
\label{lemma-pull-perfect}
Let $A \to B$ be a ring map.
Let $K^\bullet$ be a perfect
complex of $A$-modules. Then $K^\bullet \otimes_A^{\mathbf{L}} B$
is a perfect complex of $B$-modules.
\end{lemma}

\begin{proof}
Using
Lemma \ref{lemma-perfect}
this translates into the corresponding results for pseudo-coherent modules
and modules of finite tor dimension. See
Lemma \ref{lemma-pull-tor-amplitude}
and
Lemma \ref{lemma-pull-pseudo-coherent}
for those results.
\end{proof}

\begin{lemma}
\label{lemma-flat-base-change-perfect}
Let $A \to B$ be a flat ring map. Let $M$ be a perfect $A$-module.
Then $M \otimes_A B$ is a perfect $B$-module.
\end{lemma}

\begin{proof}
By
Lemma \ref{lemma-perfect-module}
the assumption implies that $M$ has a finite resolution $F_\bullet$ by
finite projective $R$-modules. As $A \to B$ is flat the complex
$F_\bullet \otimes_A B$ is a finite length resolution of $M \otimes_A B$
by finite projective modules over $B$. Hence $M \otimes_A B$ is perfect.
\end{proof}

\begin{lemma}
\label{lemma-tensor-perfect}
Let $R$ be a ring. If $K$ and $L$ are perfect objects of $D(R)$, then
$K \otimes_R^\mathbf{L} L$ is a perfect object too.
\end{lemma}

\begin{proof}
We can prove this using the definition as follows. We may represent
$K$, resp.\ $L$ by a bounded complex $K^\bullet$, resp.\ $L^\bullet$
of finite projective $R$-modules. Then $K \otimes_R^\mathbf{L} L$
is represented by the bounded complex
$\text{Tot}(K^\bullet \otimes_R L^\bullet)$.
The terms of this complex are direct sums of the modules
$M^a \otimes_R L^b$. Since $M^a$ and $L^b$ are direct summands
of finite free $R$-modules, so is $M^a \otimes_R L^b$. Hence we
conclude the terms of the complex $\text{Tot}(K^\bullet \otimes_R L^\bullet)$
are finite projective.

\medskip\noindent
Another proof can be given using the characterization of perfect
complexes in Lemma \ref{lemma-perfect} and the corresponding
lemmas for pseudo-coherent complexes (Lemma \ref{lemma-tensor-pseudo-coherent})
and for tor amplitude (Lemma \ref{lemma-push-tor-amplitude} used
with $A = B = R$).
\end{proof}

\begin{lemma}
\label{lemma-glue-perfect}
Let $R$ be a ring. Let $f_1, \ldots, f_r \in R$ be elements which
generate the unit ideal. Let $K^\bullet$
be a complex of $R$-modules. If for each $i$ the complex
$K^\bullet \otimes_R R_{f_i}$ is perfect,
then $K^\bullet$ is perfect.
\end{lemma}

\begin{proof}
Using
Lemma \ref{lemma-perfect}
this translates into the corresponding results for pseudo-coherent modules
and modules of finite tor dimension. See
Lemma \ref{lemma-glue-tor-amplitude}
and
Lemma \ref{lemma-glue-pseudo-coherent}
for those results.
\end{proof}

\begin{lemma}
\label{lemma-flat-descent-perfect}
Let $R$ be a ring. Let $K^\bullet$ be a complex of $R$-modules.
Let $R \to R'$ be a faithfully flat ring map. If the complex
$K^\bullet \otimes_R R'$ is perfect, then $K^\bullet$ is perfect.
\end{lemma}

\begin{proof}
Using
Lemma \ref{lemma-perfect}
this translates into the corresponding results for pseudo-coherent modules
and modules of finite tor dimension. See
Lemma \ref{lemma-flat-descent-tor-amplitude}
and
Lemma \ref{lemma-flat-descent-pseudo-coherent}
for those results.
\end{proof}

\begin{lemma}
\label{lemma-regular-perfect}
Let $R$ be a regular ring. Then
\begin{enumerate}
\item an $R$-module is perfect if and only if it is a finite $R$-module, and
\item a complex of $R$-modules $K^\bullet$ is perfect if and only
if $K^\bullet \in D^b(R)$ and each $H^i(K^\bullet)$ is a finite $R$-module.
\end{enumerate}
\end{lemma}

\begin{proof}
Any perfect $R$-module is finite by definition. Conversely, let $M$ be
a finite $R$-module. Choose a resolution
$$
\ldots \to F_2 \xrightarrow{d_2} F_1 \xrightarrow{d_1} F_0 \to M \to 0
$$
with $F_i$ finite free $R$-modules
(Algebra, Lemma \ref{algebra-lemma-resolution-by-finite-free}).
Set $M_i = \Ker(d_i)$. Denote $U_i \subset \Spec(R)$ the set of primes
$\mathfrak p$ such that $M_{i, \mathfrak p}$ is free; $U_i$ is open by
Algebra, Lemma \ref{algebra-lemma-finitely-presented-localization-free}.
We have a exact sequence $0 \to M_{i + 1} \to F_{i + 1} \to M_i \to 0$.
If $\mathfrak p \in U_i$, then
$0 \to M_{i + 1, \mathfrak p} \to F_{i + 1, \mathfrak p} \to
M_{i, \mathfrak p} \to 0$ splits. Thus $M_{i + 1, \mathfrak p}$
is finite projective, hence free 
(Algebra, Lemma \ref{algebra-lemma-finite-projective}).
This shows that $U_i \subset U_{i + 1}$.
We claim that $\Spec(R) = \bigcup U_i$. Namely, for every prime ideal
$\mathfrak p$ the regular local ring $R_\mathfrak p$ has finite
global dimension by
Algebra, Proposition \ref{algebra-proposition-regular-finite-gl-dim}.
It follows that $M_{i, \mathfrak p}$ is finite projective
(hence free) for
$i \gg 0$ for example by Algebra, Lemma
\ref{algebra-lemma-independent-resolution}.
Since the spectrum of $R$ is Noetherian
(Algebra, Lemma \ref{algebra-lemma-Noetherian-topology})
we conclude that $U_n = \Spec(R)$
for some $n$. Then $M_n$ is a projective $R$-module by
Algebra, Lemma \ref{algebra-lemma-finite-projective}.
Thus
$$
0 \to M_n \to F_n \to \ldots \to F_1 \to M \to 0
$$
is a bounded resolution by finite projective modules
and hence $M$ is perfect.
This proves part (1).

\medskip\noindent
Let $K^\bullet$ be a complex of $R$-modules.
If $K^\bullet$ is perfect, then it is in $D^b(R)$ and it is
quasi-isomorphic to a finite complex of finite projective $R$-modules
so certainly each $H^i(K^\bullet)$ is a finite $R$-module (as $R$ is
Noetherian). Conversely, suppose that $K^\bullet$ is in $D^b(R)$
and each $H^i(K^\bullet)$ is a finite $R$-module. Then by (1) each
$H^i(K^\bullet)$ is a perfect $R$-module, whence $K^\bullet$ is
perfect by
Lemma \ref{lemma-cohomology-perfect}
\end{proof}

\begin{lemma}
\label{lemma-dual-perfect-complex}
Let $A$ be a ring. Let $K \in D(A)$ be perfect. Then $K^\vee = R\Hom_A(K, A)$
is a perfect complex and $K \cong (K^\vee)^\vee$. There are functorial
isomorphisms
$$
L \otimes_A^\mathbf{L} K^\vee = R\Hom_A(K, L)
\quad\text{and}\quad
H^0(L \otimes_A^\mathbf{L} K^\vee) = \Ext_A^0(K, L)
$$
for $L \in D(A)$.
\end{lemma}

\begin{proof}
We can represent $K$ by a complex $K^\bullet$ of finite projective
$A$-modules. By Lemma \ref{lemma-RHom-out-of-projective} the object $K^\vee$
is represented by the complex $E^\bullet = \Hom^\bullet(K^\bullet, A)$.
Note that $E^n = \Hom_A(K^{-n}, A)$ and the differentials of
$E^\bullet$ are the transpose of the differentials of $K^\bullet$
up to sign. Observe that $E^\bullet$ is the left dual of $K^\bullet$
in the symmetric monoidal category of complexes of $R$-modules, see
Lemma \ref{lemma-left-dual-complex}. There is a canonical map
$$
K^\bullet = \text{Tot}(\Hom^\bullet(A, A) \otimes_A K^\bullet)
\longrightarrow
\Hom^\bullet(\Hom^\bullet(K^\bullet, A), A)
$$
which up to sign uses the evaluation map in each degree,
see Lemma \ref{lemma-evaluate-and-more}. (For sign rules see
Section \ref{section-sign-rules}.)
Thus this map defines a canonical isomorphism $(K^\vee)^\vee \cong K$
as the double dual of a finite projective module is itself.

\medskip\noindent
The second equality follows from the first by
Lemma \ref{lemma-internal-hom} and
Derived Categories, Lemma \ref{derived-lemma-morphisms-from-projective-complex}
as well as the definition of Ext groups, see
Derived Categories, Section \ref{derived-section-ext}.
Let $L^\bullet$ be a complex of $A$-modules representing $L$.
By Section \ref{section-sign-rules} item (\ref{item-compatible})
there is a canonical isomorphism
$$
\text{Tot}(L^\bullet \otimes_A E^\bullet)
\longrightarrow
\Hom^\bullet(K^\bullet, L^\bullet)
$$
of complexes of $A$-modules. This proves the first displayed equality
and the proof is complete.
\end{proof}

\begin{lemma}
\label{lemma-colim-and-lim-of-duals}
\begin{slogan}
Trivial duality for systems of perfect objects.
\end{slogan}
Let $A$ be a ring. Let $(K_n)_{n \in \mathbf{N}}$ be a system of
perfect objects of $D(A)$. Let $K = \text{hocolim} K_n$ be the derived colimit
(Derived Categories, Definition \ref{derived-definition-derived-colimit}).
Then for any object $E$ of $D(A)$ we have
$$
R\Hom_A(K, E) = R\lim E \otimes^\mathbf{L}_A K_n^\vee
$$
where $(K_n^\vee)$ is the inverse system of dual perfect complexes.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-dual-perfect-complex} we have
$R\lim E \otimes^\mathbf{L}_A K_n^\vee =
R\lim R\Hom_A(K_n, E)$
which fits into the distinguished triangle
$$
R\lim R\Hom_A(K_n, E) \to
\prod R\Hom_A(K_n, E) \to
\prod R\Hom_A(K_n, E)
$$
Because $K$ similarly fits into the distinguished triangle
$\bigoplus K_n \to \bigoplus K_n \to K$ it suffices to show that
$\prod R\Hom_A(K_n, E) = R\Hom_A(\bigoplus K_n, E)$.
This is a formal consequence of (\ref{equation-internal-hom})
and the fact that derived tensor product commutes with direct sums.
\end{proof}

\begin{lemma}
\label{lemma-colimit-perfect-complexes}
Let $R = \colim_{i \in I} R_i$ be a filtered colimit of rings.
\begin{enumerate}
\item Given a perfect $K$ in $D(R)$ there exists an $i \in I$
and a perfect $K_i$ in $D(R_i)$ such that
$K \cong K_i \otimes_{R_i}^\mathbf{L} R$ in $D(R)$.
\item Given $0 \in I$ and $K_0, L_0 \in D(R_0)$ with $K_0$ perfect,
we have
$$
\Hom_{D(R)}(K_0 \otimes_{R_0}^\mathbf{L} R, L_0 \otimes_{R_0}^\mathbf{L} R) =
\colim_{i \geq 0}
\Hom_{D(R_i)}(K_0 \otimes_{R_0}^\mathbf{L} R_i,
L_0 \otimes_{R_0}^\mathbf{L} R_i)
$$
\end{enumerate}
In other words, the triangulated category of perfect complexes over $R$
is the colimit of the triangulated categories of perfect complexes over $R_i$.
\end{lemma}

\begin{proof}
We will use the results of
Algebra, Lemmas \ref{algebra-lemma-module-map-property-in-colimit} and
\ref{algebra-lemma-colimit-category-fp-modules}
without further mention. These lemmas in particular say that the
category of finitely presented $R$-modules is the colimit of the
categories of finitely presented $R_i$-modules. Since finite projective
modules can be characterized as summands of finite free modules
(Algebra, Lemma \ref{algebra-lemma-finite-projective}) we see that
the same is true for the category of finite projective modules.
This proves (1) by our definition of perfect objects of $D(R)$.

\medskip\noindent
To prove (2) we may represent $K_0$ by a bounded complex $K_0^\bullet$ of
finite projective $R_0$-modules. We may represent $L_0$ by a K-flat
complex $L_0^\bullet$ (Lemma \ref{lemma-K-flat-resolution}).
Then we have
$$
\Hom_{D(R)}(K_0 \otimes_{R_0}^\mathbf{L} R, L_0 \otimes_{R_0}^\mathbf{L} R) =
\Hom_{K(R)}(K_0^\bullet \otimes_{R_0} R, L_0^\bullet \otimes_{R_0} R)
$$
by Derived Categories, Lemma
\ref{derived-lemma-morphisms-from-projective-complex}.
Similarly for the $\Hom$ with $R$ replaced by $R_i$. Since
in the right hand side only a finite number of terms are involved,
since
$$
\Hom_R(K_0^p \otimes_{R_0} R, L_0^q \otimes_{R_0} R) =
\colim_{i \geq 0}
\Hom_{R_i}(K_0^p \otimes_{R_0} R_i, L_0^q \otimes_{R_0} R_i)
$$
by the lemmas cited at the beginning of the proof, and since
filtered colimits are exact
(Algebra, Lemma \ref{algebra-lemma-directed-colimit-exact})
we conclude that (2) holds as well.
\end{proof}






\section{Lifting complexes}
\label{section-lifting-complexes}

\noindent
Let $R$ be a ring. Let $I \subset R$ be an ideal. The lifting problem
we will consider is the following. Suppose given an object $K$ of $D(R)$
and a complex $E^\bullet$ of $R/I$-modules such that $E^\bullet$
represents $K \otimes_R^\mathbf{L} R/I$ in $D(R)$.
Question: Does there exist a complex of $R$-modules $P^\bullet$
lifting $E^\bullet$ representing $K$ in $D(R)$?
In general the answer to this question is no, but in good
cases something can be done. We first discuss lifting acyclic complexes.

\begin{lemma}
\label{lemma-lift-acyclic-complex}
Let $R$ be a ring. Let $I \subset R$ be an ideal. Let $\mathcal{P}$
be a class of $R$-modules. Assume
\begin{enumerate}
\item each $P \in \mathcal{P}$ is a projective $R$-module,
\item if $P_1 \in \mathcal{P}$ and $P_1 \oplus P_2 \in \mathcal{P}$, then
$P_2 \in \mathcal{P}$, and
\item if $f : P_1 \to P_2$, $P_1, P_2 \in \mathcal{P}$ is surjective
modulo $I$, then $f$ is surjective.
\end{enumerate}
Then given any bounded above acyclic complex $E^\bullet$
whose terms are of the form $P/IP$ for $P \in \mathcal{P}$ there
exists a bounded above acyclic complex $P^\bullet$ whose terms
are in $\mathcal{P}$ lifting $E^\bullet$.
\end{lemma}

\begin{proof}
Say $E^i = 0$ for $i > b$. Assume given $n$ and a morphism of complexes
$$
\xymatrix{
& & P^n \ar[r] \ar[d] & P^{n + 1} \ar[r] \ar[d] & \ldots \ar[r]
& P^b \ar[r] \ar[d] & 0 \ar[r] \ar[d] & \ldots \\
\ldots \ar[r] & E^{n - 1} \ar[r] &
E^n \ar[r] & E^{n + 1} \ar[r] & \ldots \ar[r] &
E^b \ar[r] & 0 \ar[r] & \ldots
}
$$
with $P^i \in \mathcal{P}$, with
$P^n \to P^{n + 1} \to \ldots \to P^b$ acyclic in degrees $\geq n + 1$,
and with vertical maps inducing isomorphisms $P^i/IP^i \to E^i$.
In this situation one can inductively choose isomorphisms
$P^i = Z^i \oplus Z^{i + 1}$ such that the maps $P^i \to P^{i + 1}$
are given by
$Z^i \oplus Z^{i + 1} \to Z^{i + 1} \to Z^{i + 1} \oplus Z^{i + 2}$.
By property (2) and arguing inductively we see that $Z^i \in \mathcal{P}$.
Choose $P^{n - 1} \in \mathcal{P}$ and an isomorphism
$P^{n - 1}/IP^{n - 1} \to E^{n - 1}$. Since
$P^{n - 1}$ is projective and since $Z^n/IZ^n = \Im(E^{n - 1} \to E^n)$,
we can lift the map $P^{n - 1} \to E^{n - 1} \to E^n$ to a map
$P^{n - 1} \to Z^n$. By property (3) the map $P^{n - 1} \to Z^n$
is surjective. Thus we obtain an extension of the diagram
by adding $P^{n - 1}$ and the maps just constructed to the left
of $P^n$. Since a diagram of the desired form exists for $n > b$
we conclude by induction on $n$.
\end{proof}

\begin{lemma}
\label{lemma-lift-complex}
Let $R$ be a ring. Let $I \subset R$ be an ideal. Let $\mathcal{P}$
be a class of $R$-modules.
Let $K \in D(R)$ and let $E^\bullet$ be a complex of $R/I$-modules
representing $K \otimes_R^\mathbf{L} R/I$. Assume
\begin{enumerate}
\item each $P \in \mathcal{P}$ is a projective $R$-module,
\item $P_1 \in \mathcal{P}$ and $P_1 \oplus P_2 \in \mathcal{P}$
if and only if $P_1, P_2 \in \mathcal{P}$,
\item if $f : P_1 \to P_2$, $P_1, P_2 \in \mathcal{P}$ is surjective
modulo $I$, then $f$ is surjective,
\item $E^\bullet$ is bounded above and $E^i$ is of the form $P/IP$
for $P \in \mathcal{P}$, and
\item $K$ can be represented by a bounded above complex
whose terms are in $\mathcal{P}$.
\end{enumerate}
Then there exists a bounded above complex $P^\bullet$ whose terms
are in $\mathcal{P}$ with $P^\bullet/IP^\bullet$ isomorphic to
$E^\bullet$ and representing $K$ in $D(R)$.
\end{lemma}

\begin{proof}
By assumption (5) we can represent $K$ by a bounded above complex 
$K^\bullet$ whose terms are in $\mathcal{P}$. Then $K \otimes_R^\mathbf{L} R/I$
is represented by $K^\bullet/IK^\bullet$. Since $E^\bullet$ is
a bounded above complex of projective $R/I$-modules by (4), 
we can choose a quasi-isomorphism $\delta : E^\bullet \to K^\bullet/IK^\bullet$
(Derived Categories, Lemma
\ref{derived-lemma-morphisms-from-projective-complex}).
Let $C^\bullet$ be cone on $\delta$
(Derived Categories, Definition \ref{derived-definition-cone}).
The module $C^i$ is the direct sum $K^i/IK^i \oplus E^{i + 1}$
hence is of the form $P/IP$ for some $P \in \mathcal{P}$
as (2) says in particular that $\mathcal{P}$ is preserved under taking sums.
Since $C^\bullet$ is acyclic, we can apply
Lemma \ref{lemma-lift-acyclic-complex} and find a acyclic
lift $A^\bullet$ of $C^\bullet$. The complex $A^\bullet$ is
bounded above and has terms in $\mathcal{P}$. In
$$
\xymatrix{
K^\bullet \ar@{..>}[r] \ar[d] & A^\bullet \ar[d] \\
K^\bullet/IK^\bullet \ar[r] & C^\bullet \ar[r] & E^\bullet[1]
}
$$
we can find the dotted arrow making the diagram commute
by Derived Categories, Lemma
\ref{derived-lemma-morphisms-lift-projective}.
We will show below that it follows from (1), (2), (3)
that $K^i \to A^i$ is the inclusion of a direct summand
for every $i$. By property (2) we see that $P^i = \Coker(K^i \to A^i)$
is in $\mathcal{P}$. Thus we can take
$P^\bullet = \Coker(K^\bullet \to A^\bullet)[-1]$ to conclude.

\medskip\noindent
To finish the proof we have to show the following: Let $f : P_1 \to P_2$,
$P_1, P_2 \in \mathcal{P}$ and $P_1/IP_1 \to P_2/IP_2$ is split
injective with cokernel of the form $P_3/IP_3$ for some
$P_3 \in \mathcal{P}$, then $f$ is split injective.
Write $E_i = P_i/IP_i$. Then $E_2 = E_1 \oplus E_3$.
Since $P_2$ is projective we can choose a map $g : P_2 \to P_3$
lifting the map $E_2 \to E_3$. By condition (3) the map $g$
is surjective, hence split as $P_3$ is projective. Set $P_1' = \Ker(g)$
and choose a splitting $P_2 = P'_1 \oplus P_3$. Then $P'_1 \in \mathcal{P}$
by (2). We do not know that
$g \circ f = 0$, but we can consider the map
$$
P_1 \xrightarrow{f} P_2 \xrightarrow{projection} P'_1
$$
The composition modulo $I$ is an isomorphism. Since $P'_1$ is
projective we can split $P_1 = T \oplus P'_1$. If $T = 0$, then
we are done, because then $P_2 \to P'_1$ is a splitting of $f$.
We see that $T \in \mathcal{P}$ by (2).
Calculating modulo $I$ we see that $T/IT = 0$.
Since $0 \in \mathcal{P}$ (as the summand of any $P$ in $\mathcal{P}$)
we see the map $0 \to T$ is surjective and we conclude that $T = 0$
as desired.
\end{proof}

\begin{lemma}
\label{lemma-lift-complex-projectives}
Let $R$ be a ring. Let $I \subset R$ be an ideal. Let $E^\bullet$
be a complex of $R/I$-modules. Let $K$ be an object of $D(R)$. Assume that
\begin{enumerate}
\item $E^\bullet$ is a bounded above complex of projective $R/I$-modules,
\item $K \otimes_R^\mathbf{L} R/I$ is represented by $E^\bullet$ in
$D(R/I)$, and
\item $I$ is a nilpotent ideal.
\end{enumerate}
Then there exists a bounded above complex $P^\bullet$ of projective
$R$-modules representing $K$ in $D(R)$ such that $P^\bullet \otimes_R R/I$
is isomorphic to $E^\bullet$.
\end{lemma}

\begin{proof}
We apply Lemma \ref{lemma-lift-complex} using the class $\mathcal{P}$
of all projective $R$-modules. Properties (1) and (2) of the lemma
are immediate. Property (3) follows from Nakayama's lemma
(Algebra, Lemma \ref{algebra-lemma-NAK}).
Property (4) follows from the fact that we can lift projective
$R/I$-modules to projective $R$-modules, see
Algebra, Lemma \ref{algebra-lemma-lift-projective-module}.
To see that (5) holds it suffices to show that $K$ is in $D^{-}(R)$.
We are given that $K \otimes_R^\mathbf{L} R/I$ is in $D^{-}(R/I)$
(because $E^\bullet$ is bounded above).
We will show by induction on $n$ that
$K \otimes_R^\mathbf{L} R/I^n$ is in $D^{-}(R/I^n)$.
This will finish the proof because $I$ being nilpotent exactly
means that $I^n = 0$ for some $n$.
We may represent $K$ by a K-flat complex $K^\bullet$ with flat terms
(Lemma \ref{lemma-K-flat-resolution}).
Then derived tensor products are represented by usual tensor products.
Thus we consider the exact sequence
$$
0 \to K^\bullet \otimes_R I^n/I^{n + 1} \to
K^\bullet \otimes_R R/I^{n + 1} \to
K^\bullet \otimes_R R/I^n \to 0
$$
Thus the cohomology of $K \otimes_R^\mathbf{L} R/I^{n + 1}$
sits in a long exact sequence with the cohomology of
$K \otimes_R^\mathbf{L} R/I^n$ and the cohomology of
$$
K \otimes_R^\mathbf{L} I^n/I^{n + 1} =
K \otimes_R^\mathbf{L} R/I \otimes_{R/I}^\mathbf{L} I^n/I^{n + 1}
$$
The first cohomologies vanish above a certain degree
by induction assumption and the second cohomologies vanish
above a certain degree because $K^\bullet \otimes_R^\mathbf{L} R/I$
is bounded above and $I^n/I^{n + 1}$ is in degree $0$.
\end{proof}

\begin{lemma}
\label{lemma-lift-complex-stably-frees}
Let $R$ be a ring. Let $I \subset R$ be an ideal. Let $E^\bullet$
be a complex of $R/I$-modules. Let $K$ be an object of $D(R)$. Assume that
\begin{enumerate}
\item $E^\bullet$ is a bounded above complex of
finite stably free $R/I$-modules,
\item $K \otimes_R^\mathbf{L} R/I$ is represented by $E^\bullet$ in $D(R/I)$,
\item $K^\bullet$ is pseudo-coherent, and
\item every element of $1 + I$ is invertible.
\end{enumerate}
Then there exists a bounded above complex $P^\bullet$ of finite stably free
$R$-modules representing $K$ in $D(R)$ such that $P^\bullet \otimes_R R/I$
is isomorphic to $E^\bullet$. Moreover, if $E^i$ is free, then $P^i$ is free.
\end{lemma}

\begin{proof}
We apply Lemma \ref{lemma-lift-complex} using the class $\mathcal{P}$
of all finite stably free $R$-modules. Property (1) of the lemma is immediate.
Property (2) follows from Lemma \ref{lemma-exact-category-stably-free}.
Property (3) follows from Nakayama's lemma
(Algebra, Lemma \ref{algebra-lemma-NAK}).
Property (4) follows from the fact that we can lift finite stably free
$R/I$-modules to finite stably free $R$-modules, see
Lemma \ref{lemma-lift-stably-free}.
Part (5) holds because a pseudo-coherent complex can be represented
by a bounded above complex of finite free $R$-modules.
The final assertion of the lemma follows from
Lemma \ref{lemma-isomorphic-finite-projective-lifts}.
\end{proof}

\begin{lemma}
\label{lemma-lift-pseudo-coherent-from-residue-field}
Let $(R, \mathfrak m, \kappa)$ be a local ring. Let $K \in D(R)$
be pseudo-coherent. Set
$d_i = \dim_\kappa H^i(K \otimes_R^\mathbf{L} \kappa)$.
Then $d_i < \infty$ and for some $b \in \mathbf{Z}$ we have
$d_i = 0$ for $i > b$.
Then there exists a complex
$$
\ldots \to
R^{\oplus d_{b - 2}} \to
R^{\oplus d_{b - 1}} \to
R^{\oplus d_b} \to 0 \to \ldots
$$
representing $K$ in $D(R)$. Moreover, this complex is unique up to
isomorphism(!).
\end{lemma}

\begin{proof}
Observe that $K \otimes_R^\mathbf{L} \kappa$ is pseudo-coherent
as an object of $D(\kappa)$, see Lemma \ref{lemma-pull-pseudo-coherent}.
Hence the cohomology spaces are finite dimensional and vanish above
some cutoff. Every object of $D(\kappa)$ is isomorphic
in $D(\kappa)$ to a complex $E^\bullet$ with zero differentials.
In particular $E^i \cong \kappa^{\oplus d_i}$ is finite free.
Applying Lemma \ref{lemma-lift-complex-stably-frees} we obtain
the existence.

\medskip\noindent
If we have two complexes $F^\bullet$ and $G^\bullet$
with $F^i$ and $G^i$ free of rank $d_i$ representing $K$.
Then we may choose a map of complexes $\beta : F^\bullet \to G^\bullet$
representing the isomorphism $F^\bullet \cong K \cong G^\bullet$, see
Derived Categories, Lemma
\ref{derived-lemma-morphisms-from-projective-complex}.
The induced map of complexes
$\beta \otimes 1 : F^\bullet \otimes_R^\mathbf{L} \kappa \to
G^\bullet \otimes_R^\mathbf{L} \kappa$
must be an isomorphism of complexes as the differentials
in $F^\bullet \otimes_R^\mathbf{L} \kappa$ and
$G^\bullet \otimes_R^\mathbf{L} \kappa$ are zero.
Thus $\beta^i : F^i \to G^i$ is a map of finite free $R$-modules
whose reduction modulo $\mathfrak m$ is an isomorphism.
Hence $\beta^i$ is an isomorphism and we win.
\end{proof}

\begin{lemma}
\label{lemma-lift-perfect-from-residue-field}
Let $R$ be a ring. Let $\mathfrak p \subset R$ be a prime. Let $K \in D(R)$
be perfect. Set
$d_i =
\dim_{\kappa(\mathfrak p)} H^i(K \otimes_R^\mathbf{L} \kappa(\mathfrak p))$.
Then $d_i < \infty$ and only a finite number are nonzero.
Then there exists an $f \in R$, $f \not \in \mathfrak p$ and a
complex
$$
\ldots \to 0 \to R_f^{\oplus d_a} \to R_f^{\oplus d_{a + 1}} \to
\ldots \to
R_f^{\oplus d_{b - 1}} \to
R_f^{\oplus d_b} \to 0
\to \ldots
$$
representing $K \otimes_R^\mathbf{L} R_f$ in $D(R_f)$.
\end{lemma}

\begin{proof}
Observe that $K \otimes_R^\mathbf{L} \kappa(\mathfrak p)$
is perfect as an object of $D(\kappa(\mathfrak p))$, see
Lemma \ref{lemma-pull-perfect}. Hence only a finite number of
$d_i$ are nonzero and they are all finite. Applying
Lemma \ref{lemma-lift-pseudo-coherent-from-residue-field}
we get a complex representing $K$
having the desired shape over the local ring $R_\mathfrak p$.
We have $R_\mathfrak p = \colim R_f$ for
$f \in R$, $f \not \in \mathfrak p$
(Algebra, Lemma \ref{algebra-lemma-localization-colimit}).
We conclude by Lemma \ref{lemma-colimit-perfect-complexes}.
Some details omitted.
\end{proof}

\begin{lemma}
\label{lemma-compare-representatives-perfect}
Let $R$ be a ring. Let $\mathfrak p \subset R$ be a prime. Let $M^\bullet$
and $N^\bullet$ be bounded complexes of finite projective $R$-modules
representing the same object of $D(R)$. Then there exists an $f \in R$,
$f \not \in \mathfrak p$ such that there is an isomorphism (!)
of complexes
$$
M^\bullet_f \oplus P^\bullet \cong N^\bullet_f \oplus Q^\bullet
$$
where $P^\bullet$ and $Q^\bullet$ are finite direct sums of
trivial complexes, i.e., complexes of the form
the form $\ldots \to 0 \to R_f \xrightarrow{1} R_f \to 0 \to \ldots$
(placed in arbitrary degrees).
\end{lemma}

\begin{proof}
If we have an isomorphism of the type described over the localization
$R_\mathfrak p$, then using that $R_\mathfrak p = \colim R_f$
(Algebra, Lemma \ref{algebra-lemma-localization-colimit}) we can
descend the isomorphism to an isomorphism over $R_f$ for some $f$.
Thus we may assume $R$ is local and $\mathfrak p$ is the maximal ideal.
In this case the result follows from the uniqueness of a ``minimal''
complex representing a perfect object, see
Lemma \ref{lemma-lift-pseudo-coherent-from-residue-field}, and
the fact that any complex is a direct sum of a trivial complex
and a minimal one (Algebra, Lemma \ref{algebra-lemma-add-trivial-complex}).
\end{proof}

\begin{lemma}
\label{lemma-lift-complex-finite-projectives}
Let $R$ be a ring. Let $I \subset R$ be an ideal. Let $E^\bullet$
be a complex of $R/I$-modules. Let $K$ be an object of $D(R)$. Assume that
\begin{enumerate}
\item $E^\bullet$ is a bounded above complex of finite projective $R/I$-modules,
\item $K \otimes_R^\mathbf{L} R/I$ is represented by $E^\bullet$ in $D(R/I)$,
\item $K$ is pseudo-coherent, and
\item $(R, I)$ is a henselian pair.
\end{enumerate}
Then there exists a bounded above complex $P^\bullet$ of finite projective
$R$-modules representing $K$ in $D(R)$ such that $P^\bullet \otimes_R R/I$
is isomorphic to $E^\bullet$. Moreover, if $E^i$ is free, then $P^i$ is free.
\end{lemma}

\begin{proof}
We apply Lemma \ref{lemma-lift-complex} using the class $\mathcal{P}$
of all finite projective $R$-modules. Properties (1) and (2)
of the lemma are immediate.
Property (3) follows from Nakayama's lemma
(Algebra, Lemma \ref{algebra-lemma-NAK}).
Property (4) follows from the fact that we can lift finite projective
$R/I$-modules to finite projective $R$-modules, see
Lemma \ref{lemma-lift-finite-projective-module}.
Property (5) holds because a pseudo-coherent complex can be represented
by a bounded above complex of finite free $R$-modules.
Thus Lemma \ref{lemma-lift-complex} applies and we find $P^\bullet$
as desired. The final assertion of the lemma follows from
Lemma \ref{lemma-isomorphic-finite-projective-lifts}.
\end{proof}



\section{Splitting complexes}
\label{section-splitting}

\noindent
In this section we discuss conditions which imply an object of the
derived category of a ring is a direct sum of its truncations.
Our method is to use the following lemma (under suitable hypotheses)
to split the canonical distinguished triangles
$$
\tau_{\leq i}K \to K \to \tau_{\geq i + 1}K \to (\tau_{\leq i}K)[1]
$$
in $D(R)$, see Derived Categories, Remark
\ref{derived-remark-truncation-distinguished-triangle}.

\begin{lemma}
\label{lemma-splitting-unique}
Let $R$ be a ring. Let $K$ and $L$ be objects of $D(R)$.
Assume $L$ has projective-amplitude in $[a, b]$, for example if $L$
is perfect of tor-amplitude in $[a, b]$.
\begin{enumerate}
\item If $H^i(K) = 0$ for $i \geq a$, then
$\Hom_{D(R)}(L, K) = 0$.
\item If $H^i(K) = 0$ for $i \geq a + 1$, then given any distinguished
triangle $K \to M \to L \to K[1]$
there is an isomorphism $M \cong K \oplus L$
in $D(R)$ compatible with the maps in the distinguished triangle.
\item If $H^i(K) = 0$ for $i \geq a$, then the isomorphism
in (2) exists and is unique.
\end{enumerate}
\end{lemma}

\begin{proof}
The assumption that $L$ has projective-amplitude in $[a, b]$ means we
can represent $L$ by a complex $L^\bullet$ of projective $R$-modules
with $L^i = 0$ for $i \not \in [a, b]$, see Definition
\ref{definition-projective-dimension}.
If $L$ is perfect of tor-amplitude in $[a, b]$, then
we can represent $L$ by a complex $L^\bullet$ of finite projective $R$-modules
with $L^i = 0$ for $i \not \in [a, b]$, see Lemma \ref{lemma-perfect}.
If $H^i(K) = 0$ for $i \geq a$, then $K$ is quasi-isomorphic
to $\tau_{\leq a - 1}K$. Hence we can represent $K$ by a complex
$K^\bullet$ of $R$-modules with $K^i = 0$ for $i \geq a$. Then we obtain
$$
\Hom_{D(R)}(L, K) = \Hom_{K(R)}(L^\bullet, K^\bullet) = 0
$$
by Derived Categories, Lemma
\ref{derived-lemma-morphisms-from-projective-complex}.
This proves (1). Under the hypotheses of (2) we see that
$\Hom_{D(R)}(L, K[1]) = 0$ by (1), hence
the distinguished triangle is split by
Derived Categories, Lemma \ref{derived-lemma-split}.
The uniqueness of (3) follows from (1).
\end{proof}

\begin{lemma}
\label{lemma-better-cut-complex-in-two}
Let $R$ be a ring. Let $\mathfrak p \subset R$ be a prime ideal.
Let $K^\bullet$ be a pseudo-coherent complex of $R$-modules.
Assume that for some $i \in \mathbf{Z}$ the map
$$
H^i(K^\bullet) \otimes_R \kappa(\mathfrak p)
\longrightarrow
H^i(K^\bullet \otimes_R^{\mathbf{L}} \kappa(\mathfrak p))
$$
is surjective. Then there exists an $f \in R$, $f \not \in \mathfrak p$
such that $\tau_{\geq i + 1}(K^\bullet \otimes_R R_f)$ is a perfect
object of $D(R_f)$ with tor amplitude in $[i + 1, \infty]$ and
a canonical isomorphism
$$
K^\bullet \otimes_R R_f \cong
\tau_{\leq i}(K^\bullet \otimes_R R_f) \oplus
\tau_{\geq i + 1}(K^\bullet \otimes_R R_f)
$$
in $D(R_f)$.
\end{lemma}

\begin{proof}
In this proof all tensor products are over $R$ and we write
$\kappa = \kappa(\mathfrak p)$. We may assume that $K^\bullet$
is a bounded above complex of finite free $R$-modules. Let us
inspect what is happening in degree $i$:
$$
\ldots \to K^{i - 1} \xrightarrow{d^{i - 1}} K^i \xrightarrow{d^i}
K^{i + 1} \to \ldots
$$
Let $0 \subset V \subset W \subset K^i \otimes \kappa$ be defined
by the formulas
$$
V = \Im\left(
K^{i - 1} \otimes \kappa \to K^i \otimes \kappa
\right)
\quad\text{and}\quad
W = \Ker\left(
K^i \otimes \kappa \to K^{i + 1} \otimes \kappa
\right)
$$
Set $\dim(V) = r$, $\dim(W/V) = s$, and $\dim(K^i \otimes \kappa/W) = t$.
We can pick $x_1, \ldots, x_r \in K^{i - 1}$ which map by $d^{i - 1}$
to a basis of $V$. By our assumption we can pick
$y_1, \ldots, y_s \in \Ker(d^i)$ mapping to a basis of $W/V$.
Finally, choose $z_1, \ldots, z_t \in K^i$ mapping to a basis of
$K^i \otimes \kappa/W$. Then we see that the elements
$d^i(z_1), \ldots, d^i(z_t) \in K^{i + 1}$ are linearly independent
in $K^{i + 1} \otimes_R \kappa$.
By Algebra, Lemma \ref{algebra-lemma-cokernel-flat} we may after replacing
$R$ by $R_f$ for some $f \in R$, $f \not \in \mathfrak p$ assume that
\begin{enumerate}
\item $d^i(x_a), y_b, z_c$ is an $R$-basis of $K^i$,
\item $d^i(z_1), \ldots, d^i(z_t)$ are $R$-linearly independent in
$K^{i + 1}$, and
\item the quotient $E^{i + 1} = K^{i + 1}/\sum Rd^i(z_c)$ is finite projective.
\end{enumerate}
Since $d^i$ annihilates $d^{i - 1}(x_a)$ and $y_b$, we deduce from
condition (2) that $E^{i + 1} = \Coker(d^i : K^i \to K^{i + 1})$.
Thus we see that
$$
\tau_{\geq i + 1}K^\bullet =
(\ldots \to 0 \to E^{i + 1} \to K^{i + 2} \to \ldots)
$$
is a bounded complex of finite projective modules sitting in degrees
$[i + 1, b]$ for some $b$. Thus $\tau_{\geq i + 1}K^\bullet$ is perfect
of amplitude $[i + 1, b]$. Since $\tau_{\leq i}K^\bullet$ has no
cohomology in degrees $> i$, we may apply Lemma \ref{lemma-splitting-unique}
to the distinguished triangle
$$
\tau_{\leq i}K^\bullet \to K^\bullet \to \tau_{\geq i + 1}K^\bullet \to
(\tau_{\leq i}K^\bullet)[1]
$$
(Derived Categories, Remark
\ref{derived-remark-truncation-distinguished-triangle}) to conclude.
\end{proof}

\begin{lemma}
\label{lemma-isolate-a-cohomology-group}
Let $R$ be a ring. Let $\mathfrak p \subset R$ be a prime ideal.
Let $K^\bullet$ be a pseudo-coherent complex of $R$-modules.
Assume that for some $i \in \mathbf{Z}$ the maps
$$
H^i(K^\bullet) \otimes_R \kappa(\mathfrak p)
\longrightarrow
H^i(K^\bullet \otimes_R^{\mathbf{L}} \kappa(\mathfrak p))
\quad\text{and}\quad
H^{i - 1}(K^\bullet) \otimes_R \kappa(\mathfrak p)
\longrightarrow
H^{i - 1}(K^\bullet \otimes_R^{\mathbf{L}} \kappa(\mathfrak p))
$$
are surjective. Then there exists an $f \in R$, $f \not \in \mathfrak p$
such that
\begin{enumerate}
\item $\tau_{\geq i + 1}(K^\bullet \otimes_R R_f)$ is a perfect
object of $D(R_f)$ with tor amplitude in $[i + 1, \infty]$,
\item $H^i(K^\bullet)_f$ is a finite free $R_f$-module, and
\item there is a canonical direct sum decomposition
$$
K^\bullet \otimes_R R_f \cong
\tau_{\leq i - 1}(K^\bullet \otimes_R R_f) \oplus
H^i(K^\bullet)_f[-i] \oplus
\tau_{\geq i + 1}(K^\bullet \otimes_R R_f)
$$
in $D(R_f)$.
\end{enumerate}
\end{lemma}

\begin{proof}
We get (1) from Lemma \ref{lemma-better-cut-complex-in-two} as well
as a splitting
$K^\bullet \otimes_R R_f = \tau_{\leq i}K^\bullet \otimes_R R_f \oplus
\tau_{\geq i + 1}K^\bullet \otimes_R R_f$
in $D(R_f)$. Applying Lemma \ref{lemma-better-cut-complex-in-two} once
more to $\tau_{\leq i}K^\bullet \otimes_R R_f$
we obtain (after suitably choosing $f$) a splitting
$\tau_{\leq i}K^\bullet \otimes_R R_f =
\tau_{\leq i - 1}K^\bullet \otimes_R R_f \oplus H^i(K^\bullet)_f$ in $D(R_f)$
as well as the conclusion that $H^i(K)_f$ is a flat perfect module, i.e.,
finite projective.
\end{proof}

\begin{lemma}
\label{lemma-cut-complex-in-two}
Let $R$ be a ring. Let $\mathfrak p \subset R$ be a prime ideal.
Let $i \in \mathbf{Z}$. Let $K^\bullet$ be a pseudo-coherent complex
of $R$-modules such that
$H^i(K^\bullet \otimes_R^{\mathbf{L}} \kappa(\mathfrak p)) = 0$.
Then there exists an $f \in R$, $f \not \in \mathfrak p$
and a canonical direct sum decomposition
$$
K^\bullet \otimes_R R_f =
\tau_{\geq i + 1}(K^\bullet \otimes_R R_f) \oplus
\tau_{\leq i - 1}(K^\bullet \otimes_R R_f)
$$
in $D(R_f)$ with $\tau_{\geq i + 1}(K^\bullet \otimes_R R_f)$ a perfect
complex with tor-amplitude in $[i + 1, \infty]$.
\end{lemma}

\begin{proof}
This is an often used special case of
Lemma \ref{lemma-better-cut-complex-in-two}.
A direct proof is as follows.
We may assume that $K^\bullet$ is a bounded above
complex of finite free $R$-modules. Let us inspect what is happening
in degree $i$:
$$
\ldots \to K^{i - 2} \to R^{\oplus l}
\to R^{\oplus m} \to R^{\oplus n} \to K^{i + 2} \to \ldots
$$
Let $A$ be the $m \times l$ matrix corresponding to $K^{i - 1} \to K^i$
and let $B$ be the $n \times m$ matrix corresponding to $K^i \to K^{i + 1}$.
The assumption is that $A \bmod \mathfrak p$ has rank $r$ and that
$B \bmod \mathfrak p$ has rank $m - r$. In other words, there is some
$r \times r$ minor $a$ of $A$ which is not in $\mathfrak p$ and there is
some $(m - r) \times (m - r)$-minor $b$ of $B$ which is not in $\mathfrak p$.
Set $f = ab$. Then after inverting $f$ we can find direct sum decompositions
$K^{i - 1} = R^{\oplus l - r} \oplus R^{\oplus r}$,
$K^i = R^{\oplus r} \oplus R^{\oplus m - r}$,
$K^{i + 1} = R^{\oplus m - r} \oplus R^{\oplus n - m + r}$
such that the module map $K^{i - 1} \to K^i$ kills of
$R^{\oplus l - r}$ and induces an isomorphism of $R^{\oplus r}$ onto the
corresponding summand of $K^i$ and such that the module map $K^i \to K^{i + 1}$
kills of $R^{\oplus r}$ and induces an isomorphism of $R^{\oplus m - r}$
onto the corresponding summand of $K^{i + 1}$. Thus $K^\bullet$ becomes
quasi-isomorphic to
$$
\ldots \to K^{i - 2} \to R^{\oplus l - r}
\to 0 \to R^{\oplus n - m + r} \to K^{i + 2} \to \ldots
$$
and everything is clear.
\end{proof}

\begin{lemma}
\label{lemma-split-using-ext-injective}
Let $R$ be a ring. Let $K \in D^-(R)$. Let $a \in \mathbf{Z}$.
Assume that for any injective $R$-module map $M \to M'$ the map
$\Ext^{-a}_R(K, M) \to \Ext^{-a}_R(K, M')$ is injective.
Then there is a unique direct sum decomposition
$K \cong \tau_{\leq a}K \oplus \tau_{\geq a + 1}K$
and $\tau_{\geq a + 1}K$ has projective-amplitude in $[a + 1, b]$
for some $b$.
\end{lemma}

\begin{proof}
Consider the distinguished triangle
$$
\tau_{\leq a}K \to K \to \tau_{\geq a + 1}K \to (\tau_{\leq a}K)[1]
$$
in $D(R)$, see Derived Categories, Remark
\ref{derived-remark-truncation-distinguished-triangle}.
Observe that
$\Ext^{-a}_R(\tau_{\leq a}K, M) = \Hom_R(H^a(K), M)$
and
$\Ext^{-a - 1}_R(\tau_{\leq a}K, M) = 0$, see
Derived Categories, Lemma \ref{derived-lemma-negative-exts}. Thus
the long exact sequence of $\Ext$ gives an exact sequence
$$
0 \to
\Ext^{-a}_R(\tau_{\geq a + 1}K, M) \to
\Ext^{-a}_R(K, M) \to
\Hom_R(H^a(K), M)
$$
functorial in the $R$-module $M$.
Now if $I$ is an injective $R$-module, then
$\Ext^{-a}_R(\tau_{\geq a + 1}K, I) = 0$ for example by
Derived Categories, Lemma \ref{derived-lemma-compute-ext-resolutions}.
Since every module injects into an injective module,
we conclude that $\Ext^{-a}_R(\tau_{\geq a + 1}K, M) = 0$
for every $R$-module $M$. By Lemma \ref{lemma-projective-amplitude}
we conclude that $\tau_{\geq a + 1}K$ has projective-amplitude
in $[a + 1, b]$ for some $b$ (this is where we use that $K$
is bounded above). We obtain the splitting by
Lemma \ref{lemma-splitting-unique}.
\end{proof}

\begin{lemma}
\label{lemma-split-using-ext-zero}
Let $R$ be a ring. Let $K \in D^-(R)$. Let $a \in \mathbf{Z}$.
Assume $\Ext^{-a}_R(K, M) = 0$ for any $R$-module $M$.
Then there is a unique direct sum decomposition
$K \cong \tau_{\leq a - 1}K \oplus \tau_{\geq a + 1}K$
and $\tau_{\geq a + 1}K$ has projective-amplitude in $[a + 1, b]$
for some $b$.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-split-using-ext-injective}
we have a direct sum decomposition
$K \cong \tau_{\leq a}K \oplus \tau_{\geq a + 1}K$
and $\tau_{\geq a + 1}K$ has projective-amplitude in $[a + 1, b]$
for some $b$. Clearly, we must have $H^a(K) = 0$ and
we conclude that $\tau_{\leq a}K = \tau_{\leq a - 1}K$
in $D(R)$.
\end{proof}














\section{Recognizing perfect complexes}
\label{section-recognizing-perfect}

\noindent
Some lemmas that allow us to prove certain complexes are perfect.

\begin{lemma}
\label{lemma-lift-bounded-pseudo-coherent-to-perfect}
Let $R$ be a ring and let $\mathfrak p \subset R$ be a prime.
Let $K$ be pseudo-coherent and bounded below. Set
$d_i = \dim_{\kappa(\mathfrak p)}
H^i(K \otimes_R^\mathbf{L} \kappa(\mathfrak p))$.
If there exists an $a \in \mathbf{Z}$ such that $d_i = 0$ for $i < a$,
then there exists an $f \in R$, $f \not \in \mathfrak p$ and a
complex
$$
\ldots \to 0 \to R_f^{\oplus d_a} \to R_f^{\oplus d_{a + 1}} \to
\ldots \to
R_f^{\oplus d_{b - 1}} \to
R_f^{\oplus d_b} \to 0
\to \ldots
$$
representing $K \otimes_R^\mathbf{L} R_f$ in $D(R_f)$.
In particular $K \otimes_R^\mathbf{L} R_f$ is perfect.
\end{lemma}

\begin{proof}
After decreasing $a$ we may assume that also $H^i(K^\bullet) = 0$ for
$i < a$. By Lemma \ref{lemma-cut-complex-in-two} after replacing $R$ by $R_f$
for some $f \in R$, $f \not \in \mathfrak p$
we can write $K^\bullet = \tau_{\leq a - 1}K^\bullet \oplus
\tau_{\geq a}K^\bullet$ in $D(R)$ with $\tau_{\geq a}K^\bullet$
perfect. Since $H^i(K^\bullet) = 0$ for $i < a$ we see that
$\tau_{\leq a - 1}K^\bullet = 0$ in $D(R)$. Hence $K^\bullet$
is perfect. Then we can conclude using
Lemma \ref{lemma-lift-perfect-from-residue-field}.
\end{proof}

\begin{lemma}
\label{lemma-check-perfect-pointwise}
Let $R$ be a ring. Let $a, b \in \mathbf{Z}$.
Let $K^\bullet$ be a pseudo-coherent complex of $R$-modules.
The following are equivalent
\begin{enumerate}
\item $K^\bullet$ is perfect with tor amplitude in $[a, b]$,
\item for every prime $\mathfrak p$ we have
$H^i(K^\bullet \otimes_R^{\mathbf{L}} \kappa(\mathfrak p)) = 0$ for all
$i \not \in [a, b]$, and
\item for every maximal ideal $\mathfrak m$ we have
$H^i(K^\bullet \otimes_R^{\mathbf{L}} \kappa(\mathfrak m)) = 0$ for all
$i \not \in [a, b]$.
\end{enumerate}
\end{lemma}

\begin{proof}
We omit the proof of the implications (1) $\Rightarrow$ (2) $\Rightarrow$ (3).
Assume (3). Let $i \in \mathbf{Z}$ with $i \not \in [a, b]$. By
Lemma \ref{lemma-cut-complex-in-two}
we see that the assumption implies that $H^i(K^\bullet)_{\mathfrak m} = 0$
for all maximal ideals of $R$. Hence $H^i(K^\bullet) = 0$, see
Algebra, Lemma \ref{algebra-lemma-characterize-zero-local}.
Moreover,
Lemma \ref{lemma-cut-complex-in-two}
now also implies that for every maximal ideal
$\mathfrak m$ there exists an element $f \in R$, $f \not \in \mathfrak m$
such that $K^\bullet \otimes_R R_f$ is perfect with tor amplitude in
$[a, b]$. Hence we conclude by appealing to
Lemmas \ref{lemma-glue-perfect} and \ref{lemma-glue-tor-amplitude}.
\end{proof}

\begin{lemma}
\label{lemma-check-perfect-stalks}
Let $R$ be a ring. Let $K^\bullet$ be a pseudo-coherent
complex of $R$-modules. Consider the following conditions
\begin{enumerate}
\item $K^\bullet$ is perfect,
\item for every prime ideal $\mathfrak p$ the complex
$K^\bullet \otimes_R R_{\mathfrak p}$ is perfect,
\item for every maximal ideal $\mathfrak m$ the complex
$K^\bullet \otimes_R R_{\mathfrak m}$ is perfect,
\item for every prime $\mathfrak p$ we have
$H^i(K^\bullet \otimes_R^{\mathbf{L}} \kappa(\mathfrak p)) = 0$ for all
$i \ll 0$,
\item for every maximal ideal $\mathfrak m$ we have
$H^i(K^\bullet \otimes_R^{\mathbf{L}} \kappa(\mathfrak m)) = 0$ for all
$i \ll 0$.
\end{enumerate}
We always have the implications
$$
(1) \Rightarrow (2) \Leftrightarrow (3) \Leftrightarrow (3)
\Leftrightarrow (4) \Leftrightarrow (5)
$$
If $K^\bullet$ is bounded below, then all conditions are equivalent.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-pull-perfect} we see that (1) implies (2).
It is immediate that (2) $\Rightarrow$ (3). Since every prime
$\mathfrak p$ is contained in a maximal ideal $\mathfrak m$,
we can apply Lemma \ref{lemma-pull-perfect} to the map
$R_\mathfrak m \to R_\mathfrak p$ to see that (3) implies (2).
Applying Lemma \ref{lemma-pull-perfect} to the residue maps
$R_\mathfrak p \to \kappa(\mathfrak p)$ and
$R_\mathfrak m \to \kappa(\mathfrak m)$ we see that (2) implies
(4) and (3) implies (5).

\medskip\noindent
Assume $R$ is local with maximal ideal $\mathfrak m$ and
residue field $\kappa$. We will show that if
$H^i(K^\bullet \otimes^\mathbf{L} \kappa) = 0$ for $i < a$
for some $a$, then $K$ is perfect. This will show that
(4) implies (2) and (5) implies (3) whence the first part
of the lemma. First we apply Lemma \ref{lemma-cut-complex-in-two}
with $i = a - 1$ to see that
$K^\bullet = \tau_{\leq a - 1}K^\bullet \oplus \tau_{\geq a}K^\bullet$
in $D(R)$ with $\tau_{\geq a}K^\bullet$ perfect of tor-amplitude
contained in $[a, \infty]$. To finish we need to show that
$\tau_{\leq a - 1}K$ is zero, i.e., that its cohomology groups are zero.
If not let $i$ be the largest index such that $M = H^i(\tau_{\leq a - 1}K)$
is not zero. Then $M$ is a finite $R$-module because
$\tau_{\leq a - 1}K^\bullet$ is pseudo-coherent
(Lemmas \ref{lemma-finite-cohomology} and \ref{lemma-summands-pseudo-coherent}).
Thus by Nakayama's lemma (Algebra, Lemma \ref{algebra-lemma-NAK})
we find that $M \otimes_R \kappa$ is nonzero.
This implies that
$$
H^i((\tau_{\leq a - 1}K^\bullet) \otimes_R^\mathbf{L} \kappa) =
H^i(K^\bullet \otimes_R^\mathbf{L} \kappa)
$$
is nonzero which is a contradiction.

\medskip\noindent
Assume the equivalent conditions (2) -- (5) hold and that
$K^\bullet$ is bounded below. Say $H^i(K^\bullet) = 0$ for
$i < a$. Pick a maximal ideal $\mathfrak m$ of $R$.
It suffices to show there exists an $f \in R$, $f \not \in \mathfrak m$
such that $K^\bullet \otimes_R^\mathbf{L} R_f$ is perfect
(Lemma \ref{lemma-glue-perfect} and
Algebra, Lemma \ref{algebra-lemma-quasi-compact}).
This follows from Lemma \ref{lemma-lift-bounded-pseudo-coherent-to-perfect}.
\end{proof}

\begin{lemma}
\label{lemma-projective-amplitude-pseudo-coherent}
Let $R$ be a ring. Let $K$ be a pseudo-coherent object of $D(R)$.
Let $a, b \in \mathbf{Z}$. The following are equivalent
\begin{enumerate}
\item $K$ has projective-amplitude in $[a, b]$,
\item $K$ is perfect of tor-amplitude in $[a, b]$,
\item $\Ext^i_R(K, N) = 0$ for all finitely presented $R$-modules $N$ and all
$i \not \in [-b, -a]$,
\item $H^n(K) = 0$ for $n > b$ and
$\Ext^i_R(K, N) = 0$ for all finitely presented $R$-modules $N$ and
all $i > -a$, and
\item $H^n(K) = 0$ for $n \not \in [a - 1, b]$ and
$\Ext^{-a + 1}_R(K, N) = 0$ for all finitely presented $R$-modules $N$.
\end{enumerate}
\end{lemma}

\begin{proof}
From the final statement of Lemma \ref{lemma-perfect} we see that
(2) implies (1).  If (1) holds, then $K$ can be represented by
a complex of projective modules $P^i$ with $P^i = 0$ for $i \not \in [a, b]$.
Since projective modules are flat (as summands of free modules), we see
that $K$ has tor-amplitude in $[a, b]$, see Lemma \ref{lemma-tor-amplitude}.
Thus by Lemma \ref{lemma-perfect} we see that (2) holds.

\medskip\noindent
In conditions (3), (4), (5) the assumed vanishing of ext groups
$\Ext^i_R(K, M)$ for $M$ of finite presentation is equivalent to the
vanishing for all $R$-modules $M$ by
Lemma \ref{lemma-pseudo-coherence-colimit-ext}
and Algebra, Lemma \ref{algebra-lemma-module-colimit-fp}.
Thus the equivalence of (1), (3), (4), and (5)
follows from Lemma \ref{lemma-projective-amplitude}.
\end{proof}

\noindent
The following lemma useful in order to find perfect complexes
over a polynomial ring $B = A[x_1, \ldots, x_d]$.

\begin{lemma}
\label{lemma-perfect-over-polynomial-ring}
Let $A \to B$ be a ring map. Let $a, b \in \mathbf{Z}$. Let $d \geq 0$.
Let $K^\bullet$ be a complex of $B$-modules. Assume
\begin{enumerate}
\item the ring map $A \to B$ is flat,
\item for every prime $\mathfrak p \subset A$ the ring
$B \otimes_A \kappa(\mathfrak p)$ has finite global dimension $\leq d$,
\item $K^\bullet$ is pseudo-coherent as a complex of $B$-modules, and
\item $K^\bullet$ has tor amplitude in $[a, b]$ as a complex
of $A$-modules.
\end{enumerate}
Then $K^\bullet$ is perfect as a complex of $B$-modules
with tor amplitude in $[a - d, b]$.
\end{lemma}

\begin{proof}
We may assume that $K^\bullet$ is a bounded above complex of
finite free $B$-modules. In particular, $K^\bullet$ is flat as a
complex of $A$-modules and
$K^\bullet \otimes_A M = K^\bullet \otimes_A^{\mathbf{L}} M$ for any
$A$-module $M$. For every prime $\mathfrak p$ of $A$ the complex
$$
K^\bullet \otimes_A \kappa(\mathfrak p)
$$
is a bounded above complex of finite free modules over
$B \otimes_A \kappa(\mathfrak p)$ with vanishing $H^i$ except
for $i \in [a, b]$. As $B \otimes_A \kappa(\mathfrak p)$
has global dimension $d$ we see from
Lemma \ref{lemma-finite-gl-dim-tor-dimension}
that $K^\bullet \otimes_A \kappa(\mathfrak p)$ has tor amplitude in
$[a - d, b]$. Let $\mathfrak q$ be a prime of $B$ lying over $\mathfrak p$.
Since $K^\bullet \otimes_A \kappa(\mathfrak p)$ is a bounded above
complex of free $B \otimes_A \kappa(\mathfrak p)$-modules we see
that
\begin{align*}
K^\bullet \otimes_B^{\mathbf{L}} \kappa(\mathfrak q)
& = K^\bullet \otimes_B \kappa(\mathfrak q) \\
& = (K^\bullet \otimes_A \kappa(\mathfrak p))
\otimes_{B \otimes_A \kappa(\mathfrak p)} \kappa(\mathfrak q) \\
& = (K^\bullet \otimes_A \kappa(\mathfrak p))
\otimes^{\mathbf{L}}_{B \otimes_A \kappa(\mathfrak p)} \kappa(\mathfrak q)
\end{align*}
Hence the arguments above imply that
$H^i(K^\bullet \otimes_B^{\mathbf{L}} \kappa(\mathfrak q)) = 0$
for $i \not \in [a - d, b]$. We conclude by
Lemma \ref{lemma-check-perfect-pointwise}.
\end{proof}

\noindent
The following lemma is a local version of
Lemma \ref{lemma-perfect-over-polynomial-ring}.
It can be used to find perfect complexes over regular local rings.

\begin{lemma}
\label{lemma-perfect-over-regular-local-ring}
Let $A \to B$ be a local ring homomorphism.
Let $a, b \in \mathbf{Z}$. Let $d \geq 0$.
Let $K^\bullet$ be a complex of $B$-modules. Assume
\begin{enumerate}
\item the ring map $A \to B$ is flat,
\item the ring $B/\mathfrak m_AB$ is regular of dimension $d$,
\item $K^\bullet$ is pseudo-coherent as a complex of $B$-modules, and
\item $K^\bullet$ has tor amplitude in $[a, b]$ as a complex
of $A$-modules, in fact it suffices if
$H^i(K^\bullet \otimes_A^\mathbf{L} \kappa(\mathfrak m_A))$
is nonzero only for $i \in [a, b]$.
\end{enumerate}
Then $K^\bullet$ is perfect as a complex of $B$-modules
with tor amplitude in $[a - d, b]$.
\end{lemma}

\begin{proof}
By (3) we may assume that $K^\bullet$ is a bounded above complex of finite free
$B$-modules. We compute
\begin{align*}
K^\bullet \otimes_B^{\mathbf{L}} \kappa(\mathfrak m_B)
& = K^\bullet \otimes_B \kappa(\mathfrak m_B) \\
& = (K^\bullet \otimes_A \kappa(\mathfrak m_A))
\otimes_{B/\mathfrak m_A B} \kappa(\mathfrak m_B) \\
& = (K^\bullet \otimes_A \kappa(\mathfrak m_A))
\otimes^{\mathbf{L}}_{B/\mathfrak m_A B} \kappa(\mathfrak m_B)
\end{align*}
The first equality because $K^\bullet$ is a bounded above complex
of flat $B$-modules. The second equality follows from basic 
properties of the tensor product. The third equality holds because
$K^\bullet \otimes_A \kappa(\mathfrak m_A) =
K^\bullet/ \mathfrak m_A K^\bullet$ is a bounded above complex
of flat $B/\mathfrak m_A B$-modules. Since $K^\bullet$ is a bounded
above complex of flat $A$-modules by (1), the cohomology modules $H^i$
of the complex $K^\bullet \otimes_A \kappa(\mathfrak m_A)$ are nonzero only
for $i \in [a, b]$ by assumption (4). Thus the spectral sequence
of Example \ref{example-cohomology-complex-tensored} and the
fact that $B/\mathfrak m_AB$ has finite global dimension $d$
(by (2) and
Algebra, Proposition \ref{algebra-proposition-regular-finite-gl-dim})
shows that $H^j(K^\bullet \otimes_B^{\mathbf{L}} \kappa(\mathfrak m_B))$
is zero for $j \not \in [a - d, b]$.
This finishes the proof by Lemma \ref{lemma-check-perfect-pointwise}.
\end{proof}





\section{Characterizing perfect complexes}
\label{section-perfect-compact}

\noindent
In this section we prove that the perfect complexes are exactly the
compact objects of the derived category of a ring. First we show
the following.

\begin{lemma}
\label{lemma-perfect-ring-classical-generator}
Let $R$ be a ring. The full subcategory $D_{perf}(R) \subset D(R)$ of perfect
objects is the smallest strictly full, saturated, triangulated subcategory
containing $R = R[0]$. In other words $D_{perf}(R) = \langle R \rangle$.
In particular, $R$ is a classical generator for $D_{perf}(R)$.
\end{lemma}

\begin{proof}
To see what the statement means, please look at
Derived Categories, Definitions \ref{derived-definition-saturated} and
\ref{derived-definition-generators}.
It was shown in Lemmas \ref{lemma-two-out-of-three-perfect} and
\ref{lemma-summands-perfect} that $D_{perf}(R) \subset D(R)$
is a strictly full, saturated, triangulated subcategory of $D(R)$.
Of course $R \in D_{perf}(R)$.

\medskip\noindent
Recall that $\langle R \rangle = \bigcup \langle R \rangle_n$.
To finish the proof we will show that if $M \in D_{perf}(R)$
is represented by
$$
\ldots \to 0 \to M^a \to M^{a + 1} \to \ldots \to M^b \to 0 \to \ldots
$$
with $M^i$ finite projective, then $M \in \langle R \rangle_{b - a + 1}$.
The proof is by induction on $b - a$.
By definition $\langle R \rangle_1$ contains any finite projective
$R$-module placed in any degree; this deals with the base case
$b - a = 0$ of the induction. In general, we consider the distinguished
triangle
$$
M_b[-b] \to M^\bullet \to \sigma_{\leq b - 1}M^\bullet \to M_b[-b + 1]
$$
By induction the truncated complex $\sigma_{\leq b - 1}M^\bullet$ is
in $\langle R \rangle_{b - a}$ and $M_b[-b]$ is in $\langle R \rangle_1$.
Hence $M^\bullet \in \langle R \rangle_{b - a + 1}$ by definition.
\end{proof}

\noindent
Let $R$ be a ring. Recall that $D(R)$ has direct sums which are given
simply by taking direct sums of complexes, see
Derived Categories, Lemma \ref{derived-lemma-direct-sums}.
We will use this in the lemmas of this section without further mention. 

\begin{lemma}
\label{lemma-commutes-with-countable-sums}
Let $R$ be a ring. Let $K \in D(R)$ be an object such that for every
countable set of objects $E_n \in D(R)$ the canonical map
$$
\bigoplus \Hom_{D(R)}(K, E_n) \longrightarrow \Hom_{D(R)}(K, \bigoplus E_n)
$$
is a bijection. Then, given any system $L_n^\bullet$ of complexes over
$\mathbf{N}$ we have that
$$
\colim \Hom_{D(R)}(K, L^\bullet_n) \longrightarrow \Hom_{D(R)}(K, L^\bullet)
$$
is a bijection, where $L^\bullet$ is the termwise colimit, i.e.,
$L^m = \colim L_n^m$ for all $m \in \mathbf{Z}$.
\end{lemma}

\begin{proof}
Consider the short exact sequence of complexes
$$
0 \to \bigoplus L_n^\bullet \to \bigoplus L_n^\bullet \to L^\bullet \to 0
$$
where the first map is given by $1 - t_n$ in degree $n$ where
$t_n : L_n^\bullet \to L_{n + 1}^\bullet$ is the transition map.
By
Derived Categories, Lemma \ref{derived-lemma-derived-canonical-delta-functor}
this is a distinguished triangle in $D(R)$.
Apply the homological functor $\Hom_{D(R)}(K, -)$, see
Derived Categories, Lemma \ref{derived-lemma-representable-homological}.
Thus a long exact cohomology sequence
$$
\xymatrix{
& \ldots \ar[r] & \Hom_{D(R)}(K, \colim L^\bullet_n[-1]) \ar[lld] \\
\Hom_{D(R)}(K, \bigoplus L^\bullet_n) \ar[r] &
\Hom_{D(R)}(K, \bigoplus L^\bullet_n) \ar[r] &
\Hom_{D(R)}(K, \colim L^\bullet_n) \ar[lld] \\
\Hom_{D(R)}(K, \bigoplus L^\bullet_n[1]) \ar[r] & \ldots
}
$$
Since we have assumed that $\Hom_{D(R)}(K, \bigoplus L^\bullet_n)$
is equal to $\bigoplus \Hom_{D(R)}(K, L^\bullet_n)$ we see that the first
map on every row of the diagram is injective (by the explicit description
of this map as the sum of the maps induced by $1 - t_n$). Hence
we conclude that $\Hom_{D(R)}(K, \colim L^\bullet_n)$ is the cokernel
of the first map of the middle row in the diagram above which is what
we had to show.
\end{proof}

\noindent
The following proposition, characterizing perfect complexes as the compact
objects
(Derived Categories, Definition \ref{derived-definition-compact-object})
of the derived category, shows up in various places. See for example
\cite[proof of Proposition 6.3]{Rickard} (this treats the bounded case),
\cite[Theorem 2.4.3]{TT} (the statement doesn't match exactly), and
\cite[Proposition 6.4]{Bokstedt-Neeman} (watch out for
horrendous notational conventions).

\begin{proposition}
\label{proposition-perfect-is-compact}
Let $R$ be a ring. For an object $K$ of $D(R)$ the following are equivalent
\begin{enumerate}
\item $K$ is perfect, and
\item $K$ is a compact object of $D(R)$.
\end{enumerate}
\end{proposition}

\begin{proof}
Assume $K$ is perfect, i.e., $K$ is quasi-isomorphic to a bounded complex
$P^\bullet$ of finite projective modules, see
Definition \ref{definition-perfect}. If $E_i$ is represented by the complex
$E_i^\bullet$, then $\bigoplus E_i$ is represented by the complex
whose degree $n$ term is $\bigoplus E_i^n$. On the other hand,
as $P^n$ is projective for all $n$ we have
$\Hom_{D(R)}(P^\bullet, K^\bullet) = \Hom_{K(R)}(P^\bullet, K^\bullet)$
for every complex of $R$-modules $K^\bullet$, see
Derived Categories,
Lemma \ref{derived-lemma-morphisms-from-projective-complex}.
Thus $\Hom_{D(R)}(P^\bullet, E^\bullet)$ is the cohomology of the complex
$$
\prod \Hom_R(P^n, E^{n - 1}) \to
\prod \Hom_R(P^n, E^n) \to
\prod \Hom_R(P^n, E^{n + 1}).
$$
Since $P^\bullet$ is bounded we see that we may replace the $\prod$
signs by $\bigoplus$ signs in the complex above. Since each $P^n$ is a finite
$R$-module we see that
$\Hom_R(P^n, \bigoplus_i E_i^m) = \bigoplus_i \Hom_R(P^n, E_i^m)$
for all $n, m$.
Combining these remarks we see that the map of
Derived Categories, Definition \ref{derived-definition-compact-object}
is a bijection.

\medskip\noindent
Conversely, assume $K$ is compact.
Represent $K$ by a complex $K^\bullet$ and consider the map
$$
K^\bullet
\longrightarrow
\bigoplus\nolimits_{n \geq 0} \tau_{\geq n} K^\bullet
$$
where we have used the canonical truncations, see
Homology, Section \ref{homology-section-truncations}.
This makes sense as in each degree the direct sum on the right is finite.
By assumption this map factors through a finite direct sum.
We conclude that $K \to \tau_{\geq n} K$ is zero for at least one $n$,
i.e., $K$ is in $D^{-}(R)$.

\medskip\noindent
Since $K \in D^{-}(R)$ and since every $R$-module is a quotient of a free
module, we may represent $K$ by a bounded above complex $K^\bullet$
of free $R$-modules, see
Derived Categories, Lemma \ref{derived-lemma-subcategory-left-resolution}.
Note that we have
$$
K^\bullet = \bigcup\nolimits_{n \leq 0} \sigma_{\geq n}K^\bullet
$$
where we have used the stupid truncations, see
Homology, Section \ref{homology-section-truncations}.
Hence by Lemma \ref{lemma-commutes-with-countable-sums} we see that
$1 : K^\bullet \to K^\bullet$ factors through
$\sigma_{\geq n}K^\bullet \to K^\bullet$ in $D(R)$.
Thus we see that $1 : K^\bullet \to K^\bullet$ factors as
$$
K^\bullet \xrightarrow{\varphi} L^\bullet \xrightarrow{\psi} K^\bullet
$$
in $D(R)$ for some complex $L^\bullet$ which is bounded and whose terms
are free $R$-modules. Say $L^i = 0$ for $i \not \in [a, b]$.
Fix $a, b$ from now on. Let $c$ be the largest integer $\leq b + 1$
such that we can find a factorization of $1_{K^\bullet}$ as above
with $L^i$ is finite free for $i < c$. We will show by induction that
$c = b + 1$. Namely, write $L^c = \bigoplus_{\lambda \in \Lambda} R$.
Since $L^{c - 1}$ is finite free we can find a finite subset
$\Lambda' \subset \Lambda$ such that $L^{c - 1} \to L^c$ factors
through $\bigoplus_{\lambda \in \Lambda'} R \subset L^c$. Consider the
map of complexes
$$
\pi :
L^\bullet
\longrightarrow
(\bigoplus\nolimits_{\lambda \in \Lambda \setminus \Lambda'} R)[-c]
$$
given by the projection onto the factors corresponding to
$\Lambda \setminus \Lambda'$ in degree $i$.
By our assumption on $K$ we see that, after possibly replacing $\Lambda'$ by
a larger finite subset, we may assume that $\pi \circ \varphi = 0$
in $D(R)$. Let $(L')^\bullet \subset L^\bullet$ be the kernel of $\pi$.
Since $\pi$ is surjective we get a short exact sequence of complexes,
which gives a distinguished triangle in $D(R)$ (see
Derived Categories, Lemma \ref{derived-lemma-derived-canonical-delta-functor}).
Since $\Hom_{D(R)}(K, -)$ is homological (see
Derived Categories, Lemma \ref{derived-lemma-representable-homological})
and $\pi \circ \varphi = 0$, we can find a morphism
$\varphi' : K^\bullet \to (L')^\bullet$ in $D(R)$ whose
composition with $(L')^\bullet \to L^\bullet$ gives $\varphi$.
Setting $\psi'$ equal to the composition of $\psi$ with
$(L')^\bullet \to L^\bullet$ we obtain a new factorization.
Since $(L')^\bullet$ agrees with $L^\bullet$ except in degree $c$
and since $(L')^c = \bigoplus_{\lambda \in \Lambda'} R$ the
induction step is proved.

\medskip\noindent
The conclusion of the discussion of the preceding paragraph is that
$1_K : K \to K$ factors as
$$
K \xrightarrow{\varphi} L \xrightarrow{\psi} K
$$
in $D(R)$ where $L$ can be represented by a finite
complex of free $R$-modules. In particular we see that $L$ is
perfect. Note that $e = \varphi \circ \psi \in \text{End}_{D(R)}(L)$
is an idempotent. By Derived Categories,
Lemma \ref{derived-lemma-projectors-have-images-triangulated}
we see that $L = \Ker(e) \oplus \Ker(1 - e)$.
The map $\varphi : K \to L$ induces an isomorphism with
$\Ker(1 - e)$ in $D(R)$. Hence we finally conclude that
$K$ is perfect by Lemma \ref{lemma-summands-perfect}.
\end{proof}

\begin{lemma}
\label{lemma-perfect-modulo-nilpotent-ideal}
Let $R$ be a ring. Let $I \subset R$ be an ideal.
Let $K$ be an object of $D(R)$. Assume that
\begin{enumerate}
\item $K \otimes_R^\mathbf{L} R/I$ is perfect in $D(R/I)$, and
\item $I$ is a nilpotent ideal.
\end{enumerate}
Then $K$ is perfect in $D(R)$.
\end{lemma}

\begin{proof}
Choose a finite complex $\overline{P}^\bullet$ of finite projective
$R/I$-modules representing $K \otimes_R^\mathbf{L} R/I$, see
Definition \ref{definition-perfect}. By
Lemma \ref{lemma-lift-complex-projectives}
there exists a complex $P^\bullet$ of projective $R$-modules
representing $K$ such that $\overline{P}^\bullet = P^\bullet/IP^\bullet$.
It follows from Nakayama's lemma (Algebra, Lemma \ref{algebra-lemma-NAK})
that $P^\bullet$ is a finite complex of finite projective
$R$-modules.
\end{proof}

\begin{lemma}
\label{lemma-perfect-modulo-two-ideals}
Let $R$ be a ring. Let $I, J \subset R$ be ideals.
Let $K$ be an object of $D(R)$. Assume that
\begin{enumerate}
\item $K \otimes_R^\mathbf{L} R/I$ is perfect in $D(R/I)$, and
\item $K \otimes_R^\mathbf{L} R/J$ is perfect in $D(R/J)$.
\end{enumerate}
Then $K \otimes_R^\mathbf{L} R/IJ$ is perfect in $D(R/IJ)$.
\end{lemma}

\begin{proof}
It is clear that we may assume replace $R$ by $R/IJ$ and $K$ by
$K \otimes_R^\mathbf{L} R/IJ$. Then $R \to R/(I \cap J)$ is
a surjection whose kernel has square zero. Hence by
Lemma \ref{lemma-perfect-modulo-nilpotent-ideal}
it suffices to prove that $K \otimes_R^\mathbf{L} R/(I \cap J)$ is
perfect. Thus we may assume that $I \cap J = 0$.

\medskip\noindent
We prove the lemma in case $I \cap J = 0$. First, we may represent $K$
by a K-flat complex $K^\bullet$ with all $K^n$ flat, see
Lemma \ref{lemma-K-flat-resolution}. Then we see that we have a short
exact sequence of complexes
$$
0 \to
K^\bullet \to K^\bullet/IK^\bullet \oplus K^\bullet/JK^\bullet \to
K^\bullet/(I + J)K^\bullet \to 0
$$
Note that $K^\bullet/IK^\bullet$ represents $K \otimes^\mathbf{L}_R R/I$
by construction of the derived tensor product. Similarly for
$K^\bullet/JK^\bullet$ and $K^\bullet/(I + J)K^\bullet$.
Note that $K^\bullet/(I + J)K^\bullet$ is a perfect complex
of $R/(I + J)$-modules, see
Lemma \ref{lemma-pull-perfect}.
Hence the complexes $K^\bullet/IK^\bullet$, and
$K^\bullet/JK^\bullet$ and $K^\bullet/(I + J)K^\bullet$
have finitely many nonzero cohomology groups
(since a perfect complex has finite Tor-amplitude, see
Lemma \ref{lemma-perfect}). We conclude that $K \in D^b(R)$ by the
long exact cohomology sequence associated to short exact sequence
of complexes displayed above. In particular we assume $K^\bullet$
is a bounded above complex of free $R$-modules (see
Derived Categories, Lemma \ref{derived-lemma-subcategory-left-resolution}).

\medskip\noindent
We will now show that $K$ is perfect using the criterion of
Proposition \ref{proposition-perfect-is-compact}. Thus we let
$E_j \in D(R)$ be a family of objects parametrized by a set $J$.
We choose complexes $E_j^\bullet$ with flat terms
representing $E_j$, see for example Lemma \ref{lemma-K-flat-resolution}.
It is clear that
$$
0 \to
E_j^\bullet \to
E_j^\bullet/IE_j^\bullet \oplus E_j^\bullet/JE_j^\bullet \to
E_j^\bullet/(I + J)E_j^\bullet \to 0
$$
is a short exact sequence of complexes. Taking direct sums we obtain a
similar short exact sequence
$$
0 \to
\bigoplus E_j^\bullet \to
\bigoplus E_j^\bullet/IE_j^\bullet \oplus E_j^\bullet/JE_j^\bullet \to
\bigoplus E_j^\bullet/(I + J)E_j^\bullet \to 0
$$
(Note that $- \otimes_R R/I$ commutes with direct sums.)
This short exact sequence determines a distinguished triangle in $D(R)$, see
Derived Categories, Lemma \ref{derived-lemma-derived-canonical-delta-functor}.
Apply the homological functor $\Hom_{D(R)}(K, -)$ (see
Derived Categories, Lemma \ref{derived-lemma-representable-homological})
to get a commutative diagram
$$
\xymatrix{
\bigoplus \Hom_{D(R)}(K^\bullet, E_j^\bullet/(I + J))[-1] \ar[r] \ar[d] &
\Hom_{D(R)}(K^\bullet, \bigoplus E_j^\bullet/(I + J))[-1] \ar[d] \\
\bigoplus \Hom_{D(R)}(K^\bullet, E_j^\bullet/I \oplus E_j^\bullet/J)[-1]
\ar[r] \ar[d] &
\Hom_{D(R)}(K^\bullet, \bigoplus E_j^\bullet/I \oplus E_j^\bullet/J)[-1]
\ar[d] \\
\bigoplus \Hom_{D(R)}(K^\bullet, E_j^\bullet) \ar[r] \ar[d] &
\Hom_{D(R)}(K^\bullet, \bigoplus E_j^\bullet) \ar[d] \\
\bigoplus \Hom_{D(R)}(K^\bullet, E_j^\bullet/I \oplus E_j^\bullet/J)
\ar[r] \ar[d] &
\Hom_{D(R)}(K^\bullet, \bigoplus E_j^\bullet/I \oplus E_j^\bullet/J)
\ar[d] \\
\bigoplus \Hom_{D(R)}(K^\bullet, E_j^\bullet/(I + J)) \ar[r] &
\Hom_{D(R)}(K^\bullet, \bigoplus E_j^\bullet/(I + J))
}
$$
with exact columns. It is clear that, for any complex $E^\bullet$
of $R$-modules we have
\begin{align*}
\Hom_{D(R)}(K^\bullet, E^\bullet/I) & =
\Hom_{K(R)}(K^\bullet, E^\bullet/I) \\
& =
\Hom_{K(R/I)}(K^\bullet/IK^\bullet, E^\bullet/I) \\
& =
\Hom_{D(R/I)}(K^\bullet/IK^\bullet, E^\bullet/I)
\end{align*}
and similarly for when dividing by $J$ or $I + J$, see
Derived Categories,
Lemma \ref{derived-lemma-morphisms-from-projective-complex}.
Derived Categories. Thus all the horizontal
arrows, except for possibly the middle one, are isomorphisms as the complexes
$K^\bullet/IK^\bullet$, $K^\bullet/JK^\bullet$, $K^\bullet/(I + J)K^\bullet$
are perfect complexes of $R/I$, $R/J$, $R/(I + J)$-modules, see
Proposition \ref{proposition-perfect-is-compact}.
It follows from the $5$-lemma (Homology, Lemma \ref{homology-lemma-five-lemma})
that the middle map is an isomorphism and the lemma follows by
Proposition \ref{proposition-perfect-is-compact}.
\end{proof}






\section{Strong generators and regular rings}
\label{section-strong-generators-regular}

\noindent
Let $R$ be a ring. Denote $D(R)_c$ the saturated full triangulated subcategory
of $D(R)$. We already know that
$$
\langle R \rangle = D_{perf}(R) = D(R)_c
$$
See Lemma \ref{lemma-perfect-ring-classical-generator}
and Proposition \ref{proposition-perfect-is-compact}.
It turns out that if $R$ is regular, then $R$ is a strong generator
(Derived Categories, Definition \ref{derived-definition-generators}).

\begin{lemma}
\label{lemma-ghost-lemma}
\begin{reference}
\cite{Kelly}
\end{reference}
Let $R$ be a ring. Let $n \geq 1$. Let $K \in \langle R \rangle_n$ with
notation as in Derived Categories, Section \ref{derived-section-generators}.
Consider maps
$$
K \xrightarrow{f_1} K_1 \xrightarrow{f_2} K_2
\xrightarrow{f_3} \ldots \xrightarrow{f_n} K_n
$$
in $D(R)$. If $H^i(f_j) = 0$ for all $i, j$, then
$f_n \circ \ldots \circ f_1 = 0$.
\end{lemma}

\begin{proof}
If $n = 1$, then $K$ is a direct summand in $D(R)$ of a bounded complex
$P^\bullet$ whose terms are finite free $R$-modules and whose differentials
are zero. Thus it suffices to show any morphism $f : P^\bullet \to K_1$
in $D(R)$ with $H^i(f) = 0$ for all $i$ is zero. Since $P^\bullet$ is
a finite direct sum $P^\bullet = \bigoplus R[m_j]$ it suffices to show
any morphism $g : R[m] \to K_1$ with $H^{-m}(g) = 0$ in $D(R)$ is zero.
This follows from the fact that $\Hom_{D(R)}(R[-m], K) = H^m(K)$.

\medskip\noindent
For $n > 1$ we proceed by induction on $n$. Namely, we know that $K$
is a summand in $D(R)$ of an object $P$ which sits in a distinguished triangle
$$
P' \xrightarrow{i} P \xrightarrow{p} P'' \to P'[1]
$$
with $P' \in \langle R \rangle_1$ and $P'' \in \langle R \rangle_{n - 1}$.
As above we may replace $K$ by $P$ and assume that we have
$$
P \xrightarrow{f_1} K_1 \xrightarrow{f_2} K_2
\xrightarrow{f_3} \ldots \xrightarrow{f_n} K_n
$$
in $D(R)$ with $f_j$ zero on cohomology.
By the case $n = 1$ the composition $f_1 \circ i$ is zero.
Hence by Derived Categories, Lemma \ref{derived-lemma-representable-homological}
we can find a morphism $h : P'' \to K_1$ such that $f_1 = h \circ p$.
Observe that $f_2 \circ h$ is zero on cohomology.
Hence by induction we find that $f_n \circ \ldots \circ f_2 \circ h = 0$
which implies $f_n \circ \ldots \circ f_1 = 
f_n \circ \ldots \circ f_2 \circ h \circ p = 0$ as desired.
\end{proof}

\begin{lemma}
\label{lemma-not-regular-not-strong}
Let $R$ be a Noetherian ring. If $R$ is
a strong generator for $D_{perf}(R)$, then $R$ is regular
of finite dimension.
\end{lemma}

\begin{proof}
Assume $D_{perf}(R) = \langle R \rangle_n$ for some $n \geq 1$.
For any finite $R$-module $M$ we can choose a complex
$$
P = (
P^{-n - 1} \xrightarrow{d^{-n - 1}}
P^{-n} \xrightarrow{d^{-n}}
P^{-n + 1} \xrightarrow{d^1}
\ldots \xrightarrow{d^{-1}} P^0)
$$
of finite free $R$-modules with $H^i(P) = 0$ for $i = -n, \ldots, - 1$
and $M \cong \Coker(d^{-1})$. Note that $P$ is in $D_{perf}(R)$.
For any $R$-module $N$ we can compute $\Ext^n_R(M, N)$
the finite free resolution $P$ of $M$, see
Algebra, Section \ref{algebra-section-ext} and compare with
Derived Categories, Section \ref{derived-section-ext}.
In particular, the sequence above defines an element
$$
\xi \in \Ext^n_R(\Coker(d^{-1}), \Coker(d^{-n - 1})) =
\Ext^n_R(M, \Coker(d^{-n - 1}))
$$
and for any element $\overline{\xi}$ in $\Ext^n_R(M, N)$
there is a $R$-module map $\varphi : \Coker(d^{-n - 1}) \to N$ such
that $\varphi$ maps $\xi$ to $\overline{\xi}$.
For $j = 1, \ldots, n - 1$ consider the complexes
$$
K_j = (\Coker(d^{-n - 1}) \to P^{-n + 1} \to \ldots \to P^{-j})
$$
with $\Coker(d^{-n - 1})$ in degree $-n$ and $P^t$ in degree $t$.
We also set $K_n = \Coker(d^{-n - 1})[n]$. Then we have maps
$$
P \to K_1 \to K_2 \to \ldots \to K_n
$$
which induce vanishing maps on cohomology. By Lemma \ref{lemma-ghost-lemma}
since $P \in D_{perf}(R) = \langle R \rangle_n$ we find that the composition
of this maps is zero in $D(R)$. Since
$\Hom_{D(R)}(P, K_n) = \Hom_{K(R)}(P, K_n)$ by
Derived Categories, Lemma \ref{derived-lemma-morphisms-from-projective-complex}
we conclude $\xi = 0$. Hence $\Ext^n_R(M, N) = 0$ for all $R$-modules
$N$, see discussion above.
It follows that $M$ has projective dimension $\leq n - 1$ by
Algebra, Lemma \ref{algebra-lemma-projective-dimension-ext}.
Since this holds for all finite $R$-modules $M$ we conclude that
$R$ has finite global dimension, see
Algebra, Lemma \ref{algebra-lemma-finite-gl-dim}.
We finally conclude by Algebra, Lemma
\ref{algebra-lemma-finite-gl-dim-finite-dim-regular}.
\end{proof}

\begin{lemma}
\label{lemma-ext-regular}
Let $R$ be a Noetherian regular ring of dimension $d < \infty$.
Let $K, L \in D^-(R)$. Assume there exists an $k$ such that
$H^i(K) = 0$ for $i \leq k$ and $H^i(L) = 0$ for $i \geq k - d + 1$.
Then $\Hom_{D(R)}(K, L) = 0$.
\end{lemma}

\begin{proof}
Let $K^\bullet$ be a bounded above complex representing $K$, say
$K^i = 0$ for $i \geq n + 1$. After replacing $K^\bullet$ by
$\tau_{\geq k + 1}K^\bullet$ we may assume $K^i = 0$ for $i \leq k$.
Then we may use the distinguished triangle
$$
K^n[-n] \to K^\bullet \to \sigma_{\leq n - 1}K^\bullet
$$
to see it suffices to prove the lemma for $K^n[-n]$ and
$\sigma_{\leq n - 1}K^\bullet$. By induction on $n$, we conclude
that it suffices to prove the lemma in case $K$ is represented by
the complex $M[-m]$ for some $R$-module $M$ and some $m \geq k + 1$.
Since $R$ has global dimension $d$ by Algebra, Lemma
\ref{algebra-lemma-finite-gl-dim-finite-dim-regular}
we see that $M$ has a projective resolution
$0 \to P_d \to \ldots \to P_0 \to M \to 0$.
Then the complex $P^\bullet$ having $P_i$ in degree $m - i$
is a bounded complex of projectives representing $M[-m]$.
On the other hand, we can choose a complex $L^\bullet$ representing
$L$ with $L^i = 0$ for $i \geq k - d  + 1$.
Hence any map of complexes $P^\bullet \to L^\bullet$ is zero.
This implies the lemma by Derived Categories, Lemma
\ref{derived-lemma-morphisms-from-projective-complex}.
\end{proof}

\begin{lemma}
\label{lemma-split-complex-regular}
Let $R$ be a Noetherian regular ring of dimension $1 \leq d < \infty$.
Let $K \in D(R)$ be perfect and let $k \in \mathbf{Z}$ such that
$H^i(K) = 0$ for $i = k - d + 2, \ldots, k$ (empty condition if $d = 1$).
Then $K = \tau_{\leq k - d + 1}K \oplus \tau_{\geq k + 1}K$.
\end{lemma}

\begin{proof}
The vanishing of cohomology shows that we have a distinguished triangle
$$
\tau_{\leq k - d + 1}K \to K \to \tau_{\geq k + 1}K \to
(\tau_{\leq k - d + 1}K)[1]
$$
By Derived Categories, Lemma \ref{derived-lemma-split} it suffices to show that
the third arrow is zero. Thus it suffices to show that
$\Hom_{D(R)}(\tau_{\geq k + 1}K, (\tau_{\leq k - d + 1}K)[1]) = 0$
which follows from Lemma \ref{lemma-ext-regular}.
\end{proof}

\begin{lemma}
\label{lemma-regular-strong-generator}
Let $R$ be a Noetherian regular ring of finite dimension.
Then $R$ is a strong generator for the full subcategory
$D_{perf}(R) \subset D(R)$ of perfect objects.
\end{lemma}

\begin{proof}
We will use that an object $K$ of $D(R)$ is perfect if and only
if $K$ is bounded and has finite cohomology modules, see
Lemma \ref{lemma-regular-perfect}.
Strong generators of triangulated categories are defined in
Derived Categories, Definition \ref{derived-definition-generators}.
Let $d = \dim(R)$.

\medskip\noindent
Let $K \in D_{perf}(R)$. We will show $K \in \langle R \rangle_{d + 1}$.
By Algebra, Lemma \ref{algebra-lemma-finite-gl-dim-finite-dim-regular}
every finite $R$-module has projective dimension $\leq d$.
We will show by induction on $0 \leq i \leq d$ that
if $H^n(K)$ has projective dimension $\leq i$ for all
$n \in \mathbf{Z}$, then $K$ is in $\langle R \rangle_{i + 1}$.

\medskip\noindent
Base case $i = 0$. In this case $H^n(K)$ is a finite $R$-module
of projective dimension $0$. In other words, each cohomology
is a projective $R$-module. Thus $\Ext^i_R(H^n(K), H^m(K)) = 0$
for all $i > 0$ and $m, n \in \mathbf{Z}$. By
Derived Categories, Lemma \ref{derived-lemma-ext-2-zero-pre}
we find that $K$ is isomorphic to the direct sum of the shifts of its
cohomology modules. Since each cohomology module is a finite
projective $R$-module, it is a direct summand of a direct sum
of copies of $R$. Hence by definition we see that $K$
is contained in $\langle R \rangle_1$.

\medskip\noindent
Induction step. Assume the claim holds for $i < d$ and let
$K \in D_{perf}(R)$ have the property that $H^n(K)$ has
projective dimension $\leq i + 1$ for all $n \in \mathbf{Z}$.
Choose $a \leq b$ such that $H^n(K)$ is zero for $n \not \in [a, b]$.
For each $n \in [a, b]$ choose a surjection $F^n \to H^n(K)$
where $F^n$ is a finite free $R$-module. Since $F^n$ is projective,
we can lift $F^n \to H^n(K)$ to a map $F^n[-n] \to K$ in $D(R)$
(small detail omitted). Thus we obtain a morphism
$\bigoplus_{a \leq n \leq b} F^n[-n] \to K$
which is surjective on cohomology modules.
Choose a distinguished triangle
$$
K' \to \bigoplus\nolimits_{a \leq n \leq b} F^n[-n] \to K \to K'[1]
$$
in $D(R)$. Of course, the object $K'$ is bounded and has
finite cohomology modules. The long exact sequence of cohomology
breaks into short exact sequences
$$
0 \to H^n(K') \to F^n \to H^n(K) \to 0
$$
by the choices we made. By
Algebra, Lemma \ref{algebra-lemma-exact-sequence-projective-dimension}
we see that the projective dimension of $H^n(K')$ is $\leq \max(0, i)$.
Thus $K' \in \langle R \rangle_{i + 1}$. By definition this means
that $K$ is in $\langle R \rangle_{i + 1 + 1}$ as desired.
\end{proof}

\begin{proposition}
\label{proposition-regular-strong-generator}
Let $R$ be a Noetherian ring. The following are equivalent
\begin{enumerate}
\item $R$ is regular of finite dimension,
\item $D_{perf}(R)$ has a strong generator, and
\item $R$ is a strong generator for $D_{perf}(R)$.
\end{enumerate}
\end{proposition}

\begin{proof}
This is a formal consequence of
Lemmas \ref{lemma-perfect-ring-classical-generator},
\ref{lemma-not-regular-not-strong}, and
\ref{lemma-regular-strong-generator}
as well as Derived Categories, Lemma
\ref{derived-lemma-classical-generator-strong-generator}.
\end{proof}







\section{Relatively finitely presented modules}
\label{section-relative-finite-presentation}

\noindent
Let $R$ be a ring. Let $A \to B$ be a finite map of finite type $R$-algebras.
Let $M$ be a finite $B$-module. In this case it is {\bf not true} that
$$
M\text{ of finite presentation over }B
\Leftrightarrow
M\text{ of finite presentation over }A
$$
A counter example is $R = k[x_1, x_2, x_3, \ldots]$, $A = R$, $B = R/(x_i)$,
and $M = B$. To ``fix'' this we introduce a relative notion of finite
presentation.

\begin{lemma}
\label{lemma-relatively-finitely-presented}
Let $R \to A$ be a ring map of finite type.
Let $M$ be an $A$-module.
The following are equivalent
\begin{enumerate}
\item for some presentation $\alpha : R[x_1, \ldots, x_n] \to A$
the module $M$ is a finitely presented $R[x_1, \ldots, x_n]$-module,
\item for all presentations $\alpha : R[x_1, \ldots, x_n] \to A$
the module $M$ is a finitely presented $R[x_1, \ldots, x_n]$-module, and
\item for any surjection $A' \to A$ where $A'$ is a finitely presented
$R$-algebra, the module $M$ is finitely presented as $A'$-module.
\end{enumerate}
In this case $M$ is a finitely presented $A$-module.
\end{lemma}

\begin{proof}
If $\alpha : R[x_1, \ldots, x_n] \to A$ and
$\beta : R[y_1, \ldots, y_m] \to A$ are presentations.
Choose $f_j \in R[x_1, \ldots, x_n]$ with $\alpha(f_j) = \beta(y_j)$
and $g_i \in R[y_1, \ldots, y_m]$ with $\beta(g_i) = \alpha(x_i)$.
Then we get a commutative diagram
$$
\xymatrix{
R[x_1, \ldots, x_n, y_1, \ldots, y_m]
\ar[d]^{x_i \mapsto g_i} \ar[rr]_-{y_j \mapsto f_j} & &
R[x_1, \ldots, x_n] \ar[d] \\
R[y_1, \ldots, y_m] \ar[rr] & & A
}
$$
Hence the equivalence of (1) and (2) follows by applying
Algebra, Lemmas \ref{algebra-lemma-finitely-presented-over-subring} and
\ref{algebra-lemma-finite-finitely-presented-extension}.
The equivalence of (2) and (3) follows by choosing a presentation
$A' = R[x_1, \ldots, x_n]/(f_1, \ldots, f_m)$ and using
Algebra, Lemma \ref{algebra-lemma-finite-finitely-presented-extension}
to show that $M$ is finitely presented as $A'$-module if and only if
$M$ is finitely presented as a $R[x_1, \ldots, x_n]$-module.
\end{proof}

\begin{definition}
\label{definition-relatively-finitely-presented}
Let $R \to A$ be a finite type ring map. Let $M$ be an $A$-module.
We say $M$ is an $A$-module {\it finitely presented relative to $R$}
if the equivalent conditions of
Lemma \ref{lemma-relatively-finitely-presented}
hold.
\end{definition}

\noindent
Note that if $R \to A$ is of finite presentation, then $M$ is an
$A$-module finitely presented relative to $R$ if and only if $M$
is a finitely presented $A$-module. It is equally clear that $A$ as
an $A$-module is finitely presented relative to $R$ if and only if
$A$ is of finite presentation over $R$. If $R$ is Noetherian the notion
is uninteresting. Now we can formulate the result we were looking for.

\begin{lemma}
\label{lemma-finite-extension}
Let $R$ be a ring. Let $A \to B$ be a finite map of finite type $R$-algebras.
Let $M$ be a $B$-module. Then
$M$ is an $A$-module finitely presented relative to $R$
if and only if
$M$ is a $B$-module finitely presented relative to $R$.
\end{lemma}

\begin{proof}
Choose a surjection $R[x_1, \ldots, x_n] \to A$.
Choose $y_1, \ldots, y_m \in B$ which generate $B$ over $A$.
As $A \to B$ is finite each $y_i$ satisfies a monic equation with
coefficients in $A$. Hence we can find monic polynomials
$P_j(T) \in R[x_1, \ldots, x_n][T]$ such that $P_j(y_j) = 0$ in $B$.
Then we get a commutative diagram
$$
\xymatrix{
R[x_1, \ldots, x_n] \ar[d] \ar[r] &
R[x_1, \ldots, x_n, y_1, \ldots, y_m]/(P_j(y_j)) \ar[d] \\
A \ar[r] & B
}
$$
Since the top arrow is a finite and finitely presented ring map
we conclude by
Algebra, Lemma \ref{algebra-lemma-finite-finitely-presented-extension}
and the definition.
\end{proof}

\noindent
With this result in hand we see that the relative notion makes sense
and behaves well with regards to finite maps of rings of finite type
over $R$. It is also stable under localization, stable under
base change, and "glues" well.

\begin{lemma}
\label{lemma-localize-relative-finite-presentation}
Let $R$ be a ring, $f \in R$ an element, $R_f \to A$ is a finite type ring map,
$g \in A$, and $M$ an $A$-module. If $M$ of finite presentation relative
to $R_f$, then $M_g$ is an $A_g$-module of finite presentation relative
to $R$.
\end{lemma}

\begin{proof}
Choose a presentation $R_f[x_1, \ldots, x_n] \to A$. We write
$R_f = R[x_0]/(fx_0 - 1)$. Consider the presentation
$R[x_0, x_1, \ldots, x_n, x_{n + 1}] \to A_g$ which extends the given
map, maps $x_0$ to the image of $1/f$, and maps $x_{n + 1}$ to $1/g$.
Choose $g' \in R[x_0, x_1, \ldots, x_n]$ which maps to $g$ (this is
possible). Suppose that
$$
R_f[x_1, \ldots, x_n]^{\oplus s} \to
R_f[x_1, \ldots, x_n]^{\oplus t} \to M \to 0
$$
is a presentation of $M$ given by a matrix $(h_{ij})$. Pick
$h'_{ij} \in R[x_0, x_1, \ldots, x_n]$ which map to $h_{ij}$.
Then
$$
R[x_0, x_1, \ldots, x_n, x_{n + 1}]^{\oplus s + 2t} \to
R[x_0, x_1, \ldots, x_n, x_{n + 1}]^{\oplus t} \to M_g \to 0
$$
is a presentation of $M_f$.
Here the $t \times (s + 2t)$ matrix defining the map has a first
$t \times s$ block consisting of the matrix $h'_{ij}$, a second
$t \times t$ block which is $(x_0f - )I_t$, and a third block
which is $(x_{n + 1}g' - 1)I_t$.
\end{proof}

\begin{lemma}
\label{lemma-base-change-relative-finite-presentation}
Let $R \to A$ be a finite type ring map. Let $M$ be an $A$-module finitely
presented relative to $R$. For any ring map $R \to R'$ the
$A \otimes_R R'$-module
$$
M \otimes_A A' = M \otimes_R R'
$$
is finitely presented relative to $R'$.
\end{lemma}

\begin{proof}
Choose a surjection $R[x_1, \ldots, x_n] \to A$. Choose a presentation
$$
R[x_1, \ldots, x_n]^{\oplus s} \to
R[x_1, \ldots, x_n]^{\oplus t} \to M \to 0
$$
Then
$$
R'[x_1, \ldots, x_n]^{\oplus s} \to
R'[x_1, \ldots, x_n]^{\oplus t} \to M \otimes_R R' \to 0
$$
is a presentation of the base change and we win.
\end{proof}

\begin{lemma}
\label{lemma-pull-relative-finite-presentation}
Let $R \to A$ be a finite type ring map.
Let $M$ be an $A$-module finitely presented relative to $R$.
Let $A \to A'$ be a ring map of finite presentation.
The $A'$-module $M \otimes_A A'$ is finitely presented relative to $R$.
\end{lemma}

\begin{proof}
Choose a surjection $R[x_1, \ldots, x_n] \to A$. Choose a presentation
$A' = A[y_1, \ldots, y_m]/(g_1, \ldots, g_l)$.
Pick $g'_i \in R[x_1, \ldots, x_n, y_1, \ldots, y_m]$ mapping to $g_i$.
Say
$$
R[x_1, \ldots, x_n]^{\oplus s} \to
R[x_1, \ldots, x_n]^{\oplus t} \to M \to 0
$$
is a presentation of $M$ given by a matrix $(h_{ij})$.
Then
$$
R[x_1, \ldots, x_n, y_1, \ldots, y_m]^{\oplus s + tl} \to
R[x_0, x_1, \ldots, x_n, y_1, \ldots, y_m]^{\oplus t} \to M \otimes_A A' \to 0
$$
is a presentation of $M \otimes_A A'$.
Here the $t \times (s + lt)$ matrix defining the map has a first
$t \times s$ block consisting of the matrix $h_{ij}$, followed
by $l$ blocks of size $t \times t$ which are $g'_iI_t$.
\end{proof}

\begin{lemma}
\label{lemma-composition-relative-finite-presentation}
Let $R \to A \to B$ be finite type ring maps. Let $M$ be a $B$-module.
If $M$ is finitely presented relative to $A$ and $A$ is of finite presentation
over $R$, then $M$ is finitely presented relative to $R$.
\end{lemma}

\begin{proof}
Choose a surjection $A[x_1, \ldots, x_n] \to B$.
Choose a presentation
$$
A[x_1, \ldots, x_n]^{\oplus s} \to
A[x_1, \ldots, x_n]^{\oplus t} \to M \to 0
$$
given by a matrix $(h_{ij})$. Choose a presentation
$$
A = R[y_1, \ldots, y_m]/(g_1, \ldots, g_u).
$$
Choose $h'_{ij} \in R[y_1, \ldots, y_m, x_1, \ldots, x_n]$
mapping to $h_{ij}$. Then we obtain the presentation
$$
R[y_1, \ldots, y_m, x_1, \ldots, x_n]^{\oplus s + tu} \to
R[y_1, \ldots, y_m, x_1, \ldots, x_n]^{\oplus t} \to M \to 0
$$
where the $t \times (s + tu)$-matrix is given by a first $t \times s$ block
consisting of $h'_{ij}$ followed by $u$ blocks of size $t \times t$ given
by $g_iI_t$, $i = 1, \ldots, u$.
\end{proof}

\begin{lemma}
\label{lemma-glue-relative-finite-presentation}
Let $R \to A$ be a finite type ring map. Let $M$ be an $A$-module.
Let $f_1, \ldots, f_r \in A$ generate the unit ideal.
The following are equivalent
\begin{enumerate}
\item each $M_{f_i}$ is finitely presented relative to $R$, and
\item $M$ is finitely presented relative to $R$.
\end{enumerate}
\end{lemma}

\begin{proof}
The implication (2) $\Rightarrow$ (1) is in
Lemma \ref{lemma-localize-relative-finite-presentation}.
Assume (1). Write $1 = \sum f_ig_i$ in $A$.
Choose a surjection
$R[x_1, \ldots, x_n, y_1, \ldots, y_r, z_1, \ldots, z_r] \to A$.
such that $y_i$ maps to $f_i$ and $z_i$ maps to $g_i$. Then we
see that there exists a surjection
$$
P = R[x_1, \ldots, x_n, y_1, \ldots, y_r, z_1, \ldots, z_r]/(\sum y_iz_i - 1)
\longrightarrow
A.
$$
By
Lemma \ref{lemma-relatively-finitely-presented}
we see that $M_{f_i}$ is a finitely presented $A_{f_i}$-module, hence by
Algebra, Lemma \ref{algebra-lemma-cover}
we see that $M$ is a finitely presented $A$-module.
Hence $M$ is a finite $P$-module (with $P$ as above).
Choose a surjection $P^{\oplus t} \to M$.
We have to show that the kernel $K$ of this map is a finite
$P$-module. Since $P_{y_i}$ surjects onto
$A_{f_i}$ we see by
Lemma \ref{lemma-relatively-finitely-presented}
and
Algebra, Lemma \ref{algebra-lemma-extension}
that the localization $K_{y_i}$ is a finitely generated
$P_{y_i}$-module. Choose elements
$k_{i, j} \in K$, $i = 1, \ldots, r$, $j = 1, \ldots, s_i$ such
that the images of $k_{i, j}$ in $K_{y_i}$ generate.
Set $K' \subset K$ equal to the $P$-module
generated by the elements $k_{i, j}$. Then $K/K'$ is a module
whose localization at $y_i$ is zero for all $i$. Since $(y_1, \ldots, y_r) = P$
we see that $K/K' = 0$ as desired.
\end{proof}

\begin{lemma}
\label{lemma-ses-relatively-finite-presentation}
Let $R \to A$ be a finite type ring map. Let $0 \to M' \to M \to M'' \to 0$
be a short exact sequence of $A$-modules.
\begin{enumerate}
\item If $M', M''$ are finitely presented relative to $R$, then so is $M$.
\item If $M'$ is a finite type $A$-module and $M$ is finitely presented
relative to $R$, then $M''$ is finitely presented relative to $R$.
\end{enumerate}
\end{lemma}

\begin{proof}
Follows immediately from
Algebra, Lemma \ref{algebra-lemma-extension}.
\end{proof}

\begin{lemma}
\label{lemma-sum-relatively-finite-presentation}
Let $R \to A$ be a finite type ring map.
Let $M, M'$ be $A$-modules. If $M \oplus M'$ is
finitely presented relative to $R$, then so are $M$ and $M'$.
\end{lemma}

\begin{proof}
Omitted.
\end{proof}






\section{Relatively pseudo-coherent modules}
\label{section-relative-pseudo-coherent}

\noindent
This section is the analogue of
Section \ref{section-relative-finite-presentation}
for pseudo-coherence.

\begin{lemma}
\label{lemma-pull-push}
Let $R$ be a ring. Let $K^\bullet$ be a complex of $R$-modules.
Consider the $R$-algebra map $R[x] \to R$ which maps $x$ to zero.
Then
$$
K^\bullet \otimes_{R[x]}^{\mathbf{L}} R \cong K^\bullet \oplus K^\bullet[1]
$$
in $D(R)$.
\end{lemma}

\begin{proof}
Choose a K-flat resolution $P^\bullet \to K^\bullet$ over $R$
such that $P^n$ is a flat $R$-module for all $n$, see
Lemma \ref{lemma-K-flat-resolution}. Then $P^\bullet \otimes_R R[x]$
is a K-flat complex of $R[x]$-modules whose terms are flat $R[x]$-modules, see
Lemma \ref{lemma-base-change-K-flat} and
Algebra, Lemma \ref{algebra-lemma-flat-base-change}.
In particular $x : P^n \otimes_R R[x] \to P^n \otimes_R R[x]$
is injective with cokernel isomorphic to $P^n$. Thus
$$
P^\bullet \otimes_R R[x] \xrightarrow{x} P^\bullet \otimes_R R[x]
$$
is a double complex of $R[x]$-modules whose associated
total complex is quasi-isomorphic to $P^\bullet$ and hence $K^\bullet$.
Moreover, this associated total complex is a K-flat complex
of $R[x]$-modules for example by
Lemma \ref{lemma-tensor-product-K-flat} or by
Lemma \ref{lemma-K-flat-two-out-of-three}.
Hence
\begin{align*}
K^\bullet \otimes_{R[x]}^{\mathbf{L}} R
& \cong
\text{Tot}(P^\bullet \otimes_R R[x] \xrightarrow{x} P^\bullet \otimes_R R[x])
\otimes_{R[x]} R =
\text{Tot}(P^\bullet \xrightarrow{0} P^\bullet) \\
& = P^\bullet \oplus P^\bullet[1] \cong K^\bullet \oplus K^\bullet[1]
\end{align*}
as desired.
\end{proof}

\begin{lemma}
\label{lemma-add-variable-pseudo-coherent}
Let $R$ be a ring and $K^\bullet$ a complex of $R$-modules.
Let $m \in \mathbf{Z}$. Consider the $R$-algebra map $R[x] \to R$
which maps $x$ to zero. Then $K^\bullet$ is $m$-pseudo-coherent as
a complex of $R$-modules if and only if $K^\bullet$ is $m$-pseudo-coherent
as a complex of $R[x]$-modules.
\end{lemma}

\begin{proof}
This is a special case of
Lemma \ref{lemma-finite-push-pseudo-coherent}.
We also prove it in another way as follows.

\medskip\noindent
Note that $0 \to R[x] \to R[x] \to R \to 0$ is exact. Hence $R$ is
pseudo-coherent as an $R[x]$-module. Thus one implication of the lemma
follows from
Lemma \ref{lemma-finite-push-pseudo-coherent}.
To prove the other implication, assume that $K^\bullet$ is
$m$-pseudo-coherent as a complex of $R[x]$-modules. By
Lemma \ref{lemma-pull-pseudo-coherent}
we see that $K^\bullet \otimes^{\mathbf{L}}_{R[x]} R$ is
$m$-pseudo-coherent as a complex of $R$-modules. By
Lemma \ref{lemma-pull-push}
we see that $K^\bullet \oplus K^\bullet[1]$ is $m$-pseudo-coherent
as a complex of $R$-modules.
Finally, we conclude that $K^\bullet$ is $m$-pseudo-coherent
as a complex of $R$-modules from
Lemma \ref{lemma-summands-pseudo-coherent}.
\end{proof}

\begin{lemma}
\label{lemma-relatively-pseudo-coherent}
Let $R \to A$ be a ring map of finite type.
Let $K^\bullet$ be a complex of $A$-modules.
Let $m \in \mathbf{Z}$.
The following are equivalent
\begin{enumerate}
\item for some presentation $\alpha : R[x_1, \ldots, x_n] \to A$
the complex $K^\bullet$ is an $m$-pseudo-coherent complex of
$R[x_1, \ldots, x_n]$-modules,
\item for all presentations $\alpha : R[x_1, \ldots, x_n] \to A$
the complex $K^\bullet$ is an $m$-pseudo-coherent complex of
$R[x_1, \ldots, x_n]$-modules.
\end{enumerate}
In particular the same equivalence holds for pseudo-coherence.
\end{lemma}

\begin{proof}
If $\alpha : R[x_1, \ldots, x_n] \to A$ and
$\beta : R[y_1, \ldots, y_m] \to A$ are presentations.
Choose $f_j \in R[x_1, \ldots, x_n]$ with $\alpha(f_j) = \beta(y_j)$
and $g_i \in R[y_1, \ldots, y_m]$ with $\beta(g_i) = \alpha(x_i)$.
Then we get a commutative diagram
$$
\xymatrix{
R[x_1, \ldots, x_n, y_1, \ldots, y_m]
\ar[d]^{x_i \mapsto g_i} \ar[rr]_-{y_j \mapsto f_j} & &
R[x_1, \ldots, x_n] \ar[d] \\
R[y_1, \ldots, y_m] \ar[rr] & & A
}
$$
After a change of coordinates the ring homomorphism
$R[x_1, \ldots, x_n, y_1, \ldots, y_m] \to R[x_1, \ldots, x_n]$
is isomorphic to the ring homomorphism which maps
each $y_i$ to zero. Similarly for the left vertical map in the
diagram. Hence, by induction on the number of variables this lemma follows from
Lemma \ref{lemma-add-variable-pseudo-coherent}.
The pseudo-coherent case follows from this and
Lemma \ref{lemma-pseudo-coherent}.
\end{proof}

\begin{definition}
\label{definition-relatively-pseudo-coherent}
Let $R \to A$ be a finite type ring map.
Let $K^\bullet$ be a complex of $A$-modules.
Let $M$ be an $A$-module.
Let $m \in \mathbf{Z}$.
\begin{enumerate}
\item We say $K^\bullet$ is {\it $m$-pseudo-coherent relative to $R$}
if the equivalent conditions of
Lemma \ref{lemma-relatively-pseudo-coherent}
hold.
\item We say $K^\bullet$ is {\it pseudo-coherent relative to $R$}
if $K^\bullet$ is $m$-pseudo-coherent relative to $R$ for all
$m \in \mathbf{Z}$.
\item We say $M$ is {\it $m$-pseudo-coherent relative to $R$}
if $M[0]$ is $m$-pseudo-coherent relative to $R$.
\item We say $M$ is {\it pseudo-coherent relative to $R$}
if $M[0]$ is pseudo-coherent relative to $R$.
\end{enumerate}
\end{definition}

\noindent
Part (2) means that $K^\bullet$ is pseudo-coherent as a complex
of $R[x_1, \ldots, x_n]$-modules for any surjection
$R[y_1, \ldots, y_m] \to A$, see
Lemma \ref{lemma-pseudo-coherent}.
This definition has the following pleasing property.

\begin{lemma}
\label{lemma-finite-extension-pseudo-coherent}
Let $R$ be a ring. Let $A \to B$ be a finite map of finite type $R$-algebras.
Let $m \in \mathbf{Z}$. Let $K^\bullet$ be a complex of $B$-modules.
Then $K^\bullet$ is $m$-pseudo-coherent (resp.\ pseudo-coherent)
relative to $R$ if and only if $K^\bullet$ seen as a complex of $A$-modules
is $m$-pseudo-coherent (pseudo-coherent) relative to $R$.
\end{lemma}

\begin{proof}
Choose a surjection $R[x_1, \ldots, x_n] \to A$.
Choose $y_1, \ldots, y_m \in B$ which generate $B$ over $A$.
As $A \to B$ is finite each $y_i$ satisfies a monic equation with
coefficients in $A$. Hence we can find monic polynomials
$P_j(T) \in R[x_1, \ldots, x_n][T]$ such that $P_j(y_j) = 0$ in $B$.
Then we get a commutative diagram
$$
\xymatrix{
& R[x_1, \ldots, x_n, y_1, \ldots, y_m] \ar[d] \\
R[x_1, \ldots, x_n] \ar[d] \ar[r] &
R[x_1, \ldots, x_n, y_1, \ldots, y_m]/(P_j(y_j)) \ar[d] \\
A \ar[r] & B
}
$$
The top horizontal arrow and the top right vertical arrow
satisfy the assumptions of
Lemma \ref{lemma-finite-push-pseudo-coherent}.
Hence $K^\bullet$ is $m$-pseudo-coherent (resp.\ pseudo-coherent) as a complex
of $R[x_1, \ldots, x_n]$-modules if and only if $K^\bullet$ is
$m$-pseudo-coherent (resp.\ pseudo-coherent) as a complex of
$R[x_1, \ldots, x_n, y_1, \ldots, y_m]$-modules.
\end{proof}

\begin{lemma}
\label{lemma-cone-relatively-pseudo-coherent}
Let $R$ be a ring. Let $R \to A$ be a finite type ring map.
Let $m \in \mathbf{Z}$. Let $(K^\bullet, L^\bullet, M^\bullet, f, g, h)$
be a distinguished triangle in $D(A)$.
\begin{enumerate}
\item If $K^\bullet$ is $(m + 1)$-pseudo-coherent relative to $R$ and
$L^\bullet$ is $m$-pseudo-coherent relative to $R$ then $M^\bullet$ is
$m$-pseudo-coherent relative to $R$.
\item If $K^\bullet, M^\bullet$ are $m$-pseudo-coherent relative to $R$,
then $L^\bullet$ is $m$-pseudo-coherent relative to $R$.
\item If $L^\bullet$ is $(m + 1)$-pseudo-coherent relative to $R$
and $M^\bullet$ is $m$-pseudo-coherent relative to $R$, then
$K^\bullet$ is $(m + 1)$-pseudo-coherent relative to $R$.
\end{enumerate}
Moreover, if two out of three of $K^\bullet, L^\bullet, M^\bullet$
are pseudo-coherent relative to $R$, the so is the third.
\end{lemma}

\begin{proof}
Follows immediately from
Lemma \ref{lemma-cone-pseudo-coherent}
and the definitions.
\end{proof}

\begin{lemma}
\label{lemma-rel-n-pseudo-module}
Let $R \to A$ be a finite type ring map. Let $M$ be an $A$-module.
Then
\begin{enumerate}
\item $M$ is $0$-pseudo-coherent relative to $R$ if and only if
$M$ is a finite type $A$-module,
\item $M$ is $(-1)$-pseudo-coherent relative to $R$ if and only if
$M$ is a finitely presented relative to $R$,
\item $M$ is $(-d)$-pseudo-coherent relative to $R$ if and only if
for every surjection $R[x_1, \ldots, x_n] \to A$ there exists a
resolution
$$
R[x_1, \ldots, x_n]^{\oplus a_d} \to R[x_1, \ldots, x_n]^{\oplus a_{d - 1}}
\to \ldots \to R[x_1, \ldots, x_n]^{\oplus a_0} \to M \to 0
$$
of length $d$, and
\item $M$ is pseudo-coherent relative to $R$ if and only if
for every presentation $R[x_1, \ldots, x_n] \to A$ there exists an
infinite resolution
$$
\ldots \to R[x_1, \ldots, x_n]^{\oplus a_1} \to
R[x_1, \ldots, x_n]^{\oplus a_0} \to M \to 0
$$
by finite free $R[x_1, \ldots, x_n]$-modules.
\end{enumerate}
\end{lemma}

\begin{proof}
Follows immediately from
Lemma \ref{lemma-n-pseudo-module}
and the definitions.
\end{proof}

\begin{lemma}
\label{lemma-summands-relative-pseudo-coherent}
Let $R \to A$ be a finite type ring map.
Let $m \in \mathbf{Z}$. Let $K^\bullet, L^\bullet \in D(A)$.
If $K^\bullet \oplus L^\bullet$
is $m$-pseudo-coherent (resp.\ pseudo-coherent) relative to $R$
so are $K^\bullet$ and $L^\bullet$.
\end{lemma}

\begin{proof}
Immediate from
Lemma \ref{lemma-summands-pseudo-coherent}
and the definitions.
\end{proof}

\begin{lemma}
\label{lemma-complex-relative-pseudo-coherent-modules}
Let $R \to A$ be a finite type ring map.
Let $m \in \mathbf{Z}$. Let $K^\bullet$ be a bounded
above complex of $A$-modules such that $K^i$ is $(m - i)$-pseudo-coherent
relative to $R$ for all $i$. Then $K^\bullet$ is $m$-pseudo-coherent
relative to $R$. In particular, if $K^\bullet$ is a bounded above complex of
$A$-modules pseudo-coherent relative to $R$, then $K^\bullet$ is
pseudo-coherent relative to $R$.
\end{lemma}

\begin{proof}
Immediate from
Lemma \ref{lemma-complex-pseudo-coherent-modules}
and the definitions.
\end{proof}

\begin{lemma}
\label{lemma-cohomology-relative-pseudo-coherent}
Let $R \to A$ be a finite type ring map. Let $m \in \mathbf{Z}$.
Let $K^\bullet \in D^{-}(A)$ such that $H^i(K^\bullet)$ is
$(m - i)$-pseudo-coherent (resp.\ pseudo-coherent) relative to $R$
for all $i$. Then $K^\bullet$ is $m$-pseudo-coherent
(resp.\ pseudo-coherent) relative to $R$.
\end{lemma}

\begin{proof}
Immediate from
Lemma \ref{lemma-cohomology-pseudo-coherent}
and the definitions.
\end{proof}

\begin{lemma}
\label{lemma-localize-relative-pseudo-coherent}
Let $R$ be a ring, $f \in R$ an element, $R_f \to A$ is a finite type ring map,
$g \in A$, and $K^\bullet$ a complex of $A$-modules.
If $K^\bullet$ is $m$-pseudo-coherent (resp.\ pseudo-coherent)
relative to $R_f$, then $K^\bullet \otimes_A A_g$ is
$m$-pseudo-coherent (resp.\ pseudo-coherent) relative to $R$.
\end{lemma}

\begin{proof}
First we show that $K^\bullet$ is $m$-pseudo-coherent relative to $R$.
Namely, suppose $R_f[x_1, \ldots, x_n] \to A$ is surjective. Write
$R_f = R[x_0]/(fx_0 - 1)$. Then $R[x_0, x_1, \ldots, x_n] \to A$
is surjective, and $R_f[x_1, \ldots, x_n]$ is pseudo-coherent as
an $R[x_0, \ldots, x_n]$-module. Hence by
Lemma \ref{lemma-finite-push-pseudo-coherent}
we see that $K^\bullet$ is $m$-pseudo-coherent as a complex of
$R[x_0, x_1, \ldots, x_n]$-modules.

\medskip\noindent
Choose an element $g' \in R[x_0, x_1, \ldots, x_n]$ which maps to $g \in A$. By
Lemma \ref{lemma-pull-pseudo-coherent}
we see that
\begin{align*}
K^\bullet \otimes_{R[x_0, x_1, \ldots, x_n]}^{\mathbf{L}}
R[x_0, x_1, \ldots, x_n, \frac{1}{g'}] & =
K^\bullet \otimes_{R[x_0, x_1, \ldots, x_n]}
R[x_0, x_1, \ldots, x_n, \frac{1}{g'}] \\
& = K^\bullet \otimes_A A_f
\end{align*}
is $m$-pseudo-coherent as a complex of
$R[x_0, x_1, \ldots, x_n, \frac{1}{g'}]$-modules.
write
$$
R[x_0, x_1, \ldots, x_n, \frac{1}{g'}] =
R[x_0, \ldots, x_n, x_{n + 1}]/(x_{n + 1}g' - 1).
$$
As $R[x_0, x_1, \ldots, x_n, \frac{1}{g'}]$ is pseudo-coherent as a
$R[x_0, \ldots, x_n, x_{n + 1}]$-module we conclude (see
Lemma \ref{lemma-finite-push-pseudo-coherent})
that $K^\bullet \otimes_A A_g$ is $m$-pseudo-coherent as a complex of
$R[x_0, \ldots, x_n, x_{n + 1}]$-modules as desired.
\end{proof}

\begin{lemma}
\label{lemma-base-change-relative-pseudo-coherent}
Let $R \to A$ be a finite type ring map. Let $m \in \mathbf{Z}$.
Let $K^\bullet$ be a complex of $A$-modules which is $m$-pseudo-coherent
(resp.\ pseudo-coherent) relative to $R$. Let $R \to R'$ be a ring
map such that $A$ and $R'$ are Tor independent over $R$. Set
$A' = A \otimes_R R'$. Then
$K^\bullet \otimes_A^{\mathbf{L}} A'$
is $m$-pseudo-coherent (resp.\ pseudo-coherent) relative to $R'$.
\end{lemma}

\begin{proof}
Choose a surjection $R[x_1, \ldots, x_n] \to A$.
Note that
$$
K^\bullet \otimes_A^{\mathbf{L}} A' =
K^\bullet \otimes_R^{\mathbf{L}} R' =
K^\bullet \otimes_{R[x_1, \ldots, x_n]}^{\mathbf{L}} R'[x_1, \ldots, x_n]
$$
by
Lemma \ref{lemma-base-change-comparison}
applied twice. Hence we win by
Lemma \ref{lemma-pull-pseudo-coherent}.
\end{proof}

\begin{lemma}
\label{lemma-pull-relative-pseudo-coherent}
Let $R \to A \to B$ be finite type ring maps.
Let $m \in \mathbf{Z}$.
Let $K^\bullet$ be a complex of $A$-modules.
Assume $B$ as a $B$-module is pseudo-coherent relative to $A$.
If $K^\bullet$ is $m$-pseudo-coherent (resp.\ pseudo-coherent)
relative to $R$, then $K^\bullet \otimes_A^{\mathbf{L}} B$ is
$m$-pseudo-coherent (resp.\ pseudo-coherent) relative to $R$.
\end{lemma}

\begin{proof}
Choose a surjection $A[y_1, \ldots, y_m] \to B$.
Choose a surjection $R[x_1, \ldots, x_n] \to A$.
Combined we get a surjection $R[x_1, \ldots, x_n, y_1, \ldots y_m] \to B$.
Choose a resolution $E^\bullet \to B$ of $B$ by a complex of
finite free $A[y_1, \ldots, y_n]$-modules (which is possible
by our assumption on the ring map $A \to B$). We may assume
that $K^\bullet$ is a bounded above complex of flat $A$-modules. Then
\begin{align*}
K^\bullet \otimes_A^{\mathbf{L}} B & =
\text{Tot}(K^\bullet \otimes_A B[0]) \\
& = \text{Tot}(K^\bullet \otimes_A A[y_1, \ldots, y_m]
\otimes_{A[y_1, \ldots, y_m]} B[0]) \\
& \cong
\text{Tot}\left(
(K^\bullet \otimes_A A[y_1, \ldots, y_m])
\otimes_{A[y_1, \ldots, y_m]} E^\bullet
\right) \\
& =
\text{Tot}(K^\bullet \otimes_A E^\bullet)
\end{align*}
in $D(A[y_1, \ldots, y_m])$. The quasi-isomorphism $\cong$ comes from
an application of
Lemma \ref{lemma-derived-tor-quasi-isomorphism}.
Thus we have to show that
$\text{Tot}(K^\bullet \otimes_A E^\bullet)$ is $m$-pseudo-coherent
as a complex of $R[x_1, \ldots, x_n, y_1, \ldots y_m]$-modules.
Note that $\text{Tot}(K^\bullet \otimes_A E^\bullet)$ has a filtration by
subcomplexes with successive quotients the complexes
$K^\bullet \otimes_A E^i[-i]$. Note that for $i \ll 0$ the
complexes $K^\bullet \otimes_A E^i[-i]$ have zero cohomology
in degrees $\leq m$ and hence are $m$-pseudo-coherent (over any ring).
Hence, applying
Lemma \ref{lemma-cone-relatively-pseudo-coherent}
and induction, it suffices to show that $K^\bullet \otimes_A E^i[-i]$ is
pseudo-coherent relative to $R$ for all $i$. Note that $E^i = 0$ for
$i > 0$. Since also $E^i$ is finite free this
reduces to proving that $K^\bullet \otimes_A A[y_1, \ldots, y_m]$ is
$m$-pseudo-coherent relative to $R$ which follows from
Lemma \ref{lemma-base-change-relative-pseudo-coherent}
for instance.
\end{proof}

\begin{lemma}
\label{lemma-pull-relative-pseudo-coherent-module}
Let $R \to A \to B$ be finite type ring maps.
Let $m \in \mathbf{Z}$. Let $M$ be an $A$-module.
Assume $B$ is flat over $A$ and $B$ as a $B$-module is
pseudo-coherent relative to $A$.
If $M$ is $m$-pseudo-coherent (resp.\ pseudo-coherent)
relative to $R$, then $M \otimes_A B$ is
$m$-pseudo-coherent (resp.\ pseudo-coherent) relative to $R$.
\end{lemma}

\begin{proof}
Immediate from
Lemma \ref{lemma-pull-relative-pseudo-coherent}.
\end{proof}

\begin{lemma}
\label{lemma-composition-relative-pseudo-coherent}
Let $R$ be a ring. Let $A \to B$ be a map of finite type $R$-algebras.
Let $m \in \mathbf{Z}$. Let $K^\bullet$ be a complex of $B$-modules.
Assume $A$ is pseudo-coherent relative to $R$. Then the following are
equivalent
\begin{enumerate}
\item $K^\bullet$ is $m$-pseudo-coherent (resp.\ pseudo-coherent)
relative to $A$, and
\item $K^\bullet$ is $m$-pseudo-coherent (resp.\ pseudo-coherent)
relative to $R$.
\end{enumerate}
\end{lemma}

\begin{proof}
Choose a surjection $R[x_1, \ldots, x_n] \to A$.
Choose a surjection $A[y_1, \ldots, y_m] \to B$.
Then we get a surjection
$$
R[x_1, \ldots, x_n, y_1, \ldots, y_m] \to A[y_1, \ldots, y_m]
$$
which is a flat base change of $R[x_1, \ldots, x_n] \to A$.
By assumption $A$ is a pseudo-coherent module over $R[x_1, \ldots, x_n]$
hence by
Lemma \ref{lemma-flat-base-change-pseudo-coherent}
we see that $A[y_1, \ldots, y_m]$ is pseudo-coherent over
$R[x_1, \ldots, x_n, y_1, \ldots, y_m]$. Thus the lemma follows from
Lemma \ref{lemma-finite-push-pseudo-coherent}
and the definitions.
\end{proof}

\begin{lemma}
\label{lemma-glue-relative-pseudo-coherent}
Let $R \to A$ be a finite type ring map.
Let $K^\bullet$ be a complex of $A$-modules.
Let $m \in \mathbf{Z}$.
Let $f_1, \ldots, f_r \in A$ generate the unit ideal.
The following are equivalent
\begin{enumerate}
\item each $K^\bullet \otimes_A A_{f_i}$ is
$m$-pseudo-coherent relative to $R$, and
\item $K^\bullet$ is $m$-pseudo-coherent relative to $R$.
\end{enumerate}
The same equivalence holds for pseudo-coherence relative to $R$.
\end{lemma}

\begin{proof}
The implication (2) $\Rightarrow$ (1) is in
Lemma \ref{lemma-localize-relative-pseudo-coherent}.
Assume (1). Write $1 = \sum f_ig_i$ in $A$.
Choose a surjection
$R[x_1, \ldots, x_n, y_1, \ldots, y_r, z_1, \ldots, z_r] \to A$.
such that $y_i$ maps to $f_i$ and $z_i$ maps to $g_i$. Then we
see that there exists a surjection
$$
P = R[x_1, \ldots, x_n, y_1, \ldots, y_r, z_1, \ldots, z_r]/(\sum y_iz_i - 1)
\longrightarrow
A.
$$
Note that $P$ is pseudo-coherent as an
$R[x_1, \ldots, x_n, y_1, \ldots, y_r, z_1, \ldots, z_r]$-module
and that $P[1/y_i]$ is pseudo-coherent as an
$R[x_1, \ldots, x_n, y_1, \ldots, y_r, z_1, \ldots, z_r, 1/y_i]$-module.
Hence by
Lemma \ref{lemma-finite-push-pseudo-coherent}
we see that
$K^\bullet \otimes_A A_{f_i}$ is an $m$-pseudo-coherent complex
of $P[1/y_i]$-modules for each $i$.
Thus by
Lemma \ref{lemma-glue-pseudo-coherent}
we see that $K^\bullet$ is pseudo-coherent as a complex of
$P$-modules, and
Lemma \ref{lemma-finite-push-pseudo-coherent}
shows that  $K^\bullet$ is pseudo-coherent as a complex of
$R[x_1, \ldots, x_n, y_1, \ldots, y_r, z_1, \ldots, z_r]$-modules.
\end{proof}

\begin{lemma}
\label{lemma-Noetherian-relative-pseudo-coherent}
Let $R$ be a Noetherian ring. Let $R \to A$ be a finite type ring map. Then
\begin{enumerate}
\item A complex of $A$-modules $K^\bullet$ is $m$-pseudo-coherent
relative to $R$ if and only if $K^\bullet \in D^{-}(A)$ and
$H^i(K^\bullet)$ is a finite $A$-module for $i \geq m$.
\item A complex of $A$-modules $K^\bullet$ is pseudo-coherent relative to $R$
if and only if $K^\bullet \in D^{-}(A)$ and
$H^i(K^\bullet)$ is a finite $A$-module for all $i$.
\item An $A$-module is pseudo-coherent relative to $R$
if and only if it is finite.
\end{enumerate}
\end{lemma}

\begin{proof}
Immediate consequence of
Lemma \ref{lemma-Noetherian-pseudo-coherent}
and the definitions.
\end{proof}










\section{Pseudo-coherent and perfect ring maps}
\label{section-pseudo-coherent-perfect-ring-map}

\noindent
We can define these types of ring maps as follows.

\begin{definition}
\label{definition-pseudo-coherent-perfect}
Let $A \to B$ be a ring map.
\begin{enumerate}
\item We say $A \to B$ is a {\it pseudo-coherent ring map} if it is of finite
type and $B$, as a $B$-module, is pseudo-coherent relative to $A$.
\item We say $A \to B$ is a {\it perfect ring map} if it is a
pseudo-coherent ring map such that $B$ as an $A$-module has finite
tor dimension.
\end{enumerate}
\end{definition}

\noindent
This terminology may be nonstandard. Using
Lemma \ref{lemma-rel-n-pseudo-module}
we see that $A \to B$ is pseudo-coherent if and only if
$B = A[x_1, \ldots, x_n]/I$ and $B$ as an $A[x_1, \ldots, x_n]$-module
has a resolution by finite free $A[x_1, \ldots, x_n]$-modules.
The motivation for the definition of a perfect ring map is
Lemma \ref{lemma-perfect}.
The following lemmas gives a more useful and intuitive
characterization of a perfect ring map.

\begin{lemma}
\label{lemma-perfect-ring-map}
A ring map $A \to B$ is perfect if and only if $B = A[x_1, \ldots, x_n]/I$
and $B$ as an $A[x_1, \ldots, x_n]$-module has a finite resolution by
finite projective $A[x_1, \ldots, x_n]$-modules.
\end{lemma}

\begin{proof}
If $A \to B$ is perfect, then $B = A[x_1, \ldots, x_n]/I$ and
$B$ is pseudo-coherent as an $A[x_1, \ldots, x_n]$-module and
has finite tor dimension as an $A$-module. Hence
Lemma \ref{lemma-perfect-over-polynomial-ring}
implies that $B$ is perfect as a $A[x_1, \ldots, x_n]$-module, i.e.,
it has a finite resolution by finite projective $A[x_1, \ldots, x_n]$-modules
(Lemma \ref{lemma-perfect-module}).
Conversely, if $B = A[x_1, \ldots, x_n]/I$
and $B$ as an $A[x_1, \ldots, x_n]$-module has a finite resolution by
finite projective $A[x_1, \ldots, x_n]$-modules then
$B$ is pseudo-coherent as an $A[x_1, \ldots, x_n]$-module,
hence $A \to B$ is pseudo-coherent. Moreover, the given resolution
over $A[x_1, \ldots, x_n]$ is a finite resolution by flat
$A$-modules and hence $B$ has finite tor dimension as an $A$-module.
\end{proof}

\noindent
Lots of the results of the preceding sections can be reformulated
in terms of this terminology. We  also refer to
More on Morphisms, Sections \ref{more-morphisms-section-pseudo-coherent}
and \ref{more-morphisms-section-perfect}
for the corresponding discussion concerning morphisms of schemes.

\begin{lemma}
\label{lemma-Noetherian-pseudo-coherent-ring-map}
A finite type ring map of Noetherian rings is pseudo-coherent.
\end{lemma}

\begin{proof}
See
Lemma \ref{lemma-Noetherian-relative-pseudo-coherent}.
\end{proof}

\begin{lemma}
\label{lemma-flat-finite-presentation-perfect}
A ring map which is flat and of finite presentation is perfect.
\end{lemma}

\begin{proof}
Let $A \to B$ be a ring map which is flat and of finite presentation.
It is clear that $B$ has finite tor dimension. By
Algebra, Lemma \ref{algebra-lemma-flat-finite-presentation-limit-flat}
there exists a finite type $\mathbf{Z}$-algebra $A_0 \subset A$
and a flat finite type ring map $A_0 \to B_0$ such that
$B = B_0 \otimes_{A_0} A$. By
Lemma \ref{lemma-Noetherian-relative-pseudo-coherent}
we see that $A_0 \to B_0$ is pseudo-coherent.
As $A_0 \to B_0$ is flat we see that $B_0$ and $A$ are tor independent
over $A_0$, hence we may use
Lemma \ref{lemma-base-change-relative-pseudo-coherent}
to conclude that $A \to B$ is pseudo-coherent.
\end{proof}

\begin{lemma}
\label{lemma-regular-perfect-ring-map}
Let $A \to B$ be a finite type ring map with $A$ a regular ring
of finite dimension. Then $A \to B$ is perfect.
\end{lemma}

\begin{proof}
By
Algebra, Lemma \ref{algebra-lemma-finite-gl-dim-finite-dim-regular}
the assumption on $A$ means that $A$ has finite global dimension.
Hence every module has finite tor dimension, see
Lemma \ref{lemma-finite-gl-dim-tor-dimension},
in particular $B$ does. By
Lemma \ref{lemma-Noetherian-pseudo-coherent-ring-map}
the map is pseudo-coherent.
\end{proof}

\begin{lemma}
\label{lemma-lci-perfect}
A local complete intersection homomorphism is perfect.
\end{lemma}

\begin{proof}
Let $A \to B$ be a local complete intersection homomorphism.
By Definition \ref{definition-local-complete-intersection} this
means that $B = A[x_1, \ldots, x_n]/I$ where $I$ is a Koszul ideal
in $A[x_1, \ldots, x_n]$. 
By Lemmas \ref{lemma-perfect-ring-map} and \ref{lemma-perfect-module}
it suffices to show that $I$ is a perfect module over $A[x_1, \ldots, x_n]$.
By Lemma \ref{lemma-glue-perfect} this is a local question. Hence we
may assume that $I$ is generated by a Koszul-regular sequence (by
Definition \ref{definition-regular-ideal}).
Of course this means that $I$ has a finite free resolution and we win.
\end{proof}

\begin{lemma}
\label{lemma-relative-pseudo-coherent-is-moot}
Let $R \to A$ be a pseudo-coherent ring map. Let $K \in D(A)$.
The following are equivalent
\begin{enumerate}
\item $K$ is $m$-pseudo-coherent (resp.\ pseudo-coherent) relative to $R$, and
\item $K$ is $m$-pseudo-coherent (resp.\ pseudo-coherent) in $D(A)$.
\end{enumerate}
\end{lemma}

\begin{proof}
Reformulation of a special case of
Lemma \ref{lemma-composition-relative-pseudo-coherent}.
\end{proof}

\begin{lemma}
\label{lemma-more-relative-pseudo-coherent-is-moot}
Let $R \to B \to A$ be ring maps with $\varphi : B \to A$ surjective and
$R \to B$ and $R \to A$ flat and of finite presentation. For $K \in D(A)$
denote $\varphi_*K \in D(B)$ the restriction.
The following are equivalent
\begin{enumerate}
\item $K$ is pseudo-coherent,
\item $K$ is pseudo-coherent relative to $R$,
\item $K$ is pseudo-coherent relative to $A$,
\item $\varphi_*K$ is pseudo-coherent,
\item $\varphi_*K$ is pseudo-coherent relative to $R$.
\end{enumerate}
Similar holds for $m$-pseudo-coherence.
\end{lemma}

\begin{proof}
Observe that $R \to A$ and $R \to B$ are perfect ring maps
(Lemma \ref{lemma-flat-finite-presentation-perfect})
hence a fortiori pseudo-coherent ring maps.
Thus (1) $\Leftrightarrow$ (2) and (4) $\Leftrightarrow$ (5)
by Lemma \ref{lemma-relative-pseudo-coherent-is-moot}.

\medskip\noindent
Using that $A$ is pseudo-coherent relative to $R$ we use
Lemma \ref{lemma-composition-relative-pseudo-coherent}
to see that (2) $\Leftrightarrow$ (3).
However, since $A \to B$ is surjective, we see directly from
Definition \ref{definition-relatively-pseudo-coherent}
that (3) is equivalent with (4).
\end{proof}



\section{Relatively perfect modules}
\label{section-relatively-perfect}

\noindent
This section is the analogue of
Section \ref{section-relative-pseudo-coherent}
for perfect objects of the derived category.
we only define this notion in a limited
generality as we are not sure what the correct
definition is in general. See
Derived Categories of Schemes, Remark
\ref{perfect-remark-discuss-rel-perfect}
for a discussion.

\begin{definition}
\label{definition-relatively-perfect}
Let $R \to A$ be a flat ring map of finite presentation.
An object $K$ of $D(A)$ is {\it $R$-perfect} or {\it perfect relative to $R$}
if $K$ is pseudo-coherent
(Definition \ref{definition-pseudo-coherent})
and has finite tor dimension over $R$
(Definition \ref{definition-tor-amplitude}).
\end{definition}

\noindent
By Lemma \ref{lemma-more-relative-pseudo-coherent-is-moot}
it would have been the same thing to ask $K$ to be
pseudo-coherent relative to $R$.
Here are some obligatory lemmas.

\begin{lemma}
\label{lemma-cone-relatively-perfect}
Let $R \to A$ be a flat ring map of finite presentation.
The $R$-perfect objects of $D(A)$ form a
saturated\footnote{Derived Categories, Definition
\ref{derived-definition-saturated}.} triangulated
strictly full subcategory.
\end{lemma}

\begin{proof}
This follows from
Lemmas \ref{lemma-cone-pseudo-coherent},
\ref{lemma-summands-pseudo-coherent},
\ref{lemma-cone-tor-amplitude}, and
\ref{lemma-summands-tor-amplitude}.
\end{proof}

\begin{lemma}
\label{lemma-perfect-relatively-perfect}
Let $R \to A$ be a flat ring map of finite presentation.
A perfect object of $D(A)$ is $R$-perfect. If $K, M \in D(A)$
then $K \otimes_A^\mathbf{L} M$ is $R$-perfect if $K$ is perfect
and $M$ is $R$-perfect.
\end{lemma}

\begin{proof}
The first statement follows from the second by taking $M = A$.
The second statement follows from Lemmas \ref{lemma-perfect},
\ref{lemma-push-tor-amplitude}, and \ref{lemma-tensor-pseudo-coherent}.
\end{proof}

\begin{lemma}
\label{lemma-structure-relatively-perfect}
Let $R \to A$ be a flat ring map of finite presentation.
Let $K \in D(A)$. The following are equivalent
\begin{enumerate}
\item $K$ is $R$-perfect, and
\item $K$ is isomorphic to a finite complex of $R$-flat,
finitely presented $A$-modules.
\end{enumerate}
\end{lemma}

\begin{proof}
To prove (2) implies (1) it suffices by
Lemma \ref{lemma-cone-relatively-perfect}
to show that an $R$-flat, finitely presented $A$-module $M$ defines
an $R$-perfect object of $D(A)$. Since $M$ has finite tor dimension
over $R$, it suffices to show that $M$ is pseudo-coherent. By
Algebra, Lemma \ref{algebra-lemma-flat-finite-presentation-limit-flat}
there exists a finite type $\mathbf{Z}$-algebra $R_0 \subset R$
and a flat finite type ring map $R_0 \to A_0$ and
a finite $A_0$-module $M_0$ flat over $R_0$ such that
$A = A_0 \otimes_{R_0} R$ and $M = M_0 \otimes_{R_0} R$. By
Lemma \ref{lemma-Noetherian-pseudo-coherent}
we see that $M_0$ is pseudo-coherent $A_0$-module.
Choose a resolution $P_0^\bullet \to M_0$ by finite free
$A_0$-modules $P_0^n$. Since $A_0$ is flat over $R_0$,
this is a flat resolution. Since $M_0$ is flat over $R_0$
we find that $P^\bullet = P_0^\bullet \otimes_{R_0} R$
still resolves $M = M_0 \otimes_{R_0} R$. (You can use
Lemma \ref{lemma-base-change-comparison} to see this.)
Hence $P^\bullet$ is a finite free resolution of $M$
over $A$ and we conclude that $M$ is pseudo-coherent.

\medskip\noindent
Assume (1). We can represent $K$ by a bounded above complex
$P^\bullet$ of finite free $A$-modules. Assume that
$K$ viewed as an object of $D(R)$ has tor amplitude in $[a, b]$.
By Lemma \ref{lemma-last-one-flat} we see that
$\tau_{\geq a}P^\bullet$ is a complex of $R$-flat, finitely
presented $A$-modules representing $K$.
\end{proof}

\begin{lemma}
\label{lemma-base-change-relatively-perfect}
Let $R \to A$ be a flat ring map of finite presentation.
Let $R \to R'$ be a ring map and set $A' = A \otimes_R R'$.
If $K \in D(A)$ is $R$-perfect, then $K \otimes_A^\mathbf{L} A'$ is
$R'$-perfect.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-pull-pseudo-coherent} we see that
$K \otimes_A^\mathbf{L} A'$ is pseudo-coherent.
By Lemma \ref{lemma-base-change-comparison} we see that
$K \otimes_A^\mathbf{L} A'$ is equal to $K \otimes_R^\mathbf{L} R'$ in $D(R')$.
Then we can apply Lemma \ref{lemma-pull-tor-amplitude}
to see that $K \otimes_R^\mathbf{L} R'$ in $D(R')$ has finite
tor dimension.
\end{proof}

\begin{lemma}
\label{lemma-compute-RHom-relatively-perfect}
Let $R \to A$ be a flat ring map. Let $K, L \in D(A)$ with $K$
pseudo-coherent and $L$ finite tor dimension over $R$. We may choose
\begin{enumerate}
\item a bounded above complex $P^\bullet$
of finite free $A$-modules representing $K$, and
\item a bounded complex of $R$-flat $A$-modules
$F^\bullet$ representing $L$.
\end{enumerate}
Given these choices we have
\begin{enumerate}
\item[(a)] $E^\bullet = \Hom^\bullet(P^\bullet, F^\bullet)$
is a bounded below complex
of $R$-flat $A$-modules representing $R\Hom_A(K, L)$,
\item[(b)] for any ring map $R \to R'$ with $A' = A \otimes_R R'$
the complex $E^\bullet \otimes_R R'$ represents
$R\Hom_{A'}(K \otimes_A^\mathbf{L} A', L \otimes_A^\mathbf{L} A')$.
\end{enumerate}
If in addition $R \to A$ is of finite presentation and $L$ is
$R$-perfect, then we may choose $F^p$ to be finitely presented
$A$-modules and consequently $E^n$ will be finitely presented $A$-modules
as well.
\end{lemma}

\begin{proof}
The existence of $P^\bullet$ is the definition of a pseudo-coherent complex.
We first represent $L$
by a bounded above complex $F^\bullet$ of free $A$-modules
(this is possible because bounded tor dimension in particular
implies bounded). Next, say $L$ viewed as an object of $D(R)$
has tor amplitude in $[a, b]$. Then, after replacing
$F^\bullet$ by $\tau_{\geq a}F^\bullet$, we get a complex
as in (2). This follows from Lemma \ref{lemma-last-one-flat}.

\medskip\noindent
Proof of (a).
Since $F^\bullet$ is bounded an since $P^\bullet$ is bounded above,
we see that $E^n = 0$ for $n \ll 0$ and that
$E^n$ is a finite (!) direct sum
$$
E^n = \bigoplus\nolimits_{p + q = n} \Hom_A(P^{-q}, F^p)
$$
and since $P^{-q}$ is finite free, this is indeed an $R$-flat $A$-module.
The fact that $E^\bullet$ represents $R\Hom_A(K, L)$
follows from Lemma \ref{lemma-RHom-out-of-projective}.

\medskip\noindent
Proof of (b).
Let $R \to R'$ be a ring map and $A' = A \otimes_R R'$.
By Lemma \ref{lemma-base-change-comparison} the object
$L \otimes_A^\mathbf{L} A'$ is represented by
$F^\bullet \otimes_R R'$ viewed as a complex of $A'$-modules
(by flatness of $F^p$ over $R$). Similarly for $P^\bullet \otimes_R R'$.
As above $R\Hom_{A'}(K \otimes_A^\mathbf{L} A', L \otimes_A^\mathbf{L} A')$
is represented by
$$
\Hom^\bullet(P^\bullet \otimes_R R', F^\bullet \otimes_R R') =
E^\bullet \otimes_R R'
$$
The equality holds by looking at the terms of the complex individually
and using that $\Hom_{A'}(P^{-q} \otimes_R R', F^p \otimes_R R') =
\Hom_A(P^{-q}, F^p) \otimes_R R'$.
\end{proof}

\begin{lemma}
\label{lemma-colimit-relatively-perfect}
Let $R = \colim_{i \in I} R_i$ be a filtered colimit of rings.
Let $0 \in I$ and $R_0 \to A_0$ be a flat ring map of
finite presentation. For $i \geq 0$ set $A_i = R_i \otimes_{R_0} A_0$
and set $A = R \otimes_{R_0} A_0$.
\begin{enumerate}
\item Given an $R$-perfect $K$ in $D(A)$ there exists an $i \in I$
and an $R_i$-perfect $K_i$ in $D(A_i)$ such that
$K \cong K_i \otimes_{A_i}^\mathbf{L} A$ in $D(A)$.
\item Given $K_0, L_0 \in D(A_0)$ with $K_0$ pseudo-coherent
and $L_0$ finite tor dimension over $R_0$, then
we have
$$
\Hom_{D(A)}(K_0 \otimes_{A_0}^\mathbf{L} A, L_0 \otimes_{A_0}^\mathbf{L} A) =
\colim_{i \geq 0}
\Hom_{D(A_i)}(K_0 \otimes_{A_0}^\mathbf{L} A_i,
L_0 \otimes_{A_0}^\mathbf{L} A_i)
$$
\end{enumerate}
In particular, the triangulated category of $R$-perfect complexes over $A$
is the colimit of the triangulated categories of
$R_i$-perfect complexes over $A_i$.
\end{lemma}

\begin{proof}
By Algebra, Lemma \ref{algebra-lemma-colimit-category-fp-modules}
the category of finitely presented $A$-modules is the colimit of
the categories of finitely presented $A_i$-modules.
Given this, Algebra, Lemma
\ref{algebra-lemma-flat-finite-presentation-limit-flat}
tells us that category of $R$-flat, finitely presented $A$-modules
is the colimit of the categories of
$R_i$-flat, finitely presented $A_i$-modules.
Thus the characterization in
Lemma \ref{lemma-structure-relatively-perfect}
proves that (1) is true.

\medskip\noindent
To prove (2) we choose $P_0^\bullet$ representing $K_0$ and
$F_0^\bullet$ representing $L_0$ as in
Lemma \ref{lemma-compute-RHom-relatively-perfect}.
Then $E_0^\bullet = \Hom^\bullet(P_0^\bullet, F_0^\bullet)$
satisfies
$$
H^0(E_0^\bullet \otimes_{R_0} R_i) =
\Hom_{D(A_i)}(K_0 \otimes_{A_0}^\mathbf{L} A_i,
L_0 \otimes_{A_0}^\mathbf{L} A_i)
$$
and
$$
H^0(E_0^\bullet \otimes_{R_0} R) =
\Hom_{D(A)}(K_0 \otimes_{A_0}^\mathbf{L} A, L_0 \otimes_{A_0}^\mathbf{L} A)
$$
by the lemma. Thus the result because tensor product commutes
with colimits and filtered colimits are exact
(Algebra, Lemma \ref{algebra-lemma-directed-colimit-exact}).
\end{proof}

\begin{lemma}
\label{lemma-thickening-relatively-perfect}
Let $R' \to A'$ be a flat ring map of finite presentation.
Let $R' \to R$ be a surjective ring map whose kernel is a nilpotent ideal.
Set $A = A' \otimes_{R'} R$. Let $K' \in D(A')$ and set
$K = K' \otimes_{A'}^\mathbf{L} A$ in $D(A)$.
If $K$ is $R$-perfect, then $K'$ is $R'$-perfect.
\end{lemma}

\begin{proof}
We can represent $K$ by a bounded above complex of finite free
$A$-modules $E^\bullet$, see Lemma \ref{lemma-pseudo-coherent}.
By Lemma \ref{lemma-lift-complex-projectives}
we conclude that $K'$ is pseudo-coherent because it can be represented
by a bounded above complex $P^\bullet$ of finite free $A'$-modules
with $P^\bullet \otimes_{A'} A = E^\bullet$. Observe that
this also means $P^\bullet \otimes_{R'} R = E^\bullet$
(since $A = A' \otimes_{R'} R$).

\medskip\noindent
Let $I = \Ker(R' \to R)$. Then $I^n = 0$ for some $n$.
Choose $[a, b]$ such that $K$ has tor amplitude in $[a, b]$
as a complex of $R$-modules. We will show $K'$ has
tor amplitude in $[a, b]$. To do this, let $M'$
be an $R'$-module. If $IM' = 0$, then
$$
K' \otimes_{R'}^\mathbf{L} M' =
P^\bullet \otimes_{R'} M' =
E^\bullet \otimes_R M' = K \otimes_R^\mathbf{L} M'
$$
(because $A'$ is flat over $R'$ and $A$ is flat over $R$)
which has nonzero cohomology only for degrees in $[a, b]$
by choice of $a, b$.
If $I^{t + 1}M' = 0$, then we consider the short exact sequence
$$
0 \to IM' \to M' \to M'/IM' \to 0
$$
with $M = M'/IM'$. By induction on $t$ we have that both
$K' \otimes_{R'}^\mathbf{L} IM'$ and
$K' \otimes_{R'}^\mathbf{L} M'/IM'$ have nonzero cohomology
only for degrees in $[a, b]$. Then the distinguished
triangle
$$
K' \otimes_{R'}^\mathbf{L} IM' \to
K' \otimes_{R'}^\mathbf{L} M' \to
K' \otimes_{R'}^\mathbf{L} M'/IM' \to
(K' \otimes_{R'}^\mathbf{L} IM')[1]
$$
proves the same is true for
$K' \otimes_{R'}^\mathbf{L} M'$.
This proves the desired bound for all $M'$ and hence the
desired bound on the tor amplitude of $K'$.
\end{proof}

\begin{lemma}
\label{lemma-lift-from-fibre-relatively-perfect}
Let $R$ be a ring. Let $A = R[x_1, \ldots, x_d]/I$
be flat and of finite presentation over $R$.
Let $\mathfrak q \subset A$ be a prime ideal lying over
$\mathfrak p \subset R$. Let $K \in D(A)$ be pseudo-coherent.
Let $a, b \in \mathbf{Z}$. If
$H^i(K_\mathfrak q \otimes_{R_\mathfrak p}^\mathbf{L} \kappa(\mathfrak p))$
is nonzero only for $i \in [a, b]$, then
$K_\mathfrak q$ has tor amplitude in $[a - d, b]$ over $R$.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-more-relative-pseudo-coherent-is-moot}
$K$ is pseudo-coherent as a complex of $R[x_1, \ldots, x_d]$-modules.
Therefore we may assume $A = R[x_1, \ldots, x_d]$.
Applying Lemma \ref{lemma-perfect-over-regular-local-ring}
to $R_\mathfrak p \to A_\mathfrak q$ and the complex $K_\mathfrak q$
using our assumption, we find that $K_\mathfrak q$ is perfect
in $D(A_\mathfrak q)$ with tor amplitude in $[a - d, b]$.
Since $R_\mathfrak p \to A_\mathfrak q$ is flat, we conclude
by Lemma \ref{lemma-flat-push-tor-amplitude}.
\end{proof}

\begin{lemma}
\label{lemma-bounded-on-fibres-relatively-perfect}
Let $R \to A$ be a ring map which is flat and of finite presentation.
Let $K \in D(A)$ be pseudo-coherent. The following are equivalent
\begin{enumerate}
\item $K$ is $R$-perfect, and
\item $K$ is bounded below and for every prime ideal $\mathfrak p \subset R$
the object $K \otimes_R^\mathbf{L} \kappa(\mathfrak p)$ is bounded below.
\end{enumerate}
\end{lemma}

\begin{proof}
Observe that (1) implies (2) as an $R$-perfect complex has bounded
tor dimension as a complex of $R$-modules by definition. Let us prove
the other implication.

\medskip\noindent
Write $A = R[x_1, \ldots, x_d]/I$. Denote $L$ in $D(R[x_1, \ldots, x_d])$
the restriction of $K$. By
Lemma \ref{lemma-more-relative-pseudo-coherent-is-moot}
we see that $L$ is pseudo-coherent.
Since $L$ and $K$ have the same image in $D(R)$ we see that
$L$ is $R$-perfect if and only if $K$ is $R$-perfect.
Also $L \otimes_R^\mathbf{L} \kappa(\mathfrak p)$
and $K \otimes_R^\mathbf{L} \kappa(\mathfrak p)$ are the same objects of
$D(\kappa(\mathfrak p))$. This reduces us to the case
$A = R[x_1, \ldots, x_d]$.

\medskip\noindent
Say $A = R[x_1, \ldots, x_d]$ and $K$ satisfies (2).
Let $\mathfrak q \subset A$ be a prime lying over a
prime $\mathfrak p \subset R$. By
Lemma \ref{lemma-perfect-over-regular-local-ring} applied
to $R_\mathfrak p \to A_\mathfrak q$ and the complex $K_\mathfrak q$
using our assumption, we find that $K_\mathfrak q$ is perfect
in $D(A_\mathfrak q)$. Since $K$ is bounded below, we see that
$K$ is perfect in $D(A)$ by 
Lemma \ref{lemma-check-perfect-stalks}.
This implies that $K$ is $R$-perfect by
Lemma \ref{lemma-perfect-relatively-perfect}
and the proof is complete.
\end{proof}











\section{Two term complexes}
\label{section-two-term}

\noindent
In this section we prove some results on two term complexes of modules
which will help us understand conditions on the naive cotangent complex.

\begin{lemma}
\label{lemma-ext-1-zero}
Let $R$ be a ring. Let $K \in D(R)$ with $H^i(K) = 0$ for
$i \not \in \{-1, 0\}$. The following are equivalent
\begin{enumerate}
\item $H^{-1}(K) = 0$ and $H^0(K)$ is a projective module and
\item $\Ext^1_R(K, M) = 0$ for every $R$-module $M$.
\end{enumerate}
If $R$ is Noetherian and $H^i(K)$ is a finite $R$-module for
$i = -1, 0$, then these are also equivalent to
\begin{enumerate}
\item[(3)] $\Ext^1_R(K, M) = 0$ for every finite $R$-module $M$.
\end{enumerate}
\end{lemma}

\begin{proof}
The equivalence of (1) and (2) follows from
Lemma \ref{lemma-projective-amplitude}.
If $R$ is Noetherian and $H^i(K)$ is a finite $R$-module for
$i = -1, 0$, then $K$ is pseudo-coherent, see
Lemma \ref{lemma-Noetherian-pseudo-coherent}.
Thus the equivalence of (1) and (3) follows from
Lemma \ref{lemma-projective-amplitude-pseudo-coherent}.
\end{proof}

\begin{remark}
\label{remark-smoothness-ext-1-zero}
The following two statements follow from Lemma \ref{lemma-ext-1-zero},
Algebra, Definition \ref{algebra-definition-smooth}, and
Algebra, Proposition \ref{algebra-proposition-characterize-formally-smooth}.
\begin{enumerate}
\item A ring map $A \to B$ is smooth if and only if $A \to B$ is
of finite presentation and $\Ext^1_B(\NL_{B/A}, N) = 0$
for every $B$-module $N$.
\item A ring map $A \to B$ is formally smooth if and only if
$\Ext^1_B(\NL_{B/A}, N) = 0$ for every $B$-module $N$.
\end{enumerate}
\end{remark}

\begin{lemma}
\label{lemma-represent-two-term-complex}
Let $R$ be a ring. Let $K$ be an object of $D(R)$ with $H^i(K) = 0$
for $i \not \in \{-1, 0\}$. Then
\begin{enumerate}
\item $K$ can be represented by a two term complex
$K^{-1} \to K^0$ with $K^0$ a free module, and
\item if $R$ is Noetherian and $H^i(K)$ is a finite $R$-module for
$i = -1, 0$, then $K$ can be represented by a two term complex
$K^{-1} \to K^0$ with $K^0$ a finite free module and $K^{-1}$ finite.
\end{enumerate}
\end{lemma}

\begin{proof}
Proof of (1). Suppose $K$ is given by the complex of modules $M^\bullet$.
We may first replace $M^\bullet$ by $\tau_{\leq 0}M^\bullet$. Thus we
may assume $M^i = 0$ for $i > 0$, Next, we may choose a
free resolution $P^\bullet \to M^\bullet$ with $P^i = 0$ for $i > 0$, see
Derived Categories, Lemma \ref{derived-lemma-subcategory-left-resolution}.
Finally, we can set $K^\bullet = \tau_{\geq -1}P^\bullet$.

\medskip\noindent
Proof of (2). Assume $R$ is Noetherian and $H^i(K)$ is a finite $R$-module for
$i = -1, 0$. By Lemma \ref{lemma-pseudo-coherent} we can choose a
quasi-isomorphism $F^\bullet \to M^\bullet$ with $F^i = 0$ for $i > 0$
and $F^i$ finite free. Then we can set $K^\bullet = \tau_{\geq -1}F^\bullet$.
\end{proof}

\noindent
Maps in the derived category out of the naive cotangent complex
$\NL_{B/A}$ or $\NL(\alpha)$ (see
Algebra, Section \ref{algebra-section-netherlander})
are easy to understand by the result of the following lemma.

\begin{lemma}
\label{lemma-map-out-of-almost-free}
Let $R$ be a ring. Let $M^\bullet$ be a complex of modules over $R$
with $M^i = 0$ for $i > 0$ and $M^0$ a projective $R$-module.
Let $K^\bullet$ be a second complex.
\begin{enumerate}
\item Assume $K^i = 0$ for $i \leq -2$. Then
$\Hom_{D(R)}(M^\bullet, K^\bullet) = \Hom_{K(R)}(M^\bullet, K^\bullet)$.
\item Assume $K^i = 0$ for $i \not \in [-1, 0]$ and
$K^0$ a projective $R$-module. Then for a map of complexes
$a^\bullet : M^\bullet \to K^\bullet$, the following are equivalent
\begin{enumerate}
\item $a^\bullet$ induces the zero map $\Ext^1_R(K^\bullet, N) \to
\Ext^1_R(M^\bullet, N)$ for all $R$-modules $N$, and
\item there is a map $h^0 : M^0 \to K^{-1}$ such that
$a^{-1} + h^0 \circ d^{-1}_K = 0$.
\end{enumerate}
\item Assume $K^i = 0$ for $i \leq -3$. Let
$\alpha \in \Hom_{D(R)}(M^\bullet, K^\bullet)$. If the
composition of $\alpha$ with
$K^\bullet \to K^{-2}[2]$ comes from an $R$-module map
$a : M^{-2} \to K^{-2}$ with $a \circ d_M^{-3} = 0$, then
$\alpha$ can be represented by a map of complexes
$a^\bullet : M^\bullet \to K^\bullet$ with $a^{-2} = a$.
\item In (2) for any second map of complexes
$(a')^\bullet : M^\bullet \to K^\bullet$
representing $\alpha$ with $a = (a')^{-2}$
there exist $h^i : M^i \to K^{i - 1}$ for $i = 0, -1$ such that
$$
h^{-1} \circ d_M^{-2} = 0, \quad
(a')^{-1} = a^{-1} + d_K^{-2} \circ h^{-1} + h^0 \circ d_M^{-1},\quad
(a')^0 = a^0 + d_K^{-1} \circ h^0
$$
\end{enumerate}
\end{lemma}

\begin{proof}
Set $F^0 = M^0$.
Choose a free $R$-module $F^{-1}$ and a surjection $F^{-1} \to M^{-1}$.
Choose a free $R$-module $F^{-2}$ and a surjection
$F^{-2} \to M^{-2} \times_{M^{-1}} F^{-1}$. Continuing in this
way we obtain a quasi-isomorphism $p^\bullet : F^\bullet \to M^\bullet$
which is termwise surjective and with $F^i$ projective for all $i$.

\medskip\noindent
Proof of (1). By
Derived Categories, Lemma \ref{derived-lemma-morphisms-from-projective-complex}
we have
$$
\Hom_{D(R)}(M^\bullet, K^\bullet) = \Hom_{K(R)}(F^\bullet, K^\bullet)
$$
If $K^i = 0$ for $i \leq -2$, then any morphism of complexes
$F^\bullet \to K^\bullet$ factors through $p^\bullet$. Similarly, any
homotopy $\{h^i : F^i \to K^{i - 1}\}$ factors through $p^\bullet$.
Thus (1) holds.

\medskip\noindent
Proof of (2). If (2)(b) holds, then $a^\bullet$ is homotopic to a map
of complexes $(a')^\bullet : M^\bullet \to K^\bullet$
which is zero in degree $-1$.
On the other hand, let $N \to I^\bullet$ be an injective resolution.
We have
$$
\Ext^1_R(K^\bullet, N) = \Hom_{D(R)}(K^\bullet, I^\bullet[1]) =
\Hom_{K(R)}(K^\bullet, I^\bullet[1])
$$
by Derived Categories, Lemma
\ref{derived-lemma-morphisms-into-injective-complex}.
Let $b^\bullet : K^\bullet \to I^\bullet[1]$ be a map of complexes.
Since $K^1 = 0$ the map $b^0 : K^0 \to I^1$ maps into the kernel of
$I^1 \to I^2$ which is the image of $I^0 \to I^1$. Since $K^0$ is projective
we can lift $b^0$ to a map $h : K^0 \to I^0$. Thus we see that $b^\bullet$
is homotopic to a map of complexes $(b')^\bullet$ with $(b')^0 = 0$. Since
$K^i = 0$ for $i \not \in [-1, 0]$ it follows that
$(b')^\bullet \circ (a')^\bullet = 0$ as a map of complexes.
Hence the map $\Ext^1_R(K^\bullet, N) \to
\Ext^1_R(M^\bullet, N)$ is zero. In this way we see that (2)(b)
implies (2)(a). Conversely, assume (2)(a). We see that the
canonical element in $\Ext^1_R(K^\bullet, K^{-1})$ maps to
zero in $\Ext^1_R(M^\bullet, K^{-1})$. Using (1) we
see immediately that we get a map $h^0$ as in (2)(b).

\medskip\noindent
Proof of (3). Choose $b^\bullet : F^\bullet \to K^\bullet$ representing
$\alpha$. The composition of $\alpha$ with $K^\bullet \to K^{-2}[2]$ is
represented by $b^{-2} : F^{-2} \to K^{-2}$. As this is homotopic to
$a \circ p^{-2} : F^{-2} \to M^{-2} \to K^{-2}$, there is a map
$h : F^{-1} \to K^{-2}$ such that $b^{-2} = a \circ p^{-2} + h \circ d_F^{-2}$.
Adjusting $b^\bullet$ by $h$ viewed as a homotopy from $F^\bullet$
to $K^\bullet$, we find that $b^{-2} = a \circ p^{-2}$. Hence $b^{-2}$
factors through $p^{-2}$. Since $F^0 = M^0$ the kernel of $p^{-2}$
surjects onto the kernel of $p^{-1}$ (for example because the kernel
of $p^\bullet$ is an acyclic complex or by a diagram chase). Hence $b^{-1}$
necessarily factors through $p^{-1}$ as well and we see that (3)
holds for these factorizations and $a^0 = b^0$.

\medskip\noindent
Proof of (4) is omitted. Hint: There is a homotopy between
$a^\bullet \circ p^\bullet$ and $(a')^\bullet \circ p^\bullet$
and we argue as before that this homotopy factors through $p^\bullet$.
\end{proof}

\noindent
Let $A \to B$ be a finitely presented ring map.
Given an ideal $I \subset B$ we can consider the condition
\begin{enumerate}
\item[(*)]
$\Ext^1_B(\NL_{B/A}, N)$ is annihilated by $I$ for all $B$-modules $N$.
\end{enumerate}
This condition is one possible precise mathematical formulation of
the notion ``the singular locus of $A \to B$ is scheme theoretically
contained in $V(I)$''. Please compare with
Remark \ref{remark-smoothness-ext-1-zero} and the following lemmas.

\begin{lemma}
\label{lemma-ext-1-annihilated-definite}
Let $R$ be a ring and let $I \subset R$ be an ideal.
Let $K \in D(R)$. Assume $H^i(K) = 0$ for $i \not \in \{-1, 0\}$.
The following are equivalent
\begin{enumerate}
\item $\Ext^1_R(K, N)$ is annihilated by $I$ for all $R$-modules $N$,
\item $K$ can be represented by a complex $K^{-1} \to K^0$
with $K^0$ free such that for any $a \in I$ the map
$a : K^{-1} \to K^{-1}$ factors through $d_K^{-1} : K^{-1} \to K^0$,
\item whenever $K$ is represented by a two term complex
$K^{-1} \to K^0$ with $K^0$ projective, then for any $a \in I$ the map
$a : K^{-1} \to K^{-1}$ factors through $d_K^{-1} : K^{-1} \to K^0$.
\end{enumerate}
If $R$ is Noetherian and $H^i(K)$ is a finite $R$-module for $i = -1, 0$,
then these are also equivalent to
\begin{enumerate}
\item[(4)] $\Ext^1_R(K, N)$ is annihilated by $I$ for every finite
$R$-module $N$,
\item[(5)] $K$ can be represented by a complex $K^{-1} \to K^0$
with $K^0$ finite free and $K^{-1}$ finite such that for any $a \in I$ the map
$a : K^{-1} \to K^{-1}$ factors through $d_K^{-1} : K^{-1} \to K^0$.
\end{enumerate}
\end{lemma}

\begin{proof}

\medskip\noindent
Assume (1) and let $K^{-1} \to K^0$
be a two term complex representing $K$
with $K^0$ projective.
We will use the description of maps in $D(R)$ out of $K^\bullet$ given in
Lemma \ref{lemma-map-out-of-almost-free} without further mention.
Choosing $N = K^{-1}$ consider the element $\xi$ of $\Ext^1_R(K, N)$
given by $\text{id}_{K^{-1}} : K^{-1} \to K^{-1}$. Since is annihilated
by $a \in I$ we see that we get the dotted arrow fitting into the
following commutative diagram
$$
\xymatrix{
K^{-1} \ar[d]_a \ar[r]_{d_K^{-1}} & K^0 \ar@{..>}[ld]^h \\
K^{-1}
}
$$
This proves that (3) holds. Part (3) implies (2) in view of
Lemma \ref{lemma-represent-two-term-complex} part (1). Assume
$K^\bullet$ is as in (2) and $N$ is an arbitrary $R$-module.
Any element $\xi$ of $\Ext^1_R(K, N)$ is given as the class of
a map $\varphi : K^{-1} \to N$. Then for $a \in I$ by assumption
we may choose a map $h$ as in the diagram above and we see that
$a\varphi = \varphi \circ a = \varphi \circ h \circ \text{d}_K^{-1}$
which proves that $a \xi$ is zero in $\Ext^1_R(K, N)$.
Thus (1), (2), and (3) are equivalent.

\medskip\noindent
Assume $R$ is Noetherian and $H^i(K)$ is a finite $R$-module for $i = -1, 0$.
Part (3) implies (5) in view of
Lemma \ref{lemma-represent-two-term-complex} part (2).
It is clear that (5) implies (2). Trivially (1) implies (4).
Thus to finish the proof it suffices to show that (4) implies
any of the other conditions. Let $K^{-1} \to K^0$ be a complex
representing $K$ with $K^0$ finite free and $K^{-1}$ finite as in
Lemma \ref{lemma-represent-two-term-complex} part (2). The argument
given in the proof of (2) $\Rightarrow$ (1)
shows that if $\Ext^1_R(K, K^{-1})$ is annihilated by $I$,
then (1) holds. In this way we see that (4) implies (1) and the
proof is complete.
\end{proof}

\begin{lemma}
\label{lemma-two-term-base-change}
Let $R$ be a ring. Let $K$ be an object of $D(R)$ with $H^i(K) = 0$
for $i \not \in \{-1, 0\}$. Let $K^{-1} \to K^0$ be a two term complex
of $R$-modules representing $K$ such that $K^0$ is a flat $R$-module
(for example projective or free). Let $R \to R'$ be a ring map.
Then the complex $K^\bullet \otimes_R R'$ represents
$\tau_{\geq -1}(K \otimes_R^\mathbf{L} R')$.
\end{lemma}

\begin{proof}
We have a distinguished triangle
$$
K^0 \to K^\bullet \to K^{-1}[1] \to K^0[1]
$$
in $D(R)$. This determines a map of distinguished triangles
$$
\xymatrix{
K^0 \otimes_R^\mathbf{L} R' \ar[d] \ar[r] &
K^\bullet \otimes_R^\mathbf{L} R' \ar[r] \ar[d] &
K^{-1} \otimes_R^\mathbf{L} R'[1] \ar[r] \ar[d] &
K^0 \otimes_R^\mathbf{L} R'[1] \ar[d] \\
K^0 \otimes_R R' \ar[r] &
K^\bullet \otimes_R R' \ar[r] &
K^{-1} \otimes_R R'[1] \ar[r] &
K^0 \otimes_R R'[1]
}
$$
The left and right vertical arrows are isomorphisms as $K^0$ is flat.
Since $K^{-1} \otimes_R^\mathbf{L} R' \to K^{-1} \otimes_R R'$
is an isomorphism on cohomology in degree $0$ we conclude.
\end{proof}

\begin{lemma}
\label{lemma-base-change-property-ext-1-annihilated}
Let $I$ be an ideal of a ring $R$. Let $K$ be an object of $D(R)$ with
$H^i(K) = 0$ for $i \not \in \{-1, 0\}$. Let $R \to R'$ be a ring map.
If $K$ satisfies the equivalent conditions (1), (2), and (3)
of Lemma \ref{lemma-ext-1-annihilated-definite} with respect to $(R, I)$,
then $\tau_{\geq -1}(K \otimes_R^\mathbf{L} R')$
satisfies the equivalent conditions (1), (2), and (3)
of Lemma \ref{lemma-ext-1-annihilated-definite} with respect to $(R', IR')$
\end{lemma}

\begin{proof}
We may assume $K$ is represented by a two term complex $K^{-1} \to K^0$
with $K^0$ free such that for any $a \in I$ the map $a : K^{-1} \to K^{-1}$
is equal to $h_a \circ d_K^{-1}$ for some map $h_a : K^0 \to K^{-1}$.
By Lemma \ref{lemma-two-term-base-change} we see that
$\tau_{\geq -1}(K \otimes_R^\mathbf{L} R')$ is represented by
$K^\bullet \otimes_R R'$. Then of course for every $a \in I$
we see that $a \otimes 1 : K^{-1} \otimes_R R' \to K^{-1} \otimes_R R'$
is equal to $(h_a \otimes 1) \circ (d_K^{-1} \otimes 1)$.
Since the collection of maps $K^{-1} \otimes_R R' \to K^{-1} \otimes_R R'$
which factor through $\text{d}_K^{-1} \otimes 1$
forms an $R'$-module we conclude.
\end{proof}

\begin{lemma}
\label{lemma-two-term-surjection-map-zero}
Let $R$ be a ring. Let $\alpha : K \to K'$ be a morphism of $D(R)$. Assume
\begin{enumerate}
\item $H^i(K) = H^i(K') = 0$ for $i \not \in \{-1, 0\}$
\item $H^0(\alpha)$ is an isomorphism and $H^{-1}(\alpha)$ is surjective.
\end{enumerate}
For any $f \in R$ if $f : K \to K$ is $0$, then $f : K' \to K'$ is $0$.
\end{lemma}

\begin{proof}
Set $M = \Ker(H^{-1}(\alpha))$. Then $\alpha$ fits into a distinguished
triangle
$$
M[1] \to K \to K' \to M[2]
$$
Since $K \to K' \xrightarrow{f} K'$ is zero by our assumption, we see
that $f : K' \to K'$ factors over a map $M[2] \to K'$. However
$\Hom(M[2], K') = 0$ for example by
Derived Categories, Lemma \ref{derived-lemma-negative-exts}.
\end{proof}

\begin{lemma}
\label{lemma-surjection-property-ext-1-annihilated}
Let $I$ be an ideal of a ring $R$. Let $\alpha : K \to K'$
be a morphism of $D(R)$. Assume
\begin{enumerate}
\item $H^i(K) = H^i(K') = 0$ for $i \not \in \{-1, 0\}$
\item $H^0(\alpha)$ is an isomorphism and $H^{-1}(\alpha)$ is surjective.
\end{enumerate}
If $K$ satisfies the equivalent conditions (1), (2), and (3)
of Lemma \ref{lemma-ext-1-annihilated-definite},
then $K'$ does too.
\end{lemma}

\begin{proof}
Set $M = \Ker(H^{-1}(\alpha))$. Then $\alpha$ fits into a distinguished
trangle
$$
M[1] \to K \to K' \to M[2]
$$
For any $R$-module $N$ this determines an exact sequence
$$
\Ext^0_R(M[1], N) \to
\Ext^1_R(K', N) \to
\Ext^1_R(K, N)
$$
Since $\Ext^0_R(M[1], N) = \Ext^{-1}_R(M, N) = 0$ we see that
$\Ext^1_R(K', N)$ is a submodule of $\Ext^1_R(K, N)$. Hence if
$\Ext^1_R(K, N)$ is annihilated by $I$ so is $\Ext^1_R(K', N)$.
\end{proof}

\begin{lemma}
\label{lemma-ext-1-annihilated}
Let $R$ be ring and let $I \subset R$ be an ideal.
Let $K \in D(R)$ with $H^i(K) = 0$ for $i \not \in \{-1, 0\}$.
The following are equivalent
\begin{enumerate}
\item there exists a $c \geq 0$ such that the equivalent
conditions (1), (2), (3) of Lemma \ref{lemma-ext-1-annihilated-definite}
hold for $K$ and the ideal $I^c$,
\item there exists a $c \geq 0$ such that (a) $I^c$ annihilates
$H^{-1}(K)$ and (b) $H^0(K)$ is an $I^c$-projective module (see
Section \ref{section-near-projective}).
\end{enumerate}
If $R$ is Noetherian and $H^i(K)$ is a finite $R$-module
for $i = -1, 0$, then these are also equivalent to
\begin{enumerate}
\item[(3)] there exists a $c \geq 0$ such that the equivalent
conditions (4), (5) of Lemma \ref{lemma-ext-1-annihilated-definite}
hold for $K$ and the ideal $I^c$,
\item[(4)] $H^{-1}(K)$ is $I$-power torsion and there exist
$f_1, \ldots, f_s \in R$ with $V(f_1, \ldots, f_s) \subset V(I)$
such that the localizations $H^0(K)_{f_i}$ are projective
$R_{f_i}$-modules,
\item[(5)] $H^{-1}(K)$ is $I$-power torsion and there exist
$f_1, \ldots, f_s \in I$ with $V(f_1, \ldots, f_s) = V(I)$
such that the localizations $H^0(K)_{f_i}$ are projective
$R_{f_i}$-modules.
\end{enumerate}
\end{lemma}

\begin{proof}
The distinguished triangle $H^{-1}(K)[1] \to K \to H^0(K)[0] \to H^{-1}(K)[2]$
determines an exact sequence
$$
0 \to \Ext^1_R(H^0(K), N) \to \Ext^1_R(K, N) \to \Hom_R(H^{-1}(K), N) \to
\Ext^2_R(H^0(K), N)
$$
Thus (2) implies that $I^{2c}$ annihilates $\Ext^1_R(K, N)$ for every
$R$-module $N$. Assuming (1) we immediately see that $H^0(K)$ is
$I^c$-projective. On the other hand, we may choose an injective map
$H^{-1}(K) \to N$ for some injective $R$-module $N$. Then this map
is the image of an element of $\Ext^1_R(K, N)$ by the vanishing
of the $\Ext^2$ in the sequence and we conclude $H^{-1}(K)$
is annihilated by $I^c$.

\medskip\noindent
Assume $R$ is Noetherian and $H^i(K)$ is a finite $R$-module
for $i = -1, 0$. By Lemma \ref{lemma-ext-1-annihilated-definite}
we see that (3) is equivalent to (1) and (2). Also, if (3)
holds then for $f \in I$ the multiplication by $f$ on
$H^0(K)$ factors through a projective module, which implies
that $H^0(K)_f$ is a summand of a projective $R_f$-module and hence
itself a projective $R_f$-module. Choosing $f_1, \ldots, f_s$
to be generators of $I$ we find
the equivalent conditions (1), (2), and (3) imply (5).
Of course (5) trivially implies (4).

\medskip\noindent
Assume (4). Since $H^{-1}(K)$ is a finite $R$-module and $I$-power torsion
we see that $I^{c_1}$ annihilates $H^{-1}(K)$ for some $c_1 \geq 0$.
Choose a short exact sequence
$$
0 \to M \to R^{\oplus r} \to H^0(K) \to 0
$$
which determines an element $\xi \in \Ext^1_R(H^0(K), M)$.
For any $f \in I$ we have $\Ext^1_R(H^0(K), M)_f = \Ext^1_{R_f}(H^0(K)_f, M_f)$
by Lemma \ref{lemma-pseudo-coherence-and-base-change-ext}.
Hence if $H^0(K)_f$ is projective, then a power of $f$ annihilates $\xi$.
We conclude that $\xi$ is annihilated by $(f_1, \ldots, f_s)^{c_2}$
for some $c_2 \geq 0$. Since $V(f_1, \ldots, f_s) \subset V(I)$ we have
$\sqrt{I} \subset (f_1, \ldots, f_s)$
(Algebra, Lemma \ref{algebra-lemma-Zariski-topology}).
Since $R$ is Noetherian we find $I^{c_3} \subset (f_1, \ldots, f_s)$
for some $c_3 \geq 0$ (Algebra, Lemma \ref{algebra-lemma-Noetherian-power}).
Hence $I^{c2c3}$ annihilates $\xi$.
This in turn says that $H^0(K)$ is $I^{c_2c_3}$-projective (as multiplication
by $a \in I$ which annihilate $\xi$ factor through $R^{\oplus r}$).
Hence taking $c = \max(c_1, c_2c_3)$ we see that (2) holds.
\end{proof}

\begin{lemma}
\label{lemma-zero-in-derived}
Let $R$ be a ring. Let $K_j \in D(R)$, $j = 1, 2, 3$ with $H^i(K_j) = 0$
for $i \not \in \{-1, 0\}$. Let $\varphi : K_1 \to K_2$ and
$\psi : K_2 \to K_3$ be maps in $D(R)$.
If $H^0(\varphi) = 0$ and $H^{-1}(\psi) = 0$, then
$\varphi \circ \psi = 0$.
\end{lemma}

\begin{proof}
Apply Derived Categories, Lemma \ref{derived-lemma-trick-vanishing-composition}
to see that $\varphi \circ \psi$ factors through $\tau_{\leq -2}K_2 = 0$.
\end{proof}

\begin{lemma}
\label{lemma-silly}
Let $R$ be a ring. Let $K \in D(R)$ be given by a two term complex
of the form $R^{\oplus n} \to R^{\oplus n}$. Denote
$A \in \text{Mat}(n \times n, R)$ the matrix of the differential.
Then $\det(a) : K \to K$ is zero in $D(R)$.
\end{lemma}

\begin{proof}
Omitted. Good exercise.
\end{proof}






\section{The naive cotangent complex}
\label{section-netherlander}

\noindent
In this section we continue the discussion started in
Algebra, Section \ref{algebra-section-netherlander}.
We begin with a discussion of base change.
The first lemma shows that taking the naive tensor product
of the naive cotangent complex with a ring extension
isn't quite as naive as one might think.

\begin{lemma}
\label{lemma-tensor-NL}
Let $R \to S$ and $S \to S'$ be ring maps. The canonical map
$\NL_{S/R} \otimes_S^\mathbf{L} S' \to \NL_{S/R} \otimes_S S'$
induces an isomorphism
$\tau_{\geq -1}(\NL_{S/R} \otimes_S^\mathbf{L} S') \to \NL_{S/R} \otimes_S S'$
in $D(S')$. Similarly, given a presentation $\alpha$ of $S$ over $R$
the canonical map
$\NL(\alpha) \otimes_S^\mathbf{L} S' \to \NL(\alpha) \otimes_S S'$
induces an isomorphism $\tau_{\geq -1}(\NL(\alpha) \otimes_S^\mathbf{L} S') \to
\NL(\alpha) \otimes_S S'$ in $D(S')$.
\end{lemma}

\begin{proof}
Special case of Lemma \ref{lemma-two-term-base-change}.
\end{proof}

\begin{lemma}
\label{lemma-base-change-NL}
Let $R \to S$ and $R \to R'$ be ring maps.
Let $\alpha : P \to S$ be a presentation of $S$ over $R$.
Then $\alpha' : P \otimes_R R' \to S \otimes_R R'$ is a
presentation of $S' = S \otimes_R R'$ over $R'$.
The canonical map
$$
NL(\alpha) \otimes_S S' \to \NL(\alpha')
$$
is an isomorphism on $H^0$ and surjective on $H^{-1}$. In particular,
the canonical map
$$
\NL_{S/R} \otimes_S S' \to \NL_{S'/R'}
$$
is an isomorphism on $H^0$ and surjective on $H^{-1}$.
\end{lemma}

\begin{proof}
Denote $I = \Ker(P \to S)$. Denote $P' = P \otimes_R R'$ and
$I' = \Ker(P' \to S')$. Suppose $P$ is a polynomial algebra
on $x_j$ for $j \in J$. The map displayed in the lemma becomes
$$
\xymatrix{
\bigoplus_{j \in J} S' \text{d}x_j \ar[r] &
\bigoplus_{j \in J} S' \text{d}x_j \\
I/I^2 \otimes_S S' \ar[r] \ar[u] &
I'/(I')^2 \ar[u]
}
$$
where the left column is $\NL(\alpha) \otimes_S S'$ and the right
column is $\NL(\alpha')$. By right exactness of tensor product we
see that $I \otimes_R R' \to I'$ is surjective. Hence the bottom arrow
is a surjection. This proves the first statement of the lemma.
The statement for $\NL_{S/R} \otimes_S S' \to \NL_{S'/R'}$
follows as these complexes are homotopic to $\NL(\alpha) \otimes_S S'$ and
$\NL(\alpha')$.
\end{proof}

\begin{lemma}
\label{lemma-base-change-NL-flat}
Consider a cocartesian diagram of rings
$$
\xymatrix{
B \ar[r] & B' \\
A \ar[r] \ar[u] & A' \ar[u]
}
$$
If $B$ is flat over $A$, then the canonical map
$\NL_{B/A} \otimes_B B' \to \NL_{B'/A'}$ is a quasi-isomorphism.
If in addition $\NL_{B/A}$ has tor-amplitude in $[-1, 0]$
then $\NL_{B/A} \otimes_B^\mathbf{L} B' \to \NL_{B'/A'}$
is a quasi-isomorphism too.
\end{lemma}

\begin{proof}
Choose a presentation $\alpha : P \to B$ as in
Algebra, Section \ref{algebra-section-netherlander}.
Let $I = \Ker(\alpha)$. Set $P' = P \otimes_A A'$ and denote
$\alpha' : P' \to B'$ the corresponding presentation of $B'$ over $A'$.
As $B$ is flat over $A$ we see that $I' = \Ker(\alpha')$ is equal
to $I \otimes_A A'$. Hence
$$
I'/(I')^2 = \Coker(I^2 \otimes_A A' \to I \otimes_A A') =
I/I^2 \otimes_A A' = I/I^2 \otimes_B B'
$$
We have $\Omega_{P'/A'} = \Omega_{P/A} \otimes_A A'$
because both sides have the same basis. It follows that
$\Omega_{P'/A'} \otimes_{P'} B' = \Omega_{P/A} \otimes_P B \otimes_B B'$.
This proves that $\NL(\alpha) \otimes_B B' \to \NL(\alpha')$
is an isomorphism of complexes and hence the first statement holds.

\medskip\noindent
We have
$$
\NL(\alpha) = I/I^2 \longrightarrow \Omega_{P/A} \otimes_P B
$$
as a complex of $B$-modules with $I/I^2$ placed in degree $-1$.
Since the term in degree $0$ is free, this complex has tor-amplitude
in $[-1, 0]$ if and only if $I/I^2$ is a flat $B$-module, see
Lemma \ref{lemma-last-one-flat}.
If this holds, then $\NL(\alpha) \otimes_B^\mathbf{L} B' =
\NL(\alpha) \otimes_B B'$ and we get the second statement.
\end{proof}

\begin{lemma}
\label{lemma-lci-NL}
Let $A \to B$ be a local complete intersection as in
Definition \ref{definition-local-complete-intersection}.
Then $\NL_{B/A}$ is a perfect object of
$D(B)$ with tor amplitude in $[-1, 0]$.
\end{lemma}

\begin{proof}
Write $B = A[x_1, \ldots, x_n]/I$. Then $\NL_{B/A}$ is represented by
the complex
$$
I/I^2 \longrightarrow \bigoplus B \text{d}x_i
$$
of $B$-modules with $I/I^2$ placed in degree $-1$. Since the term in
degree $0$ is finite free, this complex has tor-amplitude in $[-1, 0]$ if and
only if $I/I^2$ is a flat $B$-module, see
Lemma \ref{lemma-last-one-flat}. By definition $I$ is a Koszul regular
ideal and hence a quasi-regular ideal, see Section \ref{section-ideals}.
Thus $I/I^2$ is a finite projective $B$-module
(Lemma \ref{lemma-quasi-regular-ideal-finite-projective})
and we conclude both that $\NL_{B/A}$ is perfect and that it has tor amplitude
in $[-1, 0]$.
\end{proof}

\begin{lemma}
\label{lemma-base-change-lci-bis}
Consider a cocartesian diagram of rings
$$
\xymatrix{
B \ar[r] & B' \\
A \ar[r] \ar[u] & A' \ar[u]
}
$$
If $A \to B$ and $A' \to B'$ are local complete intersections as in
Definition \ref{definition-local-complete-intersection}, then
the kernel of $H^{-1}(\NL_{B/A} \otimes_B B') \to H^{-1}(\NL_{B'/A'})$
is a finite projective $B'$-module.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-lci-NL} the complexes $\NL_{B/A}$ and $\NL_{B'/A'}$
are perfect of tor-amplitude in $[-1, 0]$.
Combining Lemmas \ref{lemma-tensor-NL}, \ref{lemma-pull-perfect}, and
\ref{lemma-pull-tor-amplitude} we have
$\NL_{B/A} \otimes_B B' = \NL_{B/A} \otimes_B^\mathbf{L} B'$
and this complex is also perfect of tor-amplitude in $[-1, 0]$.
Choose a distinguished triangle
$$
C \to \NL_{B/A} \otimes_B B'  \to \NL_{B'/A'} \to C[1]
$$
in $D(B')$. By Lemmas \ref{lemma-two-out-of-three-perfect} and
\ref{lemma-cone-tor-amplitude} we conclude that $C$ is perfect
with tor-amplitude in $[-1, 1]$. By Lemma \ref{lemma-base-change-NL}
the complex $C$ has only one nonzero cohomology module, namely the module
of the lemma sitting in degree $-1$. This module is of finite presentation
(Lemma \ref{lemma-n-pseudo-module}) and flat
(Lemma \ref{lemma-tor-dimension}). Hence it is finite projective by
Algebra, Lemma \ref{algebra-lemma-finite-projective}.
\end{proof}












\section{Rlim of abelian groups}
\label{section-Rlim}

\noindent
We briefly discuss $R\lim$ on abelian groups.
In this section we will denote $\textit{Ab}(\mathbf{N})$ the
abelian category of inverse systems of abelian groups.
The notation is compatible with the notation for sheaves of abelian
groups on a site, as an inverse system of abelian groups is
the same thing as a sheaf of groups on the category $\mathbf{N}$
(with a unique morphism $i \to j$ if $i \leq j$), see
Remark \ref{remark-Rlim-cohomology}. Many of the arguments in this
section duplicate the arguments used to construct the cohomological
machinery for sheaves of abelian groups on sites.

\begin{lemma}
\label{lemma-compute-Rlim}
The functor $\lim : \textit{Ab}(\mathbf{N}) \to \textit{Ab}$
has a right derived functor
\begin{equation}
\label{equation-Rlim}
R\lim : D(\textit{Ab}(\mathbf{N})) \longrightarrow D(\textit{Ab})
\end{equation}
As usual we set $R^p\lim(K) = H^p(R\lim(K))$. Moreover, we have
\begin{enumerate}
\item for any $(A_n)$ in $\textit{Ab}(\mathbf{N})$ we have
$R^p\lim A_n = 0$ for $p > 1$,
\item the object $R\lim A_n$ of $D(\textit{Ab})$ is represented
by the complex
$$
\prod A_n \to \prod A_n,\quad (x_n) \mapsto (x_n - f_{n + 1}(x_{n + 1}))
$$
sitting in degrees $0$ and $1$,
\item if $(A_n)$ is ML, then $R^1\lim A_n = 0$, i.e., $(A_n)$
is right acyclic for $\lim$,
\item every $K^\bullet \in D(\textit{Ab}(\mathbf{N}))$ is quasi-isomorphic
to a complex whose terms are right acyclic for $\lim$, and
\item if each $K^p = (K^p_n)$ is right acyclic for $\lim$, i.e.,
of $R^1\lim_n K^p_n = 0$, then $R\lim K$ is represented by the
complex whose term in degree $p$ is $\lim_n K_n^p$.
\end{enumerate}
\end{lemma}

\begin{proof}
Let $(A_n)$ be an arbitrary inverse system. Let $(B_n)$ be the inverse
system with
$$
B_n = A_n \oplus A_{n - 1} \oplus \ldots \oplus A_1
$$
and transition maps given by projections. Let $A_n \to B_n$ be given
by $(1, f_n, f_{n - 1} \circ f_n, \ldots, f_2 \circ \ldots \circ f_n$
where $f_i : A_i \to A_{i - 1}$ are the transition maps.
In this way we see that every inverse system is a subobject of a
ML system (Homology, Section \ref{homology-section-inverse-systems}).
It follows from
Derived Categories, Lemma \ref{derived-lemma-subcategory-right-acyclics}
using Homology, Lemma \ref{homology-lemma-Mittag-Leffler}
that every ML system is right acyclic for $\lim$, i.e., (3) holds.
This already implies that $RF$ is defined on $D^+(\textit{Ab}(\mathbf{N}))$,
see Derived Categories, Proposition \ref{derived-proposition-enough-acyclics}.
Set $C_n = A_{n - 1} \oplus \ldots \oplus A_1$ for $n > 1$ and
$C_1 = 0$ with transition maps given by projections as well.
Then there is a short exact sequence of inverse systems
$0 \to (A_n) \to (B_n) \to (C_n) \to 0$ where $B_n \to C_n$
is given by $(x_i) \mapsto (x_i - f_{i + 1}(x_{i + 1}))$.
Since $(C_n)$ is ML as well, we conclude that (2) holds
(by proposition reference above) which also implies (1).
Finally, this implies by Derived Categories, Lemma
\ref{derived-lemma-unbounded-right-derived}
that $R\lim$ is in fact defined on all of $D(\textit{Ab}(\mathbf{N}))$.
In fact, the proof of Derived Categories, Lemma
\ref{derived-lemma-unbounded-right-derived}
proceeds by proving assertions (4) and (5).
\end{proof}

\begin{lemma}
\label{lemma-six-term-Rlim}
Let
$$
0 \to (A_i) \to (B_i) \to (C_i) \to 0
$$
be a short exact sequence of inverse systems of abelian groups.
Then there is an associated $6$ term exact sequence
$0 \to \lim A_i \to \lim B_i \to \lim C_i \to
R^1\lim A_i \to R^1\lim B_i \to R^1\lim C_i \to 0$.
\end{lemma}

\begin{proof}
Follows from the vanishing in Lemma \ref{lemma-compute-Rlim}.
\end{proof}

\noindent
Here is the ``correct'' formulation of
Homology, Lemma \ref{homology-lemma-apply-Mittag-Leffler-again}.

\begin{lemma}
\label{lemma-apply-Mittag-Leffler-again}
Let
$$
(A^{-2}_n \to A^{-1}_n \to A^0_n \to A^1_n)
$$
be an inverse system of complexes of abelian groups and denote
$A^{-2} \to A^{-1} \to A^0 \to A^1$ its limit. Denote
$(H_n^{-1})$, $(H_n^0)$ the inverse systems of cohomologies, and
denote $H^{-1}$, $H^0$ the cohomologies of $A^{-2} \to A^{-1} \to A^0 \to A^1$.
If
\begin{enumerate}
\item $(A^{-2}_n)$ and $(A^{-1}_n)$ have vanishing $R^1\lim$,
\item $(H^{-1}_n)$ has vanishing $R^1\lim$,
\end{enumerate}
then $H^0 = \lim H_n^0$.
\end{lemma}

\begin{proof}
Let $K \in D(\textit{Ab}(\mathbf{N}))$ be the object represented
by the system of complexes whose $n$th constituent
is the complex $A^{-2}_n \to A^{-1}_n \to A^0_n \to A^1_n$.
We will compute $H^0(R\lim K)$ using both spectral
sequences\footnote{To use these spectral sequences we have to
show that $\textit{Ab}(\mathbf{N})$ has enough injectives.
A inverse system $(I_n)$ of abelian groups is injective if and only
if each $I_n$ is an injective abelian group and the transition maps are
split surjections. Every system embeds in one of these. Details omitted.} of
Derived Categories, Lemma \ref{derived-lemma-two-ss-complex-functor}.
The first has $E_1$-page
$$
\begin{matrix}
0 & 0 & R^1\lim A^0_n  & R^1\lim A^1_n \\
A^{-2} & A^{-1} & A^0  & A^1
\end{matrix}
$$
with horizontal differentials and all higher differentials are zero.
The second has $E_2$ page
$$
\begin{matrix}
R^1\lim H^{-2}_n & 0 & R^1\lim H^0_n & R^1 \lim H^1_n \\
\lim H^{-2}_n &
\lim H^{-1}_n &
\lim H^0_n &
\lim H^1_n
\end{matrix}
$$
and degenerates at this point. The result follows.
\end{proof}

\begin{lemma}
\label{lemma-map-into-Rlim}
Let $\mathcal{D}$ be a triangulated category. Let
$(K_n)$ be an inverse system of objects of $\mathcal{D}$.
Let $K$ be a derived limit of the system $(K_n)$.
Then for every $L$ in $\mathcal{D}$ we have a short exact sequence
$$
0 \to R^1\lim \Hom_\mathcal{D}(L, K_n[-1]) \to
\Hom_\mathcal{D}(L, K) \to
\lim \Hom_\mathcal{D}(L, K_n) \to 0
$$
\end{lemma}

\begin{proof}
This follows from
Derived Categories, Definition \ref{derived-definition-derived-limit} and
Lemma \ref{derived-lemma-representable-homological},
and the description of $\lim$ and $R^1\lim$ in
Lemma \ref{lemma-compute-Rlim} above.
\end{proof}

\begin{lemma}
\label{lemma-map-from-hocolim}
Let $\mathcal{D}$ be a triangulated category. Let
$(K_n)$ be a system of objects of $\mathcal{D}$.
Let $K$ be a derived colimit of the system $(K_n)$.
Then for every $L$ in $\mathcal{D}$ we have a short exact sequence
$$
0 \to R^1\lim \Hom_\mathcal{D}(K_n, L[-1]) \to
\Hom_\mathcal{D}(K, L) \to
\lim \Hom_\mathcal{D}(K_n, L) \to 0
$$
\end{lemma}

\begin{proof}
This follows from
Derived Categories, Definition \ref{derived-definition-derived-colimit} and
Lemma \ref{derived-lemma-representable-homological},
and the description of $\lim$ and $R^1\lim$ in
Lemma \ref{lemma-compute-Rlim} above.
\end{proof}

\begin{remark}[Rlim as cohomology]
\label{remark-Rlim-cohomology}
Consider the category $\mathbf{N}$ whose objects are natural numbers and
whose morphisms are unique arrows $i \to j$ if $j \geq i$. Endow $\mathbf{N}$
with the chaotic topology (Sites, Example \ref{sites-example-indiscrete}) so
that a sheaf $\mathcal{F}$ is the same thing as an inverse system
$$
\mathcal{F}_1 \leftarrow \mathcal{F}_2 \leftarrow \mathcal{F}_3
\leftarrow \ldots
$$
of sets over $\mathbf{N}$. Note that
$\Gamma(\mathbf{N}, \mathcal{F}) = \lim \mathcal{F}_n$. For an inverse
system of abelian groups $\mathcal{F}_n$ we have
$$
R^p\lim \mathcal{F}_n = H^p(\mathbf{N}, \mathcal{F})
$$
because both sides are the higher right derived functors of
$\mathcal{F} \mapsto \lim \mathcal{F}_n = H^0(\mathbf{N}, \mathcal{F})$.
Thus the existence of $R\lim$ also follows from the general material in
Cohomology on Sites, Sections
\ref{sites-cohomology-section-cohomology-sheaves} and
\ref{sites-cohomology-section-unbounded}.
\end{remark}

\noindent
The products in the following lemma can be seen as termwise products
of complexes or as products in the derived category $D(\textit{Ab})$, see
Derived Categories, Lemma \ref{derived-lemma-products}.

\begin{lemma}
\label{lemma-distinguished-triangle-Rlim}
Let $K = (K_n^\bullet)$ be an object of $D(\textit{Ab}(\mathbf{N}))$.
There exists a canonical distinguished triangle
$$
R\lim K \to \prod\nolimits_n K_n^\bullet \to \prod\nolimits_n K_n^\bullet
\to R\lim K[1]
$$
in $D(\textit{Ab})$. In other words, $R\lim K$ is a derived limit
of the inverse system $(K_n^\bullet)$ of $D(\textit{Ab})$, see
Derived Categories, Definition \ref{derived-definition-derived-limit}.
\end{lemma}

\begin{proof}
Suppose that for each $p$ the inverse system $(K_n^p)$ is right
acyclic for $\lim$. By Lemma \ref{lemma-compute-Rlim}
this gives a short exact sequence
$$
0 \to \lim_n K^p_n \to \prod\nolimits_n K^p_n \to \prod\nolimits_n K^p_n \to 0
$$
for each $p$. Since the complex consisting of $\lim_n K^p_n$
computes $R\lim K$ by Lemma \ref{lemma-compute-Rlim} we see that the
lemma holds in this case.

\medskip\noindent
Next, assume $K = (K_n^\bullet)$ is general. By Lemma \ref{lemma-compute-Rlim}
there is a quasi-isomorphism $K \to L$ in $D(\textit{Ab}(\mathbf{N}))$
such that $(L_n^p)$ is acyclic for each $p$. Then $\prod K_n^\bullet$
is quasi-isomorphic to $\prod L_n^\bullet$ as products are exact in
$\textit{Ab}$, whence the result for $L$ (proved above) implies the
result for $K$.
\end{proof}

\begin{lemma}
\label{lemma-break-long-exact-sequence}
With notation as in Lemma \ref{lemma-distinguished-triangle-Rlim}
the long exact cohomology sequence associated to the distinguished
triangle breaks up into short exact sequences
$$
0 \to R^1\lim_n H^{p - 1}(K_n^\bullet) \to
H^p(R\lim K) \to
\lim_n H^p(K_n^\bullet) \to 0
$$
\end{lemma}

\begin{proof}
The long exact sequence of the distinguished triangle is
$$
\ldots \to H^p(R\lim K) \to \prod\nolimits_n H^p(K_n^\bullet)
\to \prod\nolimits_n H^p(K_n^\bullet) \to
H^{p + 1}(R\lim K) \to \ldots
$$
The map in the middle has kernel $\lim_n H^p(K_n^\bullet)$ by its
explicit description given in the lemma.
The cokernel of this map is $R^1\lim_n H^p(K_n^\bullet)$
by Lemma \ref{lemma-compute-Rlim}.
\end{proof}

\noindent
{\bf Warning.} An object of $D(\textit{Ab}(\mathbf{N}))$ is a complex of
inverse systems of abelian groups. You can also think of this as an inverse
system $(K_n^\bullet)$ of complexes. However, this is {\bf not} the
same thing as an inverse system of objects of $D(\textit{Ab})$; the following
lemma and remark explain the difference.

\begin{lemma}
\label{lemma-lift-to-system-complexes-Ab}
Let $(K_n)$ be an inverse system of objects of $D(\textit{Ab})$.
Then there exists an object $M = (M_n^\bullet)$
of $D(\textit{Ab}(\mathbf{N}))$ and isomorphisms
$M_n^\bullet \to K_n$ in $D(\textit{Ab})$ such that the diagrams
$$
\xymatrix{
M_{n + 1}^\bullet \ar[d] \ar[r] &
M_n^\bullet \ar[d] \\
K_{n + 1} \ar[r] & K_n
}
$$
commute in $D(\textit{Ab})$.
\end{lemma}

\begin{proof}
Namely, let $M_1^\bullet$ be a complex of abelian groups representing $K_1$.
Suppose we have constructed
$M_e^\bullet \to M_{e - 1}^\bullet \to \ldots \to M_1^\bullet$
and maps $\psi_i : M_i^\bullet \to K_i$ such that
the diagrams in the statement of the lemma commute for all $n < e$.
Then we consider the diagram
$$
\xymatrix{
& M_n^\bullet \ar[d]^{\psi_n} \\
K_{n + 1} \ar[r] & K_n
}
$$
in $D(\textit{Ab})$. By the definition of morphisms in $D(\textit{Ab})$
we can find a complex $M_{n + 1}^\bullet$ of abelian groups, an isomorphism
$M_{n + 1}^\bullet \to K_{n + 1}$ in $D(\textit{Ab})$, and a
morphism of complexes $M_{n + 1}^\bullet \to M_n^\bullet$
representing the composition
$$
K_{n + 1} \to K_n \xrightarrow{\psi_n^{-1}} M_n^\bullet
$$
in $D(\textit{Ab})$.
Thus the lemma holds by induction.
\end{proof}

\begin{remark}
\label{remark-compare-derived-limit}
Let $(K_n)$ be an inverse system of objects of $D(\textit{Ab})$.
Let $K = R\lim K_n$ be a derived limit of this system (see
Derived Categories, Section \ref{derived-section-derived-limit}). Such
a derived limit exists because $D(\textit{Ab})$ has countable products
(Derived Categories, Lemma \ref{derived-lemma-products}).
By Lemma \ref{lemma-lift-to-system-complexes-Ab} we can also lift
$(K_n)$ to an object $M$ of $D(\mathbf{N})$.
Then $K \cong R\lim M$ where $R\lim$ is the functor (\ref{equation-Rlim})
because $R\lim M$ is also a derived limit of the system $(K_n)$
by Lemma \ref{lemma-distinguished-triangle-Rlim}.
Thus, although there may be many isomorphism classes of lifts $M$
of the system $(K_n)$, the isomorphism type of
$R\lim M$ is independent of the choice because it is isomorphic
to the derived limit $K = R\lim K_n$ of the system. Thus we may
apply results on $R\lim$ proved in this section to derived limits.
For example, for every $p \in \mathbf{Z}$ there is a
canonical short exact sequence
$$
0 \to R^1\lim H^{p - 1}(K_n) \to H^p(K) \to \lim H^p(K_n) \to 0
$$
because we may apply Lemma \ref{lemma-distinguished-triangle-Rlim} to $M$.
This can also been seen directly, without invoking the existence of $M$,
by applying the argument of the proof of
Lemma \ref{lemma-distinguished-triangle-Rlim} to the (defining)
distinguished triangle $K \to \prod K_n \to \prod K_n \to K[1]$.
\end{remark}

\begin{lemma}
\label{lemma-Rlim-pro-equal}
Let $E \to D$ be a morphism of $D(\textit{Ab}(\mathbf{N}))$.
Let $(E_n)$, resp.\ $(D_n)$ be the system of objects of
$D(\textit{Ab})$ associated to $E$, resp.\ $D$.
If $(E_n) \to (D_n)$ is an isomorphism of pro-objects, then
$R\lim E \to R\lim D$ is an isomorphism in $D(\textit{Ab})$.
\end{lemma}

\begin{proof}
The assumption in particular implies that the pro-objects
$H^p(E_n)$ and $H^p(D_n)$ are isomorphic. By the short exact sequences of
Lemma \ref{lemma-break-long-exact-sequence}
it suffices to show that given a map $(A_n) \to (B_n)$ of inverse
systems of abelian groupsc which induces an isomorphism
of pro-objects, then $\lim A_n \cong \lim B_n$ and
$R^1\lim A_n \cong R^1\lim B_n$.

\medskip\noindent
The assumption implies there are $1 \leq m_1 < m_2 < m_3 < \ldots$
and maps $\varphi_n : B_{m_n} \to A_n$ such that
$(\varphi_n) : (B_{m_n}) \to (A_n)$ is a map of systems
which is inverse to the given map $\psi = (\psi_n) : (A_n) \to (B_n)$
as a morphism of pro-objects. What this means is that
(after possibly replacing $m_n$ by larger integers) we may
assume that the compositions $A_{m_n} \to B_{m_n} \to A_n$ and
$B_{m_n} \to A_n \to B_n$ are equal to the transition maps
of the inverse systems. Now, if $(b_n) \in \lim B_n$ we can set
$a_n = \varphi_{m_n}(b_{m_n})$. This defines an inverse
$\lim B_n \to \lim A_n$ (computation omitted). Let us use the
cokernel of the map
$$
\prod B_n \longrightarrow \prod B_n
$$
as an avatar of $R^1\lim B_n$ (Lemma \ref{lemma-compute-Rlim}).
Any element in this cokernel can be represented by an element
$(b_i)$ with $b_i = 0$ if $i \not = m_n$ for some $n$ (computation omitted).
We can define a map $R^1\lim B_n \to R^1\lim A_n$ by mapping the class
of such a special element $(b_n)$ to the class of $(\varphi_n(b_{m_n}))$.
We omit the verification this map is inverse to the map
$R^1\lim A_n \to R^1\lim B_n$.
\end{proof}

\begin{lemma}[Emmanouil]
\label{lemma-emmanouil}
\begin{reference}
Taken from \cite{Emmanouil}.
\end{reference}
Let $(A_n)$ be an inverse system of abelian groups.
The following are equivalent
\begin{enumerate}
\item $(A_n)$ is Mittag-Leffler,
\item $R^1\lim A_n = 0$ and
the same holds for $\bigoplus_{i \in \mathbf{N}} (A_n)$.
\end{enumerate}
\end{lemma}

\begin{proof}
Set $B = \bigoplus_{i \in \mathbf{N}} (A_n)$ and hence
$B = (B_n)$ with $B_n = \bigoplus_{i \in \mathbf{N}} A_n$.
If $(A_n)$ is ML, then $B$ is ML and hence $R^1\lim A_n = 0$ and
$R^1\lim B_n = 0$ by Lemma \ref{lemma-compute-Rlim}.

\medskip\noindent
Conversely, assume $(A_n)$ is not ML. Then we can pick an $m$
and a sequence of integers $m < m_1 < m_2 < \ldots$ and elements
$x_i \in A_{m_i}$ whose image $y_i \in A_m$ is not in the
image of $A_{m_i + 1} \to A_m$.
We will use the elements $x_i$ and $y_i$ to
show that $R^1\lim B_n \not = 0$ in two ways.
This will finish the proof of the lemma.

\medskip\noindent
First proof.
Set $C = (C_n)$ with $C_n = \prod_{i \in \mathbf{N}} A_n$.
There is a canonical injective map $B_n \to C_n$ with cokernel
$Q_n$. Set $Q = (Q_n)$. We may and do think of elements $q_n$ of $Q_n$
as sequences of elements $q_n = (q_{n, 1}, q_{n, 2}, \ldots)$
with $q_{n, i} \in A_n$ modulo sequences whose tail is zero
(in other words, we identify sequences which differ in
finitely many places).
We have a short exact sequence of inverse systems
$$
0 \to (B_n) \to (C_n) \to (Q_n) \to 0
$$
Consider the element $q_n \in Q_n$ given by
$$
q_{n, i} =
\left\{
\begin{matrix}
\text{image of }x_i &\text{if}& m_i \geq n \\
0 & \text{else}
\end{matrix}
\right.
$$
Then it is clear that $q_{n + 1}$ maps to $q_n$.
Hence we obtain $q = (q_n) \in \lim Q_n$.
On the other hand, we claim that $q$ is not in the image
of $\lim C_n \to \lim Q_n$. Namely, say that $c = (c_n)$
maps to $q$. Then we can write $c_n = (c_{n, i})$ and since
$c_{n', i} \mapsto c_{n, i}$ for $n' \geq n$, we see that
$c_{n, i} \in \Im(C_{n'} \to C_n)$ for all $n, i, n' \geq n$.
In particular, the image of $c_{m, i}$ in $A_m$ is in
$\Im(A_{m_i + 1} \to A_m)$ whence cannot be equal to $y_i$.
Thus $c_m$ and $q_m = (y_1, y_2, y_3, \ldots)$
differ in infinitely many spots, which
is a contradiction. Considering the long exact cohomology sequence
$$
0 \to \lim B_n \to \lim C_n \to \lim Q_n \to R^1\lim B_n
$$
we conclude that the last group is nonzero as desired.

\medskip\noindent
Second proof. For $n' \geq n$ we denote $A_{n, n'} = \Im(A_{n'} \to A_n)$.
Then we have $y_i \in A_m$, $y_i \not \in A_{m, m_i + 1}$.
Let $\xi = (\xi_n) \in \prod B_n$ be the element with
$\xi_n = 0$ unless $n = m_i$ and $\xi_{m_i} = (0, \ldots, 0, x_i, 0, \ldots)$
with $x_i$ placed in the $i$th summand. We claim that $\xi$ is not in the
image of the map $\prod B_n \to \prod B_n$ of Lemma \ref{lemma-compute-Rlim}.
This shows that $R^1\lim B_n$ is nonzero and finishes the proof.
Namely, suppose that $\xi$ is the image of $\eta = (z_1, z_2, \ldots)$
with $z_n = \sum z_{n, i} \in \bigoplus_i A_n$.
Observe that $x_i = z_{m_i, i} \bmod A_{m_i, m_i + 1}$.
Then $z_{m_i - 1, i}$ is the image of $z_{m_i, i}$ under
$A_{m_i} \to A_{m_i - 1}$, and so on, and we conclude that
$z_{m, i}$ is the image of $z_{m_i, i}$ under $A_{m_i} \to A_m$.
We conclude that $z_{m, i}$ is congruent to $y_i$ modulo
$A_{m, m_i + 1}$. In particular $z_{m, i} \not = 0$.
This is impossible as $\sum z_{m, i} \in \bigoplus_i A_m$
hence only a finite number of $z_{m, i}$ can be nonzero.
\end{proof}

\begin{lemma}
\label{lemma-Mittag-Leffler}
Let
$$
0 \to (A_i) \to (B_i) \to (C_i) \to 0
$$
be a short exact sequence of inverse systems of abelian groups.
If $(A_i)$ and $(C_i)$ are ML, then so is $(B_i)$.
\end{lemma}

\begin{proof}
This follows from Lemma \ref{lemma-emmanouil}, the fact that
taking infinite direct sums is exact, and the long exact sequence
of cohomology associated to $R\lim$.
\end{proof}

\begin{lemma}
\label{lemma-Rlim-zero-of-direct-sums}
Let $(A_n)$ be an inverse system of abelian groups.
The following are equivalent
\begin{enumerate}
\item $(A_n)$ is zero as a pro-object,
\item $\lim A_n = 0$ and $R^1\lim A_n = 0$ and
the same holds for $\bigoplus_{i \in \mathbf{N}} (A_n)$.
\end{enumerate}
\end{lemma}

\begin{proof}
It follows from Lemma \ref{lemma-Rlim-pro-equal} that (1) implies (2).
Assume (2). Then $(A_n)$ is ML by Lemma \ref{lemma-emmanouil}.
For $m \geq n$ let $A_{n, m} = \Im(A_m \to A_n)$
so that $A_n = A_{n, n} \supset A_{n, n + 1} \supset \ldots$.
Note that $(A_n)$ is zero as a pro-object if and only if for every
$n$ there is an $m \geq n$ such that $A_{n, m} = 0$.
Note that $(A_n)$ is ML if and only if for every $n$ there is an $m_n \geq n$
such that $A_{n, m} = A_{n, m + 1} = \ldots$. In the ML case it is
clear that $\lim A_n = 0$ implies that $A_{n, m_n} = 0$
because the maps $A_{n + 1, m_{n + 1}} \to A_{n, m}$ are surjective.
This finishes the proof.
\end{proof}




\section{Rlim of modules}
\label{section-Rlim-modules}

\noindent
We briefly discuss $R\lim$ on modules. Many of the arguments in this
section duplicate the arguments used to construct the cohomological
machinery for modules on ringed sites.

\medskip\noindent
Let $(A_n)$ be an inverse system of rings. We will denote
$\textit{Mod}(\mathbf{N}, (A_n))$ the category of inverse systems
$(M_n)$ of abelian groups such that each $M_n$ is given the
structure of a $A_n$-module and the transition maps
$M_{n + 1} \to M_n$ are $A_{n + 1}$-module maps.
This is an abelian category. Set $A = \lim A_n$.
Given an object $(M_n)$ of $\textit{Mod}(\mathbf{N}, (A_n))$
the limit $\lim M_n$ is an $A$-module.

\begin{lemma}
\label{lemma-compute-Rlim-modules}
In the situation above. The functor
$\lim : \textit{Mod}(\mathbf{N}, (A_n)) \to \text{Mod}_A$
has a right derived functor
$$
R\lim :
D(\textit{Mod}(\mathbf{N}, (A_n)))
\longrightarrow
D(A)
$$
As usual we set $R^p\lim(K) = H^p(R\lim(K))$. Moreover, we have
\begin{enumerate}
\item for any $(M_n)$ in $\textit{Mod}(\mathbf{N}, (A_n))$ we have
$R^p\lim M_n = 0$ for $p > 1$,
\item the object $R\lim M_n$ of $D(\text{Mod}_A)$ is represented
by the complex
$$
\prod M_n \to \prod M_n,\quad
(x_n) \mapsto (x_n - f_{n + 1}(x_{n + 1}))
$$
sitting in degrees $0$ and $1$,
\item if $(M_n)$ is ML, then $R^1\lim M_n = 0$, i.e., $(M_n)$
is right acyclic for $\lim$,
\item every $K^\bullet \in D(\textit{Mod}(\mathbf{N}, (A_n)))$
is quasi-isomorphic to a complex whose terms are right acyclic for $\lim$, and
\item if each $K^p = (K^p_n)$ is right acyclic for $\lim$, i.e.,
of $R^1\lim_n K^p_n = 0$, then $R\lim K$ is represented by the
complex whose term in degree $p$ is $\lim_n K_n^p$.
\end{enumerate}
\end{lemma}

\begin{proof}
The proof of this is word for word the same as the proof of
Lemma \ref{lemma-compute-Rlim}.
\end{proof}

\begin{remark}
\label{remark-Rlim-cohomology-modules}
This remark is a continuation of Remark \ref{remark-Rlim-cohomology}.
A sheaf of rings on $\mathbf{N}$ is just an inverse system of rings
$(A_n)$. A sheaf of modules over $(A_n)$ is exactly the same thing
as an object of the category $\textit{Mod}(\mathbf{N}, (A_n))$
defined above. The derived functor $R\lim$ of
Lemma \ref{lemma-compute-Rlim-modules}
is simply $R\Gamma(\mathbf{N}, -)$ from the derived category of
modules to the derived category of modules over the global sections
of the structure sheaf. It
is true in general that cohomology of groups and modules agree, see
Cohomology on Sites, Lemma
\ref{sites-cohomology-lemma-cohomology-modules-abelian-agree}.
\end{remark}

\noindent
The products in the following lemma can be seen as termwise products
of complexes or as products in the derived category $D(A)$, see
Derived Categories, Lemma \ref{derived-lemma-products}.

\begin{lemma}
\label{lemma-distinguished-triangle-Rlim-modules}
Let $K = (K_n^\bullet)$ be an object of
$D(\textit{Mod}(\mathbf{N}, (A_n)))$.
There exists a canonical distinguished triangle
$$
R\lim K \to \prod\nolimits_n K_n^\bullet \to \prod\nolimits_n K_n^\bullet
\to R\lim K[1]
$$
in $D(A)$. In other words, $R\lim K$ is a derived limit
of the inverse system $(K_n^\bullet)$ of $D(A)$, see
Derived Categories, Definition \ref{derived-definition-derived-limit}.
\end{lemma}

\begin{proof}
The proof is exactly the same as the proof of
Lemma \ref{lemma-distinguished-triangle-Rlim}
using Lemma \ref{lemma-compute-Rlim-modules} in stead of
Lemma \ref{lemma-compute-Rlim}.
\end{proof}

\begin{lemma}
\label{lemma-break-long-exact-sequence-modules}
With notation as in Lemma \ref{lemma-distinguished-triangle-Rlim-modules}
the long exact cohomology sequence associated to the distinguished
triangle breaks up into short exact sequences
$$
0 \to R^1\lim_n H^{p - 1}(K_n^\bullet) \to
H^p(R\lim K) \to
\lim_n H^p(K_n^\bullet) \to 0
$$
of $A$-modules.
\end{lemma}

\begin{proof}
The proof is exactly the same as the proof of
Lemma \ref{lemma-break-long-exact-sequence}
using Lemma \ref{lemma-compute-Rlim-modules} in stead of
Lemma \ref{lemma-compute-Rlim}.
\end{proof}

\noindent
{\bf Warning.} As in the case of abelian groups an object
$M = (M_n^\bullet)$ of
$D(\textit{Mod}(\mathbf{N}, (A_n)))$ is an inverse system of complexes
of modules, which is {\bf not} the same thing as an inverse system of
objects in the derived categories. In the following lemma we show
how an inverse system of objects in derived categories always lifts
to an object of $D(\textit{Mod}(\mathbf{N}, (A_n)))$.

\begin{lemma}
\label{lemma-lift-to-system-complexes}
Let $(A_n)$ be an inverse system of rings. Suppose that we are given
\begin{enumerate}
\item for every $n$ an object $K_n$ of $D(A_n)$, and
\item for every $n$ a map $\varphi_n : K_{n + 1} \to K_n$ of
$D(A_{n + 1})$ where we think of $K_n$ as an object of $D(A_{n + 1})$
by restriction via $A_{n + 1} \to A_n$.
\end{enumerate}
There exists an object
$M = (M_n^\bullet) \in D(\textit{Mod}(\mathbf{N}, (A_n)))$
and isomorphisms $\psi_n : M_n^\bullet \to K_n$ in $D(A_n)$
such that the diagrams
$$
\xymatrix{
M_{n + 1}^\bullet \ar[d]_{\psi_{n + 1}} \ar[r] & M_n^\bullet \ar[d]^{\psi_n} \\
K_{n + 1} \ar[r]^{\varphi_n} & K_n
}
$$
commute in $D(A_{n + 1})$.
\end{lemma}

\begin{proof}
We write out the proof in detail. For an $A_n$-module $T$ we write
$T_{A_{n + 1}}$ for the same module viewd as an $A_{n + 1}$-module.
Suppose that $K_n^\bullet$ is a complex of $A_n$-modules representing $K_n$.
Then $K_{n, A_{n + 1}}^\bullet$ is the same complex, but viewed as a
complex of $A_{n + 1}$-modules. By the construction of the derived
category, the map $\psi_n$ can be given as
$$
\psi_n = \tau_n \circ \sigma_n^{-1}
$$
where $\sigma_n : L_{n + 1}^\bullet \to K_{n + 1}^\bullet$
is a quasi-isomorphism of complexes of $A_{n + 1}$-modules
and $\tau_n : L_{n + 1}^\bullet \to K_{n, A_{n + 1}}^\bullet$
is a map of complexes of $A_{n + 1}$-modules.

\medskip\noindent
Now we construct the complexes $M_n^\bullet$ by induction. As base case
we let $M_1^\bullet = K_1^\bullet$. Suppose we have already constructed
$M_e^\bullet \to M_{e - 1}^\bullet \to \ldots \to M_1^\bullet$
and maps of complexes $\psi_i : M_i^\bullet \to K_i^\bullet$ such that
the diagrams
$$
\xymatrix{
M_{n + 1}^\bullet \ar[d]_{\psi_{n + 1}} \ar[rr] & &
M_{n, A_{n + 1}}^\bullet \ar[d]^{\psi_{n, A_{n + 1}}} \\
K_{n + 1}^\bullet & L_{n + 1}^\bullet \ar[l]_{\sigma_n} \ar[r]^{\tau_n} &
K_{n, A_{n + 1}}^\bullet
}
$$
above commute in $D(A_{n + 1})$ for all $n < e$. Then we consider the diagram
$$
\xymatrix{
& & M_{e, A_{e + 1}}^\bullet \ar[d]^{\psi_{e, A_{e + 1}}} \\
K_{e + 1}^\bullet & L_{e + 1}^\bullet \ar[r]^{\tau_e} \ar[l]_{\sigma_e} &
K_{e, A_{e + 1}}^\bullet
}
$$
in $D(A_{e + 1})$. Because $\psi_e$ is a quasi-isomorphism,
we see that $\psi_{e, A_{e + 1}}$ is a quasi-isomorphism too.
By the definition of morphisms in $D(A_{e + 1})$ we can
find a quasi-isomorphism
$\psi_{e + 1} : M_{e + 1}^\bullet \to K_{e + 1}^\bullet$
of complexes of $A_{e + 1}$-modules such that there exists a morphism
of complexes $M_{e + 1}^\bullet \to M_{e, A_{e + 1}}^\bullet$
of $A_{e + 1}$-modules representing the composition 
$\psi_{e, A_{e + 1}}^{-1} \circ \tau_e \circ \sigma_e^{-1}$
in $D(A_{e + 1})$. Thus the lemma holds by induction.
\end{proof}

\begin{remark}
\label{remark-how-unique}
With assumptions as in Lemma \ref{lemma-lift-to-system-complexes}.
A priori there are many isomorphism classes of objects $M$ of
$D(\textit{Mod}(\mathbf{N}, (A_n)))$ which give rise to the system
$(K_n, \varphi_n)$ of the lemma. For each such $M$ we can consider the
complex $R\lim M \in D(A)$ where $A = \lim A_n$. By
Lemma \ref{lemma-distinguished-triangle-Rlim-modules}
we see that $R\lim M$ is a derived limit of the inverse system
$(K_n)$ of $D(A)$. Hence we see that the isomorphism class of $R\lim M$ in
$D(A)$ is independent of the choices made in constructing $M$.
In particular, we may apply results on $R\lim$ proved in this section to
derived limits of inverse systems in $D(A)$.
For example, for every $p \in \mathbf{Z}$ there is a
canonical short exact sequence
$$
0 \to R^1\lim H^{p - 1}(K_n) \to H^p(R\lim K_n) \to \lim H^p(K_n) \to 0
$$
because we may apply Lemma \ref{lemma-distinguished-triangle-Rlim-modules}
to $M$. This can also been seen directly, without invoking the existence of $M$,
by applying the argument of the proof of
Lemma \ref{lemma-distinguished-triangle-Rlim-modules} to the (defining)
distinguished triangle
$R\lim K_n \to \prod K_n \to \prod K_n \to (R\lim K_n)[1]$
of the derived limit.
\end{remark}

\begin{lemma}
\label{lemma-get-ML-system}
Let $(A_n)$ be an inverse system of rings. Every
$K \in D(\textit{Mod}(\mathbf{N}, (A_n)))$
can be represented by a system of complexes $(M_n^\bullet)$
such that all the transition maps $M_{n + 1}^\bullet \to M_n^\bullet$
are surjective.
\end{lemma}

\begin{proof}
Let $K$ be represented by the system $(K_n^\bullet)$. Set
$M_1^\bullet = K_1^\bullet$. Suppose we have constructed surjective maps
of complexes $M_n^\bullet \to M_{n - 1}^\bullet \to \ldots \to M_1^\bullet$
and homotopy equivalences $\psi_e : K_e^\bullet \to M_e^\bullet$ such that
the diagrams
$$
\xymatrix{
K_{e + 1}^\bullet \ar[d] \ar[r] & K_e^\bullet \ar[d] \\
M_{e + 1}^\bullet \ar[r] & M_e^\bullet
}
$$
commute for all $e < n$. Then we consider the diagram
$$
\xymatrix{
K_{n + 1}^\bullet \ar[r] & K_n^\bullet \ar[d] \\
& M_n^\bullet
}
$$
By Derived Categories, Lemma \ref{derived-lemma-make-surjective}
we can factor the composition $K_{n + 1}^\bullet \to M_n^\bullet$ as
$K_{n + 1}^\bullet \to M_{n + 1}^\bullet \to M_n^\bullet$
such that the first arrow is a homotopy equivalence and the
second a termwise split surjection. The lemma follows
from this and induction.
\end{proof}

\begin{lemma}
\label{lemma-get-K-flat-system}
Let $(A_n)$ be an inverse system of rings. Every
$K \in D(\textit{Mod}(\mathbf{N}, (A_n)))$
can be represented by a system of complexes $(K_n^\bullet)$
such that each $K_n^\bullet$ is K-flat.
\end{lemma}

\begin{proof}
First use Lemma \ref{lemma-get-ML-system} to represent $K$ by a
system of complexes $(M_n^\bullet)$ such that all the transition maps
$M_{n + 1}^\bullet \to M_n^\bullet$ are surjective.
Next, let $K_1^\bullet \to M_1^\bullet$ be a quasi-isomorphism
with $K_1^\bullet$ a K-flat complex of $A_1$-modules
(Lemma \ref{lemma-K-flat-resolution}).
Suppose we have constructed
$K_n^\bullet \to K_{n - 1}^\bullet \to \ldots \to K_1^\bullet$
and maps of complexes $\psi_e : K_e^\bullet \to M_e^\bullet$ such that
$$
\xymatrix{
K_{e + 1}^\bullet \ar[d] \ar[r] & K_e^\bullet \ar[d] \\
M_{e + 1}^\bullet \ar[r] & M_e^\bullet
}
$$
commutes for all $e < n$. Then we consider the diagram
$$
\xymatrix{
C^\bullet \ar@{..>}[d] \ar@{..>}[r] & K_n^\bullet \ar[d]^{\psi_n} \\
M_{n + 1}^\bullet \ar[r]^{\varphi_n} & M_n^\bullet
}
$$
in $D(A_{n + 1})$. As $M_{n + 1}^\bullet \to M_n^\bullet$ is
termwise surjective, the complex $C^\bullet$ fitting into the left
upper corner with terms
$$
C^p = M_{n + 1}^p \times_{M_n^p} K_n^p
$$
is quasi-isomorphic to $M_{n + 1}^\bullet$ (details omitted).
Choose a quasi-isomorphism $K_{n + 1}^\bullet \to C^\bullet$
with $K_{n +1}^\bullet$ K-flat.
Thus the lemma holds by induction.
\end{proof}

\begin{lemma}
\label{lemma-derived-tensor-product-systems}
Let $(A_n)$ be an inverse system of rings. Given
$K, L \in D(\textit{Mod}(\mathbf{N}, (A_n)))$ there is a canonical derived
tensor product $K \otimes^\mathbf{L} L$ in $D(\mathbf{N}, (A_n))$
compatible with the maps to $D(A_n)$. The construction is symmetric
in $K$ and $L$ and an exact functor of triangulated categories in
each variable.
\end{lemma}

\begin{proof}
Choose a representative $(K_n^\bullet)$ for $K$ such that each $K_n^\bullet$
is a K-flat complex (Lemma \ref{lemma-get-K-flat-system}).
Then you can define $K \otimes^\mathbf{L} L$ as the object represented by
the system of complexes
$$
(\text{Tot}(K_n^\bullet \otimes_{A_n} L_n^\bullet))
$$
for any choice of representative $(L_n^\bullet)$ for $L$.
This is well defined in both variables by
Lemmas \ref{lemma-K-flat-quasi-isomorphism} and
\ref{lemma-derived-tor-quasi-isomorphism-other-side}.
Compatibility with the map to $D(A_n)$ is clear.
Exactness follows exactly as in
Lemma \ref{lemma-derived-tor-exact}.
\end{proof}

\begin{remark}
\label{remark-constructing-tensor-with-limits-functorially}
Let $A$ be a ring. Let $(E_n)$ be an inverse system of objects
of $D(A)$. We've seen above that a derived limit $R\lim E_n$
exists. Thus for every object $K$ of $D(A)$ also the derived
limit $R\lim( K \otimes_A^\mathbf{L} E_n )$ exists.
It turns out that we can construct these derived limits
functorially in $K$ and obtain an exact functor
$$
R\lim(- \otimes_A^\mathbf{L} E_n) : D(A) \longrightarrow D(A)
$$
of triangulated categories. Namely, we first lift $(E_n)$ to an object $E$
of $D(\mathbf{N}, A)$, see Lemma \ref{lemma-lift-to-system-complexes}.
(The functor will depend on the choice of this lift.)
Next, observe that there is a ``diagonal'' or ``constant'' functor
$$
\Delta : D(A) \longrightarrow D(\mathbf{N}, A)
$$
mapping the complex $K^\bullet$ to the constant inverse system of
complexes with value $K^\bullet$. Then we simply define
$$
R\lim(K \otimes_A^\mathbf{L} E_n) = R\lim(\Delta(K)\otimes^\mathbf{L} E)
$$
where on the right hand side we use the functor $R\lim$ of
Lemma \ref{lemma-compute-Rlim-modules}
and the functor $- \otimes^\mathbf{L} -$ of
Lemma \ref{lemma-derived-tensor-product-systems}.
\end{remark}

\begin{lemma}
\label{lemma-tensor-Rlim-exact}
Let $A$ be a ring. Let $E \to D \to F \to E[1]$ be a distinguished
triangle of $D(\mathbf{N}, A)$. Let $(E_n)$, resp.\ $(D_n)$, resp.\ $(F_n)$
be the system of objects of $D(A)$ associated to $E$, resp.\ $D$, resp.\ $F$.
Then for every $K \in D(A)$ there is a canonical distinguished triangle
$$
R\lim (K \otimes^\mathbf{L}_A E_n) \to
R\lim (K \otimes^\mathbf{L}_A D_n) \to
R\lim (K \otimes^\mathbf{L}_A F_n) \to
R\lim (K \otimes^\mathbf{L}_A E_n)[1]
$$
in $D(A)$ with notation as in
Remark \ref{remark-constructing-tensor-with-limits-functorially}.
\end{lemma}

\begin{proof}
This is clear from the construction in
Remark \ref{remark-constructing-tensor-with-limits-functorially}
and the fact that $\Delta : D(A) \to D(\mathbf{N}, A)$,
$- \otimes^\mathbf{L} -$, and $R\lim$ are exact functors of triangulated
categories.
\end{proof}

\begin{lemma}
\label{lemma-tensor-Rlim-pro-equal}
Let $A$ be a ring. Let $E \to D$ be a morphism of
$D(\mathbf{N}, A)$. Let $(E_n)$, resp.\ $(D_n)$
be the system of objects of $D(A)$ associated to $E$, resp.\ $D$.
If $(E_n) \to (D_n)$ is an isomorphism of pro-objects, then for every
$K \in D(A)$ the corresponding map
$$
R\lim (K \otimes^\mathbf{L}_A E_n)
\longrightarrow
R\lim (K \otimes^\mathbf{L}_A D_n)
$$
in $D(A)$ is an isomorphism
(notation as in
Remark \ref{remark-constructing-tensor-with-limits-functorially}).
\end{lemma}

\begin{proof}
Follows from the definitions and Lemma \ref{lemma-Rlim-pro-equal}.
\end{proof}








\section{Torsion modules}
\label{section-torsion}

\noindent
In this section ``torsion modules'' will refer to modules supported
on a given closed subset $V(I)$ of an affine scheme $\Spec(R)$.
This is different, but analogous to, the notion of a torsion module
over a domain (Definition \ref{definition-torsion}).

\begin{definition}
\label{definition-f-power-torsion}
Let $R$ be a ring. Let $M$ be an $R$-module.
\begin{enumerate}
\item Let $I \subset R$ be an ideal. We say $M$ is an
{\it $I$-power torsion module} if for every $m \in M$ there exists an $n > 0$
such that $I^n m = 0$.
\item Let $f \in R$. We say $M$ is
{\it an $f$-power torsion module} if for each
$m \in M$, there exists an $n > 0$ such that $f^n m = 0$.
\end{enumerate}
\end{definition}

\noindent
Thus an $f$-power torsion module is the same thing as an $I$-power torsion
module for $I = (f)$. We will use the notation
$$
M[I^n] = \{m \in M \mid I^nm = 0\}
$$
and
$$
M[I^\infty] = \bigcup M[I^n]
$$
for an $R$-module $M$. Thus $M$ is $I$-power torsion if and only if
$M = M[I^\infty]$ if and only if $M = \bigcup M[I^n]$.

\begin{lemma}
\label{lemma-I-power-torsion-presentation}
Let $R$ be a ring.
Let $I$ be an ideal of $R$.
Let $M$ be an $I$-power torsion module.
Then $M$ admits a resolution
$$
\ldots \to K_2 \to K_1 \to K_0 \to M \to 0
$$
with each $K_i$ a direct sum of copies of $R/I^n$ for $n$ variable.
\end{lemma}

\begin{proof}
There is a canonical surjection
$$
\oplus_{m \in M} R/I^{n_m} \to M \to 0
$$
where $n_m$ is the smallest positive integer such that $I^{n_m} \cdot m = 0$.
The kernel of the preceding surjection is also an $I$-power torsion module.
Proceeding inductively, we construct the desired resolution of $M$.
\end{proof}

\begin{lemma}
\label{lemma-torsion-free}
Let $R$ be a ring. Let $I$ be an ideal of $R$.
For any $R$-module $M$ set $M[I^n] = \{m \in M \mid I^nm = 0\}$.
If $I$ is finitely generated then the following are equivalent
\begin{enumerate}
\item $M[I] = 0$,
\item $M[I^n] = 0$ for all $n \geq 1$, and
\item if $I = (f_1, \ldots, f_t)$, then the map
$M \to \bigoplus M_{f_i}$ is injective.
\end{enumerate}
\end{lemma}

\begin{proof}
This follows from
Algebra, Lemma \ref{algebra-lemma-when-injective-covering}.
\end{proof}

\begin{lemma}
\label{lemma-divide-by-torsion}
Let $R$ be a ring. Let $I$ be a finitely generated ideal of $R$.
\begin{enumerate}
\item For any $R$-module $M$ we have $(M/M[I^\infty])[I] = 0$.
\item An extension of $I$-power torsion modules is $I$-power torsion.
\end{enumerate}
\end{lemma}

\begin{proof}
Let $m \in M$. If $m$ maps to an element of $(M/M[I^\infty])[I]$
then $Im \subset M[I^\infty]$.
Write $I = (f_1, \ldots, f_t)$. Then we see that
$f_i m \in M[I^\infty]$, i.e., $I^{n_i}f_i m = 0$ for some $n_i > 0$.
Thus we see that $I^Nm = 0$ with $N = \sum n_i + 2$.
Hence $m$ maps to zero in $(M/M[I^\infty])$ which proves the
first statement of the lemma.

\medskip\noindent
For the second, suppose that $0 \to M' \to M \to M'' \to 0$ is a short
exact sequence of modules with $M'$ and $M''$ both $I$-power torsion
modules. Then $M[I^\infty] \supset M'$ and hence $M/M[I^\infty]$ is a
quotient of $M''$ and therefore $I$-power torsion. Combined with
the first statement and Lemma \ref{lemma-torsion-free} this implies
that it is zero.
\end{proof}

\begin{lemma}
\label{lemma-I-power-torsion}
Let $I$ be a finitely generated ideal of a ring $R$.
The $I$-power torsion modules form a Serre subcategory of
the abelian category $\text{Mod}_R$, see
Homology, Definition \ref{homology-definition-serre-subcategory}.
\end{lemma}

\begin{proof}
It is clear that a submodule and a quotient module of an $I$-power
torsion module is $I$-power torsion. Moreover, the extension
of two $I$-power torsion modules is $I$-power torsion by
Lemma \ref{lemma-divide-by-torsion}.
Hence the statement of the lemma by
Homology, Lemma \ref{homology-lemma-characterize-serre-subcategory}.
\end{proof}

\begin{lemma}
\label{lemma-local-cohomology-closed}
Let $R$ be a ring and let $I \subset R$ be a finitely generated ideal.
The subcategory $I^\infty\text{-torsion} \subset \text{Mod}_R$
depends only on the closed subset $Z = V(I) \subset \Spec(R)$.
In fact, an $R$-module $M$ is $I$-power torsion if and only if its
support is contained in $Z$.
\end{lemma}

\begin{proof}
Let $M$ be an $R$-module. Let $x \in M$. If $x \in M[I^\infty]$, then $x$
maps to zero in $M_f$ for all $f \in I$. Hence $x$ maps to zero in
$M_\mathfrak p$ for all $\mathfrak p \not \supset I$. Conversely, if $x$
maps to zero in $M_\mathfrak p$ for all $\mathfrak p \not \supset I$,
then $x$ maps to zero in $M_f$ for all $f \in I$. Hence if
$I = (f_1, \ldots, f_r)$, then $f_i^{n_i}x = 0$ for some $n_i \geq 1$.
It follows that $x \in M[I^{\sum n_i}]$. Thus $M[I^\infty]$ is
the kernel of $M \to \prod_{\mathfrak p \not \in Z} M_\mathfrak p$.
The second statement of the lemma follows and it implies the first.
\end{proof}

\noindent
The next lemma should probably go somewhere else.

\begin{lemma}
\label{lemma-derived-vanishing-mod-I}
Let $R$ be a ring. Let $I \subset R$ be an ideal. Let $K$ be an object of
$D(R)$ such that $K \otimes_R^\mathbf{L} R/I = 0$ in $D(R)$. Then
\begin{enumerate}
\item $K \otimes_R^\mathbf{L} R/I^n = 0$ for all $n \geq 1$,
\item $K \otimes_R^\mathbf{L} N = 0$ for any $I$-power torsion
$R$-module $N$,
\item $K \otimes_R^\mathbf{L} M = 0$ for any $M \in D^b(R)$ whose
cohomology modules are $I$-power torsion.
\end{enumerate}
\end{lemma}

\begin{proof}
Proof of (2). We can write $N = \bigcup N[I^n]$. We have
$K \otimes_R^\mathbf{L} N = \text{hocolim}_n K \otimes_R^\mathbf{L} N[I^n]$
as tensor products commute with colimits (details omitted; hint: represent
$K$ by a K-flat complex and compute directly).
Hence we may assume $N$ is annihilated by $I^n$.
Consider the $R$-algebra $R' = R/I^n \oplus N$
where $N$ is an ideal of square zero. It suffices to show that
$K' = K \otimes_R^\mathbf{L} R'$ is $0$ in $D(R')$.
We have a surjection $R' \to R/I$ of $R$-algebras whose kernel $J$
is nilpotent (any product of $n$ elements in the kernel is zero).
We have
$$
0 = K \otimes_R^\mathbf{L} R/I =
(K \otimes_R^\mathbf{L} R') \otimes_{R'}^\mathbf{L} R/I =
K' \otimes_{R'}^\mathbf{L} R/I
$$
by Lemma \ref{lemma-double-base-change}.
Hence by Lemma \ref{lemma-perfect-modulo-nilpotent-ideal}
we find that $K'$
is a perfect complex of $R'$-modules. In particular $K'$
is bounded above and if $H^b(K')$ is the right-most nonvanishing
cohomology module (if it exists), then $H^b(K')$ is a finite
$R'$-module (use Lemmas \ref{lemma-perfect} and
\ref{lemma-finite-cohomology})
with $H^b(K') \otimes_{R'} R'/J = H^b(K')/JH^b(K') = 0$ (because
$K' \otimes_{R'}^\mathbf{L} R'/J = 0$).
By Nakayama's lemma (Algebra, Lemma \ref{algebra-lemma-NAK})
we find $H^b(K') = 0$, i.e., $K' = 0$ as desired.

\medskip\noindent
Part (1) follows trivially from part (2).
Part (3) follows from part (2), induction on the number of nonzero
cohomology modules of $M$, and the distinguished triangles of truncation
from Derived Categories, Remark
\ref{derived-remark-truncation-distinguished-triangle}. Details omitted.
\end{proof}

\begin{lemma}
\label{lemma-torsion-completion}
\begin{reference}
Slight generalization of \cite[Lemme~1]{Beauville-Laszlo}.
\end{reference}
Let $R \to R'$ be a ring map. Let $I \subset R$ be an ideal such that
$R/I^n \to R'/I^nR'$ is an isomorphism for $n > 0$.
For any $I$-power torsion $R$-module $M$ the map $M \to M \otimes_R R'$
is an isomorphism.
For example, if $I$ is finitely generated and $R^\wedge$ is the completion
of $R$ with respect to $I$, then we have $M \cong M \otimes_R R^\wedge$.
\end{lemma}

\begin{proof}
If $M$ is annihilated by $I^n$, then
$$
M \otimes_R R' \cong
M \otimes_{R/I^n} R'/I^n R' \cong
M \otimes_{R/I^n} R/I^n \cong M.
$$
If $M$ is $I$-power torsion, then $M = \bigcup M[I^n]$.
Since tensor products commute with direct limits
(Algebra, Lemma \ref{algebra-lemma-tensor-products-commute-with-limits}),
we obtain the desired isomorphism. The last statement is a special
case of the first statement by Algebra, Lemma
\ref{algebra-lemma-hathat-finitely-generated}.
\end{proof}







\section{Formal glueing of module categories}
\label{section-formal-glueing}

\noindent
Fix a Noetherian scheme $X$, and a closed subscheme $Z$ with complement $U$.
Our goal is to explain how coherent sheaves on $X$ can be constructed
(uniquely) from coherent sheaves on the formal completion of $X$ along
$Z$, and those on $U$ with a suitable compatibility on the overlap.
We first do this using only commutative algebra (this section) and
later we explain this in the setting of algebraic spaces
(Pushouts of Spaces, Section \ref{spaces-pushouts-section-formal-glueing}).

\medskip\noindent
Here are some references treating some of the material in this section:
\cite[Section 2]{ArtinII},
\cite[Appendix]{Ferrand-Raynaud},
\cite{Beauville-Laszlo},
\cite{MB}, and
\cite[Section 4.6]{dJ-crystalline}.

\begin{lemma}
\label{lemma-characterize-flatness-on-torsion}
Let $\varphi : R \to S$ be a ring map. Let $I \subset R$ be an ideal.
The following are equivalent
\begin{enumerate}
\item $\varphi$ is flat and $R/I \to S/IS$ is faithfully flat,
\item $\varphi$ is flat, and the map
$\Spec(S/IS) \to \Spec(R/I)$ is surjective.
\item $\varphi$ is flat, and the base change functor
$M \mapsto M \otimes_R S$ is faithful on modules annihilated by $I$, and
\item $\varphi$ is flat, and the base change functor
$M \mapsto M \otimes_R S$ is faithful on $I$-power torsion modules.
\end{enumerate}
\end{lemma}

\begin{proof}
If $R \to S$ is flat, then $R/I^n \to S/I^nS$ is flat for every $n$, see
Algebra, Lemma \ref{algebra-lemma-flat-base-change}.
Hence (1) and (2) are equivalent by
Algebra, Lemma \ref{algebra-lemma-ff-rings}.
The equivalence of (1) with (3) follows by identifying $I$-torsion
$R$-modules with $R/I$-modules, using that
$$
M \otimes_R S = M \otimes_{R/I} S/IS
$$
for $R$-modules $M$ annihilated by $I$, and
Algebra, Lemma \ref{algebra-lemma-easy-ff}.
The implication (4) $\Rightarrow$ (3) is immediate. Assume (3). We have
seen above that $R/I^n \to S/I^nS$ is flat, and by assumption it induces
a surjection on spectra, as $\Spec(R/I^n) = \Spec(R/I)$ and
similarly for $S$. Hence the base change functor is faithful on modules
annihilated by $I^n$. Since any $I$-power torsion module $M$ is the union
$M = \bigcup M_n$ where $M_n$ is annihilated by $I^n$ we see that the base
change functor is faithful on the category of all $I$-power torsion modules
(as tensor product commutes with colimits).
\end{proof}

\begin{lemma}
\label{lemma-neighbourhood-isomorphism}
Assume $(\varphi : R \to S, I)$ satisfies the equivalent conditions of
Lemma \ref{lemma-characterize-flatness-on-torsion}.
The following are equivalent
\begin{enumerate}
\item for any $I$-power torsion module $M$, the natural map
$M \to M \otimes_R S$ is an isomorphism, and
\item $R/I \to S/IS$ is an isomorphism.
\end{enumerate}
\end{lemma}

\begin{proof}
The implication (1) $\Rightarrow$ (2) is immediate.
Assume (2). First assume that $M$ is annihilated by $I$.
In this case, $M$ is an $R/I$-module. Hence, we have an isomorphism
$$
M \otimes_R S = M \otimes_{R/I} S/IS = M \otimes_{R/I} R/I = M
$$
proving the claim. Next we prove by induction that $M \to M \otimes_R S$
is an isomorphism for any module $M$ is annihilated by $I^n$. Assume
the induction hypothesis holds for $n$ and assume $M$ is annihilated by
$I^{n + 1}$. Then we have a short exact sequence
$$
0 \to I^nM \to M \to M/I^nM \to 0
$$
and as $R \to S$ is flat this gives rise to a short exact sequence
$$
0 \to I^nM \otimes_R S \to M \otimes_R S \to M/I^nM \otimes_R S \to 0
$$
Using that the canonical map is an isomorphism for $M' = I^nM$ and
$M'' = M/I^nM$ (by induction hypothesis) we conclude the same thing is
true for $M$. Finally, suppose that $M$ is a general $I$-power torsion
module. Then $M = \bigcup M_n$ where $M_n$ is annihilated by $I^n$
and we conclude using that tensor products commute with colimits.
\end{proof}

\begin{lemma}
\label{lemma-neighbourhood-equivalence}
Assume $\varphi : R \to S$ is a flat ring map and $I \subset R$ is a
finitely generated ideal such that $R/I \to S/IS$ is an isomorphism. Then
\begin{enumerate}
\item for any $R$-module $M$ the map $M \to M \otimes_R S$ induces
an isomorphism
$M[I^\infty] \to (M \otimes_R S)[(IS)^\infty]$ of $I$-power
torsion submodules,
\item the natural map
$$
\Hom_R(M, N) \longrightarrow \Hom_S(M \otimes_R S, N \otimes_R S)
$$
is an isomorphism if either $M$ or $N$ is $I$-power torsion, and
\item the base change functor $M \mapsto M \otimes_R S$ defines an
equivalence of categories between $I$-power torsion modules
and $IS$-power torsion modules.
\end{enumerate}
\end{lemma}

\begin{proof}
Note that the equivalent conditions of both
Lemma \ref{lemma-characterize-flatness-on-torsion} and
Lemma \ref{lemma-neighbourhood-isomorphism}
are satisfied. We will use these without further mention.
We first prove (1). Let $M$ be any $R$-module.
Set $M' = M/M[I^\infty]$ and consider the exact sequence
$$
0 \to M[I^\infty] \to M \to M' \to 0
$$
As $M[I^\infty] = M[I^\infty] \otimes_R S$ we see that it suffices to
show that $(M' \otimes_R S)[(IS)^\infty] = 0$.
Write $I = (f_1, \ldots, f_t)$. By
Lemma \ref{lemma-divide-by-torsion}
we see that $M'[I^\infty] = 0$. Hence for every $n > 0$ the map
$$
M' \longrightarrow \bigoplus\nolimits_{i = 1, \ldots t} M',
\quad
x \longmapsto (f_1^n x, \ldots, f_t^n x)
$$
is injective. As $S$ is flat over $R$ also the corresponding map
$M' \otimes_R S \to \bigoplus_{i = 1, \ldots t} M' \otimes_R S$
is injective. This means that $(M' \otimes_R S)[I^n] = 0$ as desired.

\medskip\noindent
Next we prove (2). If $N$ is $I$-power torsion, then
$N \otimes_R S = N$ and the displayed map of (2) is an isomorphism by
Algebra, Lemma \ref{algebra-lemma-adjoint-tensor-restrict}.
If $M$ is $I$-power torsion, then the image of any map
$M \to N$ factors through $M[I^\infty]$ and the image of any map
$M \otimes_R S \to N \otimes_R S$ factors through
$(N \otimes_R S)[(IS)^\infty]$. Hence in this case
part (1) guarantees that we may replace $N$ by $N[I^\infty]$
and the result follows from the case where $N$ is $I$-power torsion
we just discussed.

\medskip\noindent
Next we prove (3). The functor is fully faithful by (2).
For essential surjectivity, we simply note that for any $IS$-power torsion
$S$-module $N$, the natural map $N \otimes_R S \to N$ is an isomorphism.
\end{proof}

\begin{lemma}
\label{lemma-map-identifies-koszul-and-cech-complexes}
Assume $\varphi : R \to S$ is a flat ring map and $I \subset R$ is a
finitely generated ideal such that $R/I \to S/IS$ is an isomorphism.
For any $f_1, \ldots, f_r \in R$ such that $V(f_1, \ldots, f_r) = V(I)$
\begin{enumerate}
\item the map of Koszul complexes
$K(R, f_1, \ldots, f_r) \to K(S, f_1, \ldots, f_r)$ is a quasi-isomorphism, and
\item The map of extended alternating {\v C}ech complexes
$$
\xymatrix{
R \to \prod_{i_0} R_{f_{i_0}} \to \prod_{i_0 < i_1} R_{f_{i_0}f_{i_1}}
\to \ldots \to R_{f_1\ldots f_r} \ar[d] \\
S \to \prod_{i_0} S_{f_{i_0}} \to \prod_{i_0 < i_1} S_{f_{i_0}f_{i_1}}
\to \ldots \to S_{f_1\ldots f_r}
}
$$
is a quasi-isomorphism.
\end{enumerate}
\end{lemma}

\begin{proof}
In both cases we have a complex $K_\bullet$ of $R$ modules and we want
to show that $K_\bullet \to K_\bullet \otimes_R S$ is a quasi-isomorphism.
By Lemma \ref{lemma-neighbourhood-isomorphism} and the flatness of
$R \to S$ this will hold as soon as all homology groups of $K$ are $I$-power
torsion. This is true for the Koszul complex by
Lemma \ref{lemma-homotopy-koszul} and for the extended alternating {\v C}ech
complex by Lemma \ref{lemma-extended-alternating-torsion}.
\end{proof}

\begin{lemma}
\label{lemma-naive-Koszul-complex}
Let $R$ be a ring. Let $I = (f_1, \ldots, f_n)$ be a finitely generated ideal
of $R$. Let $M$ be the $R$-module generated by elements
$e_1, \ldots, e_n$ subject to the relations $f_i e_j - f_j e_i = 0$.
There exists a short exact sequence
$$
0 \to K \to M \to I \to 0
$$
such that $K$ is annihilated by $I$.
\end{lemma}

\begin{proof}
This is just a truncation of the Koszul complex.
The map $M \to I$ is determined by the rule $e_i \mapsto f_i$. If
$m = \sum a_i e_i$ is in the kernel of $M \to I$, i.e., $\sum a_i f_i = 0$,
then $f_j m = \sum f_j a_i e_i = (\sum f_i a_i) e_j = 0$.
\end{proof}

\begin{lemma}
\label{lemma-explicit-ext}
Let $R$ be a ring. Let $I = (f_1, \ldots, f_n)$ be a finitely generated ideal
of $R$. For any $R$-module $N$ set
$$
H_1(N, f_\bullet) =
\frac{\{(x_1, \ldots, x_n) \in N^{\oplus n} \mid f_i x_j = f_j x_i \}}
{\{f_1x, \ldots, f_nx) \mid x \in N\}}
$$
For any $R$-module $N$ there exists a canonical short exact sequence
$$
0 \to \Ext_R(R/I, N) \to H_1(N, f_\bullet) \to \Hom_R(K, N)
$$
where $K$ is as in
Lemma \ref{lemma-naive-Koszul-complex}.
\end{lemma}

\begin{proof}
The notation above indicates the $\Ext$-groups in $\text{Mod}_R$
as defined in
Homology, Section \ref{homology-section-extensions}.
These are denoted $\Ext_R(M, N)$. Using the long exact sequence of
Homology, Lemma \ref{homology-lemma-six-term-sequence-ext}
associated to the short exact sequence $0 \to I \to R \to R/I \to 0$
and the fact that $\Ext_R(R, N) = 0$ we see that
$$
\Ext_R(R/I, N) =
\Coker(N \longrightarrow \Hom(I, N))
$$
Using the short exact sequence of
Lemma \ref{lemma-naive-Koszul-complex}
we see that we get a complex
$$
N \to \Hom(M, N) \to \Hom_R(K, N)
$$
whose homology in the middle is canonically isomorphic to
$\Ext_R(R/I, N)$. The proof of the lemma is now complete
as the cokernel of the first map
is canonically isomorphic to $H_1(N, f_\bullet)$.
\end{proof}

\begin{lemma}
\label{lemma-koszul-homology-annihilated}
Let $R$ be a ring. Let $I = (f_1, \ldots, f_n)$ be a finitely generated ideal
of $R$. For any $R$-module $N$ the Koszul homology group
$H_1(N, f_\bullet)$ defined in
Lemma \ref{lemma-explicit-ext}
is annihilated by $I$.
\end{lemma}

\begin{proof}
Let $(x_1, \ldots, x_n) \in N^{\oplus n}$ with $f_i x_j = f_j x_i$.
Then we have $f_i(x_1, \ldots, x_n) = (f_i x_i, \ldots, f_i x_n)$.
In other words $f_i$ annihilates $H_1(N, f_\bullet)$.
\end{proof}

\noindent
We can improve on the full faithfulness of
Lemma \ref{lemma-neighbourhood-equivalence}
by showing that $\Ext$-groups whose source is $I$-power torsion
are insensitive to passing to $S$ as well. See
Dualizing Complexes, Lemma \ref{dualizing-lemma-neighbourhood-extensions}
for a derived version of the following lemma.

\begin{lemma}
\label{lemma-neighbourhood-extensions}
Assume $\varphi : R \to S$ is a flat ring map and $I \subset R$ is a
finitely generated ideal such that $R/I \to S/IS$ is an isomorphism.
Let $M$, $N$ be $R$-modules. Assume $M$ is $I$-power torsion.
Given an short exact sequence
$$
0 \to N \otimes_R S \to \tilde E \to M \otimes_R S \to 0
$$
there exists a commutative diagram
$$
\xymatrix{
0 \ar[r] &
N \ar[r] \ar[d] &
E \ar[r] \ar[d] &
M \ar[r] \ar[d] &
0 \\
0 \ar[r] &
N \otimes_R S \ar[r] &
\tilde E \ar[r] &
M \otimes_R S \ar[r] &
0
}
$$
with exact rows.
\end{lemma}

\begin{proof}
As $M$ is $I$-power torsion we see that $M \otimes_R S = M$, see
Lemma \ref{lemma-neighbourhood-isomorphism}.
We will use this identification without further mention.
As $R \to S$ is flat, the base change functor is exact and we
obtain a functorial map of $\Ext$-groups
$$
\Ext_R(M, N)
\longrightarrow
\Ext_S(M \otimes_R S, N \otimes_R S),
$$
see
Homology, Lemma \ref{homology-lemma-exact-functor-ext}.
The claim of the lemma is that this map is surjective when
$M$ is $I$-power torsion. In fact we will show that it is an
isomorphism. By
Lemma \ref{lemma-I-power-torsion-presentation}
we can find a surjection $M' \to M$ with $M'$ a direct sum of
modules of the form $R/I^n$. Using the long exact sequence of
Homology, Lemma \ref{homology-lemma-six-term-sequence-ext}
we see that it suffices to prove the lemma for $M'$.
Using compatibility of $\Ext$ with direct sums (details omitted)
we reduce to the case where $M = R/I^n$ for some $n$.

\medskip\noindent
Let $f_1, \ldots, f_t$ be generators for $I^n$. By
Lemma \ref{lemma-explicit-ext}
we have a commutative diagram
$$
\xymatrix{
0 \ar[r] &
\Ext_R(R/I^n, N) \ar[r] \ar[d] &
H_1(N, f_\bullet) \ar[r] \ar[d] &
\Hom_R(K, N) \ar[d] \\
0 \ar[r] &
\Ext_S(S/I^nS, N \otimes S) \ar[r] &
H_1(N \otimes S, f_\bullet) \ar[r] &
\Hom_S(K \otimes S, N \otimes S)
}
$$
with exact rows where $K$ is as in
Lemma \ref{lemma-naive-Koszul-complex}.
Hence it suffices to prove that the two right vertical arrows are
isomorphisms. Since $K$ is annihilated by $I^n$ we see that
$\Hom_R(K, N) = \Hom_S(K \otimes_R S, N \otimes_R S)$ by
Lemma \ref{lemma-neighbourhood-equivalence}.
As $R \to S$ is flat we have
$H_1(N, f_\bullet) \otimes_R S = H_1(N \otimes_R S, f_\bullet)$.
As $H_1(N, f_\bullet)$ is annihilated by $I^n$, see
Lemma \ref{lemma-koszul-homology-annihilated}
we have $H_1(N, f_\bullet) \otimes_R S = H_1(N, f_\bullet)$ by
Lemma \ref{lemma-neighbourhood-isomorphism}.
\end{proof}

\noindent
Let $R \to S$ be a ring map.
Let $f_1, \ldots, f_t \in R$ and $I = (f_1, \ldots, f_t)$.
Then for any $R$-module $M$ we can define a complex
\begin{equation}
\label{equation-glueing-complex}
0 \to M \xrightarrow{\alpha}
M \otimes_R S \times \prod M_{f_i} \xrightarrow{\beta}
\prod (M \otimes_R S)_{f_i}
\times
\prod M_{f_if_j}
\end{equation}
where $\alpha(m) = (m \otimes 1, m/1, \ldots, m/1)$ and
$$
\beta(m', m_1, \ldots, m_t) =
((m'/1 - m_1 \otimes 1, \ldots, m'/1 - m_t \otimes 1),
(m_1 - m_2, \ldots, m_{t - 1} - m_t).
$$
We would like to know when this complex is exact.

\begin{lemma}
\label{lemma-recover-module-from-glueing-data}
Assume $\varphi : R \to S$ is a flat ring map and
$I = (f_1, \ldots, f_t) \subset R$ is an ideal such that
$R/I \to S/IS$ is an isomorphism.
Let $M$ be an $R$-module. Then the
complex (\ref{equation-glueing-complex})
is exact.
\end{lemma}

\begin{proof}
First proof. Denote $\check{\mathcal{C}}_R \to \check{\mathcal{C}}_S$
the quasi-isomorphism of extended alternating {\v C}ech complexes of
Lemma \ref{lemma-map-identifies-koszul-and-cech-complexes}.
Since these complexes are bounded with flat terms, we see that
$M \otimes_R \check{\mathcal{C}}_R \to M \otimes_R \check{\mathcal{C}}_S$
is a quasi-isomorphism too (Lemmas
\ref{lemma-derived-tor-quasi-isomorphism} and
\ref{lemma-derived-tor-quasi-isomorphism-other-side}). Now the complex
(\ref{equation-glueing-complex}) is a truncation of the cone
of the map
$M \otimes_R \check{\mathcal{C}}_R \to M \otimes_R \check{\mathcal{C}}_S$
and we win.

\medskip\noindent
Second computational proof.
Let $m \in M$. If $\alpha(m) = 0$, then $m \in M[I^\infty]$, see
Lemma \ref{lemma-torsion-free}. Pick $n$ such that $I^n m = 0$
and consider the map $\varphi : R/I^n \to M$.
If $m \otimes 1 = 0$, then $\varphi \otimes 1_S = 0$, hence
$\varphi = 0$ (see
Lemma \ref{lemma-neighbourhood-equivalence})
hence $m = 0$. In this way we see that $\alpha$ is injective.

\medskip\noindent
Let $(m', m'_1, \ldots, m'_t) \in \Ker(\beta)$.
Write $m'_i = m_i/f_i^n$ for some $n > 0$ and $m_i \in M$.
We may, after possibly enlarging $n$ assume that
$f_i^n m' = m_i \otimes 1$ in $M \otimes_R S$ and
$f_j^nm_i - f_i^nm_j = 0$ in $M$.
In particular we see that
$(m_1, \ldots, m_t)$ defines an element $\xi$ of
$H_1(M, (f_1^n, \ldots, f_t^n))$.
Since $H_1(M, (f_1^n, \ldots, f_t^n))$ is annihilated by $I^{tn + 1}$ (see
Lemma \ref{lemma-koszul-homology-annihilated})
and since $R \to S$ is flat we see that
$$
H_1(M, (f_1^n, \ldots, f_t^n)) =
H_1(M, (f_1^n, \ldots, f_t^n)) \otimes_R S =
H_1(M \otimes_R S, (f_1^n, \ldots, f_t^n))
$$
by
Lemma \ref{lemma-neighbourhood-isomorphism}
The existence of $m'$ implies that $\xi$ maps to zero in the last group, i.e.,
the element $\xi$ is zero. Thus there exists an $m \in M$ such that
$m_i = f_i^n m$. Then $(m', m'_1, \ldots, m'_t) - \alpha(m)
= (m'', 0, \ldots, 0)$ for some $m'' \in (M \otimes_R S)[(IS)^\infty]$.
By
Lemma \ref{lemma-neighbourhood-equivalence}
we conclude that $m'' \in M[I^\infty]$ and we win.
\end{proof}

\begin{remark}
\label{remark-glueing-data}
In this remark we define a category of glueing data.
Let $R \to S$ be a ring map.
Let $f_1, \ldots, f_t \in R$ and $I = (f_1, \ldots, f_t)$.
Consider the category $\text{Glue}(R \to S, f_1, \ldots, f_t)$
as the category whose
\begin{enumerate}
\item objects are systems $(M', M_i, \alpha_i, \alpha_{ij})$, where
$M'$ is an $S$-module, $M_i$ is an $R_{f_i}$-module,
$\alpha_i : (M')_{f_i} \to M_i \otimes_R S$ is an isomorphism, and
$\alpha_{ij} : (M_i)_{f_j} \to (M_j)_{f_i}$ are isomorphisms
such that
\begin{enumerate}
\item $\alpha_{ij} \circ \alpha_i = \alpha_j$ as maps
$(M')_{f_if_j} \to (M_j)_{f_i}$, and
\item $\alpha_{jk} \circ \alpha_{ij} = \alpha_{ik}$ as maps
$(M_i)_{f_jf_k} \to (M_k)_{f_if_j}$ (cocycle condition).
\end{enumerate}
\item morphisms
$(M', M_i, \alpha_i, \alpha_{ij}) \to (N', N_i, \beta_i, \beta_{ij})$
are given by maps $\varphi' : M' \to N'$ and $\varphi_i : M_i \to N_i$
compatible with the given maps $\alpha_i, \beta_i, \alpha_{ij}, \beta_{ij}$.
\end{enumerate}
There is a canonical functor
$$
\text{Can} : \text{Mod}_R
\longrightarrow
\text{Glue}(R \to S, f_1, \ldots, f_t),
\quad
M \longmapsto (M \otimes_R S, M_{f_i}, \text{can}_i, \text{can}_{ij})
$$
where $\text{can}_i : (M \otimes_R S)_{f_i} \to M_{f_i} \otimes_R S$
and $\text{can}_{ij} : (M_{f_i})_{f_j} \to (M_{f_j})_{f_i}$
are the canonical isomorphisms. For any object
$\mathbf{M} = (M', M_i, \alpha_i, \alpha_{ij})$ of the category
$\text{Glue}(R \to S, f_1, \ldots, f_t)$ we define
$$
H^0(\mathbf{M}) =
\{(m', m_i) \mid \alpha_i(m') = m_i \otimes 1, \alpha_{ij}(m_i) = m_j\}
$$
in other words defined by the exact sequence
$$
0 \to H^0(\mathbf{M}) \to
M' \times \prod M_i \to
\prod M'_{f_i}
\times
\prod (M_i)_{f_j}
$$
similar to (\ref{equation-glueing-complex}).
We think of $H^0(\mathbf{M})$ as an $R$-module. Thus we also get a functor
$$
H^0 :
\text{Glue}(R \to S, f_1, \ldots, f_t)
\longrightarrow
\text{Mod}_R
$$
Our next goal is to show that the functors
$\text{Can}$ and $H^0$ are sometimes quasi-inverse to each other.
\end{remark}

\begin{lemma}
\label{lemma-H0-inverse}
Assume $\varphi : R \to S$ is a flat ring map and
$I = (f_1, \ldots, f_t) \subset R$ is an ideal such that
$R/I \to S/IS$ is an isomorphism. Then the functor $H^0$
is a left quasi-inverse to the functor $\text{Can}$ of
Remark \ref{remark-glueing-data}.
\end{lemma}

\begin{proof}
This is a reformulation of
Lemma \ref{lemma-recover-module-from-glueing-data}.
\end{proof}

\begin{lemma}
\label{lemma-exact}
Assume $\varphi : R \to S$ is a flat ring map and let
$I = (f_1, \ldots, f_t) \subset R$ be an ideal.
Then $\text{Glue}(R \to S, f_1, \ldots, f_t)$ is an abelian category, and
the functor $\text{Can}$ is exact and commutes with arbitrary colimits.
\end{lemma}

\begin{proof}
Given a morphism
$(\varphi', \varphi_i) :
(M', M_i, \alpha_i, \alpha_{ij})
\to
(N', N_i, \beta_i, \beta_{ij})$
of the category $\text{Glue}(R \to S, f_1, \ldots, f_t)$
we see that its kernel exists and is equal to the object
$(\Ker(\varphi'), \Ker(\varphi_i), \alpha_i, \alpha_{ij})$
and its cokernel exists and is equal to the object
$(\Coker(\varphi'), \Coker(\varphi_i), \beta_i, \beta_{ij})$.
This works because $R \to S$ is flat, hence taking kernels/cokernels
commutes with $- \otimes_R S$. Details omitted.
The exactness follows from the $R$-flatness of $R_{f_i}$ and $S$, while
commuting with colimits follows as tensor products commute with colimits.
\end{proof}

\begin{lemma}
\label{lemma-equivalence-I-unit}
Let $\varphi : R \to S$ be a flat ring map and $(f_1, \ldots, f_t) = R$.
Then $\text{Can}$ and $H^0$ are quasi-inverse equivalences of categories
$$
\text{Mod}_R = \text{Glue}(R \to S, f_1, \ldots, f_t)
$$
\end{lemma}

\begin{proof}
Consider an object $\mathbf{M} = (M', M_i, \alpha_i, \alpha_{ij})$
of $\text{Glue}(R \to S, f_1, \ldots, f_t)$. By
Algebra, Lemma \ref{algebra-lemma-glue-modules}
there exists a unique module $M$ and isomorphisms
$M_{f_i} \to M_i$ which recover the glueing data $\alpha_{ij}$.
Then both $M'$ and $M \otimes_R S$ are $S$-modules
which recover the modules $M_i \otimes_R S$ upon localizing at $f_i$.
Whence there is a canonical isomorphism $M \otimes_R S \to M'$.
This shows that $\mathbf{M}$ is in the essential image of $\text{Can}$.
Combined with
Lemma \ref{lemma-H0-inverse}
the lemma follows.
\end{proof}

\begin{lemma}
\label{lemma-base-change-glue}
Let $\varphi : R \to S$ be a flat ring map and $I = (f_1, \ldots, f_t)$
and ideal. Let $R \to R'$ be a flat ring map, and set $S' = S \otimes_R R'$.
Then we obtain a commutative diagram of categories and functors
$$
\xymatrix{
\text{Mod}_R \ar[r]_-{\text{Can}} \ar[d]_{-\otimes_R R'} &
\text{Glue}(R \to S, f_1, \ldots, f_t) \ar[r]_-{H^0} \ar[d]^{-\otimes_R R'} &
\text{Mod}_R \ar[d]^{-\otimes_R R'} \\
\text{Mod}_{R'} \ar[r]^-{\text{Can}} &
\text{Glue}(R' \to S', f_1, \ldots, f_t) \ar[r]^-{H^0} &
\text{Mod}_{R'}
}
$$
\end{lemma}

\begin{proof}
Omitted.
\end{proof}

\begin{proposition}
\label{proposition-equivalence}
Assume $\varphi : R \to S$ is a flat ring map and
$I = (f_1, \ldots, f_t) \subset R$ is an ideal such that
$R/I \to S/IS$ is an isomorphism. Then $\text{Can}$ and
$H^0$ are quasi-inverse equivalences of categories
$$
\text{Mod}_R = \text{Glue}(R \to S, f_1, \ldots, f_t)
$$
\end{proposition}

\begin{proof}
We have already seen that $H^0 \circ \text{Can}$ is isomorphic to the
identity functor, see
Lemma \ref{lemma-H0-inverse}.
Consider an object $\mathbf{M} = (M', M_i, \alpha_i, \alpha_{ij})$
of $\text{Glue}(R \to S, f_1, \ldots, f_t)$.
We get a natural morphism
$$
\Psi :
(H^0(\mathbf{M}) \otimes_R S, H^0(\mathbf{M})_{f_i},
\text{can}_i, \text{can}_{ij})
\longrightarrow
(M', M_i, \alpha_i, \alpha_{ij}).
$$
Namely, by definition $H^0(\mathbf{M})$ comes equipped with compatible
$R$-module maps $H^0(\mathbf{M}) \to M'$ and $H^0(\mathbf{M}) \to M_i$.
We have to show that this map is an isomorphism.

\medskip\noindent
Pick an index $i$ and set $R' = R_{f_i}$. Combining
Lemmas \ref{lemma-base-change-glue} and \ref{lemma-equivalence-I-unit}
we see that $\Psi \otimes_R R'$ is an isomorphism.
Hence the kernel, resp.\ cokernel of $\Psi$ is a system of the form
$(K, 0, 0, 0)$, resp.\ $(Q, 0, 0, 0)$. Note that
$H^0((K, 0, 0, 0)) = K$, that $H^0$ is left exact, and that by
construction $H^0(\Psi)$ is bijective. Hence we see $K = 0$, i.e.,
the kernel of $\Psi$ is zero.

\medskip\noindent
The conclusion of the above is that we obtain a short exact sequence
$$
0 \to H^0(\mathbf{M}) \otimes_R S \to M' \to Q \to 0
$$
and that $M_i = H^0(\mathbf{M})_{f_i}$.
Note that we may think of $Q$ as an $R$-module which is $I$-power
torsion so that $Q = Q \otimes_R S$. By
Lemma \ref{lemma-neighbourhood-extensions}
we see that there exists a commutative diagram
$$
\xymatrix{
0 \ar[r] &
H^0(\mathbf{M}) \ar[r] \ar[d] &
E \ar[r] \ar[d] &
Q \ar[r] \ar[d] &
0 \\
0 \ar[r] &
H^0(\mathbf{M}) \otimes_R S \ar[r] &
M' \ar[r] &
Q \ar[r] &
0
}
$$
with exact rows. This clearly determines an isomorphism
$\text{Can}(E) \to (M', M_i, \alpha_i, \alpha_{ij})$
in the category $\text{Glue}(R \to S, f_1, \ldots, f_t)$
and we win. (Of course, a posteriori we have $Q = 0$.)
\end{proof}

\begin{lemma}
\label{lemma-application-formal-glueing}
Let $\varphi : R \to S$ be a flat ring map and let $I \subset R$ be a
finitely generated ideal such that $R/I \to S/IS$ is an isomorphism. 
\begin{enumerate}
\item Given an $R$-module $N$, an $S$-module $M'$ and an $S$-module
map $\varphi : M' \to N \otimes_R S$ whose kernel and cokernel are
$I$-power torsion, there exists an $R$-module map
$\psi : M \to N$ and an isomorphism $M \otimes_R S = M'$
compatible with $\varphi$ and $\psi$.
\item Given an $R$-module $M$, an $S$-module $N'$ and an $S$-module
map $\varphi : M \otimes_R S \to N'$ whose kernel and cokernel are
$I$-power torsion, there exists an $R$-module map
$\psi : M \to N$ and an isomorphism $N \otimes_R S = N'$
compatible with $\varphi$ and $\psi$.
\end{enumerate}
In both cases we have $\Ker(\varphi) \cong \Ker(\psi)$ and
$\Coker(\varphi) \cong \Coker(\psi)$.
\end{lemma}

\begin{proof}
Proof of (1). Say $I = (f_1, \ldots, f_t)$. It is clear that
the localization $\varphi_{f_i}$ is an isomorphism.
Thus we see that $(M', N_{f_i}, \varphi_{f_i}, can_{ij})$ is an
object of $\text{Glue}(R \to S, f_1, \ldots, f_t)$, see
Remark \ref{remark-glueing-data}.
By Proposition \ref{proposition-equivalence}
we conclude that there exists an $R$-module $M$ such that
$M' = M \otimes_R S$ and $N_{f_i} = M_{f_i}$ compatibly
with the isomorphisms $\varphi_{f_i}$ and $can_{ij}$. There is a
morphism
$$
(M \otimes_R S, M_{f_i}, can_i, can_{ij}) =
(M', N_{f_i}, \varphi_{f_i}, can_{ij})
\to
(N \otimes_R S, N_{f_i}, can_i, can_{ij})
$$
of $\text{Glue}(R \to S, f_1, \ldots, f_t)$
which uses $\varphi$ in the first component. This
corresponds to an $R$-module map $\psi : M \to N$ (by the equivalence of
categories of Proposition \ref{proposition-equivalence}).
The composition of the base change of $M \to N$ with the
isomorphism $M' \cong M \otimes_R S$ is $\varphi$, in other words
$M \to N$ is compatible with $\varphi$.

\medskip\noindent
Proof of (2). This is just the dual of the argument above.
Namely, the localization $\varphi_{f_i}$ is an isomorphism.
Thus we see that $(N', M_{f_i}, \varphi_{f_i}^{-1}, can_{ij})$ is an
object of $\text{Glue}(R \to S, f_1, \ldots, f_t)$, see
Remark \ref{remark-glueing-data}.
By Proposition \ref{proposition-equivalence}
we conclude that there exists an $R$-module $N$ such that
$N' = N \otimes_R S$ and $N_{f_i} = M_{f_i}$ compatibly
with the isomorphisms $\varphi_{f_i}^{-1}$ and $can_{ij}$. There is a
morphism
$$
(M \otimes_R S, M_{f_i}, can_i, can_{ij}) \to
(N', M_{f_i}, \varphi_{f_i}, can_{ij}) =
(N \otimes_R S, N_{f_i}, can_i, can_{ij})
$$
of $\text{Glue}(R \to S, f_1, \ldots, f_t)$
which uses $\varphi$ in the first component. This
corresponds to an $R$-module map $\psi : M \to N$ (by the equivalence of
categories of Proposition \ref{proposition-equivalence}).
The composition of the base change of $M \to N$ with the
isomorphism $N' \cong N \otimes_R S$ is $\varphi$, in other words
$M \to N$ is compatible with $\varphi$.

\medskip\noindent
The final statement follows for example from
Lemma \ref{lemma-neighbourhood-equivalence}.
\end{proof}

\noindent
Next, we specialize Proposition \ref{proposition-equivalence} to get something
more useable. Namely, if $I = (f)$ is a principal ideal then the objects
of $\text{Glue}(R \to S, f)$ are simply triples $(M', M_1, \alpha_1)$
and there is {\it no} cocycle condition to check!

\begin{theorem}
\label{theorem-formal-glueing}
Let $R$ be a ring, and let $f \in R$.
Let $\varphi : R \to S$ be a flat ring map inducing an isomorphism
$R/fR \to S/fS$. Then the functor
$$
\text{Mod}_R
\longrightarrow
\text{Mod}_S \times_{\text{Mod}_{S_f}} \text{Mod}_{R_f},
\quad
M
\longmapsto
(M \otimes_R S, M_f, \text{can})
$$
is an equivalence.
\end{theorem}

\begin{proof}
The category appearing on the right side of the arrow
is the category of triples $(M', M_1, \alpha_1)$ where $M'$ is an
$S$-module, $M_1$ is a $R_f$-module, and
$\alpha_1 : M'_f \to M_1 \otimes_R S$ is a $S_f$-isomorphism, see
Categories, Example \ref{categories-example-2-fibre-product-categories}.
Hence this theorem is a special case of
Proposition \ref{proposition-equivalence}.
\end{proof}

\noindent
A useful special case of
Theorem \ref{theorem-formal-glueing}
is when $R$ is Noetherian, and $S$ is a completion of $R$ at an
element $f$. The completion $R \to S$ is flat, and the functor
$M \mapsto M \otimes_R S$ can be identified with the $f$-adic
completion functor when $M$ is finitely generated. To state
this more precisely, let $\text{Mod}^{fg}_R$ denote the category
of finitely generated $R$-modules.

\begin{proposition}
\label{proposition-formal-glueing}
Let $R$ be a Noetherian ring.
Let $f \in R$ be an element.
Let $R^\wedge$ be the $f$-adic completion of $R$.
Then the functor $M \mapsto (M^\wedge, M_f, \text{can})$
defines an equivalence
$$
\text{Mod}^{fg}_R
\longrightarrow
\text{Mod}^{fg}_{R^\wedge}
\times_{\text{Mod}^{fg}_{(R^\wedge)_f}}
\text{Mod}^{fg}_{R_f}
$$
\end{proposition}

\begin{proof}
The ring map $R \to R^\wedge$ is flat by
Algebra, Lemma \ref{algebra-lemma-completion-flat}.
It is clear that $R/fR = R^\wedge/fR^\wedge$.
By
Algebra, Lemma \ref{algebra-lemma-completion-tensor}
the completion of a finite $R$-module $M$ is equal to $M \otimes_R R^\wedge$.
Hence the displayed functor of the proposition is equal to the
functor occurring in
Theorem \ref{theorem-formal-glueing}.
In particular it is fully faithful. Let $(M_1, M_2, \psi)$ be an
object of the right hand side. By
Theorem \ref{theorem-formal-glueing}
there exists an $R$-module $M$ such that
$M_1 = M \otimes_R R^\wedge$ and $M_2 = M_f$. As $R \to R^\wedge \times R_f$
is faithfully flat we conclude from
Algebra, Lemma \ref{algebra-lemma-cover}
that $M$ is finitely generated, i.e., $M \in \text{Mod}^{fg}_R$.
This proves the proposition.
\end{proof}

\begin{remark}
\label{remark-formal-glueing-algebras}
The equivalences of
Proposition \ref{proposition-equivalence},
Theorem \ref{theorem-formal-glueing}, and
Proposition \ref{proposition-formal-glueing}
preserve properties of modules. For example if
$M$ corresponds to $\mathbf{M} = (M', M_i, \alpha_i, \alpha_{ij})$
then $M$ is finite, or finitely presented, or flat, or projective over $R$
if and only if $M'$ and $M_i$ have the corresponding property
over $S$ and $R_{f_i}$. This follows from the fact that
$R \to S \times \prod R_{f_i}$ is faithfully flat and
descend and ascent of these properties along faithfully flat maps, see
Algebra, Lemma \ref{algebra-lemma-descend-properties-modules} and
Theorem \ref{algebra-theorem-ffdescent-projectivity}.
These functors also preserve the $\otimes$-structures on either side.
Thus, it defines equivalences of various categories
built out of the pair $(\text{Mod}_R, \otimes)$, such as the category of
algebras.
\end{remark}

\begin{remark}
\label{remark-topological-analogue}
Given a differential manifold $X$ with a compact closed submanifold $Z$
having complement $U$, specifying a sheaf on $X$ is the same as specifying
a sheaf on $U$, a sheaf on an unspecified tubular neighbourhood $T$ of $Z$ in
$X$, and an isomorphism between the two resulting sheaves along $T \cap U$.
Tubular neighbourhoods do not exist in algebraic geometry as such, but
results such as
Proposition \ref{proposition-equivalence},
Theorem \ref{theorem-formal-glueing}, and
Proposition \ref{proposition-formal-glueing}
allow us to work with formal neighbourhoods instead.
\end{remark}





\section{The Beauville-Laszlo theorem}
\label{section-beauville-laszlo}

\noindent
Let $R$ be a ring and let $f$ be an element of $R$. Denote
$R^\wedge = \lim R/f^n R$ the $f$-adic completion of $R$.
In this section we discuss and slightly generalize a theorem of
Beauville and Laszlo, see \cite{Beauville-Laszlo}.
The theorem asserts that under suitable conditions, a module over
$R$ can be constructed by ``glueing together'' modules over
$R^\wedge$ and $R_f$ along an isomorphism between the
base extensions to $(R^\wedge)_f$.

\medskip\noindent
In \cite{Beauville-Laszlo} it is assumed that $f$ is a nonzerodivisor on
both $R$ and $M$. In fact, one only needs to assume that
$$
R[f^\infty] \longrightarrow R^\wedge[f^\infty]
$$
is bijective and that
$$
M[f^\infty] \longrightarrow M \otimes_R R^\wedge
$$
is injective. This optimization was partly inspired by an alternate approach
to glueing introduced in \cite[\S 1.3]{Kedlaya-Liu-I} for use in the theory of
nonarchimedean analytic spaces.

\medskip\noindent
In fact, we will establish the Beauville-Laszlo theorem in the more general
setting of a ring map
$$
R \longrightarrow R'
$$
which induces isomorphisms $R/f^nR \to R'/f^nR'$ for every $n > 0$
and an isomorphism $R[f^\infty] \to R'[f^\infty]$.
This is better suited for globalizing and does not formally follow
from the case when $R'$ is the completion of $R$
because, for instance, the condition that $R[f^\infty] \to R'[f^\infty]$
is a bijection does not imply that
$R[f^\infty] \to R^\wedge[f^\infty]$ is a bijection.

\medskip\noindent
The theorem of Beauville and Laszlo as proved in this section
can be viewed as a non-flat version of Theorem \ref{theorem-formal-glueing}
and in the case where $R' = R^\wedge$ can be viewed
as a non-Noetherian version of
Proposition \ref{proposition-formal-glueing}.
For a comparison with flat descent, please see Remark \ref{remark-not-descent}.

\medskip\noindent
One can establish even stronger results (without imposing restrictions
on $M$ for example) but for this one must work at the level of
derived categories. See \cite[\S 5]{Bhatt-Algebraize} for more details.

\begin{lemma}
\label{lemma-same-quotients}
Let $R$ be a ring and let $f \in R$. For every positive integer $n$ the map
$R/f^nR \to R^\wedge/f^n R^\wedge$ is an isomorphism.
\end{lemma}

\begin{proof}
This is a special case of Algebra, Lemma
\ref{algebra-lemma-hathat-finitely-generated}.
\end{proof}

\noindent
We will use the notation introduced in Section \ref{section-torsion}.
Thus for an $R$-module $M$, we denote $M[f^n]$ the submodule of
$M$ annihilated by  $f^n$ and we put
$$
M[f^\infty] = \bigcup\nolimits_{n = 1}^\infty M[f^n] = \Ker(M \to M_f).
$$
If $M = M[f^\infty]$, we say that $M$ is an $f$-power torsion module.

\begin{lemma}
\label{lemma-BL-faithful}
Let $R$ be a ring, let $f \in R$, and let $R \to R'$ be a ring map
which induces isomorphisms $R/f^nR \to R'/f^nR'$ for $n > 0$.
The $R$-module $R' \oplus R_f$ is faithful: for every nonzero
$R$-module $M$, the module $M \otimes_R (R' \oplus R_f)$
is also nonzero. For example, if $M$ is nonzero, then
$M \otimes_R (R^\wedge \oplus R_f)$ is nonzero.
\end{lemma}

\noindent
However, the map $M \to M \otimes_R (R' \oplus R_f)$ need not be
injective; see Example \ref{example-not-glueing-pair}.

\begin{proof}
If $M \neq 0$ but $M \otimes_R R_f = 0$, then $M$ is $f$-power torsion.
By Lemma \ref{lemma-torsion-completion} we find that
$M \otimes_R R' \cong M \neq 0$. The last statement is a special
case of the first statement by Lemma \ref{lemma-same-quotients}.
\end{proof}

\begin{lemma}
\label{lemma-cover-spec}
Let $R$ be a ring, let $f \in R$, and let $R \to R'$ be a ring map
which induces an isomorphism $R/fR \to R'/fR'$.
The map $\Spec(R') \amalg \Spec(R_f) \to \Spec(R)$ is surjective.
For example, the map
$\Spec(R^\wedge) \amalg \Spec(R_f) \to \Spec(R)$ is surjective.
\end{lemma}

\begin{proof}
Recall that $\Spec(R) = V(f) \amalg D(f)$ where $V(f) = \Spec(R/fR)$
and $D(f) = \Spec(R_f)$, see
Algebra, Section \ref{algebra-section-spectrum-ring}
and especially Lemmas \ref{algebra-lemma-spec-closed} and
\ref{algebra-lemma-standard-open}.
Thus the lemma follows as the map $R \to R/fR$ factors through $R'$.
The last statement is a special
case of the first statement by Lemma \ref{lemma-same-quotients}.
\end{proof}

\begin{lemma}
\label{lemma-faithful-descent}
\begin{reference}
Slight generalization of \cite[Lemme~2(a)]{Beauville-Laszlo}.
\end{reference}
Let $R$ be a ring, let $f \in R$, and let $R \to R'$ be a ring map
which induces isomorphisms $R/f^nR \to R'/f^nR'$ for $n > 0$.
An $R$-module $M$ is finitely generated if and only if the
($R' \oplus R_f$)-module $M \otimes_R (R' \oplus R_f)$ is finitely generated.
For example, if $M \otimes_R (R^\wedge \oplus R_f)$ is finitely generated
as a module over $R^\wedge \oplus R_f$, then $M$ is a finitely generated
$R$-module.
\end{lemma}

\begin{proof}
The `only if' is clear, so we assume that
$M \otimes_R (R' \oplus R_f)$ is finitely generated. In this case, by
writing each generator as a sum of simple tensors,
$M \otimes_R (R' \oplus R_f)$ admits a finite
generating set consisting of elements of $M$.
That is, there exists a morphism from a finite free
$R$-module to $M$ whose cokernel is killed by tensoring with $R' \oplus R_f$;
we may thus deduce $M$ is finite generated by applying
Lemma \ref{lemma-BL-faithful} to this cokernel.
The last statement is a special
case of the first statement by Lemma \ref{lemma-same-quotients}.
\end{proof}

\begin{remark}
\label{remark-not-descent}
While $R \to R_f$ is always flat, $R \to R^\wedge$ is typically not flat
unless $R$ is Noetherian (see
Algebra, Lemma \ref{algebra-lemma-completion-flat}
and the discussion in
Examples, Section \ref{examples-section-nonflat}).
Consequently, we cannot in general apply faithfully flat descent
as discussed in Descent, Section
\ref{descent-section-descent-modules}
to the morphism $R \to R^\wedge \oplus R_f$.
Moreover, even in the Noetherian case, the usual
definition of a descent datum for this morphism
refers to the ring $R^\wedge \otimes_R R^\wedge$, which we will
avoid considering in this section.
\end{remark}

\noindent
{\bf Glueing pairs.} Let $R \to R'$ be a ring map that induces isomorphisms
$R/f^nR \to R'/f^nR'$ for $n > 0$. Consider the sequence
\begin{equation}
\label{equation-BL-cech-re}
0 \to R \to R' \oplus R_f \to R'_f \to 0,
\end{equation}
in which the map on the right is the difference between the two canonical
homomorphisms. If this sequence is exact, then
we say that $(R \to R', f)$ is a \emph{glueing pair}.
We will say that $(R, f)$ is a \emph{glueing pair} if
$(R \to R^\wedge, f)$ is a glueing pair; this makes sense by
Lemma \ref{lemma-same-quotients}. Thus $(R, f)$
is a glueing pair if and only if the sequence
\begin{equation}
\label{equation-BL-cech}
0 \to R \to R^\wedge \oplus R_f \to (R^\wedge)_f \to 0,
\end{equation}
is exact.

\begin{lemma}
\label{lemma-same-f-torsion}
Let $R$ be a ring, let $f \in R$, and let $R \to R'$ be a ring map
which induces isomorphisms $R/f^nR \to R'/f^nR'$ for $n > 0$.
The sequence (\ref{equation-BL-cech-re}) is
\begin{enumerate}
\item exact on the right,
\item exact on the left if and only if $R[f^\infty] \to R'[f^\infty]$
is injective, and
\item exact in the middle if and only if $R[f^\infty] \to R'[f^\infty]$
is surjective.
\end{enumerate}
In particular, $(R \to R', f)$ is a glueing pair if and only if
$R[f^\infty] \to R'[f^\infty]$ is bijective. For example, $(R, f)$
is a glueing pair if and only if
$R[f^\infty] \to R^\wedge[f^\infty]$ is bijective.
\end{lemma}

\begin{proof}
Let $x \in R'_f$. Write $x = x'/f^n$ with $x' \in R'$.
Write $x' = x'' + f^n y$ with $x'' \in R$ and $y \in R'$.
Then we see that $(y, -x''/f^n)$ maps to $x$. Thus (1) holds.

\medskip\noindent
Part (2) follows from the fact that $\Ker(R \to R_f) = R[f^\infty]$.

\medskip\noindent
If the sequence is exact in the middle, then elements of the form
$(x, 0)$ with $x \in R'[f^\infty]$ are in the image of
the first arrow. This implies that $R[f^\infty] \to R'[f^\infty]$
is surjective. Conversely, assume that $R[f^\infty] \to R'[f^\infty]$
is surjective. Let $(x, y)$ be an element in the middle
which maps to zero on the right. Write $y = y'/f^n$ for some $y' \in R$.
Then we see that $f^n x - y'$ is annihilated by some power of $f$ in
$R'$. By assumption we can write $f^nx - y' = z$ for some
$z \in R[f^\infty]$. Then $y = y''/f^n$ where $y'' = y' + z$
is in the kernel of $R \to R/f^nR$. Hence we see that $y$ can be
represented as $y'''/1$ for some $y''' \in R$. Then
$x - y'''$ is in $R'[f^\infty]$. Thus $x - y''' = z' \in R[f^\infty]$.
Then $(x, y'''/1) = (y''' + z', (y''' + z')/1)$ as desired.

\medskip\noindent
The last statement of the lemma is a special case of the penultimate statement
by Lemma \ref{lemma-same-quotients}.
\end{proof}

\begin{remark}
\label{remark-BL-special-case}
Suppose that $f$ is a nonzerodivisor. Then
Algebra, Lemma \ref{algebra-lemma-completion-differ-by-torsion}
shows that $f$ is a nonzerodivisor in $R^\wedge$.
Hence $(R, f)$ is a glueing pair.
\end{remark}

\begin{remark}
\label{remark-noetherian-case}
If $R \to R^\wedge$ is flat, then for each positive integer $n$ tensoring
the sequence $0 \to R[f^n] \to R \to R$ with $R^\wedge$ gives the sequence
$0 \to R[f^n] \otimes_R R^\wedge \to R^\wedge \to R^\wedge$.
Combined with Lemma \ref{lemma-torsion-completion}
we conclude that $R[f^n] \to R^\wedge[f^n]$ is an isomorphism.
Thus $(R, f)$ is a glueing pair.
This holds in particular if $R$ is Noetherian, see
Algebra, Lemma \ref{algebra-lemma-completion-flat}.
\end{remark}

\begin{example}
\label{example-not-glueing-pair}
Let $k$ be a field and put
$$
R = k[f, T_1, T_2, \ldots]/(fT_1, fT_2 - T_1, fT_3 - T_2, \ldots).
$$
Then $(R, f)$ is not a glueing pair because the map
$R[f^\infty] \to R^\wedge[f^\infty]$ is not injective
as the image of $T_1$ is $f$-divisible in $R^\wedge$.
For
$$
R = k[f, T_1, T_2, \ldots]/(fT_1, f^2T_2, \ldots),
$$
the map $R[f^\infty] \to R^\wedge[f^\infty]$ is not surjective
as the element $T_1 + fT_2 + f^2 T_3 + \ldots$ is not in the image.
In particular, by
Remark \ref{remark-noetherian-case}, these are both examples where
$R \to R^\wedge$ is not flat.
\end{example}

\noindent
{\bf Glueable modules.}
Let $R \to R'$ be a ring map which induces isomorphisms
$R/f^nR \to R'/f^nR'$ for $n > 0$. For any $R$-module $M$, we
may tensor (\ref{equation-BL-cech-re}) with $M$ to obtain a sequence
\begin{equation}
\label{equation-BL-cech-mod-re}
0 \to M \to (M \otimes_R R') \oplus (M \otimes_R R_f) \to
M \otimes_R R'_f \to 0
\end{equation}
Observe that $M \otimes_R R_f = M_f$ and that
$M \otimes_R R'_f = (M \otimes_R R')_f$.
If this sequence is exact, we say that $M$ is
\emph{glueable for $(R \to R', f)$}.
If $R$ is a ring and $f \in R$, then we say an $R$-module
is \emph{glueable} if $M$ is glueable for $(R \to R^\wedge, f)$.
Thus $M$ is glueable if and only if the sequence
\begin{equation}
\label{equation-BL-cech-mod}
0 \to M \to (M \otimes_R R^\wedge) \oplus (M \otimes_R R_f) \to
M \otimes_R (R^\wedge)_f \to 0
\end{equation}
is exact.

\begin{lemma}
\label{lemma-same-f-torsion-module}
Let $R$ be a ring, let $f \in R$, and let $R \to R'$ be a ring map
which induces isomorphisms $R/f^nR \to R'/f^nR'$ for $n > 0$.
The sequence (\ref{equation-BL-cech-mod-re}) is
\begin{enumerate}
\item exact on the right,
\item exact on the left if and only if
$M[f^\infty] \to (M \otimes_R R')[f^\infty]$
is injective, and
\item exact in the middle if and only if
$M[f^\infty] \to (M \otimes_R R')[f^\infty]$
is surjective.
\end{enumerate}
Thus $M$ is glueable for $(R \to R', f)$ if and only if
$M[f^\infty] \to (M \otimes_R R')[f^\infty]$ is bijective.
If $(R \to R', f)$ is a glueing pair, then $M$ is glueable for $(R \to R', f)$
if and only if $M[f^\infty] \to (M \otimes_R R')[f^\infty]$ is injective.
For example, if $(R, f)$ is a glueing pair, then $M$ is glueable
if and only if $M[f^\infty] \to (M \otimes_R R^\wedge)[f^\infty]$ is
injective.
\end{lemma}

\begin{proof}
We will use the results of Lemma \ref{lemma-same-f-torsion} without
further mention. The functor $M \otimes_R -$ is right exact
(Algebra, Lemma \ref{algebra-lemma-tensor-product-exact})
hence we get (1).

\medskip\noindent
The kernel of $M \to M \otimes_R R_f = M_f$ is $M[f^\infty]$.
Thus (2) follows.

\medskip\noindent
If the sequence is exact in the middle, then elements of the form
$(x, 0)$ with $x \in (M \otimes_R R')[f^\infty]$ are in the image of
the first arrow. This implies that
$M[f^\infty] \to (M \otimes_R R')[f^\infty]$
is surjective. Conversely, assume that
$M[f^\infty] \to (M \otimes_R R')[f^\infty]$
is surjective. Let $(x, y)$ be an element in the middle
which maps to zero on the right. Write $y = y'/f^n$ for some $y' \in M$.
Then we see that $f^n x - y'$ is annihilated by some power of $f$ in
$M \otimes_R R'$. By assumption we can write $f^nx - y' = z$ for some
$z \in M[f^\infty]$. Then $y = y''/f^n$ where $y'' = y' + z$
is in the kernel of $M \to M/f^nM$. Hence we see that $y$ can be
represented as $y'''/1$ for some $y''' \in M$. Then
$x - y'''$ is in $(M \otimes_R R')[f^\infty]$.
Thus $x - y''' = z' \in M[f^\infty]$.
Then $(x, y'''/1) = (y''' + z', (y''' + z')/1)$ as desired.

\medskip\noindent
If $(R \to R', f)$ is a glueing pair, then (\ref{equation-BL-cech-mod-re})
is exact in the middle for any $M$ by
Algebra, Lemma \ref{algebra-lemma-tensor-product-exact}.
This gives the penultimate statement of the lemma.
The final statement of the lemma follows from this and
the fact that $(R, f)$ is a glueing pair if and only if
$(R \to R^\wedge, f)$ is a glueing pair.
\end{proof}

\begin{remark}
\label{remark-glueable}
Let $(R \to R', f)$ be a glueing pair and let $M$ be an $R$-module.
Here are some  observations which can be used to determine whether
$M$ is glueable for $(R \to R', f)$.
\begin{enumerate}
\item By Lemma \ref{lemma-same-f-torsion-module} we see that $M$
is glueable for $(R \to R^\wedge, f)$
if and only if $M[f^\infty] \to M \otimes_R R^\wedge$ is injective.
This holds if $M[f] \to M^\wedge$ is injective,
i.e., when $M[f] \cap \bigcap_{n = 1}^\infty f^n M = 0$.
\item If $\text{Tor}_1^R(M, R'_f) = 0$, then $M$ is glueable for
$(R \to R', f)$
(use Algebra, Lemma \ref{algebra-lemma-long-exact-sequence-tor}).
This is equivalent to saying that $\text{Tor}_1^R(M, R')$ is
$f$-power torsion. In particular, any flat $R$-module
is glueable for $(R \to R', f)$.
\item If $R \to R'$ is flat, then $\text{Tor}_1^R(M, R') = 0$
for every $R$-module so every $R$-module is glueable for
$(R \to R', f)$. This holds
in particular when $R$ is Noetherian and $R' = R^\wedge$, see
Algebra, Lemma \ref{algebra-lemma-completion-flat}
\end{enumerate}
\end{remark}

\begin{example}[Non glueable module]
\label{example-not-glueable-module}
\begin{reference}
\cite[\S 4, Remarques]{Beauville-Laszlo}
\end{reference}
Let $R$ be the ring of germs at $0$ of $C^\infty$ functions on $\mathbf{R}$.
Let $f \in R$ be the function $f(x) = x$. Then $f$ is a nonzerodivisor
in $R$, so $(R, f)$ is a glueing pair and $R^\wedge \cong \mathbf{R}[[x]]$.
Let $\varphi \in R$ be the function $\varphi(x) = \text{exp}(-1/x^2)$.
Then $\varphi$ has zero Taylor series, so $\varphi \in \Ker(R \to R^\wedge)$.
Since $\varphi(x) \neq 0$ for $x \neq 0$, we see that $\varphi$ is a
nonzerodivisor in $R$. The function $\varphi/f$ also has zero Taylor series,
so its image in $M = R/\varphi R$ is a nonzero element of $M[f]$
which maps to zero in
$M \otimes_R R^\wedge = R^\wedge/\varphi R^\wedge = R^\wedge$.
Hence $M$ is not glueable.
\end{example}

\noindent
We next make some calculations of Tor groups.

\begin{lemma}
\label{lemma-first-tor}
Let $(R \to R', f)$ be a glueing pair. Then
$\text{Tor}^R_1(R', f^n R) = 0$ for each $n > 0$.
\end{lemma}

\begin{proof}
From the exact sequence $0 \to R[f^n] \to R \to f^n R \to 0$ we see that it
suffices to check that $R[f^n] \otimes_R R' \to R'$ is injective.
By Lemma \ref{lemma-torsion-completion} we have
$R[f^n] \otimes_R R' = R[f^n]$ and by Lemma \ref{lemma-same-f-torsion}
we see that $R[f^n] \to R'$ is injective as $(R \to R', f)$ is a glueing pair.
\end{proof}

\begin{lemma}
\label{lemma-first-tor-total}
Let $(R \to R',f)$ be a glueing pair.
Then $\text{Tor}^R_1(R', R/R[f^\infty]) = 0$.
\end{lemma}

\begin{proof}
We have $R/R[f^\infty] = \colim R/R[f^n] = \colim f^nR$.
As formation of Tor groups commutes with filtered colimits
(Algebra, Lemma \ref{algebra-lemma-tor-commutes-filtered-colimits})
we may apply Lemma \ref{lemma-first-tor}.
\end{proof}

\begin{lemma}
\label{lemma-BL3}
\begin{reference}
Slight generalization of \cite[Lemme 3(a)]{Beauville-Laszlo}
\end{reference}
Let $(R \to R', f)$ be a glueing pair. For every $R$-module $M$, we have
$\text{Tor}^R_1(R', \Coker(M \to M_f)) = 0$.
\end{lemma}

\begin{proof}
Set $\overline{M} = M/M[f^\infty]$. Then
$\Coker(M \to M_f) \cong \Coker(\overline{M} \to \overline{M}_f)$
hence we may and do assume that $f$ is a nonzerodivisor on $M$.
In this case $M \subset M_f$ and $M_f/M = \colim M/f^nM$ where the
transition maps are given by multiplication by $f$. Since
formation of Tor groups commutes with colimits
(Algebra, Lemma \ref{algebra-lemma-tor-commutes-filtered-colimits})
it suffices to show that $\text{Tor}^R_1(R', M/f^n M) = 0$.

\medskip\noindent
We first treat the case $M = R/R[f^\infty]$. By
Lemma \ref{lemma-same-f-torsion}
we have $M \otimes_R R' = R'/R'[f^\infty]$.
From the short exact sequence $0 \to M \to M \to M/f^nM \to 0$
we obtain the exact sequence
$$
\xymatrix{
\text{Tor}_1^R(R', R/R[f^\infty]) \ar[r] &
\text{Tor}_1^R(R', M/f^n M) \ar[r] &
R'/R'[f^\infty] \ar[dll]_{f^n} \\
R'/R'[f^\infty] \ar[r] &
(R'/R'[f^\infty])/(f^n
(R'/R'[f^\infty])) \ar[r] & 0
}
$$
by Algebra, Lemma \ref{algebra-lemma-long-exact-sequence-tor}.
Here the diagonal arrow is injective. Since the first group
$\text{Tor}_1^R(R', R/R[f^\infty])$ is zero by
Lemma \ref{lemma-first-tor-total}, we deduce that
$\text{Tor}_1^R(R', M/f^nM) = 0$ as desired.

\medskip\noindent
To treat the general case, choose a surjection $F \to M$ with $F$ a free
$R/R[f^\infty]$-module, and form an exact sequence
$$
0 \to N \to F/f^n F \to M/f^n M \to 0.
$$
By Lemma \ref{lemma-torsion-completion}
this sequence remains unchanged, and hence
exact, upon tensoring with $R'$.
Since $\text{Tor}^R_1(R', F/f^n F) = 0$ by the
previous paragraph, we deduce  that
$\text{Tor}^R_1(R', M/f^n M) = 0$ as desired.
\end{proof}

\noindent
Let $(R \to R', f)$ be a glueing pair. This means that
$R/f^nR \to R'/f^nR'$ is an isomorphism for $n > 0$ and the sequence
$$
0 \to R \to R' \oplus R_f \to R_f' \to 0
$$
is exact. Consider the category $\text{Glue}(R \to R', f)$
introduced in Remark \ref{remark-glueing-data}. We will call an object
$(M', M_1, \alpha_1)$ of $\text{Glue}(R \to R', f)$
a \emph{glueing datum}. It consists of an $R'$-module $M'$,
an $R_f$-module $M_1$, and
an isomorphism $\alpha_1 : (M')_f \to M_1 \otimes_R R'$.
There is an obvious functor
$$
\text{Can} : \text{Mod}_R \longrightarrow \text{Glue}(R \to R', f),\quad
M \longmapsto (M \otimes_R R', M_f, \text{can}),
$$
and there is a functor
$$
H^0 : \text{Glue}(R \to R', f) \longrightarrow \text{Mod}_R,\quad
(M', M_1, \alpha_1) \longmapsto \Ker(M' \oplus M_1 \to (M')_f)
$$
in the reverse direction, see Remark \ref{remark-glueing-data}
for the precise definition.

\begin{theorem}
\label{theorem-BL-glueing}
\begin{reference}
Slight generalization of the main theorem of \cite{Beauville-Laszlo}.
\end{reference}
Let $(R \to R',f)$ be a glueing pair. The functor
$\text{Can} : \text{Mod}_R \longrightarrow \text{Glue}(R \to R', f)$
determines an equivalence of the category of $R$-modules glueable
for $(R \to R', f)$ and the category $\text{Glue}(R \to R', f)$
of glueing data.
\end{theorem}

\begin{proof}
The functor is fully faithful due to the exactness of
(\ref{equation-BL-cech-mod-re}) for glueable modules, which tells
us exactly that $H^0 \circ \text{Can} = \text{id}$ on the
full subcategory of glueable modules.
Hence it suffices to check essential surjectivity.
That is, we must show that an arbitrary glueing datum
$(M', M_1, \alpha_1)$ arises from some glueable $R$-module.

\medskip\noindent
We first check that the map $\text{d} : M' \oplus M_1 \to (M')_f$ used in the
definition of the functor $H^0$ is surjective. Observe that
$(x, y) \in M' \oplus M_1$ maps to
$\text{d}(x, y) = x/1 - \alpha_1^{-1}(y \otimes 1)$
in $(M')_f$. If $z \in (M')_f$, then we can write
$\alpha_1(z) = \sum y_i \otimes g_i$ with $g_i \in R'$
and $y_i \in M_1$. Write $\alpha_1^{-1}(y_i \otimes 1) = y_i'/f^n$
for some $y'_i \in M'$ and $n \geq 0$ (we can pick the same $n$
for all $i$). Write $g_i = a_i + f^n b_i$ with $a_i \in R$ and
$b_i \in R'$. Then with $y = \sum a_i y_i \in M_1$ and
$x = \sum b_i y'_i \in M'$ we have $\text{d}(x, -y) = z$
as desired.

\medskip\noindent
Put $M = H^0((M', M_1, \alpha_1)) = \Ker(\text{d})$. We obtain
an exact sequence of $R$-modules
\begin{equation}
\label{equation-define-M}
0 \to M \to M' \oplus M_1 \to (M')_f \to 0.
\end{equation}
We will prove that the maps $M \to M'$ and $M \to M_1$ induce isomorphisms
$M \otimes_R R' \to M'$ and $M \otimes_R R_f \to M_1$.
This will imply that $M$ is glueable for $(R \to R', f)$ and
gives rise to the original glueing datum.

\medskip\noindent
Since $f$ is a nonzerodivisor on $M_1$, we have
$M[f^\infty] \cong M'[f^\infty]$. This yields an exact sequence
\begin{equation}
\label{equation-exact-mod-torsion}
0 \to M/M[f^\infty] \to M_1 \to (M')_f/M' \to 0.
\end{equation}
Since $R \to R_f$ is flat, we may tensor this exact sequence with $R_f$
to deduce that $M \otimes_R R_f = (M/M[f^\infty]) \otimes_R R_f \to M_1$
is an isomorphism.

\medskip\noindent
By Lemma \ref{lemma-BL3} we have
$\text{Tor}_1^R(R', \Coker(M' \to (M')_f)) = 0$.
The sequence (\ref{equation-exact-mod-torsion})
thus remains exact upon tensoring
over $R$ with $R'$. Using $\alpha_1$ and
Lemma \ref{lemma-torsion-completion}
the resulting exact sequence can be written as
\begin{equation}
\label{equation-mod-torsion-sequence}
0 \to (M/M[f^\infty]) \otimes_R R' \to
(M')_f \to (M')_f/M' \to 0
\end{equation}
This yields an isomorphism
$(M/M[f^\infty]) \otimes_R R' \cong M'/M'[f^\infty]$.
This implies that in the diagram
$$
\xymatrix{
& M[f^\infty] \otimes_R R' \ar[r] \ar[d] &
M \otimes_R R'  \ar[r] \ar[d] &
(M/M[f^\infty]) \otimes_R R' \ar[r] \ar[d] & 0 \\
0 \ar[r] &
M'[f^\infty] \ar[r] &
M' \ar[r] &
M'/M'[f^\infty] \ar[r] & 0,
}
$$
the third vertical arrow is an isomorphism. Since the rows are exact and the
first vertical arrow is an isomorphism by
Lemma \ref{lemma-torsion-completion} and $M[f^\infty] = M'[f^\infty]$,
the five lemma implies that $M \otimes_R R' \to M'$ is an isomorphism.
This completes the proof.
\end{proof}

\begin{remark}
\label{remark-what-you-get-for-general-modules}
Let $(R \to R', f)$ be a glueing pair.
Let $M$ be an $R$-module that is not necessarily glueable
for $(R \to R', f)$. Setting $M' = M \otimes_R R'$ and $M_1 = M_f$
we obtain the glueing datum $\text{Can}(M) = (M', M_1, \text{can})$.
Then $\tilde M = H^0(M', M_1, \text{can})$ is an $R$-module that is
glueable for $(R \to R', f)$
and the canonical map $M \to \tilde M$ gives isomorphisms
$M \otimes_R R' \to \tilde M \otimes_R R'$ and
$M_f \to \tilde M_f$, see Theorem \ref{theorem-BL-glueing}.
From the exactness of the sequences
$$
M \to (M \otimes_R R' )\oplus M_f \to M \otimes_R (R')_f  \to 0
$$
and
$$
0 \to \tilde M \to (\tilde M \otimes_R R') \oplus \tilde M_f \to
\tilde M \otimes_R  (R')_f \to 0
$$
we conclude that the map $M \to \tilde M$ is surjective.
\end{remark}

\noindent
Recall that flat $R$-modules over a glueing pair $(R \to R', f)$
are glueable (Remark \ref{remark-glueable}). Hence the following
lemma shows that
Theorem \ref{theorem-BL-glueing} determines an equivalence between
the category of flat $R$-modules and
the category of glueing data $(M', M_1, \alpha_1)$ where $M'$
and $M_1$ are flat over $R'$ and $R_f$.

\begin{lemma}
\label{lemma-BL-flat}
Let $(R \to R', f)$ be a glueing pair. Let $M$ be an $R$-module
which is not necessarily glueable for $(R \to R', f)$. Then $M$
is flat over $R$ if and only if $M \otimes_R R'$ is flat over $R'$
and $M_f$ is flat over $R_f$.
\end{lemma}

\begin{proof}
One direction of the lemma follows from
Algebra, Lemma \ref{algebra-lemma-flat-base-change}.
For the other direction, assume $M \otimes_R R'$
is flat over $R'$ and $M_f$ is flat over $R_f$.
Let $\tilde M$ be as in Remark \ref{remark-what-you-get-for-general-modules}.
If $\tilde M$ is flat over $R$, then applying
Algebra, Lemma \ref{algebra-lemma-flat-tor-zero}
to the short exact sequence
$0 \to \Ker(M \to \tilde M) \to M \to \tilde M \to 0$
we find that $\Ker(M \to \tilde M) \otimes_R (R' \oplus R_f)$ is zero.
Hence $M = \tilde M$ by Lemma \ref{lemma-BL-faithful} and we conclude.
In other words, we may replace $M$ by $\tilde M$ and assume
$M$ is glueable for $(R \to R', f)$. Let $N$ be a second $R$-module.
It suffices to prove that $\text{Tor}_1^R(M, N) = 0$, see
Algebra, Lemma \ref{algebra-lemma-characterize-flat}.

\medskip\noindent
The long the exact sequence of Tors associated to the
short exact sequence $0 \to R \to R' \oplus R_f \to (R')_f \to 0$
and $N$ gives an exact sequence
$$
0 \to \text{Tor}_1^R(R', N) \to \text{Tor}_1^R((R')_f, N)
$$
and isomorphisms
$\text{Tor}_i^R(R', N) = \text{Tor}_i^R((R')_f, N)$
for $i \geq 2$. Since
$\text{Tor}_i^R((R')_f, N) = \text{Tor}_i^R(R', N)_f$
we conclude that $f$ is a nonzerodivisor on $\text{Tor}_1^R(R', N)$
and invertible on $\text{Tor}_i^R(R', N)$ for $i \geq 2$.
Since $M \otimes_R R'$ is flat over $R'$ we have
$$
\text{Tor}_i^R(M \otimes_R R', N) =
(M \otimes_R R') \otimes_{R'} \text{Tor}_i^R(R', N)
$$
by the spectral sequence of Example \ref{example-tor-change-rings}.
Writing $M \otimes_R R'$ as a filtered colimit of
finite free $R'$-modules (Algebra, Theorem \ref{algebra-theorem-lazard})
we conclude that $f$ is a nonzerodivisor
on $\text{Tor}_1^R(M \otimes_R R', N)$ and invertible on
$\text{Tor}_i^R(M \otimes_R R', N)$. Next, we consider
the exact sequence
$0 \to M \to M \otimes_R R' \oplus M_f \to M \otimes_R (R')_f \to 0$
coming from the fact that $M$ is glueable and the associated long exact
sequence of $\text{Tor}$. The relevant part is
$$
\xymatrix{
\text{Tor}_1^R(M, N) \ar[r] &
\text{Tor}_1^R(M \otimes_R R', N) \ar[r] &
\text{Tor}_1^R(M \otimes_R (R')_f, N) \\
& \text{Tor}_2^R(M \otimes_R R', N) \ar[r] &
\text{Tor}_2^R(M \otimes_R (R')_f, N) \ar[llu]
}
$$
We conclude that $\text{Tor}_1^R(M, N) = 0$ by our remarks above on the
action on $f$ on $\text{Tor}_i^R(M \otimes_R R', N)$.
\end{proof}

\noindent
Observe that we have seen the result of the following lemma for
``finitely generated'' in Lemma \ref{lemma-faithful-descent}.

\begin{lemma}
\label{lemma-BL-properties}
Let $(R \to R', f)$ be a glueing pair. Let $M$ be an $R$-module
which is not necessarily glueable for $(R \to R', f)$. Then
$M$ is a finite projective $R$-module if and only if
$M \otimes_R R'$ is finite projective over $R'$ and
$M_f$ is finite projective over $R_f$.
\end{lemma}

\begin{proof}
Assume that $M \otimes_R R'$ is a finite projective module over
$R'$ and that $M_f$ is a finite projective module over $R_f$.
Our task is to prove that $M$ is finite projective over $R$.
We will use Algebra, Lemma \ref{algebra-lemma-finite-projective}
without further mention.
By Lemma \ref{lemma-BL-flat} we see that $M$ is flat.
By Lemma \ref{lemma-faithful-descent} we see that $M$ is finite.
Choose a short exact sequence $0 \to K \to R^{\oplus n} \to M \to 0$.
Since a finite projective module is of finite presentation
and since the sequence remains exact after tensoring with
$R'$ (by Algebra, Lemma \ref{algebra-lemma-flat-tor-zero})
and $R_f$, we conclude that $K \otimes_R R'$ and $K_f$
are finite modules. Using the lemma above
we conclude that $K$ is finitely generated.
Hence $M$ is finitely presented and hence finite projective.
\end{proof}

\begin{remark}
\label{remark-compare-BL}
In \cite{Beauville-Laszlo} it is assumed that $f$ is a nonzerodivisor
in $R$ and $R' = R^\wedge$, which gives a glueing pair by
Lemma \ref{lemma-same-f-torsion}.
Even in this setting Theorem \ref{theorem-BL-glueing}
says something new: the
results of \cite{Beauville-Laszlo} only apply to modules on which
$f$ is a nonzerodivisor (and hence glueable in our sense, see
Lemma \ref{lemma-same-f-torsion-module}).
Lemma \ref{lemma-BL-properties} also provides a slight extension
of the results of  \cite{Beauville-Laszlo}: not only can we allow $M$
to have nonzero $f$-power torsion, we do not even require it to be glueable.
\end{remark}










\section{Derived Completion}
\label{section-derived-completion}

\noindent
Some references for the material in this section are
\cite{Dwyer-Greenlees}, \cite{Greenlees-May}, \cite{PSY}, \cite{dag12}
(especially Chapter 4). Our exposition follows \cite{BS}.
The analogue (or ``dual'') of this section for torsion modules
is Dualizing Complexes, Section \ref{dualizing-section-local-cohomology}.
The relationship between the derived category of complexes with
torsion cohomology and derived complete complexes can be found
in Dualizing Complexes, Section \ref{dualizing-section-torsion-and-complete}.

\medskip\noindent
Let $K \in D(A)$. Let $f \in A$. We denote $T(K, f)$ a derived limit
of the system
$$
\ldots \to K \xrightarrow{f} K \xrightarrow{f} K
$$
in $D(A)$.

\begin{lemma}
\label{lemma-hom-from-Af}
Let $A$ be a ring. Let $f \in A$. Let $K \in D(A)$.
The following are equivalent
\begin{enumerate}
\item $\Ext^n_A(A_f, K) = 0$ for all $n$,
\item $\Hom_{D(A)}(E, K) = 0$ for all $E$ in $D(A_f)$,
\item $T(K, f) = 0$,
\item for every $p \in \mathbf{Z}$ we have $T(H^p(K), f) = 0$,
\item for every $p \in \mathbf{Z}$ we have
$\Hom_A(A_f, H^p(K)) = 0$ and $\Ext^1_A(A_f, H^p(K)) = 0$,
\item $R\Hom_A(A_f, K) = 0$,
\item the map $\prod_{n \geq 0} K \to \prod_{n \geq 0} K$,
$(x_0, x_1, \ldots) \mapsto (x_0 - fx_1, x_1 - fx_2, \ldots)$
is an isomorphism in $D(A)$, and
\item add more here.
\end{enumerate}
\end{lemma}

\begin{proof}
It is clear that (2) implies (1) and that (1) is equivalent to (6). Assume (1).
Let $I^\bullet$ be a K-injective complex of $A$-modules representing $K$.
Condition (1) signifies that $\Hom_A(A_f, I^\bullet)$ is acyclic.
Let $M^\bullet$ be a complex of $A_f$-modules representing $E$.
Then
$$
\Hom_{D(A)}(E, K) =
\Hom_{K(A)}(M^\bullet, I^\bullet) =
\Hom_{K(A_f)}(M^\bullet, \Hom_A(A_f, I^\bullet))
$$
by Algebra, Lemma \ref{algebra-lemma-adjoint-hom-restrict}.
As $\Hom_A(A_f, I^\bullet)$ is a K-injective complex of
$A_f$-modules by Lemma \ref{lemma-hom-K-injective}
the fact that it is acyclic implies that it is homotopy equivalent to zero
(Derived Categories, Lemma \ref{derived-lemma-K-injective}).
Thus we get (2).

\medskip\noindent
A free resolution of the $A$-module $A_f$ is given by
$$
0 \to \bigoplus\nolimits_{n \in \mathbf{N}} A \to
\bigoplus\nolimits_{n \in \mathbf{N}} A
\to A_f \to 0
$$
where the first map sends the $(a_0, a_1, a_2, \ldots)$ to
$(a_0, a_1 - fa_0, a_2 - fa_1, \ldots)$ and the second map sends
$(a_0, a_1, a_2, \ldots)$ to $a_0 + a_1/f + a_2/f^2 + \ldots$.
Applying $\Hom_A(-, I^\bullet)$ we get
$$
0 \to \Hom_A(A_f, I^\bullet) \to \prod I^\bullet \to \prod I^\bullet \to 0
$$
Since $\prod I^\bullet$ represents $\prod_{n \geq 0} K$
this proves the equivalence of (1) and (7). On the other hand,
by construction of derived limits in
Derived Categories, Section \ref{derived-section-derived-limit}
the displayed exact sequence shows the object $T(K, f)$
is a representative of $R\Hom_A(A_f, K)$ in $D(A)$.
Thus the equivalence of (1) and (3).

\medskip\noindent
There is a spectral sequence
$$
E_2^{p, q} = \Ext^p_A(A_f, H^q(K)) \Rightarrow
\Ext^{p + q}_A(A_f, K)
$$
See Equation (\ref{equation-first-ss-ext}).
This spectral sequence degenerates at $E_2$ because
$A_f$ has a length $1$ resolution by projective $A$-modules (see above)
hence the $E_2$-page has only 2 nonzero columns. Thus we obtain short exact
sequences
$$
0 \to \Ext^1_A(A_f, H^{p - 1}(K)) \to
\Ext^p_A(A_f, K) \to
\Hom_A(A_f, H^p(K)) \to 0
$$
This proves (4) and (5) are equivalent to (1).
\end{proof}

\begin{lemma}
\label{lemma-ideal-of-elements-complete-wrt}
Let $A$ be a ring. Let $K \in D(A)$. The set $I$ of $f \in A$ such that
$T(K, f) = 0$ is a radical ideal of $A$.
\end{lemma}

\begin{proof}
We will use the results of Lemma \ref{lemma-hom-from-Af}
without further mention.
If $f \in I$, and $g \in A$, then $A_{gf}$ is an $A_f$-module
hence $\Ext^n_A(A_{gf}, K) = 0$ for all $n$, hence $gf \in I$.
Suppose $f, g \in I$. Then there is a short exact sequence
$$
0 \to A_{f + g} \to A_{f(f + g)} \oplus A_{g(f + g)} \to A_{gf(f + g)} \to 0
$$
because $f, g$ generate the unit ideal in $A_{f + g}$. This follows from
Algebra, Lemma \ref{algebra-lemma-standard-covering}
and the easy fact that the last arrow is surjective.
From the long exact sequence of $\Ext$ and the vanishing of
$\Ext^n_A(A_{f(f + g)}, K)$,
$\Ext^n_A(A_{g(f + g)}, K)$, and
$\Ext^n_A(A_{gf(f + g)}, K)$ for all $n$
we deduce the vanishing of $\Ext^n_A(A_{f + g}, K)$ for all $n$.
Finally, if $f^n \in I$ for some $n > 0$, then $f \in I$ because
$T(K, f) = T(K, f^n)$ or because $A_f \cong A_{f^n}$.
\end{proof}

\begin{lemma}
\label{lemma-complete-derived-complete}
Let $A$ be a ring. Let $I \subset A$ be an ideal. Let $M$ be an $A$-module.
\begin{enumerate}
\item If $M$ is $I$-adically complete, then $T(M, f) = 0$ for all $f \in I$.
\item Conversely, if $T(M, f) = 0$ for all $f \in I$ and $I$ is finitely
generated, then $M \to \lim M/I^nM$ is surjective.
\end{enumerate}
\end{lemma}

\begin{proof}
Proof of (1). Assume $M$ is $I$-adically complete.
By Lemma \ref{lemma-hom-from-Af} it suffices to prove
$\Ext^1_A(A_f, M) = 0$ and $\Hom_A(A_f, M) = 0$.
Since $M = \lim M/I^nM$ and since $\Hom_A(A_f, M/I^nM) = 0$
it follows that $\Hom_A(A_f, M) = 0$. Suppose we have an extension
$$
0 \to M \to E \to A_f \to 0
$$
For $n \geq 0$ pick $e_n \in E$ mapping to $1/f^n$.
Set $\delta_n = fe_{n + 1} - e_n \in M$ for $n \geq 0$.
Replace $e_n$ by
$$
e'_n = e_n + \delta_n + f\delta_{n + 1} + f^2 \delta_{n + 2} + \ldots
$$
The infinite sum exists as $M$ is complete with respect to $I$ and $f \in I$.
A simple calculation shows that $fe'_{n + 1} = e'_n$. Thus we get a splitting
of the extension by mapping $1/f^n$ to $e'_n$.

\medskip\noindent
Proof of (2). Assume that $I = (f_1, \ldots, f_r)$ and that $T(M, f_i) = 0$
for $i = 1, \ldots, r$. By
Algebra, Lemma \ref{algebra-lemma-when-surjective-to-completion}
we may assume $I = (f)$ and $T(M, f) = 0$. Let $x_n \in M$ for $n \geq 0$.
Consider the extension
$$
0 \to M \to E \to A_f \to 0
$$
given by
$$
E = M \oplus \bigoplus Ae_n\Big/\langle x_n - fe_{n + 1} + e_n\rangle
$$
mapping $e_n$ to $1/f^n$ in $A_f$ (see above).
By assumption and Lemma \ref{lemma-hom-from-Af}
this extension is split, hence we obtain an element
$x + e_0$ which generates a copy of $A_f$ in $E$.
Then
$$
x + e_0 = x - x_0 + fe_1 = x - x_0 - f x_1 + f^2 e_2 = \ldots
$$
Since $M/f^nM = E/f^nE$ by the snake lemma, we see that
$x = x_0 + fx_1 + \ldots + f^{n - 1}x_{n - 1}$ modulo $f^nM$.
In other words, the map $M \to \lim M/f^nM$ is surjective as desired.
\end{proof}

\noindent
Motivated by the results above we make the following definition.

\begin{definition}
\label{definition-derived-complete}
Let $A$ be a ring. Let $K \in D(A)$. Let $I \subset A$ be an ideal.
We say $K$ is {\it derived complete with respect to $I$}
if for every $f \in I$ we have $T(K, f) = 0$.
If $M$ is an $A$-module, then we say $M$ is
{\it derived complete with respect to $I$}
if $M[0] \in D(A)$ is derived complete with respect to $I$.
\end{definition}

\noindent
The full subcategory $D_{comp}(A) = D_{comp}(A, I) \subset D(A)$
consisting of derived complete objects is a strictly full, saturated
triangulated subcategory, see
Derived Categories, Definitions
\ref{derived-definition-triangulated-subcategory} and
\ref{derived-definition-saturated}.
By Lemma \ref{lemma-ideal-of-elements-complete-wrt}
the subcategory $D_{comp}(A, I)$ depends only on the radical
$\sqrt{I}$ of $I$, in other words it depends only on the closed
subset $Z = V(I)$ of $\Spec(A)$. The subcategory $D_{comp}(A, I)$ is preserved
under products and homotopy limits in $D(A)$.
But it is not preserved under countable direct sums in general.
We will often simply say $M$ is a derived complete module if
the choice of the ideal $I$ is clear from the context.

\begin{proposition}
\label{proposition-derived-complete-modules}
Let $I \subset A$ be a finitely generated ideal of a ring $A$.
Let $M$ be an $A$-module. The following are equivalent
\begin{enumerate}
\item $M$ is $I$-adically complete, and
\item $M$ is derived complete with respect to $I$ and $\bigcap I^nM = 0$.
\end{enumerate}
\end{proposition}

\begin{proof}
This is clear from the results of
Lemma \ref{lemma-complete-derived-complete}.
\end{proof}

\noindent
The next lemma shows that the category $\mathcal{C}$
of derived complete modules is abelian. It turns out that $\mathcal{C}$
is not a Grothendieck abelian category, see
Examples, Section \ref{examples-section-derived-complete-modules}.

\begin{lemma}
\label{lemma-serre-subcategory}
Let $I$ be an ideal of a ring $A$.
\begin{enumerate}
\item The derived complete $A$-modules form a weak Serre
subcategory $\mathcal{C}$ of $\text{Mod}_A$.
\item $D_\mathcal{C}(A) \subset D(A)$ is the full subcategory
of derived complete objects.
\end{enumerate}
\end{lemma}

\begin{proof}
Part (2) is immediate from Lemma \ref{lemma-hom-from-Af}
and the definitions. For part (1), suppose that $M \to N$ is
a map of derived complete modules. Denote $K = (M \to N)$
the corresponding object of $D(A)$. Pick $f \in I$. Then
$\Ext_A^n(A_f, K)$ is zero for all $n$ because
$\Ext_A^n(A_f, M)$ and $\Ext_A^n(A_f, N)$ are zero for all $n$.
Hence $K$ is derived complete. By (2) we see that $\Ker(M \to N)$ and
$\Coker(M \to N)$ are objects of $\mathcal{C}$.
Finally, suppose that $0 \to M_1 \to M_2 \to M_3 \to 0$
is a short exact sequence of $A$-modules and
$M_1$, $M_3$ are derived complete. Then it follows from
the long exact sequence of $\Ext$'s that $M_2$
is derived complete. Thus $\mathcal{C}$ is a weak Serre subcategory by
Homology, Lemma \ref{homology-lemma-characterize-weak-serre-subcategory}.
\end{proof}

\noindent
We will generalize the following lemma in
Lemma \ref{lemma-derived-complete-zero-bis}.

\begin{lemma}
\label{lemma-derived-complete-zero}
Let $I$ be a finitely generated ideal of a ring $A$.
Let $M$ be a derived complete $A$-module.
If $M/IM = 0$, then $M = 0$.
\end{lemma}

\begin{proof}
Assume that $M/IM$ is zero. Let $I = (f_1, \ldots, f_r)$.
Let $i < r$ be the largest integer such that $N = M/(f_1, \ldots, f_i)M$
is nonzero. If $i$ does not exist, then $M = 0$ which is what we
want to show. Then $N$ is derived complete as a cokernel
of a map between derived complete modules, see
Lemma \ref{lemma-serre-subcategory}.
By our choice of $i$ we have that $f_{i + 1} : N \to N$ is surjective.
Hence
$$
\lim (\ldots \to N \xrightarrow{f_{i + 1}} N \xrightarrow{f_{i + 1}} N)
$$
is nonzero, contradicting the derived completeness of $N$.
\end{proof}

\noindent
If the ring is $I$-adically complete, then one obtains an ample supply
of derived complete complexes.

\begin{lemma}
\label{lemma-pseudo-coherent-is-derived-complete}
Let $A$ be a ring and $I \subset A$ an ideal. If $A$ is derived complete
(eg.\ $I$-adically complete)
then any pseudo-coherent object of $D(A)$ is derived complete.
\end{lemma}

\begin{proof}
(Lemma \ref{lemma-complete-derived-complete} explains the parenthetical
statement of the lemma.)
Let $K$ be a pseudo-coherent object of $D(A)$. By definition this
means $K$ is represented by a bounded above complex $K^\bullet$
of finite free $A$-modules. Since $A$ is derived complete
it follows that $H^n(K)$ is derived complete for all $n$, by part (1)
of Lemma \ref{lemma-serre-subcategory}. This in turn implies that
$K$ is derived complete by part (2) of the same lemma.
\end{proof}

\begin{lemma}
\label{lemma-double-localize}
Let $A$ be a ring. Let $f, g \in A$. Then for $K \in D(A)$ we have
$R\Hom_A(A_f, R\Hom_A(A_g, K)) = R\Hom_A(A_{fg}, K)$.
\end{lemma}

\begin{proof}
This follows from Lemma \ref{lemma-internal-hom}.
\end{proof}

\begin{lemma}
\label{lemma-derived-completion}
\begin{slogan}
Derived completions along finitely generated ideals exist, and can
be computed by a {\v C}ech procedure.
\end{slogan}
Let $I$ be a finitely generated ideal of a ring $A$.
The inclusion functor $D_{comp}(A, I) \to D(A)$ has a
left adjoint, i.e., given any object $K$ of $D(A)$ there
exists a map $K \to K^\wedge$ of $K$ into a derived complete
object of $D(A)$ such that the map
$$
\Hom_{D(A)}(K^\wedge, E) \longrightarrow \Hom_{D(A)}(K, E)
$$
is bijective whenever $E$ is a derived complete object of $D(A)$.
In fact, if $I$ is generated by $f_1, \ldots, f_r \in A$, then we have
$$
K^\wedge = R\Hom\left((A \to \prod\nolimits_{i_0} A_{f_{i_0}} \to
\prod\nolimits_{i_0 < i_1} A_{f_{i_0}f_{i_1}}
\to \ldots \to A_{f_1\ldots f_r}), K\right)
$$
functorially in $K$.
\end{lemma}

\begin{proof}
Define $K^\wedge$ by the last displayed formula of the lemma.
There is a map of complexes
$$
(A \to \prod\nolimits_{i_0} A_{f_{i_0}} \to
\prod\nolimits_{i_0 < i_1} A_{f_{i_0}f_{i_1}} \to
\ldots \to A_{f_1\ldots f_r}) \longrightarrow A
$$
which induces a map $K \to K^\wedge$. It suffices to prove that
$K^\wedge$ is derived complete and that $K \to K^\wedge$ is an
isomorphism if $K$ is derived complete.

\medskip\noindent
Let $f \in A$. By Lemma \ref{lemma-double-localize}
the object $R\Hom_A(A_f, K^\wedge)$ is equal to
$$
R\Hom\left((A_f \to \prod\nolimits_{i_0} A_{ff_{i_0}} \to
\prod\nolimits_{i_0 < i_1} A_{ff_{i_0}f_{i_1}} \to
\ldots \to A_{ff_1\ldots f_r}), K\right)
$$
If $f \in I$, then $f_1, \ldots, f_r$ generate the
unit ideal in $A_f$, hence the extended alternating
{\v C}ech complex
$$
A_f \to \prod\nolimits_{i_0} A_{ff_{i_0}} \to
\prod\nolimits_{i_0 < i_1} A_{ff_{i_0}f_{i_1}} \to
\ldots \to A_{ff_1\ldots f_r}
$$
is zero in $D(A)$ by
Lemma \ref{lemma-extended-alternating-torsion}.
(In fact, if $f = f_i$ for some $i$, then this complex
is homotopic to zero by
Lemma \ref{lemma-extended-alternating-homotopy-zero};
this is the only case we need.)
Hence $R\Hom_A(A_f, K^\wedge) = 0$ and we conclude that
$K^\wedge$ is derived complete by Lemma \ref{lemma-hom-from-Af}.

\medskip\noindent
Conversely, if $K$ is derived complete, then $R\Hom_A(A_f, K)$
is zero for all $f = f_{i_0} \ldots f_{i_p}$, $p \geq 0$. Thus
$K \to K^\wedge$ is an isomorphism in $D(A)$.
\end{proof}

\begin{remark}
\label{remark-derived-completion}
Let $A$ be a ring and let $I \subset A$ be a finitely generated ideal.
The left adjoint to the inclusion functor $D_{comp}(A, I) \to D(A)$
which exists by Lemma \ref{lemma-derived-completion} is called the
{\it derived completion}. To indicate this we will say
``let $K^\wedge$ be the derived completion of $K$''. Please keep in mind
that the unit of the adjunction is a functorial map $K \to K^\wedge$.
\end{remark}

\begin{lemma}
\label{lemma-derived-completion-vanishes}
Let $A$ be a ring and let $I \subset A$ be a finitely generated ideal.
Let $K^\bullet$ be a complex of $A$-modules such that
$f : K^\bullet \to K^\bullet$ is an isomorphism for some
$f \in I$, i.e., $K^\bullet$ is a complex of $A_f$-modules. Then
the derived completion of $K^\bullet$ is zero.
\end{lemma}

\begin{proof}
Indeed, in this case the $R\Hom_A(K, L)$ is zero for any derived complete
complex $L$, see
Lemma \ref{lemma-hom-from-Af}. Hence $K^\wedge$ is zero by the
universal property in Lemma \ref{lemma-derived-completion}.
\end{proof}

\begin{lemma}
\label{lemma-completion-RHom}
Let $A$ be a ring and let $I \subset A$ be a finitely generated ideal.
Let $K, L \in D(A)$. Then
$$
R\Hom_A(K, L)^\wedge = R\Hom_A(K, L^\wedge) = R\Hom_A(K^\wedge, L^\wedge)
$$
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-derived-completion} we know that derived completion is
given by $R\Hom_A(C, -)$ for some $C \in D(A)$. Then
\begin{align*}
R\Hom_A(C, R\Hom_A(K, L))
& =
R\Hom_A(C \otimes_A^\mathbf{L} K, L) \\
& =
R\Hom_A(K, R\Hom_A(C, L))
\end{align*}
by Lemma \ref{lemma-internal-hom}. This proves the first equation.
The map $K \to K^\wedge$ induces a map
$$
R\Hom_A(K^\wedge, L^\wedge) \to R\Hom_A(K, L^\wedge)
$$
which is an isomorphism in $D(A)$ by definition of the derived completion
as the left adjoint to the inclusion functor.
\end{proof}

\begin{lemma}
\label{lemma-naive-derived-completion}
Let $A$ be a ring and let $I \subset A$ be an ideal. Let $(K_n)$ be an inverse
system of objects of $D(A)$ such that for all $f \in I$ and $n$
there exists an $e = e(n, f)$ such that $f^e$ is zero on $K_n$.
Then for $K \in D(A)$ the object $K' = R\lim (K \otimes_A^\mathbf{L} K_n)$
is derived complete with respect to $I$.
\end{lemma}

\begin{proof}
Since the category of derived complete objects is preserved under $R\lim$
it suffices to show that each $K \otimes_A^\mathbf{L} K_n$ is derived
complete. By assumption for all $f \in I$ there is an $e$ such
that $f^e$ is zero on $K \otimes_A^\mathbf{L} K_n$. Of course this
implies that $T(K \otimes_A^\mathbf{L} K_n, f) = 0$ and we win.
\end{proof}

\begin{situation}
\label{situation-koszul}
Let $A$ be a ring. Let $I = (f_1, \ldots, f_r) \subset A$. Let
$K_n^\bullet = K_\bullet(A, f_1^n, \ldots, f_r^n)$
be the Koszul complex on $f_1^n, \ldots, f_r^n$
viewed as a cochain complex in degrees $-r, -r + 1, \ldots, 0$.
Using the functoriality of Lemma \ref{lemma-functorial}
we obtain an inverse system
$$
\ldots \to K_3^\bullet \to K_2^\bullet \to K_1^\bullet
$$
compatible with the inverse system
$H^0(K_n^\bullet) = A/(f_1^n, \ldots, f_r^n)$
and compatible with the maps $A \to K_n^\bullet$.
\end{situation}

\noindent
A key feature of the discussion below will use that for $m > n$ the map
$$
K_m^{-p} = \wedge^p(A^{\oplus r}) \to \wedge^p(A^{\oplus r}) = K_n^{-p}
$$
is given by multiplication by $f_{i_1}^{m - n} \ldots f_{i_p}^{m - n}$
on the basis element $e_{i_1} \wedge \ldots \wedge e_{i_p}$.

\begin{lemma}
\label{lemma-koszul-derived-completion-complete}
In Situation \ref{situation-koszul}. For
$K \in D(A)$ the object $K' = R\lim (K \otimes_A^\mathbf{L} K_n^\bullet)$
is derived complete with respect to $I$.
\end{lemma}

\begin{proof}
This is a special case of Lemma \ref{lemma-naive-derived-completion}
because $f_i^n$ acts by an endomorphism of $K_n^\bullet$ which is
homotopic to zero by Lemma \ref{lemma-homotopy-koszul}.
\end{proof}

\begin{lemma}
\label{lemma-characterize-derived-complete-Koszul}
In Situation \ref{situation-koszul}. Let $K \in D(A)$.
The following are equivalent
\begin{enumerate}
\item $K$ is derived complete with respect to $I$, and
\item the canonical map $K \to R\lim (K \otimes_A^\mathbf{L} K_n^\bullet)$
is an isomorphism of $D(A)$.
\end{enumerate}
\end{lemma}

\begin{proof}
If (2) holds, then $K$ is derived complete with respect to $I$
by Lemma \ref{lemma-koszul-derived-completion-complete}.
Conversely, assume that $K$ is derived complete with respect to $I$.
Consider the filtrations
$$
K_n^\bullet \supset
\sigma_{\geq -r + 1}K_n^\bullet \supset
\sigma_{\geq -r + 2}K_n^\bullet \supset \ldots \supset
\sigma_{\geq -1}K_n^\bullet \supset
\sigma_{\geq 0}K_n^\bullet = A
$$
by stupid truncations (Homology, Section \ref{homology-section-truncations}).
Because the construction $R\lim(K \otimes E)$ is exact in
the second variable (Lemma \ref{lemma-tensor-Rlim-exact})
we see that it suffices to show
$$
R\lim \left(
K \otimes_A^\mathbf{L}
(\sigma_{\geq p}K_n^\bullet/ \sigma_{\geq p + 1}K_n^\bullet)
\right) = 0
$$
for $p < 0$. The explicit description of the Koszul complexes above
shows that
$$
R\lim \left(
K \otimes_A^\mathbf{L}
(\sigma_{\geq p}K_n^\bullet/ \sigma_{\geq p + 1}K_n^\bullet)
\right) =
\bigoplus\nolimits_{i_1, \ldots, i_{-p}}
T(K, f_{i_1}\ldots f_{i_{-p}})
$$
which is zero for $p < 0$ by assumption on $K$.
\end{proof}

\begin{lemma}
\label{lemma-derived-completion-koszul}
In Situation \ref{situation-koszul}.
The functor which sends $K \in D(A)$ to the derived limit
$K' = R\lim( K \otimes_A^\mathbf{L} K_n^\bullet )$ is the left
adjoint to the inclusion functor $D_{comp}(A) \to D(A)$
constructed in Lemma \ref{lemma-derived-completion}.
\end{lemma}

\begin{proof}[First proof]
The assignment $K \leadsto K'$ is a functor and $K'$ is derived
complete with respect to $I$ by
Lemma \ref{lemma-koszul-derived-completion-complete}.
By a formal argument (omitted) we see that it suffices
to show $K \to K'$ is an isomorphism if $K$ is derived complete
with respect to $I$. This is
Lemma \ref{lemma-characterize-derived-complete-Koszul}.
\end{proof}

\begin{proof}[Second proof]
Denote $K \mapsto K^\wedge$ the adjoint constructed in
Lemma \ref{lemma-derived-completion}. By that lemma we have
$$
K^\wedge = R\Hom\left((A \to \prod\nolimits_{i_0} A_{f_{i_0}} \to
\prod\nolimits_{i_0 < i_1} A_{f_{i_0}f_{i_1}}
\to \ldots \to A_{f_1\ldots f_r}), K\right)
$$
In Lemma \ref{lemma-extended-alternating-Cech-is-colimit-koszul}
we have seen that the extended alternating {\v C}ech complex
$$
A \to \prod\nolimits_{i_0} A_{f_{i_0}} \to
\prod\nolimits_{i_0 < i_1} A_{f_{i_0}f_{i_1}}
\to \ldots \to A_{f_1\ldots f_r}
$$
is a colimit of the Koszul complexes
$K^n = K(A, f_1^n, \ldots, f_r^n)$ sitting in
degrees $0, \ldots, r$. Note that $K^n$ is a finite chain complex
of finite free $A$-modules with dual (as in
Lemma \ref{lemma-dual-perfect-complex})
$R\Hom_A(K^n, A) = K_n$ where $K_n$ is the Koszul cochain
complex sitting in degrees $-r, \ldots, 0$ (as usual).
Thus it suffices to show that
$$
R\Hom_A(\text{hocolim} K^n, K) =  R\lim (K \otimes_A^\mathbf{L} K_n)
$$
This follows from
Lemma \ref{lemma-colim-and-lim-of-duals}.
\end{proof}

\begin{lemma}
\label{lemma-derived-complete-zero-bis}
\begin{slogan}
Derived Nakayama
\end{slogan}
\begin{reference}
A related result is \cite[Proposition 6.5]{Dwyer-Greenlees}.
The derived Nakayama lemma can for example be found in Bhatt's 3rd lecture
on Prismatic cohomology at Columbia University in Fall 2018
as Section 2 property (2). Leonid Positselski proposed a proof in
\url{https://mathoverflow.net/a/331501}. However, we follow the proof
suggested by Anonymous in the comments.
\end{reference}
Let $I$ be a finitely generated ideal of a ring $A$.
Let $K$ be a derived complete object of $D(A)$.
If $K \otimes_A^\mathbf{L} A/I = 0$, then $K = 0$.
\end{lemma}

\begin{proof}
Choose generators $f_1, \ldots, f_r$ of $I$. Denote $K_n$ the
Koszul complex on $f_1^n, \ldots, f_r^n$ over $A$. Recall that
$K_n$ is bounded and that the cohomology modules of $K_n$ are
annihilated by $f_1^n, \ldots, f_r^n$ and hence by $I^{nr}$.
By Lemma \ref{lemma-derived-vanishing-mod-I}
we see that $K \otimes_A^\mathbf{L} K_n = 0$.
Since $K$ is derived complete by Lemma \ref{lemma-derived-completion-koszul}
we have $K = R\lim K \otimes_A^\mathbf{L} K_n = 0$
as desired.
\end{proof}

\noindent
As an application of the relationship with the Koszul complex
we obtain that derived completion has finite cohomological dimension.

\begin{lemma}
\label{lemma-derived-completion-finite-cohomological-dimension}
Let $A$ be a ring and let $I \subset A$ be an ideal which can be
generated by $r$ elements. Then derived completion has finite
cohomological dimension:
\begin{enumerate}
\item Let $K \to L$ be a morphism in $D(A)$ such that $H^i(K) \to H^i(L)$
is an isomorphism for $i \geq 1$ and surjective for $i = 0$.
Then $H^i(K^\wedge) \to H^i(L^\wedge)$ is an isomorphism for $i \geq 1$
and surjective for $i = 0$.
\item Let $K \to L$ be a morphism of $D(A)$ such that $H^i(K) \to H^i(L)$
is an isomorphism for $i \leq -1$ and injective for $i = 0$.
Then $H^i(K^\wedge) \to H^i(L^\wedge)$ is an isomorphism for $i \leq -r - 1$
and injective for $i = -r$.
\end{enumerate}
\end{lemma}

\begin{proof}
Say $I$ is generated by $f_1, \ldots, f_r$. For any $K \in D(A)$
by Lemma \ref{lemma-derived-completion-koszul} we have
$K^\wedge = R\lim K \otimes_A^\mathbf{L} K_n$ where $K_n$
is the Koszul complex on $f_1^n, \ldots, f_r^n$
and hence we obtain a short exact sequence
$$
0 \to R^1\lim H^{i - 1}(K \otimes_A^\mathbf{L} K_n)
\to H^i(K^\wedge) \to \lim H^i(K \otimes_A^\mathbf{L} K_n) \to 0
$$
by Lemma \ref{lemma-break-long-exact-sequence-modules}.

\medskip\noindent
Proof of (1). Pick a distinguished triangle $K \to L \to C \to K[1]$.
Then $H^i(C) = 0$ for $i \geq 0$. Since $K_n$ is sitting in degrees $\leq 0$
we see that $H^i(C \otimes_A^\mathbf{L} K_n) = 0$ for $i \geq 0$
and that $H^{-1}(C \otimes_A^\mathbf{L} K_n) =
H^{-1}(C) \otimes_A A/(f_1^n, \ldots, f_r^n)$ is a system with
surjective transition maps. The displayed equation above shows
that $H^i(C^\wedge) = 0$ for $i \geq 0$. Applying the distinguished triangle
$K^\wedge \to L^\wedge \to C^\wedge \to K^\wedge[1]$ we get (1).

\medskip\noindent
Proof of (2). Pick a distinguished triangle $K \to L \to C \to K[1]$.
Then $H^i(C) = 0$ for $i < 0$. Since $K_n$ is sitting in degrees
$-r, \ldots, 0$ we see that $H^i(C \otimes_A^\mathbf{L} K_n) = 0$
for $i < -r$. The displayed equation above shows
that $H^i(C^\wedge) = 0$ for $i < r$. Applying the distinguished triangle
$K^\wedge \to L^\wedge \to C^\wedge \to K^\wedge[1]$ we get (2).
\end{proof}

\begin{lemma}
\label{lemma-derived-completion-spectral-sequence}
Let $A$ be a ring and let $I \subset A$ be a finitely generated ideal.
Let $K^\bullet$ be a filtered complex of $A$-modules. There exists a
canonical spectral sequence $(E_r, \text{d}_r)_{r \geq 1}$
of bigraded derived complete $A$-modules with $d_r$ of bidegree
$(r, -r + 1)$ and with
$$
E_1^{p, q} = H^{p + q}((\text{gr}^pK^\bullet)^\wedge)
$$
If the filtration on each $K^n$ is finite, then the spectral sequence is
bounded and converges to $H^*((K^\bullet)^\wedge)$.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-derived-completion} we know that derived completion is
given by $R\Hom_A(C, -)$ for some $C \in D^b(A)$. By
Lemmas \ref{lemma-derived-completion-finite-cohomological-dimension} and
\ref{lemma-projective-amplitude} we see that $C$ has finite projective
dimension. Thus we may choose a bounded complex of projective
modules $P^\bullet$ representing $C$. Then
$$
M^\bullet = \Hom^\bullet(P^\bullet, K^\bullet)
$$
is a complex of $A$-modules representing $(K^\bullet)^\wedge$.
It comes with a filtration given by
$F^pM^\bullet = \Hom^\bullet(P^\bullet, F^pK^\bullet)$.
We see that $F^pM^\bullet$ represents $(F^pK^\bullet)^\wedge$
and hence $\text{gr}^pM^\bullet$ represents $(\text{gr}K^\bullet)^\wedge$.
Thus we find our spectral sequence by taking the spectral sequence of
the filtered complex $M^\bullet$, see
Homology, Section \ref{homology-section-filtered-complex}.
If the filtration on each $K^n$ is finite, then the filtration
on each $M^n$ is finite because $P^\bullet$ is a bounded complex.
Hence the final statement follows from
Homology, Lemma \ref{homology-lemma-biregular-ss-converges}.
\end{proof}

\begin{example}
\label{example-derived-completion-spectral-sequence}
Let $A$ be a ring and let $I \subset A$ be a finitely generated ideal.
Let $K^\bullet$ be a complex of $A$-modules. We can apply
Lemma \ref{lemma-derived-completion-spectral-sequence}
with $F^pK^\bullet = \tau_{\leq -p}K^\bullet$. Then we get a
bounded spectral sequence
$$
E_1^{p, q} = H^{p + q}(H^{-p}(K^\bullet)^\wedge[p]) =
H^{2p + q}(H^{-p}(K^\bullet)^\wedge)
$$
converging to $H^{p + q}((K^\bullet)^\wedge)$. After renumbering
$p = -j$ and $q = i + 2j$ we find that for any $K \in D(A)$
there is a bounded spectral sequence $(E'_r, d'_r)_{r \geq 2}$
of bigraded derived complete modules with
$d'_r$ of bidegree $(r, -r + 1)$, with
$$
(E'_2)^{i, j} = H^i(H^j(K)^\wedge)
$$
and converging to $H^{i + j}(K^\wedge)$.
\end{example}

\begin{lemma}
\label{lemma-restriction-derived-complete}
Let $A \to B$ be a ring map. Let $I \subset A$ be an ideal. The inverse
image of $D_{comp}(A, I)$ under the restriction functor $D(B) \to D(A)$ is
$D_{comp}(B, IB)$.
\end{lemma}

\begin{proof}
Using Lemma \ref{lemma-ideal-of-elements-complete-wrt}
we see that $L \in D(B)$ is in $D_{comp}(B, IB)$
if and only if $T(L, f)$ is zero for every local section
$f \in I$. Observe that the cohomology of
$T(L, f)$ is computed in the category of abelian groups,
so it doesn't matter whether we think of $f$ as an element of $A$
or take the image of $f$ in $B$.
The lemma follows immediately from this and the
definition of derived complete objects.
\end{proof}

\begin{lemma}
\label{lemma-restriction-derived-complete-equivalence}
Let $A \to B$ be a ring map. Let $I \subset A$ be a finitely generated ideal.
If $A \to B$ is flat and $A/I \cong B/IB$, then the restriction functor
$D(B) \to D(A)$ induces an equivalence
$D_{comp}(B, IB) \to D_{comp}(A, I)$.
\end{lemma}

\begin{proof}
Choose generators $f_1, \ldots, f_r$ of $I$.
Denote $\check{\mathcal{C}}^\bullet_A \to \check{\mathcal{C}}^\bullet_B$
the quasi-isomorphism of extended alternating {\v C}ech complexes of
Lemma \ref{lemma-map-identifies-koszul-and-cech-complexes}.
Let $K \in D_{comp}(A, I)$. Let $I^\bullet$ be a K-injective
complex of $A$-modules representing $K$. Since $\Ext^n_A(A_f, K)$
and $\Ext^n_A(B_f, K)$ are zero for all $f \in I$ and
$n \in \mathbf{Z}$ (Lemma \ref{lemma-hom-from-Af}) we conclude that
$\check{\mathcal{C}}^\bullet_A \to A$ and
$\check{\mathcal{C}}^\bullet_B \to B$ induce quasi-isomorphisms
$$
I^\bullet = \Hom_A(A, I^\bullet) \longrightarrow
\text{Tot}(\Hom_A(\check{\mathcal{C}}^\bullet_A, I^\bullet))
$$
and
$$
\Hom_A(B, I^\bullet) \longrightarrow
\text{Tot}(\Hom_A(\check{\mathcal{C}}^\bullet_B, I^\bullet))
$$
Some details omitted.
Since $\check{\mathcal{C}}^\bullet_A \to \check{\mathcal{C}}^\bullet_B$
is a quasi-isomorphism and $I^\bullet$ is K-injective we conclude
that $\Hom_A(B, I^\bullet) \to I^\bullet$ is a quasi-isomorphism.
As the complex $\Hom_A(B, I^\bullet)$ is a complex of $B$-modules
we conclude that $K$ is in the image of the restriction map, i.e.,
the functor is essentially surjective

\medskip\noindent
In fact, the argument shows that
$F : D_{comp}(A, I) \to D_{comp}(B, IB)$, $K \mapsto \Hom_A(B, I^\bullet)$
is a left inverse to restriction. Finally, suppose that
$L \in D_{comp}(B, IB)$. Represent $L$ by a K-injective complex
$J^\bullet$ of $B$-modules.
Then $J^\bullet$ is also K-injective as a complex of $A$-modules
(Lemma \ref{lemma-K-injective-flat}) hence
$F(\text{restriction of }L) = \Hom_A(B, J^\bullet)$.
There is a map $J^\bullet \to \Hom_A(B, J^\bullet)$
of complexes of $B$-modules, whose composition with
$\Hom_A(B, J^\bullet) \to J^\bullet$ is the identity.
We conclude that $F$ is also a right inverse to restriction
and the proof is finished.
\end{proof}







\section{The category of derived complete modules}
\label{section-derived-complete-modules}

\noindent
Let $A$ be a ring and let $I$ be an ideal. Denote
$\mathcal{C}$ the category of derived complete modules, see
Definition \ref{definition-derived-complete}.
In this section we discuss some properties of this
category. In Examples, Section \ref{examples-section-derived-complete-modules}
we show that $\mathcal{C}$ isn't a Grothendieck abelian category in general.

\medskip\noindent
By Lemma \ref{lemma-serre-subcategory}
the category $\mathcal{C}$ is abelian and the inclusion
functor $\mathcal{C} \to \text{Mod}_A$ is exact.

\medskip\noindent
Since $D_{comp}(A) \subset D(A)$ is closed under products
(see discussion following Definition \ref{definition-derived-complete})
and since products in $D(A)$ are computed on the level of complexes,
we see that $\mathcal{C}$ has products which agree with products in
$\text{Mod}_A$. Thus $\mathcal{C}$ in fact has arbitrary limits and
the inclusion functor $\mathcal{C} \to \text{Mod}_A$ commutes with them,
see Categories, Lemma \ref{categories-lemma-limits-products-equalizers}.

\medskip\noindent
Assume $I$ is finitely generated. Let ${}^\wedge : D(A) \to D(A)$ denote
the derived completion functor of Lemma \ref{lemma-derived-completion}.
Let us show the functor
$$
\text{Mod}_A \longrightarrow \mathcal{C},\quad
M \longmapsto H^0(M^\wedge)
$$
is a left adjoint to the inclusion functor $\mathcal{C} \to \text{Mod}_A$.
Note that $H^i(M^\wedge) = 0$ for $i > 0$ for example by
Lemma \ref{lemma-derived-completion-finite-cohomological-dimension}.
Hence, if $N$ is a derived complete $A$-module, then we have
\begin{align*}
\Hom_\mathcal{C}(H^0(M^\wedge), N)
& =
\Hom_{D_{comp}(A)}(M^\wedge, N)\\
& =
\Hom_{D(A)}(M, N) \\
& =
\Hom_A(M, N)
\end{align*}
as desired.

\medskip\noindent
Let $T$ be a preordered set and let $t \mapsto M_t$ be a system of
derived complete $A$-modules, i.e., a system over $T$ in $\mathcal{C}$, see
Categories, Section \ref{categories-section-posets-limits}. Denote
$\colim_{t \in T} M_t$ the colimit of the system in $\text{Mod}_A$.
It follows formally from the above that
$$
H^0((\colim_{t \in T} M_t)^\wedge)
$$
is the colimit of the system in $\mathcal{C}$. In this way we see that
$\mathcal{C}$ has all colimits. In general the inclusion
functor $\mathcal{C} \to \text{Mod}_A$ will not commute with colimits,
see Examples, Section \ref{examples-section-derived-complete-modules}.

\begin{lemma}
\label{lemma-derived-complete-modules}
Let $A$ be a ring and let $I \subset A$ be an ideal. The category $\mathcal{C}$
of derived complete modules is abelian, has arbitrary limits, and the
inclusion functor $F : \mathcal{C} \to \text{Mod}_A$ is exact and commutes
with limits. If $I$ is finitely generated, then $\mathcal{C}$ has arbitrary
colimits and $F$ has a left adjoint
\end{lemma}

\begin{proof}
This summarizes the discussion above.
\end{proof}








\section{Derived completion for a principal ideal}
\label{section-derived-completion-principal}

\noindent
In this section we discuss what happens with derived completion
when the ideal is generated by a single element.

\begin{lemma}
\label{lemma-lift-universally}
Let $A$ be a ring. Let $f \in A$. If there exists an integer $c \geq 1$
such that $A[f^c] = A[f^{c + 1}] = A[f^{c + 2}] = \ldots$ (for example
if $A$ is Noetherian), then for all $n \geq 1$ there exist maps
$$
(A \xrightarrow{f^n} A) \longrightarrow A/(f^n),
\quad\text{and}\quad
A/(f^{n + c}) \longrightarrow (A \xrightarrow{f^n} A)
$$
in $D(A)$ inducing an isomorphism of the pro-objects $\{A/(f^n)\}$ and
$\{(f^n : A \to A)\}$ in $D(A)$.
\end{lemma}

\begin{proof}
The first displayed arrow is obvious. We can define the second arrow of
the lemma by the diagram
$$
\xymatrix{
A/A[f^c] \ar[r]_-{f^{n + c}} \ar[d]_{f^c} & A \ar[d]^1 \\
A \ar[r]^{f^n} & A
}
$$
Since the top horizontal arrow is injective the complex
in the top row is quasi-isomorphic to $A/f^{n + c}A$.
We omit the calculation of compositions needed to show
the statement on pro objects.
\end{proof}

\begin{lemma}
\label{lemma-when-does-it-work}
Let $A$ be a ring and $f \in A$. Set $I = (f)$. In this situation
we have the naive derived completion
$K \mapsto K' = R\lim (K \otimes_A^\mathbf{L} A/f^nA)$ and the
derived completion
$$
K \mapsto K^\wedge = R\lim (K \otimes_A^\mathbf{L} (A \xrightarrow{f^n} A))
$$
of Lemma \ref{lemma-derived-completion-koszul}.
The natural transformation of functors $K^\wedge \to K'$
is an isomorphism if and only if the $f$-power torsion of $A$ is bounded.
\end{lemma}

\begin{proof}
If the $f$-power torsion is bounded, then the pro-objects
$\{(f^n : A \to A)\}$ and $\{A/f^nA\}$ are isomorphic by
Lemma \ref{lemma-lift-universally}.
Hence the functors are isomorphic by Lemma \ref{lemma-Rlim-pro-equal}.
Conversely, we see from Lemma \ref{lemma-tensor-Rlim-exact}
that the condition is exactly that
$$
R\lim (K \otimes_A^\mathbf{L} A[f^n])
$$
is zero for all $K \in D(A)$. Here the maps of the system $(A[f^n])$
are given by multiplication by $f$. Taking $K = A$ and
$K = \bigoplus_{i \in \mathbf{N}} A$ we see from
Lemma \ref{lemma-Rlim-zero-of-direct-sums}
this implies $(A[f^n])$ is zero as a pro-object, i.e.,
$f^{n - 1}A[f^n] = 0$ for some $n$, i.e., $A[f^{n - 1}] = A[f^n]$, i.e.,
the $f$-power torsion is bounded.
\end{proof}

\begin{example}
\label{example-derived-complete-modules}
Let $A$ be a ring. Let $f \in A$ be a nonzerodivisor. An example
to keep in mind is $A = \mathbf{Z}_p$ and $f = p$. Let $M$ be
an $A$-module. Claim: $M$ is derived complete with respect to $f$
if and only if there exists a short exact sequence
$$
0 \to K \to L \to M \to 0
$$
where $K, L$ are $f$-adically complete modules whose $f$-torsion is zero.
Namely, if there is a such a short exact sequence, then
$$
M \otimes_A^\mathbf{L} (A \xrightarrow{f^n} A) = (K/f^nK \to L/f^nL)
$$
because $f$ is a nonzerodivisor on $K$ and $L$
and we conclude that $R\lim (M \otimes_A^\mathbf{L} (A \xrightarrow{f^n} A))$
is quasi-isomorphic to $K \to L$, i.e., $M$. This shows that $M$ is
derived complete by Lemma \ref{lemma-characterize-derived-complete-Koszul}.
Conversely, suppose that $M$ is derived complete. Choose a surjection
$F \to M$ where $F$ is a free $A$-module. Since $f$ is a nonzerodivisor
on $F$ the derived completion of $F$ is $L = \lim F/f^nF$.
Note that $L$ is $f$-torsion free: if $(x_n)$ with $x_n \in F$ represents
an element $\xi$ of $L$ and $f\xi = 0$, then $x_n = x_{n + 1} + f^nz_n$
and $fx_n = f^ny_n$ for some $z_n, y_n \in F$. Then $f^n y_n = fx_n =
fx_{n + 1} + f^{n + 1}z_n = f^{n + 1}y_{n + 1} + f^{n + 1}z_n$ and since
$f$ is a nonzerodivisor on $F$ we see that $y_n \in fF$ which implies
that $x_n \in f^nF$, i.e., $\xi = 0$. Since $L$ is the derived
completion, the universal property gives a map $L \to M$ factoring
$F \to M$. Let $K = \Ker(L \to M)$ be the kernel.
Again $K$ is $f$-torsion free, hence the derived completion of
$K$ is $\lim K/f^nK$. On the other hand, both $M$ and $L$ are derived
complete, hence $K$ is too by Lemma \ref{lemma-serre-subcategory}.
It follows that $K = \lim K/f^nK$ and the claim is proved.
\end{example}

\begin{example}
\label{example-derived-complete-not-complete}
Let $p$ be a prime number. Consider the map
$\mathbf{Z}_p[x] \to \mathbf{Z}_p[y]$
of polynomial algebras sending $x$ to $py$.
Consider the cokernel
$M = \Coker(\mathbf{Z}_p[x]^\wedge \to \mathbf{Z}_p[y]^\wedge)$
of the induced map on (ordinary) $p$-adic completions.
Then $M$ is a derived complete $\mathbf{Z}_p$-module by
Proposition \ref{proposition-derived-complete-modules} and
Lemma \ref{lemma-serre-subcategory}; see also
discussion in Example \ref{example-derived-complete-modules}.
However, $M$ is not $p$-adically complete as
$1 + py + p^2 y^2 + \ldots$ maps to a nonzero element
of $M$ which is contained in $\bigcap p^nM$.
\end{example}

\begin{example}
\label{example-spectral-sequence-principal}
Let $A$ be a ring and let $f \in A$. Denote $K \mapsto K^\wedge$ the
derived completion with respect to $(f)$. Let $M$ be an $A$-module.
Using that
$$
M^\wedge = R\lim (M \xrightarrow{f^n} M)
$$
by Lemma \ref{lemma-derived-completion-koszul}
and using Lemma \ref{lemma-break-long-exact-sequence-modules} we obtain
$$
H^{-1}(M^\wedge) = \lim M[f^n] = T_f(M)
$$
the {\it $f$-adic Tate module of $M$}. Here the maps $M[f^n] \to M[f^{n - 1}]$
are given by multiplication by $f$. Then there is a short exact sequence
$$
0 \to R^1\lim M[f^n] \to H^0(M^\wedge) \to \lim M/f^n M \to 0
$$
describing $H^0(M^\wedge)$. We have $H^1(M^\wedge) = R^1\lim M/f^nM = 0$
as the transition maps are surjective (Lemma \ref{lemma-compute-Rlim-modules}).
All the other cohomologies of $M^\wedge$ are zero for trivial reasons.
Finally, for $K \in D(A)$ and $p \in \mathbf{Z}$ there is a short exact
sequence
$$
0 \to H^0(H^p(K)^\wedge) \to H^p(K^\wedge) \to T_f(H^{p + 1}(K)) \to 0
$$
This follows from the spectral sequence of
Example \ref{example-derived-completion-spectral-sequence}
because it degenerates at $E_2$ (as only $i = -1, 0$ give nonzero terms);
the next lemma gives more information.
\end{example}

\begin{lemma}
\label{lemma-compare-completion-derived-completion}
Let $A$ be a ring and let $f \in A$. Let $K$ be an object of $D(A)$.
Denote $K_n = K \otimes_A^\mathbf{L} (A \xrightarrow{f^n} A)$.
For all $p \in \mathbf{Z}$ there is a commutative diagram
$$
\xymatrix{
& 0 & 0 \\
0 \ar[r] &
\widehat{H^p(K)} \ar[r] \ar[u] &
\lim H^p(K_n) \ar[r] \ar[u] &
T_f(H^{p + 1}(K)) \ar[r] &
0 \\
0 \ar[r] &
H^0(H^p(K)^\wedge) \ar[r] \ar[u] &
H^p(K^\wedge) \ar[r] \ar[u] &
T_f(H^{p + 1}(K)) \ar[r] \ar@{=}[u] &
0 \\
&
R^1\lim H^p(K)[f^n] \ar[u] \ar[r]^\cong &
R^1\lim H^{p - 1}(K_n) \ar[u] \\
& 0 \ar[u] & 0 \ar[u]
}
$$
with exact rows and columns where $\widehat{H^p(K)} = \lim H^p(K)/f^nH^p(K)$
is the usual $f$-adic completion. The left vertical short exact sequence
and the middle horizontal short exact sequence are taken from
Example \ref{example-spectral-sequence-principal}
The middle vertical short exact sequence is the one from
Lemma \ref{lemma-break-long-exact-sequence-modules}.
\end{lemma}

\begin{proof}
To construct the top horizontal short exact sequence, observe that
we have the following inverse system short exact sequences
$$
0 \to H^p(K)/f^nH^p(K) \to H^p(K_n) \to H^{p + 1}(K)[f^n] \to 0
$$
coming from the construction of $K_n$ as a shift of the
cone on $f^n : K \to K$. Taking the inverse limit of these
we obtain the top horizontal short exact sequence, see
Homology, Lemma \ref{homology-lemma-Mittag-Leffler}.

\medskip\noindent
Let us prove that we have a commutative diagram as in the lemma.
We consider the map $L = \tau_{\leq p}K \to K$.
Setting $L_n = L \otimes_A^\mathbf{L} (A \xrightarrow{f^n} A)$
we obtain a map $(L_n) \to (K_n)$ of inverse systems which
induces a map of short exact sequences
$$
\xymatrix{
0 & 0 \\
\lim H^p(L_n) \ar[r] \ar[u] &
\lim H^p(K_n) \ar[u] \\
H^p(L^\wedge) \ar[r] \ar[u] &
H^p(K^\wedge) \ar[u] \\
R^1\lim H^{p - 1}(L_n) \ar[r] \ar[u] &
R^1\lim H^{p - 1}(K_n) \ar[u] \\
0 \ar[u] & 0 \ar[u]
}
$$
Since $H^i(L) = 0$ for $i > p$ and $H^p(L) = H^p(K)$,
a computation using the references in the statement of the lemma
shows that $H^p(L^\wedge) = H^0(H^p(K)^\wedge)$
and that $H^p(L_n) = H^p(K)/f^nH^p(K)$. On the other hand,
we have $H^{p - 1}(L_n) = H^{p - 1}(K_n)$ and hence we see that
we get the isomorphism as indicated in the statement of the lemma
since we already know the kernel of
$H^0(H^p(K)^\wedge) \to \widehat{H^p(K)}$ is equal
to $R^1\lim H^p(K)[f^n]$. We omit the verification
that the rightmost square in the diagram commutes if we
define the top row by the construction in the first paragraph
of the proof.
\end{proof}

\begin{remark}
\label{remark-ML-condition}
With notation as in Lemma \ref{lemma-compare-completion-derived-completion}
we also see that the inverse system $H^p(K_n)$ has ML if and only if
the inverse system $H^{p + 1}(K)[f^n]$ has ML. This follows from the inverse
system of short exact sequences
$0 \to H^p(K)/f^nH^p(K) \to H^p(K_n) \to H^{p + 1}(K)[f^n] \to 0$
(see proof of the lemma) combined with
Homology, Lemma \ref{homology-lemma-Mittag-Leffler} and
Lemma \ref{lemma-Mittag-Leffler}.
\end{remark}

\begin{lemma}[Bhatt]
\label{lemma-torsion-and-derived-complete}
Let $I$ be a finitely generated ideal in a ring $A$.
Let $M$ be a derived complete $A$-module. If $M$ is
an $I$-power torsion module, then $I^nM = 0$ for some $n$.
\end{lemma}

\begin{proof}
Say $I = (f_1, \ldots, f_r)$. It suffices to show
that for each $i$ there is an $n_i$ such that $f_i^{n_i}M = 0$.
Hence we may assume that $I = (f)$ is a principal ideal.
Let $B = \mathbf{Z}[x] \to A$ be the ring map sending $x$ to $f$.
By Lemma \ref{lemma-restriction-derived-complete}
we see that $M$ is derived complete as a $B$-module
with respect to the ideal $(x)$. After replacing $A$ by
$B$, we may assume that $f$ is a nonzerodivisor in $A$.

\medskip\noindent
Assume $I = (f)$ with $f \in A$ a nonzerodivisor.
According to Example \ref{example-derived-complete-modules}
there exists a short exact sequence
$$
0 \to K \xrightarrow{u} L \to M \to 0
$$
where $K$ and $L$ are $I$-adically complete $A$-modules
whose $f$-torsion is zero\footnote{For the proof it is enough
to show that there exists a sequence $K \xrightarrow{u} L \to M \to 0$
where $K$ and $L$ are $I$-adically complete $A$-modules. This can
be shown by choosing a presentation $F_1 \to F_0 \to M \to 0$
with $F_i$ free and then setting $K$ and $L$ equal to the
$f$-adic completions of $F_1$ and $F_0$. Namely, as $f$
is a nonzerodivisor these completions will be the
derived completions and the sequence will remain exact.}.
Consider $K$ and $L$ as
topological modules with the $I$-adic topology. Then $u$ is continuous.
Let
$$
L_n = \{x \in L \mid f^n x \in u(K)\}
$$
Since $M$ is $f$-power torsion we see that
$L = \bigcup L_n$. Let $N_n$ be the closure of $L_n$ in $L$.
By Lemma \ref{lemma-consequence-baire-complete-module}
we see that $N_n$ is open in $L$ for some $n$. Fix such an $n$.
Since $f^{n + m} : L \to L$ is a continuous open map, and since
$f^{n + m} L_n \subset u(f^m K)$ we conclude that
the closure of $u(f^mK)$ is open for all $m \geq 1$.
Thus by Lemma \ref{lemma-open-mapping}
we conclude that $u$ is open. Hence $f^tL \subset \Im(u)$
for some $t$ and we conclude that $f^t$ annihilates $M$
as desired.
\end{proof}

\begin{lemma}
\label{lemma-kernel-to-completion-square-zero}
Let $f \in A$ be an element of a ring. Set $J = \bigcap f^nA$.
Let $M$ be an $A$-module derived complete with respect to $f$.
Then $JM' = 0$ where $M' = \Ker(M \to \lim M/f^nM)$. In particular,
if $A$ is derived complete then $J$ is an ideal of square zero.
\end{lemma}

\begin{proof}
Take $x \in M'$ and $g \in J$. For every $n \geq 1$ we may write
$x = f^n x_n$. Since $g$ is in $f^nA$ we see that the element
$y_n = gx_n$ in $M'$ is independent of the choice of $x_n$.
In particular, we may take $x_n = fx_{n + 1}$ and we find that
$y_n = fy_{n + 1}$. Thus we obtain a map $A_f \to M$ sending
$1/f^n$ to $y_n$. This map has to be zero as $M$ is derived complete
(Lemma \ref{lemma-hom-from-Af})
and hence $y_n = 0$ for all $n$. Since $gx = gfx_1 = fy_1$
this completes the proof.
\end{proof}

\begin{lemma}
\label{lemma-derived-complete-henselian}
Let $A$ be a ring derived complete with respect to an ideal $I$.
Then $(A, I)$ is a henselian pair.
\end{lemma}

\begin{proof}
Let $f \in I$. By Lemma \ref{lemma-largest-ideal-henselian}
it suffices to show that $(A, fA)$ is a henselian pair.
Observe that $A$ is derived complete with respect to $fA$
(follows immediately from Definition \ref{definition-derived-complete}).
By Lemma \ref{lemma-complete-derived-complete} the map from
$A$ to the $f$-adic completion $A'$ of $A$ is surjective.
By Lemma \ref{lemma-complete-henselian} the pair $(A', fA')$
is henselian. Thus it suffices to show that $(A, \bigcap f^nA)$
is a henselian pair, see Lemma \ref{lemma-henselian-henselian-pair}.
This follows from Lemmas \ref{lemma-kernel-to-completion-square-zero}
and \ref{lemma-locally-nilpotent-henselian}.
\end{proof}

\begin{lemma}
\label{lemma-kernel-to-completion-nilpotent}
Let $A$ be a ring derived complete with respect to an ideal $I$.
Set $J = \bigcap I^n$. If $I$ can be generated by $r$ elements
then $J^N = 0$ where $N = 2^r$.
\end{lemma}

\begin{proof}
When $r = 1$ this is Lemma \ref{lemma-kernel-to-completion-square-zero}.
Say $I = (f_1, \ldots, f_r)$ with $r > 1$.
By Lemma \ref{lemma-serre-subcategory}
the ring $A_t = A/f_r^tA$ is derived complete with
respect to $I$ and hence a fortiori derived complete with respect to
$I_t = (f_1, \ldots, f_{r - 1})A_t$. Observe that $A \to A_t$ sends $J$
into $J_t = \bigcap I_t^n$. By induction $J_t^{N/2} = 0$ with
$N = 2^r$. The ideal $\bigcap \Ker(A \to A_t) = \bigcap f_r^t A$
has square zero by the case $r = 1$. This finishes the proof.
\end{proof}

\begin{lemma}
\label{lemma-reduced-derived-complete-complete}
Let $A$ be a reduced ring derived complete with respect to
a finitely generated ideal $I$. Then $A$ is $I$-adically complete.
\end{lemma}

\begin{proof}
Follows from Lemma \ref{lemma-kernel-to-completion-nilpotent} and
Proposition \ref{proposition-derived-complete-modules}.
\end{proof}







\section{Derived completion for Noetherian rings}
\label{section-derived-completion-noetherian}

\noindent
Let $A$ be a ring and let $I \subset A$ be an ideal. For any
$K \in D(A)$ we can consider the derived limit
$$
K' = R\lim (K \otimes_A^\mathbf{L} A/I^n)
$$
This is a functor in $K$, see
Remark \ref{remark-constructing-tensor-with-limits-functorially}.
The system of maps $A \to A/I^n$ induces a map $K \to K'$
and $K'$ is derived complete with respect to $I$
(Lemma \ref{lemma-naive-derived-completion}).
This ``naive'' derived completion construction does not agree
with the adjoint of Lemma \ref{lemma-derived-completion} in general.
For example, if $A = \mathbf{Z}_p \oplus \mathbf{Q}_p/\mathbf{Z}_p$
with the second summand an ideal of square zero, $K = A[0]$, and $I = (p)$,
then the naive derived completion gives $\mathbf{Z}_p[0]$, but the
construction of Lemma \ref{lemma-derived-completion} gives
$K^\wedge \cong \mathbf{Z}_p[1] \oplus \mathbf{Z}_p[0]$ (computation omitted).
Lemma \ref{lemma-when-does-it-work} characterizes when the two
functors agree in the case $I$ is generated by a single element.

\medskip\noindent
The main goal of this section is the show that the naive
derived completion is equal to derived completion if $A$
is Noetherian.

\begin{lemma}
\label{lemma-sequence-Koszul-complexes}
In Situation \ref{situation-koszul}. If $A$ is Noetherian, then the pro-objects
$\{K_n^\bullet\}$ and $\{A/(f_1^n, \ldots, f_r^n)\}$ of $D(A)$ are
isomorphic\footnote{In particular, for every $n$ there exists an $m \geq n$
such that $K_m^\bullet \to K_n^\bullet$ factors through the map
$K_m^\bullet \to A/(f_1^m, \ldots, f_r^m)$.}.
\end{lemma}

\begin{proof}
We have an inverse system of distinguished triangles
$$
\tau_{\leq -1}K_n^\bullet \to K_n^\bullet \to A/(f_1^m, \ldots, f_r^m) \to
(\tau_{\leq -1}K_n^\bullet)[1]
$$
See Derived Categories, Remark
\ref{derived-remark-truncation-distinguished-triangle}.
By Derived Categories, Lemma \ref{derived-lemma-pro-isomorphism}
it suffices to show that the inverse system
$\tau_{\leq -1}K_n^\bullet$ is pro-zero.
Recall that $K_n^\bullet$ has nonzero terms only in degrees
$i$ with $-r \leq i \leq 0$. Thus by
Derived Categories, Lemma \ref{derived-lemma-essentially-constant-cohomology}
it suffices to show that $H^p(K_n^\bullet)$ is pro-zero
for $p \leq -1$.
In other words, for every $n \in \mathbf{N}$ we have to show
there exists an $m \geq n$ such that $H^p(K_m^\bullet) \to H^p(K_n^\bullet)$
is zero. Since $A$ is Noetherian, we see that
$$
H^p(K_n^\bullet) =
\frac{\Ker(K_n^p \to K_n^{p + 1})}{\Im(K_n^{p - 1} \to K_n^p)}
$$
is a finite $A$-module. Moreover, the map $K_m^p \to K_n^p$ is given
by a diagonal matrix whose entries are in the ideal
$(f_1^{m - n}, \ldots, f_r^{m - n})$ as $p < 0$.
Note that $H^p(K_n^\bullet)$ is annihilated by
$J = (f_1^n, \ldots, f_r^n)$, see Lemma \ref{lemma-homotopy-koszul}. Now
$(f_1^{m - n}, \ldots, f_r^{m - n}) \subset J^t$ for $m - n \geq tn$.
Thus by Algebra, Lemma \ref{algebra-lemma-Artin-Rees} (Artin-Rees) applied
to the ideal $J$ and the module $M = K_n^p$ with submodule
$N = \Ker(K_n^p \to K_n^{p + 1})$ for $m$ large enough
the image of $K_m^p \to K_n^p$ intersected with
$\Ker(K_n^p \to K_n^{p + 1})$ is contained in
$J \Ker(K_n^p \to K_n^{p + 1})$. For such $m$ we get the zero map.
\end{proof}

\begin{proposition}
\label{proposition-noetherian-naive-completion-is-completion}
Let $A$ be a Noetherian ring. Let $I \subset A$ be an ideal.
The functor which sends $K \in D(A)$ to the derived limit
$K' = R\lim( K \otimes_A^\mathbf{L} A/I^n )$ is the left
adjoint to the inclusion functor $D_{comp}(A) \to D(A)$
constructed in Lemma \ref{lemma-derived-completion}.
\end{proposition}

\begin{proof}
Say $(f_1, \ldots, f_r) = I$ and let $K_n^\bullet$ be the Koszul complex
with respect to $f_1^n, \ldots, f_r^n$. By
Lemma \ref{lemma-derived-completion-koszul}
it suffices to prove that
$$
R\lim (K \otimes_A^\mathbf{L} K_n^\bullet) =
R\lim (K \otimes_A^\mathbf{L} A/(f_1^n, \ldots, f_r^n) ) =
R\lim (K \otimes_A^\mathbf{L} A/I^n ).
$$
By Lemma \ref{lemma-sequence-Koszul-complexes} the pro-objects
$\{K_n^\bullet\}$ and $\{A/(f_1^n, \ldots, f_r^n)\}$ of $D(A)$ are
isomorphic. It is clear that the pro-objects
$\{A/(f_1^n, \ldots, f_r^n)\}$ and $\{A/I^n\}$ are isomorphic.
Thus the map from left to right is an isomorphism by
Lemma \ref{lemma-tensor-Rlim-pro-equal}.
\end{proof}

\begin{lemma}
\label{lemma-noetherian-calculate}
Let $I$ be an ideal of a Noetherian ring $A$. Let $M$ be an $A$-module
with derived completion $M^\wedge$. Then there are short exact sequences
$$
0 \to R^1\lim \text{Tor}_{i + 1}^A(M, A/I^n) \to
H^{-i}(M^\wedge) \to \lim \text{Tor}_i^A(M, A/I^n) \to 0
$$
A similar result holds for $M \in D^-(A)$.
\end{lemma}

\begin{proof}
Immediate consequence of
Proposition \ref{proposition-noetherian-naive-completion-is-completion}
and Lemma \ref{lemma-break-long-exact-sequence-modules}.
\end{proof}

\noindent
As an application of the proposition above we identify the derived
completion in the Noetherian case for pseudo-coherent complexes.

\begin{lemma}
\label{lemma-derived-completion-pseudo-coherent}
Let $A$ be a Noetherian ring and $I \subset A$ an ideal. Let $K$ be an
object of $D(A)$ such that $H^n(K)$ a finite $A$-module for all
$n \in \mathbf{Z}$. Then the cohomology modules $H^n(K^\wedge)$ of
the derived completion are the $I$-adic
completions of the cohomology modules $H^n(K)$.
\end{lemma}

\begin{proof}
The complex $\tau_{\leq m}K$ is pseudo-coherent for all $m$
by Lemma \ref{lemma-Noetherian-pseudo-coherent}.
Thus $\tau_{\leq m}K$ is represented by a bounded above complex
$P^\bullet$ of finite free $A$-modules. Then
$\tau_{\leq m}K \otimes_A^\mathbf{L} A/I^n = P^\bullet/I^nP^\bullet$.
Hence $(\tau_{\leq m}K)^\wedge = R\lim P^\bullet/I^nP^\bullet$
(Proposition \ref{proposition-noetherian-naive-completion-is-completion})
and since the $R\lim$ is just given by termwise $\lim$
(Lemma \ref{lemma-compute-Rlim-modules}) and since
$I$-adic completion is an exact functor on finite $A$-modules
(Algebra, Lemma \ref{algebra-lemma-completion-flat}) we conclude
the result holds for $\tau_{\leq m}K$. Hence the result holds for
$K$ as derived completion has finite cohomological dimension, see
Lemma \ref{lemma-derived-completion-finite-cohomological-dimension}.
\end{proof}

\begin{lemma}
\label{lemma-derived-complete-finite}
Let $I$ be an ideal of a Noetherian ring $A$.
Let $M$ be a derived complete $A$-module.
If $M/IM$ is a finite $A/I$-module, then
$M = \lim M/I^nM$ and $M$ is a finite $A^\wedge$-module.
\end{lemma}

\begin{proof}
Assume $M/IM$ is finite. Pick $x_1, \ldots, x_t \in M$ which map to
generators of $M/IM$. We obtain a map $A^{\oplus t} \to M$ mapping
the $i$th basis vector to $x_i$. By
Proposition \ref{proposition-noetherian-naive-completion-is-completion}
the derived completion
of $A$ is $A^\wedge = \lim A/I^n$. As $M$ is derived complete, we
see that our map factors through a map $q : (A^\wedge)^{\oplus t} \to M$.
The module $\Coker(q)$ is zero by
Lemma \ref{lemma-derived-complete-zero}.
Thus $M$ is a finite $A^\wedge$-module.
Since $A^\wedge$ is Noetherian and complete with respect to $IA^\wedge$,
it follows that $M$ is $I$-adically complete (use
Algebra, Lemmas \ref{algebra-lemma-completion-Noetherian},
\ref{algebra-lemma-when-finite-module-complete-over-complete-ring}, and
\ref{algebra-lemma-Artin-Rees}).
\end{proof}

\begin{lemma}
\label{lemma-when-derived-completion-is-completion}
Let $I$ be an ideal in a Noetherian ring $A$.
\begin{enumerate}
\item If $M$ is a finite $A$-module and $N$ is a flat $A$-module, then the
derived $I$-adic completion of $M \otimes_A N$ is the usual
$I$-adic completion of $M \otimes_A N$.
\item If $M$ is a finite $A$-module and $f \in A$, then the derived
$I$-adic completion of $M_f$ is the usual $I$-adic completion
of $M_f$.
\end{enumerate}
\end{lemma}

\begin{proof}
For an $A$-module $M$ denote $M^\wedge$ the derived completion
and $\lim M/I^nM$ the usual completion.
Assume $M$ is finite. The system $\text{Tor}^A_i(M, A/I^n)$
is pro-zero for $i > 0$, see
Lemma \ref{lemma-tor-strictly-pro-zero}.
Since $\text{Tor}_i^A(M \otimes_A N, A/I^n) =
\text{Tor}_i^A(M, A/I^n) \otimes_A N$ as $N$ is flat, the
same is true for the system $\text{Tor}^A_i(M \otimes_A N, A/I^n)$.
By Lemma \ref{lemma-noetherian-calculate}
we conclude $R\lim (M \otimes_A N) \otimes_A^\mathbf{L} A/I^n$
only has cohomology in degree $0$ given by the usual completion
$\lim M \otimes_A N/ I^n(M \otimes_A N)$. This proves (1).
Part (2) follows from (1) and the fact that $M_f = M \otimes_A A_f$.
\end{proof}

\begin{lemma}
\label{lemma-derived-completion-tensor-finite}
Let $I$ be an ideal in a Noetherian ring $A$.
Let ${}^\wedge$ denote derived completion with respect to $I$.
Let $K \in D^-(A)$.
\begin{enumerate}
\item If $M$ is a finite $A$-module, then
$(K \otimes_A^\mathbf{L} M)^\wedge = K^\wedge \otimes_A^\mathbf{L} M$.
\item If $L \in D(A)$ is pseudo-coherent, then
$(K \otimes_A^\mathbf{L} L)^\wedge = K^\wedge \otimes_A^\mathbf{L} L$.
\end{enumerate}
\end{lemma}

\begin{proof}
Let $L$ be as in (2).
We may represent $K$ by a bounded above complex $P^\bullet$
of free $A$-modules. We may represent $L$ by a bounded above complex
$F^\bullet$ of finite free $A$-modules.
Since $\text{Tot}(P^\bullet \otimes_A F^\bullet)$
represents $K \otimes_A^\mathbf{L} L$ we see that
$(K \otimes_A^\mathbf{L} L)^\wedge$ is represented by
$$
\text{Tot}((P^\bullet)^\wedge \otimes_A F^\bullet)
$$
where $(P^\bullet)^\wedge$ is the complex whose terms are
the usual $=$ derived completions $(P^n)^\wedge$, see for example
Proposition \ref{proposition-noetherian-naive-completion-is-completion}
and Lemma \ref{lemma-when-derived-completion-is-completion}.
This proves (2). Part (1) is a special case of (2).
\end{proof}








\section{An operator introduced by Berthelot and Ogus}
\label{section-eta}

\noindent
In this section we discuss a construction introduced in
\cite[Section 8]{Berthelot-Ogus} and generalized in \cite[Section 6]{BMS}.
We urge the reader to look at the original papers discussing this notion.

\medskip\noindent
Let $A$ be a ring and let $f \in A$ be a nonzerodivisor. If $M$ is a
$A$-module then by Lemma \ref{lemma-torsion-free} following are equivalent
\begin{enumerate}
\item $f$ is a nonzerodivisor on $M$,
\item $M[f] = 0$,
\item $M[f^n] = 0$ for all $n \geq 1$, and
\item the map $M \to M_f$ is injective.
\end{enumerate}
If these equivalent conditions hold, then (in this section) we will
say {\it $M$ is $f$-torsion free}. If so, then we denote
$f^iM \subset M_f$ the submodule consisting of elements of the
form $f^ix$ with $x \in M$. Of course $f^iM$ is isomorphic to $M$
as an $A$-module. Let $M^\bullet$ be a complex of $f$-torsion free
$A$-modules with differentials $d^i : M^i \to M^{i + 1}$. In this case
we define $\eta_fM^\bullet$ to be the complex with terms
$$
(\eta_fM)^i = \{x \in f^iM^i \mid d^i(x) \in f^{i + 1}M^{i + 1}\}
$$
and differential induced by $d^i$. Observe that $\eta_fM^\bullet$
is another complex of $f$-torsion free $A$-modules.
If $a^\bullet : M^\bullet \to N^\bullet$ is a map of complexes
of $f$-torsion free $A$-modules, then we obtain a map of complexes
$$
\eta_fa^\bullet : \eta_fM^\bullet \longrightarrow \eta_fN^\bullet
$$
induced by the maps $f^iM^i \to f^iN^i$. The reader checks that we obtain
an endo-functor on the category of complexes of $f$-torsion free $A$-modules.
If $a^\bullet, b^\bullet : M^\bullet \to N^\bullet$ are two maps of
complexes of $f$-torsion free $A$-modules
and $h = \{h^i : M^i \to N^{i - 1}\}$ is a homotopy
between $a^\bullet$ and $b^\bullet$, then we define
$\eta_fh$ to be the family of maps
$(\eta_fh)^i : (\eta_fM)^i \to (\eta_fN)^{i - 1}$
which sends $x$ to $h^i(x)$; this makes sense as $x \in f^iM^i$
implies $h^i(x) \in f^iN^{i - 1}$ which is certainly contained in
$(\eta_fN)^{i - 1}$. The reader checks that $\eta_fh$ is a homotopy
between $\eta_fa^\bullet$ and $\eta_fb^\bullet$. All in all we see
that we obtain a functor
$$
\eta_f :
K(f\text{-torsion free }A\text{-modules})
\longrightarrow
K(f\text{-torsion free }A\text{-modules})
$$
on the homotopy category
(Derived Categories, Section \ref{derived-section-homotopy})
of the additive category of $f$-torsion free $A$-modules.
There is no sense in which $\eta_f$ is an exact functor of
triangulated categories, see
Example \ref{example-eta-not-distinguished}.

\begin{example}
\label{example-eta-not-distinguished}
Let $A$ be a ring. Let $f \in A$ be a nonzerodivisor.
Consider the functor $\eta_f : K(f\text{-torsion free }A\text{-modules})
\to K(f\text{-torsion free }A\text{-modules})$.
Let $M^\bullet$ be a complex of $f$-torsion free $A$-modules.
Multiplication by $f$ defines an isomorphism
$\eta_f(M^\bullet[1]) \to (\eta_fM^\bullet)[1]$, so in this
sense $\eta_f$ is compatible with shifts.
However, consider the diagram
$$
\xymatrix{
A \ar[r]_f &
A \ar[r]_1 &
A \ar[r] &
0 \\
0 \ar[r] \ar[u] &
0 \ar[r] \ar[u] &
A \ar[r]^{-1} \ar[u]^f &
A \ar[u]
}
$$
Think of each column as a complex of $f$-torsion free $A$-modules
with the module on top in degree $1$ and the module under it in degree $0$.
Then this diagram provides us with a distinguished triangle in
$K(f\text{-torsion free }A\text{-modules})$
with triangulated structure as given in
Derived Categories, Section \ref{derived-section-homotopy-triangulated}.
Namely the third complex is the cone of the map between the
first two complexes.
However, applying $\eta_f$ to each column we obtain
$$
\xymatrix{
fA \ar[r]_f &
fA \ar[r]_1 &
fA \ar[r] &
0 \\
0 \ar[r] \ar[u] &
0 \ar[r] \ar[u] &
A \ar[r]^{-1} \ar[u]^f &
A \ar[u]
}
$$
However, the third complex is acyclic and even homotopic to zero.
Hence if this were a distinguished triangle, then the first arrow
would have to be an isomorphism in the homotopy category, which
is not true unless $f$ is a unit.
\end{example}

\begin{lemma}
\label{lemma-eta-first-property}
Let $A$ be a ring and let $f \in A$ be a nonzerodivisor. Let $M^\bullet$ be
a complex of $f$-torsion free $A$-modules. There is a canonical isomorphism
$$
f^i : H^i(M^\bullet)/H^i(M^\bullet)[f] \longrightarrow H^i(\eta_fM^\bullet)
$$
given by multiplication by $f^i$.
\end{lemma}

\begin{proof}
Observe that $\Ker(d^i : (\eta_fM)^i \to (\eta_fM)^{i + 1})$
is equal to
$\Ker(d^i : f^iM^i \to f^iM^{i + 1}) = f^i\Ker(d^i : M^i \to M^{i + 1})$.
This we get a surjection
$f^i : H^i(M^\bullet) \to H^i(\eta_fM^\bullet)$
by sending the class of $z \in \Ker(d^i : M^i \to M^{i + 1})$
to the class of $f^iz$. If we obtain the zero class in
$H^i(\eta_fM^\bullet)$ then we see that $f^i z = d^{i - 1}(f^{i - 1}y)$
for some $y \in M^{i - 1}$. Since $f$ is a nonzerodivisor on all
the modules involved, this means $f z = d^{i - 1}(y)$ which
exactly means that the class of $z$ is $f$-torsion as desired.
\end{proof}

\begin{lemma}
\label{lemma-eta-qis}
Let $A$ be a ring and let $f \in A$ be a nonzerodivisor.
If $M^\bullet \to N^\bullet$ is a quasi-isomorphism of complexes of
$f$-torsion free $A$-modules,
then the induced map $\eta_fM^\bullet \to \eta_fN^\bullet$
is a quasi-isomorphism too.
\end{lemma}

\begin{proof}
This is true because the isomorphisms of Lemma \ref{lemma-eta-first-property}
are compatible with maps of complexes.
\end{proof}

\begin{lemma}
\label{lemma-Leta}
Let $A$ be a ring and let $f \in A$ be a nonzerodivisor. There is an additive
functor\footnote{Beware that this functor isn't exact, i.e.,
does not transform distinguished triangles into distinguished triangles.
See Example \ref{example-eta-not-distinguished}.}
$L\eta_f : D(A) \to D(A)$ such that if $M \in D(A)$ is
represented by a complex $M^\bullet$ of $f$-torsion free $A$-modules,
then $L\eta_fM = \eta_fM^\bullet$ and similarly for morphisms.
\end{lemma}

\begin{proof}
Denote $\mathcal{T} \subset \text{Mod}_A$ the full subcategory
of $f$-torsion free $A$-modules. We have a corresponding inclusion
$$
K(\mathcal{T}) \quad\subset\quad K(\text{Mod}_A) = K(A)
$$
of $K(\mathcal{T})$ as a full triangulated subcategory of $K(A)$.
Let $S \subset \text{Arrows}(K(\mathcal{T}))$ be the quasi-isomorphisms.
We will apply
Derived Categories, Lemma \ref{derived-lemma-localization-subcategory}
to show that the map
$$
S^{-1}K(\mathcal{T}) \longrightarrow D(A)
$$
is an equivalence of triangulated categories. The lemma shows that
it suffices to prove: given a complex $M^\bullet$ of $A$-modules,
there exists a quasi-isomorphism $K^\bullet \to M^\bullet$ with $K^\bullet$
a complex of $f$-torsion free modules.
By Lemma \ref{lemma-K-flat-resolution} we can find a quasi-isomorphism
$K^\bullet \to M^\bullet$ such that the complex $K^\bullet$
is K-flat (we won't use this) and consists of flat $A$-modules $K^i$.
In particular, $f$ is a nonzerodivisor on $K^i$ for all $i$ as desired.

\medskip\noindent
With these preliminaries out of the way we can define $L\eta_f$.
Namely, by the discussion at the start of this section
we have already a well defined functor
$$
K(\mathcal{T}) \xrightarrow{\eta_f} K(\mathcal{T}) \to K(A) \to D(A)
$$
which according to Lemma \ref{lemma-eta-qis} sends quasi-isomorphisms
to quasi-isomorphisms. Hence this functor factors over
$S^{-1}K(\mathcal{T}) = D(A)$ by 
Categories, Lemma \ref{categories-lemma-properties-left-localization}.
\end{proof}

\begin{remark}
\label{remark-eta-BZ}
Let $A$ be a ring and let $f \in A$ be a nonzerodivisor. Let $M^\bullet$ be
a complex of $f$-torsion free $A$-modules.
For every $i$ set $\overline{M}^i = M^i/fM^i$. Denote
$B^i \subset Z^i \subset \overline{M}^i$ the boundaries and
cocycles for the differentials on the complex
$\overline{M}^\bullet = M^\bullet \otimes_A A/fA$.
We claim that there exists a commutative diagram
$$
\xymatrix{
0 \ar[r] &
B^{i + 1} \ar[r] \ar@{=}[d] &
B^{i + 1} \oplus B^i \ar[r] \ar[d]^{s, s'} &
B^i \ar[r] \ar[d] & 0 \\
0 \ar[r] &
B^{i + 1} \ar[r]^-s &
(\eta_fM)^i /f(\eta_fM)^i \ar[r]^-t &
Z^i \ar[r] & 0
}
$$
with exact rows. Here are the constructions of the maps
\begin{enumerate}
\item If $x \in (\eta_fM)^i$ then $x = f^ix'$
with $d^i(x') = 0$ in $\overline{M}^{i + 1}$. Hence we can define the map
$t$ by sending $x$ to the class of $x'$.
\item If $y \in M^{i + 1}$ has class $\overline{y}$ in
$B^{i + 1} \subset \overline{M}^{i + 1}$ then we
can write $y = fy' + d^i(x)$ for $y' \in M^{i + 1}$ and $x \in M^i$.
Hence we can define the map $s$ sending $\overline{y}$ to the class of
$f^{i + 1}x$ in $(\eta_fM)^i /f(\eta_fM)^i$; we omit the verification that
this is well defined.
\item If $x \in M^i$ has class $\overline{x}$ in $B^i \subset \overline{M}^i$
then we can write $x = fx' + d^{i - 1}(z)$ for $x' \in M^i$ and
$z \in M^{i - 1}$. We define the map $s'$ by sending $\overline{x}$ to the
class of $f^i d^{i - 1}(z)$ in $(\eta_fM)^i/f(\eta_fM)^i$. This is well defined
because if $fx' + d^{i - 1}(z) = 0$, then $f^ix'$ is in $(\eta_fM)^i$
and consequently $f^id^{i - 1}(z)$ is in $f(\eta_fM)^i$.
\end{enumerate}
We omit the verification that the lower row in the displayed
diagram is a short exact sequence of modules.
It is immediately clear from these constructions that we have commutative
diagrams
$$
\xymatrix{
B^{i + 1} \oplus B^i \ar[d]^{s, s'} \ar[r] &
B^{i + 2} \oplus B^{i + 1} \ar[d]^{s, s'} \\
(\eta_fM)^i /f(\eta_fM)^i \ar[r] &
(\eta_fM)^{i + 1} /f(\eta_fM)^{i + 1}
}
$$
where the upper horizontal arrow is given by the identification
of the summands $B^{i + 1}$ in source and target. In other words,
we have found an acyclic subcomplex of
$\eta_fM^\bullet / f(\eta_fM^\bullet) = \eta_fM^\bullet \otimes_A A/fA$
and the quotient by this subcomplex is a complex whose terms $Z^i/B^i$
are the cohomology modules of the complex
$\overline{M}^\bullet = M^\bullet \otimes_A A/fA$.
\end{remark}

\noindent
To explain the phenomenon observed in Remark \ref{remark-eta-BZ}
in a more canonical manner, we are going to construct the Bockstein operators.
Let $A$ be a ring and let $f \in A$ be a nonzerodivisor. Let $M^\bullet$ be
a complex of $f$-torsion free $A$-modules.
For every $i \in \mathbf{Z}$ there is a commutative diagram
(with tensor products over $A$)
$$
\xymatrix{
0 \ar[r] &
M^\bullet \otimes f^{i + 1}A \ar[r] \ar[d] &
M^\bullet \otimes f^iA \ar[r] \ar[d] &
M^\bullet \otimes f^iA/f^{i + 1}A \ar[r] \ar@{=}[d] &
0 \\
0 \ar[r] &
M^\bullet \otimes f^{i + 1}A/f^{i + 2}A \ar[r] &
M^\bullet \otimes f^iA/f^{i + 2}A \ar[r] &
M^\bullet \otimes f^iA/f^{i + 1}A \ar[r] &
0
}
$$
whose rows are short exact sequences of complexes. Of course these short
exact sequences for different $i$ are all isomorphic to each other by
suitably multiplying with powers of $f$. The long exact sequence of
cohomology of the bottom sequence in particular determines the
{\it Bockstein operator}
$$
\beta = \beta^i : H^i(M^\bullet \otimes f^iA/f^{i + 1}A) \to
H^{i + 1}(M^\bullet \otimes f^{i + 1}A/f^{i + 2}A)
$$
for all $i \in \mathbf{Z}$. For later use we record here that by
the commutative diagram above there is a factorization
\begin{equation}
\label{equation-factorization-bockstein}
\vcenter{
\xymatrix{
H^i(M^\bullet \otimes f^iA/f^{i + 1}A)
\ar[r]_\delta \ar[rd]_\beta &
H^{i + 1}(M^\bullet \otimes f^{i + 1}A) \ar[d] \\
&
H^{i + 1}(M^\bullet \otimes f^{i + 1}A/f^{i + 2}A)
}
}
\end{equation}
of the Bockstein operator where $\delta$ is the boundary operator
coming from the top row in the commutative diagram above.
Let us show that we obtain a complex
\begin{equation}
\label{equation-complex-bocksteins}
H^\bullet(M^\bullet/f) =
\left[
\begin{matrix}
\ldots \\
\downarrow \\
H^{i - 1}(M^\bullet \otimes f^{i - 1}A/f^iA) \\
\downarrow \beta \\
H^i(M^\bullet \otimes f^iA/f^{i + 1}A) \\
\downarrow \beta \\
H^{i + 1}(M^\bullet \otimes f^{i + 1}A/f^{i + 2}A) \\
\downarrow \\
\ldots
\end{matrix}
\right]
\end{equation}
i.e., that $\beta \circ \beta = 0$\footnote{An alternative is to
argue that $\beta$ occurs as the differential for the spectral
sequence for the complex $(M^\bullet)_f$ filtered by the subcomplexes
$f^iM^\bullet$. Yet another argument, which proves something stronger,
is to first consider the case $M^\bullet = A$. Here the short exact sequences
$0 \to f^{i + 1}A/f^{i + 2}A \to f^iA/f^{i + 2}A \to f^iA/f^{i + 1}A \to 0$
define maps $\beta^i : f^iA/f^{i + 1}A \to f^{i + 1}A/f^{i + 2}A[1]$
in $D(A)$. Then one computes (arguing similarly to the
text) that the composition
$f^iA/f^{i + 1}A \to f^{i + 1}A/f^{i + 2}A[1] \to f^{i + 2}A/f^{i + 3}A[2]$
is zero in $D(A)$. Since $M^\bullet \otimes f^iA/f^{i + 1}A =
M^\bullet \otimes^\mathbf{L} f^iA/f^{i + 1}A$ by our assumption on $M^\bullet$
having $f$-torsion free terms, we conclude the
compostion
$$
(M^\bullet \otimes f^iA/f^{i + 1}A)
\to
(M^\bullet \otimes f^{i + 1}A/f^{i + 2}A)[1]
\to
(M^\bullet \otimes f^{i + 2}A/f^{i + 3}A)[2]
$$
in $D(A)$ is zero as well.}. Namely, using the factorization
(\ref{equation-factorization-bockstein}) we see that
it suffices to show that
$$
H^{i + 1}(M^\bullet \otimes f^{i + 1}A)
\to
H^{i + 1}(M^\bullet \otimes f^{i + 1}A/f^{i + 2}A)
\xrightarrow{\beta^{i + 1}}
H^{i + 2}(M^\bullet \otimes f^{i + 2}A/f^{i + 3}A)
$$
is zero. This is true because the kernel of $\beta^{i + 1}$
consists of the cohomology classes which can be lifted to
$H^{i + 1}(M^\bullet \otimes f^{i + 1}A/f^{i + 3}A)$
and those in the image of the first map certainly can!

\begin{lemma}
\label{lemma-eta-second-property}
Let $A$ be a ring and let $f \in A$ be a nonzerodivisor. Let $M^\bullet$ be
a complex of $f$-torsion free $A$-modules.
There is a canonical map of complexes
$$
\eta_fM^\bullet \otimes_A A/fA
\longrightarrow
H^\bullet(M^\bullet/f)
$$
which is a quasi-isomorphism where the right hand side is the complex
(\ref{equation-complex-bocksteins}).
\end{lemma}

\begin{proof}
Let $x \in (\eta_fM)^i$. Then $x = f^ix' \in f^iM$ and
$d^i(x) = f^{i + 1}y \in f^{i + 1}M^{i + 1}$. Thus $d^i$ maps $x' \otimes f^i$
to zero in $M^{i + 1} \otimes f^iA/f^{i + 1}A$. All tensor products
are over $A$ in this proof.
Hence we may map $x$ to the class of $x' \otimes f^i$ in
$H^i(M^\bullet \otimes f^iA/f^{i + 1}A)$. It is clear that this
rule defines a map
$$
(\eta_fM)^i \otimes A/fA
\longrightarrow
H^i(M^\bullet \otimes f^iA/f^{i + 1}A)
$$
of $A/fA$-modules. Observe that in the situation above, we may view
$x' \otimes f^i$ as an element of $M^i \otimes f^iA/f^{i + 2}A$
with differential $d^i(x' \otimes f^i) = y \otimes f^{i + 1}$.
By the construction of $\beta$ above we find that
$\beta(x' \otimes f^i) = y \otimes f^{i + 1}$ and we conclude that
our maps are compatible with differentials, i.e., we have a map
of complexes.

\medskip\noindent
To finish the proof, we observe that the construction given
in the previous paragraph agrees with the maps
$(\eta_fM)^i \otimes A/fA \to Z^i/B^i$ discussed in
Remark \ref{remark-eta-BZ}.
Since we have seen that the kernel of these maps is
an acyclic subcomplex of $\eta_fM^\bullet \otimes A/fA$, the lemma is proved.
\end{proof}

\begin{lemma}
\label{lemma-vanishing-beta}
Let $A$ be a ring and let $f \in A$ be a nonzerodivisor. Let
$M^\bullet$ be a complex of $f$-torsion free $A$-modules.
For $i \in \mathbf{Z}$ the following are equivalent
\begin{enumerate}
\item $\Ker(d^i \bmod f^2)$ surjects onto $\Ker(d^i \bmod f)$,
\item $\beta : H^i(M^\bullet \otimes_A f^iA/f^{i + 1}A) \to
H^{i + 1}(M^\bullet \otimes_A f^{i + 1}A/f^{i + 2}A)$ is zero.
\end{enumerate}
These equivalent conditions are implied by the condition
$H^{i + 1}(M^\bullet)[f] = 0$.
\end{lemma}

\begin{proof}
The equivalence of (1) and (2) follows from the definition of
$\beta$ as the boundary map on cohomology of a short exact sequence
of complexes isomorphic to the short exact sequence of complexes
$0 \to fM^\bullet/f^2M^\bullet \to M^\bullet/f^2M^\bullet \to
M^\bullet/fM^\bullet \to 0$. If $\beta \not = 0$,
then $H^{i + 1}(M^\bullet)[f] \not = 0$ because of the factorization
(\ref{equation-factorization-bockstein}).
\end{proof}

\begin{lemma}
\label{lemma-eta-vanishing-beta}
Let $A$ be a ring and let $f \in A$ be a nonzerodivisor. Let
$M^\bullet$ be a complex of $f$-torsion free $A$-modules.
If $\Ker(d^i \bmod f^2)$ surjects onto $\Ker(d^i \bmod f)$,
then the canonical map
$$
(1, d^i) :
(\eta_fM)^i / f(\eta_fM)^i \longrightarrow
f^iM^i/f^{i + 1}M^i \oplus f^{i + 1}M^{i + 1}/f^{i + 2}M^{i + 1}
$$
identifies the left hand side with a direct sum of submodules of
the right hand side.
\end{lemma}

\begin{proof}
With notation as in Remark \ref{remark-eta-BZ}
we define a map $t^{-1} : Z^i \to (\eta_fM)^i / f(\eta_fM)^i$.
Namely, for $x \in M^i$ with $d^i(x) = f^2y$ we send the class of
$x$ in $Z^i$ to the class of $f^ix$ in $(\eta_fM)^i / f(\eta_fM)^i$.
We omit the verification that this is well defined; the assumption
of the lemma exactly signifies that the domain of this operation
is all of $Z^i$. Then
$t \circ t^{-1} = \text{id}_{Z^i}$. Hence $t^{-1}$
defines a splitting of the short exact sequence in
Remark \ref{remark-eta-BZ} and the resulting direct sum
decomposition
$$
(\eta_fM)^i / f(\eta_fM)^i = Z^i \oplus B^{i + 1}
$$
is compatible with the map displayed in the lemma.
\end{proof}

\begin{lemma}
\label{lemma-eta-third-property}
Let $A$ be a ring and let $f, g \in A$ be nonzerodivisors. Let $M^\bullet$ be
a complex of $A$-modules such that $fg$ is a nonzerodivisor on all $M^i$.
Then $\eta_f\eta_gM^\bullet = \eta_{fg}M^\bullet$.
\end{lemma}

\begin{proof}
The statement means that in degree $i$ we obtain the same submodule
of the localization $M^i_{fg} = (M^i_g)_f$. We omit the details.
\end{proof}

\begin{lemma}
\label{lemma-eta-flat-base-change}
Let $A$ be a ring and let $f \in A$ be a nonzerodivisor. Let
$A \to B$ be a flat ring map and let $g \in B$ the image of $f$.
Let $M^\bullet$ be a complex of $f$-torsion free $A$-modules.
Then $g$ is a nonzerodivisor, $M^\bullet \otimes_A B$
is a complex of $g$-torsion free modules, and
$\eta_fM^\bullet \otimes_A B = \eta_g(M^\bullet \otimes_A B)$.
\end{lemma}

\begin{proof}
Omitted.
\end{proof}







\section{Perfect complexes and the eta operator}
\label{section-perfect-eta}

\noindent
In this section we do some algebra to prepare for our version of
Macpherson's graph construction, see
More on Flatness, Section \ref{flat-section-blowup-complexes-III}.
We will use the $\eta_f$ operator introduced in
Section \ref{section-eta}.

\medskip\noindent
Let $A$ be a ring and let $f \in A$ be a nonzerodivisor. Let $M^\bullet$
be a bounded complex of finite free $A$-modules. For each $i$ let $r_i$
be the rank of $M^i$ and set
$$
I_i(M^\bullet, f) = \text{ideal generated by the }
r_i \times r_i\text{-minors of }
(f, d^i) : M^i \to M^i \oplus M^{i + 1}
$$
Observe that $f^{r_i} \in I_i(M^\bullet, f)$.

\begin{lemma}
\label{lemma-ideal-well-defined}
Let $A$ be a ring and let $f \in A$ be a nonzerodivisor.
Let $M^\bullet$ and $N^\bullet$ be two bounded complexes
of finite free $A$-modules representing the same object of $D(A)$.
Then
$$
f^m I_i(M^\bullet, f) = f^n I_i(N^\bullet, f)
$$
as ideals of $A$ for integers $n, m \geq 0$ such that
$$
m + \sum\nolimits_{j \geq i} (-1)^{j - i}rk(M^j) =
n + \sum\nolimits_{j \geq i} (-1)^{j - i}rk(N^j)
$$
\end{lemma}

\begin{proof}
It suffices to prove the equality after localization at every prime ideal
of $A$. Thus by Lemma \ref{lemma-compare-representatives-perfect}
and an induction argument we omit
we may assume $N^\bullet = M^\bullet \oplus Q^\bullet$
for some trivial complex $Q^\bullet$, i.e.,
$$
Q^\bullet = \ldots \to 0 \to A \xrightarrow{1} A \to 0 \to \ldots
$$
where $A$ is placed in degree $j$ and $j + 1$.
If $j \not = i - 1, i, i + 1$ then we clearly have equality
$I_i(M^\bullet, f) = I_i(N^\bullet, f)$ and $m = n$
and we have the desired equality. If $j = i + 1$ then the maps
$$
(f, d^i) : M^i \to M^i \oplus M^{i + 1}
\quad\text{and}\quad
(f, d^i, 0) : M^i \to M^i \oplus M^{i + 1} \oplus A
$$
have the same nonzero minors hence in this case we also have
$I_i(M^\bullet, f) = I_i(N^\bullet, f)$ and $m = n$. If $j = i$,
then $I_i(M^\bullet, f)$ is the ideal generated by the
$r_i \times r_i$-minors of
$$
(f, d^i) : M^i \to M^i \oplus M^{i + 1}
$$
and $I_i(N^\bullet, f)$ is the ideal generated by
the $(r_i + 1) \times (r_i + 1)$-minors of
$$
(f \oplus f, d^i \oplus 1) :
(M^i \oplus A) \to (M^i \oplus A) \oplus (M^{i + 1} \oplus A)
$$
With suitable choice of coordinates we see that the matrix
of the second map is in block form
$$
T =
\left(
\begin{matrix}
T_1 & 0 \\
0 & T_2
\end{matrix}
\right),
\quad
T_1 = \text{matrix of first map},
\quad
T_2 =
\left(
\begin{matrix}
f \\
1
\end{matrix}
\right)
$$
With notation as in Lemma \ref{lemma-ideals-generated-by-minors}
we have $I_0(T_2) = A$, $I_1(T_2) = A$, $I_p(T_2) = 0$ for $p \geq 2$
and hence $I_{r_i + 1}(T) = I_{r_i + 1}(T_1) + I_{r_i}(T_1) =
I_{r_i}(T_1)$ which means that $I_i(M^\bullet, f) = I_i(N^\bullet, f)$.
We also have $m = n$ so this finishes the case $j = i$.
Finally, say $j = i - 1$. Then we see that $m = n + 1$, thus we have
to show that $fI_i(M^\bullet, f) = I_i(N^\bullet, f)$.
In this case $I_i(M^\bullet, f)$ is the ideal generated by the
$r_i \times r_i$-minors of
$$
(f, d^i) : M^i \to M^i \oplus M^{i + 1}
$$
and $I_i(N^\bullet, f)$ is the ideal generated by
the $(r_i + 1) \times (r_i + 1)$-minors of
$$
(f \oplus f, d^i) : (M^i \oplus A) \to (M^i \oplus A) \oplus M^{i + 1}
$$
With suitable choice of coordinates we see that the matrix
of the second map is in block form
$$
T =
\left(
\begin{matrix}
T_1 & 0 \\
0 & T_2
\end{matrix}
\right),
\quad
T_1 = \text{matrix of first map},
\quad
T_2 =
\left(
\begin{matrix}
f
\end{matrix}
\right)
$$
Arguing as above we find that indeed
$fI_i(M^\bullet, f) = I_i(N^\bullet, f)$.
\end{proof}

\begin{lemma}
\label{lemma-eta-change-unit}
Let $f \in A$ be a nonzerodivisor of a ring $A$. Let $u \in A$ be a unit. Let
$M^\bullet$ be a bounded complex of finite free $A$-modules. Then
$I_i(M^\bullet, f) = I_i(M^\bullet, uf)$.
\end{lemma}

\begin{proof}
Omitted.
\end{proof}

\begin{lemma}
\label{lemma-eta-base-change-pre}
Let $A \to B$ be a ring map. Let $f \in A$ be a nonzerodivisor. Let
$M^\bullet$ be a bounded complex of finite free $A$-modules. Assume
$f$ maps to a nonzerodivisor $g$ in $B$. Then
$I_i(M^\bullet, f)B = I_i(M^\bullet \otimes_A B, g)$.
\end{lemma}

\begin{proof}
The minors of $(f, d^i) : M^i \to M^i \oplus M^{i + 1}$ map to the
corresponding minors of
$(g, d^i) : M^i \otimes_A B \to M^i \otimes_A B \oplus M^{i + 1} \otimes_A B$.
\end{proof}

\begin{lemma}
\label{lemma-eta-cohomology-free}
Let $A$ be a ring, let $\mathfrak p \subset A$ be a prime ideal, and
let $f \in A$ be a nonzerodivisor. Let $M^\bullet$ be a bounded complex
of finite free $A$-modules. If $H^i(M^\bullet)_\mathfrak p$
is free for all $i$, then $I_i(M^\bullet, f)_\mathfrak p$ is a
principal ideal and in fact generated by a power of $f$ for all $i$.
\end{lemma}

\begin{proof}
We may assume $A$ is local with maximal ideal $\mathfrak p$ by
Lemma \ref{lemma-eta-base-change-pre}. We may also replace $M^\bullet$
with a quasi-isomorphic complex by Lemma \ref{lemma-ideal-well-defined}.
By our assumption on the freeness of cohomology modules
we see that $M^\bullet$ is quasi-isomorphic to the
complex whose term in degree $i$ is $H^i(M^\bullet)$ with vanishing
differentials, see for example
Derived Categories, Lemma \ref{derived-lemma-ext-2-zero-pre}.
In other words, we may assume the differentials in the
complex $M^\bullet$ are all zero. In this case it is clear
that $I_i(M^\bullet, f) = (f^{r_i})$ is principal.
\end{proof}

\begin{lemma}
\label{lemma-eta-locally-free}
Let $A$ be a ring and let $f \in A$ be a nonzerodivisor. Let
$M^\bullet$ be a bounded complex of finite free $A$-modules. Assume
$I_i(M^\bullet, f)$ is a principal ideal.
Then $(\eta_fM)^i$ is locally free of rank $r_i$ and the map
$(1, d^i) : (\eta_fM)^i \to f^iM^i \oplus f^{i + 1}M^{i + 1}$
is the inclusion of a direct summand.
\end{lemma}

\begin{proof}
Choose a generator $g$ for $I_i(M^\bullet, f)$. Since
$f^{r_i} \in I_i(M^\bullet, f)$ we see that $g$ divides a power of $f$.
In particular $g$ is a nonzerodivisor in $A$.
The $r_i \times r_i$-minors of the map
$(f, d^i) : M^i \to M^i \oplus M^{i + 1}$
generate the ideal $I_i(M^\bullet, f)$ and the
$(r_i + 1) \times (r_i + 1)$-minors of $(f, d^i)$ are zero:
we may check this after localizing at $f$
where the rank of the map is equal to $r_i$.
Consider the surjection
$$
M^i \oplus M^{i + 1}
\longrightarrow
Q = \Coker(f, d^i)/g\text{-torsion}
$$
By Lemma \ref{lemma-fitting-ideals-and-pd1}
the module $Q$ is finite locally free of rank $r_{i + 1}$.
Hence $Q$ is $f$-torsion free and we conclude the cokernel of
$(f, d^i)$ modulo $f$-power torsion is $Q$ as well.

\medskip\noindent
Consider the complex of finite free $A$-modules
$$
0 \to f^{i + 1}M^i \xrightarrow{1, d^i} f^iM^i \oplus f^{i + 1}M^{i + 1}
\xrightarrow{d^i, -1} f^iM^{i + 1} \to 0
$$
which becomes split exact after localizing at $f$.
The map $(1, d^i) : f^{i + 1}M^i \to f^iM^i \oplus f^{i + 1}M^{i + 1}$
is isomorphic to the map $(f, d^i) : M^i \to M^i \oplus M^{i + 1}$ we
studied above. Hence the image
$$
Q' = \Im(f^iM^i \oplus f^{i + 1}M^{i + 1} \xrightarrow{d^i, -1} f^iM^{i + 1})
$$
is isomorphic to $Q$ in particular projective. On the other hand,
by construction of $\eta_f$ in Section \ref{section-eta}
the image of the injective map
$(1, d^i) : (\eta_fM)^i \to f^iM^i \oplus f^{i + 1}M^{i + 1}$ is
the kernel of $(d^i, -1)$. We conclude that we obtain an
isomorphism $(\eta_fM)^i \oplus Q' = f^iM^i \oplus f^{i + 1}M^{i + 1}$
and we see that indeed $\eta_fM^i$ is finite locally free
of rank $r_i$ and that $(1, d^i)$ is the inclusion of a direct
summand.
\end{proof}

\begin{lemma}
\label{lemma-eta-base-change}
Let $A \to B$ be a ring map. Let $f \in A$ be a nonzerodivisor. Let
$M^\bullet$ be a bounded complex of finite free $A$-modules. Assume
$f$ maps to a nonzerodivisor $g$ in $B$ and $I_i(M^\bullet, f)$
is a principal ideal for all $i \in \mathbf{Z}$.
Then there is a canonical isomorphism
$\eta_fM^\bullet \otimes_A B = \eta_g(M^\bullet \otimes_A B)$.
\end{lemma}

\begin{proof}
Set $N^i = M^i \otimes_A B$. Observe that $f^iM^i \otimes_A B = g^iN^i$
as submodules of $(N^i)_g$. The maps
$$
(\eta_fM)^i \otimes_A B \to g^iN^i \otimes g^{i + 1}N^{i + 1}
\quad\text{and}\quad
(\eta_gN)^i \to g^iN^i \otimes g^{i + 1}N^{i + 1}
$$
are inclusions of direct summands by Lemma \ref{lemma-eta-locally-free}.
Since their images agree after localizing at $g$ we conclude.
\end{proof}

\begin{lemma}
\label{lemma-ideal-direct-summand}
Let $A$ be a ring. Let $M$, $N_1$, $N_2$ be finite projective $A$-modules.
Let $s : M \to N_1 \oplus N_2$ be a split injection. There exists a
finitely generated ideal $J \subset A$ with the following property:
a ring map $A \to B$ factors through $A/J$ if and only if
$s \otimes \text{id}_B$
identifies $M \otimes_A B$ with a direct sum of submodules of
$N_1 \otimes_A B \oplus N_2 \otimes_A B$.
\end{lemma}

\begin{proof}
Choose a splitting $\pi : N_1 \oplus N_2 \to M$ of $s$. Denote
$q_i : N_1 \oplus N_2 \to N_1 \oplus N_2$ the projector onto $N_i$.
Set $p_i = \pi \circ q_i \circ s$. Observe that $p_1 + p_2 = \text{id}_M$.
We claim $M$ is a direct sum of submodules of $N_1 \oplus N_2$
if and only if $p_1$ and $p_2$ are orthogonal projectors.
Thus $J$ is the smallest ideal of $A$ such that
$p_1 \circ p_1 - p_1$, $p_2 \circ p_2 - p_2$, $p_1 \circ p_2$, and
$p_2 \circ p_1$ are contained in $J \otimes_A \text{End}_A(M)$.
Some details omitted.
\end{proof}

\noindent
Let $A$ be a ring and let $f \in A$ be a nonzerodivisor. Let
$M^\bullet$ be a bounded complex of finite free $A$-modules.
Assume the ideals $I_i(M^\bullet, f)$ are principal for all
$i \in \mathbf{Z}$. Then the maps
$$
(1, d^i) : (\eta_fM)^i / f(\eta_fM)^i \longrightarrow
f^iM^i/f^{i + 1}M^i \oplus f^{i + 1}M^{i + 1}/f^{i + 2}M^{i + 1}
$$
are split injections by Lemma \ref{lemma-eta-locally-free}.
Denote $J_i(M^\bullet, f) \subset A/fA$ the finitely generated ideal
of Lemma \ref{lemma-ideal-direct-summand} corresponding to the
split injection $(1, d^i)$ displayed above.

\begin{lemma}
\label{lemma-eta-vanishing-beta-plus-pre}
Let $A$ be a ring and let $f \in A$ be a nonzerodivisor. Let
$M^\bullet$ and $N^\bullet$ be two bounded complexes of finite
free $A$-modules representing the same object in $D(A)$.
Assume $I_i(M^\bullet, f)$ is a principal ideal
for all $i \in \mathbf{Z}$. Then $J_i(M^\bullet, f) = J_i(N^\bullet, f)$
as ideals in $A/fA$.
\end{lemma}

\begin{proof}
Observe that the fact that $I_i(M^\bullet, f)$ is a principal ideal
implies that $I_i(M^\bullet, f)$ is a principal ideal by
Lemma \ref{lemma-ideal-well-defined} and hence the statement makes sense.
As in the proof of Lemma \ref{lemma-ideal-well-defined}
we may assume $N^\bullet = M^\bullet \oplus Q^\bullet$
for some trivial complex $Q^\bullet$, i.e.,
$$
Q^\bullet = \ldots \to 0 \to A \xrightarrow{1} A \to 0 \to \ldots
$$
where $A$ is placed in degree $j$ and $j + 1$. Since $\eta_f$ is
compatible with direct sums, we see that the map
$$
(1, d^i) : (\eta_fN)^i / f(\eta_fN)^i \longrightarrow
f^iN^i/f^{i + 1}N^i \oplus f^{i + 1}N^{i + 1}/f^{i + 2}N^{i + 1}
$$
is the direct sum of the corresponding map for
$M^\bullet$ and for $Q^\bullet$. By the universal property
defining the ideals in question, we conclude that
$J_i(N^\bullet, f) = J_i(M^\bullet, f) + J_i(Q^\bullet, f)$.
Hence it suffices to show that $J_i(Q^\bullet, f) = 0$
for all $i$. This is a computation that we omit.
\end{proof}

\begin{lemma}
\label{lemma-eta-vanishing-beta-plus}
Let $A$ be a ring and let $f \in A$ be a nonzerodivisor. Let
$M^\bullet$ be a bounded complex of finite free $A$-modules.
Assume $I_i(M^\bullet, f)$ is a principal ideal
for all $i \in \mathbf{Z}$. Consider the ideal
$J(M^\bullet, f) = \sum_i J_i(M^\bullet, f)$ of $A/fA$.
Consider the set of prime ideals
\begin{align*}
E
& =
\{f \in \mathfrak p \subset A \mid
\Ker(d^i \bmod f^2)_\mathfrak p \text{ surjects onto }
\Ker(d^i \bmod f)_\mathfrak p \text{ for all }i \in \mathbf{Z}\} \\
& =
\{f \in \mathfrak p \subset A \mid
\text{the localizations }\beta_\mathfrak p
\text{ of the Bockstein operators are zero}\}
\end{align*}
Then we have
\begin{enumerate}
\item $J(M^\bullet, f)$ is finitely generated,
\item $A/fA \to C = (A/fA)/J(M^\bullet, f)$
is surjective of finite presentation,
\item $J(M^\bullet, f)_\mathfrak p = 0$ for $\mathfrak p \in E$,
\item if $f \in \mathfrak p$ and
$H^i(M^\bullet)_\mathfrak p$ is free for all $i \in \mathbf{Z}$,
then $\mathfrak p \in E$, and
\item the cohomology modules of
$\eta_f M^\bullet \otimes_A C$ are finite locally free $C$-modules.
\end{enumerate}
\end{lemma}

\begin{proof}
The equality in the definition of $E$ follows from
Lemma \ref{lemma-vanishing-beta} and in addition the
final statement of that lemma implies part (4).

\medskip\noindent
Part (1) is true because the ideals $J_i(M^\bullet, f)$ are finitely
generated and because $M^\bullet$ is bounded and hence $J_i(M^\bullet, f)$
is zero for almost all $i$. Part (2) is just a reformulation of part (1).

\medskip\noindent
Proof of (3). By Lemma \ref{lemma-eta-locally-free} we find that
$(\eta_fM)^i$ is finite locally free of rank $r_i$ for all $i$.
Consider the map
$$
(1, d^i) :
(\eta_fM)^i / f(\eta_fM)^i
\longrightarrow
f^iM^i/f^{i + 1}M^i \oplus f^{i + 1}M^{i + 1}/f^{i + 2}M^{i + 1}
$$
Pick $\mathfrak p \in E$. By Lemma \ref{lemma-eta-vanishing-beta}
and the local freeness of the modules $(\eta_fM)^i$ we may write
$$
\left((\eta_fM)^i / f(\eta_fM)^i\right)_\mathfrak p =
(A/fA)_\mathfrak p^{\oplus m_i} \oplus (A/fA)_\mathfrak p^{\oplus n_i}
$$
compatible with the arrow $(1, d^i)$ above. By the universal property of
the ideal $J_i(M^\bullet, f)$ we conclude that
$J_i(M^\bullet, f)_\mathfrak p = 0$.
Hence $I_\mathfrak p = fA_\mathfrak p$ for $\mathfrak p \in E$.

\medskip\noindent


\medskip\noindent
Proof of (5). Observe that the differential on $\eta_fM^\bullet$
fits into a commutative diagram
$$
\xymatrix{
(\eta_fM)^i \ar[d] \ar[r] &
f^iM^i \oplus f^{i + 1}M^{i + 1}
\ar[d]^{\left(
\begin{matrix}
0 & 1 \\
0 & 0
\end{matrix}
\right)} \\
(\eta_fM)^{i + 1} \ar[r] &
f^{i + 1}M^i \oplus f^{i + 2}M^{i + 2}
}
$$
By construction, after tensoring with $C$, the modules on the
left are direct sums of direct summands of the summands on the right.
Picture
$$
\xymatrix{
(\eta_fM)^i \otimes_A C \ar[d] \ar@{=}[r] &
K^i \oplus L^i \ar[r] \ar[d] &
f^iM^i \otimes_A C \oplus f^{i + 1}M^{i + 1} \otimes_A C
\ar[d]^{\left(
\begin{matrix}
0 & 1 \\
0 & 0
\end{matrix}
\right)} \\
(\eta_fM)^{i + 1} \otimes_A C \ar@{=}[r] &
K^{i + 1} \oplus L^{i + 1} \ar[r] &
f^{i + 1}M^i \otimes_A C \oplus f^{i + 2}M^{i + 2} \otimes_A C
}
$$
where the horizontal arrows are compatible with direct sum decompositions
as well as inclusions of direct summands.
It follows that the differential identifies $L^i$ with a direct summand
of $K^{i + 1}$ and we conclude that the cohomology of
$\eta_fM^\bullet \otimes_A C$ in degree $i$ is the
module $K^{i + 1}/L^i$ which is finite projective as desired.
\end{proof}









\section{Taking limits of complexes}
\label{section-limits}

\noindent
In this section we discuss what happens when we have a ``formal deformation''
of a complex and we take its limit. We will consider two cases
\begin{enumerate}
\item we have a limit $A = \lim A_n$ of an inverse system of
rings whose transition maps are surjective with locally nilpotent
kernels and objects $K_n \in D(A_n)$ which fit together 
in the sense that $K_n = K_{n + 1} \otimes_{A_{n + 1}}^\mathbf{L} A_n$, or
\item we have a ring $A$, an ideal $I$, and objects
$K_n \in D(A/I^n)$ which fit together  in the sense that
$K_n = K_{n + 1} \otimes_{A/I^{n + 1}}^\mathbf{L} A/I^n$.
\end{enumerate}
Under additional hypotheses we can show that $K = R\lim K_n$ reproduces
the system in the sense that $K_n = K \otimes_A^\mathbf{L} A_n$ or
$K_n = K \otimes_A^\mathbf{L} A/I^n$.

\begin{lemma}
\label{lemma-Rlim-pseudo-coherent-gives-pseudo-coherent}
Let $A = \lim A_n$ be a limit of an inverse system $(A_n)$ of rings.
Suppose given $K_n \in D(A_n)$ and maps $K_{n + 1} \to K_n$
in $D(A_{n + 1})$. Assume
\begin{enumerate}
\item the transition maps $A_{n + 1} \to A_n$ are surjective
with locally nilpotent kernels,
\item $K_1$ is pseudo-coherent, and
\item the maps induce isomorphisms
$K_{n + 1} \otimes_{A_{n + 1}}^\mathbf{L} A_n \to K_n$.
\end{enumerate}
Then $K = R\lim K_n$ is a pseudo-coherent object of $D(A)$
and $K \otimes_A^\mathbf{L} A_n \to K_n$ is an isomorphism for all $n$.
\end{lemma}

\begin{proof}
By assumption we can find a bounded above complex of
finite free $A_1$-modules $P_1^\bullet$ representing $K_1$, see
Definition \ref{definition-pseudo-coherent}.
By Lemma \ref{lemma-lift-complex-stably-frees}
we can, by induction on $n > 1$, find
complexes $P_n^\bullet$ of finite free $A_n$-modules representing $K_n$
and maps $P_n^\bullet \to P_{n - 1}^\bullet$ representing the maps
$K_n \to K_{n - 1}$ inducing isomorphisms (!)
of complexes $P_n^\bullet \otimes_{A_n} A_{n - 1} \to P_{n - 1}^\bullet$.
Thus $K = R\lim K_n$ is represented by $P^\bullet = \lim P_n^\bullet$, see
Lemma \ref{lemma-compute-Rlim-modules} and
Remark \ref{remark-how-unique}.
Since $P_n^i$ is a finite free $A_n$-module for each $n$ and
$A = \lim A_n$ we see that $P^i$ is finite free of the same rank
as $P_1^i$ for each $i$.
This means that $K$ is pseudo-coherent.
It also follows that $K \otimes_A^\mathbf{L} A_n$ is represented by
$P^\bullet \otimes_A A_n = P_n^\bullet$ which proves the final
assertion.
\end{proof}

\begin{lemma}
\label{lemma-Rlim-pseudo-coherent-gives-complete-pseudo-coherent}
Let $A$ be a ring and $I \subset A$ an ideal.
Suppose given $K_n \in D(A/I^n)$ and maps $K_{n + 1} \to K_n$
in $D(A/I^{n + 1})$. Assume
\begin{enumerate}
\item $A$ is $I$-adically complete,
\item $K_1$ is pseudo-coherent, and
\item the maps induce isomorphisms
$K_{n + 1} \otimes_{A/I^{n + 1}}^\mathbf{L} A/I^n \to K_n$.
\end{enumerate}
Then $K = R\lim K_n$ is a pseudo-coherent, derived complete object of $D(A)$
and $K \otimes_A^\mathbf{L} A/I^n \to K_n$ is an isomorphism for all $n$.
\end{lemma}

\begin{proof}
We already know that $K$ is pseudo-coherent and that
$K \otimes_A^\mathbf{L} A/I^n \to K_n$ is an isomorphism for all $n$, see
Lemma \ref{lemma-Rlim-pseudo-coherent-gives-pseudo-coherent}.
Finally, $K$ is derived complete by
Lemma \ref{lemma-naive-derived-completion}.
\end{proof}

\begin{lemma}
\label{lemma-Rlim-perfect-gives-perfect}
\begin{reference}
\cite[Lemma 4.2]{Bhatt-Algebraize}
\end{reference}
Let $A = \lim A_n$ be a limit of an inverse system $(A_n)$ of rings.
Suppose given $K_n \in D(A_n)$ and maps $K_{n + 1} \to K_n$
in $D(A_{n + 1})$. Assume
\begin{enumerate}
\item the transition maps $A_{n + 1} \to A_n$ are surjective with
locally nilpotent kernels,
\item $K_1$ is a perfect object, and
\item the maps induce isomorphisms
$K_{n + 1} \otimes_{A_{n + 1}}^\mathbf{L} A_n \to K_n$.
\end{enumerate}
Then $K = R\lim K_n$ is a perfect object of $D(A)$
and $K \otimes_A^\mathbf{L} A_n \to K_n$ is an isomorphism for all $n$.
\end{lemma}

\begin{proof}
We already know that $K$ is pseudo-coherent and that
$K \otimes_A^\mathbf{L} A_n \to K_n$ is an isomorphism for all $n$
by Lemma \ref{lemma-Rlim-pseudo-coherent-gives-pseudo-coherent}.
Thus it suffices to show that $H^i(K \otimes_A^\mathbf{L} \kappa) = 0$ for
$i \ll 0$ and every surjective map $A \to \kappa$ whose kernel is
a maximal ideal $\mathfrak m$, see
Lemma \ref{lemma-check-perfect-stalks}.
Any element of $A$ which maps to a unit in $A_1$ is a unit
in $A$ by Algebra, Lemma \ref{algebra-lemma-locally-nilpotent-unit}
and hence $\Ker(A \to A_1)$ is contained in the Jacobson radical of $A$ by
Algebra, Lemma \ref{algebra-lemma-contained-in-radical}.
Hence $A \to \kappa$ factors as $A \to A_1 \to \kappa$.
Hence
$$
K \otimes_A^\mathbf{L} \kappa =
K \otimes_A^\mathbf{L} A_1 \otimes_{A_1}^\mathbf{L} \kappa =
K_1 \otimes_{A_1}^\mathbf{L} \kappa
$$
and we get what we want as $K_1$ has finite tor dimension by
Lemma \ref{lemma-perfect}.
\end{proof}

\begin{lemma}
\label{lemma-Rlim-perfect-gives-complete}
Let $A$ be a ring and $I \subset A$ an ideal.
Suppose given $K_n \in D(A/I^n)$ and maps $K_{n + 1} \to K_n$
in $D(A/I^{n + 1})$. Assume
\begin{enumerate}
\item $A$ is $I$-adically complete,
\item $K_1$ is a perfect object, and
\item the maps induce isomorphisms
$K_{n + 1} \otimes_{A/I^{n + 1}}^\mathbf{L} A/I^n \to K_n$.
\end{enumerate}
Then $K = R\lim K_n$ is a perfect, derived complete object of $D(A)$
and $K \otimes_A^\mathbf{L} A/I^n \to K_n$ is an isomorphism for all $n$.
\end{lemma}

\begin{proof}
Combine Lemmas \ref{lemma-Rlim-perfect-gives-perfect} and
\ref{lemma-Rlim-pseudo-coherent-gives-complete-pseudo-coherent}
(to get derived completeness).
\end{proof}

\noindent
We do not know if the following lemma holds for unbounded complexes.

\begin{lemma}
\label{lemma-Rlim-gives-complete}
Let $A$ be a ring and $I \subset A$ an ideal. Suppose
given $K_n \in D(A/I^n)$ and maps $K_{n + 1} \to K_n$ in
$D(A/I^{n + 1})$. If
\begin{enumerate}
\item $A$ is Noetherian,
\item $K_1$ is bounded above, and
\item the maps induce isomorphisms
$K_{n + 1} \otimes_{A/I^{n + 1}}^\mathbf{L} A/I^n \to K_n$,
\end{enumerate}
then $K = R\lim K_n$ is a derived complete object of $D^-(A)$ and
$K \otimes_A^\mathbf{L} A/I^n \to K_n$ is an isomorphism for all $n$.
\end{lemma}

\begin{proof}
The object $K$ of $D(A)$ is derived complete by
Lemma \ref{lemma-naive-derived-completion}.

\medskip\noindent
Suppose that $H^i(K_1) = 0$ for $i > b$. Then we can find a complex of
free $A/I$-modules $P_1^\bullet$ representing $K_1$ with $P_1^i = 0$
for $i > b$. By Lemma \ref{lemma-lift-complex-projectives}
we can, by induction on $n > 1$, find
complexes $P_n^\bullet$ of free $A/I^n$-modules representing $K_n$
and maps $P_n^\bullet \to P_{n - 1}^\bullet$ representing the maps
$K_n \to K_{n - 1}$ inducing isomorphisms (!)
of complexes $P_n^\bullet/I^{n - 1}P_n^\bullet \to P_{n - 1}^\bullet$.

\medskip\noindent
Thus we have arrived at the situation where $R\lim K_n$ is represented by
$P^\bullet = \lim P_n^\bullet$, see
Lemma \ref{lemma-compute-Rlim-modules} and
Remark \ref{remark-how-unique}.
The complexes $P_n^\bullet$ are uniformly bounded above complexes
of flat $A/I^n$-modules and the transition maps are termwise surjective.
Then $P^\bullet$ is a bounded above complex of flat $A$-modules by
Lemma \ref{lemma-limit-flat}.
It follows that $K \otimes_A^\mathbf{L} A/I^t$ is represented by
$P^\bullet \otimes_A A/I^t$. We have
$P^\bullet \otimes_A A/I^t = \lim P_n^\bullet \otimes_A A/I^t$
termwise by Lemma \ref{lemma-limit-flat}. The transition maps
$P_{n + 1}^\bullet \otimes_A A/I^t \to P_n^\bullet \otimes_A A/I^t$
are isomorphisms for $n \geq t$ by our choice of $P_n^\bullet$, hence we have
$\lim P_n^\bullet \otimes_A A/I^t = P_t^\bullet \otimes_A A/I^t = P_t^\bullet$.
Since $P_t^\bullet$ represents $K_t$, we see that
$K \otimes_A^\mathbf{L} A/I^t \to K_t$ is an isomorphism.
\end{proof}

\noindent
Here is a different type of result.

\begin{lemma}[Koll\'ar-Kov\'acs]
\label{lemma-kollar-kovacs}
\begin{reference}
Email from Kovacs of 23/02/2018.
\end{reference}
Let $I$ be an ideal of a Noetherian ring $A$. Let $K \in D(A)$.
Set $K_n = K \otimes_A^\mathbf{L} A/I^n$. Assume for all
$i \in \mathbf{Z}$ we have
\begin{enumerate}
\item $H^i(K)$ is a finite $A$-module, and
\item the system $H^i(K_n)$ satisfies Mittag-Leffler.
\end{enumerate}
Then $\lim H^i(K)/I^nH^i(K)$ is equal to $\lim H^i(K_n)$ for all
$i \in \mathbf{Z}$.
\end{lemma}

\begin{proof}
Recall that $K^\wedge = R\lim K_n$ is the derived completion of $K$, see
Proposition \ref{proposition-noetherian-naive-completion-is-completion}.
By Lemma \ref{lemma-derived-completion-pseudo-coherent} we have
$H^i(K^\wedge) = \lim H^i(K)/I^nH^i(K)$. By
Lemma \ref{lemma-break-long-exact-sequence-modules}
we get short exact sequences
$$
0 \to R^1\lim H^{i - 1}(K_n) \to H^i(K^\wedge) \to \lim H^i(K_n) \to 0
$$
The Mittag-Leffler condition guarantees that the left terms are zero
(Lemma \ref{lemma-compute-Rlim-modules}) and we conclude the lemma is true.
\end{proof}



\section{Some evaluation maps}
\label{section-evaluation}

\noindent
In this section we prove that certain canonical maps of
$R\Hom$'s are isomorphisms for suitable types of complexes.

\begin{lemma}
\label{lemma-internal-hom-evaluate-isomorphism}
Let $R$ be a ring. Let $K, L, M$ be objects of $D(R)$.
the map
$$
R\Hom_R(L, M) \otimes_R^\mathbf{L} K \longrightarrow R\Hom_R(R\Hom_R(K, L), M)
$$
of Lemma \ref{lemma-internal-hom-evaluate} is an isomorphism
in the following two cases
\begin{enumerate}
\item $K$ perfect, or
\item $K$ is pseudo-coherent, $L \in D^+(R)$, and $M$ finite injective
dimension.
\end{enumerate}
\end{lemma}

\begin{proof}
Choose
a K-injective complex $I^\bullet$ representing $M$,
a K-injective complex $J^\bullet$ representing $L$, and
a bounded above complex of finite projective modules $K^\bullet$
representing $K$. Consider the map of complexes
$$
\text{Tot}(\Hom^\bullet(J^\bullet, I^\bullet) \otimes_R K^\bullet)
\longrightarrow
\Hom^\bullet(\Hom^\bullet(K^\bullet, J^\bullet), I^\bullet)
$$
of Lemma \ref{lemma-evaluate-and-more}. Note that
$$
\left(\prod\nolimits_{p + r = t} \Hom_R(J^{-r}, I^p)\right) \otimes_R K^s =
\prod\nolimits_{p + r = t} \Hom_R(J^{-r}, I^p) \otimes_R K^s
$$
because $K^s$ is finite projective. The map is given by the maps
$$
c_{p, r, s} :
\Hom_R(J^{-r}, I^p) \otimes_R K^s
\longrightarrow
\Hom_R(\Hom_R(K^s, J^{-r}), I^p)
$$
which are isomorphisms as $K^s$ is finite projective.
For every element $\alpha = (\alpha^{p, r, s})$
of degree $n$ of the left hand side, there are only finitely
many values of $s$ such that $\alpha^{p, r, s}$ is nonzero
(for some $p, r$ with $n = p + r + s$). Hence our map
is an isomorphism if the same vanishing condition is forced
on the elements $\beta = (\beta^{p, r, s})$ of the right hand side.
If $K^\bullet$ is a bounded complex of finite projective
modules, this is clear. On the other hand, if we can choose
$I^\bullet$ bounded and $J^\bullet$ bounded below, then
$\beta^{p, r, s}$ is zero for $p$ outside a fixed range, for
$s \gg 0$, and for $r \gg 0$. Hence among solutions of $n = p + r + s$
with $\beta^{p, r, s}$ nonzero only a finite number of $s$ values
occur.
\end{proof}

\begin{lemma}
\label{lemma-internal-hom-evaluate-isomorphism-technical}
Let $R$ be a ring. Let $K, L, M$ be objects of $D(R)$.
the map
$$
R\Hom_R(L, M) \otimes_R^\mathbf{L} K \longrightarrow R\Hom_R(R\Hom_R(K, L), M)
$$
of Lemma \ref{lemma-internal-hom-evaluate} is an isomorphism
if the following three conditions are satisfied
\begin{enumerate}
\item $L, M$ have finite injective dimension,
\item $R\Hom_R(L, M)$ has finite tor dimension,
\item for every $n \in \mathbf{Z}$ the truncation $\tau_{\leq n}K$
is pseudo-coherent
\end{enumerate}
\end{lemma}

\begin{proof}
Pick an integer $n$ and consider the distinguished triangle
$$
\tau_{\leq n}K \to K \to \tau_{\geq n + 1}K \to \tau_{\leq n}K[1]
$$
see Derived Categories, Remark
\ref{derived-remark-truncation-distinguished-triangle}.
By assumption (3) and Lemma \ref{lemma-internal-hom-evaluate-isomorphism}
the map is an isomorphism for $\tau_{\leq n}K$. Hence it
suffices to show that both
$$
R\Hom_R(L, M) \otimes_R^\mathbf{L} \tau_{\geq n + 1}K
\quad\text{and}\quad
R\Hom_R(R\Hom_R(\tau_{\geq n + 1}K, L), M)
$$
have vanishing cohomology in degrees $\leq n - c$ for some $c$.
This follows immediately from assumptions (2) and (1).
\end{proof}

\begin{lemma}
\label{lemma-internal-hom-evaluate-tensor-isomorphism}
Let $R$ be a ring. Let $K, L, M$ be objects of $D(R)$. The map
$$
K \otimes_R^\mathbf{L} R\Hom_R(M, L) \longrightarrow
R\Hom_R(M, K \otimes_R^\mathbf{L} L)
$$
of Lemma \ref{lemma-internal-hom-diagonal-better}
is an isomorphism in the following cases
\begin{enumerate}
\item $M$ perfect, or
\item $K$ is perfect, or
\item $M$ is pseudo-coherent, $L \in D^+(R)$, and $K$ has
tor amplitude in $[a, \infty]$.
\end{enumerate}
\end{lemma}

\begin{proof}
Proof in case $M$ is perfect. Note that both sides of the arrow
transform distinguished triangles in $M$ into distinguished triangles
and commute with direct sums. Hence it suffices to check
it holds when $M = R[n]$, see
Derived Categories, Remark \ref{derived-remark-check-on-generator}
and Lemma \ref{lemma-perfect-ring-classical-generator}.
In this case the result is obvious.

\medskip\noindent
Proof in case $K$ is perfect. Same argument as in the previous case.

\medskip\noindent
Proof in case (3). We may represent $K$ and $L$ by
bounded below complexes of $R$-modules $K^\bullet$ and $L^\bullet$.
We may assume that $K^\bullet$ is a K-flat complex
consisting of flat $R$-modules, see
Lemma \ref{lemma-bounded-below-tor-amplitude}.
We may represent $M$ by a bounded above complex $M^\bullet$
of finite free $R$-modules, see Definition \ref{definition-pseudo-coherent}.
Then the object on the LHS is represented by
$$
\text{Tot}(K^\bullet \otimes_R \Hom^\bullet(M^\bullet, L^\bullet))
$$
and the object on the RHS by
$$
\Hom^\bullet(M^\bullet, \text{Tot}(K^\bullet \otimes_R L^\bullet))
$$
This uses Lemma \ref{lemma-RHom-out-of-projective}.
Both complexes have in degree $n$ the module
$$
\bigoplus\nolimits_{p + q + r = n} K^p \otimes \Hom_R(M^{-r}, L^q) =
\bigoplus\nolimits_{p + q + r = n} \Hom_R(M^{-r}, K^p \otimes_R L^q)
$$
because $M^{-r}$ is finite free (as well these are finite direct sums).
The map defined in Lemma \ref{lemma-internal-hom-diagonal-better}
comes from the map of complexes defined in
Lemma \ref{lemma-diagonal-better} which uses
the canonical isomorphisms between these modules.
\end{proof}

\begin{lemma}
\label{lemma-hom-complex-K-flat}
Let $R$ be a ring. Let $P^\bullet$ be a bounded above complex
of projective $R$-modules. Let $K^\bullet$ be a K-flat complex
of $R$-modules. If $P^\bullet$ is a perfect object of $D(R)$,
then $\Hom^\bullet(P^\bullet, K^\bullet)$ is K-flat and
represents $R\Hom_R(P^\bullet, K^\bullet)$.
\end{lemma}

\begin{proof}
The last statement is Lemma \ref{lemma-RHom-out-of-projective}.
Since $P^\bullet$ represents a perfect object, there exists a
finite complex of finite projective $R$-modules $F^\bullet$
such that $P^\bullet$ and $F^\bullet$ are isomorphic in $D(R)$, see
Definition \ref{definition-perfect}.
Then $P^\bullet$ and $F^\bullet$ are homotopy equivalent, see
Derived Categories, Lemma
\ref{derived-lemma-morphisms-from-projective-complex}.
Then $\Hom^\bullet(P^\bullet, K^\bullet)$
and $\Hom^\bullet(F^\bullet, K^\bullet)$
are homotopy equivalent. Hence the first is K-flat if and
only if the second is (follows from
Definition \ref{definition-K-flat} and
Lemma \ref{lemma-derived-tor-homotopy}).
It is clear that
$$
\Hom^\bullet(F^\bullet, K^\bullet) =
\text{Tot}(E^\bullet \otimes_R K^\bullet)
$$
where $E^\bullet$ is the dual complex to $F^\bullet$
with terms $E^n = \Hom_R(F^{-n}, R)$, see
Lemma \ref{lemma-dual-perfect-complex}
and its proof.
Since $E^\bullet$ is a bounded complex of projectives
we find that it is K-flat by Lemma \ref{lemma-derived-tor-quasi-isomorphism}.
Then we conclude by Lemma \ref{lemma-tensor-product-K-flat}.
\end{proof}






\section{Base change for derived hom}
\label{section-base-change-RHom}

\noindent
We have already seen some material discussing this in
Lemma \ref{lemma-pseudo-coherence-and-base-change-ext}
and in
Algebra, Section \ref{algebra-section-functoriality-ext}.

\begin{lemma}
\label{lemma-upgrade-adjoint-tensor-RHom}
Let $R \to R'$ be a ring map. For $K \in D(R)$ and
$M \in D(R')$ there is a canonical isomorphism
$$
R\Hom_R(K, M) = R\Hom_{R'}(K \otimes_R^\mathbf{L} R', M)
$$
\end{lemma}

\begin{proof}
Choose a K-injective complex of $R'$-modules $J^\bullet$ representing $M$. 
Choose a quasi-isomorphism $J^\bullet \to I^\bullet$ where $I^\bullet$
is a K-injective complex of $R$-modules. Choose a K-flat complex
$K^\bullet$ of $R$-modules representing $K$. Consider the map
$$
\Hom^\bullet(K^\bullet \otimes_R R', J^\bullet)
\longrightarrow
\Hom^\bullet(K^\bullet, I^\bullet)
$$
The map on degree $n$ terms is given by the map
$$
\prod\nolimits_{n = p + q} \Hom_{R'}(K^{-q} \otimes_R R', J^p)
\longrightarrow
\prod\nolimits_{n = p + q} \Hom_R(K^{-q}, I^p)
$$
coming from precomposing by $K^{-q} \to K^{-q} \otimes_R R'$
and postcomposing by $J^p \to I^p$. To finish the proof it suffices
to show that we get isomorphisms on cohomology groups:
$$
\Hom_{D(R)}(K, M) = \Hom_{D(R')}(K \otimes_R^\mathbf{L} R', M)
$$
which is true because base change $- \otimes_R^\mathbf{L} R' : D(R) \to D(R')$
is left adjoint to the restriction functor $D(R') \to D(R)$ by
Lemma \ref{lemma-tensor-hom-adjoint}.
\end{proof}

\noindent
Let $R \to R'$ be a ring map. There is a base change map
\begin{equation}
\label{equation-base-change-RHom}
R\Hom_R(K, M) \otimes_R^\mathbf{L} R'
\longrightarrow
R\Hom_{R'}(K \otimes_R^\mathbf{L} R', M \otimes_R^\mathbf{L} R')
\end{equation}
in $D(R')$ functorial in $K, M \in D(R)$. Namely, by adjointness of
$- \otimes_R^\mathbf{L} R' : D(R) \to D(R')$ and the restriction functor
$D(R') \to D(R)$, this is the same thing as a map
$$
R\Hom_R(K, M)
\longrightarrow
R\Hom_{R'}(K \otimes_R^\mathbf{L} R', M \otimes_R^\mathbf{L} R') =
R\Hom_R(K, M \otimes_R^\mathbf{L} R')
$$
(equality by Lemma \ref{lemma-upgrade-adjoint-tensor-RHom})
for which we can use the canonical map $M \to M \otimes_R^\mathbf{L} R'$
(unit of the adjunction).

\begin{lemma}
\label{lemma-base-change-RHom}
Let $R \to R'$ be a ring map. Let $K, M \in D(R)$. The map
(\ref{equation-base-change-RHom})
$$
R\Hom_R(K, M) \otimes_R^\mathbf{L} R'
\longrightarrow
R\Hom_{R'}(K \otimes_R^\mathbf{L} R', M \otimes_R^\mathbf{L} R')
$$
is an isomorphism in $D(R')$ in the following cases
\begin{enumerate}
\item $K$ is perfect,
\item $R'$ is perfect as an $R$-module,
\item $R \to R'$ is flat, $K$ is pseudo-coherent, and $M \in D^{+}(R)$, or
\item $R'$ has finite tor dimension as an $R$-module,
$K$ is pseudo-coherent, and $M \in D^{+}(R)$
\end{enumerate}
\end{lemma}

\begin{proof}
We may check the map is an isomorphism after applying the
restriction functor $D(R') \to D(R)$. After applying this
functor our map becomes the map
$$
R\Hom_R(K, L) \otimes_R^\mathbf{L} R'
\longrightarrow
R\Hom_R(K, L \otimes_R^\mathbf{L} R')
$$
of Lemma \ref{lemma-internal-hom-diagonal-better}.
See discussion above the lemma to match the left and right hand sides;
in particular, this uses Lemma \ref{lemma-upgrade-adjoint-tensor-RHom}.
Thus we conclude by
Lemma \ref{lemma-internal-hom-evaluate-tensor-isomorphism}.
\end{proof}





\section{Systems of modules}
\label{section-systems}

\noindent
Let $I$ be an ideal of a Noetherian ring $A$. In this section
we add to our knowledge of the relationship between finite modules
over $A$ and systems of finite $A/I^n$-modules.

\begin{lemma}
\label{lemma-consequence-Artin-Rees}
Let $I$ be an ideal of a Noetherian ring $A$. Let
$
K \xrightarrow{\alpha} L \xrightarrow{\beta} M
$
be a complex of finite $A$-modules. Set $H = \Ker(\beta)/\Im(\alpha)$.
For $n \geq 0$ let
$$
K/I^nK \xrightarrow{\alpha_n} L/I^nL \xrightarrow{\beta_n} M/I^nM
$$
be the induced complex. Set $H_n = \Ker(\beta_n)/\Im(\alpha_n)$.
Then there are canonical $A$-module maps giving a commutative diagram
$$
\xymatrix{
& & & H \ar[lld] \ar[ld] \ar[d] \\
\ldots \ar[r] & H_3 \ar[r] & H_2 \ar[r] & H_1
}
$$
Moreover, there exists a $c > 0$ and canonical $A$-module maps
$H_n \to H/I^{n - c}H$ for $n \geq c$ such that the compositions
$$
H/I^n H \to H_n \to  H/I^{n - c}H
\quad\text{and}\quad
H_n \to H/I^{n - c}H \to H_{n - c}
$$
are the canonical ones. Moreover, we have
\begin{enumerate}
\item $(H_n)$ and $(H/I^nH)$ are isomorphic as pro-objects of $\text{Mod}_A$,
\item $\lim H_n = \lim H/I^n H$,
\item the inverse system $(H_n)$ is Mittag-Leffler,
\item the image of $H_{n + c} \to H_n$ is equal to the image of $H \to H_n$,
\item the composition $I^cH_n \to H_n \to H/I^{n - c}H \to H_n/I^{n - c}H_n$
is the inclusion $I^cH_n \to H_n$ followed by the quotient map
$H_n \to H_n/I^{n - c}H_n$, and
\item the kernel and cokernel of $H/I^nH \to H_n$ is annihilated by $I^c$.
\end{enumerate}
\end{lemma}

\begin{proof}
Observe that $H_n = \beta^{-1}(I^nM)/\Im(\alpha) + I^nL$. For $n \geq 2$
we have $\beta^{-1}(I^nM) \subset \beta^{-1}(I^{n - 1}M)$ and
$\Im(\alpha) + I^nL \subset \Im(\alpha) + I^{n - 1}L$. Thus
we obtain our canonical map $H_n \to H_{n - 1}$. Similarly, we have
$\Ker(\beta) \subset \beta^{-1}(I^nM)$ and
$\Im(\alpha) \subset \Im(\alpha) + I^nL$ which produces the
canonical map $H \to H_n$. We omit the verification that the diagram
commutes.

\medskip\noindent
By Artin-Rees we may choose $c_1, c_2 \geq 0$ such that
$\beta^{-1}(I^nM) \subset \Ker(\beta) + I^{n - c_1}L$ for $n \geq c_1$ and
$\Ker(\beta) \cap I^nL \subset I^{n - c_2}\Ker(\beta)$ for $n \geq c_2$, see
Algebra, Lemmas \ref{algebra-lemma-map-AR} and
\ref{algebra-lemma-Artin-Rees}. Set $c = c_1 + c_2$.

\medskip\noindent
Let $n \geq c$. We define $\psi_n : H_n \to H/I^{n - c}H$ as follows.
Say $x \in H_n$. Choose $y \in \beta^{-1}(I^nM)$ representing $x$.
Write $y = z + w$ with $z \in \Ker(\beta)$ and $w \in I^{n - c_1}L$
(this is possible by our choice of $c_1$). We set $\psi_n(x)$
equal to the class of $z$ in $H/I^{n - c}H$. To see this is well defined,
suppose we have a second set of choices $y', z', w'$ as above for $x$
with obvious notation.
Then $y' - y \in \Im(\alpha) + I^nL$, say $y' - y = \alpha(v) + u$
with $v \in K$ and $u \in I^nL$. Thus
$$
y' = z' + w' = \alpha(v) + u + z + w
\Rightarrow
z' = z + \alpha(v) + u + w - w'
$$
Since $\beta(z' - z - \alpha(v)) = 0$ we find that
$u + w - w' \in \Ker(\beta) \cap I^{n - c_1}L$
which is contained in $I^{n - c_1 - c_2}\Ker(\beta) = I^{n - c}\Ker(\beta)$
by our choice of $c_2$. Thus $z'$ and $z$ have the same image in
$H/I^{n - c}H$ as desired.

\medskip\noindent
The composition $H/I^n H \to H_n \to  H/I^{n - c}H$ is the canonical map
because if $z \in \Ker(\beta)$ represents an element $x$ in
$H/I^nH = \Ker(\beta)/\Im(\alpha) + I^n\Ker(\beta)$ then it is clear
from the above that $x$ maps to the class of $z$ in $H/I^{n - c}H$
under the maps constructed above.

\medskip\noindent
Let us consider the composition $H_n \to H/I^{n - c}H \to H_{n - c}$.
Given $x, y, z, w$ as in the construction of $\psi_n$ above, we see
that $x$ is mapped to the cass of $z$ in $H_{n - c}$. On the other hand,
the canonical map $H_n \to H_{n - c}$ from the first paragraph of the
proof sends $x$ to the class of $y$. Thus we have to show that
$y - z \in \Im(\alpha) + I^{n - c}L$ which is the case because
$y - z = w \in I^{n - c_1}L \subset I^{n - c}L$.

\medskip\noindent
Statements (1) -- (4) are formal consequences of what we just proved.
Namely, (1) follows from the existence of the maps and the definition
of morphisms of pro-objects in
Categories, Remark \ref{categories-remark-pro-category}.
Part (2) holds because isomorphic pro-objects have isomorphic limits.
Part (3) is immediate from part (4).
Part (4) follows from the factorization
$H_{n + c} \to H/I^nH \to H_n$ of the canonical map
$H_{n + c} \to H_n$.

\medskip\noindent
Proof of part (5). Let $x \in I^cH_n$. Write $x = \sum f_i x_i$ with
$x_i \in H_n$ and $f_i \in I^c$. Choose $y_i, z_i, w_i$ as in the
construction of $\psi_n$ for $x_i$. Then for the computation of
$\psi_n$ of $x$ we may choose
$y = \sum f_iy_i$, $z = \sum f_i z_i$ and $w = \sum f_i w_i$
and we see that $\psi_n(x)$ is given by the class of $z$.
The image of this in $H_n/I^{n - c}H_n$ is equal to the class
of $y$ as $w = \sum f_i w_i$ is in $I^nL$. This proves (5).

\medskip\noindent
Proof of part (6). Let $y \in \Ker(\beta)$ whose class is $x$ in $H$.
If $x$ maps to zero in $H_n$, then $y \in I^nL + \Im(\alpha)$.
Hence $y - \alpha(v) \in \Ker(\beta) \cap I^nL$ for some $v \in K$.
Then $y - \alpha(v) \in I^{n - c_2}\Ker(\beta)$ and hence the class
of $y$ in $H/I^nH$ is annihilated by $I^{c_2}$. Finally, let $x \in H_n$
be the class of $y \in \beta^{-1}(I^nM)$. Then we write $y = z + w$
with $z \in \Ker(\beta)$ and $w \in I^{n - c_1}L$ as above. Clearly, if
$f \in I^{c_1}$ then $fx$ is the class of
$fy + fw \equiv fy$ modulo $\Im(\alpha) + I^nL$ and hence $fx$ is
the image of the class of $fy$ in $H$ as desired.
\end{proof}

\begin{lemma}
\label{lemma-kollar-kovacs-pseudo-coherent}
\begin{reference}
Email from Kovacs of 23/02/2018.
\end{reference}
Let $I$ be an ideal of a Noetherian ring $A$. Let $K \in D(A)$
be pseudo-coherent. Set $K_n = K \otimes_A^\mathbf{L} A/I^n$.
Then for all $i \in \mathbf{Z}$ the system $H^i(K_n)$
satisfies Mittag-Leffler and $\lim H^i(K)/I^nH^i(K)$ is equal to
$\lim H^i(K_n)$.
\end{lemma}

\begin{proof}
We may represent $K$ by a bounded above complex $P^\bullet$ of
finite free $A$-modules. Then $K_n$ is represented by
$P^\bullet/I^nP^\bullet$. Hence the Mittag-Leffler property
by Lemma \ref{lemma-consequence-Artin-Rees}.
The final statement follows then from
Lemma \ref{lemma-kollar-kovacs}.
\end{proof}

\begin{lemma}
\label{lemma-derived-completion-plain-completion}
Let $A$ be a Noetherian ring. Let $I \subset A$ be an ideal. Let
$M^\bullet$ be a bounded complex of finite $A$-modules. The
inverse system of maps
$$
M^\bullet \otimes_A^\mathbf{L} A/I^n \longrightarrow M^\bullet/I^nM^\bullet
$$
defines an isomorphism of pro-objects of $D(A)$.
\end{lemma}

\begin{proof}
Say $I = (f_1, \ldots, f_r)$.
Let $K_n \in D(A)$ be the object represented by the Koszul complex
on $f_1^n, \ldots, f_r^n$. Recall that we have maps $K_n \to A/I^n$
which induce a pro-isomorphism of inverse systems, see
Lemma \ref{lemma-sequence-Koszul-complexes}.
Hence it suffices to show that
$$
M^\bullet \otimes_A^\mathbf{L} K_n \longrightarrow M^\bullet/I^nM^\bullet
$$
defines an isomorphism of pro-objects of $D(A)$. Since $K_n$ is represented
by a complex of finite free $A$-modules sitting in degrees $-r, \ldots, 0$
there exist $a, b \in \mathbf{Z}$ such that
the source and target of the displayed arrow have vanishing cohomology
in degrees outside $[a, b]$ for all $n$. Thus we may apply
Derived Categories, Lemma \ref{derived-lemma-pro-isomorphism-bis}
and we find that it suffices to show that the maps
$$
H^i(M^\bullet \otimes_A^\mathbf{L} A/I^n) \to H^i(M^\bullet/I^nM^\bullet)
$$
define isomorphisms of pro-systems of $A$-modules for any $i \in \mathbf{Z}$.
To see this choose a quasi-isomorphism
$P^\bullet \to M^\bullet$ where $P^\bullet$ is a bounded
above complex of finite free $A$-modules. The arrows above are
given by the maps
$$
H^i(P^\bullet/I^nP^\bullet) \to H^i(M^\bullet/I^nM^\bullet)
$$
These define an isomorphism of pro-systems by
Lemma \ref{lemma-consequence-Artin-Rees}. Namely,
the lemma shows both are isomorphic to the pro-system $H^i/I^nH^i$
with $H^i = H^i(M^\bullet) = H^i(P^\bullet)$.
\end{proof}

\begin{lemma}
\label{lemma-hom-systems-ML}
Let $A$ be a Noetherian ring. Let $I \subset A$ be an ideal. Let $M$, $N$ be
finite $A$-modules. Set $M_n = M/I^nM$ and $N_n = N/I^nN$. Then
\begin{enumerate}
\item the systems $(\Hom_A(M_n, N_n))$ and $(\text{Isom}_A(M_n, N_n))$
are Mittag-Leffler,
\item there exists a $c \geq 0$ such that the kernels and cokernels of
$$
\Hom_A(M, N)/I^n\Hom_A(M, N) \to \Hom_A(M_n, N_n)
$$
are killed by $I^c$ for all $n$,
\item we have
$\lim \Hom_A(M_n, N_n) =\Hom_A(M, N)^\wedge =
\Hom_{A^\wedge}(M^\wedge, N^\wedge)$
\item $\lim \text{Isom}_A(M_n, N_n) =
\text{Isom}_{A^\wedge}(M^\wedge, N^\wedge)$.
\end{enumerate}
Here ${}^\wedge$ denotes usual $I$-adic completion.
\end{lemma}

\begin{proof}
Note that $\Hom_A(M_n, N_n) = \Hom_A(M, N_n)$. Choose a presentation
$$
A^{\oplus t} \to A^{\oplus s} \to M \to 0
$$
Applying the right exact functor $\Hom_A(-, N)$ we obtain a complex
$$
0 \xrightarrow{\alpha} N^{\oplus s} \xrightarrow{\beta} N^{\oplus t}
$$
whose cohomology in the middle is $\Hom_A(M, N)$ and such that for
$n \geq 0$ the cohomology of
$$
0 \xrightarrow{\alpha_n} N_n^{\oplus s} \xrightarrow{\beta_n} N_n^{\oplus t}
$$
is $\Hom_A(M_n, N_n)$. Let $c \geq 0$ be as in
Lemma \ref{lemma-consequence-Artin-Rees}
for this $A$, $I$, $\alpha$, and $\beta$.
By part (3) of the lemma
we deduce the Mittag-Leffler property for $(\Hom_A(M_n, N_n))$.
The kernel and cokernel of the maps
$\Hom_A(M, N)/I^n\Hom_A(M, N) \to \Hom_A(M_n, N_n)$
are killed by $I^c$ by [art part (6) of the lemma.
We find that $\lim \Hom_A(M_n, N_n) = \Hom_A(M, N)^\wedge$ by
part (2) of the lemma. The equality
$$
\Hom_{A^\wedge}(M^\wedge, N^\wedge) = \lim \Hom_A(M_n, N_n)
$$
follows formally from the fact that $M^\wedge = \lim M_n$ and
$M_n = M^\wedge/I^nM^\wedge$ and the corresponding facts for $N$, see
Algebra, Lemma \ref{algebra-lemma-completion-complete}.

\medskip\noindent
The result for isomorphisms follows from the case of homomorphisms
applied to both $(\Hom(M_n, N_n))$ and $(\Hom(N_n, M_n))$
and the following fact: for $n > m > 0$, if we have maps
$\alpha : M_n \to N_n$ and $\beta : N_n \to M_n$ which
induce an isomorphisms $M_m \to N_m$ and $N_m \to M_m$, then
$\alpha$ and $\beta$ are isomorphisms. Namely, then $\alpha \circ \beta$
is surjective by Nakayama's lemma (Algebra, Lemma \ref{algebra-lemma-NAK})
hence $\alpha \circ \beta$ is an isomorphism by
Algebra, Lemma \ref{algebra-lemma-fun}.
\end{proof}

\begin{lemma}
\label{lemma-isomorphic-completions}
Let $A$ be a Noetherian ring. Let $I \subset A$ be an ideal. Let $M$, $N$ be
finite $A$-modules. Set $M_n = M/I^nM$ and $N_n = N/I^nN$. If
$M_n \cong N_n$ for all $n$, then $M^\wedge \cong N^\wedge$
as $A^\wedge$-modules.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-hom-systems-ML} the system $(\text{Isom}_A(M_n, N_n))$
is Mittag-Leffler. By assumption each of the sets
$\text{Isom}_A(M_n, N_n)$ is nonempty. Hence $\lim \text{Isom}_A(M_n, N_n)$
is nonempty. Since
$\lim \text{Isom}_A(M_n, N_n) = \text{Isom}_{A^\wedge}(M^\wedge, N^\wedge)$
we obtain an isomorphism.
\end{proof}

\begin{remark}
\label{remark-weird-systems}
Let $I$ be an ideal of a Noetherian ring $A$. Set $A_n = A/I^n$ for $n \geq 1$.
Consider the following category:
\begin{enumerate}
\item An object is a sequence $\{E_n\}_{n \geq 1}$ where $E_n$ is a finite
$A_n$-module.
\item A morphism $\{E_n\} \to \{E'_n\}$ is given by maps
$$
\varphi_n : I^cE_n \longrightarrow E'_n/E'_n[I^c]
\quad\text{for }n \geq c
$$
where $E'_n[I^c]$ is the torsion submodule (Section \ref{section-torsion})
up to equivalence: we say $(c, \varphi_n)$ is the same as
$(c + 1, \overline{\varphi}_n)$ where
$\overline{\varphi}_n : I^{c + 1}E_n \longrightarrow E'_n/E'_n[I^{c + 1}]$
is the induced map.
\end{enumerate}
Composition of $(c, \varphi_n) : \{E_n\} \to \{E'_n\}$
and $(c', \varphi'_n) : \{E'_n\} \to \{E''_n\}$
is defined by the obvious compositions
$$
I^{c + c'}E_n \to I^{c'}E'_n/E'_n[I^{c}] \to E''_n/E''_n[I^{c + c'}]
$$
for $n \geq c + c'$. We omit the verification that this is a category.
\end{remark}

\begin{lemma}
\label{lemma-iso}
A morphism $(c, \varphi_n)$ of the category of
Remark \ref{remark-weird-systems} is an
isomorphism if and only if there exists a $c' \geq 0$ such that
$\Ker(\varphi_n)$ and $\Coker(\varphi_n)$ are $I^{c'}$-torsion for
all $n \gg 0$.
\end{lemma}

\begin{proof}
We may and do assume $c' \geq c$ and that the
$\Ker(\varphi_n)$ and $\Coker(\varphi_n)$ are $I^{c'}$-torsion
for all $n$. For $n \geq c'$ and
$x \in I^{c'}E'_n$ we can choose $y \in I^cE_n$ with
$x = \varphi_n(y) \bmod E'_n[I^c]$ as $\Coker(\varphi_n)$
is annihilated by $I^{c'}$. Set $\psi_n(x)$ equal to the class of
$y$ in $E_n/E_n[I^{c'}]$. For a different choice $y' \in I^cE_n$
with $x = \varphi_n(y') \bmod E'_n[I^c]$ the difference
$y - y'$ maps to zero in $E'_n/E'_n[I^c]$ and hence is
annihilated by $I^{c'}$ in $I^cE_n$. Thus the maps
$\psi_n : I^{c'}E'_n \to E_n/E_n[I^{c'}]$
are well defined.
We omit the verification that $(c', \psi_n)$ is the inverse of
$(c, \varphi_n)$ in the category.
\end{proof}

\begin{lemma}
\label{lemma-dejong-kollar-kovacs}
\begin{reference}
Email correspondence between Janos Kollar, Sandor Kovacs, and
Johan de Jong of 23/02/2018.
\end{reference}
Let $I$ be an ideal of the Noetherian ring $A$. Let $M$ and $N$
be finite $A$-modules. Write $A_n = A/I^n$, $M_n = M/I^nM$, and
$N_n = N/I^nN$.
For every $i \geq 0$ the objects
$$
\{\Ext^i_A(M, N)/I^n\Ext^i_A(M, N)\}_{n \geq 1}
\quad\text{and}\quad
\{\Ext^i_{A_n}(M_n, N_n)\}_{n \geq 1}
$$
are isomorphic in the category $\mathcal{C}$ of
Remark \ref{remark-weird-systems}.
\end{lemma}

\begin{proof}
Choose a short exact sequence
$$
0 \to K \to A^{\oplus r} \to M \to 0
$$
and set $K_n = K/I^nK$.
For $n \geq 1$ define $K(n) = \Ker(A_n^{\oplus r} \to M_n)$
so that we have exact sequences
$$
0 \to K(n) \to A_n^{\oplus r} \to M_n \to 0
$$
and surjections $K_n \to K(n)$. In fact, by
Lemma \ref{lemma-consequence-Artin-Rees}
there is a $c \geq 0$ and maps $K(n) \to K_n/I^{n - c}K_n$
which are ``almost inverse''.
Since $I^{n - c}K_n \subset K_n[I^c]$ these maps which witness the fact that
the systems $\{K(n)\}_{n \geq 1}$ and $\{K_n\}_{n \geq 1}$
are isomorphic in $\mathcal{C}$.

\medskip\noindent
We claim the systems
$$
\{\Ext^i_{A_n}(K(n), N_n)\}_{n \geq 1}
\quad\text{and}\quad
\{\Ext^i_{A_n}(K_n, N_n)\}_{n \geq 1}
$$
are isomorphic in the category $\mathcal{C}$. Namely, the surjective maps
$K_n \to K(n)$ have kernels annihilated by $I^c$ and therefore determine maps
$$
\Ext^i_{A_n}(K(n), N_n) \to \Ext^i_{A_n}(K_n, N_n)
$$
whose kernel and cokernel are annihilated by $I^c$. Hence the claim
by Lemma \ref{lemma-iso}.

\medskip\noindent
For $i \geq 2$ we have isomorphisms
$$
\Ext^{i - 1}_A(K, N) = \Ext^i_A(M, N)
\quad\text{and}\quad
\Ext^{i - 1}_{A_n}(K(n), N_n) = \Ext^i_{A_n}(M_n, N_n)
$$
In this way we see that it suffices to prove the lemma
for $i = 0, 1$.

\medskip\noindent
For $i = 0, 1$ we consider the commutative diagram
$$
\xymatrix{
0 \ar[r] &
\Hom(M, N) \ar[r] \ar[dd] &
N^{\oplus r} \ar[r]_-\varphi \ar[dd] &
\Hom(K, N) \ar[r] \ar[d] &
\Ext^1(M, N) \ar[r] &
0 \\
& & &
\Hom(K_n, N_n)
\\
0 \ar[r] &
\Hom(M_n, N_n) \ar[r] &
N_n^{\oplus r} \ar[r] &
\Hom(K(n), N_n) \ar[r] \ar[u] &
\Ext^1(M_n, N_n) \ar[r] &
0
}
$$
By Lemma \ref{lemma-hom-systems-ML} we see that the kernel and cokernel of
$\Hom(M, N)/I^n \Hom(M, N) \to \Hom(M_n, N_n)$ and
$\Hom(K, N)/I^n \Hom(K, N) \to \Hom(K_n, N_n)$ and
are $I^c$-torsion for some $c \geq 0$ independent of $n$.
Above we have seen the cokernel of the injective maps
$\Hom(K(n), N_n) \to \Hom(K_n, N_n)$ are annihilated by $I^c$
after possibly increasing $c$. For such a $c$ we obtain maps
$\delta_n : I^c\Hom(K, N)/I^n\Hom(K, N) \to \Hom(K(n), N_n)$
fitting into the diagram (precise formulation omitted).
The kernel and cokernel of $\delta_n$ are annihilated by
$I^c$ after possibly increasing $c$ since we know that the
same thing is true for $\Hom(K, N)/I^n \Hom(K, N) \to \Hom(K_n, N_n)$
and $\Hom(K(n), N_n) \to \Hom(K_n, N_n)$.
Then we can use commutativity of the solid diagram
$$
\xymatrix{
\varphi^{-1}(I^c\Hom(K, N)) \ar[r]_-\varphi \ar[d] &
I^c\Hom(K, N)/I^n\Hom(K, N) \ar[r] \ar[d]^{\delta_n} &
I^c\Ext^1(M, N)/I^n\Ext^1(M, N) \ar[r] \ar@{..>}[d] & 0 \\
N_n^{\oplus r} \ar[r] &
\Hom(K(n), N_n) \ar[r] &
\Ext^1(M_n, N_n) \ar[r] & 0
}
$$
to define the dotted arrow. A straightforward diagram chase
(omitted) shows that the kernel and cokernel of the
dotted arrow are annihilated buy $I^c$ after possibly
increasing $c$ one final time.
\end{proof}

\begin{remark}
\label{remark-awkward}
The awkwardness in the statement of Lemma \ref{lemma-dejong-kollar-kovacs}
is partly due to the fact that there are no
obvious maps between the modules $\Ext^i_{A_n}(M_n, N_n)$
for varying $n$. What we may conclude from the
lemma is that there exists a $c \geq 0$ such that
for $m \gg n \gg 0$ there are (canonical) maps
$$
I^c\Ext^i_{A_n}(M_m, N_m)/I^n\Ext^i_{A_n}(M_m, N_m) \to
\Ext^i_{A_n}(M_n, N_n)/\Ext^i_{A_n}(M_n, N_n)[I^c]
$$
whose kernel and cokernel are annihilated by $I^c$.
This is the (weak) sense in which we get a system of modules.
\end{remark}

\begin{example}
\label{example-has-to-be-awkward}
Let $k$ be a field. Let $A = k[[x, y]]/(xy)$. By abuse of notation we denote
$x$ and $y$ the images of $x$ and $y$ in $A$. Let $I = (x)$. Let $M = A/(y)$.
There is a free resolution
$$
\ldots \to
A \xrightarrow{y}
A \xrightarrow{x}
A \xrightarrow{y} A \to M \to 0
$$
We conclude that
$$
\Ext^2_A(M, N) = N[y]/xN
$$
where $N[y] = \Ker(y : N \to N)$. We denote
$A_n = A/I^n$, $M_n = M/I^nM$, and $N_n = N/I^nN$.
For each $n$ we have a free resolution
$$
\ldots \to
A_n^{\oplus 2} \xrightarrow{y, x^{n - 1}}
A_n \xrightarrow{x}
A_n \xrightarrow{y} A_n \to M_n \to 0
$$
We conclude that
$$
\Ext^2_{A_n}(M_n, N_n) = (N_n[y] \cap N_n[x^{n - 1}])/xN_n
$$
where $N_n[y] = \Ker(y : N_n \to N_n)$ and
$N[x^{n - 1}] = \Ker(x^{n - 1} : N_n \to N_n)$.
Take $N = A/(y)$. Then we see that
$$
\Ext^2_A(M, N) = N[y]/xN = N/xN \cong k
$$
but
$$
\Ext^2_{A_n}(M_n, N_n) = (N_n[y] \cap N_n[x^{n - 1}])/xN_n =
N_n[x^{n - 1}]/xN_n = 0
$$
for all $r$ because $N_n = k[x]/(x^n)$ and the sequence
$$
N_n \xrightarrow{x} N_n \xrightarrow{x^{n - 1}} N_n
$$
is exact. Thus ignoring some kind of $I$-power torsion is necessary
to get a result as in Lemma \ref{lemma-dejong-kollar-kovacs}.
\end{example}

\begin{lemma}
\label{lemma-not-awkward}
\begin{reference}
Email correspondence between Janos Kollar, Sandor Kovacs, and
Johan de Jong of 23/02/2018.
\end{reference}
Let $A \to B$ be a flat homomorphism of Noetherian rings.
Let $I \subset A$ be an ideal. Let $M, N$ be $A$-modules.
Set $B_n = B/I^nB$, $M_n = M/I^nM$, $N_n = N/I^nN$.
If $M$ is flat over $A$, then we have
$$
\lim \Ext^i_B(M, N)/I^n \Ext^i_B(M, N) =
\lim \Ext^i_{B_n}(M_n, N_n)
$$
for all $i \in \mathbf{Z}$.
\end{lemma}

\begin{proof}
Choose a resolution
$$
\ldots \to P_2 \to P_1 \to P_0 \to M \to 0
$$
by finite free $B$-modues $P_i$. Set $P_{i, n} = P_i/I^nP_i$.
Since $M$ and $B$ are flat over $A$, the sequence
$$
\ldots \to P_{2, n} \to P_{1, n} \to P_{0, n} \to M_n \to 0
$$
is exact. We see that on the one hand the complex
$$
\Hom_B(P_0, N) \to \Hom_B(P_1, N) \to \Hom_B(P_2, N) \to \ldots
$$
computes the modules $\Ext^i_B(M, N)$ and on the other hand the complex
$$
\Hom_{B_n}(P_{0, n}, N_n) \to \Hom_{B_n}(P_{1, n}, N_n) \to
\Hom_{B_n}(P_{2, n}, N_n) \to \ldots
$$
computes the modules $\Ext^i_{B_n}(M_n, N_n)$. Since
$$
\Hom_{B_n}(P_{i, n}, N_n) = \Hom_B(P_i, N)/I^n \Hom_B(P_i, N)
$$
we obtain the result from
Lemma \ref{lemma-consequence-Artin-Rees} part (2).
\end{proof}








\section{Systems of modules, bis}
\label{section-systems-bis}

\noindent
Let $I$ be an ideal of a Noetherian ring $A$.
In Section \ref{section-systems} we considered what happens
when considering systems of the form $M/I^nM$ for
finite $A$-modules $M$. In this section we consider the
systems $I^nM$ instead.

\begin{lemma}
\label{lemma-consequence-Artin-Rees-bis}
Let $I$ be an ideal of a Noetherian ring $A$. Let
$
K \xrightarrow{\alpha} L \xrightarrow{\beta} M
$
be a complex of finite $A$-modules. Set $H = \Ker(\beta)/\Im(\alpha)$.
For $n \geq 0$ let
$$
I^nK \xrightarrow{\alpha_n} I^nL \xrightarrow{\beta_n} I^nM
$$
be the induced complex. Set $H_n = \Ker(\beta_n)/\Im(\alpha_n)$.
Then there are canonical $A$-module maps
$$
\ldots \to H_3 \to H_2 \to H_1 \to H
$$
There exists a $c > 0$ such that for $n \geq c$ the image of $H_n \to H$ is
contained in $I^{n - c}H$ and there is a canonical $A$-module map
$I^nH \to H_{n - c}$ such that the compositions
$$
I^n H \to H_{n - c} \to  I^{n - 2c}H
\quad\text{and}\quad
H_n \to I^{n - c}H \to H_{n - 2c}
$$
are the canonical ones. In particular, the inverse systems
$(H_n)$ and $(I^nH)$ are isomorphic as pro-objects of $\text{Mod}_A$.
\end{lemma}

\begin{proof}
We have $H_n = \Ker(\beta) \cap I^nL/\alpha(I^nK)$.
Since $\Ker(\beta) \cap I^nL \subset \Ker(\beta) \cap I^{n - 1}L$
and $\alpha(I^nK) \subset \alpha(I^{n - 1}K)$ we get the maps
$H_n \to H_{n - 1}$. Similarly for the map $H_1 \to H$.

\medskip\noindent
By Artin-Rees we may choose $c_1, c_2 \geq 0$ such that
$\Im(\alpha) \cap I^nL \subset \alpha(I^{n - c_1}K)$ for $n \geq c_1$ and
$\Ker(\beta) \cap I^nL \subset I^{n - c_2}\Ker(\beta)$ for $n \geq c_2$, see
Algebra, Lemmas \ref{algebra-lemma-map-AR} and
\ref{algebra-lemma-Artin-Rees}. Set $c = c_1 + c_2$.

\medskip\noindent
It follows immediately from our choice of $c \geq c_2$ that for $n \geq c$
the image of $H_n \to H$ is contained in $I^{n - c}H$.

\medskip\noindent
Let $n \geq c$. We define $\psi_n : I^nH \to H_{n - c}$ as follows.
Say $x \in I^nH$. Choose $y \in I^n\Ker(\beta)$ representing $x$.
We set $\psi_n(x)$ equal to the class of $y$ in $H_{n - c}$.
To see this is well defined, suppose we have a second choice $y'$
as above for $x$. Then $y' - y \in \Im(\alpha)$. By our choice of
$c \geq c_1$ we conclude that $y' - y \in \alpha(I^{n - c}K)$
which implies that $y$ and $y'$ represent the same element of $H_{n - c}$.
Thus $\psi_n$ is well defined.

\medskip\noindent
The statements on the compositions $I^n H \to H_{n - c} \to  I^{n - 2c}H$
and $H_n \to I^{n - c}H \to H_{n - 2c}$ follow immediately from our
definitions.
\end{proof}

\begin{lemma}
\label{lemma-ext-factors}
Let $A$ be a Noetherian ring. Let $I \subset A$ be an ideal.
Let $M$, $N$ be $A$-modules with $M$ finite. For each $p > 0$ there exists a
$c \geq 0$ such that for $n \geq c$ the map
$\Ext_A^p(M, N) \to \Ext_A^p(I^nM, N)$
factors through $\Ext^p_A(I^nM, I^{n - c}N) \to \Ext_A^p(I^nM, N)$.
\end{lemma}

\begin{proof}
For $p = 0$, if $\varphi : M \to N$ is an $A$-linear map, then
$\varphi(\sum f_i m_i) = \sum f_i \varphi(m_i)$ for $f_i \in A$
and $m_i \in M$. Hence $\varphi$ induces a map $I^nM \to I^nN$
for all $n$ and the result is true with $c = 0$.

\medskip\noindent
Choose a short exact sequence $0 \to K \to A^{\oplus t} \to M \to 0$.
For each $n$ we pick a short exact sequence
$0 \to L_n \to A^{\oplus s_n} \to I^nM \to 0$.
It is clear that we can construct a map of short exact sequences
$$
\xymatrix{
0 \ar[r] &
L_n \ar[r] \ar[d] &
A^{\oplus s_n} \ar[r] \ar[d] &
I^nM \ar[r] \ar[d] & 0 \\
0 \ar[r] &
K \ar[r] &
A^{\oplus t} \ar[r] &
M \ar[r] & 0
}
$$
such that $A^{\oplus s_n} \to A^{\oplus t}$ has image in $(I^n)^{\oplus t}$.
By Artin-Rees (Algebra, Lemma \ref{algebra-lemma-Artin-Rees}) there exists
a $c \geq 0$ such that $L_n \to K$ factors through $I^{n - c}K$ if $n \geq c$.

\medskip\noindent
For $p = 1$ our choices above induce a solid commutative diagram
$$
\xymatrix{
\Hom_A(A^{\oplus s_n}, N) \ar[r] &
\Hom_A(L_n, N) \ar[r] &
\Ext_A^1(I^nM, N) \ar[r] & 0 \\
\Hom_A((I^n)^{\oplus t}, I^{n - c}N) \ar[r] \ar[u] &
\Hom_A(K \cap (I^n)^{\oplus t}, I^{n - c}N) \ar[r] \ar[u] &
\Ext_A^1(I^nM, I^{n - c}N) \ar[u] \\
\Hom_A(A^{\oplus t}, N) \ar[r] \ar[u] &
\Hom_A(K, N) \ar[r] \ar[u] &
\Ext_A^1(M, N) \ar@{..>}[u] \ar[r] & 0
}
$$
whose horizontal arrows are exact. The lower middle vertical arrow
arises because $K \cap (I^n)^{\oplus t} \subset I^{n - c}K$
and hence any $A$-linear map $K \to N$ induces an $A$-linear map
$(I^n)^{\oplus t} \to I^{n - c}N$ by the argument of the first paragraph.
Thus we obtain the dotted arrow as desired.

\medskip\noindent
For $p > 1$ we obtain a commutative diagram
$$
\xymatrix{
\Ext^{p - 1}_A(I^{n - c}K, N) \ar[r] &
\Ext^{p - 1}_A(L_n, N) \ar[r] &
\Ext_A^p(I^nM, N) \\
\Ext^{p - 1}_A(K, N) \ar[rr] \ar[u] & &
\Ext_A^p(M, N) \ar[u]
}
$$
whose bottom horizontal arrow is an isomorphism. By induction
on $p$ the left vertical map factors through
$\Ext^{p - 1}_A(I^{n - c}K, I^{n - c - c'}N)$ for some $c' \geq 0$
and all $n \geq c + c'$. Using the composition
$\Ext^{p - 1}_A(I^{n - c}K, I^{n - c - c'}N) \to
\Ext^{p - 1}_A(L_n, I^{n - c - c'}N) \to \Ext^p_A(I^nM, I^{n - c - c'}N)$
we obtain the desired factorization (for $n \geq c + c'$ and with $c$
replaced by $c + c'$).
\end{proof}

\begin{lemma}
\label{lemma-ext-annihilated}
Let $A$ be a Noetherian ring. Let $I \subset A$ be an ideal. Let $M$, $N$
be $A$-modules with $M$ finite and $N$ annihilated by a power of $I$.
For each $p > 0$ there exists an $n$ such that the map
$\Ext_A^p(M, N) \to \Ext_A^p(I^nM, N)$ is zero.
\end{lemma}

\begin{proof}
Immediate consequence of Lemma \ref{lemma-ext-factors} and the fact that
$I^mN = 0$ for some $m > 0$.
\end{proof}

\begin{lemma}
\label{lemma-ext-induced-toplogy}
Let $A$ be a Noetherian ring. Let $I \subset A$ be an ideal.
Let $K \in D(A)$ be pseudo-coherent and let $M$ be a finite
$A$-module. For each $p \in \mathbf{Z}$ there exists an $c$
such that the image of $\Ext_A^p(K, I^nM) \to \Ext_A^p(K, M)$
is contained in $I^{n - c}\Ext_A^p(K, M)$ for $n \geq c$.
\end{lemma}

\begin{proof}
Choose a bounded above complex $P^\bullet$ of finite free $A$-modules
representing $K$. Then $\Ext_A^p(K, M)$ is the cohomology of
$$
\Hom_A(F^{-p + 1}, M) \xrightarrow{a}
\Hom_A(F^{-p}, M) \xrightarrow{b}
\Hom_A(F^{-p - 1}, M)
$$
and $\Ext_A^p(K, I^nM)$ is computed by replacing these finite $A$-modules
by $I^n$ times themselves. Thus the result by
Lemma \ref{lemma-consequence-Artin-Rees-bis}
(and much more is true).
\end{proof}

\noindent
In Situation \ref{situation-koszul} we define complexes $I_n^\bullet$
such that we have distinguished triangles
$$
I_n^\bullet \to A \to K_n^\bullet \to I_n^\bullet[1]
$$
in the triangulated category $K(A)$ of complexes of $A$-modules up to
homotopy. Namely, we set $I_n^\bullet = \sigma_{\leq -1}K_n^\bullet[-1]$.
We have termwise split short exact sequences of complexes
$$
0 \to A \to K_n^\bullet \to I_n^\bullet[1] \to 0
$$
defining distinguished triangles by definition of the triangulated
structure on $K(A)$. Their rotations determine the desired
distinguished triangles above. Note that $I_n^0 = A^{\oplus r} \to A$
is given by multiplication by $f_i^n$ on the $i$th factor.
Hence $I_n^\bullet \to A$ factors as
$$
I_n^\bullet \to (f_1^n, \ldots, f_r^n) \to A
$$
In fact, there is a short exact sequence
$$
0 \to H^{-1}(K_n^\bullet) \to H^0(I_n^\bullet) \to (f_1^n, \ldots, f_r^n) \to 0
$$
and for every $i < 0$ we have $H^i(I_n^\bullet) = H^{i - 1}(K_n^\bullet$.
The maps $K_{n + 1}^\bullet \to K_n^\bullet$ induce maps
$I_{n + 1}^\bullet \to I_n^\bullet$ and we obtain a commutative diagram
$$
\xymatrix{
\ldots \ar[r] &
I_3^\bullet \ar[d] \ar[r] &
I_2^\bullet \ar[d] \ar[r] &
I_1^\bullet \ar[d] \\
\ldots \ar[r] &
(f_1^3, \ldots, f_r^3) \ar[r] &
(f_1^2, \ldots, f_r^2) \ar[r] &
(f_1, \ldots, f_r)
}
$$
in $K(A)$.

\begin{lemma}
\label{lemma-sequence-powers-pro-bounded}
In Situation \ref{situation-koszul} assume $A$ is Noetherian. With
notation as above, the inverse system $(I^n)$ is pro-isomorphic
in $D(A)$ to the inverse system $(I_n^\bullet)$.
\end{lemma}

\begin{proof}
It is elementary to show that the inverse system $I^n$ is pro-isomorphic
to the inverse system $(f_1^n, \ldots, f_r^n)$ in the category of $A$-modules.
Consider the inverse system of distinguished triangles
$$
I_n^\bullet \to (f_1^n, \ldots, f_r^n) \to C_n^\bullet \to I_n^\bullet[1]
$$
where $C_n^\bullet$ is the cone of the first arrow. By
Derived Categories, Lemma \ref{derived-lemma-pro-isomorphism}
it suffices to show that the inverse system $C_n^\bullet$ is pro-zero.
The complex $I_n^\bullet$ has nonzero terms only in degrees
$i$ with $-r + 1 \leq i \leq 0$ hence $C_n^\bullet$ is bounded
similarly. Thus by
Derived Categories, Lemma \ref{derived-lemma-essentially-constant-cohomology}
it suffices to show that $H^p(C_n^\bullet)$ is pro-zero. By the discussion
above we have $H^p(C_n^\bullet) = H^p(K_n^\bullet)$ for $p \leq -1$ and
$H^p(C_n^\bullet) = 0$ for $p \geq 0$.
The fact that the inverse systems $H^p(K_n^\bullet)$ are pro-zero
was shown in the proof of Lemma \ref{lemma-sequence-Koszul-complexes}
(and this is where the assumption that $A$ is Noetherian is used).
\end{proof}

\begin{lemma}
\label{lemma-tensoring-Deligne-system}
Let $A$ be a Noetherian ring. Let $I \subset A$ be an ideal. Let
$M^\bullet$ be a bounded complex of finite $A$-modules. The
inverse system of maps
$$
I^n \otimes_A^\mathbf{L} M^\bullet \longrightarrow I^nM^\bullet
$$
defines an isomorphism of pro-objects of $D(A)$.
\end{lemma}

\begin{proof}
Choose generators $f_1, \ldots, f_r \in I$ of $I$. The inverse system $I^n$
is pro-isomorphic to the inverse system $(f_1^n, \ldots, f_r^n)$
in the category of $A$-modules. With notation as in
Lemma \ref{lemma-sequence-powers-pro-bounded} we find that
it suffices to prove the inverse system of maps
$$
I_n^\bullet \otimes_A^\mathbf{L} M^\bullet
\longrightarrow
(f_1^n, \ldots, f_r^n)M^\bullet
$$
defines an isomorphism of pro-objects of $D(A)$.
Say we have $a \leq b$ such that $M^i = 0$ if $i \not \in [a, b]$.
Then source and target of the arrows above have cohomology
only in degrees $[-r + a, b]$.
Thus it suffices to show that for any $p \in \mathbf{Z}$ the
inverse system of maps
$$
H^p(I_n^\bullet \otimes_A^\mathbf{L} M^\bullet)
\longrightarrow
H^p((f_1^n, \ldots, f_r^n)M^\bullet)
$$
defines an isomorphism of pro-objects of $A$-modules, see
Derived Categories, Lemma \ref{derived-lemma-pro-isomorphism-bis}.
Using the pro-isomorphism between
$I_n^\bullet \otimes_A^\mathbf{L} M^\bullet$
and $I^n \otimes_A^\mathbf{L} M^\bullet$
and the pro-isomorphism between
$(f_1^n, \ldots, f_r^n)M^\bullet$ and $I^nM^\bullet$
this is equivalent to showing that the inverse system of maps
$$
H^p(I^n \otimes_A^\mathbf{L} M^\bullet)
\longrightarrow
H^p(I^nM^\bullet)
$$
defines an isomorphism of pro-objects of $A$-modules
Choose a bounded above complex of finite free $A$-modules
$P^\bullet$ and a quasi-isomorphism $P^\bullet \to M^\bullet$.
Then it suffices to show that the inverse system of maps
$$
H^p(I^nP^\bullet)
\longrightarrow
H^p(I^nM^\bullet)
$$
is a pro-isomorphism. This follows from
Lemma \ref{lemma-consequence-Artin-Rees-bis}
as $H^p(P^\bullet) = H^p(M^\bullet)$.
\end{proof}

\begin{lemma}
\label{lemma-factor-through-derived-tensor-product}
Let $A$ be a Noetherian ring. Let $I \subset A$ be an ideal. Let $M$
be a finite $A$-module. There exists an integer $n > 0$ such that
$I^nM \to M$ factors through the map $I \otimes_A^\mathbf{L} M \to M$
in $D(A)$.
\end{lemma}

\begin{proof}
This follows from Lemma \ref{lemma-tensoring-Deligne-system}.
It can also been seen directly as follows. Consider the distinguished triangle
$$
I \otimes_A^\mathbf{L} M \to M \to A/I \otimes_A^\mathbf{L} M \to
I \otimes_A^\mathbf{L} M[1]
$$
By the axioms of a triangulated category it suffices to prove that
$I^nM \to A/I \otimes_A^\mathbf{L} M$ is zero in $D(A)$ for some $n$.
Choose generators $f_1, \ldots, f_r$ of $I$ and let
$K = K_\bullet(A, f_1, \ldots, f_r)$ be the Koszul complex
and consider the factorization $A \to K \to A/I$ of the quotient map.
Then we see that it suffices to show that $I^nM \to K \otimes_A M$
is zero in $D(A)$ for some $n > 0$. Suppose that we have found an $n > 0$
such that $I^nM \to K \otimes_A M$ factors through
$\tau_{\geq t}(K \otimes_A M)$ in $D(A)$. Then the obstruction
to factoring through $\tau_{\geq t + 1}(K \otimes_A M)$ is an element
in $\Ext^t(I^nM, H_t(K \otimes_A M))$. The finite $A$-module
$H_t(K \otimes_A M)$ is annihilated by $I$. Then by
Lemma \ref{lemma-ext-annihilated}
we can after increasing $n$ assume this obstruction element is zero.
Repeating this a finite number of times we find $n$ such that
$I^nM \to K \otimes_A M$ factors through
$0 = \tau_{\geq r + 1}(K \otimes_A M)$ in $D(A)$ and we win.
\end{proof}






\section{Miscellany}
\label{section-misc}

\noindent
Some results which do not fit anywhere else.

\begin{lemma}
\label{lemma-ext-annihilated-into}
Let $A$ be a Noetherian ring. Let $I \subset A$ be an ideal.
Let $K \in D(A)$ be pseudo-coherent. Let $a \in \mathbf{Z}$.
Assume that for every finite $A$-module $M$ the modules
$\Ext^i_A(K, M)$ are $I$-power torsion for $i \geq a$.
Then for $i \geq a$ and $M$ finite
the system $\Ext^i_A(K, M/I^nM)$
is essentially constant with value
$$
\Ext^i_A(K, M) = \lim \Ext^i_A(K, M/I^nM)
$$
\end{lemma}

\begin{proof}
Let $M$ be a finite $A$-module. Since $K$ is pseudo-coherent we see that
$\Ext^i_A(K, M)$ is a finite $A$-module. Thus for $i \geq a$
it is annihilated by $I^t$ for some $t \geq 0$. By
Lemma \ref{lemma-ext-induced-toplogy} we see that the image of
$\Ext^i_A(K, I^nM) \to \Ext^i_A(K, M)$ is
zero for some $n > 0$.
The short exact sequence $0 \to I^nM \to M \to M/I^n M \to 0$
gives a long exact sequence
$$
\Ext^i_A(K, I^nM) \to \Ext^i_A(K, M) \to
\Ext^i_A(K, M/I^nM) \to \Ext^{i + 1}_A(K, I^nM)
$$
The systems $\Ext^i_A(K, I^nM)$ and $\Ext^{i + 1}_A(K, I^nM)$
are essentially constant with value $0$ by what we just said
(applied to the finite $A$-modules $I^mM$). A diagram chase
shows $\Ext^i_A(K, M/I^nM)$ is essentially constant with value
$\Ext^i_A(K, M)$.
\end{proof}

\begin{lemma}
\label{lemma-tor-annihilated}
Let $A$ be a Noetherian ring. Let $I \subset A$ be an ideal. Let $M$
be a finite $A$-module. Let $N$ be an $A$-module annihilated by $I$.
There exists an integer $n > 0$ such that
$\text{Tor}^A_p(I^nM, N) \to \text{Tor}^A_p(M, N)$ is zero
for all $p \geq 0$.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-factor-through-derived-tensor-product}
we can factor $I^nM \to M$ as $I^nM \to M \otimes_A^\mathbf{L} I \to M$.
We claim the composition
$$
I^nM \otimes_A^\mathbf{L} N \to
(M \otimes_A^\mathbf{L} I) \otimes_A^\mathbf{L} N
\to M \otimes_A^\mathbf{L} N
$$
is zero. Namely, the diagram
$$
\xymatrix{
(M \otimes_A^\mathbf{L} I) \otimes_A^\mathbf{L} N \ar[rr] \ar[rd] & &
M \otimes_A^\mathbf{L} (I \otimes_A^\mathbf{L} N) \ar[ld] \\
& M \otimes_A^\mathbf{L} N
}
$$
commutes (details omitted) and the map $I \otimes_A^\mathbf{L} N \to N$
is zero as $N$ is annihilated by $I$.
\end{proof}

\begin{lemma}
\label{lemma-pseudo-coherent-tensor-limit}
Let $R$ be a ring. Let $K \in D(R)$ be pseudo-coherent.
Let $(M_n)$ be an inverse system of $R$-modules.
Then $R\lim K \otimes_R^\mathbf{L} M_n = K \otimes_R^\mathbf{L} R\lim M_n$.
\end{lemma}

\begin{proof}
Consider the defining distinguished triangle
$$
R\lim M_n \to \prod M_n \to \prod M_n \to R\lim M_n[1]
$$
and apply Lemma \ref{lemma-pseudo-coherent-tensor}.
\end{proof}

\begin{lemma}
\label{lemma-additivity-of-pd}
Let $R$ be a Noetherian local ring. Let $I \subset R$ be an ideal
and let $E$ be a nonzero module over $R/I$. If $R/I$ has finite projective
dimension and $E$ has finite projective dimension over $R/I$, then
$E$ has finite projective dimension over $R$ and
$$
\text{pd}_R(E) = \text{pd}_R(R/I) + \text{pd}_{R/I}(E)
$$
\end{lemma}

\begin{proof}
We will use that, for a finite module, having finite projective dimension
over $R$, resp.\ $R/I$ is the same as being a perfect module, see
discussion following Definition \ref{definition-perfect}.
We see that $E$ has finite projective dimension
over $R$ by Lemma \ref{lemma-cohomology-perfect}.
Thus we can apply Auslander-Buchsbaum (Algebra, Proposition
\ref{algebra-proposition-Auslander-Buchsbaum}) to see that
$$
\text{pd}_R(E) + \text{depth}(E) = \text{depth}(R),\quad
\text{pd}_{R/I}(E) + \text{depth}(E) = \text{depth}(R/I),
$$
and
$$
\text{pd}_R(R/I) + \text{depth}(R/I) = \text{depth}(R)
$$
Note that in the first equation we take the depth of $E$
as an $R$-module and in the second as an $R/I$-module.
However these depths are the same (this is trivial but
also follows from Algebra, Lemma \ref{algebra-lemma-depth-goes-down-finite}).
This concludes the proof.
\end{proof}

\begin{lemma}
\label{lemma-enlarge}
Let $A \to B$ be a ring map. There exists a cardinal $\kappa = \kappa(A \to B)$
with the following property: Let $M^\bullet$, resp.\ $N^\bullet$
be a complex of $A$-modules, resp.\ $B$-modules. Let
$a : M^\bullet \to N^\bullet$ be a map of complexes of $A$-modules
which induces an isomorphism
$M^\bullet \otimes_A^\mathbf{L} B \to N^\bullet$ in $D(B)$.
Let $M_1^\bullet \subset M^\bullet$, resp.\ $N_1^\bullet \subset N^\bullet$
be a subcomplex of $A$-modules, resp.\ $B$-modules such that
$a(M_1^\bullet) \subset N_1^\bullet$. Then there exist
subcomplexes
$$
M_1^\bullet \subset M_2^\bullet \subset M^\bullet
\quad\text{and}\quad
N_1^\bullet \subset N_2^\bullet \subset N^\bullet
$$
such that $a(M_2^\bullet) \subset N_2^\bullet$
with the following properties:
\begin{enumerate}
\item $\Ker(H^i(M_1^\bullet \otimes_A^\mathbf{L} B) \to H^i(N_1^\bullet))$
maps to zero in $H^i(M_2^\bullet \otimes_A^\mathbf{L} B)$,
\item $\Im(H^i(N_1^\bullet) \to H^i(N_2^\bullet))$ is contained in
$\Im(H^i(M_2^\bullet \otimes_A^\mathbf{L} B) \to H^2(N_2^\bullet))$,
\item $|\bigcup M_2^i \cup \bigcup N_2^i| \leq
\max(\kappa, |\bigcup M_1^i \cup \bigcup N_1^i|)$.
\end{enumerate}
\end{lemma}

\begin{proof}
Let $\kappa = \max(|A|, |B|, \aleph_0)$. Set $|M^\bullet| = |\bigcup M^i|$
and similarly for other complexes. With this notation we have
$$
\max(\kappa, |\bigcup M_1^i \cup \bigcup N_1^i|) =
\max(\kappa, |M_1^\bullet|, |M_2^\bullet|)
$$
for the quantity used in the statement of the lemma. We are going to
use this and other observations coming from arithmetic of cardinals
without further mention.

\medskip\noindent
First, let us show that there are plenty of ``small'' subcomplexes.
For every pair of collections $E = \{E^i\}$ and $F = \{F^i\}$
of finite subsets $E^i \subset M^i$, $i \in \mathbf{Z}$
and $F^i \subset N^i$, $i \in \mathbf{Z}$ we can let
$$
M_1^\bullet \subset M_1(E, F)^\bullet \subset M^\bullet
\quad\text{and}\quad
N_1^\bullet \subset N_1(E, F)^\bullet \subset N^\bullet
$$
be the smallest subcomplexes of $A$ and $B$-modules
such that $a(M_1(E, F)^\bullet) \subset N_1(E, F)^\bullet$
and such that $E^i \subset M_1(E, F)^i$ and $F^i \subset M_2(E, F)^i$.
Then it is easy to see that
$$
|M_1(E, F)^\bullet| \leq \max(\kappa, |M_1^\bullet|)
\quad\text{and}\quad
|M_2(E, F)^\bullet| \leq \max(\kappa, |M_2^\bullet|)
$$
Details omitted. It is clear that we have
$$
M^\bullet = \colim_{(E, F)} M_1(E, F)^\bullet
\quad\text{and}\quad
N^\bullet = \colim_{(E, F)} N_1(E, F)^\bullet
$$
and the colimits are (termwise) filtered colimits.

\medskip\noindent
There exists a resolution $\ldots \to F^{-1} \to F^0 \to B$
by free $A$-modules $F_i$ with $|F_i| \leq \kappa$ (details omitted).
The cohomology modules of $M_1^\bullet \otimes_A^\mathbf{L} B$ are
computed by $\text{Tot}(M_1^\bullet \otimes_A F^\bullet)$.
It follows that
$|H^i(M_1^\bullet \otimes_A^\mathbf{L} B)| \leq \max(\kappa, |M_1^\bullet|)$.

\medskip\noindent
Let $i \in \mathbf{Z}$ and let
$\xi \in H^i(M_1^\bullet \otimes_A^\mathbf{L} B)$
be an element which maps to zero in $H^i(N_1^\bullet)$.
Then $\xi$ maps to zero in $H^i(N^\bullet)$ and hence
$\xi$ maps to zero in $H^i(M^\bullet \otimes_A^\mathbf{L} B)$.
Since derived tensor product commutes with filtered colimits,
we can find finite collections $E_\xi$ and $F_\xi$
as above such that $\xi$ maps to zero in
$H^i(M_1(E_\xi, F_\xi)^\bullet \otimes_A^\mathbf{L} B)$.

\medskip\noindent
Let $i \in \mathbf{Z}$ and let $\eta \in H^i(N_1^\bullet)$.
Then the image of $\eta$ in $H^i(N^\bullet)$ is in the image
of $H^i(M^\bullet \otimes_A^\mathbf{L} B) \to H^i(N^\bullet)$.
Hence as before, we can find finite collections $E_\eta$ and $F_\eta$
as above such that $\eta$ maps to an element of
$H^i(N_1(E_\eta, F_\eta)$ which is in the image of the map
$H^i(M_1(E_\eta, F_\eta)^\bullet \otimes_A^\mathbf{L} B) \to
H^i(N_1(E_\eta, F_\eta)$.

\medskip\noindent
Now we simply define
$$
M_2^\bullet =
\sum\nolimits_\xi M_1(E_\xi, F_\xi)^\bullet +
\sum\nolimits_\eta M_1(E_\eta, F_\eta)^\bullet
$$
where the sum is over $\xi$ and $\eta$ as in the previous two paragraphs
and the sum is taken inside $M^\bullet$. Similiarly we set
$$
N_2^\bullet =
\sum\nolimits_\xi N_1(E_\xi, F_\xi)^\bullet +
\sum\nolimits_\eta N_1(E_\eta, F_\eta)^\bullet
$$
where the sum is taken inside $N^\bullet$. By construction we will
have properties (1) and (2) with these choices.
The bound (3) also follows as the set of
$\xi$ and $\eta$ has cardinality at most
$\max(\kappa, |M_1^\bullet|, |N_1^\bullet|)$.
\end{proof}









\section{Tricks with double complexes}
\label{section-tricks}

\noindent
This section continues the discussion in
Homology, Section \ref{homology-section-double-complexes-abelian-groups}.

\begin{lemma}
\label{lemma-vanishing-coh-prod-totalization}
Let $A_0^\bullet \to A_1^\bullet \to A_2^\bullet \to \ldots$
be a complex of complexes of abelian groups. Assume
$H^{-p}(A_p^\bullet) = 0$ for all $p \geq 0$.
Set $A^{p, q} = A_p^q$ and view $A^{\bullet, \bullet}$ as a double complex.
Then $H^0(\text{Tot}_\pi(A^{\bullet, \bullet})) = 0$.
\end{lemma}

\begin{proof}
Denote $f_p : A_p^\bullet \to A_{p + 1}^\bullet$ the given maps
of complexes. Recall that the differential on
$\text{Tot}_\pi(A^{\bullet, \bullet})$ is given by
$$
\prod\nolimits_{p + q = n} (f^q_p + (-1)^p\text{d}^q_{A_p^\bullet})
$$
on elements in degree $n$.
Let $\xi \in H^0(\text{Tot}_\pi(A^{\bullet, \bullet}))$ be a cohomology
class. We will show $\xi$ is zero. Represent $\xi$ as the class of an cocycle
$x = (x_p) \in \prod A^{p, -p}$.
Since $\text{d}(x) = 0$ we find that
$\text{d}_{A_0^\bullet}(x_0) = 0$.
Since $H^0(A_0^\bullet) = 0$ there exists a $y_{-1} \in A^{0, -1}$ with
$\text{d}_{A_0^\bullet}(y_{-1}) = x_0$.
Then we see that $\text{d}_{A_1^\bullet}(x_1 + f_0(y_{-1})) = 0$.
Since $H^{-1}(A_1^\bullet) = 0$ we can find a $y_{-2} \in A^{1, -2}$
such that $-\text{d}_{A_1^\bullet}(y_{-2}) = x_1 + f_0(y_{-1})$.
By induction we can find
$y_{-p - 1} \in A^{p, -p - 1}$ such that
$$
(-1)^p\text{d}_{A_p^\bullet}(y_{-p - 1}) = x_p + f_{p - 1}(y_{-p})
$$
This implies that $\text{d}(y) = x$ where $y = (y_{-p - 1})$.
\end{proof}

\begin{lemma}
\label{lemma-prod-qis-gives-qis}
Let
$$
(A_0^\bullet \to A_1^\bullet \to A_2^\bullet \to \ldots)
\longrightarrow
(B_0^\bullet \to B_1^\bullet \to B_2^\bullet \to \ldots)
$$
be a map between two complexes of complexes of abelian groups.
Set $A^{p, q} = A_p^q$, $B^{p, q} = B_p^q$ to obtain double complexes.
Let $\text{Tot}_\pi(A^{\bullet, \bullet})$
and $\text{Tot}_\pi(B^{\bullet, \bullet})$ be the
product total complexes associated to the double complexes.
If each $A_p^\bullet \to B_p^\bullet$ is a
quasi-isomorphism, then
$\text{Tot}_\pi(A^{\bullet, \bullet}) \to \text{Tot}_\pi(B^{\bullet, \bullet})$
is a quasi-isomorphism.
\end{lemma}

\begin{proof}
Recall that $\text{Tot}_\pi(A^{\bullet, \bullet})$ in degree
$n$ is given by $\prod_{p + q = n} A^{p, q} = \prod_{p + 1 = n} A^q_p$.
Let $C_p^\bullet$ be the cone on the map $A_p^\bullet \to B_p^\bullet$,
see Derived Categories, Section \ref{derived-section-cones}.
By the functoriality of the cone construction we obtain a
complex of complexes
$$
C_0^\bullet \to C_1^\bullet \to C_2^\bullet \to \ldots
$$
Then we see $\text{Tot}_\pi(C^{\bullet, \bullet})$ in degree $n$
is given by
$$
\prod_{p + q = n} C^{p, q} = \prod_{p + q = n} C^q_p =
\prod_{p + q = n} (B^q_p \oplus A^{q + 1}_p) =
\prod_{p + q = n} B^q_p \oplus \prod_{p + q = n} A^{q + 1}_p
$$
We conclude that $\text{Tot}_\pi(C^{\bullet, \bullet})$
is the cone of the map
$\text{Tot}_\pi(A^{\bullet, \bullet}) \to \text{Tot}_\pi(B^{\bullet, \bullet})$
(We omit the verification that the differentials agree.)
Thus it suffices to show $\text{Tot}_\pi(A^{\bullet, \bullet})$ is
acyclic if each $A_p^\bullet$ is acyclic. This follows from
Lemma \ref{lemma-vanishing-coh-prod-totalization}.
\end{proof}






\section{Weakly \'etale ring maps}
\label{section-weakly-etale}

\noindent
Most of the results in this section are from the paper
\cite{Olivier-AF} by Olivier. See also the related paper
\cite{Ferrand-epi}.

\begin{definition}
\label{definition-weakly-etale}
A ring $A$ is called {\it absolutely flat} if every $A$-module is flat over
$A$. A ring map $A \to B$ is {\it weakly \'etale} or {\it absolutely flat}
if both $A \to B$ and $B \otimes_A B \to B$ are flat.
\end{definition}

\noindent
Absolutely flat rings are sometimes called von Neumann regular rings
(often in the setting of noncommutative rings). A localization is a
weakly \'etale ring map. An \'etale ring map is weakly
\'etale. Here is a simple, yet key property.

\begin{lemma}
\label{lemma-key}
Let $A \to B$ be a ring map such that $B \otimes_A B \to B$ is flat.
Let $N$ be a $B$-module. If $N$ is flat as an $A$-module, then
$N$ is flat as a $B$-module.
\end{lemma}

\begin{proof}
Assume $N$ is a flat as an $A$-module.
Then the functor
$$
\text{Mod}_B \longrightarrow \text{Mod}_{B \otimes_A B},\quad
N' \mapsto N \otimes_A N'
$$
is exact. As $B \otimes_A B \to B$ is flat we conclude that the functor
$$
\text{Mod}_B \longrightarrow \text{Mod}_B,\quad
N' \mapsto (N \otimes_A N') \otimes_{B \otimes_A B} B = N \otimes_B N'
$$
is exact, hence $N$ is flat over $B$.
\end{proof}

\begin{definition}
\label{definition-weak-dimension}
Let $A$ be a ring. Let $d \geq 0$ be an integer.
We say that $A$ has {\it weak dimension $\leq d$}
if every $A$-module has tor dimension $\leq d$.
\end{definition}

\begin{lemma}
\label{lemma-weak-dimension-goes-up}
Let $A \to B$ be a weakly \'etale ring map.
If $A$ has weak dimension at most $d$, then so does $B$.
\end{lemma}

\begin{proof}
Let $N$ be a $B$-module. If $d = 0$, then $N$ is flat as an $A$-module,
hence flat as a $B$-module by Lemma \ref{lemma-key}.
Assume $d > 0$. Choose a resolution $F_\bullet \to N$
by free $B$-modules. Our assumption implies that
$K = \Im(F_d \to F_{d - 1})$ is $A$-flat, see
Lemma \ref{lemma-last-one-flat}. Hence it is $B$-flat
by Lemma \ref{lemma-key}. Thus
$0 \to K \to F_{d - 1} \to \ldots \to F_0 \to N \to 0$
is a flat resolution of length $d$ and we see that $N$ has
tor dimension at most $d$.
\end{proof}

\begin{lemma}
\label{lemma-absolutely-flat}
Let $A$ be a ring. The following are equivalent
\begin{enumerate}
\item $A$ has weak dimension $\leq 0$,
\item $A$ is absolutely flat, and
\item $A$ is reduced and every prime is maximal.
\end{enumerate}
In this case every local ring of $A$ is a field.
\end{lemma}

\begin{proof}
The equivalence of (1) and (2) is immediate.
Assume $A$ is absolutely flat. This implies every ideal of $A$ is pure, see
Algebra, Definition \ref{algebra-definition-pure-ideal}.
Hence every finitely generated ideal is generated by an idempotent by
Algebra, Lemma \ref{algebra-lemma-finitely-generated-pure-ideal}.
If $f \in A$, then $(f) = (e)$ for some idempotent $e \in A$
and $D(f) = D(e)$ is open and closed
(Algebra, Lemma \ref{algebra-lemma-idempotent-spec}).
This already implies every ideal of $A$ is maximal
for example by
Algebra, Lemma \ref{algebra-lemma-ring-with-only-minimal-primes}.
Moreover, if $f$ is nilpotent, then $e = 0$ hence $f = 0$.
Thus $A$ is reduced.

\medskip\noindent
Assume $A$ is reduced and every prime of $A$ is maximal.
Let $M$ be an $A$-module. Our goal is to show that $M$ is flat.
We may write $M$ as a filtered colimit of finite $A$-modules, hence
we may assume $M$ is finite
(Algebra, Lemma \ref{algebra-lemma-colimit-flat}).
There is a finite filtration of $M$ by modules of the form
$A/I$ (Algebra, Lemma \ref{algebra-lemma-trivial-filter-finite-module}),
hence we may assume that $M = A/I$
(Algebra, Lemma \ref{algebra-lemma-flat-ses}).
Thus it suffices to show every ideal of $A$ is pure.
Since every local ring of $A$ is a field
(by Algebra, Lemma \ref{algebra-lemma-minimal-prime-reduced-ring} and
the fact that every prime of $A$ is minimal),
we see that every ideal $I \subset A$ is radical.
Note that every closed subset of $\Spec(A)$ is closed under generalization.
Thus every (radical) ideal of $A$ is pure by
Algebra, Lemma \ref{algebra-lemma-pure-open-closed-specializations}.
\end{proof}

\begin{lemma}
\label{lemma-product-fields-absolutely-flat}
A product of fields is an absolutely flat ring.
\end{lemma}

\begin{proof}
Let $K_i$ be a family of fields. If $f = (f_i) \in \prod K_i$, then
the ideal generated by $f$ is the same as the ideal generated by
the idempotent $e = (e_i)$ with $e_i = 0, 1$ according to whether
$f_i$ is $0$ or not. Thus $D(f) = D(e)$ is open and closed and we conclude
by Lemma \ref{lemma-absolutely-flat} and
Algebra, Lemma \ref{algebra-lemma-ring-with-only-minimal-primes}.
\end{proof}

\begin{lemma}
\label{lemma-base-change-weakly-etale}
Let $A \to B$ and $A \to A'$ be ring maps. Let $B' = B \otimes_A A'$
be the base change of $B$.
\begin{enumerate}
\item If $B \otimes_A B \to B$ is flat, then $B' \otimes_{A'} B' \to B'$
is flat.
\item If $A \to B$ is weakly \'etale, then $A' \to B'$ is weakly \'etale.
\end{enumerate}
\end{lemma}

\begin{proof}
Assume $B \otimes_A B \to B$ is flat.
The ring map $B' \otimes_{A'} B' \to B'$ is the base change of
$B \otimes_A B \to B$ by $A \to A'$. Hence it is flat by
Algebra, Lemma \ref{algebra-lemma-flat-base-change}. This proves (1).
Part (2) follows from (1) and the fact (just used) that the
base change of a flat ring map is flat.
\end{proof}

\begin{lemma}
\label{lemma-absolutely-flat-over-absolutely-flat}
Let $A \to B$ be a ring map such that $B \otimes_A B \to B$ is flat.
\begin{enumerate}
\item If $A$ is an absolutely flat ring, then so is $B$.
\item If $A$ is reduced and $A \to B$ is weakly \'etale, then $B$ is reduced.
\end{enumerate}
\end{lemma}

\begin{proof}
Part (1) follows immediately from Lemma \ref{lemma-key} and the definitions.
If $A$ is reduced, then there exists an injection
$A \to A' = \prod_{\mathfrak p \subset A\text{ minimal}} A_\mathfrak p$
of $A$ into an absolutely flat ring
(Algebra, Lemma \ref{algebra-lemma-reduced-ring-sub-product-fields} and
Lemma \ref{lemma-product-fields-absolutely-flat}).
If $A \to B$ is flat, then the induced map $B \to B' = B \otimes_A A'$
is injective too. By Lemma \ref{lemma-base-change-weakly-etale}
the ring map $A' \to B'$ is weakly \'etale.
By part (1) we see that $B'$ is absolutely flat.
By Lemma \ref{lemma-absolutely-flat} the ring $B'$ is reduced.
Hence $B$ is reduced.
\end{proof}

\begin{lemma}
\label{lemma-composition-weakly-etale}
Let $A \to B$ and $B \to C$ be ring maps.
\begin{enumerate}
\item If $B \otimes_A B \to B$ and $C \otimes_B C \to C$
are flat, then $C \otimes_A C \to C$ is flat.
\item If $A \to B$ and $B \to C$ are weakly \'etale, then $A \to C$
is weakly \'etale.
\end{enumerate}
\end{lemma}

\begin{proof}
Part (1) follows from the factorization
$$
C \otimes_A C \longrightarrow C \otimes_B C \longrightarrow C
$$
of the multiplication map, the fact that
$$
C \otimes_B C = (C \otimes_A C) \otimes_{B \otimes_A B} B,
$$
the fact that a base change of a flat map is flat, and the
fact that the composition of flat ring maps is flat.
See Algebra, Lemmas \ref{algebra-lemma-flat-base-change} and
\ref{algebra-lemma-composition-flat}.
Part (2) follows from (1) and the fact (just used) that the
composition of flat ring maps is flat.
\end{proof}

\begin{lemma}
\label{lemma-go-down}
Let $A \to B \to C$ be ring maps.
\begin{enumerate}
\item If $B \to C$ is faithfully flat and $C \otimes_A C \to C$ is flat,
then $B \otimes_A B \to B$ is flat.
\item If $B \to C$ is faithfully flat and $A \to C$ is weakly \'etale,
then $A \to B$ is weakly \'etale.
\end{enumerate}
\end{lemma}

\begin{proof}
Assume $B \to C$ is faithfully flat and $C \otimes_A C \to C$ is flat.
Consider the commutative diagram
$$
\xymatrix{
C \otimes_A C \ar[r] & C \\
B \otimes_A B \ar[r] \ar[u] & B \ar[u]
}
$$
The vertical arrows are flat, the top horizontal arrow is flat.
Hence $C$ is flat as a $B \otimes_A B$-module. The map $B \to C$ is
faithfully flat and $C = B \otimes_B C$. Hence $B$ is flat as a
$B \otimes_A B$-module by
Algebra, Lemma \ref{algebra-lemma-flatness-descends-more-general}.
This proves (1). Part (2) follows from (1) and the fact that
$A \to B$ is flat if $A \to C$ is flat and $B \to C$ is faithfully flat
(Algebra, Lemma \ref{algebra-lemma-flatness-descends-more-general}).
\end{proof}

\begin{lemma}
\label{lemma-weakly-etale-permanence}
Let $A$ be a ring. Let $B \to C$ be an $A$-algebra map of weakly \'etale
$A$-algebras. Then $B \to C$ is weakly \'etale.
\end{lemma}

\begin{proof}
The ring map $B \to C$ is flat by Lemma \ref{lemma-key}. The ring map
$C \otimes_A C \to C \otimes_B C$ is surjective, hence an epimorphism.
Thus Lemma \ref{lemma-key} implies, that since $C$ is flat over
$C \otimes_A C$ also $C$ is flat over $C \otimes_B C$.
\end{proof}

\begin{lemma}
\label{lemma-formally-unramified}
Let $A \to B$ be a ring map such that $B \otimes_A B \to B$ is flat.
Then $\Omega_{B/A} = 0$, i.e., $B$ is formally unramified over $A$.
\end{lemma}

\begin{proof}
Let $I \subset B \otimes_A B$ be the kernel of the flat surjective map
$B \otimes_A B \to B$. Then $I$ is a pure ideal
(Algebra, Definition \ref{algebra-definition-pure-ideal}),
so $I^2 = I$ (Algebra, Lemma \ref{algebra-lemma-pure}).
Since $\Omega_{B/A} = I/I^2$
(Algebra, Lemma \ref{algebra-lemma-differentials-diagonal})
we obtain the vanishing. This means $B$ is formally unramified over
$A$ by
Algebra, Lemma \ref{algebra-lemma-characterize-formally-unramified}.
\end{proof}

\begin{lemma}
\label{lemma-weakly-etale-finite-type}
Let $A \to B$ be a ring map such that $B \otimes_A B \to B$ is flat.
\begin{enumerate}
\item If $A \to B$ is of finite type, then $A \to B$ is unramified.
\item If $A \to B$ is of finite presentation and flat, then
$A \to B$ is \'etale.
\end{enumerate}
In particular a weakly \'etale ring map of finite presentation is \'etale.
\end{lemma}

\begin{proof}
Part (1) follows from Lemma \ref{lemma-formally-unramified} and
Algebra, Definition \ref{algebra-definition-unramified}.
Part (2) follows from part (1) and
Algebra, Lemma \ref{algebra-lemma-etale-flat-unramified-finite-presentation}.
\end{proof}

\begin{lemma}
\label{lemma-when-weakly-etale}
Let $A \to B$ be a ring map. Then $A \to B$ is weakly \'etale in each
of the following cases
\begin{enumerate}
\item $B = S^{-1}A$ is a localization of $A$,
\item $A \to B$ is \'etale,
\item $B$ is a filtered colimit of weakly \'etale $A$-algebras.
\end{enumerate}
\end{lemma}

\begin{proof}
An \'etale ring map is flat and the map $B \otimes_A B \to B$ is
also \'etale as a map between \'etale $A$-algebras
(Algebra, Lemma \ref{algebra-lemma-map-between-etale}).
This proves (2).

\medskip\noindent
Let $B_i$ be a directed system of weakly \'etale $A$-algebras.
Then $B = \colim B_i$ is flat over $A$ by
Algebra, Lemma \ref{algebra-lemma-colimit-flat}.
Note that the transition maps $B_i \to B_{i'}$ are flat
by Lemma \ref{lemma-weakly-etale-permanence}.
Hence $B$ is flat over $B_i$ for each $i$, and we see that $B$ is flat
over $B_i \otimes_A B_i$ by
Algebra, Lemma \ref{algebra-lemma-composition-flat}.
Thus $B$ is flat over $B \otimes_A B = \colim B_i \otimes_A B_i$
by Algebra, Lemma \ref{algebra-lemma-colimit-rings-flat}.

\medskip\noindent
Part (1) can be proved directly, but also follows by combining
(2) and (3).
\end{proof}

\begin{lemma}
\label{lemma-absolutely-flat-fields}
Let $L/K$ be an extension of fields. If $L \otimes_K L \to L$
is flat, then $L$ is an algebraic separable extension of $K$.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-go-down} we see that any subfield
$K \subset L' \subset L$ the map $L' \otimes_K L' \to L'$ is flat.
Thus we may assume $L$ is a finitely generated field extension of $K$.
In this case the fact that $L/K$ is formally unramified
(Lemma \ref{lemma-formally-unramified})
implies that $L/K$ is finite separable, see Algebra, Lemma
\ref{algebra-lemma-characterize-separable-algebraic-field-extensions}.
\end{proof}

\begin{lemma}
\label{lemma-absolutely-flat-over-field}
Let $B$ be an algebra over a field $K$. The following are
equivalent
\begin{enumerate}
\item $B \otimes_K B \to B$ is flat,
\item $K \to B$ is weakly \'etale, and
\item $B$ is a filtered colimit of \'etale $K$-algebras.
\end{enumerate}
Moreover, every finitely generated $K$-subalgebra of $B$
is \'etale over $K$.
\end{lemma}

\begin{proof}
Parts (1) and (2) are equivalent because every $K$-algebra is flat over $K$.
Part (3) implies (1) and (2) by Lemma \ref{lemma-when-weakly-etale}

\medskip\noindent
Assume (1) and (2) hold. We will prove (3) and the finite statement of
the lemma. A field is absolutely flat ring, hence $B$ is a absolutely
flat ring by Lemma \ref{lemma-absolutely-flat-over-absolutely-flat}.
Hence $B$ is reduced and every local
ring is a field, see Lemma \ref{lemma-absolutely-flat}.

\medskip\noindent
Let $\mathfrak q \subset B$ be a prime. The ring map
$B \to B_\mathfrak q$ is weakly \'etale, hence $B_\mathfrak q$
is weakly \'etale over $K$ (Lemma \ref{lemma-composition-weakly-etale}).
Thus $B_\mathfrak q$ is a separable algebraic extension of $K$ by
Lemma \ref{lemma-absolutely-flat-fields}.

\medskip\noindent
Let $K \subset A \subset B$ be a finitely generated $K$-sub algebra.
We will show that $A$ is \'etale over $K$ which will finish the proof
of the lemma.
Then every minimal prime $\mathfrak p \subset A$ is the image of a prime
$\mathfrak q$ of $B$, see
Algebra, Lemma \ref{algebra-lemma-injective-minimal-primes-in-image}.
Thus $\kappa(\mathfrak p)$ as a subfield of
$B_\mathfrak q = \kappa(\mathfrak q)$ is separable algebraic over $K$.
Hence every generic point of $\Spec(A)$
is closed (Algebra, Lemma \ref{algebra-lemma-finite-residue-extension-closed}).
Thus $\dim(A) = 0$.
Then $A$ is the product of its local rings, e.g., by
Algebra, Proposition \ref{algebra-proposition-dimension-zero-ring}.
Moreover, since $A$ is reduced, all local rings are equal
to their residue fields wich are finite separable over $K$.
This means that $A$ is \'etale over $K$ by
Algebra, Lemma \ref{algebra-lemma-etale-over-field}
and finishes the proof.
\end{proof}

\begin{lemma}
\label{lemma-weakly-etale-residue-field-extensions}
Let $A \to B$ be a ring map. If $A \to B$ is weakly \'etale, then
$A \to B$ induces separable algebraic residue field extensions.
\end{lemma}

\begin{proof}
Let $\mathfrak p$ be a prime of $A$. Then
$\kappa(\mathfrak p) \to B \otimes_A \kappa(\mathfrak p)$ is weakly \'etale by
Lemma \ref{lemma-base-change-weakly-etale}.
Hence $B \otimes_A \kappa(\mathfrak p)$ is a filtered colimit of
\'etale $\kappa(\mathfrak p)$-algebras by
Lemma \ref{lemma-absolutely-flat-over-field}.
Hence for $\mathfrak q \subset B$ lying over $\mathfrak p$ the
extension $\kappa(\mathfrak q)/\kappa(\mathfrak p)$ is
a filtered colimit of finite separable extensions by
Algebra, Lemma \ref{algebra-lemma-etale-over-field}.
\end{proof}

\begin{lemma}
\label{lemma-weak-dimension-at-most-1}
Let $A$ be a ring. The following are equivalent
\begin{enumerate}
\item $A$ has weak dimension $\leq 1$,
\item every ideal of $A$ is flat,
\item every finitely generated ideal of $A$ is flat,
\item every submodule of a flat $A$-module is flat, and
\item every local ring of $A$ is a valuation ring.
\end{enumerate}
\end{lemma}

\begin{proof}
If $A$ has weak dimension $\leq 1$, then the resolution
$0 \to I \to A \to A/I \to 0$ shows that every ideal $I$
is flat by Lemma \ref{lemma-last-one-flat}.
Hence (1) $\Rightarrow$ (2).

\medskip\noindent
Assume (4). Let $M$ be an $A$-module. Choose a surjection
$F \to M$ where $F$ is a free $A$-module. Then $\Ker(F \to M)$
is flat by assumption, and we see that $M$ has tor dimension
$\leq 1$ by Lemma \ref{lemma-tor-dimension}.
Hence (4) $\Rightarrow$ (1).

\medskip\noindent
Every ideal is the union of the finitely generated ideals
contained in it. Hence (3) implies (2) by
Algebra, Lemma \ref{algebra-lemma-colimit-flat}.
Thus (3) $\Leftrightarrow$ (2).

\medskip\noindent
Assume (2). Suppose that $N \subset M$ with $M$ a flat $A$-module.
We will prove that $N$ is flat.
We can write $M = \colim M_i$ with each $M_i$ finite free, see
Algebra, Theorem \ref{algebra-theorem-lazard}.
Setting $N_i \subset M_i$ the inverse image of $N$ we see that
$N = \colim N_i$. By
Algebra, Lemma \ref{algebra-lemma-colimit-flat}.
it suffices to prove $N_i$ is flat and we reduce
to the case $M = R^{\oplus n}$. In this case
the module $N$ has a finite filtration by the submodules
$R^{\oplus j} \cap N$ whose subquotients are ideals.
By (2) these ideals are flat and hence $N$ is flat by
Algebra, Lemma \ref{algebra-lemma-flat-ses}. Thus (2) $\Rightarrow$ (4).

\medskip\noindent
Assume $A$ satisfies (1) and let $\mathfrak p \subset A$ be a
prime ideal. By
Lemmas \ref{lemma-when-weakly-etale} and \ref{lemma-weak-dimension-goes-up}
we see that $A_\mathfrak p$ satisfies (1). We will show $A$ is a valuation ring
if $A$ is a local ring satisfying (3). Let $f \in \mathfrak m$
be a nonzero element. Then $(f)$ is a flat nonzero module generated by
one element. Hence it is a free $A$-module by
Algebra, Lemma \ref{algebra-lemma-finite-flat-local}.
It follows that $f$ is a nonzerodivisor and $A$ is a domain.
If $I \subset A$ is a finitely generated ideal, then we similarly
see that $I$ is a finite free $A$-module, hence (by considering the
rank) free of rank $1$ and $I$ is a principal ideal. Thus $A$ is a
valuation ring by
Algebra, Lemma \ref{algebra-lemma-characterize-valuation-ring}.
Thus (1) $\Rightarrow$ (5).

\medskip\noindent
Assume (5). Let $I \subset A$ be a finitely generated ideal.
Then $I_\mathfrak p \subset A_\mathfrak p$ is a finitely generated ideal
in a valuation ring, hence principal
(Algebra, Lemma \ref{algebra-lemma-characterize-valuation-ring}), hence flat.
Thus $I$ is flat by
Algebra, Lemma \ref{algebra-lemma-flat-localization}.
Thus (5) $\Rightarrow$ (3). This finishes the proof of the lemma.
\end{proof}

\begin{lemma}
\label{lemma-product-weak-dimension-at-most-1}
Let $J$ be a set. For each $j \in J$ let
$A_j$ be a valuation ring with fraction field $K_j$.
Set $A = \prod A_j$ and $K = \prod K_j$.
Then $A$ has weak dimension at most $1$ and $A \to K$ is
a localization.
\end{lemma}

\begin{proof}
Let $I \subset A$ be a finitely generated ideal.
By Lemma \ref{lemma-weak-dimension-at-most-1}
it suffices to show that $I$ is a flat $A$-module.
Let $I_j \subset A_j$ be the image of $I$.
Observe that $I_j = I \otimes_A A_j$, hence
$I \to \prod I_j$ is surjective by
Algebra, Proposition \ref{algebra-proposition-fg-tensor}.
Thus $I = \prod I_j$.
Since $A_j$ is a valuation ring, the ideal $I_j$
is generated by a single element
(Algebra, Lemma \ref{algebra-lemma-characterize-valuation-ring}).
Say $I_j = (f_j)$. Then $I$ is generated by the element $f = (f_j)$.
Let $e \in A$ be the idempotent which has a $0$ or $1$
in $A_j$ depending on whether $f_j$ is $0$ or not.
Then $f = g e$ for some nonzerodivisor $g \in A$:
take $g = (g_j)$ with $g_j = 1$ if $f_j = 0$ and $g_j = f_j$ else.
Thus $I \cong (e)$ as a module. We conclude $I$ is flat as $(e)$ is a
direct summand of $A$. The final statement is true because
$K = S^{-1}A$ where $S = \prod (A_j \setminus \{0\})$.
\end{proof}

\begin{lemma}
\label{lemma-product-found-valuation-rings}
Let $A$ be a normal domain with fraction field $K$.
There exists a cartesian diagram
$$
\xymatrix{
A \ar[d] \ar[r] & K \ar[d] \\
V \ar[r] & L
}
$$
of rings where $V$ has weak dimension at most $1$
and $V \to L$ is a flat, injective, epimorphism of rings.
\end{lemma}

\begin{proof}
For every $x \in K$, $x \not \in A$ pick $V_x \subset K$ as in
Algebra, Lemma \ref{algebra-lemma-find-valuation-rings}.
Set $V = \prod_{x \in K \setminus A} V_x$ and
$L = \prod_{x \in K \setminus A} K$. The ring $V$
has weak dimension at most $1$ by
Lemma \ref{lemma-product-weak-dimension-at-most-1}
which also shows that $V \to L$ is a localization.
A localization is flat and an epimorphism, see
Algebra, Lemmas \ref{algebra-lemma-flat-localization} and
\ref{algebra-lemma-epimorphism-local}.
\end{proof}

\begin{lemma}
\label{lemma-weak-dimension-at-most-1-integrally-closed}
Let $A$ be a ring of weak dimension at most $1$.
If $A \to B$ is a flat, injective, epimorphism of rings, then
$A$ is integrally closed in $B$.
\end{lemma}

\begin{proof}
Let $x \in B$ be integral over $A$. Let $A' = A[x] \subset B$.
Then $A'$ is a finite ring extension of $A$ by
Algebra, Lemma \ref{algebra-lemma-characterize-finite-in-terms-of-integral}.
To show $A = A'$ it suffices to show $A \to A'$ is an epimorphism by
Algebra, Lemma \ref{algebra-lemma-finite-epimorphism-surjective}.
Note that $A'$ is flat over $A$ by assumption on $A$ and the fact that
$B$ is flat over $A$ (Lemma \ref{lemma-weak-dimension-at-most-1}).
Hence the composition
$$
A' \otimes_A A' \to B \otimes_A A' \to B \otimes_A B \to B
$$
is injective, i.e., $A' \otimes_A A' \cong A'$ and the lemma is proved.
\end{proof}

\begin{lemma}
\label{lemma-normality-goes-up}
Let $A$ be a normal domain with fraction field $K$.
Let $A \to B$ be weakly \'etale. Then
$B$ is integrally closed in $B \otimes_A K$.
\end{lemma}

\begin{proof}
Choose a diagram as in Lemma \ref{lemma-product-found-valuation-rings}.
As $A \to B$ is flat, the base change gives a cartesian diagram
$$
\xymatrix{
B \ar[d] \ar[r] & B \otimes_A K \ar[d] \\
B \otimes_A V \ar[r] & B \otimes_A L
}
$$
of rings. Note that $V \to B \otimes_A V$ is weakly \'etale
(Lemma \ref{lemma-base-change-weakly-etale}), hence $B \otimes_A V$
has weak dimension at most $1$ by Lemma \ref{lemma-weak-dimension-goes-up}.
Note that $B \otimes_A V \to B \otimes_A L$ is a flat, injective,
epimorphism of rings as a flat base change of such
(Algebra, Lemmas \ref{algebra-lemma-flat-base-change} and
\ref{algebra-lemma-base-change-epimorphism}).
By Lemma \ref{lemma-weak-dimension-at-most-1-integrally-closed}
we see that $B \otimes_A V$ is integrally closed in $B \otimes_A L$.
It follows from the cartesian property of the diagram
that $B$ is integrally closed in $B \otimes_A K$.
\end{proof}

\begin{lemma}
\label{lemma-integral-over-henselian}
Let $A \to B$ be a ring homomorphism.
Assume
\begin{enumerate}
\item $A$ is a henselian local ring,
\item $A \to B$ is integral,
\item $B$ is a domain.
\end{enumerate}
Then $B$ is a henselian local ring and $A \to B$ is a local homomorphism.
If $A$ is strictly henselian, then $B$ is a strictly henselian local ring
and the extension $\kappa(\mathfrak m_B)/\kappa(\mathfrak m_A)$
of residue fields is purely inseparable.
\end{lemma}

\begin{proof}
Write $B$ as a filtered colimit $B = \colim B_i$ of finite $A$-sub algebras.
If we prove the results for each $B_i$, then the result follows for $B$.
See Algebra, Lemma \ref{algebra-lemma-colimit-henselian}.
If $A \to B$ is finite, then $B$ is a product of local henselian rings by
Algebra, Lemma \ref{algebra-lemma-finite-over-henselian}.
Since $B$ is a domain we see that $B$ is a local ring.
The maximal ideal of $B$ lies over the maximal ideal of $A$ by
going up for $A \to B$ (Algebra, Lemma \ref{algebra-lemma-integral-going-up}).
If $A$ is strictly henselian, then the field extension
$\kappa(\mathfrak m_B)/\kappa(\mathfrak m_A)$
being algebraic, has to be purely inseparable.
Of course, then $\kappa(\mathfrak m_B)$ is separably algebraically
closed and $B$ is strictly henselian.
\end{proof}

\begin{theorem}[Olivier]
\label{theorem-olivier}
Let $A \to B$ be a local homomorphism of local rings.
If $A$ is strictly henselian and $A \to B$ is weakly \'etale, then
$A = B$.
\end{theorem}

\begin{proof}
We will show that for all $\mathfrak p \subset A$ there is a unique
prime $\mathfrak q \subset B$ lying over $\mathfrak p$ and
$\kappa(\mathfrak p) = \kappa(\mathfrak q)$.
This implies that $B \otimes_A B \to B$ is bijective on spectra
as well as surjective and flat. Hence it is an isomorphism
for example by the description of pure ideals in
Algebra, Lemma \ref{algebra-lemma-pure-open-closed-specializations}.
Hence $A \to B$ is a faithfully flat epimorphism of rings. We get
$A = B$ by
Algebra, Lemma \ref{algebra-lemma-faithfully-flat-epimorphism}.

\medskip\noindent
Note that the fibre ring $B \otimes_A \kappa(\mathfrak p)$
is a colimit of \'etale extensions of $\kappa(\mathfrak p)$ by
Lemmas \ref{lemma-base-change-weakly-etale} and
\ref{lemma-absolutely-flat-over-field}.
Hence, if there exists more than one prime lying over $\mathfrak p$
or if $\kappa(\mathfrak p) \not = \kappa(\mathfrak q)$ for some $\mathfrak q$,
then $B \otimes_A L$ has a nontrivial idempotent for some (separable)
algebraic field extension $L/\kappa(\mathfrak p)$.

\medskip\noindent
Let $L/\kappa(\mathfrak p)$ be an algebraic field extension.
Let $A' \subset L$ be the integral closure of $A/\mathfrak p$ in $L$.
By Lemma \ref{lemma-integral-over-henselian}
we see that $A'$ is a strictly henselian local ring
whose residue field is a purely inseparable extension of the residue
field of $A$. Thus $B \otimes_A A'$ is a local ring by
Algebra, Lemma \ref{algebra-lemma-local-tensor-with-integral}.
On the other hand, $B \otimes_A A'$ is integrally closed in
$B \otimes_A L$ by Lemma \ref{lemma-normality-goes-up}.
Since $B \otimes_A A'$ is local, it follows that the ring
$B \otimes_A L$ does not have nontrivial
idempotents which is what we wanted to prove.
\end{proof}







\section{Weakly \'etale algebras over fields}
\label{section-weakly-etale-over-field}

\noindent
If $K$ is a field, then an algebra $B$ is weakly \'etale over $K$
if and only if it is a filtered colimit of \'etale $K$-algebras.
This is Lemma \ref{lemma-absolutely-flat-over-field}.

\begin{lemma}
\label{lemma-class-weakly-etale-over-field}
Let $K$ be a field. If $B$ is weakly \'etale over $K$, then
\begin{enumerate}
\item $B$ is reduced,
\item $B$ is integral over $K$,
\item any finitely generated $K$-subalgebra of $B$ is a finite product
of finite separable extensions of $K$,
\item $B$ is a field if and only if $B$ does not have nontrivial idempotents
and in this case it is a separable algebraic extension of $K$,
\item any sub or quotient $K$-algebra of $B$ is weakly \'etale over $K$,
\item if $B'$ is weakly \'etale over $K$, then $B \otimes_K B'$ is
weakly \'etale over $K$.
\end{enumerate}
\end{lemma}

\begin{proof}
Part (1) follows from Lemma \ref{lemma-absolutely-flat-over-absolutely-flat}
but of course it follows from part (3) as well.
Part (3) follows from Lemma \ref{lemma-absolutely-flat-over-field}
and the fact that \'etale $K$-algebras are finite products of
finite separable extensions of $K$, see
Algebra, Lemma \ref{algebra-lemma-etale-over-field}.
Part (3) implies (2).
Part (4) follows from (3) as a product of fields is
a field if and only if it has no nontrivial idempotents.

\medskip\noindent
If $S \subset B$ is a subalgebra, then it is the filtered
colimit of its finitely generated subalgebras which are
all \'etale over $K$ by the above and hence
$S$ is weakly \'etale over $K$ by
Lemma \ref{lemma-absolutely-flat-over-field}.
If $B \to Q$ is a quotient algebra, then
$Q$ is the filtered colimit of $K$-algebra quotients of
finite products $\prod_{i \in I} L_i$ of finite separable extensions
$L_i/K$. Such a quotient is of the form $\prod_{i \in J} L_i$
for some subset $J \subset I$ and hence the result
holds for quotients by the same reasoning.

\medskip\noindent
The statement on tensor products follows in a similar manner
or by combining Lemmas \ref{lemma-base-change-weakly-etale} and
\ref{lemma-composition-weakly-etale}.
\end{proof}

\begin{lemma}
\label{lemma-max-weakly-etale-subalgebra}
Let $K$ be a field. Let $A$ be a $K$-algebra. There exists
a maximal weakly \'etale $K$-subalgebra $B_{max} \subset A$.
\end{lemma}

\begin{proof}
Let $B_1, B_2 \subset A$ be weakly \'etale $K$-subalgebras.
Then $B_1 \otimes_K B_2$ is weakly \'etale over $K$
and so is the image of $B_1 \otimes_K B_2 \to A$
(Lemma \ref{lemma-class-weakly-etale-over-field}).
Thus the collection $\mathcal{B}$ of weakly \'etale $K$-subalgebras
$B \subset A$ is directed and the colimit
$B_{max} = \colim_{B \in \mathcal{B}} B$ is
a weakly \'etale $K$-algebra by Lemma \ref{lemma-when-weakly-etale}.
Hence the image of $B_{max} \to A$ is weakly \'etale over $K$
(previous lemma cited). It follows that this image is in $\mathcal{B}$
and hence $\mathcal{B}$ has a maximal element
(and the image is the same as $B_{max}$).
\end{proof}

\begin{lemma}
\label{lemma-properties-of-max-weakly-etale-subalgebra}
Let $K$ be a field. For a $K$-algebra $A$ denote $B_{max}(A)$
the maximal weakly \'etale $K$-subalgebra of $A$ as in
Lemma \ref{lemma-max-weakly-etale-subalgebra}. Then
\begin{enumerate}
\item any $K$-algebra map $A' \to A$ induces a $K$-algebra map
$B_{max}(A') \to B_{max}(A)$,
\item if $A' \subset A$, then $B_{max}(A') = B_{max}(A) \cap A'$,
\item if $A = \colim A_i$ is a filtered colimit, then
$B_{max}(A) = \colim B_{max}(A_i)$,
\item the map $B_{max}(A) \to B_{max}(A_{red})$ is an isomorphism,
\item $B_{max}(A_1 \times \ldots \times A_n) =
B_{max}(A_1) \times \ldots \times B_{max}(A_n)$,
\item if $A$ has no nontrivial idempotents, then $B_{max}(A)$ is a
field and a separable algebraic extension of $K$,
\item add more here.
\end{enumerate}
\end{lemma}

\begin{proof}
Proof of (1). This is true because the image of $B_{max}(A') \to A$
is weakly \'etale over $K$ by Lemma \ref{lemma-class-weakly-etale-over-field}.

\medskip\noindent
Proof of (2). By (1) we have $B_{max}(A') \subset B_{max}(A)$.
Conversely, $B_{max}(A) \cap A'$ is a weakly \'etale $K$-algebra
by Lemma \ref{lemma-class-weakly-etale-over-field} and hence
contained in $B_{max}(A')$.

\medskip\noindent
Proof of (3). By (1) there is a map $\colim B_{max}(A_i) \to A$
which is injective because the system is filtered and
$B_{max}(A_i) \subset A_i$. The colimit $\colim B_{max}(A_i)$
is weakly \'etale over $K$ by
Lemma \ref{lemma-when-weakly-etale}.
Hence we get an injective map $\colim B_{max}(A_i) \to B_{max}(A)$.
Suppose that $a \in B_{max}(A)$. Then $a$ generates a finitely presented
$K$-subalgebra $B \subset B_{max}(A)$.
By Algebra, Lemma \ref{algebra-lemma-characterize-finite-presentation}
there is an $i$ and a $K$-algebra map $f : B \to A_i$
lifting the given map $B \to A$.
Since $B$ is weakly \'etale by
Lemma \ref{lemma-class-weakly-etale-over-field},
we see that $f(B) \subset B_{max}(A_i)$ and we conclude that $a$
is in the image of $\colim B_{max}(A_i) \to B_{max}(A)$.

\medskip\noindent
Proof of (4). Write $B_{max}(A_{red}) = \colim B_i$
as a filtered colimit of \'etale $K$-algebras
(Lemma \ref{lemma-absolutely-flat-over-field}).
By Algebra, Lemma \ref{algebra-lemma-smooth-strong-lift}
for each $i$ there is a $K$-algebra map $f_i : B_i \to A$
lifting the given map $B_i \to A_{red}$. It follows that the
canonical map $B_{max}(A_{red}) \to B_{max}(A)$ is surjective.
The kernel consists of nilpotent elements and hence is zero
as $B_{max}(A_{red})$ is reduced
(Lemma \ref{lemma-class-weakly-etale-over-field}).

\medskip\noindent
Proof of (5). Omitted.

\medskip\noindent
Proof of (6). Follows from Lemma \ref{lemma-class-weakly-etale-over-field}
part (4).
\end{proof}

\begin{lemma}
\label{lemma-change-fields-max-weakly-etale-subalgebra}
Let $L/K$ be an extension of fields. Let $A$ be a $K$-algebra.
Let $B \subset A$ be the maximal weakly \'etale $K$-subalgebra of
$A$ as in Lemma \ref{lemma-max-weakly-etale-subalgebra}.
Then $B \otimes_K L$ is the maximal weakly \'etale $L$-subalgebra
of $A \otimes_K L$.
\end{lemma}

\begin{proof}
For an algebra $A$ over $K$ we write $B_{max}(A/K)$
for the maximal weakly \'etale $K$-subalgebra of $A$.
Similarly we write $B_{max}(A'/L)$ for the maximal weakly \'etale
$L$-subalgebra of $A'$ if $A'$ is an $L$-algebra.
Since $B_{max}(A/K) \otimes_K L$ is weakly \'etale over $L$
(Lemma \ref{lemma-base-change-weakly-etale})
and since $B_{max}(A/K) \otimes_K L \subset A \otimes_K L$
we obtain a canonical injective map
$$
B_{max}(A/K) \otimes_K L \to B_{max}((A \otimes_K L)/L)
$$
The lemma states that this map is an isomorphism.

\medskip\noindent
To prove the lemma for $L$ and our $K$-algebra $A$, it suffices to
prove the lemma for any field extension $L'$ of $L$. Namely, we have
the factorization
$$
B_{max}(A/K) \otimes_K L' \to
B_{max}((A \otimes_K L)/L) \otimes_L L' \to
B_{max}((A \otimes_K L')/L')
$$
hence the composition cannot be surjective without
$B_{max}(A/K) \otimes_K L \to B_{max}((A \otimes_K L)/L)$
being surjective. Thus we may assume $L$ is algebraically closed.

\medskip\noindent
Reduction to finite type $K$-algebra. We may write $A$
is the filtered colimit of its finite type $K$-subalgebras.
Using Lemma \ref{lemma-properties-of-max-weakly-etale-subalgebra}
we see that it suffices to prove the lemma for finite type
$K$-algebras.

\medskip\noindent
Assume $A$ is a finite type $K$-algebra. Since the kernel
of $A \to A_{red}$ is nilpotent, the same is true for
$A \otimes_K L \to A_{red} \otimes_K L$. Then
$$
B_{max}((A \otimes_K L)/L) \to B_{max}((A_{red} \otimes_K L)/L)
$$
is injective because the kernel is nilpotent and the
weakly \'etale $L$-algebra $B_{max}((A \otimes_K L)/L)$ is reduced
(Lemma \ref{lemma-class-weakly-etale-over-field}).
Since $B_{max}(A/K) = B_{max}(A_{red}/K)$
by Lemma \ref{lemma-properties-of-max-weakly-etale-subalgebra}
we conclude
that it suffices to prove the lemma for $A_{red}$.

\medskip\noindent
Assume $A$ is a reduced finite type $K$-algebra.
Let $Q = Q(A)$ be the total quotient ring of $A$.
Then $A \subset Q$ and $A \otimes_K L \subset Q \otimes_A L$
and hence
$$
B_{max}(A/K) = A \cap B_{max}(Q/K)
$$
and
$$
B_{max}((A \otimes_K L)/L) =
(A \otimes_K L) \cap B_{max}((Q \otimes_K L)/L)
$$
by Lemma \ref{lemma-properties-of-max-weakly-etale-subalgebra}.
Since $-\otimes_K L$ is an exact functor, it follows that
if we prove the result for $Q$, then the result follows for $A$.
Since $Q$ is a finite product of fields (Algebra, Lemmas
\ref{algebra-lemma-total-ring-fractions-no-embedded-points},
\ref{algebra-lemma-minimal-prime-reduced-ring},
\ref{algebra-lemma-Noetherian-irreducible-components}, and
\ref{algebra-lemma-Noetherian-permanence})
and since $B_{max}$ commutes with products
(Lemma \ref{lemma-properties-of-max-weakly-etale-subalgebra})
it suffices to prove the lemma when $A$ is a field.

\medskip\noindent
Assume $A$ is a field. We reduce to $A$ being finitely generated
over $K$ by the argument in the third paragraph of the proof.
(In fact the way we reduced to the case of a field produces
a finitely generated field extension of $K$.)

\medskip\noindent
Assume $A$ is a finitely generated field extension of $K$.
Then $K' = B_{max}(A/K)$ is a field separable algebraic over $K$ by
Lemma \ref{lemma-properties-of-max-weakly-etale-subalgebra} part (6).
Hence $K'$ is a finite separable field extension
of $K$ and $A$ is geometrically irreducible over $K'$ by
Algebra, Lemma \ref{algebra-lemma-make-geometrically-irreducible}.
Since $L$ is algebraically closed and $K'/K$ finite separable
we see that
$$
K' \otimes_K L \to \prod\nolimits_{\sigma \in \Hom_K(K', L)} L,\quad
\alpha \otimes \beta \mapsto (\sigma(\alpha)\beta)_\sigma
$$
is an isomorphism
(Fields, Lemma \ref{fields-lemma-finite-separable-tensor-alg-closed}).
We conclude
$$
A \otimes_K L = A \otimes_{K'} (K' \otimes_K L) =
\prod\nolimits_{\sigma \in \Hom_K(K', L)} A \otimes_{K', \sigma} L
$$
Since $A$ is geometrically irreducible over $K'$ we see that
$A \otimes_{K', \sigma} L$ has a unique minimal prime.
Since $L$ is algebraically closed it follows that
$B_{max}((A \otimes_{K', \sigma} L)/L) = L$
because this $L$-algebra is a field algebraic over $L$ by
Lemma \ref{lemma-properties-of-max-weakly-etale-subalgebra} part (6).
It follows that the maximal weakly \'etale $K' \otimes_K L$-subalgebra
of $A \otimes_K L$ is $K' \otimes_K L$ because we can decompose
these subalgebras into products as above. Hence the inclusion
$K' \otimes_K L \subset B_{max}((A \otimes_K L)/L)$ is an
equality: the ring map $K' \otimes_K L \to B_{max}((A \otimes_K L)/L)$
is weakly \'etale by
Lemma \ref{lemma-weakly-etale-permanence}.
\end{proof}












\section{Local irreducibility}
\label{section-unibranch}

\noindent
The following definition seems to be the generally accepted one.
To parse it, observe that if $A \subset B$ is an integral extension of local
domains, then $A \to B$ is a local ring homomorphism by
going up (Algebra, Lemma \ref{algebra-lemma-integral-going-up}).

\begin{definition}
\label{definition-unibranch}
\begin{reference}
\cite[Chapter 0 (23.2.1)]{EGA4}
\end{reference}
Let $A$ be a local ring. We say $A$ is {\it unibranch}
if the reduction $A_{red}$ is a domain and if the integral closure
$A'$ of $A_{red}$ in its field of fractions is local.
We say $A$ is {\it geometrically unibranch} if $A$ is unibranch
and moreover the residue field of $A'$ is purely inseparable over
the residue field of $A$.
\end{definition}

\noindent
Let $A$ be a local ring. Here is an equivalent formulation
\begin{enumerate}
\item $A$ is unibranch if $A$ has a unique minimal prime $\mathfrak p$ and
the integral closure of $A/\mathfrak p$ in its fraction field is a
local ring, and
\item $A$ is geometrically unibranch if $A$ has a unique minimal prime
$\mathfrak p$ and the integral closure of $A/\mathfrak p$ in its
fraction field is a local ring whose residue field is purely inseparable
over the residue field of $A$.
\end{enumerate}
A local ring which is normal is geometrically unibranch
(follows from Definition \ref{definition-unibranch} and
Algebra, Definition \ref{algebra-definition-ring-normal}).
Lemmas \ref{lemma-unibranch} and \ref{lemma-geometrically-unibranch}
suggest that being (geometrically) unibranch
is a reasonable property to look at.

\begin{lemma}
\label{lemma-branches}
Let $A$ be a local ring. Assume $A$ has finitely many minimal prime ideals.
Let $A'$ be the integral closure of $A$ in the total ring of fractions
of $A_{red}$.
Let $A^h$ be the henselization of $A$.
Consider the maps
$$
\Spec(A') \leftarrow \Spec((A')^h) \rightarrow \Spec(A^h)
$$
where $(A')^h = A' \otimes_A A^h$. Then
\begin{enumerate}
\item the left arrow is bijective on maximal ideals,
\item the right arrow is bijective on minimal primes,
\item every minimal prime of $(A')^h$ is contained in a unique
maximal ideal and every maximal ideal contains exactly one minimal prime.
\end{enumerate}
\end{lemma}

\begin{proof}
Let $I \subset A$ be the ideal of nilpotents.
We have $(A/I)^h = A^h/IA^h$ by
(Algebra, Lemma \ref{algebra-lemma-quotient-henselization}).
The spectra of $A$, $A^h$, $A'$, and $(A')^h$ are the same
as the spectra of $A/I$, $A^h/IA^h$, $A'$, and
$(A')^h = A' \otimes_{A/I} A^h/IA^h$. Thus
we may replace $A$ by $A_{red} = A/I$ and assume $A$ is reduced.
Then $A \subset A'$ which we will use below without further mention.

\medskip\noindent
Proof of (1). As $A'$ is integral over $A$ we see that $(A')^h$
is integral over $A^h$. By going up
(Algebra, Lemma \ref{algebra-lemma-integral-going-up})
every maximal ideal of $A'$, resp.\ $(A')^h$ lies over
the maximal ideal $\mathfrak m$, resp.\ $\mathfrak m^h$ of
$A$, resp.\ $A^h$. Thus (1) follows from the isomorphism
$$
(A')^h \otimes_{A^h} \kappa^h =
A' \otimes_A A^h \otimes_{A^h} \kappa^h = A' \otimes_A \kappa
$$
because the residue field extension $\kappa^h/\kappa$
induced by $A \to A^h$ is trivial. We will use below that the
displayed ring is integral over a field hence spectrum of
this ring is a profinite space, see
Algebra, Lemmas \ref{algebra-lemma-integral-over-field} and
\ref{algebra-lemma-ring-with-only-minimal-primes}.

\medskip\noindent
Proof of (3). The ring $A'$ is a normal ring and in fact a
finite product of normal domains, see
Algebra, Lemma \ref{algebra-lemma-characterize-reduced-ring-normal}.
Since $A^h$ is a filtered colimit of \'etale $A$-algebras,
$(A')^h$ is filtered colimit of \'etale $A'$-algebras
hence $(A')^h$ is a normal ring by
Algebra, Lemmas \ref{algebra-lemma-normal-goes-up} and
\ref{algebra-lemma-colimit-normal-ring}.
Thus every local ring of $(A')^h$ is a normal domain
and we see that every maximal ideal contains a unique minimal prime.
By Lemma \ref{lemma-integral-over-henselian-pair} applied
to $A^h \to (A')^h$ we see that $((A')^h, \mathfrak m(A')^h)$ is
a henselian pair. If $\mathfrak q \subset (A')^h$
is a minimal prime (or any prime), then the intersection of
$V(\mathfrak q)$ with $V(\mathfrak m (A')^h)$ is connected
by Lemma \ref{lemma-irreducible-henselian-pair-connected}
Since $V(\mathfrak m (A')^h) = \Spec((A')^h \otimes \kappa^h)$
is a profinite space by we see there is a unique
maximal ideal containing $\mathfrak q$.

\medskip\noindent
Proof of (2). The minimal primes of $A'$ are exactly the primes
lying over a minimal prime of $A$ (by construction).
Since $A' \to (A')^h$ is flat by going down
(Algebra, Lemma \ref{algebra-lemma-flat-going-down})
every minimal prime of $(A')^h$ lies over a minimal prime
of $A'$. Conversely, any prime of $(A')^h$ lying over a
minimal prime of $A'$ is minimal because $(A')^h$ is a filtered
colimit of \'etale hence quasi-finite algebras over $A'$ (small detail omitted).
We conclude that the minimal primes of $(A')^h$
are exactly the primes which lie over a minimal prime of $A$.
Similarly, the minimal primes of $A^h$ are exactly the
primes lying over minimal primes of $A$.
By construction we have $A' \otimes_A Q(A) = Q(A)$ where $Q(A)$
is the total fraction ring of our reduced local ring $A$.
Of course $Q(A)$ is the finite product of residue fields of
the minimal primes of $A$. It follows that
$$
(A')^h \otimes_A Q(A) = A^h \otimes_A A' \otimes_A Q(A) = A^h \otimes_A Q(A)
$$
Our discussion above shows the spectrum of the ring
on the left is the set of minimal primes of $(A')^h$
and the spectrum of the ring on the right is the
is the set of minimal primes of $A^h$. This finishes the proof.
\end{proof}

\begin{lemma}
\label{lemma-unibranch}
\begin{reference}
\cite[Chapter IV Proposition 18.6.12]{EGA4}
\end{reference}
Let $A$ be a local ring. Let $A^h$ be the henselization of $A$.
The following are equivalent
\begin{enumerate}
\item $A$ is unibranch, and
\item $A^h$ has a unique minimal prime.
\end{enumerate}
\end{lemma}

\begin{proof}
This follows from Lemma \ref{lemma-branches} but we will also give a
direct proof. Denote $\mathfrak m$ the maximal ideal of the ring $A$.
Recall that the residue field $\kappa = A/\mathfrak m$ is the same as
the residue field of $A^h$.

\medskip\noindent
Assume (2). Let $\mathfrak p^h$ be the unique minimal prime of
$A^h$. The flatness of $A \to A^h$ implies that
$\mathfrak p = A \cap \mathfrak p^h$ is the unique minimal
prime of $A$ (by going down, see
Algebra, Lemma \ref{algebra-lemma-flat-going-down}).
Also, since $A^h/\mathfrak pA^h = (A/\mathfrak p)^h$ (see
Algebra, Lemma \ref{algebra-lemma-quotient-henselization})
is reduced by Lemma \ref{lemma-henselization-reduced}
we see that $\mathfrak p^h = \mathfrak pA^h$.
Let $A'$ be the integral closure of $A/\mathfrak p$ in its fraction
field. We have to show that $A'$ is local.
Since $A \to A'$ is integral, every maximal ideal of $A'$ lies over
$\mathfrak m$ (by going up for integral ring maps, see
Algebra, Lemma \ref{algebra-lemma-integral-going-up}).
If $A'$ is not local, then we can find distinct maximal ideals
$\mathfrak m_1$, $\mathfrak m_2$. Choose elements $f_1, f_2 \in A'$
with $f_i \in \mathfrak m_i$ and $f_i \not \in \mathfrak m_{3 - i}$.
We find a finite subalgebra $B = A[f_1, f_2] \subset A'$ with distinct maximal
ideals $B \cap \mathfrak m_i$, $i = 1, 2$.
Note that the inclusions
$$
A/\mathfrak p \subset B \subset \kappa(\mathfrak p)
$$
give, on tensoring with the flat ring map $A \to A^h$ the inclusions
$$
A^h/\mathfrak p^h \subset
B \otimes_A A^h \subset
\kappa(\mathfrak p) \otimes_A A^h \subset
\kappa(\mathfrak p^h)
$$
the last inclusion because
$\kappa(\mathfrak p) \otimes_A A^h =
\kappa(\mathfrak p) \otimes_{A/\mathfrak p} A^h/\mathfrak p^h$
is a localization of the domain $A^h/\mathfrak p^h$.
Note that $B \otimes_A \kappa$ has at least two maximal ideals
because $B/\mathfrak mB$ has two maximal ideals. Hence, as
$A^h$ is henselian we see that
$B \otimes_A A^h$ is a product of $\geq 2$ local rings, see
Algebra, Lemma \ref{algebra-lemma-mop-up}.
But we've just seen that $B \otimes_A A^h$ is a subring of a domain
and we get a contradiction.

\medskip\noindent
Assume (1). Let $\mathfrak p \subset A$ be the unique minimal
prime and let $A'$ be the integral closure of $A/\mathfrak p$
in its fraction field. Let $A \to B$ be a local map of local rings
inducing an isomorphism of residue fields which is a
localization of an \'etale $A$-algebra. In particular $\mathfrak m_B$
is the unique prime containing $\mathfrak m B$. Then $B' = A' \otimes_A B$
is integral over $B$ and the assumption that $A \to A'$ is local
implies that $B'$ is local
(Algebra, Lemma \ref{algebra-lemma-local-tensor-with-integral}).
On the other hand, $A' \to B'$ is the localization
of an \'etale ring map, hence $B'$ is normal, see
Algebra, Lemma \ref{algebra-lemma-normal-goes-up}.
Thus $B'$ is a (local) normal domain. Finally, we have
$$
B/\mathfrak pB \subset B \otimes_A \kappa(\mathfrak p)
= B' \otimes_{A'} (\text{fraction field of }A') \subset
\text{fraction field of }B'
$$
Hence $B/\mathfrak pB$ is a domain, which implies that $B$ has a unique
minimal prime (since by flatness of $A \to B$ these all have to lie
over $\mathfrak p$). Since $A^h$ is a filtered colimit of
the local rings $B$ it follows that $A^h$ has a unique minimal prime.
Namely, if $fg = 0$ in $A^h$ for some non-nilpotent elements
$f, g$, then we can find a $B$ as above containing both $f$ and $g$
which leads to a contradiction.
\end{proof}

\begin{lemma}
\label{lemma-geometric-branches}
Let $(A, \mathfrak m, \kappa)$ be a local ring.
Assume $A$ has finitely many minimal prime ideals.
Let $A'$ be the integral closure of $A$ in the total ring of fractions
of $A_{red}$. Choose an algebraic closure $\overline{\kappa}$ of
$\kappa$ and denote $\kappa^{sep} \subset \overline{\kappa}$
the separable algebraic closure of $\kappa$.
Let $A^{sh}$ be the strict henselization of $A$
with respect to $\kappa^{sep}$.
Consider the maps
$$
\Spec(A') \xleftarrow{c} \Spec((A')^{sh}) \xrightarrow{e} \Spec(A^{sh})
$$
where $(A')^{sh} = A' \otimes_A A^{sh}$. Then
\begin{enumerate}
\item for $\mathfrak m' \subset A'$ maximal the residue field
$\kappa'$ is algebraic over $\kappa$ and the fibre of $c$
over $\mathfrak m'$ can be canonically identified
with $\Hom_\kappa(\kappa', \overline{\kappa})$,
\item the right arrow is bijective on minimal primes,
\item every minimal prime of $(A')^{sh}$ is contained in a unique
maximal ideal and every maximal ideal contains a unique minimal prime.
\end{enumerate}
\end{lemma}

\begin{proof}
The proof is almost exactly the same as for Lemma \ref{lemma-branches}.
Let $I \subset A$ be the ideal of nilpotents.
We have $(A/I)^{sh} = A^{sh}/IA^{sh}$ by
(Algebra, Lemma \ref{algebra-lemma-quotient-henselization}).
The spectra of $A$, $A^{sh}$, $A'$, and $(A')^h$ are the same
as the spectra of $A/I$, $A^{sh}/IA^{sh}$, $A'$, and
$(A')^{sh} = A' \otimes_{A/I} A^{sh}/IA^{sh}$. Thus
we may replace $A$ by $A_{red} = A/I$ and assume $A$ is reduced.
Then $A \subset A'$ which we will use below without further mention.

\medskip\noindent
Proof of (1). The field extension $\kappa'/\kappa$ is algebraic
because $A'$ is integral over $A$. Since $A'$ is integral over $A$,
we see that $(A')^{sh}$ is integral over $A^{sh}$. By going up
(Algebra, Lemma \ref{algebra-lemma-integral-going-up})
every maximal ideal of $A'$, resp.\ $(A')^{sh}$ lies over
the maximal ideal $\mathfrak m$, resp.\ $\mathfrak m^{sh}$ of
$A$, resp.\ $A^h$. We have
$$
(A')^{sh} \otimes_{A^{sh}} \kappa^{sep} =
A' \otimes_A A^h \otimes_{A^h} \kappa^{sep} =
(A' \otimes_A \kappa) \otimes_{\kappa} \kappa^{sep}
$$
because the residue field of $A^{sh}$ is $\kappa^{sep}$.
Thus the fibre of $c$ over $\mathfrak m'$ is the spectrum
of $\kappa' \otimes_\kappa \kappa^{sep}$.
We conclude (1) is true because there is a bijection
$$
\Hom_\kappa(\kappa', \overline{\kappa}) \to
\Spec(\kappa' \otimes_\kappa \kappa^{sep}),\quad
\sigma \mapsto \Ker(
\sigma \otimes 1 : \kappa' \otimes_\kappa \kappa^{sep} \to \overline{\kappa}
)
$$
We will use below that the displayed ring is integral over a field
hence spectrum of this ring is a profinite space, see
Algebra, Lemmas \ref{algebra-lemma-integral-over-field} and
\ref{algebra-lemma-ring-with-only-minimal-primes}.

\medskip\noindent
Proof of (3). The ring $A'$ is a normal ring and in fact a
finite product of normal domains, see
Algebra, Lemma \ref{algebra-lemma-characterize-reduced-ring-normal}.
Since $A^{sh}$ is a filtered colimit of \'etale $A$-algebras,
$(A')^{sh}$ is filtered colimit of \'etale $A'$-algebras
hence $(A')^{sh}$ is a normal ring by
Algebra, Lemmas \ref{algebra-lemma-normal-goes-up} and
\ref{algebra-lemma-colimit-normal-ring}.
Thus every local ring of $(A')^{sh}$ is a normal domain
and we see that every maximal ideal contains a unique minimal prime.
By Lemma \ref{lemma-integral-over-henselian-pair} applied
to $A^{sh} \to (A')^{sh}$ to see that $((A')^{sh}, \mathfrak m(A')^{sh})$
is a henselian pair. If $\mathfrak q \subset (A')^{sh}$
is a minimal prime (or any prime), then the intersection of
$V(\mathfrak q)$ with $V(\mathfrak m (A')^{sh})$ is connected
by Lemma \ref{lemma-irreducible-henselian-pair-connected}
Since $V(\mathfrak m (A')^{sh}) = \Spec((A')^{sh} \otimes \kappa^{sh})$
is a profinite space by we see there is a unique
maximal ideal containing $\mathfrak q$.

\medskip\noindent
Proof of (2). The minimal primes of $A'$ are exactly the primes
lying over a minimal prime of $A$ (by construction).
Since $A' \to (A')^{sh}$ is flat by going down
(Algebra, Lemma \ref{algebra-lemma-flat-going-down})
every minimal prime of $(A')^{sh}$ lies over a minimal prime
of $A'$. Conversely, any prime of $(A')^{sh}$ lying over a
minimal prime of $A'$ is minimal because $(A')^{sh}$ is a filtered
colimit of \'etale hence quasi-finite algebras over $A'$ (small detail omitted).
We conclude that the minimal primes of $(A')^{sh}$
are exactly the primes which lie over a minimal prime of $A$.
Similarly, the minimal primes of $A^{sh}$ are exactly the
primes lying over minimal primes of $A$.
By construction we have $A' \otimes_A Q(A) = Q(A)$ where $Q(A)$
is the total fraction ring of our reduced local ring $A$.
Of course $Q(A)$ is the finite product of residue fields of
the minimal primes of $A$. It follows that
$$
(A')^{sh} \otimes_A Q(A) =
A^{sh} \otimes_A A' \otimes_A Q(A) = A^{sh} \otimes_A Q(A)
$$
Our discussion above shows the spectrum of the ring
on the left is the set of minimal primes of $(A')^{sh}$
and the spectrum of the ring on the right is the
is the set of minimal primes of $A^{sh}$. This finishes the proof.
\end{proof}

\begin{lemma}
\label{lemma-geometrically-unibranch}
\begin{reference}
\cite[Lemma 2.2]{Etale-coverings} and
\cite[Chapter IV Proposition 18.8.15]{EGA4}
\end{reference}
Let $A$ be a local ring. Let $A^{sh}$ be a strict henselization of $A$.
The following are equivalent
\begin{enumerate}
\item $A$ is geometrically unibranch, and
\item $A^{sh}$ has a unique minimal prime.
\end{enumerate}
\end{lemma}

\begin{proof}
This follows from Lemma \ref{lemma-geometric-branches}
but we will also give a direct proof; this direct
proof is almost exactly the same as the direct proof of
Lemma \ref{lemma-unibranch}.
Denote $\mathfrak m$ the maximal ideal of the ring $A$.
Denote $\kappa$, $\kappa^{sh}$ the residue field of $A$, $A^{sh}$.

\medskip\noindent
Assume (2). Let $\mathfrak p^{sh}$ be the unique minimal prime of
$A^{sh}$. The flatness of $A \to A^{sh}$ implies that
$\mathfrak p = A \cap \mathfrak p^{sh}$ is the unique minimal
prime of $A$ (by going down, see
Algebra, Lemma \ref{algebra-lemma-flat-going-down}).
Also, since $A^{sh}/\mathfrak pA^{sh} = (A/\mathfrak p)^{sh}$ (see
Algebra, Lemma \ref{algebra-lemma-quotient-strict-henselization})
is reduced by Lemma \ref{lemma-henselization-reduced}
we see that $\mathfrak p^{sh} = \mathfrak pA^{sh}$.
Let $A'$ be the integral closure of $A/\mathfrak p$ in its fraction
field. We have to show that $A'$ is local and that its residue
field is purely inseparable over $\kappa$.
Since $A \to A'$ is integral, every maximal ideal of $A'$ lies over
$\mathfrak m$ (by going up for integral ring maps, see
Algebra, Lemma \ref{algebra-lemma-integral-going-up}).
If $A'$ is not local, then we can find distinct maximal ideals
$\mathfrak m_1$, $\mathfrak m_2$. Choosing elements $f_1, f_2 \in A'$
with $f_i \in \mathfrak m_i, f_i \not \in \mathfrak m_{3 - i}$ we find
a finite subalgebra $B = A[f_1, f_2] \subset A'$ with distinct maximal
ideals $B \cap \mathfrak m_i$, $i = 1, 2$. If $A'$ is local with maximal
ideal $\mathfrak m'$, but $A/\mathfrak m \subset A'/\mathfrak m'$
is not purely inseparable, then we can find $f \in A'$ whose image in
$A'/\mathfrak m'$ generates a finite, not purely inseparable extension
of $A/\mathfrak m$ and we find a finite local subalgebra $B = A[f] \subset A'$
whose residue field is not a purely inseparable extension of $A/\mathfrak m$.
Note that the inclusions
$$
A/\mathfrak p \subset B \subset \kappa(\mathfrak p)
$$
give, on tensoring with the flat ring map $A \to A^{sh}$ the inclusions
$$
A^{sh}/\mathfrak p^{sh} \subset
B \otimes_A A^{sh} \subset
\kappa(\mathfrak p) \otimes_A A^{sh} \subset
\kappa(\mathfrak p^{sh})
$$
the last inclusion because
$\kappa(\mathfrak p) \otimes_A A^{sh} =
\kappa(\mathfrak p) \otimes_{A/\mathfrak p} A^{sh}/\mathfrak p^{sh}$
is a localization of the domain $A^{sh}/\mathfrak p^{sh}$.
Note that $B \otimes_A \kappa^{sh}$ has at least two maximal ideals
because $B/\mathfrak mB$ either has two maximal ideals or one whose
residue field is not purely inseparable over $\kappa$, and because
$\kappa^{sh}$ is separably algebraically closed. Hence, as
$A^{sh}$ is strictly henselian we see that
$B \otimes_A A^{sh}$ is a product of $\geq 2$ local rings, see
Algebra, Lemma \ref{algebra-lemma-mop-up-strictly-henselian}.
But we've just seen that $B \otimes_A A^{sh}$ is a subring of a domain
and we get a contradiction.

\medskip\noindent
Assume (1). Let $\mathfrak p \subset A$ be the unique minimal
prime and let $A'$ be the integral closure of $A/\mathfrak p$
in its fraction field. Let $A \to B$ be a local map of local rings which is a
localization of an \'etale $A$-algebra. In particular $\mathfrak m_B$
is the unique prime containing $\mathfrak m_AB$. Then $B' = A' \otimes_A B$
is integral over $B$ and the assumption that $A \to A'$ is local
with purely inseparable residue field extension implies that $B'$
is local (Algebra, Lemma \ref{algebra-lemma-local-tensor-with-integral}).
On the other hand, $A' \to B'$ is the localization
of an \'etale ring map, hence $B'$ is normal, see
Algebra, Lemma \ref{algebra-lemma-normal-goes-up}.
Thus $B'$ is a (local) normal domain. Finally, we have
$$
B/\mathfrak pB \subset B \otimes_A \kappa(\mathfrak p)
= B' \otimes_{A'} (\text{fraction field of }A') \subset
\text{fraction field of }B'
$$
Hence $B/\mathfrak pB$ is a domain, which implies that $B$ has a unique
minimal prime (since by flatness of $A \to B$ these all have to lie
over $\mathfrak p$). Since $A^{sh}$ is a filtered colimit of
the local rings $B$ it follows that $A^{sh}$ has a unique minimal prime.
Namely, if $fg = 0$ in $A^{sh}$ for some non-nilpotent elements
$f, g$, then we can find a $B$ as above containing both $f$ and $g$
which leads to a contradiction.
\end{proof}

\begin{definition}
\label{definition-number-of-branches}
Let $A$ be a local ring with henselization $A^h$ and
strict henselization $A^{sh}$. The {\it number of branches of $A$}
is the number of minimal primes of $A^h$ if finite and $\infty$
otherwise. The {\it number of geometric branches of $A$}
is the number of minimal primes of $A^{sh}$ if finite and $\infty$
otherwise.
\end{definition}

\noindent
We spell out the relationship with Definition \ref{definition-unibranch}.

\begin{lemma}
\label{lemma-number-of-branches-1}
Let $(A, \mathfrak m, \kappa)$ be a local ring.
\begin{enumerate}
\item If $A$ has infinitely many minimal prime ideals, then
the number of (geometric) branches of $A$ is $\infty$.
\item The number of branches of $A$ is $1$ if and only if
$A$ is unibranch.
\item The number of geometric branches of $A$ is $1$ if and only if
$A$ is geometrically unibranch.
\end{enumerate}
Assume $A$ has finitely many minimal primes and let $A'$ be the
integral closure of $A$ in the total ring of fractions of $A_{red}$.
Then
\begin{enumerate}
\item[(4)] the number of branches of $A$ is the number of maximal ideals
$\mathfrak m'$ of $A'$,
\item[(5)] to get the number of geometric branches of $A$ we have to count
each maximal ideal $\mathfrak m'$ of $A'$ with multiplicity given by the
separable degree of $\kappa(\mathfrak m')/\kappa$.
\end{enumerate}
\end{lemma}

\begin{proof}
This lemma follows immediately from the definitions,
Lemma \ref{lemma-branches},
Lemma \ref{lemma-geometric-branches}, and
Fields, Lemma \ref{fields-lemma-separable-degree}.
\end{proof}

\begin{lemma}
\label{lemma-invariance-number-branches-smooth}
Let $A \to B$ be a local homomorphism of local rings which
is the localization of a smooth ring map.
\begin{enumerate}
\item The number of geometric branches of $A$ is equal to the number
of geometric branches of $B$.
\item If $A \to B$ induces a purely inseparable extension of residue fields,
then the number of branches of $A$ is the number of branches of $B$.
\end{enumerate}
\end{lemma}

\begin{proof}
We will use that smooth ring maps are flat
(Algebra, Lemma \ref{algebra-lemma-smooth-syntomic}),
that localizations are flat (Algebra, Lemma
\ref{algebra-lemma-flat-localization}),
that compositions of flat ring maps are flat
(Algebra, Lemma \ref{algebra-lemma-composition-flat}),
that base change of a flat ring map is flat
(Algebra, Lemma \ref{algebra-lemma-flat-base-change}),
that flat local homomorphisms are faithfully flat
(Algebra, Lemma \ref{algebra-lemma-local-flat-ff}),
that (strict) henselization is flat
(Lemma \ref{lemma-dumb-properties-henselization}), and
Going down for flat ring maps
(Algebra, Lemma \ref{algebra-lemma-flat-going-down}).

\medskip\noindent
Proof of (2). Let $A^h$, $B^h$ be the henselizations of $A$, $B$. Then $B^h$
is the henselization of $A^h \otimes_A B$ at the unique
maximal ideal lying over $\mathfrak m_B$, see
Algebra, Lemma \ref{algebra-lemma-henselian-functorial-improve}.
Thus we may and do assume $A$ is henselian.
Since $A \to B \to B^h$ is flat, every minimal prime of $B^h$
lies over a minimal prime of $A$ and since $A \to B^h$ is faithfully flat,
every minimal prime of $A$ does lie under a minimal prime of $B^h$;
in both cases use going down for flat ring maps.
Therefore it suffices to show that given a minimal prime
$\mathfrak p \subset A$, there is at most one minimal prime
of $B^h$ lying over $\mathfrak p$.
After replacing $A$ by $A/\mathfrak p$ and $B$ by $B/\mathfrak p B$
we may assume that $A$ is a domain; the $A$ is still henselian by
Algebra, Lemma \ref{algebra-lemma-quotient-henselization}.
By Lemma \ref{lemma-unibranch} we see that the integral closure
$A'$ of $A$ in its field of fractions is a local domain.
Of course $A'$ is a normal domain. By
Algebra, Lemma \ref{algebra-lemma-normal-goes-up}
we see that $A' \otimes_A B^h$ is a normal ring
(the lemma just gives it for $A' \otimes_A B$, to go up to
$A' \otimes_A B^h$ use that $B^h$ is a colimit of \'etale
$B$-algebras and use Algebra, Lemma \ref{algebra-lemma-colimit-normal-ring}).
By Algebra, Lemma \ref{algebra-lemma-local-tensor-with-integral}
we see that $A' \otimes_A B^h$ is local (this is where we
use the assumption on the residue fields of $A$ and $B$).
Hence $A' \otimes_A B^h$ is a local normal ring, hence a local domain.
Since $B^h \subset A' \otimes_A B^h$ by flatness of $A \to B^h$
we conclude that $B^h$ is a domain as desired.

\medskip\noindent
Proof of (1). Let $A^{sh}$, $B^{sh}$ be strict henselizations
of $A$, $B$. Then $B^{sh}$ is a strict henselization of
$A^h \otimes_A B$ at a maximal ideal lying over $\mathfrak m_B$
and $\mathfrak m_{A^h}$, see
Algebra, Lemma \ref{algebra-lemma-strictly-henselian-functorial-improve}.
Thus we may and do assume $A$ is strictly henselian.
Since $A \to B \to B^{sh}$ is flat, every minimal prime of $B^{sh}$
lies over a minimal prime of $A$ and since $A \to B^{sh}$ is faithfully flat,
every minimal prime of $A$ does lie under a minimal prime of $B^{sh}$;
in both cases use going down for flat ring maps.
Therefore it suffices to show that given a minimal prime
$\mathfrak p \subset A$, there is at most one minimal prime
of $B^{sh}$ lying over $\mathfrak p$.
After replacing $A$ by $A/\mathfrak p$ and $B$ by $B/\mathfrak p B$
we may assume that $A$ is a domain; then $A$ is still strictly henselian by
Algebra, Lemma \ref{algebra-lemma-quotient-strict-henselization}.
By Lemma \ref{lemma-geometrically-unibranch} we see that the integral closure
$A'$ of $A$ in its field of fractions is a local domain whose residue
field is a purely inseparable extension of the residue field of $A$.
Of course $A'$ is a normal domain. By
Algebra, Lemma \ref{algebra-lemma-normal-goes-up}
we see that $A' \otimes_A B^{sh}$ is a normal ring
(the lemma just gives it for $A' \otimes_A B$, to go up to
$A' \otimes_A B^{sh}$ use that $B^{sh}$ is a colimit of \'etale
$B$-algebras and use Algebra, Lemma \ref{algebra-lemma-colimit-normal-ring}).
By Algebra, Lemma \ref{algebra-lemma-local-tensor-with-integral}
we see that $A' \otimes_A B^{sh}$ is local (since $A \subset A'$
induces a purely inseparable residue field extension).
Hence $A' \otimes_A B^{sh}$ is a local normal ring, hence a local domain.
Since $B^{sh} \subset A' \otimes_A B^{sh}$ by flatness of $A \to B^{sh}$
we conclude that $B^{sh}$ is a domain as desired.
\end{proof}







\section{Miscellaneous on branches}
\label{section-branches}

\noindent
Some results related to branches of local rings as defined
in Section \ref{section-unibranch}.

\begin{lemma}
\label{lemma-ideal-inverse-nonzero}
Let $A$ and $B$ be domains and let $A \to B$ be a ring map.
Assume $A \to B$ has additionally at least one of the following properties
\begin{enumerate}
\item it is the localization of an \'etale ring map,
\item it is flat and the localization of an unramified ring map,
\item it is flat and the localization of a quasi-finite ring map,
\item it is flat and the localization of an integral ring map,
\item it is flat and there are no nontrivial specializations between points
of fibres of $\Spec(B) \to \Spec(A)$,
\item $\Spec(B) \to \Spec(A)$ maps the generic point to the generic
point and there are no nontrivial specializations between points of fibres, or
\item exactly one point of $\Spec(B)$ is mapped to the generic
point of $\Spec(A)$.
\end{enumerate}
Then $A \cap J$ is nonzero for every nonzero ideal $J$ of $B$.
\end{lemma}

\begin{proof}
Proof in case (7).
Let $K$, resp.\ $L$ be the fraction field of $A$, resp.\ $B$.
By Algebra, Lemma
\ref{algebra-lemma-minimal-prime-image-minimal-prime} we see that
the unique point of $\Spec(B)$ which maps to the generic
point $(0) \in \Spec(A)$ is $(0) \in \Spec(B)$.
We conclude that $B \otimes_A K$ is a ring with a unique prime
ideal whose residue field is $L$ (in fact it is equal to $L$ but
we do not need this).
Choose $b \in J$ nonzero. Then $b$ maps to a unit of $L$.
Hence $b$ maps to a unit of $B \otimes_A K$
(Algebra, Lemma \ref{algebra-lemma-surjective-on-spec-units}).
Since $B \otimes_A K = \colim_{f \in A \setminus \{0\}} B_f$
we see that $b$ maps to a unit of $B_f$ for some $f \in A$ nonzero.
This means that $b b' = f^n$ for some $b' \in B$ and $n \geq 1$.
Thus $f^n \in A \cap J$ as desired.

\medskip\noindent
In the rest of the proof, we show that each of the other assumptions imply (7).
Under assumptions (1) -- (5), the ring map $A \to B$ is flat and
hence $A \to B$ is injective (since flat local homomorphisms are
faithfully flat by Algebra, Lemma \ref{algebra-lemma-local-flat-ff}).
Hence the generic point of $\Spec(B)$
maps to the generic point of $\Spec(A)$. Now, if there are no
nontrivial specializations
between points of fibres of $\Spec(B) \to \Spec(A)$, then of course
this generic point of $\Spec(B)$ has to be the unique point mapping
to the generic point of $\Spec(A)$. So (6) implies (7).
Finally, to finish we show that in cases (1) -- (5) there are no
nontrivial specializations
between the points of fibres of $\Spec(B) \to \Spec(A)$.
Namely, see
Algebra, Lemma \ref{algebra-lemma-integral-no-inclusion} for
the integral case,
Algebra, Definition \ref{algebra-definition-quasi-finite}
for the quasi-finite case, and use that
unramified and \'etale ring maps are quasi-finite
(Algebra, Lemmas \ref{algebra-lemma-unramified-quasi-finite} and
\ref{algebra-lemma-etale-quasi-finite}).
\end{proof}

\begin{lemma}
\label{lemma-local-unramified-extension-unibranch-domain-is-etale}
Let $A \to B$ be a ring map. Let $\mathfrak q \subset B$ be a prime
ideal lying over the prime $\mathfrak p \subset A$. Assume
\begin{enumerate}
\item $A$ is a domain,
\item $A_\mathfrak p$ is geometrically unibranch,
\item $A \to B$ is unramified at $\mathfrak q$, and
\item $A_\mathfrak p \to B_\mathfrak q$ is injective.
\end{enumerate}
Then there exists a $g \in B$, $g \not \in \mathfrak q$ such that
$B_g$ is \'etale over $A$.
\end{lemma}

\begin{proof}
By Algebra, Proposition \ref{algebra-proposition-unramified-locally-standard}
after replacing $B$ by a principal localization, we can find a
standard \'etale ring map $A \to B'$ and a surjection $B' \to B$.
Denote $\mathfrak q' \subset B'$ the inverse image of $\mathfrak q$.
We will show that $B' \to B$ is injective
after possibly replacing $B'$ by a principal localization.

\medskip\noindent
In this paragraph we reduce to the case that $B'$ is a domain.
Since $A$ is a domain, the ring $B'$ is reduced, see
Algebra, Lemma \ref{lemma-reduced-goes-up}.
Let $K$ be the fraction field of $A$. Then $B' \otimes_A K$
is \'etale over a field, hence is a finite product of fields, see
Algebra, Lemma \ref{algebra-lemma-etale-over-field}.
Since $A \to B'$ is \'etale (hence flat) the minimal primes of $B'$
are lie over $(0) \subset A$ (by going down for flat ring maps).
We conclude that $B'$ has finitely many minimal primes, say
$\mathfrak r_1, \ldots, \mathfrak r_r \subset B'$.
Since $A_\mathfrak p$ is geometrically unibranch and $A \to B'$ \'etale,
the ring $B'_{\mathfrak q'}$ is a domain, see
Lemmas \ref{lemma-invariance-number-branches-smooth} and
\ref{lemma-number-of-branches-1}.
Hence $\mathfrak q' \supset \mathfrak r_i$ for exactly one $i = i_0$.
Choose $g' \in B'$, $g' \not \in \mathfrak r_{i_0}$ but
$g' \in \mathfrak r_i$ for $i \not = i_0$, see
Algebra, Lemma \ref{algebra-lemma-silly}. After replacing
$B'$ and $B$ by $B'_{g'}$ and $B_{g'}$ we obtain that $B'$
is a domain.

\medskip\noindent
Assume $B'$ is a domain, in particular $B' \subset B'_{\mathfrak q'}$.
If $B' \to B$ is not injective,
then $J = \Ker(B'_{\mathfrak q'} \to B_\mathfrak q)$ is nonzero.
By Lemma \ref{lemma-ideal-inverse-nonzero} applied to
$A_\mathfrak p \to B'_{\mathfrak q'}$
we find a nonzero element $a \in A_\mathfrak p$
mapping to zero in $B_\mathfrak q$ contradicting
assumption (4). This finishes the proof.
\end{proof}

\begin{lemma}
\label{lemma-unramified-extension-unibranch-domain-is-etale}
\begin{reference}
Generalization of \cite[Expose I, Theorem 9.5 part (ii)]{SGA1}
\end{reference}
Let $(A, \mathfrak m)$ be a geometrically unibranch local domain. Let
$A \to B$ be an injective local homomorphism of local rings,
which is essentially of finite type. If $\mathfrak m B$
is the maximal ideal of $B$ and the induced extension of
residue fields is separable, then $A \to B$ is the localization
of an \'etale ring map.
\end{lemma}

\begin{proof}
We may write $B = C_\mathfrak q$ where $A \to C$ is a finite
type ring map and $\mathfrak q \subset C$ is a prime ideal
lying over $\mathfrak m$. By
Algebra, Lemma \ref{algebra-lemma-characterize-unramified}
the ring map $A \to C$ is unramified at $\mathfrak q$.
By Algebra, Proposition \ref{algebra-proposition-unramified-locally-standard}
after replacing $C$ by a principal localization,
we can find a standard \'etale ring map $A \to C'$
and a surjection $C' \to C$. Denote $\mathfrak q' \subset C'$
the inverse image of $\mathfrak q$ and set $B' = C'_{\mathfrak q'}$.
Then $B' \to B$ is surjective.
It suffices to show that $B' \to B$ is also injective.

\medskip\noindent
Since $A$ is a domain, the rings $C'$ and $B'$ are reduced, see
Algebra, Lemma \ref{lemma-reduced-goes-up}.
Since $A$ is geometrically unibranch, the ring $B'$ is a domain, see
by Lemmas \ref{lemma-invariance-number-branches-smooth} and
\ref{lemma-number-of-branches-1}.
If $B' \to B$ is not injective, then
$A \cap \Ker(B' \to B)$ is nonzero by Lemma \ref{lemma-ideal-inverse-nonzero}
which contradicts the assumption that $A \to B$ is injective.
\end{proof}

\begin{lemma}
\label{lemma-minimal-primes-tensor-strictly-henselian}
Let $k$ be an algebraically closed field. Let $A$, $B$ be strictly
henselian local $k$-algebras with residue field equal to $k$.
Let $C$ be the strict henselization of $A \otimes_k B$ at the maximal
ideal $\mathfrak m_A \otimes_k B + A \otimes_k \mathfrak m_B$.
Then the minimal primes of $C$ correspond $1$-to-$1$ to pairs of
minimal primes of $A$ and $B$.
\end{lemma}

\begin{proof}
First note that a minimal prime $\mathfrak r$ of $C$ maps to a minimal
prime $\mathfrak p$ in $A$ and to a minimal prime $\mathfrak q$ of $B$
because the ring maps $A \to C$ and $B \to C$ are flat (by going down for
flat ring map Algebra, Lemma \ref{algebra-lemma-flat-going-down}).
Hence it suffices to show that the strict henselization of
$(A/\mathfrak p \otimes_k B/\mathfrak q)_{
\mathfrak m_A \otimes_k B + A \otimes_k \mathfrak m_B}$
has a unique minimal prime ideal. By
Algebra, Lemma \ref{algebra-lemma-quotient-strict-henselization}
the rings $A/\mathfrak p$, $B/\mathfrak q$ are strictly henselian.
Hence we may assume that $A$ and $B$ are strictly henselian
local domains and our goal is to show that $C$ has a unique minimal prime.
By Lemma \ref{lemma-geometrically-unibranch} the
integral closure $A'$ of $A$ in its fraction field
is a normal local domain with residue field $k$. Similarly for the
integral closure $B'$ of $B$ into its fraction field. By
Algebra, Lemma \ref{algebra-lemma-geometrically-normal-tensor-normal}
we see that $A' \otimes_k B'$ is a normal ring. Hence its localization
$$
R = (A' \otimes_k B')_{
\mathfrak m_{A'} \otimes_k B' + A' \otimes_k \mathfrak m_{B'}}
$$
is a normal local domain. Note that $A \otimes_k B \to A' \otimes_k B'$
is integral (hence gong up holds --
Algebra, Lemma \ref{algebra-lemma-integral-going-up})
and that $\mathfrak m_{A'} \otimes_k B' + A' \otimes_k \mathfrak m_{B'}$
is the unique maximal ideal of $A' \otimes_k B'$
lying over $\mathfrak m_A \otimes_k B + A \otimes_k \mathfrak m_B$.
Hence we see that
$$
R = (A' \otimes_k B')_{
\mathfrak m_A \otimes_k B + A \otimes_k \mathfrak m_B}
$$
by
Algebra, Lemma \ref{algebra-lemma-unique-prime-over-localize-below}.
It follows that
$$
(A \otimes_k B)_{
\mathfrak m_A \otimes_k B + A \otimes_k \mathfrak m_B}
\longrightarrow
R
$$
is integral. We conclude that $R$ is the integral closure of
$(A \otimes_k B)_{
\mathfrak m_A \otimes_k B + A \otimes_k \mathfrak m_B}$
in its fraction field, and by
Lemma \ref{lemma-geometrically-unibranch}
once again we conclude that $C$ has a unique prime ideal.
\end{proof}






\section{Branches of the completion}
\label{section-branches-completion}

\noindent
Let $(A, \mathfrak m)$ be a Noetherian local ring. Consider the maps
$A \to A^h \to A^\wedge$. In general the map $A^h \to A^\wedge$
need not induce a bijection on minimal primes, see
Examples, Section \ref{examples-section-bad}. In other words, the
number of branches of $A$ (as defined in
Definition \ref{definition-number-of-branches})
may be different from the number of
branches of $A^\wedge$. However, under some conditions the number of
branches is the same, for example if the dimension of $A$ is $1$.

\begin{lemma}
\label{lemma-nr-branches-completion}
Let $(A, \mathfrak m)$ be a Noetherian local ring.
\begin{enumerate}
\item The map $A^h \to A^\wedge$ defines a surjective map from minimal
primes of $A^\wedge$ to minimal primes of $A^h$.
\item The number of branches of $A$ is at most the number of branches
of $A^\wedge$.
\item The number of geometric branches of $A$ is at most the number
of geometric branches of $A^\wedge$.
\end{enumerate}
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-henselization-noetherian} the map $A^h \to A^\wedge$
is flat and injective. Combining going down
(Algebra, Lemma \ref{algebra-lemma-flat-going-down}) and
Algebra, Lemma \ref{algebra-lemma-injective-minimal-primes-in-image}
we see that part (1) holds. Part (2) follows from this,
Definition \ref{definition-number-of-branches}, and
the fact that $A^\wedge$ is henselian
(Algebra, Lemma \ref{algebra-lemma-complete-henselian}).
By Lemma \ref{lemma-henselization-noetherian}
we have $(A^\wedge)^{sh} = A^{sh} \otimes_{A^h} A^\wedge$.
Thus we can repeat the arguments above using the flat injective
map $A^{sh} \to (A^\wedge)^{sh}$ to prove (3).
\end{proof}

\begin{lemma}
\label{lemma-equal-nr-branches-completion}
Let $(A, \mathfrak m)$ be a Noetherian local ring. The number of
branches of $A$ is the same as the number of branches of $A^\wedge$
if and only if $\sqrt{\mathfrak qA^\wedge}$ is prime for every
minimal prime $\mathfrak q \subset A^h$ of the henselization.
\end{lemma}

\begin{proof}
Follows from Lemma \ref{lemma-nr-branches-completion}
and the fact that there are only a finite number of branches
for both $A$ and $A^\wedge$ by
Algebra, Lemma \ref{algebra-lemma-Noetherian-irreducible-components}
and the fact that $A^h$ and $A^\wedge$ are Noetherian
(Lemma \ref{lemma-henselization-noetherian}).
\end{proof}

\noindent
A simple glueing lemma.

\begin{lemma}
\label{lemma-glueing-sum-components-open}
Let $A$ be a ring and let $I$ be a finitely generated ideal.
Let $A \to C$ be a ring map such that for all $f \in I$
the ring map $A_f \to C_f$ is localization at an idempotent.
Then there exists a surjection $A \to C'$ such that
$A_f \to (C \times C')_f$ is an isomorphism for all $f \in I$.
\end{lemma}

\begin{proof}
Choose generators $f_1, \ldots, f_r$ of $I$. Write
$$
C_{f_i} = (A_{f_i})_{e_i}
$$
for some idempotent $e_i \in A_{f_i}$. Write $e_i = a_i/f_i^n$
for some $a_i \in A$ and $n \geq 0$; we may use the same $n$
for all $i = 1, \ldots, r$. After replacing $a_i$ by $f_i^ma_i$
and $n$ by $n + m$ for a suitable $m \gg 0$, we may assume
$a_i^2 = f_i^n a_i$ for all $i$. Since $e_i$ maps to $1$ in
$C_{f_if_j} = (A_{f_if_j})_{e_j} = A_{f_if_ja_j}$ we see that
$$
(f_if_ja_j)^N(f_j^n a_i  - f_i^na_j) = 0
$$
for some $N$ (we can pick the same $N$ for all pairs $i, j$). Using
$a_j^2 = f_j^na_j$ this gives
$$
f_i^{N + n} f_j^{N + nN} a_j = f_i^N f_j^{N + n} a_ia_j^N
$$
After increasing $n$ to $n + N + nN$ and replacing $a_i$ by $f_i^{N + nN}a_i$
we see that $f_i^n a_j$ is in the ideal of $a_i$ for all pairs $i, j$.
Let $C' = A/(a_1, \ldots, a_r)$. Then
$$
C'_{f_i} = A_{f_i}/(a_i) = A_{f_i}/(e_i)
$$
because $a_j$ is in the ideal generated by $a_i$ after inverting $f_i$.
Since for an idempotent $e$ of a ring $B$ we have $B = B_e \times B/(e)$
we see that the conclusion of the lemma holds for $f$ equal to one
of $f_1, \ldots, f_r$. Using glueing of functions, in the form of
Algebra, Lemma \ref{algebra-lemma-cover},
we conclude that the result holds for all $f \in I$.
Namely, for $f \in I$ the elements $f_1, \ldots, f_r$
generate the unit ideal in $A_f$ so $A_f \to (C \times C')_f$
is an isomorphism if and only if this is the case after localizing
at $f_1, \ldots, f_r$.
\end{proof}

\noindent
Lemma \ref{lemma-quotient-by-idempotent} can be used to construct
finite type extensions from given finite type extensions of the
formal completion. We will
generalize this lemma in Algebraization of Formal Spaces, Lemma
\ref{restricted-lemma-approximate-by-etale-over-complement}.

\begin{lemma}
\label{lemma-quotient-by-idempotent}
Let $A$ be a Noetherian ring and $I$ an ideal. Let $B$
be a finite type $A$-algebra. Let $B^\wedge \to C$ be a surjective
ring map with kernel $J$ where $B^\wedge$ is the $I$-adic completion.
If $J/J^2$ is annihilated by $I^c$ for some $c \geq 0$, then $C$ is
isomorphic to the completion of a finite type $A$-algebra.
\end{lemma}

\begin{proof}
Let $f \in I$. Since $B^\wedge$ is Noetherian (Algebra, Lemma
\ref{algebra-lemma-completion-Noetherian-Noetherian}),
we see that $J$ is a finitely generated ideal.
Hence we conclude from
Algebra, Lemma \ref{algebra-lemma-ideal-is-squared-union-connected}
that
$$
C_f = ((B^\wedge)_f)_e
$$
for some idempotent $e \in (B^\wedge)_f$. By
Lemma \ref{lemma-glueing-sum-components-open}
we can find a surjection $B^\wedge \to C'$
such that $B^\wedge \to C \times C'$ becomes an
isomorphism after inverting any $f \in I$.
Observe that $C \times C'$ is a finite $B^\wedge$-algebra.

\medskip\noindent
Choose generators $f_1, \ldots, f_r \in I$. Denote
$\alpha_i : (C \times C')_{f_i} \to B_{f_i} \otimes_B B^\wedge$
the inverse of the isomorphism of $(B^\wedge)_{f_i}$-algebras
we obtained above. Denote $\alpha_{ij} : (B_{f_i})_{f_j} \to (B_{f_j})_{f_i}$
the obvious $B$-algebra isomorphism.
Consider the object
$$
(C \times C', B_{f_i}, \alpha_i, \alpha_{ij})
$$
of the category $\text{Glue}(B \to B^\wedge, f_1, \ldots, f_r)$ introduced
in Remark \ref{remark-glueing-data}. We omit the verification of
conditions (1)(a) and (1)(b).
Since $B \to B^\wedge$ is a flat map
(Algebra, Lemma \ref{algebra-lemma-completion-flat}) inducing an isomorphism
$B/IB \to B^\wedge/IB^\wedge$ we may apply
Proposition \ref{proposition-equivalence}
and Remark \ref{remark-formal-glueing-algebras}.
We conclude that $C \times C'$ is isomorphic to $D \otimes_B B^\wedge$
for some finite $B$-algebra $D$.
Then $D/ID \cong C/IC \times C'/IC'$. Let $\overline{e} \in D/ID$
be the idempotent corresponding to the factor $C/IC$.
By Lemma \ref{lemma-lift-idempotent-upstairs} there exists an
\'etale ring map $B \to B'$ which induces an isomorphism
$B/IB \to B'/IB'$ such that $D' = D \otimes_B B'$ contains an
idempotent $e$ lifting $\overline{e}$. Since $C \times C'$
is $I$-adically complete the pair $(C \times C', IC \times IC')$
is henselian (Lemma \ref{lemma-complete-henselian}).
Thus we can factor the map $B \to C \times C'$ through $B'$.
Doing so we may replace $B$ by $B'$ and $D$ by $D'$. Then
we find that $D = D_e \times D_{1 - e} = D/(1 - e) \times D/(e)$
is a product of finite type $A$-algebras and the completion of the
first part is $C$ and the completion of the second part is $C'$.
\end{proof}

\begin{lemma}
\label{lemma-one-dimensional-formal-branch}
Let $(A, \mathfrak m)$ be a Noetherian local ring with henselization $A^h$.
Let $\mathfrak q \subset A^\wedge$ be a minimal prime with
$\dim(A^\wedge/\mathfrak q) = 1$. Then there exists a minimal
prime $\mathfrak q^h$ of $A^h$ such that
$\mathfrak q = \sqrt{\mathfrak q^hA^\wedge}$.
\end{lemma}

\begin{proof}
Since the completion of $A$ and $A^h$ are the same, we may assume
that $A$ is henselian (Lemma \ref{lemma-henselization-noetherian}).
We will apply Lemma \ref{lemma-quotient-by-idempotent}
to $A^\wedge \to A^\wedge/J$ where
$J = \Ker(A^\wedge \to (A^\wedge)_{\mathfrak q})$.
Since $\dim((A^\wedge)_\mathfrak q) = 0$ we see that
$\mathfrak q^n \subset J$ for some $n$. Hence $J/J^2$ is
annihilated by $\mathfrak q^n$. On the other hand $(J/J^2)_\mathfrak q = 0$
because $J_\mathfrak q = 0$. Hence $\mathfrak m$ is the only
associated prime of $J/J^2$ and we find that a power
of $\mathfrak m$ annihilates $J/J^2$. Thus the lemma applies
and we find that $A^\wedge/J = C^\wedge$ for some finite type
$A$-algebra $C$.

\medskip\noindent
Then $C/\mathfrak m C = A/\mathfrak m$ because $A^\wedge/J$ has the same
property. Hence $\mathfrak m_C = \mathfrak m C$ is a maximal ideal
and $A \to C$ is unramified at $\mathfrak m_C$
(Algebra, Lemma \ref{algebra-lemma-characterize-unramified}).
After replacing $C$ by a principal localization we may
assume that $C$ is a quotient of an \'etale $A$-algebra $B$, see
Algebra, Proposition \ref{algebra-proposition-unramified-locally-standard}.
However, since the residue field extension of $A \to C_{\mathfrak m_C}$
is trivial and $A$ is henselian, we conclude that $B = A$
again after a localization.
Thus $C = A/I$ for some ideal $I \subset A$ and it follows that
$J = IA^\wedge$ (because completion is exact in our situation by
Algebra, Lemma \ref{algebra-lemma-completion-flat}) and $I = J \cap A$
(by flatness of $A \to A^\wedge$). Since
$\mathfrak q^n \subset J \subset \mathfrak q$ we see that
$\mathfrak p = \mathfrak q \cap A$ satisfies
$\mathfrak p^n \subset I \subset \mathfrak p$.
Then $\sqrt{\mathfrak p A^\wedge} = \mathfrak q$ and the proof is complete.
\end{proof}

\begin{lemma}
\label{lemma-completion-disconnected}
Let $(A, \mathfrak m)$ be a Noetherian local ring. The punctured spectrum
of $A^\wedge$ is disconnected if and only if the punctured spectrum of $A^h$
is disconnected.
\end{lemma}

\begin{proof}
Since the completion of $A$ and $A^h$ are the same, we may assume
that $A$ is henselian (Lemma \ref{lemma-henselization-noetherian}).

\medskip\noindent
Since $A \to A^\wedge$ is faithfully flat (see reference just given)
the map from the punctured spectrum of $A^\wedge$ to the punctured
spectrum of $A$ is surjective
(see Algebra, Lemma \ref{algebra-lemma-ff-rings}).
Hence if the punctured spectrum of $A$ is disconnected, then
the same is true for $A^\wedge$.

\medskip\noindent
Assume the punctured spectrum of $A^\wedge$ is disconnected.
This means that
$$
\Spec(A^\wedge) \setminus \{\mathfrak m^\wedge\} = Z \amalg Z'
$$
with $Z$ and $Z'$ closed. Let
$\overline{Z}, \overline{Z}' \subset \Spec(A^\wedge)$ be the closures.
Say $\overline{Z} = V(J)$, $\overline{Z}' = V(J')$ for some ideals
$J, J' \subset A^\wedge$. Then $V(J + J') = \{\mathfrak m^\wedge\}$
and $V(JJ') = \Spec(A^\wedge)$. The first equality means that
$\mathfrak m^\wedge = \sqrt{J + J'}$ which implies
$(\mathfrak m^\wedge)^e \subset J + J'$ for some $e \geq 1$.
The second equality implies every element
of $JJ'$ is nilpotent hence $(JJ')^n = 0$ for some $n \geq 1$.
Combined this means that $J^n/J^{2n}$ is annihilated by
$J^n$ and $(J')^n$ and hence by $(\mathfrak m^\wedge)^{2en}$.
Thus we may apply Lemma \ref{lemma-quotient-by-idempotent}
to see that there is a finite type $A$-algebra $C$ and an
isomorphism $A^\wedge/J^n = C^\wedge$.

\medskip\noindent
The rest of the proof is exactly the same as the second part
of the proof of Lemma \ref{lemma-one-dimensional-formal-branch};
of course that lemma is a special case of this one!
We have $C/\mathfrak m C = A/\mathfrak m$ because $A^\wedge/J^n$ has the same
property. Hence $\mathfrak m_C = \mathfrak m C$ is a maximal ideal
and $A \to C$ is unramified at $\mathfrak m_C$
(Algebra, Lemma \ref{algebra-lemma-characterize-unramified}).
After replacing $C$ by a principal localization we may
assume that $C$ is a quotient of an \'etale $A$-algebra $B$, see
Algebra, Proposition \ref{algebra-proposition-unramified-locally-standard}.
However, since the residue field extension of $A \to C_{\mathfrak m_C}$
is trivial and $A$ is henselian, we conclude that $B = A$
again after a localization.
Thus $C = A/I$ for some ideal $I \subset A$ and it follows that
$J^n = IA^\wedge$ (because completion is exact in our situation by
Algebra, Lemma \ref{algebra-lemma-completion-flat}) and $I = J^n \cap A$
(by flatness of $A \to A^\wedge$).
By symmetry $I' = (J')^n \cap A$ satisfies $(J')^n = I'A^\wedge$.
Then $\mathfrak m^e \subset I + I'$ and $II' = 0$
and we conclude that $V(I)$ and $V(I')$ are closed subschemes
which give the desired disjoint union decomposition of the
punctured spectrum of $A$.
\end{proof}

\begin{lemma}
\label{lemma-one-dimensional-number-of-branches}
Let $(A, \mathfrak m)$ be a Noetherian local ring of dimension $1$.
Then the number of (geometric) branches of $A$ and $A^\wedge$ is the same.
\end{lemma}

\begin{proof}
To see this for the number of branches, combine
Lemmas \ref{lemma-nr-branches-completion},
\ref{lemma-equal-nr-branches-completion}, and
\ref{lemma-one-dimensional-formal-branch}
and use that the dimension of $A^\wedge$ is one, see
Lemma \ref{lemma-completion-dimension}.
To see this is true for the number of geometric branches
we use the result for branches, the fact that the dimension
does not change under strict henselization
(Lemma \ref{lemma-henselization-dimension}), and the fact that
$(A^{sh})^\wedge = ((A^\wedge)^{sh})^\wedge$
by Lemma \ref{lemma-henselization-noetherian}.
\end{proof}

\begin{lemma}
\label{lemma-geometrically-normal-formal-fibres-number-of-branches}
\begin{reference}
\cite[Theorem 2.3]{Beddani}
\end{reference}
Let $(A, \mathfrak m)$ be a Noetherian local ring. If the formal
fibres of $A$ are geometrically normal (for example if $A$ is
excellent or quasi-excellent), then $A$ is Nagata
and the number of (geometric) branches of $A$ and $A^\wedge$ is the same.
\end{lemma}

\begin{proof}
Since a normal ring is reduced, we see that $A$ is Nagata by
Lemma \ref{lemma-Nagata-local-ring}. In the rest of the proof
we will use Lemma \ref{lemma-formal-fibres-normal},
Proposition \ref{proposition-finite-type-over-P-ring}, and
Lemma \ref{lemma-check-P-ring-maximal-ideals}. This tells us
that $A$ is a P-ring where $P(k \to R) = $``$R$ is geometrically
normal over $k$'' and the same is true for any (essentially of) finite type
$A$-algebra.

\medskip\noindent
Let $\mathfrak q \subset A$ be a minimal prime. Then
$A^\wedge/\mathfrak q A^\wedge = (A/\mathfrak q)^\wedge$
and $A^h/\mathfrak qA^h = (A/\mathfrak q)^h$
(Algebra, Lemma \ref{algebra-lemma-quotient-henselization}).
Hence the number of branches of $A$ is the sum of the
number of branches of the rings $A/\mathfrak q$ and
similarly for $A^\wedge$. In this way we reduce
to the case that $A$ is a domain.

\medskip\noindent
Assume $A$ is a domain. Let $A'$ be the integral closure of $A$
in the fraction field $K$ of $A$. Since $A$ is Nagata, we see that
$A \to A'$ is finite. Recall that the number of branches of
$A$ is the number of maximal ideals $\mathfrak m'$ of $A'$
(Lemma \ref{lemma-branches}). Also, recall that
$$
(A')^\wedge = A' \otimes_A A^\wedge =
\prod\nolimits_{\mathfrak m' \subset A'} (A'_{\mathfrak m'})^\wedge
$$
by Algebra, Lemma \ref{algebra-lemma-completion-finite-extension}.
Because $A'_{\mathfrak m'}$ is a local ring whose formal
fibres are geometrically normal, we see that
$(A'_{\mathfrak m'})^\wedge$ is normal
(Lemma \ref{lemma-completion-normal-local-ring}).
Hence the minimal primes of $A' \otimes_A A^\wedge$
are in $1$-to-$1$ correspondence with the factors in the
decomposition above. By flatness of $A \to A^\wedge$ we have
$$
A^\wedge \subset A' \otimes_A A^\wedge \subset K \otimes_A A^\wedge
$$
Since the left and the right ring have the same set of minimal
primes, the same is true for the ring in the middle (small
detail omitted) and this finishes the proof.

\medskip\noindent
To see this is true for the number of geometric branches
we use the result for branches, the fact that the formal
fibres of $A^{sh}$ are geometrically normal
(Lemmas \ref{lemma-formal-fibres-normal} and
\ref{lemma-henselization-P-ring})
and the fact that $(A^{sh})^\wedge = ((A^\wedge)^{sh})^\wedge$
by Lemma \ref{lemma-henselization-noetherian}.
\end{proof}






\section{Formally catenary rings}
\label{section-formally-catenary}

\noindent
In this section we prove a theorem of Ratliff
\cite{Ratliff} that a Noetherian local
ring is universally catenary if and only if it is formally catenary.

\begin{definition}
\label{definition-formally-catenary}
A Noetherian local ring $A$ is {\it formally catenary}
if for every minimal prime $\mathfrak p \subset A$ the spectrum of
$A^\wedge/\mathfrak p A^\wedge$ is equidimensional.
\end{definition}

\noindent
Let $A$ be a Noetherian local ring which is formally catenary.
By Ratliff's result (Proposition \ref{proposition-ratliff})
we see that any quotient of $A$ is also formally catenary
(because the class of universally catenary rings is stable under quotients).
We conclude that the spectrum of $A^\wedge/\mathfrak p A^\wedge$
is equidimensional for every prime ideal $\mathfrak p$ of $A$.

\begin{lemma}
\label{lemma-not-formally-catenary}
Let $(A, \mathfrak m)$ be a Noetherian local ring which is not
formally catenary. Then $A$ is not universally catenary.
\end{lemma}

\begin{proof}
By assumption there exists a minimal prime $\mathfrak p \subset A$ such that
the spectrum of $A^\wedge /\mathfrak p A^\wedge$ is not equidimensional.
After replacing $A$ by $A/\mathfrak p$ we may assume that $A$
is a domain and that the spectrum of $A^\wedge$ is not equidimensional.
Let $\mathfrak q$ be a minimal prime of
$A^\wedge$ such that $d = \dim(A^\wedge/\mathfrak q)$
is minimal and hence $0 < d < \dim(A)$. We prove the lemma by induction
on $d$.

\medskip\noindent
The case $d = 1$. In this case $\dim(A^\wedge_\mathfrak q) = 0$.
Hence $A^\wedge_\mathfrak q$ is Artinian local and we see that
for some $n > 0$ the ideal $J = \mathfrak q^n$ maps to zero in
$A^\wedge_\mathfrak q$. It follows that $\mathfrak m$ is the
only associated prime of $J/J^2$, whence $\mathfrak m^m$ annihilates
$J/J^2$ for some $m > 0$. Thus we can use
Lemma \ref{lemma-quotient-by-idempotent}
to find $A \to B$ of finite type such that $B^\wedge \cong A^\wedge/J$.
It follows that $\mathfrak m_B = \sqrt{\mathfrak mB}$ is a maximal
ideal with the same residue field as $\mathfrak m$ and $B^\wedge$
is the $\mathfrak m_B$-adic completion
(Algebra, Lemma \ref{algebra-lemma-finite-after-completion}).
Then
$$
\dim(B_{\mathfrak m_B}) = \dim(B^\wedge) = 1 = d.
$$
Since we have the factorization $A \to B \to A^\wedge/J$ the inverse image
of $\mathfrak q/J$ is a prime $\mathfrak q' \subset \mathfrak m_B$ lying
over $(0)$ in $A$. Thus, if $A$ were universally catenary, the dimension
formula (Algebra, Lemma \ref{algebra-lemma-dimension-formula}) would give
\begin{align*}
\dim(B_{\mathfrak m_B})
& \geq
\dim((B/\mathfrak q')_{\mathfrak m_B}) \\
& =
\dim(A) + \text{trdeg}_A(B/\mathfrak q') -
\text{trdeg}_{\kappa(\mathfrak m)}(\kappa(\mathfrak m_B)) \\
& =
\dim(A) + \text{trdeg}_A(B/\mathfrak q')
\end{align*}
This contradiction finishes the argument in case $d = 1$.

\medskip\noindent
Assume $d > 1$. Let $Z \subset \Spec(A^\wedge)$ be the union of
the irreducible components distinct from $V(\mathfrak q)$.
Let $\mathfrak r_1, \ldots, \mathfrak r_m \subset A^\wedge$
be the prime ideals corresponding to irreducible components of
$V(\mathfrak q) \cap Z$ of dimension $> 0$.
Choose $f \in \mathfrak m$, $f \not \in A \cap \mathfrak r_j$
using prime avoidance (Algebra, Lemma \ref{algebra-lemma-silly}).
Then $\dim(A/fA) = \dim(A) - 1$ and there is some irreducible
component of $V(\mathfrak q, f)$ of dimension $d - 1$.
Thus $A/fA$ is not formally catenary and the invariant $d$ has
decreased. By induction $A/fA$ is not universally catenary, hence
$A$ is not universally catenary.
\end{proof}

\begin{lemma}
\label{lemma-flat-under-catenary-equidimensional}
Let $A \to B$ be a flat local ring map of local Noetherian rings.
Assume $B$ is catenary and is $\Spec(B)$ equidimensional. Then
\begin{enumerate}
\item $\Spec(B/\mathfrak p B)$ is equidimensional for all
$\mathfrak p \subset A$ and
\item $A$ is catenary and $\Spec(A)$ is equidimensional.
\end{enumerate}
\end{lemma}

\begin{proof}
Let $\mathfrak p \subset A$ be a prime ideal. Let $\mathfrak q \subset B$
be a prime minimal over $\mathfrak pB$. Then $\mathfrak q \cap A = \mathfrak p$
by going down for $A \to B$
(Algebra, Lemma \ref{algebra-lemma-flat-going-down}).
Hence $A_\mathfrak p \to B_\mathfrak q$ is a flat local ring map
with special fibre of dimension $0$ and hence
$$
\dim(A_\mathfrak p) = \dim(B_\mathfrak q) = \dim(B) - \dim(B/\mathfrak q)
$$
(Algebra, Lemma \ref{algebra-lemma-dimension-base-fibre-equals-total}).
The second equality because $\Spec(B)$ is equidimensional and $B$ is catenary.
Thus $\dim(B/\mathfrak q)$ is independent of the choice of $\mathfrak q$
and we conclude that $\Spec(B/\mathfrak p B)$ is equidimensional of
dimension $\dim(B) - \dim(A_\mathfrak p)$. On the other hand, we
have
$\dim(B/\mathfrak p B) = \dim(A/\mathfrak p) + \dim(B/\mathfrak m_A B)$
and
$\dim(B) = \dim(A) + \dim(B/\mathfrak m_A B)$
by flatness (see lemma cited above) and we get
$$
\dim(A_\mathfrak p) = \dim(A) - \dim(A/\mathfrak p)
$$
for all $\mathfrak p$ in $A$. Applying this to all minimal primes in
$A$ we see that $A$ is equidimensional.
If $\mathfrak p \subset \mathfrak p'$ is a strict inclusion
with no primes in between, then we may apply the above to
the prime $\mathfrak p'/\mathfrak p$ in $A/\mathfrak p$
because $A/\mathfrak p \to B/\mathfrak p B$ is flat and
$\Spec(B/\mathfrak p B)$ is equidimensional, to get
$$
1 = \dim((A/\mathfrak p)_{\mathfrak p'}) =
\dim(A/\mathfrak p) - \dim(A/\mathfrak p')
$$
Thus $\mathfrak p \mapsto \dim(A/\mathfrak p)$ is a dimension
function and we conclude that $A$ is catenary.
\end{proof}

\begin{lemma}
\label{lemma-formally-catenary}
Let $A$ be a formally catenary Noetherian local ring.
Then $A$ is universally catenary.
\end{lemma}

\begin{proof}
We may replace $A$ by $A/\mathfrak p$ where $\mathfrak p$ is a minimal prime
of $A$, see Algebra, Lemma \ref{algebra-lemma-catenary-check-irreducible}.
Thus we may assume that the spectrum of $A^\wedge$ is equidimensional.
It suffices to show that every local ring essentially of finite type
over $A$ is catenary (see for example
Algebra, Lemma \ref{algebra-lemma-catenary-check-local}).
Hence it suffices to show that $A[x_1, \ldots, x_n]_\mathfrak m$ is catenary
where $\mathfrak m \subset A[x_1, \ldots, x_n]$ is a maximal
ideal lying over $\mathfrak m_A$, see
Algebra, Lemma \ref{algebra-lemma-localization-at-closed-point-special-fibre}
(and Algebra, Lemmas \ref{algebra-lemma-quotient-catenary} and
\ref{algebra-lemma-localization-catenary}).
Let $\mathfrak m' \subset A^\wedge[x_1, \ldots, x_n]$ be the unique
maximal ideal lying over $\mathfrak m$. Then
$$
A[x_1, \ldots, x_n]_\mathfrak m \to A^\wedge[x_1, \ldots, x_n]_{\mathfrak m'}
$$
is local and flat (Algebra, Lemma \ref{algebra-lemma-completion-flat}).
Hence it suffices to show that the ring on the right
hand side catenary with equidimensional spectrum, see
Lemma \ref{lemma-flat-under-catenary-equidimensional}.
It is catenary because complete local rings are universally catenary
(Algebra, Remark
\ref{algebra-remark-Noetherian-complete-local-ring-universally-catenary}).
Pick any minimal prime $\mathfrak q$ of
$A^\wedge[x_1, \ldots, x_n]_{\mathfrak m'}$. Then
$\mathfrak q = \mathfrak p A^\wedge[x_1, \ldots, x_n]_{\mathfrak m'}$
for some minimal prime $\mathfrak p$ of $A^\wedge$ (small detail omitted).
Hence
$$
\dim(A^\wedge[x_1, \ldots, x_n]_{\mathfrak m'}/\mathfrak q) =
\dim(A^\wedge/\mathfrak p) + n = \dim(A^\wedge) + n
$$
the first equality by
Algebra, Lemma \ref{algebra-lemma-dimension-base-fibre-equals-total}
and the second because the spectrum of $A^\wedge$ is equidimensional.
This finishes the proof.
\end{proof}

\begin{proposition}[Ratliff]
\label{proposition-ratliff}
\begin{reference}
\cite{Ratliff}
\end{reference}
A Noetherian local ring is universally catenary if and only if
it is formally catenary.
\end{proposition}

\begin{proof}
Combine Lemmas \ref{lemma-not-formally-catenary} and
\ref{lemma-formally-catenary}.
\end{proof}

\begin{lemma}
\label{lemma-geometrically-normal-fibres-universally-catenary}
\begin{reference}
\cite[Corollary 2.3]{Heinzer-Rotthaus-Wiegand}
\end{reference}
Let $(A, \mathfrak m)$ be a Noetherian local ring with
geometrically normal formal fibres. Then
\begin{enumerate}
\item $A^h$ is universally catenary, and
\item if $A$ is unibranch (for example normal), then
$A$ is universally catenary.
\end{enumerate}
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-geometrically-normal-formal-fibres-number-of-branches}
the number of branches of $A$ and $A^\wedge$ are the same,
hence Lemma \ref{lemma-equal-nr-branches-completion} applies.
Then for any minimal prime $\mathfrak q \subset A^h$
we see that $A^\wedge/\mathfrak q A^\wedge$
has a unique minimal prime. Thus $A^h$ is formally catenary
(by definition) and hence universally catenary by
Proposition \ref{proposition-ratliff}. If $A$ is unibranch,
then $A^h$ has a unique minimal prime, hence $A^\wedge$ has
a unique minimal prime, hence $A$ is formally catenary and
we conclude in the same way.
\end{proof}






\section{Group actions and integral closure}
\label{section-group-actions-integral}

\noindent
This section is in some sense a continuation of
Algebra, Section \ref{algebra-section-going-down-integral-over-normal}.
More material of a similar kind can be found in
Fundamental Groups, Section \ref{pione-section-group-actions-integral}

\begin{lemma}
\label{lemma-pol-lifting}
Let $\varphi : A \to B$ be a surjection of rings. Let $G$ be a finite group
of order $n$ acting on $\varphi : A \to B$. If $b \in B^G$, then
there exists a monic polynomial $P \in A^G[T]$ which maps to
$(T - b)^n$ in $B^G[T]$.
\end{lemma}

\begin{proof}
Choose $a \in A$ lifting $b$ and set
$P = \prod_{\sigma \in G} (T - \sigma(a))$.
\end{proof}

\begin{lemma}
\label{lemma-invariants-modulo}
Let $R$ be a ring. Let $G$ be a finite group acting on $R$. Let $I \subset R$
be an ideal such that $\sigma(I) \subset I$ for all $\sigma \in G$.
Then $R^G/I^G \subset (R/I)^G$ is an integral extension of rings which
induces a homeomorphism on spectra and purely inseparable extensions of
residue fields.
\end{lemma}

\begin{proof}
Since $I^G = R^G \cap I$ it is clear that the map is injective.
Lemma \ref{lemma-pol-lifting} shows that
Algebra, Lemma \ref{algebra-lemma-universally-bijective}
applies.
\end{proof}

\begin{lemma}
\label{lemma-pol-in-ideal}
Let $G$ be a finite group of order $n$ acting on a ring $R$.
Let $J \subset R^G$ be an ideal. For $x \in JR$
we have $\prod_{\sigma \in G} (T - \sigma(x)) =
T^n + a_1 T^{n - 1} + \ldots + a_n$ with $a_i \in J$.
\end{lemma}

\begin{proof}
Observe that the polynomial is indeed monic and has coefficients in $R^G$.
We can write $x = f_1 b_1 + \ldots + f_m b_m$ with $f_j \in J$ and $b_j \in R$.
Thus, arguing by induction on $m$, we may assume that $x = y - fb$ with
$f \in J$, $b \in R$, and $y \in JR$ such that the result holds for $y$.
Then we see that
$$
\prod\nolimits_{\sigma \in G} (T - \sigma(x)) =
\prod\nolimits_{\sigma \in G} (T - \sigma(y) + f\sigma(b)) =
\prod\nolimits_{\sigma \in G} (T - \sigma(y)) +
\sum_{i = 1, \ldots, n} f^i a_i
$$
where we have
$$
a_i =
\sum\nolimits_{S \subset G,\ |S| = i}
\prod\nolimits_{\sigma \in S} \sigma(b)
\prod\nolimits_{\sigma \not \in S} (T - \sigma(y))
$$
A computation we omit shows that $a_i \in R^G$ (hint: the given expression
is symmetric). Thus the polynomial
of the statement of the lemma
for $x$ is congruent modulo $J$ to the polynomial for $y$
and this proves the induction step.
\end{proof}

\begin{lemma}
\label{lemma-invariants-modulo-bis}
Let $R$ be a ring. Let $G$ be a finite group of order $n$ acting on $R$.
Let $J \subset R^G$ be an ideal. Then $R^G/J \to (R/JR)^G$ is ring map
such that
\begin{enumerate}
\item for $b \in (R/JR)^G$ there is a monic polynomial
$P \in R^G/J[T]$ whose image in $(R/JR)^G[T]$ is $(T - b)^n$,
\item for $a \in \Ker(R^G/J \to (R/JR)^G)$
we have $(T - a)^n = T^n$ in $R^G/J[T]$.
\end{enumerate}
In particular, $R^G/J \to (R/JR)^G$ is an integral ring map which
induces homeomorphisms on spectra and purely inseparable extensions of
residue fields.
\end{lemma}

\begin{proof}
Part (1) follow from Lemma \ref{lemma-pol-lifting} with $I = JR$.
If $a$ is as in part (2), then $a$ is the image of $x \in R^G \cap JR$.
Hence $(T - x)^n = \prod_{\sigma \in G} (T - \sigma(x))$
is congruent to $T^n$ modulo $J$ by Lemma \ref{lemma-pol-in-ideal}.
This proves part (2). To see the final statement we may apply
Algebra, Lemma \ref{algebra-lemma-universally-bijective}.
\end{proof}

\begin{remark}
\label{remark-when-iso}
In Lemma \ref{lemma-invariants-modulo-bis}
we see that the map $R^G/J \to (R/JR)^G$
is an isomorphism if $n$ is invertible in $R$.
\end{remark}

\begin{lemma}
\label{lemma-functor-invariants-tensor}
Let $R$ be a ring. Let $G$ be a finite group of order $n$ acting on $R$.
Let $A$ be an $R^G$-algebra.
\begin{enumerate}
\item for $b \in (A \otimes_{R^G} R)^G$ there exists a monic polynomial
$P \in A[T]$ whose image in $(A \otimes_{R^G} R)^G[T]$ is $(T - b)^n$,
\item for $a \in \Ker(A \to (A \otimes_{R^G} R)^G)$ we have
$(T - a)^n = T^n$ in $A[T]$.
\end{enumerate}
\end{lemma}

\begin{proof}
Choose a surjection $E \to A$ where $E$ is a polynomial algebra over $R^G$.
Then $(E \otimes_{R^G} R)^G = E$ because $E$ is free as an $R^G$-module.
Denote $J = \Ker(E \to A)$. Since tensor product is right exact we see
that $A \otimes_{R^G} R$ is the quotient of $E \otimes_{R^G} R$
by the ideal generated by $J$. In this way we see that our lemma
is a special case of Lemma \ref{lemma-invariants-modulo-bis}.
\end{proof}

\begin{lemma}
\label{lemma-base-change-invariants}
Let $R$ be a ring. Let $G$ be a finite group acting on $R$.
Let $R^G \to A$ be a ring map. The map
$$
A \to (A \otimes_{R^G} R)^G
$$
is an isomorphism if $R^G \to A$ is flat. In general the map
is integral, induces a homeomorphism on spectra, and
induces purely inseparable residue field extensions.
\end{lemma}

\begin{proof}
To see the first statement consider the
exact sequence $0 \to R^G \to R \to \bigoplus_{\sigma \in G} R$
where the second map sends $x$ to $(\sigma(x) - x)_{\sigma \in G}$.
Tensoring with $A$ the sequence remains exact if $R^G \to A$ is flat.
Thus $A$ is the $G$-invariants in $(A \otimes_{R^G} R)^G$.

\medskip\noindent
The second statement follows from Lemma \ref{lemma-functor-invariants-tensor}
and Algebra, Lemma \ref{algebra-lemma-universally-bijective}.
\end{proof}

\begin{lemma}
\label{lemma-one-orbit}
Let $G$ be a finite group acting on a ring $R$. For any two primes
$\mathfrak q, \mathfrak q' \subset R$ lying over the same prime in $R^G$
there exists a $\sigma \in G$ with $\sigma(\mathfrak q) = \mathfrak q'$.
\end{lemma}

\begin{proof}
The extension $R^G \subset R$ is integral because every $x \in R$
is a root of the monic polynomial $\prod_{\sigma \in G}(T - \sigma(x))$
in $R^G[T]$. Thus there are no inclusion relations among the primes
lying over a given prime $\mathfrak p$
(Algebra, Lemma \ref{algebra-lemma-integral-no-inclusion}).
If the lemma is wrong, then
we can choose $x \in \mathfrak q'$, $x \not \in \sigma(\mathfrak q)$
for all $\sigma \in G$. See Algebra, Lemma \ref{algebra-lemma-silly}.
Then $y = \prod_{\sigma \in G} \sigma(x)$ is in $R^G$ and
in $\mathfrak p = R^G \cap \mathfrak q'$. On the other hand,
$x \not \in \sigma(\mathfrak q)$ for all $\sigma$ means
$\sigma(x) \not \in \mathfrak q$ for all $\sigma$. Hence
$y \not \in \mathfrak q$ as $\mathfrak q$ is a prime ideal.
This is impossible as $y \in \mathfrak p \subset \mathfrak q$.
\end{proof}

\begin{lemma}
\label{lemma-one-orbit-geometric}
Let $G$ be a finite group acting on a ring $R$. Let $\mathfrak q \subset R$
be a prime lying over $\mathfrak p \subset R^G$. Then
$\kappa(\mathfrak q)/\kappa(\mathfrak p)$ is an algebraic normal
extension and the map
$$
D = \{\sigma \in G \mid \sigma(\mathfrak q) = \mathfrak q\}
\longrightarrow
\text{Aut}(\kappa(\mathfrak q)/\kappa(\mathfrak p))
$$
is surjective\footnote{Recall that we use the notation $\text{Gal}$
only in the case of Galois extensions.}.
\end{lemma}

\begin{proof}
With $A = (R^G)_\mathfrak p$ and $B = A \otimes_{R^G} R$ we see that $A = B^G$
as localization is flat, see Lemma \ref{lemma-base-change-invariants}.
Observe that $\mathfrak pA$ and $\mathfrak qB$ are prime ideals,
$D$ is the stabilizer of $\mathfrak qB$, and
$\kappa(\mathfrak p) = \kappa(\mathfrak pA)$ and
$\kappa(\mathfrak q) = \kappa(\mathfrak qB)$. Thus we may replace
$R$ by $B$ and assume that $\mathfrak p$ is a maximal ideal.
Since $R^G \subset R$ is an integral ring extension, we find
that the maximal ideals of $R$ are exactly the primes lying over
$\mathfrak p$ (follows from
Algebra, Lemmas \ref{algebra-lemma-integral-no-inclusion} and
\ref{algebra-lemma-integral-going-up}).
By Lemma \ref{lemma-one-orbit} there are finitely many of them
$\mathfrak q = \mathfrak q_1, \mathfrak q_2, \ldots, \mathfrak q_m$
and they form a single orbit for $G$.
By the Chinese remainder theorem
(Algebra, Lemma \ref{algebra-lemma-chinese-remainder}) the map
$R \to \prod_{j = 1, \ldots, m} R/\mathfrak q_j$ is surjective.

\medskip\noindent
First we prove that the extension is normal. Pick an element
$\alpha \in \kappa(\mathfrak q)$. We have to show that the
minimal polynomial $P$ of $\alpha$ over $\kappa(\mathfrak p)$
splits completely. By the above we can choose
$a \in \mathfrak q_2 \cap \ldots \cap \mathfrak q_m$
mapping to $\alpha$ in $\kappa(\mathfrak q)$.
Consider the polynomial $Q = \prod_{\sigma \in G} (T - \sigma(a))$
in $R^G[T]$. The image of $Q$ in $R[T]$ splits completely
into linear factors, hence the same is true for its
image in $\kappa(\mathfrak q)[T]$. Since $P$ divides
the image of $Q$ in $\kappa(\mathfrak p)[T]$ we conclude
that $P$ splits completely into linear factors over
$\kappa(\mathfrak q)$ as desired.

\medskip\noindent
Since $\kappa(\mathfrak q)/\kappa(\mathfrak p)$ is normal we may assume
$\kappa(\mathfrak q) = \kappa_1 \otimes_{\kappa(\mathfrak p)} \kappa_2$
with $\kappa_1/\kappa(\mathfrak p)$ purely inseparable and
$\kappa_2/\kappa(\mathfrak p)$ Galois, see
Fields, Lemma \ref{fields-lemma-normal-case}. Pick
$\alpha \in \kappa_2$ which generates $\kappa_2$ over $\kappa(\mathfrak p)$
if it is finite and a subfield of degree $> |G|$ if it is infinite
(to get a contradiction).
This is possible by Fields, Lemma \ref{fields-lemma-primitive-element}.
Pick $a$, $P$, and $Q$ as in the previous paragraph.
If $\alpha' \in \kappa_2$ is a Galois conjugate of $\alpha$ over
$\kappa(\mathfrak p)$, then the fact that $P$ divides the
image of $P$ in $\kappa(\mathfrak p)[T]$ shows there exists a
$\sigma \in G$ such that $\sigma(a)$ maps to $\alpha'$. By our choice of
$a$ (vanishing at other maximal ideals) this implies $\sigma \in D$ and
that the image of $\sigma$ in
$\text{Aut}(\kappa(\mathfrak q)/\kappa(\mathfrak p))$
maps $\alpha$ to $\alpha'$. Hence the surjectivity or the
desired absurdity
in case $\alpha$ has degree $> |G|$ over $\kappa(\mathfrak p)$.
\end{proof}

\begin{lemma}
\label{lemma-one-orbit-geometric-galois}
Let $A$ be a normal domain with fraction field $K$.
Let $L/K$ be a (possibly infinite) Galois extension.
Let $G = \text{Gal}(L/K)$ and let
$B$ be the integral closure of $A$ in $L$.
\begin{enumerate}
\item For any two primes
$\mathfrak q, \mathfrak q' \subset B$ lying over the same prime in $A$
there exists a $\sigma \in G$ with $\sigma(\mathfrak q) = \mathfrak q'$.
\item Let $\mathfrak q \subset B$ be a prime lying over
$\mathfrak p \subset A$. Then $\kappa(\mathfrak q)/\kappa(\mathfrak p)$
is an algebraic normal extension and the map
$$
D = \{\sigma \in G \mid \sigma(\mathfrak q) = \mathfrak q\}
\longrightarrow
\text{Aut}(\kappa(\mathfrak q)/\kappa(\mathfrak p))
$$
is surjective.
\end{enumerate}
\end{lemma}

\begin{proof}
Proof of (1). Consider pairs $(M, \sigma)$ where $K \subset M \subset L$
is a subfield such that $M/K$ is Galois, $\sigma \in \text{Gal}(M/K)$
with $\sigma(\mathfrak q \cap M) = \mathfrak q' \cap M$.
We say $(M', \sigma') \geq (M, \sigma)$ if and only if
$M \subset M'$ and $\sigma'|_M = \sigma$.
Observe that $(K, \text{id}_K)$ is such a pair as $A = K \cap B$
since $A$ is a normal domain.
The collection of these pairs satisfies the hypotheses of Zorn's lemma,
hence there exists a maximal pair $(M, \sigma)$.
If $M \not = L$, then we can find
$M \subset M' \subset L$ with $M'/M$ nontrivial and finite and $M'/K$ Galois
(Fields, Lemma \ref{fields-lemma-normal-closure-inside-normal}).
Choose $\sigma' \in \text{Gal}(M'/K)$ whose restriction to $M$
is $\sigma$ (Fields, Lemma \ref{fields-lemma-galois-infinite}).
Then the primes $\sigma'(\mathfrak q \cap M')$ and $\mathfrak q' \cap M'$
restrict to the same prime of $B \cap M$. Since
$B \cap M = (B \cap M')^{\text{Gal}(M'/M)}$ we can
use Lemma \ref{lemma-one-orbit} to find $\tau \in \text{Gal}(M'/M)$
with $\tau(\sigma'(\mathfrak q \cap M')) = \mathfrak q' \cap M'$.
Hence $(M', \tau \circ \sigma') > (M, \sigma)$
contradicting the maximality of $(M, \sigma)$.

\medskip\noindent
Part (2) is proved in exactly the same manner as part (1). We
write out the details. Pick
$\overline{\sigma} \in \text{Aut}(\kappa(\mathfrak q)/\kappa(\mathfrak p))$.
Consider pairs $(M, \sigma)$ where $K \subset M \subset L$
is a subfield such that $M/K$ is Galois, $\sigma \in \text{Gal}(M/K)$
with $\sigma(\mathfrak q \cap M) = \mathfrak q \cap M$ and
$$
\xymatrix{
\kappa(\mathfrak q \cap M) \ar[r] \ar[d]_\sigma &
\kappa(\mathfrak q) \ar[d]_{\overline{\sigma}} \\
\kappa(\mathfrak q \cap M) \ar[r] & \kappa(\mathfrak q)
}
$$
commutes. We say $(M', \sigma') \geq (M, \sigma)$ if and only if
$M \subset M'$ and $\sigma'|_M = \sigma$.
As above $(K, \text{id}_K)$ is such a pair.
The collection of these pairs satisfies the hypotheses of Zorn's lemma,
hence there exists a maximal pair $(M, \sigma)$.
If $M \not = L$, then we can find
$M \subset M' \subset L$ with $M'/M$ finite and $M'/K$ Galois
(Fields, Lemma \ref{fields-lemma-normal-closure-inside-normal}).
Choose $\sigma' \in \text{Gal}(M'/K)$ whose restriction to $M$
is $\sigma$ (Fields, Lemma \ref{fields-lemma-galois-infinite}).
Then the primes $\sigma'(\mathfrak q \cap M')$ and $\mathfrak q \cap M'$
restrict to the same prime of $B \cap M$. Adjusting the choice
of $\sigma'$ as in the first paragraph, we may assume that
$\sigma'(\mathfrak q \cap M') = \mathfrak q \cap M'$.
Then $\sigma'$ and $\overline{\sigma}$ define maps
$\kappa(\mathfrak q \cap M') \to \kappa(\mathfrak q)$
which agree on $\kappa(\mathfrak q \cap M)$. Since
$B \cap M = (B \cap M')^{\text{Gal}(M'/M)}$ we can
use Lemma \ref{lemma-one-orbit-geometric}
to find $\tau \in \text{Gal}(M'/M)$ with
$\tau(\mathfrak q \cap M') = \mathfrak q \cap M'$
such that $\tau \circ \sigma$ and $\overline{\sigma}$
induce the same map on $\kappa(\mathfrak q \cap M')$.
There is a small detail here in that the lemma first
guarantees that $\kappa(\mathfrak q \cap M')/\kappa(\mathfrak q \cap M)$
is normal, which then tells us that the difference between
the maps is an automorphism of this extension
(Fields, Lemma \ref{fields-lemma-normal-embeddings-differ-by-aut}),
to which we can
apply the lemma to get $\tau$. Hence $(M', \tau \circ \sigma') > (M, \sigma)$
contradicting the maximality of $(M, \sigma)$.
\end{proof}

\begin{lemma}
\label{lemma-one-orbit-geometric-galois-compare}
Let $A$ be a normal domain with fraction field $K$.
Let $M/L/K$ be a tower of (possibly infinite) Galois extensions of $K$.
Let $H = \text{Gal}(M/K)$ and $G = \text{Gal}(L/K)$ and let
$C$ and $B$ be the integral closure of $A$ in $M$ and $L$.
Let $\mathfrak r \subset C$ and $\mathfrak q = B \cap \mathfrak r$.
Set
$D_\mathfrak r = \{\tau \in H \mid \tau(\mathfrak r) = \mathfrak r\}$
and
$I_\mathfrak r = \{\tau \in D_\mathfrak r \mid
\tau \bmod \mathfrak r = \text{id}_{\kappa(\mathfrak r)}\}$
and similarly for $D_\mathfrak q$ and $I_\mathfrak q$.
Under the map $H \to G$ the induced maps
$D_\mathfrak r \to D_\mathfrak q$ and
$I_\mathfrak r \to I_\mathfrak q$ are surjective.
\end{lemma}

\begin{proof}
Let $\sigma \in D_\mathfrak q$. Pick $\tau \in H$ mapping to $\sigma$.
This is possible by Fields, Lemma \ref{fields-lemma-galois-infinite}.
Then $\tau(\mathfrak r)$ and $\mathfrak r$ both lie over $\mathfrak q$.
Hence by Lemma \ref{lemma-one-orbit-geometric-galois}
there exists a $\sigma' \in \text{Gal}(M/L)$ with
$\sigma'(\tau(\mathfrak r)) = \mathfrak r$. Hence
$\sigma'\tau \in D_\mathfrak r$ maps to $\sigma$.
The case of inertia groups is proved in exactly the same
way using surjectivity onto automorphism groups.
\end{proof}








\section{Extensions of discrete valuation rings}
\label{section-discrete-valuation-rings}

\noindent
In this section and the next few we use the following definitions.

\begin{definition}
\label{definition-extension-discrete-valuation-rings}
We say that $A \to B$ or $A \subset B$ is an
{\it extension of discrete valuation rings} if $A$ and $B$ are
discrete valuation rings and $A \to B$ is injective and local.
In particular, if $\pi_A$ and $\pi_B$ are uniformizers of
$A$ and $B$, then $\pi_A = u \pi_B^e$ for some $e \geq 1$ and unit
$u$ of $B$. The integer $e$ does not depend on the choice of
the uniformizers as it is also the unique integer $\geq 1$ such that
$$
\mathfrak m_A B = \mathfrak m_B^e
$$
The integer $e$ is called the {\it ramification index} of $B$ over $A$.
We say that $B$ is {\it weakly unramified} over $A$ if $e = 1$.
If the extension of residue fields
$\kappa_A = A/\mathfrak m_A \subset \kappa_B = B/\mathfrak m_B$
is finite, then we set $f = [\kappa_B : \kappa_A]$ and we
call it the {\it residual degree} or {\it residue degree}
of the extension $A \subset B$.
\end{definition}

\noindent
Note that we do not require the extension of fraction fields to be finite.

\begin{lemma}
\label{lemma-inequality}
Let $A \subset B$ be an extension of discrete valuation rings with
fraction fields $K \subset L$. If the extension $L/K$
is finite, then the residue field extension is finite and we have
$ef \leq [L : K]$.
\end{lemma}

\begin{proof}
Finiteness of the residue field extension is
Algebra, Lemma \ref{algebra-lemma-finite-extension-residue-fields-dimension-1}.
The inequality follows from
Algebra, Lemmas \ref{algebra-lemma-finite-length} and
\ref{algebra-lemma-pushdown-module}.
\end{proof}

\begin{lemma}
\label{lemma-multiplicative-e-f}
Let $A \subset B \subset C$ be extensions of discrete valuation rings.
Then the ramification indices of $B/A$ and $C/B$ multiply to give
the ramification index of $C/A$. In a formula $e_{C/A} = e_{B/A} e_{C/B}$.
Similarly for the residual degrees in case they are finite.
\end{lemma}

\begin{proof}
This is immediate from the definitions and
Fields, Lemma \ref{fields-lemma-multiplicativity-degrees}.
\end{proof}

\begin{lemma}
\label{lemma-ramification-index-a-power-of-p}
Let $A \subset B$ be an extension of discrete valuation rings
inducing the field extension $K \subset L$. If the characteristic
of $K$ is $p > 0$ and $L$ is purely inseparable over $K$, then
the ramification index $e$ is a power of $p$.
\end{lemma}

\begin{proof}
Write $\pi_A = u \pi_B^e$ for some $u \in B^*$. On the other hand, we have
$\pi_B^q \in K$ for some $p$-power $q$. Write
$\pi_B^q = v \pi_A^k$ for some $v \in A^*$ and $k \in \mathbf{Z}$.
Then $\pi_A^q = u^q \pi_B^{qe} = u^q v^e \pi_A^{ke}$.
Taking valuations in $B$ we conclude that $ke = q$.
\end{proof}

\noindent
In the following lemma we discuss what it means for an extension $A \subset B$
of discrete valuation rings to be ``unramified'', i.e., have ramification
index $1$ and separable (possibly nonalgebraic) extension of residue fields.
However, we cannot use the term ``unramified'' itself because there already
exists a notion of an unramified ring map, see
Algebra, Section \ref{algebra-section-unramified}.

\begin{lemma}
\label{lemma-extension-dvrs-formally-smooth}
Let $A \subset B$ be an extension of discrete valuation rings.
The following are equivalent
\begin{enumerate}
\item $A \to B$ is formally smooth in the $\mathfrak m_B$-adic topology, and
\item $A \to B$ is weakly unramified and $\kappa_B/\kappa_A$
is a separable field extension.
\end{enumerate}
\end{lemma}

\begin{proof}
This follows from Proposition \ref{proposition-fs-flat-fibre-fs} and
Algebra, Proposition
\ref{algebra-proposition-characterize-separable-field-extensions}.
\end{proof}

\begin{remark}
\label{remark-finite-separable-extension}
Let $A$ be a discrete valuation ring with fraction field $K$.
Let $L/K$ be a finite separable field extension.
Let $B \subset L$ be the integral closure of $A$ in $L$.
Picture:
$$
\xymatrix{
B \ar[r] & L \\
A \ar[u] \ar[r] & K \ar[u]
}
$$
By Algebra, Lemma
\ref{algebra-lemma-Noetherian-normal-domain-finite-separable-extension}
the ring extension $A \subset B$ is finite, hence $B$ is Noetherian.
By Algebra, Lemma \ref{algebra-lemma-integral-sub-dim-equal}
the dimension of $B$ is $1$, hence $B$ is a Dedekind domain, see
Algebra, Lemma \ref{algebra-lemma-characterize-Dedekind}.
Let $\mathfrak m_1, \ldots, \mathfrak m_n$ be the maximal ideals
of $B$ (i.e., the primes lying over $\mathfrak m_A$). We obtain
extensions of discrete valuation rings
$$
A \subset B_{\mathfrak m_i}
$$
and hence ramification indices $e_i$ and residue degrees $f_i$. We have
$$
[L : K] = \sum\nolimits_{i = 1, \ldots, n} e_i f_i
$$
by Algebra, Lemma \ref{algebra-lemma-finite-extension-dim-1}
applied to a uniformizer in $A$.
We observe that $n = 1$ if $A$ is henselian (by
Algebra, Lemma \ref{algebra-lemma-finite-over-henselian}), e.g.\ if
$A$ is complete.
\end{remark}

\begin{definition}
\label{definition-types-of-extensions}
Let $A$ be a discrete valuation ring with fraction field $K$. Let $L/K$
be a finite separable extension. With $B$ and
$\mathfrak m_i$, $i = 1, \ldots, n$
as in Remark \ref{remark-finite-separable-extension} we say the extension
$L/K$ is
\begin{enumerate}
\item {\it unramified with respect to $A$} if $e_i = 1$ and the extension
$\kappa(\mathfrak m_i)/\kappa_A$ is separable for all $i$,
\item {\it tamely ramified with respect to $A$}
if either the characteristic of $\kappa_A$
is $0$ or the characteristic of $\kappa_A$ is $p > 0$, the field extensions
$\kappa(\mathfrak m_i)/\kappa_A$ are separable,
and the ramification indices $e_i$ are prime to $p$, and
\item {\it totally ramified with respect to $A$}
if $n = 1$ and the residue field extension
$\kappa(\mathfrak m_1)/\kappa_A$ is trivial.
\end{enumerate}
If the discrete valuation ring $A$ is clear from context, then we sometimes
say $L/K$ is unramified, totally ramified, or tamely ramified for short.
\end{definition}

\noindent
For unramified extensions we have the following basic lemma.

\begin{lemma}
\label{lemma-permanence-unramified}
Let $A$ be a discrete valuation ring with fraction field $K$.
\begin{enumerate}
\item If $M/L/K$ are finite separable extensions and
$M$ is unramified with respect to $A$, then $L$ is unramified
with respect to $A$.
\item If $L/K$ is a finite separable extension which is
unramified with respect to $A$, then there exists a Galois
extension $M/K$ containing $L$ which is unramified with respect to $A$.
\item If $L_1/K$, $L_2/K$ are finite separable extensions which are
unramified with respect to $A$, then there exists a a finite
separable extension $L/K$ which is unramified with respect
to $A$ containing $L_1$ and $L_2$.
\end{enumerate}
\end{lemma}

\begin{proof}
We will use the results of the discussion in
Remark \ref{remark-finite-separable-extension}
without further mention.

\medskip\noindent
Proof of (1). Let $C/B/A$ be the integral closures of $A$ in $M/L/K$.
Since $C$ is a finite ring extension of $B$, we see that
$\Spec(C) \to \Spec(B)$ is surjective. Hence for ever maximal
ideal $\mathfrak m \subset B$ there is a maximal ideal
$\mathfrak m' \subset C$ lying over $\mathfrak m$.
By the multiplicativity of ramification indices
(Lemma \ref{lemma-multiplicative-e-f})
and the assumption, we conclude that the ramification
index of $B_\mathfrak m$ over $A$ is $1$.
Since $\kappa(\mathfrak m')/\kappa_A$ is finite separable,
the same is true for $\kappa(\mathfrak m)/\kappa_A$.

\medskip\noindent
Proof of (2). Let $M$ be the normal closure of $L$ over $K$, see
Fields, Definition \ref{fields-definition-normal-closure}.
Then $M/K$ is Galois by Fields, Lemma \ref{fields-lemma-normal-closure-galois}.
On the other hand, there is a surjection
$$
L \otimes_K \ldots \otimes_K L \longrightarrow M
$$
of $K$-algebras, see Fields, Lemma
\ref{fields-lemma-normal-closure-tensor-product}.
Let $B$ be the integral closure of $A$ in $L$
as in Remark \ref{remark-finite-separable-extension}. The
condition that $L$ is unramified with respect to $A$
exactly means that $A \to B$ is an \'etale ring map, see
Algebra, Lemma \ref{algebra-lemma-characterize-etale}.
By permanence properties of \'etale ring maps we see that
$$
B \otimes_A \ldots \otimes_A B
$$
is \'etale over $A$, see
Algebra, Lemma \ref{algebra-lemma-etale}.
Hence the displayed ring is a product of Dedekind domains, see
Lemma \ref{lemma-Dedekind-etale-extension}.
We conclude that $M$ is the fraction field of a
Dedekind domain finite \'etale over $A$.
This means that $M$ is unramified with respect to $A$
as desired.

\medskip\noindent
Proof of (3). Let $B_i \subset L_i$ be the integral closure of $A$.
Argue in the same manner as above to show that $B_1 \otimes_A B_2$
is finite \'etale over $A$. Details omitted.
\end{proof}

\begin{lemma}
\label{lemma-composition-unramified}
Let $A$ be a discrete valuation ring with fraction field $K$.
Let $M/L/K$ be finite separable extensions.
Let $B$ be the integral closure of $A$ in $L$.
If $L/K$ is unramified with respect to $A$
and $M/L$ is unramified with respect to $B_\mathfrak m$
for every maximal ideal $\mathfrak m$ of $B$, then
$M/K$ is unramified with respect to $A$.
\end{lemma}

\begin{proof}
Let $C$ be the integral closure of $A$ in $M$.
Every maximal ideal $\mathfrak m'$ of $C$ lies over
a maximal ideal $\mathfrak m$ of $B$.
Then the lemma follows from the multiplicativity
of ramification indices (Lemma \ref{lemma-multiplicative-e-f})
and the fact that we have the tower
$\kappa(\mathfrak m')/\kappa(\mathfrak m)/\kappa_A$
of finite extensions of fields.
\end{proof}















\section{Galois extensions and ramification}
\label{section-ramification}

\noindent
In the case of Galois extensions, we can elaborate on the discussion in
Section \ref{section-discrete-valuation-rings}.

\begin{lemma}
\label{lemma-galois}
Let $A$ be a discrete valuation ring with fraction field $K$.
Let $L/K$ be a finite Galois extension with Galois group $G$.
Then $G$ acts on the ring $B$ of Remark \ref{remark-finite-separable-extension}
and acts transitively on the set of maximal ideals of $B$.
\end{lemma}

\begin{proof}
Observe that $A = B^G$ as $A$ is integrally closed in $K$ and $K = L^G$.
Hence this lemma is a special case of Lemma \ref{lemma-one-orbit}.
\end{proof}

\begin{lemma}
\label{lemma-galois-conclusion}
Let $A$ be a discrete valuation ring with fraction field $K$.
Let $L/K$ be a finite Galois extension. Then there are $e \geq 1$ and
$f \geq 1$ such that $e_i = e$ and $f_i = f$ for all $i$ (notation
as in Remark \ref{remark-finite-separable-extension}). In particular
$[L : K] = n e f$.
\end{lemma}

\begin{proof}
Immediate consequence of Lemma \ref{lemma-galois} and the definitions.
\end{proof}

\begin{definition}
\label{definition-decomposition-inertia}
Let $A$ be a discrete valuation ring with fraction field $K$.
Let $L/K$ be a finite Galois extension with Galois group $G$.
Let $B$ be the integral closure of $A$ in $L$.
Let $\mathfrak m \subset B$ be a maximal ideal.
\begin{enumerate}
\item The {\it decomposition group of $\mathfrak m$}
is the subgroup $D = \{\sigma \in G \mid \sigma(\mathfrak m) = \mathfrak m\}$.
\item The {\it inertia group of $\mathfrak m$} is the kernel $I$ of the map
$D \to \text{Aut}(\kappa(\mathfrak m)/\kappa_A)$.
\end{enumerate}
\end{definition}

\noindent
Note that the field $\kappa(\mathfrak m)$ may be inseparable over $\kappa_A$.
In particular the field extension $\kappa(\mathfrak m)/\kappa_A$
need not be Galois. If $\kappa_A$ is perfect, then it is.

\begin{lemma}
\label{lemma-galois-galois}
Let $A$ be a discrete valuation ring with fraction field $K$ and residue field
$\kappa$. Let $L/K$ be a finite Galois extension with Galois group $G$.
Let $B$ be the integral closure of $A$ in $L$. Let $\mathfrak m$ be a maximal
ideal of $B$. Then
\begin{enumerate}
\item the field extension $\kappa(\mathfrak m)/\kappa$ is normal, and
\item $D \to \text{Aut}(\kappa(\mathfrak m)/\kappa)$ is surjective.
\end{enumerate}
If for some (equivalently all) maximal ideal(s) $\mathfrak m \subset B$
the field extension $\kappa(\mathfrak m)/\kappa$ is separable, then
\begin{enumerate}
\item[(3)] $\kappa(\mathfrak m)/\kappa$ is Galois, and
\item[(4)] $D \to \text{Gal}(\kappa(\mathfrak m)/\kappa)$ is surjective.
\end{enumerate}
Here $D \subset G$ is the decomposition group of $\mathfrak m$.
\end{lemma}

\begin{proof}
Observe that $A = B^G$ as $A$ is integrally closed in $K$ and $K = L^G$.
Thus parts (1) and (2) follow from Lemma \ref{lemma-one-orbit-geometric}.
The ``equivalently all'' part of the lemma follows from
Lemma \ref{lemma-galois}. Assume $\kappa(\mathfrak m)/\kappa$
is separable. Then parts (3) and (4) follow immediately from (1) and (2).
\end{proof}

\begin{lemma}
\label{lemma-galois-inertia}
Let $A$ be a discrete valuation ring with fraction field $K$.
Let $L/K$ be a finite Galois extension with Galois group $G$.
Let $B$ be the integral closure of $A$ in $L$. Let $\mathfrak m \subset B$
be a maximal ideal. The inertia group $I$ of $\mathfrak m$
sits in a canonical exact sequence
$$
1 \to P \to I \to I_t \to 1
$$
such that
\begin{enumerate}
\item $P = \{\sigma \in D \mid
\sigma|_{B/\mathfrak m^2} = \text{id}_{B/\mathfrak m^2}\}$
where $D$ is the decomposition group,
\item $P$ is a normal subgroup of $D$,
\item $P$ is a $p$-group if the characteristic of $\kappa_A$ is
$p > 0$ and $P = \{1\}$ if the characteristic of $\kappa_A$ is zero,
\item $I_t$ is cyclic of order the prime to $p$ part of the integer $e$, and
\item there is a canonical isomorphism
$\theta : I_t \to \mu_e(\kappa(\mathfrak m))$.
\end{enumerate}
Here $e$ is the integer of Lemma \ref{lemma-galois-conclusion}.
\end{lemma}

\begin{proof}
Recall that $|G| = [L : K] = nef$, see Lemma \ref{lemma-galois-conclusion}.
Since $G$ acts transitively on the set
$\{\mathfrak m_1, \ldots, \mathfrak m_n\}$ of maximal ideals of $B$
(Lemma \ref{lemma-galois})
and since $D$ is the stabilizer of an element we see that $|D| = ef$.
By Lemma \ref{lemma-galois-galois} we have
$$
ef = |D| = |I| \cdot |\text{Aut}(\kappa(\mathfrak m)/\kappa)|
$$
where $\kappa$ is the residue field of $A$.
As $\kappa(\mathfrak m)$ is normal over $\kappa$ the order of
$\text{Aut}(\kappa(\mathfrak m)/\kappa)$ differs from $f$ by
a power of $p$ (see
Fields, Lemma \ref{fields-lemma-normal-and-automorphisms}
and discussion following
Fields, Definition \ref{fields-definition-insep-degree}).
Hence the prime to $p$ part
of $|I|$ is equal to the prime to $p$ part of $e$.

\medskip\noindent
Set $C = B_\mathfrak m$. Then $I$ acts on $C$ over $A$ and trivially
on the residue field of $C$. Let $\pi_A \in A$ and $\pi_C \in C$ be
uniformizers. Write $\pi_A = u \pi_C^e$ for some unit $u$ in $C$.
For $\sigma \in I$ write $\sigma(\pi_C) = \theta_\sigma \pi_C$ for some
unit $\theta_\sigma$ in $C$. Then we have
$$
\pi_A = \sigma(\pi_A) = \sigma(u) (\theta_\sigma \pi_C)^e
= \sigma(u) \theta_\sigma^e \pi_C^e = \frac{\sigma(u)}{u} \theta_\sigma^e \pi_A
$$
Since $\sigma(u) \equiv u \bmod \mathfrak m_C$ as $\sigma \in I$
we see that the image $\overline{\theta}_\sigma$
of $\theta_\sigma$ in $\kappa_C = \kappa(\mathfrak m)$
is an $e$th root of unity.
We obtain a map
\begin{equation}
\label{equation-inertia-character}
\theta : I \longrightarrow \mu_e(\kappa(\mathfrak m)),\quad
\sigma \mapsto \overline{\theta}_\sigma
\end{equation}
We claim that $\theta$ is a homomorphism of groups and independent
of the choice of uniformizer $\pi_C$. Namely, if $\tau$ is a second
element of $I$, then
$\tau(\sigma(\pi_C)) = \tau(\theta_\sigma \pi_C) =
\tau(\theta_\sigma) \theta_\tau \pi_C$, hence
$\theta_{\tau \sigma} = \tau(\theta_\sigma) \theta_\tau$ and
since $\tau \in I$ we conclude that
$\overline{\theta}_{\tau \sigma} =
\overline{\theta}_\sigma \overline{\theta}_\tau$.
If $\pi'_C$ is a second uniformizer, then we see
that $\pi'_C = w \pi_C$ for some unit $w$ of $C$ and
$\sigma(\pi'_C) = w^{-1}\sigma(w)\theta_\sigma \pi'_C$,
hence $\theta'_\sigma = w^{-1}\sigma(w)\theta_\sigma$,
hence $\theta'_\sigma$ and $\theta_\sigma$
map to the same element of the residue field as before.

\medskip\noindent
Since $\kappa(\mathfrak m)$ has characteristic $p$, the group
$\mu_e(\kappa(\mathfrak m))$ is cyclic of order at most the prime
to $p$ part of $e$ (see Fields, Section \ref{fields-section-roots-of-1}).

\medskip\noindent
Let $P = \Ker(\theta)$. The elements of $P$ are exactly the elements
of $D$ acting trivially on $C/\pi_C^2C \cong B/\mathfrak m^2$.
Thus (a) is true. This implies (b) as $P$ is the kernel
of the map $D \to \text{Aut}(B/\mathfrak m^2)$.
If we can prove (c), then parts (d) and (e) will follow as $I_t$
will be isomorphic to $\mu_e(\kappa(\mathfrak m))$ as the arguments above show
that $|I_t| \geq |\mu_e(\kappa(\mathfrak m))|$.

\medskip\noindent
Thus it suffices to prove that the
kernel $P$ of $\theta$ is a $p$-group. Let $\sigma$ be a nontrivial element of
the kernel. Then $\sigma - \text{id}$
sends $\mathfrak m_C^i$ into $\mathfrak m_C^{i + 1}$
for all $i$. Let $m$ be the order of $\sigma$. Pick $c \in C$ such
that $\sigma(c) \not = c$. Then $\sigma(c) - c \in \mathfrak m_C^i$,
$\sigma(c) - c \not \in \mathfrak m_C^{i + 1}$ for some $i$ and
we have
\begin{align*}
0
& =
\sigma^m(c) - c \\
& =
\sigma^m(c) - \sigma^{m - 1}(c) + \ldots + \sigma(c) - c \\
& =
\sum\nolimits_{j = 0, \ldots, m - 1} \sigma^j(\sigma(c) - c) \\
& \equiv
m(\sigma(c) - c) \bmod \mathfrak m_C^{i + 1}
\end{align*}
It follows that $p | m$ (or $m = 0$ if $p = 1$). Thus every element of the
kernel of $\theta$ has order divisible by $p$, i.e., $\Ker(\theta)$
is a $p$-group.
\end{proof}

\begin{definition}
\label{definition-wild-inertia}
With assumptions and notation as in Lemma \ref{lemma-galois-inertia}.
\begin{enumerate}
\item The {\it wild inertia group of $\mathfrak m$} is the subgroup $P$.
\item The {\it tame inertia group of $\mathfrak m$} is the
quotient $I \to I_t$.
\end{enumerate}
We denote $\theta : I \to \mu_e(\kappa(\mathfrak m))$ the surjective map
(\ref{equation-inertia-character}) whose kernel is $P$ and which
induces the isomorphism $I_t \to \mu_e(\kappa(\mathfrak m))$.
\end{definition}

\begin{lemma}
\label{lemma-inertia-character}
With assumptions and notation as in Lemma \ref{lemma-galois-inertia}.
The inertia character $\theta : I \to \mu_e(\kappa(\mathfrak m))$
satisfies the following property
$$
\theta(\tau \sigma \tau^{-1}) = \tau(\theta(\sigma))
$$
for $\tau \in D$ and $\sigma \in I$.
\end{lemma}

\begin{proof}
The formula makes sense as $I$ is a normal subgroup of $D$
and as $\tau$ acts on $\kappa(\mathfrak m)$ via the map
$D \to \text{Aut}(\kappa(\mathfrak m))$ discussed in
Lemma \ref{lemma-galois-galois} for example.
Recall the construction of $\theta$. Choose
a uniformizer $\pi$ of $B_\mathfrak m$ and for
$\sigma \in I$ write $\sigma(\pi) = \theta_\sigma \pi$.
Then $\theta(\sigma)$ is the image $\overline{\theta}_\sigma$
of $\theta_\sigma$ in the residue field. For any $\tau \in D$
we can write $\tau(\pi) = \theta_\tau \pi$ for some unit $\theta_\tau$.
Then $\theta_{\tau^{-1}} = \tau^{-1}(\theta_\tau^{-1})$.
We compute
\begin{align*}
\theta_{\tau \sigma \tau^{-1}}
& =
\tau(\sigma(\tau^{-1}(\pi)))/\pi \\
& =
\tau(\sigma(\tau^{-1}(\theta_\tau^{-1}) \pi))/\pi \\
& =
\tau(\sigma(\tau^{-1}(\theta_\tau^{-1})) \theta_\sigma \pi)/\pi \\
& =
\tau(\sigma(\tau^{-1}(\theta_\tau^{-1}))) \tau(\theta_\sigma) \theta_\tau
\end{align*}
However, since $\sigma$ acts trivially modulo $\pi$ we see that
the product $\tau(\sigma(\tau^{-1}(\theta_\tau^{-1}))) \theta_\tau$
maps to $1$ in the residue field. This proves the lemma.
\end{proof}

\noindent
We will generalize the following lemma in
Fundamental Groups, Lemma \ref{pione-lemma-inertial-invariants-unramified}.

\begin{lemma}
\label{lemma-inertial-invariants-unramified}
Let $A$ be a discrete valuation ring with fraction field $K$.
Let $L/K$ be a finite Galois extension. Let $\mathfrak m \subset B$
be a maximal ideal of the integral closure of $A$ in $L$.
Let $I \subset G$ be the inertia group of $\mathfrak m$.
Then $B^I$ is the integral closure of $A$ in $L^I$ and
$A \to (B^I)_{B^I \cap \mathfrak m}$ is \'etale.
\end{lemma}

\begin{proof}
Write $B' = B^I$. It follows from the definitions that $B' = B^I$
is the integral closure of $A$ in $L^I$. Write
$\mathfrak m' = B^I \cap \mathfrak m = B' \cap \mathfrak m \subset B'$.
By Lemma \ref{lemma-one-orbit} the maximal ideal $\mathfrak m$ is the
unique prime ideal of $B$ lying over $\mathfrak m'$.
As $I$ acts trivially on $\kappa(\mathfrak m)$ we see from
Lemma \ref{lemma-invariants-modulo} that the extension
$\kappa(\mathfrak m)/\kappa(\mathfrak m')$ is purely inseparable
(perhaps an easier alternative is to apply the result of
Lemma \ref{lemma-one-orbit-geometric}).
Since $D/I$ acts faithfully on $\kappa(\mathfrak m')$,
we conclude that $D/I$ acts faithfully on $\kappa(\mathfrak m)$.
Of course the elements of the residue field $\kappa$ of $A$
are fixed by this action.
By Galois theory we see that $[\kappa(\mathfrak m') : \kappa] \geq |D/I|$,
see Fields, Lemma \ref{fields-lemma-galois-over-fixed-field}.

\medskip\noindent
Let $\pi$ be the uniformizer of $A$. Since
$\text{Norm}_{L/K}(\pi) = \pi^{[L : K]}$ we see from
Algebra, Lemma \ref{algebra-lemma-finite-extension-dim-1}
that
$$
|G| = [L : K] = [L : K]\ \text{ord}_A(\pi) =
|G/D|\ [\kappa(\mathfrak m) : \kappa]\ \text{ord}_{B_\mathfrak m}(\pi)
$$
as there are $n = |G/D|$ maximal ideals of $B$ which are all
conjugate under $G$, see
Remark \ref{remark-finite-separable-extension} and
Lemma \ref{lemma-galois}.
Applying the same reasoning to the finite extension
the finite extension $L/L^I$ of degree $|I|$ we find
$$
|I|\ \text{ord}_{B'_{\mathfrak m'}}(\pi) =
[\kappa(\mathfrak m) : \kappa(\mathfrak m')]\ \text{ord}_{B_\mathfrak m}(\pi)
$$
We conclude that
$$
\text{ord}_{B'_{\mathfrak m'}}(\pi) =
\frac{|D/I|}{[\kappa(\mathfrak m') : \kappa]}
$$
Since the left hand side is a positive integer and since the right hand
side is $\leq 1$ by the above, we conclude that we have equality,
$\text{ord}_{B'_{\mathfrak m'}}(\pi) = 1$ and
$\kappa(\mathfrak m')/\kappa$ has degree $|D/I|$.
Thus $\pi B'_{\mathfrak m'} = \mathfrak m' B_\mathfrak m'$ and
$\kappa(\mathfrak m')$ is Galois over $\kappa$ with
Galois group $D/I$, in particular separable, see
Fields, Lemma \ref{fields-lemma-finite-Galois}.
By Algebra, Lemma \ref{algebra-lemma-characterize-etale}
we find that $A \to B'_{\mathfrak m'}$ is \'etale
as desired.
\end{proof}

\begin{remark}
\label{remark-tower-of-rings}
Let $A$ be a discrete valuation ring with fraction field $K$.
Let $L/K$ be a finite Galois extension. Let $\mathfrak m \subset B$
be a maximal ideal of the integral closure of $A$ in $L$.
Let
$$
P \subset I \subset D \subset G
$$
be the wild inertia, inertia, decomposition group of $\mathfrak m$.
Consider the diagram
$$
\xymatrix{
\mathfrak m \ar@{-}[d] \ar@{-}[r] &
\mathfrak m^P \ar@{-}[d] \ar@{-}[r] &
\mathfrak m^I \ar@{-}[d] \ar@{-}[r] &
\mathfrak m^D \ar@{-}[d] \ar@{-}[r] &
A \cap \mathfrak m \ar@{-}[d] \\
B & B^P \ar[l] & B^I \ar[l] & B^D \ar[l] & A \ar[l]
}
$$
Observe that $B^P, B^I, B^D$ are the integral closures of
$A$ in the fields $L^P$, $L^I$, $L^D$. Thus we also see that
$B^P$ is the integral closure of $B^I$ in $L^P$ and so on.
Observe that $\mathfrak m^P = \mathfrak m \cap B^P$,
$\mathfrak m^I = \mathfrak m \cap B^I$, and
$\mathfrak m^D = \mathfrak m \cap B^D$. Hence the
top line of the diagram corresponds to the images
of $\mathfrak m \in \Spec(B)$ under the induced maps of
spectra. Having said all of this we have the following
\begin{enumerate}
\item the extension $L^I/L^D$ is Galois with group $D/I$,
\item the extension $L^P/L^I$ is Galois with group $I_t = I/P$,
\item the extension $L^P/L^D$ is Galois with group $D/P$,
\item $\mathfrak m^I$ is the unique prime of $B^I$ lying over $\mathfrak m^D$,
\item $\mathfrak m^P$ is the unique prime of $B^P$ lying over $\mathfrak m^I$,
\item $\mathfrak m$ is the unique prime of $B$ lying over $\mathfrak m^P$,
\item $\mathfrak m^P$ is the unique prime of $B^P$ lying over $\mathfrak m^D$,
\item $\mathfrak m$ is the unique prime of $B$ lying over $\mathfrak m^I$,
\item $\mathfrak m$ is the unique prime of $B$ lying over $\mathfrak m^D$,
\item $A \to B^D_{\mathfrak m^D}$ is \'etale and induces a
trivial residue field extension,
\item $B^D_{\mathfrak m^D} \to B^I_{\mathfrak m^I}$ is \'etale
and induces a Galois extension of residue fields with Galois
group $D/I$,
\item $A \to B^I_{\mathfrak m^I}$ is \'etale,
\item $B^I_{\mathfrak m^I} \to B^P_{\mathfrak m^P}$
has ramification index $|I/P|$ prime to $p$ and induces a
trivial residue field extension,
\item $B^D_{\mathfrak m^D} \to B^P_{\mathfrak m^P}$
has ramification index $|I/P|$ prime to $p$ and induces a
separable residue field extension,
\item $A \to B^P_{\mathfrak m^P}$
has ramification index $|I/P|$ prime to $p$ and induces a
separable residue field extension.
\end{enumerate}
Statements (1), (2), and (3) are immediate from Galois theory
(Fields, Section \ref{fields-section-galois-theory})
and Lemma \ref{lemma-galois-inertia}.
Statements (4) -- (9) are clear from
Lemma \ref{lemma-galois}.
Part (12) is Lemma \ref{lemma-inertial-invariants-unramified}.
Since we have the factorization
$A \to B^D_{\mathfrak m^D} \to B^I_{\mathfrak m^I}$
we obtain the \'etaleness in (10) and (11) as a consequence.
The residue field extension in (10) must be trivial because
it is separable and $D/I$ maps onto
$\text{Aut}(\kappa(\mathfrak m)/\kappa_A)$ as shown in
Lemma \ref{lemma-galois-galois}. The same argument
provides the proof of the statement on residue fields in (11).
To see (13), (14), and (15) it suffices to prove (13).
By the above, the extension $L^P/L^I$ is Galois
with a cyclic Galois group of order prime to $p$,
the prime $\mathfrak m^P$ is the unique prime lying over
$\mathfrak m^I$ and the action of $I/P$ on the residue
field is trivial. Thus we can apply Lemma \ref{lemma-galois-inertia}
to this extension and the discrete valuation ring
$B^I_{\mathfrak m^I}$ to see that (13) holds.
\end{remark}

\begin{lemma}
\label{lemma-compare-inertia}
Let $A$ be a discrete valuation ring with fraction field $K$.
Let $M/L/K$ be a tower with $M/K$ and $L/K$ finite Galois.
Let $C$, $B$ be the integral closure of $A$ in $M$, $L$.
Let $\mathfrak m' \subset C$ be a maximal ideal and set
$\mathfrak m = \mathfrak m' \cap B$. Let
$$
P \subset I \subset D \subset \text{Gal}(L/K)
\quad\text{and}\quad
P' \subset I' \subset D' \subset \text{Gal}(M/K)
$$
be the wild inertia, inertia, decomposition group of
$\mathfrak m$ and $\mathfrak m'$.
Then the canonical surjection $\text{Gal}(M/K) \to \text{Gal}(L/K)$
induces surjections $P' \to P$, $I' \to I$, and $D' \to D$. Moreover
these fit into commutative diagrams
$$
\vcenter{
\xymatrix{
D' \ar[r] \ar[d] &
\text{Aut}(\kappa(\mathfrak m')/\kappa_A) \ar[d] \\
D \ar[r] &
\text{Aut}(\kappa(\mathfrak m)/\kappa_A)
}
}
\quad\text{and}\quad
\vcenter{
\xymatrix{
I' \ar[r]_-{\theta'} \ar[d] &
\mu_{e'}(\kappa(\mathfrak m')) \ar[d]^{(-)^{e'/e}} \\
I \ar[r]^-\theta &
\mu_e(\kappa(\mathfrak m))
}
}
$$
where $e'$ and $e$ are the ramification indices of
$A \to C_{\mathfrak m'}$ and $A \to B_\mathfrak m$.
\end{lemma}

\begin{proof}
The fact that under the map $\text{Gal}(M/K) \to \text{Gal}(L/K)$
the groups $P', I', D'$ map into $P, I, D$ is immediate from the
definitions of these groups. The commutativity of the first diagram
is clear (observe that since $\kappa(\mathfrak m)/\kappa_A$ is normal
every automorphism of $\kappa(\mathfrak m')$ over $\kappa_A$ indeed
induces an automorphism of $\kappa(\mathfrak m)$ over $\kappa_A$
and hence we obtain the right vertical arrow in the first diagram, see
Lemma \ref{lemma-galois-galois} and
Fields, Lemma \ref{fields-lemma-lift-maps}).

\medskip\noindent
The maps $I' \to I$ and $D' \to D$ are surjective by
Lemma \ref{lemma-one-orbit-geometric-galois-compare}.
The surjectivity of $P' \to P$ follows as $P'$ and $P$
are p-Sylow subgroups of $I'$ and $I$.

\medskip\noindent
To see the commutativity of the second diagram we choose a uniformizer
$\pi'$ of $C_{\mathfrak m'}$ and a uniformizer $\pi$ of $B_\mathfrak m$.
Then $\pi = c' (\pi')^{e'/e}$ for some unit $c'$ of $C_{\mathfrak m'}$.
For $\sigma' \in I'$ the image $\sigma \in I$ is simply the restriction
of $\sigma'$ to $L$. Write $\sigma'(\pi') = c \pi'$ for a unit
$c \in C_{\mathfrak m'}$ and write
$\sigma(\pi) = b \pi$ for a unit $b$ of $B_\mathfrak m$.
Then $\sigma'(\pi) = b \pi$ and we obtain
$$
b \pi = \sigma'(\pi) = \sigma'(c' (\pi')^{e'/e}) =
\sigma'(c') c^{e'/e} (\pi')^{e'/e} =
\frac{\sigma'(c')}{c'} c^{e'/e} \pi
$$
As $\sigma' \in I'$ we see that $b$ and $c^{e'/e}$ have the same
image in the residue field which proves what we want.
\end{proof}

\begin{remark}
\label{remark-canonical-inertia-character}
In order to use the inertia character
$\theta : I \to \mu_e(\kappa(\mathfrak m))$
for infinite Galois extensions, it is convenient
to scale it. Let $A, K, L, B, \mathfrak m, G, P, I, D, e, \theta$
be as in Lemma \ref{lemma-galois-inertia} and
Definition \ref{definition-wild-inertia}.
Then $e = q |I_t|$ with $q$ is a power of the characteristic $p$
of $\kappa(\mathfrak m)$ if positive or $1$ if zero.
Note that $\mu_e(\kappa(\mathfrak m)) = \mu_{|I_t|}(\kappa(\mathfrak m))$
because the characteristic of $\kappa(\mathfrak m)$ is $p$. Consider
the map
$$
\theta_{can} = q\theta : I \longrightarrow \mu_{|I_t|}(\kappa(\mathfrak m))
$$
This map induces an isomorphism
$\theta_{can} : I_t \to \mu_{|I_t|}(\kappa(\mathfrak m))$.
We have $\theta_{can}(\tau \sigma \tau^{-1}) = \tau(\theta_{can}(\sigma))$
for $\tau \in D$ and $\sigma \in I$
by Lemma \ref{lemma-inertia-character}.
Finally, if $M/L$ is an extension such that $M/K$ is Galois
and $\mathfrak m'$ is a prime of the integral closure of $A$ in $M$
lying over $\mathfrak m$, then we get the commutative diagram
$$
\xymatrix{
I' \ar[r]_-{\theta'_{can}} \ar[d] &
\mu_{|I'_t|}(\kappa(\mathfrak m')) \ar[d]^{(-)^{|I'_t|/|I_t|}} \\
I \ar[r]^-{\theta_{can}} &
\mu_{|I_t|}(\kappa(\mathfrak m))
}
$$
by Lemma \ref{lemma-compare-inertia}.
\end{remark}













\section{Krasner's lemma}
\label{section-krasner}

\noindent
Here is Krasner's lemma in the case of discretely valued fields.

\begin{lemma}[Krasner's lemma]
\label{lemma-krasner}
Let $A$ be a complete local domain of dimension $1$. Let $P(t) \in A[t]$
be a polynomial with coefficients in $A$. Let $\alpha \in A$ be a root
of $P$ but not a root of the derivative $P' = \text{d}P/\text{d}t$.
For every $c \geq 0$ there exists an integer $n$ such that for any
$Q \in A[t]$ whose coefficients are in $\mathfrak m_A^n$ the polynomial
$P + Q$ has a root $\beta \in A$ with $\beta - \alpha \in \mathfrak m_A^c$.
\end{lemma}

\begin{proof}
Choose a nonzero $\pi \in \mathfrak m$. Since the dimension of $A$ is $1$
we have $\mathfrak m = \sqrt{(\pi)}$. By assumption we may write
$P'(\alpha)^{-1} = \pi^{-m} a$ for some $m \geq 0$ and $a \in A$.
We may and do assume that $c \geq m + 1$.
Pick $n$ such that $\mathfrak m_A^n \subset (\pi^{c + m})$.
Pick any $Q$ as in the statement. For later use we observe that we can write
$$
P(x + y) = P(x) + P'(x)y + R(x, y)y^2
$$
for some $R(x, y) \in A[x, y]$. We will show by induction that we can find a
sequence $\alpha_m, \alpha_{m + 1}, \alpha_{m + 2}, \ldots$ such that
\begin{enumerate}
\item $\alpha_k \equiv \alpha \bmod \pi^c$,
\item $\alpha_{k + 1} - \alpha_k \in (\pi^k)$, and
\item $(P + Q)(\alpha_k) \in (\pi^{m + k})$.
\end{enumerate}
Setting $\beta = \lim \alpha_k$ will finish the proof.

\medskip\noindent
Base case. Since the coefficients of $Q$ are in $(\pi^{c + m})$ we have
$(P + Q)(\alpha) \in (\pi^{c + m})$. Hence $\alpha_m = \alpha$ works.
This choice guarantees that $\alpha_k \equiv \alpha \bmod \pi^c$
for all $k \geq m$.

\medskip\noindent
Induction step. Given $\alpha_k$ we write
$\alpha_{k + 1} = \alpha_k + \delta$ for some $\delta \in (\pi^k)$.
Then we have
$$
(P + Q)(\alpha_{k + 1}) =
P(\alpha_k + \delta) + Q(\alpha_k + \delta)
$$
Because the coefficients of $Q$ are in $(\pi^{c + m})$ we see that
$Q(\alpha_k + \delta) \equiv Q(\alpha_k) \bmod \pi^{c + m + k}$.
On the other hand we have
$$
P(\alpha_k + \delta) =
P(\alpha_k) + P'(\alpha_k)\delta + R(\alpha_k, \delta)\delta^2
$$
Note that $P'(\alpha_k) \equiv P'(\alpha) \bmod (\pi^{m + 1})$
as $\alpha_k \equiv \alpha \bmod \pi^{m + 1}$. Hence we obtain
$$
P(\alpha_k + \delta) \equiv P(\alpha_k) + P'(\alpha) \delta
\bmod \pi^{k + m + 1}
$$
Recombining the two terms we see that
$$
(P + Q)(\alpha_{k + 1}) \equiv (P + Q)(\alpha_k) + P'(\alpha) \delta
\bmod \pi^{k + m + 1}
$$
Thus a solution is to take
$\delta = -P'(\alpha)^{-1} (P + Q)(\alpha_k) =  - \pi^{-m} a (P + Q)(\alpha_k)$
which is contained in $(\pi^k)$ by induction assumption.
\end{proof}

\begin{lemma}
\label{lemma-approximate-separable-extension}
Let $A$ be a discrete valuation ring with field of fractions $K$.
Let $A^\wedge$ be the completion of $A$ with fraction field $K^\wedge$.
If $M/K^\wedge$ is a finite separable extension, then
there exists a finite separable extension $L/K$
such that $M = K^\wedge \otimes_K L$.
\end{lemma}

\begin{proof}
Note that $A^\wedge$ is a discrete valuation ring too (by
Lemmas \ref{lemma-completion-regular} and \ref{lemma-completion-dimension}).
In particular $A^\wedge$ is a domain. The proof will work more generally
for Noetherian local rings $A$ such that $A^\wedge$ is a local domain
of dimension $1$.

\medskip\noindent
Let $\theta \in M$ be an element that generates $M$ over $K^\wedge$.
(Theorem of the primitive element.)
Let $P(t) \in K^\wedge[t]$ be the minimal polynomial of $\theta$ over
$K^\wedge$. Let $\pi \in \mathfrak m_A$ be a nonzero element.
After replacing $\theta$ by $\pi^n\theta$ we may assume that
the coefficients of $P(t)$ are in $A^\wedge$. Let
$B = A^\wedge[\theta] = A^\wedge[t]/(P(t))$. Note that $B$ is
a complete local domain of dimension $1$ because it is finite over $A$ and
contained in $M$. Since $M$ is separable over $K$ the element $\theta$
is not a root of the derivative of $P$. For any integer $n$ we can find
a monic polynomial $P_1 \in A[t]$ such that $P - P_1$ has coefficients in
$\pi^nA^\wedge[t]$. By Krasner's lemma (Lemma \ref{lemma-krasner}) we see that
$P_1$ has a root $\beta$ in $B$ for $n$ sufficiently large.
Moreover, we may assume (if $n$ is chosen large enough)
that $\theta - \beta \in \pi B$. Consider the map
$\Phi : A^\wedge[t]/(P_1) \to B$ of $A^\wedge$-algebras
which maps $t$ to $\beta$. Since
$B = \pi B + \sum_{i < \deg(P)} A^\wedge \theta^i$, the map $\Phi$
is surjective by Nakayama's lemma. As $\deg(P_1) = \deg(P)$ it
follows that $\Phi$ is an isomorphism. We conclude that the ring
extension $L = K[t]/(P_1(t))$ satisfies $K^\wedge \otimes_K L \cong M$.
This implies that $L$ is a field and the proof is complete.
\end{proof}

\begin{definition}
\label{definition-mixed}
Let $A$ be a discrete valuation ring. We say $A$ has {\it mixed characteristic}
if the characteristic of the residue field of $A$ is $p > 0$ and the
characteristic of the fraction field of $A$ is $0$.
In this case we obtain an extension of discrete valuation rings
$\mathbf{Z}_{(p)} \subset A$ and the {\it absolute ramification index}
of $A$ is the ramification index of this extension.
\end{definition}









\section{Abhyankar's lemma and tame ramification}
\label{section-abhyankar-tame}

\noindent
In this section we prove what we think is the most general version of
Abhyankar's lemma for discrete valuation rings. After doing so, we apply
this to prove some results about tamely ramified extensions of the
fraction field of a discrete valuation ring.

\begin{remark}
\label{remark-construction}
Let $A \to B$ be an extension of discrete valuation rings with fraction
fields $K \subset L$. Let $K_1/K$ be a finite extension of
fields. Let $A_1 \subset K_1$ be the integral closure of $A$ in $K_1$.
On the other hand, let $L_1 = (L \otimes_K K_1)_{red}$. Then $L_1$ is a
nonempty finite product of finite field extensions of $L$. Let $B_1$ be
the integral closure of $B$ in $L_1$. We obtain compatible commutative
diagrams
$$
\vcenter{
\xymatrix{
L \ar[r] & L_1 \\
K \ar[u] \ar[r] & K_1 \ar[u]
}
}
\quad\text{and}\quad
\vcenter{
\xymatrix{
B \ar[r] & B_1 \\
A \ar[u] \ar[r] & A_1 \ar[u]
}
}
$$
In this situation we have the following
\begin{enumerate}
\item By Algebra, Lemma \ref{algebra-lemma-integral-closure-Dedekind}
the ring $A_1$ is a Dedekind domain and $B_1$ is a finite product of
Dedekind domains.
\item Note that $L \otimes_K K_1 = (B \otimes_A A_1)_\pi$ where $\pi \in A$
is a uniformizer and that $\pi$ is a nonzerodivisor on $B \otimes_A A_1$. 
Thus the ring map $B \otimes_A A_1 \to B_1$ is integral with kernel
consisting of nilpotent elements. Hence $\Spec(B_1) \to \Spec(B \otimes_A A_1)$
is surjective on spectra
(Algebra, Lemma \ref{algebra-lemma-integral-overring-surjective}).
The map $\Spec(B \otimes_A A_1) \to \Spec(A_1)$ is surjective as
$A_1/\mathfrak m_A A_1 \to
B/\mathfrak m_AB \otimes_{\kappa_A} A_1/\mathfrak m_A A_1$
is an injective ring map with $A_1/\mathfrak m_A A_1$ Artinian.
We conclude that $\Spec(B_1) \to \Spec(A_1)$ is surjective.
\item Let $\mathfrak m_i$, $i = 1, \ldots n$ with $n \geq 1$ be the
maximal ideals of $A_1$. For each $i = 1, \ldots, n$ let
$\mathfrak m_{ij}$, $j = 1, \ldots, m_i$ with $m_i \geq 1$
be the maximal ideals of $B_1$ lying over $\mathfrak m_i$. We obtain diagrams
$$
\xymatrix{
B \ar[r] & (B_1)_{\mathfrak m_{ij}} \\
A \ar[u] \ar[r] & (A_1)_{\mathfrak m_i} \ar[u]
}
$$
of extensions of discrete valuation rings.
\item If $A$ is henselian (for example complete), then $A_1$ is a
discrete valuation ring, i.e., $n = 1$.
Namely, $A_1$ is a union of finite extensions of $A$ which are domains,
hence local by Algebra, Lemma \ref{algebra-lemma-finite-over-henselian}.
\item If $B$ is henselian (for example complete), then $B_1$
is a product of discrete valuation rings, i.e., $m_i = 1$ for
$i = 1, \ldots, n$.
\item If $K \subset K_1$ is purely inseparable, then $A_1$ and $B_1$
are both discrete valuation rings, i.e., $n = 1$ and $m_1 = 1$.
This is true because for every $b \in B_1$ a $p$-power power of $b$
is in $B$, hence $B_1$ can only have one maximal ideal.
\item If $K \subset K_1$ is finite separable, then $L_1 = L \otimes_K K_1$
and is a finite product of finite separable extensions too. Hence
$A \subset A_1$ and $B \subset B_1$ are finite by
Algebra, Lemma
\ref{algebra-lemma-Noetherian-normal-domain-finite-separable-extension}.
\item If $A$ is Nagata, then $A \subset A_1$ is finite.
\item If $B$ is Nagata, then $B \subset B_1$ is finite.
\end{enumerate}
\end{remark}

\begin{lemma}
\label{lemma-pull-root-uniformizer}
Let $A$ be a discrete valuation ring with uniformizer $\pi$.
Let $n \geq 2$. Then $K_1 = K[\pi^{1/n}]$ is a degree $n$ extension of $K$
and the integral closure $A_1$ of $A$ in $K_1$ is the ring $A[\pi^{1/n}]$
which is a discrete valuation ring with ramification index $n$ over $A$.
\end{lemma}

\begin{proof}
This lemma proves itself.
\end{proof}

\begin{lemma}
\label{lemma-formally-smooth-goes-up}
Let $A \to B$ be an extension of discrete valuation rings with fraction fields
$K \subset L$. Assume that $A \to B$ is formally smooth in the
$\mathfrak m_B$-adic topology. Then for any finite extension $K_1/K$
we have $L_1 = L \otimes_K K_1$, $B_1 = B \otimes_A A_1$, and each extension
$(A_1)_{\mathfrak m_i} \subset (B_1)_{\mathfrak m_{ij}}$ (see
Remark \ref{remark-construction}) is formally smooth in the
$\mathfrak m_{ij}$-adic topology.
\end{lemma}

\begin{proof}
We will use the equivalence of Lemma \ref{lemma-extension-dvrs-formally-smooth}
without further mention. Let $\pi \in A$ and $\pi_i \in (A_1)_{\mathfrak m_i}$
be uniformizers. As $\kappa_A \subset \kappa_B$ is separable, the ring
$$
(B \otimes_A (A_1)_{\mathfrak m_i})/\pi_i (B \otimes_A (A_1)_{\mathfrak m_i}) =
B/\pi B \otimes_{A/\pi A} (A_1)_{\mathfrak m_i}/\pi_i (A_1)_{\mathfrak m_i}
$$
is a product of fields each separable over $\kappa_{\mathfrak m_i}$.
Hence the element $\pi_i$ in $B \otimes_A (A_1)_{\mathfrak m_i}$
is a nonzerodivisor and the quotient by this element is a product of fields.
It follows that $B \otimes_A A_1$ is a Dedekind domain in particular
reduced. Thus $B \otimes_A A_1 \subset B_1$ is an equality.
\end{proof}

\noindent
The following lemma is our version of Abhyankar's lemma for
discrete valuation rings. Observe that $\kappa_B/\kappa_A$ is not assumed
to be an algebraic extension of fields.

\begin{lemma}[Abhyankar's lemma]
\label{lemma-abhyankar}
Let $A \subset B$ be an extension of discrete valuation rings.
Assume that either the residue characteristic of $A$ is $0$
or it is $p$, the ramification index $e$ is prime to $p$, and
$\kappa_B/\kappa_A$ is a separable field extension.
Let $K_1/K$ be a finite extension. Using the notation of
Remark \ref{remark-construction}
assume $e$ divides the ramification index of $A \subset (A_1)_{\mathfrak m_i}$
for some $i$. Then $(A_1)_{\mathfrak m_i} \subset (B_1)_{\mathfrak m_{ij}}$
is formally smooth in the $\mathfrak m_{ij}$-adic topology
for all $j = 1, \ldots, m_i$.
\end{lemma}

\begin{proof}
Let $\pi \in A$ be a uniformizer. Let $\pi_1$ be a uniformizer
of $(A_1)_{\mathfrak m_i}$. Write $\pi = u \pi_1^{e_1}$ with $u$ a unit
of $(A_1)_{\mathfrak m_i}$ and $e_1$ the ramification index of
$A \subset (A_1)_{\mathfrak m_i}$.

\medskip\noindent
Claim: we may assume that $u$ is an $e$th power in $K_1$.
Namely, let $K_2$ be an extension of $K_1$ obtained by
adjoining a root of $x^e = u$; thus $K_2$ is a factor
of $K_1[x]/(x^e - u)$. Then $K_2/K_1$ is a finite
separable extension (by our assumption on $e$)
and hence $A_1 \subset A_2$ is finite.
Since $(A_1)_{\mathfrak m_i} \to (A_1)_{\mathfrak m_i}[x]/(x^e - u)$
is finite \'etale
(as $e$ is prime to the residue characteristic and $u$ a unit)
we conclude that $(A_2)_{\mathfrak m_i}$ is a factor of
a finite \'etale extension of $(A_1)_{\mathfrak m_i}$ hence
finite \'etale over $(A_1)_{\mathfrak m_i}$ itself.
The same reasoning shows that $B_1 \subset B_2$ induces
finite \'etale extensions
$(B_1)_{\mathfrak m_{ij}} \subset (B_2)_{\mathfrak m_{ij}}$.
Pick a maximal ideal $\mathfrak m'_{ij} \subset B_2$
lying over $\mathfrak m_{ij} \subset B_1$
(of course there may be more than one) and consider
$$
\xymatrix{
(B_1)_{\mathfrak m_{ij}} \ar[r] & (B_2)_{\mathfrak m'_{ij}} \\
(A_1)_{\mathfrak m_i} \ar[u] \ar[r] &
(A_2)_{\mathfrak m'_i} \ar[u]
}
$$
where $\mathfrak m'_i \subset A_2$ is the image.
Now the horizontal arrows have ramification index $1$
and induce finite separable residue field extensions.
Thus, using the equivalence of
Lemma \ref{lemma-extension-dvrs-formally-smooth},
we see that it suffices to show that the right vertical
arrow is formally smooth in the $\mathfrak m'_{ij}$-adic topology.
Since $u$ has a $e$th root
in $K_2$ we obtain the claim.

\medskip\noindent
Assume $u$ has an $e$th root in $K_1$.
Since $e | e_1$ and since $u$ has a $e$th root in $K_1$
we see that $\pi = \theta^e$ for some $\theta \in K_1$.
Let $K'_1 = K[\theta] \subset K_1$ be the subfield generated by $\theta$.
By Lemma \ref{lemma-pull-root-uniformizer} the integral closure $A'_1$
of $A$ in $K[\theta]$ is the discrete valuation ring $A'_1 = A[\theta]$
which has ramification index $e$ over $A$.
If we can prove the lemma for the extension $K'_1/K$,
then we conclude by Lemma \ref{lemma-formally-smooth-goes-up}
applied to the diagram
$$
\xymatrix{
(B'_1)_{B'_1 \cap \mathfrak m_{ij}} \ar[r] & (B_1)_{\mathfrak m_{ij}} \\
A'_1 \ar[u] \ar[r] &
(A_1)_{\mathfrak m_i} \ar[u]
}
$$
for all $j = 1, \ldots, m_i$. This reduces us to the case discussed
in the next paragraph.

\medskip\noindent
Assume $K_1 = K[\pi^{1/e}]$ and set $\theta = \pi^{1/e}$. Let $\pi_B$ be a
uniformizer for $B$ and write $\pi = w \pi_B^e$ for some unit $w$ of $B$.
Then we see that $L_1 = L \otimes_K K_1$ is obtained by adjoining
$\theta / \pi_B$ which is an $e$th root of the unit $w$. Thus
$B \subset B_1$ is finite \'etale. Thus for any maximal ideal
$\mathfrak m \subset B_1$ consider the commutative diagram
$$
\xymatrix{
B \ar[r]_1 & (B_1)_{\mathfrak m} \\
A \ar[u]^e \ar[r]^e & A_1 \ar[u]_{e_\mathfrak m}
}
$$
Here the numbers along the arrows are the ramification indices.
By multiplicativity of ramification indices
(Lemma \ref{lemma-multiplicative-e-f})
we conclude $e_\mathfrak m = 1$. Looking at the residue field extensions
we find that $\kappa(\mathfrak m)$ is a finite separable extension
of $\kappa_B$ which is separable over $\kappa_A$. Therefore
$\kappa(\mathfrak m)$ is separable over $\kappa_A$
which is equal to the residue field of $A_1$ and we win by
Lemma \ref{lemma-extension-dvrs-formally-smooth}.
\end{proof}

\begin{lemma}
\label{lemma-composition-tame}
Let $A$ be a discrete valuation ring with fraction field $K$.
Let $M/L/K$ be finite separable extensions.
Let $B$ be the integral closure of $A$ in $L$.
If $L/K$ is tamely ramified with respect to $A$
and $M/L$ is tamely ramified with respect to $B_\mathfrak m$
for every maximal ideal $\mathfrak m$ of $B$, then
$M/K$ is tamely ramified with respect to $A$.
\end{lemma}

\begin{proof}
Let $C$ be the integral closure of $A$ in $M$.
Every maximal ideal $\mathfrak m'$ of $C$ lies over
a maximal ideal $\mathfrak m$ of $B$.
Then the lemma follows from the multiplicativity
of ramification indices (Lemma \ref{lemma-multiplicative-e-f})
and the fact that we have the tower
$\kappa(\mathfrak m')/\kappa(\mathfrak m)/\kappa_A$
of finite extensions of fields.
\end{proof}

\begin{lemma}
\label{lemma-subextension-tame}
Let $A$ be a discrete valuation ring with fraction field $K$.
If $M/L/K$ are finite separable extensions and
$M$ is tamely ramified with respect to $A$, then
$L$ is tamely ramified with respect to $A$.
\end{lemma}

\begin{proof}
We will use the results of the discussion in
Remark \ref{remark-finite-separable-extension}
without further mention.
Let $C/B/A$ be the integral closures of $A$ in $M/L/K$.
Since $C$ is a finite ring extension of $B$, we see that
$\Spec(C) \to \Spec(B)$ is surjective. Hence for ever maximal
ideal $\mathfrak m \subset B$ there is a maximal ideal
$\mathfrak m' \subset C$ lying over $\mathfrak m$.
By the multiplicativity of ramification indices
(Lemma \ref{lemma-multiplicative-e-f})
and the assumption, we conclude that the ramification
index of $B_\mathfrak m$ over $A$ is prime to the residue characteristic.
Since $\kappa(\mathfrak m')/\kappa_A$ is finite separable,
the same is true for $\kappa(\mathfrak m)/\kappa_A$.
\end{proof}

\begin{lemma}
\label{lemma-characterize-tame}
Let $A$ be a discrete valuation ring with fraction field $K$.
Let $\pi \in A$ be a uniformizer.
Let $L/K$ be a finite separable extension.
The following are equivalent
\begin{enumerate}
\item $L$ is tamely ramified with respect to $A$,
\item there exists an $e \geq 1$ invertible in $\kappa_A$
and an extension $L'/K' = K[\pi^{1/e}]$ unramified with respect to
$A' = A[\pi^{1/e}]$ such that $L$ is contained in $L'$, and
\item there exists an $e_0 \geq 1$ invertible in $\kappa_A$
such that for every $d \geq 1$ invertible in $\kappa_A$
(2) holds with $e = de_0$.
\end{enumerate}
\end{lemma}

\begin{proof}
Observe that $A'$ is a discrete valuation ring with fraction
field $K'$, see Lemma \ref{lemma-pull-root-uniformizer}.
Of course the ramification index of $A'$ over $A$ is $e$.
Thus if (2) holds, then $L'$ is tamely ramified with respect to $A$
by Lemma \ref{lemma-composition-tame}. Hence $L$ is tamely
ramified with respect to $A$ by Lemma \ref{lemma-subextension-tame}.

\medskip\noindent
The implication (3) $\Rightarrow$ (2) is immediate.

\medskip\noindent
Assume that (1) holds. Let $B$ be the integral closure of $A$ in $L$
and let $\mathfrak m_1, \ldots, \mathfrak m_n$ be its maximal ideals.
Denote $e_i$ the ramification index of $A \to B_{\mathfrak m_i}$.
Let $e_0$ be the least common multiple of $e_1, \ldots, e_r$.
This is invertible in $\kappa_A$ by our assumption (1).
Let $e = de_0$ as in (3). Set $A' = A[\pi^{1/e}]$.
Then $A \to A'$ is an extension of discrete valuation rings
with fraction field $K' = K[\pi^{1/e}]$, see
Lemma \ref{lemma-pull-root-uniformizer}.
Choose a product decomposition
$$
L \otimes_K K' = \prod L'_j
$$
where $L'_j$ are fields. Let $B'_j$ be the integral closure
of $A$ in $L'_j$. Let $\mathfrak m_{ijk}$ be the maximal
ideals of $B'_j$ lying over $\mathfrak m_i$.
Observe that $(B'_j)_{\mathfrak m_i}$ is the integral
closure of $B_{\mathfrak m_i}$ in $L'_j$.
By Abhyankar's lemma (Lemma \ref{lemma-abhyankar})
applied to $A \subset B_{\mathfrak m_i}$ and the extension $K'/K$
we see that $A' \to (B'_j)_{\mathfrak m_{ijk}}$
is formally smooth in the $\mathfrak m_{ijk}$-adic topology.
This implies that the ramification index is $1$ and
that the residue field extension is separable
(Lemma \ref{lemma-extension-dvrs-formally-smooth}).
In this way we see that $L'_j$ is unramified with respect to $A'$.
This finishes the proof: we take $L' = L'_j$ for some $j$.
\end{proof}

\begin{lemma}
\label{lemma-permanence-tame}
Let $A$ be a discrete valuation ring with fraction field $K$.
\begin{enumerate}
\item If $L/K$ is a finite separable extension which is tamely
ramified with respect to $A$, then there exists a Galois
extension $M/K$ containing $L$ which is tamely ramified
with respect to $A$.
\item If $L_1/K$, $L_2/K$ are finite separable extensions which are tamely
ramified with respect to $A$, then there exists a a finite
separable extension $L/K$ which is tamely ramified with respect
to $A$ containing $L_1$ and $L_2$.
\end{enumerate}
\end{lemma}

\begin{proof}
Proof of (2). Choose a uniformizer $\pi \in A$.
We can choose an integer $e$ invertible
in $\kappa_A$ and extensions $L_i'/K' = K[\pi^{1/e}]$
unramified with respect to $A' = A[\pi^{1/e}]$
with $L'_i/L_i$ as extensions of $K$, see
Lemma \ref{lemma-characterize-tame}.
By Lemma \ref{lemma-permanence-unramified}
we can find an extension $L'/K'$ which is unramified
with respect to $A'$ such that $L'_i/K$ is isomorphic
to a subextension of $L'/K'$ for $i = 1, 2$.
This finishes the proof of (3) as $L'/K$ is tamely ramified
(use same lemma as above).

\medskip\noindent
Proof of (1). We may first replace $L$ by a larger extension
and assume that $L$ is an extension of $K' = K[\pi^{1/e}]$
unramified with respect to $A' = A[\pi^{1/e}]$ where $e$ is
invertible in $\kappa_A$, see Lemma \ref{lemma-characterize-tame}.
Let $M$ be the normal closure of $L$ over $K$, see
Fields, Definition \ref{fields-definition-normal-closure}.
Then $M/K$ is Galois by Fields, Lemma \ref{fields-lemma-normal-closure-galois}.
On the other hand, there is a surjection
$$
L \otimes_K \ldots \otimes_K L \longrightarrow M
$$
of $K$-algebras, see Fields, Lemma
\ref{fields-lemma-normal-closure-tensor-product}.
Let $B$ be the integral closure of $A$ in $L$
as in Remark \ref{remark-finite-separable-extension}. The
condition that $L$ is unramified with respect to $A' = A[\pi^{1/e}]$
exactly means that $A' \to B$ is an \'etale ring map, see
Algebra, Lemma \ref{algebra-lemma-characterize-etale}.
Claim: 
$$
K' \otimes_K \ldots \otimes_K K' = \prod K'_i
$$
is a product of field extensions $K'_i/K$ tamely
ramified with respect to $A$. Then if $A'_i$ is the integral
closure of $A$ in $K'_i$ we see that
$$
\prod A'_i \otimes_{(A' \otimes_A \ldots \otimes_A A')}
(B \otimes_A \ldots \otimes_A B)
$$
is finite \'etale over $\prod A'_i$ and hence a product of
Dedekind domains (Lemma \ref{lemma-Dedekind-etale-extension}).
We conclude that $M$ is the fraction field
of one of these Dedekind domains which is finite \'etale
over $A'_i$ for some $i$. It follows that $M/K'_i$
is unramified with respect to every maximal ideal of $A'_i$
and hence $M/K$ is tamely ramified by Lemma \ref{lemma-composition-tame}.

\medskip\noindent
It remains the prove the claim. For this we write
$A' = A[x]/(x^e - \pi)$ and we see that
$$
A' \otimes_A \ldots \otimes_A A' =
A'[x_1, \ldots, x_r]/(x_1^e - \pi, \ldots, x_r^e - \pi)
$$
The normalization of this ring certainly contains the
elements $y_i = x_i/x_1$ for $i = 2, \ldots, r$ subject
to the relations $y_i^e - 1 = 0$ and
we obtain
$$
A[x_1, y_2, \ldots, y_r]/(x_1^e - \pi, y_2^e - 1, \ldots, y_r - 1) =
A'[y_2, \ldots, y_r]/(y_2^e - 1, \ldots, y_r^e - 1)
$$
This ring is finite \'etale over $A'$ because $e$ is invertible in $A'$.
Hence it is a product of Dedekind domains each unramified over $A'$
as desired (see references given above in case of confusion).
\end{proof}

\begin{lemma}
\label{lemma-tame-goes-up}
Let $A \subset B$ be an extension of discrete valuation rings.
Denote $L/K$ the corresponding extension of fraction fields.
Let $K'/K$ be a finite separable extension.
Then
$$
K' \otimes_K L = \prod L'_i
$$
is a finite product of fields and the following is true
\begin{enumerate}
\item If $K'$ is unramified with respect to $A$, then
each $L'_i$ is unramified with respect to $B$.
\item If $K'$ is tamely ramified with respect to $A$, then
each $L'_i$ is tamely ramified with respect to $B$.
\end{enumerate}
\end{lemma}

\begin{proof}
The algebra $K' \otimes_K L$ is a finite product of fields as it is
a finite \'etale algebra over $L$.
Let $A'$ be the integral closure of $A$ in $K'$.

\medskip\noindent
In case (1) the ring map $A \to A'$ is finite \'etale.
Hence $B' = B \otimes_A A'$ is finite \'etale over $B$ and
is a finite product of Dedekind domains
(Lemma \ref{lemma-Dedekind-etale-extension}).
Hence $B'$ is the integral closure of $B$ in $K' \otimes_K L$.
It follows immediately that each $L'_i$ is unramified
with respect to $B$.

\medskip\noindent
Choose a uniformizer $\pi \in A$. To prove (2) we may replace $K'$
by a larger extension tame ramified with respect to $A$ (details omitted;
hint: use Lemma \ref{lemma-subextension-tame}).
Thus by Lemma \ref{lemma-characterize-tame} we may assume
there exists some $e \geq 1$ invertible in $\kappa_A$ such that
$K'$ contains $K[\pi^{1/e}]$ and such that $K'$ is unramified with respect
to $A[\pi^{1/e}]$. Choose a product decomposition
$$
K[\pi^{1/e}] \otimes_K L = \prod L_{e, j}
$$
For every $i$ there exists a $j_i$ such that
$L'_i/L_{e, j_i}$ is a finite separable extension.
Let $B_{e, j}$ be the integral closure of $B$ in $L_{e, j}$.
By (1) applied to $K'/K[\pi^{1/e}]$ and
$A[\pi^{1/e}] \subset (B_{e, j_i})_\mathfrak m$
we see that $L'_i$ is unramified with respect to $(B_{e, j_i})_\mathfrak m$
for every maximal ideal $\mathfrak m \subset B_{e, j_i}$.
Hence the proof will be complete if we can show that
$L_{e, j}$ is tamely ramified with respect to $B$, see
Lemma \ref{lemma-composition-tame}.

\medskip\noindent
Choose a uniformizer $\theta$ in $B$.
Write $\pi = u \theta^t$ where $u$ is a unit of $B$ and $t \geq 1$.
Then we have
$$
A[\pi^{1/e}] \otimes_A B = B[x]/(x^e - u \theta^t)
\subset B[y, z]/(y^{e'} - \theta, z^e - u)
$$
where $e' = e/\gcd(e, t)$. The map sends $x$ to
$z y^{t/\gcd(e, t)}$. Since the right hand side is
a product of Dedekind domains each tamely ramified
over $B$ the proof is complete (details omitted).
\end{proof}












\section{Eliminating ramification}
\label{section-eliminating-ramification}

\noindent
In this section we discuss a result of Helmut Epp, see \cite{Epp}. We strongly
encourage the reader to read the original. Our approach is slightly different
as we try to handle the mixed and equicharacteristic cases by the same method.
For related results, see also
\cite{Ponomarev}, \cite{Ponomarev-Abhyankar}, \cite{Kuhlmann}, and \cite{ZK}.

\medskip\noindent
Let $A \subset B$ be an extension of discrete valuation rings with
fraction fields $K \subset L$.
The goal in this section is to find a finite extension $K_1/K$
such that with
$$
\vcenter{
\xymatrix{
L \ar[r] & L_1 \\
K \ar[u] \ar[r] & K_1 \ar[u]
}
}
\quad\text{and}\quad
\vcenter{
\xymatrix{
B \ar[r] & B_1 \ar[r] & (B_1)_{\mathfrak m_{ij}} \\
A \ar[u] \ar[r] & A_1 \ar[r] \ar[u] & (A_1)_{\mathfrak m_i} \ar[u]
}
}
$$
as in Remark \ref{remark-construction} the extensions
$(A_1)_{\mathfrak m_i} \subset (B_1)_{\mathfrak m_{ij}}$
are all weakly unramified or even formally smooth in the relevant
adic topologies. The simplest (but nontrivial) example of this is
Abhyankar's lemma, see Lemma \ref{lemma-abhyankar}.

\begin{definition}
\label{definition-solution}
Let $A \to B$ be an extension of discrete valuation rings with fraction
fields $K \subset L$.
\begin{enumerate}
\item We say a finite field extension $K_1/K$ is a
{\it weak solution for $A \subset B$} if all the extensions
$(A_1)_{\mathfrak m_i} \subset (B_1)_{\mathfrak m_{ij}}$ of
Remark \ref{remark-construction} are weakly unramified.
\item We say a finite field extension $K_1/K$ is a
{\it solution for $A \subset B$} if each extension
$(A_1)_{\mathfrak m_i} \subset (B_1)_{\mathfrak m_{ij}}$ of
Remark \ref{remark-construction} is formally smooth in
the $\mathfrak m_{ij}$-adic topology.
\end{enumerate}
We say a solution $K_1/K$ is a {\it separable solution}
if $K_1/K$ is separable.
\end{definition}

\noindent
In general (weak) solutions do not exist; there is an example in \cite{Epp}.
Under a mild hypothesis on the residue field extension, we will prove the
existence of weak solutions in Theorem \ref{theorem-epp} following \cite{Epp}.
In the next section, we will deduce the existence of solutions
and sometimes separable solutions in geometrically meaningful cases,
see Proposition \ref{proposition-epp-essentially-finite-type} and
Lemma \ref{lemma-epp-essentially-finite-type-separable}.
However, the following example shows that
in general one needs inseparable extensions to get even a weak solution.

\begin{example}
\label{example-inseparable-necessary}
Let $k$ be a perfect field of characteristic $p > 0$. Let $A = k[[x]]$
and $K = k((x))$. Let $B = A[x^{1/p}]$. Any weak solution $K_1/K$
for $A \to B$ is inseparable (and any finite inseparable extension of
$K$ is a solution). We omit the proof.
\end{example}

\noindent
Solutions are stable under further extensions, see
Lemma \ref{lemma-solution-goes-up}.
This may not be true for weak solutions.
Weak solutions are in some sense stable under totally ramified extensions, see
Lemma \ref{lemma-weakly-unramified-goes-up-along-totally-ramified}.

\begin{lemma}
\label{lemma-weakly-unramified-goes-up-along-totally-ramified}
Let $A \to B$ be an extension of discrete valuation rings with fraction
fields $K \subset L$. Assume that $A \to B$ is weakly unramified. Then for
any finite separable extension $K_1/K$ totally ramified with respect to $A$
we have that $L_1 = L \otimes_K K_1$ is a field, $A_1$ and
$B_1 = B \otimes_A A_1$ are discrete valuation rings, and the extension
$A_1 \subset B_1$ (see
Remark \ref{remark-construction}) is weakly unramified.
\end{lemma}

\begin{proof}
Let $\pi \in A$ and $\pi_1 \in A_1$ be uniformizers. As $K_1/K$
is totally ramified with respect to $A$
we have $\pi_1^e = u_1 \pi$ for some unit $u_1$ in $A_1$.
Hence $A_1$ is generated by $\pi_1$ over $A$ and the minimal polynomial
$P(t)$ of $\pi_1$ over $K$ has the form
$$
P(t) = t^e + a_{e - 1} t^{e - 1} + \ldots + a_0
$$
with $a_i \in (\pi)$ and $a_0 = u\pi$ for some unit $u$ of $A$.
Note that $e = [K_1 : K]$ as well. Since $A \to B$ is weakly
unramified we see that $\pi$ is a uniformizer of $B$ and hence
$B_1 = B[t]/(P(t))$ is a discrete valuation ring with uniformizer
the class of $t$. Thus the lemma is clear.
\end{proof}

\begin{lemma}
\label{lemma-solutions-go-down}
Let $A \to B \to C$ be extensions of discrete valuation rings with fraction
fields $K \subset L \subset M$. Let $K_1/K$ be a finite extension.
\begin{enumerate}
\item If $K_1$ is a (weak) solution for $A \to C$, then $K_1$ is a (weak)
solution for $A \to B$.
\item If $K_1$ is a (weak) solution for $A \to B$ and
$L_1 = (L \otimes_K K_1)_{red}$ is a product of fields which are
(weak) solutions for $B \to C$, then $K_1$ is a (weak) solution for $A \to C$.
\end{enumerate}
\end{lemma}

\begin{proof}
Let $L_1 = (L \otimes_K K_1)_{red}$ and $M_1 = (M \otimes_K K_1)_{red}$
and let $B_1 \subset L_1$ and $C_1 \subset M_1$ be the integral closure
of $B$ and $C$. Note that $M_1 = (M \otimes_L L_1)_{red}$ and that $L_1$
is a (nonempty) finite product of finite extensions of $L$. Hence the
ring map $B_1 \to C_1$ is a finite product of ring maps of the form discussed
in Remark \ref{remark-construction}. In particular, the map
$\Spec(C_1) \to \Spec(B_1)$ is surjective. Choose a maximal ideal
$\mathfrak m \subset C_1$ and consider the extensions of discrete
valuation rings
$$
(A_1)_{A_1 \cap \mathfrak m} \to
(B_1)_{B_1 \cap \mathfrak m} \to
(C_1)_\mathfrak m
$$
If the composition is weakly unramified, so is the map
$(A_1)_{A_1 \cap \mathfrak m} \to (B_1)_{B_1 \cap \mathfrak m}$.
If the residue field extension
$\kappa_{A_1 \cap \mathfrak m} \to \kappa_\mathfrak m$ is separable,
so is the subextension
$\kappa_{A_1 \cap \mathfrak m} \to \kappa_{B_1 \cap \mathfrak m}$.
Taking into account Lemma \ref{lemma-extension-dvrs-formally-smooth}
this proves (1). A similar argument works for (2).
\end{proof}

\begin{lemma}
\label{lemma-solution-after-strict-henselization}
Let $A \to B$ be an extension of discrete valuation rings. There exists
a commutative diagram
$$
\xymatrix{
B \ar[r] & B' \\
A \ar[r] \ar[u] & A' \ar[u]
}
$$
of extensions of discrete valuation rings such that
\begin{enumerate}
\item the extensions $K'/K$ and $L'/L$ of fraction fields
are separable algebraic,
\item the residue fields of $A'$ and $B'$ are separable algebraic
closures of the residue fields of $A$ and $B$, and
\item if a solution, weak solution, or separable solution exists for
$A' \to B'$, then a solution, weak solution, or separable solution exists
for $A \to B$.
\end{enumerate}
\end{lemma}

\begin{proof}
By Algebra, Lemma \ref{algebra-lemma-colimit-finite-etale-given-residue-field}
there exists an extension $A \subset A'$ which is a filtered colimit of finite
\'etale extensions such that the residue field of $A'$ is a separable algebraic
closure of the residue field of $A$. Then $A \subset A'$ is an extension of
discrete valuation rings such that the induced extension $K'/K$ of
fraction fields is separable algebraic.

\medskip\noindent
Let $B \subset B'$ be a strict henselization of $B$. Then $B \subset B'$ is an
extension of discrete valuation rings whose fraction field extension is
separable algebraic. By
Algebra, Lemma \ref{algebra-lemma-strictly-henselian-functorial-prepare}
there exists a commutative diagram as in the statement of the lemma.
Parts (1) and (2) of the lemma are clear.

\medskip\noindent
Let $K'_1/K'$ be a (weak) solution for $A' \to B'$. Since $A'$ is a
colimit, we can find a finite \'etale extension $A \subset A_1'$ and a finite
extension $K_1$ of the fraction field $F$ of $A_1'$ such that
$K'_1 = K' \otimes_F K_1$. As $A \subset A_1'$ is finite \'etale
and $B'$ strictly henselian, it follows that $B' \otimes_A A_1'$ is a finite
product of rings isomorphic to $B'$. Hence
$$
L' \otimes_K K_1 = L' \otimes_K F \otimes_F K_1
$$
is a finite product of rings isomorphic to $L' \otimes_{K'} K'_1$.
Thus we see that $K_1/K$ is a (weak) solution for $A \to B'$.
Hence it is also a (weak) solution for $A \to B$ by
Lemma \ref{lemma-solutions-go-down}.
\end{proof}

\begin{lemma}
\label{lemma-galois-relative}
Let $A \to B$ be an extension of discrete valuation rings with fraction fields
$K \subset L$. Let $K_1/K$ be a normal extension. Say
$G = \text{Aut}(K_1/K)$. Then $G$ acts on the rings $K_1$, $L_1$,
$A_1$ and $B_1$ of Remark \ref{remark-construction}
and acts transitively on the set of maximal ideals of $B_1$.
\end{lemma}

\begin{proof}
Everything is clear apart from the last assertion. If there are two or
more orbits of the action, then we can find an element $b \in B_1$
which vanishes at all the maximal ideals of one orbit and has residue
$1$ at all the maximal ideals in another orbit. Then
$b' = \prod_{\sigma \in G} \sigma(b)$ is a $G$-invariant element of
$B_1 \subset L_1 = (L \otimes_K K_1)_{red}$ which is in some maximal
ideals of $B_1$
but not in all maximal ideals of $B_1$. Lifting it to an element of
$L \otimes_K K_1$ and raising to a high power we obtain a $G$-invariant
element $b''$ of $L \otimes_K K_1$ mapping to $(b')^N$ for some $N > 0$;
in fact, we only need to do this in case the characteristic is $p > 0$ and
in this case raising to a suitably large $p$-power $q$ defines a
canonical map $(L \otimes_K K_1)_{red} \to L \otimes_K K_1$.
Since $K = (K_1)^G$ we conclude that $b'' \in L$. Since $b''$ maps
to an element of $B_1$ we see that $b'' \in B$ (as $B$ is normal).
Then on the one hand it must be true that $b'' \in \mathfrak m_B$
as $b'$ is in some maximal ideal of $B_1$ and on the other hand it
must be true that $b'' \not \in \mathfrak m_B$ as $b'$ is not in
all maximal ideals of $B_1$. This contradiction finishes the proof of the
lemma.
\end{proof}

\begin{lemma}
\label{lemma-make-degree-q-extension}
Let $A$ be a discrete valuation ring with uniformizer $\pi$. If the residue
characteristic of $A$ is $p > 0$, then for every $n > 1$ and $p$-power $q$
there exists a degree $q$ separable extension $L/K$
totally ramified with respect to $A$
such that the integral closure $B$ of $A$ in $L$ has ramification index
$q$ and a uniformizer $\pi_B$ such that
$\pi_B^q = \pi + \pi^n b$ and $\pi_B^q = \pi + (\pi_B)^{nq}b'$
for some $b, b' \in B$.
\end{lemma}

\begin{proof}
If the characteristic of $K$ is zero, then we can take the
extension given by $\pi_B^q = \pi$, see
Lemma \ref{lemma-pull-root-uniformizer}.
If the characteristic of $K$ is $p > 0$, then we can take the
extension of $K$ given by $z^q - \pi^n z = \pi^{1 - q}$.
Namely, then we see that $y^q - \pi^{n + q - 1} y = \pi$
where $y = \pi z$. Taking $\pi_B = y$ we obtain the desired result.
\end{proof}

\begin{lemma}
\label{lemma-pre-purely-inseparable-case}
Let $A$ be a discrete valuation ring. Assume the reside field $\kappa_A$ has
characteristic $p > 0$ and that $a \in A$ is an element whose residue
class in $\kappa_A$ is not a $p$th power. Then $a$ is not a $p$th power in $K$
and the integral closure of $A$ in $K[a^{1/p}]$ is the ring $A[a^{1/p}]$
which is a discrete valuation ring weakly unramified over $A$.
\end{lemma}

\begin{proof}
This lemma proves itself.
\end{proof}

\begin{lemma}
\label{lemma-purely-inseparable-case}
Let $A \subset B \subset C$ be extensions of discrete valuation rings
with fractions fields $K \subset L \subset M$. Let $\pi \in A$ be a
uniformizer. Assume
\begin{enumerate}
\item $B$ is a Nagata ring,
\item $A \subset B$ is weakly unramified,
\item $M$ is a degree $p$ purely inseparable extension of $L$.
\end{enumerate}
Then either
\begin{enumerate}
\item $A \to C$ is weakly unramified, or
\item $C = B[\pi^{1/p}]$, or
\item there exists a degree $p$ separable extension $K_1/K$
totally ramified with respect to $A$
such that $L_1 = L \otimes_K K_1$ and $M_1 = M \otimes_K K_1$
are fields and the maps of integral closures $A_1 \to B_1 \to C_1$
are weakly unramified extensions of discrete valuation rings.
\end{enumerate}
\end{lemma}

\begin{proof}
Let $e$ be the ramification index of $C$ over $B$. If $e = 1$, then we are
done. If not, then $e = p$ by Lemmas \ref{lemma-inequality} and
\ref{lemma-ramification-index-a-power-of-p}.
This in turn implies that the residue fields of $B$ and $C$ agree.
Choose a uniformizer $\pi_C$ of $C$.
Write $\pi_C^p = u \pi$ for some unit $u$ of $C$.
Since $\pi_C^p \in L$, we see that $u \in B^*$. Also $M = L[\pi_C]$.

\medskip\noindent
Suppose there exists an integer $m \geq 0$ such that
$$
u = \sum\nolimits_{0 \leq i < m} b_i^p \pi^i + b \pi^m
$$
with $b_i \in B$ and with $b \in B$ an element whose image in $\kappa_B$
is not a $p$th power. Choose an extension $K_1/K$ as in
Lemma \ref{lemma-make-degree-q-extension}
with $n = m + 2$ and denote $\pi'$ the uniformizer
of the integral closure $A_1$ of $A$ in $K_1$ such that
$\pi = (\pi')^p + (\pi')^{np} a$ for some $a \in A_1$.
Let $B_1$ be the integral closure of $B$ in $L \otimes_K K_1$.
Observe that $A_1 \to B_1$ is weakly unramified by
Lemma \ref{lemma-weakly-unramified-goes-up-along-totally-ramified}.
In $B_1$ we have
$$
u \pi =
\left(\sum\nolimits_{0 \leq i < m} b_i (\pi')^{i + 1}\right)^p +
b (\pi')^{(m + 1)p} + (\pi')^{np} b_1
$$
for some $b_1 \in B_1$ (computation omitted).
We conclude that $M_1$ is obtained from
$L_1$ by adjoining a $p$th root of
$$
b + (\pi')^{n - m - 1} b_1
$$
Since the residue field of $B_1$ equals the residue field of $B$
we see from Lemma \ref{lemma-pre-purely-inseparable-case}
that $M_1/L_1$ has degree $p$ and
the integral closure $C_1$ of $B_1$ is weakly unramified over $B_1$.
Thus we conclude in this case.

\medskip\noindent
If there does not exist an integer $m$ as in the preceding paragraph,
then $u$ is a $p$th power in the $\pi$-adic completion of $B_1$.
Since $B$ is Nagata, this means that $u$ is a $p$th power in $B_1$
by Algebra, Lemma \ref{algebra-lemma-nagata-pth-roots}.
Whence the second case of the statement of the lemma holds.
\end{proof}

\begin{lemma}
\label{lemma-cohen}
Let $A$ be a local ring annihilated by a prime $p$ whose maximal ideal is
nilpotent. There exists a ring map $\sigma : \kappa_A \to A$
which is a section to the residue map $A \to \kappa_A$. If $A \to A'$ is
a local homomorphism of local rings, then we can choose a similar
ring map $\sigma' : \kappa_{A'} \to A'$ compatible with $\sigma$ provided
that the extension $\kappa_{A'}/\kappa_A$ is separable.
\end{lemma}

\begin{proof}
Separable extensions are formally smooth by Algebra, Proposition
\ref{algebra-proposition-characterize-separable-field-extensions}.
Thus the existence of $\sigma$ follows from the fact that
$\mathbf{F}_p \to \kappa_A$ is separable.
Similarly for the existence of $\sigma'$ compatible with $\sigma$.
\end{proof}

\begin{lemma}
\label{lemma-pre-characteristic-p-case}
Let $A$ be a discrete valuation ring with fraction field $K$ of characteristic
$p > 0$. Let $\xi \in K$. Let $L$ be an extension of $K$ obtained by
adjoining a root of $z^p - z = \xi$. Then $L/K$ is Galois and one of the
following happens
\begin{enumerate}
\item $L = K$,
\item $L/K$ is unramified with respect to $A$ of degree $p$,
\item $L/K$ is totally ramified with respect to $A$
with ramification index $p$, and
\item the integral closure $B$ of $A$ in $L$ is a discrete valuation ring,
$A \subset B$ is weakly unramified, and $A \to B$ induces a purely inseparable
residue field extension of degree $p$.
\end{enumerate}
Let $\pi$ be a uniformizer of $A$. We have the following implications:
\begin{enumerate}
\item[(A)] If $\xi \in A$, then we are in case (1) or (2).
\item[(B)] If $\xi = \pi^{-n}a$ where $n > 0$ is not divisible by
$p$ and $a$ is a unit in $A$, then we are in case (3)
\item[(C)] If $\xi = \pi^{-n} a$ where $n > 0$ is divisible by $p$ and
the image of $a$ in $\kappa_A$ is not a $p$th power, then we are in case (4).
\end{enumerate}
\end{lemma}

\begin{proof}
The extension is Galois of order dividing $p$ by the discussion in
Fields, Section \ref{fields-section-Artin-Schreier}.
It immediately follows from the discussion in
Section \ref{section-ramification} that we are in one of the cases (1) -- (4)
listed in the lemma.

\medskip\noindent
Case (A). Here we see that $A \to A[x]/(x^p - x - \xi)$ is a finite
\'etale ring extension. Hence we are in cases (1) or (2).

\medskip\noindent
Case (B). Write $\xi = \pi^{-n}a$ where $p$ does not divide $n$.
Let $B \subset L$ be the integral closure of $A$ in $L$.
If $C = B_\mathfrak m$ for some maximal ideal $\mathfrak m$,
then it is clear that $p \text{ord}_C(z) = -n \text{ord}_C(\pi)$.
In particular $A \subset C$ has ramification index divisible by $p$.
It follows that it is $p$ and that $B = C$.

\medskip\noindent
Case (C). Set $k = n/p$. Then we can rewrite the equation as
$$
(\pi^kz)^p - \pi^{n - k} (\pi^kz) = a
$$
Since $A[y]/(y^p - \pi^{n - k}y - a)$ is a discrete valuation ring
weakly unramified over $A$, the lemma follows.
\end{proof}

\begin{lemma}
\label{lemma-characteristic-p-case}
Let $A \subset B \subset C$ be extensions of discrete valuation rings
with fractions fields $K \subset L \subset M$. Assume
\begin{enumerate}
\item $A \subset B$ weakly unramified,
\item the characteristic of $K$ is $p$,
\item $M$ is a degree $p$ Galois extension of $L$, and
\item $\kappa_A = \bigcap_{n \geq 1} \kappa_B^{p^n}$.
\end{enumerate}
Then there exists a finite Galois extension $K_1/K$
totally ramified with respect to $A$
which is a weak solution for $A \to C$.
\end{lemma}

\begin{proof}
Since the characteristic of $L$ is $p$ we know that $M$ is an Artin-Schreier
extension of $L$ (Fields, Lemma \ref{fields-lemma-Artin-Schreier}).
Thus we may pick $z \in M$, $z \not \in L$ such that
$\xi = z^p - z \in L$. Choose $n \geq 0$ such that $\pi^n\xi \in B$.
We pick $z$ such that $n$ is minimal. If $n = 0$, then $M/L$ is unramified
with respect to $B$ (Lemma \ref{lemma-pre-characteristic-p-case}) and
we are done. Thus we have $n > 0$.

\medskip\noindent
Assumption (4) implies that $\kappa_A$ is perfect. Thus we may
choose compatible ring maps $\overline{\sigma} : \kappa_A \to A/\pi^n A$ and
$\overline{\sigma} : \kappa_B \to B/\pi^n B$ as in
Lemma \ref{lemma-cohen}. We lift the second of these to a
map of sets $\sigma : \kappa_B \to B$\footnote{If $B$ is complete, then
we can choose $\sigma$ to be a ring map. If $A$ is also complete and
$\sigma$ is a ring map, then $\sigma$ maps $\kappa_A$ into $A$.}.
Then we can write
$$
\xi = \sum\nolimits_{i = n, \ldots, 1} \sigma(\lambda_i) \pi^{-i} + b
$$
for some $\lambda_i \in \kappa_B$ and $b \in B$. Let
$$
I = \{i \in \{n, \ldots, 1\} \mid \lambda_i \in \kappa_A\}
$$
and
$$
J = \{j \in \{n, \ldots, 1\} \mid \lambda_i \not \in \kappa_A\}
$$
We will argue by induction on the size of the finite set $J$.

\medskip\noindent
The case $J = \emptyset$. Here for all $i \in \{n, \ldots, 1\}$ we have
$\sigma(\lambda_i) = a_i + \pi^n b_i$ for some $a_i \in A$ and $b_i \in B$
by our choice of $\sigma$. Thus
$\xi = \pi^{-n} a + b$ for some $a \in A$ and $b \in B$.
If $p | n$, then we write $a = a_0^p + \pi a_1$ for some $a_0, a_1 \in A$
(as the residue field of $A$ is perfect). We compute
$$
(z - \pi^{-n/p}a_0)^p - (z - \pi^{-n/p}a_0) =
\pi^{-(n - 1)}(a_1 + \pi^{n - 1 - n/p}a_0) + b'
$$
for some $b' \in B$. This would contradict the minimality of $n$. Thus $p$
does not divide $n$. Consider the degree $p$ extension $K_1$ of $K$ given
by $w^p - w = \pi^{-n}a$. By Lemma \ref{lemma-pre-characteristic-p-case}
this extension is Galois and totally ramified with respect to $A$.
Thus $L_1 = L \otimes_K K_1$ is a field and $A_1 \subset B_1$
is weakly unramified
(Lemma \ref{lemma-weakly-unramified-goes-up-along-totally-ramified}).
By Lemma \ref{lemma-pre-characteristic-p-case}
the ring $M_1 = M \otimes_K K_1$ is either a product of $p$ copies
of $L_1$ (in which case we are done) or a field extension of $L_1$
of degree $p$. Moreover, in the second case, either $C_1$ is weakly unramified
over $B_1$ (in which case we are done) or $M_1/L_1$ is degree $p$,
Galois, and totally ramified with respect to $B_1$.
In this last case the extension $M_1/L_1$
is generated by the element $z - w$ and
$$
(z - w)^p - (z - w) = z^p - z - (w^p - w) = b
$$
with $b \in B$ (see above). Thus by Lemma \ref{lemma-pre-characteristic-p-case}
once more the extension $M_1/L_1$ is unramified with respect to $B_1$
and we conclude that $K_1$ is a weak solution for $A \to C$.
From now on we assume $J \not = \emptyset$.

\medskip\noindent
Suppose that $j', j \in J$ such that $j' = p^r j$ for some
$r > 0$. Then we change our choice of $z$ into
$$
z' = z -
(\sigma(\lambda_j) \pi^{-j} + \sigma(\lambda_j^p) \pi^{-pj} + \ldots +
\sigma(\lambda_j^{p^{r - 1}}) \pi^{-p^{r - 1}j})
$$
Then $\xi$ changes into $\xi' = (z')^p - (z')$ as follows
$$
\xi' =
\xi - \sigma(\lambda_j) \pi^{-j} + \sigma(\lambda_j^{p^r}) \pi^{-j'}
+ \text{something in }B
$$
Writing
$\xi' = \sum\nolimits_{i = n, \ldots, 1} \sigma(\lambda'_i) \pi^{-i} + b'$
as before we find that
$\lambda'_i = \lambda_i$ for $i \not = j, j'$ and $\lambda'_j = 0$.
Thus the set $J$ has gotten smaller.
By induction on the size of $J$ we may assume no such pair $j, j'$ exists.
(Please observe that in this procedure we may get thrown back into the case
that $J = \emptyset$ we treated above.)

\medskip\noindent
For $j \in J$ write $\lambda_j = \mu_j^{p^{r_j}}$ for some $r_j \geq 0$ and
$\mu_j \in \kappa_B$ which is not a $p$th power. This is possible by our
assumption (4). Let $j \in J$ be the unique index such that $j p^{-r_j}$
is maximal. (The index is unique by the result of the preceding paragraph.)
Choose $r > \max(r_j + 1)$ and such that $j p^{r - r_j} > n$ for $j \in J$.
Choose a separable extension $K_1/K$ totally ramified with respect to $A$
of degree $p^r$ such that the corresponding discrete valuation ring
$A_1 \subset K_1$ has uniformizer $\pi'$ with
$(\pi')^{p^r} = \pi + \pi^{n + 1}a$ for some $a \in A_1$
(Lemma \ref{lemma-make-degree-q-extension}).
Observe that $L_1 = L \otimes_K K_1$ is a field and that
$L_1/L$ is totally ramified with respect to $B$
(Lemma \ref{lemma-weakly-unramified-goes-up-along-totally-ramified}).
Computing in the integral closure $B_1$ we get
$$
\xi = \sum\nolimits_{i \in I} \sigma(\lambda_i) (\pi')^{-i p^r} +
\sum\nolimits_{j \in J} \sigma(\mu_j)^{p^{r_j}} (\pi')^{-j p^r} + b_1
$$
for some $b_1 \in B_1$. Note that $\sigma(\lambda_i)$ for $i \in I$
is a $q$th power modulo $\pi^n$, i.e., modulo $(\pi')^{n p^r}$.
Hence we can rewrite the above as
$$
\xi = \sum\nolimits_{i \in I} x_i^{p^r} (\pi')^{-i p^r} +
\sum\nolimits_{j \in J} \sigma(\mu_j)^{p^{r_j}} (\pi')^{- j p^r}
+ b_1
$$
As in the previous paragraph we change our choice of $z$ into
\begin{align*}
z' & = z \\
& -
\sum\nolimits_{i \in I}
\left(x_i (\pi')^{-i} + \ldots + x_i^{p^{r - 1}} (\pi')^{-i p^{r - 1}}\right)
\\
& -
\sum\nolimits_{j \in J}
\left(
\sigma(\mu_j) (\pi')^{- j p^{r - r_j}}
+ \ldots +
\sigma(\mu_j)^{p^{r_j - 1}} (\pi')^{- j p^{r - 1}}
\right)
\end{align*}
to obtain
$$
(z')^p - z' =
\sum\nolimits_{i \in I} x_i (\pi')^{-i} +
\sum\nolimits_{j \in J} \sigma(\mu_j) (\pi')^{- j p^{r - r_j}} + b_1'
$$
for some $b'_1 \in B_1$.
Since there is a unique $j$ such that $j p^{r - r_j}$ is maximal
and since $j p^{r - r_j}$ is bigger than $i \in I$ and divisible
by $p$, we see that $M_1 / L_1$ falls into case (C) of
Lemma \ref{lemma-pre-characteristic-p-case}.
This finishes the proof.
\end{proof}

\begin{lemma}
\label{lemma-prepare}
Let $A$ be a ring which contains a primitive $p$th root of unity $\zeta$.
Set $w = 1 - \zeta$. Then
$$
P(z) = \frac{(1 + wz)^p - 1}{w^p} =
z^p - z + \sum\nolimits_{0 < i < p} a_i z^i
$$
is an element of $A[z]$ and in fact $a_i \in (w)$. Moreover, we have
$$
P(z_1 + z_2 + w z_1 z_2) = P(z_1) + P(z_2) + w^p P(z_1) P(z_2)
$$
in the polynomial ring $A[z_1, z_2]$.
\end{lemma}

\begin{proof}
It suffices to prove this when
$$
A = \mathbf{Z}[\zeta] = \mathbf{Z}[x]/(x^{p - 1} + \ldots + x + 1)
$$
is the ring of integers of the cyclotomic field. The polynomial identity
$t^p - 1 = (t - 1)(t - \zeta) \ldots (t - \zeta^{p - 1})$
(which is proved by looking at the roots on both sides)
shows that
$t^{p - 1} + \ldots + t + 1 = (t - \zeta) \ldots (t - \zeta^{p - 1})$.
Substituting $t = 1$ we obtain
$p = (1 - \zeta)(1 - \zeta^2) \ldots (1 - \zeta^{p - 1})$.
The maximal ideal $(p, w) = (w)$ is the unique prime ideal of $A$
lying over $p$ (as fields of characteristic $p$ do not have nontrivial
$p$th roots of $1$). It follows that $p = u w^{p - 1}$ for some unit $u$.
This implies that
$$
a_i = \frac{1}{p} {p \choose i} u w^{i - 1}
$$
for $p > i > 1$ and $- 1 + a_1 = pw/w^p = u$. Since $P(-1) = 0$ we
see that $0 = (-1)^p - u$ modulo $(w)$. Hence $a_1 \in (w)$ and the
proof if the first part is done. The second part follows from a direct
computation we omit.
\end{proof}

\begin{lemma}
\label{lemma-extension-defined-by-nice-polynial}
Let $A$ be a discrete valuation ring of mixed characteristic $(0, p)$
which contains a primitive $p$th root of $1$.
Let $P(t) \in A[t]$ be the polynomial of Lemma \ref{lemma-prepare}.
Let $\xi \in K$.
Let $L$ be an extension of $K$ obtained by
adjoining a root of $P(z) = \xi$. Then $L/K$ is Galois and one of the
following happens
\begin{enumerate}
\item $L = K$,
\item $L/K$ is unramified with respect to $A$ of degree $p$,
\item $L/K$ is totally ramified with respect to $A$
with ramification index $p$, and
\item the integral closure $B$ of $A$ in $L$ is a discrete valuation ring,
$A \subset B$ is weakly unramified, and $A \to B$ induces a purely inseparable
residue field extension of degree $p$.
\end{enumerate}
Let $\pi$ be a uniformizer of $A$. We have the following implications:
\begin{enumerate}
\item[(A)] If $\xi \in A$, then we are in case (1) or (2).
\item[(B)] If $\xi = \pi^{-n}a$ where $n > 0$ is not divisible by
$p$ and $a$ is a unit in $A$, then we are in case (3)
\item[(C)] If $\xi = \pi^{-n} a$ where $n > 0$ is divisible by $p$ and
the image of $a$ in $\kappa_A$ is not a $p$th power, then we are in case (4).
\end{enumerate}
\end{lemma}

\begin{proof}
Adjoining a root of $P(z) = \xi$ is the same thing as adjoining a root
of $y^p = w^p(1 + \xi)$. Since $K$ contains a primitive $p$th root of $1$
the extension is Galois of order dividing $p$ by the discussion in
Fields, Section \ref{fields-section-Kummer}.
It immediately follows from the discussion in
Section \ref{section-ramification} that we are in one of the cases (1) -- (4)
listed in the lemma.

\medskip\noindent
Case (A). Here we see that $A \to A[x]/(P(x) - \xi)$ is a finite
\'etale ring extension. Hence we are in cases (1) or (2).

\medskip\noindent
Case (B). Write $\xi = \pi^{-n}a$ where $p$ does not divide $n$.
Let $B \subset L$ be the integral closure of $A$ in $L$.
If $C = B_\mathfrak m$ for some maximal ideal $\mathfrak m$,
then it is clear that $p \text{ord}_C(z) = -n \text{ord}_C(\pi)$.
In particular $A \subset C$ has ramification index divisible by $p$.
It follows that it is $p$ and that $B = C$.

\medskip\noindent
Case (C). Set $k = n/p$. Then we can rewrite the equation as
$$
(\pi^kz)^p - \pi^{n - k} (\pi^kz) + \sum a_i \pi^{n - ik} (\pi^kz)^i = a
$$
Since $A[y]/(y^p - \pi^{n - k}y - \sum  a_i \pi^{n - ik} y^i - a)$
is a discrete valuation ring weakly unramified over $A$, the lemma follows.
\end{proof}

\noindent
Let $A$ be a discrete valuation ring of mixed characteristic $(0, p)$
containing a primitive $p$th root of $1$. Let $w \in A$ and $P(t) \in A[t]$
be as in Lemma \ref{lemma-prepare}. Let $L$ be a finite extension of $K$.
We say $L/K$ is a {\it degree $p$ extension of finite level}
if $L$ is a degree $p$ extension of $K$ obtained by adjoining a
root of the equation $P(z) = \xi$ where $\xi \in K$ is an
element with $w^p \xi \in \mathfrak m_A$.

\medskip\noindent
This definition is relevant to the discussion in this section due
to the following straightforward lemma.

\begin{lemma}
\label{lemma-make-finite-level}
Let $A \subset B \subset C$ be extensions of discrete valuation rings
with fractions fields $K \subset L \subset M$. Assume that
\begin{enumerate}
\item $A$ has mixed characteristic $(0, p)$,
\item $A \subset B$ is weakly unramified,
\item $B$ contains a primitive $p$th root of $1$, and
\item $M/L$ is Galois of degree $p$.
\end{enumerate}
Then there exists a finite Galois extension $K_1/K$ totally ramified
with respect to $A$ which is either a weak solution for $A \to C$
or is such that $M_1/L_1$ is a degree $p$ extension of finite level.
\end{lemma}

\begin{proof}
Let $\pi \in A$ be a uniformizer. By Kummer theory
(Fields, Lemma \ref{fields-lemma-Kummer}) $M$ is obtained
from $L$ by adjoining the root of $y^p = b$ for some $b \in L$.

\medskip\noindent
If $\text{ord}_B(b)$ is prime to $p$, then we choose a degree $p$
separable extension $K_1/K$
totally ramified with respect to $A$ (for example
using Lemma \ref{lemma-make-degree-q-extension}).
Let $A_1$ be the integral closure of $A$ in $K_1$.
By Lemma \ref{lemma-weakly-unramified-goes-up-along-totally-ramified}
the integral closure $B_1$ of $B$ in $L_1 = L \otimes_K K_1$
is a discrete valuation ring weakly unramified over $A_1$.
If $K_1/K$ is not a weak solution for $A \to C$, then
the integral closure $C_1$ of $C$ in $M_1 = M \otimes_K K_1$ is a
discrete valuation ring and $B_1 \to C_1$ has ramification index $p$.
In this case, the field $M_1$ is obtained from $L_1$ by adjoining the
$p$th root of $b$ with $\text{ord}_{B_1}(b)$ divisible by $p$.
Replacing $A$ by $A_1$, etc we may assume that $b = \pi^n u$ where
$u \in B$ is a unit and $n$ is divisible by $p$. Of course, in
this case the extension $M$ is obtained from $L$ by adjoining
the $p$th root of a unit.

\medskip\noindent
Suppose $M$ is obtained from $L$ by adjoining the root of
$y^p = u$ for some unit $u$ of $B$. If the residue class of $u$
in $\kappa_B$ is not a $p$th power, then $B \subset C$ is
weakly unramified (Lemma \ref{lemma-pre-purely-inseparable-case})
and we are done. Otherwise, we can replace our choice of $y$ by
$y/v$ where $v^p$ and $u$ have the same image in $\kappa_B$.
After such a replacement we have
$$
y^p = 1 + \pi b
$$
for some $b \in B$. Then we see that $P(z) = \pi b/ w^p$ where
$z = (y - 1)/w$. Thus we see that the extension is a degree $p$
extension of finite level with $\xi = \pi b / w^p$.
\end{proof}

\noindent
Let $A$ be a discrete valuation ring of mixed characteristic $(0, p)$
containing a primitive $p$th root of $1$. Let $w \in A$ and $P(t) \in A[t]$
be as in Lemma \ref{lemma-prepare}. Let $L$ be a degree $p$ extension of
$K$ of finite level. Choose $z \in L$ generating $L$ over $K$
with $\xi = P(z) \in K$. Choose a uniformizer $\pi$ for $A$ and write
$w = u \pi^{e_1}$ for some integer $e_1 = \text{ord}_A(w)$
and unit $u \in A$. Finally, pick $n \geq 0$ such that
$$
\pi^n \xi \in A
$$
The {\it level} of $L/K$ is the smallest value of the quantity $n/e_1$
taking over all $z$ generating $L/K$ with $\xi = P(z) \in K$.

\medskip\noindent
We make a couple of remarks. Since the extension is of finite level
we know that we can choose $z$ such that $n < pe_1$.
Thus the level is a rational number contained in $[0, p)$.
If the level is zero then $L/K$ is unramified with respect to $A$ by
Lemma \ref{lemma-extension-defined-by-nice-polynial}.
Our next goal is to lower the level.

\begin{lemma}
\label{lemma-lowering-the-level}
Let $A \subset B \subset C$ be extensions of discrete valuation rings
with fractions fields $K \subset L \subset M$. Assume
\begin{enumerate}
\item $A$ has mixed characteristic $(0, p)$,
\item $A \subset B$ weakly unramified,
\item $B$ contains a primitive $p$th root of $1$,
\item $M/L$ is a degree $p$ extension of finite level $l > 0$,
\item $\kappa_A = \bigcap_{n \geq 1} \kappa_B^{p^n}$.
\end{enumerate}
Then there exists a finite separable extension $K_1$ of $K$
totally ramified with respect to $A$
such that either $K_1$ is a weak solution for $A \to C$, or the extension
$M_1/L_1$ is a degree $p$ extension of finite level
$\leq \max(0, l - 1, 2l - p)$.
\end{lemma}

\begin{proof}
Let $\pi \in A$ be a uniformizer.
Let $w \in B$ and $P \in B[t]$ be as in Lemma \ref{lemma-prepare} (for $B$).
Set $e_1 = \text{ord}_B(w)$, so that $w$ and $\pi^{e_1}$ are associates in $B$.
Pick $z \in M$ generating $M$ over $L$ with $\xi = P(z) \in K$
and $n$ such that $\pi^n\xi \in B$ as in the definition of the level
of $M$ over $L$, i.e., $l = n/e_1$.

\medskip\noindent
The proof of this lemma is completely similar to the proof of
Lemma \ref{lemma-characteristic-p-case}.
To explain what is going on, observe that
\begin{equation}
\label{equation-first-congruence}
P(z) \equiv z^p - z \bmod \pi^{-n + e_1}B
\end{equation}
for any $z \in L$ such that $\pi^{-n} P(z) \in B$ (use that $z$ has valuation
at worst $-n/p$ and the shape of the polynomial $P$). Moreover, we have
\begin{equation}
\label{equation-second-congruence}
\xi_1 + \xi_2 + w^p \xi_1 \xi_2 \equiv \xi_1 + \xi_2 \bmod \pi^{-2n + pe_1}B 
\end{equation}
for $\xi_1, \xi_2 \in \pi^{-n}B$. Finally, observe that
$n - e_1 = (l - 1)/e_1$ and $-2n + pe_1 = -(2l - p)e_1$.
Write $m = n - e_1 \max(0, l - 1, 2l - p)$. The above shows that doing
calculations in $\pi^{-n}B / \pi^{-n + m}B$ the polynomial $P$ behaves exactly
as the polynomial $z^p -  z$. This explains why the lemma is true
but we also give the details below.

\medskip\noindent
Assumption (4) implies that $\kappa_A$ is perfect. Observe that
$m \leq e_1$ and hence $A/\pi^m$ is annihilated by $w$ and hence $p$.
Thus we may choose compatible ring maps
$\overline{\sigma} : \kappa_A \to A/\pi^mA$ and
$\overline{\sigma} : \kappa_B \to B/\pi^mB$ as in
Lemma \ref{lemma-cohen}. We lift the second of these to a
map of sets $\sigma : \kappa_B \to B$. Then we can write
$$
\xi =
\sum\nolimits_{i = n, \ldots, n - m + 1} \sigma(\lambda_i) \pi^{-i} +
\pi^{-n + m)} b
$$
for some $\lambda_i \in \kappa_B$ and $b \in B$. Let
$$
I = \{i \in \{n, \ldots, n - m + 1\} \mid \lambda_i \in \kappa_A\}
$$
and
$$
J = \{j \in \{n, \ldots, n - m + 1\} \mid \lambda_i \not \in \kappa_A\}
$$
We will argue by induction on the size of the finite set $J$.

\medskip\noindent
The case $J = \emptyset$. Here for all $i \in \{n, \ldots, n - m + 1\}$
we have $\sigma(\lambda_i) = a_i + \pi^{n - m}b_i$ for some $a_i \in A$
and $b_i \in B$ by our choice of $\overline{\sigma}$. Thus
$\xi = \pi^{-n} a + \pi^{-n + m} b$ for some $a \in A$ and $b \in B$.
If $p | n$, then we write $a = a_0^p + \pi a_1$ for some $a_0, a_1 \in A$
(as the residue field of $A$ is perfect). Set $z_1 = - \pi^{-n/p} a_0$.
Note that $P(z_1) \in \pi^{-n}B$ and that $z + z_1 + w z z_1$ is an
element generating $M$ over $L$ (note that $wz_1 \not = -1$ as
$n < pe_1$). Moreover, by Lemma \ref{lemma-prepare} we have
$$
P(z + z_1 + w z z_1) = P(z) + P(z_1) + w^p P(z) P(z_1) \in K
$$
and by equations (\ref{equation-first-congruence}) and
(\ref{equation-second-congruence}) we have
$$
P(z) + P(z_1) + w^p P(z) P(z_1)
\equiv
\xi + z_1^p - z_1 \bmod \pi^{-n + m}B
$$
for some $b' \in B$. This contradict the minimality of $n$! Thus $p$
does not divide $n$. Consider the degree $p$ extension $K_1$ of $K$ given
by $P(y) = -\pi^{-n}a$. By Lemma \ref{lemma-extension-defined-by-nice-polynial}
this extension is separable and totally ramified with respect to $A$.
Thus $L_1 = L \otimes_K K_1$
is a field and $A_1 \subset B_1$ is weakly unramified
(Lemma \ref{lemma-weakly-unramified-goes-up-along-totally-ramified}).
By Lemma \ref{lemma-extension-defined-by-nice-polynial}
the ring $M_1 = M \otimes_K K_1$ is either a product of $p$ copies
of $L_1$ (in which case we are done) or a field extension of $L_1$
of degree $p$. Moreover, in the second case, either $C_1$ is weakly unramified
over $B_1$ (in which case we are done) or $M_1/L_1$ is degree $p$,
Galois, totally ramified with respect to $B_1$.
In this last case the extension $M_1/L_1$
is generated by the element $z + y + wzy$ and we see that
$P(z + y + wzy) \in L_1$ and
\begin{align*}
P(z + y + wzy)
& = P(z) + P(y) + w^p P(z) P(y) \\
& \equiv
\xi - \pi^{-n}a \bmod \pi^{-n + m}B_1 \\
& \equiv
0 \bmod \pi^{-n + m}B_1
\end{align*}
in exactly the same manner as above. By our choice of $m$ this
means exactly that $M_1/L_1$ has level at most $\max(0, l - 1, 2l - p)$.
From now on we assume that $J \not = \emptyset$.

\medskip\noindent
Suppose that $j', j \in J$ such that $j' = p^r j$ for some $r > 0$.
Then we set
$$
z_1 = - \sigma(\lambda_j) \pi^{-j} - \sigma(\lambda_j^p) \pi^{-pj} -
\ldots - \sigma(\lambda_j^{p^{r - 1}}) \pi^{-p^{r - 1}j}
$$
and we change $z$ into $z' = z + z_1 + wzz_1$. Observe that $z' \in M$
generates $M$ over $L$ and that we have
$\xi' = P(z') = P(z) + P(z_1) + wP(z)P(z_1) \in L$ with
$$
\xi' \equiv
\xi - \sigma(\lambda_j) \pi^{-j} + \sigma(\lambda_j^{p^r}) \pi^{-j'}
\bmod \pi^{-n + m}B
$$
by using equations (\ref{equation-first-congruence}) and
(\ref{equation-second-congruence}) as above. Writing
$$
\xi' = \sum\nolimits_{i = n, \ldots, n - m + 1} \sigma(\lambda'_i) \pi^{-i}
+ \pi^{-n + m}b'
$$
as before we find that
$\lambda'_i = \lambda_i$ for $i \not = j, j'$ and $\lambda'_j = 0$.
Thus the set $J$ has gotten smaller.
By induction on the size of $J$ we may assume there is no pair
$j, j'$ of $J$ such that $j'/j$ is a power of $p$.
(Please observe that in this procedure we may get thrown back into the case
that $J = \emptyset$ we treated above.)

\medskip\noindent
For $j \in J$ write $\lambda_j = \mu_j^{p^{r_j}}$ for some $r_j \geq 0$ and
$\mu_j \in \kappa_B$ which is not a $p$th power. This is possible by our
assumption (4). Let $j \in J$ be the unique index such that $j p^{-r_j}$
is maximal. (The index is unique by the result of the preceding paragraph.)
Choose $r > \max(r_j + 1)$ and such that $j p^{r - r_j} > n$ for $j \in J$.
Let $K_1/K$ be the extension of degree $p^r$, totally ramified
with respect to $A$, defined by $(\pi')^{p^r} = \pi$.
Observe that $\pi'$ is the uniformizer of the
corresponding discrete valuation ring $A_1 \subset K_1$.
Observe that $L_1 = L \otimes_K K_1$ is a field and $L_1/L$
is totally ramified with respect to $B$
(Lemma \ref{lemma-weakly-unramified-goes-up-along-totally-ramified}).
Computing in the integral closure $B_1$ we get
$$
\xi = \sum\nolimits_{i \in I} \sigma(\lambda_i) (\pi')^{-i p^r} +
\sum\nolimits_{j \in J} \sigma(\mu_j)^{p^{r_j}} (\pi')^{-j p^r} +
\pi^{-n + m} b_1
$$
for some $b_1 \in B_1$. Note that $\sigma(\lambda_i)$ for $i \in I$
is a $q$th power modulo $\pi^m$, i.e., modulo $(\pi')^{m p^r}$.
Hence we can rewrite the above as
$$
\xi = \sum\nolimits_{i \in I} x_i^{p^r} (\pi')^{-i p^r} +
\sum\nolimits_{j \in J} \sigma(\mu_j)^{p^{r_j}} (\pi')^{- j p^r}
+ \pi^{-n + m}b_1
$$
Similar to our choice in the previous paragraph we set
\begin{align*}
z_1 & - \sum\nolimits_{i \in I}
\left(x_i (\pi')^{-i} + \ldots + x_i^{p^{r - 1}} (\pi')^{-i p^{r - 1}}\right)
\\
& - \sum\nolimits_{j \in J}
\left(
\sigma(\mu_j) (\pi')^{- j p^{r - r_j}}
+ \ldots +
\sigma(\mu_j)^{p^{r_j - 1}} (\pi')^{- j p^{r - 1}}
\right)
\end{align*}
and we change our choice of $z$ into $z' = z + z_1 + wzz_1$.
Then $z'$ generates $M_1$ over $L_1$ and
$\xi' = P(z') = P(z) + P(z_1) + w^p P(z) P(z_1) \in L_1$
and a calculation shows that
$$
\xi' \equiv
\sum\nolimits_{i \in I} x_i (\pi')^{-i} +
\sum\nolimits_{j \in J} \sigma(\mu_j) (\pi')^{- j p^{r - r_j}} +
(\pi')^{(-n + m)p^r}b'_1
$$
for some $b'_1 \in B_1$. There is a unique $j$ such that $j p^{r - r_j}$
is maximal and $j p^{r - r_j}$ is bigger than $i \in I$. If
$j p^{r - r_j} \leq (n - m)p^r$ then the level of the extension $M_1/L_1$
is less than $\max(0, l - 1, 2l - p)$. If not, then, as $p$ divides
$j p^{r - r_j}$, we see that $M_1 / L_1$ falls into case (C) of
Lemma \ref{lemma-extension-defined-by-nice-polynial}.
This finishes the proof.
\end{proof}

\begin{lemma}
\label{lemma-special-case}
Let $A \subset B \subset C$ be extensions of discrete valuation rings
with fraction fields $K \subset L \subset M$. Assume
\begin{enumerate}
\item the residue field $k$ of $A$ is algebraically closed of
characteristic $p > 0$,
\item $A$ and $B$ are complete,
\item $A \to B$ is weakly unramified,
\item $M$ is a finite extension of $L$,
\item $k = \bigcap\nolimits_{n \geq 1} \kappa_B^{p^n}$
\end{enumerate}
Then there exists a finite extension $K_1/K$ which
is a weak solution for $A \to C$.
\end{lemma}

\begin{proof}
Let $M'$ be any finite extension of $L$ and consider the integral closure
$C'$ of $B$ in $M'$. Then $C'$ is finite over $B$ as $B$ is Nagata by
Algebra, Lemma \ref{algebra-lemma-Noetherian-complete-local-Nagata}.
Moreover, $C'$ is a discrete valuation ring, see discussion in
Remark \ref{remark-construction}. Moreover $C'$ is complete as a
$B$-module, hence complete as a discrete valuation ring, see
Algebra, Section \ref{algebra-section-completion}.
It follows in particular that $C$ is the integral
closure of $B$ in $M$ (by definition of valuation rings as maximal
for the relation of domination).

\medskip\noindent
Let $M \subset M'$ be a finite extension and let $C' \subset M'$
be the integral closure of $B$ as above. By
Lemma \ref{lemma-solutions-go-down}
it suffices to prove the result for $A \to B \to C'$.
Hence we may assume that $M/L$ is normal, see
Fields, Lemma \ref{fields-lemma-normal-closure}.

\medskip\noindent
If $M / L$ is normal, we can find a chain of finite extensions
$$
L = L^0 \subset L^1 \subset L^2 \subset \ldots \subset L^r = M
$$
such that each extension $L^{j + 1}/L^j$ is either:
\begin{enumerate}
\item[(a)] purely inseparable of degree $p$,
\item[(b)] totally ramified with respect to $B^j$ and Galois of degree $p$,
\item[(c)] totally ramified with respect to $B^j$ and Galois cyclic of
order prime to $p$,
\item[(d)] Galois and unramified with respect to $B^j$.
\end{enumerate}
Here $B^j$ is the integral closure of $B$ in $L^j$.
Namely, since $M/L$ is normal we can write it as a compositum of
a Galois extension and a purely inseparable extension
(Fields, Lemma \ref{fields-lemma-normal-case}).
For the purely inseparable extension the existence of the filtration
is clear. In the Galois case, note that $G$ is ``the'' decomposition group
and let $I \subset G$ be the inertia group. Then on the one hand
$I$ is solvable by Lemma \ref{lemma-galois-inertia} and on the other
hand the extension $M^I/L$ is unramified with respect to $B$ by
Lemma \ref{lemma-inertial-invariants-unramified}.
This proves we have a filtration as stated.

\medskip\noindent
We are going to argue by induction on the integer $r$. Suppose that we
can find a finite extension $K_1/K$ which is a weak solution
for $A \to B^1$ where $B^1$ is the integral closure of $B$ in $L^1$.
Let $K'_1$ be the normal closure of $K_1/K$
(Fields, Lemma \ref{fields-lemma-normal-closure}).
Since $A$ is complete and the residue field of $A$ is algebraically closed
we see that $K'_1/K_1$ is separable and totally ramified with
respect to $A_1$ (some details omitted).
Hence $K'_1/K$ is a weak solution for $A \to B^1$ as well by
Lemma \ref{lemma-weakly-unramified-goes-up-along-totally-ramified}.
In other words, we may and do assume that $K_1$ is a normal extension of $K$.
Having done so we consider the sequence
$$
L^0_1 = (L^0 \otimes_K K_1)_{red} \subset
L^1_1 = (L^1 \otimes_K K_1)_{red} \subset \ldots \subset
L^r_1 = (L^r \otimes_K K_1)_{red}
$$
and the corresponding integral closures $B^i_1$. Note that $C_1 = B^r_1$
is a product of discrete valuation rings which are transitively permuted
by $G = \text{Aut}(K_1/K)$ by Lemma \ref{lemma-galois-relative}.
In particular all the extensions of discrete valuation rings
$A_1 \to (C_1)_\mathfrak m$ are isomorphic and a weak solution for one
will be a weak solution for all of them. We can apply the induction
hypothesis to the sequence
$$
A_1 \to (B^1_1)_{B^1_1 \cap \mathfrak m} \to
(B^2_1)_{B^2_1 \cap \mathfrak m} \to
\ldots \to
(B^r_1)_{B^r_1 \cap \mathfrak m} =
(C_1)_\mathfrak m
$$
to get a weak solution $K_2/K_1$ for $A_1 \to (C_1)_\mathfrak m$.
The extension $K_2/K$ will then be a weak solution for $A \to C$
by what we said before. Note that the induction hypothesis applies:
the ring map $A_1 \to (B^1_1)_{B^1_1 \cap \mathfrak m}$
is weakly unramified by our choice of $K_1$
and the sequence of fraction field extensions
each still have one of the properties (a), (b), (c), or (d)
listed above. Moreover, observe that for any finite extension 
$\kappa_B \subset \kappa$ we still have $k = \bigcap \kappa^{p^n}$.

\medskip\noindent
Thus everything boils down to finding a weak solution for $A \subset C$
when the field extension $M/L$ satisfies one of the properties
(a), (b), (c), or (d).

\medskip\noindent
Case (d). This case is trivial as here $B \to C$ is unramified already.

\medskip\noindent
Case (c). Say $M/L$ is cyclic of order $n$ prime to $p$. Because
$M/L$ is totally ramified with respect to $B$ we see that the ramification
index of $B \subset C$ is $n$ and hence the ramification index of $A \subset C$
is $n$ as well. Choose a uniformizer $\pi \in A$ and set
$K_1 = K[\pi^{1/n}]$. Then $K_1/K$ is a solution for $A \subset C$
by Abhyankar's lemma (Lemma \ref{lemma-abhyankar}).

\medskip\noindent
Case (b). We divide this case into the mixed characteristic case and the
equicharacteristic case. In the equicharacteristic case this is
Lemma \ref{lemma-characteristic-p-case}. In the mixed characteristic
case, we first replace $K$ by a finite extension to get to the
situation where $M/L$ is a degree $p$ extension of finite level using
Lemma \ref{lemma-make-finite-level}.
Then the level is a rational number $l \in [0, p)$, see discussion
preceding Lemma \ref{lemma-lowering-the-level}. If the level is $0$,
then $B \to C$ is weakly unramified and we're done. If not, then we
can replacing the field $K$ by a finite extension to obtain a new
situation with level $l' \leq \max(0, l - 1, 2l - p)$ by
Lemma \ref{lemma-lowering-the-level}.
If $l = p - \epsilon$ for $\epsilon < 1$ then we see that
$l' \leq p - 2\epsilon$. Hence after a finite number of replacements
we obtain a case with level $\leq p - 1$. Then after at most $p - 1$
more such replacements we reach the situation where the level is zero.

\medskip\noindent
Case (a) is Lemma \ref{lemma-purely-inseparable-case}. This is the only case
where we possibly need a purely inseparable extension of $K$, namely, in
case (2) of the statement of the lemma we win by adjoining a $p$th power
of the element $\pi$. This finishes the proof of the lemma.
\end{proof}

\noindent
At this point we have collected all the lemmas we need to prove the
main result of this section.

\begin{theorem}[Epp]
\label{theorem-epp}
Let $A \subset B$ be an extension of discrete valuation rings with fraction
fields $K \subset L$. If the characteristic of $\kappa_A$ is $p > 0$,
assume that every element of
$$
\bigcap\nolimits_{n \geq 1} \kappa_B^{p^n}
$$
is separable algebraic over $\kappa_A$. Then there exists a finite extension
$K_1/K$ which is a weak solution for $A \to B$ as defined in
Definition \ref{definition-solution}.
\end{theorem}

\begin{proof}
If the characteristic of $\kappa_A$ is zero or if the residue characteristic
is $p$, the ramification index is prime to $p$, and the residue field
extension is separable, then this follows from Abhyankar's lemma
(Lemma \ref{lemma-abhyankar}). Namely, suppose the ramification index
is $e$. Choose a uniformizer $\pi \in A$. Let $K_1/K$
be the extension obtained by adjoining an $e$th root of $\pi$.
By Lemma \ref{lemma-pull-root-uniformizer} we see that the integral
closure $A_1$ of $A$ in $K_1$ is a discrete valuation ring with
ramification index over $A$. Thus $A_1 \to (B_1)_\mathfrak m$
is formally smooth in the $\mathfrak m$-adic topology
for all maximal ideals $\mathfrak m$ of $B_1$
by Lemma \ref{lemma-abhyankar} and a fortiori these are weakly
unramified extensions of discrete valuation rings.

\medskip\noindent
From now on we let $p$ be a prime number and we assume that $\kappa_A$ has
characteristic $p$. We first apply
Lemma \ref{lemma-solution-after-strict-henselization}
to reduce to the case that $A$ and $B$ have separably closed residue fields.
Since $\kappa_A$ and $\kappa_B$ are replaced by their separable algebraic
closures by this procedure we see that we obtain
$$
\kappa_A \supset \bigcap\nolimits_{n \geq 1} \kappa_B^{p^n}
$$
from the condition of the theorem.

\medskip\noindent
Let $\pi \in A$ be a uniformizer. Let $A^\wedge$ and $B^\wedge$ be the
completions of $A$ and $B$. We have a commutative diagram
$$
\xymatrix{
B \ar[r] & B^\wedge \\
A \ar[u] \ar[r] & A^\wedge \ar[u]
}
$$
of extensions of discrete valuation rings. Let $K^\wedge$ be the fraction
field of $A^\wedge$. Suppose that we can find a finite extension
$M/K^\wedge$ which is (a) a weak solution for $A^\wedge \to B^\wedge$
and (b) a compositum of a separable extension and an extension obtained
by adjoining a $p$-power root of $\pi$. Then by
Lemma \ref{lemma-approximate-separable-extension}
we can find a finite extension $K_1/K$ such that
$K^\wedge \otimes_K K_1 = M$. Let $A_1$, resp.\ $A_1^\wedge$
be the integral closure of $A$, resp.\ $A^\wedge$ in $K_1$, resp.\ $M$.
Since $A \to A^\wedge$ is formally smooth in the $\mathfrak m^\wedge$-adic
topology
(Lemma \ref{lemma-extension-dvrs-formally-smooth})
we see that $A_1 \to A_1^\wedge$ is formally smooth in the
$\mathfrak m_1^\wedge$-adic topology
(Lemma \ref{lemma-formally-smooth-goes-up} and
$A_1$ and $A_1^\wedge$ are discrete valuation
rings by discussion in Remark \ref{remark-construction}).
We conclude from Lemma \ref{lemma-solutions-go-down} part (2)
that $K_1/K$ is a weak solution for $A \to B^\wedge$.
Applying Lemma \ref{lemma-solutions-go-down} part (1)
we see that $K_1/K$ is a weak solution for $A \to B$.

\medskip\noindent
Thus we may assume $A$ and $B$ are complete discrete valuation rings
with separably closed residue fields of characteristic $p$ and
with $\kappa_A \supset \bigcap\nolimits_{n \geq 1} \kappa_B^{p^n}$.
We are also given a uniformizer $\pi \in A$ and we have to find a
weak solution for $A \to B$ which is a compositum of a separable
extension and a field obtained by taking $p$-power roots of $\pi$.
Note that the second condition is automatic if $A$ has mixed characteristic.

\medskip\noindent
Set $k = \bigcap\nolimits_{n \geq 1} \kappa_B^{p^n}$.
Observe that $k$ is an algebraically closed field of characteristic $p$.
If $A$ has mixed characteristic let $\Lambda$ be a Cohen
ring for $k$ and in the equicharacteristic case set $\Lambda = k[[t]]$.
We can choose a ring map $\Lambda \to A$ which maps $t$ to $\pi$ in the
equicharacteristic case. In the equicharacteristic case this follows
from the Cohen structure theorem
(Algebra, Theorem \ref{algebra-theorem-cohen-structure-theorem}) and
in the mixed characteristic case this follows as
$\mathbf{Z}_p \to \Lambda$ is formally smooth in the adic topology
(Lemmas \ref{lemma-extension-dvrs-formally-smooth} and
\ref{lemma-lift-continuous}).
Applying Lemma \ref{lemma-solutions-go-down} we see that it suffices to prove
the existence of a weak solution for $\Lambda \to B$ which in
the equicharacteristic $p$ case is a compositum of a separable
extension and a field obtained by taking $p$-power roots of $t$.
However, since $\Lambda = k[[t]]$ in the equicharacteristic case
and any extension of $k((t))$ is such a compositum, we can now
drop this requirement!

\medskip\noindent
Thus we arrive at the situation where $A$ and $B$ are complete, the residue
field $k$ of $A$ is algebraically closed of characteristic $p > 0$,
we have $k = \bigcap \kappa_B^{p^n}$, and in the mixed characteristic
case $p$ is a uniformizer of $A$ (i.e., $A$ is a Cohen ring for $k$).
If $A$ has mixed characteristic choose a Cohen ring
$\Lambda$ for $\kappa_B$ and in the equicharacteristic case set
$\Lambda = \kappa_B[[t]]$. Arguing as above we may choose a ring map
$A \to \Lambda$ lifting $k \to \kappa_B$ and mapping a uniformizer
to a uniformizer. Since $k \subset \kappa_B$ is separable the ring
map $A \to \Lambda$ is formally smooth in the adic topology
(Lemma \ref{lemma-extension-dvrs-formally-smooth}). Hence
we can find a ring map $\Lambda \to B$ such that the composition
$A \to \Lambda \to B$ is the given ring map $A \to B$ (see
Lemma \ref{lemma-lift-continuous}).
Since $\Lambda$ and $B$ are complete discrete valuation rings with the same
residue field, $B$ is finite over $\Lambda$
(Algebra, Lemma \ref{algebra-lemma-finite-over-complete-ring}).
This reduces us to the special case discussed in
Lemma \ref{lemma-special-case}.
\end{proof}







\section{Eliminating ramification, II}
\label{section-eliminating-ramification-bis}

\noindent
In this section we use the results of
Section \ref{section-eliminating-ramification}
to obtain (separable) solutions in some cases.

\begin{lemma}
\label{lemma-solution-goes-up}
Let $A \to B$ be an extension of discrete valuation rings with fraction
fields $K \subset L$. If $K_1/K$ is a solution for $A \subset B$,
then for any finite extension $K_2/K_1$ the extension $K_2/K$ is a
solution for $A \subset B$.
\end{lemma}

\begin{proof}
This follows from Lemma \ref{lemma-formally-smooth-goes-up}. Details omitted.
\end{proof}

\begin{lemma}
\label{lemma-nagata-goes-down}
Let $A \subset B$ be an extension of discrete valuation rings.
If $B$ is Nagata and the extension $L/K$ of fraction fields is
separable, then $A$ is Nagata.
\end{lemma}

\begin{proof}
A discrete valuation ring is Nagata if and only if it is N-2.
Let $K_1/K$ be a finite purely inseparable field extension.
We have to show that the integral closure $A_1$ of $A$ in $K_1$
is finite over $A$, see Algebra, Lemma \ref{algebra-lemma-domain-char-p-N-1-2}.
Since $L/K$ is separable and $K_1/K$ is purely inseparable,
the algebra $L \otimes_K K_1$ is a field (by Algebra, Lemmas
\ref{algebra-lemma-separable-extension-preserves-reducedness} and
\ref{algebra-lemma-radicial-integral-bijective}).
Let $B_1$ be the integral closure of $B$ in $L \otimes_K K_1$.
Since $B$ is Nagata, $B_1$ is finite over $B$. Since
$B \otimes_A A_1 \subset B_1$
and $B$ is Noetherian, we see that $B \otimes_A A_1$ is finite over $B$.
As $A \to B$ is faithfully flat, this implies $A_1$ is finite over $A$,
see Algebra, Lemma \ref{algebra-lemma-descend-properties-modules}.
\end{proof}

\begin{lemma}
\label{lemma-construct-extension}
Let $A' \subset A$ be an extension of rings. Let $f \in A'$.
Assume that (a) $A$ is finite over $A'$, (b) $f$ is a nonzerodivisor
on $A$, and (c) $A'_f = A_f$. Then there exists an integer $n_0 > 0$
such that for all $n \geq n_0$ the following is true: given a ring
$B'$, a nonzerodivisor $g \in B'$, and an isomorphism
$\varphi' : A'/f^n A' \to B'/g^n B'$ with $\varphi'(f) \equiv g$, there is a
finite extension $B' \subset B$ and an isomorphism
$\varphi : A/fA \to B/gB$ compatible with $\varphi'$.
\end{lemma}

\begin{proof}
Since $A$ is finite over $A'$ and since $A'_f = A_f$ we can
Cchoose $t > 0$ such that $f^t A \subset A'$. Set $n_0 = 2t$.
Given $n, B', g, \varphi'$ as in the statement of the lemma,
denote $N \subset B'$ the set of elements
$b \in B'$ such that $b \bmod g^nB' \in \varphi'(f^tA)$.
Set $B = g^{-t}N$. As $f^tA' \subset f^tA$ and $\varphi'$ sends $f$
to $g$ we have $g^tB' \subset N$, hence $B' \subset B$. Since
$f^tA \cdot f^tA \subset f^t \cdot f^tA$ and $\varphi'$ sends
$f$ to $g$, we see that $N \cdot N \subset g^t N$.
Hence we obtain a multiplication on $B$ extending the
multiplication of $B'$. We have an isomorphism of $A'/f^nA'$-modules
$$
A/f^tA' \xrightarrow{f^t} f^tA/f^nA' \xrightarrow{\varphi'}
g^tB/g^nB' \xrightarrow{g^{-t}} B/g^tB'
$$
where the module structures on the right are defined using $\varphi'$.
Since $A/f^tA'$ is a finite $A'$-module, we conclude that $B/g^tB'$
is a finite $B'$-module and hence we see that $B' \to B$ is finite.
Finally, we leave it to the reader to see that the displayed isomorphism
of modules sends $fA$ into $gB$ and induces an isomorphism of rings
$\varphi : A/fA \to B/gB$ compatible with $\varphi'$ (it even induces an
isomorphism $A/f^tA \to B/g^tB$ but we don't need this).
\end{proof}

\begin{remark}
\label{remark-functoriality-construct-extension}
The construction in Lemma \ref{lemma-construct-extension} satisfies
the following ``functoriality''. Suppose we have a commutative diagram
$$
\xymatrix{
A'_2 \ar[r] & A_2 \\
A'_1 \ar[r] \ar[u] & A_1 \ar[u]
}
$$
with injective horizontal arrows. Suppose given an element
$f \in A'_1$ such that $(A'_1 \subset A_1, f)$ and $(A'_2 \subset A_2, f)$
satisfy properties (a), (b), (c) of Lemma \ref{lemma-construct-extension}.
Let $n_{0, 1}$ and $n_{0, 2}$ be the integers found in the lemma for
these two situations.
Finally, let $B'_1 \to B'_2$ be a ring map, let $g \in B'_1$
be a nonzerodivisor on $B_1$ and $B_2$, let $n \geq \max(n_{0, 1}, n_{0, 2})$,
and let a commutative diagram
$$
\xymatrix{
A'_2/f^nA'_2 \ar[r]_{\varphi'_2} & B'_2/g^nB'_2 \\
A'_1/f^nA'_1 \ar[r]^{\varphi'_1} \ar[u] & B'_2/g^nB'_2 \ar[u]
}
$$
be given whose horizontal arrows are isomorphisms
and where $\varphi'_1(f) \equiv g$. Then we obtain commutative diagrams
$$
\vcenter{
\xymatrix{
B'_2 \ar[r] & B_2 \\
B'_1 \ar[r] \ar[u] & B_1 \ar[u]
}
}
\quad\text{and}\quad
\vcenter{
\xymatrix{
A_2/fA_2 \ar[r]_{\varphi_2} & B_2/gB_2 \\
A_1/fA_1 \ar[r]^{\varphi_1} \ar[u] & B_2/gB_2 \ar[u]
}
}
$$
where $(B'_1 \subset B_1, \varphi_1)$ and $(B'_2 \subset B_2, \varphi_2)$
are constructed as in the proof of Lemma \ref{lemma-construct-extension}.
We omit the detailed verification.
\end{remark}


\begin{lemma}
\label{lemma-approximate-solution}
Let $p$ be a prime number. Let $A \subset B$ be an extension of discrete
valuation rings with fraction field extension $L/K$. Let $K_2/K_1/K$ be
a tower of finite field extensions. Assume
\begin{enumerate}
\item $K$ has characteristic $p$,
\item $L/K$ is separable,
\item $B$ is Nagata,
\item $K_2$ is a solution for $A \subset B$,
\item $K_2/K_1$ is purely inseparable of degree $p$.
\end{enumerate}
Then there exists a separable extension $K_3/K_1$
which is a solution for $A \subset B$.
\end{lemma}

\begin{proof}
Let us use notation as in Remark \ref{remark-construction}; we will use all
the observations made there. Since $L/K$ is separable, the algebra
$L_1 = L \otimes_K K_1$ is reduced
(Algebra, Lemma \ref{algebra-lemma-separable-extension-preserves-reducedness}).
Since $B$ is Nagata, the ring extension $B \subset B_1$ is finite
where $B_1$ is the integral closure of $B$ in $L_1$
and $B_1$ is a Nagata ring. Similarly, the ring $A$ is Nagata by
Lemma \ref{lemma-nagata-goes-down} hence $A \subset A_1$ is finite
and $A_1$ is a Nagata ring too. Moreover, the same assertions are true
for $K_2$, i.e., $L_2 = L \otimes_K K_2$ is reduced,
the ring extensions $A_1 \subset A_2$ and $B_1 \subset B_2$
are finite where $A_2$, resp.\ $B_2$ is the integral closure of
$A$, resp.\ $B$ in $K_2$, resp.\ $L_2$.

\medskip\noindent
Let $\pi \in A$ be a uniformizer. Observe that $\pi$ is a nonzerodivisor
on $K_1$, $K_2$, $A_1$, $A_2$, $L_1$, $L_2$, $B_1$, and $B_2$ and we have
$K_1 = (A_1)_\pi$, $K_2 = (A_2)_\pi$, $L_1 = (B_1)_\pi$, and $L_2 = (B_2)_\pi$.
We may write $K_2 = K_1(\alpha)$ where $\alpha^p = a_1 \in K_1$, see
Fields, Lemma \ref{fields-lemma-finite-purely-inseparable}.
After multiplying $\alpha$ by a power of $\pi$ we may and do assume
$a_1 \in A_1$. For the rest of the proof it is convenient to write
$K_2 = K_1[x]/(x^p - a_1)$ and $L_2 = L_1[x]/(x^p - a_1)$.
Consider the extensions of rings
$$
A'_2 = A_1[x]/(x^p - a_1) \subset A_2
\quad\text{and}\quad
B'_2 = B_1[x]/(x^p - a_1) \subset B_2
$$
We may apply Lemma \ref{lemma-construct-extension} to
$A'_2 \subset A_2$ and $f = \pi^2$ and to $B'_2 \subset B_2$ and $f = \pi^2$.
Choose an integer $n$ large enough which works for both of these.

\medskip\noindent
Consider the algebras
$$
K_3 = K_1[x]/(x^p - \pi^{2n} x - a_1)
\quad\text{and}\quad
L_3 = L_1[x]/(x^p - \pi^{2n} x - a_1)
$$
Observe that $K_3/K_1$ and $L_3/L_1$ are finite \'etale algebra extensions of
degree $p$. Consider the subrings
$$
A'_3 = A_1[x]/(x^p - \pi^n x - a_1)
\quad\text{and}\quad
B'_3 = B_1[x]/(x^p - \pi^n x - a_1)
$$
of $K_3 = (A'_2)_\pi$ and $L_3 = (B'_3)_\pi$. We are going to construct
a commutative diagram
$$
\xymatrix{
B'_2/\pi^{2n} B'_2 \ar[r]_{\psi'} & B'_3/\pi^{2n} B'_3 \\
A'_2/\pi^{2n} A'_2 \ar[r]^{\varphi'} \ar[u] & A'_3/\pi^{2n} A'_3 \ar[u]
}
$$
Namely, $\varphi'$ is the unique $A_1$-algebra isomorphism
sending the class of $x$ to the class of $x$.
Simiarly, $\psi'$ is the unique $B_1$-algebra isomorphism sending
the class of $x$ to the class of $x$. By our choice of $n$ we obtain, via
Lemma \ref{lemma-construct-extension} and
Remark \ref{remark-functoriality-construct-extension}
finite ring extensions $A'_3 \subset A_3$ and $B'_3 \subset B_3$
such that $A'_3 \to B'_3$ extends to a ring map $A_3 \to B_3$
and a commutative diagram
$$
\xymatrix{
B_2/\pi^2 B_2 \ar[r]_\psi & B_3/\pi^2B_3 \\
A_2/\pi^2 A_2 \ar[r]^\varphi \ar[u] & A_3/\pi^2A_3 \ar[u]
}
$$
with all the properties asserted in the references mentioned above
(in particular $\varphi$ and $\psi$ are isomorphisms).

\medskip\noindent
With all of this data in hand, we can finish the proof. Namely, we
first observe that $A_3$ and $B_3$ are finite products of
Dedekind domains with $\pi$ contained in all of the maximal ideals.
Namely, if $\mathfrak p \subset A_3$ is a maximal ideal, then
$\pi \in \mathfrak p$ as $A \to A_3$ is finite. Then $\mathfrak p/\pi^2 A_3$
corresponds via $\varphi$ to a maximal ideal in $A_2 / \pi^2A_2$
which is principal as $A_2$ is a finite product of Dedekind domains.
We conclude that $\mathfrak p/\pi^2 A_3$ is principal and hence by Nakayama 
we see that $\mathfrak p (A_3)_\mathfrak p$ is principal.
The same argument works for $B_3$. We conclude that
$A_3$ is the integral closure of $A$ in $K_3$
and that $B_3$ is the integral closure of $B$ in $L_3$.
Let $\mathfrak q \subset B_3$ be a maximal ideal lying
over $\mathfrak p \subset A_3$. To finish the proof we have
to show that $(A_3)_\mathfrak p \to (B_3)_\mathfrak q$ is
formally smooth in the $\mathfrak q$-adic topology. By the criterion of
Lemma \ref{lemma-extension-dvrs-formally-smooth} it suffices to show that
$\mathfrak p (B_3)_\mathfrak q = \mathfrak q (B_3)_\mathfrak q$
and that the field extension $\kappa(\mathfrak q)/\kappa(\mathfrak p)$
is separable. This is true because we may check both assertions
by looking at the ring map $A_3/\pi^2 A_3 \to B_3/\pi^2 B_3$
and this is isomorphic to the ring map
$A_2/\pi^2 A_2 \to B_2/\pi^2 B_2$ where the corresponding
statement holds by our assumption that $K_2$
is a solution for $A \subset B$. Some details omitted.
\end{proof}

\begin{lemma}
\label{lemma-separable-solution-separable-solution}
Let $A \subset B$ be an extension of discrete valuation rings.
Assume
\begin{enumerate}
\item the extension $L/K$ of fraction fields is separable,
\item $B$ is Nagata, and
\item there exists a solution for $A \subset B$.
\end{enumerate}
Then there exists a separable solution for $A \subset B$.
\end{lemma}

\begin{proof}
The lemma is trivial if the characteristic of $K$ is zero; thus we may
and do assume that the characteristic of $K$ is $p > 0$.

\medskip\noindent
Let $K_2/K$ be a solution for $A \to B$. We will use induction on the
inseparable degree $[K_2 : K]_i$
(Fields, Definition \ref{fields-definition-insep-degree}) of $K_2/K$.
If $[K_2 : K]_i = 1$, then $K_2$ is separable over $K$ and we are done.
If not, then there exists a subfield $K_2/K_1/K$ such that $K_2/K_1$
is purely inseparable of degree $p$
(Fields, Lemmas \ref{fields-lemma-separable-first} and
\ref{fields-lemma-finite-purely-inseparable}). By
Lemma \ref{lemma-approximate-solution}
there exists a separable extension $K_3/K_1$ which is a
solution for $A \subset B$. Then
$[K_3 : K]_i = [K_1 : K]_i = [K_2 : K]_i/p$
(Fields, Lemma \ref{fields-lemma-multiplicativity-all-degrees})
is smaller and we conclude by induction.
\end{proof}

\begin{lemma}
\label{lemma-big-extension-is-ok}
Let $A \to B$ be an extension of discrete valuation rings with fraction
fields $K \subset L$. Assume $B$ is essentially of finite type over $A$.
Let $K'/K$ be an algebraic extension of fields such that
the integral closure $A'$ of $A$ in $K'$ is Noetherian. Then the integral
closure $B'$ of $B$ in $L' = (L \otimes_K K')_{red}$ is Noetherian
as well. Moreover, the map $\Spec(B') \to \Spec(A')$
is surjective and the corresponding residue field extensions are finitely
generated field extensions.
\end{lemma}

\begin{proof}
Let $A \to C$ be a finite type ring map such that $B$ is a localization of
$C$ at a prime $\mathfrak p$. Then $C' = C \otimes_A A'$ is a finite type
$A'$-algebra, in particular Noetherian. Since $A \to A'$ is integral, so
is $C \to C'$. Thus $B = C_\mathfrak p \subset C'_\mathfrak p$ is
integral too. It follows that the dimension of $C'_\mathfrak p$ is $1$
(Algebra, Lemma \ref{algebra-lemma-integral-sub-dim-equal}).
Of course $C'_\mathfrak p$ is Noetherian.
Let $\mathfrak q_1, \ldots, \mathfrak q_n$ be the minimal primes
of $C'_\mathfrak p$. Let $B'_i$ be the integral closure of
$B = C_\mathfrak p$, or equivalently by the above of $C'_\mathfrak p$
in the field of fractions of $C'_{\mathfrak p'}/\mathfrak q_i$.
It follows from Krull-Akizuki
(Algebra, Lemma \ref{algebra-lemma-krull-akizuki} applied
to the finitely many localizations of $C'_\mathfrak p$ at its
maximal ideals) that each $B'_i$ is Noetherian.
Moreover the residue field extensions in $C'_\mathfrak p \to B'_i$
are finite by
Algebra, Lemma \ref{algebra-lemma-finite-extension-residue-fields-dimension-1}.
Finally, we observe that $B' = \prod B'_i$ is the integral closure of $B$ in
$L' = (L \otimes_K K')_{red}$.
\end{proof}

\begin{proposition}
\label{proposition-epp-essentially-finite-type}
\begin{reference}
See \cite[Lemma 2.13]{alterations} for a special case.
\end{reference}
Let $A \to B$ be an extension of discrete valuation rings with fraction
fields $K \subset L$. If $B$ is essentially of finite type over $A$, then
there exists a finite extension $K_1/K$ which is a solution for
$A \to B$ as defined in
Definition \ref{definition-solution}.
\end{proposition}

\begin{proof}
Observe that a weak solution is a solution if the residue field of $A$
is perfect, see Lemma \ref{lemma-extension-dvrs-formally-smooth}.
Thus the proposition follows immediately from Theorem \ref{theorem-epp}
if the residue characteristic of $A$ is $0$ (and in fact we do not need
the assumption that $A \to B$ is essentially of finite type).
If the residue characteristic of $A$ is $p > 0$ we will also deduce it from
Epp's theorem.

\medskip\noindent
Let $x_i \in A$, $i \in I$ be a set of elements mapping to a $p$-base of
the residue field $\kappa$ of $A$. Set
$$
A' = \bigcup\nolimits_{n \geq 1} A[t_{i, n}]/(t_{i, n}^{p^n} - x_i)
$$
where the transition maps send $t_{i, n + 1}$ to $t_{i, n}^p$. Observe
that $A'$ is a filtered colimit of weakly unramified finite extensions
of discrete valuation rings over $A$. Thus $A'$ is a discrete valuation
ring and $A \to A'$ is weakly unramified. By construction the residue field
$\kappa' = A'/\mathfrak m_A A'$ is the perfection of $\kappa$.

\medskip\noindent
Let $K'$ be the fraction field of $A'$.
We may apply Lemma \ref{lemma-big-extension-is-ok}
to the extension $K'/K$. Thus $B'$ is a finite product of
Dedekind domains. Let $\mathfrak m_1, \ldots, \mathfrak m_n$ be the
maximal ideals of $B'$. Using Epp's theorem (Theorem \ref{theorem-epp})
we find a weak solution $K'_i/K'$ for each of the
extensions $A' \subset B'_{\mathfrak m_i}$. Since the residue field
of $A'$ is perfect, these are actually solutions. Let $K'_1/K'$
be a finite extension which contains each $K'_i$. Then $K'_1/K'$
is still a solution for each $A' \subset B'_{\mathfrak m_i}$ by
Lemma \ref{lemma-solution-goes-up}.

\medskip\noindent
Let $A'_1$ be the integral closure of $A$ in $K'_1$. Note that
$A'_1$ is a Dedekind domain by the discussion in
Remark \ref{remark-construction} applied to $K' \subset K'_1$.
Thus Lemma \ref{lemma-big-extension-is-ok} applies to $K'_1/K$.
Therefore the integral closure $B'_1$ of $B$ in
$L'_1 = (L \otimes_K K'_1)_{red}$ is a Dedekind domain and because
$K'_1/K'$ is a solution for each $A' \subset B'_{\mathfrak m_i}$
we see that $(A'_1)_{A'_1 \cap \mathfrak m} \to (B'_1)_{\mathfrak m}$
is formally smooth in the $\mathfrak m$-adic topology
for each maximal ideal $\mathfrak m \subset B'_1$.

\medskip\noindent
By construction, the field $K'_1$ is a filtered colimit of finite
extensions of $K$. Say $K'_1 = \colim_{i \in I} K_i$. For each $i$ let
$A_i$, resp.\ $B_i$ be the integral closure of
$A$, resp.\ $B$ in $K_i$, resp.\ $L_i = (L \otimes_K K_i)_{red}$.
Then it is clear that
$$
A'_1 =  \colim A_i\quad\text{and}\quad B'_1 = \colim B_i
$$
Since the ring maps $A_i \to A'_1$ and $B_i \to B'_1$ are injective
integral ring maps and since $A'_1$ and $B'_1$ have finite spectra,
we see that for all $i$ large enough the ring maps
$A_i \to A'_1$ and $B_i \to B'_1$ are bijective on spectra.
Once this is true, for all $i$ large enough the maps
$A_i \to A'_1$ and $B_i \to B'_1$ will be weakly unramified
(once the uniformizer is in the image). It follows from multiplicativity
of ramification indices that $A_i \to B_i$ induces weakly unramified maps
on all localizations at maximal ideals of $B_i$ for such $i$.
Increasing $i$ a bit more we see that
$$
B_i \otimes_{A_i} A'_1 \longrightarrow B'_1
$$
induces surjective maps on residue fields (because the residue fields
of $B'_1$ are finitely generated over those of $A'_1$ by
Lemma \ref{lemma-big-extension-is-ok}). Picture of residue
fields at maximal ideals lying under a chosen maximal ideal
of $B'_1$:
$$
\xymatrix{
\kappa_{B_i} \ar[r] &
\kappa_{B_{i'}} \ar[r] &
 & \ldots &
\kappa_{B'_1} \\
\kappa_{A_i} \ar[r] \ar[u] &
\kappa_{A_{i'}} \ar[r] \ar[u] &
 & \ldots &
\kappa_{A'_1} \ar[u]
}
$$
Thus $\kappa_{B_i}$ is a finitely generated extension of
$\kappa_{A_i}$ such that the compositum of $\kappa_{B_i}$
and $\kappa_{A'_1}$ in $\kappa_{B'_1}$ is separable over
$\kappa_{A'_1}$. Then that happens already at a finite stage:
for example, say $\kappa_{B'_1}$ is finite separable over
$\kappa_{A'_1}(x_1, \ldots, x_n)$, then just increase $i$
such that $x_1, \ldots, x_n$ are in $\kappa_{B_i}$ and such that
all generators satisfy separable polynomial equations over
$\kappa_{A_i}(x_1, \ldots, x_n)$. This means that
$A_i \to (B_i)_\mathfrak m$ is formally smooth in the $\mathfrak m$-adic
topology for all maximal ideals $\mathfrak m$ of
$B_i$ and the proof is complete.
\end{proof}

\begin{lemma}
\label{lemma-epp-essentially-finite-type-separable}
Let $A \to B$ be an extension of discrete valuation rings with fraction
fields $K \subset L$. Assume
\begin{enumerate}
\item $B$ is essentially of finite type over $A$,
\item either $A$ or $B$ is a Nagata ring, and
\item $L/K$ is separable.
\end{enumerate}
Then there exists a separable solution for $A \to B$
(Definition \ref{definition-solution}).
\end{lemma}

\begin{proof}
Observe that if $A$ is Nagata, then so is $B$
(Algebra, Lemma \ref{algebra-lemma-nagata-localize} and
Proposition \ref{algebra-proposition-nagata-universally-japanese}).
Thus the lemma follows on combining
Proposition \ref{proposition-epp-essentially-finite-type}
and
Lemma \ref{lemma-separable-solution-separable-solution}.
\end{proof}







\section{Picard groups of rings}
\label{section-picard}

\noindent
We first define invertible modules as follows.

\begin{definition}
\label{definition-invertible}
Let $R$ be a ring. An $R$-module $M$ is {\it invertible} if the functor
$$
\text{Mod}_R \longrightarrow \text{Mod}_R,\quad
N \longmapsto M \otimes_R N
$$
is an equivalence of categories. An invertible $R$-module is said to be
{\it trivial} if it is isomorphic to $R$ as an $R$-module.
\end{definition}

\begin{lemma}
\label{lemma-invertible}
Let $R$ be a ring. Let $M$ be an $R$-module. Equivalent are
\begin{enumerate}
\item $M$ is finite locally free module of rank $1$,
\item $M$ is invertible, and
\item there exists an $R$-module $N$ such that $M \otimes_R N \cong R$.
\end{enumerate}
Moreover, in this case the module $N$ in (3) is isomorphic
to $\Hom_R(M, R)$.
\end{lemma}

\begin{proof}
Assume (1). Consider the module $N = \Hom_R(M, R)$ and the evaluation
map $M \otimes_R N = M \otimes_R \Hom_R(M, R) \to R$. If $f \in R$
such that $M_f \cong R_f$, then the evaluation map becomes an isomorphism
after localization at $f$ (details omitted). Thus we see the evaluation
map is an isomorphism by Algebra, Lemma \ref{algebra-lemma-cover}.
Thus (1) $\Rightarrow$ (3).

\medskip\noindent
Assume (3). Then the functor $K \mapsto K \otimes_R N$ is a quasi-inverse
to the functor $K \mapsto K \otimes_R M$. Thus (3) $\Rightarrow$ (2).
Conversely, if (2) holds, then $K \mapsto K \otimes_R M$ is essentially
surjective and we see that (3) holds.

\medskip\noindent
Assume the equivalent conditions (2) and (3) hold. Denote
$\psi : M \otimes_R N \to R$ the isomorphism from (3).
Choose an element $\xi = \sum_{i = 1, \ldots, n} x_i \otimes y_i$
such that $\psi(\xi) = 1$. Consider the isomorphisms
$$
M \to M \otimes_R M \otimes_R N \to M
$$
where the first arrow sends $x$ to $\sum x_i \otimes x \otimes y_i$
and the second arrow sends $x \otimes x' \otimes y$ to $\psi(x' \otimes y)x$.
We conclude that $x \mapsto \sum \psi(x \otimes y_i)x_i$ is
an automorphism of $M$. This automorphism factors as
$$
M \to R^{\oplus n} \to M
$$
where the first arrow is given by
$x \mapsto (\psi(x \otimes y_1), \ldots, \psi(x \otimes y_n))$
and the second arrow by $(a_1, \ldots, a_n) \mapsto \sum a_i x_i$.
In this way we conclude that $M$ is a direct summand of a finite free
$R$-module. This means that $M$ is finite locally free
(Algebra, Lemma \ref{algebra-lemma-finite-projective}).
Since the same is true for $N$ by symmetry and since
$M \otimes_R N \cong R$, we see that
$M$ and $N$ both have to have rank $1$.
\end{proof}

\noindent
The set of isomorphism classes of these
modules is often called the {\it class group} or {\it Picard group}
of $R$. The group structure is determined by assigning to
the isomorphism classes of the invertible modules $L$ and $L'$
the isomorphism class of $L \otimes_R L'$.
The inverse of an invertible module $L$ is the module
$$
L^{\otimes -1} = \Hom_R(L, R),
$$
because as seen in the proof of Lemma \ref{lemma-invertible}
the evaluation map $L \otimes_R L^{\otimes -1} \to R$ is an isomorphism.
Let us denote the Picard group of $R$ by $\Pic(R)$.

\begin{lemma}
\label{lemma-UFD-Pic-trivial}
Let $R$ be a UFD. Then $\Pic(R)$ is trivial.
\end{lemma}

\begin{proof}
Let $L$ be an invertible $R$-module. By Lemma \ref{lemma-invertible}
we see that $L$ is a finite locally free $R$-module. In particular
$L$ is torsion free and finite over $R$. Pick a nonzero element
$\varphi \in \Hom_R(L, R)$ of the dual invertible module.
Then $I = \varphi(L) \subset R$ is an ideal which is an invertible module.
Pick a nonzero $f \in I$ and let
$$
f = u p_1^{e_1} \ldots p_r^{e_r}
$$
be the factorization into prime elements with $p_i$ pairwise distinct.
Since $L$ is finite locally free there exist $a_i \in R$,
$a_i \not \in (p_i)$ such that $I_{a_i} = (g_i)$ for some $g_i \in R_{a_i}$.
Then $p_i$ is still a prime element of the UFD $R_{a_i}$ and
we can write $g_i = p_i^{c_i} g'_i$ for some $g'_i \in R_{a_i}$
not divisible by $p_i$. Since $f \in I_{a_i}$ we see that $e_i \geq c_i$.
We claim that $I$ is generated by $h = p_1^{c_1} \ldots p_r^{c_r}$ which
finishes the proof.

\medskip\noindent
To prove the claim it suffices to show that $I_a$ is generated by $h$
for any $a \in R$ such that $I_a$ is a principal ideal
(Algebra, Lemma \ref{algebra-lemma-cover}). Say $I_a = (g)$.
Let $J \subset \{1, \ldots, r\}$ be the set of $i$ such that
$p_i$ is a nonunit (and hence a prime element) in $R_a$. Because
$f \in I_a = (g)$ we find the prime factorization
$g = v \prod_{i \in J} p_j^{b_j}$
with $v$ a unit and $b_j \leq e_j$. For each $j \in J$ we have
$I_{aa_j} = g R_{aa_j} = g_j R_{aa_j}$, in other words
$g$ and $g_j$ map to associates in $R_{aa_j}$. By uniqueness
of factorization this implies that $b_j = c_j$ and the proof is complete.
\end{proof}







\section{Determinants}
\label{section-determinants}

\noindent
Let $R$ be a ring. Let $M$ be a finite projective $R$-module.
There exists a product decomposition $R = R_0 \times \ldots \times R_t$
such that in the corresponding decomposition $M = M_0 \times \ldots \times M_t$
of $M$ we have that $M_i$ is finite locally free of rank $i$ over $R_i$.
This follows from Algebra, Lemma \ref{algebra-lemma-finite-projective}
(to see that the rank is locally constant) and
Algebra, Lemmas \ref{algebra-lemma-disjoint-decomposition} and
\ref{algebra-lemma-disjoint-implies-product} (to decompose
$R$ into a product). In this situation we define
$$
\det(M) = \wedge^0_{R_0}(M_0) \times \ldots \times \wedge^t_{R_t}(M_t)
$$
as an $R$-module. This is a finite locally free module of rank $1$
as each term is finite locally free of rank $1$.
If $\varphi : M \to N$ is an isomorphism of finite projective
$R$-modules, then we obtain a canonical isomorphism
$$
\det(\varphi) : \det(M) \longrightarrow \det(N)
$$
of locally free modules of rank $1$. More generally, if
for all primes $\mathfrak p$ of $R$ the ranks of the free modules
$M_\mathfrak p$ and $N_\mathfrak p$ are the same, then any $R$-module
homomorphism $\varphi : M \to N$ induces an $R$-module map
$\det(\varphi) : \det(M) \to \det(N)$. Finally, if $M = N$
then $\det(\varphi) : \det(M) \to \det(M)$ is an endomorphism
of an invertible $R$-module. Since $R = \Hom_R(L, L)$
for an invertible $R$-module we may and do view $\det(\varphi)$
as an element of $R$. In this way we obtain the {\it determinant}
$$
\det : \Hom_R(M, M) \longrightarrow R
$$
which is a multiplicative map.

\begin{remark}
\label{remark-determinant-as-socle}
Let $R$ be a ring. Let $M$ be a finite projective $R$-module.
Then we can consider the graded commutative $R$-algebra
exterior algebra $\wedge^*_R(M)$ on $M$ over $R$.
A formula for $\det(M)$ is that $\det(M) \subset \wedge^*_R(M)$
is the annihilator of $M \subset \wedge^*_R(M)$.
This is sometimes useful as it does not refer to the
decomposition of $R$ into a product. Of course, to
prove this satisfies the desired properties one has to
either decompose $R$ into a product (as above), or one
has to look at the localizations at primes of $R$.
\end{remark}

\noindent
Next, we consider what happens to the determinant give
a short exact sequence of finite projective modules.

\begin{lemma}
\label{lemma-det-ses}
Let $R$ be a ring. Let
$$
0 \to M' \to M \to M'' \to 0
$$
be a short exact sequence of finite projective $R$-modules. Then there
is a canonical isomorphism
$$
\gamma : \det(M') \otimes \det(M'') \longrightarrow \det(M)
$$
\end{lemma}

\begin{proof}[First proof]
First proof. Decompose $R$ into a product of rings $R_{ij}$ such that
$M' = \prod M'_{ij}$ and $M'' = \prod M''_{ij}$ where
$M'_{ij}$ has rank $i$ and $M''_{ij}$ has rank $j$.
Of course then $M = \prod M_{ij}$ and $M_{ij}$ has rank $i + j$.
This reduces us to the case where $M'$ and $M''$ have constant
rank say $i$ and $j$. In this case we have to construct a canonical
map
$$
\wedge^i(M') \otimes \wedge^j(M'') \longrightarrow \wedge^{i + j}(M)
$$
To do this choose $m'_1, \ldots, m'_i$ in $M'$ and
$m''_1, \ldots, m''_j$ in $M''$. Denote $m_1, \ldots, m_i \in M$
the images of $m'_1, \ldots, m'_i$ and denote
$m_{i + 1}, \ldots , m_{i + j} \in M$ elements mapping to
$m''_1, \ldots, m''_j$ in $M''$. Our rule will be that
$$
m'_1 \wedge \ldots \wedge m'_i \otimes
m''_1 \wedge \ldots \wedge m''_j
\longmapsto
m_1 \wedge \ldots \wedge m_{i + j}
$$
We omit the detailed proof that this is well defined and an isomorphism.
\end{proof}

\begin{proof}[Second proof]
We will use the description of $\det(M)$, $\det(M')$, and $\det(M'')$
given in Remark \ref{remark-determinant-as-socle}. Consider the $R$-algebra
maps $\wedge^*_R(M') \to \wedge^*_R(M)$ and
$\wedge^*_R(M) \to \wedge^*_R(M'')$. The first is injective and the
second is surjective. Take an element $x' \in \det(M') \subset \wedge^*_R(M')$
and an element $x'' \in \det(M'') \subset \wedge^*_R(M'')$.
Choose an element $y'' \in \wedge^*(M)$ mapping to $x''$ and set
$$
\gamma(x' \otimes x'') = x' \wedge y'' \in \det(M) \subset \wedge^*_R(M)
$$
The reader verifies easily by looking at localizations at primes
that this well defined and an isomorphism. Moreover, this construction
gives the same map as the construction given in the first proof.
\end{proof}

\begin{lemma}
\label{lemma-det-ses-functorial}
Let $R$ be a ring. Let
$$
\xymatrix{
0 \ar[r] &
M' \ar[r] \ar[d]^u &
M \ar[r] \ar[d]^v &
M'' \ar[r] \ar[d]^w &
0 \\
0 \ar[r] &
K' \ar[r] &
K \ar[r] &
K'' \ar[r] &
0
}
$$
be a commutative diagram of finite projective $R$-modules
whose vertical arrows are isomorphisms. Then we get a commutative
diagram of isomorphisms
$$
\xymatrix{
\det(M') \otimes \det(M'') \ar[r]_-\gamma \ar[d]_{\det(u) \otimes \det(w)} &
\det(M) \ar[d]^{\det(v)} \\
\det(K') \otimes \det(K'') \ar[r]^-\gamma & \det(K)
}
$$
where the horizontal arrows are the ones constructed
in Lemma \ref{lemma-det-ses}.
\end{lemma}

\begin{proof}
Omitted. Hint: use the second construction of the maps $\gamma$
in Lemma \ref{lemma-det-ses}.
\end{proof}

\begin{lemma}
\label{lemma-det-filtration}
Let $R$ be a ring. Let
$$
K \subset L \subset M
$$
be $R$-modules such that $K$, $L/K$, and $M/L$ are finite projective
$R$-modules. Then the diagram
$$
\xymatrix{
\det(K) \otimes \det(L/K) \otimes \det(M/L) \ar[r] \ar[d] &
\det(L) \otimes \det(M/L) \ar[d] \\
\det(K) \otimes \det(M/K) \ar[r] &
\det(M)
}
$$
commutes where the maps are those of Lemma \ref{lemma-det-ses}.
\end{lemma}

\begin{proof}
Omitted. Hint: after localizing at a prime of $R$ we can assume
$K \subset L \subset M$ is isomorphic to
$R^{\oplus a} \subset R^{\oplus a + b}  \subset R^{\oplus a + b + c}$
and in this case the result is an evident computation.
\end{proof}

\begin{lemma}
\label{lemma-det-direct-sum}
Let $R$ be a ring. Let $M'$ and $M''$ be two finite projective
$R$-modules. Then the diagram
$$
\xymatrix{
\det(M') \otimes \det(M'') \ar[r]
\ar[d]_{\epsilon \cdot (\text{switch tensors})} &
\det(M' \oplus M'') \ar[d]^{\det(\text{swith summands})} \\
\det(M'') \otimes \det(M') \ar[r] &
\det(M'' \oplus M')
}
$$
commutes where $\epsilon = \det( -\text{id}_{M' \otimes M''}) \in R^*$
and the horizontal arrows are those of Lemma \ref{lemma-det-ses}.
\end{lemma}

\begin{proof}
Omitted.
\end{proof}

\begin{lemma}
\label{lemma-det-switch}
Let $R$ be a ring. Let $M$, $N$ be finite projective $R$-modules.
Let $a : M \to N$ and $b : N \to M$ be $R$-linear maps.
Then
$$
\det(\text{id} + a \circ b) = \det(\text{id} + b \circ a)
$$
as elements of $R$.
\end{lemma}

\begin{proof}
It suffices to prove the assertion after replacing $R$ by a localization
at a prime ideal. Thus we may assume $R$ is local and $M$ and $N$ are
finite free. In this case we have to prove the equality
$$
\det(I_n + AB) = \det(I_m + BA)
$$
of usual determinants of matrices where $A$ has size $n \times m$
and $B$ has size $m \times n$. This reduces to the case
of the ring $R = \mathbf{Z}[a_{ij}, b_{ji}; 1 \leq i \leq n, 1 \leq j \leq m]$
where $a_{ij}$ and $b_{ij}$ are variables and the entries of the
matrices $A$ and $B$. Taking the fraction field, this reduces to the
case of a field of characteristic zero. In characteristic zero there
is a universal polynomial expressing the determinant of a matrix
of size $\leq N$ in the traces of the powers of said matrix.
Hence it suffices to prove
$$
\text{Trace}((I_n + AB)^k) = \text{Trace}((I_m + BA)^k)
$$
for all $k \geq 1$. Expanding we see that it suffices to prove
$\text{Trace}((AB)^k) = \text{Trace}((BA)^k)$ for all $k \geq 0$.
For $k = 1$ this is the well known fact that
$\text{Trace}(AB) = \text{Trace}(BA)$. For $k > 1$
it follows from this by writing $(AB)^k = A(BA)^{k - 1}B$
and $(BA)^k = (BA)^{k - 1} A B$.
\end{proof}

\noindent
Recall that we have defined in Algebra, Section \ref{algebra-section-K-groups}
a group $K_0(R)$ as the free group on isomorphism classes
of finite projective $R$-modules modulo the relations
$[M'] + [M''] = [M' \oplus M'']$.

\begin{lemma}
\label{lemma-det}
Let $R$ be a ring. There is a map
$$
\det : K_0(R) \longrightarrow \Pic(R)
$$
which maps $[M]$ to the class of the invertible module
$\wedge^n(M)$ if $M$ is a finite locally free module of rank $n$.
\end{lemma}

\begin{proof}
This follows immediately from the constructions above and in particular
Lemma \ref{lemma-det-ses} to see that the relations are mapped to $0$.
\end{proof}





\section{Perfect complexes and K-groups}
\label{section-perfect-K-group}

\noindent
We quickly show that the zeroth K-group of the derived category of
perfect complexes of a ring $R$ is the same as $K_0(R)$ defined in
Algebra, Section \ref{algebra-section-K-groups}.

\begin{lemma}
\label{lemma-perfect-to-K-group}
Let $R$ be a ring. There is a map
$$
c : \text{perfect complexes over }R \longrightarrow K_0(R)
$$
with the following properties
\begin{enumerate}
\item $c(K[n]) = (-1)^nc(K)$ for a perfect complex $K$,
\item if $K \to L \to M \to K[1]$ is a distinguished triangle of
perfect complexes, then $c(L) = c(K) + c(M)$,
\item if $K$ is represented by a finite complex $M^\bullet$
consisting of finite projective modules, then
$c(K) = \sum (-1)^i[M_i]$.
\end{enumerate}
\end{lemma}

\begin{proof}
Let $K$ be a perfect object of $D(R)$. By definition we can represent
$K$ by a finite complex $M^\bullet$ of finite projective $R$-modules.
We define $c$ by setting
$$
c(K) = \sum (-1)^n[M^n]
$$
in $K_0(R)$. Of course we have to show that this is well defined,
but once it is well defined, then (1) and (3) are immediate.
For the moment we view the map $c$ as defined on complexes of
finite projective $R$-modules.

\medskip\noindent
Suppose that $L^\bullet \to M^\bullet$ is a surjective map
of finite complexes of finite projective $R$-modules.
Let $K^\bullet$ be the kernel. Then we obtain short exact
sequences of $R$-modules
$$
0 \to K^n \to L^n \to M^n \to 0
$$
which are split because $M^n$ is projective. Hence $K^\bullet$
is also a finite complex of finite projective $R$-modules and
$c(L^\bullet) = c(K^\bullet) + c(M^\bullet)$ in $K_0(R)$.

\medskip\noindent
Suppose given finite complex $M^\bullet$ of finite projective $R$-modules
which is acyclic. Say $M^n = 0$ for $n \not \in [a, b]$. Then we
can break $M^\bullet$ into short exact sequences
$$
\begin{matrix}
0 \to M^a \to M^{a + 1} \to N^{a + 1} \to 0, \\
0 \to N^{a + 1} \to M^{a + 2} \to N^{a + 3} \to 0, \\
\ldots \\
0 \to N^{b - 3} \to M^{b - 2} \to N^{b - 2} \to 0, \\
0 \to N^{b - 2} \to M^{b - 1} \to M^b \to 0
\end{matrix}
$$
Arguing by descending induction we see that $N^{b - 2}, \ldots, N^{a + 1}$
are finite projective $R$-modules, the sequences are split exact, and
$$
c(M^\bullet) = \sum (-1)[M^n] = \sum (-1)^n([N^{n - 1}] + [N^n]) = 0
$$
Thus our construction gives zero on acyclic complexes.

\medskip\noindent
It follows formally from the results of the preceding two
paragraphs that $c$ is well defined and satisfies (2). Namely,
suppose the finite complexes $M^\bullet$ and $L^\bullet$ of
finite projective $R$-modules represent the same object
of $D(R)$. Then we can represent the isomorphism by a map
$f : M^\bullet \to L^\bullet$ of complexes, see
Derived Categories, Lemma \ref{derived-lemma-morphisms-from-projective-complex}.
We obtain a short exact sequence of complexes
$$
0 \to L^\bullet \to C(f)^\bullet \to K^\bullet[1] \to 0
$$
see Derived Categories, Definition \ref{derived-definition-cone}.
Since $f$ is a quasi-isomorphism, the cone $C(f)^\bullet$ is
acyclic (this follows for example from the discussion in
Derived Categories, Section \ref{derived-section-canonical-delta-functor}).
Hence
$$
0 = c(C(f)^\bullet) = c(L^\bullet) + c(K^\bullet[1]) =
c(L^\bullet) - c(K^\bullet)
$$
as desired. We omit the proof of (2) which is similar.
\end{proof}

\noindent
The following lemma shows that $K_0(R)$ is equal to
$K_0(D_{perf}(R))$.

\begin{lemma}
\label{lemma-perfect-to-K-group-universal}
Let $R$ be a ring. Let $D_{perf}(R)$ be the derived category of
perfect objects, see Lemma \ref{lemma-perfect-ring-classical-generator}.
The map $c$ of Lemma \ref{lemma-perfect-to-K-group} gives an isomorphism
$K_0(D_{perf}(R)) = K_0(R)$.
\end{lemma}

\begin{proof}
It follows from the definition of $K_0(D_{perf}(R))$
(Derived Categories, Definition \ref{derived-definition-K-zero})
that $c$ induces a homomorphism $K_0(D_{perf}(R)) \to K_0(R)$.

\medskip\noindent
Given a finite projective module $M$ over $R$ let us denote
$M[0]$ the perfect complex over $R$ which has $M$ sitting in degree $0$
and zero in other degrees. Given a short exact sequence
$0 \to M \to M' \to M'' \to 0$ of finite projective modules
we obtain a distinguished triangle $M[0] \to M'[0] \to M''[0] \to M[1]$, see
Derived Categories, Section \ref{derived-section-canonical-delta-functor}.
This shows that we obtain a map $K_0(R) \to K_0(D_{perf}(R))$
by sending $[M]$ to $[M[0]]$ with apologies for the horrendous notation.

\medskip\noindent
It is clear that $K_0(R) \to K_0(D_{perf}(R)) \to K_0(R)$ is the identity.
On the other hand, if $M^\bullet$ is a bounded complex of finite projective
$R$-modules, then the the existence of the distinguished triangles
of ``stupid truncations''
(see Homology, Section \ref{homology-section-truncations})
$$
\sigma_{\geq n}M^\bullet \to \sigma_{\geq n - 1}M^\bullet \to
M^{n - 1}[-n + 1] \to (\sigma_{\geq n}M^\bullet)[1]
$$
and induction show that
$$
[M^\bullet] = \sum (-1)^i[M^i[0]]
$$
in $K_0(D_{perf}(R))$ (with again apologies for the notation).
Hence the map $K_0(R) \to K_0(D_{perf}(R))$ is surjective which
finishes the proof.
\end{proof}







\section{Determinants of endomorphisms of finite length modules}
\label{section-determinants-finite-length}

\noindent
Let $(R, \mathfrak m, \kappa)$ be a local ring. Consider the category
of pairs $(M, \varphi)$ consisting of a finite length $R$-module
and an endomorphism $\varphi : M \to M$. This category is abelian
and every object is Artinian as well as Noetherian. See
Homology, Section \ref{homology-section-jordan-holder}
for definitions.

\medskip\noindent
If $(M, \varphi)$ is a simple object of this category, then
$M$ is annihilated by $\mathfrak m$ since otherwise
$(\mathfrak m M, \varphi|_{\mathfrak m M})$
would be a nontrivial suboject. Also $\dim_\kappa(M) = \text{length}_R(M)$
is finite. Thus we may define the determinant and the trace
$$
\det\nolimits_\kappa(\varphi),\quad \text{Trace}_\kappa(\varphi)
$$
as elements of $\kappa$
using linear algebra. Simlarly for
the characteristic polynomial of $\varphi$ in this case.

\medskip\noindent
By Homology, Lemma \ref{homology-lemma-finite-length} for an arbitrary object
$(M, \varphi)$ of our category we have a finite filtration
$$
0 \subset M_1 \subset \ldots \subset M_n = M
$$
by submodules stable under $\varphi$ such that
$(M_i/M_{i - 1}, \varphi_i)$ is a simple object of the category
where $\varphi_i : M_i/M_{i - 1} \to M_i/M_{i - 1}$
is the induced map. We define the {\it determinant} of $(M, \varphi)$
over $\kappa$ as
$$
\det\nolimits_\kappa(\varphi) = \prod \det\nolimits_\kappa(\varphi_i)
$$
with $\det_\kappa(\varphi_i)$ as defined in the previous paragraph.
We define the {\it trace} of $(M, \varphi)$ over $\kappa$ as
$$
\text{Trace}_\kappa(\varphi) = \sum \text{Trace}_\kappa(\varphi_i)
$$
with $\text{Trace}_\kappa(\varphi_i)$ as defined in the previous paragraph.
We can similarly define the characteristic polynomial of $\varphi$
over $\kappa$ as the product of the characteristic polynomials
of $\varphi_i$ as defined in the previous paragraph. By Jordan-H\"older
(Homology, Lemma \ref{homology-lemma-jordan-holder})
this is well defined.

\begin{lemma}
\label{lemma-ses}
Let $(R, \mathfrak m, \kappa)$ be a local ring.
Let $0 \to (M, \varphi) \to (M', \varphi') \to (M'', \varphi'') \to 0$
be a short exact sequence in the category discussed above.
Then
$$
\det\nolimits_\kappa(\varphi') =
\det\nolimits_\kappa(\varphi)\det\nolimits_\kappa(\varphi''),\quad
\text{Trace}_\kappa(\varphi') = \text{Trace}_\kappa(\varphi) + 
\text{Trace}_\kappa(\varphi'')
$$
Also, the characteristic polynomial
of $\varphi'$ over $\kappa$ is the product of the characteristic polynomials
of $\varphi$ and $\varphi''$.
\end{lemma}

\begin{proof}
Left as an exercise.
\end{proof}

\begin{lemma}
\label{lemma-multiplication}
Let $(R, \mathfrak m, \kappa) \to (R', \mathfrak m', \kappa')$
be a local homomorphism of local rings. Assume that $\kappa'/\kappa$
is a finite extension. Let $u \in R'$. Then for
any finite length $R'$-module $M'$ we have
$$
\det\nolimits_\kappa(u : M' \to M') =
\text{Norm}_{\kappa'/\kappa}(u \bmod \mathfrak m')^m
$$
where $m = \text{length}_{R'}(M')$.
\end{lemma}

\begin{proof}
Observe that the statement makes sense as
$\text{length}_R(M') = \text{length}_{R'}(M') [\kappa' : \kappa]$.
If $M' = \kappa'$, then the equality holds by definition of the
norm as the determinant of the linear operator given by multiplication
by $u$. In general one reduces to this case by chosing a suitable
filtration and using the multiplicativity of Lemma \ref{lemma-ses}.
Some details omitted.
\end{proof}

\begin{lemma}
\label{lemma-flat-base-change-det}
Let $(R, \mathfrak m, \kappa) \to (R', \mathfrak m', \kappa')$
be a flat local homomorphism of local rings such that
$m = \text{length}_{R'}(R'/\mathfrak mR') < \infty$.
For any $(M, \varphi)$ as above, the element
$\det_\kappa(\varphi)^m$ maps to
$\det_{\kappa'}(\varphi \otimes 1 : M \otimes_R R' \to M \otimes_R R')$
in $\kappa'$.
\end{lemma}

\begin{proof}
The flatness of $R \to R'$ assures us that short exact sequences
as in Lemma \ref{lemma-ses} base change to short exact sequences
over $R'$. Hence by the multiplicativity of Lemma \ref{lemma-ses}
we may assume that $(M, \varphi)$ is a simple object of our category
(see introduction to this section). In the simple case $M$ is annihilated
by $\mathfrak m$. Choose a filtration
$$
0 \subset I_1 \subset I_2 \subset \ldots \subset I_{m - 1} \subset
R'/\mathfrak mR'
$$
whose successive quotients are isomorphic to $\kappa'$ as $R'$-modules.
Then we obtain the filtration
$$
0 \subset
M \otimes_\kappa I_1 \subset
M \otimes_\kappa I_2 \subset
\ldots \subset
M \otimes_\kappa I_{m - 1} \subset
M \otimes_\kappa R'/\mathfrak mR' = M \otimes_R R'
$$
whose successive quotients are isomorphic to $M \otimes_\kappa \kappa'$.
Also, these submodules are invariant under $\varphi \otimes 1$.
By Lemma \ref{lemma-ses} we find
$$
\det\nolimits_{\kappa'}(\varphi \otimes 1 : M \otimes_R R' \to M \otimes_R R')
=
\det\nolimits_{\kappa'}(\varphi \otimes 1 :
M \otimes_\kappa \kappa' \to M \otimes_\kappa \kappa')^m =
\det\nolimits_\kappa(\varphi)^m
$$
The last equality holds by the compatibility of determinants
of linear maps with field extensions. This proves the lemma.
\end{proof}







\section{A regular local ring is a UFD}
\label{section-regular-local-UFD}

\noindent
We prove the result mentioned in the section title.

\begin{lemma}
\label{lemma-regular-local-Pic-zero}
Let $R$ be a regular local ring. Let $f \in R$.
Then $\Pic(R_f) = 0$.
\end{lemma}

\begin{proof}
Let $L$ be an invertible $R_f$-module. In particular $L$ is
a finite $R_f$-module. There exists a finite $R$-module
$M$ such that $M_f \cong L$, see
Algebra, Lemma \ref{algebra-lemma-construct-fp-module}.
By Algebra, Proposition \ref{algebra-proposition-regular-finite-gl-dim}
we see that $M$ has a finite free resolution $F_\bullet$ over $R$.
It follows that $L$ is quasi-isomorphic to a finite complex
of {\it free} $R_f$-modules. Hence by
Lemma \ref{lemma-perfect-to-K-group} we see that
$[L] = n[R_f]$ in $K_0(R)$ for some $n \in \mathbf{Z}$.
Applying the map of Lemma \ref{lemma-det}
we see that $L$ is trivial.
\end{proof}

\begin{lemma}
\label{lemma-regular-local-UFD}
A regular local ring is a UFD.
\end{lemma}

\begin{proof}
Recall that a regular local ring is a domain, see
Algebra, Lemma \ref{algebra-lemma-regular-domain}.
We will prove the unique factorization property
by induction on the dimension of the regular local ring $R$.
If $\dim(R) = 0$, then $R$ is a field and in particular a UFD.
Assume $\dim(R) > 0$. Let $x \in \mathfrak m$, $x \not \in \mathfrak m^2$.
Then $R/(x)$ is regular by Algebra, Lemma \ref{algebra-lemma-regular-ring-CM},
hence a domain by
Algebra, Lemma \ref{algebra-lemma-regular-domain},
hence $x$ is a prime element.
Let $\mathfrak p \subset R$ be a height $1$ prime. We have
to show that $\mathfrak p$ is principal, see
Algebra, Lemma \ref{algebra-lemma-characterize-UFD-height-1}.
We may assume $x \not \in \mathfrak p$, since if $x \in \mathfrak p$,
then $\mathfrak p = (x)$ and we are done.
For every nonmaximal prime $\mathfrak q \subset R$
the local ring $R_\mathfrak q$ is a regular local ring, see
Algebra, Lemma \ref{algebra-lemma-localization-of-regular-local-is-regular}.
By induction we see that $\mathfrak pR_\mathfrak q$ is principal.
In particular, the $R_x$-module $\mathfrak p_x = \mathfrak pR_x \subset R_x$
is a finitely presented $R_x$-module whose localization at
any prime is free of rank $1$. 
By Algebra, Lemma \ref{algebra-lemma-finite-projective}
we see that $\mathfrak p_x$ is an invertible $R_x$-module.
By Lemma \ref{lemma-regular-local-Pic-zero} we see that
$\mathfrak p_x = (y)$ for some $y \in R_x$.
We can write $y = x^e f$ for some $f \in \mathfrak p$ and $e \in \mathbf{Z}$.
Factor $f = a_1 \ldots a_r$ into irreducible elements of $R$
(Algebra, Lemma \ref{algebra-lemma-factorization-exists}).
Since $\mathfrak p$ is prime, we see that $a_i \in \mathfrak p$
for some $i$. Since $\mathfrak p_x = (y)$ is prime and
$a_i | y$ in $R_x$, it follows that $\mathfrak p_x$ is generated by
$a_i$ in $R_x$, i.e., the image of $a_i$ in $R_x$ is prime.
As $x$ is a prime element, we find that $a_i$ is prime in $R$ by
Algebra, Lemma \ref{algebra-lemma-invert-prime-elements}.
Since $(a_i) \subset \mathfrak p$ and $\mathfrak p$ has height
$1$ we conclude that $(a_i) = \mathfrak p$ as desired.
\end{proof}

\begin{lemma}
\label{lemma-picard-group-generic-fibre-regular}
Let $R$ be a valuation ring with fraction field $K$
and residue field $\kappa$. Let $R \to A$ be a
homomorphism of rings such that
\begin{enumerate}
\item $A$ is local and $R \to A$ is local,
\item $A$ is flat and essentially of finite type over $R$,
\item $A \otimes_R \kappa$ regular.
\end{enumerate}
Then $\Pic(A \otimes_R K) = 0$.
\end{lemma}

\begin{proof}
Let $L$ be an invertible $A \otimes_R K$-module. In particular $L$ is
a finite module. There exists a finite $A$-module
$M$ such that $M \otimes_R K \cong L$, see
Algebra, Lemma \ref{algebra-lemma-construct-fp-module}.
We may assume $M$ is torsion free as an $R$-module.
Thus $M$ is flat as an $R$-module
(Lemma \ref{lemma-valuation-ring-torsion-free-flat}).
From Lemma \ref{lemma-flat-finite-type-valuation-ring-finite-presentation}
we deduce that $M$ is of finite presentation as an $A$-module
and $A$ is essentially of finite presentation as an $R$-algebra.
By Lemma \ref{lemma-structure-relatively-perfect}
we see that $M$ is perfect relative to $R$,
in particular $M$ is pseudo-coherent as an $A$-module.
By Lemma \ref{lemma-perfect-over-regular-local-ring}
we see that $M$ is perfect, hence
$M$ has a finite free resolution $F_\bullet$ over $A$.
It follows that $L$ is quasi-isomorphic to a finite complex
of {\it free} $A \otimes_R K$-modules. Hence by
Lemma \ref{lemma-perfect-to-K-group} we see that
$[L] = n[A \otimes_R K]$ in $K_0(A \otimes_R K)$
for some $n \in \mathbf{Z}$.
Applying the map of Lemma \ref{lemma-det}
we see that $L$ is trivial.
\end{proof}






\section{Determinants of complexes}
\label{section-determinants-complexes}

\noindent
In Section \ref{section-perfect-K-group} we have seen how to a perfect
complex $K$ over a ring $R$ there is associated an isomorphism class of 
invertible $R$-modules, i.e., an element of $\Pic(R)$. In fact, analogously
to Section \ref{section-determinants} it turns out
there is a functor
$$
\det :
\left\{
\begin{matrix}
\text{category of perfect complexes} \\
\text{morphisms are isomorphisms}
\end{matrix}
\right\}
\longrightarrow
\left\{
\begin{matrix}
\text{category of invertible modules} \\
\text{morphisms are isomorphisms}
\end{matrix}
\right\}
$$
Moreover, given an object $(L, F)$ of the filtered derived category $DF(R)$
of $R$ whose filtration is finite and whose graded parts are perfect complexes,
there is a canonical isomorphism $\det(\text{gr}L) \to \det(L)$. See
\cite{determinant} for the original exposition.
We will add this material later (insert future reference).

\medskip\noindent
For the moment we will present an ad hoc construction in the case of
perfect objects $L$ in $D(R)$ of tor-amplitude in $[-1, 0]$. Such an object
may be represented by a complex
$$
L^\bullet = \ldots \to 0 \to L^{-1} \to L^0 \to 0 \to \ldots
$$
with $L^{-1}$ and $L^0$ finite projective $R$-modules, see
Lemma \ref{lemma-perfect}. In this case we set
$$
\det(L^\bullet) = \det(L^0) \otimes_R \det(L^{-1})^{\otimes -1} =
\Hom_R(\det(L^{-1}), \det(L^0))
$$
Let us say a complex of this form has {\it rank $0$} if
$L^{-1}_\mathfrak p$ and $L^0_\mathfrak p$ have the same rank
for all primes of $R$. If $L^\bullet$ has rank $0$, then
we have seen in Section \ref{section-determinants} that there
is a canonical element
$$
\delta(L^\bullet) \in \det(L^\bullet)
$$
which is simply the determininant of $d : L^{-1} \to L^0$.
Note that $\delta(L^\bullet)$ is a trivialization of
$\det(L^\bullet)$ if and only if $L^\bullet$ is acyclic.

\medskip\noindent
Consider a map of complexes $a^\bullet : K^\bullet \to L^\bullet$
such that
\begin{enumerate}
\item $a^\bullet$ is a quasi-isomorphism,
\item $a^n : K^n \to L^n$ is surjective for all $n$,
\item $K^n$, $L^n$ are finite projective $R$-modules, nonzero only for
$n \in \{-1, 0\}$.
\end{enumerate}
In this situation we will construct an isomorphism
$$
\det(a^\bullet) : \det(K^\bullet) \longrightarrow \det(L^\bullet)
$$
Using the exact sequences $0 \to \Ker(a^i) \to K^i \to L^i \to 0$
we obtain isomorphisms
$$
\gamma^i : \det(\Ker(a^i)) \otimes \det(L^i) \to \det(K^i)
$$
for $i = -1, 0$ by Lemma \ref{lemma-det-ses}. Since $a^\bullet$
is a quasi-isomorphism the complex $\Ker(a^\bullet)$ is acyclic
and has rank $0$. Hence the canonical element $\delta(\Ker(a^\bullet))$
is a trivialization of the invertible $R$-module
$\det(\Ker(a^\bullet))$, see above. We define
$\det(a^\bullet) : \det(K^\bullet) \to \det(L^\bullet)$ as the
unique isomorphism such that the diagram
$$
\xymatrix{
\det(K^\bullet) \ar[rr]_{\det(a^\bullet)} \ar[dr]_{\delta(\Ker(a^\bullet))} & &
\det(L^\bullet) \\
& \det(K^\bullet) \otimes \det(\Ker(a^\bullet))
\ar[ru]_{\gamma^0 \otimes (\gamma^{-1})^{\otimes -1}}
}
$$
commutes.

\begin{lemma}
\label{lemma-canonical-element-well-defined}
Let $R$ be a ring. Let $a^\bullet : K^\bullet \to L^\bullet$ be a map of
complexes of $R$-modules satisfying (1), (2), (3) above. If $L^\bullet$
has rank $0$, then $\det(a^\bullet)$ maps the
canonical element $\delta(K^\bullet)$ to $\delta(L^\bullet)$.
\end{lemma}

\begin{proof}
Write $M^i = \Ker(a^i)$. Thus we have a map of short
exact sequences
$$
\xymatrix{
0 \ar[r] &
M^{-1} \ar[r] \ar[d]_{d_M} &
K^{-1} \ar[r] \ar[d]_{d_K} &
L^{-1} \ar[r] \ar[d]_{d_L} &
0 \\
0 \ar[r] &
M^0 \ar[r] &
K^0 \ar[r] &
L^0 \ar[r] &
0
}
$$
By Lemma \ref{lemma-det-ses-functorial} we know that
$\det(d_K)$ corresponds to $\det(d_M) \otimes \det(d_L)$
as maps. Unwinding the definitions this gives the required
equality.
\end{proof}

\begin{lemma}
\label{lemma-homotopic-surjections}
Let $R$ be a ring. Let $a^\bullet : K^\bullet \to L^\bullet$ be a map of
complexes of $R$-modules satisfying (1), (2), (3) above.
Let $h : K^0 \to L^{-1}$ be a map such that
$b^0 = a^0 + d \circ h$ and $b^{-1} = a^{-1} + h \circ d$ are surjective.
Then $\det(a^\bullet) = \det(b^\bullet)$ as maps
$\det(K^\bullet) \to \det(L^\bullet)$.
\end{lemma}

\begin{proof}
Suppose there exists a map $\tilde h : K^0 \to K^{-1}$ such that
$h = a^{-1} \circ \tilde h$ and such that
$k^0 = \text{id} + d \circ \tilde h : K^0 \to K^0$ and
$k^1 = \text{id} + \tilde h \circ d : K^{-1} \to K^{-1}$ are isomorphisms.
Then we obtain a commutative diagram
$$
\xymatrix{
0 \ar[r] &
\Ker(b^\bullet) \ar[r] \ar[d]_{c^\bullet} &
K^\bullet \ar[r]_{b^\bullet}
\ar[d]_{k^\bullet} &
L^\bullet \ar[r] \ar[d]^{\text{id}} &
0 \\
0 \ar[r] &
\Ker(a^\bullet) \ar[r] &
K^\bullet \ar[r]^{a^\bullet} &
L^\bullet \ar[r] &
0
}
$$
of complexes, where $c^\bullet$ is the induced isomorphism of kernels.
Using Lemma \ref{lemma-det-ses-functorial} we see that
$$
\xymatrix{
\det(\Ker(b^i)) \otimes \det(L^i) \ar[r] \ar[d]_{\det(c^i) \otimes 1} &
\det(K^i) \ar[d]^{\det(k^i)} \\
\det(\Ker(a^i)) \otimes \det(L^i) \ar[r] &
\det(K^i)
}
$$
commutes. Since $\det(c^\bullet)$ maps the canonical trivialization
of $\det(\Ker(a^\bullet))$ to the canonical trivializatio of $\Ker(b^\bullet)$
(Lemma \ref{lemma-canonical-element-well-defined})
we see that we conclude if (and only if)
$$
\det(k^0) = \det(k^{-1})
$$
as elements of $R$ which follows from Lemma \ref{lemma-det-switch}.

\medskip\noindent
Suppose there exists a direct summand $U \subset K^{-1}$ such that both
$a^{-1}|_U : U \to L^{-1}$ and $b^{-1}|_U : U \to L^{-1}$
are isomorphisms. Define $\tilde h$ as the composition of $h$
with the inverse of $a^{-1}|_U$. We claim that $\tilde h$ is a
map as in the first paragraph of the proof. Namely, we have
$h = a^{-1} \circ \tilde h$ by construction. 
To show that $k^{-1} : K^{-1} \to K^{-1}$
is an isomorphism it suffices to show that it is surjective
(Algebra, Lemma \ref{algebra-lemma-fun}). Let $u \in U$. We may
choose $u' \in U$ such that $b^{-1}(u') = a^{-1}(u)$.
Then $u = k^{-1}(u')$. Namely, both $u$ and $k^{-1}(u')$
are in $U$ and $a^{-1}(u) = a^{-1}(k^{-1}(u'))$ by a
calculation\footnote{$a^{-1}(k^{-1}(u')) =
a^{-1}(u') + a^{-1}(\tilde h(d(u'))) =
a^{-1}(u') + h(d(u')) = b^{-1}(u') = a^{-1}(u)$} Since $a^{-1}|_U$
is an isomorphism we get the equality. Thus $U \subset \Im(k^{-1})$.
On the other hand, if $x \in \Ker(a^{-1})$ then
$x = k^{-1}(x) \bmod U$. Since $K^{-1} = \Ker(a^{-1}) + U$ we conclude
$k^{-1}$ is surjective.
Finally, we show that $k^0 : K^0 \to K^0$ is surjective.
First, since $a^0 \circ k^0 = b^0$ we see that $a^0 \circ k^0$ is
surjective. If $x \in \Ker(a^0)$, then $x = d(y)$ for some
$y \in \Ker(a^{-1})$. We may write $y = k^{-1}(z)$ for some $z \in K^{-1}$
by the above. Then $x = k^0(d(z))$ and we conclude.

\medskip\noindent
Final step of the proof. It suffices to find $U$ as in the 
preceding paragraph, but this may not always be possible. However,
in order to show equality of two maps of $R$-modules, it suffices
to do so after localization at primes of $R$. Hence we may assume
$R$ is local. Then we get the following problem: suppose
$$
\alpha, \beta : R^{\oplus n} \longrightarrow R^{\oplus m}
$$
are two surjective $R$-linear maps. Find a direct summand
$U \subset R^{\oplus n}$ such that both $\alpha|_U$ and $\beta|_U$
are isomorphisms. If $R$ is a field, this is possible by linear algebra.
In general, one takes a solution over the residue field and lifts this
to a solution over the local ring $R$. Some details omitted.
\end{proof}

\begin{lemma}
\label{lemma-compose-surjections}
Let $R$ be a ring. Let $a^\bullet : K^\bullet \to L^\bullet$
and $b^\bullet : L^\bullet \to M^\bullet$ be maps of
complexes of $R$-modules satisfying (1), (2), (3) above.
Then we have $\det(b^\bullet) \circ \det(a^\bullet) = 
\det(b^\bullet \circ a^\bullet)$ as maps
$\det(M^\bullet) \to \det(K^\bullet)$.
\end{lemma}

\begin{proof}
Omitted. Hints: Straightforward from Lemmas
\ref{lemma-det-ses}, \ref{lemma-det-ses-functorial},
and \ref{lemma-det-filtration}.
\end{proof}

\begin{lemma}
\label{lemma-determinant-two-term-complexes}
Let $R$ be a ring. The constructions above determine a functor
$$
\det :
\left\{
\begin{matrix}
\text{category of perfect complexes} \\
\text{with tor amplitude in }[-1, 0] \\
\text{morphisms are isomorphisms}
\end{matrix}
\right\}
\longrightarrow
\left\{
\begin{matrix}
\text{category of invertible modules} \\
\text{morphisms are isomorphisms}
\end{matrix}
\right\}
$$
Moreover, given a rank $0$ perfect object $L$ of $D(R)$ with
tor-amplitude in $[-1, 0]$ there is a canonical element
$\delta(L) \in \det(L)$ such that for any isomorphism
$a : L \to K$ in $D(R)$ we have $\det(a)(\delta(L)) = \delta(K)$.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-perfect} every object of the source category
may be represented by a complex
$$
L^\bullet = \ldots \to 0 \to L^{-1} \to L^0 \to 0 \to \ldots
$$
with $L^{-1}$ and $L^0$ finite projective $R$-modules. Let us temporarily
call a complex of this type good. By 
Derived Categories, Lemma \ref{derived-lemma-morphisms-from-projective-complex}
morphisms between good complexes in the derived category are
homotopy classes of maps of complexes. Thus we may work with good complexes
and we can use the determinant
$\det(L^\bullet) = \det(L^0) \otimes \det(L^{-1})^{\otimes -1}$
we investigated above.

\medskip\noindent
Let $a^\bullet : L^\bullet \to K^\bullet$ be a morphism of good complexes
which is an isomorphism in $D(R)$, i.e., a quasi-isomorphism. We say that
$$
\xymatrix{
L^\bullet \ar[rr]_{a^\bullet} & & K^\bullet \\
& M^\bullet \ar[lu]^{b^\bullet} \ar[ru]_{c^\bullet}
}
$$
is a good diagram if it commutes up to homotopy and $b^\bullet$
and $c^\bullet$ satisfy conditions (1), (2), (3) above. Whenever
we have such a diagram it makes sense to define
$$
\det(a^\bullet) = \det(c^\bullet) \circ \det(b^\bullet)^{-1}
$$
where $\det(c^\bullet)$ and $\det(b^\bullet)$ are the isomorphisms
constructed in the text above. We will show that good diagrams always
exist and that the resulting map $\det(a^\bullet)$
is independent of the choice of good diagram.

\medskip\noindent
Existence of good diagrams for a quasi-isomorphism
$a^\bullet : L^\bullet \to K^\bullet$ of good complexes.
Choose a
surjection $p : R^{\oplus n} \to K^{-1}$. Then we can consider the new
good complex
$$
M^\bullet = \ldots \to 0 \to
L^{-1} \oplus R^{\oplus n} \xrightarrow{d \oplus 1}
L^0 \oplus R^{\oplus n} \to 0 \to \ldots
$$
with the projection map $b^\bullet : M^\bullet \to L^\bullet$ and the map
$c^\bullet : M^\bullet \to K^\bullet$ using $a^{-1} \oplus p$ in degree $-1$
and using $a^0 \oplus d \circ p$ in degree $0$. The maps
$b^\bullet : M^\bullet \to L^\bullet$ and
$c^\bullet : M^\bullet \to K^\bullet$
satisfy conditions (1), (2), (3) above and we get a good diagram.

\medskip\noindent
Suppose that we have a good diagram
$$
\xymatrix{
L^\bullet \ar[rr]_{\text{id}^\bullet} & & L^\bullet \\
& M^\bullet \ar[lu]^{b^\bullet} \ar[ru]_{c^\bullet}
}
$$
Then by Lemma \ref{lemma-homotopic-surjections} we see that
$\det(c^\bullet) = \det(b^\bullet)$. Thus we see that
$\det(\text{id}^\bullet) = \text{id}$ is independent of the choice
of good diagram.

\medskip\noindent
Before we prove independence in general, we think about
composition. Suppose we have quasi-isomorphisms
$L_1^\bullet \to L_2^\bullet$ and $L_2^\bullet \to L_3^\bullet$
of good complexes and good diagrams
$$
\vcenter{
\xymatrix{
L_1^\bullet \ar[rr] & &
L_2^\bullet \\
& M_{12}^\bullet \ar[lu] \ar[ru]
}
}
\quad\text{and}\quad
\vcenter{
\xymatrix{
L_2^\bullet \ar[rr] & &
L_3^\bullet \\
& M_{23}^\bullet \ar[lu] \ar[ru]
}
}
$$
We can extend this to a diagram
$$
\xymatrix{
L_1^\bullet \ar[rr] & &
L_2^\bullet \ar[rr] & &
L_3^\bullet \\
& M_{12}^\bullet \ar[lu] \ar[ru]
& & M_{23}^\bullet \ar[lu] \ar[ru] \\
& &
M_{123}^\bullet \ar[lu] \ar[ru]
}
$$
where $M_{123}^\bullet \to M_{12}^\bullet$ and
$M_{123}^\bullet \to M_{23}^\bullet$ have properties (1), (2), (3)
and the square in the diagram commutes: we can just take
$M_{123}^n = M_{12}^n \times_{L_2^n} M_{23}^n$.
Then Lemma \ref{lemma-compose-surjections} shows that
$$
\xymatrix{
\det(L_2^\bullet) &
\det(M_{23}^\bullet) \ar[l] \\
\det(M_{12}^\bullet) \ar[u] &
\det(M_{123}^\bullet) \ar[l] \ar[u]
}
$$
commutes. A diagram chase shows that the composition
$\det(L_1^\bullet) \to \det(L_2^\bullet) \to \det(L_3^\bullet)$
of the maps associated to the two good diagrams using
$M_{12}^\bullet$ and $M_{23}^\bullet$
is equal to the map associated to the good diagram
$$
\xymatrix{
L_1^\bullet \ar[rr] & & L_3^\bullet \\
& M_{123}^\bullet \ar[lu] \ar[ru]
}
$$
Thus if we can show that these maps are independent of choices,
then the composition law is satisfied too and we obtain our functor.

\medskip\noindent
Independence. Let a quasi-isomorphism
$a^\bullet : L^\bullet \to K^\bullet$ of good complexes be given.
Choose an inverse quasi-isomorphism $b^\bullet : K^\bullet \to L^\bullet$.
Setting $L_1^\bullet = L$, $L_2^\bullet = K^\bullet$ and
$L_3^\bullet = L^\bullet$ may fix our choice of good diagram for
$b^\bullet$ and consider varying good diagrams for $a^\bullet$.
Then the result of the previous paragraphs is that no matter
what choices, the composition always equals the identity
map on $\det(L^\bullet)$. This clearly proves indepence of those choices.

\medskip\noindent
The statement on canonical elements follows immediately from
Lemma \ref{lemma-canonical-element-well-defined} and our construction.
\end{proof}







\section{Extensions of valuation rings}
\label{section-valuation-rings}

\noindent
This section is the analogue of Section \ref{section-discrete-valuation-rings}
for general valuation rings.

\begin{definition}
\label{definition-extension-valuation-rings}
We say that $A \to B$ or $A \subset B$ is an
{\it extension of valuation rings} if $A$ and $B$ are
valuation rings and $A \to B$ is injective and local.
Such an extension induces a commutative diagram
$$
\xymatrix{
A \setminus \{0\} \ar[r] \ar[d]_v & B \setminus \{0\} \ar[d]^v \\
\Gamma_A \ar[r] & \Gamma_B
}
$$
where $\Gamma_A$ and $\Gamma_B$ are the value groups.
We say that $B$ is {\it weakly unramified} over $A$ if
the lower horizontal arrow is a bijection.
If the extension of residue fields
$\kappa_A = A/\mathfrak m_A \subset \kappa_B = B/\mathfrak m_B$
is finite, then we set $f = [\kappa_B : \kappa_A]$ and we
call it the {\it residual degree} or {\it residue degree}
of the extension $A \subset B$.
\end{definition}

\noindent
Note that $\Gamma_A \to \Gamma_B$ is injective, because the units
of $A$ are the inverse of the units of $B$ under the map $A \to B$.
Note also, that we do not require the extension of fraction fields
to be finite.

\begin{lemma}
\label{lemma-inequality-general}
Let $A \subset B$ be an extension of valuation rings with
fraction fields $K \subset L$. If the extension $L/K$
is finite, then the residue field extension is finite,
the index of $\Gamma_A$ in $\Gamma_B$ is finite, and
$$
[\Gamma_B : \Gamma_A] [\kappa_B : \kappa_A] \leq [L : K].
$$
\end{lemma}

\begin{proof}
Let $b_1, \ldots, b_n \in B$ be units whose images in $\kappa_B$
are linearly independent over $\kappa_A$. Let $c_1, \ldots, c_m \in B$
be nonzero elements whose images in $\Gamma_B/\Gamma_A$ are pairwise
distinct. We claim that $b_i c_j$ are $K$-linearly independent
in $L$. Namely, we claim a sum
$$
\sum a_{ij} b_i c_j
$$
with $a_{ij} \in K$ not all zero cannot be zero. Choose $(i_0, j_0)$ with
$v(a_{i_0j_0}b_{i_0}c_{j_0})$ minimal. Replace $a_{ij}$ by
$a_{ij}/a_{i_0j_0}$, so that $a_{i_0 j_0} = 1$. Let
$$
P = \{(i, j) \mid
v(a_{ij}b_ic_j) = v(a_{i_0j_0}b_{i_0}c_{j_0}) \}
$$
By our choice of $c_1, \ldots, c_m$ we see that $(i, j) \in P$ implies
$j = j_0$. Hence if $(i, j) \in P$, then $v(a_{ij}) = v(a_{i_0j_0}) = 0$,
i.e., $a_{ij}$ is a unit. By our choice of $b_1, \ldots, b_n$
we see that
$$
\sum\nolimits_{(i, j) \in P} a_{ij}b_i
$$
is a unit in $B$. Thus the valuation of
$\sum\nolimits_{(i, j) \in P} a_{ij}b_ic_j$ is
$v(c_{j_0}) = v(a_{i_0j_0}b_{i_0}c_{j_0})$.
Since the terms with $(i, j) \not \in P$ in the first displayed sum
have strictly bigger valuation, we conclude that this sum cannot be
zero, thereby proving the lemma.
\end{proof}

\begin{lemma}
\label{lemma-valuation-ring-purely-inseparable}
Let $A$ be a valuation ring with fraction field $K$ of characteristic $p > 0$.
Let $L/K$ be a purely inseparable extension.
Then the integral closure $B$ of $A$ in $L$ is a valuation ring
with fraction field $L$
and $A \subset B$ is an extension of valuation rings.
\end{lemma}

\begin{proof}
Omitted. Hints: use Algebra, Lemmas
\ref{algebra-lemma-x-or-x-inverse-valuation-ring} and
\ref{algebra-lemma-integral-overring-surjective} for example.
\end{proof}

\begin{lemma}
\label{lemma-extension-normal-domains-and-roots}
Let $A \to B$ be a flat local homomorphism of Noetherian local normal domains.
Let $f \in A$ and $h \in B$ such that $f = w h^n$ for some $n > 1$ and some
unit $w$ of $B$. Assume that for every height $1$ prime
$\mathfrak p \subset A$ there is a height $1$ prime
$\mathfrak q \subset B$ lying over $\mathfrak p$
such that the extension $A_\mathfrak p \subset B_\mathfrak q$ is
weakly unramified. Then $f = u g^n$ for some $g \in A$ and unit $u$ of $A$.
\end{lemma}

\begin{proof}
The local rings of $A$ and $B$ at height $1$ primes are
discrete valuation rings (Algebra, Lemma \ref{algebra-lemma-characterize-dvr}).
Thus the assumption makes sense (via
Definition \ref{definition-extension-discrete-valuation-rings}).
Let $\mathfrak p_1, \ldots, \mathfrak p_r$ be the primes of $A$ minimal
over $f$. These have height $1$ by
Algebra, Lemma \ref{algebra-lemma-minimal-over-1}.
For each $i$ let $\mathfrak q_{i, j} \subset B$, $j = 1, \ldots, r_i$
be the height $1$ primes of $B$ lying over $\mathfrak p_i$.
Say we number them so that  $A_{\mathfrak p_i} \to B_{\mathfrak q_{i, 1}}$
is weakly unramified.
Since $f$ maps to an $n$th power times a unit in $B_{\mathfrak q_{i, 1}}$
we see that the valuation $v_i$ of $f$ in $A_{\mathfrak p_i}$ is
divisible by $n$. Say $v_i = n w_i$ for some $w_i \geq 0$.
Consider the exact sequence
$$
0 \to I \to A \to
\prod\nolimits_{i = 1, \ldots, r}
A_{\mathfrak p_i}/\mathfrak p_i^{w_i}A_{\mathfrak p_i}
$$
defining the ideal $I$. Applying the exact functor $- \otimes_A B$ we obtain
an exact sequence
$$
0 \to I \otimes_A B \to B \to
\prod\nolimits_{i = 1, \ldots, r}
(A_{\mathfrak p_i}/\mathfrak p_i^{w_i}A_{\mathfrak p_i}) \otimes_A B
$$
Fix $i$. We claim that the canonical map
$$
(A_{\mathfrak p_i}/\mathfrak p_i^{w_i}A_{\mathfrak p_i}) \otimes_A B
\to
\prod\nolimits_{j = 1, \ldots, r_i}
B_{\mathfrak q_{i, j}}/\mathfrak q_{i, j}^{e_{i, j}w_i}B_{\mathfrak q_{i, j}}
$$
is injective. Here $e_{i, j}$ is the ramification index of 
$A_{\mathfrak p_i} \to B_{\mathfrak q_{i, j}}$.
The claim asserts that $\mathfrak p_i^{w_i}B_{\mathfrak p_i}$
is equal to the set of elements $b$ of $B_{\mathfrak p_i}$
whose valuation at $\mathfrak q_{i, j}$ is $\geq e_{i, j}w_i$.
Choose a generator $a \in A_{\mathfrak p_i}$ of the principal
ideal $\mathfrak p_i^{w_i}$. Then the valuation of $a$ at
$\mathfrak q_{i, j}$ is equal to $e_{i, j}w_i$. Hence,
as $B_{\mathfrak p_i}$ is a normal domain whose height one
primes are the primes $\mathfrak q_{i, j}$, $j = 1, \ldots, r_i$,
we see that, for $b$ as above, we have $b/a \in B_{\mathfrak p_i}$ by
Algebra, Lemma
\ref{algebra-lemma-normal-domain-intersection-localizations-height-1}.
Thus the claim.

\medskip\noindent
The claim combined with the second exact sequence above
determines an exact sequence
$$
0 \to I \otimes_A B \to B \to
\prod\nolimits_{i = 1, \ldots, r}
\prod\nolimits_{j = 1, \ldots, r_i}
B_{\mathfrak q_{i, j}}/\mathfrak q_{i, j}^{e_{i, j}w_i}B_{\mathfrak q_{i, j}}
$$
It follows that $I \otimes_A B$ is the set of elements $h'$ of $B$
which have valuation $\geq e_{i, j}w_i$ at $\mathfrak q_{i, j}$.
Since $f = wh^n$ in $B$ we see that $h$ has valuation
$e_{i, j}w_i$ at $\mathfrak q_{i, j}$. Thus $h'/h \in B$
by Algebra, Lemma
\ref{algebra-lemma-normal-domain-intersection-localizations-height-1}.
It follows that $I \otimes_A B$ is a free $B$-module of rank $1$
(generated by $h$).
Therefore $I$ is a free $A$-module of rank $1$, see
Algebra, Lemma \ref{algebra-lemma-finite-projective-descends}.
Let $g \in I$ be a generator. Then we see that
$g$ and $h$ differ by a unit in $B$. Working backwards we
conclude that the valuation of $g$ in $A_{\mathfrak p_i}$ is
$w_i = v_i/n$. Hence $g^n$ and $f$ differ by a unit in $A$
(by Algebra, Lemma
\ref{algebra-lemma-normal-domain-intersection-localizations-height-1})
as desired.
\end{proof}

\begin{lemma}
\label{lemma-etale-extension-valuation-ring}
Let $A$ be a valuation ring. Let $A \to B$ be an \'etale ring map
and let $\mathfrak m \subset B$ be a prime lying over the maximal
ideal of $A$. Then $A \subset B_\mathfrak m$ is an extension of
valuation rings which is weakly unramified.
\end{lemma}

\begin{proof}
The ring $A$ has weak dimension $\leq 1$ by
Lemma \ref{lemma-weak-dimension-at-most-1}. Then $B$ has weak dimension
$\leq 1$ by Lemmas \ref{lemma-weak-dimension-goes-up} and
\ref{lemma-when-weakly-etale}. hence the local ring $B_\mathfrak m$
is a valuation ring by Lemma \ref{lemma-weak-dimension-at-most-1}.
Since the extension $A \subset B_\mathfrak m$ induces a finite
extension of fraction fields,
we see that the $\Gamma_A$ has finite index in the value group of
$B_{\mathfrak m}$. Thus for every $h \in B_\mathfrak m$ there exists
an $n > 0$, an element $f \in A$, and a unit $w \in B_\mathfrak m$
such that $f = w h^n$ in $B_\mathfrak m$. We will show that this implies
$f = ug^n$ for some $g \in A$ and unit $u \in A$; this will show that
the value groups of $A$ and $B_\mathfrak m$ agree, as claimed in the lemma.

\medskip\noindent
Write $A = \colim A_i$ as the colimit of its local subrings which
are essentially of finite type over $\mathbf{Z}$. Since $A$
is a normal domain (Algebra, Lemma \ref{algebra-lemma-valuation-ring-normal}),
we may assume that each $A_i$ is normal (here we use that taking
normalizations the local rings remain essentially of finite type
over $\mathbf{Z}$ by
Algebra, Proposition \ref{algebra-proposition-ubiquity-nagata}).
For some $i$ we can find an \'etale extension $A_i \to B_i$
such that $B = A \otimes_{A_i} B_i$, see
Algebra, Lemma \ref{algebra-lemma-etale}.
Let $\mathfrak m_i$ be the intersection of $B_i$ with $\mathfrak m$.
Then we may apply Lemma \ref{lemma-extension-normal-domains-and-roots}
to the ring map $A_i \to (B_i)_{\mathfrak m_i}$ to conclude.
The hypotheses of the lemma are satisfied because:
\begin{enumerate}
\item $A_i$ and $(B_i)_{\mathfrak m_i}$ are Noetherian as they are
essentially of finite type over $\mathbf{Z}$,
\item $A_i \to (B_i)_{\mathfrak m_i}$ is flat as $A_i \to B_i$ is \'etale,
\item $B_i$ is normal as $A_i \to B_i$ is \'etale, see
Algebra, Lemma \ref{algebra-lemma-normal-goes-up},
\item for every height $1$ prime of $A_i$ there exists a height $1$
prime of $(B_i)_{\mathfrak m_i}$ lying over it by
Algebra, Lemma \ref{algebra-lemma-finite-in-codim-1} and the fact that
$\Spec((B_i)_{\mathfrak m_i}) \to \Spec(A_i)$ is surjective,
\item the induced extensions $(A_i)_\mathfrak p \to (B_i)_\mathfrak q$
are unramified for every prime $\mathfrak q$ lying over a prime
$\mathfrak p$ as $A_i \to B_i$ is \'etale.
\end{enumerate}
This concludes the proof of the lemma.
\end{proof}

\begin{lemma}
\label{lemma-henselization-valuation-ring}
Let $A$ be a valuation ring. Let $A^h$, resp.\ $A^{sh}$ be its
henselization, resp.\ strict henselization. Then
$$
A \subset A^h \subset A^{sh}
$$
are extensions of valuation rings which induce bijections on
value groups, i.e., which are weakly unramified.
\end{lemma}

\begin{proof}
Write $A^h = \colim (B_i)_{\mathfrak q_i}$ where $A \to B_i$
is \'etale and $\mathfrak q_i \subset B_i$ is a prime ideal
lying over $\mathfrak m_A$, see
Algebra, Lemma \ref{algebra-lemma-henselization-different}.
Then Lemma \ref{lemma-etale-extension-valuation-ring}
tells us that $(B_i)_{\mathfrak q_i}$
is a valuation ring and that the induced map
$$
(A \setminus \{0\})/A^* \longrightarrow
((B_i)_{\mathfrak q_i} \setminus \{0\}) / (B_i)_{\mathfrak q_i}^*
$$
is bijective. By Algebra, Lemma \ref{algebra-lemma-colimit-valuation-rings}
we conclude that $A^h$ is a valuation ring. It also follows that
$(A \setminus \{0\})/A^* \to (A^h \setminus \{0\})/(A^h)^*$
is bijective. This proves the lemma for the inclusion $A \subset A^h$.
To prove it for $A \subset A^{sh}$ we can use exactly the same argument
except we replace Algebra, Lemma \ref{algebra-lemma-henselization-different} by
Algebra, Lemma \ref{algebra-lemma-strict-henselization-different}.
Since $A^{sh} = (A^h)^{sh}$ we see that this also proves the
assertions of the lemma for the inclusion $A^h \subset A^{sh}$.
\end{proof}










\section{Structure of modules over a PID}
\label{section-structure-modules}

\noindent
We work a little bit more generally (following the papers
\cite{Warfield-Purity} and \cite{Warfield-Decomposition}
by Warfield) so that the proofs work over valuation rings.

\begin{lemma}
\label{lemma-characterize-PD-modules}
\begin{reference}
\cite[Corollary 1]{Warfield-Purity}
\end{reference}
Let $P$ be a module over a ring $R$. The following are equivalent
\begin{enumerate}
\item $P$ is a direct summand of a direct sum of modules of the
form $R/fR$, for $f \in R$ varying.
\item for every short exact sequence $0 \to A \to B \to C \to 0$
of $R$-modules such that $fA = A \cap fB$ for all $f \in R$
the map $\Hom_R(P, B) \to \Hom_R(P, C)$ is surjective.
\end{enumerate}
\end{lemma}

\begin{proof}
Let $0 \to A \to B \to C \to 0$ be an exact sequence as in (2).
To prove that (1) implies (2) it suffices to prove that
$\Hom_R(R/fR, B) \to \Hom_R(R/fR, C)$ is surjective for every $f \in R$.
Let $\psi : R/fR \to C$ be a map. Say $\psi(1)$ is the image
of $b \in B$. Then $fb \in A$. Hence there exists an $a \in A$
such that $fa = fb$. Then $f(b - a) = 0$ hence we get a morphism
$\varphi : R/fR \to B$ mapping $1$ to $b - a$ which lifts $\psi$.

\medskip\noindent
Conversely, assume that (2) holds. Let $I$ be the set of pairs
$(f, \varphi)$ where $f \in R$ and $\varphi : R/fR \to P$. For
$i \in I$ denote $(f_i, \varphi_i)$ the corresponding pair.
Consider the map
$$
B = \bigoplus\nolimits_{i \in I} R/f_iR \longrightarrow P
$$
which sends the element $r$ in the summand $R/f_iR$ to $\varphi_i(r)$ in $P$.
Let $A = \Ker(B \to P)$. Then we see that (1) is true if the sequence
$$
0 \to A \to B \to P \to 0
$$
is an exact sequence as in (2). To see this suppose $f \in R$ and
$a \in A$ maps to $f b$ in $B$. Write $b = (r_i)_{i \in I}$ with
almost all $r_i = 0$. Then we see that
$$
f\sum \varphi_i(r_i) = 0
$$
in $P$. Hence there is an $i_0 \in I$ such that $f_{i_0} = f$ and
$\varphi_{i_0}(1) = \sum \varphi_i(r_i)$. Let $x_{i_0} \in R/f_{i_0}R$
be the class of $1$. Then we see that
$$
a' = (r_i)_{i \in I} - (0, \ldots, 0, x_{i_0}, 0, \ldots )
$$
is an element of $A$ and $fa' = a$ as desired.
\end{proof}

\begin{lemma}[Generalized valuation rings]
\label{lemma-generalized-valuation-ring}
\begin{reference}
\cite{Warfield-Decomposition}
\end{reference}
Let $R$ be a nonzero ring. The following are equivalent
\begin{enumerate}
\item For $a, b \in R$ either $a$ divides $b$ or $b$ divides $a$.
\item Every finitely generated ideal is principal and $R$ is local.
\item The set of ideals of $R$ is linearly ordered by inclusion.
\end{enumerate}
This holds in particular if $R$ is a valuation ring.
\end{lemma}

\begin{proof}
Assume (2) and let $a, b \in R$. Then $(a, b) = (c)$. If $c = 0$,
then $a = b = 0$ and $a$ divides $b$. Assume $c \not = 0$. Write
$c = ua + vb$ and $a = wc$ and $b = zc$. Then $c(1 - uw - vz) = 0$.
Since $R$ is local, this implies that $1 - uw - vz \in \mathfrak m$.
Hence either $w$ or $z$ is a unit, so either $a$ divides $b$ or
$b$ divides $a$. Thus (2) implies (1).

\medskip\noindent
Assume (1). If $R$ has two maximal ideals $\mathfrak m_i$
we can choose $a \in \mathfrak m_1$ with $a \not \in \mathfrak m_2$
and $b \in \mathfrak m_2$ with $b \not \in \mathfrak m_1$.
Then $a$ does not divide $b$ and $b$ does not divide $a$.
Hence $R$ has a unique maximal ideal and is local.
It follows easily from condition (1) and induction that every
finitely generated ideal is principal. Thus (1) implies (2).

\medskip\noindent
It is straightforward to prove that (1) and (3) are equivalent.
The final statement is Algebra, Lemma
\ref{algebra-lemma-valuation-ring-x-or-x-inverse}.
\end{proof}

\begin{lemma}
\label{lemma-generalized-valuation-ring-modules}
\begin{reference}
\cite[Theorem 1]{Warfield-Decomposition}
\end{reference}
Let $R$ be a ring satisfying the equivalent conditions of
Lemma \ref{lemma-generalized-valuation-ring}.
Then every finitely presented $R$-module
is isomorphic to a finite direct sum of modules of the form $R/fR$.
\end{lemma}

\begin{proof}
Let $M$ be a finitely presented $R$-module. We will use all
the equivalent properties of $R$ from
Lemma \ref{lemma-generalized-valuation-ring}
without further mention. Denote $\mathfrak m \subset R$
the maximal ideal and $\kappa = R/\mathfrak m$ the residue field.
Let $I \subset R$ be the annihilator of $M$.
Choose a basis $y_1, \ldots, y_n$ of the finite dimensional
$\kappa$-vector space $M/\mathfrak m M$. We will argue
by induction on $n$.

\medskip\noindent
By Nakayama's lemma any collection of elements $x_1, \ldots, x_n \in M$
lifting the elements $y_1, \ldots, y_n$ in $M/\mathfrak m M$
generate $M$, see Algebra, Lemma \ref{algebra-lemma-NAK}.
This immediately proves the base case $n = 0$ of the induction.

\medskip\noindent
We claim there exists an index $i$ such that for any choice
of $x_i \in M$ mapping to $y_i$ the annihilator of $x_i$ is $I$.
Namely, if not, then we can choose $x_1, \ldots, x_n$ such
that $I_i = \text{Ann}(x_i) \not = I$ for all $i$. But as
$I \subset I_i$ for all $i$, ideals being totally ordered
implies $I_i$ is strictly bigger than $I$ for $i = 1, \ldots, n$,
and by total ordering once more we would see that
$\text{Ann}(M) = I_1 \cap \ldots \cap I_n$ is bigger than $I$
which is a contradiction. After renumbering we may assume that
$y_1$ has the property: for any $x_1 \in M$ lifting $y_1$
the annihilator of $x_1$ is $I$.

\medskip\noindent
We set $A = Rx_1 \subset M$. Consider the exact sequence
$0 \to A \to M \to M/A \to 0$. Since $A$ is finite, we see that
$M/A$ is a finitely presented $R$-module
(Algebra, Lemma \ref{algebra-lemma-extension}) with fewer generators.
Hence $M/A \cong \bigoplus_{j = 1, \ldots, m} R/f_jR$ by induction.
On the other hand, we claim that $A \to M$ satisfies the property:
if $f \in R$, then $fA = A \cap fM$. The inclusion $fA \subset A \cap fM$
is trivial. Conversely, if $x \in A \cap fM$, then $x = gx_1 = f y$
for some $g \in R$ and $y \in M$. If $f$ divides $g$, then $x \in fA$
as desired. If not, then we can write $f = hg$ for some $h \in \mathfrak m$.
The element $x'_1 = x_1 - hy$ has annihilator $I$ by the previous
paragraph. Thus $g \in I$ and we see that $x = 0$ as desired.
The claim and Lemma \ref{lemma-characterize-PD-modules}
imply the sequence $0 \to A \to M \to M/A \to 0$ is split
and we find $M \cong A \oplus \bigoplus_{j = 1, \ldots, m} R/f_jR$.
Then $A = R/I$ is finitely presented (as a summand of $M$)
and hence $I$ is finitely generated, hence principal.
This finishes the proof.
\end{proof}

\begin{lemma}
\label{lemma-warfield}
\begin{reference}
\cite[Theorem 3]{Warfield-Decomposition}
\end{reference}
Let $R$ be a ring such that every local ring of $R$ at a maximal
ideal satisfies the equivalent conditions of
Lemma \ref{lemma-generalized-valuation-ring}.
Then every finitely presented $R$-module is a summand of a 
finite direct sum of modules of the form $R/fR$ for $f$ in $R$ varying.
\end{lemma}

\begin{proof}
Let $M$ be a finitely presented $R$-module. We first show that $M$ is a
summand of a direct sum of modules of the form $R/fR$ and at the end we
argue the direct sum can be taken to be finite. Let
$$
0 \to A \to B \to C \to 0
$$
be a short exact sequence of $R$-modules such that $fA = A \cap fB$
for all $f \in R$. By Lemma \ref{lemma-characterize-PD-modules}
we have to show that $\Hom_R(M, B) \to \Hom_R(M, C)$ is surjective.
It suffices to prove this after localization at maximal ideals
$\mathfrak m$, see
Algebra, Lemma \ref{algebra-lemma-characterize-zero-local}.
Note that the localized
sequences $0 \to A_\mathfrak m \to B_\mathfrak m \to C_\mathfrak m \to 0$
satisfy the condition that $fA_\mathfrak m = A_\mathfrak m \cap fB_\mathfrak m$
for all $f \in R_\mathfrak m$ (because we can write $f = uf'$ with
$u \in R_\mathfrak m$ a unit and $f' \in R$ and because localization
is exact). Since $M$ is finitely presented, we see that
$$
\Hom_R(M, B)_\mathfrak m = \Hom_{R_\mathfrak m}(M_\mathfrak m, B_\mathfrak m)
\quad\text{and}\quad
\Hom_R(M, C)_\mathfrak m = \Hom_{R_\mathfrak m}(M_\mathfrak m, C_\mathfrak m)
$$
by Algebra, Lemma \ref{algebra-lemma-hom-from-finitely-presented}.
The module $M_\mathfrak m$ is a finitely presented $R_\mathfrak m$-module. By
Lemma \ref{lemma-generalized-valuation-ring-modules}
we see that $M_\mathfrak m$ is a direct sum of modules
of the form $R_\mathfrak m/fR_\mathfrak m$. Thus we conclude by
Lemma \ref{lemma-characterize-PD-modules} that the map on
localizations is surjective.

\medskip\noindent
At this point we know that $M$ is a summand of
$\bigoplus_{i \in I} R/f_i R$. Consider the map
$M \to \bigoplus_{i \in I} R/f_i R$. Since $M$ is a finite $R$-module,
the image is contained in $\bigoplus_{i \in I'} R/f_i R$ for some finite
subset $I' \subset I$. This finishes the proof.
\end{proof}

\begin{definition}
\label{definition-bezout}
Let $R$ be a domain.
\begin{enumerate}
\item We say $R$ is a {\it B\'ezout domain} if every finitely generated
ideal of $R$ is principal.
\item We say $R$ is an {\it elementary divisor domain} if for
all $n , m \geq 1$ and every $n \times m$ matrix $A$, there
exist invertible matrices $U, V$ of size $n \times n, m \times m$
such that
$$
U A V =
\left(
\begin{matrix}
f_1 & 0 & 0 & \ldots \\
0 & f_2 & 0 & \ldots \\
0 & 0 & f_3 & \ldots \\
\ldots & \ldots & \ldots & \ldots
\end{matrix}
\right)
$$
with $f_1, \ldots, f_{\min(n, m)} \in R$ and $f_1 | f_2 | \ldots$.
\end{enumerate}
\end{definition}

\noindent
It is apparently still an open question as to whether every B\'ezout domain
$R$ is an elementary divisor domain (or not). This is equivalent to the
question of whether every finitely presented module over $R$ is a direct
sum of cyclic modules. The converse implication is true.

\begin{lemma}
\label{lemma-elementary-divisor-is-bezout}
An elementary divisor domain is B\'ezout.
\end{lemma}

\begin{proof}
Let $a, b \in R$ be nonzero. Consider the $1 \times 2$ matrix $A = (a\ b)$.
Then we see that $u(a\ b)V = (f\ 0)$ with $u \in R$ invertible
and $V = (g_{ij})$ an invertible $2 \times 2$ matrix.
Then $f = u a g_{11} + u b g_{2 1}$ and $(g_{11}, g_{2 1}) = R$.
It follows that $(a, b) = (f)$. An induction argument (omitted)
then shows any finitely generated ideal in $R$ is generated by one element.
\end{proof}

\begin{lemma}
\label{lemma-localize-bezout}
The localization of a B\'ezout domain is B\'ezout.
Every local ring of a B\'ezout domain is a valuation ring.
A local domain is B\'ezout if and only if it is a valuation ring.
\end{lemma}

\begin{proof}
We omit the proof of the statement on localizations. The final
statement is Algebra, Lemma \ref{algebra-lemma-characterize-valuation-ring}.
The second statement follows from the other two.
\end{proof}

\begin{lemma}
\label{lemma-split-off-free-part}
Let $R$ be a B\'ezout domain.
\begin{enumerate}
\item Every finite submodule of a free module is finite free.
\item Every finitely presented $R$-module $M$ is a direct sum of a
finite free module and a torsion module $M_{tors}$ which is a
summand of a module of the form $\bigoplus_{i = 1, \ldots, n} R/f_iR$
with $f_1, \ldots, f_n \in R$ nonzero.
\end{enumerate}
\end{lemma}

\begin{proof}
Proof of (1). Let $M \subset F$ be a finite submodule of a free module $F$.
Since $M$ is finite, we may assume $F$ is a finite free module
(details omitted). Say $F = R^{\oplus n}$. We argue by induction
on $n$. If $n = 1$, then $M$ is a finitely generated ideal, hence
principal by our assumption that $R$ is B\'ezout. If $n > 1$, then
we consider the image $I$ of $M$ under the projection
$R^{\oplus n} \to R$ onto the last summand. If $I = (0)$, then
$M \subset R^{\oplus n - 1}$ and we are done by induction.
If $I \not = 0$, then $I = (f) \cong R$. Hence
$M \cong R \oplus \Ker(M \to I)$ and we are done by induction as well.

\medskip\noindent
Let $M$ be a finitely presented $R$-module. Since the localizations
of $R$ are maximal ideals are valuation rings
(Lemma \ref{lemma-localize-bezout})
we may apply Lemma \ref{lemma-warfield}.
Thus $M$ is a summand of a module of the form
$R^{\oplus r} \oplus \bigoplus_{i = 1, \ldots, n} R/f_iR$
with $f_i \not = 0$. Since taking the torsion submodule is
a functor we see that $M_{tors}$ is
a summand of the module $\bigoplus_{i = 1, \ldots, n} R/f_iR$
and $M/M_{tors}$ is a summand of $R^{\oplus r}$.
By the first part of the proof we see that $M/M_{tors}$ is
finite free. Hence $M \cong M_{tors} \oplus M/M_{tors}$
as desired.
\end{proof}

\begin{lemma}
\label{lemma-modules-PID}
Let $R$ be a PID. Every finite $R$-module $M$ is of isomorphic
to a module of the form
$$
R^{\oplus r} \oplus \bigoplus\nolimits_{i = 1, \ldots, n} R/f_iR
$$
for some $r, n \geq 0$ and $f_1, \ldots, f_n \in R$ nonzero.
\end{lemma}

\begin{proof}
A PID is a Noetherian B\'ezout ring. By Lemma \ref{lemma-split-off-free-part}
it suffices to prove the result if $M$ is torsion. Since $M$ is finite, this
means that the annihilator of $M$ is nonzero. Say $fM = 0$ for some
$f \in R$ nonzero. Then we can think of $M$ as a module over $R/fR$.
Since $R/fR$ is Noetherian of dimension $0$ (small detail omitted)
we see that $R/fR = \prod R_j$ is a finite product of Artinian
local rings $R_i$
(Algebra, Proposition \ref{algebra-proposition-dimension-zero-ring}).
Each $R_i$, being a local ring and a quotient of a PID, is a generalized
valuation ring in the sense of
Lemma \ref{lemma-generalized-valuation-ring} (small detail omitted).
Write $M = \prod M_j$ with $M_j = e_j M$ where $e_j \in R/fR$ is
the idempotent corresponding to the factor $R_j$.
By Lemma \ref{lemma-generalized-valuation-ring-modules}
we see that $M_j = \bigoplus_{i = 1, \ldots, n_j} R_j/\overline{f}_{ji}R_j$
for some $\overline{f}_{ji} \in R_j$. Choose lifts $f_{ji} \in R$
and choose $g_{ji} \in R$ with $(g_{ji}) = (f_j, f_{ji})$.
Then we conclude that
$$
M \cong \bigoplus R/g_{ji}R
$$
as an $R$-module which finishes the proof.
\end{proof}

\noindent
One can also prove that a PID is a elementary divisor domain (insert future
reference here), by proving lemmas similar to the following.

\begin{lemma}
\label{lemma-unimodular-vector}
Let $R$ be a B\'ezout domain. Let $n \geq 1$ and $f_1, \ldots, f_n \in R$
generate the unit ideal. There exists an invertible $n \times n$ matrix in
$R$ whose first row is $f_1 \ldots f_n$.
\end{lemma}

\begin{proof}
This follows from Lemma \ref{lemma-split-off-free-part}
but we can also prove it directly as follows.
By induction on $n$. The result holds for $n = 1$. Assume $n > 1$.
We may assume $f_1 \not = 0$ after renumbering.
Choose $f \in R$ such that $(f) = (f_1, \ldots, f_{n - 1})$.
Let $A$ be an $(n - 1) \times (n - 1)$ matrix whose first row
is $f_1/f, \ldots, f_{n - 1}/f$. Choose $a, b \in R$ such that
$af - bf_n = 1$ which is possible because
$1 \in (f_1, \ldots, f_n) = (f, f_n)$. Then a solution is
the matrix
$$
\left(
\begin{matrix}
f & 0 & \ldots & 0 & f_n \\
0 & 1 & \ldots & 0 & 0 \\
  &   & \ldots \\
0 & 0 & \ldots & 1 & 0 \\
b & 0 & \ldots & 0 & a
\end{matrix}
\right)
\left(
\begin{matrix}
  & & & 0 \\
  & A \\
  & & & 0 \\
0 & \ldots & 0 & 1
\end{matrix}
\right)
$$
Observe that the left matrix is invertible because it has determinant $1$.
\end{proof}






\section{Principal radical ideals}
\label{section-principal-radical-ideals}

\noindent
In this section we prove that a catenary Noetherian normal local domain
there exists a nontrivial principal radical ideal. This result can be
found in \cite{Artin-Lipman}.

\begin{lemma}
\label{lemma-polypoly}
Let $(R,\mathfrak m)$ be a Noetherian local ring of dimension one, and
let $x\in\mathfrak m$ be an element not contained in any minimal prime
of $R$. Then
\begin{enumerate}
\item the function $P : n \mapsto \text{length}_R(R/x^n R)$
satisfies $P(n) \leq n P(1)$ for $n \geq 0$,
\item if $x$ is a nonzerodivisor, then $P(n) = nP(1)$ for $n \geq 0$.
\end{enumerate}
\end{lemma}

\begin{proof}
Since $\dim(R) = 1$, we have $\dim(R/x^n R) = 0$
and so $\text{length}_R(R/x^n R)$ is finite for each $n$
(Algebra, Lemma \ref{algebra-lemma-support-point}).
To show the lemma we will induct on $n$. Since $x^0 R = R$, we have that
$P(0) = \text{length}_R(R/x^0R) = \text{length}_R 0 = 0$.
The statement also holds for $n = 1$.
Now let $n \geq 2$ and suppose the statement holds for $n - 1$.
The following sequence is exact
$$
R/x^{n-1}R \xrightarrow{x} R/x^nR \to R/xR \to 0
$$
where $x$ denotes the multiplication by $x$ map.
Since length is additive
(Algebra, Lemma \ref{algebra-lemma-length-additive}),
we have that $P(n) \leq P(n - 1) + P(1)$. By induction
$P(n - 1) \leq (n - 1)P(1)$, whence $P(n) \leq nP(1)$.
This proves the induction step.

\medskip\noindent
If $x$ is a nonzerodivisor, then the displayed exact sequence
above is exact on the left also. Hence we get
$P(n) = P(n - 1) + P(1)$ for all $n \geq 1$.
\end{proof}

\begin{lemma}
\label{lemma-minprimespoly}
Let $(R, \mathfrak m)$ be a Noetherian local ring of dimension $1$.
Let $x \in \mathfrak m$ be an element not contained in any minimal
prime of $R$. Let $t$ be the number of minimal prime ideals of $R$.
Then $t \leq \text{length}_R(R/xR)$.
\end{lemma}

\begin{proof}
Let $\mathfrak p_1, \ldots, \mathfrak p_t$ be the minimal prime ideals
of $R$. Set $R' = R/\sqrt{0} = R/(\bigcap_{i = 1}^t \mathfrak p_i)$.
We claim it suffices to prove the lemma for $R'$. Namely, it is clear
that $R'$ has $t$ minimal primes
too and $\text{length}_{R'}(R'/xR') = \text{length}_R(R'/xR')$
is less than $\text{length}_R(R/xR)$ as there is a surjection
$R/xR \to R'/xR'$. Thus we may assume $R$ is reduced.

\medskip\noindent
Assume $R$ is reduced with minimal primes
$\mathfrak p_1, \ldots, \mathfrak p_t$.
This means there is an exact sequence
$$
0 \to R \to
\prod\nolimits_{i = 1}^t R/\mathfrak p_i \to Q \to 0
$$
Here $Q$ is the cokernel of the first map.
Write $M = \prod_{i = 1}^t R/\mathfrak p_i$.
Localizing at $\mathfrak p_j$ we see that
$$
R_{\mathfrak p_j} \to M_{\mathfrak p_j} =
\left(\prod\nolimits_{i=1}^t R/\mathfrak p_i\right)_{\mathfrak p_j} =
(R/\mathfrak p_j)_{\mathfrak p_j}
$$
is surjective. Thus $Q_{\mathfrak p_j} = 0$ for all $j$.
We conclude that $\text{Supp}(Q) = \{\mathfrak m\}$ as $\mathfrak m$
is the only prime of $R$ different from the $\mathfrak p_i$.
It follows that $Q$ has finite length
(Algebra, Lemma \ref{algebra-lemma-support-point}).
Since $\text{Supp}(Q) = \{\mathfrak m\}$ we
can pick an $n \gg 0$ such that $x^n$
acts as $0$ on $Q$
(Algebra, Lemma \ref{algebra-lemma-Noetherian-power-ideal-kills-module}).
Now consider the diagram
$$
\xymatrix{
0 \ar[r] & R \ar[r] \ar[d]^-{x^n} & M
\ar[r] \ar[d]^-{x^n} & Q \ar[r] \ar[d]^-{x^n} & 0 \\
0 \ar[r] & R \ar[r] & M \ar[r] & Q \ar[r] & 0
}
$$
where the vertical maps are multiplication by $x^n$. This is injective on
$R$ and on $M$ since $x$ is not contained in any of the $\mathfrak p_i$.
By the snake lemma (Algebra, Lemma \ref{algebra-lemma-snake}),
the following sequence is exact:
$$
0 \to Q \to R/x^nR \to M/x^nM \to Q \to 0
$$
Hence we find that $\text{length}_R(R/x^nR) = \text{length}_R(M/x^nM)$
for large enough $n$. Writing $R_i = R/\mathfrak p_i$ we see
that $\text{length}(M/x^nM) =
\sum_{i = 1}^t \text{length}_R(R_i/x^nR_i)$.
Applying Lemma \ref{lemma-polypoly} and the fact that $x$ is a nonzerodivisor
on $R$ and $R_i$, we conclude that
$$
n \text{length}_R(R/xR) =
\sum\nolimits_{i = 1}^t n \text{length}_{R_i}(R_i/x R_i)
$$
Since $\text{length}_{R_i}(R_i/x R_i) \geq 1$ the lemma is proved.
\end{proof}

\begin{lemma}
\label{lemma-sopexists}
Let $(R,\mathfrak m)$ be a Noetherian local ring of dimension $d > 1$,
let $f \in \mathfrak m$ be an element not contained in any minimal prime
ideal of $R$, and let $k\in\mathbf{N}$. Then there exist elements
$g_1, \ldots, g_{d - 1} \in \mathfrak m^k$ such that
$f, g_1, \ldots, g_{d - 1}$ is a system of parameters.
\end{lemma}

\begin{proof}
We have $\dim(R/fR) = d - 1$ by
Algebra, Lemma \ref{algebra-lemma-one-equation}.
Choose a system of parameters
$\overline{g}_1, \ldots, \overline{g}_{d - 1}$
in $R/fR$ (Algebra, Proposition \ref{algebra-proposition-dimension})
and take lifts $g_1, \ldots, g_{d - 1}$ in $R$.
It is straightforward to see that
$f, g_1, \ldots, g_{d - 1}$ is a system of parameters in $R$.
Then $f, g_1^k, \ldots, g_{d - 1}^k$ is also a system of
parameters and the proof is complete.
\end{proof}

\begin{lemma}
\label{lemma-syspar}
Let $(R,\mathfrak m)$ be a Noetherian local ring of dimension
two, and let $f \in \mathfrak m$ be an element not contained in
any minimal prime ideal of $R$. Then there exist
$g \in \mathfrak m$ and $N \in \mathbf{N}$ such that
\begin{enumerate}
\item[(a)] $f,g$ form a system of parameters for $R$.
\item[(b)] If $h \in \mathfrak m^N$, then $f + h, g$ is a
system of parameters and
$\text{length}_R (R/(f, g)) = \text{length}_R(R/(f + h, g))$.
\end{enumerate}
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-sopexists} there exists a $g \in \mathfrak m$
such that $f, g$ is a system of parameters for $R$.
Then $\mathfrak m = \sqrt{(f, g)}$. Thus there exists an $n$
such that $\mathfrak m^n \subset (f, g)$, see
Algebra, Lemma \ref{algebra-lemma-Noetherian-power}. We claim that
$N = n + 1$ works.
Namely, let $h \in \mathfrak m^N$. By our choice of $N$ we can write
$h = af + bg$ with $a, b \in \mathfrak m$. Thus
$$
(f + h, g) = (f + af + bg, g) = ((1 + a)f, g) = (f, g)
$$
because $1 + a$ is a unit in $R$. This proves the equality
of lengths and the fact that $f + h, g$ is a system of parameters.
\end{proof}

\begin{lemma}
\label{lemma-radical-element}
Let $R$ be a Noetherian local normal domain of dimension $2$.
Let $\mathfrak p_1, \ldots, \mathfrak p_r$ be pairwise distinct
primes of height $1$. There exists a nonzero element
$f \in \mathfrak p_1 \cap \ldots \cap \mathfrak p_r$ such
that $R/fR$ is reduced.
\end{lemma}

\begin{proof}
Let $f \in \mathfrak p_1 \cap \ldots \cap \mathfrak p_r$ be a nonzero element.
We will modify $f$ slightly to obtain an element that generates a radical ideal.
The localization $R_\mathfrak p$ of $R$ at each height one prime
ideal $\mathfrak p$ is a discrete valuation ring, see
Algebra, Lemma \ref{algebra-lemma-characterize-dvr} or
Algebra, Lemma \ref{algebra-lemma-criterion-normal}.
We denote by $\text{ord}_\mathfrak p(f)$ the corresponding
valuation of $f$ in $R_{\mathfrak p}$. Let
$\mathfrak q_1, \ldots, \mathfrak q_s$
be the distinct height one prime ideals containing $f$.
Write $\text{ord}_{\mathfrak q_j}(f) = m_j \geq 1$ for each $j$.
Then we define $\text{div}(f) = \sum_{j = 1}^s m_j\mathfrak q_j$
as a formal linear combination of
height one primes with integer coefficients.
Note for later use that each of the primes $\mathfrak p_i$
occurs among the primes $\mathfrak q_j$.
The ring $R/fR$ is reduced if and only if
$m_j = 1$ for $j = 1, \ldots, s$. Namely, if $m_j$ is $1$ then
$(R/fR)\mathfrak q_j$ is reduced and
$R/fR \subset \prod (R/fR)_{\mathfrak q_j}$ as
$\mathfrak q_1, \ldots, \mathfrak q_j$ are the associated primes
of $R/fR$, see Algebra, Lemmas
\ref{algebra-lemma-zero-at-ass-zero} and
\ref{algebra-lemma-normal-domain-intersection-localizations-height-1}.

\medskip\noindent
Choose and fix $g$ and $N$ as in Lemma \ref{lemma-syspar}.
For a nonzero $y \in R$ denote $t(y)$ the number of primes minimal over $y$.
Since $R$ is a normal domain, these primes
are height one and correspond $1$-to-$1$ to the minimal primes of
$R/yR$ (Algebra, Lemmas \ref{algebra-lemma-minimal-over-1} and
\ref{algebra-lemma-normal-domain-intersection-localizations-height-1}).
For example $t(f) = s$ is the number
of primes $\mathfrak q_j$ occurring in $\text{div}(f)$.
Let $h \in \mathfrak m^N$. By Lemma \ref{lemma-minprimespoly} we have
\begin{align*}
t(f + h) & \leq \text{length}_{R/(f + h)}(R/(f + h, g)) \\
& = \text{length}_R(R/(f + h, g)) \\
& = \text{length}_R(R/(f, g))
\end{align*}
see Algebra, Lemma \ref{algebra-lemma-length-independent}
for the first equality.
Therefore we see that $t(f + h)$ is bounded independent of
$h \in \mathfrak m^N$.

\medskip\noindent
By the boundedness proved above we may pick
$h \in \mathfrak m^N \cap \mathfrak p_1 \cap \ldots \cap \mathfrak p_r$
such that $t(f + h)$ is maximal among such $h$. Set $f' = f + h$.
Given $h' \in \mathfrak m^N \cap \mathfrak p_1 \cap \ldots \cap \mathfrak p_r$
we see that the number $t(f' + h') \leq t(f + h)$.
Thus after replacing $f$ by $f'$ we may assume that for every
$h \in \mathfrak m^N \cap \mathfrak p_1 \cap \ldots \cap \mathfrak p_r$
we have $t(f + h) \leq s$.

\medskip\noindent
Next, assume that we can find an element $h \in \mathfrak m^N$ such that
for each $j$ we have $\text{ord}_{\mathfrak q_j}(h) \geq 1$ and
$\text{ord}_{\mathfrak q_j}(h) = 1 \Leftrightarrow m_j > 1$.
Observe that
$h \in \mathfrak m^N \cap \mathfrak p_1 \cap \ldots \cap \mathfrak p_r$.
Then $\text{ord}_{\mathfrak q_j}(f + h) = 1$
for every $j$ by elementary properties of valuations.
Thus
$$
\text{div}(f + h) = \sum\nolimits_{j = 1}^s \mathfrak q_j +
\sum\nolimits_{k = 1}^v e_k \mathfrak r_k
$$
for some pairwise distinct height one prime ideals
$\mathfrak r_1, \ldots, \mathfrak r_v$ and $e_k \geq 1$.
However, since $s = t(f) \geq t(f + h)$ we see that $v = 0$
and we have found the desired element.

\medskip\noindent
Now we will pick $h$ that satisfies the above criteria.
By prime avoidance (Algebra, Lemma \ref{algebra-lemma-silly})
for each $1 \leq j \leq s$ we can find an element $a_j \in \mathfrak q_j$
such that $a_j \not \in \mathfrak q_{j'}$ for $j' \not = j$
and $a_j \not \in \mathfrak q_j^{(2)}$. Here
$\mathfrak q_j^{(2)} = \{x \in R \mid \text{ord}_{\mathfrak q_j}(x) \geq 2\}$
is the second symbolic power of $\mathfrak q_j$.
Then we take
$$
h = \prod\nolimits_{m_j = 1} a_j^2 \times
\prod\nolimits_{m_j > 1} a_j
$$
Then $h$ clearly satisfies the conditions on valuations imposed above.
If $h \not \in \mathfrak m^N$, then we multiply by an element of
$\mathfrak m^N$ which is not contained in $\mathfrak q_j$ for all $j$.
\end{proof}

\begin{lemma}
\label{lemma-divides-radical}
Let $(A, \mathfrak m, \kappa)$ be a Noetherian normal local domain
of dimension $2$. If $a \in \mathfrak m$ is nonzero, then there exists an
element $c \in A$ such that $A/cA$ is reduced and such that $a$ divides
$c^n$ for some $n$.
\end{lemma}

\begin{proof}
Let $\text{div}(a) = \sum_{i = 1, \ldots, r} n_i \mathfrak p_i$
with notation as in the proof of Lemma \ref{lemma-radical-element}.
Choose $c \in \mathfrak p_1 \cap \ldots \cap \mathfrak p_r$ with $A/cA$
reduced, see Lemma \ref{lemma-radical-element}. For $n \geq \max(n_i)$
we see that $-\text{div}(a) + \text{div}(c^n)$
is an effective divisor (all coefficients nonnegative).
Thus $c^n/a \in A$ by Algebra, Lemma
\ref{algebra-lemma-normal-domain-intersection-localizations-height-1}.
\end{proof}

\noindent
In the rest of this section we prove the result in dimension $> 2$.

\begin{lemma}
\label{lemma-multiplicity}
Let $(R, \mathfrak m)$ be a Noetherian local ring of dimension $d$, let
$g_1, \ldots, g_d$ be a system of parameters, and let
$I = (g_1, \ldots, g_d)$. If $e_I/d!$ is the leading coefficient of the
numerical polynomial
$n \mapsto \text{length}_R(R/I^{n+1})$, then $e_I \leq \text{length}_R(R/I)$.
\end{lemma}

\begin{proof}
The function is a numerical polynomial by
Algebra, Proposition \ref{algebra-proposition-hilbert-function-polynomial}.
It has degree $d$ by
Algebra, Proposition \ref{algebra-proposition-dimension}.
If $d = 0$, then the result is trivial.
If $d = 1$, then the result is Lemma \ref{lemma-polypoly}.
To prove it in general, observe that there is a surjection
$$
\bigoplus\nolimits_{i_1, \ldots, i_d \geq 0,\ \sum i_j = n} R/I
\longrightarrow
I^n/I^{n + 1}
$$
sending the basis element corresponding to $i_1, \ldots, i_d$
to the class of $g_1^{i_1} \ldots g_d^{i_d}$ in $I^n/I^{n + 1}$.
Thus we see that
$$
\text{length}_R(R/I^{n + 1}) - \text{length}_R(R/I^n)
\leq  \text{length}_R(R/I) {n + d - 1 \choose d - 1}
$$
Since $d \geq 2$ the numerical polynomial on the left has
degree $d - 1$ with leading coefficient $e_I / (d - 1)!$.
The polynomial on the right has degree $d - 1$ and its
leading coefficient is $\text{length}_R(R/I)/ (d - 1)!$.
This proves the lemma.
\end{proof}

\begin{lemma}
\label{lemma-minprimespolyhigher}
Let $(R, \mathfrak m)$ be a Noetherian local ring of dimension $d$, let $t$
be the number of minimal prime ideals of $R$ of dimension $d$, and let
$(g_1,\ldots,g_d)$ be a system of parameters. Then
$t \leq \text{length}_R(R/(g_1,\ldots,g_n))$.
\end{lemma}

\begin{proof}
If $d = 0$ the lemma is trivial. If $d = 1$ the lemma is
Lemma \ref{lemma-minprimespoly}. Thus we may assume $d > 1$.
Let $\mathfrak p_1, \ldots, \mathfrak p_s$ be the minimal prime ideals of
$R$ where the first $t$ have dimension $d$, and denote
$I = (g_1, \ldots, g_n)$. Arguing in exactly the same way as in
the proof of Lemma \ref{lemma-minprimespoly} we can assume $R$ is reduced.

\medskip\noindent
Assume $R$ is reduced with minimal primes
$\mathfrak p_1, \ldots, \mathfrak p_t$.
This means there is an exact sequence
$$
0 \to R \to
\prod\nolimits_{i = 1}^t R/\mathfrak p_i \to Q \to 0
$$
Here $Q$ is the cokernel of the first map.
Write $M = \prod_{i = 1}^t R/\mathfrak p_i$.
Localizing at $\mathfrak p_j$ we see that
$$
R_{\mathfrak p_j} \to M_{\mathfrak p_j} =
\left(\prod\nolimits_{i=1}^t R/\mathfrak p_i\right)_{\mathfrak p_j} =
(R/\mathfrak p_j)_{\mathfrak p_j}
$$
is surjective. Thus $Q_{\mathfrak p_j} = 0$ for all $j$. Therefore no
height $0$ prime of $R$ is in the support of $Q$. It follows that
the degree of the numerical polynomial
$n \mapsto \text{length}_R(Q/I^nQ)$ equals $\dim(\text{Supp}(Q)) < d$, see
Algebra, Lemma \ref{algebra-lemma-support-dimension-d}.
By Algebra, Lemma \ref{algebra-lemma-hilbert-ses-chi}
(which applies as $R$ does not have finite length) the polynomial
$$
n \longmapsto
\text{length}_R(M/I^nM) - \text{length}_R(R/I^n) - \text{length}_R(Q/I^nQ)
$$
has degree $< d$. Since $M = \prod R/\mathfrak p_i$ and since
$n \to \text{length}_R(R/\mathfrak p_i + I^n)$ is a numerical
polynomial of degree exactly(!) $d$ for $i = 1, \ldots, t$ (by
Algebra, Lemma \ref{algebra-lemma-support-dimension-d})
we see that the leading coefficient of $n \mapsto \text{length}_R(M/I^nM)$
is at least $t/d!$. Thus we conclude by Lemma \ref{lemma-multiplicity}.
\end{proof}

\begin{lemma}
\label{lemma-sysparhigher}
Let $(R, \mathfrak m)$ be a Noetherian local ring of dimension $d$, and let
$f \in \mathfrak m$ be an element not contained in any minimal
prime ideal of $R$. Then there exist elements
$g_1, \ldots, g_{d - 1} \in \mathfrak m$ and $N \in \mathbf{N}$ such that
\begin{enumerate}
\item $f, g_1, \ldots, g_{d - 1}$ form a system of parameters for $R$
\item If $h \in \mathfrak m^N$, then $f + h, g_1, \ldots, g_{d - 1}$ is a
system of parameters and we have
$\text{length}_R R/(f, g_1, \ldots, g_{d-1}) =
\text{length}_R R/(f + h, g_1, \ldots, g_{d-1})$.
\end{enumerate}
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-sopexists} there exist
$g_1, \ldots, g_{d - 1} \in \mathfrak m$
such that $f, g_1, \ldots, g_{d - 1}$ is a system of parameters for $R$.
Then $\mathfrak m = \sqrt{(f, g_1, \ldots, g_{d - 1})}$.
Thus there exists an $n$ such that $\mathfrak m^n \subset (f, g)$, see
Algebra, Lemma \ref{algebra-lemma-Noetherian-power}. We claim that
$N = n + 1$ works.
Namely, let $h \in \mathfrak m^N$. By our choice of $N$ we can write
$h = af + \sum b_ig_i$ with $a, b_i \in \mathfrak m$. Thus
\begin{align*}
(f + h, g_1, \ldots, g_{d - 1})
& =
(f + af + \sum b_ig_i, g_1, \ldots, g_{d - 1}) \\
& =
((1 + a)f, g_1, \ldots, g_{d - 1}) \\
& =
(f, g_1, \ldots, g_{d - 1})
\end{align*}
because $1 + a$ is a unit in $R$. This proves the equality
of lengths and the fact that $f + h, g_1, \ldots, g_{d - 1}$
is a system of parameters.
\end{proof}

\begin{proposition}
\label{proposition-propdimd}
\begin{reference}
\cite[Lemma 3.14]{Artin-Lipman} has this result without the
assumption that the ring is catenary
\end{reference}
Let $R$ be a catenary Noetherian local normal domain.
Let $J \subset R$ be a radical ideal.
Then there exists a nonzero element $f \in J$
such that $R/fR$ is reduced.
\end{proposition}

\begin{proof}
The proof is the same as that of
Lemma \ref{lemma-radical-element},
using Lemma \ref{lemma-minprimespolyhigher} instead of
Lemma \ref{lemma-minprimespoly} and
Lemma \ref{lemma-sysparhigher} instead of
Lemma \ref{lemma-syspar}.
We can use Lemma \ref{lemma-minprimespolyhigher} because $R$
is a catenary domain, so every height one prime ideal of $R$
has dimension $d - 1$, and hence the spectrum of $R/(f + h)$ is
equidimensional. For the convenience of the reader we write out
the details.

\medskip\noindent
Let $f \in J$ be a nonzero element.
We will modify $f$ slightly to obtain an element that generates a radical ideal.
The localization $R_\mathfrak p$ of $R$ at each height one prime
ideal $\mathfrak p$ is a discrete valuation ring, see
Algebra, Lemma \ref{algebra-lemma-characterize-dvr} or
Algebra, Lemma \ref{algebra-lemma-criterion-normal}.
We denote by $\text{ord}_\mathfrak p(f)$ the corresponding
valuation of $f$ in $R_{\mathfrak p}$. Let
$\mathfrak q_1, \ldots, \mathfrak q_s$
be the distinct height one prime ideals containing $f$.
Write $\text{ord}_{\mathfrak q_j}(f) = m_j \geq 1$
for each $j$. Then we define
$\text{div}(f) = \sum_{j = 1}^s m_j\mathfrak q_j$
as a formal linear combination of
height one primes with integer coefficients.
The ring $R/fR$ is reduced if and only if
$m_j = 1$ for $j = 1, \ldots, s$. Namely, if $m_j$ is $1$ then
$(R/fR)\mathfrak q_j$ is reduced and
$R/fR \subset \prod (R/fR)_{\mathfrak q_j}$ as
$\mathfrak q_1, \ldots, \mathfrak q_j$ are the associated primes
of $R/fR$, see Algebra, Lemmas
\ref{algebra-lemma-zero-at-ass-zero} and
\ref{algebra-lemma-normal-domain-intersection-localizations-height-1}.

\medskip\noindent
Choose and fix $g_2, \ldots, g_{d - 1}$ and $N$ as in
Lemma \ref{lemma-sysparhigher}.
For a nonzero $y \in R$ denote $t(y)$ the number of primes minimal over $y$.
Since $R$ is a normal domain, these primes
are height one and correspond $1$-to-$1$ to the minimal primes of
$R/yR$ (Algebra, Lemmas \ref{algebra-lemma-minimal-over-1} and
\ref{algebra-lemma-normal-domain-intersection-localizations-height-1}).
For example $t(f) = s$ is the number
of primes $\mathfrak q_j$ occurring in $\text{div}(f)$.
Let $h \in \mathfrak m^N$. Because $R$ is catenary, for each
height one prime $\mathfrak p$ of $R$ we have
$\dim(R/\mathfrak p) = d$. Hence by
Lemma \ref{lemma-minprimespolyhigher}
we have
\begin{align*}
t(f + h) & \leq \text{length}_{R/(f + h)}(R/(f + h, g_1, \ldots, g_{d - 1})) \\
& = \text{length}_R(R/(f + h, g_1, \ldots, g_{d - 1})) \\
& = \text{length}_R(R/(f, g_1, \ldots, g_{d - 1}))
\end{align*}
see Algebra, Lemma \ref{algebra-lemma-length-independent}
for the first equality.
Therefore we see that $t(f + h)$ is bounded independent of
$h \in \mathfrak m^N$.

\medskip\noindent
By the boundedness proved above we may pick $h \in \mathfrak m^N \cap J$
such that $t(f + h)$ is maximal among such $h$. Set $f' = f + h$.
Given $h' \in \mathfrak m^N \cap J$
we see that the number $t(f' + h') \leq t(f + h)$.
Thus after replacing $f$ by $f'$ we may assume that for every
$h \in \mathfrak m^N \cap J$ we have $t(f + h) \leq s$.

\medskip\noindent
Next, assume that we can find an element $h \in \mathfrak m^N \cap J$
such that for each $j$ we have $\text{ord}_{\mathfrak q_j}(h) \geq 1$ and
$\text{ord}_{\mathfrak q_j}(h) = 1 \Leftrightarrow m_j > 1$.
Then $\text{ord}_{\mathfrak q_j}(f + h) = 1$
for every $j$ by elementary properties of valuations.
Thus
$$
\text{div}(f + h) = \sum\nolimits_{j = 1}^s \mathfrak q_j +
\sum\nolimits_{k = 1}^v e_k \mathfrak r_k
$$
for some pairwise distinct height one prime ideals
$\mathfrak r_1, \ldots, \mathfrak r_v$ and $e_k \geq 1$.
However, since $s = t(f) \geq t(f + h)$ we see that $v = 0$
and we have found the desired element.

\medskip\noindent
Now we will pick $h$ that satisfies the above criteria.
By prime avoidance (Algebra, Lemma \ref{algebra-lemma-silly})
for each $1 \leq j \leq s$ we can find an element
$a_j \in \mathfrak q_j \cap J$
such that $a_j \not \in \mathfrak q_{j'}$ for $j' \not = j$.
Next, we can pick $b_j \in J \cap \mathfrak q_1 \cap \ldots \cap q_s$
with $b_j \not \in \mathfrak q_j^{(2)}$. Here
$\mathfrak q_j^{(2)} = \{x \in R \mid \text{ord}_{\mathfrak q_j}(x) \geq 2\}$
is the second symbolic power of $\mathfrak q_j$.
Prime avoidance applies because the ideal
$J' = J \cap \mathfrak q_1 \cap \ldots \cap q_s$
is radical, hence $R/J'$ is reduced, hence $(R/J')_{\mathfrak q_j}$
is reduced, hence $J'$ contains an element $x$ with
$\text{ord}_{\mathfrak q_j}(x) = 1$, hence
$J' \not \subset \mathfrak q_j^{(2)}$. Then the element
$$
c = \sum\nolimits_{j = 1, \ldots, s}
b_j \times \prod\nolimits_{j' \not = j} a_{j'}
$$
is an element of $J$
with $\text{ord}_{\mathfrak q_j}(c) = 1$ for all $j = 1, \ldots, s$
by elementary properties of valuations. Finally, we let
$$
h = c \times \prod\nolimits_{m_j = 1} a_j \times y
$$
where $y \in \mathfrak m^N$ is an element
which is not contained in $\mathfrak q_j$ for all $j$.
\end{proof}








\section{Invertible objects in the derived category}
\label{section-invertible-D-or-R}

\noindent
We characterize invertible objects in the derived category of
a ring.

\begin{lemma}
\label{lemma-symmetric-monoidal-derived}
Let $R$ be a ring. The derived category $D(R)$ of $R$
is a symmetric monoidal category with tensor product
given by derived tensor product and associativity and
commutativity constraints as in Section \ref{section-sign-rules}.
\end{lemma}

\begin{proof}
Omitted. Hints: The associativity constraint is the isomorphism of
Lemma \ref{lemma-triple-tensor-product}
and the commutativity constraint is the isomorphism of
Lemma \ref{lemma-flip-douoble-tensor-product}.
Having said this the commutativity of various diagrams
follows from the corresponding result for the category
of complexes of $R$-modules, see Section \ref{section-symmetric-monoidal}.
\end{proof}

\noindent
Thus we know what it means for an object of $D(R)$ to have a (left) dual
or to be invertible. Before we can work out what this amounts to we
need a simple lemma.

\begin{lemma}
\label{lemma-complex-bounded-above-free-colim-bounded-finite-free}
Let $R$ be a ring. Let $F^\bullet$ be a bounded above complex of
free $R$-modules. Given pairs $(n_i, f_i)$, $i = 1, \ldots, N$
with $n_i \in \mathbf{Z}$ and $f_i \in F^{n_i}$ there exists
a subcomplex $G^\bullet \subset F^\bullet$ containing
all $f_i$ which is bounded and consists of finite free $R$-modules.
\end{lemma}

\begin{proof}
By descending induction on $a = \min(n_i; i = 1, \ldots, N)$.
If $F^n = 0$ for $n \geq a$, then the result is true with
$G^\bullet$ equal to the zero complex. In general, after renumbering
we may assume there exists an $1 \leq r \leq N$ such that
$n_1 = \ldots = n_r = a$ and $n_i > a$ for $i > r$.
Choose a basis $b_j, j \in J$ for $F^a$. We can choose a finite subset
$J' \subset J$ such that $f_i \in \bigoplus_{j \in J'} Rb_j$
for $i = 1, \ldots, r$. Choose a basis $c_k, k \in K$ for $F^{a + 1}$.
We can choose a finite subset $K' \subset K$ such that
$\text{d}_F^a(b_j) \in \bigoplus_{k \in K'} Rc_k$ for
$j \in J'$. Then we can apply the induction
hypothesis to find a subcomplex $H^\bullet \subset F^\bullet$
containing $c_k \in F^{a + 1}$ for $k \in K'$ and
$f_i \in F^{n_i}$ for $i > r$. Take $G^\bullet$ equal to
$H^\bullet$ in degrees $> a$ and equal to $\bigoplus_{j \in J'} Rb_j$
in degree $a$.
\end{proof}

\begin{lemma}
\label{lemma-have-dual-derived}
Let $R$ be a ring. Let $M$ be an object of $D(R)$. The following
are equivalent
\begin{enumerate}
\item $M$ has a left dual in $D(R)$ as in
Categories, Definition \ref{categories-definition-dual},
\item $M$ is a perfect object of $D(R)$.
\end{enumerate}
Moreover, in this case the left dual of $M$ is the object
$M^\vee$ of Lemma \ref{lemma-dual-perfect-complex}.
\end{lemma}

\begin{proof}
If $M$ is perfect, then we can represent $M$ by a bounded complex
$M^\bullet$ of finite projective $R$-modules. In this case $M^\bullet$
has a left dual in the category of complexes by
Lemma \ref{lemma-left-dual-complex}
which is a fortiori a left dual in $D(R)$.

\medskip\noindent
Assume (1). Say $N$, $\eta : R \to M \otimes_R^\mathbf{L} N$, and
$\epsilon : M \otimes_R^\mathbf{L} N \to R$ is a left dual
as in Categories, Definition \ref{categories-definition-dual}.
Choose a complex $M^\bullet$ representing $M$. Choose a
K-flat complexes $N^\bullet$ with flat terms
representing $N$, see Lemma \ref{lemma-K-flat-resolution}.
Then $\eta$ is given by a map of complexes
$$
\eta : R \longrightarrow \text{Tot}(M^\bullet \otimes_R N^\bullet)
$$
We can write the image of $1$ as a finite sum
$$
\eta(1) = \sum\nolimits_n \sum\nolimits_i m_{n, i} \otimes n_{-n, i}
$$
with $m_{n, i} \in M^n$ and $n_{-n, i} \in N^{-n}$. Let
$K^\bullet \subset M^\bullet$ be the subcomplex
generated by all the elements $m_{n, i}$ and $\text{d}(m_{n, i})$.
By our choice of $N^\bullet$ we find that
$\text{Tot}(K^\bullet \otimes_R N^\bullet) \subset
\text{Tot}(M^\bullet \otimes_R N^\bullet)$ and
$\eta(1)$ is in the subcomplex by our choice above.
Denote $K$ the object of $D(R)$ represented by $K^\bullet$.
Then we see that $\eta$ factors over a map
$\tilde \eta : R \longrightarrow K \otimes_R^\mathbf{L} N$.
Since
$(1 \otimes \epsilon) \circ (\eta \otimes 1) = \text{id}_M$
we conclude that the identity on $M$ factors through $K$
by the commutative diagram
$$
\xymatrix{
M \ar[rr]_-{\eta \otimes 1} \ar[rrd]_{\tilde \eta \otimes 1} & &
M \otimes_R^\mathbf{L} N \otimes_R^\mathbf{L} M
\ar[r]_-{1 \otimes \epsilon} &
M \\
& &
K \otimes_R^\mathbf{L} N \otimes_R^\mathbf{L} M
\ar[u] \ar[r]^-{1 \otimes \epsilon} &
K \ar[u]
}
$$
Since $K$ is bounded above it follows that $M \in D^-(R)$.
Thus we can represent $M$ by a bounded above complex
$M^\bullet$ of free $R$-modules, see for example
Derived Categories, Lemma \ref{derived-lemma-subcategory-left-resolution}.
Write $\eta(1) = \sum\nolimits_n \sum\nolimits_i m_{n, i} \otimes n_{-n, i}$
as before.
By Lemma \ref{lemma-complex-bounded-above-free-colim-bounded-finite-free}
we can find a subcomplex $K^\bullet \subset M^\bullet$
containing all the elements $m_{n, i}$
which is bounded and consists of finite free $R$-modules.
As above we find that the identity on $M$ factors through $K$.
Since $K$ is perfect we conclude $M$ is perfect too, see
Lemma \ref{lemma-summands-perfect}.
\end{proof}

\begin{lemma}
\label{lemma-invertible-derived}
Let $R$ be a ring. Let $M$ be an object of $D(R)$. The following
are equivalent
\begin{enumerate}
\item $M$ is invertible in $D(R)$, see
Categories, Definition \ref{categories-definition-invertible}, and
\item for every prime ideal $\mathfrak p \subset R$ there
exists an $f \in R$, $f \not \in \mathfrak p$ such that
$M_f \cong R_f[-n]$ for some $n \in \mathbf{Z}$.
\end{enumerate}
Moreover, in this case
\begin{enumerate}
\item[(a)] $M$ is a perfect object of $D(R)$,
\item[(b)] $M = \bigoplus H^n(M)[-n]$ in $D(R)$,
\item[(c)] each $H^n(M)$ is a finite projective $R$-module,
\item[(d)] we can write $R = \prod_{a \leq n \leq b} R_n$
such that $H^n(M)$ corresponds to an invertible $R_n$-module.
\end{enumerate}
\end{lemma}

\begin{proof}
Assume (2). Consider the object $R\Hom_R(M, R)$ and the composition map
$$
R\Hom(M, R) \otimes_R^\mathbf{L} M \to R
$$
Checking locally we see that this is an isomorphism; we omit the details.
Because $D(R)$ is symmetric monoidal we see that $M$ is invertible.

\medskip\noindent
Assume (1). Observe that an invertible object of a monoidal category
has a left dual, namely, its inverse. Thus $M$ is perfect by
Lemma \ref{lemma-have-dual-derived}. Consider a prime ideal
$\mathfrak p \subset R$ with residue field $\kappa$.
Then we see that $M \otimes_R^\mathbf{L} \kappa$ is an
invertible object of $D(\kappa)$. Clearly this implies that
$\dim H^i(M \otimes_R^\mathbf{L} \kappa)$ is nonzero exactly
for one $i$ and equal to $1$ in that case. By
Lemma \ref{lemma-lift-perfect-from-residue-field}
this gives (2).

\medskip\noindent
In the proof above we have seen that (a) holds. Let $U_n \subset \Spec(R)$
be the union of the opens of the form $D(f)$ such that
$M_f \cong R_f[-n]$. Clearly, $U_n \cap U_{n'} = \emptyset$ if $n \not = n'$.
If $M$ has tor amplitude in $[a, b]$, then $U_n = \emptyset$
if $n \not \in [a, b]$. Hence we see that we have a product decomposition
$R = \prod_{a \leq n \leq b} R_n$ as in (d) such that
$U_n$ corresponds to $\Spec(R_n)$, see
Algebra, Lemma \ref{algebra-lemma-disjoint-implies-product}.
Since $D(R) = \prod_{a \leq n \leq b} D(R_n)$ and similary
for the category of modules parts (b), (c), and (d) follow immediately.
\end{proof}





\section{Splitting off a free module}
\label{section-serre-splitting}

\noindent
The arguments in this section are due to Serre, see \cite{Serre-projective}.

\begin{situation}
\label{situation-splitting}
Here $R$ is a ring and $M$ is a finitely presented $R$-module.
Denote $\Omega \subset \Spec(R)$ the set of closed points
with the induced topology. For $x \in \Omega$ denote
$M(x) = M/xM$ the fibre of $M$ at $x$. This is a finite
dimensional vector space over the residue field $\kappa(x)$ at $x$.
Given $s \in M$ we denote $s(x)$ the image of $s$ in $M(x)$.
\end{situation}

\begin{lemma}
\label{lemma-which-elements-split}
In Situation \ref{situation-splitting} let $x \in \Omega$. There exists a
canonical short exact sequence
$$
0 \to B(x) \to M(x) \to V(x) \to 0
$$
of $\kappa(x)$-vector spaces which the following
property: for $s_1, \ldots, s_r \in M$ the following are equivalent
\begin{enumerate}
\item there exists an $f \in R$, $f \not \in x$ such that
the map $s_1, \ldots, s_r : R^{\oplus r} \to M$ becomes the
inclusion of a direct summand after inverting $f$, and
\item $s_1(x), \ldots, s_r(x)$ map to linearly independent
elements of $V(x)$.
\end{enumerate}
\end{lemma}

\begin{proof}
Define $B(x) \subset M(x)$ as the perpendicular of the image of the map
$$
\Hom_R(M, R) \to \Hom_{\kappa(x)}(M(x), \kappa(x))
$$
and set $V(x) = M(x)/B(x)$. Then any $R$-linear map $\varphi : M \to R$
induces a map $\overline{\varphi} : V(x) \to \kappa(x)$ and conversely
any $\kappa(x)$-linear map $\lambda : V(x) \to \kappa(x)$ is equal
to $\overline{\varphi}$ for some $\varphi$. Let $s_1, \ldots, s_r \in M$.

\medskip\noindent
Suppose $s_1, \ldots, s_r$ map to linearly independent elements of
$V(x)$. Then we can find $\varphi_1, \ldots, \varphi_r \in \Hom_R(M, R)$
such that $\varphi_i(s_j)$ maps to $\delta_{ij}$\footnote{Kronecker delta.}
in $\kappa(x)$. Hence the matrix of the composition
$$
R^{\oplus r}
\xrightarrow{s_1, \ldots, s_r}
M
\xrightarrow{\varphi_1, \ldots, \varphi_r}
R^{\oplus r}
$$
has a determinant $f \in R$ which maps to $1$ in $\kappa(x)$
Clearly, this implies that $s_1, \ldots, s_r : R^{\oplus r} \to M$
is the inclusion of a direct summand after inverting $f$.

\medskip\noindent
Conversely, suppose that we have an $f \in R$, $f \not \in x$
such that $s_1, \ldots, s_r : R^{\oplus r} \to M$
is the inclusion of a direct summand after inverting $f$.
Hence we can find $R_f$-linear maps $\varphi_i : M_f \to R_f$
such that $\varphi_i(s_j) = \delta_{ij} \in R_f$.
Since $\Hom_R(M, R)_f = \Hom_{R_f}(M_f, R_f)$ by
Algebra, Lemma \ref{algebra-lemma-hom-from-finitely-presented}
we conclude that we can find $n \geq 0$ and $\varphi'_i \in \Hom_R(M, R)$
such that $\varphi'_i(s_j) = f^n\delta_{ij} \in R$.
It follows that $s_1, \ldots, s_r$ map to linearly independent
elements of $V(x)$ as $\overline{\varphi}'_i(s_j) = f^n\delta_{ij}$.
\end{proof}

\noindent
In Situation \ref{situation-splitting} given $s_1, \ldots, s_r \in M$
we denote $Z(s_1, \ldots, s_r) \subset \Omega$ the set of $x \in \Omega$
such that $s_1(x), \ldots, s_r(x)$ map to linearly dependent elements
of $V(x)$. By the lemma this is a closed subset of $\Omega$.

\begin{lemma}
\label{lemma-choose-values}
In Situation \ref{situation-splitting} let $x_1, \ldots, x_n \in \Omega$
be pairwise distinct. Let $v_i \in V(x_i)$. Then there exists
an $s \in M$ such that $s(x_i)$ maps to $v_i$ for $i = 1, \ldots, n$.
\end{lemma}

\begin{proof}
Since $x_i$ is a maximal ideal of $R$ we may use
Algebra, Lemma \ref{algebra-lemma-chinese-remainder}
to see that $M(x_1) \oplus \ldots \oplus M(x_n)$
is a quotient of $M$.
\end{proof}

\begin{proposition}
\label{proposition-splitting}
\begin{reference}
\cite[Theorem 2]{Serre-projective}
\end{reference}
In Situation \ref{situation-splitting} assume $\Omega$ is
a Noetherian topological space. Let $s_1, \ldots, s_h \in M$.
Let $Z(s_1, \ldots, s_h) \subset F \subset \Omega$ be closed.
Let $x_1, \ldots, x_n \in F$ be pairwise distinct.
Let $v_i  \in V(x_i)$.
Let $k \geq 0$ be an integer such that
$$
(*)\quad h + k \leq \dim_{\kappa(x)} V(x)\text{ for all }x \in \Omega
$$
Then there exist $s \in M$ and $F' \subset \Omega$ closed such that
\begin{enumerate}
\item[(a)] $s(x_i)$ maps to $v_i$,
\item[(b)] $Z(s_1, \ldots, s_h, s) \subset F \cup F'$, and
\item[(c)] every irreducible component of $F'$ has
codimension $\geq k$ in $\Omega$.
\end{enumerate}
\end{proposition}

\begin{proof}
We note that codimension was defined in
Topology, Section \ref{topology-section-catenary-spaces}
and that we will use some results on Noetherian topological
spaces contained in
Topology, Section \ref{topology-section-noetherian}.

\medskip\noindent
The proof is by induction on $k$. If $k = 0$, then we choose
$s \in M$ as in Lemma \ref{lemma-choose-values} and we choose
$F' = \Omega$.

\medskip\noindent
Assume $k > 0$. By our induction hypothesis we may
choose $u \in M$ and $G \subset \Omega$ closed satisfying
(a), (b), (c) for $s_1, \ldots, s_h$, $F$, $x_1, \ldots, x_n$,
$v_1, \ldots, v_n$, and $k - 1$.

\medskip\noindent
Let $G = G_1 \cup \ldots \cup G_m$ be the decomposition of $G$ into
its irreducible components. If $G_j \subset F$, then we can remove
it from the list. Thus we may assume $G_j$ is not contained in $F$
for $j = 1, \ldots, m$.
For $j = 1, \ldots, m$ choose $y_j \in G_j$ with $y_j \not \in F$
and $y_j \not \in G_{j'}$ for $j' \not = j$. This is possible as
there are no inclusions among the irreducible components of $G$.
Choose $w_j \in V(y_j)$ not contained in the span of the images of
$s_1(y_j), \ldots, s_h(y_j)$; this is possible because
$h + k \leq \dim V(y_j)$ and $k > 0$.

\medskip\noindent
Apply the induction hypothesis to the $h + 1$ sections
$s_1, \ldots, s_h, u$, the closed set $F \cup G$,
the points $x_1, \ldots, x_n, y_1, \ldots, y_m \in F \cup G$,
the elements $0 \in V(x_i)$ and $w_j \in V(y_j)$, and
the integer $k - 1$. Note that we have increased $h$ by $1$ and
decreased $k$ by $1$ hence the assumption $(*)$ of the proposition
remains valid. This produces $t \in M$ and $H \subset \Omega$ closed
satisfying (a), (b), (c) for $s_1, \ldots, s_h, u$, $F \cup G$,
$x_1, \ldots, x_n, y_1, \ldots, y_m$, $0, \ldots, 0, w_1, \ldots, w_m$,
and $k - 1$.

\medskip\noindent
Let $H_1, \ldots, H_p \subset H$ be the irreducible components of $H$
which are not contained in $F \cup G$. As before pick $z_l \in H_l$,
$z_l \not \in F \cup G$ and $z_l \not \in H_{l'}$ for $l' \not = l$.
Using Algebra, Lemma \ref{algebra-lemma-chinese-remainder}
we may choose $f \in R$ such that
$f(y_j) = 1$, $j = 1, \ldots, m$ and $f(z_l) = 0$, $l = 1, \ldots, p$.
Claim: the element $s = u + f t$ works.

\medskip\noindent
First, the value $s(x_i)$ agrees with $u(x_i)$ because
$t(x_i) = 0$ and hence we see that $s(x_i)$ maps to $v_i$.
This proves (a).
To finish the proof it suffices to show that every irreducible
component $Z$ of $Z(s_1, \ldots, s_h, s)$ not contained in $F$
has codimension $\geq k$ in $\Omega$. Namely, then we can set $F'$
equal to the union of these and we get (b) and (c).
We can see that irreducible components $Z$ of $Z(s_1, \ldots, s_h, s)$
of codimension $\leq k - 1$ do not exist as follows:
\begin{enumerate}
\item Observe that
$Z(s_1, \ldots, s_h, s) \subset Z(s_1, \ldots, s_h, u, t) = F \cup H$
as $s = u + ft$. Hence $Z \subset H$.
\item The irreducible components of $H$ have codimension $\geq k - 1$.
Hence $Z$ is equal to an irreducible component of $H$
as $Z$ has codimension $\leq k - 1$.
Hence $Z = H_l$ for some $l \in \{1, \ldots, p\}$ or
$Z = G_j$ for some $j \in \{1, \ldots m\}$.
\item But $Z = G_j$ is impossible as $s_1(y_j), \ldots, s_h(y_j)$
map to linearly independent elements of $V(y_j)$ and
$s(y_j) = u(y_j) + f(y_j) t(y_j) = u(y_j) + t(y_j)$
maps to an element of the form
$$
\text{linear combination images of }s_i(y_j) + w_j
$$
which is linearly independent of the images of $s_1(y_j), \ldots, s_h(y_j)$
in $V(y_j)$ by our choice of $w_j$.
\item Also $Z = Z_l$ is impossible. Namely, again
$s_1(z_l), \ldots, s_h(z_l)$ map to linearly independent
elements of $V(z_l)$ and $s(z_l) = u(z_l) + f(z_l) t(z_l) = u(z_l)$
maps to an element of $V(z_l)$ linearly independent of those
as $z_l \not \in F \cup G$.
\end{enumerate}
This finishes the proof.
\end{proof}

\begin{theorem}
\label{theorem-splitting}
\begin{reference}
\cite[Theorem 1]{Serre-projective}
\end{reference}
Let $R$ be a ring whose max spectrum $\Omega \subset \Spec(R)$
is a Noetherian topological space of dimension $d < \infty$.
Let $M$ be a finitely presented $R$-module such that
for all $\mathfrak m \in \Omega$ the $R_\mathfrak m$-module
$M_\mathfrak m$ has a free direct summand of rank $> d$.
Then $M \cong R \oplus M'$.
\end{theorem}

\begin{proof}
For $\mathfrak m \in \Omega$ suppose that $R_\mathfrak m^{\oplus r}$
is a direct summand of $M_\mathfrak m$. Then by Algebra, Lemmas
\ref{algebra-lemma-localization-colimit} and
\ref{algebra-lemma-colimit-category-fp-modules}
we see that $R_f^{\oplus r}$ is a direct summand of $M_f$
for some $f \in R$, $f \not \in \mathfrak m$. Hence
the assumption means that $\dim V(x) > d$ for all $x \in \Omega$
where $V(x)$ is as in Lemma \ref{lemma-which-elements-split}.
By Proposition \ref{proposition-splitting} applied with $F = \emptyset$,
$h = 0$ and no $s_i$, $n = 0$ and no $x_i, v_i$, and $k = d + 1$
we find an $s \in M$ and $F' \subset \Omega$
such that every irreducible component of $F'$ has codimension $\geq d + 1$
and $Z(s) \subset F'$. Since $d = \dim(\Omega)$ this forces
$F' = \emptyset$. Hence $s : R \to M$ is the inclusion of a
direct summand at all maximal ideals. It follows that $s$ is universally
injective, see Algebra, Lemma
\ref{algebra-lemma-universally-injective-check-stalks}. Then
$s$ is split injective by
Algebra, Lemma \ref{algebra-lemma-universally-exact-split}.
\end{proof}








\section{Big projective modules are free}
\label{section-big-projective-free}

\noindent
In this section we discuss one of the results of \cite{Bass};
we suggest the reader look at the original paper. Our argument
will use the slightly simplified proof given in the papers
\cite{Akasaki} and \cite{Hinohara}.

\begin{lemma}[Eilenberg's lemma]
\label{lemma-eilenberg-swindle}
\begin{slogan}
Eilenberg swindle
\end{slogan}
\begin{history}
In \cite{Bass} we find: ``...is an elegant little swindle,
observed several years ago by Eilenberg, and which
might well have sprung from the brow of Barry Mazur.''
\end{history}
\begin{reference}
\cite[Eilenberg's lemma]{Bass}
\end{reference}
If $P \oplus Q \cong F$ with $F$ a nonfinitely generated free module,
then $P \oplus F \cong F$.
\end{lemma}

\begin{proof}
$$
F \cong F \oplus F \oplus \ldots \cong
P \oplus Q \oplus P \oplus Q \oplus \ldots \cong
P \oplus F \oplus F \oplus \ldots \cong P \oplus F
$$
\end{proof}

\begin{lemma}
\label{lemma-projective-plus-free-is-free}
Let $R$ be a ring. Let $P$ be a projective module.
There exists a free module $F$ such that $P \oplus F$ is free.
\end{lemma}

\begin{proof}
Since $P$ is projective we see that $F_0 = P \oplus Q$
is a free module for some module $Q$. Set
$F = \bigoplus_{n \geq 1} F_0$. Then
$P \oplus F \cong F$ by Lemma \ref{lemma-eilenberg-swindle}.
\end{proof}

\begin{lemma}
\label{lemma-element-projective}
Let $R$ be a ring. Let $P$ be a projective module.
Let $s \in P$. There exists a finite free module $F$
and a finite free direct summand $K \subset F \oplus P$
with $(0, s) \in K$.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-projective-plus-free-is-free} we can
find a (possibly infinite) free module $F$ such that
$F \oplus P$ is free. Then of course $(0, s)$ is contained
in a finite free direct summand $K \subset F \oplus P$. In turn $K$
is contained in $F' \oplus P$ where $F' \subset F$ is
a finite free direct summand.
\end{proof}

\begin{lemma}
\label{lemma-trick-to-find-good-element}
Let $R$ be a ring with Jacobson radical $J$ such that $R/J$
is Noetherian. Let $P$ be a projective $R$-module
such that $P_\mathfrak m$ has infinite rank for all maximal ideals
$\mathfrak m$ of $R$. Let $s \in P$ and $M \subset P$ such that
$Rs + M = P$. Then we can find $m \in M$ such that $R(s + m)$
is a free direct summand of $P$.
\end{lemma}

\begin{proof}
The statement makes sense as $P_\mathfrak m$ is free by
Algebra, Theorem \ref{algebra-theorem-projective-free-over-local-ring}.

\medskip\noindent
Denote $M' \subset P/JP$ the image of $M$ and $s' \in P/JP$ the
image of $s$. Observe that $R/J s' + M' = P/JP$.
Suppose we can find $m' \in M'$ such that
$R/J(s' + m')$ is a free direct summand of $M'$.
Choose $\varphi' : P/JP \to R/J$ which gives a splitting, i.e.,
we have $\varphi'(s' + m') = 1$ in $R/J$.
Then since $P$ is a projective $R$-module we can find
a lift $\varphi : P \to R$ of $\varphi'$.
Choose $m \in M$ mapping to $m'$.
Then $\varphi(s + m) \in R$ is congruent to $1$ modulo $J$ and hence
a unit in $R$ (Algebra, Lemma \ref{algebra-lemma-contained-in-radical}).
Whence $R(s + m)$ is a free direct summand of $P$.
This reduces us to the case discussed in the next paragraph.

\medskip\noindent
Assume $R$ is Noetherian. Let $m \in M$ be an element and let
$\varphi_1, \ldots, \varphi_n : P \to R$ be $R$-linear maps. Denote
$$
Z(s + m, \varphi_1, \ldots, \varphi_n) \subset \Spec(R)
$$
the vanishing locus of $\varphi_1(s + m), \ldots, \varphi_n(s + m) \in R$.

\medskip\noindent
Suppose $\mathfrak m$ is a maximal ideal of $R$ and
$\mathfrak m \in Z(s, \varphi_1, \ldots, \varphi_n)$.
Set $K = M \cap \bigcap \Ker(\varphi_i)$. We claim the image of
$$
K/\mathfrak mK \to P/\mathfrak m P
$$
has infinite dimension. Namely, the quotient $P/K$ is a finite $R$-module
as it is isomorphic to a submodule of $P/M \oplus R^{\oplus n}$.
Thus we see that
the kernel of the displayed arrow is a quotient of
$\text{Tor}_1^R(P/K, \kappa(\mathfrak m))$ which is finite
by Algebra, Lemma \ref{algebra-lemma-tor-noetherian}.
Combined with the fact that $P/\mathfrak mP$ has infinite
dimension we obtain our claim. Thus we can find a $t \in K$
which maps to a nonzero element $\overline{t}$
of the vector space $P/\mathfrak mP$.
By linear algebra, we find an $R$-linear map
$\overline{\varphi} : P \to \kappa(\mathfrak m)$
such that $\overline{\varphi}(\overline{t}) = 1$.
Since $P$ is projective, we can find an $R$-linear map
$\varphi : P \to R$ lifting $\overline{\varphi}$.
Then we see that the vanishing locus
$Z(s + m + t, \varphi_1, \ldots, \varphi_n, \varphi)$ is
contained in $Z(s + m, \varphi_1, \ldots, \varphi_n)$ but
does not contain $\mathfrak m$, i.e., it
is strictly smaller than $Z(s + m, \varphi_1, \ldots, \varphi_n)$.

\medskip\noindent
Since $\Spec(R)$ is a Noetherian topological space, we see
from the arguments above that we may find
$m \in M$ and $\varphi_1, \ldots, \varphi_n : P \to R$
such that the closed subset $Z(s + m, \varphi_1, \ldots, \varphi_n)$
does not contain any closed points of $\Spec(R)$.
Hence $Z(s + m, \varphi_1, \ldots, \varphi_n) = \emptyset$.
Hence we can find $r_1, \ldots, r_n \in R$ such that
$\sum r_i\varphi_i(s + m) = 1$. Hence
$$
R \xrightarrow{s + m} P \xrightarrow{\sum r_i \varphi_i} R
$$
is the desired splitting.
\end{proof}

\begin{lemma}
\label{lemma-element-in-free-summand}
Let $R$ be a ring with Jacobson radical $J$ such that $R/J$
is Noetherian. Let $P$ be a projective $R$-module
such that $P_\mathfrak m$ has infinite rank for all maximal ideals
$\mathfrak m$ of $R$. Let $s \in P$. Then we can find
a finite stably free direct summand $M \subset P$ such that $s \in M$.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-element-projective} we can find a finite free
module $F$ and a finite free direct summand $K \subset F \oplus P$ such
that $(0, s) \in K$. By induction on the rank of $F$ we reduce
to the case discussed in the next paragraph.

\medskip\noindent
Assume there exists a finite stably free direct summand $K \subset R \oplus P$
such that $(0, s) \in K$. Choose a complement $K'$ of $K$, i.e.,
such that $R \oplus P = K \oplus K'$. The projection
$\pi : R \oplus P \to K'$ is surjectve, hence by
Lemma \ref{lemma-trick-to-find-good-element}
we find a $p \in P$ such that $\pi(1, p) \in K'$ generates
a free direct summand. Accordingly we write
$K' = R\pi(1, p) \oplus K''$. We see that
$$
R \oplus P = K \oplus K' = K \oplus R\pi(1, p) \oplus K''
$$
The projection $\pi' : P \to K''$ is surjective\footnote{Namely,
if $k'' \in K''$ then $k''$ viewed as an element of $K'$
can be written as $k'' = \lambda \pi(1, 0) + \pi(0, q)$
for some $\lambda \in R$ and $q \in P$.
This means $k'' = \lambda \pi(1, p) + \pi(0, q - \lambda p)$.
This in turn means that $q - \lambda p$ maps to $k''$ by
the composition $P \to R \oplus P \xrightarrow{\pi} K' \to K''$
since $K' \to K''$ annihilates $\pi(1, p)$.}
and hence split
(as $K''$ is projective). Thus $\Ker(\pi') \subset P$ is a
direct summand containing $s$. Finally, by construction we
have an isomorphism
$$
R \oplus \Ker(\pi') \cong K \oplus R\pi(1, p)
$$
and hence since $K$ is finite and stably free, so is $\Ker(\pi')$.
\end{proof}

\begin{theorem}
\label{theorem-countable-free}
\begin{reference}
Commutative case of \cite[Theorem 3.1]{Bass}
\end{reference}
Let $R$ be a ring with Jacobson radical $J$ such that $R/J$ is Noetherian.
Let $P$ be a countably generated projective $R$-module such that
$P_\mathfrak m$ has infinite rank for all maximal ideals
$\mathfrak m$ of $R$. Then $P$ is free.
\end{theorem}

\begin{proof}
We first prove that $P$ is a countable direct sum of finite stably
free modules. Let $x_1, x_2, \ldots$ be a countable set of generators for $P$.
We inductively construct finite stably free direct summands
$F_1, F_2, \ldots$ of $P$ such that for all $n$ we have
that $F_1 \oplus \ldots \oplus F_n$ is a direct summand of $P$
which contains $x_1, \ldots, x_n$. Namely, given $F_1, \ldots, F_n$
with the desired properties, write
$$
P = F_1 \oplus \ldots \oplus F_n \oplus P'
$$
and let $s \in P'$ be the image of $x_{n + 1}$.
By Lemma \ref{lemma-element-in-free-summand}
we can find a finite stably free direct summand $F_{n + 1} \subset P'$
containing $s$. Then $P = \bigoplus_{i = 1}^{\infty} F_i$.

\medskip\noindent
Assume that $P$ is an infinite direct sum
$P = \bigoplus_{i = 1}^{\infty} F_i$ of nonzero
finite stably free modules. The stable freeness
of the modules $F_i$ will be used in the following
manner: the rank of each $F_i$ is constant (and positive). Hence
we see that $P_\mathfrak m$ is free
of countably infinite rank for each maximal ideal
$\mathfrak m$ of $R$. By Lemma \ref{lemma-trick-to-find-good-element}
applied with $s = 0$ and $M = P$, we can find
a $t_1 \in P$ such that $Rt_1$ is a free direct summand of $P$.
Then $t_1$ is contained in $F_1 \oplus \ldots \oplus F_{n_1}$
for some $n_1 > n_0 = 0$.
The same reasoning applied to $\bigoplus_{n > n_1} F_n$
produces an $n_1 < n_2$ and $t_2 \in F_{n_1 + 1} \oplus \ldots \oplus F_{n_2}$
which generates a free direct summand.
Continuing in this fashion we obtain a free direct summand
$$
\bigoplus\nolimits_{i \geq 1} t_i :
\bigoplus\nolimits_{i \geq 1} R
\longrightarrow
\bigoplus\nolimits_{i \geq 1}
\bigoplus\nolimits_{n_i \geq n > n_{i - 1}} F_n = P
$$
of infinite rank. Thus we see that $P \cong Q \oplus F$ for some free
$R$-module $F$ of countable rank. Since $Q$ is countably
generated it follows that $Q \oplus Q' \cong F$ for
some module $Q'$. Then the Eilenberg swindle
(Lemma \ref{lemma-eilenberg-swindle}) implies that
$Q \oplus F \cong F$ and $P$ is free.
\end{proof}







\input{chapters}

\bibliography{my}
\bibliographystyle{amsalpha}

\end{document}
