hcju/stacksqa huggingface dataset:
Let $f : X \to S$ be an affine morphism. Let $S' \to S$ be any morphism. Denote $f' : X_{S'} = S' \times_S X \to S'$ the base change of $f$. For every $s' \in S'$ there exists an open affine neighbourhood $s' \in V \subset S'$ which maps into some open affine $U \subset S$. By assumption $f^{-1}(U)$ is affine. By the material in Schemes, Section \ref{schemes-section-fibre-products} we see that $f^{-1}(U)_V = V \times_U f^{-1}(U)$ is affine and equal to $(f')^{-1}(V)$. This proves that $S'$ has an open covering by affines whose inverse image under $f'$ is affine. We conclude by Lemma \ref{lemma-characterize-affine} above.
Proof of (1). The base change $X \times_S Y \to Y$ is affine by Lemma \ref{lemma-base-change-affine}. The morphism $(1, g) : X \to X \times_S Y$ is the base change of $Y \to Y \times_S Y$ by the morphism $X \times_S Y \to Y \times_S Y$. Hence it is affine by Lemma \ref{lemma-base-change-affine}. The composition of affine morphisms is affine (see Lemma \ref{lemma-composition-affine}) and (1) follows. Part (2) follows from (1) as a closed immersion is affine (see Lemma \ref{lemma-closed-immersion-affine}) and $Y/S$ separated means $\Delta$ is a closed immersion. Parts (3) and (4) are special cases of (1) and (2).
By Schemes, Definition \ref{schemes-definition-immersion} there exists an open subscheme $W \subset X$ such that $j$ factors as a closed immersion $i : Y \to W$ followed by the inclusion morphism $W \to X$. Since a closed immersion is affine (Lemma \ref{lemma-closed-immersion-affine}), we see that for every $x \in W$ there is an affine open neighbourhood of $x$ in $X$ whose inverse image under $j$ is affine. If $x \in U$, then the same thing is true by assumption (2). Finally, assume $x \in Z$ and $x \not \in W$. Then $x \not \in j(Y) \cap Z$. By assumption (3) we can find an affine open neighbourhood $V \subset X$ of $x$ which does not meet $j(Y) \cap Z$. Then $j^{-1}(V) = j^{-1}(V \cap U)$ which is affine by assumptions (1) and (2). It follows that $j$ is affine by Lemma \ref{lemma-characterize-affine}.
Given invertible $\mathcal{O}_X$-modules $\mathcal{L}$, $\mathcal{M}$ and global sections $s \in \Gamma(X, \mathcal{L})$, $t \in \Gamma(X, \mathcal{M})$ such that $X_s$ and $X_t$ are affine we have to prove $X_s \cap X_t$ is affine. Namely, then Lemma \ref{lemma-characterize-affine} applied to $\Delta : X \to X \times X$ and the fact that $\Delta^{-1}(X_s \times X_t) = X_s \cap X_t$ shows that $\Delta$ is affine. The fact that $X_s \cap X_t$ is affine follows from Properties, Lemma \ref{properties-lemma-affine-cap-s-open}.
Let $f : X \to S$ be quasi-affine. Quasi-compactness is immediate from Schemes, Lemma \ref{schemes-lemma-quasi-compact-affine}. Let $U \subset S$ be an affine open. If we can show that $f^{-1}(U)$ is a separated scheme, then $f$ is separated (Schemes, Lemma \ref{schemes-lemma-characterize-separated} shows that being separated is local on the base). By assumption $f^{-1}(U)$ is isomorphic to an open subscheme of an affine scheme. An affine scheme is separated and hence every open subscheme of an affine scheme is separated as desired.
It is obvious that (1) implies (2) and that (4) implies (3). \medskip\noindent Assume $S = \bigcup_{j \in J} W_j$ is an affine open covering such that each $f^{-1}(W_j)$ is quasi-affine. By Schemes, Lemma \ref{schemes-lemma-quasi-compact-affine} we see that $f$ is quasi-compact. By Schemes, Lemma \ref{schemes-lemma-characterize-quasi-separated} we see the morphism $f$ is quasi-separated. Hence by Schemes, Lemma \ref{schemes-lemma-push-forward-quasi-coherent} the sheaf $\mathcal{A} = f_*\mathcal{O}_X$ is a quasi-coherent sheaf of $\mathcal{O}_X$-algebras. Thus we have the scheme $g : Y = \underline{\Spec}_S(\mathcal{A}) \to S$ over $S$. The identity map $\text{id} : \mathcal{A} = f_*\mathcal{O}_X \to f_*\mathcal{O}_X$ provides, via the definition of the relative spectrum, a morphism $can : X \to Y$ over $S$, see Constructions, Lemma \ref{constructions-lemma-canonical-morphism}. By assumption, the lemma just cited, and Properties, Lemma \ref{properties-lemma-quasi-affine} the restriction $can|_{f^{-1}(W_j)} : f^{-1}(W_j) \to g^{-1}(W_j)$ is a quasi-compact open immersion. Thus $can$ is a quasi-compact open immersion. We have shown that (2) implies (4). \medskip\noindent Assume (3). Choose any affine open $U \subset S$. By Constructions, Lemma \ref{constructions-lemma-spec-properties} we see that the inverse image of $U$ in the relative spectrum is affine. Hence we conclude that $f^{-1}(U)$ is quasi-affine (note that quasi-compactness is encoded in (3) as well). Thus (3) implies (1).
Let $f : X \to Y$ and $g : Y \to Z$ be quasi-affine morphisms. Let $U \subset Z$ be affine open. Then $g^{-1}(U)$ is quasi-affine by assumption on $g$. Let $j : g^{-1}(U) \to V$ be a quasi-compact open immersion into an affine scheme $V$. By Lemma \ref{lemma-characterize-quasi-affine} above we see that $f^{-1}(g^{-1}(U))$ is a quasi-compact open subscheme of the relative spectrum $\underline{\Spec}_{g^{-1}(U)}(\mathcal{A})$ for some quasi-coherent sheaf of $\mathcal{O}_{g^{-1}(U)}$-algebras $\mathcal{A}$. By Schemes, Lemma \ref{schemes-lemma-push-forward-quasi-coherent} the sheaf $\mathcal{A}' = j_*\mathcal{A}$ is a quasi-coherent sheaf of $\mathcal{O}_V$-algebras with the property that $j^*\mathcal{A}' = \mathcal{A}$. Hence we get a commutative diagram $$ \xymatrix{ f^{-1}(g^{-1}(U)) \ar[r] & \underline{\Spec}_{g^{-1}(U)}(\mathcal{A}) \ar[r] \ar[d] & \underline{\Spec}_V(\mathcal{A}') \ar[d] \\ & g^{-1}(U) \ar[r]^j & V } $$ with the square being a fibre square, see Constructions, Lemma \ref{constructions-lemma-spec-properties}. Note that the upper right corner is an affine scheme. Hence $(g \circ f)^{-1}(U)$ is quasi-affine.
Let $f : X \to S$ be a quasi-affine morphism. By Lemma \ref{lemma-characterize-quasi-affine} above we can find a quasi-coherent sheaf of $\mathcal{O}_S$-algebras $\mathcal{A}$ and a quasi-compact open immersion $X \to \underline{\Spec}_S(\mathcal{A})$ over $S$. Let $g : S' \to S$ be any morphism. Denote $f' : X_{S'} = S' \times_S X \to S'$ the base change of $f$. Since the base change of a quasi-compact open immersion is a quasi-compact open immersion we see that $X_{S'} \to \underline{\Spec}_{S'}(g^*\mathcal{A})$ is a quasi-compact open immersion (we have used Schemes, Lemmas \ref{schemes-lemma-quasi-compact-preserved-base-change} and \ref{schemes-lemma-base-change-immersion} and Constructions, Lemma \ref{constructions-lemma-spec-properties}). By Lemma \ref{lemma-characterize-quasi-affine} again we conclude that $X_{S'} \to S'$ is quasi-affine.
Let $X \to S$ be a quasi-compact immersion. We have to show the inverse image of every affine open is quasi-affine. Hence, assuming $S$ is an affine scheme, we have to show $X$ is quasi-affine. By Lemma \ref{lemma-quasi-compact-immersion} the morphism $X \to S$ factors as $X \to Z \to S$ where $Z$ is a closed subscheme of $S$ and $X \subset Z$ is a quasi-compact open. Since $S$ is affine Lemma \ref{lemma-closed-immersion} implies $Z$ is affine. Hence we win.
Let $V \subset S$ be an affine open. Then $f^{-1}(V)$ is an open subscheme of the affine scheme $X$, hence quasi-affine if and only if it is quasi-compact. This proves the first assertion. The quasi-compactness of any $f : X \to S$ where $X$ is affine and $S$ quasi-separated follows from Schemes, Lemma \ref{schemes-lemma-quasi-compact-permanence} applied to $X \to S \to \Spec(\mathbf{Z})$.
The base change $X \times_S Y \to Y$ is quasi-affine by Lemma \ref{lemma-base-change-quasi-affine}. The morphism $X \to X \times_S Y$ is a quasi-compact immersion as $Y \to S$ is quasi-separated, see Schemes, Lemma \ref{schemes-lemma-section-immersion}. A quasi-compact immersion is quasi-affine by Lemma \ref{lemma-quasi-compact-immersion-quasi-affine} and the composition of quasi-affine morphisms is quasi-affine (see Lemma \ref{lemma-composition-quasi-affine}). Thus we win.
As $f$ is locally of type $P$ for every $u \in U$ there exists an affine open $U_u \subset X$ mapping into an affine open $V_u \subset S$ such that $P(\mathcal{O}_S(V_u) \to \mathcal{O}_X(U_u))$ holds. Choose an open neighbourhood $U'_u \subset U \cap U_u$ of $u$ which is standard affine open in both $U$ and $U_u$, see Schemes, Lemma \ref{schemes-lemma-standard-open-two-affines}. By Definition \ref{definition-property-local} (1)(b) we see that $P(\mathcal{O}_S(V_u) \to \mathcal{O}_X(U'_u))$ holds. Hence we may assume that $U_u \subset U$ is a standard affine open. Choose an open neighbourhood $V'_u \subset V \cap V_u$ of $f(u)$ which is standard affine open in both $V$ and $V_u$, see Schemes, Lemma \ref{schemes-lemma-standard-open-two-affines}. Then $U'_u = f^{-1}(V'_u) \cap U_u$ is a standard affine open of $U_u$ (hence of $U$) and we have $P(\mathcal{O}_S(V'_u) \to \mathcal{O}_X(U'_u))$ by Definition \ref{definition-property-local} (1)(a). Hence we may assume both $U_u \subset U$ and $V_u \subset V$ are standard affine open. Applying Definition \ref{definition-property-local} (1)(b) one more time we conclude that $P(\mathcal{O}_S(V) \to \mathcal{O}_X(U_u))$ holds. Because $U$ is quasi-compact we may choose a finite number of points $u_1, \ldots, u_n \in U$ such that $$ U = U_{u_1} \cup \ldots \cup U_{u_n}. $$ By Definition \ref{definition-property-local} (1)(c) we conclude that $P(\mathcal{O}_S(V) \to \mathcal{O}_X(U))$ holds.
Let $f : X \to Y$ and $g : Y \to Z$ be morphisms locally of type $P$. Let $x \in X$. Choose an affine open neighbourhood $W \subset Z$ of $g(f(x))$. Choose an affine open neighbourhood $V \subset g^{-1}(W)$ of $f(x)$. Choose an affine open neighbourhood $U \subset f^{-1}(V)$ of $x$. By Lemma \ref{lemma-locally-P-characterize} the ring maps $\mathcal{O}_Z(W) \to \mathcal{O}_Y(V)$ and $\mathcal{O}_Y(V) \to \mathcal{O}_X(U)$ satisfy $P$. Hence $\mathcal{O}_Z(W) \to \mathcal{O}_X(U)$ satisfies $P$ as $P$ is assumed stable under composition.
Let $f : X \to S$ be a morphism locally of type $P$. Let $S' \to S$ be any morphism. Denote $f' : X_{S'} = S' \times_S X \to S'$ the base change of $f$. For every $s' \in S'$ there exists an open affine neighbourhood $s' \in V' \subset S'$ which maps into some open affine $V \subset S$. By Lemma \ref{lemma-locally-P-characterize} the open $f^{-1}(V)$ is a union of affines $U_i$ such that the ring maps $\mathcal{O}_S(V) \to \mathcal{O}_X(U_i)$ all satisfy $P$. By the material in Schemes, Section \ref{schemes-section-fibre-products} we see that $f^{-1}(U)_{V'} = V' \times_V f^{-1}(V)$ is the union of the affine opens $V' \times_V U_i$. Since $\mathcal{O}_{X_{S'}}(V' \times_V U_i) = \mathcal{O}_{S'}(V') \otimes_{\mathcal{O}_S(V)} \mathcal{O}_X(U_i)$ we see that the ring maps $\mathcal{O}_{S'}(V') \to \mathcal{O}_{X_{S'}}(V' \times_V U_i)$ satisfy $P$ as $P$ is assumed stable under base change.
This follows from Lemma \ref{lemma-locally-P} if we show that the property ``$R \to A$ is of finite type'' is local. We check conditions (a), (b) and (c) of Definition \ref{definition-property-local}. By Algebra, Lemma \ref{algebra-lemma-base-change-finiteness} being of finite type is stable under base change and hence we conclude (a) holds. By the same lemma being of finite type is stable under composition and trivially for any ring $R$ the ring map $R \to R_f$ is of finite type. We conclude (b) holds. Finally, property (c) is true according to Algebra, Lemma \ref{algebra-lemma-cover-upstairs}.
In the proof of Lemma \ref{lemma-locally-finite-type-characterize} we saw that being of finite type is a local property of ring maps. Hence the first statement of the lemma follows from Lemma \ref{lemma-composition-type-P} combined with the fact that being of finite type is a property of ring maps that is stable under composition, see Algebra, Lemma \ref{algebra-lemma-compose-finite-type}. By the above and the fact that compositions of quasi-compact morphisms are quasi-compact, see Schemes, Lemma \ref{schemes-lemma-composition-quasi-compact} we see that the composition of morphisms of finite type is of finite type.
In the proof of Lemma \ref{lemma-locally-finite-type-characterize} we saw that being of finite type is a local property of ring maps. Hence the first statement of the lemma follows from Lemma \ref{lemma-base-change-type-P} combined with the fact that being of finite type is a property of ring maps that is stable under base change, see Algebra, Lemma \ref{algebra-lemma-base-change-finiteness}. By the above and the fact that a base change of a quasi-compact morphism is quasi-compact, see Schemes, Lemma \ref{schemes-lemma-quasi-compact-preserved-base-change} we see that the base change of a morphism of finite type is a morphism of finite type.
The equivalence of (1) and (2) is obvious as $\Spec(k)$ is a singleton and hence any morphism from it is quasi-compact. \medskip\noindent Suppose $f$ is locally of finite type. Choose any affine open $\Spec(R) = U \subset S$ such that the image of $f$ is contained in $U$, and the ring map $R \to k$ is of finite type. Let $\mathfrak p \subset R$ be the kernel. Then $R/\mathfrak p \subset k$ is of finite type. By Algebra, Lemma \ref{algebra-lemma-field-finite-type-over-domain} there exist a $\overline{f} \in R/\mathfrak p$ such that $(R/\mathfrak p)_{\overline{f}}$ is a field and $(R/\mathfrak p)_{\overline{f}} \to k$ is a finite field extension. If $f \in R$ is a lift of $\overline{f}$, then we see that $k$ is a finite $R_f$-module. Thus (2) $\Rightarrow$ (3). \medskip\noindent Suppose that $\Spec(R) = U \subset S$ is an affine open such that $f$ corresponds to a finite ring map $R \to k$. Then $f$ is locally of finite type by Lemma \ref{lemma-locally-finite-type-characterize}. Thus (3) $\Rightarrow$ (2). \medskip\noindent Suppose $R \to k$ is finite. The image of $R \to k$ is a field over which $k$ is finite by Algebra, Lemma \ref{algebra-lemma-integral-under-field}. Hence the kernel of $R \to k$ is a maximal ideal. Thus (3) $\Rightarrow$ (4). \medskip\noindent The implication (4) $\Rightarrow$ (3) is immediate.
Since the morphism $\Spec(\kappa) \to \Spec(A)$ is of finite type it is clear that if $f$ is of finite type so is the composition $\Spec(\kappa) \to S$ (see Lemma \ref{lemma-composition-finite-type}). For the converse, note that $\Spec(A) \to S$ maps into some affine open $U = \Spec(B)$ of $S$ as $\Spec(A)$ has only one point. To finish apply Algebra, Lemma \ref{algebra-lemma-essentially-of-finite-type-into-artinian-local} to $B \to A$.
We have $f(T_{\text{ft-pts}}) \subset S_{\text{ft-pts}}$ by Lemma \ref{lemma-finite-type-points-morphism}. Let $s \in S$ be a finite type point. As $f$ is surjective the scheme $T_s = \Spec(\kappa(s)) \times_S T$ is nonempty, therefore has a finite type point $t \in T_s$ by Lemma \ref{lemma-identify-finite-type-points}. Now $T_s \to T$ is a morphism of finite type as a base change of $s \to S$ (Lemma \ref{lemma-base-change-finite-type}). Hence the image of $t$ in $T$ is a finite type point by Lemma \ref{lemma-finite-type-points-morphism} which maps to $s$ by construction.
Note that $T$ carries a scheme structure (see Schemes, Lemma \ref{schemes-lemma-reduced-closed-subscheme}) such that $T \to S$ is a locally closed immersion. Any locally closed immersion is locally of finite type, see Lemma \ref{lemma-immersion-locally-finite-type}. Hence by Lemma \ref{lemma-finite-type-points-morphism} we see $T_{\text{ft-pts}} \subset S_{\text{ft-pts}}$. Finally, any nonempty affine open of $T$ has at least one closed point which is a finite type point of $T$ by Lemma \ref{lemma-identify-finite-type-points}.
We have trivially (4) $\Rightarrow$ (3) $\Rightarrow$ (2). Lemma \ref{lemma-enough-finite-type-points} shows that (2) implies (1). Hence it suffices to show that (1) implies (4). Suppose that $T \to S$ is locally of finite type. Choose $t \in T$ closed and let $s \in S$ be the image. Choose affine open neighbourhoods $\Spec(R) = U \subset S$ of $s$ and $\Spec(A) = V \subset T$ of $t$ with $V$ mapping into $U$. The induced ring map $R \to A$ is of finite type (see Lemma \ref{lemma-locally-finite-type-characterize}) and $R$ is Jacobson by Properties, Lemma \ref{properties-lemma-locally-jacobson}. Thus the result follows from Algebra, Proposition \ref{algebra-proposition-Jacobson-permanence}.
We will use Lemma \ref{lemma-Jacobson-universally-Jacobson} without mention. The spectrum of a field is clearly Jacobson. The spectrum of $\mathbf{Z}$ is Jacobson, see Algebra, Lemma \ref{algebra-lemma-pid-jacobson}. For (3) see Algebra, Lemma \ref{algebra-lemma-noetherian-dim-1-Jacobson}. For (4) see Properties, Lemma \ref{properties-lemma-complement-closed-point-Jacobson}.
By Lemma \ref{lemma-immersion-locally-finite-type} an open immersion is locally of finite type. A composition of morphisms locally of finite type is locally of finite type (Lemma \ref{lemma-composition-finite-type}). Thus it is clear that if $S$ is universally catenary then any open and any scheme locally of finite type over $S$ is universally catenary as well. This proves the final statement of the lemma and that (1) implies (2). \medskip\noindent If $\Spec(R)$ is a universally catenary scheme, then every scheme $\Spec(A)$ with $A$ a finite type $R$-algebra is catenary. Hence all these rings $A$ are catenary by Algebra, Lemma \ref{algebra-lemma-catenary}. Thus $R$ is universally catenary. Combined with the remarks above we conclude that (1) implies (3), and (2) implies (4). Of course (3) implies (4) trivially. \medskip\noindent To finish the proof we show that (4) implies (1). Assume (4) and let $X \to S$ be a morphism locally of finite type. We can find an affine open covering $X = \bigcup V_j$ such that each $V_j \to S$ maps into one of the $U_i$. By Lemma \ref{lemma-locally-finite-type-characterize} the induced ring map $\mathcal{O}(U_i) \to \mathcal{O}(V_j)$ is of finite type. Hence $\mathcal{O}(V_j)$ is catenary. Hence $X$ is catenary by Properties, Lemma \ref{properties-lemma-catenary-local}.
Assume that all local rings of $S$ are universally catenary. Let $f : X \to S$ be locally of finite type. We know that $X$ is catenary if and only if $\mathcal{O}_{X, x}$ is catenary for all $x \in X$. If $f(x) = s$, then $\mathcal{O}_{X, x}$ is essentially of finite type over $\mathcal{O}_{S, s}$. Hence $\mathcal{O}_{X, x}$ is catenary by the assumption that $\mathcal{O}_{S, s}$ is universally catenary. \medskip\noindent Conversely, assume that $S$ is universally catenary. Let $s \in S$. We may replace $S$ by an affine open neighbourhood of $s$ by Lemma \ref{lemma-universally-catenary-local}. Say $S = \Spec(R)$ and $s$ corresponds to the prime ideal $\mathfrak p$. Any finite type $R_{\mathfrak p}$-algebra $A'$ is of the form $A_{\mathfrak p}$ for some finite type $R$-algebra $A$. By assumption (and Lemma \ref{lemma-universally-catenary-local} if you like) the ring $A$ is catenary, and hence $A'$ (a localization of $A$) is catenary. Thus $R_{\mathfrak p}$ is universally catenary.
By Lemma \ref{lemma-immersion-locally-finite-type} an open immersion is locally of finite type. A composition of morphisms locally of finite type is locally of finite type (Lemma \ref{lemma-composition-finite-type}). Thus it is clear that if $X$ is J-2 then any open and any scheme locally of finite type over $X$ is J-2 as well. This proves the final statement of the lemma. \medskip\noindent If $\Spec(R)$ is J-2, then for every finite type $R$-algebra $A$ the regular locus of the scheme $\Spec(A)$ is open. Hence $R$ is J-2, by definition (see More on Algebra, Definition \ref{more-algebra-definition-J}). Combined with the remarks above we conclude that (1) implies (3), and (2) implies (4). Of course (1) $\Rightarrow$ (2) and (3) $\Rightarrow$ (4) trivially. \medskip\noindent To finish the proof we show that (4) implies (1). Assume (4) and let $Y \to X$ be a morphism locally of finite type. We can find an affine open covering $Y = \bigcup V_j$ such that each $V_j \to X$ maps into one of the $U_i$. By Lemma \ref{lemma-locally-finite-type-characterize} the induced ring map $\mathcal{O}(U_i) \to \mathcal{O}(V_j)$ is of finite type. Hence the regular locus of $V_j = \Spec(\mathcal{O}(V_j))$ is open. Since $\text{Reg}(Y) \cap V_j = \text{Reg}(V_j)$ we conclude that $\text{Reg}(Y)$ is open as desired.
The second statement follows from the first by elementary topology. According to Schemes, Lemma \ref{schemes-lemma-fibre-topological} to prove the first statement we may replace $X$ by $X_s$ and $S$ by $\Spec(\kappa(s))$. Thus we may assume that $S = \Spec(k)$ is the spectrum of a field. In this case, let $\Spec(A) = U \subset X$ be any affine open containing $x$. The point $x$ corresponds to a prime ideal $\mathfrak q \subset A$ such that $k \subset \kappa(\mathfrak q)$ is an algebraic field extension. By Algebra, Lemma \ref{algebra-lemma-finite-residue-extension-closed} we see that $\mathfrak q$ is a maximal ideal, i.e., $x \in U$ is a closed point. Since the affine opens form a basis of the topology of $X$ we conclude that $\{x\}$ is closed.
If the extension is finite, then $x$ is a closed point of the fibre by Lemma \ref{lemma-algebraic-residue-field-extension-closed-point-fibre} above. For the converse, assume that $x$ is a closed point of its fibre. Choose affine opens $\Spec(A) = U \subset X$ and $\Spec(R) = V \subset S$ such that $f(U) \subset V$. By Lemma \ref{lemma-locally-finite-type-characterize} the ring map $R \to A$ is of finite type. Let $\mathfrak q \subset A$, resp.\ $\mathfrak p \subset R$ be the prime ideal corresponding to $x$, resp.\ $s$. Consider the fibre ring $\overline{A} = A \otimes_R \kappa(\mathfrak p)$. Let $\overline{\mathfrak q}$ be the prime of $\overline{A}$ corresponding to $\mathfrak q$. The assumption that $x$ is a closed point of its fibre implies that $\overline{\mathfrak q}$ is a maximal ideal of $\overline{A}$. Since $\overline{A}$ is an algebra of finite type over the field $\kappa(\mathfrak p)$ we see by the Hilbert Nullstellensatz, see Algebra, Theorem \ref{algebra-theorem-nullstellensatz}, that $\kappa(\overline{\mathfrak q})$ is a finite extension of $\kappa(\mathfrak p)$. Since $\kappa(s) = \kappa(\mathfrak p)$ and $\kappa(x) = \kappa(\mathfrak q) = \kappa(\overline{\mathfrak q})$ we win.
The residue field $\kappa(x')$ is a quotient of $\kappa(f'(x')) \otimes_{\kappa(f(x))} \kappa(x)$, see Schemes, Lemma \ref{schemes-lemma-points-fibre-product}. Hence it is a finite extension of $\kappa(f'(x'))$ as $\kappa(x)$ is a finite extension of $\kappa(f(x))$ by Lemma \ref{lemma-closed-point-fibre-locally-finite-type}. Thus we see that $x'$ is closed in its fibre by applying that lemma one more time.