A.2 Computational Models and Complexity classes
A.2.3 Non-Uniform Polynomial-Time
A stronger model of efficient computation is that of non-uniform polynomial- time. This model will be used only in the negative way; namely, for saying that even such machines cannot do something.
Anon-uniform polynomial-time “machine”is a pair (M, a), whereM is a two-input polynomial-time machine anda=a1, a2, ...is an infinite sequence of strings such that|an|= poly(n). For everyx, we consider the computation of machine M on the input pair (x, a|x|). Intuitively, an may be thought as an extra “advice” supplied from the “outside” (together with the input
x∈ {0,1}n). We stress that machineM gets the same advice (i.e.,a
n) on all inputs of the same length (i.e.,n). Intuitively, the advice an may be useful in some cases (i.e., for some computations on inputs of lengthn), but it is unlikely to encode enough information to be useful for all 2n possible inputs. Another way of looking at non-uniform polynomial-time “machines” is to consider an infinite sequence of machines, M1, M2, ... so that both the length of the description ofMn and its running time on inputs of length n are bounded by polynomial inn(fixed for the entire sequence). MachineMn is used only on inputs of lengthn. Note the correspondence between the two ways of looking at non-uniform polynomial-time. The pair (M,(a1, a2, ...)) of the first definition gives rise to an infinite sequence of machinesMa1, Ma2, ..., whereMa|x|(x)
def
= M(x, a|x|). On the other hand, a sequenceM1, M2, ...(as in the second definition) gives rise to the pair (U,(hM1i,hM2i, ...)), whereU is a universal Turing machine andhMni is the description of machine Mn (i.e.,U(x,hM|x|i) =M|x|(x)).
In the first sentence of the current subsection, non-uniform polynomial- time has been referred to as a stronger model than probabilistic polynomial- time. This statement is valid in many contexts (e.g., language recognition as in Theorem 1 below). In particular it will be valid in all contexts we discuss in this book. So we have the following informal “meta-theorem”
Meta-Theorem: Whatever can be achieved by probabilistic polynomial- time machines can be achieved by non-uniform polynomial-time “machines”. The Meta-Theorem is clearly wrong if one thinks of the task of tossing coins... So the meta-theorem should not be understood literally. It is merely an indication of real theorems that can be proven in reasonable cases. Let’s consider the context of language recognition.
Definition A.6 (P/poly):The complexity classnon-uniform polynomial-time, denotedP/poly, is the class of languagesLwhich can be recognized by “non- uniform polynomial-time machines”. Namely, L∈ P/poly if there exists an infinite sequence of machinesM1, M2, ... satisfying
1. There exists a polynomialp(·)such that, for everyn, the description of machine Mn has length bounded above byp(n).
A.2. COMPUTATIONAL MODELS AND COMPLEXITY CLASSES 121
2. There exists a polynomial q(·)such that, for everyn, the running time of machine Mn on each input of lengthn is bounded above byq(n). 3. For every n and everyx∈ {0,1}n, machine M
n accepts x if and only ifx∈L.
Note that the non-uniformity is implicit in the lack of a requirement concern- ing the construction of the machines in the sequence. It is only required that these machines exist. In contrast, if one augments Definition A.6 by requiring the existence of a polynomial-time algorithm that on input 1n (npresented in unary) outputs the description ofMn then one gets a cumbersome way of definingP. On the other hand, it is obvious thatP ⊆ P/poly (in fact strict containment can be proven by considering non-recursive unary languages). Furthermore,
Theorem A.7 BPP ⊆ P/poly.
Proof:LetM be a probabilistic machine recognizingL∈ BPP. LetξL(x)def= 1 ifx∈LandξL(x) = 0 otherwise. Then, for everyx∈ {0,1}∗,
Pr[M(x) =ξL(x)]≥2 3
Assume, without loss of generality, that on each input of lengthn, machine
M uses the same number, m = poly(n), of coin tosses. Let x ∈ {0,1}n. Clearly, we can find for eachx∈ {0,1}na sequence of coin tossesr∈ {0,1}m such thatMr(x) =ξL(x) (in fact most sequencesrhave this property). But can one sequencer∈ {0,1}m fit all x
∈ {0,1}n? Probably not (provide an example!). Nevertheless, we can find a sequencer ∈ {0,1}n which fits 2
3 of all thex’s of length n. This is done by a counting argument (which asserts that if 2
3 of ther’s are good for eachxthen there is an r which is good for at least 2
3 of thex’s). However, this does not give us anrwhich is good for allx∈ {0,1}n. To get such anrwe have to apply the above argument on a machineM′ with exponentially vanishing error probability. Such a machine is guaranteed by the alternative formulation ofBPP(given above). Namely, for everyx∈ {0,1}∗,
Pr[M′(x) =ξL(x)]>1−2−|x|
Applying the argument now we conclude that there exists an r ∈ {0,1}m, denotedrn, which is good formore thana 1−2−nfraction of thex∈ {0,1}n. It follows thatrnis good for all the 2ninputs of lengthn. MachineM′(viewed as a deterministic two-input machine) together with the infinite sequence
Finally, let us mention a more convenient (and standard) way of viewing non-uniform polynomial-time. This is via (non-uniform) families of polynomial- size Boolean circuits. ABoolean circuit is a directed acyclic graph with in- ternal nodes marked by elements in{∧,∨,¬}. Nodes with no in-going edges are called input nodes, and nodes with no outgoing edges are called output nodes. A node marked ¬may have only one in-going edge. Computation in the circuit begins by placing input bits on the input nodes (one bit per node) and proceeds as follows. If the children of a node (of in-degreed) marked∧ have valuesv1, v2, ..., vd then the node gets the value Vdi=1vi. Similarly for nodes marked∨ and ¬. The output of the circuit is read from its output nodes. The size of a circuit is the number of its edges. A polynomial-size circuit familyis an infinite sequence of Boolean circuits,C1, C2, ...such that, for everyn, the circuitCn hasn input nodes and sizep(n), wherep(·) is a polynomial (fixed for the entire family). Clearly, the computation of a Tur- ing machine M on inputs of length n can be simulated by a single circuit (with n input nodes) having size O((|hMi|+n+t(n))2), where t(n) is a bound on the running time ofM on inputs of lengthn. Thus, a non-uniform sequence of polynomial-time machines can be simulated by a non-uniform family of polynomial-size circuits. The converse is also true, since machines with polynomial description length can incorporate polynomial-size circuits and simulate their computations in polynomial-time. The thing which is nice about the circuit formulation is that there is no need to repeat the poly- nomiality requirement twice (once for size and once for time) as in the two formulations above.