In
automata theory
Automata theory is the study of abstract machines and automata, as well as the computational problems that can be solved using them. It is a theory in theoretical computer science with close connections to cognitive science and mathematical l ...
and
sequential logic
In automata theory, sequential logic is a type of logic circuit whose output depends on the present value of its input signals and on the sequence of past inputs, the input history. This is in contrast to '' combinational logic'', whose output i ...
, a state-transition table is a table showing what state (or states in the case of a
nondeterministic finite automaton
In automata theory, a finite-state machine is called a deterministic finite automaton (DFA), if
* each of its transitions is ''uniquely'' determined by its source state and input symbol, and
* reading an input symbol is required for each state tr ...
) a
finite-state machine
A finite-state machine (FSM) or finite-state automaton (FSA, plural: ''automata''), finite automaton, or simply a state machine, is a mathematical model of computation. It is an abstract machine that can be in exactly one of a finite number o ...
will move to, based on the current state and other inputs. It is essentially a
truth table
A truth table is a mathematical table used in logic—specifically in connection with Boolean algebra, Boolean functions, and propositional calculus—which sets out the functional values of logical expressions on each of their functional arg ...
in which the inputs include the current state along with other inputs, and the outputs include the next state along with other outputs.
A state-transition table is one of many ways to specify a
finite-state machine
A finite-state machine (FSM) or finite-state automaton (FSA, plural: ''automata''), finite automaton, or simply a state machine, is a mathematical model of computation. It is an abstract machine that can be in exactly one of a finite number o ...
. Other ways include a
state diagram
A state diagram is used in computer science and related fields to describe the behavior of systems. State diagrams require that the system is composed of a finite number of states. Sometimes, this is indeed the case, while at other times this i ...
.
Common forms
One-dimension
State-transition tables are sometimes one-dimensional tables, also called ''characteristic tables''. They are much more like truth tables than their two-dimensional form. The single dimension indicates inputs, current states, next states and (optionally) outputs associated with the state transitions.
:
Two-dimensions
State-transition tables are typically two-dimensional tables. There are two common ways for arranging them.
In the first way, one of the dimensions indicates current states, while the other indicates inputs. The row/column intersections indicate next states and (optionally) outputs associated with the state transitions.
:
In the second way, one of the dimensions indicates current states, while the other indicates next states. The row/column intersections indicate inputs and (optionally) outputs associated with the state transitions.
:
Other forms
Simultaneous transitions in multiple finite-state machines can be shown in what is effectively an ''n''-dimensional state-transition table in which pairs of rows map (sets of) current states to next states.
This is an alternative to representing communication between separate, interdependent finite-state machines.
At the other extreme, separate tables have been used for each of the transitions within a single finite-state machine: "AND/OR tables"
are similar to incomplete
decision tables in which the decision for the rules which are present is implicitly the activation of the associated transition.
Example
An example of a state-transition table together with the corresponding
state diagram
A state diagram is used in computer science and related fields to describe the behavior of systems. State diagrams require that the system is composed of a finite number of states. Sometimes, this is indeed the case, while at other times this i ...
for a finite-state machine that accepts a string with an even number 0s is given below:
:
In the state-transition table, all possible inputs to the finite-state machine are enumerated across the columns of the table, while all possible states are enumerated across the rows. If the machine is in the state S
1 (the first row) and receives an input of 1 (second column), the machine will stay in the state S
1. Now if the machine is in the state S
1 and receives an input of 0 (first column), the machine will transition to the state S
2.
In the state diagram, the former is denoted by the arrow looping from S
1 to S
1 labeled with a 1, and the latter is denoted by the arrow from S
1 to S
2 labeled with a 0. This process can be described statistically using
Markov Chains.
For a
nondeterministic finite-state machine, an input may cause the machine to be in more than one state, hence its
non-determinism. This is denoted in a state-transition table by the set of all target states enclosed in a pair of braces . An example of a state-transition table together with the corresponding state diagram for a nondeterministic finite-state machine is given below:
:
If the machine is in the state S
2 and receives an input of 0, the machine will be in two states at the same time, the states S
1 and S
2.
Transformations from/to state diagram
It is possible to draw a
state diagram
A state diagram is used in computer science and related fields to describe the behavior of systems. State diagrams require that the system is composed of a finite number of states. Sometimes, this is indeed the case, while at other times this i ...
from a state-transition table. A sequence of easy to follow steps is given below:
# Draw the circles to represent the states given.
# For each of the states, scan across the corresponding row and draw an arrow to the destination state(s). There can be multiple arrows for an input character if the finite-state machine is nondeterministic.
# Designate a state as the
start state. The start state is given in the formal definition of a finite-state machine.
# Designate one or more states as
accepting state. This is also given in the formal definition of a finite-state machine.
See also
*
Adjacency list
In graph theory and computer science, an adjacency list is a collection of unordered lists used to represent a finite graph. Each unordered list within an adjacency list describes the set of neighbors of a particular vertex in the graph. This ...
*
Adjacency matrix
In graph theory and computer science, an adjacency matrix is a square matrix used to represent a finite graph (discrete mathematics), graph. The elements of the matrix (mathematics), matrix indicate whether pairs of Vertex (graph theory), vertices ...
*
Dataflow
In computing, dataflow is a broad concept, which has various meanings depending on the application and context. In the context of software architecture, data flow relates to stream processing or reactive programming.
Software architecture
Dat ...
*
Excitation table
*
Finite-state machine
A finite-state machine (FSM) or finite-state automaton (FSA, plural: ''automata''), finite automaton, or simply a state machine, is a mathematical model of computation. It is an abstract machine that can be in exactly one of a finite number o ...
*
Index notation
In mathematics and computer programming, index notation is used to specify the elements of an array of numbers. The formalism of how indices are used varies according to the subject. In particular, there are different methods for referring to th ...
*
Moore machine
In the theory of computation, a Moore machine is a finite-state machine whose current output values are determined only by its current state. This is in contrast to a Mealy machine, whose output values are determined both by its current state an ...
*
Mealy machine
In the theory of computation, a Mealy machine is a finite-state machine whose output values are determined both by its current state and the current inputs. This is in contrast to a Moore machine, whose output values are determined solely by its cu ...
*
Ward-Mellor methodology
References
Further reading
* Michael Sipser: ''Introduction to the Theory of Computation''. PWS Publishing Co., Boston 1997 {{ISBN, 0-534-94728-X
Automata (computation)