Lemma 61.6.4. Let $A \to B$ be ring map such that

1. $A \to B$ identifies local rings,

2. the topological spaces $\mathop{\mathrm{Spec}}(B)$, $\mathop{\mathrm{Spec}}(A)$ are w-local,

3. $\mathop{\mathrm{Spec}}(B) \to \mathop{\mathrm{Spec}}(A)$ is w-local, and

4. $\pi _0(\mathop{\mathrm{Spec}}(B)) \to \pi _0(\mathop{\mathrm{Spec}}(A))$ is bijective.

Then $A \to B$ is an isomorphism

Proof. Let $X_0 \subset X = \mathop{\mathrm{Spec}}(A)$ and $Y_0 \subset Y = \mathop{\mathrm{Spec}}(B)$ be the sets of closed points. By assumption $Y_0$ maps into $X_0$ and the induced map $Y_0 \to X_0$ is a bijection. As a space $\mathop{\mathrm{Spec}}(A)$ is the disjoint union of the spectra of the local rings of $A$ at closed points. Similarly for $B$. Hence $X \to Y$ is a bijection. Since $A \to B$ is flat we have going down (Algebra, Lemma 10.39.19). Thus Algebra, Lemma 10.41.11 shows for any prime $\mathfrak q \subset B$ lying over $\mathfrak p \subset A$ we have $B_\mathfrak q = B_\mathfrak p$. Since $B_\mathfrak q = A_\mathfrak p$ by assumption, we see that $A_\mathfrak p = B_\mathfrak p$ for all primes $\mathfrak p$ of $A$. Thus $A = B$ by Algebra, Lemma 10.23.1. $\square$

In your comment you can use Markdown and LaTeX style mathematics (enclose it like $\pi$). A preview option is available if you wish to see how it works out (just click on the eye in the toolbar).