Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Intrinsic divisors and adeles of a function field, and pole divisors (x)∞(x)_\infty(x)∞​

Definition
RiemannRoch_IntrinsicAdeles

by Idealson · Oct 20, 2026 · Mathlib 0df444a (Lean v4.33.1)

adelesdivisorsfunction-fieldsriemann-roch

Throughout, kkk is a field and KKK is a field together with compatible embeddings k[X]⊂k(X)⊂Kk[X]\subset k(X)\subset Kk[X]⊂k(X)⊂K such that K/k(X)K/k(X)K/k(X) is a finite separable extension; KKK is thus an algebraic function field in one variable over kkk, presented together with the transcendental element x=X∈Kx=X\in Kx=X∈K. Write O∞={f∈k(X):deg⁡f≤0}\mathcal O_\infty=\{f\in k(X):\deg f\le0\}O∞​={f∈k(X):degf≤0} for the valuation ring at infinity of k(X)k(X)k(X) (with deg⁡f=deg⁡(numerator)−deg⁡(denominator)\deg f=\deg(\text{numerator})-\deg(\text{denominator})degf=deg(numerator)−deg(denominator)) and m∞\mathfrak m_\inftym∞​ for its maximal ideal, OK\mathcal O_KOK​ for the integral closure of k[X]k[X]k[X] in KKK and OK,∞\mathcal O_{K,\infty}OK,∞​ for the integral closure of O∞\mathcal O_\inftyO∞​ in KKK. The chart places are the elements of PKch=Spec⁡1(OK)⊔Spec⁡1(OK,∞)\mathbb P^{\mathrm{ch}}_K=\operatorname{Spec}^1(\mathcal O_K)\sqcup\operatorname{Spec}^1(\mathcal O_{K,\infty})PKch​=Spec1(OK​)⊔Spec1(OK,∞​) (finite and infinite places), vPv_PvP​ is the normalized PPP-adic valuation, deg⁡P=dim⁡k(O/P)\deg P=\dim_k(\mathcal O/P)degP=dimk​(O/P) for the relevant Dedekind domain O\mathcal OO, and a chart divisor is a finitely supported D:PKch→ZD:\mathbb P^{\mathrm{ch}}_K\to\mathbb ZD:PKch​→Z with deg⁡D=∑PD(P)deg⁡P\deg D=\sum_P D(P)\deg PdegD=∑P​D(P)degP. Let AK\mathcal A_KAK​, AK(D)\mathcal A_K(D)AK​(D) and K~\widetilde KK be the chart adele space, its filtration and the principal adeles (file RiemannRoch_Adeles), L(D)\mathcal L(D)L(D), ℓ(D)\ell(D)ℓ(D) the Riemann–Roch space and its dimension, and let P↦PintP\mapsto P^{\mathrm{int}}P↦Pint be the bijection from chart places to intrinsic places (valuation subrings O⊊K\mathcal O\subsetneq KO⊊K containing kkk with value group ≅Z\cong\mathbb Z≅Z).

This file transfers the divisor and adele theory to intrinsic places and introduces pole divisors. It introduces:

  1. Comparison of local data. kkk-algebra isomorphisms between the valuation ring of a chart place PPP (the localization at PPP) and that of PintP^{\mathrm{int}}Pint, and between their residue fields; hence deg⁡Pint=deg⁡P\deg P^{\mathrm{int}}=\deg PdegPint=degP.
  2. Intrinsic divisors. Div⁡(K)=⨁QZ Q\operatorname{Div}(K)=\bigoplus_{Q}\mathbb Z\,QDiv(K)=⨁Q​ZQ over intrinsic places, its isomorphism with chart divisors induced by P↦PintP\mapsto P^{\mathrm{int}}P↦Pint, the principal divisor div⁡(x)\operatorname{div}(x)div(x) of x∈K×x\in K^\timesx∈K× (transported from the chart one) and the degree deg⁡D=∑QD(Q)deg⁡Q\deg D=\sum_Q D(Q)\deg QdegD=∑Q​D(Q)degQ.
  3. Intrinsic adeles. The adele space on intrinsic places (families (αQ)(\alpha_Q)(αQ​) in KKK, integral at almost all QQQ), a KKK-module, with its filtration AK(D)={α:vQ(αQ)≥−D(Q) ∀Q}\mathcal A_K(D)=\{\alpha: v_Q(\alpha_Q)\ge-D(Q)\ \forall Q\}AK​(D)={α:vQ​(αQ​)≥−D(Q) ∀Q} and diagonal; a kkk-linear isomorphism with the chart adele space which matches the filtrations, the diagonals and the sums AK(D)+K~\mathcal A_K(D)+\widetilde KAK​(D)+K.
  4. Pole divisors. For x∈Kx\in Kx∈K, the chart pole divisor
(x)∞=max⁡(−div⁡(x),0),(0)∞=0,(x)_\infty=\max\big(-\operatorname{div}(x),0\big),\qquad (0)_\infty=0,(x)∞​=max(−div(x),0),(0)∞​=0,

and for a finite family (fi)(f_i)(fi​) the bound B=∑i(fi)∞B=\sum_i(f_i)_\inftyB=∑i​(fi​)∞​. 5. The chart variable. The element xK∈Kx_K\in KxK​∈K, image of X∈k(X)X\in k(X)X∈k(X), and the subfield k(x)⊆Kk(x)\subseteq Kk(x)⊆K generated by an element xxx.

It also contains the structural lemmas needed below: powers 1,x,…,xr1,x,\dots,x^r1,x,…,xr of an element transcendental over kkk are linearly independent; (x)∞≥0(x)_\infty\ge0(x)∞​≥0; if x≠0x\ne0x=0 is not algebraic over kkk then vP(x)<0v_P(x)<0vP​(x)<0 for some chart place and deg⁡(x)∞>0\deg(x)_\infty>0deg(x)∞​>0; xn∈L(n (x)∞)x^n\in\mathcal L(n\,(x)_\infty)xn∈L(n(x)∞​), fi xj∈L(B+r (x)∞)f_i\,x^j\in\mathcal L(B+r\,(x)_\infty)fi​xj∈L(B+r(x)∞​) for j≤rj\le rj≤r; xKx_KxK​ is transcendental over kkk; for a basis b1,…,bnb_1,\dots,b_nb1​,…,bn​ of K/k(X)K/k(X)K/k(X) the products bixKjb_i x_K^jbi​xKj​ are kkk-linearly independent, so that n(r+1)≤ℓ(B+r (xK)∞)n(r+1)\le\ell(B+r\,(x_K)_\infty)n(r+1)≤ℓ(B+r(xK​)∞​); an elementary inequality (n(r+1)≤dr+cn(r+1)\le dr+cn(r+1)≤dr+c for all rrr implies n≤dn\le dn≤d); and, when kkk is the full constant field,

