hcju/stacksqa huggingface dataset:
We may assume $N \geq 2$. Apply Lemma \ref{lemma-map-approximation} to get $(U, u) \to (X, x)$ and $f : (U, u) \to (Y, y)$. We claim that $f$ is \'etale at $u$ which will finish the proof. In fact, we will show that the induced map $\mathcal{O}_{Y, y}^\wedge \to \mathcal{O}_{U, u}^\wedge$ is an isomorphism. Having proved this, Lemma \ref{lemma-lifting-along-artinian-at-point} will show that $f$ is smooth at $u$ and of course $f$ is unramified at $u$ as well, so Morphisms, Lemma \ref{morphisms-lemma-etale-smooth-unramified} tells us $f$ is \'etale at $u$. For a local ring $(R, \mathfrak m)$ we set $\text{Gr}_\mathfrak m(R) = \bigoplus_{n \geq 0} \mathfrak m^n/\mathfrak m^{n + 1}$. To prove the claim we look at the induced diagram of graded rings $$ \xymatrix{ & \text{Gr}_{\mathfrak m_u}(\mathcal{O}_{U, u}) \\ \text{Gr}_{\mathfrak m_y}(\mathcal{O}_{Y, y}) \ar[rr]^\varphi \ar[ru] & & \text{Gr}_{\mathfrak m_x}(\mathcal{O}_{X, x}) \ar[lu] } $$ Since $N \geq 2$ this diagram is actually commutative as the displayed graded algebras are generated in degree $1$! By assumption the lower arrow is an isomorphism. By More on Algebra, Lemma \ref{more-algebra-lemma-flat-unramified} (for example) the map $\mathcal{O}_{X, x}^\wedge \to \mathcal{O}_{U, u}^\wedge$ is an isomorphism and hence the north-west arrow in the diagram is an isomorphism. We conclude that $f$ induces an isomorphism $\text{Gr}_{\mathfrak m_x}(\mathcal{O}_{X, x}) \to \text{Gr}_{\mathfrak m_y}(\mathcal{O}_{U, u})$. Using induction and the short exact sequences $$ 0 \to \text{Gr}^n_{\mathfrak m}(R) \to R/\mathfrak m^{n + 1} \to R/\mathfrak m^n \to 0 $$ for both local rings we conclude (from the snake lemma) that $f$ induces isomorphisms $\mathcal{O}_{Y, y}/\mathfrak m_y^n \to \mathcal{O}_{U, u}/\mathfrak m_u^n$ for all $n$ which is what we wanted to show.
Denote $X_\sigma = X \times_S \Spec(\mathcal{O}_{S, s}^\wedge)$ and $x_\sigma \in X_\sigma$ the unique point lying over $x$. Observe that $\mathcal{O}_{S, s}^\wedge$ is a G-ring by More on Algebra, Proposition \ref{more-algebra-proposition-Noetherian-complete-G-ring}. By Lemma \ref{lemma-isomorphism-approximation} we can choose $$ (X_\sigma, x_\sigma) \leftarrow (U, u) \rightarrow (Y_\sigma, y_\sigma) $$ where both arrows are elementary \'etale neighbourhoods. \medskip\noindent After replacing $S$ by an open neighbourhood of $s$, we may assume $S = \Spec(R)$ is affine. Since $\mathcal{O}_{S, s}$ is a G-ring by Smoothing Ring Maps, Theorem \ref{smoothing-theorem-popescu} the ring $\mathcal{O}_{S, s}^\wedge$ is a filtered colimit of smooth $R$-algebras. Thus we can write $$ \Spec(\mathcal{O}_{S, s}^\wedge) = \lim S_i $$ as a directed limit of affine schemes $S_i$ smooth over $S$. Denote $s_i \in S_i$ the image of the closed point of $\Spec(\mathcal{O}_{S, s}^\wedge)$. Observe that $\kappa(s) = \kappa(s_i)$. Set $X_i = X \times_S S_i$ and denote $x_i \in X_i$ the unique point mapping to $x$. Note that $\kappa(x) = \kappa(x_i)$. Since $T$ is of finite type over $\mathbf{Z}$ by Limits, Proposition \ref{limits-proposition-characterize-locally-finite-presentation} we can choose an $i$ and a morphism $\sigma_i : (S_i, s_i) \to (T, t)$ of pointed schemes whose composition with $\Spec(\mathcal{O}_{S, s}) \to S_i$ is equal to $\sigma$. Set $Y_i = Y \times_T S_i$ and denote $y_i$ the image of $y_\sigma$. Note that $\kappa(y_i) = \kappa(y_\sigma)$. By Limits, Lemma \ref{limits-lemma-descend-finite-presentation} we can choose an $i$ and a diagram $$ \xymatrix{ X_i \ar[rd] & U_i \ar[l] \ar[d] \ar[r] & Y_i \ar[ld] \\ & S_i } $$ whose base change to $\Spec(\mathcal{O}_{S, s}^\wedge)$ recovers $X_\sigma \leftarrow U \rightarrow Y_\sigma$. By Limits, Lemma \ref{limits-lemma-descend-etale} after increasing $i$ we may assume the morphisms $X_i \leftarrow U_i \rightarrow Y_i$ are \'etale. Let $u_i \in U_i$ be the image of $u$. Then $u_i \mapsto x_i$ hence $\kappa(x) = \kappa(x_\sigma) = \kappa(u) \supset \kappa(u_i) \supset \kappa(x_i) = \kappa(x)$ and we see that $\kappa(u_i) = \kappa(x_i)$. Hence $(X_i, x_i) \leftarrow (U_i, u_i)$ is an elementary \'etale neighbourhood. Since also $\kappa(y_i) = \kappa(y_\sigma) = \kappa(u)$ we see that also $(U_i, u_i) \to (Y_i, y_i)$ is an elementary \'etale neighbourhood. \medskip\noindent At this point we have constructed a diagram $$ \xymatrix{ X \ar[d] & X \times_S S_i \ar[l] \ar[rd] & U_i \ar[l] \ar[r] \ar[d] & Y \times_T S_i \ar[r] \ar[ld] & Y \ar[d] \\ S & & S_i \ar[ll] \ar[rr] & & T } $$ as in the statement of the lemma, except that $S_i \to S$ is smooth. By Lemma \ref{lemma-slice-smooth} and after shrinking $S_i$ we can assume there exists a closed subscheme $V \subset S_i$ passing through $s_i$ such that $V \to S$ is \'etale. Setting $W$ equal to the scheme theoretic inverse image of $V$ in $U_i$ we conclude.
We may assume $N \geq 2$ and we may replace $(T, t)$ with $(T', t')$ as in Lemma \ref{lemma-control-graded}. Since $(V, v) \to (S, s)$ is an elementary \'etale neighbourhood, so is $(X \times_S V, (x, v)) \to (X, x)$. Thus $\mathcal{O}_{X, x} \to \mathcal{O}_{X \times_S V, (x, v)}$ induces an isomorphism on completions by More on Algebra, Lemma \ref{more-algebra-lemma-flat-unramified}. We claim $\mathcal{O}_{X, x} \to \mathcal{O}_{W, w}$ induces an isomorphism on completions. Having proved this, Lemma \ref{lemma-lifting-along-artinian-at-point} will show that $f$ is smooth at $w$ and of course $f$ is unramified at $u$ as well, so Morphisms, Lemma \ref{morphisms-lemma-etale-smooth-unramified} tells us $f$ is \'etale at $w$. \medskip\noindent First we use the commutativity in part (5) of Lemma \ref{lemma-relative-map-approximation} to see that for $i \leq N$ there is a commutative diagram $$ \xymatrix{ \text{Gr}^i_{\mathfrak m_x}(\mathcal{O}_{X, x}) \ar[r]_-\varphi & \text{Gr}^i_{\mathfrak m_{y_\sigma}}(\mathcal{O}_{Y_\sigma, y_\sigma}^\wedge) \ar@{=}[r] & \text{Gr}^i_{\mathfrak m_{(y, v)}}(\mathcal{O}_{Y \times_{T, \tau} V, (y, v)}) \ar[d]_{\cong} \\ \text{Gr}^i_{\mathfrak m_x}(\mathcal{O}_{X, x}) \ar[r]^-{\cong} \ar@{=}[u] & \text{Gr}^i_{\mathfrak m_{(x, v)}}(\mathcal{O}_{X \times_S V, (x, v)}) \ar[r]^{f^\sharp_w} & \text{Gr}^i_{\mathfrak m_w}(\mathcal{O}_{W, w}) } $$ This implies that $f^\sharp_w$ defines an isomorphism $\kappa(x) \to \kappa(w)$ on residue fields and an isomorphism $\mathfrak m_x/\mathfrak m_x^2 \to \mathfrak m_w/\mathfrak m_w^2$ on cotangent spaces. Hence $f^\sharp_w$ defines a surjection $\mathcal{O}_{X, x}^\wedge \to \mathcal{O}_{W, w}^\wedge$ on complete local rings. \medskip\noindent By Lemma \ref{lemma-control-graded} there is an isomorphism of $\text{Gr}_{\mathfrak m_s}(\mathcal{O}_{(Y \times_{T, \tau} V, (y, v)})$ with $\text{Gr}_{\mathfrak m_s}(\mathcal{O}_{Y_\sigma, y_\sigma})$. This follows by taking stalks of the isomorphism of conormal sheaves at the point $y$. Since our local rings are Noetherian taking associated graded with respect to $\mathfrak m_s$ commutes with completion because completion with respect to an ideal is an exact functor on finite modules over Noetherian rings. This produces the right vertical isomorphism in the diagram of graded rings $$ \xymatrix{ \text{Gr}_{\mathfrak m_s}(\mathcal{O}_{W, w}^\wedge) & \text{Gr}_{\mathfrak m_s} (\mathcal{O}_{(Y \times_{T, \tau} V, (y, v)}^\wedge) \ar[l] \\ \text{Gr}_{\mathfrak m_s}(\mathcal{O}_{X, x}^\wedge) \ar[r]^\varphi \ar[u] & \text{Gr}_{\mathfrak m_s}(\mathcal{O}_{Y_\sigma, y_\sigma}^\wedge) \ar[u]_{\cong} } $$ We do not claim the diagram commutes. By the result of the previous paragraph the left arrow is surjective. The other three arrows are isomorphisms. It follows that the left arrow is a surjective map between isomorphic Noetherian rings. Hence it is an isomorphism by Algebra, Lemma \ref{algebra-lemma-surjective-endo-noetherian-ring-is-iso} (you can argue this directly using Hilbert functions as well). In particular $\mathcal{O}_{X, x}^\wedge \to \mathcal{O}_{W, w}^\wedge$ must be injective as well as surjective which finishes the proof.
The problem is local on $S$ hence we may replace $S$ by any open neighbourhood of $s$. We may also replace $U$ by an open neighbourhood of $u$. Hence, by Morphisms, Lemma \ref{morphisms-lemma-etale-locally-standard-etale} we may assume that $U \to S$ is a standard \'etale morphism of affine schemes. In this case the lemma (with $V = S$) follows from Algebra, Lemma \ref{algebra-lemma-standard-etale-finite-flat-Zariski}.
Let $Y \subset X$, $W \subset S$ be affine opens such that $f(Y) \subset W$ and such that $x \in Y$. Note that $x$ is also an isolated point of the fibre of the morphism $f|_Y : Y \to W$. If we can prove the theorem for $f|_Y : Y \to W$, then the theorem follows for $f$. Hence we reduce to the case where $f$ is a morphism of affine schemes. This case is Algebra, Lemma \ref{algebra-lemma-etale-makes-quasi-finite-finite-one-prime}.
We will use induction on $n$. Namely, suppose $(U, u) \to (S, s)$ and $V_i \subset X_U$, $i = 1, \ldots, n - 1$ work for $x_1, \ldots, x_{n - 1}$. Since $\kappa(s) = \kappa(u)$ the fibre $(X_U)_u = X_s$. Hence there exists a unique point $x'_n \in X_u \subset X_U$ corresponding to $x_n \in X_s$. Also $x'_n$ is isolated in $X_u$. Hence by Lemma \ref{lemma-etale-makes-quasi-finite-finite-at-point} there exists an elementary \'etale neighbourhood $(U', u') \to (U, u)$ and an open $V_n \subset X_{U'}$ which works for $x'_n$ and hence for $x_n$. By the final assertion of Lemma \ref{lemma-etale-makes-quasi-finite-finite-at-point} the open subschemes $V'_i = U'\times_U V_i$ for $i = 1, \ldots, n - 1$ still work with respect to $x_1, \ldots, x_{n - 1}$. Hence we win.
This proof is a variant of the proof of Algebra, Lemma \ref{algebra-lemma-etale-makes-quasi-finite-finite-variant} in the language of schemes. By Morphisms, Lemma \ref{morphisms-lemma-quasi-finite-at-point-characterize} the morphism $f$ is quasi-finite at each of the points $x_i$. Hence $\kappa(s) \subset \kappa(x_i)$ is finite for each $i$ (Morphisms, Lemma \ref{morphisms-lemma-residue-field-quasi-finite}). For each $i$, let $\kappa(s) \subset L_i \subset \kappa(x_i)$ be the subfield such that $L_i/\kappa(s)$ is separable, and $\kappa(x_i)/L_i$ is purely inseparable. Choose a finite Galois extension $\kappa(s) \subset L$ such that there exist $\kappa(s)$-embeddings $L_i \to L$ for $i = 1, \ldots, n$. Choose an \'etale neighbourhood $(U, u) \to (S, s)$ such that $L \cong \kappa(u)$ as $\kappa(s)$-extensions (Lemma \ref{lemma-realize-prescribed-residue-field-extension-etale}). \medskip\noindent Let $y_{i, j}$, $j = 1, \ldots, m_i$ be the points of $X_U$ lying over $x_i \in X$ and $u \in U$. By Schemes, Lemma \ref{schemes-lemma-points-fibre-product} these points $y_{i, j}$ correspond exactly to the primes in the rings $\kappa(u) \otimes_{\kappa(s)} \kappa(x_i)$. This also explains why there are finitely many; in fact $m_i = [L_i : \kappa(s)]$ but we do not need this. By our choice of $L$ (and elementary field theory) we see that $\kappa(u) \subset \kappa(y_{i, j})$ is finite purely inseparable for each pair $i, j$. Also, by Morphisms, Lemma \ref{morphisms-lemma-base-change-quasi-finite} for example, the morphism $X_U \to U$ is quasi-finite at the points $y_{i, j}$ for all $i, j$. \medskip\noindent Apply Lemma \ref{lemma-etale-makes-quasi-finite-finite-multiple-points} to the morphism $X_U \to U$, the point $u \in U$ and the points $y_{i, j} \in (X_U)_u$. This gives an \'etale neighbourhood $(U', u') \to (U, u)$ with $\kappa(u) = \kappa(u')$ and opens $V_{i, j} \subset X_{U'}$ with the properties (\romannumeral1), (\romannumeral2), and (\romannumeral3) of that lemma. We claim that the \'etale neighbourhood $(U', u') \to (S, s)$ and the opens $V_{i, j} \subset X_{U'}$ are a solution to the problem posed by the lemma. We omit the verifications.
Choose $(U, u) \to (S, s)$ and $V_i \subset X_U$ as in Lemma \ref{lemma-etale-makes-quasi-finite-finite-multiple-points}. Since $X_U \to U$ is separated (Schemes, Lemma \ref{schemes-lemma-separated-permanence}) and $V_i \to U$ is finite hence proper (Morphisms, Lemma \ref{morphisms-lemma-finite-proper}) we see that $V_i \subset X_U$ is closed by Morphisms, Lemma \ref{morphisms-lemma-image-proper-scheme-closed}. Hence $V_i \cap V_j$ is a closed subset of $V_i$ which does not contain $v_i$. Hence the image of $V_i \cap V_j$ in $U$ is a closed set (because $V_i \to U$ proper) not containing $u$. After shrinking $U$ we may therefore assume that $V_i \cap V_j = \emptyset$ for all $i, j$. This gives the decomposition as in the lemma.
[First proof] This proof uses Algebra, Lemma \ref{algebra-lemma-etale-makes-quasi-finite-finite-variant}. Namely, choose a generator $\theta_i \in \kappa(\mathfrak q_i)_{sep}$ of this field over $\kappa(\mathfrak p)$ (Fields, Lemma \ref{fields-lemma-primitive-element}). The spectrum of the fibre ring $S \otimes_R \kappa(\mathfrak p)$ is finite discrete with points corresponding to $\mathfrak q_1, \ldots, \mathfrak q_n$. By the Chinese remainder theorem (Algebra, Lemma \ref{algebra-lemma-chinese-remainder}) we see that $S \otimes_R \kappa(\mathfrak p) \to \prod \kappa(\mathfrak q_i)$ is surjective. Hence after replacing $R$ by $R_g$ for some $g \in R$, $g \not \in \mathfrak p$ we may assume that $(0, \ldots, 0, \theta_i, 0, \ldots, 0) \in \prod \kappa(\mathfrak q_i)$ is the image of some $x_i \in S$. Let $S' \subset S$ be the $R$-subalgebra generated by our $x_i$. Since $\Spec(S) \to \Spec(S')$ is surjective (Algebra, Lemma \ref{algebra-lemma-integral-overring-surjective}) we conclude that $\mathfrak q_i' = S' \cap \mathfrak q_i$ are the primes of $S'$ over $\mathfrak p$. By our choice of $x_i$ we conclude these primes are distinct that and $\kappa(\mathfrak q'_i)_{sep} = \kappa(\mathfrak q_i)_{sep}$. In particular the field extensions $\kappa(\mathfrak q_i)/\kappa(\mathfrak q'_i)$ are purely inseparable. Since $R \to S'$ is finite we may apply Algebra, Lemma \ref{algebra-lemma-etale-makes-quasi-finite-finite-variant}. and we get $R \to R'$ and $\mathfrak p'$ and a decomposition $$ S' \otimes_R R' = A'_1 \times \ldots \times A'_m \times B' $$ with $R' \to A'_j$ integral having a unique prime $\mathfrak r'_j$ over $\mathfrak p'$ such that $\kappa(\mathfrak r'_j)/\kappa(\mathfrak p')$ is purely inseparable and such that $B'$ does not have a prime lying over $\mathfrak p'$. Since $R' \to B'$ is finite (as $R \to S'$ is finite) we can after localizing $R'$ at some $g' \in R'$, $g' \not \in \mathfrak p'$ assume that $B' = 0$. Via the map $S' \otimes_R R' \to S \otimes_R R'$ we get the corresponding decomposition for $S$.
This follows from Lemma \ref{lemma-finite-type-separated}. Namely, by that lemma there exists an open subscheme $U' \subset S'$ such that $(f')^{-1}(U') = X$ and $X \to U'$ is an isomorphism. In other words, $f'$ is an open immersion. Note that $f'$ is quasi-compact as $f$ is quasi-compact and $\nu : S' \to S$ is separated (Schemes, Lemma \ref{schemes-lemma-quasi-compact-permanence}). It follows that $f$ is quasi-affine by Morphisms, Lemma \ref{morphisms-lemma-characterize-quasi-affine}.
Let $X \to S' \to S$ be as in the conclusion of Lemma \ref{lemma-quasi-finite-separated-quasi-affine}. By Properties, Lemma \ref{properties-lemma-integral-algebra-directed-colimit-finite} we can write $\nu_*\mathcal{O}_{S'} = \colim_{i \in I} \mathcal{A}_i$ as a directed colimit of finite quasi-coherent $\mathcal{O}_X$-algebras $\mathcal{A}_i \subset \nu_*\mathcal{O}_{S'}$. Then $\pi_i : T_i = \underline{\Spec}_S(\mathcal{A}_i) \to S$ is a finite morphism for each $i$. Note that the transition morphisms $T_{i'} \to T_i$ are affine and that $S' = \lim T_i$. \medskip\noindent By Limits, Lemma \ref{limits-lemma-descend-opens} there exists an $i$ and a quasi-compact open $U_i \subset T_i$ whose inverse image in $S'$ equals $f'(X)$. For $i' \geq i$ let $U_{i'}$ be the inverse image of $U_i$ in $T_{i'}$. Then $X \cong f'(X) = \lim_{i' \geq i} U_{i'}$, see Limits, Lemma \ref{limits-lemma-directed-inverse-system-has-limit}. By Limits, Lemma \ref{limits-lemma-finite-type-eventually-closed} we see that $X \to U_{i'}$ is a closed immersion for some $i' \geq i$. (In fact $X \cong U_{i'}$ for sufficiently large $i'$ but we don't need this.) Hence $X \to T_{i'}$ is an immersion. By Morphisms, Lemma \ref{morphisms-lemma-factor-quasi-compact-immersion} we can factor this as $X \to T \to T_{i'}$ where the first arrow is an open immersion and the second a closed immersion. Thus we win.
By Limits, Lemma \ref{limits-lemma-finite-in-finite-and-finite-presentation} we can write $T = \lim T_i$ where all $T_i$ are finite and of finite presentation over $Y$ and the transition morphisms $T_{i'} \to T_i$ are closed immersions. By Limits, Lemma \ref{limits-lemma-descend-opens} there exists an $i$ and an open subscheme $U_i \subset T_i$ whose inverse image in $T$ is $X$. By Limits, Lemma \ref{limits-lemma-finite-type-eventually-closed} we see that $X \cong U_i$ for large enough $i$. Replacing $T$ by $T_i$ finishes the proof.
We have (1) implies (2) by Morphisms, Lemmas \ref{morphisms-lemma-finite-proper}, \ref{morphisms-lemma-quasi-finite}, and \ref{morphisms-lemma-finite-quasi-finite}. We have (2) implies (3) by Morphisms, Lemma \ref{morphisms-lemma-finite-fibre}. We have (3) implies (4) by the definition of proper morphisms and Morphisms, Lemmas \ref{morphisms-lemma-quasi-finite-locally-quasi-compact} and \ref{morphisms-lemma-quasi-finite}. \medskip\noindent Assume (4). Pick $s \in S$. By Morphisms, Lemma \ref{morphisms-lemma-finite-fibre} we see that all the finitely many points of $X_s$ are isolated in $X_s$. Choose an elementary \'etale neighbourhood $(U, u) \to (S, s)$ and decomposition $X_U = V \amalg W$ as in Lemma \ref{lemma-etale-splits-off-quasi-finite-part}. Note that $W_u = \emptyset$ because all points of $X_s$ are isolated. Since $f$ is universally closed we see that the image of $W$ in $U$ is a closed set not containing $u$. After shrinking $U$ we may assume that $W = \emptyset$. In other words we see that $X_U = V$ is finite over $U$. Since $s \in S$ was arbitrary this means there exists a family $\{U_i \to S\}$ of \'etale morphisms whose images cover $S$ such that the base changes $X_{U_i} \to U_i$ are finite. Note that $\{U_i \to S\}$ is an \'etale covering, see Topologies, Definition \ref{topologies-definition-etale-covering}. Hence it is an fpqc covering, see Topologies, Lemma \ref{topologies-lemma-zariski-etale-smooth-syntomic-fppf-fpqc}. Hence we conclude $f$ is finite by Descent, Lemma \ref{descent-lemma-descending-property-finite}.
The morphism $f$ is quasi-finite at all the points of $f^{-1}(\{s\})$ by Morphisms, Lemma \ref{morphisms-lemma-finite-fibre}. By Morphisms, Lemma \ref{morphisms-lemma-quasi-finite-points-open} the set of points at which $f$ is quasi-finite is an open $U \subset X$. Let $Z = X \setminus U$. Then $s \not \in f(Z)$. Since $f$ is proper the set $f(Z) \subset S$ is closed. Choose any open neighbourhood $V \subset S$ of $s$ with $f(Z) \cap V = \emptyset$. Then $f^{-1}(V) \to V$ is locally quasi-finite and proper. Hence it is quasi-finite (Morphisms, Lemma \ref{morphisms-lemma-quasi-finite-locally-quasi-compact}), hence has finite fibres (Morphisms, Lemma \ref{morphisms-lemma-quasi-finite}), hence is finite by Lemma \ref{lemma-characterize-finite}.
Let $Z \subset Y$ be the scheme theoretic image of $h$, see Morphisms, Section \ref{morphisms-section-scheme-theoretic-image}. By Morphisms, Lemma \ref{morphisms-lemma-scheme-theoretic-image-is-proper} the morphism $X \to Z$ is surjective and $Z \to S$ is proper. Thus $X_s \to Z_s$ is surjective. We see that either (3) implies $Z_s$ is finite. Hence $Z \to S$ is finite in an open neighbourhood of $s$ by Lemma \ref{lemma-proper-finite-fibre-finite-in-neighbourhood}.
Let $x_1, \ldots, x_n \in X$. Choose a quasi-compact open $U \subset X$ with $x_i \in U$. Then $U \to Y$ is quasi-affine by Lemma \ref{lemma-quasi-finite-separated-quasi-affine}. Hence there exists an affine open $V \subset U$ containing $x_1, \ldots, x_n$ by Properties, Lemma \ref{properties-lemma-ample-finite-set-in-affine}.
The question is local on $S$, hence we may assume that $S$ is affine. By Morphisms, Lemma \ref{morphisms-lemma-locally-quasi-finite-qc-source-universally-bounded} the fibres of $f$ are universally bounded in this case. Hence the existence of the stratification follows from Lemma \ref{lemma-stratify-flat-fp-lqf-universally-bounded}. \medskip\noindent We will show that $U_r = S \setminus Z_r \to S$ is quasi-compact for each $r \geq 0$. This will prove the final statement by elementary topology. Since a composition of quasi-compact maps is quasi-compact it suffices to prove that $U_r \to U_{r - 1}$ is quasi-compact. Choose an affine open $W \subset U_{r - 1}$. Write $W = \Spec(A)$. Then $Z_r \cap W = V(I)$ for some ideal $I \subset A$ and $X \times_S \Spec(A/I) \to \Spec(A/I)$ is finite locally free of degree $r$. Note that $A/I = \colim A/I_i$ where $I_i \subset I$ runs through the finitely generated ideals. By Limits, Lemma \ref{limits-lemma-descend-finite-locally-free} we see that $X \times_S \Spec(A/I_i) \to \Spec(A/I_i)$ is finite locally free of degree $r$ for some $i$. (This uses that $X \to S$ is of finite presentation, as it is locally of finite presentation, separated, and quasi-compact.) Hence $\Spec(A/I_i) \to \Spec(A) = W$ factors (set theoretically) through $Z_r \cap W$. It follows that $Z_r \cap W = V(I_i)$ is the zero set of a finite subset of elements of $A$. This means that $W \setminus Z_r$ is a finite union of standard opens, hence quasi-compact, as desired.
The statement simply means that the collection of points where the degree of the fibre is $\geq d$ is open. Thus we can work locally on $S$ and assume $S$ is affine. In this case, for every $W \subset X$ quasi-compact open, the set of points $U_d(W)$ where the fibres of $W \to S$ have degree $\geq d$ is open by Lemma \ref{lemma-stratify-flat-fp-qf}. Since $U_d = \bigcup_W U_d(W)$ the result follows.
We may assume $X$ and $S$ affine. We obtain a filtration $\emptyset = Z_{-1} \subset Z_0 \subset Z_1 \subset Z_2 \subset \ldots \subset Z_n = S$ as in Lemmas \ref{lemma-stratify-flat-fp-lqf-universally-bounded} and \ref{lemma-stratify-flat-fp-qf}. Let $T \subset X$ be the scheme theoretic support of the finite $\mathcal{O}_X$-module $\Im(g : \mathcal{O}_X \to \mathcal{O}_X)$. Note that $T$ is the support of $g$ as a section of $\mathcal{O}_X$ (Modules, Definition \ref{modules-definition-support}) and for any open $V \subset X$ we have $g|_V \not = 0$ if and only if $V \cap T \not = \emptyset$. Let $r$ be the smallest integer such that $f(T) \subset Z_r$ set theoretically. Let $\xi \in T$ be a generic point of an irreducible component of $T$ such that $f(\xi) \not \in Z_{r - 1}$ (and hence $f(\xi) \in Z_r$). We may replace $S$ by an affine neighbourhood of $f(\xi)$ contained in $S \setminus Z_{r - 1}$. Write $S = \Spec(A)$ and let $I = (a_1, \ldots, a_m) \subset A$ be a finitely generated ideal such that $V(I) = Z_r$ (set theoretically, see Algebra, Lemma \ref{algebra-lemma-qc-open}). Since the support of $g$ is contained in $f^{-1}V(I)$ by our choice of $r$ we see that there exists an integer $N$ such that $a_j^N g = 0$ for $j = 1, \ldots, m$. Replacing $a_j$ by $a_j^r$ we may assume that $Ig = 0$. For any $A$-module $M$ write $M[I]$ for the $I$-torsion of $M$, i.e., $M[I] = \{m \in M \mid Im = 0\}$. Write $X = \Spec(B)$, so $g \in B[I]$. Since $A \to B$ is flat we see that $$ B[I] = A[I] \otimes_A B \cong A[I] \otimes_{A/I} B/IB $$ By our choice of $Z_r$, the $A/I$-module $B/IB$ is finite locally free of rank $r$. Hence after replacing $S$ by a smaller affine open neighbourhood of $f(\xi)$ we may assume that $B/IB \cong (A/IA)^{\oplus r}$ as $A/I$-modules. Choose a map $\psi : A^{\oplus r} \to B$ which reduces modulo $I$ to the isomorphism of the previous sentence. Then we see that the induced map $$ A[I]^{\oplus r} \longrightarrow B[I] $$ is an isomorphism. The lemma follows by taking $\mathcal{F}$ the quasi-coherent sheaf associated to the $A$-module $A[I]$ and the map $\mathcal{F}^{\oplus r} \to \pi_*\mathcal{O}_V$ the one corresponding to $A[I]^{\oplus r} \subset A^{\oplus r} \to B$.