Log In Sign Up

Asking the metaquestions in constraint tractability

by   Hubie Chen, et al.
Concordia University

The constraint satisfaction problem (CSP) involves deciding, given a set of variables and a set of constraints on the variables, whether or not there is an assignment to the variables satisfying all of the constraints. One formulation of the CSP is as the problem of deciding, given a pair (G,H) of relational structures, whether or not there is a homomorphism from the first structure to the second structure. The CSP is in general NP-hard; a common way to restrict this problem is to fix the second structure H, so that each structure H gives rise to a problem CSP(H). The problem family CSP(H) has been studied using an algebraic approach, which links the algorithmic and complexity properties of each problem CSP(H) to a set of operations, the so-called polymorphisms of H. Certain types of polymorphisms are known to imply the polynomial-time tractability of CSP(H), and others are conjectured to do so. This article systematically studies---for various classes of polymorphisms---the computational complexity of deciding whether or not a given structure H admits a polymorphism from the class. Among other results, we prove the NP-completeness of deciding a condition conjectured to characterize the tractable problems CSP(H), as well as the NP-completeness of deciding if CSP(H) has bounded width.


page 1

page 2

page 3

page 4


No-Rainbow Problem is NP-Hard

Surjective Constraint Satisfaction Problem (SCSP) is the problem of deci...

An Algebraic Hardness Criterion for Surjective Constraint Satisfaction

The constraint satisfaction problem (CSP) on a relational structure B is...

Tractable Triangles and Cross-Free Convexity in Discrete Optimisation

The minimisation problem of a sum of unary and pairwise functions of dis...

On Classifying Continuous Constraint Satisfaction problems

A continuous constraint satisfaction problem (CCSP) is a constraint sati...

Deciding the existence of minority terms

This paper investigates the computational complexity of deciding if a gi...

Complexity of Combinations of Qualitative Constraint Satisfaction Problems

The CSP of a first-order theory T is the problem of deciding for a given...

Algebraic Global Gadgetry for Surjective Constraint Satisfaction

The constraint satisfaction problem (CSP) on a finite relational structu...

1. Introduction

The constraint satisfaction problem (CSP)

involves deciding, given a set of variables and a set of constraints on the variables, whether or not there is an assignment to the variables satisfying all of the constraints. Cases of the constraint satisfaction problem appear in many fields of study, including artificial intelligence, spatial and temporal reasoning, logic, combinatorics, and algebra. Indeed, the constraint satisfaction problem is flexible in that it admits a number of equivalent formulations. In this paper, we work with the well-known formulation as the relational homomorphism problem, namely: given two similar relational structures

and , does there exist a homomorphism from to ? In this formulation, one can view each relation of as containing variable tuples that are constrained together, and the corresponding relation of as containing the permissible values for the variable tuples. In this article, we assume that all structures under discussion are finite, that is, have finite universe.

The constraint satisfaction problem is in general NP-hard; this general intractability has motivated the study of restricted versions of the CSP that have various desirable complexity and algorithmic properties. A natural and well-studied way to restrict the CSP is to fix the second structure (often referred to as the right-hand side structure), which amounts to restricting the relations that can be used to specify permissible value tuples. Each structure then gives rise to a problem : given a structure , decide if it has a homomorphism to ; and, the resulting family of problems is a rich one that includes Boolean satisfiability problems, graph homomorphism problems, and satisfiability problems on algebraic equations. While each problem is in NP, for certain structures it can be shown that the problem is polynomial-time decidable. Indeed, in a now-classic result from 1978, Schaefer [42] presented a classification theorem, showing that for each structure having a two-element universe, the problem

is either polynomial-time decidable, or is NP-hard. Schaefer left open and suggested the research program of classifying structures having finite universe of size strictly greater than two.

Over the past two decades, an algebraic approach to studying complexity aspects of the problem family has emerged. A polymorphism of a structure with universe is defined as a finitary operation that is a homomorphism from to ; note that a polymorphism of arity is precisely an endomorphism. A cornerstone of the algebraic approach is a theorem stating that when two structures , have the same polymorphisms, the problems and are polynomial-time interreducible [13].111In fact, under the stated assumption, the problems and are logarithmic-space interreducible [39]. Let us mention here that, under the assumption, one also has interreducibility for some other computational problems of interest, such as the quantified CSP [11, 22, 23] and various comparison problems involving primitive positive formulas [12]. Intuitively, this theorem can be read as saying that the polymorphisms of a structure contain all of the information one needs to know to understand the complexity of , at least up to polynomial-time computation. At the present, it is well-known that certain types of polymorphisms are desirable in that they guarantee polynomial-time tractability of . As an example, it is now a classic theorem in the area that, for any structure having a semilattice polymorphism, the problem is polynomial-time decidable; a semilattice polymorphism is, by definition, an arity polymorphism that is associative, commutative and idempotent. Here, it should be further pointed out that a conjecture known as the algebraic dichotomy conjecture [13] predicts the polynomial-time tractability of each problem not satisfying a known sufficient condition for NP-completeness, and that this conjecture can be formulated as predicting the tractability of each problem where admits a certain type of polymorphism (see Conjecture 3.1 and the surrounding discussion).

