1.设有 NFA M=( {0,1,2,3}, {a,b},f,0,{3} ),其中 f(0,a)={0,1} f(0,b)={0} f(1,b)={2} f(2,b)={3}
画出状态转换矩阵,状态转换图,并说明该NFA识别的是什么样的语言。
解:
a | b | |
0 | {0,1} | {0} |
1 | {2} | |
2 | {3} | |
3 |
状态转换图:
语言:(a|b)*abb
2.NFA 确定化为 DFA
1.解决多值映射:子集法
1). 上述练习1的NFA
2). P64页练习3
2.解决空弧:对初态和所有新状态求ε-闭包
1). 发给大家的图2
2).P50图3.6
解:
1.
1)根据NFA构造DFA状态转换矩阵:
a | b | ||
A | {0} | {0,1} | {0} |
B | {0,1} | {0,1} | {0,2} |
C | {0,2} | {0,1} | {0,3} |
D | {0,3} | {0,1} | {0} |
DFA状态转换图:
2)
根据NFA构造DFA状态转换矩阵:
0 | 1 | ||
A | {S} | {V,Q} | {Q,U} |
B | {V,Q} | {V,Z} | {Q,U} |
C | {Q,U} | {V} | {Q,U,Z} |
D | {V,Z} | {Z} | {Z} |
E | {Q,U,Z} | {V,Z} | {Q,U,Z} |
F | {V} | {Z} | |
G | {Z} | {Z} | {Z} |
DFA:
2.
1)
状态转换矩阵:
0 | 1 | 2 | ||
A | ε{A}=ε{ABC} | ε{A}=ε{ABC} | ε{B}=ε{BC} | ε{C}=ε{C} |
B | ε{BC} | ε{B}=ε{BC} | ε{C}=ε{C} | |
C | ε{C} | ε{C} |
状态转换图:
2)
根据NFA构造DFA转换矩阵:
a | b | ||
A | ε{0}=ε{01247} | ε{38}=ε{1234678} | ε{5}=ε{124567} |
B | ε{1234678} | ε{38}=ε{1234678} | ε{59}=ε{1245679} |
C | ε{124567} | ε{38}=ε{1234678} | ε{5}=ε{124567} |
D | ε{1245679} | ε{38}=ε{1234678} | ε{5 10}=ε{124567 10} |
E | ε{124567 10} | ε{38}=ε{1234678} | ε{5}=ε{124567} |
DFA状态转换图: