# The Stacks Project

## Tag 0AB8

### 39.14. Finite groupoids

A groupoid scheme $(U, R, s, t, c)$ is sometimes called finite if the morphisms $s$ and $t$ are finite. This is potentially confusing as it doesn't imply that $U$ or $R$ or the quotient sheaf $U/R$ are finite over anything.

Lemma 39.14.1. Let $(U, R, s, t, c)$ be a groupoid scheme over a scheme $S$. Assume $s, t$ are finite. There exists a sequence of $R$-invariant closed subschemes $$U = Z_0 \supset Z_1 \supset Z_2 \supset \ldots$$ such that $\bigcap Z_r = \emptyset$ and such that $s^{-1}(Z_{r - 1}) \setminus s^{-1}(Z_r) \to Z_{r - 1} \setminus Z_r$ is finite locally free of rank $r$.

Proof. Let $\{Z_r\}$ be the stratification of $U$ given by the Fitting ideals of the finite type quasi-coherent modules $s_*\mathcal{O}_R$. See Divisors, Lemma 30.9.6. Since the identity $e : U \to R$ is a section to $s$ we see that $s_*\mathcal{O}_R$ contains $\mathcal{O}_S$ as a direct summand. Hence $U = Z_{-1} = Z_0$ (details omitted). Since formation of Fitting ideals commutes with base change (More on Algebra, Lemma 15.8.4) we find that $s^{-1}(Z_r)$ corresponds to the $r$th Fitting ideal of $\text{pr}_{1, *}\mathcal{O}_{R \times_{s, U, t} R}$ because the lower right square of diagram (39.3.0.1) is cartesian. Using the fact that the lower left square is also cartesian we conclude that $s^{-1}(Z_r) = t^{-1}(Z_r)$, in other words $Z_r$ is $R$-invariant. The morphism $s^{-1}(Z_{r - 1}) \setminus s^{-1}(Z_r) \to Z_{r - 1} \setminus Z_r$ is finite locally free of rank $r$ because the module $s_*\mathcal{O}_R$ pulls back to a finite locally free module of rank $r$ on $Z_{r - 1} \setminus Z_r$ by Divisors, Lemma 30.9.6. $\square$

Lemma 39.14.2. Let $(U, R, s, t, c)$ be a groupoid scheme over a scheme $S$. Assume $s, t$ are finite. There exists an open subscheme $W \subset U$ and a closed subscheme $W' \subset W$ such that

