Download data/lean/OAI/Computability/PerfectCompleteness/Decoding/DependentDecoderSampling.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 5.56 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Computability/PerfectCompleteness/Decoding/DependentDecoderSampling.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Computability/PerfectCompleteness/Decoding/DependentDecoderSampling.lean
-
curl -L -o DependentDecoderSampling.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Computability/PerfectCompleteness/Decoding/DependentDecoderSampling.lean
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 | |