<<

A Stroll Through the Zoo

An overview of the most important complexity classes other than P and NP

Rod Hilton

December 15, 2012

1 Introduction We will see what these classes are, what kinds of languages belong to them, how they relate Even Science students very early in to other classes, what questions related to them their careers are familiar with the “big three” remain unanswered, what the most recent ad- complexity classes of P, NP, and NP-. vancements related to them are, or any other These three classes are closely related to the particularly interesting facts about the class. In biggest open questions in Computer Science, doing, it is the goal to provide an overview with the question of P =? NP being one of Clay suitable for undergraduate or graduate students Mathematics Institute’s Millennium Prize Prob- wishing to start a journey deeper into Complex- lems. ity Theory. While these three classes are the subject of much ongoing research, the of complexity 2 DTIME and NTIME classes is much larger than many students know. 1 The Complexity Zoo - an online catalog of such A language in DTIME(f(n)) must be recognized classes maintained by MIT faculty member Scott by some deterministic that, Joel Aaronson - currently houses 495 different given an input size n, can recognize elements in complexity classes. the language within O(f(n)) time. Many refer In this work, we will take a high-level tour of to this class simply as TIME. some of the most important classes which are The class DTIME, because it can be parame- not P, NP, or NP-COMPLETE. We will mostly terized, allows us to refer to more narrowly de- focus on complexity classes that measure time fined time-complexity classes if they lack well- complexity, and will largely ignore classes that understood names. For example, we can define deal with in the interest of sav- a for languages that can be rec- 2 ing space . We will also focus only on decision ognized by a Turing machine in constant time, problems rather than optimization problems or such as even binary integers, by referring counting problems. to DTIME(1). DTIME(logn) is common enough that it is often referred to as DLOGTIME. 1http://complexity-zoo.net/zoo/wiki/ Complexity_Zoo The class P can be defined in terms of DTIME, 2Ha! as P = S DTIME(nk). The class EXPTIME k∈N

1 can be similarly defined, as EXPTIME = S choose between two possible moves, and it flips k∈N DTIME(2nk ). This often expressed more simply a fair coin to decide which path to take. k as EXPTIME = DTIME(2n ) A language is in PP iff there exists a ran- Closely related to this class is the Time domized Turing machine that runs in Hierarchy Theorem, which states that time and decides membership in the language the DTIME(f(n)) must be strictly contained in majority of the time. Such a machine can be in- 3 DTIME((f(2n + 1)) ). This theorem is used by correct with a probability so long as e < 1/2. Hartmanis and Stearns [1965] to show that P is Another way of thinking about PP is to con- a proper of EXPTIME. sider the set of languages that can be recognized Similarly, NTIME(f(n)) is a complexity class by a nondeterministic Turing machine in poly- for languages that can be recognized by a non- nomial time where more than half of the compu- deterministic Turing machine within O(f(n)) tation paths accept. time. As before, NP = S NTIME(nk) and k∈N PP has somewhat limited usefulness because, NEXPTIME = NTIME(2nk ). in order to be confident in an answer from the has its a stronger hierarchy theorem NTIME machine, one would have to -run the ma- shown in Seiferas et al. [1978], that with func- chine on the same input multiple times until tions f and g and f(n + 1) = o(g), f(n) NTIME( ) the desired probability of correctness is achieved. is a strict subset of g(n) . NTIME( ) Imagine that a nondeterministic Turing machine [Papadimitriou, 1994] shows P = NP, that recognizes a language has a million pos- then EXPTIME = NEXPTIME, as well as if sible computation paths, and 500,001 of them EXPTIME 6= NEXPTIME, it would prove that accept correctly. This meets the definition re- P 6= NP. It is generally accepted, however, that quired for PP, but it’s extremely difficult to de- proving this would be even more difficult than termine, based on the decisions of the machine proving P 6= NP in the first place [Papadim- alone, which half is the ‘error’ half. A good way itriou, 1994]. This is true as we ascend a hi- to conceptualize this is to imagine being given a erarchy of exponential time classes. 2-NEXP = k coin that has one slightly heavier side than the nk 2n NTIME(22 ), 3-NEXP = NTIME(22 ), and so other, and your task is to determine which. on, but if x-EXP were ever shown to not equal, Determining which half has the slight bias x-NEXP, the inequality would apply all the way requires an exponential number of experiments back down to EXPTIME 6= NEXPTIME and fi- [Papadimitriou, 1994], so it’s somewhat more nally P 6= NP [Papadimitriou, 1994]. useful to have a class in which the probability Some problems in EXPTIME include a modi- of error is more restrictive. BPP is just such a fied version of the (does a ma- class. chine halt within k steps), or evaluating a posi- A language is in BPP iff there exists some tion in Chess, Checkers, or Go. randomized Turing machine that runs in poly- nomial time and decides membership correctly 3 PP and BPP with probability 3/4. The name BPP stands for Bounded-error Probabilistic Polynomial. In There are a handful of classes that are defined us- other words, rather than deciding by a mere ma- ing randomized Turing machines. A randomized jority, the Turing machine will decide by a “clear Turing machine is one that has to periodically majority” [Papadimitriou, 1994].

