Finite non-trivial extensions of local rings I'm revising for exams and was looking over some old homework problems, and came across the following:

Suppose $(A,M)$ and $(B,N)$ are local rings with $M\subseteq N$ and $A\subseteq B$, such that:

*

*$B$ is finite over $A$.

*The map $M\to N\big/N^2$ is surjective.

*The map $A\big/M\to B\big/N$ is surjective.

Then show that $A=B$.

If $N$ is finitely generated as a $B$-module, one proves this by two applications of Nakayama's lemma; first note that $N=MB+N^2$ as $B$-modules by condition 1, and hence by Nakayama's lemma applied to the $B$-module $N$ we obtain $N=MB$. Then note that $B=A+N$ as $A$-modules by condition 3, and so $B=A+MB$ as $A$-modules by the computation above. But $B$ is finite over $A$ by condition 1, so we may apply Nakayama's lemma to the $A$-module $B$ and hence obtain $B=A$, as desired.
However, the problem hypotheses unfortunately did not include a hypothesis that $N$ is finitely generated as a $B$-module. I believe I've come up with a counterexample to the problem as stated, and have written it up below, but it's a bit technical; can anyone think of a cleaner example?

Edit: As Eric Wofsey points out, this example unfortunately does not work.
First let $C=F[y,x_n:n\in\mathbb{N}]$ be the polynomial ring in $\mathbb{N}$-many variables over a field $F$, with one additional variable $y$, and define the ideal $$J=\langle x_0^2,x_{n+1}^2-x_n:n\in\mathbb{N}\rangle+\langle y^2,y-yx_n:n\in\mathbb{N}\rangle<C.$$ Let $B=C\big/J$, and let $A$ be the image of the subring $F[x_n:n\in\mathbb{N}]\subset C$ in $B$. For convenience, denote the image of each $x_i$ in $B$ as $a_i$, and the image of $y$ in $B$ as $b$. (In particular, note that $A=F[a_n:n\in\mathbb{N}]$.)
Now, $B$ is local; indeed, suppose $N$ is a maximal ideal of $B$. Then, since $a_0^2=0$, we have $a_0\in N$. But now also $a_0=a_1^2$, so $a_1\in N$. Continuing inductively in this way, since each $a_n=a_{n+1}^2$, we have $a_n\in N$ for all $n\in\mathbb{N}$. Furthermore, since $b^2=0$, we have $b\in N$. So $N\supseteq\langle b,a_n:n\in\mathbb{N}\rangle$. But the preimage of this latter ideal under the projection map $C\to B$ is the ideal $\langle y,x_n:n\in\mathbb{N}\rangle$, which is maximal in $C$, so in fact $N=\langle b,a_n:n\in\mathbb{N}\rangle$, and thus $N$ is the unique maximal ideal of $B$. A very similar argument shows that $A$ is local with unique maximal ideal $M=\langle a_n:n\in\mathbb{N}\rangle$, since $A$ is isomorphic to the quotient ring $$\frac{F[x_n:n\in\mathbb{N}]}{\langle x_0^2,x^2_{n+1}-x_{n}:n\in\mathbb{N}\rangle}.$$ (Indeed, $A$ is precisely the quotient of $F[x_n:n\in\mathbb{N}]$ by $J\cap F[x_n:n\in\mathbb{N}]$, and this latter ideal is just $\langle x_0^2,x_{n+1}^2-x_n:n\in\mathbb{N}\rangle$.)
Now, we have $N^2=N$. Indeed, it suffices to show $b\in N^2$ and $a_n\in N^2$ for all $n\in\mathbb{N}$. Certainly $a_n=a_{n+1}^2\in N^2$ for each $n\in\mathbb{N}$, and also $b=ba_0\in N^2$ since $y-yx_0\in J$. So this is as claimed. In particular, the canonical map $M\to N\big/N^2$ is trivially surjective, since $N\big/N^2=0$. Furthermore, we have $A\big/M=F=B\big/N$, so the canonical map $A\big/M\to B\big/N$ is a bijection. Finally, note that $B$ is finite over $A$, and we in fact have $B=A+Ab$. To see this, note that $a_nb=b$ for all $n\in\mathbb{N}$, and that $b^2=0$, so that every element of $B$ is of form $f+\lambda b$ for some $f\in A$ and $\lambda\in F$. So, all of the problem hypothesis are met; but the inclusion $A\hookrightarrow B$ is not surjective, since for example $b\notin A$, so we are done.
 A: The problem is correct as written.  Let $b_1,\dots,b_n$ generate $B$ as an $A$-module.  Since $A/M\to B/N$ is surjective, each $b_i$ can be written in the form $a_i+c_i$ where $a_i\in A$ and $c_i\in N$.  It follows then that $N$ is generated by $M$ together with the $c_i$ as an $A$-module: if you write an element of $N$ as an $A$-linear combination of the $b_i$, then the $a_i$ terms must add up to an element of $A\cap N=M$ (otherwise you would not get an element of $N$).
Thus we have shown that the $A$-module $N/M$ is finitely generated, and thus so is the $B$-module $N/MB$.  Now work in the local ring $(B/MB,N/MB)$, whose maximal ideal we have just shown is finitely generated.   Since $M\to N/N^2$ is surjective, this maximal ideal also satisfies $N/MB=(N/MB)^2$, so by Nakayama $N/MB=0$.  Thus $N=MB$ and then the final part of your argument implies $A=B$.
(Or, here's a different way to see that $N/MB$ is finitely generated.  Note that $B/MB$ is finitely generated as a module over the field $A/M$, and in particular it is Noetherian.)
