Sub topic 14
Chomsky Hierarchy and the Machine for Each Level
Prerequisites: finite automata, context-free grammars, pushdown automata, and the basic idea of a Turing machine. The Chomsky hierarchy classifies formal languages by the strength of the machine or grammar needed to recognize them.
Each level contains the levels below it. A stronger machine can simulate a weaker machine, so it can recognize at least the same languages.
| Type | Language class | Recognizing machine | Grammar restriction |
|---|---|---|---|
| Type 3 | Regular | Finite automaton | Right-linear or left-linear rules |
| Type 2 | Context-free | Pushdown automaton | One variable on the left side |
| Type 1 | Context-sensitive | Linear bounded automaton | Noncontracting rules |
| Type 0 | Recursively enumerable | Turing machine | Unrestricted rules |
The hierarchy
Type 3: regular languages
A finite automaton recognizes a regular language. It has only a finite amount of memory, represented by its current state. It cannot count an arbitrary number of symbols or remember an unbounded prefix.
For example, the language of strings over zero and one that end in 01 is regular. A finite automaton can remember whether the most recent symbols match the required suffix.
Regular languages are generated by linear grammars. Their decision problems are usually easy: membership, emptiness, equivalence, and intersection are all decidable.
Type 2: context-free languages
A pushdown automaton recognizes a context-free language. It adds a stack, which provides unbounded last-in, first-out memory.
The language containing equal numbers of a followed by b,
a^n b^n
is context-free but not regular. A pushdown automaton pushes one stack symbol for each a and pops one for each b.
Context-free languages describe nested structures such as balanced parentheses and programming-language expressions. Membership is decidable, although equivalence and universality are undecidable for general context-free grammars.
Type 1: context-sensitive languages
A linear bounded automaton is a restricted nondeterministic Turing machine. Its tape is limited to a linear function of the input length. It cannot use unlimited extra tape.
Context-sensitive languages include
a^n b^n c^n,
which requires comparing three unbounded groups. They contain every context-free language and are strictly more expressive.
Context-sensitive languages are decidable. A machine can explore all possible computations because its bounded tape gives only finitely many configurations for a fixed input. The empty string requires a special convention in many definitions because context-sensitive grammar rules do not normally shorten strings.
Type 0: recursively enumerable languages
An unrestricted grammar generates a recursively enumerable language. An ordinary Turing machine recognizes it.
The machine accepts every string in the language, but it may run forever on a string outside the language. Therefore, recursively enumerable means semi-decidable, not necessarily decidable.
Every context-sensitive language is recursively enumerable, but some recursively enumerable languages are not decidable. The halting problem is a standard example.
GATE classification shortcut
Identify the machine model first. Finite memory suggests regular languages. A stack suggests context-free languages. Input-bounded tape suggests context-sensitive languages. Unrestricted tape suggests recursively enumerable languages.
Exercise
Which class contains the language a^n b^n c^n, and which machine model recognizes it?
Show answer
It is context-sensitive and can be recognized by a linear bounded automaton. It is not context-free.