The Notion of State
A declarative model that is good for describing control logic is based on the notions of state and state transition. The state of a system is a summary of its history, and the state transition function describes how the state changes with input.
Here are some examples of state and state transition:
state |
input |
state transition |
values in computer memory |
instructions |
assign new values to variables |
your net worth |
income and expenditures |
changes when you save or spend |
parking meter flag and timer positions |
clock tick and coin insertion |
changes with passage of time and coin insertion |
customers present in a store |
customers enter or leave |
changes when customers enter or leave store |
positions and velocities of masses |
forces |
positions and velocities are changed according to Newton's laws |
For some of these, the state changes discretely in response to discrete input events. We will focus first on such examples.