Homework 9 Solutions 349
size, there is a constant d and an encoding of circuits B
n
as strings
b
n
∈{0, 1}
n
d
such that a Turing machine, given b
n
and x ∈{0, 1}
n
,can
compute B
n
(x) in polynomial time.
Now we save the string b
n
in the oracle as the characteristic function
of strings of length n.Thatis,forn so large that n
d
≤ 2
n
, we put
the ith string of length n in C iff the ith bit of b
n
is 1. Thus B
n
can
be determined by querying C on at most n
d
strings of length n.For
the finitely many values of n for which n
d
> 2
n
, the circuit B
n
is just
encoded in the finite control of M.
Because |b
n
|≤n
d
, the oracle is sparse. The machine M
C
on input
x ∈{0, 1}
n
first queries C on the first n
d
strings of length n to determine
B
n
, then computes B
n
(x) and accepts if the value is 1.
For the other direction, suppose we are given a polynomial-time oracle
machine M
C
with sparse oracle C, |C ∩{0, 1}
n
|≤n
d
, accepting a set A.
We wish to construct (nonuniform) polynomial-size circuits B
0
,B
1
,...
equivalent to M
C
. We must somehow encode the oracle information
in the circuits. We do this in two steps. First we show that for each
n there exists a string y
n
of length polynomial in n encoding all the
oracle information needed by M on inputs of length n. The string y
n
is essentially a list of all elements in C up to the maximum length that
could be queried by M on inputs of length n. Because these strings are
of polynomial length in n and C is sparse, the string y
n
is of polynomial
length. More accurately, let n
k
be the time bound of M . On inputs of
length n, M can only query the oracle on strings of length at most n
k
,
because it must write them down. As C is n
d
-sparse, there are at most
|C ∩{0, 1}
≤n
k
| =
n
k
m=0
|C ∩{0, 1}
m
|≤
n
k
m=0
m
d
≤ n
k(d+1)
nonzero elements of C in the range that could possibly be queried by
M on an input of length n, and all of them are of length at most n
k
,
so they can be written down end-to-end separated by 2’s in a string
z
n
∈{0, 1, 2}
∗
of length at most O(n
k(d+2)
). Now convert the ternary
string z
n
to binary to get y
n
.Then
|y
n
|≤log
2
3 ·|z
n
| = O(n
k(d+2)
).
The binary string y
n
contains all the oracle information necessary to
process input strings of length n. That is, there is a deterministic
polynomial-time TM N such that for any string x of length n, M
C
accepts x iff N accepts x#y
n
.ThemachineN first converts y
n
to z
n
,