[K:k(X)]≤deg⁡ (xK)∞.[K:k(X)]\le\deg\,(x_K)_\infty .[K:k(X)]≤deg(xK​)∞​.

Intrinsic divisors and adeles are the setting of the final, coordinate-free statements; the pole divisor of xKx_KxK​ is the tool for proving that the genus is finite. In the chain of definition files it imports RiemannRoch_Adeles and is imported by RiemannRoch_GenusCharts.

Formalization Note The function field is not constructed from kkk: KKK is an arbitrary field carrying the instances Algebra k[X] K, Algebra k⟮X⟯ K, IsScalarTower k[X] k⟮X⟯ K, Mathlib's FunctionField k K (i.e. KKK is finite-dimensional over k(X)k(X)k(X)) and Algebra.IsSeparable k⟮X⟯ K; when constants are needed, also Algebra k K with IsScalarTower k k[X] K. Intrinsic divisors are FunctionField.Divisor k K := Place k K →₀ ℤ, with divisorEquivChart : DivisorA k K ≃+ Divisor k K (Finsupp.domCongr chartToPlace), FunctionField.principalDivisor and Divisor.deg. The intrinsic adele space is FunctionField.AdeleSpace k K, with adeleEquivChart : AdeleSpace k K ≃ₗ[k] Chart.AdeleSpace k K. The pole divisor is FunctionField.Chart.polarDivisor, the bound is basisPoleBound, xKx_KxK​ is XK k K and k(x)k(x)k(x) is rationalSubfield (Mathlib's IntermediateField.adjoin k {x}). The last inequality is stated with Module.finrank k⟮X⟯ K and assumes IsFullConstantField k K. Valuations take values in Zm0={0}∪{exp⁡(n):n∈Z}\mathbb Z_{m0}=\{0\}\cup\{\exp(n):n\in\mathbb Z\}Zm0​={0}∪{exp(n):n∈Z}, written multiplicatively, so that the Lean valuation of f≠0f\ne0f=0 at PPP is exp⁡(−vP(f))\exp(-v_P(f))exp(−vP​(f)); the inequality exp⁡(−vP(f))≤exp⁡(D(P))\exp(-v_P(f))\le\exp(D(P))exp(−vP​(f))≤exp(D(P)) is the additive condition vP(f)≥−D(P)v_P(f)\ge -D(P)vP​(f)≥−D(P).

Definition code
import Mathlib
import Definitions.Def_RiemannRoch_Adeles

/-
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.
-/

set_option linter.style.haveILetI false

section
section
open scoped nonZeroDivisors Polynomial RatFunc WithZero
noncomputable section
namespace FunctionField
open Chart
variable (k K : Type*) [Field k] [Field K]
  [Algebra k K] [Algebra k[X] K] [Algebra k⟮X⟯ K]
  [IsScalarTower k k[X] K] [IsScalarTower k[X] k⟮X⟯ K] [FunctionField k K]
  [Algebra.IsSeparable k⟮X⟯ K]
local instance instDecidableEqRatFuncCoordinateFreeDivisor : DecidableEq k⟮X⟯ :=
  Classical.decEq _
namespace Place
noncomputable local instance finiteVspAlgebra
    (w : IsDedekindDomain.HeightOneSpectrum (ringOfIntegers k K)) :
    Algebra k (IsDedekindDomain.HeightOneSpectrum.valuationSubringAtPrime K w) :=
  ((algebraMap (ringOfIntegers k K)
    (IsDedekindDomain.HeightOneSpectrum.valuationSubringAtPrime K w)).comp
      (algebraMap k (ringOfIntegers k K))).toAlgebra
local instance finiteVspTower
    (w : IsDedekindDomain.HeightOneSpectrum (ringOfIntegers k K)) :
    IsScalarTower k (ringOfIntegers k K)
      (IsDedekindDomain.HeightOneSpectrum.valuationSubringAtPrime K w) :=
  IsScalarTower.of_algebraMap_eq fun _ => rfl
noncomputable def finiteValuationSubringAlgEquiv
    (w : IsDedekindDomain.HeightOneSpectrum (ringOfIntegers k K)) :
    IsDedekindDomain.HeightOneSpectrum.valuationSubringAtPrime K w ≃ₐ[k]
      (Place.ofChart k K (Sum.inl w)).toValuationSubring := by
  let e : (IsDedekindDomain.HeightOneSpectrum.valuationSubringAtPrime K w).toSubring ≃+*
      (Place.ofChart k K (Sum.inl w)).toValuationSubring.toSubring :=
    RingEquiv.subringCongr <| congrArg ValuationSubring.toSubring <|
      (IsDedekindDomain.HeightOneSpectrum.valuationSubringAtPrime_eq_valuationSubring
        (K := K) (v := w)).trans (Place.ofChart_toValuationSubring k K (Sum.inl w)).symm
  exact
    { __ := e
      commutes' := fun c => by
        apply Subtype.ext
        change algebraMap (ringOfIntegers k K) K
          (algebraMap k (ringOfIntegers k K) c) = algebraMap k K c
        exact (IsScalarTower.algebraMap_apply k (ringOfIntegers k K) K c).symm }
