Download data/lean/OAI/Probability/BinarySweep/Trajectories/EndpointEvents.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 5.54 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/BinarySweep/Trajectories/EndpointEvents.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/BinarySweep/Trajectories/EndpointEvents.lean
-
curl -L -o EndpointEvents.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/BinarySweep/Trajectories/EndpointEvents.lean
5.54 kB
| import Mathlib | |
| import OAI.Probability.BinarySweep.FiniteLaws.UniformFiniteProbability | |
| namespace OAI | |
| noncomputable section | |
| open scoped BigOperators Classical | |
| namespace BinaryCoordinateSweeps | |
| attribute [local instance] Classical.propDecidable | |
| open Sparse | |
| variable {b h : β} {bits : Fin b β β} | |
| lemma gridLayer_at (g : GridChoices bits) (j : Fin b) (x : GridSlot bits) : | |
| gridLayer bits g j x j = g j (fun i => x i) (x j) := by | |
| simp [gridLayer,Equiv.piSplitAt_symm_apply] | |
| @[simp] lemma independentPosition_zero (e : GridSlot bits Γ GridSlot bits) : | |
| independentPosition e 0=e.1 := by ext i; simp [independentPosition] | |
| @[simp] lemma independentPosition_last (e : GridSlot bits Γ GridSlot bits) : | |
| independentPosition e (Fin.last b)=e.2 := by ext i; simp [independentPosition] | |
| def endpointLine (e : GridSlot bits Γ GridSlot bits) (j : Fin b) : GridOutside bits j := | |
| fun i => independentPosition e j.castSucc i | |
| lemma endpoint_gridLayer_iff (g : GridChoices bits) (e : GridSlot bits Γ GridSlot bits) (j : Fin b) : | |
| gridLayer bits g j (independentPosition e j.castSucc)=independentPosition e j.succ β | |
| g j (endpointLine e j) (e.1 j)=e.2 j := by | |
| unfold endpointLine | |
| constructor | |
| Β· intro he | |
| have hh := congrFun he j | |
| simpa only [gridLayer_at,endpointLine,independentPosition,Fin.val_castSucc, | |
| Fin.val_succ,lt_self_iff_false,ite_false,Nat.lt_succ_self,ite_true] using hh | |
| Β· intro he | |
| funext i | |
| by_cases hi : i=j | |
| Β· subst i | |
| simpa only [gridLayer_at,endpointLine,independentPosition,Fin.val_castSucc, | |
| Fin.val_succ,lt_self_iff_false,ite_false,Nat.lt_succ_self,ite_true] using he | |
| Β· rw [gridLayer_other bits g j i hi] | |
| exact (independentPosition_changes e j i hi).symm | |
| lemma gridSweep_endpoint_iff (g : GridChoices bits) (e : GridSlot bits Γ GridSlot bits) : | |
| gridSweep bits g e.1=e.2 β βj, g j (endpointLine e j) (e.1 j)=e.2 j := by | |
| constructor | |
| Β· intro he j | |
| have hp (t : Fin (b+1)) : gridPartialSweep bits g t e.1=independentPosition e t := by | |
| have hh := independentPosition_of_path (fun t => gridPartialSweep bits g t e.1) | |
| (gridPartialSweep_changes bits g e.1) t | |
| simpa only [gridPartialSweep_zero,Equiv.Perm.one_apply,gridPartialSweep_last,he] using hh.symm | |
| apply (endpoint_gridLayer_iff g e j).mp | |
| rw [β hp j.castSucc,β hp j.succ,gridPartialSweep_succ,Equiv.Perm.mul_apply] | |
| Β· intro he | |
| have hh := chronological_trajectory b (gridLayer bits g) (independentPosition e) | |
| (fun j => (endpoint_gridLayer_iff g e j).mpr (he j)) | |
| simpa only [independentPosition_zero,independentPosition_last,gridSweep] using hh | |
| variable {I : Type*} [Fintype I] [DecidableEq I] | |
| def localEndpointEvent (A : Finset I) (e : I β GridSlot bits Γ GridSlot bits) | |
| (j : Fin b) (y : GridOutside bits j) (Ο : Equiv.Perm (Slot (bits j))) : Prop := | |
| βi β A, endpointLine (e i) j=y β Ο ((e i).1 j)=(e i).2 j | |
| def endpointMass (H : PathFamily bits h) (z : β) (A : Finset I) | |
| (e : I β GridSlot bits Γ GridSlot bits) : β := | |
| βg : GridChoices bits, if pathEvent H g β§ βi β A, gridSweep bits g (e i).1=(e i).2 then | |
| gridWeight bits z g else 0 | |
| def localEndpointMass (H : PathFamily bits h) (z : β) (A : Finset I) | |
| (e : I β GridSlot bits Γ GridSlot bits) (j : Fin b) (y : GridOutside bits j) : β := | |
| βΟ, if Assigns (lineInput H j y) (lineOutput H j y) Ο β§ localEndpointEvent A e j y Ο then | |
| lineLaw (bits j) z Ο else 0 | |
| lemma endpointMass_factor (H : PathFamily bits h) (z : β) (A : Finset I) | |
| (e : I β GridSlot bits Γ GridSlot bits) : | |
| endpointMass H z A e = βj, βy, localEndpointMass H z A e j y := by | |
| have he (g : GridChoices bits) : | |
| (pathEvent H g β§ βi β A, gridSweep bits g (e i).1=(e i).2) β | |
| βj y, Assigns (lineInput H j y) (lineOutput H j y) (g j y) β§ | |
| localEndpointEvent A e j y (g j y) := by | |
| rw [pathEvent_iff_assigns] | |
| simp_rw [gridSweep_endpoint_iff] | |
| constructor | |
| Β· rintro β¨hg,hpβ© j y | |
| refine β¨hg j y,?_β© | |
| intro i hi hiy | |
| rw [β hiy] | |
| exact hp i hi j | |
| Β· intro hh | |
| refine β¨fun j y => (hh j y).1,?_β© | |
| intro i hi j | |
| exact (hh j (endpointLine (e i) j)).2 i hi rfl | |
| unfold endpointMass localEndpointMass | |
| rw [β sum_prod_grid] | |
| apply Finset.sum_congr rfl | |
| intro g _ | |
| simp only [Fintype.prod_ite_zero] | |
| simp only [he,gridWeight] | |
| split_ifs <;> rfl | |
| omit [Fintype I] in | |
| lemma localEndpointEvent_insert (A : Finset I) (e : I β GridSlot bits Γ GridSlot bits) | |
| (i : I) (j : Fin b) (y : GridOutside bits j) (Ο : Equiv.Perm (Slot (bits j))) : | |
| localEndpointEvent (insert i A) e j y Ο β | |
| (endpointLine (e i) j=y β Ο ((e i).1 j)=(e i).2 j) β§ localEndpointEvent A e j y Ο := by | |
| simp only [localEndpointEvent,Finset.mem_insert,forall_eq_or_imp] | |
| omit [Fintype I] [DecidableEq I] in | |
| lemma localEndpointEvent_empty_line (A : Finset I) (e : I β GridSlot bits Γ GridSlot bits) | |
| (j : Fin b) (y : GridOutside bits j) (ha : βi β A, endpointLine (e i) jβ y) | |
| (Ο : Equiv.Perm (Slot (bits j))) : localEndpointEvent A e j y Ο := by | |
| intro i hi hiy | |
| exact (ha i hi hiy).elim | |
| lemma assigns_empty_line (H : PathFamily bits h) (j : Fin b) (y : GridOutside bits j) | |
| (hn : βk, (fun i : {i : Fin b // iβ j} => H.position j.castSucc k i) β y) | |
| (Ο : Equiv.Perm (Slot (bits j))) : Assigns (lineInput H j y) (lineOutput H j y) Ο := by | |
| intro k | |
| exact (hn k.val k.property).elim | |
| end BinaryCoordinateSweeps | |
| end | |
| end OAI | |