File size: 14,799 Bytes
caec230
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
276
277
278
279
280
281
282
import OAI.MathematicalPhysics.RapidForcing.RawMachine
import OAI.MathematicalPhysics.RapidForcing.ScaledSyntax

namespace OAI

section
open scoped BigOperators Topology ENNReal ContDiff
open Set Filter
namespace RapidForcing
lemma addressCurl_jetBound (M : Machine) (w : M.Input) (k : ℕ) :
    ∀ n m : ℕ, ∀ p : ℝ × Space,
      ‖iteratedFDeriv ℝ k (fun q : ℝ × Space =>
        movingCurl (addressPath M (M.scaleData w) n m) ((M.scaleData w).δ n)
          (q.1 - 1 - (n : ℝ)) q.2) p‖ ≤
        (EffectiveProfile.Formula.curlJetBound k : ℝ) * ((M.scaleData w).b n / (M.scaleData w).δ n ^ k) := by
  let C : ℝ := EffectiveProfile.Formula.curlJetBound k
  have hbound := EffectiveProfile.Formula.curlJetBound_spec k
  intro n m p
  let d := M.scaleData w
  let η := (d.δ n)⁻¹ • addressDisplacement M d n m
  let ξ := (d.b n)⁻¹ • addressDisplacement M d n m
  have hsm : ContDiff ℝ (⊤ : ℕ∞) (Function.uncurry (scaledCurl η ξ)) := by
    change ContDiff ℝ (⊤ : ℕ∞)
      ((fun p : (Space × Space) × (ℝ × Space) => scaledCurl p.1.1 p.1.2 p.2.1 p.2.2) ∘
        (fun q : ℝ × Space => ((η, ξ), q)))
    exact scaledCurl_joint_smooth.comp (contDiff_const.prodMk contDiff_id)
  have heq : (fun q : ℝ × Space => movingCurl (addressPath M d n m) (d.δ n)
      (q.1 - 1 - (n : ℝ)) q.2) = (fun q : ℝ × Space =>
      d.b n • scaledCurl η ξ (q.1 - (1 + (n : ℝ)))
        ((d.δ n)⁻¹ • (q.2 - addressCenter d n m))) := by
    funext q
    change movingCurl (fun s => addressCenter d n m + θ s • addressDisplacement M d n m)
      (d.δ n) _ _ = _
    rw [movingCurl_normalized _ _ (d.delta_pos n).ne' (d.b_pos n).ne']
    change d.b n • scaledCurl η ξ (q.1 - 1 - (n : ℝ)) _ = _
    congr 2
    ring
  rw [heq]
  have hparam := address_parameters_bound M w n m
  have hbnd := norm_iteratedFDeriv_scaled hsm (hbound η ξ hparam.1 hparam.2)
    ((one_le_inv₀ (d.delta_pos n)).mpr (d.delta_le_one n))
    (d.b n) (1 + (n : ℝ)) (addressCenter d n m) p
  convert hbnd using 1
  · rfl
  · change C * (d.b n / d.δ n ^ k) = _
    rw [abs_of_pos (d.b_pos n), inv_pow]
    ring

