import Mathlib import OAI.Probability.CriticalPercolation.Modular.DensityModular 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 monotone_indicator_upper (A : Set (Set E)) (hA : IsUpperSet A) : Monotone (fun ω : E → Prop => A.indicator (1 : Set E → ℝ) {e | ω e}) := by intro ω ω' h change (if {e | ω e} ∈ A then (1 : ℝ) else 0) ≤ (if {e | ω' e} ∈ A then (1 : ℝ) else 0) split_ifs with ha hb · rfl · exact (hb (hA h ha)).elim · norm_num · rfl lemma real_eq_expect_indicator [Fintype E] (q : E → unitInterval) (A : Set (Set E)) : (law q).real A = FiniteProduct.expect (fun e => bitWeight (q e)) (fun ω : E → Prop => A.indicator (1 : Set E → ℝ) {e | ω e}) := by rw [← integral_law_eq_expect] exact (integral_indicator_one (.of_discrete)).symm lemma finite_harris [Fintype E] (q : E → unitInterval) (A B : Set (Set E)) (hA : IsUpperSet A) (hB : IsUpperSet B) : (law q).real A * (law q).real B ≤ (law q).real (A ∩ B) := by simp_rw [real_eq_expect_indicator] have he : (fun ω : E → Prop => (A ∩ B).indicator (1 : Set E → ℝ) {e | ω e}) = (fun ω => A.indicator (1 : Set E → ℝ) {e | ω e} * B.indicator (1 : Set E → ℝ) {e | ω e}) := by funext ω by_cases ha : {e | ω e} ∈ A <;> by_cases hb : {e | ω e} ∈ B <;> simp [ha, hb] rw [he] exact FiniteProduct.expect_mul_ge _ (fun e => bitWeight_sum (q e)) (fun e b => bitWeight_nonneg (q e) b) _ _ (Set.indicator_nonneg (fun _ _ => zero_le_one)) (Set.indicator_nonneg (fun _ _ => zero_le_one)) (monotone_indicator_upper A hA) (monotone_indicator_upper B hB) lemma real_law_restrict_general (q : E → unitInterval) (s : Set E) (hs : s.Finite) (A : Set (Set E)) : (law q).real {ω | s ∩ ω ∈ A} = (law (fun e : s => q e)).real {ω | Subtype.val '' ω ∈ A} := by let := hs.fintype have hi (ω : Set E) : Subtype.val '' (Subtype.val ⁻¹' ω : Set s) = s ∩ ω := by ext e simp rw [← law_map_restrict q s] have hf : Measurable (fun ω : Set E => (Subtype.val ⁻¹' ω : Set s)) := Measurable.of_eval (fun edge => measurable_set_mem edge.val) simp only [Measure.real] rw [Measure.map_apply hf (.of_discrete)] simp only [Set.preimage_ofPred_eq, hi] lemma finite_restriction_harris (q : E → unitInterval) (s : Set E) (hs : s.Finite) (A B : Set (Set E)) (hA : IsUpperSet A) (hB : IsUpperSet B) : (law q).real {ω | s ∩ ω ∈ A} * (law q).real {ω | s ∩ ω ∈ B} ≤ (law q).real {ω | s ∩ ω ∈ A ∩ B} := by let := hs.fintype simp_rw [real_law_restrict_general _ s hs] exact finite_harris _ _ _ (fun _ _ h => hA (Set.image_mono h)) (fun _ _ h => hB (Set.image_mono h)) lemma HasFiniteOpenWitness.inter {A B : Set (Set E)} (hA : HasFiniteOpenWitness A) (hB : HasFiniteOpenWitness B) (hAm : IsUpperSet A) (hBm : IsUpperSet B) : HasFiniteOpenWitness (A ∩ B) := by rintro ω ⟨hωA, hωB⟩ obtain ⟨s, hs, hsω, hsA⟩ := hA ω hωA obtain ⟨t, ht, htω, htB⟩ := hB ω hωB exact ⟨s ∪ t, hs.union ht, Set.union_subset hsω htω, hAm Set.subset_union_left hsA, hBm Set.subset_union_right htB⟩ lemma tendsto_real_finiteWitness_general (q : E → unitInterval) (A : Set (Set E)) (hmono : IsUpperSet A) (hw : HasFiniteOpenWitness A) (K : Set.FiniteExhaustion (Set.univ : Set E)) : Tendsto (fun n => (law q).real {ω | K n ∩ ω ∈ A}) atTop (𝓝 ((law q).real A)) := by have h := tendsto_measure_iUnion_atTop (μ := law q) (finiteWitness_exhaustion_mono A hmono K) rw [finiteWitness_exhaustion A hmono hw K] at h exact (ENNReal.tendsto_toReal (measure_ne_top _ _)).comp h theorem harris_finiteWitness [Countable E] (q : E → unitInterval) (A B : Set (Set E)) (hA : IsUpperSet A) (hB : IsUpperSet B) (hwA : HasFiniteOpenWitness A) (hwB : HasFiniteOpenWitness B) : (law q).real A * (law q).real B ≤ (law q).real (A ∩ B) := by let K := (Set.to_countable (Set.univ : Set E)).finiteExhaustion exact le_of_tendsto_of_tendsto ((tendsto_real_finiteWitness_general q A hA hwA K).mul (tendsto_real_finiteWitness_general q B hB hwB K)) (tendsto_real_finiteWitness_general q (A ∩ B) (hA.inter hB) (hwA.inter hwB hA hB) K) (Eventually.of_forall fun n => finite_restriction_harris q (K n) (K.finite n) A B hA hB) end CriticalPercolation.BernoulliProduct open Set MeasureTheory ProbabilityTheory Filter open scoped Classical Topology end end end OAI