[proofplan]
The construction proceeds in three stages. First, fix a generator $t = t_p$ of the principal maximal ideal $\mathfrak{m}_p$ — such $t$ exists by the theorem that an [element outside $\mathfrak{m}_p^2$ generates $\mathfrak{m}_p$](/theorems/2169) at a smooth point. Second, prove that the descending chain $\mathfrak{m}_p \supset \mathfrak{m}_p^2 \supset \cdots$ has trivial intersection (the [Krull intersection](/theorems/???) at $\mathfrak{m}_p$): any $f \in \bigcap_n \mathfrak{m}_p^n$ generates a submodule killed by $\mathfrak{m}_p$, hence vanishes by [Nakayama's lemma](/theorems/2168). Third, define $\operatorname{ord}_p(f) = \max\{n : f \in \mathfrak{m}_p^n\}$ for $f \in \mathcal{O}_{C,p} \setminus \{0\}$, show it equals the unique $n$ such that $f = t^n u$ with $u \in \mathcal{O}_{C,p}^\times$, and extend additively to the field of fractions $\mathcal{O}_C(\eta) = \operatorname{Frac}(\mathcal{O}_{C,p})$. The group-homomorphism property and the two characterisations of $\mathcal{O}_{C,p}$ and $\mathfrak{m}_p$ then follow directly from the unique factorisation $f = t^n u$.
[/proofplan]
[step:Fix a uniformiser $t$ generating $\mathfrak{m}_p$]
Since $p \in C$ is a smooth point of the curve $C$, the cotangent space $\mathfrak{m}_p / \mathfrak{m}_p^2$ has dimension $1$ over the residue field $k = \mathcal{O}_{C,p} / \mathfrak{m}_p$ (this is the definition of smoothness for a curve). Choose any $t \in \mathfrak{m}_p$ whose image $\bar t \in \mathfrak{m}_p / \mathfrak{m}_p^2$ is nonzero; such $t$ exists because $\mathfrak{m}_p / \mathfrak{m}_p^2 \neq 0$. By [Element Outside $\mathfrak{m}_p^2$ Generates $\mathfrak{m}_p$](/theorems/2169) — whose hypotheses are exactly that $\bar t \neq 0$ and $\dim_k \mathfrak{m}_p / \mathfrak{m}_p^2 = 1$, both verified — we have
\begin{align*}
\mathfrak{m}_p = (t).
\end{align*}
We call $t$ a **uniformiser** at $p$ and write $t_p := t$ when emphasis on $p$ is needed.
[/step]
[step:Show $\bigcap_{n \geq 0} \mathfrak{m}_p^n = 0$ via Nakayama]
We claim every nonzero $f \in \mathcal{O}_{C,p}$ lies in only finitely many of the $\mathfrak{m}_p^n$. Set
\begin{align*}
N := \bigcap_{n \geq 0} \mathfrak{m}_p^n.
\end{align*}
Then $N$ is an ideal of $\mathcal{O}_{C,p}$, hence in particular a finitely generated $\mathcal{O}_{C,p}$-module (since $\mathcal{O}_{C,p}$ is Noetherian as a localisation of the Noetherian affine coordinate ring $A(C)$).
We show $\mathfrak{m}_p \cdot N = N$. The inclusion $\mathfrak{m}_p \cdot N \subseteq N$ is automatic (both lie inside every $\mathfrak{m}_p^n$). For the reverse, let $x \in N$. For each $n \geq 1$, $x \in \mathfrak{m}_p^n$, so $x = \sum_i a_i b_i$ with $a_i \in \mathfrak{m}_p$ and $b_i \in \mathfrak{m}_p^{n-1}$. The Artin–Rees Lemma gives a single integer $c \geq 0$ such that for all $n \geq c$, $\mathfrak{m}_p^n \cap N = \mathfrak{m}_p^{n-c}(\mathfrak{m}_p^c \cap N)$. In particular, taking $n$ large enough,
\begin{align*}
N = \mathfrak{m}_p^n \cap N = \mathfrak{m}_p^{n-c}(\mathfrak{m}_p^c \cap N) \subseteq \mathfrak{m}_p \cdot N,
\end{align*}
proving $N \subseteq \mathfrak{m}_p N$, hence equality.
By [Nakayama's lemma](/theorems/2168) applied to the local ring $\mathcal{O}_{C,p}$ with maximal ideal $\mathfrak{m}_p$ (locality verified: it is the localisation at a maximal ideal, see [Characterisation of Local Rings](/theorems/2128)) and the finitely generated module $N$ with $\mathfrak{m}_p N = N$:
\begin{align*}
N = 0.
\end{align*}
Equivalently, for every $f \in \mathcal{O}_{C,p} \setminus \{0\}$, there exists a largest integer $n \geq 0$ with $f \in \mathfrak{m}_p^n$.
[guided]
The intersection $N = \bigcap_n \mathfrak{m}_p^n$ ought to be zero — intuitively, an element vanishing to all orders at $p$ should vanish identically, because functions on a variety that vanish to infinite order on a Zariski-open set vanish on the whole component. The technical statement of "vanishes to all orders" is exactly $f \in \bigcap_n \mathfrak{m}_p^n$.
We use Nakayama. The hypothesis $\mathfrak{m}_p N = N$ is what we need to verify. The non-trivial inclusion is $N \subseteq \mathfrak{m}_p N$: given $x \in N$, we want to express $x$ as a finite sum $\sum a_i b_i$ with $a_i \in \mathfrak{m}_p$, $b_i \in N$. The naive attempt — expand $x \in \mathfrak{m}_p^n$ as $x = \sum a_i b_i$ with $a_i \in \mathfrak{m}_p$, $b_i \in \mathfrak{m}_p^{n-1}$ — produces $b_i$'s in $\mathfrak{m}_p^{n-1}$, but we need them in $N$. The $b_i$'s depend on $n$, and there is no a priori reason they lie in $N$.
The Artin–Rees Lemma fixes this. It states: for any ideal $I$ of a Noetherian ring $R$ and any finitely generated submodule $N$ of a finitely generated $R$-module $M$, there exists $c$ such that for $n \geq c$,
\begin{align*}
I^n M \cap N = I^{n-c}(I^c M \cap N).
\end{align*}
Applied to $M = \mathcal{O}_{C,p}$, $I = \mathfrak{m}_p$, and the submodule $N$: for large enough $n$,
\begin{align*}
\mathfrak{m}_p^n \cap N = \mathfrak{m}_p^{n-c}(\mathfrak{m}_p^c \cap N) \subseteq \mathfrak{m}_p \cdot (\mathfrak{m}_p^c \cap N) \subseteq \mathfrak{m}_p \cdot N,
\end{align*}
using $n - c \geq 1$. But $N \subseteq \mathfrak{m}_p^n$ for every $n$, so $N = \mathfrak{m}_p^n \cap N \subseteq \mathfrak{m}_p N$.
Now Nakayama applies: $\mathcal{O}_{C,p}$ is local (residue field $k$, maximal ideal $\mathfrak{m}_p$), $N$ is finitely generated (every ideal in a Noetherian ring is finitely generated), and $\mathfrak{m}_p N = N$. Therefore $N = 0$, which is what we wanted.
[/guided]
[/step]
[step:Define $\operatorname{ord}_p$ on $\mathcal{O}_{C,p} \setminus \{0\}$ and prove unique factorisation $f = t^n u$]
For $f \in \mathcal{O}_{C,p} \setminus \{0\}$, define
\begin{align*}
\operatorname{ord}_p(f) := \max\{n \in \mathbb{Z}_{\geq 0} : f \in \mathfrak{m}_p^n\}.
\end{align*}
The maximum exists and is finite by Step 2 (and is at least $0$, since $f \in \mathcal{O}_{C,p} = \mathfrak{m}_p^0$).
We claim that for $n = \operatorname{ord}_p(f)$, there is a unique unit $u \in \mathcal{O}_{C,p}^\times$ with
\begin{align*}
f = t^n u.
\end{align*}
**Existence.** Since $\mathfrak{m}_p = (t)$, induction gives $\mathfrak{m}_p^n = (t^n)$ for every $n \geq 0$. (Base: $\mathfrak{m}_p^0 = \mathcal{O}_{C,p} = (1) = (t^0)$. Step: $\mathfrak{m}_p^{n+1} = \mathfrak{m}_p \cdot \mathfrak{m}_p^n = (t)(t^n) = (t^{n+1})$.) Hence $f \in (t^n)$, so $f = t^n u$ for some $u \in \mathcal{O}_{C,p}$. By maximality of $n$, $f \notin \mathfrak{m}_p^{n+1} = (t^{n+1})$, which forces $u \notin \mathfrak{m}_p$ — for if $u = t v$ with $v \in \mathcal{O}_{C,p}$, then $f = t^{n+1} v \in (t^{n+1})$, contradicting $\operatorname{ord}_p(f) = n$. In a [local ring](/theorems/2128) the units are exactly the complement of the maximal ideal, so $u \in \mathcal{O}_{C,p}^\times$.
**Uniqueness.** Suppose $f = t^n u_1 = t^n u_2$ with $u_1, u_2 \in \mathcal{O}_{C,p}^\times$. Then $t^n(u_1 - u_2) = 0$. Since $\mathcal{O}_{C,p}$ is a domain (it is a localisation of the integral domain $A(C)$ of an irreducible curve, and localisations of domains are domains), and $t \neq 0$ (as $\bar t \neq 0$ in $\mathfrak{m}_p / \mathfrak{m}_p^2$), we have $t^n \neq 0$, so $u_1 = u_2$.
[/step]
[step:Extend $\operatorname{ord}_p$ to $\mathcal{O}_C(\eta)^\times$ and verify the homomorphism property]
The function field $\mathcal{O}_C(\eta)$ is the field of fractions of the integral domain $\mathcal{O}_{C,p}$ (alternatively, of $A(C)$ — the two fields of fractions agree, see [Function Field is Finitely Generated](/theorems/2142)). For $f \in \mathcal{O}_C(\eta)^\times$, write $f = a/b$ with $a, b \in \mathcal{O}_{C,p} \setminus \{0\}$, and define
\begin{align*}
\operatorname{ord}_p: \mathcal{O}_C(\eta)^\times &\to \mathbb{Z}, \\
f = a/b &\mapsto \operatorname{ord}_p(a) - \operatorname{ord}_p(b).
\end{align*}
**Well-definedness.** If $a/b = a'/b'$ in $\mathcal{O}_C(\eta)$, then $ab' = a'b$ in $\mathcal{O}_{C,p}$. Writing $a = t^{\alpha} u$, $b = t^{\beta} v$, $a' = t^{\alpha'} u'$, $b' = t^{\beta'} v'$ with $u, v, u', v' \in \mathcal{O}_{C,p}^\times$, the equation $ab' = a'b$ becomes $t^{\alpha + \beta'} (uv') = t^{\alpha' + \beta}(u'v)$. By uniqueness of the factorisation $f = t^n u$ from Step 3 (applied to the nonzero element $ab' \in \mathcal{O}_{C,p}$), $\alpha + \beta' = \alpha' + \beta$, i.e. $\alpha - \beta = \alpha' - \beta'$. So $\operatorname{ord}_p(a) - \operatorname{ord}_p(b) = \operatorname{ord}_p(a') - \operatorname{ord}_p(b')$.
**Homomorphism property.** For $f, g \in \mathcal{O}_C(\eta)^\times$, write $f = a_1/b_1$, $g = a_2/b_2$ as above. Then $fg = (a_1 a_2)/(b_1 b_2)$. Using the unique factorisations $a_i = t^{\alpha_i} u_i$, $b_i = t^{\beta_i} v_i$:
\begin{align*}
a_1 a_2 = t^{\alpha_1 + \alpha_2}(u_1 u_2), \qquad b_1 b_2 = t^{\beta_1 + \beta_2}(v_1 v_2),
\end{align*}
and $u_1 u_2, v_1 v_2 \in \mathcal{O}_{C,p}^\times$ since units form a multiplicative group. By Step 3, $\operatorname{ord}_p(a_1 a_2) = \alpha_1 + \alpha_2$ and $\operatorname{ord}_p(b_1 b_2) = \beta_1 + \beta_2$. Hence
\begin{align*}
\operatorname{ord}_p(fg) = (\alpha_1 + \alpha_2) - (\beta_1 + \beta_2) = (\alpha_1 - \beta_1) + (\alpha_2 - \beta_2) = \operatorname{ord}_p(f) + \operatorname{ord}_p(g),
\end{align*}
proving $\operatorname{ord}_p$ is a group homomorphism $(\mathcal{O}_C(\eta)^\times, \cdot) \to (\mathbb{Z}, +)$.
[/step]
[step:Prove the two set-equalities for $\mathcal{O}_{C,p}$ and $\mathfrak{m}_p$]
Both equalities follow from the unique factorisation $f = t^n u$ and the relation $\mathfrak{m}_p^n = (t^n)$.
**Equality for $\mathcal{O}_{C,p}$.** Let $f \in \mathcal{O}_C(\eta)^\times$. We show
\begin{align*}
f \in \mathcal{O}_{C,p} \quad \iff \quad \operatorname{ord}_p(f) \geq 0.
\end{align*}
($\Rightarrow$) If $f \in \mathcal{O}_{C,p}$ and $f \neq 0$ (the case $f = 0$ is excluded from $\mathcal{O}_C(\eta)^\times$), then by Step 3, $f = t^n u$ with $n = \operatorname{ord}_p(f) \geq 0$ as defined on $\mathcal{O}_{C,p} \setminus \{0\}$. Writing $f = f/1$ in the fraction-field definition gives the same value $\operatorname{ord}_p(f) = n - 0 = n \geq 0$.
($\Leftarrow$) If $\operatorname{ord}_p(f) \geq 0$, write $f = a/b$ with $a, b \in \mathcal{O}_{C,p} \setminus \{0\}$, $a = t^\alpha u$, $b = t^\beta v$, $u, v$ units, so $f = t^{\alpha - \beta}(u/v)$ in $\mathcal{O}_C(\eta)$. The hypothesis $\alpha - \beta \geq 0$ means $t^{\alpha - \beta} \in \mathcal{O}_{C,p}$, so $f = t^{\alpha-\beta} (uv^{-1}) \in \mathcal{O}_{C,p}$ since $\mathcal{O}_{C,p}$ is closed under multiplication.
Adjoining the element $0$ (excluded from $\mathcal{O}_C(\eta)^\times$ but lying in $\mathcal{O}_{C,p}$):
\begin{align*}
\mathcal{O}_{C,p} = \{f \in \mathcal{O}_C(\eta)^\times : \operatorname{ord}_p(f) \geq 0\} \cup \{0\}.
\end{align*}
**Equality for $\mathfrak{m}_p$.** Similarly,
\begin{align*}
f \in \mathfrak{m}_p \cap \mathcal{O}_C(\eta)^\times \quad \iff \quad \operatorname{ord}_p(f) > 0.
\end{align*}
($\Rightarrow$) If $f \in \mathfrak{m}_p \setminus \{0\}$, then $f = t^n u$ with $n \geq 1$ (since $\mathfrak{m}_p = (t)$ means $f$ has at least one factor of $t$), so $\operatorname{ord}_p(f) = n \geq 1 > 0$.
($\Leftarrow$) If $f \in \mathcal{O}_C(\eta)^\times$ has $\operatorname{ord}_p(f) > 0$, by ($\Leftarrow$) of the previous part $f \in \mathcal{O}_{C,p}$, and writing $f = t^n u$ with $n = \operatorname{ord}_p(f) \geq 1$ shows $f \in (t) = \mathfrak{m}_p$.
Adjoining $0 \in \mathfrak{m}_p$:
\begin{align*}
\mathfrak{m}_p = \{f \in \mathcal{O}_C(\eta)^\times : \operatorname{ord}_p(f) > 0\} \cup \{0\}.
\end{align*}
This completes the proof.
[/step]