# The power of propagation: when GAC is enough

## Abstract

Considerable effort in constraint programming has focused on the development of efficient propagators for individual constraints. In this paper, we consider the combined power of such propagators when applied to collections of more than one constraint. In particular we identify classes of constraint problems where such propagators can decide the existence of a solution on their own, without the need for any additional search. Sporadic examples of such classes have previously been identified, including classes based on restricting the structure of the problem, restricting the constraint types, and some hybrid examples. However, there has previously been no unifying approach which characterises all of these classes: structural, language-based and hybrid. In this paper we develop such a unifying approach and embed all the known classes into a common framework. We then use this framework to identify a further class of problems that can be solved by propagation alone.

### Keywords

Constraint satisfaction Arc-consistency Global constraints Propagators## 1 Introduction

Constraint programming (CP) is widely used to solve a variety of practical problems such as planning and scheduling [34, 43], and industrial configuration [1, 33]. Much of the success of CP arises from to the use of special-purpose constraint types known as *global constraints*.

Global constraints facilitate the declarative encoding of problems; they allow the constraint programmer to express high-level knowledge about relationships between variables [41, 44]. A global constraint is generally not represented explicitly by listing all the assignments that satisfy it. Instead, such constraints are usually represented *implicitly* by an algorithm in the solver that decides which assignments the constraint should allow.

For many kinds of global constraints another algorithm is also provided that prunes values from the domains of variables if they can be shown to be infeasible, given the values currently available for other variables [5, 42]. Such an algorithm is known as a filtering algorithm, or *propagator*.

Considerable effort in constraint programming has focused on the development of efficient propagators that can achieve various kinds of *local consistency* for individual constraints. The strongest level of local consistency that can be established for an individual constraint considered in isolation is when every value in the domain of every variable is part of an allowed assignment that assigns each variable of the constraint a value from its current domain. When this condition holds the domains are said to satisfy the property of *generalised arc-consistency* (GAC) for that constraint [5] (sometimes called *domain consistency* or *hyper-arc consistency*). An algorithm that removes values from the domains of the variables of an individual constraint to achieve this property is called a *GAC propagator* for that constraint. The close connection between GAC propagation and unit propagation in SAT-solvers is explored in [2].

Many common global constraint types, including the standard AllDifferent constraint [40], are known to have efficient GAC propagators. For an early survey of global constraints see the Handbook of Constraint Programming [34], and for a detailed description of many global constraints and associated GAC propagators see the online Global Constraint Catalog [4].

However, the development of efficient GAC propagators for *individual* constraints does not shed much light on the effectiveness of such algorithms when applied to multiple *overlapping* global constraints, which is a standard feature of most practical constraint problems.

In this paper we will consider the combined effect of running GAC propagators on each of the constraints in problems with more than one constraint. In particular, we will characterise constraint problems where using such propagators can efficiently decide whether or not a solution exists, without the need for any additional processing or search. This property will be referred to as being *decided by GAC*. The use of propagators is implemented by most existing solvers, so any such solver will be able to determine whether any instance that is decided by GAC has a solution or not, simply by using propagation.

We begin by surveying and characterising the diverse classes of problems that have previously been shown to be decided by GAC, and then give a unified description that characterises all individual instances with this property. We then show that this characterisation provides a simple alternative explanation for each of the previously known classes.

However, we also show that we cannot expect to be able to efficiently recognise all problem instances that are decided by GAC, by showing that this problem is NP-hard for many problem classes. Finally, we give a diagram showing the relationships between the various problem classes we have discussed.

Even when a constraint problem is decided by GAC it is not always straightforward to find solutions when they exist: the values that are left in each domain after running GAC propagators on all of the constraints will not necessarily all be extendable to a complete solution. However, there is a standard technique to adapt any algorithm which decides the existence of a solution which can often be used to actually find a solution when one exists. For any class of CSP instances where we can add constant constraints (which define assignments to individual variables), we can find a solution by adding unary constant constraints on each variable in turn, restricting it to a single value, and calling the decision algorithm each time [13]. Most of the constraint problems we consider in this paper will allow arbitrary constant constraints, and in these cases for any instance that is decided by GAC we can use propagation repeatedly to find a solution when it exists.

One important potential application area for our results will be to find decompositions of global constraints into combinations of smaller constraints [6]. If the instance formed by the smaller constraints is decided by GAC, and retains this property when we add an arbitrary unary constant constraint, then we can enforce GAC on the original global constraint by adding unary constant constraints to each variable in turn, restricting it to a single value, and enforcing GAC on the set of smaller constraints each time.

Another application area is to identify sub-problems of a given problem that can be solved efficiently, that can be used as targets for problem reduction or pre-processing strategies [17]. We believe that the systematic identification of the properties needed for GAC decidability that we give here will lead to novel problem reduction and simplification strategies.

## 2 Constraints and propagators

In this section we formalise the required definitions, and provide motivating examples.

**Definition 1** (CSP instance)

A CSP instance is a triple 〈*V*,*D*,*C*〉, where *V* is a finite set of *variables*, *D* is a function which maps each element of *V* to a finite set of possible values, called its *domain*, and *C* is a finite set of *constraints*.

Each constraint *c*∈*C* is a pair, 〈*σ*,*ρ*〉, where *σ* is a sequence of variables from *V*, called the *scope*. The length of *σ*, denoted |*σ*|, is called the arity of *c*. The *relation*, *ρ*, is a subset of *D*(*σ*[1])×⋯×*D*(*σ*[*r*]), where *r*=|*σ*|, and defines the allowed combinations of values for the list of variables in *σ*.

A *solution* to a CSP instance is a function which maps each variable to a value from its domain in such a way that all constraints are satisfied.

CSP instances are abstract specifications of problems: they tell us what the required properties of the instance are, but do not tell us how that instance should be represented for processing by a constraint solver. As discussed in [11], when the constraints in a family of problems have unbounded arity, the way that the constraints are *represented* can significantly affect their complexity.

