\input{preamble}

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

\title{Discriminants and Differents}


\maketitle

\phantomsection
\label{section-phantom}

\tableofcontents

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

\noindent
In this chapter we study the different and discriminant
of locally quasi-finite morphisms of schemes.
A good reference for some of this material is \cite{Kunz}.

\medskip\noindent
Given a quasi-finite morphism $f : Y \to X$ of Noetherian schemes
there is a relative dualizing module $\omega_{Y/X}$. 
In Section \ref{section-quasi-finite-dualizing}
we construct this module from scratch, using
Zariski's main theorem and \'etale localization methods.
The key property is that given a diagram
$$
\xymatrix{
Y' \ar[d]_{f'} \ar[r]_{g'} & Y \ar[d]^f \\
X' \ar[r]^g & X
}
$$
with $g : X' \to X$ flat, $Y' \subset X' \times_X Y$ open, and
$f' : Y' \to X'$ finite, then there is a canonical isomorphism
$$
f'_*(g')^*\omega_{Y/X} =
\SheafHom_{\mathcal{O}_{X'}}(f'_*\mathcal{O}_{Y'}, \mathcal{O}_{X'})
$$
as sheaves of $f'_*\mathcal{O}_{Y'}$-modules. In
Section \ref{section-quasi-finite-traces} we prove that
if $f$ is flat, then there is a canonical global section
$\tau_{Y/X} \in H^0(Y, \omega_{Y/X})$ which for every commutative
diagram as above maps $(g')^*\tau_{Y/X}$ to the trace map
of Section \ref{section-discriminant}
for the finite locally free morphism $f'$.
In Section \ref{section-different}
we define the different for a flat quasi-finite
morphism of Noetherian schemes as the annihilator of the
cokernel of $\tau_{Y/X} : \mathcal{O}_X \to \omega_{Y/X}$.

\medskip\noindent
The main goal of this chapter is to prove that for
quasi-finite syntomic\footnote{AKA flat and lci.} $f$ the
different agrees with the K\"ahler different.
The K\"ahler different is the zeroth fitting ideal of $\Omega_{Y/X}$, see
Section \ref{section-kahler-different}.
This agreement is not obvious; we use a slick argument
due to Tate, see Section \ref{section-formula-different}.
On the way we also discuss the Noether different
and the Dedekind different.

\medskip\noindent
Only in the end of this chapter, see
Sections \ref{section-comparison} and \ref{section-gorenstein-lci},
do we make the link with the more advanced material
on duality for schemes.








\section{Dualizing modules for quasi-finite ring maps}
\label{section-quasi-finite-dualizing}

\noindent
Let $A \to B$ be a quasi-finite homomorphism of Noetherian rings. By
Zariski's main theorem
(Algebra, Lemma \ref{algebra-lemma-quasi-finite-open-integral-closure})
there exists a factorization $A \to B' \to B$ with
$A \to B'$ finite and $B' \to B$ inducing an open immersion of spectra.
We set
\begin{equation}
\label{equation-dualizing}
\omega_{B/A} = \Hom_A(B', A) \otimes_{B'} B
\end{equation}
in this situation. The reader can think of this as a kind of relative
dualizing module, see Lemmas \ref{lemma-compare-dualizing} and
\ref{lemma-compare-dualizing-algebraic}.
In this section we will show by elementary commutative algebra methods
that $\omega_{B/A}$ is independent of the choice of the factorization
and that formation of $\omega_{B/A}$ commutes with flat base change.
To help prove the independence of factorizations we compare two
given factorizations.

\begin{lemma}
\label{lemma-dominate-factorizations}
Let $A \to B$ be a quasi-finite ring map. Given two factorizations
$A \to B' \to B$ and $A \to B'' \to B$ with
$A \to B'$ and $A \to B''$ finite and $\Spec(B) \to \Spec(B')$
and $\Spec(B) \to \Spec(B'')$ open immersions, there exists
an $A$-subalgebra $B''' \subset B$ finite over $A$ such that
$\Spec(B) \to \Spec(B''')$ an open immersion and $B' \to B$ and
$B'' \to B$ factor through $B'''$.
\end{lemma}

\begin{proof}
Let $B''' \subset B$ be the $A$-subalgebra generated by the images
of $B' \to B$ and $B'' \to B$. As $B'$ and $B''$ are each generated
by finitely many elements integral over $A$, we see that $B'''$ is
generated by finitely many elements integral over $A$ and we conclude
that $B'''$ is finite over $A$
(Algebra, Lemma \ref{algebra-lemma-characterize-finite-in-terms-of-integral}).
Consider the maps
$$
B = B' \otimes_{B'} B \to B''' \otimes_{B'} B \to B \otimes_{B'} B = B
$$
The final equality holds because $\Spec(B) \to \Spec(B')$ is an
open immersion (and hence a monomorphism). The second arrow is injective
as $B' \to B$ is flat. Hence both arrows are isomorphisms.
This means that
$$
\xymatrix{
\Spec(B''') \ar[d] & \Spec(B) \ar[d] \ar[l] \\
\Spec(B') & \Spec(B) \ar[l]
}
$$
is cartesian. Since the base change of an open immersion is an
open immersion we conclude.
\end{proof}

\begin{lemma}
\label{lemma-dualizing-well-defined}
The module (\ref{equation-dualizing}) is well defined, i.e.,
independent of the choice of the factorization.
\end{lemma}

