Documentation

CslibFrontier.Algorithms.WordRAM.TreeDecomposition.IndependentSet.ChildPass

Child-to-parent DP table projection pass (childPassProg) #

This module certifies the child pass childPassProg, which iterates over all 2 ^ |LB| child masks curC, checks pairwise independence (indepBagProg), transfers curC to its parent-bag mask (keyMaskProg), computes the forgotten-vertex weight (forgetWeightProg), and updates the scratch array best at bestPtr + key with the maximum of its previous value and fw + tblB[curC].

Main definitions #

Main results #

List mirror of childPassInst #

def Cslib.Algorithms.WordRAM.TreeDecomposition.childPassList (adj : ℕ → ℕ → Bool) (wt : ℕ → ℕ) (LB LP tblB init : List ℕ) :

List ℕ counterpart of childPassInst matching contiguous HoldsIn blocks in memory.

theorem Cslib.Algorithms.WordRAM.TreeDecomposition.length_childPassList (adj : ℕ → ℕ → Bool) (wt : ℕ → ℕ) (LB LP tblB init : List ℕ) (c : ℕ) :
(childPassList adj wt LB LP tblB init c).length = init.length

childPassList preserves the length of init.

theorem Cslib.Algorithms.WordRAM.TreeDecomposition.getD_childPassList_eq (adj : ℕ → ℕ → Bool) (wt : ℕ → ℕ) (LB LP tblB : List ℕ) (f : Array ℕ) (c : ℕ) (htbl : ∀ t < c, tblB.getD t 0 = f.getD t 0) (k : ℕ) :
k < 2 ^ LP.length → (childPassList adj wt LB LP tblB (List.replicate (2 ^ LP.length) 0) c).getD k 0 = (childPassInst adj wt LB LP f (Array.replicate (2 ^ LP.length) 0) c).getD k 0

childPassList agrees entrywise with childPassInst on 0 .. 2 ^ |LP| - 1.

theorem Cslib.Algorithms.WordRAM.TreeDecomposition.mem_childPassList_le {adj : ℕ → ℕ → Bool} {wt : ℕ → ℕ} {LB LP tblB init : List ℕ} {cap c : ℕ} (hinit : ∀ x ∈ init, x ≤ cap) (hstep : ∀ t < c, Lean.TreeDecomposition.forgetWeight wt LP LB t + tblB.getD t 0 ≤ cap) (x : ℕ) :
x ∈ childPassList adj wt LB LP tblB init c → x ≤ cap

Every entry of childPassList is bounded by cap when init and all candidate sums are.

Word-RAM child pass (childPassProg) #

Register arguments for childPassProg.

  • numVerts : ℕ

    Number of graph vertices m.

  • adjPtr : ℕ

    Base memory address of the m × m adjacency matrix.

  • wtPtr : ℕ

    Base memory address of the m-word weight array.

  • bagBPtr : ℕ

    Base memory address of child bag LB.

  • bagBLen : ℕ

    Length of child bag LB.

  • tblBPtr : ℕ

    Base memory address of child DP table tblB.

  • tblBLen : ℕ

    Length 2 ^ |LB| of child DP table tblB.

  • bagPPtr : ℕ

    Base memory address of parent bag LP.

  • bagPLen : ℕ

    Length of parent bag LP.

  • bestPtr : ℕ

    Base memory address of the scratch best array of length 2 ^ |LP|.