In this article, we systematically study—for various classes of polymorphisms—the computational problem of deciding whether or not a given structure admits a polymorphism from the class. This form of decision problem is often popularly referred to as a metaquestion. All of the polymorphisms that we study are either known to guarantee tractability of , or predicted to do so by the algebraic dichotomy conjecture (see the discussion in Section 2).

Let us overview our principal technical results.

  • We formalize and demonstrate a connection between the polynomial-time tractability of a particular type of metaquestion and the existence of a so-called uniform polynomial-time algorithm for the condition that the metaquestion asks about (Section 4).

  • On the positive side, we prove that the metaquestion for conservative binary commutative polymorphisms is solvable in NL, non-deterministic logspace (Section 5.2).

  • We prove a generic NP-hardness result that applies to the metaquestions corresponding to a range of Maltsev conditions (Section 6.1). One consequence of this result is that deciding if a given structure gives rise to a CSP with bounded width is NP-complete (Corollary 6.8); this answers a question of L. Barto [3]. Another consequence of this result is the NP-completeness of deciding if a given structure satisfies an algebraic condition which has been conjectured to characterize the structures having a tractable CSP (see Corollary 6.9).

  • We provide a simple proof that the metaquestion for semilattice polymorphisms is NP-complete (Section 6.2).

  • We give a general hardness result showing that, for a number of types of conservative polymorphisms, the metaquestion is NL-hard (Section 6.3). In particular, this result applies to the metaquestion for conservative binary commutative polymorphisms, and hence provides a hardness result tightly complementing the positive result for such polymorphisms.

We summarize some consequences both of our results and known results in Table 1.

We view the complexity study of metaquestions as a naturally motivated research topic. In general, an instance of the CSP encountered in the wild or on the street does not, of course, come with any guarantee about the properties of the right-hand side structure ; in order to know if any of the polymorphism-based tractability results can be exploited to solve the instance, one must first detect if has a relevant polymorphism. From this perspective, the present study can thus be viewed as an effort to bridge practice and the algebraic theory of tractability.

Polymorphism free idempotent conservative conservative
at most binary structure
2-TS NP-c (*) NL-c NL-c
-TS () NP-c P P P/NL-hard
-symmetric (, even) NP-c (*) P P/NL-hard
-symmetric (

, odd)

NP-c (*) not known P
-cyclic (, even) NP-c (*) P P/NL-hard
-cyclic (, odd) NP-c (*) not known P
NP-hard NL-hard
Maltsev (*) (*) P [19] P
Siggers (*) (*) not known P
semilattice NP-c NP-c NP-c NP-c

Table 1. Summary of some results. An entry of (*) indicates that the existence of the type of polymorphism in question can be formulated as an idempotent strong linear Maltsev condition, implying the applicability of Corollary 4.9, which connects the metaquestion for the Maltsev condition to the existence of a uniform polynomial-time algorithm (see Section 4 for details). Note that positive results propagate to the right, and hardness results propagate to the left; for readability, we omit explicitly placing NL-hardness claims in some of the entries. The NP-completeness results on semilattices come from Theorem 6.11; the other NP-completeness results and the NP-hardness result come from Corollary 6.10. All NL-hardness results come from Theorem 6.12, and NL containment for conservative -TS comes from Theorem 5.5. The EXPTIME containment result for set polymorphisms comes from Proposition 5.3. The P containment result for -TS comes from Corollary 3.12, and the P containment results for even -symmetric and even -cyclic come from Corollary 3.14. The P containment result for conservative Maltsev comes from [19]. Finally, in the case of conservative at most binary structures, the not yet covered P containment results follow from Theorem 3.15 in conjunction with Proposition 2.3.

2. Definitions, Notation and Terminology

A relational structure is a tuple where is a non-empty finite set and each is a relation of arity on ; the sequence is the type of . A relational structure is at most binary if the arity of each relation is less than or equal to . In this article, most of the computational problems considered take as input a relational structure; as is quite standard in the literature, we always assume that each relation of a relational structure is specified by an explicit listing of its tuples. Two structures with the same type are said to be similar. If , , , … are relational structures, we denote their respective universes by , , , … The product of similar structures is the usual one, viz. if and then where . We denote the product of the structure with itself times by . Given a map and a -tuple , let ; if is a -ary relation on then . A map is a homomorphism from to if for all . For an integer , a -ary operation on is a map from to .

