Download data/lean/OAI/Combinatorics/IndependentSets/PCP/AlphabetReduction.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 5.62 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/IndependentSets/PCP/AlphabetReduction.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/IndependentSets/PCP/AlphabetReduction.lean
-
curl -L -o AlphabetReduction.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/IndependentSets/PCP/AlphabetReduction.lean
5.62 kB
| import Mathlib | |
| import OAI.Combinatorics.IndependentSets.Reduction.Bits | |
| import OAI.Combinatorics.IndependentSets.PCP.AssignmentTester | |
| import OAI.Combinatorics.IndependentSets.PCP.CodeComposition | |
| namespace OAI | |
| noncomputable section | |
| namespace IndependentSetsGames.Foundations.PCP.AlphabetReduction | |
| open IndependentSetsGames.Foundations.Hastad | |
| open CodeComposition | |
| variable {A : Type*} [Fintype A] [DecidableEq A] [Nonempty A] | |
| abbrev LegalPair (accepts : A β A β Bool) := | |
| {p : A Γ A // accepts p.1 p.2 = true} | |
| abbrev InputCoordinate (A : Type*) := Bool Γ Cube A | |
| def pairEncoding (accepts : A β A β Bool) (p : LegalPair accepts) : | |
| InputCoordinate A β Bool := | |
| pairWord (codeword p.1.1) (codeword p.1.2) | |
| def edgeTesterReject (accepts : A β A β Bool) (left right : Cube A β Bool) | |
| (F : Cube (LegalPair accepts) β Bool) : β := | |
| AssignmentTester.explicitTesterReject (pairEncoding accepts) (pairWord left right) F | |
| theorem rejected_edge_tester_bound (accepts : A β A β Bool) | |
| (left right : Cube A β Bool) | |
| (F : Cube (LegalPair accepts) β Bool) | |
| (hbad : accepts (nearest left) (nearest right) = false) : | |
| 1 / 2048 β€ edgeTesterReject accepts left right F := by | |
| have hfar (p : LegalPair accepts) : | |
| (1 / 8 : β) β€ AssignmentTester.distance (pairWord left right) (pairEncoding accepts p) := by | |
| have h := rejected_pair_far accepts left right hbad p.1.1 p.1.2 p.2 | |
| convert h using 1 | |
| rfl | |
| have h := AssignmentTester.explicit_proximity_soundness (pairEncoding accepts) | |
| (pairWord left right) F (Ξ΄ := 1 / 8) (by norm_num) (by norm_num) hfar | |
| norm_num at h | |
| exact h | |
| omit [Nonempty A] in | |
| theorem honest_edge_tester (accepts : A β A β Bool) (a b : A) | |
| (hab : accepts a b = true) : | |
| edgeTesterReject accepts (codeword a) (codeword b) | |
| (fun f => f β¨(a, b), habβ©) = 0 := by | |
| unfold edgeTesterReject | |
| rw [AssignmentTester.explicitTesterReject_eq] | |
| exact AssignmentTester.tester_perfect_completeness | |
| (pairEncoding accepts) β¨(a, b), habβ© | |
| end IndependentSetsGames.Foundations.PCP.AlphabetReduction | |
| end | |
| namespace IndependentSetsGames.Foundations.PCP.UniformRestriction | |
| open scoped BigOperators | |
| variable {B : Type*} (p : B β Prop) | |
| def restrict (f : B β Bool) : {b // p b} β Bool := fun b => f b.1 | |
| variable [DecidablePred p] | |
| def extend (g : {b // p b} β Bool) : B β Bool := | |
| fun b => if hb : p b then g β¨b, hbβ© else false | |
| def canonicalize (f : B β Bool) : B β Bool := extend p (restrict p f) | |
| omit [DecidablePred p] in | |
| @[simp] theorem restrict_apply (f : B β Bool) (b : {b // p b}) : | |
| restrict p f b = f b.1 := rfl | |
| @[simp] theorem extend_apply_of_mem (g : {b // p b} β Bool) (b : B) (hb : p b) : | |
| extend p g b = g β¨b, hbβ© := by | |
| simp [extend, hb] | |
| @[simp] theorem extend_apply_of_not_mem (g : {b // p b} β Bool) (b : B) | |
| (hb : Β¬ p b) : extend p g b = false := by | |
| simp [extend, hb] | |
| @[simp] theorem restrict_extend (g : {b // p b} β Bool) : | |
| restrict p (extend p g) = g := by | |
| funext b | |
| simp [restrict, extend, b.property] | |
| @[simp] theorem canonicalize_apply_of_mem (f : B β Bool) (b : B) (hb : p b) : | |
| canonicalize p f b = f b := by | |
| simp [canonicalize, hb] | |
| @[simp] theorem canonicalize_apply_of_not_mem (f : B β Bool) (b : B) | |
| (hb : Β¬ p b) : canonicalize p f b = false := by | |
| simp [canonicalize, hb] | |
| @[simp] theorem restrict_canonicalize (f : B β Bool) : | |
| restrict p (canonicalize p f) = restrict p f := by | |
| exact restrict_extend p (restrict p f) | |
| @[simp] theorem canonicalize_idempotent (f : B β Bool) : | |
| canonicalize p (canonicalize p f) = canonicalize p f := by | |
| simp only [canonicalize, restrict_extend] | |
| theorem canonicalize_eq_iff (f g : B β Bool) : | |
| canonicalize p f = canonicalize p g β restrict p f = restrict p g := by | |
| constructor | |
| Β· intro h | |
| simpa only [restrict_canonicalize] using congrArg (restrict p) h | |
| Β· intro h | |
| exact congrArg (extend p) h | |
| variable [Fintype B] [DecidableEq B] | |
| theorem expect_restrict (h : ({b // p b} β Bool) β β) : | |
| (πΌ f : B β Bool, h (restrict p f)) = πΌ g : {b // p b} β Bool, h g := by | |
| calc | |
| (πΌ f : B β Bool, h (restrict p f)) = | |
| πΌ g : ({b // p b} β Bool) Γ ({b // Β¬ p b} β Bool), h g.1 := | |
| Fintype.expect_equiv (Equiv.piEquivPiSubtypeProd p (fun _ => Bool)) | |
| _ _ (fun _ => rfl) | |
| _ = πΌ g : {b // p b} β Bool, πΌ _k : {b // Β¬ p b} β Bool, h g := by | |
| simpa only [Finset.univ_product_univ] using | |
| Finset.expect_product | |
| (Finset.univ : Finset ({b // p b} β Bool)) | |
| (Finset.univ : Finset ({b // Β¬ p b} β Bool)) | |
| (fun g : ({b // p b} β Bool) Γ ({b // Β¬ p b} β Bool) => h g.1) | |
| _ = πΌ g : {b // p b} β Bool, h g := by | |
| simp only [Fintype.expect_const] | |
| theorem expect_canonicalize (h : (B β Bool) β β) : | |
| (πΌ f : B β Bool, h (canonicalize p f)) = | |
| πΌ g : {b // p b} β Bool, h (extend p g) := | |
| expect_restrict p (fun g => h (extend p g)) | |
| theorem expect_restrict_pair (h : ({b // p b} β Bool) β ({b // p b} β Bool) β β) : | |
| (πΌ f : B β Bool, πΌ g : B β Bool, h (restrict p f) (restrict p g)) = | |
| πΌ f : {b // p b} β Bool, πΌ g : {b // p b} β Bool, h f g := by | |
| calc | |
| _ = πΌ f : B β Bool, πΌ g : {b // p b} β Bool, h (restrict p f) g := by | |
| apply Finset.expect_congr rfl | |
| intro f _ | |
| exact expect_restrict p (h (restrict p f)) | |
| _ = _ := expect_restrict p (fun f => πΌ g : {b // p b} β Bool, h f g) | |
| end IndependentSetsGames.Foundations.PCP.UniformRestriction | |
| end OAI | |