Buckets:
| import OAI.Computability.BinPacking.Games.AlphabetBudget | |
| namespace OAI | |
| noncomputable section | |
| namespace BinPackingGames.Foundations.Repetition | |
| section | |
| open Games | |
| variable {Q₁ Q₂ A₁ A₂ : Type*} | |
| [Fintype Q₁] [Fintype Q₂] [Fintype A₁] [Fintype A₂] | |
| [DecidableEq Q₁] [DecidableEq Q₂] {n : Nat} | |
| def selectedLabelAccepts (G : Game Q₁ Q₂ A₁ A₂) (selected : Finset (Fin n)) | |
| (fixed : selected → Q₁ × Q₂) | |
| (label : SelectedLabels (A₁ := A₁) (A₂ := A₂) selected) : Bool := by | |
| classical | |
| exact decide (∀ i : selected, G.accepts (fixed i).1 (fixed i).2 (label.1 i) (label.2 i) = true) | |
| def selectedLocalAnswers {Q A : Type*} (strategy : (Fin n → Q) → (Fin n → A)) | |
| (selected : Finset (Fin n)) (fixed : selected → Q) | |
| (remaining : {i : Fin n // i ∉ selected} → Q) : selected → A := | |
| fun i => strategy (mergeCoordinates selected fixed remaining) i.1 | |
| def selectedLocalTest {Q A : Type*} (strategy : (Fin n → Q) → (Fin n → A)) | |
| (selected : Finset (Fin n)) (fixed : selected → Q) (label : selected → A) | |
| (remaining : {i : Fin n // i ∉ selected} → Q) : ℝ := by | |
| classical | |
| exact if selectedLocalAnswers strategy selected fixed remaining = label then 1 else 0 | |
| theorem selectedLocalTest_nonnegative {Q A : Type*} (strategy : (Fin n → Q) → (Fin n → A)) | |
| (selected : Finset (Fin n)) (fixed : selected → Q) (label : selected → A) | |
| (remaining : {i : Fin n // i ∉ selected} → Q) : | |
| 0 ≤ selectedLocalTest strategy selected fixed label remaining := by | |
| classical | |
| unfold selectedLocalTest | |
| split <;> norm_num | |
| omit [Fintype Q₁] [Fintype Q₂] [DecidableEq Q₁] [DecidableEq Q₂] in | |
| theorem selectedQuestionTuple_left (selected : Finset (Fin n)) | |
| (fixed : selected → Q₁ × Q₂) (remaining : {i : Fin n // i ∉ selected} → Q₁ × Q₂) : | |
| (selectedQuestionTuple selected fixed remaining).1 = | |
| mergeCoordinates selected (fun i => (fixed i).1) (fun i => (remaining i).1) := by | |
| funext i | |
| simp only [selectedQuestionTuple, mergeCoordinates] | |
| split <;> rfl | |
| omit [Fintype Q₁] [Fintype Q₂] [DecidableEq Q₁] [DecidableEq Q₂] in | |
| theorem selectedQuestionTuple_right (selected : Finset (Fin n)) | |
| (fixed : selected → Q₁ × Q₂) (remaining : {i : Fin n // i ∉ selected} → Q₁ × Q₂) : | |
| (selectedQuestionTuple selected fixed remaining).2 = | |
| mergeCoordinates selected (fun i => (fixed i).2) (fun i => (remaining i).2) := by | |
| funext i | |
| simp only [selectedQuestionTuple, mergeCoordinates] | |
| split <;> rfl | |
| omit [DecidableEq Q₁] [DecidableEq Q₂] in | |
| theorem selectedWins_of_answerLabel (G : Game Q₁ Q₂ A₁ A₂) | |
| (strategy : Strategy (Fin n → Q₁) (Fin n → Q₂) (Fin n → A₁) (Fin n → A₂)) | |
| (selected : Finset (Fin n)) (fixed : selected → Q₁ × Q₂) | |
| (label : SelectedLabels (A₁ := A₁) (A₂ := A₂) selected) | |
| (remaining : {i : Fin n // i ∉ selected} → Q₁ × Q₂) | |
| (hlabel : selectedAnswerLabel strategy selected (selectedQuestionTuple selected fixed remaining) = label) : | |
| G.selectedWins strategy selected (selectedQuestionTuple selected fixed remaining) = | |
| selectedLabelAccepts G selected fixed label := by | |
| classical | |
| have hleft (i : selected) := congrArg (fun l => l.1 i) hlabel | |
| have hright (i : selected) := congrArg (fun l => l.2 i) hlabel | |
| apply Bool.eq_iff_iff.mpr | |
| simp only [Game.selectedWins, selectedLabelAccepts, decide_eq_true_eq] | |
| constructor | |
| · intro h i | |
| have hi := h i.1 i.property | |
| simpa [Game.coordinateWin, selectedQuestionTuple, mergeCoordinates, i.property, | |
| ← hleft i, ← hright i, selectedAnswerLabel] using hi | |
| · intro h i hi | |
| have hv := h ⟨i,hi⟩ | |
| simpa [Game.coordinateWin, selectedQuestionTuple, mergeCoordinates, hi, | |
| ← hleft ⟨i,hi⟩, ← hright ⟨i,hi⟩, selectedAnswerLabel] using hv | |
| omit [DecidableEq Q₁] [DecidableEq Q₂] in | |
| theorem selectedLikelihood_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)) (fixed : selected → Q₁ × Q₂) | |
| (label : SelectedLabels (A₁ := A₁) (A₂ := A₂) selected) | |
| (remaining : {i : Fin n // i ∉ selected} → Q₁ × Q₂) : | |
| selectedLikelihood G strategy selected fixed label remaining = | |
| (if selectedLabelAccepts G selected fixed label then 1 else 0) * | |
| selectedLocalTest strategy.1 selected (fun i => (fixed i).1) label.1 (fun i => (remaining i).1) * | |
| selectedLocalTest strategy.2 selected (fun i => (fixed i).2) label.2 (fun i => (remaining i).2) := by | |
| classical | |
| have he : selectedAnswerLabel strategy selected (selectedQuestionTuple selected fixed remaining) = | |
| (selectedLocalAnswers strategy.1 selected (fun i => (fixed i).1) (fun i => (remaining i).1), | |
| selectedLocalAnswers strategy.2 selected (fun i => (fixed i).2) (fun i => (remaining i).2)) := by | |
| simp only [selectedAnswerLabel, | |
| selectedQuestionTuple_left, selectedQuestionTuple_right] | |
| rfl | |
| by_cases hl : selectedLocalAnswers strategy.1 selected (fun i => (fixed i).1) | |
| (fun i => (remaining i).1) = label.1 | |
| · by_cases hr : selectedLocalAnswers strategy.2 selected (fun i => (fixed i).2) | |
| (fun i => (remaining i).2) = label.2 | |
| · have hlabel : selectedAnswerLabel strategy selected (selectedQuestionTuple selected fixed remaining) = label := by | |
| rw [he, hl, hr] | |
| simp only [selectedLikelihood, ite_eq_left hlabel, | |
| selectedWins_of_answerLabel G strategy selected fixed label remaining hlabel, | |
| selectedLocalTest, ite_eq_left hl, ite_eq_left hr, mul_one] | |
| · have hn : selectedAnswerLabel strategy selected (selectedQuestionTuple selected fixed remaining) ≠ label := by | |
| intro h | |
| rw [he] at h | |
| exact hr (congrArg Prod.snd h) | |
| simp [selectedLikelihood, hn, selectedLocalTest, hl, hr] | |
| · have hn : selectedAnswerLabel strategy selected (selectedQuestionTuple selected fixed remaining) ≠ label := by | |
| intro h | |
| rw [he] at h | |
| exact hl (congrArg Prod.fst h) | |
| simp [selectedLikelihood, hn, selectedLocalTest, hl] | |
| end | |
| section | |
| open scoped BigOperators | |
| open Games Information | |
| 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] | |
| 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 | |
| section | |
| open scoped BigOperators | |
| open Games | |
| 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 | |
| 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 | |
| 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 | |
| section | |
| open scoped BigOperators | |
| open Games | |
| 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 G.selectedWins strategy selected (selectedQuestionTuple selected fixed u) <;> | |
| cases 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 | |
| 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 | |
| section | |
| open scoped BigOperators | |
| open Games Information | |
| 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 selectedQuestionRadius_le_informationRadius [Nonempty A₁] [Nonempty A₂] | |
| (G : Game Q₁ Q₂ A₁ A₂) | |
| (strategy : Strategy (Fin n → Q₁) (Fin n → Q₂) (Fin n → A₁) (Fin n → A₂)) | |
| (selected : Finset (Fin n)) : | |
| Real.sqrt ((Fintype.card {i : Fin n // i ∉ selected} : ℝ) * | |
| Real.log (1 / G.selectedSuccess strategy selected)) ≤ | |
| selectedInformationRadius G strategy selected := by | |
| have hcard : (1 : ℝ) ≤ Fintype.card (SelectedLabels (A₁ := A₁) (A₂ := A₂) selected) := by | |
| exact_mod_cast (Nat.succ_le_of_lt | |
| (Fintype.card_pos : 0 < Fintype.card (SelectedLabels (A₁ := A₁) (A₂ := A₂) selected))) | |
| have hlog := Real.log_nonneg hcard | |
| have hnonneg : 0 ≤ (Fintype.card {i : Fin n // i ∉ selected} : ℝ) := Nat.cast_nonneg _ | |
| unfold selectedInformationRadius | |
| apply Real.sqrt_le_sqrt | |
| nlinarith | |
| theorem selectedQuestionMarginal_error_sum [Nonempty A₁] [Nonempty A₂] | |
| (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}, | |
| (selectedQuestionMarginal G strategy selected positive j.1).totalVariation G.questions) ≤ | |
| selectedInformationRadius G strategy selected := | |
| (unselectedQuestionMarginal_totalVariation_sum_le_sqrt G strategy selected positive).trans | |
| (selectedQuestionRadius_le_informationRadius G strategy selected) | |
| def selectedEmbeddingError (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}) : ℝ := | |
| 2 * selectedLeftProfileError G strategy selected positive j + | |
| 2 * selectedRightProfileError G strategy selected positive j | |
| theorem selectedEmbeddingError_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)) (positive : 0 < G.selectedSuccess strategy selected) | |
| (j : {i : Fin n // i ∉ selected}) : | |
| 0 ≤ selectedEmbeddingError G strategy selected positive j := by | |
| exact add_nonneg | |
| (mul_nonneg (by norm_num) (Information.totalVariation_nonneg _ _)) | |
| (mul_nonneg (by norm_num) (Information.totalVariation_nonneg _ _)) | |
| theorem selectedLeftProfileError_sum [Nonempty A₁] [Nonempty A₂] | |
| (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}, selectedLeftProfileError G strategy selected positive j) ≤ | |
| 3 * selectedInformationRadius G strategy selected := by | |
| have hsum := Finset.sum_le_sum | |
| (fun j (_ : j ∈ (Finset.univ : Finset {i : Fin n // i ∉ selected})) => | |
| selectedLeftProfileError_le G strategy selected positive j) | |
| simp_rw [selectedCommonLaw_secondMarginal] at hsum | |
| rw [Finset.sum_add_distrib] at hsum | |
| have hleft := selected_leftReveal_error_sum G strategy selected positive | |
| have hquestion := selectedQuestionMarginal_error_sum G strategy selected positive | |
| change (∑ j : {i : Fin n // i ∉ selected}, | |
| Information.totalVariation (selectedQuestionMarginal G strategy selected positive j.1).weight | |
| G.questions.weight) ≤ _ at hquestion | |
| linarith | |
| theorem selectedRightProfileError_sum [Nonempty A₁] [Nonempty A₂] | |
| (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}, selectedRightProfileError G strategy selected positive j) ≤ | |
| 3 * selectedInformationRadius G strategy selected := by | |
| have hsum := Finset.sum_le_sum | |
| (fun j (_ : j ∈ (Finset.univ : Finset {i : Fin n // i ∉ selected})) => | |
| selectedRightProfileError_le G strategy selected positive j) | |
| simp_rw [selectedCommonLaw_secondMarginal] at hsum | |
| rw [Finset.sum_add_distrib] at hsum | |
| have hright := selected_rightReveal_error_sum G strategy selected positive | |
| have hquestion := selectedQuestionMarginal_error_sum G strategy selected positive | |
| change (∑ j : {i : Fin n // i ∉ selected}, | |
| Information.totalVariation (selectedQuestionMarginal G strategy selected positive j.1).weight | |
| G.questions.weight) ≤ _ at hquestion | |
| linarith | |
| theorem selectedEmbeddingError_sum_le_fifteen [Nonempty A₁] [Nonempty A₂] | |
| (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}, selectedEmbeddingError G strategy selected positive j) ≤ | |
| 15 * selectedInformationRadius G strategy selected := by | |
| have hl := selectedLeftProfileError_sum G strategy selected positive | |
| have hr := selectedRightProfileError_sum G strategy selected positive | |
| have hn : 0 ≤ selectedInformationRadius G strategy selected := Real.sqrt_nonneg _ | |
| simp only [selectedEmbeddingError, Finset.sum_add_distrib, ← Finset.mul_sum] | |
| linarith | |
| end | |
| open scoped BigOperators | |
| open Games | |
| variable {Q₁ Q₂ A₁ A₂ : Type*} | |
| [Fintype Q₁] [Fintype Q₂] [Fintype A₁] [Fintype A₂] | |
| [Nonempty A₁] [Nonempty A₂] | |
| [DecidableEq Q₁] [DecidableEq Q₂] {n : Nat} | |
| theorem selected_coordinate_probability_le_value_add_error | |
| (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}) : | |
| ((G.repetition n).questions.condition (G.selectedWins strategy selected) positive).probability | |
| (G.coordinateWin strategy j.1) ≤ | |
| G.value + selectedEmbeddingError G strategy selected positive j := by | |
| classical | |
| let : Nonempty (SelectedCommonData (Q₁ := Q₁) (Q₂ := Q₂) | |
| (A₁ := A₁) (A₂ := A₂) selected j) := | |
| finiteDistribution_nonempty (selectedProfileFallback G strategy selected positive j) | |
| have h := coordinate_probability_le_value_of_local_completion G j.1 strategy | |
| (selectedSamplingTarget G strategy selected positive j) | |
| (selectedLeftProfile G strategy selected positive j) | |
| (selectedRightProfile G strategy selected positive j) | |
| (selectedFullLeftCompletion G strategy selected j) | |
| (selectedFullRightCompletion G strategy selected j) | |
| (selectedFullLeftCompletion_support G strategy selected j) | |
| (selectedFullRightCompletion_support G strategy selected j) | |
| (Classical.choice inferInstance) | |
| have htarget : (selectedSamplingTarget G strategy selected positive j).mixture | |
| (fun z => (selectedFullLeftCompletion G strategy selected j (z.1.1,z.2)).product | |
| (selectedFullRightCompletion G strategy selected j (z.1.2,z.2))) = | |
| (G.repetition n).questions.condition (G.selectedWins strategy selected) positive := | |
| selectedFullCompletionMixture_eq_conditionedQuestions G strategy selected positive j | |
| rw [htarget, selectedSamplingTarget_left_error, selectedSamplingTarget_right_error] at h | |
| exact h | |
| theorem holenstein_conditionalCoordinateBound | |
| (G : Game Q₁ Q₂ A₁ A₂) (n : Nat) | |
| (strategy : Strategy (Fin n → Q₁) (Fin n → Q₂) (Fin n → A₁) (Fin n → A₂)) | |
| (ell : ℝ) | |
| (halphabet : logTwo ((Fintype.card A₁ : ℝ) * (Fintype.card A₂ : ℝ)) ≤ ell) : | |
| SelectionSequence.ConditionalCoordinateBound G n strategy ell := by | |
| intro selected hcard positive | |
| obtain ⟨j,hj⟩ := exists_coordinate_le_information_budget G strategy selected positive ell | |
| halphabet hcard (selectedEmbeddingError G strategy selected positive) | |
| (selectedEmbeddingError_sum_le_fifteen G strategy selected positive) | |
| exact ⟨j.1,j.property, | |
| (selected_coordinate_probability_le_value_add_error G strategy selected positive j).trans | |
| (add_le_add le_rfl hj)⟩ | |
| theorem holenstein_repetition_success | |
| (G : Game Q₁ Q₂ A₁ A₂) (n : Nat) | |
| (strategy : Strategy (Fin n → Q₁) (Fin n → Q₂) (Fin n → A₁) (Fin n → A₂)) | |
| {v ell : ℝ} (hvalue : G.value ≤ v) (hv : v < 1) (hell : 1 ≤ ell) | |
| (halphabet : logTwo ((Fintype.card A₁ : ℝ) * (Fintype.card A₂ : ℝ)) ≤ ell) : | |
| (G.repetition n).success strategy ≤ | |
| (1 - (1 - v)^3 / 6000)^((n : ℝ) / ell) := | |
| SelectionSequence.repetition_success_le_of_conditionalCoordinateBound G n strategy | |
| hvalue hv hell (holenstein_conditionalCoordinateBound G n strategy ell halphabet) | |
| theorem holenstein_repetition_value | |
| (G : Game Q₁ Q₂ A₁ A₂) (n : Nat) | |
| {v ell : ℝ} (hvalue : G.value ≤ v) (hv : v < 1) (hell : 1 ≤ ell) | |
| (halphabet : logTwo ((Fintype.card A₁ : ℝ) * (Fintype.card A₂ : ℝ)) ≤ ell) : | |
| (G.repetition n).value ≤ | |
| (1 - (1 - v)^3 / 6000)^((n : ℝ) / ell) := by | |
| apply ((G.repetition n).value_le_iff _).2 | |
| intro strategy | |
| exact holenstein_repetition_success G n strategy hvalue hv hell halphabet | |
| end BinPackingGames.Foundations.Repetition | |
| end | |
| end OAI | |
Xet Storage Details
- Size:
- 50.1 kB
- Xet hash:
- 4c1359dc2e2517d0f474bbad4611f0b3b2d9664d8d4ce7573f1d0e05538cd351
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.