Logic and Complexity without Order

0 downloads 0 Views 297KB Size Report
2. We measure the complexity of describing the collection as opposed to the .... follows that the two logics IFP and LFP are equivalent on finite structures.
Logic and Complexity without Order Anuj Dawar Department of Computer Science University of Wales Swansea Swansea, SA2 8PP, U.K. e-mail: [email protected]

1 Introduction Descriptive Complexity can be thought of as di ering from the more common view of computational complexity (i.e. measuring resource bounds on a machine) in two important respects: 1. We measure the complexity of a collection of structures as opposed to a collection of strings. This can be seen as a generalisation, in that strings are a special case. It is also a useful generalisation in that the problems we are concerned with (graph problems, for instance) are naturally thought of as classes of structures, and must be encoded into strings in order to t the mould of machine computations. 2. We measure the complexity of describing the collection as opposed to the complexity of computing it. So, the resources that are measured are logical resources (number and kind of quanti er, number of variables, etc.) as opposed to space, time and so on. Of course, the interest in descriptive complexity stems in large part from the fact that there is a close connection between computational and descriptive measures of complexity. This connection is most notably illustrated by Fagin's result that NP is exactly the class of  de nable classes of nite structures. In some instances, the linkage between computational and descriptive complexity is not so close. Chandra and Harel [6] posed the question of whether there is a logical characterisation of P, in the spirit of Fagin's result. A partial answer is given by Immerman and Vardi's theorem that least xed point logic (LFP) captures P on the class of ordered structures. This answer is not completely satisfactory, in that it 1 1

Notes for lectures presented at the Ninth European Summer School on Logic, Language and Information, Aix-en-Provence, August 1997. 

1

doesn't quite mesh with item (1) above. The generalisation from strings to ordered structures is much weaker than that from strings to arbitrary relational structures. In Section 3, we explore the role of the ordering, and why it appears crucial to a characterisation of polynomial time complexity. However, another view one might take is that the attempts to match exactly descriptive and computational measures is misguided. Perhaps polynomial time complexity is a notion so enmeshed with the machine view of computation that it does not quite have a logical counterpart. By this view, we should regard the descriptive measures as valid measures in their own right, and regard a logic such as LFP as a proper complexity class. We can then try and determine its exact power and its relationship with other such descriptive classes. Remarkably, it turns out that when we do this, we end up with exactly the same outstanding open questions that computational complexity has stumbled against. In doing so, however, we develop a new set of tools (based largely on nite variable logics) which appear to provide a model theoretic view to questions in computational complexity. This is explored in the later sections.

2 Inductive Logics We know by now that the power of rst order sentences to de ne classes of nite structures is extremely limited. Any rst order de nable class of structures is decidable by a Turing machine using a logarithmic amount of workspace. Moreover, there are many computationally simple classes that are not rst order de nable, such as the class of structures with an even number of elements. We can say, in fact, that any class of structures that requires some element of recursion or iteration to compute is not, in general, rst order de nable. For instance, there is no rst order sentence that can express that a graph (V; E ) is connected. However, the transitive closure of the edge relation E can be de ned as the least relation R that satis es the condition:

R(x; y) if, and only if, x = y _ 9z(E (x; z) ^ R(z; y)): That is, the transitive closure of E is obtained as the least xed point of an operator de ned by a rst order formula. If we could de ne R, it would then be an easy matter to construct the sentence 8x8yR(x; y) stating that a graph is connected. It seems that a natural way to extend rst order logic to permit recursion is to introduce an operator for de ning such least xed points. Let ' be a formula with free individual variables among x ; : : : ; xm, in the signature  extended with an additional m-ary predicate symbol R. On -structures, ' de nes an operator mapping m-ary relations to m-ary relations. Thus, given a -structure A and an m-ary relation P in A, we de ne ' A;P to be fs j (A; P ) j= '[s]g. If this operator is monotone, that is, for every P and Q such that P  Q, ' A;P  ' A;Q then it has a least xed point. While monotonicity is a semantic property, there 1

(

)

(

2

)

(

)

