next up previous
Next: Other Properties of State Up: Constraints Previous: Fat Sets Again

MaxCounter

Constraints are useful for stating succinctly when things do not change in value. Consider the following MaxCounter machine whose state variable x can never exceed the value of the other state variable max. Max is initialized to 15 and its value never changes.

MaxCounter = (
tex2html_wrap_inline678
tex2html_wrap_inline680
tex2html_wrap_inline450
tex2html_wrap_inline418 =

1

 incĒ(i: int)

pre tex2html_wrap_inline686

post tex2html_wrap_inline688

).

It's trivial to show the following constraint:

tex2html_wrap_inline692

This kind of example may look simplistic but it generalizes to any system where you want to ensure that some state variable never changes. When we have a huge state space (as is more typical of software systems than in my zillions of simple counter examples), very often we are careful to state how some state variable changes but forget to say what state variables do not change. Constraints are a nice way to describe those properties.



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