Documentation

CslibFrontier.Logics.Propositional.CSP.Planar.Substitution.CopyLabels

Actual target labels at copied gadget occurrences #

The target getters follow the existing template and instantiation operations. Free ports read the actual source scope; auxiliary names retain their source-copy and local indices. A fixed auxiliary bound separates all private copies, without requiring distinct source names or an injection of a source scope. Binary labels are data, not enumeration bounds.

theorem Cslib.Complexity.CSP.GadgetRotation.getElem_template_vars_occurrence {Rel : Type} {arity : Rel → ℕ} {sem : Rel → List Bool → Bool} {n : ℕ} {R : Set (Fin n → Bool)} (g : Logic.PL.CSP.PPGadget arity sem R) (o : g.body.Occurrence) :
g.template.vars[incidenceEdgeIndex o] = Sum.elim (fun (i : Fin n) => (false, ↑i)) (fun (j : Fin g.numAux) => (true, ↑j)) o.var

A template's occurrence getter retains the canonical free/auxiliary port coordinates.

theorem Cslib.Complexity.CSP.GadgetRotation.copyIndex_lt_gadgetOccurrence {Src Rel : Type} {arity : Rel → ℕ} {sem : Rel → List Bool → Bool} {srcArity : Src → ℕ} {srcSem : Src → List Bool → Bool} (gadgets : (r : Src) → Logic.PL.CSP.PPGadget arity sem (Logic.PL.CSP.booleanRelation srcArity srcSem r)) (B : ℕ) (F : Logic.PL.CSP Src ℕ) {i : ℕ} (hi : i < List.length F) (o : (gadgets F[i].rel).body.Occurrence) :
occurrencePrefix (fun (r : Src) => (gadgets r).template) F i + incidenceEdgeIndex o < (Logic.PL.CSP.replaceGadgets B (fun (r : Src) => (gadgets r).template) F).vars.length

Each typed gadget occurrence shifts to a bounded actual target position.

theorem Cslib.Complexity.CSP.GadgetRotation.getElem_vars_gadgetCopy {Src Rel : Type} {arity : Rel → ℕ} {sem : Rel → List Bool → Bool} {srcArity : Src → ℕ} {srcSem : Src → List Bool → Bool} (gadgets : (r : Src) → Logic.PL.CSP.PPGadget arity sem (Logic.PL.CSP.booleanRelation srcArity srcSem r)) (B : ℕ) (F : Logic.PL.CSP Src ℕ) {i : ℕ} (hi : i < List.length F) (o : (gadgets F[i].rel).body.Occurrence) :
(Logic.PL.CSP.replaceGadgets B (fun (r : Src) => (gadgets r).template) F).vars[occurrencePrefix (fun (r : Src) => (gadgets r).template) F i + incidenceEdgeIndex o] = Sum.elim (fun (a : Fin (srcArity F[i].rel)) => 2 * F[i].scope.getD (↑a) 0) (fun (j : Fin (gadgets F[i].rel).numAux) => 2 * (B * i + ↑j) + 1) o.var

The actual replacement variable at a copied occurrence is its original instantiated name.

theorem Cslib.Complexity.CSP.GadgetRotation.exists_gadgetCopy {Src Rel : Type} {arity : Rel → ℕ} {sem : Rel → List Bool → Bool} {srcArity : Src → ℕ} {srcSem : Src → List Bool → Bool} (gadgets : (r : Src) → Logic.PL.CSP.PPGadget arity sem (Logic.PL.CSP.booleanRelation srcArity srcSem r)) (B : ℕ) (F : Logic.PL.CSP Src ℕ) {index : ℕ} (hi : index < (Logic.PL.CSP.replaceGadgets B (fun (r : Src) => (gadgets r).template) F).vars.length) :
∃ (i : ℕ) (hi : i < List.length F) (o : (gadgets F[i].rel).body.Occurrence), occurrencePrefix (fun (r : Src) => (gadgets r).template) F i + incidenceEdgeIndex o = index

Every bounded target position has an actual typed occurrence in one original gadget copy. This recovers positions through the existing public incidence-index lookup.

