CS Atlas GATE 2027
TOC course
0 / 91 complete

TOC/Phase 4 · Turing Machines

Lesson 4.3.2 · Item 71 of 91

The Chomsky hierarchy and the containment chain

Read at your own pace. Try the questions before opening the answers.

On this page

Recall warm-up

  1. 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.

    Read lesson 4.3.1

  2. 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.

    Read lesson 4.2

  3. 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.

    Read lesson 3.3.3

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.

stepwitness in the bigger class only
Regular ⊊ DCFLaⁿbⁿ
DCFL ⊊ CFLwwᴿ
CFL ⊊ CSLaⁿbⁿcⁿ, ww
CSL ⊊ RECexists by diagonalization (no simple example needed)
REC ⊊ REthe acceptance / halting language (Phase 5)
RE ⊊ all languagesits complement (Phase 5)
One witness per strict step.

The four grammar types

TypeGrammar rulesMachineLanguages
0unrestricted α → βTuring machineRE
1context-sensitive |α| ≤ |β|LBACSL
2context-free A → αPDACFL
3right/left-linearfinite automatonregular

DCFL and REC are not Chomsky types but sit in the chain: DCFL between regular and CFL; REC between CSL and RE.

Type 0 — RE unrestricted grammars · TM
Recursive deciders
Type 1 — CSL CSG · LBA
Type 2 — CFL CFG · NPDA
DCFL DPDA
Type 3 — Regular regular grammar · DFA
The containment chain, outermost first.

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.

Phase 4 language hierarchy
The Language Universe at Phase 4: Finite ⊂ Regular ⊂ DCFL ⊂ CFL ⊂ CSL ⊂ REC ⊂ RE.

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).

unrestricted grammar
TM
search all derivations
RE
Type 0 ⇔ RE.

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).
every CFL is recursive
true
every recursive language is a CSL
false
every regular language is a DCFL
true
complement of a CFL is a CSL
true
Quick true/false reads of the chain.

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

Easy

Is every CSL recursive?

Show the full solution

Yes — an LBA has finitely many configurations per input length, so a TM can decide it.

Medium

Order: CFL, Regular, RE, CSL, DCFL, REC.

Show the full solution

Regular ⊂ DCFL ⊂ CFL ⊂ CSL ⊂ REC ⊂ RE.

GATE-level

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

  1. MCQ

    Correct containment chain:

    1. Reg ⊂ CFL ⊂ DCFL ⊂ CSL ⊂ REC ⊂ RE
    2. Reg ⊂ DCFL ⊂ CFL ⊂ CSL ⊂ REC ⊂ RE
    3. Reg ⊂ DCFL ⊂ CFL ⊂ REC ⊂ CSL ⊂ RE
    4. Reg ⊂ CSL ⊂ CFL ⊂ REC ⊂ RE
  2. MSQ

    Which are true?

    1. Every CSL is recursive
    2. Every RE language is recursive
    3. Every DCFL is a CSL
    4. Type 0 grammars generate exactly the RE languages
  3. MCQ

    Which machine corresponds to Type 1 grammars?

    1. DFA
    2. PDA
    3. LBA
    4. TM
  4. MCQ

    A language in CSL but not in CFL:

    1. aⁿbⁿ
    2. wwᴿ
    3. aⁿbⁿcⁿ
    4. 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

  1. A TM that halts on every input.
  2. The linear bounded automaton.
  3. wwᴿ.

Self-test answers

  1. B — Standard chain.
    • A: DCFL inside CFL.
    • C: CSL inside REC.
    • D: Order wrong.
  2. ACD — Chain facts.
    • B: REC ⊊ RE.
  3. C — CSG ⇔ LBA.
    • A: Type 3.
    • B: Type 2.
    • D: Type 0.
  4. C — Standard witness.
    • A: CFL.
    • B: CFL.
    • D: Regular.

Flashcards

  1. Full containment chain?
    Reveal answerRegular ⊂ DCFL ⊂ CFL ⊂ CSL ⊂ REC ⊂ RE (all strict).
  2. Type 1 grammars and machines?
    Reveal answerContext-sensitive grammars, LBAs.
  3. Witness for CFL ⊊ CSL?
    Reveal answeraⁿbⁿcⁿ (or ww).

Ready for the next idea?

Mark this item complete when you’ve finished reading and working through it.