math / data /lean /OAI /Computability /UniqueGames /Games /SelectionSequence.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
9.24 kB
import OAI.Computability.UniqueGames.Foundations.Conditioning
import OAI.Computability.UniqueGames.Foundations.ValueLemmas
import OAI.Computability.UniqueGames.Games.FactorizationLemmas
namespace OAI
section
namespace UniqueGamesTheorem.Foundations.Repetition.SelectionSequence
private theorem exists_unused {n : Nat} (S : Finset (Fin n)) (hcard : S.card < n) :
βˆƒ j : Fin n, j βˆ‰ S := by
classical
apply Classical.byContradiction
intro h
have hall : βˆ€ j : Fin n, j ∈ S := by
intro j
apply Classical.byContradiction
intro hj
exact h ⟨j, hj⟩
have hfull : S = Finset.univ :=
Finset.ext (fun j => iff_of_true (hall j) (Finset.mem_univ j))
have hbad : n < n := by
simpa only [hfull, Finset.card_univ, Fintype.card_fin] using hcard
exact Nat.lt_irrefl n hbad
/-- Insert a chosen unused coordinate while there are coordinates remaining. -/
noncomputable def nextSet {n : Nat}
(Step : Finset (Fin n) β†’ Fin n β†’ Prop)
(witness : βˆ€ S, S.card < n β†’ βˆƒ j, j βˆ‰ S ∧ Step S j)
(S : Finset (Fin n)) : Finset (Fin n) :=
if hs : S.card < n then insert (Classical.choose (witness S hs)) S else S
/-- A total sequence, constant after all `n` coordinates have been selected. -/
noncomputable def selectedSet {n : Nat}
(Step : Finset (Fin n) β†’ Fin n β†’ Prop)
(witness : βˆ€ S, S.card < n β†’ βˆƒ j, j βˆ‰ S ∧ Step S j) : Nat β†’ Finset (Fin n)
| 0 => βˆ…
| m + 1 => nextSet Step witness (selectedSet Step witness m)
theorem selectedSet_card {n : Nat}
(Step : Finset (Fin n) β†’ Fin n β†’ Prop)
(witness : βˆ€ S, S.card < n β†’ βˆƒ j, j βˆ‰ S ∧ Step S j) (m : Nat) :
(selectedSet Step witness m).card = min m n := by
induction m with
| zero => simp [selectedSet]
| succ m ih =>
by_cases hm : m < n
Β· have hc : (selectedSet Step witness m).card = m := by
simpa only [Nat.min_eq_left (Nat.le_of_lt hm)] using ih
have hs : (selectedSet Step witness m).card < n := by
simpa only [hc] using hm
rw [selectedSet, nextSet, dite_eq_left hs,
Finset.card_insert_of_notMem ((Classical.choose_spec (witness _ hs)).1),
hc, Nat.min_eq_left (Nat.succ_le_of_lt hm)]
Β· have hc : (selectedSet Step witness m).card = n := by
simpa only [Nat.min_eq_right (Nat.le_of_not_gt hm)] using ih
have hs : Β¬(selectedSet Step witness m).card < n := by
rw [hc]
exact Nat.not_lt.mpr (Nat.le_refl n)
rw [selectedSet, nextSet, dite_eq_right hs, hc,
Nat.min_eq_right (Nat.le_trans (Nat.le_of_not_gt hm) (Nat.le_succ m))]
theorem selectedSet_subset_succ {n : Nat}
(Step : Finset (Fin n) β†’ Fin n β†’ Prop)
(witness : βˆ€ S, S.card < n β†’ βˆƒ j, j βˆ‰ S ∧ Step S j) (m : Nat) :
selectedSet Step witness m βŠ† selectedSet Step witness (m + 1) := by
change selectedSet Step witness m βŠ† nextSet Step witness (selectedSet Step witness m)
unfold nextSet
split
Β· exact Finset.subset_insert _ _
Β· exact le_rfl
theorem selectedSet_monotone {n : Nat}
(Step : Finset (Fin n) β†’ Fin n β†’ Prop)
(witness : βˆ€ S, S.card < n β†’ βˆƒ j, j βˆ‰ S ∧ Step S j) :
Monotone (selectedSet Step witness) :=
monotone_nat_of_le_succ (selectedSet_subset_succ Step witness)
theorem selectedSet_univ {n : Nat}
(Step : Finset (Fin n) β†’ Fin n β†’ Prop)
(witness : βˆ€ S, S.card < n β†’ βˆƒ j, j βˆ‰ S ∧ Step S j) :
selectedSet Step witness n = Finset.univ := by
apply Finset.eq_of_subset_of_card_le (Finset.subset_univ _)
simp [selectedSet_card]
theorem selectedSet_step {n : Nat}
(Step : Finset (Fin n) β†’ Fin n β†’ Prop)
(witness : βˆ€ S, S.card < n β†’ βˆƒ j, j βˆ‰ S ∧ Step S j)
(m : Nat) (hm : m < n) :
βˆƒ j, j βˆ‰ selectedSet Step witness m ∧
selectedSet Step witness (m + 1) = insert j (selectedSet Step witness m) ∧
Step (selectedSet Step witness m) j := by
have hc : (selectedSet Step witness m).card = m := by
rw [selectedSet_card, Nat.min_eq_left (Nat.le_of_lt hm)]
have hs : (selectedSet Step witness m).card < n := by simpa only [hc] using hm
let j := Classical.choose (witness (selectedSet Step witness m) hs)
have hj := Classical.choose_spec (witness (selectedSet Step witness m) hs)
refine ⟨j, hj.1, ?_, hj.2⟩
simp only [selectedSet, nextSet, dite_eq_left hs, j]
/-- The multiplicative scalar inequality for one actual selected-set update. -/
def SetStep {n : Nat} (P : Finset (Fin n) β†’ ℝ) (v ell : ℝ)
(S : Finset (Fin n)) (j : Fin n) : Prop :=
P (insert j S) ≀ P S *
(v + 15 * Real.sqrt (((S.card : ℝ) * ell + logTwo (1 / P S)) /
((n : ℝ) - S.card)))
/-- At zero success, any unused coordinate is safe and no conditioning occurs. -/
theorem totalSetStep {n : Nat} (P : Finset (Fin n) β†’ ℝ) (v ell : ℝ)
(hnonneg : βˆ€ S, 0 ≀ P S) (hanti : Antitone P)
(hpositive : βˆ€ S, S.card < n β†’ 0 < P S β†’
βˆƒ j, j βˆ‰ S ∧ SetStep P v ell S j) :
βˆ€ S, S.card < n β†’ βˆƒ j, j βˆ‰ S ∧ SetStep P v ell S j := by
intro S hcard
by_cases hp : 0 < P S
Β· exact hpositive S hcard hp
· obtain ⟨j, hj⟩ := exists_unused S hcard
have hz : P S = 0 := le_antisymm (le_of_not_gt hp) (hnonneg S)
have hnext : P (insert j S) = 0 := le_antisymm
((hanti (Finset.subset_insert j S)).trans (le_of_eq hz)) (hnonneg (insert j S))
refine ⟨j, hj, ?_⟩
simpa only [SetStep, hnext, hz, zero_mul] using (le_refl (0 : ℝ))
/-- Construct the scalar sequence from actual selected-set probabilities. -/
theorem exists_scalar_sequence {n : Nat} (P : Finset (Fin n) β†’ ℝ) (v ell : ℝ)
(hempty : P βˆ… = 1) (hnonneg : βˆ€ S, 0 ≀ P S) (hanti : Antitone P)
(hpositive : βˆ€ S, S.card < n β†’ 0 < P S β†’
βˆƒ j, j βˆ‰ S ∧ SetStep P v ell S j) :
βˆƒ p : Nat β†’ ℝ, p 0 = 1 ∧ (βˆ€ m, 0 ≀ p m) ∧ Antitone p ∧
ScalarRecurrence p n v ell ∧ p n = P Finset.univ := by
let witness := totalSetStep P v ell hnonneg hanti hpositive
let sets := selectedSet (SetStep P v ell) witness
let p := fun m => P (sets m)
refine ⟨p, ?_, ?_, ?_, ?_, ?_⟩
Β· change P (selectedSet (SetStep P v ell) witness 0) = 1
simpa only [selectedSet] using hempty
Β· intro m
exact hnonneg (sets m)
Β· intro i j hij
exact hanti (selectedSet_monotone (SetStep P v ell) witness hij)
Β· intro m hm
obtain ⟨j, _, hnext, hbound⟩ :=
selectedSet_step (SetStep P v ell) witness m hm
have hc : (selectedSet (SetStep P v ell) witness m).card = m := by
rw [selectedSet_card, Nat.min_eq_left (Nat.le_of_lt hm)]
change P (selectedSet (SetStep P v ell) witness (m + 1)) ≀ _
rw [hnext]
simpa only [SetStep, hc] using hbound
Β· change P (selectedSet (SetStep P v ell) witness n) = P Finset.univ
rw [selectedSet_univ]
open UniqueGamesTheorem.Foundations.Games
section ActualGame
variable {Q₁ Qβ‚‚ A₁ Aβ‚‚ : Type*}
variable [Fintype Q₁] [Fintype Qβ‚‚] [Fintype A₁] [Fintype Aβ‚‚]
variable [Nonempty A₁] [Nonempty Aβ‚‚]
def ConditionalCoordinateBound (G : Game Q₁ Qβ‚‚ A₁ Aβ‚‚) (n : Nat)
(strategy : Strategy (Fin n β†’ Q₁) (Fin n β†’ Qβ‚‚) (Fin n β†’ A₁) (Fin n β†’ Aβ‚‚))
(ell : ℝ) : Prop :=
βˆ€ (S : Finset (Fin n)) (_hcard : S.card < n)
(hp : 0 < G.selectedSuccess strategy S),
βˆƒ j, j βˆ‰ S ∧
(((G.repetition n).questions.condition (G.selectedWins strategy S) hp).probability
(G.coordinateWin strategy j)) ≀
G.value + 15 * Real.sqrt
(((S.card : ℝ) * ell + logTwo (1 / G.selectedSuccess strategy S)) /
((n : ℝ) - S.card))
/-- Apply the proved scalar estimate to the success of an actual repeated-game
strategy. The conditional-coordinate bound is the sole game-theoretic premise. -/
theorem repetition_success_le_of_conditionalCoordinateBound
(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) (hv1 : v < 1) (hell : 1 ≀ ell)
(hcoordinate : ConditionalCoordinateBound G n strategy ell) :
(G.repetition n).success strategy ≀
(1 - (1 - v)^3 / 6000)^((n : ℝ) / ell) := by
have hpositive : βˆ€ S : Finset (Fin n), S.card < n β†’
0 < G.selectedSuccess strategy S β†’
βˆƒ j, j βˆ‰ S ∧ SetStep (G.selectedSuccess strategy) v ell S j := by
intro S hcard hp
obtain ⟨j, hj, hbound⟩ := hcoordinate S hcard hp
refine ⟨j, hj, ?_⟩
change G.selectedSuccess strategy (insert j S) ≀ _
rw [G.selectedSuccess_insert strategy S j hp]
exact mul_le_mul_of_nonneg_left
(hbound.trans (add_le_add hvalue (le_refl _))) (le_of_lt hp)
obtain ⟨p, hp0, hpnonneg, hpmono, hrec, hpn⟩ :=
exists_scalar_sequence (G.selectedSuccess strategy) v ell
(G.selectedSuccess_empty strategy) (G.selectedSuccess_nonnegative strategy)
(G.selectedSuccess_antitone strategy) hpositive
have hbound := scalar_bound_6000 p n
(G.value_nonnegative.trans hvalue) hv1 hell hp0 hpnonneg hpmono hrec
rw [hpn, G.selectedSuccess_univ strategy] at hbound
exact hbound
end ActualGame
end UniqueGamesTheorem.Foundations.Repetition.SelectionSequence
end
end OAI