Sub topic 10
Closure Properties of Regular Languages
Assume you know basic set operations, finite automata, and how a DFA or NFA processes a string. A language is regular if some finite automaton recognizes it. A family of languages is closed under an operation when applying that operation to languages in the family always produces another language in the same family.
Closure properties let you prove that a complicated language is regular without constructing a complete automaton from scratch.
Basic closure properties
If \(L1\) and \(L2\) are regular languages over alphabet \(\Sigma\), then the following languages are also regular:
| Operation | Result | Main construction |
|---|---|---|
| Union | \(L_1 \cup L_2\) | Product DFA or NFA choice |
| Intersection | \(L_1 \cap L_2\) | Product DFA |
| Complement | \(\overline{L_1} = \Sigma^* - L_1\) | Swap accepting and nonaccepting states |
| Difference | \(L_1 - L_2\) | \(L_1 \cap \overline{L_2}\) |
| Concatenation | \(L_1L_2\) | NFA with epsilon transitions |
| Kleene star | \(L_1^*\) | NFA with a new start and looping paths |
| Reversal | \(L_1^R\) | Reverse every transition |
For union and intersection, use a product construction. If \(D1\) has states \(Q1\) and \(D2\) has states \(Q2\), the product DFA has states \(Q1 \times Q2\). It reads both machines simultaneously:
- For union, a pair is accepting if at least one component is accepting.
- For intersection, a pair is accepting only if both components are accepting.
The product may contain \(|Q1||Q2|\) states, although some states may be unreachable.
Complement and difference
To complement a DFA, make every accepting state nonaccepting and every nonaccepting state accepting. This works only when the DFA is complete: every state must have a transition for every symbol in \(\Sigma\). If a transition is missing, first add a dead state and send all missing transitions there.
Difference follows from intersection:
\[ L1 - L2 = L1 \cap \overline{L2}. \]
This identity is useful because it reduces a less familiar operation to two standard closure operations.
Concatenation, star, and reversal
For \(L1L2\), build an NFA for \(L1\), an NFA for \(L2\), and add epsilon transitions from every accepting state of the first machine to the start state of the second. The NFA accepts when some split \(w=xy\) has \(x\in L1\) and \(y\in L2\).
For \(L^*\), add a new accepting start state. Add epsilon transitions from it to the old start state and from every old accepting state back to the old start. This allows zero or more repetitions.
For reversal, reverse all transitions, make the old start state accepting, and create a new start state with epsilon transitions to every old accepting state.
Common errors
- Complementing a partial DFA without adding a dead state.
- Treating intersection as a transition-by-transition operation instead of using state pairs.
- Assuming closure under arbitrary infinite union. Regular languages are closed under finite union, not necessarily infinite union.
- Confusing concatenation \(L1L2\) with intersection. Concatenation divides a string into two consecutive parts.
Exercise
If L is regular, is the language of strings containing an even number of a's and ending in b regular?
Show answer
Yes. The language of strings with an even number of a's is regular, and the language ending in b is regular. Their intersection is regular by closure.