1. Gyanastra
  2. Theory of Computation
  3. Chomsky Hierarchy
  4. Chomsky Hierarchy of Language Classes and Proper Subset Relations
Free lesson, no account needed 8 min read 11 practice questions after it
Asked in past papers26 times
  • GATE CSE201620142011200820041995199119901988
  • ISRO202020172016
  • UGC NET20232022202020192018201720152014201320122010200720062005

Theory of Computation · Chomsky Hierarchy

Chomsky Hierarchy of Language Classes and Proper Subset Relations

Overview

The Chomsky hierarchy arranges language classes by the machine model that accepts them, from finite automata up to general Turing machines.
Each containment is proper, but the top two boundaries can only be proved by mathematical theorems, not by exhibiting a concrete witness language.

Key concepts

  • Recursively enumerable (RE) languages: the set of all languages accepted by Turing machines. This is the outermost class and encloses every other class.
  • Recursive languages: languages accepted by halting Turing machines (TMs that always halt). Contained inside RE.
  • Context-sensitive languages (CSL): languages accepted by linear bounded automata (LBA). Contained inside recursive.
  • Context-free languages (CFL): languages accepted by pushdown automata (PDA). Contained inside CSL.
  • Regular languages: languages accepted by finite automata (FA). The innermost class.
  • Proper subset: to prove that a containment A⊆BA \subseteq B is proper, exhibit at least one language that is in the bigger class BB but not in the smaller class AA.
  • Nesting: RE⊇Recursive⊇Context-sensitive⊇Context-free⊇Regular\text{RE} \supseteq \text{Recursive} \supseteq \text{Context-sensitive} \supseteq \text{Context-free} \supseteq \text{Regular}, and every containment is proper.

How it works

  1. List the classes and the machine model that accepts each one.
  2. Ask whether each containment is proper, i.e. whether the smaller class is a proper subset of the larger one.
  3. For Regular vs Context-free, exhibit an explicit witness: L={anbn∣n≥0}L = \{ a^n b^n \mid n \ge 0 \} is context-free but not regular.
  4. For Context-free vs Context-sensitive, exhibit an explicit witness: L={anbncn∣n≥0}L = \{ a^n b^n c^n \mid n \ge 0 \} is context-sensitive but not context-free.
  5. For Recursive vs Context-sensitive, no explicit witness of the simple form (anbncna^n b^n c^n, {ap∣p is prime}\{ a^p \mid p \text{ is prime} \}, etc.) is available.
    Properness is established only by mathematical theorems (counting/diagonal arguments), which prove that at least one language exists that is recursive but not context-sensitive.
    We can assert "there exists at least one such language" but cannot say precisely what it is.
  6. The same holds one level up: at least one language exists that is recursively enumerable but not recursive, proved by mathematical theorems, but it cannot be exhibited in the simple anbncna^n b^n c^n form.
  7. Conclusion: using mathematical theorems one proves that every containment in the hierarchy is proper; what cannot be done is to name the exact witness language at the top two boundaries.
  8. The Turing machine is the most powerful machine model.
    Whether it accepts every possible language — for every language LL, does there exist a TM that accepts LL — is the next question, to be settled using set theory (comparing the set of all Turing machines with the set of all languages).

Formulas

  • RE⊇Recursive⊇Context-sensitive⊇Context-free⊇Regular\text{RE} \supseteq \text{Recursive} \supseteq \text{Context-sensitive} \supseteq \text{Context-free} \supseteq \text{Regular} — the nesting of the Chomsky hierarchy; every containment is proper.

  • L={anbn∣n≥0}L = \{ a^n b^n \mid n \ge 0 \} — witness separating Regular from Context-free (n≥1n \ge 1 or n≥0n \ge 0).

  • L={anbncn∣n≥0}L = \{ a^n b^n c^n \mid n \ge 0 \} — witness separating Context-free from Context-sensitive.

  • {ap∣p is prime}\{ a^p \mid p \text{ is prime} \} — an example of a simple-form language that is not available as a witness at the top boundaries.

  • Chomsky Hierarchy Nesting

  • Shows the proper-subset nesting of the five language classes from RE down to Regular.

  • Machine to Language Class

  • Maps each machine model to the language class it accepts.

Worked examples

Example 1 — Separating Regular from Context-free.

  • Language: L={anbn∣n≥0}L = \{ a^n b^n \mid n \ge 0 \}.
  • Not regular: a finite automaton has only finitely many states and cannot remember an unbounded count of a's to compare with b's.
  • Context-free: a PDA pushes each a, then pops one a for each b, accepting when the stack empties.
  • Conclusion: L∈CFLL \in \text{CFL} but L∉RegularL \notin \text{Regular}, so Regular ⊊\subsetneq Context-free.

