2

I have a homework problem that requires you to prove if a language is one of the three:

  1. A Regular Language
  2. Context-Free but Not Regular
  3. Not Comtext-Free

How would you prove each one? I know Pumping Lemma can verify if a language is Not Regular or Not Context-Free, but that’s it.

The example to help me understand better is the following:

{ a^(2n+1)b^(3n+2) | n ∈ N }, alphabet { a, b } where N is all natural numbers.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
bmcisme
  • 57
  • 6

1 Answers1

0

The pumping lemma for regular languages can tell you that a language is not regular; however, it cannot tell you that a language is regular. To tell that a language is regular, you must do the equivalent of producing a finite automaton, regular grammar or regular expression and then proving it's correct for your language.

The pumping lemma for context-free languages tells you whether the language is or is not context free. That is, if a language satisfies the pumping lemma for context-free languages, it is context free; and if it does not, then it is not. However, you can certainly use it in the same way you'd use the pumping lemma for regular languages and go ahead and find a pushdown automaton or context-free grammar instead.

In your case, we can first choose the string a^(2p+1) b^(3p+2) to show that the language is not regular by the pumping lemma for regular languages. We can show the language is context-free by arguing that for any string of the form a^(2k+1) b^(3k+2) where 2k+1 and 3k+2 are sufficiently large, we can always choose v to contain 2 a's and y to contain three b's, so that pumping maintains the required property. Alternatively, we can just give a CFG for it based on the same insight:

S -> aaSbbb | abb

Then we should show the grammar is correct, which is left as an exercise.

Patrick87
  • 27,682
  • 3
  • 38
  • 73