Ekivalensi NFA Ke DFA

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

25/03/2021

Edi M

Stages of Changing Non‐Deterministic Finite (NFA)


Automata to Deterministic Finite Automata (DFA)
 From a Non‐Deterministic Finite Automata machine, an
equivalent DFA engine can be built.
 Equivalent means being able to accept the same language.
 A DFA can be viewed as a special case (subset) of the NFA.
 It is clear that language classes accepted by the DFA will also be
accepted by DFA
 However, it turns out that DFA can also simulate NFA; that is, for
each NFA we can make the DFA equivalent
 It can be proven that DFA and NFA are equivalent, so it can be
called FA only

1
25/03/2021

NFA simulation by DFA


 The way to simulate NFA by DFA is to create a DFA
state corresponds to the state set in the NFA
 The established DFA records all possible states on the
NFA after read the specified input

 Example Q = ( { q0 }, { q1} )
0 1  = { 0, 1 }
 0 1
0,1 S = q0 q0 { q0, q1 } q1
qo q1

F = q1 q1  { q0, q1 }
1

NFA simulation by DFA (2)


 Search for each existing state starting from {q0}:
 State {q0} when getting input o becomes state {q0, q1}
 State {q0} if getting input 1 becomes state {q1}
{ q1 } 1
1  0 1
qo q0 { q0, q1 } q1
0 {qo, q1} 0,1 q1  { q0, q1 }

 State {q1}
 State {q1} when getting input o becomes state 
 State {q1} if getting input 1 becomes state {q0, q1}

2
25/03/2021

 0 1
q0 { q0, q1 } q1
q1  { q0, q1 }

 State {q0, q1} when getting input o becomes state {q0,


q1} obtained from
 ({q0, q1}, 0) = (q0,0)  (q1,0)
= {q0, q1}  
= {q0, q1}
 State {q0, q1} if getting input 1 becomes {q0, q1}
obtained from
 ({q0,q1},1) = (q0, 1)   (q1, 1)
= {q1}  {q0, q1}
= {q0, q1}

Results after searching {q1}, {q0}, {q0, q1}


1
q1  ( , 0 ) = 
0,  ( , 1 ) = 
 0,1
qo 1 1 F = ({ q1 }, { q0, q1 })
0
{ q0, q1 } 0,1

Transition Table Machine Configuration Transition Table


 0 1 Q = (q0, (q0, q1), q1, )
q0 { q0, q1 } q1 ∑ = {1,0}
S = q0
q1  { q0, q1 } F = (q1, (q0, q1})
{ q0, q1 } { q0, q1 } { q0, q1 }
  

3
25/03/2021

Exercise
1. DFA
2. NFA
3. NFA to DFA equivalence

DFA

4
25/03/2021

NFA

NFA to DFA equivalence


3. Make a DFA which is equivalent to the following NFA
 Q = {p, q, r, s}
 ∑ = {0, 1}
 S=p
 F = {s}
 The transition function is stated  0 1
p p, q p
in the following transition table
q r r
r s ‐
s s s

You might also like