The Timpson Lyceum seal

The Timpson Lyceum · Computation Theory

Lecture 15 (Computation Theory) Decidable and Undecidable Languages

Decidable and Undecidable Languages – Lecture 15

Overview

This lecture surveys which language-recognition problems can be solved by an algorithm and which cannot. Building on the Church–Turing thesis (an algorithm is exactly what a Turing machine can do) and the existence of a universal Turing machine, we prove that a whole family of natural questions about DFAs, NFAs, regular expressions, and context-free grammars are decidable. We then cross into undecidability: the acceptance problem for Turing machines, ATMA_{TM}, is recognizable but not decidable. To set up that impossibility proof we develop Cantor's theory of set size — bijections, countable sets, and the diagonalization argument showing the real numbers are uncountable. The thread tying it together is the difference between being able to confirm "yes" answers and being able to settle every answer, yes or no.

Key Concepts

The language hierarchy. Every regular language is context-free, every context-free language is decidable, and every decidable language is Turing-recognizable. Each containment is strict.

Decidable vs. recognizable.

Encodings. Angle brackets denote an encoding of an object as a string, e.g. ⟨D,w⟩\langle D, w\rangle is the DFA DD and string ww packaged as a single input. Languages are sets of strings, so any machine, grammar, or pair must first be encoded.

Decidable problems about regular languages. Each of these languages is decidable:

Decidable problems about context-free languages.

Acceptance for Turing machines is undecidable. ATM={⟨M,w⟩∣M is a TM that accepts w}A_{TM} = \{\langle M, w\rangle \mid M \text{ is a TM that accepts } w\} is recognizable — the universal TM simulates ww on MM and accepts if MM accepts. But we cannot make it a decider: if MM loops, the simulation never returns, and unlike DFAs/CFGs there is no finite bound on the number of steps after which a TM must halt. ATMA_{TM} turns out to be recognizable but undecidable, and its complement is not even recognizable.

Cardinality and bijections. Two sets have the same cardinality, ∣A∣=∣B∣|A| = |B|, iff there is a bijection f:A→Bf : A \to B — a map that is onto (every element of BB is hit, so BB is not larger than AA) and one-to-one (distinct inputs give distinct outputs, so AA is not larger than BB).

Countable vs. uncountable. A set is countable if it is finite or has the same cardinality as N\mathbb{N}. Examples of countably infinite sets: the even naturals, the integers Z\mathbb{Z}, and (via dovetailing through the grid of fractions) the rationals Q\mathbb{Q}. A set that is neither finite nor the size of N\mathbb{N} is uncountable.

Diagonalization — the reals are uncountable. Assume a bijection f:N→(0,1)f : \mathbb{N} \to (0,1) exists. Build a real x∈(0,1)x \in (0,1) whose nn-th decimal digit differs from the nn-th digit of f(n)f(n) (e.g. use 88 if that digit is 99, otherwise add 11). Then x≠f(n)x \neq f(n) for every nn, so xx is missed — ff is not onto, contradicting that it was a bijection. No such bijection exists, so (0,1)(0,1) (and hence R\mathbb{R}) is uncountable. This counting machinery is the engine behind proving ATMA_{TM} undecidable.

Worked Example

Claim: the even natural numbers E={n∈N∣n even}E = \{n \in \mathbb{N} \mid n \text{ even}\} have the same cardinality as N\mathbb{N}.

To show ∣N∣=∣E∣|\mathbb{N}| = |E| we exhibit a bijection f:N→Ef : \mathbb{N} \to E and verify it is onto and one-to-one.

f(n)=2nonto: e∈E  ⟹  e=2n for some n≥0, n∈N  ⟹  f(n)=eone-to-one: f(m)=f(n)  ⟹  2m=2n  ⟹  m=n\begin{aligned} f(n) &= 2n \\ \text{onto: } \quad e \in E &\implies e = 2n \text{ for some } n \ge 0,\ n \in \mathbb{N} \implies f(n) = e \\ \text{one-to-one: } \quad f(m) = f(n) &\implies 2m = 2n \implies m = n \end{aligned}

Every even natural is the image of some natural (onto), and equal outputs force equal inputs (one-to-one), so ff is a bijection and ∣N∣=∣E∣|\mathbb{N}| = |E| — halving an infinite set leaves its cardinality unchanged.

Summary