File size: 8,283 Bytes
180bc03
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
import OAI.NumberTheory.TwoPointCorrelations.HalaszPhaseIntegral

namespace OAI

/-! A uniform power-sum estimate, using centered cells past the frequency. -/

namespace TwoPointCorrelations

open MeasureTheory Finset

lemma halasz_phase_cells_telescope (t : ℝ) (A N : ℕ) (hA : 1 ≤ A) (hAN : A ≤ N) :
    (∑ n ∈ Ioc A N, ∫ x in ((n : ℝ) - 1 / 2)..((n : ℝ) + 1 / 2),
      halaszPowerPhase t x) =
      ∫ x in ((A : ℝ) + 1 / 2)..((N : ℝ) + 1 / 2), halaszPowerPhase t x := by
  induction N, hAN using Nat.le_induction with
  | base => simp
  | succ N hAN ih =>
    rw [sum_Ioc_succ_top hAN, ih]
    have he : ((N + 1 : ℕ) : ℝ) - 1 / 2 = (N : ℝ) + 1 / 2 := by push_cast; ring
    rw [he]
    apply intervalIntegral.integral_add_adjacent_intervals
    · exact halasz_power_phase_intervalIntegrable t ((A : ℝ) + 1 / 2)
        ((N : ℝ) + 1 / 2) (by positivity) (by positivity)
    · exact halasz_power_phase_intervalIntegrable t ((N : ℝ) + 1 / 2)
        (((N + 1 : ℕ) : ℝ) + 1 / 2) (by positivity) (by positivity)

lemma halasz_phase_cell_sum_error (t : ℝ) (A N : ℕ) (hA : 1 ≤ A)
    (hAN : A ≤ N) (ht : |t| ≤ (A : ℝ)) :
    ‖(∑ n ∈ Ioc A N, halaszPowerPhase t n) -
      ∫ x in ((A : ℝ) + 1 / 2)..((N : ℝ) + 1 / 2), halaszPowerPhase t x‖ ≤
      (t ^ 2 + |t|) / A := by
  rw [← halasz_phase_cells_telescope t A N hA hAN, ← sum_sub_distrib]
  calc
    _ ≤ ∑ n ∈ Ioc A N,
        ‖halaszPowerPhase t n -
          ∫ x in ((n : ℝ) - 1 / 2)..((n : ℝ) + 1 / 2), halaszPowerPhase t x‖ :=
      norm_sum_le _ _
    _ ≤ ∑ n ∈ Ioc A N, (t ^ 2 + |t|) / (n : ℝ) ^ 2 := by
      apply sum_le_sum
      intro n hn
      have hnA := (mem_Ioc.mp hn).1
      have hn1 : (1 : ℝ) ≤ n := by exact_mod_cast hA.trans hnA.le
      have htn : |t| ≤ (n : ℝ) := ht.trans (by exact_mod_cast hnA.le)
      have hh := halasz_power_phase_cell_integral t n hn1 htn
      rw [intervalIntegral.integral_comp_add_left] at hh
      have he : (n : ℝ) + (-1 / 2) = (n : ℝ) - 1 / 2 := by ring
      rw [he] at hh
      simpa only [norm_sub_rev] using hh
    _ = (t ^ 2 + |t|) * ∑ n ∈ Ioc A N, ((n : ℝ) ^ 2)⁻¹ := by
      simp_rw [div_eq_mul_inv, mul_sum]
    _ ≤ (t ^ 2 + |t|) * ((A : ℝ)⁻¹ - (N : ℝ)⁻¹) :=
      mul_le_mul_of_nonneg_left (sum_Ioc_inv_sq_le_sub (by omega : A ≠ 0) hAN) (by positivity)
    _ ≤ (t ^ 2 + |t|) / A := by
      rw [div_eq_mul_inv]
      exact mul_le_mul_of_nonneg_left (sub_le_self _ (by positivity)) (by positivity)

lemma halasz_power_phase_prefix_norm (t : ℝ) (N : ℕ) :
    ‖∑ n ∈ Ioc 0 N, halaszPowerPhase t n‖ ≤ N := by
  calc
    _ ≤ ∑ n ∈ Ioc 0 N, ‖halaszPowerPhase t n‖ := norm_sum_le _ _
    _ = _ := by simp

