import Mathlib import OAI.Probability.CriticalPercolation.Gluing.PredictionFailure namespace OAI section section noncomputable section open Set Function MeasureTheory ProbabilityTheory open scoped Classical ENNReal BigOperators namespace CriticalPercolation variable {Ω : Type*} [MeasurableSpace Ω] lemma relay_failure_bound (μ : Measure Ω) [IsFiniteMeasure μ] (A : ℕ → Set Ω) (κ : ℝ) (N : ℕ) (h : ∀ i simp | succ N ih => have hsub : A 0\A (N+1) ⊆ (A 0\A N)∪(A N\A (N+1)) := by intro ω hω by_cases hn : ω∈A N · exact Or.inr ⟨hn,hω.2⟩ · exact Or.inl ⟨hω.1,hn⟩ calc _ ≤ μ.real ((A 0\A N)∪(A N\A (N+1))) := measureReal_mono hsub _ ≤ μ.real (A 0\A N)+μ.real (A N\A (N+1)) := measureReal_union_le _ _ _ ≤ N*κ+κ := add_le_add (ih (fun i hi => h i (by omega))) (h N (by omega)) _ = _ := by push_cast; ring lemma relay_miss_bound (μ : Measure Ω) [IsFiniteMeasure μ] (A : ℕ → Set Ω) (κ η : ℝ) (N : ℕ) (hfirst : μ.real (A 0)ᶜ ≤ η) (h : ∀ i