Lemma 37.74.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. The question is Zariski local on $X$ and $Y$, hence we may assume $X$ and $Y$ are affine. (Observe that the restriction of a weighting to an open is a weighting of the restriction of $f$ to that open.) By Lemma 37.73.3 after base change we still have a weighthing. 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. 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). Observe 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$. This is a constructible partition of $Y$, 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$. (You can base change by 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.) Thus $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 weigthing, 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).