Introduction
Regular languages are closed under a rich family of operations: Boolean operations, concatenation, star, reverse, homomorphisms and inverse homomorphisms. They also have decidable emptiness, membership, finiteness and equivalence. These facts let you build new regular languages from old ones and answer yes/no questions about DFAs and regular expressions algorithmically.
The skills are the constructions (especially product automata and complement by flipping finals) and knowing which properties remain decidable when you move to context-free languages (many do not).
Prerequisites
- Equivalence of Regular Expressions and Finite Automata: DFAs, NFAs and REs as interchangeable presentations.
Core concepts
Closure properties (summary table)
If and are regular, so are:
| Operation | Construction idea |
|---|---|
| Product with accept when either accepts; or NFA -union; or RE sum | |
| Product with accept when both accept | |
| Same DFA, flip accepting/non-accepting (DFA must be complete) | |
| NFA: link accepts of to start of by | |
| NFA star construction (Thompson) | |
| Reverse edges, swap start/accept (NFA; then determinize) | |
| Homomorphism: replace each edge label by a path reading | |
| Inverse homomorphism: on follow the path that would take in the DFA for |
Difference. is regular. Symmetric difference likewise.
Further operations that preserve regularity
| Operation | Definition | Why regular |
|---|---|---|
| Right quotient | DFA for , accept at iff some leads from to ; true for any , even non-regular | |
| Left quotient | reverse, take right quotient, reverse | |
| Prefixes | all prefixes of strings in | accept every state that can reach |
| Suffixes, substrings | all suffixes or factors | Suffixes: new epsilon-start to every reachable useful state, retaining original finals. Factors: additionally make every useful state accepting |
| Substitution by regular languages | replace each by a regular | substitute for in the expression |
| product of a forward and a guessed backward run | ||
| Finite union, finite intersection | repeat the binary constructions |
Operations that do not preserve regularity.
- Infinite union. Each is finite, hence regular, but is not regular. Closure holds only for finitely many operands.
- Subset. ; a subset of a regular language can be anything.
- Going backwards. regular does not make regular (take for a non-regular ); regular does not either; can be regular when is not (for , ).
- Regular with non-regular. and can go either way. is regular; is not.
Using closure to prove non-regularity
If were regular, then , and would be regular for every regular and homomorphism . So reduce to a known non-regular language:
- : , not regular, so is not regular.
- : , so is not regular. This is far shorter than pumping directly, where every decomposition seems to survive.
- By contrast is intersected with the even-length strings, so it is regular. Counting two things against each other breaks regularity; checking a parity does not.
Decision properties
Given a DFA (or RE/NFA converted to DFA):
| Question | Decidable? | Method |
|---|---|---|
| Is ? | yes | Run the DFA |
| Is ? | yes | Reachability from start to some accept state |
| Is ? | yes | Emptiness of the complement |
| Is finite? | yes | In the DFA, after removing dead/unreachable states, check for a cycle on a path from start to an accept |
| Is ? | yes | Emptiness of symmetric difference, or minimize both and compare |
| Is ? | yes | Emptiness of |
All of the above are decidable in time polynomial in the DFA size for standard formulations used in GATE.
How it works
Product construction for intersection
DFAs and . Product:
accept for intersection, or for union.
Complement pitfall
Flipping finals works only on a total DFA. If you flip an NFA's finals, you do not get the complement. Always determinize (and complete) first.

