[英]Proof that a regular expression is not a regular language using pumping lemma
Ok, I know that this isn't a programming question but it is a computing question so it is relevant. 好的,我知道这不是编程问题,而是计算问题,因此很相关。
Basically, how can I use the pumping lemma to prove that this language is not regular? 基本上,我如何使用抽水引理证明该语言不是常规语言?
{w in {0,1}* | {w in {0,1} ** | if the length of w is odd then the middle symbol is 0}
如果w的长度为奇数,则中间符号为0}
Please answer this as simple as possible as whilst I know about models of computation, I am relatively new to it. 在我了解计算模型的同时,请尽可能简单地回答这个问题,但我对此并不陌生。
Thank you very much in advance! 提前非常感谢您!
According to the pumping lemma, if that language is regular then there must exist a number p such that for all strings longer than p in the language, we can decompose that string into x + y + z , where each of x , y , and z are strings and | 根据泵激引理,如果该语言是规则的,则必须存在一个数字p ,对于所有比该语言中的p长的字符串,我们可以将该字符串分解为x + y + z ,其中x , y和z是字符串和| y |
y | >= 1, |
> = 1,| x + y |
x + y | <= p , and x + ( y * i ) + z is in the language for all non-negative integers i .
<= p ,并且x +( y * i )+ z是所有非负整数i的语言。
Now observe that for every non-negative integer i , the string " 1
" * i + " 0
" + " 1
" * i is in the language. 现在观察到,对于每个非负整数i ,字符串“
1
” * i +“ 0
” +“ 1
” * i在语言中。 (That is, the string of i 1
s followed by a single 0
and then i more 1
s) (即,字符串i
1
s,后跟单个0
,然后是i more 1
s)
Specifically, the string S consisting of p 1
s followed by a 0
and then p more 1
s is in the language. 具体来说,该字符串S是由p
1
s后面跟着0
,然后是p more 1
s组成的语言。 Since this string has length 2 p + 1, this string is long enough that it can be broken into three strings x , y , and z as in the pumping lemma. 由于该字符串的长度为2 p +1,因此该字符串足够长,可以像抽运引理中一样分成三个字符串x , y和z 。 Since |
由于 x + y |
x + y | <= p , it must be that x and y are all
1
s, and the only 0
character in S is in z . <= p ,必须x和y均为
1
,并且S中唯一的0
字符在z中 。 Now consider the string S' = x + y + y + y + z . 现在考虑字符串S' = x + y + y + y + z 。 Since we added 2*|
由于我们加了2 * | y |
y | characters to it, S' must also have an odd length.
字符, S'还必须具有奇数长度。 But we added some number of
1
characters to the left of the only 0
in S , and didn't add any 1
characters to the right of the 0
. 但是我们在S中唯一的
0
的左侧增加了一定数量的1
字符,而在0
的右侧未添加任何1
字符。 So S' doesn't have a 0
as its middle character, and therefore S' isn't in the language. 因此S'的中间字符没有
0
,因此S'不在语言中。
Therefore, we've shown that the language can't be pumped as the pumping lemma requires. 因此,我们证明了无法根据泵送引理要求来泵送语言。 Therefore, the language is not regular.
因此,语言不规则。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.