Computer Science Theory

Lecture 15: November 12, 2012

The Universal Language and

Post's Correspondence Problem

- The universal language is RE but not recursive
- Reductions
- Post's correspondence problem
- Undecidability of the ambiguity problem for CFG's

- L
_{u}, 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, - L
_{u}= { (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: L
_{u}is recursively enumerable. - Proof:
- We can construct a Turing machine U, called the
universal Turing machine, to recognize L
_{u}. - 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).
- L
_{u}= L(U). - Theorem: L
_{u}is not recursive. - Proof:
- Suppose L
_{u}were recursive. Then there exists a TM M that accepts the complement of L_{u}. - Then we can transform M into a TM M' that accepts L
_{d}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 M
_{i}and the second w is an encoding of a binary string w_{i}. Since M accepts the complement of L_{u}, it will accept (w,w) iff M_{i}does not accept w_{i}. - Thus, M' accepts w iff w is in L
_{d}. But we have previously shown there does not exist a TM that defines L_{d}. - We conclude L
_{u}is not recursive.

- 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.

- 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 = (w
_{1}, w_{2}, ... , w_{k}) and B = (x_{1}, x_{2}, ... , x_{k}) be the two lists. - A solution to this instance of PCP, if one exists, is a sequence of one or more integers
*i*_{1},*i*_{2}, ... ,*i*_{m}such that w_{i1}w_{i2}... w_{im}= x_{i1}x_{i2}... x_{im}. - 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.

- 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
*i*_{1},*i*_{2}, ... ,*i*_{m}such that w_{1}w_{i1}w_{i2}... w_{im}= x_{1}x_{i1}x_{i2}... x_{im}. - 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 = (w
_{1}, w_{2}, ... , w_{k}) and B = (x_{1}, x_{2}, ... , x_{k}). - Assume * and $ are new symbols.
- From (A, B) we construct a PCP instance (C, D) with

C = (y_{0}, y_{1}, ... , y_{k+1}) and D = (z_{0}, z_{1}, ... , z_{k+1}) where- y
_{i}is w_{i}with a * after each symbol in w_{i}, for*i*= 1, 2, ...,*k*. - z
_{i}is x_{i}with a * before each symbol in x_{i}, for*i*= 1, 2, ...,*k*. - y
_{0}= *y_{1}and y_{k+1}= $. - z
_{0}= z_{1}and z_{k+1}= *$.

- y
- We can show
*i*_{1},*i*_{2}, ... ,*i*_{m}is a solution to the given (A,B)-MPCP instance iff 0,*i*_{1},*i*_{2}, ... ,*i*_{m},*i*_{k+1}is a solution to this constructed (C,D)-PCP instance. - We can show that given (M, w), an instance of L
_{u}, we can reduce this instance of L_{u}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.

- 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
```

`abcaaabc41321`

because this instance of the
PCP problem has a solution.- 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.

- HMU: Sections 9.2-9.6

aho@cs.columbia.edu