File size: 7,337 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
import OAI.Computability.PerfectCompleteness.Foundations.OddLists
import OAI.Computability.PerfectCompleteness.Foundations.RecursiveSpaceEquivLemmas
import OAI.Computability.PerfectCompleteness.Repetition.RepetitionRateLemmas
import OAI.Computability.PerfectCompleteness.Sampling.FiniteListSampling

namespace OAI

section

namespace PerfectCompleteness.OddListGame

open scoped BigOperators
open UniqueGamesTheorem.Foundations.Games
open OddLists FiniteListSampling

noncomputable section

variable {E Q₁ Q₂ A₁ A₂ : Type*}
  [Fintype E] [Fintype Q₁] [Fintype Q₂] [Fintype A₁] [Fintype A₂]
  [DecidableEq Q₁] [DecidableEq Q₂] [DecidableEq A₁] [DecidableEq A₂]

def base (μ : FiniteDistribution E) (left : E → Q₁) (right : E → Q₂)
    (projection : E → A₁ → A₂) : OccurrenceGame E Q₁ Q₂ A₁ A₂ :=
  OccurrenceGame.ofProjection μ left right projection

def game (s : Nat) (μ : FiniteDistribution E) (left : E → Q₁) (right : E → Q₂)
    (projection : E → A₁ → A₂) :
    OccurrenceGame E Q₁ Q₂ (OddList s A₁) (OddList s A₂) :=
  OccurrenceGame.ofProjection μ left right (fun e => OddList.map (projection e))

def responses {Q A : Type*} [Fintype A] [DecidableEq A] {s : Nat}
    (lists : Q → OddList s A) (q : Q) : FiniteDistribution A :=
  uniformList (lists q).val (lists q).nonempty

omit [DecidableEq Q₁] [DecidableEq Q₂] [DecidableEq A₁] in
theorem accepted_pair {s : Nat} (μ : FiniteDistribution E)
    (left : E → Q₁) (right : E → Q₂) (projection : E → A₁ → A₂)
    (strategy : Strategy Q₁ Q₂ (OddList s A₁) (OddList s A₂)) (e : E)
    (accepted : (game s μ left right projection).wins strategy e = true) :
    ∃ a ∈ (strategy.1 (left e)).val, ∃ b ∈ (strategy.2 (right e)).val,
      (base μ left right projection).accepts e a b = true := by
  have hmap : OddList.map (projection e) (strategy.1 (left e)) = strategy.2 (right e) := by
    simpa only [game, OccurrenceGame.wins, OccurrenceGame.ofProjection, decide_eq_true_eq]
      using accepted
  obtain ⟨a, ha, b, hb, hab⟩ := OddList.exists_accepting_pair_of_eq
    (projection e) (strategy.1 (left e)) (strategy.2 (right e)) hmap
  exact ⟨a, ha, b, hb, by simpa [base, OccurrenceGame.ofProjection] using hab⟩

