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 TauCeti.Analysis.Normed.Unbundled.SpectralNorm.Basic |
| 4 | import TauCeti.NumberTheory.LocalField.Padic |
| 5 | import TauCeti.NumberTheory.LocalField.Unramified.Existence |
| 6 | import TauCeti.RingTheory.RootsOfUnity.LocalRing |
| 7 | public import Lib.Cohomology.Etale.Basic |
| 8 | public import Lib.General.NumberTheory.CoefficientRings |
| 9 | import Lib.ClassField.Places.TameInertia |
| 10 | import Lib.General.NumberTheory.PadicLimitsValuation |
| 11 | import Lib.PadicComparison.Descent.TestCategory |
| 12 | |
| 13 | /-! |
| 14 | # Coefficient rings with a large residue field |
| 15 | |
| 16 | Adjoining the roots of unity of order `ℓ ^ k - 1` to a finite extension of `ℚ_ℓ` multiplies the |
| 17 | degree by at most `k` and gives a residue field with at least `ℓ ^ k - 1` elements. The extension is |
| 18 | unramified, but this is not needed: the ramification index is at most the degree, which grows |
| 19 | linearly in `k`, while `ℓ ^ k` grows faster. |
| 20 | |
| 21 | * `New.Selmer.frequently_lt_card_residueField`: beyond every coefficient ring there is one whose |
| 22 | residue field is large compared with the ramification index. |
| 23 | |
| 24 | Notions from other files: |
| 25 | * `New.CoeffRing ℓ`: rings of integers of finite Galois extensions of `ℚ_ℓ` inside `ℚ̄_ℓ`, ordered |
| 26 | by inclusion; |
| 27 | * `New.ThePrime ℓ`: the class saying that `ℓ` is prime. |
| 28 | -/ |
| 29 | |
| 30 | @[expose] public section |
| 31 | |
| 32 | namespace New.Selmer |
| 33 | |
| 34 | open IsDiscreteValuationRing IsLocalRing IntermediateField Module Polynomial |
| 35 | |
| 36 | variable {ℓ : ℕ} [ThePrime ℓ] |
| 37 | |
| 38 | /-- An element `x` of `ℚ̄_ℓ` of norm less than `1` and of degree `d` over `ℚ_ℓ` satisfies |
| 39 | `‖x‖ ^ d ≤ ‖ℓ‖`. -/ |
| 40 | lemma norm_pow_natDegree_minpoly_le {x : PadicAlgCl ℓ} (hx : ‖x‖ < 1) : |
| 41 | ‖x‖ ^ (minpoly ℚ_[ℓ] x).natDegree ≤ ‖(ℓ : PadicAlgCl ℓ)‖ := by |
| 42 | -- `‖x‖ ^ d` is the norm of the constant coefficient, an element of `ℚ_ℓ` of norm less than `1`. |
| 43 | have h_coeff := NormedAlgebra.norm_pow_natDegree_minpoly_eq_norm_coeff_zero ℚ_[ℓ] |
| 44 | (Algebra.IsAlgebraic.isAlgebraic x) |
| 45 | have h_lt : ‖(minpoly ℚ_[ℓ] x).coeff 0‖ < (ℓ : ℝ) ^ (0 : ℤ) := by |
| 46 | simpa [← h_coeff] using pow_lt_one₀ (norm_nonneg x) hx |
| 47 | (minpoly.natDegree_pos (Algebra.IsIntegral.isIntegral x)).ne' |
| 48 | rw [h_coeff, ← map_natCast (algebraMap ℚ_[ℓ] (PadicAlgCl ℓ)), PadicAlgCl.norm_extends] |
| 49 | simpa using (Padic.norm_lt_pow_iff_norm_le_pow_sub_one _ 0).1 h_lt |
| 50 | |
| 51 | /-- If a coefficient ring `O`, the ring of integers of a finite Galois extension of `ℚ_ℓ`, is |
| 52 | contained in a finite extension `K` of `ℚ_ℓ`, then its ramification index, the valuation of `ℓ` |
| 53 | in `O`, is at most the degree of `K`. -/ |
| 54 | lemma addVal_ell_le_finrank (O : CoeffRing ℓ) (K : IntermediateField ℚ_[ℓ] (PadicAlgCl ℓ)) |
| 55 | [FiniteDimensional ℚ_[ℓ] K] (hK : ∀ x ∈ (O : Subalgebra ℤ_[ℓ] (PadicAlgCl ℓ)), x ∈ K) : |
| 56 | addVal O (ℓ : ↑O) ≤ finrank ℚ_[ℓ] K := by |
| 57 | -- For a uniformiser `ϖ` of degree `d`, `ℓ` divides `ϖ ^ d`. |
| 58 | obtain ⟨ϖ, hϖ⟩ := exists_irreducible O |
| 59 | let d : ℕ := (minpoly ℚ_[ℓ] ϖ.val).natDegree |
| 60 | have h_norm : ‖(ϖ : PadicAlgCl ℓ)‖ < 1 := |
| 61 | (O.norm_le_one ϖ).lt_of_ne (mt (O.isUnit_iff_norm_eq_one ϖ).2 hϖ.not_isUnit) |
| 62 | have h_dvd : (ℓ : ↑O) ∣ ϖ ^ d := by |
| 63 | simpa [O.dvd_iff_norm_le] using norm_pow_natDegree_minpoly_le h_norm |
| 64 | have h_deg : d ≤ finrank ℚ_[ℓ] K := by |
| 65 | simpa only [d, |
| 66 | K.minpoly_eq] using minpoly.natDegree_le (A := ℚ_[ℓ]) (⟨ϖ.val, hK _ ϖ.property⟩ : K) |
| 67 | calc addVal O (ℓ : ↑O) ≤ addVal O (ϖ ^ d) := addVal_le_iff_dvd.2 h_dvd |
| 68 | _ = d := hϖ.addVal_pow _ |
| 69 | _ ≤ finrank ℚ_[ℓ] K := Nat.cast_le.2 h_deg |
| 70 | |
| 71 | /-- An element `ζ` of `ℚ̄_ℓ` with `ζ ^ (ℓ ^ k - 1) = 1`, where `k ≠ 0`, has degree at most `k` over |
| 72 | `ℚ_ℓ`. -/ |
| 73 | lemma natDegree_minpoly_le_of_pow_eq_one {k : ℕ} [NeZero k] {ζ : PadicAlgCl ℓ} |
| 74 | (hζ : ζ ^ (ℓ ^ k - 1) = 1) : (minpoly ℚ_[ℓ] ζ).natDegree ≤ k := by |
| 75 | -- The `(ℓ ^ k - 1)`-st roots of unity lie in the degree-`k` unramified extension. |
| 76 | let U := TauCeti.unramifiedExtension ℚ_[ℓ] (PadicAlgCl ℓ) k |
| 77 | have h_mem : ζ ∈ U := by |
| 78 | change ζ ∈ TauCeti.unramifiedExtension ℚ_[ℓ] (PadicAlgCl ℓ) k |
| 79 | rw [TauCeti.unramifiedExtension_eq_adjoin_setOf_pow_eq_one (NeZero.ne k)] |
| 80 | exact subset_adjoin _ _ (by simpa [Padic.natCard_residueField] using hζ) |
| 81 | have h_degree : finrank ℚ_[ℓ] U = k := TauCeti.finrank_unramifiedExtension (NeZero.ne k) |
| 82 | have : FiniteDimensional ℚ_[ℓ] U := .of_finrank_pos (h_degree.symm ▸ NeZero.pos k) |
| 83 | simpa only [U.minpoly_eq, h_degree] using minpoly.natDegree_le (A := ℚ_[ℓ]) (⟨ζ, h_mem⟩ : U) |
| 84 | |
| 85 | /-- If a coefficient ring `O`, the ring of integers of a finite Galois extension of `ℚ_ℓ`, holds a |
| 86 | primitive `m`-th root of unity `ζ` of `ℚ̄_ℓ` and `m` is prime to `ℓ`, then the residue field of |
| 87 | `O` has at least `m` elements. -/ |
| 88 | lemma le_card_residueField_of_isPrimitiveRoot {O : CoeffRing ℓ} {m : ℕ} (hm : ¬ℓ ∣ m) {ζ : ↑O} |
| 89 | (hζ : IsPrimitiveRoot (ζ : PadicAlgCl ℓ) m) : m ≤ Nat.card (ResidueField O) := by |
| 90 | have hm_unit : IsUnit (m : ↑O) := isUnit_natCast_of_not_dvd hm |
| 91 | have hζO : IsPrimitiveRoot ζ m := .coe_submonoidClass_iff.1 hζ |
| 92 | exact (hζO.map_residue hm_unit).eq_orderOf.le.trans orderOf_le_card |
| 93 | |
| 94 | variable (ℓ) in |
| 95 | /-- For every natural number `a` there is a positive `k` with `a k + 1 < ℓ ^ k - 1`. -/ |
| 96 | lemma exists_mul_add_one_lt_pow_sub_one (a : ℕ) : ∃ k : ℕ, 0 < k ∧ a * k + 1 < ℓ ^ k - 1 := by |
| 97 | let j : ℕ := 2 * a + 1 |
| 98 | -- The exponent `2 j` works, as `(j + 1) ^ 2 ≤ ℓ ^ (2 j)`. |
| 99 | refine ⟨j * 2, by positivity, Nat.lt_sub_of_add_lt ?_⟩ |
| 100 | calc a * (j * 2) + 1 + 1 < (j + 1) ^ 2 := by grind |
| 101 | _ ≤ (ℓ ^ j) ^ 2 := Nat.pow_le_pow_left (Nat.lt_pow_self (Fact.out : ℓ.Prime).one_lt) 2 |
| 102 | _ = ℓ ^ (j * 2) := (pow_mul ℓ j 2).symm |
| 103 | |
| 104 | /-- Let `K₀` be a finite Galois extension of `ℚ_ℓ` and `k ≠ 0`. Adjoining to `K₀` a primitive root |
| 105 | of unity of order `ℓ ^ k - 1` gives a coefficient ring containing the elements of `K₀` of norm at |
| 106 | most `1`, with ramification index at most `k` times the degree of `K₀` and with at least |
| 107 | `ℓ ^ k - 1` elements in its residue field. -/ |
| 108 | private lemma exists_coeffRing_pow_sub_one_le_card_residueField |
| 109 | (K₀ : FiniteGaloisIntermediateField ℚ_[ℓ] (PadicAlgCl ℓ)) (k : ℕ) [NeZero k] : |
| 110 | ∃ O : CoeffRing ℓ, |
| 111 | (∀ x : PadicAlgCl ℓ, ‖x‖ ≤ 1 → x ∈ K₀.toIntermediateField → |
| 112 | x ∈ (O : Subalgebra ℤ_[ℓ] (PadicAlgCl ℓ))) ∧ |
| 113 | addVal O (ℓ : ↑O) ≤ (finrank ℚ_[ℓ] K₀ * k : ℕ) ∧ ℓ ^ k - 1 ≤ Nat.card (ResidueField O) := by |
| 114 | obtain ⟨ζ, hζ, h_norm⟩ := |
| 115 | exists_isPrimitiveRoot_norm_eq_one (ℓ := ℓ) (ℓ ^ k - 1) |
| 116 | have hζ_int : IsIntegral ℚ_[ℓ] ζ := Algebra.IsIntegral.isIntegral ζ |
| 117 | have : IsCyclotomicExtension {ℓ ^ k - 1} ℚ_[ℓ] ℚ_[ℓ]⟮ζ⟯ := |
| 118 | hζ.intermediateField_adjoin_isCyclotomicExtension ℚ_[ℓ] |
| 119 | have : FiniteDimensional ℚ_[ℓ] ℚ_[ℓ]⟮ζ⟯ := adjoin.finiteDimensional hζ_int |
| 120 | have : IsGalois ℚ_[ℓ] ℚ_[ℓ]⟮ζ⟯ := IsCyclotomicExtension.isGalois {ℓ ^ k - 1} _ _ |
| 121 | let K : FiniteGaloisIntermediateField ℚ_[ℓ] (PadicAlgCl ℓ) := ⟨K₀.toIntermediateField ⊔ ℚ_[ℓ]⟮ζ⟯⟩ |
| 122 | obtain ⟨O, hO⟩ : ∃ O : CoeffRing ℓ, ∀ x : PadicAlgCl ℓ, |
| 123 | x ∈ (O : Subalgebra ℤ_[ℓ] (PadicAlgCl ℓ)) ↔ ‖x‖ ≤ 1 ∧ x ∈ K.toIntermediateField := |
| 124 | ⟨⟨_, K, rfl⟩, fun x ↦ Iff.rfl⟩ |
| 125 | have hζ_mem : ζ ∈ (O : Subalgebra ℤ_[ℓ] (PadicAlgCl ℓ)) := (hO ζ).2 |
| 126 | ⟨h_norm.le, |
| 127 | (le_sup_right : ℚ_[ℓ]⟮ζ⟯ ≤ K.toIntermediateField) (mem_adjoin_simple_self _ ζ)⟩ |
| 128 | have h_deg : finrank ℚ_[ℓ] K ≤ finrank ℚ_[ℓ] K₀ * k := |
| 129 | (finrank_sup_le _ _).trans <| Nat.mul_le_mul_left _ <| |
| 130 | (adjoin.finrank hζ_int).trans_le (natDegree_minpoly_le_of_pow_eq_one hζ.pow_eq_one) |
| 131 | refine ⟨O, fun x hx_norm hx_mem ↦ (hO x).2 |
| 132 | ⟨hx_norm, (le_sup_left : K₀.toIntermediateField ≤ K.toIntermediateField) hx_mem⟩, ?_, ?_⟩ |
| 133 | · exact (addVal_ell_le_finrank O K.1 fun x hx ↦ ((hO x).1 hx).2).trans (Nat.cast_le.2 h_deg) |
| 134 | · exact le_card_residueField_of_isPrimitiveRoot not_dvd_pow_sub_one (ζ := ⟨ζ, hζ_mem⟩) hζ |
| 135 | |
| 136 | variable (ℓ) in |
| 137 | /-- For every natural number `c` and every coefficient ring, that is, the ring of integers of a |
| 138 | finite Galois extension of `ℚ_ℓ`, there is a coefficient ring containing it whose residue field has |
| 139 | more than `c · e + 1` elements, where `e`, the valuation of `ℓ`, is the ramification index of the |
| 140 | containing ring. -/ |
| 141 | lemma frequently_lt_card_residueField (c : ℕ) : |
| 142 | ∃ᶠ O : CoeffRing ℓ in Filter.atTop, |
| 143 | c * addVal O (ℓ : ↑O) + 1 < Nat.card (ResidueField O) := by |
| 144 | -- Adjoin to the field `K₀`, of degree `d`, a primitive root of unity of order `ℓ ^ k - 1`, where |
| 145 | -- `c d k + 2 < ℓ ^ k`. |
| 146 | refine Filter.frequently_atTop.2 ?_ |
| 147 | rintro ⟨_, K₀, rfl⟩ |
| 148 | let d : ℕ := finrank ℚ_[ℓ] K₀ |
| 149 | obtain ⟨k, hk_pos, hk⟩ : ∃ k : ℕ, 0 < k ∧ c * (d * k) + 1 < ℓ ^ k - 1 := by |
| 150 | simpa only [← mul_assoc] using exists_mul_add_one_lt_pow_sub_one ℓ (c * d) |
| 151 | have : NeZero k := ⟨hk_pos.ne'⟩ |
| 152 | obtain ⟨O, hO, h_addVal, h_card⟩ := exists_coeffRing_pow_sub_one_le_card_residueField K₀ k |
| 153 | refine ⟨O, ?_, ?_⟩ |
| 154 | · rintro x ⟨hx_norm, hx_mem⟩ |
| 155 | exact hO x hx_norm hx_mem |
| 156 | calc c * addVal O (ℓ : ↑O) + 1 ≤ c * (d * k : ℕ) + 1 := by gcongr |
| 157 | _ < (ℓ ^ k - 1 : ℕ) := by exact_mod_cast hk |
| 158 | _ ≤ Nat.card (ResidueField O) := Nat.cast_le.2 h_card |
| 159 | |
| 160 | end New.Selmer |