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 | # Finitely many orbits of lattices satisfy the bounds |
| 7 | |
| 8 | Let `V` be a hermitian space presented as a part `X` plus a string of vectors. For a finite point |
| 9 | `x` let `Λ'⁻` be the intersection of its lattice with `X^⊥`, and `Λ⁻` the same for the point `1`. |
| 10 | The bounds are `q̄ ^ k Λ⁻ ⊆ Λ'⁻` and `q ^ k Λ'⁻ ⊆ Λ⁻`, for a finite adele `q` and a natural number |
| 11 | `k`. |
| 12 | |
| 13 | * `New.Grading.finite_image_latticeMinus`: if `q` is invertible, finitely many `Λ'⁻` satisfy the |
| 14 | bounds. |
| 15 | * `New.Grading.HasLatticeBounds.latticeMinus_componentOn`: under the bounds, `Λ'⁻` does not change |
| 16 | when the components of `x` outside `Q ∪ Q̄` are replaced by `1`, for a set `Q` of places outside |
| 17 | which `q` has valuation `1`. |
| 18 | * `New.Grading.exists_finite_representatives`: let `E` contain a primitive root of unity of order |
| 19 | 5040, let `q` be invertible and have valuation `1` outside `Q`. Among the double cosets under the |
| 20 | finite Bessel subgroup and the stabiliser of the standard lattice, those with bounded orbit have |
| 21 | finitely many representatives, supported on `Q ∪ Q̄`. |
| 22 | |
| 23 | Notions from other files: |
| 24 | * `New.Grading`: an indexing of the basis of `V` by `X` and a string of vectors, with Gram matrix |
| 25 | `1` on `X` and anti-diagonal on the string, which spans `X^⊥`; `stringProj` projects onto `X^⊥`. |
| 26 | It gives each basis vector an integer grade; the part of a vector in a grade is its projection to |
| 27 | the span of the basis vectors of that grade. |
| 28 | * `New.Space.lattice`: the lattice of a point `x`, the vectors with integral coordinates (entries in |
| 29 | `Ô E`) in its frame, the columns of the matrix `V.xFin * x`, where `V.xFin` is the fixed |
| 30 | invertible finite adelic matrix whose columns span the lattice of the point `1`. |
| 31 | * `New.idem`: the finite adele that is `1` at the places of a set and `0` at the others. |
| 32 | * `atPlace`: the component of a finite point at a place; `v`: the valuation of such a place. |
| 33 | |
| 34 | ## Relation to the literature |
| 35 | |
| 36 | Known result: there are finitely many lattices between two given ones, and a lattice is determined |
| 37 | by its local components. Source: O'Meara, Introduction to Quadratic Forms, §81. |
| 38 | -/ |
| 39 | |
| 40 | @[expose] public section |
| 41 | |
| 42 | open IsDedekindDomain (FiniteAdeleRing) |
| 43 | |
| 44 | open Matrix Pointwise Valued |
| 45 | |
| 46 | noncomputable section |
| 47 | |
| 48 | namespace New |
| 49 | |
| 50 | variable {E X ι : Type} [Field E] [CMType E] [Fintype ι] [DecidableEq ι] |
| 51 | [DecidableEq X] {ε : ι → ℤˣ} {s : ℕ} {N : E} {V : Space E ι ε} |
| 52 | |
| 53 | namespace Space |
| 54 | |
| 55 | /-- The lattice of a finite point is open: it is the preimage of the integral vectors under the |
| 56 | inverse of the matrix of its frame. -/ |
| 57 | lemma isOpen_lattice (x : Gf E ι) : IsOpen (V.lattice x : Set (ι → 𝔸f E)) := by |
| 58 | have h_preimage : (V.lattice x : Set (ι → 𝔸f E)) = |
| 59 | (V.xFin * x.val)⁻¹.val.mulVec ⁻¹' {z | ∀ i, z i ∈ Ô E} := Set.ext fun y ↦ mem_lattice |
| 60 | rw [h_preimage] |
| 61 | exact (isOpen_intVectors isOpen_Ô).preimage (continuous_const.matrix_mulVec continuous_id) |
| 62 | |
| 63 | /-- The lattice of a finite point is compact: it is the image of the integral vectors under the |
| 64 | matrix of its frame. -/ |
| 65 | lemma isCompact_lattice (x : Gf E ι) : IsCompact (V.lattice x : Set (ι → 𝔸f E)) := by |
| 66 | have h_image : (V.lattice x : Set (ι → 𝔸f E)) = |
| 67 | (V.xFin * x.val).val.mulVec '' {z : ι → 𝔸f E | ∀ i : ι, z i ∈ Ô E} := by |
| 68 | refine Set.ext fun y ↦ ⟨fun hy ↦ ?_, ?_⟩ |
| 69 | · exact ⟨_, mem_lattice.1 hy, by simp only [mulVec_mulVec, Units.mul_inv, one_mulVec]⟩ |
| 70 | · rintro ⟨z, hz, rfl⟩ |
| 71 | exact mulVec_mem_lattice.2 hz |
| 72 | rw [h_image] |
| 73 | exact (isCompact_pi_infinite fun _ ↦ isCompact_Ô).image |
| 74 | (continuous_const.matrix_mulVec continuous_id) |
| 75 | |
| 76 | variable {x x' : Gf E ι} {y : ι → 𝔸f E} {T : Set (FinPlace E)} |
| 77 | |
| 78 | /-- The part `idem T • y` of `y` at the places of `T` lies in the lattice of `x` if and only if the |
| 79 | coordinates of `y` in the frame `V.xFin * x` of that lattice are integral at these places. -/ |
| 80 | lemma idem_smul_mem_lattice : idem T • y ∈ V.lattice x ↔ |
| 81 | ∀ i : ι, ∀ w ∈ T, v (((V.xFin * x.val)⁻¹.val *ᵥ y) i w) ≤ 1 := by |
| 82 | simp only [mem_lattice, mulVec_smul, Pi.smul_apply, smul_eq_mul, idem_mul_mem_Ô] |
| 83 | |
| 84 | /-- If two points have the same components at the places of `T`, then the part `idem T • y` of a |
| 85 | vector `y` at these places lies in both of their lattices or in neither. -/ |
| 86 | lemma idem_smul_mem_lattice_congr (h_atPlace : ∀ w ∈ T, x.atPlace w = x'.atPlace w) : |
| 87 | idem T • y ∈ V.lattice x ↔ idem T • y ∈ V.lattice x' := by |
| 88 | -- The component at `w` of the coordinates depends only on the component of the point at `w`. |
| 89 | have h_coord (g : Gf E ι) (i : ι) (w : FinPlace E) : ((V.xFin * g.val)⁻¹.val *ᵥ y) i w = |
| 90 | ((V.xFin.map (evalAt w) * g.atPlace w)⁻¹.val *ᵥ (evalAt w ∘ y)) i := by |
| 91 | change evalAt w (((V.xFin * g.val)⁻¹.val *ᵥ y) i) = |
| 92 | ((V.xFin.map (evalAt w) * g.val.map (evalAt w))⁻¹.val *ᵥ (evalAt w ∘ y)) i |
| 93 | rw [← map_mul, ← map_inv, RingHom.map_mulVec, GeneralLinearGroup.val_map_apply] |
| 94 | simp +contextual only [idem_smul_mem_lattice, h_coord, h_atPlace] |
| 95 | |
| 96 | /-- For a scalar `c` of valuation `1` at the places of `T`, the part `idem T • y` of `y` at `T` |
| 97 | lies in a lattice if and only if its product with `c` does. -/ |
| 98 | lemma smul_idem_smul_mem_lattice {c : 𝔸f E} (hc : ∀ w ∈ T, v (c w) = 1) : |
| 99 | c • idem T • y ∈ V.lattice x ↔ idem T • y ∈ V.lattice x := by |
| 100 | rw [smul_comm] |
| 101 | simp +contextual only [idem_smul_mem_lattice, mulVec_smul, Pi.smul_apply, smul_eq_mul, |
| 102 | FiniteAdeleRing.mul_apply, map_mul, hc, one_mul] |
| 103 | |
| 104 | /-- A vector lies in a lattice if and only if its parts at the places of `T` and off `T` do. -/ |
| 105 | lemma mem_lattice_iff_idem_smul (T : Set (FinPlace E)) : |
| 106 | y ∈ V.lattice x ↔ idem T • y ∈ V.lattice x ∧ idem Tᶜ • y ∈ V.lattice x := by |
| 107 | rw [idem_smul_mem_lattice, idem_smul_mem_lattice, mem_lattice] |
| 108 | -- Being integral means being integral at every place, and each place lies in `T` or in `Tᶜ`. |
| 109 | grind [mem_Ô] |
| 110 | |
| 111 | end Space |
| 112 | |
| 113 | namespace Grading |
| 114 | variable {Y : Grading V N X s} |
| 115 | |
| 116 | variable (Y) in |
| 117 | /-- For `x` satisfying `Y.HasLatticeBounds q.val k x` with `q` invertible, intersecting |
| 118 | the preimage of `(Y.latticeMinus x).map U.mkQ` under `U.mkQ` with `Y.stringProj.range` |
| 119 | recovers `Y.latticeMinus x` by the modular law. -/ |
| 120 | private lemma latticeMinus_recover_of_hasLatticeBounds |
| 121 | (q : (𝔸f E)ˣ) (k : ℕ) |
| 122 | (U : Submodule (Ô E) (ι → 𝔸f E)) |
| 123 | (h_inter : U ⊓ (Y.stringProj.range.restrictScalars (Ô E)) ≤ |
| 124 | star q.val ^ k • Y.latticeMinus 1) |
| 125 | {x : Gf E ι} (hx : Y.HasLatticeBounds q.val k x) : |
| 126 | ((Y.latticeMinus x).map U.mkQ).comap U.mkQ ⊓ |
| 127 | (Y.stringProj.range.restrictScalars (Ô E)) = Y.latticeMinus x := by |
| 128 | have h_le : Y.latticeMinus x ≤ Y.stringProj.range.restrictScalars (Ô E) := inf_le_right |
| 129 | rw [Submodule.comap_map_mkQ, sup_comm, sup_inf_assoc_of_le U h_le, |
| 130 | sup_eq_left.2 (h_inter.trans hx.lower)] |
| 131 | |
| 132 | variable (Y) in |
| 133 | /-- For an invertible finite adele `q`, the points `x` of the finite adelic unitary group with the |
| 134 | bounds `q̄ ^ k Λ⁻ ⊆ Λ'⁻`, `q ^ k Λ'⁻ ⊆ Λ⁻` give only finitely many intersections `Λ'⁻` of their |
| 135 | lattice with `X^⊥`. Here `Λ⁻` is the intersection for `x = 1`. -/ |
| 136 | lemma finite_image_latticeMinus (q : (𝔸f E)ˣ) (k : ℕ) : |
| 137 | (Y.latticeMinus '' {x : Gf E ι | Y.HasLatticeBounds q.val k x}).Finite := by |
| 138 | -- Such a lattice lies in the compact set `C` and is determined by its image modulo the open |
| 139 | -- subgroup `U`; the image of `C` modulo `U` is finite. |
| 140 | let U : Submodule (Ô E) (ι → 𝔸f E) := star q.val ^ k • V.lattice 1 |
| 141 | let C : Set (ι → 𝔸f E) := (q ^ k)⁻¹ • (V.lattice 1 : Set (ι → 𝔸f E)) |
| 142 | have : DiscreteTopology ((ι → 𝔸f E) ⧸ U) := QuotientAddGroup.discreteTopology |
| 143 | (N := U.toAddSubgroup) ((q.isUnit.star.pow k).isOpenMap_smul _ (V.isOpen_lattice 1)) |
| 144 | have h_finite : (U.mkQ '' C).Finite := |
| 145 | (((V.isCompact_lattice 1).smul _).image U.continuous_mkQ).finite_of_discrete |
| 146 | let P : Submodule (Ô E) (ι → 𝔸f E) := Y.stringProj.range.restrictScalars (Ô E) |
| 147 | have h_inter : U ⊓ P ≤ star q.val ^ k • Y.latticeMinus 1 := by |
| 148 | rintro _ ⟨⟨u, hu, rfl⟩, z, hz : Y.stringProj z = star q.val ^ k • u⟩ |
| 149 | exact Submodule.smul_mem_pointwise_smul u _ _ (mem_latticeMinus.2 ⟨hu, |
| 150 | (q.isUnit.star.pow k).smul_left_cancel.1 <| by rw [← map_smul, ← hz, stringProj_stringProj]⟩) |
| 151 | have h_recover {x : Gf E ι} (hx : Y.HasLatticeBounds q.val k x) : |
| 152 | ((Y.latticeMinus x).map U.mkQ).comap U.mkQ ⊓ P = Y.latticeMinus x := |
| 153 | Y.latticeMinus_recover_of_hasLatticeBounds q k U h_inter hx |
| 154 | refine Set.Finite.of_injOn (f := fun L : Submodule (Ô E) (ι → 𝔸f E) ↦ U.mkQ '' L) ?_ ?_ |
| 155 | h_finite.finite_subsets |
| 156 | · rintro _ ⟨x, hx : Y.HasLatticeBounds q.val k x, rfl⟩ |
| 157 | exact Set.image_mono fun y hy ↦ Set.mem_inv_smul_set_iff.2 |
| 158 | (latticeMinus_le_lattice (smul_le_iff_forall.1 hx.upper y hy)) |
| 159 | · rintro _ ⟨x, hx, rfl⟩ _ ⟨x', hx', rfl⟩ h_image |
| 160 | have h_map : (Y.latticeMinus x).map U.mkQ = (Y.latticeMinus x').map U.mkQ := |
| 161 | SetLike.coe_injective h_image |
| 162 | rw [← h_recover hx, h_map, h_recover hx'] |
| 163 | |
| 164 | /-- Let `Y` present the hermitian space `V` as a part `X` plus a string of `s` vectors, which spans |
| 165 | `X^⊥`. For a point `g` of the finite adelic unitary group `Gf E ι`, `Y.latticeMinus g` is the |
| 166 | intersection with `X^⊥` of the lattice `V.lattice g`, the adelic vectors with integral coordinates |
| 167 | in the frame `V.xFin * g`. Write `Λ'⁻ = Y.latticeMinus x` and `Λ⁻ = Y.latticeMinus 1`, and assume |
| 168 | the bounds `q̄ ^ k Λ⁻ ⊆ Λ'⁻` and `q ^ k Λ'⁻ ⊆ Λ⁻` for a finite adele `q`. Let `Q` be a set of finite |
| 169 | places outside which `q` is a local unit (its multiplicative valuation `v` is `1`). Let |
| 170 | `x' = Gf.componentOn ι Q x` be the point with the components of `x` at the places of `Q` and their |
| 171 | conjugates, and with component `1` at the other places. Then `Y.latticeMinus x' = Λ'⁻`. -/ |
| 172 | lemma HasLatticeBounds.latticeMinus_componentOn {V : Space E ι ε} {Y : Grading V N X s} |
| 173 | {q : 𝔸f E} {k : ℕ} {x : Gf E ι} (h_bounds : Y.HasLatticeBounds q k x) {Q : Set (FinPlace E)} |
| 174 | (hq : ∀ w : FinPlace E, w ∉ Q → v (q w) = 1) : |
| 175 | Y.latticeMinus (Gf.componentOn ι Q x) = Y.latticeMinus x := by |
| 176 | -- Split `y ∈ X^⊥` into its parts at `T = Q ∪ Q̄` and off `T`. Off `T` both `q` and its conjugate |
| 177 | -- have valuation `1`, so the bounds say that `Λ'⁻` and `Λ⁻` agree there. |
| 178 | ext y |
| 179 | rw [mem_latticeMinus, mem_latticeMinus] |
| 180 | refine and_congr_left fun hy ↦ ?_ |
| 181 | let T := Q.conjClosure |
| 182 | have h_on : idem T • y ∈ V.lattice (Gf.componentOn ι Q x) ↔ idem T • y ∈ V.lattice x := |
| 183 | V.idem_smul_mem_lattice_congr fun w hw ↦ by rw [Gf.atPlace_componentOn, ite_eq_left hw] |
| 184 | have h_off : idem Tᶜ • y ∈ V.lattice (Gf.componentOn ι Q x) ↔ idem Tᶜ • y ∈ V.lattice 1 := |
| 185 | V.idem_smul_mem_lattice_congr fun w hw ↦ by |
| 186 | rw [Gf.atPlace_componentOn, ite_eq_right hw, map_one] |
| 187 | have h_incl {c : 𝔸f E} {g g' : Gf E ι} (hc : ∀ w ∈ Tᶜ, v (c w) = 1) |
| 188 | (h_le : c • Y.latticeMinus g ≤ Y.latticeMinus g') (hg : idem Tᶜ • y ∈ V.lattice g) : |
| 189 | idem Tᶜ • y ∈ V.lattice g' := |
| 190 | (V.smul_idem_smul_mem_lattice hc).1 <| latticeMinus_le_lattice <| |
| 191 | smul_le_iff_forall.1 h_le _ (mem_latticeMinus.2 ⟨hg, by rw [map_smul, hy]⟩) |
| 192 | have h_agree : idem Tᶜ • y ∈ V.lattice 1 ↔ idem Tᶜ • y ∈ V.lattice x := |
| 193 | ⟨h_incl (by simp +contextual [T, finAdele_pow_apply, hq]) h_bounds.lower, |
| 194 | h_incl (by simp +contextual [T, finAdele_pow_apply, hq]) h_bounds.upper⟩ |
| 195 | rw [V.mem_lattice_iff_idem_smul T, V.mem_lattice_iff_idem_smul (x := x) T, h_on, h_off, h_agree] |
| 196 | |
| 197 | variable (Y) in |
| 198 | /-- Let `q` be an invertible finite adele of valuation `1` at the places outside `Q`, let `R` be the |
| 199 | finite Bessel subgroup `Y.besselFin` (it contains the image `Y.inclXFin a` of each point `a` of the |
| 200 | unitary group of `X`) and `J°` the stabiliser `stdLevel E ι` of the standard lattice. Assume that |
| 201 | `E` contains a primitive root of unity of order 5040. Then there is a finite set `T` of points |
| 202 | supported on `Q` and its conjugate such that `R x J°` meets `T` whenever the `R`-orbit of `x` is |
| 203 | bounded (`HasBoundedOrbit`: some point of it has a graded lattice whose intersection with `X^⊥` |
| 204 | satisfies the bounds given by `q` and `k`; graded means that it contains the part in each grade of |
| 205 | each of its vectors). -/ |
| 206 | lemma exists_finite_representatives [Fintype X] [HasPrimitiveRoot5040 E] (q : (𝔸f E)ˣ) (k : ℕ) |
| 207 | {Q : Set (FinPlace E)} (hq : ∀ w : FinPlace E, w ∉ Q → v (q.val w) = 1) : |
| 208 | ∃ T : Set (Gf E ι), T.Finite ∧ T ⊆ Gf.supportedOn ι Q ∧ |
| 209 | ∀ x : Gf E ι, Y.HasBoundedOrbit q.val k x → |
| 210 | ∃ r ∈ Y.besselFin, r * x ∈ T * (stdLevel E ι : Set (Gf E ι)) := by |
| 211 | -- Take one point for each `Λ'⁻` and keep its components at `Q ∪ Q̄`. Lattices with the same |
| 212 | -- `Λ'⁻` are translates of each other by the unitary group of `X`, which lies in `R`. |
| 213 | let B : Set (Gf E ι) := {x : Gf E ι | Y.HasLatticeBounds q.val k x} |
| 214 | obtain ⟨T, hT_bounds, hT_finite, hT_image⟩ : |
| 215 | ∃ T ⊆ B, T.Finite ∧ Y.latticeMinus '' B ⊆ Y.latticeMinus '' T := |
| 216 | Set.exists_subset_image_finite_and.1 |
| 217 | ⟨Y.latticeMinus '' B, subset_rfl, Y.finite_image_latticeMinus q k, subset_rfl⟩ |
| 218 | refine ⟨Gf.componentOn ι Q '' T, hT_finite.image _, |
| 219 | Set.image_subset_iff.2 fun _ _ ↦ Gf.componentOn_mem_supportedOn, ?_⟩ |
| 220 | rintro x ⟨r, hr, -, h_bounds⟩ |
| 221 | obtain ⟨t, ht, h_eq⟩ : ∃ t ∈ T, Y.latticeMinus t = Y.latticeMinus (r * x) := |
| 222 | hT_image ⟨r * x, h_bounds, rfl⟩ |
| 223 | obtain ⟨a, ha⟩ : ∃ a : Gf E X, |
| 224 | V.lattice (Y.inclXFin a * (r * x)) = V.lattice (Gf.componentOn ι Q t) := |
| 225 | exists_lattice_inclXFin_mul_eq |
| 226 | (h_eq.symm.trans ((hT_bounds ht).latticeMinus_componentOn hq).symm) |
| 227 | refine ⟨Y.inclXFin a * r, |
| 228 | mul_mem (Y.snd_mem_besselFin (Y.inclX_mem_besselGroup (1, a))) hr, ?_⟩ |
| 229 | rw [mul_assoc, ← mul_inv_cancel_left (Gf.componentOn ι Q t) (Y.inclXFin a * (r * x))] |
| 230 | exact Set.mul_mem_mul ⟨t, ht, rfl⟩ (Space.lattice_eq_iff.1 ha.symm) |
| 231 | |
| 232 | end Grading |
| 233 | |
| 234 | end New |
| 235 | |
| 236 | end |