math / data /lean /OAI /MathematicalPhysics /NavierStokes /ForcedComputation /Programs /BalancedActivation.lean
Download data/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedActivation.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 5.78 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedActivation.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedActivation.lean
-
curl -L -o BalancedActivation.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedActivation.lean
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 | |