简体   繁体   English

使用Pumping Lemma证明语言的非常规性

[英]Using Pumping Lemma to prove non regularity of a language

This is the general rule... 这是一般规则...

Let L be a regular language. L为常规语言。 Then there exists an integer p ≥ 1 depending only on L such that every string w in L of length at least p ( p is called the "pumping length") can be written as w = xyz (ie, w can be divided into three substrings), satisfying the following conditions: 然后,存在一个仅依赖于L的整数p ≥ 1 ,这样长度L中长度至少为p每个字符串wp称为“抽取长度”)可以写成w = xyz (即w可以分为三子字符串),满足以下条件:

  • |y| ≥ 1

  • |xy| ≤ p

  • for all i ≥ 0, xy^iz ∈ L 对于所有i ≥ 0, xy^iz ∈ L

...and so far so good. ...到目前为止,一切都很好。

But in order to prove that a given language is non-regular, is it sufficient to consider one case (and thus going to void the third point)? 但是为了证明给定语言是非常规语言,考虑一种情况是否足够(从而使第三点无效)? For instance: 例如:

L = {a b^n c^k d^m | k,n,m>0 AND m>n} <-- given language
w = {a b^n c d^m  | n=1 AND m=2} = abcdd  <-- arbitrary instance of the language
x = a
y = bc
z = dd

with i=2 , xy^iz would become abbccdd , and therefore n=2 , which means m>n is now false . i=2xy^iz将变为abbccdd ,因此n=2 ,这意味着m>n现在为false

Is this enough as proof? 这足以证明吗?

OT: how do you write apex/superscript characters in stackoverflow? OT:如何在stackoverflow中编写顶点/上标字符?

in order to prove that a given language is non-regular, is it sufficient to consider one case 为了证明给定语言是非常规语言,考虑一种情况是否足够

Yes, this is the common pattern when using the pumping lemma. 是的,这是使用抽水引理时的常见模式。 The proof should be by contradiction, which starts by assuming that the language is regular. 证明应该是自相矛盾的,首先要假设语言规则的。 Then you find one example string in the language which contradicts the pumping lemma. 然后,您找到了一个与抽水引理矛盾的语言示例字符串。 The pumping lemma says something about every string (under some conditions), so finding one counterexample is sufficient to prove the contradiction. 抽引式引理对每条弦(在某些条件下) 都会说些什么,因此找到一个反例就足以证明这一矛盾。

The language that is given is L = {ab^nc^kd^m | k,n,m>0 AND m>n} 给定的语言为L = {ab^nc^kd^m | k,n,m>0 AND m>n} L = {ab^nc^kd^m | k,n,m>0 AND m>n} - this means there are more d s than b s in the words of this language. L = {ab^nc^kd^m | k,n,m>0 AND m>n} -这意味着该语言的单词中d s大于b s。

To answer your questions: 要回答您的问题:

But in order to prove that a given language is non-regular, is it sufficient to consider one case (and thus going to void the third point)? 但是为了证明给定语言是非常规语言,考虑一种情况是否足够(从而使第三点无效)?

The idea is correct. 这个想法是正确的。 You want to use the Pumping Lemma for Regular Languages, and if you can prove that applying the Pumping Lemma to a word of a given language results in a word that is not in the language then you have shown that that language cannot be regular. 您想要对常规语言使用泵送引理,并且如果您可以证明将泵送引理应用于给定语言的单词会导致该单词不是该语言的单词,那么您已经证明该语言不是常规语言。

The Pumping Lemma is often used and useful in that sense. 从这个意义上说,抽水引诱经常被使用和有用。

Is this enough as proof? 这足以证明吗?

The proof you have shown is the right idea, but was not applied correctly. 您显示的证据是正确的想法,但未正确应用。 You chose 你选择了

x = a
y = bc
z = dd

and applying the Pumping Lemma would result in abcbcdd , which is not part of the language of course, but now the pumping length comes into play. 并应用抽水abcbcdd将导致abcbcdd ,这当然不是语言的一部分,但是现在抽水长度开始起作用了。

You have the language 你有语言

L = {a b^n c^k d^m | k,n,m>0 AND m>n}

Now you want to find a word and choose p and the substrings appropriately, apply the Pumping Lemma for Regular Languages, and show that the resulting word is not in that language. 现在,您想查找一个单词,并适当选择p和子字符串,应用常规语言的Pumping Lemma,并显示结果单词不是该语言的。 You then can conclude that the language is not regular. 然后,您可以得出结论,该语言不是正常语言。

The substrings you have chosen are not appropriate. 您选择的子字符串不合适。 There is a mistake, I mentioned that in a comment to your question. 我在评论您的问题时提到了一个错误。 I would go for a general approach: 我将采用一种通用方法:

w = {a b^n c^k d^m  | n,p,m > 0 and m > n and n < p }
x = a
y = b^n
z = c^k d^m

So using the Pumping Lemma we can say the following: 因此,使用抽水引理我们可以说以下几点:

  • |y| >= 1 |y| >= 1 because by definition b^n with n > 0 |y| >= 1因为根据定义b^n with n > 0
  • |xy| = |ab^n| <= p |xy| = |ab^n| <= p where p is the pumping length |xy| = |ab^n| <= p ,其中p是抽气长度
  • and thus we can assume p = n + 1 which is |ab^n| 因此我们可以假设p = n + 1 ,即|ab^n|
  • xy contains at least ab and thus p >= 1 xy至少包含ab ,因此p >= 1
  • |w| >= p |w| >= p , because we set p to n + 1 previously, and since k > 0 and m > n |w| >= p ,因为我们先前将p设置为n + 1 ,并且因为k > 0m > n
  • and xy^iz is in L for all i >= 0 并且对于所有i >= 0xy^izL

Now choose a word where n + 1 = m , ie there is always one d more than there is a b in the word. 现在选择一个n + 1 = m的单词,即单词中的b总是比d多一个d This word is in L and looks like ab^nc^kd^m . 这个词在L ,看起来像ab^nc^kd^m Now we apply the Pumping Lemma and this pumps the word up to ab^n+1 c^kd^m . 现在我们应用Pumping Lemma,这将单词泵到ab^n+1 c^kd^m But this is a contradiction because now there are as many b s as d s in the pumped word, and thus the word is not in the language L . 但这是一个矛盾,因为现在抽出的单词中的b s与d s一样多,因此该单词不在语言L We can conclude that L is not regular. 我们可以得出结论L不规则。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM