COMS W3261 CS Theory
Lecture 17: Post's Correspondence Problem
1. Complements of Ld and Lu
- The diagonal language Ld is not recursively enumerable.
- The universal language Lu is recursively enumerable but not
recursive.
- The complement of the diagonal language is recursively enumerable but
not recursive.
- The complement of the universal language is not recursively enumerable.
- Note that if the complement of a recursively enumerable language L
is recursively enumerable, then L and its complement are both recursive.
2. Post's Correspondence Problem (PCP)
- We now prove a string-oriented problem called Post's Correspondence Problem
is undecidable. We will use PCP to show various important
problems about context-free grammars are undecidable.
- An instance of Post's correspondence problem consists of two
lists of strings over some alphabet where the two lists have the same
number of strings.
Let A =
(w1, w2, …, wk) and
B =
(x1, x2, …, xk)
be the two lists.
- A solution to this instance of PCP, if one exists, is a sequence of one or more integers
i1, i2, …, im
such that
wi1
wi2 …
wim
= xi1
xi2 …
xim.
An integer index can be repeated many times in a solution.
- Example: Consider the instance of PCP with A =
(a, b, ca, abc)
and B = (ab, ca, a, c).
The sequence 1, 2, 3, 1, 4 is a solution because the same string
abcaaabc is obtained by concatenating the corresponding strings
from either list
A [(a)(b)(ca)(a)(abc)] or
list B [(ab)(ca)(a)(ab)(c)].
- Post's correspondence problem is to determine whether
an instance has a solution.
- We will show that Post’s correspondence problem is undecidable by reducing
the universal language
to PCP.
- We will then show that the ambiguity problem for CFG’s is undecidable by reducing PCP to
the ambiguity problem for CFG’s.
3. Modified PCP
- The Modified PCP has the additional requirement that the
first string from list A and the first string from list B
has to be the first string in the solution. The example above
has this property.
- Formally, a solution to an instance of the MPCP is a sequence
of zero or more integers
i1, i2, …, im
such that
w1wi1
wi2 … wim
= x1xi1
xi2 …
xim.
- We can show that the modified PCP problem can be reduced to the PCP
problem as follows:
- We are given an instance of MPCP with lists
A =
(w1, w2, …, wk) and
B =
(x1, x2, …, xk).
- Assume * and $ are new symbols.
- From (A, B) we construct a PCP instance (C, D) with
C =
(y0, y1, …, yk+1) and
D =
(z0, z1, …, zk+1)
where
- yi is wi with a * after each
symbol in wi, for i = 1, 2, ..., k.
- zi is xi with a * before each
symbol in xi, for i = 1, 2, ..., k.
- y0 = *y1 and yk+1 = $.
- z0 = z1 and zk+1 = *$.
- We can show
i1, i2, …, im
is a solution to the given (A,B)-MPCP instance iff
0, i1, i2, …,
im, ik+1
is a solution to this constructed (C, D)-PCP instance.
4. Reducing the Universal Language to MPCP
- We can show that given (M, w), an instance of Lu,
we can reduce this instance of Lu to an instance (A, B)
of the MPCP such that M accepts
w iff (A, B) has a solution.
We do this by showing that (A, B)
simulates the computation of M on w.
See Section 9.4.3 of HMU, pp. 407-412, for details.
- This shows that both the MPCP and the PCP problems are undecidable.
5. Undecidability of the Ambiguity Problem for CFG's
- We can reduce an instance of the PCP problem to an instance of
determining whether a CFG is ambiguous, thereby showing it is
undecidable to determine whether a CFG is ambiguous.
- We will illustrate the reduction with the following example.
Let (A, B) be an instance of the PCP problem with
A = (a, b, ca, abc)
and B = (ab, ca, a, c).
Let G be the CFG with the productions
S → A | B
A → aA1 | bA2 | caA3 | abcA4 | a1| b2 | ca3 | abc4
B → abB1 | caB2 | aB3 | cB4 | ab1 | ca2 | a3 | c4
There are two distinct leftmost derivations for the string
abcaaabc41321
because this instance of the
PCP problem has a solution.
6. Practice Problems
- Does the following instance of PCP have a solution:
A = (ab, aab, ba) and
B = (abb, ba, aa)?
- Does the following instance of PCP have a solution:
A = (ab, b, aba, aa) and
B = (abab, a, b, a)?
- Does the following instance of PCP have a solution:
A = (ab, baa, aba) and
B = (aba, aa, baa)?
- Is PCP on lists over a single-symbol alphabet decidable?
- Show that the PCP problem can be formulated as a language recognition problem.
7. Reading
aho@cs.columbia.edu
verma@cs.columbia.edu