Constraints and Universal Algebra 1 Introduction - CiteSeerX

1 downloads 0 Views 247KB Size Report
Nov 28, 1997 - Peter Jeavons, David Cohen. Department of Computer Science. Royal Holloway, University of London, UK email:[email protected].
Constraints and Universal Algebra Peter Jeavons, David Cohen Department of Computer Science Royal Holloway, University of London, UK email:[email protected]

Justin Pearson Department of Information Technology Mid Sweden University, S-851 70 Sundsvall, Sweden email:[email protected]

November 28, 1997

Abstract

In this paper we explore the links between constraint satisfaction problems and

universal algebra. We show that a constraint satisfaction problem instance can be

viewed as a pair of relational structures, and the solutions to the problem are then the structure preserving mappings between these two relational structures. We give a number of examples to illustrate how this framework can be used to express a wide variety of combinatorial problems, many of which are not generally considered as constraint satisfaction problems. We also show that certain key aspects of the mathematical structure of constraint satisfaction problems can be precisely described in terms of the notion of a Galois connection, which is a standard notion of universal algebra. Using this result, we obtain an algebraic characterisation of the property of minimality in a constraint satisfaction problem. We also obtain a similar algebraic criterion for determining whether or not a given set of solutions can be expressed by a constraint satisfaction problem of a given arity.

1 Introduction The constraint satisfaction problem provides a framework in which it is possible to express, in a natural way, many combinatorial problems encountered in arti cial intelligence and elsewhere. The aim in a constraint satisfaction problem is to nd an assignment of values to a given set of variables subject to constraints on the values which can be assigned simultaneously to certain speci ed subsets of variables. The mathematical framework used to describe constraint satisfaction problems has strong links with several other areas of computer science and mathematics. In a previous paper [5] we explored one example of this by describing and using the close links between constraint satisfaction problems and relational databases. Relational database theory provides a very powerful and convenient terminology for describing operations on relations, and certain aspects of their structure, and this terminology is very useful in the description and study of constraint satisfaction problems. Furthermore, many of the computational tasks undertaken in the processing and solution of constraint satisfaction problems also arise in the context of database management. We believe that 1

a greater interchange of ideas between these two elds could be of considerable bene t to both [2, 5], and therefore these links should receive more attention than they currently do. In the present paper we explore a di erent set of links, which we believe will prove to be equally important, the links between constraint satisfaction problems and universal algebra. This branch of mathematics is concerned with the study of the structure of general mathematical objects such as abstract algebras, lattices, and relational structures, and with the operations that can be de ned on such objects. We shall show that a constraint satisfaction problem instance can be viewed as a pair of relational structures, and the solutions to the problem are then the structure preserving mappings between these two relational structures. One advantage of viewing constraint satisfaction problems in this way is that it suggests a number of algebraic techniques for analysing the properties of a given problem class. For example, the nature of the constraints which occur in a problem class can be described by specifying the algebraic operations under which they are invariant. This has led to a novel approach to the study of tractability in constraint satisfaction problems which focuses on algebraic properties of constraints [9, 10, 11]. This approach has led to a number of new insights into the nature of tractable constraint types. In particular, we have established that any collection of tractable constraints over a nite domain, must all be invariant under a pointwise operation [10, 11]. This result has transformed the search for new tractable constraint types into a search for possible algebraic invariance properties. Another advantage of an algebraic viewpoint is that it allows the powerful structural results obtained in the eld of universal algebra to be applied to the analysis of constraint satisfaction problems. For example, a theorem about algebras obtained by Baker and Pixley in 1975 [1] provides a precise algebraic characterisation of the constraint types for which local consistency is sucient to ensure global consistency [8]. As another example, we shall show below that certain key aspects of the mathematical structure of constraint satisfaction problems can be precisely described in terms of the notion of a Galois connection, which is a standard notion of universal algebra. The paper is organised as follows. In Section 2 we give the basic de nitions, and establish the fundamental connection between constraint satisfaction problems and relational structures. In Section 3 we consider the class of constraint satisfaction problems with a given constraint structure, that is, a xed constraint hypergraph. We investigate the relationship between problem instances and sets of solutions, and show that this relationship can be viewed as a Galois connection. Hence we obtain an algebraic characterisation of the property of minimality, and an algebraic criterion for determining whether or not a given set of solutions can be expressed by a constraint problem of a certain arity. In Section 4 we consider the class of constraint satisfaction problems with arbitrary constraint hypergraphs, but with a given collection of constraint types. We show how algebraic properties known as polymorphisms can be used to classify di erent constraint types, and we indicate how the relationship between constraint types and polymorphisms can also be viewed as an example of a Galois connection.

