Lean formalization of the Riemann Hypothesis (Alpöge, 2026-11-20) being cleaned up by members of the Lean community.
Python
module
import TauCeti.NumberTheory.EffectiveBounds.ClassNumber.Basic
import TauCeti.NumberTheory.NumberField.Units.SUnit.Basic
import TauCeti.RingTheory.ClassGroup.Basic
public import Mathlib.NumberTheory.NumberField.ClassNumber
import Mathlib.NumberTheory.NumberField.CanonicalEmbedding.NormLeOne
import Mathlib.NumberTheory.NumberField.House
public import Lib.General.NumberTheory.ImaginaryQuadraticField
/-!
# Principal ideal powers, S-units and a class number bound
For every ideal `I` of a ring of integers of a number field some power `I ^ n` with `n ≠ 0` is
principal. For ideals of norm greater than 1 the generators can be chosen large at every complex
embedding.
## Main definitions and results
* `New.ThetaTori.exists_pow_eq_span_inv_lt`: for an ideal of norm greater than 1, some power is
principal with a non-unit generator of arbitrarily large absolute value at every complex
embedding.
* `New.exists_valuation_eq_exp_mul`: for a finite set `S` of finite places of a number field `K`,
there is `n ≠ 0` such that any family of valuations `exp (n * e v)`, `v ∈ S`, is attained by an
`S`-unit; `n` is the class number. Valuations are multiplicative, with values in `ℤᵐ⁰`, and a
uniformiser has valuation `exp (-1)`.
* `New.SUnit.dirichlet_unit_theorem`: the `S`-units are finitely generated of rank
`#S + #(infinite places) - 1`. This is Tau Ceti's rank formula
`TauCeti.finrank_sUnits_numberField` combined with Mathlib's unit rank `NumberField.Units.rank`.
* `New.eq_zero_of_forall_norm_lt_one`: an algebraic integer of absolute value below `1` at every
infinite place is `0`. Here `Φ v`, from an instance of `New.PlaceEmbedding`, is a chosen complex
embedding that induces the infinite place `v`.
* `New.classNumber_le`: a number field of degree `n` and discriminant `d` has class number at most
`(2 ^ n * |d|) ^ (n + 1)`.
This follows from Tau Ceti's effective class number bound `NumberField.classNumber_le_bound`.
* `New.conj_mem_quadInt`: for a prime `d ≡ 7` mod `8`, the ring `New.quadInt d`, the image of the
ring of integers of ℚ(√−d) in ℂ, is stable under complex conjugation.
## Relation to the literature
Dirichlet's `S`-unit theorem is Tau Ceti's rank formula for `S`-units, and the class number bound
is a crude form of Tau Ceti's effective bound on the class number.
-/
@[expose] public section
/-! ## Principal powers of ideals of a ring of integers -/
open NumberField in
/-- For every ideal `I` of the ring of integers of a number field, some power `I ^ n` with
`n ≠ 0` is principal. -/
lemma New.exists_ideal_pow_eq_span_singleton {F : Type*} [Field F] [NumberField F]
(I : Ideal (𝓞 F)) : ∃ n ≠ (0 : ℕ), ∃ y : 𝓞 F, I ^ n = Ideal.span {y} :=
⟨Nat.card (ClassGroup (𝓞 F)), Nat.card_pos.ne',
I.isPrincipal_pow_natCard_classGroup.principal⟩
/-! ## Generators of ideal powers large at every complex embedding -/
open NumberField mixedEmbedding fundamentalCone Ideal Algebra in
/-- For an integer `a : 𝓞 K` with `⌈|C / r| ^ [K : ℚ]⌉₊ < absNorm (span {a})` and a
unit `u : (𝓞 K)ˣ`, scaling `u • mixedEmbedding K (a : K)⁻¹` by `C / r` has
mixed-embedding norm at most `1`. -/
private lemma norm_scaled_inv_generator_le_one {K : Type*} [Field K] [NumberField K]
{a : 𝓞 K} {C r : ℝ}
(h_big : ⌈|C / r| ^ Module.finrank ℚ K⌉₊ < absNorm (span {a}))
(u : (𝓞 K)ˣ) :
mixedEmbedding.norm ((C / r) • u • mixedEmbedding K (a : K)⁻¹) ≤ 1 := by
calc _ = |C / r| ^ Module.finrank ℚ K / absNorm (span {a}) := by
simp [div_eq_mul_inv, ← coe_norm_int a, Algebra.norm_inv, mixedEmbedding.norm_smul]
_ ≤ 1 := div_le_one_of_le₀ (Nat.ceil_le.1 h_big.le) (by positivity)
open NumberField mixedEmbedding fundamentalCone Ideal Algebra in
/-- If `I` is an ideal of norm greater than 1 in the ring of integers of a number field `K` and
`r > 0`, some power of `I` is generated by a non-unit `a` with `‖σ a‖⁻¹ < r` for every complex
embedding `σ` of `K`. -/
lemma New.ThetaTori.exists_pow_eq_span_inv_lt {K : Type*} [Field K] [NumberField K]
{I : Ideal (𝓞 K)} {r : ℝ} (hI : 1 < absNorm I) (hr : 0 < r) :
∃ a : 𝓞 K, (∃ k : ℕ, I ^ k = span {a}) ∧ ¬IsUnit a ∧ ∀ σ : K →+* ℂ, ‖σ a‖⁻¹ < r := by
classical
-- The points of norm at most `1` in the fundamental cone are bounded by some `C`. Take a
-- generator `a` of a power of `I` with norm above `(C / r) ^ [K : ℚ]`, move `a⁻¹` into the cone
-- by a unit `u` and scale it by `C / r`: the result has norm at most `1`.
obtain ⟨C, hC_pos, hC⟩ :
∃ C > (0 : ℝ), ∀ x ∈ normLeOne K, ∀ v : InfinitePlace K, normAtPlace v x < C := by
simpa only [norm_eq_sup'_normAtPlace, Finset.sup'_lt_iff, Finset.mem_univ, true_imp_iff]
using (isBounded_normLeOne K).exists_pos_norm_lt
obtain ⟨m, hm⟩ := pow_unbounded_of_one_lt ⌈|C / r| ^ Module.finrank ℚ K⌉₊ hI
obtain ⟨k, hk, a, ha⟩ := exists_ideal_pow_eq_span_singleton (I ^ m)
have h_big : ⌈|C / r| ^ Module.finrank ℚ K⌉₊ < absNorm (span {a}) := by
grw [hm, ← ha, map_pow, map_pow, ← Nat.le_self_pow hk]
have ha_ne : a ≠ 0 := fun ha_zero ↦ by simp [ha_zero] at h_big
obtain ⟨u, hu⟩ := exists_unit_smul_mem (x := mixedEmbedding K (a : K)⁻¹) (by simpa)
have h_norm : mixedEmbedding.norm ((C / r) • u • mixedEmbedding K (a : K)⁻¹) ≤ 1 :=
norm_scaled_inv_generator_le_one h_big u
refine ⟨↑u⁻¹ * a, ⟨m * k, ?_⟩, fun h_unit ↦ h_big.not_ge ?_, fun σ ↦ ?_⟩
· rw [pow_mul, ha, span_singleton_mul_left_unit u⁻¹.isUnit]
· -- a unit has norm `1`, while the ceiling is positive
rw [span_singleton_eq_top.2 (IsUnit.mul_iff.mp h_unit).2, absNorm_top, Nat.one_le_ceil_iff]
positivity
· have h_lt : normAtPlace (.mk σ) ((C / r) • u • mixedEmbedding K (a : K)⁻¹) < C :=
hC _ ⟨smul_mem_of_mem hu (div_pos hC_pos hr).ne', h_norm⟩ _
-- this reads `C / r * ‖σ (u * a⁻¹)‖ < C`, and `u * a⁻¹` is the inverse of `u⁻¹ * a`
simpa [normAtPlace_smul, hC_pos, hr, ha_ne, abs_of_pos, mul_comm, field] using h_lt
/-!
## The ring of integers of an imaginary quadratic field in ℂ
The ring `New.quadInt d` (the integers of K = ℚ(√−d), inside ℂ) contains
ω = `New.quadGen d` = (1 + i√d)/2 and is stable under complex conjugation; ω + ω̄ = 1. For
membership in `quadInt d`, d is assumed to be a prime ≡ 7 mod 8 (`New.PrimeSevenModEight`).
-/
namespace New
lemma conj_quadGen {d : ℕ} : starRingEnd ℂ (quadGen d) = 1 - quadGen d := by
simp [quadGen, map_ofNat]
ring
variable {d : ℕ} [PrimeSevenModEight d]
/-- For a prime d ≡ 7 mod 8, ω = (1 + i√d)/2 lies in the image of the ring of integers of ℚ(√−d)
in ℂ: it is the image of the algebraic integer `New.QuadField.betaK d` of ℚ(√−d). -/
lemma CMLattice.quadGen_mem_quadInt : quadGen d ∈ quadInt d := ⟨QuadField.betaK d, rfl⟩
/-- For a prime d ≡ 7 mod 8 (`PrimeSevenModEight d`), the image `quadInt d` in ℂ of the ring of
integers of ℚ(√−d) is stable under complex conjugation. -/
lemma conj_mem_quadInt {x : ℂ} (hx : x ∈ quadInt d) : starRingEnd ℂ x ∈ quadInt d := by
obtain ⟨a, rfl⟩ := hx
-- the embedding into ℂ takes `star` to complex conjugation
exact ⟨star a, by aesop⟩
end New
/-! ## Dirichlet's S-unit theorem -/
namespace New
open NumberField IsDedekindDomain Module WithZero Algebra Units Subgroup
variable {K : Type*} [Field K] [NumberField K] {S : Set (FinPlace K)}
/-- Let `S` be a finite set of finite places of `K`. There is `n ≠ 0` such that for every family of
integers `e v`, `v ∈ S`, some `S`-unit has valuation `exp (n * e v)` at each `v ∈ S`. -/
lemma exists_valuation_eq_exp_mul (hS : S.Finite) :
∃ n ≠ (0 : ℕ), ∀ e : S → ℤ, ∃ x : S.unit K, ∀ v : S,
(v : FinPlace K).valuation K ((x : Kˣ) : K) = exp (n * e v) := by
have : Finite S := hS.to_subtype
refine ⟨classNumber K, classNumber_ne_zero K, fun e ↦ ?_⟩
obtain ⟨x, hx⟩ := TauCeti.pow_mem_range_unitValuation (𝓞 K) K S (classNumber K)
(fun _ ↦ pow_card_eq_one) (fun v ↦ Multiplicative.ofAdd (e v))
refine ⟨x, fun v ↦ ?_⟩
have hv := congrFun hx v
simp only [Set.unitValuation_apply, Pi.pow_apply, ← ofAdd_nsmul] at hv
rw [← HeightOneSpectrum.valuationOfNeZero_eq, hv]
rfl
/-- Dirichlet's `S`-unit theorem: for a finite set `S` of finite places (nonzero primes of `𝓞 K`),
the group of `S`-units is finitely generated, and its rank plus one is `#S` plus the number of
infinite places. -/
lemma SUnit.dirichlet_unit_theorem (hS : S.Finite) :
Module.Finite ℤ (Additive (S.unit K)) ∧
finrank ℤ (Additive (S.unit K)) + 1 = S.ncard + Fintype.card (InfinitePlace K) := by
have : Finite S := hS.to_subtype
refine ⟨Module.Finite.iff_addGroup_fg.mpr (AddGroup.fg_iff_mul_fg.mpr inferInstance), ?_⟩
rw [TauCeti.finrank_sUnits_numberField, NumberField.Units.rank, Nat.card_coe_set_eq,
Nat.add_right_comm, Nat.sub_add_cancel Fintype.card_pos, add_comm]
end New
/-! ## Nonzero algebraic integers are large at some infinite place -/
open NumberField in
/-- Let `x` be an algebraic integer in a number field `E`, each infinite place `v` of which comes
with a chosen complex embedding `Φ v` inducing it (`PlaceEmbedding E`). If `‖Φ v x‖ < 1` for every
infinite place `v`, then `x = 0`. -/
lemma New.eq_zero_of_forall_norm_lt_one {E : Type*} [Field E] [NumberField E] [PlaceEmbedding E]
{x : E} (hx_int : IsIntegral ℤ x) (h_small : ∀ v : InfinitePlace E, ‖Φ v x‖ < 1) : x = 0 := by
have h_embedding (σ : E →+* ℂ) : ‖σ x‖ < 1 := by
rw [← InfinitePlace.apply σ x, ← PlaceEmbedding.mk_Φ (.mk σ), InfinitePlace.apply]
exact h_small (.mk σ)
have h_house : house x < 1 := by simpa [house, pi_norm_lt_iff] using h_embedding
exact by_contra fun hx ↦ (one_le_house_of_isIntegral hx_int hx).not_gt h_house
/-! ## A crude upper bound for the class number -/
section ClassNumberBound
open NumberField Module
/-- A number field of degree `n` and discriminant `d` has class number at most
`(2 ^ n * |d|) ^ (n + 1)`.
Follows from Tau Ceti's effective class-number bound `classNumber F ≤ |discr F| * 4 ^ n`. -/
lemma New.classNumber_le (F : Type*) [Field F] [NumberField F] :
classNumber F ≤ (2 ^ finrank ℚ F * (discr F).natAbs) ^ (finrank ℚ F + 1) := by
set n : ℕ := finrank ℚ F
set d : ℕ := (discr F).natAbs
have h_bound : classNumber F ≤ d * 4 ^ n := by
have h := NumberField.classNumber_le_bound F
rw [show |(discr F : ℝ)| = (d : ℝ) by simp [d]] at h
exact_mod_cast h
have hn : 1 ≤ n := Module.finrank_pos
calc classNumber F
≤ d * 4 ^ n := h_bound
_ = d * (2 ^ n) ^ 2 := by rw [← pow_mul, mul_comm n 2, pow_mul]; norm_num
_ ≤ d ^ (n + 1) * (2 ^ n) ^ (n + 1) := by
gcongr
· exact Nat.le_self_pow (Nat.succ_ne_zero n) d
· omega
_ = (2 ^ n * d) ^ (n + 1) := by rw [← mul_pow, mul_comm]
end ClassNumberBound