Norm and factor-counting lemmas for the two charts; prime weights
DefinitionRiemannRoch_FunctionFieldDivisor3Throughout, is a field and is a field together with compatible embeddings such that is a finite separable extension; is thus an algebraic function field in one variable over , presented together with the transcendental element . Write for the valuation ring at infinity of (with ) and for its maximal ideal, for the integral closure of in and for the integral closure of in . The chart places are the elements of (finite and infinite places). Write for the relative norm of ideals (from to , resp. from to ) and also for the norm of integral elements, for the field norm, and for the inertia degree.
This file is the third of four consecutive parts of the source module RiemannRoch/FunctionField/Divisor.lean, which was cut into quarters for publication (the other parts are RiemannRoch_FunctionFieldDivisor1, RiemannRoch_FunctionFieldDivisor2, RiemannRoch_FunctionFieldDivisor4). It introduces the two prime weights used to count degrees prime by prime: for a prime of , resp. of ,
which are the degrees of the corresponding chart places.
It also contains the structural lemmas used for the degree of principal divisors (prime factors are counted with multiplicity):
- for a nonzero ideal of , equals the number of prime factors of in (the infinite analogue of the previous quarter);
- for , ;
- for , the number of prime factors of is ;
- if is written with , , then in , and likewise with and norms to .
In the chain of definition files it imports RiemannRoch_FunctionFieldDivisor2 and is imported by RiemannRoch_FunctionFieldDivisor4.
Formalization Note The function field is not constructed from : 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. is finite-dimensional over ) and Algebra.IsSeparable k⟮X⟯ K; when constants are needed, also Algebra k K with IsScalarTower k k[X] K. The weights are FunctionField.Chart.finiteIdealWeight and infiniteIdealWeight (functions on all ideals, with values in ). Element norms are Mathlib's Algebra.intNorm, the fractions are IsLocalization.mk' K n d, the field norm is Algebra.norm k⟮X⟯ and on is RatFunc.intDegree.
import Mathlib
import Definitions.Def_RiemannRoch_FunctionFieldDivisor2
/-
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
noncomputable section
namespace FunctionField.Chart
variable (k K : Type*) [Field k] [Field K]
[Algebra k[X] K] [Algebra k⟮X⟯ K]
[IsScalarTower k[X] k⟮X⟯ K] [FunctionField k K]
[Algebra.IsSeparable k⟮X⟯ K]
attribute [local instance] FunctionField.Chart.instDecidableEqRatFuncDivisorFile
omit [Algebra k[X] K] [IsScalarTower k[X] k⟮X⟯ K] in
theorem infinite_factorDegree_eq_relNorm
(I : Ideal (infiniteIntegers k K)) (hI : I ≠ ⊥) :
((UniqueFactorizationMonoid.normalizedFactors I).map fun P =>
(P.under (inftyValuationSubring k)).inertiaDeg' P).sum =
((UniqueFactorizationMonoid.normalizedFactors
(Ideal.relNorm (inftyValuationSubring k) I)).map fun _ => 1).sum := by
let A := inftyValuationSubring k
let S := infiniteIntegers k K
letI : Algebra A (FractionRing S) := inferInstance
letI : FaithfulSMul A (FractionRing S) := inferInstance
letI : Algebra (FractionRing A) (FractionRing S) :=
FractionRing.liftAlgebra A (FractionRing S)
letI : IsScalarTower A (FractionRing A) (FractionRing S) :=
FractionRing.isScalarTower_liftAlgebra A (FractionRing S)
letI : Algebra.IsSeparable (FractionRing A) (FractionRing S) := by
refine Algebra.IsSeparable.of_equiv_equiv
(FractionRing.algEquiv A k⟮X⟯).symm.toRingEquiv
(FractionRing.algEquiv S K).symm.toRingEquiv ?_
ext x
exact IsFractionRing.algEquiv_commutes
(FractionRing.algEquiv A k⟮X⟯).symm
(FractionRing.algEquiv S K).symm x
symm
simpa using Ideal.sum_normalizedFactors_relNorm_of_isSeparable I hI
(fun _ : Ideal A => 1)
theorem polynomial_factorDegree_span (p : k[X]) (hp : p ≠ 0) :
((UniqueFactorizationMonoid.normalizedFactors (Ideal.span {p})).map
(fun P : Ideal k[X] => Module.finrank k (k[X] ⧸ P))).sum = p.natDegree := by
classical
rw [← UniqueFactorizationMonoid.factors_eq_normalizedFactors,
Ideal.factors_span_eq, Multiset.map_map]
simp_rw [Function.comp_apply, finrank_quotient_span_eq_natDegree]
have hassoc := UniqueFactorizationMonoid.factors_prod hp
have hprod : (UniqueFactorizationMonoid.factors p).prod ≠ 0 :=
hassoc.ne_zero_iff.mpr hp
have hzero : (0 : k[X]) ∉ UniqueFactorizationMonoid.factors p := by
intro h
exact hprod (Multiset.prod_eq_zero_iff.mpr h)
rw [← Polynomial.natDegree_multiset_prod _ hzero]
exact Polynomial.natDegree_eq_of_degree_eq
(Polynomial.degree_eq_degree_of_associated hassoc)
theorem infinity_factorDegree_span (a : inftyValuationSubring k) (ha : a ≠ 0) :
((((UniqueFactorizationMonoid.normalizedFactors (Ideal.span {a})).map
(fun _ : Ideal (inftyValuationSubring k) => (1 : ℕ))).sum : ℕ) : ℤ) =
-RatFunc.intDegree (a : k⟮X⟯) := by
classical
let v := RatFunc.inftyValuation k
let A := inftyValuationSubring k
have hmem : (1 / RatFunc.X : k⟮X⟯) ∈ v.valuationSubring := by
change v (1 / RatFunc.X) ≤ 1
rw [RatFunc.inftyValuation.X_inv]
simpa only [← WithZero.exp_zero, WithZero.exp_le_exp] using (show (-1 : ℤ) ≤ 0 by omega)
let π : v.valuationSubring := ⟨1 / RatFunc.X, hmem⟩
have hgen : (↑(Valuation.IsRankOneDiscrete.generator v) : WithZero (Multiplicative ℤ)) =
WithZero.exp (-1 : ℤ) := by
have h := Valuation.IsRankOneDiscrete.generator_eq_exp_neg_one_of_mem_range
(v := v) (show WithZero.exp (-1 : ℤ) ∈ Set.range v from
⟨1 / RatFunc.X, RatFunc.inftyValuation.X_inv k⟩)
exact congrArg Units.val h
have hπval : v (π : k⟮X⟯) = WithZero.exp (-1 : ℤ) := by
exact RatFunc.inftyValuation.X_inv k
have hπ : v.IsUniformizer (π : k⟮X⟯) := by
rw [Valuation.IsUniformizer.iff, hgen]
exact hπval
let πu : v.Uniformizer := ⟨π, hπ⟩
obtain ⟨n, u, hau⟩ := Valuation.exists_pow_Uniformizer ha πu
have hassocA : Associated a (π ^ n) := by
have hauA : a = π ^ n * (u : v.valuationSubring) := by
apply Subtype.ext
exact hau
rw [hauA]
exact associated_mul_unit_left _ _ u.isUnit
have hmaxpow : IsLocalRing.maximalIdeal A ^ n = Ideal.span {π ^ n} := by
exact Valuation.pow_Uniformizer_is_pow_generator πu n
have hideal : Ideal.span {a} = IsLocalRing.maximalIdeal A ^ n := by
rw [hmaxpow]
exact Ideal.span_singleton_eq_span_singleton.mpr hassocA
have hmaxIrred : Irreducible (IsLocalRing.maximalIdeal A) := by
exact (Ideal.prime_of_isPrime
(IsDiscreteValuationRing.maximalIdeal A).ne_bot
(IsLocalRing.maximalIdeal.isMaximal A).isPrime).irreducible
have hfactor :
UniqueFactorizationMonoid.normalizedFactors (Ideal.span {a}) =
Multiset.replicate n (IsLocalRing.maximalIdeal A) := by
rw [hideal, UniqueFactorizationMonoid.normalizedFactors_pow,
UniqueFactorizationMonoid.normalizedFactors_irreducible hmaxIrred,
normalize_eq, Multiset.nsmul_singleton]
have hleft :
((UniqueFactorizationMonoid.normalizedFactors (Ideal.span {a})).map
(fun _ : Ideal A => 1)).sum = n := by
rw [hfactor]
simp
have huval : v ((u : v.valuationSubring) : k⟮X⟯) = 1 := by
exact (Valuation.Integers.isUnit_iff_valuation_eq_one
(Valuation.valuationSubring.integers v)).mp u.isUnit
have haval : v (a : k⟮X⟯) = WithZero.exp (RatFunc.intDegree (a : k⟮X⟯)) := by
rw [RatFunc.inftyValuation_apply, RatFunc.inftyValuation_of_nonzero]
simpa using ha
have hvrepr := congrArg v hau
have hexp : WithZero.exp (RatFunc.intDegree (a : k⟮X⟯)) =
WithZero.exp (-(n : ℤ)) := by
rw [← haval, hvrepr, map_mul]
change v ((π : k⟮X⟯) ^ n) * v ((u : v.valuationSubring) : k⟮X⟯) = _
rw [map_pow, hπval, huval, mul_one]
calc
WithZero.exp (-1 : ℤ) ^ n = WithZero.exp (n • (-1 : ℤ)) :=
(WithZero.exp_nsmul n (-1 : ℤ)).symm
_ = WithZero.exp (-(n : ℤ)) := by congr 1; simp
have hint : RatFunc.intDegree (a : k⟮X⟯) = -(n : ℤ) :=
WithZero.exp_injective hexp
have hleftZ :
((((UniqueFactorizationMonoid.normalizedFactors (Ideal.span {a})).map
(fun _ : Ideal A => (1 : ℕ))).sum : ℕ) : ℤ) = (n : ℤ) := by
exact congrArg (fun m : ℕ => (m : ℤ)) hleft
rw [hleftZ, hint]
omega
theorem finite_intNorm_div_eq_norm (x : Kˣ) (n : ringOfIntegers k K)
(d : nonZeroDivisors (ringOfIntegers k K))
(hnd : IsLocalization.mk' K n d = (x : K)) :
algebraMap k[X] k⟮X⟯ (Algebra.intNorm k[X] (ringOfIntegers k K) n) /
algebraMap k[X] k⟮X⟯
(Algebra.intNorm k[X] (ringOfIntegers k K) (d : ringOfIntegers k K)) =
Algebra.norm k⟮X⟯ (x : K) := by
have hn : algebraMap k[X] k⟮X⟯ (Algebra.intNorm k[X] (ringOfIntegers k K) n) =
Algebra.intNorm k⟮X⟯ K (algebraMap (ringOfIntegers k K) K n) :=
Algebra.intNorm_eq_of_isLocalization k[X]⁰ (Bₘ := K) n
have hd : algebraMap k[X] k⟮X⟯
(Algebra.intNorm k[X] (ringOfIntegers k K) (d : ringOfIntegers k K)) =
Algebra.intNorm k⟮X⟯ K
(algebraMap (ringOfIntegers k K) K (d : ringOfIntegers k K)) :=
Algebra.intNorm_eq_of_isLocalization k[X]⁰ (Bₘ := K) (d : ringOfIntegers k K)
rw [Algebra.intNorm_eq_norm k[X] (ringOfIntegers k K),
Algebra.intNorm_eq_norm k⟮X⟯ K] at hn hd
let N : K →*₀ k⟮X⟯ :=
{ Algebra.norm k⟮X⟯ with
map_zero' := (Algebra.norm_eq_zero_iff (R := k⟮X⟯) (S := K)).mpr rfl }
have hx := congrArg N hnd
rw [IsFractionRing.mk'_eq_div, map_div₀] at hx
change Algebra.norm k⟮X⟯ (algebraMap (ringOfIntegers k K) K n) /
Algebra.norm k⟮X⟯
(algebraMap (ringOfIntegers k K) K (d : ringOfIntegers k K)) =
Algebra.norm k⟮X⟯ (x : K) at hx
rw [← hn, ← hd] at hx
simpa [Algebra.intNorm_eq_norm k[X] (ringOfIntegers k K)] using hx
omit [Algebra k[X] K] [IsScalarTower k[X] k⟮X⟯ K] in
theorem infinite_intNorm_div_eq_norm (x : Kˣ) (n : infiniteIntegers k K)
(d : nonZeroDivisors (infiniteIntegers k K))
(hnd : IsLocalization.mk' K n d = (x : K)) :
algebraMap (inftyValuationSubring k) k⟮X⟯
(Algebra.intNorm (inftyValuationSubring k) (infiniteIntegers k K) n) /
algebraMap (inftyValuationSubring k) k⟮X⟯
(Algebra.intNorm (inftyValuationSubring k) (infiniteIntegers k K)
(d : infiniteIntegers k K)) =
Algebra.norm k⟮X⟯ (x : K) := by
let A := inftyValuationSubring k
let S := infiniteIntegers k K
have hn : algebraMap A k⟮X⟯ (Algebra.intNorm A S n) =
Algebra.intNorm k⟮X⟯ K (algebraMap S K n) :=
Algebra.intNorm_eq_of_isLocalization A⁰ (Bₘ := K) n
have hd : algebraMap A k⟮X⟯ (Algebra.intNorm A S (d : S)) =
Algebra.intNorm k⟮X⟯ K (algebraMap S K (d : S)) :=
Algebra.intNorm_eq_of_isLocalization A⁰ (Bₘ := K) (d : S)
rw [Algebra.intNorm_eq_norm A S, Algebra.intNorm_eq_norm k⟮X⟯ K] at hn hd
let N : K →*₀ k⟮X⟯ :=
{ Algebra.norm k⟮X⟯ with
map_zero' := (Algebra.norm_eq_zero_iff (R := k⟮X⟯) (S := K)).mpr rfl }
have hx := congrArg N hnd
rw [IsFractionRing.mk'_eq_div, map_div₀] at hx
change Algebra.norm k⟮X⟯ (algebraMap S K n) /
Algebra.norm k⟮X⟯ (algebraMap S K (d : S)) = Algebra.norm k⟮X⟯ (x : K) at hx
rw [← hn, ← hd] at hx
simpa [A, S, Algebra.intNorm_eq_norm A S] using hx
noncomputable def finiteIdealWeight (P : Ideal (ringOfIntegers k K)) : ℕ :=
Module.finrank k (k[X] ⧸ P.under k[X]) * (P.under k[X]).inertiaDeg' P
noncomputable def infiniteIdealWeight (P : Ideal (infiniteIntegers k K)) : ℕ :=
(P.under (inftyValuationSubring k)).inertiaDeg' P
end FunctionField.Chart
end
end
end