File size: 6,409 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
import OAI.Geometry.TriangularCovering.Main
import OAI.Geometry.CylinderCovering.Angular.InterceptDefinitions

namespace OAI

open Set MeasureTheory
open scoped InnerProductSpace
noncomputable section
namespace TriangularCovering

theorem lowerIntercept_eq_convexHull {a b T : ℝ} (hab : a < b) (hT : 0 < T) :
    lowerIntercept a b T = convexHull ℝ (Set.range (lowerVertices a b T)) := by
  change lowerIntercept a b T =
    triangle (lowerVertices a b T 0) (lowerVertices a b T 1) (lowerVertices a b T 2)
  ext z
  constructor
  · rintro ⟨y,t,ht0,htT,hay,hyb,rfl⟩
    exact lower_triangle_mem hab hT ht0 htT hay hyb
  · rw [mem_triangle_iff]
    rintro ⟨r,s,hr,hs,hrs,rfl⟩
    refine ⟨r*(a*T)+s*(b*T), r*T+s*T, ?_, ?_, ?_, ?_, ?_⟩
    · positivity
    · nlinarith [mul_le_mul_of_nonneg_right hrs hT.le]
    · nlinarith [mul_le_mul_of_nonneg_left
        (mul_le_mul_of_nonneg_right hab.le hT.le) hs]
    · nlinarith [mul_le_mul_of_nonneg_left
        (mul_le_mul_of_nonneg_right hab.le hT.le) hr]
    · ext i
      fin_cases i <;> simp [lowerVertices, point]
      ring

theorem upperIntercept_eq_convexHull {a b T : ℝ} (hab : a < b) (hT : 0 < T) :
    upperIntercept a b T = convexHull ℝ (Set.range (upperVertices a b T)) := by
  change upperIntercept a b T =
    triangle (upperVertices a b T 0) (upperVertices a b T 1) (upperVertices a b T 2)
  ext z
  constructor
  · rintro ⟨x,t,ht0,htT,hax,hxb,rfl⟩
    exact upper_triangle_mem hab hT ht0 htT hax hxb
  · rw [mem_triangle_iff]
    rintro ⟨r,s,hr,hs,hrs,rfl⟩
    refine ⟨r*(a*T)+s*(b*T), r*T+s*T, ?_, ?_, ?_, ?_, ?_⟩
    · positivity
    · nlinarith [mul_le_mul_of_nonneg_right hrs hT.le]
    · nlinarith [mul_le_mul_of_nonneg_left
        (mul_le_mul_of_nonneg_right hab.le hT.le) hs]
    · nlinarith [mul_le_mul_of_nonneg_left
        (mul_le_mul_of_nonneg_right hab.le hT.le) hr]
    · ext i
      fin_cases i <;> simp [upperVertices, point]
      ring

theorem projectedCylinder_carrier_direction (v : Space) (hv : v ≠ 0)
    (a b c : Space)
    (h : inner ℝ (unit v) (cross3 (b-a) (c-a)) ≠ 0) :
    (projectedCylinder (unit v) (unit_norm hv) a b c h).carrier =
      {z | ∃ p ∈ triangle a b c, ∃ r : ℝ, z = p + r • v} := by
  ext z
  constructor
  · rintro ⟨q,⟨p,hp,rfl⟩,r,hz⟩
    refine ⟨p,hp,(r-inner ℝ (unit v) p) / ‖v‖,?_⟩
    calc
      z = projection (unit v) p + r • unit v := hz
      _ = p + (r-inner ℝ (unit v) p) • unit v := by
        unfold projection
        module
      _ = p + ((r-inner ℝ (unit v) p) / ‖v‖) • v := by
        simp only [unit, smul_smul, div_eq_mul_inv]
  · rintro ⟨p,hp,r,hz⟩
    exact projectedCylinder_mem_direction v hv a b c h hp r hz

theorem lowerCylinder_carrier_intercept {a b T : ℝ} (hab : a < b) (hT : 0 < T)
    (ε A B : ℝ) :
    (lowerCylinder hab hT ε A B).carrier =
      {z | ∃ p ∈ lowerIntercept a b T, ∃ r : ℝ, z = p + r • tiltV ε A B} := by
  rw [lowerCylinder, projectedCylinder_carrier_direction _ (tiltV_ne_zero ε A B),
    lowerIntercept_eq_convexHull hab hT]
  rfl

