File size: 16,175 Bytes
720fa25 | 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 | import Mathlib
import OAI.Geometry.BallPacking.Layers.ParametricNestedDisks
namespace OAI
noncomputable section
namespace PackingSufficiencySupport.Hamiltonian
section
open scoped ContDiff Topology
open Set Function
def planeRotate (θ : ℝ) (v : Plane) : Plane :=
(Real.cos θ*v.1-Real.sin θ*v.2,Real.sin θ*v.1+Real.cos θ*v.2)
@[fun_prop] theorem planeRotate_smooth : ContDiff ℝ ∞ (fun p : ℝ × Plane => planeRotate p.1 p.2) := by
unfold planeRotate
fun_prop
@[simp] theorem planeRotate_zero (v : Plane) : planeRotate 0 v = v := by
ext <;> simp [planeRotate]
@[simp] theorem radiusSq_planeRotate (θ : ℝ) (v : Plane) :
radiusSq (planeRotate θ v) = radiusSq v := by
unfold radiusSq planeRotate
nlinarith only [Real.sin_sq_add_cos_sq θ]
@[simp] theorem radialArea_planeRotate (θ : ℝ) (v : Plane) :
radialArea (planeRotate θ v) = radialArea v := by
simp [radialArea]
theorem planeRotate_hasDerivAt {θ : ℝ → ℝ} {t a : ℝ} (hθ : HasDerivAt θ a t) (v : Plane) :
HasDerivAt (fun s => planeRotate (θ s) v)
(a • (-(planeRotate (θ t) v).2,(planeRotate (θ t) v).1)) t := by
have h1 := ((Real.hasDerivAt_cos (θ t)).comp t hθ).mul_const v.1
have h2 := ((Real.hasDerivAt_sin (θ t)).comp t hθ).mul_const v.2
have h3 := ((Real.hasDerivAt_sin (θ t)).comp t hθ).mul_const v.1
have h4 := ((Real.hasDerivAt_cos (θ t)).comp t hθ).mul_const v.2
apply ((h1.sub h2).prodMk (h3.add h4)).congr_deriv
ext <;> dsimp [planeRotate] <;> ring
@[fun_prop] theorem radialArea_smooth : ContDiff ℝ ∞ radialArea :=
contDiff_const.mul radiusSq_smooth
theorem radialArea_hasFDerivAt (x : Plane) :
HasFDerivAt radialArea
(Real.pi • ((2*x.1) • ContinuousLinearMap.fst ℝ ℝ ℝ +
(2*x.2) • ContinuousLinearMap.snd ℝ ℝ ℝ)) x := by
have h₁ : HasFDerivAt (fun p : Plane => p.1^2)
((2*x.1) • ContinuousLinearMap.fst ℝ ℝ ℝ) x := by
simpa using (hasFDerivAt_fst (𝕜 := ℝ) (p := x)).pow 2
have h₂ : HasFDerivAt (fun p : Plane => p.2^2)
((2*x.2) • ContinuousLinearMap.snd ℝ ℝ ℝ) x := by
simpa using (hasFDerivAt_snd (𝕜 := ℝ) (p := x)).pow 2
exact (h₁.add h₂).const_mul Real.pi
@[simp] theorem radialArea_fderiv (x v : Plane) :
fderiv ℝ radialArea x v = 2*Real.pi*(x.1*v.1+x.2*v.2) := by
rw [(radialArea_hasFDerivAt x).fderiv]
change Real.pi * (2*x.1*v.1+2*x.2*v.2) = _
ring
end
section
open scoped ContDiff Topology BigOperators
open Set Function MeasureTheory
theorem exists_hamiltonian_thin_grid {m : ℕ} (h : Fin m → ℝ)
(hh : ∀ i, 0 < h i) (hmono : StrictMono h) {δ : ℝ} (hδ : 0 < δ) :
∃ (R : ℝ) (Ψ : HamiltonianDiskIsotopyFamily ℝ R),
∀ i x, radialArea x ≤ h i →
0 < (Ψ.isotopy.map 0 1 x).1 ∧ (Ψ.isotopy.map 0 1 x).1 < h i+δ/2 ∧
(Ψ.isotopy.map 0 1 x).2 ∈ Ioo 0 1 := by
obtain ⟨L,w,c,hL,hw,hwmono,hareaL,hnestL,hplace⟩ :=
exists_thin_rectangle_placement h hh hmono hδ
let Y : Set ℝ := {0}
let V (_ : ℝ) (i : Fin m) : Set ℝ := Ioo 0 (h i+δ/2)
have hV (i : Fin m) : IsOpen {p : ℝ × ℝ | p.2 ∈ V p.1 i} :=
isOpen_Ioo.preimage continuous_snd
obtain ⟨q,k,hq,hq1,hk,hsquare,harea,hmargin⟩ :=
exists_exact_area_rounded_margins (isCompact_singleton (x := (0:ℝ)))
(fun _ : ℝ => c) continuous_const L w hwmono V hV
(fun _ _ => ⟨hplace,hnestL⟩)
let s : ℝ := 4/squeezedArea k
have hs : 0 < s := div_pos (by norm_num) harea
let C (i : Fin m) : Plane := (c i+L i/2,1/2)
let a (i : Fin m) := s*L i/2
let b (i : Fin m) := w i/2
have ha i : 0 < a i := div_pos (mul_pos hs (hL i)) (by norm_num)
have hb i : 0 < b i := div_pos (hw i).1 (by norm_num)
have hmar := hmargin 0 (mem_singleton (0:ℝ))
have hnest ⦃i j : Fin m⦄ (hij : i < j) :
roundedBox k (C i) (a i) (b i) ⊆ interior (roundedBox k (C j) (a j) (b j)) := by
apply roundedBox_nested_of_margins (ha i) (hb i) (ha j) (hb j) hsquare
all_goals
have hn := hmar.2.2 hij
dsimp only [C,a,b]
nlinarith only [hn.1,hn.2.1,hn.2.2]
have hbound (i : Fin m) {x : Plane} (hx : x ∈ roundedBox k (C i) (a i) (b i)) :
0 < x.1 ∧ x.1 < h i+δ/2 ∧ x.2 ∈ Ioo 0 1 := by
obtain ⟨z,_,rfl⟩ := hx
have hz := roundedMap_mem_openBox (ha i) (hb i) k (C i) z
have he := hmar.2.1 i
change (0 < c i+L i/2-s*L i/2 ∧ c i+L i/2-s*L i/2 < h i+δ/2) ∧
(0 < c i+L i/2+s*L i/2 ∧ c i+L i/2+s*L i/2 < h i+δ/2) at he
change (c i+L i/2-s*L i/2 < _ ∧ _ < c i+L i/2+s*L i/2) ∧
(1/2-w i/2 < _ ∧ _ < 1/2+w i/2) at hz
exact ⟨he.1.1.trans hz.1.1,hz.1.2.trans he.2.2,
by linarith [hz.2.1,(hw i).2],by linarith [hz.2.2,(hw i).2]⟩
have hvol (i : Fin m) : volume (roundedBox k (C i) (a i) (b i)) = ENNReal.ofReal (h i) := by
rw [roundedBox_volume_eq (ha i).le (hb i).le]
congr 1
calc
a i*b i*squeezedArea k = L i*w i := by
dsimp [a,b,s]
field_simp [harea.ne']
ring
_ = h i := hareaL i
let r i := areaRadius (h i)
have hr i : 0 < r i := areaRadius_pos (hh i)
have hrmono : StrictMono r := fun i j hij =>
areaRadius_strictMono (hh i).le (hh j).le (hmono hij)
let f (i : Fin m) (p : ℝ × Plane) := normalizedRoundedMap k (C i) (a i) (b i) (r i) p.2
have himage (i : Fin m) (y : ℝ) :
(fun x => f i (y,x)) '' closedRoundDisk (r i) = roundedBox k (C i) (a i) (b i) :=
normalizedRoundedMap_image (hr i) k (C i) (a i) (b i)
let K := ⋃ i, roundedBox k (C i) (a i) (b i)
have hK : IsCompact K := isCompact_iUnion (fun i => roundedBox_compact k (C i) (a i) (b i))
obtain ⟨M,hM⟩ := (hK.image radialArea_smooth.continuous).bddAbove
let T := max (M+1) (1+∑ i, h i)
have hT : 0 < T := by
have hs : 0 ≤ ∑ i, h i := Finset.sum_nonneg (fun i _ => (hh i).le)
have hl := le_max_right (M+1) (1+∑ i, h i)
dsimp [T]; linarith
have hiT (i : Fin m) : h i < T := by
have hi := Finset.single_le_sum (s := Finset.univ) (fun j _ => (hh j).le) (Finset.mem_univ i)
have hl := le_max_right (M+1) (1+∑ i, h i)
dsimp [T]; linarith
obtain ⟨Ψ,hΨ⟩ := exists_hamiltonian_plane_disk_germs
(Y := Y) (A := univ) isCompact_singleton (convex_singleton 0) isOpen_univ
(subset_univ Y) 0 (mem_singleton 0) r hr hrmono f
(fun i => ((normalizedRoundedMap_smooth k (C i) (a i) (b i) (r i)).comp contDiff_snd).contDiffOn)
(fun i _ _ => normalizedRoundedMap_injective hk (ha i) (hb i) (hr i) (C i))
(fun i _ _ x => normalizedRoundedMap_det_pos hk (ha i) (hb i) (hr i) (C i) x)
(by intro i j hij y _; rw [himage,himage]; exact hnest hij)
(areaRadius T) (areaRadius_pos hT)
(fun i => areaRadius_strictMono (hh i).le hT.le (hiT i))
(by
intro i y _ x hx
rw [himage] at hx
rw [mem_roundDisk_areaRadius hT.le]
have hm : radialArea x ≤ M := hM (mem_image_of_mem radialArea (mem_iUnion.mpr ⟨i,hx⟩))
have ht := le_max_left (M+1) (1+∑ i, h i)
dsimp [T]; linarith)
(by intro i y _; rw [himage,hvol,volume_closedRoundDisk_areaRadius (hh i).le])
refine ⟨areaRadius T,Ψ,?_⟩
intro i x hx
apply hbound i
rw [←himage i 0,←hΨ i 0 (mem_singleton 0)]
exact mem_image_of_mem _ ((mem_closedRoundDisk_areaRadius (hh i).le x).mpr hx)
theorem exists_thin_planar_embedding {A δ : ℝ} (hA : 0 ≤ A) (hδ : 0 < δ) :
∃ q : Plane ≃ₜ Plane, ContDiff ℝ ∞ q ∧ ContDiff ℝ ∞ q.symm ∧
(∀ x v w, planarArea (fderiv ℝ q x v) (fderiv ℝ q x w) = planarArea v w) ∧
∀ x, radialArea x ≤ A →
0 < (q x).1 ∧ (q x).1 < radialArea x+δ ∧ (q x).2 ∈ Ioo 0 1 := by
obtain ⟨m,h,hmono,hh,hgrid⟩ := Comparison.exists_positive_area_grid hA
(show 0 < δ/2 by positivity)
obtain ⟨R,Ψ,hΨ⟩ := exists_hamiltonian_thin_grid h hh hmono hδ
refine ⟨Ψ.isotopy.map 0 1,?_,?_,Ψ.symplectic 0 1,?_⟩
· exact Ψ.isotopy.smooth.comp ((contDiff_const (c := ((0,1) : ℝ × ℝ))).prodMk contDiff_id)
· exact Ψ.isotopy.inverse_smooth.comp ((contDiff_const (c := ((0,1) : ℝ × ℝ))).prodMk contDiff_id)
· intro x hx
have hx0 : 0 ≤ radialArea x := mul_nonneg Real.pi_pos.le (by
dsimp [radiusSq]; positivity)
obtain ⟨i,hi,hiδ⟩ := hgrid (radialArea x) ⟨hx0,hx⟩
have hb := hΨ i x hi
exact ⟨hb.1,by linarith [hb.2.1],hb.2.2⟩
end
section
open scoped ContDiff
open Set Function
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
def productForm (A : E →L[ℝ] E →L[ℝ] ℝ) :
(Plane × E) →L[ℝ] (Plane × E) →L[ℝ] ℝ :=
planarArea.bilinearComp (ContinuousLinearMap.fst ℝ Plane E) (ContinuousLinearMap.fst ℝ Plane E) +
A.bilinearComp (ContinuousLinearMap.snd ℝ Plane E) (ContinuousLinearMap.snd ℝ Plane E)
@[simp] theorem productForm_apply (A : E →L[ℝ] E →L[ℝ] ℝ) (v w : Plane × E) :
productForm A v w = planarArea v.1 w.1 + A v.2 w.2 := by simp [productForm]
def oneCovectorForm (A : E →L[ℝ] E →L[ℝ] ℝ) (c : ℝ) (η : E →L[ℝ] ℝ) :
(Plane × E) →L[ℝ] (Plane × E) →L[ℝ] ℝ :=
let ds := (ContinuousLinearMap.fst ℝ ℝ ℝ).comp (ContinuousLinearMap.fst ℝ Plane E)
let dt := (ContinuousLinearMap.snd ℝ ℝ ℝ).comp (ContinuousLinearMap.fst ℝ Plane E)
let α := η.comp (ContinuousLinearMap.snd ℝ Plane E)
A.bilinearComp (ContinuousLinearMap.snd ℝ Plane E) (ContinuousLinearMap.snd ℝ Plane E) +
c • (ds.smulRight dt - dt.smulRight ds) + α.smulRight dt - dt.smulRight α
@[simp] theorem oneCovectorForm_apply (A : E →L[ℝ] E →L[ℝ] ℝ) (c : ℝ)
(η : E →L[ℝ] ℝ) (v w : Plane × E) :
oneCovectorForm A c η v w = A v.2 w.2 + c*(v.1.1*w.1.2-v.1.2*w.1.1) +
η v.2*w.1.2-v.1.2*η w.2 := by
simp [oneCovectorForm,ContinuousLinearMap.smulRight_apply,smul_eq_mul]
theorem oneCovectorForm_skew {A : E →L[ℝ] E →L[ℝ] ℝ}
(hA : ∀ v w, A v w = -A w v) (c : ℝ) (η : E →L[ℝ] ℝ) (v w : Plane × E) :
oneCovectorForm A c η v w = -oneCovectorForm A c η w v := by
simp only [oneCovectorForm_apply]
rw [hA v.2 w.2]
ring
theorem oneCovectorForm_isInvertible [FiniteDimensional ℝ E] {A : E →L[ℝ] E →L[ℝ] ℝ}
(hA : A.IsInvertible) {c : ℝ} (hc : c ≠ 0) (η : E →L[ℝ] ℝ) :
(oneCovectorForm A c η).IsInvertible := by
let B := oneCovectorForm A c η
have hAi : Injective A := by obtain ⟨e,he⟩ := hA; rw [←he]; exact e.injective
have hBi : Injective B := by
apply (injective_iff_map_eq_zero B).mpr
intro v hv
have ht := congrArg (fun α : (Plane × E) →L[ℝ] ℝ => α ((1,0),0)) hv
have ht0 : v.1.2 = 0 := by
simp only [B,oneCovectorForm_apply,map_zero,mul_zero,sub_zero,mul_one,zero_add,
zero_sub,zero_apply] at ht
have he : c*v.1.2 = 0 := by linarith
exact (mul_eq_zero.mp he).resolve_left hc
have hf : A v.2 = 0 := by
apply ContinuousLinearMap.ext
intro z
have hz := congrArg (fun α : (Plane × E) →L[ℝ] ℝ => α ((0,0),z)) hv
simpa [B,ht0] using hz
have hf0 : v.2 = 0 := hAi (hf.trans A.map_zero.symm)
have hs := congrArg (fun α : (Plane × E) →L[ℝ] ℝ => α ((0,1),0)) hv
have hs0 : v.1.1 = 0 := by
simp only [B,oneCovectorForm_apply,hf0,ht0,map_zero,mul_zero,mul_one,sub_zero,
zero_add,add_zero,zero_apply] at hs
exact (mul_eq_zero.mp hs).resolve_left hc
exact Prod.ext (Prod.ext hs0 ht0) hf0
have hBs : Surjective B := by
intro β
let t : ℝ := -β ((1,0),0)/c
let α : E →L[ℝ] ℝ := β.comp (ContinuousLinearMap.inr ℝ Plane E) + t • η
let z := A.inverse α
let s := (β ((0,1),0)-η z)/c
refine ⟨((s,t),z),?_⟩
apply ContinuousLinearMap.ext
intro v
have hz : A z v.2 = β ((0,0),v.2)+t*η v.2 := by
change A (A.inverse α) v.2 = _
rw [hA.self_apply_inverse]
rfl
have ht : c*t = -β ((1,0),0) := by dsimp [t]; field_simp
have hs : c*s = β ((0,1),0)-η z := by dsimp [s]; field_simp
have hβ : β v = v.1.1*β ((1,0),0)+v.1.2*β ((0,1),0)+β ((0,0),v.2) := by
conv_lhs => rw [show v = v.1.1 • (((1,0),0) : Plane × E) +
v.1.2 • (((0,1),0) : Plane × E) + ((0,0),v.2) by ext <;> simp]
simp only [map_add,map_smul,smul_eq_mul]
change oneCovectorForm A c η ((s,t),z) v = _
rw [oneCovectorForm_apply,hz,hβ]
linear_combination v.1.2*hs-v.1.1*ht
exact ⟨(LinearEquiv.ofBijective B.toLinearMap ⟨hBi,hBs⟩).toContinuousLinearEquiv,rfl⟩
end
section
open scoped ContDiff Topology
open Set Function
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
def planarProduct (q : Plane ≃ₜ Plane) : (Plane × E) ≃ₜ (Plane × E) :=
q.prodCongr (Homeomorph.refl E)
@[fun_prop] theorem planarProduct_smooth {q : Plane ≃ₜ Plane} (hq : ContDiff ℝ ∞ q) :
ContDiff ℝ ∞ (planarProduct (E := E) q) :=
(hq.comp contDiff_fst).prodMk contDiff_snd
theorem planarProduct_fderiv {q : Plane ≃ₜ Plane} (hq : ContDiff ℝ ∞ q)
(p v : Plane × E) : fderiv ℝ (planarProduct q) p v = (fderiv ℝ q p.1 v.1,v.2) := by
have hd := (((hq.differentiable (by simp) p.1).hasFDerivAt).comp p
(hasFDerivAt_fst (𝕜 := ℝ) (p := p))).prodMk (hasFDerivAt_snd (𝕜 := ℝ) (p := p))
change HasFDerivAt (planarProduct q) _ p at hd
rw [hd.fderiv]
rfl
theorem planarProduct_pullback {q : Plane ≃ₜ Plane} (hq : ContDiff ℝ ∞ q)
(hqs : ∀ x v w, planarArea (fderiv ℝ q x v) (fderiv ℝ q x w) = planarArea v w)
(B : E →L[ℝ] E →L[ℝ] ℝ) (p v w : Plane × E) :
productForm B (fderiv ℝ (planarProduct q) p v) (fderiv ℝ (planarProduct q) p w) =
productForm B v w := by
rw [planarProduct_fderiv hq,planarProduct_fderiv hq]
simp only [productForm_apply]
rw [hqs]
end
open scoped ContDiff Topology
open Set Function
variable {Q : Type*} [NormedAddCommGroup Q] [NormedSpace ℝ Q] [CompleteSpace Q]
theorem monotone_strip_inverse {f : Q × ℝ → ℝ} (hf : ContDiff ℝ ∞ f)
{U : Set Q} (hU : IsOpen U) {a b : ℝ} (hab : a < b) {h : Q → ℝ}
(hderiv : ∀ q ∈ U, ∀ s ∈ Ioo a b, 0 < deriv (fun r => f (q,r)) s)
(hlo : ∀ q ∈ U, f (q,a) = 0) (hhi : ∀ q ∈ U, h q < f (q,b)) :
∃ (W : Set (Q × ℝ)) (g : Q × ℝ → ℝ), IsOpen W ∧ ContDiffOn ℝ ∞ g W ∧
W = (fun p : Q × ℝ => (p.1,f p)) '' (U ×ˢ Ioo a b) ∧
(∀ q ∈ U, ∀ x, 0 < x → x < h q → (q,x) ∈ W) ∧
(∀ q ∈ U, ∀ s ∈ Ioo a b, g (q,f (q,s)) = s) ∧
(∀ p ∈ W, p.1 ∈ U ∧ g p ∈ Ioo a b ∧ f (p.1,g p) = p.2) := by
have hc (q : Q) : Continuous (fun s => f (q,s)) :=
hf.continuous.comp (continuous_const.prodMk continuous_id)
have hm (q : Q) (hq : q ∈ U) : StrictMonoOn (fun s => f (q,s)) (Icc a b) := by
apply strictMonoOn_of_deriv_pos (convex_Icc a b) (hc q).continuousOn
simpa only [interior_Icc] using hderiv q hq
have hinj (q : Q) : InjOn (fun s => f (q,s)) {s | (q,s) ∈ U ×ˢ Ioo a b} := by
intro s hs t ht he
exact (hm q hs.1).injOn ⟨hs.2.1.le,hs.2.2.le⟩ ⟨ht.2.1.le,ht.2.2.le⟩ he
have hiv (p : Q × ℝ) (hp : p ∈ U ×ˢ Ioo a b) :
(fderiv ℝ (fun s => f (p.1,s)) p.2).IsInvertible := by
let c := deriv (fun s => f (p.1,s)) p.2
have hc0 : c ≠ 0 := ne_of_gt (hderiv p.1 hp.1 p.2 hp.2)
let e : ℝ ≃L[ℝ] ℝ := (LinearEquiv.smulOfNeZero ℝ ℝ c hc0).toContinuousLinearEquiv
refine ⟨e,?_⟩
ext
simp [e,c]
obtain ⟨W,g,hWo,hgs,hWe,hleft,hright⟩ := parametric_inverse_on f hf
(U ×ˢ Ioo a b) (hU.prod isOpen_Ioo) hinj hiv
refine ⟨W,g,hWo,hgs,hWe,?_,?_,?_⟩
· intro q hq x hx0 hxh
have hh : x ∈ Ioo (f (q,a)) (f (q,b)) := ⟨by rwa [hlo q hq],hxh.trans (hhi q hq)⟩
obtain ⟨s,hs,hse⟩ := intermediate_value_Ioo hab.le (hc q).continuousOn hh
rw [hWe]
exact ⟨(q,s),⟨hq,hs⟩,Prod.ext rfl hse⟩
· intro q hq s hs
exact (hleft (q,s) ⟨hq,hs⟩).2
· intro p hp
exact ⟨(hright p hp).1.1,(hright p hp).1.2,(hright p hp).2⟩
end PackingSufficiencySupport.Hamiltonian
end
end OAI
|