Lemma 37.68.5. Let $f : X \to Y$ be a morphism of schemes. Assume $f$ is locally quasi-finite, locally of finite presentation, and flat. Then there is a positive weighting $w : X \to \mathbf{Z}_{> 0}$ of $f$ given by the rule that sends $x \in X$ lying over $y \in Y$ to

$w(x) = \text{length}_{\mathcal{O}_{X, x}} (\mathcal{O}_{X, x}/\mathfrak m_ y \mathcal{O}_{X, x}) [\kappa (x) : \kappa (y)]_ i$

where $[\kappa ' : \kappa ]_ i$ is the inseparable degree (Fields, Definition 9.14.7).

Proof. Consider a diagram as in Definition 37.68.2. Let $u \in U$ with images $x, y, v$ in $X, Y, V$. Then we claim that

$\text{length}_{\mathcal{O}_{X, x}} (\mathcal{O}_{X, x}/\mathfrak m_ y \mathcal{O}_{X, x}) = \text{length}_{\mathcal{O}_{U, u}} (\mathcal{O}_{U, u}/\mathfrak m_ v \mathcal{O}_{U, u})$

and

$[\kappa (x) : \kappa (y)]_ i = [\kappa (u) : \kappa (v)]_ i$

The first equality follows as $\mathcal{O}_{X, x} \to \mathcal{O}_{U, u}$ is a flat local homomorphism such that $\mathfrak m_ y \mathcal{O}_{U, u} = \mathfrak m_ v \mathcal{O}_{U, u}$ and $\mathfrak m_ x \mathcal{O}_{U, u} = \mathfrak m_ u$ (because $\mathcal{O}_{Y, y} \to \mathcal{O}_{V, v}$ and $\mathcal{O}_{X, x} \to \mathcal{O}_{U, u}$ are unramified) and hence the equality by Algebra, Lemma 10.52.13. The second equality follows because $\kappa (v)/\kappa (y)$ is a finite separable extension and $\kappa (u)$ is a factor of $\kappa (x) \otimes _{\kappa (y)} \kappa (v)$ and hence the inseparable degree is unchanged. Having said this, we see that formation of the function in the lemma commutes with étale base change. This reduces the problem to the discussion of the next paragraph.

Assume that $f$ is a finite, flat morphism of finite presentation. We have to show that $\int _ f w$ is locally constant on $Y$. In fact, $f$ is finite locally free (Morphisms, Lemma 29.48.2) and we will show that $\int _ f w$ is equal to the degree of $f$ (which is a locally constant function on $Y$). Namely, for $y \in Y$ we see that

\begin{align*} (\textstyle {\int }_ f w)(y) & = \sum \nolimits _{f(x) = y} \text{length}_{\mathcal{O}_{X, x}} (\mathcal{O}_{X, x}/\mathfrak m_ y \mathcal{O}_{X, x}) [\kappa (x) : \kappa (y)]_ i [\kappa (x) : \kappa (y)]_ s \\ & = \sum \nolimits _{f(x) = y} \text{length}_{\mathcal{O}_{X, x}} (\mathcal{O}_{X, x}/\mathfrak m_ y \mathcal{O}_{X, x}) [\kappa (x) : \kappa (y)] \\ & = \text{length}_{\mathcal{O}_{Y, y}}((f_*\mathcal{O}_ X)_ y/ \mathfrak m_ y (f_*\mathcal{O}_ X)_ y) \end{align*}

Last equality by Algebra, Lemma 10.52.12. The final number is the rank of $f_*\mathcal{O}_ X$ at $y$ as desired. $\square$

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