Let $K/F$ be a function field of genus $g\geq 2$, and $\deg(P)=1$. If $0\leq k\leq 2g - 2$ show there are $g$ values of $k$ s.t $l(kP) = l((k+1)P)$.

Let $$K/F$$ be a function field. First some notation:

$$D_K$$ is the group of divisors of $$K$$ (i.e. the free abelian group generated by the primes of $$K$$).

For $$x \in K^{\times}$$, $$(x) = \sum_P ord_P(x)P$$

$$L(D) = \{x \in K^{\times} \,:\, (x) + D \geq 0\} \cup \{0\}$$ for $$D \in D_K$$

$$l(D) = \dim_F(L(D))$$

Here is the problem:

Suppose $$K/F$$ is of genus $$g\geq 2$$, and $$P$$ a prime of degree $$1$$. For all integers $$k$$ we have $$l(kP) \leq l((k+1)P)$$. If we restrict $$k$$ to the range $$0\leq k\leq 2g - 2$$ show there are exactly $$g$$ values of $$k$$ where $$l(kP) = l((k+1)P)$$.

I am able to show that $$l((k+1)P) - l(kP) \leq 1$$ for $$k \geq 0$$ (this seems like it should help, but maybe not). I have also observed that by Riemann-Roch, $$l(kP) = l((k+1)P)$$ (with $$0\leq k \leq 2g-2$$) if and only if $$l(C - kP) = l(C - (k+1)P) + 1$$ where $$C$$ is a divisor in the canonical class $$\mathcal{C}$$.

Edit:

I'm not sure where to go from here. I tried to gain some intuition by looking at the case when $$k = 0$$. Of course $$l(0P) = l(0) = 1$$. But $$l(P)$$ can be either $$1$$ or $$2$$, and I don't see why $$l(P)$$ has to be $$1$$.

Notice that $$l(0P) = 1$$ and $$l((2g-1)P) = \deg((2g - 1)P) - g + 1 = g$$. Denote $$n_0 = |K_0|$$, where $$K_0 = \{k \,:\,0\leq k \leq 2g-2 ; l(kP) = l((k+1)P) \}$$ and let $$K_1 = ([0,2g-2]\cap \mathbb{Z})\setminus K_0$$. Then since for each $$0\leq k\leq 2g-2$$ we have $$l((k+1)P)- l(kP) \leq 1$$, for each $$k \in K_1$$, we must add $$1$$ to $$l(0) = 1$$ in order to reach $$l((2g-1)P) = g$$ (having a real hard time expressing this idea). Since $$|K_1| = 2g-1 - n_0$$, we get that $$g = 2g-1 - n_0 + 1$$ and rearranging terms we arrive at $$n_0 = g$$.