Modular Counting over 3-Element and Conservative Domains
Abstract
In the Constraint Satisfaction Problem (CSP for short) the goal is to decide the existence of a homomorphism from a given relational structure to a given relational structure . If the structure is fixed and is the only input, the problem is denoted . In its counting version, , the task is to find the number of such homomorphisms. The CSP and have been used to model a wide variety of combinatorial problems and have received a tremendous amount of attention from researchers from multiple disciplines.
In this paper we consider the modular version of the counting CSPs, that is, problems of the form of counting the number of homomorphisms to modulo a fixed prime number . Modular counting has been intensively studied during the last decade, although mainly in the case of graph homomorphisms. Here we continue the program of systematic research of modular counting of homomorphisms to general relational structures. The main results of the paper include a new way of reducing modular counting problems to smaller domains and a study of the complexity of such problems over 3-element domains and over conservative domains, that is, relational structures that allow to express (in a certain exact way) every possible unary predicate.
Keywords and phrases:
Constraint Satisfaction Problem, Modular CountingFunding:
Andrei A. Bulatov: This research is supported by a NSERC Discovery Grant.Copyright and License:
2012 ACM Subject Classification:
Theory of computation Problems, reductions and completeness ; Theory of computation Constraint and logic programmingEditors:
Meena Mahajan, Florin Manea, Annabelle McIver, and Nguyễn Kim ThắngSeries and Publisher:
Leibniz International Proceedings in Informatics, Schloss Dagstuhl – Leibniz-Zentrum für Informatik
1 Introduction
The Constraint Satisfaction Problem.
In a Constraint Satisfaction Problem (CSP) the goal is to decide the existence of a homomorphism from a given relational structure to a given relational structure , [27]. If the target structure is fixed and only is the input, the problem called a nonuniform CSP and is denoted by , [27]. CSPs and nonuniform CSPs in particular have been used to model a wide variety of combinatorial problems across many disciplines. The complexity of problems of the form for finite relational structures has been thoroughly investigated [37, 15, 2, 11, 36, 10, 48].
In the counting version of the CSP, denoted by (or if we are dealing with a nonuniform problem), the goal is to find the number of homomorphisms from a given structure to a given structure , or in the case of a nonuniform problem to a fixed structure . Counting CSPs have received much attention starting from the seminal work of Valiant [46, 45], to the classification of Boolean [21] counting CSPs and those over graphs [22], to the discovery of the algebraic method for such problems [12], to a complexity classification of unweighted counting CSPs [8, 23], to a sequence of results on weighted counting CSPs [24, 13, 32, 18, 20, 19] culminating at a complete characterization of counting CSPs with complex weights by Cai and Chen [17]. In all the research mentioned above the goal is “exact” counting, that is, finding the exact number of (weighted) homomorphisms between relational structures. Approximate counting is another vast area of research that we do not touch in this paper. Statistical Physics often concerns with the problem of computing partition functions that is closely related to counting CSPs. In this paper we consider another variation of counting problems, counting modulo an integer.
The complexity class the Counting belongs to is , the class of problems of counting accepting paths of polynomial time nondeterministic Turing machines. There are several ways to define reductions between counting problems, but the most widely used ones are parsimonious reductions and Turing (polynomial time) reductions. A parsimonious reduction from a counting problem to a counting problem is an algorithm that, given an instance of produces (in polynomial time) an instance of such that the answers to and are equal. A Turing (or polynomial time) reduction is a polynomial time algorithm that solves using as an oracle.
Modular counting.
While the complexity of and algorithms for exact counting are now well understood, counting modulo an integer has received much attention in the past decade. For an integer and a relational structure the problem of counting homomorphisms from a given relational structure to modulo is denoted by . Here (and in almost all papers on the subject) the focus is on prime moduli .
One of the most important features of relational structures affecting the complexity of the corresponding modular counting CSP is the automorphism group, , of . Indeed, it can be easily shown that if has order (or is a -automorphism), then is equivalent, i.e., parsimoniously interreducible, with , where denotes the substructure of induced by the set of the fixed points of . Clearly, such a reduction by -automorphisms can be repeated until the resulting structure is -rigid, that is, has no -automorphisms. Such a derivative -rigid structure is unique up to an isomorphism, as it is shown in [26], and will be denoted by .
A related problem that will be important in this paper is computing partition functions. Let be a -matrix with entries from (in the most general case) a semiring . Let denote the problem of computing the function
for a given (di)graph , called the partition function of . The complexity of has been extensively studied in Statistical Physics and Theoretical Computer Science, see [47, 4, 14] for some samples. In the case of real or complex matrices the complexity of exact computing of partition functions is well understood [14, 18]. The case of matrices over a finite field that arises from modular counting is wide open and presents challenges that can be glimpsed from the “cancellation phenomenon” observed in [32, 17] and produced by elements of the field of a finite multiplicative order.
Existing results.
A systematic research on modular counting was initiated by Faben in [25], who introduced the complexity classes of problems of counting, modulo , accepting paths of polynomial time Turing machines. In the same paper he also proved some key hardness results and gave a complexity classification of for 2-element structures into polynomial time solvable and -complete ones. The notion of reduction between modular counting problems is similar to that for exact counting: it is either polynomial time reduction, in the same sense as before, or parsimonious reductions, where the answers to the two instances must be equal modulo .
Since then most of the effort has been directed at problems where is a graph. Faben and Jerrum [26] investigated the case when and is a tree, and, apart from classifying the complexity of the problem in this case, they also posed a conjecture stating that if is a -rigid graph, has the same complexity as the exact counting problem . In a series of papers [31, 30, 33, 43, 28, 40] the Faben–Jerrum conjecture was confirmed for a number of graph classes and values of , and then was proved in full generality by Bulatov and Kazeminia in [16].
While modular counting of graph homomorphisms provides some insight into the more general case, many of the complications do not occur in that case as it was demonstrated in [41]. As we will be using some of the results from this paper, we discuss it in some detail. The first observation is that the more general version of the Faben–Jerrum conjecture is not true for general relational structures: for any prime there exists a -rigid structure such that is #P-complete, but is polynomial time solvable. This can be fixed to some extent by introducing and exploiting multi-sorted relational structures with a richer structure of automorphisms. We will be using this framework as well, see Section 2.1. Although it is possible to modify the Faben–Jerrum conjecture for general multi-sorted structures in such a way that no counterexample is known so far, there is still little understanding of the general case.
There are two properties of graphs that made the result of [16] possible but fail for general relational structures. One is the structure of automorphisms of direct products of graphs. Due to the results of [35, 16] every automorphism of a direct product of graphs essentially boils down to a combination of automorphisms of the factors and a permutation of the factors. This is no longer true in the general case, even in the case of digraphs, as was demonstrated in [41]. This leads to a failure of the second important property: reductions through primitive positive (pp-) definitions. Let be a relational structure. Recall that a relation on , the base set of , is said to be pp-definable in if there is a first order formula that represents and has the following form
where is a conjunction of predicates from and equality predicates. If is a -rigid graph, then the problem , where denotes the extension of by adding the predicate , is polynomial time reducible to . Such reductions are known to be a powerful tool in the CSP research, as they allow for the use of polymorphisms, that is, homomorphisms from powers to , to describe the complexity of constraint problems, see [15, 3]. In particular, the existence of a so-called Mal’tsev polymorphism, that is, a polymorphism satisfying the equations , makes it possible to represent solutions to a CSP in a compact form that then in some cases can be used to find their number [11, 23]. In the case of general relational structures pp-definitions no longer give rise to reductions between problems and need to be replaced with their modular counterpart. A relation is said to be -mpp-definable in for a prime , it can be represented by a formula
where the requirements on are the same as before, and which is true for certain values of if and only if the number of values of that make true is not divisible by . Then [41] proves that is polynomial time reducible to for any relational structure and any relation -mpp-definable in .
Unfortunately, -mpp-definitions cannot be captured by polymorphisms, and overcoming this difficulty will be an ongoing theme of this paper. In some cases, however, polymorphisms of -mpp-definable relations play an important role. For instance, in [41] it was shown that if the set of 2-mpp-definable relations of a structure has a Mal’tsev polymorphism, then can be solved in polynomial time.
Our contribution.
In this paper we build upon the results of [41] to obtain a complexity classification of for two classes of structures . We start with a new version of an automorphism and the corresponding rigidity condition.
A binary polymorphism of a relational structure is said to be an automorphic polynomial if for every , is a permutation of . If, for a prime , for any , is the identity mapping or a permutation of order , and is a permutation of order for at least one , is said to be a -automorphic polynomial. The existence of a -automorphic polynomial allows one to reduce a modular counting CSP to a CSP over a smaller structure even when the structure is -rigid, see Example 12. For a complete version of the following result see Proposition 10 and Corollary 11.
Proposition 1.
Let a relational structure have a -automorphic polynomial . Then there is such that the domain of has smaller cardinality than and is polynomial time reducible to . Moreover, if satisfies some additional conditions, can be chosen such that and are polynomial time equivalent.
In order to prove Proposition 1, given an instance of we find permutations of the domain that are specific for each variable from , have order , and such that they map every tuple of every constraint to a tuple from the same constraint (so-called consistent permutations). These permutations allow us to reduce the domain to a smaller structure (in terms of the cardinality of the domain), because similar to automorphisms the elements that are shifted by the permutations can be eliminated from the problem. On the other hand, let be an element such that is a permutation of order . Then, if the permutations above do not exist, it implies that the element cannot be a part of any solution, and therefore can be eliminated. Consistent permutations are found by constructing a derivative CSP, whose domain is the symmetric group on , and the CSP itself is an instance of a Mal’tsev CSP over that group [11, 5].
Recall that a unary relation pp-definable in a structure is said to be a subalgebra of . In the case of modular counting we use -subalgebras, that is, unary relations -mpp-definable in . The two types of relational structures we consider here are
-
3-element structures, which are the next step after a similar result for 2-element structures from [25], and
-
-conservative structures, i.e., structures such that every possible unary relation is a -subalgebra.
The same types of the CSP have been major milestones in the study of the decision problem, see [6, 7, 1, 9]. They introduced several key ideas that were then used to obtain a dichotomy theorem for the general CSP.
In this paper in both cases our complexity classification is incomplete. The remaining difficulty is the complexity of modular partition functions. When every partition function has a 0-1 matrix, and therefore can be treated as the problem of counting homomorphism to a graph or a bipartite graph. The complexity of this problem is known, see, [16]. If this is no longer possible and the structure of matrices of partition functions becomes more intricate, requiring methods from finite fields. To give the reader a better idea of the difficulties with modular partition functions, recall [8, 23] that in the case of exact counting a necessary and sufficient condition for the problem to be solvable in polynomial time is that the structure is strongly balanced. It means that there is a way to associate integer matrices to relations pp-definable in , and these matrices must have rank at most 1. In fact, the complexity of is determined by the complexity of , for the matrices defined as above. That balancedness is necessary for being solvable in polynomial time is no longer true, and this is due to the fact that the modular version of can be polynomial time solvable even if does not have rank 1. Some partial results have been obtained in [39].
Let and denote the set of all relations that are, respectively, pp-definable and -mpp-definable in . In the case of exact counting a necessary condition for tractability of is the existence of a Mal’tsev polymorphism of , mentioned above. No similar property has been known to be true for modular counting. The two main results of this paper claim that for 3-element and -conservative structures if has no Mal’tsev polymorphism then is -hard. If a Mal’tsev polymorphism exists then we identify certain cases, in which the problem is polynomial time solvable.
Theorem 2.
Let be a -conservative structure and a prime. If does not have a Mal’tsev polymorphism then is -hard. Otherwise, if then is solvable in polynomial time.
In order to state the result for 3-element structures let be the structure from Proposition 1 constructed from using a -automorphic polynomial . Note that if is a 3-element structure, has at most 2 elements.
Theorem 3.
Let be a 3-element structure and a prime. If one of the following conditions holds:
-
(a)
has a -automorphic polynomial and has a Mal’tsev polymorphism, or
-
(b)
does not have a -automorphic polynomial, has a Mal’tsev polymorphism, and ,
then is solvable in polynomial time. If
-
(1)
has a -automorphic polynomial and does not have a Mal’tsev polymorphism, or
-
(2)
does not have a -automorphic polynomial and does not have a Mal’tsev polymorphism,
then is -complete.
Since has at most 2 elements, the cases when has a -automorphic polynomial can be dealt with using an extension of the results by Faben [25], see Proposition 20.
Apart from the introduction of -automorphic polynomials, the main technical contribution of the paper is the following. The property of relations with a Mal’tsev polymorphism that makes Mal’tsev polymorphisms useful is rectangularity. A relation (at least binary) is said to be rectangular if for any partition of the coordinate set of into two nonempty parts for any tuples from the first part and from the second part, if , then . If a structure has a Mal’tsev polymorphism then any relation is rectangular, a property that is sometimes referred to as strong rectangularity. It is the lack of rectangularity that often makes a counting CSP hard, as it was shown in [12]. In the case of modular counting a similar result is also true, although highly nontrivial, provided a non-rectangular relation is in , see [16]. The major difficulty though has been to obtain hardness from non-rectangular relations in . Here we found a way to use instead, while still using a Mal’tsev polymorphism, although in a different manner than in other versions of counting.
2 Preliminaries
Let denote the set . Let be the direct product of the set with itself times and the direct product of sets . We denote the members of and using bold font, , . The -th entry of is denoted by . For , we write for the tuple , and for a relation or , we define . The arity of , denoted by , is defined to be , the length of the tuples in . For , , let , and by we denote the cardinality of . (Note that we will often use the notation in a more general sense, when for a set that is not necessarily of the form .) For a prime we denote the cardinality of mod by . Moreover, denotes the set . Often, we treat relations as predicates .
2.1 Relational structures
We begin by introducing multi-sorted sets. Let be a collection of sets. We assume that the sets are disjoint. A mapping between two multi-sorted sets and is defined as a collection of mappings , where , that is, maps elements of the sort in to elements of the sort in . A mapping from to is injective (bijective), if for all , is injective (bijective).
A multi-sorted relational signature over a set of types is a collection of relational symbols. A symbol is assigned a positive integer , the arity of the symbol denoted , and a tuple , the type of the symbol. A multi-sorted relational structure with signature is a multi-sorted set and an interpretation of each , where is a relation or a predicate on . The multi-sorted structure is finite if contains finitely many finite domains, and is finite. All structures in this paper are finite. The set is said to be the base set or the universe of . For the base set we will use the same letter as for the structure, only in the regular font. Multi-sorted structures with the same signature and types are called similar.
Let be a relational structure. We use to denote its spectrum, that is, an infinite sequence where is the number of domains of cardinality . If the structure is finite, is essentially a finite sequence, and we will truncate it by removing the trailing zeroes. Let denote the colexicographic order on the set of such sequences: , if and only if either the sequences are equal, or , or for some , and for .
Let be similar multi-sorted structures with signature . A homomorphism from to is a mapping such that for any with type , if is true for , then is true as well. The set of all homomorphisms from to is denoted . The cardinality of is denoted by . A homomorphism is an isomorphism if it is bijective and the inverse mapping is a homomorphism from to . If and are isomorphic, we write . A homomorphism of a structure to itself is called an endomorphism, and an isomorphism to itself is called an automorphism. As is easily seen, automorphisms of a structure form a group denoted . Let be an automorphism of . By we denote the collection of sets of fixed points of the ’s. For , we use to denote the set , where . For a prime number we say that has order or is a -automorphism if has order in . In other words, each of the ’s is either the identity mapping or has order , and at least one of the ’s is not the identity mapping. The structure is said to be -rigid if it has no -automorphisms.
Proposition 4 ([41]).
Let be a multi-sorted structure and a prime. Then up to an isomorphism there exists a unique -rigid multi-sorted structure such that for any structure similar to it holds that .
The direct product of multi-sorted -structures , denoted is the multi-sorted -structure with the base set , the interpretation of is given by if and only if and . By we will denote the th power of , that is, the direct product of copies of . A substructure of induced by a collection of sets , where , is the relational structure given by , where and is the type of .
2.2 The CSP and Modular Counting
There are two standard formulations of the Constraint Satisfaction Problem (CSP). Let be a multi-sorted relational structure. The problem asks, given a relational structure similar to whether there exists a homomorphism from to .
The other standard definition does not involve relational structures. Let be a multi-sorted domain and a set of multi-sorted relations over , called a constraint language. An instance of consists of:
-
a finite set of variables ,
-
a type function assigning each variable a sort,
-
a finite set of constraints , where each constraint is a pair with of arity and a tuple of variables whose sorts match the type of .
A solution is a mapping such that for all , , and for every constraint , the tuple belongs to .
For a structure , let . It is well known, see e.g. [27] and [3], that the problems and can be easily translated into each other. The same holds for the counting versions and , as well as the modular counting versions and . The conversion procedure is as follows. Given an instance of with signature , construct an instance of by setting , with the type function induced by the sorts of , and for every relation and tuple , include the constraint in . Conversely, for a finite constraint language over we can construct a structure with an appropriately selected signature. Then any instance of can be transformed into an instance of by reversing this construction. This correspondence naturally extends to the counting and modular counting versions.
2.3 Expansions of Relational Structures and the CSP
A (multi-sorted) relational structure , , is an expansion of a relational structure , if and for . It will be convenient to denote by or just if . Several types of expansions are often used in the context of the CSP.
Let be a multi-sorted structure with signature and its expansion by adding a family of binary relational symbols (one for each type) interpreted as the equality relation on , . A constant relation over a set is a unary relation , (such a predicate can only be applied to variables of type ). For a structure by we denote the expansion of by all the constant relations , .
Proposition 5 ([41]).
Let be a multi-sorted relational structure and prime.
-
(1)
is polynomial time reducible to ;
-
(2)
Let be -rigid. Then is polynomial time reducible to .
Observe that if a relational structure contains all the constant relations, in particular, any structure of the form , it is obviously rigid, as every automorphism should respect every and map to , and therefore also -rigid for any .
Using Proposition 4 we may assume that all the structures we are dealing with are -rigid. Then, by Proposition 5(2) we may assume they contain all the constants, that is, . We will use this assumption from now on.
Primitive-positive definitions play a central role in the CSP research. It has been proved in multiple circumstances that expanding a relational structure with pp-definable relations does not change the complexity of the corresponding CSP. This has been proved for the decision CSP in [37, 15], the exact counting CSP [12], and in certain cases (where relational structures are expansions of graphs) [16] of modular counting CSP. The reader is referred to [3] for details about primitive positive definitions and their use in the study of the CSP.
Let be a multi-sorted relational structure with the base set . A primitive positive (pp-) formula in is a first-order formula
where is a conjunction of atomic formulas of the form or , , and is a predicate of . Every variable in is assigned a type in such a way that for every atomic formula it holds that , and for any atomic formula the sequence matches the type of . We say that pp-defines a predicate if there exists a pp-formula such that
The set of all pp-definable relations in the (multi-sorted) relational structure is denoted by .
For by we denote the number of assignments to such that is true. We denote the number of such assignments modulo by .
As was shown in [41], pp-definitions are not always compatible with modular counting in the sense that will be made precise later. The concept of pp-definitions adapted to modular counting is that of modular pp-definitions, or -mpp-definitions, where is the modulus for counting. For a prime number the -modular quantifier is interpreted as follows
| (1) |
A primitive positive formula that uses -modular quantifiers instead of regular ones is called a -modular primitive positive (or -mpp for short). The relation it defines is said to be -mpp-definable, and the definition itself is called a -mpp-definition. The set of all -mpp-definable relations in is denoted by . Note that modular quantifiers are not as robust as regular ones. In particular, and may result in a different predicate. The same is of course true for more complicated applications of modular quantifiers, so, one needs to be extra careful with -mpp-definitions.
If for the -mpp-definition (1) for all , the -mpp definition is said to be strict. By Proposition 5.6 from [16] if has a -mpp-definition, it has a strict -mpp definition.
Proposition 6 ([41]).
Let be a be a -structure (single- or multi-sorted), and a prime. Let be a relation that is -mpp-definable in . Then is polynomial time reducible to . In particular, if is conjunctive definable in (that is, in (1) and the specific value of is irrelevant), is polynomial time reducible to .
Let be a multi-sorted relational structure. A subset is called a subalgebra (of sort ) if it is pp-definable in as a unary relation. If is -mpp-definable in , it is said to be -subalgebra. In other words, is a -subalgebra if there exists a relation -mpp-definable in , such that if and only if .
2.4 Polymorphisms and Automorphisms of Products
We will also use polymorphisms of relational structures and constraint languages. Let , be a multi-sorted relational structure. An -ary polymorphism of is a homomorphism . In other words, a collection of mappings , , such that for every , , with type , for any
If this condition for holds, is also said to be a polymorphism of . For a constraint language over the definition of a polymorphism is essentially the same: is a polymorphism of if it is a polymorphism of every relation from .
Let be a multi-sorted set. A collection of mappings , , is said to be the ’th -ary projection if for all and . Projections are polymorphisms of any relation, structure, or constraint language.
A particular type of polymorphisms plays an outsized role in counting CSP research. A ternary polymorphism of a multi-sorted relational structure , , (a constraint language over ) is said to be Mal’tsev if for every the mapping satisfies the equations If has a Mal’tsev polymorphism, the set of solutions of any instance of admits a compact representation by a set of solutions whose number is linear in the size of , see, [11, 23]. Under certain conditions this allows to solve in polynomial time.
One other concept that we will refer to in this paper is the rectangularity. A binary relation is called rectangular if implies for any . A relation for is rectangular if for every , the relation is rectangular when viewed as a binary relation, a subset of . A relational structure is strongly rectangular if every relation of arity at least 2 is rectangular. The following lemma provides a connection between strong rectangularity and Mal’tsev polymorphisms and was first observed in [34] although in a different language.
Lemma 7 ([34], see also [23]).
A relational structure is strongly rectangular if and only if it has a Mal’tsev polymorphism.
We introduce a modular version of this concept, strongly -rectangular structures. A relational structure is said to be strongly -rectangular, if every is rectangular. It is shown in [41] that a relational structure can be strongly rectangular, but not strongly -rectangular.
Also, it was shown in [41] that if a relational structure is strongly 2-rectangular and admits a Mal’tsev polymorphism, then the corresponding modular counting CSP problem modulo 2 is tractable. This result highlights the algorithmic significance of Mal’tsev polymorphisms: their presence enables efficient algorithms, while their absence plays a central role in establishing hardness.
Theorem 8 ([41, 42]).
Let be a 2-rigid, strongly 2-rectangular multi-sorted relational structure, and has a Mal’tsev polymorphism. Then can be solved in time .
Another part polymorphisms will be playing in this paper is their connection to automorphisms of powers of structures. Let be a multi-sorted structure with the base set and its direct power. A mapping of to itself is a collection of mappings each of which can also be represented as , where . Rearranging these mapping we obtain collections , , where each is a mapping of to . The following lemma is straightforward from the definitions.
Lemma 9.
In the notation above is a homomorphism of to itself if and only if is a polymorphism of for every .
Clearly, is an automorphism of if and only if the are such that is bijective.
3 Automorphic Polynomials
In this section we introduce a new automorphism-like construction that allows one to reduce to a CSP over a smaller structure that we will extensively use in the future. A binary polymorphism of a (multi-sorted) relational structure is said to be an automorphic polynomial if for any domain of and any , viewed as a mapping from to is a permutation of . If, for a prime , for any domain and any , is the identity mapping or a permutation of order , and is a permutation of order for at least one domain and at least one , is said to be a -automorphic polynomial.
Let and its -automorphic polynomial. Let also and be such that is a permutation of of order . Then a structure is constructed as follows:
-
The domains are the same as those of , except . The domain is replaced with two domains: and , where is the union of all nontrivial orbits of .
-
Every relation containing in its type is replaced with and that are obtained from by replacing with (respectively ) restricting to tuples that do not contain (respectively, do not contain elements from ).
We repeat this construction for every and such that is a permutation of of order . The resulting structure is denoted .
Proposition 10.
Suppose that a relational structure has a -automorphic polynomial and is as above. Then and is polynomial time reducible to .
Proof (sketch).
Let . The first claim of the proposition is obvious, so we focus on the second claim. We will construct an auxiliary problem from an instance of . Let be a constraint in and the symmetric group on as a set. We introduce an instance with domains , constraints that are derivative from the constraints of and will allow us to conclude that either the -automorphic polynomial can be used to reduce to a problem with smaller domains that are parts of , or that does not have solutions that are equal to certain elements of the domains and therefore, again, can be reduced to a problem with smaller domains.
More precisely, is constructed as follows.
-
and the domain of is , that is, ;
-
for any constraints , such that for some , introduce the constraint , where ,
For an instance of , a collection of permutations is said to be a consistent collection of permutations if for any , , and any such that it holds that . It can be shown that each solution of provides a collection of consistent permutations for .
Finding solutions to can also be done in polynomial time, because as every is a group, we can introduce a Mal’tsev operation on the collection of , , as follows: , where multiplication and inverse are as in the group . Then for any and any such that the types of the corresponding coordinates match, the mapping is a polymorphism of . By the results of [11] for any instance of the problem can be solved in polynomial time. Moreover, for any and , we can verify in polynomial time whether or not there is a consistent collection of mappings such that . With that in mind the following transformation of can be performed in polynomial time.
Now, let be constructed as explained before the proposition. Let be such that for some the type of is , say, , and there is with . If there are no such and , then can be either completely eliminated or it can be reduced by removing from it. Thus, itself can be considered as an instance of . Otherwise let be given by . It is possible to verify whether or not there exists a solution of such that . If such a solution exists, can be reduced by eliminating all the nontrivial orbits of , since for any solution of with belonging to such an orbit, the mappings are also different solutions of and together they contribute 0 modulo into the number of solutions of . Suppose such a solution does not exist. As is easily seen, if there is a solution of such that , then the mappings , , given by , form a solution of with . Therefore, there is no such solution and the tuple can be removed from . Repeating this procedure for every with we can either reduce the domain of by eliminating nontrivial orbits of , or by eliminating . In both cases after applying this transformation to all constraints of we obtain an instance of .
Finally, repeating this construction for every and such that is a permutation of of order we arrive to an instance the required problem .
While Proposition 10 may help to prove that is solvable in polynomial time, in order to prove hardness we also need the reverse reduction, which exists only under additional assumptions. The case we need is the following.
Corollary 11.
Let be a 3-element single-sorted structure such that there is a 2-automorphic polynomial of and for the mapping is a permutation of of order 2. Then, if and are 2-subalgebras of , the structure from Proposition 10 can be chosen such that and are polynomial time interreducible.
Proof.
In order to prove Corollary 11 we only need to show that the problem is polynomial time reducible to . Let be a relation of of arity . Then
Since and are 2-subalgebras of , the relations are -mpp-definable in . The result follows from Proposition 6.
Example 12.
Let , where for some prime , is the binary relation , and is the constant relation . Since any automorphism of must preserve for each , the structure is rigid. However, it has a -automorphic polynomial given by
| for , and | |||
If we now apply Proposition 10, the problem can be reduced to , where is a multisorted structure with domains , , and the 1-element domains. The relations of are all trivial, and so is polynomial time solvable.
4 Tools for Reduction
This section introduces the main technical tools used in our reductions. First, we define indicator problems and explain how the existence of a Mal’tsev polymorphism relates to the presence of a specific predicate in the set of all (multi-sorted) pp-definable relations. Then, we apply all the constructions and tools that we developed in this section to two special classes of relational structures: -conservative and three-element structures.
4.1 Indicator Problem and Indicator Obstruction
In this section, we show that in many cases, if a relational structure is not strongly -rectangular, then there is a rectangularity obstruction of a very specific kind. Recall that ([38]) for a (multi-sorted) relational structure , the ternary indicator problem is an instance of that characterizes the ternary polymorphisms of .
-
The set of variables is the set of all triples over the domains of , i.e., for each triple , the set contains a variable with domain .
-
For every -ary relation of type from and for any tuples , where each , we include the constraint in the instance if for every , the tuple belongs to . That is, the projection of the sequence onto each coordinate is a tuple in .
As is easily seen, every solution of defines a ternary multi-sorted operation with .
Example 13.
-
(a)
Let be a relational structure with only one domain and one (binary) relation ,. Then contains 8 variables , that is, all possible triples of elements of , and the constraints are imposed on every pair such that . In this case this means all pairs of “dual” variables of the form . Thus, the constraints are
-
(b)
For a structure let the domain be the same set , but the only binary relation is given by . The set of variables of is the same as before, but the constraints are very different. As is easily seen, the constraints in this case are
Lemma 14 ([38]).
For a (multi-sorted) relational structure , a ternary (multi-sorted) operation on the domains of is a solution of if and only if it is a ternary polymorphism of .
We will call the set of all solutions of the indicator predicate . It is not difficult to see that is conjunctive-definable in . Indeed, let be the set of all constraints as defined above in . Then we define the indicator predicate as the conjunction of all those constraints
where is the tuple consisting of all variables indexed by triples .
We now define certain coordinate sets used to analyze . Let
Note that the diagonal triples are included in . Enumerate these sets as, and define tuples
Then , and . Also,
Moreover, admits a Mal’tsev polymorphism if and only if .
Indeed, this condition tests whether the tuple , which represents applying the Mal’tsev term coordinate-wise to the elements of each triple from , belongs to the projection of the relation . That is, since the closure under a Mal’tsev polymorphism would imply that the corresponding output tuple, , must also be in the relation. So, its membership characterizes whether such a polymorphism exists.
Example 15.
Let us reconsider the structures from Example 13 and their indicator problems. The following tables contain all the solutions of and , that is, the tuples of . The rows are labeled with the variables of .
Every column in these tables represents a ternary polymorphism of , respectively. Note that the first three polymorphisms in both cases are the projections, their values equal the first, second, and third component of the triple representing the label of variables of the indicator problem. Projections are polymorphisms of every structure, and therefore are always solutions of the indicator problem.
The relation contains every polymorphism satisfying the condition , also known as the condition of self-duality. The relation cannot be described by such a simple condition. The stars in the table for mean that no matter what values are in these positions, the tuple belongs to .
The sets are equal in this case and so are . The special tuples and are also equal, as they are restrictions of the tuples corresponding to the same projections. Specifically,
As was observed, the presence of a Mal’tsev polymorphism is equivalent to the conditions
that is It is not difficult to see that such a tuple exists in , but not in .
While characterizes the ternary polymorphisms of , we now define a construction that characterizes the ternary polymorphisms of .
Note that every polymorphism of is also a polymorphism of . For any ternary polymorphism of that is not a polymorphism of , there exists a relation such that fails to preserve . Let be the expansion of by all such relations The following lemma is straightforward.
Lemma 16.
Let be a (multi-sorted) relational structure. Then
-
1.
is conjunctive-definable in ,
-
2.
is -mpp-definable in .
If does not have a Mal’tsev polymorphism, then also does not have a Mal’tsev polymorphism. Therefore, and .
A relation such that and will be called a -indicator rectangularity obstruction. Clearly, if has no Mal’tsev polymorphism, itself is a -indicator rectangularity obstruction. However, it may not be -mpp-definable in . A relational structure is said to admit a -indicator rectangularity obstruction if there exists a -indicator rectangularity obstruction that is -mpp-definable in .
Recall that for a multisorted structure with domains we use to denote . An important ingredient in our construction is the study of automorphisms of that fix certain structured tuples. Specifically, those of the form and . We refer to such automorphisms as M-automorphisms, with “M” standing for Mal’tsev.
The motivation for working with comes from the need to apply our reduction tools in a higher-dimensional setting. While every automorphism of induces a polymorphism of via its coordinate projections, the converse does not hold: not every collection of polymorphisms arises as projections of a single automorphism of . The notion of M-automorphisms captures precisely those symmetries of that preserve the key tuples required for our connection to Mal’tsev polymorphisms. This connection will become essential later.
Let be the tuple of variables indexed by the elements of . For a subset , we use the notation to denote the subtuple , that is, the variables whose indices belong to . The next lemma identifies conditions sufficient for to admit a -indicator rectangularity obstruction. Define and .
Lemma 17.
Let , where , and is a conjunction of unary predicates on variables from such that Let also and let
If contains a triple that is a fixed point of every M-automorphism of then there is a -mpp-definable relation in such that , and
Starting from by repeated application of Lemma 17 we can obtain a relation , which is a -indicator rectangularity obstruction.
4.2 Conservative and 3-Element Structures
In this section we use the results of Sections 3 and 4.1 to essentially show that in the case of a -conservative and 3-element structure (single-sorted in the latter case) either there is a Mal’tsev polymorphism of or admits a -indicator rectangularity obstruction. The latter will later be used to prove the hardness of the corresponding modular counting problem.
Recall that a multi-sorted relational structure is said to be -conservative if for every and every subset , the set is -mpp-definable in (as a unary relation).
Theorem 18.
Let be a -conservative structure. Then either has a Mal’tsev polymorphism, or admits a -indicator rectangularity obstruction and therefore is not strongly -rectangular.
Proof (sketch).
We assume that has no Mal’tsev polymorphism. By Lemma 16, it suffices to show that -mpp-defines a -indicator rectangularity obstruction.
Let be an ordering of the variables from the set . We prove by induction that for any , there exists a relation , where , such that Note that is the desired -indicator rectangularity obstruction. For the base case, let , which satisfies the required condition, since .
Now suppose the statement holds for some and that is the corresponding relation. Consider the variable , and let its domain be . Define the sets as the sets of values appearing at coordinate in the extensions of , , and , respectively, within , i.e.,
Let be a minimal set of representatives for , , and ; clearly, . Let . We then consider several cases depending on the cardinality of and use Lemma 17 to show that can be quantified away from via applying a -modular quantifier to it.
Next, we assume to be a 3-element (single-sorted) structure , where . The main result of this section is the following theorem.
Theorem 19.
Let be a 3-element structure. Then one of the following three options holds
-
(1)
has a Mal’tsev polymorphism and therefore is strongly -rectangular;
-
(2)
admits a -indicator rectangularity obstruction;
-
(3)
and has a -automorphic polynomial , there is such that is a permutation of order 2, and is a -subalgebra of .
Proof (idea).
In this case we follow the same approach as in the proof of Theorem 18, except in some cases it is not possible to show that can be quantified away from . The reason for that is M-automorphisms of that act nontrivially on . So, we prove that whenever such an M-automorphism is present, has a -automorphic polynomial. This is done by a large case analysis using the Universal Algebra Calculator [29].
5 Complexity Classifications
We start this section with an (incomplete) complexity classification of , where is a -conservative structure. The missing case is and has a Mal’tsev polymorphism. The gap is due the lack of understanding of the complexity of partition functions over nontrivial finite fields. It is a highly nontrivial problem that requires a separate study, see [39] for some partial results.
We start with proving hardness for structures whose domains are 2-element. The proposition below generalizes the results of Faben [25] to multisorted CSPs.
Proposition 20.
Let be a multi-sorted relational structure, all of whose domains contain at most 2 elements. The problem is solvable in polynomial time if and only if has a Mal’tsev polymorphism. Otherwise it is -hard.
Proof (idea).
If does not have a Mal’tsev polymorphism, by Theorem 18 a -indicator rectangularity obstruction is -mpp-definable in . We start with the obstruction and then recursively quantify away coordinates of by applying -modular quantifiers (which requires significant care) until we obtain a binary non-rectangular relation, for which hardness is known by [25].
Now, suppose that has a Mal’tsev polymorphism. It is known that if a single-sorted 2-element relational structure has a Mal’tsev polymorphism then it also has the operation as a polymorphism [44], where is addition modulo 2. This means that for every domain of there is a polymorphism of that acts like if is equipped with addition modulo 2. The main step of the proof is to show that all the can be chosen the same. Therefore can be represented by a system of linear equations modulo 2, for which the exact number of solutions can be found.
Theorem 21.
Let be a conservative structure and a prime. If does not have a Mal’tsev polymorphism then is -hard. If has a Mal’tsev polymorphism then is solvable in polynomial time.
Proof.
The second statement of the theorem follows from Theorem 8. For the first statement, by Theorem 18 a -indicator rectangularity obstruction is -mpp-definable in . Recall that while . As is conservative, for every (), () is a -subalgebra of . Set
The relation still contains and does not contain . By Proposition 20 is -hard.
Next, we consider the case when is a 3-element structure.
Theorem 22.
Let be a 3-element structure and a prime. If one of the following conditions holds:
-
(a)
has a -automorphic polynomial and has a Mal’tsev polymorphism, or
-
(b)
does not have a -automorphic polynomial, has a Mal’tsev polymorphism, and ,
then is solvable in polynomial time. Also, if
-
(1)
has a -automorphic polynomial and does not have a Mal’tsev polymorphism, or
-
(2)
does not have a -automorphic polynomial and does not have a Mal’tsev polymorphism,
then is -complete.
Proof (idea).
If has a -automorphic polynomial then , and the result follows from Corollary 11 and Proposition 20. If has a Mal’tsev polymorphism and , the result follows from Theorem 8. Therefore, we assume that has no Mal’tsev polymorphism and does not have a -automorphic polynomial. By Theorem 19 a -indicator rectangularity obstruction is -mpp-definable in . We prove that it is possible to -mpp-define a binary non-rectangular relation showing that is -complete. Unlike the case of -conservative structures, it is not possible to restrict with arbitrary subsets of , because they may not be -subalgebras. We therefore use an approach similar to that in the proof of Theorem 21, except every possible combination of -subalgebras of is considered separately.
References
- [1] Libor Barto. The dichotomy for conservative constraint satisfaction problems revisited. In LICS 2011, pages 301–310, 2011. doi:10.1109/LICS.2011.25.
- [2] Libor Barto and Marcin Kozik. Constraint satisfaction problems solvable by local consistency methods. J. ACM, 61(1):3:1–3:19, 2014. doi:10.1145/2556646.
- [3] Libor Barto, Andrei Krokhin, and Ross Willard. Polymorphisms, and how to use them. In Dagstuhl Follow-Ups, volume 7. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2017. doi:10.4230/DFU.VOL7.15301.1.
- [4] Alexander I. Barvinok. Combinatorics and Complexity of Partition Functions, volume 30 of Algorithms and Combinatorics. Springer, 2016. doi:10.1007/978-3-319-51829-9.
- [5] Christoph Berkholz and Martin Grohe. Limitations of algebraic approaches to graph isomorphism testing. In ICALP 2015, volume 9134 of LNCS, pages 155–166. Springer, 2015. doi:10.1007/978-3-662-47672-7_13.
- [6] Andrei A. Bulatov. A dichotomy theorem for constraint satisfaction problems on a 3-element set. J. ACM, 53(1):66–120, 2006. doi:10.1145/1120582.1120584.
- [7] Andrei A. Bulatov. Complexity of conservative constraint satisfaction problems. ACM Trans. Comput. Log., 12(4):24:1–24:66, 2011. doi:10.1145/1970398.1970400.
- [8] Andrei A. Bulatov. The complexity of the counting constraint satisfaction problem. J. ACM, 60(5):34:1–34:41, 2013. doi:10.1145/2528400.
- [9] Andrei A. Bulatov. Conservative constraint satisfaction re-revisited. J. Comput. Syst. Sci., 82(2):347–356, 2016. doi:10.1016/J.JCSS.2015.07.004.
- [10] Andrei A. Bulatov. A dichotomy theorem for nonuniform CSPs. In FOCS, pages 319–330, 2017. doi:10.1109/FOCS.2017.37.
- [11] Andrei A. Bulatov and Víctor Dalmau. A simple algorithm for Mal’tsev constraints. SIAM J. Comput., 36(1):16–27, 2006. doi:10.1137/050628957.
- [12] Andrei A. Bulatov and Víctor Dalmau. Towards a dichotomy theorem for the counting constraint satisfaction problem. Information and Computation, 205(5):651–678, 2007. doi:10.1016/J.IC.2006.09.005.
- [13] Andrei A. Bulatov, Martin E. Dyer, Leslie Ann Goldberg, Markus Jalsenius, Mark Jerrum, and David Richerby. The complexity of weighted and unweighted #CSP. J. Comp. Syst. Sci., 78(2):681–688, 2012. doi:10.1016/J.JCSS.2011.12.002.
- [14] Andrei A. Bulatov and Martin Grohe. The complexity of partition functions. Theor. Comput. Sci., 348(2-3):148–186, 2005. doi:10.1016/J.TCS.2005.09.011.
- [15] Andrei A. Bulatov, Peter Jeavons, and Andrei A. Krokhin. Classifying the complexity of constraints using finite algebras. SIAM J. Comput., 34(3):720–742, 2005. doi:10.1137/S0097539700376676.
- [16] Andrei A. Bulatov and Amirhossein Kazeminia. Complexity classification of counting graph homomorphisms modulo a prime number. In STOC, pages 1024–1037, 2022. doi:10.1145/3519935.3520075.
- [17] Jin-Yi Cai and Xi Chen. Complexity of counting CSP with complex weights. J. ACM, 64(3), 2017. doi:10.1145/2822891.
- [18] Jin-yi Cai, Xi Chen, and Pinyan Lu. Graph homomorphisms with complex values: A dichotomy theorem. In ICALP 2010, volume 6198 of LNCS, pages 275–286. Springer, 2010. doi:10.1007/978-3-642-14165-2_24.
- [19] Jin-Yi Cai, Xi Chen, and Pinyan Lu. Nonnegative weighted #CSP: An effective complexity dichotomy. SIAM J. Comput., 45(6):2177–2198, 2016. doi:10.1137/15M1032314.
- [20] Jin-Yi Cai, Pinyan Lu, and Mingji Xia. The complexity of complex weighted Boolean #CSP. J. Comput. Syst. Sci., 80(1):217–236, 2014. doi:10.1016/J.JCSS.2013.07.003.
- [21] Nadia Creignou and Miki Hermann. Complexity of generalized satisfiability counting problems. Inf. Comput., 125(1):1–12, 1996. doi:10.1006/INCO.1996.0016.
- [22] Martin Dyer and Catherine Greenhill. The complexity of counting graph homomorphisms. Random Structures and Algorithms, 17:260–289, 2000. doi:10.1002/1098-2418(200010/12)17:3/4\%3C260::AID-RSA5\%3E3.0.CO;2-W.
- [23] Martin Dyer and David Richerby. An effective dichotomy for the counting constraint satisfaction problem. SIAM J on Comp, 42(3):1245–1274, 2013. doi:10.1137/100811258.
- [24] Martin E. Dyer, Leslie Ann Goldberg, and Mark Jerrum. The complexity of weighted Boolean #CSP. SIAM J. Comput., 38(5):1970–1986, 2009. doi:10.1137/070690201.
- [25] John Faben. The complexity of counting solutions to generalised satisfiability problems modulo , 2008. arXiv:0809.1836.
- [26] John Faben and Mark Jerrum. The complexity of parity graph homomorphism: an initial investigation. arXiv preprint arXiv:1309.4033, 2013. arXiv:1309.4033.
- [27] Tomás Feder and Moshe Y. Vardi. The computational structure of monotone monadic SNP and constraint satisfaction: A study through Datalog and group theory. SIAM J. Comput., 28(1):57–104, 1998. doi:10.1137/S0097539794266766.
- [28] Jacob Focke, Leslie Ann Goldberg, Marc Roth, and Stanislav Zivny. Counting homomorphisms to -minor-free graphs, modulo 2. CoRR, abs/2006.16632, 2020. arXiv:2006.16632.
- [29] Ralph Freese and Emil Kiss. Universal algebra calculator. Available at http://uacalc.org/.
- [30] Andreas Göbel, Leslie Ann Goldberg, and David Richerby. Counting homomorphisms to square-free graphs, modulo 2. ACM Transactions on Computation Theory (TOCT), 8(3):1–29, 2016. doi:10.1145/2898441.
- [31] Andreas Göbel, J. A. Gregor Lagodzinski, and Karen Seidel. Counting homomorphisms to trees modulo a prime. In MFCS, volume 117, pages 49:1–49:13, 2018. doi:10.4230/LIPIcs.MFCS.2018.49.
- [32] Leslie Ann Goldberg, Martin Grohe, Mark Jerrum, and Marc Thurley. A complexity dichotomy for partition functions with mixed signs. SIAM J. Comput., 39(7):3336–3402, 2010. doi:10.1137/090757496.
- [33] Andreas Göbel, Leslie Ann Goldberg, and David Richerby. The complexity of counting homomorphisms to cactus graphs modulo 2. ACM Trans on Comp Th, 6(4):1–29, 2014. doi:10.1145/2635825.
- [34] J. Hagemann and A. Mitschke. On -permutable congruences. Algebra Universalis, 3:8–12, 1973.
- [35] Richard Hammack, Wilfried Imrich, and Sandi Klavzar. Handbook of Product Graphs, Second Edition. CRC Press, Inc., USA, 2nd edition, 2011.
- [36] Pawel M. Idziak, Petar Markovic, Ralph McKenzie, Matthew Valeriote, and Ross Willard. Tractability and learnability arising from algebras with few subpowers. SIAM J. Comput., 39(7):3023–3037, 2010. doi:10.1137/090775646.
- [37] Peter Jeavons. On the algebraic structure of combinatorial problems. Theoretical Computer Science, 200(1-2):185–204, 1998. doi:10.1016/S0304-3975(97)00230-2.
- [38] P.G. Jeavons, D.A. Cohen, and M. Gyssens. How to determine the expressive power of constraints. Constraints, 4:113–131, 1999. doi:10.1023/A:1009890709297.
- [39] Amirhossein Kazeminia. Complexity of Modular Counting. PhD thesis, Simon Fraser University, 2025.
- [40] Amirhossein Kazeminia and Andrei A Bulatov. Counting homomorphisms modulo a prime number. In MFCS, volume 138 of LIPIcs, pages 59:1–59:13, 2019. doi:10.4230/LIPIcs.MFCS.2019.59.
- [41] Amirhossein Kazeminia and Andrei A. Bulatov. Modular counting CSP: reductions and algorithms. In STACS 2025, volume 327 of LIPIcs, pages 60:1–60:18, 2025. doi:10.4230/LIPIcs.STACS.2025.60.
- [42] Amirhossein Kazeminia and Andrei A. Bulatov. Modular counting CSP: reductions and algorithms. CoRR, abs/2501.04224, 2025. doi:10.48550/arXiv.2501.04224.
- [43] J. A. Gregor Lagodzinski, Andreas Göbel, Katrin Casel, and Tobias Friedrich. On counting (quantum-) graph homomorphisms in finite fields of prime order. CoRR, abs/2011.04827, 2021. arXiv:2011.04827.
- [44] Emil L. Post. The two-valued iterative systems of mathematical logic, volume 5 of Annals Mathematical Studies. Princeton University Press, 1941.
- [45] Leslie Valiant. The complexity of computing the permanent. Theor. Comput. Sci., 8:189–201, 1979. doi:10.1016/0304-3975(79)90044-6.
- [46] Leslie Valiant. The complexity of enumeration and reliability problems. SIAM J. on Comput., 8(3):410–421, 1979. doi:10.1137/0208032.
- [47] Dominic J.A. Welsh. The computational complexity of some classical problems from statistical physics. Oxford Univ. Press, 1990.
- [48] Dmitriy Zhuk. A proof of the CSP dichotomy conjecture. J. ACM, 67(5):30:1–30:78, 2020. doi:10.1145/3402029.