Professional Documents
Culture Documents
(NFA)
Definition: An NFA is a TG with a unique start
state and a property of having single letter as
label of transitions. An NFA is a collection of
three things
1) Finite many states with one initial and some
final states
2) Finite set of input letters, say, ={a, b, c}
3) Finite set of transitions, showing where to
move if a letter is input at certain state ( is
not a valid transition), there may be more
than one transition for certain letters and
there may not be any transition for certain
letters. 1
Observations
2+
a
1- a
3
a
b
4 5+
It is to be noted that the above NFA accepts the language consisting of a and
ab.
3
Example
a, b a,b
a a
1- 2 3+
It is to be noted that the above NFA accepts the language of strings, defined
over Σ = {a, b}, containing aa.
4
Note
5
Example
… 4 8 …
a a b
… 5 b c 9
7 …
c d
… 6 10 …
To eliminate the loop at state 7, the 6
… 4 b …
11 8
a c
d
… 5 a a …
9
b b
c
… 6 c 7 d 10 …
7
Converting an FA to an equivalent NFA
- +
a
► The above FA may be equivalent to the
following NFA
a, b
11
Example
1- 4+
b a
3
Using the method discussed earlier, the above
NFA may be equivalent to the following FA
12
Example Continued ...
2
a b
1- 4+
b a
3 1- a
2
b
b 4+ a
a a, b
3 b
D
13
a, b
Example
b b b
1- 2 3 4+
b b b
1- 2 3 4+
b b b
1- 2 (3,4)+ 4+
a a a a,b
D
15
a, b
Task
b b
1- 2 3+
16
Solution of the Task
a, b a, b
b b
1- 2 3+
b a
a b a
Method 2:
As discussed earlier that in an NFA, there may
be more than one transition for a certain letter
and there may not be any transition for certain
letter, so starting from the initial state
corresponding to the initial state of given NFA,
the transition table along with new labels of
states, of the corresponding FA, can be built
introducing an empty state for a letter having no
transition at certain state and a state
corresponding to the combination of states, for a
letter having more than one transitions.
Following are the examples
18
Example
b b
x - x x +
1 2 3
Using the method discussed earlier, the transition table corresponding to
the required FA may be constructed as
19
Example continued …
b a
a b a
z - b
z z + z +
1 a 2 3 b 4
21