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 Mathlib.Analysis.SpecialFunctions.Complex.Circle |
| 4 | public import Mathlib.RingTheory.PowerSeries.Basic |
| 5 | public import Mathlib.Analysis.CStarAlgebra.Classes |
| 6 | import TauCeti.Analysis.Analytic.TaylorSeries |
| 7 | import TauCeti.Analysis.Calculus.BumpFunction.FiniteDimension |
| 8 | import TauCeti.Analysis.Calculus.Deriv.Second |
| 9 | import Mathlib.Analysis.Complex.MeanValue |
| 10 | import Mathlib.Analysis.Complex.TaylorSeries |
| 11 | import Mathlib.Analysis.SpecialFunctions.RegularizedHypergeometric |
| 12 | import Mathlib.Order.CompletePartialOrder |
| 13 | import Mathlib.RingTheory.SimpleRing.Principal |
| 14 | public import Lib.Speed |
| 15 | import Lib.General.Measure.IdempotentKernel |
| 16 | public import TauCeti.MeasureTheory.Measure.Haar.UnitAddTorus |
| 17 | |
| 18 | /-! |
| 19 | # Circle means, Taylor series at zero, a power bound, and smooth matrix operations |
| 20 | |
| 21 | This file proves mean value facts for circle averages and a halving criterion for upper bounds. It |
| 22 | develops the algebra of Taylor series at 0 of analytic functions and proves an elementary bound of |
| 23 | x^l by a factorial and exponentials. It also gives smoothness rules for matrix operations and |
| 24 | extends analytic germs to globally smooth maps. |
| 25 | |
| 26 | The definition `New.taylorAtZero f` is the formal power series whose `n`-th coefficient is |
| 27 | `iteratedDeriv n f 0 / n !`, the Taylor series of `f : ℂ → ℂ` at 0. |
| 28 | |
| 29 | ## Main definitions and results |
| 30 | |
| 31 | * `New.taylorAtZero_mul`, `New.taylorAtZero_comp_mul`, `New.eq_of_taylorAtZero_eq`: Taylor series |
| 32 | at 0 of products and of `z ↦ f (a * z)`; such a series determines an entire function. |
| 33 | * `New.integral_eq_of_probability_mean`: an integral is unchanged when the integrand is |
| 34 | averaged over measure preserving maps with respect to a probability measure. |
| 35 | * `New.integral_comp_toCircle_eq_apply_zero`: the mean value property over the unit circle of a |
| 36 | function holomorphic on the closed unit disc, for the Haar probability measure of `ℝ / ℤ`. |
| 37 | * `New.le_of_halving`: let `c ≥ 0`. A function bounded above is at most `c` if each of its bounds |
| 38 | can be halved at the points where it exceeds `c`. |
| 39 | * `New.exists_contDiff_eventuallyEq`: a map on a finite-dimensional space that is of class `C^ω` |
| 40 | at a point agrees near it with a globally smooth map. |
| 41 | |
| 42 | ## Relation to the literature |
| 43 | |
| 44 | The results of this file include the mean value property of holomorphic functions and the fact that |
| 45 | an entire function is determined by its Taylor series at 0. |
| 46 | -/ |
| 47 | |
| 48 | @[expose] public section |
| 49 | |
| 50 | /-! ## Circle averages, the mean value property and a halving criterion for upper bounds -/ |
| 51 | |
| 52 | section CircleMean |
| 53 | |
| 54 | open MeasureTheory Real AddCircle |
| 55 | |
| 56 | /-- Averaging over a probability space of measure preserving maps leaves the integral unchanged. |
| 57 | Suppose `μ` is s-finite and the maps `T θ` preserve `μ` and are jointly measurable. |
| 58 | If `f` is integrable and `g x` is the average of `f (T θ x)`, then `f` and `g` have the same |
| 59 | integral. -/ |
| 60 | theorem New.integral_eq_of_probability_mean {G Ω : Type*} [MeasurableSpace G] [MeasurableSpace Ω] |
| 61 | {μ : Measure G} [SFinite μ] {ν : Measure Ω} [IsProbabilityMeasure ν] |
| 62 | {f g : G → ℂ} {T : Ω → G → G} (hT_meas : Measurable T.uncurry) |
| 63 | (hT : ∀ θ : Ω, MeasurePreserving (T θ) μ μ) (hf : Integrable f μ) |
| 64 | (h_mean : ∀ x : G, ∫ θ : Ω, f (T θ x) ∂ν = g x) : |
| 65 | ∫ x : G, f x ∂μ = ∫ x : G, g x ∂μ := by |
| 66 | -- Fubini's theorem: average over `θ` last; each `T θ` preserves `μ`, so the inner integral is |
| 67 | -- then the integral of `f`. |
| 68 | calc ∫ x : G, f x ∂μ = ∫ _ : Ω, (∫ x : G, f x ∂μ) ∂ν := by simp |
| 69 | _ = ∫ x : G, (∫ θ : Ω, f (T θ x) ∂ν) ∂μ := |
| 70 | (integral_integral_skew_product (fun θ ↦ (hT θ).map_eq) (hf.comp_snd ν) hT_meas).symm |
| 71 | _ = ∫ x : G, g x ∂μ := by simp only [h_mean] |
| 72 | |
| 73 | /-- The mean value property: the mean over the unit circle of a function holomorphic on the closed |
| 74 | unit disc is its value at the centre. -/ |
| 75 | theorem New.integral_comp_toCircle_eq_apply_zero {f : ℂ → ℂ} |
| 76 | (hf : DifferentiableOn ℂ f (Metric.closedBall 0 1)) : |
| 77 | ∫ θ : UnitAddCircle, f θ.toCircle = f 0 := by |
| 78 | -- Mathlib's mean value property, with the period of the angle rescaled from `2π` to `1`. |
| 79 | calc ∫ θ : UnitAddCircle, f θ.toCircle |
| 80 | = ∫ t in (0 : ℝ)..1, f (Circle.exp (2 * π * t)) := by |
| 81 | simp [← AddCircle.intervalIntegral_preimage 1 0, toCircle, -Circle.coe_exp] |
| 82 | _ = circleAverage f 0 1 := by |
| 83 | rw [intervalIntegral.integral_comp_mul_left (fun t : ℝ ↦ f (Circle.exp t)) (by positivity)] |
| 84 | simp [circleAverage, circleMap] |
| 85 | _ = f 0 := (hf.diffContOnCl_ball (by rw [abs_one])).circleAverage |
| 86 | |
| 87 | /-- Halving criterion: let `f` be a real function bounded above and `c ≥ 0`. If for every upper |
| 88 | bound `M ≥ 0` of `f` each value is at most `M / 2` or at most `c`, then `f ≤ c`. -/ |
| 89 | lemma New.le_of_halving {X : Sort*} {f : X → ℝ} {c B : ℝ} (hB : ∀ x : X, f x ≤ B) (hc : 0 ≤ c) |
| 90 | (h_halve : ∀ M ≥ (0 : ℝ), (∀ x : X, f x ≤ M) → ∀ x : X, f x ≤ M / 2 ∨ f x ≤ c) (x : X) : |
| 91 | f x ≤ c := by |
| 92 | -- Let `s` be the supremum of `f`. Halving the bound `|s|` gives `s ≤ max (|s| / 2) c`, which |
| 93 | -- forces `s ≤ c`: if `s ≤ |s| / 2`, then `s ≤ 0 ≤ c`. |
| 94 | have h_le_sup : ∀ y : X, f y ≤ iSup f := le_ciSup ⟨B, Set.forall_mem_range.2 hB⟩ |
| 95 | have h_sup : iSup f ≤ max (|iSup f| / 2) c := |
| 96 | Real.iSup_le (fun y ↦ le_max_iff.2 <| h_halve |iSup f| (abs_nonneg _) |
| 97 | (fun z ↦ (h_le_sup z).trans (le_abs_self _)) y) (le_max_of_le_right hc) |
| 98 | have h_sup_le : iSup f ≤ c := by grind |
| 99 | exact (h_le_sup x).trans h_sup_le |
| 100 | |
| 101 | end CircleMean |
| 102 | |
| 103 | /-! |
| 104 | ## Algebra of one-variable Taylor series at 0 |
| 105 | |
| 106 | For functions analytic at 0 the Taylor series `New.taylorAtZero` respects sums, products, powers and |
| 107 | polynomial expressions (`New.taylorAtZero_add`, `New.taylorAtZero_mul`, `New.taylorAtZero_pow`, |
| 108 | `New.taylorAtZero_eval`); by `New.taylorAtZero_comp_mul` the series of z ↦ f (a z) is the series of |
| 109 | f rescaled by a, and `New.eq_of_taylorAtZero_eq` says that the Taylor series at 0 determines an |
| 110 | entire function. |
| 111 | -/ |
| 112 | |
| 113 | section TaylorSeries |
| 114 | |
| 115 | open PowerSeries Nat AnalyticAt Complex |
| 116 | |
| 117 | attribute [fun_prop] Differentiable.analyticAt |
| 118 | |
| 119 | namespace New |
| 120 | |
| 121 | /-- The Taylor series ∑ f⁽ⁿ⁾(0) zⁿ/n! at 0 of a function f : ℂ → ℂ, as a formal power series. -/ |
| 122 | noncomputable def taylorAtZero (f : ℂ → ℂ) : PowerSeries ℂ := |
| 123 | PowerSeries.mk fun n ↦ iteratedDeriv n f 0 / n.factorial |
| 124 | |
| 125 | @[simp] |
| 126 | lemma coeff_taylorAtZero {f : ℂ → ℂ} (n : ℕ) : |
| 127 | coeff n (taylorAtZero f) = iteratedDeriv n f 0 / n ! := |
| 128 | coeff_mk n _ |
| 129 | |
| 130 | @[simp] |
| 131 | lemma constantCoeff_taylorAtZero {f : ℂ → ℂ} : constantCoeff (taylorAtZero f) = f 0 := by |
| 132 | simp [taylorAtZero] |
| 133 | |
| 134 | @[simp] |
| 135 | lemma taylorAtZero_const (c : ℂ) : (taylorAtZero fun _ : ℂ ↦ c) = C c := by |
| 136 | ext ⟨_ | n⟩ <;> simp [iteratedDeriv_const] |
| 137 | |
| 138 | /-- The Taylor series `taylorAtZero` at 0 of `z ↦ f (a * z)` is that of `f` with the `n`-th |
| 139 | coefficient multiplied by `a ^ n` (`PowerSeries.rescale a`). No analyticity is needed. -/ |
| 140 | @[simp] |
| 141 | lemma taylorAtZero_comp_mul (a : ℂ) (f : ℂ → ℂ) : |
| 142 | taylorAtZero (fun z : ℂ ↦ f (a * z)) = rescale a (taylorAtZero f) := by |
| 143 | ext n |
| 144 | simp [TauCeti.iteratedDeriv_comp_mul_left, smul_eq_mul, mul_div_assoc] |
| 145 | |
| 146 | /-- Two entire functions with the same Taylor series at 0 are equal. -/ |
| 147 | lemma eq_of_taylorAtZero_eq {f g : ℂ → ℂ} (hf_diff : Differentiable ℂ f) |
| 148 | (hg_diff : Differentiable ℂ g) (h_eq : taylorAtZero f = taylorAtZero g) : f = g := by |
| 149 | ext z |
| 150 | -- an entire function is the sum of its Taylor series |
| 151 | rw [← taylorSeries_eq_of_entire' 0 z hf_diff, ← taylorSeries_eq_of_entire' 0 z hg_diff] |
| 152 | simp [inv_mul_eq_div, ← coeff_taylorAtZero, h_eq] |
| 153 | |
| 154 | /-- For a function analytic at zero, the derivative formula for the Taylor series agrees |
| 155 | with Tau Ceti's construction by iterated divided differences. -/ |
| 156 | private lemma taylorAtZero_eq_taylorSeries {f : ℂ → ℂ} (hf : AnalyticAt ℂ f 0) : |
| 157 | taylorAtZero f = TauCeti.taylorSeries f 0 := by |
| 158 | ext n |
| 159 | rw [coeff_taylorAtZero, ← hf.factorial_smul_coeff_taylorSeries n, nsmul_eq_mul, |
| 160 | mul_comm, mul_div_cancel_right₀ _ (Nat.cast_ne_zero.mpr (factorial_ne_zero n))] |
| 161 | |
| 162 | /-- The Taylor series at 0 of a sum of two functions analytic at 0 is the sum of their Taylor |
| 163 | series. -/ |
| 164 | @[simp] |
| 165 | lemma taylorAtZero_add {f g : ℂ → ℂ} (hf : AnalyticAt ℂ f 0) (hg : AnalyticAt ℂ g 0) : |
| 166 | taylorAtZero (fun z : ℂ ↦ f z + g z) = taylorAtZero f + taylorAtZero g := by |
| 167 | change taylorAtZero (f + g) = _ |
| 168 | rw [taylorAtZero_eq_taylorSeries (hf.add hg), taylorAtZero_eq_taylorSeries hf, |
| 169 | taylorAtZero_eq_taylorSeries hg] |
| 170 | exact TauCeti.taylorSeries_add hf hg |
| 171 | |
| 172 | /-- The Taylor series at 0 of a product of two functions analytic at 0 is the product of their |
| 173 | Taylor series. -/ |
| 174 | @[simp] |
| 175 | lemma taylorAtZero_mul {f g : ℂ → ℂ} (hf : AnalyticAt ℂ f 0) (hg : AnalyticAt ℂ g 0) : |
| 176 | taylorAtZero (fun z : ℂ ↦ f z * g z) = taylorAtZero f * taylorAtZero g := by |
| 177 | change taylorAtZero (f * g) = _ |
| 178 | rw [taylorAtZero_eq_taylorSeries (hf.mul hg), taylorAtZero_eq_taylorSeries hf, |
| 179 | taylorAtZero_eq_taylorSeries hg] |
| 180 | exact TauCeti.taylorSeries_mul hf hg |
| 181 | |
| 182 | /-- Let `f` be analytic at 0 and `P` a polynomial. Then the Taylor series of `P ∘ f` is `P` |
| 183 | evaluated at the Taylor series of `f`. -/ |
| 184 | @[simp] |
| 185 | lemma taylorAtZero_eval {f : ℂ → ℂ} (hf : AnalyticAt ℂ f 0) (P : Polynomial ℂ) : |
| 186 | taylorAtZero (fun z : ℂ ↦ P.eval (f z)) = Polynomial.aeval (taylorAtZero f) P := by |
| 187 | -- build `P` by adding constants and multiplying by `X`; `taylorAtZero` respects both |
| 188 | induction P using Polynomial.recOnHorner with |
| 189 | | M0 => simp |
| 190 | | MC P c _ _ ih => simp (disch := fun_prop) [ih] |
| 191 | | MX P _ ih => simp (disch := fun_prop) [ih] |
| 192 | |
| 193 | /-- The Taylor series at 0 of `f ^ n` is the `n`-th power of that of `f`, for `f` analytic |
| 194 | at 0. -/ |
| 195 | @[simp] |
| 196 | lemma taylorAtZero_pow {f : ℂ → ℂ} (hf : AnalyticAt ℂ f 0) (n : ℕ) : |
| 197 | taylorAtZero (fun z : ℂ ↦ f z ^ n) = taylorAtZero f ^ n := by |
| 198 | simpa using taylorAtZero_eval hf (Polynomial.X ^ n) |
| 199 | |
| 200 | end New |
| 201 | |
| 202 | end TaylorSeries |
| 203 | |
| 204 | /-! ## A bound of x^l by a factorial and an exponential -/ |
| 205 | |
| 206 | section PowerExpBound |
| 207 | |
| 208 | open Real |
| 209 | |
| 210 | /-- For a natural number `l`, a real `x ≥ 0` and a real `v`: |
| 211 | `x ^ l ≤ exp (log l! + l v + x / exp v)`. This is `t ^ l / l! ≤ exp t` at `t = x / exp v`. -/ |
| 212 | lemma New.pow_le_exp_log_factorial_add (l : ℕ) (x : NNReal) (v : ℝ) : |
| 213 | (x : ℝ) ^ l ≤ exp (log l.factorial + l * v + x / exp v) := by |
| 214 | calc (x : ℝ) ^ l = l.factorial * exp v ^ l * ((x / exp v) ^ l / l.factorial) := by |
| 215 | simp [field, div_pow] |
| 216 | _ ≤ l.factorial * exp v ^ l * exp (x / exp v) := by |
| 217 | gcongr |
| 218 | exact pow_div_factorial_le_exp _ (by positivity) l |
| 219 | _ = exp (log l.factorial + l * v + x / exp v) := by |
| 220 | simp [exp_add, exp_log, l.factorial_pos, exp_natCast_mul] |
| 221 | |
| 222 | end PowerExpBound |
| 223 | |
| 224 | /-! |
| 225 | ## Smoothness of matrix operations and extension of analytic germs |
| 226 | |
| 227 | Matrices carry the elementwise sup norm. The exponent `N` is any order of smoothness, finite, `∞` |
| 228 | or analytic (`ω`). |
| 229 | -/ |
| 230 | |
| 231 | section SmoothMatrices |
| 232 | |
| 233 | open Matrix ContDiff Norms.Elementwise NormedSpace |
| 234 | |
| 235 | namespace New |
| 236 | |
| 237 | variable {X l m o : Type*} |
| 238 | {N : ℕ∞ω} [NormedAddCommGroup X] [NormedSpace ℝ X] [Fintype l] [Fintype m] |
| 239 | |
| 240 | /-- A map from a finite-dimensional real normed space to a real normed space that is of class |
| 241 | `C^ω` at `x` (analytic, if the target is complete) agrees near `x` with a globally smooth map. -/ |
| 242 | lemma exists_contDiff_eventuallyEq {Y : Type*} [FiniteDimensional ℝ X] [NormedAddCommGroup Y] |
| 243 | [NormedSpace ℝ Y] {f : X → Y} {x : X} (hf : ContDiffAt ℝ ω f x) : |
| 244 | ∃ g : X → Y, ContDiff ℝ ∞ g ∧ g =ᶠ[nhds x] f := by |
| 245 | obtain ⟨s, hs, hfs⟩ := hf.contDiffOn (m := ∞) (by simp) (by simp) |
| 246 | obtain ⟨g, hg, _, hgf⟩ := hfs.exists_contDiff_eventuallyEq_of_finiteDimensional hs |
| 247 | exact ⟨g, hg, hgf⟩ |
| 248 | |
| 249 | /-- Complex conjugation is smooth over `ℝ`, of every order `N`. -/ |
| 250 | @[fun_prop] |
| 251 | lemma contDiff_conj : ContDiff ℝ N (starRingEnd ℂ) := Complex.conjCLE.contDiff |
| 252 | |
| 253 | /-- Matrix multiplication of complex matrices is smooth over `ℝ` for the elementwise norm. -/ |
| 254 | @[fun_prop] |
| 255 | lemma contDiff_matrix_mul [Fintype o] : |
| 256 | ContDiff ℝ N fun p : Matrix l m ℂ × Matrix m o ℂ ↦ p.1 * p.2 := by |
| 257 | refine contDiff_pi' fun i ↦ contDiff_pi' fun j ↦ ?_ |
| 258 | simp only [Matrix.mul_apply] |
| 259 | fun_prop |
| 260 | |
| 261 | /-- The conjugate transpose of complex matrices is smooth over `ℝ` for the elementwise norm. -/ |
| 262 | @[fun_prop] |
| 263 | lemma contDiff_conjTranspose : ContDiff ℝ N (conjTranspose : Matrix l m ℂ → Matrix m l ℂ) := |
| 264 | (conjTransposeLinearEquiv l m ℝ ℂ).toContinuousLinearEquiv.contDiff |
| 265 | |
| 266 | /-- The exponential of complex square matrices is smooth over `ℝ` for the elementwise norm. -/ |
| 267 | @[fun_prop] |
| 268 | lemma contDiff_matrix_exp [DecidableEq m] : ContDiff ℝ N (NormedSpace.exp (𝔸 := Matrix m m ℂ)) := by |
| 269 | -- The goal uses the elementwise norm, but `exp` is known to be analytic for the operator norm. |
| 270 | -- The identity `e` from the first normed space to the second is a continuous linear |
| 271 | -- equivalence, so smoothness carries over. |
| 272 | open Norms.Operator in |
| 273 | let e : (m → m → ℂ) ≃L[ℝ] Matrix m m ℂ := .refl .. |
| 274 | have h_exp : ContDiff ℝ N (exp (𝔸 := Matrix m m ℂ)) := |
| 275 | AnalyticOnNhd.contDiff fun A _ ↦ exp_analytic A |
| 276 | -- `e` is the identity map, so `e.symm ∘ exp ∘ e` is `exp` itself, now for the elementwise norm |
| 277 | have h_conj : ContDiff ℝ N (e.symm ∘ exp (𝔸 := Matrix m m ℂ) ∘ e) := |
| 278 | e.symm.contDiff.comp (h_exp.comp e.contDiff) |
| 279 | exact h_conj |
| 280 | |
| 281 | end New |
| 282 | |
| 283 | end SmoothMatrices |