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.CStarAlgebra.Classes |
| 4 | import TauCeti.Analysis.SpecialFunctions.Pow.Bounds |
| 5 | public import Mathlib.NumberTheory.LSeries.DirichletContinuation |
| 6 | import Mathlib.Algebra.Order.Star.Real |
| 7 | import Mathlib.Analysis.Complex.HalfPlane |
| 8 | import Mathlib.Analysis.Real.Pi.Bounds |
| 9 | import TauCeti.Analysis.Complex.HalfPlaneIdentity |
| 10 | import Mathlib.NumberTheory.LSeries.Nonvanishing |
| 11 | import Mathlib.NumberTheory.MulChar.Lemmas |
| 12 | import Mathlib.RingTheory.PiTensorProduct |
| 13 | import Mathlib.RingTheory.SimpleRing.Principal |
| 14 | import Mathlib.Topology.Separation.CompletelyRegular |
| 15 | public import Lib.Speed |
| 16 | |
| 17 | /-! |
| 18 | # Theta series of Dirichlet characters, Poisson summation, and `L(s, χ)` as a Mellin transform |
| 19 | |
| 20 | For a parity `j ∈ {0, 1}`, the weight `w(z) = z ^ j e^(-π z²)` and coefficients `c(n)`, this file |
| 21 | studies the theta series `θ(u) = u ^ (1/2) ∑_{n ≥ 1} c(n) w(n u)`. It bounds `θ` and expresses its |
| 22 | Mellin transform through the Dirichlet series of `c`. For a Dirichlet character `χ ≠ 1` of parity |
| 23 | `j`, Poisson summation bounds the series near `0` and so gives the formula for `L(s, χ)` in |
| 24 | `re s > 0` (`hasMellin_thetaSeries_char`); if `χ` is also primitive, it gives the transformation |
| 25 | formula of `|θ|` (`norm_thetaSeries_inv`). |
| 26 | |
| 27 | ## Relation to the literature |
| 28 | |
| 29 | Known result: the transformation formula and the Mellin transform of the theta series of a Dirichlet |
| 30 | character. Sources: Davenport, Multiplicative Number Theory; Montgomery–Vaughan, Multiplicative |
| 31 | Number Theory I, ch. 10. Form here: the transformation is proved in absolute value only, so no root |
| 32 | number appears. |
| 33 | -/ |
| 34 | |
| 35 | @[expose] public section |
| 36 | |
| 37 | noncomputable section |
| 38 | |
| 39 | open Complex MeasureTheory Set Real ZMod HurwitzZeta Filter ArithmeticFunction Moebius |
| 40 | |
| 41 | namespace New |
| 42 | |
| 43 | /-- The weight `w(z) = z ^ j e^(-π z²)` of parity `j ∈ {0, 1}`. -/ |
| 44 | def gaussianMonomial (j : Fin 2) (z : ℝ) : ℝ := z ^ j.val * rexp (-π * z ^ 2) |
| 45 | |
| 46 | /-- The series `∑_{n ≥ 1} c(n) w(n u)`. -/ |
| 47 | def gaussianTheta (j : Fin 2) (c : ℕ → ℂ) (u : ℝ) : ℂ := |
| 48 | ∑' n : ℕ+, c n * gaussianMonomial j (n * u) |
| 49 | |
| 50 | /-- The theta series `θ(u) = u ^ (1/2) ∑_{n ≥ 1} c(n) w(n u)`. -/ |
| 51 | def thetaSeries (j : Fin 2) (c : ℕ → ℂ) (u : ℝ) : ℂ := √u * gaussianTheta j c u |
| 52 | |
| 53 | /-- The Mellin transform `Γ_j(s) = ∫_0^∞ w(z) z ^ s dz / z` of the weight `w`. -/ |
| 54 | def gaussianMellin (j : Fin 2) : ℂ → ℂ := mellin (gaussianMonomial j ·) |
| 55 | |
| 56 | variable {j : Fin 2} {c : ℕ → ℂ} {q : ℕ} {t : ℝ} {s : ℂ} [NeZero q] {χ : DirichletCharacter ℂ q} |
| 57 | |
| 58 | /-- The Gaussian theta function `gaussianTheta j c` is measurable. -/ |
| 59 | lemma measurable_gaussianTheta : Measurable (gaussianTheta j c) := by |
| 60 | fun_prop [gaussianTheta, gaussianMonomial] |
| 61 | |
| 62 | /-- The theta series `thetaSeries j c` is measurable. -/ |
| 63 | lemma measurable_thetaSeries : Measurable (thetaSeries j c) := |
| 64 | (measurable_ofReal.comp continuous_sqrt.measurable).mul measurable_gaussianTheta |
| 65 | |
| 66 | /-- If a measurable function `f` satisfies `‖f(t)‖ ≤ D e^(-t)` for `t > 0`, then at every `s` with |
| 67 | `re s > 0` the Mellin integral of `f` converges absolutely and `mellin f` is differentiable at |
| 68 | `s`. -/ |
| 69 | lemma mellinConvergent_and_differentiableAt {D : ℝ} {f : ℝ → ℂ} |
| 70 | (h_bound : ∀ t : ℝ, 0 < t → ‖f t‖ ≤ D * rexp (-t)) (h_meas : Measurable f) (hs : 0 < s.re) : |
| 71 | MellinConvergent f s ∧ DifferentiableAt ℂ (mellin f) s := by |
| 72 | -- `f` decays exponentially at `∞` and is bounded on `(0, ∞)`. |
| 73 | have h_bdd (x : ℝ) : ∀ᶠ t in nhdsWithin x (Ioi 0), ‖f t‖ ≤ |D| := |
| 74 | eventually_nhdsWithin_of_forall fun t (ht : 0 < t) ↦ by |
| 75 | grw [h_bound t ht, le_abs_self D, exp_le_one_iff.2 (neg_nonpos.2 ht.le), mul_one] |
| 76 | have h_top : f =O[atTop] fun t ↦ rexp (-1 * t) := |
| 77 | .of_bound D ((eventually_gt_atTop 0).mono fun t ht ↦ by simpa using h_bound t ht) |
| 78 | have h_zero : f =O[nhdsWithin 0 (Ioi 0)] fun t ↦ t ^ (-0 : ℝ) := |
| 79 | .of_bound |D| (by simpa using h_bdd 0) |
| 80 | have h_loc : LocallyIntegrableOn f (Ioi 0) := fun x _ ↦ (volume.finiteAt_nhdsWithin x _) |
| 81 | |>.integrableAtFilter h_meas.stronglyMeasurable.stronglyMeasurableAtFilter ⟨|D|, h_bdd x⟩ |
| 82 | exact ⟨mellinConvergent_of_isBigO_rpow_exp one_pos h_loc h_top h_zero hs, |
| 83 | mellin_differentiableAt_of_isBigO_rpow_exp one_pos h_loc h_top h_zero hs⟩ |
| 84 | |
| 85 | /-- If a measurable function `f` satisfies `‖f(t)‖ ≤ D e^(-t)` for `t > 0`, then its Mellin |
| 86 | transform is holomorphic in `re s > 0` and bounded on `1/2 ≤ re s ≤ 2`. -/ |
| 87 | lemma mellin_differentiableOn_and_bounded {D : ℝ} {f : ℝ → ℂ} |
| 88 | (h_bound : ∀ t : ℝ, 0 < t → ‖f t‖ ≤ D * rexp (-t)) (h_meas : Measurable f) : |
| 89 | DifferentiableOn ℂ (mellin f) {z : ℂ | 0 < z.re} ∧ |
| 90 | ∃ G : ℝ, ∀ z : ℂ, z.re ∈ Icc 2⁻¹ 2 → ‖mellin f z‖ ≤ G := by |
| 91 | -- In the strip the integrand is at most the sum of those at `z = 1/2` (which serves for |
| 92 | -- `t ≤ 1`) and at `z = 2` (for `t ≥ 1`). |
| 93 | obtain ⟨h_half, -⟩ := mellinConvergent_and_differentiableAt (s := 2⁻¹) h_bound h_meas (by simp) |
| 94 | obtain ⟨h_two, -⟩ := mellinConvergent_and_differentiableAt (s := 2) h_bound h_meas (by simp) |
| 95 | have h_integrand (z : ℂ) (hz : z.re ∈ Icc (2⁻¹ : ℝ) 2) (t : ℝ) (ht : 0 < t) : |
| 96 | ‖(t : ℂ) ^ (z - 1) • f t‖ ≤ |
| 97 | ‖(t : ℂ) ^ ((2⁻¹ : ℂ) - 1) • f t‖ + ‖(t : ℂ) ^ ((2 : ℂ) - 1) • f t‖ := by |
| 98 | simpa [norm_cpow_eq_rpow_re_of_pos ht, ← add_mul] using mul_le_mul_of_nonneg_right |
| 99 | (Real.rpow_le_rpow_add_rpow_of_mem_Icc ht ⟨sub_le_sub_right hz.1 1, sub_le_sub_right hz.2 1⟩) |
| 100 | (norm_nonneg (f t)) |
| 101 | exact ⟨fun z hz ↦ |
| 102 | (mellinConvergent_and_differentiableAt h_bound h_meas hz).2.differentiableWithinAt, |
| 103 | _, fun z hz ↦ norm_integral_le_of_norm_le (h_half.norm.add h_two.norm) |
| 104 | (ae_restrict_of_forall_mem measurableSet_Ioi (h_integrand z hz))⟩ |
| 105 | |
| 106 | /-- For `t ≥ 0` the weight `w(t) = t ^ j e^(-π t²)` satisfies `|w(t)| ≤ 3 e^(-2t)`. -/ |
| 107 | lemma norm_gaussianMonomial_le (ht : 0 ≤ t) : ‖gaussianMonomial j t‖ ≤ 3 * rexp (-t) ^ 2 := by |
| 108 | have h_pow : t ^ j.val ≤ rexp t := |
| 109 | calc t ^ j.val ≤ t + 1 := by fin_cases j <;> simp [ht] |
| 110 | _ ≤ rexp t := add_one_le_exp t |
| 111 | -- As `π > 3`, this follows from `3 t² - 3 t + 1 = 3 (t - 1/2)² + 1/4 ≥ 0`. |
| 112 | have h_exp : t + -π * t ^ 2 ≤ 1 + (-t + -t) := by |
| 113 | nlinarith only [pi_gt_three, sq_nonneg (t - 2⁻¹), sq_nonneg t] |
| 114 | calc ‖gaussianMonomial j t‖ = t ^ j.val * rexp (-π * t ^ 2) := by |
| 115 | simp [gaussianMonomial, abs_of_nonneg ht] |
| 116 | _ ≤ rexp t * rexp (-π * t ^ 2) := by gcongr |
| 117 | _ ≤ rexp (1 + (-t + -t)) := by grw [← Real.exp_add, h_exp] |
| 118 | _ = rexp 1 * rexp (-t) ^ 2 := by rw [Real.exp_add, Real.exp_add, sq] |
| 119 | _ ≤ 3 * rexp (-t) ^ 2 := by grw [exp_one_lt_three] |
| 120 | |
| 121 | /-- If `|c(n)| ≤ 1` and `t > 0`, the series `∑_{n ≥ 1} c(n) w(n t)`, with |
| 122 | `w(z) = z ^ j e^(-π z²)`, converges and is at most `3 e^(-t) / t` in absolute value. -/ |
| 123 | lemma summable_and_norm_gaussianTheta_le (hc : ∀ n : ℕ, ‖c n‖ ≤ 1) (ht : 0 < t) : |
| 124 | (Summable fun n : ℕ+ ↦ c n * gaussianMonomial j (n * t)) ∧ |
| 125 | ‖gaussianTheta j c t‖ ≤ 3 * rexp (-t) / t := by |
| 126 | -- By `norm_gaussianMonomial_le` the terms are bounded by those of the geometric series |
| 127 | -- `∑ 3 r ^ n`, `r = e^(-2t)`. |
| 128 | let r : ℝ := rexp (-t) ^ 2 |
| 129 | have hr : |r| < 1 := by simpa [r] using ht |
| 130 | have h_geom : HasSum (fun n : ℕ+ ↦ 3 * r ^ (n : ℕ)) (3 * r / (1 - r)) := |
| 131 | (hasSum_pnat_iff_hasSum_succ (f := fun n : ℕ ↦ 3 * r ^ n)).2 <| by |
| 132 | simpa only [pow_succ', mul_assoc, div_eq_mul_inv] using |
| 133 | (hasSum_geometric_of_abs_lt_one hr).mul_left (3 * r) |
| 134 | have h_term (n : ℕ+) : ‖c n * gaussianMonomial j (n * t)‖ ≤ 3 * r ^ (n : ℕ) := by |
| 135 | grw [norm_mul, hc, norm_real, norm_gaussianMonomial_le (by positivity)] |
| 136 | simp [r, ← Real.exp_natCast_mul, field] |
| 137 | -- As `t + 1 ≤ e^t`, we have `(t + e^(-t)) e^(-t) ≤ 1`. |
| 138 | have h_mul_exp_le : t * rexp (-t) ≤ 1 - r := by |
| 139 | nlinarith [add_one_le_exp t, exp_pos (-t), exp_le_one_iff.2 (neg_nonpos.2 ht.le), |
| 140 | show rexp t * rexp (-t) = 1 by simp [← Real.exp_add]] |
| 141 | refine ⟨h_geom.summable.of_norm_bounded h_term, (tsum_of_norm_bounded h_geom h_term).trans ?_⟩ |
| 142 | calc 3 * r / (1 - r) ≤ 3 * r / (t * rexp (-t)) := by gcongr |
| 143 | _ = 3 * rexp (-t) / t := by simp [r, field] |
| 144 | |
| 145 | /-- The absolute value of `θ(u) = u ^ (1/2) ∑_{n ≥ 1} c(n) w(n u)` is `u ^ (1/2)` times that of |
| 146 | the sum. -/ |
| 147 | lemma norm_thetaSeries (u : ℝ) : ‖thetaSeries j c u‖ = √u * ‖gaussianTheta j c u‖ := by |
| 148 | rw [thetaSeries, norm_mul, norm_real, norm_of_nonneg (sqrt_nonneg u)] |
| 149 | |
| 150 | /-- The trivial bound: if `|c(n)| ≤ 1` and `t > 0`, then the theta series |
| 151 | `θ(t) = t ^ (1/2) ∑_{n ≥ 1} c(n) w(n t)` is at most `3 t ^ (-1/2) e^(-t)` in absolute value. -/ |
| 152 | lemma norm_thetaSeries_le (hc : ∀ n : ℕ, ‖c n‖ ≤ 1) (ht : 0 < t) : |
| 153 | ‖thetaSeries j c t‖ ≤ 3 * rexp (-t) / √t := |
| 154 | calc ‖thetaSeries j c t‖ ≤ √t * (3 * rexp (-t) / t) := by |
| 155 | grw [norm_thetaSeries, (summable_and_norm_gaussianTheta_le hc ht).2] |
| 156 | _ = 3 * rexp (-t) * (√t / t) := by ring |
| 157 | _ = 3 * rexp (-t) / √t := by rw [sqrt_div_self', mul_one_div] |
| 158 | |
| 159 | /-- For `|c(n)| ≤ 1` and `r > 0` the integral `∫_r^∞ |θ(u)| du / u` converges, by the trivial bound |
| 160 | on `θ`. -/ |
| 161 | lemma integrableOn_norm_thetaSeries_div (hc : ∀ n : ℕ, ‖c n‖ ≤ 1) {r : ℝ} (hr : 0 < r) : |
| 162 | IntegrableOn (fun u : ℝ ↦ ‖thetaSeries j c u‖ / u) (Ioi r) := by |
| 163 | have h_majorant : IntegrableOn (fun u : ℝ ↦ 3 * rexp (-u) / √r / r) (Ioi r) := |
| 164 | (((integrableOn_exp_neg_Ioi r).const_mul 3).div_const √r).div_const r |
| 165 | have h_le (u : ℝ) (hu : r < u) : ‖‖thetaSeries j c u‖ / u‖ ≤ 3 * rexp (-u) / √r / r := by |
| 166 | have hu_pos : 0 < u := hr.trans hu |
| 167 | grw [norm_of_nonneg (by positivity), norm_thetaSeries_le hc hu_pos] |
| 168 | gcongr |
| 169 | exact h_majorant.mono' (measurable_thetaSeries.norm.div measurable_id).aestronglyMeasurable |
| 170 | (ae_restrict_of_forall_mem measurableSet_Ioi h_le) |
| 171 | |
| 172 | /-- For `t > 0` we have `t ^ (s - 1/2 - 1) θ(t) = t ^ (s - 1) ∑_{n ≥ 1} c(n) w(n t)`: the |
| 173 | integrands of the Mellin transforms of `θ` at `s - 1/2` and of the series at `s` agree. -/ |
| 174 | lemma cpow_smul_thetaSeries (s : ℂ) (ht : 0 < t) : |
| 175 | (t : ℂ) ^ (s - 2⁻¹ - 1) • thetaSeries j c t = (t : ℂ) ^ (s - 1) • gaussianTheta j c t := by |
| 176 | have h_sqrt : (√t : ℂ) = t ^ (2⁻¹ : ℂ) := by simp [sqrt_eq_rpow, ofReal_cpow ht.le] |
| 177 | rw [thetaSeries, h_sqrt, smul_eq_mul, smul_eq_mul, ← mul_assoc, |
| 178 | ← cpow_add _ _ (ofReal_ne_zero.2 ht.ne')] |
| 179 | ring_nf |
| 180 | |
| 181 | /-- The Mellin transform of `θ(u) = u ^ (1/2) ∑_{n ≥ 1} c(n) w(n u)` at `s - 1/2` is that of the sum |
| 182 | at `s`. -/ |
| 183 | lemma mellin_thetaSeries_sub_half (s : ℂ) : |
| 184 | mellin (thetaSeries j c) (s - 2⁻¹) = mellin (gaussianTheta j c) s := |
| 185 | setIntegral_congr_fun measurableSet_Ioi fun _ ht ↦ cpow_smul_thetaSeries s ht |
| 186 | |
| 187 | /-- By the substitution `u = t²`, the Mellin transform of `t ^ k F(t²)` at `s` is half that of |
| 188 | `F` at `(s + k) / 2`. -/ |
| 189 | lemma mellin_pow_mul_comp_sq (F : ℝ → ℂ) (k : ℕ) (s : ℂ) : |
| 190 | mellin (fun t : ℝ ↦ t ^ k * F (t ^ 2)) s = mellin F ((s + k) / 2) / 2 := by |
| 191 | trans mellin (fun t : ℝ ↦ F (t ^ 2)) (s + k) |
| 192 | · simpa using mellin_cpow_smul (fun t : ℝ ↦ F (t ^ 2)) s k |
| 193 | · simpa [field] using mellin_comp_rpow F (s + k) 2 |
| 194 | |
| 195 | /-- For `re s > 0` the Mellin transform `Γ_j` of `w(z) = z ^ j e^(-π z²)` is |
| 196 | `Γ_j(s) = π ^ (-(s + j) / 2) Γ((s + j) / 2) / 2`. -/ |
| 197 | lemma gaussianMellin_eq (hs : 0 < s.re) : gaussianMellin j s = Gammaℝ (s + j.val) / 2 := by |
| 198 | have h_re : 0 < ((s + j.val) / 2).re := by |
| 199 | simp only [div_ofNat_re, add_re, natCast_re] |
| 200 | positivity |
| 201 | simp only [gaussianMellin, gaussianMonomial, ofReal_mul, ofReal_pow] |
| 202 | rw [mellin_pow_mul_comp_sq (fun u : ℝ ↦ (rexp (-π * u) : ℂ)), Gammaℝ_def, neg_div] |
| 203 | congr 1 |
| 204 | simpa only [mellin, smul_eq_mul, ofReal_exp, ofReal_mul, ofReal_neg, neg_mul, one_div, cpow_neg, |
| 205 | inv_cpow _ _ (arg_ofReal_of_nonneg pi_pos.le ▸ pi_pos.ne)] using |
| 206 | integral_cpow_mul_exp_neg_mul_Ioi h_re pi_pos |
| 207 | |
| 208 | /-- Integration term by term: if `|c(n)| ≤ 1` and `re s > 1`, the Mellin transform of |
| 209 | `∑_{n ≥ 1} c(n) w(n u)` at `s` is `Γ_j(s) L(s, c)`, where `Γ_j` is the Mellin transform of the |
| 210 | weight `w(z) = z ^ j e^(-π z²)`. -/ |
| 211 | lemma mellin_gaussianTheta (hc : ∀ n : ℕ, ‖c n‖ ≤ 1) (hs : 1 < s.re) : |
| 212 | mellin (gaussianTheta j c) s = gaussianMellin j s * LSeries c s := by |
| 213 | -- `gaussianTheta j c t = t ^ j F(t²)` with `F(u) = ∑ a(n) e^(-π n² u)`, `a(n) = c(n) n ^ j`, and |
| 214 | -- the Mellin transform of `F` may be taken term by term. |
| 215 | let a (n : ℕ+) : ℂ := c n * n ^ j.val |
| 216 | let F (u : ℝ) : ℂ := ∑' n : ℕ+, a n * rexp (-π * n ^ 2 * u) |
| 217 | have h_theta : gaussianTheta j c = fun t : ℝ ↦ t ^ j.val * F (t ^ 2) := funext fun t ↦ by |
| 218 | simp [gaussianTheta, gaussianMonomial, F, a, ← tsum_mul_left, mul_pow, mul_assoc, mul_left_comm] |
| 219 | have h_series (u : ℝ) (hu : 0 < u) : Summable fun n : ℕ+ ↦ a n * rexp (-π * n ^ 2 * u) := |
| 220 | ((summable_and_norm_gaussianTheta_le (j := j) hc (sqrt_pos.2 hu)).1.div_const |
| 221 | (√u ^ j.val)).congr fun n ↦ by |
| 222 | have h_sqrt : (√u : ℂ) ≠ 0 := ofReal_ne_zero.2 (sqrt_pos.2 hu).ne' |
| 223 | simp [a, gaussianMonomial, mul_pow, mul_assoc, hu.le, field] |
| 224 | have h_coeff : Summable fun n : ℕ+ ↦ ‖a n‖ / |(n : ℝ)| ^ (s + j.val).re := |
| 225 | (summable_pnat_iff_summable_nat.2 (summable_nat_rpow_inv.2 hs)).of_nonneg_of_le |
| 226 | (fun _ ↦ by positivity) fun n ↦ by simp [a, rpow_add, field, hc] |
| 227 | have h_re : 0 < (s + j.val).re := by simpa using (one_pos.trans hs).trans_le (by simp) |
| 228 | have h_mellin : HasSum (fun n : ℕ+ ↦ Gammaℝ (s + j.val) * a n / |(n : ℝ)| ^ (s + j.val)) |
| 229 | (mellin F ((s + j.val) / 2)) := |
| 230 | hasSum_mellin_pi_mul_sq h_re (fun u hu ↦ by simpa [F] using (h_series u hu).hasSum) h_coeff |
| 231 | have h_term (n : ℕ+) : Gammaℝ (s + j.val) * a n / |(n : ℝ)| ^ (s + j.val) / 2 = |
| 232 | gaussianMellin j s * LSeries.term c s n := by |
| 233 | simp [gaussianMellin_eq (one_pos.trans hs), a, cpow_add, field] |
| 234 | calc mellin (gaussianTheta j c) s = mellin F ((s + j.val) / 2) / 2 := by |
| 235 | rw [h_theta, mellin_pow_mul_comp_sq] |
| 236 | _ = ∑' n : ℕ+, gaussianMellin j s * LSeries.term c s n := by |
| 237 | rw [← h_mellin.tsum_eq, ← tsum_div_const, tsum_congr h_term] |
| 238 | _ = gaussianMellin j s * LSeries c s := by |
| 239 | rw [tsum_mul_left, tsum_pnat_eq_tsum_of_eq_zero (LSeries.term_zero c s), LSeries] |
| 240 | |
| 241 | /-- Riemann's formula `∫_0^∞ θ(u) u ^ (s - 1/2) du / u = Γ_j(s) L(s, c)` for `re s > 1` and |
| 242 | `|c(n)| ≤ 1`, where `θ` is the theta series of `c` and `Γ_j` the Mellin transform of its weight |
| 243 | `w(z) = z ^ j e^(-π z²)`. -/ |
| 244 | lemma mellin_thetaSeries (hc : ∀ n : ℕ, ‖c n‖ ≤ 1) (hs : 1 < s.re) : |
| 245 | mellin (thetaSeries j c) (s - 2⁻¹) = gaussianMellin j s * LSeries c s := by |
| 246 | rw [mellin_thetaSeries_sub_half, mellin_gaussianTheta hc hs] |
| 247 | |
| 248 | /-- If `|c(n)| ≤ 1` for all `n`, then also `|c(n) μ(n)| ≤ 1`, where `μ` is the Möbius function. -/ |
| 249 | lemma norm_mul_moebius_le_one (hc : ∀ n : ℕ, ‖c n‖ ≤ 1) (n : ℕ) : ‖c n * μ n‖ ≤ 1 := by |
| 250 | grw [norm_mul, hc, one_mul, Complex.norm_intCast, ← Int.cast_abs, abs_moebius_le_one, |
| 251 | Int.cast_one] |
| 252 | |
| 253 | omit [NeZero q] in |
| 254 | /-- If `Φ : ZMod q → ℂ` has parity `j` and vanishes at `0`, then the sum of `Φ(n) w(n t)` over `ℤ`, |
| 255 | where `w(z) = z ^ j e^(-π z²)`, is twice the sum over `n ≥ 1` that defines `gaussianTheta`. -/ |
| 256 | lemma two_mul_gaussianTheta (t : ℝ) {Φ : ZMod q → ℂ} {S : ℂ} |
| 257 | (h_parity : ∀ x : ZMod q, Φ (-x) = (-1) ^ j.val * Φ x) (h_zero : Φ 0 = 0) |
| 258 | (h_sum : HasSum (fun n : ℤ ↦ Φ n * gaussianMonomial j (n * t)) S) : |
| 259 | 2 * gaussianTheta j (fun n : ℕ ↦ Φ n) t = S := by |
| 260 | -- The terms are even in `n` and the one at `n = 0` vanishes. |
| 261 | have h_even : Function.Even fun n : ℤ ↦ Φ n * gaussianMonomial j (n * t) := by |
| 262 | fin_cases j <;> simp [Function.Even, gaussianMonomial, h_parity] |
| 263 | rw [← h_sum.tsum_eq, tsum_int_eq_zero_add_two_mul_tsum_pnat h_even h_sum.summable] |
| 264 | simp [gaussianTheta, h_zero] |
| 265 | |
| 266 | /-- Poisson summation for `w(z) = z ^ j e^(-π z²)`: for `t > 0` and real `a`, |
| 267 | `∑_{n ∈ ℤ} e^(2πi a n) w(n / t) = i ^ j t ∑_{n ∈ ℤ} w((n + a) t)`, both series being convergent. -/ |
| 268 | lemma poisson_summation_gaussianMonomial (a : ℝ) (ht : 0 < t) : ∃ S : ℝ, |
| 269 | HasSum (fun n : ℤ ↦ gaussianMonomial j ((n + a) * t)) S ∧ |
| 270 | HasSum (fun n : ℤ ↦ cexp (2 * π * I * a * n) * gaussianMonomial j (n * t⁻¹)) |
| 271 | (I ^ j.val * t * S) := by |
| 272 | -- Up to a factor when `j = 1`, the two sums are the theta kernels of Mathlib at `t²` and |
| 273 | -- `1 / t²`, and the functional equations of these kernels compare them. |
| 274 | have h_sq : 0 < t ^ 2 := by positivity |
| 275 | fin_cases j |
| 276 | · have h_fe : (cosKernel a (t ^ 2)⁻¹ : ℂ) = t * evenKernel a (t ^ 2) := by |
| 277 | simp [evenKernel_functional_equation, ← rpow_natCast_mul ht.le, ht.ne'] |
| 278 | refine ⟨evenKernel a (t ^ 2), (hasSum_int_evenKernel a h_sq).congr_fun fun n ↦ ?_, ?_⟩ |
| 279 | · simp [gaussianMonomial, mul_pow, mul_assoc] |
| 280 | · simpa [gaussianMonomial, mul_pow, mul_assoc, h_fe] using |
| 281 | hasSum_int_cosKernel a (inv_pos.2 h_sq) |
| 282 | · have h_fe : I / t * sinKernel a (t ^ 2)⁻¹ = I * t * (t * oddKernel a (t ^ 2)) := by |
| 283 | simp [oddKernel_functional_equation, ← rpow_natCast_mul ht.le, field, mul_div_cancel₀] |
| 284 | refine ⟨t * oddKernel a (t ^ 2), |
| 285 | ((hasSum_int_oddKernel a h_sq).mul_left t).congr_fun fun n ↦ ?_, ?_⟩ |
| 286 | · simp [gaussianMonomial, mul_pow, field] |
| 287 | · -- Termwise `(I / t) (-I n) = n / t`, the factor in front of the Gaussian in `w(n / t)`. |
| 288 | have h_dual := (hasSum_int_sinKernel a (inv_pos.2 h_sq)).mul_left (I / t) |
| 289 | rw [h_fe] at h_dual |
| 290 | simpa using h_dual.congr_fun fun n ↦ by simp [gaussianMonomial, mul_pow, mul_assoc, field] |
| 291 | |
| 292 | /-- The Mellin transform `Γ_j` of the weight `w(z) = z ^ j e^(-π z²)` is holomorphic in |
| 293 | `re s > 0` and bounded on `1/2 ≤ re s ≤ 2`. -/ |
| 294 | lemma gaussianMellin_differentiableOn_and_bdd : |
| 295 | DifferentiableOn ℂ (gaussianMellin j) {z : ℂ | 0 < z.re} ∧ |
| 296 | ∃ G : ℝ, ∀ z : ℂ, z.re ∈ Icc 2⁻¹ 2 → ‖gaussianMellin j z‖ ≤ G := by |
| 297 | have h_bound (t : ℝ) (ht : 0 < t) : ‖(gaussianMonomial j t : ℂ)‖ ≤ 3 * rexp (-t) := by |
| 298 | grw [norm_real, norm_gaussianMonomial_le ht.le, |
| 299 | pow_le_of_le_one (exp_nonneg _) (exp_le_one_iff.2 (neg_nonpos.2 ht.le)) two_ne_zero] |
| 300 | exact mellin_differentiableOn_and_bounded h_bound (by fun_prop [gaussianMonomial]) |
| 301 | |
| 302 | /-- On a compact subset `K` of the half plane `re s > 0` the Mellin transform `Γ_j` of |
| 303 | `w(z) = z ^ j e^(-π z²)` is bounded away from zero in absolute value. -/ |
| 304 | lemma exists_pos_le_norm_gaussianMellin {K : Set ℂ} (hK : IsCompact K) |
| 305 | (h_re : ∀ s ∈ K, 0 < s.re) : ∃ c > (0 : ℝ), ∀ s ∈ K, c ≤ ‖gaussianMellin j s‖ := by |
| 306 | -- `Γ_j` is continuous, and has no zero as `Gammaℝ` has none. |
| 307 | refine hK.exists_forall_le' |
| 308 | (gaussianMellin_differentiableOn_and_bdd.1.continuousOn.mono h_re).norm fun s hs ↦ ?_ |
| 309 | have h_re_add : 0 < (s + j.val).re := by simpa using (h_re s hs).trans_le (by simp) |
| 310 | simp [gaussianMellin_eq (h_re s hs), Gammaℝ_ne_zero_of_re_pos h_re_add] |
| 311 | |
| 312 | /-- A sum over `ℤ` may be taken class by class modulo `q`: if `∑_m w((m + a / q) q t) = S a` for |
| 313 | every class `a`, where `w` is `gaussianMonomial j`, then `∑_n Φ(n) w(n t) = ∑_a Φ(a) S a`. -/ |
| 314 | lemma hasSum_mul_gaussianMonomial_of_classes (Φ : ZMod q → ℂ) {S : ZMod q → ℝ} |
| 315 | (h_class : ∀ a : ZMod q, |
| 316 | HasSum (fun m : ℤ ↦ gaussianMonomial j ((m + a.val / q) * (q * t))) (S a)) : |
| 317 | HasSum (fun n : ℤ ↦ Φ n * gaussianMonomial j (n * t)) (∑ a : ZMod q, Φ a * S a) := by |
| 318 | have h_range (a : ZMod q) : HasSum |
| 319 | (fun n : ℤ ↦ if n = a then Φ n * gaussianMonomial j (n * t) else 0) (Φ a * S a) := by |
| 320 | -- The class of `a` is the range of `m ↦ a + q m`. |
| 321 | have h_inj : (fun m : ℤ ↦ ZMod.cast a + q * m).Injective := fun _ _ ↦ by simp [NeZero.ne q] |
| 322 | have h_outside (n : ℤ) (hn : n ∉ range fun m : ℤ ↦ ZMod.cast a + q * m) : |
| 323 | (if n = a then Φ n * gaussianMonomial j (n * t) else 0 : ℂ) = 0 := by |
| 324 | simp_all [intCast_eq_iff, ne_comm] |
| 325 | refine (h_inj.hasSum_iff h_outside).1 |
| 326 | (((hasSum_ofReal.2 (h_class a)).mul_left (Φ a)).congr_fun fun m ↦ ?_) |
| 327 | have h_mod : ((ZMod.cast a + q * m : ℤ) : ZMod q) = a := by simp [natCast_self] |
| 328 | have h_arg : ((ZMod.cast a + q * m : ℤ) : ℝ) * t = (m + a.val / q) * (q * t) := by |
| 329 | have hq : (q : ℝ) ≠ 0 := NeZero.ne _ |
| 330 | simp [field]; ring |
| 331 | rw [Function.comp_apply, ite_eq_left h_mod, h_mod, h_arg] |
| 332 | simpa using hasSum_sum fun (a : ZMod q) (_ : a ∈ Finset.univ) ↦ h_range a |
| 333 | |
| 334 | /-- If `∑_n e^(2πi a n / q) w(n / (q t)) = i ^ j q t S a` for every class `a` modulo `q`, where `w` |
| 335 | is `gaussianMonomial j`, then `∑_n 𝓕⁻ Φ(n) w(n / (q t)) = i ^ j t ∑_a Φ(a) S a`, as |
| 336 | `𝓕⁻ Φ(n) = q⁻¹ ∑_a Φ(a) e^(2πi a n / q)`. Here `n` runs over `ℤ` and `a` over `ZMod q`. -/ |
| 337 | lemma hasSum_invDFT_mul_gaussianMonomial (Φ : ZMod q → ℂ) {S : ZMod q → ℝ} |
| 338 | (h_dual : ∀ a : ZMod q, |
| 339 | HasSum (fun n : ℤ ↦ |
| 340 | cexp (2 * π * I * (a.val / q : ℝ) * n) * gaussianMonomial j (n * (q * t)⁻¹)) |
| 341 | (I ^ j.val * (q * t : ℝ) * S a)) : |
| 342 | HasSum (fun n : ℤ ↦ 𝓕⁻ Φ n * gaussianMonomial j (n * (q * t)⁻¹)) |
| 343 | (I ^ j.val * t * ∑ a : ZMod q, Φ a * S a) := by |
| 344 | have h_char (a : ZMod q) (n : ℤ) : |
| 345 | stdAddChar (a * (n : ZMod q)) = cexp (2 * π * I * (a.val / q : ℝ) * n) := by |
| 346 | rw [← zsmul_eq_mul', AddChar.map_zsmul_eq_zpow, stdAddChar_apply, toCircle_apply, |
| 347 | ← Complex.exp_intCast_mul] |
| 348 | push_cast |
| 349 | ring_nf |
| 350 | have h_value : (∑ a : ZMod q, Φ a * (I ^ j.val * (q * t : ℝ) * S a)) / q = |
| 351 | I ^ j.val * t * ∑ a : ZMod q, Φ a * S a := by |
| 352 | have hq : (q : ℂ) ≠ 0 := NeZero.ne _ |
| 353 | simp [mul_left_comm (Φ _), ← Finset.mul_sum, field] |
| 354 | rw [← h_value] |
| 355 | refine ((hasSum_sum fun a _ ↦ (h_dual a).mul_left (Φ a)).div_const q).congr_fun fun n ↦ ?_ |
| 356 | simp only [invDFT_apply, h_char, smul_eq_mul, Finset.mul_sum, Finset.sum_mul, Finset.sum_div] |
| 357 | exact Finset.sum_congr rfl fun a _ ↦ by ring |
| 358 | |
| 359 | /-- For a Dirichlet character `χ ≠ 1` modulo `q` of parity `j ∈ {0, 1}`, primitive or not, Poisson |
| 360 | summation in the classes modulo `q` gives `t |∑ χ(n) w(n t)| = |∑ 𝓕⁻ χ(n) w(n / (q t))|` for |
| 361 | `t > 0`, where `w(z) = z ^ j e^(-π z²)`, the sums are over `n ≥ 1` (`gaussianTheta`) and |
| 362 | `𝓕⁻ χ(n) = q⁻¹ ∑_a χ(a) e^(2πi a n / q)`. -/ |
| 363 | lemma gaussianTheta_poisson_summation (hχ_ne : χ ≠ 1) (hχ_parity : χ (-1) = (-1) ^ j.val) |
| 364 | (ht : 0 < t) : |
| 365 | t * ‖gaussianTheta j (fun n : ℕ ↦ χ n) t‖ = |
| 366 | ‖gaussianTheta j (fun n : ℕ ↦ 𝓕⁻ χ n) (q * t)⁻¹‖ := by |
| 367 | -- Apply `poisson_summation_gaussianMonomial` to each class `a` mod `q`, with shift `a / q` and |
| 368 | -- scale `q t`, multiply by `χ(a)` and add up over `a`. The first sums give |
| 369 | -- `∑_{n ∈ ℤ} χ(n) w(n t)`, the second `q ∑_{n ∈ ℤ} 𝓕⁻ χ(n) w(n / (q t))`. |
| 370 | have h_parity (x : ZMod q) : χ (-x) = (-1) ^ j.val * χ x := by |
| 371 | rw [← hχ_parity, ← map_mul, neg_one_mul] |
| 372 | have h_poisson (a : ZMod q) : ∃ S : ℝ, |
| 373 | HasSum (fun n : ℤ ↦ gaussianMonomial j ((n + a.val / q) * (q * t))) S ∧ |
| 374 | HasSum (fun n : ℤ ↦ |
| 375 | cexp (2 * π * I * (a.val / q : ℝ) * n) * gaussianMonomial j (n * (q * t)⁻¹)) |
| 376 | (I ^ j.val * (q * t : ℝ) * S) := |
| 377 | poisson_summation_gaussianMonomial (a.val / q) (mul_pos (Nat.cast_pos.2 (NeZero.pos q)) ht) |
| 378 | choose S h_class h_dual using h_poisson |
| 379 | -- Both `χ` and `𝓕⁻ χ` have parity `j` and vanish at `0`. |
| 380 | have h_parity_dual (n : ZMod q) : 𝓕⁻ χ (-n) = (-1) ^ j.val * 𝓕⁻ χ n := by |
| 381 | simp_rw [invDFT_apply', ← congrFun (dft_comp_neg χ) (-n), h_parity, dft_const_mul] |
| 382 | ring |
| 383 | have h_zero_dual : 𝓕⁻ χ 0 = 0 := by simp [invDFT_apply, χ.sum_eq_zero_of_ne_one hχ_ne] |
| 384 | have h_sum : 2 * gaussianTheta j (fun n : ℕ ↦ χ n) t = ∑ a : ZMod q, χ a * S a := |
| 385 | two_mul_gaussianTheta t h_parity (χ.map_zero' (hχ_ne ∘ χ.level_one')) |
| 386 | (hasSum_mul_gaussianMonomial_of_classes χ h_class) |
| 387 | have h_sum_dual : 2 * gaussianTheta j (fun n : ℕ ↦ 𝓕⁻ χ n) (q * t)⁻¹ = |
| 388 | I ^ j.val * t * ∑ a : ZMod q, χ a * S a := |
| 389 | two_mul_gaussianTheta _ h_parity_dual h_zero_dual |
| 390 | (hasSum_invDFT_mul_gaussianMonomial χ h_dual) |
| 391 | have h_eq : gaussianTheta j (fun n : ℕ ↦ 𝓕⁻ χ n) (q * t)⁻¹ = |
| 392 | I ^ j.val * t * gaussianTheta j (fun n : ℕ ↦ χ n) t := by |
| 393 | linear_combination h_sum_dual / 2 - I ^ j.val * t / 2 * h_sum |
| 394 | rw [h_eq] |
| 395 | simp [abs_of_pos ht] |
| 396 | |
| 397 | /-- **Symmetry.** For primitive `χ ≠ 1` of conductor `q` with `χ(-1) = (-1) ^ j` and `t > 0` we have |
| 398 | `|θ_χ(t)| = |θ_χ(1 / (q t))|`, where `θ_χ(u) = u ^ (1/2) ∑_{n ≥ 1} χ(n) (n u) ^ j e^(-π n² u²)` is |
| 399 | `thetaSeries`. This is the functional equation of the theta series of a primitive character, in |
| 400 | absolute value. -/ |
| 401 | theorem norm_thetaSeries_inv (hχ_ne : χ ≠ 1) (hχ_parity : χ (-1) = (-1) ^ j.val) |
| 402 | (hχ : χ.IsPrimitive) (ht : 0 < t) : |
| 403 | ‖thetaSeries j (fun n : ℕ ↦ χ n) (q * t)⁻¹‖ = ‖thetaSeries j (fun n : ℕ ↦ χ n) t‖ := by |
| 404 | have hq : (0 : ℝ) < q := Nat.cast_pos.2 (NeZero.pos q) |
| 405 | -- `q 𝓕⁻ χ` is a Gauss sum, of modulus `√q`, times the conjugate of `χ`, and `w` is real. |
| 406 | have h_dual (u : ℝ) : √q * ‖gaussianTheta j (fun n : ℕ ↦ 𝓕⁻ χ n) u‖ = |
| 407 | ‖gaussianTheta j (fun n : ℕ ↦ χ n) u‖ := by |
| 408 | have h_coeff (n : ZMod q) : 𝓕⁻ χ n = (q : ℂ)⁻¹ * gaussSum χ stdAddChar * star (χ n) := by |
| 409 | rw [invDFT_apply', hχ.fourierTransform_eq_inv_mul_gaussSum, neg_neg, smul_eq_mul, |
| 410 | χ.star_apply', mul_comm (χ⁻¹ n), mul_assoc] |
| 411 | have h_theta : gaussianTheta j (fun n : ℕ ↦ 𝓕⁻ χ n) u = |
| 412 | (q : ℂ)⁻¹ * gaussSum χ stdAddChar * star (gaussianTheta j (fun n : ℕ ↦ χ n) u) := by |
| 413 | simp [gaussianTheta, tsum_star, h_coeff, mul_assoc, ← tsum_mul_left] |
| 414 | simp [h_theta, DirichletCharacter.norm_gaussSum_stdAddChar hχ, field] |
| 415 | rw [norm_thetaSeries, norm_thetaSeries, ← h_dual, |
| 416 | ← gaussianTheta_poisson_summation hχ_ne hχ_parity ht, sqrt_inv, sqrt_mul hq.le] |
| 417 | simp [field, sq_sqrt ht.le] |
| 418 | |
| 419 | /-- For `χ ≠ 1` of parity `j ∈ {0, 1}` modulo `q` and `t > 0` the sum `∑_{n ≥ 1} χ(n) w(n t)`, with |
| 420 | `w(z) = z ^ j e^(-π z²)`, has absolute value at most `3 e q e^(-t)`: trivially for `t ≥ 1`, by |
| 421 | Poisson summation for `t ≤ 1`. The character need not be primitive. -/ |
| 422 | lemma norm_gaussianTheta_char_le (hχ_ne : χ ≠ 1) (hχ_parity : χ (-1) = (-1) ^ j.val) |
| 423 | (ht : 0 < t) : ‖gaussianTheta j (fun n : ℕ ↦ χ n) t‖ ≤ 3 * q * rexp 1 * rexp (-t) := by |
| 424 | obtain h | h := le_total 1 t |
| 425 | · calc ‖gaussianTheta j (fun n : ℕ ↦ χ n) t‖ ≤ 3 * rexp (-t) / t := |
| 426 | (summable_and_norm_gaussianTheta_le (fun n ↦ χ.norm_le_one n) ht).2 |
| 427 | _ ≤ 3 * q * rexp 1 * rexp (-t) := by |
| 428 | grw [div_le_self (by positivity) h, ← NeZero.one_le (n := q)] |
| 429 | bound |
| 430 | -- For `t ≤ 1` pass to `𝓕⁻ χ`, an average of numbers of modulus at most `1`. |
| 431 | have h_dft (n : ℕ) : ‖𝓕⁻ χ n‖ ≤ 1 := by |
| 432 | grw [invDFT_apply, norm_smul, |
| 433 | norm_sum_le_of_le (n := fun _ ↦ (1 : ℝ)) _ fun a _ ↦ by simp [χ.norm_le_one]] |
| 434 | simp [NeZero.ne q] |
| 435 | have h_pos : 0 < (q * t)⁻¹ := inv_pos.2 (mul_pos (Nat.cast_pos.2 (NeZero.pos q)) ht) |
| 436 | refine le_of_mul_le_mul_left ?_ ht |
| 437 | calc t * ‖gaussianTheta j (fun n : ℕ ↦ χ n) t‖ |
| 438 | _ = ‖gaussianTheta j (fun n : ℕ ↦ 𝓕⁻ χ n) (q * t)⁻¹‖ := |
| 439 | gaussianTheta_poisson_summation hχ_ne hχ_parity ht |
| 440 | _ ≤ 3 * rexp (-(q * t)⁻¹) / (q * t)⁻¹ := (summable_and_norm_gaussianTheta_le h_dft h_pos).2 |
| 441 | _ ≤ 3 * rexp (1 - t) / (q * t)⁻¹ := by gcongr; linarith |
| 442 | _ = t * (3 * q * rexp 1 * rexp (-t)) := by simp [sub_eq_add_neg, Real.exp_add, field] |
| 443 | |
| 444 | /-- For `χ ≠ 1` of parity `j` and `re s > 0`, the Mellin transform of `∑_{n ≥ 1} χ(n) w(n u)` at `s` |
| 445 | is `Γ_j(s) L(s, χ)`, where `Γ_j` is the Mellin transform of `w(z) = z ^ j e^(-π z²)`. This extends |
| 446 | `mellin_gaussianTheta` by analytic continuation. -/ |
| 447 | lemma mellin_gaussianTheta_char (hχ_ne : χ ≠ 1) (hχ_parity : χ (-1) = (-1) ^ j.val) |
| 448 | (hs : 0 < s.re) : |
| 449 | mellin (gaussianTheta j fun n : ℕ ↦ χ n) s = gaussianMellin j s * χ.LFunction s := by |
| 450 | -- Both sides are holomorphic for `re s > 0` and agree for `re s > 1` by `mellin_gaussianTheta`. |
| 451 | let f : ℂ → ℂ := mellin (gaussianTheta j fun n : ℕ ↦ χ n) |
| 452 | let g (z : ℂ) : ℂ := gaussianMellin j z * χ.LFunction z |
| 453 | have hf : DifferentiableOn ℂ f {z : ℂ | 0 < z.re} := |
| 454 | (mellin_differentiableOn_and_bounded |
| 455 | (fun _ ↦ norm_gaussianTheta_char_le hχ_ne hχ_parity) measurable_gaussianTheta).1 |
| 456 | have hg : DifferentiableOn ℂ g {z : ℂ | 0 < z.re} := |
| 457 | gaussianMellin_differentiableOn_and_bdd.1.mul (by fun_prop) |
| 458 | have h_agree : EqOn f g {z : ℂ | 1 < z.re} := fun z hz ↦ by |
| 459 | simp only [f, g, mellin_gaussianTheta (fun n ↦ χ.norm_le_one n) hz, χ.LFunction_eq_LSeries hz] |
| 460 | exact hf.eqOn_of_eqOn_re_gt hg h_agree hs |
| 461 | |
| 462 | /-- **Riemann's formula.** For `χ ≠ 1` with `χ(-1) = (-1) ^ j` and `re s > 0` the |
| 463 | identity `∫_0^∞ θ_χ(u) u ^ (s - 1/2) du / u = Γ_j(s) L(s, χ)` holds with absolute convergence |
| 464 | (`HasMellin`), where `θ_χ` is `thetaSeries` and `Γ_j` the Mellin transform of |
| 465 | `z ^ j e^(-π z²)`. -/ |
| 466 | theorem hasMellin_thetaSeries_char (hχ_ne : χ ≠ 1) (hχ_parity : χ (-1) = (-1) ^ j.val) |
| 467 | (hs : 0 < s.re) : |
| 468 | HasMellin (thetaSeries j fun n : ℕ ↦ χ n) (s - 2⁻¹) |
| 469 | (gaussianMellin j s * χ.LFunction s) := by |
| 470 | have h_conv : MellinConvergent (gaussianTheta j fun n : ℕ ↦ χ n) s := |
| 471 | (mellinConvergent_and_differentiableAt (fun _ ↦ norm_gaussianTheta_char_le hχ_ne hχ_parity) |
| 472 | measurable_gaussianTheta hs).1 |
| 473 | refine ⟨h_conv.congr_fun (fun _ ht ↦ (cpow_smul_thetaSeries s ht).symm) measurableSet_Ioi, ?_⟩ |
| 474 | rw [mellin_thetaSeries_sub_half, mellin_gaussianTheta_char hχ_ne hχ_parity hs] |
| 475 | |
| 476 | /-- For `b, r > 0` with `1 / (b r) = r`, the map `u ↦ 1 / (b u)` takes the interval `(0, r)` onto |
| 477 | `(r, ∞)`. -/ |
| 478 | lemma image_inv_const_mul_Ioo {b r : ℝ} (hb : 0 < b) (hr : 0 < r) (h_fix : (b * r)⁻¹ = r) : |
| 479 | (fun u : ℝ ↦ (b * u)⁻¹) '' Ioo 0 r = Ioi r := by |
| 480 | rw [← image_image Inv.inv (b * ·), image_mul_left_Ioo hb, mul_zero, image_inv_eq_inv, |
| 481 | inv_Ioo_0_left (mul_pos hb hr), h_fix] |
| 482 | |
| 483 | /-- The fold: for primitive `χ ≠ 1` of conductor `q` with `χ(-1) = (-1) ^ j`, |
| 484 | `∫_0^∞ |θ_χ(u)| du / u = 2 ∫_{q ^ (-1/2)}^∞ |θ_χ(u)| du / u`, where |
| 485 | `θ_χ(u) = u ^ (1/2) ∑_{n ≥ 1} χ(n) (n u) ^ j e^(-π n² u²)` is `thetaSeries`. -/ |
| 486 | lemma integral_norm_thetaSeries_div (hχ_ne : χ ≠ 1) (hχ_parity : χ (-1) = (-1) ^ j.val) |
| 487 | (hχ : χ.IsPrimitive) : |
| 488 | ∫ u : ℝ in Ioi 0, ‖thetaSeries j (fun n : ℕ ↦ χ n) u‖ / u = |
| 489 | 2 * ∫ u : ℝ in Ioi (√q)⁻¹, ‖thetaSeries j (fun n : ℕ ↦ χ n) u‖ / u := by |
| 490 | -- The map `u ↦ 1 / (q u)` has the fixed point `r = q ^ (-1/2)` and preserves `du / u` and |
| 491 | -- `|θ_χ|`. |
| 492 | let f (u : ℝ) : ℝ := ‖thetaSeries j (fun n : ℕ ↦ χ n) u‖ / u |
| 493 | let r : ℝ := (√q)⁻¹ |
| 494 | have hq : (0 : ℝ) < q := Nat.cast_pos.2 (NeZero.pos q) |
| 495 | have hr : 0 < r := by positivity |
| 496 | have h_fix : (q * r)⁻¹ = r := by rw [← div_eq_mul_inv, div_sqrt] |
| 497 | have h_int : IntegrableOn f (Ioi 0) := by |
| 498 | refine (hasMellin_thetaSeries_char hχ_ne hχ_parity (s := 2⁻¹) (by simp)).1.norm.congr |
| 499 | (ae_restrict_of_forall_mem measurableSet_Ioi fun u (hu : 0 < u) ↦ ?_) |
| 500 | simp [f, cpow_neg_one, abs_of_pos hu, div_eq_inv_mul] |
| 501 | have h_deriv (u : ℝ) (hu : u ∈ Ioo 0 r) : |
| 502 | HasDerivWithinAt (fun u : ℝ ↦ (q * u)⁻¹) (-q / (q * u) ^ 2) (Ioo 0 r) u := |
| 503 | (hasDerivAt_const_mul _).hasDerivWithinAt.fun_inv (mul_pos hq hu.1).ne' |
| 504 | have h_inj : InjOn (fun u : ℝ ↦ (q * u)⁻¹) (Ioo 0 r) := fun u _ v _ h ↦ by simp_all [hq.ne'] |
| 505 | have h_invariant (u : ℝ) (hu : u ∈ Ioo 0 r) : |-q / (q * u) ^ 2| • f (q * u)⁻¹ = f u := by |
| 506 | have hu_pos : 0 < u := hu.1 |
| 507 | simp only [f, norm_thetaSeries_inv hχ_ne hχ_parity hχ hu_pos, neg_div, abs_neg, smul_eq_mul] |
| 508 | rw [abs_of_pos (by positivity)] |
| 509 | field |
| 510 | have h_fold : ∫ u : ℝ in Ioi r, f u = ∫ u : ℝ in Ioc 0 r, f u := by |
| 511 | rw [← image_inv_const_mul_Ioo hq hr h_fix, |
| 512 | integral_image_eq_integral_abs_deriv_smul measurableSet_Ioo h_deriv h_inj, |
| 513 | setIntegral_congr_fun measurableSet_Ioo h_invariant, integral_Ioc_eq_integral_Ioo] |
| 514 | calc ∫ u : ℝ in Ioi 0, f u = (∫ u : ℝ in Ioc 0 r, f u) + ∫ u : ℝ in Ioi r, f u := by |
| 515 | rw [← setIntegral_union Ioc_disjoint_Ioi_same measurableSet_Ioi |
| 516 | (h_int.mono_set Ioc_subset_Ioi_self) (h_int.mono_set (Ioi_subset_Ioi hr.le)), |
| 517 | Ioc_union_Ioi_eq_Ioi hr.le] |
| 518 | _ = 2 * ∫ u : ℝ in Ioi r, f u := by rw [← h_fold, two_mul] |
| 519 | |
| 520 | end New |
| 521 | |
| 522 | end |