Proofs: Lawler's chromatic number algorithm
These are the human proofs of Lawler's chromatic number algorithm, at full length.
Lawler's dynamic program computes the chromatic number of every induced subgraph full
This proof shows: correctness, termination.
Let be a finite simple graph. For write for the induced subgraph and , with . Identify each subset with its bitmask, so that a proper subset has a smaller bitmask than .
Termination. Line L2 visits the nonempty subsets once each. For each , line L4 runs over the finite family of maximal independent sets of , and this family is not empty when , since any single vertex of extends greedily to a maximal independent set. So the algorithm stops, and is finite after the turn of .
Order of evaluation. If and is a maximal independent set of , then , so is a proper subset of . Its bitmask is smaller, so its turn in line L2 came earlier (or it is , set in line L1). Hence line L5 reads only final values.
Claim. After the turn of , .
Proof. By strong induction on the bitmask of . For , line L1 sets . Let and assume the claim for all smaller bitmasks, in particular for all proper subsets of . After the loop of lines L4 and L5,
Upper bound on . Fix a maximal independent set of and a proper coloring of with colors. Give every vertex of one new color. No edge joins two vertices of , since is independent, and an edge between and has ends of different colors because the color of is new. So has a proper coloring with colors, and .
Lower bound on . Let and fix a proper coloring of with classes ; we may take . The class is independent in . Add vertices of to it one at a time, each time a vertex with no neighbor in the current set, until no such vertex is left. The result is a maximal independent set of . The sets are independent and cover , because . So , and the term of in the minimum gives .
The two bounds give , which proves the claim.
Output. Line L6 returns . For the coloring, the implementation stores at each the set that gave the minimum. Following these choices from gives sets with , and , so the chain reaches after exactly steps. Each is independent and the partition , so giving color to is a proper coloring with colors. ∎