Download data/lean/OAI/Computability/UniqueGames/Games/SelectedCommonMarginalLemmas.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 45.9 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Computability/UniqueGames/Games/SelectedCommonMarginalLemmas.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Computability/UniqueGames/Games/SelectedCommonMarginalLemmas.lean
-
curl -L -o SelectedCommonMarginalLemmas.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Computability/UniqueGames/Games/SelectedCommonMarginalLemmas.lean
45.9 kB
| import OAI.Computability.UniqueGames.Foundations.SamplingLemmas | |
| import OAI.Computability.UniqueGames.Foundations.SharedProfiles | |
| import OAI.Computability.UniqueGames.Foundations.ValueLemmas | |
| import OAI.Computability.UniqueGames.Games.FactorizationLemmas | |
| import OAI.Computability.UniqueGames.Games.Overlap | |
| import OAI.Computability.UniqueGames.Games.PartialRevealLemmas | |
| import OAI.Computability.UniqueGames.Games.SelectedInformationLemmas | |
| namespace OAI | |
| section | |
| /-! The common-data law has exactly the actual selected-event question marginal. | |
| Removing the fair endpoint reveal and regrouping the outside data preserve | |
| the embedded question pair. -/ | |
| namespace UniqueGamesTheorem.Foundations.Repetition | |
| open scoped BigOperators | |
| open Games Information | |
| noncomputable section | |
| theorem pushforward_snd_weight_eq_secondMarginal {A B : Type*} | |
| [Fintype A] [Fintype B] (ΞΌ : FiniteDistribution (A Γ B)) : | |
| (ΞΌ.pushforward Prod.snd).weight = secondMarginal ΞΌ.weight := by | |
| classical | |
| funext b | |
| simp [FiniteDistribution.pushforward, secondMarginal, Fintype.sum_prod_type] | |
| variable {I T X Y : Type*} [Fintype I] [DecidableEq I] [Fintype T] | |
| [Fintype X] [Fintype Y] [DecidableEq X] [DecidableEq Y] | |
| def revealDataSplitEquiv (j : I) : | |
| (T Γ (I β X β Y)) β ((T Γ ({i : I // i β j} β X β Y)) Γ (X β Y)) where | |
| toFun z := ((z.1, fun i => z.2 i.1), z.2 j) | |
| invFun z := (z.1.1, mergeAt j z.2 z.1.2) | |
| left_inv z := by | |
| apply Prod.ext | |
| Β· rfl | |
| Β· funext i | |
| by_cases h : i = j <;> simp [mergeAt, h] | |
| right_inv z := by | |
| apply Prod.ext | |
| Β· apply Prod.ext | |
| Β· rfl | |
| Β· funext i | |
| exact mergeAt_other j z.2 z.1.2 i | |
| Β· exact mergeAt_self j z.2 z.1.2 | |
| theorem partialRevealMarginal_secondMarginal | |
| (ΞΌ : FiniteDistribution (X Γ Y)) (j : I) | |
| (likelihood : T β (I β X Γ Y) β β) : | |
| secondMarginal (partialRevealMarginal ΞΌ j likelihood) = | |
| secondMarginal (fullRevealMarginal ΞΌ j likelihood) := by | |
| classical | |
| funext q | |
| calc | |
| _ = β z : (T Γ ({i : I // i β j} β X β Y)) Γ (X β Y), | |
| maskedJoint (partialRevealMarginal ΞΌ j likelihood) (z,q) := by | |
| simp [secondMarginal, Fintype.sum_prod_type, maskedJoint] | |
| _ = _ := by | |
| apply Fintype.sum_equiv (revealDataSplitEquiv (T := T) j).symm | |
| intro z | |
| exact (fullRevealMarginal_merge ΞΌ j likelihood z.1.1 z.1.2 z.2 q).symm | |
| variable {Qβ Qβ Aβ Aβ : Type*} | |
| [Fintype Qβ] [Fintype Qβ] [Fintype Aβ] [Fintype Aβ] | |
| [DecidableEq Qβ] [DecidableEq Qβ] {n : Nat} | |
| def selectedObservationDataEquiv (selected : Finset (Fin n)) : | |
| (SelectedInput Qβ Qβ selected Γ SelectedLabels (Aβ := Aβ) (Aβ := Aβ) selected) β | |
| (((selected β Qβ Γ Qβ) Γ SelectedLabels (Aβ := Aβ) (Aβ := Aβ) selected) Γ | |
| ({i : Fin n // i β selected} β Qβ β Qβ)) where | |
| toFun z := ((z.1.1,z.2),z.1.2) | |
| invFun z := ((z.1.1,z.2),z.1.2) | |
| left_inv _ := rfl | |
| right_inv _ := rfl | |
| theorem selectedFullReveal_secondMarginal (G : Game Qβ Qβ Aβ Aβ) | |
| (strategy : Strategy (Fin n β Qβ) (Fin n β Qβ) (Fin n β Aβ) (Fin n β Aβ)) | |
| (selected : Finset (Fin n)) (j : {i : Fin n // i β selected}) : | |
| secondMarginal (fullRevealMarginal G.questions j | |
| (selectedOutsideLikelihood G strategy selected)) = | |
| secondMarginal (selectedRawMarginal G strategy selected j) := by | |
| classical | |
| funext q | |
| apply Fintype.sum_equiv | |
| (selectedObservationDataEquiv (Qβ := Qβ) (Qβ := Qβ) | |
| (Aβ := Aβ) (Aβ := Aβ) selected).symm | |
| intro z | |
| exact (selectedRawMarginal_fullReveal G strategy selected j (z,q)).symm | |
| theorem selectedRawMarginal_secondMarginal (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}) : | |
| secondMarginal (selectedRawMarginal G strategy selected j) = | |
| (selectedQuestionMarginal G strategy selected positive j.1).weight := by | |
| classical | |
| funext q | |
| calc | |
| _ = (selectedJointLaw G strategy selected positive).probability | |
| (fun z => decide (z.2 j = q)) := by | |
| simp only [secondMarginal, selectedRawMarginal, FiniteDistribution.probability, | |
| selectedJointLaw, toGameLaw, Fintype.sum_prod_type, decide_eq_true_eq] | |
| _ = ((G.repetition n).questions.condition (G.selectedWins strategy selected) positive).probability | |
| (fun questions => decide ((questions.1 j.1,questions.2 j.1) = q)) := by | |
| have h := selectedJointLaw_question_probability G strategy selected positive | |
| (fun questions => decide ((questions.1 j.1,questions.2 j.1) = q)) | |
| simpa [selectedQuestionTuple, mergeCoordinates, j.property] using h | |
| _ = _ := by | |
| rw [FiniteDistribution.weight_eq_probability_singleton, selectedQuestionMarginal, | |
| FiniteDistribution.probability_pushforward] | |
| /-- The exact marginal identification needed to use the conditioned-question | |
| information bound in the two local common-data profile errors. -/ | |
| theorem selectedCommonLaw_secondMarginal (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}) : | |
| secondMarginal (selectedCommonLaw G strategy selected positive j).weight = | |
| (selectedQuestionMarginal G strategy selected positive j.1).weight := by | |
| change secondMarginal (partialRevealMarginal G.questions j | |
| (selectedOutsideLikelihood G strategy selected)) = _ | |
| rw [partialRevealMarginal_secondMarginal, selectedFullReveal_secondMarginal] | |
| exact selectedRawMarginal_secondMarginal G strategy selected positive j | |
| theorem selectedCommonLaw_questions_pushforward (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}) : | |
| (selectedCommonLaw G strategy selected positive j).pushforward Prod.snd = | |
| selectedQuestionMarginal G strategy selected positive j.1 := by | |
| classical | |
| apply FiniteDistribution.eq_of_weight_eq | |
| intro q | |
| exact (congrFun (pushforward_snd_weight_eq_secondMarginal | |
| (selectedCommonLaw G strategy selected positive j)) q).trans | |
| (congrFun (selectedCommonLaw_secondMarginal G strategy selected positive j) q) | |
| end | |
| end UniqueGamesTheorem.Foundations.Repetition | |
| end | |
| section | |
| /-! | |
| Actual local completions of the unused questions, conditioned on common data | |
| and the player's own embedded question. The raw row factors are explicit | |
| finite weights. Their normalization reconstructs the actual selected common | |
| law, including zero rows. The fallback independently samples base marginal | |
| questions and then inserts the local input at the embedded coordinate. | |
| -/ | |
| namespace UniqueGamesTheorem.Foundations.Repetition | |
| open scoped BigOperators | |
| open Games | |
| noncomputable section | |
| section LocalNormalization | |
| variable {I X Y : Type*} [Fintype I] [DecidableEq I] | |
| [Fintype X] [Fintype Y] | |
| def completionTupleEquiv : (I β X Γ Y) β ((I β X) Γ (I β Y)) where | |
| toFun u := (fun i => (u i).1, fun i => (u i).2) | |
| invFun z := fun i => (z.1 i, z.2 i) | |
| left_inv u := by funext i; rfl | |
| right_inv z := by cases z; rfl | |
| def updatedTableFallback (ΞΌ : FiniteDistribution X) (j : I) (x : X) : | |
| FiniteDistribution (I β X) := | |
| (FiniteDistribution.table (fun _ : I => ΞΌ)).pushforward | |
| (fun l => Function.update l j x) | |
| theorem updatedTableFallback_zero (ΞΌ : FiniteDistribution X) (j : I) (x : X) | |
| (l : I β X) (hne : l j β x) : | |
| (updatedTableFallback ΞΌ j x).weight l = 0 := by | |
| classical | |
| simp only [updatedTableFallback, FiniteDistribution.pushforward] | |
| apply Finset.sum_eq_zero | |
| intro t _ | |
| apply ite_eq_right | |
| intro h | |
| have he := congrFun h j | |
| exact hne (by simpa only [Function.update_self] using he.symm) | |
| theorem normalizeOr_weight_eq_zero_of_zero | |
| (w : X β β) (hw : β x, 0 β€ w x) (fallback : FiniteDistribution X) | |
| (x : X) (hraw : w x = 0) (hdefault : fallback.weight x = 0) : | |
| (normalizeOr w hw fallback).weight x = 0 := by | |
| classical | |
| unfold normalizeOr | |
| split | |
| Β· change normalizedWeight w x = 0 | |
| simp only [normalizedWeight, hraw, zero_div] | |
| Β· exact hdefault | |
| end LocalNormalization | |
| variable {Qβ Qβ Aβ Aβ : Type*} | |
| [Fintype Qβ] [Fintype Qβ] [Fintype Aβ] [Fintype Aβ] | |
| [DecidableEq Qβ] [DecidableEq Qβ] {n : Nat} | |
| def selectedLeftRaw (G : Game Qβ Qβ Aβ Aβ) | |
| (strategy : Strategy (Fin n β Qβ) (Fin n β Qβ) (Fin n β Aβ) (Fin n β Aβ)) | |
| (selected : Finset (Fin n)) (j : {i : Fin n // i β selected}) | |
| (s : SelectedCommonData (Qβ := Qβ) (Qβ := Qβ) (Aβ := Aβ) (Aβ := Aβ) selected j) | |
| (x : Qβ) (l : {i : Fin n // i β selected} β Qβ) : β := | |
| (if l j = x then 1 else 0) * partialLeftFactor G.questions j s.2 l * | |
| selectedLocalTest strategy.1 selected (fun i => (s.1.1 i).1) s.1.2.1 l | |
| def selectedRightRaw (G : Game Qβ Qβ Aβ Aβ) | |
| (strategy : Strategy (Fin n β Qβ) (Fin n β Qβ) (Fin n β Aβ) (Fin n β Aβ)) | |
| (selected : Finset (Fin n)) (j : {i : Fin n // i β selected}) | |
| (s : SelectedCommonData (Qβ := Qβ) (Qβ := Qβ) (Aβ := Aβ) (Aβ := Aβ) selected j) | |
| (y : Qβ) (r : {i : Fin n // i β selected} β Qβ) : β := | |
| (if r j = y then 1 else 0) * partialRightFactor G.questions j s.2 r * | |
| selectedLocalTest strategy.2 selected (fun i => (s.1.1 i).2) s.1.2.2 r | |
| omit [DecidableEq Qβ] in | |
| theorem selectedLeftRaw_nonnegative (G : Game Qβ Qβ Aβ Aβ) | |
| (strategy : Strategy (Fin n β Qβ) (Fin n β Qβ) (Fin n β Aβ) (Fin n β Aβ)) | |
| (selected : Finset (Fin n)) (j : {i : Fin n // i β selected}) | |
| (s : SelectedCommonData (Qβ := Qβ) (Qβ := Qβ) (Aβ := Aβ) (Aβ := Aβ) selected j) | |
| (x : Qβ) (l : {i : Fin n // i β selected} β Qβ) : | |
| 0 β€ selectedLeftRaw G strategy selected j s x l := by | |
| apply mul_nonneg | |
| Β· apply mul_nonneg | |
| Β· split <;> norm_num | |
| Β· exact Finset.prod_nonneg (fun i _ => revealLeftFactor_nonnegative G.questions (s.2 i) (l i.1)) | |
| Β· exact selectedLocalTest_nonnegative _ _ _ _ _ | |
| omit [DecidableEq Qβ] in | |
| theorem selectedRightRaw_nonnegative (G : Game Qβ Qβ Aβ Aβ) | |
| (strategy : Strategy (Fin n β Qβ) (Fin n β Qβ) (Fin n β Aβ) (Fin n β Aβ)) | |
| (selected : Finset (Fin n)) (j : {i : Fin n // i β selected}) | |
| (s : SelectedCommonData (Qβ := Qβ) (Qβ := Qβ) (Aβ := Aβ) (Aβ := Aβ) selected j) | |
| (y : Qβ) (r : {i : Fin n // i β selected} β Qβ) : | |
| 0 β€ selectedRightRaw G strategy selected j s y r := by | |
| apply mul_nonneg | |
| Β· apply mul_nonneg | |
| Β· split <;> norm_num | |
| Β· exact Finset.prod_nonneg (fun i _ => revealRightFactor_nonnegative G.questions (s.2 i) (r i.1)) | |
| Β· exact selectedLocalTest_nonnegative _ _ _ _ _ | |
| def selectedLeftCompletion (G : Game Qβ Qβ Aβ Aβ) | |
| (strategy : Strategy (Fin n β Qβ) (Fin n β Qβ) (Fin n β Aβ) (Fin n β Aβ)) | |
| (selected : Finset (Fin n)) (j : {i : Fin n // i β selected}) | |
| (s : SelectedCommonData (Qβ := Qβ) (Qβ := Qβ) (Aβ := Aβ) (Aβ := Aβ) selected j) | |
| (x : Qβ) : FiniteDistribution ({i : Fin n // i β selected} β Qβ) := | |
| normalizeOr (selectedLeftRaw G strategy selected j s x) | |
| (selectedLeftRaw_nonnegative G strategy selected j s x) | |
| (updatedTableFallback (G.questions.pushforward Prod.fst) j x) | |
| def selectedRightCompletion (G : Game Qβ Qβ Aβ Aβ) | |
| (strategy : Strategy (Fin n β Qβ) (Fin n β Qβ) (Fin n β Aβ) (Fin n β Aβ)) | |
| (selected : Finset (Fin n)) (j : {i : Fin n // i β selected}) | |
| (s : SelectedCommonData (Qβ := Qβ) (Qβ := Qβ) (Aβ := Aβ) (Aβ := Aβ) selected j) | |
| (y : Qβ) : FiniteDistribution ({i : Fin n // i β selected} β Qβ) := | |
| normalizeOr (selectedRightRaw G strategy selected j s y) | |
| (selectedRightRaw_nonnegative G strategy selected j s y) | |
| (updatedTableFallback (G.questions.pushforward Prod.snd) j y) | |
| omit [DecidableEq Qβ] in | |
| theorem selectedLeftCompletion_zero (G : Game Qβ Qβ Aβ Aβ) | |
| (strategy : Strategy (Fin n β Qβ) (Fin n β Qβ) (Fin n β Aβ) (Fin n β Aβ)) | |
| (selected : Finset (Fin n)) (j : {i : Fin n // i β selected}) | |
| (s : SelectedCommonData (Qβ := Qβ) (Qβ := Qβ) (Aβ := Aβ) (Aβ := Aβ) selected j) | |
| (x : Qβ) (l : {i : Fin n // i β selected} β Qβ) (hne : l j β x) : | |
| (selectedLeftCompletion G strategy selected j s x).weight l = 0 := by | |
| apply normalizeOr_weight_eq_zero_of_zero | |
| Β· simp only [selectedLeftRaw, ite_eq_right hne, zero_mul] | |
| Β· exact updatedTableFallback_zero _ j x l hne | |
| omit [DecidableEq Qβ] in | |
| theorem selectedRightCompletion_zero (G : Game Qβ Qβ Aβ Aβ) | |
| (strategy : Strategy (Fin n β Qβ) (Fin n β Qβ) (Fin n β Aβ) (Fin n β Aβ)) | |
| (selected : Finset (Fin n)) (j : {i : Fin n // i β selected}) | |
| (s : SelectedCommonData (Qβ := Qβ) (Qβ := Qβ) (Aβ := Aβ) (Aβ := Aβ) selected j) | |
| (y : Qβ) (r : {i : Fin n // i β selected} β Qβ) (hne : r j β y) : | |
| (selectedRightCompletion G strategy selected j s y).weight r = 0 := by | |
| apply normalizeOr_weight_eq_zero_of_zero | |
| Β· simp only [selectedRightRaw, ite_eq_right hne, zero_mul] | |
| Β· exact updatedTableFallback_zero _ j y r hne | |
| omit [DecidableEq Qβ] in | |
| theorem selectedLeftCompletion_support (G : Game Qβ Qβ Aβ Aβ) | |
| (strategy : Strategy (Fin n β Qβ) (Fin n β Qβ) (Fin n β Aβ) (Fin n β Aβ)) | |
| (selected : Finset (Fin n)) (j : {i : Fin n // i β selected}) | |
| (s : SelectedCommonData (Qβ := Qβ) (Qβ := Qβ) (Aβ := Aβ) (Aβ := Aβ) selected j) | |
| (x : Qβ) (l : {i : Fin n // i β selected} β Qβ) | |
| (h : (selectedLeftCompletion G strategy selected j s x).weight l β 0) : l j = x := by | |
| by_contra hne | |
| exact h (selectedLeftCompletion_zero G strategy selected j s x l hne) | |
| omit [DecidableEq Qβ] in | |
| theorem selectedRightCompletion_support (G : Game Qβ Qβ Aβ Aβ) | |
| (strategy : Strategy (Fin n β Qβ) (Fin n β Qβ) (Fin n β Aβ) (Fin n β Aβ)) | |
| (selected : Finset (Fin n)) (j : {i : Fin n // i β selected}) | |
| (s : SelectedCommonData (Qβ := Qβ) (Qβ := Qβ) (Aβ := Aβ) (Aβ := Aβ) selected j) | |
| (y : Qβ) (r : {i : Fin n // i β selected} β Qβ) | |
| (h : (selectedRightCompletion G strategy selected j s y).weight r β 0) : r j = y := by | |
| by_contra hne | |
| exact h (selectedRightCompletion_zero G strategy selected j s y r hne) | |
| def selectedCompletionScale (G : Game Qβ Qβ Aβ Aβ) | |
| (strategy : Strategy (Fin n β Qβ) (Fin n β Qβ) (Fin n β Aβ) (Fin n β Aβ)) | |
| (selected : Finset (Fin n)) (j : {i : Fin n // i β selected}) | |
| (s : SelectedCommonData (Qβ := Qβ) (Qβ := Qβ) (Aβ := Aβ) (Aβ := Aβ) selected j) | |
| (xy : Qβ Γ Qβ) : β := | |
| G.questions.weight xy * (β i : selected, G.questions.weight (s.1.1 i)) * | |
| (if selectedLabelAccepts G selected s.1.1 s.1.2 then 1 else 0) / | |
| G.selectedSuccess strategy selected | |
| /-- Pointwise factorization of the actual selected common-data row. -/ | |
| theorem selected_completion_factorization (G : Game Qβ Qβ Aβ Aβ) | |
| (strategy : Strategy (Fin n β Qβ) (Fin n β Qβ) (Fin n β Aβ) (Fin n β Aβ)) | |
| (selected : Finset (Fin n)) (j : {i : Fin n // i β selected}) | |
| (s : SelectedCommonData (Qβ := Qβ) (Qβ := Qβ) (Aβ := Aβ) (Aβ := Aβ) selected j) | |
| (xy : Qβ Γ Qβ) | |
| (l : {i : Fin n // i β selected} β Qβ) | |
| (r : {i : Fin n // i β selected} β Qβ) : | |
| selectedCompletionScale G strategy selected j s xy * | |
| selectedLeftRaw G strategy selected j s xy.1 l * | |
| selectedRightRaw G strategy selected j s xy.2 r = | |
| if (l j, r j) = xy then | |
| partialRevealWeight G.questions j s.2 (fun i => (l i,r i)) * | |
| selectedOutsideLikelihood G strategy selected s.1 (fun i => (l i,r i)) | |
| else 0 := by | |
| rcases xy with β¨x,yβ© | |
| by_cases hl : l j = x <;> by_cases hr : r j = y | |
| Β· rw [ite_eq_left (Prod.ext hl hr), partialRevealWeight_factorization] | |
| cases hacc : selectedLabelAccepts G selected s.1.1 s.1.2 <;> | |
| simp [selectedOutsideLikelihood, selectedLikelihood_factorization, | |
| selectedCompletionScale, selectedLeftRaw, selectedRightRaw, hl, hr, hacc] | |
| ring | |
| Β· simp [selectedLeftRaw, selectedRightRaw, hl, hr, Prod.mk.injEq] | |
| Β· simp [selectedLeftRaw, selectedRightRaw, hl, hr, Prod.mk.injEq] | |
| Β· simp [selectedLeftRaw, selectedRightRaw, hl, hr, Prod.mk.injEq] | |
| theorem selectedCommonLaw_completion_row_mass (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}) | |
| (s : SelectedCommonData (Qβ := Qβ) (Qβ := Qβ) (Aβ := Aβ) (Aβ := Aβ) selected j) | |
| (xy : Qβ Γ Qβ) : | |
| (selectedCommonLaw G strategy selected positive j).weight (s,xy) = | |
| β lr : ({i : Fin n // i β selected} β Qβ) Γ | |
| ({i : Fin n // i β selected} β Qβ), | |
| selectedCompletionScale G strategy selected j s xy * | |
| selectedLeftRaw G strategy selected j s xy.1 lr.1 * | |
| selectedRightRaw G strategy selected j s xy.2 lr.2 := by | |
| classical | |
| change (β u, if u j = xy then partialRevealWeight G.questions j s.2 u * | |
| selectedOutsideLikelihood G strategy selected s.1 u else 0) = _ | |
| rw [β (completionTupleEquiv (I := {i : Fin n // i β selected}) | |
| (X := Qβ) (Y := Qβ)).sum_comp] | |
| apply Finset.sum_congr rfl | |
| intro u _ | |
| exact (selected_completion_factorization G strategy selected j s xy | |
| (fun i => (u i).1) (fun i => (u i).2)).symm | |
| /-- Actual common-row mass times the two local completion probabilities is | |
| the selected partial-reveal weight with its actual coordinate indicator. -/ | |
| theorem selected_completion_row_recombine (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}) | |
| (s : SelectedCommonData (Qβ := Qβ) (Qβ := Qβ) (Aβ := Aβ) (Aβ := Aβ) selected j) | |
| (xy : Qβ Γ Qβ) | |
| (l : {i : Fin n // i β selected} β Qβ) | |
| (r : {i : Fin n // i β selected} β Qβ) : | |
| (selectedCommonLaw G strategy selected positive j).weight (s,xy) * | |
| ((selectedLeftCompletion G strategy selected j s xy.1).product | |
| (selectedRightCompletion G strategy selected j s xy.2)).weight (l,r) = | |
| if (l j,r j) = xy then | |
| partialRevealWeight G.questions j s.2 (fun i => (l i,r i)) * | |
| selectedOutsideLikelihood G strategy selected s.1 (fun i => (l i,r i)) | |
| else 0 := by | |
| rw [selectedCommonLaw_completion_row_mass] | |
| calc | |
| _ = selectedCompletionScale G strategy selected j s xy * | |
| selectedLeftRaw G strategy selected j s xy.1 l * | |
| selectedRightRaw G strategy selected j s xy.2 r := | |
| factorized_completion_row | |
| (selectedLeftRaw G strategy selected j s xy.1) | |
| (selectedRightRaw G strategy selected j s xy.2) | |
| (selectedLeftRaw_nonnegative G strategy selected j s xy.1) | |
| (selectedRightRaw_nonnegative G strategy selected j s xy.2) | |
| (updatedTableFallback (G.questions.pushforward Prod.fst) j xy.1) | |
| (updatedTableFallback (G.questions.pushforward Prod.snd) j xy.2) | |
| (selectedCompletionScale G strategy selected j s xy) (l,r) | |
| _ = _ := selected_completion_factorization G strategy selected j s xy l r | |
| end | |
| end UniqueGamesTheorem.Foundations.Repetition | |
| end | |
| section | |
| /-! The actual local completion mixture reproduces the repeated question law | |
| conditioned on the selected wins. All hidden coordinates and reveal variables | |
| are explicitly summed out. -/ | |
| namespace UniqueGamesTheorem.Foundations.Repetition | |
| open scoped BigOperators | |
| open Games | |
| noncomputable section | |
| theorem partialRevealWeight_forget | |
| {I X Y : Type*} [Fintype I] [DecidableEq I] | |
| [Fintype X] [Fintype Y] [DecidableEq X] [DecidableEq Y] | |
| (ΞΌ : FiniteDistribution (X Γ Y)) (j : I) (u : I β X Γ Y) : | |
| (β rest : {i : I // i β j} β X β Y, partialRevealWeight ΞΌ j rest u) = | |
| β i, ΞΌ.weight (u i) := by | |
| have h := reveal_product_forget ΞΌ (fun i : {i : I // i β j} => u i.1) | |
| simp_rw [reveal_product_factorization] at h | |
| simp only [partialRevealWeight, β Finset.mul_sum] | |
| rw [h] | |
| exact (Fintype.prod_eq_mul_prod_subtype_ne (fun i => ΞΌ.weight (u i)) j).symm | |
| theorem partialReveal_event_forget | |
| {I X Y : Type*} [Fintype I] [DecidableEq I] | |
| [Fintype X] [Fintype Y] [DecidableEq X] [DecidableEq Y] | |
| (ΞΌ : FiniteDistribution (X Γ Y)) (j : I) (f : (I β X Γ Y) β β) : | |
| (β rest : {i : I // i β j} β X β Y, | |
| β u : I β X Γ Y, partialRevealWeight ΞΌ j rest u * f u) = | |
| β u, (β i, ΞΌ.weight (u i)) * f u := by | |
| rw [Finset.sum_comm] | |
| apply Finset.sum_congr rfl | |
| intro u _ | |
| rw [β Finset.sum_mul, partialRevealWeight_forget] | |
| variable {Qβ Qβ Aβ Aβ : Type*} | |
| [Fintype Qβ] [Fintype Qβ] [Fintype Aβ] [Fintype Aβ] | |
| [DecidableEq Qβ] [DecidableEq Qβ] {n : Nat} | |
| omit [DecidableEq Qβ] [DecidableEq Qβ] in | |
| theorem selectedOutsideLikelihood_event_sum (G : Game Qβ Qβ Aβ Aβ) | |
| (strategy : Strategy (Fin n β Qβ) (Fin n β Qβ) (Fin n β Aβ) (Fin n β Aβ)) | |
| (selected : Finset (Fin n)) | |
| (event : ((Fin n β Qβ) Γ (Fin n β Qβ)) β Bool) : | |
| (β t : (selected β Qβ Γ Qβ) Γ SelectedLabels (Aβ := Aβ) (Aβ := Aβ) selected, | |
| β u : {i : Fin n // i β selected} β Qβ Γ Qβ, | |
| (β i, G.questions.weight (u i)) * selectedOutsideLikelihood G strategy selected t u * | |
| (if event (selectedQuestionTuple selected t.1 u) then 1 else 0)) = | |
| (G.repetition n).questions.probability | |
| (fun q => G.selectedWins strategy selected q && event q) / | |
| G.selectedSuccess strategy selected := by | |
| classical | |
| have hlabel (fixed : selected β Qβ Γ Qβ) | |
| (u : {i : Fin n // i β selected} β Qβ Γ Qβ) : | |
| (β label : SelectedLabels (Aβ := Aβ) (Aβ := Aβ) selected, | |
| (β i, G.questions.weight (u i)) * | |
| selectedOutsideLikelihood G strategy selected (fixed,label) u * | |
| (if event (selectedQuestionTuple selected fixed u) then 1 else 0)) = | |
| ((β i : selected, G.questions.weight (fixed i)) * (β i, G.questions.weight (u i)) * | |
| (if G.selectedWins strategy selected (selectedQuestionTuple selected fixed u) && | |
| event (selectedQuestionTuple selected fixed u) then 1 else 0)) / | |
| G.selectedSuccess strategy selected := by | |
| calc | |
| _ = (β i, G.questions.weight (u i)) * | |
| (β i : selected, G.questions.weight (fixed i)) * | |
| (β label, selectedLikelihood G strategy selected fixed label u) * | |
| (if event (selectedQuestionTuple selected fixed u) then 1 else 0) / | |
| G.selectedSuccess strategy selected := by | |
| simp only [selectedOutsideLikelihood, div_eq_mul_inv, Finset.mul_sum, Finset.sum_mul] | |
| apply Finset.sum_congr rfl | |
| intro label _ | |
| ring | |
| _ = _ := by | |
| rw [selectedLikelihood_sum] | |
| cases hw : G.selectedWins strategy selected (selectedQuestionTuple selected fixed u) <;> | |
| cases he : event (selectedQuestionTuple selected fixed u) <;> simp | |
| ring | |
| calc | |
| _ = β fixed : selected β Qβ Γ Qβ, | |
| β u : {i : Fin n // i β selected} β Qβ Γ Qβ, | |
| β label : SelectedLabels (Aβ := Aβ) (Aβ := Aβ) selected, | |
| (β i, G.questions.weight (u i)) * | |
| selectedOutsideLikelihood G strategy selected (fixed,label) u * | |
| (if event (selectedQuestionTuple selected fixed u) then 1 else 0) := by | |
| rw [Fintype.sum_prod_type] | |
| apply Finset.sum_congr rfl | |
| intro fixed _ | |
| rw [Finset.sum_comm] | |
| _ = (β fixed : selected β Qβ Γ Qβ, | |
| β u : {i : Fin n // i β selected} β Qβ Γ Qβ, | |
| (β i : selected, G.questions.weight (fixed i)) * (β i, G.questions.weight (u i)) * | |
| (if G.selectedWins strategy selected (selectedQuestionTuple selected fixed u) && | |
| event (selectedQuestionTuple selected fixed u) then 1 else 0)) / | |
| G.selectedSuccess strategy selected := by | |
| simp_rw [hlabel] | |
| simp only [div_eq_mul_inv, Finset.sum_mul] | |
| _ = _ := by | |
| congr 1 | |
| have h := selectedSplit_question_probability G selected | |
| (fun q => G.selectedWins strategy selected q && event q) | |
| simpa [selectedSplitLaw, FiniteDistribution.probability, FiniteDistribution.product, | |
| FiniteDistribution.table, Fintype.sum_prod_type, mul_ite] using h | |
| theorem selected_partial_event_total (G : Game Qβ Qβ Aβ Aβ) | |
| (strategy : Strategy (Fin n β Qβ) (Fin n β Qβ) (Fin n β Aβ) (Fin n β Aβ)) | |
| (selected : Finset (Fin n)) (j : {i : Fin n // i β selected}) | |
| (event : ((Fin n β Qβ) Γ (Fin n β Qβ)) β Bool) : | |
| (β s : SelectedCommonData (Qβ := Qβ) (Qβ := Qβ) (Aβ := Aβ) (Aβ := Aβ) selected j, | |
| β u : {i : Fin n // i β selected} β Qβ Γ Qβ, | |
| partialRevealWeight G.questions j s.2 u * | |
| selectedOutsideLikelihood G strategy selected s.1 u * | |
| (if event (selectedQuestionTuple selected s.1.1 u) then 1 else 0)) = | |
| (G.repetition n).questions.probability | |
| (fun q => G.selectedWins strategy selected q && event q) / | |
| G.selectedSuccess strategy selected := by | |
| have hrest (t : (selected β Qβ Γ Qβ) Γ SelectedLabels (Aβ := Aβ) (Aβ := Aβ) selected) := | |
| partialReveal_event_forget G.questions j | |
| (fun u => selectedOutsideLikelihood G strategy selected t u * | |
| (if event (selectedQuestionTuple selected t.1 u) then 1 else 0)) | |
| simp only [β mul_assoc] at hrest | |
| rw [Fintype.sum_prod_type] | |
| simp_rw [hrest] | |
| exact selectedOutsideLikelihood_event_sum G strategy selected event | |
| def selectedFullLeftCompletion (G : Game Qβ Qβ Aβ Aβ) | |
| (strategy : Strategy (Fin n β Qβ) (Fin n β Qβ) (Fin n β Aβ) (Fin n β Aβ)) | |
| (selected : Finset (Fin n)) (j : {i : Fin n // i β selected}) | |
| (q : Qβ Γ SelectedCommonData (Qβ := Qβ) (Qβ := Qβ) (Aβ := Aβ) (Aβ := Aβ) selected j) : | |
| FiniteDistribution (Fin n β Qβ) := | |
| (selectedLeftCompletion G strategy selected j q.2 q.1).pushforward | |
| (mergeCoordinates selected (fun i => (q.2.1.1 i).1)) | |
| def selectedFullRightCompletion (G : Game Qβ Qβ Aβ Aβ) | |
| (strategy : Strategy (Fin n β Qβ) (Fin n β Qβ) (Fin n β Aβ) (Fin n β Aβ)) | |
| (selected : Finset (Fin n)) (j : {i : Fin n // i β selected}) | |
| (q : Qβ Γ SelectedCommonData (Qβ := Qβ) (Qβ := Qβ) (Aβ := Aβ) (Aβ := Aβ) selected j) : | |
| FiniteDistribution (Fin n β Qβ) := | |
| (selectedRightCompletion G strategy selected j q.2 q.1).pushforward | |
| (mergeCoordinates selected (fun i => (q.2.1.1 i).2)) | |
| omit [DecidableEq Qβ] in | |
| theorem selectedFullLeftCompletion_support (G : Game Qβ Qβ Aβ Aβ) | |
| (strategy : Strategy (Fin n β Qβ) (Fin n β Qβ) (Fin n β Aβ) (Fin n β Aβ)) | |
| (selected : Finset (Fin n)) (j : {i : Fin n // i β selected}) | |
| (q : Qβ Γ SelectedCommonData (Qβ := Qβ) (Qβ := Qβ) (Aβ := Aβ) (Aβ := Aβ) selected j) | |
| (l : Fin n β Qβ) (h : (selectedFullLeftCompletion G strategy selected j q).weight l β 0) : | |
| l j.1 = q.1 := by | |
| classical | |
| by_contra hne | |
| apply h | |
| simp only [selectedFullLeftCompletion, FiniteDistribution.pushforward] | |
| apply Finset.sum_eq_zero | |
| intro t _ | |
| split | |
| Β· rename_i he | |
| apply selectedLeftCompletion_zero | |
| intro ht | |
| apply hne | |
| have hcoord := congrFun he j.1 | |
| simpa [mergeCoordinates, j.property, ht] using hcoord.symm | |
| Β· rfl | |
| omit [DecidableEq Qβ] in | |
| theorem selectedFullRightCompletion_support (G : Game Qβ Qβ Aβ Aβ) | |
| (strategy : Strategy (Fin n β Qβ) (Fin n β Qβ) (Fin n β Aβ) (Fin n β Aβ)) | |
| (selected : Finset (Fin n)) (j : {i : Fin n // i β selected}) | |
| (q : Qβ Γ SelectedCommonData (Qβ := Qβ) (Qβ := Qβ) (Aβ := Aβ) (Aβ := Aβ) selected j) | |
| (r : Fin n β Qβ) (h : (selectedFullRightCompletion G strategy selected j q).weight r β 0) : | |
| r j.1 = q.1 := by | |
| classical | |
| by_contra hne | |
| apply h | |
| simp only [selectedFullRightCompletion, FiniteDistribution.pushforward] | |
| apply Finset.sum_eq_zero | |
| intro t _ | |
| split | |
| Β· rename_i he | |
| apply selectedRightCompletion_zero | |
| intro ht | |
| apply hne | |
| have hcoord := congrFun he j.1 | |
| simpa [mergeCoordinates, j.property, ht] using hcoord.symm | |
| Β· rfl | |
| theorem selected_full_completion_probability (G : Game Qβ Qβ Aβ Aβ) | |
| (strategy : Strategy (Fin n β Qβ) (Fin n β Qβ) (Fin n β Aβ) (Fin n β Aβ)) | |
| (selected : Finset (Fin n)) (j : {i : Fin n // i β selected}) | |
| (s : SelectedCommonData (Qβ := Qβ) (Qβ := Qβ) (Aβ := Aβ) (Aβ := Aβ) selected j) | |
| (xy : Qβ Γ Qβ) (event : ((Fin n β Qβ) Γ (Fin n β Qβ)) β Bool) : | |
| ((selectedFullLeftCompletion G strategy selected j (xy.1,s)).product | |
| (selectedFullRightCompletion G strategy selected j (xy.2,s))).probability event = | |
| β lr : ({i : Fin n // i β selected} β Qβ) Γ ({i : Fin n // i β selected} β Qβ), | |
| ((selectedLeftCompletion G strategy selected j s xy.1).product | |
| (selectedRightCompletion G strategy selected j s xy.2)).weight lr * | |
| (if event (selectedQuestionTuple selected s.1.1 (fun i => (lr.1 i,lr.2 i))) | |
| then 1 else 0) := by | |
| rw [selectedFullLeftCompletion, selectedFullRightCompletion, | |
| β FiniteDistribution.product_pushforward, FiniteDistribution.probability_pushforward] | |
| unfold FiniteDistribution.probability | |
| apply Finset.sum_congr rfl | |
| intro lr _ | |
| have he : selectedQuestionTuple selected s.1.1 (fun i => (lr.1 i,lr.2 i)) = | |
| (mergeCoordinates selected (fun i => (s.1.1 i).1) lr.1, | |
| mergeCoordinates selected (fun i => (s.1.1 i).2) lr.2) := | |
| Prod.ext (selectedQuestionTuple_left selected s.1.1 _) | |
| (selectedQuestionTuple_right selected s.1.1 _) | |
| rw [he] | |
| cases hevent : event (mergeCoordinates selected (fun i => (s.1.1 i).1) lr.1, | |
| mergeCoordinates selected (fun i => (s.1.1 i).2) lr.2) <;> simp [hevent] | |
| theorem selected_completion_event_row (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}) | |
| (s : SelectedCommonData (Qβ := Qβ) (Qβ := Qβ) (Aβ := Aβ) (Aβ := Aβ) selected j) | |
| (event : ((Fin n β Qβ) Γ (Fin n β Qβ)) β Bool) : | |
| (β xy : Qβ Γ Qβ, (selectedCommonLaw G strategy selected positive j).weight (s,xy) * | |
| ((selectedFullLeftCompletion G strategy selected j (xy.1,s)).product | |
| (selectedFullRightCompletion G strategy selected j (xy.2,s))).probability event) = | |
| β u : {i : Fin n // i β selected} β Qβ Γ Qβ, | |
| partialRevealWeight G.questions j s.2 u * | |
| selectedOutsideLikelihood G strategy selected s.1 u * | |
| (if event (selectedQuestionTuple selected s.1.1 u) then 1 else 0) := by | |
| classical | |
| have hpoint (xy : Qβ Γ Qβ) | |
| (lr : ({i : Fin n // i β selected} β Qβ) Γ ({i : Fin n // i β selected} β Qβ)) : | |
| (selectedCommonLaw G strategy selected positive j).weight (s,xy) * | |
| ((selectedLeftCompletion G strategy selected j s xy.1).product | |
| (selectedRightCompletion G strategy selected j s xy.2)).weight lr = | |
| if (lr.1 j,lr.2 j) = xy then | |
| partialRevealWeight G.questions j s.2 (fun i => (lr.1 i,lr.2 i)) * | |
| selectedOutsideLikelihood G strategy selected s.1 (fun i => (lr.1 i,lr.2 i)) else 0 := | |
| selected_completion_row_recombine G strategy selected positive j s xy lr.1 lr.2 | |
| simp_rw [selected_full_completion_probability, Finset.mul_sum, β mul_assoc, | |
| hpoint] | |
| have hsum (xy : Qβ Γ Qβ) : | |
| (β lr : ({i : Fin n // i β selected} β Qβ) Γ ({i : Fin n // i β selected} β Qβ), | |
| (if (lr.1 j,lr.2 j) = xy then | |
| partialRevealWeight G.questions j s.2 (fun i => (lr.1 i,lr.2 i)) * | |
| selectedOutsideLikelihood G strategy selected s.1 (fun i => (lr.1 i,lr.2 i)) else 0) * | |
| (if event (selectedQuestionTuple selected s.1.1 (fun i => (lr.1 i,lr.2 i))) then 1 else 0)) = | |
| β u : {i : Fin n // i β selected} β Qβ Γ Qβ, | |
| (if u j = xy then partialRevealWeight G.questions j s.2 u * | |
| selectedOutsideLikelihood G strategy selected s.1 u else 0) * | |
| (if event (selectedQuestionTuple selected s.1.1 u) then 1 else 0) := by | |
| exact ((completionTupleEquiv (I := {i : Fin n // i β selected}) | |
| (X := Qβ) (Y := Qβ)).sum_comp _).symm | |
| simp_rw [hsum] | |
| rw [Finset.sum_comm] | |
| apply Finset.sum_congr rfl | |
| intro u _ | |
| rw [β Finset.sum_mul] | |
| simp | |
| def selectedFullCompletionMixture (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 ((Fin n β Qβ) Γ (Fin n β Qβ)) := | |
| ((selectedCommonLaw G strategy selected positive j).transport (Equiv.prodComm _ _)).mixture | |
| (fun z => (selectedFullLeftCompletion G strategy selected j (z.1.1,z.2)).product | |
| (selectedFullRightCompletion G strategy selected j (z.1.2,z.2))) | |
| theorem selectedFullCompletionMixture_probability (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}) | |
| (event : ((Fin n β Qβ) Γ (Fin n β Qβ)) β Bool) : | |
| (selectedFullCompletionMixture G strategy selected positive j).probability event = | |
| ((G.repetition n).questions.condition (G.selectedWins strategy selected) positive).probability event := by | |
| erw [FiniteDistribution.probability_condition] | |
| rw [selectedFullCompletionMixture, FiniteDistribution.probability_mixture] | |
| simp only [FiniteDistribution.transport] | |
| rw [Fintype.sum_prod_type, Finset.sum_comm] | |
| calc | |
| _ = β s : SelectedCommonData (Qβ := Qβ) (Qβ := Qβ) (Aβ := Aβ) (Aβ := Aβ) selected j, | |
| β u : {i : Fin n // i β selected} β Qβ Γ Qβ, | |
| partialRevealWeight G.questions j s.2 u * | |
| selectedOutsideLikelihood G strategy selected s.1 u * | |
| (if event (selectedQuestionTuple selected s.1.1 u) then 1 else 0) := by | |
| apply Finset.sum_congr rfl | |
| intro s _ | |
| exact selected_completion_event_row G strategy selected positive j s event | |
| _ = _ := selected_partial_event_total G strategy selected j event | |
| /-- Exact equality with the actual repeated-game question law conditioned on | |
| the selected wins, derived by summing the local completion rows. -/ | |
| theorem selectedFullCompletionMixture_eq_conditionedQuestions (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}) : | |
| selectedFullCompletionMixture G strategy selected positive j = | |
| (G.repetition n).questions.condition (G.selectedWins strategy selected) positive := by | |
| classical | |
| apply FiniteDistribution.eq_of_weight_eq | |
| intro q | |
| rw [FiniteDistribution.weight_eq_probability_singleton, | |
| FiniteDistribution.weight_eq_probability_singleton] | |
| exact selectedFullCompletionMixture_probability G strategy selected positive j _ | |
| end | |
| end UniqueGamesTheorem.Foundations.Repetition | |
| end | |
| section | |
| /-! Actual finite shared seed laws for the bounded correlated sampler. -/ | |
| namespace UniqueGamesTheorem.Foundations.Repetition | |
| open scoped BigOperators | |
| open Games | |
| noncomputable section | |
| universe u | |
| def TraceSeed (Ο : Type u) : Nat β Type u | |
| | 0 => PUnit | |
| | n + 1 => Ο Γ TraceSeed Ο n | |
| instance traceSeedFintype {Ο : Type*} [Fintype Ο] (n : Nat) : Fintype (TraceSeed Ο n) := by | |
| induction n with | |
| | zero => exact inferInstanceAs (Fintype PUnit) | |
| | succ n ih => exact inferInstanceAs (Fintype (Ο Γ TraceSeed Ο n)) | |
| instance traceSeedUniqueZero {Ο : Type*} : Unique (TraceSeed Ο 0) := | |
| inferInstanceAs (Unique PUnit) | |
| def traceList {Ο : Type*} : (n : Nat) β TraceSeed Ο n β List Ο | |
| | 0, _ => [] | |
| | n + 1, seed => seed.1 :: traceList n seed.2 | |
| def traceSeedLaw {Ο : Type*} [Fintype Ο] (ΞΌ : FiniteDistribution Ο) : | |
| (n : Nat) β FiniteDistribution (TraceSeed Ο n) | |
| | 0 => { weight := fun _ => 1, nonnegative := by intro; norm_num, | |
| normalized := by simp } | |
| | n + 1 => ΞΌ.product (traceSeedLaw ΞΌ n) | |
| theorem traceSeedLaw_expectation {Ο : Type*} [Fintype Ο] | |
| (ΞΌ : FiniteDistribution Ο) (n : Nat) (f : List Ο β β) : | |
| (traceSeedLaw ΞΌ n).expectation (fun seed => f (traceList n seed)) = | |
| CorrelatedSampling.traceAverage ΞΌ.weight n f := by | |
| induction n generalizing f with | |
| | zero => simp [traceSeedLaw, traceList, FiniteDistribution.expectation, | |
| CorrelatedSampling.traceAverage] | |
| | succ n ih => | |
| change (ΞΌ.product (traceSeedLaw ΞΌ n)).expectation | |
| (fun seed => f (seed.1 :: traceList n seed.2)) = _ | |
| rw [FiniteDistribution.expectation_product] | |
| simp only [CorrelatedSampling.traceAverage, FiniteDistribution.expectation] | |
| apply Finset.sum_congr rfl | |
| intro s _ | |
| congr 1 | |
| exact ih (fun xs => f (s :: xs)) | |
| /-- The law of the two local outputs, driven by a seed chosen independently | |
| of the question pair. Local maps receive only their own question. -/ | |
| def sharedOutputLaw {X Y S Seed : Type*} | |
| [Fintype X] [Fintype Y] [Fintype S] [Fintype Seed] [DecidableEq S] | |
| (ΞΌ : FiniteDistribution (X Γ Y)) (seedLaw : FiniteDistribution Seed) | |
| (left : Seed β X β S) (right : Seed β Y β S) : | |
| FiniteDistribution ((X Γ Y) Γ S Γ S) := | |
| (ΞΌ.product seedLaw).pushforward | |
| (fun z => (z.1, left z.2 z.1.1, right z.2 z.1.2)) | |
| theorem sharedOutputLaw_weight {X Y S Seed : Type*} | |
| [Fintype X] [Fintype Y] [Fintype S] [Fintype Seed] [DecidableEq S] | |
| (ΞΌ : FiniteDistribution (X Γ Y)) (seedLaw : FiniteDistribution Seed) | |
| (left : Seed β X β S) (right : Seed β Y β S) (x : X) (y : Y) (a b : S) : | |
| (sharedOutputLaw ΞΌ seedLaw left right).weight ((x,y),a,b) = | |
| ΞΌ.weight (x,y) * seedLaw.expectation | |
| (fun seed => if left seed x = a β§ right seed y = b then 1 else 0) := by | |
| classical | |
| simp only [sharedOutputLaw, FiniteDistribution.pushforward, | |
| FiniteDistribution.product, Fintype.sum_prod_type, Prod.mk.injEq] | |
| simp only [and_assoc, ite_and] | |
| simp [FiniteDistribution.expectation, Finset.mul_sum, mul_ite] | |
| section Rectangle | |
| open CorrelatedSampling | |
| variable {X Y S : Type*} [Fintype X] [Fintype Y] [Fintype S] | |
| [Nonempty S] [DecidableEq S] | |
| def samplerLocal (thresholds : List β) (profile : X β FiniteDistribution S) | |
| (fallback : S) (n : Nat) (seed : TraceSeed (RectangleSeed thresholds S) n) | |
| (x : X) : S := | |
| localSample (rectangleAccept thresholds (profile x).weight) Prod.fst fallback | |
| (traceList n seed) | |
| def samplerOutputLaw (thresholds : List β) (ΞΌ : FiniteDistribution (X Γ Y)) | |
| (L : X β FiniteDistribution S) (R : Y β FiniteDistribution S) | |
| (fallback : S) (n : Nat) : FiniteDistribution ((X Γ Y) Γ S Γ S) := | |
| sharedOutputLaw ΞΌ (traceSeedLaw (rectangleDistribution thresholds) n) | |
| (samplerLocal thresholds L fallback n) (samplerLocal thresholds R fallback n) | |
| omit [Nonempty S] [DecidableEq S] in | |
| theorem probability_weight_le_one (ΞΌ : FiniteDistribution S) (s : S) : ΞΌ.weight s β€ 1 := by | |
| calc | |
| ΞΌ.weight s β€ β t, ΞΌ.weight t := | |
| Finset.single_le_sum (fun t _ => ΞΌ.nonnegative t) (Finset.mem_univ s) | |
| _ = 1 := ΞΌ.normalized | |
| /-- The per-label estimate concerns the actual finite game-law | |
| sampler with a shared seed independent of the input questions. -/ | |
| theorem samplerOutputLaw_diagonal (thresholds : List β) | |
| (ΞΌ : FiniteDistribution (X Γ Y)) | |
| (L : X β FiniteDistribution S) (R : Y β FiniteDistribution S) | |
| (hL : β x s, (L x).weight s β thresholds) | |
| (hR : β y s, (R y).weight s β thresholds) | |
| (fallback : S) (n : Nat) (x : X) (y : Y) (a : S) : | |
| ΞΌ.weight (x,y) * min ((L x).weight a) ((R y).weight a) / | |
| (1 + Information.totalVariation (L x).weight (R y).weight) * | |
| (1 - eventMass (rectangleWeight thresholds) | |
| (fun s => !(rectangleAccept thresholds (L x).weight s || | |
| rectangleAccept thresholds (R y).weight s)) ^ n) β€ | |
| (samplerOutputLaw thresholds ΞΌ L R fallback n).weight ((x,y),a,a) := by | |
| have h := rectangle_label_diagonal_bound thresholds (L x).weight (R y).weight | |
| fallback a (hL x) (hR y) (L x).nonnegative (R y).nonnegative | |
| (probability_weight_le_one (L x)) (probability_weight_le_one (R y)) | |
| (L x).normalized (R y).normalized n | |
| rw [samplerOutputLaw, sharedOutputLaw_weight] | |
| have he : (traceSeedLaw (rectangleDistribution (Ξ± := S) thresholds) n).expectation | |
| (fun seed => if samplerLocal thresholds L fallback n seed x = a β§ | |
| samplerLocal thresholds R fallback n seed y = a then 1 else 0) = | |
| traceAverage (rectangleWeight thresholds) n | |
| (localDiagonal (rectangleAccept thresholds (L x).weight) | |
| (rectangleAccept thresholds (R y).weight) Prod.fst fallback a) := by | |
| exact traceSeedLaw_expectation (rectangleDistribution (Ξ± := S) thresholds) n | |
| (localDiagonal (rectangleAccept thresholds (L x).weight) | |
| (rectangleAccept thresholds (R y).weight) Prod.fst fallback a) | |
| rw [he] | |
| simp only [Information.totalVariation, CorrelatedSampling.totalVariation] at h β’ | |
| simpa only [mul_div_assoc, mul_assoc] using | |
| mul_le_mul_of_nonneg_left h (ΞΌ.nonnegative (x,y)) | |
| theorem samplerOutputLaw_uniform_diagonal | |
| (ΞΌ : FiniteDistribution (X Γ Y)) | |
| (L : X β FiniteDistribution S) (R : Y β FiniteDistribution S) | |
| (fallback : S) (n : Nat) (x : X) (y : Y) (a : S) : | |
| ΞΌ.weight (x,y) * min ((L x).weight a) ((R y).weight a) / | |
| (1 + Information.totalVariation (L x).weight (R y).weight) * | |
| (1 - uniformRejectionRate S ^ n) β€ | |
| (samplerOutputLaw (sharedProfileThresholds L R) ΞΌ L R fallback n).weight ((x,y),a,a) := by | |
| have hp := pow_le_pow_leftβ (sharedProfileReject_nonnegative L R x y) | |
| (sharedProfile_reject_le_rate L R x y) n | |
| have hco : 0 β€ ΞΌ.weight (x,y) * min ((L x).weight a) ((R y).weight a) / | |
| (1 + Information.totalVariation (L x).weight (R y).weight) := | |
| div_nonneg (mul_nonneg (ΞΌ.nonnegative (x,y)) | |
| (le_min ((L x).nonnegative a) ((R y).nonnegative a))) | |
| (by linarith [Information.totalVariation_nonneg (L x).weight (R y).weight]) | |
| have h := samplerOutputLaw_diagonal (sharedProfileThresholds L R) ΞΌ L R | |
| (left_mem_sharedProfileThresholds L R) (right_mem_sharedProfileThresholds L R) | |
| fallback n x y a | |
| exact (mul_le_mul_of_nonneg_left (sub_le_sub_left hp 1) hco).trans h | |
| /-- Actual finite shared sampler approximates any prescribed diagonal law. | |
| Its error is derived from the two actual conditional profiles and its uniform | |
| finite exhaustion probability. -/ | |
| theorem samplerOutputLaw_totalVariation | |
| (p : FiniteDistribution ((X Γ Y) Γ S)) (ΞΌ : FiniteDistribution (X Γ Y)) | |
| (L : X β FiniteDistribution S) (R : Y β FiniteDistribution S) | |
| (fallback : S) (n : Nat) : | |
| Information.totalVariation | |
| (samplerOutputLaw (sharedProfileThresholds L R) ΞΌ L R fallback n).weight | |
| (diagonalWeights p.weight) β€ | |
| 2 * Information.totalVariation p.weight (fun z => ΞΌ.weight z.1 * (L z.1.1).weight z.2) + | |
| 2 * Information.totalVariation p.weight (fun z => ΞΌ.weight z.1 * (R z.1.2).weight z.2) + | |
| uniformRejectionRate S ^ n := by | |
| apply diagonal_sampler_totalVariation_le p.weight ΞΌ.weight | |
| (fun xy => (L xy.1).weight) (fun xy => (R xy.2).weight) _ | |
| (Information.gameLaw_isProbability p) (Information.gameLaw_isProbability ΞΌ) | |
| (fun xy => Information.gameLaw_isProbability (L xy.1)) | |
| (fun xy => Information.gameLaw_isProbability (R xy.2)) | |
| (Information.gameLaw_isProbability _) | |
| (pow_nonneg (uniformRejectionRate_nonnegative S) n) | |
| Β· exact pow_le_oneβ (uniformRejectionRate_nonnegative S) | |
| (uniformRejectionRate_lt_one S).le | |
| Β· intro xy a | |
| exact samplerOutputLaw_uniform_diagonal ΞΌ L R fallback n xy.1 xy.2 a | |
| theorem samplerOutputLaw_arbitrarily_close | |
| (p : FiniteDistribution ((X Γ Y) Γ S)) (ΞΌ : FiniteDistribution (X Γ Y)) | |
| (L : X β FiniteDistribution S) (R : Y β FiniteDistribution S) | |
| (fallback : S) (Ξ· : β) (hΞ· : 0 < Ξ·) : β n : Nat, | |
| Information.totalVariation | |
| (samplerOutputLaw (sharedProfileThresholds L R) ΞΌ L R fallback n).weight | |
| (diagonalWeights p.weight) β€ | |
| 2 * Information.totalVariation p.weight (fun z => ΞΌ.weight z.1 * (L z.1.1).weight z.2) + | |
| 2 * Information.totalVariation p.weight (fun z => ΞΌ.weight z.1 * (R z.1.2).weight z.2) + Ξ· := by | |
| obtain β¨n,hnβ© := exists_uniformRejectionRate_pow_lt S Ξ· hΞ· | |
| exact β¨n, (samplerOutputLaw_totalVariation p ΞΌ L R fallback n).trans | |
| (by linarith)β© | |
| end Rectangle | |
| end | |
| end UniqueGamesTheorem.Foundations.Repetition | |
| end | |
| end OAI | |