cfahlgren1/math / lean /OAI /Computability /VertexCover /Repetition /SelectedInformation.lean
cfahlgren1's picture
download
raw
12.3 kB
import Mathlib
import OAI.Computability.VertexCover.Repetition.Reveal
import OAI.Computability.VertexCover.Information.SideInformation
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
def mergeCoordinates {Ω : Type*} {n : Nat} (selected : Finset (Fin n))
(fixed : selected → Ω) (remaining : {i : Fin n // i ∉ selected} → Ω) : Fin n → Ω :=
fun i => if h : i ∈ selected then fixed ⟨i,h⟩ else remaining ⟨i,h⟩
def coordinateSplitEquiv {Ω : Type*} {n : Nat} (selected : Finset (Fin n)) :
(Fin n → Ω) ≃ ((selected → Ω) × ({i : Fin n // i ∉ selected} → Ω)) where
toFun x := (fun i => x i.1, fun i => x i.1)
invFun x := mergeCoordinates selected x.1 x.2
left_inv x := by funext i; simp [mergeCoordinates]
right_inv x := by
apply Prod.ext <;> funext i <;> simp [mergeCoordinates, i.property]
theorem iid_coordinate_split {Ω : Type*} [Fintype Ω] {n : Nat}
(μ : FiniteDistribution Ω) (selected : Finset (Fin n)) :
(μ.iid n).transport (coordinateSplitEquiv selected) =
(FiniteDistribution.table (fun _ : selected => μ)).product
(FiniteDistribution.table (fun _ : {i : Fin n // i ∉ selected} => μ)) := by
classical
apply FiniteDistribution.eq_of_weight_eq
intro x
change (∏ i, μ.weight (mergeCoordinates selected x.1 x.2 i)) =
(∏ i : selected, μ.weight (x.1 i)) *
∏ i : {i : Fin n // i ∉ selected}, μ.weight (x.2 i)
have h := Fintype.prod_subtype_mul_prod_subtype (fun i : Fin n => i ∈ selected)
(fun i => μ.weight (mergeCoordinates selected x.1 x.2 i))
have hi : Subtype.fintype (fun i : Fin n => i ∈ selected) =
Finset.Subtype.fintype selected := Subsingleton.elim _ _
rw [hi] at h
calc
_ = (∏ i : {i : Fin n // i ∈ selected},
μ.weight (mergeCoordinates selected x.1 x.2 i.1)) *
∏ i : {i : Fin n // i ∉ selected},
μ.weight (mergeCoordinates selected x.1 x.2 i.1) := h.symm
_ = _ := by
congr 1 <;> apply Finset.prod_congr rfl <;> intro i _ <;>
simp [mergeCoordinates, i.property]
variable {Q₁ Q₂ A₁ A₂ : Type*}
[Fintype Q₁] [Fintype Q₂] [Fintype A₁] [Fintype A₂]
[DecidableEq Q₁] [DecidableEq Q₂]
{n : Nat}
abbrev SelectedLabels (selected : Finset (Fin n)) :=
(selected → A₁) × (selected → A₂)
def selectedQuestionTuple (selected : Finset (Fin n))
(fixed : selected → Q₁ × Q₂)
(remaining : {i : Fin n // i ∉ selected} → Q₁ × Q₂) :
(Fin n → Q₁) × (Fin n → Q₂) :=
(fun i => (mergeCoordinates selected fixed remaining i).1,
fun i => (mergeCoordinates selected fixed remaining i).2)
def selectedAnswerLabel
(strategy : Strategy (Fin n → Q₁) (Fin n → Q₂) (Fin n → A₁) (Fin n → A₂))
(selected : Finset (Fin n)) (questions : (Fin n → Q₁) × (Fin n → Q₂)) :
SelectedLabels (A₁ := A₁) (A₂ := A₂) selected :=
(fun i => strategy.1 questions.1 i.1, fun i => strategy.2 questions.2 i.1)
def selectedLikelihood (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₂) : ℝ := by
classical
let questions := selectedQuestionTuple selected fixed remaining
exact if selectedAnswerLabel strategy selected questions = label then
(if G.selectedWins strategy selected questions then 1 else 0) else 0
omit [DecidableEq Q₁] [DecidableEq Q₂] in
theorem selectedLikelihood_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)) (fixed : selected → Q₁ × Q₂)
(label : SelectedLabels (A₁ := A₁) (A₂ := A₂) selected)
(remaining : {i : Fin n // i ∉ selected} → Q₁ × Q₂) :
0 ≤ selectedLikelihood G strategy selected fixed label remaining := by
classical
dsimp only [selectedLikelihood]
split_ifs <;> norm_num
omit [DecidableEq Q₁] [DecidableEq Q₂] in
theorem selectedLikelihood_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)) (fixed : selected → Q₁ × Q₂)
(remaining : {i : Fin n // i ∉ selected} → Q₁ × Q₂) :
(∑ label, selectedLikelihood G strategy selected fixed label remaining) =
if G.selectedWins strategy selected (selectedQuestionTuple selected fixed remaining)
then 1 else 0 := by
classical
simp [selectedLikelihood]
omit [DecidableEq Q₁] [DecidableEq Q₂] in
theorem selectedLikelihood_sum_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)) (fixed : selected → Q₁ × Q₂)
(remaining : {i : Fin n // i ∉ selected} → Q₁ × Q₂) :
(∑ label, selectedLikelihood G strategy selected fixed label remaining) ≤ 1 := by
rw [selectedLikelihood_sum]
split <;> norm_num
def selectedSplitLaw (G : Game Q₁ Q₂ A₁ A₂) (selected : Finset (Fin n)) :
FiniteDistribution ((selected → Q₁ × Q₂) ×
({i : Fin n // i ∉ selected} → Q₁ × Q₂)) :=
(FiniteDistribution.table (fun _ : selected => G.questions)).product
(FiniteDistribution.table (fun _ : {i : Fin n // i ∉ selected} => G.questions))
omit [DecidableEq Q₁] [DecidableEq Q₂] in
theorem selectedSplit_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)) :
(selectedSplitLaw G selected).probability
(fun q => G.selectedWins strategy selected (selectedQuestionTuple selected q.1 q.2)) =
G.selectedSuccess strategy selected := by
rw [selectedSplitLaw, ← iid_coordinate_split, FiniteDistribution.probability_transport]
change (G.questions.iid n).probability _ =
((G.questions.iid n).transport (Game.tupleQuestionEquiv n)).probability _
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]
abbrev SelectedInput (Q₁ Q₂ : Type*) {n : Nat} (selected : Finset (Fin n)) :=
(selected → Q₁ × Q₂) × ({i : Fin n // i ∉ selected} → Q₁ ⊕ Q₂)
def selectedInputLaw (G : Game Q₁ Q₂ A₁ A₂) (selected : Finset (Fin n)) :
FiniteDistribution (SelectedInput Q₁ Q₂ selected) :=
(FiniteDistribution.table (fun _ : selected => G.questions)).product
(FiniteDistribution.table (fun _ : {i : Fin n // i ∉ selected} => revealInputLaw G.questions))
def selectedInputProfile (G : Game Q₁ Q₂ A₁ A₂) (selected : Finset (Fin n))
(t : SelectedInput Q₁ Q₂ selected) (i : {i : Fin n // i ∉ selected}) :
FiniteDistribution (Q₁ × Q₂) := revealProfile G.questions (t.2 i)
def selectedSideMass (G : Game Q₁ Q₂ A₁ A₂)
(strategy : Strategy (Fin n → Q₁) (Fin n → Q₂) (Fin n → A₁) (Fin n → A₂))
(selected : Finset (Fin n))
(tv : SelectedInput Q₁ Q₂ selected × SelectedLabels (A₁ := A₁) (A₂ := A₂) selected) : ℝ :=
∑ u, independentProduct (fun i => (selectedInputProfile G selected tv.1 i).weight) u *
selectedLikelihood G strategy selected tv.1.1 tv.2 u
omit [DecidableEq Q₁] [DecidableEq Q₂] in
theorem selectedSideMass_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)) (t : SelectedInput Q₁ Q₂ selected) :
(∑ v, selectedSideMass G strategy selected (t,v)) =
∑ u, independentProduct (fun i => (selectedInputProfile G selected t i).weight) u *
(if G.selectedWins strategy selected (selectedQuestionTuple selected t.1 u)
then 1 else 0) := by
classical
simp only [selectedSideMass]
rw [Finset.sum_comm]
simp_rw [← Finset.mul_sum, selectedLikelihood_sum]
theorem selectedSideMass_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)) :
(∑ tv, (selectedInputLaw G selected).weight tv.1 *
selectedSideMass G strategy selected tv) = G.selectedSuccess strategy selected := by
classical
rw [Fintype.sum_prod_type]
simp_rw [← Finset.mul_sum, selectedSideMass_sum]
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)
then (1 : ℝ) else 0)
simp_rw [hforget]
have h := selectedSplit_probability G strategy selected
simpa [selectedSplitLaw, FiniteDistribution.probability, FiniteDistribution.product,
FiniteDistribution.table, Fintype.sum_prod_type, Finset.mul_sum, mul_ite, mul_assoc] using h
def selectedSideWeight (G : Game Q₁ Q₂ A₁ A₂)
(strategy : Strategy (Fin n → Q₁) (Fin n → Q₂) (Fin n → A₁) (Fin n → A₂))
(selected : Finset (Fin n))
(tv : SelectedInput Q₁ Q₂ selected × SelectedLabels (A₁ := A₁) (A₂ := A₂) selected) : ℝ :=
(selectedInputLaw G selected).weight tv.1 * selectedSideMass G strategy selected tv /
G.selectedSuccess strategy selected
theorem selected_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) :
(∑ i : {i : Fin n // i ∉ selected}, totalVariation
(fun tva : (SelectedInput Q₁ Q₂ selected ×
SelectedLabels (A₁ := A₁) (A₂ := A₂) selected) × (Q₁ × Q₂) =>
selectedSideWeight G strategy selected tva.1 * coordinateMarginal
(posteriorOrOriginal
(independentProduct (fun j => (selectedInputProfile G selected tva.1.1 j).weight))
(selectedLikelihood G strategy selected tva.1.1.1 tva.1.2)
(selectedSideMass G strategy selected tva.1)) i tva.2)
(fun tva => selectedSideWeight G strategy selected tva.1 *
(selectedInputProfile G selected tva.1.1 i).weight tva.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
exact finite_side_information_bound (selectedInputLaw G selected).weight
(fun t i => (selectedInputProfile G selected t i).weight)
(fun tv => selectedLikelihood G strategy selected tv.1.1 tv.2)
(selectedSideMass G strategy selected) (selectedSideWeight G strategy selected)
(gameLaw_isProbability _) (fun t i => gameLaw_isProbability _)
(fun tv => selectedLikelihood_nonnegative G strategy selected tv.1.1 tv.2)
(fun t => selectedLikelihood_sum_le_one G strategy selected t.1)
(fun _ => rfl) positive (selectedSideMass_total G strategy selected) (fun _ => rfl)
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

Xet Storage Details

Size:
12.3 kB
·
Xet hash:
c68d70d3c3b675188ad8593b57410449ebc9c71b900c044bd8d7ab52f76b20cb

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.