Download lean/OAI/MathematicalPhysics/NavierStokes/VelocityDetection/ExpandingArrayLoss.lean from roseking/openAI-math-dataset: direct link, hf CLI and curl.
theoremloading_loss_le_loss (hν : 0 < ν) :
ν * 3000 / radius ν (K₀N b m) (D b) 0 ^ 2≤ loss (N:=N) (b := b) ν m :=by
proof · 10
lines
haveheq : ν * 3000 / radius ν (K₀N b m) (D b) 0 ^ 2 =
ν * 3000 * (initialRadius ν (K₀N b m) (D b))⁻¹ ^ 2:=by
simp only [radius, pow_zero, mul_one, inv_pow, div_eq_mul_inv]
rw [heq, loss, mul_add]
havehs : 0≤∑' n : ℕ, duration ν (K₀N b m) (D b) n /
radius ν (K₀N b m) (D b) n ^ 2:=
tsum_nonneg (fun n => (loss_term_bound hν (K₀_nonnegN b m) (D_ge_one hb) n).1)
have : 0≤ ν * 3000 * (∑' n : ℕ, duration ν (K₀N b m) (D b) n /
radius ν (K₀N b m) (D b) n ^ 2) :=by positivity
linarith
theoremretained_loading {t : ℝ} (ht : t ∈Icc (0 : ℝ) 1) :
(∫X, ρ t X) - capture (radius ν (K₀N b m) (D b) 0)
(fun _ => point hb table terminal ν m c₀ 0) ρ t ≤
ν * 3000 / radius ν (K₀N b m) (D b) 0 ^ 2:=by
proof · 32
lines
havehR : 0 < radius ν (K₀N b m) (D b) 0:=
lt_of_lt_of_le zero_lt_one (radius_ge_one hν (K₀_nonnegN b m) (D_ge_one hb) 0)
have hu (s : ℝ) (hs : s ∈Ioo (0 : ℝ) t) : 0≤ s := hs.1.le
have h := retention_on_interval (ν := ν)
(R:= radius ν (K₀N b m) (D b) 0)
(a := field hb table terminal ν m) (g := impulse (point hb table terminal ν m c₀ 0))
(c :=fun _ => point hb table terminal ν m c₀ 0) (M:= step)
hR hν.le ht.1 hρ contDiff_const Real.smoothTransition.continuous.continuousOn
(fun s _ =>by rw [integral_impulse]; exact (differentiable_step s).hasDerivAt)
(fun s _ => field_slice_component hb table terminal ν m hν s)
(fun s _ => (contDiff_impulse (point hb table terminal ν m c₀ 0)).continuous.comp
(continuous_const.prodMk continuous_id))
(fun s _ X=> divergence_field hb table terminal ν m hν s X)
(fun s hs X=> heq s (hu s hs) X)
(fun s hs X _ =>by
rw [field_at_rest hb table terminal ν m hν (hs.2.le.trans ht.2) X]
symm
exact deriv_const s _)
(fun s hs => hρint s (hu s hs)) (fun s hs => hρnonneg s (hu s hs))
(fun s hs =>by rw [hmass s (hu s hs)]; exact Real.smoothTransition.le_one s)
(fun s _ X hX i =>byhave hsupport := (impulse_support_bound (point hb table terminal ν m c₀ 0) X s hX).2.2 i
have hlarge := radius_ge_one hν (K₀_nonnegN b m) (D_ge_one hb) 0
linarith)
havehz : capture (radius ν (K₀N b m) (D b) 0)
(fun _ => point hb table terminal ν m c₀ 0) ρ 0 = 0:=by
simp only [capture, hρinit, mul_zero, integral_zero]
rw [hz, show step 0 = 0fromReal.smoothTransition.zero_of_nonpos le_rfl, zero_sub,
sub_zero, ← hmass t ht.1] at h
have hm := mul_le_mul_of_nonneg_left ht.2 (bypositivity :
0≤ ν * 3000 / radius ν (K₀N b m) (D b) 0 ^ 2)
exact h.trans (by simpa using hm)
theoremretained_at_loading_end :
step (startTime ν (K₀N b m) (D b) 0) -
capture (radius ν (K₀N b m) (D b) 0) (runPath hb table terminal ν m c₀ 0) ρ
(startTime ν (K₀N b m) (D b) 0) ≤
ν * 3000 / radius ν (K₀N b m) (D b) 0 ^ 2:=by
proof · 11
lines
havehc : capture (radius ν (K₀N b m) (D b) 0)
(runPath hb table terminal ν m c₀ 0) ρ (startTime ν (K₀N b m) (D b) 0) =
capture (radius ν (K₀N b m) (D b) 0)
(fun _ => point hb table terminal ν m c₀ 0) ρ 1:=by
unfold capture
rw [runPath_start]
rfl
rw [hc]
change step 1 - _ ≤ _
rw [← hmass 1 (by norm_num)]
exact retained_loading hb table terminal ν m c₀ hν hρ heq hρinit hρint hρnonneg hmass ⟨by norm_num, le_rfl⟩
theoremretained_stages {n : ℕ}
(hactive : ∀ k ≤ n, (lookup hb table (orbit hb table c₀ k)).isSome)
{t : ℝ} (ht : t ∈Icc (startTime ν (K₀N b m) (D b) n)
(startTime ν (K₀N b m) (D b) (n + 1))) :
(∫X, ρ t X) - capture (radius ν (K₀N b m) (D b) n)
(runPath hb table terminal ν m c₀ n) ρ t ≤ loss (N:=N) (b := b) ν m :=by
proof · 52
lines
have hR (k : ℕ) : 0 < radius ν (K₀N b m) (D b) k :=
lt_of_lt_of_le zero_lt_one (radius_ge_one hν (K₀_nonnegN b m) (D_ge_one hb) k)
have hτ (k : ℕ) : startTime ν (K₀N b m) (D b) k ≤ startTime ν (K₀N b m) (D b) (k + 1) :=
(startTime_strictMono hν (K₀_nonnegN b m) (D_ge_one hb)).monotone (Nat.le_succ k)
have hu (k : ℕ) (s : ℝ) (hs : s ∈Icc (startTime ν (K₀N b m) (D b) k)
(startTime ν (K₀N b m) (D b) (k + 1))) : 1≤ s :=by
linarith [startTime_ge hν (K₀_nonnegN b m) (D_ge_one hb) k,
Nat.cast_nonneg (α :=ℝ) k, hs.1]
have loss_eq (k : ℕ) :
(ν * 3000 / radius ν (K₀N b m) (D b) k ^ 2) *
(startTime ν (K₀N b m) (D b) (k + 1) - startTime ν (K₀N b m) (D b) k) =
ν * 3000 * (duration ν (K₀N b m) (D b) k / radius ν (K₀N b m) (D b) k ^ 2) :=by
rw [startTime, add_sub_cancel_left]
ring
havehsummable : Summable (fun k => (ν * 3000 / radius ν (K₀N b m) (D b) k ^ 2) *
(startTime ν (K₀N b m) (D b) (k + 1) - startTime ν (K₀N b m) (D b) k)) :=by
simp_rw [loss_eq]
exact (summable_loss hν (K₀_nonnegN b m) (D_ge_one hb)).mul_left _
have h := retention_le_series (ν := ν)
(R:= radius ν (K₀N b m) (D b)) (τ := startTime ν (K₀N b m) (D b))
(a := field hb table terminal ν m) (g := impulse (point hb table terminal ν m c₀ 0))
(c := runPath hb table terminal ν m c₀) (M:= step)
hν.le hR hτ (radius_next_ge hν (K₀_nonnegN b m) (D_ge_one hb)) hρ
(fun k => (contDiff_runPath hb table terminal ν m c₀ k).of_le (by simp))
(runPath_joins hb table terminal ν m c₀ hν)
(fun _ =>Real.smoothTransition.continuous.continuousOn)
(fun _ s _ =>by rw [integral_impulse]; exact (differentiable_step s).hasDerivAt)
(fun _ s _ => field_slice_component hb table terminal ν m hν s)
(fun _ s _ => (contDiff_impulse (point hb table terminal ν m c₀ 0)).continuous.comp
(continuous_const.prodMk continuous_id))
(fun _ s _ X=> divergence_field hb table terminal ν m hν s X)
(fun k s hs X=> heq s (by linarith [hu k s ⟨hs.1.le, hs.2.le⟩]) X)
(fun k hk s hs X hX => runPath_plateau hb table terminal ν m c₀ hm hc₀ hν hdir hin hterm
k (hactive k hk) ⟨hs.1.le, hs.2.le⟩ X hX)
(fun k s hs => hρint s (by linarith [hu k s hs]))
(fun k s hs => hρnonneg s (by linarith [hu k s hs]))
(fun k s hs =>by
rw [hmass s (by linarith [hu k s ⟨hs.1.le, hs.2.le⟩])]
exact Real.smoothTransition.le_one s)
(fun k s hs X hX _ =>byhave hz := impulse_zero_of_time_one_le (point hb table terminal ν m c₀ 0)
(hu k s ⟨hs.1.le, hs.2.le⟩)
exact False.elim (hX (congrFun hz X))) hsummable ht
have hload := retained_at_loading_end hb table terminal ν m c₀ hν hρ heq hρinit hρint hρnonneg hmass
rw [← hmass t (by linarith [hu n t ht])] at h
simp_rw [loss_eq] at h
rw [tsum_mul_left] at h
havehbudget : loss (N:=N) (b := b) ν m = ν * 3000 / radius ν (K₀N b m) (D b) 0 ^ 2 +
ν * 3000 * (∑' k : ℕ, duration ν (K₀N b m) (D b) k / radius ν (K₀N b m) (D b) k ^ 2) :=by
simp only [loss, mul_add, radius, pow_zero, mul_one, inv_pow, div_eq_mul_inv]
rw [hbudget]
linarith