**Proof.**
Observe that $\int _ f w$ attains its maximum by Lemma 37.69.5. The set $Y_ d$ is open by Lemma 37.69.4. Thus the statement of the lemma makes sense.

Reduction to the Noetherian case; please skip this paragraph. Recall that a finite type morphism is quasi-finite if and only if it has relative dimension $0$, see Morphisms, Lemma 29.29.5. By Lemma 37.31.9 applied with $d = 0$ we can find a quasi-finite morphism $f_0 : X_0 \to Y_0$ of affine Noetherian schemes and a morphism $Y \to Y_0$ such that $f$ is the base change of $f_0$. Then we can write $Y = \mathop{\mathrm{lim}}\nolimits Y_ i$ as a directed limit of affine schemes of finite type over $Y_0$, see Algebra, Lemma 10.127.2. By Lemma 37.69.9 we can find an $i$ such that our weighting $w$ descends to a weighting $w_ i$ of the base change $f_ i : X_ i \to Y_ i$ of $f_0$. Now if the lemma holds for $f_ i, w_ i$, then it implies the lemma for $f$ as formation of $\int _ f w$ commutes with base change, see Lemma 37.68.1.

Assume $X$ and $Y$ Noetherian. Let $X' \to Y'$ be the base change of $f$ by a morphism $g : Y' \to Y$. The formation of $\int _ f w$ and hence the open $Y_ d$ commute with base change. If $g$ is finite and surjective, then $Y'_ d \to Y_ d$ is finite and surjective. In this case proving that $Y_ d$ is affine is equivalent to showing that $Y'_ d$ is affine, see Cohomology of Schemes, Lemma 30.13.3.

We may choose an immersion $X \to T$ with $T$ finite over $Y$, see Lemma 37.39.3. We are going to apply Morphisms, Lemma 29.48.6 to the finite morphism $T \to Y$. This lemma tells us that there is a finite surjective morphism $Y' \to Y$ such that $Y' \times _ Y T$ is a closed subscheme of a scheme $T'$ finite over $Y'$ which has a special form. By the discussion in the first paragraph, we may replace $Y$ by $Y'$, $T$ by $T'$, and $X$ by $Y' \times _ Y X$. Thus we may assume there is an immersion $X \to T$ (not necessarily open or closed) and closed subschemes $T_ i \subset T$, $i = 1, \ldots , n$ where

$T \to Y$ is finite (and locally free),

$T_ i \to Y$ is an isomorphism, and

$T = \bigcup _{i = 1, \ldots , n} T_ i$ set theoretically.

Let $Y' = \coprod Y_ k$ be the disjoint union of the irreducible components of $Y$ (viewed as integral closed subschemes of $Y$). Then we may base change once more by $Y' \to Y$; here we are using that $Y$ is Noetherian. Thus we may in addition assume $Y$ is integral and Noetherian.

We also may and do assume that $T_ i \not= T_ j$ if $i \not= j$ by removing repeats. Since $Y$ and hence all $T_ i$ are integral, this means that if $T_ i$ and $T_ j$ intersect, then they intersect in a closed subset which maps to a proper closed subset of $Y$.

Observe that $V_ i = X \cap T_ i$ is a locally closed subset which is in addition a closed subscheme of $X$ hence affine. Let $\eta \in Y$ and $\eta _ i \in T_ i$ be the generic points. If $\eta \not\in Y_ d$, then $Y_ d = \emptyset $ and we're done. Assume $\eta \in Y_ d$. Denote $I \in \{ 1, \ldots , n\} $ the subset of indices $i$ such that $\eta _ i \in V_ i$. For $i \in I$ the locally closed subset $V_ i \subset T_ i$ contains the generic point of the irreducible space $T_ i$ and hence is open. On the other hand, since $f$ is open (Lemma 37.68.4), for any $x \in X$ we can find an $i \in I$ and a specialization $\eta _ i \leadsto x$. It follows that $x \in T_ i$ and hence $x \in V_ i$. In other words, we see that $X = \bigcup _{i \in I} V_ i$ set theoretically. We claim that $Y_ d = \bigcap _{i \in I} \mathop{\mathrm{Im}}(V_ i \to Y)$; this will finish the proof as the intersection of affine opens $\mathop{\mathrm{Im}}(V_ i \to Y)$ of $Y$ is affine.

For $y \in Y$ let $f^{-1}(\{ y\} ) = \{ x_1, \ldots , x_ r\} $ in $X$. For each $i \in I$ there is at most one $j(i) \in \{ 1, \ldots , x_ r\} $ such that $\eta _ i \leadsto x_{j(i)}$. In fact, $j(i)$ exists and is equal to $j$ if and only if $x_ j \in V_ i$. If $i \in I$ is such that $j = j(i)$ exists, then $V_ i \to Y$ is an isomorphism in a neighbourhood of $x_ j \mapsto y$. Hence $\bigcup _{i \in I,\ j(i) = j} V_ i \to Y$ is finite after replacing source and target by neighbourhoods of $x_ j \mapsto y$. Thus the definition of a weighting tells us that $w(x_ j) = \sum _{i \in I,\ j(i) = j} w(\eta _ i)$. Thus we see that

\[ (\textstyle {\int }_ f w)(\eta ) = \sum \nolimits _{i \in I} w(\eta _ i) \geq \sum \nolimits _{j(i)\text{ exists}} w(\eta _ i) = \sum \nolimits _ j w(x_ j) = (\textstyle {\int }_ f w)(y) \]

Thus equality holds if and only if $y$ is contained in $\bigcap _{i \in I} \mathop{\mathrm{Im}}(V_ i \to Y)$ which is what we wanted to show.
$\square$

## Comments (0)