math / data /lean /OAI /Computability /PerfectCompleteness /Decoding /DependentDecoderSampling.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
5.56 kB
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