File size: 4,808 Bytes
4a56cd6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | 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
|