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 | public import New.Spanning.RemainingTerms.Data |
| 5 | import New.Spanning.RemainingTerms.FramesOverLattice |
| 6 | import New.Spanning.RemainingTerms.Gain |
| 7 | public import New.Spanning.RemainingTerms.LatticesOfCorank |
| 8 | |
| 9 | /-! |
| 10 | # The sum over pairs of near terms |
| 11 | |
| 12 | For a fixed class `c`, a pair of near terms over a block `(c, s, c')` is sorted by its label, a |
| 13 | component of `s` in the reduced image of the Bessel subgroup, and by its common lattice. Over a |
| 14 | given lattice and label there are few terms, and the sum over the lattices is bounded. |
| 15 | |
| 16 | The main notions used in the statements: |
| 17 | * a class `c : S.Classes` is a double coset of the unitary group of the definite space `X₀` at the |
| 18 | finite adeles, with representative `h_c`; |
| 19 | * a block is a triple `(c, s, c')`, with `s` in the finite group `S.ResidueGL`. A rational isometry |
| 20 | `γ` is a term over it if `h_c⁻¹ γ h_c'` is integral with reduction `s`; |
| 21 | * `S.IsNearPairOverAgreeingBlock c c' q`: the two terms in `q` are near, are the chosen |
| 22 | representatives of their double cosets, have a cell rank, and lie over one block `(c, s, c')` |
| 23 | whose `s` agrees (`S.Agrees s`); |
| 24 | * `commonLink γ γ'`: the subspace of `X₀` that two terms have in common; its dimension is the rank |
| 25 | of their common lattice `L₁₂ = S.pairLattice c c' γ γ'`, which has corank `l` if this dimension is |
| 26 | `k - l`; |
| 27 | * `S.termLattice c c' γ`: the lattice `L_γ ⊆ Λ ∩ X₀` of a term, where `Λ` is the adelic lattice of |
| 28 | the class `c` and `Λ ∩ X₀` is `S.classLatticeX₀ c`. |
| 29 | |
| 30 | The main result is `New.Filling.sum_pairDiscriminant_inv_le`. |
| 31 | -/ |
| 32 | |
| 33 | @[expose] public section |
| 34 | |
| 35 | namespace New.Filling |
| 36 | |
| 37 | open NumberField Matrix Module Fintype ENNReal Pointwise |
| 38 | |
| 39 | variable {E : Type} [Field E] [CMType E] [HasPrimitiveRoot5040 E] {𝔰 : Shape} {S : Filling E 𝔰} |
| 40 | |
| 41 | /-- If every index `i` is related by `R` to some `y` of the same weight, and at most `x` indices are |
| 42 | related to each `y`, then the sum over the indices is at most `x` times the sum over the `y`. -/ |
| 43 | lemma tsum_le_tsum_mul_of_encard_le {I Y : Type} {v : I → ℝ≥0∞} {w : Y → ℝ≥0∞} {x : ℝ≥0∞} |
| 44 | (R : I → Y → Prop) (h_cover : ∀ i : I, ∃ y : Y, R i y ∧ v i = w y) |
| 45 | (h_fibre : ∀ y : Y, {i : I | R i y}.encard ≤ x) : ∑' i : I, v i ≤ (∑' y : Y, w y) * x := by |
| 46 | choose chosenY h_over h_weight using h_cover |
| 47 | calc ∑' i, v i = ∑' y, ∑' i : chosenY ⁻¹' {y}, v i := (tsum_fiberwise v chosenY).symm |
| 48 | _ ≤ ∑' y, w y * x := tsum_le_tsum fun y ↦ by |
| 49 | have h_const (i : chosenY ⁻¹' {y}) : v i = w y := by |
| 50 | rw [h_weight i, show chosenY i = y from i.property] |
| 51 | have h_subset : chosenY ⁻¹' {y} ⊆ {i : I | R i y} := |
| 52 | fun i (hi : chosenY i = y) ↦ by simpa [hi] using h_over i |
| 53 | rw [tsum_congr h_const, tsum_set_const, mul_comm] |
| 54 | grw [h_subset, h_fibre] |
| 55 | _ = (∑' y, w y) * x := ENNReal.tsum_mul_right |
| 56 | |
| 57 | /-- For positive `n` and `l ≤ n ^ 3`, twice the exponent `2000 n ^ 6 (l + 1) f` in the |
| 58 | count of the terms over a lattice is at most `10 ^ 5 n ^ 9 f`. -/ |
| 59 | lemma two_mul_count_exponent_le {n f l : ℕ} (hn : 0 < n) (hl : l ≤ n ^ 3) : |
| 60 | 2 * (2000 * n ^ 6 * (l + 1) * f) ≤ 10 ^ 5 * n ^ 9 * f := by |
| 61 | have h_cube : 1 ≤ n ^ 3 := Nat.pow_pos hn |
| 62 | have h_corank : n ^ 6 * (l + 1) * f ≤ n ^ 6 * (n ^ 3 + n ^ 3) * f := by gcongr |
| 63 | linarith [Nat.zero_le (n ^ 9 * f)] |
| 64 | |
| 65 | variable (S) in |
| 66 | /-- The terms `γ` and `γ'` from the class `c'` to the class `c` both have the label `t` |
| 67 | (`S.IsNearTermAt`), and their common lattice `S.pairLattice c c' γ γ'` is a lattice in `Λ ∩ X₀` that |
| 68 | lies in the lattices `S.termLattice` of both terms and whose rank is the dimension of |
| 69 | `commonLink γ γ'`, the subspace of `X₀` that the terms share. -/ |
| 70 | structure IsLabelledPair (c c' : S.Classes) (t : S.reducedImage besselS) (γ γ' : S.G E) : Prop where |
| 71 | /-- The first term is near and has the label `t`. -/ |
| 72 | isNearTermAt_left : S.IsNearTermAt c t (c', γ) |
| 73 | /-- The second term is near and has the label `t`. -/ |
| 74 | isNearTermAt_right : S.IsNearTermAt c t (c', γ') |
| 75 | /-- The common lattice lies in the lattice of the first term. -/ |
| 76 | le_termLattice_left : S.pairLattice c c' γ γ' ≤ S.termLattice c c' γ |
| 77 | /-- The common lattice lies in the lattice of the second term. -/ |
| 78 | le_termLattice_right : S.pairLattice c c' γ γ' ≤ S.termLattice c c' γ' |
| 79 | /-- The common lattice lies in `Λ ∩ X₀`. -/ |
| 80 | le_classLatticeX₀ : S.pairLattice c c' γ γ' ≤ S.classLatticeX₀ c |
| 81 | /-- The rank of the common lattice is the dimension of the subspace that the terms share. -/ |
| 82 | isLatticeOfRank : IsLatticeOfRank (finrank E (commonLink γ γ')) (S.pairLattice c c' γ γ') |
| 83 | |
| 84 | /-- Let `E` be a CM field with a primitive 5040th root of unity, `S` admissible filling data of |
| 85 | shape `𝔰` over `E`, and `c`, `c'` classes. A near pair consists of two rational isometries `γ`, `γ'` |
| 86 | that are near, chosen in their double cosets and of some cell rank, and lie over one block |
| 87 | `(c, s, c')`: both `h_c⁻¹ γ h_c'` and `h_c⁻¹ γ' h_c'` are integral with the same reduction `s`, |
| 88 | which agrees (`S.Agrees s`). Such a pair has a common label `t`, and the lattices `S.termLattice` of |
| 89 | both terms contain their common lattice `S.pairLattice c c' γ γ'`. This is a lattice in |
| 90 | `Λ ∩ X₀ = S.classLatticeX₀ c`. -/ |
| 91 | lemma exists_isLabelledPair_of_isNearPairOverAgreeingBlock {c c' : S.Classes} |
| 92 | {γ γ' : S.G E} (h_pair : S.IsNearPairOverAgreeingBlock c c' (γ, γ')) : |
| 93 | ∃ t : S.reducedImage besselS, S.IsLabelledPair c c' t γ γ' := by |
| 94 | obtain ⟨⟨h_near, h_level⟩, ⟨h_near', h_level'⟩, s, hs, h_over, h_over'⟩ := h_pair |
| 95 | -- The label is that of the block `(c, s, c')` over which both terms lie. The common lattice is |
| 96 | -- cut out of the intersection of the lattices of the two terms, each of which lies in `Λ ∩ X₀`. |
| 97 | have h_le_inf : S.pairLattice c c' γ γ' ≤ S.termLattice c c' γ ⊓ S.termLattice c c' γ' := |
| 98 | inf_le_right |
| 99 | exact ⟨(Subgroup.groupEquivQuotientProdSubgroup s).2, |
| 100 | { isNearTermAt_left := ⟨⟨h_near, _, h_level⟩, s, h_over, rfl⟩ |
| 101 | isNearTermAt_right := ⟨⟨h_near', _, h_level'⟩, s, h_over', rfl⟩ |
| 102 | le_termLattice_left := h_le_inf.trans inf_le_left |
| 103 | le_termLattice_right := h_le_inf.trans inf_le_right |
| 104 | le_classLatticeX₀ := (h_le_inf.trans inf_le_left).trans inf_le_left |
| 105 | isLatticeOfRank := isLatticeOfRank_pairLattice hs h_over h_over' h_level h_level' }⟩ |
| 106 | |
| 107 | variable (S) in |
| 108 | /-- The lattices `L ⊆ Λ ∩ X₀` of rank `r` with discriminant at most `S.discriminantBound`. -/ |
| 109 | abbrev ClassBoundedDiscLattice (c : S.Classes) (r : ℕ) : Type := |
| 110 | S.BoundedDiscSublattice r (S.classLatticeX₀ c) |
| 111 | |
| 112 | variable (S) in |
| 113 | /-- The near pairs over a block `(c, s, c')` with agreeing `s` |
| 114 | (`S.IsNearPairOverAgreeingBlock c c'`) whose common lattice has corank `l` and discriminant at most |
| 115 | `S.discriminantBound`. -/ |
| 116 | def boundedDiscNearPairs (l : ℕ) (c c' : S.Classes) : Set (S.G E × S.G E) := |
| 117 | {q : S.G E × S.G E | S.IsNearPairOverAgreeingBlock c c' q ∧ |
| 118 | finrank E (commonLink q.1 q.2) + l = 𝔰.k ∧ |
| 119 | S.pairDiscriminant c c' q.1 q.2 ≤ S.discriminantBound} |
| 120 | |
| 121 | /-- For admissible filling data `S` of shape `𝔰` over a CM field `E` with a primitive 5040th root |
| 122 | of unity, a class `c`, a label `t` in `S.reducedImage besselS`, and a bounded-discriminant lattice |
| 123 | `L` in `S.ClassBoundedDiscLattice c r` of rank `r` and corank `l ≤ 𝔰.n ^ 3` (`r + l = 𝔰.k`), the |
| 124 | square of the set of near terms of class `c` and label `t` whose lattice `S.termLattice` contains |
| 125 | `L` has cardinality at most `S.tailScale`. -/ |
| 126 | private lemma encard_prod_nearTerms_le [S.IsAdmissible] {c : S.Classes} {r l : ℕ} |
| 127 | (hl_le : l ≤ 𝔰.n ^ 3) (h_rank : r + l = 𝔰.k) |
| 128 | (t : S.reducedImage besselS) (L : S.ClassBoundedDiscLattice c r) : |
| 129 | (({p : S.Classes × S.G E | S.IsNearTermAt c t p ∧ L.val ≤ S.termLattice c p.1 p.2} ×ˢ |
| 130 | {p : S.Classes × S.G E | S.IsNearTermAt c t p ∧ L.val ≤ S.termLattice c p.1 p.2}).encard : |
| 131 | ℝ≥0∞) ≤ ENNReal.ofReal S.tailScale := by |
| 132 | obtain ⟨L, hL, h_le, h_disc⟩ := L |
| 133 | let termsOverL : Set (S.Classes × S.G E) := |
| 134 | {p | S.IsNearTermAt c t p ∧ L ≤ S.termLattice c p.1 p.2} |
| 135 | let exponent : ℕ := 2000 * 𝔰.n ^ 6 * (l + 1) * numInfPlaces E |
| 136 | have h_exponent : 2 * exponent ≤ 10 ^ 5 * 𝔰.n ^ 9 * numInfPlaces E := |
| 137 | two_mul_count_exponent_le 𝔰.ϱ.succ_pos hl_le |
| 138 | have h_terms : termsOverL.encard ≤ ENNReal.ofReal (S.b ^ exponent) := |
| 139 | encard_setOf_isNearTermAt_and_le_termLattice_le t h_rank hL h_le h_disc |
| 140 | calc ((termsOverL ×ˢ termsOverL).encard : ℝ≥0∞) |
| 141 | ≤ .ofReal (S.b ^ exponent) * .ofReal (S.b ^ exponent) := by |
| 142 | grw [Set.encard_prod, ENat.toENNReal_mul, h_terms] |
| 143 | _ = .ofReal (S.b ^ (2 * exponent)) := by |
| 144 | rw [← ofReal_mul (pow_nonneg (zero_le_one.trans S.one_le_b) exponent), ← pow_add, two_mul] |
| 145 | _ ≤ .ofReal S.tailScale := ofReal_le_ofReal (pow_le_tailScale h_exponent) |
| 146 | |
| 147 | /-- Let `E` be a CM field with a primitive 5040th root of unity and `f` infinite places, `S` |
| 148 | admissible filling data of shape `𝔰` over `E` with size parameter `b = S.b`, and `c` a class, with |
| 149 | adelic lattice `Λ`. Let `n = 𝔰.n`, let `k = 𝔰.k` be the dimension of the definite space `X₀`, and |
| 150 | let `l ≤ n³`, `r + l = k`. A near pair over `(c, c')` is two near, chosen terms over one block |
| 151 | `(c, s, c')` with `s` agreeing; its common lattice `L₁₂ ⊆ Λ ∩ X₀` has rank the dimension of the |
| 152 | subspace of `X₀` that the terms share, and corank `l` if this rank is `r`. The sum of |
| 153 | `(disc L₁₂) ^ (-k)` over all classes `c'` and all such pairs with corank `l` and discriminant at |
| 154 | most `S.discriminantBound = b ^ (n³ f)` is at most the number of labels, times the sum of |
| 155 | `(disc L) ^ (-k)` over the lattices `L ⊆ Λ ∩ X₀` of rank `r` with the same bound on the |
| 156 | discriminant, times `S.tailScale = b ^ (k f / 4)`. -/ |
| 157 | lemma sum_pairDiscriminant_inv_le_tsum [S.IsAdmissible] {c : S.Classes} {r l : ℕ} |
| 158 | (hl_le : l ≤ 𝔰.n ^ 3) (h_rank : r + l = 𝔰.k) : |
| 159 | ∑ c' : S.Classes, ∑' q : S.boundedDiscNearPairs l c c', |
| 160 | ENNReal.ofReal (S.pairDiscriminant c c' q.val.fst q.val.snd ^ 𝔰.k)⁻¹ ≤ |
| 161 | Nat.card (S.reducedImage besselS) * |
| 162 | (∑' L : S.ClassBoundedDiscLattice c r, |
| 163 | ENNReal.ofReal (discriminant r (L : Submodule (Ô E) (𝔰.κ → 𝔸f E)) ^ 𝔰.k)⁻¹) * |
| 164 | ENNReal.ofReal S.tailScale := by |
| 165 | -- Send a pair to its label and common lattice. Both of its terms then lie in the set `terms` of |
| 166 | -- this label and lattice, so each fibre has at most as many elements as the square of that set. |
| 167 | let terms : S.reducedImage besselS × S.ClassBoundedDiscLattice c r → Set (S.Classes × S.G E) := |
| 168 | fun (t, L) ↦ {p | S.IsNearTermAt c t p ∧ L.val ≤ S.termLattice c p.1 p.2} |
| 169 | let termPair : (Σ c' : S.Classes, S.boundedDiscNearPairs l c c') → |
| 170 | (S.Classes × S.G E) × S.Classes × S.G E |
| 171 | | ⟨c', (γ, γ'), _⟩ => ((c', γ), (c', γ')) |
| 172 | have h_inj : Function.Injective termPair := by |
| 173 | rintro ⟨c', ⟨γ, γ'⟩, h_mem⟩ ⟨c'', ⟨δ, δ'⟩, h_mem'⟩ h_eq |
| 174 | obtain ⟨⟨rfl, rfl⟩, -, rfl⟩ : (c' = c'' ∧ γ = δ) ∧ c' = c'' ∧ γ' = δ' := by |
| 175 | simpa only [termPair, Prod.mk.injEq] using h_eq |
| 176 | rfl |
| 177 | rw [← tsum_fintype (L := .unconditional _), ← tsum_sigma] |
| 178 | refine (tsum_le_tsum_mul_of_encard_le (x := .ofReal S.tailScale) |
| 179 | (w := fun (_, L) ↦ .ofReal (discriminant r L.val ^ 𝔰.k)⁻¹) |
| 180 | (fun i y ↦ termPair i ∈ terms y ×ˢ terms y) ?_ ?_).trans_eq ?_ |
| 181 | · -- Both terms of a pair have the label of its block, and their lattices contain the common one. |
| 182 | rintro ⟨c', ⟨γ, γ'⟩, h_pair, h_link, h_disc⟩ |
| 183 | obtain rfl : r = finrank E (commonLink γ γ') := Nat.add_right_cancel (h_rank.trans h_link.symm) |
| 184 | obtain ⟨t, ht⟩ : ∃ t : S.reducedImage besselS, S.IsLabelledPair c c' t γ γ' := |
| 185 | exists_isLabelledPair_of_isNearPairOverAgreeingBlock h_pair |
| 186 | let L : S.ClassBoundedDiscLattice c (finrank E (commonLink γ γ')) := |
| 187 | ⟨S.pairLattice c c' γ γ', ht.isLatticeOfRank, ht.le_classLatticeX₀, h_disc⟩ |
| 188 | have h_left : (c', γ) ∈ terms (t, L) := ⟨ht.isNearTermAt_left, ht.le_termLattice_left⟩ |
| 189 | have h_right : (c', γ') ∈ terms (t, L) := ⟨ht.isNearTermAt_right, ht.le_termLattice_right⟩ |
| 190 | exact ⟨(t, L), Set.mk_mem_prod h_left h_right, rfl⟩ |
| 191 | · -- The number of choices for both terms is at most the square of the count over a lattice. |
| 192 | rintro ⟨t, L⟩ |
| 193 | calc ((termPair ⁻¹' (terms (t, L) ×ˢ terms (t, L))).encard : ℝ≥0∞) |
| 194 | ≤ (terms (t, L) ×ˢ terms (t, L)).encard := mod_cast Set.encard_le_encard_of_injOn |
| 195 | (Set.mapsTo_preimage termPair (terms (t, L) ×ˢ terms (t, L))) h_inj.injOn |
| 196 | _ ≤ .ofReal S.tailScale := encard_prod_nearTerms_le hl_le h_rank t L |
| 197 | · simp [tsum_prod', ENat.card_eq_coe_natCard] |
| 198 | |
| 199 | /-- **Count.** Let `E` be a CM field with a primitive 5040th root of unity and `f` infinite places, |
| 200 | and let `S` be admissible filling data of shape `𝔰` over `E`, with size parameter `b = S.b` and |
| 201 | prime `N = S.N`. Let `n = 𝔰.n`, let `k = 𝔰.k` be the dimension of the definite space `X₀`, and let |
| 202 | `l ≤ n³`. For classes `c`, `c'` a near pair is two near, chosen terms over one block `(c, s, c')` |
| 203 | with `s` agreeing; its common lattice `L₁₂` is a lattice in `X₀` of rank the dimension of the |
| 204 | subspace that the terms share, and has corank `l` if this rank is `k - l`. The sum of |
| 205 | `(disc L₁₂) ^ (-k)` over all `c`, `c'` and all such pairs with corank `l` and discriminant at most |
| 206 | `S.discriminantBound = b ^ (n³ f)` is at most `tailScale ^ (l + 2) * pairCountScale`. Here |
| 207 | `tailScale = b ^ (k f / 4)`, and `pairCountScale` is the number of labels times the number of |
| 208 | classes, divided by `N ^ (k f)`. -/ |
| 209 | theorem sum_pairDiscriminant_inv_le [S.IsAdmissible] {l : ℕ} (hl_le : l ≤ 𝔰.n ^ 3) : |
| 210 | ∑ c : S.Classes, ∑ c' : S.Classes, ∑' q : S.boundedDiscNearPairs l c c', |
| 211 | ENNReal.ofReal (S.pairDiscriminant c c' q.val.fst q.val.snd ^ 𝔰.k)⁻¹ ≤ |
| 212 | ENNReal.ofReal (S.tailScale ^ (l + 2) * S.pairCountScale) := by |
| 213 | obtain h_corank_gt | h_corank_le := lt_or_ge 𝔰.k l |
| 214 | · -- No lattice has corank above `k`, so the sum is empty. |
| 215 | have h_empty (c c' : S.Classes) : IsEmpty (S.boundedDiscNearPairs l c c') := by |
| 216 | refine ⟨fun ⟨q, h_pair, h_link, h_disc⟩ ↦ ?_⟩ |
| 217 | have h_le : l ≤ 𝔰.k := Nat.le_of_add_left_le h_link.le |
| 218 | exact h_corank_gt.not_ge h_le |
| 219 | simp only [tsum_empty, Finset.sum_const_zero, zero_le] |
| 220 | obtain ⟨r, h_rank⟩ : ∃ r : ℕ, r + l = 𝔰.k := ⟨𝔰.k - l, Nat.sub_add_cancel h_corank_le⟩ |
| 221 | have h_tailScale_nonneg : 0 ≤ S.tailScale := Real.rpow_nonneg (zero_le_one.trans S.one_le_b) _ |
| 222 | let ratio : ℝ := card S.Classes / S.N ^ (𝔰.k * numInfPlaces E) |
| 223 | calc _ ≤ ∑ c : S.Classes, Nat.card (S.reducedImage besselS) * |
| 224 | (∑' L : S.ClassBoundedDiscLattice c r, |
| 225 | ENNReal.ofReal (discriminant r L.val ^ 𝔰.k)⁻¹) * .ofReal S.tailScale := |
| 226 | Finset.sum_le_sum fun c _ ↦ sum_pairDiscriminant_inv_le_tsum hl_le h_rank |
| 227 | _ ≤ Nat.card (S.reducedImage besselS) * .ofReal (ratio * S.tailScale ^ (l + 1)) * |
| 228 | .ofReal S.tailScale := by |
| 229 | grw [← Finset.sum_mul, ← Finset.mul_sum, sum_discriminant_inv_le h_rank] |
| 230 | _ = .ofReal (S.tailScale ^ (l + 2) * S.pairCountScale) := by |
| 231 | rw [← ofReal_natCast, ← ofReal_mul (by positivity), ← ofReal_mul (by positivity), |
| 232 | pairCountScale] |
| 233 | congr 1 |
| 234 | ring |
| 235 | |
| 236 | end New.Filling |