Buckets:
| import Mathlib | |
| import OAI.Computability.DirectedFeedback.Probability.Mixture | |
| import OAI.Computability.DirectedFeedback.Games.SelectedInformation | |
| namespace OAI | |
| namespace DFVSGames.Foundations.Repetition | |
| open scoped BigOperators | |
| open Games Information | |
| noncomputable section | |
| 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 selectedSplit_question_probability (G : Game Q₁ Q₂ A₁ A₂) | |
| (selected : Finset (Fin n)) | |
| (event : ((Fin n → Q₁) × (Fin n → Q₂)) → Bool) : | |
| (selectedSplitLaw G selected).probability | |
| (fun q => event (selectedQuestionTuple selected q.1 q.2)) = | |
| (G.repetition n).questions.probability event := by | |
| rw [selectedSplitLaw, ← iid_coordinate_split, FiniteDistribution.probability_transport] | |
| change (G.questions.iid n).probability _ = | |
| ((G.questions.iid n).transport (Game.tupleQuestionEquiv n)).probability event | |
| rw [FiniteDistribution.probability_transport] | |
| apply congrArg (G.questions.iid n).probability | |
| funext q | |
| congr 1 | |
| apply Prod.ext <;> funext i <;> | |
| simp [selectedQuestionTuple, coordinateSplitEquiv, mergeCoordinates, Game.tupleQuestionEquiv] | |
| theorem selectedJoint_eventMass (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) : | |
| (∑ tv : SelectedInput Q₁ Q₂ selected × | |
| SelectedLabels (A₁ := A₁) (A₂ := A₂) selected, | |
| (selectedInputLaw G selected).weight tv.1 * | |
| ∑ u, independentProduct | |
| (fun i => (selectedInputProfile G selected tv.1 i).weight) u * | |
| selectedLikelihood G strategy selected tv.1.1 tv.2 u * | |
| (if event (selectedQuestionTuple selected tv.1.1 u) then 1 else 0)) = | |
| (G.repetition n).questions.probability | |
| (fun q => G.selectedWins strategy selected q && event q) := by | |
| classical | |
| have hlabel (t : SelectedInput Q₁ Q₂ selected) : | |
| (∑ v, ∑ u, independentProduct | |
| (fun i => (selectedInputProfile G selected t i).weight) u * | |
| selectedLikelihood G strategy selected t.1 v u * | |
| (if event (selectedQuestionTuple selected t.1 u) then 1 else 0)) = | |
| ∑ u, independentProduct | |
| (fun i => (selectedInputProfile G selected t i).weight) u * | |
| (if G.selectedWins strategy selected (selectedQuestionTuple selected t.1 u) && | |
| event (selectedQuestionTuple selected t.1 u) then 1 else 0) := by | |
| rw [Finset.sum_comm] | |
| apply Finset.sum_congr rfl | |
| intro u _ | |
| rw [← Finset.sum_mul, ← Finset.mul_sum, selectedLikelihood_sum] | |
| cases hw : G.selectedWins strategy selected (selectedQuestionTuple selected t.1 u) <;> | |
| cases he : event (selectedQuestionTuple selected t.1 u) <;> simp [] | |
| rw [Fintype.sum_prod_type] | |
| simp_rw [← Finset.mul_sum, hlabel] | |
| rw [Fintype.sum_prod_type] | |
| simp only [selectedInputLaw, FiniteDistribution.product, FiniteDistribution.table, | |
| selectedInputProfile, independentProduct] | |
| simp_rw [mul_assoc, ← Finset.mul_sum] | |
| have hforget (fixed : selected → Q₁ × Q₂) := | |
| reveal_product_expectation G.questions | |
| (fun u : {i : Fin n // i ∉ selected} → Q₁ × Q₂ => | |
| if G.selectedWins strategy selected (selectedQuestionTuple selected fixed u) && | |
| event (selectedQuestionTuple selected fixed u) then (1 : ℝ) else 0) | |
| simp_rw [hforget] | |
| 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, Finset.mul_sum, mul_ite, mul_assoc] using h | |
| theorem selectedJointLaw_question_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) | |
| (event : ((Fin n → Q₁) × (Fin n → Q₂)) → Bool) : | |
| (selectedJointLaw G strategy selected positive).probability | |
| (fun z => event (selectedQuestionTuple selected z.1.1.1 z.2)) = | |
| ((G.repetition n).questions.condition (G.selectedWins strategy selected) positive).probability | |
| event := by | |
| classical | |
| erw [FiniteDistribution.probability_condition] | |
| change | |
| (∑ z : (SelectedInput Q₁ Q₂ selected × | |
| SelectedLabels (A₁ := A₁) (A₂ := A₂) selected) × | |
| ({i : Fin n // i ∉ selected} → Q₁ × Q₂), | |
| if event (selectedQuestionTuple selected z.1.1.1 z.2) | |
| then selectedJointWeight G strategy selected z else 0) = | |
| (G.repetition n).questions.probability | |
| (fun q => G.selectedWins strategy selected q && event q) / | |
| G.selectedSuccess strategy selected | |
| calc | |
| _ = (∑ tv : SelectedInput Q₁ Q₂ selected × | |
| SelectedLabels (A₁ := A₁) (A₂ := A₂) selected, | |
| (selectedInputLaw G selected).weight tv.1 * | |
| ∑ u, independentProduct | |
| (fun i => (selectedInputProfile G selected tv.1 i).weight) u * | |
| selectedLikelihood G strategy selected tv.1.1 tv.2 u * | |
| (if event (selectedQuestionTuple selected tv.1.1 u) then 1 else 0)) / | |
| G.selectedSuccess strategy selected := by | |
| conv_lhs => rw [Fintype.sum_prod_type] | |
| simp only [div_eq_mul_inv, Finset.sum_mul, Finset.mul_sum] | |
| apply Finset.sum_congr rfl | |
| intro tv _ | |
| apply Finset.sum_congr rfl | |
| intro u _ | |
| cases he : event (selectedQuestionTuple selected tv.1.1 u) <;> | |
| simp [selectedJointWeight, div_eq_mul_inv, mul_assoc] | |
| _ = _ := by rw [selectedJoint_eventMass] | |
| theorem selectedJointLaw_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) : | |
| (selectedJointLaw G strategy selected positive).pushforward | |
| (fun z => selectedQuestionTuple selected z.1.1.1 z.2) = | |
| (G.repetition n).questions.condition (G.selectedWins strategy selected) positive := by | |
| classical | |
| apply FiniteDistribution.eq_of_weight_eq | |
| intro questions | |
| have h : | |
| ((selectedJointLaw G strategy selected positive).pushforward | |
| (fun z => selectedQuestionTuple selected z.1.1.1 z.2)).probability | |
| (fun q => decide (q = questions)) = | |
| ((G.repetition n).questions.condition (G.selectedWins strategy selected) positive).probability | |
| (fun q => decide (q = questions)) := by | |
| rw [FiniteDistribution.probability_pushforward] | |
| exact selectedJointLaw_question_probability G strategy selected positive | |
| (fun q => decide (q = questions)) | |
| simpa [FiniteDistribution.probability] using h | |
| end | |
| end DFVSGames.Foundations.Repetition | |
| namespace DFVSGames.Foundations.Repetition | |
| open scoped BigOperators | |
| open Games Information | |
| noncomputable section | |
| variable {Q₁ Q₂ A₁ A₂ : Type*} | |
| [Fintype Q₁] [Fintype Q₂] [Fintype A₁] [Fintype A₂] | |
| [DecidableEq Q₁] [DecidableEq Q₂] | |
| {n : Nat} | |
| def selectedTupleLikelihood (G : Game Q₁ Q₂ A₁ A₂) | |
| (strategy : Strategy (Fin n → Q₁) (Fin n → Q₂) (Fin n → A₁) (Fin n → A₂)) | |
| (selected : Finset (Fin n)) (questions : Fin n → Q₁ × Q₂) : ℝ := | |
| if G.selectedWins strategy selected (Game.tupleQuestionEquiv n questions) then 1 else 0 | |
| omit [DecidableEq Q₁] [DecidableEq Q₂] in | |
| theorem selectedTupleLikelihood_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)) (questions : Fin n → Q₁ × Q₂) : | |
| 0 ≤ selectedTupleLikelihood G strategy selected questions := by | |
| unfold selectedTupleLikelihood | |
| split <;> norm_num | |
| omit [DecidableEq Q₁] [DecidableEq Q₂] in | |
| theorem selectedTupleLikelihood_le_one (G : Game Q₁ Q₂ A₁ A₂) | |
| (strategy : Strategy (Fin n → Q₁) (Fin n → Q₂) (Fin n → A₁) (Fin n → A₂)) | |
| (selected : Finset (Fin n)) (questions : Fin n → Q₁ × Q₂) : | |
| selectedTupleLikelihood G strategy selected questions ≤ 1 := by | |
| unfold selectedTupleLikelihood | |
| split <;> norm_num | |
| omit [DecidableEq Q₁] [DecidableEq Q₂] in | |
| theorem selectedTupleLikelihood_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)) : | |
| (∑ questions, independentProduct (fun _ : Fin n => G.questions.weight) questions * | |
| selectedTupleLikelihood G strategy selected questions) = | |
| G.selectedSuccess strategy selected := by | |
| classical | |
| change _ = ((G.questions.iid n).transport (Game.tupleQuestionEquiv n)).probability | |
| (G.selectedWins strategy selected) | |
| rw [FiniteDistribution.probability_transport] | |
| simp only [FiniteDistribution.probability, FiniteDistribution.iid, independentProduct, | |
| selectedTupleLikelihood, mul_ite, mul_one, mul_zero] | |
| def selectedQuestionMarginal (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) | |
| (i : Fin n) : FiniteDistribution (Q₁ × Q₂) := | |
| ((G.repetition n).questions.condition (G.selectedWins strategy selected) positive).pushforward | |
| (fun questions => (questions.1 i, questions.2 i)) | |
| theorem selectedQuestionMarginal_weight (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) | |
| (i : Fin n) : | |
| (selectedQuestionMarginal G strategy selected positive i).weight = | |
| coordinateMarginal | |
| (posterior (independentProduct (fun _ : Fin n => G.questions.weight)) | |
| (selectedTupleLikelihood G strategy selected) (G.selectedSuccess strategy selected)) i := by | |
| classical | |
| funext a | |
| simp only [selectedQuestionMarginal, FiniteDistribution.pushforward, | |
| FiniteDistribution.condition, coordinateMarginal] | |
| refine Fintype.sum_equiv (Game.tupleQuestionEquiv (Q₁ := Q₁) (Q₂ := Q₂) n).symm _ _ ?_ | |
| intro questions | |
| cases he : G.selectedWins strategy selected questions <;> | |
| simp [Game.repetition_question_weight, Game.tupleQuestionEquiv, | |
| posterior, independentProduct, selectedTupleLikelihood, Game.selectedSuccess, he] | |
| theorem selectedQuestionMarginal_totalVariation_sq_sum_le_log | |
| (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) : | |
| (∑ i : Fin n, | |
| (selectedQuestionMarginal G strategy selected positive i).totalVariation G.questions ^ 2) ≤ | |
| Real.log (1 / G.selectedSuccess strategy selected) := by | |
| classical | |
| change (∑ i : Fin n, Information.totalVariation | |
| (selectedQuestionMarginal G strategy selected positive i).weight G.questions.weight ^ 2) ≤ _ | |
| simp_rw [selectedQuestionMarginal_weight] | |
| exact posterior_coordinate_totalVariation_sq_sum_le_log | |
| (fun _ : Fin n => G.questions.weight) (fun _ => gameLaw_isProbability G.questions) | |
| (selectedTupleLikelihood G strategy selected) | |
| (selectedTupleLikelihood_nonnegative G strategy selected) | |
| (selectedTupleLikelihood_le_one G strategy selected) | |
| positive (selectedTupleLikelihood_mass G strategy selected) | |
| theorem unselectedQuestionMarginal_totalVariation_sq_sum_le_log | |
| (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) : | |
| (∑ i : {i : Fin n // i ∉ selected}, | |
| (selectedQuestionMarginal G strategy selected positive i.1).totalVariation G.questions ^ 2) ≤ | |
| Real.log (1 / G.selectedSuccess strategy selected) := by | |
| classical | |
| let d : Fin n → ℝ := fun i => | |
| (selectedQuestionMarginal G strategy selected positive i).totalVariation G.questions | |
| have hfull := selectedQuestionMarginal_totalVariation_sq_sum_le_log G strategy selected positive | |
| have hsplit := Fintype.sum_subtype_add_sum_subtype (fun i : Fin n => i ∈ selected) | |
| (fun i => d i ^ 2) | |
| have hinst : Subtype.fintype (fun i : Fin n => i ∈ selected) = | |
| Finset.Subtype.fintype selected := Subsingleton.elim _ _ | |
| rw [hinst] at hsplit | |
| have hselected : 0 ≤ ∑ i : {i : Fin n // i ∈ selected}, d i.1 ^ 2 := | |
| Finset.sum_nonneg (fun _ _ => sq_nonneg _) | |
| change (∑ i : {i : Fin n // i ∉ selected}, d i.1 ^ 2) ≤ _ | |
| change (∑ i : Fin n, d i ^ 2) ≤ _ at hfull | |
| linarith | |
| theorem unselectedQuestionMarginal_totalVariation_sum_le_sqrt | |
| (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) : | |
| (∑ i : {i : Fin n // i ∉ selected}, | |
| (selectedQuestionMarginal G strategy selected positive i.1).totalVariation G.questions) ≤ | |
| Real.sqrt ((Fintype.card {i : Fin n // i ∉ selected} : ℝ) * | |
| Real.log (1 / G.selectedSuccess strategy selected)) := by | |
| classical | |
| let d : {i : Fin n // i ∉ selected} → ℝ := fun i => | |
| (selectedQuestionMarginal G strategy selected positive i.1).totalVariation G.questions | |
| have hsq := unselectedQuestionMarginal_totalVariation_sq_sum_le_log G strategy selected positive | |
| have hcs := Finset.sum_mul_sq_le_sq_mul_sq | |
| (Finset.univ : Finset {i : Fin n // i ∉ selected}) d (fun _ => (1 : ℝ)) | |
| simp only [mul_one, one_pow, Finset.sum_const, Finset.card_univ, nsmul_eq_mul, mul_one] at hcs | |
| have hln : 0 ≤ Real.log (1 / G.selectedSuccess strategy selected) := | |
| (Finset.sum_nonneg (fun _ _ => sq_nonneg _)).trans hsq | |
| have hcard : 0 ≤ (Fintype.card {i : Fin n // i ∉ selected} : ℝ) := Nat.cast_nonneg _ | |
| have hmul := mul_le_mul_of_nonneg_left hsq hcard | |
| have hsqrt := Real.sq_sqrt (mul_nonneg hcard hln) | |
| have hsqrtpos := Real.sqrt_nonneg | |
| ((Fintype.card {i : Fin n // i ∉ selected} : ℝ) * | |
| Real.log (1 / G.selectedSuccess strategy selected)) | |
| change (∑ i, d i) ≤ _ | |
| change (∑ i, d i ^ 2) ≤ _ at hsq | |
| change (Fintype.card {i : Fin n // i ∉ selected} : ℝ) * (∑ i, d i ^ 2) ≤ _ at hmul | |
| nlinarith | |
| theorem unselectedQuestionMarginal_totalVariation_sum_le_sqrt_sub_card | |
| (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) : | |
| (∑ i : {i : Fin n // i ∉ selected}, | |
| (selectedQuestionMarginal G strategy selected positive i.1).totalVariation G.questions) ≤ | |
| Real.sqrt (((n - selected.card : Nat) : ℝ) * | |
| Real.log (1 / G.selectedSuccess strategy selected)) := by | |
| classical | |
| have hcard : Fintype.card {i : Fin n // i ∉ selected} = n - selected.card := by | |
| simp | |
| simpa only [hcard] using | |
| unselectedQuestionMarginal_totalVariation_sum_le_sqrt G strategy selected positive | |
| end | |
| end DFVSGames.Foundations.Repetition | |
| namespace DFVSGames.Foundations.Repetition | |
| open scoped BigOperators | |
| open Games Information | |
| noncomputable section | |
| theorem isProbability_comp_equiv {A B : Type*} [Fintype A] [Fintype B] | |
| (e : A ≃ B) (p : B → ℝ) (hp : IsProbability p) : | |
| IsProbability (fun a => p (e a)) := by | |
| constructor | |
| · intro a | |
| exact hp.1 _ | |
| · rw [e.sum_comp] | |
| exact hp.2 | |
| theorem partialRevealMarginal_isProbability | |
| {I T X Y : Type*} [Fintype I] [DecidableEq I] [Fintype T] | |
| [Fintype X] [Fintype Y] [DecidableEq X] [DecidableEq Y] | |
| (μ : FiniteDistribution (X × Y)) (j : I) | |
| (likelihood : T → (I → X × Y) → ℝ) | |
| (hp : IsProbability (fullRevealMarginal μ j likelihood)) : | |
| IsProbability (partialRevealMarginal μ j likelihood) := by | |
| apply (maskedJoint_isProbability_iff _).mp | |
| have h := isProbability_comp_equiv (revealSplitEquiv (T := T) j).symm _ hp | |
| have he : (fun z => fullRevealMarginal μ j likelihood | |
| ((revealSplitEquiv (T := T) j).symm z)) = | |
| maskedJoint (partialRevealMarginal μ j likelihood) := by | |
| funext z | |
| exact fullRevealMarginal_merge μ j likelihood z.1.1.1 z.1.1.2 z.1.2 z.2 | |
| rw [he] at h | |
| exact h | |
| variable {Q₁ Q₂ A₁ A₂ : Type*} | |
| [Fintype Q₁] [Fintype Q₂] [Fintype A₁] [Fintype A₂] | |
| [DecidableEq Q₁] [DecidableEq Q₂] {n : Nat} | |
| abbrev SelectedCommonData (selected : Finset (Fin n)) | |
| (j : {i : Fin n // i ∉ selected}) := | |
| ((selected → Q₁ × Q₂) × SelectedLabels (A₁ := A₁) (A₂ := A₂) selected) × | |
| ({i : {i : Fin n // i ∉ selected} // i ≠ j} → Q₁ ⊕ Q₂) | |
| theorem selected_fullReveal_isProbability (G : Game Q₁ Q₂ A₁ A₂) | |
| (strategy : Strategy (Fin n → Q₁) (Fin n → Q₂) (Fin n → A₁) (Fin n → A₂)) | |
| (selected : Finset (Fin n)) (positive : 0 < G.selectedSuccess strategy selected) | |
| (j : {i : Fin n // i ∉ selected}) : | |
| IsProbability (fullRevealMarginal G.questions j | |
| (selectedOutsideLikelihood G strategy selected)) := by | |
| have h := isProbability_comp_equiv | |
| (selectedObservationEquiv (Q₁ := Q₁) (Q₂ := Q₂) (A₁ := A₁) (A₂ := A₂) selected).symm | |
| _ (selectedRawMarginal_isProbability G strategy selected positive j) | |
| have he : (fun z => selectedRawMarginal G strategy selected j | |
| ((selectedObservationEquiv (Q₁ := Q₁) (Q₂ := Q₂) (A₁ := A₁) (A₂ := A₂) selected).symm z)) = | |
| fullRevealMarginal G.questions j (selectedOutsideLikelihood G strategy selected) := by | |
| funext z | |
| exact selectedRawMarginal_fullReveal G strategy selected j z | |
| rw [he] at h | |
| exact h | |
| def selectedCommonLaw (G : Game Q₁ Q₂ A₁ A₂) | |
| (strategy : Strategy (Fin n → Q₁) (Fin n → Q₂) (Fin n → A₁) (Fin n → A₂)) | |
| (selected : Finset (Fin n)) (positive : 0 < G.selectedSuccess strategy selected) | |
| (j : {i : Fin n // i ∉ selected}) : | |
| FiniteDistribution (SelectedCommonData (Q₁ := Q₁) (Q₂ := Q₂) | |
| (A₁ := A₁) (A₂ := A₂) selected j × (Q₁ × Q₂)) := | |
| toGameLaw (partialRevealMarginal G.questions j (selectedOutsideLikelihood G strategy selected)) | |
| (partialRevealMarginal_isProbability G.questions j _ | |
| (selected_fullReveal_isProbability G strategy selected positive j)) | |
| end | |
| end DFVSGames.Foundations.Repetition | |
| namespace DFVSGames.Foundations.Repetition | |
| open scoped BigOperators | |
| open Games Information | |
| noncomputable section | |
| variable {S X Y : Type*} [Fintype S] [Fintype X] [Fintype Y] | |
| theorem firstMarginal_totalVariation_le (r t : X × Y → ℝ) : | |
| totalVariation (firstMarginal r) (firstMarginal t) ≤ totalVariation r t := by | |
| unfold totalVariation firstMarginal | |
| simp_rw [← Finset.sum_sub_distrib] | |
| have h := Finset.sum_le_sum (s := Finset.univ) | |
| (fun x _ => Finset.abs_sum_le_sum_abs (fun y : Y => r (x,y)-t (x,y)) Finset.univ) | |
| rw [Fintype.sum_prod_type] | |
| linarith | |
| def leftCommonMarginal (p : S × (X × Y) → ℝ) : X × S → ℝ := | |
| fun z => ∑ y, p (z.2,(z.1,y)) | |
| def leftCommonProfile (p : S × (X × Y) → ℝ) (fallback : S → ℝ) : X → S → ℝ := | |
| conditionalKernel (leftCommonMarginal p) fallback | |
| def swapSeedLeft : (X × (S × Y)) ≃ (S × (X × Y)) where | |
| toFun z := (z.2.1,(z.1,z.2.2)) | |
| invFun z := (z.2.1,(z.1,z.2.2)) | |
| left_inv _ := rfl | |
| right_inv _ := rfl | |
| theorem leftCommonMarginal_isProbability (p : S × (X × Y) → ℝ) | |
| (hp : IsProbability p) : IsProbability (leftCommonMarginal p) := by | |
| exact ProfileCorrection.seedQuestionMarginal_isProbability | |
| (fun z => p (swapSeedLeft z)) (isProbability_comp_equiv swapSeedLeft p hp) | |
| theorem leftCommonProfile_isProbability (p : S × (X × Y) → ℝ) (fallback : S → ℝ) | |
| (hp : IsProbability p) (hf : IsProbability fallback) (x : X) : | |
| IsProbability (leftCommonProfile p fallback x) := | |
| conditionalKernel_isProbability _ _ (leftCommonMarginal_isProbability p hp) hf x | |
| theorem leftCommonProfile_error [DecidableEq X] [DecidableEq Y] | |
| (p : S × (X × Y) → ℝ) (μ : FiniteDistribution (X × Y)) (fallback : S → ℝ) | |
| (hp : IsProbability p) (hf : IsProbability fallback) : | |
| totalVariation p (fun z => μ.weight z.2 * leftCommonProfile p fallback z.2.1 z.1) ≤ | |
| totalVariation p (leftRevealModel μ p) + totalVariation (secondMarginal p) μ.weight := by | |
| let e := swapSeedLeft (S := S) (X := X) (Y := Y) | |
| let p' : X × (S × Y) → ℝ := fun z => p (e z) | |
| have h := ProfileCorrection.left_profile_correction p' μ.weight fallback | |
| (μ.pushforward Prod.snd).weight | |
| (isProbability_comp_equiv e p hp) (gameLaw_isProbability μ) hf | |
| (gameLaw_isProbability (μ.pushforward Prod.snd)) | |
| have hs : ProfileCorrection.seedQuestionMarginal p' = leftCommonMarginal p := rfl | |
| have hc : (fun z : X × (S × Y) => ProfileCorrection.seedQuestionMarginal p' (z.1,z.2.1) * | |
| conditionalKernel μ.weight (μ.pushforward Prod.snd).weight z.1 z.2.2) = | |
| fun z => leftRevealModel μ p (e z) := by | |
| funext z | |
| change (∑ y, p (z.2.1,(z.1,y))) * | |
| conditionalKernel μ.weight (μ.pushforward Prod.snd).weight z.1 z.2.2 = | |
| (∑ y, p (z.2.1,(z.1,y))) * | |
| (revealProfile μ (Sum.inl z.1)).weight (z.1,z.2.2) | |
| rw [revealProfile_inl_diagonal] | |
| have hd : (fun z : X × (S × Y) => μ.weight (z.1,z.2.2) * | |
| conditionalKernel (ProfileCorrection.seedQuestionMarginal p') fallback z.1 z.2.1) = | |
| fun z => μ.weight (e z).2 * leftCommonProfile p fallback (e z).2.1 (e z).1 := rfl | |
| rw [hc, hd] at h | |
| change totalVariation (fun z => p (e z)) _ ≤ | |
| totalVariation (fun z => p (e z)) _ + _ at h | |
| rw [totalVariation_comp_equiv e p (leftRevealModel μ p)] at h | |
| rw [totalVariation_comp_equiv e p | |
| (fun z => μ.weight z.2 * leftCommonProfile p fallback z.2.1 z.1)] at h | |
| have hm : firstMarginal p' = firstMarginal (secondMarginal p) := by | |
| funext x | |
| simp only [firstMarginal, secondMarginal, Fintype.sum_prod_type, p', e, swapSeedLeft] | |
| exact Finset.sum_comm | |
| rw [hm] at h | |
| exact h.trans (add_le_add le_rfl (firstMarginal_totalVariation_le (secondMarginal p) μ.weight)) | |
| end | |
| end DFVSGames.Foundations.Repetition | |
| namespace DFVSGames.Foundations.Repetition | |
| open scoped BigOperators | |
| open Games Information | |
| noncomputable section | |
| variable {S X Y : Type*} [Fintype S] [Fintype X] [Fintype Y] | |
| def swapQuestionEndpoints : (S × (Y × X)) ≃ (S × (X × Y)) where | |
| toFun z := (z.1,(z.2.2,z.2.1)) | |
| invFun z := (z.1,(z.2.2,z.2.1)) | |
| left_inv _ := rfl | |
| right_inv _ := rfl | |
| def rightCommonMarginal (p : S × (X × Y) → ℝ) : Y × S → ℝ := | |
| fun z => ∑ x, p (z.2,(x,z.1)) | |
| def rightCommonProfile (p : S × (X × Y) → ℝ) (fallback : S → ℝ) : Y → S → ℝ := | |
| conditionalKernel (rightCommonMarginal p) fallback | |
| theorem rightCommonProfile_isProbability (p : S × (X × Y) → ℝ) (fallback : S → ℝ) | |
| (hp : IsProbability p) (hf : IsProbability fallback) (y : Y) : | |
| IsProbability (rightCommonProfile p fallback y) := | |
| leftCommonProfile_isProbability (fun z => p (swapQuestionEndpoints z)) fallback | |
| (isProbability_comp_equiv swapQuestionEndpoints p hp) hf y | |
| theorem swap_question_pushforward_snd (μ : FiniteDistribution (X × Y)) : | |
| ((μ.transport (Equiv.prodComm X Y)).pushforward Prod.snd) = μ.pushforward Prod.fst := by | |
| rw [FiniteDistribution.transport_eq_pushforward, FiniteDistribution.pushforward_comp] | |
| rfl | |
| omit [Fintype S] in | |
| theorem leftRevealModel_swap [DecidableEq X] [DecidableEq Y] | |
| (p : S × (X × Y) → ℝ) (μ : FiniteDistribution (X × Y)) (z : S × (Y × X)) : | |
| leftRevealModel (μ.transport (Equiv.prodComm X Y)) | |
| (fun z => p (swapQuestionEndpoints z)) z = rightRevealModel μ p (swapQuestionEndpoints z) := by | |
| rcases z with ⟨s,y,x⟩ | |
| change (∑ x', p (s,(x',y))) * | |
| (revealProfile (μ.transport (Equiv.prodComm X Y)) (Sum.inl y)).weight (y,x) = | |
| (∑ x', p (s,(x',y))) * (revealProfile μ (Sum.inr y)).weight (x,y) | |
| rw [revealProfile_inl_diagonal, revealProfile_inr_diagonal, swap_question_pushforward_snd] | |
| theorem rightCommonProfile_error [DecidableEq X] [DecidableEq Y] | |
| (p : S × (X × Y) → ℝ) (μ : FiniteDistribution (X × Y)) (fallback : S → ℝ) | |
| (hp : IsProbability p) (hf : IsProbability fallback) : | |
| totalVariation p (fun z => μ.weight z.2 * rightCommonProfile p fallback z.2.2 z.1) ≤ | |
| totalVariation p (rightRevealModel μ p) + totalVariation (secondMarginal p) μ.weight := by | |
| let e := swapQuestionEndpoints (S := S) (X := X) (Y := Y) | |
| let p' : S × (Y × X) → ℝ := fun z => p (e z) | |
| let μ' := μ.transport (Equiv.prodComm X Y) | |
| have h := leftCommonProfile_error p' μ' fallback (isProbability_comp_equiv e p hp) hf | |
| have hc : leftRevealModel μ' p' = fun z => rightRevealModel μ p (e z) := by | |
| funext z | |
| exact leftRevealModel_swap p μ z | |
| have hd : (fun z : S × (Y × X) => μ'.weight z.2 * leftCommonProfile p' fallback z.2.1 z.1) = | |
| fun z => μ.weight (e z).2 * rightCommonProfile p fallback (e z).2.2 (e z).1 := rfl | |
| rw [hc, hd] at h | |
| change totalVariation (fun z => p (e z)) _ ≤ | |
| totalVariation (fun z => p (e z)) _ + _ at h | |
| rw [totalVariation_comp_equiv e p (rightRevealModel μ p)] at h | |
| rw [totalVariation_comp_equiv e p | |
| (fun z => μ.weight z.2 * rightCommonProfile p fallback z.2.2 z.1)] at h | |
| have hm : totalVariation (secondMarginal p') μ'.weight = | |
| totalVariation (secondMarginal p) μ.weight := by | |
| change totalVariation (fun yx => secondMarginal p ((Equiv.prodComm Y X) yx)) | |
| (fun yx => μ.weight ((Equiv.prodComm Y X) yx)) = _ | |
| exact totalVariation_comp_equiv (Equiv.prodComm Y X) _ _ | |
| rw [hm] at h | |
| exact h | |
| end | |
| end DFVSGames.Foundations.Repetition | |
| namespace DFVSGames.Foundations.Repetition | |
| open scoped BigOperators | |
| open Games Information | |
| noncomputable section | |
| theorem finiteDistribution_nonempty {A : Type*} [Fintype A] (μ : FiniteDistribution A) : | |
| Nonempty A := by | |
| have hsum : (∑ a, μ.weight a) ≠ 0 := by rw [μ.normalized]; norm_num | |
| obtain ⟨a, _, _⟩ := Finset.exists_ne_zero_of_sum_ne_zero hsum | |
| exact ⟨a⟩ | |
| variable {Q₁ Q₂ A₁ A₂ : Type*} | |
| [Fintype Q₁] [Fintype Q₂] [Fintype A₁] [Fintype A₂] | |
| [DecidableEq Q₁] [DecidableEq Q₂] {n : Nat} | |
| def selectedProfileFallback (G : Game Q₁ Q₂ A₁ A₂) | |
| (strategy : Strategy (Fin n → Q₁) (Fin n → Q₂) (Fin n → A₁) (Fin n → A₂)) | |
| (selected : Finset (Fin n)) (positive : 0 < G.selectedSuccess strategy selected) | |
| (j : {i : Fin n // i ∉ selected}) : | |
| FiniteDistribution (SelectedCommonData (Q₁ := Q₁) (Q₂ := Q₂) | |
| (A₁ := A₁) (A₂ := A₂) selected j) := | |
| (selectedCommonLaw G strategy selected positive j).pushforward Prod.fst | |
| def selectedLeftProfile (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}) (x : Q₁) : | |
| FiniteDistribution (SelectedCommonData (Q₁ := Q₁) (Q₂ := Q₂) | |
| (A₁ := A₁) (A₂ := A₂) selected j) := | |
| toGameLaw | |
| (leftCommonProfile (selectedCommonLaw G strategy selected positive j).weight | |
| (selectedProfileFallback G strategy selected positive j).weight x) | |
| (leftCommonProfile_isProbability _ _ | |
| (gameLaw_isProbability (selectedCommonLaw G strategy selected positive j)) | |
| (gameLaw_isProbability (selectedProfileFallback G strategy selected positive j)) x) | |
| def selectedRightProfile (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}) (y : Q₂) : | |
| FiniteDistribution (SelectedCommonData (Q₁ := Q₁) (Q₂ := Q₂) | |
| (A₁ := A₁) (A₂ := A₂) selected j) := | |
| toGameLaw | |
| (rightCommonProfile (selectedCommonLaw G strategy selected positive j).weight | |
| (selectedProfileFallback G strategy selected positive j).weight y) | |
| (rightCommonProfile_isProbability _ _ | |
| (gameLaw_isProbability (selectedCommonLaw G strategy selected positive j)) | |
| (gameLaw_isProbability (selectedProfileFallback G strategy selected positive j)) y) | |
| def selectedLeftProfileError (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}) : ℝ := | |
| totalVariation (selectedCommonLaw G strategy selected positive j).weight | |
| (fun z => G.questions.weight z.2 * (selectedLeftProfile G strategy selected positive j z.2.1).weight z.1) | |
| def selectedRightProfileError (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}) : ℝ := | |
| totalVariation (selectedCommonLaw G strategy selected positive j).weight | |
| (fun z => G.questions.weight z.2 * (selectedRightProfile G strategy selected positive j z.2.2).weight z.1) | |
| theorem selectedLeftProfileError_le (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 ≤ | |
| totalVariation (partialRevealMarginal G.questions j (selectedOutsideLikelihood G strategy selected)) | |
| (leftRevealModel G.questions | |
| (partialRevealMarginal G.questions j (selectedOutsideLikelihood G strategy selected))) + | |
| totalVariation (secondMarginal (selectedCommonLaw G strategy selected positive j).weight) | |
| G.questions.weight := | |
| leftCommonProfile_error _ G.questions _ | |
| (gameLaw_isProbability (selectedCommonLaw G strategy selected positive j)) | |
| (gameLaw_isProbability (selectedProfileFallback G strategy selected positive j)) | |
| theorem selectedRightProfileError_le (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 ≤ | |
| totalVariation (partialRevealMarginal G.questions j (selectedOutsideLikelihood G strategy selected)) | |
| (rightRevealModel G.questions | |
| (partialRevealMarginal G.questions j (selectedOutsideLikelihood G strategy selected))) + | |
| totalVariation (secondMarginal (selectedCommonLaw G strategy selected positive j).weight) | |
| G.questions.weight := | |
| rightCommonProfile_error _ G.questions _ | |
| (gameLaw_isProbability (selectedCommonLaw G strategy selected positive j)) | |
| (gameLaw_isProbability (selectedProfileFallback G strategy selected positive j)) | |
| def selectedSamplingTarget (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 ((Q₁ × Q₂) × SelectedCommonData (Q₁ := Q₁) (Q₂ := Q₂) | |
| (A₁ := A₁) (A₂ := A₂) selected j) := | |
| (selectedCommonLaw G strategy selected positive j).transport (Equiv.prodComm _ _) | |
| theorem selectedSamplingTarget_left_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}) : | |
| totalVariation (selectedSamplingTarget G strategy selected positive j).weight | |
| (fun z => G.questions.weight z.1 * (selectedLeftProfile G strategy selected positive j z.1.1).weight z.2) = | |
| selectedLeftProfileError G strategy selected positive j := by | |
| exact totalVariation_comp_equiv | |
| (Equiv.prodComm (Q₁ × Q₂) (SelectedCommonData (Q₁ := Q₁) (Q₂ := Q₂) | |
| (A₁ := A₁) (A₂ := A₂) selected j)) | |
| (selectedCommonLaw G strategy selected positive j).weight | |
| (fun z => G.questions.weight z.2 * (selectedLeftProfile G strategy selected positive j z.2.1).weight z.1) | |
| theorem selectedSamplingTarget_right_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}) : | |
| totalVariation (selectedSamplingTarget G strategy selected positive j).weight | |
| (fun z => G.questions.weight z.1 * (selectedRightProfile G strategy selected positive j z.1.2).weight z.2) = | |
| selectedRightProfileError G strategy selected positive j := by | |
| exact totalVariation_comp_equiv | |
| (Equiv.prodComm (Q₁ × Q₂) (SelectedCommonData (Q₁ := Q₁) (Q₂ := Q₂) | |
| (A₁ := A₁) (A₂ := A₂) selected j)) | |
| (selectedCommonLaw G strategy selected positive j).weight | |
| (fun z => G.questions.weight z.2 * (selectedRightProfile G strategy selected positive j z.2.2).weight z.1) | |
| end | |
| end DFVSGames.Foundations.Repetition | |
| namespace DFVSGames.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] | |
| 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 DFVSGames.Foundations.Repetition | |
| namespace DFVSGames.Foundations.Repetition | |
| open scoped BigOperators | |
| open Games Information | |
| noncomputable section | |
| 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 | |
| end DFVSGames.Foundations.Repetition | |
| end OAI | |
Xet Storage Details
- Size:
- 45.4 kB
- Xet hash:
- d5be0838995a9e7fb0c0860c57e44dd78115465714c79a45da457e668f85cbc6
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.