Riemann-Hurwitz proof from Lang's Introdution to Algebraic and Abelian Functions I was studying the proof of the Riemann-Hurwitz formula in the book Introdution to Algebraic and Abelian Functions by Serge Lang (chapter 1, section 6):

Theorem. Let $k$ be algebraically closed, and let $K$ be a function field with $k$ as constant field. Let $E$ be a finite separable extension of $K$ of degree $n$. Let $g_E$ and $g_K$ be the genera of $E$ and $K$ respectively. For each point $P$ of $K$, and each point $Q$ of $E$ above $P$, assume that the ramification index $e_Q$ is prime to the characteristic of $k$. Then $$2g_E-2=n(2g_K-2)+\sum_Q (e_Q-1).$$
Proof. If $\omega$ is any non-zero differential form of $K$, then we know that its degree is $2g_K-2$. Such a form can be written as $ydx$, with $x,y\in K$. We can also view $x,y$ as elements of $E$; we can compute the degree in $E$, and compare it with that in $K$ to the formula, as follows. Let $P$ be a point of $K$, and let $t$ be a local parameter at $P$, that is an element of order $1$ at $P$ in $K$. If $u$ is a local parameter at $Q$, then $$t=u^ev,$$ where $v$ is a unit at $Q$. Furthermore, $dt=u^edv+eu^{e-1}vdu$. Hence $$\operatorname{ord}_Q(ydx)=e_Q\cdot\operatorname{ord}_P(ydx)+(e_Q-1).$$ Summing over all $Q$ over $P$, and then over all $P$ yields the formula.

I have two questions:

*

*I don't see why $dt=u^e dv+eu^{e-1}vdu$ implies
$$\operatorname{ord}_Q(ydx)=e_Q\operatorname{ord}_P(ydx)+(e_Q-1)$$

*When we have the following formula
$$\operatorname{ord}_Q(ydx)=e_Q\operatorname{ord}_P(ydx)+(e_Q-1)$$
it says that summing over all $Q$ over $P$ we are done. I don't see why, since:
$$\sum_Q\operatorname{ord}_Q(ydx)=\sum_Q e_Q\operatorname{ord}_P(ydx)+\sum_Q(e_Q-1)$$ Hence, in order to finish the prove we need that $\sum_Q\operatorname{ord}_Q(ydx)=2g_E-2$ and $\sum_Q e_Q\operatorname{ord}_P(ydx)=n(2g_K-2)$, but none of this formulas seems trivial to me.

I am not sure whether these facts are easy consequences of previous results of the book or not, since there are not any similar result in the previous sections. (As a extra, if someone can write the whole proof with all the details I will be very grateful.)
 A: $\def\ord{\operatorname{ord}}$
Question 1: Given a differential form $ydx$, and a point $P$ with uniformizer $t$, we can write $ydx=fdt$ at $P$ for a unique rational function $f$. Then $\ord_P(ydx)=\ord_P(f)$. Let's use this to compute $\ord_Q(dt)$: as $v$ is in the local ring at $Q$, the valuation of $dv$ is non-negative, so $\ord_Q(u^edv)\geq e$, and as $e\neq 0$ in $K$ we have $\ord_Q(eu^{e-1}vdu)=e-1$. As the valuation of the sum of two elements of different valuations is the smaller of the valuations, $\ord_Q(dt)=e-1$.
Now what happens if we consider $sdt$? Since multiplication adds valuations, we see that $\ord_Q(sdt)=\ord_Q(s)+e-1$. But $\ord_Q(s)=e_Q\ord_P(s)$, and as $\ord_P(s)=\ord_P(sdt)$ we find that $\ord_Q(sdt)=e_Q\ord_P(sdt)+e-1$. Writing $ydx$ as $sdt$, we find the equation we're looking for.
Question 2: Start with $\sum_Q \ord_Q(ydx)$. This is just the degree of the differential form $ydx$, which is the degree of the canonical class on $E$, or $2g_E-2$. Next, for the sum $\sum_Q e_Q\ord_P(ydx)$, reindex this in to a sum over all $P$ by writing it as $\sum_P \sum_{Q\mapsto P} e_Q\ord_P(ydx)$. Since $\sum_{Q\mapsto P} e_Q=n$, this becomes $n\sum_P\ord_P(ydx)$, which by the same logic as the first part of this question is exactly $n(2g_K-2)$.
