File size: 8,653 Bytes
2f887db | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | import OAI.Computability.UniqueGames.Foundations.SamplingLemmas
import OAI.Computability.UniqueGames.Foundations.ValueLemmas
import OAI.Computability.UniqueGames.Games.FinishBoundsLemmas
namespace OAI
namespace PerfectCompleteness
open UniqueGamesTheorem.Foundations.Games
open scoped BigOperators
noncomputable section
structure OccurrenceGame (E Q₁ Q₂ A₁ A₂ : Type*)
[Fintype E] [Fintype Q₁] [Fintype Q₂] [Fintype A₁] [Fintype A₂] where
occurrences : FiniteDistribution E
left : E → Q₁
right : E → Q₂
accepts : E → A₁ → A₂ → Bool
namespace OccurrenceGame
variable {E Q₁ Q₂ A₁ A₂ : Type*}
[Fintype E] [Fintype Q₁] [Fintype Q₂] [Fintype A₁] [Fintype A₂]
def ofProjection (μ : FiniteDistribution E) (left : E → Q₁) (right : E → Q₂)
(projection : E → A₁ → A₂) : OccurrenceGame E Q₁ Q₂ A₁ A₂ := by
classical
exact
{ occurrences := μ
left := left
right := right
accepts := fun e a b => decide (projection e a = b) }
def endpoints (G : OccurrenceGame E Q₁ Q₂ A₁ A₂) (e : E) : Q₁ × Q₂ :=
(G.left e, G.right e)
def wins (G : OccurrenceGame E Q₁ Q₂ A₁ A₂)
(strategy : Strategy Q₁ Q₂ A₁ A₂) (e : E) : Bool :=
G.accepts e (strategy.1 (G.left e)) (strategy.2 (G.right e))
def success (G : OccurrenceGame E Q₁ Q₂ A₁ A₂)
(strategy : Strategy Q₁ Q₂ A₁ A₂) : ℝ :=
G.occurrences.probability (G.wins strategy)
theorem success_nonnegative (G : OccurrenceGame E Q₁ Q₂ A₁ A₂)
(strategy : Strategy Q₁ Q₂ A₁ A₂) : 0 ≤ G.success strategy :=
G.occurrences.probability_nonnegative _
theorem success_le_one (G : OccurrenceGame E Q₁ Q₂ A₁ A₂)
(strategy : Strategy Q₁ Q₂ A₁ A₂) : G.success strategy ≤ 1 :=
G.occurrences.probability_le_one _
structure EndpointPresentation (G : OccurrenceGame E Q₁ Q₂ A₁ A₂) where
predicate : Q₁ → Q₂ → A₁ → A₂ → Bool
agrees : ∀ e a b, G.accepts e a b = predicate (G.left e) (G.right e) a b
def EndpointDetermined (G : OccurrenceGame E Q₁ Q₂ A₁ A₂) : Prop :=
∀ e e', G.left e = G.left e' → G.right e = G.right e' →
∀ a b, G.accepts e a b = G.accepts e' a b
private def chosenEndpointPredicate (G : OccurrenceGame E Q₁ Q₂ A₁ A₂)
(x : Q₁) (y : Q₂) (a : A₁) (b : A₂) : Bool := by
classical
exact if h : ∃ e, G.left e = x ∧ G.right e = y then
G.accepts (Classical.choose h) a b
else false
def presentationOfDetermined (G : OccurrenceGame E Q₁ Q₂ A₁ A₂)
(h : G.EndpointDetermined) : G.EndpointPresentation where
predicate := chosenEndpointPredicate G
agrees e a b := by
have hex : ∃ e', G.left e' = G.left e ∧ G.right e' = G.right e :=
⟨e, rfl, rfl⟩
simp only [chosenEndpointPredicate, dite_eq_left hex]
exact h e (Classical.choose hex) (Classical.choose_spec hex).1.symm
(Classical.choose_spec hex).2.symm a b
theorem EndpointPresentation.determined (G : OccurrenceGame E Q₁ Q₂ A₁ A₂)
(p : G.EndpointPresentation) : G.EndpointDetermined := by
intro e e' hl hr a b
rw [p.agrees, p.agrees, hl, hr]
def toGame (G : OccurrenceGame E Q₁ Q₂ A₁ A₂)
(p : G.EndpointPresentation) : Game Q₁ Q₂ A₁ A₂ where
questions := G.occurrences.pushforward G.endpoints
accepts := p.predicate
@[simp] theorem toGame_success (G : OccurrenceGame E Q₁ Q₂ A₁ A₂)
(p : G.EndpointPresentation) (strategy : Strategy Q₁ Q₂ A₁ A₂) :
(G.toGame p).success strategy = G.success strategy := by
unfold Game.success OccurrenceGame.success toGame
rw [FiniteDistribution.probability_pushforward]
congr 1
funext e
exact (p.agrees e (strategy.1 (G.left e)) (strategy.2 (G.right e))).symm
def repetition (G : OccurrenceGame E Q₁ Q₂ A₁ A₂) (n : Nat) :
OccurrenceGame (Fin n → E) (Fin n → Q₁) (Fin n → Q₂)
(Fin n → A₁) (Fin n → A₂) := by
classical
exact
{ occurrences := G.occurrences.iid n
left := fun e i => G.left (e i)
right := fun e i => G.right (e i)
accepts := fun e a b => decide (∀ i, G.accepts (e i) (a i) (b i) = true) }
def EndpointPresentation.repetition (G : OccurrenceGame E Q₁ Q₂ A₁ A₂)
(p : G.EndpointPresentation) (n : Nat) : (G.repetition n).EndpointPresentation := by
classical
exact
{ predicate := fun x y a b => decide (∀ i, p.predicate (x i) (y i) (a i) (b i) = true)
agrees := by
intro e a b
simp only [OccurrenceGame.repetition, p.agrees] }
theorem toGame_repetition_questions (G : OccurrenceGame E Q₁ Q₂ A₁ A₂)
(p : G.EndpointPresentation) (n : Nat) :
((G.toGame p).repetition n).questions =
(G.occurrences.iid n).pushforward (G.repetition n).endpoints := by
change ((G.occurrences.pushforward G.endpoints).iid n).transport
(Game.tupleQuestionEquiv n) = _
rw [FiniteDistribution.iid_pushforward, FiniteDistribution.transport_eq_pushforward,
FiniteDistribution.pushforward_comp]
rfl
theorem toGame_repetition_success (G : OccurrenceGame E Q₁ Q₂ A₁ A₂)
(p : G.EndpointPresentation) (n : Nat)
(strategy : Strategy (Fin n → Q₁) (Fin n → Q₂) (Fin n → A₁) (Fin n → A₂)) :
((G.toGame p).repetition n).success strategy = (G.repetition n).success strategy := by
classical
unfold Game.success OccurrenceGame.success
rw [G.toGame_repetition_questions p n, FiniteDistribution.probability_pushforward]
congr 1
funext e
simp only [Game.wins, Game.repetition, toGame, OccurrenceGame.repetition,
endpoints, wins, p.agrees]
rfl
variable [Nonempty A₁] [Nonempty A₂]
def value (G : OccurrenceGame E Q₁ Q₂ A₁ A₂) : ℝ := by
classical
exact Finset.univ.sup' Finset.univ_nonempty G.success
theorem success_le_value (G : OccurrenceGame E Q₁ Q₂ A₁ A₂)
(strategy : Strategy Q₁ Q₂ A₁ A₂) : G.success strategy ≤ G.value := by
classical
exact Finset.le_sup' G.success (Finset.mem_univ strategy)
theorem value_le_iff (G : OccurrenceGame E Q₁ Q₂ A₁ A₂) (bound : ℝ) :
G.value ≤ bound ↔ ∀ strategy : Strategy Q₁ Q₂ A₁ A₂, G.success strategy ≤ bound := by
classical
simp [value, Finset.sup'_le_iff]
theorem exists_optimal_strategy (G : OccurrenceGame E Q₁ Q₂ A₁ A₂) :
∃ strategy : Strategy Q₁ Q₂ A₁ A₂, G.success strategy = G.value := by
classical
obtain ⟨strategy, _, h⟩ := Finset.exists_mem_eq_sup'
(s := (Finset.univ : Finset (Strategy Q₁ Q₂ A₁ A₂))) Finset.univ_nonempty G.success
exact ⟨strategy, h.symm⟩
theorem value_nonnegative (G : OccurrenceGame E Q₁ Q₂ A₁ A₂) : 0 ≤ G.value := by
obtain ⟨strategy, h⟩ := G.exists_optimal_strategy
rw [← h]
exact G.success_nonnegative strategy
theorem value_le_one (G : OccurrenceGame E Q₁ Q₂ A₁ A₂) : G.value ≤ 1 :=
(G.value_le_iff 1).2 G.success_le_one
theorem randomized_success_le_value (G : OccurrenceGame E Q₁ Q₂ A₁ A₂)
{Seed : Type*} [Fintype Seed] (seedLaw : FiniteDistribution Seed)
(strategies : Seed → Strategy Q₁ Q₂ A₁ A₂) :
seedLaw.expectation (fun seed => G.success (strategies seed)) ≤ G.value := by
unfold FiniteDistribution.expectation
calc
_ ≤ ∑ seed, seedLaw.weight seed * G.value := by
apply Finset.sum_le_sum
intro seed _
exact mul_le_mul_of_nonneg_left (G.success_le_value _) (seedLaw.nonnegative seed)
_ = G.value := by rw [← Finset.sum_mul, seedLaw.normalized, one_mul]
@[simp] theorem toGame_value (G : OccurrenceGame E Q₁ Q₂ A₁ A₂)
(p : G.EndpointPresentation) : (G.toGame p).value = G.value := by
apply le_antisymm
· apply ((G.toGame p).value_le_iff _).2
intro strategy
rw [G.toGame_success p strategy]
exact G.success_le_value strategy
· apply (G.value_le_iff _).2
intro strategy
rw [← G.toGame_success p strategy]
exact (G.toGame p).success_le_value strategy
theorem toGame_repetition_value (G : OccurrenceGame E Q₁ Q₂ A₁ A₂)
(p : G.EndpointPresentation) (n : Nat) :
((G.toGame p).repetition n).value = (G.repetition n).value := by
apply le_antisymm
· apply (((G.toGame p).repetition n).value_le_iff _).2
intro strategy
rw [G.toGame_repetition_success p n strategy]
exact (G.repetition n).success_le_value strategy
· apply ((G.repetition n).value_le_iff _).2
intro strategy
rw [← G.toGame_repetition_success p n strategy]
exact ((G.toGame p).repetition n).success_le_value strategy
end OccurrenceGame
end
end PerfectCompleteness
end OAI
|