noncomputable def finiteResidueAlgEquiv
    (w : IsDedekindDomain.HeightOneSpectrum (ringOfIntegers k K)) :
    (ringOfIntegers k K ⧸ w.asIdeal) ≃ₐ[k]
      (Place.ofChart k K (Sum.inl w)).residueField := by
  let e₀ : (ringOfIntegers k K ⧸ w.asIdeal) ≃ₐ[k] w.asIdeal.ResidueField :=
    AlgEquiv.ofBijective
      (IsScalarTower.toAlgHom k (ringOfIntegers k K ⧸ w.asIdeal) w.asIdeal.ResidueField)
      (Ideal.bijective_algebraMap_quotient_residueField w.asIdeal)
  let e₁ : w.asIdeal.ResidueField ≃ₐ[k]
      IsLocalRing.ResidueField
        (IsDedekindDomain.HeightOneSpectrum.valuationSubringAtPrime K w) :=
    IsLocalRing.ResidueField.mapAlgEquiv
      ((IsDedekindDomain.HeightOneSpectrum.localizationAlgEquiv (K := K) w).restrictScalars k)
  let e₂ : IsLocalRing.ResidueField
      (IsDedekindDomain.HeightOneSpectrum.valuationSubringAtPrime K w) ≃ₐ[k]
      (Place.ofChart k K (Sum.inl w)).residueField :=
    IsLocalRing.ResidueField.mapAlgEquiv (finiteValuationSubringAlgEquiv k K w)
  exact e₀.trans (e₁.trans e₂)
theorem finite_degree_eq (w : IsDedekindDomain.HeightOneSpectrum (ringOfIntegers k K)) :
    (Place.ofChart k K (Sum.inl w)).degree = placeDegree k K (Sum.inl w) := by
  exact (finiteResidueAlgEquiv k K w).toLinearEquiv.finrank_eq.symm
noncomputable local instance infiniteVspAlgebra
    (w : IsDedekindDomain.HeightOneSpectrum (infiniteIntegers k K)) :
    Algebra k (IsDedekindDomain.HeightOneSpectrum.valuationSubringAtPrime K w) :=
  ((algebraMap (infiniteIntegers k K)
    (IsDedekindDomain.HeightOneSpectrum.valuationSubringAtPrime K w)).comp
      (algebraMap k (infiniteIntegers k K))).toAlgebra
local instance infiniteVspTower
    (w : IsDedekindDomain.HeightOneSpectrum (infiniteIntegers k K)) :
    IsScalarTower k (infiniteIntegers k K)
      (IsDedekindDomain.HeightOneSpectrum.valuationSubringAtPrime K w) :=
  IsScalarTower.of_algebraMap_eq fun _ => rfl
noncomputable def infiniteValuationSubringAlgEquiv
    (w : IsDedekindDomain.HeightOneSpectrum (infiniteIntegers k K)) :
    IsDedekindDomain.HeightOneSpectrum.valuationSubringAtPrime K w ≃ₐ[k]
      (Place.ofChart k K (Sum.inr w)).toValuationSubring := by
  let e : (IsDedekindDomain.HeightOneSpectrum.valuationSubringAtPrime K w).toSubring ≃+*
      (Place.ofChart k K (Sum.inr w)).toValuationSubring.toSubring :=
    RingEquiv.subringCongr <| congrArg ValuationSubring.toSubring <|
      (IsDedekindDomain.HeightOneSpectrum.valuationSubringAtPrime_eq_valuationSubring
        (K := K) (v := w)).trans (Place.ofChart_toValuationSubring k K (Sum.inr w)).symm
  exact
    { __ := e
      commutes' := fun c => by
        apply Subtype.ext
        change algebraMap (infiniteIntegers k K) K
          (algebraMap k (infiniteIntegers k K) c) = algebraMap k K c
        exact (IsScalarTower.algebraMap_apply k (infiniteIntegers k K) K c).symm }
noncomputable def infiniteResidueAlgEquiv
    (w : IsDedekindDomain.HeightOneSpectrum (infiniteIntegers k K)) :
    (infiniteIntegers k K ⧸ w.asIdeal) ≃ₐ[k]
      (Place.ofChart k K (Sum.inr w)).residueField := by
  let e₀ : (infiniteIntegers k K ⧸ w.asIdeal) ≃ₐ[k] w.asIdeal.ResidueField :=
    AlgEquiv.ofBijective
      (IsScalarTower.toAlgHom k (infiniteIntegers k K ⧸ w.asIdeal) w.asIdeal.ResidueField)
      (Ideal.bijective_algebraMap_quotient_residueField w.asIdeal)
  let e₁ : w.asIdeal.ResidueField ≃ₐ[k]
      IsLocalRing.ResidueField
        (IsDedekindDomain.HeightOneSpectrum.valuationSubringAtPrime K w) :=
    IsLocalRing.ResidueField.mapAlgEquiv
      ((IsDedekindDomain.HeightOneSpectrum.localizationAlgEquiv (K := K) w).restrictScalars k)
  let e₂ : IsLocalRing.ResidueField
      (IsDedekindDomain.HeightOneSpectrum.valuationSubringAtPrime K w) ≃ₐ[k]
      (Place.ofChart k K (Sum.inr w)).residueField :=
    IsLocalRing.ResidueField.mapAlgEquiv (infiniteValuationSubringAlgEquiv k K w)
  exact e₀.trans (e₁.trans e₂)
theorem infinite_degree_eq (w : IsDedekindDomain.HeightOneSpectrum (infiniteIntegers k K)) :
    (Place.ofChart k K (Sum.inr w)).degree = placeDegree k K (Sum.inr w) := by
  exact (infiniteResidueAlgEquiv k K w).toLinearEquiv.finrank_eq.symm
end Place
theorem placeDegree_eq (w : PlaceA k K) :
    placeDegree k K w = (chartToPlace k K w).degree := by
  rcases w with w | w
  · exact (Place.finite_degree_eq k K w).symm
  · exact (Place.infinite_degree_eq k K w).symm
abbrev Divisor := Place k K →₀ ℤ
noncomputable def divisorEquivChart : DivisorA k K ≃+ Divisor k K :=
  Finsupp.domCongr (chartToPlace k K)
noncomputable def principalDivisor : Additive Kˣ →+ Divisor k K :=
  (divisorEquivChart k K).toAddMonoidHom.comp (principalDivisorA k K)
namespace Divisor
noncomputable def deg (D : Divisor k K) : ℤ :=
  D.sum fun v n => n * (v.degree : ℤ)
end Divisor
end FunctionField
end
end
end