theorem upperCylinder_carrier_intercept {a b T : ℝ} (hab : a < b) (hT : 0 < T)
    (ε A B : ℝ) :
    (upperCylinder hab hT ε A B).carrier =
      {z | ∃ p ∈ upperIntercept a b T, ∃ r : ℝ, z = p + r • tiltW ε A B} := by
  rw [upperCylinder, projectedCylinder_carrier_direction _ (tiltW_ne_zero ε A B),
    upperIntercept_eq_convexHull hab hT]
  rfl

theorem lowerAngularBase_eq_projection_intercept (ε : ℝ) (he : 0 < ε)
    (j : Fin (n ε)) :
    lowerAngularBase ε j = projection (lowerAngularAxis ε j) ''
      lowerIntercept (mesh (n ε) j) (mesh (n ε) (j + 1))
        (cutoff ε (mesh (n ε) j) (mesh (n ε) (j + 1))) := by
  rw [lowerIntercept_eq_convexHull (mesh_strict (N := n ε) (ceil_count_pos he) j)
    (cutoff_pos_all ε (mesh (n ε) j) (mesh (n ε) (j + 1)))]
  rfl

theorem upperAngularBase_eq_projection_intercept (ε : ℝ) (he : 0 < ε)
    (j : Fin (n ε)) :
    upperAngularBase ε j = projection (upperAngularAxis ε j) ''
      upperIntercept (mesh (n ε) j) (mesh (n ε) (j + 1))
        (cutoff ε (mesh (n ε) j) (mesh (n ε) (j + 1))) := by
  rw [upperIntercept_eq_convexHull (mesh_strict (N := n ε) (ceil_count_pos he) j)
    (cutoff_pos_all ε (mesh (n ε) j) (mesh (n ε) (j + 1)))]
  rfl

theorem TriCylinder.ext_axis_base {c d : TriCylinder}
    (ha : c.axis = d.axis) (hb : c.base = d.base) : c = d := by
  cases c
  cases d
  cases ha
  cases hb
  rfl

theorem finiteFamily_explicit_laws (ε : ℝ) (he : 0 < ε) :
    ExplicitAngularFamily ε (finiteFamily ε he) := by
  intro j
  simp only [lowerAngularIndex, upperAngularIndex, finiteFamily, Function.comp_apply,
    Fin.cast_cast, Fin.cast_eq_self, Fin.append_left, Fin.append_right]
  exact ⟨rfl, rfl, rfl, rfl⟩

theorem ExplicitAngularFamily.unique {ε : ℝ}
    {c d : Fin (2 * n ε) → TriCylinder}
    (hc : ExplicitAngularFamily ε c) (hd : ExplicitAngularFamily ε d) : c = d := by
  have h : ∀ k : Fin (n ε + n ε),
      c (Fin.cast (two_mul (n ε)).symm k) =
        d (Fin.cast (two_mul (n ε)).symm k) := by
    intro k
    refine Fin.addCases (fun j => ?_) (fun j => ?_) k
    · exact TriCylinder.ext_axis_base ((hc j).1.trans (hd j).1.symm)
        ((hc j).2.1.trans (hd j).2.1.symm)
    · exact TriCylinder.ext_axis_base ((hc j).2.2.1.trans (hd j).2.2.1.symm)
        ((hc j).2.2.2.trans (hd j).2.2.2.symm)
  funext i
  simpa only [Fin.cast_cast, Fin.cast_eq_self] using h (Fin.cast (two_mul (n ε)) i)

theorem ExplicitAngularFamily.eq_finiteFamily {ε : ℝ} (he : 0 < ε)
    {c : Fin (2 * n ε) → TriCylinder} (hc : ExplicitAngularFamily ε c) :
    c = finiteFamily ε he := hc.unique (finiteFamily_explicit_laws ε he)

theorem ExplicitAngularFamily.exact_area_sum {ε : ℝ} (he : 0 < ε)
    {c : Fin (2 * n ε) → TriCylinder} (hc : ExplicitAngularFamily ε c) :
    totalArea c / H =
      ∑ j : Fin (n ε), normalizedTerm ε (mesh (n ε) j) (mesh (n ε) (j + 1)) := by
  rw [hc.eq_finiteFamily he]
  exact finiteFamily_total ε he

theorem ExplicitAngularFamily.covers {ε : ℝ} (he : 0 < ε)
    (hsmall : ε ≤ 1 / 2000) {c : Fin (2 * n ε) → TriCylinder}
    (hc : ExplicitAngularFamily ε c) : Covers c := by
  rw [hc.eq_finiteFamily he]
  apply finiteFamily_covers he
  norm_num [η] at *
  exact hsmall

end TriangularCovering

end

end OAI