import F04Riemann.WeilForm /-! # Within-Window and Inter-Window Estimates (F04 §§3–4, Lemmas 1 & 2) This module proves the two core analytic estimates of F04: 1. **Lemma 1 (`lemma1_single_interval_lower_bound`, Section 3, eq. (4))**: For any smooth function `φ` supported in `[a, b]` of length `L = b - a` with `0 < L ≤ log 2` (without requiring balance conditions), `Q(φ) ≥ m(L) ‖φ‖_2^2`, where `m(L) = B(L) - A`. 2. **Exact inter-window interaction (`exact_interwindow_interaction`, Section 4, eq. (6))**: For two separated intervals `[a₁, b₁]` and `[a₂, b₂]` with `b₁ < a₂`, `K_{12} = B(φ₂, φ₁) = -(1/2) ∫_d^D w(t) C_{φ₂,φ₁}(t) dt - ∑_{log n ∈ [d, D]} (Λ(n)/√n) C_{φ₂,φ₁}(log n)`. 3. **Fubini cancellation (`fubini_exp_corr_eq_moments`, Section 4, eq. (9))**: `∫ e^{-t/2} C_{a,b}(t) dt = (∫ a(y) e^{-y/2} dy) (∫ conj(b(x)) e^{x/2} dx)`, which vanishes identically when `a` and `b` satisfy the balance conditions (1). 4. **Lemma 2 (`lemma2_interwindow_bound`, Section 4, eq. (8))**: For separated balanced functions `φ₁, φ₂`, `‖B(φ₂, φ₁)‖ ≤ E(L₁, L₂, d, D) ‖φ₁‖_2 ‖φ₂‖_2`, where `E = P + R`, `P = P_bound d D`, and `R = √(L₁ L₂) e^{-5d/2} / (1 - e^{-2d})`. -/ namespace F04Riemann open Real Complex MeasureTheory Set Finset /-! ### 1. Lemma 1: Single-Interval Lower Bound (Section 3, eq. (4)) -/ /-- **Lemma 1 (F04 §3, eq. (4))**: Every smooth function `φ` vanishing outside `[a, b]` of length `L = b - a` with `0 < L ≤ log 2` satisfies `Q(φ) ≥ m(L) ‖φ‖_2^2`. No local balance conditions are assumed, and the endpoint `L = log 2` is included. -/ theorem lemma1_single_interval_lower_bound {φ : TestFn} {a b : ℝ} (hL_pos : 0 < b - a) (hL_le : b - a ≤ Real.log 2) (hsupp : SupportedIn φ a b) : m_func (b - a) * normSq φ ≤ Q_form φ := by -- Step 1: Every prime-power term in `Q(φ)` vanishes because `log n ≥ log 2 ≥ b - a`. have harith_zero : ∀ n : ℕ, arithTermQ φ n = 0 := by intro n by_cases h2 : n < 2 · simp [arithTermQ, arithWeight_eq_zero_of_lt_two h2] · push Not at h2 have hlog : Real.log 2 ≤ Real.log (n : ℝ) := Real.log_le_log (by norm_num) (by exact_mod_cast h2) have hc0 : autoCorr φ (Real.log (n : ℝ)) = 0 := autoCorr_eq_zero_of_ge hsupp (le_trans hL_le hlog) simp [arithTermQ, hc0] have htsum_zero : (∑' n : ℕ, arithTermQ φ n) = 0 := by simp [harith_zero] -- Step 2: Keep only the tail `(b - a, ∞)` of the nonnegative continuous integrand. have hnn : ∀ t ∈ Ioi (0 : ℝ), 0 ≤ weilWeight t * (normSq φ - (autoCorr φ t).re) := by intro t ht exact mul_nonneg (le_of_lt (weilWeight_pos ht)) (by linarith [re_autoCorr_le φ t]) have hsub : Ioi (b - a) ⊆ Ioi (0 : ℝ) := Ioi_subset_Ioi (le_of_lt hL_pos) have htail_le : ∫ t in Ioi (b - a), weilWeight t * (normSq φ - (autoCorr φ t).re) ≤ ∫ t in Ioi (0 : ℝ), weilWeight t * (normSq φ - (autoCorr φ t).re) := MeasureTheory.setIntegral_mono_set (integrableOn_Q_integrand φ) ((ae_restrict_iff' measurableSet_Ioi).mpr (Filter.Eventually.of_forall hnn)) hsub.eventuallyLE -- Step 3: On `(b - a, ∞)`, `autoCorr φ t = 0`, leaving `B(b - a) * normSq φ`. have htail_eq : ∫ t in Ioi (b - a), weilWeight t * (normSq φ - (autoCorr φ t).re) = B_func (b - a) * normSq φ := by have hcongr : ∫ t in Ioi (b - a), weilWeight t * (normSq φ - (autoCorr φ t).re) = ∫ t in Ioi (b - a), weilWeight t * normSq φ := by refine MeasureTheory.setIntegral_congr_fun measurableSet_Ioi (fun t ht => ?_) have hc0 : autoCorr φ t = 0 := autoCorr_eq_zero_of_ge hsupp (le_of_lt ht) simp [hc0] rw [hcongr, MeasureTheory.integral_mul_const, (integral_Ioi_weilWeight hL_pos).2] unfold Q_form m_func rw [htsum_zero, mul_zero, sub_zero] linarith /-! ### 2. Exact Inter-Window Interaction (Section 4, eq. (6)) -/ /-- Exact interaction formula (eq. (6)) between a left window `[a₁, b₁]` and a right window `[a₂, b₂]` with positive gap `d = a₂ - b₁ > 0` and span `D = b₂ - a₁`. -/ theorem exact_interwindow_interaction {φ₁ φ₂ : TestFn} {a₁ b₁ a₂ b₂ : ℝ} (h1 : a₁ ≤ b₁) (hgap : b₁ < a₂) (h2 : a₂ ≤ b₂) (hsupp₁ : SupportedIn φ₁ a₁ b₁) (hsupp₂ : SupportedIn φ₂ a₂ b₂) : B_form φ₂ φ₁ = -(1 / 2 : ℂ) * (∫ t in (a₂ - b₁)..(b₂ - a₁), (weilWeight t : ℂ) * corr φ₂ φ₁ t) - ∑ n ∈ primePowerRange (a₂ - b₁) (b₂ - a₁), ((arithWeight n : ℝ) : ℂ) * corr φ₂ φ₁ (Real.log (n : ℝ)) := by set d := a₂ - b₁ set D := b₂ - a₁ have hd_pos : 0 < d := by linarith have hdD : d ≤ D := by linarith have hc0 : corr φ₂ φ₁ 0 = 0 := corr_eq_zero_of_le hsupp₂ hsupp₁ (by linarith) have hc_neg : ∀ t ≥ 0, corr φ₂ φ₁ (-t) = 0 := fun t ht => corr_eq_zero_of_le hsupp₂ hsupp₁ (by linarith) have hc_out : ∀ t, t ∉ Icc d D → corr φ₂ φ₁ t = 0 := by intro t ht by_cases hlt : t ≤ d · exact corr_eq_zero_of_le hsupp₂ hsupp₁ hlt · push Not at hlt have hgt : D ≤ t := by by_contra hlt2; push Not at hlt2; exact ht ⟨le_of_lt hlt, le_of_lt hlt2⟩ exact corr_eq_zero_of_ge hsupp₂ hsupp₁ hgt -- Simplify continuous integral on `Ioi 0` to `-(1/2) ∫_d^D w(t) C_{φ₂,φ₁}(t) dt`. have hint : ∫ t in Ioi (0 : ℝ), (weilWeight t : ℂ) * (corr φ₂ φ₁ 0 - (corr φ₂ φ₁ t + corr φ₂ φ₁ (-t)) / 2) = -(1 / 2 : ℂ) * ∫ t in d..D, (weilWeight t : ℂ) * corr φ₂ φ₁ t := by have hrew : ∫ t in Ioi (0 : ℝ), (weilWeight t : ℂ) * (corr φ₂ φ₁ 0 - (corr φ₂ φ₁ t + corr φ₂ φ₁ (-t)) / 2) = ∫ t in Ioi (0 : ℝ), (Icc d D).indicator (fun s => -(1 / 2 : ℂ) * ((weilWeight s : ℂ) * corr φ₂ φ₁ s)) t := by refine MeasureTheory.setIntegral_congr_fun measurableSet_Ioi (fun t ht => ?_) rw [hc0, hc_neg t (le_of_lt ht), add_zero, zero_sub] by_cases hmem : t ∈ Icc d D · rw [Set.indicator_of_mem hmem]; ring · rw [Set.indicator_of_notMem hmem, hc_out t hmem]; ring have hsub : Icc d D ⊆ Ioi (0 : ℝ) := fun t ht => lt_of_lt_of_le hd_pos ht.1 rw [hrew, MeasureTheory.setIntegral_indicator measurableSet_Icc, Set.inter_eq_right.mpr hsub, MeasureTheory.integral_const_mul, intervalIntegral.integral_of_le hdD, MeasureTheory.setIntegral_congr_set Ioc_ae_eq_Icc] -- Simplify prime-power `tsum` to the finite sum over `primePowerRange d D`. have hsum : ∑' n : ℕ, arithTermB φ₂ φ₁ n = ∑ n ∈ primePowerRange d D, ((arithWeight n : ℝ) : ℂ) * corr φ₂ φ₁ (Real.log (n : ℝ)) := by rw [tsum_eq_sum (s := primePowerRange d D)] · refine Finset.sum_congr rfl (fun n hn => ?_) rw [mem_primePowerRange_iff] at hn have hlog_nn : 0 ≤ Real.log (n : ℝ) := Real.log_nonneg (by exact_mod_cast (show 1 ≤ n by omega)) unfold arithTermB rw [hc_neg (Real.log (n : ℝ)) hlog_nn, add_zero] · intro n hn unfold arithTermB by_cases h2 : n < 2 · simp [arithWeight_eq_zero_of_lt_two h2] · push Not at h2 have hlog_nn : 0 ≤ Real.log (n : ℝ) := Real.log_nonneg (by exact_mod_cast (show 1 ≤ n by omega)) have hnot : Real.log (n : ℝ) ∉ Icc d D := by intro hmem exact hn (mem_primePowerRange_iff.mpr ⟨h2, hmem.1, hmem.2⟩) rw [hc_out (Real.log (n : ℝ)) hnot, hc_neg (Real.log (n : ℝ)) hlog_nn] simp unfold B_form rw [hint, hc0, mul_zero, sub_zero, hsum] /-! ### 3. Fubini Cancellation Identity (Section 4, eq. (9)) -/ /-- Helper: product integrability on `ℝ × ℝ` for compactly supported continuous functions. -/ lemma integrable_prod_of_continuous_of_vanishes_outside_rect {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] {F : ℝ × ℝ → E} (a₁ b₁ a₂ b₂ : ℝ) (hcont : Continuous F) (hsupp : ∀ p : ℝ × ℝ, p ∉ Icc a₁ b₁ ×ˢ Icc a₂ b₂ → F p = 0) : Integrable F (volume.prod volume) := by have hind : (Icc a₁ b₁ ×ˢ Icc a₂ b₂).indicator F = F := by ext p by_cases hp : p ∈ Icc a₁ b₁ ×ˢ Icc a₂ b₂ · exact Set.indicator_of_mem hp F · rw [Set.indicator_of_notMem hp, hsupp p hp] rw [← hind] have hmeas : MeasurableSet (Icc a₁ b₁ ×ˢ Icc a₂ b₂) := measurableSet_Icc.prod measurableSet_Icc have hcomp : IsCompact (Icc a₁ b₁ ×ˢ Icc a₂ b₂) := isCompact_Icc.prod isCompact_Icc exact (integrable_indicator_iff hmeas).mpr (hcont.continuousOn.integrableOn_compact hcomp) /-- Exact Fubini identity (eq. (9)): `∫ e^{-t/2} C_{a,b}(t) dt = (∫ a(y) e^{-y/2} dy) (∫ conj(b(x)) e^{x/2} dx)`. -/ theorem fubini_exp_corr_eq_moments (a b : TestFn) : ∫ t, ((Real.exp (-(t / 2)) : ℝ) : ℂ) * corr a b t = momentNeg a * starRingEnd ℂ (momentPos b) := by obtain ⟨a₁, b₁, _, ha⟩ := exists_Icc_support_of_hasCompactSupport a.compactSupport obtain ⟨a₂, b₂, _, hb⟩ := exists_Icc_support_of_hasCompactSupport b.compactSupport let F : ℝ → ℝ → ℂ := fun t v => ((Real.exp (-(t / 2)) : ℝ) : ℂ) * (a (v + t) * starRingEnd ℂ (b v)) have hF_int : Integrable (Function.uncurry F) (volume.prod volume) := by refine integrable_prod_of_continuous_of_vanishes_outside_rect (a₁ - b₂) (b₁ - a₂) a₂ b₂ ?_ ?_ · change Continuous (fun p : ℝ × ℝ => ((Real.exp (-(p.1 / 2)) : ℝ) : ℂ) * (a (p.2 + p.1) * starRingEnd ℂ (b p.2))) refine (Complex.continuous_ofReal.comp (Real.continuous_exp.comp ((continuous_fst.div_const 2).neg))).mul ?_ exact (a.continuous.comp (continuous_snd.add continuous_fst)).mul (Complex.continuous_conj.comp (b.continuous.comp continuous_snd)) · intro p hp change ((Real.exp (-(p.1 / 2)) : ℝ) : ℂ) * (a (p.2 + p.1) * starRingEnd ℂ (b p.2)) = 0 by_cases hv : p.2 ∈ Icc a₂ b₂ · have ht : p.1 ∉ Icc (a₁ - b₂) (b₁ - a₂) := fun hmem => hp ⟨hmem, hv⟩ have ha0 : a (p.2 + p.1) = 0 := ha (p.2 + p.1) (fun hmem => ht ⟨by linarith [hmem.1, hv.2], by linarith [hmem.2, hv.1]⟩) simp [ha0] · simp [hb p.2 hv] have hpull : (fun t => ((Real.exp (-(t / 2)) : ℝ) : ℂ) * corr a b t) = fun t => ∫ v, F t v := by ext t unfold corr exact (MeasureTheory.integral_const_mul _ _).symm rw [hpull, MeasureTheory.integral_integral_swap hF_int] have hinner : ∀ v : ℝ, ∫ t, F t v = (starRingEnd ℂ (b v) * ((Real.exp (v / 2) : ℝ) : ℂ)) * momentNeg a := by intro v have hsplit : (fun t => F t v) = fun t => (starRingEnd ℂ (b v) * ((Real.exp (v / 2) : ℝ) : ℂ)) * (a (t + v) * ((Real.exp (-((t + v) / 2)) : ℝ) : ℂ)) := by ext t have hexp : Real.exp (-(t / 2)) = Real.exp (v / 2) * Real.exp (-((t + v) / 2)) := by rw [← Real.exp_add]; congr 1; ring simp only [F, hexp] push_cast rw [add_comm v t] ring rw [hsplit, MeasureTheory.integral_const_mul] congr 1 have hcs : HasCompactSupport (fun y : ℝ => a y * ((Real.exp (-(y / 2)) : ℝ) : ℂ)) := a.compactSupport.mul_right exact integral_add_right_compact hcs v simp_rw [hinner] rw [MeasureTheory.integral_mul_const, mul_comm] congr 1 unfold momentPos change _ = Complex.conjCLE (∫ u, b u * ((Real.exp (u / 2) : ℝ) : ℂ)) rw [← Complex.conjCLE.integral_comp_comm] congr 1; ext v change starRingEnd ℂ (b v) * ((Real.exp (v / 2) : ℝ) : ℂ) = starRingEnd ℂ (b v * ((Real.exp (v / 2) : ℝ) : ℂ)) simp only [map_mul, Complex.conj_ofReal] /-- Fubini `L^1` integral of the absolute cross-correlation: `∫ t, ‖C_{a,b}(t)‖ ≤ ‖a‖_1 ‖b‖_1`. -/ lemma integral_norm_corr_le_l1_mul_l1 (a b : TestFn) : ∫ t, ‖corr a b t‖ ≤ l1Norm a * l1Norm b := by obtain ⟨a₁, b₁, _, ha⟩ := exists_Icc_support_of_hasCompactSupport a.compactSupport obtain ⟨a₂, b₂, _, hb⟩ := exists_Icc_support_of_hasCompactSupport b.compactSupport let G : ℝ → ℝ → ℝ := fun t v => ‖a (v + t)‖ * ‖b v‖ have hG_int : Integrable (Function.uncurry G) (volume.prod volume) := by refine integrable_prod_of_continuous_of_vanishes_outside_rect (a₁ - b₂) (b₁ - a₂) a₂ b₂ ?_ ?_ · change Continuous (fun p : ℝ × ℝ => ‖a (p.2 + p.1)‖ * ‖b p.2‖) exact (a.continuous.comp (continuous_snd.add continuous_fst)).norm.mul (b.continuous.comp continuous_snd).norm · intro p hp change ‖a (p.2 + p.1)‖ * ‖b p.2‖ = 0 by_cases hv : p.2 ∈ Icc a₂ b₂ · have ht : p.1 ∉ Icc (a₁ - b₂) (b₁ - a₂) := fun hmem => hp ⟨hmem, hv⟩ have ha0 : a (p.2 + p.1) = 0 := ha (p.2 + p.1) (fun hmem => ht ⟨by linarith [hmem.1, hv.2], by linarith [hmem.2, hv.1]⟩) simp [ha0] · simp [hb p.2 hv] have hcorr_int : Integrable (fun t => ‖corr a b t‖) volume := by refine integrable_of_continuous_of_vanishes_outside_Icc (a₁ - b₂) (b₁ - a₂) (continuous_corr a b).norm (fun t ht => ?_) have hc0 : corr a b t = 0 := by by_cases hlt : t ≤ a₁ - b₂ · exact corr_eq_zero_of_le ha hb hlt · push Not at hlt have hgt : b₁ - a₂ ≤ t := by by_contra hlt2; push Not at hlt2; exact ht ⟨le_of_lt hlt, le_of_lt hlt2⟩ exact corr_eq_zero_of_ge ha hb hgt simp [hc0] have hle : ∫ t, ‖corr a b t‖ ≤ ∫ t, ∫ v, G t v := by refine MeasureTheory.integral_mono hcorr_int hG_int.integral_prod_left (fun t => ?_) calc ‖corr a b t‖ ≤ ∫ v, ‖a (v + t) * starRingEnd ℂ (b v)‖ := MeasureTheory.norm_integral_le_integral_norm _ _ = ∫ v, G t v := by congr 1; ext v; simp [G] have hswap : ∫ t, ∫ v, G t v = l1Norm a * l1Norm b := by rw [MeasureTheory.integral_integral_swap hG_int] have hinner : ∀ v, ∫ t, G t v = l1Norm a * ‖b v‖ := by intro v unfold G rw [MeasureTheory.integral_mul_const] congr 1 have hrew : (fun t => ‖a (v + t)‖) = fun t => ‖a (t + v)‖ := by ext t; rw [add_comm] rw [hrew] have hcs : HasCompactSupport (fun y : ℝ => ‖a y‖) := a.compactSupport.comp_left norm_zero exact integral_add_right_compact hcs v simp_rw [hinner] rw [MeasureTheory.integral_const_mul] rfl linarith /-! ### 4. Lemma 2: Complete Inter-Window Interaction Bound (Section 4, eqs. (7)–(8)) -/ /-- Continuous interaction bound `R_{ij} = √(L_i L_j) e^{-5 d / 2} / (1 - e^{-2 d})` (eq. (7)). -/ noncomputable def R_bound (L₁ L₂ d : ℝ) : ℝ := Real.sqrt (L₁ * L₂) * (Real.exp (-(5 * d / 2)) / (1 - Real.exp (-(2 * d)))) /-- Total pairwise interaction bound `E_{ij} = P_{ij} + R_{ij}` (eq. (7)). -/ noncomputable def E_bound (L₁ L₂ d D : ℝ) : ℝ := P_bound d D + R_bound L₁ L₂ d lemma R_bound_nonneg {L₁ L₂ d : ℝ} (hd : 0 < d) : 0 ≤ R_bound L₁ L₂ d := mul_nonneg (Real.sqrt_nonneg _) (div_nonneg (le_of_lt (Real.exp_pos _)) (le_of_lt (one_sub_exp_neg_two_pos hd))) lemma E_bound_nonneg {L₁ L₂ d D : ℝ} (hd : 0 < d) : 0 ≤ E_bound L₁ L₂ d D := add_nonneg (P_bound_nonneg d D) (R_bound_nonneg hd) /-- **Lemma 2 (F04 §4, eq. (8))**: For two smooth functions `φ₁, φ₂` supported in strictly separated intervals `[a₁, b₁]` and `[a₂, b₂]` (`b₁ < a₂`) that individually satisfy both balance conditions (1), the complete interaction `K_{12} = B(φ₂, φ₁)` (including every continuous and prime-power contribution) satisfies `|K_{12}| ≤ E_{12} ‖φ₁‖_2 ‖φ₂‖_2`. -/ theorem lemma2_interwindow_bound {φ₁ φ₂ : TestFn} {a₁ b₁ a₂ b₂ : ℝ} (h1 : a₁ ≤ b₁) (hgap : b₁ < a₂) (h2 : a₂ ≤ b₂) (hsupp₁ : SupportedIn φ₁ a₁ b₁) (hsupp₂ : SupportedIn φ₂ a₂ b₂) (_hbal₁ : IsBalanced φ₁) (hbal₂ : IsBalanced φ₂) : ‖B_form φ₂ φ₁‖ ≤ E_bound (b₁ - a₁) (b₂ - a₂) (a₂ - b₁) (b₂ - a₁) * l2Norm φ₁ * l2Norm φ₂ := by set d := a₂ - b₁ set D := b₂ - a₁ have hd_pos : 0 < d := by linarith have hdD : d ≤ D := by linarith rw [exact_interwindow_interaction h1 hgap h2 hsupp₁ hsupp₂] -- Split into continuous bound `R` and arithmetic bound `P`. have htri : ‖-(1 / 2 : ℂ) * (∫ t in d..D, (weilWeight t : ℂ) * corr φ₂ φ₁ t) - ∑ n ∈ primePowerRange d D, ((arithWeight n : ℝ) : ℂ) * corr φ₂ φ₁ (Real.log (n : ℝ))‖ ≤ ‖-(1 / 2 : ℂ) * (∫ t in d..D, (weilWeight t : ℂ) * corr φ₂ φ₁ t)‖ + ‖∑ n ∈ primePowerRange d D, ((arithWeight n : ℝ) : ℂ) * corr φ₂ φ₁ (Real.log (n : ℝ))‖ := norm_sub_le _ _ -- Part A: Arithmetic bound `≤ P_bound d D * l2Norm φ₁ * l2Norm φ₂`. have hP : ‖∑ n ∈ primePowerRange d D, ((arithWeight n : ℝ) : ℂ) * corr φ₂ φ₁ (Real.log (n : ℝ))‖ ≤ P_bound d D * l2Norm φ₁ * l2Norm φ₂ := by calc ‖∑ n ∈ primePowerRange d D, ((arithWeight n : ℝ) : ℂ) * corr φ₂ φ₁ (Real.log (n : ℝ))‖ ≤ ∑ n ∈ primePowerRange d D, ‖((arithWeight n : ℝ) : ℂ) * corr φ₂ φ₁ (Real.log (n : ℝ))‖ := norm_sum_le _ _ _ ≤ ∑ n ∈ primePowerRange d D, arithWeight n * (l2Norm φ₁ * l2Norm φ₂) := by refine Finset.sum_le_sum (fun n _ => ?_) rw [norm_mul, Complex.norm_real, Real.norm_of_nonneg (arithWeight_nonneg n), mul_comm (l2Norm φ₁)] exact mul_le_mul_of_nonneg_left (norm_corr_le φ₂ φ₁ (Real.log (n : ℝ))) (arithWeight_nonneg n) _ = P_bound d D * l2Norm φ₁ * l2Norm φ₂ := by unfold P_bound; rw [← Finset.sum_mul, mul_assoc] -- Part B: Continuous bound via exact weight split `w(t) = 2 e^{-t/2} + w_0(t)` and Fubini cancellation. have hcancel : ∫ t in d..D, ((Real.exp (-(t / 2)) : ℝ) : ℂ) * corr φ₂ φ₁ t = 0 := by have hsupp_corr : ∀ t, t ∉ Icc d D → ((Real.exp (-(t / 2)) : ℝ) : ℂ) * corr φ₂ φ₁ t = 0 := by intro t ht have hc0 : corr φ₂ φ₁ t = 0 := by by_cases hlt : t ≤ d · exact corr_eq_zero_of_le hsupp₂ hsupp₁ hlt · push Not at hlt have hgt : D ≤ t := by by_contra hlt2; push Not at hlt2; exact ht ⟨le_of_lt hlt, le_of_lt hlt2⟩ exact corr_eq_zero_of_ge hsupp₂ hsupp₁ hgt simp [hc0] rw [← integral_eq_intervalIntegral_of_vanishes_outside_Icc hdD hsupp_corr, fubini_exp_corr_eq_moments, hbal₂.1, zero_mul] have hint_split : ∫ t in d..D, (weilWeight t : ℂ) * corr φ₂ φ₁ t = ∫ t in d..D, (residualWeight t : ℂ) * corr φ₂ φ₁ t := by have hcongr : ∫ t in d..D, (weilWeight t : ℂ) * corr φ₂ φ₁ t = ∫ t in d..D, ((2 : ℂ) * (((Real.exp (-(t / 2)) : ℝ) : ℂ) * corr φ₂ φ₁ t) + (residualWeight t : ℂ) * corr φ₂ φ₁ t) := by refine intervalIntegral.integral_congr (fun t ht => ?_) rw [uIcc_of_le hdD] at ht have htpos : 0 < t := lt_of_lt_of_le hd_pos ht.1 rw [weilWeight_split htpos] push_cast; ring have hint1 : IntervalIntegrable (fun t => (2 : ℂ) * (((Real.exp (-(t / 2)) : ℝ) : ℂ) * corr φ₂ φ₁ t)) volume d D := (continuous_const.mul ((Complex.continuous_ofReal.comp (Real.continuous_exp.comp (continuous_id.div_const 2).neg)).mul (continuous_corr φ₂ φ₁))).intervalIntegrable d D have hint2 : IntervalIntegrable (fun t => (residualWeight t : ℂ) * corr φ₂ φ₁ t) volume d D := by refine ContinuousOn.intervalIntegrable ?_ rw [uIcc_of_le hdD] exact (Complex.continuous_ofReal.comp_continuousOn (continuousOn_residualWeight.mono (fun t ht => lt_of_lt_of_le hd_pos ht.1))).mul (continuous_corr φ₂ φ₁).continuousOn rw [hcongr, intervalIntegral.integral_add hint1 hint2, intervalIntegral.integral_const_mul, hcancel, mul_zero, zero_add] have hR : ‖-(1 / 2 : ℂ) * (∫ t in d..D, (weilWeight t : ℂ) * corr φ₂ φ₁ t)‖ ≤ R_bound (b₁ - a₁) (b₂ - a₂) d * l2Norm φ₁ * l2Norm φ₂ := by rw [hint_split, norm_mul, norm_neg] have hhalf : ‖(1 / 2 : ℂ)‖ = 1 / 2 := by norm_num rw [hhalf] have hbound1 : ‖∫ t in d..D, (residualWeight t : ℂ) * corr φ₂ φ₁ t‖ ≤ residualWeight d * ∫ t in d..D, ‖corr φ₂ φ₁ t‖ := by have h1 := intervalIntegral.norm_integral_le_integral_norm (μ := volume) (f := fun t => (residualWeight t : ℂ) * corr φ₂ φ₁ t) hdD have hint_lhs : IntervalIntegrable (fun t => ‖(residualWeight t : ℂ) * corr φ₂ φ₁ t‖) volume d D := by refine ContinuousOn.intervalIntegrable ?_ rw [uIcc_of_le hdD] exact ((Complex.continuous_ofReal.comp_continuousOn (continuousOn_residualWeight.mono (fun t ht => lt_of_lt_of_le hd_pos ht.1))).mul (continuous_corr φ₂ φ₁).continuousOn).norm have hint_rhs : IntervalIntegrable (fun t => residualWeight d * ‖corr φ₂ φ₁ t‖) volume d D := (continuous_const.mul (continuous_corr φ₂ φ₁).norm).intervalIntegrable d D have hmono := intervalIntegral.integral_mono_on hdD hint_lhs hint_rhs (fun t ht => ?_) · rw [intervalIntegral.integral_const_mul] at hmono exact le_trans h1 hmono · have htpos : 0 < t := lt_of_lt_of_le hd_pos ht.1 rw [norm_mul, Complex.norm_real, Real.norm_of_nonneg (le_of_lt (residualWeight_pos htpos))] have hw_le : residualWeight t ≤ residualWeight d := by rcases eq_or_lt_of_le ht.1 with rfl | hlt · exact le_refl _ · exact le_of_lt (residualWeight_antiOn hd_pos htpos hlt) exact mul_le_mul_of_nonneg_right hw_le (norm_nonneg _) have hcorr_full : ∫ t in d..D, ‖corr φ₂ φ₁ t‖ = ∫ t, ‖corr φ₂ φ₁ t‖ := by symm refine integral_eq_intervalIntegral_of_vanishes_outside_Icc hdD (fun t ht => ?_) have hc0 : corr φ₂ φ₁ t = 0 := by by_cases hlt : t ≤ d · exact corr_eq_zero_of_le hsupp₂ hsupp₁ hlt · push Not at hlt have hgt : D ≤ t := by by_contra hlt2; push Not at hlt2; exact ht ⟨le_of_lt hlt, le_of_lt hlt2⟩ exact corr_eq_zero_of_ge hsupp₂ hsupp₁ hgt simp [hc0] have hl1_1 : l1Norm φ₁ ≤ Real.sqrt (b₁ - a₁) * l2Norm φ₁ := l1Norm_le_sqrt_mul_l2Norm h1 hsupp₁ have hl1_2 : l1Norm φ₂ ≤ Real.sqrt (b₂ - a₂) * l2Norm φ₂ := l1Norm_le_sqrt_mul_l2Norm h2 hsupp₂ have hprod_l1 : l1Norm φ₂ * l1Norm φ₁ ≤ Real.sqrt ((b₁ - a₁) * (b₂ - a₂)) * l2Norm φ₁ * l2Norm φ₂ := by have hmul : l1Norm φ₂ * l1Norm φ₁ ≤ (Real.sqrt (b₂ - a₂) * l2Norm φ₂) * (Real.sqrt (b₁ - a₁) * l2Norm φ₁) := mul_le_mul hl1_2 hl1_1 (MeasureTheory.integral_nonneg fun _ => norm_nonneg _) (mul_nonneg (Real.sqrt_nonneg _) (l2Norm_nonneg _)) have hsqrt : Real.sqrt (b₁ - a₁) * Real.sqrt (b₂ - a₂) = Real.sqrt ((b₁ - a₁) * (b₂ - a₂)) := (Real.sqrt_mul (by linarith : 0 ≤ b₁ - a₁) (b₂ - a₂)).symm calc l1Norm φ₂ * l1Norm φ₁ ≤ (Real.sqrt (b₂ - a₂) * l2Norm φ₂) * (Real.sqrt (b₁ - a₁) * l2Norm φ₁) := hmul _ = (Real.sqrt (b₁ - a₁) * Real.sqrt (b₂ - a₂)) * l2Norm φ₁ * l2Norm φ₂ := by ring _ = Real.sqrt ((b₁ - a₁) * (b₂ - a₂)) * l2Norm φ₁ * l2Norm φ₂ := by rw [hsqrt] have hhalf_w0 : (1 / 2 : ℝ) * residualWeight d = Real.exp (-(5 * d / 2)) / (1 - Real.exp (-(2 * d))) := by unfold residualWeight; ring have hw_nn : 0 ≤ residualWeight d := le_of_lt (residualWeight_pos hd_pos) calc (1 / 2 : ℝ) * ‖∫ t in d..D, (residualWeight t : ℂ) * corr φ₂ φ₁ t‖ ≤ (1 / 2 : ℝ) * (residualWeight d * ∫ t in d..D, ‖corr φ₂ φ₁ t‖) := mul_le_mul_of_nonneg_left hbound1 (by norm_num) _ = ((1 / 2 : ℝ) * residualWeight d) * ∫ t, ‖corr φ₂ φ₁ t‖ := by rw [hcorr_full]; ring _ ≤ ((1 / 2 : ℝ) * residualWeight d) * (l1Norm φ₂ * l1Norm φ₁) := mul_le_mul_of_nonneg_left (integral_norm_corr_le_l1_mul_l1 φ₂ φ₁) (by positivity) _ ≤ ((1 / 2 : ℝ) * residualWeight d) * (Real.sqrt ((b₁ - a₁) * (b₂ - a₂)) * l2Norm φ₁ * l2Norm φ₂) := mul_le_mul_of_nonneg_left hprod_l1 (by positivity) _ = R_bound (b₁ - a₁) (b₂ - a₂) d * l2Norm φ₁ * l2Norm φ₂ := by unfold R_bound; rw [hhalf_w0]; ring unfold E_bound linarith end F04Riemann