Professional Documents
Culture Documents
Outline
From eNFA to NFA
From DFA to RE
Closed operators for Regular Languages
e is the empty string, it contains no alphabets; It makes a state transition when seeing e. It makes a state transition without receiving an input symbol (from alphabet); It makes a state transition unconditionally;
NFA + Allows e-transitions; It brings programming convenience; Closely related to regular expressions
eNFA
NFA:
q0
a, b a
q1
a, b
q2
state q1
NFA:
q0
q2
q0
e,b a e qi qk a
q1
a qj
e e
q2
qi
qm
qj
?
NFA: q0 ? q1 ? q2
q0
e
e,b a q1 q0 a
q1
a
q2
q0
q0 q0
a
NFA: q0 ? q1 ? q2
q0
e
e,b a q1 q0 a a
q1
q2
q0 q0 b b
q0
q1 q1
q1 q1
NFA:
q0
a, b
q1
q2
q0
e
e,b a
q1
q2
q0 b q 1 e q2 q0 b q2
q0
q1 a q1 e q2 q0 a q2
NFA:
q0
a, b
q1
q2
a, b
NFA:
q0
a, b a
q1
a, b
q2
(4) The accepting states of the NFA are all states that can reach some accepting state of eNFA using only e-transitions
NFA:
q0
a, b a
q1 a, b
q2
Outline
From eNFA to NFA
From DFA to RE
Closed operators for Regular Languages
qi
ai1,ai2,,ait
qi
ai1,ai2,,ait
qj
qk qi
a path in M
qj
q1 q1
0 0 1
q2 q2
R210 = {0} = 0
R220 = {e, 1} = 1 + e
q2
R111 = {e, 1, 11, 111, ...} R120 = {0} = 0 R220 = {e, 1} = 1 + e = 1* 1 0 0 0 0 R121 = R120 + R110(R110)*R120 R22 = R22 + R21 (R11 )*R12 +0 = (1 + e) + 0(1+ e)*0 = 0 + (1+ e)
R122 = R121 + R121(R221)*R221 = (0 + (1+ e)+0) + (0 + (1+ e)+0) ((1 + e) + 0(1+ e)*0)+ = (0 + (1+ e)+0) ((1 + e) + 0(1+ e)*0)* = (1+ e)*0 ((1 + e) + 01*0)* = 1*0 (1 + 01*0)*
R122=1*0 (1+01*0)*
Outline
From eNFA to NFA
From DFA to RE
Closed operators for Regular Languages
(1). min(L) = { w | w is in L, but no proper prefix of w is in L }; (2). max(L) = { w | w is in L and for no x other than is wx in L }; (3). init(L) = { w | for some x, wx is in L }
Hint: Start with a DFA for L and perform a construction to get the desired language.
For example, suppose the alphabet is { 0, 1 }, then: (1) 011, 01 are proper prefixes of 0110001; (2) 0110001 is a prefix of 0110001, but not a proper prefix; (3) (i.e., ) is not a proper prefix of 0110001.
Main idea:
A DFA for L:
w=ux
q0
qj
qk
(1). min(L) = { w | w is in L, but no proper prefix of w is in L }; (2). max(L) = { w | w is in L and for no x other than is wx in L }; (3). init(L) = { w | for some x, wx is in L }
Hint: Start with a DFA for L and perform a construction to get the desired language. Left as exercises at home!