In this paper we will assume that the constraints in our instances are represented by pre-defined global constraints that impose the specified restrictions, each with an associated GAC propagator that the solver can use to prune values from the domains of the variables in the scope of that constraint.

A standard approach to processing a CSP instance, implemented in many current solvers, is to run the GAC propagators on each constraint until no further changes result. If doing this removes all possible values from the domain of at least one variable, then we will say that this algorithm returns the answer “no”. This outcome will be called “domain wipeout”. Any other outcome (i.e., at least one remaining value in the domain of every variable) corresponds to returning the answer “yes”.

Running this algorithm on any instance that has a solution will always return the value “yes”, but running it on instances with no solutions may also in some cases return the value “yes”. Such cases will need additional processing to determine whether a solution actually exists (such as some form of search).

We will say that an individual CSP instance is *decided by GAC* if running this algorithm returns the answer “yes” if the instance has a solution, and returns the answer “no” if it does not. This is captured by the following definition.

**Definition 2**

A CSP instance is *decided by GAC* if it has a solution, or else repeatedly running GAC propagators on each of its separate constraints leads to domain wipeout.

As the next examples illustrate, it can be challenging to distinguish between instances where GAC decides and instances where it does not.

*Example 1*

A Latin square is an arrangement of the numbers 1 to *n* in an *n*×*n* square grid in such a way that the numbers in each row are distinct and the numbers in each column are distinct. The task of completing a Latin square where some entries are already given and others are left blank is sometimes referred to as the *quasi-group completion* problem [39] and has been used as a benchmark problem for constraint programming.

It can be formulated as a constraint problem where we have *n*^{2} variables, some with a single specified value, and others with domain of values 1 to *n*, and AllDifferent constraints on each of the rows and columns. Empirical studies of this formulation have shown that in many cases, especially when *n* is small, GAC propagation alone will decide whether a given instance of this problem has a solution without the need for any further search [27]. However, this is not true in general, as GAC propagation can be completed in polynomial time, but this problem is known to be NP-complete [16].

*Example 2*

Consider the CSP instance *I*_{tet} which has variables {*v*_{1},*v*_{2},*v*_{3},*v*_{4}} each with domain {*R*,*G*,*B*} and four ternary AllDifferent constraints, with scopes <*v*_{1},*v*_{2},*v*_{3}>,<*v*_{1},*v*_{2},*v*_{4}>,<*v*_{1},*v*_{3},*v*_{4}>,<*v*_{2},*v*_{3},*v*_{4}>, and a unary constraint on variable *v*_{4} that allows only the single value *R*.

This instance has no solution. Running a GAC propagator on the unary constraint reduces the domain of *v*_{4} to the single value *R*. Then running a GAC propagator on the constraint with scope <*v*_{2},*v*_{3},*v*_{4}> will remove the value *R* from the domains of *v*_{2} and *v*_{3}. Then running a GAC propagator on the constraint with scope <*v*_{1},*v*_{2},*v*_{3}> will remove the values *B* and *G* from the domain of *v*_{1}. Finally, running a GAC propagator on the constraint with scope <*v*_{1},*v*_{2},*v*_{4}> will remove the value *R* from the domain of *v*_{1}, causing a domain wipeout.

Hence *I*_{tet} is decided by GAC.

The following example shows that removing a constraint from an instance will, in some cases, stop GAC deciding that instance.

*Example 3*

Now consider the CSP instance \(I^{\prime }_{\text {\sc tet}}\) which has the same variables and domains as the instance *I*_{tet} in Example 3, but without the unary constraint. This instance again has no solution, but it is now generalised-arc-consistent, so running a GAC propagator on each constraint has no effect.

Hence \(I^{\prime }_{\text {\sc tet}}\) is *not* decided by GAC.

## 3 Restricted classes decided by GAC

In this section we survey the classes already known to be decided by GAC.

### 3.1 Structural restrictions

The first kind of restriction that we consider is to limit the way that the constraints in a given instance share their variables, or, in other words, the way that the constraint scopes overlap [14, 28, 31]. If every instance in a class defined by a structural restriction is decided by GAC it means that we can apply arbitrary constraints over the same scopes and the result will still be decided by GAC.

It is well-known that any *binary* CSP instance where the constraint scopes form a tree is decided by GAC [25]. To obtain a simple generalisation of this result to non-binary CSP instances we need to identify a suitable generalisation of the notion of a tree.

One possible generalisation of the graph-theoretic notion of a tree that has received a great deal of attention is the class of *acyclic hypergraphs* [3]. A hypergraph is a generalisation of the idea of a graph, where the edges can contain an arbitrary number of vertices, rather than just two (the edges in such a structure are sometimes referred to as hyperedges). A hypergraph is said to be acyclic if repeatedly removing all hyperedges contained in other hyperedges, and all vertices contained in only a single hyperedge, eventually deletes all vertices.

Another class of hypergraphs that has been considered in this context are those with *bounded tree-width* [20].

Both acyclicity and bounded tree-width have proven very useful in the analysis of the computational complexity of many combinatorial search problems. Indeed, many NP-hard problems become tractable if their structure is acyclic or has bounded tree-width.

Solving a CSP instance whose constraints are represented extensionally (i.e., as table constraints) is known to be tractable if the hypergraph defined by the constraint scopes is acyclic [32]. However, this is no longer true if the constraints are represented implicitly, even when they have a fixed, finite domain [15].

Dalmau et al. [20], building on several earlier results [22, 26], showed that the class of all CSP instances whose associated hypergraphs belong to some (recursively enumerable) family with bounded tree-width is solvable in polynomial time. This remains true even when the constraints are represented implicitly.

However, restricting the structure of CSP instances to be acyclic or to have bounded tree-width does not ensure that they are decided by GAC. Moreover, there are structural classes of CSP instances that are decided by GAC but do not have bounded tree-width (for example, the class of instances containing a single constraint of unbounded arity). Hence we need a different generalisation of trees in order to be able to characterise the structural classes of CSP instances that are decided by GAC.