Instances For

    Populate the scratch best array at args.bestPtr across all args.tblBLen child masks.

    theorem Cslib.Algorithms.WordRAM.TreeDecomposition.childPassProg_spec {w : ℕ} (args : ChildPassArgs) {inst : MWISInstance} {LB LP tblB initL : List ℕ} {cap : ℕ} {s : DataStructure.Memory.State} (hadj : WordRAM.Realization.HoldsIn args.adjPtr inst.adjMatrix s) (hadj_end : args.adjPtr + inst.adjMatrix.length ≤ args.bestPtr) (hwt : WordRAM.Realization.HoldsIn args.wtPtr inst.weights s) (hwt_end : args.wtPtr + inst.weights.length ≤ args.bestPtr) (hnv : args.numVerts = inst.numVerts) (hLB : WordRAM.Realization.HoldsIn args.bagBPtr LB s) (hlenB : LB.length = args.bagBLen) (hLB_end : args.bagBPtr + args.bagBLen ≤ args.bestPtr) (hLB_lt : ∀ u ∈ LB, u < inst.numVerts) (htblB : WordRAM.Realization.HoldsIn args.tblBPtr tblB s) (htblB_len : tblB.length = args.tblBLen) (htblB_end : args.tblBPtr + args.tblBLen ≤ args.bestPtr) (hLP : WordRAM.Realization.HoldsIn args.bagPPtr LP s) (hlenP : LP.length = args.bagPLen) (hLP_end : args.bagPPtr + args.bagPLen ≤ args.bestPtr) (hinit : WordRAM.Realization.HoldsIn args.bestPtr initL s) (hinit_len : initL.length = 2 ^ LP.length) (hinit_le : ∀ x ∈ initL, x ≤ cap) (hcand_le : ∀ t < args.tblBLen, Lean.TreeDecomposition.forgetWeight inst.wt LP LB t + tblB.getD t 0 ≤ cap) (hfit_cap : WordRAM.Fits w cap) :

    Functional correctness, framing below bestPtr, and memory-cost bound for childPassProg.

    theorem Cslib.Algorithms.WordRAM.TreeDecomposition.childPassProg_realizes :
    WordRAM.Realization.Realizes WordRAM.Basis.exact childPassProg WordRAM.Realization.WordEncoding.encode WordRAM.Realization.WordEncoding.encode (fun (w : ℕ) (args : ChildPassArgs) (s : DataStructure.Memory.State) => WordRAM.Fits w 2 ∧ ∃ (m : ℕ) (adjL : List ℕ) (wtL : List ℕ) (LB : List ℕ) (LP : List ℕ) (tblB : List ℕ) (initL : List ℕ) (cap : ℕ), adjL.length = m * m ∧ wtL.length = m ∧ args.numVerts = m ∧ WordRAM.Realization.HoldsIn args.adjPtr adjL s ∧ args.adjPtr + adjL.length ≤ args.bestPtr ∧ WordRAM.Realization.HoldsIn args.wtPtr wtL s ∧ args.wtPtr + wtL.length ≤ args.bestPtr ∧ WordRAM.Realization.HoldsIn args.bagBPtr LB s ∧ LB.length = args.bagBLen ∧ args.bagBPtr + args.bagBLen ≤ args.bestPtr ∧ (∀ u ∈ LB, u < m) ∧ WordRAM.Realization.HoldsIn args.tblBPtr tblB s ∧ tblB.length = args.tblBLen ∧ args.tblBPtr + args.tblBLen ≤ args.bestPtr ∧ WordRAM.Realization.HoldsIn args.bagPPtr LP s ∧ LP.length = args.bagPLen ∧ args.bagPPtr + args.bagPLen ≤ args.bestPtr ∧ WordRAM.Realization.HoldsIn args.bestPtr initL s ∧ initL.length = 2 ^ args.bagPLen ∧ args.bagBLen * List.foldl max 0 wtL + List.foldl max 0 tblB ≤ cap ∧ WordRAM.Fits w (args.adjPtr + m * m) ∧ WordRAM.Fits w (args.wtPtr + m) ∧ WordRAM.Fits w (args.bagBPtr + args.bagBLen) ∧ WordRAM.Fits w (args.tblBPtr + args.tblBLen) ∧ WordRAM.Fits w (args.bagPPtr + args.bagPLen) ∧ WordRAM.Fits w (2 ^ args.bagPLen) ∧ WordRAM.Fits w (args.bestPtr + 2 ^ args.bagPLen) ∧ WordRAM.Fits w cap) fun (x : ChildPassArgs) (x_1 : DataStructure.Memory.State) => 0

    Exact-basis Word-RAM realization certificate for childPassProg.