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.Analysis.SpecialFunctions.Gaussian.FourierTransform |
| 4 | import Mathlib.MeasureTheory.Integral.Pi |
| 5 | import Mathlib.RingTheory.PiTensorProduct |
| 6 | import Mathlib.RingTheory.SimpleRing.Principal |
| 7 | public import Lib.Speed |
| 8 | import Lib.Adelic.Hecke.Basic |
| 9 | |
| 10 | /-! |
| 11 | # Uniqueness of Haar measure, integrals over subgroups and Gaussian normalisation of volumes |
| 12 | |
| 13 | The file treats three topics of measure theory. Two additive Haar measures on a locally compact, |
| 14 | second countable group agree if some real function has integral 1 for both. Integrals over compact |
| 15 | or open subgroups are computed by translation invariance, orthogonality of characters and reduction |
| 16 | to finite sums. A normalisation of volumes by Gaussian integrals is defined. It holds for `ℝ` and |
| 17 | `ℂ` and passes to binary products and finite powers under σ-finiteness assumptions. |
| 18 | |
| 19 | ## Main definitions and results |
| 20 | |
| 21 | * `New.addHaar_eq_of_integral_eq_one`: uniqueness of additive Haar measure, with the constant fixed |
| 22 | by the integral of one test function. |
| 23 | * `New.setIntegral_char`: orthogonality for a multiplicative function over an open subgroup. |
| 24 | * `New.setIntegral_eq_finsum`: over a compact `M`, a function constant on the cosets of an open |
| 25 | subgroup `L` integrates to `ν (L ∩ M)` times a finite sum over `M ⧸ (L ∩ M)`. |
| 26 | * `New.HasGaussianIntegral`: the Gaussian normalisation of a volume. |
| 27 | * `New.HasGaussianIntegral.pi`: the normalisation on a finite power. |
| 28 | -/ |
| 29 | |
| 30 | @[expose] public section |
| 31 | |
| 32 | /-! ## Uniqueness of Haar measure -/ |
| 33 | |
| 34 | section HaarUnique |
| 35 | |
| 36 | open MeasureTheory |
| 37 | |
| 38 | /-- Let `μ` and `ν` be additive Haar measures on a locally compact, second countable group. If some |
| 39 | real function has integral 1 for both, then `μ = ν`. -/ |
| 40 | lemma New.addHaar_eq_of_integral_eq_one {G : Type*} [AddGroup G] [TopologicalSpace G] |
| 41 | [IsTopologicalAddGroup G] [LocallyCompactSpace G] [SecondCountableTopology G] |
| 42 | [MeasurableSpace G] [BorelSpace G] {μ ν : Measure G} [μ.IsAddHaarMeasure] [ν.IsAddHaarMeasure] |
| 43 | {f : G → ℝ} (hν : ∫ x : G, f x ∂ν = 1) (hμ : ∫ x : G, f x ∂μ = 1) : |
| 44 | μ = ν := by |
| 45 | -- By uniqueness `μ = c • ν` for a constant `c`, and the two integrals give `c = 1`. |
| 46 | obtain ⟨c, rfl⟩ : ∃ c : NNReal, μ = c • ν := ⟨_, μ.isAddLeftInvariant_eq_smul ν⟩ |
| 47 | obtain rfl : c = 1 := by simpa [integral_smul_nnreal_measure, hν, NNReal.smul_def] using hμ |
| 48 | exact one_smul _ ν |
| 49 | |
| 50 | end HaarUnique |
| 51 | |
| 52 | /-! |
| 53 | ## Integrals over subgroups |
| 54 | |
| 55 | Integrals over a subgroup `M` of a topological abelian group `V`, for a translation-invariant Borel |
| 56 | measure `ν`. |
| 57 | -/ |
| 58 | |
| 59 | section SubgroupIntegral |
| 60 | |
| 61 | open MeasureTheory AddSubgroup Set |
| 62 | |
| 63 | namespace New |
| 64 | |
| 65 | variable {V X : Type*} [AddCommGroup V] [MeasurableSpace V] {ν : Measure V} [ν.IsAddLeftInvariant] |
| 66 | {M L : AddSubgroup V} [NormedAddCommGroup X] [NormedSpace ℝ X] |
| 67 | [TopologicalSpace V] [IsTopologicalAddGroup V] [BorelSpace V] |
| 68 | |
| 69 | /-- For a left-invariant measure `ν` and a subgroup `M`, the integral over `M` is unchanged by |
| 70 | translating the integrand by an element of `M`. -/ |
| 71 | lemma setIntegral_add_left_eq_self_of_mem (F : V → X) {m : V} (hm : m ∈ M) : |
| 72 | ∫ x : V in M, F (m + x) ∂ν = ∫ x : V in M, F x ∂ν := by |
| 73 | -- Change variables by the translation `x ↦ m + x`, which preserves `ν` and maps `M` onto `M`. |
| 74 | have h_preimage : (m + ·) ⁻¹' (M : Set V) = M := Set.ext fun x ↦ M.add_mem_cancel_left hm |
| 75 | simpa [h_preimage] using (measurePreserving_add_left ν m).setIntegral_preimage_emb |
| 76 | (measurableEmbedding_addLeft m) F M |
| 77 | |
| 78 | open scoped Classical in |
| 79 | /-- Orthogonality: let `ν` be a left-invariant measure on `V` and `χ : V → ℂ` satisfy |
| 80 | `χ (x + y) = χ x * χ y`. The integral of `χ` over an open subgroup `M` is the measure of `M` (read |
| 81 | as `0` if infinite) when `χ = 1` on `M`, and `0` otherwise. -/ |
| 82 | lemma setIntegral_char (hM : IsOpen (M : Set V)) {χ : V → ℂ} |
| 83 | (h_add : ∀ x y : V, χ (x + y) = χ x * χ y) : |
| 84 | ∫ x : V in M, χ x ∂ν = if ∀ x ∈ M, χ x = 1 then (ν.real M : ℂ) else 0 := by |
| 85 | split_ifs with h_triv |
| 86 | · simp [setIntegral_congr_fun hM.measurableSet h_triv, Set.univ_inter] |
| 87 | · -- Translating by `m ∈ M` multiplies the integral by `χ m` and leaves it unchanged, |
| 88 | -- and some `χ m` is not `1`. |
| 89 | obtain ⟨m, hm, hm_ne⟩ : ∃ m ∈ M, χ m ≠ 1 := by simpa using h_triv |
| 90 | have h_mul : χ m * ∫ x : V in M, χ x ∂ν = ∫ x : V in M, χ x ∂ν := by |
| 91 | simp only [← integral_const_mul, ← h_add, setIntegral_add_left_eq_self_of_mem χ hm] |
| 92 | exact eq_zero_of_mul_eq_self_left hm_ne h_mul |
| 93 | |
| 94 | /-- Let `M` be a compact and `L` an open subgroup of `V`, and `ν` a left-invariant measure that is |
| 95 | finite on compact sets. If `F` is constant on the cosets of `L ∩ M` in `M`, its integral over `M` is |
| 96 | `ν (L ∩ M)` times the sum of its values on these cosets; `q.out` is a chosen representative of the |
| 97 | coset `q`. -/ |
| 98 | lemma setIntegral_eq_finsum [IsFiniteMeasureOnCompacts ν] [CompleteSpace X] [T2Space V] |
| 99 | (hM : IsCompact (M : Set V)) (hL : IsOpen (L : Set V)) {F : V → X} |
| 100 | (hF : ∀ x y : M, -(x : V) + y ∈ L → F y = F x) : |
| 101 | ∫ x : V in M, F x ∂ν = ν.real (L ∩ M) • ∑ᶠ q : M ⧸ L.addSubgroupOf M, F q.out := by |
| 102 | classical |
| 103 | -- `M` is compact and `L` is open, so there are finitely many cosets. |
| 104 | let : Fintype (M ⧸ L.addSubgroupOf M) := fintypeOfIndexNeZero (hM.relIndex_ne_zero_add hL) |
| 105 | -- On `M`, `F` is the sum over the cosets `q` of the constant `F q.out` on `q.out + L`. |
| 106 | let G (q : M ⧸ L.addSubgroupOf M) (x : V) : X := indicator L (fun _ ↦ F q.out) (-q.out + x) |
| 107 | have h_sum : EqOn F (fun x : V ↦ ∑ q : M ⧸ L.addSubgroupOf M, G q x) M := by |
| 108 | intro x hx |
| 109 | let q₀ : M ⧸ L.addSubgroupOf M := QuotientAddGroup.mk ⟨x, hx⟩ |
| 110 | have h_coset (q : M ⧸ L.addSubgroupOf M) : -(q.out : V) + x ∈ L ↔ q = q₀ := by |
| 111 | rw [← q.out_eq', QuotientAddGroup.eq] |
| 112 | simp [mem_addSubgroupOf] |
| 113 | simp [G, indicator, h_coset, hF q₀.out ⟨x, hx⟩ ((h_coset q₀).2 rfl)] |
| 114 | have h_int (q : M ⧸ L.addSubgroupOf M) : IntegrableOn (G q) M ν := |
| 115 | (integrableOn_const hM.measure_ne_top).indicator (measurable_const_add _ hL.measurableSet) |
| 116 | -- Translating by `-q.out ∈ M` moves the coset to `L` and keeps the integral over `M`. |
| 117 | have h_integral (q : M ⧸ L.addSubgroupOf M) : |
| 118 | ∫ x : V in M, G q x ∂ν = ν.real (L ∩ M) • F q.out := by |
| 119 | rw [setIntegral_add_left_eq_self_of_mem (indicator L fun _ ↦ F q.out) |
| 120 | (M.neg_mem (SetLike.coe_mem q.out))] |
| 121 | simp [hL.measurableSet] |
| 122 | rw [setIntegral_congr_fun hM.measurableSet h_sum, integral_finsetSum _ fun q _ ↦ h_int q] |
| 123 | simp [h_integral, finsum_eq_sum_of_fintype, Finset.smul_sum] |
| 124 | |
| 125 | end New |
| 126 | |
| 127 | end SubgroupIntegral |
| 128 | |
| 129 | /-! |
| 130 | ## Volumes normalised by a Gaussian integral |
| 131 | |
| 132 | A way to fix the normalisation of a volume without choosing a basis. For σ-finite volumes it passes |
| 133 | to binary products and finite powers, with the sum of the functions and the sum of the exponents. |
| 134 | -/ |
| 135 | |
| 136 | namespace New |
| 137 | |
| 138 | open MeasureTheory Real GaussianFourier Finset Fintype |
| 139 | |
| 140 | variable {V : Type} {W : Type} [MeasureSpace V] [MeasureSpace W] |
| 141 | {q : V → ℝ} {q' : W → ℝ} {a b : ℝ} {ι : Type} [Fintype ι] |
| 142 | [SigmaFinite (volume : Measure V)] [SFinite (volume : Measure W)] |
| 143 | |
| 144 | /-- Gaussian normalisation of the volume on `V` for the real function `q` with exponent `a`: for |
| 145 | every `t > 0`, the integral of `exp (-t * q x)` over `V` equals `(π / t) ^ a`. -/ |
| 146 | class HasGaussianIntegral (a : outParam ℝ) (q : outParam (V → ℝ)) : Prop where |
| 147 | /-- For `t > 0`, the integral of `exp (-t * q x)` over `V` is `(π / t) ^ a`. -/ |
| 148 | integral_exp_eq {t : ℝ} : 0 < t → ∫ x : V, exp (-t * q x) = (π / t) ^ a |
| 149 | |
| 150 | /-- The Gaussian integral on `ℝ`: the integral of `exp (-t x²)` is `(π / t) ^ (1 / 2)`. -/ |
| 151 | instance : HasGaussianIntegral (1 / 2) fun x : ℝ ↦ x ^ 2 where |
| 152 | integral_exp_eq {t} _ := by rw [integral_gaussian t, sqrt_eq_rpow] |
| 153 | |
| 154 | /-- The Gaussian integral on `ℂ`: the integral of `exp (-t ‖z‖²)` is `π / t`. -/ |
| 155 | instance : HasGaussianIntegral 1 fun z : ℂ ↦ ‖z‖ ^ 2 where |
| 156 | integral_exp_eq ht := by simpa using integral_rexp_neg_mul_sq_norm (V := ℂ) ht |
| 157 | |
| 158 | /-- If the volumes on `V` (σ-finite) and `W` (s-finite) satisfy `∫ exp (-t q) = (π / t) ^ a` and |
| 159 | `∫ exp (-t q') = (π / t) ^ b` for all `t > 0`, then the volume on `V × W` satisfies the same with |
| 160 | exponent `a + b` for the sum of `q` and `q'`. -/ |
| 161 | instance [h : HasGaussianIntegral a q] [h' : HasGaussianIntegral b q'] : |
| 162 | HasGaussianIntegral (a + b) fun x : V × W ↦ q x.1 + q' x.2 where |
| 163 | integral_exp_eq {t} ht := |
| 164 | -- Fubini applies, since the Gaussian of the sum is a product. |
| 165 | calc ∫ x : V × W, exp (-t * (q x.1 + q' x.2)) |
| 166 | _ = (∫ v : V, exp (-t * q v)) * ∫ w : W, exp (-t * q' w) := by |
| 167 | simp only [mul_add, exp_add, Measure.volume_eq_prod, ← integral_prod_mul] |
| 168 | _ = (π / t) ^ (a + b) := by |
| 169 | rw [h.integral_exp_eq ht, h'.integral_exp_eq ht, rpow_add (by positivity)] |
| 170 | |
| 171 | /-- If the volume on `V` is σ-finite and satisfies `∫ exp (-t q) = (π / t) ^ a` for all `t > 0`, |
| 172 | then the volume on `ι → V` satisfies the same with exponent `a * card ι` for `x ↦ ∑ i, q (x i)`. -/ |
| 173 | instance HasGaussianIntegral.pi [h : HasGaussianIntegral a q] : |
| 174 | HasGaussianIntegral (a * Fintype.card ι) fun x : ι → V ↦ ∑ i : ι, q (x i) where |
| 175 | integral_exp_eq {t} ht := |
| 176 | calc ∫ x : ι → V, exp (-t * ∑ i : ι, q (x i)) |
| 177 | _ = ∫ x : ι → V, ∏ i : ι, exp (-t * q (x i)) := by simp only [mul_sum, exp_sum] |
| 178 | _ = ((π / t) ^ a) ^ Fintype.card ι := by |
| 179 | rw [integral_fintype_prod_volume_eq_pow fun v : V ↦ exp (-t * q v), h.integral_exp_eq ht] |
| 180 | _ = (π / t) ^ (a * Fintype.card ι) := by rw [rpow_mul (by positivity), rpow_natCast] |
| 181 | |
| 182 | end New |