**Definition 3**

A variable *v* is called an *articulation point* for a set of constraints if those constraints can be partitioned into two non-empty sets whose scopes share only the variable *v*.

A CSP instance is *Berge-acyclic* [3] if every variable is either an articulation point or belongs to at most one constraint scope.

It is clearly the case that every *binary* CSP instance where the constraint scopes form a tree, is Berge-acyclic. However, there is no requirement for a Berge-acyclic instance to be connected, so any binary CSP instance where the constraint scopes form a forest is also Berge-acyclic.

It has been noted by many authors that Freuder’s result about trees can be extended to non-binary Berge-acyclic instances. Here we state a slightly stronger result: these are the *only* structural classes which are decided by GAC.

**Theorem 1**

*The following are equivalent*:

*The CSP instance I is Berge-acyclic*;*Every CSP instance with the same constraint scopes as I is decided by GAC*.

*Proof*

If *I* is Berge-acyclic, then the constraint scopes only overlap at articulation points. Hence, after establishing GAC, if the domains are not empty, then for each connected subset of constraints we can choose any constraint as the root, choose any allowed tuple for that constraint, extend the assigned values to allowed values for the children, and repeat until we reach the leaves. Hence *I* has a solution, and so is decided by GAC.

If *I* is not Berge-acyclic, then there exists a sequence of two or more distinct variables each shared by two or more constraint scopes where each successive pair are contained in the scope of some constraint, and the first and last are also in the scope of some constraint. So, choose variables *x*_{1},*x*_{2},…,*x*_{k} and scopes *σ*_{i},1≤*i*≤*k* such that {*x*_{i},*x*_{i+1}}⊆*σ*_{i} for *i*=1,…,*k*−1 and {*x*_{k},*x*_{1}}⊆*σ*_{k}. Now form a new instance on the same scopes with a domain of size two or greater. On *σ*_{1} apply a constraint that requires *x*_{i}≠*x*_{i+1}, and on all other such scopes *σ*_{i} apply a constraint that requires *x*_{i} = *x*_{i+1}. If no further restrictions are imposed, then the resulting instance is GAC but has no solution. □

### 3.2 Language restrictions

The second kind of restriction that we consider is a restriction on the constraint relations that can be specified for the constraints in a given instance, or, in other words, the kinds of constraints we can use [8, 35].

It is convenient to refer to a set of relations Γ over some fixed set *D* as a *constraint language*, and to refer to a class of CSP instances where the constraint relations of all constraints are elements of Γ as the class of CSP instances over the language Γ.

Amongst the earliest such language restrictions to be identified were the so-called *min-closed* and *max-closed* families of constraints [36]. These constraint types generalise Horn clauses to larger domains, and also generalise the basic arithmetic constraints provided in the CHIP programming language [36]. Any class of CSP instances where the constraints are all max-closed or all min-closed is decided by GAC [29]. (This result generalises the well-known fact that unit propagation decides all satisfiability problems over Horn clauses [36]).

This class of constraints was further generalised to the class of all constraints where the constraint relations are preserved by a so-called semi-lattice polymorphism [8]. Another generalisation has been described [21], to constraints where the constraint relations are preserved by a set function. A set function on a set *D* is a function from the non-empty subsets of *D* to *D*.

**Definition 4**

*ρ*of arity

*r*is said to be preserved by a set function

*f*if, for any non-empty subset {

*t*

_{1},

*t*

_{2},…,

*t*

_{k}} of tuples from

*ρ*, the tuple

*ρ*. A language Γ is said to be preserved by a set function if every relation in Γ is preserved by that set function.

Building on the work of [23], Dalmau and Pearson were able to show that any CSP instance over a fixed domain where the constraint relations are preserved by a set function is decided by GAC [21]. In fact they obtained the following result, for which we include a short proof in our terminology, so that we can extend this result below.

**Theorem 2** (21)

*The following are equivalent*:

*A constraint language Γ over a finite set D is preserved by a set function;**Every CSP instance over Γ is decided by GAC*.

*Proof*

Let Γ be a constraint language over a finite set *D*. We construct a canonical CSP instance *I*_{D} over Γ, as follows.

The variables of *I*_{D} are the non-empty subsets of *D*. For each relation *γ*∈Γ, with arity *r* we impose the constraint <(*A*_{1},…,*A*_{r}),*γ*> (where the *A*_{i} are not necessarily distinct), for all choices of (*A*_{1},…,*A*_{r}) that satisfy the following condition: for every 1≤*i*≤*r* and every *a*_{i}∈*A*_{i} there exist elements *a*_{j} in each of the remaining *A*_{j} for which *γ*(*a*_{1},…,*a*_{r}) holds. Observe that the solutions to *I*_{D} are precisely the set functions that preserve Γ.

Assume first that GAC decides every CSP instance over Γ, so GAC decides *I*_{D}. Restricting the domain of each variable *A*_{i} to be the set *A*_{i} gives a sub-instance of *I*_{D} with non-empty domains which is GAC. Hence, by our assumption, *I*_{D} has a solution and so, by the observation above, every relation in Γ is preserved by the set function that corresponds to this solution.

Conversely suppose that not every instance over Γ is decided by GAC. In this case there is some instance *I* over Γ with non-empty domains which is GAC but has no solution. Let *D*^{′} be the mapping from the variables to their sub-domains after enforcing GAC. By our construction of *I*_{D}, the mapping which maps each variable *v* of *I* to the variable *D*^{′}(*v*) in *I*_{D} gives a mapping from *I* to *I*_{D} that maps each constraint scope of *I* to a list of variables in *I*_{D} that are constrained in the same way. Hence *I*_{D} is also not solvable, and so, by the observation above, Γ is not preserved by any set function. □

Note that if all the constraint relations in some CSP instance are preserved by a set function then we can remove any constraint and still have this property. However, as we have seen in Examples 2 and 3, not every instance that is decided by GAC is still decided by GAC after removing a constraint. Hence not every individual instance that is decided by GAC will have all its constraint relations preserved by some set function; rather, as Theorem 2 indicates, this will only be the case for those instances where all other instances over the same constraint language are also decided by GAC, which is quite a strong requirement.

