A canonical divisor has degree
ProvedFunctionField.deg_canonicalLet 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 .
Then every canonical divisor of satisfies
Together with , this is the basic numerical description of canonical divisors; for example, an elliptic function field () has canonical divisors of degree .
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 identity is stated 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.deg_canonical : W.deg = 2 * (genus k K : ℤ) - 2 := by sorry