Lemma 37.76.1. Let $f : X \to Y$ be a locally quasi-finite morphism. Let $w : X \to \mathbf{Z}$ be a weighting of $f$. Then the level sets of the function $w$ are locally constructible in $X$.

Proof. In the proof below we will use Lemmas 37.75.4 and 37.75.3 without further mention. We will also use elementary properties of constructible subsets of schemes and topological spaces, see Topology, Section 5.15 and Properties, Section 28.2. Using this the reader sees question is local on $X$ and $Y$; details omitted. Hence we may assume $X$ and $Y$ are affine. If we can find a surjective morphism $Y' \to Y$ of finite presentation such that the level sets of $w$ pull back to locally constructible subsets of $X' = Y' \times _ Y X$, then we conclude by Morphisms, Theorem 29.22.3.

Assume $X$ and $Y$ affine. We may choose an immersion $X \to T$ where $T \to Y$ is finite, see Lemma 37.43.3. By Morphisms, Lemma 29.48.6 after replacing $Y$ by $Y'$ surjective finite locally free over $Y$, replacing $X$ by $Y' \times _ Y X$ and $T$ by a scheme finite locally free over $Y'$ containing $Y' \times _ Y T$ as a closed subscheme, we may assume $T$ is finite locally free over $Y$, contains closed subschemes $T_ i$ mapping isomorphically to $Y$ such that $T = \bigcup _{i = 1, \ldots , n} T_ i$ (set theoretically). Since $T_ i \subset T$ is a constructible closed subset (as the image of a finitely presented morphism $Y \to T$ of schemes), we see that for $I \subset \{ 1, \ldots , n\}$ the intersection $\bigcap _{i \in I} T_ i$ is a constructible closed subset of $T$ and hence maps to a constructible closed subset of $Y$.

For a disjoint union decomposition $\{ 1, \ldots , n\} = I_1 \amalg \ldots \amalg I_ r$ with nonempty parts consider the subset $Y_{I_1, \ldots , I_ r} \subset Y$ consisting of points $y \in Y$ such that $T_ y = \{ x_1, \ldots , x_ r\}$ consists of exactly $r$ points with $x_ j \in T_ i \Leftrightarrow i \in I_ j$. By our remarks above this is a constructible partition of $Y$. There exists an affine scheme $Y'$ of finite presentation over $Y$ such that the image of $Y' \to Y$ is exactly $Y_{I_1, \ldots , I_ r}$, see Algebra, Lemma 10.29.4. Hence we may assume that $Y = Y_{I_1, \ldots , I_ r}$ for some disjoint union decomposition $\{ 1, \ldots , n\} = I_1 \amalg \ldots \amalg I_ r$. In this case $T = T(1) \amalg \ldots \amalg T(r)$ with $T(j) = \bigcap _{i \in I_ j} T_ i$ is a decomposition of $T$ into disjoint closed (and hence open) subsets. Intersecting with the locally closed subscheme $X$ we obtain an analogous decomposition $X = X(1) \amalg \ldots \amalg X(r)$ into open and closed parts. The morphism $X(j) \to Y$ an immersion. Since $w$ is a weighting, it follows that $w|_{X(j)}$ is locally constant1 and we conclude. $\square$

[1] In fact, if $f : X \to Y$ is an immersion and $w$ is a weighting of $f$, then $f$ restricts to an open map on the locus where $w$ is nonzero.

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