COMS W3261
Computer Science Theory
Lecture 15: November 12, 2012
The Universal Language and
Post's Correspondence Problem
Outline
- The universal language is RE but not recursive
- Reductions
- Post's correspondence problem
- Undecidability of the ambiguity problem for CFG's
1. The Universal Language is RE but not Recursive
- Lu, the universal language, is the set of binary strings
that encode a pair (M, w) consisting of a Turing machine
and an input string accepted by that Turing machine.
That is,
- Lu = { (M, w) |
M is an encoding of a Turing machine, w is an
encoding of a binary string,
and w is in L(M) }.
- Theorem: Lu is recursively enumerable.
- Proof:
- We can construct a Turing machine U, called the
universal Turing machine, to recognize Lu.
- It is easiest to think of U as a multitape TM.
- One tape holds the input with the encodings of M and w.
- A second tape is used to simulate M's input tape.
- A third tape is used to keep track of M's state.
- A fourth tape is used as a scratch tape.
- To simulate a move of M, U searches for a transition on
the current state of M (stored on tape 3) and the current
state tape symbol of M (stored at the position on tape 2
scanned by U.
- U changes the contents of tape 3 to record the new state.
- U changes the tape symbol under M's simulated tape head on
tape 2.
- U moves M's tape head left or right on tape 2.
- If M enters its final state, U accepts the original input (M, w).
- Lu = L(U).
- Theorem: Lu is not recursive.
- Proof:
- Suppose Lu were recursive. Then there exists a TM M
that accepts the complement of Lu.
- Then we can transform M into a TM M' that accepts Ld as follows:
- M' transforms its input string w into a pair (w,w).
- M' simulates M on (w,w) assuming the first w is an encoding of a
TM Mi and the second w is an encoding of a
binary string wi.
Since M accepts the complement of
Lu, it will accept (w,w) iff Mi
does not accept wi.
- Thus, M' accepts w iff w is in Ld. But we have
previously shown there does not exist a TM that defines Ld.
- We conclude Lu is not recursive.
2. Reductions
- A reduction is the conversion of one problem A to another B in such
a way that a solution to B can be used to solve A.
- The reduction should turn positive instances of A into positive
instances of B and negative instances of A into negative instances of B.
- Formally, a reduction from A to B is a Turing machine that takes an
instance of A written on its tape and halts with an instance of B
on its tape.
- We say a function f: Σ* → Σ* is a computable function
if there is a TM M such that given w on the input tape, M makes a sequence
of moves and halts with f(w) on the input tape.
- A language A is mapping reducible to language B if there is a
computable function f such that for every w in Σ*, w is in A
iff f(w) is in B. The function f is called a reduction of A to B.
- If we can reduce an undecidable problem A to problem B,
then we can conclude that problem B is also undecidable.
- If we can show the complement of a problem A is undecidable,
then A itself is undecidable.
- If we can reduce an non-RE problem A to problem B,
then we can conclude that problem B is also non-RE.
3. Post's Correspondence Problem
- 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.
- Example: Let 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.
4. 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.
- 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.
- We will thus show 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
- If we can reduce a problem A to a decidable problem B,
can we conclude A is decidable?
- If we can reduce a decidable problem A to a problem B,
can we conclude B is decidable?
- If we can reduce a problem A to an undecidable problem B,
can we conclude problem A is undecidable?
- If we can reduce an undecidable problem A to a problem B,
can we conclude problem B is undecidable?
- Does the following instance of PCP have a solution:
A = (ab, b, aba, aa) and B = (abab, a, b, a)?
- Show that the equivalence problem for CFG's is undecidable.
7. Reading Assignment
aho@cs.columbia.edu