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 | public import New.Reduction.PrimeSums |
| 5 | import New.Determinant.Twist.LongForms |
| 6 | import New.Reduction.ShortAndEnough |
| 7 | |
| 8 | /-! |
| 9 | # The main inequality |
| 10 | |
| 11 | One covolume, corrected by an index, is bounded from both sides. Write `dim` for the dimension of |
| 12 | the target (`targetDim`), `mainAmount` for the main amount and `rem` for the total remainder |
| 13 | (`totalRemainder`), weighted sums over primes less their expected values. Theorems A and B give a |
| 14 | family of `n ≤ dim` target forms, a bound `V` for the logarithm of the squared covolume of its lifts |
| 15 | (`TwistedLattice.CovolumeLe`) and a bound `δ` for its index (`TwistedLattice.IndexLe`). Up to |
| 16 | errors, |
| 17 | |
| 18 | mainAmount ≤ (V + 2 δ) / dim ≤ mainAmount - (n / dim) m rem, |
| 19 | |
| 20 | where the lower bound is Theorem C. The main amount cancels. |
| 21 | |
| 22 | Notions from other files: |
| 23 | |
| 24 | * `Data P`: the data for the parameters `P` (a modulus `q₀` and a prime `d`). They bundle |
| 25 | scales `x`, `x₁`, `b` in prescribed ranges (`D.logB = log b`), the number `D.m` of lifts, a set |
| 26 | of places of the CM field `D.E`, the `b`-places, which carry the weight `b`, and primes for the |
| 27 | levels. `D.a = x b`, and `D.f` is the number of infinite places of `D.E`. |
| 28 | * `D.normalizedPoincare g`: the translate `g 𝔭` by `g : D.chosenGL` of a fixed linear map `𝔭` from |
| 29 | the source `D.ramifiedSourceForms` to the target `D.targetForms`. |
| 30 | * `D.integralRamified`: the source forms that are integral at every `ι : PrimePadicIso`. |
| 31 | * `D.errorUnit`: the unit of loss `f a log³ b`. |
| 32 | |
| 33 | ## The inputs |
| 34 | |
| 35 | * Theorem A: (a) `span_short_integralRamified_eq_top` (size) and (b) `indexLe_normalizedPoincare` |
| 36 | (index), both in `New.Reduction.ShortAndEnough`. |
| 37 | * Theorem B: `enough_forms` in `New.Reduction.ShortAndEnough`. |
| 38 | * Theorem C: `integral_forms_long` in `New.Determinant.Twist.LongForms`, from a twist for each prime |
| 39 | (`TwistedLattice.covolume_add_index_nonneg`) and the height of `Z(1) / Z(ξ_ι)` |
| 40 | (`heightLe_chainDeterminant_one_div`). |
| 41 | * Hadamard's bound for the covolume: `TwistedLattice.covolumeLe_of_normSqAt_le`. |
| 42 | * The sign of the main amount: `mainAmount_nonneg`. |
| 43 | |
| 44 | ## What cancels, and where |
| 45 | |
| 46 | * The main amount, between the upper and the lower bound: the comparison step of |
| 47 | `star_inequality`. |
| 48 | * The gains `∑ gain_l log l` in the size of the chain, against `log c_B`: |
| 49 | `span_short_integralRamified_eq_top`. |
| 50 | * The constant `c₁ = (logDerivMean d 1 1).re`, between the period and the expected value |
| 51 | `a (log (a / κ̄) + c₁)` of the prime sums: |
| 52 | `jetSize_sub_mainPrimeSum_le`. |
| 53 | * The excesses `a log (κ̄ M rd_E / 2π)` of the `m` lifts, against `a log N`, up to `O(a log b)`. |
| 54 | Here `κ̄` is the geometric mean of the weights `κ` over the `f` places and `rd_E` is the root |
| 55 | discriminant of `E`: |
| 56 | `mul_jetSize_sub_mainPrimeSum_sub_le`. |
| 57 | * The main terms `log x`, `log x₁` and `c₁` of the prime sums, against their expected value: |
| 58 | `totalRemainder_eq`. |
| 59 | * A constant that depends on `q₀`, between the two cut-offs: `sum_aPlaces_primeSum`. |
| 60 | |
| 61 | ## The errors per dimension |
| 62 | |
| 63 | | source | where | amount | |
| 64 | |----------|-------------------|-------------------------------------| |
| 65 | | size | Theorem A (a) | `f a log⁴ b` | |
| 66 | | index | Theorems A (b), B | `20 log (1 + 2 b²) · f a log³ b` | |
| 67 | | covolume | Theorem C | `3 f a log⁴ b` | |
| 68 | |
| 69 | The index enters twice, and the table shows the doubled amount. The family has `n ≥ dim / 2` |
| 70 | members, so `m rem` is at most twice the sum, and twice the sum is at most `f a log⁵ b`. The scales |
| 71 | are listed in `New.Reduction.Data.Sizes`. |
| 72 | |
| 73 | ## Relation to the literature |
| 74 | |
| 75 | Earlier bounds for sums over primes by size against divisibility: Pritsker, The Gelfond–Schnirelman |
| 76 | method in prime number theory, 2005; Granville–Stark, ABC implies no Siegel zeros for L-functions of |
| 77 | characters with negative discriminant, 2000; Bombieri, Counting points on curves over finite fields, |
| 78 | Sém. Bourbaki 430, 1973; van Frankenhuijsen, The Riemann hypothesis for function fields over a |
| 79 | finite field, 2008. |
| 80 | -/ |
| 81 | |
| 82 | @[expose] public section |
| 83 | |
| 84 | namespace New |
| 85 | |
| 86 | open Real Finset Data Module Submodule |
| 87 | |
| 88 | /-- **Main inequality.** For the data `D` we have `m rem ≤ f a log⁵ b`. |
| 89 | |
| 90 | The parameters `P` are a multiple `q₀` of `18480` and a prime `d ≡ q₀/2 - 1 mod q₀`. The scales are |
| 91 | integers with `(log b) ^ 100 ≤ x`, `x ^ 10⁶ ≤ x₁`, `x₁ ^ 10⁶ ≤ b` and |
| 92 | `log log b ≥ 10¹² P.constantBound`. -/ |
| 93 | theorem star_inequality {P : Parameters} (D : Data P) : |
| 94 | D.m * D.totalRemainder ≤ D.f * D.a * D.logB ^ 5 := by |
| 95 | -- Choose many independent images of short integral forms, bound their covolume and index from |
| 96 | -- above, and compare with the lower bound `integral_forms_long`. |
| 97 | obtain ⟨h_dim_pos, t, h_translate_budget, h_span_dimension⟩ : |
| 98 | 0 < D.targetDim ∧ ∃ t : Finset D.chosenGL, |
| 99 | #t * finrank ℂ D.ramifiedSourceForms ≤ 5 * D.targetDim * log (1 + 2 * D.b ^ 2) ∧ |
| 100 | (1 - 4 / D.b ^ 2) * D.targetDim ≤ finrank ℂ ↥(⨆ g ∈ t, (D.normalizedPoincare g).range) := |
| 101 | D.enough_forms |
| 102 | let sizeError : ℝ := D.f * D.a * D.logB ^ 4 |
| 103 | let logNormBound : ℝ := D.mainAmount - D.m * D.totalRemainder + sizeError |
| 104 | let indexBudgetPerDim : ℝ := 10 * log (1 + 2 * D.b ^ 2) * D.errorUnit |
| 105 | let short : Set D.ramifiedSourceForms := |
| 106 | {φ ∈ D.integralRamified | ∀ (g : D.chosenGL) (σ : ℂ ≃+* ℂ), |
| 107 | (D.Θ 1 (D.normalizedPoincare g φ)).normSqAt σ ≤ exp logNormBound} |
| 108 | have h_short_span : span ℂ short = ⊤ := D.span_short_integralRamified_eq_top |
| 109 | -- A + B: take a basis from the images of short source forms under the chosen translates. |
| 110 | obtain ⟨n, y, h_indep, h_near_full_rank, h_image_short⟩ : ∃ (n : ℕ) (y : Fin n → D.targetForms), |
| 111 | LinearIndependent ℂ y ∧ (1 - 4 / D.b ^ 2) * D.targetDim ≤ n ∧ |
| 112 | ∀ i : Fin n, ∃ g ∈ t, y i ∈ D.normalizedPoincare g '' short := by |
| 113 | let images : Set D.targetForms := ⋃ g ∈ t, D.normalizedPoincare g '' short |
| 114 | have span_eq : span ℂ images = ⨆ g ∈ t, (D.normalizedPoincare g).range := by |
| 115 | simp only [images, span_iUnion₂, span_image, h_short_span, Submodule.map_top] |
| 116 | obtain ⟨y, hy_mem, -, h_indep⟩ := exists_fun_fin_finrank_span_eq ℂ images |
| 117 | refine ⟨finrank ℂ (span ℂ images), y, h_indep, by rwa [span_eq], fun i ↦ ?_⟩ |
| 118 | simpa only [images, Set.mem_iUnion, exists_prop] using hy_mem i |
| 119 | have hn_le : (n : ℝ) ≤ D.targetDim := by simpa using h_indep.fintype_card_le_finrank |
| 120 | -- Covolume: each form has squared length at most `exp logNormBound`. |
| 121 | have h_covolume_upper : D.targetLattice.CovolumeLe y (n * logNormBound) := by |
| 122 | refine TwistedLattice.covolumeLe_of_normSqAt_le fun i σ ↦ ?_ |
| 123 | obtain ⟨g, -, φ, ⟨-, hφ_short⟩, hφ_eq⟩ := h_image_short i |
| 124 | rw [normSqAt_targetLattice, ← hφ_eq] |
| 125 | exact hφ_short g σ |
| 126 | -- Index: each translate in `t` contributes `2 · errorUnit` per dimension of the source. |
| 127 | have h_index_upper : D.targetLattice.IndexLe y (D.targetDim * indexBudgetPerDim) := by |
| 128 | have h_errorUnit_nonneg : 0 ≤ D.errorUnit := (HasLogBound.pos D).le |
| 129 | have hy_int (i : Fin n) : ∃ g ∈ t, y i ∈ D.normalizedPoincare g '' D.integralRamified := by |
| 130 | obtain ⟨g, hg, φ, ⟨hφ_int, -⟩, hφ_eq⟩ := h_image_short i |
| 131 | exact ⟨g, hg, φ, hφ_int, hφ_eq⟩ |
| 132 | refine (D.indexLe_normalizedPoincare t hy_int).mono ?_ |
| 133 | calc #t * finrank ℂ D.ramifiedSourceForms * (2 * D.errorUnit) |
| 134 | ≤ 5 * D.targetDim * log (1 + 2 * D.b ^ 2) * (2 * D.errorUnit) := by grw [h_translate_budget] |
| 135 | _ = D.targetDim * indexBudgetPerDim := by ring |
| 136 | -- C: apply the lower bound to the same family. The index is counted twice (the two Gram |
| 137 | -- variables); the nonnegative main amount cancels using `n ≤ targetDim`. |
| 138 | have h_volume_index_lower : |
| 139 | D.targetDim * (D.mainAmount - 3 * sizeError) ≤ |
| 140 | n * logNormBound + 2 * (D.targetDim * indexBudgetPerDim) := |
| 141 | integral_forms_long h_indep h_near_full_rank h_index_upper h_covolume_upper |
| 142 | have h_loss_pos : 0 < sizeError := HasLogBound.pos D |
| 143 | have h_main_comparison : |
| 144 | n * (D.mainAmount + sizeError) ≤ D.targetDim * (D.mainAmount + sizeError) := |
| 145 | mul_le_mul_of_nonneg_right hn_le (add_nonneg D.mainAmount_nonneg h_loss_pos.le) |
| 146 | let totalErrorPerDim : ℝ := 4 * sizeError + 2 * indexBudgetPerDim |
| 147 | have h_main_cancelled : n * (D.m * D.totalRemainder) ≤ D.targetDim * totalErrorPerDim := by |
| 148 | simp only [logNormBound, totalErrorPerDim] at h_volume_index_lower ⊢ |
| 149 | linarith only [h_volume_index_lower, h_main_comparison] |
| 150 | -- Divide by `n ≥ targetDim / 2 > 0`. |
| 151 | have h_half_dimension : (D.targetDim : ℝ) ≤ n * 2 := by |
| 152 | have h_share : 4 / D.b ^ 2 ≤ 2⁻¹ := D.le_of_hasLogBound |
| 153 | calc (D.targetDim : ℝ) = (1 - 2⁻¹) * D.targetDim * 2 := by ring |
| 154 | _ ≤ (1 - 4 / D.b ^ 2) * D.targetDim * 2 := by grw [h_share] |
| 155 | _ ≤ n * 2 := by grw [h_near_full_rank] |
| 156 | have hn_pos : (0 : ℝ) < n := |
| 157 | pos_of_mul_pos_left ((Nat.cast_pos.2 h_dim_pos).trans_le h_half_dimension) zero_le_two |
| 158 | -- The errors are of smaller order than `f a log⁵ b`. |
| 159 | have h_error_budget : |2 * totalErrorPerDim| ≤ D.f * D.a * D.logB ^ 5 := D.le_of_hasLogBound |
| 160 | refine le_of_mul_le_mul_left ?_ hn_pos |
| 161 | calc n * (D.m * D.totalRemainder) ≤ D.targetDim * |totalErrorPerDim| := by |
| 162 | grw [h_main_cancelled, ← le_abs_self] |
| 163 | _ ≤ n * 2 * |totalErrorPerDim| := by grw [h_half_dimension] |
| 164 | _ = n * |2 * totalErrorPerDim| := by rw [abs_mul, Nat.abs_ofNat, mul_assoc] |
| 165 | _ ≤ n * (D.f * D.a * D.logB ^ 5) := by grw [h_error_budget] |
| 166 | |
| 167 | end New |