File size: 15,975 Bytes
785c727
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
import OAI.Geometry.CylinderCovering.Physical.TrianglesDefinitions
import OAI.Geometry.CylinderCovering.Physical.Finite

namespace OAI

open Set MeasureTheory Filter
open scoped Topology InnerProductSpace
noncomputable section
namespace RadialPhysical.ExplicitTriangles
open CylinderCovering PhysicalFiniteProof

variable (centered : Bool) (b eta : ℝ) (hb : 0 < b) (T : ℝ → ℝ)
  (hT : ContinuousOn T (Icc (-b) b))
  (hT0 : ∀ s ∈ Icc (-b) b, 0 ≤ T s)

lemma upper_scalarBound :
    RadialSweep.scalarBound (upperData centered b eta hb T hT hT0) = |eta| := by
  unfold RadialSweep.scalarBound
  change sSup ((fun _ : ℝ => |-eta|) '' Icc (-b) b) = |eta|
  have him : ((fun _ : ℝ => |-eta|) '' Icc (-b) b) = {|eta|} := by
    ext z
    constructor
    · rintro ⟨s, hs, rfl⟩
      simp
    · rintro rfl
      exact ⟨0, ⟨by linarith, by linarith⟩, abs_neg eta⟩
  rw [him, csSup_singleton]

lemma lower_scalarBound :
    RadialSweep.scalarBound (lowerData centered b eta hb T hT hT0) = |eta| := by
  unfold RadialSweep.scalarBound
  change sSup ((fun _ : ℝ => |eta|) '' Icc (-b) b) = |eta|
  have him : ((fun _ : ℝ => |eta|) '' Icc (-b) b) = {|eta|} := by
    ext z
    constructor
    · rintro ⟨s, hs, rfl⟩
      rfl
    · rintro rfl
      exact ⟨0, ⟨by linarith, by linarith⟩, rfl⟩
  rw [him, csSup_singleton]

lemma upper_error :
    RadialSweep.radialError (upperData centered b eta hb T hT hT0) =
      error centered b eta := by
  unfold RadialSweep.radialError
  rw [upper_scalarBound]
  rfl

lemma lower_error :
    RadialSweep.radialError (lowerData centered b eta hb T hT hT0) =
      error centered b eta := by
  unfold RadialSweep.radialError
  rw [lower_scalarBound]
  rfl

lemma upper_coordinateMap (p : ℝ × ℝ) :
    RadialSweep.coordinateMap (upperData centered b eta hb T hT hT0) p =
      upperIntercept b p := by
  ext i
  fin_cases i <;> simp [RadialSweep.coordinateMap, upperData, upperIntercept,
    point, RadialPairedSweep.point]
  ring

lemma lower_coordinateMap (p : ℝ × ℝ) :
    RadialSweep.coordinateMap (lowerData centered b eta hb T hT hT0) p =
      lowerIntercept centered b p := by
  cases centered <;> ext i <;>
    fin_cases i <;> simp [RadialSweep.coordinateMap, lowerData, lowerIntercept,
    point, RadialPairedSweep.point] <;> ring

lemma upper_vertices (N : ℕ) (i : Fin N) :
    RadialSweep.frozenVertices (upperData centered b eta hb T hT hT0) N i =
      upperVertices centered b eta T N i := by
  unfold RadialSweep.frozenVertices
  simp only [RadialSweep.leftTip, RadialSweep.rightEdge, RadialSweep.collar,
    upper_error, RadialSweep.midpoint]
  change ![_, _, _] = _
  funext j
  fin_cases j <;>
    change RadialSweep.coordinateMap (upperData centered b eta hb T hT hT0) _ =
      upperIntercept b _
  all_goals
    rw [upper_coordinateMap]
    rfl

lemma lower_vertices (N : ℕ) (i : Fin N) :
    RadialSweep.frozenVertices (lowerData centered b eta hb T hT hT0) N i =
      lowerVertices centered b eta T N i := by
  unfold RadialSweep.frozenVertices
  simp only [RadialSweep.leftTip, RadialSweep.rightEdge, RadialSweep.collar,
    lower_error, RadialSweep.midpoint]
  change ![_, _, _] = _
  funext j
  fin_cases j <;>
    change RadialSweep.coordinateMap (lowerData centered b eta hb T hT hT0) _ =
      lowerIntercept centered b _
  all_goals
    rw [lower_coordinateMap]
    rfl

