Download data/lean/OAI/Probability/CriticalPercolation/GraphGeometry/FiniteAdjacent.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 5.14 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/CriticalPercolation/GraphGeometry/FiniteAdjacent.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/CriticalPercolation/GraphGeometry/FiniteAdjacent.lean
-
curl -L -o FiniteAdjacent.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/CriticalPercolation/GraphGeometry/FiniteAdjacent.lean
5.14 kB
| import Mathlib | |
| import OAI.Probability.CriticalPercolation.Exploration.IncidenceDegree | |
| import OAI.Probability.CriticalPercolation.Exploration.IncidenceIdentity | |
| import OAI.Probability.CriticalPercolation.Exploration.QueryBand | |
| import OAI.Probability.CriticalPercolation.Exploration.QueryNormalized | |
| import OAI.Probability.CriticalPercolation.Modular.CappedDiscrepancy | |
| namespace OAI | |
| section | |
| section | |
| noncomputable section | |
| open Set | |
| open scoped Classical | |
| namespace CriticalPercolation | |
| open FiniteProduct | |
| namespace BondGraph | |
| variable {V E : Type*} [Fintype V] [Fintype E] (G : BondGraph V E) | |
| omit [Fintype V] in | |
| lemma clusterDiscrepancy_eq_centered (p : β) (hp : pβ 0) (Ο : Set E) (v : V) : | |
| G.clusterDiscrepancy p Ο v = -(IncidenceSearch.tree G v).centeredSum p Ο / p := by | |
| rw [IncidenceSearch.tree_centered,clusterDiscrepancy,β Finset.sum_neg_distrib,Finset.sum_div] | |
| apply Finset.sum_congr rfl | |
| intro e _ | |
| change (if eβG.incidentEdges (G.cluster Ο v) then | |
| (if eβΟ then -(1-p)/p else 1) else 0) = | |
| -(if eβG.incidentEdges (G.cluster Ο v) then (if eβΟ then 1-p else -p) else 0)/p | |
| by_cases he : eβG.incidentEdges (G.cluster Ο v) | |
| Β· by_cases hΟ : eβΟ <;> simp [he,hΟ,hp] | |
| Β· simp [he] | |
| lemma root_discrepancy_bound (p : β) (hp : p β Set.Ioo 0 1) | |
| (w : E β Prop β β) (hw : β e, β b, w e b=1) (hn : β e b, 0β€w e b) | |
| (hf : LazyDFS.Fresh w p β ) (D : β) (hDpos : 1β€D) | |
| (hD : β v, (G.incidentEdges {v}).toFinset.card β€ D) (K : β) (v : V) : | |
| expect w (fun Ο => G.rootMass (cappedMass (4^K)) Ο v * |G.clusterDiscrepancy p Ο v|) β€ | |
| (D:β)/p*(6/(2:β)^K) := by | |
| let t := IncidenceSearch.tree G v | |
| have hwel : β Ο : Set E, G.rootMass (cappedMass (4^K)) Ο v * |G.clusterDiscrepancy p Ο v| β€ | |
| (D:β)/p * (|t.centeredSum p Ο| * min (1/(4:β)^K) (1/(t.queryCount Ο : β))) := by | |
| intro Ο | |
| rw [G.clusterDiscrepancy_eq_centered p hp.1.ne' Ο v,abs_div,abs_neg,abs_of_pos hp.1] | |
| change G.rootMass (cappedMass (4^K)) Ο v * (|t.centeredSum p Ο|/p) β€ _ | |
| by_cases hT : t.queryCount Ο = 0 | |
| Β· rw [t.centeredSum_eq_zero_of_count Ο hT p] | |
| simp | |
| Β· have hTD : t.queryCount Ο β€ D*G.clusterSize Ο v := by | |
| rw [IncidenceSearch.tree_count] | |
| simpa only [clusterSize,mul_comm] using G.incident_card_le (G.cluster Ο v) D hD | |
| have hh := G.capped_root_le_normalized (4^K) (t.queryCount Ο) D | |
| (by positivity) (Nat.pos_of_ne_zero hT) hDpos Ο v hTD | |
| have hh' : G.rootMass (cappedMass (4^K)) Ο v β€ (D:β)* | |
| min (1/(4:β)^K) (1/(t.queryCount Ο : β)) := by | |
| simpa only [Nat.cast_pow,Nat.cast_ofNat] using hh | |
| calc | |
| _ β€ ((D:β)*min (1/(4:β)^K) (1/(t.queryCount Ο : β))) * | |
| (|t.centeredSum p Ο|/p) := mul_le_mul_of_nonneg_right hh' | |
| (div_nonneg (abs_nonneg _) hp.1.le) | |
| _ = _ := by ring | |
| calc | |
| _ β€ expect w (fun Ο => (D:β)/p * | |
| (|t.centeredSum p Ο| * min (1/(4:β)^K) (1/(t.queryCount Ο : β)))) := by | |
| exact expect_mono hn (fun Ο => hwel Ο) | |
| _ = (D:β)/p * expect w (fun Ο => | |
| |t.centeredSum p Ο| * min (1/(4:β)^K) (1/(t.queryCount Ο : β))) := expect_const_mul _ _ _ | |
| _ β€ _ := mul_le_mul_of_nonneg_left | |
| (t.normalized_centered_bound β (IncidenceSearch.tree_valid G v) p | |
| β¨hp.1.le,hp.2.leβ© w hw hn hf K) (div_nonneg (Nat.cast_nonneg D) hp.1.le) | |
| theorem finite_averaged_adjacent (p : β) (hp : p β Set.Ioo 0 1) | |
| (w : E β Prop β β) (hw : β e, β b, w e b=1) (hn : β e b, 0β€w e b) | |
| (h0 : β e, w e False=1-p) (h1 : β e, w e True=p) | |
| (D : β) (hDpos : 1β€D) (hD : β v, (G.incidentEdges {v}).toFinset.card β€ D) | |
| (x y : E β V) (he : β e, G.ends e = s(x e,y e)) (K : β) : | |
| (β e, prob w (BinaryLaw.endpointEvent G (x e) (y e) (4^K))) β€ | |
| (Fintype.card V : β)*((D:β)/p*(6/(2:β)^K)) := by | |
| have hf : LazyDFS.Fresh w p β := fun e _ => β¨h0 e,h1 eβ© | |
| calc | |
| _ β€ β e, expect w (fun Ο => G.edgeDiscrepancy (cappedMass (4^K)) p Ο e) := by | |
| apply Finset.sum_le_sum | |
| intro e _ | |
| exact G.endpoint_prob_le_discrepancy p hp w hw hn e (x e) (y e) (he e) | |
| (h0 e) (h1 e) (4^K) (by positivity) | |
| _ = expect w (fun Ο => β v, G.rootMass (cappedMass (4^K)) Ο v * G.clusterDiscrepancy p Ο v) := by | |
| erw [β expect_sum] | |
| congr 1 | |
| funext Ο | |
| exact G.sum_edgeDiscrepancy _ p Ο | |
| _ β€ expect w (fun Ο => β v, G.rootMass (cappedMass (4^K)) Ο v * |G.clusterDiscrepancy p Ο v|) := by | |
| apply expect_mono hn | |
| intro Ο | |
| apply Finset.sum_le_sum | |
| intro v _ | |
| apply mul_le_mul_of_nonneg_left (le_abs_self _) | |
| exact div_nonneg (cappedMass_nonneg _ _) (Nat.cast_nonneg _) | |
| _ = β v, expect w (fun Ο => G.rootMass (cappedMass (4^K)) Ο v * |G.clusterDiscrepancy p Ο v|) := by | |
| erw [expect_sum] | |
| _ β€ β _v : V, (D:β)/p*(6/(2:β)^K) := by | |
| exact Finset.sum_le_sum (fun v _ => G.root_discrepancy_bound p hp w hw hn hf D hDpos hD K v) | |
| _ = _ := by simp | |
| end BondGraph | |
| end CriticalPercolation | |
| end | |
| end | |
| end | |
| end OAI | |