Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 8

Theory of Computation

DFA

NFA
It is DFA but with different defined by
δ’ :Q x (Σ {}) 2Q
i.e., transitions from a state on an input symbol can be to any set of states.
Thus, it has the ability to be in several states at once. The set (q, λ) may be
empty. This means that there is no transition defined for this specific input
symbol λ. In order for a DFA to be an NFA the following condition must apply
for some state q and input x, i.e. | (q, x) | > 1.
It does not increasing the computational power of automata and is easier to
design.
Example (1). Design an NFA that accepts all strings that contain either 101 or
11 as a substring.
Theory of Computation

Example (2). Design an NFA that accepts all strings over {0,1}
containing a 1 in the third position from the end.

One good way to view this computation of NFA is to say that it stays in
the state q1 until it guesses that it is three places from the end. At that
point if the input symbol is 1, it branches to state q2 and uses q3 and q4
to check on whether its guess was correct.
Theory of Computation
Conversion of NFA to DFA.
The method of converting NFA to DFA can be described by using a formula
known as point- set topology. We shall describe it without its derivation. It is
given by
f( A I ) = f( A I )
Since, we have only so this implies that
A i , x ) = (A i , x)
and DFA is referred to as subset DFA.
To convert NFA of example (2) to equivalent DFA, we know that a DFA may
have many more states. The smallest DFA for A will contain 8 states. It is
given by
Theory of Computation
Example(3). Find DFA by converting the NFA given by

This NFA accepts all strings of the form 0k where k is a multiple of 2 or 3. We


must note here that superscript represents repetition. Thus it accepts the
strings,
Example (4). Convert the NFA to DFA. Clearly, it accepts the strings, , a, baba
and bba but does not accept the strings b, bb, babba.
Theory of Computation
Another method for conversion of NFA to DFA.
It is hard to decide for a string to be accepted by an NFA . If an NFA can be converted
to a DFA, then this type of problem will not arise. That means, we have to convert Q
× Σ → 2Q to Q′ × Σ → Q′, where Q is the finite set of states for an NFA, and Q′ is the set
of states for the converted DFA.
Procedure to convert NFA to DFA
(i)Start from the start state of the NFA. Put the state within [ ] in the present state
column.
(ii) Place the next states for the start state for the given inputs in the next state
column. Put them also in [ ].
(iii) If any new combination of state appears in next state column, which is not yet
taken in the present state column, then take that combination of state in the present
state column.
(iv) If in the present state column more than one state appears, then the next state
for that combination will be the combination of the next states for each of the states.
(v) If no new combination of state appears, which is not yet taken in the present state
column, stop the process.
(vi) The start state for the constructed DFA will be the start state of the NFA.
(vii)The final state or final states for the constructing DFA will be the combination of
states containing at least one final state.
Theory of Computation
Example (5). Construct a DFA from the NFA given by the following state table.

Solution.
Theory of Computation
Let us replace [q0] as A, [q0, q1] as B, [q1, q2] as C, [q0, q1, q2] as D, [q2] as E, and
[q1] as F. Then, the constructed finite automata is

In the finite automata, we are seeing that, for a single state and a single input
the machine can go to only one state. So it is a DFA. The starting state is [q0],
i.e., A. The final states are [q1, q2], i.e., C, [q0, q1, q2], i.e., D, and [q2], i.e., E.
The transition diagram for DFA is
Theory of Computation
Example(6). Construct a DFA from the given NFA

Example (7). Construct an equivalent DFA for the given NFA

You might also like