Choose affine open neighbourhoods $\Spec(A)$ of $s$ and $\Spec(B)$ of $x$ such that $\varphi(\Spec(B)) \subset \Spec(A)$. Let $\mathfrak p \subset A$ be the prime ideal corresponding to $s$. Let $\mathfrak q \subset B$ be the prime ideal corresponding to $x$. Let $I \subset B$ be the ideal corresponding to $T$. By the initial assumption of the lemma we know that $A \to B$ is flat and of finite presentation. The assumption in (1) means that, after shrinking $\Spec(B)$, we may assume $I(B \otimes_A \kappa(\mathfrak p))$ is generated by a quasi-regular sequence of elements. After possibly localizing $B$ at some $g \in B$, $g \not \in \mathfrak q$ we may assume there exist $f_1, \ldots, f_r \in I$ which map to a quasi-regular sequence in $B \otimes_A \kappa(\mathfrak p)$ which generates $I(B \otimes_A \kappa(\mathfrak p))$. By Algebra, Lemmas \ref{algebra-lemma-quasi-regular-regular} and \ref{algebra-lemma-regular-sequence-in-neighbourhood} we may assume after another localization that $f_1, \ldots, f_r \in I$ form a regular sequence in $B \otimes_A \kappa(\mathfrak p)$. By Lemma \ref{lemma-fibre-Cartier} it follows that $Z_1 = V(f_1) \subset \Spec(B)$ is a relative effective Cartier divisor, again after possibly localizing $B$. Applying the same lemma again, but now to $Z_2 = V(f_1, f_2) \subset Z_1$ we see that $Z_2 \subset Z_1$ is a relative effective Cartier divisor. And so on until one reaches $Z = Z_n = V(f_1, \ldots, f_n)$. Then $Z \to \Spec(B)$ is a regular immersion and $Z$ is flat over $S$, in particular $Z \to \Spec(B)$ is a relative quasi-regular immersion over $\Spec(A)$. This proves (1). \medskip\noindent To see (2) consider the closed immersion $Z \to D$. The surjective ring map $u : \mathcal{O}_{D, x} \to \mathcal{O}_{Z, x}$ is a map of flat local $\mathcal{O}_{S, s}$-algebras which are essentially of finite presentation, and which becomes an isomorphisms after dividing by $\mathfrak m_s$. Hence it is an isomorphism, see Algebra, Lemma \ref{algebra-lemma-mod-injective-general}. It follows that $Z \to D$ is an isomorphism in a neighbourhood of $x$, see Algebra, Lemma \ref{algebra-lemma-local-isomorphism}. \medskip\noindent To see (3), after possibly shrinking $U$ we may assume that the ideal of $Z$ is generated by a regular sequence $f_1, \ldots, f_r$ (see our construction of $Z$ above) and the ideal of $T$ is generated by $g_1, \ldots, g_c$. We claim that $c = r$. Namely, \begin{align*} \dim_x(X_s) & = \dim(\mathcal{O}_{X_s, x}) + \text{trdeg}_{\kappa(s)}(\kappa(x)), \\ \dim_x(T_s) & = \dim(\mathcal{O}_{T_s, x}) + \text{trdeg}_{\kappa(s)}(\kappa(x)), \\ \dim(\mathcal{O}_{X_s, x}) & = \dim(\mathcal{O}_{T_s, x}) + r \end{align*} the first two equalities by Algebra, Lemma \ref{algebra-lemma-dimension-at-a-point-finite-type-field} and the second by $r$ times applying Algebra, Lemma \ref{algebra-lemma-one-equation}. As $T \subset Z$ we see that $f_i = \sum b_{ij} g_j$. But the ideals of $Z$ and $T$ cut out the same quasi-regular closed subscheme of $X_s$ in a neighbourhood of $x$. Hence the matrix $(b_{ij}) \bmod \mathfrak m_x$ is invertible (some details omitted). Hence $(b_{ij})$ is invertible in an open neighbourhood of $x$. In other words, $T \cap U = Z$ after shrinking $U$. \medskip\noindent The final statements of the lemma follow immediately from part (2), combined with the fact that $Z \to S$ is locally of finite presentation if and only if $Z \to X$ is of finite presentation, see Morphisms, Lemmas \ref{morphisms-lemma-composition-finite-presentation} and \ref{morphisms-lemma-finite-presentation-permanence}.