\begin{proof}
Let $B', B'', B'''$ be as in Lemma \ref{lemma-dominate-factorizations}.
We obtain a canonical map
$$
\omega''' = \Hom_A(B''', A) \otimes_{B'''} B \longrightarrow
\Hom_A(B', A) \otimes_{B'} B = \omega'
$$
and a similar one involving $B''$. If we show these maps are isomorphisms
then the lemma is proved. Let $g \in B'$ be an element such that
$B'_g \to B_g$ is an isomorphism and hence $B'_g \to (B''')_g \to B_g$
are isomorphisms. It suffices to show that $(\omega''')_g \to \omega'_g$
is an isomorphism. The kernel and cokernel of the ring map $B' \to B'''$
are finite $A$-modules and $g$-power torsion.
Hence they are annihilated by a power of $g$.
This easily implies the result.
\end{proof}

\begin{lemma}
\label{lemma-localize-dualizing}
Let $A \to B$ be a quasi-finite map of Noetherian rings.
\begin{enumerate}
\item If $A \to B$ factors as $A \to A_f \to B$ for some $f \in A$,
then $\omega_{B/A} = \omega_{B/A_f}$.
\item If $g \in B$, then $(\omega_{B/A})_g = \omega_{B_g/A}$.
\item If $f \in A$, then $\omega_{B_f/A_f} = (\omega_{B/A})_f$.
\end{enumerate}
\end{lemma}

\begin{proof}
Say $A \to B' \to B$ is a factorization with $A \to B'$ finite and
$\Spec(B) \to \Spec(B')$ an open immersion. In case (1) we may use
the factorization $A_f \to B'_f \to B$ to compute $\omega_{B/A_f}$
and use Algebra, Lemma \ref{algebra-lemma-hom-from-finitely-presented}.
In case (2) use the factorization $A \to B' \to B_g$ to see the result.
Part (3) follows from a combination of (1) and (2).
\end{proof}

\noindent
Let $A \to B$ be a quasi-finite ring map of Noetherian rings, let
$A \to A_1$ be an arbitrary ring map of Noetherian rings, and set
$B_1 = B \otimes_A A_1$. We obtain a cocartesian diagram
$$
\xymatrix{
B \ar[r] & B_1 \\
A \ar[u] \ar[r] & A_1 \ar[u]
}
$$
Observe that $A_1 \to B_1$ is quasi-finite as well (Algebra, Lemma
\ref{algebra-lemma-quasi-finite-base-change}).
In this situation we will define a canonical
$B$-linear base change map
\begin{equation}
\label{equation-bc-dualizing}
\omega_{B/A} \longrightarrow \omega_{B_1/A_1}
\end{equation}
Namely, we choose a factorization $A \to B' \to B$ as in the construction
of $\omega_{B/A}$. Then $B'_1 = B' \otimes_A A_1$ is finite over $A_1$
and we can use the factorization $A_1 \to B'_1 \to B_1$ in the construction
of $\omega_{B_1/A_1}$. Thus we have to construct a map
$$
\Hom_A(B', A) \otimes_{B'} B
\longrightarrow
\Hom_{A_1}(B' \otimes_A A_1, A_1) \otimes_{B'_1} B_1
$$
Thus it suffices to construct a $B'$-linear map
$\Hom_A(B', A) \to \Hom_{A_1}(B' \otimes_A A_1, A_1)$
which we will denote $\varphi \mapsto \varphi_1$.
Namely, given an $A$-linear map $\varphi : B' \to A$ we
let $\varphi_1$ be the map such that
$\varphi_1(b' \otimes a_1) = \varphi(b')a_1$.
This is clearly $A_1$-linear and the construction is complete.

\begin{lemma}
\label{lemma-bc-map-dualizing}
The base change map (\ref{equation-bc-dualizing})
is independent of the choice of the
factorization $A \to B' \to B$. Given ring maps $A \to A_1 \to A_2$
the composition of the base change maps for $A \to A_1$ and $A_1 \to A_2$
is the base change map for $A \to A_2$.
\end{lemma}

\begin{proof}
Omitted. Hint: argue in exactly the same way as in
Lemma \ref{lemma-dualizing-well-defined}
using Lemma \ref{lemma-dominate-factorizations}.
\end{proof}

\begin{lemma}
\label{lemma-dualizing-flat-base-change}
If $A \to A_1$ is flat, then
the base change map (\ref{equation-bc-dualizing}) induces an isomorphism
$\omega_{B/A} \otimes_B B_1 \to \omega_{B_1/A_1}$.
\end{lemma}

\begin{proof}
Assume that $A \to A_1$ is flat. By construction of $\omega_{B/A}$ we may
assume that $A \to B$ is finite. Then $\omega_{B/A} = \Hom_A(B, A)$ and
$\omega_{B_1/A_1} = \Hom_{A_1}(B_1, A_1)$. Since $B_1 = B \otimes_A A_1$
the result follows from More on Algebra, Lemma
\ref{more-algebra-lemma-pseudo-coherence-and-base-change-ext}.
\end{proof}

\begin{lemma}
\label{lemma-dualizing-composition}
Let $A \to B \to C$ be quasi-finite homomorphisms of Noetherian rings.
There is a canonical map
$\omega_{B/A} \otimes_B \omega_{C/B} \to \omega_{C/A}$.
\end{lemma}

\begin{proof}
Choose $A \to B' \to B$ with $A \to B'$ finite such that
$\Spec(B) \to \Spec(B')$ is an open immersion. Then
$B' \to C$ is quasi-finite too. Choose $B' \to C' \to C$
with $B' \to C'$ finite and $\Spec(C) \to \Spec(C')$ an
open immersion. Then the source of the arrow is
$$
\Hom_A(B', A) \otimes_{B'} B \otimes_B
\Hom_B(B \otimes_{B'} C', B) \otimes_{B \otimes_{B'} C'} C
$$
which is equal to
$$
\Hom_A(B', A) \otimes_{B'}
\Hom_{B'}(C', B) \otimes_{C'} C
$$
This indeed comes with a canonical map to
$\Hom_A(C', A) \otimes_{C'} C = \omega_{C/A}$
coming from composition
$\Hom_A(B', A) \times \Hom_{B'}(C', B) \to \Hom_A(C', A)$.
\end{proof}

\begin{lemma}
\label{lemma-dualizing-product}
Let $A \to B$ and $A \to C$ be quasi-finite maps of Noetherian rings.
Then $\omega_{B \times C/A} = \omega_{B/A} \times \omega_{C/A}$
as modules over $B \times C$.
\end{lemma}

\begin{proof}
Choose factorizations $A \to B' \to B$ and $A \to C' \to C$ such that
$A \to B'$ and $A \to C'$ are finite and such that $\Spec(B) \to \Spec(B')$
and $\Spec(C) \to \Spec(C')$ are open immersions. Then
$A \to B' \times C' \to B \times C$ is a similar factorization.
Using this factorization to compute $\omega_{B \times C/A}$
gives the lemma.
\end{proof}

\begin{lemma}
\label{lemma-dualizing-associated-primes}
Let $A \to B$ be a quasi-finite homomorphism of Noetherian rings.
Then $\text{Ass}_B(\omega_{B/A})$ is the set of primes of $B$
lying over associated primes of $A$.
\end{lemma}

\begin{proof}
Choose a factorization $A \to B' \to B$ with $A \to B'$ finite and
$B' \to B$ inducing an open immersion on spectra. As
$\omega_{B/A} = \omega_{B'/A} \otimes_{B'} B$ it suffices
to prove the statement for $\omega_{B'/A}$. Thus we may assume $A \to B$
is finite.

\medskip\noindent
Assume $\mathfrak p \in \text{Ass}(A)$ and $\mathfrak q$ is a prime
of $B$ lying over $\mathfrak p$. Let $x \in A$ be an element whose
annihilator is $\mathfrak p$. Choose a nonzero $\kappa(\mathfrak p)$
linear map $\lambda : \kappa(\mathfrak q) \to \kappa(\mathfrak p)$.
Since $A/\mathfrak p \subset B/\mathfrak q$ is a finite extension
of rings, there is an $f \in A$, $f \not \in \mathfrak p$
such that $f\lambda$ maps $B/\mathfrak q$ into $A/\mathfrak p$.
Hence we obtain a nonzero $A$-linear map
$$
B \to B/\mathfrak q \to A/\mathfrak p \to A,\quad
b \mapsto f\lambda(b)x
$$
An easy computation shows that this element of $\omega_{B/A}$
has annihilator $\mathfrak q$, whence
$\mathfrak q \in \text{Ass}(\omega_{B/A})$.

\medskip\noindent
Conversely, suppose that $\mathfrak q \subset B$ is a prime ideal
lying over a prime $\mathfrak p \subset A$ which is not an associated
prime of $A$. We have to show that
$\mathfrak q \not \in \text{Ass}_B(\omega_{B/A})$.
After replacing $A$ by $A_\mathfrak p$ and $B$ by
$B_\mathfrak p$ we may assume that $\mathfrak p$ is a maximal ideal
of $A$. This is allowed by Lemma \ref{lemma-dualizing-flat-base-change} and
Algebra, Lemma \ref{algebra-lemma-localize-ass}.
Then there exists an $f \in \mathfrak m$
which is a nonzerodivisor on $A$.
Then $f$ is a nonzerodivisor on $\omega_{B/A}$
and hence $\mathfrak q$ is not an associated prime of this module.
\end{proof}

\begin{lemma}
\label{lemma-dualizing-base-flat-flat}
Let $A \to B$ be a flat quasi-finite homomorphism of Noetherian rings.
Then $\omega_{B/A}$ is a flat $A$-module.
\end{lemma}

\begin{proof}
Let $\mathfrak q \subset B$ be a prime lying over $\mathfrak p \subset A$.
We will show that the localization $\omega_{B/A, \mathfrak q}$ is flat
over $A_\mathfrak p$.
This suffices by Algebra, Lemma \ref{algebra-lemma-flat-localization}.
By
Algebra, Lemma \ref{algebra-lemma-etale-makes-quasi-finite-finite-one-prime}
we can find an \'etale ring map $A \to A'$ and a prime
ideal $\mathfrak p' \subset A'$ lying over $\mathfrak p$
such that $\kappa(\mathfrak p') = \kappa(\mathfrak p)$ and
such that
$$
B' = B \otimes_A A' = C \times D
$$
with $A' \to C$ finite and such that the unique prime $\mathfrak q'$
of $B \otimes_A A'$ lying over $\mathfrak q$ and $\mathfrak p'$
corresponds to a prime of $C$. By 
Lemma \ref{lemma-dualizing-flat-base-change}
and Algebra, Lemma \ref{algebra-lemma-base-change-flat-up-down}
it suffices to show $\omega_{B'/A', \mathfrak q'}$
is flat over $A'_{\mathfrak p'}$.
Since $\omega_{B'/A'} = \omega_{C/A'} \times \omega_{D/A'}$
by Lemma \ref{lemma-dualizing-product}
this reduces us to the case where $B$ is finite flat over $A$.
In this case $B$ is finite locally free as an $A$-module
and $\omega_{B/A} = \Hom_A(B, A)$ is the dual finite
locally free $A$-module.
\end{proof}

\begin{lemma}
\label{lemma-dualizing-base-change-of-flat}
If $A \to B$ is flat, then the base change map (\ref{equation-bc-dualizing})
induces an isomorphism $\omega_{B/A} \otimes_B B_1 \to \omega_{B_1/A_1}$.
\end{lemma}

\begin{proof}
If $A \to B$ is finite flat, then $B$ is finite locally free as an $A$-module.
In this case $\omega_{B/A} = \Hom_A(B, A)$ is the dual finite
locally free $A$-module and formation of this module commutes
with arbitrary base change which proves the lemma in this case.
In the next paragraph we reduce the general (quasi-finite flat)
case to the finite flat case just discussed.

\medskip\noindent
Let $\mathfrak q_1 \subset B_1$ be a prime. We will show that the
localization of the map at the prime $\mathfrak q_1$ is an isomorphism, which
suffices by Algebra, Lemma \ref{algebra-lemma-characterize-zero-local}.
Let $\mathfrak q \subset B$ and $\mathfrak p \subset A$ be the prime
ideals lying under $\mathfrak q_1$. By
Algebra, Lemma \ref{algebra-lemma-etale-makes-quasi-finite-finite-one-prime}
we can find an \'etale ring map $A \to A'$ and a prime
ideal $\mathfrak p' \subset A'$ lying over $\mathfrak p$
such that $\kappa(\mathfrak p') = \kappa(\mathfrak p)$ and
such that
$$
B' = B \otimes_A A' = C \times D
$$
with $A' \to C$ finite and such that the unique prime $\mathfrak q'$
of $B \otimes_A A'$ lying over $\mathfrak q$ and $\mathfrak p'$
corresponds to a prime of $C$. Set $A'_1 = A' \otimes_A A_1$ and
consider the base change maps
(\ref{equation-bc-dualizing}) for the ring maps
$A \to A' \to A'_1$ and $A \to A_1 \to A'_1$ as in the diagram
$$
\xymatrix{
\omega_{B'/A'} \otimes_{B'} B'_1 \ar[r] & \omega_{B'_1/A'_1} \\
\omega_{B/A} \otimes_B B'_1 \ar[r] \ar[u] &
\omega_{B_1/A_1} \otimes_{B_1} B'_1 \ar[u]
}
$$
where $B' = B \otimes_A A'$, $B_1 = B \otimes_A A_1$, and
$B_1' = B \otimes_A (A' \otimes_A A_1)$. By
Lemma \ref{lemma-bc-map-dualizing} the diagram commutes. By
Lemma \ref{lemma-dualizing-flat-base-change}
the vertical arrows are isomorphisms.
As $B_1 \to B'_1$ is \'etale and hence flat it suffices
to prove the top horizontal arrow is an isomorphism after localizing
at a prime $\mathfrak q'_1$ of $B'_1$ lying over $\mathfrak q$
(there is such a prime and use
Algebra, Lemma \ref{algebra-lemma-local-flat-ff}).
Thus we may assume that $B = C \times D$ with $A \to C$
finite and $\mathfrak q$ corresponding to a prime of $C$.
In this case the dualizing module $\omega_{B/A}$ decomposes
in a similar fashion (Lemma \ref{lemma-dualizing-product})
which reduces the question
to the finite flat case $A \to C$ handled above.
\end{proof}

\begin{remark}
\label{remark-relative-dualizing-for-quasi-finite}
Let $f : Y \to X$ be a locally quasi-finite morphism of locally Noetherian
schemes. It is clear from Lemma \ref{lemma-localize-dualizing}
that there is a unique coherent $\mathcal{O}_Y$-module
$\omega_{Y/X}$ on $Y$ such that for every pair of affine opens
$\Spec(B) = V \subset Y$, $\Spec(A) = U \subset X$ with $f(V) \subset U$
there is a canonical isomorphism
$$
H^0(V, \omega_{Y/X}) = \omega_{B/A}
$$
and where these isomorphisms are compatible with restriction maps.
\end{remark}

\begin{lemma}
\label{lemma-compare-dualizing-algebraic}
Let $A \to B$ be a quasi-finite homomorphism of Noetherian rings.
Let $\omega_{B/A}^\bullet \in D(B)$ be the algebraic relative dualizing
complex discussed in Dualizing Complexes, Section
\ref{dualizing-section-relative-dualizing-complexes-Noetherian}.
Then there is a (nonunique) isomorphism
$\omega_{B/A} = H^0(\omega_{B/A}^\bullet)$.
\end{lemma}

\begin{proof}
Choose a factorization $A \to B' \to B$
where $A \to B'$ is finite and $\Spec(B') \to \Spec(B)$
is an open immersion. Then
$\omega_{B/A}^\bullet = \omega_{B'/A}^\bullet \otimes_B^\mathbf{L} B'$
by Dualizing Complexes, Lemmas
\ref{dualizing-lemma-composition-shriek-algebraic} and
\ref{dualizing-lemma-upper-shriek-localize} and
the definition of $\omega_{B/A}^\bullet$. Hence
it suffices to show there is an isomorphism when $A \to B$ is finite.
In this case we can use
Dualizing Complexes, Lemma \ref{dualizing-lemma-upper-shriek-finite}
to see that $\omega_{B/A}^\bullet = R\Hom(B, A)$ and hence
$H^0(\omega^\bullet_{B/A}) = \Hom_A(B, A)$ as desired.
\end{proof}






\section{Discriminant of a finite locally free morphism}
\label{section-discriminant}

\noindent
Let $X$ be a scheme and let $\mathcal{F}$ be a finite locally
free $\mathcal{O}_X$-module. Then there is a canonical {\it trace} map
$$
\text{Trace} :
\SheafHom_{\mathcal{O}_X}(\mathcal{F}, \mathcal{F})
\longrightarrow
\mathcal{O}_X
$$
See Exercises, Exercise \ref{exercises-exercise-trace-det}. This map has
the property that $\text{Trace}(\text{id})$ is the locally constant function
on $\mathcal{O}_X$ corresponding to the rank of $\mathcal{F}$.

\medskip\noindent
Let $\pi : X \to Y$ be a morphism of schemes which is finite locally
free. Then there exists a canonical {\it trace for $\pi$}
which is an $\mathcal{O}_Y$-linear map
$$
\text{Trace}_\pi : \pi_*\mathcal{O}_X \longrightarrow \mathcal{O}_Y
$$
sending a local section $f$ of $\pi_*\mathcal{O}_X$ to the
trace of multiplication by $f$ on $\pi_*\mathcal{O}_X$. Over
affine opens this recovers the construction in
Exercises, Exercise \ref{exercises-exercise-trace-det-rings}.
The composition
$$
\mathcal{O}_Y \xrightarrow{\pi^\sharp} \pi_*\mathcal{O}_X
\xrightarrow{\text{Trace}_\pi} \mathcal{O}_Y
$$
equals multiplication by the degree of $\pi$ (which is a locally constant
function on $Y$). In analogy with
Fields, Section \ref{fields-section-trace-pairing}
we can define the trace pairing
$$
Q_\pi :
\pi_*\mathcal{O}_X \times \pi_*\mathcal{O}_X
\longrightarrow
\mathcal{O}_Y
$$
by the rule $(f, g) \mapsto \text{Trace}_\pi(fg)$. We can think of
$Q_\pi$ as a linear map
$\pi_*\mathcal{O}_X \to
\SheafHom_{\mathcal{O}_Y}(\pi_*\mathcal{O}_X, \mathcal{O}_Y)$
between locally free modules of the same rank, and hence obtain
a determinant
$$
\det(Q_\pi) :
\wedge^{top}(\pi_*\mathcal{O}_X)
\longrightarrow
\wedge^{top}(\pi_*\mathcal{O}_X)^{\otimes -1}
$$
or in other words a global section
$$
\det(Q_\pi) \in \Gamma(Y, \wedge^{top}(\pi_*\mathcal{O}_X)^{\otimes -2})
$$
The {\it discriminant of $\pi$} is by definition the closed
subscheme $D_\pi \subset Y$ cut out by this global section.
Clearly, $D_\pi$ is a locally principal closed subscheme of $Y$.

\begin{lemma}
\label{lemma-discriminant}
Let $\pi : X \to Y$ be a morphism of schemes which is finite locally
free. Then $\pi$ is \'etale if and only if its discriminant is empty.
\end{lemma}

\begin{proof}
By Morphisms, Lemma \ref{morphisms-lemma-etale-flat-etale-fibres}
it suffices to check that the fibres of $\pi$ are \'etale.
Since the construction of the trace pairing commutes with base
change we reduce to the following question: Let $k$ be a field
and let $A$ be a finite dimensional $k$-algebra. Show that
$A$ is \'etale over $k$ if and only if the trace pairing
$Q_{A/k} : A \times A \to k$, $(a, b) \mapsto \text{Trace}_{A/k}(ab)$
is nondegenerate.

\medskip\noindent
Assume $Q_{A/k}$ is nondegenerate. If $a \in A$ is a nilpotent element, then
$ab$ is nilpotent for all $b \in A$ and we conclude that $Q_{A/k}(a, -)$ is
identically zero. Hence $A$ is reduced. Then we can write
$A = K_1 \times \ldots \times K_n$ as a product where each $K_i$
is a field (see
Algebra, Lemmas \ref{algebra-lemma-finite-dimensional-algebra},
\ref{algebra-lemma-artinian-finite-length}, and
\ref{algebra-lemma-minimal-prime-reduced-ring}).
In this case the quadratic
space $(A, Q_{A/k})$ is the orthogonal direct sum of the spaces
$(K_i, Q_{K_i/k})$. It follows from
Fields, Lemma \ref{fields-lemma-separable-trace-pairing}
that each $K_i$ is separable over $k$. This means that $A$ is \'etale
over $k$ by Algebra, Lemma \ref{algebra-lemma-etale-over-field}.
The converse is proved by reading the argument backwards.
\end{proof}





\section{Traces for flat quasi-finite ring maps}
\label{section-quasi-finite-traces}

\noindent
The trace referred to in the title of this section is of a completely
different nature than the trace discussed in
Duality for Schemes, Section \ref{duality-section-trace}.
Namely, it is the trace
as discussed in Fields, Section \ref{fields-section-trace-pairing}
and generalized in Exercises, Exercises \ref{exercises-exercise-trace-det} and
\ref{exercises-exercise-trace-det-rings}.

\medskip\noindent
Let $A \to B$ be a finite flat map of Noetherian rings. Then $B$ is finite
flat as an $A$-module and hence finite locally free
(Algebra, Lemma \ref{algebra-lemma-finite-projective}).
Given $b \in B$ we can consider the {\it trace} $\text{Trace}_{B/A}(b)$
of the $A$-linear map $B \to B$ given by
multiplication by $b$ on $B$. By the references above this defines
an $A$-linear map $\text{Trace}_{B/A} : B \to A$.
Since $\omega_{B/A} = \Hom_A(B, A)$ as $A \to B$ is finite, we see
that $\text{Trace}_{B/A} \in \omega_{B/A}$.

\medskip\noindent
For a general flat quasi-finite ring map we define the notion
of a trace as follows.

\begin{definition}
\label{definition-trace-element}
Let $A \to B$ be a flat quasi-finite map of Noetherian rings.
The {\it trace element} is the unique\footnote{Uniqueness
and existence will be justified in
Lemmas \ref{lemma-trace-unique} and \ref{lemma-dualizing-tau}.}
element
$\tau_{B/A} \in \omega_{B/A}$
with the following property: for any Noetherian $A$-algebra $A_1$
such that $B_1 = B \otimes_A A_1$ comes with a
product decomposition $B_1 = C \times D$ with $A_1 \to C$ finite
the image of $\tau_{B/A}$ in $\omega_{C/A_1}$
is $\text{Trace}_{C/A_1}$.
Here we use the base change map (\ref{equation-bc-dualizing}) and
Lemma \ref{lemma-dualizing-product} to get
$\omega_{B/A} \to \omega_{B_1/A_1} \to \omega_{C/A_1}$.
\end{definition}

\noindent
We first prove that trace elements are unique and then
we prove that they exist.

\begin{lemma}
\label{lemma-trace-unique}
Let $A \to B$ be a flat quasi-finite map of Noetherian rings.
Then there is at most one trace element in $\omega_{B/A}$.
\end{lemma}

\begin{proof}
Let $\mathfrak q \subset B$ be a prime ideal lying over the prime
$\mathfrak p \subset A$. By
Algebra, Lemma \ref{algebra-lemma-etale-makes-quasi-finite-finite-one-prime}
we can find an \'etale ring map $A \to A_1$ and a prime
ideal $\mathfrak p_1 \subset A_1$ lying over $\mathfrak p$
such that $\kappa(\mathfrak p_1) = \kappa(\mathfrak p)$ and
such that
$$
B_1 = B \otimes_A A_1 = C \times D
$$
with $A_1 \to C$ finite and such that the unique prime $\mathfrak q_1$
of $B \otimes_A A_1$ lying over $\mathfrak q$ and $\mathfrak p_1$
corresponds to a prime of $C$. Observe that
$\omega_{C/A_1} = \omega_{B/A} \otimes_B C$
(combine Lemmas \ref{lemma-dualizing-flat-base-change} and
\ref{lemma-dualizing-product}). Since the collection
of ring maps $B \to C$ obtained in this manner is a jointly
injective family of flat maps and since the image of $\tau_{B/A}$
in $\omega_{C/A_1}$ is prescribed the uniqueness follows.
\end{proof}

\noindent
Here is a sanity check.

\begin{lemma}
\label{lemma-finite-flat-trace}
Let $A \to B$ be a finite flat map of Noetherian rings.
Then $\text{Trace}_{B/A} \in \omega_{B/A}$ is the trace element.
\end{lemma}

\begin{proof}
Suppose we have $A \to A_1$ with $A_1$ Noetherian and
a product decomposition $B \otimes_A A_1 = C \times D$ with $A_1 \to C$
finite. Of course in this case $A_1 \to D$ is also finite.
Set $B_1 = B \otimes_A A_1$.
Since the construction of traces commutes with base change
we see that $\text{Trace}_{B/A}$ maps to $\text{Trace}_{B_1/A_1}$.
Thus the proof is finished by noticing that
$\text{Trace}_{B_1/A_1} = (\text{Trace}_{C/A_1}, \text{Trace}_{D/A_1})$
under the isomorphism
$\omega_{B_1/A_1} = \omega_{C/A_1} \times \omega_{D/A_1}$
of Lemma \ref{lemma-dualizing-product}.
\end{proof}

\begin{lemma}
\label{lemma-trace-base-change}
Let $A \to B$ be a flat quasi-finite map of Noetherian rings.
Let $\tau \in \omega_{B/A}$ be a trace element.
\begin{enumerate}
\item If $A \to A_1$ is a map with $A_1$ Noetherian, then with
$B_1 = A_1 \otimes_A B$ the image of $\tau$ in $\omega_{B_1/A_1}$ is a
trace element.
\item If $A = R_f$, then $\tau$ is a trace element in $\omega_{B/R}$.
\item If $g \in B$, then the image of $\tau$ in $\omega_{B_g/A}$
is a trace element.
\item If $B = B_1 \times B_2$, then $\tau$ maps to a trace element
in both $\omega_{B_1/A}$ and $\omega_{B_2/A}$.
\end{enumerate}
\end{lemma}

\begin{proof}
Part (1) is a formal consequence of the definition.

\medskip\noindent
Statement (2) makes sense because $\omega_{B/R} = \omega_{B/A}$
by Lemma \ref{lemma-localize-dualizing}. Denote $\tau'$ the element
$\tau$ but viewed as an element of $\omega_{B/R}$. To see that (2) is true
suppose that we have $R \to R_1$ with $R_1$ Noetherian and a product
decomposition $B \otimes_R R_1 = C \times D$ with $R_1 \to C$ finite.
Then with $A_1 = (R_1)_f$ we see that $B \otimes_A A_1 = C \times D$.
Since $R_1 \to C$ is finite, a fortiori $A_1 \to C$ is finite.
Hence we can use the defining property of $\tau$ to get the corresponding
property of $\tau'$.

\medskip\noindent
Statement (3) makes sense because $\omega_{B_g/A} = (\omega_{B/A})_g$
by Lemma \ref{lemma-localize-dualizing}. The proof is similar to the proof
of (2). Suppose we have $A \to A_1$ with $A_1$ Noetherian and
a product decomposition $B_g \otimes_A A_1 = C \times D$ with $A_1 \to C$
finite. Set $B_1 = B \otimes_A A_1$. Then
$\Spec(C) \to \Spec(B_1)$ is an open immersion as $B_g \otimes_A A_1 = (B_1)_g$
and the image is closed because $B_1 \to C$ is finite
(as $A_1 \to C$ is finite).
Thus we see that $B_1 = C \times D_1$ and $D = (D_1)_g$. Then we can use
the defining property of $\tau$ to get the corresponding property
for the image of $\tau$ in $\omega_{B_g/A}$.

\medskip\noindent
Statement (4) makes sense because
$\omega_{B/A} = \omega_{B_1/A} \times \omega_{B_2/A}$ by
Lemma \ref{lemma-dualizing-product}.
Suppose we have $A \to A'$ with $A'$ Noetherian and
a product decomposition $B \otimes_A A' = C \times D$ with $A' \to C$
finite. Then it is clear that we can refine this product
decomposition into  $B \otimes_A A' = C_1 \times C_2 \times D_1 \times D_2$
with $A' \to C_i$ finite such that $B_i \otimes_A A' = C_i \times D_i$.
Then we can use the defining property of $\tau$ to get the corresponding
property for the image of $\tau$ in $\omega_{B_i/A}$. This uses the obvious
fact that
$\text{Trace}_{C/A'} = (\text{Trace}_{C_1/A'}, \text{Trace}_{C_2/A'})$
under the decomposition
$\omega_{C/A'} = \omega_{C_1/A'} \times \omega_{C_2/A'}$.
\end{proof}

\begin{lemma}
\label{lemma-glue-trace}
Let $A \to B$ be a flat quasi-finite map of Noetherian rings.
Let $g_1, \ldots, g_m \in B$ be elements generating the unit ideal.
Let $\tau \in \omega_{B/A}$ be an element whose image in
$\omega_{B_{g_i}/A}$ is a trace element for $A \to B_{g_i}$.
Then $\tau$ is a trace element.
\end{lemma}

\begin{proof}
Suppose we have $A \to A_1$ with $A_1$ Noetherian and a product
decomposition $B \otimes_A A_1 = C \times D$ with $A_1 \to C$ finite.
We have to show that the image of $\tau$ in $\omega_{C/A_1}$ is
$\text{Trace}_{C/A_1}$. Observe that $g_1, \ldots, g_m$
generate the unit ideal in $B_1 = B \otimes_A A_1$ and that
$\tau$ maps to a trace element in $\omega_{(B_1)_{g_i}/A_1}$
by Lemma \ref{lemma-trace-base-change}. Hence we may replace
$A$ by $A_1$ and $B$ by $B_1$ to get to the situation as described
in the next paragraph.

\medskip\noindent
Here we assume that $B = C \times D$ with $A \to C$ is finite.
Let $\tau_C$ be the image of $\tau$ in $\omega_{C/A}$.
We have to prove that $\tau_C = \text{Trace}_{C/A}$ in $\omega_{C/A}$.
By the compatibility of trace elements with products
(Lemma \ref{lemma-trace-base-change})
we see that $\tau_C$ maps to a trace element in $\omega_{C_{g_i}/A}$.
Hence, after replacing $B$ by $C$ we may assume that $A \to B$
is finite flat.

\medskip\noindent
Assume $A \to B$ is finite flat. In this case $\text{Trace}_{B/A}$
is a trace element by Lemma \ref{lemma-finite-flat-trace}.
Hence $\text{Trace}_{B/A}$ maps to a trace element in
$\omega_{B_{g_i}/A}$ by Lemma \ref{lemma-trace-base-change}.
Since trace elements are unique (Lemma \ref{lemma-trace-unique})
we find that $\text{Trace}_{B/A}$ and $\tau$ map
to the same elements in $\omega_{B_{g_i}/A} = (\omega_{B/A})_{g_i}$.
As $g_1, \ldots, g_m$ generate the unit ideal of $B$ the map
$\omega_{B/A} \to \prod \omega_{B_{g_i}/A}$ is injective
and we conclude that $\tau_C = \text{Trace}_{B/A}$ as desired.
\end{proof}

\begin{lemma}
\label{lemma-dualizing-tau}
Let $A \to B$ be a flat quasi-finite map of Noetherian rings.
There exists a trace element $\tau \in \omega_{B/A}$.
\end{lemma}

\begin{proof}
Choose a factorization $A \to B' \to B$ with $A \to B'$ finite and
$\Spec(B) \to \Spec(B')$ an open immersion. Let $g_1, \ldots, g_n \in B'$
be elements such that $\Spec(B) = \bigcup D(g_i)$ as opens of $\Spec(B')$.
Suppose that we can prove the existence of trace elements $\tau_i$ for the
quasi-finite flat ring maps $A \to B_{g_i}$. Then for all $i, j$ the elements
$\tau_i$ and $\tau_j$ map to trace elements of $\omega_{B_{g_ig_j}/A}$
by Lemma \ref{lemma-trace-base-change}. By uniqueness of
trace elements (Lemma \ref{lemma-trace-unique}) they map to the same element.
Hence the sheaf condition for the quasi-coherent module associated to
$\omega_{B/A}$ (see Algebra, Lemma \ref{algebra-lemma-cover-module})
produces an element $\tau \in \omega_{B/A}$.
Then $\tau$ is a trace element by
Lemma \ref{lemma-glue-trace}.
In this way we reduce to the case treated in the next paragraph.

\medskip\noindent
Assume we have $A \to B'$ finite and $g \in B'$ with $B = B'_g$ flat over $A$.
It is our task to construct a trace element in
$\omega_{B/A} = \Hom_A(B', A) \otimes_{B'} B$.
Choose a resolution $F_1 \to F_0 \to B' \to 0$ of $B'$ by finite free
$A$-modules $F_0$ and $F_1$. Then we have an exact sequence
$$
0 \to \Hom_A(B', A) \to F_0^\vee \to F_1^\vee
$$
where $F_i^\vee = \Hom_A(F_i, A)$ is the dual finite free module.
Similarly we have the exact sequence
$$
0 \to \Hom_A(B', B') \to F_0^\vee \otimes_A B' \to F_1^\vee \otimes_A B'
$$
The idea of the construction of $\tau$ is to use the diagram
$$
B' \xrightarrow{\mu} \Hom_A(B', B')
\leftarrow \Hom_A(B', A) \otimes_A B'
\xrightarrow{ev} A
$$
where the first arrow sends $b' \in B'$ to the $A$-linear operator
given by multiplication by $b'$ and the last arrow is the evaluation map.
The problem is that the middle arrow, which sends $\lambda' \otimes b'$
to the map $b'' \mapsto \lambda'(b'')b'$, is not an isomorphism.
If $B'$ is flat over $A$, the exact sequences above show that it
is an isomorphism and the composition from left to right is the usual trace
$\text{Trace}_{B'/A}$. In the general case, we consider
the diagram
$$
\xymatrix{
& \Hom_A(B', A) \otimes_A B' \ar[r] \ar[d] &
\Hom_A(B', A) \otimes_A B'_g \ar[d] \\
B' \ar[r]_-\mu \ar@{..>}[rru] \ar@{..>}[ru]^\psi &
\Hom_A(B', B') \ar[r] &
\Ker(F_0^\vee \otimes_A B'_g \to F_1^\vee \otimes_A B'_g)
}
$$
By flatness of $A \to B'_g$ we see that the right vertical arrow is an
isomorphism. Hence we obtain the unadorned dotted arrow.
Since $B'_g = \colim \frac{1}{g^n}B'$, since
colimits commute with tensor products,
and since $B'$ is a finitely presented $A$-module
we can find an $n \geq 0$ and a $B'$-linear (for right $B'$-module structure)
map $\psi : B' \to \Hom_A(B', A) \otimes_A B'$
whose composition with the left vertical arrow is $g^n\mu$.
Composing with $ev$ we obtain an element
$ev \circ \psi \in \Hom_A(B', A)$. Then we set 
$$
\tau = (ev \circ \psi) \otimes g^{-n} \in
\Hom_A(B', A) \otimes_{B'} B'_g = \omega_{B'_g/A} = \omega_{B/A}
$$
We omit the easy verification that this element does not depend
on the choice of $n$ and $\psi$ above.

\medskip\noindent
Let us prove that $\tau$ as constructed in the previous paragraph
has the desired property in a special case. Namely, say
$B' = C' \times D'$ and $g = (f, h)$ where $A \to C'$ flat, $D'_h$ is flat, and
$f$ is a unit in $C'$.
To show: $\tau$ maps to $\text{Trace}_{C'/A}$ in $\omega_{C'/A}$.
In this case we first choose $n_D$ and
$\psi_D : D' \to \Hom_A(D', A) \otimes_A D'$ as above for the pair
$(D', h)$ and we can let
$\psi_C : C' \to \Hom_A(C', A) \otimes_A C' = \Hom_A(C', C')$
be the map seconding $c' \in C'$ to multiplication by $c'$.
Then we take $n = n_D$ and $\psi = (f^{n_D} \psi_C, \psi_D)$
and the desired compatibility is clear because
$\text{Trace}_{C'/A} = ev \circ \psi_C$ as remarked above.

\medskip\noindent
To prove the desired property in general, suppose given
$A \to A_1$ with $A_1$ Noetherian and a product decomposition
$B'_g \otimes_A A_1 = C \times D$ with $A_1 \to C$ finite.
Set $B'_1 = B' \otimes_A A_1$. Then $\Spec(C) \to \Spec(B'_1)$
is an open immersion as $B'_g \otimes_A A_1 = (B'_1)_g$ and
the image is closed as $B'_1 \to C$ is finite (since $A_1 \to C$
is finite). Thus $B'_1 = C \times D'$ and $D'_g = D$.
We conclude that $B'_1 = C \times D'$ and $g$ over $A_1$
are as in the previous paragraph.
Since formation of the displayed diagram above
commutes with base change, the formation of $\tau$ commutes
with the base change $A \to A_1$ (details omitted; use the
resolution $F_1 \otimes_A A_1 \to F_0 \otimes_A A_1 \to B'_1 \to 0$
to see this). Thus the desired compatibility follows from the result
of the previous paragraph.
\end{proof}

\begin{remark}
\label{remark-relative-dualizing-for-flat-quasi-finite}
Let $f : Y \to X$ be a flat locally quasi-finite morphism of locally
Noetherian schemes. Let $\omega_{Y/X}$ be as in
Remark \ref{remark-relative-dualizing-for-quasi-finite}.
It is clear from the uniqueness, existence, and compatibility with
localization of trace elements
(Lemmas \ref{lemma-trace-unique}, \ref{lemma-dualizing-tau}, and
\ref{lemma-trace-base-change})
that there exists a global section
$$
\tau_{Y/X} \in \Gamma(Y, \omega_{Y/X})
$$
such that for every pair of affine opens
$\Spec(B) = V \subset Y$, $\Spec(A) = U \subset X$ with $f(V) \subset U$
that element $\tau_{Y/X}$ maps to $\tau_{B/A}$ under the
canonical isomorphism
$H^0(V, \omega_{Y/X}) = \omega_{B/A}$.
\end{remark}

\begin{lemma}
\label{lemma-tau-nonzero}
Let $k$ be a field and let $A$ be a finite $k$-algebra. Assume $A$
is local with residue field $k'$. The following are equivalent
\begin{enumerate}
\item $\text{Trace}_{A/k}$ is nonzero,
\item $\tau_{A/k} \in \omega_{A/k}$ is nonzero, and
\item $k'/k$ is separable and $\text{length}_A(A)$ is prime
to the characteristic of $k$.
\end{enumerate}
\end{lemma}

\begin{proof}
Conditions (1) and (2) are equivalent by Lemma \ref{lemma-finite-flat-trace}.
Let $\mathfrak m \subset A$. Since $\dim_k(A) < \infty$ it is clear that
$A$ has finite length over $A$. Choose a filtration
$$
A = I_0 \supset \mathfrak m = I_1 \supset I_2 \supset \ldots I_n = 0
$$
by ideals such that $I_i/I_{i + 1} \cong k'$ as $A$-modules. See
Algebra, Lemma \ref{algebra-lemma-simple-pieces} which also shows that
$n = \text{length}_A(A)$. If $a \in \mathfrak m$ then $aI_i \subset I_{i + 1}$
and it is immediate that $\text{Trace}_{A/k}(a) = 0$.
If $a \not \in \mathfrak m$ with image $\lambda \in k'$, then
we conclude
$$
\text{Trace}_{A/k}(a) =
\sum\nolimits_{i = 0, \ldots, n - 1}
\text{Trace}_k(a : I_i/I_{i - 1} \to I_i/I_{i - 1}) =
n \text{Trace}_{k'/k}(\lambda)
$$
The proof of the lemma is finished by applying
Fields, Lemma \ref{fields-lemma-separable-trace-pairing}.
\end{proof}






\section{Finite morphisms}
\label{section-finite-morphisms}

\noindent
In this section we collect some observations about the
constructions in the previous sections for finite morphisms.
Let $f : Y \to X$ be a finite morphism of locally Noetherian schemes.
Let $\omega_{Y/X}$ be as in
Remark \ref{remark-relative-dualizing-for-quasi-finite}.

\medskip\noindent
The first remark is that
$$
f_*\omega_{Y/X} = \SheafHom_{\mathcal{O}_X}(f_*\mathcal{O}_Y, \mathcal{O}_X)
$$
as sheaves of $f_*\mathcal{O}_Y$-modules. Since $f$ is affine, this
formula uniquely characterizes $\omega_{Y/X}$, see
Morphisms, Lemma \ref{morphisms-lemma-affine-equivalence-modules}.
The formula holds because for $\Spec(A) = U \subset X$ affine open, the
inverse image $V = f^{-1}(U)$ is the spectrum of a finite $A$-algebra
$B$ and hence
$$
H^0(U, f_*\omega_{Y/X}) =
H^0(V, \omega_{Y/X}) =
\omega_{B/A} =
\Hom_A(B, A) =
H^0(U, \SheafHom_{\mathcal{O}_X}(f_*\mathcal{O}_Y, \mathcal{O}_X))
$$
by construction. In particular, we obtain a canonical evaluation map
$$
f_*\omega_{Y/X} \longrightarrow \mathcal{O}_X
$$
which is given by evaluation at $1$ if we think of $f_*\omega_{Y/X}$
as the sheaf $\SheafHom_{\mathcal{O}_X}(f_*\mathcal{O}_Y, \mathcal{O}_X)$.

\medskip\noindent
The second remark is that using the evaluation map we obtain
canonical identifications
$$
\Hom_Y(\mathcal{F}, f^*\mathcal{G} \otimes_{\mathcal{O}_Y} \omega_{Y/X})
=
\Hom_X(f_*\mathcal{F}, \mathcal{G})
$$
functorially in the quasi-coherent module $\mathcal{F}$ on $Y$
and the finite locally free module $\mathcal{G}$ on $X$.
If $\mathcal{G} = \mathcal{O}_X$ this follows immediately
from the above and
Algebra, Lemma \ref{algebra-lemma-adjoint-hom-restrict}.
For general $\mathcal{G}$ we can use the same lemma and the
isomorphisms
$$
f_*(f^*\mathcal{G} \otimes_{\mathcal{O}_Y} \omega_{Y/X}) =
\mathcal{G} \otimes_{\mathcal{O}_X}
\SheafHom_{\mathcal{O}_X}(f_*\mathcal{O}_Y, \mathcal{O}_X) =
\SheafHom_{\mathcal{O}_X}(f_*\mathcal{O}_Y, \mathcal{G})
$$
of $f_*\mathcal{O}_Y$-modules where the first equality is the
projection formula
(Cohomology, Lemma \ref{cohomology-lemma-projection-formula}).
An alternative is to prove the formula affine locally by
direct computation.

\medskip\noindent
The third remark is that if $f$ is in addition flat, then the
composition
$$
f_*\mathcal{O}_Y \xrightarrow{f_*\tau_{Y/X}} f_*\omega_{Y/X}
\longrightarrow \mathcal{O}_X
$$
is equal to the trace map $\text{Trace}_f$ discussed in
Section \ref{section-discriminant}. This follows immediately by
looking over affine opens.

\medskip\noindent
The fourth remark is that if $f$ is flat and $X$ Noetherian, then
we obtain
$$
\Hom_Y(K, Lf^*M \otimes_{\mathcal{O}_Y} \omega_{Y/X})
=
\Hom_X(Rf_*K, M)
$$
for any $K$ in $D_\QCoh(\mathcal{O}_Y)$ and $M$ in $D_\QCoh(\mathcal{O}_X)$.
This follows from the material in
Duality for Schemes, Section \ref{duality-section-proper-flat},
but can be proven directly in this case as follows.
First, if $X$ is affine, then it holds by
Dualizing Complexes, Lemmas \ref{dualizing-lemma-right-adjoint} and
\ref{dualizing-lemma-RHom-is-tensor-special}\footnote{There is a
simpler proof of this lemma in our case.} and
Derived Categories of Schemes, Lemma \ref{perfect-lemma-affine-compare-bounded}.
Then we can use the induction principle
(Cohomology of Schemes, Lemma \ref{coherent-lemma-induction-principle})
and Mayer-Vietoris
(in the form of Cohomology, Lemma \ref{cohomology-lemma-mayer-vietoris-hom})
to finish the proof.







\section{The Noether different}
\label{section-noether-different}

\noindent
There are many different differents available in the literature.
We list some of them in this and the next sections; for more
information we suggest the reader consult \cite{Kunz}.

\medskip\noindent
Let $A \to B$ be a ring map. Denote
$$
\mu : B \otimes_A B \longrightarrow B,\quad
b \otimes b' \longmapsto bb'
$$
the multiplication map. Let $I = \Ker(\mu)$. It is clear that $I$ is
generated by the elements $b \otimes 1 - 1 \otimes b$ for $b \in B$.
Hence the annihilator $J \subset B \otimes_A B$ of $I$ is a $B$-module
in a canonical manner. The {\it Noether different} of $B$ over $A$ is
the image of $J$ under the map $\mu : B \otimes_A B \to B$. Equivalently,
the Noether different is the image of the map
$$
J = \Hom_{B \otimes_A B}(B, B \otimes_A B) \longrightarrow B,\quad
\varphi \longmapsto \mu(\varphi(1))
$$
We begin with some obligatory lemmas.

\begin{lemma}
\label{lemma-noether-different-product}
Let $A \to B_i$, $i = 1, 2$ be ring maps. Set $B = B_1 \times B_2$.
\begin{enumerate}
\item The annihilator $J$ of $\Ker(B \otimes_A B \to B)$ is $J_1 \times J_2$
where $J_i$ is the annihilator of $\Ker(B_i \otimes_A B_i \to B_i)$.
\item The Noether different $\mathfrak{D}$ of $B$ over $A$ is
$\mathfrak{D}_1 \times \mathfrak{D}_2$, where $\mathfrak{D}_i$ is
the Noether different of $B_i$ over $A$.
\end{enumerate}
\end{lemma}

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

\begin{lemma}
\label{lemma-noether-different-base-change}
Let $A \to B$ be a finite type ring map. Let $A \to A'$ be a flat ring map.
Set $B' = B \otimes_A A'$.
\begin{enumerate}
\item The annihilator $J'$ of $\Ker(B' \otimes_{A'} B' \to B')$ is
$J \otimes_A A'$ where $J$ is the annihilator of $\Ker(B \otimes_A B \to B)$.
\item The Noether different $\mathfrak{D}'$ of $B'$ over $A'$ is
$\mathfrak{D}B'$, where $\mathfrak{D}$ is
the Noether different of $B$ over $A$.
\end{enumerate}
\end{lemma}

\begin{proof}
Choose generators $b_1, \ldots, b_n$ of $B$ as an $A$-algebra.
Then
$$
J = \Ker(B \otimes_A B \xrightarrow{b_i \otimes 1 - 1 \otimes b_i}
(B \otimes_A B)^{\oplus n})
$$
Hence we see that the formation of $J$ commutes with flat base change.
The result on the Noether different follows immediately from this.
\end{proof}

\begin{lemma}
\label{lemma-noether-different-localization}
Let $A \to B' \to B$ be ring maps with $A \to B'$
of finite type and $B' \to B$ inducing an open immersion of spectra.
\begin{enumerate}
\item The annihilator $J$ of $\Ker(B \otimes_A B \to B)$ is
$J' \otimes_{B'} B$ where $J'$ is the annihilator of
$\Ker(B' \otimes_A B' \to B')$.
\item The Noether different $\mathfrak{D}$ of $B$ over $A$ is
$\mathfrak{D}'B$, where $\mathfrak{D}'$ is
the Noether different of $B'$ over $A$.
\end{enumerate}
\end{lemma}

\begin{proof}
Write $I = \Ker(B \otimes_A B \to B)$ and $I' = \Ker(B' \otimes_A B' \to B')$.
As $\Spec(B) \to \Spec(B')$ is an open immersion, it follows that
$B = (B \otimes_A B) \otimes_{B' \otimes_A B'} B'$. Thus we see that
$I = I'(B \otimes_A B)$. Since $I'$ is finitely generated and
$B' \otimes_A B' \to B \otimes_A B$ is flat, we conclude that
$J = J'(B \otimes_A B)$, see
Algebra, Lemma \ref{algebra-lemma-annihilator-flat-base-change}.
Since the $B' \otimes_A B'$-module structure of $J'$
factors through $B' \otimes_A B' \to B'$ we conclude that (1) is true.
Part (2) is a consequence of (1).
\end{proof}

\begin{remark}
\label{remark-construction-pairing}
Let $A \to B$ be a quasi-finite homomorphism of Noetherian rings.
Let $J$ be the annihilator of $\Ker(B \otimes_A B \to B)$.
There is a canonical $B$-bilinear pairing
\begin{equation}
\label{equation-pairing-noether}
\omega_{B/A} \times J \longrightarrow B
\end{equation}
defined as follows. Choose a factorization $A \to B' \to B$
with $A \to B'$ finite and $B' \to B$ inducing an open immersion
of spectra. Let $J'$ be the annihilator of $\Ker(B' \otimes_A B' \to B')$.
We first define
$$
\Hom_A(B', A) \times J' \longrightarrow B',\quad
(\lambda, \sum b_i \otimes c_i) \longmapsto \sum \lambda(b_i)c_i
$$
This is $B'$-bilinear exactly because for $\xi \in J'$ and $b \in B'$
we have $(b \otimes 1)\xi = (1 \otimes b)\xi$. By
Lemma \ref{lemma-noether-different-localization}
and the fact that $\omega_{B/A} = \Hom_A(B', A) \otimes_{B'} B$
we can extend this to a $B$-bilinear pairing as displayed above.
\end{remark}

\begin{lemma}
\label{lemma-noether-pairing-compatibilities}
Let $A \to B$ be a quasi-finite homomorphism of Noetherian rings.
\begin{enumerate}
\item If $A \to A'$ is a flat map of Noetherian rings, then
$$
\xymatrix{
\omega_{B/A} \times J \ar[r] \ar[d] & B \ar[d]  \\
\omega_{B'/A'} \times J' \ar[r] & B'
}
$$
is commutative where notation as in
Lemma \ref{lemma-noether-different-base-change}
and horizontal arrows are given by
(\ref{equation-pairing-noether}).
\item If $B = B_1 \times B_2$, then
$$
\xymatrix{
\omega_{B/A} \times J \ar[r] \ar[d] & B \ar[d]  \\
\omega_{B_i/A} \times J_i \ar[r] & B_i
}
$$
is commutative for $i = 1, 2$ where notation as in
Lemma \ref{lemma-noether-different-product}
and horizontal arrows are given by
(\ref{equation-pairing-noether}).
\end{enumerate}
\end{lemma}

\begin{proof}
Because of the construction of the pairing in
Remark \ref{remark-construction-pairing}
both (1) and (2) reduce to the case where $A \to B$ is finite.
Then (1) follows from the fact that the contraction map
$\Hom_A(M, A) \otimes_A M \otimes_A M \to M$,
$\lambda \otimes m \otimes m' \mapsto \lambda(m)m'$
commuted with base change. To see (2) use that
$J = J_1 \times J_2$ is contained in the summands
$B_1 \otimes_A B_1$ and $B_2 \otimes_A B_2$
of $B \otimes_A B$.
\end{proof}

\begin{lemma}
\label{lemma-noether-pairing-flat-quasi-finite}
Let $A \to B$ be a flat quasi-finite homomorphism of Noetherian rings.
The pairing of Remark \ref{remark-construction-pairing} induces an isomorphism
$J \to \Hom_B(\omega_{B/A}, B)$.
\end{lemma}

\begin{proof}
We first prove this when $A \to B$ is finite and flat. In this case we can
localize on $A$ and assume $B$ is finite free as an $A$-module. Let
$b_1, \ldots, b_n$ be a basis of $B$ as an $A$-module and denote
$b_1^\vee, \ldots, b_n^\vee$ the dual basis of $\omega_{B/A}$. Note that
$\sum b_i \otimes c_i \in J$ maps to the element of $\Hom_B(\omega_{B/A}, B)$
which sends $b_i^\vee$ to $c_i$. Suppose $\varphi : \omega_{B/A} \to B$
is $B$-linear. Then we claim that $\xi = \sum b_i \otimes \varphi(b_i^\vee)$
is an element of $J$. Namely, the $B$-linearity of $\varphi$
exactly implies that $(b \otimes 1)\xi = (1 \otimes b)\xi$ for all $b \in B$.
Thus our map has an inverse and it is an isomorphism.

\medskip\noindent
Let $\mathfrak q \subset B$ be a prime lying over $\mathfrak p \subset A$.
We will show that the localization
$$
J_\mathfrak q
\longrightarrow
\Hom_B(\omega_B/A, B)_\mathfrak q
$$
is an isomorphism.
This suffices by Algebra, Lemma \ref{algebra-lemma-characterize-zero-local}.
By
Algebra, Lemma \ref{algebra-lemma-etale-makes-quasi-finite-finite-one-prime}
we can find an \'etale ring map $A \to A'$ and a prime
ideal $\mathfrak p' \subset A'$ lying over $\mathfrak p$
such that $\kappa(\mathfrak p') = \kappa(\mathfrak p)$ and
such that
$$
B' = B \otimes_A A' = C \times D
$$
with $A' \to C$ finite and such that the unique prime $\mathfrak q'$
of $B \otimes_A A'$ lying over $\mathfrak q$ and $\mathfrak p'$
corresponds to a prime of $C$. Let $J'$ be the annihilator of
$\Ker(B' \otimes_{A'} B' \to B')$. By
Lemmas \ref{lemma-dualizing-flat-base-change},
\ref{lemma-noether-different-base-change}, and
\ref{lemma-noether-pairing-compatibilities}
the map $J' \to \Hom_{B'}(\omega_{B'/A'}, B')$
is gotten by applying the functor $- \otimes_B B'$
to the map $J \to \Hom_B(\omega_{B/A}, B)$.
Since $B_\mathfrak q \to B'_{\mathfrak q'}$ is faithfully flat
it suffices to prove the result for $(A' \to B', \mathfrak q')$.
By Lemmas \ref{lemma-dualizing-product},
\ref{lemma-noether-different-product}, and
\ref{lemma-noether-pairing-compatibilities}
this reduces us to the case proved in the first
paragraph of the proof.
\end{proof}

\begin{lemma}
\label{lemma-noether-different-flat-quasi-finite}
Let $A \to B$ be a flat quasi-finite homomorphism of Noetherian rings.
The diagram
$$
\xymatrix{
J \ar[rr] \ar[rd]_\mu & &
\Hom_B(\omega_{B/A}, B) \ar[ld]^{\varphi \mapsto \varphi(\tau_{B/A})} \\
& B
}
$$
commutes where the horizontal arrow is the isomorphism of
Lemma \ref{lemma-noether-pairing-flat-quasi-finite}.
Hence the Noether different of $B$ over $A$
is the image of the map $\Hom_B(\omega_{B/A}, B) \to B$.
\end{lemma}

\begin{proof}
Exactly as in the proof of Lemma \ref{lemma-noether-pairing-flat-quasi-finite}
this reduces to the case of a finite free map $A \to B$.
In this case $\tau_{B/A} = \text{Trace}_{B/A}$.
Choose a basis $b_1, \ldots, b_n$ of $B$ as an $A$-module.
Let $\xi = \sum b_i \otimes c_i \in J$. Then $\mu(\xi) = \sum b_i c_i$.
On the other hand, the image of $\xi$ in $\Hom_B(\omega_{B/A}, B)$
sends $\text{Trace}_{B/A}$ to $\sum \text{Trace}_{B/A}(b_i)c_i$.
Thus we have to show
$$
\sum b_ic_i = \sum \text{Trace}_{B/A}(b_i)c_i
$$
when $\xi = \sum b_i \otimes c_i \in J$. Write $b_i b_j = \sum_k a_{ij}^k b_k$
for some $a_{ij}^k \in A$. Then the right hand side is
$\sum_{i, j} a_{ij}^j c_i$. On the other hand, $\xi \in J$ implies
$$
(b_j \otimes 1)(\sum\nolimits_i b_i \otimes c_i) =
(1 \otimes b_j)(\sum\nolimits_i b_i \otimes c_i)
$$
which implies that $b_j c_i = \sum_k a_{jk}^i c_k$. Thus the left hand side
is $\sum_{i, j} a_{ij}^i c_j$. Since $a_{ij}^k = a_{ji}^k$ the equality holds.
\end{proof}

\begin{lemma}
\label{lemma-noether-different}
Let $A \to B$ be a finite type ring map. Let $\mathfrak{D} \subset B$
be the Noether different. Then $V(\mathfrak{D})$ is the set of primes
$\mathfrak q \subset B$ such that $A \to B$ is not unramified at $\mathfrak q$.
\end{lemma}

\begin{proof}
Assume $A \to B$ is unramified at $\mathfrak q$. After replacing
$B$ by $B_g$ for some $g \in B$, $g \not \in \mathfrak q$ we may
assume $A \to B$ is unramified (Algebra, Definition
\ref{algebra-definition-unramified} and
Lemma \ref{lemma-noether-different-localization}).
In this case $\Omega_{B/A} = 0$. Hence if $I = \Ker(B \otimes_A B \to B)$,
then $I/I^2 = 0$ by
Algebra, Lemma \ref{algebra-lemma-differentials-diagonal}.
Since $A \to B$ is of finite type, we see that $I$ is finitely
generated. Hence by Nakayama's lemma
(Algebra, Lemma \ref{algebra-lemma-NAK})
there exists an element of the form $1 + i$
annihilating $I$. It follows that $\mathfrak{D} = B$.

\medskip\noindent
Conversely, assume that $\mathfrak{D} \not \subset \mathfrak q$.
Then after replacing $B$ by a principal localization as above
we may assume $\mathfrak{D} = B$. This means there exists an
element of the form $1 + i$ in the annihilator of $I$.
Conversely this implies that $I/I^2 = \Omega_{B/A}$ is zero
and we conclude.
\end{proof}







\section{The K\"ahler different}
\label{section-kahler-different}

\noindent
Let $A \to B$ be a finite type ring map. The {\it K\"ahler different} is the
zeroth fitting ideal of $\Omega_{B/A}$ as a $B$-module. We globalize the
definition as follows.

\begin{definition}
\label{definition-kahler-different}
Let $f : Y \to X$ be a morphism of schemes which is locally of finite type.
The {\it K\"ahler different} is the $0$th fitting ideal of $\Omega_{Y/X}$.
\end{definition}

\noindent
The K\"ahler different is a quasi-coherent sheaf of ideals on $Y$.

\begin{lemma}
\label{lemma-base-change-kahler-different}
Consider a cartesian diagram of schemes
$$
\xymatrix{
Y' \ar[d]_{f'} \ar[r] & Y \ar[d]^f \\
X' \ar[r]^g & X
}
$$
with $f$ locally of finite type. Let $R \subset Y$, resp.\ $R' \subset Y'$
be the closed subscheme cut out by the K\"ahler different of $f$, resp.\ $f'$.
Then $Y' \to Y$ induces an isomorphism $R' \to R \times_Y Y'$.
\end{lemma}

\begin{proof}
This is true because $\Omega_{Y'/X'}$ is the pullback of $\Omega_{Y/X}$
(Morphisms, Lemma \ref{morphisms-lemma-base-change-differentials})
and then we can apply
More on Algebra, Lemma \ref{more-algebra-lemma-fitting-ideal-basics}.
\end{proof}

\begin{lemma}
\label{lemma-kahler-different}
Let $f : Y \to X$ be a morphism of schemes which is locally of finite type.
Let $R \subset Y$ be the closed subscheme defined by
the K\"ahler different. Then $R \subset Y$ is exactly
the set of points where $f$ is not unramified.
\end{lemma}

\begin{proof}
This is a copy of
Divisors, Lemma \ref{divisors-lemma-zero-fitting-ideal-omega-unramified}.
\end{proof}

\begin{lemma}
\label{lemma-kahler-different-complete-intersection}
Let $A$ be a ring. Let $n \geq 1$ and
$f_1, \ldots, f_n \in A[x_1, \ldots, x_n]$.
Set $B = A[x_1, \ldots, x_n]/(f_1, \ldots, f_n)$.
The K\"ahler different of $B$ over $A$ is the ideal
of $B$ generated by $\det(\partial f_i/\partial x_j)$.
\end{lemma}

\begin{proof}
This is true because $\Omega_{B/A}$ has a presentation
$$
\bigoplus\nolimits_{i = 1, \ldots, n} B f_i
\xrightarrow{\text{d}}
\bigoplus\nolimits_{j = 1, \ldots, n} B \text{d}x_j
\rightarrow \Omega_{B/A} \rightarrow 0
$$
by Algebra, Lemma \ref{algebra-lemma-differential-seq}.
\end{proof}



\section{The Dedekind different}
\label{section-dedekind-different}

\noindent
Let $A \to B$ be a ring map. We say {\it the Dedekind different is defined}
if $A$ is Noetherian, $A \to B$ is finite,
any nonzerodivisor on $A$ is a nonzerodivisor on $B$, and $K \to L$ is
\'etale where $K = Q(A)$ and $L = B \otimes_A K$. Then $K \subset L$ is
finite \'etale and
$$
\mathcal{L}_{B/A} = \{x \in L \mid \text{Trace}_{L/K}(bx) \in A
\text{ for all }b \in B\}
$$
is the Dedekind complementary module. In this situation the
{\it Dedekind different} is
$$
\mathfrak{D}_{B/A} = \{x \in L \mid x\mathcal{L}_{B/A} \subset B\}
$$
viewed as a $B$-submodule of $L$.
By Lemma \ref{lemma-dedekind-different-ideal} the Dedekind different is an
ideal of $B$ either if $A$ is normal or if $B$ is flat over $A$.

\begin{lemma}
\label{lemma-dedekind-different-ideal}
Assume the Dedekind different of $A \to B$ is defined. Consider the statements
\begin{enumerate}
\item $A \to B$ is flat,
\item $A$ is a normal ring,
\item $\text{Trace}_{L/K}(B) \subset A$,
\item $1 \in \mathcal{L}_{B/A}$, and
\item the Dedekind different $\mathfrak{D}_{B/A}$ is an ideal of $B$.
\end{enumerate}
Then we have (1) $\Rightarrow$ (3), (2) $\Rightarrow$ (3),
(3) $\Leftrightarrow$ (4), and (4) $\Rightarrow$ (5).
\end{lemma}

\begin{proof}
The equivalence of (3) and (4) and the
implication (4) $\Rightarrow$ (5) are immediate.

\medskip\noindent
If $A \to B$ is flat, then we see that $\text{Trace}_{B/A} : B \to A$ is
defined and that $\text{Trace}_{L/K}$ is the base change. Hence (3) holds.

\medskip\noindent
If $A$ is normal, then $A$ is a finite product of normal domains,
hence we reduce to the case of a normal domain. Then $K$ is
the fraction field of $A$ and $L = \prod L_i$ is a finite product of
finite separable field extensions of $K$. Then
$\text{Trace}_{L/K}(b) = \sum \text{Trace}_{L_i/K}(b_i)$
where $b_i \in L_i$ is the image of $b$.
Since $b$ is integral over $A$ as $B$ is finite over $A$,
these traces are in $A$. This is true because the
minimal polynomial of $b_i$ over $K$ has coefficients in $A$
(Algebra, Lemma \ref{algebra-lemma-minimal-polynomial-normal-domain})
and because $\text{Trace}_{L_i/K}(b_i)$ is an
integer multiple of one of these coefficients
(Fields, Lemma \ref{fields-lemma-trace-and-norm-from-minimal-polynomial}).
\end{proof}

\begin{lemma}
\label{lemma-dedekind-complementary-module}
If the Dedekind different of $A \to B$ is defined, then
there is a canonical isomorphism
$\mathcal{L}_{B/A} \to \omega_{B/A}$.
\end{lemma}

\begin{proof}
Recall that $\omega_{B/A} = \Hom_A(B, A)$ as $A \to B$ is finite.
We send $x \in \mathcal{L}_{B/A}$ to the map
$b \mapsto \text{Trace}_{L/K}(bx)$.
Conversely, given an $A$-linear map $\varphi : B \to A$
we obtain a $K$-linear map $\varphi_K : L \to K$. Since $K \to L$ is finite
\'etale, we see that the trace pairing is nondegenerate
(Lemma \ref{lemma-discriminant}) and hence there exists a $x \in L$ such that
$\varphi_K(y) = \text{Trace}_{L/K}(xy)$ for all $y \in L$.
Then $x \in \mathcal{L}_{B/A}$ maps to $\varphi$ in $\omega_{B/A}$.
\end{proof}

\begin{lemma}
\label{lemma-flat-dedekind-complementary-module-trace}
If the Dedekind different of $A \to B$ is defined and $A \to B$ is flat, then
\begin{enumerate}
\item the canonical isomorphism $\mathcal{L}_{B/A} \to \omega_{B/A}$
sends $1 \in \mathcal{L}_{B/A}$ to the trace element
$\tau_{B/A} \in \omega_{B/A}$, and
\item the Dedekind different is
$\mathfrak{D}_{B/A} = \{b \in B \mid b\omega_{B/A} \subset B\tau_{B/A}\}$.
\end{enumerate}
\end{lemma}

\begin{proof}
The first assertion
follows from the proof of Lemma \ref{lemma-dedekind-different-ideal}
and Lemma \ref{lemma-finite-flat-trace}.
The second assertion is immediate from the first and the
definitions.
\end{proof}



\section{The different}
\label{section-different}

\noindent
The motivation for the following definition is that it recovers the
Dedekind different in the finite flat case as we will see below.

\begin{definition}
\label{definition-different}
Let $f : Y \to X$ be a flat quasi-finite morphism of Noetherian schemes.
Let $\omega_{Y/X}$ be the relative dualizing module and let
$\tau_{Y/X} \in \Gamma(Y, \omega_{Y/X})$ be the trace element
(Remarks \ref{remark-relative-dualizing-for-quasi-finite} and
\ref{remark-relative-dualizing-for-flat-quasi-finite}).
The annihilator of
$$
\Coker(\mathcal{O}_Y \xrightarrow{\tau_{Y/X}} \omega_{Y/X})
$$
is the {\it different} of $Y/X$. It is a coherent ideal
$\mathfrak{D}_f \subset \mathcal{O}_Y$.
\end{definition}

\noindent
We will generalize this in Remark \ref{remark-different-generalization} below.
Observe that $\mathfrak{D}_f$ is locally generated by one element if
$\omega_{Y/X}$ is an invertible $\mathcal{O}_Y$-module.
We first state the agreement with the Dedekind different.

\begin{lemma}
\label{lemma-flat-agree-dedekind}
Let $f : Y \to X$ be a flat quasi-finite morphism of Noetherian schemes.
Let $V = \Spec(B) \subset Y$, $U = \Spec(A) \subset X$
be affine open subschemes with $f(V) \subset U$.
If the Dedekind different of $A \to B$ is defined, then
$$
\mathfrak{D}_f|_V = \widetilde{\mathfrak{D}_{B/A}}
$$
as coherent ideal sheaves on $V$.
\end{lemma}

\begin{proof}
This is clear from Lemmas \ref{lemma-dedekind-different-ideal} and
\ref{lemma-flat-dedekind-complementary-module-trace}.
\end{proof}

\begin{lemma}
\label{lemma-flat-gorenstein-agree-noether}
Let $f : Y \to X$ be a flat quasi-finite morphism of Noetherian schemes.
Let $V = \Spec(B) \subset Y$, $U = \Spec(A) \subset X$
be affine open subschemes with $f(V) \subset U$.
If $\omega_{Y/X}|_V$ is invertible, i.e., if $\omega_{B/A}$
is an invertible $B$-module, then
$$
\mathfrak{D}_f|_V = \widetilde{\mathfrak{D}}
$$
as coherent ideal sheaves on $V$ where
$\mathfrak{D} \subset B$ is the Noether different of $B$ over $A$.
\end{lemma}

\begin{proof}
Consider the map
$$
\SheafHom_{\mathcal{O}_Y}(\omega_{Y/X}, \mathcal{O}_Y)
\longrightarrow
\mathcal{O}_Y,\quad
\varphi \longmapsto \varphi(\tau_{Y/X})
$$
The image of this map corresponds to the Noether different
on affine opens, see Lemma \ref{lemma-noether-different-flat-quasi-finite}.
Hence the result follows from the elementary fact that given
an invertible module $\omega$ and a global section $\tau$
the image of
$\tau : \SheafHom(\omega, \mathcal{O}) = \omega^{\otimes -1} \to \mathcal{O}$
is the same as the annihilator of $\Coker(\tau : \mathcal{O} \to \omega)$.
\end{proof}

\begin{lemma}
\label{lemma-base-change-different}
Consider a cartesian diagram of Noetherian schemes
$$
\xymatrix{
Y' \ar[d]_{f'} \ar[r] & Y \ar[d]^f \\
X' \ar[r]^g & X
}
$$
with $f$ flat and quasi-finite. Let $R \subset Y$, resp.\ $R' \subset Y'$
be the closed subscheme cut out by the different
$\mathfrak{D}_f$, resp.\ $\mathfrak{D}_{f'}$.
Then $Y' \to Y$ induces a bijective closed immersion $R' \to R \times_Y Y'$.
If $g$ is flat or if $\omega_{Y/X}$ is invertible, then
$R' = R \times_Y Y'$.
\end{lemma}

\begin{proof}
There is an immediate reduction to the case where $X$, $X'$, $Y$, $Y'$
are affine. In other words, we have a cocartesian diagram of Noetherian
rings
$$
\xymatrix{
B' & B \ar[l] \\
A' \ar[u] & A \ar[l] \ar[u]
}
$$
with $A \to B$ flat and quasi-finite. The base change map
$\omega_{B/A} \otimes_B B' \to \omega_{B'/A'}$ is an isomorphism
(Lemma \ref{lemma-dualizing-base-change-of-flat}) and maps
the trace element $\tau_{B/A}$ to the trace element $\tau_{B'/A'}$
(Lemma \ref{lemma-trace-base-change}).
Hence the finite $B$-module $Q = \Coker(\tau_{B/A} : B \to \omega_{B/A})$
satisfies $Q \otimes_B B' = \Coker(\tau_{B'/A'} : B' \to \omega_{B'/A'})$.
Thus $\mathfrak{D}_{B/A}B' \subset \mathfrak{D}_{B'/A'}$ which means
we obtain the closed immersion $R' \to R \times_Y Y'$.
Since $R = \text{Supp}(Q)$ and $R' = \text{Supp}(Q \otimes_B B')$
(Algebra, Lemma \ref{algebra-lemma-support-closed})
we see that $R' \to R \times_Y Y'$ is bijective by
Algebra, Lemma \ref{algebra-lemma-support-base-change}.
The equality $\mathfrak{D}_{B/A}B' = \mathfrak{D}_{B'/A'}$ holds
if $B \to B'$ is flat, e.g., if $A \to A'$ is flat, see
Algebra, Lemma \ref{algebra-lemma-annihilator-flat-base-change}.
Finally, if $\omega_{B/A}$ is invertible, then we can localize
and assume $\omega_{B/A} = B \lambda$. Writing $\tau_{B/A} = b\lambda$
we see that $Q = B/bB$ and $\mathfrak{D}_{B/A} = bB$.
The same reasoning over $B'$
gives $\mathfrak{D}_{B'/A'} = bB'$ and the lemma is proved.
\end{proof}

\begin{lemma}
\label{lemma-norm-different-in-discriminant}
Let $f : Y \to X$ be a finite flat morphism of Noetherian schemes.
Then $\text{Norm}_f : f_*\mathcal{O}_Y \to \mathcal{O}_X$ maps
$f_*\mathfrak{D}_f$ into the ideal sheaf of the discriminant $D_f$.
\end{lemma}

\begin{proof}
The norm map is constructed in
Divisors, Lemma \ref{divisors-lemma-finite-locally-free-has-norm}
and the discriminant of $f$ in Section \ref{section-discriminant}.
The question is affine local, hence we may assume $X = \Spec(A)$,
$Y = \Spec(B)$ and $f$ given by a finite locally free ring map $A \to B$.
Localizing further we may assume $B$ is finite free as an $A$-module.
Choose a basis $b_1, \ldots, b_n \in B$ for $B$ as an $A$-module.
Denote $b_1^\vee, \ldots, b_n^\vee$ the dual basis of
$\omega_{B/A} = \Hom_A(B, A)$ as an $A$-module.
Since the norm of $b$ is the determinant of $b : B \to B$ as an
$A$-linear map, we see that
$\text{Norm}_{B/A}(b) = \det(b_i^\vee(bb_j))$.
The discriminant is the principal closed subscheme of $\Spec(A)$
defined by $\det(\text{Trace}_{B/A}(b_ib_j))$.
If $b \in \mathfrak{D}_{B/A}$ then
there exist $c_i \in B$ such that
$b \cdot b_i^\vee = c_i \cdot \text{Trace}_{B/A}$ where
we use a dot to indicate the $B$-module structure on $\omega_{B/A}$.
Write $c_i = \sum a_{il} b_l$.
We have
\begin{align*}
\text{Norm}_{B/A}(b)
& =
\det(b_i^\vee(bb_j)) \\
& =
\det( (b \cdot b_i^\vee)(b_j)) \\
& =
\det((c_i \cdot \text{Trace}_{B/A})(b_j)) \\
& =
\det(\text{Trace}_{B/A}(c_ib_j)) \\
& =
\det(a_{il}) \det(\text{Trace}_{B/A}(b_l b_j))
\end{align*}
which proves the lemma.
\end{proof}

\begin{lemma}
\label{lemma-different-ramification}
Let $f : Y \to X$ be a flat quasi-finite morphism of Noetherian schemes.
The closed subscheme $R \subset Y$ defined by the different $\mathfrak{D}_f$
is exactly the set of points where $f$ is not \'etale
(equivalently not unramified).
\end{lemma}

\begin{proof}
Since $f$ is of finite presentation and flat, we see that it is \'etale
at a point if and only if it is unramified at that point. Moreover, the
formation of the locus of ramified points commutes with base change.
See Morphisms, Section \ref{morphisms-section-etale} and especially
Morphisms, Lemma \ref{morphisms-lemma-set-points-where-fibres-etale}.
By Lemma \ref{lemma-base-change-different} the formation of $R$ commutes
set theoretically with base change. Hence it suffices to prove the
lemma when $X$ is the spectrum of a field. On the other hand, the
construction of $(\omega_{Y/X}, \tau_{Y/X})$ is local on $Y$.
Since $Y$ is a finite discrete space (being quasi-finite
over a field), we may assume $Y$ has a unique point.

\medskip\noindent
Say $X = \Spec(k)$ and $Y = \Spec(B)$ where $k$ is a field and $B$ is
a finite local $k$-algebra. If $Y \to X$ is \'etale, then
$B$ is a finite separable extension of $k$, and the trace
element $\text{Trace}_{B/k}$ is a basis element of $\omega_{B/k}$
by Fields, Lemma \ref{fields-lemma-separable-trace-pairing}.
Thus $\mathfrak{D}_{B/k} = B$ in this case.
Conversely, if $\mathfrak{D}_{B/k} = B$, then we see from
Lemma \ref{lemma-norm-different-in-discriminant}
and the fact that the norm of $1$ equals $1$ that the
discriminant is empty. Hence
$Y \to X$ is \'etale by Lemma \ref{lemma-discriminant}.
\end{proof}

\begin{lemma}
\label{lemma-norm-different-is-discriminant}
Let $f : Y \to X$ be a flat quasi-finite morphism of Noetherian schemes.
Let $R \subset Y$ be the closed subscheme defined by $\mathfrak{D}_f$.
\begin{enumerate}
\item If $\omega_{Y/X}$ is invertible,
then $R$ is a locally principal closed subscheme of $Y$.
\item If $\omega_{Y/X}$ is invertible and $f$ is finite, then
the norm of $R$ is the discriminant $D_f$ of $f$.
\item If $\omega_{Y/X}$ is invertible and $f$
is \'etale at the associated points of $Y$, then $R$
is an effective Cartier divisor and there is an
isomorphism $\mathcal{O}_Y(R) = \omega_{Y/X}$.
\end{enumerate}
\end{lemma}

\begin{proof}
Proof of (1). We may work locally on $Y$, hence we may assume
$\omega_{Y/X}$ is free of rank $1$. Say $\omega_{Y/X} = \mathcal{O}_Y\lambda$.
Then we can write $\tau_{Y/X} = h \lambda$ and then we see that
$R$ is defined by $h$, i.e., $R$ is locally principal.

\medskip\noindent
Proof of (2). We may assume $Y \to X$ is given by a finite free ring
map $A \to B$ and that $\omega_{B/A}$ is free of rank $1$ as $B$-module.
Choose a $B$-basis element $\lambda$ for $\omega_{B/A}$ and write
$\text{Trace}_{B/A} = b \cdot \lambda$ for some $b \in B$.
Then $\mathfrak{D}_{B/A} = (b)$ and $D_f$ is cut out by
$\det(\text{Trace}_{B/A}(b_ib_j))$ where $b_1, \ldots, b_n$ is a
basis of $B$ as an $A$-module. Let $b_1^\vee, \ldots, b_n^\vee$
be the dual basis.
Writing $b_i^\vee = c_i \cdot \lambda$ we see that
$c_1, \ldots, c_n$ is a basis of $B$ as well.
Hence with $c_i = \sum a_{il}b_l$ we see that $\det(a_{il})$
is a unit in $A$. Clearly,
$b \cdot b_i^\vee = c_i \cdot \text{Trace}_{B/A}$
hence we conclude from the computation in the proof of
Lemma \ref{lemma-norm-different-in-discriminant}
that $\text{Norm}_{B/A}(b)$ is a unit times
$\det(\text{Trace}_{B/A}(b_ib_j))$.

\medskip\noindent
Proof of (3). In the notation above we see from
Lemma \ref{lemma-different-ramification} and the assumption
that $h$ does not vanish in
the associated points of $Y$, which implies that $h$ is a nonzerodivisor.
The canonical isomorphism sends $1$ to $\tau_{Y/X}$, see
Divisors, Lemma \ref{divisors-lemma-characterize-OD}.
\end{proof}







\section{Quasi-finite syntomic morphisms}
\label{section-quasi-finite-syntomic}

\noindent
This section discusses the fact that a quasi-finite syntomic morphism
has an invertible relative dualizing module.

\begin{lemma}
\label{lemma-syntomic-quasi-finite}
Let $f : Y \to X$ be a morphism of schemes. The following are equivalent
\begin{enumerate}
\item $f$ is locally quasi-finite and syntomic,
\item $f$ is locally quasi-finite, flat, and a local complete intersection
morphism,
\item $f$ is locally quasi-finite, flat, locally of finite presentation,
and the fibres of $f$ are local complete intersections,
\item $f$ is locally quasi-finite and for every $y \in Y$ there are
affine opens $y \in V = \Spec(B) \subset Y$, $U = \Spec(A) \subset X$
with $f(V) \subset U$ an integer $n$ and
$h, f_1, \ldots, f_n \in A[x_1, \ldots, x_n]$ such that
$B = A[x_1, \ldots, x_n, 1/h]/(f_1, \ldots, f_n)$,
\item for every $y \in Y$ there are affine opens
$y \in V = \Spec(B) \subset Y$, $U = \Spec(A) \subset X$
with $f(V) \subset U$ such that $A \to B$ is a relative global complete
intersection of the form $B = A[x_1, \ldots, x_n]/(f_1, \ldots, f_n)$,
\item $f$ is locally quasi-finite, flat, locally of finite presentation,
and $\NL_{X/Y}$ has tor-amplitude in $[-1, 0]$, and
\item $f$ is flat, locally of finite presentation,
$\NL_{X/Y}$ is perfect of rank $0$ with tor-amplitude in $[-1, 0]$,
\end{enumerate}
\end{lemma}

\begin{proof}
The equivalence of (1) and (2) is
More on Morphisms, Lemma \ref{more-morphisms-lemma-flat-lci}.
The equivalence of (1) and (3) is 
Morphisms, Lemma \ref{morphisms-lemma-syntomic-flat-fibres}.

\medskip\noindent
If $A \to B$ is as in (4), then
$B = A[x, x_1, \ldots, x_n]/(xh - 1, f_1, \ldots, f_n]$
is a relative global complete intersection by see Algebra, Definition
\ref{algebra-definition-relative-global-complete-intersection}.
Thus (4) implies (5).
It is clear that (5) implies (4).

\medskip\noindent
Condition (5) implies (1): by
Algebra, Lemma \ref{algebra-lemma-relative-global-complete-intersection}
a relative global complete intersection is syntomic and
the definition of a relative global complete intersection
guarantees that a relative global complete intersection on
$n$ variables with $n$ equations is quasi-finite, see
Algebra, Definition
\ref{algebra-definition-relative-global-complete-intersection} and
Lemma \ref{algebra-lemma-isolated-point-fibre}.

\medskip\noindent
Either Algebra, Lemma \ref{algebra-lemma-syntomic} or
Morphisms, Lemma \ref{morphisms-lemma-syntomic-locally-standard-syntomic}
shows that (1) implies (5).

\medskip\noindent
More on Morphisms, Lemma \ref{more-morphisms-lemma-flat-fp-NL-lci} shows that
(6) is equivalent to (1). If the equivalent conditions (1) -- (6) hold,
then we see that affine locally $Y \to X$ is given by a relative global
complete intersection $B = A[x_1, \ldots, x_n]/(f_1, \ldots, f_n)$
with the same number of variables as the number of
equations. Using this presentation we see that
$$
\NL_{B/A} =\left(
(f_1, \ldots, f_n)/(f_1, \ldots, f_n)^2
\longrightarrow
\bigoplus\nolimits_{i = 1, \ldots, n} B \text{d} x_i\right)
$$
By Algebra, Lemma
\ref{algebra-lemma-relative-global-complete-intersection-conormal}
the module $(f_1, \ldots, f_n)/(f_1, \ldots, f_n)^2$
is free with generators the congruence classes of the elements
$f_1, \ldots, f_n$. Thus $\NL_{B/A}$ has rank $0$ and so does $\NL_{Y/X}$.
In this way we see that (1) -- (6) imply (7).

\medskip\noindent
Finally, assume (7). By
More on Morphisms, Lemma \ref{more-morphisms-lemma-flat-fp-NL-lci}
we see that $f$ is syntomic. Thus on suitable affine opens
$f$ is given by a relative global complete intersection
$A \to B = A[x_1, \ldots, x_n]/(f_1, \ldots, f_m)$, see
Morphisms, Lemma \ref{morphisms-lemma-syntomic-locally-standard-syntomic}.
Exactly as above we see that $\NL_{B/A}$ is a perfect complex
of rank $n - m$. Thus $n = m$ and we see that (5) holds.
This finishes the proof.
\end{proof}

\begin{lemma}
\label{lemma-characterize-invertible}
Invertibility of the relative dualizing module.
\begin{enumerate}
\item If $A \to B$ is a quasi-finite flat homomorphism of Noetherian rings,
then $\omega_{B/A}$ is an invertible $B$-module if and only if
$\omega_{B \otimes_A \kappa(\mathfrak p)/\kappa(\mathfrak p)}$
is an invertible $B \otimes_A \kappa(\mathfrak p)$-module
for all primes $\mathfrak p \subset A$.
\item If $Y \to X$ is a quasi-finite flat morphism of
Noetherian schemes, then $\omega_{Y/X}$ is invertible
if and only if $\omega_{Y_x/x}$ is invertible for all $x \in X$.
\end{enumerate}
\end{lemma}

\begin{proof}
Proof of (1). As $A \to B$ is flat, the module
$\omega_{B/A}$ is $A$-flat, see Lemma \ref{lemma-dualizing-base-flat-flat}.
Thus $\omega_{B/A}$ is an invertible $B$-module if and only if
$\omega_{B/A} \otimes_A \kappa(\mathfrak p)$
is an invertible $B \otimes_A \kappa(\mathfrak p)$-module for
every prime $\mathfrak p \subset A$, see More on Morphisms, Lemma
\ref{more-morphisms-lemma-flat-and-free-at-point-fibre}.
Still using that $A \to B$ is flat, we have that
formation of $\omega_{B/A}$ commutes with base change, see
Lemma \ref{lemma-dualizing-base-change-of-flat}.
Thus we see that invertibility of the relative dualizing module,
in the presence of flatness, is equivalent to invertibility
of the relative dualizing module for the maps
$\kappa(\mathfrak p) \to B \otimes_A \kappa(\mathfrak p)$.

\medskip\noindent
Part (2) follows from (1) and the fact that affine locally
the dualizing modules are given by their algebraic counterparts, see
Remark \ref{remark-relative-dualizing-for-quasi-finite}.
\end{proof}

\begin{lemma}
\label{lemma-dim-zero-global-complete-intersection-over-field}
Let $k$ be a field. Let $B = k[x_1, \ldots, x_n]/(f_1, \ldots, f_n)$
be a global complete intersection over $k$ of dimension $0$.
Then $\omega_{B/k}$ is invertible.
\end{lemma}

\begin{proof}
By Noether normalization, see
Algebra, Lemma \ref{algebra-lemma-Noether-normalization}
we see that there exists a finite injection $k \to B$, i.e.,
$\dim_k(B) < \infty$. Hence $\omega_{B/k} = \Hom_k(B, k)$
as a $B$-module.
By Dualizing Complexes, Lemma \ref{dualizing-lemma-dualizing-finite}
we see that $R\Hom(B, k)$ is a dualizing complex for $B$
and by Dualizing Complexes, Lemma \ref{dualizing-lemma-RHom-ext}
we see that $R\Hom(B, k)$ is equal to $\omega_{B/k}$
placed in degree $0$. Thus it suffices to show that
$B$ is Gorenstein
(Dualizing Complexes, Lemma \ref{dualizing-lemma-gorenstein}).
This is true by Dualizing Complexes, Lemma
\ref{dualizing-lemma-gorenstein-lci}.
\end{proof}

\begin{lemma}
\label{lemma-dualizing-syntomic-quasi-finite}
Let $f : Y \to X$ be a morphism of locally Noetherian schemes. If $f$
satisfies the equivalent conditions of Lemma \ref{lemma-syntomic-quasi-finite}
then $\omega_{Y/X}$ is an invertible $\mathcal{O}_Y$-module.
\end{lemma}

\begin{proof}
We may assume $A \to B$ is a relative global complete
intersection of the form $B = A[x_1, \ldots, x_n]/(f_1, \ldots, f_n)$
and we have to show $\omega_{B/A}$ is invertible.
This follows in combining Lemmas \ref{lemma-characterize-invertible} and
\ref{lemma-dim-zero-global-complete-intersection-over-field}.
\end{proof}

\begin{example}
\label{example-universal-quasi-finite-syntomic}
Let $n \geq 1$ and $d \geq 1$ be integers. Let $T$ be the set of
multi-indices $E = (e_1, \ldots, e_n)$ with $e_i \geq 0$ and
$\sum e_i \leq d$. Consider the ring
$$
A = \mathbf{Z}[a_{i, E} ; 1 \leq i \leq n, E \in T]
$$
In $A[x_1, \ldots, x_n]$ consider the elements
$f_i = \sum_{E \in T} a_{i, E} x^E$ where $x^E = x_1^{e_1} \ldots x_n^{e_n}$
as is customary. Consider the $A$-algebra
$$
B = A[x_1, \ldots, x_n]/(f_1, \ldots, f_n)
$$
Denote $X_{n, d} = \Spec(A)$ and let $Y_{n, d} \subset \Spec(B)$
be the maximal open subscheme such that the restriction of the
morphism $\Spec(B) \to \Spec(A) = X_{n, d}$ is quasi-finite, see
Algebra, Lemma \ref{algebra-lemma-quasi-finite-open}.
\end{example}

\begin{lemma}
\label{lemma-universal-quasi-finite-syntomic-etale}
With notation as in Example \ref{example-universal-quasi-finite-syntomic}
the schemes $X_{n, d}$ and $Y_{n, d}$ are regular and irreducible,
the morphism $Y_{n, d} \to X_{n, d}$ is locally quasi-finite and
syntomic, and there is a dense open subscheme $V \subset Y_{n, d}$
such that $Y_{n, d} \to X_{n, d}$ restricts to an \'etale morphism
$V \to X_{n, d}$.
\end{lemma}

\begin{proof}
The scheme $X_{n, d}$ is the spectrum of the polynomial ring $A$.
Hence $X_{n, d}$ is regular and irreducible. Since we can write
$$
f_i = a_{i, (0, \ldots, 0)} +
\sum\nolimits_{E \in T, E \not = (0, \ldots, 0)} a_{i, E} x^E
$$
we see that the ring $B$ is isomorphic to the polynomial ring
on $x_1, \ldots, x_n$ and the elements $a_{i, E}$ with
$E \not = (0, \ldots, 0)$. Hence $\Spec(B)$ is an irreducible and
regular scheme and so is the open $Y_{n, d}$. The morphism
$Y_{n, d} \to X_{n, d}$ is locally quasi-finite and syntomic by
Lemma \ref{lemma-syntomic-quasi-finite}. To find $V$ it suffices
to find a single point where $Y_{n, d} \to X_{n, d}$ is \'etale
(the locus of points where a morphism is \'etale is open by
definition). Thus it suffices to find a point of $X_{n, d}$
where the fibre of $Y_{n, d} \to X_{n, d}$ is nonempty and \'etale, see
Morphisms, Lemma \ref{morphisms-lemma-etale-at-point}. We choose
the point corresponding to the ring map $\chi : A \to \mathbf{Q}$
sending $f_i$ to $1 + x_i^d$. Then
$$
B \otimes_{A, \chi} \mathbf{Q} =
\mathbf{Q}[x_1, \ldots, x_n]/(x_1^d - 1, \ldots, x_n^d - 1)
$$
which is a nonzero \'etale algebra over $\mathbf{Q}$.
\end{proof}

\begin{lemma}
\label{lemma-locally-comes-from-universal}
Let $f : Y \to X$ be a morphism of schemes. If $f$ satisfies the equivalent
conditions of Lemma \ref{lemma-syntomic-quasi-finite} then for every
$y \in Y$ there exist $n, d$ and a commutative diagram
$$
\xymatrix{
Y \ar[d] &
V \ar[d] \ar[l] \ar[r] &
Y_{n, d} \ar[d] \\
X & U \ar[l] \ar[r] &
X_{n, d}
}
$$
where $U \subset X$ and $V \subset Y$ are open, where $Y_{n, d} \to X_{n, d}$
is as in Example \ref{example-universal-quasi-finite-syntomic}, and
where the square on the right hand side is cartesian.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-syntomic-quasi-finite}
we can choose $U$ and $V$ affine so that
$U = \Spec(R)$ and $V = \Spec(S)$ with
$S = R[y_1, \ldots, y_n]/(g_1, \ldots, g_n)$.
With notation as in Example \ref{example-universal-quasi-finite-syntomic}
if we pick $d$ large enough, then we can write each $g_i$ as
$g_i = \sum_{E \in T} g_{i, E}y^E$ with $g_{i, E} \in R$.
Then the map $A \to R$ sending $a_{i, E}$ to $g_{i, E}$
and the map $B \to S$ sending $x_i \to y_i$ give a cocartesian
diagram of rings
$$
\xymatrix{
S & B \ar[l] \\
R \ar[u] & A \ar[l] \ar[u]
}
$$
which proves the lemma.
\end{proof}











\section{Finite syntomic morphisms}
\label{section-finite-syntomic}

\noindent
This section is the analogue of Section \ref{section-quasi-finite-syntomic}
for finite syntomic morphisms.

\begin{lemma}
\label{lemma-syntomic-finite}
Let $f : Y \to X$ be a morphism of schemes. The following are equivalent
\begin{enumerate}
\item $f$ is finite and syntomic,
\item $f$ is finite, flat, and a local complete intersection morphism,
\item $f$ is finite, flat, locally of finite presentation,
and the fibres of $f$ are local complete intersections,
\item $f$ is finite and for every $x \in X$ there is an
affine open $x \in U = \Spec(A) \subset X$ an integer $n$
and $f_1, \ldots, f_n \in A[x_1, \ldots, x_n]$ such that
$f^{-1}(U)$ is isomorphic to the spectrum of
$A[x_1, \ldots, x_n]/(f_1, \ldots, f_n)$,
\item $f$ is finite, flat, locally of finite presentation,
and $\NL_{X/Y}$ has tor-amplitude in $[-1, 0]$, and
\item $f$ is finite, flat, locally of finite presentation, and
$\NL_{X/Y}$ is perfect of rank $0$ with tor-amplitude in $[-1, 0]$,
\end{enumerate}
\end{lemma}

\begin{proof}
The equivalence of (1), (2), (3), (5), and (6)
and the implication (4) $\Rightarrow$ (1) follow immediately
from Lemma \ref{lemma-syntomic-quasi-finite}. Assume the equivalent conditions
(1), (2), (3), (5), (6) hold.
Choose a point $x \in X$ and an affine open $U = \Spec(A)$
of $x$ in $X$ and say $x$ corresponds to the prime ideal
$\mathfrak p \subset A$. Write $f^{-1}(U) = \Spec(B)$.
Write $B = A[x_1, \ldots, x_n]/I$. Since $\NL_{B/A}$
is perfect of tor-amplitude in $[-1, 0]$ by (6)
we see that $I/I^2$ is a finite locally free $B$-module
of rank $n$. Since $B_\mathfrak p$ is semi-local we see that
$(I/I^2)_\mathfrak p$ is free of rank $n$, see
Algebra, Lemma \ref{algebra-lemma-locally-free-semi-local-free}.
Thus after replacing $A$ by a principal localization at
an element not in $\mathfrak p$ we may assume $I/I^2$
is a free $B$-module of rank $n$.
Thus by Algebra, Lemma \ref{algebra-lemma-huber}
we can find a presentation of $B$ over $A$
with the same number of variables as equations. In other words,
we may assume $B = A[x_1, \ldots, x_n]/(f_1, \ldots, f_n)$.
This proves (4).
\end{proof}

\begin{example}
\label{example-universal-finite-syntomic}
Let $d \geq 1$ be an integer. Consider variables
$a_{ij}^l$ for $1 \leq i, j, l \leq d$ and denote
$$
A_d = \mathbf{Z}[a_{ij}^k]/J
$$
where $J$ is the ideal generated by the elements
$$
\left\{
\begin{matrix}
\sum_l a_{ij}^la_{lk}^m - \sum_l a_{il}^ma_{jk}^l & \forall i, j, k, m \\
a_{ij}^k - a_{ji}^k & \forall i, j, k \\
a_{i1}^j - \delta_{ij} & \forall i, j
\end{matrix}
\right.
$$
where $\delta_{ij}$ indices the Kronecker delta function.
We define an $A_d$-algebra $B_d$ as follows: as an $A_d$-module we set
$$
B_d = A_d e_1 \oplus \ldots \oplus A_d e_d
$$
The algebra structure is given by $A_d \to B_d$ mapping $1$ to $e_1$.
The multiplication on $B_d$ is the $A_d$-bilinar map
$$
m : B_d \times B_d \longrightarrow B_d, \quad
m(e_i, e_j) = \sum a_{ij}^k e_k
$$
It is straightforward to check that the relations given above
exactly force this to be an $A_d$-algebra structure.
The morphism
$$
\pi_d : Y_d = \Spec(B_d) \longrightarrow \Spec(A_d) = X_d
$$
is the ``universal'' finite free morphism of rank $d$.
\end{example}

\begin{lemma}
\label{lemma-universal-finite-syntomic}
With notation as in Example \ref{example-universal-finite-syntomic}
there is an open subscheme $U_d \subset X_d$ with the following property:
a morphism of schemes $X \to X_d$ factors through $U_d$ if and only
if $Y_d \times_{X_d} X \to X$ is syntomic.
\end{lemma}

\begin{proof}
Recall that being syntomic is the same thing as being flat and
a local complete intersection morphism, see
More on Morphisms, Lemma \ref{more-morphisms-lemma-flat-lci}.
The set $W_d \subset Y_d$ of points where $\pi_d$ is Koszul
is open in $Y_d$ and its formation commutes with arbitrary base change, see
More on Morphisms, Lemma \ref{more-morphisms-lemma-base-change-lci-fibres}.
Since $\pi_d$ is finite and hence closed, we see that
$Z = \pi_d(Y_d \setminus W_d)$ is closed. Since clearly $U_d = X_d \setminus Z$
and since its formation commutes with base change we find that the lemma
is true.
\end{proof}

\begin{lemma}
\label{lemma-universal-finite-syntomic-smooth}
With notation as in Example \ref{example-universal-finite-syntomic}
and $U_d$ as in Lemma \ref{lemma-universal-finite-syntomic}
then $U_d$ is smooth over $\Spec(\mathbf{Z})$.
\end{lemma}

\begin{proof}
Let us use More on Morphisms, Lemma
\ref{more-morphisms-lemma-lifting-along-artinian-at-point}
to show that $U_d \to \Spec(\mathbf{Z})$ is smooth.
Namely, suppose that $\Spec(A) \to U_d$ is a morphism
and $A' \to A$ is a small extension. Then $B = A \otimes_{A_d} B_d$
is a finite free $A$-algebra which is syntomic over $A$
(by construction of $U_d$). By
Smoothing Ring Maps, Proposition \ref{smoothing-proposition-lift-smooth}
there exists a syntomic ring map $A' \to B'$ such that
$B \cong B' \otimes_{A'} A$. Set $e'_1 = 1 \in B'$. For $1 < i \leq d$
choose lifts $e'_i \in B'$ of the elements
$1 \otimes e_i \in A \otimes_{A_d} B_d = B$. Then $e'_1, \ldots, e'_d$
is a basis for $B'$ over $A'$ (for example see Algebra, Lemma
\ref{algebra-lemma-local-artinian-basis-when-flat}).
Thus we can write $e'_i e'_j = \sum \alpha_{ij}^l e'_l$ for unique
elements $\alpha_{ij}^l \in A'$ which satisfy the relations
$\sum_l \alpha_{ij}^l \alpha_{lk}^m = \sum_l \alpha_{il}^m \alpha _{jk}^l$
and $\alpha_{ij}^k = \alpha_{ji}^k$ and $\alpha_{i1}^j - \delta_{ij}$
in $A'$. This determines a morphism $\Spec(A') \to X_d$ by
sending $a_{ij}^l \in A_d$ to $\alpha_{ij}^l \in A'$. This morphism
agrees with the given morphism $\Spec(A) \to U_d$. Since $\Spec(A')$
and $\Spec(A)$ have the same underlying topological space, we see
that we obtain the desired lift $\Spec(A') \to U_d$ and we
conclude that $U_d$ is smooth over $\mathbf{Z}$.
\end{proof}

\begin{lemma}
\label{lemma-universal-finite-syntomic-etale}
With notation as in Example \ref{example-universal-finite-syntomic}
consider the open subscheme $U'_d \subset X_d$ over which
$\pi_d$ is \'etale. Then $U'_d$ is a dense subset of the
open $U_d$ of Lemma \ref{lemma-universal-finite-syntomic}
\end{lemma}

\begin{proof}
By exactly the same reasoning as in the proof of
Lemma \ref{lemma-universal-finite-syntomic}, using
Morphisms, Lemma \ref{morphisms-lemma-set-points-where-fibres-etale},
there is a maximal open $U'_d \subset X_d$ over which $\pi_d$ is
\'etale. Moreover, since an \'etale morphism is syntomic, we see
that $U'_d \subset U_d$. To finish the proof we have to show
that $U'_d \subset U_d$ is dense. Let $u : \Spec(k) \to U_d$ be a morphism
where $k$ is a field. Let $B = k \otimes_{A_d} B_d$ as in the
proof of Lemma \ref{lemma-universal-finite-syntomic-smooth}.
We will show there is a local domain $A'$ with residue field $k$
and a finite syntomic $A'$ algebra $B'$ with $B = k \otimes_{A'} B'$
whose generic fibre is \'etale. Exactly as in the previous paragraph
this will determine a morphism $\Spec(A') \to U_d$ which will map the
generic point into $U'_d$ and the closed point to $u$, thereby
finishing the proof.

\medskip\noindent
By Lemma \ref{lemma-syntomic-finite} part (4) we can choose a presentation
$B = k[x_1, \ldots, x_n]/(f_1, \ldots, f_n)$.
Let $d'$ be the maximum total degree of the polynomials $f_1, \ldots, f_n$.
Let $Y_{n, d'} \to X_{n, d'}$ be as in
Example \ref{example-universal-quasi-finite-syntomic}.
By construction there is a morphism $u' : \Spec(k) \to X_{n, d'}$
such that
$$
\Spec(B) \cong Y_{n, d'} \times_{X_{n, d'}, u'} \Spec(k)
$$
Denote $A = \mathcal{O}_{X_{n, d'}, u'}^h$ the henselization of the
local ring of $X_{n, d'}$ at the image of $u'$. Then we can write
$$
Y_{n, d'} \times_{X_{n, d'}} \Spec(A) = Z \amalg W
$$
with $Z \to \Spec(A)$ finite and $W \to \Spec(A)$ having empty
closed fibre, see
Algebra, Lemma \ref{algebra-lemma-characterize-henselian} part (13)
or the discussion in More on Morphisms, Section
\ref{more-morphisms-section-etale-localization}.
By Lemma \ref{lemma-universal-quasi-finite-syntomic-etale}
the local ring $A$ is regular (here we also use
More on Algebra, Lemma \ref{more-algebra-lemma-henselization-regular})
and the morphism $Z \to \Spec(A)$ is \'etale over the generic point of
$\Spec(A)$ (because it is mapped to the generic point of $X_{d, n'}$).
By construction $Z \times_{\Spec(A)} \Spec(k) \cong \Spec(B)$.
This proves what we want except that the map from
residue field of $A$ to $k$ may not be an isomorphism.
By Algebra, Lemma \ref{algebra-lemma-flat-local-given-residue-field}
there exists a flat local ring map $A \to A'$ such that the residue
field of $A'$ is $k$. If $A'$ isn't a domain, then we choose a
minimal prime $\mathfrak p \subset A'$ (which lies over the
unique minimal prime of $A$ by flatness) and we replace
$A'$ by $A'/\mathfrak p$. Set $B'$ equal to the unique $A'$-algebra
such that $Z \times_{\Spec(A)} \Spec(A') = \Spec(B')$.
This finishes the proof.
\end{proof}

\begin{remark}
\label{remark-universal-finite-syntomic-smooth-top}
Let $\pi_d : Y_d \to X_d$ be as in
Example \ref{example-universal-finite-syntomic}.
Let $U_d \subset X_d$ be the maximal open over which
$V_d = \pi_d^{-1}(U_d)$ is finite syntomic as in
Lemma \ref{lemma-universal-finite-syntomic}.
Then it is also true that $V_d$ is smooth over $\mathbf{Z}$.
(Of course the morphism $V_d \to U_d$ is not smooth when $d \geq 2$.)
Arguing as in the proof of Lemma \ref{lemma-universal-finite-syntomic-smooth}
this corresponds to the following deformation
problem: given a small extension $C' \to C$ and
a finite syntomic $C$-algebra $B$ with a section $B \to C$,
find a finite syntomic $C'$-algebra $B'$ and a section $B' \to C'$
whose tensor product with $C$ recovers $B \to C$.
By Lemma \ref{lemma-syntomic-finite} we may write
$B = C[x_1, \ldots, x_n]/(f_1, \ldots, f_n)$ as
a relative global complete intersection.
After a change of coordinates with may assume
$x_1, \ldots, x_n$ are in the kernel of $B \to C$.
Then the polynomials $f_i$ have vanishing constant terms.
Choose any lifts $f'_i \in C'[x_1, \ldots, x_n]$ of $f_i$
with vanishing constant terms. Then 
$B' = C'[x_1, \ldots, x_n]/(f'_1, \ldots, f'_n)$
with section $B' \to C'$ sending $x_i$ to zero works.
\end{remark}

\begin{lemma}
\label{lemma-locally-comes-from-universal-finite}
Let $f : Y \to X$ be a morphism of schemes. If $f$ satisfies the equivalent
conditions of Lemma \ref{lemma-syntomic-finite} then for every
$x \in X$ there exist a $d$ and a commutative diagram
$$
\xymatrix{
Y \ar[d] &
V \ar[d] \ar[l] \ar[r] &
V_d \ar[d] \ar[r] &
Y_d \ar[d]^{\pi_d}\\
X &
U \ar[l] \ar[r] &
U_d \ar[r] &
X_d
}
$$
with the following properties
\begin{enumerate}
\item $U \subset X$ is open and $V = f^{-1}(U)$,
\item $\pi_d : Y_d \to X_d$ is as in
Example \ref{example-universal-finite-syntomic},
\item $U_d \subset X_d$ is as in Lemma \ref{lemma-universal-finite-syntomic}
and $V_d = \pi_d^{-1}(U_d) \subset Y_d$,
\item where the middle square is cartesian.
\end{enumerate}
\end{lemma}

\begin{proof}
Choose an affine open neighbourhood $U = \Spec(A) \subset X$ of $x$.
Write $V = f^{-1}(U) = \Spec(B)$. Then $B$ is a finite locally free
$A$-module and the inclusion $A \subset B$ is a locally direct summand.
Thus after shrinking $U$ we can choose a basis $1 = e_1, e_2, \ldots, e_d$
of $B$ as an $A$-module. Write
$e_i e_j = \sum \alpha_{ij}^l e_l$ for unique
elements $\alpha_{ij}^l \in A$ which satisfy the relations
$\sum_l \alpha_{ij}^l \alpha_{lk}^m = \sum_l \alpha_{il}^m \alpha _{jk}^l$
and $\alpha_{ij}^k = \alpha_{ji}^k$ and $\alpha_{i1}^j - \delta_{ij}$
in $A$. This determines a morphism $\Spec(A) \to X_d$ by sending
$a_{ij}^l \in A_d$ to $\alpha_{ij}^l \in A$. By construction
$V \cong \Spec(A) \times_{X_d} Y_d$. By the definition of $U_d$
we see that $\Spec(A) \to X_d$ factors through $U_d$. This
finishes the proof.
\end{proof}










\section{A formula for the different}
\label{section-formula-different}

\noindent
In this section we discuss the material in \cite[Appendix A]{Mazur-Roberts}
due to Tate. In our language, this will show that the different is
equal to the K\"ahler different in the case of a flat, quasi-finite,
local complete intersection morphism.
First we compute the Noether different in a special case.

\begin{lemma}
\label{lemma-tate}
\begin{reference}
\cite[Appendix]{Mazur-Roberts}
\end{reference}
Let $A \to P$ be a ring map. Let $f_1, \ldots, f_n \in P$ be a
Koszul regular sequence. Assume $B = P/(f_1, \ldots, f_n)$
is flat over $A$. Let $g_1, \ldots, g_n \in P \otimes_A B$
be a Koszul regular sequence generating the kernel of the multiplication
map $P \otimes_A B \to B$. Write $f_i \otimes 1 = \sum g_{ij} g_j$.
Then the annihilator of $\Ker(B \otimes_A B \to B)$ is a principal
ideal generated by the image of $\det(g_{ij})$.
\end{lemma}

\begin{proof}
The Koszul complex $K_\bullet = K(P, f_1, \ldots, f_n)$ is a resolution
of $B$ by finite free $P$-modules. The Koszul complex
$M_\bullet = K(P \otimes_A B, g_1, \ldots, g_n)$ is a resolution
of $B$ by finite free $P \otimes_A B$-modules. There is a map of
complexes
$$
K_\bullet \longrightarrow M_\bullet
$$
which in degree $1$ is given by the matrix $(g_{ij})$ and
in degree $n$ by $\det(g_{ij})$. See
More on Algebra, Lemma \ref{more-algebra-lemma-functorial}.
As $B$ is a flat $A$-module, we can view $M_\bullet$ as a complex
of flat $P$-modules (via $P \to P \otimes_A B$, $p \mapsto p \otimes 1$).
Thus we may use both complexes to compute $\text{Tor}_*^P(B, B)$ and
it follows that the displayed map defines a quasi-isomorphism after tensoring
with $B$. It is clear that $H_n(K_\bullet \otimes_P B) = B$.
On the other hand, $H_n(M_\bullet \otimes_P B)$ is the kernel of
$$
B \otimes_A B \xrightarrow{g_1, \ldots, g_n} (B \otimes_A B)^{\oplus n}
$$
Since $g_1, \ldots, g_n$ generate the kernel of $B \otimes_A B \to B$
this proves the lemma.
\end{proof}

\begin{lemma}
\label{lemma-quasi-finite-complete-intersection}
Let $A$ be a ring. Let $n \geq 1$ and
$h, f_1, \ldots, f_n \in A[x_1, \ldots, x_n]$.
Set $B = A[x_1, \ldots, x_n, 1/h]/(f_1, \ldots, f_n)$.
Assume that $B$ is quasi-finite over $A$.
Then
\begin{enumerate}
\item $B$ is flat over $A$ and $A \to B$ is a relative local complete
intersection,
\item the annihilator $J$ of $I = \Ker(B \otimes_A B \to B)$
is free of rank $1$ over $B$,
\item the Noether different of $B$ over $A$ is generated
by $\det(\partial f_i/\partial x_j)$ in $B$.
\end{enumerate}
\end{lemma}

\begin{proof}
Note that
$B = A[x, x_1, \ldots, x_n]/(xh - 1, f_1, \ldots, f_n)$
is a relative global complete intersection over $A$, see
Algebra, Definition
\ref{algebra-definition-relative-global-complete-intersection}.
By Algebra, Lemma \ref{algebra-lemma-relative-global-complete-intersection}
we see that $B$ is flat over $A$.

\medskip\noindent
Write $P' = A[x, x_1, \ldots, x_n]$ and
$P = P'/(xh - 1) = A[x_1, \ldots, x_n, 1/g]$.
Then we have $P' \to P \to B$.
By More on Algebra, Lemma
\ref{more-algebra-lemma-relative-global-complete-intersection-koszul}
we see that $xh - 1, f_1, \ldots, f_n$ is a Koszul regular sequence
in $P'$. Since $xh - 1$ is a Koszul regular sequence of length
one in $P'$ (by the same lemma for example) we conclude that 
$f_1, \ldots, f_n$ is a Koszul regular sequence in $P$ by
More on Algebra, Lemma \ref{more-algebra-lemma-truncate-koszul-regular}.

\medskip\noindent
Let $g_i \in P \otimes_A B$ be the image of $x_i \otimes 1 - 1 \otimes x_i$.
Let us use the short hand $y_i = x_i \otimes 1$ and $z_i = 1 \otimes x_i$
in $A[x_1, \ldots, x_n] \otimes_A A[x_1, \ldots, x_n]$
so that $g_i$ is the image of $y_i - z_i$. For a polynomial
$f \in A[x_1, \ldots, x_n]$ we write $f(y) = f \otimes 1$
and $f(z) = 1 \otimes f$ in the above tensor product.
Then we have
$$
P \otimes_A B/(g_1, \ldots, g_n) =
\frac{A[y_1, \ldots, y_n, z_1, \ldots, z_n, \frac{1}{h(y)h(z)}]}
{(f_1(z), \ldots, f_n(z), y_1 - z_1, \ldots, y_n - z_n)}
$$
which is clearly isomorphic to $B$. Hence by the same arguments
as above we find that $f_1(z), \ldots, f_n(z), y_1 - z_1, \ldots, y_n - z_n$
is a Koszul regular sequence in
$A[y_1, \ldots, y_n, z_1, \ldots, z_n, \frac{1}{h(y)h(z)}]$.
The sequence $f_1(z), \ldots, f_n(z)$ is a Koszul regular in
$A[y_1, \ldots, y_n, z_1, \ldots, z_n, \frac{1}{h(y)h(z)}]$
by flatness of the map
$$
P \longrightarrow A[y_1, \ldots, y_n, z_1, \ldots, z_n,
\textstyle{\frac{1}{h(y)h(z)}}],\quad x_i \longmapsto z_i
$$
and More on Algebra, Lemma
\ref{more-algebra-lemma-koszul-regular-flat-base-change}.
By More on Algebra, Lemma \ref{more-algebra-lemma-truncate-koszul-regular}
we conclude that $g_1, \ldots, g_n$ is a regular sequence
in $P \otimes_A B$.

\medskip\noindent
At this point we have verified all the assumptions of Lemma \ref{lemma-tate}
above with $P$, $f_1, \ldots, f_n$, and $g_i \in P \otimes_A B$ as above.
In particular the annihilator $J$ of $I$ is freely generated by one
element $\delta$ over $B$.
Set $f_{ij} = \partial f_i/\partial x_j \in A[x_1, \ldots, x_n]$.
An elementary computation shows that we can write
$$
f_i(y) =
f_i(z_1 + g_1, \ldots, z_n + g_n) =
f_i(z) + \sum\nolimits_j f_{ij}(z) g_j +
\sum\nolimits_{j, j'} F_{ijj'}g_jg_{j'}
$$
for some $F_{ijj'} \in A[y_1, \ldots, y_n, z_1, \ldots, z_n]$.
Taking the image in $P \otimes_A B$ the terms $f_i(z)$ map to
zero and we obtain
$$
f_i \otimes 1 = \sum\nolimits_j
\left(1 \otimes f_{ij} + \sum\nolimits_{j'} F_{ijj'}g_{j'}\right)g_j
$$
Thus we conclude from Lemma \ref{lemma-tate}
that $\delta = \det(g_{ij})$ with
$g_{ij} = 1 \otimes f_{ij} + \sum_{j'} F_{ijj'}g_{j'}$.
Since $g_{j'}$ maps to zero in $B$, we conclude
that the image of $\det(\partial f_i/\partial x_j)$ in $B$
generates the Noether different of $B$ over $A$.
\end{proof}

\begin{lemma}
\label{lemma-different-syntomic-quasi-finite}
Let $f : Y \to X$ be a morphism of Noetherian schemes. If $f$
satisfies the equivalent conditions of Lemma \ref{lemma-syntomic-quasi-finite}
then the different $\mathfrak{D}_f$ of $f$ is the K\"ahler different
of $f$.
\end{lemma}

\begin{proof}
By Lemmas \ref{lemma-flat-gorenstein-agree-noether} and
\ref{lemma-dualizing-syntomic-quasi-finite}
the different of $f$ affine locally is the same as the
Noether different. Then the lemma follows from the
computation of the Noether different and the K\"ahler
different on standard affine pieces done in
Lemmas \ref{lemma-kahler-different-complete-intersection} and
\ref{lemma-quasi-finite-complete-intersection}.
\end{proof}

\begin{lemma}
\label{lemma-different-quasi-finite-complete-intersection}
Let $A$ be a ring. Let $n \geq 1$ and
$h, f_1, \ldots, f_n \in A[x_1, \ldots, x_n]$.
Set $B = A[x_1, \ldots, x_n, 1/h]/(f_1, \ldots, f_n)$.
Assume that $B$ is quasi-finite over $A$.
Then there is an isomorphism $B \to \omega_{B/A}$
mapping $\det(\partial f_i/\partial x_j)$ to $\tau_{B/A}$.
\end{lemma}

\begin{proof}
Let $J$ be the annihilator of $\Ker(B \otimes_A B \to B)$.
By Lemma \ref{lemma-quasi-finite-complete-intersection}
the map $A \to B$ is flat and
$J$ is a free $B$-module with generator $\xi$ mapping to
$\det(\partial f_i/\partial x_j)$ in $B$.
Thus the lemma follows from
Lemma \ref{lemma-noether-different-flat-quasi-finite}
and the fact (Lemma \ref{lemma-dualizing-syntomic-quasi-finite})
that $\omega_{B/A}$ is an invertible $B$-module.
(Warning: it is necessary to prove $\omega_{B/A}$
is invertible because a finite $B$-module $M$ such
that $\Hom_B(M, B) \cong B$ need not be free.)
\end{proof}

\begin{example}
\label{example-different-for-monogenic}
Let $A$ be a Noetherian ring. Let $f, h \in A[x]$ such that
$$
B = (A[x]/(f))_h = A[x, 1/h]/(f)
$$
is quasi-finite over $A$. Let $f' \in A[x]$ be the derivative
of $f$ with respect to $x$. The ideal $\mathfrak{D} = (f') \subset B$
is the Noether different of $B$ over $A$,
is the K\"ahler different of $B$ over $A$, and
is the ideal whose associated quasi-coherent sheaf of ideals is the
different of $\Spec(B)$ over $\Spec(A)$.
\end{example}

\begin{lemma}
\label{lemma-discriminant-quasi-finite-morphism-smooth}
Let $S$ be a Noetherian scheme. Let $X$, $Y$ be smooth schemes
of relative dimension $n$ over $S$. Let $f : Y \to X$ be a
quasi-finite morphism over $S$.
Then $f$ is flat and the closed subscheme $R \subset Y$
cut out by the different of $f$ is the locally principal
closed subscheme cut out by
$$
\wedge^n(\text{d}f) \in
\Gamma(Y,
(f^*\Omega^n_{X/S})^{\otimes -1} \otimes_{\mathcal{O}_Y} \Omega^n_{Y/S})
$$
If $f$ is \'etale at the associated points of $Y$, then $R$ is an
effective Cartier divisor and
$$
f^*\Omega^n_{X/S} \otimes_{\mathcal{O}_Y} \mathcal{O}(R) =
\Omega^n_{Y/S}
$$
as invertible sheaves on $Y$.
\end{lemma}

\begin{proof}
To prove that $f$ is flat, it suffices to prove $Y_s \to X_s$
is flat for all $s \in S$ (More on Morphisms, Lemma
\ref{more-morphisms-lemma-morphism-between-flat-Noetherian}).
Flatness of $Y_s \to X_s$ follows from
Algebra, Lemma \ref{algebra-lemma-CM-over-regular-flat}.
By More on Morphisms, Lemma
\ref{more-morphisms-lemma-lci-permanence}
the morphism $f$ is a local complete intersection morphism.
Thus the statement on the different follows from the
corresponding statement on the K\"ahler different by
Lemma \ref{lemma-different-syntomic-quasi-finite}.
Finally, since we have the exact sequence
$$
f^*\Omega_{X/S} \xrightarrow{\text{d}f} \Omega_{X/S} \to \Omega_{Y/X} \to 0
$$
by Morphisms, Lemma \ref{morphisms-lemma-triangle-differentials}
and since $\Omega_{X/S}$ and $\Omega_{Y/S}$ are finite locally free
of rank $n$ (Morphisms, Lemma
\ref{morphisms-lemma-smooth-omega-finite-locally-free}),
the statement for the K\"ahler different is clear from the definition
of the zeroth fitting ideal. If $f$ is \'etale at the associated
points of $Y$, then $\wedge^n\text{d}f$ does not vanish in
the associated points of $Y$, which implies that the local equation
of $R$ is a nonzerodivisor. Hence $R$ is an effective Cartier divisor.
The canonical isomorphism sends $1$ to $\wedge^n\text{d}f$, see
Divisors, Lemma \ref{divisors-lemma-characterize-OD}.
\end{proof}






\section{The Tate map}
\label{section-tate-map}

\noindent
In this section we produce an isomorphism between
the determinant of the relative cotangent complex and
the relative dualizing module for a locally quasi-finite
syntomic morphism of locally Noetherian schemes. Following
\cite[1.4.4]{Garel} we dub the isomorphism the Tate map.
Our approach is to avoid doing local calculations as
much as is possible.

\medskip\noindent
Let $Y \to X$ be a locally quasi-finite syntomic morphism of schemes.
We will use all the equivalent conditions for this notion given in
Lemma \ref{lemma-syntomic-quasi-finite} without further mention in
this section. In particular, we see that $\NL_{Y/X}$ is a perfect
object of $D(\mathcal{O}_Y)$ with tor-amplitude in $[-1, 0]$. Thus
we have a canonical invertible module
$\det(\NL_{Y/X})$ on $Y$ and a global section
$$
\delta(\NL_{Y/X}) \in \Gamma(Y, \det(\NL_{Y/X}))
$$
See Derived Categories of Schemes, Lemma
\ref{perfect-lemma-determinant-two-term-complexes}.
Suppose given a commutative diagram of schemes
$$
\xymatrix{
Y' \ar[r]_b \ar[d] & Y \ar[d] \\
X' \ar[r] & X
}
$$
whose vertical arrows are locally quasi-finite syntomic and which
induces an isomorphism of $Y'$ with an open of $X' \times_X Y$.
Then the canonical map
$$
Lb^*\NL_{Y/X} \longrightarrow \NL_{Y'/X'}
$$
is a quasi-isomorphism by
More on Morphisms, Lemma \ref{more-morphisms-lemma-base-change-NL-flat}.
Thus we get a canonical isomorphism
$b^*\det(\NL_{Y/X}) \to \det(\NL_{Y'/X'})$ which sends the
canonical section $\delta(\NL_{Y/X})$ to $\delta(\NL_{Y'/ X'})$, see
Derived Categories of Schemes, Remark \ref{perfect-remark-functorial-det}.

\begin{remark}
\label{remark-local-description-delta}
Let $Y \to X$ be a locally quasi-finite syntomic morphism of schemes.
What does the pair $(\det(\NL_{Y/X}), \delta(\NL_{Y/X}))$ look
like locally? Choose affine opens $V = \Spec(B) \subset Y$,
$U = \Spec(A) \subset X$ with $f(V) \subset U$ and an integer $n$ and
$f_1, \ldots, f_n \in A[x_1, \ldots, x_n]$ such that
$B = A[x_1, \ldots, x_n]/(f_1, \ldots, f_n)$. Then
$$
\NL_{B/A} = \left(
(f_1, \ldots, f_n)/(f_1, \ldots, f_n)^2
\longrightarrow
\bigoplus\nolimits_{i = 1, \ldots, n} B \text{d} x_i\right)
$$
and $(f_1, \ldots, f_n)/(f_1, \ldots, f_n)^2$ is free with generators
the classes $\overline{f}_i$. See proof of
Lemma \ref{lemma-syntomic-quasi-finite}.
Thus $\det(L_{B/A})$ is free on the generator
$$
\text{d}x_1 \wedge \ldots \wedge \text{d}x_n
\otimes
(\overline{f}_1 \wedge \ldots \wedge \overline{f}_n)^{\otimes -1}
$$
and the section $\delta(\NL_{B/A})$ is the element
$$
\delta(\NL_{B/A}) =
\det(\partial f_j/ \partial x_i) \cdot
\text{d}x_1 \wedge \ldots \wedge \text{d}x_n
\otimes
(\overline{f}_1 \wedge \ldots \wedge \overline{f}_n)^{\otimes -1}
$$
by definition.
\end{remark}

\noindent
Let $Y \to X$ be a locally quasi-finite syntomic morphism of
locally Noetherian schemes. By
Remarks \ref{remark-relative-dualizing-for-quasi-finite} and
\ref{remark-relative-dualizing-for-flat-quasi-finite} we have
a coherent $\mathcal{O}_Y$-module $\omega_{Y/X}$ and a canonical
global section
$$
\tau_{Y/X} \in \Gamma(Y, \omega_{Y/X})
$$
which affine locally recovers the pair $\omega_{B/A}, \tau_{B/A}$.
By Lemma \ref{lemma-dualizing-syntomic-quasi-finite} the module
$\omega_{Y/X}$ is invertible. Suppose given a commutative diagram of
locally Noetherian schemes
$$
\xymatrix{
Y' \ar[r]_b \ar[d] & Y \ar[d] \\
X' \ar[r] & X
}
$$
whose vertical arrows are locally quasi-finite syntomic and which
induces an isomorphism of $Y'$ with an open of $X' \times_X Y$.
Then there is a canonical base change map
$$
b^*\omega_{Y/X} \longrightarrow \omega_{Y'/X'}
$$
which is an isomorphism
mapping $\tau_{Y/X}$ to $\tau_{Y'/X'}$. Namely, the base change map
in the affine setting is (\ref{equation-bc-dualizing}), it is an
isomorphism by Lemma \ref{lemma-dualizing-base-change-of-flat}, and it
maps $\tau_{Y/X}$ to $\tau_{Y'/X'}$ by
Lemma \ref{lemma-trace-base-change} part (1).

\begin{proposition}
\label{proposition-tate-map}
There exists a unique rule that to every locally quasi-finite syntomic
morphism of locally Noetherian schemes $Y \to X$ assigns an isomorphism
$$
c_{Y/X} : \det(\NL_{Y/X}) \longrightarrow \omega_{Y/X}
$$
satisfying the following two properties
\begin{enumerate}
\item the section $\delta(\NL_{Y/X})$ is mapped to $\tau_{Y/X}$, and
\item the rule is compatible with restriction to opens and with
base change.
\end{enumerate}
\end{proposition}

\begin{proof}
Let us reformulate the statement of the proposition. Consider the category
$\mathcal{C}$ whose objects, denoted $Y/X$, are locally quasi-finite syntomic
morphism $Y \to X$ of locally Noetherian schemes and whose morphisms
$b/a : Y'/X' \to Y/X$ are commutative diagrams
$$
\xymatrix{
Y' \ar[d] \ar[r]_b & Y \ar[d] \\
X' \ar[r]^a & X
}
$$
which induce an isomorphism of $Y'$ with an open subscheme of
$X' \times_X Y$. The proposition means that for every object
$Y/X$ of $\mathcal{C}$ we have an isomorphism
$c_{Y/X} : \det(\NL_{Y/X}) \to \omega_{Y/X}$
with $c_{Y/X}(\delta(\NL_{Y/X})) = \tau_{Y/X}$
and for every morphism $b/a : Y'/X' \to Y/X$ of $\mathcal{C}$ we have
$b^*c_{Y/X} = c_{Y'/X'}$ via the identifications
$b^*\det(\NL_{Y/X}) = \det(\NL_{Y'/X'})$ and
$b^*\omega_{Y/X} = \omega_{Y'/X'}$ described above.

\medskip\noindent
Given $Y/X$ in $\mathcal{C}$ and $y \in Y$ we can find
an affine open $V \subset Y$ and $U \subset X$ with $f(V) \subset U$
such that there exists some isomorphism
$$
\det(\NL_{Y/X})|_V \longrightarrow \omega_{Y/X}|_V
$$
mapping $\delta(\NL_{Y/X})|_V$ to $\tau_{Y/X}|_V$. This follows
from picking affine opens as in
Lemma \ref{lemma-syntomic-quasi-finite} part (5), the affine
local description of $\delta(\NL_{Y/X})$ in
Remark \ref{remark-local-description-delta}, and
Lemma \ref{lemma-different-quasi-finite-complete-intersection}.
If the annihilator of the section $\tau_{Y/X}$ is zero, then
these local maps are unique and automatically glue. Hence if the annihilator
of $\tau_{Y/X}$ is zero, then there is a unique isomorphism
$c_{Y/X} : \det(\NL_{Y/X}) \to \omega_{Y/X}$ with
$c_{Y/X}(\delta(\NL_{Y/X})) = \tau_{Y/X}$.
If $b/a : Y'/X' \to Y/X$ is a morphism of $\mathcal{C}$
and the annihilator of $\tau_{Y'/X'}$ is zero as well,
then $b^*c_{Y/X}$ is the unique isomorphism
$c_{Y'/X'} : \det(\NL_{Y'/X'}) \to \omega_{Y'/X'}$ with
$c_{Y'/X'}(\delta(\NL_{Y'/X'})) = \tau_{Y'/X'}$.
This follows formally from the fact that
$b^*\delta(\NL_{Y/X}) = \delta(\NL_{Y'/X'})$ and
$b^*\tau_{Y/X} = \tau_{Y'/X'}$.

\medskip\noindent
We can summarize the results of the previous paragraph as follows.
Let $\mathcal{C}_{nice} \subset \mathcal{C}$ denote the
full subcategory of $Y/X$ such that the annihilator of
$\tau_{Y/X}$ is zero. Then we have solved the problem
on $\mathcal{C}_{nice}$. For $Y/X$ in $\mathcal{C}_{nice}$
we continue to denote $c_{Y/X}$ the solution we've just found.

\medskip\noindent
Consider morphisms
$$
Y_1/X_1 \xleftarrow{b_1/a_1} Y/X \xrightarrow{b_2/a_2} Y_2/X_2
$$
in $\mathcal{C}$ such that $Y_1/X_1$ and $Y_2/X_2$ are objects
of $\mathcal{C}_{nice}$. {\bf Claim.} $b_1^*c_{Y_1/X_1} = b_2^*c_{Y_2/X_2}$.
We will first show that the claim implies the proposition
and then we will prove the claim.

\medskip\noindent
Let $d, n \geq 1$ and consider the locally
quasi-finite syntomic morphism $Y_{n, d} \to X_{n, d}$
constructed in Example \ref{example-universal-quasi-finite-syntomic}.
Then $Y_{n, d}$ is an irreducible regular scheme and the
morphism $Y_{n, d} \to X_{n, d}$ is locally quasi-finite syntomic
and \'etale over a dense open, see
Lemma \ref{lemma-universal-quasi-finite-syntomic-etale}.
Thus $\tau_{Y_{n, d}/X_{n, d}}$ is nonzero for example by
Lemma \ref{lemma-different-ramification}. Now a nonzero section
of an invertible module over an irreducible regular scheme
has vanishing annihilator. Thus
$Y_{n, d}/X_{n, d}$ is an object of $\mathcal{C}_{nice}$.

\medskip\noindent
Let $Y/X$ be an arbitrary object of $\mathcal{C}$. Let $y \in Y$.
By Lemma \ref{lemma-locally-comes-from-universal} we can find
$n, d \geq 1$ and morphisms
$$
Y/X \leftarrow V/U \xrightarrow{b/a} Y_{n, d}/X_{n, d}
$$
of $\mathcal{C}$ such that $V \subset Y$ and $U \subset X$ are open.
Thus we can pullback the canonical morphism $c_{Y_{n, d}/X_{n, d}}$
constructed above by $b$ to $V$. The claim guarantees these local
isomorphisms glue! Thus we get a well defined global isomorphism
$c_{Y/X} : \det(\NL_{Y/X}) \to \omega_{Y/X}$ with
$c_{Y/X}(\delta(\NL_{Y/X})) = \tau_{Y/X}$.
If $b/a : Y'/X' \to Y/X$ is a morphism of $\mathcal{C}$, then
the claim also implies that the similarly constructed map
$c_{Y'/X'}$ is the pullback by $b$ of the locally constructed
map $c_{Y/X}$. Thus it remains to prove the claim.

\medskip\noindent
In the rest of the proof we prove the claim. We may pick a point
$y \in Y$ and prove the maps agree in an open neighbourhood of $y$.
Thus we may replace $Y_1$, $Y_2$ by open neighbourhoods of the
image of $y$ in $Y_1$ and $Y_2$. Thus we may assume there are
morphisms
$$
Y_{n_1, d_1}/X_{n_1, d_1} \leftarrow Y_1/X_1
\quad\text{and}\quad
Y_2/X_2 \rightarrow Y_{n_2, d_2}/X_{n_2, d_2}
$$
These are morphisms of $\mathcal{C}_{nice}$ for which we know the
desired compatibilities. Thus we may replace
$Y_1/X_1$ by $Y_{n_1, d_1}/X_{n_1, d_1}$ and
$Y_2/X_2$ by $Y_{n_2, d_2}/X_{n_2, d_2}$. This reduces us to the
case that $Y_1, X_1, Y_2, X_2$ are of finite type over $\mathbf{Z}$.
(The astute reader will realize that this step wouldn't have been
necessary if we'd defined $\mathcal{C}_{nice}$ to consist only
of those objects $Y/X$ with $Y$ and $X$ of finite type over $\mathbf{Z}$.)

\medskip\noindent
Assume $Y_1, X_1, Y_2, X_2$ are of finite type over $\mathbf{Z}$.
After replacing $Y, X, Y_1, X_1, Y_2, X_2$ by suitable open neighbourhoods
of the image of $y$ we may assume $Y, X, Y_1, X_1, Y_2, X_2$ are affine.
We may write $X = \lim X_\lambda$ as a cofiltered limit of affine
schemes of finite type over $X_1 \times X_2$. For each $\lambda$
we get
$$
Y_1 \times_{X_1} X_\lambda
\quad\text{and}\quad
X_\lambda \times_{X_2} Y_2
$$
If we take limits we obtain
$$
\lim Y_1 \times_{X_1} X_\lambda =
Y_1 \times_{X_1} X \supset Y \subset
X \times_{X_2} Y_2 = \lim X_\lambda \times_{X_2} Y_2
$$
By Limits, Lemma \ref{limits-lemma-descend-opens}
we can find a $\lambda$ and opens
$V_{1, \lambda} \subset Y_1 \times_{X_1} X_\lambda$ and
$V_{2, \lambda} \subset X_\lambda \times_{X_2} Y_2$
whose base change to $X$ recovers $Y$ (on both sides).
After increasing $\lambda$ we may assume
there is an isomorphism
$V_{1, \lambda} \to V_{2, \lambda}$ whose base change to $X$ is the
identity on $Y$, see
Limits, Lemma \ref{limits-lemma-descend-finite-presentation}.
Then we have the commutative diagram
$$
\xymatrix{
& Y/X \ar[d] \ar[ld]_{b_1/a_1} \ar[rd]^{b_2/a_2} \\
Y_1/X_1 & V_{1, \lambda}/X_\lambda \ar[l] \ar[r] & Y_2/X_2
}
$$
Thus it suffices to prove the claim for the lower row
of the diagram and we reduce to the case discussed in the
next paragraph.

\medskip\noindent
Assume $Y, X, Y_1, X_1, Y_2, X_2$ are affine of finite type over $\mathbf{Z}$.
Write $X = \Spec(A)$, $X_i = \Spec(A_i)$. The ring map $A_1 \to A$ corresponding
to $X \to X_1$ is of finite type and hence we may choose a surjection
$A_1[x_1, \ldots, x_n] \to A$. Similarly, we may choose a surjection
$A_2[y_1, \ldots, y_m] \to A$. Set $X'_1 = \Spec(A_1[x_1, \ldots, x_n])$
and $X'_2 = \Spec(A_2[y_1, \ldots, y_m])$.
Set $Y'_1 = Y_1 \times_{X_1} X'_1$ and $Y'_2 = Y_2 \times_{X_2} X'_2$.
We get the following diagram
$$
Y_1/X_1 \leftarrow
Y'_1/X'_1 \leftarrow
Y/X
\rightarrow Y'_2/X'_2
\rightarrow Y_2/X_2
$$
Since $X'_1 \to X_1$ and $X'_2 \to X_2$ are flat, the same is true
for $Y'_1 \to Y_1$ and $Y'_2 \to Y_2$. It follows easily that the
annihilators of $\tau_{Y'_1/X'_1}$ and $\tau_{Y'_2/X'_2}$ are zero.
Hence $Y'_1/X'_1$ and $Y'_2/X'_2$ are in $\mathcal{C}_{nice}$.
Thus the outer morphisms in the displayed diagram are morphisms
of $\mathcal{C}_{nice}$ for which we know the desired compatibilities.
Thus it suffices to prove the claim for
$Y'_1/X'_1 \leftarrow Y/X \rightarrow Y'_2/X'_2$. This reduces us
to the case discussed in the next paragraph.

\medskip\noindent
Assume $Y, X, Y_1, X_1, Y_2, X_2$ are affine of finite type over
$\mathbf{Z}$ and $X \to X_1$ and $X \to X_2$ are closed immersions.
Consider the open embeddings
$Y_1 \times_{X_1} X \supset Y \subset X \times_{X_2} Y_2$.
There is an open neighbourhood $V \subset Y$ of $y$ which is a
standard open of both $Y_1 \times_{X_1} X$ and $X \times_{X_2} Y_2$.
This follows from Schemes, Lemma \ref{schemes-lemma-standard-open-two-affines}
applied to the scheme obtained by glueing $Y_1 \times_{X_1} X$ and
$X \times_{X_2} Y_2$ along $Y$; details omitted.
Since $X \times_{X_2} Y_2$ is a closed subscheme of $Y_2$
we can find a standard open $V_2 \subset Y_2$ such that
$V_2 \times_{X_2} X = V$. Similarly, we can find a standard open
$V_1 \subset Y_1$ such that $V_1 \times_{X_1} X = V$.
After replacing $Y, Y_1, Y_2$ by $V, V_1, V_2$ we reduce to the
case discussed in the next paragraph.

\medskip\noindent
Assume $Y, X, Y_1, X_1, Y_2, X_2$ are affine of finite type over
$\mathbf{Z}$ and $X \to X_1$ and $X \to X_2$ are closed immersions
and $Y_1 \times_{X_1} X = Y = X \times_{X_2} Y_2$.
Write $X = \Spec(A)$, $X_i = \Spec(A_i)$, $Y = \Spec(B)$,
$Y_i = \Spec(B_i)$. Then we can consider the affine schemes
$$
X' = \Spec(A_1 \times_A A_2) = \Spec(A')
\quad\text{and}\quad
Y' = \Spec(B_1 \times_B B_2) = \Spec(B')
$$
Observe that $X' = X_1 \amalg_X X_2$ and $Y' = Y_1 \amalg_Y Y_2$, see
More on Morphisms, Lemma \ref{more-morphisms-lemma-basic-example-pushout}.
By More on Algebra, Lemma \ref{more-algebra-lemma-fibre-product-finite-type}
the rings $A'$ and $B'$ are of finite type over $\mathbf{Z}$. By
More on Algebra, Lemma \ref{more-algebra-lemma-module-over-fibre-product}
we have $B' \otimes_A A_1 = B_1$ and $B' \times_A A_2 = B_2$.
In particular a fibre of $Y' \to X'$ over a point of
$X' = X_1 \amalg_X X_2$ is always equal to either a fibre of $Y_1 \to X_1$
or a fibre of $Y_2 \to X_2$. By More on Algebra, Lemma
\ref{more-algebra-lemma-flat-module-over-fibre-product}
the ring map $A' \to B'$ is flat. Thus by
Lemma \ref{lemma-syntomic-quasi-finite} part (3)
we conclude that $Y'/X'$ is an object of $\mathcal{C}$.
Consider now the commutative diagram
$$
\xymatrix{
& Y/X \ar[ld]_{b_1/a_1} \ar[rd]^{b_2/a_2} \\
Y_1/X_1 \ar[rd] & & Y_2/X_2 \ar[ld] \\
& Y'/X'
}
$$
Now we would be done if $Y'/X'$ is an object of $\mathcal{C}_{nice}$.
Namely, then pulling back $c_{Y'/X'}$ around the two sides of the
square, we would obtain the desired conclusion. Now, in fact, it
is true that $Y'/X'$ is an object of
$\mathcal{C}_{nice}$\footnote{Namely, the structure
sheaf $\mathcal{O}_{Y'}$ is a subsheaf of
$(Y_1 \to Y')_*\mathcal{O}_{Y_1} \times (Y_2 \to Y')_*\mathcal{O}_{Y_2}$.}.
But it is amusing to note that we don't even need this.
Namely, the arguments above show that,
after possibly shrinking all of the schemes
$X, Y, X_1, Y_1, X_2, Y_2, X', Y'$ we can find some
$n, d \geq 1$, and extend the diagram like so:
$$
\xymatrix{
& Y/X \ar[ld]_{b_1/a_1} \ar[rd]^{b_2/a_2} \\
Y_1/X_1 \ar[rd] & & Y_2/X_2 \ar[ld] \\
& Y'/X' \ar[d] \\
& Y_{n, d}/X_{n, d}
}
$$
and then we can use the already given argument by pulling
back from $c_{Y_{n, d}/X_{n, d}}$. This finishes the proof.
\end{proof}













\section{A generalization of the different}
\label{section-different-generalization}

\noindent
In this section we generalize Definition \ref{definition-different}
to take into account all cases of ring maps $A \to B$
where the Dedekind different is defined and $1 \in \mathcal{L}_{B/A}$.
First we explain the condition ``$A \to B$ maps nonzerodivisors to
nonzerodivisors and induces a flat map $Q(A) \to Q(A) \otimes_A B$''.

\begin{lemma}
\label{lemma-explain-condition}
Let $A \to B$ be a map of Noetherian rings. Consider the conditions
\begin{enumerate}
\item nonzerodivisors of $A$ map to nonzerodivisors of $B$,
\item (1) holds and $Q(A) \to Q(A) \otimes_A B$ is flat,
\item $A \to B_\mathfrak q$ is flat for every
$\mathfrak q \in \text{Ass}(B)$,
\item (3) holds and $A \to B_\mathfrak q$ is flat for every $\mathfrak q$
lying over an element in $\text{Ass}(A)$.
\end{enumerate}
Then we have the following implications
$$
\xymatrix{
(1) & (2) \ar@{=>}[l] \ar@{=>}[d] \\
(3) \ar@{=>}[u] & (4) \ar@{=>}[l]
}
$$
If going up holds for $A \to B$ then (2) and (4) are equivalent.
\end{lemma}

\begin{proof}
The horizontal implications in the diagram are trivial.
Let $S \subset A$ be the set of nonzerodivisors so that
$Q(A) = S^{-1}A$ and $Q(A) \otimes_A B = S^{-1}B$. Recall that
$S = A \setminus \bigcup_{\mathfrak p \in \text{Ass}(A)} \mathfrak p$
by Algebra, Lemma \ref{algebra-lemma-ass-zero-divisors}.
Let $\mathfrak q \subset B$ be a prime lying over $\mathfrak p \subset A$.

\medskip\noindent
Assume (2). If $\mathfrak q \in \text{Ass}(B)$ then
$\mathfrak q$ consists of zerodivisors, hence (1) implies
the same is true for $\mathfrak p$. Hence
$\mathfrak p$ corresponds to a prime of $S^{-1}A$.
Hence $A \to B_\mathfrak q$ is flat by our assumption (2).
If $\mathfrak q$ lies over an associated prime $\mathfrak p$
of $A$, then certainly $\mathfrak p \in \Spec(S^{-1}A)$ and the
same argument works.

\medskip\noindent
Assume (3). Let $f \in A$ be a nonzerodivisor. If $f$ were a zerodivisor
on $B$, then $f$ is contained in an associated prime $\mathfrak q$
of $B$. Since $A \to B_\mathfrak q$ is flat by assumption, we conclude that
$\mathfrak p$ is an associated prime of $A$ by
Algebra, Lemma \ref{algebra-lemma-bourbaki}. This would imply that
$f$ is a zerodivisor on $A$, a contradiction.

\medskip\noindent
Assume (4) and going up for $A \to B$. We already know (1) holds.
If $\mathfrak q$ corresponds to a prime of $S^{-1}B$ then $\mathfrak p$
is contained in an associated prime $\mathfrak p'$ of $A$. By going up
there exists a prime $\mathfrak q'$ containing $\mathfrak q$ and lying
over $\mathfrak p$. Then $A \to B_{\mathfrak q'}$ is flat by
(4). Hence $A \to B_{\mathfrak q}$ is flat as a localization.
Thus $A \to S^{-1}B$ is flat and so is $S^{-1}A \to S^{-1}B$, see
Algebra, Lemma \ref{algebra-lemma-flat-localization}.
\end{proof}

\begin{remark}
\label{remark-different-generalization}
We can generalize Definition \ref{definition-different}.
Suppose that $f : Y \to X$ is a quasi-finite morphism of Noetherian schemes
with the following properties
\begin{enumerate}
\item the open $V \subset Y$ where $f$ is flat contains
$\text{Ass}(\mathcal{O}_Y)$ and $f^{-1}(\text{Ass}(\mathcal{O}_X))$,
\item the trace element $\tau_{V/X}$ comes from a section
$\tau \in \Gamma(Y, \omega_{Y/X})$.
\end{enumerate}
Condition (1) implies that $V$ contains the associated points of
$\omega_{Y/X}$ by Lemma \ref{lemma-dualizing-associated-primes}.
In particular, $\tau$ is unique if it exists
(Divisors, Lemma \ref{divisors-lemma-restriction-injective-open-contains-ass}).
Given $\tau$ we can define the different $\mathfrak{D}_f$ as the annihilator of
$\Coker(\tau : \mathcal{O}_Y \to \omega_{Y/X})$. This agrees with the
Dedekind different in many cases (Lemma \ref{lemma-agree-dedekind}).
However, for non-flat maps between non-normal rings, this generalization
no longer measures ramification of the morphism, see
Example \ref{example-no-different}.
\end{remark}

\begin{lemma}
\label{lemma-agree-dedekind}
Assume the Dedekind different is defined for $A \to B$.
Set $X = \Spec(A)$ and $Y = \Spec(B)$. The generalization of
Remark \ref{remark-different-generalization}
applies to the morphism $f : Y \to X$ if and only if
$1 \in \mathcal{L}_{B/A}$ (e.g., if $A$ is normal, see
Lemma \ref{lemma-dedekind-different-ideal}).
In this case $\mathfrak{D}_{B/A}$ is an ideal of $B$ and we have
$$
\mathfrak{D}_f = \widetilde{\mathfrak{D}_{B/A}}
$$
as coherent ideal sheaves on $Y$.
\end{lemma}

\begin{proof}
As the Dedekind different for $A \to B$ is defined we can apply
Lemma \ref{lemma-explain-condition} to see that
$Y \to X$ satisfies condition (1) of
Remark \ref{remark-different-generalization}.
Recall that there is a canonical isomorphism
$c : \mathcal{L}_{B/A} \to \omega_{B/A}$, see
Lemma \ref{lemma-dedekind-complementary-module}.
Let $K = Q(A)$ and $L = K \otimes_A B$ as above.
By construction the map $c$ fits into a commutative diagram
$$
\xymatrix{
\mathcal{L}_{B/A} \ar[r] \ar[d]_c & L \ar[d] \\
\omega_{B/A} \ar[r] & \Hom_K(L, K)
}
$$
where the right vertical arrow sends $x \in L$ to the map
$y \mapsto \text{Trace}_{L/K}(xy)$ and the lower horizontal
arrow is the base change map (\ref{equation-bc-dualizing}) for $\omega_{B/A}$.
We can factor the lower horizontal map as
$$
\omega_{B/A} = \Gamma(Y, \omega_{Y/X})
\to \Gamma(V, \omega_{V/X}) \to \Hom_K(L, K)
$$
Since all associated points of $\omega_{V/X}$
map to associated primes of $A$
(Lemma \ref{lemma-dualizing-associated-primes})
we see that the second map is injective.
The element $\tau_{V/X}$ maps to $\text{Trace}_{L/K}$ in
$\Hom_K(L, K)$ by the very definition of trace elements
(Definition \ref{definition-trace-element}).
Thus $\tau$ as in condition (2) of
Remark \ref{remark-different-generalization}
exists if and only if $1 \in \mathcal{L}_{B/A}$ and then
$\tau = c(1)$. In this case, by Lemma \ref{lemma-dedekind-different-ideal}
we see that $\mathfrak{D}_{B/A} \subset B$.
Finally, the agreement of $\mathfrak{D}_f$ with $\mathfrak{D}_{B/A}$
is immediate from the definitions and the fact $\tau = c(1)$ seen above.
\end{proof}

\begin{example}
\label{example-no-different}
Let $k$ be a field. Let $A = k[x, y]/(xy)$ and $B = k[u, v]/(uv)$ and let
$A \to B$ be given by $x \mapsto u^n$ and $y \mapsto v^m$ for some
$n, m \in \mathbf{N}$ prime to the characteristic of $k$. Then
$A_{x + y} \to B_{x + y}$ is (finite) \'etale hence we are in the situation
where the Dedekind different is defined. A computation shows that
$$
\text{Trace}_{L/K}(1) = (nx + my)/(x + y),\quad
\text{Trace}_{L/K}(u^i) = 0,\quad \text{Trace}_{L/K}(v^j) = 0
$$
for $1 \leq i < n$ and $1 \leq j < m$. We conclude that
$1 \in \mathcal{L}_{B/A}$ if and only if $n = m$. Moreover, a
computation shows that if $n = m$, then $\mathcal{L}_{B/A} = B$
and the Dedekind different is $B$ as well. In other words, we find that
the different of Remark \ref{remark-different-generalization}
is defined for $\Spec(B) \to \Spec(A)$
if and only if $n = m$, and in this case the different is the
unit ideal. Thus we see that in nonflat cases the nonvanishing
of the different does not guarantee the morphism is \'etale or unramified.
\end{example}







\section{Comparison with duality theory}
\label{section-comparison}

\noindent
In this section we compare the elementary algebraic constructions
above with the constructions in the chapter on duality theory
for schemes.

\begin{lemma}
\label{lemma-compare-dualizing}
Let $f : Y \to X$ be a quasi-finite separated morphism of Noetherian schemes.
For every pair of affine opens $\Spec(B) = V \subset Y$,
$\Spec(A) = U \subset X$ with $f(V) \subset U$ there is an isomorphism
$$
H^0(V, f^!\mathcal{O}_Y) = \omega_{B/A}
$$
where $f^!$ is as in
Duality for Schemes, Section \ref{duality-section-upper-shriek}.
These isomorphisms are compatible with restriction maps and define a canonical
isomorphism $H^0(f^!\mathcal{O}_X) = \omega_{Y/X}$ with
$\omega_{Y/X}$ as in Remark \ref{remark-relative-dualizing-for-quasi-finite}.
Similarly, if $f : Y \to X$ is a quasi-finite morphism of schemes of
finite type over a Noetherian base $S$ endowed with a dualizing complex
$\omega_S^\bullet$, then $H^0(f_{new}^!\mathcal{O}_X) = \omega_{Y/X}$.
\end{lemma}

\begin{proof}
By Zariski's main theorem we can choose a factorization $f = f' \circ j$
where $j : Y \to Y'$ is an open immersion and $f' : Y' \to X$ is a finite
morphism, see More on Morphisms, Lemma
\ref{more-morphisms-lemma-quasi-finite-separated-pass-through-finite}.
By our construction in
Duality for Schemes, Lemma \ref{duality-lemma-shriek-well-defined} we have
$f^! = j^* \circ a'$ where
$a' : D_\QCoh(\mathcal{O}_X) \to D_\QCoh(\mathcal{O}_{Y'})$
is the right adjoint to $Rf'_*$ of
Duality for Schemes, Lemma \ref{duality-lemma-twisted-inverse-image}.
By Duality for Schemes, Lemma \ref{duality-lemma-finite-twisted}
we see that
$\Phi(a'(\mathcal{O}_X)) = R\SheafHom(f'_*\mathcal{O}_{Y'}, \mathcal{O}_X)$ in
$D_\QCoh^+(f'_*\mathcal{O}_{Y'})$. In particular $a'(\mathcal{O}_X)$ has
vanishing cohomology sheaves in degrees $< 0$. The zeroth cohomology sheaf
is determined by the isomorphism
$$
f'_*H^0(a'(\mathcal{O}_X)) =
\SheafHom_{\mathcal{O}_X}(f'_*\mathcal{O}_{Y'}, \mathcal{O}_X)
$$
as $f'_*\mathcal{O}_{Y'}$-modules via the equivalence of
Morphisms, Lemma \ref{morphisms-lemma-affine-equivalence-modules}.
Writing $(f')^{-1}U = V' = \Spec(B')$, we obtain
$$
H^0(V', a'(\mathcal{O}_X)) = \Hom_A(B', A).
$$
As the zeroth cohomology sheaf of $a'(\mathcal{O}_X)$
is a quasi-coherent module we find that
the restriction to $V$ is given by
$\omega_{B/A} = \Hom_A(B', A) \otimes_{B'} B$ as desired.

\medskip\noindent
The statement about restriction maps signifies that the restriction mappings
of the quasi-coherent $\mathcal{O}_{Y'}$-module $H^0(a'(\mathcal{O}_X))$
for opens in $Y'$ agrees with the maps defined in
Lemma \ref{lemma-localize-dualizing}
for the modules $\omega_{B/A}$ via the isomorphisms given above.
This is clear.

\medskip\noindent
Let $f : Y \to X$ be a quasi-finite morphism of schemes of finite type
over a Noetherian base $S$ endowed with a dualizing complex $\omega_S^\bullet$.
Consider opens $V \subset Y$ and $U \subset X$ with $f(V) \subset U$
and $V$ and $U$ separated over $S$. Denote $f|_V : V \to U$ the restriction
of $f$. By the discussion above and
Duality for Schemes, Lemma \ref{duality-lemma-duality-bootstrap}
there are canonical isomorphisms
$$
H^0(f_{new}^!\mathcal{O}_X)|_V = H^0((f|_V)^!\mathcal{O}_U) = \omega_{V/U} =
\omega_{Y/X}|_V
$$
We omit the verification that these isomorphisms glue to a global
isomorphism $H^0(f_{new}^!\mathcal{O}_X) \to \omega_{Y/X}$.
\end{proof}

\begin{lemma}
\label{lemma-compare-trace}
Let $f : Y \to X$ be a finite flat morphism of Noetherian schemes.
The map
$$
\text{Trace}_f : f_*\mathcal{O}_Y \longrightarrow \mathcal{O}_X
$$
of Section \ref{section-discriminant}
corresponds to a map $\mathcal{O}_Y \to f^!\mathcal{O}_X$ (see proof).
Denote $\tau_{Y/X} \in H^0(Y, f^!\mathcal{O}_X)$ the image of $1$.
Via the isomorphism $H^0(f^!\mathcal{O}_X) = \omega_{X/Y}$ of
Lemma \ref{lemma-compare-dualizing}
this agrees with the construction in
Remark \ref{remark-relative-dualizing-for-flat-quasi-finite}.
\end{lemma}

\begin{proof}
The functor $f^!$ is defined in 
Duality for Schemes, Section \ref{duality-section-upper-shriek}.
Since $f$ is finite (and hence proper), we see that $f^!$ is given by
the right adjoint to pushforward for $f$. In
Duality for Schemes, Section \ref{duality-section-duality-finite}
we have made this adjoint explicit. In particular,
the object $f^!\mathcal{O}_X$ consists of a single
cohomology sheaf placed in degree $0$ and for this sheaf we have
$$
f_*f^!\mathcal{O}_X =
\SheafHom_{\mathcal{O}_X}(f_*\mathcal{O}_Y, \mathcal{O}_X)
$$
To see this we use also that $f_*\mathcal{O}_Y$ is finite locally free
as $f$ is a finite flat morphism of Noetherian schemes
and hence all higher Ext sheaves are zero. Some details omitted.
Thus finally
$$
\text{Trace}_f \in
\Hom_{\mathcal{O}_X}(f_*\mathcal{O}_Y, \mathcal{O}_X) =
\Gamma(X, f_*f^!\mathcal{O}_X) =
\Gamma(Y, f^!\mathcal{O}_X)
$$
On the other hand, we have $f^!\mathcal{O}_X = \omega_{Y/X}$
by the identification of Lemma \ref{lemma-compare-dualizing}.
Thus we now have two elements, namely $\text{Trace}_f$
and $\tau_{Y/X}$ from
Remark \ref{remark-relative-dualizing-for-flat-quasi-finite} in
$$
\Gamma(Y, f^!\mathcal{O}_X) = \Gamma(Y, \omega_{Y/X})
$$
and the lemma says these elements are the same.

\medskip\noindent
Let $U = \Spec(A) \subset X$ be an affine open with inverse image
$V = \Spec(B) \subset Y$. Since $f$ is finite, we see that
$A \to B$ is finite and hence the $\omega_{Y/X}(V) = \Hom_A(B,A)$
by construction and this isomorphism agrees with the identification
of $f_*f^!\mathcal{O}_Y$ with
$\SheafHom_{\mathcal{O}_X}(f_*\mathcal{O}_Y, \mathcal{O}_X)$ discussed
above. Hence the agreement of $\text{Trace}_f$ and $\tau_{Y/X}$
follows from the fact that $\tau_{B/A} = \text{Trace}_{B/A}$
by Lemma \ref{lemma-finite-flat-trace}.
\end{proof}








\section{Quasi-finite Gorenstein morphisms}
\label{section-gorenstein-lci}

\noindent
This section discusses quasi-finite Gorenstein morphisms.

\begin{lemma}
\label{lemma-gorenstein-quasi-finite}
Let $f : Y \to X$ be a quasi-finite morphism of Noetherian schemes.
The following are equivalent
\begin{enumerate}
\item $f$ is Gorenstein,
\item $f$ is flat and the fibres of $f$ are Gorenstein,
\item $f$ is flat and $\omega_{Y/X}$ is invertible
(Remark \ref{remark-relative-dualizing-for-quasi-finite}),
\item for every $y \in Y$ there are affine opens
$y \in V = \Spec(B) \subset Y$, $U = \Spec(A) \subset X$
with $f(V) \subset U$ such that $A \to B$ is flat
and $\omega_{B/A}$ is an invertible $B$-module.
\end{enumerate}
\end{lemma}

\begin{proof}
Parts (1) and (2) are equivalent by definition. Parts (3) and (4)
are equivalent by the construction of $\omega_{Y/X}$ in
Remark \ref{remark-relative-dualizing-for-quasi-finite}.
Thus we have to show that (1)-(2) is equivalent to (3)-(4).

\medskip\noindent
First proof. Working affine locally we can assume $f$ is a separated
morphism and apply Lemma \ref{lemma-compare-dualizing} to see that
$\omega_{Y/X}$ is the zeroth cohomology sheaf of $f^!\mathcal{O}_X$.
Under both assumptions $f$ is flat and quasi-finite, hence
$f^!\mathcal{O}_X$ is isomorphic to $\omega_{Y/X}[0]$, see
Duality for Schemes, Lemma \ref{duality-lemma-flat-quasi-finite-shriek}. Hence
the equivalence follows from
Duality for Schemes, Lemma
\ref{duality-lemma-affine-flat-Noetherian-gorenstein}.

\medskip\noindent
Second proof. By Lemma \ref{lemma-characterize-invertible},
we see that it suffices to prove the equivalence of
(2) and (3) when $X$ is the spectrum of a field $k$.
Then $Y = \Spec(B)$ where $B$ is a finite $k$-algebra.
In this case $\omega_{B/A} = \omega_{B/k} = \Hom_k(B, k)$
placed in degree $0$ is a dualizing complex for $B$, see
Dualizing Complexes, Lemma \ref{dualizing-lemma-dualizing-finite}.
Thus the equivalence follows from
Dualizing Complexes, Lemma \ref{dualizing-lemma-gorenstein}.
\end{proof}

\begin{remark}
\label{remark-collect-results-qf-gorenstein}
Let $f : Y \to X$ be a quasi-finite Gorenstein morphism of Noetherian schemes.
Let $\mathfrak D_f \subset \mathcal{O}_Y$ be the different and let
$R \subset Y$ be the closed subscheme cut out by $\mathfrak D_f$.
Then we have
\begin{enumerate}
\item $\mathfrak D_f$ is a locally principal ideal,
\item $R$ is a locally principal closed subscheme,
\item $\mathfrak D_f$ is affine locally the same as the Noether different,
\item formation of $R$ commutes with base change,
\item if $f$ is finite, then the norm of $R$ is the discriminant of $f$, and
\item if $f$ is \'etale in the associated points of $Y$, then
$R$ is an effective Cartier divisor and $\omega_{Y/X} = \mathcal{O}_Y(R)$.
\end{enumerate}
This follows from Lemmas \ref{lemma-flat-gorenstein-agree-noether},
\ref{lemma-base-change-different}, and
\ref{lemma-norm-different-is-discriminant}.
\end{remark}

\begin{remark}
\label{remark-collect-results-qf-gorenstein-two}
Let $S$ be a Noetherian scheme endowed with a dualizing complex
$\omega_S^\bullet$. Let $f : Y \to X$ be a quasi-finite Gorenstein
morphism of compactifyable schemes over $S$. Assume moreover
$Y$ and $X$ Cohen-Macaulay and $f$ \'etale at the generic
points of $Y$. Then we can combine
Duality for Schemes, Remark
\ref{duality-remark-CM-morphism-compare-dualizing} and
Remark \ref{remark-collect-results-qf-gorenstein}
to see that we have a canonical isomorphism
$$
\omega_Y = f^*\omega_X \otimes_{\mathcal{O}_Y} \omega_{Y/X} =
f^*\omega_X \otimes_{\mathcal{O}_Y} \mathcal{O}_Y(R)
$$
of $\mathcal{O}_Y$-modules. If further $f$ is finite,
then the isomorphism $\mathcal{O}_Y(R) = \omega_{Y/X}$ comes
from the global section $\tau_{Y/X} \in H^0(Y, \omega_{Y/X})$
which corresponds via duality to the map
$\text{Trace}_f : f_*\mathcal{O}_Y \to \mathcal{O}_X$, see
Lemma \ref{lemma-compare-trace}.
\end{remark}






\input{chapters}

\bibliography{my}
\bibliographystyle{amsalpha}

\end{document}
