From e18ef415bd012091c5bf56cd17eae0322bbe3118 Mon Sep 17 00:00:00 2001 From: Riccardo Brasca Date: Wed, 4 Nov 2026 08:26:34 +0100 Subject: [PATCH 01/20] chore: clean up after #43233 --- Mathlib/Analysis/SpecialFunctions/Exp.lean | 8 + .../NumberTheory/LSeries/WienerIkehara.lean | 546 +++++++++--------- Mathlib/Topology/Algebra/Support.lean | 5 + 3 files changed, 294 insertions(+), 265 deletions(-) diff --git a/Mathlib/Analysis/SpecialFunctions/Exp.lean b/Mathlib/Analysis/SpecialFunctions/Exp.lean index 9a898d89a28728..b360a9407342b6 100644 --- a/Mathlib/Analysis/SpecialFunctions/Exp.lean +++ b/Mathlib/Analysis/SpecialFunctions/Exp.lean @@ -235,6 +235,14 @@ theorem tendsto_exp_atBot : Tendsto exp atBot (𝓝 0) := theorem tendsto_exp_atBot_nhdsGT : Tendsto exp atBot (𝓝[>] 0) := tendsto_inf.2 ⟨tendsto_exp_atBot, tendsto_principal.2 <| Eventually.of_forall exp_pos⟩ +/-- If `f : ℝ → E` has compact support and vanishes near `0`, then `f ∘ exp` has compact +support. -/ +theorem _root_.HasCompactSupport.comp_exp {E : Type*} [Zero E] {f : ℝ → E} + (hf : HasCompactSupport f) (h : 0 ∉ tsupport f) : HasCompactSupport (f ∘ exp) := by + simp only [hasCompactSupport_iff_eventuallyEq, coclosedCompact_eq_cocompact, + cocompact_eq_atBot_atTop] at hf ⊢ + exact ⟨tendsto_exp_atBot <| notMem_tsupport_iff_eventuallyEq.mp h, tendsto_exp_atTop hf.2⟩ + @[simp] theorem isBoundedUnder_ge_exp_comp (l : Filter α) (f : α → ℝ) : IsBoundedUnder (· ≥ ·) l fun x => exp (f x) := diff --git a/Mathlib/NumberTheory/LSeries/WienerIkehara.lean b/Mathlib/NumberTheory/LSeries/WienerIkehara.lean index a0f406a2d22358..422a2689269ec9 100644 --- a/Mathlib/NumberTheory/LSeries/WienerIkehara.lean +++ b/Mathlib/NumberTheory/LSeries/WienerIkehara.lean @@ -37,16 +37,16 @@ for smooth cutoffs. ## Proof outline -Writing `ψ̂` for the Fourier transform, the proof studies `S f A σ ψ̂ x`, the difference +Writing `ψ̂` for the Fourier transform, the proof studies `remainder f A σ ψ̂ x`, the difference between `∑' n, term f σ n * ψ̂ (log (n / x) / (2 * π))` and its polar counterpart. Rewriting both -halves as Fourier integrals (`sum_term_mul_fourier_eq`, `integral_exp_mul_fourier_eq`) cancels the -pole and expresses `S` through `G` (`sum_term_mul_sub_mul_integral_eq`); letting `σ → 1` -and applying the Riemann-Lebesgue lemma gives `S f A 1 ψ̂ x → 0`, first for compactly supported -test functions (`tendsto_S_one_fourier_of_hasCompactSupport`) and then for all Schwartz -functions (`tendsto_S_one_fourier`). +halves as Fourier integrals (`smoothedSum_fourier_eq`, `poleTerm_fourier_eq`) cancels the +pole and expresses `remainder` through `G` (`remainder_fourier_eq`); letting `σ → 1` and applying +the Riemann-Lebesgue lemma gives `remainder f A 1 ψ̂ x → 0`, first for compactly supported test +functions (`tendsto_remainder_one_fourier_of_hasCompactSupport`) and then for all Schwartz +functions (`tendsto_remainder_one_fourier`). Surjectivity of the Fourier transform on Schwartz space upgrades this to a smoothed form of the theorem (`tendsto_sum_div_smooth_real`), and non-negativity of `f` together with a smooth Urysohn -lemma (`exists_cutoff`) replaces the smooth cutoff by the indicator of +lemma (`exists_smooth_cutoff`) replaces the smooth cutoff by the indicator of an interval, whence the theorem (`tendsto_sum_div`). This file is adapted from the `PrimeNumberTheoremAnd` project. @@ -59,44 +59,48 @@ open Real MeasureTheory Filter Set FourierTransform LSeries Asymptotics Schwartz Function open scoped Topology ContDiff ComplexConjugate LSeries.notation -namespace SchwartzMap +namespace WienerIkehara + +section FourierSeminorm variable (ψ : 𝓢(ℝ, ℂ)) (u : ℝ) -/-- In the arguments of this file, it is convenient to isolate a bespoke seminorm for -Schwartz functions that controls the decay of their Fourier transform. -/ -private def Q : ℝ := (𝓕 ψ).seminorm ℝ 0 0 + (𝓕 ψ).seminorm ℝ 2 0 +/-- A bespoke seminorm on Schwartz functions `ψ` controlling the decay of their Fourier transform: +`‖𝓕 ψ u‖ ≤ fourierSeminorm ψ / (1 + u ^ 2)`, see `norm_fourier_le_fourierSeminorm_mul`. -/ +def fourierSeminorm : ℝ := (𝓕 ψ).seminorm ℝ 0 0 + (𝓕 ψ).seminorm ℝ 2 0 -private lemma Q_nonneg : 0 ≤ ψ.Q := add_nonneg (apply_nonneg _ _) (apply_nonneg _ _) +lemma fourierSeminorm_nonneg : 0 ≤ fourierSeminorm ψ := + add_nonneg (apply_nonneg _ _) (apply_nonneg _ _) -private lemma continuous_Q : Continuous Q := +lemma continuous_fourierSeminorm : Continuous fourierSeminorm := (((schwartz_withSeminorms ℝ ℝ ℂ).continuous_seminorm (0, 0)).comp (by fun_prop)).add (((schwartz_withSeminorms ℝ ℝ ℂ).continuous_seminorm (2, 0)).comp (by fun_prop)) -private lemma norm_fourier_le_Q_mul : ‖𝓕 ψ u‖ ≤ ψ.Q * (1 + u ^ 2)⁻¹ := by - rw [← div_eq_mul_inv, le_div_iff₀ (by positivity : (0 : ℝ) < 1 + u ^ 2), Q] +lemma norm_fourier_le_fourierSeminorm_mul : ‖𝓕 ψ u‖ ≤ fourierSeminorm ψ * (1 + u ^ 2)⁻¹ := by + rw [← div_eq_mul_inv, le_div_iff₀ (by positivity : (0 : ℝ) < 1 + u ^ 2), fourierSeminorm] have h := norm_pow_mul_le_seminorm ℝ (𝓕 ψ) 2 u rw [Real.norm_eq_abs, sq_abs] at h linarith [norm_le_seminorm ℝ (𝓕 ψ) u] -end SchwartzMap - -namespace WienerIkehara +end FourierSeminorm variable (f : ℕ → ℝ) (A : ℝ) (σ : ℝ) (φ : 𝓢(ℝ, ℂ)) (x : ℝ) -private abbrev c₀ := π⁻¹ * 2⁻¹ - -private def S₁ : ℂ := ∑' n, term ↗f σ n * φ (c₀ * log (n / x)) +/-- The smoothed sum `∑' n, term f σ n * φ ((2 * π)⁻¹ * log (n / x))` of `f` against a test +function `φ` at the scale `x`. -/ +def smoothedSum : ℂ := ∑' n, term ↗f σ n * φ ((2 * π)⁻¹ * log (n / x)) -private def S₂ : ℂ := A * ↑(x ^ (1 - σ)) * ∫ u in Ici (-log x), rexp (-u * (σ - 1)) * φ (c₀ * u) +/-- The contribution to `smoothedSum` of a pole of `LSeries f` at `s = 1` with residue `A`. -/ +def poleTerm : ℂ := + A * ↑(x ^ (1 - σ)) * ∫ u in Ici (-log x), rexp (-u * (σ - 1)) * φ ((2 * π)⁻¹ * u) /-- A key statistic in the Wiener--Ikehara analysis involving an exponent `σ`, a test -function `φ`, and a scale parameter `x`. -/ -private def S : ℂ := S₁ f σ φ x - S₂ A σ φ x +function `φ`, and a scale parameter `x`: the smoothed sum of `f` minus the contribution of the +pole of its `L`-series. -/ +def remainder : ℂ := smoothedSum f σ φ x - poleTerm A σ φ x -private lemma S₂_one : S₂ A 1 φ x = A * ∫ u in Ici (-log x), φ (c₀ * u) := by - simp [S₂] +lemma poleTerm_one : poleTerm A 1 φ x = A * ∫ u in Ici (-log x), φ ((2 * π)⁻¹ * u) := by + simp [poleTerm] /- The data and hypotheses for the Wiener-Ikehara theorem, supplied as individual hypotheses: a nonnegative function `f` (`hpos`) obeying a Chebyshev-type bound with constant `C` (`bound`), @@ -107,14 +111,14 @@ variable {f : ℕ → ℝ} {C A : ℝ} {G : ℂ → ℂ} (bound : ∀ n, ∑ i (hG' : EqOn G (fun s ↦ LSeries ↗f s - A / (s - 1)) {s | 1 < s.re}) (hpos : 0 ≤ f) include bound hpos in -private lemma C_nonneg : 0 ≤ C := (hpos 0).trans (by simpa using bound 1) +lemma C_nonneg : 0 ≤ C := (hpos 0).trans (by simpa using bound 1) section FourierIdentities variable {x σ : ℝ} (ψ : 𝓢(ℝ, ℂ)) (hx : 0 < x) (hσ : 1 < σ) include hpos bound hσ in -private lemma lSeriesSummable : LSeriesSummable ↗f (σ : ℂ) := by +lemma lSeriesSummable : LSeriesSummable ↗f (σ : ℂ) := by refine LSeriesSummable_of_sum_norm_bigO_and_nonneg (r := 1) ?_ hpos zero_le_one (by simpa) refine isBigO_of_le' (c := 2 * C) _ fun n ↦ ?_ rw [norm_of_nonneg (Finset.sum_nonneg fun k _ ↦ hpos k), rpow_one, Real.norm_natCast] @@ -124,19 +128,19 @@ private lemma lSeriesSummable : LSeriesSummable ↗f (σ : ℂ) := by _ ≤ _ := (bound (2 * n)).trans_eq (by push_cast; ring) include hx in -private lemma fourierChar_neg_mul_log_div {n : ℕ} (hn : n ≠ 0) (t : ℝ) : - (𝐞 (-(c₀ * log (n / x) * t)) : ℂ) = x ^ (t * I) / n ^ (t * I) := by +lemma fourierChar_neg_mul_log_div {n : ℕ} (hn : n ≠ 0) (t : ℝ) : + (𝐞 (-((2 * π)⁻¹ * log (n / x) * t)) : ℂ) = x ^ (t * I) / n ^ (t * I) := by simp [fourierChar_apply, cpow_def_of_ne_zero, hx.ne', hn, ← Complex.exp_sub, log_div, ofReal_log, hx.le] congr field include bound hpos hx hσ in -private lemma sum_term_mul_fourier_eq : - S₁ f σ (𝓕 ψ) x = ∫ t : ℝ, LSeries ↗f (σ + t * I) * ψ t * x ^ (t * I) := +lemma smoothedSum_fourier_eq : + smoothedSum f σ (𝓕 ψ) x = ∫ t : ℝ, LSeries ↗f (σ + t * I) * ψ t * x ^ (t * I) := calc - _ = ∑' n, ∫ t, term ↗f σ n * 𝐞 (-(c₀ * log (n / x) * t)) • ψ t := by - simp [S₁, fourier_coe, fourier_eq, integral_const_mul] + _ = ∑' n, ∫ t, term ↗f σ n * 𝐞 (-((2 * π)⁻¹ * log (n / x) * t)) • ψ t := by + simp [smoothedSum, fourier_coe, fourier_eq, integral_const_mul] _ = ∫ t, ∑' n, _ := by refine integral_tsum_of_summable_integral_norm (fun n ↦ ?_) ?_ · exact (ψ.integrable.norm.const_mul ‖term ↗f σ n‖).mono' (by fun_prop) @@ -153,10 +157,10 @@ private lemma sum_term_mul_fourier_eq : simp [cpow_add, field, *] include hx hσ in -private lemma mul_integral_exp_mul_fourierChar_eq (t : ℝ) : - ↑(x ^ (1 - σ)) * ∫ u in Ici (-log x), (rexp (-u * (σ - 1)) : ℂ) * 𝐞 (-(t * (c₀ * u))) = +lemma mul_integral_exp_mul_fourierChar_eq (t : ℝ) : + ↑(x ^ (1 - σ)) * ∫ u in Ici (-log x), (rexp (-u * (σ - 1)) : ℂ) * 𝐞 (-(t * ((2 * π)⁻¹ * u))) = x ^ (t * I) / (σ + t * I - 1) := by - have : ∫ u in Ici (-log x), (rexp (-u * (σ - 1)) : ℂ) * 𝐞 (-(t * (c₀ * u))) = + have : ∫ u in Ici (-log x), (rexp (-u * (σ - 1)) : ℂ) * 𝐞 (-(t * ((2 * π)⁻¹ * u))) = ∫ u in Ioi (-log x), cexp (-(σ - 1 + t * I) * u) := by rw [integral_Ici_eq_integral_Ioi] congr with u @@ -169,46 +173,44 @@ private lemma mul_integral_exp_mul_fourierChar_eq (t : ℝ) : ring_nf include hx hσ in -private lemma integral_exp_mul_fourier_eq : - S₂ A σ (𝓕 ψ) x = A * ∫ t, (1 / (σ + t * I - 1)) * ψ t * x ^ (t * I) := by +lemma poleTerm_fourier_eq : + poleTerm A σ (𝓕 ψ) x = A * ∫ t, (1 / (σ + t * I - 1)) * ψ t * x ^ (t * I) := by have hint : IntegrableOn (fun u ↦ rexp (-u * (σ - 1))) (Ici (-log x)) := by rw [integrableOn_Ici_iff_integrableOn_Ioi] convert exp_neg_integrableOn_Ioi (-log x) (sub_pos.mpr hσ) using 1 - ext u; ring_nf - rw [S₂, mul_assoc]; congr 1 + ext u + ring_nf + rw [poleTerm, mul_assoc] + congr 1 calc - _ = ↑(x ^ (1 - σ)) * ∫ u in Ici (-log x), - ∫ t, (rexp (-u * (σ - 1)) : ℂ) • 𝐞 (-(t * (c₀ * u))) • ψ t := by - simp_rw [fourier_coe, fourier_real_eq, ← smul_eq_mul, ← integral_smul] - _ = ↑(x ^ (1 - σ)) * ∫ t, ∫ u in Ici (-log x), _ := - congr(_ * $(integral_integral_swap ((Integrable.mul_prod hint ψ.integrable.norm).mono' - (by fun_prop) (.of_forall fun ⟨u, t⟩ ↦ by simp [Complex.norm_exp])))) - _ = _ := by - rw [← integral_const_mul] - congr with t - simp_rw [Circle.smul_def, smul_smul, smul_eq_mul, integral_mul_const] - rw [← mul_assoc, mul_integral_exp_mul_fourierChar_eq hx hσ] - ring - -include hx in -private lemma continuous_cpow_mul_I : Continuous fun t : ℝ ↦ (x : ℂ) ^ (t * I) := - continuous_const.cpow (by fun_prop) (by simp [hx]) + _ = ↑(x ^ (1 - σ)) * ∫ u in Ici (-log x), + ∫ t, (rexp (-u * (σ - 1)) : ℂ) • 𝐞 (-(t * ((2 * π)⁻¹ * u))) • ψ t := by + simp_rw [fourier_coe, fourier_real_eq, ← smul_eq_mul, ← integral_smul] + _ = ↑(x ^ (1 - σ)) * ∫ t, ∫ u in Ici (-log x), _ := + congr(_ * $(integral_integral_swap ((Integrable.mul_prod hint ψ.integrable.norm).mono' + (by fun_prop) (.of_forall fun ⟨u, t⟩ ↦ by simp [Complex.norm_exp])))) + _ = _ := by + rw [← integral_const_mul] + congr with t + simp_rw [Circle.smul_def, smul_smul, smul_eq_mul, integral_mul_const] + rw [← mul_assoc, mul_integral_exp_mul_fourierChar_eq hx hσ] + ring include bound hpos hG hG' hx in /-- The main result of this section: an initial Fourier identity expressing a sum of `f` as an error term of Fourier integral type. -/ -private lemma sum_term_mul_sub_mul_integral_eq {ψ : 𝓢(ℝ, ℂ)} (hψ : HasCompactSupport ψ) - {σ : ℝ} (hσ : 1 < σ) : S f A σ (𝓕 ψ) x = ∫ t : ℝ, G (σ + t * I) * ψ t * x ^ (t * I) := by +lemma remainder_fourier_eq {ψ : 𝓢(ℝ, ℂ)} (hψ : HasCompactSupport ψ) {σ : ℝ} (hσ : 1 < σ) : + remainder f A σ (𝓕 ψ) x = ∫ t : ℝ, G (σ + t * I) * ψ t * x ^ (t * I) := by have hσt (t : ℝ) : 1 < (σ + t * I).re := by simpa using hσ have (t : ℝ) : (σ : ℂ) + t * I - 1 ≠ 0 := ne_zero_of_re_pos (by simpa using hσ) - have hcpow := continuous_cpow_mul_I hx + have hcpow : Continuous fun t : ℝ ↦ (x : ℂ) ^ (t * I) := by fun_prop (disch := simp [hx.ne']) have hGc : Continuous fun t : ℝ ↦ G (σ + t * I) := hG.comp_continuous (by fun_prop) fun t ↦ (hσt t).le have hint₁ : Integrable fun t : ℝ ↦ G (σ + t * I) * ψ t * x ^ (t * I) := ((hGc.mul ψ.continuous).mul hcpow).integrable_of_hasCompactSupport hψ.mul_left.mul_right have hint₂ : Integrable fun t : ℝ ↦ A * (1 / (σ + t * I - 1) * ψ t * x ^ (t * I)) := Continuous.integrable_of_hasCompactSupport (by fun_prop) hψ.mul_left.mul_right.mul_left - rw [S, sum_term_mul_fourier_eq bound hpos ψ hx hσ, integral_exp_mul_fourier_eq ψ hx hσ, + rw [remainder, smoothedSum_fourier_eq bound hpos ψ hx hσ, poleTerm_fourier_eq ψ hx hσ, sub_eq_iff_eq_add, ← integral_const_mul, ← integral_add hint₁ hint₂] refine integral_congr_ae (.of_forall fun t ↦ ?_) simp only [hG' (hσt t)] @@ -221,164 +223,168 @@ section Weight variable {a c t x : ℝ} {n : ℕ} /-- A weight function appearing in the analysis. -/ -private def w (t : ℝ) : ℝ := (t * (1 + (c₀ * log t) ^ 2))⁻¹ +def weight (t : ℝ) : ℝ := (t * (1 + ((2 * π)⁻¹ * log t) ^ 2))⁻¹ -private lemma w_nonneg (ht : 0 ≤ t) : 0 ≤ w t := by rw [w]; positivity +lemma weight_nonneg (ht : 0 ≤ t) : 0 ≤ weight t := by rw [weight]; positivity -private lemma hasDerivAt_w (ht : t ≠ 0) : HasDerivAt w - (- (c₀ ^ 2 * (log t + 1) ^ 2 + (1 - c₀) * (1 + c₀)) * w t ^ 2) t := by - have : HasDerivAt (fun t ↦ t * (1 + (c₀ * log t) ^ 2)) - (1 + 2 * c₀ ^ 2 * log t + (c₀ * log t) ^ 2) t := by - convert (hasDerivAt_id' t).mul ?_ (d' := 2 * c₀ ^ 2 * t⁻¹ * log t) using 1 +lemma hasDerivAt_weight (ht : t ≠ 0) : HasDerivAt weight + (-((2 * π)⁻¹ ^ 2 * (log t + 1) ^ 2 + (1 - (2 * π)⁻¹) * (1 + (2 * π)⁻¹)) * weight t ^ 2) t := by + have : HasDerivAt (fun t ↦ t * (1 + ((2 * π)⁻¹ * log t) ^ 2)) + (1 + 2 * (2 * π)⁻¹ ^ 2 * log t + ((2 * π)⁻¹ * log t) ^ 2) t := by + convert (hasDerivAt_id' t).mul ?_ (d' := 2 * (2 * π)⁻¹ ^ 2 * t⁻¹ * log t) using 1 · grind - convert (((hasDerivAt_log ht).const_mul _).pow (f' := c₀ * t⁻¹) 2).const_add _ using 1 + convert (((hasDerivAt_log ht).const_mul _).pow (f' := (2 * π)⁻¹ * t⁻¹) 2).const_add _ using 1 ring - unfold w + unfold weight convert this.inv (by positivity) using 1 grind -private lemma antitoneOn_w : AntitoneOn w (Ioi 0) := by +lemma antitoneOn_weight : AntitoneOn weight (Ioi 0) := by refine antitoneOn_of_hasDerivWithinAt_nonpos (convex_Ioi _) - (fun _ _ ↦ (hasDerivAt_w (by grind)).continuousAt.continuousWithinAt) - (fun _ _ ↦ (hasDerivAt_w (fun _ ↦ by simp_all)).hasDerivWithinAt) + (fun _ _ ↦ (hasDerivAt_weight (by grind)).continuousAt.continuousWithinAt) + (fun _ _ ↦ (hasDerivAt_weight (fun _ ↦ by simp_all)).hasDerivWithinAt) fun x _ ↦ ?_ - have : 0 < c₀ ^ 2 * (log x + 1) ^ 2 + (1 - c₀) * (1 + c₀) := by - have : π⁻¹ ≤ 2⁻¹ := by simp [field, two_le_pi] - positivity [(by nlinarith : 0 < 1 - π⁻¹ * 2⁻¹)] + have : 0 < 1 - (2 * π)⁻¹ := sub_pos.mpr (inv_lt_one_of_one_lt₀ (by linarith [two_le_pi])) simp only [neg_mul, Left.neg_nonpos_iff] positivity -private lemma integrableOn_mul_w_div (hc : 0 < c) : - IntegrableOn (fun t ↦ a * w (t / c)) (Ici 0) := by - have (t) (ht : 0 < t) : t⁻¹ • (a * c * (1 + (c₀ * (log t - log c)) ^ 2)⁻¹) = a * w (t / c) - := by - have : 0 < 1 + (c₀ * (log t - log c)) ^ 2 := by positivity - simp [w, log_div ht.ne' hc.ne', field] +lemma integrableOn_mul_weight_div (hc : 0 < c) : + IntegrableOn (fun t ↦ a * weight (t / c)) (Ici 0) := by + have (t) (ht : 0 < t) : + t⁻¹ • (a * c * (1 + ((2 * π)⁻¹ * (log t - log c)) ^ 2)⁻¹) = a * weight (t / c) := by + have : 0 < 1 + ((2 * π)⁻¹ * (log t - log c)) ^ 2 := by positivity + simp [weight, log_div ht.ne' hc.ne', field] rw [integrableOn_Ici_iff_integrableOn_Ioi] exact ((integrableOn_comp_log_Ioi_zero _).2 (((integrable_inv_one_add_mul_sq (by positivity)).comp_sub_right _).const_mul _)).congr_fun this measurableSet_Ioi -private lemma antitoneOn_inv_mul_w_div (hx : 0 < x) : - AntitoneOn (fun t ↦ x⁻¹ * w (t / x)) (Ioc 0 n) := by - intro u ⟨_, _⟩ v ⟨_, _⟩ huv - apply mul_le_mul le_rfl ?_ (w_nonneg (by positivity)) (by positivity) - exact antitoneOn_w (by rw [mem_Ioi]; positivity) (by rw [mem_Ioi]; positivity) (by grw [huv]) +lemma antitoneOn_inv_mul_weight_div (hx : 0 < x) : + AntitoneOn (fun t ↦ x⁻¹ * weight (t / x)) (Ioc 0 n) := by + intro u hu v hv huv + dsimp only + gcongr + exact antitoneOn_weight (div_pos hu.1 hx) (div_pos hv.1 hx) (by gcongr) -private lemma integrableOn_inv_mul_w_div (hx : 0 < x) : - IntegrableOn (fun t ↦ x⁻¹ * w (t / x)) (Icc 0 n) := - .mono_set (integrableOn_mul_w_div (by positivity)) Icc_subset_Ici_self +lemma integrableOn_inv_mul_weight_div (hx : 0 < x) : + IntegrableOn (fun t ↦ x⁻¹ * weight (t / x)) (Icc 0 n) := + .mono_set (integrableOn_mul_weight_div (by positivity)) Icc_subset_Ici_self -private lemma inv_mul_w_div (hx : x ≠ 0) (t : ℝ) : - x⁻¹ * w (t / x) = (t * (1 + (c₀ * log (t / x)) ^ 2))⁻¹ := by - rw [w, ← mul_inv, ← mul_assoc, mul_div_cancel₀ t hx] +lemma inv_mul_weight_div (hx : x ≠ 0) (t : ℝ) : + x⁻¹ * weight (t / x) = (t * (1 + ((2 * π)⁻¹ * log (t / x)) ^ 2))⁻¹ := by + rw [weight, ← mul_inv, ← mul_assoc, mul_div_cancel₀ t hx] -private lemma inv_mul_w_div_le_one (hx : x ≠ 0) (ht : 1 ≤ t) : x⁻¹ * w (t / x) ≤ 1 := by - rw [inv_mul_w_div hx] +lemma inv_mul_weight_div_le_one (hx : x ≠ 0) (ht : 1 ≤ t) : x⁻¹ * weight (t / x) ≤ 1 := by + rw [inv_mul_weight_div hx] exact inv_le_one_of_one_le₀ <| one_le_mul_of_one_le_of_one_le ht <| le_add_of_nonneg_right (sq_nonneg _) -private lemma antitone_ite_w (hx : 0 < x) : - Antitone fun i : ℕ ↦ if i = 0 then (1 : ℝ) else x⁻¹ * w (i / x) := by +lemma antitone_ite_weight (hx : 0 < x) : + Antitone fun i : ℕ ↦ if i = 0 then (1 : ℝ) else x⁻¹ * weight (i / x) := by intro i j hij rcases eq_or_ne j 0 with rfl | hj · simp [Nat.le_zero.mp hij] simp only [hj, ↓reduceIte] split_ifs with hi - · exact inv_mul_w_div_le_one hx.ne' (mod_cast Nat.one_le_iff_ne_zero.mpr hj) + · exact inv_mul_weight_div_le_one hx.ne' (mod_cast Nat.one_le_iff_ne_zero.mpr hj) · gcongr - exact antitoneOn_w (by rw [mem_Ioi]; positivity) (by rw [mem_Ioi]; positivity) (by gcongr) + exact antitoneOn_weight (mem_Ioi.mpr (by positivity)) (mem_Ioi.mpr (by positivity)) (by gcongr) end Weight section LimitingFourierIdentity -private lemma tendsto_integral_mul_cpow_mul_I {ψ : ℝ → ℂ} : +lemma tendsto_integral_mul_cpow_mul_I {ψ : ℝ → ℂ} : Tendsto (fun x : ℝ ↦ ∫ t, ψ t * x ^ (t * I)) atTop (𝓝 0) := by have : ∀ᶠ x : ℝ in atTop, ∫ t, ψ t * x ^ (t * I) = ∫ t, ψ t * exp (log x * t * I) := by filter_upwards [eventually_ne_atTop 0, eventually_ge_atTop 0] with x hx hx' refine integral_congr_ae (Eventually.of_forall fun _ ↦ ?_) simp [cpow_def_of_ne_zero (ofReal_ne_zero.mpr hx), ofReal_log hx', mul_assoc] simp_rw [tendsto_congr' this] - convert_to Tendsto (fun x ↦ 𝓕 ψ (-c₀ * log x)) atTop (𝓝 0) - · ext; congr with _ + convert_to Tendsto (fun x ↦ 𝓕 ψ (-(2 * π)⁻¹ * log x)) atTop (𝓝 0) + · ext + congr with _ simp only [← ofReal_mul, mul_comm (ψ _), fourierChar, Circle.exp, innerₗ_apply_apply, RCLike.inner_apply, conj_trivial, AddChar.coe_mk, mul_neg] - congr; field + congr + field exact (zero_at_infty_fourier ψ).comp <| Tendsto.mono_right (tendsto_log_atTop.const_mul_atTop_of_neg (by simp [pi_pos])) atBot_le_cocompact -private abbrev C₀ := 1 + ∫ t in Ioi 0, w t - -private lemma C₀_nonneg : 0 ≤ C₀ := - add_nonneg zero_le_one (setIntegral_nonneg measurableSet_Ioi (by grind [w_nonneg])) - variable {x : ℝ} (Ψ : 𝓢(ℝ, ℂ)) (hΨ : HasCompactSupport Ψ) (hx : 1 ≤ x) (n : ℕ) include hx in -private lemma sum_range_ite_w_le : - ∑ i ∈ .range n, (if i = 0 then 1 else x⁻¹ * w (i / x)) ≤ 1 + ∫ t in Ioi 0, w t := by +lemma sum_range_ite_weight_le : + ∑ i ∈ .range n, (if i = 0 then 1 else x⁻¹ * weight (i / x)) ≤ + 1 + ∫ t in Ioi 0, weight t := by have hx₀ : 0 < x := zero_lt_one.trans_le hx rcases n with _ | m - · simpa using C₀_nonneg + · simpa using add_nonneg zero_le_one + (setIntegral_nonneg measurableSet_Ioi fun t ht ↦ weight_nonneg ht.le) simp only [Finset.sum_range_succ', Nat.add_one_ne_zero, ↓reduceIte] rw [add_comm _ (1 : ℝ)] gcongr calc - _ ≤ ∫ t in 0..m, x⁻¹ * w (t / x) := by - simpa using @AntitoneOn.sum_le_integral_of_integrableOn 0 m (fun t ↦ x⁻¹ * w (t / x)) - (by simpa using antitoneOn_inv_mul_w_div hx₀) - (by simpa using integrableOn_inv_mul_w_div hx₀) - _ = ∫ t in 0..m / x, w t := by - rw [intervalIntegral.integral_const_mul, intervalIntegral.integral_comp_div w hx₀.ne', + _ ≤ ∫ t in 0..m, x⁻¹ * weight (t / x) := by + simpa using @AntitoneOn.sum_le_integral_of_integrableOn 0 m (fun t ↦ x⁻¹ * weight (t / x)) + (by simpa using antitoneOn_inv_mul_weight_div hx₀) + (by simpa using integrableOn_inv_mul_weight_div hx₀) + _ = ∫ t in 0..m / x, weight t := by + rw [intervalIntegral.integral_const_mul, intervalIntegral.integral_comp_div weight hx₀.ne', zero_div, smul_eq_mul, ← mul_assoc, inv_mul_cancel₀ hx₀.ne', one_mul] - _ ≤ ∫ t in Ioi 0, w t := by + _ ≤ ∫ t in Ioi 0, weight t := by rw [intervalIntegral.integral_of_le (by positivity)] exact setIntegral_mono_set - (by simpa using (integrableOn_mul_w_div (a := 1) zero_lt_one).mono_set Ioi_subset_Ici_self) - (eventually_of_mem (self_mem_ae_restrict measurableSet_Ioi) fun t ht ↦ w_nonneg ht.le) + (by simpa using + (integrableOn_mul_weight_div (a := 1) zero_lt_one).mono_set Ioi_subset_Ici_self) + (eventually_of_mem (self_mem_ae_restrict measurableSet_Ioi) fun t ht ↦ weight_nonneg ht.le) Ioc_subset_Ioi_self.eventuallyLE include bound hpos hx in -private lemma bound_sum_log_range : - ∑ i ∈ .range n, ‖f i‖ / i * (1 + (c₀ * log (i / x)) ^ 2)⁻¹ ≤ C * C₀ := by +lemma bound_sum_log_range : + ∑ i ∈ .range n, ‖f i‖ / i * (1 + ((2 * π)⁻¹ * log (i / x)) ^ 2)⁻¹ ≤ + C * (1 + ∫ t in Ioi 0, weight t) := by have hx₀ : 0 < x := zero_lt_one.trans_le hx have := C_nonneg bound hpos calc - _ ≤ ∑ i ∈ .range n, ‖f i‖ * (if i = 0 then 1 else x⁻¹ * w (i / x)) := by + _ ≤ ∑ i ∈ .range n, ‖f i‖ * (if i = 0 then 1 else x⁻¹ * weight (i / x)) := by gcongr 1 with i - by_cases i = 0 <;> simp [*, w, field] - _ ≤ ∑ i ∈ .range n, C * (if i = 0 then 1 else x⁻¹ * w (i / x)) := + by_cases i = 0 <;> simp [*, weight, field] + _ ≤ ∑ i ∈ .range n, C * (if i = 0 then 1 else x⁻¹ * weight (i / x)) := Finset.sum_mul_le_sum_mul_of_sum_range_le (fun k _ ↦ by simpa [mul_comm, Real.norm_of_nonneg (hpos _)] using bound k) (fun i ↦ by + unfold weight simp only [Pi.zero_apply] - split_ifs - exacts [zero_le_one, mul_nonneg (by positivity) (w_nonneg (by positivity))]) - ((antitone_ite_w hx₀).antitoneOn _) - _ ≤ C * C₀ := by + positivity) + ((antitone_ite_weight hx₀).antitoneOn _) + _ ≤ C * (1 + ∫ t in Ioi 0, weight t) := by rw [← Finset.mul_sum] gcongr - exact sum_range_ite_w_le hx n + exact sum_range_ite_weight_le hx n include bound hpos hx in -private lemma summable_sum_log_range : - Summable fun n ↦ ‖f n‖ / n * (1 + (c₀ * log (n / x)) ^ 2)⁻¹ := summable_of_sum_range_le - (fun _ ↦ by positivity) (fun n ↦ by simpa using bound_sum_log_range bound hpos hx n) - -private lemma norm_term_mul_le (x : ℝ) (f : ℕ → ℂ) (n : ℕ) : - ‖(term f 1 n) * 𝓕 Ψ (c₀ * log (n / x))‖ ≤ - Ψ.Q * (‖f n‖ / n * (1 + (c₀ * log (n / x)) ^ 2)⁻¹) := by - convert mul_le_mul_of_nonneg_left (Ψ.norm_fourier_le_Q_mul (1 / (2 * π) * log (n / x))) +lemma summable_sum_log_range : + Summable fun n ↦ ‖f n‖ / n * (1 + ((2 * π)⁻¹ * log (n / x)) ^ 2)⁻¹ := + summable_of_sum_range_le (fun _ ↦ by positivity) + fun n ↦ by simpa using bound_sum_log_range bound hpos hx n + +lemma norm_term_mul_le (x : ℝ) (f : ℕ → ℂ) (n : ℕ) : + ‖term f 1 n * 𝓕 Ψ ((2 * π)⁻¹ * log (n / x))‖ ≤ + fourierSeminorm Ψ * (‖f n‖ / n * (1 + ((2 * π)⁻¹ * log (n / x)) ^ 2)⁻¹) := by + convert mul_le_mul_of_nonneg_left + (norm_fourier_le_fourierSeminorm_mul Ψ ((2 * π)⁻¹ * log (n / x))) (norm_nonneg (f n / n)) using 1 · simp [term_of_ne_zero'] - · simp; grind + · rw [norm_div, Complex.norm_natCast] + ring include bound hpos hx in -private theorem tendsto_S₁ : Tendsto (S₁ f · (𝓕 Ψ) x) (𝓝[>] 1) (𝓝 (S₁ f 1 (𝓕 Ψ) x)) := by - simp only [S₁] +lemma tendsto_smoothedSum : + Tendsto (smoothedSum f · (𝓕 Ψ) x) (𝓝[>] 1) (𝓝 (smoothedSum f 1 (𝓕 Ψ) x)) := by + simp only [smoothedSum] refine tendsto_tsum_of_dominated_convergence - ((summable_sum_log_range bound hpos hx).mul_left Ψ.Q) (fun n ↦ ?_) ?_ + ((summable_sum_log_range bound hpos hx).mul_left (fourierSeminorm Ψ)) (fun n ↦ ?_) ?_ · refine (Continuous.tendsto ?_ 1).mono_left nhdsWithin_le_nhds rcases eq_or_ne n 0 with rfl | hn · simpa [term] using continuous_const @@ -391,12 +397,13 @@ private theorem tendsto_S₁ : Tendsto (S₁ f · (𝓕 Ψ) x) (𝓝[>] 1) (𝓝 exact norm_term_le_of_re_le_re _ (by simpa using hσ.le) n include hx in -private theorem tendsto_S₂ : Tendsto (S₂ A · (𝓕 Ψ) x) (𝓝[>] 1) (𝓝 (S₂ A 1 (𝓕 Ψ) x)) := by +lemma tendsto_poleTerm : + Tendsto (poleTerm A · (𝓕 Ψ) x) (𝓝[>] 1) (𝓝 (poleTerm A 1 (𝓕 Ψ) x)) := by have hx₀ : 0 < x := zero_lt_one.trans_le hx apply Tendsto.mul · exact (Continuous.tendsto (by fun_prop (disch := simp [hx₀.ne'])) 1).mono_left nhdsWithin_le_nhds - refine tendsto_integral_filter_of_dominated_convergence (fun t ↦ x * ‖𝓕 Ψ (c₀ * t)‖) + refine tendsto_integral_filter_of_dominated_convergence (fun t ↦ x * ‖𝓕 Ψ ((2 * π)⁻¹ * t)‖) (.of_forall fun _ ↦ Continuous.aestronglyMeasurable (by fun_prop)) ?_ (((𝓕 Ψ).integrable.comp_mul_left' (by positivity)).norm.const_mul x).restrict (.of_forall fun t ↦ (Continuous.tendsto (by fun_prop) 1).mono_left nhdsWithin_le_nhds) @@ -409,10 +416,11 @@ private theorem tendsto_S₂ : Tendsto (S₂ A · (𝓕 Ψ) x) (𝓝[>] 1) (𝓝 _ = x := exp_log hx₀ include hG hΨ hx in -private theorem tendsto_integral_G_mul : +lemma tendsto_integral_G_mul : Tendsto (fun σ : ℝ ↦ ∫ t : ℝ, G (σ + t * I) * Ψ t * x ^ (t * I)) (𝓝[>] 1) (𝓝 (∫ t : ℝ, G (1 + t * I) * Ψ t * x ^ (t * I))) := by - have hcpow := continuous_cpow_mul_I (zero_lt_one.trans_le hx) + have hcpow : Continuous fun t : ℝ ↦ (x : ℂ) ^ (t * I) := by + fun_prop (disch := simp [(zero_lt_one.trans_le hx).ne']) have hGc : Continuous fun p : ℝ × ℝ ↦ G (max p.1 1 + p.2 * I) := hG.comp_continuous (by fun_prop) fun p ↦ by simp have hF : Continuous (uncurry fun σ t : ℝ ↦ G (max σ 1 + t * I) * Ψ t * x ^ (t * I)) := @@ -429,15 +437,16 @@ private theorem tendsto_integral_G_mul : simp only [max_eq_left hσ.le] include bound hG hG' hpos hΨ in -private lemma tendsto_S_one_fourier_of_hasCompactSupport : - Tendsto (S f A 1 (𝓕 Ψ)) atTop (𝓝 0) := by - apply (tendsto_integral_mul_cpow_mul_I (ψ := fun t ↦ G (1 + t * I) * (Ψ t))).congr' +lemma tendsto_remainder_one_fourier_of_hasCompactSupport : + Tendsto (remainder f A 1 (𝓕 Ψ)) atTop (𝓝 0) := by + apply (tendsto_integral_mul_cpow_mul_I (ψ := fun t ↦ G (1 + t * I) * Ψ t)).congr' filter_upwards [eventually_ge_atTop 1] with x hx - rw [S] - apply (tendsto_nhds_unique_of_eventuallyEq ((tendsto_S₁ bound hpos Ψ hx).sub (tendsto_S₂ Ψ hx)) - (tendsto_integral_G_mul hG Ψ hΨ hx) _).symm - exact (eventuallyEq_nhdsWithin_iff.mpr (.of_forall fun σ hσ ↦ - sum_term_mul_sub_mul_integral_eq bound hG hG' hpos (by linarith) hΨ hσ)) + rw [remainder] + refine (tendsto_nhds_unique_of_eventuallyEq + ((tendsto_smoothedSum bound hpos Ψ hx).sub (tendsto_poleTerm Ψ hx)) + (tendsto_integral_G_mul hG Ψ hΨ hx) ?_).symm + exact eventuallyEq_nhdsWithin_iff.mpr <| .of_forall fun σ hσ ↦ + remainder_fourier_eq bound hG hG' hpos (by linarith) hΨ hσ end LimitingFourierIdentity @@ -445,70 +454,77 @@ section LimitingFourierIdentitySchwartz variable (Ψ φ φ' : 𝓢(ℝ, ℂ)) {x : ℝ} (hx : 1 ≤ x) -private lemma norm_setIntegral_fourier_le (x : ℝ) : - ‖∫ u in Ici (-log x), 𝓕 Ψ (c₀ * u)‖ ≤ Ψ.Q * ∫ u, (1 + (c₀ * u) ^ 2)⁻¹ := by - have hint : Integrable fun u : ℝ ↦ Ψ.Q * (1 + (c₀ * u) ^ 2)⁻¹ := +lemma norm_setIntegral_fourier_le (x : ℝ) : + ‖∫ u in Ici (-log x), 𝓕 Ψ ((2 * π)⁻¹ * u)‖ ≤ + fourierSeminorm Ψ * ∫ u, (1 + ((2 * π)⁻¹ * u) ^ 2)⁻¹ := by + have hint : Integrable fun u : ℝ ↦ fourierSeminorm Ψ * (1 + ((2 * π)⁻¹ * u) ^ 2)⁻¹ := (integrable_inv_one_add_sq.comp_mul_left' (by positivity)).const_mul _ rw [← integral_const_mul] exact (norm_integral_le_of_norm_le hint.integrableOn - (.of_forall fun u ↦ Ψ.norm_fourier_le_Q_mul _)).trans - (setIntegral_le_integral hint (.of_forall fun _ ↦ mul_nonneg Ψ.Q_nonneg (by positivity))) + (.of_forall fun u ↦ norm_fourier_le_fourierSeminorm_mul Ψ _)).trans + (setIntegral_le_integral hint + (.of_forall fun _ ↦ mul_nonneg (fourierSeminorm_nonneg Ψ) (by positivity))) include bound hpos hx in -private lemma summable_term_mul : Summable fun n ↦ ‖(term ↗f 1 n) * 𝓕 Ψ (c₀ * log (n / x))‖ := +lemma summable_term_mul : Summable fun n ↦ ‖term ↗f 1 n * 𝓕 Ψ ((2 * π)⁻¹ * log (n / x))‖ := .of_nonneg_of_le (fun _ ↦ norm_nonneg _) (norm_term_mul_le Ψ x ↗f) - (by simpa using (summable_sum_log_range bound hpos hx).const_smul Ψ.Q) + (by simpa using (summable_sum_log_range bound hpos hx).const_smul (fourierSeminorm Ψ)) include bound hpos hx in -/-- The map `φ ↦ S f A 1 (𝓕 φ) x` is linear in the test function. -/ -private lemma S_one_sub : S f A 1 (𝓕 (φ - φ')) x = S f A 1 (𝓕 φ) x - S f A 1 (𝓕 φ') x := by +/-- The map `φ ↦ remainder f A 1 (𝓕 φ) x` is linear in the test function. -/ +lemma remainder_one_fourier_sub : + remainder f A 1 (𝓕 (φ - φ')) x = remainder f A 1 (𝓕 φ) x - remainder f A 1 (𝓕 φ') x := by have hs (ψ : 𝓢(ℝ, ℂ)) := (summable_term_mul bound hpos ψ hx).of_norm - have hi (ψ : 𝓢(ℝ, ℂ)) : IntegrableOn (fun u ↦ 𝓕 ψ (c₀ * u)) (Ici (-log x)) := + have hi (ψ : 𝓢(ℝ, ℂ)) : IntegrableOn (fun u ↦ 𝓕 ψ ((2 * π)⁻¹ * u)) (Ici (-log x)) := ((𝓕 ψ).integrable.comp_mul_left' (by positivity)).integrableOn - simp only [S, S₁, S₂_one, fourier_sub, sub_apply, mul_sub, ofReal_one] + simp only [remainder, smoothedSum, poleTerm_one, fourier_sub, sub_apply, mul_sub, ofReal_one] rw [Summable.tsum_sub (hs φ) (hs φ'), integral_sub (hi φ) (hi φ')] ring include bound hpos in -/-- `φ ↦ S f A 1 (𝓕 φ) x` is bounded by a multiple of the seminorm `φ.Q`, uniformly in `x ≥ 1`. -/ -private lemma exists_norm_S_one_le : - ∃ K, ∀ (φ : 𝓢(ℝ, ℂ)) {x : ℝ}, 1 ≤ x → ‖S f A 1 (𝓕 φ) x‖ ≤ φ.Q * K := by - refine ⟨C * C₀ + |A| * ∫ u, (1 + (c₀ * u) ^ 2)⁻¹, fun φ x hx ↦ ?_⟩ - have h₁ : ‖S₁ f 1 (𝓕 φ) x‖ ≤ φ.Q * (C * C₀) := by - rw [S₁, ofReal_one] +/-- `φ ↦ remainder f A 1 (𝓕 φ) x` is bounded by a multiple of the seminorm `fourierSeminorm φ`, +uniformly in `x ≥ 1`. -/ +lemma exists_norm_remainder_one_le : + ∃ K, ∀ (φ : 𝓢(ℝ, ℂ)) {x : ℝ}, 1 ≤ x → ‖remainder f A 1 (𝓕 φ) x‖ ≤ fourierSeminorm φ * K := by + refine ⟨C * (1 + ∫ t in Ioi 0, weight t) + |A| * ∫ u, (1 + ((2 * π)⁻¹ * u) ^ 2)⁻¹, + fun φ x hx ↦ ?_⟩ + have h₁ : ‖smoothedSum f 1 (𝓕 φ) x‖ ≤ + fourierSeminorm φ * (C * (1 + ∫ t in Ioi 0, weight t)) := by + rw [smoothedSum, ofReal_one] refine (norm_tsum_le_tsum_norm (summable_term_mul bound hpos φ hx)).trans ?_ calc - _ ≤ ∑' n, φ.Q * (‖f n‖ / n * (1 + (c₀ * log (n / x)) ^ 2)⁻¹) := + _ ≤ ∑' n, fourierSeminorm φ * (‖f n‖ / n * (1 + ((2 * π)⁻¹ * log (n / x)) ^ 2)⁻¹) := (summable_term_mul bound hpos φ hx).tsum_mono ((summable_sum_log_range bound hpos hx).mul_left _) fun n ↦ (norm_term_mul_le φ x ↗f n).trans_eq (by simp) _ ≤ _ := by rw [tsum_mul_left] exact mul_le_mul_of_nonneg_left (tsum_le_of_sum_range_le (fun _ ↦ by positivity) - (bound_sum_log_range bound hpos hx)) φ.Q_nonneg - have h₂ : ‖S₂ A 1 (𝓕 φ) x‖ ≤ φ.Q * (|A| * ∫ u, (1 + (c₀ * u) ^ 2)⁻¹) := by - simp only [S₂_one, norm_mul, norm_real, norm_eq_abs] + (bound_sum_log_range bound hpos hx)) (fourierSeminorm_nonneg φ) + have h₂ : ‖poleTerm A 1 (𝓕 φ) x‖ ≤ + fourierSeminorm φ * (|A| * ∫ u, (1 + ((2 * π)⁻¹ * u) ^ 2)⁻¹) := by + simp only [poleTerm_one, norm_mul, norm_real, norm_eq_abs] exact (mul_le_mul_of_nonneg_left (norm_setIntegral_fourier_le φ x) (abs_nonneg A)).trans_eq (by ring) - rw [S] + rw [remainder] exact (norm_sub_le _ _).trans ((add_le_add h₁ h₂).trans_eq (mul_add ..).symm) include bound hG hG' hpos in -private lemma tendsto_S_one_fourier : Tendsto (S f A 1 (𝓕 Ψ)) atTop (𝓝 0) := by - obtain ⟨K, hK⟩ := exists_norm_S_one_le (A := A) bound hpos +lemma tendsto_remainder_one_fourier : Tendsto (remainder f A 1 (𝓕 Ψ)) atTop (𝓝 0) := by + obtain ⟨K, hK⟩ := exists_norm_remainder_one_le (A := A) bound hpos refine Metric.tendsto_nhds.mpr fun ε hε ↦ ?_ obtain ⟨φ, hφQ : _ < ε / 2, hφcs⟩ := SchwartzMap.dense_hasCompactSupport.inter_open_nonempty - {φ | (Ψ - φ).Q * K < ε / 2} - (isOpen_lt ((SchwartzMap.continuous_Q.comp (by fun_prop)).mul continuous_const) + {φ | fourierSeminorm (Ψ - φ) * K < ε / 2} + (isOpen_lt ((continuous_fourierSeminorm.comp (by fun_prop)).mul continuous_const) continuous_const) - ⟨Ψ, by simpa [Q] using half_pos hε⟩ + ⟨Ψ, by simpa [fourierSeminorm] using half_pos hε⟩ filter_upwards [eventually_ge_atTop 1, Metric.tendsto_nhds.mp - (tendsto_S_one_fourier_of_hasCompactSupport bound hG hG' hpos φ hφcs) (ε / 2) + (tendsto_remainder_one_fourier_of_hasCompactSupport bound hG hG' hpos φ hφcs) (ε / 2) (half_pos hε)] with x hx hφ rw [dist_zero_right] at hφ ⊢ calc - _ = ‖S f A 1 (𝓕 (Ψ - φ)) x + S f A 1 (𝓕 φ) x‖ := by - rw [S_one_sub bound hpos Ψ φ hx, sub_add_cancel] + _ = ‖remainder f A 1 (𝓕 (Ψ - φ)) x + remainder f A 1 (𝓕 φ) x‖ := by + rw [remainder_one_fourier_sub bound hpos Ψ φ hx, sub_add_cancel] _ < _ := by grw [norm_add_le, hφ, hK (Ψ - φ) hx, hφQ]; grind end LimitingFourierIdentitySchwartz @@ -519,18 +535,11 @@ variable {ψ : ℝ → ℂ} (hsmooth : ContDiff ℝ ∞ ψ) (hsupp : HasCompactS (hplus : tsupport ψ ⊆ Ioi 0) include hplus in -private lemma eventually_eq_zero_of_tsupport_subset : ∀ᶠ x in 𝓝 0, ψ x = 0 := +lemma eventually_eq_zero_of_tsupport_subset_Ioi : ∀ᶠ x in 𝓝 0, ψ x = 0 := notMem_tsupport_iff_eventuallyEq.mp (fun h ↦ lt_irrefl 0 <| mem_Ioi.mp (hplus h)) -include hsupp hplus in -private theorem hasCompactSupport_comp_exp : HasCompactSupport (ψ ∘ rexp) := by - simp only [hasCompactSupport_iff_eventuallyEq, coclosedCompact_eq_cocompact, - cocompact_eq_atBot_atTop] at hsupp ⊢ - exact ⟨tendsto_exp_atBot <| eventually_eq_zero_of_tsupport_subset hplus, - tendsto_exp_atTop hsupp.2⟩ - /-- If `ψ` vanishes near `0`, then eventually `∫ y in Ioi x⁻¹, ψ y = ∫ y in Ioi 0, ψ y`. -/ -private lemma eventually_setIntegral_Ioi_inv_eq (hψ : ∀ᶠ x in 𝓝 0, ψ x = 0) : +lemma eventually_setIntegral_Ioi_inv_eq (hψ : ∀ᶠ x in 𝓝 0, ψ x = 0) : ∀ᶠ x : ℝ in atTop, ∫ y in Ioi x⁻¹, ψ y = ∫ y in Ioi 0, ψ y := by obtain ⟨ε, hε, h⟩ := Metric.eventually_nhds_iff.mp hψ filter_upwards [eventually_gt_atTop ε⁻¹] with x hx @@ -539,15 +548,16 @@ private lemma eventually_setIntegral_Ioi_inv_eq (hψ : ∀ᶠ x in 𝓝 0, ψ x grw [Real.dist_eq, sub_zero, abs_of_pos hy, not_lt.mp hy', inv_lt_of_inv_lt₀ hε hx] include hsmooth hsupp hplus in -/-- `y ↦ y * ψ y`, written in the variable `c₀ * log y`, is a Fourier transform. -/ -private lemma exists_fourier_eq : ∃ g : 𝓢(ℝ, ℂ), ∀ y > 0, 𝓕 g (c₀ * log y) = y * ψ y := by +/-- `y ↦ y * ψ y`, written in the variable `(2 * π)⁻¹ * log y`, is a Fourier transform. -/ +lemma exists_fourier_eq : ∃ g : 𝓢(ℝ, ℂ), ∀ y > 0, 𝓕 g ((2 * π)⁻¹ * log y) = y * ψ y := by let h x := rexp (2 * π * x) * ψ (exp (2 * π * x)) - have h1 : ContDiff ℝ ∞ h := by - have : ContDiff ℝ ∞ fun x ↦ rexp (2 * π * x) := (contDiff_const.mul contDiff_id).exp + have hh : ContDiff ℝ ∞ h := by + have : ContDiff ℝ ∞ fun x ↦ rexp (2 * π * x) := by fun_prop exact (ofRealCLM.contDiff.comp this).mul (hsmooth.comp this) - have h2 : HasCompactSupport h := by - simpa using! (hasCompactSupport_comp_exp hsupp hplus).comp_smul two_pi_pos.ne' |>.mul_left - refine ⟨𝓕⁻ (h2.toSchwartzMap h1), fun y hy ↦ ?_⟩ + have hh' : HasCompactSupport h := by + have := (hsupp.comp_exp fun h₀ ↦ lt_irrefl 0 (hplus h₀)).comp_smul two_pi_pos.ne' + simpa using! this.mul_left + refine ⟨𝓕⁻ (hh'.toSchwartzMap hh), fun y hy ↦ ?_⟩ simp only [fourier_fourierInv_eq, HasCompactSupport.toSchwartzMap_toFun, h] field_simp rw [exp_log hy] @@ -560,15 +570,15 @@ asymptotically with respect to smooth weights with compact support in `(0, ∞)` lemma tendsto_sum_div_smooth : Tendsto (fun x ↦ (∑' n, f n * ψ (n / x)) / x) atTop (𝓝 (A * ∫ y in Ioi 0, ψ y)) := by obtain ⟨g, hg⟩ := exists_fourier_eq hsmooth hsupp hplus - have h3 : ∀ᶠ x in atTop, - S f A 1 (𝓕 g) x = ∑' n, f n * ψ (n / x) / x - A * ∫ y in Ioi 0, ψ y := by + have key : ∀ᶠ x in atTop, + remainder f A 1 (𝓕 g) x = ∑' n, f n * ψ (n / x) / x - A * ∫ y in Ioi 0, ψ y := by filter_upwards [eventually_gt_atTop 0, eventually_setIntegral_Ioi_inv_eq - (eventually_eq_zero_of_tsupport_subset hplus)] with x hx hint - simp only [S, S₁, S₂_one, ← hint, ofReal_one] + (eventually_eq_zero_of_tsupport_subset_Ioi hplus)] with x hx hint + simp only [remainder, smoothedSum, poleTerm_one, ← hint, ofReal_one] congr 1 · refine tsum_congr fun n ↦ ?_ rcases eq_or_ne n 0 with rfl | hn - · simp [(eventually_eq_zero_of_tsupport_subset hplus).self_of_nhds] + · simp [(eventually_eq_zero_of_tsupport_subset_Ioi hplus).self_of_nhds] rw [hg _ (by positivity)] simp [term, hn, field] · rw [integral_Ici_eq_integral_Ioi, show x⁻¹ = rexp (-log x) by rw [Real.exp_neg, exp_log hx], @@ -576,7 +586,7 @@ lemma tendsto_sum_div_smooth : Tendsto (fun x ↦ (∑' n, f n * ψ (n / x)) / x exact congr(_ * $(setIntegral_congr_fun measurableSet_Ioi fun u _ ↦ by rw [real_smul, ← hg _ (exp_pos u), Real.log_exp])) simpa [tendsto_sub_nhds_zero_iff, tsum_div_const] using - (tendsto_S_one_fourier bound hG hG' hpos g).congr' h3 + (tendsto_remainder_one_fourier bound hG hG' hpos g).congr' key include bound hG hG' hpos in /-- A version of smoothed Wiener-Ikehara for real-valued cutoffs. -/ @@ -584,49 +594,53 @@ lemma tendsto_sum_div_smooth_real {Ψ : ℝ → ℝ} (hsmooth : ContDiff ℝ ∞ (hsupp : HasCompactSupport Ψ) (hplus : tsupport Ψ ⊆ Ioi 0) : Tendsto (fun x ↦ (∑' n, f n * Ψ (n / x)) / x) atTop (𝓝 (A * ∫ y in Ioi 0, Ψ y)) := by have := (continuous_re.tendsto _).comp (tendsto_sum_div_smooth bound hG hG' hpos - (ofRealCLM.contDiff.comp hsmooth) (hsupp.comp_left rfl) - (by rwa [tsupport, support_comp_eq]; simp)) - simp at this; norm_cast at this + (ofRealCLM.contDiff.comp hsmooth) (hsupp.comp_left rfl) + (by rwa [tsupport, support_comp_eq]; simp)) + simp only [comp_apply, ofRealCLM_apply, mul_re, ofReal_re, ofReal_im, zero_mul, sub_zero] at this + exact_mod_cast this end Smooth /-- A smooth Urysohn lemma for cutoffs supported away from the origin, additionally controlling the integral of the cutoff from above and below by the lengths of `Ioo a d` and `Icc b c` respectively. -/ -private lemma exists_cutoff {a b c d : ℝ} (ha : 0 < a) (hab : a < b) (hbc : b ≤ c) (hcd : c < d) : +lemma exists_smooth_cutoff {a b c d : ℝ} (ha : 0 < a) (hab : a < b) (hbc : b ≤ c) (hcd : c < d) : ∃ ψ, ContDiff ℝ ∞ ψ ∧ HasCompactSupport ψ ∧ tsupport ψ ⊆ Ioi 0 ∧ indicator (Icc b c) 1 ≤ ψ ∧ ψ ≤ indicator (Ioo a d) 1 ∧ c - b ≤ ∫ y in Ioi 0, ψ y ∧ ∫ y in Ioi 0, ψ y ≤ d - a := by - obtain ⟨ψ, h1, h2, h3, h4⟩ := exists_contDiff_support_eq_eq_one_iff + obtain ⟨ψ, hψ, hrange, hsupp, hone⟩ := exists_contDiff_support_eq_eq_one_iff isOpen_Ioo isClosed_Icc (Icc_subset_Ioo hab hcd) - have h5 := HasCompactSupport.of_support_subset_isCompact isCompact_Icc - (h3 ▸ Ioo_subset_Icc_self) - have h6 := indicator_le' (fun x hx ↦ ((h4 x).mp hx).ge) fun x _ ↦ (h2 (mem_range_self x)).1 - have h7 : ψ ≤ indicator (Ioo a d) 1 := fun x ↦ le_indicator_apply - (fun _ ↦ (h2 (mem_range_self x)).2) (by grind) - have h8 : tsupport ψ ⊆ Ioi 0 := by grind [tsupport, closure_Ioo] - have h9 : Integrable ψ := h1.continuous.integrable_of_hasCompactSupport h5 - have h10 : ∫ y in Ioi 0, ψ y = _ := setIntegral_eq_integral_of_forall_compl_eq_zero fun x hx ↦ - notMem_support.1 fun h ↦ hx (h8 (subset_tsupport _ h)) - have h11 {s} (hs : MeasurableSet s) (hs' : volume s ≠ ⊤) : Integrable (indicator s (1 : ℝ → ℝ)) - := (integrable_indicator_iff hs).2 (integrableOn_const hs' (by simp)) - refine ⟨ψ, h1, h5, h8, h6, h7, ?_, ?_⟩ - · rw [h10, ← volume_real_Icc_of_le hbc, ← integral_indicator_one measurableSet_Icc] - exact integral_mono (h11 measurableSet_Icc (by simp)) h9 h6 - · rw [h10, ← volume_real_Ioo_of_le (by order), ← integral_indicator_one measurableSet_Ioo] - exact integral_mono h9 (h11 measurableSet_Ioo (by simp)) h7 + have hcs : HasCompactSupport ψ := + .of_support_subset_isCompact isCompact_Icc (hsupp ▸ Ioo_subset_Icc_self) + have hle : indicator (Icc b c) 1 ≤ ψ := + indicator_le' (fun x hx ↦ ((hone x).mp hx).ge) fun x _ ↦ (hrange (mem_range_self x)).1 + have hle' : ψ ≤ indicator (Ioo a d) 1 := fun x ↦ + le_indicator_apply (fun _ ↦ (hrange (mem_range_self x)).2) (by grind) + have hts : tsupport ψ ⊆ Ioi 0 := by grind [tsupport, closure_Ioo] + have hint : Integrable ψ := hψ.continuous.integrable_of_hasCompactSupport hcs + have hI : ∫ y in Ioi 0, ψ y = ∫ y, ψ y := + setIntegral_eq_integral_of_forall_compl_eq_zero fun x hx ↦ + notMem_support.1 fun h ↦ hx (hts (subset_tsupport _ h)) + have hind {s} (hs : MeasurableSet s) (hs' : volume s ≠ ⊤) : + Integrable (indicator s (1 : ℝ → ℝ)) := + (integrable_indicator_iff hs).2 (integrableOn_const hs' (by simp)) + refine ⟨ψ, hψ, hcs, hts, hle, hle', ?_, ?_⟩ + · rw [hI, ← volume_real_Icc_of_le hbc, ← integral_indicator_one measurableSet_Icc] + exact integral_mono (hind measurableSet_Icc (by simp)) hint hle + · rw [hI, ← volume_real_Ioo_of_le (by order), ← integral_indicator_one measurableSet_Ioo] + exact integral_mono hint (hind measurableSet_Ioo (by simp)) hle' include hpos bound hG hG' in -private lemma A_nonneg : 0 ≤ A := by - obtain ⟨ψ, h1, h2, h3, h4, -, h6, -⟩ := - exists_cutoff one_pos one_lt_two (by norm_num : (2 : ℝ) ≤ 3) (by norm_num : (3 : ℝ) < 4) - have hψ (y : ℝ) : 0 ≤ ψ y := (indicator_nonneg (fun _ _ ↦ zero_le_one) y).trans (h4 y) +lemma A_nonneg : 0 ≤ A := by + obtain ⟨ψ, hψ, hcs, hts, hle, -, hint, -⟩ := + exists_smooth_cutoff one_pos one_lt_two (by norm_num : (2 : ℝ) ≤ 3) (by norm_num : (3 : ℝ) < 4) + have hψ₀ (y : ℝ) : 0 ≤ ψ y := (indicator_nonneg (fun _ _ ↦ zero_le_one) y).trans (hle y) refine nonneg_of_mul_nonneg_left (ge_of_tendsto - (tendsto_sum_div_smooth_real bound hG hG' hpos h1 h2 h3) ?_) (by linarith) + (tendsto_sum_div_smooth_real bound hG hG' hpos hψ hcs hts) ?_) (by linarith) filter_upwards [eventually_ge_atTop 0] with x hx - exact div_nonneg (tsum_nonneg fun n ↦ mul_nonneg (hpos n) (hψ _)) hx + exact div_nonneg (tsum_nonneg fun n ↦ mul_nonneg (hpos n) (hψ₀ _)) hx -private lemma summable_mul {x : ℝ} {g : ℝ → ℝ} (hg : HasCompactSupport g) (hx : 0 < x) : +lemma summable_mul_comp_div {x : ℝ} {g : ℝ → ℝ} (hg : HasCompactSupport g) (hx : 0 < x) : Summable fun n ↦ f n * g (n / x) := by obtain ⟨M, hM⟩ := hg.bddAbove.mono subset_closure apply summable_of_hasFiniteSupport @@ -635,57 +649,59 @@ private lemma summable_mul {x : ℝ} {g : ℝ → ℝ} (hg : HasCompactSupport g rw [finite_iff_bddAbove] exact ⟨Nat.ceil (M * x), fun i hi ↦ by simpa using Nat.ceil_mono ((div_le_iff₀ hx).mp (hM hi))⟩ -private lemma hasCompactSupport_indicator_Ico (u v : ℝ) : - HasCompactSupport (indicator (Ico u v) (1 : ℝ → ℝ)) := - .of_support_subset_isCompact isCompact_Icc (support_indicator_subset.trans Ico_subset_Icc_self) - -private lemma tsum_mul_indicator_Ico {N : ℕ} (hN : (0 : ℝ) < N) (u : ℝ) : - ∑' n, f n * (indicator (Ico u 1) 1 (n / N)) = ∑ i ∈ .Ico ⌈u * N⌉₊ N, f i := by +lemma tsum_mul_indicator_Ico {N : ℕ} (hN : (0 : ℝ) < N) (u : ℝ) : + ∑' n, f n * indicator (Ico u 1) 1 (n / N) = ∑ i ∈ .Ico ⌈u * N⌉₊ N, f i := by rw [tsum_eq_sum (s := .Ico ⌈u * N⌉₊ N)] · apply Finset.sum_congr rfl simp +contextual [Nat.ceil_le, le_div_iff₀, div_lt_iff₀, hN] · simp +contextual [Nat.ceil_le, le_div_iff₀, div_lt_iff₀, hN] include bound hG hG' hpos in -private lemma eventually_lt_sum_range_div {c : ℝ} (hc : c < A) : +lemma eventually_lt_sum_range_div {c : ℝ} (hc : c < A) : ∀ᶠ N : ℕ in atTop, c < (∑ i ∈ .range N, f i) / N := by - have hg : ∀ᶠ ε in 𝓝[>] (0 : ℝ), c < _ := (by fun_prop : ContinuousWithinAt - (fun ε ↦ A * (1 - 3 * ε)) (Ioi 0) 0) (Ioi_mem_nhds (by grind)) - obtain ⟨ε, _, hε, _⟩ := (hg.and (Ioc_mem_nhdsGT (by norm_num : (0 : ℝ) < 1/3))).exists - obtain ⟨ψ, h1, h2, h3, -, h5, _, -⟩ := exists_cutoff hε (by linarith : ε < 2 * ε) + have hg : ∀ᶠ ε in 𝓝[>] (0 : ℝ), c < A * (1 - 3 * ε) := by + have : ContinuousWithinAt (fun ε ↦ A * (1 - 3 * ε)) (Ioi 0) 0 := by fun_prop + exact this (Ioi_mem_nhds (by grind)) + obtain ⟨ε, hcε, hε, hε'⟩ := (hg.and (Ioc_mem_nhdsGT (by norm_num : (0 : ℝ) < 1 / 3))).exists + obtain ⟨ψ, hψ, hcs, hts, -, hle, hint, -⟩ := exists_smooth_cutoff hε (by linarith : ε < 2 * ε) (by linarith) (by linarith : 1 - ε < 1) - filter_upwards [(tendsto_sum_div_smooth_real bound hG hG' hpos h1 h2 h3).comp + filter_upwards [(tendsto_sum_div_smooth_real bound hG hG' hpos hψ hcs hts).comp tendsto_natCast_atTop_atTop (Ioi_mem_nhds (by nlinarith [A_nonneg bound hG hG' hpos]) - (a := c)), eventually_gt_atTop 0] with N hN1 _ - have : (0 : ℝ) < N := by norm_cast - refine hN1.trans_le ?_ + (a := c)), eventually_gt_atTop 0] with N hN _ + have hN₀ : (0 : ℝ) < N := by norm_cast + refine hN.trans_le ?_ simp only [comp_apply] - grw [(h5.trans (indicator_le_indicator_of_subset (by grind : Ioo ε 1 ⊆ Ico 0 1) (by simp))) _, - tsum_mul_indicator_Ico this, zero_mul, Nat.ceil_zero, Nat.Ico_zero_eq_range] - exacts [hpos _, summable_mul h2 this, summable_mul (hasCompactSupport_indicator_Ico 0 1) this] + grw [(hle.trans (indicator_le_indicator_of_subset (by grind : Ioo ε 1 ⊆ Ico 0 1) (by simp))) _, + tsum_mul_indicator_Ico hN₀, zero_mul, Nat.ceil_zero, Nat.Ico_zero_eq_range] + exacts [hpos _, summable_mul_comp_div hcs hN₀, summable_mul_comp_div + (hasCompactSupport_indicator (isCompact_Icc.closure_of_subset Ico_subset_Icc_self)) hN₀] include bound hG hG' hpos in -private lemma eventually_sum_range_div_lt {c : ℝ} (hc : A < c) : +lemma eventually_sum_range_div_lt {c : ℝ} (hc : A < c) : ∀ᶠ N : ℕ in atTop, (∑ i ∈ .range N, f i) / N < c := by - have hg : ∀ᶠ ε in 𝓝[>] (0 : ℝ), _ < c := (by fun_prop : ContinuousWithinAt - (fun ε ↦ A + 2 * C * ε + ε) (Ioi 0) 0) (Iio_mem_nhds (by grind)) - obtain ⟨ε, _, hε, _⟩ := (hg.and (Ioc_mem_nhdsGT (by norm_num : (0 : ℝ) < 1 / 4))).exists - obtain ⟨ψ, h1, h2, h3, h4, -, -, _⟩ := exists_cutoff hε (by linarith : ε < 2 * ε) + have hg : ∀ᶠ ε in 𝓝[>] (0 : ℝ), A + 2 * C * ε + ε < c := by + have : ContinuousWithinAt (fun ε ↦ A + 2 * C * ε + ε) (Ioi 0) 0 := by fun_prop + exact this (Iio_mem_nhds (by grind)) + obtain ⟨ε, hcε, hε, hε'⟩ := (hg.and (Ioc_mem_nhdsGT (by norm_num : (0 : ℝ) < 1 / 4))).exists + obtain ⟨ψ, hψ, hcs, hts, hle, -, -, hint⟩ := exists_smooth_cutoff hε (by linarith : ε < 2 * ε) (by linarith) (by linarith : 1 < 1 + ε) have hcψ : A * ∫ y in Ioi 0, ψ y < c - 2 * C * ε - ε := by nlinarith [A_nonneg bound hG hG' hpos] - filter_upwards [(tendsto_sum_div_smooth_real bound hG hG' hpos h1 h2 h3).comp + filter_upwards [(tendsto_sum_div_smooth_real bound hG hG' hpos hψ hcs hts).comp tendsto_natCast_atTop_atTop (Iio_mem_nhds hcψ), eventually_gt_atTop 0, - (tendsto_const_div_atTop_nhds_zero_nat C).eventually (gt_mem_nhds hε)] with N hN1 _ hN3 - have hN : (0 : ℝ) < N := by norm_cast + (tendsto_const_div_atTop_nhds_zero_nat C).eventually (gt_mem_nhds hε)] with N hN _ hN' + have hN₀ : (0 : ℝ) < N := by norm_cast grw [← Finset.sum_range_add_sum_Ico _ (by rw [Nat.ceil_le]; nlinarith : ⌈2 * ε * N⌉₊ ≤ N), - add_div, ← tsum_mul_indicator_Ico hN, ((indicator_le_indicator_of_subset Ico_subset_Icc_self - (by simp)).trans h4) _, (by exact hN1 : (∑' n, f n * ψ (n / N)) / N < _), - bound, Nat.ceil_lt_add_one, mul_add, add_div, mul_one, hN3] - · field_simp; grind + add_div, ← tsum_mul_indicator_Ico hN₀, ((indicator_le_indicator_of_subset Ico_subset_Icc_self + (by simp)).trans hle) _, (by exact hN : (∑' n, f n * ψ (n / N)) / N < _), + bound, Nat.ceil_lt_add_one, mul_add, add_div, mul_one, hN'] + · field_simp + grind · exact C_nonneg bound hpos · positivity - exacts [hpos _, summable_mul (hasCompactSupport_indicator_Ico _ _) hN, summable_mul h2 hN] + exacts [hpos _, summable_mul_comp_div + (hasCompactSupport_indicator (isCompact_Icc.closure_of_subset Ico_subset_Icc_self)) hN₀, + summable_mul_comp_div hcs hN₀] include bound hG hG' hpos in /-- The *Wiener-Ikehara Tauberian Theorem*, summing over naturals `n < N`; see diff --git a/Mathlib/Topology/Algebra/Support.lean b/Mathlib/Topology/Algebra/Support.lean index d44b0bffaebeb0..f5d2e990a95374 100644 --- a/Mathlib/Topology/Algebra/Support.lean +++ b/Mathlib/Topology/Algebra/Support.lean @@ -246,6 +246,11 @@ theorem of_mulSupport_subset_isCompact [R1Space α] (hK : IsCompact K) (h : mulS HasCompactMulSupport f := hK.closure_of_subset h +@[to_additive] +theorem _root_.hasCompactMulSupport_mulIndicator {s : Set α} (hs : IsCompact (closure s)) : + HasCompactMulSupport (s.mulIndicator f) := + hs.of_isClosed_subset isClosed_closure (closure_mono mulSupport_mulIndicator_subset) + @[to_additive] theorem isCompact (hf : HasCompactMulSupport f) : IsCompact (mulTSupport f) := hf From 584e84de5a789e29b8ddbea55a344b0f2e690897 Mon Sep 17 00:00:00 2001 From: Riccardo Brasca Date: Wed, 4 Nov 2026 09:17:59 +0100 Subject: [PATCH 02/20] better --- .../NumberTheory/LSeries/WienerIkehara.lean | 51 ++++++++----------- 1 file changed, 22 insertions(+), 29 deletions(-) diff --git a/Mathlib/NumberTheory/LSeries/WienerIkehara.lean b/Mathlib/NumberTheory/LSeries/WienerIkehara.lean index 422a2689269ec9..b947b6b06ad66a 100644 --- a/Mathlib/NumberTheory/LSeries/WienerIkehara.lean +++ b/Mathlib/NumberTheory/LSeries/WienerIkehara.lean @@ -52,7 +52,7 @@ an interval, whence the theorem (`tendsto_sum_div`). This file is adapted from the `PrimeNumberTheoremAnd` project. -/ -public noncomputable section +noncomputable section open Complex hiding log open Real MeasureTheory Filter Set FourierTransform LSeries Asymptotics SchwartzMap @@ -67,10 +67,10 @@ variable (ψ : 𝓢(ℝ, ℂ)) (u : ℝ) /-- A bespoke seminorm on Schwartz functions `ψ` controlling the decay of their Fourier transform: `‖𝓕 ψ u‖ ≤ fourierSeminorm ψ / (1 + u ^ 2)`, see `norm_fourier_le_fourierSeminorm_mul`. -/ -def fourierSeminorm : ℝ := (𝓕 ψ).seminorm ℝ 0 0 + (𝓕 ψ).seminorm ℝ 2 0 +abbrev fourierSeminorm : ℝ := (𝓕 ψ).seminorm ℝ 0 0 + (𝓕 ψ).seminorm ℝ 2 0 -lemma fourierSeminorm_nonneg : 0 ≤ fourierSeminorm ψ := - add_nonneg (apply_nonneg _ _) (apply_nonneg _ _) +lemma fourierSeminorm_nonneg : 0 ≤ fourierSeminorm ψ := by + positivity lemma continuous_fourierSeminorm : Continuous fourierSeminorm := (((schwartz_withSeminorms ℝ ℝ ℂ).continuous_seminorm (0, 0)).comp (by fun_prop)).add @@ -125,7 +125,7 @@ lemma lSeriesSummable : LSeriesSummable ↗f (σ : ℂ) := by calc _ ≤ ∑ k ∈ .range (2 * n), f k := Finset.sum_le_sum_of_subset_of_nonneg (by grind) fun k _ _ ↦ hpos k - _ ≤ _ := (bound (2 * n)).trans_eq (by push_cast; ring) + _ ≤ _ := (bound (2 * n)).trans_eq (by grind) include hx in lemma fourierChar_neg_mul_log_div {n : ℕ} (hn : n ≠ 0) (t : ℝ) : @@ -165,12 +165,12 @@ lemma mul_integral_exp_mul_fourierChar_eq (t : ℝ) : rw [integral_Ici_eq_integral_Ioi] congr with u push_cast [fourierChar_apply, ← Complex.exp_add] - congr 1 + congr field rw [this, integral_cexp_neg_mul_Ioi_neg_log hx (by simpa using hσ), ofReal_cpow hx.le, mul_div_assoc', ← cpow_add _ _ (mod_cast hx.ne')] push_cast - ring_nf + grind include hx hσ in lemma poleTerm_fourier_eq : @@ -178,8 +178,7 @@ lemma poleTerm_fourier_eq : have hint : IntegrableOn (fun u ↦ rexp (-u * (σ - 1))) (Ici (-log x)) := by rw [integrableOn_Ici_iff_integrableOn_Ioi] convert exp_neg_integrableOn_Ioi (-log x) (sub_pos.mpr hσ) using 1 - ext u - ring_nf + grind rw [poleTerm, mul_assoc] congr 1 calc @@ -212,9 +211,7 @@ lemma remainder_fourier_eq {ψ : 𝓢(ℝ, ℂ)} (hψ : HasCompactSupport ψ) { Continuous.integrable_of_hasCompactSupport (by fun_prop) hψ.mul_left.mul_right.mul_left rw [remainder, smoothedSum_fourier_eq bound hpos ψ hx hσ, poleTerm_fourier_eq ψ hx hσ, sub_eq_iff_eq_add, ← integral_const_mul, ← integral_add hint₁ hint₂] - refine integral_congr_ae (.of_forall fun t ↦ ?_) - simp only [hG' (hσt t)] - ring + exact integral_congr_ae (.of_forall fun t ↦ by grind [hG' (hσt t)]) end FourierIdentities @@ -244,7 +241,7 @@ lemma antitoneOn_weight : AntitoneOn weight (Ioi 0) := by (fun _ _ ↦ (hasDerivAt_weight (by grind)).continuousAt.continuousWithinAt) (fun _ _ ↦ (hasDerivAt_weight (fun _ ↦ by simp_all)).hasDerivWithinAt) fun x _ ↦ ?_ - have : 0 < 1 - (2 * π)⁻¹ := sub_pos.mpr (inv_lt_one_of_one_lt₀ (by linarith [two_le_pi])) + have : 0 < 1 - (2 * π)⁻¹ := by grind [two_le_pi, inv_lt_one_of_one_lt₀] simp only [neg_mul, Left.neg_nonpos_iff] positivity @@ -272,7 +269,7 @@ lemma integrableOn_inv_mul_weight_div (hx : 0 < x) : lemma inv_mul_weight_div (hx : x ≠ 0) (t : ℝ) : x⁻¹ * weight (t / x) = (t * (1 + ((2 * π)⁻¹ * log (t / x)) ^ 2))⁻¹ := by - rw [weight, ← mul_inv, ← mul_assoc, mul_div_cancel₀ t hx] + grind [weight] lemma inv_mul_weight_div_le_one (hx : x ≠ 0) (ht : 1 ≤ t) : x⁻¹ * weight (t / x) ≤ 1 := by rw [inv_mul_weight_div hx] @@ -283,10 +280,10 @@ lemma antitone_ite_weight (hx : 0 < x) : Antitone fun i : ℕ ↦ if i = 0 then (1 : ℝ) else x⁻¹ * weight (i / x) := by intro i j hij rcases eq_or_ne j 0 with rfl | hj - · simp [Nat.le_zero.mp hij] + · grind simp only [hj, ↓reduceIte] split_ifs with hi - · exact inv_mul_weight_div_le_one hx.ne' (mod_cast Nat.one_le_iff_ne_zero.mpr hj) + · exact inv_mul_weight_div_le_one hx.ne' (mod_cast by grind) · gcongr exact antitoneOn_weight (mem_Ioi.mpr (by positivity)) (mem_Ioi.mpr (by positivity)) (by gcongr) @@ -434,7 +431,7 @@ lemma tendsto_integral_G_mul : simp only [max_self, ofReal_one] at this refine (this.mono_left nhdsWithin_le_nhds).congr' ?_ filter_upwards [self_mem_nhdsWithin] with σ (hσ : 1 < σ) - simp only [max_eq_left hσ.le] + simp [max_eq_left hσ.le] include bound hG hG' hpos hΨ in lemma tendsto_remainder_one_fourier_of_hasCompactSupport : @@ -506,8 +503,7 @@ lemma exists_norm_remainder_one_le : simp only [poleTerm_one, norm_mul, norm_real, norm_eq_abs] exact (mul_le_mul_of_nonneg_left (norm_setIntegral_fourier_le φ x) (abs_nonneg A)).trans_eq (by ring) - rw [remainder] - exact (norm_sub_le _ _).trans ((add_le_add h₁ h₂).trans_eq (mul_add ..).symm) + grind [remainder, norm_sub_le] include bound hG hG' hpos in lemma tendsto_remainder_one_fourier : Tendsto (remainder f A 1 (𝓕 Ψ)) atTop (𝓝 0) := by @@ -522,10 +518,7 @@ lemma tendsto_remainder_one_fourier : Tendsto (remainder f A 1 (𝓕 Ψ)) atTop (tendsto_remainder_one_fourier_of_hasCompactSupport bound hG hG' hpos φ hφcs) (ε / 2) (half_pos hε)] with x hx hφ rw [dist_zero_right] at hφ ⊢ - calc - _ = ‖remainder f A 1 (𝓕 (Ψ - φ)) x + remainder f A 1 (𝓕 φ) x‖ := by - rw [remainder_one_fourier_sub bound hpos Ψ φ hx, sub_add_cancel] - _ < _ := by grw [norm_add_le, hφ, hK (Ψ - φ) hx, hφQ]; grind + grind [remainder_one_fourier_sub bound hpos Ψ φ hx, norm_sub_norm_le, hK (Ψ - φ) hx] end LimitingFourierIdentitySchwartz @@ -545,7 +538,7 @@ lemma eventually_setIntegral_Ioi_inv_eq (hψ : ∀ᶠ x in 𝓝 0, ψ x = 0) : filter_upwards [eventually_gt_atTop ε⁻¹] with x hx refine (setIntegral_eq_of_subset_of_forall_sdiff_eq_zero measurableSet_Ioi (Ioi_subset_Ioi (inv_pos.mpr ((inv_pos.mpr hε).trans hx)).le) fun y ⟨hy, hy'⟩ ↦ h ?_).symm - grw [Real.dist_eq, sub_zero, abs_of_pos hy, not_lt.mp hy', inv_lt_of_inv_lt₀ hε hx] + grind [Real.dist_eq, abs_of_pos, inv_lt_of_inv_lt₀ hε hx] include hsmooth hsupp hplus in /-- `y ↦ y * ψ y`, written in the variable `(2 * π)⁻¹ * log y`, is a Fourier transform. -/ @@ -560,14 +553,14 @@ lemma exists_fourier_eq : ∃ g : 𝓢(ℝ, ℂ), ∀ y > 0, 𝓕 g ((2 * π)⁻ refine ⟨𝓕⁻ (hh'.toSchwartzMap hh), fun y hy ↦ ?_⟩ simp only [fourier_fourierInv_eq, HasCompactSupport.toSchwartzMap_toFun, h] field_simp - rw [exp_log hy] + simp [exp_log hy] include bound hG hG' hpos hsmooth hsupp hplus in /-- A smoothed *Wiener-Ikehara Tauberian Theorem*: If `f` is a nonnegative arithmetic function with `∑ i < n, f i ≤ C * n` whose L-series has a simple pole at `s = 1` with residue `A` and otherwise extends continuously to the closed half-plane `re s ≥ 1`, then `f` behaves like `A` asymptotically with respect to smooth weights with compact support in `(0, ∞)`. -/ -lemma tendsto_sum_div_smooth : Tendsto (fun x ↦ (∑' n, f n * ψ (n / x)) / x) +public lemma tendsto_sum_div_smooth : Tendsto (fun x ↦ (∑' n, f n * ψ (n / x)) / x) atTop (𝓝 (A * ∫ y in Ioi 0, ψ y)) := by obtain ⟨g, hg⟩ := exists_fourier_eq hsmooth hsupp hplus have key : ∀ᶠ x in atTop, @@ -590,7 +583,7 @@ lemma tendsto_sum_div_smooth : Tendsto (fun x ↦ (∑' n, f n * ψ (n / x)) / x include bound hG hG' hpos in /-- A version of smoothed Wiener-Ikehara for real-valued cutoffs. -/ -lemma tendsto_sum_div_smooth_real {Ψ : ℝ → ℝ} (hsmooth : ContDiff ℝ ∞ Ψ) +public lemma tendsto_sum_div_smooth_real {Ψ : ℝ → ℝ} (hsmooth : ContDiff ℝ ∞ Ψ) (hsupp : HasCompactSupport Ψ) (hplus : tsupport Ψ ⊆ Ioi 0) : Tendsto (fun x ↦ (∑' n, f n * Ψ (n / x)) / x) atTop (𝓝 (A * ∫ y in Ioi 0, Ψ y)) := by have := (continuous_re.tendsto _).comp (tendsto_sum_div_smooth bound hG hG' hpos @@ -706,14 +699,14 @@ lemma eventually_sum_range_div_lt {c : ℝ} (hc : A < c) : include bound hG hG' hpos in /-- The *Wiener-Ikehara Tauberian Theorem*, summing over naturals `n < N`; see `WienerIkehara.tendsto_sum_div` for the version summing over reals `n ≤ x`. -/ -theorem tendsto_sum_range_div : Tendsto (fun N ↦ (∑ i ∈ .range N, f i) / N) atTop (𝓝 A) := +public theorem tendsto_sum_range_div : Tendsto (fun N ↦ (∑ i ∈ .range N, f i) / N) atTop (𝓝 A) := tendsto_order.mpr ⟨fun _ ↦ eventually_lt_sum_range_div bound hG hG' hpos, fun _ ↦ eventually_sum_range_div_lt bound hG hG' hpos⟩ include bound hG hG' hpos in /-- The *Wiener-Ikehara Tauberian Theorem*, summing over naturals `n ≤ x` for real `x`; see `WienerIkehara.tendsto_sum_range_div` for the version summing over naturals `n < N`. -/ -theorem tendsto_sum_div : Tendsto (fun x ↦ (∑ n ∈ .Icc 0 ⌊x⌋₊, f n) / x) atTop (𝓝 A) := by +public theorem tendsto_sum_div : Tendsto (fun x ↦ (∑ n ∈ .Icc 0 ⌊x⌋₊, f n) / x) atTop (𝓝 A) := by have : Tendsto (fun x ↦ (∑ i ∈ .range (⌊x⌋₊ + 1), f i) / (⌊x⌋₊ + 1) * ((⌊x⌋₊ + 1) / x)) atTop (𝓝 A) := by rw [← mul_one A] From cd5b698d962061775c7e28ad26081bc51564679a Mon Sep 17 00:00:00 2001 From: Riccardo Brasca Date: Wed, 4 Nov 2026 22:54:34 +0100 Subject: [PATCH 03/20] move this --- .../Topology/Algebra/InfiniteSum/Real.lean | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Mathlib/Topology/Algebra/InfiniteSum/Real.lean b/Mathlib/Topology/Algebra/InfiniteSum/Real.lean index bf94705edc398c..5f2184c7e9ae24 100644 --- a/Mathlib/Topology/Algebra/InfiniteSum/Real.lean +++ b/Mathlib/Topology/Algebra/InfiniteSum/Real.lean @@ -110,4 +110,26 @@ protected theorem Summable.tsum_lt_tsum_of_nonneg {i : ℕ} {f g : ℕ → ℝ} (h : ∀ b : ℕ, f b ≤ g b) (hi : f i < g i) (hg : Summable g) : ∑' n, f n < ∑' n, g n := Summable.tsum_lt_tsum h hi (.of_nonneg_of_le h0 h hg) hg +variable {R : Type*} [TopologicalSpace R] {g : ℝ → R} (f : ℕ → R) {x : ℝ} + +/-- If `g : ℝ → R` has compact support and `x ≠ 0`, then `n ↦ f n * g (n / x)` vanishes for all +but finitely many `n : ℕ`, hence is summable. -/ +theorem HasCompactSupport.summable_mul_natCast_div [NonUnitalNonAssocSemiring R] + (hg : HasCompactSupport g) (hx : x ≠ 0) : Summable fun n : ℕ ↦ f n * g (n / x) := by + obtain ⟨M, hM⟩ := hg.isCompact.isBounded.subset_closedBall 0 + refine summable_of_hasFiniteSupport <| (Set.finite_Iic ⌈M * |x|⌉₊).subset fun n hn ↦ ?_ + have := hM (subset_tsupport _ (right_ne_zero_of_mul hn)) + rw [Metric.mem_closedBall, Real.dist_eq, sub_zero, abs_div, Nat.abs_cast, + div_le_iff₀ (abs_pos.mpr hx)] at this + exact Nat.cast_le.mp (this.trans (Nat.le_ceil _)) + +/-- For `0 < c`, the sum of `f n` over the natural numbers `n` with `n / c ∈ [u, v)`, written as +a `tsum` against an indicator function. -/ +theorem tsum_mul_indicator_Ico_natCast_div [NonAssocSemiring R] (hx : 0 < x) (u v : ℝ) (f : ℕ → R) : + ∑' n : ℕ, f n * (Set.Ico u v).indicator 1 (n / x) = ∑ n ∈ Ico ⌈u * x⌉₊ ⌈v * x⌉₊, f n := by + rw [tsum_eq_sum (s := Ico ⌈u * x⌉₊ ⌈v * x⌉₊)] + · refine sum_congr rfl fun n hn ↦ ?_ + simp_all [Nat.ceil_le, Nat.lt_ceil, le_div_iff₀, div_lt_iff₀] + · simp +contextual [Nat.ceil_le, Nat.lt_ceil, le_div_iff₀, div_lt_iff₀, hx] + end summable From 0e7f6012e9854e1af5b369bcbb4782c37f6f45db Mon Sep 17 00:00:00 2001 From: Riccardo Brasca Date: Wed, 4 Nov 2026 22:55:26 +0100 Subject: [PATCH 04/20] better --- Mathlib/Topology/Algebra/InfiniteSum/Real.lean | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Mathlib/Topology/Algebra/InfiniteSum/Real.lean b/Mathlib/Topology/Algebra/InfiniteSum/Real.lean index 5f2184c7e9ae24..31f34baf4a396a 100644 --- a/Mathlib/Topology/Algebra/InfiniteSum/Real.lean +++ b/Mathlib/Topology/Algebra/InfiniteSum/Real.lean @@ -110,7 +110,7 @@ protected theorem Summable.tsum_lt_tsum_of_nonneg {i : ℕ} {f g : ℕ → ℝ} (h : ∀ b : ℕ, f b ≤ g b) (hi : f i < g i) (hg : Summable g) : ∑' n, f n < ∑' n, g n := Summable.tsum_lt_tsum h hi (.of_nonneg_of_le h0 h hg) hg -variable {R : Type*} [TopologicalSpace R] {g : ℝ → R} (f : ℕ → R) {x : ℝ} +variable {R : Type*} [TopologicalSpace R] {g : ℝ → R} (u v : ℝ) (f : ℕ → R) {x : ℝ} /-- If `g : ℝ → R` has compact support and `x ≠ 0`, then `n ↦ f n * g (n / x)` vanishes for all but finitely many `n : ℕ`, hence is summable. -/ @@ -125,7 +125,7 @@ theorem HasCompactSupport.summable_mul_natCast_div [NonUnitalNonAssocSemiring R] /-- For `0 < c`, the sum of `f n` over the natural numbers `n` with `n / c ∈ [u, v)`, written as a `tsum` against an indicator function. -/ -theorem tsum_mul_indicator_Ico_natCast_div [NonAssocSemiring R] (hx : 0 < x) (u v : ℝ) (f : ℕ → R) : +theorem tsum_mul_indicator_Ico_natCast_div [NonAssocSemiring R] (hx : 0 < x) : ∑' n : ℕ, f n * (Set.Ico u v).indicator 1 (n / x) = ∑ n ∈ Ico ⌈u * x⌉₊ ⌈v * x⌉₊, f n := by rw [tsum_eq_sum (s := Ico ⌈u * x⌉₊ ⌈v * x⌉₊)] · refine sum_congr rfl fun n hn ↦ ?_ From 9fa77249e917d1a59e59f07ec0ac428636faef8c Mon Sep 17 00:00:00 2001 From: Riccardo Brasca Date: Wed, 4 Nov 2026 22:57:02 +0100 Subject: [PATCH 05/20] add this --- Mathlib/Analysis/Distribution/SchwartzSpace/Basic.lean | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Mathlib/Analysis/Distribution/SchwartzSpace/Basic.lean b/Mathlib/Analysis/Distribution/SchwartzSpace/Basic.lean index 62b507cc046801..09eeb9a00df007 100644 --- a/Mathlib/Analysis/Distribution/SchwartzSpace/Basic.lean +++ b/Mathlib/Analysis/Distribution/SchwartzSpace/Basic.lean @@ -531,6 +531,10 @@ instance instLocallyConvexSpace : LocallyConvexSpace ℝ 𝓢(E, F) := instance instFirstCountableTopology : FirstCountableTopology 𝓢(E, F) := (schwartz_withSeminorms ℝ E F).firstCountableTopology +@[fun_prop] +theorem continuous_seminorm (k n : ℕ) : Continuous (SchwartzMap.seminorm 𝕜 k n : 𝓢(E, F) → ℝ) := + (schwartz_withSeminorms 𝕜 E F).continuous_seminorm (k, n) + end Topology @[fun_prop] From 2de86cdd972b3d219289ee74a009aeb6fbd9dc62 Mon Sep 17 00:00:00 2001 From: Riccardo Brasca Date: Wed, 4 Nov 2026 22:57:33 +0100 Subject: [PATCH 06/20] we also want this --- .../Integral/IntegralEqImproper.lean | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Mathlib/MeasureTheory/Integral/IntegralEqImproper.lean b/Mathlib/MeasureTheory/Integral/IntegralEqImproper.lean index 4eb25f0aabf0a4..54f351304f627b 100644 --- a/Mathlib/MeasureTheory/Integral/IntegralEqImproper.lean +++ b/Mathlib/MeasureTheory/Integral/IntegralEqImproper.lean @@ -501,6 +501,22 @@ theorem AECover.integral_eq_of_tendsto_of_nonneg_ae [l.NeBot] [l.IsCountablyGene have hfi' : Integrable f μ := hφ.integrable_of_integral_tendsto_of_nonneg_ae I hfi hnng htendsto hφ.integral_eq_of_tendsto I hfi' htendsto +/-- If `f` vanishes in a neighborhood of `a`, then `∫ x in Ioi b, f x ∂μ = ∫ x in Ioi a, f x ∂μ` +for all `b` close enough to `a`. -/ +theorem eventually_setIntegral_Ioi_eq_of_eventuallyEq_zero [LinearOrder α] [TopologicalSpace α] + [OrderTopology α] [OpensMeasurableSpace α] {f : α → E} {a : α} (hf : f =ᶠ[𝓝 a] 0) : + ∀ᶠ b in 𝓝 a, ∫ x in Ioi b, f x ∂μ = ∫ x in Ioi a, f x ∂μ := by + filter_upwards [tendsto_smallSets_iff.mp (tendsto_const_nhds.uIcc tendsto_id) _ hf] with b hb + rw [← integral_indicator measurableSet_Ioi, ← integral_indicator measurableSet_Ioi] + congr 1 with x + by_cases hx : x ∈ uIcc a b + · simp [indicator_apply, show f x = 0 from hb hx] + simp only [indicator_apply, mem_Ioi] + split_ifs with h₁ h₂ h₂ <;> first + | rfl + | exact (hx (mem_uIcc.mpr (.inr ⟨h₁.le, not_lt.mp h₂⟩))).elim + | exact (hx (mem_uIcc.mpr (.inl ⟨h₂.le, not_lt.mp h₁⟩))).elim + end Integral section IntegrableOfIntervalIntegral From 3f86c3b07065001cdf193844c293414488ca1259 Mon Sep 17 00:00:00 2001 From: Riccardo Brasca Date: Wed, 4 Nov 2026 22:58:12 +0100 Subject: [PATCH 07/20] why not --- Mathlib/NumberTheory/LSeries/SumCoeff.lean | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Mathlib/NumberTheory/LSeries/SumCoeff.lean b/Mathlib/NumberTheory/LSeries/SumCoeff.lean index fb6b036bb23e32..2f0eb900244570 100644 --- a/Mathlib/NumberTheory/LSeries/SumCoeff.lean +++ b/Mathlib/NumberTheory/LSeries/SumCoeff.lean @@ -94,6 +94,19 @@ theorem LSeriesSummable_of_sum_norm_bigO_and_nonneg LSeriesSummable (fun n ↦ f n) s := LSeriesSummable_of_sum_norm_bigO (by simpa [abs_of_nonneg (hf _)]) hr hs +/-- If `f` takes nonnegative real values and satisfies the Chebyshev-type bound +`∑ k ∈ range n, f k ≤ C * n` for all `n`, then the L-series `LSeries f` converges at `s : ℂ` +for all `s` such that `1 < s.re`. -/ +theorem LSeriesSummable_of_sum_range_le_and_nonneg {f : ℕ → ℝ} {C : ℝ} + (hO : ∀ n, ∑ k ∈ range n, f k ≤ C * n) (hf : ∀ n, 0 ≤ f n) (hs : 1 < s.re) : + LSeriesSummable (fun n ↦ f n) s := by + refine LSeriesSummable_of_sum_norm_bigO_and_nonneg (r := 1) ?_ hf zero_le_one hs + refine isBigO_of_le' (c := 2 * C) _ fun n ↦ ?_ + rw [Real.norm_of_nonneg (sum_nonneg fun k _ ↦ hf k), Real.rpow_one, Real.norm_natCast] + calc + _ ≤ ∑ k ∈ range (2 * n), f k := sum_le_sum_of_subset_of_nonneg (by grind) fun k _ _ ↦ hf k + _ ≤ _ := (hO (2 * n)).trans_eq (by grind) + end summable section integralrepresentation From 07190b94700019a89b90c07ff457eb2b2faf6411 Mon Sep 17 00:00:00 2001 From: Riccardo Brasca Date: Thu, 5 Nov 2026 07:09:04 +0100 Subject: [PATCH 08/20] add this --- .../Fourier/RiemannLebesgueLemma.lean | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Mathlib/Analysis/Fourier/RiemannLebesgueLemma.lean b/Mathlib/Analysis/Fourier/RiemannLebesgueLemma.lean index 8d1d96c0abd6d0..03c1c08cbc06d0 100644 --- a/Mathlib/Analysis/Fourier/RiemannLebesgueLemma.lean +++ b/Mathlib/Analysis/Fourier/RiemannLebesgueLemma.lean @@ -38,6 +38,8 @@ equivalence to an inner-product space. with its unique Hausdorff topological vector space structure), and `W` the dual of `V`, the function `fun w : W ↦ ∫ v : V, exp (2 * π * w v * I) • f v` tends to along `cocompact W`. - `Real.tendsto_integral_exp_smul_cocompact`: special case of functions on `ℝ`. +- `Real.tendsto_integral_cpow_mul_I_smul_atTop`: multiplicative form for functions on `ℝ`, + `∫ t, x ^ (t * I) • f t → 0` as `x → ∞`. - `Real.zero_at_infty_fourierIntegral` and `Real.zero_at_infty_vector_fourierIntegral`: reformulations explicitly using the Fourier integral. -/ @@ -212,6 +214,28 @@ theorem Real.tendsto_integral_exp_smul_cocompact (f : ℝ → E) : theorem Real.zero_at_infty_fourier (f : ℝ → E) : Tendsto (𝓕 f) (cocompact ℝ) (𝓝 0) := tendsto_integral_exp_inner_smul_cocompact f +/-- For `0 < x`, the character `t ↦ x ^ (t * I)` of `ℝ` is `t ↦ 𝐞 (t * log x / (2 * π))`. -/ +theorem Real.fourierChar_mul_log_div_two_pi {x : ℝ} (hx : 0 < x) (t : ℝ) : + (𝐞 (t * Real.log x / (2 * π)) : ℂ) = (x : ℂ) ^ (t * I) := by + rw [Real.fourierChar_apply, cpow_def_of_ne_zero (ofReal_ne_zero.mpr hx.ne'), + ← ofReal_log hx.le] + congr 1 + push_cast + field_simp + +/-- The Riemann-Lebesgue lemma for functions on `ℝ`, in multiplicative form: the integrals +`∫ t, x ^ (t * I) • f t` tend to `0` as `x → ∞`. -/ +theorem Real.tendsto_integral_cpow_mul_I_smul_atTop (f : ℝ → E) : + Tendsto (fun x : ℝ ↦ ∫ t : ℝ, (x : ℂ) ^ (t * I) • f t) atTop (𝓝 0) := by + have h : Tendsto (fun x ↦ -(Real.log x / (2 * π))) atTop (cocompact ℝ) := + (tendsto_neg_atTop_atBot.comp + (Real.tendsto_log_atTop.atTop_div_const (by positivity))).mono_right atBot_le_cocompact + refine ((Real.zero_at_infty_fourier f).comp h).congr' ?_ + filter_upwards [eventually_gt_atTop 0] with x hx + simp only [Function.comp_apply, Real.fourier_real_eq] + refine integral_congr_ae (.of_forall fun t ↦ ?_) + simp [← mul_div_assoc, Circle.smul_def, Real.fourierChar_mul_log_div_two_pi hx] + /-- Riemann-Lebesgue lemma for functions on a finite-dimensional inner-product space, formulated via dual space. **Do not use** -- it is only a stepping stone to `tendsto_integral_exp_smul_cocompact` where the inner-product-space structure isn't required. -/ From af5274aa20ae9292fc4d08a12bd46ecef7a978ba Mon Sep 17 00:00:00 2001 From: Riccardo Brasca Date: Thu, 5 Nov 2026 07:10:01 +0100 Subject: [PATCH 09/20] also this --- .../BumpFunction/FiniteDimension.lean | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/Mathlib/Analysis/Calculus/BumpFunction/FiniteDimension.lean b/Mathlib/Analysis/Calculus/BumpFunction/FiniteDimension.lean index 03d564a13d64a7..0f73e7b3be0a8b 100644 --- a/Mathlib/Analysis/Calculus/BumpFunction/FiniteDimension.lean +++ b/Mathlib/Analysis/Calculus/BumpFunction/FiniteDimension.lean @@ -26,6 +26,9 @@ in `IsOpen.exists_contDiff_support_eq`. Then we use this construction to construct bump functions with nice behavior, by convolving the indicator function of `closedBall 0 1` with a function as above with `s = ball 0 D`. + +Finally, `Real.exists_contDiff_indicator_Icc_le_le_indicator_Ioo` provides smooth cutoffs on `ℝ` +lying between the indicator functions of two nested intervals. -/ @[expose] public section @@ -526,3 +529,43 @@ instance (priority := 100) {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E end ExistsContDiffBumpBase end + +/-- A smooth cutoff on `ℝ`: if `a < b ≤ c < d`, there is a smooth function `ψ` with compact +support contained in `Ioo a d` such that `𝟙_[b, c] ≤ ψ ≤ 𝟙_(a, d)`. In particular, +`c - b ≤ ∫ ψ ≤ d - a`. -/ +theorem Real.exists_contDiff_indicator_Icc_le_le_indicator_Ioo {a b c d : ℝ} (hab : a < b) + (hbc : b ≤ c) (hcd : c < d) : + ∃ ψ : ℝ → ℝ, ContDiff ℝ ∞ ψ ∧ HasCompactSupport ψ ∧ tsupport ψ ⊆ Ioo a d ∧ + (Icc b c).indicator 1 ≤ ψ ∧ ψ ≤ (Ioo a d).indicator 1 ∧ + c - b ≤ ∫ x, ψ x ∧ ∫ x, ψ x ≤ d - a := by + have hδ : 0 < min (b - a) (d - c) := lt_min (by linarith) (by linarith) + have hδa := min_le_left (b - a) (d - c) + have hδd := min_le_right (b - a) (d - c) + let ψ : ContDiffBump ((b + c) / 2) := + ⟨(c - b) / 2 + min (b - a) (d - c) / 3, (c - b) / 2 + 2 * min (b - a) (d - c) / 3, + by linarith, by linarith⟩ + have hts : tsupport ψ ⊆ Ioo a d := by + rw [ψ.tsupport_eq, Real.closedBall_eq_Icc] + exact Icc_subset_Ioo (by simp [ψ]; linarith) (by simp [ψ]; linarith) + have hle : (Icc b c).indicator 1 ≤ ψ := fun x ↦ by + by_cases hx : x ∈ Icc b c + · rw [indicator_of_mem hx, Pi.one_apply, ψ.one_of_mem_closedBall] + rw [Real.closedBall_eq_Icc] + obtain ⟨hbx, hxc⟩ := hx + simp only [ψ, mem_Icc] + constructor <;> linarith + · simpa [indicator_of_notMem hx] using ψ.nonneg + have hle' : ⇑ψ ≤ (Ioo a d).indicator 1 := fun x ↦ by + by_cases hx : x ∈ Ioo a d + · rw [indicator_of_mem hx, Pi.one_apply] + exact ψ.le_one + · rw [indicator_of_notMem hx, image_eq_zero_of_notMem_tsupport fun h ↦ hx (hts h)] + have hint : Integrable ψ := ψ.continuous.integrable_of_hasCompactSupport ψ.hasCompactSupport + have hind {s : Set ℝ} (hs : MeasurableSet s) (hs' : volume s ≠ ⊤) : + Integrable (s.indicator (1 : ℝ → ℝ)) := + (integrable_indicator_iff hs).2 (integrableOn_const hs' (by simp)) + refine ⟨ψ, ψ.contDiff, ψ.hasCompactSupport, hts, hle, hle', ?_, ?_⟩ + · rw [← volume_real_Icc_of_le hbc, ← integral_indicator_one measurableSet_Icc] + exact integral_mono (hind measurableSet_Icc (by simp)) hint hle + · rw [← volume_real_Ioo_of_le (by linarith), ← integral_indicator_one measurableSet_Ioo] + exact integral_mono hint (hind measurableSet_Ioo (by simp)) hle' From 2fec5b45d0d1a6fcdc8deb4dedbbf42177ff7959 Mon Sep 17 00:00:00 2001 From: Riccardo Brasca Date: Thu, 5 Nov 2026 07:22:18 +0100 Subject: [PATCH 10/20] better --- .../NumberTheory/LSeries/WienerIkehara.lean | 410 ++++++++---------- 1 file changed, 169 insertions(+), 241 deletions(-) diff --git a/Mathlib/NumberTheory/LSeries/WienerIkehara.lean b/Mathlib/NumberTheory/LSeries/WienerIkehara.lean index b947b6b06ad66a..9c6a8fced58998 100644 --- a/Mathlib/NumberTheory/LSeries/WienerIkehara.lean +++ b/Mathlib/NumberTheory/LSeries/WienerIkehara.lean @@ -6,16 +6,18 @@ Authors: Jose Francisco Antonio Balderas, Vincent Beffara, Alex Kontorovich, Ter -/ module -public import Mathlib.Analysis.Distribution.SchwartzSpace.Fourier +public import Mathlib.Analysis.Calculus.ContDiff.Defs +public import Mathlib.MeasureTheory.Integral.Bochner.Basic +public import Mathlib.MeasureTheory.Measure.Haar.OfBasis public import Mathlib.NumberTheory.LSeries.Basic import Mathlib.Algebra.Order.Chebyshev +import Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension import Mathlib.Analysis.Distribution.SchwartzSpace.CompactSupport +import Mathlib.Analysis.Distribution.SchwartzSpace.Fourier import Mathlib.Analysis.Fourier.RiemannLebesgueLemma import Mathlib.Analysis.Normed.Group.Tannery import Mathlib.Analysis.SumIntegralComparisons -import Mathlib.Geometry.Manifold.PartitionOfUnity -import Mathlib.MeasureTheory.Group.Circle import Mathlib.NumberTheory.LSeries.SumCoeff /-! @@ -23,7 +25,8 @@ import Mathlib.NumberTheory.LSeries.SumCoeff Let `f : ℕ → ℝ` be non-negative with `∑ n ≤ x, f n ≪ x`, whose `L`-series `F` extends continuously to `Re s ≥ 1` after subtracting `A / (s - 1)`. Then -`∑ n < N, f n = A * N + o(N)`. +`∑ n < N, f n = A * N + o(N)`. These hypotheses are bundled in `IsWienerIkehara f C A G`, where +`C` is the implied constant in `∑ n ≤ x, f n ≪ x` and `G` is the continuous extension. The classical theorem does not need the bound `∑ n ≤ x, f n ≪ x`, only the convergence of `F(s)` for `Re s > 1` (which the bound implies); it is assumed here because it simplifies the proof. @@ -34,6 +37,7 @@ for `Re s > 1` (which the bound implies); it is assumed here because it simplifi Tauberian theorem, summing over reals `n ≤ x` and over naturals `n < N` respectively. * `WienerIkehara.tendsto_sum_div_smooth`, `WienerIkehara.tendsto_sum_div_smooth_real`: versions for smooth cutoffs. +* `IsWienerIkehara.A_nonneg`: the residue `A` is non-negative. ## Proof outline @@ -45,9 +49,9 @@ the Riemann-Lebesgue lemma gives `remainder f A 1 ψ̂ x → 0`, first for compa functions (`tendsto_remainder_one_fourier_of_hasCompactSupport`) and then for all Schwartz functions (`tendsto_remainder_one_fourier`). Surjectivity of the Fourier transform on Schwartz space upgrades this to a smoothed form of the -theorem (`tendsto_sum_div_smooth_real`), and non-negativity of `f` together with a smooth Urysohn -lemma (`exists_smooth_cutoff`) replaces the smooth cutoff by the indicator of -an interval, whence the theorem (`tendsto_sum_div`). +theorem (`tendsto_sum_div_smooth_real`), and non-negativity of `f` together with smooth cutoffs +(`Real.exists_contDiff_indicator_Icc_le_le_indicator_Ioo`) replaces the smooth cutoff by the +indicator of an interval, whence the theorem (`tendsto_sum_div`). This file is adapted from the `PrimeNumberTheoremAnd` project. -/ @@ -59,6 +63,30 @@ open Real MeasureTheory Filter Set FourierTransform LSeries Asymptotics Schwartz Function open scoped Topology ContDiff ComplexConjugate LSeries.notation +/-- The hypotheses of the Wiener-Ikehara theorem: `f : ℕ → ℝ` is non-negative and obeys the +Chebyshev-type bound `∑ i < n, f i ≤ C * n`, and `G` is a continuous extension of +`s ↦ LSeries f s - A / (s - 1)` from the open half-plane `1 < re s` to the closed half-plane +`1 ≤ re s`. -/ +public structure IsWienerIkehara (f : ℕ → ℝ) (C A : ℝ) (G : ℂ → ℂ) : Prop where + /-- `f` is non-negative. -/ + nonneg : 0 ≤ f + /-- The partial sums of `f` grow at most linearly, with constant `C`. -/ + sum_range_le (n : ℕ) : ∑ i ∈ .range n, f i ≤ C * n + /-- `G` is continuous on the closed half-plane `1 ≤ re s`. -/ + continuousOn : ContinuousOn G {s | 1 ≤ s.re} + /-- `G` agrees with `LSeries f s - A / (s - 1)` on the open half-plane `1 < re s`. -/ + eqOn : EqOn G (fun s ↦ LSeries ↗f s - A / (s - 1)) {s | 1 < s.re} + +namespace IsWienerIkehara + +variable {f : ℕ → ℝ} {C A : ℝ} {G : ℂ → ℂ} + +/-- The constant `C` in the hypotheses of the Wiener-Ikehara theorem is non-negative. -/ +public lemma C_nonneg (h : IsWienerIkehara f C A G) : 0 ≤ C := + (h.nonneg 0).trans (by simpa using h.sum_range_le 1) + +end IsWienerIkehara + namespace WienerIkehara section FourierSeminorm @@ -72,9 +100,8 @@ abbrev fourierSeminorm : ℝ := (𝓕 ψ).seminorm ℝ 0 0 + (𝓕 ψ).seminorm lemma fourierSeminorm_nonneg : 0 ≤ fourierSeminorm ψ := by positivity -lemma continuous_fourierSeminorm : Continuous fourierSeminorm := - (((schwartz_withSeminorms ℝ ℝ ℂ).continuous_seminorm (0, 0)).comp (by fun_prop)).add - (((schwartz_withSeminorms ℝ ℝ ℂ).continuous_seminorm (2, 0)).comp (by fun_prop)) +lemma continuous_fourierSeminorm : Continuous fourierSeminorm := by + fun_prop lemma norm_fourier_le_fourierSeminorm_mul : ‖𝓕 ψ u‖ ≤ fourierSeminorm ψ * (1 + u ^ 2)⁻¹ := by rw [← div_eq_mul_inv, le_div_iff₀ (by positivity : (0 : ℝ) < 1 + u ^ 2), fourierSeminorm] @@ -102,40 +129,13 @@ def remainder : ℂ := smoothedSum f σ φ x - poleTerm A σ φ x lemma poleTerm_one : poleTerm A 1 φ x = A * ∫ u in Ici (-log x), φ ((2 * π)⁻¹ * u) := by simp [poleTerm] -/- The data and hypotheses for the Wiener-Ikehara theorem, supplied as individual hypotheses: -a nonnegative function `f` (`hpos`) obeying a Chebyshev-type bound with constant `C` (`bound`), -an asymptotic constant `A`, and a continuous extension `G` of `s ↦ LSeries f s - A / (s - 1)` -to `re s ≥ 1` (`hG`, `hG'`). -/ -variable {f : ℕ → ℝ} {C A : ℝ} {G : ℂ → ℂ} (bound : ∀ n, ∑ i ∈ .range n, f i ≤ C * n) - (hG : ContinuousOn G {s | 1 ≤ s.re}) - (hG' : EqOn G (fun s ↦ LSeries ↗f s - A / (s - 1)) {s | 1 < s.re}) (hpos : 0 ≤ f) - -include bound hpos in -lemma C_nonneg : 0 ≤ C := (hpos 0).trans (by simpa using bound 1) +variable {f : ℕ → ℝ} {C A : ℝ} {G : ℂ → ℂ} (h : IsWienerIkehara f C A G) section FourierIdentities variable {x σ : ℝ} (ψ : 𝓢(ℝ, ℂ)) (hx : 0 < x) (hσ : 1 < σ) -include hpos bound hσ in -lemma lSeriesSummable : LSeriesSummable ↗f (σ : ℂ) := by - refine LSeriesSummable_of_sum_norm_bigO_and_nonneg (r := 1) ?_ hpos zero_le_one (by simpa) - refine isBigO_of_le' (c := 2 * C) _ fun n ↦ ?_ - rw [norm_of_nonneg (Finset.sum_nonneg fun k _ ↦ hpos k), rpow_one, Real.norm_natCast] - calc - _ ≤ ∑ k ∈ .range (2 * n), f k := - Finset.sum_le_sum_of_subset_of_nonneg (by grind) fun k _ _ ↦ hpos k - _ ≤ _ := (bound (2 * n)).trans_eq (by grind) - -include hx in -lemma fourierChar_neg_mul_log_div {n : ℕ} (hn : n ≠ 0) (t : ℝ) : - (𝐞 (-((2 * π)⁻¹ * log (n / x) * t)) : ℂ) = x ^ (t * I) / n ^ (t * I) := by - simp [fourierChar_apply, cpow_def_of_ne_zero, hx.ne', hn, ← Complex.exp_sub, log_div, - ofReal_log, hx.le] - congr - field - -include bound hpos hx hσ in +include h hx hσ in lemma smoothedSum_fourier_eq : smoothedSum f σ (𝓕 ψ) x = ∫ t : ℝ, LSeries ↗f (σ + t * I) * ψ t * x ^ (t * I) := calc @@ -145,33 +145,22 @@ lemma smoothedSum_fourier_eq : refine integral_tsum_of_summable_integral_norm (fun n ↦ ?_) ?_ · exact (ψ.integrable.norm.const_mul ‖term ↗f σ n‖).mono' (by fun_prop) (.of_forall fun t ↦ by simp) - · simpa [integral_const_mul] using - (lSeriesSummable bound hpos hσ).norm.mul_right (∫ t, ‖ψ t‖) + · simpa [integral_const_mul] using (LSeriesSummable_of_sum_range_le_and_nonneg + h.sum_range_le h.nonneg (by simpa using hσ)).norm.mul_right (∫ t, ‖ψ t‖) _ = _ := by congr with t rw [LSeries, mul_assoc, ← tsum_mul_right] congr with n by_cases hn : n = 0 - · simp [*] - rw [Circle.smul_def, fourierChar_neg_mul_log_div hx hn] + · simp_all + have hn' : (0 : ℝ) < n := by positivity + have harg : -((2 * π)⁻¹ * log (n / x) * t) = t * log x / (2 * π) - t * log n / (2 * π) := by + rw [log_div hn'.ne' hx.ne'] + ring + rw [harg, AddChar.map_sub_eq_div, Circle.smul_def, Circle.coe_div, + fourierChar_mul_log_div_two_pi hx, fourierChar_mul_log_div_two_pi hn'] simp [cpow_add, field, *] -include hx hσ in -lemma mul_integral_exp_mul_fourierChar_eq (t : ℝ) : - ↑(x ^ (1 - σ)) * ∫ u in Ici (-log x), (rexp (-u * (σ - 1)) : ℂ) * 𝐞 (-(t * ((2 * π)⁻¹ * u))) = - x ^ (t * I) / (σ + t * I - 1) := by - have : ∫ u in Ici (-log x), (rexp (-u * (σ - 1)) : ℂ) * 𝐞 (-(t * ((2 * π)⁻¹ * u))) = - ∫ u in Ioi (-log x), cexp (-(σ - 1 + t * I) * u) := by - rw [integral_Ici_eq_integral_Ioi] - congr with u - push_cast [fourierChar_apply, ← Complex.exp_add] - congr - field - rw [this, integral_cexp_neg_mul_Ioi_neg_log hx (by simpa using hσ), ofReal_cpow hx.le, - mul_div_assoc', ← cpow_add _ _ (mod_cast hx.ne')] - push_cast - grind - include hx hσ in lemma poleTerm_fourier_eq : poleTerm A σ (𝓕 ψ) x = A * ∫ t, (1 / (σ + t * I - 1)) * ψ t * x ^ (t * I) := by @@ -192,10 +181,21 @@ lemma poleTerm_fourier_eq : rw [← integral_const_mul] congr with t simp_rw [Circle.smul_def, smul_smul, smul_eq_mul, integral_mul_const] - rw [← mul_assoc, mul_integral_exp_mul_fourierChar_eq hx hσ] + have hI : ∫ u in Ici (-log x), (rexp (-u * (σ - 1)) : ℂ) * 𝐞 (-(t * ((2 * π)⁻¹ * u))) = + ∫ u in Ioi (-log x), cexp (-(σ - 1 + t * I) * u) := by + rw [integral_Ici_eq_integral_Ioi] + congr with u + push_cast [fourierChar_apply, ← Complex.exp_add] + congr + field + have hx' : (x : ℂ) ≠ 0 := mod_cast hx.ne' + rw [← mul_assoc, hI, integral_cexp_neg_mul_Ioi_neg_log hx (by simpa using hσ), + ofReal_cpow hx.le, mul_div_assoc', ← cpow_add _ _ hx'] + push_cast + rw [show 1 - (σ : ℂ) + (σ - 1 + t * I) = t * I by ring] ring -include bound hpos hG hG' hx in +include h hx in /-- The main result of this section: an initial Fourier identity expressing a sum of `f` as an error term of Fourier integral type. -/ lemma remainder_fourier_eq {ψ : 𝓢(ℝ, ℂ)} (hψ : HasCompactSupport ψ) {σ : ℝ} (hσ : 1 < σ) : @@ -204,14 +204,14 @@ lemma remainder_fourier_eq {ψ : 𝓢(ℝ, ℂ)} (hψ : HasCompactSupport ψ) { have (t : ℝ) : (σ : ℂ) + t * I - 1 ≠ 0 := ne_zero_of_re_pos (by simpa using hσ) have hcpow : Continuous fun t : ℝ ↦ (x : ℂ) ^ (t * I) := by fun_prop (disch := simp [hx.ne']) have hGc : Continuous fun t : ℝ ↦ G (σ + t * I) := - hG.comp_continuous (by fun_prop) fun t ↦ (hσt t).le + h.continuousOn.comp_continuous (by fun_prop) fun t ↦ (hσt t).le have hint₁ : Integrable fun t : ℝ ↦ G (σ + t * I) * ψ t * x ^ (t * I) := ((hGc.mul ψ.continuous).mul hcpow).integrable_of_hasCompactSupport hψ.mul_left.mul_right have hint₂ : Integrable fun t : ℝ ↦ A * (1 / (σ + t * I - 1) * ψ t * x ^ (t * I)) := Continuous.integrable_of_hasCompactSupport (by fun_prop) hψ.mul_left.mul_right.mul_left - rw [remainder, smoothedSum_fourier_eq bound hpos ψ hx hσ, poleTerm_fourier_eq ψ hx hσ, + rw [remainder, smoothedSum_fourier_eq h ψ hx hσ, poleTerm_fourier_eq ψ hx hσ, sub_eq_iff_eq_add, ← integral_const_mul, ← integral_add hint₁ hint₂] - exact integral_congr_ae (.of_forall fun t ↦ by grind [hG' (hσt t)]) + exact integral_congr_ae (.of_forall fun t ↦ by grind [h.eqOn (hσt t)]) end FourierIdentities @@ -291,23 +291,6 @@ end Weight section LimitingFourierIdentity -lemma tendsto_integral_mul_cpow_mul_I {ψ : ℝ → ℂ} : - Tendsto (fun x : ℝ ↦ ∫ t, ψ t * x ^ (t * I)) atTop (𝓝 0) := by - have : ∀ᶠ x : ℝ in atTop, ∫ t, ψ t * x ^ (t * I) = ∫ t, ψ t * exp (log x * t * I) := by - filter_upwards [eventually_ne_atTop 0, eventually_ge_atTop 0] with x hx hx' - refine integral_congr_ae (Eventually.of_forall fun _ ↦ ?_) - simp [cpow_def_of_ne_zero (ofReal_ne_zero.mpr hx), ofReal_log hx', mul_assoc] - simp_rw [tendsto_congr' this] - convert_to Tendsto (fun x ↦ 𝓕 ψ (-(2 * π)⁻¹ * log x)) atTop (𝓝 0) - · ext - congr with _ - simp only [← ofReal_mul, mul_comm (ψ _), fourierChar, Circle.exp, - innerₗ_apply_apply, RCLike.inner_apply, conj_trivial, AddChar.coe_mk, mul_neg] - congr - field - exact (zero_at_infty_fourier ψ).comp <| Tendsto.mono_right - (tendsto_log_atTop.const_mul_atTop_of_neg (by simp [pi_pos])) atBot_le_cocompact - variable {x : ℝ} (Ψ : 𝓢(ℝ, ℂ)) (hΨ : HasCompactSupport Ψ) (hx : 1 ≤ x) (n : ℕ) include hx in @@ -337,19 +320,19 @@ lemma sum_range_ite_weight_le : (eventually_of_mem (self_mem_ae_restrict measurableSet_Ioi) fun t ht ↦ weight_nonneg ht.le) Ioc_subset_Ioi_self.eventuallyLE -include bound hpos hx in +include h hx in lemma bound_sum_log_range : ∑ i ∈ .range n, ‖f i‖ / i * (1 + ((2 * π)⁻¹ * log (i / x)) ^ 2)⁻¹ ≤ C * (1 + ∫ t in Ioi 0, weight t) := by have hx₀ : 0 < x := zero_lt_one.trans_le hx - have := C_nonneg bound hpos + have := h.C_nonneg calc _ ≤ ∑ i ∈ .range n, ‖f i‖ * (if i = 0 then 1 else x⁻¹ * weight (i / x)) := by gcongr 1 with i by_cases i = 0 <;> simp [*, weight, field] _ ≤ ∑ i ∈ .range n, C * (if i = 0 then 1 else x⁻¹ * weight (i / x)) := Finset.sum_mul_le_sum_mul_of_sum_range_le - (fun k _ ↦ by simpa [mul_comm, Real.norm_of_nonneg (hpos _)] using bound k) + (fun k _ ↦ by simpa [mul_comm, Real.norm_of_nonneg (h.nonneg _)] using h.sum_range_le k) (fun i ↦ by unfold weight simp only [Pi.zero_apply] @@ -360,11 +343,11 @@ lemma bound_sum_log_range : gcongr exact sum_range_ite_weight_le hx n -include bound hpos hx in +include h hx in lemma summable_sum_log_range : Summable fun n ↦ ‖f n‖ / n * (1 + ((2 * π)⁻¹ * log (n / x)) ^ 2)⁻¹ := summable_of_sum_range_le (fun _ ↦ by positivity) - fun n ↦ by simpa using bound_sum_log_range bound hpos hx n + fun n ↦ by simpa using bound_sum_log_range h hx n lemma norm_term_mul_le (x : ℝ) (f : ℕ → ℂ) (n : ℕ) : ‖term f 1 n * 𝓕 Ψ ((2 * π)⁻¹ * log (n / x))‖ ≤ @@ -376,12 +359,12 @@ lemma norm_term_mul_le (x : ℝ) (f : ℕ → ℂ) (n : ℕ) : · rw [norm_div, Complex.norm_natCast] ring -include bound hpos hx in +include h hx in lemma tendsto_smoothedSum : Tendsto (smoothedSum f · (𝓕 Ψ) x) (𝓝[>] 1) (𝓝 (smoothedSum f 1 (𝓕 Ψ) x)) := by simp only [smoothedSum] refine tendsto_tsum_of_dominated_convergence - ((summable_sum_log_range bound hpos hx).mul_left (fourierSeminorm Ψ)) (fun n ↦ ?_) ?_ + ((summable_sum_log_range h hx).mul_left (fourierSeminorm Ψ)) (fun n ↦ ?_) ?_ · refine (Continuous.tendsto ?_ 1).mono_left nhdsWithin_le_nhds rcases eq_or_ne n 0 with rfl | hn · simpa [term] using continuous_const @@ -412,38 +395,27 @@ lemma tendsto_poleTerm : rexp (-t * (σ - 1)) ≤ rexp (log x) := exp_le_exp.mpr (by nlinarith [log_nonneg hx]) _ = x := exp_log hx₀ -include hG hΨ hx in -lemma tendsto_integral_G_mul : - Tendsto (fun σ : ℝ ↦ ∫ t : ℝ, G (σ + t * I) * Ψ t * x ^ (t * I)) (𝓝[>] 1) - (𝓝 (∫ t : ℝ, G (1 + t * I) * Ψ t * x ^ (t * I))) := by - have hcpow : Continuous fun t : ℝ ↦ (x : ℂ) ^ (t * I) := by - fun_prop (disch := simp [(zero_lt_one.trans_le hx).ne']) - have hGc : Continuous fun p : ℝ × ℝ ↦ G (max p.1 1 + p.2 * I) := - hG.comp_continuous (by fun_prop) fun p ↦ by simp - have hF : Continuous (uncurry fun σ t : ℝ ↦ G (max σ 1 + t * I) * Ψ t * x ^ (t * I)) := - (hGc.mul (Ψ.continuous.comp continuous_snd)).mul (hcpow.comp continuous_snd) - have hI (σ : ℝ) : ∫ (t : ℝ) in tsupport Ψ, G (max σ 1 + t * I) * Ψ t * x ^ (t * I) = - ∫ t : ℝ, G (max σ 1 + t * I) * Ψ t * x ^ (t * I) := - setIntegral_eq_integral_of_forall_compl_eq_zero fun t ht ↦ by - simp [image_eq_zero_of_notMem_tsupport ht] - have := (continuous_parametric_integral_of_continuous (μ := volume) hF hΨ).tendsto 1 - simp only [hI] at this - simp only [max_self, ofReal_one] at this - refine (this.mono_left nhdsWithin_le_nhds).congr' ?_ - filter_upwards [self_mem_nhdsWithin] with σ (hσ : 1 < σ) - simp [max_eq_left hσ.le] - -include bound hG hG' hpos hΨ in +include h hΨ in lemma tendsto_remainder_one_fourier_of_hasCompactSupport : Tendsto (remainder f A 1 (𝓕 Ψ)) atTop (𝓝 0) := by - apply (tendsto_integral_mul_cpow_mul_I (ψ := fun t ↦ G (1 + t * I) * Ψ t)).congr' + refine (tendsto_integral_cpow_mul_I_smul_atTop fun t ↦ G (1 + t * I) * Ψ t).congr' ?_ filter_upwards [eventually_ge_atTop 1] with x hx - rw [remainder] - refine (tendsto_nhds_unique_of_eventuallyEq - ((tendsto_smoothedSum bound hpos Ψ hx).sub (tendsto_poleTerm Ψ hx)) - (tendsto_integral_G_mul hG Ψ hΨ hx) ?_).symm - exact eventuallyEq_nhdsWithin_iff.mpr <| .of_forall fun σ hσ ↦ - remainder_fourier_eq bound hG hG' hpos (by linarith) hΨ hσ + have hcpow : Continuous fun t : ℝ ↦ (x : ℂ) ^ (t * I) := by + fun_prop (disch := simp [(zero_lt_one.trans_le hx).ne']) + have hcont : ContinuousOn (fun σ : ℝ ↦ ∫ t : ℝ, G (σ + t * I) * Ψ t * x ^ (t * I)) (Ici 1) := by + refine continuousOn_integral_of_compact_support hΨ.isCompact ?_ fun σ t _ ht ↦ by + simp [image_eq_zero_of_notMem_tsupport ht] + refine ((h.continuousOn.comp (by fun_prop) fun p hp ↦ ?_).mul + (Ψ.continuous.comp continuous_snd).continuousOn).mul (hcpow.comp continuous_snd).continuousOn + simpa using (mem_prod.mp hp).1 + rw [remainder, tendsto_nhds_unique_of_eventuallyEq + ((tendsto_smoothedSum h Ψ hx).sub (tendsto_poleTerm Ψ hx)) + ((hcont 1 self_mem_Ici).tendsto.mono_left (nhdsWithin_mono _ Ioi_subset_Ici_self)) + (eventuallyEq_nhdsWithin_iff.mpr <| .of_forall fun σ hσ ↦ + remainder_fourier_eq h (by linarith) hΨ hσ)] + simp only [ofReal_one, smul_eq_mul] + congr with t + ring end LimitingFourierIdentity @@ -462,23 +434,23 @@ lemma norm_setIntegral_fourier_le (x : ℝ) : (setIntegral_le_integral hint (.of_forall fun _ ↦ mul_nonneg (fourierSeminorm_nonneg Ψ) (by positivity))) -include bound hpos hx in +include h hx in lemma summable_term_mul : Summable fun n ↦ ‖term ↗f 1 n * 𝓕 Ψ ((2 * π)⁻¹ * log (n / x))‖ := .of_nonneg_of_le (fun _ ↦ norm_nonneg _) (norm_term_mul_le Ψ x ↗f) - (by simpa using (summable_sum_log_range bound hpos hx).const_smul (fourierSeminorm Ψ)) + (by simpa using (summable_sum_log_range h hx).const_smul (fourierSeminorm Ψ)) -include bound hpos hx in +include h hx in /-- The map `φ ↦ remainder f A 1 (𝓕 φ) x` is linear in the test function. -/ lemma remainder_one_fourier_sub : remainder f A 1 (𝓕 (φ - φ')) x = remainder f A 1 (𝓕 φ) x - remainder f A 1 (𝓕 φ') x := by - have hs (ψ : 𝓢(ℝ, ℂ)) := (summable_term_mul bound hpos ψ hx).of_norm + have hs (ψ : 𝓢(ℝ, ℂ)) := (summable_term_mul h ψ hx).of_norm have hi (ψ : 𝓢(ℝ, ℂ)) : IntegrableOn (fun u ↦ 𝓕 ψ ((2 * π)⁻¹ * u)) (Ici (-log x)) := ((𝓕 ψ).integrable.comp_mul_left' (by positivity)).integrableOn simp only [remainder, smoothedSum, poleTerm_one, fourier_sub, sub_apply, mul_sub, ofReal_one] rw [Summable.tsum_sub (hs φ) (hs φ'), integral_sub (hi φ) (hi φ')] ring -include bound hpos in +include h in /-- `φ ↦ remainder f A 1 (𝓕 φ) x` is bounded by a multiple of the seminorm `fourierSeminorm φ`, uniformly in `x ≥ 1`. -/ lemma exists_norm_remainder_one_le : @@ -488,16 +460,16 @@ lemma exists_norm_remainder_one_le : have h₁ : ‖smoothedSum f 1 (𝓕 φ) x‖ ≤ fourierSeminorm φ * (C * (1 + ∫ t in Ioi 0, weight t)) := by rw [smoothedSum, ofReal_one] - refine (norm_tsum_le_tsum_norm (summable_term_mul bound hpos φ hx)).trans ?_ + refine (norm_tsum_le_tsum_norm (summable_term_mul h φ hx)).trans ?_ calc _ ≤ ∑' n, fourierSeminorm φ * (‖f n‖ / n * (1 + ((2 * π)⁻¹ * log (n / x)) ^ 2)⁻¹) := - (summable_term_mul bound hpos φ hx).tsum_mono - ((summable_sum_log_range bound hpos hx).mul_left _) + (summable_term_mul h φ hx).tsum_mono + ((summable_sum_log_range h hx).mul_left _) fun n ↦ (norm_term_mul_le φ x ↗f n).trans_eq (by simp) _ ≤ _ := by rw [tsum_mul_left] exact mul_le_mul_of_nonneg_left (tsum_le_of_sum_range_le (fun _ ↦ by positivity) - (bound_sum_log_range bound hpos hx)) (fourierSeminorm_nonneg φ) + (bound_sum_log_range h hx)) (fourierSeminorm_nonneg φ) have h₂ : ‖poleTerm A 1 (𝓕 φ) x‖ ≤ fourierSeminorm φ * (|A| * ∫ u, (1 + ((2 * π)⁻¹ * u) ^ 2)⁻¹) := by simp only [poleTerm_one, norm_mul, norm_real, norm_eq_abs] @@ -505,9 +477,9 @@ lemma exists_norm_remainder_one_le : (by ring) grind [remainder, norm_sub_le] -include bound hG hG' hpos in +include h in lemma tendsto_remainder_one_fourier : Tendsto (remainder f A 1 (𝓕 Ψ)) atTop (𝓝 0) := by - obtain ⟨K, hK⟩ := exists_norm_remainder_one_le (A := A) bound hpos + obtain ⟨K, hK⟩ := exists_norm_remainder_one_le h refine Metric.tendsto_nhds.mpr fun ε hε ↦ ?_ obtain ⟨φ, hφQ : _ < ε / 2, hφcs⟩ := SchwartzMap.dense_hasCompactSupport.inter_open_nonempty {φ | fourierSeminorm (Ψ - φ) * K < ε / 2} @@ -515,10 +487,10 @@ lemma tendsto_remainder_one_fourier : Tendsto (remainder f A 1 (𝓕 Ψ)) atTop continuous_const) ⟨Ψ, by simpa [fourierSeminorm] using half_pos hε⟩ filter_upwards [eventually_ge_atTop 1, Metric.tendsto_nhds.mp - (tendsto_remainder_one_fourier_of_hasCompactSupport bound hG hG' hpos φ hφcs) (ε / 2) + (tendsto_remainder_one_fourier_of_hasCompactSupport h φ hφcs) (ε / 2) (half_pos hε)] with x hx hφ rw [dist_zero_right] at hφ ⊢ - grind [remainder_one_fourier_sub bound hpos Ψ φ hx, norm_sub_norm_le, hK (Ψ - φ) hx] + grind [remainder_one_fourier_sub h Ψ φ hx, norm_sub_norm_le, hK (Ψ - φ) hx] end LimitingFourierIdentitySchwartz @@ -527,51 +499,36 @@ section Smooth variable {ψ : ℝ → ℂ} (hsmooth : ContDiff ℝ ∞ ψ) (hsupp : HasCompactSupport ψ) (hplus : tsupport ψ ⊆ Ioi 0) -include hplus in -lemma eventually_eq_zero_of_tsupport_subset_Ioi : ∀ᶠ x in 𝓝 0, ψ x = 0 := - notMem_tsupport_iff_eventuallyEq.mp (fun h ↦ lt_irrefl 0 <| mem_Ioi.mp (hplus h)) - -/-- If `ψ` vanishes near `0`, then eventually `∫ y in Ioi x⁻¹, ψ y = ∫ y in Ioi 0, ψ y`. -/ -lemma eventually_setIntegral_Ioi_inv_eq (hψ : ∀ᶠ x in 𝓝 0, ψ x = 0) : - ∀ᶠ x : ℝ in atTop, ∫ y in Ioi x⁻¹, ψ y = ∫ y in Ioi 0, ψ y := by - obtain ⟨ε, hε, h⟩ := Metric.eventually_nhds_iff.mp hψ - filter_upwards [eventually_gt_atTop ε⁻¹] with x hx - refine (setIntegral_eq_of_subset_of_forall_sdiff_eq_zero measurableSet_Ioi - (Ioi_subset_Ioi (inv_pos.mpr ((inv_pos.mpr hε).trans hx)).le) fun y ⟨hy, hy'⟩ ↦ h ?_).symm - grind [Real.dist_eq, abs_of_pos, inv_lt_of_inv_lt₀ hε hx] - -include hsmooth hsupp hplus in -/-- `y ↦ y * ψ y`, written in the variable `(2 * π)⁻¹ * log y`, is a Fourier transform. -/ -lemma exists_fourier_eq : ∃ g : 𝓢(ℝ, ℂ), ∀ y > 0, 𝓕 g ((2 * π)⁻¹ * log y) = y * ψ y := by - let h x := rexp (2 * π * x) * ψ (exp (2 * π * x)) - have hh : ContDiff ℝ ∞ h := by - have : ContDiff ℝ ∞ fun x ↦ rexp (2 * π * x) := by fun_prop - exact (ofRealCLM.contDiff.comp this).mul (hsmooth.comp this) - have hh' : HasCompactSupport h := by - have := (hsupp.comp_exp fun h₀ ↦ lt_irrefl 0 (hplus h₀)).comp_smul two_pi_pos.ne' - simpa using! this.mul_left - refine ⟨𝓕⁻ (hh'.toSchwartzMap hh), fun y hy ↦ ?_⟩ - simp only [fourier_fourierInv_eq, HasCompactSupport.toSchwartzMap_toFun, h] - field_simp - simp [exp_log hy] - -include bound hG hG' hpos hsmooth hsupp hplus in +include h hsmooth hsupp hplus in /-- A smoothed *Wiener-Ikehara Tauberian Theorem*: If `f` is a nonnegative arithmetic function with `∑ i < n, f i ≤ C * n` whose L-series has a simple pole at `s = 1` with residue `A` and otherwise extends continuously to the closed half-plane `re s ≥ 1`, then `f` behaves like `A` asymptotically with respect to smooth weights with compact support in `(0, ∞)`. -/ public lemma tendsto_sum_div_smooth : Tendsto (fun x ↦ (∑' n, f n * ψ (n / x)) / x) atTop (𝓝 (A * ∫ y in Ioi 0, ψ y)) := by - obtain ⟨g, hg⟩ := exists_fourier_eq hsmooth hsupp hplus + have hψ₀ : ψ =ᶠ[𝓝 0] 0 := notMem_tsupport_iff_eventuallyEq.mp fun h₀ ↦ lt_irrefl 0 (hplus h₀) + -- `y ↦ y * ψ y`, written in the variable `(2 * π)⁻¹ * log y`, is a Fourier transform. + obtain ⟨g, hg⟩ : ∃ g : 𝓢(ℝ, ℂ), ∀ y > 0, 𝓕 g ((2 * π)⁻¹ * log y) = y * ψ y := by + let k x := rexp (2 * π * x) * ψ (exp (2 * π * x)) + have hk : ContDiff ℝ ∞ k := by + have : ContDiff ℝ ∞ fun x ↦ rexp (2 * π * x) := by fun_prop + exact (ofRealCLM.contDiff.comp this).mul (hsmooth.comp this) + have hk' : HasCompactSupport k := by + have := (hsupp.comp_exp fun h₀ ↦ lt_irrefl 0 (hplus h₀)).comp_smul two_pi_pos.ne' + simpa using! this.mul_left + refine ⟨𝓕⁻ (hk'.toSchwartzMap hk), fun y hy ↦ ?_⟩ + simp only [fourier_fourierInv_eq, HasCompactSupport.toSchwartzMap_toFun, k] + field_simp + simp [exp_log hy] have key : ∀ᶠ x in atTop, remainder f A 1 (𝓕 g) x = ∑' n, f n * ψ (n / x) / x - A * ∫ y in Ioi 0, ψ y := by - filter_upwards [eventually_gt_atTop 0, eventually_setIntegral_Ioi_inv_eq - (eventually_eq_zero_of_tsupport_subset_Ioi hplus)] with x hx hint + filter_upwards [eventually_gt_atTop 0, tendsto_inv_atTop_zero.eventually + (eventually_setIntegral_Ioi_eq_of_eventuallyEq_zero (μ := volume) hψ₀)] with x hx hint simp only [remainder, smoothedSum, poleTerm_one, ← hint, ofReal_one] congr 1 · refine tsum_congr fun n ↦ ?_ rcases eq_or_ne n 0 with rfl | hn - · simp [(eventually_eq_zero_of_tsupport_subset_Ioi hplus).self_of_nhds] + · simp [hψ₀.self_of_nhds] rw [hg _ (by positivity)] simp [term, hn, field] · rw [integral_Ici_eq_integral_Ioi, show x⁻¹ = rexp (-log x) by rw [Real.exp_neg, exp_log hx], @@ -579,14 +536,14 @@ public lemma tendsto_sum_div_smooth : Tendsto (fun x ↦ (∑' n, f n * ψ (n / exact congr(_ * $(setIntegral_congr_fun measurableSet_Ioi fun u _ ↦ by rw [real_smul, ← hg _ (exp_pos u), Real.log_exp])) simpa [tendsto_sub_nhds_zero_iff, tsum_div_const] using - (tendsto_remainder_one_fourier bound hG hG' hpos g).congr' key + (tendsto_remainder_one_fourier h g).congr' key -include bound hG hG' hpos in +include h in /-- A version of smoothed Wiener-Ikehara for real-valued cutoffs. -/ public lemma tendsto_sum_div_smooth_real {Ψ : ℝ → ℝ} (hsmooth : ContDiff ℝ ∞ Ψ) (hsupp : HasCompactSupport Ψ) (hplus : tsupport Ψ ⊆ Ioi 0) : Tendsto (fun x ↦ (∑' n, f n * Ψ (n / x)) / x) atTop (𝓝 (A * ∫ y in Ioi 0, Ψ y)) := by - have := (continuous_re.tendsto _).comp (tendsto_sum_div_smooth bound hG hG' hpos + have := (continuous_re.tendsto _).comp (tendsto_sum_div_smooth h (ofRealCLM.contDiff.comp hsmooth) (hsupp.comp_left rfl) (by rwa [tsupport, support_comp_eq]; simp)) simp only [comp_apply, ofRealCLM_apply, mul_re, ofReal_re, ofReal_im, zero_mul, sub_zero] at this @@ -594,116 +551,87 @@ public lemma tendsto_sum_div_smooth_real {Ψ : ℝ → ℝ} (hsmooth : ContDiff end Smooth -/-- A smooth Urysohn lemma for cutoffs supported away from the -origin, additionally controlling the integral of the cutoff from above and below by the lengths of -`Ioo a d` and `Icc b c` respectively. -/ -lemma exists_smooth_cutoff {a b c d : ℝ} (ha : 0 < a) (hab : a < b) (hbc : b ≤ c) (hcd : c < d) : - ∃ ψ, ContDiff ℝ ∞ ψ ∧ HasCompactSupport ψ ∧ tsupport ψ ⊆ Ioi 0 ∧ - indicator (Icc b c) 1 ≤ ψ ∧ ψ ≤ indicator (Ioo a d) 1 ∧ - c - b ≤ ∫ y in Ioi 0, ψ y ∧ ∫ y in Ioi 0, ψ y ≤ d - a := by - obtain ⟨ψ, hψ, hrange, hsupp, hone⟩ := exists_contDiff_support_eq_eq_one_iff - isOpen_Ioo isClosed_Icc (Icc_subset_Ioo hab hcd) - have hcs : HasCompactSupport ψ := - .of_support_subset_isCompact isCompact_Icc (hsupp ▸ Ioo_subset_Icc_self) - have hle : indicator (Icc b c) 1 ≤ ψ := - indicator_le' (fun x hx ↦ ((hone x).mp hx).ge) fun x _ ↦ (hrange (mem_range_self x)).1 - have hle' : ψ ≤ indicator (Ioo a d) 1 := fun x ↦ - le_indicator_apply (fun _ ↦ (hrange (mem_range_self x)).2) (by grind) - have hts : tsupport ψ ⊆ Ioi 0 := by grind [tsupport, closure_Ioo] - have hint : Integrable ψ := hψ.continuous.integrable_of_hasCompactSupport hcs - have hI : ∫ y in Ioi 0, ψ y = ∫ y, ψ y := - setIntegral_eq_integral_of_forall_compl_eq_zero fun x hx ↦ - notMem_support.1 fun h ↦ hx (hts (subset_tsupport _ h)) - have hind {s} (hs : MeasurableSet s) (hs' : volume s ≠ ⊤) : - Integrable (indicator s (1 : ℝ → ℝ)) := - (integrable_indicator_iff hs).2 (integrableOn_const hs' (by simp)) - refine ⟨ψ, hψ, hcs, hts, hle, hle', ?_, ?_⟩ - · rw [hI, ← volume_real_Icc_of_le hbc, ← integral_indicator_one measurableSet_Icc] - exact integral_mono (hind measurableSet_Icc (by simp)) hint hle - · rw [hI, ← volume_real_Ioo_of_le (by order), ← integral_indicator_one measurableSet_Ioo] - exact integral_mono hint (hind measurableSet_Ioo (by simp)) hle' - -include hpos bound hG hG' in -lemma A_nonneg : 0 ≤ A := by +include h in +/-- The residue `A` in the Wiener-Ikehara theorem is non-negative. -/ +public theorem _root_.IsWienerIkehara.A_nonneg : 0 ≤ A := by obtain ⟨ψ, hψ, hcs, hts, hle, -, hint, -⟩ := - exists_smooth_cutoff one_pos one_lt_two (by norm_num : (2 : ℝ) ≤ 3) (by norm_num : (3 : ℝ) < 4) + Real.exists_contDiff_indicator_Icc_le_le_indicator_Ioo one_lt_two (by norm_num : (2 : ℝ) ≤ 3) + (by norm_num : (3 : ℝ) < 4) + have hts' : tsupport ψ ⊆ Ioi 0 := hts.trans fun y hy ↦ zero_lt_one.trans hy.1 + have hI : ∫ y in Ioi 0, ψ y = ∫ y, ψ y := setIntegral_eq_integral_of_forall_compl_eq_zero + fun y hy ↦ image_eq_zero_of_notMem_tsupport fun h' ↦ hy (hts' h') have hψ₀ (y : ℝ) : 0 ≤ ψ y := (indicator_nonneg (fun _ _ ↦ zero_le_one) y).trans (hle y) refine nonneg_of_mul_nonneg_left (ge_of_tendsto - (tendsto_sum_div_smooth_real bound hG hG' hpos hψ hcs hts) ?_) (by linarith) + (tendsto_sum_div_smooth_real h hψ hcs hts') ?_) (by rw [hI]; linarith) filter_upwards [eventually_ge_atTop 0] with x hx - exact div_nonneg (tsum_nonneg fun n ↦ mul_nonneg (hpos n) (hψ₀ _)) hx - -lemma summable_mul_comp_div {x : ℝ} {g : ℝ → ℝ} (hg : HasCompactSupport g) (hx : 0 < x) : - Summable fun n ↦ f n * g (n / x) := by - obtain ⟨M, hM⟩ := hg.bddAbove.mono subset_closure - apply summable_of_hasFiniteSupport - simp only [HasFiniteSupport, support_mul] - apply Finite.inter_of_right - rw [finite_iff_bddAbove] - exact ⟨Nat.ceil (M * x), fun i hi ↦ by simpa using Nat.ceil_mono ((div_le_iff₀ hx).mp (hM hi))⟩ - -lemma tsum_mul_indicator_Ico {N : ℕ} (hN : (0 : ℝ) < N) (u : ℝ) : - ∑' n, f n * indicator (Ico u 1) 1 (n / N) = ∑ i ∈ .Ico ⌈u * N⌉₊ N, f i := by - rw [tsum_eq_sum (s := .Ico ⌈u * N⌉₊ N)] - · apply Finset.sum_congr rfl - simp +contextual [Nat.ceil_le, le_div_iff₀, div_lt_iff₀, hN] - · simp +contextual [Nat.ceil_le, le_div_iff₀, div_lt_iff₀, hN] - -include bound hG hG' hpos in + exact div_nonneg (tsum_nonneg fun n ↦ mul_nonneg (h.nonneg n) (hψ₀ _)) hx + +include h in lemma eventually_lt_sum_range_div {c : ℝ} (hc : c < A) : ∀ᶠ N : ℕ in atTop, c < (∑ i ∈ .range N, f i) / N := by have hg : ∀ᶠ ε in 𝓝[>] (0 : ℝ), c < A * (1 - 3 * ε) := by have : ContinuousWithinAt (fun ε ↦ A * (1 - 3 * ε)) (Ioi 0) 0 := by fun_prop exact this (Ioi_mem_nhds (by grind)) obtain ⟨ε, hcε, hε, hε'⟩ := (hg.and (Ioc_mem_nhdsGT (by norm_num : (0 : ℝ) < 1 / 3))).exists - obtain ⟨ψ, hψ, hcs, hts, -, hle, hint, -⟩ := exists_smooth_cutoff hε (by linarith : ε < 2 * ε) - (by linarith) (by linarith : 1 - ε < 1) - filter_upwards [(tendsto_sum_div_smooth_real bound hG hG' hpos hψ hcs hts).comp - tendsto_natCast_atTop_atTop (Ioi_mem_nhds (by nlinarith [A_nonneg bound hG hG' hpos]) + obtain ⟨ψ, hψ, hcs, hts, -, hle, hint, -⟩ := + Real.exists_contDiff_indicator_Icc_le_le_indicator_Ioo (by linarith : ε < 2 * ε) (by linarith) + (by linarith : 1 - ε < 1) + have hts' : tsupport ψ ⊆ Ioi 0 := hts.trans fun y hy ↦ hε.trans hy.1 + have hI : ∫ y in Ioi 0, ψ y = ∫ y, ψ y := setIntegral_eq_integral_of_forall_compl_eq_zero + fun y hy ↦ image_eq_zero_of_notMem_tsupport fun h' ↦ hy (hts' h') + filter_upwards [(tendsto_sum_div_smooth_real h hψ hcs hts').comp + tendsto_natCast_atTop_atTop (Ioi_mem_nhds (by rw [hI]; nlinarith [h.A_nonneg]) (a := c)), eventually_gt_atTop 0] with N hN _ have hN₀ : (0 : ℝ) < N := by norm_cast refine hN.trans_le ?_ simp only [comp_apply] grw [(hle.trans (indicator_le_indicator_of_subset (by grind : Ioo ε 1 ⊆ Ico 0 1) (by simp))) _, - tsum_mul_indicator_Ico hN₀, zero_mul, Nat.ceil_zero, Nat.Ico_zero_eq_range] - exacts [hpos _, summable_mul_comp_div hcs hN₀, summable_mul_comp_div - (hasCompactSupport_indicator (isCompact_Icc.closure_of_subset Ico_subset_Icc_self)) hN₀] + tsum_mul_indicator_Ico_natCast_div (hx := hN₀), zero_mul, one_mul, Nat.ceil_zero, + Nat.ceil_natCast, Nat.Ico_zero_eq_range] + exacts [h.nonneg _, hcs.summable_mul_natCast_div f hN₀.ne', (hasCompactSupport_indicator + (isCompact_Icc.closure_of_subset Ico_subset_Icc_self)).summable_mul_natCast_div f hN₀.ne'] -include bound hG hG' hpos in +include h in lemma eventually_sum_range_div_lt {c : ℝ} (hc : A < c) : ∀ᶠ N : ℕ in atTop, (∑ i ∈ .range N, f i) / N < c := by have hg : ∀ᶠ ε in 𝓝[>] (0 : ℝ), A + 2 * C * ε + ε < c := by have : ContinuousWithinAt (fun ε ↦ A + 2 * C * ε + ε) (Ioi 0) 0 := by fun_prop exact this (Iio_mem_nhds (by grind)) obtain ⟨ε, hcε, hε, hε'⟩ := (hg.and (Ioc_mem_nhdsGT (by norm_num : (0 : ℝ) < 1 / 4))).exists - obtain ⟨ψ, hψ, hcs, hts, hle, -, -, hint⟩ := exists_smooth_cutoff hε (by linarith : ε < 2 * ε) - (by linarith) (by linarith : 1 < 1 + ε) + obtain ⟨ψ, hψ, hcs, hts, hle, -, -, hint⟩ := + Real.exists_contDiff_indicator_Icc_le_le_indicator_Ioo (by linarith : ε < 2 * ε) (by linarith) + (by linarith : 1 < 1 + ε) + have hts' : tsupport ψ ⊆ Ioi 0 := hts.trans fun y hy ↦ hε.trans hy.1 + have hI : ∫ y in Ioi 0, ψ y = ∫ y, ψ y := setIntegral_eq_integral_of_forall_compl_eq_zero + fun y hy ↦ image_eq_zero_of_notMem_tsupport fun h' ↦ hy (hts' h') have hcψ : A * ∫ y in Ioi 0, ψ y < c - 2 * C * ε - ε := by - nlinarith [A_nonneg bound hG hG' hpos] - filter_upwards [(tendsto_sum_div_smooth_real bound hG hG' hpos hψ hcs hts).comp + rw [hI] + nlinarith [h.A_nonneg] + filter_upwards [(tendsto_sum_div_smooth_real h hψ hcs hts').comp tendsto_natCast_atTop_atTop (Iio_mem_nhds hcψ), eventually_gt_atTop 0, (tendsto_const_div_atTop_nhds_zero_nat C).eventually (gt_mem_nhds hε)] with N hN _ hN' have hN₀ : (0 : ℝ) < N := by norm_cast + have hsum : ∑ i ∈ .Ico ⌈2 * ε * N⌉₊ N, f i = ∑' n, f n * indicator (Ico (2 * ε) 1) 1 (n / N) := by + rw [tsum_mul_indicator_Ico_natCast_div (hx := hN₀), one_mul, Nat.ceil_natCast] grw [← Finset.sum_range_add_sum_Ico _ (by rw [Nat.ceil_le]; nlinarith : ⌈2 * ε * N⌉₊ ≤ N), - add_div, ← tsum_mul_indicator_Ico hN₀, ((indicator_le_indicator_of_subset Ico_subset_Icc_self + add_div, hsum, ((indicator_le_indicator_of_subset Ico_subset_Icc_self (by simp)).trans hle) _, (by exact hN : (∑' n, f n * ψ (n / N)) / N < _), - bound, Nat.ceil_lt_add_one, mul_add, add_div, mul_one, hN'] + h.sum_range_le, Nat.ceil_lt_add_one, mul_add, add_div, mul_one, hN'] · field_simp grind - · exact C_nonneg bound hpos + · exact h.C_nonneg · positivity - exacts [hpos _, summable_mul_comp_div - (hasCompactSupport_indicator (isCompact_Icc.closure_of_subset Ico_subset_Icc_self)) hN₀, - summable_mul_comp_div hcs hN₀] + exacts [h.nonneg _, (hasCompactSupport_indicator + (isCompact_Icc.closure_of_subset Ico_subset_Icc_self)).summable_mul_natCast_div f hN₀.ne', + hcs.summable_mul_natCast_div f hN₀.ne'] -include bound hG hG' hpos in +include h in /-- The *Wiener-Ikehara Tauberian Theorem*, summing over naturals `n < N`; see `WienerIkehara.tendsto_sum_div` for the version summing over reals `n ≤ x`. -/ public theorem tendsto_sum_range_div : Tendsto (fun N ↦ (∑ i ∈ .range N, f i) / N) atTop (𝓝 A) := - tendsto_order.mpr ⟨fun _ ↦ eventually_lt_sum_range_div bound hG hG' hpos, - fun _ ↦ eventually_sum_range_div_lt bound hG hG' hpos⟩ + tendsto_order.mpr ⟨fun _ ↦ eventually_lt_sum_range_div h, fun _ ↦ eventually_sum_range_div_lt h⟩ -include bound hG hG' hpos in +include h in /-- The *Wiener-Ikehara Tauberian Theorem*, summing over naturals `n ≤ x` for real `x`; see `WienerIkehara.tendsto_sum_range_div` for the version summing over naturals `n < N`. -/ public theorem tendsto_sum_div : Tendsto (fun x ↦ (∑ n ∈ .Icc 0 ⌊x⌋₊, f n) / x) atTop (𝓝 A) := by @@ -711,7 +639,7 @@ public theorem tendsto_sum_div : Tendsto (fun x ↦ (∑ n ∈ .Icc 0 ⌊x⌋₊ (𝓝 A) := by rw [← mul_one A] apply Tendsto.mul - · simpa [Function.comp_def] using (tendsto_sum_range_div bound hG hG' hpos).comp + · simpa [Function.comp_def] using (tendsto_sum_range_div h).comp ((tendsto_add_atTop_nat 1).comp tendsto_nat_floor_atTop) · convert (tendsto_nat_floor_div_atTop (R := ℝ)).add tendsto_inv_atTop_zero <;> grind apply this.congr' From baf251346c6983285bc1ed73dbc7612bfa84ad23 Mon Sep 17 00:00:00 2001 From: Riccardo Brasca Date: Sun, 22 Nov 2026 08:36:09 +0100 Subject: [PATCH 11/20] Update Mathlib/Analysis/Calculus/BumpFunction/FiniteDimension.lean Co-authored-by: Michael Stoll <99838730+MichaelStollBayreuth@users.noreply.github.com> --- .../Calculus/BumpFunction/FiniteDimension.lean | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/Mathlib/Analysis/Calculus/BumpFunction/FiniteDimension.lean b/Mathlib/Analysis/Calculus/BumpFunction/FiniteDimension.lean index a6db60dda1f5a1..a2028a36db0857 100644 --- a/Mathlib/Analysis/Calculus/BumpFunction/FiniteDimension.lean +++ b/Mathlib/Analysis/Calculus/BumpFunction/FiniteDimension.lean @@ -538,22 +538,15 @@ theorem Real.exists_contDiff_indicator_Icc_le_le_indicator_Ioo {a b c d : ℝ} ( ∃ ψ : ℝ → ℝ, ContDiff ℝ ∞ ψ ∧ HasCompactSupport ψ ∧ tsupport ψ ⊆ Ioo a d ∧ (Icc b c).indicator 1 ≤ ψ ∧ ψ ≤ (Ioo a d).indicator 1 ∧ c - b ≤ ∫ x, ψ x ∧ ∫ x, ψ x ≤ d - a := by - have hδ : 0 < min (b - a) (d - c) := lt_min (by linarith) (by linarith) - have hδa := min_le_left (b - a) (d - c) - have hδd := min_le_right (b - a) (d - c) let ψ : ContDiffBump ((b + c) / 2) := ⟨(c - b) / 2 + min (b - a) (d - c) / 3, (c - b) / 2 + 2 * min (b - a) (d - c) / 3, - by linarith, by linarith⟩ + by grind, by grind⟩ have hts : tsupport ψ ⊆ Ioo a d := by - rw [ψ.tsupport_eq, Real.closedBall_eq_Icc] - exact Icc_subset_Ioo (by simp [ψ]; linarith) (by simp [ψ]; linarith) + grind [ψ.tsupport_eq, Real.closedBall_eq_Icc] have hle : (Icc b c).indicator 1 ≤ ψ := fun x ↦ by by_cases hx : x ∈ Icc b c - · rw [indicator_of_mem hx, Pi.one_apply, ψ.one_of_mem_closedBall] - rw [Real.closedBall_eq_Icc] - obtain ⟨hbx, hxc⟩ := hx - simp only [ψ, mem_Icc] - constructor <;> linarith + · rw [indicator_of_mem hx, Pi.one_apply, ψ.one_of_mem_closedBall ?h] + case h => grind [Real.closedBall_eq_Icc] · simpa [indicator_of_notMem hx] using ψ.nonneg have hle' : ⇑ψ ≤ (Ioo a d).indicator 1 := fun x ↦ by by_cases hx : x ∈ Ioo a d From 1bd1ff4bad35bd08f04fa45441456d998536fc40 Mon Sep 17 00:00:00 2001 From: Riccardo Brasca Date: Sun, 22 Nov 2026 08:36:21 +0100 Subject: [PATCH 12/20] Update Mathlib/Analysis/Fourier/RiemannLebesgueLemma.lean Co-authored-by: Michael Stoll <99838730+MichaelStollBayreuth@users.noreply.github.com> --- Mathlib/Analysis/Fourier/RiemannLebesgueLemma.lean | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Mathlib/Analysis/Fourier/RiemannLebesgueLemma.lean b/Mathlib/Analysis/Fourier/RiemannLebesgueLemma.lean index 03c1c08cbc06d0..4842fa5eff85f4 100644 --- a/Mathlib/Analysis/Fourier/RiemannLebesgueLemma.lean +++ b/Mathlib/Analysis/Fourier/RiemannLebesgueLemma.lean @@ -227,14 +227,14 @@ theorem Real.fourierChar_mul_log_div_two_pi {x : ℝ} (hx : 0 < x) (t : ℝ) : `∫ t, x ^ (t * I) • f t` tend to `0` as `x → ∞`. -/ theorem Real.tendsto_integral_cpow_mul_I_smul_atTop (f : ℝ → E) : Tendsto (fun x : ℝ ↦ ∫ t : ℝ, (x : ℂ) ^ (t * I) • f t) atTop (𝓝 0) := by - have h : Tendsto (fun x ↦ -(Real.log x / (2 * π))) atTop (cocompact ℝ) := + have h : Tendsto (fun x ↦ -(log x / (2 * π))) atTop (cocompact ℝ) := (tendsto_neg_atTop_atBot.comp - (Real.tendsto_log_atTop.atTop_div_const (by positivity))).mono_right atBot_le_cocompact - refine ((Real.zero_at_infty_fourier f).comp h).congr' ?_ + (tendsto_log_atTop.atTop_div_const (by positivity))).mono_right atBot_le_cocompact + refine ((zero_at_infty_fourier f).comp h).congr' ?_ filter_upwards [eventually_gt_atTop 0] with x hx - simp only [Function.comp_apply, Real.fourier_real_eq] + simp only [Function.comp_apply, fourier_real_eq] refine integral_congr_ae (.of_forall fun t ↦ ?_) - simp [← mul_div_assoc, Circle.smul_def, Real.fourierChar_mul_log_div_two_pi hx] + simp [← mul_div_assoc, Circle.smul_def, fourierChar_mul_log_div_two_pi hx] /-- Riemann-Lebesgue lemma for functions on a finite-dimensional inner-product space, formulated via dual space. **Do not use** -- it is only a stepping stone to From 7ec05f46d5eaadffd84491a402aa2755bfbf3bb5 Mon Sep 17 00:00:00 2001 From: Riccardo Brasca Date: Sun, 22 Nov 2026 08:36:49 +0100 Subject: [PATCH 13/20] Update Mathlib/Topology/Algebra/InfiniteSum/Real.lean Co-authored-by: Michael Stoll <99838730+MichaelStollBayreuth@users.noreply.github.com> --- Mathlib/Topology/Algebra/InfiniteSum/Real.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/Topology/Algebra/InfiniteSum/Real.lean b/Mathlib/Topology/Algebra/InfiniteSum/Real.lean index 31f34baf4a396a..088948ddf44db1 100644 --- a/Mathlib/Topology/Algebra/InfiniteSum/Real.lean +++ b/Mathlib/Topology/Algebra/InfiniteSum/Real.lean @@ -119,7 +119,7 @@ theorem HasCompactSupport.summable_mul_natCast_div [NonUnitalNonAssocSemiring R] obtain ⟨M, hM⟩ := hg.isCompact.isBounded.subset_closedBall 0 refine summable_of_hasFiniteSupport <| (Set.finite_Iic ⌈M * |x|⌉₊).subset fun n hn ↦ ?_ have := hM (subset_tsupport _ (right_ne_zero_of_mul hn)) - rw [Metric.mem_closedBall, Real.dist_eq, sub_zero, abs_div, Nat.abs_cast, + rw [Metric.mem_closedBall, Real.dist_0_eq_abs, abs_div, Nat.abs_cast, div_le_iff₀ (abs_pos.mpr hx)] at this exact Nat.cast_le.mp (this.trans (Nat.le_ceil _)) From 4d4a7bdf3eede66d0cdd5ebeba3b1190e27ff4d5 Mon Sep 17 00:00:00 2001 From: Riccardo Brasca Date: Sun, 22 Nov 2026 08:37:15 +0100 Subject: [PATCH 14/20] Update Mathlib/MeasureTheory/Integral/IntegralEqImproper.lean Co-authored-by: Michael Stoll <99838730+MichaelStollBayreuth@users.noreply.github.com> --- Mathlib/MeasureTheory/Integral/IntegralEqImproper.lean | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Mathlib/MeasureTheory/Integral/IntegralEqImproper.lean b/Mathlib/MeasureTheory/Integral/IntegralEqImproper.lean index 0827f1e0c3a2d8..fe3f3231121b90 100644 --- a/Mathlib/MeasureTheory/Integral/IntegralEqImproper.lean +++ b/Mathlib/MeasureTheory/Integral/IntegralEqImproper.lean @@ -509,9 +509,9 @@ theorem eventually_setIntegral_Ioi_eq_of_eventuallyEq_zero [LinearOrder α] [Top filter_upwards [tendsto_smallSets_iff.mp (tendsto_const_nhds.uIcc tendsto_id) _ hf] with b hb rw [← integral_indicator measurableSet_Ioi, ← integral_indicator measurableSet_Ioi] congr 1 with x - by_cases hx : x ∈ uIcc a b - · simp [indicator_apply, show f x = 0 from hb hx] simp only [indicator_apply, mem_Ioi] + by_cases hx : x ∈ uIcc a b + · simp [show f x = 0 from hb hx] split_ifs with h₁ h₂ h₂ <;> first | rfl | exact (hx (mem_uIcc.mpr (.inr ⟨h₁.le, not_lt.mp h₂⟩))).elim From b2e11ef0cffad9db275090315bc344ddba1656fa Mon Sep 17 00:00:00 2001 From: Riccardo Brasca Date: Sun, 22 Nov 2026 08:37:28 +0100 Subject: [PATCH 15/20] Update Mathlib/NumberTheory/LSeries/WienerIkehara.lean Co-authored-by: Michael Stoll <99838730+MichaelStollBayreuth@users.noreply.github.com> --- Mathlib/NumberTheory/LSeries/WienerIkehara.lean | 1 - 1 file changed, 1 deletion(-) diff --git a/Mathlib/NumberTheory/LSeries/WienerIkehara.lean b/Mathlib/NumberTheory/LSeries/WienerIkehara.lean index b8df193eed54f3..a3d05e56789b7a 100644 --- a/Mathlib/NumberTheory/LSeries/WienerIkehara.lean +++ b/Mathlib/NumberTheory/LSeries/WienerIkehara.lean @@ -249,7 +249,6 @@ lemma integrableOn_mul_weight_div (hc : 0 < c) : IntegrableOn (fun t ↦ a * weight (t / c)) (Ici 0) := by have (t) (ht : 0 < t) : t⁻¹ • (a * c * (1 + ((2 * π)⁻¹ * (log t - log c)) ^ 2)⁻¹) = a * weight (t / c) := by - have : 0 < 1 + ((2 * π)⁻¹ * (log t - log c)) ^ 2 := by positivity simp [weight, log_div ht.ne' hc.ne', field] rw [integrableOn_Ici_iff_integrableOn_Ioi] exact ((integrableOn_comp_log_Ioi_zero _).2 From 10264b77c23836ee8919cef90331da4819a20804 Mon Sep 17 00:00:00 2001 From: Riccardo Brasca Date: Sun, 22 Nov 2026 08:37:58 +0100 Subject: [PATCH 16/20] Update Mathlib/NumberTheory/LSeries/WienerIkehara.lean Co-authored-by: Michael Stoll <99838730+MichaelStollBayreuth@users.noreply.github.com> --- Mathlib/NumberTheory/LSeries/WienerIkehara.lean | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Mathlib/NumberTheory/LSeries/WienerIkehara.lean b/Mathlib/NumberTheory/LSeries/WienerIkehara.lean index a3d05e56789b7a..bed2bc60ec4578 100644 --- a/Mathlib/NumberTheory/LSeries/WienerIkehara.lean +++ b/Mathlib/NumberTheory/LSeries/WienerIkehara.lean @@ -59,8 +59,7 @@ This file is adapted from the `PrimeNumberTheoremAnd` project. noncomputable section open Complex hiding log -open Real MeasureTheory Filter Set FourierTransform LSeries Asymptotics SchwartzMap - Function +open Real MeasureTheory Filter Set FourierTransform LSeries Asymptotics SchwartzMap Function open scoped Topology ContDiff ComplexConjugate LSeries.notation /-- The hypotheses of the Wiener-Ikehara theorem: `f : ℕ → ℝ` is non-negative and obeys the From 1af4e2b3ce9d42128e9a966be69de2bf52773aed Mon Sep 17 00:00:00 2001 From: Riccardo Brasca Date: Sun, 22 Nov 2026 08:38:07 +0100 Subject: [PATCH 17/20] Update Mathlib/Analysis/Fourier/RiemannLebesgueLemma.lean Co-authored-by: Michael Stoll <99838730+MichaelStollBayreuth@users.noreply.github.com> --- Mathlib/Analysis/Fourier/RiemannLebesgueLemma.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/Analysis/Fourier/RiemannLebesgueLemma.lean b/Mathlib/Analysis/Fourier/RiemannLebesgueLemma.lean index 4842fa5eff85f4..9f171afde964dc 100644 --- a/Mathlib/Analysis/Fourier/RiemannLebesgueLemma.lean +++ b/Mathlib/Analysis/Fourier/RiemannLebesgueLemma.lean @@ -221,7 +221,7 @@ theorem Real.fourierChar_mul_log_div_two_pi {x : ℝ} (hx : 0 < x) (t : ℝ) : ← ofReal_log hx.le] congr 1 push_cast - field_simp + field /-- The Riemann-Lebesgue lemma for functions on `ℝ`, in multiplicative form: the integrals `∫ t, x ^ (t * I) • f t` tend to `0` as `x → ∞`. -/ From b45626b525764aa3afd8d8c3a0051c78df3e65b2 Mon Sep 17 00:00:00 2001 From: Riccardo Brasca Date: Sun, 22 Nov 2026 08:38:34 +0100 Subject: [PATCH 18/20] Update Mathlib/NumberTheory/LSeries/WienerIkehara.lean Co-authored-by: Michael Stoll <99838730+MichaelStollBayreuth@users.noreply.github.com> --- Mathlib/NumberTheory/LSeries/WienerIkehara.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/NumberTheory/LSeries/WienerIkehara.lean b/Mathlib/NumberTheory/LSeries/WienerIkehara.lean index bed2bc60ec4578..10960a892cbb76 100644 --- a/Mathlib/NumberTheory/LSeries/WienerIkehara.lean +++ b/Mathlib/NumberTheory/LSeries/WienerIkehara.lean @@ -120,7 +120,7 @@ def smoothedSum : ℂ := ∑' n, term ↗f σ n * φ ((2 * π)⁻¹ * log (n / x def poleTerm : ℂ := A * ↑(x ^ (1 - σ)) * ∫ u in Ici (-log x), rexp (-u * (σ - 1)) * φ ((2 * π)⁻¹ * u) -/-- A key statistic in the Wiener--Ikehara analysis involving an exponent `σ`, a test +/-- A key statistic in the Wiener-Ikehara analysis involving an exponent `σ`, a test function `φ`, and a scale parameter `x`: the smoothed sum of `f` minus the contribution of the pole of its `L`-series. -/ def remainder : ℂ := smoothedSum f σ φ x - poleTerm A σ φ x From 834e24efbde03a48d447547c11020e6a5fa01c35 Mon Sep 17 00:00:00 2001 From: Riccardo Brasca Date: Sun, 22 Nov 2026 09:42:04 +0100 Subject: [PATCH 19/20] use icc --- Mathlib/Analysis/Calculus/BumpFunction/FiniteDimension.lean | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Mathlib/Analysis/Calculus/BumpFunction/FiniteDimension.lean b/Mathlib/Analysis/Calculus/BumpFunction/FiniteDimension.lean index a2028a36db0857..9bb7ed45f813a6 100644 --- a/Mathlib/Analysis/Calculus/BumpFunction/FiniteDimension.lean +++ b/Mathlib/Analysis/Calculus/BumpFunction/FiniteDimension.lean @@ -532,12 +532,12 @@ end /-- A smooth cutoff on `ℝ`: if `a < b ≤ c < d`, there is a smooth function `ψ` with compact support contained in `Ioo a d` such that `𝟙_[b, c] ≤ ψ ≤ 𝟙_(a, d)`. In particular, -`c - b ≤ ∫ ψ ≤ d - a`. -/ +`∫ ψ ∈ [c - b, d - a]`. -/ theorem Real.exists_contDiff_indicator_Icc_le_le_indicator_Ioo {a b c d : ℝ} (hab : a < b) (hbc : b ≤ c) (hcd : c < d) : ∃ ψ : ℝ → ℝ, ContDiff ℝ ∞ ψ ∧ HasCompactSupport ψ ∧ tsupport ψ ⊆ Ioo a d ∧ (Icc b c).indicator 1 ≤ ψ ∧ ψ ≤ (Ioo a d).indicator 1 ∧ - c - b ≤ ∫ x, ψ x ∧ ∫ x, ψ x ≤ d - a := by + ∫ x, ψ x ∈ Icc (c - b) (d - a) := by let ψ : ContDiffBump ((b + c) / 2) := ⟨(c - b) / 2 + min (b - a) (d - c) / 3, (c - b) / 2 + 2 * min (b - a) (d - c) / 3, by grind, by grind⟩ From 2b4c39255d833c2380dfa9d44d127c507185caa7 Mon Sep 17 00:00:00 2001 From: Riccardo Brasca Date: Sun, 22 Nov 2026 09:46:57 +0100 Subject: [PATCH 20/20] better --- .../NumberTheory/LSeries/WienerIkehara.lean | 349 +++++++++--------- 1 file changed, 178 insertions(+), 171 deletions(-) diff --git a/Mathlib/NumberTheory/LSeries/WienerIkehara.lean b/Mathlib/NumberTheory/LSeries/WienerIkehara.lean index 10960a892cbb76..e863f68c6d85b9 100644 --- a/Mathlib/NumberTheory/LSeries/WienerIkehara.lean +++ b/Mathlib/NumberTheory/LSeries/WienerIkehara.lean @@ -108,8 +108,130 @@ lemma norm_fourier_le_fourierSeminorm_mul : ‖𝓕 ψ u‖ ≤ fourierSeminorm rw [Real.norm_eq_abs, sq_abs] at h linarith [norm_le_seminorm ℝ (𝓕 ψ) u] +lemma norm_term_mul_le (x : ℝ) (f : ℕ → ℂ) (n : ℕ) : + ‖term f 1 n * 𝓕 ψ ((2 * π)⁻¹ * log (n / x))‖ ≤ + fourierSeminorm ψ * (‖f n‖ / n * (1 + ((2 * π)⁻¹ * log (n / x)) ^ 2)⁻¹) := by + convert mul_le_mul_of_nonneg_left + (norm_fourier_le_fourierSeminorm_mul ψ ((2 * π)⁻¹ * log (n / x))) + (norm_nonneg (f n / n)) using 1 + · simp [term_of_ne_zero'] + · rw [norm_div, Complex.norm_natCast] + ring + +lemma norm_setIntegral_fourier_le (x : ℝ) : + ‖∫ u in Ici (-log x), 𝓕 ψ ((2 * π)⁻¹ * u)‖ ≤ + fourierSeminorm ψ * ∫ u, (1 + ((2 * π)⁻¹ * u) ^ 2)⁻¹ := by + have hint : Integrable fun u : ℝ ↦ fourierSeminorm ψ * (1 + ((2 * π)⁻¹ * u) ^ 2)⁻¹ := + (integrable_inv_one_add_sq.comp_mul_left' (by positivity)).const_mul _ + rw [← integral_const_mul] + exact (norm_integral_le_of_norm_le hint.integrableOn + (.of_forall fun u ↦ norm_fourier_le_fourierSeminorm_mul ψ _)).trans + (setIntegral_le_integral hint + (.of_forall fun _ ↦ mul_nonneg (fourierSeminorm_nonneg ψ) (by positivity))) + end FourierSeminorm +section Weight + +/-- A weight function appearing in the analysis. -/ +def weight (t : ℝ) : ℝ := (t * (1 + ((2 * π)⁻¹ * log t) ^ 2))⁻¹ + +variable {a c t x : ℝ} {n : ℕ} + +lemma weight_nonneg (ht : 0 ≤ t) : 0 ≤ weight t := by rw [weight]; positivity + +lemma hasDerivAt_weight (ht : t ≠ 0) : HasDerivAt weight + (-((2 * π)⁻¹ ^ 2 * (log t + 1) ^ 2 + (1 - (2 * π)⁻¹) * (1 + (2 * π)⁻¹)) * weight t ^ 2) t := by + have : HasDerivAt (fun t ↦ t * (1 + ((2 * π)⁻¹ * log t) ^ 2)) + (1 + 2 * (2 * π)⁻¹ ^ 2 * log t + ((2 * π)⁻¹ * log t) ^ 2) t := by + convert (hasDerivAt_id' t).mul ?_ (d' := 2 * (2 * π)⁻¹ ^ 2 * t⁻¹ * log t) using 1 + · grind + convert (((hasDerivAt_log ht).const_mul _).pow (f' := (2 * π)⁻¹ * t⁻¹) 2).const_add _ using 1 + ring + unfold weight + convert this.inv (by positivity) using 1 + grind + +lemma antitoneOn_weight : AntitoneOn weight (Ioi 0) := by + refine antitoneOn_of_hasDerivWithinAt_nonpos (convex_Ioi _) + (fun _ _ ↦ (hasDerivAt_weight (by grind)).continuousAt.continuousWithinAt) + (fun _ _ ↦ (hasDerivAt_weight (fun _ ↦ by simp_all)).hasDerivWithinAt) + fun x _ ↦ ?_ + have : 0 < 1 - (2 * π)⁻¹ := by grind [two_le_pi, inv_lt_one_of_one_lt₀] + simp only [neg_mul, Left.neg_nonpos_iff] + positivity + +lemma integrableOn_mul_weight_div (hc : 0 < c) : + IntegrableOn (fun t ↦ a * weight (t / c)) (Ici 0) := by + have (t) (ht : 0 < t) : + t⁻¹ • (a * c * (1 + ((2 * π)⁻¹ * (log t - log c)) ^ 2)⁻¹) = a * weight (t / c) := by + simp [weight, log_div ht.ne' hc.ne', field] + rw [integrableOn_Ici_iff_integrableOn_Ioi] + exact ((integrableOn_comp_log_Ioi_zero _).2 + (((integrable_inv_one_add_mul_sq (by positivity)).comp_sub_right _).const_mul _)).congr_fun + this measurableSet_Ioi + +lemma antitoneOn_inv_mul_weight_div (hx : 0 < x) : + AntitoneOn (fun t ↦ x⁻¹ * weight (t / x)) (Ioc 0 n) := by + intro u hu v hv huv + dsimp only + gcongr + exact antitoneOn_weight (div_pos hu.1 hx) (div_pos hv.1 hx) (by gcongr) + +lemma integrableOn_inv_mul_weight_div (hx : 0 < x) : + IntegrableOn (fun t ↦ x⁻¹ * weight (t / x)) (Icc 0 n) := + .mono_set (integrableOn_mul_weight_div (by positivity)) Icc_subset_Ici_self + +lemma inv_mul_weight_div (hx : x ≠ 0) : + x⁻¹ * weight (t / x) = (t * (1 + ((2 * π)⁻¹ * log (t / x)) ^ 2))⁻¹ := by + grind [weight] + +lemma inv_mul_weight_div_le_one (hx : x ≠ 0) (ht : 1 ≤ t) : x⁻¹ * weight (t / x) ≤ 1 := by + rw [inv_mul_weight_div hx] + exact inv_le_one_of_one_le₀ <| one_le_mul_of_one_le_of_one_le ht <| + le_add_of_nonneg_right (sq_nonneg _) + +lemma antitone_ite_weight (hx : 0 < x) : + Antitone fun i : ℕ ↦ if i = 0 then (1 : ℝ) else x⁻¹ * weight (i / x) := by + intro i j hij + rcases eq_or_ne j 0 with rfl | hj + · grind + simp only [hj, ↓reduceIte] + split_ifs with hi + · exact inv_mul_weight_div_le_one hx.ne' (mod_cast by grind) + · gcongr + exact antitoneOn_weight (mem_Ioi.mpr (by positivity)) (mem_Ioi.mpr (by positivity)) (by gcongr) + +lemma sum_range_ite_weight_le (hx : 1 ≤ x) : + ∑ i ∈ .range n, (if i = 0 then 1 else x⁻¹ * weight (i / x)) ≤ + 1 + ∫ t in Ioi 0, weight t := by + have hx₀ : 0 < x := zero_lt_one.trans_le hx + rcases n with _ | m + · simpa using add_nonneg zero_le_one + (setIntegral_nonneg measurableSet_Ioi fun t ht ↦ weight_nonneg ht.le) + simp only [Finset.sum_range_succ', Nat.add_one_ne_zero, ↓reduceIte] + rw [add_comm _ (1 : ℝ)] + gcongr + calc + _ ≤ ∫ t in 0..m, x⁻¹ * weight (t / x) := by + simpa using @AntitoneOn.sum_le_integral_of_integrableOn 0 m (fun t ↦ x⁻¹ * weight (t / x)) + (by simpa using antitoneOn_inv_mul_weight_div hx₀) + (by simpa using integrableOn_inv_mul_weight_div hx₀) + _ = ∫ t in 0..m / x, weight t := by + rw [intervalIntegral.integral_const_mul, intervalIntegral.integral_comp_div weight hx₀.ne', + zero_div, smul_eq_mul, ← mul_assoc, inv_mul_cancel₀ hx₀.ne', one_mul] + _ ≤ ∫ t in Ioi 0, weight t := by + rw [intervalIntegral.integral_of_le (by positivity)] + exact setIntegral_mono_set + (by simpa using + (integrableOn_mul_weight_div (a := 1) zero_lt_one).mono_set Ioi_subset_Ici_self) + (eventually_of_mem (self_mem_ae_restrict measurableSet_Ioi) fun t ht ↦ weight_nonneg ht.le) + Ioc_subset_Ioi_self.eventuallySubset + +end Weight + +section Statistics + variable (f : ℕ → ℝ) (A : ℝ) (σ : ℝ) (φ : 𝓢(ℝ, ℂ)) (x : ℝ) /-- The smoothed sum `∑' n, term f σ n * φ ((2 * π)⁻¹ * log (n / x))` of `f` against a test @@ -128,6 +250,8 @@ def remainder : ℂ := smoothedSum f σ φ x - poleTerm A σ φ x lemma poleTerm_one : poleTerm A 1 φ x = A * ∫ u in Ici (-log x), φ ((2 * π)⁻¹ * u) := by simp [poleTerm] +end Statistics + variable {f : ℕ → ℝ} {C A : ℝ} {G : ℂ → ℂ} (h : IsWienerIkehara f C A G) section FourierIdentities @@ -194,10 +318,11 @@ lemma poleTerm_fourier_eq : rw [show 1 - (σ : ℂ) + (σ - 1 + t * I) = t * I by ring] ring -include h hx in +variable {ψ} in +include h hx hσ in /-- The main result of this section: an initial Fourier identity expressing a sum of `f` as an error term of Fourier integral type. -/ -lemma remainder_fourier_eq {ψ : 𝓢(ℝ, ℂ)} (hψ : HasCompactSupport ψ) {σ : ℝ} (hσ : 1 < σ) : +lemma remainder_fourier_eq (hψ : HasCompactSupport ψ) : remainder f A σ (𝓕 ψ) x = ∫ t : ℝ, G (σ + t * I) * ψ t * x ^ (t * I) := by have hσt (t : ℝ) : 1 < (σ + t * I).re := by simpa using hσ have (t : ℝ) : (σ : ℂ) + t * I - 1 ≠ 0 := ne_zero_of_re_pos (by simpa using hσ) @@ -214,112 +339,12 @@ lemma remainder_fourier_eq {ψ : 𝓢(ℝ, ℂ)} (hψ : HasCompactSupport ψ) { end FourierIdentities -section Weight - -variable {a c t x : ℝ} {n : ℕ} - -/-- A weight function appearing in the analysis. -/ -def weight (t : ℝ) : ℝ := (t * (1 + ((2 * π)⁻¹ * log t) ^ 2))⁻¹ - -lemma weight_nonneg (ht : 0 ≤ t) : 0 ≤ weight t := by rw [weight]; positivity - -lemma hasDerivAt_weight (ht : t ≠ 0) : HasDerivAt weight - (-((2 * π)⁻¹ ^ 2 * (log t + 1) ^ 2 + (1 - (2 * π)⁻¹) * (1 + (2 * π)⁻¹)) * weight t ^ 2) t := by - have : HasDerivAt (fun t ↦ t * (1 + ((2 * π)⁻¹ * log t) ^ 2)) - (1 + 2 * (2 * π)⁻¹ ^ 2 * log t + ((2 * π)⁻¹ * log t) ^ 2) t := by - convert (hasDerivAt_id' t).mul ?_ (d' := 2 * (2 * π)⁻¹ ^ 2 * t⁻¹ * log t) using 1 - · grind - convert (((hasDerivAt_log ht).const_mul _).pow (f' := (2 * π)⁻¹ * t⁻¹) 2).const_add _ using 1 - ring - unfold weight - convert this.inv (by positivity) using 1 - grind - -lemma antitoneOn_weight : AntitoneOn weight (Ioi 0) := by - refine antitoneOn_of_hasDerivWithinAt_nonpos (convex_Ioi _) - (fun _ _ ↦ (hasDerivAt_weight (by grind)).continuousAt.continuousWithinAt) - (fun _ _ ↦ (hasDerivAt_weight (fun _ ↦ by simp_all)).hasDerivWithinAt) - fun x _ ↦ ?_ - have : 0 < 1 - (2 * π)⁻¹ := by grind [two_le_pi, inv_lt_one_of_one_lt₀] - simp only [neg_mul, Left.neg_nonpos_iff] - positivity - -lemma integrableOn_mul_weight_div (hc : 0 < c) : - IntegrableOn (fun t ↦ a * weight (t / c)) (Ici 0) := by - have (t) (ht : 0 < t) : - t⁻¹ • (a * c * (1 + ((2 * π)⁻¹ * (log t - log c)) ^ 2)⁻¹) = a * weight (t / c) := by - simp [weight, log_div ht.ne' hc.ne', field] - rw [integrableOn_Ici_iff_integrableOn_Ioi] - exact ((integrableOn_comp_log_Ioi_zero _).2 - (((integrable_inv_one_add_mul_sq (by positivity)).comp_sub_right _).const_mul _)).congr_fun - this measurableSet_Ioi - -lemma antitoneOn_inv_mul_weight_div (hx : 0 < x) : - AntitoneOn (fun t ↦ x⁻¹ * weight (t / x)) (Ioc 0 n) := by - intro u hu v hv huv - dsimp only - gcongr - exact antitoneOn_weight (div_pos hu.1 hx) (div_pos hv.1 hx) (by gcongr) - -lemma integrableOn_inv_mul_weight_div (hx : 0 < x) : - IntegrableOn (fun t ↦ x⁻¹ * weight (t / x)) (Icc 0 n) := - .mono_set (integrableOn_mul_weight_div (by positivity)) Icc_subset_Ici_self - -lemma inv_mul_weight_div (hx : x ≠ 0) (t : ℝ) : - x⁻¹ * weight (t / x) = (t * (1 + ((2 * π)⁻¹ * log (t / x)) ^ 2))⁻¹ := by - grind [weight] - -lemma inv_mul_weight_div_le_one (hx : x ≠ 0) (ht : 1 ≤ t) : x⁻¹ * weight (t / x) ≤ 1 := by - rw [inv_mul_weight_div hx] - exact inv_le_one_of_one_le₀ <| one_le_mul_of_one_le_of_one_le ht <| - le_add_of_nonneg_right (sq_nonneg _) - -lemma antitone_ite_weight (hx : 0 < x) : - Antitone fun i : ℕ ↦ if i = 0 then (1 : ℝ) else x⁻¹ * weight (i / x) := by - intro i j hij - rcases eq_or_ne j 0 with rfl | hj - · grind - simp only [hj, ↓reduceIte] - split_ifs with hi - · exact inv_mul_weight_div_le_one hx.ne' (mod_cast by grind) - · gcongr - exact antitoneOn_weight (mem_Ioi.mpr (by positivity)) (mem_Ioi.mpr (by positivity)) (by gcongr) - -end Weight - section LimitingFourierIdentity -variable {x : ℝ} (Ψ : 𝓢(ℝ, ℂ)) (hΨ : HasCompactSupport Ψ) (hx : 1 ≤ x) (n : ℕ) - -include hx in -lemma sum_range_ite_weight_le : - ∑ i ∈ .range n, (if i = 0 then 1 else x⁻¹ * weight (i / x)) ≤ - 1 + ∫ t in Ioi 0, weight t := by - have hx₀ : 0 < x := zero_lt_one.trans_le hx - rcases n with _ | m - · simpa using add_nonneg zero_le_one - (setIntegral_nonneg measurableSet_Ioi fun t ht ↦ weight_nonneg ht.le) - simp only [Finset.sum_range_succ', Nat.add_one_ne_zero, ↓reduceIte] - rw [add_comm _ (1 : ℝ)] - gcongr - calc - _ ≤ ∫ t in 0..m, x⁻¹ * weight (t / x) := by - simpa using @AntitoneOn.sum_le_integral_of_integrableOn 0 m (fun t ↦ x⁻¹ * weight (t / x)) - (by simpa using antitoneOn_inv_mul_weight_div hx₀) - (by simpa using integrableOn_inv_mul_weight_div hx₀) - _ = ∫ t in 0..m / x, weight t := by - rw [intervalIntegral.integral_const_mul, intervalIntegral.integral_comp_div weight hx₀.ne', - zero_div, smul_eq_mul, ← mul_assoc, inv_mul_cancel₀ hx₀.ne', one_mul] - _ ≤ ∫ t in Ioi 0, weight t := by - rw [intervalIntegral.integral_of_le (by positivity)] - exact setIntegral_mono_set - (by simpa using - (integrableOn_mul_weight_div (a := 1) zero_lt_one).mono_set Ioi_subset_Ici_self) - (eventually_of_mem (self_mem_ae_restrict measurableSet_Ioi) fun t ht ↦ weight_nonneg ht.le) - Ioc_subset_Ioi_self.eventuallySubset +variable {x : ℝ} (Ψ : 𝓢(ℝ, ℂ)) (hx : 1 ≤ x) include h hx in -lemma bound_sum_log_range : +lemma bound_sum_log_range (n : ℕ) : ∑ i ∈ .range n, ‖f i‖ / i * (1 + ((2 * π)⁻¹ * log (i / x)) ^ 2)⁻¹ ≤ C * (1 + ∫ t in Ioi 0, weight t) := by have hx₀ : 0 < x := zero_lt_one.trans_le hx @@ -339,7 +364,7 @@ lemma bound_sum_log_range : _ ≤ C * (1 + ∫ t in Ioi 0, weight t) := by rw [← Finset.mul_sum] gcongr - exact sum_range_ite_weight_le hx n + exact sum_range_ite_weight_le hx include h hx in lemma summable_sum_log_range : @@ -347,16 +372,6 @@ lemma summable_sum_log_range : summable_of_sum_range_le (fun _ ↦ by positivity) fun n ↦ by simpa using bound_sum_log_range h hx n -lemma norm_term_mul_le (x : ℝ) (f : ℕ → ℂ) (n : ℕ) : - ‖term f 1 n * 𝓕 Ψ ((2 * π)⁻¹ * log (n / x))‖ ≤ - fourierSeminorm Ψ * (‖f n‖ / n * (1 + ((2 * π)⁻¹ * log (n / x)) ^ 2)⁻¹) := by - convert mul_le_mul_of_nonneg_left - (norm_fourier_le_fourierSeminorm_mul Ψ ((2 * π)⁻¹ * log (n / x))) - (norm_nonneg (f n / n)) using 1 - · simp [term_of_ne_zero'] - · rw [norm_div, Complex.norm_natCast] - ring - include h hx in lemma tendsto_smoothedSum : Tendsto (smoothedSum f · (𝓕 Ψ) x) (𝓝[>] 1) (𝓝 (smoothedSum f 1 (𝓕 Ψ) x)) := by @@ -393,8 +408,8 @@ lemma tendsto_poleTerm : rexp (-t * (σ - 1)) ≤ rexp (log x) := exp_le_exp.mpr (by nlinarith [log_nonneg hx]) _ = x := exp_log hx₀ -include h hΨ in -lemma tendsto_remainder_one_fourier_of_hasCompactSupport : +include h in +lemma tendsto_remainder_one_fourier_of_hasCompactSupport (hΨ : HasCompactSupport Ψ) : Tendsto (remainder f A 1 (𝓕 Ψ)) atTop (𝓝 0) := by refine (tendsto_integral_cpow_mul_I_smul_atTop fun t ↦ G (1 + t * I) * Ψ t).congr' ?_ filter_upwards [eventually_ge_atTop 1] with x hx @@ -410,7 +425,7 @@ lemma tendsto_remainder_one_fourier_of_hasCompactSupport : ((tendsto_smoothedSum h Ψ hx).sub (tendsto_poleTerm Ψ hx)) ((hcont 1 self_mem_Ici).tendsto.mono_left (nhdsWithin_mono _ Ioi_subset_Ici_self)) (eventuallyEq_nhdsWithin_iff.mpr <| .of_forall fun σ hσ ↦ - remainder_fourier_eq h (by linarith) hΨ hσ)] + remainder_fourier_eq h (by linarith) hσ hΨ)] simp only [ofReal_one, smul_eq_mul] congr with t ring @@ -419,18 +434,7 @@ end LimitingFourierIdentity section LimitingFourierIdentitySchwartz -variable (Ψ φ φ' : 𝓢(ℝ, ℂ)) {x : ℝ} (hx : 1 ≤ x) - -lemma norm_setIntegral_fourier_le (x : ℝ) : - ‖∫ u in Ici (-log x), 𝓕 Ψ ((2 * π)⁻¹ * u)‖ ≤ - fourierSeminorm Ψ * ∫ u, (1 + ((2 * π)⁻¹ * u) ^ 2)⁻¹ := by - have hint : Integrable fun u : ℝ ↦ fourierSeminorm Ψ * (1 + ((2 * π)⁻¹ * u) ^ 2)⁻¹ := - (integrable_inv_one_add_sq.comp_mul_left' (by positivity)).const_mul _ - rw [← integral_const_mul] - exact (norm_integral_le_of_norm_le hint.integrableOn - (.of_forall fun u ↦ norm_fourier_le_fourierSeminorm_mul Ψ _)).trans - (setIntegral_le_integral hint - (.of_forall fun _ ↦ mul_nonneg (fourierSeminorm_nonneg Ψ) (by positivity))) +variable (Ψ : 𝓢(ℝ, ℂ)) {x : ℝ} (hx : 1 ≤ x) include h hx in lemma summable_term_mul : Summable fun n ↦ ‖term ↗f 1 n * 𝓕 Ψ ((2 * π)⁻¹ * log (n / x))‖ := @@ -439,7 +443,7 @@ lemma summable_term_mul : Summable fun n ↦ ‖term ↗f 1 n * 𝓕 Ψ ((2 * π include h hx in /-- The map `φ ↦ remainder f A 1 (𝓕 φ) x` is linear in the test function. -/ -lemma remainder_one_fourier_sub : +lemma remainder_one_fourier_sub (φ φ' : 𝓢(ℝ, ℂ)) : remainder f A 1 (𝓕 (φ - φ')) x = remainder f A 1 (𝓕 φ) x - remainder f A 1 (𝓕 φ') x := by have hs (ψ : 𝓢(ℝ, ℂ)) := (summable_term_mul h ψ hx).of_norm have hi (ψ : 𝓢(ℝ, ℂ)) : IntegrableOn (fun u ↦ 𝓕 ψ ((2 * π)⁻¹ * u)) (Ici (-log x)) := @@ -488,7 +492,7 @@ lemma tendsto_remainder_one_fourier : Tendsto (remainder f A 1 (𝓕 Ψ)) atTop (tendsto_remainder_one_fourier_of_hasCompactSupport h φ hφcs) (ε / 2) (half_pos hε)] with x hx hφ rw [dist_zero_right] at hφ ⊢ - grind [remainder_one_fourier_sub h Ψ φ hx, norm_sub_norm_le, hK (Ψ - φ) hx] + grind [remainder_one_fourier_sub h hx Ψ φ, norm_sub_norm_le, hK (Ψ - φ) hx] end LimitingFourierIdentitySchwartz @@ -497,6 +501,21 @@ section Smooth variable {ψ : ℝ → ℂ} (hsmooth : ContDiff ℝ ∞ ψ) (hsupp : HasCompactSupport ψ) (hplus : tsupport ψ ⊆ Ioi 0) +include hsmooth hsupp hplus in +/-- `y ↦ y * ψ y`, written in the variable `(2 * π)⁻¹ * log y`, is a Fourier transform. -/ +lemma exists_fourier_eq : ∃ g : 𝓢(ℝ, ℂ), ∀ y > 0, 𝓕 g ((2 * π)⁻¹ * log y) = y * ψ y := by + let k x := rexp (2 * π * x) * ψ (exp (2 * π * x)) + have hk : ContDiff ℝ ∞ k := by + have : ContDiff ℝ ∞ fun x ↦ rexp (2 * π * x) := by fun_prop + exact (ofRealCLM.contDiff.comp this).mul (hsmooth.comp this) + have hk' : HasCompactSupport k := by + have := (hsupp.comp_exp fun h₀ ↦ lt_irrefl 0 (hplus h₀)).comp_smul two_pi_pos.ne' + simpa using! this.mul_left + refine ⟨𝓕⁻ (hk'.toSchwartzMap hk), fun y hy ↦ ?_⟩ + simp only [fourier_fourierInv_eq, HasCompactSupport.toSchwartzMap_toFun, k] + field_simp + simp [exp_log hy] + include h hsmooth hsupp hplus in /-- A smoothed *Wiener-Ikehara Tauberian Theorem*: If `f` is a nonnegative arithmetic function with `∑ i < n, f i ≤ C * n` whose L-series has a simple pole at `s = 1` with residue `A` @@ -505,19 +524,7 @@ asymptotically with respect to smooth weights with compact support in `(0, ∞)` public lemma tendsto_sum_div_smooth : Tendsto (fun x ↦ (∑' n, f n * ψ (n / x)) / x) atTop (𝓝 (A * ∫ y in Ioi 0, ψ y)) := by have hψ₀ : ψ =ᶠ[𝓝 0] 0 := notMem_tsupport_iff_eventuallyEq.mp fun h₀ ↦ lt_irrefl 0 (hplus h₀) - -- `y ↦ y * ψ y`, written in the variable `(2 * π)⁻¹ * log y`, is a Fourier transform. - obtain ⟨g, hg⟩ : ∃ g : 𝓢(ℝ, ℂ), ∀ y > 0, 𝓕 g ((2 * π)⁻¹ * log y) = y * ψ y := by - let k x := rexp (2 * π * x) * ψ (exp (2 * π * x)) - have hk : ContDiff ℝ ∞ k := by - have : ContDiff ℝ ∞ fun x ↦ rexp (2 * π * x) := by fun_prop - exact (ofRealCLM.contDiff.comp this).mul (hsmooth.comp this) - have hk' : HasCompactSupport k := by - have := (hsupp.comp_exp fun h₀ ↦ lt_irrefl 0 (hplus h₀)).comp_smul two_pi_pos.ne' - simpa using! this.mul_left - refine ⟨𝓕⁻ (hk'.toSchwartzMap hk), fun y hy ↦ ?_⟩ - simp only [fourier_fourierInv_eq, HasCompactSupport.toSchwartzMap_toFun, k] - field_simp - simp [exp_log hy] + obtain ⟨g, hg⟩ := exists_fourier_eq hsmooth hsupp hplus have key : ∀ᶠ x in atTop, remainder f A 1 (𝓕 g) x = ∑' n, f n * ψ (n / x) / x - A * ∫ y in Ioi 0, ψ y := by filter_upwards [eventually_gt_atTop 0, tendsto_inv_atTop_zero.eventually @@ -536,6 +543,8 @@ public lemma tendsto_sum_div_smooth : Tendsto (fun x ↦ (∑' n, f n * ψ (n / simpa [tendsto_sub_nhds_zero_iff, tsum_div_const] using (tendsto_remainder_one_fourier h g).congr' key +end Smooth + include h in /-- A version of smoothed Wiener-Ikehara for real-valued cutoffs. -/ public lemma tendsto_sum_div_smooth_real {Ψ : ℝ → ℝ} (hsmooth : ContDiff ℝ ∞ Ψ) @@ -547,20 +556,28 @@ public lemma tendsto_sum_div_smooth_real {Ψ : ℝ → ℝ} (hsmooth : ContDiff simp only [comp_apply, ofRealCLM_apply, mul_re, ofReal_re, ofReal_im, zero_mul, sub_zero] at this exact_mod_cast this -end Smooth +/-- A smooth cutoff supported in `Ioi 0`: a version of +`Real.exists_contDiff_indicator_Icc_le_le_indicator_Ioo` for `0 ≤ a`, with the integrals taken +over `Ioi 0`. -/ +lemma exists_cutoff {a b c d : ℝ} (ha : 0 ≤ a) (hab : a < b) (hbc : b ≤ c) (hcd : c < d) : + ∃ ψ : ℝ → ℝ, ContDiff ℝ ∞ ψ ∧ HasCompactSupport ψ ∧ tsupport ψ ⊆ Ioi 0 ∧ + (Icc b c).indicator 1 ≤ ψ ∧ ψ ≤ (Ioo a d).indicator 1 ∧ + ∫ y in Ioi 0, ψ y ∈ Icc (c - b) (d - a) := by + obtain ⟨ψ, hψ, hcs, hts, hle, hle', hint⟩ := + Real.exists_contDiff_indicator_Icc_le_le_indicator_Ioo hab hbc hcd + have hts' : tsupport ψ ⊆ Ioi 0 := hts.trans fun y hy ↦ ha.trans_lt hy.1 + refine ⟨ψ, hψ, hcs, hts', hle, hle', ?_⟩ + rwa [setIntegral_eq_integral_of_forall_compl_eq_zero + fun y hy ↦ image_eq_zero_of_notMem_tsupport fun h' ↦ hy (hts' h')] include h in /-- The residue `A` in the Wiener-Ikehara theorem is non-negative. -/ public theorem _root_.IsWienerIkehara.A_nonneg : 0 ≤ A := by - obtain ⟨ψ, hψ, hcs, hts, hle, -, hint, -⟩ := - Real.exists_contDiff_indicator_Icc_le_le_indicator_Ioo one_lt_two (by norm_num : (2 : ℝ) ≤ 3) - (by norm_num : (3 : ℝ) < 4) - have hts' : tsupport ψ ⊆ Ioi 0 := hts.trans fun y hy ↦ zero_lt_one.trans hy.1 - have hI : ∫ y in Ioi 0, ψ y = ∫ y, ψ y := setIntegral_eq_integral_of_forall_compl_eq_zero - fun y hy ↦ image_eq_zero_of_notMem_tsupport fun h' ↦ hy (hts' h') + obtain ⟨ψ, hψ, hcs, hts, hle, -, ⟨hint, -⟩⟩ := + exists_cutoff zero_le_one one_lt_two (by norm_num : (2 : ℝ) ≤ 3) (by norm_num : (3 : ℝ) < 4) have hψ₀ (y : ℝ) : 0 ≤ ψ y := (indicator_nonneg (fun _ _ ↦ zero_le_one) y).trans (hle y) refine nonneg_of_mul_nonneg_left (ge_of_tendsto - (tendsto_sum_div_smooth_real h hψ hcs hts') ?_) (by rw [hI]; linarith) + (tendsto_sum_div_smooth_real h hψ hcs hts) ?_) (by linarith) filter_upwards [eventually_ge_atTop 0] with x hx exact div_nonneg (tsum_nonneg fun n ↦ mul_nonneg (h.nonneg n) (hψ₀ _)) hx @@ -571,14 +588,10 @@ lemma eventually_lt_sum_range_div {c : ℝ} (hc : c < A) : have : ContinuousWithinAt (fun ε ↦ A * (1 - 3 * ε)) (Ioi 0) 0 := by fun_prop exact this (Ioi_mem_nhds (by grind)) obtain ⟨ε, hcε, hε, hε'⟩ := (hg.and (Ioc_mem_nhdsGT (by norm_num : (0 : ℝ) < 1 / 3))).exists - obtain ⟨ψ, hψ, hcs, hts, -, hle, hint, -⟩ := - Real.exists_contDiff_indicator_Icc_le_le_indicator_Ioo (by linarith : ε < 2 * ε) (by linarith) - (by linarith : 1 - ε < 1) - have hts' : tsupport ψ ⊆ Ioi 0 := hts.trans fun y hy ↦ hε.trans hy.1 - have hI : ∫ y in Ioi 0, ψ y = ∫ y, ψ y := setIntegral_eq_integral_of_forall_compl_eq_zero - fun y hy ↦ image_eq_zero_of_notMem_tsupport fun h' ↦ hy (hts' h') - filter_upwards [(tendsto_sum_div_smooth_real h hψ hcs hts').comp - tendsto_natCast_atTop_atTop (Ioi_mem_nhds (by rw [hI]; nlinarith [h.A_nonneg]) + obtain ⟨ψ, hψ, hcs, hts, -, hle, ⟨hint, -⟩⟩ := + exists_cutoff hε.le (by linarith : ε < 2 * ε) (by linarith) (by linarith : 1 - ε < 1) + filter_upwards [(tendsto_sum_div_smooth_real h hψ hcs hts).comp + tendsto_natCast_atTop_atTop (Ioi_mem_nhds (by nlinarith [h.A_nonneg]) (a := c)), eventually_gt_atTop 0] with N hN _ have hN₀ : (0 : ℝ) < N := by norm_cast refine hN.trans_le ?_ @@ -596,16 +609,10 @@ lemma eventually_sum_range_div_lt {c : ℝ} (hc : A < c) : have : ContinuousWithinAt (fun ε ↦ A + 2 * C * ε + ε) (Ioi 0) 0 := by fun_prop exact this (Iio_mem_nhds (by grind)) obtain ⟨ε, hcε, hε, hε'⟩ := (hg.and (Ioc_mem_nhdsGT (by norm_num : (0 : ℝ) < 1 / 4))).exists - obtain ⟨ψ, hψ, hcs, hts, hle, -, -, hint⟩ := - Real.exists_contDiff_indicator_Icc_le_le_indicator_Ioo (by linarith : ε < 2 * ε) (by linarith) - (by linarith : 1 < 1 + ε) - have hts' : tsupport ψ ⊆ Ioi 0 := hts.trans fun y hy ↦ hε.trans hy.1 - have hI : ∫ y in Ioi 0, ψ y = ∫ y, ψ y := setIntegral_eq_integral_of_forall_compl_eq_zero - fun y hy ↦ image_eq_zero_of_notMem_tsupport fun h' ↦ hy (hts' h') - have hcψ : A * ∫ y in Ioi 0, ψ y < c - 2 * C * ε - ε := by - rw [hI] - nlinarith [h.A_nonneg] - filter_upwards [(tendsto_sum_div_smooth_real h hψ hcs hts').comp + obtain ⟨ψ, hψ, hcs, hts, hle, -, ⟨-, hint⟩⟩ := + exists_cutoff hε.le (by linarith : ε < 2 * ε) (by linarith) (by linarith : 1 < 1 + ε) + have hcψ : A * ∫ y in Ioi 0, ψ y < c - 2 * C * ε - ε := by nlinarith [h.A_nonneg] + filter_upwards [(tendsto_sum_div_smooth_real h hψ hcs hts).comp tendsto_natCast_atTop_atTop (Iio_mem_nhds hcψ), eventually_gt_atTop 0, (tendsto_const_div_atTop_nhds_zero_nat C).eventually (gt_mem_nhds hε)] with N hN _ hN' have hN₀ : (0 : ℝ) < N := by norm_cast