Download data/lean/OAI/Probability/CriticalPercolation/Modular/ClusterMassEndpointFinite.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 5.99 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/CriticalPercolation/Modular/ClusterMassEndpointFinite.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/CriticalPercolation/Modular/ClusterMassEndpointFinite.lean
-
curl -L -o ClusterMassEndpointFinite.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/CriticalPercolation/Modular/ClusterMassEndpointFinite.lean
5.99 kB
| import Mathlib | |
| import OAI.Probability.CriticalPercolation.ProductMeasure.FiniteInterpolationMeasure | |
| import OAI.Probability.CriticalPercolation.Criticality.SharpnessPhi | |
| import OAI.Probability.CriticalPercolation.Modular.ClusterMassInfinite | |
| namespace OAI | |
| section | |
| noncomputable section | |
| open Set MeasureTheory | |
| open scoped Classical BigOperators | |
| namespace CriticalPercolation.FiniteClusters | |
| open FiniteProduct | |
| variable {V E : Type*} (G : BondGraph V E) | |
| lemma clusterTail_iff_size {Ο : Set E} {v : V} (hC : (G.cluster Ο v).Finite) (s : β) : | |
| Ο β G.clusterTail v s β s β€ size G Ο v := by | |
| constructor | |
| Β· rintro β¨A,hA,hAC,hsβ© | |
| exact hs.trans (Set.ncard_le_ncard hAC hC) | |
| Β· intro hs | |
| exact β¨G.cluster Ο v,hC,Subset.rfl,hsβ© | |
| lemma size_insert_disconnected (Ο : Set E) (e : E) (x y : V) | |
| (he : G.ends e = s(x,y)) (hxy : Β¬(G.openGraph Ο).Reachable x y) | |
| (hx : (G.cluster Ο x).Finite) (hy : (G.cluster Ο y).Finite) : | |
| size G (insert e Ο) x = size G Ο x + size G Ο y := by | |
| unfold size | |
| rw [G.cluster_insert_endpoint Ο e x y he, | |
| Set.ncard_union_eq (G.cluster_disjoint_of_not_reachable hxy) hx hy] | |
| lemma size_insert_connected (Ο : Set E) (e : E) (x y : V) | |
| (he : G.ends e = s(x,y)) (hxy : (G.openGraph Ο).Reachable x y) : | |
| size G (insert e Ο) x = size G Ο x := by | |
| unfold size | |
| rw [G.cluster_insert_endpoint Ο e x y he,G.cluster_eq_of_reachable hxy,Set.union_self] | |
| lemma edgeMass_gap (s : β) (hs : 0<s) (Ο : Set E) (e : E) | |
| (hx : (G.cluster Ο (G.ends e).out.1).Finite) | |
| (hy : (G.cluster Ο (G.ends e).out.2).Finite) : | |
| (if Ο β G.twoClusterEvent (G.ends e).out.1 (G.ends e).out.2 s then (1:β) else 0) β€ | |
| edgeMass G s Ο e - edgeMass G s (insert e Ο) e := by | |
| have he : G.ends e = s((G.ends e).out.1,(G.ends e).out.2) := (G.ends e).out_eq.symm | |
| have hopen := LazyDFS.prop_openEdge_reachable G (insert e Ο) (Set.mem_insert e Ο) he | |
| unfold edgeMass | |
| rw [ite_eq_left hopen,add_zero] | |
| by_cases hc : (G.openGraph Ο).Reachable (G.ends e).out.1 (G.ends e).out.2 | |
| Β· rw [ite_eq_left hc,size_insert_connected G Ο e _ _ he hc] | |
| simp [BondGraph.twoClusterEvent,hc] | |
| Β· rw [ite_eq_right hc,size_insert_disconnected G Ο e _ _ he hc hx hy] | |
| have hh := cappedMass_gap s (size G Ο (G.ends e).out.1) (size G Ο (G.ends e).out.2) hs | |
| simpa only [BondGraph.twoClusterEvent,Set.mem_inter_iff,Set.mem_ofPred_eq, | |
| clusterTail_iff_size G hx,clusterTail_iff_size G hy,hc,not_false_eq_true,and_true,true_and] using hh | |
| variable [Fintype E] | |
| lemma finite_expect_edgeDiscrepancy (s : β) (p : β) (hp : p β Ioo 0 1) | |
| (w : E β Prop β β) (hw : β e, β b, w e b=1) | |
| (e : E) (h0 : w e False=1-p) (h1 : w e True=p) : | |
| expect w (fun Ο => edgeDiscrepancy G s p Ο e) = | |
| expect w (fun Ο => if Β¬Ο e then edgeMass G s Ο e - edgeMass G s (insert e Ο) e else 0) := by | |
| let : DecidableEq E := Classical.decEq E | |
| have hflip := expect_closed_flip_decidable w hw e hp h0 h1 (fun Ο => edgeMass G s Ο e / p) | |
| have hu (Ο : Set E) : (Function.update Ο e True : Set E) = insert e Ο := by | |
| ext a | |
| change Function.update (fun a => Ο a) e True a β a=e β¨ aβΟ | |
| by_cases ha : a=e | |
| Β· subst a; simp [Function.update] | |
| Β· simp only [Function.update_of_ne ha,ha,false_or]; rfl | |
| have hleft : (fun Ο : Set E => if Β¬Ο e then p*(edgeMass G s (Function.update Ο e True) e / p) else 0) = | |
| (fun Ο => if Β¬Ο e then edgeMass G s (insert e Ο) e else 0) := by | |
| funext Ο | |
| rw [hu] | |
| split_ifs <;> field_simp [hp.1.ne'] | |
| erw [hleft] at hflip | |
| have heq (Ο : Set E) : edgeDiscrepancy G s p Ο e = | |
| (if Β¬Ο e then edgeMass G s Ο e else 0) - | |
| (if Ο e then (1-p)*(edgeMass G s Ο e / p) else 0) := by | |
| unfold edgeDiscrepancy coefficient | |
| change (if Ο e then -(1-p)/p else 1) * edgeMass G s Ο e = _ | |
| by_cases hb : Ο e <;> simp only [hb,ite_true,ite_false,not_true_eq_false,not_false_eq_true,sub_zero,zero_sub,one_mul] | |
| ring | |
| have hfunc := funext heq | |
| erw [hfunc,expect_sub,β hflip,β expect_sub] | |
| congr 1 | |
| funext Ο | |
| by_cases hb : Ο e <;> simp [hb] | |
| lemma finite_endpoint_le_expect (s : β) (hs : 0<s) (p : β) (hp : p β Ioo 0 1) | |
| (w : E β Prop β β) (hw : β e, β b, w e b=1) (hn : β e b, 0β€w e b) | |
| (e : E) (h0 : w e False=1-p) (h1 : w e True=p) : | |
| prob w (fun Ο => Ο β G.twoClusterEvent (G.ends e).out.1 (G.ends e).out.2 s) β€ | |
| expect w (fun Ο => edgeDiscrepancy G s p Ο e) := by | |
| rw [finite_expect_edgeDiscrepancy G s p hp w hw e h0 h1] | |
| apply expect_mono hn | |
| intro Ο | |
| by_cases hb : Ο e | |
| Β· have hconn := LazyDFS.prop_openEdge_reachable G Ο hb (G.ends e).out_eq.symm | |
| have hno : Β¬ (Ο : Set E) β G.twoClusterEvent (G.ends e).out.1 (G.ends e).out.2 s := by | |
| intro hh | |
| exact hh.1.1 hconn | |
| change (if (Ο : Set E) β G.twoClusterEvent _ _ s then (1:β) else 0) β€ _ | |
| simp only [hno,ite_false,hb,not_true_eq_false,le_refl] | |
| Β· simp only [hb,not_false_eq_true,ite_true] | |
| exact edgeMass_gap G s hs Ο e (G.finite_cluster_of_finite_bonds (Set.toFinite Ο) _) | |
| (G.finite_cluster_of_finite_bonds (Set.toFinite Ο) _) | |
| lemma finite_endpoint_le_integral (s : β) (hs : 0<s) (p : unitInterval) | |
| (hp : (p:β) β Ioo 0 1) (e : E) : | |
| (G.law p).real (G.twoClusterEvent (G.ends e).out.1 (G.ends e).out.2 s) β€ | |
| β« Ο, edgeDiscrepancy G s p Ο e βG.law p := by | |
| have hh := finite_endpoint_le_expect G s hs p hp (fun _ => BernoulliProduct.bitWeight p) | |
| (fun _ => BernoulliProduct.bitWeight_sum p) (fun _ => BernoulliProduct.bitWeight_nonneg p) | |
| e (by simp [BernoulliProduct.bitWeight]) (by simp [BernoulliProduct.bitWeight]) | |
| rw [BondGraph.law,β BernoulliProduct.law_const,BernoulliProduct.integral_law_eq_expect] | |
| convert hh using 1 | |
| Β· exact (Sharpness.probability_eq_real p | |
| (fun Ο => Ο β G.twoClusterEvent (G.ends e).out.1 (G.ends e).out.2 s)).symm | |
| Β· rfl | |
| end CriticalPercolation.FiniteClusters | |
| end | |
| end | |
| end OAI | |