Hoare Logic
Rules
Assignment rule
If rule
While Rule
The Partial
Correctness rule for while loops is the following, where
is the loop invariant.
For total correctness, we need to add a variant
alongside our loop invariant; this is some Well-Founded
Relation that we need to ensure strictly decreases on every
iteration, and also add conditions that ensure that evaluating the
loop body and loop guard dont crash.