Definition 2.1.

Let be a relational structure. A -ary operation on is a polymorphism of if is a homomorphism from to ; in this case, we also say that preserves .

We are concerned with polymorphisms obeying various interesting identities. In order to avoid undue algebraic technicalities, we present certain concepts in a slightly unorthodox way (for the standard equivalents, see for instance [37].)

An expression of the form

is a linear identity; it is satisfied by two interpretations for and on a set if, for any assignment to the variables, it holds that both sides of the identity evaluate to the same value. Without fear of confusion, we shall usually make no distinction between the operation symbols used in an identity and the actual operations satisfying it, for example, we will simply write that and satisfy and so on. Note that we allow linear identities of the form

that is, containing only one operation symbol; such an identity can be formally viewed as an expression of the above form where one of the operations is a projection. Following [6], if a linear identity is not of this form, i.e. has explicit operation symbols on both sides, we say it has height 1.

A strong linear Maltsev condition is a finite set of linear identities . A sequence of operations satisfies the strong Maltsev condition if it satisfies each identity .222 The standard definition of Maltsev conditions concerns varieties of algebras. The modifier “strong” refers to the fact that set of identities is finite, as opposed to a condition as in Lemma 3.9 below.

Definition 2.2.

Let be a relational structure. We say that satisfies a strong linear Maltsev condition if there exist polymorphisms of that satisfy it.

We now present some strong Maltsev conditions we shall investigate.

A -ary operation (with ) is idempotent if it satisfies

The operation is cyclic if it obeys

It is symmetric if, for every permutation of the set , it obeys the identities

It is totally symmetric (TS) if, whenever , it satisfies the identity

Notice that

and that, for a binary operation, the properties of being commutative, TS, symmetric, and cyclic all coincide.

For , the operation is a near-unanimity (NU) operation if it obeys the identities

for any position of the lone . A 3-ary NU operation is called a majority operation.

A 3-ary operation is Maltsev if it obeys the identities

A 4-ary operation is Siggers if it is idempotent and satisfies the identity

We shall also require the following conditions on operations, which are not presented by linear identities. The -ary operation is conservative if it satisfies

for all . A semilattice operation is an associative, idempotent, commutative binary operation.

We now gather some well-known implications involving the special polymorphisms defined here; as some of these results are folklore, we give general references only [18, 43, 36, 37].

Proposition 2.3.

If a structure admits an idempotent polymorphism which is cyclic, TS, symmetric, NU, or Maltsev then it admits a Siggers polymorphism; moreover, in each case, if is conservative, so is the Siggers polymorphism.

3. Known/Preliminary Results

Let be a relational structure. We denote by the set of finite structures that admit a homomorphism to . The problem is clearly in NP. The dichotomy conjecture of Feder and Vardi, that states that every is either tractable or NP-complete, has been the source of intense scrutiny over the past two decades, see for instance [2, 7] and the surveys [17, 18]. A very deep theory has been developed, relating the nature of the identities satisfied by the polymorphisms of the structure and the complexity of the associated constraint satisfaction problem. Simplifiying to the extreme, the theory states that, the nicer the identities, the easier the problem is.

We say the structure is a retract of the structure if there exist homomorphisms and such that is the identity on . A structure is a core if the only homomorphisms from to itself are automorphisms, or equivalently, if the structure has no proper retract. The retracts of minimal size of a finite relational structure are cores, and are all isomorphic to each other; we refer to these retracts as the cores of , and due to their being mutually isomorphic, by a slight abuse we speak of the core of a structure. Obviously if is the core of then . It is known that for a core , the problem is interreducible with the problem where the structure is obtained by expanding the structure with all one-element unary relations (sometimes called constants in this context). Here, interreducibility can actually be proved with respect to first-order reductions [39]. As such a structure has only idempotent polymorphisms (indeed, it is straightforwardly verified that the polymorphisms of are precisely the idempotent polymorphisms of ), for many complexity issues on the problem family , one can restrict attention to idempotent algebras, which are known to have good behavior. Note also that, up to logspace interreducibility, we can assume the equality relation is also a relation of a structure where is under study [13]. Finally, the following is immediate: a structure admits a conservative operation satisfying some identities if and only if the structure obtained from by adding all non-empty subsets as basic relations admits an operation satisfying those same identities.

The following is one of many possible formulations of a refinement of the dichotomy conjecture, due to Bulatov, Jeavons and Krokhin [13] (see also [37]):

Conjecture 3.1.

If the core of a relational structure admits a Siggers polymorphism, then is tractable.

A form of converse to this statement is known to hold, namely, it holds that a structure whose core has no Siggers polymorphism has an NP-complete CSP [13].

