Nonregular Languages
Learn to use the pumping theorem to prove a language is nonregular.
Examples of nonregular languages
We’ll use the pumping theorem to prove that the following languages are not regular:
- The language .
- The language of palindromes.
- The language of repeated halves, .
- The language over of balanced parentheses.
- The language .
- The language PRIME = , where is a prime number.
- The language .
The language
We’ll now show that the language is not regular by showing that it does not satisfy the pumping theorem.
Intuitively, we can surmise that is not regular because a finite machine has no way to track an arbitrarily large number of 's to match the subsequent 's. We can only go so far before we run out of states. Consider the diagram below accepting the singleton language . (Once again, we omit the jail state for readability.)
Now, how can we define a machine to accept ? Or ? We need to add more states. See the animation below.
A machine with a finite number of states will never have enough states to match an arbitrarily large number of symbols.
The reasoning above satisfies our intuition, but it is not a proof! If were regular, then per the pumping theorem, we could pick any string in this language of at least symbols in length, and partition it into three concatenated substrings, , and then pump however much we require and still obtain a string in the language. This is how infinite regular languages behave. We’ll choose the string , which is more than long enough for us to invoke the pumping theorem and show that it cannot be partitioned this way.
If were regular, then, using the pumping theorem, we could partition into three parts, . Since the condition must hold, we know that the substring ...