introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
2.19 kB
import Mathlib
import OAI.Probability.CriticalPercolation.ProductMeasure.Density
namespace OAI
section
section
open Set MeasureTheory ProbabilityTheory
open Set
open scoped BigOperators
namespace CriticalPercolation.FiniteProduct
variable {E A : Type*} [Fintype E] [Fintype A]
lemma expect_zero (w : E β†’ A β†’ ℝ) : expect w (fun _ => 0) = 0 := by
simp [expect]
lemma expect_sum {J : Type*} [Fintype J] (w : E β†’ A β†’ ℝ)
(f : J β†’ (E β†’ A) β†’ ℝ) :
expect w (fun Ο‰ => βˆ‘ j, f j Ο‰) = βˆ‘ j, expect w (f j) := by
classical
simp only [expect, Finset.mul_sum]
exact Finset.sum_comm
lemma expect_nonneg {w : E β†’ A β†’ ℝ} (hw : βˆ€ e a, 0 ≀ w e a)
{f : (E β†’ A) β†’ ℝ} (hf : βˆ€ Ο‰, 0 ≀ f Ο‰) : 0 ≀ expect w f := by
rw [← expect_zero w]
exact expect_mono hw hf
noncomputable def distribution {B : Type*} [DecidableEq B]
(w : E β†’ A β†’ ℝ) (Ο† : (E β†’ A) β†’ B) (b : B) : ℝ :=
expect w (fun Ο‰ => if Ο† Ο‰ = b then 1 else 0)
lemma expect_comp {B : Type*} [Fintype B] [DecidableEq B]
(w : E β†’ A β†’ ℝ) (Ο† : (E β†’ A) β†’ B) (f : B β†’ ℝ) :
expect w (fun Ο‰ => f (Ο† Ο‰)) = βˆ‘ b, distribution w Ο† b * f b := by
classical
simp only [distribution, ← expect_mul_const, ← expect_sum]
congr 1
funext Ο‰
simp
lemma distribution_nonneg {B : Type*} [DecidableEq B]
{w : E β†’ A β†’ ℝ} (hw : βˆ€ e a, 0 ≀ w e a)
(Ο† : (E β†’ A) β†’ B) (b : B) : 0 ≀ distribution w Ο† b :=
expect_nonneg hw fun _ => by split_ifs <;> norm_num
lemma distribution_mass {B : Type*} [Fintype B] [DecidableEq B]
(w : E β†’ A β†’ ℝ) (hw : βˆ€ e, βˆ‘ a, w e a = 1)
(Ο† : (E β†’ A) β†’ B) : βˆ‘ b, distribution w Ο† b = 1 := by
simpa only [mul_one] using (expect_comp w Ο† (fun _ => 1)).symm.trans (expect_const w hw 1)
end CriticalPercolation.FiniteProduct
namespace CriticalPercolation.FiniteProduct
variable {E A : Type*} [Fintype E] [Fintype A]
lemma expect_const_mul (w : E β†’ A β†’ ℝ) (c : ℝ) (f : (E β†’ A) β†’ ℝ) :
expect w (fun Ο‰ => c * f Ο‰) = c * expect w f := by
simp only [mul_comm c]
exact expect_mul_const w f c
end CriticalPercolation.FiniteProduct
end
end
end OAI