Download data/lean/OAI/Computability/PerfectCompleteness/Algebra/CanonicalMatrixTable.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 4.81 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Computability/PerfectCompleteness/Algebra/CanonicalMatrixTable.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Computability/PerfectCompleteness/Algebra/CanonicalMatrixTable.lean
-
curl -L -o CanonicalMatrixTable.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Computability/PerfectCompleteness/Algebra/CanonicalMatrixTable.lean
4.81 kB
| import OAI.Computability.PerfectCompleteness.Algebra.EvaluationMatrix | |
| import OAI.Computability.PerfectCompleteness.Foundations.LinearEvaluationLemmas | |
| import OAI.Computability.PerfectCompleteness.Foundations.QuotientTableAgreementLemmas | |
| namespace OAI | |
| section | |
| namespace PerfectCompleteness.CanonicalMatrixTable | |
| noncomputable section | |
| open scoped Classical | |
| open ClauseSupport MixedSupport CanonicalKeys | |
| open DirectionQuotient (F2) | |
| variable {n : Nat} {K Z : Type*} [AddCommGroup K] [Module F2 K] | |
| (slots : Fin n β Slot) (H : Submodule F2 (Assignment slots β F2)) | |
| (other : Assignment slots β Z) (Ο : KeyStrategy.Strategy n) | |
| abbrev Matrix := Module.Dual F2 H ββ[F2] K | |
| def query (X : Matrix (K := K) slots H) : Assignment slots β K Γ Z := | |
| EvaluationMatrix.joint H other X | |
| def response (X : Matrix (K := K) slots H) : K Γ Z := | |
| KeyStrategy.response Ο .left slots (query slots H other X) | |
| def partialTable (useful : Matrix (K := K) slots H β Prop) (X : Matrix (K := K) slots H) : Option (K Γ Z) := | |
| if useful X then some (response slots H other Ο X) else none | |
| theorem response_realized (X : Matrix (K := K) slots H) : | |
| β x : Assignment slots, | |
| EvaluationMatrix.evaluate H X x = (response slots H other Ο X).1 β§ | |
| other x = (response slots H other Ο X).2 := by | |
| obtain β¨x, hxβ© := KeyStrategy.response_mem_range Ο .left slots (query slots H other X) | |
| exact β¨x, congrArg Prod.fst hx, congrArg Prod.snd hxβ© | |
| def rightQuery (a : K) (X : Matrix (K := K) slots H) : Assignment slots β DirectionQuotient.Space a Γ Z := | |
| DirectionQuotient.projectWithSide a β query slots H other X | |
| theorem rightQuery_shift (a : K) (X : Matrix (K := K) slots H) (h : H) : | |
| rightQuery slots H other a (EvaluationMatrix.shift H X a h) = | |
| rightQuery slots H other a X := by | |
| funext x | |
| apply Prod.ext | |
| Β· change DirectionQuotient.proj a | |
| (EvaluationMatrix.evaluate H X x + h.val x β’ a) = | |
| DirectionQuotient.proj a (EvaluationMatrix.evaluate H X x) | |
| rw [map_add, map_smul] | |
| have ha : DirectionQuotient.proj a a = 0 := | |
| (DirectionQuotient.proj_eq_zero_iff a a).mpr (Or.inr rfl) | |
| simp [ha] | |
| Β· rfl | |
| theorem rightResponse_shift (a : K) (X : Matrix (K := K) slots H) (h : H) : | |
| KeyStrategy.response Ο .right slots | |
| (rightQuery slots H other a (EvaluationMatrix.shift H X a h)) = | |
| KeyStrategy.response Ο .right slots (rightQuery slots H other a X) := by | |
| rw [rightQuery_shift] | |
| def Accepts (a : K) (X : Matrix (K := K) slots H) : Prop := | |
| CanonicalEdges.coarsen slots (query slots H other X) (DirectionQuotient.projectWithSide a) | |
| (KeyStrategy.label Ο .left slots (query slots H other X)) = | |
| KeyStrategy.label Ο .right slots (rightQuery slots H other a X) | |
| theorem accepts_iff (a : K) (X : Matrix (K := K) slots H) : | |
| Accepts slots H other Ο a X β | |
| DirectionQuotient.projectWithSide a (response slots H other Ο X) = | |
| KeyStrategy.response Ο .right slots (rightQuery slots H other a X) := | |
| CanonicalEdges.coarsen_eq_iff slots (query slots H other X) | |
| (DirectionQuotient.projectWithSide a) _ _ | |
| theorem accepted_response_in_fiber (a : K) (X : Matrix (K := K) slots H) (h : H) | |
| (hacc : Accepts slots H other Ο a (EvaluationMatrix.shift H X a h)) : | |
| DirectionQuotient.projectWithSide a | |
| (response slots H other Ο (EvaluationMatrix.shift H X a h)) = | |
| KeyStrategy.response Ο .right slots (rightQuery slots H other a X) := by | |
| have h := (accepts_iff slots H other Ο a (EvaluationMatrix.shift H X a h)).mp hacc | |
| rwa [rightResponse_shift] at h | |
| theorem card_accepted_responses_le_two [Finite K] [Finite Z] | |
| (a : K) (ha : a β 0) (X : Matrix (K := K) slots H) : | |
| Nat.card {y : K Γ Z // β h : H, | |
| Accepts slots H other Ο a (EvaluationMatrix.shift H X a h) β§ | |
| response slots H other Ο (EvaluationMatrix.shift H X a h) = y} β€ 2 := by | |
| let z := KeyStrategy.response Ο .right slots (rightQuery slots H other a X) | |
| let intoFiber : | |
| {y : K Γ Z // β h : H, | |
| Accepts slots H other Ο a (EvaluationMatrix.shift H X a h) β§ | |
| response slots H other Ο (EvaluationMatrix.shift H X a h) = y} β | |
| {y : K Γ Z // DirectionQuotient.projectWithSide a y = z} := fun y => | |
| β¨y.val, by | |
| obtain β¨h, hacc, hyβ© := y.property | |
| rw [β hy] | |
| exact accepted_response_in_fiber slots H other Ο a X h haccβ© | |
| calc | |
| _ β€ Nat.card {y : K Γ Z // DirectionQuotient.projectWithSide a y = z} := | |
| Nat.card_le_card_of_injective intoFiber (by | |
| intro y y' he | |
| exact Subtype.ext (congrArg | |
| (fun v : {y : K Γ Z // DirectionQuotient.projectWithSide a y = z} => v.val) he)) | |
| _ = 2 := DirectionQuotient.card_projectWithSide_fiber a ha z | |
| end | |
| end PerfectCompleteness.CanonicalMatrixTable | |
| end | |
| end OAI | |