Descriptive Complexity: a Logicians Approach to Computation
Total Page:16
File Type:pdf, Size:1020Kb
Descriptive Complexity: A Logician’s Approach to Computation N. Immerman basic issue in computer science is there are exponentially many possibilities, the complexity of problems. If one is but in this case no known algorithm is faster doing a calculation once on a than exponential time. medium-sized input, the simplest al- Computational complexity measures how gorithm may be the best method to much time and/or memory space is needed as Ause, even if it is not the fastest. However, when a function of the input size. Let TIME[t(n)] be the one has a subproblem that will have to be solved set of problems that can be solved by algorithms millions of times, optimization is important. A that perform at most O(t(n)) steps for inputs of fundamental issue in theoretical computer sci- size n. The complexity class polynomial time (P) ence is the computational complexity of prob- is the set of problems that are solvable in time lems. How much time and how much memory at most some polynomial in n. space is needed to solve a particular problem? ∞ Here are a few examples of such problems: P= TIME[nk] 1. Reachability: Given a directed graph and k[=1 two specified points s,t, determine if there Even though the class TIME[t(n)] is sensitive is a path from s to t. A simple, linear-time to the exact machine model used in the com- algorithm marks s and then continues to putations, the class P is quite robust. The prob- mark every vertex at the head of an edge lems Reachability and Min-triangulation are el- whose tail is marked. When no more vertices ements of P. can be marked, t is reachable from s iff it Some important computational problems ap- has been marked. pear to require more than polynomial time. An 2. Min-triangulation: Given a polygon in the interesting class of such problems is contained plane and a length L, determine if there is in nondeterministic polynomial time (NP). A a triangulation of the polygon of total length nondeterministic computation is one that may less than or equal to L. Even though there make arbitrary choices as it works. If any of are exponentially many possible triangula- these choices leads to an accept state, then we tions, a dynamic programming algorithm say the input is accepted. As an example, let us can find an optimal one in O(n3) steps. consider the three-colorability problem. A non- 3. Three-Colorability: Given an undirected deterministic algorithm traverses the input graph, determine whether its vertices can be graph, arbitrarily assigning to each vertex a colored using three colors with no two ad- color: red, yellow, or blue. Then it checks whether jacent vertices having the same color. Again each edge joins vertices of different colors. If so, N. Immerman is professor in the Department of Com- it accepts. puter Science, University of Massachusetts at Amherst. A nondeterministic computation can be mod- His e-mail address is [email protected]. eled as a tree whose root is the starting config- OCTOBER 1995 NOTICES OF THE AMS 1127 uration. Every choice forms a branching node. Complexity theory typically considers yes/no The computation accepts if any of the leaves is problems: this is the examination of the difficulty an accepting configuration. The nondeterministic of computing a particular bit of the desired out- time of this computation is the length of the path put. Yes/no problems are properties of the input: from root to accepting leaf, not the exponentially the set of all inputs to which the answer is yes larger size of the tree of all possible choices. have the property in question. Rather than ask- Continuing the example, given a graph G with ing the complexity of checking if a certain input v vertices, the nondeterministic three-col- has a property T, in descriptive complexity we orability algorithm defines a computation tree ask how hard it is to express the property T in that has 3v branches, one for each possible col- a formal language. It is plausible that properties oring of the vertices. Each such branch ends in that are harder to check might be harder to ex- an accepting leaf if and only if the correspond- press. What is surprising is how closely math- ing coloring is a valid three coloring. It follows ematics mimics the physical world: when we that there exists an accepting leaf just if G is use first-order logic, descriptive complexity ex- three-colorable. Thus, three-colorability can be actly captures the important complexity classes. checked in nondeterministic O(n) time—where In descriptive complexity we view inputs as n is the number of vertices plus edges. Three- finite logical structures, e.g., a binary string colorability is in NP. w = w1w2 . w w is coded as The three-colorability problem as well as hun- | | w dreds of other well-known combinatorial prob- w = 1, 2, . , w , S , A h{ | |} ≤i lems are NP complete. (See [8] for a survey of consisting of a universe U = 1, 2, . , w of many of these.) This means that not only are they { | |} in NP, but they are the “hardest problems” in NP: the bit positions in the string, the monadic re- w w th all problems in NP are reducible to each NP- lation S defined so that S (i) holds iff the i bit of w is one, and , the usual total ordering complete problem. (A reduction from problem ≤ A to problem B is a polynomial-time mapping on U. from any input to A to an input to B that has A graph is a logical structure G the same answer. It follows that if A is reducible G = 1,2,... ,v ,E whose universe is the A h{ } i G to B and B is in P, then A is in P.) At present, set of vertices and where E is the binary edge the fastest known algorithm for any of these relation. A graph problem is a set of finite struc- problems is exponential. An efficient algorithm tures whose vocabulary consists of a single bi- for any one of these problems would translate nary relation. Similarly, we may think of any problem T in some complexity class as a set to an efficient algorithm for all of them. C The P= NP question is an example of our in- of structures of some fixed vocabulary. ability to determine what can or cannot be com- Recall that in first-order logic we can quan- puted in a certain amount of computational re- tify over the universe. We can say, for example, source: time, space, parallel time, etc. The only that a string ends in a one. The following sen- truly effective tool that we currently have for this tence does this by asserting the existence of a is Cantor’s diagonalization argument. This is string position x that is the last position and by very useful for proving hierarchy theorems, i.e., asserting S(x), i.e., the bit at that position is a that more of a given computational resource en- one: ables us to compute more. ( x)( y)(y x S(x)) ∃ ∀ ≤ ∧ " 2 " 2 TIME[n] TIME[n ]; NTIME[n] NTIME[n ]; As another example we can say that there are SPACE[n] " SPACE[n2] exactly two edges leaving every vertex: However, there are no known techniques for ( x)( yz)( w)(y = z E(x, y) E(x, z) comparing different types of resources, e.g., ∀ ∃ ∀ 6 ∧ ∧ (E(x, w) w = y w = z)) time versus nondeterministic time, time versus ∧ → ∨ space, etc. For any structure , we use the notation = ϕ These notions of complexity might not seem to mean that ϕ isA true in . A | fundamental, but rather tied to the sort of ma- In second-order logic weA also have variables chine that the algorithm will be performed on. Xi that range over relations over the universe. On the contrary, the notions of time, space, par- These variables may be quantified. allel time, and even nondeterministic time are A second-order existential formula (SO ) be- fundamental and have many equivalent formu- gins with second-order existential quantifiers∃ lations. One such formulation which I will now and is followed by a first-order formula. As an describe involves no machines at all but relies example, the following second-order existential instead on classic notions from mathematical sentence 3 says that the graph in question is logic. three-colorable. It does this by asserting that Ψ 1128 NOTICES OF THE AMS VOLUME 42, NUMBER 10 there are three unary relations—Red (R), Yellow clude a binary relation symbol “ ” denoting a (Y), and Blue (B)—defined on the universe of ver- total ordering on the universe. With≤ this proviso, tices. It goes on to say that every vertex has we can relate computational complexity to first- some color and no two adjacent vertices have the order descriptive complexity. same color. Let FO-SIZE[s(n)] be the set of properties ex- pressible by uniform sequences of first-order for- 3 ( R)( Y )( B)( x) th ≡ ∃ ∃ ∃ ∀ mulas ϕi i Z+ such that the n formula has [(R(x) Y (x) B(x)) ( y) (E(x, y) O(s(n)){symbols} ∈ and expresses the property in Ψ ∨ ∨ ∧ ∀ → (R(x) R(y)) (Y (x) Y (y)) question for structures of size n. (Uniform means ¬ ∧ ∧ ¬ ∧ that the map n ϕn has very low complexity, (B(x) B(y)))] 7→ ∧ ¬ ∧ e.g., SPACE[log n]. Later we will see that purely syntactic uniformity condi- Descriptive complexity tions suffice.) began with the following the- The following theorem orem of Ronald Fagin.