Formal Language Foundations and Unsolvable Problems
The Chomsky Hierarchy, Named Explicitly
| Type | Language class | Recognising machine | Grammar restriction |
|---|---|---|---|
| Type 3 | Regular | Finite automaton (DFA/NFA) | A → aB or A → a (right/left-linear) |
| Type 2 | Context-free | Pushdown automaton | A → γ (single non-terminal on the left) |
| Type 1 | Context-sensitive | Linear-bounded automaton | αAβ → αγβ (γ non-empty; length never decreases) |
| Type 0 | Recursively enumerable / Unrestricted | Turing machine | No restriction at all on productions |
The Halting Problem, the Post Correspondence Problem and Other Unsolvable Problems
The Halting Problem asks: given a program P and an input x, does P halt on x, or run forever? Turing proved this UNDECIDABLE by a direct diagonal/self-reference argument: assume a hypothetical HALTS(P, x) decider exists, build a new program D that, given a program's own description P as input, runs HALTS(P, P) and then does the OPPOSITE (loops forever if HALTS says P halts on itself; halts if HALTS says P loops on itself) — then ask what D(D) does, and either answer contradicts what HALTS just decided. Since the assumption of a decider leads to contradiction, no such decider can exist. The Post Correspondence Problem (PCP) asks: given two lists of strings A = (a₁,…,aₙ) and B = (b₁,…,bₙ), is there a sequence of indices i₁,…,iₖ (repeats allowed) such that ai1ai2…aik = bi1bi2…bik? PCP is also undecidable, and it is USED to prove many OTHER undecidability results by reduction (showing that a decider for some new problem would give a decider for PCP), exactly the reduction technique from Lower Bound Theory applied here to undecidability rather than to a running-time lower bound.
- Unsolvable problems for context-free languages: several natural questions that ARE decidable for regular languages become UNDECIDABLE once asked about context-free grammars — whether two context-free grammars generate the SAME language, whether a context-free grammar is AMBIGUOUS, and whether a context-free grammar generates ALL strings over its alphabet are all undecidable, in sharp contrast to the corresponding (decidable) questions for regular languages/DFAs.
- Measuring and classifying complexity: the theory of computation's undecidability line (can it be solved AT ALL) is distinct from complexity theory's tractability line (can it be solved EFFICIENTLY) — a problem can be decidable yet still intractable (every NP-complete problem is decidable, since brute-force enumeration always eventually terminates for a finite input, but none is known to be efficiently decidable), and the vocabulary TRACTABLE/INTRACTABLE from the previous chapter is exactly the second, finer distinction drawn once a problem has already cleared the first, coarser decidability bar.
How Deep NET Goes: LALR(1) and Turing-Machine Variants
Two syllabus items are worth checking against what you study in the course's Compiler Design and Theory of Computation chapters. First, LALR(1) is named alongside LR parsing generally. It is the canonical LR(1) construction with the states that share a core merged to shrink the table — a small addition on top of LR theory you already know, not a separate topic. Second, the Turing-machine item names 'Standard Turing Machine and its Variations' and 'Construction of TM for Simple Problems'; both are standard material in the Turing-machine section of the Theory of Computation chapter. So, for Unit 8, study those chapters for the bulk of the unit and this chapter for the foundations that come before them.
Key takeaways
- The diagonal argument shows there are strictly more possible problems (uncountable) than possible programs (countable), so most problems are unsolvable in principle — before any specific unsolvable problem is named.
- Russell's paradox and the halting problem's proof both exploit the same self-reference mechanism.
- The Chomsky hierarchy (regular ⊊ context-free ⊊ context-sensitive ⊊ recursively enumerable) is strict containment; a language's type is the smallest class it belongs to.
- The halting problem and the Post Correspondence Problem are both undecidable; PCP is itself used to prove many other undecidability results by reduction.
- Undecidability (can it be solved at all) and intractability (can it be solved efficiently) are distinct lines — every NP-complete problem is decidable, just not known to be efficiently so.
Practice questions (8)
Attempt each one before opening the answer. Every explanation names the tempting wrong option as well as the right one, because that is where marks are lost.
The diagonal argument shows that undecidable problems must exist because:
Show answer
Answer: A — The set of all possible problems is uncountable, while the set of all possible programs is countable
Since programs (finite strings) are countable but functions/problems are uncountable, there are strictly more problems than there could ever be programs, so most problems have no solving program at all.Russell's paradox and the standard proof of the halting problem's undecidability share:
Show answer
Answer: A — The same self-reference mechanism
Both constructions consider an object applied to (or asking about) itself and derive a direct contradiction from either possible answer, which is the defining trick of self-reference used in both proofs.In the Chomsky hierarchy, the language {aⁿbⁿ : n ≥ 0} is correctly classified as:
Show answer
Answer: A — Context-free (its smallest/tightest class), not regular
{aⁿbⁿ} is generated by a context-free grammar but provably fails the pumping lemma for regular languages, so context-free is its tightest (and hence correct) classification, even though it is technically also context-sensitive and recursively enumerable.The Post Correspondence Problem (PCP) is significant chiefly because it:
Show answer
Answer: A — Is itself undecidable and is used to prove many other undecidability results by reduction
PCP's undecidability, combined with how naturally it reduces to and from many other formal-language questions, makes it a standard anchor problem for proving other results undecidable by reduction.Whether two given context-free grammars generate the same language is:
Show answer
Answer: A — Undecidable
Language equivalence for context-free grammars is undecidable, in sharp contrast to the corresponding question for regular languages/DFAs (deciding DFA/NFA equivalence is decidable, covered in the course's Theory of Computation chapter).Which of the following are true of the relationship between decidability and tractability? (More than one option may be correct.)
Show answer
Answer: A — Every NP-complete problem is decidable; B — No NP-complete problem is known to be efficiently (polynomial-time) decidable
Decidability (solvable at all, however slowly) and tractability (solvable efficiently) are distinct lines; an NP-complete problem is decidable by brute force but not known to be efficiently decidable, while the halting problem is not decidable at all, which is a strictly different (and stronger) kind of hardness than NP-completeness.Name the mathematician whose diagonal argument (originally used to prove the reals are uncountable) is adapted to prove that there are more possible problems than possible programs.
Numerical answer — type the value.
Show answer
Answer: Cantor
Cantor's diagonal argument, originally a set-theory result about the uncountability of the reals, generalises directly to show the set of all functions/problems is uncountable while programs remain countable.LALR(1) parsing, compared to canonical LR(1) parsing, is best described as:
Show answer
Answer: A — The same construction with compatible states merged to shrink the parsing table
LALR(1) builds on the same canonical-LR(1) machinery already covered in depth by the course's Compiler Design chapter, merging states with identical cores to produce a smaller table at a small cost in parsing power.