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 | import Mathlib.Algebra.Order.Star.Real |
| 5 | import Mathlib.NumberTheory.LSeries.Nonvanishing |
| 6 | import TauCeti.NumberTheory.DirichletCharacter.LFunction.Bounds |
| 7 | public import Lib.Analytic.PrimeNumberTheorem.LFunctionGrowth |
| 8 | import Lib.Analytic.EntireLFunction |
| 9 | |
| 10 | /-! |
| 11 | # A zero-free region for Dirichlet L-functions |
| 12 | |
| 13 | For a Dirichlet character `χ` and large `l`, the function `L(s, χ)` has no zero with |
| 14 | `re s ≥ 1 - l⁻²⁵` and `|s| ≤ e^l`, and its logarithmic derivative, with the pole removed, is at most |
| 15 | `2 l²⁵` there. The inequality `|L(σ, 1)³ L(σ + i t, χ)⁴ L(σ + 2 i t, χ²)| ≥ 1` bounds `L` from below |
| 16 | to the right of `re s = 1`, and the bound for the derivative carries this across the line. If `χ²` |
| 17 | is principal, the points near `1` are treated by `𝖿_χ(1) ≠ 0` and continuity; so how large `l` must |
| 18 | be depends on `χ`. |
| 19 | |
| 20 | Notions from other files: |
| 21 | * `entireL χ`: the entire function `L(s, χ)`, or `(s - 1) L(s, χ)` if `χ` is principal; |
| 22 | * `regularL χ`, written `𝖿_χ` in comments: `entireL χ`, divided by `s` if `χ` is principal. |
| 23 | |
| 24 | ## Relation to the literature |
| 25 | |
| 26 | Known result: the classical zero-free region, in the crude form with a power of the logarithm that |
| 27 | the 3-4-1 inequality gives directly. Source: Montgomery and Vaughan, Multiplicative Number Theory I, |
| 28 | 2007, ch. 11. |
| 29 | -/ |
| 30 | |
| 31 | @[expose] public section |
| 32 | |
| 33 | open Complex Real Filter Topology Metric |
| 34 | namespace New |
| 35 | |
| 36 | variable {N : ℕ} [NeZero N] |
| 37 | |
| 38 | /-- For all sufficiently small real `r`, the regularized L-function `regularL χ` (`L(s, χ)`, times |
| 39 | `(s - 1) / s` if `χ` is principal) has absolute value at least `r` within distance `r` of `1`. -/ |
| 40 | lemma eventually_le_norm_regularL (χ : DirichletCharacter ℂ N) : |
| 41 | ∀ᶠ r : ℝ in 𝓝 0, ∀ s : ℂ, ‖s - 1‖ ≤ r → r ≤ ‖regularL χ s‖ := by |
| 42 | have h_pos : 0 < ‖regularL χ 1‖ := by simp [regularL, entireL_ne_zero χ (s := 1) le_rfl] |
| 43 | have h_near : ∀ᶠ s : ℂ in 𝓝 1, ‖regularL χ 1‖ / 2 ≤ ‖regularL χ s‖ := |
| 44 | (differentiableAt_regularL χ one_pos).continuousAt.norm.eventually_const_le (half_lt_self h_pos) |
| 45 | filter_upwards [eventually_le_nhds (half_pos h_pos), eventually_closedBall_subset h_near] |
| 46 | with r hr h_ball s hs using hr.trans (h_ball (mem_closedBall_iff_norm.2 hs)) |
| 47 | |
| 48 | /-- A lower bound from the 3-4-1 inequality. Let `l ≥ 10¹⁰`, `N ≤ e^l` and `0 < η ≤ 1`, and write |
| 49 | `𝖿_χ` for `regularL χ`, that is `L(s, χ)`, times `(s - 1) / s` if `χ` is principal. Then |
| 50 | `η³ ≤ 256 l⁷ |𝖿_χ(s)|⁴` for `re s ≥ 1 + η` and `|s| ≤ 3 e^l / 2`, if `χ²` is not principal or |
| 51 | `|s - 1| ≥ 1 / l`. -/ |
| 52 | lemma pow_three_le_mul_norm_regularL_pow (χ : DirichletCharacter ℂ N) {s : ℂ} {l : ℝ} |
| 53 | (hl : 10 ^ 10 ≤ l) (hN : N ≤ rexp l) {η : ℝ} (hη : 0 < η) (hη_le : η ≤ 1) |
| 54 | (h_far : χ ^ 2 = 1 → 1 / l ≤ ‖s - 1‖) (h_re : 1 + η ≤ s.re) |
| 55 | (h_norm : ‖s‖ ≤ 3 / 2 * rexp l) : |
| 56 | η ^ 3 ≤ 256 * l ^ 7 * ‖regularL χ s‖ ^ 4 := by |
| 57 | have hl_one : 1 ≤ l := by linarith |
| 58 | -- the three points are `re s`, `s` and `s₂ = re s + 2 i im s` |
| 59 | let s₂ : ℂ := s + s.im * I |
| 60 | have re_s₂ : s₂.re = s.re := by simp [s₂] |
| 61 | have norm_s₂ : ‖s₂‖ ≤ 3 * rexp l := by |
| 62 | have h_im : ‖s.im * I‖ ≤ ‖s‖ := by simpa using abs_im_le_norm s |
| 63 | linarith [norm_add_le s (s.im * I)] |
| 64 | have dist_s₂ : ‖s - 1‖ ≤ ‖s₂ - 1‖ := by |
| 65 | have h_sq : ‖s₂ - 1‖ ^ 2 = ‖s - 1‖ ^ 2 + 3 * s.im ^ 2 := by |
| 66 | have im_s₂ : s₂.im = 2 * s.im := by simp [s₂, two_mul] |
| 67 | simp only [Complex.sq_norm, normSq_apply, sub_re, sub_im, re_s₂, im_s₂, one_im] |
| 68 | ring |
| 69 | exact (sq_le_sq₀ (norm_nonneg _) (norm_nonneg _)).1 (by linarith [sq_nonneg s.im]) |
| 70 | have product : 1 ≤ ‖LSeries ((1 : DirichletCharacter ℂ N) ·) s.re‖ ^ 3 * ‖LSeries (χ ·) s‖ ^ 4 * |
| 71 | ‖LSeries ((χ ^ 2) ·) s₂‖ := by |
| 72 | have at_re : (1 : ℂ) + (s.re - 1 : ℝ) = s.re := by simp |
| 73 | have at_s : s.re + I * s.im = s := by rw [mul_comm, re_add_im] |
| 74 | have at_s₂ : s.re + 2 * I * s.im = s₂ := by linear_combination at_s |
| 75 | simpa only [at_re, at_s, at_s₂, norm_mul, norm_pow] using |
| 76 | χ.norm_LSeries_product_ge_one (by linarith : 0 < s.re - 1) s.im |
| 77 | have trivial_char_le : ‖LSeries ((1 : DirichletCharacter ℂ N) ·) s.re‖ ≤ 2 / η := calc |
| 78 | _ ≤ 1 + 1 / η := |
| 79 | DirichletCharacter.norm_LSeries_le_one_add 1 (one_div_pos.2 hη) (by simpa using h_re) |
| 80 | _ ≤ 1 / η + 1 / η := by linarith [one_le_one_div hη hη_le] |
| 81 | _ = 2 / η := by ring |
| 82 | have char_le : ‖LSeries (χ ·) s‖ ≤ 2 * l * ‖regularL χ s‖ := |
| 83 | norm_LSeries_le_mul_norm_regularL χ (by linarith) hl_one fun hχ ↦ h_far (by simp [hχ]) |
| 84 | have sq_char_le : ‖LSeries ((χ ^ 2) ·) s₂‖ ≤ 2 * l * l ^ 2 := by |
| 85 | have h_far₂ : χ ^ 2 = 1 → 1 / l ≤ ‖s₂ - 1‖ := fun hχ ↦ (h_far hχ).trans dist_s₂ |
| 86 | have re_s₂_ge : 1 - 1 / l ≤ s₂.re := by linarith [one_div_pos.2 (one_pos.trans_le hl_one)] |
| 87 | grw [norm_LSeries_le_mul_norm_regularL (χ ^ 2) (by linarith) hl_one h_far₂, |
| 88 | norm_regularL_le_sq (χ ^ 2) hl hN re_s₂_ge norm_s₂] |
| 89 | calc η ^ 3 ≤ η ^ 3 * ((2 / η) ^ 3 * (2 * l * ‖regularL χ s‖) ^ 4 * (2 * l * l ^ 2)) := by |
| 90 | grw [← trivial_char_le, ← char_le, ← sq_char_le, ← product, mul_one] |
| 91 | _ = 256 * l ^ 7 * ‖regularL χ s‖ ^ 4 := by field |
| 92 | |
| 93 | /-- Let `l ≥ 10¹⁰` and `N ≤ e^l`; if `χ²` is principal, let `|𝖿_χ| ≥ 1 / l` within `1 / l` of `1`, |
| 94 | where `𝖿_χ = regularL χ` is `L(s, χ)`, times `(s - 1) / s` if `χ` is principal. |
| 95 | Then `|𝖿_χ(s)| ≥ 12 / l²²` for `re s ≥ 1 + l⁻²⁵` and `|s| ≤ 3 e^l / 2`. -/ |
| 96 | lemma div_pow_le_norm_regularL (χ : DirichletCharacter ℂ N) {s : ℂ} {l : ℝ} |
| 97 | (hl : 10 ^ 10 ≤ l) (hN : N ≤ rexp l) |
| 98 | (h_near : χ ^ 2 = 1 → ∀ z : ℂ, ‖z - 1‖ ≤ 1 / l → 1 / l ≤ ‖regularL χ z‖) |
| 99 | (h_re : 1 + 1 / l ^ 25 ≤ s.re) (h_norm : ‖s‖ ≤ 3 / 2 * rexp l) : |
| 100 | 12 / l ^ 22 ≤ ‖regularL χ s‖ := by |
| 101 | have hl_one : 1 ≤ l := by linarith |
| 102 | by_cases! h_far : χ ^ 2 = 1 → 1 / l ≤ ‖s - 1‖ |
| 103 | · -- if `χ²` is not principal or `s` is not near `1`, the 3-4-1 bound with `η = l⁻²⁵` applies |
| 104 | have hη_le : 1 / l ^ 25 ≤ 1 := div_le_one_of_le₀ (one_le_pow₀ hl_one) (by positivity) |
| 105 | have h_const : 256 * 12 ^ 4 ≤ l ^ 6 := by linarith [le_self_pow₀ hl_one (by norm_num : 6 ≠ 0)] |
| 106 | have h_mul : 256 * l ^ 7 * (12 / l ^ 22) ^ 4 ≤ 256 * l ^ 7 * ‖regularL χ s‖ ^ 4 := calc |
| 107 | _ = 256 * 12 ^ 4 / l ^ 81 := by field |
| 108 | _ ≤ l ^ 6 / l ^ 81 := by gcongr |
| 109 | _ = (1 / l ^ 25) ^ 3 := by field |
| 110 | _ ≤ _ := pow_three_le_mul_norm_regularL_pow χ hl hN (by positivity) hη_le h_far h_re h_norm |
| 111 | exact le_of_pow_le_pow_left₀ four_ne_zero (norm_nonneg _) |
| 112 | (le_of_mul_le_mul_left h_mul (by positivity)) |
| 113 | · obtain ⟨hχ, h_close⟩ : χ ^ 2 = 1 ∧ ‖s - 1‖ < 1 / l := h_far |
| 114 | calc 12 / l ^ 22 ≤ l / l ^ 2 := by gcongr <;> linarith |
| 115 | _ = 1 / l := by field |
| 116 | _ ≤ ‖regularL χ s‖ := h_near hχ s h_close.le |
| 117 | |
| 118 | /-- Let `χ` be a Dirichlet character modulo `N`, `l ≥ 10¹⁰` and `N ≤ e^l`; if `χ²` is principal, let |
| 119 | `|𝖿_χ| ≥ 1 / l` within `1 / l` of `1`, where `𝖿_χ = regularL χ`. Then `|𝖿_χ(s)| ≥ 8 / l²²` and |
| 120 | `|𝖿_χ'(s)| ≤ 2 l³` for `re s ≥ 1 - l⁻²⁵` and `|s| ≤ e^l`. -/ |
| 121 | private lemma le_norm_regularL_and_norm_deriv_le (χ : DirichletCharacter ℂ N) {s : ℂ} {l : ℝ} |
| 122 | (hl : 10 ^ 10 ≤ l) (hN : N ≤ rexp l) |
| 123 | (h_near : χ ^ 2 = 1 → ∀ z : ℂ, ‖z - 1‖ ≤ 1 / l → 1 / l ≤ ‖regularL χ z‖) |
| 124 | (h_re : 1 - 1 / l ^ 25 ≤ s.re) (h_norm : ‖s‖ ≤ rexp l) : |
| 125 | 8 / l ^ 22 ≤ ‖regularL χ s‖ ∧ ‖deriv (regularL χ) s‖ ≤ 2 * l ^ 3 := by |
| 126 | -- Compare `s` with `v = s + 2 η`, `η = l⁻²⁵`: between them `𝖿_χ` changes by at most |
| 127 | -- `2 l³ · 2 η = 4 / l²²`, and `|𝖿_χ(v)| ≥ 12 / l²²`. |
| 128 | have exp_ge : l + 1 ≤ rexp l := add_one_le_exp l |
| 129 | have inv_le : 1 / l ≤ 1 / 6 := one_div_le_one_div_of_le (by norm_num) (by linarith) |
| 130 | let η : ℝ := 1 / l ^ 25 |
| 131 | have hη_pos : 0 < η := by positivity |
| 132 | have hη_le : η ≤ 1 / l / 6 := calc |
| 133 | 1 / l ^ 25 ≤ 1 / l ^ 2 := by gcongr <;> linarith |
| 134 | _ = 1 / l * (1 / l) := by ring |
| 135 | _ ≤ 1 / l / 6 := by grw [div_eq_mul_one_div (1 / l) 6, ← inv_le] |
| 136 | have bounds (z : ℂ) (hz : z ∈ closedBall s (2 * η)) : |
| 137 | 1 - 1 / l / 2 ≤ z.re ∧ ‖z‖ ≤ 2 * rexp l := by |
| 138 | rw [mem_closedBall_iff_norm] at hz |
| 139 | have h_dist : |z.re - s.re| ≤ ‖z - s‖ := by simpa using abs_re_le_norm (z - s) |
| 140 | exact ⟨by linarith [(abs_le.1 h_dist).1], by linarith [norm_le_norm_sub_add z s]⟩ |
| 141 | have deriv_le (z : ℂ) (hz : z ∈ closedBall s (2 * η)) : ‖deriv (regularL χ) z‖ ≤ 2 * l ^ 3 := |
| 142 | norm_deriv_regularL_le χ hl hN (bounds z hz).1 (bounds z hz).2 |
| 143 | have hs_mem : s ∈ closedBall s (2 * η) := mem_closedBall_self (by positivity) |
| 144 | let v : ℂ := s + (2 * η : ℝ) |
| 145 | have dist_v : ‖v - s‖ = 2 * η := by simp [v, hη_pos.le] |
| 146 | have re_v : v.re = s.re + 2 * η := by simp [v] |
| 147 | have change_le : ‖regularL χ v - regularL χ s‖ ≤ 4 / l ^ 22 := calc |
| 148 | _ ≤ 2 * l ^ 3 * ‖v - s‖ := |
| 149 | (convex_closedBall s (2 * η)).norm_image_sub_le_of_norm_deriv_le |
| 150 | (fun z hz ↦ differentiableAt_regularL χ (by linarith [(bounds z hz).1])) deriv_le hs_mem |
| 151 | (mem_closedBall_iff_norm.2 dist_v.le) |
| 152 | _ = 4 / l ^ 22 := by |
| 153 | rw [dist_v] |
| 154 | field |
| 155 | have large_v : 12 / l ^ 22 ≤ ‖regularL χ v‖ := |
| 156 | div_pow_le_norm_regularL χ hl hN h_near (by linarith) (by linarith [norm_le_norm_sub_add v s]) |
| 157 | have large_s : 8 / l ^ 22 ≤ ‖regularL χ s‖ := calc |
| 158 | _ = 12 / l ^ 22 - 4 / l ^ 22 := by ring |
| 159 | _ ≤ ‖regularL χ s‖ := by linarith [norm_sub_norm_le (regularL χ v) (regularL χ s)] |
| 160 | exact ⟨large_s, deriv_le s hs_mem⟩ |
| 161 | |
| 162 | /-- Let `l ≥ 10¹⁰` and `N ≤ e^l`; if `χ²` is principal, let `|𝖿_χ| ≥ 1 / l` within `1 / l` of `1`, |
| 163 | where `𝖿_χ = regularL χ` is `L(s, χ)`, times `(s - 1) / s` if `χ` is principal. |
| 164 | Then `𝖿_χ(s) ≠ 0` and `|𝖿_χ'(s) / 𝖿_χ(s)| ≤ l²⁵` for `re s ≥ 1 - l⁻²⁵` and `|s| ≤ e^l`. -/ |
| 165 | lemma norm_logDeriv_regularL_le (χ : DirichletCharacter ℂ N) {s : ℂ} {l : ℝ} |
| 166 | (hl : 10 ^ 10 ≤ l) (hN : N ≤ rexp l) |
| 167 | (h_near : χ ^ 2 = 1 → ∀ z : ℂ, ‖z - 1‖ ≤ 1 / l → 1 / l ≤ ‖regularL χ z‖) |
| 168 | (h_re : 1 - 1 / l ^ 25 ≤ s.re) (h_norm : ‖s‖ ≤ rexp l) : |
| 169 | regularL χ s ≠ 0 ∧ ‖logDeriv (regularL χ) s‖ ≤ l ^ 25 := by |
| 170 | obtain ⟨large_s, deriv_s⟩ : 8 / l ^ 22 ≤ ‖regularL χ s‖ ∧ ‖deriv (regularL χ) s‖ ≤ 2 * l ^ 3 := |
| 171 | le_norm_regularL_and_norm_deriv_le χ hl hN h_near h_re h_norm |
| 172 | refine ⟨norm_pos_iff.1 (lt_of_lt_of_le (by positivity) large_s), ?_⟩ |
| 173 | calc ‖logDeriv (regularL χ) s‖ ≤ 2 * l ^ 3 / (8 / l ^ 22) := by |
| 174 | grw [logDeriv_apply, norm_div, deriv_s, ← large_s] |
| 175 | _ = l ^ 25 / 4 := by field |
| 176 | _ ≤ l ^ 25 := div_le_self (by positivity) (by norm_num) |
| 177 | |
| 178 | /-- Let `χ` be a Dirichlet character mod `N ≥ 1`, `l ≥ 10¹⁰` and `N ≤ e^l`. If `χ²` is principal, |
| 179 | assume `|regularL χ z| ≥ 1 / l` whenever `|z - 1| ≤ 1 / l`, where `regularL χ` is `L(s, χ)` times |
| 180 | `(s - 1) / s` if `χ` is principal and `L(s, χ)` otherwise. Then for `re s ≥ 1 - l⁻²⁵` and |
| 181 | `|s| ≤ e^l`, the entire function `entireL χ` (equal to `L(s, χ)`, or to the continuation of |
| 182 | `(s - 1) L(s, χ)` if `χ` is principal) does not vanish at `s`, and its logarithmic derivative there |
| 183 | has norm at most `2 l²⁵`. -/ |
| 184 | lemma norm_logDeriv_entireL_le (χ : DirichletCharacter ℂ N) {s : ℂ} {l : ℝ} |
| 185 | (hl : 10 ^ 10 ≤ l) (hN : N ≤ rexp l) |
| 186 | (h_near : χ ^ 2 = 1 → ∀ z : ℂ, ‖z - 1‖ ≤ 1 / l → 1 / l ≤ ‖regularL χ z‖) |
| 187 | (h_re : 1 - 1 / l ^ 25 ≤ s.re) (h_norm : ‖s‖ ≤ rexp l) : |
| 188 | entireL χ s ≠ 0 ∧ ‖logDeriv (entireL χ) s‖ ≤ 2 * l ^ 25 := by |
| 189 | have two_le : 2 ≤ l ^ 25 := by |
| 190 | linarith [le_self_pow₀ (by linarith : 1 ≤ l) (by norm_num : 25 ≠ 0)] |
| 191 | obtain ⟨h_ne, h_bound⟩ := norm_logDeriv_regularL_le χ hl hN h_near h_re h_norm |
| 192 | -- `regularL χ` is `entireL χ` divided by the factor `u`, which is `s` or `1` |
| 193 | let u (z : ℂ) : ℂ := if χ = 1 then z else 1 |
| 194 | have h_eq : regularL χ = fun z : ℂ ↦ entireL χ z / u z := by |
| 195 | ext z |
| 196 | by_cases hχ : χ = 1 <;> simp [regularL, u, hχ] |
| 197 | obtain ⟨h_entire, hu⟩ : entireL χ s ≠ 0 ∧ u s ≠ 0 := by rwa [h_eq, div_ne_zero_iff] at h_ne |
| 198 | have u_diff : DifferentiableAt ℂ u s := by by_cases hχ : χ = 1 <;> simp [u, hχ] |
| 199 | have h_split : logDeriv (entireL χ) s = logDeriv (regularL χ) s + logDeriv u s := by |
| 200 | have h_div : logDeriv (fun z : ℂ ↦ entireL χ z / u z) s = |
| 201 | logDeriv (entireL χ) s - logDeriv u s := |
| 202 | logDeriv_div s h_entire hu (analyticAt_entireL χ s).differentiableAt u_diff |
| 203 | rw [h_eq, h_div, sub_add_cancel] |
| 204 | have u_bound : ‖logDeriv u s‖ ≤ 2 := by |
| 205 | have hs_norm : 1 / 2 ≤ ‖s‖ := by |
| 206 | linarith [re_le_norm s, one_div_le_one_div_of_le two_pos two_le] |
| 207 | by_cases hχ : χ = 1 |
| 208 | · simpa [u, hχ] using (one_div_le (by linarith) two_pos).2 hs_norm |
| 209 | · simp [u, hχ] |
| 210 | refine ⟨h_entire, ?_⟩ |
| 211 | rw [h_split] |
| 212 | linarith [norm_add_le (logDeriv (regularL χ) s) (logDeriv u s)] |
| 213 | |
| 214 | /-- **Zero-free region** for a fixed character: for all large `l`, on `re s ≥ 1 - l⁻²⁵`, |
| 215 | `|s| ≤ e^l` the function `entireL χ` (`L(s, χ)` with the pole removed) does not vanish and its |
| 216 | logarithmic derivative is at most `2 l²⁵`. -/ |
| 217 | theorem eventually_norm_logDeriv_entireL_le (χ : DirichletCharacter ℂ N) : |
| 218 | ∀ᶠ l : ℝ in atTop, ∀ s : ℂ, 1 - 1 / l ^ 25 ≤ s.re → ‖s‖ ≤ rexp l → |
| 219 | entireL χ s ≠ 0 ∧ ‖logDeriv (entireL χ) s‖ ≤ 2 * l ^ 25 := by |
| 220 | have inv_tendsto : Tendsto (fun l : ℝ ↦ 1 / l) atTop (𝓝 0) := |
| 221 | tendsto_const_nhds.div_atTop tendsto_id |
| 222 | filter_upwards [eventually_ge_atTop (10 ^ 10), eventually_ge_atTop (N : ℝ), |
| 223 | inv_tendsto.eventually (eventually_le_norm_regularL χ)] with l hl hN h_near s |
| 224 | exact norm_logDeriv_entireL_le χ hl (by linarith [add_one_le_exp l]) fun _ ↦ h_near |
| 225 | |
| 226 | end New |