Riemann hypothesis: the Lean proof, cleaned up together
The 2026 Lean proof of the Riemann hypothesis and GRH, machine-checked by others, not refereed, no word from Clay; cleaned up together: more readable, faster to build, the theorems unchanged

| 1 | module |
| 2 | |
| 3 | import Mathlib.NumberTheory.Padics.ProperSpace |
| 4 | import Mathlib.Order.CompletePartialOrder |
| 5 | import Mathlib.RingTheory.Henselian |
| 6 | import Mathlib.RingTheory.RegularLocalRing.Defs |
| 7 | import Mathlib.Topology.Algebra.Module.Compact |
| 8 | import Mathlib.Topology.Sheaves.Presheaf |
| 9 | import TauCeti.NumberTheory.Padics.AlgebraicClosure.ResidueField |
| 10 | import TauCeti.NumberTheory.Padics.PadicIntegers |
| 11 | import TauCeti.RingTheory.Length |
| 12 | import TauCeti.Topology.Algebra.Valued.Integer |
| 13 | public import Lib.General.Algebra.AdicCompletion |
| 14 | public import Lib.General.Algebra.FittingIdealsAndLengths |
| 15 | |
| 16 | /-! |
| 17 | # Coefficient rings of ℓ-adic lattices, and length versus cardinality of modules |
| 18 | |
| 19 | The coefficient rings over which ℓ-adic lattices are taken, and, for modules over a local ring with |
| 20 | finite residue field, a comparison of length with cardinality. |
| 21 | |
| 22 | * `New.length_le_of_card_le`, `New.length_le_of_card_dvd`: an inequality of cardinalities (the |
| 23 | smaller module being finite) or a divisibility of cardinalities gives an inequality of lengths. |
| 24 | * `New.CoeffRing ℓ`: the rings of integers O of finite Galois extensions of ℚ_ℓ inside ℚ̄_ℓ. Each is |
| 25 | a finite ℤ_ℓ-module, compact, and a discrete valuation ring with divisibility read from the norm |
| 26 | (`New.CoeffRing.dvd_iff_norm_le`). |
| 27 | * `New.CoeffRing.eventually_mem`: an element of norm at most 1 lies in all sufficiently large |
| 28 | coefficient rings. That the rings are directed by inclusion is an instance. |
| 29 | |
| 30 | Two imported notions occur in the statements: |
| 31 | |
| 32 | * `New.ThePrime ℓ`: the class saying that ℓ is prime, which fixes the prime ℓ in scope; |
| 33 | * `New.DVR O`: O is an integral domain and a discrete valuation ring. |
| 34 | -/ |
| 35 | |
| 36 | @[expose] public section |
| 37 | |
| 38 | -- These instances on subalgebras get priority 10, so that other instances are tried first. |
| 39 | open Subalgebra in |
| 40 | attribute [instance 10] instSMulSubtypeMem instMulActionSubtypeMem moduleLeft |
| 41 | instDistribMulActionSubtypeMem instSMulWithZeroSubtypeMem instMulActionWithZeroSubtypeMem |
| 42 | |
| 43 | namespace New |
| 44 | |
| 45 | open PadicInt IsDiscreteValuationRing NeZero IsLocalRing Module IntermediateField Finite Nat |
| 46 | |
| 47 | /-- A natural number prime to `ℓ` is a unit in every `ℤ_[ℓ]`-algebra. -/ |
| 48 | lemma isUnit_natCast_of_not_dvd {ℓ n : ℕ} [Fact ℓ.Prime] {O : Type*} [Semiring O] |
| 49 | [Algebra ℤ_[ℓ] O] (hn : ¬ℓ ∣ n) : IsUnit (n : O) := by |
| 50 | simpa only [map_natCast] using |
| 51 | (PadicInt.isUnit_natCast_iff.mpr hn).map (algebraMap ℤ_[ℓ] O) |
| 52 | |
| 53 | variable {R X Y : Type*} [CommRing R] |
| 54 | |
| 55 | /-- The residue field of a discrete valuation ring with finite quotients is finite, as the quotient |
| 56 | by its nonzero maximal ideal. -/ |
| 57 | instance [IsDomain R] [IsDiscreteValuationRing R] [Ring.HasFiniteQuotients R] : |
| 58 | Finite (ResidueField R) := |
| 59 | Ring.HasFiniteQuotients.finiteQuotient (not_a_field R) |
| 60 | |
| 61 | section LocalRingLength |
| 62 | |
| 63 | variable [IsLocalRing R] [Finite (ResidueField R)] |
| 64 | |
| 65 | /-- Over a local ring `R` with finite residue field, an infinite module `Y` has infinite length. -/ |
| 66 | lemma length_eq_top_of_infinite [AddCommGroup Y] [Module R Y] [Infinite Y] : length R Y = ⊤ := by |
| 67 | by_contra h_length |
| 68 | -- the cardinality of `Y` would be a power of the size of the residue field, hence not `0` |
| 69 | have h_card : Nat.card Y ≠ 0 := by |
| 70 | obtain ⟨n, hn⟩ := ENat.ne_top_iff_exists.1 h_length |
| 71 | rw [TauCeti.natCard_eq_pow_of_length_eq hn.symm] |
| 72 | exact pow_ne_zero _ Nat.card_pos.ne' |
| 73 | exact h_card Nat.card_eq_zero_of_infinite |
| 74 | |
| 75 | /-- Let `R` be a local ring with finite residue field, and let `X` and `Y` be `R`-modules. If `X` |
| 76 | is finite and `#X ≤ #Y`, then `length R X ≤ length R Y`. The inequality forces `Y` to be finite |
| 77 | too, since `Nat.card X` is positive and `Nat.card` is `0` for an infinite type. -/ |
| 78 | lemma length_le_of_card_le [AddCommGroup X] [Module R X] [AddCommGroup Y] [Module R Y] |
| 79 | [Finite X] (h_card : Nat.card X ≤ Nat.card Y) : length R X ≤ length R Y := by |
| 80 | have : Finite Y := Nat.finite_of_card_ne_zero (Nat.card_pos.trans_le h_card).ne' |
| 81 | have : IsArtinian R X := isArtinian_of_finite |
| 82 | have : IsNoetherian R X := isNoetherian_of_finite R X |
| 83 | have : IsArtinian R Y := isArtinian_of_finite |
| 84 | have : IsNoetherian R Y := isNoetherian_of_finite R Y |
| 85 | -- both cardinalities are powers of the size of the residue field: compare the exponents |
| 86 | rw [TauCeti.natCard_eq_pow_length_toNat (A := R) (M := X), |
| 87 | TauCeti.natCard_eq_pow_length_toNat (A := R) (M := Y), |
| 88 | pow_le_pow_iff_right₀ Finite.one_lt_card] at h_card |
| 89 | rw [← ENat.natCast_toNat (length_ne_top (R := R) (M := X)), |
| 90 | ← ENat.natCast_toNat (length_ne_top (R := R) (M := Y))] |
| 91 | exact_mod_cast h_card |
| 92 | |
| 93 | /-- Let `R` be a local ring with finite residue field, and let `X` and `Y` be `R`-modules. If |
| 94 | `Nat.card X` divides `Nat.card Y`, then `length R X ≤ length R Y`. Since `Nat.card` is `0` for an |
| 95 | infinite type, the hypothesis says that either `Y` is infinite, or both modules are finite and |
| 96 | `#X` divides `#Y`. -/ |
| 97 | lemma length_le_of_card_dvd [AddCommGroup X] [Module R X] [AddCommGroup Y] [Module R Y] |
| 98 | (h_card : Nat.card X ∣ Nat.card Y) : length R X ≤ length R Y := by |
| 99 | cases finite_or_infinite Y |
| 100 | · have : Finite X := Nat.finite_of_card_ne_zero (ne_zero_of_dvd_ne_zero Nat.card_pos.ne' h_card) |
| 101 | exact length_le_of_card_le (Nat.le_of_dvd Nat.card_pos h_card) |
| 102 | · simp [length_eq_top_of_infinite (R := R) (Y := Y)] |
| 103 | |
| 104 | end LocalRingLength |
| 105 | |
| 106 | variable (ℓ : ℕ) [ThePrime ℓ] |
| 107 | |
| 108 | /-- The coefficient rings at ℓ: the ℤ_ℓ-subalgebras of ℚ̄_ℓ that are the ring of integers of some |
| 109 | finite Galois extension K of ℚ_ℓ inside ℚ̄_ℓ, that is, the elements of K of norm at most 1. -/ |
| 110 | abbrev CoeffRing : Type := |
| 111 | Set.range fun K : FiniteGaloisIntermediateField ℚ_[ℓ] (PadicAlgCl ℓ) ↦ |
| 112 | ⟨NormedField.valuation.integer.toSubsemiring, fun r : ℤ_[ℓ] ↦ |
| 113 | (norm_algebraMap' (PadicAlgCl ℓ) (r : ℚ_[ℓ])).trans_le r.property⟩ ⊓ |
| 114 | K.toSubalgebra.restrictScalars ℤ_[ℓ] |
| 115 | |
| 116 | variable {ℓ : ℕ} [ThePrime ℓ] {O : CoeffRing ℓ} |
| 117 | |
| 118 | instance : FaithfulSMul ℤ_[ℓ] (PadicAlgCl ℓ) := .trans ℤ_[ℓ] ℚ_[ℓ] (PadicAlgCl ℓ) |
| 119 | |
| 120 | /-- A coefficient ring O is cut out by some finite Galois extension K of ℚ_ℓ: its elements are |
| 121 | those of K of norm at most 1. -/ |
| 122 | lemma CoeffRing.exists_mem_iff (O : CoeffRing ℓ) : |
| 123 | ∃ K : FiniteGaloisIntermediateField ℚ_[ℓ] (PadicAlgCl ℓ), |
| 124 | ∀ x : PadicAlgCl ℓ, x ∈ O.val ↔ ‖x‖ ≤ 1 ∧ x ∈ K.toIntermediateField := by |
| 125 | obtain ⟨_, K, rfl⟩ := O |
| 126 | exact ⟨K, fun x ↦ Iff.rfl⟩ |
| 127 | |
| 128 | /-- The elements of a coefficient ring have norm at most 1. -/ |
| 129 | @[simp] |
| 130 | lemma CoeffRing.norm_le_one (x : ↑O) : ‖x.val‖ ≤ 1 := |
| 131 | (CoeffRing.exists_mem_iff O).elim fun _ hK ↦ ((hK x.val).mp x.prop).1 |
| 132 | |
| 133 | /-- An element of ℚ̄_ℓ of norm at most 1 is integral over ℤ_ℓ. -/ |
| 134 | lemma isIntegral_padicInt_of_norm_le_one {x : PadicAlgCl ℓ} (hx : ‖x‖ ≤ 1) : |
| 135 | IsIntegral ℤ_[ℓ] x := by |
| 136 | let y : Valued.integer (PadicAlgCl ℓ) := ⟨x, Valued.integer.mem_iff.mpr hx⟩ |
| 137 | have h_inclusion : (Valued.integer (PadicAlgCl ℓ)).subtype.comp |
| 138 | (TauCeti.PadicAlgCl.padicIntToInteger ℓ) = algebraMap ℤ_[ℓ] (PadicAlgCl ℓ) := |
| 139 | RingHom.ext TauCeti.PadicAlgCl.coe_padicIntToInteger |
| 140 | rw [IsIntegral, ← h_inclusion] |
| 141 | exact (TauCeti.PadicAlgCl.isIntegral_padicIntToInteger y).map |
| 142 | (Valued.integer (PadicAlgCl ℓ)).subtype |
| 143 | |
| 144 | /-- A coefficient ring O, the ring of integers of a finite Galois extension of ℚ_ℓ inside ℚ̄_ℓ, is |
| 145 | a finite ℤ_ℓ-module. -/ |
| 146 | instance : Module.Finite ℤ_[ℓ] O := by |
| 147 | -- `O` lies in the image of the integral closure of `ℤ_[ℓ]` in `K`, which is a finite module |
| 148 | obtain ⟨K, hK⟩ := CoeffRing.exists_mem_iff O |
| 149 | have h_fin : Module.Finite ℤ_[ℓ] (integralClosure ℤ_[ℓ] K.toIntermediateField) := |
| 150 | IsIntegralClosure.finite ℤ_[ℓ] ℚ_[ℓ] K (integralClosure ℤ_[ℓ] K) |
| 151 | let incl : integralClosure ℤ_[ℓ] K.toIntermediateField →ₐ[ℤ_[ℓ]] PadicAlgCl ℓ := |
| 152 | (K.val.restrictScalars ℤ_[ℓ]).comp (integralClosure ℤ_[ℓ] K).val |
| 153 | refine .of_fg ((h_fin.fg_top.map incl.toLinearMap).of_le (S := O.val.toSubmodule) fun x hx ↦ ?_) |
| 154 | obtain ⟨h_norm, h_mem⟩ := (hK x).mp hx |
| 155 | exact ⟨⟨⟨x, h_mem⟩, coe_isIntegral_iff.mp (isIntegral_padicInt_of_norm_le_one h_norm)⟩, |
| 156 | trivial, rfl⟩ |
| 157 | |
| 158 | /-- In a coefficient ring, x divides y exactly when the norm of y is at most the norm of x. -/ |
| 159 | lemma CoeffRing.dvd_iff_norm_le (x y : ↑O) : x ∣ y ↔ ‖y.val‖ ≤ ‖x.val‖ := by |
| 160 | obtain ⟨K, hK⟩ := CoeffRing.exists_mem_iff O |
| 161 | refine ⟨?_, fun h_le ↦ ?_⟩ |
| 162 | · rintro ⟨c, rfl⟩ |
| 163 | simp [mul_le_of_le_one_right, norm_le_one] |
| 164 | · -- the quotient `y / x` has norm at most `1` and lies in the field `K` |
| 165 | have h_mem (z : ↑O) : z.val ∈ K.toIntermediateField := ((hK z).mp z.prop).2 |
| 166 | have h_norm : ‖y.val / x.val‖ ≤ 1 := by simpa using div_le_one_of_le₀ h_le (norm_nonneg _) |
| 167 | have h_quot : y.val / x.val ∈ O.val := (hK _).mpr ⟨h_norm, div_mem (h_mem y) (h_mem x)⟩ |
| 168 | have h_zero (hx : x.val = 0) : y.val = 0 := by simpa [hx] using h_le |
| 169 | exact ⟨⟨y.val / x.val, h_quot⟩, Subtype.ext (mul_div_cancel_of_imp' h_zero).symm⟩ |
| 170 | |
| 171 | /-- In a coefficient ring `O`, an element `x` is a unit if and only if |
| 172 | `‖x.val‖ = 1`. -/ |
| 173 | lemma CoeffRing.isUnit_iff_norm_eq_one (x : ↑O) : IsUnit x ↔ ‖x.val‖ = 1 := by |
| 174 | simp [isUnit_iff_dvd_one, dvd_iff_norm_le, le_antisymm_iff] |
| 175 | |
| 176 | /-- A coefficient ring O is a discrete valuation ring (`New.DVR O`: a domain and a DVR): it is a |
| 177 | Noetherian valuation ring, and it is not a field. -/ |
| 178 | instance : DVR O := |
| 179 | have : IsNoetherianRing O := .of_finite ℤ_[ℓ] O |
| 180 | have h_total (x y : ↑O) : x ∣ y ∨ y ∣ x := by simp [CoeffRing.dvd_iff_norm_le, le_total] |
| 181 | have : ValuationRing O := ValuationRing.iff_dvd_total.2 ⟨h_total⟩ |
| 182 | -- the maximal ideal of `O` lies over that of `ℤ_[ℓ]`, which is not zero |
| 183 | { not_a_field' := Ideal.ne_bot_of_liesOver_of_ne_bot (not_a_field ℤ_[ℓ]) _ } |
| 184 | |
| 185 | /-- For a finite set s in ℚ̄_ℓ, some coefficient ring (the ring of integers of a finite Galois |
| 186 | extension of ℚ_ℓ inside ℚ̄_ℓ) contains all elements of ℚ_ℓ(s) of norm at most 1. -/ |
| 187 | lemma CoeffRing.exists_mem_of_mem_adjoin (s : Finset (PadicAlgCl ℓ)) : |
| 188 | ∃ O : CoeffRing ℓ, ∀ x ∈ adjoin ℚ_[ℓ] s, ‖x‖ ≤ 1 → x ∈ O.val := |
| 189 | -- the integers of the Galois closure of `ℚ_[ℓ](s)`, which contains that field |
| 190 | ⟨⟨_, .adjoin ℚ_[ℓ] s, rfl⟩, fun _ hx h_norm ↦ ⟨h_norm, le_normalClosure _ hx⟩⟩ |
| 191 | |
| 192 | /-- The action of ℤ_ℓ on ℚ̄_ℓ is continuous, ℤ_ℓ being the unit ball `PadicInt.subring ℓ` of ℚ_ℓ. -/ |
| 193 | instance : ContinuousSMul ℤ_[ℓ] (PadicAlgCl ℓ) := (subring ℓ).continuousSMul (PadicAlgCl ℓ) |
| 194 | |
| 195 | /-- A coefficient ring O is compact, being finite over the compact ring ℤ_ℓ. -/ |
| 196 | instance : CompactSpace O := compactSpace ℤ_[ℓ] O |
| 197 | |
| 198 | /-- The coefficient rings are directed by inclusion. -/ |
| 199 | instance : IsDirectedOrder (CoeffRing ℓ) := |
| 200 | -- `CoeffRing ℓ` is the range of a monotone map on the lattice of finite Galois extensions |
| 201 | have h_mono : Monotone fun K : FiniteGaloisIntermediateField ℚ_[ℓ] (PadicAlgCl ℓ) ↦ |
| 202 | K.toSubalgebra.restrictScalars ℤ_[ℓ] := fun _ _ h_le ↦ h_le |
| 203 | (monotone_const.inf h_mono).directed_le.directedOn_range.isDirectedOrder |
| 204 | |
| 205 | /-- An element of ℚ̄_ℓ of norm at most 1 lies in all sufficiently large coefficient rings: the |
| 206 | rings of integers of finite Galois extensions of ℚ_ℓ inside ℚ̄_ℓ, ordered by inclusion. -/ |
| 207 | lemma CoeffRing.eventually_mem {x : PadicAlgCl ℓ} (hx : ‖x‖ ≤ 1) : |
| 208 | ∀ᶠ O : CoeffRing ℓ in Filter.atTop, x ∈ O.val := by |
| 209 | obtain ⟨O, hO⟩ := exists_mem_of_mem_adjoin {x} |
| 210 | exact (Filter.eventually_ge_atTop O).mono fun O' h_le ↦ |
| 211 | h_le (hO x (subset_adjoin _ _ (by simp)) hx) |
| 212 | |
| 213 | end New |