2 It actually doesn’t matter what probability is time (unless P = NP). It is not currently known chosen for BPP as long as it is strictly greater if BPP ⊂ NP or NP ⊂ BPP [Rich, 2008]. than 1/2 and less than 1; any other probability within this range would still result in the same class. Imagine we were talking about any prob- 4 RP, CO-RP, and ZPP ability in this range 1 + . The machine can be 2 PP and BPP both have tolerances for false neg- made to decide on set membership 2k + 1 times, atives as well as false positives. These are re- thus making the probability of a false answer ferred to as having “two-sided” error. However, e−22k. The probability can be made as small it is possible to build machines that have “one- as we wish by running the machine a polynomial sided” errors - meaning they can have errors in number of times, so the probability itself isn’t only one direction - which define RP and CO-RP. critical, but often 3/4 is used (we can reduce our ln 2 A language is in RP if there is a randomized error to 1/4 by letting k = d e). e2 Turing machine, similar to the ones used to de- Since all of these probabilities for BPP are fine PP and BPP, that runs in polynomial time greater than 1/2, it’s clear that BPP ⊆ PP. Fur- and accepts inputs with probability > 1/2/, but thermore, since a clear majority is required in rejects with a probability of 1. In other words, both the cases where the Turing machine cor- when the input is not in the language, the ma- rectly accepts as well as where it correctly re- chine will always reject. When it is, the machine jects, BPP is closed under (BPP = will be right more often than not. It can incor- CO-BPP). Since P is just BPP with an error rate rectly reject, but it will never incorrectly accept. of 0, P ⊆ BPP. CO-RP is the opposite, it can incorrectly - What is not yet known is whether BPP ⊆ P cept but it will never incorrectly reject. If an and thus if BPP = P. For many years, the go- input is in the language in RP, the machine will to example of a language in BPP that was not always accept, and if it is not it will reject with known to be in P was determining whether a a probability greater than 1/2. number was prime. One can test for primality in A language in CO-RP that has not yet been a probabilistic way using the Miller-Rabin pri- shown to be in P is that of Polynomial Identity mality test or the Solovay-Strassen test, both of Testing, the set of arithmetic expressions is iden- which can be run as many times as needed to tical to the zero-polynomial. achieve a particular desired confidence in the an- Finally, there is ZPP, proposed by Gill [1977]. swer, showing PRIMES to clearly be in BPP. For a language to be in ZPP, a randomized Tur- However, in 2002, Agrawal et al. [2004] showed ing machine must exist that decides “Yes”, “No”, that PRIMES is in P, reducing the number of or “Don’t Know”; it must always return either problems known to be in BPP that are not also the correct answer or “Don’t Know” (it can never in P. It is not yet known if P = BPP, though it is be wrong), and it must return “Don’t Know” strongly suspected to be the case as the number with a probability less than 1/2. ZPP is often of problems known to be in BPP but not known defined as RP ∩ CO-RP. to be in P has been decreasing. P ⊆ ZPP but it is still an open problem if If P = BPP, it would mean that random- ZPP = P. We know P ⊆ ZPP and ZPP ⊆ RP ⊆ ized Turing machines cannot make it possible NP and ZPP ⊆ CO-RP ⊆ CO-NP [Rich, 2008]. to solve NP-COMPLETE problems in polynomial An NP-COMPLETE problem being found in RP

3 would impliy that NP = RP which is, though of generality because the sequence of coin-flips theoretically possible, considered very unlikely is independent of the computation itself, so it [Moret, 1998]. In other words, RP is likely not can be done ahead of time. Now, imagine that the magic bullet for solving extremely hard prob- Arthur sends his sequence of coin-flips to Merlin lems. before Merlin gives his answer. This modified Interestingly, despite the fact that the cor- protocol, the Arthur-Merlin (notice the reversed responding question for nondeterminism (P = order) describes the class AM. In fact, you can NP∩ CO-NP), we know that ZPP = RP∩ CO-RP have k rounds of interaction between Arthur and [Arora, 2009]. Merlin to describe AM[k]