Let us remark here that the conservative case was completely settled by Bulatov:

Theorem 3.2.

[16] If a relational structure admits a conservative Siggers polymorphism then its CSP is tractable.

In the rest of this section, we will focus on CSP’s satisfying a condition called bounded width. Most known tractable CSP’s can be grouped roughly into two distinct families: bounded width and few subpowers. Few subpowers problems [21, 32] generalize linear equations and are solvable by an algorithm with many properties in common with Gaussian elimination. In particular, structures admitting a Maltsev or near-unanimity polymorphism have this property. However, in general, the algorithms involved require explicit knowledge of the polymorphisms that witness the condition of few subpowers. In contrast, recent results on CSPs of bounded width show that they are actually solvable by an algorithm that is uniform in the sense that it needs no such explicit knowledge of the polymorphisms. This form of uniformity has important consequences for the metaproblem. We now discuss this in more detail.

In order to present the required algorithm, it will convenient to view CSPs in a slightly different way; the fact that both approaches are equivalent is well-known and easy to verify. We essentially follow [3]. Let us introduce some notation. If is a function with domain and , let denote the restriction of to . Similarly, if is a family of functions with domain , let .

An instance of the CSP is a triple where

  • V is a non-empty, finite set of variables,

  • is a nonempty finite set of values,

  • is a finite nonempty set of constraints, where each constraint is a subset of ; is a subset of called the scope of the constraint, and is called the arity of the constraint.

A solution of the instance is a map such that, for every constraint with scope , we have .

If we can associate naturally a -ary relation to each subset of by setting (this depends of course on the ordering of chosen.) In this way, one can restrict the nature of the constraints involved in instances by stipulating that their associated relations belong to some fixed set; it follows that we can view the problem as a set of instances of the form just described.

Let . Consider the following polynomial-time algorithm that transforms an instance into a so-called -minimal instance:

The -minimality algorithm.

  • For each -element set , add a “dummy” constraint (this is to ensure every -element set of variables is contained in the scope of some constraint);

  • Repeat the following process until it stabilises: for every subset of size at most , and every pair of constraints and whose scope contains , remove from and any function such that .

It is easy to see that the instance obtained is equivalent to the original, in the sense that they have the same solutions. In particular, if the output instance has an empty constraint then the original instance had no solution. On the other hand, if one does not obtain an empty constraint, there is no guarantee the original instance has a solution.

Definition 3.3.

The problem has relational width if the -minimality algorithm correctly decides it, that is, if the -minimality algorithm detects an empty constraint whenever the input is a no instance. We say the problem has bounded width if it has relational width for some .

The cores whose CSP have bounded width were characterized by Barto and Kozik [4]; the following description is known.

Definition 3.4.

Let us say that a pair of operations are BW operations if is -ary, is -ary, and they satisfy the following identities:

Theorem 3.5.

[4, 37] Let be a core. The problem has bounded width if and only if has idempotent polymorphisms and that are BW operations.

It turns out that problems of bounded width are precisely those solvable by a Datalog program; and the problems solvable by a monadic Datalog program are precisely those of relational width for some , i.e. problems of width 1. Let us here observe the following fact.

Proposition 3.6.

Let and be homomorphically equivalent structures. The problem has bounded width if and only if the problem does. In particular, for any structure , let denote its core; the problem has bounded width if and only if the problem does.

One way to prove this fact is to use the just-mentioned characterization of bounded width via Datalog programs; a Datalog program only processes the input structure (and not the right-hand side structure), so the fact follows from this characterization and the fact that (when are homomorphically equivalent).

The following result due to Barto also implies the Datalog hierarchy collapses, in that every problem of bounded width can be solved using the -minimality algorithm.

Theorem 3.7 ([3]).

For every relational structure , exactly one of the following holds:

  1. has width 1;

  2. has relational width but not width 1;

  3. does not have bounded width.

The next result is a slight generalisation of Corollary 8.4 of [3]; we include its proof here as it is quite simple, clever and instructive. Recall from Section 3 that the structure is obtained by expanding the structure with all one-element unary relations.

Lemma 3.8.

(Barto, Kozik, Maroti, unpublished) Let be a strong linear Maltsev condition and let be a class of structures such that, if is a structure satisfying then has bounded width. There exists a polynomial-time algorithm that, given as input a structure in , decides if the structure satisfies .


