math / data /lean /OAI /Computability /BinPacking /Games /GameConditioning.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
5.02 kB
import OAI.Computability.BinPacking.Games.Reindexing
namespace OAI
namespace BinPackingGames.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)
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 _))
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)
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
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 BinPackingGames.Foundations.Games.Game
end OAI