lemma stepVelocity_jetBound (M : Machine) (w : M.Input) (k : ℕ) :
    ∀ n : ℕ, ∀ p : ℝ × Space,
      ‖iteratedFDeriv ℝ k (Function.uncurry (stepVelocity M w n)) p‖ ≤
        (2 * (EffectiveProfile.Formula.curlJetBound k : ℝ)) * ((M.scaleData w).b n / (M.scaleData w).δ n ^ (k + 1)) := by
  let C : ℝ := EffectiveProfile.Formula.curlJetBound k
  have hC : 0 ≤ C := by dsimp [C]; exact_mod_cast EffectiveProfile.Formula.curlJetBound_nonneg k
  have hb := addressCurl_jetBound M w k
  intro n p
  let d := M.scaleData w
  have hsm (m : ℕ) : ContDiff ℝ (⊤ : ℕ∞)
      (fun q : ℝ × Space => movingCurl (addressPath M d n m) (d.δ n)
        (q.1 - 1 - (n : ℝ)) q.2) := by
    change ContDiff ℝ (⊤ : ℕ∞)
      (Function.uncurry (movingCurl (addressPath M d n m) (d.δ n)) ∘
        (fun q : ℝ × Space => (q.1 - 1 - (n : ℝ), q.2)))
    exact (movingCurl_joint_smooth (addressPath_smooth M d n m) _).comp
      ((contDiff_fst.sub contDiff_const |>.sub contDiff_const).prodMk contDiff_snd)
  have hsum := iteratedFDeriv_fun_sum_apply (𝕜 := ℝ) (n := k) (x := p)
    (u := Finset.range (d.D n + 1)) (fun m _ => (hsm m |>.of_le
      (by exact_mod_cast (le_top : (k : ℕ∞) ≤ ⊤))).contDiffAt)
  change ‖iteratedFDeriv ℝ k (fun q : ℝ × Space => ∑ m ∈ Finset.range (d.D n + 1),
    movingCurl (addressPath M d n m) (d.δ n) (q.1 - 1 - (n : ℝ)) q.2) p‖ ≤ _
  rw [hsum]
  calc
    _ ≤ ∑ m ∈ Finset.range (d.D n + 1),
        ‖iteratedFDeriv ℝ k (fun q : ℝ × Space => movingCurl (addressPath M d n m)
          (d.δ n) (q.1 - 1 - (n : ℝ)) q.2) p‖ := norm_sum_le _ _
    _ ≤ ∑ m ∈ Finset.range (d.D n + 1), C * (d.b n / d.δ n ^ k) :=
      Finset.sum_le_sum (fun m _ => hb n m p)
    _ = ((d.D n : ℝ) + 1) * (C * (d.b n / d.δ n ^ k)) := by simp
    _ ≤ (2 * (d.δ n)⁻¹) * (C * (d.b n / d.δ n ^ k)) := by
      apply mul_le_mul_of_nonneg_right _ (mul_nonneg hC
        (div_nonneg (d.b_pos n).le (pow_nonneg (d.delta_nonneg n) k)))
      have hD : (d.D n : ℝ) = (d.δ n)⁻¹ := by rw [d.delta_eq_inv_D, inv_inv]
      rw [hD]
      have hi := (one_le_inv₀ (d.delta_pos n)).mpr (d.delta_le_one n)
      linarith
    _ = (2 * C) * (d.b n / d.δ n ^ (k + 1)) := by rw [pow_succ]; field_simp

namespace ScaleData
variable (d : ScaleData)

lemma s_quadratic_lower (n : ℕ) : (n+4)*n+n ≤ d.s n := by
  have h := Nat.two_mul_sq_add_one_le_two_pow_two_mul (n+2)
  have h' : 2 ^ (2*(n+2)) ≤ 2 ^ ((n+2)^2) :=
    Nat.pow_le_pow_right (by decide) (by nlinarith)
  have h'' : 2 ^ ((n+2)^2) ≤ d.s n := by
    unfold s
    exact Nat.le_mul_of_pos_left _ d.C_pos
  nlinarith

lemma coefficient_tail_bound (J p n : ℕ) (hn : max J p ≤ n) :
    ((n : ℝ)+4)^J * (d.b n / d.δ n^p) ≤ (1/2:ℝ)^n := by
  have hJ : J ≤ n := (le_max_left J p).trans hn
  have hp : p ≤ n := (le_max_right J p).trans hn
  have hexp : (n+4)*J+n ≤ d.s n :=
    (Nat.add_le_add_right (Nat.mul_le_mul_left _ hJ) _).trans (d.s_quadratic_lower n)
  have hpoly : ((n : ℝ)+4)^J ≤ (2:ℝ)^((n+4)*J) := by
    rw [pow_mul]
    apply pow_le_pow_left₀ (by positivity)
    exact_mod_cast (Nat.lt_two_pow_self (n := n+4)).le
  have hdelta : d.δ n ≤ (1/2:ℝ)^((n+4)*J+n) :=
    pow_le_pow_of_le_one (by norm_num) (by norm_num) hexp
  calc
    _ ≤ ((n : ℝ)+4)^J * d.δ n :=
      mul_le_mul_of_nonneg_left (d.scaled_b_le_delta n p (by omega)) (by positivity)
    _ ≤ (2:ℝ)^((n+4)*J) * (1/2:ℝ)^((n+4)*J+n) :=
      mul_le_mul hpoly hdelta (d.delta_nonneg n) (by positivity)
    _ = _ := by rw [pow_add, ← mul_assoc, ← mul_pow]; norm_num

