Reasoning about loops


Document last modified: 

Two Common Ways to Reason About Loops:

  1. loop tracing - tracing through a loop based on some input
  2. loop invariant - captures what the loop does not do, i.e., what it leaves unchanged over any single execution of the loop body (and hence over the entire execution of the loop)

Loop Invariant