Download data/lean/OAI/Probability/CriticalPercolation/Entropy/BinaryConfiguration.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 9.2 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/CriticalPercolation/Entropy/BinaryConfiguration.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/CriticalPercolation/Entropy/BinaryConfiguration.lean
-
curl -L -o BinaryConfiguration.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/CriticalPercolation/Entropy/BinaryConfiguration.lean
9.2 kB
| import Mathlib | |
| import OAI.Probability.CriticalPercolation.Entropy.BinaryDescriptor | |
| import OAI.Probability.CriticalPercolation.Entropy.BinaryRaw | |
| import OAI.Probability.CriticalPercolation.Entropy.MarkedEntropy | |
| namespace OAI | |
| section | |
| section | |
| namespace CriticalPercolation.BinaryLaw | |
| open scoped Classical | |
| open FiniteProduct BondGraph BinaryInterpolation FiniteEntropy ExactExposure | |
| variable {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] | |
| variable (G : BondGraph V E) (order : List (LazyDFS.Dart V E)) (d : β) (x : β β V) | |
| variable (p : β) (w : E β Prop β β) | |
| lemma scheduleWeight_nonneg (hp : p β Set.Ioo 0 1) (h0 : β e, w e False = 1-p) | |
| (h1 : β e, w e True = p) (n : β) (b : Fin n β Bool) (i : Fin n) | |
| (Ο : E β Prop) (m : Option E) : 0 β€ scheduleWeight G order d x p w n b i Ο m := | |
| G.rawContact_nonneg order _ _ hp w h0 h1 _ Ο m | |
| lemma scheduleWeight_sum (n : β) (b : Fin n β Bool) (i : Fin n) (Ο : E β Prop) : | |
| (β m, scheduleWeight G order d x p w n b i Ο m) = | |
| G.scheduledContact order | |
| (BondGraph.anchorSet {x 0,x d} (scheduledAnchor (E := E) d x n b) i.val) | |
| (scheduledAnchor (E := E) d x n b i.val) p w | |
| (G.clusterObject Ο (BondGraph.anchorSet {x 0,x d} (scheduledAnchor (E := E) d x n b) i.val)) Ο := by | |
| unfold scheduleWeight | |
| rw [G.rawContact_sum,scheduledTargets_anchors d x n b i.val i.isLt.le] | |
| theorem scheduleWeight_exponential (ho : LazyDFS.Exhaustive G order) | |
| (hp : p β Set.Ioo 0 1) (h0 : β e, w e False = 1-p) (h1 : β e, w e True = p) | |
| (n : β) (b : Fin n β Bool) : | |
| expect w (fun Ο => Real.exp (2*logContactMass (scheduleWeight G order d x p w n b) Ο)) β€ | |
| Real.exp (n*Real.log 4) := by | |
| let a := scheduledAnchor (E := E) d x n b | |
| let B := BondGraph.anchorSet {x 0,x d} a | |
| have he (Ο : E β Prop) : logContactMass (scheduleWeight G order d x p w n b) Ο = | |
| β i β Finset.range n, Real.log (max 1 (G.scheduledContact order (B i) (a i) p w | |
| (G.clusterObject Ο (B i)) Ο)) := by | |
| unfold logContactMass | |
| simp only [scheduleWeight_sum] | |
| exact Fin.sum_univ_eq_sum_range (fun i => Real.log (max 1 (G.scheduledContact order (B i) (a i) p w | |
| (G.clusterObject Ο (B i)) Ο))) n | |
| simp_rw [he] | |
| exact G.scheduled_contact_exponential order ho {x 0,x d} a B (fun _ => Set.Subset.refl _) | |
| hp w h0 h1 n (Finset.range n) (Finset.Subset.refl _) | |
| lemma density_seed_le_rawProduct (hd : 0<d) (hp : p β Set.Ioo 0 1) | |
| (h0 : β e, w e False = 1-p) (h1 : β e, w e True = p) | |
| {c : β} (hc : 0<c) (hc1 : cβ€1) | |
| (hconn : β j, 0<j β j<d β c β€ prob w (fun Ο => (G.openGraph Ο).Reachable (x 0) (x j))) | |
| (s : β) (hΞ΄ : 0 < prob w (endpointEvent G (x 0) (x d) s)) | |
| (n : β) (h : History E n) (Ο : E β Prop) : | |
| density G order d x p w (seed G w (x 0) (x d) s) n h Ο β€ | |
| (prob w (endpointEvent G (x 0) (x d) s))β»ΒΉ * (cβ»ΒΉ)^n * rawProduct G order d x p w n h Ο := by | |
| apply (density_le_rawProduct G order d x p w hd hp h0 h1 _ | |
| (seed_nonneg G w _ _ s hΞ΄) hc hc1 hconn n h Ο).trans | |
| apply mul_le_mul_of_nonneg_right _ (rawProduct_nonneg G order d x p w hp h0 h1 n h Ο) | |
| apply mul_le_mul_of_nonneg_right _ (pow_nonneg (inv_nonneg.mpr hc.le) n) | |
| unfold seed | |
| split_ifs <;> simp only [mul_one,mul_zero,le_refl,inv_nonneg.mpr hΞ΄.le] | |
| noncomputable def constructionCost (c : β) (s n : β) (D : FixedDescriptor n) : β := | |
| Real.log ((prob w (endpointEvent G (x 0) (x d) s))β»ΒΉ * (cβ»ΒΉ)^n / | |
| descriptorMass G order d x p w s n D) | |
| lemma exp_constructionCost (c : β) (hc : 0<c) (s n : β) (D : FixedDescriptor n) | |
| (hΞ΄ : 0 < prob w (endpointEvent G (x 0) (x d) s)) | |
| (hD : 0 < descriptorMass G order d x p w s n D) : | |
| Real.exp (constructionCost G order d x p w c s n D) = | |
| (prob w (endpointEvent G (x 0) (x d) s))β»ΒΉ * (cβ»ΒΉ)^n / | |
| descriptorMass G order d x p w s n D := | |
| Real.exp_log (div_pos (mul_pos (inv_pos.mpr hΞ΄) (pow_pos (inv_pos.mpr hc) n)) hD) | |
| theorem conditionedMass_density_le (hd : 0<d) (hp : p β Set.Ioo 0 1) | |
| (h0 : β e, w e False = 1-p) (h1 : β e, w e True = p) | |
| {c : β} (hc : 0<c) (hc1 : cβ€1) | |
| (hconn : β j, 0<j β j<d β c β€ prob w (fun Ο => (G.openGraph Ο).Reachable (x 0) (x j))) | |
| (s n : β) (D : FixedDescriptor n) | |
| (hΞ΄ : 0 < prob w (endpointEvent G (x 0) (x d) s)) | |
| (hD : 0 < descriptorMass G order d x p w s n D) | |
| (z : (E β Bool) Γ (Fin n β Option E)) : | |
| conditionedMass G order d x p w s n D z β€ | |
| Real.exp (constructionCost G order d x p w c s n D) * | |
| FiniteProduct.density (QueryTree.bitWeight p) z.1 * | |
| β i, scheduleWeight G order d x p w n (fun j => (D j).1) i (configuration z.1) (z.2 i) := by | |
| rw [exp_constructionCost G order d x p w c hc s n D hΞ΄ hD] | |
| have hΞΌ : 0 β€ FiniteProduct.density (QueryTree.bitWeight p) z.1 := | |
| FiniteProduct.density_nonneg (fun e b => (QueryTree.bitWeight_pos hp e b).le) _ | |
| unfold conditionedMass fixedMass | |
| dsimp only | |
| split_ifs | |
| Β· have hr := density_seed_le_rawProduct G order d x p w hd hp h0 h1 hc hc1 hconn s hΞ΄ n | |
| (fromWords n (fun j => (D j).1) z.2) (configuration z.1) | |
| erw [rawProduct_words] at hr | |
| unfold jointMass | |
| dsimp only | |
| calc | |
| _ β€ (FiniteProduct.density (QueryTree.bitWeight p) z.1 * | |
| ((prob w (endpointEvent G (x 0) (x d) s))β»ΒΉ * (cβ»ΒΉ)^n * | |
| β i, scheduleWeight G order d x p w n (fun j => (D j).1) i (configuration z.1) (z.2 i))) / | |
| descriptorMass G order d x p w s n D := | |
| div_le_div_of_nonneg_right (mul_le_mul_of_nonneg_left hr hΞΌ) hD.le | |
| _ = _ := by ring | |
| Β· rw [zero_div] | |
| exact mul_nonneg (mul_nonneg (div_nonneg (mul_nonneg (inv_nonneg.mpr hΞ΄.le) | |
| (pow_nonneg (inv_nonneg.mpr hc.le) n)) hD.le) hΞΌ) | |
| (Finset.prod_nonneg fun i _ => scheduleWeight_nonneg G order d x p w hp h0 h1 n _ i _ _) | |
| lemma sum_configuration (h0 : β e, w e False = 1-p) (h1 : β e, w e True = p) | |
| (f : Set E β β) : | |
| (β Ο : E β Bool, FiniteProduct.density (QueryTree.bitWeight p) Ο * f (configuration Ο)) = | |
| expect w f := by | |
| have hw : QueryTree.bitWeight p = fun e (b : Bool) => w e (b = true) := by | |
| funext e b | |
| cases b <;> simp [QueryTree.bitWeight,h0,h1] | |
| have he := expect_configuration w f | |
| rw [β hw] at he | |
| refine Eq.trans ?_ he | |
| unfold expect | |
| apply Finset.sum_congr | |
| Β· ext f; simp only [Finset.mem_univ] | |
| Β· intro f _; rfl | |
| lemma scheduleWeight_exponential_bool (ho : LazyDFS.Exhaustive G order) | |
| (hp : p β Set.Ioo 0 1) (h0 : β e, w e False = 1-p) (h1 : β e, w e True = p) | |
| (n : β) (b : Fin n β Bool) : | |
| (β Ο : E β Bool, FiniteProduct.density (QueryTree.bitWeight p) Ο * | |
| Real.exp (2*logContactMass (fun i Ο => scheduleWeight G order d x p w n b i (configuration Ο)) Ο)) β€ | |
| Real.exp (n*Real.log 4) := by | |
| have he := sum_configuration p w h0 h1 | |
| (fun Ο => Real.exp (2*logContactMass (scheduleWeight G order d x p w n b) Ο)) | |
| change (β Ο : E β Bool, FiniteProduct.density (QueryTree.bitWeight p) Ο * | |
| Real.exp (2*logContactMass (scheduleWeight G order d x p w n b) (configuration Ο))) β€ _ | |
| rw [he] | |
| exact scheduleWeight_exponential G order d x p w ho hp h0 h1 n b | |
| noncomputable section EntropyFinal | |
| local instance classicalFinDecidable (n : β) : DecidableEq (Fin n) := Classical.decEq _ | |
| theorem conditioned_configuration_entropy (ho : LazyDFS.Exhaustive G order) | |
| (hd : 0<d) (hp : p β Set.Ioo 0 1) | |
| (h0 : β e, w e False = 1-p) (h1 : β e, w e True = p) | |
| {c : β} (hc : 0<c) (hc1 : cβ€1) | |
| (hconn : β j, 0<j β j<d β c β€ prob w (fun Ο => (G.openGraph Ο).Reachable (x 0) (x j))) | |
| (s n : β) (D : FixedDescriptor n) | |
| (hΞ΄ : 0 < prob w (endpointEvent G (x 0) (x d) s)) | |
| (hD : 0 < descriptorMass G order d x p w s n D) : | |
| let Q := conditionedMass G order d x p w s n D | |
| let a := fun i Ο => scheduleWeight G order d x p w n (fun j => (D j).1) i (configuration Ο) | |
| divergence (pushMass Prod.fst Q) (FiniteProduct.density (QueryTree.bitWeight p)) β€ | |
| 2*constructionCost G order d x p w c s n D+n*Real.log 4 β§ | |
| (β z, Q z * logContactMass a z.1) β€ constructionCost G order d x p w c s n D+n*Real.log 4 := by | |
| exact contact_configuration_entropy | |
| (conditionedMass G order d x p w s n D) | |
| (conditionedMass_nonneg G order d x p w s n hp h0 h1 hΞ΄ D hD) | |
| (by | |
| have hz := conditionedMass_normalized G order d x p w s n D hD | |
| refine Eq.trans ?_ hz | |
| apply Finset.sum_congr | |
| Β· ext z; simp only [Finset.mem_univ] | |
| Β· intro z _; rfl) | |
| (FiniteProduct.density (QueryTree.bitWeight p)) | |
| (fun Ο => Finset.prod_pos (fun e _ => QueryTree.bitWeight_pos hp e (Ο e))) | |
| (fun i Ο => scheduleWeight G order d x p w n (fun j => (D j).1) i (configuration Ο)) | |
| (fun i Ο m => scheduleWeight_nonneg G order d x p w hp h0 h1 n _ i _ m) | |
| (constructionCost G order d x p w c s n D) (n*Real.log 4) | |
| (conditionedMass_density_le G order d x p w hd hp h0 h1 hc hc1 hconn s n D hΞ΄ hD) | |
| (scheduleWeight_exponential_bool G order d x p w ho hp h0 h1 n _) | |
| end EntropyFinal | |
| end CriticalPercolation.BinaryLaw | |
| end | |
| end | |
| end OAI | |