openAI-math-dataset / lean /OAI /Computability /UniqueGames /Games /CompletedSamplingLemmas.lean
roseking's picture
Add lean source and binary files (part 63)
760f90e verified
Raw History Blame Contribute Delete
36.2 kB
import OAI.Computability.UniqueGames.Games.FactorizationLemmas
import OAI.Computability.UniqueGames.Games.FinishBoundsLemmas
import OAI.Computability.UniqueGames.Games.PartialRevealLemmas
import OAI.Computability.UniqueGames.Games.SelectedCommonMarginalLemmas
import OAI.Computability.UniqueGames.Games.SelectionSequence
namespace OAI
section
/-!
# Finite local completion after correlated sampling
One independent seed contains the original shared seed and two full response
tables. Its local reads give exactly the mixture of the requested completion
kernels. Applying those kernels contracts total variation. On a diagonal
target the same construction uses one common selected label.
-/
namespace UniqueGamesTheorem.Foundations.Repetition.CompletedSampling
open scoped BigOperators
open Games
noncomputable section
section DistributionIdentities
variable {A B C D : Type*} [Fintype A] [Fintype B] [Fintype C] [Fintype D]
theorem mixture_pushforward_base (μ : FiniteDistribution A) (f : A → B)
(K : B → FiniteDistribution C) :
(μ.pushforward f).mixture K = μ.mixture (fun a => K (f a)) := by
apply FiniteDistribution.eq_of_weight_eq
intro c
exact FiniteDistribution.expectation_pushforward μ f (fun b => (K b).weight c)
theorem product_pushforward_eq_mixture_right (μ : FiniteDistribution A)
(ν : FiniteDistribution B) (f : A × B → C) :
(μ.product ν).pushforward f =
ν.mixture (fun b => μ.pushforward (fun a => f (a, b))) := by
classical
apply FiniteDistribution.eq_of_weight_eq
intro c
simp only [FiniteDistribution.pushforward, FiniteDistribution.product,
FiniteDistribution.mixture, Fintype.sum_prod_type]
rw [Finset.sum_comm]
apply Finset.sum_congr rfl
intro b _
rw [Finset.mul_sum]
apply Finset.sum_congr rfl
intro a _
by_cases h : f (a, b) = c <;> simp [h, mul_comm]
theorem product_product_pushforward_eq_mixture (μ : FiniteDistribution A)
(ν : FiniteDistribution B) (κ : FiniteDistribution C) (f : A → B → C → D) :
(μ.product (ν.product κ)).pushforward (fun z => f z.1 z.2.1 z.2.2) =
(μ.product ν).mixture
(fun z => κ.pushforward (fun c => f z.1 z.2 c)) := by
classical
apply FiniteDistribution.eq_of_weight_eq
intro d
simp only [FiniteDistribution.pushforward, FiniteDistribution.product,
FiniteDistribution.mixture, Fintype.sum_prod_type]
simp only [Finset.mul_sum, mul_ite, mul_zero, mul_assoc]
theorem mixture_totalVariation_le (μ ν : FiniteDistribution A)
(K : A → FiniteDistribution B) :
(μ.mixture K).totalVariation (ν.mixture K) ≤ μ.totalVariation ν := by
simpa only [FiniteDistribution.totalVariation, FiniteDistribution.mixture,
Information.totalVariation, kernelPushforward] using
totalVariation_kernelPushforward_le μ.weight ν.weight
(fun a => (K a).weight) (fun a => Information.gameLaw_isProbability (K a))
end DistributionIdentities
section Diagonal
variable {Z S : Type*} [Fintype Z] [Fintype S]
def diagonalLaw (σ : FiniteDistribution (Z × S)) : FiniteDistribution (Z × S × S) :=
Information.toGameLaw (diagonalWeights σ.weight)
(diagonalWeights_isProbability _ (Information.gameLaw_isProbability σ))
theorem diagonalLaw_eq_pushforward (σ : FiniteDistribution (Z × S)) :
diagonalLaw σ = σ.pushforward (fun z => (z.1, z.2, z.2)) := by
classical
apply FiniteDistribution.eq_of_weight_eq
rintro ⟨z, a, b⟩
change diagonalWeights σ.weight (z, a, b) =
(σ.pushforward (fun t => (t.1, t.2, t.2))).weight (z, a, b)
simp only [diagonalWeights, FiniteDistribution.pushforward,
Fintype.sum_prod_type, Prod.mk.injEq]
by_cases hab : a = b
· subst b
simp [ite_and]
· simp [hab, ite_and]
theorem diagonalLaw_mixture {T : Type*} [Fintype T]
(σ : FiniteDistribution (Z × S)) (K : Z × S × S → FiniteDistribution T) :
(diagonalLaw σ).mixture K = σ.mixture (fun z => K (z.1, z.2, z.2)) := by
rw [diagonalLaw_eq_pushforward, mixture_pushforward_base]
end Diagonal
section Completion
variable {X Y S Γ U V : Type*}
[Fintype X] [Fintype Y] [Fintype S] [Fintype Γ] [Fintype U] [Fintype V]
[DecidableEq X] [DecidableEq Y] [DecidableEq S]
/-- The independent original seed and two full local completion tables. -/
abbrev Seed (Γ X Y S U V : Type*) :=
Γ × KernelSampling.Seed (X × S) (Y × S) U V
def seedLaw (γ : FiniteDistribution Γ)
(L : X × S → FiniteDistribution U) (R : Y × S → FiniteDistribution V) :
FiniteDistribution (Seed Γ X Y S U V) :=
γ.product (KernelSampling.seedLaw L R)
def left (sL : Γ → X → S) (seed : Seed Γ X Y S U V) (x : X) : U :=
KernelSampling.readLeft seed.2 (x, sL seed.1 x)
def right (sR : Γ → Y → S) (seed : Seed Γ X Y S U V) (y : Y) : V :=
KernelSampling.readRight seed.2 (y, sR seed.1 y)
def completionKernel (L : X × S → FiniteDistribution U)
(R : Y × S → FiniteDistribution V) (z : (X × Y) × S × S) :
FiniteDistribution (U × V) :=
(L (z.1.1, z.2.1)).product (R (z.1.2, z.2.2))
/-- This is the shared-seed mixture used by `Game.localEmbeddingLaw`. -/
def outputLaw (μ : FiniteDistribution (X × Y)) (γ : FiniteDistribution Γ)
(sL : Γ → X → S) (sR : Γ → Y → S)
(L : X × S → FiniteDistribution U) (R : Y × S → FiniteDistribution V) :
FiniteDistribution (U × V) :=
(seedLaw γ L R).mixture (fun seed =>
μ.pushforward (fun q => (left sL seed q.1, right sR seed q.2)))
theorem outputLaw_eq_product_pushforward
(μ : FiniteDistribution (X × Y)) (γ : FiniteDistribution Γ)
(sL : Γ → X → S) (sR : Γ → Y → S)
(L : X × S → FiniteDistribution U) (R : Y × S → FiniteDistribution V) :
outputLaw μ γ sL sR L R =
(μ.product (seedLaw γ L R)).pushforward
(fun z => (left sL z.2 z.1.1, right sR z.2 z.1.2)) := by
exact (product_pushforward_eq_mixture_right μ (seedLaw γ L R)
(fun z : (X × Y) × Seed Γ X Y S U V =>
(left sL z.2 z.1.1, right sR z.2 z.1.2))).symm
/-- The completion mixture is derived from actual local table reads. -/
theorem outputLaw_eq_mixture
(μ : FiniteDistribution (X × Y)) (γ : FiniteDistribution Γ)
(sL : Γ → X → S) (sR : Γ → Y → S)
(L : X × S → FiniteDistribution U) (R : Y × S → FiniteDistribution V) :
outputLaw μ γ sL sR L R =
(sharedOutputLaw μ γ sL sR).mixture (completionKernel L R) := by
calc
outputLaw μ γ sL sR L R =
(μ.product γ).mixture (fun z =>
(KernelSampling.seedLaw L R).pushforward (fun table =>
(KernelSampling.readLeft table (z.1.1, sL z.2 z.1.1),
KernelSampling.readRight table (z.1.2, sR z.2 z.1.2)))) := by
rw [outputLaw_eq_product_pushforward]
exact product_product_pushforward_eq_mixture μ γ (KernelSampling.seedLaw L R)
(fun q seed table =>
(KernelSampling.readLeft table (q.1, sL seed q.1),
KernelSampling.readRight table (q.2, sR seed q.2)))
_ = (μ.product γ).mixture (fun z =>
completionKernel L R (z.1, sL z.2 z.1.1, sR z.2 z.1.2)) := by
apply congrArg ((μ.product γ).mixture)
funext z
exact KernelSampling.read_joint_pushforward L R
(z.1.1, sL z.2 z.1.1) (z.1.2, sR z.2 z.1.2)
_ = (sharedOutputLaw μ γ sL sR).mixture (completionKernel L R) := by
exact (mixture_pushforward_base (μ.product γ)
(fun z => (z.1, sL z.2 z.1.1, sR z.2 z.1.2)) (completionKernel L R)).symm
omit [DecidableEq X] [DecidableEq Y] [DecidableEq S] in
/-- The diagonal target uses the same selected label for both completion rows. -/
theorem diagonalLaw_completion_mixture
(σ : FiniteDistribution ((X × Y) × S))
(L : X × S → FiniteDistribution U) (R : Y × S → FiniteDistribution V) :
(diagonalLaw σ).mixture (completionKernel L R) =
σ.mixture (fun z => (L (z.1.1, z.2)).product (R (z.1.2, z.2))) := by
exact diagonalLaw_mixture σ (completionKernel L R)
/-- Completing local outputs incurs no additional total-variation loss. -/
theorem outputLaw_totalVariation_le
(μ : FiniteDistribution (X × Y)) (γ : FiniteDistribution Γ)
(sL : Γ → X → S) (sR : Γ → Y → S)
(L : X × S → FiniteDistribution U) (R : Y × S → FiniteDistribution V)
(σ : FiniteDistribution ((X × Y) × S)) :
(outputLaw μ γ sL sR L R).totalVariation
(σ.mixture (fun z => (L (z.1.1, z.2)).product (R (z.1.2, z.2)))) ≤
(sharedOutputLaw μ γ sL sR).totalVariation (diagonalLaw σ) := by
rw [outputLaw_eq_mixture, ← diagonalLaw_completion_mixture σ L R]
exact mixture_totalVariation_le _ _ (completionKernel L R)
end Completion
section CoordinateCompletion
variable {I X Y S Γ : Type*}
[Fintype I] [Fintype X] [Fintype Y] [Fintype S] [Fintype Γ]
[DecidableEq I] [DecidableEq X] [DecidableEq Y] [DecidableEq S]
/-- Restore the left input coordinate even on completion tables of weight zero. -/
def coordinateLeft (j : I) (sL : Γ → X → S)
(seed : Seed Γ X Y S (I → X) (I → Y)) (x : X) : I → X :=
KernelSampling.completedLeft j seed.2 (x, sL seed.1 x)
/-- Restore the right input coordinate even on completion tables of weight zero. -/
def coordinateRight (j : I) (sR : Γ → Y → S)
(seed : Seed Γ X Y S (I → X) (I → Y)) (y : Y) : I → Y :=
KernelSampling.completedRight j seed.2 (y, sR seed.1 y)
omit [Fintype I] [Fintype X] [Fintype Y] [Fintype S] [Fintype Γ]
[DecidableEq X] [DecidableEq Y] [DecidableEq S] in
@[simp] theorem coordinateLeft_preserves (j : I) (sL : Γ → X → S)
(seed : Seed Γ X Y S (I → X) (I → Y)) (x : X) :
coordinateLeft j sL seed x j = x := by
simp [coordinateLeft]
omit [Fintype I] [Fintype X] [Fintype Y] [Fintype S] [Fintype Γ]
[DecidableEq X] [DecidableEq Y] [DecidableEq S] in
@[simp] theorem coordinateRight_preserves (j : I) (sR : Γ → Y → S)
(seed : Seed Γ X Y S (I → X) (I → Y)) (y : Y) :
coordinateRight j sR seed y j = y := by
simp [coordinateRight]
def coordinateOutputLaw (μ : FiniteDistribution (X × Y)) (γ : FiniteDistribution Γ)
(j : I) (sL : Γ → X → S) (sR : Γ → Y → S)
(L : X × S → FiniteDistribution (I → X))
(R : Y × S → FiniteDistribution (I → Y)) :
FiniteDistribution ((I → X) × (I → Y)) :=
(seedLaw γ L R).mixture (fun seed => μ.pushforward
(fun q => (coordinateLeft j sL seed q.1, coordinateRight j sR seed q.2)))
/-- Supported coordinate repair preserves the exact completion mixture. -/
theorem coordinateOutputLaw_eq_mixture
(μ : FiniteDistribution (X × Y)) (γ : FiniteDistribution Γ)
(j : I) (sL : Γ → X → S) (sR : Γ → Y → S)
(L : X × S → FiniteDistribution (I → X))
(R : Y × S → FiniteDistribution (I → Y))
(hL : ∀ q xs, (L q).weight xs ≠ 0 → xs j = q.1)
(hR : ∀ q ys, (R q).weight ys ≠ 0 → ys j = q.1) :
coordinateOutputLaw μ γ j sL sR L R =
(sharedOutputLaw μ γ sL sR).mixture (completionKernel L R) := by
calc
coordinateOutputLaw μ γ j sL sR L R =
(μ.product (seedLaw γ L R)).pushforward
(fun z => (coordinateLeft j sL z.2 z.1.1,
coordinateRight j sR z.2 z.1.2)) := by
exact (product_pushforward_eq_mixture_right μ (seedLaw γ L R)
(fun z : (X × Y) × Seed Γ X Y S (I → X) (I → Y) =>
(coordinateLeft j sL z.2 z.1.1, coordinateRight j sR z.2 z.1.2))).symm
_ = (μ.product γ).mixture (fun z =>
(KernelSampling.seedLaw L R).pushforward (fun table =>
(KernelSampling.completedLeft j table (z.1.1, sL z.2 z.1.1),
KernelSampling.completedRight j table (z.1.2, sR z.2 z.1.2)))) := by
exact product_product_pushforward_eq_mixture μ γ (KernelSampling.seedLaw L R)
(fun q seed table =>
(KernelSampling.completedLeft j table (q.1, sL seed q.1),
KernelSampling.completedRight j table (q.2, sR seed q.2)))
_ = (μ.product γ).mixture (fun z =>
completionKernel L R (z.1, sL z.2 z.1.1, sR z.2 z.1.2)) := by
apply congrArg ((μ.product γ).mixture)
funext z
exact KernelSampling.completed_joint_pushforward L R j hL hR
(z.1.1, sL z.2 z.1.1) (z.1.2, sR z.2 z.1.2)
_ = (sharedOutputLaw μ γ sL sR).mixture (completionKernel L R) := by
exact (mixture_pushforward_base (μ.product γ)
(fun z => (z.1, sL z.2 z.1.1, sR z.2 z.1.2)) (completionKernel L R)).symm
theorem coordinateOutputLaw_eq_outputLaw
(μ : FiniteDistribution (X × Y)) (γ : FiniteDistribution Γ)
(j : I) (sL : Γ → X → S) (sR : Γ → Y → S)
(L : X × S → FiniteDistribution (I → X))
(R : Y × S → FiniteDistribution (I → Y))
(hL : ∀ q xs, (L q).weight xs ≠ 0 → xs j = q.1)
(hR : ∀ q ys, (R q).weight ys ≠ 0 → ys j = q.1) :
coordinateOutputLaw μ γ j sL sR L R = outputLaw μ γ sL sR L R := by
rw [coordinateOutputLaw_eq_mixture μ γ j sL sR L R hL hR, outputLaw_eq_mixture]
theorem coordinateOutputLaw_totalVariation_le
(μ : FiniteDistribution (X × Y)) (γ : FiniteDistribution Γ)
(j : I) (sL : Γ → X → S) (sR : Γ → Y → S)
(L : X × S → FiniteDistribution (I → X))
(R : Y × S → FiniteDistribution (I → Y))
(hL : ∀ q xs, (L q).weight xs ≠ 0 → xs j = q.1)
(hR : ∀ q ys, (R q).weight ys ≠ 0 → ys j = q.1)
(σ : FiniteDistribution ((X × Y) × S)) :
(coordinateOutputLaw μ γ j sL sR L R).totalVariation
(σ.mixture (fun z => (L (z.1.1, z.2)).product (R (z.1.2, z.2)))) ≤
(sharedOutputLaw μ γ sL sR).totalVariation (diagonalLaw σ) := by
rw [coordinateOutputLaw_eq_outputLaw μ γ j sL sR L R hL hR]
exact outputLaw_totalVariation_le μ γ sL sR L R σ
end CoordinateCompletion
end
end UniqueGamesTheorem.Foundations.Repetition.CompletedSampling
end
section
/-! An explicit finite shared sampler followed by supported local completion
gives the coordinate success bound. No embedding-existence premise remains. -/
namespace UniqueGamesTheorem.Foundations.Repetition
open scoped BigOperators
open Games CorrelatedSampling
noncomputable section
variable {Q₁ Q₂ A₁ A₂ S : Type*}
[Fintype Q₁] [Fintype Q₂] [Fintype A₁] [Fintype A₂] [Fintype S]
[Nonempty A₁] [Nonempty A₂] [Nonempty S]
[DecidableEq Q₁] [DecidableEq Q₂] [DecidableEq S] {n : Nat}
theorem coordinate_probability_le_value_of_local_completion
(G : Game Q₁ Q₂ A₁ A₂) (j : Fin n)
(strategy : Strategy (Fin n → Q₁) (Fin n → Q₂) (Fin n → A₁) (Fin n → A₂))
(σ : FiniteDistribution ((Q₁ × Q₂) × S))
(profileL : Q₁ → FiniteDistribution S) (profileR : Q₂ → FiniteDistribution S)
(completionL : Q₁ × S → FiniteDistribution (Fin n → Q₁))
(completionR : Q₂ × S → FiniteDistribution (Fin n → Q₂))
(supportL : ∀ q xs, (completionL q).weight xs ≠ 0 → xs j = q.1)
(supportR : ∀ q ys, (completionR q).weight ys ≠ 0 → ys j = q.1)
(fallback : S) :
(σ.mixture (fun z => (completionL (z.1.1,z.2)).product
(completionR (z.1.2,z.2)))).probability (G.coordinateWin strategy j) ≤
G.value +
(2 * Information.totalVariation σ.weight
(fun z => G.questions.weight z.1 * (profileL z.1.1).weight z.2) +
2 * Information.totalVariation σ.weight
(fun z => G.questions.weight z.1 * (profileR z.1.2).weight z.2)) := by
let targetLaw := σ.mixture (fun z => (completionL (z.1.1,z.2)).product (completionR (z.1.2,z.2)))
let δ := 2 * Information.totalVariation σ.weight
(fun z => G.questions.weight z.1 * (profileL z.1.1).weight z.2) +
2 * Information.totalVariation σ.weight
(fun z => G.questions.weight z.1 * (profileR z.1.2).weight z.2)
change targetLaw.probability (G.coordinateWin strategy j) ≤ G.value + δ
by_contra h
have gap : 0 < targetLaw.probability (G.coordinateWin strategy j) - (G.value + δ) :=
sub_pos.mpr (lt_of_not_ge h)
let η := (targetLaw.probability (G.coordinateWin strategy j) - (G.value + δ)) / 2
have hη : 0 < η := by dsimp [η]; linarith
obtain ⟨N,hN⟩ := samplerOutputLaw_arbitrarily_close σ G.questions profileL profileR fallback η hη
let thresholds := sharedProfileThresholds profileL profileR
let γ := traceSeedLaw (rectangleDistribution (α := S) thresholds) N
let sL := samplerLocal thresholds profileL fallback N
let sR := samplerLocal thresholds profileR fallback N
have hvariation := CompletedSampling.coordinateOutputLaw_totalVariation_le
G.questions γ j sL sR completionL completionR supportL supportR σ
have hclose : (CompletedSampling.coordinateOutputLaw G.questions γ j sL sR completionL completionR).totalVariation targetLaw ≤ δ + η :=
hvariation.trans hN
have hsuccess := G.coordinate_probability_le_value_add_embedding_distance j targetLaw
(CompletedSampling.seedLaw γ completionL completionR)
(CompletedSampling.coordinateLeft j sL) (CompletedSampling.coordinateRight j sR)
(CompletedSampling.coordinateLeft_preserves j sL)
(CompletedSampling.coordinateRight_preserves j sR) strategy
have hsym : targetLaw.totalVariation
(G.localEmbeddingLaw (CompletedSampling.seedLaw γ completionL completionR)
(CompletedSampling.coordinateLeft j sL) (CompletedSampling.coordinateRight j sR)) =
(CompletedSampling.coordinateOutputLaw G.questions γ j sL sR completionL completionR).totalVariation targetLaw := by
unfold FiniteDistribution.totalVariation
congr 1
apply Finset.sum_congr rfl
intro q _
exact abs_sub_comm _ _
rw [hsym] at hsuccess
dsimp [η] at hclose
linarith
end
end UniqueGamesTheorem.Foundations.Repetition
end
section
/-! The two actual conditional common-data profiles used by the shared
sampler, with explicit normalized default laws on all null inputs. -/
namespace UniqueGamesTheorem.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 UniqueGamesTheorem.Foundations.Repetition
end
section
namespace UniqueGamesTheorem.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 UniqueGamesTheorem.Foundations.Repetition
end
section
/-! Quantitative parallel repetition for actual finite two-player games.
The coordinate bound is derived from the explicitly conditioned question law,
finite reveal variables, information estimates, shared rejection sampler,
and normalized local completions. The scalar recurrence is then applied to
the actual repeated strategy's success probability. -/
namespace UniqueGamesTheorem.Foundations.Repetition
open scoped BigOperators
open Games
noncomputable section
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)⟩
/-- Holenstein's explicit constant-6000 repetition estimate, for the actual
success probability of every finite deterministic repeated strategy. -/
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)
/-- Quantitative parallel repetition of the actual maximum game value.
There is no repetition, embedding, information-budget, or independence premise. -/
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
end UniqueGamesTheorem.Foundations.Repetition
end
end OAI