hcju/stacksqa huggingface dataset:
Condition (1) means there is an open subspace $X' \subset X$ such that $X' \to Y$ is smooth. Hence (1) implies conditions (2) and (3) by Lemma \ref{lemma-smooth-formally-smooth}. Condition (2) implies condition (3) trivially. Assume (3). Choose a commutative diagram $$ \xymatrix{ X \ar[d] & U \ar[l] \ar[d] \\ Y & V \ar[l] } $$ with $U$ and $V$ affine, horizontal arrows \'etale and such that there is a point $u \in U$ mapping to $x$. Next, consider a diagram $$ \xymatrix{ X \ar[d] & U \ar[l] \ar[d] & \Spec(B) \ar[d]^i \ar[l]^-\alpha  \\ Y & V \ar[l] & \Spec(B') \ar[l]_-{\beta} } $$ as in (3) but for $u \in U \to V$. Let $\gamma : \Spec(B') \to X$ be the arrow we get from our assumption that (3) holds for $X$. Because $U \to X$ is \'etale and hence formally \'etale (Lemma \ref{lemma-etale-formally-etale}) the morphism $\gamma$ has a unique lift to $U$ compatible with $\alpha$. Then because $V \to Y$ is \'etale hence formally \'etale this lift is compatible with $\beta$. Hence (3) holds for $u \in U \to V$ and we conclude that $U \to V$ is smooth at $u$ by More on Morphisms, Lemma \ref{more-morphisms-lemma-lifting-along-artinian-at-point}. This proves that $X \to Y$ is smooth at $x$, thereby finishing the proof.
If $f$ is smooth, then the infinitesimal lifting criterion (Lemma \ref{lemma-smooth-formally-smooth}) says $f$ is formally smooth and (2) holds. \medskip\noindent Assume $f$ is not smooth. The set of points $x \in X$ where $f$ is not smooth forms a closed subset $T$ of $|X|$. By Morphisms of Spaces, Lemma  \ref{spaces-morphisms-lemma-enough-finite-type-points}, there exists a point $x \in T \subset X$ with $x \in X_{\text{ft-pts}}$. Choose a commutative diagram $$ \xymatrix{ X \ar[d] & U \ar[l] \ar[d] & u \ar@{|->}[d] \\ Y & V \ar[l] & v } $$ with $U$ and $V$ affine, horizontal arrows \'etale and such that there is a point $u \in U$ mapping to $x$. Then $u$ is a finite type point of $U$. Since $U \to V$ is not smooth at the point $u$, by More on Morphisms, Lemma \ref{more-morphisms-lemma-lifting-along-artinian-at-point} there is a diagram $$ \xymatrix{ X \ar[d] & U \ar[l] \ar[d] & \Spec(B) \ar[d]^i \ar[l]^-\alpha  \\ Y & V \ar[l] & \Spec(B') \ar[l]_-{\beta} \ar@{-->}[lu] } $$ with $B' \to B$ a small extension of (Artinian) local rings such that the residue field of $B$ is equal to $\kappa(v)$ and such that the dotted arrow does not exist. Since $U \to V$ is of finite type, we see that $v$ is a finite type point of $V$. By Morphisms, Lemma \ref{morphisms-lemma-artinian-finite-type} the morphism $\beta$ is of finite type, hence the composition $\Spec(B) \to Y$ is of finite type also. Arguing exactly as in the proof of Lemma \ref{lemma-lifting-along-artinian-at-point} (using that $U \to X$ and $V \to Y$ are \'etale hence formally \'etale) we see that there cannot be an arrow $\Spec(B) \to X$ fitting into the outer rectangle of the last displayed diagram. In other words, (2) doesn't hold and the proof is complete.
Assume $X_n \to Z_n$ is smooth for all $n$. Let $x \in X$ be a point lying over a point of $Z$. Given a small extension $B' \to B$ and morphisms $\alpha$, $\beta$ as in Lemma \ref{lemma-lifting-along-artinian-at-point} part (3) the maximal ideal of $B'$ is nilpotent (as $B'$ is Artinian) and hence the morphism $\beta$ factors through $Z_n$ and $\alpha$ factors through $X_n$ for a suitable $n$. Thus the lifting property for $X_n \to Z_n$ kicks in to get the desired dotted arrow in the diagram. This proves (1). Part (2) follows from (1) and the fact that a morphism is \'etale if and only if it is smooth of relative dimension $0$.
Formation of the naive cotangent complex commutes with pullback (Modules on Sites, Lemma \ref{sites-modules-lemma-pullback-NL}) and we have $p_{small}^{-1}\mathcal{O}_X = \mathcal{O}_U$ and $g_{small}^{-1}\mathcal{O}_{V_\etale} = p_{small}^{-1}f_{small}^{-1}\mathcal{O}_{Y_\etale}$ because $q_{small}^{-1}\mathcal{O}_{Y_\etale} = \mathcal{O}_{V_\etale}$ by Properties of Spaces, Lemma \ref{spaces-properties-lemma-etale-exact-pullback}. Tracing through the definitions we conclude that $\NL_{X/Y}|_{U_\etale} = \NL_{U/V}$.
Let $f_0 : X_0 \to Y_0$ be the morphism of schemes corresponding to $f$. There is a canonical map $\epsilon^{-1}f_0^{-1}\mathcal{O}_{Y_0} \to f_{small}^{-1}\mathcal{O}_Y$ compatible with $\epsilon^\sharp : \epsilon^{-1}\mathcal{O}_{X_0} \to \mathcal{O}_X$ because there is a commutative diagram $$ \xymatrix{ X_{0, Zar} \ar[d]_{f_0} & X_\etale \ar[l]^\epsilon \ar[d]^f \\ Y_{0, Zar} & Y_\etale \ar[l]_\epsilon } $$ see Derived Categories of Spaces, Remark \ref{spaces-perfect-remark-match-total-direct-images}. Thus we obtain a canonical map $$ \epsilon^{-1}\NL_{X_0/Y_0} = \epsilon^{-1}\NL_{\mathcal{O}_{X_0}/f_0^{-1}\mathcal{O}_{Y_0}} = \NL_{\epsilon^{-1}\mathcal{O}_{X_0}/\epsilon^{-1}f_0^{-1}\mathcal{O}_{Y_0}} \to \NL_{\mathcal{O}_X/f^{-1}_{small}\mathcal{O}_Y} = \NL_{X/Y} $$ by functoriality of the naive cotangent complex. To see that the induced map $\epsilon^*\NL_{X_0/Y_0} \to \NL_{X/Y}$ is an isomorphism in $D(\mathcal{O}_X)$ we may check on stalks at geometric points (Properties of Spaces, Theorem \ref{spaces-properties-theorem-exactness-stalks}). Let $\overline{x} : \Spec(k) \to X_0$ be a geometric point lying over $x \in X_0$, with $\overline{y} = f \circ \overline{x}$ lying over $y \in Y_0$. Then $$ \NL_{X/Y, \overline{x}} = \NL_{\mathcal{O}_{X, \overline{x}}/\mathcal{O}_{Y, \overline{y}}} $$ This is true because taking stalks at $\overline{x}$ is the same as taking inverse image via $\overline{x} : \Spec(k) \to X$ and we may apply Modules on Sites, Lemma \ref{sites-modules-lemma-pullback-NL}. On the other hand we have $$ (\epsilon^*\NL_{X_0/Y_0})_{\overline{x}} = \NL_{X_0/Y_0, x} \otimes_{\mathcal{O}_{X_0, x}} \mathcal{O}_{X, \overline{x}} = \NL_{\mathcal{O}_{X_0, x}/\mathcal{O}_{Y_0, y}} \otimes_{\mathcal{O}_{X_0, x}} \mathcal{O}_{X, \overline{x}} $$ Some details omitted (hint: use that the stalk of a pullback is the stalk at the image point, see Sites, Lemma \ref{sites-lemma-point-morphism-sites}, as well as the corresponding result for modules, see Modules on Sites, Lemma \ref{sites-modules-lemma-pullback-stalk}). Observe that $\mathcal{O}_{X, \overline{x}}$ is the strict henselization of $\mathcal{O}_{X_0, x}$ and similarly for $\mathcal{O}_{Y, \overline{y}}$ (Properties of Spaces, Lemma \ref{spaces-properties-lemma-describe-etale-local-ring}). Thus the result follows from More on Algebra, Lemma \ref{more-algebra-lemma-henselization-NL}.
By construction of the naive cotangent complex in Modules on Sites, Section \ref{sites-modules-section-netherlander} we have that $\NL_{X/Y}$ is a complex sitting in degrees $-1$, $0$ and that its cohomology in degree $0$ is $\Omega_{X/Y}$ (by our construction of $\Omega_{X/Y}$ in Section \ref{section-sheaf-differentials}). The sheaf of differentials is quasi-coherent (by Lemma \ref{lemma-module-differentials-quasi-coherent}). To finish the proof it suffices to show that $H^{-1}(\NL_{X/Y})$ is quasi-coherent. This follows by checking \'etale locally (allowed by Lemma \ref{lemma-NL-etale-localization} and Properties of Spaces, Lemma \ref{spaces-properties-lemma-characterize-quasi-coherent}) reducing to the case of schemes (Lemma \ref{lemma-NL-compare-spaces-schemes}) and finally using the result in the case of schemes (More on Morphisms, Lemma \ref{more-morphisms-lemma-netherlander-quasi-coherent}).
Assume (1). A formally \'etale morphism is a formally smooth morphism. Thus $H^{-1}(\NL_{X/Y}) = 0$ by Lemma \ref{lemma-NL-formally-smooth}. On the other hand, a formally \'etale morphism if formally unramified hence we have $\Omega_{X/Y} = 0$ by Lemma \ref{lemma-characterize-formally-unramified}. Conversely, if (2) holds, then $f$ is formally smooth by Lemma \ref{lemma-NL-formally-smooth} and formally unramified by Lemma \ref{lemma-characterize-formally-unramified} and hence formally \'etale by Lemmas \ref{lemma-formally-etale-unramified-smooth}.
One way to prove this is to translate the proof as given in More on Morphisms, Lemma \ref{more-morphisms-lemma-morphism-between-flat} into the category of algebraic spaces. Instead we will prove this by reducing to the case of schemes. Namely, choose a diagram as in Lemma \ref{lemma-flat-on-fibres-at-point} part (3) such that $a$, $b$, and $c$ are surjective. It follows from the definitions that this reduces to the corresponding theorem for the morphisms of schemes $U \to V \to W$, the quasi-coherent sheaf $a^*\mathcal{F}$, and the point $u \in U$. The only minor point to make is that given a morphism of algebraic spaces $Z' \to Z$ we choose a scheme $W'$ and a surjective \'etale morphism $W' \to W \times_Z Z'$. Then we set $U' = W' \times_W U$ and $V' = W' \times_W V$. We write $a', b', c'$ for the morphisms from $U', V', W'$ to $X', Y', Z'$. In this case $A$, resp.\ $A'$ are images of the open subsets of $U$, resp.\ $U'$ associated to $a^*\mathcal{F}$, resp.\ $(a')^*\mathcal{F}'$. This indeed does reduce the lemma to More on Morphisms, Lemma \ref{more-morphisms-lemma-morphism-between-flat}.
Pick a commutative diagram $$ \xymatrix{ U \ar[d] \ar[r] & V \ar[d] \\ X \ar[r] & Y } $$ where $U$ and $V$ are schemes and the vertical arrows are \'etale such that there is a point $u \in U$ mapping to $x$. Let $v \in V$ be the image of $u$. Applying Lemma \ref{lemma-flat-on-fibres-at-point} to $\text{id} : X \to X$ over $Y$ we see that (1) translates into the condition ``$\mathcal{F}|_{U_v}$ is flat over $U_v$ at $u$''. In other words, (1) is equivalent to $(\mathcal{F}|_{U_v})_u$ being a flat $\mathcal{O}_{U_v, u}$-module. By the case of schemes (More on Morphisms, Lemma \ref{more-morphisms-lemma-flat-and-free-at-point-fibre}), we find that this implies that $\mathcal{F}|_U$ is finite free in an open neighbourhood of $u$. In this way we see that (1) implies (4). The implications (4) $\Rightarrow$ (3) and (2) $\Rightarrow$ (1) are immediate. For the implication (3) $\Rightarrow$ (2) use the description of local rings and stalks in Properties of Spaces, Lemmas \ref{spaces-properties-lemma-describe-etale-local-ring} and \ref{spaces-properties-lemma-stalk-quasi-coherent}.
Openness holds trivially. Let $Y' \to Y$ be a morphism of algebraic spaces, set $X' = Y' \times_Y X$,  and let $x' \in |X'|$ be a point lying over $x \in |X|$. By Lemma \ref{lemma-flat-and-free-at-point-fibre} we see that $x$ is in our set if and only if $(\mathcal{F}_{\overline{y}})_{\overline{x}}$ is a flat $\mathcal{O}_{X_{\overline{y}}, \overline{x}}$-module. Simiarly, $x'$ is in the analogue of our set for the pullback $\mathcal{F}'$ of $\mathcal{F}$ to $X'$ if and only if $(\mathcal{F}'_{\overline{y}'})_{\overline{x}'}$ is a flat $\mathcal{O}_{X'_{\overline{y}'}, \overline{x}'}$-module (with obvious notation). These two assertions are equivalent by Lemma \ref{lemma-flat-on-fibres-at-point} applied to the morphism $\text{id} : X \to X$ over $Y$. Thus the statement on base change holds.
The locus where $\mathcal{F}$ is flat over $S$ is open in $|X|$ by Theorem \ref{theorem-openness-flatness}. The statement is insensitive to replacing $X$ by the members of an \'etale covering, hence we may assume $X$ is an affine scheme. In this case the result follows immediately from Algebra, Lemma \ref{algebra-lemma-flat-module-powers}. Some details omitted.
The base change of the factorization $Y_1 \to X_1' \to X_1$ to $X_2$ is a factorization $Y_2 \to X_2 \times_{X_1} X_1' \to X_1$ and $X_2 \times_{X_1} X_1' \to X_1$ is integral (Morphisms of Spaces, Lemma \ref{spaces-morphisms-lemma-base-change-integral}). Hence we get a morphism $h : X_2' \to X_2 \times_{X_1} X_1'$ by the universal property of Morphisms of Spaces, Lemma \ref{spaces-morphisms-lemma-characterize-normalization}. Observe that $X_2'$ is the relative spectrum of the integral closure of $\mathcal{O}_{X_2}$ in $f_{2, *}\mathcal{O}_{Y_2}$. If $\mathcal{A}' \subset f_{1, *}\mathcal{O}_{Y_1}$ denotes the integral closure of $\mathcal{O}_{X_2}$, then $X_2 \times_{X_1} X_1'$ is the relative spectrum of $\varphi^*\mathcal{A}'$ as the construction of the relative spectrum commutes with arbitrary base change. By Cohomology of Spaces, Lemma \ref{spaces-cohomology-lemma-flat-base-change-cohomology} we know that $f_{2, *}\mathcal{O}_{Y_2} = \varphi^*f_{1, *}\mathcal{O}_{Y_1}$. Hence the result follows from Lemma \ref{lemma-integral-closure-smooth-pullback}.
Given a diagram as in Descent, Definition \ref{descent-definition-local-source-target-at-point} we obtain an \'etale morphism of fibres $U'_{v'} \to U_v$ mapping $u'$ to $u$, see Descent, Lemma \ref{descent-lemma-etale-on-fiber}. Thus the strict henselizations of the local rings $\mathcal{O}_{U'_{v'}, u'}$ and $\mathcal{O}_{U_v, u}$ are the same. We conclude by More on Algebra, Lemma \ref{more-algebra-lemma-henselization-CM}.
Given an \'etale morphism $V \to Y$ where $V$ is a scheme choose a scheme $U$ and a surjective \'etale morphism $U \to X \times_Y V$. Consider the commutative diagram $$ \xymatrix{ U \ar[d] \ar[r] & V \ar[d] \\ X \ar[r] & Y } $$ Let $u \in U$ with images $x \in |X|$, $y \in |Y|$, and $v \in V$. Then $f$ is Cohen-Macaulay at $x$ if and only if $U \to V$ is Cohen-Macaulay at $u$ (by definition). Moreover the morphism $U_v \to X_v = (X_V)_v$ is surjective \'etale. Hence the scheme $U_v$ is Cohen-Macaulay if and only if the algebraic space $X_v$ is Cohen-Macaulay. Thus the equivalence of (1), (2), and (3) follows from the corresponding equivalence for morphisms of schemes, see More on Morphisms, Lemma \ref{more-morphisms-lemma-CM} by a formal argument. \medskip\noindent Proof of equivalence of (a) and (b). The corresponding equivalence for flatness is Morphisms of Spaces, Lemma \ref{spaces-morphisms-lemma-flat-at-point-etale-local-rings}. Thus we may assume $f$ is flat at $x$ when proving the equivalence. Consider a diagram and $x, y, u, v$ as above. Then $\mathcal{O}_{Y, \overline{y}} \to \mathcal{O}_{X, \overline{x}}$ is equal to the map $\mathcal{O}_{V, v}^{sh} \to \mathcal{O}_{U, u}^{sh}$ on strict henselizations of local rings, see Properties of Spaces, Lemma \ref{spaces-properties-lemma-describe-etale-local-ring}. Thus we have $$ \mathcal{O}_{X, \overline{x}}/ \mathfrak m_{\overline{y}}\mathcal{O}_{X, \overline{x}} = (\mathcal{O}_{U, u}/\mathfrak m_v \mathcal{O}_{U, u})^{sh} $$ by Algebra, Lemma \ref{algebra-lemma-quotient-strict-henselization}. Thus we have to show that the Noetherian local ring $\mathcal{O}_{U, u}/\mathfrak m_v \mathcal{O}_{U, u}$ is Cohen-Macaulay if and only if its strict henselization is. This is More on Algebra, Lemma \ref{more-algebra-lemma-henselization-CM}.
Working \'etale locally this follows from the corresponding result for schemes, see More on Morphisms, Lemma \ref{more-morphisms-lemma-composition-CM}. Alternatively, we can use the equivalence of (a) and (b) in Lemma \ref{lemma-CM}. Thus we consider the local homomorphism of Noetherian local rings $$ \mathcal{O}_{Y, \overline{y}}/ \mathfrak m_{\overline{z}}\mathcal{O}_{Y, \overline{y}} \longrightarrow \mathcal{O}_{X, \overline{x}}/ \mathfrak m_{\overline{z}}\mathcal{O}_{X, \overline{x}} $$ whose fibre is $$ \mathcal{O}_{X, \overline{x}}/ \mathfrak m_{\overline{y}}\mathcal{O}_{X, \overline{x}} $$ and we use Algebra, Lemma \ref{algebra-lemma-CM-goes-up}.
Denote $y \in |Y|$ and $y' \in |Y'|$ the image of $x'$. Choose a surjective \'etale morphism $V \to Y$ where $V$ is a scheme. Choose a surjective \'etale morphism $U \to X \times_Y V$ where $U$ is a scheme. Choose a surjectiev \'etale morphism $V' \to Y' \times_Y V$ where $V'$ is a scheme. Then $U' = U \times_V V'$ is a scheme which comes equipped with a surjective \'etale morphism $U' \to X'$. Choose $u' \in U'$ mapping to $x'$. Denote $u \in U$ the image of $u'$. Then the lemma follows from the lemma for $U \to V$ and its base change $U' \to V'$ and the points $u'$ and $u$ (this follows from the definitions). Thus the lemma follows from the case of schemes, see More on Morphisms, Lemma \ref{more-morphisms-lemma-base-change-CM}.
Choose a commutative diagram $$ \xymatrix{ U \ar[d] \ar[r] & V \ar[d] \\ X \ar[r] & Y } $$ with \'etale vertical arrows and $U$ and $V$ schemes. Let $u \in U$ with image $x \in |X|$. Then $f$ is Cohen-Macaulay at $x$ if and only if $U \to V$ is Cohen-Macaulay at $u$ (by definition). Thus we reduce to the case of the morphism $U \to V$. See More on Morphisms, Lemma \ref{more-morphisms-lemma-flat-finite-presentation-CM-open}.
Choose a commutative diagram $$ \xymatrix{ U \ar[d] \ar[r] & V \ar[d] \\ X \ar[r] & Y } $$ with \'etale vertical arrows and $U$ and $V$ schemes. Then $U \to V$ is locally of finite presentation and Cohen-Macaulay (immediate from our definitions). Thus we have a decomposition $U = \coprod_{d \geq 0} U_d$ into open and closed subschemes with $f|_{U_d} : U_d \to V$ of relative dimension $d$, see Morphisms, Lemma \ref{morphisms-lemma-flat-finite-presentation-CM-fibres-relative-dimension}. Let $u \in U$ with image $x \in |X|$. Then $f$ has relative dimension $d$ at $x$ if and only if $U \to V$ has relative dimension $d$ at $u$ (this follows from our definitions). In this way we see that $U_d$ is the inverse image of a subset $X_d \subset |X|$ which is necessarily open and closed. Denoting $X_d$ the corresponding open and closed algebraic subspace of $X$ we see that the lemma is true.
Given a diagram as in Descent, Definition \ref{descent-definition-local-source-target-at-point} we obtain an \'etale morphism of fibres $U'_{v'} \to U_v$ mapping $u'$ to $u$, see Descent, Lemma \ref{descent-lemma-etale-on-fiber}. Thus $\mathcal{O}_{U_v, u} \to \mathcal{O}_{U'_{v'}, u'}$ is the localization of an \'etale ring map. Hence the first is Noetherian if and only if the second is Noetherian, see More on Algebra, Lemma \ref{more-algebra-lemma-Noetherian-etale-extension}. Then, since $\mathcal{O}_{U'_{v'}, u'}/\mathfrak m_u \mathcal{O}_{U'_{v'}, u'} = \kappa(u')$ (Algebra, Lemma \ref{algebra-lemma-etale-at-prime}) is a Gorenstein ring, we see that $\mathcal{O}_{U_v, u}$ is Gorenstein if and only if $\mathcal{O}_{U'_{v'}, u'}$ is Gorenstein by Dualizing Complexes, Lemma \ref{dualizing-lemma-flat-under-gorenstein}.
Given an \'etale morphism $V \to Y$ where $V$ is a scheme choose a scheme $U$ and a surjective \'etale morphism $U \to X \times_Y V$. Consider the commutative diagram $$ \xymatrix{ U \ar[d] \ar[r] & V \ar[d] \\ X \ar[r] & Y } $$ Let $u \in U$ with images $x \in |X|$, $y \in |Y|$, and $v \in V$. Then $f$ is Gorenstein at $x$ if and only if $U \to V$ is Gorenstein at $u$ (by definition). Moreover the morphism $U_v \to X_v = (X_V)_v$ is surjective \'etale. Hence the scheme $U_v$ is Gorenstein if and only if the algebraic space $X_v$ is Gorenstein. Thus the equivalence of (1), (2), and (3) follows from the corresponding equivalence for morphisms of schemes, see Duality for Schemes, Lemma \ref{duality-lemma-gorenstein} by a formal argument. \medskip\noindent Proof of equivalence of (a) and (b). The corresponding equivalence for flatness is Morphisms of Spaces, Lemma \ref{spaces-morphisms-lemma-flat-at-point-etale-local-rings}. Thus we may assume $f$ is flat at $x$ when proving the equivalence. Consider a diagram and $x, y, u, v$ as above. Then $\mathcal{O}_{Y, \overline{y}} \to \mathcal{O}_{X, \overline{x}}$ is equal to the map $\mathcal{O}_{V, v}^{sh} \to \mathcal{O}_{U, u}^{sh}$ on strict henselizations of local rings, see Properties of Spaces, Lemma \ref{spaces-properties-lemma-describe-etale-local-ring}. Thus we have $$ \mathcal{O}_{X, \overline{x}}/ \mathfrak m_{\overline{y}}\mathcal{O}_{X, \overline{x}} = (\mathcal{O}_{U, u}/\mathfrak m_v \mathcal{O}_{U, u})^{sh} $$ by Algebra, Lemma \ref{algebra-lemma-quotient-strict-henselization}. Thus we have to show that the Noetherian local ring $\mathcal{O}_{U, u}/\mathfrak m_v \mathcal{O}_{U, u}$ is Gorenstein if and only if its strict henselization is. This follows immediately from Dualizing Complexes, Lemma \ref{dualizing-lemma-completion-henselization-dualizing} and the definition of a Gorenstein local ring as a Noetherian local ring which is a dualizing complex over itself.
Working \'etale locally this follows from the corresponding result for schemes, see Duality for Schemes, Lemma \ref{duality-lemma-composition-gorenstein}. Alternatively, we can use the equivalence of (a) and (b) in Lemma \ref{lemma-gorenstein}. Thus we consider the local homomorphism of Noetherian local rings $$ \mathcal{O}_{Y, \overline{y}}/ \mathfrak m_{\overline{z}}\mathcal{O}_{Y, \overline{y}} \longrightarrow \mathcal{O}_{X, \overline{x}}/ \mathfrak m_{\overline{z}}\mathcal{O}_{X, \overline{x}} $$ whose fibre is $$ \mathcal{O}_{X, \overline{x}}/ \mathfrak m_{\overline{y}}\mathcal{O}_{X, \overline{x}} $$ and we use Dualizing Complexes, Lemma \ref{dualizing-lemma-flat-under-gorenstein}.
Denote $y \in |Y|$ and $y' \in |Y'|$ the image of $x'$. Choose a surjective \'etale morphism $V \to Y$ where $V$ is a scheme. Choose a surjective \'etale morphism $U \to X \times_Y V$ where $U$ is a scheme. Choose a surjectiev \'etale morphism $V' \to Y' \times_Y V$ where $V'$ is a scheme. Then $U' = U \times_V V'$ is a scheme which comes equipped with a surjective \'etale morphism $U' \to X'$. Choose $u' \in U'$ mapping to $x'$. Denote $u \in U$ the image of $u'$. Then the lemma follows from the lemma for $U \to V$ and its base change $U' \to V'$ and the points $u'$ and $u$ (this follows from the definitions). Thus the lemma follows from the case of schemes, see Duality for Schemes, Lemma \ref{duality-lemma-base-change-gorenstein}.
Choose a commutative diagram $$ \xymatrix{ U \ar[d] \ar[r] & V \ar[d] \\ X \ar[r] & Y } $$ Let $u \in U$ with image $x \in |X|$. Then $f$ is Gorenstein at $x$ if and only if $U \to V$ is Gorenstein at $u$ (by definition). Thus we reduce to the case of the morphism $U \to V$ of schemes. Openness is proven in Duality for Schemes, Lemma \ref{duality-lemma-flat-finite-presentation-characterize-gorenstein} and compatibility with base change in Duality for Schemes, Lemma \ref{duality-lemma-flat-lft-base-change-gorenstein}.
Choose an affine scheme $V$ and an \'etale morphism $V  \to Y$. The meaning of the statement is that the inverse image of $E$ in $|V|$ is constructible. By Lemma \ref{lemma-base-change-fibres-geometrically-reduced} we may replace $Y$ by $V$, i.e., we may assume that $Y$ is an affine scheme. Then $X$ is quasi-compact. Choose an affine scheme $U$ and a surjective \'etale morphism $U \to X$. For a morphism $\Spec(k) \to Y$ the morphism between fibres $U_k \to X_k$ is surjective \'etale. Hence $U_k$ is geometrically reduced over $k$ if and only if $X_k$ is geometrically reduced over $k$, see Spaces over Fields, Lemma \ref{spaces-over-fields-lemma-geometrically-reduced-etale-local}. Thus the set $E$ for $X \to Y$ is the same as the set $E$ for $U \to Y$. In this way we see that the lemma follows from the case of schemes, see More on Morphisms, Lemma \ref{more-morphisms-lemma-geometrically-reduced-constructible}.
Choose an \'etale morphism $U \to X$ where $U$ is an affine scheme. Then $U$ is of finite type over $R$. Let $u \in U$ be in the special fibre. The local ring $A = \mathcal{O}_{U, u}$ is essentially of finite type over $R$, hence Noetherian. Let $\pi \in R$ be a uniformizer. Since $X$ is flat over $R$, we see that $\pi \in \mathfrak m_A$ is a nonzerodivisor on $A$ and since the special fibre of $X$ is reduced, we have that $A/\pi A$ is reduced. If $a \in A$, $a \not = 0$ then there exists an $n \geq 0$ and an element $a' \in A$ such that $a = \pi^n a'$ and $a' \not \in \pi A$. This follows from Krull intersection theorem (Algebra, Lemma \ref{algebra-lemma-intersect-powers-ideal-module-zero}). If $a$ is nilpotent, so is $a'$, because $\pi$ is a nonzerodivisor. But $a'$ maps to a nonzero element of the reduced ring $A/\pi A$ so this is impossible. Hence $A$ is reduced. It follows that there exists an open neighbourhood of $u$ in $U$ which is reduced (small detail omitted; use that $U$ is Noetherian). Thus we can find an \'etale morphism $U \to X$ with $U$ a reduced scheme, such that every point of the special fibre of $X$ is in the image. Since $X$ is proper over $R$ it follows that $U \to X$ is surjective. Hence $X$ is reduced. Since the generic fibre of $U \to \Spec(R)$ is reduced as well (on affine pieces it is computed by taking localizations), we conclude the same thing is true for the generic fibre.