Professional Documents
Culture Documents
TOA Lec15
TOA Lec15
FA1 x1 - a,b
x2 b
x3 +
a
x4 a,b
b a b
FA2 y1 - y 2+
a
Task solution
x1 - a,b
x2 b
x3 +
a
x4 a,b
b a b
y1 - y 2+
a
z-x x z x z
Solution continued …
z 2 x2 x4 z 3 (x3,y1) z4
z 3 x4 x4 z 3 x4 z3
z4 (x3,y1) (x3 ,y1,y2) z5 (x3,y1) z4
z5+ (x3,y1 ,y2) (x3 ,y1 ,y2) z5 (x3,y1 ,y2) z5
Solution continued …
b a,b
z4 a z+5
b
- z1 a,b z2 a,b
a
z3
Note
b
b a
y1 ± y2
a
Nondeterministic Finite
Automaton (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.
Observations
2+
a
1- a
3
a
b
4 5+
a, b a,b
a a
1- 2 3+
… 5 b c 9
7 …
c d
… 6 10 …
To eliminate the loop at state 7, the corresponding
NFA may be as follows
Example continued ...
… 4 b …
11 8
a c
d
… 5 a a …
9
b b
c
… 6 c 7 d 10 …
Converting an FA to an
equivalent NFA
• It is to be noted that according to the Kleene’s
theorem, if a language can be accepted by an FA,
then there exists a TG accepting that language.
Since, an NFA is a TG as well, therefore there
exists an NFA accepting the language accepted by
the given FA. In this case these FA and NFA are
said to be equivalent to each others.
Following are the examples of FAs to be
converted to the equivalent NFAs
Example
- +
a
• The above FA may be equivalent to the following
NFA
a, b
Can the structure of above- NFAb be compared
+ with
the corresponding RE ?
Example
a a
b a,b
1– a b 6+
b a b
3 b 5
Application of an NFA