| 1 | module |
| 2 | |
| 3 | public import E424.LowBand.L40Aux |
| 4 | |
| 5 | @[expose] public section |
| 6 | |
| 7 | /-! |
| 8 | # Section 9: helpers for Lemma 40, part 3 |
| 9 | |
| 10 | The core estimate of Lemma 40 for abstract functions: `g ∈ {0, 1}` (the step function `F (⌊e^x⌋)`), |
| 11 | `h` (the smoothed `F̄`), and `γ` (the exceptional set `G1`). If `g` is `≥ 1 - α + ...` on average over |
| 12 | every window `[z, z + L]`, and `h` is nearly constant on windows, then `g` is rarely `1`. |
| 13 | -/ |
| 14 | |
| 15 | set_option linter.style.header false |
| 16 | open Finset MeasureTheory |
| 17 | |
| 18 | namespace E424 |
| 19 | |
| 20 | /-- Bounded measurable functions are interval integrable along a window `z + x`, `x ∈ [0, L]`. -/ |
| 21 | theorem ii_shift {φ : ℝ → ℝ} (hφ : Measurable φ) {a b L M : ℝ} (hL : 0 ≤ L) |
| 22 | (hM : ∀ x ∈ Set.Icc a (b + L), |φ x| ≤ M) {z : ℝ} (hz : z ∈ Set.Icc a b) : |
| 23 | IntervalIntegrable (fun x => φ (z + x)) volume 0 L := |
| 24 | ii_of_bdd hL (hφ.comp (measurable_const.add measurable_id)) fun x hx => |
| 25 | hM _ ⟨by linarith [hz.1, hx.1], by linarith [hz.2, hx.2]⟩ |
| 26 | |
| 27 | set_option maxHeartbeats 800000 in |
| 28 | /-- Core estimate of Lemma 40. -/ |
| 29 | theorem core {g γ h : ℝ → ℝ} {α L a b R : ℝ} (hg : Measurable g) (hγ : Measurable γ) |
| 30 | (hh : Measurable h) (hg01 : ∀ x, g x = 0 ∨ g x = 1) (hγ0 : ∀ x, 0 ≤ γ x) (hγ1 : ∀ x, γ x ≤ 1) |
| 31 | (hh2 : ∀ x ∈ Set.Icc a (b + L), |h x| ≤ 2) (hα : 0 < α) (hL : 0 < L) (hab : a ≤ b) |
| 32 | (hL3 : ∀ z ∈ Set.Icc a b, α * L - 3 ≤ ∫ x in z..(z + L), ((1 - g x) + γ x)) |
| 33 | (hR : ∀ x ∈ Set.Icc (0 : ℝ) L, ∫ z in a..b, |h z - h (z + x)| ≤ R) : |
| 34 | α * (∫ z in a..b, g z) ≤ 2 * (∫ x in a..(b + L), |h x - g x|) + 3 * (b - a) / L + |
| 35 | (∫ x in a..(b + L), γ x) + R := by |
| 36 | have hg1 : ∀ x, |g x| ≤ 1 := fun x => by rcases hg01 x with h | h <;> simp [h] |
| 37 | have hγ1' : ∀ x, |γ x| ≤ 1 := fun x => by rw [abs_of_nonneg (hγ0 x)]; exact hγ1 x |
| 38 | have hu : Measurable fun x => |h x - g x| := (hh.sub hg).abs |
| 39 | have hu3 : ∀ x ∈ Set.Icc a (b + L), |h x - g x| ≤ 3 := fun x hx => by |
| 40 | calc |h x - g x| ≤ |h x| + |g x| := abs_sub _ _ |
| 41 | _ ≤ 3 := by linarith [hh2 x hx, hg1 x] |
| 42 | set ψ : ℝ → ℝ := fun x => γ x + |h x - g x| with hψdef |
| 43 | have hψm : Measurable ψ := hγ.add hu |
| 44 | have hψ0 : ∀ x, 0 ≤ ψ x := fun x => add_nonneg (hγ0 x) (abs_nonneg _) |
| 45 | have hψ4 : ∀ x ∈ Set.Icc a (b + L), |ψ x| ≤ 4 := fun x hx => by |
| 46 | rw [abs_of_nonneg (hψ0 x)]; linarith [hγ1 x, hu3 x hx] |
| 47 | have hLab : a ≤ b + L := by linarith |
| 48 | -- per-window estimate |
| 49 | have hwin : ∀ z ∈ Set.Icc a b, (∫ x in (0 : ℝ)..L, h (z + x)) ≤ |
| 50 | L * (1 - α) + 3 + ∫ x in (0 : ℝ)..L, ψ (z + x) := by |
| 51 | intro z hz |
| 52 | have ih := ii_shift hh hL.le hh2 hz |
| 53 | have ig := ii_shift (M := 1) hg hL.le (fun x _ => hg1 x) hz |
| 54 | have iγ := ii_shift (M := 1) hγ hL.le (fun x _ => hγ1' x) hz |
| 55 | have iu := ii_shift (M := 3) hu hL.le (fun x hx => (abs_abs _).le.trans (hu3 x hx)) hz |
| 56 | have h3 := hL3 z hz |
| 57 | have e1 : ∫ x in z..(z + L), ((1 - g x) + γ x) = |
| 58 | ∫ x in (0 : ℝ)..L, ((1 - g (z + x)) + γ (z + x)) := by |
| 59 | have := intervalIntegral.integral_comp_add_left (a := 0) (b := L) (fun x => (1 - g x) + γ x) z |
| 60 | simpa using this.symm |
| 61 | rw [e1, intervalIntegral.integral_add (intervalIntegrable_const.sub ig) iγ, |
| 62 | intervalIntegral.integral_sub intervalIntegrable_const ig] at h3 |
| 63 | simp only [intervalIntegral.integral_const, smul_eq_mul, sub_zero, mul_one] at h3 |
| 64 | have h4 : ∫ x in (0 : ℝ)..L, h (z + x) ≤ ∫ x in (0 : ℝ)..L, (g (z + x) + |h (z + x) - g (z + x)|) := |
| 65 | intervalIntegral.integral_mono_on hL.le ih (ig.add iu) fun x _ => by |
| 66 | have := le_abs_self (h (z + x) - g (z + x)); linarith |
| 67 | rw [intervalIntegral.integral_add ig iu] at h4 |
| 68 | have h5 : ∫ x in (0 : ℝ)..L, ψ (z + x) = |
| 69 | (∫ x in (0 : ℝ)..L, γ (z + x)) + ∫ x in (0 : ℝ)..L, |h (z + x) - g (z + x)| := |
| 70 | intervalIntegral.integral_add iγ iu |
| 71 | linarith |
| 72 | -- the averages |
| 73 | set A : ℝ → ℝ := fun z => L⁻¹ * ∫ x in (0 : ℝ)..L, h (z + x) with hA |
| 74 | set E : ℝ → ℝ := fun z => 3 / L + L⁻¹ * ∫ x in (0 : ℝ)..L, ψ (z + x) with hE |
| 75 | have hAE : ∀ z ∈ Set.Icc a b, A z ≤ 1 - α + E z := by |
| 76 | intro z hz |
| 77 | have := hwin z hz |
| 78 | simp only [hA, hE] |
| 79 | have h1 := mul_le_mul_of_nonneg_left this (inv_nonneg.2 hL.le) |
| 80 | calc L⁻¹ * ∫ x in (0 : ℝ)..L, h (z + x) ≤ L⁻¹ * (L * (1 - α) + 3 + ∫ x in (0 : ℝ)..L, ψ (z + x)) := h1 |
| 81 | _ = 1 - α + (3 / L + L⁻¹ * ∫ x in (0 : ℝ)..L, ψ (z + x)) := by field_simp; ring |
| 82 | have hE0 : ∀ z ∈ Set.Icc a b, 0 ≤ E z := by |
| 83 | intro z hz |
| 84 | have : 0 ≤ ∫ x in (0 : ℝ)..L, ψ (z + x) := |
| 85 | intervalIntegral.integral_nonneg hL.le fun x _ => hψ0 _ |
| 86 | simp only [hE]; positivity |
| 87 | have hpt : ∀ z ∈ Set.Icc a b, α * g z ≤ |h z - g z| + E z + |h z - A z| := by |
| 88 | intro z hz |
| 89 | have e0 := hE0 z hz |
| 90 | have n1 := abs_nonneg (h z - g z) |
| 91 | have n2 := abs_nonneg (h z - A z) |
| 92 | rcases hg01 z with h0 | h0 |
| 93 | · rw [h0] at n1 ⊢ |
| 94 | linarith |
| 95 | · rw [h0] at n1 ⊢ |
| 96 | have h1 := hAE z hz |
| 97 | have h3 := le_abs_self (h z - A z) |
| 98 | have h4 := neg_abs_le (h z - 1) |
| 99 | linarith |
| 100 | -- integrability |
| 101 | have hψ4' := hψ4 |
| 102 | obtain ⟨hswap, hiE, -⟩ := swap_ii (M := 4) hab hL.le (G := fun z x => ψ (z + x)) |
| 103 | (hψm.comp measurable_add) fun z hz x hx => hψ4 _ ⟨by linarith [hz.1, hx.1], by linarith [hz.2, hx.2]⟩ |
| 104 | obtain ⟨-, hiA, -⟩ := swap_ii (M := 2) hab hL.le (G := fun z x => h (z + x)) |
| 105 | (hh.comp measurable_add) fun z hz x hx => hh2 _ ⟨by linarith [hz.1, hx.1], by linarith [hz.2, hx.2]⟩ |
| 106 | have iEab : IntervalIntegrable E volume a b := |
| 107 | intervalIntegrable_const.add (hiE.const_mul L⁻¹) |
| 108 | have iAab : IntervalIntegrable A volume a b := hiA.const_mul L⁻¹ |
| 109 | have iuab : IntervalIntegrable (fun z => |h z - g z|) volume a b := |
| 110 | ii_of_bdd hab hu fun x hx => by rw [abs_abs]; exact hu3 x ⟨hx.1, by linarith [hx.2]⟩ |
| 111 | have ihab : IntervalIntegrable h volume a b := |
| 112 | ii_of_bdd hab hh fun x hx => hh2 x ⟨hx.1, by linarith [hx.2]⟩ |
| 113 | have igab : IntervalIntegrable g volume a b := ii_of_bdd (M := 1) hab hg fun x _ => hg1 x |
| 114 | have hmain : ∫ z in a..b, α * g z ≤ ∫ z in a..b, (|h z - g z| + E z + |h z - A z|) := |
| 115 | intervalIntegral.integral_mono_on hab (igab.const_mul α) ((iuab.add iEab).add (ihab.sub iAab).abs) |
| 116 | hpt |
| 117 | rw [intervalIntegral.integral_add (iuab.add iEab) (ihab.sub iAab).abs, |
| 118 | intervalIntegral.integral_add iuab iEab, intervalIntegral.integral_const_mul] at hmain |
| 119 | -- the three pieces |
| 120 | have hdev := avg_dev hh hab hL (M := 2) hh2 hR |
| 121 | have hEint : ∫ z in a..b, E z ≤ 3 * (b - a) / L + ∫ x in a..(b + L), ψ x := by |
| 122 | have h1 : ∫ z in a..b, E z = 3 / L * (b - a) + L⁻¹ * ∫ z in a..b, ∫ x in (0 : ℝ)..L, ψ (z + x) := by |
| 123 | simp only [hE] |
| 124 | rw [intervalIntegral.integral_add intervalIntegrable_const (hiE.const_mul L⁻¹), |
| 125 | intervalIntegral.integral_const_mul] |
| 126 | simp only [intervalIntegral.integral_const, smul_eq_mul] |
| 127 | ring |
| 128 | have h2 := avg_le (M := 4) hψm hψ0 hab hL hψ4 |
| 129 | rw [h1] |
| 130 | have h3 : L⁻¹ * ∫ z in a..b, ∫ x in (0 : ℝ)..L, ψ (z + x) ≤ ∫ x in a..(b + L), ψ x := by |
| 131 | calc L⁻¹ * ∫ z in a..b, ∫ x in (0 : ℝ)..L, ψ (z + x) ≤ L⁻¹ * (L * ∫ x in a..(b + L), ψ x) := |
| 132 | mul_le_mul_of_nonneg_left h2 (inv_nonneg.2 hL.le) |
| 133 | _ = _ := by field_simp |
| 134 | have h4 : 3 / L * (b - a) = 3 * (b - a) / L := by ring |
| 135 | linarith |
| 136 | have hu_mono : ∫ z in a..b, |h z - g z| ≤ ∫ x in a..(b + L), |h x - g x| := |
| 137 | intervalIntegral.integral_mono_interval le_rfl hab (by linarith) |
| 138 | (Filter.Eventually.of_forall fun x => abs_nonneg _) |
| 139 | (ii_of_bdd hLab hu fun x hx => by rw [abs_abs]; exact hu3 x hx) |
| 140 | have hψint : ∫ x in a..(b + L), ψ x = (∫ x in a..(b + L), γ x) + ∫ x in a..(b + L), |h x - g x| := |
| 141 | intervalIntegral.integral_add |
| 142 | (ii_of_bdd (M := 1) hLab hγ fun x _ => hγ1' x) |
| 143 | (ii_of_bdd hLab hu fun x hx => by rw [abs_abs]; exact hu3 x hx) |
| 144 | linarith |
| 145 | |
| 146 | end E424 |
| 147 | |