Download lean/OAI/MathematicalPhysics/NavierStokes/VelocityDetection/ExpandingArray.lean from roseking/openAI-math-dataset: direct link, hf CLI and curl.
defpath (n : ℕ) (c : Active hb table (capacity b m n)) : ℝ→Coord2:=
body · 4
lines
CenterPaths.center (startTime ν (K₀N b m) (D b) n)
(duration ν (K₀N b m) (D b) n)
(spacing ν (K₀N b m) (D b) n) (spacing ν (K₀N b m) (D b) (n + 1))
(sign terminal (target hb table c).state) (sourceAddress c.val) (targetAddress hb table c)
∑c : Active hb table (capacity b m n), TranslationGates.field
(radius ν (K₀N b m) (D b) n) (path hb table terminal ν m n c t)
(deriv (path hb table terminal ν m n c) t) X
@[fun_prop]theoremcontDiff_path (n : ℕ) (c : Active hb table (capacity b m n)) :
ContDiffℝ∞ (path hb table terminal ν m n c) :=by unfold path; fun_prop
@[fun_prop]theoremcontDiff_stage (n : ℕ) :
ContDiffℝ∞ (funq : ℝ×Coord2=> stage hb table terminal ν m n q.1 q.2) :=by
proof · 5
lines
dsimp [stage]
apply ContDiff.sum
intro c _
exact TranslationGates.contDiff_movingField _ (contDiff_path hb table terminal ν m n c)
((contDiff_infty_iff_deriv.mp (contDiff_path hb table terminal ν m n c)).2)
theoremdivergence_stage (n : ℕ) (t : ℝ) (X : Coord2) :
divergence (stage hb table terminal ν m n) t X = 0:=by
proof · 10
lines
change divergence (fun t X=>∑c : Active hb table (capacity b m n),
TranslationGates.field (radius ν (K₀N b m) (D b) n)
(path hb table terminal ν m n c t) (deriv (path hb table terminal ν m n c) t) X) t X = 0
rw [SpatialCalculus.divergence_sum]
· apply Finset.sum_eq_zero
intro c _
exact TranslationGates.divergence_field (radius ν (K₀N b m) (D b) n)
(path hb table terminal ν m n c t) (deriv (path hb table terminal ν m n c) t) X
· intro c _ s
exact TranslationGates.contDiff_field _ _ _
theoremstage_zero_before (hν : 0 < ν) (n : ℕ) {t : ℝ}
(ht : t ≤ startTime ν (K₀N b m) (D b) n) (X : Coord2) :
stage hb table terminal ν m n t X = 0:=by
proof · 6
lines
apply Finset.sum_eq_zero
intro c _
change CenterPaths.gate _ _ _ _ _ _ _ _ t X = 0
exact CenterPaths.gate_zero_before
(lt_of_lt_of_le (by norm_num) (duration_ge_one hν (K₀_nonnegN b m) (D_ge_one hb) n))
_ _ _ _ _ _ _ ht X
have h (c : Active hb table (capacity b m n)) : HasCompactSupport
(funq : ℝ×Coord2=>TranslationGates.field
(radius ν (K₀N b m) (D b) n) (path hb table terminal ν m n c q.1)
(deriv (path hb table terminal ν m n c) q.1) q.2) :=by
apply CenterPaths.compactSupport_gate
· linarith [radius_ge_one hν (K₀_nonnegN b m) (D_ge_one hb) n]
· linarith [duration_ge_one hν (K₀_nonnegN b m) (D_ge_one hb) n]
simpa only [stage, Finset.sum_fn] usingHasCompactSupport.finset_sum
(s :=Finset.univ) (fun c _ => h c)
theoremfield_eq_finite (hν : 0 < ν) {Q : ℕ} {t : ℝ} (ht : t < Q) (X : Coord2) :
field hb table terminal ν m t X = ∑ n ∈Finset.range Q, stage hb table terminal ν m n t X:=by
proof · 6
lines
apply tsum_eq_sum
intro n hn
apply stage_zero_before hb table terminal ν m hν n _ Xhavehn' : Q≤ n :=by simpa using hn
havehc : (Q : ℝ) ≤ n :=by exact_mod_cast hn'
linarith [startTime_ge hν (K₀_nonnegN b m) (D_ge_one hb) n]
theoremfield_at_rest (hν : 0 < ν) {t : ℝ} (ht : t ≤1) (X : Coord2) :
field hb table terminal ν m t X = 0:=by
proof · 8
lines
change (∑' n : ℕ, stage hb table terminal ν m n t X) = 0calc
_ = ∑' n : ℕ, (0 : Coord2) :=by
apply tsum_congr
intro n
apply stage_zero_before hb table terminal ν m hν n _ X
linarith [startTime_ge hν (K₀_nonnegN b m) (D_ge_one hb) n, Nat.cast_nonneg (α :=ℝ) n]
_ = _ := tsum_zero
theoremfield_eq_stage (hν : 0 < ν) (n : ℕ) {t : ℝ}
(ht : t ∈Icc (startTime ν (K₀N b m) (D b) n) (startTime ν (K₀N b m) (D b) (n + 1)))
(X : Coord2) : field hb table terminal ν m t X = stage hb table terminal ν m n t X:=by
proof · 6
lines
apply tsum_eq_single n
intro k hk
have hm := (startTime_strictMono hν (K₀_nonnegN b m) (D_ge_one hb)).monotone
rcases lt_or_gt_of_ne hk with h | h
· exact stage_zero_after hb table terminal ν m hν k ((hm (by omega)).trans ht.1) X
· exact stage_zero_before hb table terminal ν m hν k (ht.2.trans (hm (by omega))) X
theoremdivergence_field (hν : 0 < ν) (t : ℝ) (X : Coord2) :
divergence (field hb table terminal ν m) t X = 0:=by
proof · 9
lines
obtain ⟨Q, hQ⟩ := exists_nat_gt t
have heq := funext (field_eq_finite hb table terminal ν m hν hQ)
rw [SpatialCalculus.divergence_congr_at
(v :=fun s X=>∑ n ∈Finset.range Q, stage hb table terminal ν m n s X) t X heq]
have hs (n : ℕ) (_ : n ∈Finset.range Q) (s : ℝ) :
ContDiffℝ∞ (stage hb table terminal ν m n s) :=SpatialCalculus.contDiff_slice (contDiff_stage hb table terminal ν m n) s
exact (SpatialCalculus.divergence_sum (Finset.range Q) (stage hb table terminal ν m) hs t X).trans
(by simp only [divergence_stage, Finset.sum_const_zero])
theorempaths_separated (hν : 0 < ν) (hm : 1≤ m)
(hdir : IncomingDirection table) (hin : IncomingRule table) (n : ℕ)
(c d : Active hb table (capacity b m n)) (hcd : c ≠ d) (t : ℝ) :
∃i : Fin2, 16 * radius ν (K₀N b m) (D b) n ≤
|path hb table terminal ν m n c t i - path hb table terminal ν m n d t i| :=by
proof · 8
lines
havehB : 0 < capacity b m n := pow_pos hb _
havehc : sourceAddress c.val ≠ sourceAddress d.val :=by
intro h
exact hcd (Subtype.ext (sourceAddress_injective hB h))
havehd : targetAddress hb table c ≠ targetAddress hb table d :=
(targetAddress_injective hb table hB (capacity_dvd hm) hdir hin).ne hcd
exact CenterPaths.separated (spacing_pos hν (K₀_nonnegN b m) (D_ge_one hb) n).le
(spacing_next_ge hν (K₀_nonnegN b m) (D_ge_one hb) n) _ _ _ _ t hc hd
theoremstage_plateau (hν : 0 < ν) (hm : 1≤ m)
(hdir : IncomingDirection table) (hin : IncomingRule table) (n : ℕ)
(c : Active hb table (capacity b m n)) (t : ℝ) (X : Coord2)
(hX : ∀ i, |X i - path hb table terminal ν m n c t i| ≤ radius ν (K₀N b m) (D b) n) :
stage hb table terminal ν m n t X = deriv (path hb table terminal ν m n c) t :=by
proof · 6
lines
apply TranslationGates.array_plateau
(lt_of_lt_of_le (by norm_num) (radius_ge_one hν (K₀_nonnegN b m) (D_ge_one hb) n))
(fun d => path hb table terminal ν m n d t)
(fun d => deriv (path hb table terminal ν m n d) t)
(fun d _ e _ h => paths_separated hb table terminal ν m hν hm hdir hin n d e h t)
(Finset.mem_univ c) X hX
theoremfield_plateau (hν : 0 < ν) (hm : 1≤ m)
(hdir : IncomingDirection table) (hin : IncomingRule table) (n : ℕ)
(c : Active hb table (capacity b m n)) {t : ℝ}
(ht : t ∈Icc (startTime ν (K₀N b m) (D b) n) (startTime ν (K₀N b m) (D b) (n + 1)))
(X : Coord2)
(hX : ∀ i, |X i - path hb table terminal ν m n c t i| ≤ radius ν (K₀N b m) (D b) n) :
field hb table terminal ν m t X = deriv (path hb table terminal ν m n c) t :=by
proof · 2
lines
rw [field_eq_stage hb table terminal ν m hν n ht]
exact stage_plateau hb table terminal ν m hν hm hdir hin n c t X hX
theorempath_negative (hν : 0 < ν) (n : ℕ)
(c : Active hb table (capacity b m n))
(hc : (target hb table c).state ≠ terminal) (t : ℝ) :
path hb table terminal ν m n c t 1≤ -spacing ν (K₀N b m) (D b) n :=by
proof · 4
lines
unfold path
rw [sign, ite_eq_right hc]
exact CenterPaths.negative_height (spacing_pos hν (K₀_nonnegN b m) (D_ge_one hb) n).le
(spacing_next_ge hν (K₀_nonnegN b m) (D_ge_one hb) n) _ _ _ _ _
theorempath_end (hν : 0 < ν) (n : ℕ) (c : Active hb table (capacity b m n)) :
path hb table terminal ν m n c (startTime ν (K₀N b m) (D b) (n + 1)) =
![spacing ν (K₀N b m) (D b) (n + 1) * targetAddress hb table c,
sign terminal (target hb table c).state * spacing ν (K₀N b m) (D b) (n + 1)] :=
proof · 3
lines
CenterPaths.center_end
(lt_of_lt_of_le (by norm_num) (duration_ge_one hν (K₀_nonnegN b m) (D_ge_one hb) n))
_ _ _ _ _ _
theorempath_coordinate_bounds (hν : 0 < ν) (hm : 1≤ m) (n : ℕ)
(c : Active hb table (capacity b m n)) :
|spacing ν (K₀N b m) (D b) n| ≤ duration ν (K₀N b m) (D b) n ∧
|spacing ν (K₀N b m) (D b) n * sourceAddress c.val| ≤ duration ν (K₀N b m) (D b) n ∧
|spacing ν (K₀N b m) (D b) (n + 1) * targetAddress hb table c| ≤ duration ν (K₀N b m) (D b) n ∧
|CenterPaths.privateRow (spacing ν (K₀N b m) (D b) n) (sourceAddress c.val)| ≤
duration ν (K₀N b m) (D b) n ∧
|sign terminal (target hb table c).state * spacing ν (K₀N b m) (D b) (n + 1)| ≤
duration ν (K₀N b m) (D b) n :=by
proof · 6
lines
apply Expanding.path_coordinate_bounds hν (K₀_nonnegN b m) (D_ge_one hb) n
· rw [count_eq]
exact_mod_cast sourceAddress_count c.val
· rw [count_eq, capacity_succ]
exact_mod_cast targetAddress_count hb table (capacity_dvd hm) c
· simp
theorempath_derivative_bounds (hν : 0 < ν) (hm : 1≤ m) (j : ℕ) :
∃C : ℝ, 0≤C∧∀ (n : ℕ) (c : Active hb table (capacity b m n)) (t : ℝ) (i : Fin2),
|iteratedDeriv (j + 1) (fun s => path hb table terminal ν m n c s i) t| ≤C / duration ν (K₀N b m) (D b) n ^ j :=by
proof · 7
lines
obtain ⟨C, hC, hc⟩ :=CenterPaths.center_derivative_bound j
refine ⟨C, hC, ?_⟩
intro n c t i
obtain ⟨hS, hSk, hSl, hY, hσ⟩ := path_coordinate_bounds hb table terminal ν m hν hm n c
exact hc _ _ _ _ _ _ _
(lt_of_lt_of_le (by norm_num) (duration_ge_one hν (K₀_nonnegN b m) (D_ge_one hb) n))
hS hSk hSl hY hσ t i