| 1 | module |
| 2 | |
| 3 | public import E424.DirichletError.Basic |
| 4 | public import E424.Tools.T6 |
| 5 | |
| 6 | @[expose] public section |
| 7 | |
| 8 | /-! |
| 9 | # L29, step 1: Gallagher's lemma in discrete form |
| 10 | -/ |
| 11 | |
| 12 | set_option linter.style.header false |
| 13 | open Finset MeasureTheory |
| 14 | |
| 15 | namespace E424 |
| 16 | |
| 17 | /-- `∑_{h=1}^ℓ a (p + h)`. -/ |
| 18 | noncomputable def Sh (a : ℕ → ℝ) (p l : ℕ) : ℝ := ∑ h ∈ Icc 1 l, a (p + h) |
| 19 | |
| 20 | /-- `L` with `p ∈ (L/δ, (L+1)/δ]`. -/ |
| 21 | noncomputable def Lp (δ : ℝ) (p : ℕ) : ℕ := ⌈δ * p⌉₊ - 1 |
| 22 | |
| 23 | theorem Sh_eq_Ioc (a : ℕ → ℝ) (p l : ℕ) : Sh a p l = ∑ n ∈ Ioc p (p + l), a n := by |
| 24 | unfold Sh |
| 25 | refine sum_bij' (fun h _ => p + h) (fun n _ => n - p) ?_ ?_ ?_ ?_ ?_ <;> |
| 26 | intros <;> simp_all <;> omega |
| 27 | |
| 28 | theorem Lp_spec {δ : ℝ} {p : ℕ} (h : 0 < δ * p) : (Lp δ p : ℝ) < δ * p ∧ δ * p ≤ Lp δ p + 1 := by |
| 29 | have h1 : 1 ≤ ⌈δ * p⌉₊ := Nat.one_le_iff_ne_zero.mpr (Nat.ceil_pos.mpr h).ne' |
| 30 | have h2 := Nat.ceil_lt_add_one h.le |
| 31 | have h3 := Nat.le_ceil (δ * p) |
| 32 | unfold Lp |
| 33 | rw [Nat.cast_sub h1]; push_cast |
| 34 | constructor <;> linarith |
| 35 | |
| 36 | theorem exp_inv_bounds {T : ℝ} (hT : 4 ≤ T) : |
| 37 | 1 / T < Real.exp (1 / T) - 1 ∧ Real.exp (1 / T) - 1 ≤ 1 / T + (1 / T) ^ 2 ∧ |
| 38 | Real.exp (1 / T) ≤ 3 / 2 := by |
| 39 | have hT0 : 0 < T := by linarith |
| 40 | have h0 : 0 < 1 / T := by positivity |
| 41 | have h1 : 1 / T ≤ 1 / 4 := by gcongr |
| 42 | have h2 := Real.abs_exp_sub_one_sub_id_le (x := 1 / T) (by rw [abs_of_pos h0]; linarith) |
| 43 | have h3 := (abs_le.mp h2).2 |
| 44 | have h4 := Real.add_one_lt_exp h0.ne' |
| 45 | refine ⟨by linarith, by linarith, by nlinarith⟩ |
| 46 | |
| 47 | /-- The step value majorising Gallagher's integrand on `[p, p+1)`. -/ |
| 48 | noncomputable def stepC (T : ℝ) (a : ℕ → ℝ) (p : ℕ) : ℝ := |
| 49 | (∑ j ∈ range 4, Sh a p (Lp (Real.exp (1 / T) - 1) p + j) ^ 2) / p |
| 50 | |
| 51 | theorem stepC_nonneg (T : ℝ) (a : ℕ → ℝ) (p : ℕ) : 0 ≤ stepC T a p := by |
| 52 | unfold stepC; exact div_nonneg (sum_nonneg fun _ _ => sq_nonneg _) (Nat.cast_nonneg p) |
| 53 | |
| 54 | theorem gallagher_pointwise {N T : ℝ} (hN : 12 ≤ N) (hT : 4 ≤ T) (a : ℕ → ℝ) |
| 55 | (ha : ∀ n, a n ≠ 0 → N < n ∧ (n : ℝ) < 4 * N) (y : ℝ) (hy : 0 < y) (s : Finset ℕ) |
| 56 | (hs : ∀ n, n ∈ s ↔ n ∈ Icc 1 ⌊4 * N⌋₊ ∧ y < (n : ℝ) ∧ (n : ℝ) ≤ Real.exp (1 / T) * y) : |
| 57 | (∑ n ∈ s, a n) ^ 2 / y ≤ |
| 58 | if ⌊y⌋₊ ∈ Icc ⌈N / 2⌉₊ ⌊4 * N⌋₊ then stepC T a ⌊y⌋₊ else 0 := by |
| 59 | obtain ⟨hd1, -, hphi⟩ := exp_inv_bounds hT |
| 60 | set φ := Real.exp (1 / T) with hφ |
| 61 | have hd0 : 0 < φ - 1 := lt_trans (by positivity) hd1 |
| 62 | set p := ⌊y⌋₊ with hp |
| 63 | have hp1 : (p : ℝ) ≤ y := Nat.floor_le hy.le |
| 64 | have hp2 : y < p + 1 := Nat.lt_floor_add_one y |
| 65 | have hφy : y ≤ φ * y := by nlinarith |
| 66 | have hle : p ≤ ⌊φ * y⌋₊ := Nat.floor_mono hφy |
| 67 | have hsum : ∑ n ∈ s, a n = Sh a p (⌊φ * y⌋₊ - p) := by |
| 68 | rw [Sh_eq_Ioc, Nat.add_sub_cancel' hle] |
| 69 | refine sum_subset ?_ ?_ |
| 70 | · intro n hn |
| 71 | obtain ⟨-, h2, h3⟩ := (hs n).mp hn |
| 72 | rw [mem_Ioc, Nat.floor_lt hy.le, Nat.le_floor_iff (by positivity)] |
| 73 | exact ⟨h2, h3⟩ |
| 74 | · intro n hn hns |
| 75 | rw [mem_Ioc, Nat.floor_lt hy.le, Nat.le_floor_iff (by positivity)] at hn |
| 76 | by_contra h |
| 77 | refine hns ((hs n).mpr ⟨?_, hn⟩) |
| 78 | rw [mem_Icc, Nat.le_floor_iff (by linarith)] |
| 79 | refine ⟨?_, (ha n h).2.le⟩ |
| 80 | have : (0 : ℝ) < n := by linarith [hn.1] |
| 81 | exact_mod_cast this |
| 82 | rw [hsum] |
| 83 | by_cases h0 : Sh a p (⌊φ * y⌋₊ - p) = 0 |
| 84 | · rw [h0]; simp only [ne_eq, OfNat.ofNat_ne_zero, not_false_eq_true, zero_pow, zero_div] |
| 85 | split_ifs |
| 86 | · exact stepC_nonneg _ _ _ |
| 87 | · exact le_rfl |
| 88 | · rw [Sh_eq_Ioc, Nat.add_sub_cancel' hle] at h0 |
| 89 | obtain ⟨n, hn, hne⟩ := exists_ne_zero_of_sum_ne_zero h0 |
| 90 | rw [mem_Ioc, Nat.floor_lt hy.le, Nat.le_floor_iff (by positivity)] at hn |
| 91 | obtain ⟨hn1, hn2⟩ := ha n hne |
| 92 | have hy1 : y < 4 * N := by linarith [hn.1] |
| 93 | have hy2 : N < 3 / 2 * y := by nlinarith [hn.2] |
| 94 | have hmem : p ∈ Icc ⌈N / 2⌉₊ ⌊4 * N⌋₊ := by |
| 95 | rw [mem_Icc] |
| 96 | exact ⟨Nat.ceil_le.mpr (by linarith), (Nat.le_floor_iff (by linarith)).mpr (by linarith)⟩ |
| 97 | rw [if_pos hmem] |
| 98 | have hpos : (0 : ℝ) < p := by linarith |
| 99 | obtain ⟨hL1, hL2⟩ := Lp_spec (mul_pos hd0 hpos) |
| 100 | set L := Lp (φ - 1) p with hLdef |
| 101 | have hA : p + L ≤ ⌊φ * y⌋₊ := by |
| 102 | rw [Nat.le_floor_iff (by positivity)]; push_cast; nlinarith |
| 103 | have hB : ⌊φ * y⌋₊ < p + L + 4 := by |
| 104 | rw [Nat.floor_lt (by positivity)]; push_cast; nlinarith |
| 105 | have hj : ⌊φ * y⌋₊ - p = L + (⌊φ * y⌋₊ - p - L) := by omega |
| 106 | unfold stepC |
| 107 | rw [hj] |
| 108 | have h1 : Sh a p (L + (⌊φ * y⌋₊ - p - L)) ^ 2 ≤ ∑ j ∈ range 4, Sh a p (L + j) ^ 2 := |
| 109 | single_le_sum (f := fun j => Sh a p (L + j) ^ 2) (fun _ _ => sq_nonneg _) |
| 110 | (mem_range.mpr (by omega)) |
| 111 | have h2 : 0 ≤ ∑ j ∈ range 4, Sh a p (L + j) ^ 2 := sum_nonneg fun _ _ => sq_nonneg _ |
| 112 | exact div_le_div₀ h2 h1 hpos hp1 |
| 113 | |
| 114 | /-- Gallagher's lemma, discretised. -/ |
| 115 | theorem gallagher_disc : ∃ C > 0, ∀ N T : ℝ, 12 ≤ N → 4 ≤ T → ∀ a : ℕ → ℝ, |
| 116 | (∀ n, a n ≠ 0 → N < n ∧ (n : ℝ) < 4 * N) → |
| 117 | ∫ t in (-T)..T, ‖∑ n ∈ Icc 1 ⌊4 * N⌋₊, (a n : ℂ) * nit n t‖ ^ 2 ≤ |
| 118 | C * T ^ 2 * ∑ p ∈ Icc ⌈N / 2⌉₊ ⌊4 * N⌋₊, stepC T a p := by |
| 119 | obtain ⟨C, hC, h⟩ := T6_gallagher |
| 120 | refine ⟨C, hC, fun N T hN hT a ha => ?_⟩ |
| 121 | refine (h T (by linarith) (Icc 1 ⌊4 * N⌋₊) (fun n => (a n : ℂ)) |
| 122 | fun n hn => (mem_Icc.mp hn).1).trans ?_ |
| 123 | refine mul_le_mul_of_nonneg_left ?_ (by positivity) |
| 124 | set P := Icc ⌈N / 2⌉₊ ⌊4 * N⌋₊ with hP |
| 125 | let g : ℝ → ℝ := fun y => ∑ p ∈ P, (Set.Ico (p : ℝ) (p + 1)).indicator (fun _ => stepC T a p) y |
| 126 | have hgi : ∀ p ∈ P, Integrable ((Set.Ico (p : ℝ) (p + 1)).indicator fun _ => stepC T a p) := by |
| 127 | intro p _ |
| 128 | rw [integrable_indicator_iff measurableSet_Ico] |
| 129 | exact integrableOn_const (by simp) |
| 130 | have hgint : ∫ y, g y = ∑ p ∈ P, stepC T a p := by |
| 131 | rw [integral_finsetSum _ hgi] |
| 132 | refine sum_congr rfl fun p _ => ?_ |
| 133 | rw [integral_indicator measurableSet_Ico, setIntegral_const] |
| 134 | simp |
| 135 | have hg0 : ∀ y, 0 ≤ g y := fun y => sum_nonneg fun p _ => |
| 136 | Set.indicator_nonneg (fun _ _ => stepC_nonneg _ _ _) _ |
| 137 | rw [← hgint, ← integral_indicator measurableSet_Ioi] |
| 138 | refine integral_mono_of_nonneg ?_ (integrable_finsetSum _ hgi) ?_ |
| 139 | · exact Filter.Eventually.of_forall fun y => |
| 140 | Set.indicator_nonneg (fun y hy => div_nonneg (by positivity) (le_of_lt hy)) y |
| 141 | · refine Filter.Eventually.of_forall fun y => ?_ |
| 142 | by_cases hy : y ∈ Set.Ioi (0 : ℝ) |
| 143 | · rw [Set.indicator_of_mem hy] |
| 144 | have hy0 : 0 < y := hy |
| 145 | rw [← Complex.ofReal_sum, Complex.norm_real, Real.norm_eq_abs, sq_abs] |
| 146 | refine (gallagher_pointwise hN hT a ha y hy0 _ fun n => ?_).trans ?_ |
| 147 | · rw [mem_filter] |
| 148 | · split_ifs with hm |
| 149 | · refine le_trans (le_of_eq ?_) (single_le_sum (f := fun p : ℕ => |
| 150 | (Set.Ico (p : ℝ) (p + 1)).indicator (fun _ => stepC T a p) y) |
| 151 | (fun p _ => Set.indicator_nonneg (fun _ _ => stepC_nonneg _ _ _) _) hm) |
| 152 | rw [Set.indicator_of_mem] |
| 153 | exact ⟨Nat.floor_le hy0.le, Nat.lt_floor_add_one y⟩ |
| 154 | · exact hg0 y |
| 155 | · rw [Set.indicator_of_notMem hy]; exact hg0 y |
| 156 | |
| 157 | end E424 |
| 158 | |