cfahlgren1's picture
download
raw
9.02 kB
import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.Elementary
namespace OAI
noncomputable section
namespace BalancedTransport.Geometry
open Set Filter
open scoped Topology
variable {ι : Type*} [Fintype ι]
@[ext] structure BoxLayout (ι : Type*) where
center : ι → Space
width : ι → Space
end BalancedTransport.Geometry
end
noncomputable section
namespace BalancedTransport.Geometry.BoxLayout
open Set Filter
open scoped Topology
variable {ι : Type*} [Fintype ι]
def Positive (A : BoxLayout ι) : Prop := ∀ i k, 0 < A.width i k
def Separated (A : BoxLayout ι) (η : ℝ) : Prop :=
∀ i j, i ≠ j → ∃ k, A.width i k + A.width j k + 4 * η < |A.center i k - A.center j k|
def Guarded (A : BoxLayout ι) (safe : Set ι) : Prop :=
∀ i ∈ safe, 2 < A.center i 0 - A.width i 0
end BalancedTransport.Geometry.BoxLayout
end
noncomputable section
namespace BalancedTransport.Geometry
open Set Filter
open scoped Topology
variable {ι : Type*} [Fintype ι]
structure BoxMotion (A B : BoxLayout ι) (safe : Set ι) (η : ℝ) where
center : ℝ → ι → Space
width : ℝ → ι → Space
smooth_center : ContDiff ℝ (⊤ : ℕ∞) center
smooth_width : ContDiff ℝ (⊤ : ℕ∞) width
start_center : ∀ t, t ≤ 0 → center t = A.center
start_width : ∀ t, t ≤ 0 → width t = A.width
end_center : ∀ t, 1 ≤ t → center t = B.center
end_width : ∀ t, 1 ≤ t → width t = B.width
positive : ∀ t i k, 0 < width t i k
volume : ∀ t i, ∏ k, width t i k = ∏ k, A.width i k
separation : ∀ t, (BoxLayout.mk (center t) (width t)).Separated η
guard : ∀ t, (BoxLayout.mk (center t) (width t)).Guarded safe
end BalancedTransport.Geometry
end
noncomputable section
namespace BalancedTransport.Geometry.BoxMotion
open Set Filter
open scoped Topology
variable {ι : Type*} [Fintype ι]
variable {A B C : BoxLayout ι} {safe : Set ι} {η : ℝ}
lemma positive_start (m : BoxMotion A B safe η) : A.Positive := by
have hh := m.positive 0
rwa [m.start_width 0 le_rfl] at hh
lemma positive_end (m : BoxMotion A B safe η) : B.Positive := by
have hh := m.positive 1
rwa [m.end_width 1 le_rfl] at hh
lemma volume_end (m : BoxMotion A B safe η) (i : ι) :
∏ k, B.width i k = ∏ k, A.width i k := by
simpa only [m.end_width 1 le_rfl] using m.volume 1 i
def stationary (hp : A.Positive) (hs : A.Separated η) (hg : A.Guarded safe) :
BoxMotion A A safe η where
center := fun _ => A.center
width := fun _ => A.width
smooth_center := contDiff_const
smooth_width := contDiff_const
start_center := fun _ _ => rfl
start_width := fun _ _ => rfl
end_center := fun _ _ => rfl
end_width := fun _ _ => rfl
positive := fun _ => hp
volume := by intros; rfl
separation := fun _ => hs
guard := fun _ => hg
private def joinedCenter (m : BoxMotion A B safe η) (n : BoxMotion B C safe η)
(t : ℝ) : ι → Space := m.center (2 * t) + n.center (2 * t - 1) - B.center
private def joinedWidth (m : BoxMotion A B safe η) (n : BoxMotion B C safe η)
(t : ℝ) (i : ι) (k : Fin 3) : ℝ :=
m.width (2 * t) i k * n.width (2 * t - 1) i k / B.width i k
private lemma joined_left (m : BoxMotion A B safe η) (n : BoxMotion B C safe η)
{t : ℝ} (ht : t ≤ 1 / 2) :
joinedCenter m n t = m.center (2 * t) ∧ joinedWidth m n t = m.width (2 * t) := by
have h := n.start_center (2 * t - 1) (by linarith)
have hw := n.start_width (2 * t - 1) (by linarith)
constructor
· simp [joinedCenter, h]
· ext i k
simp [joinedWidth, hw, ne_of_gt (m.positive_end i k)]
private lemma joined_right (m : BoxMotion A B safe η) (n : BoxMotion B C safe η)
{t : ℝ} (ht : 1 / 2 ≤ t) :
joinedCenter m n t = n.center (2 * t - 1) ∧ joinedWidth m n t = n.width (2 * t - 1) := by
have h := m.end_center (2 * t) (by linarith)
have hw := m.end_width (2 * t) (by linarith)
constructor
· simp [joinedCenter, h, add_sub_cancel_left]
· ext i k
simp [joinedWidth, hw, mul_div_cancel_left₀ _ (ne_of_gt (m.positive_end i k))]
def trans (m : BoxMotion A B safe η) (n : BoxMotion B C safe η) :
BoxMotion A C safe η where
center := joinedCenter m n
width := joinedWidth m n
smooth_center := by
exact ((m.smooth_center.comp (contDiff_const.mul contDiff_id)).add
(n.smooth_center.comp ((contDiff_const.mul contDiff_id).sub contDiff_const))).sub contDiff_const
smooth_width := by
apply contDiff_pi.mpr
intro i
apply contDiff_pi.mpr
intro k
exact (((contDiff_pi.mp (contDiff_pi.mp m.smooth_width i) k).comp
(contDiff_const.mul contDiff_id)).mul
((contDiff_pi.mp (contDiff_pi.mp n.smooth_width i) k).comp
((contDiff_const.mul contDiff_id).sub contDiff_const))).div_const _
start_center := by
intro t ht
rw [(joined_left m n (by linarith : t ≤ 1 / 2)).1, m.start_center _ (by linarith)]
start_width := by
intro t ht
rw [(joined_left m n (by linarith : t ≤ 1 / 2)).2, m.start_width _ (by linarith)]
end_center := by
intro t ht
rw [(joined_right m n (by linarith : 1 / 2 ≤ t)).1, n.end_center _ (by linarith)]
end_width := by
intro t ht
rw [(joined_right m n (by linarith : 1 / 2 ≤ t)).2, n.end_width _ (by linarith)]
positive := by
intro t i k
rcases le_total t (1 / 2) with ht | ht
· rw [(joined_left m n ht).2]; exact m.positive _ _ _
· rw [(joined_right m n ht).2]; exact n.positive _ _ _
volume := by
intro t i
rcases le_total t (1 / 2) with ht | ht
· rw [(joined_left m n ht).2]; exact m.volume _ _
· rw [(joined_right m n ht).2, n.volume, m.volume_end]
separation := by
intro t
rcases le_total t (1 / 2) with ht | ht
· rw [(joined_left m n ht).1, (joined_left m n ht).2]; exact m.separation _
· rw [(joined_right m n ht).1, (joined_right m n ht).2]; exact n.separation _
guard := by
intro t
rcases le_total t (1 / 2) with ht | ht
· rw [(joined_left m n ht).1, (joined_left m n ht).2]; exact m.guard _
· rw [(joined_right m n ht).1, (joined_right m n ht).2]; exact n.guard _
def reverse (m : BoxMotion A B safe η) : BoxMotion B A safe η where
center := fun t => m.center (1 - t)
width := fun t => m.width (1 - t)
smooth_center := m.smooth_center.comp (contDiff_const.sub contDiff_id)
smooth_width := m.smooth_width.comp (contDiff_const.sub contDiff_id)
start_center := fun _ ht => m.end_center _ (by linarith)
start_width := fun _ ht => m.end_width _ (by linarith)
end_center := fun _ ht => m.start_center _ (by linarith)
end_width := fun _ ht => m.start_width _ (by linarith)
positive := fun _ => m.positive _
volume := fun _ i => (m.volume _ i).trans (m.volume_end i).symm
separation := fun _ => m.separation _
guard := fun _ => m.guard _
end BalancedTransport.Geometry.BoxMotion
end
noncomputable section
namespace BalancedTransport.Geometry
open Set Filter
open scoped Topology
variable {ι : Type*} [Fintype ι]
def segmentLayout (a b w : ι → Space) (r : ℝ) : BoxLayout ι :=
⟨fun i k => (1 - r) * a i k + r * b i k, w⟩
omit [Fintype ι] in
lemma segmentLayout_start (a b w : ι → Space) : segmentLayout a b w 0 = ⟨a, w⟩ := by
ext i k <;> simp [segmentLayout]
omit [Fintype ι] in
lemma segmentLayout_end (a b w : ι → Space) : segmentLayout a b w 1 = ⟨b, w⟩ := by
ext i k <;> simp [segmentLayout]
def segmentMotion {a b w : ι → Space} {safe : Set ι} {η : ℝ}
(hp : ∀ i k, 0 < w i k)
(hs : ∀ r ∈ Icc (0 : ℝ) 1, (segmentLayout a b w r).Separated η)
(hg : ∀ r ∈ Icc (0 : ℝ) 1, (segmentLayout a b w r).Guarded safe) :
BoxMotion ⟨a, w⟩ ⟨b, w⟩ safe η where
center := fun t => (segmentLayout a b w (Real.smoothTransition t)).center
width := fun _ => w
smooth_center := by
unfold segmentLayout
fun_prop
smooth_width := contDiff_const
start_center := by
intro t ht
simp [segmentLayout, Real.smoothTransition.zero_of_nonpos ht]
start_width := by intros; rfl
end_center := by
intro t ht
simp [segmentLayout, Real.smoothTransition.one_of_one_le ht]
end_width := by intros; rfl
positive := fun _ => hp
volume := by intros; rfl
separation := fun _ => hs _ ⟨Real.smoothTransition.nonneg _, Real.smoothTransition.le_one _⟩
guard := fun _ => hg _ ⟨Real.smoothTransition.nonneg _, Real.smoothTransition.le_one _⟩
omit [Fintype ι] in
lemma segment_guard {a b w : ι → Space} {safe : Set ι}
(ha : (BoxLayout.mk a w).Guarded safe) (hb : (BoxLayout.mk b w).Guarded safe)
{r : ℝ} (hr : r ∈ Icc (0 : ℝ) 1) : (segmentLayout a b w r).Guarded safe := by
intro i hi
have hh₀ := ha i hi
have hh₁ := hb i hi
change 2 < (1 - r) * a i 0 + r * b i 0 - w i 0
by_cases he : r = 1
· simpa [he] using hh₁
· have h₀ : 0 < 1 - r := sub_pos.mpr (lt_of_le_of_ne hr.2 he)
nlinarith [mul_pos (sub_pos.mpr hh₀) h₀,
mul_nonneg (sub_nonneg.mpr (le_of_lt hh₁)) hr.1]
end BalancedTransport.Geometry
end
end OAI

Xet Storage Details

Size:
9.02 kB
·
Xet hash:
a1e9d75799987c90d6225930daf58ab92da29f9fc95c48cd904daddd1a5223fb

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.