File size: 9,140 Bytes
4a56cd6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import Mathlib
import OAI.Combinatorics.IndependentSets.Repetition.Scalar
import OAI.Combinatorics.IndependentSets.Repetition.CoordinateCompletion

namespace OAI

noncomputable section

namespace IndependentSetsGames.Foundations.Repetition

section
open scoped BigOperators
open Games CorrelatedSampling
variable {Q₁ Qβ‚‚ A₁ Aβ‚‚ S : Type*}
  [Fintype Q₁] [Fintype Qβ‚‚] [Fintype A₁] [Fintype Aβ‚‚] [Fintype S]
  [Nonempty A₁] [Nonempty Aβ‚‚] [Nonempty S]
  [DecidableEq Q₁] [DecidableEq Qβ‚‚] [DecidableEq S] {n : Nat}

theorem coordinate_probability_le_value_of_local_completion
    (G : Game Q₁ Qβ‚‚ A₁ Aβ‚‚) (j : Fin n)
    (strategy : Strategy (Fin n β†’ Q₁) (Fin n β†’ Qβ‚‚) (Fin n β†’ A₁) (Fin n β†’ Aβ‚‚))
    (Οƒ : FiniteDistribution ((Q₁ Γ— Qβ‚‚) Γ— S))
    (profileL : Q₁ β†’ FiniteDistribution S) (profileR : Qβ‚‚ β†’ FiniteDistribution S)
    (completionL : Q₁ Γ— S β†’ FiniteDistribution (Fin n β†’ Q₁))
    (completionR : Qβ‚‚ Γ— S β†’ FiniteDistribution (Fin n β†’ Qβ‚‚))
    (supportL : βˆ€ q xs, (completionL q).weight xs β‰  0 β†’ xs j = q.1)
    (supportR : βˆ€ q ys, (completionR q).weight ys β‰  0 β†’ ys j = q.1)
    (fallback : S) :
    (Οƒ.mixture (fun z => (completionL (z.1.1,z.2)).product
      (completionR (z.1.2,z.2)))).probability (G.coordinateWin strategy j) ≀
      G.value +
        (2 * Information.totalVariation Οƒ.weight
          (fun z => G.questions.weight z.1 * (profileL z.1.1).weight z.2) +
         2 * Information.totalVariation Οƒ.weight
          (fun z => G.questions.weight z.1 * (profileR z.1.2).weight z.2)) := by
  let targetLaw := Οƒ.mixture (fun z => (completionL (z.1.1,z.2)).product (completionR (z.1.2,z.2)))
  let Ξ΄ := 2 * Information.totalVariation Οƒ.weight
      (fun z => G.questions.weight z.1 * (profileL z.1.1).weight z.2) +
    2 * Information.totalVariation Οƒ.weight
      (fun z => G.questions.weight z.1 * (profileR z.1.2).weight z.2)
  change targetLaw.probability (G.coordinateWin strategy j) ≀ G.value + Ξ΄
  by_contra h
  have gap : 0 < targetLaw.probability (G.coordinateWin strategy j) - (G.value + Ξ΄) :=
    sub_pos.mpr (lt_of_not_ge h)
  let Ξ· := (targetLaw.probability (G.coordinateWin strategy j) - (G.value + Ξ΄)) / 2
  have hΞ· : 0 < Ξ· := by dsimp [Ξ·]; linarith
  obtain ⟨N,hN⟩ := samplerOutputLaw_arbitrarily_close Οƒ G.questions profileL profileR fallback Ξ· hΞ·
  let thresholds := sharedProfileThresholds profileL profileR
  let Ξ³ := traceSeedLaw (rectangleDistribution (Ξ± := S) thresholds) N
  let sL := samplerLocal thresholds profileL fallback N
  let sR := samplerLocal thresholds profileR fallback N
  have hvariation := CompletedSampling.coordinateOutputLaw_totalVariation_le
    G.questions Ξ³ j sL sR completionL completionR supportL supportR Οƒ
  have hclose : (CompletedSampling.coordinateOutputLaw G.questions Ξ³ j sL sR completionL completionR).totalVariation targetLaw ≀ Ξ΄ + Ξ· :=
    hvariation.trans hN
  have hsuccess := G.coordinate_probability_le_value_add_embedding_distance j targetLaw
    (CompletedSampling.seedLaw Ξ³ completionL completionR)
    (CompletedSampling.coordinateLeft j sL) (CompletedSampling.coordinateRight j sR)
    (CompletedSampling.coordinateLeft_preserves j sL)
    (CompletedSampling.coordinateRight_preserves j sR) strategy
  have hsym : targetLaw.totalVariation
      (G.localEmbeddingLaw (CompletedSampling.seedLaw Ξ³ completionL completionR)
        (CompletedSampling.coordinateLeft j sL) (CompletedSampling.coordinateRight j sR)) =
      (CompletedSampling.coordinateOutputLaw G.questions Ξ³ j sL sR completionL completionR).totalVariation targetLaw := by
    unfold FiniteDistribution.totalVariation
    congr 1
    apply Finset.sum_congr rfl
    intro q _
    exact abs_sub_comm _ _
  rw [hsym] at hsuccess
  dsimp [Ξ·] at hclose
  linarith