Given a structure , we set up an instance of to encode the existence of the required polymorphisms as follows: the universe of our instance is the disjoint union of where the are the arities of the different operation symbols in the Maltsev condition. We add equality constraints for the required identities, i.e. if is an identity of our condition, we identify every pair of tuples satisfying it in the copies corresponding to and . Similarly, we add the necessary unary constraints corresponding to identities of the form . Now we run the (2,3)-consistency algorithm on this instance. If it answers no, then does not satisfy the condition (since by hypothesis if it did the consistency algorithm could not give a false positive). Otherwise, select an element of the instance, and a value of , fixing the value of the solution on the element to this value. We run the (2,3)-consistency algorithm on this new instance. Looping on all possible values of , we reject if there is no satisfying value. Otherwise, we keep this value, and repeat the procedure with all other elements of the instance. If this process terminates without rejecting, we have a fully-defined sequence of operations satisfying the condition. ∎

We observe the following corollaries of the preceding lemma, combined with the following result.

Let be a -ary operation on the set and let be a matrix with entries in . We write to denote the matrix whose entry on the -th row is the value of applied to row of .

Lemma 3.9 ([5], Theorem 1.3).

Let be a -ary idempotent polymorphism of satisfying: where and are matrices with entries in such that and for all and for all . Then has bounded width.

Corollary 3.10.

There exists a polynomial-time algorithm that, given a core structure , decides if has bounded width.


Let be the strong linear Maltsev condition that asserts that and are idempotent BW operations. Note that for any core , the structure is also a core, and that satisfies if and only if satisifes . Let be the class of all cores. Then, the hypothesis of Lemma 3.8 is satisfied: for any core satisfying , it holds that is also a core that satisfies , and thus that has bounded width by Theorem 3.5. The result of Lemma 3.8 thus gives the desired algorithm, since a core has bounded width if and only if it satisfies , by Theorem 3.5. ∎

Corollary 3.11.

For each , there exists a polynomial-time algorithm that decides if a given structure has a -near unanimity polymorphism.


The presence of such a polymorphism is formulable as a strong linear Maltsev condition. If a structure has a -near unanimity polymorphism, so does (as such a polymorphism is idempotent by definition); in this case, it is known that has bounded width. This was proved first in  [33], and also follows from Lemma 3.8, using the following matrices: is the matrix with all ’s, and is obtained from by placing ’s on the diagonal. The result thus follows from Lemma 3.8. ∎

Corollary 3.12.

Let . Deciding if a structure admits a -ary idempotent TS polymorphism is in P.


Let be a -ary idempotent TS operation, . Then it satisfies the following identities:

and hence by the last lemma the conditions of Lemma 3.8 are satisfied. ∎

The following lemma was first proved by Bulatov and Jeavons. We include a streamlined proof, as we believe that it may be of independent interest.

Lemma 3.13.

[15] Let be a relational structure that admits a binary conservative commutative polymorphism. Then has bounded width.


The proof follows the very same strategy as case (2) of Theorem 4.1 of [39]; we refer the reader to this proof for full details. Suppose has a binary conservative commutative polymorphism but does not have bounded width. Combining the results of [2], [45], and [46], there exists a subset of , , such that that every polymorphism of restricted to preserves the relation for some Abelian group structure on . Pick an element in . Then implies that . Since and is commutative and conservative it follows that . But then which implies , a contradiction. ∎

Corollary 3.14.

Let be a positive even integer. There is a polynomial-time algorithm to decide whether a relational structure admits a conservative, cyclic polymorphism of arity ; the same result holds for conservative, symmetric polymorphisms.


We prove the result for cyclic polymorphisms; the symmetric case is identical. Determining if a structure admits a conservative cyclic polymorphism of arity is clearly equivalent to determining if the structure obtained from by adding all non-empty subsets of the universe as unary relations admits a -ary cyclic polymorphism. Furthermore, notice that if a structure admits a conservative cyclic polymorphism of even arity, then it admits one of arity 2 by identifying variables: in the obvious way. Thus by Lemma 3.13, we can apply Lemma 3.8 with the class of conservative structures. ∎

It is interesting to note the following consequence of Lemma 3.8: on the class of digraphs, deciding the existence of a Maltsev polymorphism is tractable. Indeed, by a result of Kazda [35], if a digraph admits a Maltsev polymorphism it also has a majority polymorphism; since the existence of a near-unanimity polymorphism implies the CSP has bounded width (this is as an easy exercise using Lemma 3.9), the result follows from Lemma 3.8.

As another example of a class of structures where Lemma 3.8 can be invoked, consider the class of conservative, at most binary structures, i.e. structures whose basic relations are at most binary and include all non-empty subsets of the universe as unary relations. Kazda has proved [34] that if such a structure admits a Siggers polymorphism (i.e. if the CSP is tractable), then in fact the CSP has bounded width; the following is a consequence of this and Lemma 3.8.

Theorem 3.15.

Let be a strong linear Maltsev condition such that, if a structure admits a conservative polymorphism satisfying then admits a Siggers polymorphism. Then it is polynomial-time decidable if an at most binary structure admits a conservative polymorphism satisfying .