def coefficientBound (J p : ℕ) : ℚ :=
  (∑ n ∈ Finset.range (max J p), ((n:ℚ)+4)^J * (d.bQ n / d.δQ n^p)) + 2

lemma coefficientBound_nonneg (J p : ℕ) : 0 ≤ d.coefficientBound J p := by
  have h : ∀ n : ℕ, (0:ℚ) ≤ ((n:ℚ)+4)^J * (d.bQ n / d.δQ n^p) := by
    intro n
    have hd : (0:ℚ) ≤ d.δQ n := by unfold δQ; positivity
    have hb : (0:ℚ) ≤ d.bQ n := by unfold bQ δQ; positivity
    positivity
  unfold coefficientBound
  exact add_nonneg (Finset.sum_nonneg (fun n _ => h n)) (by norm_num)

lemma coefficient_sum_le (J p N : ℕ) :
    (∑ n ∈ Finset.range N, ((n:ℝ)+4)^J * (d.b n / d.δ n^p)) ≤
      (d.coefficientBound J p : ℝ) := by
  let a : ℕ → ℝ := fun n => ((n:ℝ)+4)^J * (d.b n / d.δ n^p)
  have ha : ∀ n, 0 ≤ a n := fun n => mul_nonneg (by positivity)
    (div_nonneg (d.b_pos n).le (pow_nonneg (d.delta_nonneg n) _))
  have hlo : (∑ n ∈ (Finset.range N).filter (fun n => n < max J p), a n) ≤
      ∑ n ∈ Finset.range (max J p), a n := by
    apply Finset.sum_le_sum_of_subset_of_nonneg
    · intro n hn
      exact Finset.mem_range.mpr (Finset.mem_filter.mp hn).2
    · exact fun n _ _ => ha n
  have hhi : (∑ n ∈ (Finset.range N).filter (fun n => ¬ n < max J p), a n) ≤ 2 := by
    apply (Finset.sum_le_sum (fun n hn => d.coefficient_tail_bound J p n
      (by have := (Finset.mem_filter.mp hn).2; omega))).trans
    apply le_trans _ (sum_geometric_two_le N)
    exact Finset.sum_le_sum_of_subset_of_nonneg (Finset.filter_subset _ _)
      (fun n _ _ => by positivity)
  have h := add_le_add hlo hhi
  rw [Finset.sum_filter_add_sum_filter_not] at h
  simpa only [coefficientBound, Rat.cast_add, Rat.cast_sum, Rat.cast_mul, Rat.cast_pow,
    Rat.cast_div, Rat.cast_natCast, Rat.cast_ofNat, ScaleData.cast_bQ, ScaleData.cast_deltaQ] using h

end ScaleData

open EffectiveProfile.Formula in
lemma loadingVelocity_jetBound (M : Machine) (w : M.Input) (k : ℕ) (p : ℝ × Space) :
    ‖iteratedFDeriv ℝ k (Function.uncurry (loadingVelocity M w)) p‖ ≤
      (curlJetBound k : ℝ) := by
  let v := vec (-1) ((M.scaleData w).δ 0 * (M.initialDigit w : ℝ)) 0
  have hv : ‖v‖ ≤ 2 := by
    have hy := initial_coordinate_mem M w
    have hcoord : ∀ i : Fin 3, |v i| ≤ 1 := by
      intro i
      fin_cases i <;> dsimp [v, vec]
      · norm_num
      · exact (abs_le.mpr ⟨by linarith [hy.1], hy.2.le⟩)
      · norm_num
    simpa only [mul_one] using norm_le_two_mul_of_coord_le zero_le_one hcoord
  have he : Function.uncurry (loadingVelocity M w) = Function.uncurry (scaledCurl v v) := by
    funext q
    have h := movingCurl_normalized (0:Space) v (δ := 1) (b := 1) (by norm_num) (by norm_num) q.1 q.2
    change movingCurl (fun s => θ s • v) 1 q.1 q.2 = scaledCurl v v q.1 q.2
    simpa only [zero_add, inv_one, one_smul, sub_zero] using h
  rw [he]
  exact curlJetBound_spec k v v hv hv p

