import Mathlib import OAI.Probability.CriticalPercolation.ProductMeasure.Density namespace OAI section section open Set MeasureTheory ProbabilityTheory open Set open scoped BigOperators namespace CriticalPercolation.FiniteProduct open scoped Classical variable {E : Type*} [Fintype E] lemma density_modular (w : E → Prop → ℝ) (x y : E → Prop) : density w x * density w y = density w (x ⊓ y) * density w (x ⊔ y) := by unfold density rw [← Finset.prod_mul_distrib, ← Finset.prod_mul_distrib] apply Finset.prod_congr rfl intro e _ simp only [Pi.inf_apply, Pi.sup_apply] by_cases hx : x e <;> by_cases hy : y e <;> simp [hx, hy, mul_comm] lemma expect_mul_ge (w : E → Prop → ℝ) (hw : ∀ e, ∑ b, w e b = 1) (hpos : ∀ e b, 0 ≤ w e b) (f g : (E → Prop) → ℝ) (hf0 : ∀ ω, 0 ≤ f ω) (hg0 : ∀ ω, 0 ≤ g ω) (hf : Monotone f) (hg : Monotone g) : expect w f * expect w g ≤ expect w (fun ω => f ω * g ω) := by have h := fkg f g (density w) (fun ω => density_nonneg hpos ω) hf0 hg0 hf hg (fun x y => le_of_eq (density_modular w x y)) simpa only [expect, sum_density w hw, one_mul] using h end CriticalPercolation.FiniteProduct end end end OAI