State transition table

A state transition table is an alternative way of expressing sequential modal logic. Instead of drawing states and transitions graphically in a State flow chart, you express the modal logic in tabular format.

Benefits of using state transition tables include:

Ease of modeling train-like state machines, where the modal logic involves transitions from one state to its neighbor

Concise, compact format for a state machine

Reduced maintenance of graphical objects

When you add or remove states from a chart, you have to rearrange states, transitions, and junctions. When you add or remove states from a state transition table, you do not have to rearrange any graphical objects. Common forms

A state transition table is a means of recording all of the possible states and transitions for a Finite State Machine. Some software modeling tools will generate code or state transition diagrams from such a table.

One-dimensional state tables

Also called characteristic tables, single-dimension state tables are much more like truth tables than the two-dimensional versions. Inputs are usually placed on the left, and separated from the outputs, which are on the right. The outputs will represent the next state of the machine. A simple example of a state machine with two states and two combination inputs follows:

A             B             Current State     Next State          Output

0              0              S1           S2           1

0              0              S2           S1           0

0              1              S1           S2           0

0              1              S2           S2           1

1              0              S1           S1           1

1              0              S2           S1           1

1              1              S1           S1           1

1              1              S2           S2           0

S1 and S2 would most likely represent the single bits 0 and 1, since a single bit can only have two states.

Two-dimensional state tables

State transition tables are typically two-dimensional tables. There are two common forms for arranging them.

The vertical (or horizontal) dimension indicates current states, the horizontal (or vertical) dimension indicates events, and the cells (row/column intersections) in the table contain the next state if an event happens (and possibly the action linked to this state transition).

State Transition Table   Events

State     E1           E2             …          En

S1           –              Ay/Sj      …            –

S2           –              –                …            Ax/Si

…            …            …             …            …

Sm          Az/Sk    –               …            –

(S: state, E: event, A: action, -: illegal transition)

The vertical (or horizontal) dimension indicates current states, the horizontal (or vertical) dimension indicates next states, and the row/column intersections contain the event which will lead to a particular next state.

State Transition Table       next

current                 S1           S2             …          Sm

S1                               –              –              …            Ax/Ei

S2                             Ay/Ej     –              …            –

…                               …            …            …            …

Sm                             –              Az/Ek    …            –

(S: state, E: event, A: action, -: impossible transition)

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.[1] This is an alternative to representing communication between separate, interdependent state machines.

At the other extreme, separate tables have been used for each of the transitions within a single state machine: “AND/OR tables”[2] 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 for a machine M together with the corresponding state diagram is given below.

State Transition Table   Input

State     1              0

S1           S1           S2

S2           S2           S1

State Diagram

DFA example.svg

All the possible inputs to the machine are enumerated across the columns of the table. All the possible states are enumerated across the rows. From the state transition table given above, it is easy to see that if the machine is in S1 (the first row), and the next input is character 1, the machine will stay in S1. If a character 0 arrives, the machine will transition to S2 as can be seen from the second column. In the diagram this is denoted by the arrow from S1 to S2 labeled with a 0.

For a nondeterministic finite automaton (NFA), a new 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 a pair of curly braces { } with the set of all target states between them. An example is given below.

State Transition Table for an NFA   Input

State     1              0              ε

S1           S1           { S2, S3 }               Φ

S2           S2           S1           Φ

S3           S2           S1           S1

Here, a non deterministic machine in the state S1 reading an input of 0 will cause it to be in two states at the same time, the state S2 and S3. The last column defines the legal transition of states of the special character, ε. This special character allows the NFA to move to a different state when given no input. In state S3, the NFA may move to S1 without consuming an input character. The two cases above make the finite automaton described non-deterministic.

Leave a comment