Buckets:
| import Mathlib | |
| import OAI.Combinatorics.IndependentSets.Repetition.SelectedMarginal | |
| namespace OAI | |
| noncomputable section | |
| namespace IndependentSetsGames.Foundations.Games.FiniteDistribution | |
| section | |
| open scoped BigOperators | |
| variable {Seed Ω : Type*} [Fintype Seed] [Fintype Ω] | |
| def mixture (seedLaw : FiniteDistribution Seed) | |
| (laws : Seed → FiniteDistribution Ω) : FiniteDistribution Ω where | |
| weight x := ∑ seed, seedLaw.weight seed * (laws seed).weight x | |
| nonnegative x := Finset.sum_nonneg fun seed _ => | |
| mul_nonneg (seedLaw.nonnegative seed) ((laws seed).nonnegative x) | |
| normalized := by | |
| rw [Finset.sum_comm] | |
| simp_rw [← Finset.mul_sum, (laws _).normalized, mul_one] | |
| exact seedLaw.normalized | |
| theorem probability_mixture (seedLaw : FiniteDistribution Seed) | |
| (laws : Seed → FiniteDistribution Ω) (event : Ω → Bool) : | |
| (seedLaw.mixture laws).probability event = | |
| ∑ seed, seedLaw.weight seed * (laws seed).probability event := by | |
| unfold probability mixture | |
| calc | |
| _ = ∑ x, ∑ seed, | |
| seedLaw.weight seed * (if event x then (laws seed).weight x else 0) := by | |
| apply Finset.sum_congr rfl | |
| intro x _ | |
| cases event x <;> simp | |
| _ = _ := by | |
| rw [Finset.sum_comm] | |
| apply Finset.sum_congr rfl | |
| intro seed _ | |
| rw [Finset.mul_sum] | |
| theorem probability_mixture_le (seedLaw : FiniteDistribution Seed) | |
| (laws : Seed → FiniteDistribution Ω) (event : Ω → Bool) (bound : ℝ) | |
| (h : ∀ seed, (laws seed).probability event ≤ bound) : | |
| (seedLaw.mixture laws).probability event ≤ bound := by | |
| rw [probability_mixture] | |
| calc | |
| _ ≤ ∑ seed, seedLaw.weight seed * bound := | |
| Finset.sum_le_sum fun seed _ => | |
| mul_le_mul_of_nonneg_left (h seed) (seedLaw.nonnegative seed) | |
| _ = bound := by rw [← Finset.sum_mul, seedLaw.normalized, one_mul] | |
| end | |
| open scoped BigOperators | |
| 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 IndependentSetsGames.Foundations.Games.FiniteDistribution | |
| namespace IndependentSetsGames.Foundations.Repetition | |
| open scoped BigOperators | |
| open Games Information | |
| theorem isProbability_comp_equiv {A B : Type*} [Fintype A] [Fintype B] | |
| (e : A ≃ B) (p : B → ℝ) (hp : IsProbability p) : | |
| IsProbability (fun a => p (e a)) := by | |
| constructor | |
| · intro a | |
| exact hp.1 _ | |
| · rw [e.sum_comp] | |
| exact hp.2 | |
| theorem partialRevealMarginal_isProbability | |
| {I T X Y : Type*} [Fintype I] [DecidableEq I] [Fintype T] | |
| [Fintype X] [Fintype Y] [DecidableEq X] [DecidableEq Y] | |
| (μ : FiniteDistribution (X × Y)) (j : I) | |
| (likelihood : T → (I → X × Y) → ℝ) | |
| (hp : IsProbability (fullRevealMarginal μ j likelihood)) : | |
| IsProbability (partialRevealMarginal μ j likelihood) := by | |
| apply (maskedJoint_isProbability_iff _).mp | |
| have h := isProbability_comp_equiv (revealSplitEquiv (T := T) j).symm _ hp | |
| have he : (fun z => fullRevealMarginal μ j likelihood | |
| ((revealSplitEquiv (T := T) j).symm z)) = | |
| maskedJoint (partialRevealMarginal μ j likelihood) := by | |
| funext z | |
| exact fullRevealMarginal_merge μ j likelihood z.1.1.1 z.1.1.2 z.1.2 z.2 | |
| rw [he] at h | |
| exact h | |
| variable {Q₁ Q₂ A₁ A₂ : Type*} | |
| [Fintype Q₁] [Fintype Q₂] [Fintype A₁] [Fintype A₂] | |
| [DecidableEq Q₁] [DecidableEq Q₂] {n : Nat} | |
| abbrev SelectedCommonData (selected : Finset (Fin n)) | |
| (j : {i : Fin n // i ∉ selected}) := | |
| ((selected → Q₁ × Q₂) × SelectedLabels (A₁ := A₁) (A₂ := A₂) selected) × | |
| ({i : {i : Fin n // i ∉ selected} // i ≠ j} → Q₁ ⊕ Q₂) | |
| theorem selected_fullReveal_isProbability (G : Game Q₁ Q₂ A₁ A₂) | |
| (strategy : Strategy (Fin n → Q₁) (Fin n → Q₂) (Fin n → A₁) (Fin n → A₂)) | |
| (selected : Finset (Fin n)) (positive : 0 < G.selectedSuccess strategy selected) | |
| (j : {i : Fin n // i ∉ selected}) : | |
| IsProbability (fullRevealMarginal G.questions j | |
| (selectedOutsideLikelihood G strategy selected)) := by | |
| have h := isProbability_comp_equiv | |
| (selectedObservationEquiv (Q₁ := Q₁) (Q₂ := Q₂) (A₁ := A₁) (A₂ := A₂) selected).symm | |
| _ (selectedRawMarginal_isProbability G strategy selected positive j) | |
| have he : (fun z => selectedRawMarginal G strategy selected j | |
| ((selectedObservationEquiv (Q₁ := Q₁) (Q₂ := Q₂) (A₁ := A₁) (A₂ := A₂) selected).symm z)) = | |
| fullRevealMarginal G.questions j (selectedOutsideLikelihood G strategy selected) := by | |
| funext z | |
| exact selectedRawMarginal_fullReveal G strategy selected j z | |
| rw [he] at h | |
| exact h | |
| def selectedCommonLaw (G : Game Q₁ Q₂ A₁ A₂) | |
| (strategy : Strategy (Fin n → Q₁) (Fin n → Q₂) (Fin n → A₁) (Fin n → A₂)) | |
| (selected : Finset (Fin n)) (positive : 0 < G.selectedSuccess strategy selected) | |
| (j : {i : Fin n // i ∉ selected}) : | |
| FiniteDistribution (SelectedCommonData (Q₁ := Q₁) (Q₂ := Q₂) | |
| (A₁ := A₁) (A₂ := A₂) selected j × (Q₁ × Q₂)) := | |
| toGameLaw (partialRevealMarginal G.questions j (selectedOutsideLikelihood G strategy selected)) | |
| (partialRevealMarginal_isProbability G.questions j _ | |
| (selected_fullReveal_isProbability G strategy selected positive j)) | |
| end IndependentSetsGames.Foundations.Repetition | |
| end | |
| end OAI | |
Xet Storage Details
- Size:
- 6.79 kB
- Xet hash:
- f5282ee9fad9b87ac095d4607534b94bbdc3cf0c3c62d145de23bb2638a65682
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.