Documentation

CslibFrontier.Logics.Propositional.CSP.Planar.Substitution.VariableBlocks

Exact source-incidence blocks and clockwise regrouping #

The bounded scan for a source record selects its literal constraint-list position, regardless of duplicate rows. Accepted source white cycles regroup these blocks in their supplied positive cyclic order. The flattening only permutes source incidences; it does not identify repeated variable names or replace the source rotation by a reflected or reconstructed order.

theorem Cslib.Complexity.CSP.GadgetRotation.blockAtRecord_occurrence {Src Rel : Type} (templates : Src → Logic.PL.CSP Rel (Bool × ℕ)) (freeBlocks : Src → List (List ℕ)) (F : Logic.PL.CSP Src ℕ) (o : F.Occurrence) :
blockAtRecord templates freeBlocks F (↑o.fst, ↑o.snd) = shiftBlock (occurrencePrefix templates F ↑o.fst) ((freeBlocks o.relation).getD ↑o.snd [])

Scanning an actual indexed source incidence selects exactly its own copy and local port.

theorem Cslib.Complexity.CSP.GadgetRotation.incidenceBlock_occurrence {Src Rel : Type} (templates : Src → Logic.PL.CSP Rel (Bool × ℕ)) (freeBlocks : Src → List (List ℕ)) (F : Logic.PL.CSP Src ℕ) (o : F.Occurrence) :
incidenceBlock templates freeBlocks F (2 * incidenceEdgeIndex o) = shiftBlock (occurrencePrefix templates F ↑o.fst) ((freeBlocks o.relation).getD ↑o.snd [])

Each actual even source-dart lookup retains that occurrence's own literal local block.

theorem Cslib.Complexity.CSP.GadgetRotation.mem_variableBlock_iff_occurrence {Src Rel : Type} (templates : Src → Logic.PL.CSP Rel (Bool × ℕ)) (freeBlocks : Src → List (List ℕ)) (F : Logic.PL.CSP Src ℕ) (c : Graph.RotationCertificate) (hc : Graph.RotationCertificate.verifyRotation (incidenceGraph F) c = true) (v : ℕ) (hv : v ∈ F.vars) (index : ℕ) :
index ∈ variableBlock templates freeBlocks F c v ↔ ∃ (o : F.Occurrence), o.var = v ∧ index ∈ shiftBlock (occurrencePrefix templates F ↑o.fst) ((freeBlocks o.relation).getD ↑o.snd [])

A source-variable block contains exactly the individual incidence blocks at that original name. Every indexed repetition remains a separate selected source occurrence.

theorem Cslib.Complexity.CSP.GadgetRotation.flatten_variableBlocks_perm {Src Rel : Type} (templates : Src → Logic.PL.CSP Rel (Bool × ℕ)) (freeBlocks : Src → List (List ℕ)) (F : Logic.PL.CSP Src ℕ) (c : Graph.RotationCertificate) (hc : Graph.RotationCertificate.verifyRotation (incidenceGraph F) c = true) :
(List.flatMap (variableBlock templates freeBlocks F c) F.distinctVars).Perm (List.flatMap (fun (i : ℕ) => incidenceBlock templates freeBlocks F (2 * i)) (List.range F.occurrences.length))

Flattening the supplied source-variable cycles preserves every indexed source-incidence block exactly once. Their clockwise order inside each variable remains the supplied one.

theorem Cslib.Complexity.CSP.GadgetRotation.range_incidenceBlocks_eq {Src Rel : Type} (templates : Src → Logic.PL.CSP Rel (Bool × ℕ)) (freeBlocks : Src → List (List ℕ)) (F : Logic.PL.CSP Src ℕ) :
List.flatMap (fun (i : ℕ) => incidenceBlock templates freeBlocks F (2 * i)) (List.range F.occurrences.length) = List.flatMap (fun (o : F.Occurrence) => shiftBlock (occurrencePrefix templates F ↑o.fst) ((freeBlocks o.relation).getD ↑o.snd [])) F.incidenceList

The raw edge-index scan is exactly the typed occurrence scan of the selected free blocks.

theorem Cslib.Complexity.CSP.GadgetRotation.flatten_incidenceBlocks_eq {Src Rel : Type} (templates : Src → Logic.PL.CSP Rel (Bool × ℕ)) (freeBlocks : Src → List (List ℕ)) (F : Logic.PL.CSP Src ℕ) (hfree : ∀ c ∈ F, (freeBlocks c.rel).length = c.scope.length) :
List.flatMap (fun (i : ℕ) => incidenceBlock templates freeBlocks F (2 * i)) (List.range F.occurrences.length) = List.flatMap (fun (x : Logic.PL.Constraint Src ℕ × ℕ) => match x with | ({ rel := relation, scope := scope }, i) => List.flatMap (shiftBlock (occurrencePrefix templates F i)) (freeBlocks relation)) (List.zipIdx F)

The complete source-incidence scan enumerates every free word in each copy exactly once. The only arity premise is equality of the actual source scope and local free-word lengths.