Documentation

CslibFrontier.Algorithms.Lean.TreeDecomposition.IndependentSet

Maximum-weight independent set over a tree decomposition #

Given a graph G with a rooted tree decomposition R : G.RootedTreeDecomposition n and vertex weights w : V → ℕ, the dynamic program mwisValue R w is the maximum total weight of an independent set of G. This module is the specification: it defines the program with Finset tables and proves it correct. The executable program mwisFPT of CslibFrontier.Algorithms.Lean.TreeDecomposition.IndependentSetFPT materializes the tables as bit-mask-indexed arrays and computes mwisValue R w (mwisFPT_eq_mwisValue); CslibFrontier.Algorithms.WordRAM.TreeDecomposition.IndependentSet realizes the algorithm on the Word-RAM with an explicit FPT instruction bound.

The program processes the nodes in decreasing order, so every child is handled before its parent. Node i keeps a table indexed by the subsets S of its bag. Once all children of i are processed, the entry for an independent S is the largest weight of a set J of vertices below i and outside the bag of i such that J ∪ S is independent. Processing a child j with parent p adds to the table of p, at S, the best value over the subsets T of the bag of j that are independent and agree with S on the shared vertices. The answer is the best value over the independent subsets of the root bag. Because every child table is indexed by its intersection with the parent bag, the program works on arbitrary rooted decompositions: it needs no nice decomposition and no separate join nodes.

Main definitions #

Main results #

Implementation notes #

The tables of forget, step and tables are closures and are never materialized, so forget re-evaluates the child closures, and evaluating mwisValue as written takes time exponential in the depth of the decomposition. These functions are a specification, not an algorithm; the executable program is mwisFPT. The decomposition is supplied by the caller, and its node count n + 1 is not bounded in terms of card V here. The definitions and theorems are universe polymorphic.

References #

The dynamic program #

def Cslib.Algorithms.Lean.TreeDecomposition.forget {V : Type u_1} (G : SimpleGraph V) [DecidableEq V] [DecidableRel G.Adj] (w : V → ℕ) (B P : Finset V) (f : Finset V → ℕ) (S : Finset V) :

The message from a child with bag B and table f to its parent with bag P, at a subset S of P: the best value of (∑ v ∈ T \ P, w v) + f T over the independent subsets T ⊆ B that agree with S on B ∩ P.

def Cslib.Algorithms.Lean.TreeDecomposition.step {V : Type u_1} {G : SimpleGraph V} {n : ℕ} [DecidableEq V] [DecidableRel G.Adj] (R : G.RootedTreeDecomposition n) (w : V → ℕ) (acc : Fin (n + 1) → Finset V → ℕ) (j : Fin (n + 1)) :
Fin (n + 1) → Finset V → ℕ

Process node j: add its message to the table of its parent.

def Cslib.Algorithms.Lean.TreeDecomposition.tables {V : Type u_1} {G : SimpleGraph V} {n : ℕ} [DecidableEq V] [DecidableRel G.Adj] (R : G.RootedTreeDecomposition n) (w : V → ℕ) :
ℕ → Fin (n + 1) → Finset V → ℕ

The tables after processing the nodes n, n - 1, …, n - t + 1.

The value of the dynamic program: the best value of (∑ v ∈ S, w v) + table S over the independent subsets S of the root bag, after processing every nonroot node.

Correctness #

theorem Cslib.Algorithms.Lean.TreeDecomposition.isGreatest_mwisValue {V : Type u_1} {G : SimpleGraph V} {n : ℕ} [DecidableEq V] [DecidableRel G.Adj] (R : G.RootedTreeDecomposition n) (w : V → ℕ) :
IsGreatest {x : ℕ | ∃ (I : Finset V), G.IsIndepSet ↑I ∧ ∑ v ∈ I, w v = x} (mwisValue R w)

Correctness. The value of the dynamic program is the maximum weight of an independent set: it is attained by an independent set and bounds the weight of every independent set.

With unit weights the dynamic program computes the independence number.