4. Uniformity and metaquestions

We saw in the previous section that -consistency is a generic polynomial-time algorithm that uniformly solves all problems of bounded width. In this section, we formalize and study notions of uniform polynomial-time algorithms, for a Maltsev condition, and observe a direct relationship between the existence of a uniform polynomial-time algorithm, for a Maltsev condition, and the corresponding metaquestion for the condition (see Theorem 4.7 for a precise statement). This relationship, as will be made evident, generalizes Lemma 3.8 in a certain sense. We also mention that it seems to have been a matter of folklore that such a relationship held; in particular, the consequence noted in Example 4.8 below was previously communicated to us by M. Valeriote.

Definition 4.1.

Let be a class of finite structures. A uniform polynomial-time algorithm for is a polynomial-time algorithm that, for each CSP instance with , correctly decides the instance.

Example 4.2.

Barto’s collapse result (Theorem 3.7) shows that the (2,3)-minimality algorithm is a uniform polynomial-time algorithm for the class of structures such that has bounded width.

Definition 4.3.

Let be a strong linear Maltsev condition.

  • A uniform polynomial-time algorithm for is a uniform polynomial-time algorithm for the class of structures satisfying .

  • A semiuniform polynomial-time algorithm for is a polynomial-time algorithm that, when given as input a CSP instance and polymorphisms of that satisfy , correctly decides the CSP instance.

Example 4.4.

Let be the strong linear Maltsev condition , which asserts that is a Maltsev operation. The algorithm due to [14] is readily verified to be a semiuniform polynomial-time algorithm for .

Definition 4.5.

Let be a strong linear Maltsev condition.

  • Define the metaquestion for to be the problem of deciding, given a structure , whether or not satisfies .

  • Define the creation-metaquestion for to be the problem where the input is a structure , and the output is a sequence of polymorphisms of that satisfy in the case that satisfies , and “no” otherwise.

We note the following observation.

Proposition 4.6.

Let be a strong linear Maltsev condition. If the creation-metaquestion for is polynomial-time computable, then so is the metaquestion for .

The following theorem is the main theorem of this section. It connects the existence of a uniform polynomial-time algorithm for a Maltsev condition to the existence of a semiuniform polynomial-time algorithm and the tractability of the creation-metaquestion. We say that a strong linear Maltsev condition is idempotent if if it contains or entails the identity for each operation symbol appearing in .

Theorem 4.7.

Let be a strong linear Maltsev condition.

  • If the creation-metaquestion for is polynomial-time computable and has a semiuniform polynomial-time algorithm, then the condition has a uniform polynomial-time algorithm.

  • When is idempotent, the converse of the previous statement holds.


For the first claim, the polynomial-time algorithm is this. Given a pair , invoke the algorithm for the creation-metaquestion; if a sequence of polymorphisms is returned, then invoke the semiuniform polynomial-time algorithm on the pair and the polymorphisms , and output the result.

We now prove the second claim. Assume that is idempotent and has a uniform polynomial-time algorithm. It follows immediately that has a semiuniform polynomial-time algorithm. The algorithm for the creation-metaquestion (for ) is the algorithm of Lemma 3.8, but where instead of invoking the -consistency algorithm, one invokes the uniform polynomial-time algorithm for . ∎

Example 4.8.

Consider, as an example, the condition from Example 4.4. Theorem 4.7 implies that, for this condition, the existence of a polynomial-time algorithm for the creation-metaquestion is equivalent to the existence of a uniform polynomial-time algorithm.

The following corollary, which exhibits a hypothesis under which a uniform polynomial-time algorithm immediately implies tractability of a metaquestion, is immediate from Theorem 4.7 and Proposition 4.6.

Corollary 4.9.

Let be a strong linear Maltsev condition that is idempotent. If has a uniform polynomial-time algorithm, then the metaquestion for is polynomial-time computable.

5. Positive complexity results

5.1. Set polymorphisms

We begin by studying set polymorphisms.

Definition 5.1.

Let be a relational structure. Define on a relational structure, the power structure , of the same type as follows: if is a basic relation of of arity , declare if, for every and every , there exists a tuple such that . A homomorphism from this structure to is called a set polymorphism of . We’ll say a set polymorphism is idempotent if for all .

The presence of a set polymorphism admits multiple characterizations.

Lemma 5.2.

[28, 30] Let be a relational structure. Then, the following are equivalent:

  1. has a set polymorphism;

  2. there is a map such that, for every , the operation defined by is a polymorphism of .

  3. admits TS polymorphisms of all arities.

  4. has width 1.

