Proposition 37.74.2. Let $f : X \to Y$ be a surjective quasi-finite morphism of schemes. Let $w : X \to \mathbf{Z}_{> 0}$ be a positive weighting of $f$. Assume $X$ affine and $Y$ separated1. Then the affine stratification number of $Y$ is at most the number of distinct values of $\int _ f w$.

Proof. Note that since $Y$ is separated, the morphism $X \to Y$ is affine (Morphisms, Lemma 29.11.11). The function $\int _ f w$ attains its maximum $d$ by Lemma 37.73.5. We will use induction on $d$. Consider the open subscheme $Y_ d = \{ y \in Y \mid (\int _ f w)(y) = d\}$ of $Y$ and recall that $f^{-1}(Y_ d) \to Y_ d$ is finite, see Lemma 37.73.6. By Lemma 37.74.1 for every affine open $W \subset Y$ we have that $Y_ d \cap W$ is affine (this uses that $W \times _ Y X$ is affine, being affine over $X$). Hence $Y_ d \to Y$ is an affine morphism of schemes. We conclude that $f^{-1}(Y_ d) = Y_ d \times _ Y X$ is an affine scheme being affine over $X$. Then $f^{-1}(Y_ d) \to Y_ d$ is surjective and hence $Y_ d$ is affine by Limits, Lemma 32.11.1. Set $X' = X \setminus f^{-1}(Y_ d)$ and $Y' = Y \setminus Y_ d$ viewed as closed subschemes of $X$ and $Y$. Since $X'$ is closed in $X$ it is affine. Since $Y'$ is closed in $Y$ it is separated. The morphism $f' : X' \to Y'$ is surjective and $w$ induces a weighting $w'$ of $f'$, see Lemma 37.72.3. By induction $Y'$ has an affine stratification of length $\leq$ the number of distinct values of $\int _{f'} w'$ and the proof is complete. $\square$

 It suffices if the diagonal of $Y$ is affine.

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 toolbar).