Lemma 48.25.11. Let $f : X \to S$ be a morphism of schemes which is flat and locally of finite presentation. Let $x \in X$ with image $s \in S$. Set $d = \dim _ x(X_ s)$. The following are equivalent

1. $f$ is Gorenstein at $x$,

2. there exists an open neighbourhood $U \subset X$ of $x$ and a locally quasi-finite morphism $U \to \mathbf{A}^ d_ S$ over $S$ which is Gorenstein at $x$,

3. there exists an open neighbourhood $U \subset X$ of $x$ and a locally quasi-finite Gorenstein morphism $U \to \mathbf{A}^ d_ S$ over $S$,

4. for any $S$-morphism $g : U \to \mathbf{A}^ d_ S$ of an open neighbourhood $U \subset X$ of $x$ we have: $g$ is quasi-finite at $x$ $\Rightarrow$ $g$ is Gorenstein at $x$.

In particular, the set of points where $f$ is Gorenstein is open in $X$.

Proof. Choose affine open $U = \mathop{\mathrm{Spec}}(A) \subset X$ with $x \in U$ and $V = \mathop{\mathrm{Spec}}(R) \subset S$ with $f(U) \subset V$. Then $R \to A$ is a flat ring map of finite presentation. Let $\mathfrak p \subset A$ be the prime ideal corresponding to $x$. After replacing $A$ by a principal localization we may assume there exists a quasi-finite map $R[x_1, \ldots , x_ d] \to A$, see Algebra, Lemma 10.125.2. Thus there exists at least one pair $(U, g)$ consisting of an open neighbourhood $U \subset X$ of $x$ and a locally1 quasi-finite morphism $g : U \to \mathbf{A}^ d_ S$.

Having said this, the lemma translates into the following algebra problem (translation omitted). Given $R \to A$ flat and of finite presentation, a prime $\mathfrak p \subset A$ and $\varphi : R[x_1, \ldots , x_ d] \to A$ quasi-finite at $\mathfrak p$ the following are equivalent

1. $\mathop{\mathrm{Spec}}(\varphi )$ is Gorenstein at $\mathfrak p$, and

2. $\mathop{\mathrm{Spec}}(A) \to \mathop{\mathrm{Spec}}(R)$ is Gorenstein at $\mathfrak p$.

3. $\mathop{\mathrm{Spec}}(A) \to \mathop{\mathrm{Spec}}(R)$ is Gorenstein in an open neighbourhood of $\mathfrak p$.

In each case $R[x_1, \ldots , x_ n] \to A$ is flat at $\mathfrak p$ hence by openness of flatness (Algebra, Theorem 10.129.4), we may assume $R[x_1, \ldots , x_ n] \to A$ is flat (replace $A$ by a suitable principal localization). By Algebra, Lemma 10.168.1 there exists $R_0 \subset R$ and $R_0[x_1, \ldots , x_ n] \to A_0$ such that $R_0$ is of finite type over $\mathbf{Z}$ and $R_0 \to A_0$ is of finite type and $R_0[x_1, \ldots , x_ n] \to A_0$ is flat. Note that the set of points where a flat finite type morphism is Gorenstein commutes with base change by Lemma 48.25.8. In this way we reduce to the case where $R$ is Noetherian.

Thus we may assume $X$ and $S$ affine and that we have a factorization of $f$ of the form

$X \xrightarrow {g} \mathbf{A}^ n_ S \xrightarrow {p} S$

with $g$ flat and quasi-finite and $S$ Noetherian. Then $X$ and $\mathbf{A}^ n_ S$ are separated over $S$ and we have

$f^!\mathcal{O}_ S = g^!p^!\mathcal{O}_ S = g^!\mathcal{O}_{\mathbf{A}^ n_ S}[n]$

by know properties of upper shriek functors (Lemmas 48.16.3 and 48.17.3). Hence the equivalence of (a), (b), and (c) by Lemma 48.25.10. $\square$

 If $S$ is quasi-separated, then $g$ will be quasi-finite.

In your comment you can use Markdown and LaTeX style mathematics (enclose it like $\pi$). A preview option is available if you wish to see how it works out (just click on the eye in the toolbar).