Documentation

CslibFrontier.Algorithms.WordRAM.TreeDecomposition.CSP

Word-RAM DP for extensional finite-domain CSPs over serialized nice tree decompositions #

This module certifies one fixed exact-basis Word-RAM (Program .exact r) program solving extensional finite-domain CSPs whose input is a pre-serialized nice tree decomposition together with pre-materialized constraint truth tables (TreeCSPInstance.encode).

Computational model and scope #

The implementation is factored under CslibFrontier.Algorithms.WordRAM.TreeDecomposition.CSP into Model (pure DP specification, encoding, and bounds; publicly re-exported here), Radix, BagOps, ConstraintScan, NodeDesc, parallel node handlers LeafIntro, Forget, and Join, NodeStep, and Pass (imported privately so the top-level interface stays minimal).

Main definitions #

Main results #

One fixed exact-basis Word-RAM program computes TreeCSPInstance.result within ≤ C * (inst.stepBound + 1) + 1 instructions for every word width w satisfying Fits w inst.wordBound and InputFits w inst.encode.

Uniform exact-basis Word-RAM computability certificate for TreeCSPInstance.result.

theorem Cslib.Algorithms.WordRAM.TreeDecomposition.exists_program_cspDecide_nice :
∃ (r : ℕ) (C : ℕ) (prog : WordRAM.Program WordRAM.Basis.exact r), ∀ {Rel : Type u_1} {V : Type u_2} [inst : DecidableEq V] {q m k : ℕ} (hq : 0 < q) (e : V ≃ Fin m) (sem : Rel → List (Fin q) → Bool) (F : Logic.PL.CSP Rel V) (N : F.primalGraph.NiceTreeDecomposition), N.width ≤ k → ∀ (w : ℕ), have inst_1 := TreeCSPInstance.ofNice false q hq e sem F N; WordRAM.Fits w inst_1.wordBound → ∃ (steps : ℕ), WordRAM.Executes w prog (WordRAM.State.init inst_1.encode) (if Logic.PL.CSP.Satisfiable sem F then 1 else 0) steps ∧ steps ≤ C * (cspNiceStepBound q N.size k F.vars.length (List.length F) + 1) + 1

Word-RAM Extensional CSP Decision (Supplied Nice Tree Decomposition). One fixed exact-basis Word-RAM program decides CSP.Satisfiable sem F (returning 1 if satisfiable, 0 otherwise) from the serialized nice tree decomposition N (N.width ≤ k) and externally materialized, scope-deduplicated constraint truth tables (TreeCSPInstance.ofNice false ...) in ≤ C * (cspNiceStepBound q N.size k |F.vars| |F| + 1) + 1 instructions at any word width w satisfying Fits w inst.wordBound. Because decision-mode DP entries lie in {0, 1}, TreeCSPInstance.wordBound_ofNice_le guarantees logarithmic word width w = O(log(m + N.size + |F.vars| + |F| + q ^ (k + 1))). Tree-decomposition construction and constraint truth-table materialization (ConstraintTable.ofConstraint) are external to the Word-RAM and uncharged.

theorem Cslib.Algorithms.WordRAM.TreeDecomposition.exists_program_cspCount_nice_singleWord :
∃ (r : ℕ) (C : ℕ) (prog : WordRAM.Program WordRAM.Basis.exact r), ∀ {Rel : Type u_1} {V : Type u_2} [inst : DecidableEq V] {q m k : ℕ} (hq : 0 < q) (e : V ≃ Fin m) (sem : Rel → List (Fin q) → Bool) (F : Logic.PL.CSP Rel V) (N : F.primalGraph.NiceTreeDecomposition), N.width ≤ k → ∀ (w : ℕ), have inst_1 := TreeCSPInstance.ofNice true q hq e sem F N; WordRAM.Fits w inst_1.wordBound → ∃ (steps : ℕ), WordRAM.Executes w prog (WordRAM.State.init inst_1.encode) (Logic.PL.CSP.modelCount sem F) steps ∧ steps ≤ C * (cspNiceStepBound q N.size k F.vars.length (List.length F) + 1) + 1