lemma upper_base (N : ℕ) (tag : Fin N → ℝ) (i : Fin N) :
    RadialSweep.frozenBase (upperData centered b eta hb T hT hT0) N tag i =
      upperBase centered b eta T N tag i := by
  unfold RadialSweep.frozenBase RadialSweep.frozenTriangle upperBase
  rw [upperData_direction, upper_vertices]

lemma lower_base (N : ℕ) (tag : Fin N → ℝ) (i : Fin N) :
    RadialSweep.frozenBase (lowerData centered b eta hb T hT hT0) N tag i =
      lowerBase centered b eta T N tag i := by
  unfold RadialSweep.frozenBase RadialSweep.frozenTriangle lowerBase
  rw [lowerData_direction, lower_vertices]

lemma upper_speed (s : ℝ) :
    ‖(upperData centered b eta hb T hT hT0).w s‖^2 =
      eta^2 * ((s^2+b^2)^2/4 + height b^2*s^2) := by
  have hv : (upperData centered b eta hb T hT hT0).w s =
      RadialPairedSweep.point 0 (-eta/2*(s^2+b^2)) (height b*eta*s) := by
    change (-eta/2*(s^2+b^2)) • RadialPairedSweep.point 0 1 0 +
      (height b*eta*s) • RadialPairedSweep.point 0 0 1 = _
    ext i
    fin_cases i <;> simp [RadialPairedSweep.point]
  rw [hv, RadialPairedSweep.point_norm_sq]
  ring

lemma lower_speed (s : ℝ) :
    ‖(lowerData centered b eta hb T hT hT0).w s‖^2 =
      eta^2 * ((s^2+b^2)^2/4 + height b^2*s^2) := by
  have hv : (lowerData centered b eta hb T hT hT0).w s =
      RadialPairedSweep.point (eta/2*(s^2+b^2)) 0 (height b*eta*s) := by
    change (eta/2*(s^2+b^2)) • RadialPairedSweep.point 1 0 0 +
      (height b*eta*s) • RadialPairedSweep.point 0 0 1 = _
    ext i
    fin_cases i <;> simp [RadialPairedSweep.point]
  rw [hv, RadialPairedSweep.point_norm_sq]
  ring

lemma upper_area (N : ℕ) (tag : Fin N → ℝ) (i : Fin N) :
    RadialSweep.frozenArea (upperData centered b eta hb T hT hT0) N tag i =
      localArea centered b eta T N tag i := by
  unfold RadialSweep.frozenArea RadialSweep.collar
  rw [upperData_kappa, upper_error, upper_speed]
  change height b * RadialRiemann.step (-b) b N *
    (RadialRiemann.capMax T (-b) b N i +
      (error centered b eta + (3*error centered b eta+1))*RadialRiemann.step (-b) b N)^2 /
      (2*Real.sqrt (1+eta^2*((tag i^2+b^2)^2/4+height b^2*tag i^2))) = _
  unfold localArea
  ring

lemma lower_area (N : ℕ) (tag : Fin N → ℝ) (i : Fin N) :
    RadialSweep.frozenArea (lowerData centered b eta hb T hT hT0) N tag i =
      localArea centered b eta T N tag i := by
  unfold RadialSweep.frozenArea RadialSweep.collar
  rw [lowerData_kappa, lower_error, lower_speed]
  change height b * RadialRiemann.step (-b) b N *
    (RadialRiemann.capMax T (-b) b N i +
      (error centered b eta + (3*error centered b eta+1))*RadialRiemann.step (-b) b N)^2 /
      (2*Real.sqrt (1+eta^2*((tag i^2+b^2)^2/4+height b^2*tag i^2))) = _
  unfold localArea
  ring

def upperCylinder (N : ℕ) (tag : Fin N → ℝ)
    (htag : RadialRiemann.IsTagged (-b) b N tag) (i : Fin N) :
    TriangularCovering.TriCylinder :=
  RadialSweep.frozenCylinder (upperData centered b eta hb T hT hT0) N tag htag i