### 3.3 Hybrid restrictions

The third kind of restriction that we consider is restriction on both the scopes and the constraint relations that can be specified for the constraints in a given instance [12, 18, 37].

Amongst the earliest such hybrid restrictions to be identified were the so-called *triangulated* CSP instances described in [12]. These instances contain only binary constraints, so for any instance <*V*,*D*,*C*> there is an associated graph with set of vertices *V*×*D*, and edges between each pair of distinct values for the same variable, and each pair of values for distinct variables that is forbidden by a constraint. Such a graph is called the *microstucture complement* of the instance. Any instance where this graph is triangulated is decided by GAC [12] and the class of all such instances is not defined by any structural restriction, nor by any language restriction.

More recently, another hybrid restriction defining a class of binary CSP instances that are decided by GAC has been identified [18]. These are the instances satisfying the so-called *broken-triangle property*.

**Definition 5**

*broken-triangle property*(BTP) with respect to the variable ordering <, if there is at most one constraint on each pair of variables, and for all triples of variables

*v*

_{i},

*v*

_{j},

*v*

_{k}such that

*v*

_{i}<

*v*

_{j}<

*v*

_{k}, if

the pair of values 〈

*a*,*b*〉 is allowed on the variables 〈*v*_{i},*v*_{j}〉; andthe pair of values 〈

*a*,*c*〉 is allowed on the variables 〈*v*_{i},*v*_{k}〉; andthe pair of values 〈

*b*,*d*〉 is allowed on the variables 〈*v*_{j},*v*_{k}〉;

the pair of values 〈

*a*,*d*〉 is allowed on the variables 〈*v*_{i},*v*_{k}〉; orthe pair of values 〈

*b*,*c*〉 is allowed on the variables 〈*v*_{j},*v*_{k}〉.

CSP instances satisfying the BTP (or its various extensions [17]) are the only known examples of classes of instances decided by GAC which are not closed under the action of removing a constraint, as the next example illustrates.

*Example 4*

Consider a CSP instance *I* with variables *v*_{1},*v*_{2},*v*_{3},*v*_{4} each with domain {0,1,2} and constraints *v*_{1}<*v*_{2}, *v*_{2}<*v*_{3}, *v*_{3}<*v*_{4}, and *v*_{1}≥*v*_{4}, together with an additional constraint on *v*_{1} and *v*_{3} that allows only the combinations {(2,0),(2,1),(2,2),(1,2)}.

This instance satisfies the BTP, and so is decided by GAC. However, if we remove the constraint on *v*_{1} and *v*_{3} to obtain a reduced instance *I*^{′} it no longer satisfies the BTP (consider the triple of variables *v*_{1},*v*_{3},*v*_{4}). On the other hand, the reduced instance *I*^{′} is now max-closed, so is still decided by GAC.

CSP instances satisfying the BTP are characterised by the absence of a certain kind of *pattern* of allowed and disallowed combinations on three variables [19]. Four additional patterns of this kind whose absence guarantees that a binary CSP instance is decided by GAC have been identified in [19].

## 4 A characterisation of instances decided by GAC

To unify the earlier results and obtain more fine-grained results that characterise all individual instances decided by GAC, we need to consider both the structure of the instance (defined by the constraint scopes) and the language of the instance (defined by the constraint relations). To do this we will treat each constraint 〈*σ*,*ρ*〉 as a “labelled relation” where each component of the relation *ρ* is labelled by the corresponding entry (variable) in the scope *σ*. We then consider what other instances can be formed using these labelled relations. We allow the constraints in these new instances to share a variable only when they share the same label for the corresponding component. (Note that this approach is very similar to the machinery developed in [9] for multi-sorted constraint relations.)

**Definition 6**

Given any CSP instance *I*=〈*V*,*D*,*C*〉, we say that an instance *I*^{′}=〈*V*^{′},*D*^{′},*C*^{′}〉 is an instance *over the same labelled language* as *I*, if there is a mapping *λ* from *V*^{′} to *V*, called a *labelling*, such that for every constraint \(c^{\prime } = \langle {(v^{\prime }_{1},\dots ,v^{\prime }_{r}), \rho ^{\prime }}\rangle \in C^{\prime }\), the constraint \(\langle {(\lambda (v^{\prime }_{1}),\dots ,\lambda (v^{\prime }_{r})), \rho ^{\prime }}\rangle \) is an element of *C* and for all *v*^{′}∈*V*^{′}, the domain *D*^{′}(*v*^{′}) = *D*(*λ*(*v*^{′})) .

*Example 5*

*I*

_{tet}described in Example 2 is illustrated in Fig. 2, along with an instance

*I*

^{′}over the same labelled language as

*I*

_{tet}. For each variable marked \({v^{k}_{i}}\) in

*I*

^{′}we have \(\lambda ({v^{k}_{i}}) = v_{i}\), so we say that it has label

*v*

_{i}. Each ternary constraint in

*I*

^{′}has a corresponding ternary constraint in

*I*

_{tet}and imposes the same AllDifferent constraint, and each unary constraint in

*I*

^{′}corresponds to the unary constraint in

*I*

_{tet}and restricts the domain to

*R*in the same way. Finally, each variable marked \({v^{k}_{i}}\) in

*I*

^{′}has domain \(D(\lambda ({v^{k}_{i}})) = \{R,G,B\}\).

We observe that the instance *I*^{′} is Berge-acyclic and has no solution.

**Lemma 1**

*For any CSP instance I, the following are equivalent*:

*Applying GAC propagators to I leads to domain wipeout*;*There is some Berge-acyclic instance over the same labelled language as I which has no solution*.

*Proof*

Let *I*=〈*V*,*D*,*C*〉 be a CSP instance, and let GAC (*c*,*v*,*d*) mean that a GAC propagator applied to constraint *c*∈*C* deletes value *d*∈*D*(*v*) from the domain of *v*∈*V*.

First, suppose that GAC applied to the instance *I* leads to domain wipeout at *v*. We must have a sequence: GAC(*c*_{1},*v*_{1},*d*_{1}),…,GAC(*c*_{m},*v*_{m},*d*_{m}) in which every value originally in the domain of *v* = *v*_{m} is deleted at some point.

Now we use this sequence to inductively build a Berge-acyclic instance over the same labelled language as *I* which will have no solution.

We begin the construction with an empty instance. Assume that for each *j*<*k* we have constructed a Berge-acyclic instance for GAC (*c*_{j},*v*_{j},*d*_{j}). We can then build the instance for GAC (*c*_{k},*v*_{k},*d*_{k}) as follows. Let *c*_{k}=〈*σ*_{k},*ρ*_{k}〉, where \(\sigma _{k} = (v_{i_{1}},\ldots ,v_{i_{r}})\). Create variables \(v_{i_{1}}^{k},\ldots ,v_{i_{r}}^{k}\) with labels \(v_{i_{1}},\ldots ,v_{i_{r}}\) and add the constraint \(\langle {(v_{i_{1}}^{k},\ldots ,v_{i_{r}}^{k}),\rho _{k}}\rangle \). Now, for each *j*<*k* and each GAC (*c*_{j},*v*_{j},*d*_{j}) where *v*_{j}∈*σ*(*k*) we add (a separate copy of) the Berge-acyclic instance constructed for GAC (*c*_{j},*v*_{j},*d*_{j}) and identify the variables \({v_{j}^{j}}\) and \({v_{j}^{k}}\).

All the variables that we identify during this construction become articulation points, so the resulting instance is Berge-acyclic. Moreover, since every constraint has the same relation as some constraint in *C*, and constraint scopes only overlap when the variables have the same label, the constructed instance is over the same labelled language as the original instance.

To see that it has no solution, it is enough to observe that at stage *k* we construct an instance that eliminates the value *d*_{k} from the variable \({v^{k}_{k}}\) along with all other values *d*_{i} for which there is some *i*<*k* and deletion GAC (*c*_{i},*v*_{i},*d*_{i}) with *v*_{i} = *v*_{k}. Hence, by our assumption about the sequence of GAC applications, there are no possible values for the variable *v*_{m} at stage *m*.

Conversely, suppose that some Berge-acyclic instance *T*=〈*V*^{′},*D*^{′},*C*^{′}〉 over the same labelled language as *I* has no solution. Since Berge-acyclic instances are decided by GAC, by Theorem 1, we know that applying GAC propagators to the constraints of *T* in some order removes all values from some domain.

Since *T* is Berge-acyclic, the constraints of *T* can be arranged in a forest whose edges correspond to the articulation points. Choose the tree in this forest where the domain wipeout occurs, and choose the constraint whose propagator removes the final value from the domain as the root. Order the constraints so that each parent occurs after all of its descendants (i.e., choose a post-order on the tree). Now we know that applying GAC propagators to the constraints in *T* along this post-order from each leaf to the root leads to domain wipeout at the root.

Hence we have a sequence: \(GAC(c^{\prime }_{1}, v^{\prime }_{1}, d_{1}),\dots , GAC(c^{\prime }_{m}, v^{\prime }_{m}, d_{m})\) for *T*, in which every value originally in the domain of \(v^{\prime }_{m}\) is deleted at some point. By Definition 6, each variable \(v^{\prime }_{i}\) in this sequence corresponds to a variable \(\lambda (v^{\prime }_{i})\) in the original instance *I*, and each constraint \(c^{\prime }_{i}\) corresponds to a constraint in the original instance *I*, which we will call \(\lambda (c^{\prime }_{i})\). If we apply the GAC propagators to each of the corresponding constraints \(\lambda (c^{\prime }_{i})\) of *I* in the same order, we claim that after each application the domain of \(\lambda (v^{\prime }_{i})\) will be a subset of the domain of \(v^{\prime }_{i}\) at the same point in the process.

We will establish this claim by induction. It is clearly true at the start of the process because both variables start with the same domain, by Definition 6. Suppose that it is true for the first (*k*−1) applications in the sequence. Consider the next application of the GAC propagator, to \(c^{\prime }_{k}\). By our hypothesis, the domains of all variables in *I* corresponding to children of \(c^{\prime }_{k}\) in *T* are subsets of the domains of the corresponding variables in *T*. Hence applying the GAC propagator on constraint \(\lambda (c^{\prime }_{k})\) removes at least as many values from the domain of \(\lambda (v^{\prime }_{k})\) as its analogue removes from \(v^{\prime }_{k}\), so the claim follows by induction.

It follows that this sequence of applications of GAC propagators to the constraints in *I* leads to domain wipeout at \(\lambda (v^{\prime }_{m})\), which proves the result. □

**Theorem 3**

*For any CSP instance I, the following are equivalent*:

*I is decided by GAC;**I has a solution if and only if every Berge-acyclic instance over the same labelled language as I has a solution;*

*Proof*

First, suppose that the CSP instance *I* is decided by GAC.

If *I* has a solution, say *s*, then we can use *s* to solve any Berge-acyclic instance *T* over the same labelled language as *I*. Simply choose the value of each variable in *T* to be *s*(*λ*(*v*)).

If *I* has no solution, since GAC decides *I* we know that GAC leads to domain wipeout and we can appeal to Lemma 1 to obtain a Berge-acyclic instance over the same labelled language as *I* which has no solution.

Conversely, suppose that *I* satisfies the second condition in the statement. If *I* has a solution then GAC decides, since GAC preserves solutions. On the other hand, if *I* has no solution then, by our assumption, some Berge-acyclic instance *T* over the same labelled language as *I* has no solution, and again we can appeal to Lemma 1 to show that applying GAC propagators to *I* leads to domain wipeout. □

A similar property was identified in [23], where it is referred to as “tree duality”, but it was only defined for classes of instances over a fixed constraint language (and was expressed rather more abstractly, in terms of Datalog and algebraic conditions).

