File size: 5,583 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 | import OAI.Computability.UniqueGames.Foundations.FiniteTrialsLemmas
import OAI.Computability.UniqueGames.Foundations.Rectangle
namespace OAI
section
/-! Per-label diagonal lower bounds for the actual finite shared sampler.
These bounds retain the output label, which is necessary for comparing the
sampler's output distribution with a prescribed diagonal distribution. -/
namespace UniqueGamesTheorem.Foundations.CorrelatedSampling
noncomputable section
variable {Ο Ξ± : Type*} [Fintype Ο] [DecidableEq Ο] [DecidableEq Ξ±]
def localSample (accept : Ο β Bool) (decode : Ο β Ξ±) (fallback : Ξ±)
(proposals : List Ο) : Ξ± :=
((firstAccepted accept proposals).map decode).getD fallback
def localDiagonal (left right : Ο β Bool) (decode : Ο β Ξ±) (fallback a : Ξ±)
(proposals : List Ο) : β :=
if localSample left decode fallback proposals = a β§
localSample right decode fallback proposals = a then 1 else 0
def goodLabel (left right : Ο β Bool) (decode : Ο β Ξ±) (a : Ξ±) (s : Ο) : Bool :=
(left s && right s) && decide (decode s = a)
omit [Fintype Ο] [DecidableEq Ο] in
theorem common_first_label_lower (left right : Ο β Bool) (decode : Ο β Ξ±)
(fallback a : Ξ±) (proposals : List Ο) :
goodFirstIndicator (fun s => left s || right s) (goodLabel left right decode a) proposals β€
localDiagonal left right decode fallback a proposals := by
cases hfirst : firstAccepted (fun s => left s || right s) proposals with
| none =>
simp only [goodFirstIndicator, hfirst]
unfold localDiagonal
split_ifs <;> norm_num
| some s =>
by_cases hc : goodLabel left right decode a s = true
Β· have hparts : (left s = true β§ right s = true) β§ decode s = a := by
simpa [goodLabel] using hc
have h := first_union_common left right proposals s hfirst hparts.1.1 hparts.1.2
simp [goodFirstIndicator, hfirst, hc, localDiagonal, localSample, h.1, h.2, hparts.2]
Β· have hn : 0 β€ localDiagonal left right decode fallback a proposals := by
unfold localDiagonal
split_ifs <;> norm_num
simpa [goodFirstIndicator, hfirst, hc] using hn
omit [DecidableEq Ο] in theorem union_goodLabel_mass
(w : Ο β β) (left right : Ο β Bool) (decode : Ο β Ξ±) (a : Ξ±) :
eventMass w (fun s => (left s || right s) && goodLabel left right decode a s) =
eventMass w (goodLabel left right decode a) := by
unfold eventMass
apply Finset.sum_congr rfl
intro s _
cases hl : left s <;> cases hr : right s <;> simp [goodLabel, hl, hr]
/-- The finite shared-list sampler's mass on the particular diagonal output
(a,a) is at least the common-first-label mass. Exhaustion uses a fixed local
fallback; its contribution is nonnegative and is not counted in this bound. -/
theorem finite_label_diagonal_bound (w : Ο β β) (left right : Ο β Bool)
(decode : Ο β Ξ±) (fallback a : Ξ±) (hw : β s, 0 β€ w s)
(hw_sum : β s, w s = 1) (hu : 0 < eventMass w (fun s => left s || right s)) (n : Nat) :
eventMass w (goodLabel left right decode a) / eventMass w (fun s => left s || right s) *
(1 - eventMass w (fun s => !(left s || right s)) ^ n) β€
traceAverage w n (localDiagonal left right decode fallback a) := by
have h := traceAverage_mono w hw n _ _ (common_first_label_lower left right decode fallback a)
rw [goodFirstIndicator_law w _ _ hw_sum n,
goodFirstMass_exact w _ _ hw_sum (ne_of_gt hu) n,
union_goodLabel_mass] at h
exact h
section Rectangle
variable [Fintype Ξ±] [Nonempty Ξ±]
/-- Concrete normalized-density instance of the per-label bound. All random
proposals come from the finite rectangle constructed from `thresholds`. -/
theorem rectangle_label_diagonal_bound (thresholds : List β) (p q : Ξ± β β)
(fallback a : Ξ±)
(hpm : β x, p x β thresholds) (hqm : β x, q x β thresholds)
(hp0 : β x, 0 β€ p x) (hq0 : β x, 0 β€ q x)
(hp1 : β x, p x β€ 1) (hq1 : β x, q x β€ 1)
(hpsum : β x, p x = 1) (hqsum : β x, q x = 1) (n : Nat) :
min (p a) (q a) / (1 + totalVariation p q) *
(1 - eventMass (rectangleWeight thresholds)
(fun s => !(rectangleAccept thresholds p s || rectangleAccept thresholds q s)) ^ n) β€
traceAverage (rectangleWeight thresholds) n
(localDiagonal (rectangleAccept thresholds p) (rectangleAccept thresholds q)
Prod.fst fallback a) := by
have hc : 0 < (Fintype.card Ξ± : β) := by exact_mod_cast Fintype.card_pos
have hU : 0 < unionMass p q := by
rw [unionMass_eq p q hpsum hqsum]
linarith [totalVariation_nonneg p q]
have hmass := rectangle_union_mass thresholds p q hpm hqm hp0 hq0 hp1 hq1
have hu : 0 < eventMass (rectangleWeight thresholds)
(fun s => rectangleAccept thresholds p s || rectangleAccept thresholds q s) := by
rw [hmass]
exact div_pos hU hc
have h := finite_label_diagonal_bound (rectangleWeight thresholds)
(rectangleAccept thresholds p) (rectangleAccept thresholds q) Prod.fst fallback a
(rectangleWeight_nonnegative thresholds) (rectangleWeight_normalized thresholds) hu n
unfold goodLabel at h
rw [rectangle_common_label_mass thresholds p q a hpm hqm hp0 hq0 hp1 hq1, hmass] at h
have hratio : (min (p a) (q a) / (Fintype.card Ξ± : β)) /
(unionMass p q / (Fintype.card Ξ± : β)) = min (p a) (q a) / unionMass p q := by
field_simp
rw [hratio, unionMass_eq p q hpsum hqsum] at h
exact h
end Rectangle
end
end UniqueGamesTheorem.Foundations.CorrelatedSampling
end
end OAI
|