Computer Science Theory

Lecture 16: November 14, 2012

Undecidable Problems and Rice's Theorem

- PCP is undecidable
- Rice's theorem
- Other undecidable problems
- Big-O notation
- The classes P and NP

- Post's correspondence problem (PCP)
- An instance of Post's correspondence problem consists of two
equal-length lists of strings over some alphabet:
A = (w
_{1}, w_{2}, ... , w_{k}) and B = (x_{1}, x_{2}, ... , x_{k}). - A solution to an instance of PCP 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}. - Modified Post's correspondence problem (MPCP)
- MPCP is PCP with the additional requirement that the first string from the first list and the first string from the second list has to be the first string in the solution.
- 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 reduce the MPCP problem to the PCP problem.
- We can reduce L
_{u}to MPCP. - Let M be a Turing machine and w an input string.
- From M and w we can construct an instance (A, B) of the MPCP such that M accepts w iff (A, B) has a solution.
- We do this by showing that the solution to (A, B) simulates the computation of M on w. See HMU, Sect. 9.4.3 for details.
- Thus, MPCP and PCP are undecidable.

- A
*property*of the recursively enumerable languages is a set of recursively enumerable languages. - For example, the property of being context free is the set of all CFL's.
- A property is trivial if it is either empty or it is all recursively enumerable languages.
- Rice's Theorem: Every nontrivial property of the recursively enumerable languages is undecidable.
- Proof:
- Let P be a nontrivial property of the recursively enumerable languages.
- Let L
_{P}be the set of TMs M_{i}such that L(M_{i}) is a language in P. - Case 1: Assume ∅ is not in P.
- Let L be a nonempty language in P and let M
_{L}be a TM for L. - We can reduce L
_{u}to L_{P}as follows: - The reduction takes as input a pair (M, w) and produces as output a TM M' such that L(M') is empty if w is not in L(M) and L(M') = L if w is in L(M).
- M' takes as input a string x.
- First, M' simulates M on w.
- If w is not in L(M), then M' accepts no input strings. This implies M' is not
in L
_{P}. - If w is in L(M), then M' simulates M
_{L}on x. In this case, M' will accept the language L. Since L is in P, the code for M' is in L_{P}. - Case 2: ∅ is in P.
- In this case, consider the property complement(P), the set of recursively enumerable languages that do not have property P.
- From the argument above, we see that complement(P) is undecidable.
- Note that complement(L
_{P}), the set of TMs that do not accept a language in P is the same as L_{complement(P)}, the set of TMs that accept a language in complement(P). - However, if L
_{P}were decidable, then L_{complement(P)}would also be decidable since that complement of a recursive language is recursive. - Thus, in this case as well, L
_{P}cannot be decidable. - From Rice's theorem we can conclude the following problems are undecidable:
- Is the language accepted by a TM empty?
- Is the language accepted by a TM finite?
- Is the language accepted by a TM regular?
- Is the language accepted by a TM context free?

- Define L
_{ne}to be { M | L(M) ≠ ∅ }. - L
_{ne}is recursively enumerable but not recursive. - Define L
_{e}to be { M | L(M) = ∅ }. - We have just observed that L
_{ne}is not recursive. If L_{e}were recursively enumerable, both it and L_{ne}would be recursive because L_{e}and L_{ne}are complements of each other. - Therefore, L
_{e}cannot be recursively enumerable.

- We say that T(
*n*) is O(*f*(*n*)) [read "big-oh of*f*(*n*)] if there exists an integer*n*_{0}and a constant*c*> 0 such that for all integers*n*≥*n*_{0}, we have T(*n*) ≤*cf*(*n*). - Big-oh notation allows us to ignore constant factors.
E.g., T(
*n*) = 2*n*^{2}is O(*n*^{2}). - Big-oh notation allows us to ignore low-order terms.
E.g., T(
*n*) = 2*n*^{2}+ 3*n*+ 4 is O(*n*^{2}).

- A Turing machine M is of time complexity T(
*n*) if on any input of length*n*, M halts after making at most T(*n*) moves. - P is the set of languages
*L*such that*L*= L(M) for some deterministic Turing machine M of time complexity T(*n*) where T(*n*) is a polynomial. - NP is the set of languages
*L*such that*L*= L(M) for some nondeterministic Turing machine M where on any input of length*n*, there are no sequences of more than T(*n*) moves of M where T(*n*) is a polynomial. - The question of whether P = NP is one of the most important open problems in computer science and mathematics.
- A polynomial-time reduction is an algorithm that maps any instance I of problem A into an instance J of problem B in a number of steps that is a polynomial function of the length of I such that I is in A iff J is in B.
- A language
*L*is NP-complete if *L*is in NP and- For every language
*L*' in NP there is a polynomial-time reduction of*L*' to*L*. - A language satisfying condition (2) is said to be NP-hard.
- If A is NP-complete, B is in NP, and there is a polynomial-time reduction of A to B, then B is NP-complete.
- If any one NP-complete problem is in P, then P = NP.
- Examples of problems in P
- Determining whether a set of integers has a subset whose sum is negative.
- Finding the cheapest path between a pair of nodes in a graph.
- Lots of others.
- Examples of NP-complete problems
- Determining whether a set of integers has a nonempty subset whose sum is zero ("subset sum").
- Finding the cheapest cycle in a graph that contains each node exactly once ("the traveling salesman problem").
- Lots of others.
- Examples of problems in NP not known to be in P or to be NP-complete
- Determining whether two graphs are isomorphic.
- Not that many others.
- A problem is said to be
*intractable*if it cannot be solved in polynomial time.

- Show that it is undecidable whether the language generated by one context-free grammar is contained within the language generated by another context-free grammar.
- Show that it is undecidable whether the language accepted by a TM is infinite.
- Give an example of a language
*L*such that both*L*and the complement of*L*are not recursively enumerable.

- HMU: Ch. 9, Sect. 10.1

aho@cs.columbia.edu