omit [DecidableEq Q₁] [DecidableEq Q₂] in
theorem success_le_randomized {s : Nat} [NeZero s] (μ : FiniteDistribution E)
    (left : E → Q₁) (right : E → Q₂) (projection : E → A₁ → A₂)
    (strategy : Strategy Q₁ Q₂ (OddList s A₁) (OddList s A₂)) :
    (game s μ left right projection).success strategy ≤
      (s : ℝ) ^ 2 * (base μ left right projection).stochasticSuccess
        (responses strategy.1) (responses strategy.2) := by
  let G := base μ left right projection
  let pair := fun e => pairAcceptance (responses strategy.1 (left e))
    (responses strategy.2 (right e)) (G.accepts e)
  have hs : 0 < (s : ℝ) ^ 2 := pow_pos (Nat.cast_pos.mpr (Nat.pos_of_neZero s)) 2
  have hpoint (e : E) :
      (if (game s μ left right projection).wins strategy e then (1 : ℝ) else 0) ≤
        (s : ℝ) ^ 2 * pair e := by
    by_cases hwin : (game s μ left right projection).wins strategy e = true
    · simp only [hwin, ite_true]
      have h := bounded_uniform_pair_lower
        (strategy.1 (left e)).val (strategy.2 (right e)).val
        (strategy.1 (left e)).nonempty (strategy.2 (right e)).nonempty s
        (strategy.1 (left e)).card_le (strategy.2 (right e)).card_le (G.accepts e)
        (accepted_pair μ left right projection strategy e hwin)
      have hscaled := (div_le_iff₀ hs).mp h
      change 1 ≤ (s : ℝ) ^ 2 *
        pairAcceptance (uniformList (strategy.1 (left e)).val (strategy.1 (left e)).nonempty)
          (uniformList (strategy.2 (right e)).val (strategy.2 (right e)).nonempty) (G.accepts e)
      exact hscaled.trans_eq (mul_comm _ _)
    · simp only [hwin]
      exact mul_nonneg (sq_nonneg _) (pairAcceptance_nonnegative _ _ _)
  have hpair : μ.expectation pair = G.stochasticSuccess
      (responses strategy.1) (responses strategy.2) := by
    unfold OccurrenceGame.stochasticSuccess
    apply FiniteDistribution.expectation_congr
    intro e
    exact pairAcceptance_eq_expectation _ _ _
  calc
    _ = μ.expectation
        (fun e => if (game s μ left right projection).wins strategy e then 1 else 0) :=
      (game s μ left right projection).success_eq_occurrence_expectation strategy
    _ ≤ μ.expectation (fun e => (s : ℝ) ^ 2 * pair e) :=
      SmallBias.expectation_mono μ hpoint
    _ = (s : ℝ) ^ 2 * μ.expectation pair := by
      simp only [FiniteDistribution.expectation, Finset.mul_sum]
      apply Finset.sum_congr rfl
      intro e _
      ring
    _ = _ := by rw [hpair]

theorem value_le {s : Nat} [NeZero s] [Nonempty A₁] [Nonempty A₂]
    (μ : FiniteDistribution E) (left : E → Q₁) (right : E → Q₂)
    (projection : E → A₁ → A₂) :
    (game s μ left right projection).value ≤
      (s : ℝ) ^ 2 * (base μ left right projection).value := by
  apply ((game s μ left right projection).value_le_iff _).mpr
  intro strategy
  exact (success_le_randomized μ left right projection strategy).trans
    (mul_le_mul_of_nonneg_left
      ((base μ left right projection).stochasticSuccess_le_value
        (responses strategy.1) (responses strategy.2)) (sq_nonneg _))

omit [DecidableEq Q₁] [DecidableEq Q₂] [DecidableEq A₁] in
theorem endpointDetermined {s : Nat} (μ : FiniteDistribution E)
    (left : E → Q₁) (right : E → Q₂) (projection : E → A₁ → A₂)
    (determined : (base μ left right projection).EndpointDetermined) :
    (game s μ left right projection).EndpointDetermined := by
  intro e e' hl hr L R
  have hprojection : projection e = projection e' := by
    funext a
    have h := determined e e' hl hr a (projection e a)
    have htrue : (base μ left right projection).accepts e' a (projection e a) = true := by
      rw [← h]
      simp [base, OccurrenceGame.ofProjection]
    have heq : projection e' a = projection e a := by
      simpa only [base, OccurrenceGame.ofProjection, decide_eq_true_eq] using htrue
    exact heq.symm
  simp only [game, OccurrenceGame.ofProjection, hprojection]
  by_cases h : OddList.map (projection e') L = R <;> simp only [h, decide_true, decide_false]

theorem repetition_halfRate {s L : Nat} [NeZero s] [Nonempty A₁] [Nonempty A₂]
    (μ : FiniteDistribution E) (left : E → Q₁) (right : E → Q₂)
    (projection : E → A₁ → A₂)
    (determined : (base μ left right projection).EndpointDetermined)
    (gap : (s : ℝ) ^ 2 * (base μ left right projection).value ≤ 1 / 2)
    (hL : 0 < L)
    (alphabet : UniqueGamesTheorem.Foundations.Repetition.logTwo
      ((Fintype.card (OddList s A₁) : ℝ) * (Fintype.card (OddList s A₂) : ℝ)) ≤ L)
    (n : Nat) :
    ((game s μ left right projection).repetition n).value ≤
      (RepetitionRate.halfRate L : ℝ) ^ n := by
  exact RepetitionRate.occurrence_repetition_halfRate (game s μ left right projection)
    ((game s μ left right projection).presentationOfDetermined
      (endpointDetermined μ left right projection determined)) hL alphabet
    ((value_le μ left right projection).trans gap) n

end
end PerfectCompleteness.OddListGame

end

end OAI