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.Algebra.Order.Star.Int |
| 4 | import Mathlib.Data.Rat.Cast.OfScientific |
| 5 | public import New.Spanning.Bessel.FillingData |
| 6 | import Lib.SiegelWeil.OneVector.SiegelClassSum |
| 7 | |
| 8 | /-! |
| 9 | # Masses of spheres and of frames |
| 10 | |
| 11 | For the data `D` and an infinite place `v`, the file defines the mass `sph_l` of the unit sphere of |
| 12 | `ℂ ^ l` and the product `fr_v = N ^ k sph_{k+1} ⋯ sph_r`. By the approximate formula for the ratio |
| 13 | of masses in consecutive ranks, the product of the `fr_v` over the infinite places is at most |
| 14 | `N ^ (k f) mass_k / mass_r` up to a factor close to one, where `f` is the number of infinite places |
| 15 | and `mass_l` is the mass `New.mass` in rank `l`. |
| 16 | |
| 17 | ## Main definitions and results |
| 18 | |
| 19 | * `New.Data.unitSphereMass`, `New.Data.frameMass`: the numbers `sph_l` and `fr_v`. |
| 20 | * `New.Data.prod_frameMass_mul_le`: the upper bound for the product of the `fr_v`. |
| 21 | * `New.Data.prod_frameMass_mul_openCellConst_eq`: the product of the `fr_v` in terms of the |
| 22 | constants `New.Filling.siegelConst` and `New.Shape.openCellConst`. |
| 23 | |
| 24 | Notions from other files: |
| 25 | * `New.Data`: the data: a CM field `E` with `f` infinite places (the type `D.Φ`) and root |
| 26 | discriminant `rd = D.rootDisc`, a generator `P.deltaE D.towerExp` of its different, a prime level |
| 27 | `N`, a weight `b`, the length `x` of the prime sum, and ranks `r = k + 2 ϱ + 1`. |
| 28 | * `New.Data.shape`: the shape of the hermitian space `Y₀` of rank `r`, which is the sum of `ϱ` |
| 29 | hyperbolic planes, a space `X₀` of rank `k` and a line. |
| 30 | * `New.mass E l`: the mass of the genus of the standard hermitian lattice `O_E ^ l`. |
| 31 | * `New.Filling.siegelConst`: `c_S = (π ^ k / ((k - 1)! N ^ k)) ^ f |disc E| ^ (1/4) vol(Ô) ^ k`. |
| 32 | * `New.Shape.openCellConst`: `c_G = vol U(k) (2 π ^ k / (k - 1)!) / vol U(r)`. |
| 33 | * `New.volÔ E`: the volume `vol(Ô) = (2 / rd) ^ f` of the integral finite adeles. |
| 34 | -/ |
| 35 | |
| 36 | @[expose] public section |
| 37 | |
| 38 | noncomputable section |
| 39 | |
| 40 | namespace New.Data |
| 41 | |
| 42 | open Finset Real Filling Shape NumberField |
| 43 | |
| 44 | variable {P : Parameters} (D : Data P) |
| 45 | |
| 46 | /-- For the prime level `N` and the rank `k ≥ 1` of the data, the logarithm of `N ^ k / (N ^ k - 1)` |
| 47 | is at most `2 / N`. -/ |
| 48 | lemma log_pow_div_pow_sub_one_le : log (D.N ^ D.k / (D.N ^ D.k - 1)) ≤ (2 / D.N : ℝ) := by |
| 49 | have two_le_N : 2 ≤ D.N := D.N_prime.two_le |
| 50 | have N_le_pow : D.N ≤ D.N ^ D.k := Nat.le_self_pow D.k_pos.ne' D.N |
| 51 | have pow_sub_one_pos : (0 : ℝ) < D.N ^ D.k - 1 := |
| 52 | sub_pos.mpr (one_lt_pow₀ (mod_cast D.N_prime.one_lt) D.k_pos.ne') |
| 53 | calc _ ≤ (D.N ^ D.k : ℝ) / (D.N ^ D.k - 1) - 1 := log_le_sub_one_of_pos (by positivity) |
| 54 | _ = 1 / (D.N ^ D.k - 1) := by field |
| 55 | _ ≤ 2 / D.N := by |
| 56 | field_simp |
| 57 | norm_cast |
| 58 | lia |
| 59 | |
| 60 | /-- The `r - k` errors `2 / 2 ^ ϱ` of the mass formula in the ranks between `k` and `r` add up to at |
| 61 | most `log (1 + b⁻⁹) - 2 f · 2/N`. -/ |
| 62 | lemma sum_two_div_two_pow_le_log_sub : |
| 63 | ∑ _i ∈ Ico D.k D.r, (2 / 2 ^ D.ϱ : ℝ) ≤ log (1 + D.b⁻¹ ^ 9) - 2 * (D.f * (2 / D.N)) := by |
| 64 | have h_error_budget : (D.r - D.k) * (2 / 2 ^ D.ϱ) + 2 * (D.f * (2 / D.N)) ≤ |
| 65 | 2 * D.b⁻¹ ^ 9 / (D.b⁻¹ ^ 9 + 2) := D.le_of_hasLogBound |
| 66 | rw [sum_const, Nat.card_Ico, nsmul_eq_mul, Nat.cast_sub D.k_le_r] |
| 67 | linarith [le_log_one_add_of_nonneg (x := D.b⁻¹ ^ 9) (by positivity)] |
| 68 | |
| 69 | /-- The main term of `log (mass_{i+1} / mass_i)`, with `mass_l` the mass of the genus of `O_E ^ l`, |
| 70 | is `f ((i + 1/2) log rd + log i! - (i + 1) log 2π)`, with `rd` the root discriminant and `f` the |
| 71 | number of infinite places of `E`. The sum over `k ≤ i < r` of the differences between logarithm and |
| 72 | main term has absolute value at most `log (1 + b⁻⁹) - 2 f · 2/N`. -/ |
| 73 | lemma abs_sum_log_mass_ratio_sub_le : |
| 74 | |∑ i ∈ Ico D.k D.r, (log (mass D.E (i + 1)) - log (mass D.E i) - |
| 75 | D.f * ((i + 1 / 2) * log D.rootDisc + log i.factorial - (i + 1) * log (2 * π)))| ≤ |
| 76 | log (1 + D.b⁻¹ ^ 9) - 2 * (D.f * (2 / D.N)) := by |
| 77 | refine (abs_sum_le_sum_abs _ _).trans <| |
| 78 | (sum_le_sum fun i hi ↦ abs_log_mass_ratio_sub_le D.E i D.ϱ D.nat_le_of_hasLogBound |
| 79 | (le_trans D.nat_le_of_hasLogBound (mem_Ico.mp hi).1)).trans |
| 80 | D.sum_two_div_two_pow_le_log_sub |
| 81 | |
| 82 | /-- At every infinite place `v`, the generator `ϖ` of the different of `E` has `2 ≤ |ϖ|_v ≤ b`, |
| 83 | where `b` is the weight of the data. -/ |
| 84 | lemma apply_deltaE_mem_Icc (v : D.Φ) : v (P.deltaE D.towerExp).val ∈ Set.Icc 2 D.b := |
| 85 | ⟨D.le_of_hasLogBound, D.le_of_hasLogBound⟩ |
| 86 | |
| 87 | /-- The number `sph_l = (2π) ^ l / (|ϖ|_v ^ (l - 1 / 2) (l - 1)!)` at the infinite place `v`, where |
| 88 | `ϖ` generates the different of `E`. For `l ≥ 1` it is the mass of the unit sphere of `ℂ ^ l` for |
| 89 | the fibre measure `dy / d⟨y, y⟩`, when `ℂ` carries `2 / |ϖ|_v` and `ℝ` carries `|ϖ|_v ^ (-1 / 2)` |
| 90 | times Lebesgue measure. -/ |
| 91 | def unitSphereMass (l : ℕ) (v : D.Φ) : ℝ := |
| 92 | (2 * π) ^ l / (v (P.deltaE D.towerExp).val ^ (l - 1 / 2 : ℝ) * (l - 1).factorial) |
| 93 | |
| 94 | /-- The number `fr_v = N ^ k sph_{k+1} ⋯ sph_r` at the infinite place `v`, where `N` is the level, |
| 95 | `k ≤ r` are the ranks of the data and `sph_l` is `New.Data.unitSphereMass`. -/ |
| 96 | def frameMass (v : D.Φ) : ℝ := |
| 97 | D.N ^ D.k * ∏ i ∈ Ico D.k D.r, D.unitSphereMass (i + 1) v |
| 98 | |
| 99 | lemma unitSphereMass_pos (l : ℕ) (v : D.Φ) : 0 < D.unitSphereMass l v := by |
| 100 | have hϖ : 0 < v (P.deltaE D.towerExp).val := InfinitePlace.pos_iff.mpr D.filling.deltaE_ne_zero |
| 101 | unfold unitSphereMass |
| 102 | positivity |
| 103 | |
| 104 | lemma frameMass_pos (v : D.Φ) : 0 < D.frameMass v := |
| 105 | mul_pos (pow_pos (mod_cast D.N_prime.pos) _) (prod_pos fun _ _ ↦ D.unitSphereMass_pos _ v) |
| 106 | |
| 107 | /-- The rank `r` of the data equals `k + (2 ϱ + 1)`, where `k` is the smaller rank of the data and |
| 108 | `ϱ` the number of hyperbolic planes. -/ |
| 109 | lemma r_eq_k_add_two_mul_varrho_add_one : D.r = D.k + (2 * D.ϱ + 1) := by |
| 110 | linarith only [D.r_add_one, D.m_eq_two_mul_varrho_add_two] |
| 111 | |
| 112 | /-- For the ranks `k ≤ r` of the data there are `2 ϱ + 1` integers `i` with `k ≤ i < r`, where `ϱ` |
| 113 | is the number of hyperbolic planes. -/ |
| 114 | lemma cast_card_Ico_k_r : ((Ico D.k D.r).card : ℝ) = 2 * D.ϱ + 1 := by |
| 115 | simp [D.r_eq_k_add_two_mul_varrho_add_one] |
| 116 | |
| 117 | /-- The logarithm of the product of the sphere masses `sph_{i+1}` over the `f` infinite places is |
| 118 | `-f ((i + 1/2) log rd + log i! - (i + 1) log 2π)`, with `rd` the root discriminant of `E`. -/ |
| 119 | lemma log_prod_unitSphereMass (i : ℕ) : |
| 120 | log (∏ v : D.Φ, D.unitSphereMass (i + 1) v) = |
| 121 | -(D.f * ((i + 1 / 2) * log D.rootDisc + log i.factorial - (i + 1) * log (2 * π))) := by |
| 122 | have rd_pos : 0 < D.rootDisc := rootDiscr_pos D.E |
| 123 | simp only [unitSphereMass, prod_div_distrib, prod_mul_distrib, prod_const, card_univ, |
| 124 | Nat.add_sub_cancel] |
| 125 | rw [Real.finsetProd_rpow _ _ fun v _ ↦ apply_nonneg v _, P.prod_deltaE_eq_rootDiscr_pow] |
| 126 | simp (disch := positivity) only [log_div, log_mul, log_rpow, log_pow, Nat.cast_add, Nat.cast_one] |
| 127 | ring |
| 128 | |
| 129 | lemma prod_unitSphereMass_pos (l : ℕ) : 0 < ∏ v : D.Φ, D.unitSphereMass l v := |
| 130 | prod_pos fun v _ ↦ D.unitSphereMass_pos l v |
| 131 | |
| 132 | /-- The product of the sphere masses `sph_{k+1}, …, sph_r` over all infinite places is positive. -/ |
| 133 | lemma prod_prod_unitSphereMass_pos : |
| 134 | 0 < ∏ i ∈ Ico D.k D.r, ∏ v : D.Φ, D.unitSphereMass (i + 1) v := |
| 135 | prod_pos fun i _ ↦ D.prod_unitSphereMass_pos (i + 1) |
| 136 | |
| 137 | /-- The product of `fr_v = D.frameMass v = N ^ k sph_{k+1} ⋯ sph_r` over the `f = D.f` infinite |
| 138 | places `v` in `D.Φ` equals `(N ^ k) ^ f` times the product, over `k ≤ i < r`, of the products of |
| 139 | `sph_{i+1}` over the infinite places. -/ |
| 140 | lemma prod_frameMass_eq_mul_prod : |
| 141 | ∏ v : D.Φ, D.frameMass v = |
| 142 | (D.N ^ D.k) ^ D.f * ∏ i ∈ Ico D.k D.r, ∏ v : D.Φ, D.unitSphereMass (i + 1) v := by |
| 143 | simp only [frameMass, prod_mul_distrib, prod_const, card_univ] |
| 144 | rw [prod_comm] |
| 145 | |
| 146 | /-- The product of the `fr_v = N ^ k sph_{k+1} ⋯ sph_r` over the `f` infinite places is at most |
| 147 | `(1 + b⁻⁹) (1 - N ^ (-k)) ^ (2 f) N ^ (k f) mass_k / mass_r`. The statement has `mass_r` and the |
| 148 | factor `(1 - N ^ (-k)) ^ (2 f)` moved to the left side. -/ |
| 149 | lemma prod_frameMass_mul_le : |
| 150 | (∏ v : D.Φ, D.frameMass v) * mass D.E D.r * (D.N ^ D.k / (D.N ^ D.k - 1)) ^ (2 * D.f) ≤ |
| 151 | (1 + D.b⁻¹ ^ 9) * ((D.N ^ D.k) ^ D.f * mass D.E D.k) := by |
| 152 | -- Take logarithms: the product of the `sph_{i+1}` is `mass_i / mass_{i+1}` up to a small error, |
| 153 | -- and these ratios telescope. |
| 154 | let sphereProd : ℝ := ∏ i ∈ Ico D.k D.r, ∏ v : D.Φ, D.unitSphereMass (i + 1) v |
| 155 | have sphereProd_pos : 0 < sphereProd := D.prod_prod_unitSphereMass_pos |
| 156 | have mass_k_pos : 0 < mass D.E D.k := mass_pos D.E D.k |
| 157 | have mass_r_pos : 0 < mass D.E D.r := mass_pos D.E D.r |
| 158 | have ratio_pos : (0 : ℝ) < D.N ^ D.k / (D.N ^ D.k - 1) := div_pos |
| 159 | (mod_cast pow_pos D.N_prime.pos _) |
| 160 | (sub_pos.mpr (one_lt_pow₀ (mod_cast D.N_prime.one_lt) D.k_pos.ne')) |
| 161 | have log_sphereProd_add_le : log (mass D.E D.r) - log (mass D.E D.k) + log sphereProd ≤ |
| 162 | log (1 + D.b⁻¹ ^ 9) - 2 * (D.f * (2 / D.N)) := by |
| 163 | rw [log_prod fun i _ ↦ (D.prod_unitSphereMass_pos (i + 1)).ne', |
| 164 | ← sum_Ico_sub (fun i : ℕ ↦ log (mass D.E i)) D.k_le_r, ← sum_add_distrib] |
| 165 | simpa [log_prod_unitSphereMass, sub_eq_add_neg] using |
| 166 | le_of_abs_le D.abs_sum_log_mass_ratio_sub_le |
| 167 | have h_ratio : D.f * log (D.N ^ D.k / (D.N ^ D.k - 1)) ≤ D.f * (2 / D.N) := |
| 168 | mul_le_mul_of_nonneg_left D.log_pow_div_pow_sub_one_le D.f.cast_nonneg |
| 169 | have sphereProd_mul_mass_le : |
| 170 | sphereProd * mass D.E D.r * (D.N ^ D.k / (D.N ^ D.k - 1)) ^ (2 * D.f) ≤ |
| 171 | (1 + D.b⁻¹ ^ 9) * mass D.E D.k := by |
| 172 | rw [← log_le_log_iff (by positivity) (by positivity)] |
| 173 | simp (disch := positivity) only [log_mul, log_pow, Nat.cast_mul, Nat.cast_ofNat] |
| 174 | linarith |
| 175 | rw [D.prod_frameMass_eq_mul_prod] |
| 176 | linear_combination ((D.N : ℝ) ^ D.k) ^ D.f * sphereProd_mul_mass_le |
| 177 | |
| 178 | /-- For the ranks `k` and `r = k + 2 ϱ + 1` of the data, the sum of the integers `i` with |
| 179 | `k ≤ i < r` is `(2 ϱ + 1) (k + ϱ)`, where `ϱ` is the number of hyperbolic planes. -/ |
| 180 | lemma sum_Ico_k_r_cast : ∑ i ∈ Ico D.k D.r, (i : ℝ) = (2 * D.ϱ + 1) * (D.k + D.ϱ) := by |
| 181 | have h_gauss : (∑ i ∈ range (2 * D.ϱ + 1), i) * 2 = (2 * D.ϱ + 1) * (2 * D.ϱ) := |
| 182 | sum_range_id_mul_two (2 * D.ϱ + 1) |
| 183 | rw [← Nat.cast_sum _ fun i : ℕ ↦ i, sum_Ico_eq_sum_range, D.r_eq_k_add_two_mul_varrho_add_one, |
| 184 | add_tsub_cancel_left, sum_add_distrib, sum_const, card_range, smul_eq_mul] |
| 185 | norm_cast |
| 186 | linarith |
| 187 | |
| 188 | /-- The logarithm of the product of the `fr_v = N ^ k sph_{k+1} ⋯ sph_r` over the `f` infinite |
| 189 | places, as a linear form in the logarithms of `N`, `2`, `π`, the root discriminant and the `i!`. -/ |
| 190 | lemma log_prod_frameMass : |
| 191 | log (∏ v : D.Φ, D.frameMass v) = |
| 192 | D.f * (D.k * log D.N - ∑ i ∈ Ico D.k D.r, log i.factorial + (2 * D.ϱ + 1) * |
| 193 | ((D.k + D.ϱ + 1) * (log 2 + log π) - (D.k + D.ϱ + 1 / 2) * log D.rootDisc)) := by |
| 194 | have N_pos : (0 : ℝ) < D.N := mod_cast D.N_prime.pos |
| 195 | rw [prod_frameMass_eq_mul_prod, log_mul (by positivity) D.prod_prod_unitSphereMass_pos.ne', |
| 196 | log_prod fun i _ ↦ (D.prod_unitSphereMass_pos (i + 1)).ne', log_pow, log_pow] |
| 197 | simp only [log_prod_unitSphereMass, sum_neg_distrib, ← mul_sum, sum_sub_distrib, sum_add_distrib, |
| 198 | ← sum_mul, sum_const, nsmul_eq_mul, sum_Ico_k_r_cast, cast_card_Ico_k_r, |
| 199 | log_mul two_ne_zero pi_ne_zero] |
| 200 | ring |
| 201 | |
| 202 | /-- The logarithm of `c_G = vol U(k) (2 π ^ k / (k - 1)!) / vol U(r)`, the constant of the open |
| 203 | cell, as a linear form in the logarithms of `2`, `π` and the factorials. Here `vol U(j)` is the |
| 204 | volume of the compact unitary group. The shape `D.shape` records the number `ϱ` of hyperbolic planes |
| 205 | and an index set with `k` elements. -/ |
| 206 | lemma log_openCellConst : |
| 207 | log D.shape.openCellConst = |
| 208 | log 2 + D.k * log π - log (D.k - 1).factorial + ∑ i ∈ Ico D.k D.r, log i.factorial - |
| 209 | (2 * D.ϱ + 1) * (log 2 + (D.k + D.ϱ + 1) * log π) := by |
| 210 | have h_vol : volU D.r = volU D.k * ∏ i ∈ Ico D.k D.r, 2 * π ^ (i + 1) / i.factorial := by |
| 211 | simp only [volU, sphereDensity, add_tsub_cancel_right, one_pow, mul_one, |
| 212 | prod_range_mul_prod_Ico _ D.k_le_r] |
| 213 | have h_cell : D.shape.openCellConst = (∏ i ∈ Ico D.k D.r, 2 * π ^ (i + 1) / i.factorial)⁻¹ * |
| 214 | (2 * π ^ D.k / (D.k - 1).factorial) := by |
| 215 | rw [openCellConst, Shape.k, Shape.r, card_X₀, card_rowIndex, h_vol, |
| 216 | div_mul_cancel_left₀ (volU_pos _).ne', sphereDensity, one_pow, mul_one] |
| 217 | rw [h_cell, log_mul (by positivity) (by positivity), log_inv, log_prod fun i _ ↦ by positivity] |
| 218 | simp (disch := positivity) only [log_div, log_mul, log_pow, sum_sub_distrib, sum_add_distrib, |
| 219 | ← sum_mul, sum_const, nsmul_eq_mul, Nat.cast_succ, sum_Ico_k_r_cast, cast_card_Ico_k_r] |
| 220 | ring |
| 221 | |
| 222 | /-- The product of the `fr_v = N ^ k sph_{k+1} ⋯ sph_r` over the `f` infinite places `v` of `E` |
| 223 | satisfies `(∏ fr_v) c_G ^ f |disc E| ^ (ϱ / 2) = c_S N ^ (2 k f) vol(Ô) ^ (ϱ + 1 + 2 ϱ (ϱ + k))`. -/ |
| 224 | lemma prod_frameMass_mul_openCellConst_eq : |
| 225 | (∏ v : D.Φ, D.frameMass v) * |
| 226 | (D.shape.openCellConst ^ D.f * (√√|NumberField.discr D.E| ^ D.ϱ) ^ 2) = |
| 227 | D.filling.siegelConst * ((D.N ^ D.k) ^ D.f) ^ 2 * |
| 228 | volÔ D.E ^ (D.ϱ + 1 + 2 * (D.ϱ * (D.ϱ + D.k))) := by |
| 229 | -- Both sides are positive, and their logarithms are linear in those of `2`, `π`, `N`, the root |
| 230 | -- discriminant and the factorials. |
| 231 | have rd_pos : 0 < D.rootDisc := rootDiscr_pos D.E |
| 232 | have N_pos : (0 : ℝ) < D.N := mod_cast D.N_prime.pos |
| 233 | have frame_pos : 0 < ∏ v : D.Φ, D.frameMass v := prod_pos fun v _ ↦ D.frameMass_pos v |
| 234 | have cell_pos : 0 < D.shape.openCellConst := D.shape.openCellConst_pos |
| 235 | have h_root : √√|(NumberField.discr D.E : ℝ)| = √(D.rootDisc ^ D.f) := by |
| 236 | rw [abs_discr_eq_rootDiscr_pow, sqrt_sq (by positivity)] |
| 237 | have h_siegel : D.filling.siegelConst = (π ^ D.k / (D.k - 1).factorial / D.N ^ D.k) ^ D.f * |
| 238 | √(D.rootDisc ^ D.f) * ((D.rootDisc / 2) ^ D.f)⁻¹ ^ D.k := by |
| 239 | rw [siegelConst, volÔ_eq, h_root, Shape.k, card_X₀, show D.filling.N = D.N from rfl] |
| 240 | rw [h_siegel, volÔ_eq, h_root] |
| 241 | refine log_injOn_pos (Set.mem_Ioi.mpr (by positivity)) (Set.mem_Ioi.mpr (by positivity)) ?_ |
| 242 | simp (disch := positivity) only [log_mul, log_div, log_pow, log_inv, log_sqrt, |
| 243 | log_prod_frameMass, log_openCellConst] |
| 244 | push_cast |
| 245 | ring |
| 246 | |
| 247 | end New.Data |
| 248 | |
| 249 | end |