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 TauCeti.Analysis.Convex.Lipschitz |
| 4 | import TauCeti.Probability.Distributions.Gamma.Basic |
| 5 | public import Mathlib.Analysis.CStarAlgebra.Classes |
| 6 | public import Mathlib.Probability.Distributions.Gamma |
| 7 | import Mathlib.Algebra.Order.Star.Real |
| 8 | import Mathlib.Analysis.Complex.HalfPlane |
| 9 | import Mathlib.Order.CompletePartialOrder |
| 10 | public import Lib.Speed |
| 11 | import Lib.Analytic.EntireLFunction |
| 12 | |
| 13 | /-! |
| 14 | # A Tauberian theorem with a power of the logarithm |
| 15 | |
| 16 | Let `R` be measurable and Lipschitz on `v ≥ 0`, and let its transform `∫₀^∞ R(v) e^{(1 - s) v} dv` |
| 17 | be `(F s - F 1) / (s - 1)` in `re s > 2`. Suppose that for all large `l` the function `F` is |
| 18 | holomorphic and at most `l ^ A` on `re s ≥ 1 - l ^ (-A)`, `|s| ≤ e ^ l`. Then `R(v) = O(v ^ (-B))` |
| 19 | for every `B`. The theorem is meant for the remainder in the prime number theorem for a sum over |
| 20 | prime powers with weights that vanish at the cutoff `x`: at `x = e ^ v` it is Lipschitz in `v`. |
| 21 | |
| 22 | The proof reads one Taylor coefficient of the transform at a far point `1 + H` in two ways. It is a |
| 23 | mean of `R` against a Gamma density that is concentrated at the given point `u`, hence close to |
| 24 | `R(u)`; and it is small by Cauchy's estimate on a disc that reaches left of the line `re s = 1`. |
| 25 | |
| 26 | ## Relation to the literature |
| 27 | |
| 28 | Known result: the passage from a zero-free region to the error term of the prime number theorem. |
| 29 | Source: Montgomery and Vaughan, Multiplicative Number Theory I, 2007, Section 6.2, where a contour |
| 30 | integral is used in place of the Taylor coefficient. |
| 31 | -/ |
| 32 | |
| 33 | @[expose] public section |
| 34 | |
| 35 | open Complex Filter MeasureTheory Metric ProbabilityTheory Set Topology |
| 36 | |
| 37 | open scoped Nat Real |
| 38 | |
| 39 | namespace New |
| 40 | |
| 41 | /-- Differentiation under the integral sign. Let `R` be measurable with `|R v| ≤ C e^v` for |
| 42 | `v ≥ 0`, and let `Φ s` be its transform `∫₀^∞ R(v) e^{(1 - s) v} dv` in `re s > 2`. Then, for such |
| 43 | `s`, the function `(-v)^k R(v) e^{(1 - s) v}` is integrable on `(0, ∞)`, and its integral is the |
| 44 | `k`-th derivative of `Φ` at `s`. -/ |
| 45 | lemma iteratedDeriv_transform {R : ℝ → ℝ} {C : ℝ} {Φ : ℂ → ℂ} (hR : Measurable R) |
| 46 | (R_le : ∀ v : ℝ, 0 ≤ v → |R v| ≤ C * rexp v) |
| 47 | (Φ_eq : ∀ s : ℂ, 2 < s.re → Φ s = ∫ v in Ioi (0 : ℝ), R v * cexp ((1 - s) * v)) (k : ℕ) (s : ℂ) |
| 48 | (hs : 2 < s.re) : |
| 49 | IntegrableOn (fun v : ℝ ↦ (-v) ^ k * R v * cexp ((1 - s) * v)) (Ioi 0) ∧ |
| 50 | iteratedDeriv k Φ s = ∫ v in Ioi (0 : ℝ), (-v) ^ k * R v * cexp ((1 - s) * v) := by |
| 51 | induction k generalizing s with |
| 52 | | zero => simp [integrableOn_laplace_of_abs_le hR R_le hs, Φ_eq s hs] |
| 53 | | succ k ih => |
| 54 | obtain ⟨ε, hε, hεs⟩ : ∃ ε > 0, 2 * ε < s.re - 2 := exists_pos_mul_lt (sub_pos.2 hs) 2 |
| 55 | have h_nhds : {z : ℂ | 2 < z.re} ∈ 𝓝 s := (isOpen_re_gt _).mem_nhds hs |
| 56 | let G (z : ℂ) (v : ℝ) : ℂ := (-v) ^ k * R v * cexp ((1 - z) * v) |
| 57 | -- On `re z > 2 ε + 2` the derivative in `z` is dominated by `‖G (ε + 2)‖ / ε`, since |
| 58 | -- `ε v ≤ e^{ε v}`. |
| 59 | have h_dom (v : ℝ) (hv : 0 < v) (z : ℂ) (hz : 2 * ε + 2 < z.re) : |
| 60 | ‖-v * G z v‖ ≤ ‖G (ε + 2) v‖ / ε := by |
| 61 | have h_exp_le : v * ε * rexp ((1 - z.re) * v) ≤ rexp ((1 - (ε + 2)) * v) := by |
| 62 | grw [lt_add_one (v * ε), Real.add_one_le_exp, ← Real.exp_add, Real.exp_le_exp] |
| 63 | nlinarith |
| 64 | have h_norm (w : ℂ) : ‖G w v‖ = v ^ k * |R v| * rexp ((1 - w.re) * v) := by |
| 65 | simp [G, abs_of_pos hv, norm_exp] |
| 66 | rw [norm_mul, norm_neg, norm_real, Real.norm_of_nonneg hv.le, h_norm, h_norm, add_re, |
| 67 | ofReal_re, re_ofNat, le_div_iff₀ hε] |
| 68 | calc v * (v ^ k * |R v| * rexp ((1 - z.re) * v)) * ε |
| 69 | = v ^ k * |R v| * (v * ε * rexp ((1 - z.re) * v)) := by ring |
| 70 | _ ≤ v ^ k * |R v| * rexp ((1 - (ε + 2)) * v) := by gcongr |
| 71 | have h_diff (v : ℝ) (z : ℂ) : HasDerivAt (fun z : ℂ ↦ G z v) (-v * G z v) z := by |
| 72 | simpa [G, mul_comm, mul_left_comm] using |
| 73 | (((hasDerivAt_id z).const_sub 1).mul_const (v : ℂ)).cexp.const_mul ((-v : ℂ) ^ k * R v) |
| 74 | have h_meas : ∀ᶠ z in 𝓝 s, AEStronglyMeasurable (G z) (volume.restrict (Ioi 0)) := |
| 75 | .mono h_nhds fun z hz ↦ (ih z hz).left.aestronglyMeasurable |
| 76 | have h_bound_int : IntegrableOn (fun v : ℝ ↦ ‖G (ε + 2) v‖ / ε) (Ioi 0) := |
| 77 | (ih (ε + 2) (by simpa)).left.norm.div_const ε |
| 78 | obtain ⟨h_int, h_deriv⟩ : IntegrableOn (fun v : ℝ ↦ -v * G s v) (Ioi 0) volume ∧ |
| 79 | HasDerivAt (fun z : ℂ ↦ ∫ v in Ioi 0, G z v) (∫ v in Ioi 0, -v * G s v) s := |
| 80 | hasDerivAt_integral_of_dominated_loc_of_deriv_le |
| 81 | ((isOpen_re_gt _).mem_nhds (lt_tsub_iff_right.1 hεs)) h_meas (ih s hs).left (by fun_prop) |
| 82 | (ae_restrict_of_forall_mem measurableSet_Ioi h_dom) h_bound_int |
| 83 | (.of_forall fun v z _ ↦ h_diff v z) |
| 84 | have h_eq : iteratedDeriv k Φ =ᶠ[𝓝 s] fun z : ℂ ↦ ∫ v in Ioi 0, G z v := |
| 85 | .mono h_nhds fun z hz ↦ (ih z hz).right |
| 86 | have h_succ (v : ℝ) : (-v : ℂ) ^ (k + 1) * R v * cexp ((1 - s) * v) = -v * G s v := by |
| 87 | simp [G, pow_succ', mul_assoc] |
| 88 | simp only [h_succ, iteratedDeriv_succ] |
| 89 | exact ⟨h_int, (h_deriv.congr_of_eventuallyEq h_eq).deriv⟩ |
| 90 | |
| 91 | variable {R : ℝ → ℝ} {F Φ : ℂ → ℂ} {C L : ℝ} |
| 92 | |
| 93 | /-- Cauchy's estimate for the derivatives of the slope `(F s - F 1) / (s - 1)`, written |
| 94 | `dslope F 1`, at `1 + H`: if `F` is holomorphic and at most `M` in norm on the disc of radius |
| 95 | `H + η` about `1 + H`, the `k`-th one is at most `k! (2 M / η) / (H + η) ^ k`. Indeed |
| 96 | `|s - 1| ≥ η` on the boundary of the disc. -/ |
| 97 | lemma norm_iteratedDeriv_dslope_le {H η M : ℝ} (hH : 0 ≤ H) (hη : 0 < η) |
| 98 | (hF : ∀ s ∈ closedBall (1 + H : ℂ) (H + η), DifferentiableAt ℂ F s ∧ ‖F s‖ ≤ M) (k : ℕ) : |
| 99 | ‖iteratedDeriv k (dslope F 1) (1 + H)‖ ≤ k ! * (2 * M / η) / (H + η) ^ k := by |
| 100 | have h_one : (1 : ℂ) ∈ ball (1 + H : ℂ) (H + η) := by |
| 101 | simp [dist_eq_norm, abs_of_nonneg hH, hη] |
| 102 | have h_nhds : closedBall (1 + H : ℂ) (H + η) ∈ 𝓝 1 := |
| 103 | mem_of_superset (isOpen_ball.mem_nhds h_one) ball_subset_closedBall |
| 104 | have h_diff : DifferentiableOn ℂ (dslope F 1) (closedBall (1 + H) (H + η)) := |
| 105 | (differentiableOn_dslope h_nhds).2 fun s hs ↦ (hF s hs).left.differentiableWithinAt |
| 106 | refine norm_iteratedDeriv_le_of_forall_mem_sphere_norm_le k (by positivity) |
| 107 | (h_diff.diffContOnCl_ball le_rfl) fun s hs ↦ ?_ |
| 108 | have h_centre : dist (1 : ℂ) (1 + H) = H := by simp [dist_eq_norm, hH] |
| 109 | have h_far : η ≤ ‖s - 1‖ := by |
| 110 | linarith [dist_triangle s 1 (1 + H), mem_sphere.1 hs, dist_eq_norm s 1] |
| 111 | rw [le_div_iff₀' hη] |
| 112 | calc η * ‖dslope F 1 s‖ ≤ ‖(s - 1) • dslope F 1 s‖ := by grw [norm_smul, h_far] |
| 113 | _ = ‖F s - F 1‖ := by rw [sub_smul_dslope] |
| 114 | _ ≤ ‖F s‖ + ‖F 1‖ := norm_sub_le _ _ |
| 115 | _ ≤ 2 * M := by |
| 116 | linarith [(hF s (sphere_subset_closedBall hs)).right, |
| 117 | (hF 1 (ball_subset_closedBall h_one)).right] |
| 118 | |
| 119 | /-- The normalised Taylor coefficient `(-H) ^ k H / k! · g⁽ᵏ⁾(1 + H)` of the slope `g = dslope F 1`, |
| 120 | that is `(F s - F 1) / (s - 1)`, is at most `4 M H / η · exp (-(k + 1) η / (2 H))` in norm if `F` |
| 121 | is holomorphic and at most `M` in norm on the disc about `1 + H` that reaches to `1 - η`, with |
| 122 | `0 < η ≤ H`. The exponential bounds the gain `(H / (H + η)) ^ (k + 1)`. -/ |
| 123 | lemma norm_taylorCoeff_dslope_le {H η M : ℝ} (hη : 0 < η) (hηH : η ≤ H) |
| 124 | (hF : ∀ s ∈ closedBall (1 + H : ℂ) (H + η), DifferentiableAt ℂ F s ∧ ‖F s‖ ≤ M) (k : ℕ) : |
| 125 | ‖(-H) ^ k * H / k ! * iteratedDeriv k (dslope F 1) (1 + H)‖ ≤ |
| 126 | 4 * M * H / η * rexp (-((k + 1) * (η / (2 * H)))) := by |
| 127 | have hH : 0 < H := hη.trans_le hηH |
| 128 | have hM : 0 ≤ M := (norm_nonneg _).trans (hF _ (mem_closedBall_self (by positivity))).right |
| 129 | have h_ratio : H / (H + η) ≤ rexp (-(η / (2 * H))) := |
| 130 | calc H / (H + η) = 1 - η / (H + η) := by field |
| 131 | _ ≤ 1 - η / (2 * H) := by |
| 132 | gcongr |
| 133 | linarith |
| 134 | _ ≤ rexp (-(η / (2 * H))) := Real.one_sub_le_exp_neg _ |
| 135 | calc ‖(-H) ^ k * H / k ! * iteratedDeriv k (dslope F 1) (1 + H)‖ |
| 136 | = H ^ k * H / k ! * ‖iteratedDeriv k (dslope F 1) (1 + H)‖ := by simp [abs_of_pos hH] |
| 137 | _ ≤ H ^ k * H / k ! * (k ! * (2 * M / η) / (H + η) ^ k) := by |
| 138 | gcongr |
| 139 | exact norm_iteratedDeriv_dslope_le hH.le hη hF k |
| 140 | _ = 2 * M / η * (H + η) * (H / (H + η)) ^ (k + 1) := by |
| 141 | rw [div_pow] |
| 142 | field |
| 143 | _ ≤ 2 * M / η * (H + H) * rexp (-(η / (2 * H))) ^ (k + 1) := by gcongr |
| 144 | _ = 4 * M * H / η * rexp (-((k + 1) * (η / (2 * H)))) := by |
| 145 | rw [← Real.exp_natCast_mul, Nat.cast_succ] |
| 146 | ring_nf |
| 147 | |
| 148 | /-- If `|R v - R u| ≤ L (v - u)` for all steps `0 ≤ u ≤ v ≤ u + 1`, then `R` is Lipschitz with |
| 149 | constant `L` on `[0, ∞)`. -/ |
| 150 | lemma abs_sub_le_of_unit_steps |
| 151 | (h_step_le : ∀ u v : ℝ, 0 ≤ u → u ≤ v → v ≤ u + 1 → |R v - R u| ≤ L * (v - u)) {u v : ℝ} |
| 152 | (hu : 0 ≤ u) (hv : 0 ≤ v) : |R v - R u| ≤ L * |v - u| := by |
| 153 | have hL : 0 ≤ L := by |
| 154 | simpa using (abs_nonneg _).trans (h_step_le 0 1 le_rfl zero_le_one (by simp)) |
| 155 | have h_lip : LipschitzOnWith (NNReal.mk L hL) R (Ici (0 : ℝ)) := by |
| 156 | refine (convex_Ici _).lipschitzOnWith_of_locally_dist_le fun x hx ↦ ?_ |
| 157 | filter_upwards [mem_nhdsWithin_of_mem_nhds (Metric.ball_mem_nhds x zero_lt_one), |
| 158 | self_mem_nhdsWithin] with y hy hy0 |
| 159 | simp only [Metric.mem_ball, Real.dist_eq, abs_lt] at hy |
| 160 | rw [Real.dist_eq, Real.dist_eq, NNReal.coe_mk] |
| 161 | rcases le_total x y with hxy | hyx |
| 162 | · rw [abs_of_nonneg (sub_nonneg.mpr hxy)] |
| 163 | exact h_step_le x y hx hxy (by linarith [hy.2]) |
| 164 | · rw [abs_sub_comm (R y), abs_sub_comm y, abs_of_nonneg (sub_nonneg.mpr hyx)] |
| 165 | exact h_step_le y x hy0 hyx (by linarith [hy.1]) |
| 166 | simpa only [Real.dist_eq, NNReal.coe_mk] using h_lip.dist_le_mul v hv u hu |
| 167 | |
| 168 | /-- The mean absolute deviation is at most the standard deviation. -/ |
| 169 | private lemma integral_abs_sub_mean_le_stdDev {Ω : Type*} [MeasurableSpace Ω] |
| 170 | (μ : Measure Ω) [IsProbabilityMeasure μ] {X : Ω → ℝ} (hX : MemLp X 2 μ) : |
| 171 | (∫ x, |X x - ∫ t, X t ∂μ| ∂μ) ≤ √(variance X μ) := by |
| 172 | let Y := fun x ↦ X x - ∫ t, X t ∂μ |
| 173 | have hY : MemLp Y 2 μ := hX.sub (memLp_const _) |
| 174 | have h := variance_nonneg (fun x ↦ ‖Y x‖) μ |
| 175 | rw [variance_eq_sub hY.norm] at h |
| 176 | apply Real.le_sqrt_of_sq_le |
| 177 | rw [variance_eq_integral hX.aemeasurable] |
| 178 | simpa [Y, Real.norm_eq_abs] using sub_nonneg.mp h |
| 179 | |
| 180 | /-- Suppose `Φ s = ∫₀^∞ R(v) e^{(1 - s) v} dv` for `re s > 2`, where `R` is measurable and |
| 181 | `|R(v)| ≤ C e^v` for `v ≥ 0`. For `H > 1`, the coefficient `(-H)^k H Φ⁽ᵏ⁾(1 + H) / k!` is |
| 182 | the expectation of `R` under the Gamma law of shape `k + 1` and rate `H`. -/ |
| 183 | lemma taylorCoeff_transform_eq_integral_gammaMeasure {H : ℝ} (hR : Measurable R) |
| 184 | (R_le : ∀ v : ℝ, 0 ≤ v → |R v| ≤ C * rexp v) |
| 185 | (Φ_eq : ∀ s : ℂ, 2 < s.re → Φ s = ∫ v in Ioi (0 : ℝ), R v * cexp ((1 - s) * v)) |
| 186 | (hH : 1 < H) (k : ℕ) : |
| 187 | (-H) ^ k * H / k ! * iteratedDeriv k Φ (1 + H) = |
| 188 | (∫ v, R v ∂gammaMeasure (k + 1) H : ℝ) := by |
| 189 | obtain ⟨_, h_deriv⟩ := iteratedDeriv_transform hR R_le Φ_eq k (1 + H) |
| 190 | (by simpa using (by linarith : 2 < 1 + H)) |
| 191 | rw [h_deriv, TauCeti.Probability.integral_gammaMeasure_eq_integral_Ioi |
| 192 | (by positivity) (by positivity), ← integral_complex_ofReal, ← integral_const_mul] |
| 193 | refine setIntegral_congr_fun measurableSet_Ioi fun v hv ↦ ?_ |
| 194 | rw [Real.Gamma_nat_eq_factorial, add_sub_cancel_right, Real.rpow_natCast, ← Nat.cast_succ, |
| 195 | Real.rpow_natCast, pow_succ] |
| 196 | simp only [smul_eq_mul, Complex.ofReal_mul, Complex.ofReal_div, Complex.ofReal_pow, |
| 197 | Complex.ofReal_natCast, Complex.ofReal_exp] |
| 198 | have hsign : (-(H : ℂ)) ^ k * (-(v : ℂ)) ^ k = (H : ℂ) ^ k * (v : ℂ) ^ k := by |
| 199 | simp [← mul_pow] |
| 200 | simp only [sub_add_cancel_left, Complex.ofReal_neg, Complex.ofReal_mul, neg_mul] |
| 201 | linear_combination (H / k ! * (R v : ℂ) * cexp (-(H * v : ℂ))) * hsign |
| 202 | |
| 203 | /-- Let `R` be measurable and `L`-Lipschitz on `[0, ∞)`, with transform |
| 204 | `Φ s = ∫₀^∞ R(v) e^{(1 - s) v} dv` for `re s > 2`. For `u > 0` and `H = (k + 1) / u > 1`, |
| 205 | `(-H)^k H Φ⁽ᵏ⁾(1 + H) / k!` differs from `R(u)` by at most `L u / √(k + 1)`, the Lipschitz |
| 206 | constant times the standard deviation of the Gamma law. -/ |
| 207 | lemma norm_taylorCoeff_transform_sub_le_of_lipschitz (hR : Measurable R) |
| 208 | (h_lip : ∀ x : ℝ, 0 ≤ x → ∀ y : ℝ, 0 ≤ y → |R y - R x| ≤ L * |y - x|) |
| 209 | (Φ_eq : ∀ s : ℂ, 2 < s.re → Φ s = ∫ v in Ioi (0 : ℝ), R v * cexp ((1 - s) * v)) |
| 210 | {u H : ℝ} {k : ℕ} (hu : 0 < u) (H_eq : H = (k + 1) / u) (hH : 1 < H) : |
| 211 | ‖(-H) ^ k * H / k ! * iteratedDeriv k Φ (1 + H) - R u‖ ≤ L * (u / √(k + 1)) := by |
| 212 | have hL : 0 ≤ L := by simpa using (abs_nonneg _).trans (h_lip 0 le_rfl 1 zero_le_one) |
| 213 | have R_le (v : ℝ) (hv : 0 ≤ v) : |R v| ≤ (|R 0| + L) * rexp v := by |
| 214 | have h_sub : |R v - R 0| ≤ L * v := by simpa [abs_of_nonneg hv] using h_lip 0 le_rfl v hv |
| 215 | nlinarith [abs_sub_abs_le_abs_sub (R v) (R 0), Real.add_one_le_exp v, abs_nonneg (R 0)] |
| 216 | let P := gammaMeasure ((k : ℝ) + 1) H |
| 217 | have hshape : 0 < (k : ℝ) + 1 := by positivity |
| 218 | have hrate : 0 < H := one_pos.trans hH |
| 219 | let _ : IsProbabilityMeasure P := isProbabilityMeasure_gammaMeasure hshape hrate |
| 220 | have hX : MemLp id 2 P := TauCeti.Probability.memLp_id_gammaMeasure hshape hrate |
| 221 | have hmean : ∫ v, v ∂P = u := by |
| 222 | rw [TauCeti.Probability.integral_id_gammaMeasure hshape hrate, H_eq, |
| 223 | div_div_cancel₀ (by positivity)] |
| 224 | have hvar : variance id P = (u / √(k + 1 : ℝ)) ^ 2 := by |
| 225 | rw [TauCeti.Probability.variance_id_gammaMeasure hshape hrate, H_eq] |
| 226 | simp only [div_pow, Real.sq_sqrt (by positivity : 0 ≤ (k : ℝ) + 1)] |
| 227 | field |
| 228 | have habs : Integrable (fun v ↦ L * |v - u|) P := by |
| 229 | simpa [Real.norm_eq_abs] using |
| 230 | ((hX.sub (memLp_const u)).norm.integrable (by norm_num)).const_mul L |
| 231 | have hbound : ∀ᵐ v ∂P, ‖R v - R u‖ ≤ L * |v - u| := by |
| 232 | filter_upwards [TauCeti.Probability.ae_pos_gammaMeasure (k + 1) H] with v hv |
| 233 | exact h_lip u hu.le v hv.le |
| 234 | have hsub := habs.mono' (show AEStronglyMeasurable (fun v ↦ R v - R u) P by fun_prop) hbound |
| 235 | -- Center the integrand before applying the Lipschitz bound. |
| 236 | have hcent := integral_add hsub (integrable_const (R u)) |
| 237 | simp only [sub_add_cancel, integral_const, probReal_univ, one_smul] at hcent |
| 238 | rw [taylorCoeff_transform_eq_integral_gammaMeasure hR R_le Φ_eq hH k, ← ofReal_sub, norm_real] |
| 239 | change ‖(∫ v, R v ∂P) - R u‖ ≤ _ |
| 240 | rw [sub_eq_of_eq_add hcent] |
| 241 | calc ‖∫ v, R v - R u ∂P‖ ≤ ∫ v, L * |v - u| ∂P := norm_integral_le_of_norm_le habs hbound |
| 242 | _ ≤ L * (u / √(k + 1)) := by |
| 243 | rw [integral_const_mul] |
| 244 | gcongr |
| 245 | simpa [id_eq, hmean, hvar, Real.sqrt_sq (by positivity : 0 ≤ u / √(k + 1 : ℝ))] |
| 246 | using integral_abs_sub_mean_le_stdDev P hX |
| 247 | |
| 248 | /-- For large `u` an even power of `c log u` is at most `u`, and a power of `u` is at most |
| 249 | `exp (√u / 2)`. -/ |
| 250 | lemma eventually_log_pow_le_and_pow_le_exp_sqrt (c : ℝ) (A j : ℕ) : ∀ᶠ u : ℝ in atTop, |
| 251 | (c * u.log) ^ (2 * A) ≤ u ∧ u ^ j ≤ rexp (√u / 2) := by |
| 252 | have h_log : (fun u : ℝ ↦ (c * u.log) ^ (2 * A)) =o[atTop] id := by |
| 253 | simpa [mul_pow] using |
| 254 | (Real.isLittleO_pow_log_id_atTop (n := 2 * A)).const_mul_left (c ^ (2 * A)) |
| 255 | have h_exp : ∀ᶠ t : ℝ in atTop, ‖t ^ (2 * j)‖ ≤ ‖rexp (2⁻¹ * t)‖ := |
| 256 | (isLittleO_pow_exp_pos_mul_atTop _ (by norm_num)).eventuallyLE |
| 257 | filter_upwards [h_log.eventuallyLE, Real.tendsto_sqrt_atTop.eventually h_exp, |
| 258 | eventually_ge_atTop 0] with u h_log_le h_exp_le hu |
| 259 | refine ⟨(le_abs_self _).trans (h_log_le.trans_eq (abs_of_nonneg hu)), ?_⟩ |
| 260 | simpa [pow_mul, Real.sq_sqrt hu, abs_of_nonneg hu, div_eq_inv_mul] using h_exp_le |
| 261 | |
| 262 | /-- Every point `s` of the disc of radius `H + η` about `1 + H` has `re s ≥ 1 - η` and |
| 263 | `|s| ≤ 2 H + η + 1`, for `H ≥ 0`. -/ |
| 264 | lemma one_sub_le_re_and_norm_le_of_mem_closedBall {H η : ℝ} (hH : 0 ≤ H) {s : ℂ} |
| 265 | (hs : s ∈ closedBall (1 + H : ℂ) (H + η)) : 1 - η ≤ s.re ∧ ‖s‖ ≤ 2 * H + η + 1 := by |
| 266 | rw [mem_closedBall_iff_norm] at hs |
| 267 | have h_re : |s.re - (1 + H)| ≤ H + η := by simpa using (abs_re_le_norm _).trans hs |
| 268 | have h_centre : ‖(1 + H : ℂ)‖ = 1 + H := mod_cast Real.norm_of_nonneg (by linarith) |
| 269 | exact ⟨by linarith [abs_le.1 h_re], by linarith [norm_le_norm_sub_add s (1 + H)]⟩ |
| 270 | |
| 271 | /-- Let `l ≥ 1`, let `H = (k + 1) / u > 1` with `4 H ≤ u ^ (2 B + 5)`, and let `F` be holomorphic |
| 272 | and at most `l ^ A` on the disc of radius `H + l ^ (-A)` about `1 + H`. If `l ^ (2 A) ≤ u` and |
| 273 | `u ^ (3 B + 7) ≤ exp (√u / 2)`, the normalised Taylor coefficient of `dslope F 1` at `1 + H` is at |
| 274 | most `u ^ (-(B + 1))`: the gain is `exp (-u / (2 l ^ A)) ≤ exp (-√u / 2)`. -/ |
| 275 | lemma norm_taylorCoeff_dslope_le_inv_pow {u l H : ℝ} {A B k : ℕ} (hu : 0 < u) (hl : 1 ≤ l) |
| 276 | (H_eq : H = (k + 1) / u) (hH : 1 < H) (hH_le : 4 * H ≤ u * u ^ (2 * B + 4)) |
| 277 | (h_pow : l ^ (2 * A) ≤ u) (h_exp : u ^ (3 * B + 7) ≤ rexp (√u / 2)) |
| 278 | (hF : ∀ s ∈ closedBall (1 + H : ℂ) (H + 1 / l ^ A), DifferentiableAt ℂ F s ∧ ‖F s‖ ≤ l ^ A) : |
| 279 | ‖(-H) ^ k * H / k ! * iteratedDeriv k (dslope F 1) (1 + H)‖ ≤ 1 / u ^ (B + 1) := by |
| 280 | have hη_le : 1 / l ^ A ≤ H := by grw [← one_le_pow₀ hl, ← hH, div_one] |
| 281 | have h_sqrt : l ^ A ≤ √u := Real.le_sqrt_of_sq_le (by rwa [← pow_mul, mul_comm]) |
| 282 | have h_gain : √u / 2 ≤ (k + 1) * (1 / l ^ A / (2 * H)) := |
| 283 | calc √u / 2 = u / √u / 2 := by rw [Real.div_sqrt] |
| 284 | _ ≤ u / l ^ A / 2 := by gcongr |
| 285 | _ = (k + 1) * (1 / l ^ A / (2 * H)) := by |
| 286 | rw [H_eq] |
| 287 | field |
| 288 | calc ‖(-H) ^ k * H / k ! * iteratedDeriv k (dslope F 1) (1 + H)‖ |
| 289 | ≤ 4 * l ^ A * H / (1 / l ^ A) * rexp (-((k + 1) * (1 / l ^ A / (2 * H)))) := |
| 290 | norm_taylorCoeff_dslope_le (by positivity) hη_le hF k |
| 291 | _ = l ^ (2 * A) * (4 * H) / rexp ((k + 1) * (1 / l ^ A / (2 * H))) := by |
| 292 | rw [Real.exp_neg] |
| 293 | field |
| 294 | _ ≤ u * (u * u ^ (2 * B + 4)) / u ^ (3 * B + 7) := by |
| 295 | grw [h_pow, hH_le, ← h_gain, ← h_exp] |
| 296 | _ = 1 / u ^ (B + 1) := by field |
| 297 | |
| 298 | /-- **Tauberian theorem.** Let `R` be measurable and Lipschitz on `v ≥ 0` (it suffices to test steps |
| 299 | of length at most `1`), with transform `∫₀^∞ R(v) e^{(1 - s) v} dv = (F s - F 1) / (s - 1)` in |
| 300 | `re s > 2`. Suppose that for all large `l` the function `F` is holomorphic and at most `l ^ A` on |
| 301 | `re s ≥ 1 - l ^ (-A)`, `|s| ≤ e ^ l`. Then `|R(u)| ≤ u ^ (-B)` for every `B` and all large `u`. -/ |
| 302 | theorem eventually_abs_le_inv_pow_of_transform (hR : Measurable R) |
| 303 | (h_lip : ∀ u v : ℝ, 0 ≤ u → u ≤ v → v ≤ u + 1 → |R v - R u| ≤ L * (v - u)) |
| 304 | (h_transform : ∀ s : ℂ, 2 < s.re → |
| 305 | (F s - F 1) / (s - 1) = ∫ v in Ioi (0 : ℝ), R v * cexp ((1 - s) * v)) {A : ℕ} |
| 306 | (hF : ∀ᶠ l : ℝ in atTop, ∀ s : ℂ, 1 - 1 / l ^ A ≤ s.re → ‖s‖ ≤ rexp l → |
| 307 | DifferentiableAt ℂ F s ∧ ‖F s‖ ≤ l ^ A) (B : ℕ) : |
| 308 | ∀ᶠ u : ℝ in atTop, |R u| ≤ 1 / u ^ B := by |
| 309 | have hL : 0 ≤ L := by simpa using (abs_nonneg _).trans (h_lip 0 1 le_rfl zero_le_one (by simp)) |
| 310 | have Φ_eq (s : ℂ) (hs : 2 < s.re) : |
| 311 | dslope F 1 s = ∫ v in Ioi (0 : ℝ), R v * cexp ((1 - s) * v) := by |
| 312 | have hs_ne : s ≠ 1 := fun h ↦ by norm_num [h] at hs |
| 313 | rw [← h_transform s hs, dslope_of_ne _ hs_ne, slope_def_field] |
| 314 | have h_log : Tendsto (fun u : ℝ ↦ (2 * B + 5 : ℕ) * u.log) atTop atTop := |
| 315 | Real.tendsto_log_atTop.const_mul_atTop (by positivity) |
| 316 | -- Compare `R u` with one normalised Taylor coefficient of `dslope F 1` at a point `1 + H`: the |
| 317 | -- two differ by `O(u ^ (-(B + 1)))`, and Cauchy's estimate makes the coefficient as small. |
| 318 | filter_upwards [h_log.eventually hF, h_log.eventually_ge_atTop 1, eventually_ge_atTop (L + 8), |
| 319 | eventually_log_pow_le_and_pow_le_exp_sqrt (2 * B + 5 : ℕ) A (3 * B + 7)] |
| 320 | with u hF_region hl_one hu_large ⟨h_log_pow_le, h_pow_le_exp⟩ |
| 321 | -- Take `k + 1 ≈ u ^ (2 B + 4)` and `H = (k + 1) / u`, so that the Gamma density has mean `u` and |
| 322 | -- standard deviation `u / √(k + 1) ≤ u ^ (-(B + 1))`. With `l = (2 B + 5) log u` and |
| 323 | -- `η = l ^ (-A)` the disc of radius `H + η` about `1 + H` lies in the region of `hF_region`. |
| 324 | set l : ℝ := (2 * B + 5 : ℕ) * u.log with l_def |
| 325 | have hu_one : 1 ≤ u := by linarith |
| 326 | have hu_pos : 0 < u := one_pos.trans_le hu_one |
| 327 | let k : ℕ := ⌊u ^ (2 * B + 4)⌋₊ |
| 328 | have hk_ge : u ^ (2 * B + 4) ≤ k + 1 := (Nat.lt_floor_add_one _).le |
| 329 | have hk_le : (k : ℝ) ≤ u ^ (2 * B + 4) := Nat.floor_le (by positivity) |
| 330 | let H : ℝ := (k + 1) / u |
| 331 | have hH_gt : 1 < H := |
| 332 | (one_lt_div hu_pos).2 ((lt_self_pow₀ (by linarith) (by omega)).trans_le hk_ge) |
| 333 | have hH_le : H ≤ 2 * u ^ (2 * B + 4) := |
| 334 | (div_le_self (by positivity) hu_one).trans (by linarith [one_le_pow₀ hu_one (n := 2 * B + 4)]) |
| 335 | let η : ℝ := 1 / l ^ A |
| 336 | have hη_le : η ≤ 1 := (div_le_one (by positivity)).2 (one_le_pow₀ hl_one) |
| 337 | let coeff : ℂ := (-H) ^ k * H / k ! * iteratedDeriv k (dslope F 1) (1 + H) |
| 338 | -- As `u ≥ 8`, the factor `u` absorbs the numerical constants below. |
| 339 | have h_const_mul_le : 8 * u ^ (2 * B + 4) ≤ u * u ^ (2 * B + 4) := by nlinarith |
| 340 | have h_close : ‖coeff - R u‖ ≤ L / u ^ (B + 1) := by |
| 341 | refine (norm_taylorCoeff_transform_sub_le_of_lipschitz hR |
| 342 | (fun x hx y hy ↦ abs_sub_le_of_unit_steps h_lip hx hy) Φ_eq hu_pos rfl hH_gt).trans ?_ |
| 343 | grw [← hk_ge, show 2 * B + 4 = (B + 2) * 2 by omega, pow_mul, Real.sqrt_sq (by positivity)] |
| 344 | exact le_of_eq (by field) |
| 345 | have h_disc (s : ℂ) (hs : s ∈ closedBall (1 + H : ℂ) (H + η)) : |
| 346 | DifferentiableAt ℂ F s ∧ ‖F s‖ ≤ l ^ A := by |
| 347 | obtain ⟨h_re, h_norm⟩ := one_sub_le_re_and_norm_le_of_mem_closedBall (by positivity) hs |
| 348 | refine hF_region s h_re (h_norm.trans ?_) |
| 349 | rw [l_def, Real.exp_natCast_mul, Real.exp_log hu_pos, pow_succ'] |
| 350 | linarith |
| 351 | have h_small : ‖coeff‖ ≤ 1 / u ^ (B + 1) := |
| 352 | norm_taylorCoeff_dslope_le_inv_pow hu_pos hl_one rfl hH_gt (by linarith) h_log_pow_le |
| 353 | h_pow_le_exp h_disc |
| 354 | calc |R u| = ‖coeff - (coeff - R u)‖ := by simp |
| 355 | _ ≤ 1 / u ^ (B + 1) + L / u ^ (B + 1) := norm_sub_le_of_le h_small h_close |
| 356 | _ = (1 + L) / u / u ^ B := by field |
| 357 | _ ≤ 1 / u ^ B := by grw [(div_le_one hu_pos).2 (by linarith : 1 + L ≤ u)] |
| 358 | |
| 359 | end New |