Download data/lean/OAI/Combinatorics/IndependentSets/Repetition/QuestionMarginal.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 8.65 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/IndependentSets/Repetition/QuestionMarginal.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/IndependentSets/Repetition/QuestionMarginal.lean
-
curl -L -o QuestionMarginal.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/IndependentSets/Repetition/QuestionMarginal.lean
8.65 kB
| import Mathlib | |
| import OAI.Combinatorics.IndependentSets.Repetition.TotalVariation | |
| import OAI.Combinatorics.IndependentSets.Repetition.Pinsker | |
| namespace OAI | |
| namespace IndependentSetsGames.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 IndependentSetsGames.Foundations.Repetition | |
| end OAI | |