**Proof.**
By Lemma 38.11.2 the morphism $f$ is locally of finite presentation. The image $f(X) \subset S$ is open (Morphisms, Lemma 29.25.10) hence we may replace $S$ by $f(X)$. Thus we have to prove that $f$ is an isomorphism. We may assume $S$ is affine. We can reduce to the case that $X$ is quasi-compact because it suffices to show that any quasi-compact open $X' \subset X$ whose image is $S$ maps isomorphically to $S$. Thus we may assume $f$ is quasi-compact. All the fibers of $f$ have dimension $0$, see Lemma 38.11.3. Hence $f$ is quasi-finite, see Morphisms, Lemma 29.29.5. Let $s \in S$. Choose an elementary étale neighbourhood $g : (T, t) \to (S, s)$ such that $X \times _ S T = V \amalg W$ with $V \to T$ finite and $W_ t = \emptyset $, see More on Morphisms, Lemma 37.41.6. Denote $\pi : V \amalg W \to T$ the given morphism. Since $\pi $ is flat and locally of finite presentation, we see that $\pi (V)$ is open in $T$ (Morphisms, Lemma 29.25.10). After shrinking $T$ we may assume that $T = \pi (V)$. Since $f$ is an isomorphism over $U$ we see that $\pi $ is an isomorphism over $g^{-1}U$. Since $\pi (V) = T$ this implies that $\pi ^{-1}g^{-1}U$ is contained in $V$. By Morphisms, Lemma 29.25.15 we see that $\pi ^{-1}g^{-1}U \subset V \amalg W$ is scheme theoretically dense. Hence we deduce that $W = \emptyset $. Thus $X \times _ S T = V$ is finite over $T$. This implies that $f$ is finite (after replacing $S$ by an open neighbourhood of $s$), for example by Descent, Lemma 35.23.23. Then $f$ is finite locally free (Morphisms, Lemma 29.48.2) and after shrinking $S$ to a smaller open neighbourhood of $s$ we see that $f$ is finite locally free of some degree $d$ (Morphisms, Lemma 29.48.5). But $d = 1$ as is clear from the fact that the degree is $1$ over the dense open $U$. Hence $f$ is an isomorphism.
$\square$

## Comments (0)