section
section
open scoped nonZeroDivisors Polynomial RatFunc WithZero
open Filter
noncomputable section
namespace FunctionField
open Chart
variable (k K : Type*) [Field k] [Field K]
variable [Algebra k K] [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]
def adeleSubmodule : Submodule k (Place k K → K) where
  carrier := {a | ∀ᶠ v in cofinite, a v ∈ v.toValuationSubring}
  zero_mem' := by
    change ∀ᶠ v : Place k K in cofinite, (0 : K) ∈ v.toValuationSubring
    exact Filter.Eventually.of_forall fun v => v.toValuationSubring.zero_mem
  add_mem' {a b} ha hb := by
    change ∀ᶠ v in cofinite, a v ∈ v.toValuationSubring at ha
    change ∀ᶠ v in cofinite, b v ∈ v.toValuationSubring at hb
    change ∀ᶠ v in cofinite, (a + b) v ∈ v.toValuationSubring
    exact (ha.and hb).mono fun _ h => add_mem h.1 h.2
  smul_mem' c a ha := by
    change ∀ᶠ v in cofinite, a v ∈ v.toValuationSubring at ha
    change ∀ᶠ v in cofinite, (c • a) v ∈ v.toValuationSubring
    filter_upwards [ha] with v hv
    rw [Pi.smul_apply, Algebra.smul_def]
    exact mul_mem (v.triv_on_k c) hv
