hcju/stacksqa huggingface dataset:
Let $k$ be an algebraically closed field. Since $C \to A$ is integral (Lemma \ref{lemma-integral-over-invariants}) and injective we see that $\Spec(A) \to \Spec(C)$ is surjective, see Algebra, Lemma \ref{algebra-lemma-integral-overring-surjective}. Thus $|U| \to |M|$ is surjective. Let $C \to k$ be a ring map. Since surjective morphisms are preserved under base change (Morphisms, Lemma \ref{morphisms-lemma-base-change-surjective}) we see that $A \otimes_C k$ is not zero. Now $k \subset A \otimes_C k$ is a nonzero integral extension. Hence any residue field of $A \otimes_C k$ is an algebraic extension of $k$, hence equal to $k$. Thus we see that $U(k) \to M(k)$ is surjective. \medskip\noindent Let $a_0, a_1 : A \to k$ be ring maps. If there exists a ring map $b : B \to k$ such that $a_0 = b \circ t^\sharp$ and $a_1 = b \circ s^\sharp$ then we see that $a_0|_C = a_1|_C$ by definition. Conversely, suppose that $a_0|_C = a_1|_C$. Let us name this algebra map $c : C \to k$. Consider the diagram $$ \xymatrix{ & & B \ar@{-->}[lld] \\ k & & A \ar@<0.5ex>[ll]^{a_0} \ar@<-0.5ex>[ll]_{a_1} \ar@<1ex>[u] \ar@<-1ex>[u] \\ & & C \ar[u] \ar[llu]^c } $$ We are trying to construct the dotted arrow, and if we do then part (2) follows, which in turn implies part (1). Since $A \to B$ is finite and faithfully flat there exist finitely many ring maps $b_1, \ldots, b_n : B \to k$ such that $b_i \circ s^\sharp = a_1$. If the dotted arrow does not exist, then we see that none of the $a'_i = b_i \circ t^\sharp$, $i = 1, \ldots, n$ is equal to $a_0$. Hence the maximal ideals $$ \mathfrak m'_i = \Ker(a_i' \otimes 1 : A \otimes_C k \to k) $$ of $A \otimes_C k$ are distinct from $\mathfrak m = \Ker(a_0 \otimes 1 : A \otimes_C k \to k)$. By Algebra, Lemma \ref{algebra-lemma-silly} we would get an element $f \in A \otimes_C k$ with $f \in \mathfrak m$, but $f \not \in \mathfrak m_i'$ for $i = 1, \ldots, n$. Consider the norm $$ g = \text{Norm}_{s^\sharp \otimes 1}(t^\sharp \otimes 1(f)) \in A \otimes_C k $$ By Lemma \ref{lemma-determinant-trick} this lies in the invariants $C^1 \subset A \otimes_C k$ of the base change groupoid (base change via the map $c : C \to k$). On the one hand, $a_1(g) \in k^*$ since the value of $t^\sharp(f)$ at all the points (which correspond to $b_1, \ldots, b_n$) lying over $a_1$ is invertible (insert future reference on property determinant here). On the other hand, since $f \in \mathfrak m$, we see that $f$ is not a unit, hence $t^\sharp(f)$ is not a unit (as $t^\sharp \otimes 1$ is faithfully flat), hence its norm is not a unit (insert future reference on property determinant here). We conclude that $C^1$ contains an element which is not nilpotent and not a unit. We will now show that this leads to a contradiction. Namely, apply Lemma \ref{lemma-invariants-base-change} to the map $c : C \to C' = k$, then we see that the map of $k$ into the invariants $C^1$ is injective and moreover, that for any element $x \in C^1$ there exists an integer $n > 0$ such that $x^n \in k$. Hence every element of $C^1$ is either a unit or nilpotent.
During this proof we will write $s, t : A \to B$ instead of $s^\sharp, t^\sharp$, and similarly $c : B \to B \otimes_{s, A, t} B$. We write $p_0 : B \to B \otimes_{s, A, t} B$, $b \mapsto b \otimes 1$ and $p_1 : B \to B \otimes_{s, A, t} B$, $b \mapsto 1 \otimes b$. By Lemma \ref{lemma-diagram-pull} and the definition of $C$ we have the following commutative diagram $$ \xymatrix{ B \otimes_{s, A, t} B & B \ar@<-1ex>[l]_-c \ar@<1ex>[l]^-{p_0} & A \ar[l]^t \\ B \ar[u]^{p_1} & A \ar@<-1ex>[l]_s \ar@<1ex>[l]^t \ar[u]_s & C \ar[u] \ar[l] } $$ Moreover the tow left squares are cocartesian in the category of rings, and the top row is isomorphic to the diagram $$ \xymatrix{ B \otimes_{t, A, t} B & B \ar@<-1ex>[l]_-{p_1} \ar@<1ex>[l]^-{p_0} & A \ar[l]^t } $$ which is an equalizer diagram according to Descent, Lemma \ref{descent-lemma-ff-exact} because condition (2) implies in particular that $s$ (and hence also then isomorphic arrow $t$) is faithfully flat. The lower row is an equalizer diagram by definition of $C$. We can use the $x_i$ and get a commutative diagram $$ \xymatrix{ B \otimes_{s, A, t} B & B \ar@<-1ex>[l]_-c \ar@<1ex>[l]^-{p_0} & A \ar[l]^t \\ \bigoplus_{i \in I} B x_i \ar[u]^{p_1} & \bigoplus_{i \in I} A x_i \ar@<-1ex>[l]_s \ar@<1ex>[l]^t \ar[u]_s & \bigoplus_{i \in I} C x_i \ar[u] \ar[l] } $$ where in the right vertical arrow we map $x_i$ to $x_i$, in the middle vertical arrow we map $x_i$ to $t(x_i)$ and in the left vertical arrow we map $x_i$ to $c(t(x_i)) = t(x_i) \otimes 1 = p_0(t(x_i))$ (equality by the commutativity of the top part of the diagram in Lemma \ref{lemma-diagram}). Then the diagram commutes. Moreover the middle vertical arrow is an isomorphism by assumption. Since the left two squares are cocartesian we conclude that also the left vertical arrow is an isomorphism. On the other hand, the horizontal rows are exact (i.e., they are equalizers). Hence we conclude that also the right vertical arrow is an isomorphism.
Since $s$ is finite locally free it has finite fibres. Hence $t(s^{-1}(\{u\})) = \{u_1, \ldots, u_n\}$ is a finite set. Note that $u \in \{u_1, \ldots, u_n\}$. Let $W \subset U$ be an affine open containing $\{u_1, \ldots, u_n\}$, in particular $u \in W$. Consider $Z = R \setminus s^{-1}(W) \cap t^{-1}(W)$. This is a closed subset of $R$. The image $t(Z)$ is a closed subset of $U$ which can be loosely described as the set of points of $U$ which are $R$-equivalent to a point of $U \setminus W$. Hence $W' = U \setminus t(Z)$ is an $R$-invariant, open subscheme of $U$ contained in $W$, and $\{u_1, \ldots, u_n\} \subset W'$. Picture $$ \{u_1, \ldots, u_n\} \subset W' \subset W \subset U. $$ Let $f \in \Gamma(W, \mathcal{O}_W)$ be an element such that $\{u_1, \ldots, u_n\} \subset D(f) \subset W'$. Such an $f$ exists by Algebra, Lemma \ref{algebra-lemma-silly}. By our choice of $W'$ we have $s^{-1}(W') \subset t^{-1}(W)$, and hence we get a diagram $$ \xymatrix{ s^{-1}(W') \ar[d]_s \ar[r]_-t & W \\ W' } $$ The vertical arrow is finite locally free by assumption. Set $$ g = \text{Norm}_s(t^\sharp f) \in \Gamma(W', \mathcal{O}_{W'}) $$ By construction $g$ is a function on $W'$ which is nonzero in $u$, as $t^\sharp(f)$ is nonzero in each of the points of $R$ lying over $u$, since $f$ is nonzero in $u_1, \ldots, u_n$. Similarly, $D(g) \subset W'$ is equal to the set of points $w$ such that $f$ is not zero in any of the points equivalent to $w$. This means that $D(g)$ is an $R$-invariant affine open of $W'$. The final picture is $$ \{u_1, \ldots, u_n\} \subset D(g) \subset D(f) \subset W' \subset W \subset U $$ and hence we win.
Let $\varphi$ be a descent datum as in Descent, Definition \ref{descent-definition-descent-datum}. Recall that the functor from schemes over $Y$ to descent data relative to $\{X \to Y\}$ is fully faithful, see Descent, Lemma \ref{descent-lemma-refine-coverings-fully-faithful}. Thus using Constructions, Lemma \ref{constructions-lemma-relative-glueing} it suffices to prove the lemma in the case that $Y$ is affine. Some details omitted (this argument can be avoided if $Y$ is separated or has affine diagonal, because then every morphism from an affine scheme to $X$ is affine). \medskip\noindent Assume $Y$ is affine. If $V$ is also affine, then we have effectivity by Descent, Lemma \ref{descent-lemma-affine}. Hence by Descent, Lemma \ref{descent-lemma-effective-for-fpqc-is-local-upstairs} it suffices to prove that every point $v$ of $V$ has a $\varphi$-invariant affine open neighbourhood. Consider the groupoid $(X, X \times_Y X, \text{pr}_1, \text{pr}_0, \text{pr}_{02})$. By Lemma \ref{lemma-cartesian-equivalent-descent-datum} the descent datum $\varphi$ determines and is determined by a cartesian morphism of groupoid schemes $$ (V, R, s, t, c) \longrightarrow (X, X \times_Y X, \text{pr}_1, \text{pr}_0, \text{pr}_{02}) $$ over $\Spec(\mathbf{Z})$. Since $X \to Y$ is finite locally free, we see that $\text{pr}_i : X \times_Y X \to X$ and hence $s$ and $t$ are finite locally free. In particular the $R$-orbit $t(s^{-1}(\{v\}))$ of our point $v \in V$ is finite. Using the equivalence of categories of Lemma \ref{lemma-cartesian-equivalent-descent-datum} once more we see that $\varphi$-invariant opens of $V$ are the same thing as $R$-invariant opens of $V$. Our assumption shows there exists an affine open of $V$ containing the orbit $t(s^{-1}(\{v\}))$ as all the points in this orbit map to the same point of $Y$. Thus Lemma \ref{lemma-find-invariant-affine} provides an $R$-invariant affine open containing $v$.
We check the condition in Lemma \ref{lemma-descend-along-finite}. Let $y \in Y$ and $v_1, \ldots, v_d \in V$ points over $y$. Case (1) is a special case of (2), see Morphisms, Lemma \ref{morphisms-lemma-projective-quasi-projective}. Case (2) is a special case of (4), see Morphisms, Definition \ref{morphisms-definition-quasi-projective}. If there exists an ample invertible sheaf on $V$, then there exists an affine open containing $v_1, \ldots, v_d$ by Properties, Lemma \ref{properties-lemma-ample-finite-set-in-affine}. Thus (3) is true. In cases (4) and (5) it is harmless to replace $Y$ by an affine open neighbourhood of $y$. Then $X$ is affine too. In case (4) we see that $V$ has an ample invertible sheaf by Morphisms, Definition \ref{morphisms-definition-relatively-ample} and the result follows from case (3). In case (5) we can replace $V$ by a quasi-compact open containing $v_1, \ldots, v_d$ and we reduce to case (4) by Morphisms, Lemma \ref{morphisms-lemma-ample-very-ample}.
Let $G^0$ be the connected component of the identity with its canonical scheme structure (Morphisms, Definition \ref{morphisms-definition-scheme-structure-connected-component}). To show that $G^0$ is a closed subsgroup scheme we will use the criterion of Lemma \ref{lemma-closed-subgroup-scheme}. The morphism $e : \Spec(k) \to G$ factors through $G^0$ as we chose $G^0$ to be the connected component of $G$ containing $e$. Since $i : G \to G$ is an automorphism fixing $e$, we see that $i$ sends $G^0$ into itself. By Varieties, Lemma \ref{varieties-lemma-geometrically-connected-criterion} the scheme $G^0$ is geometrically connected over $k$. Thus $G^0 \times_k G^0$ is connected (Varieties, Lemma \ref{varieties-lemma-bijection-connected-components}). Thus $m(G^0 \times_k G^0) \subset G^0$ set theoretically. Thus $m|_{G^0 \times_k G^0} : G^0 \times_k G^0 \to G$ factors through $G^0$ by Morphisms, Lemma \ref{morphisms-lemma-characterize-flat-closed-immersions}. Hence $G^0$ is a closed subgroup scheme of $G$. By Lemma \ref{lemma-connected-group-scheme-over-field-irreducible} we see that $G^0$ is irreducible. By Lemma \ref{lemma-group-scheme-field-geometrically-irreducible} we see that $G^0$ is geometrically irreducible. By Lemma \ref{lemma-irreducible-group-scheme-over-field-qc} we see that $G^0$ is quasi-compact.
Part (1) follows from Lemma \ref{lemma-abelian-variety-projective}. Part (2) follows from Lemma \ref{lemma-abelian-variety-abelian}. Part (3) follows from Lemma \ref{lemma-degree-multiplication-by-d}. If $k$ is algebraically closed then surjective morphisms of varieties over $k$ induce surjective maps on $k$-rational points, hence (4) follows from (3). Part (5) follows from Lemma \ref{lemma-degree-multiplication-by-d} and the fact that a base change of a finite locally free morphism of degree $N$ is a finite locally free morphism of degree $N$. Part (6) follows from  Lemma \ref{lemma-abelian-variety-multiplication-by-d-etale}. Namely, if $n$ is invertible in $k$, then $[n]$ is \'etale and hence $A[n]$ is \'etale over $k$. On the other hand, if $n$ is not invertible in $k$, then $[n]$ is not \'etale at $e$ and it follows that $A[n]$ is not \'etale over $k$ at $e$ (use Morphisms, Lemmas \ref{morphisms-lemma-flat-unramified-etale} and \ref{morphisms-lemma-set-points-where-fibres-unramified}). \medskip\noindent Assume $k$ is algebraically closed. Set $g = \dim(A)$. Proof of (7). Let $\ell$ be a prime number which is invertible in $k$. Then we see that $$ A[\ell](k) = A(k)[\ell] $$ is a finite abelian group, annihilated by $\ell$, of order $\ell^{2g}$. It follows that it is isomorphic to $(\mathbf{Z}/\ell\mathbf{Z})^{2g}$ by the structure theory for finite abelian groups. Next, we consider the short exact sequence $$ 0 \to A(k)[\ell] \to A(k)[\ell^2] \xrightarrow{\ell} A(k)[\ell] \to 0 $$ Arguing similarly as above we conclude that  $A(k)[\ell^2] \cong (\mathbf{Z}/\ell^2\mathbf{Z})^{2g}$. By induction on the exponent we find that $A(k)[\ell^m] \cong (\mathbf{Z}/\ell^m\mathbf{Z})^{2g}$. For composite integers $n$ prime to the characteristic of $k$ we take primary parts and we find the correct shape of the $n$-torsion in $A(k)$. The proof of (8) proceeds in exactly the same way, using that Lemma \ref{lemma-abelian-variety-multiplication-by-p} gives $A(k)[p] \cong (\mathbf{Z}/p\mathbf{Z})^{\oplus f}$ for some $0 \leq f \leq g$.
By Lemma \ref{lemma-check-finiteness-local-cohomology-locally} we may assume that $A$ is a local ring. \medskip\noindent If $A$ is a Noetherian complete local ring, then we can write $A$ as the quotient of a regular complete local ring $B$ by Cohen's structure theorem (Algebra, Theorem \ref{algebra-theorem-cohen-structure-theorem}). Using Lemma \ref{lemma-cutoff} and Dualizing Complexes, Lemma \ref{dualizing-lemma-local-cohomology-and-restriction} we reduce to the case of a regular local ring which is a consequence of Lemma \ref{lemma-local-annihilator} because a regular local ring is Gorenstein (Dualizing Complexes, Lemma \ref{dualizing-lemma-regular-gorenstein}). \medskip\noindent Let $A$ be a Noetherian local ring. Let $\mathfrak m$ be the maximal ideal. We may assume $I \subset \mathfrak m$, otherwise the lemma is trivial. Let $A^\wedge$ be the completion of $A$, let $Z^\wedge = V(IA^\wedge)$, and let $M^\wedge = M \otimes_A A^\wedge$ be the completion of $M$ (Algebra, Lemma \ref{algebra-lemma-completion-tensor}). Then $H^i_Z(M) \otimes_A A^\wedge = H^i_{Z^\wedge}(M^\wedge)$ by Dualizing Complexes, Lemma \ref{dualizing-lemma-torsion-change-rings} and flatness of $A \to A^\wedge$ (Algebra, Lemma \ref{algebra-lemma-completion-flat}). Hence it suffices to show that $H^i_{Z^\wedge}(M^\wedge)$ is finite for $i < s$ and not finite for $i = s$, see Algebra, Lemma \ref{algebra-lemma-descend-properties-modules}. Since we know the result is true for $A^\wedge$ it suffices to show that $s_{A, I}(M) = s_{A^\wedge, I^\wedge}(M^\wedge)$. This follows from Lemma \ref{lemma-cutoff-completion}.
By Cohomology, Lemma \ref{cohomology-lemma-triangle-sections-with-support} there exists a distinguished triangle $$ R\Gamma_Z(X, \widetilde{K}) \to R\Gamma(X, \widetilde{K}) \to R\Gamma(U, \widetilde{K}) \to R\Gamma_Z(X, \widetilde{K})[1] $$ where $U = X \setminus Z$. We know that $R\Gamma(X, \widetilde{K}) = K$ by Derived Categories of Schemes, Lemma \ref{perfect-lemma-affine-compare-bounded}. Say $I = (f_1, \ldots, f_r)$. Then we obtain a finite affine open covering $\mathcal{U} : U = D(f_1) \cup \ldots \cup D(f_r)$. By Derived Categories of Schemes, Lemma \ref{perfect-lemma-alternating-cech-complex-complex-computes-cohomology} the alternating {\v C}ech complex $\text{Tot}(\check{\mathcal{C}}_{alt}^\bullet(\mathcal{U}, \widetilde{K^\bullet}))$ computes $R\Gamma(U, \widetilde{K})$ where $K^\bullet$ is any complex of $A$-modules representing $K$. Working through the definitions we find $$ R\Gamma(U, \widetilde{K}) = \text{Tot}\left( K^\bullet \otimes_A (\prod\nolimits_{i_0} A_{f_{i_0}} \to \prod\nolimits_{i_0 < i_1} A_{f_{i_0}f_{i_1}} \to \ldots \to A_{f_1\ldots f_r})\right) $$ It is clear that $K^\bullet = R\Gamma(X, \widetilde{K^\bullet}) \to R\Gamma(U, \widetilde{K}^\bullet)$ is induced by the diagonal map from $A$ into $\prod A_{f_i}$. Hence we conclude that $$ R\Gamma_Z(X, \mathcal{F}^\bullet) = \text{Tot}\left( K^\bullet \otimes_A (A \to \prod\nolimits_{i_0} A_{f_{i_0}} \to \prod\nolimits_{i_0 < i_1} A_{f_{i_0}f_{i_1}} \to \ldots \to A_{f_1\ldots f_r})\right) $$ By Dualizing Complexes, Lemma \ref{dualizing-lemma-local-cohomology-adjoint} this complex computes $R\Gamma_Z(K)$ and we see the lemma holds.
The existence of $M$ follows from Properties, Lemma \ref{properties-lemma-extend-trivial} and the fact that quasi-coherent sheaves on $X$ correspond to $A$-modules (Schemes, Lemma \ref{schemes-lemma-equivalence-quasi-coherent}). Then we look at the distinguished triangle $$ R\Gamma_Z(X, \widetilde{M}) \to R\Gamma(X, \widetilde{M}) \to R\Gamma(U, \widetilde{M}|_U) \to R\Gamma_Z(X, \widetilde{M})[1] $$ of Cohomology, Lemma \ref{cohomology-lemma-triangle-sections-with-support}. Since $X$ is affine we have $R\Gamma(X, \widetilde{M}) = M$ by Cohomology of Schemes, Lemma \ref{coherent-lemma-quasi-coherent-affine-cohomology-zero}. By our choice of $M$ we have $\mathcal{F} = \widetilde{M}|_U$ and hence this produces an exact sequence $$ 0 \to H^0_Z(X, \widetilde{M}) \to M \to H^0(U, \mathcal{F}) \to H^1_Z(X, \widetilde{M}) \to 0 $$ and isomorphisms $H^p(U, \mathcal{F}) = H^{p + 1}_Z(X, \widetilde{M})$ for $p \geq 1$. By Lemma \ref{lemma-local-cohomology-is-local-cohomology} we have $H^i_Z(M) = H^i_Z(X, \widetilde{M})$ for all $i$. Thus (1) and (2) do hold. Finally, setting $M' = H^0(U, \mathcal{F})$ we see that the kernel and cokernel of $M \to M'$ are $I$-power torsion. Therefore $\widetilde{M}|_U \to \widetilde{M'}|_U$ is an isomorphism and we can indeed use $M'$ as predicted in (3). It goes without saying that we obtain zero for both $H^0_Z(M')$ and $H^0_Z(M')$.
The statement on $H^0$ follows directly from the definitions. To see the statement on $H^1$ observe that $R\Gamma_{V(f)}$ and $H^1_{V(f)}$ commute with colimits. Hence we may assume $M$ is annihilated by some $f \in S$. Then $H^1_{V(ff')}(M) = 0$ for all $f' \in S$ (for example by Lemma \ref{lemma-already-torsion}).
For $f \in A$, $f \not \in \mathfrak p$ the spectral sequence of Dualizing Complexes, Lemma \ref{dualizing-lemma-local-cohomology-ss} degenerates to give short exact sequences $$ 0 \to H^1_{V(f)}(H^{i - 1}_{V(I)}(M)) \to H^i_{V((I, f))}(M) \to H^0_{V(f)}(H^i_{V(I)}(M)) \to 0 $$ This proves (1) and part (2) follows from this and Lemma \ref{lemma-multiplicative}. Part (3) is a formal consequence.
Proof of (1). Let $\xi \in H^i_{V(I)}(M)$. Since $A$ is Noetherian, there exists a largest ideal $I \subset I'' \subset I'$ such that $\xi$ is the image of some $\xi'' \in H^i_{V(I'')}(M)$. If $V(I'') = V(I')$, then we are done. If not, choose a generic point $\mathfrak p \in V(I'')$ not in $V(I')$. Then we have $H^i_{V(I'')}(M)_\mathfrak p = H^i_{\mathfrak pA_\mathfrak p}(M_\mathfrak p) = 0$ by assumption. By Lemma \ref{lemma-elements-come-from-bigger} we can increase $I''$ which contradicts maximality. \medskip\noindent Proof of (2). Let $\xi' \in H^i_{V(I')}(M)$ be in the kernel of $\Psi$. Since $A$ is Noetherian, there exists a largest ideal $I \subset I'' \subset I'$ such that $\xi'$ maps to zero in $H^i_{V(I'')}(M)$. If $V(I'') = V(I')$, then we are done. If not, then choose a generic point $\mathfrak p  \in V(I'')$ not in $V(I')$. Then we have $H^{i - 1}_{V(I'')}(M)_\mathfrak p = H^{i - 1}_{\mathfrak pA_\mathfrak p}(M_\mathfrak p) = 0$ by assumption. By Lemma \ref{lemma-elements-come-from-bigger} we can increase $I''$ which contradicts maximality. \medskip\noindent Part (3) is formal from parts (1) and (2).
Let $U$ be the punctured spectrum of $A$. If $U$ is disconnected then we see that $\Gamma(U, \mathcal{O}_U)$ has a nontrivial idempotent. But $A$, being local, does not have a nontrivial idempotent. Hence $A \to \Gamma(U, \mathcal{O}_U)$ is not an isomorphism. By Lemma \ref{lemma-local-cohomology} we conclude that either $H^0_\mathfrak m(A)$ or $H^1_\mathfrak m(A)$ is nonzero. Thus $\text{depth}(A) \leq 1$ by Dualizing Complexes, Lemma \ref{dualizing-lemma-depth}. To see the result for $A^h$ and $A^{sh}$ use More on Algebra, Lemma \ref{more-algebra-lemma-henselization-depth}.
Set $X = \Spec(A)$. Say $d = \dim(A) = \dim(X)$. Inside $X$ consider the union $X_1$ of the irreducible components of dimension $d$ and the union $X_2$ of the irreducible components of dimension $< d$. Of course $X = X_1 \cup X_2$. If $X_2 = \emptyset$, then the lemma holds. If not, then $Z = X_1 \cap X_2$ is a nonempty closed subset of $X$ because it contains at least the closed point of $X$. Hence we can choose a generic point $z \in Z$ of an irreducible component of $Z$. Recall that the spectrum of $\mathcal{O}_{Z, z}$ is the set of points of $X$ specializing to $z$. Since $z$ is both contained in an irreducible component of dimension $d$ and in an irreducible component of dimension $< d$ we obtain nontrivial specializations $x_1 \leadsto z$ and $x_2 \leadsto z$ such that the closures of $x_1$ and $x_2$ have different dimensions. Since $X$ is catenary, this can only happen if at least one of the specializations $x_1 \leadsto z$ and $x_2 \leadsto z$ is not immediate! Thus $\dim(\mathcal{O}_{Z, z}) \geq 2$. Therefore $\text{depth}(\mathcal{O}_{Z, z}) \geq 2$ because $A$ is $(S_2)$. However, the punctured spectrum $U$ of $\mathcal{O}_{Z, z}$ is disconnected because the closed subsets $U \cap X_1$ and $U \cap X_2$ are disjoint (by our choice of $z$) and cover $U$. This is a contradiction with Lemma \ref{lemma-depth-2-connected-punctured-spectrum} and the proof is complete.
Observe that $R\Gamma_Y(-)$ has finite cohomological dimension by Dualizing Complexes, Lemma \ref{dualizing-lemma-local-cohomology-adjoint} for example. Hence there exists an integer $i_0$ such that $H^i_Y(M) = 0$ for all $A$-modules $M$ and $i \geq i_0$. \medskip\noindent Let us prove that (1) and (2) are equivalent. It is immediate that (2) implies (1). Assume (1). By descending induction on $i > d$ we will show that $H^i_Y(M) = 0$ for all $A$-modules $M$. For $i \geq i_0$ we have seen this above. To do the induction step, let $i_0 > i > d$. Choose any $A$-module $M$ and fit it into a short exact sequence $0 \to N \to F \to M \to 0$ where $F$ is a free $A$-module. Since $R\Gamma_Y$ is a right adjoint, we see that $H^i_Y(-)$ commutes with direct sums. Hence $H^i_Y(F) = 0$ as $i > d$ by assumption (1). Then we see that $H^i_Y(M) = H^{i + 1}_Y(N) = 0$ as desired. \medskip\noindent Assume $d = -1$ and (2) holds. Then $0 = H^0_Y(A/I) = A/I \Rightarrow A = I \Rightarrow Y = \emptyset$. Thus (3) holds. We omit the proof of the converse. \medskip\noindent Assume $d = 0$ and (2) holds. Set $J = H^0_I(A) = \{x \in A \mid I^nx = 0 \text{ for some }n > 0\}$. Then $$ H^1_Y(A) = \Coker(A \to \Gamma(X \setminus Y, \mathcal{O}_{X \setminus Y})) \quad\text{and}\quad H^1_Y(I) = \Coker(I \to \Gamma(X \setminus Y, \mathcal{O}_{X \setminus Y})) $$ and the kernel of the first map is equal to $J$. See Lemma \ref{lemma-local-cohomology}. We conclude from (2) that $I(A/J) = A/J$. Thus we may pick $f \in I$ mapping to $1$ in $A/J$. Then $1 - f \in J$ so $I^n(1 - f) = 0$ for some $n > 0$. Hence $f^n = f^{n + 1}$. Then $e = f^n \in I$ is an idempotent. Consider the complementary idempotent $e' = 1 - f^n \in J$. For any element $g \in I$ we have $g^m e' = 0$ for some $m > 0$. Thus $I$ is contained in the radical of ideal $(e) \subset I$. This means $Y = V(I) = V(e)$ is open and closed in $X$ as predicted in (3). Conversely, if $Y = V(I)$ is open and closed, then the functor $H^0_Y(-)$ is exact and has vanshing higher derived functors. \medskip\noindent If $d > 0$, then we see immediately from Lemma \ref{lemma-local-cohomology} that (2) is equivalent to (3).
The explicit description for $R\Gamma_Y(-)$ given in Dualizing Complexes, Lemma \ref{dualizing-lemma-local-cohomology-adjoint} shows that (1) is true. We can deduce (2) from (1) using the fact that $R\Gamma_Z$ depends only on the closed subset $Z$ and not on the choice of the finitely generated ideal $I \subset A$ with $V(I) = Z$. This follows either from the construction of local cohomology in Dualizing Complexes, Section \ref{dualizing-section-local-cohomology} combined with More on Algebra, Lemma \ref{more-algebra-lemma-local-cohomology-closed} or it follows from Lemma \ref{lemma-local-cohomology-is-local-cohomology}. To see (3) we use Lemma \ref{lemma-cd} and the vanishing result of Cohomology of Schemes, Lemma \ref{coherent-lemma-vanishing-nr-affines}.