Q4Theory of Computation
Question
Explain the closure properties of regular languages.
Answer
Regular languages are closed under union, intersection, complement, concatenation, Kleene star, reversal, and homomorphism, each provable by an explicit automaton or regular-expression construction.
A class of languages is said to be closed under an operation if applying that operation to language(s) from the class always yields a language that is also in the class. For regular languages, closure is proved constructively: given automata or regular expressions for the input languages, we exhibit an automaton or regular expression for the result, which by Kleene's Theorem guarantees the result is regular.
- Union: If are regular with DFAs , build a product automaton whose states are pairs , transitioning both components in parallel, with final states any pair where either component is final. Equivalently, if have regular expressions , then describes .
- Intersection: Using the same product construction, but making a pair final only when both components are final. This proves is regular.
- Complement: Given a DFA for (must be a complete DFA, total transition function), swap final and non-final states: . The resulting DFA accepts exactly .
- Concatenation: If are regular with expressions , then describes ; equivalently, NFAs can be joined with an -transition from each final state of to the start state of .
- Kleene star: If describes , then describes , constructed by adding -loops back to the start state at each accepting state.
- Reversal: If is regular with DFA , reversing all transition arrows, swapping the start and final-state roles (making the old start state the new unique final state and adding a new start state with -transitions to the old final states) yields an NFA for .
- Homomorphism and inverse homomorphism: If is a homomorphism and is regular, then is regular (substitute each symbol's regular-expression image into the expression for ); likewise is regular.
- Set difference: Since , and regular languages are closed under both intersection and complement, difference follows directly.
Let and recognize and . Define where . By induction on , the extended transition function satisfies , so drives to a state in exactly when it drives to a state in and to a state in simultaneously, i.e., . Since is a well-defined finite automaton with states, is regular.
These closure properties are the standard toolkit for proving other languages regular (by decomposing them into unions, intersections, and complements of simpler regular languages) and, conversely, are frequently combined with the Pumping Lemma to prove languages are not regular: for example, if were regular then for a simple regular would also have to be regular, and if it demonstrably is not, cannot be regular either.