Recall warm-up
- What is a decider?
Stuck? Peek at 4.3.1 Recursive vs recursively enumerable; deciders and recognizers
- Recognizer: accepts L, may loop outside. RE = recognizable = semi-decidable = enumerable.
- Decider: halts always. Recursive = decidable.
- REC ⊆ RE. Enumerator ⇔ recognizer (dovetailing). Shortlex enumeration ⇔ recursive.
- Which machine accepts exactly the CSLs?
Stuck? Peek at 4.2 TM variants, linear bounded automata and context-sensitive languages
- Multi-tape (O(t²)), nondeterministic (BFS, exponential), two-way tape, 2-stack PDA, 2 counters: all = TM.
- LBA: nondeterministic TM within the input ⇔ CSG (|α| ≤ |β|) ⇔ CSL.
- CFL ⊊ CSL (aⁿbⁿcⁿ). Every CSL is decided by an always-halting TM.
- Regular ⊂ DCFL ⊂ CFL — which language separates DCFL from CFL?
Stuck? Peek at 3.3.3 Designing PDAs; DPDA vs NPDA; DCFL ⊂ CFL
- Recipe: stack stores what is unbounded; states store the phase; Z₀ detects empty; accept via ε, Z₀.
- DPDA: ≤ 1 move per (q, a|ε, X), and no ε-move competing with input moves.
- Regular ⊊ DCFL ⊊ CFL. wwᴿ, aⁿbⁿ ∪ aⁿb²ⁿ, aⁱbʲcᵏ (i=j or j=k): CFL not DCFL.
- DCFL ⇒ unambiguous grammar; not conversely.
The Hook
GATE’s most reused one-mark fact is a single line: Regular ⊂ DCFL ⊂ CFL ⊂ CSL ⊂ Recursive ⊂ RE, each inclusion strict. Noam Chomsky organized the grammar side into four types in 1956; the machines you met line up with them exactly. This lesson builds the full picture — in 3D.
Predict First
Which language would you use to show CSL ≠ CFL? And CFL ≠ DCFL?
Core Concept
Prediction check
aⁿbⁿcⁿ is context-sensitive but not context-free; wwᴿ is context-free but not deterministic. Each strict step has a standard witness.
| step | witness in the bigger class only |
|---|---|
| Regular ⊊ DCFL | aⁿbⁿ |
| DCFL ⊊ CFL | wwᴿ |
| CFL ⊊ CSL | aⁿbⁿcⁿ, ww |
| CSL ⊊ REC | exists by diagonalization (no simple example needed) |
| REC ⊊ RE | the acceptance / halting language (Phase 5) |
| RE ⊊ all languages | its complement (Phase 5) |
The four grammar types
| Type | Grammar rules | Machine | Languages |
|---|---|---|---|
| 0 | unrestricted α → β | Turing machine | RE |
| 1 | context-sensitive |α| ≤ |β| | LBA | CSL |
| 2 | context-free A → α | PDA | CFL |
| 3 | right/left-linear | finite automaton | regular |
DCFL and REC are not Chomsky types but sit in the chain: DCFL between regular and CFL; REC between CSL and RE.
See it in 3D
Each class is a shell inside the next. Tap a shell to see its machine, closure properties and example languages; tap a glowing point to see why a language lives where it does.
Unrestricted grammars = TMs
Type-0 grammars allow any rule α → β (α non-empty). A TM can search all derivations (so grammar ⇒ RE); a grammar can simulate a TM run backwards (RE ⇒ grammar).
Reading the chain in exam questions
- “Every CFL is recursive” — true (CFL ⊂ CSL ⊂ REC).
- “Every RE language is CSL” — false.
- “Every DCFL is a CSL” — true.
- “Complement of a CFL is a CSL” — true (complement of a CSL is a CSL).
Putting it together
- Regular ⊂ DCFL ⊂ CFL ⊂ CSL ⊂ REC ⊂ RE, every step strict.
- Chomsky types 3→0 match FA, PDA, LBA, TM.
- Each step has a standard witness language.
Visual
Regular ⊂ DCFL ⊂ CFL ⊂ CSL ⊂ REC ⊂ RE ⊂ all languages DFA DPDA NPDA LBA decider TM a*b* aⁿbⁿ wwᴿ aⁿbⁿcⁿ (diag.) A_TM (Phase 5)
Worked Examples
Is every CSL recursive?
Show the full solution
Yes — an LBA has finitely many configurations per input length, so a TM can decide it.
Order: CFL, Regular, RE, CSL, DCFL, REC.
Show the full solution
Regular ⊂ DCFL ⊂ CFL ⊂ CSL ⊂ REC ⊂ RE.
Which are true? (i) L ∈ CFL ⇒ L̅ ∈ REC. (ii) L ∈ RE ⇒ L ∈ CSL. (iii) L ∈ DCFL ⇒ L̅ ∈ DCFL. (iv) L ∈ CSL ⇒ L ∈ RE.
Show the full solution
(i) true: L̅ is a CSL (CSLs are closed under complement), hence recursive. (ii) false. (iii) true. (iv) true. Answer: (i), (iii), (iv).
GATE Traps
- DCFL and REC are not Chomsky types, but they are in the chain.
- Every inclusion in the chain is strict.
- Type numbers go DOWN as power goes UP (Type 0 is the biggest).
Memory Hook
Rings of a tree: Regular at the core, then DCFL, CFL, CSL, REC, RE — each ring a bigger machine.
Connect the Dots
Which operations keep a language recursive, or RE? And a key bridge theorem: if both L and its complement are RE, then L is recursive.
Self-Test
- MCQ
Correct containment chain:
- Reg ⊂ CFL ⊂ DCFL ⊂ CSL ⊂ REC ⊂ RE
- Reg ⊂ DCFL ⊂ CFL ⊂ CSL ⊂ REC ⊂ RE
- Reg ⊂ DCFL ⊂ CFL ⊂ REC ⊂ CSL ⊂ RE
- Reg ⊂ CSL ⊂ CFL ⊂ REC ⊂ RE
- MSQ
Which are true?
- Every CSL is recursive
- Every RE language is recursive
- Every DCFL is a CSL
- Type 0 grammars generate exactly the RE languages
- MCQ
Which machine corresponds to Type 1 grammars?
- DFA
- PDA
- LBA
- TM
- MCQ
A language in CSL but not in CFL:
- aⁿbⁿ
- wwᴿ
- aⁿbⁿcⁿ
- a*b*
Rule Card
- Regular ⊊ DCFL ⊊ CFL ⊊ CSL ⊊ REC ⊊ RE ⊊ all.
- Types: 0 unrestricted/TM/RE; 1 CSG/LBA/CSL; 2 CFG/PDA/CFL; 3 regular grammar/FA/regular.
- Witnesses: aⁿbⁿ, wwᴿ, aⁿbⁿcⁿ, (diagonal), A_TM.
Concept Ledger
- Chomsky hierarchy (Type 0–3)
- unrestricted grammar
- containment chain Reg ⊂ DCFL ⊂ CFL ⊂ CSL ⊂ REC ⊂ RE
Answer Vault
Reveal answers when you’re ready
Warm-up answers
- A TM that halts on every input.
- The linear bounded automaton.
- wwᴿ.
Self-test answers
- B — Standard chain.
- A: DCFL inside CFL.
- C: CSL inside REC.
- D: Order wrong.
- ACD — Chain facts.
- B: REC ⊊ RE.
- C — CSG ⇔ LBA.
- A: Type 3.
- B: Type 2.
- D: Type 0.
- C — Standard witness.
- A: CFL.
- B: CFL.
- D: Regular.
Flashcards
- Full containment chain?
Reveal answer
Regular ⊂ DCFL ⊂ CFL ⊂ CSL ⊂ REC ⊂ RE (all strict). - Type 1 grammars and machines?
Reveal answer
Context-sensitive grammars, LBAs. - Witness for CFL ⊊ CSL?
Reveal answer
aⁿbⁿcⁿ (or ww).