import Mathlib import OAI.Probability.CriticalPercolation.GraphGeometry.OpenGraphIso import OAI.Probability.CriticalPercolation.ProductMeasure.TailProduct import OAI.Probability.CriticalPercolation.Clusters.InfiniteUniqueness import OAI.Probability.CriticalPercolation.GraphGeometry.InfiniteEventSubsetHit namespace OAI section section noncomputable section open Set Function MeasureTheory ProbabilityTheory Filter open scoped Classical Topology namespace CriticalPercolation.BondGraph variable {V E : Type*} (G : BondGraph V E) def infiniteVertices (ω : Set E) : Set V := {v | (G.cluster ω v).Infinite} lemma infiniteVertices_mono {ω τ : Set E} (h : ω⊆τ) : G.infiniteVertices ω⊆G.infiniteVertices τ := fun v hv => hv.mono (G.cluster_mono h v) lemma cluster_union_unchanged (ω S : Set E) (o : V) (hends : ∀ e∈S, ∀ v∈G.ends e, v∉G.cluster ω o) : G.cluster (ω∪S) o=G.cluster ω o := by apply Set.Subset.antisymm · intro z hz have hr := ((G.openGraph (ω∪S)).reachable_iff_reflTransGen o z).mp hz clear hz induction hr with | refl => exact .refl _ | @tail x y hr hxy ih => obtain ⟨⟨e,he,hend⟩,hne⟩ := (SimpleGraph.fromEdgeSet_adj _).mp hxy rcases he with he|he · have hadj : (G.openGraph ω).Adj x y := (SimpleGraph.fromEdgeSet_adj _).mpr ⟨⟨e,he,hend⟩,hne⟩ exact ih.trans hadj.reachable · exact False.elim (hends e he x (by simp [hend]) ih) · exact G.cluster_mono Set.subset_union_left o lemma infiniteVertices_union_finite_error (ω S : Set E) (hS : S.Finite) : (G.infiniteVertices (ω∪S)\G.infiniteVertices ω).Finite := by let K := ⋃ e∈S, ⋃ v∈(G.ends e).toFinset, {x | x∈G.cluster ω v ∧ (G.cluster ω v).Finite} have hK : K.Finite := hS.biUnion fun e _ => (G.ends e).toFinset.finite_toSet.biUnion fun v _ => by by_cases hv : (G.cluster ω v).Finite · exact hv.subset (fun _ h => h.1) · have heq : {x | x∈G.cluster ω v ∧ (G.cluster ω v).Finite}=(∅ : Set V) := by ext x simp [hv] rw [heq] exact Set.finite_empty apply hK.subset intro x hx have hfin : (G.cluster ω x).Finite := Set.not_infinite.mp hx.2 by_contra hn have hends : ∀ e∈S, ∀ v∈G.ends e, v∉G.cluster ω x := by intro e he v hv hvc apply hn refine Set.mem_iUnion₂.mpr ⟨e,he,Set.mem_iUnion₂.mpr ⟨v,?_,hvc.symm,?_⟩⟩ · simpa only [Sym2.mem_toFinset] using hv · rwa [← G.cluster_eq_of_reachable hvc] exact hx.1 (by rwa [G.cluster_union_unchanged ω S x hends]) def directionUnbounded (f : V → ℝ) : Set (Set E) := {ω | ∀ n : ℕ, ∃ v, (n : ℝ) by by_cases hh : e∈S · exact Or.inr hh · exact Or.inl ⟨he,hh⟩ exact (G.directionUnbounded_union_finite_iff f (ω\S) S hS).mp (G.directionUnbounded_mono f hs h) lemma directionUnbounded_measurable [Countable V] [Countable E] (f : V → ℝ) : MeasurableSet (G.directionUnbounded f) := by have heq : G.directionUnbounded f=⋂ n : ℕ, ⋃ v∈{v | (n : ℝ) MeasurableSet.biUnion (Set.to_countable _) fun v _ => G.measurableSet_infiniteEvent v lemma directionUnbounded_zero_one [Countable V] [Countable E] (q : E → unitInterval) (f : V → ℝ) : BernoulliProduct.law q (G.directionUnbounded f)=0 ∨ BernoulliProduct.law q (G.directionUnbounded f)=1 := by apply BernoulliProduct.zero_one_of_finite_erasure_invariant q _ (G.directionUnbounded_measurable f) intro S hS ω have heq : BernoulliProduct.forceOn S ∅ ω=ω\S := by ext e change (if e∈S then False else e∈ω) ↔ e∈ω ∧ e∉S split_ifs <;> tauto rw [heq] exact G.directionUnbounded_diff_finite_iff f ω S hS lemma directionUnbounded_positive [Countable V] [Countable E] (p : unitInterval) (f : V → ℝ) (hf : ∀ n : ℕ, ∃ v, (n : ℝ) ⋃ v∈{v | (n : ℝ) MeasurableSet.biUnion (Set.to_countable _) fun v _ => G.measurableSet_infiniteEvent v have hanti : Antitone A := by intro n m hnm ω hω obtain ⟨v,hv,hh⟩ := Set.mem_iUnion₂.mp hω exact Set.mem_iUnion₂.mpr ⟨v,(show (n : ℝ) (hA n).nullMeasurableSet) hanti ⟨0,measure_ne_top _ _⟩ rw [heq] at ht have hreal := (ENNReal.tendsto_toReal (measure_ne_top _ _)).comp ht have hbound : ∀ n, theta≤(G.law p).real (A n) := by intro n obtain ⟨v,hv⟩ := hf n have hs : G.infiniteEvent v⊆A n := fun ω hω => Set.mem_iUnion₂.mpr ⟨v,hv,hω⟩ exact (hroot v).trans (ENNReal.toReal_mono (measure_ne_top _ _) (measure_mono hs)) have hp : 0<(G.law p).real (G.directionUnbounded f) := htheta.trans_le (ge_of_tendsto hreal (Eventually.of_forall hbound)) exact ENNReal.toReal_pos_iff.mp hp |>.1 theorem directionUnbounded_one [Countable V] [Countable E] (hc : G.fullGraph.Connected) (hl : G.LocallyFinite) (hq : G.QuasiTransitive) (p : unitInterval) (hpositive : 0 p) f rw [BernoulliProduct.law_const] at hz exact hz.resolve_left (ne_of_gt hp) theorem unique_cluster_direction_unbounded_ae [Countable V] [Countable E] (hc : G.fullGraph.Connected) (hl : G.LocallyFinite) (hq : G.QuasiTransitive) (hg : G.SubexponentialGrowth) (p : unitInterval) (hp : (p : ℝ)∈Set.Ioo 0 1) (hpositive : 0