Theorem 3 does not bound the size of the Berge-acyclic instances that need to be considered. However, examining the proof of Lemma 1, we can see that the only Berge-acyclic instances we need to consider correspond to sequences of domain reductions caused by GAC propagators. Since the maximum number of domain reductions that can occur in a CSP instance 〈*V*,*D*,*C*〉 is \({\sum }_{v \in V} |D(v)|\), it follows that it is sufficient to consider only Berge-acyclic instances where the maximum length of a path is \({\sum }_{v \in V} |D(v)|\).

*I*we can identify a single Berge-acyclic instance

*I*

_{B}over the same labelled language as

*I*that is constructed in a standard way and is sufficient to determine whether

*I*is decided by GAC. A recursive construction for

*I*

_{B}is shown in Algorithm 1. To construct

*I*

_{B}from

*I*=〈

*V*,

*D*,

*C*〉 we set \(maxdepth = {\sum }_{v \in V} |D(v)|\), choose a variable

*v*in each connected component of the constraints of

*I*, and call MakeTree (

*v*,−,1). (To complete the definition of

*I*

_{B}, the domain of each variable

*v*

^{′}in

*T*

_{I}is then set to equal the domain of the variable

*λ*(

*v*

^{′}) in

*I*, where

*λ*(

*v*

^{′}) is the label of

*v*

^{′}.)

*Example 6*

*I*with four variables, two ternary constraints and a unary constraint is illustrated in Fig. 3, along with part of the corresponding instance

*I*

_{B}over the same labelled language as

*I*, as computed by Algorithm 1. If every variable in

*I*has domain size

*d*, then the complete instance

*I*

_{B}is a chain with 4×

*d*×2=8

*d*ternary constraints and 4

*d*unary constraints.

**Corollary 1**

*For any CSP instance I, the following are equivalent*:

*I is decided by GAC;**I has a solution if and only if I*_{B}*has a solution.*

*Proof*

Similar to Theorem 3, but noting that the edges of the Berge-acyclic instance obtained from Lemma 1 will be a subset of the edges of *I*_{B}. □

It follows that the second property holds for all of the classes decided by GAC that we have described in earlier sections. For Berge-acyclic instances this follows immediately by the following observation.

**Observation 1**

If *I* is Berge-acyclic, then *I*_{B} = *I*.

Theorem 3 also gives an alternative, more illuminating, proof that every instance whose language is preserved by a set function is decided by GAC.

**Proposition 1**

*Any instance I whose constraint relations are preserved by a set function has a solution if and only if every Berge-acyclic instance over the same labelled language as I has a solution;*

*Proof*

Let Γ_{I} be the set of constraint relations of an instance *I*, and assume that Γ_{I} is preserved by a set function.

If I has a solution *s*, then every Berge-acyclic instance over the same labelled language as *I* has a solution, given by applying *s* to the label of each variable.

Conversely, assume that every Berge-acyclic instance over the same labelled language as *I* has a solution. In this case, by Lemma 1, establishing GAC on *I* cannot lead to domain wipeout. Hence, after establishing GAC, every variable of *I* has a non-empty domain. Now apply the set function to these domains and we get a value at each variable that satisfies all the constraints, and hence a solution to *I*. □

To show that the hybrid class BTP defined earlier (Definition 5) is decided by GAC we will use Theorem 3 to obtain a stronger result. In fact we will show that a more general class of problems, introduced by Cooper et al [17] and known as DGABTP, is decided by GAC. Cooper et al [17] showed that this class of problems has a polynomial-time solution algorithm based on variable elimination. Using Theorem 3 it is relatively simple to show that this class is also decided by GAC.

## 5 The tractable class DGABTP is decided by GAC

We begin with the definition of this non-binary class and state some of its properties which were established in [17].

To formulate the definition, we assume that a CSP instance *I* is specified by defining a set of tuples known as NoGoods(*I*), where each tuple *t*∈NoGoods(*I*) is a set of variable-value assignments that are disallowed by the constraints of *I*. The predicate Good(*I*,*t*), where *t* is a tuple, is defined to be true if *t* does not contain any pair of distinct assignments to the same variable, and ∄*t*^{′}⊆*t* such that *t*^{′}∈NoGoods(*I*).

We also require a total ordering < on the variables of *I* and write *t*^{<x} for the subset {(*y*,*a*)∈*t*∣*y*<*x*} of tuple *t*, and Vars(*t*) for {*x*∣(*x*,*a*)∈*t*}.

**Definition 7** (17 )

*directed general arity (DGA) broken triangle*on assignments

*a*,

*b*to variable

*x*is a pair of tuples

*t*,

*u*(containing no assignments to variable

*x*) satisfying the following conditions:

- 1.
*t*^{<x}and*u*^{<x}are non-empty - 2.
Good(

*I*,*t*^{<x}∪*u*^{<x})∧Good(*I*,*t*^{<x}∪{(*x*,*a*)})∧Good(*I*,*u*^{<x}∪{(*x*,*b*)}) - 3.
∃

*t*^{′},Vars(*t*^{′})=Vars(*t*)∧(*t*^{′})^{<x}=*t*^{<x}∧*t*^{′}∪{(*x*,*a*)}∉NoGoods(*I*) - 4.
∃

*u*^{′},Vars(*u*^{′})=Vars(*u*)∧(*u*^{′})^{<x}=*u*^{<x}∧*u*^{′}∪{(*x*,*b*)}∉NoGoods(*I*) - 5.
*t*∪{(*x*,*b*)}∈NoGoods(*I*)∧*u*∪{(*x*,*a*)}∈NoGoods(*I*)

*I*satisfies the

*DGA broken triangle property (DGABTP)*with respect to the variable ordering <, if it has no DGA broken triangles for this ordering.

When all the constraints are at most binary, an instance satisfies the DGABTP with respect to an ordering if and only if it satisfies the BTP with respect to that ordering.

**Definition 8** (17 )

