Download data/lean/OAI/Probability/CriticalPercolation/Exploration/Initial.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 4.16 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/CriticalPercolation/Exploration/Initial.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/CriticalPercolation/Exploration/Initial.lean
-
curl -L -o Initial.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/CriticalPercolation/Exploration/Initial.lean
4.16 kB
| import Mathlib | |
| import OAI.Probability.CriticalPercolation.Exploration.Exhaustive | |
| namespace OAI | |
| section | |
| section | |
| open Set MeasureTheory ProbabilityTheory | |
| open Set | |
| open scoped BigOperators | |
| open scoped Classical | |
| namespace CriticalPercolation.LazyDFS | |
| open scoped Classical | |
| variable {V E : Type*} [DecidableEq V] [DecidableEq E] | |
| lemma compile_sound (G : BondGraph V E) (order : List (Dart V E)) (B : Set V) | |
| (fuel : β) (st : State V E) (stack : List (Dart V E)) (Ο : E β Bool) (w : V) | |
| (hs : β v β st.reached, (G.openGraph {e | Ο e = true}).Reachable w v) : | |
| β v β ((compile G order B fuel st stack).run Ο).reached, | |
| (G.openGraph {e | Ο e = true}).Reachable w v := by | |
| induction fuel generalizing st stack with | |
| | zero => exact hs | |
| | succ n ih => | |
| rw [compile.eq_def] | |
| dsimp only | |
| split_ifs with hh | |
| Β· exact hs | |
| Β· cases stack with | |
| | nil => exact hs | |
| | cons d rest => | |
| dsimp only | |
| split_ifs with hd | |
| Β· exact ih st rest hs | |
| Β· rw [SearchTree.run] | |
| split_ifs with he | |
| Β· apply ih | |
| intro u hu | |
| rcases Finset.mem_insert.mp hu with rfl | hu | |
| Β· have hdec : d.2.2 β st.reached β§ d.2.1 β st.read β§ d.1 β st.reached β§ | |
| G.ends d.2.1 = s(d.1,d.2.2) := by | |
| push Not at hd | |
| exact hd | |
| exact (hs d.1 hdec.2.2.1).trans (openEdge_reachable G Ο he hdec.2.2.2) | |
| Β· exact hs u hu | |
| Β· exact ih (st.closed d.2.1) rest hs | |
| omit [DecidableEq V] [DecidableEq E] in | |
| lemma reachable_mem_of_closed (H : SimpleGraph V) (S : Finset V) | |
| (hc : β v β S, β t, H.Adj v t β t β S) {v t : V} | |
| (hr : H.Reachable v t) (hv : v β S) : t β S := by | |
| have hh : β {u z : V}, H.Walk u z β u β S β z β S := by | |
| intro u z path | |
| induction path with | |
| | nil => exact id | |
| | cons ha _ ih => exact fun hu => ih (hc _ hu _ ha) | |
| exact hr.elim (fun path => hh path hv) | |
| noncomputable def initial (w : V) : State V E := β¨{w},β β© | |
| omit [DecidableEq E] in | |
| lemma initial_frontier (G : BondGraph V E) (order : List (Dart V E)) | |
| (ho : Exhaustive G order) (w : V) : Frontier G (initial w) (push G order w) := by | |
| intro v hv e t he _ | |
| have hvw : v = w := Finset.mem_singleton.mp hv | |
| subst v | |
| exact Or.inr (List.mem_filter.mpr β¨ho w e t he,by simpa only [decide_eq_true_eq,true_and] using heβ©) | |
| omit [DecidableEq V] [DecidableEq E] in | |
| lemma initial_consistent (G : BondGraph V E) (w : V) (Ο : E β Bool) : | |
| ReadConsistent G (initial w) Ο := by | |
| intro e he | |
| exact (Finset.notMem_empty e he).elim | |
| variable [Fintype V] | |
| noncomputable def search (G : BondGraph V E) (order : List (Dart V E)) (w : V) (B : Set V) : | |
| SearchTree E (State V E) := | |
| compile G order B (rank order (initial w) (push G order w)) (initial w) (push G order w) | |
| theorem search_decides (G : BondGraph V E) (order : List (Dart V E)) | |
| (ho : Exhaustive G order) (w : V) (B : Set V) (Ο : E β Bool) : | |
| (β v β ((search G order w B).run Ο).reached, v β B) β | |
| β v β B, (G.openGraph {e | Ο e = true}).Reachable w v := by | |
| have hs : β v β (initial (E := E) w).reached, | |
| (G.openGraph {e | Ο e = true}).Reachable w v := by | |
| intro v hv | |
| have : v = w := Finset.mem_singleton.mp hv | |
| subst v | |
| exact .refl _ | |
| constructor | |
| Β· rintro β¨v,hv,hBβ© | |
| exact β¨v,hB,compile_sound G order B _ _ _ Ο w hs v hvβ© | |
| Β· rintro β¨v,hB,hrβ© | |
| rcases compile_success_or_closed G order ho B _ (initial w) (push G order w) Ο | |
| (initial_frontier G order ho w) (initial_consistent G w Ο) le_rfl with h | h | |
| Β· exact h | |
| Β· have hw : w β ((search G order w B).run Ο).reached := | |
| (compile_mono G order B _ (initial w) (push G order w) Ο).1 (Finset.mem_singleton_self _) | |
| exact β¨v,reachable_mem_of_closed _ _ h hr hw,hBβ© | |
| theorem search_reads_nodup (G : BondGraph V E) (order : List (Dart V E)) | |
| (w : V) (B : Set V) (Ο : E β Bool) : ((search G order w B).reads Ο).Nodup := | |
| SearchTree.reads_nodup _ _ (compile_valid G order B _ _ _) Ο | |
| end CriticalPercolation.LazyDFS | |
| end | |
| end | |
| end OAI | |