Automata Lecture 05 NFAtoDFA
Automata Lecture 05 NFAtoDFA
Automata Lecture 05 NFAtoDFA
YES
Every NFA can be converted into
a DFA for the same language.
NFA → DFA in two easy steps
➊ Eliminate -transitions
0, 1
1 0
NFA: q q q
0 0
1 0
DFA: q q0 or q1 q0 or q2
1 1
NFA → DFA: intuition
0, 1
1 0
NFA: q q q
0 0
1 0
DFA: q {q0, q1} {q0, q2}
1 1
NFA → DFA: states
0, 1
1 0
NFA: q q q
1 0
NFA: q q q
0 1
1
DFA: {q0} {q0, q1}
0, 1 1
0 1
0
1
{q1} {q0, q2}
0
{q0, q1, q2}
0, 0
1
0
{q2} {q1, q2}
1
NFA → DFA: accepting states
0, 1
1 0
NFA: q q q
0 1
1
DFA: {q0} {q0, q1}
0, 1 1
0 1
0
1
{q1} {q0, q2}
0
{q0, q1, q2}
0, 0
1
0
{q2} {q1, q2}
1 0
NFA: q q q
0 1
1
DFA: {q0} {q0, q1}
0, 1 1
0 1
0
1
{q1} {q0, q2}
0
{q0, q1, q2}
0, 0
1
0
{q2} {q1, q2}
NFA DFA
states q0, q1, …, qn q0}, {q1}, {q0,q1}, …, {q0,…,qn}
one for each subset of states in the NFA
transitions ’({qi1,…,qik}, a) =
(qi1, a) ∪…∪ (qik, a)
accepting FQ F’ = {S: S contains some state in F}
states
NFA → DFA in two easy steps
➊ Eliminate -transitions
0 1
q0 {q0, q1, q2} {q1, q2}
q1 {q0, q1, q2}
q2
new NFA: 0 1
q0 {q0, q1, q2} {q1, q2}
q1 {q0, q1, q2}
q2
0 0
0, 1 0
q0 q1 q2
0
0, 1
Eliminating -transitions
• Paths with s are replaced by a single transition
q4
q5 q0 a q2 q0 q3 q3 a
q5
a
q5 a q3 q3
q9 q7 q3 q2