2 De nitions

2.1 The constraint satisfaction problem

The fundamental mathematical structure required to describe constraints, and constraint satisfaction problems, is the relation, which is de ned as follows. 2

De nition 2.1 For any set D, and any natural number n, we denote the set of all n-

tuples of elements of D by Dn . A subset of Dn is called an `n-ary relation' over D. For any tuple t 2 Dn, and any i in the range 1 to n, we denote the value in the ith coordinate position of t by t[i]. The tuple t will be written in the form ht[1]; t[2]; : : :; t[n]i.

The following relations will be of special interest in this paper: De nition 2.2 For any set D we de ne the following binary relations over D:  Equality: 2D = fhd; d0i 2 D2 j d = d0g  Disequality: 6=D = fhd; d0i 2 D2 j d 6= d0g We now de ne the `constraint satisfaction problem' [12, 13, 15]. De nition 2.3 An instance of a constraint satisfaction problem is a triple hV; D; Ci, where:

 V is a nite set of variables;  D is a nite domain of values;  C is a set of constraints, fC1; C2; : : :; Cqg. Each constraint Ci 2 C is a pair hsi; Rii, where: { si is a tuple of variables of length mi , called the `constraint scope'; and { Ri is an mi -ary relation over D, called the `constraint relation'. For each constraint, hsi ; Rii, the tuples of Ri indicate the allowed combinations of simultaneous values for the variables in si . The length of the tuples in Ri is called the `arity' of the constraint. In particular, unary constraints specify the allowed values for a single variable, and binary constraints specify the allowed combinations of values for a pair of variables. A solution to a constraint satisfaction problem instance is a function from the variables to the domain such that the image of each constraint scope is an element of the corresponding constraint relation. Each instance of a constraint satisfaction problem is associated with a set of solutions, and can be said to `represent' or `express' this set of solutions. Example 2.4 An instance of the standard propositional Satisfiability problem [4, 16] is speci ed by giving a formula in propositional logic, and asking whether there are values for the variables which make the formula true. For example, consider the formula: (x1 _ x2 _ x3 _ x4) ^ (x1 _ x2 _ x3 ) ^ (x3 _ x4 _ x1) ^ (x3 _ x2 _ x4) ^ (x1 _ x3 ) The problem of nding a satisfying truth assignment for this formula can be formulated as an instance of the constraint satisfaction problem in a number of ways. Perhaps the most straightforward is to construct the instance P with  Set of variables V = fx1; x2; x3; x4g;  Set of values D = f0; 1g, corresponding to True and False;  Set of constraints fC1; C2; C3; C4; C5g, where 3

{ { { { {

C1 = hhx1; x2; x3; x4i; D4 n h0; 0; 0; 0ii C2 = hhx1; x2; x3i; D3 n h1; 1; 0ii C3 = hhx3; x4; x1i; D3 n h1; 1; 0ii C4 = hhx3; x2; x4i; D3 n h1; 1; 0ii C5 = hhx1; x3i; D2 n h1; 1ii A simple calculation reveals that there are 6 solutions to this problem instance, which can be tabulated as follows: x1 x2 x3 x4 0 0 0 1 0 0 1 0 0 1 0 0 0 1 0 1 1 0 0 0 1 0 0 1 2

2.2 Relational structures and homomorphisms

In order to describe constraint satisfaction problems in algebraic terms, we will make extensive use of the standard algebraic notion of a `relational structure' [3, 14]. De nition 2.5 A `relational structure' is a pair, hV; Ei(i 2 I )i, consisting of a nonempty set, V , and a system, Ei, of relations over V , indexed by the elements of I . The set V is called the `universe' of the relational structure. A relational structure  = hV; Ei(i 2 I )i is called ` nite' if V and I are nite sets. In this case we will usually write  as hV; E1; E2; : : :; EjI ji.

Example 2.6 A (directed) graph is a relational structure with a single binary relation specifying which vertices are adjacent. It is usually written hV; E i. A complete graph on n vertices, denoted Kn, corresponds to a relational structure hV; 6=V i, where V is a set of cardinality n, and 6=V is the disequality relation over V de ned in Example 2.2. A graph in which the edges are labelled with elements of some set L can be written as a relational structure hV; Ei(i 2 L)i, where the relation Ei contains all edges labelled with i. 2

De nition 2.7 The `rank function' of a relational structure hV; Ei(i 2 I )i, is a function

 from I to the set of non-negative integers, such that for all i 2 I , (i) is the arity of Ei. A relational structure  is `similar' to a relational structure 0 if they have the same rank function.

De nition 2.8 Let  = hV; Ei(i 2 I )i and 0 = hV 0; Ei0(i 2 I )i be two similar relational

structures, and let  be their common rank function. A `homomorphism' from  to 0 is a function h : V ! V 0 such that, for all i 2 I ,

hv1; v2; : : :; v(i)i 2 Ei =) hh(v1); h(v2); : : :; h(v(i))i 2 Ei0: The set of all homomorphisms from  to 0 is denoted Hom(; 0). 4

The fundamental connection we wish to explore in this paper is that the solutions to any constraint satisfaction problem instance can be viewed as homomorphisms between a xed pair of nite relational structures, as the next result indicates. Proposition 2.9 For any constraint satisfaction problem instance P = hV; D; Ci, with C = fhs1; R1i; hs2; R2i; : : :; hsq; Rqig, the set of solutions to P equals Hom(; 0), where  = hV; fs1g; fs2g; : : :; fsq gi and 0 = hD; R1; R2; : : :; Rq i.

Example 2.10 Reconsider the constraint satisfaction problem instance P , de ned in

Example 2.4. This problem corresponds to the GCP instance h; 0i, where:   = hfx1; x2; x3; x4g; fhx1; x2; x3; x4ig; fhx1; x2; x3ig; fhx3; x4; x1ig; fhx3; x2; x4ig; fhx1; x3igi  0 = hf0; 1g; R1; R2; R2; R2; R3i, where { R1 = f0; 1g4 n h0; 0; 0; 0i { R2 = f0; 1g3 n h1; 1; 0i { R3 = f0; 1g2 n h1; 1i The six solutions to P , listed in Example 2.4 are precisely the homomorphisms from  to 0 . 2

Conversely, given any pair of similar nite relational structures, there is a corresponding constraint satisfaction problem instance whose solutions are precisely the homomorphisms between the two structures, as the next result indicates. Proposition 2.11 For any pair of similar nite relational structures,  and 0, with  = hV; E1; E2; : : :; Eki and 0 = hD; R1; R2; : : :; Rki, the set Hom(; 0) is equal to the of solutions to the constraint satisfaction problem instance hV; D; Ci where C = Sk set fhs; R i j s 2 E g. i=1

i

i

In view of these results, we shall refer to any pair of similar nite relational structures, h; 0i, as an instance of the `generalised constraint satisfaction problem' (GCP), and we shall regard the set of homomorphisms Hom(; 0) as the set of solutions to this problem instance. De nition 2.12 An instance of a generalised constraint satisfaction problem is a pair h; 0i, where  and 0 are similar nite relational structures. A solution to h; 0i is a homomorphism from  to 0. Comparing De nition 2.12 with De nition 2.3 indicates how the use of standard algebraic terminology streamlines the de nition. Notice that in any problem instance h; i, the rst component, , speci es the structure of the constraints (which variables constrain which other others), sometimes called the `constraint (hyper)graph', whilst the second component, 0 , speci es the constraint relations. The general constraint satisfaction framework described in De nition 2.12 allows many standard combinatorial problems to be expressed very simply as instances of GCP, as the following examples indicate.

5

Example 2.13 [GRAPH COLORABILITY] An instance of the Graph Colorability problem [4, 16] consists of a graph G and an integer q . The question is whether the

vertices of G can be labelled with q colours in such a way that adjacent vertices are labelled with di erent colours. This can be expressed as the GCP instance hG; Kq i, where Kq is a complete graph on q vertices, as de ned in Example 2.6. 2 Example 2.14 [CLIQUE] An instance of the Clique problem [4, 16] consists of a graph G and an integer q . The question is whether G contains a subgraph of q vertices which is a clique (that is, isomorphic to a complete graph Kq ). Assuming that G contains no `loops' (in other words, no vertex is adjacent to itself), this can be expressed as the GCP instance hKq ; Gi. 2 Example 2.15 [VERTEX COVER] An instance of the Vertex Cover problem [4, 16] consists of a graph G = hV; E i and an integer k. The question is whether there is a subset V 0  V with jV 0 j  k, such that for all hv; wi 2 E either v 2 V 0 or w 2 V 0 . This can be expressed as the GCP instance hK(jV j?k); G i, where G is the complement graph hV; 6=V n E i. (This formulation uses the fact that V 0 is a vertex cover if and only if V n V 0 is an independent set, which corresponds to a clique in the complement graph [4, 16].) 2 Example 2.16 [k-DIMENSIONAL MATCHING] An instance of the k-Dimensional Matching problem [4] consists of a relation M of arity k over a set V . The question is whether there is a subset M 0  M such that jM 0 j = jV j and no two elements of M 0 agree in any coordinate position. This can be expressed as the GCP instance hhV; 6=V i; hM; 6=~M ii, where 6=~M = fhhv1; v2; : : :; vki; hv10 ; v20 ; : : :; vk0 ii 2 M 2 j vi 6= vi0; i = 1; 2; : : :; kg. 2 Example 2.17 [HAMILTONIAN CIRCUIT] An instance of the Hamiltonian Circuit problem [4, 16] consists of a graph G = hV; E i. The question is whether there is a cyclic ordering of V such that every pair of successive nodes in the ordering is adjacent in G. This can be expressed as the GCP instance hhV; CV ; 6=V i; hV; E; 6=V ii, where CV is an arbitrary cyclic permutation on V and 6=V is the disequality relation over V de ned above. (The presence of the relation 6=V in both relational structures simply ensures that any solution must be injective.) 2 Example 2.18 [BANDWIDTH] An instance of the Bandwidth problem [4] consists of a graph G = hV; E i where V = fv1; v2; : : :; vng, and a positive integer k. The question is whether there is a linear ordering of V such that adjacent nodes in the graph are at most k positions apart in the ordering. This can be expressed as the GCP instance hhV; E; 6=V i; hV; Bk; 6=V ii, where Bk = fhvi; vj i 2 V 2 j ji ? j j  kg and 6=V is the disequality relation over V de ned above. 2 All of the above problems are known to be NP-complete [4, 16], but the next two examples show that it is not just NP-complete problems which can be expressed in this framework. Example 2.19 [GRAPH ISOMORPHISM] An instance of the Graph Isomorphism problem [4, 16] consists of two graphs G = hV; E i and G0 = hV 0; E 0i with jV j = jV 0 j. The question is whether there is a bijection between the vertices such that adjacent vertices in G are mapped to adjacent vertices in G0, and non-adjacent vertices in G are mapped to non-adjacent vertices in G0 . 6

This can be expressed as the GCP instance hhV; E; E i; hV 0 ; E 0; E 0ii, where E = 6=V n E and E0 = 6=V n E 0. 2 0

Example 2.20 [GRAPH UNREACHABILITY] An instance of the Graph Unreachability problem [16] consists of a graph G = hV; E i and a pair of vertices, v; w 2 V . The question is whether there is no path in G connecting v to w. This can be expressed as the GCP instance

hhV; E; fhvig; fhwigi; hf0; 1g; 2f0;1g; fh0ig; fh1igii: 2

3 Fixed constraint hypergraph In this section, we shall consider the collection of all instances of the generalised constraint satisfaction problem with a xed constraint hypergraph, and a xed domain of values, but with di ering constraint relations. To do this, we choose a xed relational structure, 0, with universe V and rank function , and a xed set D. We then consider all GCP instances h0; i, where  varies over all relational structures with universe D and rank function . To obtain a partial ordering on this set of problem instances we note that similar relational structures with the same universe can be partially ordered by inclusion on the corresponding relations, as follows. De nition 3.1 If  = hD; Ei(i 2 I )i and 0 = hD; Ei0(i 2 I )i are similar relational structures, with Ei  Ei0 for all i 2 I , then we shall say1 that   0. Using this partial order, the set of all relational structures with universe D and rank function  forms a lattice, which we shall call D; . Now, each problem instance h0; i has an associated set of solutions, which is a set of mappings from V to D. Furthermore, the set of all sets of mappings from V to D, denoted }(DV ), can be partially ordered by inclusion, in the standard way, and also forms a lattice. Now, given any xed relational structure, 0, with universe V and rank function  we can de ne a pair of mappings between D; and }(DV ), as follows. De nition 3.2 Let 0 = hV; E1; E2; : : :; Eqi be a nite relational structure, with universe V and rank function . We de ne two mappings, Sol (?) and Pro (?) as follows:  For any relational structure  with rank function , de ne Sol () as follows 0

0

0

Sol () = Hom(0; ): 0

 For any set of mappings, M , from V to some set D, de ne Pro (M ) as follows Pro (M ) = hD; R1; R2; : : :; Rq i; where, for i = 1; 2; : : :; q , [ fhm(v1); m(v2); : : :; m(v(i))i j m 2 M g Ri = 0

0

hv1 ;v2;:::;v(i) i2Ei

7

s

s

Sol (?) 0

-

Lattice of relational structures D;

Lattice of sets of mappings }(DV )



Pro (?) 0

s

s

Figure 1: The Galois connection between D; and }(DV ) This pair of mappings is illustrated in Figure 1. The mapping Sol (?) takes each relational structure  to the set of solutions to h0; i. Conversely, the mapping Pro (?) takes each set of mappings to a relational structure  such that the problem instance h0; i `expresses' this set of mappings as closely as possible, given the xed choice of constraint hypergraph. From an algebraic point of view, the signi cant fact about this pair of mappings is that they are order-reversing, as shown in the next result. Proposition 3.3 For any nite relational structure 0 = hV; E1; E2; : : :; Eqi with rank function , the mappings Sol (?) and Pro (?) have the following properties:  For any two relational structures 1 and 2, that have a common universe, and rank function , if 1  2 , then Sol (1)  Sol (2).  For any two sets of mappings, M1 and M2, in }(DV ), if M1  M2, then Pro (M1)  Pro (M2 ).  For any  with rank function , Pro (Sol ())  .  For any M in }(DV ), Sol (Pro (M ))  M . This result states that the mappings Sol (?) and Pro (?) constitute a Galois connection [3, 14] between D; and }(DV ), for any set D. As with any Galois connection [3, 14], this implies that the composite operation Pro (Sol (?)) is a closure operation on D; , and the elements which are xed by this operation form a lattice. For certain choices of 0 these elements are of particular interest. Proposition 3.4 Let Kn = hV; fe1; e2; : : :gi be a complete graph with n vertices, and set Kn = hV; fe1g; fe2g; : : :i. 0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

Note that the ordering de ned here is reversed from the standard inclusion ordering, for convenience later. 1

8

For any relational structure  with the same rank function as Kn , the pair hKn; i is a minimal binary constraint satisfaction problem [15] if and only if

ProKn (SolKn ()) = : Similarly, the composite operation Sol (Pro (?)) is a closure operation on }(DV ), and the elements which are xed by this operation also form a lattice. Proposition 3.5 A set of mappings M in }(DV ) is the set of solutions to some constraint satisfaction problem instance with constraint hypergraph 0 if and only if 0

0

Sol (Pro (M )) = M: 0

0

For some choices of 0 this result is of particular interest. Corollary 3.6 Let Kn = hV; fe1; e2; : : :gi be a complete graph with n vertices, and set Kn = hV; fe1g; fe2g; : : :i. A set of mappings M in }(DV ) is the set of solutions to some binary constraint satisfaction problem instance if and only if SolKn (ProKn (M )) = M . Similar results for other problem arities can be obtained in the same way. Example 3.7 Let S be the set of solutions to the GCP instance h; 0i de ned in Example 2.10. The set S contains 6 mappings from V = fx1; x2; x3; x4g to D = f0; 1g, as indicated in Example 2.4. In this instance we have: Kn = hV; fhx1; x2ig; fhx1; x3ig; : : :; fhx4; x3igi; giving ProKn (S ) = hV; fh0; 0i; h0; 1i; h1; 0ig; fh0; 0i; h0; 1i; h1; 0ig; : : :; fh0; 0i; h0; 1i; h1; 0igi; which then gives

SolKn (ProKn (S )) = S [ fh0; 0; 0; 0ig 6= S: Hence, by Corollary 3.6, S cannot be expressed as the set of solutions to any binary constraint satisfaction problem instance. A similar calculation shows that S cannot be expressed as the set of solutions to any ternary constraint satisfaction problem instance (but see Example 4.8). 2

4 Fixed constraint relations In this section, we shall consider the collection of all instances of the generalised constraint satisfaction problem with a xed domain of values, and a xed set of possible constraint relations, but with di ering constraint hypergraphs. Throughout this section, we shall assume that the domain of values for all the problems we consider is some xed set D. For any set, ?, of relations over D, the collection of all instances, h; 0i, of the generalised combinatorial problem where the relations of 0 are all elements of ?, will be denoted GCP(?). Once again, the notion of a Galois Connection turns out to be of fundamental importance for studying the class of problems GCP(?). In this case we shall construct a mapping from each set of relations ? to an associated set of operations on D, which are 9

s

s

Pol(?) Lattice of sets of relations D



Lattice of sets of operations

D

Inv(?) s

s

Figure 2: The Galois connection between D and D called the polymorphisms2 of ?, as described below. We also construct a second mapping from sets of operations to sets of relations, and show that these two mappings form a Galois connection. First note that the set of all possible sets of relations over D is partially ordered by inclusion in the standard way, and forms a lattice, which we shall call D . An operation on a set D is a function from Dm to D, for some positive integer m, which is called the arity of the operation. The set of all sets of operations on D is again partially ordered by inclusion in the standard way, and forms a lattice, which we shall call D . De nition 4.1 Let R be a relation over D. An operation f of arity n on D is a polymorphism of R if 8t1; t2; : : :; tn 2 R f (t1; t2; : : :; tn) 2 R; where the operation f is applied componentwise. If f is a polymorphism of R, then R is said to be invariant for f . We now de ne a pair of order-preserving mappings between D and D , as follows. De nition 4.2 We de ne two mappings, Pol(?) and Inv(?) as follows:  For any set of relations ? over D, de ne Pol(?) as follows Pol(?) = ff j 8R 2 ?; f is a polymorphism of Rg:

 For any set of operations, O, on D, de ne Inv(O) as follows Inv(O) = fR j 8f 2 O; R is invariant for f g: These mappings are illustrated in Figure 2. From an algebraic point of view, the signi cant fact about this pair of mappings is that they are order-reversing, as shown in the next result.

In previous papers [8, 9, 11] we have used the term `closure operation' instead of `polymorphism', but we introduce the term polymorphism here for consistency with the literature of universal algebra, and to avoid confusion with the notion of closure arising from the Galois connection. 2

10

Proposition 4.3 The mappings Pol(?) and Inv(?) have the following properties:  For any two sets of relations ?1 and ?2, over D, if ?1  ?2, then Pol(?1)  Pol(?2).  For any two sets of operations, O1 and O2, on D, if O1  O2, then Inv(O1)  Inv(O2).  For any set of relations, ? over D, Inv(Pol?)  ?.  For any set of operations O on D, Pol(Inv(O))  O. This result states that the mappings Pol(?) and Inv(?) constitute a Galois connection

between D and D . This particular Galois connection is well-known in universal algebra, and has been extensively studied [6, 14, 18]. As with any Galois connection, the composite operation Pol(Inv(?)) is a closure operation on D , and the elements which are xed by this operation form a lattice. These xed elements are sets of operations with particular algebraic properties, which have been investigated in universal algebra under the name of `clones'. De nition 4.4 ([18]) A set of operations O on a set D is called a clone if  Every projection operation on D is an element of O; and  The composition of any elements in O is an element of O.

Proposition 4.5 A set of operations O on D is a clone if and only if Pol(Inv(O)) = O. Similarly, the composite operation Inv(Pol(?)) is a closure operation on D , and the elements which are xed by this operation also form a lattice. These xed elements are in one-to-one correspondence with the clones described above. The image of any set of relations ? under the composite operation Inv(Pol(?)) reveals a great deal about the expressive power of ? as a set of possible constraint relations, as the next results make clear. Theorem 4.6 ([11]) Let V = fv1; v2; : : :; vng be a set of variables. The mappings in a set of mappings M in }(DV ) can be extended to form the set of solutions to some constraint satisfaction problem instance in GCP(?) if and only if

fhf (v1); f (v2); : : :; f (vn)i j f 2 M g 2 Inv(Pol(?)): For some choices of ? this result is of particular interest. Corollary 4.7 Let ?(r) be the set of all relations over D of arity r. The mappings in a set of mappings M in }(DV ) can be extended to form the set of solutions to some constraint satisfaction problem instance with constraints of arity r if

and only if

fhf (v1); f (v2); : : :; f (vn)i j f 2 M g 2 Inv(Pol(?(r))):

Example 4.8 Let S be the set of solutions to the GCP instance h; 0i de ned in Example 2.10. The set S contains 6 mappings from V = fx1; x2; x3; x4g to D = f0; 1g, as indicated in Example 2.4. In this instance we have: ?(2) = }(fh0; 0i; h0; 1i; h1; 0i; h1; 1ig) 11

It is easily veri ed that every element of ?(2) is invariant for the ternary operation  on D which is de ned as follows: ( y = z; (x; y; z) = xy ifotherwise. Hence  2 Pol(?(2)) But this means that S 62 Inv(Pol(?(2))), because, for example,

'(h0; 0; 0; 1i; h0; 0; 1; 0i; h0; 1; 0; 0i) = h0; 0; 0; 0i 62 S: Hence, by Corollary 4.7, the mappings in S cannot be extended to form the set of solutions to any binary constraint satisfaction problem instance. On the other hand, it can be shown [17, 18] that Pol(?(3)) contains only projection operations, hence Inv(Pol(?(2))) contains all relations over D, so by Corollary 4.7, the mappings in S can be extended to form the set of solutions to a ternary constraint satisfaction problem instance. 2 Finally, it was shown in [7] that Pol(?) also provides information about the computational complexity of deciding whether or not any instance of GCP(?) has a solution, as the next results indicate. Theorem 4.9 ([7]) Let ?1 and ?2 be nite sets of relations over D. If ?1  Inv(Pol(?2)), then GCP(?1) can be reduced in polynomial time to GCP(?2).

Corollary 4.10 For any nite set of relations, ?, the complexity of GCP(?) is determined, up to polynomial-time reductions, by Pol(?). 5 Conclusion In this paper we have described how a constraint satisfaction problem can be viewed as the problem of nding a homomorphism between relational structures. We have shown that this algebraic framework is suciently general to allow a wide variety of combinatorial problems to be expressed very simply as constraint satisfaction problems. We believe that this algebraic framework provides valuable new insights into the constraint satisfaction problem because it encourages the use of algebraic techniques and tools to analyse the structure of constraint satisfaction problems, and we have given a number of examples to illustrate this process.

References [1] K.A. Baker and A.F. Pixley. Polynomial interpolation and the chinese remainder theorem. Mathematische Zeitschrift, 143:165{174, 1975. [2] D.A. Cohen, M. Gyssens, and P.G. Jeavons. Derivation of constraints and database relations. In Proceedings 2nd International Conference on Constraint Programming| CP'96 (Boston, August 1996), volume 1118 of Lecture Notes in Computer Science, pages 134{148. Springer-Verlag, 1996. [3] P.M. Cohn. Universal Algebra. Harper & Row, 1965. 12

[4] M. Garey and D.S. Johnson. Computers and Intractability: A Guide to the Theory of NP-Completeness. Freeman, San Francisco, CA., 1979. [5] M. Gyssens, P.G. Jeavons, and D.A. Cohen. Decomposing constraint satisfaction problems using database techniques. Arti cial Intelligence, 66(1):57{89, 1994. [6] T. Ihringer and R. Poschel. Collapsing clones. Acta Sci. Math. (Szeged), 58:99{113, 1993. [7] P.G. Jeavons. On the algebraic structure of combinatorial problems. Technical Report CSD-TR-95-15, Computer Science Department, Royal Holloway, University of London, Egham , Surrey , UK, 1995. to appear in Theoretical Computer Science. [8] P.G. Jeavons, D.A. Cohen, and M. Cooper. Constraints, consistency, and closure. Technical Report CSD-TR-97-16, Computer Science Department, Royal Holloway, University of London, Egham, Surrey, UK, 1997. Submitted for publication. [9] P.G. Jeavons, D.A. Cohen, and M. Gyssens. A unifying framework for tractable constraints. In Proceedings 1st International Conference on Constraint Programming| CP'95 (Cassis, France, September 1995), volume 976 of Lecture Notes in Computer Science, pages 276{291. Springer-Verlag, 1995. [10] P.G. Jeavons, D.A. Cohen, and M. Gyssens. Closure properties of constraints. Technical Report CSD-TR-96-15, Computer Science Department, Royal Holloway, University of London, Egham, Surrey, UK, 1996. to appear in Journal of the ACM. [11] P.G. Jeavons, D.A. Cohen, and M. Gyssens. A test for tractability. In Proceedings 2nd International Conference on Constraint Programming|CP'96 (Boston, August 1996), volume 1118 of Lecture Notes in Computer Science, pages 267{281. Springer-

[12] [13] [14] [15] [16] [17] [18]

Verlag, 1996. P.B. Ladkin and R.D. Maddux. On binary constraint problems. Journal of the ACM, 41:435{469, 1994. A.K. Mackworth. Consistency in networks of relations. Arti cial Intelligence, 8:99{ 118, 1977. R.N. McKenzie, G.F. McNulty, and W.F. Taylor. Algebras, Lattices and Varieties, volume I. Wadsworth and Brooks, California, 1987. U. Montanari. Networks of constraints: Fundamental properties and applications to picture processing. Information Sciences, 7:95{132, 1974. C.H. Papadimitriou. Computational Complexity. Addison-Wesley, 1994. E.L. Post. The two-valued iterative systems of mathematical logic, volume 5 of Annals of Mathematical Studies. Princeton University Press, 1941. A. Szendrei. Clones in Universal Algebra, volume 99 of Seminaires de Mathematiques Superieures. University of Montreal, 1986.

13