4

I read somewhere that {(a^p)(b^q):p,Q belong to N} is a regular language. However, i dont think this is correct. This can be proved using pumping lemma. Just want to verify if my solution is correct

Let y be ab . Thus, x(y^n)z does not belong to L as there will be some b's before a's for n>=1. However, expression does not allow this. Thus, (a^p)(b^q) is not a RL

Programmer
  • 6,565
  • 25
  • 78
  • 125

2 Answers2

7

It was a while ago I used the pumping lemma, but apbq is definitely a regular language. It's even trivial to write a regular expression for it! a* b*

The similar looking apbp is not regular though, because when starting to consume b-symbols, you need to remember how many a symbols you have consumed, and a finite automaton is not able to "remember" an arbitrary number. This is not a problem in your case!

aioobe
  • 413,195
  • 112
  • 811
  • 826
  • isnt a^p b^q already a regular expression? – Programmer Nov 01 '11 at 15:27
  • Yes, if you *fix* p and q, you can write *aaaaaaaabbbbb* which is a regular expression. But when he defines the language, he says it should include all choices of p and q. – aioobe Nov 01 '11 at 15:41
0

The pumping lemma says: If a language A is regular => there is a number p (pumping length) where, if s is any string in L such that |s| >= p, then s may be divided into three pieces s=xyz, satisfying the following condition:

  1. xyiz is in L for each i>=0
  2. |y|>=0
  3. p>=|xy|

The right way to show that a certain language L is not regular is to suppose L regular and try to reach a contradiction.

If you try to suppose that your language is not regular you should first search the kind of string that represents the irregularity of the language. Lets try with apbn for n>=0.

We can do some assumption on this string: since |xy|<=p we know that y is only made of a. At this point you can pump it as much times as you prefer but xyiz is a member of your language for every i>=0.

In a similar way you will not reach a contradiction if you choose anbp for n>=0.

L={anbn | n>=0} is not regular, but you do not have constraints on p and q(I mean, it is not required to count both occurrences of a and b).

However a language is regular if and only if it can be expressed with a regular expression. And in this case you can do that: a*b*. So you can conclude that this language is regular.

Edit: for p<=q the language is not regular but you are considering any p and q.

SuperJulietta
  • 6,801
  • 1
  • 14
  • 11