Proofs: Breadth-first branch and bound
These are the human proofs of Breadth-first branch and bound, at full length.
Breadth-first branch and bound returns an optimal leaf full
This proof shows: correctness, termination.
We use the pseudocode of the page. is a finite rooted tree, gives a value to each leaf, and satisfies for each node and each leaf in the subtree of , which we write . Here a leaf is a node that the test of line L6 marks as a complete solution; an inner node can also have no children, and it is then a dead end, not a leaf. Let , with if has no leaf.
Claim 1 (the incumbent is real). At each point of the run, either and , or is a leaf of and . Proof. This holds after line L1. Only line L7 changes and , and it sets them to and for a leaf .
Claim 2 (z only grows). Line L7 changes only to a larger value.
Claim 3 (invariant). At the start of each iteration of line L3, every leaf with satisfies for some node in .
Proof. Before the first iteration, and every leaf is below the root. Suppose the claim holds at the start of an iteration, let be the value of then, and let be the node removed at line L4. Let be a leaf with , where is the value of at the end of the iteration. Then , so for a node that was in . If , then is still in . Suppose , so .
- If line L5 drops , then , which is false.
- If is a leaf, then , and after line L7 we have , which is false.
- Otherwise is an inner node and for a child of . If line L10 puts into , then is in at the end of the iteration. If it does not, then , so , which is false.
In each case the claim holds at the start of the next iteration.
Claim 4 (termination). Each node of joins at most once, so the loop runs at most times. Proof. The root joins once, at line L2. Any other node joins only at line L10, while its parent is expanded, and by induction on depth is removed at most once, so it is expanded at most once.
Theorem. BFBB stops and returns , where is a leaf with , or when has no leaf.
Proof. By Claim 4 the loop ends, and then is empty. By Claim 3 no leaf has , so . By Claim 1, either , or for a leaf . So . If has a leaf, , so is a leaf with . If has no leaf, line L7 never runs, so .