Dualities for Constraint Satisfaction Problems Andrei Bulatov1 , Andrei Krokhin2 , and Benoit Larose3 1 3 School of Computing Science Simon Fraser University Burnaby, BC, Canada, V5A 1S6 abulatov@cs.sfu.ca 2 Department of Computer Science Durham University Durham, DH1 3LE, UK andrei.krokhin@durham.ac.uk Department of Mathematics and Statistics Concordia University Montréal, Qc, Canada, H3G 1M8 larose@mathstat.concordia.ca Abstract. In a nutshell, a duality for a constraint satisfaction problem equates the existence of one homomorphism to the non-existence of other homomorphisms. In this survey paper, we give an overview of logical, combinatorial, and algebraic aspects of the following forms of duality for constraint satisfaction problems: finite duality, bounded pathwidth duality, and bounded treewidth duality. 1 Introduction The constraint satisfaction problem (CSP) provides a framework in which it is possible to express, in a natural way, many combinatorial problems encountered in artificial intelligence, computer science, discrete mathematics, and elsewhere [19, 34, 61]. An instance of the constraint satisfaction problem is represented by a finite set V of variables, a (finite) domain D of values for each variable, and a set of constraints {(s1 , R1 ), . . . , (sq , Rq )}. Each constraint consists of a constraint scope si , which is an mi -tuple of variables, and a constraint relation Ri ⊆ Dmi . The aim is then to decide whether there is an assignment h : V → D that satisfies the constraints, i.e., such that h(si ) ∈ Ri for all i. It has been observed [28] (see also [42]) that the constraint satisfaction problem can be recast as the following fundamental problem: given two finite relational structures A and B, is there a homomorphism from A to B? One of the most studied restrictions on the CSP is the non-uniform CSP – when the structure B is fixed, and only A is part of the input. The obtained problem is denoted by CSP(B). Examples of such problems include various versions of k-Sat, Graph Colouring, and Systems of Equations (see [17, 34, 42, 50]). Strong motivation for studying this framework was given in [28] where it was shown that such problems can be used in attempts to identify a largest natural subclass of NP that avoids problems of intermediate complexity. 2 A. Bulatov, A. Krokhin and B. Larose The two main general classification problems about the class of problems of the form CSP(B) are: 1. classify the problems CSP(B) with respect to computational complexity, that is, for a given complexity class K, characterise (under suitable complexitytheoretic assumptions) structures B such that CSP(B) is in K; 2. classify the problems CSP(B) with respect to descriptive complexity, that is, for a given logic L, characterise structures B such that CSP(B), as the class of all structures admitting a homomorphism to B, is definable in L. In addition, there is a so-called meta-problem: 3. Determine the (computational) complexity of deciding whether, for a given structure B, CSP(B) has a certain (computational or descriptive) complexity. A variety of mathematical approaches to study problems CSP(B) has been recently suggested. The most advanced approaches use logic (e.g., [48]), combinatorics (e.g., [32, 34, 51]), universal algebra (e.g., [7, 10, 12, 17, 41, 50]), or combinations of those (e.g., [2, 8, 20, 28, 52]). In this survey, we will discuss a combinatorial idea that has a bearing on all the above problems, and has strong links with the three approaches — the idea of homomorphism duality. The concept of duality has been much used to study homomorphism problems. In essence, a duality equates the existence of one homomorphism to the non-existence of some other homomorphism(s). The idea is to provide a set OB of obstructions for B such that, for any relational structure A, A homomorphically maps to B if and only if A does not admit a homomorphism from any structure from OB . Of course, the set OB can always be chosen to consist of all structures that do not homomorphically map to B, but this choice does not give any information about CSP(B). If, however, OB can be chosen so that it has certain nice properties then this can tell us much about the computational or descriptive complexity of CSP(B). Most of the early studies of dualities were restricted to the case of (di)graphs (see survey [36], also [34, 35, 38, 39, 49, 58]). For general relational structures, the main forms of duality that have been considered in the literature are finite duality, bounded pathwidth duality, and bounded treewidth duality. We give the necessary combinatorial, logical, and algebraic preliminaries in Section 2, and then consider the three dualities in Sections 3, 4, and 5, respectively. Sections 6 and 7 contain some remarks and a list of open problems concerning dualities. 2 2.1 Preliminaries Basic definitions Most of the terminology introduced in this section is fairly standard. A vocabulary is a finite set of relation symbols or predicates. In what follows, τ always Dualities for constraint satisfaction problems 3 denotes a vocabulary. Every relation symbol R in τ has an arity r = ρ(R) ≥ 0 associated to it. We also say that R is an r-ary relation symbol. A τ -structure A consists of a set A, called the universe of A, and a relation RA ⊆ Ar for every relation symbol R ∈ τ where r is the arity of R. Let maxar(A) denote the maximum arity of a relation in A. Unless specified otherwise, all structures in this paper are assumed to be finite, i.e., structures with a finite universe. Throughout the paper we use the same boldface and slanted capital letters to denote a structure and its universe, respectively. Let A and A0 be τ -structures. We say that A0 is a substructure of A, denoted 0 by A0 ⊆ A, if A0 ⊆ A and for every R ∈ τ , RA ⊆ RA . If A is a τ -structure and I ⊆ A, then A|I denotes the substructure induced by A on I, i.e., the τ -structure I with universe I and RI = RA ∩ I r for every r-ary R ∈ τ . A homomorphism from a τ -structure A to a τ -structure B is a mapping h : A → B such that for every r-ary R ∈ τ and every (a1 , . . . , ar ) ∈ RA , we have (h(a1 ), . . . , h(ar )) ∈ RB . We denote this by h : A → B, and the set of all homomorphisms from A to B is denoted by hom(A, B). We also say that A homomorphically maps to B, and write A → B if there is a homomorphism from A to B and A 6→ B if there is no homomorphism. Now CSP(B) can be defined to be the class of all structures A such that A → B. The class of all structures A such that A 6→ B will be denoted by co-CSP(B). Example 1. If Bhc is a digraph H then CSP(Bhc ) is the much-studied problem, H-colouring, of deciding whether a there is a homomorphism from a given digraph to H [34]. If H is the complete graph Kk on k vertices then it is well known (and easy to see) that CSP(Bhc ) is precisely the k-colouring problem. Example 2. If Blhc is a structure obtained from a digraph H by adding, for each non-empty subset U of H, a unary relation U then CSP(Blhc ) is exactly the List H-colouring problem, in which every vertex v of the input digraph G gets a list Lv of vertices of H, and the question is whether there is a homomorphism h : G → H such that h(v) ∈ Lv for all v ∈ G (see [34]). Example 3. If Bunr is the Boolean (i.e., with universe {0, 1}) structure with one binary relation Eq, which is the equality relation, and two unary relations {0} and {1} then CSP(Bunr ) is the (undirected) Unreachability problem where one is given a graph and two sets of vertices in it, S and T , and the question is whether there is no path in the graph from any vertex in S to a vertex in T . Example 4. In the Path System Accessibility problem [31], one is given a relational structure A with one ternary relation P A , and two unary relations S A and T A . The unary relations represent “source” and “terminal” nodes, respectively. The question is whether there is an “accessible” terminal node, where a node x is accessible if x ∈ S A or (a, b, x) ∈ P A for some accessible a, b ∈ A. Let Bps be the Boolean structure with one ternary relation P Bps = {(x, y, z) | x∧y → z} and two unary relations S Bps = {1} and T Bps = {0}. Then it is easy to verify that the Path System Accessibility problem is precisely co-CSP(Bps ). 4 A. Bulatov, A. Krokhin and B. Larose Example 5. Let B3H be the structure with universe {0, 1}, one unary relation U B3H = {1} and two ternary relations P B3H = {0, 1}3 \ {(1, 1, 0)} and N B3H = {0, 1}3 \ {(1, 1, 1)}. It is easy to see that every Horn 3-CNF formula ϕ with variables x1 , . . . , xn can be represented as a structure Aϕ with universe {x1 , . . . , xn } and relations U Aϕ , P Aϕ , N Aϕ where U Aϕ is the set of all unit clauses (in ϕ), P Aϕ is the set of all clauses of the form (¬x ∨ ¬y ∨ z), and N Aϕ is the set of all clauses of the form (¬x ∨ ¬y ∨ ¬z). Clearly, we have Aϕ → B3H if and only if ϕ is satisfiable. Hence Horn 3-Sat is precisely CSP(B3H ). Example 6. Let Ble be a structure with universe {0, 1}, one ternary relation {(x, y, z) | x + y + z = 1(mod 2)}, and one unary relation {0}. It is well known, and easy to verify, that CSP(Ble ) is the problem of solving systems of linear equations (with at most 3 variables per equation) over the two-element field. For any subset I of A, any homomorphism from A|I to B is called a partial homomorphism from A to B. A projective homomorphism from A to B is a partial mapping h from A to B such that, for any R ∈ τ (say, of arity n) and any tuple (a1 , . . . , an ) ∈ RA , there exists a tuple (b1 , . . . , bn ) ∈ RB such that h(ai ) = bi for every ai in dom(h), the domain of h. Clearly, every projective homomorphism is also a partial homomorphism. A retract of a structure B is an induced substructure B0 of B such that there is a homomorphism g : B → B0 with g(b) = b for every b ∈ B 0 . In this case we (trivially) have that CSP(B) and CSP(B0 ) coincide. A structure is called a core if it has no homomorphism to any of its proper substructures. A retract of B that has minimal size among all retracts of B is called a core of B. It is well known that all cores of a structure are isomorphic, and so one speaks of the core, core(B), of a structure B. 2.2 Obstructions and dualities In order to define some of our dualities, we will need the notions of pathwidth and treewidth of relational structures. Definition 1. For 0 ≤ j ≤ k, a τ -structure A is said to have treewidth at most (j, k) if there is a tree T , called a tree-decomposition of A, such that 1. 2. 3. 4. the nodes of T are subsets of A of size at most k, adjacent nodes can share at most j elements, nodes containing any given element of A form a subtree, for any tuple in any relation in A, there is a node in T containing all elements from that tuple. If T is a path then it is called a path-decomposition of A, and A is said to have pathwidth at most (j, k). Example 7. 1. Consider the graph G from Fig. 1. The top-left decomposition shows that G has treewidth at most (1,3), the top-right and the bottom decompositions imply that G has pathwidth at most (1,5) and at most (2,4), respectively. Dualities for constraint satisfaction problems h G has treewidth at most (1,3) i G has pathwidth at most (1,5) c G b d 5 a e g f G has pathwidth at most (2,4) g d a e b a h c i b b f a c Fig. 1. Examples of pathwidth and treewidth. 2. Any cycle has pathwidth at most (2,3). Indeed, assume that the nodes of the cycle are 0, 1, . . . , n − 1 and the edges are (i, i + 1), where addition is modulo n. Consider a path with nodes S1 , S2 , . . . , Sn−2 where Si = {0, i, i + 1}. It is easy to check that this is a path-decomposition of the cycle. 3. Any tree has treewidth at most (1,2). Indeed, take T to have the edges of the original tree as nodes and the adjacency relation given by the incidence relation of edges in the original tree. Note that we use two numbers to parameterise treewidth and pathwidth, as is customary in the study of CSPs [20, 28, 54] (rather than one as is customary in graph theory [34]), for the following reason. The first parameter j gives a more convenient parameterisation of CSPs, since the second parameter k is bounded from below by the maximum arity of a relation in a structure, and hence it is less convenient to use for uniform treatment of structures of different vocabularies that behave essentially in the same way with respect to homomorphisms. Nevertheless, the notions of pathwidth and treewidth of relational structures are closely related to the corresponding notions from graph theory, as follows. The Gaifman graph G(A) of a structure A is defined to have the same universe (set of vertices) as A and the edges of G(A) are the pairs (a, a0 ) of distinct elements such that a and a0 appear in the same tuple in some relation in A. Then it is not hard to check that the following numbers are equal: – the minimum k such that A has pathwidth (treewidth) at most (k, k + 1), – pathwidth (treewidth, respectively) of G(A) in the sense of graph theory. Definition 2. A set O of τ -structures is called an obstruction set for B if, for any τ -structure A, A → B if and only if A0 6→ A for all A0 ∈ O. 6 A. Bulatov, A. Krokhin and B. Larose Note that sometimes such sets are called “complete obstruction sets”. Definition 3. A structure B is said to have finite duality if it has a finite obstruction set. Example 8. Let Tn be the transitive tournament on n vertices, that is, the universe of Tn is {0, 1, . . . , n − 1}, and the only relation is the binary relation {(i, j) | 0 ≤ i < j ≤ n − 1}. Also, let Pn be the directed path on n + 1 vertices, that is the structure with universe {0, 1, . . . , n} and the relation {(i, i + 1) | 0 ≤ i ≤ n − 1}. It is well known (see, e.g., Proposition 1.20 of [34]) and easy to show that, for any digraph G, G → Tn if and only if Pn 6→ G. Hence, {Pn } is an obstruction set for Tn , and Tn has finite duality. Definition 4. A τ -structure B is said to have (j, k)-pathwidth duality4 if it has an obstruction set consisting of structures of pathwidth at most (j, k). In other words, B has (j, k)-pathwidth duality if, for any τ -structure A, we have A → B if and only if C → A implies C → B for every τ -structure C of pathwidth at most (j, k). We say that B has j-pathwidth duality if it has (j, k)-pathwidth duality for some k ≥ j, and B has bounded pathwidth duality if it has j-pathwidth duality for some j ≥ 0. Example 9. It is well known that a graph G is 2-colourable if and only if it contains no odd cycles, which is the same as to say that G does not admit a homomorphism from any odd cycle. Since the 2-colourability problem is the same as CSP(K2 ), we obtain that the family of all odd cycles forms an obstruction set for K2 . By Example 7, any cycle has pathwidth at most (2,3), so the structure K2 has (2,3)-pathwidth duality. It is easy to see that K2 does not have finite duality. Definition 5. By replacing “pathwidth” with “treewidth” throughout Definition 4, one obtains the corresponding definitions of treewidth dualities. Example 10. The structure Bps from Example 4 has (1,3)-treewidth duality. To prove this, we need to show that, for any structure A ∈ co-CSP(Bps ), there exists a structure C ∈ co-CSP(Bps ) such that C → A and C has treewidth at most (1,3). If A ∈ co-CSP(Bps ) then we can choose some terminal node in A that can be “accessed” (or “derived”) from the source nodes. It is clear that this derivation procedure can be represented as a “tree”, as shown in Fig. 2. The substructure A0 of A (corresponding to the derivation) is shown on the right; d and e are source nodes, t is a terminal node, and every oval depicts a unit derivation via a triple from the relation P A . Now modify the structure A0 as follows: for every element x ∈ A0 , give new names to the occurrences of x in A0 so that each element in the obtained structure appears either in a single oval or else in two ovals such that this element is the intersection of the two ovals, and then modify the set of source nodes accordingly. Let C be the obtained structure 4 Called (j, k)-path duality in [20]. Dualities for constraint satisfaction problems 7 (see Fig. 2, left). It is clear that C has treewidth at most (1,3). Furthermore, we have C ∈ co-CSP(Bps ) because a terminal node is still accessible from the source nodes, and we also have that C → A because the reverse renaming of elements is a homomorphism from C to A0 , and hence to A. t t C → A′ a ∧ b a ∧ b c1 ∧ f d1∧e1 e2∧d2 d4 ∧ c2 d3∧e3 c ∧ f d∧e e∧d d ∧ c d∧e Fig. 2. (1,3)-treewidth duality for the structure Bps . 2.3 Datalog and infinitary logics For logical descriptions of the three dualities, we use first-order logic, the logic programming language Datalog, and its restriction, linear Datalog, and also some infinitary finite-variable logics. We assume that the reader is familiar with firstorder logic, and we now briefly describe the basics of Datalog (for more details, see, e.g., [45]). Fix a vocabulary τ . A Datalog program is a finite set of rules of the form t0 : − t1 , . . . , tn where each ti is an atomic formula R(xi1 , . . . , xik ). Then t0 is called the head of the rule, and the sequence t1 , . . . , tn the body of the rule. The predicates occurring in the heads of the rules are not from τ and are called IDBs (from “intensional database predicates”), while all other predicates come from τ and are called EDBs (from “extensional database predicates”). One of the IDBs, which is usually 0-ary in our case, is designated as the goal predicate of the program. Since the IDBs may occur in the bodies of rules, each Datalog program is a recursive specification of the IDBs, with semantics obtained via least fixed-points of monotone operators. The goal predicate is assumed to be initially set to false, and we say that a Datalog program accepts a τ -structure A if its goal predicate evaluates to true on A. For 0 ≤ j ≤ k, a (j, k)-Datalog program is a Datalog program with at most j variables in the head and at most k variables per rule. A Datalog program is called linear if every rule in it has at most one occurrence of an IDB in its body. 8 A. Bulatov, A. Krokhin and B. Larose A class C of structures is said to be definable in (linear) (j, k)-Datalog if there is a (linear) (j, k)-Datalog program which accepts precisely the structures from C. Note that, for any Datalog program, the class C of all structures accepted by the program is closed under extension (that is, if a structure A has a substructure A0 which is in C then A is also in C). Every class of the form co-CSP(B) has this monotonicity property, but it is not the case for CSP(B). Hence, when using Datalog to study CSPs, one usually speaks of definability of co-CSP(B) in (some version of) Datalog. Example 11. Consider the structure B3H from Example 5. It is well known that Horn 3-Sat can be solved by the unit propagation algorithm which can be represented as the following Datalog program. T (X) : − U (X) T (Z) : − P (X, Y, Z), T (X), T (Y ) unsat : − N (X, Y, Z), T (X), T (Y ), T (Z) Hence, co-CSP(B3H ) is definable in (1,3)-Datalog. Example 12. The following linear (2,4)-Datalog program accepts a graph (as a structure with one binary relation E) if and only if the graph is non-2-colourable Odd(X, Y ) : − E(X, Y ) Odd(X, Y ) : − Odd(X, Z), E(Z, T ), E(T, Y ) non2col : − Odd(X, X) It is easy to see how to modify this program so that it accepts a digraph if and only if the digraph is not 2-colourable (just add all rules obtained from the second rule by permuting Z, T , and Y in the part E(Z, T ), E(T, Y )). Hence, co-CSP(K2 ) is definable in linear (2,4)-Datalog. The notion of a canonical (j, k)-Datalog program for a τ -structure B has proved to be useful in the study of dualities [28]. Let τ = {R1 , . . . , Rn }, and let S0 , S1 , . . . , Sp be an enumeration of relations of arity j on B that can be expressed by a first-order ∃∧-formula over B. Assume that S0 is the empty relation. For each Si , introduce a j-ary IDB Ii . Then the canonical (j, k)-Datalog program for B involves the IDBs I0 , . . . , Ip and EDBs R1 , . . . , Rn , and contains all the rules with at most k variables with the following property: if every Ii in the rule is replaced by Si and every Rs by RsB , then every assignment of elements of B to the variables that satisfies the conjunction of atomic formulas in the body must also satisfy the atomic formula in the head. Finally, introduce one 0-ary IDB G together with the rule G : − I0 (x1 , . . . , xj ), and make G the goal predicate of the program. The canonical linear (j, k)-Datalog program for B consists of all linear rules from the canonical program described above. Our definitions of infinitary logics are inspired by [20,V 45, 47]. Let L∞ω be the first-order logic extended with infinitary conjunctions and infinitary disW junctions . For every k ≥ 0, let ∃Lk∞ω be the existential positive (i.e., without Dualities for constraint satisfaction problems 9 negation and universal quantifiers) fragment V of L∞ω with at most k different variables. A (possibly infinitary) conjunction Φ of L∞ω -formulas is said to be j-restricted if every formula from Φ that contains more than j free variables is quantifier-free, and it is said to be strongly j-restricted if, in addition, at most one formula in Φ having quantifiers is not a sentence. Then ∃Lj,k ∞ω is the fragment of ∃Lk∞ω obtained by using atomic formulas, existential quantification, arbitrary disjunctions, and j-restricted conjunctions. It is known that every class of strucj,k tures definable in (j, k)-Datalog is also definable in ∃Lj,k ∞ω . The logic ∃M∞ω j,k is defined similarly to ∃L∞ω , but with strongly j-restricted conjunctions, and definability in linear (j, k)-Datalog implies definability in this logic. We will also need the infinitary counting logics. Let C∞ω (see [3, 55]) be the logic whose formulas are obtained from atomic formulas by using negation, infinitary conjunction and disjunction, and counting quantifiers (∃i x for any k i ≥ 0). The fragment C∞ω consists of those of C∞ω in which at most S formulas ω k k distinct variables appear, and C∞ω = k∈ω C∞ω . 2.4 Pebble games We will now define two pebble games, the pebble-relation game and the existential pebble game, which have proved to be very useful in the analysis of pathwidth and treewidth dualities. These games have been introduced in [20] and [46], respectively. Let 0 ≤ j ≤ k, and let A and B be τ -structures. The (j, k)-pebble-relation (or (j, k)-PR) game on (A, B) is played between two players, the Spoiler and the Duplicator. A configuration of the game consists of a subset I ⊆ A with |I| ≤ k and a collection of partial homomorphisms T ⊆ hom(A|I , B). If T ⊆ hom(A|I , B) then we say that I is the domain of T . For a subset J ⊆ I, let T|J denote the set {f|J | f ∈ T }. Initially, I = ∅ and T contains the (unique) homomorphism from A|∅ to B. Each round of the game consists of a move of the Spoiler and a move of the Duplicator. Intuitively, the Spoiler has control on the domain I of T , which can be regarded as placing some pebbles on the elements of A that constitute I, whereas the Duplicator decides the content of T after the domain I has been set by the Spoiler. There are two types of rounds: shrinking and blowing rounds. Let T n be the configuration after the n-th round. The Spoiler decides whether the following round is a blowing or shrinking round. – If the (n + 1)-th round is a shrinking round, the Spoiler sets I n+1 to be a non-empty subset of the domain I n of T n . The Duplicator responds by restricting every function in T n onto I n+1 , that is, T n+1 = T|Inn+1 . – A blowing round only can be performed if |I n | ≤ j. In this case the Spoiler sets I n+1 to be a superset of I n with |I n+1 | ≤ k. The Duplicator responds by providing a family T n+1 ⊆ hom(A|I n+1 , B) such that T|In+1 ⊆ T n. n The Spoiler wins the game if the response of the Duplicator sets T n+1 to ∅, i.e., the Duplicator cannot extend successfully any of the partial homomorphisms 10 A. Bulatov, A. Krokhin and B. Larose from T n . Otherwise, the game resumes. The Duplicator wins the game if he has a strategy that allows him to play “forever”, i.e., if the Spoiler can never win a round of the game. The notion of winning strategy for the Duplicator can be conveniently formalised as follows. Definition 6. Let 0 ≤ j < k, and let A and B be τ -structures. We say that the Duplicator has a winning strategy for the (j, k)-pebble-relation game on (A,B) if there is a non-empty family H of sets of partial homomorphisms such that: 1. for every T ∈ H, T ⊆ hom(A|I , B) for some I ⊆ A, |I| ≤ k, and ∅ 6∈ T , 2. H is closed under restrictions: for every T ∈ H with domain I and every I 0 ⊆ I, we have that T|I 0 ∈ H, 3. H has the (j, k)-forth property: for every T ∈ H with domain I, |I| ≤ j, and every superset I 0 of I with |I 0 | ≤ k, there exists T 0 ∈ H with domain I 0 such that T|I0 ⊆ T . The intuition behind the above definition is that every set T in a winning strategy corresponds to a winning configuration for the Duplicator in the game. If we impose the restriction that every configuration in the (j, k)-PR game consists of a single function (i.e., in every round, the Duplicator commits to a particular partial homomorphism) then the obtained game is known as the existential (j, k)-pebble game. The notion of a winning strategy for the Duplicator in this game is obtained in a natural way from the one in Definition 6, by restricting each set T to consist of a single partial homomorphism. Note that if we have a homomorphism h : A → B then the Duplicator always has a winning strategy in any PR or existential pebble game on (A, B): to win, the Duplicator only has to always include the suitable restriction of the homomorphism h in his response. However, the converse does not always hold. That is, the existence of a winning strategy for the Duplicator on (A, B) does not, in general, imply that A → B (see Example 13 below). Thus, the structures B, for which the converse also holds (for a particular type of game), must have some special properties. These properties are closely related with dualities, as we will discuss in Sections 4 and 5. Example 13. Let A be the undirected cycle with 5 nodes and B the undirected cycle with 6 nodes. Obviously, we have A 6→ B, but the Duplicator still wins the existential (1,2)-pebble game. Indeed, fix any two adjacent elements, b1 and b2 in B, and let the winning strategy simply contain all partial homomorphisms that have at most two-element domains and range {b1 , b2 }. It is straightforward to check that this is indeed a winning strategy. However, it is not hard to verify that the Spoiler wins the existential (2,3)-pebble game on (A, B). 2.5 Algebraic background The algebraic approach to constraint satisfaction (see, e.g., [11–13, 17, 50]) has proved to be extremely successful. It provides a convenient dual language to Dualities for constraint satisfaction problems 11 analyse CSPs, and, more importantly, allows one to use powerful machinery from universal algebra. First, let us formally define polymorphisms of relations and structures. Definition 7. Let f be an n-ary operation on B, and R a relation on B. Then f is said to be a polymorphism of R (or R is invariant under f ) if, for any tuples ā1 , . . . , ān ∈ R, the tuple obtained by applying f componentwise also belongs to the relation R. An operation is called a polymorphism of a relational structure if it is a polymorphism of every relation in the structure. Let Pol(B) denote the set of all polymorphisms (of all arities) of a structure B. Qn For τ -structures B1 , . . . , Bn , define the direct product structure C = i=1 Bi to be a τ -structure with base set C = B1 × . . . × Bn , and, for any m-ary R ∈ τ , let (a1 , . . . , am ) ∈ RC if and only if (a1 [i], . . . , am [i]) ∈ RBi for each 1 ≤ i ≤ n. As usual, the direct product of n copies of a structure B is called the n-th power of B, and is denoted Bn . It is easy to check that the n-ary polymorphisms of B are precisely the homomorphisms from Bn to B. Example 14. It is straightforward to verify that the Boolean relation OR = {0, 1}2 \ {(0, 0)} is invariant under the binary operation max on {0, 1}, but is not invariant under the operation min. One nice feature of the polymorphisms is that they allow one to simultaneously deal with structures over different vocabularies. For example, it is known (see [12] or [42]) that if τ1 -structure B1 and τ2 -structure B2 have the same universe and Pol(B1 ) ⊆ Pol(B2 ) then every relation in B2 can be defined by a primitive positive first-order formula (i.e., ∃∧-formula with equality) in B1 , and hence the problem CSP(B2 ) is polynomial-time (even logarithmic-space) reducible to CSP(B1 ). In particular, if Pol(B1 ) = Pol(B2 ) then CSP(B1 ) and CSP(B2 ) are equivalent. Hence, it is very convenient to group relational structures according to their polymorphisms. Note that sets of operations of the form Pol(B) are clones of operations, they are well-studied objects in universal algebra (see, e.g., [63]). We will now define some types of operations which will be useful in the subsequent sections. Definition 8. An n-ary operation f on B is called idempotent if it satisfies the identity f (x, . . . , x) = x. – A binary commutative idempotent operation f is called a 2-semilattice operation if it satisfies the identity f (x, f (x, y)) = f (x, y). – An n-ary (n ≥ 2) operation f is called totally symmetric if f (x1 , . . . , xn ) = f (y1 , . . . , yn ) whenever {x1 , . . . , xn } = {y1 , . . . , yn }. If, in addition, f is idempotent then we say that it is a TSI operation. – An n-ary (n ≥ 3) operation is called an NU (near-unanimity) operation if it satisfies the identities f (y, x, . . . , x, x) = f (x, y, . . . , x, x) = . . . = f (x, x, . . . , x, y) = x. 12 A. Bulatov, A. Krokhin and B. Larose – A ternary NU operation is called a majority operation. – An n-ary (n ≥ 2) idempotent operation is called a WNU (weak NU) operation if it satisfies the identities f (y, x, . . . , x, x) = f (x, y, . . . , x, x) = . . . = f (x, x, . . . , x, y). Example 15. 1. For any binary idempotent operation f , the following conditions are equivalent: (a) f is a TSI operation, (b) f is a WNU operation, and (c) f is commutative. 2. A binary operation g is called conservative if g(a, b) ∈ {a, b} for all a, b. Any binary commutative conservative operation is a 2-semilattice operation. 3. Let f be a binary idempotent commutative associative operation. Then f is called a semilattice operation. It is easy to see that f is also a 2-semilattice operation, and, for any n ≥ 2, the operation f (x1 , f (x2 , f (. . . , f (xn−1 , xn ) . . .) is a TSI operation. 4. It is easy to check that the (ternary) median operation on a totally ordered set is a majority operation. 5. Any TSI operation and any NU operation is a WNU operation. Also, the Boolean affine operation f (x, y, z) = x + y + z(mod 2) is a WNU operation. Example 16. Schaefer’s celebrated dichotomy theorem for Boolean CSP can be restated (see, e.g., [12, 17, 50]) as follows. For a Boolean core structure B, if B has a semilattice polymorphism, or a majority polymorphism, or the affine polymorphism, then CSP(B) is in PTIME. In all other cases, CSP(B) is NPcomplete. A refinement of this theorem, including a classification for definability in Datalog and its restrictions, can be found in [52]. The subsequent definitions in this subsection are sketchy, for more details see the surveys [13, 16] or the monograph [40]. Definition 9. A finite algebra is a pair A = (A, F ) where A is a finite set and F = (fi )i∈I is a family of finitary operations on A. For a relational structure B, the algebra AB = (B, Pol(B)) is called the algebra associated with B. Definition 10. A variety is a class of algebras closed under taking homomorphic images, subalgebras, and (possibly infinite) direct products. The variety generated by a finite algebra A, denoted var(A), consists of all homomorphic images of subalgebras of direct powers of A. Every finite algebra A can be assigned a set of types. The types are numbers from 1 to 5, and they correspond to different possible basic “local behaviours” of the algebra. The correspondence is as follows: type type type type type 1 2 3 4 5 – – – – – unary algebra, vector space over a finite field, 2-element Boolean algebra, 2-element lattice, 2-element semilattice. Dualities for constraint satisfaction problems 13 A variety is said to admit a type i if this type occurs in some finite algebra in the variety, and it omits type i otherwise. It is known (see [12, 13, 50]) that if, for a core structure B, the variety var(AB ) admits type 1 (or, equivalently, B has no WNU polymorphism of any arity [57]) then CSP(B) is NP-complete. Moreover, all core structures B that are known to give rise to NP-complete problems CSP(B) do satisfy this condition. It has been conjectured that all other core structures give rise to problems in PTIME, and this conjecture has been confirmed in many important cases (see, e.g., [7, 10, 12, 13]). For other results about the correspondence between the type set of var(AB ) on one side and the computational and descriptive complexity of CSP(B) on the other side, see [3, 13, 52]. 3 Finite duality Arguably, the simplest case of duality is that of finite duality. In this section, we outline several characterisations of constraint satisfaction problems with this property. We shall address, in particular, questions about the relationship of finite duality to definability in first-order logic (FO), the nature of the obstruction set of a structure with finite duality, and the (meta-)problem of recognising such structures. Recall from Example 8 that the transitive tournament Tn has an obstruction set consisting of a single structure Pn . In general, a structure with finite duality might not have a set of obstructions that consists of a single structure: Example 17. Let B = h{0, 1}; R, {0}, {1}i where R = {(0, 0), (0, 1), (1, 0)}. Viewing structures of this type as coloured digraphs (with colours given by the unary relations), it is easy to see that A 6→ B if and only if there exists a vertex v of A which is coloured with both colours 0 and 1, or an edge (a, b) with both endpoints coloured 1. Consequently B has a two-element obstruction set, one structure A1 consisting of a single vertex with two colours, the other structure A2 consisting of one directed edge with both ends coloured 1. It is easy to see that B does not have a one-element obstruction set. Example 18. Recall the problem Unreachability, or CSP(Bunr ) from Example 3. It is not difficult to see that Bunr does not have finite duality. As in Example 17, we can view structures as coloured digraphs. Note that any path with ends coloured 0 and 1 does not have a homomorphism to Bunr , but any proper substructure of the path does. If O is a finite obstruction set for Bunr , then one can find a long enough path P (with coloured ends) such that every structure in O can have only non-surjective homomorphisms (if any) to P. Hence, either none of the structures in O has a homomorphism to P or some structure in O has a homomorphism to Bunr . In either case, O cannot be an obstruction set for Bunr . It is easy to see that if a structure B has finite duality then CSP(B) is FO-definable; in fact, co-CSP(B) is definable in existential positive FO, or said 14 A. Bulatov, A. Krokhin and B. Larose differently, it is definable in Datalog without IDBs other than the goal predicate. Indeed, let C be a τ -structure V with V C = {c1 , . . . , cl }, and consider the following sentence TC = ∃x1 . . . ∃xl R∈τ (ci ,...,cir )∈RC R(xi1 , . . . , xir ). It is well known 1 and easy to check that, for any τ -structure A, we have C → A if and only if A satisfies TC . Hence, if O is a finite obstruction set for a τ -structure B, then a W τ -structure A belongs to co-CSP(B) if and only if the sentence C∈O TC holds true in A. Atserias ([2], see also [62]) has shown that the converse also holds: if CSP(B) is FO-definable then B has finite duality. We now show how this result follows from other, more recent, results. Theorem 1 ([52]). If a structure B does not have finite duality then CSP(B) is LOGSPACE-hard under first-order reductions. Recall that the complexity class non-uniform AC0 consists of all languages accepted by polynomial-size constant-depth families of Boolean circuits (see, e.g., [55]). It is known that any FO-definable class of structures belongs to this complexity class (see Theorem 6.4 of [55]). Moreover, any problem which is LOGSPACE-hard under first-order reductions cannot lie in non-uniform AC0 because there are problems in LOGSPACE which are not in non-uniform AC0 (see [30]) and non-uniform AC0 is closed under first-order reductions. These facts and Theorem 1 imply the following result. Theorem 2. For any structure B, the following conditions are equivalent: 1. B has finite duality. 2. CSP(B) is FO-definable. 3. CSP(B) is in non-uniform AC0 . Let us now consider the question about the nature of finite obstruction sets. Definition 11. Let A be a τ -structure. The incidence multigraph of A, denoted Inc(A), is defined as the bipartite multigraph with parts A and Block(A), where Block(A) consists of all pairs (R, a) such that R ∈ τ and a ∈ RA , and with edges ea,i,Z joining a ∈ A to Z = (R, (a1 , . . . , ar )) ∈ Block(A) when ai = a. We say that the structure A is a τ -tree (or simply a tree) if its incidence multigraph is a tree (in particular, it has no multiple edges). Theorem 3 ([59, 60]). If a finite structure has finite duality, then it admits an obstruction set consisting of finitely many trees. Conversely, for any finite set O of trees, there is a structure B that can be explicitly constructed from O such that O = OB . Note that the structure B obtained in the above theorem may not be a core; in fact, it may be much larger than its core. We now give an algebraic characterisation of structures with finite duality. Dualities for constraint satisfaction problems 15 Definition 12. Let R be a relation on the set A. An n-ary operation f on A is a 1-tolerant polymorphism of R if, for any tuples ā1 , . . . , ān at least n − 1 of which belong to R, the tuple obtained by applying f componentwise also belongs to R. Theorem 4 ([51]). A structure B has finite duality if and only if its core has a 1-tolerant NU polymorphism. In fact, the arity of such a 1-tolerant NU polymorphism is determined by the total number of tuples in the relations of minimal obstructions. A structure A is a critical obstruction of B if A 6→ B and A0 → B for any proper substructure A0 of A. Call any tuple of any relation of a structure A a hyperedge of this structure. Then we have the following: Theorem 5 ([51]). The core of B admits a 1-tolerant NU polymorphism of arity n + 1 if and only if each critical obstruction of B has at most n hyperedges. Example 19. 1. The transitive tournament Tn of Example 8 admits a 1-tolerant NU polymorphism of arity n + 1, but none of smaller arity (even though it has a majority polymorphism). 2. The structure B of Example 17 admits a 1-tolerant NU polymorphism of arity 4, but not 3. Indeed, if m was a ternary 1-tolerant NU polymorphism of the relation R of B, we would have (1, 1) = (m(1, 1, 0), m(1, 0, 1)) ∈ R, which is false. On the other hand, it is straightforward to check that the 4-ary operation f such that f (x1 , . . . , x4 ) = 1 if and only if at most one xi is equal to 0 is a 1-tolerant NU polymorphism of B. This structure also has a majority polymorphism. Core structures with finite duality that admit a majority polymorphism were described in [56]. For a τ -tree A, we say that an element of A is a leaf if it is incident to exactly one block in Inc(A). A block of A (i.e., a member of Block(A)) is said to be pendant if it is incident to at most one non-leaf element, and it is said to be non-pendant otherwise. We say that a τ -tree is a τ -caterpillar (or simply a caterpillar) if each of its blocks is incident to at most two non-leaf elements, and each element is incident to at most two non-pendant blocks. Theorem 6 ([56]). Let B be a core with finite duality. Then B has a majority polymorphism if and only if it has an obstruction set consisting of finitely many caterpillars. Call a relation R on B biredundant if the projection of R onto some two coordinates is the equality relation on some subset C ⊆ B with |C| ≥ 2. Theorem 7 ([25, 51]). Let B1 and B2 be structures such that B1 is a core with finite duality and Pol(B1 ) ⊆ Pol(B2 ). Then the following holds. 1. If B2 does not have finite duality then CSP(B2 ) is LOGSPACE-complete. 16 A. Bulatov, A. Krokhin and B. Larose 2. If none of the relations in B2 is biredundant then B2 also has finite duality. If B2 is a core then the converse holds as well. Example 20. We will now describe Boolean structures that are cores with finite duality. (Boolean non-core structures trivially have this property). It can be derived from [51, 52] that these are precisely the (Boolean) core structures B without biredundant relations and such that (at least) one of the ternary operations x ∨ (y ∧ z̄) and x ∧ (y ∨ z̄) is a polymorphism of B. We shall now describe a simple algorithm to determine if a structure B has finite duality. A slight modification of this algorithm also provides a way of producing solutions of a CSP with finite duality. First, we require a few straightforward definitions. Definition 13. Let A be a structure and let a, b ∈ A. We say that the element a dominates the element b if, in any tuple t in any relation R in A, replacement in t of any number of occurrences of b by a yields a tuple also in R. For example, if a dominates b and (b, c, b) ∈ R then (a, c, b), (b, c, a), and (a, c, a) are all in R. Note that this notion is a direct generalisation of the notion of domination in graph theory. Recall from Section 2.5 the definition of the n-th power of a structure. Obviously, the second power B2 of a structure B is called the square of B. The diagonal ∆(B2 ) of the square B2 is the substructure of B2 induced by the set {(b, b) | b ∈ B}. Note that ∆(B2 ) is isomorphic to B. Definition 14. A structure A is said to dismantle to its substructure C if there exists a sequence of induced substructures A0 , . . . , Ak of A such that (i) A0 = A, (ii) Ak = C and (iii) for each 0 ≤ j < k the structure Aj+1 is obtained from Aj by removal of a dominated element of Aj . It is known [51] that the procedure of dismantling can always be done greedily, by successively removing arbitrary dominated elements in substructures of A to eventually obtain C. Theorem 8 ([51]). A structure B has finite duality if and only if it has a retract A whose square A2 dismantles to its diagonal ∆(A2 ). Example 21. Consider the tournament T3 (see Example 8). We know that T3 is a core with finite duality, so its square T23 should dismantle to its diagonal. We will now show that this is indeed the case. The process of dismantling is shown on Fig. 3. The digraph T23 is shown in Fig. 3, top-left. The vertices (2, 0) and (0, 2) are dominated by all vertices, so they are removed, and the resulting digraph is shown in Fig. 3, top-right. Next, the vertices (1, 0) and (0, 1) are now dominated by (0, 0), so they are are removed (see Fig. 3, bottom-left). Finally, the vertices (1, 2) and (2, 1) are now dominated by (2, 2), so they are removed as well, which leaves only the diagonal ∆(T23 ), shown in Fig. 3, bottom-right. Dualities for constraint satisfaction problems (2,0) (2,1) (2,2) (1,0) (1,1) (1,2) (0,0) (0,1) (0,2) (2,1) (2,2) (1,1) (1,2) (0,0) (2,1) (2,2) (1,0) (1,1) (1,2) (0,0) (0,1) 17 (2,2) (1,1) (0,0) Fig. 3. Dismantling T23 to its diagonal. From Theorem 8, the problem of recognising structures with finite duality is in NP. Indeed, one only needs to guess a mapping φ from B onto its subset A, and then to check that the induced (by A) substructure A of B is a retract of B (via φ), then to form the square A2 and, finally, to check (greedily) that A2 dismantles to its diagonal, which clearly can all be done in polynomial time. Theorem 9 ([51]). 1. The problem of deciding whether a given structure B has finite duality is NP-complete. 2. The problem of deciding whether a given structure B is a core with finite duality is in PTIME. We now present a slight modification of this algorithm which will yield a solution to the CSP when one exists. In a product A × B, an element (a, b) is said to be dominated in the second coordinate if it is dominated by an element of the form (a, b0 ). We say that A × B dismantles in the second coordinate to its substructure C if C can be obtained from A × B by successively removing elements that are dominated in the second coordinate. Theorem 10 ([51]). Let B be a core with finite duality and let A be a structure similar to B. Let C be a structure with no dominations which is obtained from A × B by dismantling in the second coordinate. Then A → B if and only if C is the graph of a homomorphism from A to B. 18 A. Bulatov, A. Krokhin and B. Larose In other words, the procedure is as follows: (i) dismantle greedily the product A × B in the second coordinate until no dominations are left; (ii) check if the resulting set is of the form C = {(a, φ(a)) : a ∈ A} for some map φ : A → B; if it is, verify that φ is a homomorphism. Then either it is and φ is the desired solution, or else there is no homomorphism from A to B. Note that the result remains valid not only for cores, but for any structure B whose square dismantles to the diagonal. 4 Bounded pathwidth duality In this section we consider bounded pathwidth duality, which is a property shared by all structures B such that CSP(B) is currently known to belong to NL. The following result ties together pathwidth dualities, linear Datalog, and PR games. Theorem 11 ([20]). For any structure B, the following conditions are equivalent: 1. 2. 3. 4. 5. B has (j, k)-pathwidth duality. co-CSP(B) is definable in linear (j, k)-Datalog. co-CSP(B) is definable by the canonical linear (j, k)-Datalog program for B. j,k . co-CSP(B) is definable in ∃M∞ω CSP(B) is the class of all structures A such that the Duplicator wins the (j, k)-PR game on (A, B). If these conditions hold then CSP(B) is in NL. Dalmau [20] also provides other equivalent conditions, including definability in other infinitary finite-variable logics and in fragments of second-order logic. We will now give examples of structures with bounded pathwidth duality. Example 22. An oriented path is a digraph obtained from a path by orienting its edges in some way. A digraph is called a local tournament if the set of out-neighbours of any vertex induces a tournament. For example, all transitive tournaments and all directed paths (see Example 8) are local tournaments. It was shown in [37, 38] that any digraph H that is an oriented path or an acyclic local tournament has an obstruction set consisting of oriented paths. Since any oriented path has pathwidth at most (1,2), it follows that H has (1,2)-pathwidth duality. Example 23. An oriented cycle is a digraph obtained from a cycle by orienting its edges in some way. An oriented cycle is called balanced if it has the same number of edges in one direction and in the other, and it is unbalanced otherwise. It was shown in [39] that any unbalanced oriented cycle H has an obstruction set consisting of oriented paths and oriented cycles. Since oriented cycles have pathwidth at most (2,3) (see Example 7), such a digraph H has (2,3)-pathwidth duality. Moreover, if the difference between the number of edges in H going in one direction and the number of edges in the other direction is exactly one then H has an obstruction set consisting only of oriented paths [39], and so it has (1,2)-pathwidth duality. Dualities for constraint satisfaction problems 19 Example 24. A binary relation on B is called implicational (or 0/1/all) if it has one of the following three forms: (1) C × D for some C, D ⊆ B, (2) {(c, f (c) | c ∈ C} for some C ⊆ B and some permutation f on B, (3) ({c} × D) ∪ (C × {d}) for some C, D ⊆ B, c ∈ C, and d ∈ D. A structure is called implicational if all of its relations are such. For example, it is easy to show (or see [20]) that the 2-Sat problem can be represented as CSP(B) for an implicational structure B (with universe {0, 1}). It was shown in [20] that every implicational structure has (2,3)-pathwidth duality. Example 25. The class of implicative hitting-set bounded (IHS-B) relations was introduced in [19]. For k ≥ 2, a Boolean relation is in k-IHS-B+ if it can be expressed as a CNF where each clause is of the form ¬x, ¬x ∨ y, or x1 ∨ . . . ∨ xk . Dually, a Boolean relation is in k-IHS-B− if it can be expressed as a CNF where each clause is of the form x, ¬x ∨ y, or ¬x1 ∨ . . . ∨ ¬xk . It was shown in [20] that any structure Bihs (with universe {0, 1}) all whose relations are in k-IHS-B+ (or in k-IHS-B−) has (k, k − 1 + maxar(Bihs ))-pathwidth duality. We mentioned in Section 2.5 that the polymorphisms of a structure B determine the complexity of CSP(B). Similarly, the polymorphisms determine whether a structure has bounded pathwidth duality. Theorem 12 ([25, 52]). Let B1 and B2 be relational structures with the same universe and such that Pol(B1 ) ⊆ Pol(B2 ). If co-CSP(B1 ) is definable in linear Datalog, then so is co-CSP(B2 ). For a structure B, let Bc denote the structure obtained from B by adding all elements of B as singleton unary relations. Theorem 13 ([52]). For a core structure B, co-CSP(B) is definable in linear Datalog if and only if co-CSP(Bc ) is. Note that the polymorphisms of the structure Bc in the above theorem are the idempotent polymorphisms of B. Hence, for core structures, the idempotent polymorphisms determine whether a structure has bounded pathwidth duality. The only currently known sufficient algebraic condition for general structures to have bounded pathwidth duality is given by the following result: Theorem 14 ([22]). If |B| = k and B has a majority polymorphism then B has (3k + 2, 3k + maxar(B))-pathwidth duality. Note that Theorem 14 can be used to obtain bounded pathwidth duality for all structures from Examples 22-24 (though, with worse bounds). For example, it was shown in [26] that any oriented path and any unbalanced oriented cycle has a majority polymorphism, and the same can be shown for any acyclic local tournament. If B is an implicational structure then, as shown in [18], B has a majority polymorphism of a very specific form, the so-called dual discriminator. For certain types of structures B, the presence of a majority polymorphism is the dividing line, for CSP(B), between membership in PTIME (which, by 20 A. Bulatov, A. Krokhin and B. Larose Theorems 11 and 14, becomes membership in NL) and NP-completeness, that is, either B has a majority polymorphism or else CSP(B) is NP-complete. For example, this is the case when B is a structure Blhc (from Example 2) whose underlying digraph H is undirected [27]. A combinatorial description of the boundary for the classification can also be found in [27]. The structures Bihs from Example 25, with k ≥ 3 have bounded pathwidth duality, but do not have a majority polymorphism. However these structures are known to have an NU polymorphism of arity k + 1. Furthermore, it follows from known algebraic results (see, e.g., [63]) that a Boolean core structure B has an NU polymorphism (of some arity) if and only if B has a majority polymorphism or it is a structure of the form Bihs . Moreover, it can be derived from [52] that in all other cases B does not have bounded pathwidth duality. That is, we obtain the following result: Theorem 15. Let |B| = 2. Then B has bounded pathwidth duality if and only B has an NU polymorphism of some arity. It is not known whether the presence of an NU polymorphism is a sufficient condition for general structures to have bounded pathwidth duality. However, it is known that, in general, this condition is not necessary, i.e., there exist structures B such that B has bounded pathwidth duality, but no NU polymorphism of any arity. The simplest (known) structure B with these properties is obtained as follows. Take the poset Q whose Hasse diagram is shown in Fig. 4. Then B is obtained from this poset by adding all elements of the universe as singleton unary relations. An explicit description of the minimal obstructions for B in which the binary relation is a partial order (i.e., the so-called Q-zigzags) can be found in [65]. It can be easily derived from this description that B has the required properties. Fig. 4. A poset without NU polymorphisms. Let us now consider the question of which structures do not have bounded pathwidth duality. Trivially, any structure without bounded treewidth duality cannot have bounded pathwidth duality. Example 26. Reconsider the structure Bps from Example 4. This structure has 1-treewidth duality, as shown in Example 10. By using the game technique (see below), it can be shown that Bps does not have bounded pathwidth duality (an alternative proof of this can be found in [1]). Dualities for constraint satisfaction problems 21 At present, the most general algebraic necessary condition for the presence of bounded pathwidth duality is given by the following result. Theorem 16 ([52]). If a core structure B has bounded pathwidth duality then the variety var(AB ) omits types 1, 2, and 5. By using Theorem 9.11 of [40], the previous theorem can be re-stated as follows. Theorem 17. If a core structure B has bounded pathwidth duality then B has ternary polymorphisms d0 , . . . , dn , n ≥ 2, satisfying the following identities: d0 (x, y, z) = x, dn (x, y, z) = z, di (x, y, x) = di+1 (x, y, x) for all even i < n, di (x, y, y) = di+1 (x, y, y) for all even i < n, di (x, x, y) = di+1 (x, x, y) for all odd i < n. Moreover, if a core structure B does not have the polymorphisms described above (or, equivalently, the variety var(AB ) admits at least one of the types 1,2, and 5) then CSP(B) is hard for PTIME or for Modp L (for some prime p) under first-order reductions [52], and thus is unlikely to belong to NL. One very natural question about pathwidth dualities is whether they form a proper hierarchy or the hierarchy collapses to some level. That is, the question is whether there exists a number j such that, for any j 0 ≥ j, every structure with j 0 -pathwidth duality also has j-pathwidth duality. It follows from Theorem 11 that, in order to prove that a certain structure B does not have (j, k)-pathwidth duality, one only needs to provide a structure A such that the Duplicator has a winning strategy in the (j, k)-PR game on (A, B), but it holds that A 6→ B. This game technique was used in [22] to give a negative answer to the above question. Let us now describe the structures that were used in [22]. Let n ≥ 1 and let Bn be the structure with universe Bn and relations Rnl , 1 ≤ l ≤ n, defined as follows. The universe Bn is the set {1, . . . , n} × {1, 2}. For every 1 ≤ l ≤ n, Rnl is a binary symmetric relation on Bn that consists of all pairs ((i, m), (i0 , m0 )) satisfying at least one of the following conditions: – – – – i > l, i = i0 , m = m0 i = i0 = l, m 6= m0 , i < l and i0 ≤ l, i ≤ l and i0 < l. Theorem 18 ([22]). For every n ≥ 2, the structure Bn does not have npathwidth duality, but Bn has a majority polymorphism (and hence (6n + 2)pathwidth duality). The only known fact concerning the meta-problem for bounded pathwidth duality is that, for any fixed k ≥ 1, the problem of recognising structures with (1, k)-pathwidth duality is decidable [20]. 22 5 A. Bulatov, A. Krokhin and B. Larose Bounded treewidth duality In this section we consider bounded treewidth duality. Arguably, it is the most important duality because it is one of the two most general basic properties of relational structures B that are known to guarantee that the problem CSP(B) is solvable in polynomial time (the other property can be found, e.g., in [41]), and the vast majority of such structures have bounded treewidth duality. The notion of bounded treewidth duality has strong links with methods of solving constraint satisfaction problems based on establishing local consistency (see, e.g., [17, 24, 34, 43]). The following result links together treewidth dualities, Datalog, infinitary logics, and existential pebble games. Theorem 19 ([28, 47]). For any structure B, the following conditions are equivalent: 1. 2. 3. 4. 5. B has (j, k)-treewidth duality. co-CSP(B) is definable in (j, k)-Datalog. co-CSP(B) is definable by the canonical (j, k)-Datalog program for B. co-CSP(B) is expressible in ∃Lj,k ∞ω . CSP(B) consists of all structures A such that Duplicator has a winning strategy in the existential (j, k)-pebble game. If these conditions hold then CSP(B) is in PTIME. To prevent possible confusion, we note that the paper [47] speaks about definability of co-CSP(B) in k-Datalog meaning (k, k)-Datalog (in our notation). Hence, this does not exactly correspond to k-treewidth duality in our sense. In [28] and some subsequent papers (e.g., in [54]), problems CSP(B) that have j-treewidth duality (or bounded treewidth duality) are called width-j (or bounded width, respectively) problems. We will now give some examples of structures with and without bounded treewidth duality. Note that, trivially, every structure with bounded pathwidth duality also has bounded treewidth duality. Example 27. Recall the structure B3H from Example 5; the problem CSP(B3H ) is precisely Horn-3-Sat. It follows from Example 11 that B3H has (1,3)-treewidth duality. By replacing relations P B3H and N B3H in B3H with k-ary relations P BkH = {0, 1}k \{(1, . . . , 1, 1)} and N BkH = {0, 1}k \{(1, . . . , 1, 0)}, respectively, one obtains a structure BkH such that CSP(BkH ) is exactly Horn-k-Sat. An obvious modification of Example 11 shows that BkH has (1, k)-treewidth duality. Example 28. Recall from Example 23 that each unbalanced oriented cycle has (2,3)-pathwidth duality. It was shown in [26] that if H is a balanced oriented cycle then either it has bounded treewidth duality or CSP(H) is NP-complete. The description of the boundary between the cases is rather involved. Dualities for constraint satisfaction problems 23 Example 29. Let τ be the vocabulary (P, S, T, E) where P is ternary, E is binary, and S and T are unary relation symbols. Consider the τ -structure B with 4-element universe {0, 1, a, b} and relations defined as follows. Reconsider structures Bps from Example 4 and K2 from Example 9, and assume that the universe of K2 is {a, b}. If R ∈ {P, S, T } then define RB = RBps , and let E B = E K2 . We claim that the structure B has 2-treewidth duality, but neither 1-treewidth duality nor bounded pathwidth duality. It is easy to see that if a connected τ structure A homomorphically maps to B then either E A is empty or else the other three relations in A are empty. Hence, B has an obstruction set consisting of structures from OBps and OK2 (suitably expanded with empty relations) and of finitely many structures in which some element appears both in the binary relation and in one of the other three relations. Since Bps has 1-treewidth duality and K2 has (2,3)-pathwidth duality, we conclude that B has 2-treewidth duality. On the other hand, Bps does not have bounded pathwidth duality (see Example 26) and it is straightforward to show that K2 does not have 1-treewidth duality. Hence, B cannot have either of these two properties. Example 30. As we know from Example 1, the H-Coloring problem coincides with the problem CSP(Bhc ) where Bhc is the (di)graph H. If H is a bipartite graph, then core(H) = K2 and CSP(Bhc ) coincides with the 2-colourabilty problem, and Bhc hence has (2,3)-pathwidth duality (see Example 9). If H is a non-bipartite graph then CSP(Bhc ) is NP-complete [33]. It is known (see, e.g., [34]) that in this case Bhc does not have bounded treewidth duality (without any complexity-theoretic assumptions). Example 31. A triad is a digraph obtained from three oriented paths by choosing one end of each path and identifying these three vertices. It is shown in [2] that there exists a triad H such that CSP(Bhc ) is in PTIME, but H does not have bounded treewidth duality. Within the algebraic approach to the CSP, a different concept, relational width, is often very useful, see, e.g., [10]. This concept is applicable even for infinite sets of relations, but in the case of relational structures (with finite vocabulary) relational width is strongly related to treewidth duality, as we shall now see. Relational width is usually (e.g., in [7, 9, 10, 13]) defined using the “variablevalue” form (as given in Section 1) of the constraint satisfaction problem. A straightforward translation into the homomorphism form goes as follows. Definition 15. For k ≥ 1, a family M = {HI | I ⊆ A, |I| ≤ k}, where each HI is a non-empty set of mappings from I to B, is called a k-minimal family for (A, B) if 1. for any I 0 ⊆ I ⊆ A, |I| ≤ k, we have HI 0 = {h|I 0 | h ∈ HI }, and 2. for any I ⊆ A with |I| ≤ k, any h ∈ HI , any (n-ary) R ∈ τ , and any (a1 , . . . , an ) ∈ RA , there exists a tuple (b1 , . . . , bn ) ∈ RB such that (a) h(ai ) = bi for all ai ∈ I, 24 A. Bulatov, A. Krokhin and B. Larose (b) for any J ⊆ A with |J| ≤ k, there exists h0 ∈ HJ such that h0 (ai ) = bi for all ai ∈ J. A structure B is said to have relational width k if, for any structure A such that there is a k-minimal family for (A, B), we have A → B. A structure B has bounded relational width if it has relational width k for some k. Note that property 2(a) shows that every member of every HI ∈ M is a projective homomorphism, while properties 1 and 2(b) show that there is strong compatibility between different sets in M. A duality characterisation of structures of relational width k was obtained in [21]. Call a structure A a k-reltree if it has a tree-decomposition in which (i) each node with more than k elements consists of all elements in some tuple in a relation in A, and (ii) two adjacent nodes can share at most k elements. Theorem 20 ([21]). A structure has relational width k if and only if it has an obstruction set consisting of k-reltrees. The following result can be easily derived from the above theorem. Corollary 1. For any structure B, the following holds. 1. If B has (j, k)-treewidth duality, then it has relational width k. 2. If B has relational width k and maxar(B) = r, then it has (k, k 0 )-treewidth duality where k 0 = max(k, r). In particular, B has bounded treewidth duality if and only if it has bounded relational width. Note that Corollary 1 shows that there is a correspondence between the parameters of relational width and treewidth duality, but it does not show how optimal parameters for these widths are related in general. We will state results about bounded treewidth duality and bounded relational width in the way they were stated originally. By the above theorem, one can translate such results between the widths. Similarly to Theorems 12 and 13, the (idempotent) polymorphisms determine whether a (core) structure has bounded treewidth duality. Theorem 21 ([54]). Let B1 and B2 be relational structures with the same universe and such that Pol(B1 ) ⊆ Pol(B2 ). If co-CSP(B2 ) is definable in Datalog, then so is co-CSP(B1 ). Theorem 22 ([52]). For a core structure B, co-CSP(B) is definable in Datalog if and only if co-CSP(Bc ) is. We will now give examples of polymorphisms that guarantee that a structure has bounded treewidth duality. Theorem 23 ([28], see also [43]). If a structure B has a (l+1)-ary NU polymorphism then B has l-treewidth duality. Dualities for constraint satisfaction problems 25 Tree duality is just a shorter name for 1-treewidth duality. It is known [28, 51] that every structure with tree duality has an obstruction set consisting of trees in the sense of Definition 11. (Note that this fact does not follow trivially from the definition of 1-treewidth duality.) In particular, if a structure B has tree duality then it has (1, maxar(B))-treewidth duality. Structures with tree duality have been completely characterised in [28]. To state this result, we need to give a certain construction. For a τ -structure B, its power structure is a τ -structure P 1 (B) with universe consisting of all non-empty subsets of B, and, for each r-ary R ∈ τ , we have (A1 , . . . , Ar ) ∈ RP 1 (B) if and only if, for each 1 ≤ i ≤ r and each a ∈ Ai , there is (a1 , . . . , ar ) ∈ RB such that ai = a. Theorem 24 ([28], see also [24]). For any structure B, the following conditions are equivalent: 1. B has tree duality. 2. The structure P 1 (B) admits a homomorphism to B. 3. For every n ≥ 2, B has an n-ary totally symmetric polymorphism. Example 32. It is not difficult to see that, for n ≥ 2, the operation fn = is a TSI polymorphism of the structure BkH (see Example 27). Vn i=1 xi Structures with caterpillar duality (see Theorem 6 for finite caterpillar duality) can be characterised in the spirit of Theorem 24, see [14] for details. Theorem 20 implies that every structure has relational width 1 if and only if it has 1-treewidth duality. Note that, in general, the optimal parameters for relational width and treewidth duality need not be equal. For example, the structure B = K2 of Example 9 has (2,3)-treewidth duality, but not tree duality (since it has no binary TSI polymorphism). On the other hand, K2 has relational width 3 by Corollary 1, but not 2 (which can be seen by taking K3 as A). In fact, it is shown in [21] that if a structure B has relational width 2 then it has relational width 1. Theorem 25 ([9]). If a structure B has a 2-semilattice polymorphism then B has relational width 3. Some of the most studied varieties in universal algebra are the so-called congruence distributive varieties (see, e.g., [40, 44, 64]). For a core structure B, the algebra AB belongs to a congruence distributive variety if, for some n ≥ 2, B has ternary polymorphisms d0 , . . . , dn (called Jónsson operations) satisfying the identities from Theorem 17, and, in addition, such that di (x, y, x) = x for all 0 ≤ i ≤ n. In this case we say that AB is in the class CD(n). Note that AB is in CD(2) if and only if B has a majority polymorphism (which is d1 in this case). Theorem 26 ([44]). For any structure B, if the algebra AB is in CD(3) then B has relational width min(|B|2 , max(3, maxar(B))). Theorem 27 ([15]). For any structure B, if the algebra AB is in CD(4) then B has (k − 1, k)-treewidth duality where k = max(3, maxar(B)). 26 A. Bulatov, A. Krokhin and B. Larose Theorem 21 makes it possible to introduce algebras having bounded treewidth duality: An algebra A = (B; F ) has bounded treewidth duality if every structure B with universe B such that F ⊆ Pol(B) has bounded treewidth duality. The following result shows that bounded treewidth duality can be lifted further to varieties of algebras. Theorem 28 ([54]). If A is an algebra with bounded treewidth duality then every finite algebra from the variety var(A) also has bounded treewidth duality. Clearly, if CSP(B) is NP-complete, then it does not have bounded treewidth duality unless PTIME = NP. Systems of linear equations (see Example 6 in this paper or the proof of Theorem 1 of [8]), as well as problems that can “simulate” them, provide benchmark examples of structures B such that CSP(B) is in PTIME, but B does not have bounded treewidth duality [28]. Combining these two reasons for not having bounded treewidth duality, one obtains the following equivalent necessary conditions for bounded treewidth duality. Theorem 29. If a core structure B has bounded treewidth duality then the following equivalent conditions hold: 1. The variety var(AB ) omits types 1 and 2. 2. There is k ≥ 2 such that B has n-ary weak NU polymorphisms for all n ≥ k. In the above theorem, the necessity of condition (1) was proved in [54], and the equivalence of conditions (1) and (2) in [57]. It is shown in [53] that (the complement of) condition (1) is very closely related with the so-called property of “ability to count” which was introduced in [28] and conjectured there to be the main obstacle for a structure to have bounded treewidth duality. Conjecture 1 ([54]). A core structure B has bounded treewidth duality if and only if the equivalent conditions from Theorem 29 hold. A somewhat different way of applying algebras to analyse a relational structure B, via an edge-coloured graph Gr(B) of the structure, was introduced in [8] (see also [13]). The conditions in Theorem 29 can be equivalently expressed in terms of properties of this graph, and a conjecture equivalent to Conjecture 1 was made in [8, 13]. Conjecture 1 was confirmed in the following important cases, and, interestingly, the best possible bound for some width turns out to be quite small. Theorem 30 ([28]). If B is a 2-element core structure then B has bounded treewidth if and only if B has a semilattice polymorphism or a majority polymorphism. Moreover, in this case B has 2-treewidth duality. A factor of an algebra A is a homomorphic image of a subalgebra of A. Theorem 31 ([10]). If B is a core structure with |B| ≤ 3 then B has bounded relational width if and only if the algebra AB itself or each of its factors have an operation (depending on a factor) which is a majority operation or a 2-semilattice operation. Moreover, in this case B has relational width 3. Dualities for constraint satisfaction problems 27 Theorem 32 ([7]). Let B be a structure containing all unary relations. Then B has bounded relational width if and only if, for each two-element subset C ⊆ B, there is a polymorphism f ∈ Pol(B) (depending on C) such that f |C is either a semilattice operation or a majority operation. Moreover, in this case B has relational width 3. Conjecture 1 can be strengthened in the following sense. As we saw above, bounded treewidth duality is equivalent to expressibility in a certain infinitary logic. The expressive power of this logic is relatively weak, and it is natural to ask if it possible to express constraint satisfaction problems in terms of a more ω powerful logic. One such logic is C∞ω (see Section 2.3). This logic can express a number of undecidable problems (e.g., the halting problem). However, if Conjecture 1 is true than its expressive power for constraint satisfaction problems is no greater than that of Datalog. Theorem 33 ([3]). Let B be a structure. If the variety var(AB ) admits type 1 ω or 2 then CSP(B) is not expressible in C∞ω . In the direction of solving the meta-problem for bounded treewidth, the following is known. Theorem 34 ([64]). There is a polynomial time algorithm which, given a finite idempotent algebra A, checks whether the variety var(A) omits types 1 and 2. Following a strategy from [11] where the case of omitting type 1 is treated, Theorem 34 can be used to show that, for a core structure B with at most n elements (where n is any fixed number), it can be checked in polynomial time whether the variety var(AB ) omits types 1 and 2. Thus, we have the following corollary. Corollary 2. Assuming Conjecture 1 holds, the meta-problem for bounded treewidth duality is tractable for structures of bounded size. It is a natural question to determine the complexity of recognising structures with j-treewidth duality for a fixed j. For j = 1, it follows from Theorem 24 that this problem is decidable, while the proof of Theorem 6.1 of [51] implies the following lower bound. Theorem 35 ([51]). It is NP-hard to decide whether a given structure B has tree duality. In Section 4, we have considered the hierarchy problem for j-pathwidth dualities and found (see Theorem 18) that the hierarchy does not collapse. We now consider a similar problem for j-treewidth dualities. Let T Wj be the class of all structures with j-treewidth duality. Clearly, we have a hierarchy T W1 ⊆ T W2 ⊆ T W3 ⊆ T W4 ⊆ . . . . It is easy to show that T W1 T W2 . Consider the problem 2-colourability, or CSP(K2 ), from Example 9. The structure K2 has (2,3)-pathwidth duality, 28 A. Bulatov, A. Krokhin and B. Larose and hence (2,3)-treewidth duality. On the other hand, it is easy to see that K2 does not have a binary commutative polymorphism, and hence, by Theorem 24 (see also Example 15(1)), it cannot have 1-treewidth duality. Surprisingly, the question whether any other inclusion in the treewidth duality hierarchy is strict remains open. It may seem that Theorems 23, 26 and 27 contradict this claim. However, they give only an upper bound for the treewidth duality. For instance, every 2-element structure with an NU polymorphism has 2-treewidth duality. 6 6.1 Additional Remarks Symmetric Datalog A restriction of linear Datalog, symmetric Datalog, has been recently introduced in [25]. A linear Datalog program is called symmetric, if, for every rule of the form t0 : − t1 , t2 , . . . , tn (n ≥ 1), where t0 and t1 are IDBs, that appears in the program, the program also contains its “symmetric” rule t1 : − t0 , t2 , . . . , tn , obtained by formally swapping the IDBs in the rule. We say that co-CSP(B) is definable in symmetric Datalog if it is accepted by a symmetric Datalog program. In broad terms, symmetric Datalog for CSP is to LOGSPACE what linear Datalog for CSP is to NL: if co-CSP(B) is definable in symmetric Datalog then CSP(B) is in LOGSPACE, and, for all problems CSP(B) that are known to be in LOGSPACE, co-CSP(B) is definable in symmetric Datalog [25]. In particular, this holds for all Boolean problems CSP(B) in LOGSPACE. If B1 and B2 are structures such that Pol(B1 ) ⊆ Pol(B2 ) and co-CSP(B1 ) is definable in symmetric Datalog, then co-CSP(B2 ) is also definable in symmetric Datalog (compare with Theorems 12 and 21). The following analog of Theorems 16 and 29 holds for symmetric Datalog: for a core structure B, if co-CSP(B) is definable in symmetric Datalog then the variety var(AB ) omits types 1, 2, 4, and 5 (i.e., it admits only type 3) [52]. It is proved in [23] that if co-CSP(B) is definable in Datalog and B has a Mal’tsev polymorphism (i.e., a ternary polymorphism m with m(x, y, y) = m(y, y, x) = x for all x, y) then co-CSP(B) is definable in symmetric Datalog. It is shown in [25] that definability of co-CSP(B) in symmetric Datalog is equivalent to definability in a certain fragment of second order logic (this parallels a result in [20]). It would be interesting to find a convenient pebble game and an appropriate notion of duality for symmetric Datalog, in the spirit of Theorems 11 and 19. 6.2 Extending Datalog with inequality and negation One can extend (j, k)-Datalog, and the logic ∃Lj,k ∞ω by allowing the use of inequalities (6=) and negated atomic formulas (which must be EDBs in the case of Datalog). The obtained logics are denoted (j, k)-Datalog(6=, ¬) and ∃Lj,k ∞ω (6=, ¬), respectively. It was shown in [29] that these extensions do not add any expressive power for homomorphism-closed classes (e.g., such as co-CSP(B)). In other words, if a class co-CSP(B) is definable in (j, k)-Datalog(6=, ¬) then it is also Dualities for constraint satisfaction problems 29 definable in (j, k)-Datalog, and the same holds for ∃Lj,k ∞ω (6=, ¬). Moreover, a closer inspection of the proof reveals that this result remains true for linear j,k (j, k)-Datalog and the logic ∃M∞ω . 6.3 Infinite CSP Up until now we have considered only finite structures. However, one can also consider the problem of deciding whether a given finite τ -structure admits a homomorphism to a fixed infinite τ -structure B (see survey [4]). Some natural problems such as Betweenness (see [31]) and the Acyclicity problem for digraphs can be represented as CSP(B) for suitable infinitely countable structures B (but not for any finite structure B). Bounded treewidth duality for infinitely countable structures has been considered in [5, 6]. It was shown in these papers that, for general countable structures, Theorem 19 fails. However, there is a large class of structures (ω-categorical structures), for which Theorem 19 holds. Recall that a structure B is called ω-categorical if, for each n ≥ 1, there are only finitely many inequivalent first-order formulas with n free variables over B. Moreover, analogs of Theorems 23 and 24 hold for such structures. 7 A list of open questions 1. If B is a core structure with finite duality, how large can the minimal arity of its 1-tolerant NU polymorphism be? 2. Is the property of having j-pathwidth and j-treewidth duality for fixed j determined by the polymorphisms of a structure? 3. Is it true that a structure B has bounded pathwidth duality whenever CSP(B) is in NL? 4. Prove that every structure with an NU polymorphism has bounded pathwidth duality. 5. Are the conditions in Theorems 16 and 17 necessary and sufficient for a core structure to have bounded pathwidth duality? 6. Prove Conjecture 1 (that the conditions in Theorem 29 are necessary and sufficient for a core structure to have bounded treewidth duality). 7. For j ≥ 2, is there a structure P j (B) such that B has j-treewidth duality if and only if P j (B) → B (particularly, for j = 2)? 8. Does the treewidth duality hierarchy collapse (in particular, to its second level) or not? 9. Are there structures that have bounded relational width, but not relational width 3? 10. Is it true that the number k from Theorem 29 can always be chosen to be equal to 3? 11. Prove that a structure B has bounded treewidth (or even bounded pathwidth) duality whenever the algebra AB is in CD(n) for some n? 12. Find a pebble-game and a duality characterisation for structures B such that co-CSP(B) is definable in symmetric Datalog. 30 A. Bulatov, A. Krokhin and B. Larose 13. Is it true that co-CSP(B) is definable in symmetric Datalog whenever CSP(B) is in LOGSPACE? 14. Is it true that, for a core structure B, co-CSP(B) is definable in symmetric Datalog whenever the variety var(AB ) admits only type 3? 15. Are there other naturally arising dualities for the CSP? 8 Acknowledgements The authors would like to thank Catarina Carvalho, Vı́ctor Dalmau, Pavol Hell, Jarik Nešetřil, Claude Tardif and Pascal Tesson for useful discussions and helpful comments. Remarks from an anonymous reviewer are also appreciated. References 1. F. Afrati and S. Cosmodakis. Expressiveness of restricted recursive queries. In STOC’89, pages 113–126, 1989. 2. A. Atserias. On digraph coloring problems and treewidth duality. European Journal of Combinatorics, 29(4):796–820, 2008. 3. A. Atserias, A. Bulatov, and A. Dawar. Affine systems of equations and counting infinitary logic. In ICALP’07, volume 4596 of LNCS, pages 558–570, 2007. 4. M. Bodirsky. Constraint satisfaction problems with infinite templates. In The Same Volume. 2008. 5. M. Bodirsky and V. Dalmau. Datalog and constraint satisfaction with infinite templates. In STACS’06, volume 3884 of LNCS, pages 646–659, 2006. 6. M. Bodirsky and V. Dalmau. Datalog and constraint satisfaction with infinite templates, 2007. manuscript, full version. 7. A. Bulatov. Tractable conservative constraint satisfaction problems. In LICS’03, pages 321–330, 2003. 8. A. Bulatov. A graph of a relational structure and constraint satisfaction problems. In LICS’04, pages 448–457, 2004. 9. A. Bulatov. Combinatorial problems raised from 2-semilattices. Journal of Algebra, 298(2):321–339, 2006. 10. A. Bulatov. A dichotomy theorem for constraint satisfaction problems on a 3element set. Journal of the ACM, 53(1):66–120, 2006. 11. A. Bulatov and P. Jeavons. Algebraic structures in combinatorial problems. Technical Report MATH-AL-4-2001, Technische Universität Dresden, Germany, 2001. 12. A. Bulatov, P. Jeavons, and A. Krokhin. Classifying complexity of constraints using finite algebras. SIAM Journal on Computing, 34(3):720–742, 2005. 13. A. Bulatov and M. Valeriote. Recent results on the algebraic approach to the CSP. In Surveys on Complexity of Constraints. 2008. (to appear). 14. C. Carvalho, V. Dalmau, and A. Krokhin. Caterpillar duality for constraint satisfaction problems. In LICS’08, 2008. to appear. 15. C. Carvalho, V. Dalmau, P. Marković, and M. Maróti. CD(4) has bounded width. Algebra Universalis. accepted. 16. M. Clasen and M. Valeriote. Tame congruence theory. In Lectures on Algebraic Model Theory, volume 15 of Fields Institute Monographs, pages 67–111. 2002. Dualities for constraint satisfaction problems 31 17. D. Cohen and P. Jeavons. The complexity of constraint languages. In F. Rossi, P. van Beek, and T. Walsh, editors, Handbook of Constraint Programming, chapter 8. Elsevier, 2006. 18. M.C. Cooper, D.A. Cohen, and P.G. Jeavons. Characterising tractable constraints. Artificial Intelligence, 65:347–361, 1994. 19. N. Creignou, S. Khanna, and M. Sudan. Complexity Classifications of Boolean Constraint Satisfaction Problems, volume 7 of SIAM Monographs on Discrete Mathematics and Applications. 2001. 20. V. Dalmau. Linear Datalog and bounded path duality for relational structures. Logical Methods in Computer Science, 1(1), 2005. (electronic). 21. V. Dalmau. There are no pure relational width 2 constraint satisfaction problems. submitted, 2008. 22. V. Dalmau and A. Krokhin. Majority constraints have bounded pathwidth duality. European Journal of Combinatorics, 29(4):821–837, 2008. 23. V. Dalmau and B. Larose. Maltsev + Datalog ⇒ Symmetric Datalog. In LICS’08, 2008. to appear. 24. V. Dalmau and J. Pearson. Set functions and width 1 problems. In CP’99, volume 1713 of LNCS, pages 159–173, 1999. 25. L. Egri, B. Larose, and P. Tesson. Symmetric Datalog and constraint satisfaction problems in Logspace. In LICS’07, pages 193–202, 2007. 26. T. Feder. Classification of homomorphisms to oriented cycles and of k-partite satisfiability. SIAM Journal on Discrete Mathematics, 14(4):471–480, 2001. 27. T. Feder, P. Hell, and J. Huang. Bi-arc graphs and the complexity of list homomorphisms. Journal of Graph Theory, 42:61–80, 2003. 28. T. Feder and M.Y. Vardi. The computational structure of monotone monadic SNP and constraint satisfaction: A study through Datalog and group theory. SIAM Journal on Computing, 28:57–104, 1998. 29. T. Feder and M.Y. Vardi. Homomorphism closed vs. existential positive. In Proc. 18th IEEE Symp. on Logic in Computer Science, LICS’03, pages 311–320, 2003. 30. M. Furst, J. Saxe, and M. Sipser. Parity, circuits, and the polynomial-time hierarchy. Mathematical Systems Theory, 17(1):13–27, 1984. 31. M. Garey and D.S. Johnson. Computers and Intractability: A Guide to the Theory of NP-Completeness. Freeman, San Francisco, CA., 1979. 32. P. Hell. From graph colouring to constraint satisfaction: there and back again. In Topics in Discrete Mathematics, volume 26 of Algorithms and Combinatorics, pages 407–432. Springer, 2006. 33. P. Hell and J. Nešetřil. On the complexity of H-coloring. Journal of Combinatorial Theory, Ser.B, 48:92–110, 1990. 34. P. Hell and J. Nešetřil. Graphs and Homomorphisms. Oxford University Press, 2004. 35. P. Hell, J. Nešetřil, and X. Zhu. Duality and polynomial testing of tree homomorphisms. Trans. Amer. Math. Soc., 348:147–156, 1996. 36. P. Hell, J. Nešetřil, and X. Zhu. Duality of graph homomorphisms. In Combinatorics, Paul Erdös is Eighty (Vol.2), volume 2 of Bolyai Soc. Math. Stud., pages 271–282. János Bolyai Math. Soc., 1996. 37. P. Hell, H. Zhou, and X. Zhu. On homomorphisms to acyclic local tournaments. Journal of Graph Theory, 20(4):467–471, 1995. 38. P. Hell and X. Zhu. Homomorphisms to oriented paths. Discrete Mathematics, 132:107–114, 1994. 39. P. Hell and X. Zhu. The existence of homomorphisms to oriented cycles. SIAM Journal on Discrete Mathematics, 8:208–222, 1995. 32 A. Bulatov, A. Krokhin and B. Larose 40. D. Hobby and R.N. McKenzie. The Structure of Finite Algebras, volume 76 of Contemporary Mathematics. American Mathematical Society, Providence, R.I., 1988. 41. P. Idziak, P. Markovic, R. McKenzie, M. Valeriote, and R. Willard. Tractability and learnability arising from algebras with few subpowers. In LICS’07, pages 213–222, 2007. 42. P. Jeavons. On the algebraic structure of combinatorial problems. Theoretical Computer Science, 200:185–204, 1998. 43. P.G. Jeavons, D.A. Cohen, and M.C. Cooper. Constraints, consistency and closure. Artificial Intelligence, 101(1-2):251–265, 1998. 44. E.W. Kiss and M. Valeriote. On tractability and congruence distributivity. Logical Methods in Computer Science, 3(2), 2007. (electronic). 45. Ph.G. Kolaitis. On the expressive power of logics on finite models. In Finite Model Theory and its Applications, EATCS Series: Texts in Theoretical Computer Science, pages 27–124. Springer, 2007. 46. Ph.G. Kolaitis and M.Y. Vardi. On the expressive power of Datalog: tools and a case study. Journal of Computer and System Sciences, 51:110–134, 1995. 47. Ph.G. Kolaitis and M.Y. Vardi. Conjunctive-query containment and constraint satisfaction. Journal of Computer and System Sciences, 61:302–332, 2000. 48. Ph.G. Kolaitis and M.Y. Vardi. A logical approach to constraint satisfaction. In Finite Model Theory and its Applications, EATCS Series: Texts in Theoretical Computer Science, pages 339–370. Springer, 2007. 49. P. Komárek. Some new good characterisations of directed graphs. Časopis Pěst. Mat., 51:348–354, 1984. 50. A. Krokhin, A. Bulatov, and P. Jeavons. The complexity of constraint satisfaction: an algebraic approach. In Structural Theory of Automata, Semigroups, and Universal Algebra, volume 207 of NATO Science Series II: Math., Phys., Chem., pages 181–213. Springer Verlag, 2005. 51. B. Larose, C. Loten, and C. Tardif. A characterisation of first-order constraint satisfaction problems. Logical Methods in Computer Science, 3(4), 2007. (electronic). 52. B. Larose and P. Tesson. Universal algebra and hardness results for constraint satisfaction problems. Theoretical Computer Science, 2008. to appear. Preliminary version in ICALP’07, LNCS 4596, 267-278. 53. B. Larose, M. Valeriote, and L. Zádori. An algebraic characterisation of the ability to count. manuscript, 2008. 54. B. Larose and L. Zádori. Bounded width problems and algebras. Algebra Universalis, 56(3-4):439–466, 2007. 55. L. Libkin. Elements of Finite Model Theory. EATCS Series: Texts in Theoretical Computer Science. Springer, 2004. 56. C. Loten and C. Tardif. Majority functions on structures with finite duality. European Journal of Combinatorics, 29(4):979–986, 2008. 57. M. Maróti and R. McKenzie. Existence theorems for weakly symmetric operations. Algebra Universalis, 2007. to appear. 58. J. Nešetřil and A. Pultr. On classes of relations and graphs determined by subobjects and factorobjects. Discrete Mathematics, 22:287–300, 1978. 59. J. Nešetřil and C. Tardif. Duality theorems for finite structures (characterising gaps and good characterisations). Journal of Combinatorial Theory, Ser.B, 80:80–97, 2000. 60. J. Nešetřil and C. Tardif. Short answers to exponentially long questions: extremal aspects of homomorphism duality. SIAM Journal on Discrete Mathematics, 19(4):914–920, 2005. Dualities for constraint satisfaction problems 33 61. F. Rossi, P. van Beek, and T. Walsh, editors. Handbook of Constraint Programming. Elsevier, 2006. 62. B. Rossman. Existential positive types and preservation under homomorphisms. In LICS’05, pages 467–476, 2005. 63. A. Szendrei. Clones in Universal Algebra, volume 99 of Seminaires de Mathematiques Superieures. University of Montreal, 1986. 64. M. Valeriote. A subalgebra intersection property for congruence-distributive varieties. Canadian Journal of Mathematics, 2007. to appear. 65. L. Zádori. Posets, near-unanimity functions and zigzags. Bulletin of the Australian Mathematical Society, 47:79–93, 1993.