We now observe that detecting a set polymorphism can be performed in EXPTIME. Note that this improves the naive complexity upper bound of NEXPTIME, which is obtained by constructing the structure defined in Definition 5.1, nondeterministically guessing a map to the given structure , and then checking if the map is a homomorphism.

Proposition 5.3.

Deciding if a relational structure admits a set polymorphism is in EXPTIME.


Notice that a structure has a set polymorphism if and only if its core has an idempotent set polymorphism (see also the proof of Lemma 6.4). Indeed, let denote the core of , with , and let be a retraction of onto , i.e. is an onto homomorphism and for all . If is a set polymorphism of , then it is easy to see that the restriction of to subsets of is a set polymorphism for . Notice also that the one element sets with induce an isomorphic copy of in ; since is a core the restriction of to this substructure induces an automorphism of ; then is an idempotent set polymorphism of . Conversely, if is a set polymorphism of , then define a set function on by . It is straightforward to verify that is a set polymorphism for .

So now we proceed as follows: we first find the core of . Loop over all mappings , but in a fashion that increases the cardinality of the size of the image of . Check each mapping for being an endomorphism; once an endomorphism is found, the image of the original structure under the endomorphism is a core. This computation can be done in PSPACE and hence in EXPTIME.

Now that we have the core of , we can test, in EXPTIME, if it admits an idempotent set polymorphism, in the manner of Lemma 3.8: indeed, if the set polymorphism exists, and since is a core, then has bounded width; using the power structure as our instance, and fixing values one at a time, we shall either reject or eventually obtain a candidate set function which we can test for being a polymorphism. ∎

As seen (Lemma 5.2), detecting for a set polymorphism is equivalent to checking for the presence of TS polymorphisms of all arities. In the quest to improve the complexity upper bound just given, a natural question that one might ask is whether or not it suffices to check for TS polymorphisms up to some bounded arity, in order to ensure TS polymorphisms of all arities. The following proposition answers this question in the negative.

Proposition 5.4.

For every prime , there exists a digraph with vertices that admits TSI polymorphisms of all arities strictly less than but no TS (in fact, no cyclic) polymorphism of arity .


Consider the directed cycle of length , i.e. vertices and arcs for all (modulo ). Since this digraph has no loop, it cannot admit a cyclic polymorphism of arity because there is an arc from to . On the other hand, if , define an operation as follows: given a tuple , let be the distinct representatives of the set . Since , it admits a multiplicative inverse modulo . Then set

where the sum is modulo . It is straightforward to verify that this is a TSI polymorphism of the cycle. ∎

5.2. Conservative commutative polymorphisms

We now prove an NL upper bound on the detection of conservative commutative polymorphisms. Note that detecting such polymorphisms can be performed in polynomial time, by Corollary 3.14. However, the algorithm thusly given itself relies on the fact that a CSP having a commutative conservative polymorphism is decidable in polynomial-time; note that such a CSP can be complete for polynomial time (this occurs even in the case of the polymorphisms and on the domain , see for example [1]). We believe that the present result is thus interesting as it improves this polynomial-time upper bound.

Theorem 5.5.

Deciding if a structure admits a conservative binary commutative polymorphism is solvable in non-deterministic logspace.

In the scope of this proof, we refer to a conservative binary commutative function as a cc-operation. For a binary operation , and a -element subset of , we will use the notation to indicate that ; also, if is a cc-operation, we will use to denote the value .


Throughout, will denote a relation of the structure, and will denote the domain of the structure. For each relation of the structure and each pair of tuples , define to be the relation . We claim that for a relation of the structure, a cc-operation preserves if and only if, for each , it preserves . For the forward direction, let . It holds that . But since for all , it holds by the conservativity of that for all , and so . For the backward direction, suppose that . It holds, by assumption, that . But since , we have .

Now define to be the relation obtained from by projecting out each coordinate such that the projection contains just one element. Let be the tuples in corresponding to and , respectively; so, for each it holds that . As any cc-operation is idempotent, we have that a cc-operation preserves all of the relations if and only if it preserves all of the relations . By the claim of the previous paragraph, we obtain:

Claim 1: A cc-operation preserves the relations of the structure if and only if it preserves all of the relations .

For each relation and each tuple , define to be the partial operation where for each , and for each . Each cc-operation that preserves must map the tuples to a tuple ; hence, we obtain that such an must be an extension of , for some tuple . But observe that when such an extends such a , it holds that the partial operation itself preserves . Define to be the subset of which contains a tuple if and only if preserves . We thus obtain the following.

Claim 2: A cc-operation preserves if and only if there exists a tuple such that extends .

Suppose, for the remainder of the proof, that the domain of the structure is a subset of the integers. Consider a relation of arity . Each tuple can be naturally mapped to a tuple in , where is equal to or depending on whether or not is the min or max of . Define . In an analogous fashion, each cc-operation can be naturally viewed as an operation , defined, for each , by depending on whether .