5 MA and AM Babai [1988] showed that, for any k, AM[k] = AM. Obviously, MA ⊆ AM because Arthur can get a response from Merlin, flip all of his coins, Two interesting complexity classes make use of send again, and ignore Merlin’s response. It re- an ‘Merlin-Arthur’ protocol. Imagine two play- mains an open question whether AM = MA. ers of a game, Arthur (a normal person) and Merlin (a powerful wizard). Given an instance of some problem, Merlin has unlimited compu- An example of a problem in AM is graph non- tational power at his disposal, but cannot be isomorphism, determining if two graphs G1 and trusted to be telling the truth. In other words, G2 can not have their nodes reordered such that Merlin is an Oracle that can lie. Because he can they are identical. This problem is not known lie, Arthur must verify whatever Merlin tells him, to be in NP, but Merlin could convince Arthur but he has the power of a BPP machine. In an that it is so. Imagine Arthur has two graphs G1 Merlin-Arthur protocol, Merlin provides a poly- and G2. He reorders one of these graphs, let’s nomial proof that the answer to a problem is say G1, at random, to get H, then sends H to ‘yes’, and Arthur must verify it. If the answer Merlin, who must respond by declaring whether really is ‘yes’, Arthur must accept with a proba- G1 or G2 was the graph that was reshuffled into bility of more than 2/3, and if ‘no’ he must reject H. If the two graphs are isomorphic, Merlin has with a probability of more than 1/3. no way of knowing which one was shuffled into Another way of thinking about the Merlin- H, so his guesses will be random. However, if Arthur protocol is by considering it as a more the two graphs are actually isomorphic, Merlin random version of NP, where the oracle can lie will have the same answer no matter how many and the machine using it must be probabilisti- times the protocol is repeated. Thus, if Mer- cally certain of its answer. As such, NP ⊆ MA. lin answers consistently after a sufficient number Arthur can ignore Merlin and solve the problem of repetitions, Arthur can be confident that the using his BPP machine, so BPP ⊆ MA. Further, graphs are not isomorphic. Vereschchagin [1992] shows that MA ⊆ PP. MA can be made more powerful by modifying These classes both have related classes, the protocol a bit. Imagine that Arthur were to MAEXP and AMEXP, which modify the classes so pre-flip all of the coins he would need to in order that Arthur can run in exponential time rather to determine his computation path through his than polynomial, and messages between the par- BPP machine. This can be done without loss ticipants can be exponentially long.

4 6 P/POLY ter. What matters is what we define k to be in the language, such as “k is prime”. Every lan- P/POLY is defined as set of languages which can guage can be mapped to a set of numbers, which be decided by Turing machines in polynomial means every language A has a unary version of time, when given “ strings”. An advice it (1k|k ∈ A). There’s also a complexity class for string is a string of input whose lengths are poly- all of these kinds of languages, TALLY. nomial of the machine input, but whose contents UHALT is the unary version of the halting do not depend on the input itself, and can be problem, which is fair since every language has chosen however needed to help the de- a unary version. Define UHALT = {1n|n’s bi- cide. The reason this advice string is polynomi- nary expansion encodes a pair hM, xi such that ally bounded is that, if it wasn’t, any language M halts on x}. P/POLY is non-uniform, which could be decided simply by giving as an advice means the circuit it uses can be chosen in any string a gigantic exponentially-sized lookup table way as long as it’s the same for every length. So of answers. we can choose a circuit for each n by treating n Another way P/POLY is often defined is as as the circuit length. If n ∈ HALT , then the a class of languages that can be decided by circuit will be true for an input w iff w is all 1’s polynomial-size circuits, which can be imagined of length n. Since this can be implemented by as graphs with n inputs and one output, where a circuit polynomial to size n, this is fair to do, each node represents a boolean operation, and and thus P/POLY contains UHALT. This is an in- whose number of nodes is a polynomial of n. credibly surprising fact, the key to understand- If NP 6⊂ P/POLY, then P 6= NP [Karp and ing it is to realize that we can pull the circuit Lipton, 1980]. For many years, attempts were out of a magic hat that gives us whatever circuit made to prove P 6= NP by proving that NP 6⊂ we want as long as it varies only with the input P/POLY but so far there has been no success. length [Arora, 2009]. If NP ⊆ P/POLY, then MA = AM. Furthermore, if EXPTIME ⊆ P/POLY, then EXPTIME = AM and if NEXPTIME ⊆ P/POLY, 7 NC and AC then EXPTIME = NEXPTIME = MA. P/POLY has many cryptographic uses, with the Similar to P/POLY, there are a number of other security of an encyption scheme being analyzed classes that deal with . For d by treating the adversaries as P/POLY instances. any d, NC is the set of languages that can be Since BPP ⊆ P/POLY, doing this allows cryptol- decided by a family of circuits Cn where Cn is a d ogists to assume adversaries have access to the polynomial of n and is no deeper than O(log n). 3 d very practical BPP, as well as access to mas- The class NC is the union of all such NC ’s for sive (but bounded) precomputed data, such as all integers d. d rainbow tables (a huge table for reversing 1-way The class AC is similar, with AC defined the i hashes). same as NC except that the OR and AND gates P/POLY is particularly interesting because it can have more than 2 bits (the fan-in) as input. d can decide some languages that are undecidable. AC is, of course, the union of all AC ’s. To see this, we must first define a unary lan- Because fan-in on an AND or OR gate that k guage, which is any language in the form f 3NC stands for Nick’s Class, named after Nick Pip- where f is some fixed symbol that doesn’t mat- penger by Stephen Cook

