hcju/stacksqa huggingface dataset:
We first apply Lemma \ref{lemma-smooth-standard-smooth} to $S^{-1}R \to B'$. Thus we may assume $B'$ is standard smooth over $S^{-1}R$. Write $A = R[x_1, \ldots, x_n]/(g_1, \ldots, g_t)$ and say $x_i \mapsto \lambda_i$ in $\Lambda$. We may write $B' = S^{-1}R[x_1, \ldots, x_{n + m}]/(f_1, \ldots, f_c)$ for some $c \geq n$ where $\det(\partial f_j/\partial x_i)_{i, j = 1, \ldots, c}$ is invertible in $B'$ and such that $A \to B'$ is given by $x_i \mapsto x_i$, see Lemma \ref{lemma-standard-smooth-include-generators}. After multiplying $x_i$, $i > n$ by an element of $S$ and correspondingly modifying the equations $f_j$ we may assume $B' \to S^{-1}\Lambda$ maps $x_i$ to $\lambda_i/1$ for some $\lambda_i \in \Lambda$ for $i > n$. Choose a relation $$ 1 = a_0 \det(\partial f_j/\partial x_i)_{i, j = 1, \ldots, c} + \sum\nolimits_{j = 1, \ldots, c} a_jf_j $$ for some $a_j \in S^{-1}R[x_1, \ldots, x_{n + m}]$. Since each element of $S$ is invertible in $B'$ we may (by clearing denominators) assume that $f_j, a_j \in R[x_1, \ldots, x_{n + m}]$ and that $$ s_0 = a_0 \det(\partial f_j/\partial x_i)_{i, j = 1, \ldots, c} + \sum\nolimits_{j = 1, \ldots, c} a_jf_j $$ for some $s_0 \in S$. Since $g_j$ maps to zero in $S^{-1}R[x_1, \ldots, x_{n + m}]/(f_1, \ldots, x_c)$ we can find elements $s_j \in S$ such that $s_j g_j = 0$ in $R[x_1, \ldots, x_{n + m}]/(f_1, \ldots, f_c)$. Since $f_j$ maps to zero in $S^{-1}\Lambda$ we can find $s'_j \in S$ such that $s'_j f_j(\lambda_1, \ldots, \lambda_{n + m}) = 0$ in $\Lambda$. Consider the ring $$ B = R[x_1, \ldots, x_{n + m}]/ (s'_1f_1, \ldots, s'_cf_c, g_1, \ldots, g_t) $$ and the factorization $A \to B \to \Lambda$ with $B \to \Lambda$ given by $x_i \mapsto \lambda_i$. We claim that $s = s_0s_1 \ldots s_ts'_1 \ldots s'_c$ is elementary standard in $B$ over $R$ which finishes the proof. Namely, $s_j g_j \in (f_1, \ldots, f_c)$ and hence $sg_j \in (s'_1f_1, \ldots, s'_cf_c)$. Finally, we have $$ a_0\det(\partial s'_jf_j/\partial x_i)_{i, j = 1, \ldots, c} + \sum\nolimits_{j = 1, \ldots, c} (s'_1 \ldots \hat{s'_j} \ldots s'_c) a_j s'_jf_j = s_0s'_1\ldots s'_c $$ which divides $s$ as desired.
Assume PT holds for any Situation \ref{situation-global} where $R$ is a field. Let $R \to \Lambda$ be as in Situation \ref{situation-global} arbitrary. Note that $R/I \to \Lambda/I\Lambda$ is another regular ring map of Noetherian rings, see More on Algebra, Lemma \ref{more-algebra-lemma-regular-base-change}. Consider the set of ideals $$ \mathcal{I} = \{I \subset R \mid R/I \to \Lambda/I\Lambda \text{ does not have PT}\} $$ We have to show that $\mathcal{I}$ is empty. If this set is nonempty, then it contains a maximal element because $R$ is Noetherian. Replacing $R$ by $R/I$ and $\Lambda$ by $\Lambda/I$ we obtain a situation where PT holds for $R/I \to \Lambda/I\Lambda$ for any nonzero ideal of $R$. In particular, we see by applying Proposition \ref{proposition-lift} that $R$ is a reduced ring. \medskip\noindent Let $A \to \Lambda$ be an $R$-algebra homomorphism with $A$ of finite presentation. We have to find a factorization $A \to B \to \Lambda$ with $B$ smooth over $R$, see Algebra, Lemma \ref{algebra-lemma-when-colimit}. \medskip\noindent Let $S \subset R$ be the set of nonzerodivisors and consider the total ring of fractions $Q = S^{-1}R$ of $R$. We know that $Q = K_1 \times \ldots \times K_n$ is a product of fields, see Algebra, Lemmas \ref{algebra-lemma-total-ring-fractions-no-embedded-points} and \ref{algebra-lemma-Noetherian-irreducible-components}. By Lemma \ref{lemma-product} and our assumption PT holds for the ring map $S^{-1}R \to S^{-1}\Lambda$. Hence we can find a factorization $S^{-1}A \to B' \to S^{-1}\Lambda$ with $B'$ smooth over $S^{-1}R$. \medskip\noindent We apply Lemma \ref{lemma-delocalize-base} and find a factorization $A \to B \to \Lambda$ such that some $\pi \in S$ is elementary standard in $B$ over $R$. After replacing $A$ by $B$ we may assume that $\pi$ is elementary standard, hence strictly standard in $A$. We know that $R/\pi^8R \to \Lambda/\pi^8\Lambda$ satisfies PT. Hence we can find a factorization $R/\pi^8 R \to A/\pi^8A \to \bar C \to \Lambda/\pi^8\Lambda$ with $R/\pi^8 R \to \bar C$ smooth. By Lemma \ref{lemma-lifting} we can find an $R$-algebra map $D \to \Lambda$ with $D$ smooth over $R$ and a factorization $R/\pi^4 R \to A/\pi^4A \to D/\pi^4D \to \Lambda/\pi^4\Lambda$. By Lemma \ref{lemma-desingularize-strictly-standard} we can find $A \to B \to \Lambda$ with $B$ smooth over $R$ which finishes the proof.
We are going to prove this by induction on $r$. \medskip\noindent The case $r = 1$. Here the assumption is that there exists a factorization $A/\pi_1^8 \to \bar C \to \Lambda/\pi_1^8$ which resolves the situation modulo $\pi_1^8$. Conditions (1) and (2) are the assumptions needed to apply Lemma \ref{lemma-desingularize-lifting-apply}. Thus we can ``lift'' the resolution $\bar C$ to a resolution of $R \to A \to \Lambda \supset \mathfrak q$. \medskip\noindent The case $r > 1$. In this case we apply the induction hypothesis for $r - 1$ to the situation $R/\pi_1^8 \to A/\pi_1^8 \to \Lambda/\pi_1^8 \supset \mathfrak q/\pi_1^8\Lambda$. Note that property (2) is preserved by Lemma \ref{lemma-strictly-standard-base-change}.
Let $A_\mathfrak p \to C \to \Lambda_\mathfrak q$ be a resolution of $R_\mathfrak p \to A_\mathfrak p \to \Lambda_\mathfrak q \supset \mathfrak q\Lambda_\mathfrak q$. By our assumption that $\mathfrak q$ is minimal over $\mathfrak h_A$ this means that $H_{C/R_\mathfrak p} \Lambda_\mathfrak q = \Lambda_\mathfrak q$. By Lemma \ref{lemma-final-solve} we may assume that $C$ is smooth over $R_\mathfrak p$. By Lemma \ref{lemma-smooth-standard-smooth} we may assume that $C$ is standard smooth over $R_\mathfrak p$. Write $A = R[x_1, \ldots, x_n]/(g_1, \ldots, g_t)$ and say $A \to \Lambda$ is given by $x_i \mapsto \lambda_i$. Write $C = R_\mathfrak p[x_1, \ldots, x_{n + m}]/(f_1, \ldots, f_c)$ for some $c \geq n$ such that $A \to C$ maps $x_i$ to $x_i$ and such that $\det(\partial f_j/\partial x_i)_{i, j = 1, \ldots, c}$ is invertible in $C$, see Lemma \ref{lemma-standard-smooth-include-generators}. After clearing denominators we may assume $f_1, \ldots, f_c$ are elements of $R[x_1, \ldots, x_{n + m}]$. Of course $\det(\partial f_j/\partial x_i)_{i, j = 1, \ldots, c}$ is not invertible in $R[x_1, \ldots, x_{n + m}]/(f_1, \ldots, f_c)$ but it becomes invertible after inverting some element $s_0 \in R$, $s_0 \not \in \mathfrak p$. As $g_j$ maps to zero under $R[x_1, \ldots, x_n] \to A \to C$ we can find $s_j \in R$, $s_j \not \in \mathfrak p$ such that $s_j g_j$ is zero in $R[x_1, \ldots, x_{n + m}]/(f_1, \ldots, f_c)$. Write $f_j = F_j(x_1, \ldots, x_{n + m}, 1)$ for some polynomial $F_j \in R[x_1, \ldots, x_n, X_{n + 1}, \ldots, X_{n + m + 1}]$ homogeneous in $X_{n + 1}, \ldots, X_{n + m + 1}$. Pick $\lambda_{n + i} \in \Lambda$, $i = 1, \ldots, m + 1$ with $\lambda_{n + m + 1} \not \in \mathfrak q$ such that $x_{n + i}$ maps to $\lambda_{n + i}/\lambda_{n + m + 1}$ in $\Lambda_\mathfrak q$. Then \begin{align*} F_j(\lambda_1, \ldots, \lambda_{n + m + 1}) & = (\lambda_{n + m + 1})^{\deg(F_j)} F_j(\lambda_1, \ldots, \lambda_n, \frac{\lambda_{n + 1}}{\lambda_{n + m + 1}}, \ldots, \frac{\lambda_{n + m}}{\lambda_{n + m + 1}}, 1) \\ & = (\lambda_{n + m + 1})^{\deg(F_j)} f_j(\lambda_1, \ldots, \lambda_n, \frac{\lambda_{n + 1}}{\lambda_{n + m + 1}}, \ldots, \frac{\lambda_{n + m}}{\lambda_{n + m + 1}}) \\ & = 0 \end{align*} in $\Lambda_\mathfrak q$. Thus we can find $\lambda_0 \in \Lambda$, $\lambda_0 \not \in \mathfrak q$ such that $\lambda_0 F_j(\lambda_1, \ldots, \lambda_{n + m + 1}) = 0$ in $\Lambda$. Now we set $B$ equal to $$ R[x_0, \ldots, x_{n + m + 1}]/ (g_1, \ldots, g_t, x_0F_1(x_1, \ldots, x_{n + m + 1}), \ldots, x_0F_c(x_1, \ldots, x_{n + m + 1})) $$ which we map to $\Lambda$ by mapping $x_i$ to $\lambda_i$. Let $b$ be the image of $x_0 x_{n + m + 1} s_0 s_1 \ldots s_t$ in $B$. Then $B_b$ is isomorphic to $$ R_{s_0s_1 \ldots s_t}[x_0, x_1, \ldots, x_{n + m + 1}, 1/x_0x_{n + m + 1}]/ (f_1, \ldots, f_c) $$ which is smooth over $R$ by construction. Since $b$ does not map to an element of $\mathfrak q$, we win.
By (3) the ring $\Lambda_\mathfrak q$ is Artinian local hence $\mathfrak q\Lambda_\mathfrak q$ is nilpotent. Thus $(\mathfrak h_A)^N \Lambda_\mathfrak q = 0$ for some $N > 0$. Thus there exists a $\lambda \in \Lambda$, $\lambda \not \in \mathfrak q$ such that $\lambda (\mathfrak h_A)^N = 0$ in $\Lambda$. Say $H_{A/R} = (a_1, \ldots, a_r)$ so that $\lambda a_i^N = 0$ in $\Lambda$. By Lemma \ref{lemma-delocalize-weak} we can find a factorization $A \to C \to \Lambda$ with $C$ of finite presentation such that $\mathfrak h_C \not \subset \mathfrak q$. Write $C = A[x_1, \ldots, x_n]/(f_1, \ldots, f_m)$. Set $$ B = A[x_1, \ldots, x_n, y_1, \ldots, y_r, z, t_{ij}]/ (f_j - \sum y_i t_{ij}, zy_i) $$ where $t_{ij}$ is a set of $rm$ variables. Note that there is a map $B \to C[y_i, z]/(y_iz)$ given by setting $t_{ij}$ equal to zero. The map $B \to \Lambda$ is the composition $B \to C[y_i, z]/(y_iz) \to \Lambda$ where $C[y_i, z]/(y_iz) \to \Lambda$ is the given map $C \to \Lambda$, maps $z$ to $\lambda$, and maps $y_i$ to the image of $a_i^N$ in $\Lambda$. \medskip\noindent We claim that $B$ is a solution for $R \to A \to \Lambda \supset \mathfrak q$. First note that $B_z$ is isomorphic to $C[y_1, \ldots, y_r, z, z^{-1}]$ and hence is smooth. On the other hand, $B_{y_\ell} \cong A[x_i, y_i, y_\ell^{-1}, t_{ij}, i \not = \ell]$ which is smooth over $A$. Thus we see that $z$ and $a_\ell y_\ell$ (compositions of smooth maps are smooth) are all elements of $H_{B/R}$. This proves the lemma.
Set $S = \Lambda \setminus \mathfrak q$ so that $\Lambda_\mathfrak q = S^{-1}\Lambda$. First pick $\pi_1, \ldots, \pi_d$ with (1) which is possible as $\Lambda_\mathfrak q$ is regular. By assumption $\pi_i^n \in I\Lambda_\mathfrak q$. Thus we can find $s_1, \ldots, s_d \in S$ such that $s_i\pi_i^n \in I$. Replacing $\pi_i$ by $s_i\pi_i$ we get (2). Note that (1) and (2) are preserved by further multiplying by elements of $S$. Suppose that (3) holds for $i = 1, \ldots, t$ for some $t \in \{0, \ldots, d\}$. Note that $\pi_1, \ldots, \pi_d$ is a regular sequence in $S^{-1}\Lambda$, see Algebra, Lemma \ref{algebra-lemma-regular-ring-CM}. In particular $\pi_1^e, \ldots, \pi_t^e, \pi_{t + 1}$ is a regular sequence in $S^{-1}\Lambda = \Lambda_\mathfrak q$ by Algebra, Lemma \ref{algebra-lemma-regular-sequence-powers}. Hence we see that $$ \text{Ann}_{S^{-1}\Lambda/(\pi_1^e, \ldots, \pi_{i - 1}^e)}(\pi_i) = \text{Ann}_{S^{-1}\Lambda/(\pi_1^e, \ldots, \pi_{i - 1}^e)}(\pi_i^2). $$ Thus we get (3) for $i = t + 1$ after replacing $\pi_{t + 1}$ by $s\pi_{t + 1}$ for some $s \in S$ by Lemma \ref{lemma-ogoma}. By induction on $t$ this produces a sequence satisfying (1), (2), and (3).
Set $d = \dim \Lambda_\mathfrak q$. Set $R = k[x_1, \ldots, x_d]$. Choose $n > 0$ such that $\mathfrak q^n\Lambda_\mathfrak q \subset \mathfrak h_A\Lambda_\mathfrak q$ which is possible as $\mathfrak q$ is minimal over $\mathfrak h_A$. Choose generators $a_1, \ldots, a_r$ of $H_{A/R}$. Set $$ B = A[x_1, \ldots, x_d, z_{ij}]/(x_i^n - \sum z_{ij}a_j) $$ Each $B_{a_j}$ is smooth over $R$ it is a polynomial algebra over $A_{a_j}[x_1, \ldots, x_d]$ and $A_{a_j}$ is smooth over $k$. Hence $B_{x_i}$ is smooth over $R$. Let $B \to C$ be the $R$-algebra map constructed in Lemma \ref{lemma-improve-presentation} which comes with a $R$-algebra retraction $C \to B$. In particular a map $C \to \Lambda$ fitting into the diagram above. By construction $C_{x_i}$ is a smooth $R$-algebra with $\Omega_{C_{x_i}/R}$ free. Hence we can find $c > 0$ such that $x_i^c$ is strictly standard in $C/R$, see Lemma \ref{lemma-compare-standard}. Now choose $\pi_1, \ldots, \pi_d \in \Lambda$ as in Lemma \ref{lemma-find-sequence} where $n = n$, $e = 8c$, $\mathfrak q = \mathfrak q$ and $I = \mathfrak h_A$. Write $\pi_i^n = \sum \lambda_{ij} a_j$ for some $\pi_{ij} \in \Lambda$. There is a map $B \to \Lambda$ given by $x_i \mapsto \pi_i$ and $z_{ij} \mapsto \lambda_{ij}$. Set $R = k[x_1, \ldots, x_d]$. Diagram $$ \xymatrix{ R \ar[r] & B \ar[rd] \\ k \ar[u] \ar[r] & A \ar[u] \ar[r] & \Lambda } $$ Now we apply Lemma \ref{lemma-lift-solution} to $R \to C \to \Lambda \supset \mathfrak q$ and the sequence of elements $x_1^c, \ldots, x_d^c$ of $R$. Assumption (2) is clear. Assumption (1) holds for $R$ by inspection and for $\Lambda$ by our choice of $\pi_1, \ldots, \pi_d$. (Note that if $\text{Ann}_\Lambda(\pi) = \text{Ann}_\Lambda(\pi^2)$, then we have $\text{Ann}_\Lambda(\pi) = \text{Ann}_\Lambda(\pi^c)$ for all $c > 0$.) Thus it suffices to resolve $$ R/(x_1^e, \ldots, x_d^e) \to C/(x_1^e, \ldots, x_d^e) \to \Lambda/(\pi_1^e, \ldots, \pi_d^e) \supset \mathfrak q/(\pi_1^e, \ldots, \pi_d^e) $$ for $e = 8c$. By Lemma \ref{lemma-delocalize-height-zero} it suffices to resolve this after localizing at $\mathfrak q$. But since $x_1, \ldots, x_d$ map to a regular sequence in $\Lambda_\mathfrak q$ we see that $R_\mathfrak p \to \Lambda_\mathfrak q$ is flat, see Algebra, Lemma \ref{algebra-lemma-flat-over-regular}. Hence $$ R_\mathfrak p/(x_1^e, \ldots, x_d^e) \to \Lambda_\mathfrak q/(\pi_1^e, \ldots, \pi_d^e) $$ is a flat ring map of Artinian local rings. Moreover, this map induces a separable field extension on residue fields by assumption. Thus this map is a filtered colimit of smooth algebras by Algebra, Lemma \ref{algebra-lemma-colimit-syntomic} and Proposition \ref{proposition-lift}. Existence of the desired solution follows from Algebra, Lemma \ref{algebra-lemma-when-colimit}.
Set $\bar \Lambda = \Lambda_\mathfrak q/\mathfrak q^n\Lambda_\mathfrak q$. Note that $\dim H_1(L_{\kappa(\mathfrak q)/k}) < \infty$ by More on Algebra, Proposition \ref{more-algebra-proposition-characterization-geometrically-regular}. Pick $A \subset \bar \Lambda$ containing $E$ such that $A$ is local Artinian, essentially of finite type over $k$, the map $A \to \bar \Lambda$ is flat, and $\mathfrak m_A$ generates the maximal ideal of $\bar \Lambda$, see Lemma \ref{lemma-helper}. Denote $F = A/\mathfrak m_A$ the residue field so that $k \subset F \subset K$. Pick $\lambda_1, \ldots, \lambda_t \in \Lambda$ which map to elements of $A$ in $\bar \Lambda$ such that moreover the images of $\text{d}\lambda_1, \ldots, \text{d}\lambda_t$ form a basis of $\Omega_{F/k}$. Consider the map $\varphi' : k[y_1, \ldots, y_t] \to \Lambda$ sending $y_j$ to $\lambda_j$. Set $\mathfrak p' = (\varphi')^{-1}(\mathfrak q)$. By More on Algebra, Lemma \ref{more-algebra-lemma-geometrically-regular-over-field} the ring map $k[y_1, \ldots, y_t]_{\mathfrak p'} \to \Lambda_\mathfrak q$ is flat and $\Lambda_\mathfrak q/\mathfrak p' \Lambda_\mathfrak q$ is regular. Thus we can choose further elements $\lambda_{t + 1}, \ldots, \lambda_m \in \Lambda$ which map into $A \subset \bar \Lambda$ and which map to a regular system of parameters of $\Lambda_\mathfrak q/\mathfrak p' \Lambda_\mathfrak q$. We obtain $\varphi : k[y_1, \ldots, y_m] \to \Lambda$ having property (1) such that $k[y_1, \ldots, y_m]_\mathfrak p/\mathfrak p^n k[y_1, \ldots, y_m]_\mathfrak p \to \bar\Lambda$ factors through $A$. Thus $k[y_1, \ldots, y_m]_\mathfrak p/\mathfrak p^n k[y_1, \ldots, y_m]_\mathfrak p \to A$ is flat by Algebra, Lemma \ref{algebra-lemma-flatness-descends-more-general}. By construction the residue field extension $\kappa(\mathfrak p) \subset F$ is finitely generated and $\Omega_{F/\kappa(\mathfrak p)} = 0$. Hence it is finite separable by More on Algebra, Lemma \ref{more-algebra-lemma-cartier-equality}. Thus $k[y_1, \ldots, y_m]_\mathfrak p/\mathfrak p^n k[y_1, \ldots, y_m]_\mathfrak p \to A$ is finite by Algebra, Lemma \ref{algebra-lemma-essentially-of-finite-type-into-artinian-local}. Finally, we conclude that it is \'etale by Algebra, Lemma \ref{algebra-lemma-characterize-etale}. Since an \'etale ring map is certainly essentially smooth we win.
Set $\bar \Lambda = \Lambda_\mathfrak q/\mathfrak q^n\Lambda_\mathfrak q$. Let $\bar \lambda$ be the image of $\lambda$ in $\bar \Lambda$. Let $\alpha \in \kappa(\mathfrak q)$ be the image of $\lambda$ in the residue field. Let $k \subset F \subset \kappa(\mathfrak q)$ be the residue field of $D$. If $\alpha$ is in $F$ then we can find an $x \in D$ such that $x \bar\lambda = 1 \bmod \mathfrak q$. Hence $(x \bar \lambda)^q = 1 \bmod (\mathfrak q)^q$ if $q$ is divisible by $p$. Hence $\bar\lambda^q$ is in $D$. If $\alpha$ is transcendental over $F$, then we can take $D' = (D[\bar \lambda])_\mathfrak m$ equal to the subring generated by $D$ and $\bar \lambda$ localized at $\mathfrak m = D[\bar \lambda] \cap \mathfrak q \bar \Lambda$. This works because $D[\bar \lambda]$ is in fact a polynomial algebra over $D$ in this case. Finally, if $\lambda \bmod \mathfrak q$ is algebraic over $F$, then we can find a $p$-power $q$ such that $\alpha^q$ is separable algebraic over $F$, see Fields, Section \ref{fields-section-algebraic}. Note that $D$ and $\bar\Lambda$ are henselian local rings, see Algebra, Lemma \ref{algebra-lemma-local-dimension-zero-henselian}. Let $D \to D'$ be a finite \'etale extension whose residue field extension is $F \subset F(\alpha^q)$, see Algebra, Lemma \ref{algebra-lemma-henselian-cat-finite-etale}. Since $\bar\Lambda$ is henselian and $F(\alpha^q)$ is contained in its residue field we can find a factorization $D' \to \bar \Lambda$. By the first part of the argument we see that $\bar\lambda^{qq'} \in D'$ for some $q' > 0$.
By Theorem \ref{theorem-approximation-property-variant} we can find a solution $(b'_1, \ldots, b'_n)$ in some ring $R''$ \'etale over $R_\mathfrak p$ which comes with a prime ideal $\mathfrak p''$ lying over $\mathfrak p$ such that $\kappa(\mathfrak p) = \kappa(\mathfrak p'')$ and $a_i - b'_i \in (\mathfrak p'')^N(R''_{\mathfrak p''})^\wedge$. We can write $R'' = R' \otimes_R R_\mathfrak p$ for some \'etale $R$-algebra $R'$ (see Algebra, Lemma \ref{algebra-lemma-etale}). After replacing $R'$ by a principal localization if necessary we may assume $(b'_1, \ldots, b'_n)$ come from a solution $(b_1, \ldots, b_n)$ in $R'$. Setting $\mathfrak p' = R' \cap \mathfrak p''$ we see that $R''_{\mathfrak p''} = R'_{\mathfrak p'}$ which finishes the proof.
By More on Algebra, Lemma \ref{more-algebra-lemma-henselization-pair-G-ring} we see that (3) implies (2). By More on Algebra, Lemma \ref{more-algebra-lemma-map-G-ring-to-completion-regular} we see that (2) implies (1). Thus it suffices to prove the lemma in case $A \to A^\wedge$ is a regular ring map. \medskip\noindent Let $\hat{a}_1, \ldots, \hat{a}_n$ be as in the statement of the lemma. By Theorem \ref{theorem-popescu} we can find a factorization $A \to B \to A^\wedge$ with $A \to P$ smooth and $b_1, \ldots, b_n \in B$ with $f_j(b_1, \ldots, b_n) = 0$ in $B$. Denote $\sigma : B \to A^\wedge \to A/I^N$ the composition. By More on Algebra, Lemma \ref{more-algebra-lemma-lift-section-smooth-morphism} we can find an \'etale ring map $A \to A'$ which induces an isomorphism $A/I^N \to A'/I^NA'$ and an $A$-algebra map $\tilde \sigma : B \to A'$ lifting $\sigma$. Since $(A, I)$ is henselian, there is an $A$-algebra map $\chi : A' \to A$, see More on Algebra, Lemma \ref{more-algebra-lemma-characterize-henselian-pair}. Then setting $a_i = \chi(\tilde \sigma(b_i))$ gives a solution.
Since $I^n = 0$ for some $n$, it follows by induction on $n$ that it suffices to consider the case where $I^2 = 0$. Let $\varphi : A \to \Lambda$ be an $R$-algebra map with $A$ of finite presentation over $R$. We have to find a factorization $A \to B \to \Lambda$ with $B$ smooth over $R$, see Algebra, Lemma \ref{algebra-lemma-when-colimit}. By Lemma \ref{lemma-lift-once} we may assume that $A = B/J$ with $B$ smooth over $R$ and $J \subset IB$ a finitely generated ideal. By Lemma \ref{lemma-lift-twice} we can find a (possibly noncommutative) diagram $$ \xymatrix{ B \ar[rr]_\alpha \ar[rd]_\varphi & & B' \ar[ld]^\beta \\ & \Lambda } $$ of $R$-algebras which commutes modulo $I$ and such that $\alpha(J) = 0$. The map $$ D : B \longrightarrow I\Lambda,\quad b \longmapsto \varphi(b) - \beta(\alpha(b)) $$ is a derivation over $R$ hence we can write it as $D = \xi \circ \text{d}_{B/R}$ for some $B$-linear map $\xi : \Omega_{B/R} \to I\Lambda$. Since $\Omega_{B/R}$ is a finite projective $B$-module we can write $\xi = \sum_{i = 1, \ldots, n} \epsilon_i \Xi_i$ for some $\epsilon_i \in I$ and $B$-linear maps $\Xi_i : \Omega_{B/R} \to \Lambda$. (Details omitted. Hint: write $\Omega_{B/R}$ as a direct sum of a finite free module to reduce to the finite free case.) We define $$ B'' = \text{Sym}^*_{B'}\left(\bigoplus\nolimits_{i = 1, \ldots, n} \Omega_{B/R} \otimes_{B, \alpha} B'\right) $$ and we define $\beta' : B'' \to \Lambda$ by $\beta$ on $B'$ and by $$ \beta'|_{i\text{th summand }\Omega_{B/R} \otimes_{B, \alpha} B'} = \Xi_i \otimes \beta $$ and $\alpha' : B \to B''$ by $$ \alpha'(b) = \alpha(b) \oplus \sum \epsilon_i \text{d}_{B/R}(b) \otimes 1 \oplus 0 \oplus \ldots $$ At this point the diagram $$ \xymatrix{ B \ar[rr]_{\alpha'} \ar[rd]_\varphi & & B'' \ar[ld]^{\beta'} \\ & \Lambda } $$ does commute. Moreover, it is direct from the definitions that $\alpha'(J) = 0$ as $I^2 = 0$. Hence the desired factorization.
We abbreviate $A = (M_1, N_1, \varphi_1, \psi_1)$, $B = (M_2, N_2, \varphi_2, \psi_2)$ and $C = (M_3, N_3, \varphi_3, \psi_3)$. We have a long exact cohomology sequence $$ \ldots \to H^1(C) \to H^0(A) \to H^0(B) \to H^0(C) \to H^1(A) \to H^1(B) \to H^1(C) \to \ldots $$ This gives a finite exact sequence $$ 0 \to I \to H^0(A) \to H^0(B) \to H^0(C) \to H^1(A) \to H^1(B) \to K \to 0 $$ with $0 \to K \to H^1(C) \to I \to 0$ a filtration. By additivity of the length function (Algebra, Lemma \ref{algebra-lemma-length-additive}) we see the result.
We first make some preparatory remarks. The result of the lemma holds if $M$ has finite length, i.e., if $t = 0$, because both the left hand side and the right hand side are zero in this case, see Lemma \ref{lemma-finite-periodic-length}. Also, if we have a short exact sequence $0 \to M \to M' \to M'' \to 0$ of modules satisfying (1) and (2), then lemma for 2 out of 3 of these implies the lemma for the third by the additivity of length (Algebra, Lemma \ref{algebra-lemma-length-additive}) and additivty of multiplicities (Lemma \ref{lemma-additivity-periodic-length}). \medskip\noindent Denote $M_i$ the image of $M$ in $M_{\mathfrak q_i}$, so $\text{Supp}(M_i) = \{\mathfrak m, \mathfrak q_i\}$. The kernel and cokernel of the map $M \to \bigoplus M_i$ have support $\{\mathfrak m\}$ and hence have finite length. By our preparatory remarks, it follows that it suffices to prove the lemma for each $M_i$. Thus we may assume that $\text{Supp}(M) = \{\mathfrak m, \mathfrak q\}$. In this case we have a finite filtration $M \supset \mathfrak qM \supset \mathfrak q^2M \supset \ldots \supset \mathfrak q^nM = 0$ by Algebra, Lemma \ref{algebra-lemma-Noetherian-power-ideal-kills-module}. Again additivity shows that it suffices to prove the lemma in the case $M$ is annihilated by $\mathfrak q$. In this case we can view $M$ as a $R/\mathfrak q$-module, i.e., we may assume that $R$ is a Noetherian local domain of dimension $1$ with fraction field $K$. Dividing by the torsion submodule, i.e., by the kernel of $M \to M \otimes_R K = V$ (the torsion has finite length hence is handled by our preliminary remarks) we may assume that $M \subset V$ is a lattice (Algebra, Definition \ref{algebra-definition-lattice}). Then $x : M \to M$ is injective and $\text{length}_R(M/xM) = d(M, xM)$ (Algebra, Definition \ref{algebra-definition-distance}). Since $\text{length}_K(V) = \dim_K(V)$ we see that $\det(x : V \to V) = x^{\dim_K(V)}$ and $\text{ord}_R(\det(x : V \to V)) = \dim_K(V) \text{ord}_R(x)$. Thus the desired equality follows from Algebra, Lemma \ref{algebra-lemma-order-vanishing-determinant} in this case.