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.Data.Rat.Cast.OfScientific |
| 4 | import TauCeti.NumberTheory.EffectiveBounds.ClassNumber.Basic |
| 5 | public import New.Reduction.Data.AdmissibleData |
| 6 | import New.Reduction.Data.LevelAndTwists |
| 7 | |
| 8 | /-! |
| 9 | # Sizes of the data |
| 10 | |
| 11 | This file proves size estimates for admissible data `D : Data P`: for the scales, the ranks, the |
| 12 | field and the primes. The table recalls the main sizes, including those proved in the imported |
| 13 | files. Each quantity has bounds `exp l ≤ F` and `|F| ≤ exp l'` that instance search finds and |
| 14 | carries through sums, products and powers; `le_of_hasLogBound` proves `F ≤ G` by comparing the upper |
| 15 | exponent of `F` with the lower exponent of `G`, using the inequalities between the scales. |
| 16 | |
| 17 | | quantity | size proved | degree in `x` | |
| 18 | |---|---|---| |
| 19 | | `s`, `l₀` | `s ≤ 32 log x`, `27 s < l₀ ≤ 81 s` | `0` | |
| 20 | | `log x₁`, `log b` | `(log x₁)⁶ ≤ log b`, `(log b)¹⁰⁰ ≤ x` | `≤ 1 / 100` | |
| 21 | | `m` | `[√x, 2 √x]` | `1 / 2` | |
| 22 | | `k`, `r`, `t` | `r` in `[x⁵, 3 x⁵]`, `k ≤ r ≤ 2 k`, `t = 5 r` | `5` | |
| 23 | | `n_m` | `k + m (t + 1)` | `11 / 2` | |
| 24 | | `2 ^ s`, `f`, `q₁` | `x¹¹ ≤ m ^ 22 = 2 ^ s ≤ f ≤ q₁ ≤ x¹²` | `11`; the upper bound is rounded up | |
| 25 | | `rootDisc`, `1 / Ω` | `[x¹⁰, x¹²]`, `[1, x¹³]` | `11`; the bounds are rounded | |
| 26 | | the gap `Δ = D.gap` | `2 r⁸` | `40` | |
| 27 | | `x₁` | `x ^ 10⁶ ≤ x₁` | at least `10⁶` | |
| 28 | | `b`, `a = x b`, the weights `κ` | `x₁ ^ 10⁶ ≤ b`, `a / x₁ ≤ κ ≤ b` | | |
| 29 | | `M = p₀ p₁` | `[b²⁰, b²²]` | | |
| 30 | | `N` | `log N` in `[m log b, 30 m log b]` | | |
| 31 | |
| 32 | Notions from other files: |
| 33 | * `Data P`: admissible data over the parameters `P`; among its fields are the logarithms `logX`, |
| 34 | `logX₁`, `logB` of the scales `x`, `x₁`, `b`, the numbers `m`, `r`, `towerExp` (the `s` of the |
| 35 | table), the primes `levelPrime 0`, `levelPrime 1` and the level `N`. |
| 36 | * `D.E`: the CM field `K(ζ_{q₁})` over `K = ℚ(√-d)`, with `D.f` infinite places and root |
| 37 | discriminant `rd_E = D.rootDisc`. |
| 38 | * `P.bigOmega s`: the real number `Ω = exp (γ - Re L'/L(1, χ_K)) · 2π / rd_E`. |
| 39 | -/ |
| 40 | |
| 41 | @[expose] public section |
| 42 | |
| 43 | namespace New.Data |
| 44 | |
| 45 | open Real Set Parameters |
| 46 | |
| 47 | variable {P : Parameters} (D : Data P) |
| 48 | |
| 49 | /-! ### Scales and the exponent of the tower -/ |
| 50 | |
| 51 | /-- The exponent `s = D.towerExp` of the tower of admissible data `D`, for which `2 ^ s = m ^ 22` |
| 52 | with `m = D.m ≥ 2`, is not zero. -/ |
| 53 | lemma towerExp_ne_zero : D.towerExp ≠ 0 := by |
| 54 | obtain ⟨e, -, hs⟩ : ∃ e : ℕ, D.m = 2 ^ (e + 1) ∧ D.towerExp = (e + 1) * 22 := |
| 55 | D.exists_m_eq_two_pow |
| 56 | omega |
| 57 | |
| 58 | /-- The scales `x₁` and `b` of admissible data satisfy `x₁ ^ (3 l₀²) ≤ √b`, where `l₀` is the least |
| 59 | power of `3` above `27 s` and `s` is the exponent of the tower. -/ |
| 60 | lemma x₁_pow_le_sqrt_b : D.x₁ ^ (3 * l₀ D.towerExp ^ 2) ≤ √D.b := by |
| 61 | have hl₀_le : (l₀ D.towerExp : ℝ) ≤ 81 * D.towerExp := mod_cast l₀_le_mul D.towerExp_ne_zero |
| 62 | have h_logX₁_pos : 0 < D.logX₁ := HasLogBound.pos D |
| 63 | rw [x₁, b, ← exp_natCast_mul, ← exp_half, exp_le_exp] |
| 64 | push_cast |
| 65 | -- By sizes: `s ≤ 32 log x`, `log x ≤ log x₁`, `(log x₁) ^ 6 ≤ log b`, and `log x₁` is large. |
| 66 | calc 3 * (l₀ D.towerExp : ℝ) ^ 2 * D.logX₁ ≤ 3 * (81 * D.towerExp) ^ 2 * D.logX₁ := by gcongr |
| 67 | _ ≤ D.logB / 2 := D.le_of_hasLogBound |
| 68 | |
| 69 | /-! ### Ranks and invariants of the field |
| 70 | |
| 71 | The numbers `m`, `k` are even and `r`, `t` are odd by the imported lemmas `m_even`, `k_even`, |
| 72 | `r_odd`, `t_odd`; hence every `n_j = k + j (t + 1)` is even (`New.Data.n_even`). -/ |
| 73 | |
| 74 | /-- The rank `m = D.m` and the exponent `s = D.towerExp` of the field `E = P.E s` of the data `D` |
| 75 | satisfy `m ^ 22 = 2 ^ s`. -/ |
| 76 | lemma m_pow_eq_two_pow_towerExp : D.m ^ 22 = 2 ^ D.towerExp := by |
| 77 | obtain ⟨e, hm, hs⟩ : ∃ e : ℕ, D.m = 2 ^ (e + 1) ∧ D.towerExp = (e + 1) * 22 := |
| 78 | D.exists_m_eq_two_pow |
| 79 | rw [hm, hs, pow_mul] |
| 80 | |
| 81 | /-- The number `m` of successive theta lifts of admissible data, a power of `2`, satisfies |
| 82 | `m ^ 594 ≤ 2 ^ l₀`. Here `s = D.towerExp` is the exponent with `m ^ 22 = 2 ^ s`, and `l₀ = l₀ s` is |
| 83 | the least power of `3` above `27 s`. -/ |
| 84 | lemma m_pow_le_two_pow_l₀ : D.m ^ 594 ≤ 2 ^ l₀ D.towerExp := |
| 85 | calc D.m ^ 594 = (D.m ^ 22) ^ 27 := by rw [← pow_mul] |
| 86 | _ = 2 ^ (27 * D.towerExp) := by rw [m_pow_eq_two_pow_towerExp, ← pow_mul, mul_comm] |
| 87 | _ ≤ 2 ^ l₀ D.towerExp := Nat.pow_le_pow_right two_pos (mul_lt_l₀ D.towerExp).le |
| 88 | |
| 89 | /-- The number `f` of infinite places of the field `E = K(ζ_{q₁})`, `K = ℚ(√-d)`, satisfies |
| 90 | `m ^ 22 ≤ f ≤ q₁`. Here `m` is the number of successive theta lifts, a power of `2` with |
| 91 | `m ^ 22 = 2 ^ s` for `s = D.towerExp`, and `q₁ = 3 l₀ 2 ^ s q₀` is the order of the root of unity, |
| 92 | with `l₀` the least power of `3` above `27 s` and `q₀` the fixed modulus of the parameters. -/ |
| 93 | lemma f_mem_Icc : D.f ∈ Icc (D.m ^ 22) D.q₁ := by |
| 94 | rw [show D.f = towerDeg D.towerExp * P.q₀.totient from P.numInfPlaces_E D.towerExp] |
| 95 | constructor |
| 96 | · calc D.m ^ 22 = 2 ^ D.towerExp := D.m_pow_eq_two_pow_towerExp |
| 97 | _ ≤ towerDeg D.towerExp := Nat.le_mul_of_pos_left _ (by positivity) |
| 98 | _ ≤ towerDeg D.towerExp * P.q₀.totient := Nat.le_mul_of_pos_right _ (NeZero.pos _) |
| 99 | · rw [q₁, Parameters.q₁, mul_comm P.q₀] |
| 100 | exact Nat.mul_le_mul_left _ (Nat.totient_le _) |
| 101 | |
| 102 | /-- The number `f` of infinite places of the field `E` of the data is even. -/ |
| 103 | lemma f_even : Even D.f := by |
| 104 | rw [f, P.numInfPlaces_E, towerDeg] |
| 105 | simp [Nat.even_pow, D.towerExp_ne_zero] |
| 106 | |
| 107 | /-- The modulus `q₂ s = (q₀ d) ^ (s + 6)` is at most `x ^ (33 q₀ d)`. Here `q₀`, a multiple of |
| 108 | `18480`, and the prime `d` with `K = ℚ(√-d)` are the fixed parameters, `s` is the exponent of the |
| 109 | tower and `x = exp logX` is the length of the prime sum. -/ |
| 110 | lemma q₂_le : (P.q₂ D.towerExp : ℝ) ≤ D.x ^ (33 * (P.q₀ * P.d)) := by |
| 111 | have h_exponent : (D.towerExp + 6 : ℝ) ≤ 33 * D.logX := by |
| 112 | linarith [D.towerExp_le, D.constantBound_le, D.mul_log_logB_le_logX, |
| 113 | (le_constantBound (P := P)).1] |
| 114 | refine pow_le_of_le_log (exp_pos D.logX) ?_ |
| 115 | calc log (P.q₂ D.towerExp : ℝ) = (D.towerExp + 6 : ℝ) * log (P.q₀ * P.d) := by |
| 116 | simp [q₂, log_pow] |
| 117 | _ ≤ (D.towerExp + 6 : ℝ) * (P.q₀ * P.d) := |
| 118 | mul_le_mul_of_nonneg_left (log_le_self (by positivity)) (by positivity) |
| 119 | _ ≤ 33 * D.logX * (P.q₀ * P.d) := |
| 120 | mul_le_mul_of_nonneg_right h_exponent (by positivity) |
| 121 | _ = ((33 * (P.q₀ * P.d) : ℕ) : ℝ) * log D.x := by |
| 122 | rw [log_exp] |
| 123 | push_cast |
| 124 | ring |
| 125 | |
| 126 | /-- The class number `h_E` of the CM field `E` of admissible data satisfies `log h_E ≤ x ^ 30`, |
| 127 | where `x = exp logX` is the length of the prime sum. -/ |
| 128 | lemma log_classNumber_le : log (NumberField.classNumber D.E) ≤ D.x ^ 30 := by |
| 129 | -- Tau Ceti bounds `h_E` by `|d_E| · 4^[E : ℚ]`, with `[E : ℚ] = 2 f`. |
| 130 | have h_classNumber := NumberField.classNumber_le_bound D.E |
| 131 | rw [abs_discr_eq_rootDiscr_pow, finrank_eq_two_mul_card_infinitePlace] at h_classNumber |
| 132 | -- The last step compares sizes: `f ≤ x¹²` and `log rd_E ≤ 12 log x`. |
| 133 | calc _ ≤ log ((D.rootDisc ^ D.f) ^ 2 * 4 ^ (2 * D.f)) := |
| 134 | log_le_log (mod_cast NumberField.classNumber_pos D.E) h_classNumber |
| 135 | _ ≤ D.x ^ 30 := D.le_of_hasLogBound (by scale_grind D) |
| 136 | |
| 137 | /-! ### Weights |
| 138 | |
| 139 | The bounds `a / x₁ ≤ κ ≤ b` and `κ + x⁴² ≤ 2 b` for the weight `κ = D.weight σ` are the imported |
| 140 | lemmas `weight_mem_Icc`, `weight_le_b` and `weight_add_x_pow_le_two_mul_b`; those for the sequence |
| 141 | `D.shiftedWeight` are `shiftedWeight_mem_Icc` and `log_shiftedWeight_le`. -/ |
| 142 | |
| 143 | /-! ### Primes, levels and the number `Ω` |
| 144 | |
| 145 | The bound `b²⁰ ≤ M ≤ b²²` is `M_mem_Icc`; the range for the level is `logLevelTarget_mem_Icc`, |
| 146 | `log_N_mem_Icc_logLevelTarget` and `log_N_mem_Icc`. How the three primes split in `E` is in |
| 147 | `New.Parameters.star_mem_iff_notMem`, `New.Parameters.intValuation_eq_of_mul_star` and |
| 148 | `New.Data.q_eq_levelPrime`. -/ |
| 149 | |
| 150 | /-- Each of the two prime factors `p₀ = D.levelPrime 0`, `p₁ = D.levelPrime 1` of the number |
| 151 | `M = p₀ p₁` of admissible data exceeds `b²` and is smaller than the prime `N` (the level). -/ |
| 152 | lemma levelPrime_mem_Ioo (i : Fin 2) : (D.levelPrime i : ℝ) ∈ Ioo (D.b ^ 2) D.N := |
| 153 | ⟨D.lt_of_hasLogBound, D.lt_of_hasLogBound⟩ |
| 154 | |
| 155 | /-- For the exponent `s = D.towerExp` of admissible data, the real number |
| 156 | `Ω = P.bigOmega s = exp (γ - Re L'/L(1, χ_K)) · 2π / rd_E` is at most `1`. Here `γ` is Euler's |
| 157 | constant, `χ_K` the quadratic character of `K = ℚ(√-d)` and `rd_E` the root discriminant of the |
| 158 | field `E = P.E s`, a cyclotomic extension of `K`. -/ |
| 159 | lemma bigOmega_le_one : P.bigOmega D.towerExp ≤ 1 := by |
| 160 | -- Instance search knows the upper bound `|Ω| ≤ exp 0`. |
| 161 | simpa using le_of_abs_le (D.hasLogUpper_iff.1 |
| 162 | (inferInstance : D.HasLogUpper (P.bigOmega D.towerExp) 0)) |
| 163 | |
| 164 | /-- For admissible data `D` over the parameters `P`, `20 log b ≤ log (M / Ω) ≤ 23 log b`. -/ |
| 165 | lemma log_M_div_bigOmega_mem_Icc : |
| 166 | log (D.M / P.bigOmega D.towerExp) ∈ Icc (20 * D.logB) (23 * D.logB) := by |
| 167 | have h_lower : D.b ^ 20 ≤ D.M / P.bigOmega D.towerExp := |
| 168 | D.M_mem_Icc.1.trans (le_div_self (by positivity) bigOmega_pos D.bigOmega_le_one) |
| 169 | -- By sizes: `M ≤ b²²` and `1 / Ω ≤ x¹³`. |
| 170 | have h_upper : D.M / P.bigOmega D.towerExp ≤ D.b ^ 23 := D.le_of_hasLogBound |
| 171 | constructor |
| 172 | · simpa using log_le_log (by positivity) h_lower |
| 173 | · simpa using log_le_log (HasLogBound.pos D) h_upper |
| 174 | |
| 175 | /-- For admissible data `D`, `log (M rd_E / 2π)` lies between `19 log b` and `23 log b`. |
| 176 | Here `M = D.M` is the product of the two principal-level primes, `rd_E = D.rootDisc` is the root |
| 177 | discriminant, and `log b = D.logB`. -/ |
| 178 | lemma log_M_mul_rootDisc_mem_Icc : |
| 179 | log (D.M * D.rootDisc / (2 * π)) ∈ Icc (19 * D.logB) (23 * D.logB) := |
| 180 | log_mul_div_two_pi_mem_Icc D.le_of_hasLogBound D.M_mem_Icc |
| 181 | ⟨one_le_rootDiscr D.E, D.le_of_hasLogBound⟩ |
| 182 | |
| 183 | end New.Data |