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.Adelic.Reduction.DefiniteClassSums |
| 4 | import Lib.Adelic.Adeles.SemilocalProducts |
| 5 | import New.Spanning.RemainingTerms.Box |
| 6 | |
| 7 | /-! |
| 8 | # Explicit bound for the number of classes in the genus |
| 9 | |
| 10 | This file gives a crude explicit bound `New.Space.card_stdClasses_le` for the number of classes |
| 11 | `New.StdClasses (New.stdLevel E n)` in the genus of the standard lattice. A class is determined |
| 12 | by the Gram matrix `G` of a short basis of its lattice and a rational approximation `X` of the |
| 13 | change of basis. Both `G` and `G X` have integral entries of bounded size, and such matrices are |
| 14 | counted. |
| 15 | |
| 16 | ## Main definitions and results |
| 17 | |
| 18 | * `New.Space.card_stdClasses_le`: an explicit bound for the number of classes |
| 19 | `New.StdClasses (New.stdLevel E n)`, for a CM field `E` with `f` infinite places and a natural |
| 20 | number `N ≠ 0` in the different of `E`. |
| 21 | * `New.Space.stdClasses_eq_of_gram_eq`: two classes `g`, `g'` in `Γ \ G_f / K₀` are equal if |
| 22 | there are `Y`, `Y'` in `GL n E` with the same Gram matrix such that `A' A⁻¹` has entries in |
| 23 | `Ô E`, where `A = g.out⁻¹ Y` and `A' = g'.out⁻¹ Y'`. |
| 24 | |
| 25 | Notions from other files: |
| 26 | * `New.StdClasses K`: the double cosets `Γ \ G_f / K` of the finite adelic unitary group `G_f` of |
| 27 | the form `∑ x_i \bar x_i` by its rational points `Γ` and a subgroup `K`. |
| 28 | * `New.stdLevel`: the subgroup `K₀ = G_f ∩ GL_n(Ô)`, the stabiliser of the standard lattice `Ô^n`. |
| 29 | |
| 30 | ## Relation to the literature |
| 31 | |
| 32 | See `New.UpperBound.Size.Estimates` for related work. |
| 33 | -/ |
| 34 | |
| 35 | @[expose] public section |
| 36 | |
| 37 | noncomputable section |
| 38 | |
| 39 | section ClassCountBound |
| 40 | |
| 41 | open NumberField Matrix Fintype DoubleCoset Units |
| 42 | |
| 43 | /-- If `M` is an `m × n` matrix and `M'` is an `n × l` matrix over a semiring `E` whose entries |
| 44 | have norms at most `a` and `b` under a ring homomorphism `φ : E →+* K` into a seminormed ring |
| 45 | with multiplicative norm, then each entry of `M * M'` has norm at most `#n · a b`. -/ |
| 46 | lemma New.Space.norm_map_mul_apply_le {E K m n l : Type*} [Semiring E] [SeminormedRing K] |
| 47 | [NormMulClass K] [Fintype n] (φ : E →+* K) {M : Matrix m n E} {M' : Matrix n l E} {a b : ℝ} |
| 48 | (hM : ∀ i k, ‖φ (M i k)‖ ≤ a) (hM' : ∀ k j, ‖φ (M' k j)‖ ≤ b) (i : m) (j : l) : |
| 49 | ‖φ ((M * M') i j)‖ ≤ card n * (a * b) := calc |
| 50 | ‖φ ((M * M') i j)‖ ≤ ∑ k, ‖φ (M i k)‖ * ‖φ (M' k j)‖ := by |
| 51 | simpa [Matrix.mul_apply] using norm_sum_le _ fun k ↦ φ (M i k) * φ (M' k j) |
| 52 | _ ≤ ∑ _k : n, a * b := Finset.sum_le_sum fun k _ ↦ |
| 53 | mul_le_mul (hM i k) (hM' k j) (norm_nonneg _) ((norm_nonneg _).trans (hM i k)) |
| 54 | _ = card n * (a * b) := by simp |
| 55 | |
| 56 | /-- Let `c = shortBasisConst E n N = 6 N (f #n)²`, with `f` the number of infinite places of `E`. |
| 57 | If at the infinite place `w` (with embedding `Φ w`) the entries of `Y` have size at most `c` and |
| 58 | those of `X` at most `(2 f)² N`, then the entries of `Yᴴ Y` and `Yᴴ Y X` have size at most `c³`. -/ |
| 59 | lemma New.Space.norm_gram_apply_le_cube {E n : Type} [Field E] [CMType E] [Fintype n] {N : ℕ} |
| 60 | [NeZero N] {Y X : Matrix n n E} {w : InfinitePlace E} |
| 61 | (hY : ∀ i j : n, ‖Φ w (Y i j)‖ ≤ shortBasisConst E n N) |
| 62 | (hX : ∀ i j : n, ‖Φ w (X i j)‖ ≤ (2 * Core.numInfPlaces E) ^ 2 * N) (i j : n) : |
| 63 | ‖Φ w ((Yᴴ * Y) i j)‖ ≤ shortBasisConst E n N ^ 3 ∧ |
| 64 | ‖Φ w ((Yᴴ * Y * X) i j)‖ ≤ shortBasisConst E n N ^ 3 := by |
| 65 | set c : ℕ := shortBasisConst E n N with hc |
| 66 | have h_gram (i j : n) : ‖Φ w ((Yᴴ * Y) i j)‖ ≤ card n * (c * c) := |
| 67 | norm_map_mul_apply_le (Φ w) (fun i j ↦ by simpa using hY j i) hY i j |
| 68 | have h_card : card n ≤ c := calc |
| 69 | card n ≤ (Core.numInfPlaces E * card n) ^ 2 := |
| 70 | (Nat.le_mul_of_pos_left _ NeZero.one_le).trans (Nat.le_self_pow two_ne_zero _) |
| 71 | _ ≤ c := Nat.le_mul_of_pos_left _ (by simp [NeZero.pos]) |
| 72 | constructor |
| 73 | · calc ‖Φ w ((Yᴴ * Y) i j)‖ |
| 74 | _ ≤ c * (c * c) := (h_gram i j).trans (by gcongr) |
| 75 | _ = c ^ 3 := by ring |
| 76 | · calc ‖Φ w ((Yᴴ * Y * X) i j)‖ |
| 77 | _ ≤ card n * (card n * (c * c) * ((2 * Core.numInfPlaces E) ^ 2 * N)) := |
| 78 | norm_map_mul_apply_le (Φ w) h_gram hX i j |
| 79 | -- Here `card n ^ 2 * (2 f) ^ 2 * N = 4 N (f * card n) ^ 2`, which is at most `c`. |
| 80 | _ = (4 * N * (Core.numInfPlaces E * card n) ^ 2 : ℕ) * (c * c) := by |
| 81 | push_cast |
| 82 | ring |
| 83 | _ ≤ c * (c * c) := by |
| 84 | rw [hc, shortBasisConst] |
| 85 | gcongr |
| 86 | norm_num |
| 87 | _ = c ^ 3 := by ring |
| 88 | |
| 89 | /-- Let `g` be a finite adelic unitary matrix and `Y`, `Z` matrices over `E` such that `g Y` and |
| 90 | `g Z` have entries in the integral finite adeles `Ô E`. Then the entries of `Yᴴ Z` are algebraic |
| 91 | integers. -/ |
| 92 | lemma New.Space.isIntegral_conjTranspose_mul_apply {E n : Type} [Field E] [CMType E] [Fintype n] |
| 93 | [DecidableEq n] (g : Gf E n) {Y Z : Matrix n n E} |
| 94 | (hY : IsIntMatrix (Ô E) ((g : Matrix n n (𝔸f E)) * Y.map (algebraMap E (𝔸f E)))) |
| 95 | (hZ : IsIntMatrix (Ô E) ((g : Matrix n n (𝔸f E)) * Z.map (algebraMap E (𝔸f E)))) (i j : n) : |
| 96 | IsIntegral ℤ ((Yᴴ * Z) i j) := by |
| 97 | -- As `g` is unitary for the form `1`, we have `Yᴴ Z = (g Y)ᴴ (g Z)`. |
| 98 | have h_int : IsIntMatrix (Ô E) ((Y.map (algebraMap E (𝔸f E)))ᴴ * (1 : Matrix n n (𝔸f E)) * |
| 99 | Z.map (algebraMap E (𝔸f E))) := by |
| 100 | rw [← U.gram_invariant g] |
| 101 | exact (hY.conjTranspose.mul .one).mul hZ |
| 102 | rw [← algebraMap_mem_Ô] |
| 103 | simpa [Matrix.mul_apply] using h_int i j |
| 104 | |
| 105 | /-- Let `g`, `g'` be double cosets in `StdClasses K₀ = Γ \ G_f / K₀`, with representatives `g.out`, |
| 106 | `g'.out`, and let `Y`, `Y'` in `GL n E` have the same Gram matrix. Put `A = g.out⁻¹ Y` and |
| 107 | `A' = g'.out⁻¹ Y'`. If `A' A⁻¹` has entries in `Ô`, then `g' = g`. -/ |
| 108 | lemma New.Space.stdClasses_eq_of_gram_eq {E n : Type} [Field E] [CMType E] [Fintype n] |
| 109 | [DecidableEq n] {g g' : StdClasses (stdLevel E n)} {Y Y' : GL n E} {A A' : GL n (𝔸f E)} |
| 110 | (hA : A = (g.out⁻¹ : Gf E n) * Y.map (algebraMap E (𝔸f E))) |
| 111 | (hA' : A' = (g'.out⁻¹ : Gf E n) * Y'.map (algebraMap E (𝔸f E))) |
| 112 | (h_gram : (Y' : Matrix n n E)ᴴ * Y' = (Y : Matrix n n E)ᴴ * Y) |
| 113 | (h_int : IsIntMatrix (Ô E) (A' * A⁻¹).val) : g' = g := by |
| 114 | -- `γ = Y Y'⁻¹` is a rational isometry, since the Gram matrices agree. |
| 115 | have h_isom : Y * Y'⁻¹ ∈ U (stdSpace E n).J := |
| 116 | mem_unitaryGroupOf_iff.2 <| gram_mul_of_gram_eq rfl |
| 117 | (gram_inv_of_gram_eq (by simpa using h_gram)) |
| 118 | let γ : Gf E n := (stdSpace E n).embFin ⟨Y * Y'⁻¹, h_isom⟩ |
| 119 | have hγ_mem : γ ∈ (stdSpace E n).Γf := ⟨_, rfl⟩ |
| 120 | -- We have `g.out = γ g'.out k` with `k = A' A⁻¹`. |
| 121 | let k : Gf E n := (γ * g'.out)⁻¹ * g.out |
| 122 | have hk_eq : (k : GL n (𝔸f E)) = A' * A⁻¹ := by simp [k, γ, hA, hA', mul_assoc] |
| 123 | have hk_mem : k ∈ stdLevel E n := by rwa [mem_stdLevel, hk_eq] |
| 124 | exact Quotient.out_equiv_out.1 (rel_iff.2 ⟨γ, hγ_mem, k, hk_mem, by simp [k, mul_assoc]⟩) |
| 125 | |
| 126 | /-- Let `E` be a CM field with `f` infinite places, `N ≠ 0` a natural number in the different of |
| 127 | `E`, and `r = #n`. Then the set `StdClasses K₀` of double cosets `Γ \ G_f / K₀` has at most |
| 128 | `(1 + 2 c³) ^ (4 f r²)` elements, where `c = shortBasisConst E n N = 6 N (f r)²`. -/ |
| 129 | lemma New.Space.card_stdClasses_le {E : Type} [Field E] [CMType E] {N : ℕ} [NeZero N] |
| 130 | (hN_different : (N : 𝓞 E) ∈ differentIdeal ℤ (𝓞 E)) {n : Type} [Fintype n] [DecidableEq n] : |
| 131 | Nat.card (StdClasses (stdLevel E n)) ≤ |
| 132 | (1 + 2 * shortBasisConst E n N ^ 3) ^ (4 * Core.numInfPlaces E * card n ^ 2) := by |
| 133 | -- To a class `g` attach a short basis `Y` of its lattice, the Gram matrix `G = Yᴴ Y` and a |
| 134 | -- bounded rational matrix `X ≡ (g⁻¹ Y)⁻¹` modulo `Ô`. The pair `(G, G X)` has integral entries |
| 135 | -- with conjugates of size at most `c ^ 3`, and it determines the class. |
| 136 | let ι : E →+* 𝔸f E := algebraMap E (𝔸f E) |
| 137 | have h_basis (g : StdClasses (stdLevel E n)) : ∃ Y : GL n E, |
| 138 | IsIntMatrix (Ô E) (((g.out⁻¹ : Gf E n) : Matrix n n (𝔸f E)) * Y.val.map ι) ∧ |
| 139 | ∀ (φ : E →+* ℂ) (i j : n), ‖φ (Y i j)‖ ≤ shortBasisConst E n N := |
| 140 | exists_short_basis_stdSpace hN_different g.out |
| 141 | choose Y hY_int hY_le using h_basis |
| 142 | have h_near (y : 𝔸f E) : ∃ a : E, y - ι a ∈ Ô E ∧ |
| 143 | ∀ w : InfinitePlace E, ‖Φ w a‖ ≤ (2 * Core.numInfPlaces E) ^ 2 * N := by |
| 144 | simpa using exists_principal_near_of_mem_differentIdeal NeZero.out hN_different 0 y |
| 145 | choose approx h_approx_int h_approx_le using h_near |
| 146 | let A (g : StdClasses (stdLevel E n)) : GL n (𝔸f E) := (g.out⁻¹ : Gf E n) * (Y g).map ι |
| 147 | let G (g : StdClasses (stdLevel E n)) : GL n E := star (Y g) * Y g |
| 148 | let X (g : StdClasses (stdLevel E n)) : Matrix n n E := (A g)⁻¹.val.map approx |
| 149 | -- Both `A g'` and `(A g)⁻¹ - X g` are integral. |
| 150 | have hA_diff_int (g g' : StdClasses (stdLevel E n)) : |
| 151 | IsIntMatrix (Ô E) ((A g' * (A g)⁻¹).val - (A g').val * (X g).map ι) := by |
| 152 | rw [val_mul, ← mul_sub] |
| 153 | exact (hY_int g').mul fun i j ↦ h_approx_int _ |
| 154 | have hAX (g : StdClasses (stdLevel E n)) : IsIntMatrix (Ô E) ((A g).val * (X g).map ι) := by |
| 155 | simpa using IsIntMatrix.one.sub (hA_diff_int g g) |
| 156 | have hYX (g : StdClasses (stdLevel E n)) : IsIntMatrix (Ô E) |
| 157 | (((g.out⁻¹ : Gf E n) : Matrix n n (𝔸f E)) * (Y g * X g).map ι) := by |
| 158 | simpa [Matrix.map_mul, ← mul_assoc, A] using hAX g |
| 159 | -- The invariant of the class `g`: the entries of `G` (for `false`) and of `G X` (for `true`). |
| 160 | let invariant (g : StdClasses (stdLevel E n)) : Bool × n × n → E := |
| 161 | fun (k, i, j) ↦ (bif k then G g * X g else G g : Matrix n n E) i j |
| 162 | have h_invariant_int (g : StdClasses (stdLevel E n)) (k : Bool) (i j : n) : |
| 163 | IsIntegral ℤ (invariant g (k, i, j)) := by |
| 164 | cases k |
| 165 | · exact isIntegral_conjTranspose_mul_apply _ (hY_int g) (hY_int g) i j |
| 166 | · simpa [invariant, G, mul_assoc, star_eq_conjTranspose] using |
| 167 | isIntegral_conjTranspose_mul_apply _ (hY_int g) (hYX g) i j |
| 168 | have h_invariant_le (g : StdClasses (stdLevel E n)) (k : Bool) (i j : n) (w : InfinitePlace E) : |
| 169 | ‖Φ w (invariant g (k, i, j))‖ ≤ shortBasisConst E n N ^ 3 := by |
| 170 | obtain ⟨hG_le, hGX_le⟩ : ‖Φ w (G g i j)‖ ≤ shortBasisConst E n N ^ 3 ∧ |
| 171 | ‖Φ w ((G g * X g) i j)‖ ≤ shortBasisConst E n N ^ 3 := |
| 172 | norm_gram_apply_le_cube (hY_le g (Φ w)) (fun i j ↦ h_approx_le _ w) i j |
| 173 | cases k |
| 174 | exacts [hG_le, hGX_le] |
| 175 | have h_invariant_inj : Function.Injective invariant := by |
| 176 | intro g' g h_eq |
| 177 | have hG : (G g').val = G g := Matrix.ext fun i j ↦ congrFun h_eq (false, i, j) |
| 178 | have hGX : G g' * X g' = G g * X g := Matrix.ext fun i j ↦ congrFun h_eq (true, i, j) |
| 179 | have hX : X g' = X g := (G g).mul_right_inj.1 (by rw [← hGX, hG]) |
| 180 | -- `A g' (A g)⁻¹` is the sum of the integral `A g' (A g)⁻¹ - A g' X g` and `A g' X g'`. |
| 181 | have h_int : IsIntMatrix (Ô E) (A g' * (A g)⁻¹).val := by |
| 182 | simpa only [hX, sub_add_cancel] using (hA_diff_int g g').add (hAX g') |
| 183 | exact stdClasses_eq_of_gram_eq rfl rfl hG h_int |
| 184 | -- Count the integral vectors with `2 (card n)²` entries whose conjugates are at most `c ^ 3`. |
| 185 | have h_card : (Set.univ : Set (StdClasses (stdLevel E n))).encard ≤ |
| 186 | ENNReal.ofReal ((1 + 2 * shortBasisConst E n N ^ 3) ^ |
| 187 | (card (Bool × n × n) * Core.numInfPlaces E * 2)) := |
| 188 | Filling.encard_le_of_isIntegral_norm_le invariant |
| 189 | (fun g _ ⟨k, i, j⟩ ↦ ⟨h_invariant_int g k i j, h_invariant_le g k i j⟩) |
| 190 | h_invariant_inj.injOn |
| 191 | rw [← Set.ncard_univ, show 4 * Core.numInfPlaces E * card n ^ 2 = |
| 192 | card (Bool × n × n) * Core.numInfPlaces E * 2 by simp [sq, mul_comm, mul_left_comm]] |
| 193 | exact ENat.toNat_le_of_le_natCast (mod_cast h_card) |
| 194 | |
| 195 | end ClassCountBound |
| 196 | |
| 197 | end |