Inductive State Invariants
Prove a safety claim by finding a set that includes every initial state and is closed under all transitions.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 2
- Reading time
- 1 min
In this article2 chapters
An invariant can describe more states than actually occur
Choose predicate \(J\) so \(I\Rightarrow J\) and every allowed step carries \(J(s)\) to \(J(s')\). Then all reachable states satisfy \(J\) by induction on path length. If \(J\Rightarrow P\), the desired property \(P\) follows. Working with \(J\) can be much easier than explicitly describing every reachable state.
Strengthen a property that lacks one-step closure
Consider two counters initially zero, with each step incrementing both or resetting both to zero. The property \(x\le y\) is already preserved. To see why strengthening can matter, consider instead a transition that swaps their values. The inequality holds on all reachable equal pairs but fails for some unattainable states with \(x<y\). Equality is an inductive strengthening. Hoare triples apply the same initialization and preservation pattern to loops. Counterexample-guided refinement can uncover which extra facts make a proof possible.[1][2]