import Mathlib import OAI.Probability.CriticalPercolation.ProductMeasure.FiniteOpenWitness namespace OAI section section open scoped BigOperators open scoped Classical ENNReal open Set open Set MeasureTheory ProbabilityTheory open scoped Classical open Filter Topology open scoped Topology Classical open Set MeasureTheory ProbabilityTheory Filter open scoped Classical Topology namespace CriticalPercolation.BernoulliProduct variable {E : Type*} lemma measurableSet_restrict (s : Set E) (hs : s.Finite) (A : Set (Set E)) : MeasurableSet {ω | s ∩ ω ∈ A} := by let := hs.fintype have hf : Measurable (fun ω : Set E => (Subtype.val ⁻¹' ω : Set s)) := Measurable.of_eval (fun edge => measurable_set_mem edge.val) have he : {ω : Set E | s ∩ ω ∈ A} = (fun ω : Set E => (Subtype.val ⁻¹' ω : Set s)) ⁻¹' {u : Set s | Subtype.val '' u ∈ A} := by ext ω have hi : Subtype.val '' (Subtype.val ⁻¹' ω : Set s) = s ∩ ω := by ext e simp simp only [Set.mem_ofPred_eq, Set.mem_preimage, hi] rw [he] exact hf (.of_discrete) lemma measurableSet_finiteWitness [Countable E] (A : Set (Set E)) (hmono : IsUpperSet A) (hw : HasFiniteOpenWitness A) : MeasurableSet A := by let K := (Set.to_countable (Set.univ : Set E)).finiteExhaustion rw [← finiteWitness_exhaustion A hmono hw K] exact MeasurableSet.iUnion fun n => measurableSet_restrict (K n) (K.finite n) A end CriticalPercolation.BernoulliProduct end end end OAI