(this is exercise $1.8$ from Stichtenoth's Algebraic Function Fields and Codes)
Let $F|K$ be a function field in one variable with genus $g>0$. If $A$ is a divisor with $\ell(A)>0$, show that $\ell(A)=\deg(A)+1\Leftrightarrow A$ is a principal divisor.
(Notation: $\ell(A):=\dim_K\mathcal{L}(A)$, where $\mathcal{L}(A):=\{z\in F\mid (z)\geq -A\}\cup\{0\}$)
Here's my attempt:
$(\Leftarrow)$ If $A=(z)$ then $\deg(A)=0$. Besides, $A\sim 0$, so that $\mathcal{L}(A)=\mathcal{L}(0)$ and $\ell(A)=\ell(0)=1$. That way, $\ell(A)-\deg(A)-1=1-0-1=0$.
$(\Rightarrow)$ If $\ell(A)-\deg(A)-1=0$, then for a canonical divisor $W$ we have by Riemann-Roch that $\ell(W-A)=g$. Besides, $\deg(W-A)=\deg(W)-\deg(A)=2g-2-\ell(A)+1\leq 2g-2$.
If I could show that $\deg(W-A)$ is exactely $2g-2$, this would prove that $W-A$ itself is a canonical divisor, so that $A$ is necessarily principal.
I can't see how would I prove the inequality $\deg(W-A)\geq 2g-2$.
Any suggestions?
(different strategies will also be welcome)
You don't need Riemann Roch.
$\ell(D) \le \ell(D-Q)+1$ because once we have one $u \in L(D), \not \in L(D-Q)$ for all $v \in L(D)$ we have $v- C u \in L(D-Q)$ for some $C$.
Moreover $\deg(B)=0, \ell(B)=1 \implies L(B) = Kf$ and $\forall P, \deg(B-P) < 0\implies\ell(B-P) =0 \implies div(f)=B$
Given $\ell(A) = \deg(A)+1$, if $\deg(A)>0$
pick some $Q_1$ not appearing in $A$ such that one element of $L(A)$ doesn't have a zero at $Q_1$ then $\ell(A-Q_1)< \ell(A)$ so that $\ell(A-Q_1)=\ell(A)-1$,
do it repeatedly to obtain $\ell(A-\sum_{j=1}^n Q_j) = \ell(A)-n,\ell(A-\sum_{j=1}^{\deg(A)} Q_j) = 1$
$A-\sum_{j=1}^{\deg(A)} Q_j = div(g)$ so that $\ell(Q_{\deg(A)}) = \ell(Q_{\deg(A)} + div(g) ) = 2$ which means there is a function $h$ with only one (simple) pole at $Q_{\deg(A)}$ : this implies the function field is $\overline{K}(h)$ of genus $0$