# Formal Languages Closure Properties & Decidability Master Matrix
Exam: GATE Computer Science & Information Technology (GATE CS)
Subject: Theory of Computation
Canonical URL: https://gateandnet.com/exams/gate-cs/theory-of-computation/closure-properties-and-decidability

> One-stop matrix for Regular, DCFL, CFL, CSL, Recursive, and RE closure + Rice’s Theorem undecidability shortcuts.

## Complete Closure Properties Table (Save 4 Marks Every Year!)

| Operation | Regular | DCFL | CFL | Recursive (REC) | Rec. Enumerable (RE) |
| :--- | :---: | :---: | :---: | :---: | :---: |
| **Union ($L_1 \cup L_2$)** | ✅ Yes | ❌ **No** | ✅ Yes | ✅ Yes | ✅ Yes |
| **Intersection ($L_1 \cap L_2$)** | ✅ Yes | ❌ **No** | ❌ **No** | ✅ Yes | ✅ Yes |
| **Complement ($\overline{L}$)** | ✅ Yes | ✅ **Yes** | ❌ **No** | ✅ Yes | ❌ **No** |
| **Concatenation ($L_1 \cdot L_2$)** | ✅ Yes | ❌ **No** | ✅ Yes | ✅ Yes | ✅ Yes |
| **Kleene Star ($L^*$)** | ✅ Yes | ❌ **No** | ✅ Yes | ✅ Yes | ✅ Yes |
| **Intersection with Regular ($L \cap R$)** | ✅ Yes | ✅ **Yes** | ✅ **Yes** | ✅ Yes | ✅ Yes |
| **Homomorphism ($h(L)$)** | ✅ Yes | ❌ No | ✅ Yes | ❌ **No** | ✅ Yes |

## Decidable vs. Undecidable Decision Problems

| Problem | Regular | DCFL | CFL | REC / RE (Turing Machine) |
| :--- | :---: | :---: | :---: | :---: |
| **Membership ($w \in L?$)** | ✅ Decidable | ✅ Decidable | ✅ Decidable (CYK $\mathcal{O}(n^3)$) | ✅ for REC / ❌ **Undecidable** for RE |
| **Emptiness ($L = \emptyset?$)** | ✅ Decidable | ✅ Decidable | ✅ Decidable | ❌ **Undecidable** |
| **Finiteness ($|L| < \infty?$)** | ✅ Decidable | ✅ Decidable | ✅ Decidable | ❌ **Undecidable** |
| **Universality ($L = \Sigma^*?$)** | ✅ Decidable | ✅ **Decidable** | ❌ **Undecidable** | ❌ **Undecidable** |
| **Equivalence ($L_1 = L_2?$)** | ✅ Decidable | ✅ **Decidable** | ❌ **Undecidable** | ❌ **Undecidable** |

> [!FORMULA]
> **Rice’s Theorem Shortcut:** *Every non-trivial semantic property of the language $L(M)$ recognized by a Turing Machine $M$ is **UNDECIDABLE**!* (e.g., "Is $L(M)$ regular?", "Does $M$ accept $\epsilon$?", "Does $L(M)$ contain at least 2 strings?" are ALL undecidable!). Watch out for **syntactic** machine questions like *"Does $M$ have 15 states?"* or *"Does $M$ halt on $w$ within 100 steps?"* — those ARE **decidable**!


## Solved Practice Questions & PYQs

### [GATE CS MSQ | MSQ]
Let $L_1$ be a Regular language, $L_2$ be a Deterministic Context-Free Language (DCFL), and $L_3$ be a Recursively Enumerable (RE) language. Which of the following statements are **ALWAYS TRUE**?
**Correct Answer:** A,B,C
**Solution:** **A, B, and C are TRUE!** DCFLs are closed under complement and intersection with regular sets, and universality ($L = \Sigma^*$, equivalent to emptiness of $\overline{L}$) is decidable for DCFLs! **D is FALSE**: RE languages are NOT closed under complement (if $L_3$ is RE but undecidable, $\overline{L_3}$ is not RE).

### [GATE CS TOC | MCQ]
Context-Free Languages (CFLs) are **CLOSED** under which of the following set of operations?
**Correct Answer:** B
**Solution:** CFLs are closed under **Union, Concatenation, Kleene Star, Reversal, and Intersection with a Regular language**, but are **NOT closed under Intersection or Complement** (e.g., $\{a^n b^n c^m\} \cap \{a^m b^n c^n\} = \{a^n b^n c^n\}$, which is not CFL).

### [GATE CS TOC | MCQ]
By **Rice’s Theorem**, which of the following problems about an arbitrary Turing Machine $M$ is **DECIDABLE**?
**Correct Answer:** C
**Solution:** Rice’s Theorem states that **every non-trivial semantic property of $L(M)$** (like emptiness, regularity, or $|L(M)| \ge 2$) is **undecidable**. Counting whether $M$’s description has $\le 15$ states is a **syntactic** property of the machine encoding, inspectable in finite linear time!
