hcju/stacksqa huggingface dataset:
Observe that $\text{depth}(A) \geq 2$ because $A$ is normal (Serre's criterion for normality, Algebra, Lemma \ref{algebra-lemma-criterion-normal}). Thus the final statement follows from Lemma \ref{lemma-reformulate-purity}. Given $\pi : V \to U$ finite \'etale, set $B = \Gamma(V, \mathcal{O}_V)$. If we can show that $B$ is normal and finite over $A$, then we obtain the displayed functor. Since there is an obvious quasi-inverse functor, this is also all that we have to show. \medskip\noindent Since $A$ is normal, the scheme $V$ is normal (Descent, Lemma \ref{descent-lemma-normal-local-smooth}). Hence $V$ is a finite disjoint union of integral schemes (Properties, Lemma \ref{properties-lemma-normal-Noetherian}). Thus we may assume $V$ is integral. In this case the function field $L$ of $V$ (Morphisms, Section \ref{morphisms-section-rational-maps}) is a finite separable extension of the fraction field of $A$ (because we get it by looking at the generic fibre of $V \to U$ and using Morphisms, Lemma \ref{morphisms-lemma-etale-over-field}). By Algebra, Lemma \ref{algebra-lemma-Noetherian-normal-domain-finite-separable-extension} the integral closure $B' \subset L$ of $A$ in $L$ is finite over $A$. By More on Algebra, Lemma \ref{more-algebra-lemma-integral-closure-reflexive} we see that $B'$ is a reflexive $A$-module, which in turn implies that $\text{depth}_A(B') \geq 2$ by More on Algebra, Lemma \ref{more-algebra-lemma-reflexive-over-normal}. \medskip\noindent Let $f \in \mathfrak m$. Then $B_f = \Gamma(V \times_U D(f), \mathcal{O}_V)$ (Properties, Lemma \ref{properties-lemma-invert-f-sections}). Hence $B'_f = B_f$ because $B_f$ is normal (see above), finite over $A_f$ with fraction field $L$. It follows that $V = \Spec(B') \times_X U$. Then we conclude that $B = B'$ from Lemma \ref{lemma-sections-over-punctured-spec} applied to $\Spec(B') \to X$. This lemma applies because the localizations $B'_{\mathfrak m'}$ of $B'$ at maximal ideals $\mathfrak m' \subset B'$ lying over $\mathfrak m$ have depth $\geq 2$ by Algebra, Lemma \ref{algebra-lemma-depth-goes-down-finite} and the remark on depth in the preceding paragraph.
The implication (1) $\Rightarrow$ (2) follows from taking the base change of a solution $Y \to X$. Let $Y' \to X'$ be as in (2). By Lemma \ref{lemma-fill-in-missing} we can find $Y \to X$ finite such that $V = Y \times_X U$ and $Y' = Y \times_X X'$. By descent we see that $Y \to X$ is finite \'etale (Algebra, Lemmas \ref{algebra-lemma-descend-properties-modules} and \ref{algebra-lemma-etale}). This finishes the proof.
We reduce to the complete case using Lemma \ref{lemma-purity-and-completion}. (The assumptions carry over; see proof of Lemma \ref{lemma-fully-faithful-simple}.) \medskip\noindent In the complete case we can lift $Y_0 \to X_0$ to a finite \'etale morphism $Y \to X$ by More on Algebra, Lemma \ref{more-algebra-lemma-finite-etale-equivalence}; observe that $(A, fA)$ is a henselian pair by More on Algebra, Lemma \ref{more-algebra-lemma-complete-henselian}. Then we can use Lemma \ref{lemma-fully-faithful-simple} to see that $V$ is isomorphic to $Y \times_X U$ and the proof is complete.
We reduce to the complete case using Lemma \ref{lemma-purity-and-completion}. (The assumptions carry over; use Dualizing Complexes, Lemma \ref{dualizing-lemma-torsion-change-rings}.) \medskip\noindent In the complete case we can lift $Y_0 \to X_0$ to a finite \'etale morphism $Y \to X$ by More on Algebra, Lemma \ref{more-algebra-lemma-finite-etale-equivalence}; observe that $(A, fA)$ is a henselian pair by More on Algebra, Lemma \ref{more-algebra-lemma-complete-henselian}. Then we can use Lemma \ref{lemma-fully-faithful-minimal} to see that $V$ is isomorphic to $Y \times_X U$ and the proof is complete.
By induction on $\dim(A)$. If $\dim(A) = 1$, then $\mathfrak p = \mathfrak m$ works. If $\dim(A) > 1$, then let $Z \subset \Spec(A)$ be an irreducible component of dimension $> 1$. Then $V(f) \cap Z$ has dimension $> 0$ (Algebra, Lemma \ref{algebra-lemma-one-equation}). Pick a prime $\mathfrak q \in V(f) \cap Z$, $\mathfrak q \not = \mathfrak m$ corresponding to a closed point of the punctured spectrum of $A$; this is possible by Properties, Lemma \ref{properties-lemma-complement-closed-point-Jacobson}. Then $\mathfrak q$ is not the generic point of $Z$. Hence $0 < \dim(A_\mathfrak q) < \dim(A)$ and $f \in \mathfrak q A_\mathfrak q$. By induction on the dimension we can find $f \in \mathfrak p \subset A_\mathfrak q$ with $\dim((A_\mathfrak q)_\mathfrak p) = 1$. Then $\mathfrak p \cap A$ works.
Observe that the set of points where $f$ is unramified is the same as the set of points where $f$ is \'etale and that this set is open. See Morphisms, Definitions \ref{morphisms-definition-unramified} and \ref{morphisms-definition-etale} and Lemma \ref{morphisms-lemma-flat-unramified-etale}. To check $f$ is \'etale at $x$ we may work \'etale locally on the base and on the target (Descent, Lemmas \ref{descent-lemma-descending-property-etale} and \ref{descent-lemma-etale-etale-local-source}). Thus we can apply More on Morphisms, Lemma \ref{more-morphisms-lemma-etale-makes-quasi-finite-finite-at-point} and assume that $f : X \to Y$ is finite and that $x$ is the unique point of $X$ lying over $y = f(x)$. Then it follows that $f$ is finite locally free (Morphisms, Lemma \ref{morphisms-lemma-finite-flat}). \medskip\noindent Assume $f$ is finite locally free and that $x$ is the unique point of $X$ lying over $y = f(x)$. By Discriminants, Lemma \ref{discriminant-lemma-discriminant} we find a locally principal closed subscheme $D_\pi \subset Y$ such that $y' \in D_\pi$ if and only if there exists an $x' \in X$ with $f(x') = y'$ and $f$ ramified at $x'$. Thus we have to prove that $y \not \in D_\pi$. Assume $y \in D_\pi$ to get a contradiction. \medskip\noindent By condition (3) we have $\dim(\mathcal{O}_{X, x}) \geq 1$. We have $\dim(\mathcal{O}_{X, x}) = \dim(\mathcal{O}_{Y, y})$ by Algebra, Lemma \ref{algebra-lemma-dimension-base-fibre-equals-total}. By Lemma \ref{lemma-find-point-codim-1} we can find $y' \in D_\pi$ specializing to $y$ with $\dim(\mathcal{O}_{Y, y'}) = 1$. Choose $x' \in X$ with $f(x') = y'$ where $f$ is ramified. Since $f$ is finite it is closed, and hence $x' \leadsto x$. We have $\dim(\mathcal{O}_{X, x'}) = \dim(\mathcal{O}_{Y, y'}) = 1$ as before. This contradicts property (4).
Recall that a regular local ring is normal by Algebra, Lemma \ref{algebra-lemma-regular-normal}. Hence (1) and (2) are equivalent by Lemma \ref{lemma-reformulate-purity-normal}. We prove the lemma by induction on $d$. \medskip\noindent The case $d = 2$. In this case $A \to B$ is flat. Namely, we have going down for $A \to B$ by Algebra, Proposition \ref{algebra-proposition-going-down-normal-integral}. Then $\dim(B_{\mathfrak m'}) = 2$ for all maximal ideals $\mathfrak m' \subset B$ by Algebra, Lemma \ref{algebra-lemma-dimension-base-fibre-equals-total}. Then $B_{\mathfrak m'}$ is Cohen-Macaulay by Algebra, Lemma \ref{algebra-lemma-criterion-normal}. Hence and this is the important step Algebra, Lemma \ref{algebra-lemma-CM-over-regular-flat} applies to show $A \to B_{\mathfrak m'}$ is flat. Then Algebra, Lemma \ref{algebra-lemma-flat-localization} shows $A \to B$ is flat. Thus we can apply Lemma \ref{lemma-ramification-quasi-finite-flat} (or you can directly argue using the easier Discriminants, Lemma \ref{discriminant-lemma-discriminant}) to see that $A \to B$ is \'etale. \medskip\noindent The case $d \geq 3$. Let $V \to U$ be finite \'etale. Let $f \in \mathfrak m_A$, $f \not \in \mathfrak m_A^2$. Then $A/fA$ is a regular local ring of dimension $d - 1 \geq 2$, see Algebra, Lemma \ref{algebra-lemma-regular-ring-CM}. Let $U_0$ be the punctured spectrum of $A/fA$ and let $V_0 = V \times_U U_0$. By Lemma \ref{lemma-lift-purity} it suffices to show that $V_0$ is in the essential image of $\textit{F\'Et}_{\Spec(A/fA)} \to \textit{F\'Et}_{U_0}$. This follows from the induction hypothesis.
We will prove the lemma by induction on $d = \dim(\mathcal{O}_{X, x}) = \dim(\mathcal{O}_{Y, y})$. \medskip\noindent An uninteresting case is when $d = 1$. In that case we are assuming that $f$ is unramified at $x$ and that $\mathcal{O}_{Y, y}$ is a discrete valuation ring (Algebra, Lemma \ref{algebra-lemma-characterize-dvr}). Then $\mathcal{O}_{X, x}$ is flat over $\mathcal{O}_{Y, y}$ (otherwise the map would not be quasi-finite at $x$) and we see that $f$ is flat at $x$. Since flat $+$ unramified is \'etale we conclude (some details omitted). \medskip\noindent The case $d \geq 2$. We will use induction on $d$ to reduce to the case discussed in Lemma \ref{lemma-local-purity}. To check $f$ is \'etale at $x$ we may work \'etale locally on the base and on the target (Descent, Lemmas \ref{descent-lemma-descending-property-etale} and \ref{descent-lemma-etale-etale-local-source}). Thus we can apply More on Morphisms, Lemma \ref{more-morphisms-lemma-etale-makes-quasi-finite-finite-at-point} and assume that $f : X \to Y$ is finite and that $x$ is the unique point of $X$ lying over $y$. Here we use that \'etale extensions of local rings do not change dimension, normality, and regularity, see More on Algebra, Section \ref{more-algebra-section-permanence-etale} and \'Etale Morphisms, Section \ref{etale-section-properties-permanence}. \medskip\noindent Next, we can base change by $\Spec(\mathcal{O}_{Y, y})$ and assume that $Y$ is the spectrum of a regular local ring. It follows that $X = \Spec(\mathcal{O}_{X, x})$ as every point of $X$ necessarily specializes to $x$. \medskip\noindent The ring map $\mathcal{O}_{Y, y} \to \mathcal{O}_{X, x}$ is finite and necessarily injective (by equality of dimensions). We conclude we have going down for $\mathcal{O}_{Y, y} \to \mathcal{O}_{X, x}$ by Algebra, Proposition \ref{algebra-proposition-going-down-normal-integral} (and the fact that a regular ring is a normal ring by Algebra, Lemma \ref{algebra-lemma-regular-normal}). Pick $x' \in X$, $x' \not = x$ with image $y' = f(x')$. Then $\mathcal{O}_{X, x'}$ is normal as a localization of a normal domain. Similarly, $\mathcal{O}_{Y, y'}$ is regular (see Algebra, Lemma \ref{algebra-lemma-localization-of-regular-local-is-regular}). We have $\dim(\mathcal{O}_{X, x'}) = \dim(\mathcal{O}_{Y, y'})$ by Algebra, Lemma \ref{algebra-lemma-dimension-base-fibre-equals-total} (we checked going down above). Of course these dimensions are strictly less than $d$ as $x' \not = x$ and by induction on $d$ we conclude that $f$ is \'etale at $x'$. \medskip\noindent Thus we arrive at the following situation: We have a finite local homomorphism $A \to B$ of Noetherian local rings of dimension $d \geq 2$, with $A$ regular, $B$ normal, which induces a finite \'etale morphism $V \to U$ on punctured spectra. Our goal is to show that $A \to B$ is \'etale. This follows from Lemma \ref{lemma-local-purity} and the proof is complete.
Observe that $\pi_*\mathcal{O}_V$ is a finite locally free $\mathcal{O}_U$-module, in particular reflexive. By Divisors, Lemma \ref{divisors-lemma-reflexive-S2-extend} the module $j_*\pi_*\mathcal{O}_V$ is the unique reflexive coherent module on $X$ restricting to $\pi_*\mathcal{O}_V$ over $U$. This proves (1). \medskip\noindent By construction $Y \times_X U = V$. Since $\mathcal{B}$ is coherent, we see that $Y \to X$ is finite. We have $\text{depth}(\mathcal{B}_x) \geq 2$ for $x \in X \setminus U$ by Divisors, Lemma \ref{divisors-lemma-reflexive-S2}. Hence $\text{depth}(\mathcal{O}_{Y, y}) \geq 2$ for $y \in Y \setminus V$ by Algebra, Lemma \ref{algebra-lemma-depth-goes-down-finite}. Conversely, suppose that $\pi' : Y' \to X$ is a finite morphism such that $V = Y' \times_X U$ and $\text{depth}(\mathcal{O}_{Y', y'}) \geq 2$ for $y' \in Y' \setminus V$. Then $\pi'_*\mathcal{O}_{Y'}$ restricts to $\pi_*\mathcal{O}_V$ over $U$ and satisfies $\text{depth}((\pi'_*\mathcal{O}_{Y'})_x) \geq 2$ for $x \in X \setminus U$ by Algebra, Lemma \ref{algebra-lemma-depth-goes-down-finite}. Then $\pi'_*\mathcal{O}_{Y'}$ is canonically isomorphic to $j_*\pi_*\mathcal{O}_V$ for example by Divisors, Lemma \ref{divisors-lemma-depth-2-hartog}. This proves (2). \medskip\noindent If $Y \to X$ is \'etale at $y$, then $Y \to X$ is flat at $y$. Conversely, suppose that $Y \to X$ is flat at $y$. If $y \in V$, then $Y \to X$ is \'etale at $y$. If $y \not \in V$, then we check (1), (2), (3), and (4) of Lemma \ref{lemma-ramification-quasi-finite-flat} hold to see that $Y \to X$ is \'etale at $y$. Parts (1) and (2) are clear and so is (3) since $\text{depth}(\mathcal{O}_{Y, y}) \geq 2$. If $y' \leadsto y$ is a specialization and $\dim(\mathcal{O}_{Y, y'}) = 1$, then $y' \in V$ since otherwise the depth of this local ring would be $2$ a contradiction by Algebra, Lemma \ref{algebra-lemma-bound-depth}. Hence $Y \to X$ is \'etale at $y'$ and we conclude (4) of Lemma \ref{lemma-ramification-quasi-finite-flat} holds too. This finishes the proof of (3). \medskip\noindent Part (4) follows from (3) and the fact that $((Y \to X)_*\mathcal{O}_Y)_x$ is a flat $\mathcal{O}_{X, x}$-module if and only if $\mathcal{O}_{Y, y}$ is a flat $\mathcal{O}_{X, x}$-module for all $y \in Y$ mapping to $x$, see Algebra, Lemma \ref{algebra-lemma-flat-localization}. Here we also use that a finite flat module over a Noetherian ring is finite locally free, see Algebra, Lemma \ref{algebra-lemma-finite-projective} (and Algebra, Lemma \ref{algebra-lemma-Noetherian-finite-type-is-finite-presentation}). \medskip\noindent As to the final assertions of the lemma, part (a) follows from flat base change, see Cohomology of Schemes, Lemma \ref{coherent-lemma-flat-base-change-cohomology} and part (b) follows from the uniqueness in (2) applied to the restriction $Y \times_X U'$.
Let $V \to U$ be a finite \'etale morphism. By Noetherian induction it suffices to extend $V \to U$ to a finite \'etale morphism to a strictly larger open subset of $X$. Let $x \in X \setminus U$ be the generic point of an irreducible component of $X \setminus U$. Then the inverse image $U_x$ of $U$ in $\Spec(\mathcal{O}_{X, x})$ is the punctured spectrum of $\mathcal{O}_{X, x}$. By assumption $V_x = V \times_U U_x$ is the restriction of a finite \'etale morphism $Y_x \to \Spec(\mathcal{O}_{X, x})$ to $U_x$. By Limits, Lemma \ref{limits-lemma-glueing-near-point} we find an open subscheme $U \subset U' \subset X$ containing $x$ and a morphism $V' \to U'$ of finite presentation whose restriction to $U$ recovers $V \to U$ and whose restriction to $\Spec(\mathcal{O}_{X, x})$ recovering $Y_x$. Finally, the morphism $V' \to U'$ is finite \'etale after possible shrinking $U'$ to a smaller open by Limits, Lemma \ref{limits-lemma-glueing-near-point-properties}.
By Algebra, Lemma \ref{algebra-lemma-one-equation} we see that $V(\mathfrak p)$ meets $U_0$ for every prime $\mathfrak p$ of $A$ with $\dim(A/\mathfrak p) \geq 2$. Thus the displayed functor is faithful for a $U$ as in the statement by Lemma \ref{lemma-restriction-faithful}. To see the existence of such a $U'$ note that for $\mathfrak p \subset A$ with $\mathfrak p \in U$, $\mathfrak p \not \in U_0$ with $\dim(A/\mathfrak p) = 1$ then $\mathfrak p$ corresponds to a closed point of $U$ and hence $V(\mathfrak p) \cap U_0 = \emptyset$. Thus we can take $U'$ to be the complement of the irreducible components of $X$ which do not meet $U_0$ and have dimension $1$.
Let $V_0 \to U_0$ be a finite \'etale morphism. By Lemma \ref{lemma-essentially-surjective-general-better} there exists an open $U' \subset U$ containing $U_0$ and a finite \'etale morphism $V' \to U$ whose base change to $U_0$ is isomorphic to $V_0 \to U_0$. Since $U' \supset U_0$ we see that $U \setminus U'$ consists of points corresponding to prime ideals $\mathfrak p_1, \ldots, \mathfrak p_n$ as in (3). By assumption we can find finite \'etale morphisms $V'_i \to \Spec(A_{\mathfrak p_i})$ agreeing with $V' \to U'$ over $U' \times_U \Spec(A_{\mathfrak p_i})$. By Limits, Lemma \ref{limits-lemma-glueing-near-closed-point} applied $n$ times we see that $V' \to U'$ extends to a finite \'etale morphism $V \to U$.
Denote $X = \Spec(A)$ and $U = X \setminus \{\mathfrak m\}$ the punctured spectrum. Similarly we have $X_0 = \Spec(A/fA)$ and $U_0 = X_0 \setminus \{\mathfrak m\}$. Let $V_0 \to U_0$ be a finite \'etale morphism. By Lemma \ref{lemma-equivalence-better} we find a finite \'etale morphism $V \to U$ whose base change to $U_0$ is isomorphic to $V_0 \to U_0$. By assumption (5) we find that $V \to U$ extends to a finite \'etale morphism $Y \to X$. Then the restriction of $Y$ to $X_0$ is the desired extension of $V_0 \to U_0$.
Set $I = (x_1, \ldots, x_d)$. Set $X = \Spec(A)$. If we use the map $Y \to X$ to identify $Y_0$ with $X$, then $V_0$ is identified with the punctured spectrum $U$ of $A$. Pushing forward modules by this affine morphism we get \begin{align*} \lim_n \Gamma(V_0, \mathcal{O}_V/I^n\mathcal{O}_V) & = \lim_n \Gamma(V_0, \mathcal{O}_Y/I^n\mathcal{O}_Y) \\ & = \lim_n \Gamma(U, \mathcal{O}_U[x_1, \ldots, x_d]/(x_1, \ldots, x_d)^n) \\ & = \lim_n A[x_1, \ldots, x_d]/(x_1, \ldots, x_d)^n \\ & = B \end{align*} Namely, as the depth of $A$ is $\geq 2$ we have $\Gamma(U, \mathcal{O}_U) = A$, see Local Cohomology, Lemma \ref{local-cohomology-lemma-finiteness-pushforwards-and-H1-local}. Thus for any $V \subset Y$ open as in the lemma we get $$ B = \Gamma(Y, \mathcal{O}_Y) \to \Gamma(V, \mathcal{O}_V) \to \lim_n \Gamma(V_0, \mathcal{O}_Y/I^n\mathcal{O}_Y) = B $$ which implies both arrows are isomorphisms (small detail omitted). By Algebraic and Formal Geometry, Lemma  \ref{algebraization-lemma-completion-fully-faithful} we conclude that $\textit{Coh}(\mathcal{O}_V) \to \textit{Coh}(V, I\mathcal{O}_V)$ is fully faithful on the full subcategory of finite locally free objects. Thus we conclude by Lemma \ref{lemma-restriction-fully-faithful}.
A prime $\mathfrak q \subset B$ which is not contained in $V$ lies over $\mathfrak m$. In this case $A \to B_\mathfrak q$ is a flat local homomorphism and hence $\text{depth}(B_\mathfrak q) \geq 2$ (Algebra, Lemma \ref{algebra-lemma-apply-grothendieck}). Thus the functor is fully faithful by Lemma \ref{lemma-quasi-compact-dense-open-connected-at-infinity-Noetherian} combined with Local Cohomology, Lemma \ref{local-cohomology-lemma-depth-2-connected-punctured-spectrum}. \medskip\noindent Let $W \to V$ be a finite \'etale morphism. Let $B \to C$ be the unique finite ring map such that $\Spec(C) \to Y$ is the finite morphism extending $W \to V$ constructed in Lemma \ref{lemma-extend-S2}. Observe that $C = \Gamma(W, \mathcal{O}_W)$. \medskip\noindent Set $Y_0 = V(x_1, \ldots, x_d)$ and $V_0 = V \cap Y_0$. Set $X = \Spec(A)$. If we use the map $Y \to X$ to identify $Y_0$ with $X$, then $V_0$ is identified with the punctured spectrum $U$ of $A$. Thus we may view $W_0 = W \times_Y Y_0$ as a finite \'etale scheme over $U$. Then $$ W_0 \times_U (U \times_X Y) \quad\text{and}\quad W \times_V (U \times_X Y) $$ are schemes finite \'etale over $U \times_X Y$ which restrict to isomorphic finite \'etale schemes over $V_0$. By Lemma \ref{lemma-fully-faithful-power-series-over-depth2} applied to the open $U \times_X Y$ we obtain an isomorphism $$ W_0 \times_U (U \times_X Y) \longrightarrow W \times_V (U \times_X Y) $$ over $U \times_X Y$. \medskip\noindent Observe that $C_0 = \Gamma(W_0, \mathcal{O}_{W_0})$ is a finite $A$-algebra by Lemma \ref{lemma-extend-S2} applied to $W_0 \to U \subset X$ (exactly as we did for $B \to C$ above). Since the construction in Lemma \ref{lemma-extend-S2} is compatible with flat base change and with change of opens, the isomorphism above induces an isomorphism $$ \Psi : C \longrightarrow C_0 \otimes_A B $$ of finite $B$-algebras. However, we know that $\Spec(C) \to Y$ is \'etale at all points above at least one point of $Y$ lying over $\mathfrak m \in X$. Since $\Psi$ is an isomorphism, we conclude that $\Spec(C_0) \to X$ is \'etale above $\mathfrak m$ (small detail omitted). Of course this means that $A \to C_0$ is finite \'etale and hence $B \to C$ is finite \'etale.
The functor is fully faithful by Lemma \ref{lemma-quasi-compact-dense-open-connected-at-infinity-Noetherian} combined with Local Cohomology, Lemma \ref{local-cohomology-lemma-depth-2-connected-punctured-spectrum} (plus an application of Algebra, Lemma \ref{algebra-lemma-apply-grothendieck} to check the depth condition). \medskip\noindent Let $\pi : V \to U$ be a finite \'etale morphism. Let $Y \to X$ be the finite morphism constructed in Lemma \ref{lemma-extend-S2}. We have to show that $Y \to X$ is finite \'etale. To show that this is true for all points $x \in X$ mapping to a given point $s \in S$ we may perform a base change by a flat morphism $S' \to S$ of Noetherian schemes such that $s$ is in the image. This follows from the compatibility of the construction in Lemma \ref{lemma-extend-S2} with flat base change. \medskip\noindent After enlarging $U$ we may assume $U \subset X$ is the maximal open over which $Y \to X$ is finite \'etale. Let $Z \subset X$ be the complement of $U$. To get a contradiction, assume $Z \not = \emptyset$. Let $s \in S$ be a point in the image of $Z \to S$ such that no strict generalization of $s$ is in the image. Then after base change to $\Spec(\mathcal{O}_{S, s})$ we see that $S = \Spec(A)$ with $(A, \mathfrak m, \kappa)$ a local Noetherian ring of depth $\geq 2$ and $Z$ contained in the closed fibre $X_s$ and nowhere dense in $X_s$. Choose a closed point $z \in Z$. Then $\kappa(z)/\kappa$ is finite (by the Hilbert Nullstellensatz, see Algebra, Theorem \ref{algebra-theorem-nullstellensatz}). Choose a finite flat morphism $(S', s') \to (S, s)$ of local schemes realizing the residue field extension $\kappa(z)/\kappa$, see Algebra, Lemma \ref{algebra-lemma-finite-free-given-residue-field-extension}. After doing a base change by $S' \to S$ we reduce to the case where $\kappa(z) = \kappa$. \medskip\noindent By More on Morphisms, Lemma \ref{more-morphisms-lemma-slice-smooth} there exists a locally closed subscheme $S' \subset X$ passing through $z$ such that $S' \to S$ is \'etale at $z$. After performing the base change by $S' \to S$, we may assume there is a section $\sigma : S \to X$ such that $\sigma(s) = z$. Choose an affine neighbourhood $\Spec(B) \subset X$ of $s$. Then $A \to B$ is a smooth ring map which has a section $\sigma : B \to A$. Denote $I = \Ker(\sigma)$ and denote $B^\wedge$ the $I$-adic completion of $B$. Then $B^\wedge \cong A[[x_1, \ldots, x_d]]$ for some $d \geq 0$, see Algebra, Lemma \ref{algebra-lemma-section-smooth}. Observe that $d > 0$ since otherwise we see that $X \to S$ is \'etale at $z$ which would imply that $z$ is a generic point of $X_s$ and hence $z \in U$ by assumption (4). Similarly, if $d > 0$, then $\mathfrak m B^\wedge$ maps into $U$ via the morphism $\Spec(B^\wedge) \to X$. It suffices prove $Y \to X$ is finite \'etale after base change to $\Spec(B^\wedge)$. Since $B \to B^\wedge$ is flat (Algebra, Lemma \ref{algebra-lemma-completion-flat}) this follows from Lemma \ref{lemma-purity-power-series-over-depth2} and the uniqueness in the construction of $Y \to X$.