hcju/stacksqa huggingface dataset:
The ring $B$ is semi-local by Lemma \ref{lemma-finite-in-codim-1}. Let $B'$ be the integral closure of $A$ in $B$. By Lemma \ref{lemma-quasi-finite-open-integral-closure} we can find a finite $A$-subalgebra $C \subset B'$ such that on setting $\mathfrak n_i = C \cap \mathfrak m_i$ we have $C_{\mathfrak n_i} \cong B_{\mathfrak m_i}$ and the primes $\mathfrak n_1, \ldots, \mathfrak n_n$ are pairwise distinct. The ring $C$ is semi-local by Lemma \ref{lemma-finite-in-codim-1}. Let $\mathfrak p_j$, $j = 1, \ldots, m$ be the other maximal ideals of $C$ (the ``missing points''). By Lemma \ref{lemma-finite-extension-dim-1} we have $$ \text{ord}_A(x^{[L : K]}) = \sum\nolimits_i [\kappa(\mathfrak n_i) : \kappa(\mathfrak m_A)] \text{ord}_{C_{\mathfrak n_i}}(x) + \sum\nolimits_j [\kappa(\mathfrak p_j) : \kappa(\mathfrak m_A)] \text{ord}_{C_{\mathfrak p_j}}(x) $$ hence the inequality follows. In case of equality we conclude that $m = 0$ (no ``missing points''). Hence $C \subset B$ is an inclusion of semi-local rings inducing a bijection on maximal ideals and an isomorphism on all localizations at maximal ideals. So if $b \in B$, then $I = \{x \in C \mid xb \in C\}$ is an ideal of $C$ which is not contained in any of the maximal ideals of $C$, and hence $I = C$, hence $b \in C$. Thus $B = C$ and $B$ is finite over $A$.
Let $S'$ be a finite type $R$-algebra such that $S = S'_{\mathfrak q'}$ for some prime $\mathfrak q'$ of $S'$. By Definition \ref{definition-quasi-finite} we see that $R \to S'$ is quasi-finite at $\mathfrak q'$. After replacing $S'$ by $S'_{g'}$ for some $g' \in S'$, $g' \not \in \mathfrak q'$ we may assume that $R \to S'$ is quasi-finite, see Lemma \ref{lemma-quasi-finite-open}. Then by Lemma \ref{lemma-quasi-finite-open-integral-closure} there exists a finite $R$-algebra $S''$ and elements $g' \in S'$, $g' \not \in \mathfrak q'$ and $g'' \in S''$ such that $S'_{g'} \cong S''_{g''}$ as $R$-algebras. This proves the lemma.
There exists a finite $R$-algebra $S' \subset S$ and an element $g \in S'$, $g \not \in \mathfrak q' = S' \cap \mathfrak q$ such that $S'_g = S_g$ and in particular $S'_{\mathfrak q'} = S_\mathfrak q$, see Lemma \ref{lemma-quasi-finite-open-integral-closure}. We have $$ R_\mathfrak p^\wedge \otimes_R S' = (S'_{\mathfrak q'})^\wedge \times B' $$ by Lemma \ref{lemma-completion-finite-extension}. Observe that under this product decomposition $g$ maps to a pair $(u, b')$ with $u \in (S'_{\mathfrak q'})^\wedge$ a unit because $g \not \in \mathfrak q'$. The product decomposition for $R_\mathfrak p^\wedge \otimes_R S'$ induces a product decomposition $$ R_\mathfrak p^\wedge \otimes_R S = A \times B $$ Since $S'_g = S_g$ we also have $(R_\mathfrak p^\wedge \otimes_R S')_g = (R_\mathfrak p^\wedge \otimes_R S)_g$ and since $g \mapsto (u, b')$ where $u$ is a unit we see that $(S'_{\mathfrak q'})^\wedge = A$. Since the isomorphism $S'_{\mathfrak q'} = S_\mathfrak q$ determines an isomorphism on completions this also tells us that $A = S_\mathfrak q^\wedge$. This finishes the proof, except that we should perform the sanity check that the induced map $\phi : R_\mathfrak p^\wedge \otimes_R S \to A = S_\mathfrak q^\wedge$ is the natural one. For elements of the form $x \otimes 1$ with $x \in R_\mathfrak p^\wedge$ this is clear as the natural map $R_\mathfrak p^\wedge \to S_\mathfrak q^\wedge$ factors through $(S'_{\mathfrak q'})^\wedge$. For elements of the form $1 \otimes y$ with $y \in S$ we can argue that for some $n \geq 1$ the element $g^ny$ is the image of some $y' \in S'$. Thus $\phi(1 \otimes g^ny)$ is the image of $y'$ by the composition $S' \to (S'_{\mathfrak q'})^\wedge \to S_\mathfrak q^\wedge$ which is equal to the image of $g^ny$ by the map $S \to S_\mathfrak q^\wedge$. Since $g$ maps to a unit this also implies that $\phi(1 \otimes y)$ has the correct value, i.e., the image of $y$ by $S \to S_\mathfrak q^\wedge$.
The ring $\overline{S} = S \otimes_R \kappa(\mathfrak p)$ is of finite type over $\kappa(\mathfrak p)$. Let $\overline{\mathfrak q}$ be the prime of $\overline{S}$ corresponding to $\mathfrak q$. By definition of the dimension of a topological space at a point there exists an open $U \subset \Spec(\overline{S})$ with $\overline{q} \in U$ and $\dim(U) = n$. Since the topology on $\Spec(\overline{S})$ is induced from the topology on $\Spec(S)$ (see Remark \ref{remark-fundamental-diagram}), we can find a $g \in S$, $g \not \in \mathfrak q$ with image $\overline{g} \in \overline{S}$ such that $D(\overline{g}) \subset U$. Thus after replacing $S$ by $S_g$ we see that $\dim(\overline{S}) = n$. \medskip\noindent Next, choose generators $x_1, \ldots, x_N$ for $S$ as an $R$-algebra. By Lemma \ref{lemma-Noether-normalization} there exist elements $y_1, \ldots, y_n$ in the $\mathbf{Z}$-subalgebra of $S$ generated by $x_1, \ldots, x_N$ such that the map $R[t_1, \ldots, t_n] \to S$, $t_i \mapsto y_i$ has the property that $\kappa(\mathfrak p)[t_1\ldots, t_n] \to \overline{S}$ is finite. In particular, $S$ is quasi-finite over $R[t_1, \ldots, t_n]$ at $\mathfrak q$. Hence, by Lemma \ref{lemma-quasi-finite-open} we may replace $S$ by $S_g$ for some $g\in S$, $g \not \in \mathfrak q$ such that $R[t_1, \ldots, t_n] \to S$ is quasi-finite.
After replacing $S$ by a principal localization we may assume there exists a quasi-finite ring map $\varphi : R[t_1, \ldots, t_n] \to S$, see Lemma \ref{lemma-quasi-finite-over-polynomial-algebra}. Set $\mathfrak q' = \varphi^{-1}(\mathfrak q)$. Let $\overline{\mathfrak q}' \subset \kappa(\mathfrak p)[t_1, \ldots, t_n]$ be the prime corresponding to $\mathfrak q'$. By Lemma \ref{lemma-refined-Noether-normalization} there exists a finite ring map $\kappa(\mathfrak p)[x_1, \ldots, x_n] \to \kappa(\mathfrak p)[t_1, \ldots, t_n]$ such that the inverse image of $\overline{\mathfrak q}'$ is $(x_{r + 1}, \ldots, x_n)$. Let $\overline{h}_i \in \kappa(\mathfrak p)[t_1, \ldots, t_n]$ be the image of $x_i$. We can find an element $f \in R$, $f \not \in \mathfrak p$ and $h_i \in R_f[t_1, \ldots, t_n]$ which map to $\overline{h}_i$ in $\kappa(\mathfrak p)[t_1, \ldots, t_n]$. Then the ring map $$ R_f[x_1, \ldots, x_n] \longrightarrow R_f[t_1, \ldots, t_n] $$ becomes finite after tensoring with $\kappa(\mathfrak p)$. In particular, $R_f[t_1, \ldots, t_n]$ is quasi-finite over $R_f[x_1, \ldots, x_n]$ at the prime $\mathfrak q'R_f[t_1, \ldots, t_n]$. Hence, by Lemma \ref{lemma-quasi-finite-open} there exists a $g \in R_f[t_1, \ldots, t_n]$, $g \not \in \mathfrak q'R_f[t_1, \ldots, t_n]$ such that $R_f[x_1, \ldots, x_n] \to R_f[t_1, \ldots, t_n, 1/g]$ is quasi-finite. Thus we see that the composition $$ R_f[x_1, \ldots, x_n] \longrightarrow R_f[t_1, \ldots, t_n, 1/g] \longrightarrow S_{\varphi(g)} $$ is quasi-finite and we win.
If $R_{\mathfrak p}$ is Noetherian (and hence $S_{\mathfrak q}$ Noetherian since it is essentially of finite type over $R_{\mathfrak p}$) then this follows immediately from Lemma \ref{lemma-dimension-base-fibre-total} and the definitions. In the general case, let $S'$ be the integral closure of $R_\mathfrak p$ in $S_\mathfrak p$. By Zariski's Main Theorem \ref{theorem-main-theorem} we have $S_{\mathfrak q} = S'_{\mathfrak q'}$ for some $\mathfrak q' \subset S'$ lying over $\mathfrak q$. By Lemma \ref{lemma-integral-dim-up} we have $\dim(S') \leq \dim(R_\mathfrak p)$ and hence a fortiori $\dim(S_\mathfrak q) = \dim(S'_{\mathfrak q'}) \leq \dim(R_\mathfrak p)$.
It is open by Lemma \ref{lemma-dimension-fibres-bounded-open-upstairs}. Let $S = R[x_1, \ldots, x_n]/(f_1, \ldots, f_m)$ be a presentation of $S$. Let $R_0$ be the $\mathbf{Z}$-subalgebra of $R$ generated by the coefficients of the polynomials $f_i$. Let $S_0 = R_0[x_1, \ldots, x_n]/(f_1, \ldots, f_m)$. Then $S = R \otimes_{R_0} S_0$. By Lemma \ref{lemma-dimension-fibres-bounded-open-upstairs-base-change} $V_n$ is the inverse image of an open $V_{0, n}$ under the quasi-compact continuous map $\Spec(S) \to \Spec(S_0)$. Since $S_0$ is Noetherian we see that $V_{0, n}$ is quasi-compact.
It suffices to show that $\dim_{\mathfrak q}(S/k)$ is equal to $\dim(S \otimes_R K)$ for every prime $\mathfrak q$ of $S$ containing $\mathfrak m_RS$. Pick such a prime. By Lemma \ref{lemma-dimension-fibres-bounded-open-upstairs} the inequality $\dim_{\mathfrak q}(S/k) \geq \dim(S \otimes_R K)$ holds. Set $n = \dim_{\mathfrak q}(S/k)$. By Lemma \ref{lemma-quasi-finite-over-polynomial-algebra} after replacing $S$ by $S_g$ for some $g \in S$, $g \not \in \mathfrak q$ there exists a quasi-finite ring map $R[t_1, \ldots, t_n] \to S$. If $\dim(S \otimes_R K) < n$, then $K[t_1, \ldots, t_n] \to S \otimes_R K$ has a nonzero kernel. Say $f = \sum a_I t_1^{i_1}\ldots t_n^{i_n}$. After dividing $f$ by a nonzero coefficient of $f$ with minimal valuation, we may assume $f\in R[t_1, \ldots, t_n]$ and some $a_I$ does not map to zero in $k$. Hence the ring map $k[t_1, \ldots, t_n] \to S \otimes_R k$ has a nonzero kernel which implies that $\dim(S \otimes_R k) < n$. Contradiction.
It is clear that if $R \to S$ is of finite presentation then $R' \to S'$ is of finite presentation. Assume that $R' \to S'$ is of finite presentation. By Lemma \ref{lemma-finite-type-descends} we see that $R \to S$ is of finite type. Write $S = R[x_1, \ldots, x_n]/I$. By flatness $S' = R'[x_1, \ldots, x_n]/R'\otimes I$. Say $g_1, \ldots, g_m$ generate $R'\otimes I$ over $R'[x_1, \ldots, x_n]$. Write $g_j = \sum_i a_{ij} \otimes f_{ji}$ for some $a_{ij} \in R'$ and $f_{ji} \in I$. Let $J \subset I$ be the ideal generated by the $f_{ij}$. By flatness we have $R' \otimes_R J \subset R'\otimes_R I$, and both are ideals over $R'[x_1, \ldots, x_n]$. By construction $g_j \in R' \otimes_R J$. Hence $R' \otimes_R J = R'\otimes_R I$. By faithful flatness $J = I$.
Proof of (1). Let $x_1, \ldots, x_n \in M$ be elements which generate $S^{-1}M$ as an $S^{-1}R$-module. Let $M'$ be the $R$-submodule of $M$ generated by $x_1, \ldots, x_n$. \medskip\noindent Proof of (2). Let $x_1, \ldots, x_n \in M$ be elements which generate $S^{-1}M$ as an $S^{-1}R$-module. Let $K = \Ker(R^{\oplus n} \to M)$ where the map is given by the rule $(a_1, \ldots, a_n) \mapsto \sum a_i x_i$. By Lemma \ref{lemma-extension} we see that $S^{-1}K$ is a finite $S^{-1}R$-module. By (1) we can find a finite submodule $K' \subset K$ with $S^{-1}K' = S^{-1}K$. Take $M' = \Coker(K' \to R^{\oplus n})$.
Write $S = R[x_1, \ldots, x_n]/(g_1, \ldots, g_m)$. Let $a_i \in R_\mathfrak p$ be an element mapping to the image of $x_i$ in $S_\mathfrak q$. Write $a_i = b_i/f$ for some $f \in R$, $f \not \in \mathfrak p$. After replacing $R$ by $R_f$ and $x_i$ by $x_i - a_i$ we may assume that $S = R[x_1, \ldots, x_n]/(g_1, \ldots, g_m)$ such that $x_i$ maps to zero in $S_\mathfrak q$. Then if $c_j$ denotes the constant term of $g_j$ we conclude that $c_j$ maps to zero in $R_\mathfrak p$. After another replacement of $R$ we may assume that the constant coefficients $c_j$ of the $g_j$ are zero. Thus we obtain an $R$-algebra map $S \to R$, $x_i \mapsto 0$ whose kernel is the ideal $(x_1, \ldots, x_n)$. \medskip\noindent Note that $\mathfrak q = \mathfrak pS + (x_1, \ldots, x_n)$. Write $g_j = \sum a_{ji}x_i + h.o.t.$. Since $S_\mathfrak q = R_\mathfrak p$ we have $\mathfrak p \otimes \kappa(\mathfrak p) = \mathfrak q \otimes \kappa(\mathfrak q)$. It follows that $m \times n$ matrix $A = (a_{ji})$ defines a surjective map $\kappa(\mathfrak p)^{\oplus m} \to \kappa(\mathfrak p)^{\oplus n}$. Thus after inverting some element of $R$ not in $\mathfrak p$ we may assume there are $b_{ij} \in R$ such that $\sum b_{ij} g_j = x_i + h.o.t.$. We conclude that $(x_1, \ldots, x_n) = (x_1, \ldots, x_n)^2$ in $S$. It follows from Lemma \ref{lemma-ideal-is-squared-union-connected} that $(x_1, \ldots, x_n)$ is generated by an idempotent $e$. Setting $C = eS$ finishes the proof.
Let $\psi : S_{\mathfrak q} \to S'_{\mathfrak q'}$ be the isomorphism of the hypothesis of the lemma. Write $S = R[x_1, \ldots, x_n]/(f_1, \ldots, f_r)$ and $S' = R[y_1, \ldots, y_m]/J$. For each $i = 1, \ldots, n$ choose a fraction $h_i/g_i$ with $h_i, g_i \in R[y_1, \ldots, y_m]$ and $g_i \bmod J$ not in $\mathfrak q'$ which represents the image of $x_i$ under $\psi$. After replacing $S'$ by $S'_{g_1 \ldots g_n}$ and $R[y_1, \ldots, y_m, y_{m + 1}]$ (mapping $y_{m + 1}$ to $1/(g_1\ldots g_n)$) we may assume that $\psi(x_i)$ is the image of some $h_i \in R[y_1, \ldots, y_m]$. Consider the elements $f_j(h_1, \ldots, h_n) \in R[y_1, \ldots, y_m]$. Since $\psi$ kills each $f_j$ we see that there exists a $g \in R[y_1, \ldots, y_m]$, $g \bmod J \not \in \mathfrak q'$ such that $g f_j(h_1, \ldots, h_n) \in J$ for each $j = 1, \ldots, r$. After replacing $S'$ by $S'_g$ and $R[y_1, \ldots, y_m, y_{m + 1}]$ as before we may assume that $f_j(h_1, \ldots, h_n) \in J$. Thus we obtain a ring map $S \to S'$, $x_i \mapsto h_i$ which induces $\psi$ on local rings. By Lemma \ref{lemma-compose-finite-type} the map $S \to S'$ is of finite presentation. By Lemma \ref{lemma-local-isomorphism} we may assume that $S' = S \times C$. Thus localizing $S'$ at the idempotent corresponding to the factor $C$ we obtain the result.
Choose $s_1, \ldots, s_n \in S$ whose images in $S/IS$ generate $S/IS$ as an algebra over $R/I$. By Lemma \ref{lemma-NAK} part (11) we see that the $R$-algebra map $R[x_1, \ldots, x_n \to S$, $x_i \mapsto s_i$ is surjective and we conclude.
Write $S' = R[x_1, \ldots, x_m]/K$ for some ideal $K$. By assumption there exist $g_j = x_j + \sum \delta_{j, J} x^J \in R[x_1, \ldots, x_n]$ with $\delta_{j, J} \in I$ and with $g_j \bmod K \in \Im(S \to S')$. Hence it suffices to show that $g_1, \ldots, g_m$ generate $R[x_1, \ldots, x_n]$. Let $R_0 \subset R$ be a finitely generated $\mathbf{Z}$-subalgebra of $R$ containing at least the $\delta_{j, J}$. Then $R_0 \cap I$ is a nilpotent ideal (by Lemma \ref{lemma-Noetherian-power}). It follows that $R_0[x_1, \ldots, x_n]$ is generated by $g_1, \ldots, g_m$ (because $x_j \mapsto g_j$ defines an automorphism of $R_0[x_1, \ldots, x_m]$; details omitted). Since $R$ is the union of the subrings $R_0$ we win.
Let $J = \Ker(S \to S')$. By Lemma \ref{lemma-compose-finite-type} $J$ is a finitely generated ideal. Since $S'_\mathfrak q$ is flat over $R$ we see that $J_\mathfrak q/IJ_\mathfrak q \subset S_\mathfrak q/IS_{\mathfrak q}$ (apply Lemma \ref{lemma-flat-tor-zero} to $0 \to J \to S \to S' \to 0$). By assumption (2) we see that $J_\mathfrak q/IJ_\mathfrak q$ is zero. By Nakayama's lemma (Lemma \ref{lemma-NAK}) we see that there exists a $g \in S$, $g \not \in \mathfrak q$ such that $J_g = 0$. Hence $S_g \cong S'_g$ as desired.
By Lemma \ref{lemma-surjective-mod-locally-nilpotent} the map $S \to S'$ is surjective. As $I$ is locally nilpotent, so are the ideals $IS$ and $IS'$ (Lemma \ref{lemma-locally-nilpotent}). Hence every prime ideal $\mathfrak q$ of $S$ contains $IS$ and (trivially) $S_\mathfrak q/IS_\mathfrak q \cong S'_\mathfrak q/IS'_\mathfrak q$. Thus Lemma \ref{lemma-isomorphism-modulo-ideal} applies and we see that $S_\mathfrak q \to S'_\mathfrak q$ is an isomorphism for every prime $\mathfrak q \subset S$. It follows that $S \to S'$ is injective for example by Lemma \ref{lemma-characterize-zero-local}.
The category\footnote{To avoid set theoretical difficulties we consider only $A' \to A$ such that $A'$ is a quotient of $R[x_1, x_2, x_3, \ldots]$.} $\mathcal{I}$ is nonempty as $R \to R$ is an object of it. Consider a pair of objects $A' \to A$, $A'' \to A$ of $\mathcal{I}$. Then $A' \otimes_R A'' \to A$ is in $\mathcal{I}$ (use Lemmas \ref{lemma-compose-finite-type} and \ref{lemma-base-change-finiteness}). The ring maps $A' \to A' \otimes_R A''$ and $A'' \to A' \otimes_R A''$ define arrows in $\mathcal{I}$ thereby proving the second defining property of a filtered category, see Categories, Definition \ref{categories-definition-directed}. Finally, suppose that we have two morphisms $\sigma, \tau : A' \to A''$ in $\mathcal{I}$. If $x_1, \ldots, x_r \in A'$ are generators of $A'$ as an $R$-algebra, then we can consider $A''' = A''/(\sigma(x_i) - \tau(x_i))$. This is a finitely presented $R$-algebra and the given $R$-algebra map $A'' \to A$ factors through the surjection $\nu : A'' \to A'''$. Thus $\nu$ is a morphism in $\mathcal{I}$ equalizing $\sigma$ and $\tau$ as desired. \medskip\noindent The fact that our index category is cofiltered means that we may compute the value of $B = \colim_{A' \to A} A'$ in the category of sets (some details omitted; compare with the discussion in Categories, Section \ref{categories-section-directed-colimits}). To see that $B \to A$ is surjective, for every $a \in A$ we can use $R[x] \to A$, $x \mapsto a$ to see that $a$ is in the image of $B \to A$. Conversely, if $b \in B$ is mapped to zero in $A$, then we can find $A' \to A$ in $\mathcal{I}$ and $a' \in A'$ which maps to $b$. Then $A'/(a') \to A$ is in $\mathcal{I}$ as well and the map $A' \to B$ factors as $A' \to A'/(a') \to B$ which shows that $b = 0$ as desired.
The first proof is that this follows from Lemma \ref{lemma-ring-colimit-fp-category} and Categories, Lemma \ref{categories-lemma-directed-category-system}. \medskip\noindent Second proof. Compare with the proof of Lemma \ref{lemma-module-colimit-fp}. Consider any finite subset $S \subset A$, and any finite collection of polynomial relations $E$ among the elements of $S$. So each $s \in S$ corresponds to $x_s \in A$ and each $e \in E$ consists of a polynomial $f_e \in R[X_s; s\in S]$ such that $f_e(x_s) = 0$. Let $A_{S, E} = R[X_s; s\in S]/(f_e; e\in E)$ which is a finitely presented $R$-algebra. There are canonical maps $A_{S, E} \to A$. If $S \subset S'$ and if the elements of $E$ correspond, via the map $R[X_s; s \in S] \to R[X_s; s\in S']$, to a subset of $E'$, then there is an obvious map $A_{S, E} \to A_{S', E'}$ commuting with the maps to $A$. Thus, setting $\Lambda$ equal the set of pairs $(S, E)$ with ordering by inclusion as above, we get a directed partially ordered set. It is clear that the colimit of this directed system is $A$. \medskip\noindent For the last statement, suppose $A = R[x_1, \ldots, x_n]/I$. In this case, consider the subset $\Lambda' \subset \Lambda$ consisting of those systems $(S, E)$ above with $S = \{x_1, \ldots, x_n\}$. It is easy to see that still $A = \colim_{\lambda' \in \Lambda'} A_{\lambda'}$. Moreover, the transition maps are clearly surjective.
Assume (1) and write $S = R[x_1, \ldots, x_n] / (f_1, \ldots, f_m)$. Let $A = \colim A_\lambda$. Observe that an $R$-algebra homomorphism $S \to A$ or $S \to A_\lambda$ is determined by the images of $x_1, \ldots, x_n$. Hence it is clear that $\colim_\lambda \Hom_R(S, A_\lambda) \to \Hom_R(S, A)$ is injective. To see that it is surjective, let $\chi : S \to A$ be an $R$-algebra homomorphism. Then each $x_i$ maps to some element in the image of some $A_{\lambda_i}$. We may pick $\mu \geq \lambda_i$, $i = 1, \ldots, n$ and assume $\chi(x_i)$ is the image of $y_i \in A_\mu$ for $i = 1, \ldots, n$. Consider $z_j = f_j(y_1, \ldots, y_n) \in A_\mu$. Since $\chi$ is a homomorphism the image of $z_j$ in $A = \colim_\lambda A_\lambda$ is zero. Hence there exists a $\mu_j \geq \mu$ such that $z_j$ maps to zero in $A_{\mu_j}$. Pick $\nu \geq \mu_j$, $j = 1, \ldots, m$. Then the images of $z_1, \ldots, z_m$ are zero in $A_\nu$. This exactly means that the $y_i$ map to elements $y'_i \in A_\nu$ which satisfy the relations $f_j(y'_1, \ldots, y'_n) = 0$. Thus we obtain a ring map $S \to A_\nu$. This shows that (1) implies (2). \medskip\noindent It is clear that (2) implies (3). Assume (3). By Lemma \ref{lemma-ring-colimit-fp} we may write $S = \colim_\lambda S_\lambda$ with $S_\lambda$ of finite presentation over $R$. Then the identity map factors as $$ S \to S_\lambda \to S $$ for some $\lambda$. This implies that $S$ is finitely presented over $S_\lambda$ by Lemma \ref{lemma-compose-finite-type} part (4) applied to $S \to S_\lambda \to S$. Applying part (2) of the same lemma to $R \to S_\lambda \to S$ we conclude that $S$ is of finite presentation over $R$.
Suppose that $\mathcal{I} \to \mathcal{E}$, $i \mapsto A_i$ is a filtered diagram such that $\Lambda = \colim_i A_i$. Let $A \to \Lambda$ be an $R$-algebra map with $A$ of finite presentation over $R$. Then we get a factorization $A \to A_i \to \Lambda$ by applying Lemma \ref{lemma-characterize-finite-presentation}. Thus (1) implies (2). \medskip\noindent Consider the category $\mathcal{I}$ of Lemma \ref{lemma-ring-colimit-fp-category}. By Categories, Lemma \ref{categories-lemma-cofinal-in-filtered} the full subcategory $\mathcal{J}$ consisting of those $A \to \Lambda$ with $A \in \mathcal{E}$ is cofinal in $\mathcal{I}$ and is a filtered category. Then $\Lambda$ is also the colimit over $\mathcal{J}$ by Categories, Lemma \ref{categories-lemma-cofinal}.
To prove (1) choose a presentation $R^{\oplus m} \to R^{\oplus n} \to M \to 0$. Suppose that the first map is given by the matrix $A = (a_{ij})$. We can choose a $\lambda \in \Lambda$ and a matrix $A_\lambda = (a_{\lambda, ij})$ with coefficients in $R_\lambda$ which maps to $A$ in $R$. Then we simply let $M_\lambda$ be the $R_\lambda$-module with presentation $R_\lambda^{\oplus m} \to R_\lambda^{\oplus n} \to M_\lambda \to 0$ where the first arrow is given by $A_\lambda$. \medskip\noindent Parts (2) and (3) follow from Lemma \ref{lemma-module-map-property-in-colimit}.
To prove (1) choose a presentation $A = R[x_1, \ldots, x_n]/(f_1, \ldots, f_m)$. We can choose a $\lambda \in \Lambda$ and elements $f_{\lambda, j} \in R_\lambda[x_1, \ldots, x_n]$ mapping to $f_j \in R[x_1, \ldots, x_n]$. Then we simply let $A_\lambda = R_\lambda[x_1, \ldots, x_n]/(f_{\lambda, 1}, \ldots, f_{\lambda, m})$. \medskip\noindent Parts (2) and (3) follow from Lemma \ref{lemma-algebra-map-property-in-colimit}.
As in the proof of Lemma \ref{lemma-limit-essentially-finite-presentation} we may first write $R = \colim R_\lambda$ as a directed colimit of local $\mathbf{Z}$-algebras which are essentially of finite type. Next, we may assume that for some $\lambda_1 \in \Lambda$ there exist $f_{j, \lambda_1} \in R_{\lambda_1}[x_1, \ldots, x_n]$ such that $$ S = \colim_{\lambda \geq \lambda_1} S_\lambda, \text{ with } S_\lambda = (R_\lambda[x_1, \ldots, x_n]/ (f_{1, \lambda}, \ldots, f_{m, \lambda}))_{\mathfrak q_\lambda} $$ Choose a presentation $$ S^{\oplus s} \to S^{\oplus t} \to M \to 0 $$ of $M$ over $S$. Let $A \in \text{Mat}(t \times s, S)$ be the matrix of the presentation. For some $\lambda_2 \in \Lambda$, $\lambda_2 \geq \lambda_1$ we can find a matrix $A_{\lambda_2} \in \text{Mat}(t \times s, S_{\lambda_2})$ which maps to $A$. For all $\lambda \geq \lambda_2$ we let $M_\lambda = \Coker(S_\lambda^{\oplus s} \xrightarrow{A_\lambda} S_\lambda^{\oplus t})$. We leave it to the reader to see that this works.
Consider the set $\Lambda$ of pairs $(E, F)$ where $E \subset R$ is a finite subset, $F \subset S$ is a finite subset, and every element $f \in F$ is the root of a monic $P(X) \in R[X]$ whose coefficients are in $E$. Say $(E, F) \leq (E', F')$ if $E \subset E'$ and $F \subset F'$. Given $\lambda = (E, F) \in \Lambda$ set $R_\lambda \subset R$ equal to the $\mathbf{Z}$-subalgebra of $R$ generated by $E$ and $S_\lambda \subset S$ equal to the $\mathbf{Z}$-subalgebra generated by $F$ and the image of $E$ in $S$. It is clear that $R = \colim R_\lambda$. We have $S = \colim S_\lambda$ as every element of $S$ is integral over $S$. The ring maps $R_\lambda \to S_\lambda$ are finite by Lemma \ref{lemma-characterize-finite-in-terms-of-integral} and the fact that $S_\lambda$ is generated over $R_\lambda$ by the elements of $F$ which are integral over $R_\lambda$ by our condition on the pairs $(E, F)$. The lemma follows.