hcju/stacksqa huggingface dataset:
To prove the set $U$ is open we may work locally on $\Spec(R)$. Thus we may replace $R$ by a suitable localization and assume that $P_1 = R^{n_1}$ and $P_2 = R^{n_2}$, see Lemma \ref{lemma-finite-projective}. In this case injectivity of $\varphi \otimes \kappa(\mathfrak p)$ is equivalent to $n_1 \leq n_2$ and some $n_1 \times n_1$ minor $f$ of the matrix of $\varphi$ being invertible in $\kappa(\mathfrak p)$. Thus $D(f) \subset U$. This argument also shows that $P_{1, \mathfrak p} \to P_{2, \mathfrak p}$ is injective for $\mathfrak p \in U$. \medskip\noindent Now suppose $D(f) \subset U$. By the remark in the previous paragraph and Lemma \ref{lemma-characterize-zero-local} we see that $P_{1, f} \to P_{2, f}$ is injective, i.e., (1)(a) holds. By Lemma \ref{lemma-finite-projective} to prove (1)(b) it suffices to prove that $\Coker(\varphi)$ is finite projective locally on $D(f)$. Thus, as we saw above, we may assume that $P_1 = R^{n_1}$ and $P_2 = R^{n_2}$ and that some minor of the matrix of $\varphi$ is invertible in $R$. If the minor in question corresponds to the first $n_1$ basis vectors of $R^{n_2}$, then using the last $n_2 - n_1$ basis vectors we get a map $R^{n_2 - n_1} \to R^{n_2} \to \Coker(\varphi)$ which is easily seen to be an isomorphism. \medskip\noindent Openness of $W$ and (2)(a) for $D(f) \subset W$ follow from Lemma \ref{lemma-map-between-finite}. Since $P_{2, f}$ is projective over $R_f$ we see that $\varphi_f : P_{1, f} \to P_{2, f}$ has a section and it follows that $\Ker(\varphi)_f$ is a direct summand of $P_{2, f}$. Therefore $\Ker(\varphi)_f$ is finite projective. Thus (2)(b) holds as well. \medskip\noindent It is clear that $V = U \cap W$ is open and the other statement in (3) follows from (1)(a) and (2)(a).
That (1) is equivalent to (2) is just a reformulation of the equational criterion for flatness\footnote{In fact, a module map $f : R^n \to M$ corresponds to a choice of elements $x_1, x_2, \ldots, x_n$ of $M$ (namely, the images of the standard basis elements $e_1, e_2, \ldots, e_n$); furthermore, an element $x \in \Ker(f)$ corresponds to a relation between these $x_1, x_2, \ldots, x_n$ (namely, the relation $\sum_i f_i x_i = 0$, where the $f_i$ are the coordinates of $x$). The module map $h$ (represented as an $m \times n$-matrix) corresponds to the matrix $(a_{ij})$ from Lemma \ref{lemma-flat-eq}, and the $y_j$ of Lemma \ref{lemma-flat-eq} are the images of the standard basis vectors of $R^m$ under $g$.}.   To show (2) implies (3), let $g: R^m \to M$ be the map such that $f$ factors as $f = g \circ h$.  By (2) find $h'': R^m \to R^{m'}$ such that $h''$ kills $h(x)$ and $g: R^m \to M$ factors through $h''$.  Then taking $h' = h'' \circ h$ works.  (3) implies (4) by induction on the number of generators of $N \subset \Ker(f)$ in (4). Clearly (4) implies (2).
First suppose $M$ is flat.  We must show that if $P$ is finitely presented, then given a map $f: P \to M$, it factors through the map $N \to M$.  By Lemma \ref{lemma-flat-factors-fp} the map $f$ factors through a map $F \to M$ where $F$ is free and finite. Since $F$ is free, this map factors through $N \to M$.  Thus $f$ factors through $N \to M$. \medskip\noindent Conversely, suppose the condition of the lemma holds.  Let $f: P \to M$ be a map from a finitely presented module $P$.  Choose a free module $N$ with a surjection $N \to M$ onto $M$.  Then $f$ factors through $N \to M$, and since $P$ is finitely generated, $f$ factors through a free finite submodule of $N$.  Thus $M$ satisfies the condition of Lemma \ref{lemma-flat-factors-fp}, hence is flat.
Let $N$ be an $R$-module. Let $\mathfrak q$ be a prime of $S$ lying over the prime $\mathfrak p$ of $R$. Then we have $$ (M \otimes_R N)_{\mathfrak q} = M_{\mathfrak q} \otimes_R N = M_{\mathfrak q} \otimes_{R_{\mathfrak p}} N_{\mathfrak p}. $$ Moreover, the same thing holds for $M'$ and localization is exact. Also, if $N$ is an $R_{\mathfrak p}$-module, then $N_{\mathfrak p} = N$. Using this the equivalences can be proved in a straightforward manner. \medskip\noindent For example, suppose that (5) holds. Let $K = \Ker(M \otimes_R N \to M' \otimes_R N)$. By the remarks above we see that $K_{\mathfrak m} = 0$ for each maximal ideal $\mathfrak m$ of $S$. Hence $K = 0$ by Lemma \ref{lemma-characterize-zero-local}. Thus (1) holds. Conversely, suppose that (1) holds. Take any $\mathfrak q \subset S$ lying over $\mathfrak p \subset R$. Take any module $N$ over $R_{\mathfrak p}$. Then by assumption $\Ker(M \otimes_R N \to M' \otimes_R N) = 0$. Hence by the formulae above and the fact that $N = N_{\mathfrak p}$ we see that $\Ker(M_{\mathfrak q} \otimes_{R_{\mathfrak p}} N \to M'_{\mathfrak q} \otimes_{R_{\mathfrak p}} N) = 0$. In other words (4) holds. Of course (4) $\Rightarrow$ (5) is immediate. Hence (1), (4) and (5) are all equivalent. We omit the proof of the other equivalences.
You can prove this using Lemma \ref{lemma-universally-injective-check-stalks} but you can also prove it directly as follows. Assume $M \to M'$ is $A$-universally injective. Let $Q$ be an $A$-module. Then $Q \otimes_A M \to Q \otimes_A M'$ is injective. Since localization is exact we see that $(S')^{-1}(Q \otimes_A M) \to (S')^{-1}(Q \otimes_A M')$ is injective. As $(S')^{-1}(Q \otimes_A M) = Q \otimes_A (S')^{-1}M$ and similarly for $M'$ we see that $Q \otimes_A (S')^{-1}M \to Q \otimes_A (S')^{-1}M'$ is injective, hence $(S')^{-1}M \to (S')^{-1}M'$ is universally injective as a map of $A$-modules. This proves the first part of (1). To see (2) we can use the following two facts: (a) if $Q$ is an $S^{-1}A$-module, then $Q \otimes_A S^{-1}A = Q$, i.e., tensoring with $Q$ over $A$ is the same thing as tensoring with $Q$ over $S^{-1}A$, (b) if $M$ is any $A$-module on which the elements of $S$ are invertible, then $M \otimes_A Q = M \otimes_{S^{-1}A} S^{-1}Q$. Part (2) follows from this immediately.
It suffices to show that $M \otimes_R Q \to M' \otimes_R Q$ is injective for every finite $R$-module $Q$, see Theorem \ref{theorem-universally-exact-criteria}. Then $Q$ has a finite filtration $0 = Q_0 \subset Q_1 \subset \ldots \subset Q_n = Q$ by submodules whose subquotients are isomorphic to cyclic modules $R/I_i$, see Lemma \ref{lemma-trivial-filter-finite-module}. Since $M'$ is flat, we obtain a filtration $$ \xymatrix{ M \otimes Q_1 \ar[r] \ar[d] & M \otimes Q_2 \ar[r] \ar[d] & \ldots \ar[r] & M \otimes Q \ar[d] \\ M' \otimes Q_1 \ar@{^{(}->}[r] & M' \otimes Q_2 \ar@{^{(}->}[r] & \ldots \ar@{^{(}->}[r] & M' \otimes Q } $$ of $M' \otimes_R Q$ by submodules $M' \otimes_R Q_i$ whose successive quotients are $M' \otimes_R R/I_i = M'/I_iM'$. A simple induction argument shows that it suffices to check $M/I_i M \to M'/I_i M'$ is injective. Note that the collection of finitely generated ideals $I'_i \subset I_i$ is a directed set. Thus $M/I_iM = \colim M/I'_iM$ is a filtered colimit, similarly for $M'$, the maps $M/I'_iM \to M'/I'_i M'$ are injective by assumption, and since filtered colimits are exact (Lemma \ref{lemma-directed-colimit-exact}) we conclude.
This is part of Lemma \ref{lemma-finite-projective}. However, at this point we can give a more elegant proof of the implication (1) $\Rightarrow$ (2) of that lemma as follows. If $M$ is finitely presented and flat, then take a surjection $R^n \to M$.  By Lemma \ref{lemma-flat-surjective-hom} applied to $P = M$, the map $R^n \to M$ admits a section. So $M$ is a direct summand of a  free module and hence projective.
Assume $M \otimes_R S$ is of finite type. Let $y_1, \ldots, y_m$ be generators of $M \otimes_R S$ over $S$. Write $y_j = \sum x_i \otimes f_i$ for some $x_1, \ldots, x_n \in M$. Then we see that the map $\varphi : R^{\oplus n} \to M$ has the property that $\varphi \otimes \text{id}_S : S^{\oplus n} \to M \otimes_R S$ is surjective. Since $R \to S$ is faithfully flat we see that $\varphi$ is surjective, and $M$ is finitely generated. \medskip\noindent Assume $M \otimes_R S$ is of finite presentation. By (1) we see that $M$ is of finite type. Choose a surjection $R^{\oplus n} \to M$ and denote $K$ the kernel. As $R \to S$ is flat we see that $K \otimes_R S$ is the kernel of the base change $S^{\oplus n} \to M \otimes_R S$. As $M \otimes_R S$ is of finite presentation we conclude that $K \otimes_R S$ is of finite type. Hence by (1) we see that $K$ is of finite type and hence $M$ is of finite presentation. \medskip\noindent Part (3) is Lemma \ref{lemma-flatness-descends}.
Taking limits of directed inverse systems is left exact, hence we only need to prove surjectivity of $\lim B_i \to \lim C_i$.  So let $(c_i) \in \lim C_i$.  For each $i \in I$, let $E_i = g_i^{-1}(c_i)$, which is nonempty since $g_i: B_i \to C_i$ is surjective. The system of maps $\varphi_{ji}: B_j \to B_i$ for $(B_i)$ restrict to maps $E_j \to E_i$ which make $(E_i)$ into an inverse system of nonempty sets.  It is enough to show that $(E_i)$ is Mittag-Leffler. For then Lemma \ref{lemma-ML-limit-nonempty} would show $\lim E_i$ is nonempty, and taking any element of $\lim E_i$ would give an element of $\lim B_i$ mapping to $(c_i)$. \medskip\noindent By the injection $f_i: A_i \to B_i$ we will regard $A_i$ as a subset of $B_i$.  Since $(A_i)$ is Mittag-Leffler, if $i \in I$ then there exists $j \geq i$ such that $\varphi_{ki}(A_k) = \varphi_{ji}(A_j)$ for $k \geq j$.  We claim that also $\varphi_{ki}(E_k) = \varphi_{ji}(E_j)$ for $k \geq j$.  Always $\varphi_{ki}(E_k) \subset \varphi_{ji}(E_j)$ for $k \geq j$.  For the reverse inclusion let $e_j \in E_j$, and we need to find $x_k \in E_k$ such that $\varphi_{ki}(x_k) = \varphi_{ji}(e_j)$.  Let $e'_k \in E_k$ be any element, and set $e'_j = \varphi_{kj}(e'_k)$.  Then $g_j(e_j - e'_j) = c_j - c_j = 0$, hence $e_j - e'_j = a_j \in A_j$.  Since $\varphi_{ki}(A_k) = \varphi_{ji}(A_j)$, there exists $a_k \in A_k$ such that $\varphi_{ki}(a_k) = \varphi_{ji}(a_j)$.  Hence $$ \varphi_{ki}(e'_k + a_k) = \varphi_{ji}(e'_j) + \varphi_{ji}(a_j) = \varphi_{ji}(e_j), $$ so we can take $x_k = e'_k + a_k$.
Consider the pushout of $f$ and $g$ as in the statement of Lemma \ref{lemma-domination-universally-injective}. From the construction of the pushout it follows that $\Coker(f') = \Coker(f)$, so $\Coker(f')$ is of finite presentation.  Then by Lemma \ref{lemma-universally-exact-split}, $f'$ is universally injective if and only if $$ 0 \to M' \xrightarrow{f'} N' \to \Coker(f') \to 0 $$ splits. This is the case if and only if there is a map $h' : N' \to M'$ such that $h' \circ f' = \text{id}_{M'}$.  From the universal property of the pushout, the existence of such an $h'$ is equivalent to $g$ factoring through $f$.
Write $M = \colim_{i \in I} M_i$ and $N = \colim_{j \in J} N_j$ as directed colimits of finitely presented $R$-modules. Denote $f_{ii'} : M_i \to M_{i'}$ and $g_{jj'} : N_j \to N_{j'}$ the transition maps. Then $M_i \otimes_R N_j$ is a finitely presented $R$-module (see Lemma \ref{lemma-tensor-finiteness}), and $M \otimes_R N = \colim_{(i, j) \in I \times J} M_i \otimes_R M_j$. Pick $(i, j) \in I \times J$. By the definition of a Mittag-Leffler module we have Proposition \ref{proposition-ML-characterization} (3) for both systems. In other words there exist $i' \geq i$ and $j' \geq j$ such that for every choice of $i'' \geq i$ and $j'' \geq j$ there exist maps $a : M_{i''} \to M_{i'}$ and $b : M_{j''} \to M_{j'}$ such that $f_{ii'} = a \circ f_{ii''}$ and $g_{jj'} = b \circ g_{jj''}$. Then it is clear that $a \otimes b : M_{i''} \otimes_R N_{j''} \to M_{i'} \otimes_R N_{j'}$ serves the same purpose for the system $(M_i \otimes_R N_j, f_{ii'} \otimes g_{jj'})$. Thus by the characterization Proposition \ref{proposition-ML-characterization} (3) we conclude that $M \otimes_R N$ is Mittag-Leffler.
Since the condition is clear weaker than condition (1) of Proposition \ref{proposition-ML-characterization} we see that a Mittag-Leffler module satisfies the condition. Conversely, suppose that $M$ satisfies the condition and that $f : P \to M$ is an $R$-module map from a finitely presented $R$-module $P$ into $M$. Choose a surjection $F \to P$ where $F$ is a finite free $R$-module. By assumption we can find a map $F \to Q$ where $Q$ is a finitely presented $R$-module such that $F \to Q$ and $F \to M$ dominate each other. In particular, the kernel of $F \to Q$ contains the kernel of $F \to P$, hence we obtain an $R$-module map $g : P \to Q$ such that $F \to Q$ is equal to the composition $F \to P \to Q$. Let $N$ be any $R$-module and consider the commutative diagram $$ \xymatrix{ F \otimes_R N \ar[d] \ar[r] & Q \otimes_R N \\ P \otimes_R N \ar[ru] \ar[r] & M \otimes_R N } $$ By assumption the kernels of $F \otimes_R N \to Q \otimes_R N$ and $F \otimes_R N \to M \otimes_R N$ are equal. Hence, as $F \otimes_R N \to P \otimes_R N$ is surjective, also the kernels of $P \otimes_R N \to Q \otimes_R N$ and $P \otimes_R N \to M \otimes_R N$ are equal.
Assume $M$ is a Mittag-Leffler module over $S$. Write $M = \colim M_i$ as a directed colimit of finitely presented $S$-modules $M_i$. As $M$ is Mittag-Leffler over $S$ there exists for each $i$ an index $j \geq i$ such that for all $k \geq j$ there is a factorization $f_{ij} = h \circ f_{ik}$ (where $h$ depends on $i$, the choice of $j$ and $k$). Note that by Lemma \ref{lemma-finite-finitely-presented-extension} the modules $M_i$ are also finitely presented as $R$-modules. Moreover, all the maps $f_{ij}, f_{ik}, h$ are maps of $R$-modules. Thus we see that the system $(M_i, f_{ij})$ satisfies the same condition when viewed as a system of $R$-modules. Thus $M$ is Mittag-Leffler as an $R$-module.
One implication follows from Lemma \ref{lemma-restrict-ML-modules}. To prove the other, assume $M$ is Mittag-Leffler as an $R$-module. Write $M = \colim M_i$ as a directed colimit of finitely presented $S$-modules. As $I$ is finitely generated, the ring $S$ is finite and finitely presented as an $R$-algebra, hence the modules $M_i$ are finitely presented as $R$-modules, see Lemma \ref{lemma-finite-finitely-presented-extension}. Next, let $N$ be any $S$-module. Note that for each $i$ we have $\Hom_R(M_i, N) = \Hom_S(M_i, N)$ as $R \to S$ is surjective. Hence the condition that the inverse system $(\Hom_R(M_i, N))_i$ satisfies Mittag-Leffler, implies that the system $(\Hom_S(M_i, N))_i$ satisfies Mittag-Leffler. Thus $M$ is Mittag-Leffler over $S$ by definition.
Since $M$ is flat we have $F' \otimes_R M \subset F \otimes_R M$ if $F' \subset F$ is a submodule, hence the statement makes sense. Let $I = \{F' \subset F \mid x \in F' \otimes_R M\}$ and for $i \in I$ denote $F_i \subset F$ the corresponding submodule. Then $x$ maps to zero under the map $$ F \otimes_R M \longrightarrow \prod (F/F_i \otimes_R M) $$ whence by Proposition \ref{proposition-ML-tensor} $x$ maps to zero under the map $$ F \otimes_R M \longrightarrow \left(\prod F/F_i\right) \otimes_R M $$ Since $M$ is flat the kernel of this arrow is $(\bigcap F_i) \otimes_R M$ which proves the lemma.
For any family $(Q_{\alpha})_{\alpha \in A}$ of $R$-modules we have a commutative diagram $$ \xymatrix{ 0 \ar[r] & M_1 \otimes_R (\prod_{\alpha} Q_{\alpha}) \ar[r] \ar[d] & M_2 \otimes_R (\prod_{\alpha} Q_{\alpha}) \ar[r] \ar[d] & M_3 \otimes_R (\prod_{\alpha} Q_{\alpha}) \ar[r] \ar[d] & 0 \\ 0 \ar[r] & \prod_{\alpha}(M_1 \otimes Q_{\alpha}) \ar[r] & \prod_{\alpha}(M_2 \otimes Q_{\alpha}) \ar[r] & \prod_{\alpha}(M_3 \otimes Q_{\alpha})\ar[r] & 0 } $$ with exact rows. Thus (1) and (2) follow from Proposition \ref{proposition-ML-tensor}.
For any family $(Q_{\alpha})_{\alpha \in A}$ of $R$-modules, since tensor product is right exact, we have a commutative diagram $$ \xymatrix{ M_1 \otimes_R (\prod_{\alpha} Q_{\alpha}) \ar[r] \ar[d] & M_2 \otimes_R (\prod_{\alpha} Q_{\alpha}) \ar[r] \ar[d] & M_3 \otimes_R (\prod_{\alpha} Q_{\alpha}) \ar[r] \ar[d] & 0 \\ \prod_{\alpha}(M_1 \otimes Q_{\alpha}) \ar[r] & \prod_{\alpha}(M_2 \otimes Q_{\alpha}) \ar[r] & \prod_{\alpha}(M_3 \otimes Q_{\alpha})\ar[r] & 0 } $$ with exact rows. By Proposition \ref{proposition-fg-tensor} the left vertical arrow is surjective. By Proposition \ref{proposition-ML-tensor} the middle vertical arrow is injective. A diagram chase shows the right vertical arrow is injective. Hence $M_3$ is Mittag-Leffler by Proposition \ref{proposition-ML-tensor}.
Let $(Q_{\alpha})_{\alpha \in A}$ be a family of $R$-modules. We have to show that $M \otimes_R (\prod Q_\alpha) \to \prod M \otimes_R Q_\alpha$ is injective and we know that $M_i \otimes_R (\prod Q_\alpha) \to \prod M_i \otimes_R Q_\alpha$ is injective for each $i$, see Proposition \ref{proposition-ML-tensor}. Since $\otimes$ commutes with filtered colimits, it suffices to show that $\prod M_i \otimes_R Q_\alpha \to \prod M \otimes_R Q_\alpha$ is injective. This is clear as each of the maps $M_i \otimes_R Q_\alpha \to M \otimes_R Q_\alpha$ is injective by our assumption that the transition maps are universally injective.
The ``only if'' direction follows from Lemma \ref{lemma-pure-submodule-ML} (1) and the fact that a split short exact sequence is universally exact. The converse follows from Lemma \ref{lemma-colimit-universally-injective-ML} but we can also argue it directly as follows. First note that if $I$ is finite then this follows from Lemma \ref{lemma-pure-submodule-ML} (2).  For general $I$, if all $M_i$ are Mittag-Leffler then we prove the same of $M$ by verifying condition (1) of Proposition \ref{proposition-ML-characterization}. Let $f: P \to M$ be a map from a finitely presented module $P$. Then $f$ factors as $P \xrightarrow{f'} \bigoplus_{i' \in I'} M_{i'} \hookrightarrow \bigoplus_{i \in I} M_i$ for some finite subset $I'$ of $I$.  By the finite case $\bigoplus_{i' \in I'} M_{i'}$ is Mittag-Leffler and hence there exists a finitely presented  module $Q$ and a map $g: P \to Q$ such that $g$ and $f'$ dominate each other.  Then also $g$ and $f$ dominate each other.
We deduce this from the characterization of Proposition \ref{proposition-ML-tensor}. Namely, suppose that $Q_\alpha$ is a family of $R$-modules. Consider the composition $$ \xymatrix{ M \otimes_R \prod_\alpha Q_\alpha = M \otimes_S S \otimes_R \prod_\alpha Q_\alpha \ar[d] \\ M \otimes_S \prod_\alpha (S \otimes_R Q_\alpha) \ar[d] \\ \prod_\alpha (M \otimes_S \otimes_R Q_\alpha) = \prod_\alpha (M \otimes_R Q_\alpha) } $$ The first arrows is injective as $M$ is flat over $S$ and $S$ is Mittag-Leffler over $R$ and the second arrow is injective as $M$ is Mittag-Leffler over $S$. Hence $M$ is Mittag-Leffler over $R$.
The first statement is immediate from the definition. During the rest of the proof we will use the results of Lemma \ref{lemma-extension} without further mention. \medskip\noindent Let $\varphi : N \to M$ satisfy the assumptions of (2). Suppose that $N$ is generated by $x_1, \ldots, x_n$. By Definition \ref{definition-coherent} the kernel $K$ of the induced map $R^{\oplus n} \to M$, $e_i \mapsto \varphi(x_i)$ is of finite type. Hence $\Ker(\varphi)$ which is the image of the composition $K \to R^{\oplus n} \to N$ is of finite type. This proves (2). \medskip\noindent Let $\varphi : N \to M$ satisfy the assumptions of (3). By (2) the kernel of $\varphi$ is of finite type and hence by (1) it is coherent. \medskip\noindent With the same hypotheses let us show that $\Coker(\varphi)$ is coherent. Since $M$ is finite so is $\Coker(\varphi)$. Let $\overline{x}_i \in \Coker(\varphi)$. We have to show that the kernel of the associated morphism $\overline{\Psi} : R^{\oplus n} \to \Coker(\varphi)$ is finite. Choose $x_i \in M$ lifting $\overline{x}_i$. Choose additionally generators $y_1, \ldots, y_m$ of $\Im(\varphi)$. Let $\Phi : R^{\oplus m} \to \Im(\varphi)$ using $y_j$ and $\Psi : R^{\oplus m} \oplus R^{\oplus n} \to M$ using $y_j$ and $x_i$ be the corresponding maps. Consider the following commutative diagram $$ \xymatrix{ 0 \ar[r] & R^{\oplus m} \ar[d]_\Phi \ar[r] & R^{\oplus m} \oplus R^{\oplus n} \ar[d]_\Psi \ar[r] & R^{\oplus n} \ar[d]_{\overline{\Psi}} \ar[r] & 0 \\ 0 \ar[r] & \Im(\varphi) \ar[r] & M \ar[r] & \Coker(\varphi) \ar[r] & 0 } $$ with exact rows. By Lemma \ref{lemma-snake} we get an exact sequence $\Ker(\Psi) \to \Ker(\overline{\Psi}) \to 0$. Since $\Ker(\Psi)$ is a finite $R$-module, we see that $\Ker(\overline{\Psi})$ is finite. \medskip\noindent Statement (4) follows from (3). \medskip\noindent Let $0 \to M_1 \to M_2 \to M_3 \to 0$ be a short exact sequence of $R$-modules. It suffices to prove that if $M_1$ and $M_3$ are coherent so is $M_2$. By Lemma \ref{lemma-extension} we see that $M_2$ is finite. Let $x_1, \ldots, x_n$ be finitely many elements of $M_2$. We have to show that the module of relations $K$ between them is finite. Consider the following commutative diagram $$ \xymatrix{ 0 \ar[r] & 0 \ar[r] \ar[d] & \bigoplus_{i = 1}^{n} R \ar[r] \ar[d] & \bigoplus_{i = 1}^{n} R \ar[r] \ar[d] & 0 \\ 0 \ar[r] & M_1 \ar[r] & M_2 \ar[r] & M_3 \ar[r] & 0 } $$ with obvious notation. By the snake lemma we get an exact sequence $0 \to K \to K_3 \to M_1$ where $K_3$ is the module of relations among the images of the $x_i$ in $M_3$. Since $M_3$ is coherent we see that $K_3$ is a finite module. Since $M_1$ is coherent we see that the image $I$ of $K_3 \to M_1$ is coherent. Hence $K$ is the kernel of the map $K_3 \to I$ between a finite module and a coherent module and hence finite by (2).
The implication (1) $\Rightarrow$ (2) is a special case of Lemma \ref{lemma-minimal-contains}. Assume (2). By Theorem \ref{theorem-lazard} we can write $M$ as the colimit $M = \colim_{i \in I} M_i$ of a directed system $(M_i, f_{ij})$ of finite free $R$-modules. By Remark \ref{remark-flat-ML}, it suffices to show that the inverse system $(\Hom_R(M_i, R), \Hom_R(f_{ij}, R))$ is Mittag-Leffler.  In other words, fix $i \in I$ and for $j \geq i$ let $Q_j$ be the image of $\Hom_R(M_j, R) \to \Hom_R(M_i, R)$; we must show that the $Q_j$ stabilize. \medskip\noindent Since $M_i$ is free and finite, we can make the identification $\Hom_R(M_i, M_j) = \Hom_R(M_i, R) \otimes_R  M_j$ for all $j$.  Using the fact that the $M_j$ are free, it follows that for $j \geq i$, $Q_j$ is the smallest submodule of $\Hom_R(M_i, R)$ such that $f_{ij} \in Q_j \otimes_R M_j$.  Under the identification $\Hom_R(M_i, M) = \Hom_R(M_i, R) \otimes_R M$, the canonical map $f_i: M_i \to M$ is in $\Hom_R(M_i, R) \otimes_R M$.  By the assumption on $M$, there exists a smallest submodule $Q$ of $\Hom_R(M_i, R)$ such that $f_i \in Q \otimes_R M$.  We are going to show that the $Q_j$ stabilize to $Q$. \medskip\noindent For $j \geq i$ we have a commutative diagram $$ \xymatrix{ Q_j \otimes_R M_j \ar[r] \ar[d] & \Hom_R(M_i, R) \otimes_R M_j \ar[d] \\ Q_j \otimes_R M \ar[r] & \Hom_R(M_i, R) \otimes_R M. } $$ Since $f_{ij} \in Q_j \otimes_R M_j$ maps to $f_i \in \Hom_R(M_i, R) \otimes_R M$, it follows that $f_i \in Q_j \otimes_R M$.  Hence, by the choice of $Q$, we have $Q \subset Q_j$ for all $j \geq i$. \medskip\noindent Since the $Q_j$ are decreasing and $Q \subset Q_j$ for all $j \geq i$, to show that the $Q_j$ stabilize to $Q$ it suffices to find a $j \geq i$ such that $Q_j \subset Q$.  As an element of $$ \Hom_R(M_i, R) \otimes_R M = \colim_{j \in J} (\Hom_R(M_i, R) \otimes_R M_j), $$ $f_i$ is the colimit of $f_{ij}$ for $j \geq i$, and $f_i$ also lies in the submodule $$ \colim_{j \in J} (Q \otimes_R M_j) \subset \colim_{j \in J} (\Hom_R(M_i, R) \otimes_R M_j). $$ It follows that for some $j \geq i$, $f_{ij}$ lies in $Q \otimes_R M_j$. Since $Q_j$ is the smallest submodule of $\Hom_R(M_i, R)$ with $f_{ij} \in Q_j \otimes_R M_j$, we conclude $Q_j\subset Q$.
Combining Lemma \ref{lemma-Noetherian-coherent} and Proposition \ref{proposition-characterize-coherent} we see that $M$ is flat over $R$. We show that $M$ satisfies the condition of Lemma \ref{lemma-flat-ML-criterion}. Let $F$ be a free finite $R$-module. If $F'$ is any submodule of $F$ then it is finitely presented since $R$ is Noetherian. So by Proposition \ref{proposition-fp-tensor} we have a commutative diagram $$ \xymatrix{ F' \otimes_R M \ar[r] \ar[d]^{\cong} & F \otimes_R M \ar[d]^{\cong} \\ (F')^A \ar[r] & F^A } $$ by which we can identify the map $F' \otimes_R M \to F \otimes_R M$ with $(F')^A \to F^A$.  Hence if $x \in F \otimes_R M$ corresponds to $(x_\alpha) \in F^A$, then the submodule of $F'$ of $F$ generated by the $x_\alpha$ is the smallest submodule of $F$ such that $x \in F' \otimes_R M$.