abbrev AdeleSpace := adeleSubmodule k K
theorem eventually_mem_place (f : K) :
    ∀ᶠ v : Place k K in cofinite, f ∈ v.toValuationSubring := by
  have h := Chart.eventually_mem_placeValuationSubring k K f
  have h' := (chartToPlace k K).symm.injective.tendsto_cofinite.eventually h
  filter_upwards [h'] with v hv
  rw [← (chartToPlace k K).apply_symm_apply v, chartToPlace_apply,
    Place.ofChart_toValuationSubring]
  exact hv
noncomputable def adeleEquivChart : AdeleSpace k K ≃ₗ[k] Chart.AdeleSpace k K where
  toFun a := ⟨fun w => a.1 (chartToPlace k K w), by
    have ha := (chartToPlace k K).injective.tendsto_cofinite.eventually a.property
    filter_upwards [ha] with w hw
    rw [placeValuationSubring, ← Place.ofChart_toValuationSubring]
    exact hw⟩
  invFun a := ⟨fun v => a.1 ((chartToPlace k K).symm v), by
    have ha := (chartToPlace k K).symm.injective.tendsto_cofinite.eventually a.property
    filter_upwards [ha] with v hv
    have hs : v.toValuationSubring =
        placeValuationSubring k K ((chartToPlace k K).symm v) := by
      rw [placeValuationSubring, ← Place.ofChart_toValuationSubring]
      exact congrArg Place.toValuationSubring
        ((chartToPlace k K).apply_symm_apply v).symm
    rw [hs]
    exact hv⟩
  left_inv a := by
    apply Subtype.ext
    funext v
    exact congrArg a.1 ((chartToPlace k K).apply_symm_apply v)
  right_inv a := by
    apply Subtype.ext
    funext w
    exact congrArg a.1 ((chartToPlace k K).symm_apply_apply w)
  map_add' _ _ := rfl
  map_smul' _ _ := rfl
@[simp]
theorem adeleEquivChart_apply (a : AdeleSpace k K) (w : PlaceA k K) :
    (adeleEquivChart k K a).1 w = a.1 (chartToPlace k K w) :=
  rfl
@[simp]
theorem adeleEquivChart_symm_apply (a : Chart.AdeleSpace k K) (v : Place k K) :
    ((adeleEquivChart k K).symm a).1 v = a.1 ((chartToPlace k K).symm v) :=
  rfl
def smulAdele (x : K) (a : AdeleSpace k K) : AdeleSpace k K :=
  ⟨fun v => x * a.1 v, (eventually_mem_place k K x).and a.property |>.mono
    fun _ h => mul_mem h.1 h.2⟩
instance : SMul K (AdeleSpace k K) := ⟨smulAdele k K⟩
instance : Module K (AdeleSpace k K) :=
  Module.ofMinimalAxioms
    (fun _ _ _ => Subtype.ext <| funext fun _ => mul_add _ _ _)
    (fun _ _ _ => Subtype.ext <| funext fun _ => add_mul _ _ _)
    (fun _ _ _ => Subtype.ext <| funext fun _ => mul_assoc _ _ _)
    (fun _ => Subtype.ext <| funext fun _ => one_mul _)
def mulAdeleLinear (x : K) : AdeleSpace k K →ₗ[k] AdeleSpace k K where
  toFun a := x • a
  map_add' _ _ := smul_add x _ _
  map_smul' c a := by
    ext v
    change x * (c • a.1 v) = c • (x * a.1 v)
    simp only [Algebra.smul_def]
    ring
def memAdeleFilt (D : Divisor k K) (a : AdeleSpace k K) : Prop :=
  ∀ v, v.valuation (a.1 v) ≤ WithZero.exp (D v)
def adeleFilt (D : Divisor k K) : Submodule k (AdeleSpace k K) where
  carrier := {a | memAdeleFilt k K D a}
  zero_mem' := fun _ => by simp
  add_mem' {a b} ha hb := fun v =>
    (v.valuation.map_add (a.1 v) (b.1 v)).trans (max_le (ha v) (hb v))
  smul_mem' c a ha := by
    intro v
    change v.valuation (c • a.1 v) ≤ _
    rw [Algebra.smul_def, map_mul]
    have hc : v.valuation (algebraMap k K c) ≤ 1 := by
      rw [← Valuation.mem_valuationSubring_iff, Place.valuationSubring_valuation]
      exact v.triv_on_k c
    exact (mul_le_mul' hc (ha v)).trans_eq (one_mul _)
theorem mem_adeleFilt_equivChart (D : Divisor k K) (a : AdeleSpace k K) :
    adeleEquivChart k K a ∈
        Chart.adeleFilt k K ((divisorEquivChart k K).symm D) ↔
      a ∈ adeleFilt k K D := by
  constructor
  · intro ha v
    let w := (chartToPlace k K).symm v
    have hw := ha w
    rw [← placeValuation_eq] at hw
    simpa [w, divisorEquivChart, Finsupp.domCongr_apply] using hw
  · intro ha w
    have hv := ha (chartToPlace k K w)
    rw [placeValuation_eq] at hv
    simpa [divisorEquivChart, Finsupp.domCongr_apply] using hv
omit [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] in
theorem adeleFilt_mono {D E : Divisor k K} (h : D ≤ E) :
    adeleFilt k K D ≤ adeleFilt k K E := by
  intro a ha v
  exact (ha v).trans (WithZero.exp_le_exp.mpr (h v))
def diagonal : K →ₗ[k] AdeleSpace k K where
  toFun f := ⟨fun _ => f, eventually_mem_place k K f⟩
  map_add' _ _ := rfl
  map_smul' _ _ := rfl
def diagonalSubmodule : Submodule k (AdeleSpace k K) :=
  LinearMap.range (diagonal k K)
@[simp]
theorem adeleEquivChart_diagonal (f : K) :
    adeleEquivChart k K (diagonal k K f) = Chart.diagonal k K f := by
  ext w
  change f = f
  rfl
theorem map_adeleFilt_equivChart (D : Divisor k K) :
    Submodule.map (adeleEquivChart k K).toLinearMap (adeleFilt k K D) =
      Chart.adeleFilt k K ((divisorEquivChart k K).symm D) := by
  ext a
  constructor
  · rintro ⟨b, hb, rfl⟩
    exact (mem_adeleFilt_equivChart k K D b).2 hb
  · intro ha
    refine ⟨(adeleEquivChart k K).symm a, ?_, by simp⟩
    exact (mem_adeleFilt_equivChart k K D _).1 (by simpa using ha)
theorem map_diagonalSubmodule_equivChart :
    Submodule.map (adeleEquivChart k K).toLinearMap (diagonalSubmodule k K) =
      Chart.diagonalSubmodule k K := by
  ext a
  constructor
  · rintro ⟨b, ⟨f, rfl⟩, rfl⟩
    exact ⟨f, (adeleEquivChart_diagonal k K f).symm⟩
  · rintro ⟨f, rfl⟩
    exact ⟨diagonal k K f, ⟨f, rfl⟩, adeleEquivChart_diagonal k K f⟩
theorem map_adeleFilt_add_diagonal_equivChart (D : Divisor k K) :
    Submodule.map (adeleEquivChart k K).toLinearMap
        (adeleFilt k K D + diagonalSubmodule k K) =
      Chart.adeleFilt k K ((divisorEquivChart k K).symm D) +
        Chart.diagonalSubmodule k K := by
  rw [Submodule.add_eq_sup,
    Submodule.map_sup (adeleFilt k K D) (diagonalSubmodule k K)
      (adeleEquivChart k K).toLinearMap,
    map_adeleFilt_equivChart,
    map_diagonalSubmodule_equivChart, ← Submodule.add_eq_sup]
theorem mem_adeleFilt_add_diagonal_equivChart (D : Divisor k K) (a : AdeleSpace k K) :
    adeleEquivChart k K a ∈
        Chart.adeleFilt k K ((divisorEquivChart k K).symm D) +
          Chart.diagonalSubmodule k K ↔
      a ∈ adeleFilt k K D + diagonalSubmodule k K := by
  rw [← map_adeleFilt_add_diagonal_equivChart k K D]
  constructor
  · rintro ⟨b, hb, hba⟩
    exact (adeleEquivChart k K).injective hba |>.symm ▸ hb
  · intro ha
    exact ⟨a, ha, rfl⟩
end FunctionField
end
end
end

section
section
open scoped nonZeroDivisors Polynomial RatFunc WithZero
open Polynomial BigOperators Submodule IntermediateField
noncomputable section
namespace FunctionField.Chart
section TranscendentalPowers
variable (k L : Type*) [Field k] [Field L] [Algebra k L]
theorem linearIndependent_fin_pow_of_transcendental {x : L} (hx : Transcendental k x) (r : ℕ) :
    LinearIndependent k fun j : Fin (r + 1) => x ^ (j : ℕ) := by
  rw [Fintype.linearIndependent_iff]
  intro g hg j
  let p : k[X] := ∑ i : Fin (r + 1), C (g i) * X ^ (i : ℕ)
  have hzero : aeval x p = 0 := by
    have hsum : aeval x p = ∑ i : Fin (r + 1), g i • x ^ (i : ℕ) := by
      simp only [p, map_sum, map_mul, aeval_C]
      congr 1
      ext i
      rw [aeval_X_pow, Algebra.smul_def, mul_comm]
    rw [hsum, hg]
  have hp0 : p = 0 := (transcendental_iff.mp hx) p hzero
  have hcoeffj : g j = 0 := by
    have hpgj : g j = p.coeff (j : ℕ) := by
      classical
      dsimp only [p]
      rw [finsetSum_coeff, Finset.sum_eq_single j]
      · rw [coeff_C_mul_X_pow, if_pos rfl]
      · intro b _ ne
        rw [coeff_C_mul_X_pow]
        split_ifs with h
        · exact absurd h (Fin.val_ne_of_ne ne.symm)
        · rfl
      · simp
    rw [hpgj, hp0, coeff_zero]
  exact hcoeffj
end TranscendentalPowers
variable (k K : Type*) [Field k] [Field K]
variable [Algebra k K] [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]
variable [IsFullConstantField k K]
local instance instDecidableEqPlaceAPolar : DecidableEq (PlaceA k K) := Classical.decEq _
local instance instDecidableEqRatFuncPolar : DecidableEq k⟮X⟯ := Classical.decEq _
section PolarDivisor
noncomputable def polarDivisor (x : K) : DivisorA k K :=
  by
  classical
  exact if hx : x = 0 then 0
    else (-principalDivisorA k K (Additive.ofMul (Units.mk0 x hx))) ⊔ 0
omit [Algebra k K] [IsScalarTower k k[X] K] [IsFullConstantField k K] in
theorem polarDivisor_nonneg (x : K) : 0 ≤ polarDivisor k K x := by
  unfold polarDivisor
  split_ifs with hx
  · simp
  · exact le_sup_right
omit [IsFullConstantField k K] in
theorem exists_placeValuation_gt_one_of_not_algebraic {x : K} (_hx : x ≠ 0)
    (hnt : ¬IsAlgebraic k x) :
    ∃ v : PlaceA k K, 1 < placeValuation k K v x := by
  by_cases h : ∃ v : PlaceA k K, 1 < placeValuation k K v x
  · exact h
  · push Not at h
    exact absurd (isAlgebraic_of_placeValuation_le_one k K x h) hnt
omit [IsFullConstantField k K] in
theorem polarDivisor_pos {x : K} (hx : x ≠ 0) (hnt : ¬IsAlgebraic k x) :
    0 < deg k K (polarDivisor k K x) := by
  obtain ⟨v, hvgt⟩ := exists_placeValuation_gt_one_of_not_algebraic k K hx hnt
  have hvpos : 0 < placeDegree k K v := placeDegree_pos k K v
  have hord : 0 < (polarDivisor k K x) v := by
    unfold polarDivisor
    split_ifs with hx0
    · exact absurd hx0 hx
    · have hvval := placeValuation_eq_exp_neg_principalDivisor k K
        (Additive.ofMul (Units.mk0 x hx)) v
      change 1 < placeValuation k K v x at hvgt
      change placeValuation k K v x =
        WithZero.exp (-(principalDivisorA k K (Additive.ofMul (Units.mk0 x hx)) v)) at hvval
      rw [hvval] at hvgt
      let t := -(principalDivisorA k K (Additive.ofMul (Units.mk0 x hx)) v)
      have hexp1 : 1 < WithZero.exp t := hvgt
      have ht : 0 < t := by
        have hexpne : WithZero.exp t ≠ 0 := WithZero.exp_pos.ne'
        have hlog : WithZero.log 1 < WithZero.log (WithZero.exp t) :=
          (WithZero.log_lt_log one_ne_zero hexpne).2 hexp1
        rw [WithZero.log_one, WithZero.log_exp] at hlog
        exact hlog
      rw [Finsupp.sup_apply]
      exact lt_sup_iff.2 (Or.inl ht)
  have hsingle : Finsupp.single v (polarDivisor k K x v) ≤ polarDivisor k K x := by
    intro w
    by_cases hw : w = v
    · subst hw
      simp only [Finsupp.single_apply, if_pos]
      exact le_rfl
    · rw [Finsupp.single_apply, if_neg (Ne.symm hw)]
      exact polarDivisor_nonneg k K x w
  have hle : (placeDegree k K v : ℤ) * (polarDivisor k K x v) ≤
      deg k K (polarDivisor k K x) := by
    rw [← mul_comm (polarDivisor k K x v : ℤ), ← deg_single k K v (polarDivisor k K x v)]
    exact deg_mono k K hsingle
  have hdeg : 0 < (placeDegree k K v : ℤ) * (polarDivisor k K x v) := by
    exact mul_pos (mod_cast hvpos) (mod_cast hord)
  exact lt_of_lt_of_le hdeg hle
theorem le_of_forall_nat_mul_le {n d c : ℕ} (_hd : 0 < d)
    (h : ∀ r : ℕ, n * (r + 1) ≤ d * r + c) : n ≤ d := by
  by_contra hn
  have hn' : d < n := lt_of_not_ge hn
  have hnd : 0 < n - d := tsub_pos_of_lt hn'
  have step : ∀ r : ℕ, (n - d) * r + n ≤ c := by
    intro r
    have hr := h r
    have hsuc : n * (r + 1) = n * r + n := Nat.mul_succ n r
    have hn_eq : d + (n - d) = n := by rw [Nat.add_comm, Nat.sub_add_cancel (Nat.le_of_lt hn')]
    have hsplit : n * r = d * r + (n - d) * r := by
      conv_lhs => arg 1; rw [← hn_eq]
      exact add_mul d (n - d) r
    rw [hsuc, hsplit] at hr
    have hr' : (n - d) * r + n ≤ c := by omega
    exact hr'
  have _hnc : n ≤ c := by simpa [Nat.mul_zero, Nat.zero_add] using step 0
  have bound : ∀ r : ℕ, (n - d) * r ≤ c - n := by
    intro r
    have := step r
    omega
  set q := (c - n) / (n - d)
  have hq_lt : c - n < (q + 1) * (n - d) := by
    have hmod := Nat.mod_lt (c - n) hnd
    calc c - n
        = (n - d) * q + (c - n) % (n - d) := (Nat.div_add_mod (c - n) (n - d)).symm
      _ = q * (n - d) + (c - n) % (n - d) := by rw [Nat.mul_comm]
      _ < q * (n - d) + (n - d) := by gcongr
      _ = (q + 1) * (n - d) := by ring_nf
  have hcontra := bound (q + 1)
  rw [Nat.mul_comm] at hcontra
  exact lt_irrefl _ (Nat.lt_of_le_of_lt hcontra hq_lt)
omit [Algebra k K] [IsScalarTower k k[X] K] [IsFullConstantField k K] in
theorem memRRspace_polarDivisor_of_ne_zero {x : K} (hxne : x ≠ 0) :
    memRRspace k K (polarDivisor k K x) x := by
  intro v
  unfold polarDivisor
  split_ifs with hx0
  · exact absurd hx0 hxne
  · have hvval := placeValuation_eq_exp_neg_principalDivisor k K
      (Additive.ofMul (Units.mk0 x hx0)) v
    change placeValuation k K v x =
      WithZero.exp (-(principalDivisorA k K (Additive.ofMul (Units.mk0 x hx0)) v)) at hvval
    rw [hvval, Finsupp.sup_apply]
    exact WithZero.exp_le_exp.mpr (le_max_left _ 0)
omit [Algebra k K] [IsScalarTower k k[X] K] [IsFullConstantField k K] in
theorem memRRspace_smul_polar {x : K} (hxne : x ≠ 0) (n : ℕ) :
    memRRspace k K (n • polarDivisor k K x) (x ^ n) :=
  memRRspace.pow_mem (k := k) (K := K) (D := polarDivisor k K x) (f := x)
    (memRRspace_polarDivisor_of_ne_zero k K hxne) n
omit [Algebra k K] [IsScalarTower k k[X] K] [IsScalarTower k[X] k⟮X⟯ K]
  [_root_.FunctionField k K] [Algebra.IsSeparable k⟮X⟯ K] [IsFullConstantField k K] in
theorem nsmul_le_nsmul_polar {D : DivisorA k K} (hD : 0 ≤ D) {j r : ℕ} (hjr : j ≤ r) :
    j • D ≤ r • D := by
  intro v
  show (j : ℤ) * D v ≤ (r : ℤ) * D v
  exact mul_le_mul_of_nonneg_right (Nat.cast_le.mpr hjr) (hD v)
noncomputable def basisPoleBound {ι : Type*} [Fintype ι] (f : ι → K) : DivisorA k K :=
  (Finset.univ : Finset ι).sum fun i => polarDivisor k K (f i)
omit [Algebra k K] [IsScalarTower k k[X] K] [IsFullConstantField k K] in
theorem polarDivisor_le_basisPoleBound {ι : Type*} [Fintype ι] [DecidableEq ι]
    (f : ι → K) (i : ι) :
    polarDivisor k K (f i) ≤ basisPoleBound k K f := by
  classical
  simp only [basisPoleBound]
  rw [← Finset.add_sum_erase _ _ (Finset.mem_univ i)]
  exact le_add_of_nonneg_right (Finset.sum_nonneg fun j _ => polarDivisor_nonneg k K (f j))
omit [Algebra k K] [IsScalarTower k k[X] K] [IsFullConstantField k K] in
theorem basisPoleBound_nonneg {ι : Type*} [Fintype ι] (f : ι → K) :
    0 ≤ basisPoleBound k K f := by
  intro v
  change 0 ≤ (basisPoleBound k K f) v
  simp [basisPoleBound, Finset.sum_apply]
  exact Finset.sum_nonneg fun i _ => polarDivisor_nonneg k K (f i) v
omit [Algebra k K] [IsScalarTower k k[X] K] [IsFullConstantField k K] in
theorem memRRspace_basisPoleBound {ι : Type*} [Fintype ι] [DecidableEq ι]
    (f : ι → K) (i : ι) :
    memRRspace k K (basisPoleBound k K f) (f i) := by
  by_cases hi : f i = 0
  · rw [hi]
    exact memRRspace.zero_mem (k := k) (K := K) (basisPoleBound k K f)
  · exact (memRRspace.memRRspace_mono (k := k) (K := K) (polarDivisor_le_basisPoleBound k K f i))
      (memRRspace_polarDivisor_of_ne_zero k K hi)
omit [Algebra k K] [IsScalarTower k k[X] K] [IsFullConstantField k K] in
theorem memRRspace_basis_smul_x_pow {ι : Type*} [Fintype ι] [DecidableEq ι]
    (f : ι → K) (x : K)
    (hxne : x ≠ 0) (r : ℕ) (i : ι) (j : ℕ) (hj : j ≤ r) :
    memRRspace k K (basisPoleBound k K f + r • polarDivisor k K x) (f i * x ^ j) :=
  memRRspace.mul_mem (k := k) (K := K)
    (memRRspace_basisPoleBound k K f i)
    ((memRRspace.memRRspace_mono (k := k) (K := K)
        (nsmul_le_nsmul_polar (D := polarDivisor k K x) (hD := polarDivisor_nonneg k K x)
          (hjr := hj)))
      (memRRspace_smul_polar k K hxne j))
section ChartVariable
local instance instIsScalarTowerChart : IsScalarTower k k⟮X⟯ K :=
  IsScalarTower.of_algebraMap_eq fun c => by
    rw [IsScalarTower.algebraMap_apply k k[X] K,
      IsScalarTower.algebraMap_apply k[X] k⟮X⟯ K,
      ← IsScalarTower.algebraMap_apply k k[X] k⟮X⟯]
noncomputable def XK : K := algebraMap k⟮X⟯ K (RatFunc.X : k⟮X⟯)
omit [_root_.FunctionField k K] [Algebra.IsSeparable k⟮X⟯ K] [IsFullConstantField k K] in
theorem transcendental_XK : Transcendental k (XK k K) :=
  (transcendental_algebraMap_iff (algebraMap k⟮X⟯ K).injective).2 RatFunc.transcendental_X
omit [_root_.FunctionField k K] [Algebra.IsSeparable k⟮X⟯ K] [IsFullConstantField k K] in
theorem not_algebraic_XK : ¬IsAlgebraic k (XK k K) :=
  transcendental_XK k K
omit [_root_.FunctionField k K] [Algebra.IsSeparable k⟮X⟯ K] [IsFullConstantField k K] in
theorem XK_ne_zero : XK k K ≠ 0 := fun hx0 =>
  (not_algebraic_XK k K) (hx0 ▸ isAlgebraic_zero)
omit [_root_.FunctionField k K] [Algebra.IsSeparable k⟮X⟯ K] [IsFullConstantField k K] in
theorem linearIndependent_basis_smul_XK_pow {n r : ℕ}
    (b : Module.Basis (Fin n) k⟮X⟯ K) :
    LinearIndependent k fun p : Fin n × Fin (r + 1) =>
      (b p.1 : K) * (XK k K) ^ (p.2 : ℕ) := by
  rw [Fintype.linearIndependent_iff]
  intro g hg
  let s : Fin n → k⟮X⟯ := fun i =>
    ∑ j : Fin (r + 1), g (i, j) • RatFunc.X ^ (j : ℕ)
  have hsingle : ∀ i, algebraMap k⟮X⟯ K (s i) * (b i : K) =
      ∑ j : Fin (r + 1), g (i, j) • ((b i : K) * (XK k K) ^ (j : ℕ)) := by
    intro i
    dsimp only [s, XK]
    rw [map_sum, Finset.sum_mul]
    refine Finset.sum_congr rfl ?_
    intro j _
    simp only [Algebra.smul_def, map_mul, map_pow, mul_assoc, mul_comm (b i : K),
      IsScalarTower.algebraMap_apply k k⟮X⟯ K (g (i, j))]
  have hcombo : ∑ i : Fin n, algebraMap k⟮X⟯ K (s i) * (b i : K) = 0 := by
    rw [Finset.sum_congr rfl fun i _ => hsingle i, ← Finset.sum_product']
    exact hg
  have hcombo' : ∑ i : Fin n, s i • (b i : K) = 0 := by
    simpa only [Algebra.smul_def] using hcombo
  have hs : ∀ i, s i = 0 :=
    (Fintype.linearIndependent_iff.mp b.linearIndependent) s hcombo'
  intro p
  have hs' := hs p.1
  have hlin := linearIndependent_fin_pow_of_transcendental (k := k) (L := k⟮X⟯)
    RatFunc.transcendental_X r
  rw [Fintype.linearIndependent_iff] at hlin
  exact hlin (fun j => g (p.1, j)) (by dsimp only [s] at hs'; exact hs') p.2
omit [IsFullConstantField k K] in
theorem ell_family_ge {n r : ℕ} (b : Module.Basis (Fin n) k⟮X⟯ K) :
    n * (r + 1) ≤ ell k K (basisPoleBound k K b + r • polarDivisor k K (XK k K)) := by
  let C := basisPoleBound k K b
  let B := polarDivisor k K (XK k K)
  let x := XK k K
  have hx0 : x ≠ 0 := XK_ne_zero k K
  have hDnn : 0 ≤ C + r • B := add_nonneg (basisPoleBound_nonneg k K b) fun v =>
    mul_nonneg (Nat.cast_nonneg r) (polarDivisor_nonneg k K x v)
  let v : Fin n × Fin (r + 1) → K := fun p => (b p.1 : K) * x ^ (p.2 : ℕ)
  have hmem : ∀ p, v p ∈ RRspace k K (C + r • B) := by
    intro p
    rw [mem_RRspace_iff]
    exact memRRspace_basis_smul_x_pow (k := k) (K := K) (f := b) x hx0 r p.1 (p.2 : ℕ)
      (Nat.le_of_lt_succ (Fin.is_lt p.2))
  have hlin : LinearIndependent k v :=
    linearIndependent_basis_smul_XK_pow (k := k) (K := K) b
  have hsubset : span k (Set.range v) ≤ RRspace k K (C + r • B) := by
    refine span_le.mpr ?_
    rintro _ ⟨p, rfl⟩
    exact hmem p
  have hcard : n * (r + 1) ≤ Module.finrank k (span k (Set.range v)) := by
    have heq_card := finrank_span_eq_card (R := k) (M := K) hlin
    simp [heq_card, Fintype.card_prod, Fintype.card_fin]
  have hle : Module.finrank k (span k (Set.range v)) ≤ ell k K (C + r • B) :=
    Submodule.finrank_mono hsubset
  exact Nat.le_trans hcard hle
theorem finrank_le_deg_polarX :
    Module.finrank k⟮X⟯ K ≤ deg k K (polarDivisor k K (XK k K)) := by
  let n := Module.finrank k⟮X⟯ K
  let b := Module.finBasis k⟮X⟯ K
  let C := basisPoleBound k K b
  let B := polarDivisor k K (XK k K)
  have hx : ¬IsAlgebraic k (XK k K) := not_algebraic_XK k K
  have hx0 : XK k K ≠ 0 := XK_ne_zero k K
  have hBpos : 0 < deg k K B := polarDivisor_pos k K hx0 hx
  have hBnn : 0 ≤ B := polarDivisor_nonneg k K (XK k K)
  have hBeff : IsEffective k K B := hBnn
  have hdegB0 := deg_nonneg k K hBeff
  have hdpos : 0 < (deg k K B).toNat := by
    rw [← Int.toNat_of_nonneg hdegB0] at hBpos
    exact Int.ofNat_lt.mp hBpos
  have hmain : n ≤ (deg k K B).toNat :=
    le_of_forall_nat_mul_le (d := (deg k K B).toNat) (c := (deg k K C).toNat + 1) hdpos fun r => by
      let D := C + r • B
      have hDnn : 0 ≤ D := add_nonneg (basisPoleBound_nonneg k K b) fun v =>
        mul_nonneg (Nat.cast_nonneg r) (hBnn v)
      have hDeff : IsEffective k K D := hDnn
      have hCeff : IsEffective k K C := basisPoleBound_nonneg k K b
      have hell : (ell k K D : ℤ) ≤ deg k K D + 1 :=
        ell_le_nonneg (k := k) (K := K) hDnn
      have hdeg : deg k K D = deg k K C + (r : ℤ) * deg k K B := by
        rw [add_comm, ← nsmul_eq_mul, deg_add, deg_nsmul, nsmul_eq_mul, add_comm]
      have hell_nat : n * (r + 1) ≤ ell k K D :=
        ell_family_ge (k := k) (K := K) (n := n) (r := r) b
      have hbound : (n * (r + 1) : ℤ) ≤ deg k K D + 1 :=
        (Nat.cast_le.mpr hell_nat).trans hell
      have hC0 := deg_nonneg k K hCeff
      have htoC : ((deg k K C).toNat : ℤ) = deg k K C := Int.toNat_of_nonneg hC0
      have htoB : ((deg k K B).toNat : ℤ) = deg k K B := Int.toNat_of_nonneg hdegB0
      have hsum :
          deg k K D + 1 = (deg k K B).toNat * r + ((deg k K C).toNat + 1) := by
        rw [hdeg, htoC, htoB]
        ring
      have hnat_z :
          (n * (r + 1) : ℤ) ≤ (deg k K B).toNat * r + ((deg k K C).toNat + 1) := by
        rw [← hsum]
        exact hbound
      exact_mod_cast hnat_z
  have hdegB := deg_nonneg k K hBeff
  rw [← Int.toNat_of_nonneg hdegB]
  exact_mod_cast hmain
end ChartVariable
section Auxiliary
noncomputable def rationalSubfield (x : K) : IntermediateField k K :=
  IntermediateField.adjoin k {x}
end Auxiliary
end PolarDivisor
end FunctionField.Chart
end
end
end
Source
H. Stichtenoth, *Algebraic Function Fields and Codes*, 2nd ed., GTM 254, Springer 2009, Section 1.4 (divisors, degree, pole divisor (x)∞(x)_\infty(x)∞​, cf. Theorem 1.4.11 deg⁡(x)∞=[F:K(x)]\deg(x)_\infty=[F:K(x)]deg(x)∞​=[F:K(x)]) and Section 1.5 (adeles). Lean: riemann-roch-function-fields by Guanghao Li (Apache 2.0), ported to Mathlib 0df444a: https://github.com/vaca22/riemann-roch-function-fields/blob/dbca5beed1da77e2ecd1eec207d0451fa57e8aa6/RiemannRoch/CoordinateFree/Divisor.lean, https://github.com/vaca22/riemann-roch-function-fields/blob/dbca5beed1da77e2ecd1eec207d0451fa57e8aa6/RiemannRoch/CoordinateFree/AdeleSpace.lean, https://github.com/vaca22/riemann-roch-function-fields/blob/dbca5beed1da77e2ecd1eec207d0451fa57e8aa6/RiemannRoch/Genus/Polar.lean

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me