Single-Word Wide-Word (w > F.numVars · log₂ q) Word-RAM Extensional CSP Exact Model Counting (Supplied Nice Tree Decomposition). One fixed exact-basis Word-RAM program computes CSP.modelCount sem F from the serialized nice tree decomposition N (N.width ≤ k) and externally materialized, scope-deduplicated constraint truth tables (TreeCSPInstance.ofNice true) in ≤ C * (cspNiceStepBound q N.size k |F.vars| |F| + 1) + 1 instructions at any word width w satisfying Fits w inst.wordBound.

On valid nice tree decompositions, inst.maxEntryBound = q ^ F.numVars (TreeCSPInstance.maxEntryBound_ofNice_eq, independent of redundant tree nodes), so this theorem operates in the wide-word single-register regime (w > F.numVars · log₂ q) where Basis.exact charges unit cost for adding (forget) and multiplying (join) single-word counts (matching CslibFrontier.Algorithms.WordRAM.HamiltonianCount). Logarithmic-word multi-word exact counting, tree-decomposition construction, and truth-table materialization remain open (#9170).

theorem Cslib.Algorithms.WordRAM.TreeDecomposition.exists_program_cspDecide_of_toNiceTreePruned :
∃ (r : ℕ) (C : ℕ) (prog : WordRAM.Program WordRAM.Basis.exact r), ∀ {Rel : Type u_1} {V : Type u_2} [inst : LinearOrder V] {q m n k : ℕ} (hq : 0 < q) (e : V ≃ Fin m) (sem : Rel → List (Fin q) → Bool) (F : Logic.PL.CSP Rel V) (R : F.primalGraph.RootedTreeDecomposition n), R.width ≤ k → ∀ (w : ℕ), have inst := TreeCSPInstance.ofToNiceTreePruned false q hq e sem F R; WordRAM.Fits w inst.wordBound → ∃ (steps : ℕ), WordRAM.Executes w prog (WordRAM.State.init inst.encode) (if Logic.PL.CSP.Satisfiable sem F then 1 else 0) steps ∧ steps ≤ C * (cspPrunedNiceStepBound q m k F.vars.length (List.length F) + 1) + 1

Intermediate step (not a rooted-tree Word-RAM algorithm or a Word-RAM formalization of Cygan et al., Parameterized Algorithms, Lemma 7.4): corollary of exists_program_cspDecide_nice in which R.toNiceTreePruned and ConstraintTable.ofConstraint are computed externally outside the Word-RAM and uncharged before .init inst.encode. Consequently, cspPrunedNiceStepBound bounds only the post-normalization nice-tree DP phase and has no dependence on the input rooted tree's node count n. Executing and charging rooted-to-nice normalization on the Word-RAM remains open (#9170).

theorem Cslib.Algorithms.WordRAM.TreeDecomposition.exists_program_cspCount_of_toNiceTreePruned_singleWord :
∃ (r : ℕ) (C : ℕ) (prog : WordRAM.Program WordRAM.Basis.exact r), ∀ {Rel : Type u_1} {V : Type u_2} [inst : LinearOrder V] {q m n k : ℕ} (hq : 0 < q) (e : V ≃ Fin m) (sem : Rel → List (Fin q) → Bool) (F : Logic.PL.CSP Rel V) (R : F.primalGraph.RootedTreeDecomposition n), R.width ≤ k → ∀ (w : ℕ), have inst_1 := TreeCSPInstance.ofToNiceTreePruned true q hq e sem F R; WordRAM.Fits w inst_1.wordBound → ∃ (steps : ℕ), WordRAM.Executes w prog (WordRAM.State.init inst_1.encode) (Logic.PL.CSP.modelCount sem F) steps ∧ steps ≤ C * (cspPrunedNiceStepBound q m k F.vars.length (List.length F) + 1) + 1

Intermediate step (not a rooted-tree Word-RAM algorithm, not a Word-RAM formalization of Cygan et al., Parameterized Algorithms, Lemma 7.4, and not a logarithmic-word counting algorithm): single-word wide-word (w > F.numVars · log₂ q, unit-cost Basis.exact arithmetic) corollary of exists_program_cspCount_nice_singleWord in which R.toNiceTreePruned and ConstraintTable.ofConstraint are computed externally outside the Word-RAM and uncharged before .init inst.encode. Consequently, cspPrunedNiceStepBound bounds only the post-normalization nice-tree DP phase and has no dependence on n. Executing and charging rooted-to-nice normalization on the Word-RAM and logarithmic-word multi-word exact counting remain open (#9170).