 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
n |
A loop
invariant is a condition
that remains true as
|
|
|
we repeatedly
execute the loop body, and captures the
|
|
fundamental
intent in iteration.
|
|
|
n |
partial
correctness: the assertion that a loop is
|
|
|
correct if it
terminates.
|
|
n |
total
correctness: the assertion that a loop is both
|
|
|
partially
correct, and terminates.
|
|
n |
loop
invariant: a condition that is true at the start of
|
|
|
execution of a
loop and remains true no matter how
|
|
|
many times the
body of the loop is performed.
|
|