Documentation

CslibFrontier.Algorithms.WordRAM.TreeDecomposition.CSP.NodeStep

Node-step dispatcher, iteration splitting lemmas, and subtree invariant #

This module combines leafNodeProg, introNodeProg, forgetNodeProg, and joinNodeProg into the tagged post-order dispatcher nodeStep and its loop wrapper iterNodesProg. It also records the iterate composition lemmas (clientState_iterate_add, memoryCost_iterate_add, etc.), holdsIn_encode_decode, the inductive specification SubtreeFullSpec, and the shared arithmetic setup subtree_setup.

Main definitions #

Main results #

Environment bundle threaded through the bottom-up nice-tree DP pass (nodeStep).

  • mode : ℕ

    Mode flag (1 for exact model counting, 0 for satisfiability).

  • q : ℕ

    Domain size q.

  • varsPtr : ℕ

    Base address of the serialized active-variable list vars.

  • varsLen : ℕ

    Length of the serialized vars list.

  • treePtr : ℕ

    Base address of the serialized post-order node array.

  • consRawPtr : ℕ

    Base address of the serialized constraint-table array.

  • numCons : ℕ

    Number of serialized constraint tables.

  • descBase : ℕ

    Base address of the allocated 4-word-per-node descriptor table.

Instances For

    Tuple equivalence encoding NodeEnv into Word-RAM registers.

    Dispatch one post-order nice-tree node p.2 to leafNodeProg, introNodeProg, forgetNodeProg, or joinNodeProg.

    Word-width safety predicate guarding one iteration of nodeStep.

    Execute count consecutive nodeStep iterations starting at node index start.

    theorem Cslib.Algorithms.WordRAM.TreeDecomposition.iterationSafe_add {δ σ : Type} (body : δ × σ → DataStructure.Memory.Prog σ) (safe : ℕ → δ × σ → DataStructure.Memory.State → Prop) (w : ℕ) (d : δ) (n₁ n₂ : ℕ) (a : σ) (s : DataStructure.Memory.State) (hs₁ : WordRAM.Realization.iterationSafe body safe w d n₁ a s) (hs₂ : WordRAM.Realization.iterationSafe body safe w d n₂ ((DataStructure.Memory.spec 0).clientResult s (WordRAM.Realization.iterate body d n₁ a)) ((DataStructure.Memory.spec 0).clientState s (WordRAM.Realization.iterate body d n₁ a))) :
    WordRAM.Realization.iterationSafe body safe w d (n₁ + n₂) a s
    @[reducible, inline]

    Static NodeEnv decoded from Memory.State.init inst.encode.

    @[reducible, inline]

    Inductive specification proved for every subtree S executed by iterate nodeStep.

    theorem Cslib.Algorithms.WordRAM.TreeDecomposition.subtree_setup {w : ℕ} (inst : TreeCSPInstance) (hw : WordRAM.Fits w inst.wordBound) :
    have env := subtreeEnv inst; have F_lo := env.descBase + 4 * inst.tree.size; have E := maxTableExp inst.tree; have perSpace := E + 2 + inst.domainSize ^ E; 1 ≤ inst.domainSize ^ E ∧ WordRAM.Fits w 4 ∧ WordRAM.Fits w inst.domainSize ∧ WordRAM.Fits w inst.tree.size ∧ WordRAM.Fits w (F_lo + inst.tree.size * perSpace) ∧ env.consRawPtr + (List.flatMap ConstraintTable.encode inst.constraints).length = env.descBase ∧ env.varsPtr + env.varsLen ≤ env.descBase ∧ env.consRawPtr + (List.flatMap ConstraintTable.encode inst.constraints).length ≤ env.descBase ∧ 0 < inst.tree.size ∧ perSpace ≤ inst.tree.size * perSpace ∧ (∀ A ≤ E ^ 2 + E + 4 + 3 * inst.constraints.length + inst.totalArity * (2 * E + 3), inst.domainSize ^ E * A ≤ inst.domainSize ^ E * (E ^ 2 + E + 4 + 3 * inst.constraints.length + inst.totalArity * (2 * E + 3))) ∧ ∀ (S : SimpleGraph.NiceTree ℕ), maxTreeVert S ≤ maxTreeVert inst.tree → ∀ u ∈ Lean.TreeDecomposition.bagList S, WordRAM.Fits w u