hcju/stacksqa huggingface dataset:
Let $x \in X$ with image $y \in Y$. It suffices to prove that $V \cap W$ is affine for some affine open neighbourhood $W$ of $x$. Since $\Spec(\mathcal{O}_{X, x})$ is the limit of the schemes $W$, this holds if and only if $$ V_x = V \times_X \Spec(\mathcal{O}_{X, x}) $$ is affine (Limits, Lemma \ref{limits-lemma-limit-affine}). Thus, if the theorem holds for the morphism $X \times_Y \Spec(\mathcal{O}_{Y, y}) \to \Spec(\mathcal{O}_{Y, y})$, then the theorem holds. In particular, we may assume $Y$ is regular of finite dimension, which allows us to do induction on the dimension $d = \dim(Y)$. Combining this with the same argument again, we may assume that $Y$ is local with closed point $y$ and that $V \cap (X \setminus f^{-1}(\{y\}) \to X \setminus f^{-1}(\{y\})$ is affine. \medskip\noindent Let $x \in X$ be a point lying over $y$. If $x \in V$, then there is nothing to prove. Observe that  $f^{-1}(\{y\}) \cap V$ is a finite set of closed points (the fibres of an \'etale morphism are discrete). Thus after replacing $X$ by an affine open neighbourhood of $x$ we may assume $y \not \in f(V)$. We have to prove that $V$ is affine. \medskip\noindent Let $e(V)$ be the maximum $i$ with $H^i(V, \mathcal{O}_V) \not = 0$. As $X$ is affine the integer $e(V)$ is the maximum of the numbers $e(V_x)$ where $x \in X \setminus V$, see Local Cohomology, Lemma \ref{local-cohomology-lemma-cd-local} and the characterization of cohomological dimension in Local Cohomology, Lemma \ref{local-cohomology-lemma-cd}. We have $e(V_x) \leq \dim(\mathcal{O}_{X, x}) - 1$ by Local Cohomology, Lemma \ref{local-cohomology-lemma-cd-dimension}. If $\dim(\mathcal{O}_{X, x}) \geq 2$ then purity of ramification locus (Lemma \ref{lemma-purity-ramification}) shows that $V_x$ is strictly smaller than the punctured spectrum of $\mathcal{O}_{X, x}$. Since $\mathcal{O}_{X, x}$ is normal and excellent, this implies $e(V_x) \leq \dim(\mathcal{O}_{X, x}) - 2$ by Hartshorne-Lichtenbaum vanishing (Local Cohomology, Lemma \ref{local-cohomology-lemma-affine-complement}). On the other hand, since $X \to Y$ is of finite type and $V \subset X$ is dense (after possibly replacing $X$ by the closure of $V$), we see that $\dim(\mathcal{O}_{X, x}) \leq d$ by the dimension formula (Morphisms, Lemma \ref{morphisms-lemma-dimension-formula}). Whence $e(V) \leq \max(0, d -  2)$. Thus $V$ is affine by Lemma \ref{lemma-conclude} if $d \geq 2$. If $d = 1$ or $d = 0$, then the punctured spectrum of $\mathcal{O}_{Y, y}$ is affine and hence $V$ is affine.
This is proved in exactly the same manner as Proposition \ref{proposition-specialization-map-isomorphism} with the following differences \begin{enumerate} \item Given $X/A$ we no longer show that the functor $\textit{F\'Et}_X \to \textit{F\'Et}_{X_{\overline{\eta}}}$ is essentially surjective. We show only that Galois objects whose Galois group has order prime to $p$ are in the essential image. This will be enough to conclude the injectivity of $\pi'_1(X_{\overline{s}'}) \to \pi'_1(X_{\overline{s}})$ by exactly the same argument. \item The extensions $\mathcal{O}_{X_B, \xi_B} \subset \mathcal{O}_{Z, \xi_i}$ are tamely ramified as the associated extension of fraction fields is Galois with group of order prime to $p$. See More on Algebra, Lemma \ref{more-algebra-lemma-galois-conclusion}. \item The extension $\kappa_A \subset \kappa_B$ is no longer necessarily trivial, but it is purely inseparable. Hence the morphism $X_{\kappa_B} \to X_{\kappa_A}$ is a universal homeomorphism and induces an isomorphism of fundamental groups by Proposition \ref{proposition-universal-homeomorphism}. \end{enumerate}
A scheme $X$ over $K$ is \'etale over $K$ if and only if $X \cong \coprod_{i\in I} \Spec(K_i)$ with each $K_i$ a finite separable extension of $K$ (Morphisms, Lemma \ref{morphisms-lemma-etale-over-field}). The functor of the lemma associates to $X$ the $G$-set $$ \coprod\nolimits_i \Hom_K(K_i, K^{sep}) $$ with its natural left $G$-action. Each element has an open stabilizer by definition of the topology on $G$. Conversely, any $G$-set $S$ is a disjoint union of its orbits. Say $S = \coprod S_i$. Pick $s_i \in S_i$ and denote $G_i \subset G$ its open stabilizer. By Galois theory (Fields, Theorem \ref{fields-theorem-inifinite-galois-theory}) the fields $(K^{sep})^{G_i}$ are finite separable field extensions of $K$, and hence the scheme $$ \coprod\nolimits_i \Spec((K^{sep})^{G_i}) $$ is \'etale over $K$. This gives an inverse to the functor of the lemma. Some details omitted.
Denote $F_G$ the functor (\ref{equation-forgetful}). Any morphism $X \to Y$ in $\textit{Finite-}G\textit{-Sets}$ commutes with the action of $G$. Thus any $g \in G$ defines an automorphism of $F_G$ and we obtain a canonical homomorphism $G \to \text{Aut}(F_G)$ of groups. Observe that any finite $G$-set $X$ is a finite disjoint union of $G$-sets of the form $G/H_i$ with canonical $G$-action where $H_i \subset G$ is an open subgroup of finite index. Then $U_i = \bigcap gH_ig^{-1}$ is open, normal, and has finite index. Moreover $U_i$ acts trivially on $G/H_i$ hence $U = \bigcap U_i$ acts trivially on $F_G(X)$. Hence the action $G \times F_G(X) \to F_G(X)$ is continuous. By the universal property of the topology on $\text{Aut}(F_G)$ the map $G \to \text{Aut}(F_G)$ is continuous. By Lemma \ref{lemma-aut-inverse-limit} and the universal property of profinite completion there is an induced continuous group homomorphism $$ G^\wedge \longrightarrow \text{Aut}(F_G) $$ Moreover, since $G/U$ acts faithfully on $G/U$ this map is injective. If the image is dense, then the map is surjective and hence a homeomorphism by Topology, Lemma \ref{topology-lemma-bijective-map}. \medskip\noindent Let $\gamma \in \text{Aut}(F_G)$ and let $X \in \Ob(\mathcal{C})$. We will show there is a $g \in G$ such that $\gamma$ and $g$ induce the same action on $F_G(X)$. This will finish the proof. As before we see that $X$ is a finite disjoint union of $G/H_i$. With $U_i$ and $U$ as above, the finite $G$-set $Y = G/U$ surjects onto $G/H_i$ for all $i$ and hence it suffices to find $g \in G$ such that $\gamma$ and $g$ induce the same action on $F_G(G/U) = G/U$. Let $e \in G$ be the neutral element and say that $\gamma(eU) = g_0U$ for some $g_0 \in G$. For any $g_1 \in G$ the morphism $$ R_{g_1} : G/U \longrightarrow G/U,\quad gU \longmapsto gg_1U $$ of $\textit{Finite-}G\textit{-Sets}$ commutes with the action of $\gamma$. Hence $$ \gamma(g_1U) = \gamma(R_{g_1}(eU)) = R_{g_1}(\gamma(eU)) = R_{g_1}(g_0U) = g_0g_1U $$ Thus we see that $g = g_0$ works.
Let $X$ be a nonempty object of $\textit{Finite-}G\textit{-Sets}$. The diagram $$ \xymatrix{ X \ar[r] \ar[d] & \{*\} \ar[d] \\ \{*\} \ar[r] & \{*\} } $$ is cocartesian. Hence we conclude that $F(X)$ is nonempty. Let $U \subset G$ be an open, normal subgroup with finite index. Observe that $$ G/U \times G/U = \coprod\nolimits_{gU \in G/U} G/U $$ where the summand corresponding to $gU$ corresponds to the orbit of $(eU, gU)$ on the left hand side. Then we see that $$ F(G/U) \times F(G/U) = F(G/U \times G/U) = \coprod\nolimits_{gU \in G/U} F(G/U) $$ Hence $|F(G/U)| = |G/U|$ as $F(G/U)$ is nonempty. Thus we see that $$ \lim_{U \subset G\text{ open, normal, finite idex}} F(G/U) $$ is nonempty (Categories, Lemma \ref{categories-lemma-nonempty-limit}). Pick $\gamma = (\gamma_U)$ an element in this limit. Denote $F_G$ the functor (\ref{equation-forgetful}). We can identify $F_G$ with the functor $$ X \longmapsto \colim_U \Mor(G/U, X) $$ where $f : G/U \to X$ corresponds to $f(eU) \in X = F_G(X)$ (details omitted). Hence the element $\gamma$ determines a well defined map $$ t : F_G \longrightarrow F $$ Namely, given $x \in X$ choose $U$ and $f : G/U \to X$ sending $eU$ to $x$ and then set $t_X(x) = F(f)(\gamma_U)$. We will show that $t$ induces a bijective map $t_{G/U} : F_G(G/U) \to F(G/U)$ for any $U$. This implies in a straightforward manner that $t$ is an isomorphism (details omitted). Since $|F_G(G/U)| = |F(G/U)|$ it suffices to show that $t_{G/U}$ is surjective. The image contains at least one element, namely $t_{G/U}(eU) = F(\text{id}_{G/U})(\gamma_U) = \gamma_U$. For $g \in G$ denote $R_g : G/U \to G/U$ right multiplication. Then set of fixed points of $F(R_g) : F(G/U) \to F(G/U)$ is equal to $F(\emptyset) = \emptyset$ if $g \not \in U$ because $F$ commutes with equalizers. It follows that if $g_1, \ldots, g_{|G/U|}$ is a system of representatives for $G/U$, then the elements $F(R_{g_i})(\gamma_U)$ are pairwise distinct and hence fill out $F(G/U)$. Then $$ t_{G/U}(g_iU) = F(R_{g_i})(\gamma_U) $$ and the proof is complete.
We will use the results of Lemma \ref{lemma-epi-mono} without further mention. Let $n = |F(X)|$. Consider $X^n$ endowed with its natural action of $S_n$. Let $$ X^n = \coprod\nolimits_{t \in T} Z_t $$ be the decomposition into connected objects. Pick a $t$ such that $F(Z_t)$ contains $(s_1, \ldots, s_n)$ with $s_i$ pairwise distinct. If $(s'_1, \ldots, s'_n) \in F(Z_t)$ is another element, then we claim $s'_i$ are pairwise distinct as well. Namely, if not, say $s'_i = s'_j$, then $Z_t$ is the image of an connected component of $X^{n - 1}$ under the diagonal morphism $$ \Delta_{ij} : X^{n - 1} \longrightarrow X^n $$ Since morphisms of connected objects are epimorphisms and induce surjections after applying $F$ it would follow that $s_i = s_j$ which is not the case. \medskip\noindent Let $G \subset S_n$ be the subgroup of elements with $g(Z_t) = Z_t$. Looking at the action of $S_n$ on $$ F(X)^n = F(X^n) = \coprod\nolimits_{t' \in T} F(Z_{t'}) $$ we see that $G = \{g \in S_n \mid g(s_1, \ldots, s_n) \in F(Z_t)\}$. Now pick a second element $(s'_1, \ldots, s'_n) \in F(Z_t)$. Above we have seen that $s'_i$ are pairwise distinct. Thus we can find a $g \in S_n$ with $g(s_1, \ldots, s_n) = (s'_1, \ldots, s'_n)$. In other words, the action of $G$ on $F(Z_t)$ is transitive and the proof is complete.
We will use the results of Lemma \ref{lemma-epi-mono} without further mention. Let $I$ be the set of isomorphism classes of Galois objects in $\mathcal{C}$. For each $i \in I$ let $X_i$ be a representative of the isomorphism class. Choose $\gamma_i \in F(X_i)$ for each $i \in I$. We define a partial ordering on $I$ by setting $i \geq i'$ if and only if there is a morphism $f_{ii'} : X_i \to X_{i'}$. Given such a morphism we can post-compose by an automorphism $X_{i'} \to X_{i'}$ to assure that $F(f_{ii'})(\gamma_i) = \gamma_{i'}$. With this normalization the morphism $f_{ii'}$ is unique. Observe that $I$ is a directed partially ordered set: (Categories, Definition \ref{categories-definition-directed-set}) if $i_1, i_2 \in I$ there exists a Galois object $Y$ and a morphism $Y \to X_{i_1} \times X_{i_2}$ by Lemma \ref{lemma-galois} applied to a connected component of $X_{i_1} \times X_{i_2}$. Then $Y \cong X_i$ for some $i \in I$ and $i \geq i_1$, $i \geq I_2$. \medskip\noindent We claim that the functor $F$ is isomorphic to the functor $F'$ which sends $X$ to $$ F'(X) = \colim_I \Mor_\mathcal{C}(X_i, X) $$ via the transformation of functors $t : F' \to F$ defined as follows: given $f : X_i \to X$ we set $t_X(f) = F(f)(\gamma_i)$. Using (\ref{item-one-element}) we find that $t_X$ is injective. To show surjectivity, let $\gamma \in F(X)$. Then we can immediately reduce to the case where $X$ is connected by the definition of a Galois category. Then we may assume $X$ is Galois by Lemma \ref{lemma-galois}. In this case $X$ is isomorphic to $X_i$ for some $i$ and we can choose the isomorphism $X_i \to X$ such that $\gamma_i$ maps to $\gamma$ (by definition of Galois objects). We conclude that $t$ is an isomorphism. \medskip\noindent Set $A_i = \text{Aut}(X_i)$. We claim that for $i \geq i'$ there is a canonical map $h_{ii'} : A_i \to A_{i'}$ such that for all $a \in A_i$ the diagram $$ \xymatrix{ X_i \ar[d]_a \ar[r]_{f_{ii'}} & X_{i'} \ar[d]^{h_{ii'}(a)} \\ X_i \ar[r]^{f_{ii'}} & X_{i'} } $$ commutes. Namely, just let $h_{ii'}(a) = a' : X_{i'} \to X_{i'}$ be the unique automorphism such that $F(a')(\gamma_{i'}) = F(f_{ii'} \circ a)(\gamma_i)$. As before this makes the diagram commute and moreover the choice is unique. It follows that $h_{i'i''} \circ h_{ii'} = h_{ii''}$ if $i \geq i' \geq i''$. Since $F(X_i) \to F(X_{i'})$ is surjective we see that $A_i \to A_{i'}$ is surjective. Taking the inverse limit we obtain a group $$ A = \lim_I A_i $$ This is a profinite group since the automorphism groups are finite. The map $A \to A_i$ is surjective for all $i$ by Categories, Lemma \ref{categories-lemma-nonempty-limit}. \medskip\noindent Since elements of $A$ act on the inverse system $X_i$ we get an action of $A$ (on the right) on $F'$ by pre-composing. In other words, we get a homomorphism $A^{opp} \to G$. Since $A \to A_i$ is surjective we conclude that $G$ acts transitively on $F(X_i)$ for all $i$. Since every connected object is dominated by one of the $X_i$ we conclude the lemma is true.
By Proposition \ref{proposition-galois} and Lemma \ref{lemma-single-out-profinite} we may assume $\mathcal{C} = \textit{Finite-}G\textit{-Sets}$ and $F$ is the forgetful functor and similarly for $\mathcal{C}'$. Thus the existence of $t$ follows from Lemma \ref{lemma-second-fundamental-functor}. The map $h$ comes from transport of structure via $t$. The commutativity of the diagram is obvious. Uniqueness of $h$ up to inner conjugation by an element of $G$ comes from the fact that the choice of $t$ is unique up to an element of $G$. The final statement is straightforward.
By Lemmas \ref{lemma-functoriality-galois-surjective} and \ref{lemma-composition-trivial} we may assume that $H$ is fully faithful, $h$ is surjective, $H' \circ H$ maps objects to disjoint unions of the final object, and $h \circ h'$ is trivial. Let $N \subset G'$ be the smallest closed normal subgroup containing the image of $h'$. It is clear that $N \subset \Ker(h)$. We may assume the functors $H$ and $H'$ are the canonical functors $\textit{Finite-}G\textit{-Sets} \to \textit{Finite-}G'\textit{-Sets} \to \textit{Finite-}G''\textit{-Sets}$ determined by $h$ and $h'$. \medskip\noindent Suppose that (2) holds. This means that for a finite $G'$-set $X'$ such that $G''$ acts trivially, the action of $G'$ factors through $G$. Apply this to $X' = G'/U'N$ where $U'$ is a small open subgroup of $G'$. Then we see that $\Ker(h) \subset U'N$ for all $U'$. Since $N$ is closed this implies $\Ker(h) \subset N$, i.e., (1) holds. \medskip\noindent Suppose that (1) holds. This means that $N = \Ker(h)$. Let $X'$ be a finite $G'$-set such that $G''$ acts trivially. This means that $\Ker(G' \to \text{Aut}(X'))$ is a closed normal subgroup containing $\Im(h')$. Hence $N = \Ker(h)$ is contained in it and the $G'$-action on $X'$ factors through $G$, i.e., (2) holds. \medskip\noindent Suppose that (3) holds. This means that for a finite $G'$-set $X'$ such that $G''$ acts trivially, there is a surjection of $G'$-sets $X \to X'$ where $X$ is a $G$-set. Clearly this means the action of $G'$ on $X'$ factors through $G$, i.e., (2) holds. \medskip\noindent The implication (2) $\Rightarrow$ (3) is immediate. This finishes the proof.
Finite limits and left exactness. By Categories, Lemma \ref{categories-lemma-finite-limits-exist} it suffices to show that $\textit{F\'Et}_X$ has a final object and fibred products. This is clear because the category of all schemes over $X$ has a final object (namely $X$) and fibred products and fibred products of schemes finite \'etale over $X$ are finite \'etale over $X$. Moreover, it is clear that base change commutes with these operations and hence base change is left exact (Categories, Lemma \ref{categories-lemma-characterize-left-exact}). \medskip\noindent Finite colimits and right exactness. By Categories, Lemma \ref{categories-lemma-colimits-exist} it suffices to show that $\textit{F\'Et}_X$ has finite coproducts and coequalizers. Finite coproducts are given by disjoint unions (the empty coproduct is the empty scheme). Let $a, b : Z \to Y$ be two morphisms of $\textit{F\'Et}_X$. Since $Z \to X$ and $Y \to X$ are finite \'etale we can write $Z = \underline{\Spec}(\mathcal{C})$ and $Y = \underline{\Spec}(\mathcal{B})$ for some finite locally free $\mathcal{O}_X$-algebras $\mathcal{C}$ and $\mathcal{B}$. The morphisms $a, b$ induce two maps $a^\sharp, b^\sharp : \mathcal{B} \to \mathcal{C}$. Let $\mathcal{A} = \text{Eq}(a^\sharp, b^\sharp)$ be their equalizer. If $$ \underline{\Spec}(\mathcal{A}) \longrightarrow X $$ is finite \'etale, then it is clear that this is the coequalizer (after all we can write any object of $\textit{F\'Et}_X$ as the relative spectrum of a sheaf of $\mathcal{O}_X$-algebras). This we may do after replacing $X$ by the members of an \'etale covering (Descent, Lemmas \ref{descent-lemma-descending-property-finite} and \ref{descent-lemma-descending-property-separated}). Thus by \'Etale Morphisms, Lemma \ref{etale-lemma-finite-etale-etale-local} we may assume that $Y = \coprod_{i = 1, \ldots, n} X$ and $Z = \coprod_{j = 1, \ldots, m} X$. Then $$ \mathcal{C} = \prod\nolimits_{1 \leq j \leq m} \mathcal{O}_X \quad\text{and}\quad \mathcal{B} = \prod\nolimits_{1 \leq i \leq n} \mathcal{O}_X $$ After a further replacement by the members of an open covering we may assume that $a, b$ correspond to maps $a_s, b_s : \{1, \ldots, m\} \to \{1, \ldots, n\}$, i.e., the summand $X$ of $Z$ corresponding to the index $j$ maps into the summand $X$ of $Y$ corresponding to the index $a_s(j)$, resp.\ $b_s(j)$ under the morphism $a$, resp.\ $b$. Let $\{1, \ldots, n\} \to T$ be the coequalizer of $a_s, b_s$. Then we see that $$ \mathcal{A} = \prod\nolimits_{t \in T} \mathcal{O}_X $$ whose spectrum is certainly finite \'etale over $X$. We omit the verification that this is compatible with base change. Thus base change is a right exact functor.
By More on Morphisms, Lemma \ref{more-morphisms-lemma-hom-from-finite-locally-free-separated-lqf} there exists a scheme $W$ representing $\mathit{Mor}_X(U, V)$. (Use that an \'etale morphism is locally quasi-finite by Morphisms, Lemmas \ref{morphisms-lemma-etale-locally-quasi-finite} and that a finite morphism is separated.) This scheme clearly satisfies the formula after any base change. To finish the proof we have to show that $W \to X$ is finite \'etale. This we may do after replacing $X$ by the members of an \'etale covering (Descent, Lemmas \ref{descent-lemma-descending-property-finite} and \ref{descent-lemma-descending-property-separated}). Thus by \'Etale Morphisms, Lemma \ref{etale-lemma-finite-etale-etale-local} we may assume that $U = \coprod_{i = 1, \ldots, n} X$ and $V = \coprod_{j = 1, \ldots, m} X$. In this case $W = \coprod_{\alpha : \{1, \ldots, n\} \to \{1, \ldots, m\}} X$ by inspection (details omitted) and the proof is complete.
After identifying $\textit{F\'Et}_{\overline{x}}$ with the category of finite sets (Example \ref{example-finite-etale-geometric-point}) we see that our functor $F_{\overline{x}}$ is nothing but the base change functor for the morphism $\overline{x} \to X$. Thus we see that $\textit{F\'Et}_X$ has finite limits and finite colimits and that $F_{\overline{x}}$ is exact by Lemma \ref{lemma-finite-etale-covers-limits-colimits}. We will also use that finite limits in $\textit{F\'Et}_X$ agree with the corresponding finite limits in the category of schemes over $X$, see Remark \ref{remark-colimits-commute-forgetful}. \medskip\noindent If $Y' \to Y$ is a monomorphism in $\textit{F\'Et}_X$ then we see that $Y' \to Y' \times_Y Y'$ is an isomorphism, and hence $Y' \to Y$ is a monomorphism of schemes. It follows that $Y' \to Y$ is an open immersion (\'Etale Morphisms, Theorem \ref{etale-theorem-etale-radicial-open}). Since $Y'$ is finite over $X$ and $Y$ separated over $X$, the morphism $Y' \to Y$ is finite (Morphisms, Lemma \ref{morphisms-lemma-finite-permanence}), hence closed (Morphisms, Lemma \ref{morphisms-lemma-finite-proper}), hence it is the inclusion of an open and closed subscheme of $Y$. It follows that $Y$ is a connected objects of the category $\textit{F\'Et}_X$ (as in Definition \ref{definition-galois-category}) if and only if $Y$ is connected as a scheme. Then it follows from Topology, Lemma \ref{topology-lemma-finite-fibre-connected-components} that $Y$ is a finite coproduct of its connected components both as a scheme and in the sense of Definition \ref{definition-galois-category}. \medskip\noindent Let $Y \to Z$ be a morphism in $\textit{F\'Et}_X$ which induces a bijection $F_{\overline{x}}(Y) \to F_{\overline{x}}(Z)$. We have to show that $Y \to Z$ is an isomorphism. By the above we may assume $Z$ is connected. Since $Y \to Z$ is finite \'etale and hence finite locally free it suffices to show that $Y \to Z$ is finite locally free of degree $1$. This is true in a neighbourhood of any point of $Z$ lying over $\overline{x}$ and since $Z$ is connected and the degree is locally constant we conclude.
The functor of Lemma \ref{lemma-sheaves-point} is the same as the functor $F_{\overline{x}}$ because for any $Y$ \'etale over $X$ we have $$ \Mor_X(\Spec(\overline{K}), Y) = \Mor_X(\Spec(K^{sep}), Y) $$ Namely, as seen in the proof of Lemma \ref{lemma-sheaves-point} we have $Y = \coprod_{i \in I} \Spec(L_i)$ with $L_i/K$ finite separable over $K$. Hence any $K$-algebra homomorphism $L_i \to \overline{K}$ factors through $K^{sep}$. Also, note that $F_{\overline{x}}(Y)$ is finite if and only if $I$ is finite if and only if $Y \to X$ is finite \'etale. This proves (1). \medskip\noindent Part (2) is a formal consequence of (1), Lemma \ref{lemma-functoriality-galois}, and Lemma \ref{lemma-single-out-profinite}. (Please also see the remark below.)
Let $Y = Y_0 \amalg Y_1$ be a decomposition into nonempty open and closed subschemes. We claim that $f(X)$ meets both $Y_i$. Namely, if not, say $f(X) \subset Y_1$, then we can consider the finite \'etale morphism $V = Y_1 \to Y$. This is not an isomorphism but $V \times_Y X \to X$ is an isomorphism, which is a contradiction. \medskip\noindent Suppose that $X = X_0 \amalg X_1$ is a decomposition into open and closed subschemes. Consider the finite \'etale morphism $U = X_1 \to X$. Then $U = X \times_Y V$ for some finite \'etale morphism $V \to Y$. The degree of the morphism $V \to Y$ is locally constant, hence we obtain a decomposition $Y = \coprod_{d \geq 0} Y_d$ into open and closed subschemes such that $V \to Y$ has degree $d$ over $Y_d$. Since $f^{-1}(Y_d) = \emptyset$ for $d > 1$ we conclude that $Y_d = \emptyset$ for $d > 1$ by the above. And we conclude that $f^{-1}(Y_i) = X_i$ for $i = 0, 1$. \medskip\noindent It follows that $f^{-1}$ induces a bijection between the set of open and closed subsets of $Y$ and the set of open and closed subsets of $X$. Note that $X$ and $Y$ are spectral spaces, see Properties, Lemma \ref{properties-lemma-quasi-compact-quasi-separated-spectral}. By Topology, Lemma \ref{topology-lemma-connected-component-intersection} the lattice of open and closed subsets of a spectral space determines the set of connected components. Hence $\pi_0(X) \to \pi_0(Y)$ is bijective. Since $\pi_0(X)$ and $\pi_0(Y)$ are profinite spaces (Topology, Lemma \ref{topology-lemma-pi0-profinite}) we conclude that $\pi_0(X) \to \pi_0(Y)$ is a homeomorphism by Topology, Lemma \ref{topology-lemma-bijective-map}. This proves (1). Part (2) is immediate.