Decidability | Computer Science
flowchart TD A[5_Decidability] --> B[Key Concepts] A --> C[Core Principles] A --> D[Practical Applications] B --> E[Fundamental definitions] C --> F[Design patterns] D --> G[Real-world usage]Intuition
Section titled “Intuition”Decidability asks: can an algorithm give a definitive yes/no answer for every input? Some problems are fundamentally undecidable — no amount of cleverness or computing power can solve them for all cases. The halting problem is the canonical example: you cannot write a program that determines whether an arbitrary program will halt or loop forever.
Why the halting problem is undecidable: The proof is by diagonalisation — if such a program H existed, we could construct a program D that does the opposite of what H predicts, creating a paradox. This is similar to the liar’s paradox (“this statement is false”) but made rigorous through computation.
Reductions intuition: To prove a problem is undecidable, reduce a known undecidable problem to it. If A reduces to B and A is undecidable, then B is undecidable (because a decider for B would give a decider for A). This is the primary tool for proving undecidability results.
5.1 Decidable Languages
Section titled “5.1 Decidable Languages”Theorem 5.1. The following languages are decidable:
- A_{\mathrm{DFA} = \{\langle B, w \rangle : B \mathrm{ is a DFA that accepts w\}.
- E_{\mathrm{DFA} = \{\langle B \rangle : B \mathrm{ is a DFA with L(B) = \emptyset\}.
- \mathrm{EQ_{\mathrm{DFA} = \{\langle A, B \rangle : A, B \mathrm{ are DFAs with L(A) = L(B)\}.
- A_{\mathrm{CFG} = \{\langle G, w \rangle : G \mathrm{ is a CFG that generates w\}.
Proof (for A_{\mathrm{DFA}). Simulate on input . This takes steps and always halts.
Proof (for E_{\mathrm{DFA}). Mark the start state. Repeatedly mark states reachable by Transitions from already-marked states. After no more states can be marked, check if any accept state Is marked. If not, .
Proof (for \mathrm{EQ_{\mathrm{DFA}). Use the product construction to build a DFA for . Test if this DFA accepts any string (using the algorithm for E_{\mathrm{DFA}).
Additional decidable problems:
- A_{\mathrm{REX} = \{\langle R, w \rangle : R \mathrm{ is a regex and w \in L(R)\} — convert to a DFA, then decide A_{\mathrm{DFA}.
- E_{\mathrm{CFG} = \{\langle G \rangle : L(G) = \emptyset\} — test all derivations up to length .
- \mathrm{INF_{\mathrm{CFL} = \{\langle G \rangle : L(G) \mathrm{ is infinite\} — check if any variable has a self-embedding derivation.
5.2 The Halting Problem
Section titled “5.2 The Halting Problem”Theorem 5.2. A_{\mathrm{TM} = \{\langle M, w \rangle : M \mathrm{ is a TM and M \mathrm{ accepts w\} Is Turing-recognisable but undecidable.
Proof of recognisability. Simulate on . If accepts, accept. If rejects, reject. This recognises A_{\mathrm{TM}.
Proof of undecidability (by contradiction). Assume a decider for A_{\mathrm{TM} exists. Construct a TM that on input :
- Run on .
- If accepts, reject.
- If rejects, accept.
Consider on input :
- If accepts Then by construction rejects . Contradiction.
- If rejects Then by construction accepts . Contradiction.
Therefore cannot exist.
Theorem 5.2a. \overline{A_{\mathrm{TM}} is not Turing-recognisable.
Proof. If \overline{A_{\mathrm{TM}} were Turing-recognisable, then since A_{\mathrm{TM} is Also Turing-recognisable, A_{\mathrm{TM} would be decidable (run both recognisers in parallel; one Must accept). But A_{\mathrm{TM} is undecidable. Contradiction.
5.3 Reductions and Undecidability
Section titled “5.3 Reductions and Undecidability”A reduction from language to language is a computable function that maps instances of to instances of such that .
Theorem 5.3. If and is decidable, then is decidable.
Proof. To decide on input : compute Then decide on . Since both steps are Computable, is decidable.
Corollary 5.4. If and is undecidable, then is undecidable.
Applications. Using reductions from A_{\mathrm{TM}We can prove many problems undecidable:
| Language | Description | Reduction from |
|---|---|---|
| \mathrm{HALT_{\mathrm{TM} | \{M, w : M \mathrm{ halts on w\} | A_{\mathrm{TM} |
| E_{\mathrm{TM} | A_{\mathrm{TM} | |
| \mathrm{REGULAR_{\mathrm{TM} | \{M : L(M) \mathrm{ is regular\} | A_{\mathrm{TM} |
| \mathrm{EQ_{\mathrm{TM} | E_{\mathrm{TM} |
Example reduction. A_{\mathrm{TM} \leq_m \mathrm{HALT_{\mathrm{TM}.
Proof. Given Construct a TM that on input : simulates on . If accepts, accept. If rejects, loop. Then \langle M, w \rangle \in A_{\mathrm{TM} iff halts on some input (any input), iff \langle M' \rangle \in \mathrm{HALT_{\mathrm{TM}.
Worked Example: $A_{\mathrm{TM} \leq_m E_{\mathrm{TM}$
Proof. Given Construct a TM that on input :
- Simulate on .
- If accepts Accept .
- If rejects Reject .
Then if accepts And if does not accept .
Therefore: \langle M, w \rangle \in A_{\mathrm{TM} iff Iff \langle M_w \rangle \notin E_{\mathrm{TM}.
The reduction is computable. So if E_{\mathrm{TM} Were decidable, \overline{E_{\mathrm{TM}} would be decidable, and hence A_{\mathrm{TM} Would be decidable — contradiction.
Worked Example: $E_{\mathrm{TM} \leq_m \mathrm{EQ_{\mathrm{TM}$
Proof. Given Construct two TMs:
- : on any input, immediately rejects. So .
- : on any input, simulates and accepts iff accepts. So .
Then iff .
Therefore \langle M \rangle \in E_{\mathrm{TM} iff \langle M_1, M_2 \rangle \in \mathrm{EQ_{\mathrm{TM}. If \mathrm{EQ_{\mathrm{TM} were decidable, E_{\mathrm{TM} would be decidable — contradiction.
5.4 Rice’s Theorem
Section titled “5.4 Rice’s Theorem”Theorem 5.5 (Rice’s Theorem). Every non-trivial property of the language recognised by a Turing Machine is undecidable.
A property is a set of Turing-recognisable languages. It is non-trivial if is neither Empty nor the set of all Turing-recognisable languages.
Proof (sketch). Let be a non-trivial property. Since is non-trivial, there exists a TM with and a TM with . Given an arbitrary TM and input Construct that on input : first simulates on Then simulates on . If accepts Then ; if does not accept , . If Then iff accepts So deciding would decide . The case is similar.
Corollary. The following are undecidable: “Does accept at least one string?”, “Is Finite?”, “Is regular?”, “Is context-free?”
Cross-References
Section titled “Cross-References”Turing Machines: Turing machine formalism and computability.
Theory of Computation Flashcards: Interactive flashcards covering complexity classes.
Algorithms: Algorithm design and complexity theory.
Common Mistakes
Section titled “Common Mistakes”Reversing the direction of a many-one reduction. To prove is undecidable, you need where is known to be undecidable. This means “if is decidable, then is decidable” (contrapositive: undecidable implies undecidable). Reversing it to gives “if is decidable, then is decidable,” which tells you nothing about when is undecidable.
Assuming all undecidable problems are “the same.” Undecidable problems have different degrees of unsolvability. The halting problem is Turing-complete, but there are problems that are not even Turing-recognisable (e.g., the complement of the halting problem). Reductions establish relative difficulty but not absolute equivalence.
Confusing recognisability with decidability for co-RE languages. A language is decidable iff both and its complement are recognisable. The halting problem is recognisable but its complement is not, so it is not decidable. Knowing only that is recognisable tells you nothing about .
Using Rice’s theorem incorrectly. Rice’s theorem applies to non-trivial properties of the language recognised by a TM, not properties of the TM itself. “Does this TM have 5 states?” is not a property of the language and is therefore decidable. “Does this TM accept a regular language?” is a property of the language and is undecidable by Rice’s theorem.
Assuming oracles resolve undecidability. An oracle for the halting problem lets a TM decide the halting problem, but it cannot decide the halting problem relative to itself (the Turing jump). Oracles create a strict hierarchy — each level of oracle makes some problems decidable but introduces new undecidable problems at a higher level.