Decidability
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
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
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
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?”
:::caution Common Pitfall Rice’s theorem applies only to properties of the language Not properties of the machine itself. For example, “Does halt within 100 steps on input ?” is a property Of ‘s behaviour, not of And is in fact decidable (just simulate for 100 steps).
5.5 Post Correspondence Problem
Definition. An instance of the Post Correspondence Problem (PCP) consists of two lists of Strings and over some Alphabet . A solution is a non-empty sequence of indices such That:
The PCP language is .
Example. , . The sequence gives and — not equal. The sequence gives and — not equal. This instance may or may not have a solution; determining this is undecidable .
Worked Example: A solvable PCP instance
, .
Try the sequence :
- Top:
- Bottom:
Not equal.
Try :
- Top:
- Bottom:
Not equal. Finding solutions to PCP instances can be very difficult — there is no general algorithm.
Theorem 5.6. PCP is undecidable.
Proof (sketch). Reduce from . Given TM and input Construct a PCP instance Whose tiles encode the computation history of on . The tiles are designed so that a matching Sequence corresponds to a valid accepting computation: the first tile starts the computation, middle Tiles enforce that each configuration follows from the previous by a valid transition, and the last Tile allows termination only if an accept state is reached. Thus the PCP instance has a solution iff accepts . The construction is computable, so if PCP were decidable, would Be decidable — contradiction.
Modified PCP (MPCP). In the modified version, the first tile used must be tile 1. MPCP is also Undecidable, and the reduction from PCP to MPCP adds a “prefix” tile that forces tile 1 to be used First.
5.6 Oracle Machines and the Arithmetical Hierarchy
An oracle machine is a Turing machine with access to an oracle for a language . In addition to its ordinary transitions, may enter a special “query state,” write a string on a query tape, and enter an “answer state” where the tape Contains 1 if and 0 if . The oracle answers in one step.
Definition. for a fixed oracle TM and oracle .
Theorem 5.7. There exists an oracle such that And an oracle such That .
This result (Baker—Gill—Solovay, 1975) shows that resolving will require Non-relativising techniques — …/1-number-and-algebra/3_proof-and-logic methods that do not carry over in the presence of oracles.
The Turing jump. Given a language Define the halting problem relative to :
A' = \{\langle M^A, w \rangle : M^A \mathrm{ accepts w\}
Theorem 5.8. (i.e., is strictly more difficult than under Turing Reductions).
The arithmetical hierarchy is defined by iterating the jump: . Each jump produces a strictly more difficult problem, Yielding an infinite hierarchy of undecidability.
::: :::caution Common Pitfall A common mistake when using reductions is confusing the direction. To prove is undecidable Using a reduction from a known undecidable problem You need Not . Remember: if and is undecidable, then is undecidable (contrapositive of “if is decidable then is decidable”). Reversing the direction gives a valid implication (“if and is undecidable, then…”) that tells us nothing about .
:::