1. $W$ and $W'$ are $R$-invariant,
2. $U = t(s^{-1}(\overline{W}))$ set theoretically,
3. $W$ is a thickening of $W'$, and
4. the maps $s'$, $t'$ of the restriction $(W', R', s', t', c')$ are finite locally free.

Proof. Consider the stratification $U = Z_0 \supset Z_1 \supset Z_2 \supset \ldots$ of Lemma 39.14.1.

We will construct disjoint unions $W = \coprod_{r \geq 1} W_r$ and $W' = \coprod_{r \geq 1} W'_r$ with each $W'_r \to W_r$ a thickening of $R$-invariant subschemes of $U$ such that the morphisms $s_r', t_r'$ of the restrictions $(W_r', R_r', s_r', t_r', c_r')$ are finite locally free of rank $r$. To begin we set $W_1 = W'_1 = U \setminus Z_1$. This is an $R$-invariant open subscheme of $U$, it is true that $W_0$ is a thickening of $W'_0$, and the maps $s_1'$, $t_1'$ of the restriction $(W_1', R_1', s_1', t_1', c_1')$ are isomorphisms, i.e., finite locally free of rank $1$. Moreover, every point of $U \setminus Z_1$ is in $t(s^{-1}(\overline{W_1}))$.

Assume we have found subschemes $W'_r \subset W_r \subset U$ for $r \leq n$ such that

1. $W_1, \ldots, W_n$ are disjoint,
2. $W_r$ and $W_r'$ are $R$-invariant,
3. $U \setminus Z_n \subset \bigcup_{r \leq n} t(s^{-1}(\overline{W_r}))$ set theoretically,
4. $W_r$ is a thickening of $W'_r$,
5. the maps $s_r'$, $t_r'$ of the restriction $(W_r', R_r', s_r', t_r', c_r')$ are finite locally free of rank $r$.

Then we set $$W_{n + 1} = Z_n \setminus \left( Z_{n + 1} \cup \bigcup\nolimits_{r \leq n} t(s^{-1}(\overline{W_r})) \right)$$ set theoretically and $$W'_{n + 1} = Z_n \setminus \left( Z_{n + 1} \cup \bigcup\nolimits_{r \leq n} t(s^{-1}(\overline{W_r})) \right)$$ scheme theoretically. Then $W_{n + 1}$ is an $R$-invariant open subscheme of $U$ because $Z_{n + 1} \setminus \overline{U \setminus Z_{n + 1}}$ is open in $U$ and $\overline{U \setminus Z_{n + 1}}$ is contained in the closed subset $\bigcup\nolimits_{r \leq n} t(s^{-1}(\overline{W_r}))$ we are removing by property (3) and the fact that $t$ is a closed morphism. It is clear that $W'_{n + 1}$ is a closed subscheme of $W_{n + 1}$ with the same underlying topological space. Finally, properties (1), (2) and (3) are clear and property (5) follows from Lemma 39.14.1.

By Lemma 39.14.1 we have $\bigcap Z_r = \emptyset$. Hence every point of $U$ is contained in $U \setminus Z_n$ for some $n$. Thus we see that $U = \bigcup_{r \geq 1} t(s^{-1}(\overline{W_r}))$ set theoretically and we see that (2) holds. Thus $W' \subset W$ satisfy (1), (2), (3), and (4). $\square$

Let $(U, R, s, t, c)$ be a groupoid scheme. Given a point $u \in U$ the $R$-orbit of $u$ is the subset $t(s^{-1}(\{u\}))$ of $U$.

Lemma 39.14.3. In Lemma 39.14.2 assume in addition that $s$ and $t$ are of finite presentation. Then

1. the morphism $W' \to W$ is of finite presentation, and
2. if $u \in U$ is a point whose $R$-orbit consists of generic points of irreducible components of $U$, then $u \in W$.

Proof. In this case the stratification $U = Z_0 \supset Z_1 \supset Z_2 \supset \ldots$ of Lemma 39.14.1 is given by closed immersions $Z_k \to U$ of finite presentation, see Divisors, Lemma 30.9.6. Part (1) follows immediately from this as $W' \to W$ is locally given by intersecting the open $W$ by $Z_r$. To see part (2) let $\{u_1, \ldots, u_n\}$ be the orbit of $u$. Since the closed subschemes $Z_k$ are $R$-invariant and $\bigcap Z_k = \emptyset$, we find an $k$ such that $u_i \in Z_k$ and $u_i \not \in Z_{k + 1}$ for all $i$. The image of $Z_k \to U$ and $Z_{k + 1} \to U$ is locally constructible (Morphisms, Theorem 28.21.3). Since $u_i \in U$ is a generic point of an irreducible component of $U$, there exists an open neighbourhood $U_i$ of $u_i$ which is contained in $Z_k \setminus Z_{k + 1}$ set theoretically (Properties, Lemma 27.2.2). In the proof of Lemma 39.14.2 we have constructed $W$ as a disjoint union $\coprod W_r$ with $W_r \subset Z_{r - 1} \setminus Z_r$ such that $U = \bigcup t(s^{-1}(\overline{W_r}))$. As $\{u_1, \ldots, u_n\}$ is an $R$-orbit we see that $u \in t(s^{-1}(\overline{W_r}))$ implies $u_i \in \overline{W_r}$ for some $i$ which implies $U_i \cap W_r \not = \emptyset$ which implies $r = k$. Thus we conclude that $u$ is in $$W_{k + 1} = Z_k \setminus \left( Z_{k + 1} \cup \bigcup\nolimits_{r \leq k} t(s^{-1}(\overline{W_r})) \right)$$ as desired. $\square$

Lemma 39.14.4. Let $(U, R, s, t, c)$ be a groupoid scheme over a scheme $S$. Assume $s, t$ are finite and of finite presentation and $U$ quasi-separated. Let $u_1, \ldots, u_m \in U$ be points whose orbits consist of generic points of irreducible components of $U$. Then there exist $R$-invariant subschemes $V' \subset V \subset U$ such that

1. $u_1, \ldots, u_m \in V'$,
2. $V$ is open in $U$,
3. $V'$ and $V$ are affine,
4. $V' \subset V$ is a thickening of finite presentation,
5. the morphisms $s', t'$ of the restriction $(V', R', s', t', c')$ are finite locally free.

Proof. Let $W' \subset W \subset U$ be as in Lemma 39.14.2. By Lemma 39.14.3 we get $u_j \in W$ and that $W' \to W$ is a thickening of finite presentation. By Limits, Lemma 31.11.3 it suffices to find an $R$-invariant affine open subscheme $V'$ of $W'$ containing $u_j$ (because then we can let $V \subset W$ be the corresponding open subscheme which will be affine). Thus we may replace $(U, R, s, t, c)$ by the restriction $(W', R', s', t', c')$ to $W'$. In other words, we may assume we have a groupoid scheme $(U, R, s, t, c)$ whose morphisms $s$ and $t$ are finite locally free. By Properties, Lemma 27.29.1 we can find an affine open containing the union of the orbits of $u_1, \ldots, u_m$. Finally, we can apply Groupoids, Lemma 38.24.1 to conclude. $\square$

The following lemma is a special case of Lemma 39.14.4 but we redo the argument as it is slightly easier in this case (it avoids using Lemma 39.14.3).

Lemma 39.14.5. Let $(U, R, s, t, c)$ be a groupoid scheme over a scheme $S$. Assume $s, t$ finite, $U$ is locally Noetherian, and $u_1, \ldots, u_m \in U$ points whose orbits consist of generic points of irreducible components of $U$. Then there exist $R$-invariant subschemes $V' \subset V \subset U$ such that

1. $u_1, \ldots, u_m \in V'$,
2. $V$ is open in $U$,
3. $V'$ and $V$ are affine,
4. $V' \subset V$ is a thickening,
5. the morphisms $s', t'$ of the restriction $(V', R', s', t', c')$ are finite locally free.

Proof. Let $\{u_{j1}, \ldots, u_{jn_j}\}$ be the orbit of $u_j$. Let $W' \subset W \subset U$ be as in Lemma 39.14.2. Since $U = t(s^{-1}(\overline{W}))$ we see that at least one $u_{ji} \in \overline{W}$. Since $u_{ji}$ is a generic point of an irreducible component and $U$ locally Noetherian, this implies that $u_{ji} \in W$. Since $W$ is $R$-invariant, we conclude that $u_j \in W$ and in fact the whole orbit is contained in $W$. By Cohomology of Schemes, Lemma 29.13.3 it suffices to find an $R$-invariant affine open subscheme $V'$ of $W'$ containing $u_1, \ldots, u_m$ (because then we can let $V \subset W$ be the corresponding open subscheme which will be affine). Thus we may replace $(U, R, s, t, c)$ by the restriction $(W', R', s', t', c')$ to $W'$. In other words, we may assume we have a groupoid scheme $(U, R, s, t, c)$ whose morphisms $s$ and $t$ are finite locally free. By Properties, Lemma 27.29.1 we can find an affine open containing $\{u_{ij}\}$ (a locally Noetherian scheme is quasi-separated by Properties, Lemma 27.5.4). Finally, we can apply Groupoids, Lemma 38.24.1 to conclude. $\square$

Lemma 39.14.6. Let $(U, R, s, t, c)$ be a groupoid scheme over a scheme $S$ with $s, t$ integral. Let $g : U' \to U$ be an integral morphism such that every $R$-orbit in $U$ meets $g(U')$. Let $(U', R', s', t', c')$ be the restriction of $R$ to $U'$. If $u' \in U'$ is contained in an $R'$-invariant affine open, then the image $u \in U$ is contained in an $R$-invariant affine open of $U$.

Proof. Let $W' \subset U'$ be an $R'$-invariant affine open. Set $\tilde R = U' \times_{g, U, t} R$ with maps $\text{pr}_0 : \tilde R \to U'$ and $h = s \circ \text{pr}_1 : \tilde R \to U$. Observe that $\text{pr}_0$ and $h$ are integral. It follows that $\tilde W = \text{pr}_0^{-1}(W')$ is affine. Since $W'$ is $R'$-invariant, the image $W = h(\tilde W)$ is set theoretically $R$-invariant and $\tilde W = h^{-1}(W)$ set theoretically (details omitted). Thus, if we can show that $W$ is open, then $W$ is a scheme and the morphism $\tilde W \to W$ is integral surjective which implies that $W$ is affine by Limits, Proposition 31.11.2. However, our assumption on orbits meeting $U'$ implies that $h : \tilde R \to U$ is surjective. Since an integral surjective morphism is submersive (Topology, Lemma 5.6.5 and Morphisms, Lemma 28.42.7) it follows that $W$ is open. $\square$

The following technical lemma produces ''almost'' invariant functions in the situation of a finite groupoid on a quasi-affine scheme.

Lemma 39.14.7. Let $(U, R, s, t, c)$ be a groupoid scheme with $s, t$ finite and of finite presentation. Let $u_1, \ldots, u_m \in U$ be points whose $R$-orbits consist of generic points of irreducible components of $U$. Let $j : U \to \mathop{\rm Spec}(A)$ be an immersion. Let $I \subset A$ be an ideal such that $j(U) \cap V(I) = \emptyset$ and $V(I) \cup j(U)$ is closed in $\mathop{\rm Spec}(A)$. Then there exists an $h \in I$ such that $j^{-1}D(h)$ is an $R$-invariant affine open subscheme of $U$ containing $u_1, \ldots, u_m$.

Proof. Let $u_1, \ldots, u_m \in V' \subset V \subset U$ be as in Lemma 39.14.4. Since $U \setminus V$ is closed in $U$, $j$ an immersion, and $V(I) \cup j(U)$ is closed in $\mathop{\rm Spec}(A)$, we can find an ideal $J \subset I$ such that $V(J) = V(I) \cup j(U \setminus V)$. For example we can take the ideal of elements of $I$ which vanish on $j(U \setminus V)$. Thus we can replace $(U, R, s, t, c)$, $j : U \to \mathop{\rm Spec}(A)$, and $I$ by $(V', R', s', t', c')$, $j|_{V'} : V' \to \mathop{\rm Spec}(A)$, and $J$. In other words, we may assume that $U$ is affine and that $s$ and $t$ are finite locally free. Take any $f \in I$ which does not vanish at all the points in the $R$-orbits of $u_1, \ldots, u_m$ (Algebra, Lemma 10.14.2). Consider $$g = \text{Norm}_s(t^\sharp(j^\sharp(f))) \in \Gamma(U, \mathcal{O}_U)$$ Since $f \in I$ and since $V(I) \cup j(U)$ is closed we see that $U \cap D(f) \to D(f)$ is a closed immersion. Hence $f^ng$ is the image of an element $h \in I$ for some $n > 0$. We claim that $h$ works. Namely, we have seen in Groupoids, Lemma 38.23.2 that $g$ is an $R$-invariant function, hence $D(g) \subset U$ is $R$-invariant. Since $f$ does not vanish on the orbit of $u_j$, the function $g$ does not vanish at $u_j$. Moreover, we have $V(g) \supset V(j^\sharp(f))$ and hence $j^{-1}D(h) = D(g)$. $\square$

Lemma 39.14.8. Let $(U, R, s, t, c)$ be a groupoid scheme. If $s, t$ are finite, and $u, u' \in R$ are distinct points in the same orbit, then $u'$ is not a specialization of $u$.

Proof. Let $r \in R$ with $s(r) = u$ and $t(r) = u'$. If $u \leadsto u'$ then we can find a nontrivial specialization $r \leadsto r'$ with $s(r') = u'$, see Schemes, Lemma 25.19.8. Set $u'' = t(r')$. Note that $u'' \not = u'$ as there are no specializations in the fibres of a finite morphism. Hence we can continue and find a nontrivial specialization $r' \leadsto r''$ with $s(r'') = u''$, etc. This shows that the orbit of $u$ contains an infinite sequence $u \leadsto u' \leadsto u'' \leadsto \ldots$ of specializations which is nonsense as the orbit $t(s^{-1}(\{u\}))$ is finite. $\square$

Lemma 39.14.9. Let $j : V \to \mathop{\rm Spec}(A)$ be a quasi-compact immersion of schemes. Let $f \in A$ be such that $j^{-1}D(f)$ is affine and $j(V) \cap V(f)$ is closed. Then $V$ is affine.

Proof. This follows from Morphisms, Lemma 28.11.14 but we will also give a direct proof. Let $A' = \Gamma(V, \mathcal{O}_V)$. Then $j' : V \to \mathop{\rm Spec}(A')$ is a quasi-compact open immersion, see Properties, Lemma 27.18.3. Let $f' \in A'$ be the image of $f$. Then $(j')^{-1}D(f') = j^{-1}D(f)$ is affine. On the other hand, $j'(V) \cap V(f')$ is a subscheme of $\mathop{\rm Spec}(A')$ which maps isomorphically to the closed subscheme $j(V) \cap V(f)$ of $\mathop{\rm Spec}(A)$. Hence it is closed in $\mathop{\rm Spec}(A')$ for example by Schemes, Lemma 25.21.12. Thus we may replace $A$ by $A'$ and assume that $j$ is an open immersion and $A = \Gamma(V, \mathcal{O}_V)$.

In this case we claim that $j(V) = \mathop{\rm Spec}(A)$ which finishes the proof. If not, then we can find a principal affine open $D(g) \subset \mathop{\rm Spec}(A)$ which meets the complement and avoids the closed subset $j(V) \cap V(f)$. Note that $j$ maps $j^{-1}D(f)$ isomorphically onto $D(f)$, see Properties, Lemma 27.18.2. Hence $D(g)$ meets $V(f)$. On the other hand, $j^{-1}D(g)$ is a principal open of the affine open $j^{-1}D(f)$ hence affine. Hence by Properties, Lemma 27.18.2 again we see that $D(g)$ is isomorphic to $j^{-1}D(g) \subset j^{-1}D(f)$ which implies that $D(g) \subset D(f)$. This contradiction finishes the proof. $\square$

Lemma 39.14.10. Let $(U, R, s, t, c)$ be a groupoid scheme. Let $u \in U$. Assume

1. $s, t$ are finite morphisms,
2. $U$ is separated and locally Noetherian,
3. $\dim(\mathcal{O}_{U, u'}) \leq 1$ for every point $u'$ in the orbit of $u$.

Then $u$ is contained in an $R$-invariant affine open of $U$.

Proof. The $R$-orbit of $u$ is finite. By conditions (2) and (3) it is contained in an affine open $U'$ of $U$, see Varieties, Proposition 32.41.7. Then $t(s^{-1}(U \setminus U'))$ is an $R$-invariant closed subset of $U$ which does not contain $u$. Thus $U \setminus t(s^{-1}(U \setminus U'))$ is an $R$-invariant open of $U'$ containing $u$. Replacing $U$ by this open we may assume $U$ is quasi-affine.

By Lemma 39.14.6 we may replace $U$ by its reduction and assume $U$ is reduced. This means $R$-invariant subschemes $W' \subset W \subset U$ of Lemma 39.14.2 are equal $W' = W$. As $U = t(s^{-1}(\overline{W}))$ some point $u'$ of the $R$-orbit of $u$ is contained in $\overline{W}$ and by Lemma 39.14.6 we may replace $U$ by $\overline{W}$ and $u$ by $u'$. Hence we may assume there is a dense open $R$-invariant subscheme $W \subset U$ such that the morphisms $s_W, t_W$ of the restriction $(W, R_W, s_W, t_W, c_W)$ are finite locally free.

If $u \in W$ then we are done by Groupoids, Lemma 38.24.1 (because $W$ is quasi-affine so any finite set of points of $W$ is contained in an affine open, see Properties, Lemma 27.29.5). Thus we assume $u \not \in W$ and hence none of the points of the orbit of $u$ is in $W$. Let $\xi \in U$ be a point with a nontrivial specialization to a point $u'$ in the orbit of $u$. Since there are no specializations among the points in the orbit of $u$ (Lemma 39.14.8) we see that $\xi$ is not in the orbit. By assumption (3) we see that $\xi$ is a generic point of $U$ and hence $\xi \in W$. As $U$ is Noetherian there are finitely many of these points $\xi_1, \ldots, \xi_m \in W$. Because $s_W, t_W$ are flat the orbit of each $\xi_j$ consists of generic points of irreducible components of $W$ (and hence $U$).

Let $j : U \to \mathop{\rm Spec}(A)$ be an immersion of $U$ into an affine scheme (this is possible as $U$ is quasi-affine). Let $J \subset A$ be an ideal such that $V(J) \cap j(W) = \emptyset$ and $V(J) \cup j(W)$ is closed. Apply Lemma 39.14.7 to the groupoid scheme $(W, R_W, s_W, t_W, c_W)$, the morphism $j|_W : W \to \mathop{\rm Spec}(A)$, the points $\xi_j$, and the ideal $J$ to find an $f \in J$ such that $(j|_W)^{-1}D(f)$ is an $R_W$-invariant affine open containing $\xi_j$ for all $j$. Since $f \in J$ we see that $j^{-1}D(f) \subset W$, i.e., $j^{-1}D(f)$ is an $R$-invariant affine open of $U$ contained in $W$ containing all $\xi_j$.

Let $Z$ be the reduced induced closed subscheme structure on $$U \setminus j^{-1}D(f) = j^{-1}V(f).$$ Then $Z$ is set theoretically $R$-invariant (but it may not be scheme theoretically $R$-invariant). Let $(Z, R_Z, s_Z, t_Z, c_Z)$ be the restriction of $R$ to $Z$. Since $Z \to U$ is finite, it follows that $s_Z$ and $t_Z$ are finite. Since $u \in Z$ the orbit of $u$ is in $Z$ and agrees with the $R_Z$-orbit of $u$ viewed as a point of $Z$. Since $\dim(\mathcal{O}_{U, u'}) \leq 1$ and since $\xi_j \not \in Z$ for all $j$, we see that $\dim(\mathcal{O}_{Z, u'}) \leq 0$ for all $u'$ in the orbit of $u$. In other words, the $R_Z$-orbit of $u$ consists of generic points of irreducible components of $Z$.

Let $I \subset A$ be an ideal such that $V(I) \cap j(U) =\emptyset$ and $V(I) \cup j(U)$ is closed. Apply Lemma 39.14.7 to the groupoid scheme $(Z, R_Z, s_Z, t_Z, c_Z)$, the restriction $j|_Z$, the ideal $I$, and the point $u \in Z$ to obtain $h \in I$ such that $j^{-1}D(h) \cap Z$ is an $R_Z$-invariant open affine containing $u$.

Consider the $R_W$-invariant (Groupoids, Lemma 38.23.2) function $$g = \text{Norm}_{s_W}(t_W^\sharp(j^\sharp(h)|_W)) \in \Gamma(W, \mathcal{O}_W)$$ (In the following we only need the restriction of $g$ to $j^{-1}D(f)$ and in this case the norm is along a finite locally free morphism of affines.) We claim that $$V = (W_g \cap j^{-1}D(f)) \cup (j^{-1}D(h) \cap Z)$$ is an $R$-invariant affine open of $U$ which finishes the proof of the lemma. It is set theoretically $R$-invariant by construction. As $V$ is a constuctible set, to see that it is open it suffices to show it is closed under generalization in $U$ (Topology, Lemma 5.19.9 or the more general Topology, Lemma 5.23.5). Since $W_g \cap j^{-1}D(f)$ is open in $U$, it suffices to consider a specialization $u_1 \leadsto u_2$ of $U$ with $u_2 \in j^{-1}D(h) \cap Z$. This means that $h$ is nonzero in $j(u_2)$ and $u_2 \in Z$. If $u_1 \in Z$, then $j(u_1) \leadsto j(u_2)$ and since $h$ is nonzero in $j(u_2)$ it is nonzero in $j(u_1)$ which implies $u_1 \in V$. If $u_1 \not \in Z$ and also not in $W_g \cap j^{-1}D(f)$, then $u_1 \in W$, $u_1 \not \in W_g$ because the complement of $Z = j^{-1}V(f)$ is contained in $W \cap j^{-1}D(f)$. Hence there exists a point $r_1 \in R$ with $s(r_1) = u_1$ such that $h$ is zero in $t(r_1)$. Since $s$ is finite we can find a specialization $r_1 \leadsto r_2$ with $s(r_2) = u_2$. However, then we conclude that $f$ is zero in $u'_2 = t(r_2)$ which contradicts the fact that $j^{-1}D(h) \cap Z$ is $R$-invariant and $u_2$ is in it. Thus $V$ is open.

Observe that $V \subset j^{-1}D(h)$ for our function $h \in I$. Thus we obtain an immersion $$j' : V \longrightarrow \mathop{\rm Spec}(A_h)$$ Let $f' \in A_h$ be the image of $f$. Then $(j')^{-1}D(f')$ is the principal open determined by $g$ in the affine open $j^{-1}D(f)$ of $U$. Hence $(j')^{-1}D(f)$ is affine. Finally, $j'(V) \cap V(f') = j'(j^{-1}D(h) \cap Z)$ is closed in $\mathop{\rm Spec}(A_h/(f')) = \mathop{\rm Spec}((A/f)_h) = D(h) \cap V(f)$ by our choice of $h \in I$ and the ideal $I$. Hence we can apply Lemma 39.14.9 to conclude that $V$ is affine as claimed above. $\square$

The code snippet corresponding to this tag is a part of the file more-groupoids.tex and is located in lines 2412–2957 (see updates for more information).

\section{Finite groupoids}
\label{section-finite-groupoids}

\noindent
A groupoid scheme $(U, R, s, t, c)$ is sometimes called {\it finite} if the
morphisms $s$ and $t$ are finite. This is potentially confusing as it doesn't
imply that $U$ or $R$ or the quotient sheaf $U/R$ are finite over anything.

\begin{lemma}
\label{lemma-finite-stratify}
Let $(U, R, s, t, c)$ be a groupoid scheme over a scheme $S$. Assume $s, t$
are finite. There exists a sequence of $R$-invariant closed subschemes
$$U = Z_0 \supset Z_1 \supset Z_2 \supset \ldots$$
such that $\bigcap Z_r = \emptyset$ and such that
$s^{-1}(Z_{r - 1}) \setminus s^{-1}(Z_r) \to Z_{r - 1} \setminus Z_r$
is finite locally free of rank $r$.
\end{lemma}

\begin{proof}
Let $\{Z_r\}$ be the stratification of $U$ given by the Fitting ideals
of the finite type quasi-coherent modules $s_*\mathcal{O}_R$. See
Divisors, Lemma \ref{divisors-lemma-locally-free-rank-r-pullback}.
Since the identity $e : U \to R$ is a section to $s$ we see that
$s_*\mathcal{O}_R$ contains $\mathcal{O}_S$ as a direct summand.
Hence $U = Z_{-1} = Z_0$ (details omitted).
Since formation of Fitting ideals commutes with base change
(More on Algebra, Lemma \ref{more-algebra-lemma-fitting-ideal-basics})
we find that $s^{-1}(Z_r)$ corresponds to the $r$th Fitting ideal
of $\text{pr}_{1, *}\mathcal{O}_{R \times_{s, U, t} R}$ because
the lower right square of diagram (\ref{equation-diagram}) is cartesian.
Using the fact that the lower left square is also cartesian we conclude
that $s^{-1}(Z_r) = t^{-1}(Z_r)$, in other words $Z_r$ is $R$-invariant.
The morphism
$s^{-1}(Z_{r - 1}) \setminus s^{-1}(Z_r) \to Z_{r - 1} \setminus Z_r$
is finite locally free of rank $r$ because the module
$s_*\mathcal{O}_R$ pulls back to a finite locally free module of rank $r$
on $Z_{r - 1} \setminus Z_r$ by
Divisors, Lemma \ref{divisors-lemma-locally-free-rank-r-pullback}.
\end{proof}

\begin{lemma}
\label{lemma-finite-flat-over-almost-dense-subscheme}
Let $(U, R, s, t, c)$ be a groupoid scheme over a scheme $S$. Assume $s, t$
are finite. There exists an open subscheme $W \subset U$ and a closed
subscheme $W' \subset W$ such that
\begin{enumerate}
\item $W$ and $W'$ are $R$-invariant,
\item $U = t(s^{-1}(\overline{W}))$ set theoretically,
\item $W$ is a thickening of $W'$, and
\item the maps $s'$, $t'$ of the restriction $(W', R', s', t', c')$
are finite locally free.
\end{enumerate}
\end{lemma}

\begin{proof}
Consider the stratification $U = Z_0 \supset Z_1 \supset Z_2 \supset \ldots$
of Lemma \ref{lemma-finite-stratify}.

\medskip\noindent
We will construct disjoint unions $W = \coprod_{r \geq 1} W_r$ and
$W' = \coprod_{r \geq 1} W'_r$ with each $W'_r \to W_r$ a thickening
of $R$-invariant subschemes of $U$ such that the morphisms
$s_r', t_r'$ of the restrictions $(W_r', R_r', s_r', t_r', c_r')$
are finite locally free of rank $r$. To begin we set
$W_1 = W'_1 = U \setminus Z_1$. This is an $R$-invariant open
subscheme of $U$, it is true that $W_0$ is a thickening of $W'_0$,
and the maps $s_1'$, $t_1'$ of the
restriction $(W_1', R_1', s_1', t_1', c_1')$ are isomorphisms, i.e.,
finite locally free of rank $1$.
Moreover, every point of $U \setminus Z_1$ is in $t(s^{-1}(\overline{W_1}))$.

\medskip\noindent
Assume we have found subschemes $W'_r \subset W_r \subset U$ for $r \leq n$
such that
\begin{enumerate}
\item $W_1, \ldots, W_n$ are disjoint,
\item $W_r$ and $W_r'$ are $R$-invariant,
\item $U \setminus Z_n \subset \bigcup_{r \leq n} t(s^{-1}(\overline{W_r}))$
set theoretically,
\item $W_r$ is a thickening of $W'_r$,
\item the maps $s_r'$, $t_r'$ of the restriction
$(W_r', R_r', s_r', t_r', c_r')$ are finite locally free of rank $r$.
\end{enumerate}
Then we set
$$W_{n + 1} = Z_n \setminus \left( Z_{n + 1} \cup \bigcup\nolimits_{r \leq n} t(s^{-1}(\overline{W_r})) \right)$$
set theoretically and
$$W'_{n + 1} = Z_n \setminus \left( Z_{n + 1} \cup \bigcup\nolimits_{r \leq n} t(s^{-1}(\overline{W_r})) \right)$$
scheme theoretically. Then $W_{n + 1}$ is an $R$-invariant open subscheme
of $U$ because $Z_{n + 1} \setminus \overline{U \setminus Z_{n + 1}}$
is open in $U$ and $\overline{U \setminus Z_{n + 1}}$ is contained
in the closed subset $\bigcup\nolimits_{r \leq n} t(s^{-1}(\overline{W_r}))$
we are removing by property (3) and the fact that $t$ is a closed morphism.
It is clear that $W'_{n + 1}$ is a closed subscheme
of $W_{n + 1}$ with the same underlying topological space.
Finally, properties (1), (2) and (3) are clear and property (5) follows from
Lemma \ref{lemma-finite-stratify}.

\medskip\noindent
By Lemma \ref{lemma-finite-stratify} we have $\bigcap Z_r = \emptyset$.
Hence every point of $U$ is contained in $U \setminus Z_n$
for some $n$. Thus we see that
$U = \bigcup_{r \geq 1} t(s^{-1}(\overline{W_r}))$
set theoretically and we see that (2) holds.
Thus $W' \subset W$ satisfy (1), (2), (3), and (4).
\end{proof}

\noindent
Let $(U, R, s, t, c)$ be a groupoid scheme. Given a point $u \in U$
the {\it $R$-orbit} of $u$ is the subset $t(s^{-1}(\{u\}))$ of $U$.

\begin{lemma}
In Lemma \ref{lemma-finite-flat-over-almost-dense-subscheme}
assume in addition that $s$ and $t$ are of finite presentation.
Then
\begin{enumerate}
\item the morphism $W' \to W$ is of finite presentation, and
\item if $u \in U$ is a point whose $R$-orbit consists of
generic points of irreducible components of $U$, then $u \in W$.
\end{enumerate}
\end{lemma}

\begin{proof}
In this case the stratification
$U = Z_0 \supset Z_1 \supset Z_2 \supset \ldots$ of
Lemma \ref{lemma-finite-stratify} is given by closed immersions $Z_k \to U$
of finite presentation, see
Divisors, Lemma \ref{divisors-lemma-locally-free-rank-r-pullback}.
Part (1) follows immediately from this as $W' \to W$ is locally given
by intersecting the open $W$ by $Z_r$. To see part (2)
let $\{u_1, \ldots, u_n\}$ be the orbit of $u$.
Since the closed subschemes $Z_k$ are $R$-invariant and
$\bigcap Z_k = \emptyset$, we find an $k$ such that $u_i \in Z_k$
and $u_i \not \in Z_{k + 1}$ for all $i$.
The image of $Z_k \to U$ and $Z_{k + 1} \to U$ is locally constructible
(Morphisms, Theorem \ref{morphisms-theorem-chevalley}).
Since $u_i \in U$ is a generic point of an irreducible component
of $U$, there exists an open neighbourhood $U_i$ of $u_i$ which
is contained in $Z_k \setminus Z_{k + 1}$ set theoretically
(Properties, Lemma \ref{properties-lemma-generic-point-in-constructible}).
In the proof of Lemma \ref{lemma-finite-flat-over-almost-dense-subscheme}
we have constructed $W$ as a disjoint union $\coprod W_r$
with $W_r \subset Z_{r - 1} \setminus Z_r$ such that
$U = \bigcup t(s^{-1}(\overline{W_r}))$. As $\{u_1, \ldots, u_n\}$
is an $R$-orbit we see that $u \in t(s^{-1}(\overline{W_r}))$
implies $u_i \in \overline{W_r}$ for some $i$ which implies
$U_i \cap W_r \not = \emptyset$ which implies $r = k$.
Thus we conclude that $u$ is in
$$W_{k + 1} = Z_k \setminus \left( Z_{k + 1} \cup \bigcup\nolimits_{r \leq k} t(s^{-1}(\overline{W_r})) \right)$$
as desired.
\end{proof}

\begin{lemma}
\label{lemma-invariant-affine-open-around-generic-point}
Let $(U, R, s, t, c)$ be a groupoid scheme over a scheme $S$. Assume $s, t$
are finite and of finite presentation and $U$ quasi-separated. Let
$u_1, \ldots, u_m \in U$ be points whose orbits consist of generic points
of irreducible components of $U$. Then there exist $R$-invariant subschemes
$V' \subset V \subset U$ such that
\begin{enumerate}
\item $u_1, \ldots, u_m \in V'$,
\item $V$ is open in $U$,
\item $V'$ and $V$ are affine,
\item $V' \subset V$ is a thickening of finite presentation,
\item the morphisms $s', t'$ of the restriction $(V', R', s', t', c')$
are finite locally free.
\end{enumerate}
\end{lemma}

\begin{proof}
Let $W' \subset W \subset U$ be as in
Lemma \ref{lemma-finite-flat-over-almost-dense-subscheme}.
we get $u_j \in W$ and that $W' \to W$ is a thickening of finite presentation.
By Limits, Lemma \ref{limits-lemma-affines-glued-in-closed-affine}
it suffices to find an $R$-invariant affine open subscheme
$V'$ of $W'$ containing $u_j$ (because then we can let $V \subset W$
be the corresponding open subscheme which will be affine).
Thus we may replace $(U, R, s, t, c)$ by the restriction
$(W', R', s', t', c')$ to $W'$.
In other words, we may assume we have a groupoid scheme $(U, R, s, t, c)$
whose morphisms $s$ and $t$ are finite locally free.
By Properties, Lemma \ref{properties-lemma-maximal-points-affine}
we can find an affine open containing the union of the orbits of
$u_1, \ldots, u_m$. Finally, we can apply
Groupoids, Lemma \ref{groupoids-lemma-find-invariant-affine}
to conclude.
\end{proof}

\noindent
The following lemma is a special case of
Lemma \ref{lemma-invariant-affine-open-around-generic-point}
but we redo the argument as it is slightly easier in this case
(it avoids using

\begin{lemma}
\label{lemma-invariant-affine-open-around-generic-point-Noetherian}
Let $(U, R, s, t, c)$ be a groupoid scheme over a scheme $S$.
Assume $s, t$ finite, $U$ is locally Noetherian, and $u_1, \ldots, u_m \in U$
points whose orbits consist of generic points of irreducible
components of $U$. Then there exist $R$-invariant subschemes
$V' \subset V \subset U$ such that
\begin{enumerate}
\item $u_1, \ldots, u_m \in V'$,
\item $V$ is open in $U$,
\item $V'$ and $V$ are affine,
\item $V' \subset V$ is a thickening,
\item the morphisms $s', t'$ of the restriction $(V', R', s', t', c')$
are finite locally free.
\end{enumerate}
\end{lemma}

\begin{proof}
Let $\{u_{j1}, \ldots, u_{jn_j}\}$ be the orbit of $u_j$.
Let $W' \subset W \subset U$ be as in
Lemma \ref{lemma-finite-flat-over-almost-dense-subscheme}.
Since $U = t(s^{-1}(\overline{W}))$ we see that at least
one $u_{ji} \in \overline{W}$. Since $u_{ji}$ is a generic point
of an irreducible component and $U$ locally Noetherian,
this implies that $u_{ji} \in W$. Since $W$ is $R$-invariant, we
conclude that $u_j \in W$ and in fact the whole orbit is contained in $W$.
By Cohomology of Schemes, Lemma
\ref{coherent-lemma-image-affine-finite-morphism-affine-Noetherian}
it suffices to find an $R$-invariant affine open subscheme $V'$
of $W'$ containing $u_1, \ldots, u_m$ (because then we can let $V \subset W$
be the corresponding open subscheme which will be affine).
Thus we may replace $(U, R, s, t, c)$
by the restriction $(W', R', s', t', c')$ to $W'$.
In other words, we may assume we have a groupoid scheme $(U, R, s, t, c)$
whose morphisms $s$ and $t$ are finite locally free.
By Properties, Lemma \ref{properties-lemma-maximal-points-affine}
we can find an affine open containing $\{u_{ij}\}$
(a locally Noetherian scheme is quasi-separated by
Properties, Lemma \ref{properties-lemma-locally-Noetherian-quasi-separated}).
Finally, we can apply
Groupoids, Lemma \ref{groupoids-lemma-find-invariant-affine}
to conclude.
\end{proof}

\begin{lemma}
\label{lemma-find-affine-integral}
Let $(U, R, s, t, c)$ be a groupoid scheme over a scheme $S$
with $s, t$ integral. Let $g : U' \to U$ be an integral morphism
such that every $R$-orbit in $U$ meets $g(U')$. Let $(U', R', s', t', c')$
be the restriction of $R$ to $U'$. If $u' \in U'$ is contained in an
$R'$-invariant affine open, then the image $u \in U$ is contained
in an $R$-invariant affine open of $U$.
\end{lemma}

\begin{proof}
Let $W' \subset U'$ be an $R'$-invariant affine open.
Set $\tilde R = U' \times_{g, U, t} R$ with maps
$\text{pr}_0 : \tilde R \to U'$ and $h = s \circ \text{pr}_1 : \tilde R \to U$.
Observe that $\text{pr}_0$ and $h$ are integral.
It follows that $\tilde W = \text{pr}_0^{-1}(W')$ is affine.
Since $W'$ is $R'$-invariant, the image
$W = h(\tilde W)$ is set theoretically $R$-invariant and
$\tilde W = h^{-1}(W)$ set theoretically (details omitted).
Thus, if we can show that $W$ is open, then $W$ is a scheme
and the morphism $\tilde W \to W$ is integral surjective
which implies that $W$ is affine by
Limits, Proposition \ref{limits-proposition-affine}.
However, our assumption on orbits meeting $U'$ implies
that $h : \tilde R \to U$ is surjective. Since an
integral surjective morphism is submersive
(Topology, Lemma \ref{topology-lemma-closed-morphism-quotient-topology}
and Morphisms, Lemma \ref{morphisms-lemma-integral-universally-closed})
it follows that $W$ is open.
\end{proof}

\noindent
The following technical lemma produces almost'' invariant
functions in the situation of a finite groupoid on a quasi-affine
scheme.

\begin{lemma}
\label{lemma-find-almost-invariant-function}
Let $(U, R, s, t, c)$ be a groupoid scheme with $s, t$ finite and of
finite presentation. Let $u_1, \ldots, u_m \in U$ be points whose $R$-orbits
consist of generic points of irreducible components of $U$.
Let $j : U \to \Spec(A)$ be an immersion.
Let $I \subset A$ be an ideal such that $j(U) \cap V(I) = \emptyset$
and $V(I) \cup j(U)$ is closed in $\Spec(A)$.
Then there exists an $h \in I$ such that $j^{-1}D(h)$
is an $R$-invariant affine open subscheme of $U$ containing
$u_1, \ldots, u_m$.
\end{lemma}

\begin{proof}
Let $u_1, \ldots, u_m \in V' \subset V \subset U$ be as in
Lemma \ref{lemma-invariant-affine-open-around-generic-point}.
Since $U \setminus V$ is closed in $U$, $j$ an immersion, and $V(I) \cup j(U)$
is closed in $\Spec(A)$, we can find an ideal
$J \subset I$ such that $V(J) = V(I) \cup j(U \setminus V)$.
For example we can take the ideal of elements of $I$ which
vanish on $j(U \setminus V)$. Thus we can replace
$(U, R, s, t, c)$, $j : U \to \Spec(A)$, and $I$ by
$(V', R', s', t', c')$, $j|_{V'} : V' \to \Spec(A)$, and $J$.
In other words, we may assume that $U$ is affine and that
$s$ and $t$ are finite locally free.
Take any $f \in I$ which does not vanish at all the
points in the $R$-orbits of $u_1, \ldots, u_m$
(Algebra, Lemma \ref{algebra-lemma-silly}). Consider
$$g = \text{Norm}_s(t^\sharp(j^\sharp(f))) \in \Gamma(U, \mathcal{O}_U)$$
Since $f \in I$ and since $V(I) \cup j(U)$ is closed we see that
$U \cap D(f) \to D(f)$ is a closed immersion. Hence $f^ng$ is the
image of an element $h \in I$ for some $n > 0$. We claim that $h$ works.
Namely, we have seen in
Groupoids, Lemma \ref{groupoids-lemma-determinant-trick}
that $g$ is an $R$-invariant function, hence $D(g) \subset U$
is $R$-invariant. Since $f$ does not vanish on the orbit of $u_j$,
the function $g$ does not vanish at $u_j$. Moreover, we have
$V(g) \supset V(j^\sharp(f))$ and hence $j^{-1}D(h) = D(g)$.
\end{proof}

\begin{lemma}
\label{lemma-no-specializations-map-to-same-point}
Let $(U, R, s, t, c)$ be a groupoid scheme. If $s, t$ are finite,
and $u, u' \in R$ are distinct points in the same orbit,
then $u'$ is not a specialization of $u$.
\end{lemma}

\begin{proof}
Let $r \in R$ with $s(r) = u$ and $t(r) = u'$. If $u \leadsto u'$
then we can find a nontrivial specialization $r \leadsto r'$ with
$s(r') = u'$, see
Schemes, Lemma \ref{schemes-lemma-quasi-compact-closed}.
Set $u'' = t(r')$. Note that $u'' \not = u'$ as there are no
specializations in the fibres of a finite morphism.
Hence we can continue and find a nontrivial specialization
$r' \leadsto r''$ with $s(r'') = u''$, etc. This shows that the
orbit of $u$ contains an infinite sequence
$u \leadsto u' \leadsto u'' \leadsto \ldots$
of specializations which is nonsense as the orbit
$t(s^{-1}(\{u\}))$ is finite.
\end{proof}

\begin{lemma}
\label{lemma-get-affine}
Let $j : V \to \Spec(A)$ be a quasi-compact immersion of schemes.
Let $f \in A$ be such that $j^{-1}D(f)$ is affine and $j(V) \cap V(f)$
is closed. Then $V$ is affine.
\end{lemma}

\begin{proof}
This follows from Morphisms, Lemma \ref{morphisms-lemma-get-affine}
but we will also give a direct proof.
Let $A' = \Gamma(V, \mathcal{O}_V)$. Then $j' : V \to \Spec(A')$ is a
quasi-compact open immersion, see
Properties, Lemma \ref{properties-lemma-quasi-affine}.
Let $f' \in A'$ be the image of $f$. Then $(j')^{-1}D(f') = j^{-1}D(f)$
is affine. On the other hand, $j'(V) \cap V(f')$ is a subscheme of
$\Spec(A')$ which maps isomorphically to the closed subscheme
$j(V) \cap V(f)$ of $\Spec(A)$. Hence it is closed in $\Spec(A')$
for example by Schemes, Lemma \ref{schemes-lemma-section-immersion}.
Thus we may replace $A$ by $A'$ and assume that $j$ is an open immersion
and $A = \Gamma(V, \mathcal{O}_V)$.

\medskip\noindent
In this case we claim that $j(V) = \Spec(A)$ which finishes the proof.
If not, then we can find a principal affine open $D(g) \subset \Spec(A)$
which meets the complement and avoids the closed subset $j(V) \cap V(f)$.
Note that $j$ maps $j^{-1}D(f)$ isomorphically onto $D(f)$, see
Properties, Lemma \ref{properties-lemma-invert-f-affine}.
Hence $D(g)$ meets $V(f)$. On the other hand, $j^{-1}D(g)$
is a principal open of the affine open $j^{-1}D(f)$ hence affine.
Hence by
Properties, Lemma \ref{properties-lemma-invert-f-affine}
again we see that $D(g)$ is isomorphic to $j^{-1}D(g) \subset j^{-1}D(f)$
which implies that $D(g) \subset D(f)$. This contradiction finishes
the proof.
\end{proof}

\begin{lemma}
\label{lemma-find-affine-codimension-1}
Let $(U, R, s, t, c)$ be a groupoid scheme. Let $u \in U$. Assume
\begin{enumerate}
\item $s, t$ are finite morphisms,
\item $U$ is separated and locally Noetherian,
\item $\dim(\mathcal{O}_{U, u'}) \leq 1$ for every point $u'$
in the orbit of $u$.
\end{enumerate}
Then $u$ is contained in an $R$-invariant affine open of $U$.
\end{lemma}

\begin{proof}
The $R$-orbit of $u$ is finite. By conditions (2) and (3) it is contained
in an affine open $U'$ of $U$, see
Varieties, Proposition
\ref{varieties-proposition-finite-set-of-points-of-codim-1-in-affine}.
Then $t(s^{-1}(U \setminus U'))$ is an $R$-invariant
closed subset of $U$ which does not contain $u$. Thus
$U \setminus t(s^{-1}(U \setminus U'))$ is an $R$-invariant open
of $U'$ containing $u$.
Replacing $U$ by this open we may assume $U$ is quasi-affine.

\medskip\noindent
By Lemma \ref{lemma-find-affine-integral} we may replace $U$ by its reduction
and assume $U$ is reduced. This means $R$-invariant subschemes
$W' \subset W \subset U$ of
Lemma \ref{lemma-finite-flat-over-almost-dense-subscheme}
are equal $W' = W$. As $U = t(s^{-1}(\overline{W}))$ some point
$u'$ of the $R$-orbit of $u$ is contained in $\overline{W}$
and by Lemma \ref{lemma-find-affine-integral}
we may replace $U$ by $\overline{W}$ and $u$ by $u'$.
Hence we may assume there is
a dense open $R$-invariant subscheme $W \subset U$ such that
the morphisms $s_W, t_W$ of the restriction $(W, R_W, s_W, t_W, c_W)$ are
finite locally free.

\medskip\noindent
If $u \in W$ then we are done by
Groupoids, Lemma \ref{groupoids-lemma-find-invariant-affine}
(because $W$ is quasi-affine so any finite set of points
of $W$ is contained in an affine open, see
Properties, Lemma \ref{properties-lemma-ample-finite-set-in-affine}).
Thus we assume $u \not \in W$ and hence none of the points of the
orbit of $u$ is in $W$. Let $\xi \in U$
be a point with a nontrivial specialization to a point $u'$ in the orbit
of $u$. Since there are no specializations among the points in the
orbit of $u$ (Lemma \ref{lemma-no-specializations-map-to-same-point})
we see that $\xi$ is not in the orbit.
By assumption (3) we see that $\xi$ is a generic point of $U$
and hence $\xi \in W$.
As $U$ is Noetherian there are finitely many of these
points $\xi_1, \ldots, \xi_m \in W$. Because $s_W, t_W$ are flat the orbit
of each $\xi_j$ consists of generic points of irreducible components
of $W$ (and hence $U$).

\medskip\noindent
Let $j : U \to \Spec(A)$ be an immersion of $U$ into an affine scheme
(this is possible as $U$ is quasi-affine). Let $J \subset A$
be an ideal such that $V(J) \cap j(W) = \emptyset$ and $V(J) \cup j(W)$
is closed. Apply Lemma \ref{lemma-find-almost-invariant-function}
to the groupoid scheme $(W, R_W, s_W, t_W, c_W)$, the morphism
$j|_W : W \to \Spec(A)$, the points $\xi_j$, and the ideal $J$
to find an $f \in J$ such that $(j|_W)^{-1}D(f)$ is an $R_W$-invariant
affine open containing $\xi_j$ for all $j$. Since $f \in J$
we see that $j^{-1}D(f) \subset W$, i.e., $j^{-1}D(f)$ is
an $R$-invariant affine open of $U$ contained in $W$
containing all $\xi_j$.

\medskip\noindent
Let $Z$ be the reduced induced closed subscheme structure on
$$U \setminus j^{-1}D(f) = j^{-1}V(f).$$
Then $Z$ is set theoretically
$R$-invariant (but it may not be scheme theoretically $R$-invariant).
Let $(Z, R_Z, s_Z, t_Z, c_Z)$ be the restriction of $R$ to $Z$.
Since $Z \to U$ is finite, it follows that $s_Z$ and $t_Z$ are finite.
Since $u \in Z$ the orbit of $u$ is in $Z$ and agrees with the
$R_Z$-orbit of $u$ viewed as a point of $Z$. Since
$\dim(\mathcal{O}_{U, u'}) \leq 1$ and since $\xi_j \not \in Z$
for all $j$, we see that $\dim(\mathcal{O}_{Z, u'}) \leq 0$ for
all $u'$ in the orbit of $u$. In other words, the $R_Z$-orbit of $u$
consists of generic points of irreducible components of $Z$.

\medskip\noindent
Let $I \subset A$ be an ideal such that $V(I) \cap j(U) =\emptyset$
and $V(I) \cup j(U)$ is closed. Apply
Lemma \ref{lemma-find-almost-invariant-function} to
the groupoid scheme $(Z, R_Z, s_Z, t_Z, c_Z)$, the restriction $j|_Z$,
the ideal $I$, and the point $u \in Z$ to obtain $h \in I$ such that
$j^{-1}D(h) \cap Z$ is an $R_Z$-invariant open affine containing $u$.

\medskip\noindent
Consider the $R_W$-invariant (Groupoids, Lemma
\ref{groupoids-lemma-determinant-trick}) function
$$g = \text{Norm}_{s_W}(t_W^\sharp(j^\sharp(h)|_W)) \in \Gamma(W, \mathcal{O}_W)$$
(In the following we only need the restriction of $g$ to $j^{-1}D(f)$ and
in this case the norm is along a finite locally free morphism of affines.)
We claim that
$$V = (W_g \cap j^{-1}D(f)) \cup (j^{-1}D(h) \cap Z)$$
is an $R$-invariant affine open of $U$ which finishes the proof of the lemma.
It is set theoretically $R$-invariant by construction. As $V$ is a
constuctible set, to see that it is open it suffices to show it is
closed under generalization in $U$ (Topology, Lemma
\ref{topology-lemma-characterize-closed-Noetherian}
or the more general
Topology, Lemma
\ref{topology-lemma-constructible-stable-specialization-closed}).
Since $W_g \cap j^{-1}D(f)$ is open in $U$, it suffices to consider
a specialization $u_1 \leadsto u_2$ of $U$ with
$u_2 \in j^{-1}D(h) \cap Z$.
This means that $h$ is nonzero in $j(u_2)$ and $u_2 \in Z$.
If $u_1 \in Z$, then $j(u_1) \leadsto j(u_2)$ and since
$h$ is nonzero in $j(u_2)$ it is nonzero in $j(u_1)$ which
implies $u_1 \in V$. If $u_1 \not \in Z$ and
also not in $W_g \cap j^{-1}D(f)$, then $u_1 \in W$, $u_1 \not \in W_g$
because the complement of $Z = j^{-1}V(f)$ is contained in $W \cap j^{-1}D(f)$.
Hence there exists a point $r_1 \in R$ with $s(r_1) = u_1$
such that $h$ is zero in $t(r_1)$. Since $s$ is finite we
can find a specialization $r_1 \leadsto r_2$ with $s(r_2) = u_2$.
However, then we conclude that $f$ is zero in $u'_2 = t(r_2)$
which contradicts the fact that $j^{-1}D(h) \cap Z$
is $R$-invariant and $u_2$ is in it. Thus $V$ is open.

\medskip\noindent
Observe that $V \subset j^{-1}D(h)$ for our function $h \in I$.
Thus we obtain an immersion
$$j' : V \longrightarrow \Spec(A_h)$$
Let $f' \in A_h$ be the image of $f$. Then $(j')^{-1}D(f')$
is the principal open determined by $g$ in the affine
open $j^{-1}D(f)$ of $U$.
Hence $(j')^{-1}D(f)$ is affine. Finally,
$j'(V) \cap V(f') = j'(j^{-1}D(h) \cap Z)$
is closed in $\Spec(A_h/(f')) = \Spec((A/f)_h) = D(h) \cap V(f)$
by our choice of $h \in I$ and the ideal $I$. Hence we can apply
Lemma \ref{lemma-get-affine}
to conclude that $V$ is affine as claimed above.
\end{proof}

There are no comments yet for this tag.

## Add a comment on tag 0AB8

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 lower-right corner).