File size: 13,665 Bytes
9b6e014
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
import Mathlib
import OAI.Probability.Ballisticity.Estimates.GridOscillation

namespace OAI

section
section
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Pointwise Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Pointwise Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical BoundedContinuousFunction
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical BoundedContinuousFunction
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology Classical
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology
namespace DirectionalTransience

lemma sum_window_difference (x : ℕ → ℝ) (k j m : ℕ)
    (hj : j ≤ k+m) (hk : k ≤ j+m) :
    |realPartialSum x j-realPartialSum x k| ≤
      2*partialSumMax (fun l => x (k-m+l)) (2*m) := by
  let s := k-m
  have hs : s ≤ j := by dsimp [s]; omega
  have hs' : s ≤ k := Nat.sub_le _ _
  have hjm : j-s ≤ 2*m := by dsimp [s]; omega
  have hkm : k-s ≤ 2*m := by dsimp [s]; omega
  have he (a : ℕ) (ha : s ≤ a) :
      realPartialSum x a = realPartialSum x s+realPartialSum (fun l => x (s+l)) (a-s) := by
    rw [← realPartialSum_add,Nat.add_sub_of_le ha]
  rw [he j hs,he k hs']
  have hb1 := (abs_partialSum_le_max (fun l => x (s+l)) (j-s)).trans
    (partialSumMax_mono _ hjm)
  have hb2 := (abs_partialSum_le_max (fun l => x (s+l)) (k-s)).trans
    (partialSumMax_mono _ hkm)
  have h := abs_sub (realPartialSum (fun l => x (s+l)) (j-s))
    (realPartialSum (fun l => x (s+l)) (k-s))
  rw [add_sub_add_left_eq_sub]
  dsimp [s] at hb1 hb2 h
  linarith

theorem iid_random_clock_error {Ω : Type*} [MeasurableSpace Ω]
    (μ : Measure Ω) [IsProbabilityMeasure μ] (X : ℕ → Ω → ℝ)
    (hX : ∀ j, Measurable (X j)) (hind : iIndepFun X μ)
    (hid : ∀ j, IdentDistrib (X j) (X 0) μ μ)
    (hsym : IdentDistrib (X 0) (fun ω => -X 0 ω) μ μ)
    (hI : Integrable (X 0) μ) (hne : 0 < μ {ω | X 0 ω ≠ 0})
    (r : ℕ → ℝ) (hr : Tendsto r atTop atTop) (K : ℕ → ℕ) (C : ℕ → Ω → ℕ)
    (hclock : TendstoInMeasure μ (fun i ω => ((C i ω : ℝ)-K i)/fluctuationScale μ (X 0) (r i)) atTop 0) :
    TendstoInMeasure μ (fun i ω => (realPartialSum (fun j => X j ω) (C i ω)-
      realPartialSum (fun j => X j ω) (K i))/r i) atTop 0 := by
  let n := fun i => fluctuationScale μ (X 0) (r i)
  have hn : Tendsto n atTop atTop := (fluctuationScale_tendsto μ (X 0) (hX 0) hI hne).comp hr
  apply tendstoInMeasure_iff_measureReal_norm.2
  intro ε hε
  simp only [Pi.zero_apply,sub_zero,Real.norm_eq_abs]
  apply tendsto_order.mpr
  constructor
  · intro a ha
    exact Eventually.of_forall (fun _ => ha.trans_le measureReal_nonneg)
  · intro η hη
    let ρ := min (ε/4) 1
    have hρ : 0 < ρ := lt_min (by positivity) zero_lt_one
    have hρ1 : ρ ≤ 1 := min_le_right _ _
    have hρε : ρ ≤ ε/4 := min_le_left _ _
    let δ := η*ρ^2/40
    have hδ : 0 < δ := by dsimp [δ]; positivity
    let A := fun i => {ω | δ ≤ |((C i ω : ℝ)-K i)/n i|}
    have ht : Tendsto (fun i => μ.real (A i)) atTop (𝓝 0) := by
      simpa only [Pi.zero_apply,sub_zero,Real.norm_eq_abs] using
        (tendstoInMeasure_iff_measureReal_norm.mp hclock δ hδ)
    have hinv : Tendsto (fun i => 1/n i) atTop (𝓝 0) := by
      simpa only [one_div,Function.comp_def] using tendsto_inv_atTop_zero.comp hn
    have hb : Tendsto (fun i => μ.real (A i)+10*(δ+1/n i)/ρ^2) atTop (𝓝 (η/4)) := by
      have hh := ht.add ((((tendsto_const_nhds (x := δ)).add hinv).const_mul 10).div_const (ρ^2))
      have he : 0+10*(δ+0)/ρ^2 = η/4 := by
        dsimp [δ]
        field_simp [ne_of_gt hρ]; ring
      rwa [he] at hh
    filter_upwards [hr.eventually (eventually_gt_atTop (0:ℝ)),
      hb.eventually (gt_mem_nhds (show η/4 < η by linarith))] with i hri hbi
    have hni : 0 < n i := div_pos (sq_pos_of_pos hri) (truncatedVariance_pos μ (X 0) (hX 0) hne hri)
    let m := ⌈δ*n i⌉₊
    have hm : δ*n i ≤ (m:ℝ) := Nat.le_ceil _
    have hm' : (m:ℝ) ≤ δ*n i+1 := (Nat.ceil_lt_add_one (mul_nonneg hδ.le hni.le)).le
    let B := {ω | ρ*r i < partialSumMax (fun j => X (K i-m+j) ω) (2*m)}
    have hsub : {ω | ε ≤ |(realPartialSum (fun j => X j ω) (C i ω)-
        realPartialSum (fun j => X j ω) (K i))/r i|} ⊆ A i ∪ B := by
      intro ω hω
      change ε ≤ |(realPartialSum (fun j => X j ω) (C i ω)-
        realPartialSum (fun j => X j ω) (K i))/r i| at hω
      by_cases ha : ω ∈ A i
      · exact Or.inl ha
      · apply Or.inr
        have ha' : |(C i ω : ℝ)-K i| < δ*n i := by
          change ¬δ ≤ |((C i ω : ℝ)-K i)/n i| at ha
          rwa [abs_div,abs_of_pos hni,not_le,div_lt_iff₀ hni] at ha
        have hle := abs_le.mp (ha'.le.trans hm)
        have hj : C i ω ≤ K i+m := by exact_mod_cast (show (C i ω : ℝ) ≤ K i+m by linarith)
        have hk : K i ≤ C i ω+m := by exact_mod_cast (show (K i : ℝ) ≤ C i ω+m by linarith)
        have hw := sum_window_difference (fun j => X j ω) (K i) (C i ω) m hj hk
        rw [abs_div,abs_of_pos hri,le_div_iff₀ hri] at hω
        change ρ*r i < partialSumMax (fun j => X (K i-m+j) ω) (2*m)
        nlinarith
    have hp : μ.real B ≤ 10*(δ+1/n i)/ρ^2 := by
      dsimp only [B]
      rw [measureReal_shifted_max μ X hind hid]
      have hh := measureReal_partialSumMax_gt_le μ X hX hind hid hsym (mul_pos hρ hri) (2*m)
      have hs := fluctuationScale_scaling μ (X 0) (hX 0) hne hri hρ hρ1
      have hbound : 5*(2*m:ℕ)/fluctuationScale μ (X 0) (ρ*r i) ≤ 10*(δ+1/n i)/ρ^2 := by
        calc
          _ ≤ 5*(2*m:ℕ)/(ρ^2*n i) := div_le_div_of_nonneg_left (by positivity) (by positivity) hs
          _ ≤ 10*(δ*n i+1)/(ρ^2*n i) := by
            apply div_le_div_of_nonneg_right _ (by positivity)
            push_cast
            nlinarith
          _ = _ := by field_simp
      rw [← div_div_eq_mul_div] at hh
      exact hh.trans hbound
    exact ((measureReal_mono (μ := μ) hsub).trans (measureReal_union_le _ _)).trans_lt
      (lt_of_le_of_lt (add_le_add le_rfl hp) hbi)

end DirectionalTransience

open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal BigOperators Topology

end
end

end OAI