From this discussion and the first two claims, we obtain the following.

Claim 3: A cc-operation preserves the structure if and only if it holds that, for each relation (of arity ), the tuple is in .

We now observe the following.

Claim 4: Each relation of the form is closed under the majority operation on .

We prove this claim as follows. Set . Let be arbitrary tuples in , and let be the corresponding tuples in . Set , and let be the tuple over that corresponds to . We show that for any , it holds that , which suffices (via the definition of ): is then obtainable by composing the , implying that preserves . We verify the identity as follows.

  • If , then and ; thus this last value is equal to , by the idempotence of .

  • If , then . We have , and so .

To determine whether or not there exists a cc-operation that preserves the original structure, by Claim 3, one may determine whether or not the following CSP instance has a solution. The variable set is , where the variable represents the value ; for each relation of the form (of arity ), there is a constraint stating that the variable tuple must be mapped to a value in . By Claim 4, each of these relations is preserved by the majority operation , and it is known that one can decide in NL all CSP instances on a two-element domain with a majority polymorphism [1].

Hence, it suffices to argue that each of the relations can be computed in logspace. To compute these relations, the algorithm loops over each relation and each pair . For each tuple , it checks to see if the tuple corresponding to has the property that preserves ; in the affirmative case, it holds that is in , and so the algorithm outputs . The check can be carried out in logspace as follows. Let denote the arity of . The algorithm loops over all pairs of tuples in ; for each such pair, the algorithm loops on ; for each value of , it attempts to find a tuple in that is equal to on the first coordinates, and store a pointer to such a tuple. For a particular value of , it can loop over all tuples in and, for those having the correct value in the th coordinate, it can check for correctness in the first coordinates by comparing with the tuple obtained after the th iteration. ∎

6. Complexity hardness results

In this section we prove various hardness results for the existence of “good” polymorphisms on finite structures.

6.1. A generic NP-hardness result for Maltsev conditions

We here give a rather general result that applies to a wide range of Maltsev conditions. In order to present the theorem statement, we introduce the following definitions.

Definition 6.1.

Let be a strong, linear Maltsev condition.

  • We say that is non-trivial if, on a domain with at least 2 elements, no tuple of projections can satisfy it.

  • is of height 1 if its identities all have height 1.

  • We’ll say is consistent if for every non-empty finite set , there exist idempotent operations on that satisfy .

The following is the statement of the main theorem proved in this subsection.

Theorem 6.2.

Let be a non-trivial, consistent, strong linear Maltsev condition of height 1. The problem of deciding if a relational structure satisfies is NP-complete (even when restricted to at most binary relational structures).

In order to present some examples of Maltsev conditions to which Theorem 6.2 applies, we introduce the following definition.

Definition 6.3.

Let be a strong, linear Maltsev condition. Let be the strong, linear Maltsev condition obtained from by replacing every identity of the form by the identity .

If is the Maltsev condition defining Siggers (Maltsev, -NU, …), we’ll say that an operation satisfying is quasi-Siggers (Maltsev, -NU, …).

Our reason for introducing (for example) quasi-Maltsev operations is this. As mentioned, it is known that a structure and its core each give rise to the same CSP, that is, . Hence, if the core has a polymorphism known to imply tractability of , such as a Maltsev polymorphism, it follows that the problem is also tractable. As the following lemma implies, the assertion that a structure has a quasi-Maltsev polymorphism characterizes precisely when its core has a Maltsev polymorphism, and hence precisely characterizes the sufficient condition for tractability just described. We remark that the notion of quasi- versions of operations has been previously considered in the literature, in particular, within the context of infinite-domain constraint satisfaction; see for example [8, 9].

It is probable that some version of the following lemma is implicit in the literature (see also

[6]). At any rate, its proof is straightforward.

Lemma 6.4.

Let be a relational structure and let be a strong linear Maltsev condition. The following are equivalent:

  1. satisfies ;

  2. The core of satisfies ;

  3. The core of satisfies via idempotent operations.


Let denote the core of and let be a retraction of onto . : Let be polymorphisms of that satisfy . For each let denote the restriction of to and let for all . Since is a core, each is an automorphism of ; we claim that the polymorphisms of are idempotent and satisfy . The first claim is immediate. Let be in . Notice first that, if we fix and set for all , then , so . It follows that if are elements of then

Now consider an identity of of the form . Since the satisfy , if we set we have that

and hence we obtain

is trivial. : If are polymorphisms of satisfying , for each let (where is the arity of ). Clearly these are polymorphisms of , and it is immediate that they satisfy every identity in which belongs to . Now consider an identity of of the form , obtained from the identity