Documentation

CslibFrontier.Logics.Propositional.CSP.Planar.Substitution.Table

Positional rotation tables for fixed-gadget replacement #

The target body is exactly replaceGadgets, with its existing even/odd fresh namespaces. Local rotation blocks use local occurrence positions. At each original variable, its source successor cycle orders the blocks of its distinct source incidences, even when the same variable occurs repeatedly in one constraint. Target argument rotations are built from the target's actual ordered scope lists, so no relation is reflected.

Every loop is funded by a source, template, or target list. Binary source names and invalid binary successor entries are lookup data, not loop bounds. Fixed template preprocessing is nonuniform in the language. This module defines the executed positional table construction; its vertex-fiber and componentwise numerical Euler properties are separate proof obligations.

def Cslib.Complexity.CSP.GadgetRotation.occurrencePrefix {Src Rel : Type} (templates : Src → Logic.PL.CSP Rel (Bool × ℕ)) (F : Logic.PL.CSP Src ℕ) (index : ℕ) :

Number of target occurrences contributed by the actual preceding source constraints.

Shift one local occurrence block into its literal position in the flat-mapped body.

def Cslib.Complexity.CSP.GadgetRotation.blockAtRecord {Src Rel : Type} (templates : Src → Logic.PL.CSP Rel (Bool × ℕ)) (freeBlocks : Src → List (List ℕ)) (F : Logic.PL.CSP Src ℕ) (record : ℕ × ℕ) :

Expand one recorded source incidence by scanning actual constraint positions. The record's indices are unary positions; relation symbols are read from the original body.

def Cslib.Complexity.CSP.GadgetRotation.incidenceBlock {Src Rel : Type} (templates : Src → Logic.PL.CSP Rel (Bool × ℕ)) (freeBlocks : Src → List (List ℕ)) (F : Logic.PL.CSP Src ℕ) (dart : ℕ) :

The block for a single original incidence position. Oversized supplied successor values are only used in the bounded lookup of the original occurrence record.

def Cslib.Complexity.CSP.GadgetRotation.variableBlock {Src Rel : Type} (templates : Src → Logic.PL.CSP Rel (Bool × ℕ)) (freeBlocks : Src → List (List ℕ)) (F : Logic.PL.CSP Src ℕ) (c : Graph.RotationCertificate) (v : ℕ) :

Splice blocks in the actual source rotation at one appearing variable. The start is its first positional occurrence, with no enumeration up to the numeric variable name.

def Cslib.Complexity.CSP.GadgetRotation.replacementCycles {Src Rel : Type} (templates : Src → Logic.PL.CSP Rel (Bool × ℕ)) (freeBlocks auxiliaryBlocks : Src → List (List ℕ)) (F : Logic.PL.CSP Src ℕ) (c : Graph.RotationCertificate) :

All variable-side target cycles: source-variable blocks first, followed by each copy's private auxiliary-variable cycles in constraint-list order. Empty blocks are harmless.

theorem Cslib.Complexity.CSP.GadgetRotation.mem_replacementCycles_iff {Src Rel : Type} (templates : Src → Logic.PL.CSP Rel (Bool × ℕ)) (freeBlocks auxiliaryBlocks : Src → List (List ℕ)) (F : Logic.PL.CSP Src ℕ) (c : Graph.RotationCertificate) (word : List ℕ) :
word ∈ replacementCycles templates freeBlocks auxiliaryBlocks F c ↔ (∃ v ∈ F.distinctVars, variableBlock templates freeBlocks F c v = word) ∨ ∃ (i : Fin (List.length F)), ∃ block ∈ auxiliaryBlocks F[↑i].rel, shiftBlock (occurrencePrefix templates F ↑i) block = word

Each emitted word is either one actual source-variable splice or one auxiliary block at an actual indexed source row. Duplicate source records retain separate copy indices.

Successor pairs for each actual target occurrence. The second entry always follows its original target constraint's cyclic argument order.

Emit one even variable successor and one odd argument successor per target occurrence.

The produced table has exactly two entries per actual target occurrence on all inputs.

The emitted constraint-side rotation has exactly the target's literal argument order, independently of the candidate variable cycles. This is an executed checker equality.

Every emitted raw successor is its exact variable-cycle or original argument successor. This inspects the actual indexed body, retaining duplicate rows and repeated variable names.

def Cslib.Complexity.CSP.GadgetRotation.replacementCertificate {Src Rel : Type} (B : ℕ) (templates : Src → Logic.PL.CSP Rel (Bool × ℕ)) (freeBlocks auxiliaryBlocks : Src → List (List ℕ)) (F : Logic.PL.CSP Src ℕ) (c : Graph.RotationCertificate) :

The candidate certificate is computed from the literal replacement body and positional source/template blocks. No rotation search is performed.

theorem Cslib.Complexity.CSP.GadgetRotation.verifyArgumentOrder_replacementCertificate {Src Rel : Type} (B : ℕ) (templates : Src → Logic.PL.CSP Rel (Bool × ℕ)) (freeBlocks auxiliaryBlocks : Src → List (List ℕ)) (F : Logic.PL.CSP Src ℕ) (c : Graph.RotationCertificate) :
verifyArgumentOrder (Logic.PL.CSP.replaceGadgets B templates F) (replacementCertificate B templates freeBlocks auxiliaryBlocks F c) = true

Every target scope order is preserved by the generated table, including repeated variables and duplicate constraint records.