Download data/lean/OAI/Probability/CriticalPercolation/Entropy/BinaryReverseKernels.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/BinaryReverseKernels.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/CriticalPercolation/Entropy/BinaryReverseKernels.lean
-
curl -L -o BinaryReverseKernels.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/CriticalPercolation/Entropy/BinaryReverseKernels.lean
6.28 kB
| import Mathlib | |
| import OAI.Probability.CriticalPercolation.Entropy.BinaryTranscript | |
| import OAI.Probability.CriticalPercolation.Criticality.ReverseReference | |
| import OAI.Probability.CriticalPercolation.Entropy.MarkedBits | |
| namespace OAI | |
| section | |
| section | |
| noncomputable section | |
| namespace CriticalPercolation.BinaryLaw | |
| open scoped Classical | |
| open FiniteProduct BondGraph BinaryInterpolation ExactExposure FiniteEntropy MarkedBits SearchTree | |
| variable {V E : Type*} [Fintype V] [Fintype E] | |
| local instance kernelsFinDec (n : β) : DecidableEq (Fin n) := Classical.decEq _ | |
| 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 pivotGuess (i : Fin n) (Ο : E β Bool) (e : E) : β := | |
| (LazyDFS.search G order (stepLeft (E := E) d x n D i) (stepTargets (E := E) d x n D i)).reverseGuess | |
| p (fun Ο => β b β stepTargets (E := E) d x n D i, | |
| (G.openGraph Ο).Reachable (stepLeft (E := E) d x n D i) b) w (configuration Ο) 0 e | |
| lemma pivotGuess_subprobability (hp : p β Set.Ioo 0 1) | |
| (h0 : β e, w e False = 1-p) (h1 : β e, w e True = p) (i : Fin n) (Ο : E β Bool) : | |
| (β e, 0 β€ pivotGuess G order d x p w n D i Ο e) β§ | |
| (β e, pivotGuess G order d x p w n D i Ο e) β€ 1 := by | |
| apply SearchTree.reverseGuess_subprobability _ β (LazyDFS.compile_valid G order _ _ _ _) hp | |
| Β· rintro a b hab β¨v,hv,hrβ© | |
| exact β¨v,hv,hr.mono (G.openGraph_mono hab)β© | |
| Β· exact homogeneous_normalized w p h0 h1 | |
| Β· exact fun e b => (homogeneous_positive w hp h0 h1 e b).le | |
| Β· exact fun e _ => β¨h0 e,h1 eβ© | |
| noncomputable def inverseKernel (j : β) (Ο : E β Bool) (m : Option E) : β := | |
| if hj : j < n then | |
| if (β¨j,hjβ© : Fin n) β activeSteps n D then | |
| match m with | none => 0 | some e => pivotGuess G order d x p w n D β¨j,hjβ© Ο e | |
| else if m = none then 1 else 0 | |
| else if m = none then 1 else 0 | |
| noncomputable def inverseUpdate (j : β) (Ο : E β Bool) (m : Option E) : E β Bool := | |
| if hj : j < n then | |
| if (β¨j,hjβ© : Fin n) β activeSteps n D then | |
| match m with | none => Ο | some e => Function.update Ο e false | |
| else Ο | |
| else Ο | |
| lemma inverseKernel_nonneg (hp : p β Set.Ioo 0 1) | |
| (h0 : β e, w e False = 1-p) (h1 : β e, w e True = p) | |
| (j : β) (Ο : E β Bool) (m : Option E) : 0 β€ inverseKernel G order d x p w n D j Ο m := by | |
| unfold inverseKernel | |
| split_ifs with hj hi hm hm | |
| Β· cases m with | |
| | none => exact le_rfl | |
| | some e => exact (pivotGuess_subprobability G order d x p w n D hp h0 h1 _ Ο).1 e | |
| Β· exact zero_le_one | |
| Β· exact le_rfl | |
| Β· exact zero_le_one | |
| Β· exact le_rfl | |
| lemma inverseKernel_sum (hp : p β Set.Ioo 0 1) | |
| (h0 : β e, w e False = 1-p) (h1 : β e, w e True = p) | |
| (j : β) (Ο : E β Bool) : (β m, inverseKernel G order d x p w n D j Ο m) β€ 1 := by | |
| unfold inverseKernel | |
| split_ifs with hj hi | |
| Β· rw [Fintype.sum_option] | |
| simp only [zero_add] | |
| exact (pivotGuess_subprobability G order d x p w n D hp h0 h1 _ Ο).2 | |
| Β· simp | |
| Β· simp | |
| noncomputable def contactTotal (i : Fin n) (Ο : E β Bool) : β := | |
| β m, scheduleWeight G order d x p w n (fun j => (D j).1) i (configuration Ο) m | |
| noncomputable def inactiveKernel (i : Fin n) (Ο : E β Bool) (m : Option E) : β := | |
| if i β activeSteps n D then if m=none then 1 else 0 | |
| else if contactTotal G order d x p w n D i Ο = 0 then if m=none then 1 else 0 | |
| else scheduleWeight G order d x p w n (fun j => (D j).1) i (configuration Ο) m / | |
| contactTotal G order d x p w n D i Ο | |
| lemma contactTotal_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) : | |
| 0 β€ contactTotal G order d x p w n D i Ο := | |
| Finset.sum_nonneg fun m _ => scheduleWeight_nonneg G order d x p w hp h0 h1 n _ i _ m | |
| lemma inactiveKernel_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 β€ inactiveKernel G order d x p w n D i Ο m := by | |
| unfold inactiveKernel | |
| split_ifs | |
| Β· exact zero_le_one | |
| Β· exact le_rfl | |
| Β· exact zero_le_one | |
| Β· exact le_rfl | |
| Β· exact div_nonneg (scheduleWeight_nonneg G order d x p w hp h0 h1 n _ i _ m) | |
| (contactTotal_nonneg G order d x p w n D hp h0 h1 i Ο) | |
| lemma inactiveKernel_sum (i : Fin n) (Ο : E β Bool) : | |
| (β m, inactiveKernel G order d x p w n D i Ο m) = 1 := by | |
| unfold inactiveKernel | |
| split_ifs with hi ht | |
| Β· simp | |
| Β· simp | |
| Β· rw [β Finset.sum_div] | |
| exact div_self ht | |
| noncomputable def inverseReference : ((E β Bool) Γ (Fin n β Option E) Γ (Fin n β Option E)) β β := | |
| ReverseReference.joint (FiniteProduct.density (QueryTree.bitWeight p)) | |
| (inverseKernel G order d x p w n D) (inverseUpdate (E := E) n D) | |
| (inactiveKernel G order d x p w n D) n | |
| lemma inverseReference_nonneg (hp : p β Set.Ioo 0 1) | |
| (h0 : β e, w e False = 1-p) (h1 : β e, w e True = p) (z) : | |
| 0 β€ inverseReference G order d x p w n D z := | |
| ReverseReference.joint_nonneg _ (FiniteProduct.density_nonneg (QueryTree.bitWeight_nonneg β¨hp.1.le,hp.2.leβ©)) | |
| _ _ (inverseKernel_nonneg G order d x p w n D hp h0 h1) | |
| _ (inactiveKernel_nonneg G order d x p w n D hp h0 h1) n z | |
| lemma inverseReference_marginal (hp : p β Set.Ioo 0 1) | |
| (h0 : β e, w e False = 1-p) (h1 : β e, w e True = p) (Ο : E β Bool) : | |
| pushMass Prod.fst (inverseReference G order d x p w n D) Ο β€ | |
| FiniteProduct.density (QueryTree.bitWeight p) Ο := by | |
| have he := ReverseReference.joint_marginal_le | |
| (FiniteProduct.density (QueryTree.bitWeight p) : (E β Bool) β β) | |
| (FiniteProduct.density_nonneg (QueryTree.bitWeight_nonneg β¨hp.1.le,hp.2.leβ©)) | |
| (inverseKernel G order d x p w n D) (inverseUpdate (E := E) n D) | |
| (inverseKernel_nonneg G order d x p w n D hp h0 h1) | |
| (inverseKernel_sum G order d x p w n D hp h0 h1) | |
| (inactiveKernel G order d x p w n D) (inactiveKernel_sum G order d x p w n D) n Ο | |
| refine Eq.trans_le ?_ he | |
| unfold pushMass | |
| apply Finset.sum_congr | |
| Β· ext z | |
| simp only [Finset.mem_univ] | |
| Β· intro z _ | |
| rfl | |
| end CriticalPercolation.BinaryLaw | |
| end | |
| end | |
| end | |
| end OAI | |