import Mathlib.Analysis.Calculus.ContDiff.Basic import Mathlib.Analysis.Calculus.ContDiff.Deriv import Mathlib.Analysis.Calculus.ContDiff.Operations import Mathlib.Analysis.Calculus.Deriv.Support import Mathlib.Analysis.Complex.Basic import Mathlib.MeasureTheory.Integral.Bochner.Basic import Mathlib.MeasureTheory.Integral.Bochner.ContinuousLinearMap import Mathlib.MeasureTheory.Integral.Bochner.Set import Mathlib.MeasureTheory.Integral.IntervalIntegral.Basic import Mathlib.MeasureTheory.Integral.IntervalIntegral.FundThmCalculus import Mathlib.MeasureTheory.Integral.Prod import F04Riemann.AnalyticFoundations import F04Riemann.Arithmetic /-! # Smooth Compactly Supported Test Functions, Moments, and Correlations (F04 §2) This module defines the complex-valued smooth compactly supported test space `TestFn` (`C_c^∞(ℝ, ℂ)`), its `L^2` and `L^1` norms, the multiplicative-coordinate isometry `g(x) = x^{-1/2} φ(log x)`, the two balance conditions `momentNeg φ = 0` and `momentPos φ = 0` (eq. (1)), the differential operator `T ψ = ψ'' - (1/4) ψ` generating balanced test functions, the cross-correlation `corr a b t = ∫ a(v+t) conj(b(v)) dv`, its Cauchy–Schwarz and support bounds, and the `O(t^2)` cancellation proving full convergence of the continuous Weil integral for every pair `a b : TestFn`. -/ namespace F04Riemann open Real Complex MeasureTheory Set Filter Topology /-! ### 1. Compact-Support Integration Helpers -/ lemma integrable_of_continuous_of_vanishes_outside_Icc {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] {f : ℝ → E} (a b : ℝ) (hf : Continuous f) (hsupp : ∀ u, u ∉ Icc a b → f u = 0) : Integrable f volume := by have hind : (Icc a b).indicator f = f := by ext u by_cases hu : u ∈ Icc a b · exact Set.indicator_of_mem hu f · rw [Set.indicator_of_notMem hu, hsupp u hu] rw [← hind] exact (integrable_indicator_iff measurableSet_Icc).mpr hf.continuousOn.integrableOn_Icc lemma integral_eq_intervalIntegral_of_vanishes_outside_Icc {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] {f : ℝ → E} {a b : ℝ} (hab : a ≤ b) (hsupp : ∀ u, u ∉ Icc a b → f u = 0) : ∫ u, f u = ∫ u in a..b, f u := by rw [intervalIntegral.integral_of_le hab] have hset : ∫ u in Ioc a b, f u = ∫ u in Icc a b, f u := MeasureTheory.setIntegral_congr_set Ioc_ae_eq_Icc rw [hset, ← MeasureTheory.integral_indicator measurableSet_Icc] congr 1 ext u by_cases hu : u ∈ Icc a b · rw [Set.indicator_of_mem hu] · rw [Set.indicator_of_notMem hu, hsupp u hu] lemma exists_Icc_support_of_hasCompactSupport {E : Type*} [Zero E] {f : ℝ → E} (hf : HasCompactSupport f) : ∃ a b : ℝ, a ≤ b ∧ ∀ u, u ∉ Icc a b → f u = 0 := by obtain ⟨R, hR⟩ := hf.isBounded.subset_closedBall (0 : ℝ) refine ⟨-(max R 0), max R 0, by linarith [le_max_right R 0], fun u hu => ?_⟩ by_contra hne have hmem : u ∈ tsupport f := subset_tsupport f (Function.mem_support.mpr hne) have hball := hR hmem rw [Metric.mem_closedBall, Real.dist_eq, sub_zero, abs_le] at hball exact hu ⟨by linarith [le_max_left R 0, hball.1], by linarith [le_max_left R 0, hball.2]⟩ lemma integral_add_right_compact {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] {f : ℝ → E} (hf : HasCompactSupport f) (d : ℝ) : ∫ v, f (v + d) = ∫ v, f v := by obtain ⟨a, b, hab, hsupp⟩ := exists_Icc_support_of_hasCompactSupport hf have h1 : ∀ u, u ∉ Icc (a - d) (b - d) → f (u + d) = 0 := by intro u hu apply hsupp (u + d) intro hmem exact hu ⟨by linarith [hmem.1], by linarith [hmem.2]⟩ rw [integral_eq_intervalIntegral_of_vanishes_outside_Icc (by linarith : a - d ≤ b - d) h1] rw [intervalIntegral.integral_comp_add_right f d] have ha : a - d + d = a := by ring have hb : b - d + d = b := by ring rw [ha, hb, ← integral_eq_intervalIntegral_of_vanishes_outside_Icc hab hsupp] lemma integral_neg_compact {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] {f : ℝ → E} (hf : HasCompactSupport f) : ∫ v, f (-v) = ∫ v, f v := by obtain ⟨a, b, hab, hsupp⟩ := exists_Icc_support_of_hasCompactSupport hf have h1 : ∀ u, u ∉ Icc (-b) (-a) → f (-u) = 0 := by intro u hu apply hsupp (-u) intro hmem exact hu ⟨by linarith [hmem.2], by linarith [hmem.1]⟩ rw [integral_eq_intervalIntegral_of_vanishes_outside_Icc (by linarith : -b ≤ -a) h1] rw [intervalIntegral.integral_comp_neg f] simp only [neg_neg] exact (integral_eq_intervalIntegral_of_vanishes_outside_Icc hab hsupp).symm /-- Elementary Cauchy–Schwarz inequality for real Lebesgue integrals via quadratic discriminant. -/ lemma sq_integral_mul_le_integral_sq_mul_integral_sq {f g : ℝ → ℝ} (hfg : Integrable (fun u => f u * g u) volume) (hf2 : Integrable (fun u => f u ^ 2) volume) (hg2 : Integrable (fun u => g u ^ 2) volume) : (∫ u, f u * g u) ^ 2 ≤ (∫ u, f u ^ 2) * (∫ u, g u ^ 2) := by set A := ∫ u, f u ^ 2 set B := ∫ u, f u * g u set C := ∫ u, g u ^ 2 have hquad : ∀ lam : ℝ, 0 ≤ A - 2 * lam * B + lam ^ 2 * C := by intro lam have hnn : 0 ≤ ∫ u, (f u - lam * g u) ^ 2 := MeasureTheory.integral_nonneg (fun _ => sq_nonneg _) have hexpand : (fun u => (f u - lam * g u) ^ 2) = (fun u => (f u ^ 2 - (2 * lam) * (f u * g u)) + lam ^ 2 * g u ^ 2) := by ext u; ring rw [hexpand] at hnn have hint1 : Integrable (fun u => (2 * lam) * (f u * g u)) volume := hfg.const_mul (2 * lam) have hint_sub : Integrable (fun u => f u ^ 2 - (2 * lam) * (f u * g u)) volume := hf2.sub hint1 have hint2 : Integrable (fun u => lam ^ 2 * g u ^ 2) volume := hg2.const_mul (lam ^ 2) rw [MeasureTheory.integral_add hint_sub hint2, MeasureTheory.integral_sub hf2 hint1, MeasureTheory.integral_const_mul, MeasureTheory.integral_const_mul] at hnn exact hnn have hC : 0 ≤ C := MeasureTheory.integral_nonneg (fun _ => sq_nonneg _) rcases eq_or_lt_of_le hC with hC0 | hCpos · rw [← hC0, mul_zero] by_contra hlt push Not at hlt have hBne : B ≠ 0 := by intro hB0; rw [hB0, zero_pow two_ne_zero] at hlt; linarith have h := hquad ((A + 1) / (2 * B)) rw [← hC0, mul_zero, add_zero] at h have hcancel : 2 * ((A + 1) / (2 * B)) * B = A + 1 := by field_simp linarith · have h := hquad (B / C) have hval : A - 2 * (B / C) * B + (B / C) ^ 2 * C = (A * C - B ^ 2) / C := by field_simp [ne_of_gt hCpos]; ring rw [hval, div_nonneg_iff] at h rcases h with ⟨h1, _⟩ | ⟨_, h2⟩ · linarith · linarith lemma integral_mul_le_sqrt_mul_sqrt {f g : ℝ → ℝ} (hfg : Integrable (fun u => f u * g u) volume) (hf2 : Integrable (fun u => f u ^ 2) volume) (hg2 : Integrable (fun u => g u ^ 2) volume) : ∫ u, f u * g u ≤ Real.sqrt (∫ u, f u ^ 2) * Real.sqrt (∫ u, g u ^ 2) := by have hsq := sq_integral_mul_le_integral_sq_mul_integral_sq hfg hf2 hg2 have hA : 0 ≤ ∫ u, f u ^ 2 := MeasureTheory.integral_nonneg (fun _ => sq_nonneg _) rw [← Real.sqrt_mul hA] exact Real.le_sqrt_of_sq_le hsq /-! ### 2. Smooth Compactly Supported Test Space `TestFn` -/ /-- A complex-valued smooth, compactly supported test function on `ℝ` (`C_c^∞(ℝ, ℂ)`). -/ structure TestFn where toFun : ℝ → ℂ smooth : ContDiff ℝ (⊤ : ℕ∞) toFun compactSupport : HasCompactSupport toFun instance : CoeFun TestFn (fun _ => ℝ → ℂ) := ⟨TestFn.toFun⟩ @[ext] lemma TestFn.ext {f g : TestFn} (h : ∀ u, f u = g u) : f = g := by cases f; cases g; simp only [TestFn.mk.injEq]; ext u; exact h u lemma TestFn.continuous (φ : TestFn) : Continuous φ := φ.smooth.continuous lemma TestFn.differentiable (φ : TestFn) : Differentiable ℝ φ := φ.smooth.differentiable (by simp) lemma TestFn.contDiff_deriv (φ : TestFn) : ContDiff ℝ (⊤ : ℕ∞) (deriv φ) := (contDiff_infty_iff_deriv.mp φ.smooth).2 lemma TestFn.hasCompactSupport_deriv (φ : TestFn) : HasCompactSupport (deriv φ) := φ.compactSupport.deriv lemma TestFn.contDiff_deriv2 (φ : TestFn) : ContDiff ℝ (⊤ : ℕ∞) (deriv (deriv φ)) := (contDiff_infty_iff_deriv.mp φ.contDiff_deriv).2 lemma TestFn.hasCompactSupport_deriv2 (φ : TestFn) : HasCompactSupport (deriv (deriv φ)) := φ.hasCompactSupport_deriv.deriv lemma TestFn.integrable (φ : TestFn) : Integrable φ volume := by obtain ⟨a, b, _, hsupp⟩ := exists_Icc_support_of_hasCompactSupport φ.compactSupport exact integrable_of_continuous_of_vanishes_outside_Icc a b φ.continuous hsupp /-- `TestFn` forms a complex vector space under pointwise operations. -/ instance : Zero TestFn where zero := ⟨0, contDiff_const, HasCompactSupport.zero⟩ instance : Add TestFn where add f g := ⟨fun u => f u + g u, f.smooth.add g.smooth, f.compactSupport.add g.compactSupport⟩ instance : Neg TestFn where neg f := ⟨fun u => -f u, f.smooth.neg, f.compactSupport.neg⟩ instance : Sub TestFn where sub f g := ⟨fun u => f u - g u, f.smooth.sub g.smooth, f.compactSupport.sub g.compactSupport⟩ instance : SMul ℂ TestFn where smul c f := ⟨fun u => c * f u, contDiff_const.mul f.smooth, f.compactSupport.mul_left⟩ @[simp] lemma TestFn.zero_apply (u : ℝ) : (0 : TestFn) u = 0 := rfl @[simp] lemma TestFn.add_apply (f g : TestFn) (u : ℝ) : (f + g) u = f u + g u := rfl @[simp] lemma TestFn.neg_apply (f : TestFn) (u : ℝ) : (-f) u = -f u := rfl @[simp] lemma TestFn.sub_apply (f g : TestFn) (u : ℝ) : (f - g) u = f u - g u := rfl @[simp] lemma TestFn.smul_apply (c : ℂ) (f : TestFn) (u : ℝ) : (c • f) u = c * f u := rfl instance : AddCommGroup TestFn where add_assoc a b c := by ext u; simp [add_assoc] zero_add a := by ext u; simp add_zero a := by ext u; simp neg_add_cancel a := by ext u; simp add_comm a b := by ext u; simp [add_comm] nsmul := nsmulRec zsmul := zsmulRec instance : Module ℂ TestFn where one_smul a := by ext u; simp mul_smul c d a := by ext u; simp [mul_assoc] smul_zero c := by ext u; simp smul_add c a b := by ext u; simp [mul_add] add_smul c d a := by ext u; simp [add_mul] zero_smul a := by ext u; simp @[simp] lemma TestFn.finset_sum_apply {ι : Type*} (s : Finset ι) (f : ι → TestFn) (u : ℝ) : (∑ i ∈ s, f i) u = ∑ i ∈ s, f i u := by classical induction s using Finset.induction_on with | empty => simp | insert a s ha ih => simp [Finset.sum_insert ha, ih] /-- Predicate asserting `φ` vanishes outside the closed interval `[a, b]`. -/ def SupportedIn (φ : TestFn) (a b : ℝ) : Prop := ∀ u, u ∉ Icc a b → φ u = 0 lemma SupportedIn.smul {φ : TestFn} {a b : ℝ} (h : SupportedIn φ a b) (c : ℂ) : SupportedIn (c • φ) a b := fun u hu => by simp [h u hu] lemma SupportedIn.add {φ ψ : TestFn} {a b : ℝ} (h1 : SupportedIn φ a b) (h2 : SupportedIn ψ a b) : SupportedIn (φ + ψ) a b := fun u hu => by simp [h1 u hu, h2 u hu] lemma SupportedIn.mono {φ : TestFn} {a b a' b' : ℝ} (h : SupportedIn φ a b) (ha : a' ≤ a) (hb : b ≤ b') : SupportedIn φ a' b' := fun u hu => h u (fun hmem => hu ⟨le_trans ha hmem.1, le_trans hmem.2 hb⟩) /-! ### 3. `L^2` Norm, `L^1` Norm, and Coordinate Isometry (F04 §2) -/ /-- Squared `L^2` norm `‖φ‖_2^2 = ∫ |φ(u)|^2 du`. -/ noncomputable def normSq (φ : TestFn) : ℝ := ∫ u, ‖φ u‖ ^ 2 /-- `L^2` norm `‖φ‖_2 = √(∫ |φ(u)|^2 du)`. -/ noncomputable def l2Norm (φ : TestFn) : ℝ := Real.sqrt (normSq φ) /-- `L^1` norm `‖φ‖_1 = ∫ |φ(u)| du`. -/ noncomputable def l1Norm (φ : TestFn) : ℝ := ∫ u, ‖φ u‖ lemma TestFn.integrable_norm_sq (φ : TestFn) : Integrable (fun u => ‖φ u‖ ^ 2) volume := by obtain ⟨a, b, _, hsupp⟩ := exists_Icc_support_of_hasCompactSupport φ.compactSupport exact integrable_of_continuous_of_vanishes_outside_Icc a b (φ.continuous.norm.pow 2) (fun u hu => by simp [hsupp u hu]) lemma TestFn.integrable_norm (φ : TestFn) : Integrable (fun u => ‖φ u‖) volume := by obtain ⟨a, b, _, hsupp⟩ := exists_Icc_support_of_hasCompactSupport φ.compactSupport exact integrable_of_continuous_of_vanishes_outside_Icc a b φ.continuous.norm (fun u hu => by simp [hsupp u hu]) lemma normSq_nonneg (φ : TestFn) : 0 ≤ normSq φ := MeasureTheory.integral_nonneg (fun _ => sq_nonneg _) lemma l2Norm_nonneg (φ : TestFn) : 0 ≤ l2Norm φ := Real.sqrt_nonneg _ lemma sq_l2Norm (φ : TestFn) : (l2Norm φ) ^ 2 = normSq φ := Real.sq_sqrt (normSq_nonneg φ) lemma normSq_smul (c : ℂ) (φ : TestFn) : normSq (c • φ) = ‖c‖ ^ 2 * normSq φ := by unfold normSq have hfun : (fun u => ‖(c • φ) u‖ ^ 2) = fun u => ‖c‖ ^ 2 * ‖φ u‖ ^ 2 := by ext u; simp [mul_pow] rw [hfun, MeasureTheory.integral_const_mul] lemma l2Norm_smul (c : ℂ) (φ : TestFn) : l2Norm (c • φ) = ‖c‖ * l2Norm φ := by unfold l2Norm rw [normSq_smul, Real.sqrt_mul (sq_nonneg _), Real.sqrt_sq (norm_nonneg c)] lemma normSq_pos_of_ne_zero {φ : TestFn} (hne : φ ≠ 0) : 0 < normSq φ := by have hex : ∃ u₀, φ u₀ ≠ 0 := by by_contra hall; push Not at hall; exact hne (TestFn.ext hall) obtain ⟨u₀, hu₀⟩ := hex have hpos : 0 < ‖φ u₀‖ ^ 2 := sq_pos_of_pos (norm_pos_iff.mpr hu₀) have hcont : Continuous (fun u => ‖φ u‖ ^ 2) := φ.continuous.norm.pow 2 obtain ⟨δ, hδ, hball⟩ := Metric.continuousAt_iff.mp hcont.continuousAt (‖φ u₀‖ ^ 2 / 2) (by linarith) have hlow : ∀ u ∈ Icc (u₀ - δ / 2) (u₀ + δ / 2), ‖φ u₀‖ ^ 2 / 2 ≤ ‖φ u‖ ^ 2 := by intro u hu have hdist : dist u u₀ < δ := by rw [Real.dist_eq, abs_lt]; constructor <;> linarith [hu.1, hu.2] have hval := hball hdist rw [Real.dist_eq, abs_lt] at hval linarith [hval.1] have hsub : ∫ u in Icc (u₀ - δ / 2) (u₀ + δ / 2), (‖φ u₀‖ ^ 2 / 2) ≤ ∫ u in Icc (u₀ - δ / 2) (u₀ + δ / 2), ‖φ u‖ ^ 2 := MeasureTheory.setIntegral_mono_on (integrableOn_const (by simp)) φ.integrable_norm_sq.integrableOn measurableSet_Icc hlow have hset_le : ∫ u in Icc (u₀ - δ / 2) (u₀ + δ / 2), ‖φ u‖ ^ 2 ≤ normSq φ := MeasureTheory.setIntegral_le_integral φ.integrable_norm_sq (Filter.Eventually.of_forall fun _ => sq_nonneg _) have hconst_int : ∫ u in Icc (u₀ - δ / 2) (u₀ + δ / 2), (‖φ u₀‖ ^ 2 / 2) = δ * (‖φ u₀‖ ^ 2 / 2) := by rw [MeasureTheory.setIntegral_const, smul_eq_mul, Measure.real, Real.volume_Icc] have hdiff : u₀ + δ / 2 - (u₀ - δ / 2) = δ := by ring rw [hdiff, ENNReal.toReal_ofReal (le_of_lt hδ)] have hprod_pos : 0 < δ * (‖φ u₀‖ ^ 2 / 2) := by positivity linarith /-- Multiplicative-coordinate function `g(x) = x^{-1/2} φ(log x)` from Section 2 of F04. -/ noncomputable def toMultCoord (φ : TestFn) (x : ℝ) : ℂ := ((1 / Real.sqrt x : ℝ) : ℂ) * φ (Real.log x) /-- Exact `L^2` coordinate isometry `∫_0^∞ |g(x)|^2 dx = ∫_ℝ |φ(u)|^2 du = ‖φ‖_2^2` (Section 2). -/ theorem normSq_toMultCoord (φ : TestFn) : ∫ x in Ioi (0 : ℝ), ‖toMultCoord φ x‖ ^ 2 = normSq φ := by obtain ⟨A, B, hAB, hsupp⟩ := exists_Icc_support_of_hasCompactSupport φ.compactSupport have hexp_le : Real.exp A ≤ Real.exp B := Real.exp_le_exp.mpr hAB have hzero_out : ∀ x ∈ Ioi (0 : ℝ), x ∉ Icc (Real.exp A) (Real.exp B) → ‖toMultCoord φ x‖ ^ 2 = 0 := by intro x hx hnot have hlog_not : Real.log x ∉ Icc A B := by intro hmem have h1 : Real.exp A ≤ x := by rw [← Real.exp_log hx]; exact Real.exp_le_exp.mpr hmem.1 have h2 : x ≤ Real.exp B := by rw [← Real.exp_log hx]; exact Real.exp_le_exp.mpr hmem.2 exact hnot ⟨h1, h2⟩ simp [toMultCoord, hsupp (Real.log x) hlog_not] have hsub_Ioi : Icc (Real.exp A) (Real.exp B) ⊆ Ioi (0 : ℝ) := fun x hx => lt_of_lt_of_le (Real.exp_pos A) hx.1 have hset_eq' : ∫ x in Ioi (0 : ℝ), ‖toMultCoord φ x‖ ^ 2 = ∫ x in (Real.exp A)..(Real.exp B), ‖toMultCoord φ x‖ ^ 2 := by rw [intervalIntegral.integral_of_le hexp_le, MeasureTheory.setIntegral_congr_set Ioc_ae_eq_Icc] have h1 : ∫ x in Ioi (0 : ℝ), ‖toMultCoord φ x‖ ^ 2 = ∫ x in Ioi (0 : ℝ), (Icc (Real.exp A) (Real.exp B)).indicator (fun y => ‖toMultCoord φ y‖ ^ 2) x := by refine MeasureTheory.setIntegral_congr_fun measurableSet_Ioi (fun x hx => ?_) by_cases hmem : x ∈ Icc (Real.exp A) (Real.exp B) · rw [Set.indicator_of_mem hmem] · rw [Set.indicator_of_notMem hmem, hzero_out x hx hmem] rw [h1, MeasureTheory.setIntegral_indicator measurableSet_Icc, Set.inter_eq_right.mpr hsub_Ioi] rw [hset_eq'] let F : ℝ → ℝ := fun x => ∫ u in A..(Real.log x), ‖φ u‖ ^ 2 have hcont_normsq : Continuous (fun u => ‖φ u‖ ^ 2) := φ.continuous.norm.pow 2 have hderiv : ∀ x ∈ uIcc (Real.exp A) (Real.exp B), HasDerivAt F (‖toMultCoord φ x‖ ^ 2) x := by intro x hx rw [uIcc_of_le hexp_le] at hx have hxpos : 0 < x := lt_of_lt_of_le (Real.exp_pos A) hx.1 have hF1 : HasDerivAt (fun y => ∫ u in A..y, ‖φ u‖ ^ 2) (‖φ (Real.log x)‖ ^ 2) (Real.log x) := intervalIntegral.integral_hasDerivAt_right (hcont_normsq.intervalIntegrable A (Real.log x)) (hcont_normsq.stronglyMeasurableAtFilter volume (𝓝 (Real.log x))) hcont_normsq.continuousAt have hcomp := HasDerivAt.comp x hF1 (hasDerivAt_log_pos hxpos) have hval : ‖φ (Real.log x)‖ ^ 2 * x⁻¹ = ‖toMultCoord φ x‖ ^ 2 := by unfold toMultCoord rw [norm_mul, Complex.norm_real, Real.norm_of_nonneg (by positivity), mul_pow, one_div, inv_pow, Real.sq_sqrt (le_of_lt hxpos)] ring rw [hval] at hcomp exact hcomp have hint_g : IntervalIntegrable (fun x => ‖toMultCoord φ x‖ ^ 2) volume (Real.exp A) (Real.exp B) := by refine ContinuousOn.intervalIntegrable ?_ rw [uIcc_of_le hexp_le] intro x hx have hxpos : 0 < x := lt_of_lt_of_le (Real.exp_pos A) hx.1 have hlogc : ContinuousAt Real.log x := (hasDerivAt_log_pos hxpos).continuousAt have h1 : ContinuousAt (fun y => ‖toMultCoord φ y‖ ^ 2) x := by unfold toMultCoord refine (ContinuousAt.mul ?_ (φ.continuous.continuousAt.comp hlogc)).norm.pow 2 exact Complex.continuous_ofReal.continuousAt.comp (continuousAt_const.div (Real.continuous_sqrt.continuousAt) (ne_of_gt (Real.sqrt_pos.mpr hxpos))) exact h1.continuousWithinAt have hftc := intervalIntegral.integral_eq_sub_of_hasDerivAt hderiv hint_g rw [hftc] simp only [F, Real.log_exp, intervalIntegral.integral_same, sub_zero] exact (integral_eq_intervalIntegral_of_vanishes_outside_Icc hAB (fun u hu => by simp [hsupp u hu])).symm /-- `L^1 ≤ √L · L^2` bound for functions supported in `[a, b]` (Section 4 of F04). -/ lemma l1Norm_le_sqrt_mul_l2Norm {φ : TestFn} {a b : ℝ} (hab : a ≤ b) (hsupp : SupportedIn φ a b) : l1Norm φ ≤ Real.sqrt (b - a) * l2Norm φ := by let g : ℝ → ℝ := (Icc a b).indicator (fun _ => (1 : ℝ)) have hg_sq : (fun u => g u ^ 2) = g := by ext u; by_cases hu : u ∈ Icc a b <;> simp [g, hu] have hprod : (fun u => ‖φ u‖ * g u) = fun u => ‖φ u‖ := by ext u by_cases hu : u ∈ Icc a b · simp [g, hu] · simp [g, hu, hsupp u hu] have hg_int : Integrable g volume := (integrable_indicator_iff measurableSet_Icc).mpr (integrableOn_const (by simp)) have hg2_int : Integrable (fun u => g u ^ 2) volume := by rw [hg_sq]; exact hg_int have hfg_int : Integrable (fun u => ‖φ u‖ * g u) volume := by rw [hprod]; exact φ.integrable_norm have hcs := integral_mul_le_sqrt_mul_sqrt hfg_int φ.integrable_norm_sq hg2_int rw [hprod, hg_sq] at hcs have hg_val : ∫ u, g u = b - a := by rw [MeasureTheory.integral_indicator measurableSet_Icc, MeasureTheory.setIntegral_const, smul_eq_mul, mul_one, Measure.real, Real.volume_Icc, ENNReal.toReal_ofReal (by linarith)] rw [hg_val, mul_comm] at hcs exact hcs /-! ### 4. Balance Conditions (1) and Differential Operator `T = ∂² - 1/4` -/ /-- Weighted integral `ℓ^-(φ) = ∫ φ(u) e^{-u/2} du` (first balance condition in eq. (1)). -/ noncomputable def momentNeg (φ : TestFn) : ℂ := ∫ u, φ u * ((Real.exp (-(u / 2)) : ℝ) : ℂ) /-- Weighted integral `ℓ^+(φ) = ∫ φ(u) e^{u/2} du` (second balance condition in eq. (1)). -/ noncomputable def momentPos (φ : TestFn) : ℂ := ∫ u, φ u * ((Real.exp (u / 2) : ℝ) : ℂ) /-- Both balance conditions of eq. (1): `∫ φ(u) e^{-u/2} du = 0` and `∫ φ(u) e^{u/2} du = 0`. -/ def IsBalanced (φ : TestFn) : Prop := momentNeg φ = 0 ∧ momentPos φ = 0 lemma TestFn.integrable_mul_exp_neg_half (φ : TestFn) : Integrable (fun u => φ u * ((Real.exp (-(u / 2)) : ℝ) : ℂ)) volume := by obtain ⟨a, b, _, hsupp⟩ := exists_Icc_support_of_hasCompactSupport φ.compactSupport exact integrable_of_continuous_of_vanishes_outside_Icc a b (φ.continuous.mul (Complex.continuous_ofReal.comp (Real.continuous_exp.comp (continuous_id.div_const 2).neg))) (fun u hu => by simp [hsupp u hu]) lemma TestFn.integrable_mul_exp_pos_half (φ : TestFn) : Integrable (fun u => φ u * ((Real.exp (u / 2) : ℝ) : ℂ)) volume := by obtain ⟨a, b, _, hsupp⟩ := exists_Icc_support_of_hasCompactSupport φ.compactSupport exact integrable_of_continuous_of_vanishes_outside_Icc a b (φ.continuous.mul (Complex.continuous_ofReal.comp (Real.continuous_exp.comp (continuous_id.div_const 2)))) (fun u hu => by simp [hsupp u hu]) lemma momentNeg_smul (c : ℂ) (φ : TestFn) : momentNeg (c • φ) = c * momentNeg φ := by unfold momentNeg have h : (fun u => (c • φ) u * ((Real.exp (-(u / 2)) : ℝ) : ℂ)) = fun u => c * (φ u * ((Real.exp (-(u / 2)) : ℝ) : ℂ)) := by ext u; simp [mul_assoc] rw [h, MeasureTheory.integral_const_mul] lemma momentPos_smul (c : ℂ) (φ : TestFn) : momentPos (c • φ) = c * momentPos φ := by unfold momentPos have h : (fun u => (c • φ) u * ((Real.exp (u / 2) : ℝ) : ℂ)) = fun u => c * (φ u * ((Real.exp (u / 2) : ℝ) : ℂ)) := by ext u; simp [mul_assoc] rw [h, MeasureTheory.integral_const_mul] lemma momentNeg_add (f g : TestFn) : momentNeg (f + g) = momentNeg f + momentNeg g := by unfold momentNeg have h : (fun u => (f + g) u * ((Real.exp (-(u / 2)) : ℝ) : ℂ)) = fun u => f u * ((Real.exp (-(u / 2)) : ℝ) : ℂ) + g u * ((Real.exp (-(u / 2)) : ℝ) : ℂ) := by ext u; simp [add_mul] rw [h, MeasureTheory.integral_add f.integrable_mul_exp_neg_half g.integrable_mul_exp_neg_half] lemma momentPos_add (f g : TestFn) : momentPos (f + g) = momentPos f + momentPos g := by unfold momentPos have h : (fun u => (f + g) u * ((Real.exp (u / 2) : ℝ) : ℂ)) = fun u => f u * ((Real.exp (u / 2) : ℝ) : ℂ) + g u * ((Real.exp (u / 2) : ℝ) : ℂ) := by ext u; simp [add_mul] rw [h, MeasureTheory.integral_add f.integrable_mul_exp_pos_half g.integrable_mul_exp_pos_half] lemma IsBalanced.smul {φ : TestFn} (h : IsBalanced φ) (c : ℂ) : IsBalanced (c • φ) := ⟨by rw [momentNeg_smul, h.1, mul_zero], by rw [momentPos_smul, h.2, mul_zero]⟩ lemma IsBalanced.add {f g : TestFn} (hf : IsBalanced f) (hg : IsBalanced g) : IsBalanced (f + g) := ⟨by rw [momentNeg_add, hf.1, hg.1, add_zero], by rw [momentPos_add, hf.2, hg.2, add_zero]⟩ /-- The second-order differential operator `T ψ = ψ'' - (1/4) ψ` from Sections 2 and 7. -/ noncomputable def diffOp (ψ : TestFn) : TestFn where toFun u := deriv (deriv ψ) u - ((1 / 4 : ℝ) : ℂ) * ψ u smooth := ψ.contDiff_deriv2.sub (contDiff_const.mul ψ.smooth) compactSupport := ψ.hasCompactSupport_deriv2.sub ψ.compactSupport.mul_left lemma hasDerivAt_ofReal_exp_mul (α : ℝ) (u : ℝ) : HasDerivAt (fun x : ℝ => ((Real.exp (α * x) : ℝ) : ℂ)) (((α * Real.exp (α * u) : ℝ) : ℂ)) u := by have h1 : HasDerivAt (fun x : ℝ => Real.exp (α * x)) (Real.exp (α * u) * α) u := by have hlin : HasDerivAt (fun x : ℝ => α * x) α u := by simpa using (hasDerivAt_id' u).const_mul α exact HasDerivAt.comp u (Real.hasDerivAt_exp (α * u)) hlin have h2 : HasDerivAt (fun x : ℝ => ((Real.exp (α * x) : ℝ) : ℂ)) ((Real.exp (α * u) * α : ℝ) : ℂ) u := h1.ofReal_comp have hval : ((Real.exp (α * u) * α : ℝ) : ℂ) = ((α * Real.exp (α * u) : ℝ) : ℂ) := by congr 1; ring rwa [hval] at h2 /-- Integration by parts shows `T ψ = ψ'' - (1/4) ψ` annihilates `e^{α u}` whenever `α^2 = 1/4`. -/ lemma integral_diffOp_mul_exp (ψ : TestFn) {α : ℝ} (hα : α ^ 2 = 1 / 4) : ∫ u, diffOp ψ u * ((Real.exp (α * u) : ℝ) : ℂ) = 0 := by obtain ⟨a, b, hab, hsupp⟩ := exists_Icc_support_of_hasCompactSupport ψ.compactSupport set A := a - 1 set B := b + 1 have hAB : A ≤ B := by linarith have hderiv_van : ∀ u, u ∉ Icc a b → deriv ψ u = 0 := by intro u hu have hopen : IsOpen ((Icc a b)ᶜ) := isClosed_Icc.isOpen_compl have hev : ψ.toFun =ᶠ[𝓝 u] (fun _ => (0 : ℂ)) := by filter_upwards [hopen.mem_nhds hu] with x hx exact hsupp x hx rw [hev.deriv_eq, deriv_const] have hderiv2_van : ∀ u, u ∉ Icc a b → deriv (deriv ψ) u = 0 := by intro u hu have hopen : IsOpen ((Icc a b)ᶜ) := isClosed_Icc.isOpen_compl have hev : deriv ψ.toFun =ᶠ[𝓝 u] (fun _ => (0 : ℂ)) := by filter_upwards [hopen.mem_nhds hu] with x hx exact hderiv_van x hx rw [hev.deriv_eq, deriv_const] have hsupp_tot : ∀ u, u ∉ Icc A B → diffOp ψ u * ((Real.exp (α * u) : ℝ) : ℂ) = 0 := by intro u hu have hnot : u ∉ Icc a b := fun hm => hu ⟨by linarith [hm.1], by linarith [hm.2]⟩ simp [diffOp, hsupp u hnot, hderiv2_van u hnot] rw [integral_eq_intervalIntegral_of_vanishes_outside_Icc hAB hsupp_tot] have hψ_A : ψ A = 0 := hsupp A (fun hm => by linarith [hm.1]) have hψ_B : ψ B = 0 := hsupp B (fun hm => by linarith [hm.2]) have hdψ_A : deriv ψ A = 0 := hderiv_van A (fun hm => by linarith [hm.1]) have hdψ_B : deriv ψ B = 0 := hderiv_van B (fun hm => by linarith [hm.2]) have hu1 : ∀ x ∈ uIcc A B, HasDerivAt (fun t => ((Real.exp (α * t) : ℝ) : ℂ)) (((α * Real.exp (α * x) : ℝ) : ℂ)) x := fun x _ => hasDerivAt_ofReal_exp_mul α x have hv1 : ∀ x ∈ uIcc A B, HasDerivAt (deriv ψ) (deriv (deriv ψ) x) x := fun x _ => (ψ.contDiff_deriv.differentiable (by simp) x).hasDerivAt have hu1' : IntervalIntegrable (fun x => ((α * Real.exp (α * x) : ℝ) : ℂ)) volume A B := (Complex.continuous_ofReal.comp (continuous_const.mul (Real.continuous_exp.comp (continuous_const.mul continuous_id)))).intervalIntegrable A B have hv1' : IntervalIntegrable (deriv (deriv ψ)) volume A B := ψ.contDiff_deriv2.continuous.intervalIntegrable A B have hibp1 := intervalIntegral_mul_deriv_eq_deriv_mul_of_hasDerivAt hu1 hv1 hu1' hv1' rw [hdψ_A, hdψ_B, mul_zero, mul_zero, sub_self, zero_sub] at hibp1 have hv2 : ∀ x ∈ uIcc A B, HasDerivAt ψ (deriv ψ x) x := fun x _ => (ψ.differentiable x).hasDerivAt have hv2' : IntervalIntegrable (deriv ψ) volume A B := ψ.contDiff_deriv.continuous.intervalIntegrable A B have hibp2 := intervalIntegral_mul_deriv_eq_deriv_mul_of_hasDerivAt hu1 hv2 hu1' hv2' rw [hψ_A, hψ_B, mul_zero, mul_zero, sub_self, zero_sub] at hibp2 have hrew : (fun u => diffOp ψ u * ((Real.exp (α * u) : ℝ) : ℂ)) = fun u => ((Real.exp (α * u) : ℝ) : ℂ) * deriv (deriv ψ) u - ((1 / 4 : ℝ) : ℂ) * (((Real.exp (α * u) : ℝ) : ℂ) * ψ u) := by ext u; simp only [diffOp]; ring rw [hrew] have hint_a : IntervalIntegrable (fun u => ((Real.exp (α * u) : ℝ) : ℂ) * deriv (deriv ψ) u) volume A B := ((Complex.continuous_ofReal.comp (Real.continuous_exp.comp (continuous_const.mul continuous_id))).mul ψ.contDiff_deriv2.continuous).intervalIntegrable A B have hint_b : IntervalIntegrable (fun u => ((1 / 4 : ℝ) : ℂ) * (((Real.exp (α * u) : ℝ) : ℂ) * ψ u)) volume A B := (continuous_const.mul ((Complex.continuous_ofReal.comp (Real.continuous_exp.comp (continuous_const.mul continuous_id))).mul ψ.continuous)).intervalIntegrable A B rw [intervalIntegral.integral_sub hint_a hint_b, hibp1, intervalIntegral.integral_const_mul] have hfactor1 : (fun x => ((α * Real.exp (α * x) : ℝ) : ℂ) * deriv ψ x) = fun x => (α : ℂ) * (((Real.exp (α * x) : ℝ) : ℂ) * deriv ψ x) := by ext x; push_cast; ring have hfactor2 : (fun x => ((α * Real.exp (α * x) : ℝ) : ℂ) * ψ x) = fun x => (α : ℂ) * (((Real.exp (α * x) : ℝ) : ℂ) * ψ x) := by ext x; push_cast; ring rw [hfactor1, intervalIntegral.integral_const_mul, hibp2, hfactor2, intervalIntegral.integral_const_mul] have hαC : (α : ℂ) ^ 2 = ((1 / 4 : ℝ) : ℂ) := by exact_mod_cast hα linear_combination (∫ x in A..B, ((Real.exp (α * x) : ℝ) : ℂ) * ψ x) * hαC /-- Every `φ = ψ'' - (1/4) ψ` satisfies both balance conditions (1) (Section 2 of F04). -/ theorem isBalanced_diffOp (ψ : TestFn) : IsBalanced (diffOp ψ) := by constructor · unfold momentNeg have h := integral_diffOp_mul_exp ψ (α := -(1 / 2)) (by norm_num) convert h using 3 with u congr 2; ring · unfold momentPos have h := integral_diffOp_mul_exp ψ (α := 1 / 2) (by norm_num) convert h using 3 with u congr 2; ring /-! ### 5. Cross-Correlation `C_{a,b}(t)` and Auto-Correlation `C_φ(t)` (F04 §2) -/ /-- Cross-correlation `C_{a,b}(t) = ∫ a(v + t) conj(b(v)) dv`. -/ noncomputable def corr (a b : TestFn) (t : ℝ) : ℂ := ∫ v, a (v + t) * starRingEnd ℂ (b v) /-- Auto-correlation `C_φ(t) = C_{φ,φ}(t)`. -/ noncomputable def autoCorr (φ : TestFn) (t : ℝ) : ℂ := corr φ φ t lemma integrable_corr_integrand (a b : TestFn) (t : ℝ) : Integrable (fun v => a (v + t) * starRingEnd ℂ (b v)) volume := by obtain ⟨a₂, b₂, _, hsupp⟩ := exists_Icc_support_of_hasCompactSupport b.compactSupport exact integrable_of_continuous_of_vanishes_outside_Icc a₂ b₂ ((a.continuous.comp (continuous_id.add continuous_const)).mul (Complex.continuous_conj.comp b.continuous)) (fun v hv => by simp [hsupp v hv]) lemma hasCompactSupport_corr_integrand (a b : TestFn) (t : ℝ) : HasCompactSupport (fun v => a (v + t) * starRingEnd ℂ (b v)) := by have hb : HasCompactSupport (fun v => starRingEnd ℂ (b v)) := b.compactSupport.comp_left (map_zero _) exact hb.mul_left lemma autoCorr_zero (φ : TestFn) : autoCorr φ 0 = (normSq φ : ℂ) := by unfold autoCorr corr normSq have hfun : (fun v => φ (v + 0) * starRingEnd ℂ (φ v)) = fun v => ((‖φ v‖ ^ 2 : ℝ) : ℂ) := by ext v rw [add_zero, Complex.mul_conj, Complex.normSq_eq_norm_sq] rw [hfun] exact integral_ofReal lemma corr_symm (a b : TestFn) (t : ℝ) : corr a b t = starRingEnd ℂ (corr b a (-t)) := by unfold corr change _ = Complex.conjCLE (∫ v, b (v + -t) * starRingEnd ℂ (a v)) rw [← Complex.conjCLE.integral_comp_comm] have hfun : (fun v => Complex.conjCLE (b (v + -t) * starRingEnd ℂ (a v))) = fun v => a v * starRingEnd ℂ (b (v - t)) := by ext v change starRingEnd ℂ (b (v + -t) * starRingEnd ℂ (a v)) = a v * starRingEnd ℂ (b (v - t)) rw [map_mul, RingHomCompTriple.comp_apply, RingHom.id_apply, mul_comm, sub_eq_add_neg] rw [hfun] have hcs : HasCompactSupport (fun v => a v * starRingEnd ℂ (b (v - t))) := a.compactSupport.mul_right rw [← integral_add_right_compact hcs t] congr 1; ext v; simp [add_sub_cancel_right] lemma autoCorr_neg (φ : TestFn) (t : ℝ) : autoCorr φ (-t) = starRingEnd ℂ (autoCorr φ t) := by have h := corr_symm φ φ (-t) rwa [neg_neg] at h lemma corr_add_left (a₁ a₂ b : TestFn) (t : ℝ) : corr (a₁ + a₂) b t = corr a₁ b t + corr a₂ b t := by unfold corr have h : (fun v => (a₁ + a₂) (v + t) * starRingEnd ℂ (b v)) = fun v => a₁ (v + t) * starRingEnd ℂ (b v) + a₂ (v + t) * starRingEnd ℂ (b v) := by ext v; simp [add_mul] rw [h, MeasureTheory.integral_add (integrable_corr_integrand a₁ b t) (integrable_corr_integrand a₂ b t)] lemma corr_add_right (a b₁ b₂ : TestFn) (t : ℝ) : corr a (b₁ + b₂) t = corr a b₁ t + corr a b₂ t := by unfold corr have h : (fun v => a (v + t) * starRingEnd ℂ ((b₁ + b₂) v)) = fun v => a (v + t) * starRingEnd ℂ (b₁ v) + a (v + t) * starRingEnd ℂ (b₂ v) := by ext v; simp [map_add, mul_add] rw [h, MeasureTheory.integral_add (integrable_corr_integrand a b₁ t) (integrable_corr_integrand a b₂ t)] lemma corr_smul_left (c : ℂ) (a b : TestFn) (t : ℝ) : corr (c • a) b t = c * corr a b t := by unfold corr have h : (fun v => (c • a) (v + t) * starRingEnd ℂ (b v)) = fun v => c * (a (v + t) * starRingEnd ℂ (b v)) := by ext v; simp [mul_assoc] rw [h, MeasureTheory.integral_const_mul] lemma corr_smul_right (c : ℂ) (a b : TestFn) (t : ℝ) : corr a (c • b) t = starRingEnd ℂ c * corr a b t := by unfold corr have h : (fun v => a (v + t) * starRingEnd ℂ ((c • b) v)) = fun v => starRingEnd ℂ c * (a (v + t) * starRingEnd ℂ (b v)) := by ext v; simp [map_mul]; ring rw [h, MeasureTheory.integral_const_mul] /-- Cauchy–Schwarz bound `|C_{a,b}(t)| ≤ ‖a‖_2 ‖b‖_2` for every shift `t` (Sections 3 & 4). -/ lemma norm_corr_le (a b : TestFn) (t : ℝ) : ‖corr a b t‖ ≤ l2Norm a * l2Norm b := by have h1 : ‖corr a b t‖ ≤ ∫ v, ‖a (v + t)‖ * ‖b v‖ := by calc ‖corr a b t‖ ≤ ∫ v, ‖a (v + t) * starRingEnd ℂ (b v)‖ := MeasureTheory.norm_integral_le_integral_norm _ _ = ∫ v, ‖a (v + t)‖ * ‖b v‖ := by congr 1; ext v; rw [norm_mul, Complex.norm_conj] have hf_int : Integrable (fun v => ‖a (v + t)‖ ^ 2) volume := by obtain ⟨a₁, b₁, _, hsupp⟩ := exists_Icc_support_of_hasCompactSupport a.compactSupport exact integrable_of_continuous_of_vanishes_outside_Icc (a₁ - t) (b₁ - t) ((a.continuous.comp (continuous_id.add continuous_const)).norm.pow 2) (fun v hv => by have hnot : v + t ∉ Icc a₁ b₁ := fun hm => hv ⟨by linarith [hm.1], by linarith [hm.2]⟩ simp [hsupp (v + t) hnot]) have hfg_int : Integrable (fun v => ‖a (v + t)‖ * ‖b v‖) volume := by have hnorm := (integrable_corr_integrand a b t).norm have hfun : (fun v => ‖a (v + t) * starRingEnd ℂ (b v)‖) = fun v => ‖a (v + t)‖ * ‖b v‖ := by ext v; rw [norm_mul, Complex.norm_conj] rwa [hfun] at hnorm have hcs := integral_mul_le_sqrt_mul_sqrt hfg_int hf_int b.integrable_norm_sq have hshift : ∫ v, ‖a (v + t)‖ ^ 2 = ∫ v, ‖a v‖ ^ 2 := by have hcs_a : HasCompactSupport (fun v => ‖a v‖ ^ 2) := a.compactSupport.comp_left (g := fun z : ℂ => ‖z‖ ^ 2) (by rw [norm_zero, zero_pow two_ne_zero]) exact integral_add_right_compact (f := fun v => ‖a v‖ ^ 2) hcs_a t have hcs' : ∫ v, ‖a (v + t)‖ * ‖b v‖ ≤ l2Norm a * l2Norm b := by unfold l2Norm normSq rw [← hshift] exact hcs exact le_trans h1 hcs' lemma norm_autoCorr_le (φ : TestFn) (t : ℝ) : ‖autoCorr φ t‖ ≤ normSq φ := by have h := norm_corr_le φ φ t rwa [← sq, sq_l2Norm] at h lemma re_autoCorr_le (φ : TestFn) (t : ℝ) : (autoCorr φ t).re ≤ normSq φ := le_trans (Complex.re_le_norm _) (norm_autoCorr_le φ t) /-- Support vanishing of `C_{a,b}(t)` at and beyond the left boundary `t ≤ a₁ - b₂`. -/ lemma corr_eq_zero_of_le {a b : TestFn} {a₁ b₁ a₂ b₂ t : ℝ} (ha : SupportedIn a a₁ b₁) (hb : SupportedIn b a₂ b₂) (ht : t ≤ a₁ - b₂) : corr a b t = 0 := by unfold corr have hae : (fun v => a (v + t) * starRingEnd ℂ (b v)) =ᵐ[volume] (fun _ => (0 : ℂ)) := by have hcompl : ({b₂}ᶜ : Set ℝ) ∈ ae volume := by rw [mem_ae_iff, compl_compl] exact measure_singleton b₂ filter_upwards [hcompl] with v hv rcases lt_or_gt_of_ne (Set.mem_compl_singleton_iff.mp hv) with hlt | hgt · have ha0 : a (v + t) = 0 := ha (v + t) (fun hm => by linarith [hm.1]) simp [ha0] · have hb0 : b v = 0 := hb v (fun hm => by linarith [hm.2]) simp [hb0] rw [MeasureTheory.integral_congr_ae hae, MeasureTheory.integral_zero] /-- Support vanishing of `C_{a,b}(t)` at and beyond the right boundary `b₁ - a₂ ≤ t`. -/ lemma corr_eq_zero_of_ge {a b : TestFn} {a₁ b₁ a₂ b₂ t : ℝ} (ha : SupportedIn a a₁ b₁) (hb : SupportedIn b a₂ b₂) (ht : b₁ - a₂ ≤ t) : corr a b t = 0 := by unfold corr have hae : (fun v => a (v + t) * starRingEnd ℂ (b v)) =ᵐ[volume] (fun _ => (0 : ℂ)) := by have hcompl : ({a₂}ᶜ : Set ℝ) ∈ ae volume := by rw [mem_ae_iff, compl_compl] exact measure_singleton a₂ filter_upwards [hcompl] with v hv rcases lt_or_gt_of_ne (Set.mem_compl_singleton_iff.mp hv) with hlt | hgt · have hb0 : b v = 0 := hb v (fun hm => by linarith [hm.1]) simp [hb0] · have ha0 : a (v + t) = 0 := ha (v + t) (fun hm => by linarith [hm.2]) simp [ha0] rw [MeasureTheory.integral_congr_ae hae, MeasureTheory.integral_zero] lemma autoCorr_eq_zero_of_ge {φ : TestFn} {a b t : ℝ} (hφ : SupportedIn φ a b) (ht : b - a ≤ t) : autoCorr φ t = 0 := corr_eq_zero_of_ge hφ hφ ht lemma autoCorr_eq_zero_of_le {φ : TestFn} {a b t : ℝ} (hφ : SupportedIn φ a b) (ht : t ≤ -(b - a)) : autoCorr φ t = 0 := corr_eq_zero_of_le hφ hφ (by linarith) lemma continuous_corr (a b : TestFn) : Continuous (corr a b) := by obtain ⟨a₂, b₂, hab₂, hsupp_b⟩ := exists_Icc_support_of_hasCompactSupport b.compactSupport have heq : corr a b = fun t => ∫ v in a₂..b₂, a (v + t) * starRingEnd ℂ (b v) := by ext t exact integral_eq_intervalIntegral_of_vanishes_outside_Icc hab₂ (fun v hv => by simp [hsupp_b v hv]) rw [heq] rw [Metric.continuous_iff] intro t ε hε obtain ⟨v₀, _, hv₀⟩ := isCompact_Icc.exists_isMaxOn (nonempty_Icc.mpr hab₂) b.continuous.norm.continuousOn set M_b : ℝ := ‖b v₀‖ + 1 have hMb_pos : 0 < M_b := by positivity have hMb_le : ∀ v ∈ Icc a₂ b₂, ‖b v‖ ≤ M_b := by intro v hv have hle : ‖b v‖ ≤ ‖b v₀‖ := hv₀ hv linarith have hlen : 0 < b₂ - a₂ + 1 := by linarith have huc : UniformContinuousOn a (Icc (a₂ + t - 1) (b₂ + t + 1)) := isCompact_Icc.uniformContinuousOn_of_continuous a.continuous.continuousOn obtain ⟨δ, hδ, hclose⟩ := Metric.uniformContinuousOn_iff.mp huc (ε / ((b₂ - a₂ + 1) * M_b)) (div_pos hε (mul_pos hlen hMb_pos)) refine ⟨min δ 1, lt_min hδ zero_lt_one, fun t' ht' => ?_⟩ have ht'_δ : dist t' t < δ := lt_of_lt_of_le ht' (min_le_left _ _) have ht'_1 : dist t' t < 1 := lt_of_lt_of_le ht' (min_le_right _ _) have hint_t' : IntervalIntegrable (fun v => a (v + t') * starRingEnd ℂ (b v)) volume a₂ b₂ := ((a.continuous.comp (continuous_id.add continuous_const)).mul (Complex.continuous_conj.comp b.continuous)).intervalIntegrable a₂ b₂ have hint_t : IntervalIntegrable (fun v => a (v + t) * starRingEnd ℂ (b v)) volume a₂ b₂ := ((a.continuous.comp (continuous_id.add continuous_const)).mul (Complex.continuous_conj.comp b.continuous)).intervalIntegrable a₂ b₂ rw [dist_eq_norm, ← intervalIntegral.integral_sub hint_t' hint_t] have hbound : ∀ v ∈ uIoc a₂ b₂, ‖a (v + t') * starRingEnd ℂ (b v) - a (v + t) * starRingEnd ℂ (b v)‖ ≤ (ε / ((b₂ - a₂ + 1) * M_b)) * M_b := by intro v hv rw [uIoc_of_le hab₂] at hv have hmem : v ∈ Icc a₂ b₂ := ⟨le_of_lt hv.1, hv.2⟩ rw [← sub_mul, norm_mul, Complex.norm_conj] have hdist_vt : dist (v + t') (v + t) < δ := by simpa [Real.dist_eq] using ht'_δ have hmem_t' : v + t' ∈ Icc (a₂ + t - 1) (b₂ + t + 1) := by rw [Real.dist_eq, abs_lt] at ht'_1 exact ⟨by linarith [hmem.1, ht'_1.1], by linarith [hmem.2, ht'_1.2]⟩ have hmem_t : v + t ∈ Icc (a₂ + t - 1) (b₂ + t + 1) := ⟨by linarith [hmem.1], by linarith [hmem.2]⟩ have ha_close : ‖a (v + t') - a (v + t)‖ ≤ ε / ((b₂ - a₂ + 1) * M_b) := by rw [← dist_eq_norm]; exact le_of_lt (hclose _ hmem_t' _ hmem_t hdist_vt) exact mul_le_mul ha_close (hMb_le v hmem) (norm_nonneg _) (le_of_lt (div_pos hε (mul_pos hlen hMb_pos))) have hint_le := intervalIntegral.norm_integral_le_of_norm_le_const hbound have hcancel : (ε / ((b₂ - a₂ + 1) * M_b)) * M_b * |b₂ - a₂| < ε := by rw [abs_of_nonneg (by linarith)] have hMb_ne : M_b ≠ 0 := ne_of_gt hMb_pos have hlen_ne : b₂ - a₂ + 1 ≠ 0 := ne_of_gt hlen have hsimp : ε / ((b₂ - a₂ + 1) * M_b) * M_b * (b₂ - a₂) = ε * ((b₂ - a₂) / (b₂ - a₂ + 1)) := by field_simp rw [hsimp] have hfrac : (b₂ - a₂) / (b₂ - a₂ + 1) < 1 := (div_lt_one hlen).mpr (by linarith) nlinarith exact lt_of_le_of_lt hint_le hcancel /-! ### 6. Quadratic Cancellation at `t = 0` and Full Integrability of the Weil Integral -/ /-- Exact symmetric second-difference bound `‖a(v+t) + a(v-t) - 2 a(v)‖ ≤ M₂ · t^2` for every `a : TestFn`, `v : ℝ`, and `t ≥ 0`. -/ lemma norm_second_diff_le (a : TestFn) : ∃ M₂ ≥ 0, ∀ v t : ℝ, 0 ≤ t → ‖a (v + t) + a (v - t) - 2 * a v‖ ≤ M₂ * t ^ 2 := by obtain ⟨A, B, hAB, hsupp⟩ := exists_Icc_support_of_hasCompactSupport a.hasCompactSupport_deriv2 obtain ⟨u₀, _, hu₀⟩ := isCompact_Icc.exists_isMaxOn (nonempty_Icc.mpr hAB) a.contDiff_deriv2.continuous.norm.continuousOn refine ⟨‖deriv (deriv a) u₀‖, norm_nonneg _, fun v t ht => ?_⟩ have hM : ∀ x : ℝ, ‖deriv (deriv a) x‖ ≤ ‖deriv (deriv a) u₀‖ := by intro x by_cases hx : x ∈ Icc A B · exact hu₀ hx · rw [hsupp x hx, norm_zero]; exact norm_nonneg _ have h1 : ∫ s in (0 : ℝ)..t, deriv a (v + s) = a (v + t) - a v := by have hd : ∀ s ∈ uIcc (0 : ℝ) t, HasDerivAt (fun r => a (v + r)) (deriv a (v + s)) s := by intro s _ have hlin : HasDerivAt (fun r : ℝ => v + r) 1 s := by simpa using (hasDerivAt_id' s).const_add v have hcomp := (a.differentiable (v + s)).hasDerivAt.scomp s hlin rw [one_smul] at hcomp exact hcomp have hint : IntervalIntegrable (fun s => deriv a (v + s)) volume 0 t := (a.contDiff_deriv.continuous.comp (continuous_const.add continuous_id)).intervalIntegrable 0 t simpa using intervalIntegral.integral_eq_sub_of_hasDerivAt hd hint have h2 : ∫ s in (0 : ℝ)..t, deriv a (v - s) = a v - a (v - t) := by have hd : ∀ s ∈ uIcc (0 : ℝ) t, HasDerivAt (fun r => -a (v - r)) (deriv a (v - s)) s := by intro s _ have hlin : HasDerivAt (fun r : ℝ => v - r) (-1) s := by simpa using (hasDerivAt_id' s).const_sub v have hcomp := ((a.differentiable (v - s)).hasDerivAt.scomp s hlin).neg rw [neg_one_smul, neg_neg] at hcomp exact hcomp have hint : IntervalIntegrable (fun s => deriv a (v - s)) volume 0 t := (a.contDiff_deriv.continuous.comp (continuous_const.sub continuous_id)).intervalIntegrable 0 t have hftc := intervalIntegral.integral_eq_sub_of_hasDerivAt hd hint simp only [sub_zero, neg_sub_neg] at hftc exact hftc have hdiff : a (v + t) + a (v - t) - 2 * a v = ∫ s in (0 : ℝ)..t, (deriv a (v + s) - deriv a (v - s)) := by have hint1 : IntervalIntegrable (fun s => deriv a (v + s)) volume 0 t := (a.contDiff_deriv.continuous.comp (continuous_const.add continuous_id)).intervalIntegrable 0 t have hint2 : IntervalIntegrable (fun s => deriv a (v - s)) volume 0 t := (a.contDiff_deriv.continuous.comp (continuous_const.sub continuous_id)).intervalIntegrable 0 t rw [intervalIntegral.integral_sub hint1 hint2, h1, h2] ring rw [hdiff] have hinner : ∀ s ∈ Icc (0 : ℝ) t, ‖deriv a (v + s) - deriv a (v - s)‖ ≤ 2 * ‖deriv (deriv a) u₀‖ * s := by intro s hs have hd2 : ∀ r ∈ uIcc (-s) s, HasDerivAt (fun y => deriv a (v + y)) (deriv (deriv a) (v + r)) r := by intro r _ have hlin : HasDerivAt (fun y : ℝ => v + y) 1 r := by simpa using (hasDerivAt_id' r).const_add v have hcomp := (a.contDiff_deriv.differentiable (by simp) (v + r)).hasDerivAt.scomp r hlin rw [one_smul] at hcomp exact hcomp have hint2 : IntervalIntegrable (fun r => deriv (deriv a) (v + r)) volume (-s) s := (a.contDiff_deriv2.continuous.comp (continuous_const.add continuous_id)).intervalIntegrable (-s) s have hftc2 := intervalIntegral.integral_eq_sub_of_hasDerivAt hd2 hint2 have hsub : v + -s = v - s := by ring rw [hsub] at hftc2 rw [← hftc2] have hbd := intervalIntegral.norm_integral_le_of_norm_le_const (a := -s) (b := s) (C := ‖deriv (deriv a) u₀‖) (fun r _ => hM (v + r)) have habs : |s - -s| = 2 * s := by have : s - -s = 2 * s := by ring rw [this, abs_of_nonneg (by linarith [hs.1])] rw [habs] at hbd linarith have hnorm_le : ‖∫ s in (0 : ℝ)..t, (deriv a (v + s) - deriv a (v - s))‖ ≤ ∫ s in (0 : ℝ)..t, (2 * ‖deriv (deriv a) u₀‖ * s) := by have h1 := intervalIntegral.norm_integral_le_integral_norm (μ := volume) (f := fun s => deriv a (v + s) - deriv a (v - s)) ht refine le_trans h1 (intervalIntegral.integral_mono_on ht ?_ ?_ hinner) · exact (((a.contDiff_deriv.continuous.comp (continuous_const.add continuous_id)).sub (a.contDiff_deriv.continuous.comp (continuous_const.sub continuous_id))).norm).intervalIntegrable 0 t · exact (continuous_const.mul continuous_id).intervalIntegrable 0 t have heval : ∫ s in (0 : ℝ)..t, (2 * ‖deriv (deriv a) u₀‖ * s) = ‖deriv (deriv a) u₀‖ * t ^ 2 := by have hd : ∀ s ∈ uIcc (0 : ℝ) t, HasDerivAt (fun x : ℝ => ‖deriv (deriv a) u₀‖ * x ^ 2) (2 * ‖deriv (deriv a) u₀‖ * s) s := by intro s _ have h := (hasDerivAt_pow 2 s).const_mul ‖deriv (deriv a) u₀‖ have hval : ‖deriv (deriv a) u₀‖ * ((2 : ℕ) * s ^ (2 - 1)) = 2 * ‖deriv (deriv a) u₀‖ * s := by push_cast; ring rwa [hval] at h have hftc := intervalIntegral.integral_eq_sub_of_hasDerivAt hd ((continuous_const.mul continuous_id).intervalIntegrable 0 t) simpa using hftc linarith /-- Symmetric correlation cancellation `‖C_{a,b}(0) - (C_{a,b}(t) + C_{a,b}(-t))/2‖ ≤ K · t^2`. -/ lemma norm_symm_corr_diff_le (a b : TestFn) : ∃ K ≥ 0, ∀ t ≥ 0, ‖corr a b 0 - (corr a b t + corr a b (-t)) / 2‖ ≤ K * t ^ 2 := by obtain ⟨M₂, hM₂, hsd⟩ := norm_second_diff_le a refine ⟨M₂ * l1Norm b / 2, div_nonneg (mul_nonneg hM₂ (MeasureTheory.integral_nonneg fun _ => norm_nonneg _)) zero_le_two, ?_⟩ intro t ht have heq : corr a b 0 - (corr a b t + corr a b (-t)) / 2 = -((1 / 2 : ℂ) * ∫ v, (a (v + t) + a (v - t) - 2 * a v) * starRingEnd ℂ (b v)) := by unfold corr have hlin : (fun v => (a (v + t) + a (v - t) - 2 * a v) * starRingEnd ℂ (b v)) = fun v => (a (v + t) * starRingEnd ℂ (b v) + a (v + -t) * starRingEnd ℂ (b v)) - (2 : ℂ) * (a (v + 0) * starRingEnd ℂ (b v)) := by ext v; simp [sub_eq_add_neg]; ring have hint12 : Integrable (fun v => a (v + t) * starRingEnd ℂ (b v) + a (v + -t) * starRingEnd ℂ (b v)) volume := (integrable_corr_integrand a b t).add (integrable_corr_integrand a b (-t)) have hint0 : Integrable (fun v => (2 : ℂ) * (a (v + 0) * starRingEnd ℂ (b v))) volume := (integrable_corr_integrand a b 0).const_mul 2 rw [hlin, MeasureTheory.integral_sub hint12 hint0, MeasureTheory.integral_add (integrable_corr_integrand a b t) (integrable_corr_integrand a b (-t)), MeasureTheory.integral_const_mul] ring rw [heq, norm_neg, norm_mul] have hhalf : ‖(1 / 2 : ℂ)‖ = 1 / 2 := by norm_num rw [hhalf] have hint_norm : ‖∫ v, (a (v + t) + a (v - t) - 2 * a v) * starRingEnd ℂ (b v)‖ ≤ M₂ * t ^ 2 * l1Norm b := by calc ‖∫ v, (a (v + t) + a (v - t) - 2 * a v) * starRingEnd ℂ (b v)‖ ≤ ∫ v, ‖(a (v + t) + a (v - t) - 2 * a v) * starRingEnd ℂ (b v)‖ := MeasureTheory.norm_integral_le_integral_norm _ _ ≤ ∫ v, (M₂ * t ^ 2) * ‖b v‖ := by refine MeasureTheory.integral_mono ?_ (b.integrable_norm.const_mul (M₂ * t ^ 2)) (fun v => ?_) · obtain ⟨a₂, b₂, _, hsupp⟩ := exists_Icc_support_of_hasCompactSupport b.compactSupport exact integrable_of_continuous_of_vanishes_outside_Icc a₂ b₂ ((((a.continuous.comp (continuous_id.add continuous_const)).add (a.continuous.comp (continuous_id.sub continuous_const))).sub (continuous_const.mul a.continuous)).mul (Complex.continuous_conj.comp b.continuous)).norm (fun v hv => by simp [hsupp v hv]) · rw [norm_mul, Complex.norm_conj] exact mul_le_mul_of_nonneg_right (hsd v t ht) (norm_nonneg _) _ = M₂ * t ^ 2 * l1Norm b := by rw [MeasureTheory.integral_const_mul]; rfl nlinarith lemma one_le_cosh_real (x : ℝ) : 1 ≤ Real.cosh x := by rw [Real.cosh_eq] have hpos : 0 < Real.exp x := Real.exp_pos x have hinv : Real.exp (-x) = (Real.exp x)⁻¹ := Real.exp_neg x rw [hinv] have hsq : 0 ≤ (Real.exp x - 1) ^ 2 := sq_nonneg _ have hmul : 2 * Real.exp x ≤ Real.exp x * (Real.exp x + (Real.exp x)⁻¹) := by have : Real.exp x * (Real.exp x + (Real.exp x)⁻¹) = Real.exp x ^ 2 + 1 := by field_simp [ne_of_gt hpos] nlinarith have hsum : 2 ≤ Real.exp x + (Real.exp x)⁻¹ := by nlinarith linarith lemma t_le_sinh {t : ℝ} (ht : 0 ≤ t) : t ≤ Real.sinh t := by let g : ℝ → ℝ := fun x => Real.sinh x - x have hd : ∀ x ∈ uIcc (0 : ℝ) t, HasDerivAt g (Real.cosh x - 1) x := by intro x _ exact (hasDerivAt_sinh_real x).sub (hasDerivAt_id' x) have hftc := intervalIntegral.integral_eq_sub_of_hasDerivAt hd ((Real.continuous_cosh.sub continuous_const).intervalIntegrable 0 t) have hnn : 0 ≤ ∫ x in (0 : ℝ)..t, (Real.cosh x - 1) := by refine intervalIntegral.integral_nonneg ht (fun x _ => ?_) linarith [one_le_cosh_real x] have h0 : g 0 = 0 := by simp [g] linarith /-- Full integrability of the continuous integrand of `B(a, b)` on `(0, ∞)` (F04 §2). -/ theorem integrableOn_weil_integrand (a b : TestFn) : IntegrableOn (fun t => (weilWeight t : ℂ) * (corr a b 0 - (corr a b t + corr a b (-t)) / 2)) (Ioi (0 : ℝ)) volume := by let F : ℝ → ℂ := fun t => (weilWeight t : ℂ) * (corr a b 0 - (corr a b t + corr a b (-t)) / 2) have hcont_F : ContinuousOn F (Ioi 0) := by refine (Complex.continuous_ofReal.comp_continuousOn continuousOn_weilWeight).mul ?_ exact (continuous_const.sub (((continuous_corr a b).add ((continuous_corr a b).comp continuous_neg)).div_const 2)).continuousOn have hsplit : Ioi (0 : ℝ) = Ioc (0 : ℝ) 1 ∪ Ioi (1 : ℝ) := (Ioc_union_Ioi_eq_Ioi zero_le_one).symm rw [hsplit] refine IntegrableOn.union ?_ ?_ · obtain ⟨K, hK, hdiff⟩ := norm_symm_corr_diff_le a b have hmeas : AEStronglyMeasurable F (volume.restrict (Ioc (0 : ℝ) 1)) := (hcont_F.mono (show Ioc (0 : ℝ) 1 ⊆ Ioi 0 from fun _ ht => ht.1)).aestronglyMeasurable measurableSet_Ioc have hdom : IntegrableOn (fun _ : ℝ => Real.exp (1 / 2) * K) (Ioc (0 : ℝ) 1) volume := integrableOn_const (by simp) refine hdom.mono' hmeas ?_ filter_upwards [ae_restrict_mem measurableSet_Ioc] with t ht have htpos : 0 < t := ht.1 have htle : t ≤ 1 := ht.2 rw [norm_mul, Complex.norm_real, Real.norm_of_nonneg (le_of_lt (weilWeight_pos htpos))] have hw_le : weilWeight t ≤ Real.exp (1 / 2) / t := by unfold weilWeight have h1 : Real.exp (t / 2) ≤ Real.exp (1 / 2) := Real.exp_le_exp.mpr (by linarith) have h2 : t ≤ Real.sinh t := t_le_sinh (le_of_lt htpos) calc Real.exp (t / 2) / Real.sinh t ≤ Real.exp (1 / 2) / Real.sinh t := div_le_div_of_nonneg_right h1 (le_of_lt (sinh_pos_of_pos htpos)) _ ≤ Real.exp (1 / 2) / t := div_le_div_of_nonneg_left (le_of_lt (Real.exp_pos _)) htpos h2 have hprod_eq : (Real.exp (1 / 2) / t) * (K * t ^ 2) = Real.exp (1 / 2) * K * t := by field_simp [ne_of_gt htpos] calc weilWeight t * ‖corr a b 0 - (corr a b t + corr a b (-t)) / 2‖ ≤ (Real.exp (1 / 2) / t) * (K * t ^ 2) := mul_le_mul hw_le (hdiff t (le_of_lt htpos)) (norm_nonneg _) (by positivity) _ = Real.exp (1 / 2) * K * t := hprod_eq _ ≤ Real.exp (1 / 2) * K * 1 := mul_le_mul_of_nonneg_left htle (mul_nonneg (le_of_lt (Real.exp_pos _)) hK) _ = Real.exp (1 / 2) * K := mul_one _ · have hw_int : IntegrableOn weilWeight (Ioi 1) volume := (integral_Ioi_weilWeight zero_lt_one).1 have hmeas : AEStronglyMeasurable F (volume.restrict (Ioi (1 : ℝ))) := (hcont_F.mono (Ioi_subset_Ioi zero_le_one)).aestronglyMeasurable measurableSet_Ioi have hdom : IntegrableOn (fun t => (2 * (l2Norm a * l2Norm b)) * weilWeight t) (Ioi 1) volume := hw_int.const_mul _ refine hdom.mono' hmeas ?_ filter_upwards [ae_restrict_mem measurableSet_Ioi] with t ht have htpos : 0 < t := lt_trans zero_lt_one ht rw [norm_mul, Complex.norm_real, Real.norm_of_nonneg (le_of_lt (weilWeight_pos htpos))] have hbd : ‖corr a b 0 - (corr a b t + corr a b (-t)) / 2‖ ≤ 2 * (l2Norm a * l2Norm b) := by have h1 := norm_corr_le a b 0 have h2 := norm_corr_le a b t have h3 := norm_corr_le a b (-t) have htri : ‖corr a b 0 - (corr a b t + corr a b (-t)) / 2‖ ≤ ‖corr a b 0‖ + (‖corr a b t‖ + ‖corr a b (-t)‖) / 2 := by calc ‖corr a b 0 - (corr a b t + corr a b (-t)) / 2‖ ≤ ‖corr a b 0‖ + ‖(corr a b t + corr a b (-t)) / 2‖ := norm_sub_le _ _ _ = ‖corr a b 0‖ + ‖corr a b t + corr a b (-t)‖ / 2 := by rw [norm_div, Complex.norm_ofNat] _ ≤ ‖corr a b 0‖ + (‖corr a b t‖ + ‖corr a b (-t)‖) / 2 := by linarith [norm_add_le (corr a b t) (corr a b (-t))] linarith rw [mul_comm] exact mul_le_mul_of_nonneg_right hbd (le_of_lt (weilWeight_pos htpos)) /-- Integrability of the real diagonal integrand `w(t) (‖φ‖_2^2 - Re C_φ(t))` on `(0, ∞)`. -/ lemma integrableOn_Q_integrand (φ : TestFn) : IntegrableOn (fun t => weilWeight t * (normSq φ - (autoCorr φ t).re)) (Ioi (0 : ℝ)) volume := by have hC := integrableOn_weil_integrand φ φ have hre : IntegrableOn (fun t => Complex.reCLM ((weilWeight t : ℂ) * (corr φ φ 0 - (corr φ φ t + corr φ φ (-t)) / 2))) (Ioi (0 : ℝ)) volume := Complex.reCLM.integrable_comp hC refine IntegrableOn.congr_fun hre (fun t _ => ?_) measurableSet_Ioi change ((weilWeight t : ℂ) * (autoCorr φ 0 - (autoCorr φ t + autoCorr φ (-t)) / 2)).re = weilWeight t * (normSq φ - (autoCorr φ t).re) rw [autoCorr_zero, autoCorr_neg] simp only [Complex.mul_re, Complex.ofReal_re, Complex.ofReal_im, zero_mul, sub_zero, Complex.sub_re, Complex.div_ofNat_re, Complex.add_re, Complex.conj_re] ring /-- Disjoint-support additivity of the squared `L^2` norm (Section 5, eq. (11)). -/ theorem normSq_sum_disjoint {r : ℕ} {a b : Fin r → ℝ} {φ : Fin r → TestFn} (hsep : ∀ i j : Fin r, i < j → b i < a j) (hsupp : ∀ i, SupportedIn (φ i) (a i) (b i)) (c : Fin r → ℂ) : normSq (∑ i : Fin r, c i • φ i) = ∑ i : Fin r, ‖c i‖ ^ 2 * normSq (φ i) := by unfold normSq have hpw : ∀ u, ‖(∑ i : Fin r, c i • φ i) u‖ ^ 2 = ∑ i : Fin r, ‖c i‖ ^ 2 * ‖φ i u‖ ^ 2 := by intro u rw [TestFn.finset_sum_apply] by_cases hex : ∃ i₀ : Fin r, u ∈ Icc (a i₀) (b i₀) · obtain ⟨i₀, hi₀⟩ := hex have hother : ∀ i : Fin r, i ≠ i₀ → φ i u = 0 := by intro i hne apply hsupp i u intro hm rcases lt_or_gt_of_ne hne with hlt | hgt · linarith [hsep i i₀ hlt, hm.2, hi₀.1] · linarith [hsep i₀ i hgt, hi₀.2, hm.1] rw [Finset.sum_eq_single i₀ (fun i _ hne => by simp [hother i hne]) (by simp)] rw [Finset.sum_eq_single i₀ (fun i _ hne => by simp [hother i hne]) (by simp)] simp [mul_pow] · push Not at hex have hall : ∀ i : Fin r, φ i u = 0 := fun i => hsupp i u (hex i) simp [hall] simp_rw [hpw] rw [MeasureTheory.integral_finsetSum _ (fun i _ => (φ i).integrable_norm_sq.const_mul (‖c i‖ ^ 2))] congr 1; ext i exact MeasureTheory.integral_const_mul _ _ end F04Riemann