Finite Automata: States, Transitions and Finite-State Transition System
Finite Automata: States, Transitions and Finite-State Transition System
com
Finite Automata
Automata (singular: automation) are a particularly simple, but useful, model of computation.
They were initially proposed as a simple model for the behavior of neurons. The concept of a
finite automaton appears to have arisen in the 1943 paper “A logical calculus of the ideas
immanent in nervous activity", by Warren McCullock and Walter Pitts. In 1951 Kleene
introduced regular expressions to describe the behaviour of finite automata. He also proved the
important theorem saying that regular expressions exactly capture the behaviors of finite
automata. In 1959, Dana Scott and Michael Rabin introduced non-deterministic automata and
showed the surprising theorem that they are equivalent to deterministic automata. We will study
these fundamental results. Since those early years, the study of automata has continued to grow,
showing that they are indeed a fundamental idea in computing.
Let us first give some intuitive idea about a state of a system and state transitions before
describing finite automata.
Informally, a state of a system is an instantaneous description of that system which gives all
relevant information necessary to determine how the system can evolve from that point on.
Transitions are changes of states that can occur spontaneously or in response to inputs to the
states. Though transitions usually take time, we assume that state transitions are instantaneous
(which is an abstraction).
Some examples of state transition systems are: digital systems, vending machines, etc.
A system containing only a finite number of states and transitions among them is called a finite-
state transition system.
Finite-state transition systems can be modeled abstractly by a mathematical model called finite
automation.
We said that automata are a model of computation. That means that they are a simplified
abstraction of `the real thing'. So what gets abstracted away? One thing that disappears is any
notion of hardware or software. We merely deal with states and transitions between states. The
distinction between program and machine executing it disappears. One could say that an
automaton is the machine and the program. This makes automata relatively easy to implement in
either hardware or software. From the point of view of resource consumption, the essence of a
finite automaton is that it is a strictly finite model of computation. Everything in it is of a fixed,
finite size and cannot be modified in the course of the computation.
1
mywbut.com
Informally, a DFA (Deterministic Finite State Automaton) is a simple machine that reads an
input string -- one symbol at a time -- and then, after the input has been completely read, decides
whether to accept or reject the input. As the symbols are read from the tape, the automaton can
change its state, to reflect how it reacts to what it has seen so far.
1. A tape to hold the input string. The tape is divided into a finite number of cells. Each cell
holds a symbol from .
2. A tape head for reading symbols from the tape
3. A control , which itself consists of 3 things:
o finite number of states that the machine is allowed to be in (zero or more states
are designated as accept or final states),
o a current state, initially set to a start state,
o a state transition function for changing the current state.
An automaton processes a string on the tape by repeating the following actions until the tape
head has traversed the entire string:
1. The tape head reads the current tape cell and sends the symbol s found there to the
control. Then the tape head moves to the next cell.
2. He control takes s and the current state and consults the state transition function to get the
next state, which becomes the new current state.
Once the entire string has been processed, the state in which the automation enters is examined.
If it is an accept state , the input string is accepted ; otherwise, the string is rejected .
Summarizing all the above we can formulate the following formal definition:
2
mywbut.com
Acceptance of Strings:
The language accepted or recognized by a DFA M is the set of all strings accepted by M , and is
denoted by i.e.
The notion of acceptance can also be made more precise by extending the transition function .
That is, is the state the automation reaches when it starts from the state q and finish
processing the string w. Formally, we can give an inductive definition as follows:
The language of the DFA M is the set of strings that can take the start state to one of the
accepting states i.e.
L(M) = { | M accepts w }
={ | }
3
mywbut.com
Example 1:
It is a formal description of a DFA. But it is hard to comprehend. For ex. The language of the
DFA is any string over { 0, 1} having at least one 1.
We can describe the same DFA by transition table or state transition diagram as following:
Transition Table:
0 1
Explanation: We cannot reach find state w/0 or in the i/p string. There can be any no. of 0's at
the beginning. (The self-loop at on label 0 indicates it). Similarly there can be any no. of 0's &
1's in any order at the end of the string.
4
mywbut.com
Transition table:
It is basically a tabular representation of the transition function that takes two arguments (a state
and a symbol) and returns a value (the “next state”).
0 1
A state transition diagram or simply a transition diagram is a directed graph which can be
constructed as follows:
Here is an informal description how a DFA operates. An input to a DFA can be any string
. Put a pointer to the start state q. Read the input string w from left to right, one symbol at
a time, moving the pointer according to the transition function, . If the next symbol of w is a
and the pointer is on state p, move the pointer to . When the end of the input string w is
5
mywbut.com
encountered, the pointer is on some state, r. The string is said to be accepted by the DFA if
and rejected if . Note that there is no formal mechanism for moving the pointer.
Removing Transition
- transitions do not increase the power of an NFA . That is, any - NFA ( NFA with
transition), we can always construct an equivalent NFA without -transitions. The equivalent
NFA must keep track where the NFA goes at every step during computation. This can be done
by adding extra transitions for removal of every - transitions from the - NFA as follows.
If we removed the - transition from the - NFA , then we need to moves from
state p to all the state on input symbol which are reachable from state q (in the - NFA
) on same input symbol q. This will allow the modified NFA to move from state p to all states on
some input symbols which were possible in case of -NFA on the same input symbol. This
process is stated formally in the following theories.
Proof:
We construct
6
mywbut.com
i.e.
Basis : , then
But by definition of .
By definition of extension of
By inductions hypothesis.
Assuming that
By definition of
Since
7
mywbut.com
0 1
Transition table
0 1
Since the start state q0 must be final state in the equivalent NFA .
8
mywbut.com
-closures:
The concept used in the above construction can be made more formal by defining the -closure
for a state (or a set of states). The idea of -closure is that, when moving from a state p to a state
q (or from a set of states Si to a set of states Sj ) an input , we need to take account of all
-moves that could be made after the transition. Formally, for a given state q,
-closures:
-closures:
So, in the construction of equivalent NFA N' without -transition from any NFA with moves.
It is worth noting that a DFA is a special type of NFA and hence the class of languages accepted
by DFA s is a subset of the class of languages accepted by NFA s. Surprisingly, these two classes
are in fact equal. NFA s appeared to have more power than DFA s because of generality enjoyed
in terms of -transition and multiple next states. But they are no more powerful than DFA s in
terms of the languages they accept.
Proof: A DFA is just a special type of an NFA. In a DFA, the transition functions are defined
from whereas in case of an NFA it is defined from and
9
mywbut.com
i. e
If and
Then it is clear from the above construction of N that there is a sequence of states (in N)
Hence,
Given any NFA we need to construct as equivalent DFA i.e. the DFA need to simulate the
behavior of the NFA . For this, the DFA have to keep track of all the states where the NFA could
be in at every step during processing a given input string.
There are possible subsets of states for any NFA with n states. Every subset corresponds to
one of the possibilities that the equivalent DFA must keep track of. Thus, the equivalent DFA
will have states.
The formal constructions of an equivalent DFA for any NFA is given below. We first consider an
NFA without transitions and then we incorporate the affects of transitions later.
as follows
i.e.
10
mywbut.com
where
That is,
To show that this construction works we need to show that L(D)=L(N) i.e.
Or,
So, by definition.
Inductions hypothesis: Assume inductively that the statement holds of length less than
or equal to n.
Inductive step
11
mywbut.com
Now,
Now, given any NFA with -transition, we can first construct an equivalent NFA without -
transition and then use the above construction process to construct an equivalent DFA , thus,
proving the equivalence of NFA s and DFA s..
It is also possible to construct an equivalent DFA directly from any given NFA with -transition
by integrating the concept of -closure in the above construction.
- closure :
In the equivalent DFA , at every step, we need to modify the transition functions to keep
track of all the states where the NFA can go on -transitions. This is done by replacing
Besides this the initial state of the DFA D has to be modified to keep track of all the states that
can be reached from the initial state of NFA on zero or more -transitions. This can be done by
changing the initial state to -closure ( ).
It is clear that, at every step in the processing of an input string by the DFA D , it enters a state
that corresponds to the subset of states that the NFA N could be in at that particular point. This
has been proved in the constructions of an equivalent NFA for any -NFA
If the number of states in the NFA is n , then there are states in the DFA . That is, each state in
the DFA is a subset of state of the NFA .
12
mywbut.com
But, it is important to note that most of these states are inaccessible from the start state and
hence can be removed from the DFA without changing the accepted language. Thus, in fact, the
number of states in the equivalent DFA would be much less than .
Transition table
0 1
{ }
There will be states (representing all possible subset of states) in the equivalent DFA . The
transition table of the DFA constructed by using the subset constructions process is produced
here.
The final states are all those subsets that contains (since
in the NFA).
13
mywbut.com
It is interesting to note that we can avoid encountering all those inaccessible or unnecessary
states in the equivalent DFA by performing the following two steps inductively.
1. If is the start state of the NFA, then make - closure ( ) the start state of the
equivalent DFA. This is definitely the only accessible state.
14
mywbut.com
Following these steps in the above example, we get the transition table given below
0 1
15