theorem halasz_power_phase_sum_integral (t : ℝ) (N : ℕ) :
    ‖(∑ n ∈ Ioc 0 N, halaszPowerPhase t n) -
      ∫ x in (0 : ℝ)..(N : ℝ), halaszPowerPhase t x‖ ≤ 8 * (1 + |t|) := by
  let A : ℕ := ⌈1 + |t|⌉₊
  have hAlo : 1 + |t| ≤ (A : ℝ) := Nat.le_ceil _
  have hAhi : (A : ℝ) < 2 + |t| := by
    have hh : (A : ℝ) < 1 + |t| + 1 := Nat.ceil_lt_add_one (by positivity)
    linarith
  have hA1 : 1 ≤ A := by exact_mod_cast (show (1 : ℝ) ≤ A by linarith [abs_nonneg t])
  have hi (a b : ℝ) (ha : 0 ≤ a) (hb : 0 ≤ b) :=
    halasz_power_phase_intervalIntegrable t a b ha hb
  have hb : ∀ M : ℕ,
      ‖(∑ n ∈ Ioc 0 M, halaszPowerPhase t n) -
        ∫ x in (0 : ℝ)..(M : ℝ), halaszPowerPhase t x‖ ≤ 2 * M := by
    intro M
    calc
      _ ≤ ‖∑ n ∈ Ioc 0 M, halaszPowerPhase t n‖ +
          ‖∫ x in (0 : ℝ)..(M : ℝ), halaszPowerPhase t x‖ := norm_sub_le _ _
      _ ≤ (M : ℝ) + M := add_le_add (halasz_power_phase_prefix_norm t M)
        (by simpa using halasz_power_phase_integral_norm t 0 M)
      _ = _ := by ring
  by_cases hNA : N ≤ A
  · have hNr : (N : ℝ) ≤ A := by exact_mod_cast hNA
    exact (hb N).trans (by linarith [abs_nonneg t])
  · have hAN : A ≤ N := by omega
    have hs := sum_Ioc_consecutive (fun n : ℕ => halaszPowerPhase t n)
      (Nat.zero_le A) hAN
    have hj := intervalIntegral.integral_add_adjacent_intervals
      (hi 0 ((A : ℝ) + 1 / 2) (by norm_num) (by positivity))
      (hi ((A : ℝ) + 1 / 2) ((N : ℝ) + 1 / 2) (by positivity) (by positivity))
    have hk := intervalIntegral.integral_add_adjacent_intervals
      (hi 0 N (by norm_num) (by positivity))
      (hi N ((N : ℝ) + 1 / 2) (by positivity) (by positivity))
    have he : (∑ n ∈ Ioc 0 N, halaszPowerPhase t n) -
        ∫ x in (0 : ℝ)..(N : ℝ), halaszPowerPhase t x =
        ((∑ n ∈ Ioc 0 A, halaszPowerPhase t n) -
          ∫ x in (0 : ℝ)..((A : ℝ) + 1 / 2), halaszPowerPhase t x) +
        ((∑ n ∈ Ioc A N, halaszPowerPhase t n) -
          ∫ x in ((A : ℝ) + 1 / 2)..((N : ℝ) + 1 / 2), halaszPowerPhase t x) +
        ∫ x in (N : ℝ)..((N : ℝ) + 1 / 2), halaszPowerPhase t x := by
      rw [← hs]
      linear_combination hj - hk
    have hhead : ‖(∑ n ∈ Ioc 0 A, halaszPowerPhase t n) -
        ∫ x in (0 : ℝ)..((A : ℝ) + 1 / 2), halaszPowerPhase t x‖ ≤ 2 * A + 1 / 2 := by
      calc
        _ ≤ ‖∑ n ∈ Ioc 0 A, halaszPowerPhase t n‖ +
            ‖∫ x in (0 : ℝ)..((A : ℝ) + 1 / 2), halaszPowerPhase t x‖ := norm_sub_le _ _
        _ ≤ (A : ℝ) + ((A : ℝ) + 1 / 2) := add_le_add (halasz_power_phase_prefix_norm t A)
          (by
            have hh := halasz_power_phase_integral_norm t 0 ((A : ℝ) + 1 / 2)
            rw [sub_zero, abs_of_nonneg (by positivity)] at hh
            exact hh)
        _ = _ := by ring
    have htail := halasz_phase_cell_sum_error t A N hA1 hAN (by linarith)
    have hend : ‖∫ x in (N : ℝ)..((N : ℝ) + 1 / 2), halaszPowerPhase t x‖ ≤ 1 / 2 := by
      simpa using halasz_power_phase_integral_norm t N ((N : ℝ) + 1 / 2)
    have hratio : (t ^ 2 + |t|) / (A : ℝ) ≤ |t| := by
      apply (div_le_iff₀ (by exact_mod_cast (show 0 < A by omega))).mpr
      have hm := mul_le_mul_of_nonneg_left hAlo (abs_nonneg t)
      nlinarith [sq_abs t]
    rw [he]
    exact ((norm_add_le _ _).trans (add_le_add
      ((norm_add_le _ _).trans (add_le_add hhead htail)) hend)).trans
        (by linarith [abs_nonneg t])

