Verification Conditions from Annotated Programs
Turn a loop annotation into three logical obligations and distinguish a failed proof obligation from a real runtime witness.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 2
- Reading time
- 1 min
In this article2 chapters
An invariant separates the loop from the solver
Consider \(x\) initialized to a nonnegative integer \(n\), decremented while \(x>0\), with result required to be zero. Let \(I\) state \(0\le x\le n\). The obligations are that entry implies \(I\), that \(I\land x>0\) implies \(I\) after decrement, and that \(I\land x\le0\) implies \(x=0\). The preservation condition uses weakest preconditions to express the successor assertion before updating \(x\). The ranking function \(x\) supplies termination.
The proof checks every state allowed by the annotation
If the annotation were only \(x\le n\), the exit obligation would admit a negative \(x\). That countermodel need not arise from any initial run. It shows the invariant needs a stronger bound. Inductive state invariants explain this distinction. Deductive program verification applies the same decomposition to larger programs with procedures and invariants.[1][2]