5 is polynomial of n can be simulated by a tree the tape and the read-write device are not re- of depth O(logn), the interesting property arises stricted to values of only 0 and 1, but can also that, for any i, NCi ⊆ ACi ⊆ NCi+1. Further- be in a superposition of 0 and 1 and everything in more, since for any i, NCi ⊆ ACi, it follows that between. So while a regular Turing machine can NC = AC. only make one calculation at a time, a quantum AC0 is the smallest of the AC classes, it’s the Turing machine can make many calculations all family of circuits that can only have a depth of at once. O(1), but an unlimited fan-in on the gates. AC0 There is also the class QMA, which is the is a very limited class, and it was shown by Furst quantum analogue of NP or MA. It’s the set et al. [1984] that the class cannot decide PAR- of languages for which, when an element is in ITY, the language of binary integers with an odd the language, there is a polynomial-size quan- number of 1’s. However, NC1 does contain this tum proof that can convince a verifier (Arthur) language, by building circuits resembling binary that this is the case with a high probability (as trees which compute the parity of their respec- well as when an element is not in the language). tive halves recursively. The depth of such a tree P ⊆ BPP ⊆ BQP ⊆ PP and P ⊆ NP ⊆ MA ⊆ would be O(logn). QMA ⊆ PP. BQP is generally considered the NC is generally used to characterize languages class of feasible problems on quantum comput- which have very efficient parallel , be- ers, like P and BPP, while QMA is generally cuase the work of the circuits can be split and considered probably infeasible. Scott Aaronson done independently, as in the PARITY example. has argued (but not proved) that BQP does not In the same way that problems are P are consid- contain NP, which is to say, quantum ered tractable for computers, problems in NC cannot be used to solve NP-COMPLETE problems. are considered tractable for parallel computers [Homer and Selman, 2011]. It contains problems 9 PH of integer addition, multiplication, division, ma- trix multiplication and inversing, and many more Let’s define three new classes, all equal to P. P = problems which are considered highly paralleliz- ∆0P = Σ0P = Π0P . Each of these classes will able. be used as oracles in a new set of classes, adding It is not yet known if P = NC, in other words, power to the class. So ∆1P = P with a Σ0P if any highly parallelizable problem can be solved oracle, Σ1P = NP with a Σ0P oracle, and Π1P = in polynomial time without parallelization. It CO-NP with a Σ0P oracle. The first level of this is generally suspected that the answer to this hierarchy is another way to refer to the more question is negative [Arora, 2009]. familiar complexity classes, as ∆1P = P,Σ1P = NP, and Π1P = CO-NP More generally: ∆ P = P with a Σ P oracle 8 BQP and QMA • i i−1 • ΣiP = NP with a Σi−1P oracle

The class BQP is the set of languages recogniz- • ΠiP = CO-NP with a Σi−1P oracle able by a , with at most 1/3 chance of error. It is, effectively, the quan- If we take the union of all of these classes, for tum version of BPP. A quantum Turing machine all i, the resulting class is PH, the Polynomial- works like a regular Turing machine, except that Time Hierarchy class.

