Documentation

CslibFrontier.Logics.Propositional.CSP.PrimitivePositive.Expansion

Static expansion of primitive-positive gadgets #

A finite macro body is interpreted using actual original-language gadgets. Each constraint occurrence receives a fresh auxiliary block, even when its symbol and scope repeat. Blocks have their actual lengths; no uniform bound or finite relation alphabet is required. The macro's old auxiliaries precede the concatenation of replacement auxiliaries. Free ports retain their index order. This module proves semantics only; ordered numerical witnesses are constructed separately in the planar expansion bridge.

Main definitions #

def Cslib.Logic.PL.CSP.PPGadget.expandList {Src Rel : Type} {arity : Rel → ℕ} {sem : Rel → List Bool → Bool} {srcArity : Src → ℕ} {srcSem : Src → List Bool → Bool} (gadgets : (r : Src) → PPGadget arity sem (booleanRelation srcArity srcSem r)) {k : ℕ} (F : CSP Src (Fin k)) (hF : WellFormed srcArity F) :
PPGadget arity sem {a : Fin k → Bool | eval srcSem a F = true}

Expand a finite conjunction on named finite ports by the existing conjunction and free-port substitution constructors. Its auxiliary layout is the ordered ragged sum of the actual replacement sizes. Nullary constraints and empty bodies are retained.

@[simp]
theorem Cslib.Logic.PL.CSP.PPGadget.numAux_expandList {Src Rel : Type} {arity : Rel → ℕ} {sem : Rel → List Bool → Bool} {srcArity : Src → ℕ} {srcSem : Src → List Bool → Bool} (gadgets : (r : Src) → PPGadget arity sem (booleanRelation srcArity srcSem r)) {k : ℕ} (F : CSP Src (Fin k)) (hF : WellFormed srcArity F) :
(expandList gadgets F hF).numAux = (List.map (fun (c : Constraint Src (Fin k)) => (gadgets c.rel).numAux) F).sum

Exact auxiliary count: every source occurrence contributes its own replacement size.

def Cslib.Logic.PL.CSP.PPGadget.expand {Src Rel : Type} {arity : Rel → ℕ} {sem : Rel → List Bool → Bool} {srcArity : Src → ℕ} {srcSem : Src → List Bool → Bool} (gadgets : (r : Src) → PPGadget arity sem (booleanRelation srcArity srcSem r)) {n : ℕ} {R : Set (Fin n → Bool)} (g : PPGadget srcArity srcSem R) :
PPGadget arity sem R

Expand a checked semantic macro into the original language. The macro's existential ports are hidden using the existing substitution operation, before the fresh ragged blocks. This is finite static preprocessing and makes no native running-time assertion.

@[simp]
theorem Cslib.Logic.PL.CSP.PPGadget.numAux_expand {Src Rel : Type} {arity : Rel → ℕ} {sem : Rel → List Bool → Bool} {srcArity : Src → ℕ} {srcSem : Src → List Bool → Bool} (gadgets : (r : Src) → PPGadget arity sem (booleanRelation srcArity srcSem r)) {n : ℕ} {R : Set (Fin n → Bool)} (g : PPGadget srcArity srcSem R) :
(expand gadgets g).numAux = g.numAux + (List.map (fun (c : Constraint Src (Fin n ⊕ Fin g.numAux)) => (gadgets c.rel).numAux) g.body).sum

Old macro auxiliaries precede the actual per-occurrence replacement blocks.