
CUUS063 main CUUS063 Goldreich 978 0 521 88473 0 March 31, 2008 18:49
P, NP, AND NP-COMPLETENESS
Note that this mapping can be computed in polynomial time, and that x ∈ S if and
only if f (x) =M
R
, x, 1
t
R
(|x |+p
R
(|x |))
∈S
u
. Details follow.
First, note that the mapping f does depend (of course) on S, and so it may depend
on the fixed objects M
R
, p
R
, and T
R
(which depend on S). Thus, computing f on
input x calls for printing the fixed string M
R
, copying x, and printing a number of 1’s
that is a fixed polynomial in the length of x. Hence, f is polynomial-time computable.
Second, recall that x ∈ S if and only if there exists y such that |y|≤p
R
(|x|) and
(x, y) ∈ R. Since M
R
accepts (x, y) ∈ R within t
R
(|x|+|y|) steps, it follows that
x ∈ S if and only if there exists y such that |y|≤p
R
(|x|) and M
R
accepts (x, y)
within t
R
(|x|+|y|) steps. It follows that x ∈ S if and only if f (x) ∈ S
u
.
We now turn to the search version. For reducing the search problem of any
R ∈ PC to the search problem of R
u
, we use essentially the same reduction. On
input an instance x (for R), we make the query M
R
, x, 1
t
R
(|x |+p
R
(|x |))
to the search
problem of R
u
and return whatever the latter returns. Note that if x ∈ S then the
answer will be “no solution,” whereas for every x and y it holds that (x, y) ∈
R if and only if (M
R
, x, 1
t
R
(|x |+p
R
(|x |))
, y) ∈ R
u
. Thus, a Levin-reduction of R
to R
u
consists of the pair of functions ( f, g), where f is the foregoing Karp-
reduction and g(x, y) = y. Note that indeed, for every ( f (x), y) ∈ R
u
, it holds that
(x, g(x, y)) = (x, y) ∈ R.
Advanced comment. Note that the role of 1
t
in the definition of R
u
is to allow placing R
u
in PC. In contrast, consider the relation R
u
that consists of pairs (M, x, t, y) such that
M accepts xy within t steps. Indeed, the difference is that in R
u
the time bound t appears
in unary notation, whereas in R
u
it appears in binary. Then, as will become obvious in
§4.2.1.2, membership in R
u
cannot be decided in polynomial-time. Going even fur ther,
we note that omitting t altogether from the problem instance yields a search problem
that is not solvable at all. That is, consider the relation R
H
def
={(M, x, y):M(xy) = 1}
(which is related to the halting problem). Indeed, the search problem of any relation
(and in particular of any relation in PC) is Karp-reducible to the search problem of R
H
,
but the latter is not solvable at all (i.e., there exists no algorithm that halts on every
input and on input
x =M, x outputs y such that (x, y) ∈ R
H
if and only if such a
y exists).
Bounded Halting and Non-halting
We note that the problem shown to be NP-complete in the proof of Theorem 2.19 is
related to the following two problems, called
Bounded Halting and Bounded Non-
halting
. Fixing any programming language, the instance to each of these problems
consists of a program π and a time bound t (presented in unary). The decision version of
Bounded Halting (resp., Bounded Non-halting) consists of determining whether
or not there exists an input (of length at most t) on which the program π halts in t steps
(resp., does not halt in t steps), whereas the search problem consists of finding such an
input.
The decision version of
Bounded Non-halting refers to a fundamental computa-
tional problem in the area of program verification; specifically, the problem of determining
whether a given program halts within a given time bound on all inputs of a given length.
9
9
The length parameter need not equal the time bound. Indeed, a more general version of the problem refers to two
bounds, and t, and to whether the given program halts within t steps on each possible -bit input. It is easy to prove
70