*Merging* two values *a* and *b* for variable *x* consists of replacing both *a* and *b* with a new domain value *c* which is compatible with any tuples that are compatible with either (*x*,*a*) or (*x*,*b*).

**Lemma 2** (Lemma 22 and Theorem 23 of 17)

*The class of CSP instances that satisfy the DGABTP with respect to an ordering is closed under*

*merging of any two values in the domain of the final variable in that ordering;**projecting out the final variable in that ordering when it has a singleton domain.*

We also observe that merging values for a variable *x* does not affect any constraints that do not have *x* in their scope.

We will now show that for any instance *I* that satisfies the DGABTP, *I* has a solution if a particular Berge-acyclic instance over the same labelled language, which we will call \(I^{ord}_{B}\), has a solution. By Theorem 3, this will be enough to show that any such instance is decided by GAC.

To obtain \(I^{ord}_{B}\) we take into account the ordering on the variables along which they satisfy the DGABTP, and we replace the “occurs” check in Algorithm 1 (in line 3 and line 10) by a test to check whether *v* is the *earliest* variable in the relevant scopes according to this ordering. For instances *I* that are not Berge-acyclic, the instance \(I^{ord}_{B}\) can be much smaller than *I*_{B}, as the following example illustrates.

*Example 7*

*I*

_{tet}described in Example 2 are shown in Fig. 4. The corresponding instance

*I*

_{B}has a very large number of constraints, but the instance \(I^{ord}_{B}\) has a much smaller number. For the ordering

*v*

_{1}<

*v*

_{2}<

*v*

_{3}<

*v*

_{4}, the corresponding instance \(I^{ord}_{B}\) has only 9 constraints on 11 variables; the scopes of the constraints and the labels of the variables are shown in Fig. 4.

**Theorem 4**

*A DGABTP instance I has a solution if*\(I^{ord}_{B}\)*has a solution.*

*Proof*

Let *I* be a CSP instance that satisfies the DGABTP with respect to the variable ordering *v*_{1}<*v*_{2}<⋯<*v*_{n}, and assume that \(I^{ord}_{B}\) has a solution.

We will prove the result by induction on the number of variables. The inductive hypothesis is that, for every DGABTP instance *I* with at most *k* variables, if there is a solution to \(I^{ord}_{B}\), then there is a solution to \(I^{ord}_{B}\) that assigns values to variables dependent only on their label. By Definition 6, this will induce a solution on the original instance *I*.

We begin the induction by observing that the result is trivially true for DGABTP instances with at most two variables, since in this case *I* and \(I^{ord}_{B}\) are identical.

Now suppose that the DGABTP instance *I* has more than two variables and that \(I^{ord}_{B}\) has a solution. We can assume that \(I^{ord}_{B}\) has been made GAC since this does not affect its set of solutions.

Let *I*^{′} be the instance obtained from *I* by merging all values for the final variable *v*_{n} to a value *c* and projecting out variable *v*_{n} in all constraints. By Lemma 2, the instance *I*^{′} is DGABTP. The solution to \(I^{ord}_{B}\) induces a solution *s*^{′} to \(I^{\prime ord}_{B}\) and so, by induction, we can assume that value of *s*^{′} only depends on the label of its argument. This induces the solution *s*^{′} on *I*^{′}.

Replace in \(I^{ord}_{B}\) all variables labelled *v*_{n} by variables labelled with the merged variable \(v_{n}^{\prime }\) in *I*^{′} whose domain is a single merged value *c*. Now replace the constraints in \(I^{ord}_{B}\) whose scope include a variable labeled \(v^{\prime }_{n}\) with their analogous constraints from the merged instance.

Since merging preserves solutions, we know that every constraint in this new Berge-acyclic instance involving a new variable allows *s*^{′}. Hence choosing the merged value for variables labelled \(v^{\prime }_{n}\) extends *s*^{′} to a solution of the merged instance. Hence the original instance *I* has a solution. □

**Corollary 2**

*Every instance in the class DGABTP* [17] *is decided by GAC and hence is tractable when constraints are represented by polynomial-time GAC propagators.*

This is a new result which extends the results of [17] and illustrates the power of the new theoretical characterisation of being decided by GAC.

## 6 The complexity of identifying classes decided by GAC

We describe a class of CSP instances as NP-hard if it is NP-hard to decide whether a given instance from that class has a solution.

**Theorem 5**

*Let Φ be an NP-hard class of CSP instances, where each constraint has a polynomial-time GAC propagator. It is NP-hard to determine whether a given instance from Φ is decided by GAC.*

*Proof*

We will show that deciding whether an instance *I* of Φ has a solution can be reduced, in polynomial time, to determining whether *I* is both decided by GAC and running GAC propagators leaves all domains non-empty.

Assume we have an algorithm to determine whether *I* is decided by GAC.

If this algorithm return “no” for instance *I*, then *I* has no solution, since all instances with a solution are decided by GAC.

Otherwise the algorithm returns “yes” and *I* is decided by GAC. We can establish GAC in polynomial time by running each of the propagators on the constraints until no further changes result. If there is a domain wipeout we can conclude that *I* has no solution, otherwise we conclude that *I* has a solution. □

The restricted case of 2-valued CSP instances includes the 3-SAT problem, which has polynomial-time GAC propagators but is NP-hard. Hence Theorem 5 can be applied to the class of 2-valued instances. An exactly analogous argument using the 3-colouring problem shows that it also applies to binary CSP instances.

Some of the intersections between the classes shown in the diagram are worth analysing further. For example, it is known that that all (binary) instances with a tree structure satisfy the BTP for an appropriate variable ordering [18]. Hence all binary Berge-acyclic instances satisfy the BTP. We will now show that all Berge-acyclic instances of any arity satisfy the DGABTP for an appropriate variable ordering.

