Download data/lean/OAI/Probability/CriticalPercolation/Entropy/BinaryTranscript.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 6.28 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/CriticalPercolation/Entropy/BinaryTranscript.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/CriticalPercolation/Entropy/BinaryTranscript.lean
-
curl -L -o BinaryTranscript.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/CriticalPercolation/Entropy/BinaryTranscript.lean
6.28 kB
| import Mathlib | |
| import OAI.Probability.CriticalPercolation.Entropy.BinaryConfiguration | |
| import OAI.Probability.CriticalPercolation.Entropy.BinaryCosts | |
| namespace OAI | |
| section | |
| section | |
| namespace CriticalPercolation.BinaryLaw | |
| open scoped Classical | |
| open FiniteProduct BondGraph BinaryInterpolation InterpolationForest ExactExposure FiniteEntropy | |
| variable {V E : Type*} | |
| abbrev stepLeft (d : β) (x : β β V) (n : β) (D : FixedDescriptor n) (i : Fin n) : V := | |
| (descriptorNode (E := E) d x n D (i.val+2)).1 | |
| abbrev stepRight (d : β) (x : β β V) (n : β) (D : FixedDescriptor n) (i : Fin n) : V := | |
| (descriptorNode (E := E) d x n D (descriptorParent (E := E) d x n D (i.val+2))).1 | |
| abbrev stepTargets (d : β) (x : β β V) (n : β) (D : FixedDescriptor n) (i : Fin n) : Set V := | |
| scheduledTargets (E := E) d x n (fun j => (D j).1) i.val | |
| def activeSteps (n : β) (D : FixedDescriptor n) : Finset (Fin n) := | |
| Finset.univ.filter fun i => (D i).2.2 = true | |
| variable [Fintype V] [Fintype E] | |
| variable (G : BondGraph V E) (order : List (LazyDFS.Dart V E)) (d : β) (x : β β V) | |
| variable (p : β) (w : E β Prop β β) (n : β) (D : FixedDescriptor n) | |
| noncomputable def pairQuery (i : Fin n) : QueryTree E := | |
| (pair G (stepLeft (E := E) d x n D i) (stepRight (E := E) d x n D i)).bare | |
| noncomputable def selectedTranscript (i : Fin n) (Ο : E β Bool) : E β Bool := | |
| if (D i).2.2 = true then | |
| representative (pairQuery G d x n D i).run (fun _ => false) ((pairQuery G d x n D i).run Ο) | |
| else Ο | |
| noncomputable def selectedWeight (i : Fin n) (Ο : E β Bool) (m : Option E) : β := | |
| if (D i).2.2 = true then match m with | |
| | none => 0 | |
| | some e => markWeight G order (stepTargets (E := E) d x n D i) | |
| (stepLeft (E := E) d x n D i) (stepRight (E := E) d x n D i) p w Ο e | |
| else scheduleWeight G order d x p w n (fun j => (D j).1) i (configuration Ο) m | |
| noncomputable def selectedCost (i : Fin n) (Ο : E β Bool) (m : Option E) : β := | |
| if (D i).2.2 = true then match m with | |
| | none => 0 | |
| | some e => markCost G order (stepTargets (E := E) d x n D i) | |
| (stepLeft (E := E) d x n D i) (stepRight (E := E) d x n D i) p w Ο e | |
| else 0 | |
| lemma selected_nonneg (hp : p β Set.Ioo 0 1) (h0 : β e, w e False = 1-p) | |
| (h1 : β e, w e True = p) (i : Fin n) (Ο : E β Bool) (m : Option E) : | |
| 0 β€ selectedWeight G order d x p w n D i Ο m β§ | |
| 0 β€ selectedCost G order d x p w n D i Ο m := by | |
| unfold selectedWeight selectedCost | |
| split_ifs | |
| Β· cases m with | |
| | none => exact β¨le_rfl,le_rflβ© | |
| | some e => exact mark_nonneg G order _ _ _ hp w h0 h1 Ο e | |
| Β· exact β¨scheduleWeight_nonneg G order d x p w hp h0 h1 n _ i _ m,le_rflβ© | |
| lemma selected_run (i : Fin n) (Ο : E β Bool) (m : Option E) : | |
| selectedWeight G order d x p w n D i (selectedTranscript G d x n D i Ο) m = | |
| selectedWeight G order d x p w n D i Ο m β§ | |
| selectedCost G order d x p w n D i (selectedTranscript G d x n D i Ο) m = | |
| selectedCost G order d x p w n D i Ο m := by | |
| unfold selectedWeight selectedCost selectedTranscript | |
| split_ifs with hi | |
| Β· cases m with | |
| | none => exact β¨rfl,rflβ© | |
| | some e => | |
| exact pair_mark_congr G order _ _ _ (scheduled_parent_mem d x n D i) p w _ Ο | |
| (representative_run (pairQuery G d x n D i).run (fun _ => false) Ο) e | |
| Β· exact β¨rfl,rflβ© | |
| lemma selectedWeight_le_raw (hp : p β Set.Ioo 0 1) (h0 : β e, w e False = 1-p) | |
| (h1 : β e, w e True = p) (i : Fin n) (Ο : E β Bool) (m : Option E) : | |
| selectedWeight G order d x p w n D i Ο m β€ | |
| scheduleWeight G order d x p w n (fun j => (D j).1) i (configuration Ο) m := by | |
| unfold selectedWeight | |
| split_ifs | |
| Β· cases m with | |
| | none => exact scheduleWeight_nonneg G order d x p w hp h0 h1 n _ i _ none | |
| | some e => | |
| unfold scheduleWeight | |
| rw [scheduledAnchor_node] | |
| exact G.markWeight_le_raw order _ _ _ (scheduled_parent_mem d x n D i) hp w h0 h1 Ο e | |
| Β· exact le_rfl | |
| lemma supported_selected_eq (s : β) (Ο : E β Bool) (m : Fin n β Option E) | |
| (hz : conditionedMass G order d x p w s n D (Ο,m) β 0) (i : Fin n) : | |
| selectedWeight G order d x p w n D i Ο (m i) = | |
| scheduleWeight G order d x p w n (fun j => (D j).1) i (configuration Ο) (m i) := by | |
| unfold selectedWeight | |
| split_ifs with hi | |
| Β· obtain β¨e,he,haβ© := supported_active_admissible G order d x p w s n D Ο m hz β¨i,hiβ© | |
| dsimp only at he ha | |
| rw [he] | |
| unfold scheduleWeight | |
| rw [scheduledAnchor_node] | |
| exact G.markWeight_eq_raw_of_admissible order _ _ _ (scheduled_parent_mem d x n D i) p w Ο e ha | |
| Β· rfl | |
| lemma supported_selected_positive (s : β) (hp : p β Set.Ioo 0 1) | |
| (h0 : β e, w e False = 1-p) (h1 : β e, w e True = p) | |
| (z : (E β Bool) Γ (Fin n β Option E)) | |
| (hz : 0 < conditionedMass G order d x p w s n D z) (i : Fin n) : | |
| 0 < selectedWeight G order d x p w n D i (selectedTranscript G d x n D i z.1) (z.2 i) := by | |
| rw [(selected_run G order d x p w n D i z.1 (z.2 i)).1, | |
| supported_selected_eq G order d x p w n D s z.1 z.2 hz.ne' i] | |
| exact lt_of_le_of_ne (scheduleWeight_nonneg G order d x p w hp h0 h1 n _ i _ _) | |
| (Ne.symm (supported_schedule_ne_zero G order d x p w s n D z.1 z.2 hz.ne' i)) | |
| lemma selected_moment (horder : LazyDFS.GoodDarts G order) (ho : LazyDFS.Exhaustive G order) | |
| (hp : p β Set.Ioo 0 1) (h0 : β e, w e False = 1-p) (h1 : β e, w e True = p) | |
| (i : Fin n) (hi : i β activeSteps n D) : | |
| (β ym : (E β Bool) Γ Option E, | |
| pushMass (selectedTranscript G d x n D i) (FiniteProduct.density (QueryTree.bitWeight p)) ym.1 * | |
| selectedWeight G order d x p w n D i ym.1 ym.2 * | |
| (1+selectedCost G order d x p w n D i ym.1 ym.2)) β€ 4 := by | |
| have hi' : (D i).2.2 = true := (Finset.mem_filter.mp hi).2 | |
| rw [Fintype.sum_prod_type] | |
| simp_rw [mul_assoc] | |
| simp_rw [β Finset.mul_sum] | |
| rw [sum_pushMass_mul] | |
| simp_rw [(selected_run G order d x p w n D i _ _).1, | |
| (selected_run G order d x p w n D i _ _).2] | |
| simp only [selectedWeight,selectedCost,ite_eq_left hi',Fintype.sum_option,zero_mul,zero_add] | |
| exact marked_pair_bound G order horder ho _ _ _ (scheduled_parent_mem d x n D i) hp w h0 h1 | |
| end CriticalPercolation.BinaryLaw | |
| end | |
| end | |
| end OAI | |