Download data/lean/OAI/Computability/PerfectCompleteness/Decoding/BucketUsefulCollision.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 7.93 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Computability/PerfectCompleteness/Decoding/BucketUsefulCollision.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Computability/PerfectCompleteness/Decoding/BucketUsefulCollision.lean
-
curl -L -o BucketUsefulCollision.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Computability/PerfectCompleteness/Decoding/BucketUsefulCollision.lean
7.93 kB
| import OAI.Computability.PerfectCompleteness.Algebra.BucketMatrixResampling | |
| import OAI.Computability.PerfectCompleteness.Decoding.CollisionAveragingLemmas | |
| import OAI.Computability.PerfectCompleteness.Decoding.RepresentativeBucketCollisionLemmas | |
| import OAI.Computability.PerfectCompleteness.Foundations.QuarterBalanceLemmas | |
| namespace OAI | |
| namespace PerfectCompleteness.BucketUsefulCollision | |
| noncomputable section | |
| open scoped Classical | |
| open ClauseSupport MixedSupport | |
| open UniqueGamesTheorem.Foundations.Games | |
| open BucketSampler (F2 Direction Tape) | |
| section Product | |
| variable {H : Type*} {β : Nat} | |
| def fill (a : Direction β) | |
| (b : FiniteProductSplit.Others (Ξ© := fun _ : Direction β => H) a) | |
| (h : H) : Tape β H := | |
| fun d => if hd : d = a then h else b β¨d, hdβ© | |
| @[simp] theorem fill_self (a : Direction β) | |
| (b : FiniteProductSplit.Others (Ξ© := fun _ : Direction β => H) a) | |
| (h : H) : fill a b h a = h := by | |
| simp [fill] | |
| theorem fill_update (a : Direction β) | |
| (b : FiniteProductSplit.Others (Ξ© := fun _ : Direction β => H) a) | |
| (h h' : H) : Function.update (fill a b h) a h' = fill a b h' := by | |
| funext d | |
| by_cases hd : d = a | |
| Β· subst d | |
| simp [fill] | |
| Β· simp only [Function.update_of_ne hd, fill, dite_eq_right hd] | |
| theorem fill_others (a : Direction β) (t : Tape β H) : | |
| fill a (FiniteProductSplit.others a t) (t a) = t := by | |
| funext d | |
| by_cases hd : d = a | |
| Β· subst d | |
| simp [fill] | |
| Β· simp only [fill, dite_eq_right hd, FiniteProductSplit.others] | |
| theorem fill_others_update (a : Direction β) (t : Tape β H) (h : H) : | |
| fill a (FiniteProductSplit.others a t) h = Function.update t a h := by | |
| rw [β fill_update a (FiniteProductSplit.others a t) (t a) h, fill_others] | |
| private theorem probability_eq_expectation {A : Type*} [Fintype A] | |
| (ΞΌ : FiniteDistribution A) (event : A β Bool) : | |
| ΞΌ.probability event = ΞΌ.expectation (fun x => if event x then 1 else 0) := by | |
| simp only [FiniteDistribution.probability, FiniteDistribution.expectation, | |
| mul_ite, mul_one, mul_zero] | |
| variable [Fintype H] | |
| theorem probability_background_first (ΞΌ : FiniteDistribution H) | |
| (a : Direction β) (event : Tape β H β Bool) : | |
| (BucketSampler.tapeLaw β ΞΌ).probability event = | |
| (FiniteProductSplit.otherLaw (fun _ : Direction β => ΞΌ) a).expectation | |
| (fun b => ΞΌ.probability (fun h => event (fill a b h))) := by | |
| have h := FiniteProductSplit.expectation_background_first | |
| (fun _ : Direction β => ΞΌ) a | |
| (fun h b => if event (fill a b h) then (1 : β) else 0) | |
| simpa only [fill_others, β probability_eq_expectation, BucketSampler.tapeLaw] using h | |
| theorem probability_resampling (ΞΌ : FiniteDistribution H) | |
| (a : Direction β) (event : Tape β H β Tape β H β Bool) : | |
| ((BucketSampler.tapeLaw β ΞΌ).product ΞΌ).probability | |
| (fun z => event z.1 (Function.update z.1 a z.2)) = | |
| (FiniteProductSplit.otherLaw (fun _ : Direction β => ΞΌ) a).expectation | |
| (fun b => (ΞΌ.product ΞΌ).probability | |
| (fun z => event (fill a b z.1) (fill a b z.2))) := by | |
| have h := FiniteProductSplit.resampling_expectation | |
| (fun _ : Direction β => ΞΌ) a | |
| (fun b h h' => if event (fill a b h) (fill a b h') then (1 : β) else 0) | |
| simp only [fill_others] at h | |
| simpa only [fill_others_update, β probability_eq_expectation, BucketSampler.tapeLaw] using h | |
| end Product | |
| variable {n β : Nat} {Z : Type*} | |
| (slots : Fin n β Slot) (V : Submodule F2 (Assignment slots β F2)) | |
| (other : Assignment slots β Z) (Ο : KeyStrategy.Strategy n) | |
| (W : Submodule F2 V) (s : (V β§Έ W) ββ[F2] V) | |
| theorem assembledMatrix_fill (a : Direction β) | |
| (b : FiniteProductSplit.Others (Ξ© := fun _ : Direction β => V) a) (h : V) : | |
| BucketMatrixResampling.assembledMatrix V β (fill a b h) = | |
| EvaluationMatrix.shift V | |
| (BucketMatrixResampling.assembledMatrix V β (fill a b 0)) a.val h := by | |
| have he := BucketMatrixResampling.assembledMatrix_update V β (fill a b 0) a h | |
| rw [fill_update] at he | |
| simpa only [fill_self, sub_zero] using he | |
| variable [Fintype V] [Finite Z] | |
| theorem collision_probability_lower_bound | |
| (hs : W.mkQ.comp s = LinearMap.id) | |
| (hW : RepresentativeMatrixTable.Determined slots V other W) | |
| (ΞΌ : FiniteDistribution V) | |
| (useful : (Module.Dual F2 (V β§Έ W) ββ[F2] (Fin β β F2)) β Prop) | |
| (a : Direction β) : | |
| (BucketSampler.tapeLaw β ΞΌ).probability | |
| (fun t => decide (CanonicalMatrixTable.Accepts slots V other Ο a.val | |
| (BucketMatrixResampling.assembledMatrix V β t)) && | |
| (RepresentativeMatrixTable.partialTable slots V other Ο W s useful | |
| (MatrixRowQuotient.projectMatrix W | |
| (BucketMatrixResampling.assembledMatrix V β t))).isSome) ^ 2 / 2 β€ | |
| ((BucketSampler.tapeLaw β ΞΌ).product ΞΌ).probability | |
| (fun z => TwoResponseCollision.collision | |
| (RepresentativeMatrixTable.partialTable slots V other Ο W s useful) | |
| (MatrixRowQuotient.projectMatrix W | |
| (BucketMatrixResampling.assembledMatrix V β z.1), | |
| MatrixRowQuotient.projectMatrix W | |
| (BucketMatrixResampling.assembledMatrix V β (Function.update z.1 a z.2)))) := by | |
| let f := RepresentativeMatrixTable.partialTable slots V other Ο W s useful | |
| let good : Tape β V β Bool := fun t => | |
| decide (CanonicalMatrixTable.Accepts slots V other Ο a.val | |
| (BucketMatrixResampling.assembledMatrix V β t)) && | |
| (f (MatrixRowQuotient.projectMatrix W | |
| (BucketMatrixResampling.assembledMatrix V β t))).isSome | |
| let collision : Tape β V β Tape β V β Bool := fun t t' => | |
| TwoResponseCollision.collision f | |
| (MatrixRowQuotient.projectMatrix W (BucketMatrixResampling.assembledMatrix V β t), | |
| MatrixRowQuotient.projectMatrix W (BucketMatrixResampling.assembledMatrix V β t')) | |
| change (BucketSampler.tapeLaw β ΞΌ).probability good ^ 2 / 2 β€ | |
| ((BucketSampler.tapeLaw β ΞΌ).product ΞΌ).probability | |
| (fun z => collision z.1 (Function.update z.1 a z.2)) | |
| rw [probability_background_first ΞΌ a good, probability_resampling ΞΌ a collision] | |
| apply CollisionAveraging.average_square_bound | |
| intro b | |
| have hgood : (fun h : V => good (fill a b h)) = | |
| TwoResponseCollision.goodDefined | |
| (RepresentativeBucketCollision.bucketTable slots V other Ο W s useful a.val | |
| (BucketMatrixResampling.assembledMatrix V β (fill a b 0))) | |
| (RepresentativeBucketCollision.bucketAccepted slots V other Ο a.val | |
| (BucketMatrixResampling.assembledMatrix V β (fill a b 0))) := by | |
| funext h | |
| dsimp only [good, f, TwoResponseCollision.goodDefined, | |
| RepresentativeBucketCollision.bucketTable, RepresentativeBucketCollision.bucketAccepted] | |
| simp only [assembledMatrix_fill slots V a b h] | |
| have htable (h : V) : | |
| f (MatrixRowQuotient.projectMatrix W | |
| (BucketMatrixResampling.assembledMatrix V β (fill a b h))) = | |
| RepresentativeBucketCollision.bucketTable slots V other Ο W s useful a.val | |
| (BucketMatrixResampling.assembledMatrix V β (fill a b 0)) h := by | |
| dsimp only [f, RepresentativeBucketCollision.bucketTable] | |
| rw [assembledMatrix_fill slots V a b h] | |
| have hcollision : | |
| (fun z : V Γ V => collision (fill a b z.1) (fill a b z.2)) = | |
| TwoResponseCollision.collision | |
| (RepresentativeBucketCollision.bucketTable slots V other Ο W s useful a.val | |
| (BucketMatrixResampling.assembledMatrix V β (fill a b 0))) := by | |
| exact congrArg (fun g : V β Option ((Fin β β F2) Γ Z) => | |
| TwoResponseCollision.collision g) (funext htable) | |
| rw [hgood, hcollision] | |
| exact RepresentativeBucketCollision.collision_probability_lower_bound | |
| slots V other Ο W s hs hW ΞΌ useful a.val a.property | |
| (BucketMatrixResampling.assembledMatrix V β (fill a b 0)) | |
| end | |
| end PerfectCompleteness.BucketUsefulCollision | |
| end OAI | |