hcju/stacksqa huggingface dataset:
By assumption the schemes $S$ and $Y$ are affine. Write $S = \Spec(A)$ and $Y = \Spec(B)$. As $\pi$ is finite the $\mathcal{O}_Y$-module $\pi_*\mathcal{G}$ is a finite type quasi-coherent $\mathcal{O}_Y$-module. Hence $\pi_*\mathcal{G} = \widetilde{N}$ for some finite $B$-module $N$. Let $\mathfrak p \subset B$ be the prime ideal corresponding to $\xi$. To obtain $\alpha$ set $r = \dim_{\kappa(\mathfrak p)} N \otimes_B \kappa(\mathfrak p)$ and pick $x_1, \ldots, x_r \in N$ which form a basis of $N \otimes_B \kappa(\mathfrak p)$. Take $\alpha : B^{\oplus r} \to N$ to be the map given by the formula $\alpha(b_1, \ldots, b_r) = \sum b_ix_i$. It is clear that $\alpha : \kappa(\mathfrak p)^{\oplus r} \to N \otimes_B \kappa(\mathfrak p)$ is an isomorphism as desired. Finally, suppose $\alpha$ is any map with this property. Then $N' = \Coker(\alpha)$ is a finite $B$-module such that $N' \otimes \kappa(\mathfrak p) = 0$. By Nakayama's lemma (Algebra, Lemma \ref{algebra-lemma-NAK}) we see that $N'_{\mathfrak p} = 0$. Since the fibre $Y_s$ is geometrically irreducible of dimension $n$ with generic point $\xi$ and since we have just seen that $\xi$ is not in the support of $\Coker(\alpha)$ the last assertion of the lemma holds.
By Lemma \ref{lemma-base-change-one-step} we know that the base change of a one step d\'evissage is a one step d\'evissage. Hence it suffices to prove that formation of $\Coker(\alpha_k)$ commutes with base change and that condition (2) of Definition \ref{definition-complete-devissage} is preserved by base change. The first is true as $\pi'_{k, *}\mathcal{G}'_k$ is the pullback of $\pi_{k, *}\mathcal{G}_k$ (by Cohomology of Schemes, Lemma \ref{coherent-lemma-affine-base-change}) and because $\otimes$ is right exact. The second because by the same token we have $$ (\pi_{k, *}\mathcal{G}_k)_{\xi_k} \otimes_{\mathcal{O}_{Y_k, \xi_k}} \kappa(\xi_k) \otimes_{\kappa(\xi_k)} \kappa(\xi'_k) \cong (\pi'_{k, *}\mathcal{G}'_k)_{\xi'_k} \otimes_{\mathcal{O}_{Y'_k, \xi'_k}} \kappa(\xi'_k) $$ with obvious notation.
Part (1) is immediate from Lemmas \ref{lemma-base-change-complete-at-x} and \ref{lemma-shrink}. \medskip\noindent Proof of (2). For convenience denote $X = Y_0$. We apply Lemma \ref{lemma-shrink} (\ref{item-shrink-on-Y}) to find a standard shrinking $S', Y'_{n - 1}, Z'_n, Y'_n$ of the one step d\'evissage of $\Coker(\alpha_{n - 1})/Y_{n - 1}/S$ at $y_{n - 1}$ with $Y'_n = W \times_S S'$. We may repeat this procedure and find a standard shrinking $S'', Y''_{n - 2}, Z''_{n - 1}, Y''_{n - 1}$ of the one step d\'evissage of $\Coker(\alpha_{n - 2})/Y_{n - 2}/S$ at $y_{n - 2}$ with $Y''_{n - 1} = Y'_{n - 1} \times_S S''$. We may continue in this manner until we obtain $S^{(n)}, Y^{(n)}_0, Z^{(n)}_1, Y^{(n)}_1$. At this point it is clear that we obtain our desired standard shrinking by taking $S^{(n)}$, $X^{(n)}$, $Z_k^{(n - k)} \times_S S^{(n)}$, and $Y_k^{(n - k)} \times_S S^{(n)}$ with the desired property. \medskip\noindent Proof of (3). We use induction on the length of the complete d\'evissage. First we apply Lemma \ref{lemma-shrink} (\ref{item-shrink-on-X}) to find a standard shrinking $S', X', Z'_1, Y'_1$ of the one step d\'evissage of $\mathcal{F}/X/S$ at $x$ with $X' \subset U$. If $n = 1$, then we are done. If $n > 1$, then by induction we can find a standard shrinking $S''$, $Y''_1$, $Z''_k$, and $Y''_k$ of the complete d\'evissage $(Z_k, Y_k, i_k, \pi_k, \mathcal{G}_k, \alpha_k, z_k, y_k)_{k = 2, \ldots, n}$ of $\Coker(\alpha_1)/Y_1/S$ at $x$ such that $Y''_1 \subset Y'_1$. Using Lemma \ref{lemma-shrink} (\ref{item-shrink-on-Y}) we can find $S''' \subset S'$, $X''' \subset X'$, $Z'''_1$ and $Y'''_1 = Y''_1 \times_S S'''$ which is a standard shrinking. The solution to our problem is to take $$ S''', X''', Z'''_1, Y'''_1, Z''_2 \times_S S''', Y''_2 \times_S S''', \ldots, Z''_n \times_S S''', Y''_n \times_S S''' $$ This ends the proof of the lemma.
For every point $x \in X_s$ we can find a diagram $$ \xymatrix{ (X, x) \ar[d] & (X', x') \ar[l]^g \ar[d] \\ (S, s) & (S', s') \ar[l] } $$ of pointed schemes such that the horizontal arrows are elementary \'etale neighbourhoods and such that $g^*\mathcal{F}/X'/S'$ has a complete d\'evissage at $x'$. As $X \to S$ is of finite type the fibre $X_s$ is quasi-compact, and since each $g : X' \to X$ as above is open we can cover $X_s$ by a finite union of $g(X'_{s'})$. Thus we can find a finite family of such diagrams $$ \vcenter{ \xymatrix{ (X, x) \ar[d] & (X'_i, x'_i) \ar[l]^{g_i} \ar[d] \\ (S, s) & (S'_i, s'_i) \ar[l] } } \quad i = 1, \ldots, n $$ such that $X_s = \bigcup g_i(X'_i)$. Set $S' = S'_1 \times_S \ldots \times_S S'_n$ and let $Y_i = X_i \times_{S'_i} S'$ be the base change of $X'_i$ to $S'$. By Lemma \ref{lemma-base-change-complete} we see that the pullback of $\mathcal{F}$ to $Y_i$ has a complete d\'evissage over $s$ and we win.
Note that $\text{Ass}_S(\overline{N}) = \text{Ass}_{\overline{S}}(\overline{N})$, see Algebra, Lemma \ref{algebra-lemma-ass-quotient-ring}. This is a finite set by Algebra, Lemma \ref{algebra-lemma-finite-ass}. Say $\{\mathfrak q_1, \ldots, \mathfrak q_r\} = \text{Ass}_S(\overline{N})$. We have $\Sigma = S \setminus (\bigcup \mathfrak q_i)$ by Algebra, Lemma \ref{algebra-lemma-ass-zero-divisors}. By the description of $\Spec(\Sigma^{-1}S)$ in Algebra, Lemma \ref{algebra-lemma-spec-localization} and by Algebra, Lemma \ref{algebra-lemma-silly} we see that the primes of $\Sigma^{-1}S$ correspond to the primes of $S$ contained in one of the $\mathfrak q_i$. Hence the maximal ideals of $\Sigma^{-1}S$ correspond one-to-one with the maximal (w.r.t.\ inclusion) elements of the set $\{\mathfrak q_1, \ldots, \mathfrak q_r\}$. This proves the lemma.
By Algebra, Lemma \ref{algebra-lemma-mod-injective-general} the sequence $0 \to N \to N \to N/sN \to 0$ is exact and $N/sN$ is flat over $R$. This implies that $s : N \to N$ is universally injective, see Algebra, Lemma \ref{algebra-lemma-flat-tor-zero}. The map $N \to \Sigma^{-1}N$ is universally injective as the directed colimit of the maps $s : N \to N$.
Set $N' = N \otimes_R S'$. Consider the commutative diagram $$ \xymatrix{ N \ar[d] \ar[r] & N' \ar[d] \\ \Sigma^{-1}N \ar[r] & \Sigma^{-1}N' } $$ where $\Sigma \subset S$ is the set of elements which are not a zerodivisor on $N/\mathfrak m_R N$. If we can show that the map $N \to \Sigma^{-1}N'$ is universally injective, then $N \to N'$ is too (see Algebra, Lemma \ref{algebra-lemma-universally-injective-permanence}). \medskip\noindent By Lemma \ref{lemma-homothety-spectrum} the ring $\Sigma^{-1}S$ is a semi-local ring whose maximal ideals correspond to associated primes of $N/\mathfrak m_R N$. Hence the image of $\Spec(\Sigma^{-1}S') \to \Spec(\Sigma^{-1}S)$ contains all these maximal ideals by assumption. By Algebra, Lemma \ref{algebra-lemma-ff-rings} the ring map $\Sigma^{-1}S \to \Sigma^{-1}S'$ is faithfully flat. Hence $\Sigma^{-1}N \to \Sigma^{-1}N'$, which is the map $$ N \otimes_S \Sigma^{-1}S \longrightarrow N \otimes_S \Sigma^{-1}S' $$ is universally injective, see Algebra, Lemmas \ref{algebra-lemma-faithfully-flat-universally-injective} and \ref{algebra-lemma-universally-injective-tensor}. Finally, we apply Lemma \ref{lemma-homothety-universally-injective} to see that $N \to \Sigma^{-1}N$ is universally injective. As the composition of universally injective module maps is universally injective (see Algebra, Lemma \ref{algebra-lemma-composition-universally-injective}) we conclude that $N \to \Sigma^{-1}N'$ is universally injective and we win.
By Algebra, Lemma \ref{algebra-lemma-universally-injective-check-stalks} it suffices to show that $N_{\mathfrak q} \to (N \otimes_R S')_{\mathfrak q}$ is a $R_{\mathfrak p}$-universally injective for any prime $\mathfrak q$ of $S$ lying over $\mathfrak p$ in $R$. Thus we may apply Lemma \ref{lemma-base-change-universally-flat-local} to the ring maps $R_{\mathfrak p} \to S_{\mathfrak q} \to S'_{\mathfrak q}$ and the module $N_{\mathfrak q}$.
By Algebra, Theorem \ref{algebra-theorem-projective-free-over-local-ring} the module $M$ is free. If we show the result holds for every finitely generated direct summand of $M$, then the lemma follows. Hence we may assume that $M$ is finite free. Write $N = \colim_i N_i$ as a directed colimit of finite free modules, see Algebra, Theorem \ref{algebra-theorem-lazard}. Note that $u : M \to N$ factors through $N_i$ for some $i$ (as $M$ is finite free). Denote $u_i : M \to N_i$ the corresponding $R$-module map. As $\overline{u}$ is injective we see that $\overline{u_i} : M/\mathfrak mM \to N_i/\mathfrak mN_i$ is injective and remains injective on composing with the maps $N_i/\mathfrak mN_i \to N_{i'}/\mathfrak mN_{i'}$ for all $i' \geq i$. As $M$ and $N_{i'}$ are finite free over the local ring $R$ this implies that $M \to N_{i'}$ is a split injection for all $i' \geq i$. Hence for any $R$-module $Q$ we see that $M \otimes_R Q \to N_{i'} \otimes_R Q$ is injective for all $i' \geq i$. As $- \otimes_R Q$ commutes with colimits we conclude that $M \otimes_R Q \to N_{i'} \otimes_R Q$ is injective as desired.
By More on Algebra, Lemma \ref{more-algebra-lemma-ui-completion-direct-sum-into-product} the map $(\bigoplus\nolimits_{\alpha \in A} R)^\wedge \to \prod_{\alpha \in A} R$ is universally injective. Thus, by Algebra, Lemmas \ref{algebra-lemma-ui-flat-domain} and \ref{algebra-lemma-pure-submodule-ML} it suffices to show that $\prod_{\alpha \in A} R$ is flat and Mittag-Leffler. By Algebra, Proposition \ref{algebra-proposition-characterize-coherent} (and Algebra, Lemma \ref{algebra-lemma-Noetherian-coherent}) we see that $\prod_{\alpha \in A} R$ is flat. Thus we conclude because a product of copies of $R$ is Mittag-Leffler, see Algebra, Lemma \ref{algebra-lemma-product-over-Noetherian-ring}.
Choose a surjection $F \to M$ where $F$ is a free $R$-module. By Algebra, Lemma \ref{algebra-lemma-split-completed-sequence} the module $M^\wedge$ is a direct summand of the module $F^\wedge$. Hence it suffices to prove the lemma for $F$. In this case the lemma follows from Lemma \ref{lemma-completed-direct-sum-ML}.
We have to show that for any finite $R$-module $Q$ the map $Q \otimes_R N \to Q \otimes_R N^\wedge$ is injective, see Algebra, Theorem \ref{algebra-theorem-universally-exact-criteria}. As there is a canonical map $Q \otimes_R N^\wedge \to (Q \otimes_R N)^\wedge$ it suffices to prove that the canonical map $Q \otimes_R N \to (Q \otimes_R N)^\wedge$ is injective. Hence we may replace $N$ by $Q \otimes_R N$ and it suffices to prove the injectivity for the map $N \to N^\wedge$. \medskip\noindent Let $K = \Ker(N \to N^\wedge)$. It suffices to show that $K_{\mathfrak q} = 0$ for $\mathfrak q \in \text{Ass}(N)$ as $N$ is a submodule of $\prod_{\mathfrak q \in \text{Ass}(N)} N_{\mathfrak q}$, see Algebra, Lemma \ref{algebra-lemma-zero-at-ass-zero}. Pick $\mathfrak q \in \text{Ass}(N)$. By the last assumption we see that there exists a prime $\mathfrak q' \supset IS + \mathfrak q$. Since $K_{\mathfrak q}$ is a localization of $K_{\mathfrak q'}$ it suffices to prove the vanishing of $K_{\mathfrak q'}$. Note that $K = \bigcap I^nN$, hence $K_{\mathfrak q'} \subset \bigcap I^nN_{\mathfrak q'}$. Hence $K_{\mathfrak q'} = 0$ by Algebra, Lemma \ref{algebra-lemma-intersect-powers-ideal-module-zero}.
This follows from Lemma \ref{lemma-universally-injective-to-completion} because Algebra, Lemma \ref{algebra-lemma-bourbaki-fibres} and Remark \ref{algebra-remark-bourbaki} guarantee that the set of associated primes of tensor products $N \otimes_R Q$ are contained in the set of associated primes of the modules $N \otimes_R \kappa(\mathfrak p)$.
By Lemma \ref{lemma-universally-injective-to-completion-flat} the map $N \to N^\wedge$ is universally injective. By Lemma \ref{lemma-lift-ML} the module $N^\wedge$ is Mittag-Leffler. By Algebra, Lemma \ref{algebra-lemma-pure-submodule-ML} we conclude that $N$ is Mittag-Leffler. Hence $N$ is countably generated, flat and Mittag-Leffler as an $R$-module, whence projective by Algebra, Lemma \ref{algebra-lemma-countgen-projective}.
Consider the set $$ \{I \subset R \mid S/IS\text{ not projective as }R/I\text{-module}\} $$ We have to show this set is empty. To get a contradiction assume it is nonempty. Then it contains a maximal element $I$. Let $J = \sqrt{I}$ be its radical. If $I \not = J$, then $S/JS$ is projective as a $R/J$-module, and $S/IS$ is flat over $R/I$ and $J/I$ is a nilpotent ideal in $R/I$. Applying Algebra, Lemma \ref{algebra-lemma-lift-projective} we see that $S/IS$ is a projective $R/I$-module, which is a contradiction. Hence we may assume that $I$ is a radical ideal. In other words we are reduced to proving the lemma in case $R$ is a reduced ring and $S/IS$ is a projective $R/I$-module for every nonzero ideal $I$ of $R$. \medskip\noindent Assume $R$ is a reduced ring and $S/IS$ is a projective $R/I$-module for every nonzero ideal $I$ of $R$. By generic flatness, Algebra, Lemma \ref{algebra-lemma-generic-flatness-Noetherian} (applied to a localization $R_g$ which is a domain) or the more general Algebra, Lemma \ref{algebra-lemma-generic-flatness-reduced} there exists a nonzero $f \in R$ such that $S_f$ is free as an $R_f$-module. Denote $R^\wedge = \lim R/(f^n)$ the $(f)$-adic completion of $R$. Note that the ring map $$ R \longrightarrow R_f \times R^\wedge $$ is a faithfully flat ring map, see Algebra, Lemma \ref{algebra-lemma-completion-flat}. Hence by faithfully flat descent of projectivity, see Algebra, Theorem \ref{algebra-theorem-ffdescent-projectivity} it suffices to prove that $S \otimes_R R^\wedge$ is a projective $R^\wedge$-module. To see this we will use the criterion of Lemma \ref{lemma-flat-pure-over-complete-projective}. First of all, note that $S/fS = (S \otimes_R R^\wedge)/f(S \otimes_R R^\wedge)$ is a projective $R/(f)$-module and that $S \otimes_R R^\wedge$ is flat and of finite type over $R^\wedge$ as a base change of such. Next, suppose that $\mathfrak p^\wedge$ is a prime ideal of $R^\wedge$. Let $\mathfrak p \subset R$ be the corresponding prime of $R$. As $R \to S$ has geometrically integral fibre rings, the same is true for the fibre rings of any base change. Hence $\mathfrak q^\wedge = \mathfrak p^\wedge(S \otimes_R R^\wedge)$, is a prime ideals lying over $\mathfrak p^\wedge$ and it is the unique associated prime of $S \otimes_R \kappa(\mathfrak p^\wedge)$. Thus we win if $f(S \otimes_R R^\wedge) + \mathfrak q^\wedge \not = S \otimes_R R^\wedge$. This is true because $\mathfrak p^\wedge + fR^\wedge \not = R^\wedge$ as $f$ lies in the Jacobson radical of the $f$-adically complete ring $R^\wedge$ and because $R^\wedge \to S \otimes_R R^\wedge$ is surjective on spectra as its fibres are nonempty (irreducible spaces are nonempty).
We can find a cocartesian diagram of rings $$ \xymatrix{ S_0 \ar[r] & S \\ R_0 \ar[u] \ar[r] & R \ar[u] } $$ such that $R_0$ is of finite type over $\mathbf{Z}$, the map $R_0 \to S_0$ is of finite type and flat with geometrically integral fibres, see More on Morphisms, Lemmas \ref{more-morphisms-lemma-Noetherian-approximation-flat}, \ref{more-morphisms-lemma-Noetherian-approximation-geometrically-reduced}, \ref{more-morphisms-lemma-Noetherian-approximation-geometrically-irreducible}, and \ref{more-morphisms-lemma-Noetherian-approximation-combine}. By Lemma \ref{lemma-fibres-irreducible-flat-projective} we see that $S_0$ is a projective $R_0$-module. Hence $S = S_0 \otimes_{R_0} R$ is a projective $R$-module, see Algebra, Lemma \ref{algebra-lemma-ascend-properties-modules}.
To obtain $\alpha$ set $r = \dim_{\kappa(\mathfrak p)} N \otimes_S \kappa(\mathfrak p)$ and pick $x_1, \ldots, x_r \in N$ which form a basis of $N \otimes_S \kappa(\mathfrak p)$. Define $\alpha(s_1, \ldots, s_r) = \sum s_i x_i$. This proves the existence. \medskip\noindent Fix an $\alpha$. The most interesting implication is (1) $\Rightarrow$ (2) which we prove first. Assume (1). Because $S/\mathfrak mS$ is a domain with fraction field $\kappa(\mathfrak p)$ we see that $(S/\mathfrak mS)^{\oplus r} \to N_{\mathfrak p}/\mathfrak mN_{\mathfrak p} = N \otimes_S \kappa(\mathfrak p)$ is injective. Hence by Lemmas \ref{lemma-universally-injective-local} and \ref{lemma-fibres-irreducible-flat-projective-nonnoetherian}. the map $S^{\oplus r} \to N_{\mathfrak p}$ is $R$-universally injective. It follows that $S^{\oplus r} \to N$ is $R$-universally injective, see Algebra, Lemma \ref{algebra-lemma-universally-injective-permanence}. Then also the localization $\alpha_{\mathfrak q}$ is $R$-universally injective, see Algebra, Lemma \ref{algebra-lemma-universally-injective-localize}. We conclude that $\Coker(\alpha)_{\mathfrak q}$ is $R$-flat by Algebra, Lemma \ref{algebra-lemma-ui-flat-domain}. \medskip\noindent The implication (2) $\Rightarrow$ (3) is immediate. If (3) holds, then $\alpha_{\mathfrak p}$ is injective as a localization of an injective module map. By Nakayama's lemma (Algebra, Lemma \ref{algebra-lemma-NAK}) $\alpha_{\mathfrak p}$ is surjective too. Hence (3) $\Rightarrow$ (4). If (4) holds, then $\alpha_{\mathfrak p}$ is an isomorphism, so $\alpha$ is injective as $S_{\mathfrak q} \to S_{\mathfrak p}$ is injective. Namely, elements of $S \setminus \mathfrak p$ are nonzerodivisors on $S$ by a combination of Lemmas \ref{lemma-invert-universally-injective} and \ref{lemma-fibres-irreducible-flat-projective-nonnoetherian}. Hence (4) $\Rightarrow$ (5). Finally, if (5) holds, then $N_{\mathfrak q}$ is $R$-flat as an extension of flat modules, see Algebra, Lemma \ref{algebra-lemma-flat-ses}. Hence (5) $\Rightarrow$ (1) and the proof is finished.
Let $(A_i, B_i, M_i, \alpha_i, \mathfrak q_i)_{i = 1, \ldots, n}$ be the given complete d\'evissage. We prove the lemma by induction on $n$. Note that $N$ is finitely presented as an $S$-module if and only if $M_1$ is finitely presented as an $B_1$-module, see Remark \ref{remark-finite-presentation}. Note that $N_{\mathfrak q} \cong (M_1)_{\mathfrak q_1}$ as $R$-modules because (a) $N_{\mathfrak q} \cong (M_1)_{\mathfrak q'_1}$ where $\mathfrak q'_1$ is the unique prime in $A_1$ lying over $\mathfrak q_1$ and (b) $(A_1)_{\mathfrak q'_1} = (A_1)_{\mathfrak q_1}$ by Algebra, Lemma \ref{algebra-lemma-unique-prime-over-localize-below}, so (c) $(M_1)_{\mathfrak q'_1} \cong (M_1)_{\mathfrak q_1}$. Hence $(M_1)_{\mathfrak q_1}$ is a flat $R$-module. Thus we may replace $(S, N)$ by $(B_1, M_1)$ in order to prove the lemma. By Lemma \ref{lemma-induction-step} the map $\alpha_1 : B_1^{\oplus r_1} \to M_1$ is $R$-universally injective and $\Coker(\alpha_1)_{\mathfrak q}$ is $R$-flat. Note that $(A_i, B_i, M_i, \alpha_i, \mathfrak q_i)_{i = 2, \ldots, n}$ is a complete d\'evissage of $\Coker(\alpha_1)/B_1/R$ at $\mathfrak q_1$. Hence the induction hypothesis implies that $\Coker(\alpha_1)$ is finitely presented as a $B_1$-module, free as an $R$-module, and has a decomposition as in the lemma. This implies that $M_1$ is finitely presented as a $B_1$-module, see Algebra, Lemma \ref{algebra-lemma-extension}. It further implies that $M_1 \cong B_1^{\oplus r_1} \oplus \Coker(\alpha_1)$ as $R$-modules, hence a decomposition as in the lemma. Finally, $B_1$ is projective as an $R$-module by Lemma \ref{lemma-fibres-irreducible-flat-projective-nonnoetherian} hence free as an $R$-module by Algebra, Theorem \ref{algebra-theorem-projective-free-over-local-ring}. This finishes the proof.
Suppose $x \in U$. Choose an elementary \'etale neighbourhood $(S', s') \to (S, s)$ and open $V \subset X \times_S \Spec(\mathcal{O}_{S', s'})$ as in Proposition \ref{proposition-finite-type-flat-at-point}. Note that $X_{s'} = X_s$ as $\kappa(s) = \kappa(s')$. If $x' \in V \cap X_{s'}$, then the pullback of $\mathcal{F}$ to $X \times_S S'$ is flat over $S'$ at $x'$. Hence $\mathcal{F}$ is flat at $x'$ over $S$, see Morphisms, Lemma \ref{morphisms-lemma-flat-permanence}. In other words $X_s \cap V \subset U$ is an open neighbourhood of $x$ in $U$.
(The only difference between this and Proposition \ref{proposition-finite-type-flat-at-point} is that we do not assume $f$ is of finite presentation.) The question is local on $X$ and $S$, hence we may assume $X$ and $S$ are affine. Write $X = \Spec(B)$, $S = \Spec(A)$ and write $B = A[x_1, \ldots, x_n]/I$. In other words we obtain a closed immersion $i : X \to \mathbf{A}^n_S$. Denote $t = i(x) \in \mathbf{A}^n_S$. We may apply Proposition \ref{proposition-finite-type-flat-at-point} to $\mathbf{A}^n_S \to S$, the sheaf $i_*\mathcal{F}$ and the point $t$. We obtain an elementary \'etale neighbourhood $(S', s') \to (S, s)$ and an open subscheme $$ W \subset \mathbf{A}^n_{\mathcal{O}_{S', s'}} $$ such that the pullback of $i_*\mathcal{F}$ to $W$ is flat over $\mathcal{O}_{S', s'}$. This means that $V := W \cap \big(X \times_S \Spec(\mathcal{O}_{S', s'})\big)$ is the desired open subscheme.
For every point $x \in X_s$ we can use Proposition \ref{proposition-finite-type-flat-at-point} to find an elementary \'etale neighbourhood $(S_x, s_x) \to (S, s)$ and an open $V_x \subset X \times_S \Spec(\mathcal{O}_{S_x, s_x})$ such that $x \in X_s = X \times_S s_x$ is contained in $V_x$ and such that the pullback of $\mathcal{F}$ to $V_x$ is an $\mathcal{O}_{V_x}$-module of finite presentation and flat over $\mathcal{O}_{S_x, s_x}$. In particular we may view the fibre $(V_x)_{s_x}$ as an open neighbourhood of $x$ in $X_s$. Because $X_s$ is quasi-compact we can find a finite number of points $x_1, \ldots, x_n \in X_s$ such that $X_s$ is the union of the $(V_{x_i})_{s_{x_i}}$. Choose an elementary \'etale neighbourhood $(S' , s') \to (S, s)$ which dominates each of the neighbourhoods $(S_{x_i}, s_{x_i})$, see More on Morphisms, Lemma \ref{more-morphisms-lemma-elementary-etale-neighbourhoods}. Set $V = \bigcup V_i$ where $V_i$ is the inverse images of the open $V_{x_i}$ via the morphism $$ X \times_S \Spec(\mathcal{O}_{S', s'}) \longrightarrow X \times_S \Spec(\mathcal{O}_{S_{x_i}, s_{x_i}}) $$ By construction $V$ contains $X_s$ and by construction the pullback of $\mathcal{F}$ to $V$ is an $\mathcal{O}_V$-module of finite presentation and flat over $\mathcal{O}_{S', s'}$.
(The only difference between this and Lemma \ref{lemma-finite-type-flat-along-fibre} is that we do not assume $f$ is of finite presentation.) For every point $x \in X_s$ we can use Lemma \ref{lemma-finite-type-flat-at-point} to find an elementary \'etale neighbourhood $(S_x, s_x) \to (S, s)$ and an open $V_x \subset X \times_S \Spec(\mathcal{O}_{S_x, s_x})$ such that $x \in X_s = X \times_S s_x$ is contained in $V_x$ and such that the pullback of $\mathcal{F}$ to $V_x$ is flat over $\mathcal{O}_{S_x, s_x}$. In particular we may view the fibre $(V_x)_{s_x}$ as an open neighbourhood of $x$ in $X_s$. Because $X_s$ is quasi-compact we can find a finite number of points $x_1, \ldots, x_n \in X_s$ such that $X_s$ is the union of the $(V_{x_i})_{s_{x_i}}$. Choose an elementary \'etale neighbourhood $(S' , s') \to (S, s)$ which dominates each of the neighbourhoods $(S_{x_i}, s_{x_i})$, see More on Morphisms, Lemma \ref{more-morphisms-lemma-elementary-etale-neighbourhoods}. Set $V = \bigcup V_i$ where $V_i$ is the inverse images of the open $V_{x_i}$ via the morphism $$ X \times_S \Spec(\mathcal{O}_{S', s'}) \longrightarrow X \times_S \Spec(\mathcal{O}_{S_{x_i}, s_{x_i}}) $$ By construction $V$ contains $X_s$ and by construction the pullback of $\mathcal{F}$ to $V$ is flat over $\mathcal{O}_{S', s'}$.
The question is local on $X$ and $S$, hence we may assume $X$ and $S$ are affine. Write $X = \Spec(B)$, $S = \Spec(A)$ and write $B = A[x_1, \ldots, x_n]/I$. In other words we obtain a closed immersion $i : X \to \mathbf{A}^n_S$. Denote $t = i(x) \in \mathbf{A}^n_S$. We may apply Proposition \ref{proposition-finite-type-flat-at-point} to $\mathbf{A}^n_S \to S$, the sheaf $\mathcal{F} = i_*\mathcal{O}_X$ and the point $t$. We obtain an elementary \'etale neighbourhood $(S', s') \to (S, s)$ and an open subscheme $$ W \subset \mathbf{A}^n_{\mathcal{O}_{S', s'}} $$ such that the pullback of $i_*\mathcal{O}_X$ is flat and of finite presentation. This means that $V := W \cap \big(X \times_S \Spec(\mathcal{O}_{S', s'})\big)$ is the desired open subscheme.