An executable FPT program for maximum-weight independent set #
mwisFPT R w L is an executable pure program that computes the maximum total weight of an
independent set of G, given a rooted tree decomposition R : G.RootedTreeDecomposition n, vertex
weights w : V → ℕ and an ordering L of the bags (IsBagOrder R L). It materializes the
tables of mwisValue (CslibFrontier.Algorithms.Lean.TreeDecomposition.IndependentSet) as arrays
indexed by bit masks and stores them in a Vector over the nodes. mwisFPT_eq_mwisValue proves
that it equals mwisValue R w, so it returns the optimum (isGreatest_mwisFPT).
Machine-level FPT running-time bounds on an array-encoded decomposition live in
CslibFrontier.Algorithms.WordRAM.TreeDecomposition.IndependentSet.
The program #
The tables are indexed by bit masks over the ordered bags (ofMask, toMask). The nodes are
processed in the order n, n - 1, …, 1, so every child is processed before its parent. Processing
a node j with bag list LB and parent bag list LP (processNode) runs two loops:
- the child pass (
childPass) visits each of the2 ^ |LB|child maskst. It tests whether the subsetTselected bytis independent, computes the parent-bag mask ofTand the weight of the vertices ofToutside the parent bag, and updates the entry of a zero-initialized arraybestat that parent-bag mask with the maximum of its old value and the weight plus the table entry ofjatt; - the parent pass (
parentPass) visits each of the2 ^ |LP|parent maskss. It computes the parent-bag mask ofS ∩ B, for the parent subsetSselected bysand the child bagB, and adds the entry ofbestthere to the parent's table entry ats.
The root pass (rootPass) returns the best weight plus table entry over the independent subsets
of the root bag. getD_tablesFPT shows that the arrays agree with tables on every subset of
every bag. It is proved one node at a time against step (getD_processNode). The only nontrivial
step is that the child pass computes forget (getD_childPass_eq_forget).
Main definitions #
Cslib.Algorithms.Lean.TreeDecomposition.mwisFPT: the executable program.
Main results #
Cslib.Algorithms.Lean.TreeDecomposition.mwisFPT_eq_mwisValue: the program computesmwisValue R w.Cslib.Algorithms.Lean.TreeDecomposition.isGreatest_mwisFPT: so it computes the maximum weight of an independent set.Cslib.Algorithms.Lean.TreeDecomposition.mwisFPT_one_eq_indepNum: with unit weights it computes the independence number.
References #
The passes #
The parent pass: for each parent mask s < c, add the best child entry agreeing with s to
the old parent table.
The child pass over the child masks t < c: for each independent child subset, update the
entry of best at its parent-bag mask with the forgotten weight plus the child table entry.
The root pass over the root masks t < c: the best weight of an independent root subset plus
its table entry.
The program #
Process node j: build its message to its parent and add it to the parent's table.
The tables after processing the nodes n, n - 1, …, n - t + 1.
The executable program: process every nonroot node, then combine at the root.
Correctness of the passes #
After the child masks t < c, the entry of best at a parent mask k is the best value over
the independent child subsets with parent mask k.
Started from a zero table, the child pass computes forget on every parent subset.
Correctness #
One step of the program refines step: if the materialized tables agree with g on every
subset of every bag, then after processing j they agree with step R w g j.
The materialized tables agree with the specification tables of
CslibFrontier.Algorithms.Lean.TreeDecomposition.IndependentSet on every subset of every bag.
Correctness. The executable program computes the value of the dynamic program.
The executable program computes the maximum weight of an independent set.
With unit weights the executable program computes the independence number.