
4.4 NP Sets That Are Neither in P nor NP-Complete 129
either S or S
= S ∩ F ). Recall that if i + 1 is even, then we need to fail a
standard machine (which attempts to decide S
), and otherwise we need to fail
an oracle machine (which attempts to reduce S to S
). Thus, for even i + 1
we need to determine whether x is in S
= S ∩ F , whereas for odd i + 1we
need to determine whether x is in S as well as whether some other strings
(which appear as queries) are in S
. Deciding membership in S ∈ NP can be
done in exponential time (by using the exhaustive search algorithm that tries all
possible NP-witnesses). Indeed, this means that when computing f (n)wemay
only complete the treatment of inputs that are of logarithmic (in n) length, but
anyhow in n
3
steps we cannot hope to reach (in our lexicographic scanning)
strings of length greater than 3 log
2
n. As for deciding membership in F ,this
requires an ability to compute f on adequate integers. That is, we may need
to compute the value of f (n
) for various integers n
, but as noted, n
will be
much smaller than n (since n
≤ poly(|x|) ≤ poly(log n)). Thus, the value of
f (n
) is just computed recursively (while counting the recursive steps in our
total number of steps).
22
The point is that when considering an input x,wemay
need the values of f only on {1,...,p
i+1
(|x|)}, where p
i+1
is the polynomial
bounding the running time of the i + 1
st
(modified) machine, and obtaining
such a value takes at most p
i+1
(|x|)
3
steps. We conclude that the number of
steps performed toward determining whether or not a failure (of the i + 1
st
machine) occurs on the input x is upper-bounded by an (exponential) function
of |x|.
As hinted in the foregoing paragraph, the procedure will complete n
3
steps
well before examining inputs of length greater than 3 log
2
n, but this does not
matter. What matters is that f is unbounded (see Exercise 4.25). Furthermore,
by construction, f (n) is computed in poly(n)-time.
Comment. The proof of Theorem 4.12 actually establishes that for every
decidable set S ∈ P, there exists S
∈ P such that S
is Karp-reducible to S but
S is not Cook-reducible to S
.
23
Thus, if P = NP then there exists an infinite
sequence of sets S
1
,S
2
,... in NP \ P such that S
i+1
is Karp-reducible to S
i
but S
i
is not Cook-reducible to S
i+1
. Furthermore, S
1
may be NP-complete.
That is, there exists an infinite sequence of problems (albeit unnatural ones),
all in NP, such that each problem is “easier” than the previous ones (in the
sense that it can be reduced to any of the previous problems while none of these
problems can be reduced to it).
22
We do not bother to present a more efficient implementation of this process. That is, we may
afford to recompute f (n
) every time we need it (rather than store it for later use).
23
The said Karp-reduction (of S
to S)mapsx to itself if x ∈ F and otherwise maps x to a fixed
no-instance of S.