introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
5.78 kB
import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.BalancedBody
namespace OAI
/-! A computable time cutoff starts the machine-only periodic body. It changes
only during the final empty part of the preceding period, so the body is
exactly zero before one and exactly periodic from one onward. -/
noncomputable section
namespace ForcedComputation.BalancedBody
open ShearFlows Recorder.Planar PlanarHamiltonian Set
open scoped ContDiff
def activationStart (n : β„•) : β„š := 1 - 1 / (4 * ((n : β„š) + 1))
def activationFinish (n : β„•) : β„š := 1 - 1 / (8 * ((n : β„š) + 1))
theorem activation_intervals (n : β„•) :
0 < activationStart n ∧ activationStart n < activationFinish n ∧ activationFinish n < 1 := by
have hn : (0 : β„š) < n + 1 := by positivity
have hβ‚„ : (0 : β„š) < 4 * (n + 1) := by positivity
have hβ‚ˆ : (0 : β„š) < 8 * (n + 1) := by positivity
refine ⟨?_, ?_, ?_⟩
Β· unfold activationStart
have h : 1 / (4 * ((n : β„š) + 1)) < 1 := (div_lt_one hβ‚„).mpr (by nlinarith [Nat.cast_nonneg (Ξ± := β„š) n])
linarith
Β· unfold activationStart activationFinish
have h : 1 / (8 * ((n : β„š) + 1)) < 1 / (4 * ((n : β„š) + 1)) :=
one_div_lt_one_div_of_lt hβ‚„ (by nlinarith)
linarith
Β· unfold activationFinish
have h : (0 : β„š) < 1 / (8 * (n + 1)) := by positivity
linarith
theorem finish_le_activationStart {n : β„•} (i : Fin n) :
PlanarTiming.finish i ≀ activationStart n := by
have hn : (0 : β„š) < (n : β„š) + 1 := by positivity
have hi : (i.val : β„š) + 1 ≀ n := by exact_mod_cast i.isLt
unfold PlanarTiming.finish activationStart
apply (le_sub_iff_add_le).mpr
apply (mul_le_mul_iff_leftβ‚€ (by positivity : (0 : β„š) < 4 * (n + 1))).mp
field_simp
nlinarith
def bodyLength (M : Alternating.Machine) (hM : M.WellFormed) : β„• :=
(actions (freshMachine M) (freshInput_valid (BalancedPlanar.referenceValid hM)).1).length
def activation (M : Alternating.Machine) (hM : M.WellFormed) : ℝ β†’ ℝ :=
smoothRamp (activationStart (bodyLength M hM)) (activationFinish (bodyLength M hM))
def activated (M : Alternating.Machine) (hM : M.WellFormed) : Velocity :=
fun y => activation M hM y.1 β€’ velocity M hM y
theorem raw_late_zero (M : Alternating.Machine) (hM : M.WellFormed) {t : ℝ}
(ht : t ∈ Icc (activationStart (bodyLength M hM) : ℝ) 1) (x : Space) :
raw M hM (t, x) = 0 := by
have hn := activation_intervals (bodyLength M hM)
have ht0 : 0 ≀ t := (Rat.cast_nonneg.mpr hn.1.le).trans ht.1
have hp : BalancedPlanar.bodyVelocity M hM t (horizontal x) = 0 := by
rw [show BalancedPlanar.bodyVelocity M hM =
PlanarHamiltonian.periodicVelocity
(normalizedPulse (BalancedPlanar.referenceInput M) (BalancedPlanar.referenceValid hM)) from rfl]
rw [periodicVelocity_on_unit
(normalizedPulse_valid (BalancedPlanar.referenceInput M) (BalancedPlanar.referenceValid hM))
(normalizedPulse_inUnit (BalancedPlanar.referenceInput M) (BalancedPlanar.referenceValid hM)) ⟨ht0, ht.2⟩,
processorVelocity_eq_sum]
apply Finset.sum_eq_zero
intro i _
have hfi : ((normalizedPulse (BalancedPlanar.referenceInput M)
(BalancedPlanar.referenceValid hM) i).finish : ℝ) ≀ t := by
exact (Rat.cast_le.mpr (finish_le_activationStart i)).trans ht.1
have hab := (normalizedPulse_valid (BalancedPlanar.referenceInput M)
(BalancedPlanar.referenceValid hM) i).2
rw [Pulse.velocity, smoothPulse_after (by exact_mod_cast hab) hfi, zero_smul]
simp only [raw, CompactLift.velocity, CompactLift.spatial, VelocityDetector.triangularLift,
VelocityDetector.horizontalLinear_eq, hp, map_zero, zero_smul, add_zero, smul_zero]
theorem velocity_late_zero (M : Alternating.Machine) (hM : M.WellFormed) {t : ℝ}
(ht : t ∈ Icc (activationStart (bodyLength M hM) : ℝ) 1) (x : Space) :
velocity M hM (t, x) = 0 := by
change BalancedStretch.stretch (raw M hM (t, BalancedStretch.stretch.symm x)) = 0
rw [raw_late_zero M hM ht, map_zero]
theorem activated_before (M : Alternating.Machine) (hM : M.WellFormed) {t : ℝ}
(ht : t ≀ 1) (x : Space) : activated M hM (t, x) = 0 := by
by_cases ha : t ≀ (activationStart (bodyLength M hM) : ℝ)
Β· rw [activated, activation, smoothRamp_before
(by exact_mod_cast (activation_intervals (bodyLength M hM)).2.1) ha, zero_smul]
· rw [activated, velocity_late_zero M hM ⟨(lt_of_not_ge ha).le, ht⟩, smul_zero]
theorem activated_tail (M : Alternating.Machine) (hM : M.WellFormed) {t : ℝ}
(ht : 1 ≀ t) (x : Space) : activated M hM (t, x) = velocity M hM (t, x) := by
rw [activated, activation, smoothRamp_after
(by exact_mod_cast (activation_intervals (bodyLength M hM)).2.1), one_smul]
have hfinish : (activationFinish (bodyLength M hM) : ℝ) ≀ 1 := by
exact_mod_cast (activation_intervals (bodyLength M hM)).2.2.le
exact hfinish.trans ht
theorem activated_smooth (M : Alternating.Machine) (hM : M.WellFormed) :
ContDiff ℝ ∞ (activated M hM) :=
((smoothRamp_smooth _ _).comp contDiff_fst).smul (velocity_smooth M hM)
theorem activated_support (M : Alternating.Machine) (hM : M.WellFormed) (t : ℝ) :
tsupport (fun x => activated M hM (t, x)) βŠ† support :=
(tsupport_smul_subset_right _ _).trans (velocity_support M hM t)
theorem activated_bounded (M : Alternating.Machine) (hM : M.WellFormed) :
BoundedMixedDerivatives (activated M hM) :=
boundedMixed_of_compact_tail (activated_smooth M hM) (velocity_smooth M hM)
support_compact (activated_support M hM) (velocity_support M hM) (velocity_periodic M hM)
(fun _ ht x => activated_before M hM (by linarith) x)
(fun _ ht x => activated_tail M hM ht.le x)
end ForcedComputation.BalancedBody
end
end OAI