Loop invariants
What role must the loop invariant I of while B do S play to ensure post-condition Q holds afterwards?
We need
{B^I}S{I}
~B ^ I => Q
That is, the loop maintains the invariant and on termination, the post-condition holds
Previous slide
Next slide
Back to first slide
View graphic version