open EffectiveProfile.Formula in
lemma loadingVelocity_weighted_jetBound (M : Machine) (w : M.Input) (J k : ℕ) (p : ℝ × Space) :
    (1+‖p‖)^J * ‖iteratedFDeriv ℝ k (Function.uncurry (loadingVelocity M w)) p‖ ≤
      4^J * (curlJetBound k : ℝ) := by
  by_cases hp : p ∈ tsupport (Function.uncurry (loadingVelocity M w))
  · have hs := loadingVelocity_joint_tsupport M w hp
    have hn : ‖p‖ ≤ 3 := by
      change max ‖p.1‖ ‖p.2‖ ≤ 3
      apply max_le
      · rw [Real.norm_eq_abs, abs_of_nonneg hs.1.1]; linarith [hs.1.2]
      · exact norm_le_three_of_mem_K hs.2
    exact mul_le_mul (pow_le_pow_left₀ (by positivity) (by linarith) J)
      (loadingVelocity_jetBound M w k p) (norm_nonneg _) (by positivity)
  · have hz : iteratedFDeriv ℝ k (Function.uncurry (loadingVelocity M w)) p = 0 :=
      image_eq_zero_of_notMem_tsupport (fun h => hp (tsupport_iteratedFDeriv_subset k h))
    rw [hz, norm_zero, mul_zero]
    exact mul_nonneg (by positivity) (by exact_mod_cast curlJetBound_nonneg k)

open EffectiveProfile.Formula in
lemma stepVelocity_weighted_jetBound (M : Machine) (w : M.Input) (J k n : ℕ) (p : ℝ × Space) :
    (1+‖p‖)^J * ‖iteratedFDeriv ℝ k (Function.uncurry (stepVelocity M w n)) p‖ ≤
      (2 * (curlJetBound k : ℝ)) * (((n:ℝ)+4)^J *
        ((M.scaleData w).b n / (M.scaleData w).δ n^(k+1))) := by
  by_cases hp : p ∈ tsupport (Function.uncurry (stepVelocity M w n))
  · have hn := norm_le_slot (stepVelocity_joint_tsupport M w n hp)
    calc
      _ ≤ ((n:ℝ)+4)^J * ((2 * (curlJetBound k : ℝ)) *
          ((M.scaleData w).b n / (M.scaleData w).δ n^(k+1))) :=
        mul_le_mul (pow_le_pow_left₀ (by positivity) (by linarith) _) (stepVelocity_jetBound M w k n p)
          (norm_nonneg _) (by positivity)
      _ = _ := by ring
  · have hz : iteratedFDeriv ℝ k (Function.uncurry (stepVelocity M w n)) p = 0 :=
      image_eq_zero_of_notMem_tsupport (fun h => hp (tsupport_iteratedFDeriv_subset k h))
    rw [hz, norm_zero, mul_zero]
    have hC : (0:ℝ) ≤ curlJetBound k := by exact_mod_cast curlJetBound_nonneg k
    have hd := (M.scaleData w).delta_nonneg n
    have hb := (M.scaleData w).b_pos n
    positivity

def velocityJetBound (d : ScaleData) (J k : ℕ) : ℚ :=
  EffectiveProfile.Formula.curlJetBound k * (4^J + 2*d.coefficientBound J (k+1))

lemma velocityJetBound_nonneg (d : ScaleData) (J k : ℕ) : 0 ≤ velocityJetBound d J k :=
  mul_nonneg (EffectiveProfile.Formula.curlJetBound_nonneg k)
    (add_nonneg (by positivity) (mul_nonneg (by norm_num) (d.coefficientBound_nonneg J (k+1))))

