Divisors of degree at least are non-special:
ProvedFunctionField.ell_eq_of_deg_geLet be a field and let be an algebraic function field in one variable, presented through a separating variable: is a finite separable extension of the rational function field , the structure maps being compatible. Assume that is the full constant field of : every element of that is algebraic over already lies in .
A place of is a valuation ring with whose value group is infinite cyclic; is its normalized valuation and its degree. A divisor is a finite formal sum with , of degree . Its Riemann–Roch space is
a -vector space of dimension . The genus of is the largest value of the defect over all divisors .
An adele (répartition) of is a family of elements of , indexed by the places, with for all but finitely many ; the adeles form a -vector space containing diagonally, and for a divisor one puts . A Weil differential is a -linear form that vanishes on for some divisor ; if , its divisor is the largest divisor with this property. A divisor is canonical if for some nonzero Weil differential .
Assume that is a canonical divisor of (this hypothesis is part of the statement; such a always exists). Let be a divisor with
Then
This is the "second part" of the Riemann–Roch theorem: for divisors of large degree the dimension of is determined by the degree and the genus alone. It is the form used in practice to compute Riemann–Roch spaces, e.g. for on an elliptic curve.
Formalization Note The tower is given by the instances Algebra k[X] K, Algebra k⟮X⟯ K, Algebra k K, IsScalarTower k k[X] K and IsScalarTower k[X] k⟮X⟯ K, together with FunctionField k K ( is finite-dimensional over ) and Algebra.IsSeparable k⟮X⟯ K. The full constant field hypothesis is IsFullConstantField k K. Places (FunctionField.Place k K) are valuation subrings containing the image of whose value group admits an order isomorphism with (only its existence is recorded); the normalized valuation is written multiplicatively, , so that reads for every place. Degrees of places and are Module.finrank over , and divisors are finitely supported functions from places to . The genus FunctionField.genus k K is defined as the natural-number truncation of the supremum in of the defects . The adele space is the restricted product of copies of over the intrinsic places; the divisor of a nonzero Weil differential is defined in the two-chart presentation of places (places over and places over infinity) and transported to intrinsic places. The canonical divisor W and the hypothesis hW : IsCanonical k K W are arguments of the theorem although W does not occur in the conclusion. Degrees and dimensions are compared in .
import Mathlib
import Definitions.Def_RiemannRoch_WeilDifferentials
/-
Contains code from riemann-roch-function-fields
(https://github.com/vaca22/riemann-roch-function-fields, commit dbca5bee),
Copyright (c) 2026 Guanghao Li, released under the Apache License 2.0
(https://www.apache.org/licenses/LICENSE-2.0).
Modified: ported to Lean v4.33.1 / Mathlib 0df444a (module headers converted, some proofs
adapted to this Mathlib, a few names qualified, `picTorsor` omitted; statements unchanged), then
split into prove2.me definitions and theorems, with comments removed.
-/
open scoped nonZeroDivisors Polynomial RatFunc WithZero
open FunctionField
open Chart
variable (k K : Type*) [Field k] [Field K] [Algebra k K]
variable [Algebra k[X] K] [Algebra k⟮X⟯ K]
[IsScalarTower k k[X] K] [IsScalarTower k[X] k⟮X⟯ K] [_root_.FunctionField k K]
[Algebra.IsSeparable k⟮X⟯ K] [IsFullConstantField k K]
variable {W : Divisor k K} (hW : IsCanonical k K W)
include hWtheorem FunctionField.ell_eq_of_deg_ge (D : Divisor k K)
(hdeg : D.deg ≥ 2 * (genus k K : ℤ) - 1) :
(ell k K D : ℤ) = D.deg + 1 - (genus k K : ℤ) := by sorry