import Mathlib import OAI.Probability.CriticalPercolation.Model import OAI.Probability.CriticalPercolation.GraphGeometry.FiniteInduced import OAI.Probability.CriticalPercolation.Gluing.ConditionalGluing import OAI.Probability.CriticalPercolation.Gluing.ContactSelection import OAI.Probability.CriticalPercolation.Gluing.FewContacts import OAI.Probability.CriticalPercolation.Gluing.FreshContactTransfer import OAI.Probability.CriticalPercolation.Gluing.FreshTrial namespace OAI section section noncomputable section open Set Function MeasureTheory ProbabilityTheory open scoped Classical BigOperators ENNReal namespace CriticalPercolation.BondGraph open BernoulliProduct variable {V E : Type*} [Countable V] [Countable E] (G : BondGraph V E) theorem fresh_collar_transfer_from_geometry (hlocal : G.LocallyFinite) (q : E → unitInterval) (π : V → ℤ) (o : V) (Input T : Set V) (J : Finset ℤ) (hJ : J.Nonempty) (ho : ∀ j∈J, j ≤ π o) (hInput : ∀ j∈J, ∀ v∈Input, π v (BernoulliProduct.law q).real (allOpen (F j v))) s₀ K hK (fun v hv => ⟨hs j hj v hv,measureReal_le_one⟩) hN have hh := G.fresh_contact_transfer q (G.inducedEdges {v | j ≤ π v}) (G.inducedEdges {v | j ≤ π v})ᶜ disjoint_compl_right d (F j) (B j) {v | π v=j} T Input o hd (hF j hj) (hconnect j hj) (G.manyContacts π j o k) (G.fewContacts π j o k) (G.measurableSet_manyContacts π j o k) (by intro ω hω have hne := G.levelContacts_nonempty_of_hit π j o (ho j hj) (hcross j hj) ω (G.hitEvent_mono_target o (hInput j hj) hω) by_cases hf : ω∈G.fewContacts π j o k · exact Or.inl hf · exact Or.inr ⟨hne,hf⟩) (by intro ω hω v hv have hmem := (hsel ω hω).1 hv exact ⟨hmem.2,G.levelContacts_reachable π j o ω hmem⟩) K η lam (by linarith) hη hlam (hmean j hj) (by intro ω hω v hv w hw hvw exact hdis j hj v w ((hsel ω hω).2.1 hv hw hvw)) (fun ω hω => (hsel ω hω).2.2.1) (fun ω hω => (hsel ω hω).2.2.2) linarith end CriticalPercolation.BondGraph end end end end OAI