theorem halasz_power_phase_sum (t : ℝ) (N : ℕ) :
    ‖(∑ n ∈ Icc 1 N, halaszPowerPhase t n) -
      (N : ℂ) * halaszPowerPhase t N / (1 + (-t : ℂ) * Complex.I)‖ ≤
        8 * (1 + |t|) := by
  have hset : Icc 1 N = Ioc 0 N := by ext n; simp; omega
  have hh := halasz_power_phase_sum_integral t N
  rw [halasz_power_phase_integral t 0 N (by norm_num) (by positivity)] at hh
  simpa [hset] using hh

theorem halasz_power_phase_sum_real (t x : ℝ) (hx : 0 ≤ x) :
    ‖(∑ n ∈ Icc 1 ⌊x⌋₊, halaszPowerPhase t n) -
      (x : ℂ) * halaszPowerPhase t x / (1 + (-t : ℂ) * Complex.I)‖ ≤
        9 * (1 + |t|) := by
  have hN : (⌊x⌋₊ : ℝ) ≤ x := Nat.floor_le hx
  have hN' : x - (⌊x⌋₊ : ℝ) < 1 := by linarith [Nat.lt_floor_add_one x]
  have hj := intervalIntegral.integral_add_adjacent_intervals
    (halasz_power_phase_intervalIntegrable t 0 ⌊x⌋₊ (by norm_num) (by positivity))
    (halasz_power_phase_intervalIntegrable t ⌊x⌋₊ x (by positivity) hx)
  have he : (∑ n ∈ Icc 1 ⌊x⌋₊, halaszPowerPhase t n) -
      ∫ y in (0 : ℝ)..x, halaszPowerPhase t y =
      ((∑ n ∈ Icc 1 ⌊x⌋₊, halaszPowerPhase t n) -
        ∫ y in (0 : ℝ)..(⌊x⌋₊ : ℝ), halaszPowerPhase t y) -
      ∫ y in (⌊x⌋₊ : ℝ)..x, halaszPowerPhase t y := by
    rw [← hj]
    ring
  have hset : Icc 1 ⌊x⌋₊ = Ioc 0 ⌊x⌋₊ := by ext n; simp; omega
  have hh := halasz_power_phase_sum_integral t ⌊x⌋₊
  rw [← hset] at hh
  have ht : ‖∫ y in (⌊x⌋₊ : ℝ)..x, halaszPowerPhase t y‖ ≤ 1 := by
    apply (halasz_power_phase_integral_norm t ⌊x⌋₊ x).trans
    rw [abs_of_nonneg (sub_nonneg.mpr hN)]
    exact hN'.le
  have h := ((norm_sub_le _ _).trans (add_le_add hh ht)).trans
    (show 8 * (1 + |t|) + 1 ≤ 9 * (1 + |t|) by linarith [abs_nonneg t])
  rw [← he, halasz_power_phase_integral t 0 x (by norm_num) hx] at h
  simpa using h

end TwoPointCorrelations

end OAI