import Mathlib import OAI.Computability.VertexCover.Games.Stochastic import OAI.Computability.VertexCover.Games.Mixture namespace OAI section section section section section section section section section section section section section section section section section section section section section section section section section section section section section section section namespace UniqueGames.Foundations.Games.FiniteDistribution open scoped BigOperators noncomputable section variable {A B C : Type*} [Fintype A] [Fintype B] [Fintype C] theorem weight_eq_probability_singleton [DecidableEq A] (μ : FiniteDistribution A) (a : A) : μ.weight a = μ.probability (fun x => decide (x = a)) := by classical simp [probability] theorem pushforward_comp (μ : FiniteDistribution A) (f : A → B) (g : B → C) : (μ.pushforward f).pushforward g = μ.pushforward (fun a => g (f a)) := by classical apply eq_of_weight_eq intro «c» rw [weight_eq_probability_singleton, weight_eq_probability_singleton] simp only [probability_pushforward] theorem transport_eq_pushforward (μ : FiniteDistribution A) (e : A ≃ B) : μ.transport e = μ.pushforward e := by classical apply eq_of_weight_eq intro b rw [weight_eq_probability_singleton, weight_eq_probability_singleton, probability_transport, probability_pushforward] theorem expectation_pushforward (μ : FiniteDistribution A) (f : A → B) (h : B → ℝ) : (μ.pushforward f).expectation h = μ.expectation (fun a => h (f a)) := by classical simp only [expectation, pushforward, Finset.sum_mul] rw [Finset.sum_comm] apply Finset.sum_congr rfl intro a _ simp [ite_mul] theorem pushforward_mixture (μ : FiniteDistribution A) (ν : A → FiniteDistribution B) (f : B → C) : (μ.mixture ν).pushforward f = μ.mixture (fun a => (ν a).pushforward f) := by classical apply eq_of_weight_eq intro «c» rw [weight_eq_probability_singleton, weight_eq_probability_singleton] simp only [probability_pushforward, probability_mixture] end end UniqueGames.Foundations.Games.FiniteDistribution end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end OAI