theorem Cslib.Complexity.CSP.GadgetRotation.shifted_boundaryBlock_spec {Src Rel : Type} {arity : Rel → ℕ} {sem : Rel → List Bool → Bool} {srcArity : Src → ℕ} {srcSem : Src → List Bool → Bool} (gadgets : (r : Src) → Logic.PL.CSP.PPGadget arity sem (Logic.PL.CSP.booleanRelation srcArity srcSem r)) (witnesses : (r : Src) → OrderedBoundary.GadgetWitness (gadgets r)) (B : ℕ) (F : Logic.PL.CSP Src ℕ) {i : ℕ} (hi : i < List.length F) (v : Fin (srcArity F[i].rel) ⊕ Fin (gadgets F[i].rel).numAux) {index : ℕ} (hm : index ∈ shiftBlock (occurrencePrefix (fun (r : Src) => (gadgets r).template) F i) (boundaryBlock (gadgets F[i].rel) (witnesses F[i].rel) v)) :
index < (Logic.PL.CSP.replaceGadgets B (fun (r : Src) => (gadgets r).template) F).vars.length ∧ (Logic.PL.CSP.replaceGadgets B (fun (r : Src) => (gadgets r).template) F).vars.getD index 0 = Sum.elim (fun (a : Fin (srcArity F[i].rel)) => 2 * F[i].scope.getD (↑a) 0) (fun (j : Fin (gadgets F[i].rel).numAux) => 2 * (B * i + ↑j) + 1) v

Every copied variable-word entry is a bounded target position carrying precisely its instantiated canonical label. The same witness supplies the position and the target getter.

theorem Cslib.Complexity.CSP.GadgetRotation.getD_vars_of_mem_shifted_freeBlock {Src Rel : Type} {arity : Rel → ℕ} {sem : Rel → List Bool → Bool} {srcArity : Src → ℕ} {srcSem : Src → List Bool → Bool} (gadgets : (r : Src) → Logic.PL.CSP.PPGadget arity sem (Logic.PL.CSP.booleanRelation srcArity srcSem r)) (witnesses : (r : Src) → OrderedBoundary.GadgetWitness (gadgets r)) (B : ℕ) (F : Logic.PL.CSP Src ℕ) {i : ℕ} (hi : i < List.length F) (a : Fin (srcArity F[i].rel)) {index : ℕ} (hm : index ∈ shiftBlock (occurrencePrefix (fun (r : Src) => (gadgets r).template) F i) ((freeBoundaryBlocks (gadgets F[i].rel) (witnesses F[i].rel)).getD ↑a [])) :
(Logic.PL.CSP.replaceGadgets B (fun (r : Src) => (gadgets r).template) F).vars.getD index 0 = 2 * F[i].scope.getD (↑a) 0

A shifted free block reads exactly its source-scope name, including repeated names.

theorem Cslib.Complexity.CSP.GadgetRotation.getD_vars_of_mem_shifted_auxiliaryBlock {Src Rel : Type} {arity : Rel → ℕ} {sem : Rel → List Bool → Bool} {srcArity : Src → ℕ} {srcSem : Src → List Bool → Bool} (gadgets : (r : Src) → Logic.PL.CSP.PPGadget arity sem (Logic.PL.CSP.booleanRelation srcArity srcSem r)) (witnesses : (r : Src) → OrderedBoundary.GadgetWitness (gadgets r)) (B : ℕ) (F : Logic.PL.CSP Src ℕ) {i : ℕ} (hi : i < List.length F) (a : Fin (gadgets F[i].rel).numAux) {index : ℕ} (hm : index ∈ shiftBlock (occurrencePrefix (fun (r : Src) => (gadgets r).template) F i) ((auxiliaryBoundaryBlocks (gadgets F[i].rel) (witnesses F[i].rel)).getD ↑a [])) :
(Logic.PL.CSP.replaceGadgets B (fun (r : Src) => (gadgets r).template) F).vars.getD index 0 = 2 * (B * i + ↑a) + 1

A shifted auxiliary block reads its actual private copy index and local auxiliary label.

theorem Cslib.Complexity.CSP.GadgetRotation.auxiliaryName_eq_iff {B i k j q : ℕ} (hj : j < B) (hq : q < B) :
2 * (B * i + j) + 1 = 2 * (B * k + q) + 1 ↔ i = k ∧ j = q

The existing odd auxiliary encoding retains both copy and local index under the actual fixed bound. Zero auxiliary bounds cause no exception, since they admit no local index.