Download data/lean/OAI/MathematicalPhysics/RapidForcing/Detector.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 9.51 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/MathematicalPhysics/RapidForcing/Detector.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/MathematicalPhysics/RapidForcing/Detector.lean
-
curl -L -o Detector.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/MathematicalPhysics/RapidForcing/Detector.lean
9.51 kB
| import OAI.MathematicalPhysics.RapidForcing.ParticlePaths | |
| import OAI.MathematicalPhysics.RapidForcing.MachineRun | |
| import OAI.MathematicalPhysics.RapidForcing.Flow | |
| namespace OAI | |
| open scoped BigOperators ENNReal Topology NNReal | |
| open Set MeasureTheory | |
| namespace RapidForcing | |
| lemma addressPath_smooth (M : Machine) (d : ScaleData) (n m : β) : | |
| ContDiff β (β€ : ββ) (addressPath M d n m) := | |
| contDiff_const.add (theta_smooth.smul contDiff_const) | |
| lemma materialFlow_loading (M : Machine) (w : M.Input) | |
| {X : β β Space β Space} (hX : MaterialFlow (addressedVelocity M w) X) | |
| {t : β} (ht : t β Icc (0 : β) 1) : | |
| X t 0 = ΞΈ t β’ vec (-1) ((M.scaleData w).Ξ΄ 0 * (M.initialDigit w : β)) 0 := by | |
| let c : β β Space := fun s => ΞΈ s β’ vec (-1) ((M.scaleData w).Ξ΄ 0 * (M.initialDigit w : β)) 0 | |
| have hc : ContDiff β (β€ : ββ) c := theta_smooth.smul contDiff_const | |
| have htr : TrajectoryOn (addressedVelocity M w) 0 1 c := by | |
| refine β¨?_, ?_β© | |
| Β· simp [c, theta_zero (by norm_num : (0 : β) β€ 1 / 4)] | |
| Β· intro s hs | |
| have h := addressedVelocity_at_loadingPath M w hs.2 | |
| change addressedVelocity M w s (c s) = deriv c s at h | |
| rw [h] | |
| exact (hc.differentiable (by simp) s).hasDerivAt.hasDerivWithinAt | |
| exact (hX.2.2 1 zero_lt_one 0 c htr t ht).symm | |
| lemma materialFlow_addressPath (M : Machine) (w : M.Input) | |
| {X : β β Space β Space} (hX : MaterialFlow (addressedVelocity M w) X) | |
| (n m : β) (hm : m β€ (M.scaleData w).D n) | |
| (hstart : X (1 + (n : β)) 0 = addressCenter (M.scaleData w) n m) | |
| {Ο : β} (hΟ : Ο β Icc (0 : β) 1) : | |
| X (1 + (n : β) + Ο) 0 = addressPath M (M.scaleData w) n m Ο := by | |
| let c := addressPath M (M.scaleData w) n m | |
| let Ξ· : β β Space := fun t => c (t - 1 - (n : β)) | |
| have hc := addressPath_smooth M (M.scaleData w) n m | |
| have he : EqOn (fun t => X t 0) Ξ· (Icc (1 + (n : β)) (2 + (n : β))) := by | |
| apply solution_unique_Icc (addressedVelocity_joint_smooth M w) | |
| (addressedVelocity_supported M w) (by positivity) | |
| Β· intro t ht | |
| apply (hX.2.1 0 t (by have := Nat.cast_nonneg (Ξ± := β) n; linarith [ht.1])).mono | |
| intro s hs | |
| have := Nat.cast_nonneg (Ξ± := β) n | |
| exact le_trans (by positivity) hs.1 | |
| Β· intro t ht | |
| have ht' : t - 1 - (n : β) β Icc (0 : β) 1 := by constructor <;> linarith [ht.1, ht.2] | |
| have hh := addressedVelocity_at_addressPath M w n m hm ht' | |
| rw [show 1 + (n : β) + (t - 1 - (n : β)) = t by ring] at hh | |
| change addressedVelocity M w t (Ξ· t) = deriv c (t - 1 - (n : β)) at hh | |
| rw [hh] | |
| have hshift : HasDerivAt (fun s : β => s - 1 - (n : β)) 1 t := | |
| ((hasDerivAt_id t).sub_const 1).sub_const (n : β) | |
| have hd := (hc.differentiable (by simp) (t - 1 - (n : β))).hasDerivAt.scomp t hshift | |
| simpa only [one_smul, Function.comp_def] using hd.hasDerivWithinAt | |
| Β· rw [hstart] | |
| dsimp [Ξ·, c] | |
| rw [show 1 + (n : β) - 1 - (n : β) = 0 by ring] | |
| simp [addressPath, theta_zero (by norm_num : (0 : β) β€ 1 / 4)] | |
| have h := he (show 1 + (n : β) + Ο β Icc (1 + (n : β)) (2 + (n : β)) from | |
| β¨by linarith [hΟ.1], by linarith [hΟ.2]β©) | |
| change X (1 + (n : β) + Ο) 0 = c (1 + (n : β) + Ο - 1 - (n : β)) at h | |
| rwa [show 1 + (n : β) + Ο - 1 - (n : β) = Ο by ring] at h | |
| namespace ScaleData | |
| lemma history_zero (d : ScaleData) (k : β β β) : d.history k 0 = d.Ξ΄ 0 * (k 0 : β) := by | |
| simp [history] | |
| lemma history_succ (d : ScaleData) (k : β β β) (n : β) : | |
| d.history k (n + 1) = d.history k n + d.Ξ΄ (n + 1) * (k (n + 1) : β) := | |
| Finset.sum_range_succ _ _ | |
| end ScaleData | |
| lemma runAddress_center (M : Machine) (w : M.Input) (n : β) : | |
| addressCenter (M.scaleData w) n ((M.scaleData w).addressIndex (M.runCode w) n) = | |
| vec (-1) ((M.scaleData w).history (M.runCode w) n) 0 := by | |
| unfold addressCenter | |
| rw [β (M.scaleData w).history_eq_address] | |
| lemma runAddress_mod (M : Machine) (w : M.Input) (n : β) : | |
| ((M.scaleData w).addressIndex (M.runCode w) n) % (M.scaleData w).capacity n = M.runCode w n := | |
| (M.scaleData w).address_mod_capacity (M.runCode w) n (M.runCode_lt w n) | |
| lemma runAddress_le_D (M : Machine) (w : M.Input) (n : β) : | |
| (M.scaleData w).addressIndex (M.runCode w) n β€ (M.scaleData w).D n := | |
| ((M.scaleData w).address_lt_D (M.runCode w) n (fun j _ => M.runCode_lt w j)).le | |
| lemma runAddress_nonterminal_end (M : Machine) (w : M.Input) {n : β} | |
| (hn : (M.run w n).state.val β M.states) : | |
| addressPath M (M.scaleData w) n ((M.scaleData w).addressIndex (M.runCode w) n) 1 = | |
| vec (-1) ((M.scaleData w).history (M.runCode w) (n + 1)) 0 := by | |
| unfold addressPath | |
| rw [runAddress_center, theta_one (by norm_num : (3 / 4 : β) β€ 1), one_smul] | |
| unfold addressDisplacement | |
| rw [runAddress_mod] | |
| dsimp only | |
| rw [M.runCode_terminal, ite_eq_right hn, β M.runCode_succ w hn, (M.scaleData w).history_succ] | |
| ext i | |
| fin_cases i <;> simp [vec] | |
| lemma runAddress_nonterminal_first (M : Machine) (w : M.Input) {n : β} | |
| (hn : (M.run w n).state.val β M.states) (Ο : β) : | |
| (addressPath M (M.scaleData w) n ((M.scaleData w).addressIndex (M.runCode w) n) Ο) 0 = -1 := by | |
| unfold addressPath addressDisplacement | |
| rw [runAddress_mod] | |
| dsimp only | |
| rw [M.runCode_terminal, ite_eq_right hn] | |
| simp [addressCenter, vec] | |
| lemma runAddress_terminal_first (M : Machine) (w : M.Input) {n : β} | |
| (hn : (M.run w n).state.val = M.states) : | |
| (addressPath M (M.scaleData w) n ((M.scaleData w).addressIndex (M.runCode w) n) 1) 0 = | |
| -1 - (M.scaleData w).b n := by | |
| unfold addressPath addressDisplacement | |
| rw [runAddress_mod] | |
| dsimp only | |
| rw [M.runCode_terminal, ite_eq_left hn, theta_one (by norm_num : (3 / 4 : β) β€ 1)] | |
| simp [addressCenter, vec, sub_eq_add_neg] | |
| theorem materialFlow_at_codeTime (M : Machine) (w : M.Input) | |
| {X : β β Space β Space} (hX : MaterialFlow (addressedVelocity M w) X) | |
| (n : β) (hn : β j < n, (M.run w j).state.val β M.states) : | |
| X (1 + (n : β)) 0 = vec (-1) ((M.scaleData w).history (M.runCode w) n) 0 := by | |
| induction n with | |
| | zero => | |
| simpa only [Nat.cast_zero, add_zero, (M.scaleData w).history_zero, M.runCode_zero, | |
| theta_one (by norm_num : (3 / 4 : β) β€ 1), one_smul] using | |
| materialFlow_loading M w hX (t := 1) (by constructor <;> norm_num) | |
| | succ n ih => | |
| have hstart : X (1 + (n : β)) 0 = | |
| addressCenter (M.scaleData w) n ((M.scaleData w).addressIndex (M.runCode w) n) := by | |
| rw [ih (fun j hj => hn j (by omega)), runAddress_center] | |
| have h := materialFlow_addressPath M w hX n _ (runAddress_le_D M w n) hstart | |
| (Ο := 1) (by constructor <;> norm_num) | |
| rw [runAddress_nonterminal_end M w (hn n (by omega))] at h | |
| simpa only [Nat.cast_add, Nat.cast_one, add_assoc] using h | |
| lemma materialFlow_run_slot (M : Machine) (w : M.Input) | |
| {X : β β Space β Space} (hX : MaterialFlow (addressedVelocity M w) X) | |
| (n : β) (hn : β j < n, (M.run w j).state.val β M.states) | |
| {Ο : β} (hΟ : Ο β Icc (0 : β) 1) : | |
| X (1 + (n : β) + Ο) 0 = | |
| addressPath M (M.scaleData w) n ((M.scaleData w).addressIndex (M.runCode w) n) Ο := by | |
| apply materialFlow_addressPath M w hX n _ (runAddress_le_D M w n) _ hΟ | |
| rw [materialFlow_at_codeTime M w hX n hn, runAddress_center] | |
| lemma materialFlow_nonhalting_first (M : Machine) (w : M.Input) | |
| {X : β β Space β Space} (hX : MaterialFlow (addressedVelocity M w) X) | |
| (hnh : Β¬ M.Halts w) {t : β} (ht : 0 β€ t) : -1 β€ (X t 0) 0 := by | |
| have hn (n : β) : (M.run w n).state.val β M.states := fun h => hnh β¨n, hβ© | |
| by_cases ht1 : t β€ 1 | |
| Β· rw [materialFlow_loading M w hX β¨ht, ht1β©] | |
| simp only [PiLp.smul_apply, vec_zero_coord, smul_eq_mul, mul_neg_one] | |
| exact neg_le_neg (theta_le_one t) | |
| Β· let n := Nat.floor (t - 1) | |
| have hn1 : (n : β) β€ t - 1 := Nat.floor_le (by linarith) | |
| have hn2 : t - 1 < (n : β) + 1 := Nat.lt_floor_add_one _ | |
| have hΟ : t - 1 - (n : β) β Icc (0 : β) 1 := by constructor <;> linarith | |
| have he := materialFlow_run_slot M w hX n (fun j _ => hn j) hΟ | |
| rw [show 1 + (n : β) + (t - 1 - (n : β)) = t by ring] at he | |
| rw [he, runAddress_nonterminal_first M w (hn n)] | |
| theorem materialFlow_halting_iff (M : Machine) (w : M.Input) | |
| {X : β β Space β Space} (hX : MaterialFlow (addressedVelocity M w) X) : | |
| M.Halts w β β t : β, 0 β€ t β§ (X t 0) 0 < -1 := by | |
| constructor | |
| Β· intro hhalt | |
| let n := Nat.find hhalt | |
| have hn : (M.run w n).state.val = M.states := Nat.find_spec hhalt | |
| have hprev : β j < n, (M.run w j).state.val β M.states := by | |
| intro j hj he | |
| have hlu := Nat.find_min' hhalt he | |
| omega | |
| refine β¨1 + (n : β) + 1, by positivity, ?_β© | |
| rw [materialFlow_run_slot M w hX n hprev (show (1 : β) β Icc 0 1 by constructor <;> norm_num), | |
| runAddress_terminal_first M w hn] | |
| have := (M.scaleData w).b_pos n | |
| linarith | |
| Β· rintro β¨t, ht, heβ© | |
| by_contra hnh | |
| have := materialFlow_nonhalting_first M w hX hnh ht | |
| linarith | |
| theorem addressed_particle_detection (M : Machine) (w : M.Input) : | |
| β X : β β Space β Space, MaterialFlow (addressedVelocity M w) X β§ | |
| (M.Halts w β β t : β, 0 β€ t β§ (X t 0) 0 < -1) := by | |
| obtain β¨X, hXβ© := addressed_materialFlow M w | |
| exact β¨X, hX, materialFlow_halting_iff M w hXβ© | |
| end RapidForcing | |
| end OAI | |