Download data/lean/OAI/Computability/VertexCover/Repetition/SelectedMarginal.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 12.9 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Computability/VertexCover/Repetition/SelectedMarginal.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Computability/VertexCover/Repetition/SelectedMarginal.lean
-
curl -L -o SelectedMarginal.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Computability/VertexCover/Repetition/SelectedMarginal.lean
12.9 kB
| import Mathlib | |
| import OAI.Computability.VertexCover.Repetition.SelectedJoint | |
| import OAI.Computability.VertexCover.Repetition.PartialReveal | |
| namespace OAI | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| namespace UniqueGames.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 selectedRawMarginal (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}) : | |
| (SelectedInput Qβ Qβ selected Γ SelectedLabels (Aβ := Aβ) (Aβ := Aβ) selected) Γ | |
| (Qβ Γ Qβ) β β := by | |
| classical | |
| exact fun z => β u, if u j = z.2 then selectedJointWeight G strategy selected (z.1,u) else 0 | |
| theorem selectedPosterior_eq_raw (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}) (tv) (q) : | |
| selectedSideWeight G strategy selected tv * coordinateMarginal | |
| (posteriorOrOriginal | |
| (independentProduct (fun i => (selectedInputProfile G selected tv.1 i).weight)) | |
| (selectedLikelihood G strategy selected tv.1.1 tv.2) | |
| (selectedSideMass G strategy selected tv)) j q = | |
| selectedRawMarginal G strategy selected j (tv,q) := by | |
| classical | |
| rw [selectedSideWeight] | |
| have h := weighted_coordinate_posterior_recombine | |
| (independentProduct (fun i => (selectedInputProfile G selected tv.1 i).weight)) | |
| (selectedLikelihood G strategy selected tv.1.1 tv.2) | |
| (independentProduct_isProbability _ | |
| (fun i => gameLaw_isProbability (selectedInputProfile G selected tv.1 i))) | |
| (selectedLikelihood_nonnegative G strategy selected tv.1.1 tv.2) | |
| (Β«cΒ» := selectedSideMass G strategy selected tv) rfl | |
| ((selectedInputLaw G selected).weight tv.1) (G.selectedSuccess strategy selected) j q | |
| rw [h] | |
| simp only [Finset.mul_sum, selectedRawMarginal, selectedJointWeight] | |
| apply Finset.sum_congr rfl | |
| intro u _ | |
| by_cases hu : u j = q | |
| Β· simp only [ite_eq_left hu] | |
| ring | |
| Β· simp [hu] | |
| theorem selectedRawMarginal_firstMarginal (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}) (tv) : | |
| firstMarginal (selectedRawMarginal G strategy selected j) tv = | |
| selectedSideWeight G strategy selected tv := by | |
| classical | |
| simp only [firstMarginal, selectedRawMarginal] | |
| rw [Finset.sum_comm] | |
| simp only [Finset.sum_ite_eq, Finset.mem_univ, ite_true] | |
| exact selectedJointWeight_firstMarginal G strategy selected tv | |
| theorem selectedRawMarginal_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 (selectedRawMarginal G strategy selected j) := by | |
| classical | |
| constructor | |
| Β· intro z | |
| apply Finset.sum_nonneg | |
| intro u _ | |
| split | |
| Β· exact selectedJointWeight_nonnegative G strategy selected (z.1,u) | |
| Β· exact le_rfl | |
| Β· rw [Fintype.sum_prod_type] | |
| change (β tv, firstMarginal (selectedRawMarginal G strategy selected j) tv) = 1 | |
| simp_rw [selectedRawMarginal_firstMarginal, selectedSideWeight, div_eq_mul_inv] | |
| rw [β Finset.sum_mul, selectedSideMass_total, mul_inv_cancelβ positive.ne'] | |
| theorem selected_raw_information_bound [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}, totalVariation | |
| (selectedRawMarginal G strategy selected j) | |
| (fun z => selectedSideWeight G strategy selected z.1 * | |
| (selectedInputProfile G selected z.1.1 j).weight z.2)) β€ | |
| Real.sqrt ((Fintype.card {i : Fin n // i β selected} : β) * | |
| (Real.log (Fintype.card (SelectedLabels (Aβ := Aβ) (Aβ := Aβ) selected) : β) + | |
| Real.log (1 / G.selectedSuccess strategy selected))) := by | |
| have h := selected_information_bound G strategy selected positive | |
| simp_rw [selectedPosterior_eq_raw] at h | |
| exact h | |
| def selectedOutsideLikelihood (G : Game Qβ Qβ Aβ Aβ) | |
| (strategy : Strategy (Fin n β Qβ) (Fin n β Qβ) (Fin n β Aβ) (Fin n β Aβ)) | |
| (selected : Finset (Fin n)) | |
| (t : (selected β Qβ Γ Qβ) Γ SelectedLabels (Aβ := Aβ) (Aβ := Aβ) selected) | |
| (u : {i : Fin n // i β selected} β Qβ Γ Qβ) : β := | |
| (β i : selected, G.questions.weight (t.1 i)) * | |
| selectedLikelihood G strategy selected t.1 t.2 u / G.selectedSuccess strategy selected | |
| def selectedObservationEquiv (selected : Finset (Fin n)) : | |
| ((SelectedInput Qβ Qβ selected Γ SelectedLabels (Aβ := Aβ) (Aβ := Aβ) selected) Γ | |
| (Qβ Γ Qβ)) β | |
| ((((selected β Qβ Γ Qβ) Γ SelectedLabels (Aβ := Aβ) (Aβ := Aβ) selected) Γ | |
| ({i : Fin n // i β selected} β Qβ β Qβ)) Γ (Qβ Γ Qβ)) where | |
| toFun z := (((z.1.1.1,z.1.2),z.1.1.2),z.2) | |
| invFun z := (((z.1.1.1,z.1.2),z.1.1.2),z.2) | |
| left_inv _ := rfl | |
| right_inv _ := rfl | |
| theorem selectedRawMarginal_fullReveal (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}) (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) z := by | |
| classical | |
| change selectedRawMarginal G strategy selected j | |
| (((z.1.1.1,z.1.2),z.1.1.2),z.2) = _ | |
| simp only [selectedRawMarginal, fullRevealMarginal] | |
| apply Finset.sum_congr rfl | |
| intro u _ | |
| by_cases hu : u j = z.2 | |
| Β· simp only [ite_eq_left hu, selectedJointWeight_factorization, selectedOutsideLikelihood] | |
| ring | |
| Β· simp [hu] | |
| theorem selectedRawReference_fullReveal (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}) (z) : | |
| (fun w => selectedSideWeight G strategy selected w.1 * | |
| (selectedInputProfile G selected w.1.1 j).weight w.2) | |
| ((selectedObservationEquiv (Qβ := Qβ) (Qβ := Qβ) (Aβ := Aβ) (Aβ := Aβ) selected).symm z) = | |
| fullRevealModel G.questions j (selectedOutsideLikelihood G strategy selected) z := by | |
| change selectedSideWeight G strategy selected ((z.1.1.1,z.1.2),z.1.1.2) * | |
| (revealProfile G.questions (z.1.2 j)).weight z.2 = _ | |
| rw [β selectedRawMarginal_firstMarginal G strategy selected j] | |
| unfold firstMarginal fullRevealModel | |
| congr 1 | |
| apply Finset.sum_congr rfl | |
| intro q _ | |
| exact selectedRawMarginal_fullReveal G strategy selected j (z.1,q) | |
| theorem selected_raw_error_eq_fullReveal (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}) : | |
| totalVariation (selectedRawMarginal G strategy selected j) | |
| (fun z => selectedSideWeight G strategy selected z.1 * | |
| (selectedInputProfile G selected z.1.1 j).weight z.2) = | |
| totalVariation (fullRevealMarginal G.questions j (selectedOutsideLikelihood G strategy selected)) | |
| (fullRevealModel G.questions j (selectedOutsideLikelihood G strategy selected)) := by | |
| rw [β totalVariation_comp_equiv | |
| (selectedObservationEquiv (Qβ := Qβ) (Qβ := Qβ) (Aβ := Aβ) (Aβ := Aβ) selected).symm] | |
| congr 1 <;> funext z | |
| Β· exact selectedRawMarginal_fullReveal G strategy selected j z | |
| Β· exact selectedRawReference_fullReveal G strategy selected j z | |
| theorem selected_fullReveal_information_bound [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}, | |
| totalVariation (fullRevealMarginal G.questions j (selectedOutsideLikelihood G strategy selected)) | |
| (fullRevealModel G.questions j (selectedOutsideLikelihood G strategy selected))) β€ | |
| Real.sqrt ((Fintype.card {i : Fin n // i β selected} : β) * | |
| (Real.log (Fintype.card (SelectedLabels (Aβ := Aβ) (Aβ := Aβ) selected) : β) + | |
| Real.log (1 / G.selectedSuccess strategy selected))) := by | |
| have h := selected_raw_information_bound G strategy selected positive | |
| simp_rw [selected_raw_error_eq_fullReveal] at h | |
| exact h | |
| def selectedInformationRadius (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 (Fintype.card (SelectedLabels (Aβ := Aβ) (Aβ := Aβ) selected) : β) + | |
| Real.log (1 / G.selectedSuccess strategy selected))) | |
| theorem selected_leftReveal_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}, | |
| totalVariation (partialRevealMarginal G.questions j (selectedOutsideLikelihood G strategy selected)) | |
| (leftRevealModel G.questions | |
| (partialRevealMarginal G.questions j (selectedOutsideLikelihood G strategy selected)))) β€ | |
| 2 * selectedInformationRadius G strategy selected := by | |
| calc | |
| _ β€ β j : {i : Fin n // i β selected}, | |
| 2 * totalVariation (fullRevealMarginal G.questions j (selectedOutsideLikelihood G strategy selected)) | |
| (fullRevealModel G.questions j (selectedOutsideLikelihood G strategy selected)) := by | |
| apply Finset.sum_le_sum | |
| intro j _ | |
| exact leftReveal_full_error G.questions j _ | |
| _ = 2 * β j : {i : Fin n // i β selected}, | |
| totalVariation (fullRevealMarginal G.questions j (selectedOutsideLikelihood G strategy selected)) | |
| (fullRevealModel G.questions j (selectedOutsideLikelihood G strategy selected)) := | |
| (Finset.mul_sum _ _ _).symm | |
| _ β€ _ := mul_le_mul_of_nonneg_left | |
| (selected_fullReveal_information_bound G strategy selected positive) (by norm_num) | |
| theorem selected_rightReveal_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}, | |
| totalVariation (partialRevealMarginal G.questions j (selectedOutsideLikelihood G strategy selected)) | |
| (rightRevealModel G.questions | |
| (partialRevealMarginal G.questions j (selectedOutsideLikelihood G strategy selected)))) β€ | |
| 2 * selectedInformationRadius G strategy selected := by | |
| calc | |
| _ β€ β j : {i : Fin n // i β selected}, | |
| 2 * totalVariation (fullRevealMarginal G.questions j (selectedOutsideLikelihood G strategy selected)) | |
| (fullRevealModel G.questions j (selectedOutsideLikelihood G strategy selected)) := by | |
| apply Finset.sum_le_sum | |
| intro j _ | |
| exact rightReveal_full_error G.questions j _ | |
| _ = 2 * β j : {i : Fin n // i β selected}, | |
| totalVariation (fullRevealMarginal G.questions j (selectedOutsideLikelihood G strategy selected)) | |
| (fullRevealModel G.questions j (selectedOutsideLikelihood G strategy selected)) := | |
| (Finset.mul_sum _ _ _).symm | |
| _ β€ _ := mul_le_mul_of_nonneg_left | |
| (selected_fullReveal_information_bound G strategy selected positive) (by norm_num) | |
| end | |
| end UniqueGames.Foundations.Repetition | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end OAI | |