lemma addressedVelocity_weighted_jetBound (M : Machine) (w : M.Input) (J k : ℕ) (p : ℝ × Space) :
    (1+‖p‖)^J * ‖iteratedFDeriv ℝ k (Function.uncurry (addressedVelocity M w)) p‖ ≤
      (velocityJetBound (M.scaleData w) J k : ℝ) := by
  obtain ⟨N, hN⟩ := exists_nat_gt p.1
  have he : Function.uncurry (addressedVelocity M w) =ᶠ[𝓝 p]
      fun q : ℝ × Space => loadingVelocity M w q.1 q.2 +
        ∑ n ∈ Finset.range N, stepVelocity M w n q.1 q.2 := by
    have hopen : IsOpen {q : ℝ × Space | q.1 < (N : ℝ) + 1} :=
      isOpen_lt continuous_fst continuous_const
    have ho : ∀ᶠ q : ℝ × Space in 𝓝 p, q.1 < (N : ℝ) + 1 :=
      hopen.mem_nhds (by change p.1 < (N : ℝ) + 1; linarith)
    filter_upwards [ho] with q hq
    simpa only [Function.uncurry, Pi.add_apply, Finset.sum_apply] using
      congrFun (addressedVelocity_eq_finite M w N hq) q.2
  have hk := finite_order k
  have hload : ContDiffAt ℝ k (Function.uncurry (loadingVelocity M w)) p :=
    ((loadingVelocity_smooth M w).of_le hk).contDiffAt
  have hstep (n : ℕ) : ContDiffAt ℝ k (Function.uncurry (stepVelocity M w n)) p :=
    ((stepVelocity_smooth M w n).of_le hk).contDiffAt
  have hsplit : iteratedFDeriv ℝ k
      (fun q : ℝ × Space => loadingVelocity M w q.1 q.2 +
        ∑ n ∈ Finset.range N, stepVelocity M w n q.1 q.2) p =
      iteratedFDeriv ℝ k (Function.uncurry (loadingVelocity M w)) p +
        ∑ n ∈ Finset.range N,
          iteratedFDeriv ℝ k (Function.uncurry (stepVelocity M w n)) p := by
    calc
      _ = iteratedFDeriv ℝ k (Function.uncurry (loadingVelocity M w)) p +
          iteratedFDeriv ℝ k (fun q : ℝ × Space =>
            ∑ n ∈ Finset.range N, stepVelocity M w n q.1 q.2) p :=
        fun_iteratedFDeriv_add_apply hload (ContDiffAt.sum (s := Finset.range N) (fun n _ => hstep n))
      _ = _ := congrArg (_ + ·) (iteratedFDeriv_fun_sum_apply (fun n _ => hstep n))
  let C : ℝ := EffectiveProfile.Formula.curlJetBound k
  have hC : 0 ≤ C := by dsimp [C]; exact_mod_cast EffectiveProfile.Formula.curlJetBound_nonneg k
  let d := M.scaleData w
  rw [(he.iteratedFDeriv ℝ k).eq_of_nhds, hsplit]
  calc
    _ ≤ (1+‖p‖)^J * (‖iteratedFDeriv ℝ k (Function.uncurry (loadingVelocity M w)) p‖ +
        ∑ n ∈ Finset.range N, ‖iteratedFDeriv ℝ k (Function.uncurry (stepVelocity M w n)) p‖) := by
      apply mul_le_mul_of_nonneg_left _ (by positivity)
      exact (norm_add_le _ _).trans (add_le_add le_rfl (norm_sum_le _ _))
    _ = (1+‖p‖)^J * ‖iteratedFDeriv ℝ k (Function.uncurry (loadingVelocity M w)) p‖ +
        ∑ n ∈ Finset.range N, (1+‖p‖)^J *
          ‖iteratedFDeriv ℝ k (Function.uncurry (stepVelocity M w n)) p‖ := by
      rw [mul_add, Finset.mul_sum]
    _ ≤ 4^J*C + ∑ n ∈ Finset.range N, 2*C * (((n:ℝ)+4)^J * (d.b n / d.δ n^(k+1))) :=
      add_le_add (loadingVelocity_weighted_jetBound M w J k p)
        (Finset.sum_le_sum (fun n _ => stepVelocity_weighted_jetBound M w J k n p))
    _ = 4^J*C + 2*C * ∑ n ∈ Finset.range N, ((n:ℝ)+4)^J * (d.b n / d.δ n^(k+1)) := by
      rw [Finset.mul_sum]
    _ ≤ 4^J*C + 2*C * (d.coefficientBound J (k+1) : ℝ) :=
      add_le_add le_rfl (mul_le_mul_of_nonneg_left (d.coefficient_sum_le J (k+1) N) (by positivity))
    _ = _ := by simp only [velocityJetBound, Rat.cast_mul, Rat.cast_add, Rat.cast_pow, Rat.cast_ofNat]; dsimp [C,d]; ring

end RapidForcing

end

end OAI