cfahlgren1/math / lean /OAI /Computability /UniqueGames /Games /FactorizationLemmas.lean
cfahlgren1's picture
download
raw
38.9 kB
import Mathlib.Algebra.BigOperators.Ring.Finset
import Mathlib.Algebra.Order.BigOperators.Group.Finset
import Mathlib.Algebra.Order.Floor.Ring
import Mathlib.Analysis.Convex.SpecificFunctions.Basic
import Mathlib.Analysis.Real.Sqrt
import Mathlib.Data.Fintype.BigOperators
import Mathlib.Data.Fintype.Sum
import Mathlib.Basic.Real.Basic
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.Linarith
import Mathlib.Tactic.NormNum
import Mathlib.Tactic.Positivity
import Mathlib.Tactic.Ring
import OAI.Computability.UniqueGames.Foundations.MixtureLemmas
import OAI.Computability.UniqueGames.Foundations.SamplingLemmas
import OAI.Computability.UniqueGames.Foundations.ValueLemmas
namespace OAI
section
/-!
The finite product algebra of dependency breaking.
Revealing one endpoint of each independently sampled question pair turns the
remaining question weight into a product of two separate functions, one for
each player. Further separate restrictions on the players' answers preserve
this product. The final theorem normalizes the displayed weights, rather than
assuming conditional independence as an abstract hypothesis.
-/
namespace UniqueGamesTheorem.Foundations.Repetition
open scoped BigOperators
noncomputable section
variable {ι α β : Type*} [Fintype ι] [DecidableEq α] [DecidableEq β]
/-- `mask i = false` reveals the first question, and `true` the second. -/
def revealedProductWeight (weight : ι → α → β → ℝ) (mask : ι → Bool)
(fixedLeft : ι → α) (fixedRight : ι → β) (x : ι → α) (y : ι → β) : ℝ :=
∏ i, weight i (x i) (y i) *
(if mask i then (if y i = fixedRight i then 1 else 0)
else (if x i = fixedLeft i then 1 else 0))
def revealedLeftWeight (weight : ι → α → β → ℝ) (mask : ι → Bool)
(fixedLeft : ι → α) (fixedRight : ι → β) (x : ι → α) : ℝ :=
∏ i, if mask i then weight i (x i) (fixedRight i)
else (if x i = fixedLeft i then 1 else 0)
def revealedRightWeight (weight : ι → α → β → ℝ) (mask : ι → Bool)
(fixedLeft : ι → α) (fixedRight : ι → β) (y : ι → β) : ℝ :=
∏ i, if mask i then (if y i = fixedRight i then 1 else 0)
else weight i (fixedLeft i) (y i)
/-- Exact factorization after fixing the selected endpoint at every position.
No assumption on coordinate alphabets or probabilities is needed for this
identity, so it applies separately at every fixed outside question tuple. -/
theorem revealedProductWeight_factorizes (weight : ι → α → β → ℝ) (mask : ι → Bool)
(fixedLeft : ι → α) (fixedRight : ι → β) (x : ι → α) (y : ι → β) :
revealedProductWeight weight mask fixedLeft fixedRight x y =
revealedLeftWeight weight mask fixedLeft fixedRight x *
revealedRightWeight weight mask fixedLeft fixedRight y := by
unfold revealedProductWeight revealedLeftWeight revealedRightWeight
rw [← Finset.prod_mul_distrib]
apply Finset.prod_congr rfl
intro i _
by_cases hm : mask i = true
· by_cases hy : y i = fixedRight i <;> simp [hm, hy]
· by_cases hx : x i = fixedLeft i <;> simp [hm, hx]
/-- Local answer tests are separate functions of the complete local question
vectors. Multiplying by both tests leaves a product of two local weights. -/
theorem revealedProductWeight_local_restrictions
(weight : ι → α → β → ℝ) (mask : ι → Bool)
(fixedLeft : ι → α) (fixedRight : ι → β)
(leftTest : (ι → α) → ℝ) (rightTest : (ι → β) → ℝ)
(x : ι → α) (y : ι → β) :
revealedProductWeight weight mask fixedLeft fixedRight x y * leftTest x * rightTest y =
(revealedLeftWeight weight mask fixedLeft fixedRight x * leftTest x) *
(revealedRightWeight weight mask fixedLeft fixedRight y * rightTest y) := by
rw [revealedProductWeight_factorizes]
ring
variable {X Y : Type*} [Fintype X] [Fintype Y]
theorem productWeight_mass (left : X → ℝ) (right : Y → ℝ) :
(∑ xy : X × Y, left xy.1 * right xy.2) =
(∑ x, left x) * (∑ y, right y) := by
rw [Fintype.sum_prod_type]
simp only [← Finset.mul_sum, ← Finset.sum_mul]
def normalizedWeight (weight : X → ℝ) : X → ℝ :=
fun x => weight x / ∑ x', weight x'
theorem normalizedWeight_isProbability (weight : X → ℝ)
(hweight : ∀ x, 0 ≤ weight x) (hmass : 0 < ∑ x, weight x) :
(∀ x, 0 ≤ normalizedWeight weight x) ∧ (∑ x, normalizedWeight weight x) = 1 := by
constructor
· intro x
exact div_nonneg (hweight x) hmass.le
· simp only [normalizedWeight, div_eq_mul_inv, ← Finset.sum_mul, mul_inv_cancel₀ hmass.ne']
/-- Normalizing an actual product weight gives the product of its separately
normalized marginals. This is the finite conditional-independence identity. -/
theorem normalized_productWeight (left : X → ℝ) (right : Y → ℝ)
(hleft : 0 < ∑ x, left x) (hright : 0 < ∑ y, right y) (xy : X × Y) :
normalizedWeight (fun z : X × Y => left z.1 * right z.2) xy =
normalizedWeight left xy.1 * normalizedWeight right xy.2 := by
unfold normalizedWeight
rw [productWeight_mass]
field_simp
/-- Conditioning a product law on separate local events keeps the two factors
independent, with each conditioned on its own event. -/
theorem normalized_rectangle_restriction
(left : X → ℝ) (right : Y → ℝ) (leftTest : X → ℝ) (rightTest : Y → ℝ)
(hleft : 0 < ∑ x, left x * leftTest x)
(hright : 0 < ∑ y, right y * rightTest y) (xy : X × Y) :
normalizedWeight
(fun z : X × Y => left z.1 * right z.2 * leftTest z.1 * rightTest z.2) xy =
normalizedWeight (fun x => left x * leftTest x) xy.1 *
normalizedWeight (fun y => right y * rightTest y) xy.2 := by
have hfun : (fun z : X × Y => left z.1 * right z.2 * leftTest z.1 * rightTest z.2) =
(fun z : X × Y => (left z.1 * leftTest z.1) * (right z.2 * rightTest z.2)) := by
funext z
ring
rw [hfun]
exact normalized_productWeight _ _ hleft hright xy
end
end UniqueGamesTheorem.Foundations.Repetition
end
section
/-! Normalized local completion laws derived from their actual product weights.
Zero rows use explicit default laws and satisfy the same recombination identity.
-/
namespace UniqueGamesTheorem.Foundations.Repetition
open scoped BigOperators
open Games
noncomputable section
variable {X Y : Type*} [Fintype X] [Fintype Y]
def normalizeOr (w : X → ℝ) (hw : ∀ x, 0 ≤ w x)
(fallback : FiniteDistribution X) : FiniteDistribution X :=
if h : 0 < ∑ x, w x then
{ weight := normalizedWeight w
nonnegative := (normalizedWeight_isProbability w hw h).1
normalized := (normalizedWeight_isProbability w hw h).2 }
else fallback
theorem sum_mul_normalizeOr (w : X → ℝ) (hw : ∀ x, 0 ≤ w x)
(fallback : FiniteDistribution X) (x : X) :
(∑ z, w z) * (normalizeOr w hw fallback).weight x = w x := by
classical
have hs : 0 ≤ ∑ z, w z := Finset.sum_nonneg (fun z _ => hw z)
by_cases h : 0 < ∑ z, w z
· simp only [normalizeOr, dite_eq_left h, normalizedWeight]
field_simp
· have hz : ∑ z, w z = 0 := le_antisymm (le_of_not_gt h) hs
have hx : w x = 0 := by
apply le_antisymm _ (hw x)
have hl := Finset.single_le_sum (fun z _ => hw z) (Finset.mem_univ x)
simpa only [hz] using hl
simp [normalizeOr, hz, hx]
/-- Exact reconstruction from two separately normalized local completion
laws, valid even when either unnormalized row has mass zero. -/
theorem local_completion_recombination
(left : X → ℝ) (right : Y → ℝ)
(hl : ∀ x, 0 ≤ left x) (hr : ∀ y, 0 ≤ right y)
(defaultLeft : FiniteDistribution X) (defaultRight : FiniteDistribution Y)
(c : ℝ) (x : X) (y : Y) :
(c * (∑ z, left z) * (∑ z, right z)) *
((normalizeOr left hl defaultLeft).weight x *
(normalizeOr right hr defaultRight).weight y) = c * left x * right y := by
calc
_ = c * ((∑ z, left z) * (normalizeOr left hl defaultLeft).weight x) *
((∑ z, right z) * (normalizeOr right hr defaultRight).weight y) := by ring
_ = _ := by rw [sum_mul_normalizeOr, sum_mul_normalizeOr]
/-- The row mass appearing in reconstruction is the actual sum of product
weights, not an assumed marginal identity. -/
theorem factorized_completion_row
(left : X → ℝ) (right : Y → ℝ)
(hl : ∀ x, 0 ≤ left x) (hr : ∀ y, 0 ≤ right y)
(defaultLeft : FiniteDistribution X) (defaultRight : FiniteDistribution Y)
(c : ℝ) (xy : X × Y) :
(∑ z : X × Y, c * left z.1 * right z.2) *
((normalizeOr left hl defaultLeft).product
(normalizeOr right hr defaultRight)).weight xy = c * left xy.1 * right xy.2 := by
have hm : (∑ z : X × Y, c * left z.1 * right z.2) =
c * (∑ z, left z) * (∑ z, right z) := by
simp_rw [mul_assoc, ← Finset.mul_sum]
rw [productWeight_mass]
rw [hm]
exact local_completion_recombination left right hl hr defaultLeft defaultRight c xy.1 xy.2
end
end UniqueGamesTheorem.Foundations.Repetition
end
section
/-!
Local embedding to single-game strategy transfer for Holenstein's argument.
The embedding law below is explicitly sampled from a finite shared seed and
the base game's actual joint question law. Its distance from the desired
conditioned law is an explicit total-variation expression. Constructing an
embedding with a sufficiently small distance is a separate proof obligation.
-/
namespace UniqueGamesTheorem.Foundations.Games.Game
noncomputable section
variable {Q₁ Q₂ A₁ A₂ R₁ R₂ B₁ B₂ Seed : Type*}
[Fintype Q₁] [Fintype Q₂] [Fintype A₁] [Fintype A₂]
[Fintype R₁] [Fintype R₂] [Fintype B₁] [Fintype B₂] [Fintype Seed]
[Nonempty A₁] [Nonempty A₂]
def localEmbeddingLaw (G : Game Q₁ Q₂ A₁ A₂)
(seedLaw : FiniteDistribution Seed)
(left : Seed → Q₁ → R₁) (right : Seed → Q₂ → R₂) :
FiniteDistribution (R₁ × R₂) :=
seedLaw.mixture fun seed =>
G.questions.pushforward fun q => (left seed q.1, right seed q.2)
/-- Any finite shared-randomness local embedding yields a valid base-game
strategy after the seed is fixed. Total variation pays exactly for changing
the resulting question distribution to the desired one. -/
theorem success_le_value_add_embedding_distance
(G : Game Q₁ Q₂ A₁ A₂) (H : Game R₁ R₂ B₁ B₂)
(seedLaw : FiniteDistribution Seed)
(left : Seed → Q₁ → R₁) (right : Seed → Q₂ → R₂)
(answerLeft : Seed → Q₁ → B₁ → A₁)
(answerRight : Seed → Q₂ → B₂ → A₂)
(acceptance : ∀ seed x y a b,
H.accepts (left seed x) (right seed y) a b = true →
G.accepts x y (answerLeft seed x a) (answerRight seed y b) = true)
(strategy : Strategy R₁ R₂ B₁ B₂) :
H.success strategy ≤ G.value +
H.questions.totalVariation (G.localEmbeddingLaw seedLaw left right) := by
have localBound (seed : Seed) :
(G.questions.pushforward (fun q => (left seed q.1, right seed q.2))).probability
(H.wins strategy) ≤ G.value := by
let embedded : Game R₁ R₂ B₁ B₂ :=
{ questions := G.questions.pushforward fun q => (left seed q.1, right seed q.2)
accepts := H.accepts }
change embedded.success strategy ≤ G.value
exact (G.success_le_of_localSimulation embedded (left seed) (right seed)
(answerLeft seed) (answerRight seed) rfl (acceptance seed) strategy).trans
(G.success_le_value _)
have mixtureBound :
(G.localEmbeddingLaw seedLaw left right).probability (H.wins strategy) ≤ G.value :=
seedLaw.probability_mixture_le _ _ _ localBound
exact (H.questions.probability_le_add_totalVariation
(G.localEmbeddingLaw seedLaw left right) (H.wins strategy)).trans
(add_le_add mixtureBound (le_refl _))
/-- A single tested coordinate under an arbitrary full-tuple question law. -/
def coordinateGame (G : Game Q₁ Q₂ A₁ A₂) {n : Nat} (coordinate : Fin n)
(law : FiniteDistribution ((Fin n → Q₁) × (Fin n → Q₂))) :
Game (Fin n → Q₁) (Fin n → Q₂) (Fin n → A₁) (Fin n → A₂) where
questions := law
accepts x y a b := G.accepts (x coordinate) (y coordinate) (a coordinate) (b coordinate)
/-- The strategy-extraction step used for a surviving coordinate after
conditioning on successes at other coordinates. It preserves full local
question dependence and uses no independence assumption on the target law. -/
theorem coordinate_probability_le_value_add_embedding_distance
(G : Game Q₁ Q₂ A₁ A₂) {n : Nat} (coordinate : Fin n)
(law : FiniteDistribution ((Fin n → Q₁) × (Fin n → Q₂)))
(seedLaw : FiniteDistribution Seed)
(left : Seed → Q₁ → Fin n → Q₁) (right : Seed → Q₂ → Fin n → Q₂)
(left_preserves : ∀ seed x, left seed x coordinate = x)
(right_preserves : ∀ seed y, right seed y coordinate = y)
(strategy : Strategy (Fin n → Q₁) (Fin n → Q₂) (Fin n → A₁) (Fin n → A₂)) :
law.probability (G.coordinateWin strategy coordinate) ≤ G.value +
law.totalVariation (G.localEmbeddingLaw seedLaw left right) := by
apply G.success_le_value_add_embedding_distance (G.coordinateGame coordinate law)
seedLaw left right (fun _ _ a => a coordinate) (fun _ _ b => b coordinate)
intro seed x y a b h
simpa only [coordinateGame, left_preserves, right_preserves] using h
/-- Finite samplers may have an arbitrarily small exhaustion error. Passing
to the limit in the numerical bound does not require an infinite seed or a
claim that any finite sampler terminates with probability one. -/
theorem coordinate_probability_le_value_of_approximate_embeddings
{SeedFamily : Nat → Type*} [∀ t, Fintype (SeedFamily t)]
(G : Game Q₁ Q₂ A₁ A₂) {n : Nat} (coordinate : Fin n)
(law : FiniteDistribution ((Fin n → Q₁) × (Fin n → Q₂)))
(seedLaw : (t : Nat) → FiniteDistribution (SeedFamily t))
(left : (t : Nat) → SeedFamily t → Q₁ → Fin n → Q₁)
(right : (t : Nat) → SeedFamily t → Q₂ → Fin n → Q₂)
(left_preserves : ∀ t seed x, left t seed x coordinate = x)
(right_preserves : ∀ t seed y, right t seed y coordinate = y)
(strategy : Strategy (Fin n → Q₁) (Fin n → Q₂) (Fin n → A₁) (Fin n → A₂))
(distance : ℝ)
(close : ∀ η : ℝ, 0 < η → ∃ t,
law.totalVariation (G.localEmbeddingLaw (seedLaw t) (left t) (right t)) ≤
distance + η) :
law.probability (G.coordinateWin strategy coordinate) ≤ G.value + distance := by
by_contra h
have gap : 0 < law.probability (G.coordinateWin strategy coordinate) -
(G.value + distance) := sub_pos.mpr (lt_of_not_ge h)
obtain ⟨t, ht⟩ := close
((law.probability (G.coordinateWin strategy coordinate) - (G.value + distance)) / 2)
(by linarith)
have bound := G.coordinate_probability_le_value_add_embedding_distance coordinate law
(seedLaw t) (left t) (right t) (left_preserves t) (right_preserves t) strategy
linarith
end
end UniqueGamesTheorem.Foundations.Games.Game
end
section
/-! Replacing the input marginal of an actual conditional profile. -/
namespace UniqueGamesTheorem.Foundations.Repetition.ProfileCorrection
open scoped BigOperators
open UniqueGamesTheorem.Foundations.Information
noncomputable section
variable {S X Y : Type*} [Fintype S] [Fintype X] [Fintype Y]
def seedQuestionMarginal (p : X × (S × Y) → ℝ) : X × S → ℝ :=
firstMarginal (fun z : (X × S) × Y => p (z.1.1, (z.1.2, z.2)))
theorem seedQuestionMarginal_isProbability (p : X × (S × Y) → ℝ)
(hp : IsProbability p) : IsProbability (seedQuestionMarginal p) := by
apply firstMarginal_isProbability
constructor
· intro z
exact hp.1 _
· have h := hp.2
simp only [Fintype.sum_prod_type] at h ⊢
exact h
omit [Fintype X] in
theorem seedQuestionMarginal_first (p : X × (S × Y) → ℝ) :
firstMarginal (seedQuestionMarginal p) = firstMarginal p := by
funext x
simp only [seedQuestionMarginal, firstMarginal, Fintype.sum_prod_type]
theorem totalVariation_triangle {Ω : Type*} [Fintype Ω]
(p c d : Ω → ℝ) :
totalVariation p d ≤ totalVariation p c + totalVariation c d := by
unfold totalVariation
have h := Finset.sum_le_sum (s := Finset.univ)
(fun x _ => abs_sub_le (p x) (c x) (d x))
rw [Finset.sum_add_distrib] at h
linarith
theorem left_profile_correction
(p : X × (S × Y) → ℝ) (μ : X × Y → ℝ)
(fallbackS : S → ℝ) (fallbackY : Y → ℝ)
(hp : IsProbability p) (hμ : IsProbability μ)
(hS : IsProbability fallbackS) (hY : IsProbability fallbackY) :
totalVariation p (fun z => μ (z.1, z.2.2) *
conditionalKernel (seedQuestionMarginal p) fallbackS z.1 z.2.1) ≤
totalVariation p (fun z => seedQuestionMarginal p (z.1, z.2.1) *
conditionalKernel μ fallbackY z.1 z.2.2) +
totalVariation (firstMarginal p) (firstMarginal μ) := by
let σ := seedQuestionMarginal p
let L := conditionalKernel σ fallbackS
let M := conditionalKernel μ fallbackY
let k : X → S × Y → ℝ := fun x sy => L x sy.1 * M x sy.2
let c : X × (S × Y) → ℝ := fun z => σ (z.1,z.2.1) * M z.1 z.2.2
let d : X × (S × Y) → ℝ := fun z => μ (z.1,z.2.2) * L z.1 z.2.1
have hσ : IsProbability σ := seedQuestionMarginal_isProbability p hp
have hk : ∀ x, IsProbability (k x) := by
intro x
exact kernelProduct_isProbability (L x) (fun _ : S => M x)
(conditionalKernel_isProbability σ fallbackS hσ hS x)
(fun _ => conditionalKernel_isProbability μ fallbackY hμ hY x)
have hc : c = fun z => firstMarginal σ z.1 * k z.1 z.2 := by
funext z
change σ (z.1,z.2.1) * M z.1 z.2.2 =
firstMarginal σ z.1 * (L z.1 z.2.1 * M z.1 z.2.2)
rw [← mul_assoc, marginal_mul_conditionalKernel σ fallbackS hσ]
have hd : d = fun z => firstMarginal μ z.1 * k z.1 z.2 := by
funext z
change μ (z.1,z.2.2) * L z.1 z.2.1 =
firstMarginal μ z.1 * (L z.1 z.2.1 * M z.1 z.2.2)
calc
_ = (firstMarginal μ z.1 * M z.1 z.2.2) * L z.1 z.2.1 := by
rw [marginal_mul_conditionalKernel μ fallbackY hμ]
_ = _ := by ring
have hmiddle : totalVariation c d =
totalVariation (firstMarginal σ) (firstMarginal μ) := by
rw [hc, hd]
exact totalVariation_joint_common_kernel _ _ k hk
have result := totalVariation_triangle p c d
rw [hmiddle] at result
have hmarg : firstMarginal σ = firstMarginal p := seedQuestionMarginal_first p
rw [hmarg] at result
exact result
end
end UniqueGamesTheorem.Foundations.Repetition.ProfileCorrection
end
section
/-! The actual single-coordinate dependency-breaking reveal distribution.
The tag records which endpoint of the question pair was revealed. -/
namespace UniqueGamesTheorem.Foundations.Repetition
open scoped BigOperators
open Games Information
noncomputable section
variable {X Y : Type*} [Fintype X] [Fintype Y] [DecidableEq X] [DecidableEq Y]
def revealEndpoint (q : X × Y) (side : Bool) : X ⊕ Y :=
if side then Sum.inr q.2 else Sum.inl q.1
/-- Independently reveal either endpoint with probability one half. -/
def revealLaw (μ : FiniteDistribution (X × Y)) :
FiniteDistribution ((X × Y) × (X ⊕ Y)) :=
(μ.product (FiniteDistribution.uniform Bool)).pushforward
(fun z => (z.1, revealEndpoint z.1 z.2))
theorem revealLaw_weight (μ : FiniteDistribution (X × Y)) (q : X × Y) (r : X ⊕ Y) :
(revealLaw μ).weight (q,r) =
(if r = Sum.inl q.1 then μ.weight q / 2 else 0) +
(if r = Sum.inr q.2 then μ.weight q / 2 else 0) := by
classical
rcases q with ⟨x,y⟩
simp only [revealLaw, FiniteDistribution.pushforward, FiniteDistribution.product,
Fintype.sum_prod_type, Prod.mk.injEq, ite_and]
simp [revealEndpoint, FiniteDistribution.uniform, div_eq_mul_inv, add_comm, eq_comm]
def revealFirstLaw (μ : FiniteDistribution (X × Y)) :
FiniteDistribution ((X ⊕ Y) × (X × Y)) :=
(revealLaw μ).transport (Equiv.prodComm _ _)
omit [DecidableEq X] [DecidableEq Y] in
@[simp] theorem revealFirstLaw_weight (μ : FiniteDistribution (X × Y))
(r : X ⊕ Y) (q : X × Y) :
(revealFirstLaw μ).weight (r,q) = (revealLaw μ).weight (q,r) := rfl
/-- The default row still preserves the displayed endpoint if that endpoint
has zero probability in the base question law. -/
def revealFallback (μ : FiniteDistribution (X × Y)) (r : X ⊕ Y) :
FiniteDistribution (X × Y) :=
match r with
| Sum.inl x => μ.pushforward (fun q => (x,q.2))
| Sum.inr y => μ.pushforward (fun q => (q.1,y))
def revealProfile (μ : FiniteDistribution (X × Y)) (r : X ⊕ Y) :
FiniteDistribution (X × Y) :=
gameConditionalKernel (revealFirstLaw μ) (revealFallback μ r) r
theorem revealProfile_inl_support (μ : FiniteDistribution (X × Y))
(x : X) (q : X × Y) (h : q.1 ≠ x) :
(revealProfile μ (Sum.inl x)).weight q = 0 := by
classical
rcases q with ⟨x',y⟩
dsimp at h
simp only [revealProfile, gameConditionalKernel, toGameLaw, conditionalKernel]
split
· simp [revealFallback, FiniteDistribution.pushforward, Fintype.sum_prod_type,
Prod.mk.injEq, Ne.symm h]
· simp [revealLaw_weight, Ne.symm h]
theorem revealProfile_inr_support (μ : FiniteDistribution (X × Y))
(y : Y) (q : X × Y) (h : q.2 ≠ y) :
(revealProfile μ (Sum.inr y)).weight q = 0 := by
classical
rcases q with ⟨x,y'⟩
dsimp at h
simp only [revealProfile, gameConditionalKernel, toGameLaw, conditionalKernel]
split
· simp [revealFallback, FiniteDistribution.pushforward, Fintype.sum_prod_type,
Prod.mk.injEq, Ne.symm h]
· simp [revealLaw_weight, Ne.symm h]
def revealInputLaw (μ : FiniteDistribution (X × Y)) : FiniteDistribution (X ⊕ Y) :=
(revealLaw μ).pushforward Prod.snd
theorem revealInputLaw_weight (μ : FiniteDistribution (X × Y)) (r : X ⊕ Y) :
(revealInputLaw μ).weight r = firstMarginal (revealFirstLaw μ).weight r := by
classical
cases r <;>
simp [revealInputLaw, FiniteDistribution.pushforward, firstMarginal, Fintype.sum_prod_type]
/-- The conditional product representation is proved from the sampled law,
including reveal values with zero probability. -/
theorem reveal_profile_recombination (μ : FiniteDistribution (X × Y))
(r : X ⊕ Y) (q : X × Y) :
(revealInputLaw μ).weight r * (revealProfile μ r).weight q =
(revealLaw μ).weight (q,r) := by
rw [revealInputLaw_weight]
exact gameConditionalKernel_recombine (revealFirstLaw μ) (revealFallback μ r) r q
theorem reveal_profile_inl_recombination (μ : FiniteDistribution (X × Y))
(x : X) (q : X × Y) :
(revealInputLaw μ).weight (Sum.inl x) * (revealProfile μ (Sum.inl x)).weight q =
if x = q.1 then μ.weight q / 2 else 0 := by
rw [reveal_profile_recombination, revealLaw_weight]
simp
theorem reveal_profile_inr_recombination (μ : FiniteDistribution (X × Y))
(y : Y) (q : X × Y) :
(revealInputLaw μ).weight (Sum.inr y) * (revealProfile μ (Sum.inr y)).weight q =
if y = q.2 then μ.weight q / 2 else 0 := by
rw [reveal_profile_recombination, revealLaw_weight]
simp
theorem revealInputLaw_inl (μ : FiniteDistribution (X × Y)) (x : X) :
(revealInputLaw μ).weight (Sum.inl x) = (∑ y, μ.weight (x,y)) / 2 := by
classical
rw [revealInputLaw_weight]
simp [firstMarginal, Fintype.sum_prod_type, revealLaw_weight, div_eq_mul_inv]
rw [Finset.sum_comm]
simp [← Finset.sum_mul]
theorem revealInputLaw_inr (μ : FiniteDistribution (X × Y)) (y : Y) :
(revealInputLaw μ).weight (Sum.inr y) = (∑ x, μ.weight (x,y)) / 2 := by
classical
rw [revealInputLaw_weight]
simp [firstMarginal, Fintype.sum_prod_type, revealLaw_weight,
div_eq_mul_inv, ← Finset.sum_mul]
theorem revealProfile_inl_diagonal (μ : FiniteDistribution (X × Y)) (x : X) (y : Y) :
(revealProfile μ (Sum.inl x)).weight (x,y) =
conditionalKernel μ.weight (μ.pushforward Prod.snd).weight x y := by
classical
have hm : firstMarginal (revealFirstLaw μ).weight (Sum.inl x) =
firstMarginal μ.weight x / 2 := by
rw [← revealInputLaw_weight, revealInputLaw_inl]
rfl
have hf : (revealFallback μ (Sum.inl x)).weight (x,y) =
(μ.pushforward Prod.snd).weight y := by
simp [revealFallback, FiniteDistribution.pushforward, Prod.mk.injEq]
apply Finset.sum_congr rfl
intro q _
by_cases hq : q.2 = y <;> simp [hq]
simp only [revealProfile, gameConditionalKernel, toGameLaw, conditionalKernel, hm]
by_cases h : firstMarginal μ.weight x = 0
· simpa [h] using hf
· have hh : firstMarginal μ.weight x / 2 ≠ 0 := div_ne_zero h (by norm_num)
simp only [ite_eq_right h, ite_eq_right hh, revealFirstLaw_weight, revealLaw_weight,
ite_true, Sum.inl_ne_inr, ite_false, add_zero]
field_simp
theorem revealProfile_inr_diagonal (μ : FiniteDistribution (X × Y)) (x : X) (y : Y) :
(revealProfile μ (Sum.inr y)).weight (x,y) =
conditionalKernel (μ.transport (Equiv.prodComm X Y)).weight
(μ.pushforward Prod.fst).weight y x := by
classical
have hm : firstMarginal (revealFirstLaw μ).weight (Sum.inr y) =
firstMarginal (μ.transport (Equiv.prodComm X Y)).weight y / 2 := by
rw [← revealInputLaw_weight, revealInputLaw_inr]
rfl
have hf : (revealFallback μ (Sum.inr y)).weight (x,y) =
(μ.pushforward Prod.fst).weight x := by
simp [revealFallback, FiniteDistribution.pushforward, Prod.mk.injEq]
apply Finset.sum_congr rfl
intro q _
by_cases hq : q.1 = x <;> simp [hq]
simp only [revealProfile, gameConditionalKernel, toGameLaw, conditionalKernel, hm]
by_cases h : firstMarginal (μ.transport (Equiv.prodComm X Y)).weight y = 0
· simpa [h] using hf
· have hh : firstMarginal (μ.transport (Equiv.prodComm X Y)).weight y / 2 ≠ 0 :=
div_ne_zero h (by norm_num)
simp only [ite_eq_right h, ite_eq_right hh, revealFirstLaw_weight, revealLaw_weight,
ite_true, Sum.inr_ne_inl, ite_false, zero_add]
change (μ.weight (x,y) / 2) / (firstMarginal (μ.transport (Equiv.prodComm X Y)).weight y / 2) =
μ.weight (x,y) / firstMarginal (μ.transport (Equiv.prodComm X Y)).weight y
field_simp
theorem revealLaw_sum_left (μ : FiniteDistribution (X × Y)) (q : X × Y) :
(∑ x, (revealLaw μ).weight (q, Sum.inl x)) = μ.weight q / 2 := by
classical
simp [revealLaw_weight]
theorem revealLaw_sum_right (μ : FiniteDistribution (X × Y)) (q : X × Y) :
(∑ y, (revealLaw μ).weight (q, Sum.inr y)) = μ.weight q / 2 := by
classical
simp [revealLaw_weight]
theorem revealLaw_forget (μ : FiniteDistribution (X × Y)) :
(revealLaw μ).pushforward Prod.fst = μ := by
classical
apply FiniteDistribution.eq_of_weight_eq
intro q
rcases q with ⟨x,y⟩
simp [FiniteDistribution.pushforward, Fintype.sum_prod_type,
Finset.sum_ite_irrel, revealLaw_weight]
/-- A conditional product of independently revealed coordinates has its
exact point weight. This is the product identity used by the information
bound, derived from the single-coordinate sampled distribution. -/
theorem reveal_product_factorization {ι : Type*} [Fintype ι]
(μ : FiniteDistribution (X × Y)) (r : ι → X ⊕ Y) (q : ι → X × Y) :
(∏ i, (revealInputLaw μ).weight (r i)) *
(∏ i, (revealProfile μ (r i)).weight (q i)) =
∏ i, (revealLaw μ).weight (q i,r i) := by
rw [← Finset.prod_mul_distrib]
apply Finset.prod_congr rfl
intro i _
exact reveal_profile_recombination μ (r i) (q i)
theorem reveal_product_forget {ι : Type*} [Fintype ι] [DecidableEq ι]
(μ : FiniteDistribution (X × Y)) (q : ι → X × Y) :
(∑ r : ι → X ⊕ Y,
(∏ i, (revealInputLaw μ).weight (r i)) *
(∏ i, (revealProfile μ (r i)).weight (q i))) =
∏ i, μ.weight (q i) := by
classical
simp_rw [reveal_product_factorization]
calc
_ = ∏ i, ∑ r : X ⊕ Y, (revealLaw μ).weight (q i,r) :=
(Fintype.prod_sum (fun (i : ι) (r : X ⊕ Y) => (revealLaw μ).weight (q i,r))).symm
_ = _ := by
apply Finset.prod_congr rfl
intro i _
rw [Fintype.sum_sum_type, revealLaw_sum_left, revealLaw_sum_right]
ring
/-- Marginalizing the reveal variables restores the original independent
question law for every observable, including the selected-win likelihood. -/
theorem reveal_product_expectation {ι : Type*} [Fintype ι] [DecidableEq ι]
(μ : FiniteDistribution (X × Y)) (f : (ι → X × Y) → ℝ) :
(∑ r : ι → X ⊕ Y,
(∏ i, (revealInputLaw μ).weight (r i)) *
∑ q : ι → X × Y, (∏ i, (revealProfile μ (r i)).weight (q i)) * f q) =
∑ q : ι → X × Y, (∏ i, μ.weight (q i)) * f q := by
classical
simp_rw [Finset.mul_sum]
rw [Finset.sum_comm]
apply Finset.sum_congr rfl
intro q _
simp_rw [← mul_assoc, ← Finset.sum_mul]
rw [reveal_product_forget]
end
end UniqueGamesTheorem.Foundations.Repetition
end
section
namespace UniqueGamesTheorem.Foundations.Repetition
noncomputable def logTwo (x : ℝ) : ℝ := Real.log x / Real.log 2
@[simp] theorem logTwo_one : logTwo 1 = 0 := by simp [logTwo]
theorem logTwo_inv_le_of_half_pow_le {p : ℝ} (m : ℕ)
(h : (1 / 2 : ℝ) ^ m ≤ p) : logTwo (1 / p) ≤ m := by
have hp : 0 < p := (pow_pos (by norm_num : (0 : ℝ) < 1 / 2) m).trans_le h
have hlog := Real.log_le_log (pow_pos (by norm_num : (0 : ℝ) < 1 / 2) m) h
have hhalf : Real.log (1 / 2 : ℝ) = -Real.log 2 := by
rw [one_div, Real.log_inv]
rw [Real.log_pow, hhalf] at hlog
unfold logTwo
rw [one_div, Real.log_inv]
apply (div_le_iff₀ (Real.log_pos (by norm_num : (1 : ℝ) < 2))).2
nlinarith
/-- A nonzero step below the cutoff contracts by `(1+v)/2`. -/
theorem contraction_step {v ell : ℝ} {n m : ℕ} {p next : ℝ}
(hv0 : 0 ≤ v) (hv1 : v < 1) (hell : 1 ≤ ell)
(hm : 1 ≤ m) (hmn : m < n) (hp : 0 ≤ p)
(hmono : next ≤ p)
(hprev : p ≤ ((1 + v) / 2) ^ m)
(hcut : 2700 * (m : ℝ) * ell ≤ (1 - v) ^ 2 * ((n : ℝ) - m))
(hstep : next ≤ p * (v + 15 * Real.sqrt
(((m : ℝ) * ell + logTwo (1 / p)) / ((n : ℝ) - m)))) :
next ≤ ((1 + v) / 2) ^ (m + 1) := by
by_cases hsmall : p ≤ ((1 + v) / 2) ^ (m + 1)
· exact hmono.trans hsmall
have hq : (1 / 2 : ℝ) ≤ (1 + v) / 2 := by linarith
have hhalf : (1 / 2 : ℝ) ^ (m + 1) ≤ p :=
(pow_le_pow_left₀ (by norm_num) hq (m + 1)).trans (le_of_not_ge hsmall)
have hlog := logTwo_inv_le_of_half_pow_le (m + 1) hhalf
have hmreal : (1 : ℝ) ≤ m := by exact_mod_cast hm
have hden : 0 < (n : ℝ) - m := by
have hmnreal : (m : ℝ) < n := by exact_mod_cast hmn
linarith
have hmell : (m : ℝ) ≤ (m : ℝ) * ell := by nlinarith
have hbudget : (m : ℝ) * ell + logTwo (1 / p) ≤ 3 * (m : ℝ) * ell := by
simp only [Nat.cast_add, Nat.cast_one] at hlog
nlinarith
have hsqrt : Real.sqrt
(((m : ℝ) * ell + logTwo (1 / p)) / ((n : ℝ) - m)) ≤ (1 - v) / 30 := by
apply (Real.sqrt_le_left (by linarith : 0 ≤ (1 - v) / 30)).2
apply (div_le_iff₀ hden).2
nlinarith
have hfactor : v + 15 * Real.sqrt
(((m : ℝ) * ell + logTwo (1 / p)) / ((n : ℝ) - m)) ≤ (1 + v) / 2 := by
linarith
calc
next ≤ p * (v + 15 * Real.sqrt
(((m : ℝ) * ell + logTwo (1 / p)) / ((n : ℝ) - m))) := hstep
_ ≤ p * ((1 + v) / 2) := mul_le_mul_of_nonneg_left hfactor hp
_ ≤ ((1 + v) / 2) ^ m * ((1 + v) / 2) :=
mul_le_mul_of_nonneg_right hprev (by linarith)
_ = ((1 + v) / 2) ^ (m + 1) := (pow_succ _ _).symm
/-- The `m=0` case does not use the estimate `m+1 ≤ 2*m*ell`. -/
theorem initial_step {v ell next : ℝ} {n : ℕ}
(hstep : next ≤ 1 * (v + 15 * Real.sqrt
(((0 : ℝ) * ell + logTwo (1 / 1)) / ((n : ℝ) - 0)))) :
next ≤ v := by simpa using hstep
/-- A real cutoff gives a valid step at every integer strictly below it. -/
theorem cutoff_step {v ell : ℝ} {n m : ℕ}
(hv0 : 0 ≤ v) (hv1 : v < 1) (hell : 1 ≤ ell)
(hm : (m : ℝ) < (n : ℝ) * (1 - v) ^ 2 / (2925 * ell)) :
2700 * (m : ℝ) * ell ≤ (1 - v) ^ 2 * ((n : ℝ) - m) := by
have hell0 : 0 < ell := by linarith
have hd : (1 - v) ^ 2 ≤ 1 := by nlinarith
have hmul : (m : ℝ) * (2925 * ell) < (n : ℝ) * (1 - v) ^ 2 :=
(lt_div_iff₀ (by positivity : 0 < 2925 * ell)).1 hm
have hdell : (1 - v) ^ 2 ≤ 225 * ell := by linarith
have hprod := mul_le_mul_of_nonneg_left hdell (Nat.cast_nonneg m : (0 : ℝ) ≤ m)
nlinarith
theorem cutoff_le_length {v ell : ℝ} (n : ℕ)
(hv0 : 0 ≤ v) (hv1 : v < 1) (hell : 1 ≤ ell) :
(n : ℝ) * (1 - v) ^ 2 / (2925 * ell) ≤ n := by
have hell0 : 0 < ell := by linarith
apply (div_le_iff₀ (by positivity : 0 < 2925 * ell)).2
have hd : (1 - v) ^ 2 ≤ 2925 * ell := by nlinarith
nlinarith [mul_le_mul_of_nonneg_left hd (Nat.cast_nonneg n : (0 : ℝ) ≤ n)]
/-- The explicit recurrence obtained from a `15*sqrt` embedding error. -/
def ScalarRecurrence (p : ℕ → ℝ) (n : ℕ) (v ell : ℝ) : Prop :=
∀ m, m < n → p (m + 1) ≤ p m * (v + 15 * Real.sqrt
(((m : ℝ) * ell + logTwo (1 / p m)) / ((n : ℝ) - m)))
/-- Induction to the ceiling of the real cutoff repairs the integer-rounding
omission in the printed scalar proof. -/
theorem decay_to_cutoff (p : ℕ → ℝ) (n : ℕ) {v ell : ℝ}
(hv0 : 0 ≤ v) (hv1 : v < 1) (hell : 1 ≤ ell)
(hp0 : p 0 = 1) (hpnonneg : ∀ m, 0 ≤ p m)
(hpmono : Antitone p) (hrec : ScalarRecurrence p n v ell) :
p n ≤ ((1 + v) / 2) ^
((n : ℝ) * (1 - v) ^ 2 / (2925 * ell)) := by
let T : ℝ := (n : ℝ) * (1 - v) ^ 2 / (2925 * ell)
let M : ℕ := Nat.ceil T
have hMn : M ≤ n := Nat.ceil_le.mpr (cutoff_le_length n hv0 hv1 hell)
have hind : ∀ m, m ≤ M → p m ≤ ((1 + v) / 2) ^ m := by
intro m
induction m with
| zero => intro _; simp [hp0]
| succ m ih =>
intro hmM
have hmM' : m < M := Nat.lt_of_succ_le hmM
have hmn : m < n := hmM'.trans_le hMn
have hprev := ih (Nat.le_of_lt hmM')
by_cases hm0 : m = 0
· subst m
have hinit : p 1 ≤ v := by
have hs := hrec 0 hmn
simpa [hp0] using hs
simpa using hinit.trans (by linarith : v ≤ (1 + v) / 2)
· have hmT : (m : ℝ) < T := Nat.lt_ceil.mp hmM'
exact contraction_step hv0 hv1 hell (Nat.one_le_iff_ne_zero.mpr hm0)
hmn (hpnonneg m) (hpmono (Nat.le_succ m)) hprev
(cutoff_step hv0 hv1 hell hmT) (hrec m hmn)
have hq0 : 0 < (1 + v) / 2 := by linarith
have hq1 : (1 + v) / 2 ≤ 1 := by linarith
calc
p n ≤ p M := hpmono hMn
_ ≤ ((1 + v) / 2) ^ M := hind M le_rfl
_ = ((1 + v) / 2) ^ (M : ℝ) := (Real.rpow_natCast _ _).symm
_ ≤ ((1 + v) / 2) ^ T :=
Real.rpow_le_rpow_of_exponent_ge hq0 hq1 (Nat.le_ceil T)
/-- The loss in one real-power block is cubic in the initial gap. -/
theorem block_contraction {v : ℝ} (hv0 : 0 ≤ v) (hv1 : v < 1) :
((1 + v) / 2) ^ ((1 - v) ^ 2 / 2925 : ℝ) ≤
1 - (1 - v) ^ 3 / 5850 := by
have hd : (1 - v) ^ 2 ≤ 1 := by nlinarith
have hb := rpow_one_add_le_one_add_mul_self
(s := -(1 - v) / 2) (p := (1 - v) ^ 2 / 2925)
(by linarith) (by positivity) (by nlinarith)
have hbase : 1 + -(1 - v) / 2 = (1 + v) / 2 := by ring
have hrhs : 1 + (1 - v) ^ 2 / 2925 * (-(1 - v) / 2) =
1 - (1 - v) ^ 3 / 5850 := by ring
rwa [hbase, hrhs] at hb
/-- Numerical endpoint of Holenstein's recurrence, with the published constant
6000. This theorem assumes only a concrete scalar recurrence, not any game
value bound. The derivation of that recurrence for games is separate. -/
theorem scalar_bound_6000 (p : ℕ → ℝ) (n : ℕ) {v ell : ℝ}
(hv0 : 0 ≤ v) (hv1 : v < 1) (hell : 1 ≤ ell)
(hp0 : p 0 = 1) (hpnonneg : ∀ m, 0 ≤ p m)
(hpmono : Antitone p) (hrec : ScalarRecurrence p n v ell) :
p n ≤ (1 - (1 - v) ^ 3 / 6000) ^ ((n : ℝ) / ell) := by
have hell0 : 0 < ell := by linarith
have hq0 : 0 ≤ (1 + v) / 2 := by linarith
have hexp : 0 ≤ (n : ℝ) / ell := by positivity
have hblock := block_contraction hv0 hv1
have hweak : 1 - (1 - v) ^ 3 / 5850 ≤ 1 - (1 - v) ^ 3 / 6000 := by
have : 0 ≤ (1 - v) ^ 3 := by positivity
nlinarith
calc
p n ≤ ((1 + v) / 2) ^
((n : ℝ) * (1 - v) ^ 2 / (2925 * ell)) :=
decay_to_cutoff p n hv0 hv1 hell hp0 hpnonneg hpmono hrec
_ = (((1 + v) / 2) ^ ((1 - v) ^ 2 / 2925 : ℝ)) ^ ((n : ℝ) / ell) := by
rw [← Real.rpow_mul hq0]
congr 1
ring
_ ≤ (1 - (1 - v) ^ 3 / 6000) ^ ((n : ℝ) / ell) :=
Real.rpow_le_rpow (Real.rpow_nonneg hq0 _) (hblock.trans hweak) hexp
noncomputable def incidenceRate : ℝ := 1 - 1 / (100000 * 192 ^ 3)
theorem incidenceRate_pos : 0 < incidenceRate := by norm_num [incidenceRate]
theorem incidenceRate_lt_one : incidenceRate < 1 := by norm_num [incidenceRate]
/-- Exact rational arithmetic verifies the fourth-power comparison. -/
theorem incidenceRate_fourth :
1 - (1 / 192 : ℝ) ^ 3 / 6000 ≤ incidenceRate ^ 4 := by
norm_num [incidenceRate]
/-- Converting the real exponent `n/4` to an integral power loses only the
explicit slack already built into `incidenceRate`. -/
theorem incidence_rate_comparison (n : ℕ) :
(1 - (1 / 192 : ℝ) ^ 3 / 6000) ^ ((n : ℝ) / 4) ≤ incidenceRate ^ n := by
calc
(1 - (1 / 192 : ℝ) ^ 3 / 6000) ^ ((n : ℝ) / 4)
≤ (incidenceRate ^ 4) ^ ((n : ℝ) / 4) :=
Real.rpow_le_rpow (by norm_num) incidenceRate_fourth (by positivity)
_ = incidenceRate ^ ((4 : ℝ) * ((n : ℝ) / 4)) :=
(Real.rpow_natCast_mul incidenceRate_pos.le 4 ((n : ℝ) / 4)).symm
_ = incidenceRate ^ (n : ℝ) := by congr 1; ring
_ = incidenceRate ^ n := Real.rpow_natCast _ _
/-- The incidence-game rate follows from its concrete scalar recurrence.
The game-to-recurrence proof is deliberately not hidden in this statement. -/
theorem scalar_incidence_bound (p : ℕ → ℝ) (n : ℕ) {v : ℝ}
(hv : v ≤ 1 - (1 / 192 : ℝ))
(hp0 : p 0 = 1) (hpnonneg : ∀ m, 0 ≤ p m)
(hpmono : Antitone p) (hrec : ScalarRecurrence p n v 4) :
p n ≤ incidenceRate ^ n := by
have hrec' : ScalarRecurrence p n (1 - (1 / 192 : ℝ)) 4 := by
intro m hm
exact (hrec m hm).trans (mul_le_mul_of_nonneg_left (by linarith) (hpnonneg m))
have hbound := scalar_bound_6000 p n
(v := 1 - (1 / 192 : ℝ)) (ell := 4)
(by norm_num) (by norm_num) (by norm_num) hp0 hpnonneg hpmono hrec'
norm_num only [sub_sub_cancel] at hbound
have hcomparison := incidence_rate_comparison n
norm_num at hcomparison
exact hbound.trans hcomparison
end UniqueGamesTheorem.Foundations.Repetition
end
end OAI

Xet Storage Details

Size:
38.9 kB
·
Xet hash:
59f1aa67b17aaeacf6d5646999da4a22142d96417f381ea23a109a22ebe54043

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