def lowerCylinder (N : ℕ) (tag : Fin N → ℝ)
    (htag : RadialRiemann.IsTagged (-b) b N tag) (i : Fin N) :
    TriangularCovering.TriCylinder :=
  RadialSweep.frozenCylinder (lowerData centered b eta hb T hT hT0) N tag htag i

theorem upperCylinder_axis (N : ℕ) (tag : Fin N → ℝ)
    (htag : RadialRiemann.IsTagged (-b) b N tag) (i : Fin N) :
    (upperCylinder centered b eta hb T hT hT0 N tag htag i).axis =
      upperPhysicalAxis b eta (tag i) :=
  upperData_direction centered b eta hb T hT hT0 (tag i)

theorem lowerCylinder_axis (N : ℕ) (tag : Fin N → ℝ)
    (htag : RadialRiemann.IsTagged (-b) b N tag) (i : Fin N) :
    (lowerCylinder centered b eta hb T hT hT0 N tag htag i).axis =
      lowerPhysicalAxis b eta (tag i) :=
  lowerData_direction centered b eta hb T hT hT0 (tag i)

theorem upperCylinder_base (N : ℕ) (tag : Fin N → ℝ)
    (htag : RadialRiemann.IsTagged (-b) b N tag) (i : Fin N) :
    (upperCylinder centered b eta hb T hT hT0 N tag htag i).base =
      upperBase centered b eta T N tag i :=
  upper_base centered b eta hb T hT hT0 N tag i

theorem lowerCylinder_base (N : ℕ) (tag : Fin N → ℝ)
    (htag : RadialRiemann.IsTagged (-b) b N tag) (i : Fin N) :
    (lowerCylinder centered b eta hb T hT hT0 N tag htag i).base =
      lowerBase centered b eta T N tag i :=
  lower_base centered b eta hb T hT hT0 N tag i

theorem upperCylinder_area (N : ℕ) (tag : Fin N → ℝ)
    (htag : RadialRiemann.IsTagged (-b) b N tag) (i : Fin N) :
    TriangularCovering.area
      (upperCylinder centered b eta hb T hT hT0 N tag htag i).base =
      localArea centered b eta T N tag i := by
  exact (RadialSweep.frozenCylinder_area
    (upperData centered b eta hb T hT hT0) N tag htag i).trans
    (upper_area centered b eta hb T hT hT0 N tag i)

theorem lowerCylinder_area (N : ℕ) (tag : Fin N → ℝ)
    (htag : RadialRiemann.IsTagged (-b) b N tag) (i : Fin N) :
    TriangularCovering.area
      (lowerCylinder centered b eta hb T hT hT0 N tag htag i).base =
      localArea centered b eta T N tag i := by
  exact (RadialSweep.frozenCylinder_area
    (lowerData centered b eta hb T hT hT0) N tag htag i).trans
    (lower_area centered b eta hb T hT hT0 N tag i)

theorem upper_actual_enclosure (N : ℕ) (tag : Fin N → ℝ)
    (htag : RadialRiemann.IsTagged (-b) b N tag) (i : Fin N) :
    upperPhysicalBase centered b eta T N tag i ⊆
      (upperCylinder centered b eta hb T hT hT0 N tag htag i).base := by
  rw [upperCylinder_base, ← upper_base centered b eta hb T hT hT0,
    ← upperData_actualBase centered b eta hb T hT hT0]
  exact RadialSweep.actualBase_subset_frozenBase _ tag htag i

theorem lower_actual_enclosure (N : ℕ) (tag : Fin N → ℝ)
    (htag : RadialRiemann.IsTagged (-b) b N tag) (i : Fin N) :
    lowerPhysicalBase centered b eta T N tag i ⊆
      (lowerCylinder centered b eta hb T hT hT0 N tag htag i).base := by
  rw [lowerCylinder_base, ← lower_base centered b eta hb T hT hT0,
    ← lowerData_actualBase centered b eta hb T hT hT0]
  exact RadialSweep.actualBase_subset_frozenBase _ tag htag i

