DFA NFA 与 RE是等价的
原理在于RE “may be weakest language”
我们可以构造单字符自动机
接着我们可以构造并联自动机
我们可以构造串联自动机
我们可以构造星自动机
意味着我们一定可以把一个RE拼装成自动机。
有限的自动机的长度/状态(state)是有限的
顾名思义
假如可以接收长于state数量的字符串那必然成环
对于一个有限个数的自动机(假设这个有限的状态的数量为p),假如出现了一个长度大于P的字符串S,其长度为n.由鸽笼定理,必然出现某个state被访问两次以上,由自动机之间是通过跳转实现的状态转移,必然成环(自环也是环).
得到成环的DFA结构后反推性质
显然,这个DFA可以被拆分成最多三个DFA的组合
X DFA(不含有环) Y DFA (含有环) Z DFA(不含有环)
其中Y理论上因为可以无限循环,所以可以接受无限长度的字符串
所以我们先引入一个叫泵引理的东西
Q:为什么要长度大于等于p?
A:保证在串S的基础上添加任意一个字符或一个长度大于1的字符串必然对该DFA成环。
Q:为什么要让|xy|小于等于p?
A:必须让原字符串不成环,这样才使得字串重复后的新串(成环)变得有意义。
Q:为什么y长度要大于0?
A:Y是可重复部分(即将成环部分),Y为0所有证明将失去意义。
Q:为什么重复子串重复无数次之后还属于该(正则)语言?
A:因为使子串重复后仍然属于该DFA,而该DFA与RE等价。
做做题
suppose L is RE
y=0*|1*|0* 1*
we set 0p1p as a string from language L
let y be sub-string of 0p,and the length of DFA state is n
if y=0i and i<=n
after repeat INF times
in new string the number of 0 is not equal to the number of 1
if y=1i and i<=n
after repeat INF times
in new string the number of 0 is not equal to the number of 1
if y is a combination of 1 and 0
the new string after trans will be
01010101010 like this
will not be 0n1n
SUPPOSE L IS regular
y=0*|1*|2*|1* 2*|1* 2* 3*| 01|12
if y is the the combination of single 0s or 1s or 2s
the number of 1 and 0 and 2 will not equal
else
if y is the mix of different number
the RANK WILL BE BREAK
like 01012 is not belong to L