next up previous
Next: Fat Sets Up: Invariants Previous: C. Use a proof

OddCounter

Let OddCounter be the state machine:

tex2html_wrap476

More precisely,

OddCounter = (
tex2html_wrap_inline446
tex2html_wrap_inline448
tex2html_wrap_inline450
tex2html_wrap_inline418 =

1

 incĒ(i: int)

pre i is even

post x' = x + i

).

The invariant I want to prove is that OddCounter's state always holds an odd integer:

tex2html_wrap_inline460 x is odd.

Intuitively we see this is true because

  1. It's true of the initial state (1 is an odd integer).
  2. For the action inc:


Norman Papernick
Mon Mar 18 14:28:12 EST 1996