Sub topic 13
The Post Correspondence Problem
Assume you know finite automata, context-free grammars, Turing machines, and proof by contradiction. You should also be comfortable with the idea of a reduction: transforming one problem into another so that solving the second would solve the first.
The problem statement
A Post Correspondence Problem (PCP) instance is a finite list of dominoes. Each domino has a string on top and another string below it.
For example:
| Domino | Top | Bottom |
|---|---|---|
| 1 | `a` | `ab` |
| 2 | `ba` | `a` |
You may use a domino any number of times, in any order. The question is whether some nonempty sequence makes the concatenated top string equal the concatenated bottom string.
For the instance above, choose dominoes 1, 2:
- Top:
afollowed byba, givingaba - Bottom:
abfollowed bya, givingaba
Therefore, this instance has a solution.
The order and repetition matter. Choosing dominoes 2, 1 produces different strings, and using a domino more than once is allowed.
Checking a proposed solution
A proposed sequence is easy to verify. Concatenate the selected top strings and bottom strings, then compare the results.
tiles = [("a", "ab"), ("ba", "a")]
choice = [0, 1]
top = "".join(tiles[i][0] for i in choice)
bottom = "".join(tiles[i][1] for i in choice)
print(top)
print(bottom)
print(top == bottom)The output is:
aba
aba
TrueThe difficulty is deciding that no solution exists. Searching sequences of length 1, 2, 3, and so on can continue forever when the instance has no solution.
Why PCP is undecidable
PCP is undecidable. No algorithm accepts every PCP instance and always answers correctly whether a matching sequence exists.
The standard proof reduces the acceptance problem for Turing machines to PCP. Given a machine and an input, construct dominoes whose matching sequences encode valid computation histories:
- The first part represents the initial configuration.
- Later parts represent successive configurations.
- Matching top and bottom strings forces each configuration to follow legally from the previous one.
- A special ending arrangement is possible exactly when the machine enters its accepting state.
If a general PCP decider existed, we could use it to decide whether any Turing machine accepts its input. That contradicts the undecidability of the acceptance problem.
Decidability classification
PCP is recognizable, also called recursively enumerable. Enumerate every finite domino sequence and test it. If a solution exists, the search eventually finds one.
However, PCP is not decidable because a search may run forever when no solution exists.
| Question | Classification |
|---|---|
| Does a proposed sequence solve the instance? | Decidable |
| Does some sequence solve the instance? | Recognizable but undecidable |
| Does no sequence solve the instance? | Not recognizable in general |
Exercise
Why does enumerating all finite domino sequences recognize PCP but fail to decide it?
Show answer
It eventually finds a matching sequence when one exists. If no matching sequence exists, the enumeration never has a reason to halt and reject.