Download data/lean/OAI/Probability/CriticalPercolation/Criticality/LayerCounting.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 8.06 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/CriticalPercolation/Criticality/LayerCounting.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/CriticalPercolation/Criticality/LayerCounting.lean
-
curl -L -o LayerCounting.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/CriticalPercolation/Criticality/LayerCounting.lean
8.06 kB
| import Mathlib | |
| import OAI.Probability.CriticalPercolation.Model | |
| import OAI.Probability.CriticalPercolation.GraphGeometry.FiniteInduced | |
| import OAI.Probability.CriticalPercolation.Exploration.BallIncidence | |
| import OAI.Probability.CriticalPercolation.Exploration.LayerExposure | |
| import OAI.Probability.CriticalPercolation.Gluing.StripMoves | |
| import OAI.Probability.CriticalPercolation.Criticality.BlockLocalization | |
| import OAI.Probability.CriticalPercolation.Modular.ModularClusterMass | |
| namespace OAI | |
| section | |
| noncomputable section | |
| open Set MeasureTheory ProbabilityTheory | |
| open scoped Classical ENNReal BigOperators | |
| namespace CriticalPercolation.BondGraph | |
| variable {V E : Type*} (G : BondGraph V E) | |
| def layerComponent (D H : Set V) (Ο : Set E) (x : V) : Set V := | |
| G.cluster ((Οβ©G.inducedEdges D)β©G.inducedEdges HαΆ) x | |
| def openLayerExits (D H : Set V) (Ο : Set E) (x : V) : Set E := | |
| G.freshClusterBoundary (G.inducedEdges HαΆ) x (Οβ©G.inducedEdges D)β©(Οβ©G.inducedEdges D) | |
| lemma openLayerExit_endpoints {D H : Set V} {Ο : Set E} {x : V} (hx : xβH) | |
| {e : E} (he : eβG.openLayerExits D H Ο x) : | |
| β u v, G.ends e=s(u,v) β§ uβH β§ vβH β§ vβG.layerComponent D H Ο x β§ eβΟ β§ | |
| eβG.inducedEdges D := by | |
| obtain β¨β¨β¨u,v,heuv,hu,hvβ©,heHβ©,heΟ,heDβ© := he | |
| have hvH := G.cluster_induced_subset (Οβ©G.inducedEdges D) HαΆ hx hv | |
| refine β¨u,v,heuv,?_,hvH,hv,heΟ,heDβ© | |
| by_contra huH | |
| apply heH | |
| intro z hz | |
| rw [heuv] at hz | |
| rcases Sym2.mem_iff.mp hz with rfl|rfl | |
| Β· exact huH | |
| Β· exact hvH | |
| lemma openLayerExit_child {D H : Set V} (hHD : HβD) {o x : V} {Ο : Set E} | |
| (hx : xβG.entrySeeds D o Ο) (hxH : xβH) {e : E} | |
| (he : eβG.openLayerExits D H Ο x) : | |
| eβG.incidentEdges (G.entrySeeds H o Ο) := by | |
| obtain β¨u,v,heuv,huH,hvH,hv,heΟ,heDβ© := G.openLayerExit_endpoints hxH he | |
| have hprevious : xβG.cluster (Οβ©(G.inducedEdges H)αΆ) o := by | |
| apply G.cluster_mono _ o hx.1 | |
| intro f hf | |
| exact β¨hf.1,fun hh => hf.2 (G.inducedEdges_monotone hHD hh)β© | |
| have hmiddle : vβG.cluster (Οβ©(G.inducedEdges H)αΆ) x := by | |
| apply G.cluster_mono _ x hv | |
| intro f hf | |
| refine β¨hf.1.1,?_β© | |
| intro hh | |
| obtain β¨a,b,habβ© : β a b, G.ends f=s(a,b) := Sym2.exists.mp β¨G.ends f,rflβ© | |
| have ha : aβG.ends f := by rw [hab]; simp | |
| exact hf.2 a ha (hh a ha) | |
| have hneq : vβ u := by intro hh; subst v; exact hvH huH | |
| have hedge : (G.openGraph (Οβ©(G.inducedEdges H)αΆ)).Adj v u := by | |
| apply (SimpleGraph.fromEdgeSet_adj _).mpr | |
| refine β¨β¨e,β¨heΟ,?_β©,?_β©,hneqβ© | |
| Β· intro hh | |
| exact hvH (hh v (by rw [heuv]; simp)) | |
| Β· rw [heuv,Sym2.eq_swap] | |
| exact β¨u,β¨hprevious.trans (hmiddle.trans hedge.reachable),huHβ©,by rw [heuv]; simpβ© | |
| lemma openLayerExit_common_component {D H : Set V} {Ο : Set E} {x y : V} | |
| (hx : xβH) (hy : yβH) {e : E} | |
| (hex : eβG.openLayerExits D H Ο x) (hey : eβG.openLayerExits D H Ο y) : | |
| yβG.layerComponent D H Ο x := by | |
| obtain β¨u,v,heuv,huH,hvH,hv,_,_β© := G.openLayerExit_endpoints hx hex | |
| obtain β¨a,b,heab,haH,hbH,hb,_,_β© := G.openLayerExit_endpoints hy hey | |
| have hevb : v=b := by | |
| have heq : s(u,v)=s(a,b) := heuv.symm.trans heab | |
| rcases Sym2.eq_iff.mp heq with hh|hh | |
| Β· exact hh.2 | |
| Β· exact False.elim (hvH (hh.2 βΈ haH)) | |
| subst b | |
| exact hv.trans hb.symm | |
| lemma comparable_parents_card_le (hc : G.fullGraph.Connected) (hl : G.LocallyFinite) | |
| (o x : V) (C : Set V) (A : Finset V) (hAC : (A : Set V)βC) | |
| (a T : β) (ha : 0<a) (hT : 0<T) | |
| (hband : β yβA, a*Tβ€G.modularRatio y o) | |
| (hx : G.modularRatio x oβ€T) (M K : β) (hMK : (M:β)β€a*K) | |
| (hm : G.modularMass x Cβ€M) : A.cardβ€K := by | |
| have hlow := G.finset_weight_lower o C A hAC (ENNReal.ofReal (a*T)) | |
| (fun y hy => ENNReal.ofReal_le_ofReal (hband y hy)) | |
| have hmass : G.modularMass o Cβ€ENNReal.ofReal T*M := by | |
| rw [G.modularMass_change_base hc hl o x C] | |
| exact mul_le_mul' (ENNReal.ofReal_le_ofReal hx) hm | |
| have hh := hlow.trans hmass | |
| have hh' : a*T*(A.card:β)β€T*M := by | |
| rw [βENNReal.ofReal_natCast,βENNReal.ofReal_mul (mul_pos ha hT).le, | |
| βENNReal.ofReal_natCast,βENNReal.ofReal_mul hT.le] at hh | |
| exact (ENNReal.ofReal_le_ofReal_iff (by positivity : (0:β)β€T*M)).mp hh | |
| apply Nat.cast_le.mp (show (A.card:β)β€K from ?_) | |
| have hc' : a*(A.card:β)β€M := (mul_le_mul_iff_rightβ hT).mp (by | |
| calc | |
| T*(a*(A.card:β))=a*T*(A.card:β) := by ring | |
| _ β€ T*M := hh') | |
| exact (mul_le_mul_iff_rightβ ha).mp (hc'.trans hMK) | |
| lemma finite_relation_count {Ξ± Ξ² : Type*} (A : Finset Ξ±) (B : Finset Ξ²) | |
| (r : Ξ± β Ξ² β Prop) (N K : β) | |
| (hN : β xβA, Nβ€(B.filter (r x)).card) | |
| (hK : β yβB, (A.filter (fun x => r x y)).cardβ€K) : | |
| N*A.cardβ€K*B.card := by | |
| calc | |
| N*A.card = β _xβA, N := by simp [Nat.mul_comm] | |
| _ β€ β xβA, (B.filter (r x)).card := Finset.sum_le_sum hN | |
| _ = β yβB, (A.filter (fun x => r x y)).card := by | |
| simp only [Finset.card_eq_sum_ones,Finset.sum_filter] | |
| exact Finset.sum_comm | |
| _ β€ β _yβB, K := Finset.sum_le_sum hK | |
| _ = K*B.card := by simp [Nat.mul_comm] | |
| lemma layer_exit_fiber_card (hc : G.fullGraph.Connected) (hl : G.LocallyFinite) | |
| (D H : Set V) (Ο : Set E) (o : V) (A : Finset V) | |
| (a T : β) (ha : 0<a) (hT : 0<T) (M N K : β) (hMK : (M:β)β€a*K) | |
| (hA : β xβA, xβH β§ a*Tβ€G.modularRatio x o β§ G.modularRatio x oβ€T β§ | |
| ΟβG.boundedDomainFreshExitEvent D HαΆ x N M) (e : E) : | |
| (A.filter (fun x => eβG.openLayerExits D H Ο x)).cardβ€K := by | |
| let F := A.filter (fun x => eβG.openLayerExits D H Ο x) | |
| by_cases hF : F.Nonempty | |
| Β· obtain β¨x,hxβ© := hF | |
| have hxA := (Finset.mem_filter.mp hx).1 | |
| apply G.comparable_parents_card_le hc hl o x (G.layerComponent D H Ο x) F _ | |
| a T ha hT _ (hA x hxA).2.2.1 M K hMK (hA x hxA).2.2.2.2 | |
| Β· intro y hy | |
| exact G.openLayerExit_common_component (hA x hxA).1 | |
| (hA y (Finset.mem_filter.mp hy).1).1 (Finset.mem_filter.mp hx).2 (Finset.mem_filter.mp hy).2 | |
| Β· intro y hy | |
| exact (hA y (Finset.mem_filter.mp hy).1).2.1 | |
| Β· have he : F=β := Finset.not_nonempty_iff_eq_empty.mp hF | |
| change F.cardβ€K | |
| rw [he,Finset.card_empty] | |
| exact Nat.zero_le K | |
| lemma layer_seed_counting (hc : G.fullGraph.Connected) (hl : G.LocallyFinite) | |
| (D H : Set V) (hHD : HβD) (Ο : Set E) (o : V) (A : Finset V) | |
| (a T : β) (ha : 0<a) (hT : 0<T) (M N K d : β) (hMK : (M:β)β€a*K) | |
| (hd : β v, (G.incidentEdges {v}).ncardβ€d) | |
| (hfinite : (G.entrySeeds H o Ο).Finite) | |
| (hA : β xβA, xβG.entrySeeds D o Ο β§ xβH β§ a*Tβ€G.modularRatio x o β§ | |
| G.modularRatio x oβ€T β§ ΟβG.boundedDomainFreshExitEvent D HαΆ x N M) : | |
| N*A.cardβ€K*d*(G.entrySeeds H o Ο).ncard := by | |
| let F := (G.finite_incident hl hfinite).toFinset | |
| have hN : β xβA, Nβ€(F.filter (fun e => eβG.openLayerExits D H Ο x)).card := by | |
| intro x hx | |
| obtain β¨B,hB,hBxβ© := (hA x hx).2.2.2.2.1 | |
| apply hB.trans (Finset.card_le_card _) | |
| intro e he | |
| apply Finset.mem_filter.mpr | |
| have hh : eβG.openLayerExits D H Ο x := hBx he | |
| exact β¨(G.finite_incident hl hfinite).mem_toFinset.mpr | |
| (G.openLayerExit_child hHD (hA x hx).1 (hA x hx).2.1 hh),hhβ© | |
| have hK : β eβF, (A.filter (fun x => eβG.openLayerExits D H Ο x)).cardβ€K := | |
| fun e _ => G.layer_exit_fiber_card hc hl D H Ο o A a T ha hT M N K hMK | |
| (fun x hx => (hA x hx).2) e | |
| have hcount := finite_relation_count A F (fun x e => eβG.openLayerExits D H Ο x) N K hN hK | |
| have hF : F.cardβ€(G.entrySeeds H o Ο).ncard*d := by | |
| rw [βSet.ncard_eq_toFinset_card _ (G.finite_incident hl hfinite)] | |
| exact G.incident_ncard_le _ hfinite d (fun v _ => hd v) | |
| calc | |
| N*A.card β€ K*F.card := hcount | |
| _ β€ K*((G.entrySeeds H o Ο).ncard*d) := Nat.mul_le_mul_left K hF | |
| _ = K*d*(G.entrySeeds H o Ο).ncard := by ring | |
| end CriticalPercolation.BondGraph | |
| end | |
| end | |
| end OAI | |