Descriptive Complexity: a Logician's Approach to Computation
Total Page:16
File Type:pdf, Size:1020Kb
Descriptive Complexity a Logicians Approach to Computation Neil Immerman Computer Science Dept University of Massachusetts Amherst MA immermancsumassedu App eared in Notices of the American Mathematical Society A basic issue in computer science is the complexity of problems If one is doing a calculation once on a mediumsized input the simplest algorithm may b e the b est metho d to use even if it is not the fastest However when one has a subproblem that will havetobesolved millions of times optimization is imp ortant A fundamental issue in theoretical computer science is the computational complexity of problems Howmuch time and howmuch memory space is needed to solve a particular problem Here are a few examples of such problems Reachability Given a directed graph and two sp ecied p oints s t determine if there is a path from s to t A simple lineartime algorithm marks s and then continues to mark every vertex at the head of an edge whose tail is marked When no more vertices can b e marked t is reachable from s i it has b een marked Mintriangulation Given a p olygon in the plane and a length L determine if there is a triangulation of the p olygon of total length less than or equal to L Even though there are exp onentially many p ossible triangulations a dynamic programming algorithm can nd an optimal one in O n steps ThreeColorability Given an undirected graph determine whether its vertices can b e colored using three colors with no two adjacentvertices having the same color Again there are exp onentially many p ossibilities but in this case no known algorithm is faster than exp onential time Research supp orted in part by NSF grant CCR Computational complexity measures howmuch time andor memory space is needed as a function of the input size Let TIMEtn b e the set of problems that can b e solved by algorithms that p erform at most O tn steps for inputs of size n The complexity class Polynomial Time P is the set of problems that are solvable in time at most some p olynomial in n k P TIME n k Even though the class TIMEtn is sensitive to the exact machine mo del used in the computations the class P is quite robust The problems Reachability and Min triangulation are elements of P Some imp ortant computational problems app ear to require more than p olynomial time An interesting class of such problems is contained in nondeterministic p oly nomial time NP A nondeterministic computation is one that maymake arbitrary choices as it works If anyofthesechoices lead to an accept state then wesaythe input is accepted As an example let us consider the threecolorability problem A nondeterministic algorithm traverses the input graph arbitrarily assigning to each vertex a color red yellow or blue Then it checks whether each edge joins vertices of dierent colors If so it accepts A nondeterministic computation can b e mo deled as a tree whose ro ot is the starting conguration Every choice forms a branching no de The computation accepts if any of the leaves is an accepting conguration The nondeterministic time of this com putation is the length of the path from ro ot to accepting leaf not the exp onentially larger size of the tree of all p ossible choices Continuing the example given a graph G with v vertices the nondeterministic three v colorability algorithm denes a computation tree that has branches one for each p ossible coloring of the vertices Each such branch ends in an accepting leaf if and only if the corresp onding coloring is a valid three coloring It follows that there exists an accepting leaf just if G is threecolorable Thus threecolorabilitycanbe checked in nondeterministic O n time where n is the number of vertices plus edges ThreecolorabilityisinNP The threecolorability problem as well as hundreds of other wellknown combinatorial problems are NP complete See for a survey of many of these This means that not only are they in NP but they are the hardest problems in NP all problems in NP are reducible to each NPcomplete problem A reduction from problem A to problem B is a p olynomialtime mapping from anyinputtoA to an input to B that has the same answer It follows that if A is reducible to B and B is in P then A is in P At present the fastest known algorithm for any of these problems is exp onential An ecient algorithm for any one of these problems would translate to an ecient algorithm for all of them The P NP question is an example of our inability to determine what can or cannot b e computed in a certain amount of computational resource time space parallel time etc The only truly eectivetoolthatwe currently have for this is Cantors diagonalization argument This is very useful for proving hierarchy theorems ie that more of a given computational resource enables us to compute more TIMEn TIMEn NTIMEn NTIMEn SPACEn SPACEn However there are no known techniques for comparing dierenttyp es of resources eg time versus nondeterministic time times versus space etc These notions of complexitymight not seem fundamental but rather tied to the sort of machine that the algorithm will b e p erformed on On the contrary the notions of time space parallel time and even nondeterministic time are fundamental and have many equivalent formulations One such formulation whichIwillnow describ e involves no machines at all but relies instead on classic notions from mathematical logic Complexitytheorytypically considers yesno problems this is the examination of the diculty of computing a particular bit of the desired output Yesno problems are prop erties of the input the set of all inputs to which the answer is yes have the prop erty in question Rather than asking the complexityofchecking if a certain input has a prop erty T in Descriptive Complexitywe ask how hard is it to express the prop erty T in a formal language It is plausible that prop erties that are harder to check might b e harder to express What is surprising is how closely mathemat ics mimics the physical world when we use rstorder logic descriptive complexity exactly captures the imp ortant complexity classes In Descriptive Complexitywe view inputs as nite logical structures eg a binary string w w w w is co ded as jw j w A hf jw jgS i w consisting of a universe U f jw jg of the bit p ositions in the string the w w th monadic relation S dened so that S i holds i the i bit of w is one and is the usual total ordering on U G A graph is a logical structure A hf vgE i whose universe is the set G G of vertices and E is the binary edge relation A graph problem is a set of nite structures whose vo cabulary consists of a single binary relation Similarlywemay think of any problem T in some complexity class C as a set of structures of some xed vo cabulary Recall that in rstorder logic we can quantify over the universe Wecansayfor example that a string ends in a one The following sentence do es this by asserting the existence of a string p osition x that is the last p osition and asserting S x ie the bit at that p osition is a one xy y x S x As another example wecansay that there are exactly two edges leaving every vertex xyz w y z E x y E x z E x w w y w z For any structure Awe use the notation Aj to mean that is true in A In secondorder logic we also havevariables X that range over relations over the i universe These variables may b e quantied A secondorder existential formula SO b egins with second order existential quan tiers and is followed by a rstorder formula As an example the following second order existential sentence says that the graph in question is threecolorable It do es this by asserting that there are three unary relations Red R Yellow Y and Blue B dened on the universe of vertices It go es on to saythatevery vertex has some color and no two adjacentvertices have the same color h R Y B x R x Y x B x y E x y i R x R y Y x Y y B x B y Descriptive Complexity b egan with the following theorem of Ronald Fagin Fagins theorem says that NP is equal to the set of problems describable in secondorder existential logic ObservethatFagins Theorem characterizes the complexity class NP purely by logic with no mention of machines or time Theorem A set of structures T is in NP i there exists a secondorder exis tential formula such that T fA j A jg To capture complexity classes P and b elow rstorder logic is more appropriate Since rstorder logic is weaker than secondorder it is natural to let formulas grow with the size of inputs For example one can ask How long a rstorder formula is needed to express graph connectivity A graph G is connected i G jxy P x y whereP x y means that there is a path from x to y We are interested in paths of length less than G n jV j Firstorder formulas of size O log n are b oth necessary and sucientto express connectivity In order to characterize complexity classes as in Fagins theorem but via rstorder logics one must lo ok at the co ding of inputs A graph or other structure is given to a computer in some order eg vertices v v v Furthermore algorithms mayuse n the ordering eg searching through eachvertex in turn Tosimulate the machine the logical languages need access to the ordering This was also necessary for Fagins theorem but in SO wemay existentially quantify a total ordering on the universe From now on we will assume that all rstorder languages include a binary relation symbol denoting a total ordering on the universe With this proviso wecan relate computational complexity to rstorder descriptive complexity Let FOSIZEsn b e the set of prop erties expressible by uniform sequences