Pumping Lemma says: If A is regular =>, then there exists a number p (pumping length), where s is any string in L such that | s | > = p, then s can be divided into three parts s = xyz satisfying the following condition:
- xy i z is in L for each i> = 0
- | y | > = 0
- p> = | xy |
The correct way to show that a certain language L is not regular is to consider L regular and try to achieve a contradiction.
If you try to assume that your language is not regular, you should first look for a string type that represents the unevenness of the language. Let's try with p b n for n> = 0.
We can make some assumption on this line: since | xy | <= p, we know that y consists only of a. At this point, you can pump it as many times as you want, but xy i z is a member of your language for every i> = 0.
Similarly, you will not achieve a contradiction if you choose n b p for n> = 0.
L = {a n b n | n> = 0} is not regular, but you have no restrictions on p and q (I mean, it is not necessary to count both occurrences 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 this: a * b *. Therefore, 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.
source share