[proofplan]
The Riemann–Roch theorem reads $\ell(D) - \ell(K_C - D) = \deg D - g + 1$. To convert this into a closed formula for $\ell(D)$, it suffices to kill the correction term $\ell(K_C - D)$. We show that under $\deg D \geq 2g - 1$ the divisor $K_C - D$ has strictly negative degree, hence its Riemann–Roch space contains only zero — because a nonzero $f \in \mathcal{L}(K_C - D)$ would produce an effective divisor in the same class, and effective divisors have non-negative degree. Substituting $\ell(K_C - D) = 0$ into Riemann–Roch yields the formula.
[/proofplan]
[step:Compute the degree of $K_C - D$ and show it is negative]
The canonical divisor on a smooth projective curve of genus $g$ has degree $\deg K_C = 2g - 2$. (This follows from the [Riemann–Roch Theorem](/theorems/2185) applied once with $D = 0$ to get $\ell(K_C) = g$, and once with $D = K_C$ to get $\ell(K_C) - \ell(0) = \deg K_C - g + 1$; substituting $\ell(0) = 1$ and $\ell(K_C) = g$ yields $\deg K_C = 2g - 2$.) The hypothesis $\deg D \geq 2g - 1$ gives
\begin{align*}
\deg(K_C - D) = \deg K_C - \deg D = (2g - 2) - \deg D \leq (2g - 2) - (2g - 1) = -1.
\end{align*}
Hence $\deg(K_C - D) \leq -1 < 0$.
[/step]
[step:Show that a divisor of negative degree has zero Riemann–Roch space]
We claim: if $E \in \mathrm{Div}(C)$ satisfies $\deg E < 0$, then $\mathcal{L}(E) = \{0\}$.
Suppose for contradiction that there is a nonzero $f \in \mathcal{L}(E)$. By definition of $\mathcal{L}(E)$,
\begin{align*}
\operatorname{div}(f) + E \geq 0,
\end{align*}
i.e., the divisor $\operatorname{div}(f) + E$ is effective. An effective divisor has non-negative degree:
\begin{align*}
\deg(\operatorname{div}(f) + E) \geq 0.
\end{align*}
Now $\deg \operatorname{div}(f) = 0$ for any nonzero rational function $f \in k(C)^\times$, by [Principal Divisors Have Degree Zero](/theorems/2177). Therefore
\begin{align*}
0 \leq \deg(\operatorname{div}(f) + E) = \deg \operatorname{div}(f) + \deg E = 0 + \deg E = \deg E,
\end{align*}
contradicting $\deg E < 0$.
Applying the claim with $E := K_C - D$, which satisfies $\deg E \leq -1 < 0$ by Step 1:
\begin{align*}
\mathcal{L}(K_C - D) = \{0\}, \qquad \ell(K_C - D) = \dim_k \{0\} = 0.
\end{align*}
[guided]
We need to show that no nonzero rational function $f$ can satisfy $\operatorname{div}(f) + (K_C - D) \geq 0$ when $\deg(K_C - D) < 0$. Why does negative degree force the space to vanish? Because the condition "$\operatorname{div}(f) + E$ is effective" puts a degree lower bound on the principal divisor $\operatorname{div}(f)$ — but principal divisors always have degree exactly zero. The two facts combine to a degree obstruction.
Concretely, suppose $f \in \mathcal{L}(E) \setminus \{0\}$ for some divisor $E$ with $\deg E < 0$. The defining condition $\operatorname{div}(f) + E \geq 0$ means each coefficient of $\operatorname{div}(f) + E$, summed over all closed points of $C$, is non-negative. Summing the coefficients gives the degree:
\begin{align*}
\deg(\operatorname{div}(f) + E) = \sum_{p \in C} \bigl(\operatorname{ord}_p(f) + E_p\bigr) \cdot [\kappa(p) : k] \geq 0,
\end{align*}
since all summands are non-negative. (Here $E = \sum_p E_p \cdot p$ and $\kappa(p)$ is the residue field at $p$; over the algebraically closed $k$ all residue fields are $k$ and the degrees are $1$, but the inequality is the same in either case.)
A foundational fact about smooth projective curves over an algebraically closed field is that for every nonzero $f \in k(C)^\times$, the principal divisor $\operatorname{div}(f) = \sum_p \operatorname{ord}_p(f) \cdot p$ has degree zero — the number of zeros equals the number of poles, counted with multiplicity. This is [Principal Divisors Have Degree Zero](/theorems/2177). Hence
\begin{align*}
0 \leq \deg(\operatorname{div}(f) + E) = \deg \operatorname{div}(f) + \deg E = 0 + \deg E = \deg E,
\end{align*}
contradicting our hypothesis $\deg E < 0$. Hence no such $f$ exists, and $\mathcal{L}(E) = \{0\}$, so $\ell(E) = 0$.
Specialising to $E = K_C - D$ — for which we just established $\deg E \leq -1$ in Step 1 — gives $\ell(K_C - D) = 0$. This is the engine that makes the "large-degree" version of Riemann–Roch a closed formula rather than a difference of two unknowns.
[/guided]
[/step]
[step:Substitute into Riemann–Roch to obtain the closed formula]
The [Riemann–Roch Theorem](/theorems/2185) for the smooth projective curve $C$ of genus $g$ states that for every divisor $D \in \mathrm{Div}(C)$,
\begin{align*}
\ell(D) - \ell(K_C - D) = \deg D - g + 1.
\end{align*}
Substituting the value $\ell(K_C - D) = 0$ obtained in Step 2:
\begin{align*}
\ell(D) - 0 = \deg D - g + 1,
\end{align*}
hence
\begin{align*}
\ell(D) = \deg D - g + 1.
\end{align*}
This together with $\ell(K_C - D) = 0$ is the conclusion of the theorem.
[/step]