theorem upper_cover {N : ℕ} (hN : 0 < N) (tag : Fin N → ℝ)
    (htag : RadialRiemann.IsTagged (-b) b N tag) :
    ∀ z ∈ upperSweepOn centered b eta T (Icc (-b) b),
      ∃ i : Fin N, z ∈ (upperCylinder centered b eta hb T hT hT0 N tag htag i).carrier := by
  intro z hz
  rw [← upperData_sweep centered b eta hb T hT hT0,
    RadialSweep.sweep_eq_iUnion_localSweep _ hN] at hz
  obtain ⟨i, hi⟩ := Set.mem_iUnion.mp hz
  exact ⟨i, RadialSweep.localSweep_mem_frozenCylinder _ tag htag i hi⟩

theorem lower_cover {N : ℕ} (hN : 0 < N) (tag : Fin N → ℝ)
    (htag : RadialRiemann.IsTagged (-b) b N tag) :
    ∀ z ∈ lowerSweepOn centered b eta T (Icc (-b) b),
      ∃ i : Fin N, z ∈ (lowerCylinder centered b eta hb T hT hT0 N tag htag i).carrier := by
  intro z hz
  rw [← lowerData_sweep centered b eta hb T hT hT0,
    RadialSweep.sweep_eq_iUnion_localSweep _ hN] at hz
  obtain ⟨i, hi⟩ := Set.mem_iUnion.mp hz
  exact ⟨i, RadialSweep.localSweep_mem_frozenCylinder _ tag htag i hi⟩

theorem upper_total_tendsto (tag : (N : ℕ) → Fin N → ℝ)
    (htag : ∀ N, RadialRiemann.IsTagged (-b) b N (tag N)) :
    Tendsto (fun N => TriangularCovering.totalArea
      (upperCylinder centered b eta hb T hT hT0 N (tag N) (htag N)))
      atTop (𝓝 (scaledCost b eta T / 2)) := by
  have h := RadialSweep.frozenArea_tendsto
    (upperData centered b eta hb T hT hT0) tag htag
  rw [upperData_weightedArea] at h
  convert h using 1
  funext N
  apply Finset.sum_congr rfl
  intro i _
  exact RadialSweep.frozenCylinder_area _ N (tag N) (htag N) i

theorem lower_total_tendsto (tag : (N : ℕ) → Fin N → ℝ)
    (htag : ∀ N, RadialRiemann.IsTagged (-b) b N (tag N)) :
    Tendsto (fun N => TriangularCovering.totalArea
      (lowerCylinder centered b eta hb T hT hT0 N (tag N) (htag N)))
      atTop (𝓝 (scaledCost b eta T / 2)) := by
  have h := RadialSweep.frozenArea_tendsto
    (lowerData centered b eta hb T hT hT0) tag htag
  rw [lowerData_weightedArea] at h
  convert h using 1
  funext N
  apply Finset.sum_congr rfl
  intro i _
  exact RadialSweep.frozenCylinder_area _ N (tag N) (htag N) i

theorem total_tendsto (tagU tagL : (N : ℕ) → Fin N → ℝ)
    (htagU : ∀ N, RadialRiemann.IsTagged (-b) b N (tagU N))
    (htagL : ∀ N, RadialRiemann.IsTagged (-b) b N (tagL N)) :
    Tendsto (fun N => TriangularCovering.totalArea
      (upperCylinder centered b eta hb T hT hT0 N (tagU N) (htagU N)) +
      TriangularCovering.totalArea
      (lowerCylinder centered b eta hb T hT hT0 N (tagL N) (htagL N)))
      atTop (𝓝 (scaledCost b eta T)) := by
  simpa only [add_halves] using
    (upper_total_tendsto centered b eta hb T hT hT0 tagU htagU).add
      (lower_total_tendsto centered b eta hb T hT hT0 tagL htagL)

include hb hT hT0 in

theorem localArea_pos (N : ℕ) (tag : Fin N → ℝ) (i : Fin N) :
    0 < localArea centered b eta T N tag i := by
  have hinterval : -b < b := by linarith
  have hd := RadialRiemann.step_pos hinterval (Nat.zero_lt_of_lt i.isLt)
  have hcap := RadialRiemann.capMax_nonneg hinterval hT hT0 i
  have hh : 0 < height b := mul_pos (Real.sqrt_pos.mpr (by norm_num)) hb
  have hA : 0 ≤ error centered b eta := by
    unfold error axialBound
    cases centered <;> simp <;> positivity
  have hwidth : 0 < RadialRiemann.capMax T (-b) b N i +
      (4 * error centered b eta + 1) * RadialRiemann.step (-b) b N := by positivity
  unfold localArea
  exact div_pos (mul_pos (mul_pos hh hd) (sq_pos_of_pos hwidth))
    (mul_pos (by norm_num) (Real.sqrt_pos.mpr (by positivity)))

