简体   繁体   中英

Using Pumping Lemma to prove non regularity of a language

This is the general rule...

Let L be a regular language. 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:

  • |y| ≥ 1

  • |xy| ≤ p

  • for all 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 .

Is this enough as proof?

OT: how do you write apex/superscript characters in 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} - this means there are more d s than b s in the words of this language.

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.

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. 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
  • |xy| = |ab^n| <= p |xy| = |ab^n| <= p where p is the pumping length
  • and thus we can assume p = n + 1 which is |ab^n|
  • xy contains at least ab and thus p >= 1
  • |w| >= p |w| >= p , because we set p to n + 1 previously, and since k > 0 and m > n
  • and xy^iz is in L for all i >= 0

Now choose a word where n + 1 = m , ie there is always one d more than there is a b in the word. This word is in L and looks like ab^nc^kd^m . Now we apply the Pumping Lemma and this pumps the word up to 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 . We can conclude that L is not regular.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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