is a syntactic condition on ' that guarantees that the corresponding operator is monotone. Namely, if ' is R-positive, that is all occurrences of R in ' are in the scope of an even number of negations, then the operator de ned by ' is monotone. We write LFP for the closure of rst order logic under the operation of taking least xed points of positive formulas. That is,  if ' is rst order formula over , then ' 2 LFP()  if ' is formed from formulas in LFP() by conjunction, disjunction, negation and rst order quanti cation, then ' 2 LFP(), and  if ' 2 LFP( [ fRg), ' is positive in R and x ; : : : ; xk are distinct variables, where k is the arity of R, then lfp(R; x : : : xk )'(t : : : tk ) 2 LFP() for any terms t ; : : : ; tk . Immerman [23] and Vardi [35] independently showed that LFP captures the complexity class PTIME over the class of structures which include a linear order as one of their relations. If ' de nes a monotone operator, then its least xed point in a structure A can be obtained by iterating the operator as follows. De ne ' to be the empty relation ;, i i A ;' and de ne ' to be ' . Because the operator is monotone, this sequence of relations is increasing, and if A has cardinality n, then for some i  nm , 'i = 'i . This 'i is then the least xed point of '. A similar iteration can be de ned even when ' does not de ne a monotone operator by taking at each stage the union with the previous stage. That is, de ne 'i = 'i [ ' A;'i . The resulting sequence of relations is increasing for any ', and once again reaches a xed point for some i  nm . This is the in ationary xed point of '. IFP is de ned to be the closure of rst order logic under the operation of taking in ationary xed points of arbitrary formulas. Clearly, for positive formulas, the least xed point and the in ationary xed point coincide. Moreover, Gurevich and Shelah [19] showed that for every formula ', the in ationary xed point of ' is de nable by a formula of LFP. It follows that the two logics IFP and LFP are equivalent on nite structures. Consider now an arbitrary formula ' that does not necessarily de ne a monotone operator. The sequence of stages de ned by taking ' = ; and 'i = ' A;'i is not necessarily increasing and may or may not converge to a xedmpoint. However, if there is an i such that 'i = 'i , then there is such an i  2n . The partial xed point of ' is de ned to be 'i for i such that 'i = 'i , if such an i exists, and empty otherwise. PFP denotes the closure of rst order logic under an operation de ning the partial xed point of formulas. 1

1

1

1

0

+1

(

)

+1

+1

(

)

0

+1

+1

Example 1 Consider the formula: '(R; x; y)  x = y _ 9z(E (x; z) ^ R(z; y)): 3

+1

(

)

Since ' is positive in R, the operator it de nes is monotone, so in both the in ationary and non-in ationary iterations yield the same result.

'm = f(v; w) j there is a path v ? w of length  mg: +1

And, '1 is the transitive closure of the relation E . Let (R; x; y) be the formula (x = y ^ 8x8y:R(x; y)) _ 9z(E (x; z) ^ R(z; y)): This formula is not positive in R and does not de ne a monotone operator, but its in ationary xed point is the same as that of '. For the non-in ationary iteration:

'm = f(v; w) j there is a path v ? w of length = mg: +1

This may, or may not, reach a xed point, depending on E .

3 P and Order Above, we asked if there is a logical characterisation of P, in other words: is there a natural logic L such that for every sentence ' of L, the class of nite structures Mod(') is recognisable in polynomial time and conversely, for every class of structures S such that the collection of strings that are encodings of structures in S is recognisable in polynomial time, there is a sentence ' in L such that S = Mod(')? This question as stated above is not precisely formulated, because we have not de ned what we mean by a natural logic. However, it can be seen as part of the broader question: are the PTIME properties of all structures recursively enumerable?

3.1 Graphs and Clocked Turing Machines

For concreteness, consider graphs, i.e. structures over the signature (E ), where E is a binary relation symbol. Clearly, a graph on n nodes can be encoded as a binary string of length n . However, the same graph can be encoded in many di erent ways (up to n!) and some machines will accept some encodings of a given graph but not others. We say a Turing machine accepts a graph property if it does not break isomorphism classes of graphs, that is to say it either accepts or rejects all encodings of any given graph. Or, putting it di erently, the collection of graphs accepted by the machine is closed under isomorphisms. Every Turing machine can be converted into a polynomial time machine by attaching a clock to it that terminates any computation if it exceeds some xed polynomial time bound. This gives us an enumeration, Mi(i 2 !) of polynomial time machines that includes machines that accept any polynomial time recognisable class of binary strings. The problem of Chandra and Harel can now be framed as follows: can we 2

4

enumerate a sub-sequence of this list that only includes machines that accept graph properties and includes at least one machine for each graph property accepted by some machine on the original list. An equivalent formulation of the problem, which we shall use later, was given by Gurevich [18]. This asks whether the class P is recursively indexable, which is de ned as follows: De nition 2 The class P is said to be recursively indexable, if there is a recursive set I and a Turing machine M such that:  on input i 2 I , M produces the code for a machine M (i) and a polynomial pi;  the class of structures accepted by M (i), is a class in P;  M (i) runs in time bounded by pi;  for each class of structures C 2 P, there is an i such that M (i) accepts C .

3.2 Order Invariant Sentences We can look at the same problem in another way. The binary string encoding of graphs described above can be seen as encoding an ordered graph, with the ordering given by the natural ordering on the integers. In this way, each ordered graph gives a unique binary string and hence no Turing machine breaks isomorphism classes. Hence, we know that we can enumerate all the PTIME properties of ordered graphs. We also obtain such an enumeration simply by enumerating all the sentences of LFP over the signature fE;