Example 2 — Separating Context-free from Context-sensitive.

  • Language: L={anbncn∣n≥0}L = \{ a^n b^n c^n \mid n \ge 0 \}.
  • Not context-free: one stack cannot simultaneously enforce equality of three counts.
  • Context-sensitive: accepted by a linear bounded automaton (the tape is limited to the input length, and the machine can mark and cross-check the three blocks).
  • Conclusion: L∈CSLL \in \text{CSL} but L∉CFLL \notin \text{CFL}, so Context-free ⊊\subsetneq Context-sensitive.

Example 3 — The boundary that has no simple witness.

  • Question: give a language that is recursive but not context-sensitive.
  • No explicit language of the form anbncna^n b^n c^n or {ap∣p is prime}\{ a^p \mid p \text{ is prime} \} is available for this.
  • Only a mathematical-theorem (counting) argument proves such a language exists.
  • For a language that is RE but not recursive, an explicit witness exists: the halting problem language Lu={⟨M,w⟩∣M halts on w}L_u = \{ \langle M, w \rangle \mid M \text{ halts on } w \} is RE but not recursive.

Comparison

ContainmentProper?How provedWitness language
Regular ⊊\subsetneq Context-freeYesexplicit example{anbn∣n≥0}\{ a^n b^n \mid n \ge 0 \}
Context-free ⊊\subsetneq Context-sensitiveYesexplicit example{anbncn∣n≥0}\{ a^n b^n c^n \mid n \ge 0 \}
Context-sensitive ⊊\subsetneq RecursiveYesmathematical theorems onlynone exhibitable
Recursive ⊊\subsetneq REYesexplicit examplehalting problem LuL_u
MachineLanguage class accepted
Finite automatonRegular
Pushdown automatonContext-free
Linear bounded automatonContext-sensitive
Halting Turing machineRecursive
Turing machine (general)Recursively enumerable

Revision summary

  • RE is the set of all languages accepted by Turing machines and encloses every other class.
  • Recursive means accepted by halting Turing machines (TMs that always halt).
  • To prove a containment is proper, exhibit one language in the larger class but not the smaller class.
  • {anbn∣n≥0}\{ a^n b^n \mid n \ge 0 \} separates Regular from CFL; {anbncn∣n≥0}\{ a^n b^n c^n \mid n \ge 0 \} separates CFL from CSL.
  • At the top two boundaries (CSL vs Recursive, Recursive vs RE) no explicit witness language is available; properness is proved only by mathematical theorems — "there exists at least one such language" but it cannot be named.
  • The Turing machine is the most powerful machine model; whether it accepts every language is settled with set theory.

Previous-year exam insights

  • Chomsky type numbering: Type 0 = recursively enumerable (Turing machine), Type 1 = context-sensitive (linear bounded automaton), Type 2 = context-free (pushdown automaton), Type 3 = regular (finite automaton).
    Asked inUGC NET 2022UGC NET 2018
  • Closure/containment facts used in matching questions: regular ⊂ CFL ⊂ CSL ⊂ recursive ⊂ RE; the complement of a recursive language is recursive, and the complement of an RE language need not be RE, so unions like (complement of recursive) ∪ RE stay RE, while (complement of CFL) ∪ recursive stays recursive.
    Asked inUGC NET 2020UGC NET 2019
  • Every finite language is regular (hence context-free, context-sensitive, recursive and RE); a finite language is never undecidable.
    Asked inGATE 1991
  • Decidability by class: membership is decidable for regular, CFL, CSL and recursive languages, but undecidable for RE languages in general.
    Emptiness is decidable for regular and CFLs but undecidable for CSLs;
    whether L1 ∩ L2 = ∅ is decidable for regular languages but already undecidable for CFLs (hence also for CSLs).
    Asked inUGC NET 2020
  • Standard non-containment witnesses: {ana^{n} bnb^{n} | n ≥ 0} is CFL but not regular; {ana^{n} bnb^{n} cnc^{n} | n ≥ 0} and {0n0^{n} 1n1^{n} 2n2^{n} | n ≥ 1} are CSL but not CFL; {apa^{p} | p prime} is also CSL (decidable in linear space) but not CFL; the halting language {(⟨M⟩,w) : M halts on w} is RE but not recursive.
    Asked inGATE 2014GATE 2011UGC NET 2018
  • A language is regular iff some finite automaton accepts it; adding a stack gives PDA/CFL, a bounded tape gives LBA/CSL, and an unbounded tape gives TM/RE — the machine model determines exactly the class, so a CSL is recognized by an LBA, not by any finite automaton.
    Asked inUGC NET 2018GATE 1990
Pages 1–2 of 2