Proving Termination with Remaining Work

A decreasing measure into the natural numbers can show that an operation eventually reaches a base case or stops looping.

Source
Anbloq
Language
English
Created
Updated
Chapters
2
Reading time
1 min
In this article2 chapters
  1. Trace batches of two
  2. Check branches that repeat

Trace batches of two

For a nonnegative remaining count, process two at a time but take the last singleton alone. Five decreases to three, one, and zero. See progress in a while loop.

Check branches that repeat

A failure path may continue without reducing remaining work. A separate bounded attempt measure can cover that route. Termination measures explain how to combine progress facts.[1]

References

  1. Benjamin C. Pierce et al., Software Foundations ↩