6 Schaefer and Umans [2002] has a massive list, solutions would lead directly to solving the white updated regularly (latest update in 2008), of dif- whale of Complexity Theory, P =? NP. ferent problems and which particular class in- Scott Aaronson, keeper of the Complexity side of PH they belong. For example, MIN- Zoo, published a post on his blog a few years MAX CLIQUE is in Π2P , while CLIQUE COL- ago entitled “Eight Signs A Claimed P 6= NP 4 ORING is in Σ2P . The problem of MINIMUM Proof Is Wrong” . In the post, Dr. Aaronson CIRCUIT, which determines if a implores readers not to dismiss a proof based on can be represented by an equivalent circuit with the author’s credentials or background, but to fewer gates, is Π2P . challenge the proofs when they fail to address Toda [1989] shows that PH ⊆ eight specific points. Nearly all eight of these P with a PP oracle . If P = NP then the points involve an author not explaining how his entire PH hierarchy collapses to P.Σ2P or her proof interplays with various complexity contains AM. classes and languages. The third, for example, Without proof that P 6= NP, Papadimitriou states: [1994] argues that it is impossible to show that each level of the hierarchy properly contains the The paper doesn’t prove any weaker next. We know that PH ⊆ PSPACE, but it is an results along the way: for example, open question if PH = PSPACE. If it were the P 6= PSPACE, NEXP 6⊂ P/POLY ... P case that PH = PSPACE, then once again the vs. NP is a staggeringly hard prob- entire PH hierarchy would collapse [Hemaspaan- lem, which one should think of as being dra and Ogihara, 2001]. dozens of steps beyond anything that we know how to prove today.

10 Remarks Given how important these varied complexity classes may prove to be in the process of chipping We’ve looked at many complexity classes away at the P =? NP question, it’s certainly ben- 0 here, including AC , AC, AM, BPP, BQP, eficial to study and understand them, and The DLOGTIME, DTIME, EXPTIME, MA, NC, Complexity Zoo is an indispensable resource. NEXPTIME, NTIME, P/POLY, PH, PP, PSPACE, RP, QMA, TALLY, ZPP, CO-BPP, CO-NP, CO-RP, and of course P, NP, and References NP-COMPLETE. Still, that’s only 26 classes, M. Agrawal, N. Kayal, and N. Saxena. Primes is leaving over 450 more classes in the Complexity in p. Annals of mathematics, pages 781–793, Zoo that haven’t even been mentioned. Many of 2004. these classes are small tweaks and variations on those covered, but Complexity Theory is still an S. Arora. : a modern immense field. approach. Cambridge University Press, Cam- These many classes often share tight relation- bridge New York, 2009. ISBN 9780521424264. ships with other classes, with a single equivalence . Babai. Arthur-merlin games: A randomized or containment proof kicking off a series of col- proof system and a hierarchy of complexity lapsing hierarchies or equalities. And of course, many of these classes have open problems whose 4http://www.scottaaronson.com/blog/?p=458

7 classes. J. Comput. Syst. Sci., 36:254–276, J. Seiferas, M. Fischer, and A. Meyer. Separat- 1988. ing nondeterministic classes. Journal of the ACM (JACM), 25(1):146–167, M. Furst, J. Saxe, and M. Sipser. Parity, circuits, 1978. and the polynomial-time hierarchy. Theory of Computing Systems, 17(1):13–27, 1984. S. Toda. On the computational power of and p. In Foundations of Computer Science, 1989., J. Gill. Computational complexity of probabilis- 30th Annual Symposium on, pages 514–519. tic turing machines. SIAM Journal on Com- IEEE, 1989. puting, 6(4):675–695, 1977. N. Vereschchagin. On the power of pp. In Struc- J. Hartmanis and . Stearns. On the computa- ture in Complexity Theory Conference, 1992., tional complexity of algorithms. Transactions Proceedings of the Seventh Annual, pages 138– of the American Mathematical Society, pages 143. IEEE, 1992. 285–306, 1965.

L. Hemaspaandra and M. Ogihara. The complex- ity theory companion. Springer, 2001.

S. Homer and A. Selman. and complexity theory. Springer, New York, 2011. ISBN 9781461406815.

R. Karp and R. Lipton. Some connections between nonuniform and uniform complex- ity classes. In Proceedings of the twelfth an- nual ACM symposium on Theory of comput- ing, pages 302–309. ACM, 1980.

B. Moret. The theory of computation. Addison- Wesley, Reading, Mass, 1998. ISBN 9780201258288.

C. Papadimitriou. Computational complexity. Addison-Wesley, Reading, Mass, 1994. ISBN 9780201530827.

E. Rich. Automata, computability and complexity : theory and applications. Pearson Prentice Hall, Upper Saddle River, N.J, 2008. ISBN 9780132288064.

M. Schaefer and C. Umans. Completeness in the polynomial-time hierarchy: A compendium. SIGACT news, 33(3):32–49, 2002.

8