Algorithms and pseudocode
INTERSECT(M1, M2)
1 build product with F <- F1 x F2
2 return reachable component from (q1,q2)
EQUIVALENT(M1, M2)
1 M <- INTERSECT(M1, COMPLEMENT(M2)) union INTERSECT(COMPLEMENT(M1), M2)
2 return EMPTY(M)
FINITE(M)
1 remove unreachable states from start and states that cannot reach an accept
2 return whether the remaining graph is acyclicMathematical explanation
Why complement needs determinism
An NFA accepts if some path accepts. The language of paths that all reject is a universal condition, which an NFA (existential) cannot express by merely swapping finals. Example: NFA for strings ending with 0; flipping finals does not yield "does not end with 0".
Homomorphism
A homomorphism is determined by for and extended by , . Regular languages are closed under and under . Inverse homomorphism is especially useful in proofs that a language is regular: express it as of a known regular language.
Worked examples
Example 1: even length ends with 1
DFA even: states E/O. DFA ends-with-1: S/T. Product accept only (E,T). Strings: 01 length 2 ends with 1, accept; 1 length 1, reject; 11 length 2 ends with 1, accept; 0 reject.
Example 2: equivalence via minimization
Two DFAs for "ends with 0" that differ by unreachable states become identical after minimize; EQUIVALENT returns true.
Example 3: reverse of 0*1
. Then . Construction: reverse the obvious 2-state NFA and determinize.
Example 4: finiteness
has a cycle through an accept state: infinite. as a DFA has no cycle among useful states: finite (two nonempty strings plus optionally if present). Language is finite.
Example 5: quotient and inverse homomorphism
Quotient: and . Then . With the quotient also contains itself (take ): .
Inverse homomorphism: let , and . Every is with , so . With (exactly two copies), .
Example 6: the finiteness test by lengths
For a DFA with states, is infinite iff contains a string with . For the 2-state "even length" DFA, ab has length 2 in : infinite. For a minimal DFA of (4 states with the dead state), no accepted string has length in : finite. This turns the cycle test into a bounded membership search.
Example 7: non-closure red herrings
Regular languages are closed under the operations above. Do not confuse them with CFLs (not closed under intersection or complement). Keep the tables separate.
Important properties and observations
- Closure under complement + union yields closure under all Boolean operations.
- Decision procedures assume an effective representation (DFA/NFA/RE); an arbitrary set given only as a black box is a different story.
- Product of -state and -state DFAs has at most states.
- Completing a partial DFA adds at most one dead sink.
Common misconceptions.
- Flipping NFA finals for complement.
- Claiming equivalence of regular languages is undecidable (it is decidable; CFL equivalence is undecidable).
- Thinking intersection of regular languages may leave the class (it does not).
GATE examination perspective
- PRODUCT DRILLS. Draw both union and intersection accept conditions.
- COMPLEMENT ON DFA ONLY. State the completeness assumption.
- DECIDABILITY CONTRAST. Regular: equivalence decidable. CFL: equivalence undecidable. RE (r.e.): emptiness undecidable.
- FINITE VS INFINITE. Look for cycles that can pump a nonempty string inside an accepting path, or use the length window .
- FINITE OPERANDS ONLY. Closure under union and intersection is for finitely many languages; an infinite union of regular languages can be any language.
- "IF IS REGULAR THEN ...". Statements that infer regularity of the parts from the whole are false; look for a complement pair.
- QUOTIENT. is regular for regular and any ; the construction may not be effective when is not regular, but the language is still regular.
- CLOSURE AS A PROOF TOOL. Intersect with or complement to reach ; it is usually shorter than pumping.
- FULL CROSS-CLASS TABLE. Closure across regular, DCFL, CFL, CSL, recursive and RE languages, with counterexamples, is collected in Closure and Decision Properties of CFLs.
Summary
Sources
- J. E. Hopcroft, R. Motwani, J. D. Ullman, Introduction to Automata Theory, Languages, and Computation, 3rd ed., Pearson Addison-Wesley, Section 4.2 (closure under Boolean operations, reversal, homomorphisms, inverse homomorphisms), Section 4.3 (decision properties: emptiness, membership), Section 4.4.2 (testing equivalence of regular languages).
- M. Sipser, Introduction to the Theory of Computation, 3rd ed., Cengage Learning: Section 1.1 (the regular operations), Section 1.2 (closure under the regular operations), Section 4.1 (decidable problems concerning regular languages).
- P. Linz, An Introduction to Formal Languages and Automata, 6th ed., Jones & Bartlett Learning: Section 4.1 (closure properties of regular languages, including closure under other operations), Section 4.2 (elementary questions about regular languages).