File size: 5,557 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
import OAI.Computability.PerfectCompleteness.Decoding.TwoResponseCollisionLemmas
import OAI.Computability.PerfectCompleteness.Reduction.CompletionSoundness
import OAI.Computability.PerfectCompleteness.Sampling.RecursiveSamplerLaws

namespace OAI

section

namespace PerfectCompleteness.DependentDecoderSampling

noncomputable section

open scoped BigOperators Classical
open UniqueGamesTheorem.Foundations.Games

variable {Q₁ Qβ‚‚ E : Type*} [Fintype Q₁] [Fintype Qβ‚‚] [Fintype E]
  [DecidableEq Q₁] [DecidableEq Qβ‚‚]
  {A : Q₁ β†’ Type*} {B : Qβ‚‚ β†’ Type*}
  [βˆ€ q, Fintype (A q)] [βˆ€ q, Fintype (B q)]

abbrev Seed (A : Q₁ β†’ Type*) (B : Qβ‚‚ β†’ Type*) :=
  ((q : Q₁) β†’ A q) Γ— ((q : Qβ‚‚) β†’ B q)

def seedLaw (leftKernel : (q : Q₁) β†’ FiniteDistribution (A q))
    (rightKernel : (q : Qβ‚‚) β†’ FiniteDistribution (B q)) :
    FiniteDistribution (Seed A B) :=
  (FiniteProduct.law leftKernel).product (FiniteProduct.law rightKernel)

theorem read_law (leftKernel : (q : Q₁) β†’ FiniteDistribution (A q))
    (rightKernel : (q : Qβ‚‚) β†’ FiniteDistribution (B q)) (q₁ : Q₁) (qβ‚‚ : Qβ‚‚) :
    (seedLaw leftKernel rightKernel).pushforward (fun seed => (seed.1 q₁, seed.2 qβ‚‚)) =
      (leftKernel q₁).product (rightKernel qβ‚‚) := by
  have h := FiniteDistribution.product_pushforward
    (FiniteProduct.law leftKernel) (FiniteProduct.law rightKernel)
    (fun table : (q : Q₁) β†’ A q => table q₁)
    (fun table : (q : Qβ‚‚) β†’ B q => table qβ‚‚)
  rw [FiniteProduct.eval_pushforward, FiniteProduct.eval_pushforward] at h
  exact h

def sampleLaw (ΞΌ : FiniteDistribution E) (left : E β†’ Q₁) (right : E β†’ Qβ‚‚)
    (leftKernel : (q : Q₁) β†’ FiniteDistribution (A q))
    (rightKernel : (q : Qβ‚‚) β†’ FiniteDistribution (B q)) :
    FiniteDistribution (Ξ£ e : E, A (left e) Γ— B (right e)) :=
  CompletionSoundness.sigmaLaw ΞΌ (fun e => (leftKernel (left e)).product (rightKernel (right e)))

theorem sample_probability_eq (ΞΌ : FiniteDistribution E) (left : E β†’ Q₁) (right : E β†’ Qβ‚‚)
    (leftKernel : (q : Q₁) β†’ FiniteDistribution (A q))
    (rightKernel : (q : Qβ‚‚) β†’ FiniteDistribution (B q))
    (event : (e : E) β†’ A (left e) β†’ B (right e) β†’ Bool) :
    (sampleLaw ΞΌ left right leftKernel rightKernel).probability
        (fun x => event x.1 x.2.1 x.2.2) =
      (seedLaw leftKernel rightKernel).expectation
        (fun seed => ΞΌ.probability (fun e => event e (seed.1 (left e)) (seed.2 (right e)))) := by
  rw [sampleLaw, CompletionSoundness.sigmaLaw_probability]
  calc
    _ = ΞΌ.expectation (fun e => (seedLaw leftKernel rightKernel).probability
        (fun seed => event e (seed.1 (left e)) (seed.2 (right e)))) := by
      apply FiniteDistribution.expectation_congr
      intro e
      have h := FiniteDistribution.probability_pushforward
        (seedLaw leftKernel rightKernel) (fun seed => (seed.1 (left e), seed.2 (right e)))
        (fun answer => event e answer.1 answer.2)
      rw [read_law] at h
      exact h
    _ = ΞΌ.expectation (fun e => (seedLaw leftKernel rightKernel).expectation
        (fun seed => if event e (seed.1 (left e)) (seed.2 (right e)) then 1 else 0)) := by
      simp only [FiniteDistribution.probability, FiniteDistribution.expectation,
        mul_ite, mul_one, mul_zero]
    _ = (seedLaw leftKernel rightKernel).expectation (fun seed => ΞΌ.expectation
        (fun e => if event e (seed.1 (left e)) (seed.2 (right e)) then 1 else 0)) :=
      FiniteDistribution.expectation_comm ΞΌ (seedLaw leftKernel rightKernel) _
    _ = _ := by
      simp only [FiniteDistribution.probability, FiniteDistribution.expectation,
        mul_ite, mul_one, mul_zero]

theorem probability_le_of_supported_seeds
    (ΞΌ : FiniteDistribution E) (left : E β†’ Q₁) (right : E β†’ Qβ‚‚)
    (leftKernel : (q : Q₁) β†’ FiniteDistribution (A q))
    (rightKernel : (q : Qβ‚‚) β†’ FiniteDistribution (B q))
    (event : (e : E) β†’ A (left e) β†’ B (right e) β†’ Bool) (bound : ℝ)
    (hbound : βˆ€ seed, (seedLaw leftKernel rightKernel).weight seed β‰  0 β†’
      ΞΌ.probability (fun e => event e (seed.1 (left e)) (seed.2 (right e))) ≀ bound) :
    (sampleLaw ΞΌ left right leftKernel rightKernel).probability
      (fun x => event x.1 x.2.1 x.2.2) ≀ bound := by
  rw [sample_probability_eq]
  exact DecoderTableAdmissibility.expectation_le_of_support _ _ bound hbound

theorem supported_left (leftKernel : (q : Q₁) β†’ FiniteDistribution (A q))
    (rightKernel : (q : Qβ‚‚) β†’ FiniteDistribution (B q))
    (seed : Seed A B) (hs : (seedLaw leftKernel rightKernel).weight seed β‰  0) (q : Q₁) :
    (leftKernel q).weight (seed.1 q) β‰  0 := by
  intro hq
  apply hs
  have hz : (FiniteProduct.law leftKernel).weight seed.1 = 0 := by
    exact Finset.prod_eq_zero (Finset.mem_univ q) hq
  change (FiniteProduct.law leftKernel).weight seed.1 *
    (FiniteProduct.law rightKernel).weight seed.2 = 0
  rw [hz, zero_mul]

theorem supported_right (leftKernel : (q : Q₁) β†’ FiniteDistribution (A q))
    (rightKernel : (q : Qβ‚‚) β†’ FiniteDistribution (B q))
    (seed : Seed A B) (hs : (seedLaw leftKernel rightKernel).weight seed β‰  0) (q : Qβ‚‚) :
    (rightKernel q).weight (seed.2 q) β‰  0 := by
  intro hq
  apply hs
  have hz : (FiniteProduct.law rightKernel).weight seed.2 = 0 := by
    exact Finset.prod_eq_zero (Finset.mem_univ q) hq
  change (FiniteProduct.law leftKernel).weight seed.1 *
    (FiniteProduct.law rightKernel).weight seed.2 = 0
  rw [hz, mul_zero]

end
end PerfectCompleteness.DependentDecoderSampling

end

end OAI