Automata Theory
Lecture 8, 9
Lecture objective
Nondeterminism & NFA
Do you remember the definition of DFA?
Before to proceed let’s get familiar with a
definition
Extended transition function
δ* (p , abc) = s
What if we’re allowed to have multiple
edges for one symbol from a state?
It’ll become easy to
construct directly from
RegEx. Isn’t it?
More examples
• Lets construct NFA’s directly from following regular expressions
• (a+b)*a
• a(a+b)*
• a(a+b)*a
• (a+b)*aa(a+b)*
• (a+b)*aa(a+b)* + (a+b)*bb(a+b)*
• (ab)* ab* + ab*
• And we’ll see later reverse is also possible and very simple
Nondeterminism
• Benefits:
• Easy to construct from RE and vice versa.
• Difficulties:
• It doesn’t represent an explicit algorithm for accepting a language. Because
algorithm is actually a sequence of steps which
• Are determined by input and may not change for single input if algorithm is executed
many times.
Nondeterminism- Handling difficulty
• Computation tree can be used to
visualize possible sequences for a
string.
• Using DFS and backtracking right
path could be searched.
• But practically we’ve to pay in
terms of time complexity.
Input: aaaabaab
NFA with ^ transition
Another variation
Computation tree for
Input: aababa
Nondeterministic FA – Formal definition
Observe the difference
Extended transition function for NFA
• To define δ∗(q, xa) where x∈∑* and a∈∑
• δ∗(q, x) gives a set of states and for each state p of this set δ(p, a) is
itself a set. So to include all possibilities
δ∗(q, xa) =
δ∗(q0, aab) = δ∗(δ∗(q0, aa), b) = δ∗(δ∗(δ(q0, a), a), b)
= δ∗(δ∗(q1, a), b) U δ∗(δ∗(q2, a), b)
= δ∗(q0, b) U δ∗(q3, b)
= q4 U q0
Lets do some exercises
δ∗(q0, aab) = ?
δ∗(q0, bab) = ?
δ∗(q0, abababa) = ?
δ∗(q0, aabba) = ?
What about ^ transitions if allowed in NFA?
Of course extended transition function will be changed.
Caring of ^ transition
• ^-closure of a set of states
Final extended transition function for NFA
and definition of acceptance
δ∗(q0, ^) = ?
Lets do some more exercises δ∗(q0, a) = ?
By applying both ^(S) and δ∗ δ∗(q0, ab) = ?
δ∗(q0, aba) = ?
Is DFA = NFA?
Eliminating Nondeterminism
• Causes of Nondeterminism
1. Multiple edges
2. ^ transitions
1. Eliminating ^ transitions
a. If ^ is word in languages then make start state in new model accept state as
well.
b. Eliminate ^ transitions.
c. Introduce new multiple edges.
Eliminating ^ transitions