TITLE: finite generation of unit group of global function field
QUESTION [6 upvotes]: Let $X/\mathbb{F}_q$ be a smooth projective geometrically connected curve. Why do we have $\Gamma(X - \{p_1,\ldots,p_n\},\mathcal{O}_X)^\times$ is finitely generated of rank $n$? (analogue of the Dirichlet unit theorem for function fields)
EDIT: 1. Is it also possible to prove this using Riemann-Roch? $\dim\Gamma(X, \mathcal{L}(D)) = \deg{D} + 1-g$?
2. Or using the exact sequence $1 \to \mathbb{G}_{m,X} \to j_*\mathbb{G}_{m,X - S} \to \bigoplus_{p \in S}\mathbb{Z} \to 0$?
EDIT2: Yes, 2. works!

REPLY [3 votes]: In addition to @Cantlog's "geometric" answer, the Fujisaki Compactness Lemma argument via Haar measure is identical: proving for any finite separable extension $K$ of $\mathbb F_q(x)$ that ideles of norm $1$ modulo $K^\times$ is a compact group. Then as corollaries one has both finiteness of "generalized class number" and the generator-count (mod torsion) for "generalized unit groups".
That is, somehow the local compactness of the completions, the finiteness of residue class fields gives a sufficient argument.