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 |
Ø |
Ø |
该状态转换图为:
识别的语言为:(aIb)*abb
2.NFA 确定化为 DFA
2.1解决多值映射:子集法
(1). 上述练习1的NFA
该状态转换矩阵为:
|
|
a |
b |
0 |
{0} |
{0,1} |
{0} |
1 |
{0,1} |
{0,1} |
{0,2} |
2 |
{0,2} |
{0,1} |
{0,3} |
3 |
{0,3} |
{0,1} |
{0} |
该状态转换图为:
(2)
该状态转换矩阵为:
|
|
0 |
1 |
0 |
{S} |
{V,Q} |
{U,Q} |
1 |
{V,Q} |
{Z,V} |
{Q,U} |
2 |
{Z,V} |
{Z} |
{Z} |
3 |
{U,Q} |
{V} |
{Z,Q,U} |
4 |
{Z,Q,U} |
{Z,V} |
{Z,Q,U} |
5 |
{Z} |
{Z} |
{Z} |
6 |
{V} |
{Z} |
Ø |
该状态转换图为:
2.2.解决空弧:对初态和所有新状态求ε-闭包
(1). 发给大家的图2
该状态转换矩阵为:
|
|
0 |
1 |
2 |
0 |
ε{A}={ABC} |
ε{A}={ABC} |
ε{B}={BC} |
ε{C}={C} |
1 |
{BC} |
Ø |
ε{B}={BC} |
ε{C}={C} |
2 |
{C} |
Ø |
Ø |
ε{C}={C} |
该状态转换图为:
(2).P50图3.6
该状态转换矩阵为:
|
|
a |
b |
0 |
ε{0}={0,1,2,4,7} |
ε{3,8}={3,6,7,1,2,4,8} |
ε{5}={5,6,7,1,2,4} |
1 |
ε{1,2,3,4,6,7,8} |
ε{3,8}={3,6,7,8,1,2,4} |
ε{59}={5,6,7,1,2,4,9} |
2 |
ε{1,2,4,5,6,7} |
ε{3,8}={3,6,7,8,1,2,4} |
ε{5}={1,2,4,5,6,7} |
3 |
ε{1,2,4,5,6,7,9} |
ε{3,8}={3,6,7,8,1,2,4} |
ε{5,10}={5,6,7,1,2,4,10} |
4 |
ε{1,2,4,5,6,7,10} |
ε{3,8}={3,6,7,8,1,2,4} |
ε{5}={1,2,4,5,6,7} |
该状态转换图为: