COMS W3261
Computer Science Theory
Lecture 16: November 14, 2012
Undecidable Problems and Rice's Theorem
Outline
- PCP is undecidable
- Rice's theorem
- Other undecidable problems
- Big-O notation
- The classes P and NP
1. Post's Correspondence Problem is Undecidable
- Post's correspondence problem (PCP)
- An instance of Post's correspondence problem consists of two
equal-length lists of strings over some alphabet:
A = (w1, w2, ... , wk) and
B = (x1, x2, ... , xk).
- A solution to an instance of PCP is a sequence of one or more integers
i1, i2, ... , im
such that
wi1
wi2 ... wim
= xi1
xi2 ...
xim.
- 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
i1, i2, ... , im
such that
w1wi1
wi2 ... wim
= x1xi1
xi2 ...
xim.
- We can reduce the MPCP problem to the PCP problem.
- We can reduce Lu 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.
2. Rice's Theorem
- 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 LP be the set of TMs Mi such that L(Mi)
is a language in P.
- Case 1: Assume ∅ is not in P.
- Let L be a nonempty language in P and let ML be a TM for L.
- We can reduce Lu to LP 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 LP.
- If w is in L(M), then M' simulates ML on x. In this case, M' will accept
the language L. Since L is in P, the code for M' is in LP.
- 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(LP), the set of TMs that do not accept a language
in P is the same as Lcomplement(P), the set of TMs that accept a
language in complement(P).
- However, if LP were decidable, then Lcomplement(P) would also
be decidable since that complement of a recursive language is recursive.
- Thus, in this case as well, LP 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?
3. Other Undecidable Problems
- Define Lne to be { M | L(M) ≠ ∅ }.
- Lne is recursively enumerable but not recursive.
- Define Le to be { M | L(M) = ∅ }.
- We have just observed that Lne is not recursive. If Le were
recursively enumerable, both it and Lne would be recursive
because Le and Lne are complements of each other.
- Therefore, Le cannot be recursively enumerable.
4. Big-O Notation
- We say that T(n) is O(f(n)) [read "big-oh of f(n)]
if there exists an integer
n0 and a constant c > 0 such that for all
integers n ≥ n0, we have
T(n) ≤ cf(n).
- Big-oh notation allows us to ignore constant factors.
E.g., T(n) = 2n2 is O(n2).
- Big-oh notation allows us to ignore low-order terms.
E.g., T(n) = 2n2 + 3n + 4 is O(n2).
5. The Classes P and NP
- 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.
6. Practice Problems
- 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.
7. Reading Assignment
aho@cs.columbia.edu