Hello. In the previous lesson, you used the pumping lemma to prove that
is not regular. That result is more valuable than a single example: it is now a known nonregular language that can serve as a contradiction target.
This lesson develops a second proof strategy. Rather than searching for a string that breaks the pumping lemma, we temporarily assume an unfamiliar language is regular, apply a closure property, and derive that a language already known to be nonregular would have to be regular. The contradiction rules out the original assumption.
The central logic: closure properties used backward
A closure property says that applying a particular operation to regular languages produces another regular language. From the previous lesson, you have already seen why regular languages are closed under intersection: a product DFA can track membership in two regular languages simultaneously.
For example:
- If and are regular, then is regular.
- If is regular over alphabet , then its complement is regular.
A closure-property nonregularity proof uses these facts in a contradiction argument:
- Identify a language that is already known to be nonregular.
- Suppose the target language were regular.
- Combine with one or more known regular languages, or take its complement.
- Use closure to conclude that the resulting language must be regular.
- Prove that the result is exactly .
- Contradict the known fact that is nonregular.
The essential asymmetry is worth stating carefully:
Regular languages are closed under operations such as intersection and complement. Nonregular languages are not “closed” in the same way.
For instance, two nonregular languages can have a regular intersection. The method never claims otherwise. It assumes the unknown target is regular and uses closure to force a contradiction.

The image’s key idea is that the known nonregular language appears at the end of the argument, as an impossible consequence of the assumption that the unknown language is regular.
Complementation: flipping membership
Fix an alphabet . The complement of a language is always relative to that alphabet:
Thus, a string belongs to exactly when it is a string over that does not belong to .
Why is complement closure true? If a DFA recognizes , keep its states, start state, alphabet, and transitions unchanged, but swap accepting and rejecting states. Because a DFA ends in exactly one state after reading any input, the modified DFA accepts precisely the strings that rejects.
Regular Languages Closed Under Complement Proof
Watch “Regular Languages Closed Under Complement Proof” from Easy Theory for the DFA-level justification behind complement closure.
Watch the DFA construction, where accepting and nonaccepting states are swapped, then the closure statement. Focus on why the transition structure does not change: only the acceptance condition is reversed.
This has a useful consequence. If is known to be nonregular, then is also nonregular. Indeed, if were regular, complement closure would make
regular, a contradiction.
Example: nonpalindromes
Let
where is the reversal of . Suppose it is already known that is nonregular.
Now define
This is the language of binary strings that are not palindromes. Since every binary string either is or is not a palindrome,
To prove that is nonregular, write the argument explicitly:
Assume, for contradiction, that is regular. By closure of regular languages under complement, is regular. But , and is known to be nonregular. This is a contradiction. Therefore is not regular.
Notice that this proof does not need a pumping length, a special string, or cases for possible decompositions. All the work lies in recognizing the complement relationship and fixing the alphabet correctly.
Intersection as a regular filter
Intersection is often the most flexible closure tool. Think of a known regular language as a filter: it keeps only the strings of the target language that have a controlled form. If that filtered portion is a known nonregular language, then cannot have been regular.
The most common filter is
It is regular because it is described by a regular expression. It contains strings consisting of any number of zeros followed by any number of ones, including , , and . It excludes strings such as and , whose symbols alternate or return to zeros after a one.
Proving languages to be nonregular
Read Section 5.3, “Nonregularity from closure properties,” from the University of Waterloo Theory of Computing notes. It gives compact complement and intersection proofs and emphasizes the direction in which closure arguments are valid.
Begin with Proposition 5.8 and read the complement argument. Then continue through Proposition 5.9, paying particular attention to the claim identifying the intersection with a previously known nonregular language. Finish with the final paragraph beginning “It is important to remember,” which warns against treating nonregular languages as closed under intersection.
A complete intersection proof
Consider the language
where and denote the number of zeros and ones in , respectively.
Unlike
the language allows symbols in any order. For example, , , and all belong to . We will prove that is nonregular by filtering it with .
Let
The crucial identity is
Do not merely assert this equality: proving it is the core of the argument.
Why the equality holds
Take any string . Since , it has the form
for some . Since , it has equally many zeros and ones. Therefore . Letting this common value be , we get
This proves that every string in belongs to .
Conversely, every string has equal numbers of zeros and ones, so it belongs to ; it also has all zeros before all ones, so it belongs to . Thus it belongs to .
Both inclusions have been established, so the identity follows.
The proof
Claim: is not regular.
Proof: Assume, toward a contradiction, that is regular. The language
is regular. Because regular languages are closed under intersection, is regular.
But
The language on the right is nonregular, as established with the pumping lemma in the previous lesson. This contradicts the conclusion that is regular. Therefore is not regular.
The regular filter does two jobs at once:
- It discards complicated orderings such as .
- It preserves exactly the structured subset in which equal counts become the known nonregular pattern .
Choosing an effective regular filter
The intersection method is not based on the fact that a language has a nonregular-looking subset. That reasoning would be invalid: a regular language may contain nonregular subsets. For example,
is regular but contains the nonregular subset
What makes the closure proof work is the conditional claim:
If the target were regular, then its intersection with the independently known regular filter would be regular.
A good filter is therefore chosen to make an exact identity of the form
easy to prove, where is a known nonregular language.
When designing a proof, use this checklist:
| Step | What to establish |
|---|---|
| Select a seed | Name a language already known to be nonregular. |
| State the assumption | Assume the target language is regular. |
| Choose a legal operation | Typically intersect with a language that is clearly regular, or complement . |
| Invoke closure correctly | Under the assumption, the constructed language is regular. |
| Prove an exact identity | Show that the constructed language equals , usually with two set inclusions. |
| State the contradiction | The same language would be regular and nonregular. Conclude that is nonregular. |
Two common flaws are especially important to avoid:
-
Using a nonregular auxiliary language.
To invoke intersection closure, every input language must be regular under the assumption. The filter must therefore be independently known to be regular. -
Showing only containment rather than equality.
Knowing that does not produce a contradiction. A regular language can contain a nonregular subset. You need an exact characterization of , or another argument that directly identifies a known nonregular result.
Key takeaways
Closure properties offer a way to transfer a known nonregularity result to a new language. The proof begins by assuming the target is regular, not by assuming anything about the known nonregular seed.
For complement proofs, specify the alphabet and identify the complement exactly. For intersection proofs, select a regular filter that isolates a known nonregular language, then prove the resulting set equality in both directions.
You now have two complementary methods for proving nonregularity: the pumping lemma, which exposes a forbidden pumping behavior directly, and closure arguments, which reduce the target language to a nonregular language you already understand. Next, the course turns to Myhill–Nerode distinguishability, a state-based method for proving that any DFA for a language would require arbitrarily many states.
Can't find a good explanation? Sign up and we'll make it for you
Sign up