A state machine is a description of a process (computational, physical, economic) in terms of its potential sequences of states.
The state of a system is defined to be all we need to know about the system to predict its future trajectories as well as possible. For example, it could be the position and velocity of an object or the locations of your pieces on a game board, or the current traffic densities on a highway network.
Formally, we define a state machine as , where:
- is set of states
- is set of inputs
- is set of outputs
- is the initial state of the machine
- is a transition function, which takes an input and a previous state and produces a next state. This can be more clearly written as .
- is an output function, which takes a state and produces an output.
The basic operation of the state machine is to start with , then iteratively compute :
The diagram below illustrates this process:
- Note that the “feedback” connection of back into has to be buffered or delayed by one time step – otherwise, what it is computing would not generally be well defined.
So, given a sequence of inputs the machine generates a sequence of outputs
We sometimes say machine transduces sequences into sequence . The output at time can have dependence on inputs from steps to .
Finite state machines can be described using a State Transition Diagram.