To establish this result, we first have to consider how to obtain a suitable set of nogoods to describe a given CSP instance, so that we can apply Definition 7. We will assume for simplicity that the set of nogoods for an instance *I* is precisely the tuples of assignments to each of the constraint scopes that are disallowed by the constraints of the instance. (Note that this abstract specification in terms of nogoods may be very large, but it does not need to be explicitly constructed - it is simply a mathematical tool used to describe the restrictions imposed by the constraints in order to verify that the instance has the properties required by Definition 7.)

**Theorem 6**

*Any Berge-acyclic CSP instance satisfies the DGABTP property, for an appropriate variable ordering.*

*Proof*

Let *I* be a Berge-acyclic instance. The constraint scopes of *I* can be arranged in a forest whose edges correspond to articulation points. Choose a root for each tree in this forest and order the nodes in each tree from the root to the leaves. Extend this ordering to an ordering of all the variables of *I*, so that variables in earlier scopes occur before variables in later scopes.

Now for any two nogoods *t* and *u* that share a common variable *x*, if *t*^{<x} and *u*^{<x} are both non-empty, then they must arise from the same constraint scope, so Vars(*t*^{<x})=Vars(*u*^{<x}). Hence it cannot be true that Good(*I*,*t*^{<x}∪*u*^{<x}), unless *t*^{<x} = *u*^{<x}, and so there are no DGA broken triangles. Hence *I* satisfies the DGABTP with respect to this variable ordering. □

Our definition of a CSP instance (Definition 1) allows each variable to have a different domain of values, and the structural classes and hybrid classes we have considered make no assumptions about whether the domains of different variables are the same or different. However, the language classes described in Section 3.2 generally assume that all variables have the same fixed domain. For example, the definition of languages preserved by a set function (Definition 4) assumes that the set function is defined on a fixed set *D*. One advantage of this assumption is that it makes it possible to check in polynomial-time whether a given language is preserved by a set function.

If we relax this assumption, or equivalently allow *D* to be the union of different domains for different variables, then we obtain a potentially wider class of languages: the languages preserved by a set function that can behave differently on different variables. This gives rise to a wider class of instances, but the same arguments show that this broader class is still decided by GAC. This broader class of instances now includes all instances with a solution, since all the constraints in such an instance are preserved by the set function that maps every subset of domain elements for any particular variable to the solution value for that variable (and maps all other sets arbitrarily). However, even this broader class does not include all BTP instances or all Berge-acyclic instances as the following examples show.

*Example 8*

*v*

_{1},

*v*

_{2},

*v*

_{3},

*v*

_{4}}, each with domain {

*T*

*r*

*u*

*e*,

*F*

*a*

*l*

*s*

*e*}, and five constraints:

*v*

_{1}<

*v*

_{2}<

*v*

_{3}<

*v*

_{4}.

If all the constraints are preserved by some set function (which may be defined differently on different variables), then this set function must satisfy certain conditions. For example, to preserve the constraint *v*_{1}⇔*v*_{2} it must map the set {*T**r**u**e*} to the same value on both variables *v*_{1} and *v*_{2}. Similarly, such a set function must map {*T**r**u**e*} to the same value on *v*_{2} and *v*_{3} and on *v*_{3} and *v*_{4}. However, since we also have the constraint \(v_{1} \Leftrightarrow \overline {v_{4}}\). it must be the case that the set function maps the set {*T**r**u**e*} to different truth values on *v*_{1} and *v*_{4}.

Hence this BTP instance cannot be preserved by any set function, even if we allow that set function to behave differently on different variables.

*Example 9*

Consider the CSP instance that has two main variables *v*_{1} and *v*_{2} with domain {0,1,2} and 14 auxiliary variables \({v_{i}^{t}}\) for *i*=1,2 and each non-empty subset *t* of {0,1,2}, where each \({v_{i}^{t}}\) has the singleton domain {0}. The instance has a binary constraint *v*_{1}≠*v*_{2} between *v*_{1} and *v*_{2}, and a binary constraint between each \({v_{i}^{t}}\) and *v*_{i} that allows the tuples (0,*d*) precisely when *d*∈*t*.

If all the constraints are preserved by some set function (that may be defined differently on different variables), then this set function must satisfy certain conditions. For example, on *v*_{1} and *v*_{2} it must be conservative: that is, it must map each non-empty subset *t*⊆{0,1,2} to an element of *t*.

Now consider set functions that are conservative on *v*_{1} and *v*_{2}. The subsets {0,1}, {1,2} and {0,2} have no common element, so they must take at least two distinct values under this set function. This implies that the set function must assign the same value to a subset of size two on *v*_{1} and a subset of size two on *v*_{2}. But for any two sets {*a*,*b*} and {*c*,*d*} there is a set of tuples *T* in the relation *v*_{1}≠*v*_{2} such that the projections of *T* onto *v*_{1} and *v*_{2} are {*a*,*b*} and {*c*,*d*}, so the constraint *v*_{1}≠*v*_{2} cannot be preserved by such a set function.

Hence this Berge-acyclic instance cannot be preserved by any set function, even if we allow that set function to behave differently on different variables.

## 7 Summary and related work

We have described a new characterisation for the class of CSP instances which are decided by establishing generalised arc-consistency. Our results unify and generalize several previously studied classes of problems, including tree-structured problems [25], problems with max-closed constraints [36], problems where the constraints are preserved by a set function [21], and problems with the broken-triangle property [18].

There has been a long series of earlier papers attempting to identify tractable constraint problems [8,14,28,31,38]. However, much of this previous theoretical work has assumed (often tacitly) that the constraints are represented *explicitly*, by a table of allowed assignments, and so can be modified and combined efficiently. Hence very few of these earlier theoretical results are directly applicable to overlapping constraints represented by propagators. This may be one reason why such work has had little practical impact on the design of constraint solvers.

Exceptions include the pioneering work of Bulatov and Marx [10], the structural classes explored in [30], some work on overlapping AllDifferent constraints [7,24], and our earlier work on global constraints with a high degree of symmetry [15].

We see this paper as another step in the development of a more robust and applicable theory of complexity for realistic constraint problems which involve overlapping global constraints represented by propagators.