Download lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/CompiledGeometry.lean from roseking/openAI-math-dataset: direct link, hf CLI and curl.
intro i j hij
by_contra! h
letx : Space:=fun k => max (A.center i k - A.width i k) (A.center j k - A.width j k)
have hh (k : Fin3) :
-(A.width i k + A.width j k) ≤A.center i k - A.center j k ∧A.center i k - A.center j k ≤A.width i k + A.width j k :=byhave:= h k
simp only [mul_zero, add_zero] at this
exact abs_le.mp this
havehi : x ∈A.solid i :=by
rw [BoxLayout.mem_solid]
intro k
refine ⟨le_max_left _ _, max_le ?_ ?_⟩
· linarith [hp i k]
· linarith [(hh k).1]
havehj : x ∈A.solid j :=by
rw [BoxLayout.mem_solid]
intro k
refine ⟨le_max_right _ _, max_le ?_ ?_⟩
· linarith [(hh k).2]
· linarith [hp j k]
exact Set.disjoint_left.mp (hs hij) hi hj
lemmalayout_solid [Fintype ι] (r : ℝ) (digit : S→ℝ) (o : ι →Space)
(u : ι →Fin3→ListS) (i : ι) :
(layout r digit o u).solid i = box r digit (o i) (u i) :=by
proof · 9
lines
ext x
rw [BoxLayout.mem_solid]
change (∀ k, o i k + word r digit (u i k) + r ^ (u i k).length / 2 -
r ^ (u i k).length / 2≤ x k ∧
x k ≤ o i k + word r digit (u i k) + r ^ (u i k).length / 2 +
r ^ (u i k).length / 2) ↔∀ k, word r digit (u i k) ≤ x k - o i k ∧
x k - o i k ≤ word r digit (u i k) + r ^ (u i k).length
constructor <;> intro h k <;> have:= h k <;> constructor <;> linarith
lemmalayout_affineMap {r : ℝ} (hr : r ≠0) (digit : S→ℝ) (o p : ι →Space)
(u v : ι →Fin3→ListS) (i : ι) (x : Space) :
(layout r digit o u).affineMap (layout r digit p v) i x =
boxMap r digit (o i) (p i) (u i) (v i) x :=by
proof · 4
lines
ext k
dsimp [BoxLayout.affineMap, layout, boxMap, replacement]
field_simp
ring
lemmalayout_volume (r : ℝ) (digit : S→ℝ) (o p : ι →Space)
(u v : ι →Fin3→ListS) (i : ι)
(h : ∑ k, (u i k).length = ∑ k, (v i k).length) :
∏ k, (layout r digit o u).width i k = ∏ k, (layout r digit p v).width i k :=by
proof · 1
line
simp only [layout, Finset.prod_div_distrib, Finset.prod_pow_eq_pow_sum, h]
apply BoxLayout.separated_of_disjoint (sourceLayout_positive M)
intro i j hij
rw [sourceLayout_solid, sourceLayout_solid]
exact (compiled_boxes_disjoint M).1 i.property j.property (fun h => hij (Subtype.ext h))
apply BoxLayout.separated_of_disjoint (targetLayout_positive M)
intro i j hij
rw [targetLayout_solid, targetLayout_solid]
exact (compiled_boxes_disjoint M).2 i.property j.property (fun h => hij (Subtype.ext h))
intro i _
have hh :=BoxLayout.lower_mem (sourceLayout_positive M) i
rw [sourceLayout_solid] at hh
have hn := source_box_guard M i.val ((mem_table M _).mp i.property) hh
change 2 < (sourceLayout M).center i 0 - (sourceLayout M).width i 0
change 4≤ (sourceLayout M).center i 0 - (sourceLayout M).width i 0 at hn
linarith
intro i hi
have hh :=BoxLayout.lower_mem (targetLayout_positive M) i
rw [targetLayout_solid] at hh
have hn := nonhalt_box_guard M _ hi _ hh
change 2 < (targetLayout M).center i 0 - (targetLayout M).width i 0
change 4≤ (targetLayout M).center i 0 - (targetLayout M).width i 0 at hn
linarith
lemmalayouts_affineMap (M : MachineQ Γ) (i : ActiveRowM) (x : Space) :
(sourceLayout M).affineMap (targetLayout M) i x = (i.val.instruction M).fullMap M x :=
theoremexists_guarded_template (M : MachineQ Γ) :
∃ (v : Velocity) (K : SetSpace), IsCompactK∧JointSmooth v ∧TimeCollars v ∧SpatiallySupportedK v ∧ (∀ t x, div v t x = 0) ∧GuardedTemplateM v :=by
proof · 16
lines
obtain ⟨η, hη, ⟨m⟩⟩ := guarded_solid_box_motion (sourceLayout M) (targetLayout M)
(safeRows M) (sourceLayout_positive M) (targetLayout_positive M)
(sourceLayout_separated M) (targetLayout_separated M) (layouts_equal_volume M)
(sourceLayout_guard M) (targetLayout_guard M)
obtain ⟨K, hK, hs⟩ := m.velocity_compact_support hη
refine ⟨m.velocity, K, hK, m.velocity_jointSmooth, m.velocity_collars, hs,
m.velocity_divergence, ?_⟩
intro r hr x hx
leti : ActiveRowM:= ⟨r, (mem_table M r).mpr hr⟩
havehm : x ∈ (sourceLayout M).solid i :=by rwa [sourceLayout_solid]
refine ⟨m.path i x, m.path_start i x, ?_, ?_, ?_⟩
· rw [m.path_end, layouts_affineMap]
· intro t _
exact (m.path_hasDerivAt hη hm t).hasDerivWithinAt
· intro hsafe t _
exact m.path_guarded hsafe hm t