math / data /lean /OAI /Dynamics /ThreeTorus /PositiveLaws.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
74.4 kB
import Mathlib namespace OAI /-! Positive Fourier laws, compact integral differentiation, affine densities, and prime-sieve signal laws. -/ noncomputable section open MeasureTheory Filter Set Complex open scoped Topology SchwartzMap FourierTransform Real open scoped Topology open MeasureTheory Set open scoped ENNReal Topology open Set Function Filter open scoped Topology NNReal open MeasureTheory Filter Set open MeasureTheory Set Function open scoped Topology ENNReal open scoped Topology BigOperators noncomputable section open MeasureTheory Set Filter open scoped Topology namespace ThreeTorus /-- Compact-parameter differentiation, used by the exact passage near epsilon=0. -/ lemma hasFDerivAt_compact_integral {E : Type} {G : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] [NormedAddCommGroup G] [NormedSpace ℝ G] [CompleteSpace G] {F : E Γ— ℝ β†’ G} (hF : ContDiff ℝ 1 F) (a b : ℝ) (x : E) : HasFDerivAt (fun y => ∫ t in a..b, F (y,t)) (∫ t in a..b, (fderiv ℝ F (x,t)).comp (ContinuousLinearMap.inl ℝ E ℝ)) x := by let D : E Γ— ℝ β†’ E β†’L[ℝ] G := fun p => (fderiv ℝ F p).comp (ContinuousLinearMap.inl ℝ E ℝ) have hD : Continuous D := hF.continuous_fderiv (by norm_num) |>.clm_comp continuous_const obtain ⟨C,hC⟩ := ((isCompact_closedBall x 1).prod (isCompact_uIcc (a := a) (b := b))).exists_bound_of_continuousOn hD.continuousOn refine hasFDerivAt_integral_of_dominated_of_fderiv_le'' (F := fun y t => F (y,t)) (F' := fun y t => D (y,t)) (bound := fun _ => C) (Metric.closedBall_mem_nhds x (by norm_num : (0:ℝ)<1)) ?_ ?_ ?_ ?_ intervalIntegrable_const ?_ Β· exact Eventually.of_forall (fun y => (hF.continuous.comp (continuous_const.prodMk continuous_id)).aestronglyMeasurable) Β· exact (hF.continuous.comp (continuous_const.prodMk continuous_id)).intervalIntegrable _ _ Β· exact (hD.comp (continuous_const.prodMk continuous_id)).aestronglyMeasurable Β· filter_upwards [ae_restrict_mem measurableSet_uIoc] with t ht intro y hy exact hC (y,t) ⟨hy,uIoc_subset_uIcc ht⟩ Β· exact Eventually.of_forall (fun t y _ => by simpa [D,Function.comp_def] using ((hF.differentiable one_ne_zero ((ContinuousLinearMap.inl ℝ E ℝ) y+(0,t))).hasFDerivAt).comp y ((ContinuousLinearMap.inl ℝ E ℝ).hasFDerivAt.add_const (0,t))) /-- Smooth parameter integration over a fixed compact interval. -/ lemma contDiff_compact_integral {E : Type} {G : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] [NormedAddCommGroup G] [NormedSpace ℝ G] [CompleteSpace G] (n : β„•) {F : E Γ— ℝ β†’ G} (hF : ContDiff ℝ n F) (a b : ℝ) : ContDiff ℝ n (fun y => ∫ t in a..b, F (y,t)) := by induction n generalizing G with | zero => apply contDiff_zero.mpr exact intervalIntegral.continuous_parametric_intervalIntegral_of_continuous' (show Continuous (Function.uncurry (fun y t => F (y,t))) from hF.continuous) a b | succ n ih => let D : E Γ— ℝ β†’ E β†’L[ℝ] G := fun p => (fderiv ℝ F p).comp (ContinuousLinearMap.inl ℝ E ℝ) have hD : ContDiff ℝ n D := (hF.fderiv_right (by simp)).clm_comp contDiff_const have hder (x : E) := hasFDerivAt_compact_integral (hF.of_le (by exact_mod_cast Nat.succ_pos n)) a b x rw [show ((n+1 : β„•) : WithTop β„•βˆž) = (n : WithTop β„•βˆž)+1 by simp, contDiff_succ_iff_fderiv] refine ⟨fun x => (hder x).differentiableAt, ?_, ?_⟩ Β· simp Β· have heq : fderiv ℝ (fun y => ∫ t in a..b, F (y,t)) = fun y => ∫ t in a..b, D (y,t) := by funext y exact (hder y).fderiv rw [heq] exact ih hD lemma smooth_compact_integral {E : Type} {G : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] [NormedAddCommGroup G] [NormedSpace ℝ G] [CompleteSpace G] {F : E Γ— ℝ β†’ G} (hF : ContDiff ℝ ((⊀ : β„•βˆž) : WithTop β„•βˆž) F) (a b : ℝ) : ContDiff ℝ ((⊀ : β„•βˆž) : WithTop β„•βˆž) (fun y => ∫ t in a..b, F (y,t)) := by rw [contDiff_infty] intro n exact contDiff_compact_integral n (hF.of_le (by exact_mod_cast (le_top : (n : β„•βˆž) ≀ ⊀))) a b /-! The positive Fourier law. The sinc and averaged baseline below are exactly those of the manuscript, including the scale and normalization. -/ open scoped FourierTransform Convolution lemma sinc_eq_integral_cos (x : ℝ) : Real.sinc x = ∫ t in (0 : ℝ)..1, Real.cos (x*t) := by by_cases hx : x = 0 Β· simp [hx] Β· rw [intervalIntegral.integral_comp_mul_left _ hx,integral_cos] simp only [mul_zero,mul_one,Real.sin_zero,sub_zero,smul_eq_mul] rw [Real.sinc_of_ne_zero hx] ring lemma smooth_sinc : ContDiff ℝ ((⊀ : β„•βˆž) : WithTop β„•βˆž) Real.sinc := by rw [show Real.sinc = (fun x => ∫ t in (0 : ℝ)..1, Real.cos (x*t)) from funext sinc_eq_integral_cos] exact smooth_compact_integral (F := fun p : ℝ Γ— ℝ => Real.cos (p.1*p.2)) (by fun_prop) 0 1 def signalSinc (Ξ± R : ℝ) : ℝ := Ξ± * Real.sinc (Real.pi*Ξ±*R)^2 def signalAverageRadius (Ξ± : ℝ) : ℝ := (2*Ξ±)⁻¹ def signalBaseline (Ξ± R : ℝ) : ℝ := (2*signalAverageRadius Ξ±)⁻¹ * ∫ t in -signalAverageRadius Ξ±..signalAverageRadius Ξ±, signalSinc Ξ± (R-t) lemma signalSinc_nonneg {Ξ± : ℝ} (hΞ± : 0 ≀ Ξ±) (R : ℝ) : 0 ≀ signalSinc Ξ± R := mul_nonneg hΞ± (sq_nonneg _) lemma smooth_signalSinc (Ξ± : ℝ) : ContDiff ℝ ((⊀ : β„•βˆž) : WithTop β„•βˆž) (signalSinc Ξ±) := by exact contDiff_const.mul ((smooth_sinc.comp (by fun_prop)).pow 2) lemma smooth_signalBaseline (Ξ± : ℝ) : ContDiff ℝ ((⊀ : β„•βˆž) : WithTop β„•βˆž) (signalBaseline Ξ±) := by apply contDiff_const.mul exact smooth_compact_integral (F := fun p : ℝ Γ— ℝ => signalSinc Ξ± (p.1-p.2)) ((smooth_signalSinc Ξ±).comp (by fun_prop)) _ _ lemma sinc_sq_le (x : ℝ) : Real.sinc x ^ 2 ≀ 1 := by simpa only [sq_abs,one_pow] using (sq_le_sqβ‚€ (abs_nonneg (Real.sinc x)) (by norm_num : (0:ℝ) ≀ 1)).2 (Real.abs_sinc_le_one x) lemma sin_sq_le_one (x : ℝ) : Real.sin x ^ 2 ≀ 1 := by simpa only [sq_abs,one_pow] using (sq_le_sqβ‚€ (abs_nonneg (Real.sin x)) (by norm_num : (0:ℝ) ≀ 1)).2 (Real.abs_sin_le_one x) lemma sinc_sq_mul_sq_le (x : ℝ) : Real.sinc x ^ 2 * x^2 ≀ 1 := by by_cases hx : x = 0 Β· simp [hx] Β· rw [Real.sinc_of_ne_zero hx] field_simp exact sin_sq_le_one x lemma signalSinc_decay {Ξ± : ℝ} (hΞ± : 0 < Ξ±) (R : ℝ) : signalSinc Ξ± R ≀ (Ξ± + (Real.pi^2*Ξ±)⁻¹) * (1+R^2)⁻¹ := by have ha : Real.pi^2*Ξ± > 0 := by positivity have hsmall : signalSinc Ξ± R ≀ Ξ± := mul_le_of_le_one_right hΞ±.le (sinc_sq_le _) have hlarge : signalSinc Ξ± R * R^2 ≀ (Real.pi^2*Ξ±)⁻¹ := by have := sinc_sq_mul_sq_le (Real.pi*Ξ±*R) rw [← one_div] apply (le_div_iffβ‚€ ha).2 dsimp [signalSinc] nlinarith have hd : 0 < 1+R^2 := by positivity rw [← div_eq_mul_inv,le_div_iffβ‚€ hd] nlinarith lemma integrable_signalSinc {Ξ± : ℝ} (hΞ± : 0 < Ξ±) : Integrable (signalSinc Ξ±) := by apply (integrable_inv_one_add_sq.const_mul (Ξ± + (Real.pi^2*Ξ±)⁻¹)).mono' (smooth_signalSinc Ξ±).continuous.aestronglyMeasurable filter_upwards [] with R rw [Real.norm_eq_abs,abs_of_nonneg (signalSinc_nonneg hΞ±.le R)] exact signalSinc_decay hΞ± R lemma signalAverageRadius_pos {Ξ± : ℝ} (hΞ± : 0 < Ξ±) : 0 < signalAverageRadius Ξ± := by dsimp [signalAverageRadius] positivity lemma signalSinc_denominator {Ξ± : ℝ} (hΞ± : 0 < Ξ±) (R : ℝ) : signalSinc Ξ± R * (Real.pi^2*Ξ±*R^2) = Real.sin (Real.pi*Ξ±*R)^2 := by by_cases hR : R = 0 Β· simp [hR] Β· dsimp [signalSinc] rw [Real.sinc_of_ne_zero (by positivity : Real.pi*Ξ±*R β‰  0)] field_simp lemma integral_sin_sq_pi (x : ℝ) : ∫ t in x..x+Real.pi, Real.sin t^2 = Real.pi/2 := by rw [integral_sin_sq,Real.sin_add_pi,Real.cos_add_pi] ring lemma signal_sin_sq_average {Ξ± : ℝ} (hΞ± : 0 < Ξ±) (R : ℝ) : ∫ t in -signalAverageRadius Ξ±..signalAverageRadius Ξ±, Real.sin (Real.pi*Ξ±*(R-t))^2 = signalAverageRadius Ξ± := by rw [intervalIntegral.integral_comp_sub_left (fun u => Real.sin (Real.pi*Ξ±*u)^2) R] rw [intervalIntegral.integral_comp_mul_left (fun v => Real.sin v^2) (mul_ne_zero Real.pi_ne_zero hΞ±.ne')] have hh : Real.pi*Ξ±*(R- -signalAverageRadius Ξ±) = Real.pi*Ξ±*(R-signalAverageRadius Ξ±)+Real.pi := by dsimp [signalAverageRadius] field_simp ring rw [hh,integral_sin_sq_pi,smul_eq_mul] dsimp [signalAverageRadius] field_simp lemma signalBaseline_nonneg {Ξ± : ℝ} (hΞ± : 0 < Ξ±) (R : ℝ) : 0 ≀ signalBaseline Ξ± R := by apply mul_nonneg (by dsimp [signalAverageRadius]; positivity) apply intervalIntegral.integral_nonneg (by linarith [signalAverageRadius_pos hΞ±]) intro t _ exact signalSinc_nonneg hΞ±.le (R-t) /-- The averaging interval has exactly one sine-square period. In fact the manuscript's lower tail estimate holds at every point, including the origin. -/ lemma signalBaseline_lower {Ξ± : ℝ} (hΞ± : 0 < Ξ±) (R : ℝ) : 1 / (2*Real.pi^2*Ξ±*(|R|+signalAverageRadius Ξ±)^2) ≀ signalBaseline Ξ± R := by let a := signalAverageRadius Ξ± have ha : 0 < a := signalAverageRadius_pos hΞ± have hΞΊ : 0 < Real.pi^2*Ξ±*(|R|+a)^2 := by positivity have hp : 0 < Real.pi^2*Ξ± := by positivity have hi : a ≀ (Real.pi^2*Ξ±*(|R|+a)^2) * ∫ t in -a..a, signalSinc Ξ± (R-t) := by calc a = ∫ t in -a..a, Real.sin (Real.pi*Ξ±*(R-t))^2 := (signal_sin_sq_average hΞ± R).symm _ ≀ _ := ?_ rw [← intervalIntegral.integral_const_mul] apply intervalIntegral.integral_mono_on (by linarith) ((by fun_prop : Continuous (fun t => Real.sin (Real.pi*Ξ±*(R-t))^2)).intervalIntegrable _ _) (by exact (continuous_const.mul ((smooth_signalSinc Ξ±).continuous.comp (by fun_prop))).intervalIntegrable _ _) intro t ht have ht' : |t| ≀ a := abs_le.mpr ⟨ht.1,ht.2⟩ have hdist : |R-t| ≀ |R|+a := (abs_sub R t).trans (by linarith) have hs : (R-t)^2 ≀ (|R|+a)^2 := by simpa only [sq_abs] using (sq_le_sqβ‚€ (abs_nonneg _) (by positivity)).2 hdist rw [← signalSinc_denominator hΞ± (R-t)] nlinarith [mul_le_mul_of_nonneg_left (mul_le_mul_of_nonneg_left hs hp.le) (signalSinc_nonneg hΞ±.le (R-t))] rw [div_le_iffβ‚€ (by positivity : 0 < 2*Real.pi^2*Ξ±*(|R|+signalAverageRadius Ξ±)^2)] dsimp [signalBaseline] change 1 ≀ ((2*a)⁻¹ * ∫ t in -a..a, signalSinc Ξ± (R-t)) * (2*Real.pi^2*Ξ±*(|R|+a)^2) field_simp nlinarith lemma shifted_quadratic_bound {a R t : ℝ} (ha : 0 ≀ a) (ht : |t| ≀ a) : 1+R^2 ≀ 2*(1+a^2)*(1+(R-t)^2) := by have ht2 : t^2 ≀ a^2 := by simpa only [sq_abs] using (sq_le_sqβ‚€ (abs_nonneg _) ha).2 ht nlinarith [sq_nonneg (R-2*t),mul_nonneg (sq_nonneg a) (sq_nonneg (R-t))] lemma signalBaseline_upper {Ξ± : ℝ} (hΞ± : 0 < Ξ±) (R : ℝ) : signalBaseline Ξ± R ≀ (Ξ±+(Real.pi^2*Ξ±)⁻¹)* (2*(1+(signalAverageRadius Ξ±)^2))* (1+R^2)⁻¹ := by let a := signalAverageRadius Ξ± let C := Ξ±+(Real.pi^2*Ξ±)⁻¹ have ha : 0 < a := signalAverageRadius_pos hΞ± have hC : 0 < C := by dsimp [C]; positivity have hi : (∫ t in -a..a, signalSinc Ξ± (R-t)) ≀ (2*a) * (C * (2*(1+a^2))* (1+R^2)⁻¹) := by calc _ ≀ ∫ _t in -a..a, C * (2*(1+a^2))* (1+R^2)⁻¹ := by apply intervalIntegral.integral_mono_on (by linarith) (((smooth_signalSinc Ξ±).continuous.comp (by fun_prop)).intervalIntegrable _ _) intervalIntegrable_const intro t ht have hs := shifted_quadratic_bound (R := R) ha.le (abs_le.mpr ⟨ht.1,ht.2⟩) have hd : 0 < 1+(R-t)^2 := by positivity have hD : 0 < 1+R^2 := by positivity calc signalSinc Ξ± (R-t) ≀ C*(1+(R-t)^2)⁻¹ := signalSinc_decay hΞ± (R-t) _ ≀ C*(2*(1+a^2))*(1+R^2)⁻¹ := by rw [← div_eq_mul_inv,← div_eq_mul_inv] apply (div_le_div_iffβ‚€ hd hD).2 nlinarith _ = _ := by rw [intervalIntegral.integral_const]; simp only [smul_eq_mul]; ring dsimp [signalBaseline] change (2*a)⁻¹ * _ ≀ C*(2*(1+a^2))*(1+R^2)⁻¹ rw [inv_mul_le_iffβ‚€ (by positivity : 0 < 2*a)] exact hi lemma integrable_signalBaseline {Ξ± : ℝ} (hΞ± : 0 < Ξ±) : Integrable (signalBaseline Ξ±) := by apply (integrable_inv_one_add_sq.const_mul ((Ξ±+(Real.pi^2*Ξ±)⁻¹)*(2*(1+(signalAverageRadius Ξ±)^2)))).mono' (smooth_signalBaseline Ξ±).continuous.aestronglyMeasurable filter_upwards [] with R rw [Real.norm_eq_abs,abs_of_nonneg (signalBaseline_nonneg hΞ± R)] exact signalBaseline_upper hΞ± R /-! Exact Fourier support, without assuming an interval inversion formula. -/ def signalBox (Ξ± : ℝ) (x : ℝ) : β„‚ := (Icc (-Ξ±/2) (Ξ±/2)).indicator (fun _ => 1) x def signalTriangle (Ξ± v : ℝ) : β„‚ := ((max (Ξ±-|v|) 0 / Ξ± : ℝ) : β„‚) lemma integrable_signalBox (Ξ± : ℝ) : Integrable (signalBox Ξ±) := by exact (integrableOn_const (isCompact_Icc.measure_ne_top) : IntegrableOn (fun _ : ℝ => (1 : β„‚)) (Icc (-Ξ±/2) (Ξ±/2))).integrable_indicator measurableSet_Icc lemma fourier_const_mul (c : β„‚) (f : ℝ β†’ β„‚) (v : ℝ) : 𝓕 (fun x => c*f x) v = c*𝓕 f v := by simp only [Real.fourier_real_eq,Circle.smul_def,smul_eq_mul] rw [← integral_const_mul] congr 1 funext x ring lemma fourier_signalBox {Ξ± : ℝ} (hΞ± : 0 < Ξ±) (v : ℝ) : 𝓕 (signalBox Ξ±) v = (Ξ± * Real.sinc (Real.pi*Ξ±*v) : ℝ) := by rw [Real.fourier_real_eq_integral_exp_smul] simp only [smul_eq_mul] have heq : (fun x : ℝ => Complex.exp (↑(-2*Real.pi*x*v)*Complex.I)*signalBox Ξ± x) = (Icc (-Ξ±/2) (Ξ±/2)).indicator (fun x => Complex.exp (↑(-2*Real.pi*x*v)*Complex.I)) := by funext x by_cases hx : x ∈ Icc (-Ξ±/2) (Ξ±/2) <;> simp [signalBox,Set.indicator,hx] rw [heq,integral_indicator measurableSet_Icc,integral_Icc_eq_integral_Ioc, ← intervalIntegral.integral_of_le (by linarith : -Ξ±/2 ≀ Ξ±/2)] by_cases hv : v = 0 Β· simp [hv,intervalIntegral.integral_const] ring Β· let c : ℝ := -2*Real.pi*v have hc : c β‰  0 := by dsimp [c]; positivity have he : (fun x : ℝ => Complex.exp (↑(-2*Real.pi*x*v)*Complex.I)) = (fun x => Complex.exp (↑(c*x)*Complex.I)) := by funext x congr 1 dsimp [c] push_cast ring rw [he,intervalIntegral.integral_comp_mul_left (fun x => Complex.exp (↑x*Complex.I)) hc] rw [show c*(-Ξ±/2) = -(c*(Ξ±/2)) by ring,integral_exp_mul_I_eq_sinc] rw [show c*(Ξ±/2) = -(Real.pi*Ξ±*v) by dsimp [c]; ring,Real.sinc_neg] dsimp [c] simp only [Complex.ofReal_inv,Complex.ofReal_mul,Complex.ofReal_neg, Complex.ofReal_ofNat] have hvC : (v : β„‚) β‰  0 := Complex.ofReal_ne_zero.mpr hv field_simp [hvC] lemma signalBox_convolution {Ξ± : ℝ} (_hΞ± : 0 < Ξ±) (v : ℝ) : (signalBox Ξ± ⋆[ContinuousLinearMap.mul β„‚ β„‚] signalBox Ξ±) v = (max (Ξ±-|v|) 0 : ℝ) := by rw [convolution_def] change (∫ t : ℝ, signalBox Ξ± t * signalBox Ξ± (v-t)) = _ let l := max (-Ξ±/2) (v-Ξ±/2) let u := min (Ξ±/2) (v+Ξ±/2) have heq : (fun t => signalBox Ξ± t * signalBox Ξ± (v-t)) = (Icc l u).indicator (fun _ : ℝ => (1 : β„‚)) := by funext t have hm : t ∈ Icc l u ↔ t ∈ Icc (-Ξ±/2) (Ξ±/2) ∧ v-t ∈ Icc (-Ξ±/2) (Ξ±/2) := by dsimp [l,u] simp only [mem_Icc,max_le_iff,le_min_iff] constructor Β· rintro ⟨⟨h1,h2⟩,h3,h4⟩ exact ⟨⟨h1,h3⟩,by constructor <;> linarith⟩ Β· rintro ⟨⟨h1,h2⟩,h3,h4⟩ exact ⟨⟨h1,by linarith⟩,h2,by linarith⟩ by_cases h₁ : t ∈ Icc (-Ξ±/2) (Ξ±/2) <;> by_cases hβ‚‚ : v-t ∈ Icc (-Ξ±/2) (Ξ±/2) <;> simp [signalBox,Set.indicator,hm,h₁,hβ‚‚] rw [heq,integral_indicator measurableSet_Icc,setIntegral_const,Real.volume_real_Icc] simp only [Complex.real_smul,mul_one] congr 1 dsimp [l,u] by_cases hv : 0 ≀ v Β· rw [abs_of_nonneg hv,min_eq_left (by linarith),show max (-Ξ±/2) (v-Ξ±/2) = v-Ξ±/2 from max_eq_right (by linarith)] congr 1 ring Β· rw [abs_of_nonpos (le_of_not_ge hv),min_eq_right (by linarith),show max (-Ξ±/2) (v-Ξ±/2) = -Ξ±/2 from max_eq_left (by linarith)] congr 1 ring lemma signalTriangle_eq_convolution {Ξ± : ℝ} (hΞ± : 0 < Ξ±) : signalTriangle Ξ± = fun v => (Ξ± : β„‚)⁻¹ * (signalBox Ξ± ⋆[ContinuousLinearMap.mul β„‚ β„‚] signalBox Ξ±) v := by funext v rw [signalBox_convolution hΞ±] simp [signalTriangle,div_eq_mul_inv,mul_comm] lemma integrable_signalTriangle {Ξ± : ℝ} (hΞ± : 0 < Ξ±) : Integrable (signalTriangle Ξ±) := by rw [signalTriangle_eq_convolution hΞ±] exact ((integrable_signalBox Ξ±).integrable_convolution (ContinuousLinearMap.mul β„‚ β„‚) (integrable_signalBox Ξ±)).const_mul _ lemma continuous_signalTriangle (Ξ± : ℝ) : Continuous (signalTriangle Ξ±) := by fun_prop [signalTriangle] lemma fourier_signalTriangle {Ξ± : ℝ} (hΞ± : 0 < Ξ±) (R : ℝ) : 𝓕 (signalTriangle Ξ±) R = (signalSinc Ξ± R : ℝ) := by rw [signalTriangle_eq_convolution hΞ±,fourier_const_mul, Real.fourier_mul_convolution_eq (integrable_signalBox Ξ±) (integrable_signalBox Ξ±), fourier_signalBox hΞ±] dsimp [signalSinc] push_cast field_simp lemma fourierInv_signalSinc {Ξ± : ℝ} (hΞ± : 0 < Ξ±) : 𝓕⁻ (fun R => (signalSinc Ξ± R : β„‚)) = signalTriangle Ξ± := by have heq : 𝓕 (signalTriangle Ξ±) = (fun R => (signalSinc Ξ± R : β„‚)) := funext (fourier_signalTriangle hΞ±) rw [← heq] exact (continuous_signalTriangle Ξ±).fourierInv_fourier_eq (integrable_signalTriangle hΞ±) (by rw [heq]; exact (integrable_signalSinc hΞ±).ofReal) lemma fourier_signalSinc {Ξ± : ℝ} (hΞ± : 0 < Ξ±) (v : ℝ) : 𝓕 (fun R => (signalSinc Ξ± R : β„‚)) v = signalTriangle Ξ± v := by have h := congrFun (fourierInv_signalSinc hΞ±) (-v) rw [Real.fourierInv_eq_fourier_neg,neg_neg] at h simpa only [signalTriangle,abs_neg] using h lemma signalBaseline_eq_convolution {Ξ± : ℝ} (hΞ± : 0 < Ξ±) : (fun R => (signalBaseline Ξ± R : β„‚)) = fun R => ((2*signalAverageRadius Ξ± : ℝ) : β„‚)⁻¹ * (signalBox (2*signalAverageRadius Ξ±) ⋆[ContinuousLinearMap.mul β„‚ β„‚] (fun x => (signalSinc Ξ± x : β„‚))) R := by funext R have ha : 0 < signalAverageRadius Ξ± := signalAverageRadius_pos hΞ± rw [convolution_def] change ↑(signalBaseline Ξ± R) = _ * ∫ t, signalBox (2*signalAverageRadius Ξ±) t * ↑(signalSinc Ξ± (R-t)) have heq : (fun t => signalBox (2*signalAverageRadius Ξ±) t * (signalSinc Ξ± (R-t) : β„‚)) = (Icc (-signalAverageRadius Ξ±) (signalAverageRadius Ξ±)).indicator (fun t => (signalSinc Ξ± (R-t) : β„‚)) := by funext t have hl : -(2*signalAverageRadius Ξ±)/2 = -signalAverageRadius Ξ± := by ring have hu : 2*signalAverageRadius Ξ±/2 = signalAverageRadius Ξ± := by ring by_cases ht : t ∈ Icc (-signalAverageRadius Ξ±) (signalAverageRadius Ξ±) <;> simp [signalBox,hl,hu,Set.indicator,ht] rw [heq,integral_indicator measurableSet_Icc,integral_Icc_eq_integral_Ioc, ← intervalIntegral.integral_of_le (by linarith : -signalAverageRadius Ξ± ≀ signalAverageRadius Ξ±), intervalIntegral.integral_ofReal] simp only [signalBaseline,Complex.ofReal_mul,Complex.ofReal_inv] lemma fourier_signalBaseline {Ξ± : ℝ} (hΞ± : 0 < Ξ±) (v : ℝ) : 𝓕 (fun R => (signalBaseline Ξ± R : β„‚)) v = (Real.sinc (Real.pi*(2*signalAverageRadius Ξ±)*v) : β„‚)*signalTriangle Ξ± v := by rw [signalBaseline_eq_convolution hΞ±,fourier_const_mul] have hc := Real.fourier_mul_convolution_eq (integrable_signalBox (2*signalAverageRadius Ξ±)) (integrable_signalSinc hΞ±).ofReal v change 𝓕 (signalBox (2*signalAverageRadius Ξ±) ⋆[ContinuousLinearMap.mul β„‚ β„‚] (fun x => (signalSinc Ξ± x : β„‚))) v = _ at hc rw [hc,fourier_signalBox (mul_pos (by norm_num) (signalAverageRadius_pos hΞ±)) v] have hs := fourier_signalSinc hΞ± v change 𝓕 (fun x => (signalSinc Ξ± x : β„‚)) v = signalTriangle Ξ± v at hs erw [hs] have ha : (2*signalAverageRadius Ξ± : ℝ) β‰  0 := (mul_pos (by norm_num) (signalAverageRadius_pos hΞ±)).ne' have haC : ((2*signalAverageRadius Ξ± : ℝ) : β„‚) β‰  0 := Complex.ofReal_ne_zero.mpr ha have ha0 : (signalAverageRadius Ξ± : β„‚) β‰  0 := Complex.ofReal_ne_zero.mpr (signalAverageRadius_pos hΞ±).ne' push_cast field_simp [ha0] lemma integral_signalBaseline {Ξ± : ℝ} (hΞ± : 0 < Ξ±) : ∫ R, signalBaseline Ξ± R = 1 := by have h := fourier_signalBaseline hΞ± 0 simp [Real.fourier_real_eq,signalTriangle,max_eq_left hΞ±.le,hΞ±.ne'] at h apply Complex.ofReal_injective calc ((∫ R, signalBaseline Ξ± R : ℝ) : β„‚) = ∫ R, (signalBaseline Ξ± R : β„‚) := (integral_ofReal (π•œ := β„‚)).symm _ = (1 : β„‚) := h _ = ((1 : ℝ) : β„‚) := rfl lemma signalBaseline_fourier_support {Ξ± v : ℝ} (hΞ± : 0 < Ξ±) (hv : Ξ± ≀ |v|) : 𝓕 (fun R => (signalBaseline Ξ± R : β„‚)) v = 0 := by rw [fourier_signalBaseline hΞ±] simp [signalTriangle,max_eq_right (sub_nonpos.mpr hv)] lemma signalBaseline_pos {Ξ± : ℝ} (hΞ± : 0 < Ξ±) (R : ℝ) : 0 < signalBaseline Ξ± R := by have ha := signalAverageRadius_pos hΞ± exact lt_of_lt_of_le (by positivity) (signalBaseline_lower hΞ± R) theorem signalBaseline_quadratic_tails {Ξ± : ℝ} (hΞ± : 0 < Ξ±) : βˆƒ c C : ℝ, 0 < c ∧ 0 < C ∧ βˆ€ R : ℝ, c/(1+R^2) ≀ signalBaseline Ξ± R ∧ signalBaseline Ξ± R ≀ C/(1+R^2) := by let a := signalAverageRadius Ξ± have ha : 0 < a := signalAverageRadius_pos hΞ± let c := (4*Real.pi^2*Ξ±*(1+a^2))⁻¹ let C := (Ξ±+(Real.pi^2*Ξ±)⁻¹)*(2*(1+a^2)) refine ⟨c,C,by dsimp [c]; positivity,by dsimp [C]; positivity,fun R => ⟨?_,?_⟩⟩ Β· apply le_trans ?_ (signalBaseline_lower hΞ± R) change c/(1+R^2) ≀ 1/(2*Real.pi^2*Ξ±*(|R|+a)^2) have hD : 0 < 2*Real.pi^2*Ξ±*(|R|+a)^2 := by positivity have hbig : (|R|+a)^2 ≀ 2*(1+a^2)*(1+R^2) := by nlinarith [sq_nonneg (|R|-a),sq_abs R,mul_nonneg (sq_nonneg a) (sq_nonneg R)] have hp : 0 < 2*Real.pi^2*Ξ± := by positivity dsimp [c] rw [← one_div,div_div] apply one_div_le_one_div_of_le hD nlinarith [mul_le_mul_of_nonneg_left hbig hp.le] Β· exact (signalBaseline_upper hΞ± R).trans_eq (by dsimp [C,a]; rw [div_eq_mul_inv]) open scoped ComplexConjugate lemma fourier_hermitian_real (d : ℝ β†’ β„‚) (hd : βˆ€ v, d (-v) = conj (d v)) (R : ℝ) : conj (𝓕 d R) = 𝓕 d R := by rw [Real.fourier_real_eq_integral_exp_smul] simp only [smul_eq_mul] rw [← integral_conj] calc (∫ v : ℝ, conj (Complex.exp (↑(-2*Real.pi*v*R)*Complex.I)*d v)) = ∫ v : ℝ, Complex.exp (↑(-2*Real.pi*(-v)*R)*Complex.I)*d (-v) := by apply integral_congr_ae filter_upwards [] with v rw [map_mul,← Complex.exp_conj,hd] congr 2 simp only [map_mul,Complex.conj_ofReal,Complex.conj_I] push_cast ring _ = ∫ v : ℝ, Complex.exp (↑(-2*Real.pi*v*R)*Complex.I)*d v := integral_neg_eq_self (fun v : ℝ => Complex.exp (↑(-2*Real.pi*v*R)*Complex.I)*d v) volume def signalInverse (d : ℝ β†’ β„‚) (R : ℝ) : ℝ := (𝓕 d R).re lemma signalInverse_complex {d : ℝ β†’ β„‚} (hd : βˆ€ v, d (-v) = conj (d v)) (R : ℝ) : (signalInverse d R : β„‚) = 𝓕 d R := Complex.conj_eq_iff_re.mp (fourier_hermitian_real d hd R) lemma signalInverse_contDiff {d : ℝ β†’ β„‚} (hd : ContDiff ℝ ((⊀ : β„•βˆž) : WithTop β„•βˆž) d) (hc : HasCompactSupport d) : ContDiff ℝ ((⊀ : β„•βˆž) : WithTop β„•βˆž) (signalInverse d) := by let f := hc.toSchwartzMap hd exact Complex.reCLM.contDiff.comp ((𝓕 f).smooth ⊀) lemma signalInverse_integrable {d : ℝ β†’ β„‚} (hd : ContDiff ℝ ((⊀ : β„•βˆž) : WithTop β„•βˆž) d) (hc : HasCompactSupport d) : Integrable (signalInverse d) := by let f := hc.toSchwartzMap hd exact Complex.reCLM.integrable_comp (𝓕 f).integrable lemma signalInverse_inversion {d : ℝ β†’ β„‚} (hd : ContDiff ℝ ((⊀ : β„•βˆž) : WithTop β„•βˆž) d) (hc : HasCompactSupport d) (hreal : βˆ€ v, d (-v) = conj (d v)) : 𝓕⁻ (fun R => (signalInverse d R : β„‚)) = d := by have heq : (fun R => (signalInverse d R : β„‚)) = 𝓕 d := funext (signalInverse_complex hreal) rw [heq] let f := hc.toSchwartzMap hd exact hd.continuous.fourierInv_fourier_eq (f.integrable) (𝓕 f).integrable lemma integral_signalInverse {d : ℝ β†’ β„‚} (hd : ContDiff ℝ ((⊀ : β„•βˆž) : WithTop β„•βˆž) d) (hc : HasCompactSupport d) (hreal : βˆ€ v, d (-v) = conj (d v)) (h0 : d 0 = 0) : ∫ R, signalInverse d R = 0 := by have h := congrFun (signalInverse_inversion hd hc hreal) 0 simp [Real.fourierInv_eq,h0] at h apply Complex.ofReal_injective calc ((∫ R, signalInverse d R : ℝ) : β„‚) = ∫ R, (signalInverse d R : β„‚) := (integral_ofReal (π•œ := β„‚)).symm _ = 0 := h _ = ((0 : ℝ) : β„‚) := rfl lemma signalInverse_quadratic_bound {d : ℝ β†’ β„‚} (hd : ContDiff ℝ ((⊀ : β„•βˆž) : WithTop β„•βˆž) d) (hc : HasCompactSupport d) : βˆƒ G : ℝ, 0 ≀ G ∧ βˆ€ R, (1+R^2)*|signalInverse d R| ≀ G := by let f := hc.toSchwartzMap hd let g := 𝓕 f refine ⟨SchwartzMap.seminorm β„‚ 0 0 g + SchwartzMap.seminorm β„‚ 2 0 g,by positivity,?_⟩ intro R have h0 := g.norm_le_seminorm β„‚ R have h2 := g.norm_pow_mul_le_seminorm β„‚ 2 R have hr : |signalInverse d R| ≀ β€–g Rβ€– := Complex.abs_re_le_norm (g R) rw [Real.norm_eq_abs,sq_abs] at h2 nlinarith [sq_nonneg R,mul_le_mul_of_nonneg_left hr (sq_nonneg R)] lemma conj_stdAddChar {P : β„•} [NeZero P] (h : ZMod P) : conj (ZMod.stdAddChar h) = ZMod.stdAddChar (-h) := by rw [ZMod.stdAddChar_apply,ZMod.stdAddChar_apply,AddChar.map_neg_eq_inv, Circle.coe_inv_eq_conj] /-- The exact Ramanujan coefficient in the joint law of Section 3. -/ def signalRamanujanC (P : β„•) [NeZero P] (h : ZMod P) : β„‚ := βˆ‘ u : (ZMod P)Λ£, ZMod.stdAddChar (-(u.val*h)) def signalRamanujan (P : β„•) [NeZero P] (h : ZMod P) : ℝ := (signalRamanujanC P h).re lemma conj_signalRamanujanC {P : β„•} [NeZero P] (h : ZMod P) : conj (signalRamanujanC P h) = signalRamanujanC P h := by classical simp only [signalRamanujanC,map_sum,conj_stdAddChar,neg_neg] exact Fintype.sum_equiv (Equiv.neg ((ZMod P)Λ£)) _ _ (by intro u simp [Equiv.neg_apply,Units.val_neg,neg_mul]) lemma signalRamanujan_complex {P : β„•} [NeZero P] (h : ZMod P) : (signalRamanujan P h : β„‚) = signalRamanujanC P h := Complex.conj_eq_iff_re.mp (conj_signalRamanujanC h) lemma signalRamanujan_bound {P : β„•} [NeZero P] (h : ZMod P) : |signalRamanujan P h| ≀ Fintype.card (ZMod P)Λ£ := by apply (Complex.abs_re_le_norm (signalRamanujanC P h)).trans calc β€–signalRamanujanC P hβ€– ≀ βˆ‘ u : (ZMod P)Λ£, β€–ZMod.stdAddChar (-(u.val*h))β€– := norm_sum_le _ _ _ = Fintype.card (ZMod P)Λ£ := by simp [ZMod.stdAddChar_apply,Circle.norm_coe] lemma sum_stdAddChar_mul {P : β„•} [NeZero P] (k : ZMod P) : βˆ‘ h : ZMod P, ZMod.stdAddChar (k*h) = if k = 0 then (P : β„‚) else 0 := by classical split_ifs with hk Β· simp [hk] Β· exact AddChar.sum_eq_zero_of_ne_one (ZMod.isPrimitive_stdAddChar P hk) lemma signalRamanujan_selector {P : β„•} [NeZero P] (k : ZMod P) : βˆ‘ h : ZMod P, signalRamanujanC P h * ZMod.stdAddChar (k*h) = if IsUnit k then (P : β„‚) else 0 := by classical simp only [signalRamanujanC,Finset.sum_mul] rw [Finset.sum_comm] have heq (u : (ZMod P)Λ£) : βˆ‘ h : ZMod P, ZMod.stdAddChar (-(u.val*h))*ZMod.stdAddChar (k*h) = if u.val = k then (P : β„‚) else 0 := by simp_rw [← AddChar.map_add_eq_mul,show βˆ€ h : ZMod P, -(u.val*h)+k*h = (k-u.val)*h by intro; ring] rw [sum_stdAddChar_mul] simp [sub_eq_zero,eq_comm] simp_rw [heq] split_ifs with hk Β· rw [Finset.sum_eq_single hk.unit] Β· simp Β· intro u _ hne simp only [ite_eq_right_iff] intro hu exfalso exact hne (Units.ext (hu.trans hk.unit_spec.symm)) Β· simp Β· apply Finset.sum_eq_zero intro u _ rw [ite_eq_right] intro hu exact hk (hu β–Έ u.isUnit) /-- Joint law; its marginal over the residue coordinate has total mass one. -/ def signalJoint (Ξ± Ξ³ : ℝ) (d : ℝ β†’ β„‚) (P : β„•) [NeZero P] (h : ZMod P) (R : ℝ) : ℝ := (signalBaseline Ξ± R+Ξ³*signalRamanujan P h*signalInverse d R)/P lemma signalJoint_smooth {Ξ± : ℝ} (_hΞ± : 0 < Ξ±) (Ξ³ : ℝ) {d : ℝ β†’ β„‚} (hd : ContDiff ℝ ((⊀ : β„•βˆž) : WithTop β„•βˆž) d) (hc : HasCompactSupport d) (P : β„•) [NeZero P] (h : ZMod P) : ContDiff ℝ ((⊀ : β„•βˆž) : WithTop β„•βˆž) (signalJoint Ξ± Ξ³ d P h) := by exact ((smooth_signalBaseline Ξ±).add (contDiff_const.mul (signalInverse_contDiff hd hc))).div_const _ lemma signalJoint_integrable {Ξ± : ℝ} (hΞ± : 0 < Ξ±) (Ξ³ : ℝ) {d : ℝ β†’ β„‚} (hd : ContDiff ℝ ((⊀ : β„•βˆž) : WithTop β„•βˆž) d) (hc : HasCompactSupport d) (P : β„•) [NeZero P] (h : ZMod P) : Integrable (signalJoint Ξ± Ξ³ d P h) := ((integrable_signalBaseline hΞ±).add ((signalInverse_integrable hd hc).const_mul (Ξ³*signalRamanujan P h))).div_const _ lemma integral_signalJoint {Ξ± : ℝ} (hΞ± : 0 < Ξ±) (Ξ³ : ℝ) {d : ℝ β†’ β„‚} (hd : ContDiff ℝ ((⊀ : β„•βˆž) : WithTop β„•βˆž) d) (hc : HasCompactSupport d) (hr : βˆ€ v, d (-v) = conj (d v)) (h0 : d 0 = 0) (P : β„•) [NeZero P] (h : ZMod P) : ∫ R, signalJoint Ξ± Ξ³ d P h R = 1/P := by simp only [signalJoint] rw [integral_div,integral_add (integrable_signalBaseline hΞ±) ((signalInverse_integrable hd hc).const_mul _),integral_const_mul, integral_signalBaseline hΞ±,integral_signalInverse hd hc hr h0] ring lemma fourier_add_integrable {f g : ℝ β†’ β„‚} (hf : Integrable f) (hg : Integrable g) (v : ℝ) : 𝓕 (fun x => f x+g x) v = 𝓕 f v+𝓕 g v := by simp only [Real.fourier_eq,smul_add] rw [integral_add ((Real.fourierIntegral_convergent_iff v).2 hf) ((Real.fourierIntegral_convergent_iff v).2 hg)] lemma fourierInv_add_integrable {f g : ℝ β†’ β„‚} (hf : Integrable f) (hg : Integrable g) (v : ℝ) : 𝓕⁻ (fun x => f x+g x) v = 𝓕⁻ f v+𝓕⁻ g v := by simp only [Real.fourierInv_eq_fourier_neg,fourier_add_integrable hf hg] lemma fourierInv_const_mul (c : β„‚) (f : ℝ β†’ β„‚) (v : ℝ) : 𝓕⁻ (fun x => c*f x) v = c*𝓕⁻ f v := by simp only [Real.fourierInv_eq_fourier_neg,fourier_const_mul] lemma fourierInv_signalJoint {Ξ± : ℝ} (hΞ± : 0 < Ξ±) (Ξ³ : ℝ) {d : ℝ β†’ β„‚} (hd : ContDiff ℝ ((⊀ : β„•βˆž) : WithTop β„•βˆž) d) (hc : HasCompactSupport d) (hr : βˆ€ v, d (-v) = conj (d v)) (P : β„•) [NeZero P] (h : ZMod P) (v : ℝ) : 𝓕⁻ (fun R => (signalJoint Ξ± Ξ³ d P h R : β„‚)) v = (P : β„‚)⁻¹ * (𝓕⁻ (fun R => (signalBaseline Ξ± R : β„‚)) v+ (Ξ³ : β„‚)*signalRamanujanC P h*d v) := by have heq : (fun R => (signalJoint Ξ± Ξ³ d P h R : β„‚)) = fun R => (P : β„‚)⁻¹*((signalBaseline Ξ± R : β„‚)+ ((Ξ³ : β„‚)*signalRamanujanC P h)*(signalInverse d R : β„‚)) := by funext R simp only [signalJoint,div_eq_mul_inv,Complex.ofReal_mul,Complex.ofReal_add, Complex.ofReal_inv,Complex.ofReal_natCast,signalRamanujan_complex] ring rw [heq,fourierInv_const_mul] erw [fourierInv_add_integrable (integrable_signalBaseline hΞ±).ofReal (((signalInverse_integrable hd hc).ofReal).const_mul _), fourierInv_const_mul,signalInverse_inversion hd hc hr] rfl /-- Exact positive-exponent joint Fourier transform, not a conditional moment assumption. -/ theorem signalJoint_fourier {Ξ± : ℝ} (hΞ± : 0 < Ξ±) (Ξ³ : ℝ) {d : ℝ β†’ β„‚} (hd : ContDiff ℝ ((⊀ : β„•βˆž) : WithTop β„•βˆž) d) (hc : HasCompactSupport d) (hr : βˆ€ v, d (-v) = conj (d v)) (P : β„•) [NeZero P] (v : ℝ) (k : ZMod P) : βˆ‘ h : ZMod P, (𝓕⁻ (fun R => (signalJoint Ξ± Ξ³ d P h R : β„‚)) v)* ZMod.stdAddChar (k*h) = (if k = 0 then 𝓕⁻ (fun R => (signalBaseline Ξ± R : β„‚)) v else 0)+ (if IsUnit k then (Ξ³ : β„‚)*d v else 0) := by classical simp_rw [fourierInv_signalJoint hΞ± Ξ³ hd hc hr] calc _ = (P : β„‚)⁻¹ * ((𝓕⁻ (fun R => (signalBaseline Ξ± R : β„‚)) v)* (βˆ‘ h : ZMod P, ZMod.stdAddChar (k*h))+ (Ξ³ : β„‚)*d v*(βˆ‘ h : ZMod P, signalRamanujanC P h*ZMod.stdAddChar (k*h))) := by simp only [mul_add,add_mul,Finset.mul_sum,Finset.sum_add_distrib] congr 1 all_goals apply Finset.sum_congr rfl; intro h _; ring _ = _ := by rw [sum_stdAddChar_mul,signalRamanujan_selector] have hP : (P : β„‚) β‰  0 := by exact_mod_cast NeZero.ne P split_ifs <;> field_simp [hP] <;> ring /-- Small strengths give the actual positive law, with the source's quantitative two-sided domination. The choice is independent of the angular scale B. -/ theorem signalJoint_positive_strength {Ξ± : ℝ} (hΞ± : 0 < Ξ±) {d : ℝ β†’ β„‚} (hd : ContDiff ℝ ((⊀ : β„•βˆž) : WithTop β„•βˆž) d) (hc : HasCompactSupport d) (P : β„•) [NeZero P] : βˆƒ Ξ³β‚€ : ℝ, 0 < Ξ³β‚€ ∧ βˆ€ Ξ³ : ℝ, 0 ≀ Ξ³ β†’ Ξ³ ≀ Ξ³β‚€ β†’ (βˆ€ h : ZMod P, βˆ€ R : ℝ, signalBaseline Ξ± R/(2*P) ≀ signalJoint Ξ± Ξ³ d P h R ∧ signalJoint Ξ± Ξ³ d P h R ≀ 3*signalBaseline Ξ± R/(2*P)) ∧ βˆ€ v : ℝ, 2*Ξ³*β€–d vβ€– ≀ 1/2 := by obtain ⟨c,C,hc0,_hC,htail⟩ := signalBaseline_quadratic_tails hΞ± obtain ⟨G,hG,hgb⟩ := signalInverse_quadratic_bound hd hc let Cu : ℝ := Fintype.card (ZMod P)Λ£ have hCu : 0 ≀ Cu := by dsimp [Cu]; positivity let f := hc.toSchwartzMap hd let D := SchwartzMap.seminorm β„‚ 0 0 f have hD : 0 ≀ D := apply_nonneg (SchwartzMap.seminorm β„‚ 0 0) f have hdD (v : ℝ) : β€–d vβ€– ≀ D := f.norm_le_seminorm β„‚ v let Ξ³β‚€ := min (c/(2*(Cu*G+1))) (1/(4*(D+1))) have hCG : 0 < Cu*G+1 := by positivity refine βŸ¨Ξ³β‚€,by dsimp [Ξ³β‚€]; positivity,fun Ξ³ hΞ³ hΞ³β‚€ => ⟨?_,?_⟩⟩ Β· intro h R have hsmall : Ξ³*(Cu*G+1) ≀ c/2 := by have hh := hΞ³β‚€.trans (min_le_left (c/(2*(Cu*G+1))) (1/(4*(D+1)))) have hh' := (le_div_iffβ‚€ (by positivity : 0 < 2*(Cu*G+1))).mp hh nlinarith have hgb' := hgb R have hcb := signalRamanujan_bound h have hb : |Ξ³*signalRamanujan P h*signalInverse d R| ≀ signalBaseline Ξ± R/2 := by have hprod : (1+R^2)*|Ξ³*signalRamanujan P h*signalInverse d R| ≀ Ξ³*Cu*G := by rw [abs_mul,abs_mul,abs_of_nonneg hΞ³] calc _ = Ξ³*|signalRamanujan P h| *((1+R^2)*|signalInverse d R| ) := by ring _ ≀ Ξ³*Cu*G := by gcongr have ht := (htail R).1 have hpos : 0 < 1+R^2 := by positivity have ht' := (div_le_iffβ‚€ hpos).mp ht nlinarith have hP : (0 : ℝ) < P := by exact_mod_cast Nat.pos_of_ne_zero (NeZero.ne P) obtain ⟨hl,hu⟩ := abs_le.mp hb dsimp [signalJoint] constructor Β· rw [div_le_div_iffβ‚€ (by positivity : 0 < 2*(P : ℝ)) hP] nlinarith Β· rw [div_le_div_iffβ‚€ hP (by positivity : 0 < 2*(P : ℝ))] nlinarith Β· intro v have hh := hΞ³β‚€.trans (min_le_right (c/(2*(Cu*G+1))) (1/(4*(D+1)))) have hh' := (le_div_iffβ‚€ (by positivity : 0 < 4*(D+1))).mp hh have hbd := mul_le_mul_of_nonneg_left (hdD v) hΞ³ nlinarith /-- The manuscript's finite sieve modulus, unchanged (not a factorial proxy). -/ def signalPrimeProduct (L : β„•) : β„• := ∏ p ∈ (Finset.range (L+1)).filter Nat.Prime, p lemma signalPrimeProduct_pos (L : β„•) : 0 < signalPrimeProduct L := by apply Finset.prod_pos intro p hp exact (Finset.mem_filter.mp hp).2.pos instance (L : β„•) : NeZero (signalPrimeProduct L) := ⟨(signalPrimeProduct_pos L).ne'⟩ lemma dvd_signalPrimeProduct {p L : β„•} (hp : p.Prime) (hL : p ≀ L) : p ∣ signalPrimeProduct L := by exact Finset.dvd_prod_of_mem (fun p : β„• => p) (Finset.mem_filter.mpr ⟨Finset.mem_range.mpr (by omega),hp⟩) lemma signalPrimeProduct_ge_two {L : β„•} (hL : 2 ≀ L) : 2 ≀ signalPrimeProduct L := Nat.le_of_dvd (signalPrimeProduct_pos L) (dvd_signalPrimeProduct Nat.prime_two hL) lemma signal_sieve_no_unit {L β„“ : β„•} (hβ„“ : 2 ≀ β„“) (hL : β„“ ≀ L) (m : ZMod (signalPrimeProduct L)) : Β¬ IsUnit ((β„“ : ZMod (signalPrimeProduct L))*m) := by intro h have hu := (ZMod.isUnit_iff_coprime β„“ (signalPrimeProduct L)).mp (isUnit_of_mul_isUnit_left h) have hp := Nat.minFac_prime (n := β„“) (by omega) exact (Nat.not_coprime_of_dvd_of_dvd hp.one_lt (Nat.minFac_dvd β„“) (dvd_signalPrimeProduct hp ((Nat.minFac_le (by omega)).trans hL))) hu /-- The exact ideal integer moments, with only the first nonzero harmonic. -/ theorem signalJoint_sieved_moments {Ξ± b D x : ℝ} (hΞ± : 0 < Ξ±) (hΞ±b : Ξ± < b) (hb : 0 < b) (hx : b ≀ |x|) {L : β„•} (hL : D/b < L) {d : ℝ β†’ β„‚} (hd : ContDiff ℝ ((⊀ : β„•βˆž) : WithTop β„•βˆž) d) (hc : HasCompactSupport d) (hr : βˆ€ v, d (-v) = conj (d v)) (hs : Function.support d βŠ† Icc (-D) D) (Ξ³ : ℝ) (m : ZMod (signalPrimeProduct L)) (β„“ : β„•) (hβ„“ : 1 ≀ β„“) : βˆ‘ h : ZMod (signalPrimeProduct L), (𝓕⁻ (fun R => (signalJoint Ξ± Ξ³ d (signalPrimeProduct L) h R : β„‚))) (β„“*x)* ZMod.stdAddChar (((β„“ : ZMod (signalPrimeProduct L))*m)*h) = if β„“ = 1 ∧ IsUnit m then (Ξ³ : β„‚)*d x else 0 := by rw [signalJoint_fourier hΞ± Ξ³ hd hc hr] have hβ„“r : (1 : ℝ) ≀ β„“ := by exact_mod_cast hβ„“ have hav : Ξ± ≀ |(β„“ : ℝ)*x| := by rw [abs_mul,abs_of_nonneg (Nat.cast_nonneg β„“)] nlinarith [abs_nonneg x] have hbase : 𝓕⁻ (fun R => (signalBaseline Ξ± R : β„‚)) ((β„“ : ℝ)*x) = 0 := by rw [Real.fourierInv_eq_fourier_neg] exact signalBaseline_fourier_support hΞ± (by simpa only [abs_neg] using hav) rw [hbase] simp only [ite_self,zero_add] by_cases he : β„“ = 1 Β· subst β„“ simp Β· rw [ite_eq_right (show Β¬ (β„“ = 1 ∧ IsUnit m) from fun h => he h.1)] by_cases hd0 : d ((β„“ : ℝ)*x) = 0 Β· simp [hd0] Β· have hv := hs hd0 have ha : |(β„“ : ℝ)*x| ≀ D := abs_le.mpr hv rw [abs_mul,abs_of_nonneg (Nat.cast_nonneg β„“)] at ha have hbound : (β„“ : ℝ) < L := by have hcL := (div_lt_iffβ‚€ hb).mp hL nlinarith have hβ„“L : β„“ ≀ L := (by exact_mod_cast hbound : β„“ < L).le rw [ite_eq_right (signal_sieve_no_unit (by omega) hβ„“L m)] /-- All choices of the positive-law construction precede the angular scale. The interval support used below is the exact compact support condition on d. -/ theorem exists_signal_positive_law {b D : ℝ} (hb : 0 < b) {d : ℝ β†’ β„‚} (hd : ContDiff ℝ ((⊀ : β„•βˆž) : WithTop β„•βˆž) d) (hc : HasCompactSupport d) (hr : βˆ€ v, d (-v) = conj (d v)) (h0 : d 0 = 0) (hs : Function.support d βŠ† Icc (-D) D) : βˆƒ Ξ± : ℝ, βˆƒ L : β„•, βˆƒ Ξ³β‚€ : ℝ, 0 < Ξ± ∧ Ξ± < b/2 ∧ 2 ≀ L ∧ D/b < L ∧ 0 < Ξ³β‚€ ∧ βˆ€ Ξ³ : ℝ, 0 < Ξ³ β†’ Ξ³ ≀ Ξ³β‚€ β†’ (βˆ€ h : ZMod (signalPrimeProduct L), ContDiff ℝ ((⊀ : β„•βˆž) : WithTop β„•βˆž) (signalJoint Ξ± Ξ³ d (signalPrimeProduct L) h) ∧ Integrable (signalJoint Ξ± Ξ³ d (signalPrimeProduct L) h) ∧ (∫ R, signalJoint Ξ± Ξ³ d (signalPrimeProduct L) h R) = 1/(signalPrimeProduct L) ∧ βˆ€ R, signalBaseline Ξ± R/(2*(signalPrimeProduct L)) ≀ signalJoint Ξ± Ξ³ d (signalPrimeProduct L) h R ∧ signalJoint Ξ± Ξ³ d (signalPrimeProduct L) h R ≀ 3*signalBaseline Ξ± R/(2*(signalPrimeProduct L))) ∧ (βˆ€ v, 2*Ξ³*β€–d vβ€– ≀ 1/2) ∧ βˆ€ x, b ≀ |x| β†’ βˆ€ m : ZMod (signalPrimeProduct L), βˆ€ β„“ : β„•, 1 ≀ β„“ β†’ βˆ‘ h : ZMod (signalPrimeProduct L), (𝓕⁻ (fun R => (signalJoint Ξ± Ξ³ d (signalPrimeProduct L) h R : β„‚))) (β„“*x)* ZMod.stdAddChar (((β„“ : ZMod (signalPrimeProduct L))*m)*h) = if β„“ = 1 ∧ IsUnit m then (Ξ³ : β„‚)*d x else 0 := by obtain ⟨L,hL⟩ := exists_nat_gt (max 2 (D/b)) have hL2 : 2 ≀ L := by have hh : (2 : ℝ) < L := (le_max_left _ _).trans_lt hL exact_mod_cast hh.le have hLD : D/b < L := (le_max_right _ _).trans_lt hL have hΞ± : 0 < b/4 := by positivity obtain βŸ¨Ξ³β‚€,hΞ³β‚€,hγ⟩ := signalJoint_positive_strength hΞ± hd hc (signalPrimeProduct L) refine ⟨b/4,L,Ξ³β‚€,hΞ±,by linarith,hL2,hLD,hΞ³β‚€,?_⟩ intro Ξ³ hΞ³pos hΞ³le obtain ⟨hbound,hdBound⟩ := hΞ³ Ξ³ hΞ³pos.le hΞ³le refine ⟨?_,hdBound,?_⟩ Β· intro h exact ⟨signalJoint_smooth hΞ± Ξ³ hd hc _ h,signalJoint_integrable hΞ± Ξ³ hd hc _ h, integral_signalJoint hΞ± Ξ³ hd hc hr h0 _ h,hbound h⟩ Β· intro x hx m β„“ hβ„“ exact signalJoint_sieved_moments hΞ± (by linarith) hb hx hLD hd hc hr hs Ξ³ m β„“ hβ„“ end ThreeTorus noncomputable section open MeasureTheory Set Filter open scoped Topology FourierTransform namespace ThreeTorus def affineDensity (q : ℝ β†’ ℝ) (a b y : ℝ) : ℝ := a*q (a*y+b) lemma integrable_affineDensity {q : ℝ β†’ ℝ} (hq : Integrable q) {a : ℝ} (ha : a β‰  0) (b : ℝ) : Integrable (affineDensity q a b) := by exact ((integrable_comp_mul_left_iff (fun x => q (x+b)) ha).2 (hq.comp_add_right b)).const_mul a lemma integral_affineDensity {q : ℝ β†’ ℝ} {a : ℝ} (ha : 0 < a) (b : ℝ) : (∫ y, affineDensity q a b y) = ∫ y, q y := by unfold affineDensity rw [integral_const_mul,Measure.integral_comp_mul_left (fun y => q (y+b)) a, integral_add_right_eq_self] simp only [smul_eq_mul,abs_of_pos (inv_pos.mpr ha)] field_simp lemma fourierInv_affineDensity {q : ℝ β†’ ℝ} {a : ℝ} (ha : 0 < a) (b v : ℝ) : 𝓕⁻ (fun y => (affineDensity q a b y : β„‚)) v = Complex.exp ((-2*Real.pi*(v*b/a) : ℝ)*Complex.I)* 𝓕⁻ (fun y => (q y : β„‚)) (v/a) := by simp only [Real.fourierInv_eq_fourier_neg,Real.fourier_real_eq_integral_exp_smul, smul_eq_mul] let f : ℝ β†’ β„‚ := fun x => Complex.exp (((2*Real.pi*v/a)*x : ℝ)*Complex.I)*(q x : β„‚) have hf : βˆ€ y : ℝ, Complex.exp (((-2*Real.pi*y*(-v)) : ℝ)*Complex.I)* (affineDensity q a b y : β„‚) = (a : β„‚)*(Complex.exp ((-2*Real.pi*(v*b/a) : ℝ)*Complex.I)*f (a*y+b)) := by intro y have hex : (-2*Real.pi*y*(-v)) = -2*Real.pi*(v*b/a)+(2*Real.pi*v/a)*(a*y+b) := by field_simp [ha.ne'] ring dsimp only [affineDensity,f] rw [hex,Complex.ofReal_add,add_mul,Complex.exp_add] simp only [Complex.ofReal_mul] ring simp_rw [hf] rw [integral_const_mul,integral_const_mul,Measure.integral_comp_mul_left (fun y => f (y+b)) a, integral_add_right_eq_self] simp only [abs_of_pos (inv_pos.mpr ha),Complex.real_smul,Complex.ofReal_inv] have hg : (fun y : ℝ => Complex.exp (((-2*Real.pi*y*(-(v/a))) : ℝ)*Complex.I)* (q y : β„‚)) = f := by funext y dsimp [f] congr 2 ring_nf rw [hg] field_simp [show (a : β„‚) β‰  0 from Complex.ofReal_ne_zero.mpr ha.ne'] lemma affine_square_bound (a b y : ℝ) : 1+(a*y+b)^2 ≀ (1+2*a^2+2*b^2)*(1+y^2) := by nlinarith [sq_nonneg (a*y-b),sq_nonneg a,sq_nonneg y, mul_nonneg (sq_nonneg b) (sq_nonneg y)] lemma affineDensity_quadratic_tails {q : ℝ β†’ ℝ} {a c C : ℝ} (ha : 0 < a) (hc : 0 < c) (hC : 0 < C) (hq : βˆ€ y, c/(1+y^2) ≀ q y ∧ q y ≀ C/(1+y^2)) (b : ℝ) : βˆƒ c' C' : ℝ, 0 < c' ∧ 0 < C' ∧ βˆ€ y, c'/(1+y^2) ≀ affineDensity q a b y ∧ affineDensity q a b y ≀ C'/(1+y^2) := by let K := 1+2*a^2+2*b^2 let K' := 1+2*(a⁻¹)^2+2*(-b/a)^2 have hK : 0 < K := by dsimp [K]; positivity have hK' : 0 < K' := by dsimp [K']; positivity refine ⟨a*c/K,a*C*K',by positivity,by positivity,fun y => ⟨?_,?_⟩⟩ Β· have hbnd := affine_square_bound a b y have hp : 0 < 1+y^2 := by positivity have hp' : 0 < 1+(a*y+b)^2 := by positivity have he : a*c/K/(1+y^2) ≀ a*(c/(1+(a*y+b)^2)) := by rw [div_div,← mul_div_assoc] exact div_le_div_of_nonneg_left (by positivity) hp' (by simpa [K] using hbnd) exact he.trans (mul_le_mul_of_nonneg_left (hq _).1 ha.le) Β· have hbnd := affine_square_bound a⁻¹ (-b/a) (a*y+b) have he : a⁻¹*(a*y+b)+ -b/a = y := by field_simp [ha.ne']; ring rw [he] at hbnd have hp : 0 < 1+y^2 := by positivity have hp' : 0 < 1+(a*y+b)^2 := by positivity apply (mul_le_mul_of_nonneg_left (hq _).2 ha.le).trans rw [← mul_div_assoc,div_le_div_iffβ‚€ hp' hp] have hh := mul_le_mul_of_nonneg_left hbnd (show 0 ≀ a*C by positivity) dsimp [K'] at * nlinarith end ThreeTorus noncomputable section open MeasureTheory Set Filter open scoped Topology FourierTransform namespace ThreeTorus lemma finite_sum_quadratic_tails {ΞΉ : Type*} [Fintype ΞΉ] [Nonempty ΞΉ] {q : ΞΉ β†’ ℝ β†’ ℝ} (hq : βˆ€ i, βˆƒ c C : ℝ, 0 < c ∧ 0 < C ∧ βˆ€ y, c/(1+y^2) ≀ q i y ∧ q i y ≀ C/(1+y^2)) : βˆƒ c C : ℝ, 0 < c ∧ 0 < C ∧ βˆ€ y, c/(1+y^2) ≀ βˆ‘ i, q i y ∧ βˆ‘ i, q i y ≀ C/(1+y^2) := by classical choose c C hc hC hbound using hq refine βŸ¨βˆ‘ i, c i,βˆ‘ i, C i, Finset.sum_pos (fun i _ => hc i) Finset.univ_nonempty, Finset.sum_pos (fun i _ => hC i) Finset.univ_nonempty,?_⟩ intro y constructor Β· rw [Finset.sum_div] exact Finset.sum_le_sum fun i _ => (hbound i y).1 Β· rw [Finset.sum_div] exact Finset.sum_le_sum fun i _ => (hbound i y).2 /-- Density of J_*=(R/B+h/P)/c; the finite representatives are h.val. -/ def signalJitter (Ξ± Ξ³ : ℝ) (d : ℝ β†’ β„‚) (P : β„•) [NeZero P] (B c y : ℝ) : ℝ := c*B*βˆ‘ h : ZMod P, signalJoint Ξ± Ξ³ d P h (B*(c*y-h.val/P)) lemma signalJitter_affine (Ξ± Ξ³ : ℝ) (d : ℝ β†’ β„‚) (P : β„•) [NeZero P] (B c y : ℝ) : signalJitter Ξ± Ξ³ d P B c y = βˆ‘ h : ZMod P, affineDensity (signalJoint Ξ± Ξ³ d P h) (c*B) (-B*h.val/P) y := by classical simp only [signalJitter,Finset.mul_sum,affineDensity] apply Finset.sum_congr rfl intro h _ congr 2 ring lemma signalJitter_smooth {Ξ± : ℝ} (hΞ± : 0 < Ξ±) (Ξ³ : ℝ) {d : ℝ β†’ β„‚} (hd : ContDiff ℝ ((⊀ : β„•βˆž) : WithTop β„•βˆž) d) (hc : HasCompactSupport d) (P : β„•) [NeZero P] (B c : ℝ) : ContDiff ℝ ((⊀ : β„•βˆž) : WithTop β„•βˆž) (signalJitter Ξ± Ξ³ d P B c) := by classical apply contDiff_const.mul apply ContDiff.sum intro h _ exact (signalJoint_smooth hΞ± Ξ³ hd hc P h).comp (by fun_prop) lemma signalJitter_integrable {Ξ± B c : ℝ} (hΞ± : 0 < Ξ±) (hB : 0 < B) (hc : 0 < c) (Ξ³ : ℝ) {d : ℝ β†’ β„‚} (hd : ContDiff ℝ ((⊀ : β„•βˆž) : WithTop β„•βˆž) d) (hcomp : HasCompactSupport d) (P : β„•) [NeZero P] : Integrable (signalJitter Ξ± Ξ³ d P B c) := by simp only [show signalJitter Ξ± Ξ³ d P B c = fun y => βˆ‘ h : ZMod P, affineDensity (signalJoint Ξ± Ξ³ d P h) (c*B) (-B*h.val/P) y from funext (signalJitter_affine Ξ± Ξ³ d P B c)] exact integrable_finsetSum _ (fun h _ => integrable_affineDensity (signalJoint_integrable hΞ± Ξ³ hd hcomp P h) (mul_pos hc hB).ne' _) lemma integral_signalJitter {Ξ± B c : ℝ} (hΞ± : 0 < Ξ±) (hB : 0 < B) (hc : 0 < c) (Ξ³ : ℝ) {d : ℝ β†’ β„‚} (hd : ContDiff ℝ ((⊀ : β„•βˆž) : WithTop β„•βˆž) d) (hcomp : HasCompactSupport d) (hr : βˆ€ v, d (-v) = starRingEnd β„‚ (d v)) (h0 : d 0 = 0) (P : β„•) [NeZero P] : (∫ y, signalJitter Ξ± Ξ³ d P B c y) = 1 := by simp_rw [signalJitter_affine] rw [integral_finsetSum _ (fun h _ => integrable_affineDensity (signalJoint_integrable hΞ± Ξ³ hd hcomp P h) (mul_pos hc hB).ne' _)] simp_rw [integral_affineDensity (mul_pos hc hB),integral_signalJoint hΞ± Ξ³ hd hcomp hr h0] simp [ZMod.card P,NeZero.ne P] lemma signalJitter_quadratic_tails {Ξ± B c Ξ³ : ℝ} (hΞ± : 0 < Ξ±) (hB : 0 < B) (hc : 0 < c) {d : ℝ β†’ β„‚} (P : β„•) [NeZero P] (hbound : βˆ€ h R, signalBaseline Ξ± R/(2*P) ≀ signalJoint Ξ± Ξ³ d P h R ∧ signalJoint Ξ± Ξ³ d P h R ≀ 3*signalBaseline Ξ± R/(2*P)) : βˆƒ a A : ℝ, 0 < a ∧ 0 < A ∧ βˆ€ y, a/(1+y^2) ≀ signalJitter Ξ± Ξ³ d P B c y ∧ signalJitter Ξ± Ξ³ d P B c y ≀ A/(1+y^2) := by obtain ⟨a,A,ha,hA,hq⟩ := signalBaseline_quadratic_tails hΞ± have hP : (0 : ℝ) < P := Nat.cast_pos.mpr (NeZero.pos P) have ht (h : ZMod P) : βˆ€ y, (a/(2*P))/(1+y^2) ≀ signalJoint Ξ± Ξ³ d P h y ∧ signalJoint Ξ± Ξ³ d P h y ≀ (3*A/(2*P))/(1+y^2) := by intro y constructor Β· have hh := div_le_div_of_nonneg_right (hq y).1 (show 0 ≀ 2*(P:ℝ) by positivity) have hh' : a/(2*P)/(1+y^2) ≀ signalBaseline Ξ± y/(2*P) := by convert hh using 1; first | rfl | ring exact hh'.trans (hbound h y).1 Β· have hh := div_le_div_of_nonneg_right (mul_le_mul_of_nonneg_left (hq y).2 (show 0 ≀ (3:ℝ) by norm_num)) (show 0 ≀ 2*(P:ℝ) by positivity) exact (hbound h y).2.trans (by convert hh using 1; ring) obtain ⟨a',A',ha',hA',hbnd⟩ := finite_sum_quadratic_tails (fun h : ZMod P => affineDensity_quadratic_tails (mul_pos hc hB) (show 0 < a/(2*P) by positivity) (show 0 < 3*A/(2*P) by positivity) (ht h) (-B*h.val/P)) exact ⟨a',A',ha',hA',fun y => by simpa only [signalJitter_affine] using hbnd y⟩ lemma signalJitter_pos {Ξ± B c Ξ³ : ℝ} (hΞ± : 0 < Ξ±) (hB : 0 < B) (hc : 0 < c) {d : ℝ β†’ β„‚} (P : β„•) [NeZero P] (hbound : βˆ€ h R, signalBaseline Ξ± R/(2*P) ≀ signalJoint Ξ± Ξ³ d P h R ∧ signalJoint Ξ± Ξ³ d P h R ≀ 3*signalBaseline Ξ± R/(2*P)) (y : ℝ) : 0 < signalJitter Ξ± Ξ³ d P B c y := by obtain ⟨a,A,ha,_hA,hbnd⟩ := signalJitter_quadratic_tails hΞ± hB hc P hbound exact lt_of_lt_of_le (by positivity : 0 < a/(1+y^2)) (hbnd y).1 lemma fourierInv_finsetSum {ΞΉ : Type*} (S : Finset ΞΉ) {f : ΞΉ β†’ ℝ β†’ β„‚} (hf : βˆ€ i ∈ S, Integrable (f i)) (v : ℝ) : 𝓕⁻ (fun y => βˆ‘ i ∈ S, f i y) v = βˆ‘ i ∈ S, 𝓕⁻ (f i) v := by simp only [Real.fourierInv_eq_fourier_neg,Real.fourier_eq,Finset.smul_sum] exact integral_finsetSum S (fun i hi => (Real.fourierIntegral_convergent_iff (-v)).2 (hf i hi)) lemma signalJitter_fourierInv {Ξ± B c : ℝ} (hΞ± : 0 < Ξ±) (hB : 0 < B) (hc : 0 < c) (Ξ³ : ℝ) {d : ℝ β†’ β„‚} (hd : ContDiff ℝ ((⊀ : β„•βˆž) : WithTop β„•βˆž) d) (hcomp : HasCompactSupport d) (P : β„•) [NeZero P] (v : ℝ) : 𝓕⁻ (fun y => (signalJitter Ξ± Ξ³ d P B c y : β„‚)) v = βˆ‘ h : ZMod P, Complex.exp ((2*Real.pi*(v*h.val/(c*P)) : ℝ)*Complex.I)* 𝓕⁻ (fun y => (signalJoint Ξ± Ξ³ d P h y : β„‚)) (v/(c*B)) := by classical have he : (fun y => (signalJitter Ξ± Ξ³ d P B c y : β„‚)) = fun y => βˆ‘ h : ZMod P, (affineDensity (signalJoint Ξ± Ξ³ d P h) (c*B) (-B*h.val/P) y : β„‚) := by funext y rw [signalJitter_affine] push_cast rfl rw [he] erw [fourierInv_finsetSum _ (fun h _ => (integrable_affineDensity (signalJoint_integrable hΞ± Ξ³ hd hcomp P h) (mul_pos hc hB).ne' _).ofReal)] apply Finset.sum_congr rfl intro h _ erw [fourierInv_affineDensity (mul_pos hc hB)] congr 3 field_simp [hB.ne',hc.ne',show (P : ℝ) β‰  0 from Nat.cast_ne_zero.mpr (NeZero.ne P)] lemma signal_character (P : β„•) [NeZero P] (n : β„€) (h : ZMod P) : ZMod.stdAddChar ((n : ZMod P)*h) = Complex.exp ((2*Real.pi*((n:ℝ)*h.val/P) : ℝ)*Complex.I) := by have he := ZMod.stdAddChar_coe (N := P) (n*(h.val:β„€)) simp only [Int.cast_mul,Int.cast_natCast,ZMod.natCast_zmod_val] at he rw [he] push_cast congr 1 ring lemma signalJitter_integer_moments {Ξ± B c : ℝ} (hΞ± : 0 < Ξ±) (hB : 0 < B) (hc : 0 < c) (Ξ³ : ℝ) {d : ℝ β†’ β„‚} (hd : ContDiff ℝ ((⊀ : β„•βˆž) : WithTop β„•βˆž) d) (hcomp : HasCompactSupport d) (P : β„•) [NeZero P] (n : β„€) : 𝓕⁻ (fun y => (signalJitter Ξ± Ξ³ d P B c y : β„‚)) ((n:ℝ)*c) = βˆ‘ h : ZMod P, (𝓕⁻ (fun y => (signalJoint Ξ± Ξ³ d P h y : β„‚))) ((n:ℝ)/B)* ZMod.stdAddChar ((n : ZMod P)*h) := by rw [signalJitter_fourierInv hΞ± hB hc Ξ³ hd hcomp] have he : (n:ℝ)*c/(c*B) = (n:ℝ)/B := by field_simp rw [he] apply Finset.sum_congr rfl intro h _ rw [signal_character,mul_comm] congr 3 field_simp lemma signalJitter_sieved_moments {Ξ± B c b D : ℝ} (hΞ± : 0 < Ξ±) (hΞ±b : Ξ± < b) (hB : 0 < B) (hc : 0 < c) (hb : 0 < b) {L : β„•} (hL : D/b < L) (Ξ³ : ℝ) {d : ℝ β†’ β„‚} (hd : ContDiff ℝ ((⊀ : β„•βˆž) : WithTop β„•βˆž) d) (hcomp : HasCompactSupport d) (hr : βˆ€ v, d (-v) = starRingEnd β„‚ (d v)) (hs : Function.support d βŠ† Icc (-D) D) (m : β„€) (hm : b ≀ |(m:ℝ)/B|) (β„“ : β„•) (hβ„“ : 1 ≀ β„“) : 𝓕⁻ (fun y => (signalJitter Ξ± Ξ³ d (signalPrimeProduct L) B c y : β„‚)) ((β„“:ℝ)*(m:ℝ)*c) = if β„“ = 1 ∧ IsUnit (m : ZMod (signalPrimeProduct L)) then (Ξ³ : β„‚)*d ((m:ℝ)/B) else 0 := by have he := signalJitter_integer_moments hΞ± hB hc Ξ³ hd hcomp (signalPrimeProduct L) ((β„“:β„€)*m) push_cast at he rw [he] have hh := signalJoint_sieved_moments hΞ± hΞ±b hb hm hL hd hcomp hr hs Ξ³ (m : ZMod (signalPrimeProduct L)) β„“ hβ„“ convert hh using 1 congr 2 ring_nf end ThreeTorus noncomputable section open MeasureTheory Set Filter Asymptotics open scoped Topology FourierTransform namespace ThreeTorus /-- Density under multiplication by a nonzero real scale, including negative scales. -/ def scaledDensity (q : ℝ β†’ ℝ) (s y : ℝ) : ℝ := |s|⁻¹*q (y/s) lemma integrable_scaledDensity {q : ℝ β†’ ℝ} (hq : Integrable q) {s : ℝ} (hs : s β‰  0) : Integrable (scaledDensity q s) := by have hi := ((integrable_comp_mul_left_iff q (inv_ne_zero hs)).2 hq).const_mul |s|⁻¹ change Integrable (fun y => |s|⁻¹*q (y/s)) simpa only [div_eq_mul_inv,mul_comm] using hi lemma integral_scaledDensity {q : ℝ β†’ ℝ} {s : ℝ} (hs : s β‰  0) : (∫ y, scaledDensity q s y) = ∫ y, q y := by simp only [scaledDensity,div_eq_mul_inv] rw [integral_const_mul,Measure.integral_comp_mul_right] simp only [inv_inv,smul_eq_mul] field_simp lemma fourierInv_scaledDensity {q : ℝ β†’ ℝ} {s : ℝ} (hs : s β‰  0) (v : ℝ) : 𝓕⁻ (fun y => (scaledDensity q s y : β„‚)) v = 𝓕⁻ (fun y => (q y : β„‚)) (v*s) := by simp only [Real.fourierInv_eq_fourier_neg,Real.fourier_real_eq_integral_exp_smul, smul_eq_mul] let f : ℝ β†’ β„‚ := fun x => Complex.exp (((-2*Real.pi*x*(-(v*s))) : ℝ)*Complex.I)*(q x : β„‚) have he : βˆ€ y : ℝ, Complex.exp (((-2*Real.pi*y*(-v)) : ℝ)*Complex.I)*(scaledDensity q s y : β„‚) = ((|s| : ℝ) : β„‚)⁻¹*f (s⁻¹*y) := by intro y have harg : -2*Real.pi*(s⁻¹*y)*(-(v*s)) = -2*Real.pi*y*(-v) := by field_simp [hs] dsimp only [f,scaledDensity] rw [harg] simp only [div_eq_mul_inv,Complex.ofReal_mul,Complex.ofReal_inv] rw [mul_comm s⁻¹ y] ring simp_rw [he] rw [integral_const_mul,Measure.integral_comp_mul_left] simp only [inv_inv,Complex.real_smul] have hsC : ((|s| : ℝ) : β„‚) β‰  0 := Complex.ofReal_ne_zero.mpr (abs_ne_zero.mpr hs) field_simp apply integral_congr_ae filter_upwards [] with x dsimp only [f] congr 3 ring_nf lemma fourier_scaledDensity {q : ℝ β†’ ℝ} {s : ℝ} (hs : s β‰  0) (v : ℝ) : 𝓕 (fun y => (scaledDensity q s y : β„‚)) v = 𝓕 (fun y => (q y : β„‚)) (v*s) := by have hh := fourierInv_scaledDensity (q := q) hs (-v) simpa only [Real.fourierInv_eq_fourier_neg,neg_neg,neg_mul,neg_neg] using hh lemma scaledDensity_quadratic_bound {q : ℝ β†’ ℝ} {C s : ℝ} (hC : 0 ≀ C) (hs : s β‰  0) (hq : βˆ€ y, |q y| ≀ C/(1+y^2)) : βˆƒ D : ℝ, 0 ≀ D ∧ βˆ€ y, |scaledDensity q s y| ≀ D/(1+y^2) := by let K := 1+2*s^2 have hK : 0 < K := by dsimp [K]; positivity refine ⟨|s|⁻¹*C*K,by positivity,fun y => ?_⟩ have hsq : y^2 = s^2*(y/s)^2 := by field_simp have hbnd : 1+y^2 ≀ K*(1+(y/s)^2) := by dsimp [K] nlinarith [sq_nonneg s,sq_nonneg (y/s)] calc |scaledDensity q s y| = |s|⁻¹*|q (y/s)| := by simp only [scaledDensity,abs_mul,abs_inv,abs_abs] _ ≀ |s|⁻¹*(C/(1+(y/s)^2)) := mul_le_mul_of_nonneg_left (hq _) (by positivity) _ ≀ (|s|⁻¹*C*K)/(1+y^2) := by rw [← mul_div_assoc,div_le_div_iffβ‚€ (by positivity) (by positivity)] nlinarith [mul_le_mul_of_nonneg_left hbnd (show 0 ≀ |s|⁻¹*C by positivity)] lemma quadratic_norm_isBigO {f : ℝ β†’ β„‚} {C : ℝ} (hC : 0 ≀ C) (hf : βˆ€ y, β€–f yβ€– ≀ C/(1+y^2)) : f =O[cocompact ℝ] (fun y : ℝ => |y| ^ (-(2:ℝ))) := by apply IsBigO.of_bound C filter_upwards [(isCompact_Icc (a := (-1:ℝ)) (b := 1)).compl_mem_cocompact] with y hy have h0 : y β‰  0 := by intro h; subst y; simp at hy have hsq : 0 < y^2 := sq_pos_of_ne_zero h0 have hr : |y| ^ (-(2:ℝ)) = (y^2)⁻¹ := by rw [Real.rpow_neg (abs_nonneg y),Real.rpow_two,sq_abs] rw [hr,Real.norm_eq_abs,abs_of_nonneg (by positivity),← div_eq_mul_inv] exact (hf y).trans (div_le_div_of_nonneg_left hC hsq (by nlinarith)) lemma summable_lattice_of_bounded_support {f : ℝ β†’ β„‚} {D : ℝ} (hf : βˆ€ v, D < |v| β†’ f v = 0) : Summable (fun n : β„€ => f (n:ℝ)) := by obtain ⟨N,hN⟩ := exists_nat_gt D apply summable_of_ne_finset_zero (s := Finset.Icc (-(N:β„€)) N) intro n hn apply hf by_contra! hh have hab := abs_le.mp (hh.trans hN.le) exact hn (Finset.mem_Icc.mpr ⟨by exact_mod_cast hab.1,by exact_mod_cast hab.2⟩) /-- Exact Poisson expansion for every continuously bandlimited quadratic-tail law. -/ theorem periodization_fourier {q : ℝ β†’ ℝ} (hq : Continuous q) {C : ℝ} (hC : 0 ≀ C) (hbnd : βˆ€ y, |q y| ≀ C/(1+y^2)) {D : ℝ} (hF : βˆ€ v, D < |v| β†’ 𝓕 (fun y => (q y : β„‚)) v = 0) (x : ℝ) : βˆ‘' n : β„€, (q (x+n) : β„‚) = βˆ‘' n : β„€, 𝓕 (fun y => (q y : β„‚)) (n:ℝ)*fourier n (x : UnitAddCircle) := by apply Real.tsum_eq_tsum_fourier_of_rpow_decay_of_summable (Complex.continuous_ofReal.comp hq) (b := 2) (by norm_num) Β· exact quadratic_norm_isBigO hC (fun y => by simpa only [Function.comp_apply,Complex.norm_real,Real.norm_eq_abs] using hbnd y) Β· exact summable_lattice_of_bounded_support hF lemma fourierInv_real_neg (q : ℝ β†’ ℝ) (v : ℝ) : 𝓕⁻ (fun y => (q y : β„‚)) (-v) = starRingEnd β„‚ (𝓕⁻ (fun y => (q y : β„‚)) v) := by simp only [Real.fourierInv_eq_fourier_neg,Real.fourier_real_eq_integral_exp_smul, smul_eq_mul,← integral_conj] apply integral_congr_ae filter_upwards [] with y simp only [map_mul,Complex.conj_ofReal,← Complex.exp_conj,Complex.conj_I] congr 2 push_cast ring lemma periodization_three_modes {q : ℝ β†’ ℝ} (hq : Continuous q) {C : ℝ} (hC : 0 ≀ C) (hbnd : βˆ€ y, |q y| ≀ C/(1+y^2)) (a : β„‚) (hmom : βˆ€ n : β„€, 𝓕⁻ (fun y => (q y : β„‚)) (n:ℝ) = if n = 0 then 1 else if n = 1 then a else if n = -1 then starRingEnd β„‚ a else 0) (x : ℝ) : βˆ‘' n : β„€, (q (x+n) : β„‚) = 1 + 2*((a * fourier (-1) (x : UnitAddCircle)).re : β„‚) := by have hF (n : β„€) : 𝓕 (fun y => (q y : β„‚)) (n:ℝ) = if n = 0 then 1 else if n = 1 then starRingEnd β„‚ a else if n = -1 then a else 0 := by have hh := hmom (-n) simp only [Int.cast_neg,Real.fourierInv_eq_fourier_neg,neg_neg] at hh rw [hh] by_cases h0 : n = 0 Β· simp [h0] by_cases h1 : n = 1 Β· simp [h1] by_cases hn1 : n = -1 Β· simp [hn1] have hh1 : -n β‰  1 := by omega have hh2 : -n β‰  -1 := by omega simp [h0,h1,hn1,hh1,hh2] have hs : Summable (fun n : β„€ => 𝓕 (fun y => (q y : β„‚)) (n:ℝ)) := by apply summable_of_ne_finset_zero (s := {-1,0,1}) intro n hn simp only [Finset.mem_insert,Finset.mem_singleton,not_or] at hn simp [hF,hn.1,hn.2.1,hn.2.2] have hh := Real.tsum_eq_tsum_fourier_of_rpow_decay_of_summable (Complex.continuous_ofReal.comp hq) (b := 2) (by norm_num) (quadratic_norm_isBigO hC (fun y => by simpa only [Function.comp_apply,Complex.norm_real,Real.norm_eq_abs] using hbnd y)) hs x simp only [Function.comp_def] at hh erw [hh] rw [tsum_eq_sum (s := {-1,0,1}) (fun n hn => by simp only [Finset.mem_insert,Finset.mem_singleton,not_or] at hn simp [hF,hn.1,hn.2.1,hn.2.2])] simp only [Finset.sum_insert,Finset.sum_singleton,show (-1 : β„€) βˆ‰ ({0,1} : Finset β„€) by decide, show (0 : β„€) βˆ‰ ({1} : Finset β„€) by decide,not_false_eq_true,hF] norm_num only [fourier_zero,Int.reduceNeg,Int.reduceEq,ite_true,ite_false,one_mul,mul_one] rw [fourier_neg] have he : a * starRingEnd β„‚ (fourier 1 (x : UnitAddCircle)) + starRingEnd β„‚ a * fourier 1 (x : UnitAddCircle) = 2*((a * starRingEnd β„‚ (fourier 1 (x : UnitAddCircle))).re : β„‚) := by simpa only [map_mul,starRingEnd_self_apply,Complex.ofReal_mul,Complex.ofReal_ofNat] using Complex.add_conj (a * starRingEnd β„‚ (fourier 1 (x : UnitAddCircle))) linear_combination he /-- A compact Fourier bandwidth supplies a shared finite series near any nonzero scale. -/ lemma periodization_scaled_finite {q : ℝ β†’ ℝ} (hq : Continuous q) {C : ℝ} (hC : 0 ≀ C) (hbnd : βˆ€ y, |q y| ≀ C/(1+y^2)) {D Ξ΅ : ℝ} (hΞ΅ : 0 < Ξ΅) (hF : βˆ€ v, D < |v| β†’ 𝓕 (fun y => (q y : β„‚)) v = 0) {N : β„•} (hN : D < N*Ξ΅) {s : ℝ} (hs : Ξ΅ ≀ |s|) (x : ℝ) : βˆ‘' n : β„€, (scaledDensity q s (x+n) : β„‚) = βˆ‘ n ∈ Finset.Icc (-(N:β„€)) N, 𝓕 (fun y => (q y : β„‚)) ((n:ℝ)*s)*fourier n (x : UnitAddCircle) := by have hs0 : s β‰  0 := by intro hh; simp [hh] at hs; linarith obtain ⟨C',hC',hbound⟩ := scaledDensity_quadratic_bound hC hs0 hbnd have hcont : Continuous (scaledDensity q s) := continuous_const.mul (hq.comp (continuous_id.div_const _)) have hband (n : β„€) (hn : n βˆ‰ Finset.Icc (-(N:β„€)) N) : 𝓕 (fun y => (q y : β„‚)) ((n:ℝ)*s) = 0 := by apply hF have hn' : (N : ℝ) < |(n:ℝ)| := by by_contra! hab have hle := abs_le.mp hab apply hn exact Finset.mem_Icc.mpr ⟨by exact_mod_cast hle.1,by exact_mod_cast hle.2⟩ rw [abs_mul] exact hN.trans_le (mul_le_mul (le_of_lt hn') hs hΞ΅.le (abs_nonneg _)) have hsumm : Summable (fun n : β„€ => 𝓕 (fun y => (scaledDensity q s y : β„‚)) (n:ℝ)) := by apply summable_of_ne_finset_zero (s := Finset.Icc (-(N:β„€)) N) intro n hn rw [fourier_scaledDensity hs0] exact hband n hn have he := Real.tsum_eq_tsum_fourier_of_rpow_decay_of_summable (Complex.continuous_ofReal.comp hcont) (b := 2) (by norm_num) (quadratic_norm_isBigO hC' (fun y => by simpa only [Function.comp_apply,Complex.norm_real,Real.norm_eq_abs] using hbound y)) hsumm x simp only [Function.comp_def] at he erw [he] simp_rw [fourier_scaledDensity hs0] exact tsum_eq_sum (fun n hn => by rw [hband n hn,zero_mul]) lemma periodization_scaled_tendstoUniformly {q : ℝ β†’ ℝ} (hq : Continuous q) (hqi : Integrable q) {C : ℝ} (hC : 0 ≀ C) (hbnd : βˆ€ y, |q y| ≀ C/(1+y^2)) {D : ℝ} (hF : βˆ€ v, D < |v| β†’ 𝓕 (fun y => (q y : β„‚)) v = 0) {sβ‚€ : ℝ} (hsβ‚€ : sβ‚€ β‰  0) : TendstoUniformly (fun s x => βˆ‘' n : β„€, (scaledDensity q s (x+n) : β„‚)) (fun x => βˆ‘' n : β„€, (scaledDensity q sβ‚€ (x+n) : β„‚)) (𝓝 sβ‚€) := by let Ξ΅ := |sβ‚€|/2 have hΞ΅ : 0 < Ξ΅ := by dsimp [Ξ΅]; positivity obtain ⟨N,hN⟩ := exists_nat_gt (D/Ξ΅) have hN' : D < (N:ℝ)*Ξ΅ := (div_lt_iffβ‚€ hΞ΅).mp hN let S := Finset.Icc (-(N:β„€)) N let F : ℝ β†’ β„‚ := 𝓕 (fun y => (q y : β„‚)) have hFc : Continuous F := VectorFourier.fourierIntegral_continuous Real.continuous_fourierChar continuous_inner hqi.ofReal let G : ℝ β†’ UnitAddCircle β†’ β„‚ := fun s x => βˆ‘ n ∈ S, F ((n:ℝ)*s)*fourier n x have hGc : Continuous β†ΏG := by change Continuous (fun p : ℝ Γ— UnitAddCircle => βˆ‘ n ∈ S, F ((n:ℝ)*p.1)*fourier n p.2) apply continuous_finsetSum _ intro n _ exact (hFc.comp (continuous_const.mul continuous_fst)).mul ((fourier n).continuous.comp continuous_snd) have hu := Continuous.tendstoUniformly G hGc sβ‚€ have hnear : βˆ€αΆ  s : ℝ in 𝓝 sβ‚€, Ξ΅ ≀ |s| := by have hh : Ξ΅ < |sβ‚€| := by dsimp [Ξ΅]; linarith [abs_pos.mpr hsβ‚€] exact ((continuous_abs.tendsto sβ‚€).eventually (eventually_gt_nhds hh)).mono (fun _ h => h.le) have hsβ‚€' : Ξ΅ ≀ |sβ‚€| := by dsimp [Ξ΅]; linarith [abs_nonneg sβ‚€] apply Metric.tendstoUniformly_iff.mpr intro Ξ΄ hΞ΄ filter_upwards [Metric.tendstoUniformly_iff.mp hu Ξ΄ hΞ΄,hnear] with s hs hs' intro x rw [periodization_scaled_finite hq hC hbnd hΞ΅ hF hN' hs' x, periodization_scaled_finite hq hC hbnd hΞ΅ hF hN' hsβ‚€' x] exact hs (x : UnitAddCircle) lemma fourierInv_real_zero (q : ℝ β†’ ℝ) : 𝓕⁻ (fun y => (q y : β„‚)) 0 = ((∫ y, q y : ℝ) : β„‚) := by simp only [Real.fourierInv_eq_fourier_neg,Real.fourier_real_eq_integral_exp_smul, neg_zero,mul_zero,Complex.ofReal_zero,zero_mul,Complex.exp_zero,one_smul] exact integral_ofReal lemma fourierInv_real_int_moments {q : ℝ β†’ ℝ} (hmass : (∫ y, q y) = 1) (a : β„‚) (hpos : βˆ€ β„“ : β„•, 1 ≀ β„“ β†’ 𝓕⁻ (fun y => (q y : β„‚)) (β„“:ℝ) = if β„“ = 1 then a else 0) (n : β„€) : 𝓕⁻ (fun y => (q y : β„‚)) (n:ℝ) = if n = 0 then 1 else if n = 1 then a else if n = -1 then starRingEnd β„‚ a else 0 := by by_cases h0 : n = 0 Β· rw [h0,Int.cast_zero,ite_eq_left rfl,fourierInv_real_zero,hmass,Complex.ofReal_one] rcases lt_or_gt_of_ne h0 with hn | hn Β· have hneg : 0 ≀ -n := by omega let k := (-n).toNat have hk : (k : β„€) = -n := Int.toNat_of_nonneg hneg have hkpos : 1 ≀ k := by omega have hnk : n = -(k : β„€) := by omega rw [hnk,Int.cast_neg,Int.cast_natCast,fourierInv_real_neg,hpos k hkpos] by_cases hk1 : k = 1 Β· simp [hk1] Β· have hk0 : k β‰  0 := by omega have hn1 : -(k:β„€) β‰  1 := by omega have hnm1 : -(k:β„€) β‰  -1 := by omega simp [hk1,hk0,hn1,hnm1] Β· lift n to β„• using hn.le with k hk have hkpos : 1 ≀ k := by omega rw [Int.cast_natCast,hpos k hkpos] by_cases hk1 : k = 1 Β· simp [hk1] Β· have hk0 : k β‰  0 := by omega have hkn1 : (k:β„€) β‰  -1 := by omega simp [hk1,hk0,hkn1] end ThreeTorus namespace ThreeTorus lemma signalJitter_fourierInv_support {Ξ± B c D : ℝ} (hΞ± : 0 < Ξ±) (hB : 0 < B) (hc : 0 < c) (hΞ±D : Ξ± ≀ D) (Ξ³ : ℝ) {d : ℝ β†’ β„‚} (hd : ContDiff ℝ ((⊀ : β„•βˆž) : WithTop β„•βˆž) d) (hcomp : HasCompactSupport d) (hr : βˆ€ v, d (-v) = starRingEnd β„‚ (d v)) (hs : Function.support d βŠ† Icc (-D) D) (P : β„•) [NeZero P] {v : ℝ} (hv : c*B*D < |v|) : 𝓕⁻ (fun y => (signalJitter Ξ± Ξ³ d P B c y : β„‚)) v = 0 := by rw [signalJitter_fourierInv hΞ± hB hc Ξ³ hd hcomp] have hdiv : D < |v/(c*B)| := by rw [abs_div,abs_of_pos (mul_pos hc hB),lt_div_iffβ‚€ (mul_pos hc hB)] nlinarith apply Finset.sum_eq_zero intro h _ rw [fourierInv_signalJoint hΞ± Ξ³ hd hcomp hr] have hbase : 𝓕⁻ (fun y => (signalBaseline Ξ± y : β„‚)) (v/(c*B)) = 0 := by rw [Real.fourierInv_eq_fourier_neg] exact signalBaseline_fourier_support hΞ± (by simpa only [abs_neg] using hΞ±D.trans hdiv.le) have hd0 : d (v/(c*B)) = 0 := by apply Function.notMem_support.mp intro hn have hh := hs hn exact (not_le_of_gt hdiv) (abs_le.mpr ⟨hh.1,hh.2⟩) rw [hbase,hd0,mul_zero,add_zero,mul_zero,mul_zero] lemma signalJitter_scale_cancel {Ξ± Ξ³ : ℝ} (d : ℝ β†’ β„‚) (P : β„•) [NeZero P] (B : ℝ) {c : ℝ} (hc : 0 < c) (m y : ℝ) : scaledDensity (signalJitter Ξ± Ξ³ d P B c) (m*c) y = scaledDensity (signalJitter Ξ± Ξ³ d P B 1) m y := by simp only [scaledDensity,signalJitter,abs_mul,abs_of_pos hc,mul_inv_rev,one_mul] by_cases hm : m = 0 Β· simp [hm] have he : c*(y/(m*c)) = y/m := by field_simp rw [he] field_simp lemma signalJitter_periodic_ideal {Ξ± B c b D : ℝ} (hΞ± : 0 < Ξ±) (hΞ±b : Ξ± < b) (hB : 0 < B) (hc : 0 < c) (hb : 0 < b) {L : β„•} (hL : D/b < L) (Ξ³ : ℝ) {d : ℝ β†’ β„‚} (hd : ContDiff ℝ ((⊀ : β„•βˆž) : WithTop β„•βˆž) d) (hcomp : HasCompactSupport d) (hr : βˆ€ v, d (-v) = starRingEnd β„‚ (d v)) (h0 : d 0 = 0) (hs : Function.support d βŠ† Icc (-D) D) (m : β„€) (hm : b ≀ |(m:ℝ)/B|) (hbound : βˆ€ h R, signalBaseline Ξ± R/(2*signalPrimeProduct L) ≀ signalJoint Ξ± Ξ³ d (signalPrimeProduct L) h R ∧ signalJoint Ξ± Ξ³ d (signalPrimeProduct L) h R ≀ 3*signalBaseline Ξ± R/(2*signalPrimeProduct L)) (y : ℝ) : βˆ‘' k : β„€, (scaledDensity (signalJitter Ξ± Ξ³ d (signalPrimeProduct L) B c) ((m:ℝ)*c) (y+k) : β„‚) = 1 + 2*((((if IsUnit (m : ZMod (signalPrimeProduct L)) then (Ξ³:β„‚)*d ((m:ℝ)/B) else 0) * fourier (-1) (y : UnitAddCircle)).re) : β„‚) := by have hm0 : (m:ℝ) β‰  0 := by intro hh; rw [hh,zero_div,abs_zero] at hm; linarith have hmc : (m:ℝ)*c β‰  0 := mul_ne_zero hm0 hc.ne' obtain ⟨a,A,_ha,hA,hbnd⟩ := signalJitter_quadratic_tails hΞ± hB hc (signalPrimeProduct L) hbound have hqb : βˆ€ y, |signalJitter Ξ± Ξ³ d (signalPrimeProduct L) B c y| ≀ A/(1+y^2) := by intro y rw [abs_of_pos (signalJitter_pos hΞ± hB hc _ hbound y)] exact (hbnd y).2 obtain ⟨C,hC,hCb⟩ := scaledDensity_quadratic_bound hA.le hmc hqb have hcq : Continuous (scaledDensity (signalJitter Ξ± Ξ³ d (signalPrimeProduct L) B c) ((m:ℝ)*c)) := continuous_const.mul ((signalJitter_smooth hΞ± Ξ³ hd hcomp _ B c).continuous.comp (continuous_id.div_const _)) apply periodization_three_modes hcq hC hCb apply fourierInv_real_int_moments Β· rw [integral_scaledDensity hmc,integral_signalJitter hΞ± hB hc Ξ³ hd hcomp hr h0] Β· intro β„“ hβ„“ erw [fourierInv_scaledDensity hmc] have he : (β„“:ℝ)*((m:ℝ)*c) = (β„“:ℝ)*(m:ℝ)*c := by ring rw [he,signalJitter_sieved_moments hΞ± hΞ±b hB hc hb hL Ξ³ hd hcomp hr hs m hm β„“ hβ„“] split_ifs <;> simp_all end ThreeTorus namespace ThreeTorus /-- The finite-c approximation is uniform on every fixed old speed range. The exact ideal law is independent of c after scaling, as required in section 3. -/ lemma periodization_scaled_uniform_perturbation {q : ℝ β†’ ℝ} (hq : Continuous q) (hqi : Integrable q) {C : ℝ} (hC : 0 ≀ C) (hbnd : βˆ€ y, |q y| ≀ C/(1+y^2)) {D : ℝ} (hF : βˆ€ v, D < |v| β†’ 𝓕 (fun y => (q y : β„‚)) v = 0) {sβ‚€ : ℝ} (hsβ‚€ : sβ‚€ β‰  0) (V : ℝ) : βˆ€ Ξ΅ > 0, βˆ€αΆ  c : ℝ in atTop, βˆ€ v : ℝ, |v| ≀ V β†’ βˆ€ y : ℝ, dist (βˆ‘' n : β„€, (scaledDensity q (sβ‚€*(1+v/c)) (y+n) : β„‚)) (βˆ‘' n : β„€, (scaledDensity q sβ‚€ (y+n) : β„‚)) < Ξ΅ := by intro Ξ΅ hΞ΅ obtain ⟨δ,hΞ΄,hd⟩ := Metric.eventually_nhds_iff.mp (Metric.tendstoUniformly_iff.mp (periodization_scaled_tendstoUniformly hq hqi hC hbnd hF hsβ‚€) Ξ΅ hΞ΅) filter_upwards [eventually_gt_atTop (|sβ‚€| * |V|/Ξ΄+1)] with c hc intro v hv y have hc0 : 0 < c := lt_trans (by positivity) hc have hv' : |v| ≀ |V| := hv.trans (le_abs_self V) have hnear : dist (sβ‚€*(1+v/c)) sβ‚€ < Ξ΄ := by rw [Real.dist_eq,show sβ‚€*(1+v/c)-sβ‚€ = sβ‚€*v/c by ring, abs_div,abs_mul,abs_of_pos hc0] apply (div_lt_iffβ‚€ hc0).mpr have hh : |sβ‚€| * |V| < Ξ΄*c := by have h := (div_lt_iffβ‚€ hΞ΄).mp (lt_trans (lt_add_one _) hc) nlinarith exact lt_of_le_of_lt (mul_le_mul_of_nonneg_left hv' (abs_nonneg _)) hh simpa only [dist_comm] using hd hnear y end ThreeTorus namespace ThreeTorus /-- The actual finite-c signal law, uniform in the bounded old speed and in all phases. The modulus and strength are the exact fixed ones of the manuscript. -/ lemma signalJitter_periodic_approximation {Ξ± B b D : ℝ} (hΞ± : 0 < Ξ±) (hΞ±b : Ξ± < b) (hΞ±D : Ξ± ≀ D) (hB : 0 < B) (hb : 0 < b) {L : β„•} (hL : D/b < L) (Ξ³ : ℝ) {d : ℝ β†’ β„‚} (hd : ContDiff ℝ ((⊀ : β„•βˆž) : WithTop β„•βˆž) d) (hcomp : HasCompactSupport d) (hr : βˆ€ v, d (-v) = starRingEnd β„‚ (d v)) (h0 : d 0 = 0) (hs : Function.support d βŠ† Icc (-D) D) (m : β„€) (hm : b ≀ |(m:ℝ)/B|) (hbound : βˆ€ h R, signalBaseline Ξ± R/(2*signalPrimeProduct L) ≀ signalJoint Ξ± Ξ³ d (signalPrimeProduct L) h R ∧ signalJoint Ξ± Ξ³ d (signalPrimeProduct L) h R ≀ 3*signalBaseline Ξ± R/(2*signalPrimeProduct L)) (V : ℝ) : βˆ€ Ξ΅ > 0, βˆ€αΆ  c : ℝ in atTop, βˆ€ v : ℝ, |v| ≀ V β†’ βˆ€ y : ℝ, dist (βˆ‘' k : β„€, (scaledDensity (signalJitter Ξ± Ξ³ d (signalPrimeProduct L) B c) ((m:ℝ)*(c+v)) (y+k) : β„‚)) (1 + 2*((((if IsUnit (m : ZMod (signalPrimeProduct L)) then (Ξ³:β„‚)*d ((m:ℝ)/B) else 0) * fourier (-1) (y : UnitAddCircle)).re) : β„‚)) < Ξ΅ := by have hm0 : (m:ℝ) β‰  0 := by intro hh; rw [hh,zero_div,abs_zero] at hm; linarith obtain ⟨a,A,_ha,hA,hbnd⟩ := signalJitter_quadratic_tails hΞ± hB zero_lt_one (signalPrimeProduct L) hbound have hqb : βˆ€ y, |signalJitter Ξ± Ξ³ d (signalPrimeProduct L) B 1 y| ≀ A/(1+y^2) := by intro y rw [abs_of_pos (signalJitter_pos hΞ± hB zero_lt_one _ hbound y)] exact (hbnd y).2 have hF : βˆ€ v, B*D < |v| β†’ 𝓕 (fun y => (signalJitter Ξ± Ξ³ d (signalPrimeProduct L) B 1 y : β„‚)) v = 0 := by intro v hv have hh := signalJitter_fourierInv_support hΞ± hB zero_lt_one hΞ±D Ξ³ hd hcomp hr hs (signalPrimeProduct L) (v := -v) (by simpa only [one_mul,abs_neg] using hv) simpa only [Real.fourierInv_eq_fourier_neg,neg_neg] using hh intro Ξ΅ hΞ΅ have he := periodization_scaled_uniform_perturbation (signalJitter_smooth hΞ± Ξ³ hd hcomp _ B 1).continuous (signalJitter_integrable hΞ± hB zero_lt_one Ξ³ hd hcomp _) hA.le hqb hF hm0 V Ξ΅ hΞ΅ filter_upwards [he,eventually_gt_atTop (0:ℝ)] with c hc hc0 intro v hv y have hscale : (m:ℝ)*(c+v) = ((m:ℝ)*(1+v/c))*c := by field_simp simp_rw [hscale,signalJitter_scale_cancel d (signalPrimeProduct L) B hc0] have hideal := signalJitter_periodic_ideal hΞ± hΞ±b hB zero_lt_one hb hL Ξ³ hd hcomp hr h0 hs m hm hbound y simp only [mul_one] at hideal rw [← hideal] exact hc v hv y end ThreeTorus end end end end end end OAI
import Mathlib
namespace OAI
/-! Positive Fourier laws, compact integral differentiation, affine densities, and prime-sieve signal laws. -/
noncomputable section
open MeasureTheory Filter Set Complex
open scoped Topology SchwartzMap FourierTransform Real
open scoped Topology
open MeasureTheory Set
open scoped ENNReal Topology
open Set Function Filter
open scoped Topology NNReal
open MeasureTheory Filter Set
open MeasureTheory Set Function
open scoped Topology ENNReal
open scoped Topology BigOperators
noncomputable section
open MeasureTheory Set Filter
open scoped Topology
namespace ThreeTorus
/-- Compact-parameter differentiation, used by the exact passage near epsilon=0. -/
lemma hasFDerivAt_compact_integral
{E : Type} {G : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E]
[NormedAddCommGroup G] [NormedSpace ℝ G] [CompleteSpace G]
{F : E Γ— ℝ β†’ G} (hF : ContDiff ℝ 1 F) (a b : ℝ) (x : E) :
HasFDerivAt (fun y => ∫ t in a..b, F (y,t))
(∫ t in a..b, (fderiv ℝ F (x,t)).comp (ContinuousLinearMap.inl ℝ E ℝ)) x := by
let D : E Γ— ℝ β†’ E β†’L[ℝ] G := fun p =>
(fderiv ℝ F p).comp (ContinuousLinearMap.inl ℝ E ℝ)
have hD : Continuous D := hF.continuous_fderiv (by norm_num) |>.clm_comp continuous_const
obtain ⟨C,hC⟩ := ((isCompact_closedBall x 1).prod (isCompact_uIcc (a := a) (b := b))).exists_bound_of_continuousOn hD.continuousOn
refine hasFDerivAt_integral_of_dominated_of_fderiv_le''
(F := fun y t => F (y,t)) (F' := fun y t => D (y,t))
(bound := fun _ => C) (Metric.closedBall_mem_nhds x (by norm_num : (0:ℝ)<1)) ?_ ?_ ?_ ?_
intervalIntegrable_const ?_
Β· exact Eventually.of_forall (fun y => (hF.continuous.comp (continuous_const.prodMk continuous_id)).aestronglyMeasurable)
Β· exact (hF.continuous.comp (continuous_const.prodMk continuous_id)).intervalIntegrable _ _
Β· exact (hD.comp (continuous_const.prodMk continuous_id)).aestronglyMeasurable
Β· filter_upwards [ae_restrict_mem measurableSet_uIoc] with t ht
intro y hy
exact hC (y,t) ⟨hy,uIoc_subset_uIcc ht⟩
Β· exact Eventually.of_forall (fun t y _ => by
simpa [D,Function.comp_def] using ((hF.differentiable one_ne_zero ((ContinuousLinearMap.inl ℝ E ℝ) y+(0,t))).hasFDerivAt).comp y
((ContinuousLinearMap.inl ℝ E ℝ).hasFDerivAt.add_const (0,t)))
/-- Smooth parameter integration over a fixed compact interval. -/
lemma contDiff_compact_integral
{E : Type} {G : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E]
[NormedAddCommGroup G] [NormedSpace ℝ G] [CompleteSpace G]
(n : β„•) {F : E Γ— ℝ β†’ G} (hF : ContDiff ℝ n F) (a b : ℝ) :
ContDiff ℝ n (fun y => ∫ t in a..b, F (y,t)) := by
induction n generalizing G with
| zero =>
apply contDiff_zero.mpr
exact intervalIntegral.continuous_parametric_intervalIntegral_of_continuous'
(show Continuous (Function.uncurry (fun y t => F (y,t))) from hF.continuous) a b
| succ n ih =>
let D : E Γ— ℝ β†’ E β†’L[ℝ] G := fun p =>
(fderiv ℝ F p).comp (ContinuousLinearMap.inl ℝ E ℝ)
have hD : ContDiff ℝ n D := (hF.fderiv_right (by simp)).clm_comp contDiff_const
have hder (x : E) := hasFDerivAt_compact_integral (hF.of_le (by exact_mod_cast Nat.succ_pos n)) a b x
rw [show ((n+1 : β„•) : WithTop β„•βˆž) = (n : WithTop β„•βˆž)+1 by simp, contDiff_succ_iff_fderiv]
refine ⟨fun x => (hder x).differentiableAt, ?_, ?_⟩
Β· simp
Β· have heq : fderiv ℝ (fun y => ∫ t in a..b, F (y,t)) =
fun y => ∫ t in a..b, D (y,t) := by
funext y
exact (hder y).fderiv
rw [heq]
exact ih hD
lemma smooth_compact_integral
{E : Type} {G : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E]
[NormedAddCommGroup G] [NormedSpace ℝ G] [CompleteSpace G]
{F : E Γ— ℝ β†’ G} (hF : ContDiff ℝ ((⊀ : β„•βˆž) : WithTop β„•βˆž) F) (a b : ℝ) :
ContDiff ℝ ((⊀ : β„•βˆž) : WithTop β„•βˆž) (fun y => ∫ t in a..b, F (y,t)) := by
rw [contDiff_infty]
intro n
exact contDiff_compact_integral n (hF.of_le (by exact_mod_cast (le_top : (n : β„•βˆž) ≀ ⊀))) a b
/-! The positive Fourier law. The sinc and averaged
baseline below are exactly those of the manuscript, including the scale and
normalization. -/
open scoped FourierTransform Convolution
lemma sinc_eq_integral_cos (x : ℝ) :
Real.sinc x = ∫ t in (0 : ℝ)..1, Real.cos (x*t) := by
by_cases hx : x = 0
Β· simp [hx]
Β· rw [intervalIntegral.integral_comp_mul_left _ hx,integral_cos]
simp only [mul_zero,mul_one,Real.sin_zero,sub_zero,smul_eq_mul]
rw [Real.sinc_of_ne_zero hx]
ring
lemma smooth_sinc : ContDiff ℝ ((⊀ : β„•βˆž) : WithTop β„•βˆž) Real.sinc := by
rw [show Real.sinc = (fun x => ∫ t in (0 : ℝ)..1, Real.cos (x*t)) from