hcju/stacksqa huggingface dataset:
Consider the map $H^0_c(U, K|_U) \to H^0_x(X, K) = H^0(X, K) = H^0(X, \mathcal{F})$ of Remark \ref{remark-covariance-open-lower-shriek}. To study this we represent $K$ by a bounded complex $\mathcal{F}^\bullet$ with $\mathcal{F}^i = 0$ for $i < 0$. Then we have by definition $$ H^0_c(U, K|_U) = \lim H^0(X, \mathcal{I}^n\mathcal{F}^\bullet) = \lim \Ker( H^0(X, \mathcal{I}^n\mathcal{F}^0) \to H^0(X, \mathcal{I}^n\mathcal{F}^1)) $$ By Artin-Rees (Cohomology of Schemes, Lemma \ref{coherent-lemma-Artin-Rees}) this is the same as $\lim H^0(X, \mathcal{I}^n\mathcal{F})$. Thus the arrow $H^0_c(U, K|_U) \to H^0(X, \mathcal{F})$ is injective and the image consists of those global sections of $\mathcal{F}$ which are contained in the subsheaf $\mathcal{I}^n\mathcal{F}$ for any $n$. The characterization of these as the sections which vanish in a neighbourhood of $Z$ comes from Krull's intersection theorem (Algebra, Lemma \ref{algebra-lemma-intersect-powers-ideal-module-zero}) by looking at stalks of $\mathcal{F}$. See discussion in Algebra, Remark \ref{algebra-remark-intersection-powers-ideal} for the case of functions.
By the Grothendieck's vanishing result in Cohomology, Proposition \ref{cohomology-proposition-vanishing-Noetherian} we conclude that $\dim(U) \geq d$. Assume $\dim(U) = d$. Choose a compactification $U \to X$ such that $U$ is dense in $X$. (This is possible by More on Flatness, Theorem \ref{flat-theorem-nagata} and Lemma \ref{flat-lemma-compactifyable}.) After replacing $X$ by its reduction we find that $X$ is a proper variety of dimension $d$ and we see that $U$ is proper if and only if $U = X$. Set $Z = X \setminus U$. We will show that $H^d(U, \mathcal{F})$ is zero if $Z$ is nonempty. \medskip\noindent Choose a coherent $\mathcal{O}_X$-module $\mathcal{G}$ whose restriction to $U$ is $\mathcal{F}$, see Properties, Lemma \ref{properties-lemma-lift-finite-presentation}. Let $\omega_X^\bullet$ denote the dualizing complex of $X$ as in Section \ref{section-duality-proper-over-field}. Set $\omega_U^\bullet = \omega_X^\bullet|_U$. Then $H^d(U, \mathcal{F})$ is dual to $$ H^{-d}_c(U, R\SheafHom_{\mathcal{O}_U}(\mathcal{F}, \omega_U^\bullet)) $$ by Lemma \ref{lemma-duality-compact-support}. By Lemma \ref{lemma-duality-proper-over-field} we see that the cohomology sheaves of $\omega_X^\bullet$ vanish in degrees $< -d$ and $H^{-d}(\omega_X^\bullet) = \omega_X$ is a coherent $\mathcal{O}_X$-module which is $(S_2)$ and whose support is $X$. In particular, $\omega_X$ is torsion free, see Divisors, Lemma \ref{divisors-lemma-torsion-free-finite-noetherian-domain}. Thus we see that the cohomology sheaf $$ H^{-d}(R\SheafHom_{\mathcal{O}_X}(\mathcal{G}, \omega_X^\bullet)) = \SheafHom(\mathcal{G}, \omega_X) $$ is torsion free, see Divisors, Lemma \ref{divisors-lemma-hom-into-torsion-free}. Consequently this sheaf has no nonzero sections vanishing on any nonempty open of $X$ (those would be torsion sections). Thus it follows from Lemma \ref{lemma-h0-compactly-supported} that $H^{-d}_c(U, R\SheafHom_{\mathcal{O}_U}(\mathcal{F}, \omega_U^\bullet))$ is zero, and hence $H^d(U, \mathcal{F})$ is zero as desired.
Choose a compactification $j : X \to \overline{X}$ over $Y$ and denote $\overline{f} : \overline{X} \to Y$ the structure morphism. Then we have \begin{align*} \Hom_X(K, f^!L) & = \Hom_X(K, j^*\overline{f}{}^!L) \\ & = \Hom_{\text{Pro-}D^+_{\textit{Coh}}(\mathcal{O}_{\overline{X}})} (Rj_!K, \overline{f}{}^!L) \\ & = \Hom_{\text{Pro-}D^+_{\textit{Coh}}(\mathcal{O}_Y)}(Rf_*Rj_!K, L) \\ & = \Hom_{\text{Pro-}D^+_{\textit{Coh}}(\mathcal{O}_Y)}(Rf_!K, L) \end{align*} The first equality follows immediately from the construction of $f^!$ in Section \ref{section-upper-shriek}. By Lemma \ref{lemma-shriek-coherent} we have $\overline{f}{}^!L$ in $D^+_{\textit{Coh}}(\mathcal{O}_{\overline{X}})$ hence the second equality follows from Lemma \ref{lemma-lift-map-plus}. Since $\overline{f}$ is proper the functor $\overline{f}{}^!$ is the right adjoint of pushforward by construction. This is why we have the third equality. The fourth equality holds because $Rf_! = Rf_* Rj_!$.
Consider the ring maps $$ \mathcal{O}_{S, s} \longrightarrow \mathcal{O}_{Y, y} \longrightarrow \mathcal{O}_{X, x} $$ and the module $\mathcal{F}_x$. The stalk of $\mathcal{F}_s$ at $x$ is the module $\mathcal{F}_x/\mathfrak m_s \mathcal{F}_x$ and the local ring of $Y_s$ at $y$ is $\mathcal{O}_{Y, y}/\mathfrak m_s \mathcal{O}_{Y, y}$. Thus the implication (1) $\Rightarrow$ (2) is Algebra, Lemma \ref{algebra-lemma-criterion-flatness-fibre-Noetherian}. If (2) holds, then the first ring map is faithfully flat and $\mathcal{F}_x$ is flat over $\mathcal{O}_{Y, y}$ so by Algebra, Lemma \ref{algebra-lemma-composition-flat} we see that $\mathcal{F}_x$ is flat over $\mathcal{O}_{S, s}$. Moreover, $\mathcal{F}_x/\mathfrak m_s \mathcal{F}_x$ is the base change of the flat module $\mathcal{F}_x$ by $\mathcal{O}_{Y, y} \to \mathcal{O}_{Y, y}/\mathfrak m_s \mathcal{O}_{Y, y}$, hence flat by Algebra, Lemma \ref{algebra-lemma-flat-base-change}.
Consider the ring maps $$ \mathcal{O}_{S, s} \longrightarrow \mathcal{O}_{Y, y} \longrightarrow \mathcal{O}_{X, x} $$ and the module $\mathcal{F}_x$. The stalk of $\mathcal{F}_s$ at $x$ is the module $\mathcal{F}_x/\mathfrak m_s \mathcal{F}_x$ and the local ring of $Y_s$ at $y$ is $\mathcal{O}_{Y, y}/\mathfrak m_s \mathcal{O}_{Y, y}$. Thus the implication (1) $\Rightarrow$ (2) is Algebra, Lemma \ref{algebra-lemma-criterion-flatness-fibre-fp-over-ft}. If (2) holds, then the first ring map is faithfully flat and $\mathcal{F}_x$ is flat over $\mathcal{O}_{Y, y}$ so by Algebra, Lemma \ref{algebra-lemma-composition-flat} we see that $\mathcal{F}_x$ is flat over $\mathcal{O}_{S, s}$. Moreover, $\mathcal{F}_x/\mathfrak m_s \mathcal{F}_x$ is the base change of the flat module $\mathcal{F}_x$ by $\mathcal{O}_{Y, y} \to \mathcal{O}_{Y, y}/\mathfrak m_s \mathcal{O}_{Y, y}$, hence flat by Algebra, Lemma \ref{algebra-lemma-flat-base-change}. \medskip\noindent By Morphisms, Lemma \ref{morphisms-lemma-finite-presentation-permanence} the morphism $f$ is locally of finite presentation. Consider the set \begin{equation} \label{equation-open} U = \{x \in X \mid \mathcal{F} \text{ flat at }x \text{ over both }Y\text{ and }S\}. \end{equation} This set is open in $X$ by Theorem \ref{theorem-openness-flatness}. Note that if $x \in U$, then $\mathcal{F}_s$ is flat at $x$ over $Y_s$ as a base change of a flat module under the morphism $Y_s \to Y$, see Morphisms, Lemma \ref{morphisms-lemma-base-change-module-flat}. Hence at every point of $U \cap \text{Supp}(\mathcal{F})$ condition (1) is satisfied. On the other hand, it is clear that if $x \in \text{Supp}(\mathcal{F})$ satisfies (1) and (2), then $x \in U$. Thus the open set we are looking for is $U \cap \text{Supp}(\mathcal{F})$.
Observe that the morphism $X \times_S Y \to S$ is a flat, proper morphism of finite presentation whose geometrically integral fibres (see Varieties, Lemmas \ref{varieties-lemma-geometrically-integral}, \ref{varieties-lemma-bijection-irreducible-components}, and \ref{varieties-lemma-geometrically-reduced-any-base-change} for the statement about the fibres). By Derived Categories of Schemes, Lemma \ref{perfect-lemma-proper-flat-geom-red-connected} we see that the pushforward of the structure sheaf by $X \to S$, $Y \to S$, or $X \times_S Y \to S$ is the structure sheaf of $S$ and the same remains true after any base change. Thus we may apply Lemma \ref{lemma-diagonal-picard-flat-proper} to the morphism $$ p : X \times_S Y \times_S Z \longrightarrow Z $$ and the invertible module $\mathcal{L}$ to get a ``universal'' locally closed subscheme $Z' \subset Z$ such that $\mathcal{L}|_{X \times_S Y \times_S Z'}$ is the pullback of an invertible module $\mathcal{N}$ on $Z'$. The existence of $z$ shows that $Z'$ is nonempty. By Lemma \ref{lemma-get-a-closed} we see that $Z' \subset Z$ is a closed subscheme. Let $z' \in Z'$ be a point. Observe that we may write $p$ as the product morphism $$ (X \times_S Z) \times_Z (Y \times_S Z) \longrightarrow Z $$ Hence we may apply Lemma \ref{lemma-pic-of-product} to the morphism $p$, the point $z'$, and the sections $\sigma : Z \to X \times_S Z$ and $\tau : Z \to Y \times_S Z$ given by $x$ and $y$. We conclude that $Z'$ is open. Hence $Z' = Z$ and $\mathcal{L} = p^*\mathcal{N}$ for some invertible module $\mathcal{N}$ on $Z$. Pulling back via $x \times y \times \text{id}_Z : Z  \to X \times_S Y \times_S Z$ we obtain on the one hand $\mathcal{N}$ and on the other hand we obtain the trivial invertible module by assumption (2). Thus $\mathcal{N} = \mathcal{O}_Z$ and the proof is complete.
Let $f = \pi \circ f'$ be the factorization of Lemma \ref{lemma-stein-universally-closed}. Note that besides the conclusions of Lemma \ref{lemma-stein-universally-closed} we also have that $f'$ is separated (Schemes, Lemma \ref{schemes-lemma-compose-after-separated}) and finite type (Morphisms, Lemma \ref{morphisms-lemma-permanence-finite-type}). Hence $f'$ is proper. By Cohomology of Schemes, Proposition \ref{coherent-proposition-proper-pushforward-coherent} we see that $f_*\mathcal{O}_X$ is a coherent $\mathcal{O}_S$-module. Hence we see that $\pi$ is finite, i.e., (2) holds. \medskip\noindent This proves all but the most interesting assertion, namely that all the fibres of $f'$ are geometrically connected. It is clear from the discussion above that we may replace $S$ by $S'$, and we may therefore assume that $S$ is Noetherian, affine, $f : X \to S$ is proper, and $f_*\mathcal{O}_X = \mathcal{O}_S$. Let $s \in S$ be a point of $S$. We have to show that $X_s$ is geometrically connected. By Lemma \ref{lemma-characterize-geometrically-connected-fibres} we see that it suffices to show $X_u$ is connected for every \'etale neighbourhood $(U, u) \to (S, s)$. We may assume $U$ is affine. Thus $U$ is Noetherian (Morphisms, Lemma \ref{morphisms-lemma-finite-type-noetherian}), the base change $f_U : X_U \to U$ is proper (Morphisms, Lemma \ref{morphisms-lemma-base-change-proper}), and that also $(f_U)_*\mathcal{O}_{X_U} = \mathcal{O}_U$ (Cohomology of Schemes, Lemma \ref{coherent-lemma-flat-base-change-cohomology}). Hence after replacing $(f : X \to S, s)$ by the base change $(f_U : X_U \to U, u)$ it suffices to prove that the fibre $X_s$ is connected when $f_*\mathcal{O}_X = \mathcal{O}_S$. We can deduce this from Derived Categories of Schemes, Lemma \ref{perfect-lemma-proper-idempotent-on-fibre} (by looking at idempotents in the structure sheaf of $X_s$) but we will also give a direct argument below. \medskip\noindent Namely, we apply the theorem on formal functions, more precisely Cohomology of Schemes, Lemma \ref{coherent-lemma-formal-functions-stalk}. It tells us that $$ \mathcal{O}^\wedge_{S, s} = (f_*\mathcal{O}_X)_s^\wedge = \lim_n H^0(X_n, \mathcal{O}_{X_n}) $$ where $X_n$ is the $n$th infinitesimal neighbourhood of $X_s$. Since the underlying topological space of $X_n$ is equal to that of $X_s$ we see that if $X_s = T_1 \amalg T_2$ is a disjoint union of nonempty open and closed subschemes, then similarly $X_n = T_{1, n} \amalg T_{2, n}$ for all $n$. And this in turn means $H^0(X_n, \mathcal{O}_{X_n})$ contains a nontrivial idempotent $e_{1, n}$, namely the function which is identically $1$ on $T_{1, n}$ and identically $0$ on $T_{2, n}$. It is clear that $e_{1, n + 1}$ restricts to $e_{1, n}$ on $X_n$. Hence $e_1 = \lim e_{1, n}$ is a nontrivial idempotent of the limit. This contradicts the fact that $\mathcal{O}^\wedge_{S, s}$ is a local ring. Thus the assumption was wrong, i.e., $X_s$ is connected, and we win.
We may apply Lemma \ref{lemma-stein-universally-closed} to get the morphism $f' : X \to S'$. Note that besides the conclusions of Lemma \ref{lemma-stein-universally-closed} we also have that $f'$ is separated (Schemes, Lemma \ref{schemes-lemma-compose-after-separated}) and finite type (Morphisms, Lemma \ref{morphisms-lemma-permanence-finite-type}). Hence $f'$ is proper. At this point we have proved all of the statements except for the statement that $f'$ has geometrically connected fibres. \medskip\noindent We may assume that $S = \Spec(R)$ is affine. Set $R' = \Gamma(X, \mathcal{O}_X)$. Then $S' = \Spec(R')$. Thus we may replace $S$ by $S'$ and assume that $S = \Spec(R)$ is affine $R = \Gamma(X, \mathcal{O}_X)$. Next, let $s \in S$ be a point. Let $U \to S$ be an \'etale morphism of affine schemes and let $u \in U$ be a point mapping to $s$. Let $X_U \to U$ be the base change of $X$. By Lemma \ref{lemma-characterize-geometrically-connected-fibres} it suffices to show that the fibre of $X_U \to U$ over $u$ is connected. By Cohomology of Schemes, Lemma \ref{coherent-lemma-flat-base-change-cohomology} we see that $\Gamma(X_U, \mathcal{O}_{X_U}) = \Gamma(U, \mathcal{O}_U)$. Hence we have to show: Given $S = \Spec(R)$ affine, $X \to S$ proper with $\Gamma(X, \mathcal{O}_X) = R$ and $s \in S$ is a point, the fibre $X_s$ is connected. \medskip\noindent To do this it suffices to show that the only idempotents $e \in H^0(X_s, \mathcal{O}_{X_s})$ are $0$ and $1$ (we already know that $X_s$ is nonempty by Lemma \ref{lemma-stein-universally-closed}). By Derived Categories of Schemes, Lemma \ref{perfect-lemma-proper-idempotent-on-fibre} after replacing $R$ by a principal localization we may assume $e$ is the image of an element of $R$. Since $R \to H^0(X_s, \mathcal{O}_{X_s})$ factors through $\kappa(s)$ we conclude.
It is clear that $X'$ is a locally ringed space. Let $U = \Spec(B)$ be an affine open of $X$. Set $A = \Gamma(U, \mathcal{A})$. Note that since $H^1(U, \mathcal{I}) = 0$ (see Cohomology of Schemes, Lemma \ref{coherent-lemma-quasi-coherent-affine-cohomology-zero}) the map $A \to B$ is surjective. By assumption the kernel $I = \mathcal{I}(U)$ is an ideal of square zero in the ring $A$. By Schemes, Lemma \ref{schemes-lemma-morphism-into-affine} there is a canonical morphism of locally ringed spaces $$ (U, \mathcal{A}|_U) \longrightarrow \Spec(A) $$ coming from the map $B \to \Gamma(U, \mathcal{A})$. Since this morphism fits into the commutative diagram $$ \xymatrix{ (U, \mathcal{O}_X|_U) \ar[d] \ar[r] & \Spec(B) \ar[d] \\ (U, \mathcal{A}|_U) \ar[r] & \Spec(A) } $$ we see that it is a homeomorphism on underlying topological spaces. Thus to see that it is an isomorphism, it suffices to check it induces an isomorphism on the local rings. For $u \in U$ corresponding to the prime $\mathfrak p \subset A$ we obtain a commutative diagram of short exact sequences $$ \xymatrix{ 0 \ar[r] & I_{\mathfrak p} \ar[r] \ar[d] & A_{\mathfrak p} \ar[r] \ar[d] & B_{\mathfrak p} \ar[r] \ar[d] & 0 \\ 0 \ar[r] & \mathcal{I}_u \ar[r] & \mathcal{A}_u \ar[r] & \mathcal{O}_{X, u} \ar[r] & 0. } $$ The left and right vertical arrows are isomorphisms because $\mathcal{I}$ and $\mathcal{O}_X$ are quasi-coherent sheaves. Hence also the middle map is an isomorphism. Hence every point of $X' = (X, \mathcal{A})$ has an affine neighbourhood and $X'$ is a scheme as desired.
The statement means the following: Let $X \to X'$ be a morphism of schemes and let $\{g_i : X'_i \to X'\}$ be an fpqc covering such that the base change $X_i \to X'_i$ is a thickening for all $i$. Then $X \to X'$ is a thickening. Since the morphisms $g_i$ are jointly surjective we conclude that $X \to X'$ is surjective. By Descent, Lemma \ref{descent-lemma-descending-property-closed-immersion} we conclude that $X \to X'$ is a closed immersion. Thus $X \to X'$ is a thickening. We omit the proof in the case of first order thickenings.
Observe that $S \to S'$ and $X \to X'$ are universal homeomorphisms (see for example Morphisms, Lemma \ref{morphisms-lemma-reduction-universal-homeomorphism}). This immediately implies parts (2), (3), (4), (7), and (8). Part (1) follows from Lemma \ref{lemma-thickening-affine-scheme} which tells us that there is a 1-to-1 correspondence between affine opens of $S$ and $S'$ and between affine opens of $X$ and $X'$. Part (9) follows from Limits, Lemma \ref{limits-lemma-thickening-quasi-affine} and the remark just made about affine opens of $S$ and $S'$. Part (5) follows from (1) and (4) by Morphisms, Lemma \ref{morphisms-lemma-integral-universally-closed}. Finally, note that $$ S \times_X S = S \times_{X'} S \to S \times_{X'} S' \to S' \times_{X'} S' $$ is a thickening (the two arrows are thickenings by Lemma \ref{lemma-base-change-thickening}). Hence applying (3) and (4) to the morphism $(S \subset S') \to (S \times_X S \to S' \times_{X'} S')$ we obtain (6).
Recall that being relatively ample is a condition for each affine open in the base, see Morphisms, Definition \ref{morphisms-definition-relatively-ample}. By Lemma \ref{lemma-thickening-affine-scheme} there is a 1-to-1 correspondence between affine opens of $S$ and $S'$. Thus we may assume $S$ and $S'$ are affine and we reduce to proving that $\mathcal{L}'$ is ample if and only if $\mathcal{L}$ is ample. This is Limits, Lemma \ref{limits-lemma-ample-on-reduction}.
This is the long exact cohomology sequence associated to the short exact sequence of sheaves of abelian groups $$ 0 \to \mathcal{I} \to \mathcal{O}_{X'}^* \to \mathcal{O}_X^* \to 0 $$ where the first map sends a local section $f$ of $\mathcal{I}$ to the invertible section $1 + f$ of $\mathcal{O}_{X'}$. We also use the identification of the Picard group of a ringed space with the first cohomology group of the sheaf of invertible functions, see Cohomology, Lemma \ref{cohomology-lemma-h1-invertible}.
[Proof for a finite order thickening] By the general principle explained following Definition \ref{definition-thickening} this reduces to the case of a first order thickening. Then may use Lemma \ref{lemma-picard-group-first-order-thickening} to see that it suffices to show that $H^1(X, \mathcal{I})[n]$, $H^1(X, \mathcal{I})/n$, and $H^2(X, \mathcal{I})[n]$ are zero. This follows as multiplication by $n$ on $\mathcal{I}$ is an isomorphism as it is an $\mathcal{O}_X$-module.
Let $U \subset X$ be the open used in the construction of $Z'$, i.e., an open such that $Z$ is identified with a closed subscheme of $U$ cut out by the quasi-coherent sheaf of ideals $\mathcal{I}$. Since $|T| = |T'|$ we see that $b(T') \subset U$. Hence we can think of $b$ as a morphism into $U$. Let $\mathcal{J} \subset \mathcal{O}_{T'}$ be the ideal cutting out $T$. Since $b(T) \subset Z$ by the diagram above we see that $b^\sharp(b^{-1}\mathcal{I}) \subset \mathcal{J}$. As $T'$ is a first order thickening of $T$ we see that $\mathcal{J}^2 = 0$ hence $b^\sharp(b^{-1}(\mathcal{I}^2)) = 0$. By Schemes, Lemma \ref{schemes-lemma-characterize-closed-subspace} this implies that $b$ factors through $Z'$. Denote $a' : T' \to Z'$ this factorization and everything is clear.
Consider a solid diagram $$ \xymatrix{ U \ar[d]_{f|_U} & T \ar[d]^i \ar[l]^a \\ V & T' \ar[l] \ar@{-->}[lu] } $$ as in Definition \ref{definition-formally-unramified}. If $f$ is formally ramified, then there exists at most one $S$-morphism $a' : T' \to X$ such that $a'|_T = a$. Hence clearly there exists at most one such morphism into $U$.
We recall some of the arguments of the proof of Morphisms, Lemma \ref{morphisms-lemma-differentials-affine}. Let $W \subset X \times_S X$ be an open such that $\Delta : X \to X \times_S X$ induces a closed immersion into $W$. Let $\mathcal{J} \subset \mathcal{O}_W$ be the ideal sheaf of this closed immersion. Let $X' \subset W$ be the closed subscheme defined by the quasi-coherent sheaf of ideals $\mathcal{J}^2$. Consider the two morphisms $p_1, p_2 : X' \to X$ induced by the two projections $X \times_S X \to X$. Note that $p_1$ and $p_2$ agree when composed with $\Delta : X \to X'$ and that $X \to X'$ is a closed immersion defined by a an ideal whose square is zero. Moreover there is a short exact sequence $$ 0 \to \mathcal{J}/\mathcal{J}^2 \to \mathcal{O}_{X'} \to \mathcal{O}_X \to 0 $$ and $\Omega_{X/S} = \mathcal{J}/\mathcal{J}^2$. Moreover, $\mathcal{J}/\mathcal{J}^2$ is generated by the local sections $p_1^\sharp(f) - p_2^\sharp(f)$ for $f$ a local section of $\mathcal{O}_X$. \medskip\noindent Suppose that $f : X \to S$ is formally unramified. By assumption this means that $p_1 = p_2$ when restricted to any affine open $T' \subset X'$. Hence $p_1 = p_2$. By what was said above we conclude that $\Omega_{X/S} = \mathcal{J}/\mathcal{J}^2 = 0$. \medskip\noindent Conversely, suppose that $\Omega_{X/S} = 0$. Then $X' = X$. Take any pair of morphisms $f'_1, f'_2 : T' \to X$ fitting as dotted arrows in the diagram of Definition \ref{definition-formally-unramified}. This gives a morphism $(f'_1, f'_2) : T' \to X \times_S X$. Since $f'_1|_T = f'_2|_T$ and $|T| =|T'|$ we see that the image of $T'$ under $(f'_1, f'_2)$ is contained in the open $W$ chosen above. Since $(f'_1, f'_2)(T) \subset \Delta(X)$ and since $T$ is defined by an ideal of square zero in $T'$ we see that $(f'_1, f'_2)$ factors through $X'$. As $X' = X$ we conclude $f_1' = f'_2$ as desired.
By Morphisms, Lemmas \ref{morphisms-lemma-open-immersion-unramified} and \ref{morphisms-lemma-closed-immersion-unramified} an immersion is unramified, hence formally unramified by Lemma \ref{lemma-unramified-formally-unramified}. The other assertions follow by combining Lemmas \ref{lemma-first-order-infinitesimal-neighbourhood} and \ref{lemma-infinitesimal-neighbourhood-conormal} and the definitions.
There are two proofs. The first is to show that $\Omega_{Z'/X} = 0$ by working affine locally and applying Algebra, Lemma \ref{algebra-lemma-differentials-universal-thickening}. Then Lemma \ref{lemma-formally-unramified-differentials} implies what we want. The second is a direct argument as follows. \medskip\noindent Let $T \subset T'$ be a first order thickening. Let $$ \xymatrix{ Z' \ar[d] & T \ar[l]^c \ar[d] \\ X & T' \ar[l] \ar[lu]^{a, b} } $$ be a commutative diagram. Consider two morphisms $a, b : T' \to Z'$ fitting into the diagram. Set $T_0 = c^{-1}(Z) \subset T$ and $T'_a = a^{-1}(Z)$ (scheme theoretically). Since $Z'$ is a first order thickening of $Z$, we see that $T'$ is a first order thickening of $T'_a$. Moreover, since $c = a|_T$ we see that $T_0 = T \cap T'_a$ (scheme theoretically). As $T'$ is a first order thickening of $T$ it follows that $T'_a$ is a first order thickening of $T_0$. Now $a|_{T'_a}$ and $b|_{T'_a}$ are morphisms of $T'_a$ into $Z'$ over $X$ which agree on $T_0$ as morphisms into $Z$. Hence by the universal property of $Z'$ we conclude that $a|_{T'_a} = b|_{T'_a}$. Thus $a$ and $b$ are morphism from the first order thickening $T'$ of $T'_a$ whose restrictions to $T'_a$ agree as morphisms into $Z$. Thus using the universal property of $Z'$ once more we conclude that $a = b$. In other words, the defining property of a formally unramified morphism holds for $Z' \to X$ as desired.
The morphism $h$ is formally unramified by Lemma \ref{lemma-base-change-formally-unramified}. It is clear that $X \times_Y W'$ is a first order thickening. It is straightforward to check that it has the universal property because $W'$ has the universal property (by mapping properties of fibre products). See Morphisms, Lemma \ref{morphisms-lemma-conormal-functorial-flat} for why this implies that the map of conormal sheaves is surjective.
Flatness is preserved under base change, see Morphisms, Lemma \ref{morphisms-lemma-base-change-flat}. Hence the first statement follows from the description of $W'$ in Lemma \ref{lemma-universal-thickening-fibre-product}. It is clear that $X \times_Y W'$ is a first order thickening. It is straightforward to check that it has the universal property because $W'$ has the universal property (by mapping properties of fibre products). See Morphisms, Lemma \ref{morphisms-lemma-conormal-functorial-flat} for why this implies that the map of conormal sheaves is an isomorphism.
The first statement is Lemma \ref{lemma-formally-unramified-on-opens}. The compatibility of universal thickenings can be deduced from the proof of Lemma \ref{lemma-universal-thickening}, or from Algebra, Lemma \ref{algebra-lemma-universal-thickening-localize} or deduced from Lemma \ref{lemma-universal-thickening-fibre-product-flat}.