The pumping lemma states that if a language is regular, then it can be pumped.
For example, let's say we have a language . Then it's clear that can be pumped 0 to infinity times. So would be in the language, and so would .
Pumping Lemma for Regular Languages Formal Definition
If is a regular language, then there is a number where if is any string in of length at least , then may be divided into three pieces, , satisfying the following conditions:
for all
First, if a language is a regular language, then you should be able to split a string of length () in the language into three parts: the initial part, the repeated part, and the final part.
The first constraint states that for any string , if we repeat the middle part , the new strings formed by this repetition ( for all ) should still belong to the language .
The second constraint, , emphasizes that the repeated section must be of length at least one, meaning it must contain at least one character. After all, you can't pump the empty string .
The third constraint, , ensures that the length of the initial part and the repeated part together must be less than or equal to the pumping length. More importantly, it also says that is at least within distance from the start of the string.
Proving Regularity
The pumping lemma is more useful when we factor in the contrapositive to prove that some language is not regular. Our pumping lemma makes the statement that if a language is regular, then it is pumpable.
If this, then that.
The following contrapositive is a logically equivalent statement (unlike inverses and converses).
If not that, then not this.
This means that we can use the pumping lemma in a proof of contradiction to show that a certain language is not regular by showing that it cannot be pumped.
To prove that a language is not regular, we need to use the proof by contradiction. We can do this by following the following steps:
Assume is regular.
Let be the pumping length given by the pumping lemma.
Choose a string that has at least length .
Break the string down into some such that and .
Example: Proving that is Irregular
Step 1 and 2 are just formalities. We begin the proof by saying, "Let's assume is regular." Then we follow up by saying, "Let be the pumping length given by the pumping lemma."
Step 3 is carefully crafting a string that is a part of the language that is at least length .
Step 4 is the verbose part where we satisfy all of the constraints given in the pumping lemma and using it to a show a contradiction.
Let's assume L is regular.
The pumping lemma states that f is a regular language, then there is a number where if is any string in of length at least , then may be divided into three pieces, , satisfying the following conditions:
for all
Let's use the string . We can see that and .
Since condition 3 states that , . Therefore, and . Then we can split the string to , , and .
Condition 1 states that we should be able to pump times with it staying in the language, but we can see that this is contradictory with the counterexample such that .