end

open scoped BigOperators
open Games

variable {Q₁ Qβ‚‚ A₁ Aβ‚‚ : Type*}
  [Fintype Q₁] [Fintype Qβ‚‚] [Fintype A₁] [Fintype Aβ‚‚]
  [DecidableEq Q₁] [DecidableEq Qβ‚‚] {n : β„•}

theorem selectedLabels_card (selected : Finset (Fin n)) :
    Fintype.card (SelectedLabels (A₁ := A₁) (Aβ‚‚ := Aβ‚‚) selected) =
      (Fintype.card A₁ * Fintype.card Aβ‚‚) ^ selected.card := by
  simp [SelectedLabels, Fintype.card_prod, mul_pow]

theorem unusedCoordinates_card (selected : Finset (Fin n)) :
    Fintype.card {i : Fin n // i βˆ‰ selected} = n - selected.card := by
  classical
  simp

theorem unusedCoordinates_card_real (selected : Finset (Fin n)) :
    (Fintype.card {i : Fin n // i βˆ‰ selected} : ℝ) = (n : ℝ) - selected.card := by
  have hs : selected.card ≀ n := by simpa using Finset.card_le_univ selected
  rw [unusedCoordinates_card, Nat.cast_sub hs]

theorem log_le_logTwo {x : ℝ} (hx : 1 ≀ x) : Real.log x ≀ logTwo x := by
  have hlog : 0 ≀ Real.log x := Real.log_nonneg hx
  have htwo : 0 < Real.log 2 := Real.log_pos (by norm_num)
  have htwo_le : Real.log 2 ≀ 1 := by
    convert Real.log_le_sub_one_of_pos (by norm_num : (0 : ℝ) < 2) using 1
    norm_num
  unfold logTwo
  apply (le_div_iffβ‚€ htwo).2
  simpa using mul_le_mul_of_nonneg_left htwo_le hlog

theorem selectedLabels_log_le [Nonempty A₁] [Nonempty Aβ‚‚]
    (selected : Finset (Fin n)) (ell : ℝ)
    (hell : logTwo ((Fintype.card A₁ : ℝ) * (Fintype.card Aβ‚‚ : ℝ)) ≀ ell) :
    Real.log (Fintype.card (SelectedLabels (A₁ := A₁) (Aβ‚‚ := Aβ‚‚) selected) : ℝ) ≀
      (selected.card : ℝ) * ell := by
  have ha : (1 : ℝ) ≀ Fintype.card A₁ := by exact_mod_cast Fintype.card_pos (Ξ± := A₁)
  have hb : (1 : ℝ) ≀ Fintype.card Aβ‚‚ := by exact_mod_cast Fintype.card_pos (Ξ± := Aβ‚‚)
  have hab : (1 : ℝ) ≀ (Fintype.card A₁ : ℝ) * (Fintype.card Aβ‚‚ : ℝ) := by nlinarith
  rw [selectedLabels_card, Nat.cast_pow, Nat.cast_mul, Real.log_pow]
  exact mul_le_mul_of_nonneg_left ((log_le_logTwo hab).trans hell) (Nat.cast_nonneg _)

omit [DecidableEq Q₁] [DecidableEq Qβ‚‚] in
theorem selectedInformationRadius_le [Nonempty A₁] [Nonempty Aβ‚‚]
    (G : Game Q₁ Qβ‚‚ A₁ Aβ‚‚)
    (strategy : Strategy (Fin n β†’ Q₁) (Fin n β†’ Qβ‚‚) (Fin n β†’ A₁) (Fin n β†’ Aβ‚‚))
    (selected : Finset (Fin n)) (positive : 0 < G.selectedSuccess strategy selected)
    (ell : ℝ)
    (hell : logTwo ((Fintype.card A₁ : ℝ) * (Fintype.card Aβ‚‚ : ℝ)) ≀ ell) :
    selectedInformationRadius G strategy selected ≀
      Real.sqrt (((n : ℝ) - selected.card) *
        ((selected.card : ℝ) * ell + logTwo (1 / G.selectedSuccess strategy selected))) := by
  have hprob : 1 ≀ 1 / G.selectedSuccess strategy selected := by
    apply (le_div_iffβ‚€ positive).2
    simpa using G.selectedSuccess_le_one strategy selected
  have hbudget := add_le_add (selectedLabels_log_le (A₁ := A₁) (Aβ‚‚ := Aβ‚‚) selected ell hell)
    (log_le_logTwo hprob)
  unfold selectedInformationRadius
  rw [← unusedCoordinates_card_real selected]
  apply Real.sqrt_le_sqrt
  exact mul_le_mul_of_nonneg_left hbudget (Nat.cast_nonneg _)

theorem sqrt_budget_factor (a b : ℝ) (ha : 0 < a) :
    Real.sqrt (a * b) = a * Real.sqrt (b / a) := by
  have he : a * b = a ^ 2 * (b / a) := by
    field_simp
  rw [he, Real.sqrt_mul (sq_nonneg a), Real.sqrt_sq (le_of_lt ha)]

omit [DecidableEq Q₁] [DecidableEq Qβ‚‚] in
theorem exists_coordinate_le_information_budget [Nonempty A₁] [Nonempty Aβ‚‚]
    (G : Game Q₁ Qβ‚‚ A₁ Aβ‚‚)
    (strategy : Strategy (Fin n β†’ Q₁) (Fin n β†’ Qβ‚‚) (Fin n β†’ A₁) (Fin n β†’ Aβ‚‚))
    (selected : Finset (Fin n)) (positive : 0 < G.selectedSuccess strategy selected)
    (ell : ℝ)
    (hell : logTwo ((Fintype.card A₁ : ℝ) * (Fintype.card Aβ‚‚ : ℝ)) ≀ ell)
    (hselected : selected.card < n)
    (error : {i : Fin n // i βˆ‰ selected} β†’ ℝ)
    (hsum : (βˆ‘ j, error j) ≀ 15 * selectedInformationRadius G strategy selected) :
    βˆƒ j : {i : Fin n // i βˆ‰ selected}, error j ≀ 15 * Real.sqrt
      (((selected.card : ℝ) * ell + logTwo (1 / G.selectedSuccess strategy selected)) /
        ((n : ℝ) - selected.card)) := by
  classical
  have hcard : 0 < Fintype.card {i : Fin n // i βˆ‰ selected} := by
    rw [unusedCoordinates_card]
    exact Nat.sub_pos_of_lt hselected
  let : Nonempty {i : Fin n // i βˆ‰ selected} := Fintype.card_pos_iff.mp hcard
  have hden : 0 < (n : ℝ) - selected.card := by
    rw [← unusedCoordinates_card_real selected]
    exact_mod_cast hcard
  have htotal := hsum.trans (mul_le_mul_of_nonneg_left
    (selectedInformationRadius_le G strategy selected positive ell hell) (by norm_num : (0 : ℝ) ≀ 15))
  rw [sqrt_budget_factor _ _ hden] at htotal
  have havg : (βˆ‘ j, error j) ≀ βˆ‘ _j : {i : Fin n // i βˆ‰ selected},
      15 * Real.sqrt
        (((selected.card : ℝ) * ell + logTwo (1 / G.selectedSuccess strategy selected)) /
          ((n : ℝ) - selected.card)) := by
    simpa only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul,
      unusedCoordinates_card_real, mul_assoc, mul_left_comm] using htotal
  obtain ⟨j, _, hj⟩ := Finset.exists_le_of_sum_le Finset.univ_nonempty havg
  exact ⟨j, hj⟩

end IndependentSetsGames.Foundations.Repetition

end

end OAI