theorem physical_triangle_construction : ConstructionStatement := by
  intro centered b eta hb T hT hT0 tagU tagL htagU htagL
  refine ⟨(fun N => upperCylinder centered b eta hb T hT hT0 N (tagU N) (htagU N)),
    (fun N => lowerCylinder centered b eta hb T hT hT0 N (tagL N) (htagL N)), ?_, ?_, ?_⟩
  · intro N i
    exact ⟨upperCylinder_axis centered b eta hb T hT hT0 N (tagU N) (htagU N) i,
      lowerCylinder_axis centered b eta hb T hT hT0 N (tagL N) (htagL N) i,
      upperCylinder_base centered b eta hb T hT hT0 N (tagU N) (htagU N) i,
      lowerCylinder_base centered b eta hb T hT hT0 N (tagL N) (htagL N) i,
      upperCylinder_area centered b eta hb T hT hT0 N (tagU N) (htagU N) i,
      lowerCylinder_area centered b eta hb T hT hT0 N (tagL N) (htagL N) i,
      upper_actual_enclosure centered b eta hb T hT hT0 N (tagU N) (htagU N) i,
      lower_actual_enclosure centered b eta hb T hT hT0 N (tagL N) (htagL N) i⟩
  · intro N hN
    exact ⟨upper_cover centered b eta hb T hT hT0 hN (tagU N) (htagU N),
      lower_cover centered b eta hb T hT hT0 hN (tagL N) (htagL N)⟩
  · exact total_tendsto centered b eta hb T hT hT0 tagU tagL htagU htagL

include hb hT hT0 in

theorem upperActual_area_le (N : ℕ) (tag : Fin N → ℝ)
    (htag : RadialRiemann.IsTagged (-b) b N tag) (i : Fin N) :
    TriangularCovering.area (upperPhysicalBase centered b eta T N tag i) ≤
      localArea centered b eta T N tag i := by
  have h := measureReal_mono
    (upper_actual_enclosure centered b eta hb T hT hT0 N tag htag i)
    (upperCylinder centered b eta hb T hT hT0 N tag htag i).finite_area
  change TriangularCovering.area _ ≤ TriangularCovering.area _ at h
  rwa [upperCylinder_area] at h

include hb hT hT0 in

theorem lowerActual_area_le (N : ℕ) (tag : Fin N → ℝ)
    (htag : RadialRiemann.IsTagged (-b) b N tag) (i : Fin N) :
    TriangularCovering.area (lowerPhysicalBase centered b eta T N tag i) ≤
      localArea centered b eta T N tag i := by
  have h := measureReal_mono
    (lower_actual_enclosure centered b eta hb T hT hT0 N tag htag i)
    (lowerCylinder centered b eta hb T hT hT0 N tag htag i).finite_area
  change TriangularCovering.area _ ≤ TriangularCovering.area _ at h
  rwa [lowerCylinder_area] at h

include hb hT hT0 in

theorem actualCost_le_formula (N : ℕ) (tagU tagL : Fin N → ℝ)
    (htagU : RadialRiemann.IsTagged (-b) b N tagU)
    (htagL : RadialRiemann.IsTagged (-b) b N tagL) :
    physicalActualCost centered b eta T N tagU tagL ≤
      (∑ i : Fin N, localArea centered b eta T N tagU i) +
      (∑ i : Fin N, localArea centered b eta T N tagL i) := by
  apply add_le_add
  · exact Finset.sum_le_sum fun i _ =>
      upperActual_area_le centered b eta hb T hT hT0 N tagU htagU i
  · exact Finset.sum_le_sum fun i _ =>
      lowerActual_area_le centered b eta hb T hT hT0 N tagL htagL i

end RadialPhysical.ExplicitTriangles

end

end OAI