Sub topic 6
Closure Properties: What Union, Intersection, and Complement Preserve
Assume you know finite automata, context-free languages, basic set theory, and proof by contradiction. This chapter uses two important language classes:
- A recursive language is one decided by a Turing machine that halts on every input.
- A recursively enumerable (RE) language is one recognized by a Turing machine. The machine accepts members, but it may loop forever on non-members.
Closure properties tell us whether applying an operation keeps a language inside the same class.
Recursive languages
Let \(L1\) and \(L2\) be recursive. There are deciders \(M1\) and \(M2\) for them. Because both machines halt, we can safely run them in sequence.
Union
The union is
\[ L1 \cup L2 = \{w : w \in L1 \text{ or } w \in L2\}. \]
A decider for the union runs \(M1\) and \(M2\):
- Run \(M_1\) on \(w\).
- If \(M_1\) accepts, accept.
- Otherwise run \(M_2\).
- Accept if \(M_2\) accepts; otherwise reject.
Both machines halt, so the new machine always halts.
Intersection
The intersection is
\[ L1 \cap L2 = \{w : w \in L1 \text{ and } w \in L2\}. \]
Run both deciders. Accept only when both accept. Again, termination is guaranteed.
Complement
For a recursive language, swap the accepting and rejecting outcomes of its decider. Since the original machine halts on every input, the modified machine also halts on every input.
Therefore, recursive languages are closed under union, intersection, and complement.
Recursively enumerable languages
RE languages behave differently because their recognizers may loop.
Union
RE languages are closed under union. Given recognizers \(R1\) and \(R2\), run them in parallel by alternating one step of each machine:
- If either machine accepts, accept.
- If both reject, reject, if the model includes explicit rejection.
- If neither accepts, the combined machine may continue forever.
This parallel process is called dovetailing. It prevents one looping recognizer from blocking the other.
Intersection
RE languages are also closed under intersection. Dovetail both recognizers and accept only after both have accepted. If one recognizer loops, the combined recognizer may loop, which is allowed for an RE language.
Complement
RE languages are generally not closed under complement. If both a language and its complement were RE, we could run their recognizers in parallel. One would eventually accept every input, creating a decider. Thus, if an RE language has a non-RE complement, it cannot be recursive.
| Language class | Union | Intersection | Complement |
|---|---|---|---|
| Recursive | Closed | Closed | Closed |
| RE | Closed | Closed | Not closed in general |
Exercise
If L and its complement are both recursively enumerable, what stronger conclusion can you make about L?
Show answer
L is recursive, because dovetailing recognizers for L and its complement produces a decider.