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 | public import Lib.Weil.Periods.PointLattice |
| 4 | |
| 5 | /-! |
| 6 | # The string of a graded space as the powers `𝔢 ^ i` |
| 7 | |
| 8 | The orthogonal complement of `X` in a graded space with a string of `s` vectors behaves like |
| 9 | `E[𝔢] / (𝔢 ^ s)`: the vector called `𝔢 ^ i` is `New.Grading.stringPower`, a multiple of the string |
| 10 | vector with number `i`. That vector has grade `s - 1 - 2 * i`. |
| 11 | |
| 12 | * `New.Grading.stringMap_mulVec_stringPower`: the map `New.Grading.stringMap` between neighbouring |
| 13 | spaces is the projection `E[𝔢] / (𝔢 ^ s) → E[𝔢] / (𝔢 ^ (s - 1))`. |
| 14 | * `New.Grading.exists_stringSum_eq`, `New.Grading.stringMapFin_stringSum`: over the finite adeles |
| 15 | the `𝔢 ^ i` span the complement of `X` (the vectors fixed by the projection |
| 16 | `New.Grading.stringProj` to the span of the string vectors), and `New.Grading.stringMapFin` |
| 17 | keeps the coordinates in `𝔢 ^ i` for `i < s - 1`. |
| 18 | |
| 19 | Notions from other files: |
| 20 | * `New.Space E ι ε`: a hermitian matrix `V.J` over `E`, indexed by `ι`, with an adelic point; |
| 21 | * `New.Grading V N X s`: an identification `X ⊕ Fin s ≃ ι` under which string vector `i` pairs only |
| 22 | with string vector `s - 1 - i`, to `1` (to `-N` in the middle), a constant `c = star c ≠ 0`, and |
| 23 | the fact `N = star N ≠ 0`; |
| 24 | * `New.Grading.stringMap`, `New.Grading.stringMapFin`: the map that kills `X` and the string vector |
| 25 | `s - 1` and keeps the number of any other string vector, up to a factor, and its part at the |
| 26 | finite adeles; |
| 27 | -/ |
| 28 | |
| 29 | @[expose] public section |
| 30 | |
| 31 | open Matrix |
| 32 | |
| 33 | noncomputable section |
| 34 | |
| 35 | namespace New.Grading |
| 36 | |
| 37 | variable {E X X' ι ι' : Type} [Field E] [CMType E] [Fintype ι] [DecidableEq ι] [Fintype ι'] |
| 38 | [DecidableEq ι'] [DecidableEq X] [DecidableEq X'] |
| 39 | {ε : ι → ℤˣ} {ε' : ι' → ℤˣ} {s : ℕ} {N : E} {V : Space E ι ε} {V' : Space E ι' ε'} |
| 40 | (Y : Grading V N X s) |
| 41 | |
| 42 | /-- The coefficient of `𝔢 ^ i` at the string vector `i`: a power of the constant `c` of the grading, |
| 43 | times `-N` if that vector has negative grade, that is if `s ≤ 2 * i`. -/ |
| 44 | def powerCoeff (i : ℕ) : E := |
| 45 | if 2 * i < s then Y.genericConst.val ^ (i - s / 2 : ℤ) else -N * Y.genericConst.val ^ |
| 46 | (i - (s - 1) / 2 : ℤ) |
| 47 | |
| 48 | /-- The vector `𝔢 ^ i` of the complement `E[𝔢] / (𝔢 ^ s)` of `X`: the multiple `Y.powerCoeff i` of |
| 49 | the string vector `i`, and `0` for `s ≤ i`. -/ |
| 50 | def stringPower (i : ℕ) (k : ι) : E := |
| 51 | (Y.indexEquiv.symm k).elim 0 fun b : Fin s ↦ if b.val = i then Y.powerCoeff i else 0 |
| 52 | |
| 53 | /-- For a grading `Y` whose string has length `s`, the vector `𝔢 ^ i` is `Y.powerCoeff i` times the |
| 54 | `i`-th string vector. If that vector has nonnegative grade `s − 1 − 2i` (`2 * i < s`), this |
| 55 | coefficient is `c ^ n` for `n = i - s / 2`, where `c` is the constant `Y.genericConst`. -/ |
| 56 | lemma powerCoeff_of_lt {i : ℕ} {n : ℤ} (hi : 2 * i < s) (hn : n = i - s / 2) : |
| 57 | Y.powerCoeff i = Y.genericConst.val ^ n := by |
| 58 | rw [powerCoeff, ite_eq_left hi, hn] |
| 59 | |
| 60 | /-- In negative grade (`s ≤ 2 * i`) the coefficient of `𝔢 ^ i` is `-N * c ^ n` for |
| 61 | `n = i - (s - 1) / 2`. -/ |
| 62 | lemma powerCoeff_of_le {i : ℕ} {n : ℤ} (hi : s ≤ 2 * i) (hn : n = i - (s - 1) / 2) : |
| 63 | Y.powerCoeff i = -N * Y.genericConst.val ^ n := by |
| 64 | rw [powerCoeff, ite_eq_right hi.not_gt, hn] |
| 65 | |
| 66 | /-- The coefficient `Y.powerCoeff i` of `𝔢 ^ i` is nonzero, as `c` and `N` are. -/ |
| 67 | lemma powerCoeff_ne_zero (i : ℕ) : Y.powerCoeff i ≠ 0 := by |
| 68 | simp [powerCoeff, ite_eq_iff, zpow_ne_zero _ Y.genericConst.property.left, |
| 69 | Y.N_ne_zero_and_star_eq.left] |
| 70 | |
| 71 | /-- For `i < s` the vector `𝔢 ^ i` is supported at the string index `i`. -/ |
| 72 | lemma stringPower_eq_single (i : Fin s) : |
| 73 | Y.stringPower i = Pi.single (Y.indexEquiv (.inr i)) (Y.powerCoeff i) := by |
| 74 | funext k |
| 75 | obtain ⟨a | b, rfl⟩ := Y.indexEquiv.surjective k <;> |
| 76 | simp [stringPower, Pi.single_apply, Fin.ext_iff] |
| 77 | |
| 78 | lemma stringPower_eq_zero {i : ℕ} (hi : s ≤ i) : Y.stringPower i = 0 := by |
| 79 | funext k |
| 80 | obtain ⟨a | b, rfl⟩ := Y.indexEquiv.surjective k |
| 81 | · simp [stringPower] |
| 82 | · simp [stringPower, show b.val ≠ i by omega] |
| 83 | |
| 84 | /-- For gradings `Y` and `Y'` of string lengths `s` and `s - 1` with the same constant `c`, the |
| 85 | factor of `Y.stringMap Y'` at the string vector `i` (the two `if`s below) times the coefficient of |
| 86 | `𝔢 ^ i` in `Y` is its coefficient in `Y'`. -/ |
| 87 | lemma stringMap_factor_mul_powerCoeff (Y' : Grading V' N X' (s - 1)) |
| 88 | (hc : Y'.genericConst = Y.genericConst) (i : ℕ) : |
| 89 | (if Odd s ↔ 2 * i + 1 < s then 1 else Y.genericConst.val) * (if 2 * i + 1 = s then -N else 1) * |
| 90 | Y.powerCoeff i = Y'.powerCoeff i := by |
| 91 | have hc_ne : Y.genericConst.val ≠ 0 := Y.genericConst.property.left |
| 92 | -- The exponent of `c` in the factor. |
| 93 | set e : ℤ := if s % 2 = 1 ↔ 2 * i + 1 < s then 0 else 1 |
| 94 | have h_factor : (if Odd s ↔ 2 * i + 1 < s then 1 else Y.genericConst.val) = Y.genericConst.val ^ |
| 95 | e := by |
| 96 | simp [e, Nat.odd_iff] |
| 97 | rw [h_factor] |
| 98 | have h_nonneg (hi : 2 * i < s) : Y.powerCoeff i = Y.genericConst.val ^ (i - s / 2 : ℤ) := |
| 99 | Y.powerCoeff_of_lt hi rfl |
| 100 | -- The grade of `𝔢 ^ i` is positive, `0` or negative. |
| 101 | obtain h | h | h := lt_trichotomy (2 * i + 1) s |
| 102 | · have h_right : Y'.powerCoeff i = Y'.genericConst.val ^ (e + (i - s / 2) : ℤ) := |
| 103 | Y'.powerCoeff_of_lt (by omega) (by omega) |
| 104 | rw [ite_eq_right h.ne, mul_one, h_nonneg (by omega), h_right, hc, zpow_add₀ hc_ne] |
| 105 | · have h_right : Y'.powerCoeff i = -N * Y'.genericConst.val ^ (e + (i - s / 2) : ℤ) := |
| 106 | Y'.powerCoeff_of_le (by omega) (by omega) |
| 107 | rw [ite_eq_left h, h_nonneg (by omega), h_right, hc, zpow_add₀ hc_ne] |
| 108 | ring |
| 109 | · have h_left : Y.powerCoeff i = -N * Y.genericConst.val ^ (i - (s - 1) / 2 : ℤ) := |
| 110 | Y.powerCoeff_of_le (by omega) rfl |
| 111 | have h_right : Y'.powerCoeff i = -N * Y'.genericConst.val ^ (e + (i - (s - 1) / 2) : ℤ) := |
| 112 | Y'.powerCoeff_of_le (by omega) (by omega) |
| 113 | rw [ite_eq_right h.ne', h_left, h_right, hc, zpow_add₀ hc_ne] |
| 114 | ring |
| 115 | |
| 116 | /-- Let `Y'` be a grading of a second space `V'` with the same `N` and string length `s - 1`. Assume |
| 117 | `Y'` carries the same constant `c` as `Y`, where `c = c̄ ≠ 0` is the element of `E` that each |
| 118 | grading carries for the generic character. Then for `i < s` the matrix `Y.stringMap Y'` sends |
| 119 | `Y.stringPower i` (the vector `𝔢 ^ i` of `V`, seen over the adeles by the diagonal embedding |
| 120 | `toAdele`) to `Y'.stringPower i` (the vector `𝔢 ^ i` of `V'`), which is `0` for `i = s - 1`. -/ |
| 121 | lemma stringMap_mulVec_stringPower (Y' : Grading V' N X' (s - 1)) |
| 122 | (hc : Y'.genericConst = Y.genericConst) (i : Fin s) : |
| 123 | Y.stringMap Y' *ᵥ toAdele ∘ Y.stringPower i = toAdele ∘ Y'.stringPower i := by |
| 124 | funext k |
| 125 | rw [stringMap, ← RingHom.map_mulVec, stringPower_eq_single, mulVec_single] |
| 126 | obtain ⟨a | b, rfl⟩ := Y'.indexEquiv.surjective k |
| 127 | · simp [stringPower] |
| 128 | · -- At the string index `b` both sides are `Y'.powerCoeff i` if `b = i`, else `0`. |
| 129 | by_cases hb : b.val = i <;> |
| 130 | simp [stringPower, hb, ← Y.stringMap_factor_mul_powerCoeff Y' hc i] |
| 131 | |
| 132 | /-- The vector `∑ i < s, t i • 𝔢 ^ i` over the finite adeles, with coefficients `t`. -/ |
| 133 | def stringSum (t : ℕ → 𝔸f E) : ι → 𝔸f E := |
| 134 | ∑ i ∈ Finset.range s, t i • algebraMap E (𝔸f E) ∘ Y.stringPower i |
| 135 | |
| 136 | variable {Y} |
| 137 | |
| 138 | lemma stringProj_stringSum (t : ℕ → 𝔸f E) : |
| 139 | Y.stringProj (Y.stringSum t) = Y.stringSum t := |
| 140 | stringProj_eq_self_iff.2 (by simp [stringSum, stringPower]) |
| 141 | |
| 142 | /-- At the string index `b` the sum `∑ t i • 𝔢 ^ i` has the entry `Y.powerCoeff b * t b`. -/ |
| 143 | lemma stringSum_apply_inr (t : ℕ → 𝔸f E) (b : Fin s) : |
| 144 | Y.stringSum t (Y.indexEquiv (.inr b)) = algebraMap E (𝔸f E) (Y.powerCoeff b) * t b := by |
| 145 | simp [stringSum, stringPower, apply_ite (algebraMap E (𝔸f E)), mul_comm] |
| 146 | |
| 147 | /-- The vectors `𝔢 ^ i` span the complement of `X` over the finite adeles: a vector `y` fixed by |
| 148 | the projection `Y.stringProj` to the span of the string is a sum `∑ t i • 𝔢 ^ i`. -/ |
| 149 | lemma exists_stringSum_eq {y : ι → 𝔸f E} (hy : Y.stringProj y = y) : |
| 150 | ∃ t : ℕ → 𝔸f E, Y.stringSum t = y := by |
| 151 | -- The coefficient of `𝔢 ^ i` is the entry of `y` at the string index `i` over `Y.powerCoeff i`. |
| 152 | let t (i : ℕ) : 𝔸f E := if hi : i < s then |
| 153 | algebraMap E (𝔸f E) (Y.powerCoeff i)⁻¹ * y (Y.indexEquiv (.inr ⟨i, hi⟩)) else 0 |
| 154 | refine ⟨t, funext fun k ↦ ?_⟩ |
| 155 | obtain ⟨a | b, rfl⟩ := Y.indexEquiv.surjective k |
| 156 | · -- Both vectors are fixed by the projection, so both vanish at the indices in `X`. |
| 157 | rw [stringProj_eq_self_iff.1 (stringProj_stringSum t) a, stringProj_eq_self_iff.1 hy a] |
| 158 | · simp [stringSum_apply_inr, t, ← mul_assoc, ← map_mul, Y.powerCoeff_ne_zero b] |
| 159 | |
| 160 | /-- For gradings with the same constant `c`, the map `Y.stringMapFin Y'`, the finite part of |
| 161 | `Y.stringMap Y'`, sends `𝔢 ^ i` to `𝔢 ^ i`. -/ |
| 162 | lemma stringMapFin_stringPower {Y' : Grading V' N X' (s - 1)} |
| 163 | (hc : Y'.genericConst = Y.genericConst) (i : Fin s) : |
| 164 | Y.stringMapFin Y' (algebraMap E (𝔸f E) ∘ Y.stringPower i) = |
| 165 | algebraMap E (𝔸f E) ∘ Y'.stringPower i := by |
| 166 | funext k |
| 167 | have h_adele : (Y.stringMap Y' *ᵥ toAdele ∘ Y.stringPower i) k = toAdele (Y'.stringPower i k) := |
| 168 | congrFun (Y.stringMap_mulVec_stringPower Y' hc i) k |
| 169 | -- Take the finite component. |
| 170 | simpa [stringMapFin, mulVec, dotProduct, Prod.snd_sum, toAdele] using congrArg Prod.snd h_adele |
| 171 | |
| 172 | /-- For gradings `Y` and `Y'` of string lengths `s` and `s - 1` with the same constant `c`, the map |
| 173 | `Y.stringMapFin Y'`, the finite part of `Y.stringMap Y'`, acts on the sums `∑ t i • 𝔢 ^ i` as the |
| 174 | projection `E[𝔢] / (𝔢 ^ s) → E[𝔢] / (𝔢 ^ (s - 1))`: it keeps `t i` for `i < s - 1`. -/ |
| 175 | lemma stringMapFin_stringSum {Y' : Grading V' N X' (s - 1)} (hc : Y'.genericConst = Y.genericConst) |
| 176 | (t : ℕ → 𝔸f E) : |
| 177 | Y.stringMapFin Y' (Y.stringSum t) = Y'.stringSum t := by |
| 178 | calc Y.stringMapFin Y' (Y.stringSum t) |
| 179 | _ = ∑ i ∈ Finset.range s, t i • algebraMap E (𝔸f E) ∘ Y'.stringPower i := by |
| 180 | rw [stringSum, map_sum] |
| 181 | refine Finset.sum_congr rfl fun i hi ↦ ?_ |
| 182 | rw [map_smul, stringMapFin_stringPower hc ⟨i, Finset.mem_range.1 hi⟩] |
| 183 | _ = Y'.stringSum t := by |
| 184 | -- The term for `i = s - 1` vanishes in `Y'`. |
| 185 | refine (Finset.sum_subset (by simp) fun i _ hi ↦ ?_).symm |
| 186 | simp [Y'.stringPower_eq_zero (show s - 1 ≤ i by simpa using hi)] |
| 187 | |
| 188 | end New.Grading |
| 189 | |
| 190 | end |