    # Algebraic Global Gadgetry for Surjective Constraint Satisfaction

The constraint satisfaction problem (CSP) on a finite relational structure B is to decide, given a set of constraints on variables where the relations come from B, whether or not there is a assignment to the variables satisfying all of the constraints; the surjective CSP is the variant where one decides the existence of a surjective satisfying assignment onto the universe of B. We present an algebraic framework for proving hardness results on surjective CSPs; essentially, this framework computes global gadgetry that permits one to present a reduction from a classical CSP to a surjective CSP. We show how to derive a number of hardness results for surjective CSP in this framework, including the hardness of the disconnected cut problem, of the no-rainbow 3-coloring problem, and of the surjective CSP on all 2-element structures known to be intractable (in this setting). Our framework thus allows us to unify these hardness results, and reveal common structure among them; we believe that our hardness proof for the disconnected cut problem is more succinct than the original. In our view, the framework also makes very transparent a way in which classical CSPs can be reduced to surjective CSPs.

## Authors

##### This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

## 1 Preliminaries

When and are mappings, we use to denote their composition. We adhere to the convention that for any set , there is a single element in ; this element is referred to as the empty tuple, and is denoted by .

### 1.1 Structures, formulas, and problems

A signature is a set of relation symbols; each relation symbol has an associated arity (a natural number), denoted by . A structure over signature consists of a universe which is a set, and an interpretation for each relation symbol . We tend to use the letters to denote structures, and the letters to denote their respective universes. In this article, we assume that signatures under discussion are finite, and also assume that all structures under discussion are finite; a structure is finite when its universe is finite.

By an atom (over a signature ), we refer to a formula of the form where is a relation symbol (in ), , and the are variables. An -formula (over a signature ) is a conjunction where each conjunct is an atom (over ) or a variable equality . With respect to a structure , an -formula over the signature of is satisfied by an mapping to defined on the variables of when:

• for each atom in , it holds that , and

• for each variable equality , it holds that .

When this holds, we refer to as a satisfying assignment of (over ).

We now define the computational problems to be studied. For each structure , define to be the problem of deciding, given a -formula (over the signature of ), whether or not there exists a satisfying assignment, that is, a map to , defined on the variables of , that satisfies over . For each structure , define to be the problem of deciding, given a pair where is a set of variables and is a -formula (over the signature of ) with variables from , whether or not there exists a surjective satisfying assignment on , that is, a surjective map that satisfies over .111 We remark that, given an instance of a problem , variable equalities may be efficiently eliminated in a way that preserves the existence of a surjective satisfying assignment [2, Proposition 2.1]. Likewise, given an instance of a problem , variable equalities may be efficiently eliminated in a way that preserves the existence of a satisfying assignment. Thus, in these problems, whether or not one allows variable equalities in instances is a matter of presentation, for the complexity issues at hand.

Unless mentioned otherwise, when discussing NP-hardness and NP-completeness, we refer to these notions as defined with respect to polynomial-time many-one reductions.

### 1.2 Definability and algebra

Let be a relational structure. A set of mappings , each of which is from a finite set to , is -definable over if there exists a -formula , whose variables are drawn from , such that is the set of satisfying assignments of , with respect to . Let be a finite set; when is a set of mappings, each of which is from to , we use to denote the smallest -definable set of mappings from to (over ) that contains . (Such a smallest set exists, since one clearly has -definability of the intersection of two -definable sets of mappings all sharing the same type.)

Let be a set of mappings from a finite set to a finite set . A partial polymorphism of is a partial mapping such that, for any selection of maps, letting denote the mapping taking each to :

if the mapping from to sending each to the value is defined at each point ,

then it is contained in .

Conventionally, one speaks of a partial polymorphism of a relation ; we here give a more general formulation, as it will be convenient for us to deal here with arbitrary index sets . When is a relation, we apply the just-given definition by viewing each element of as a set of mappings from the set to ; likewise, when is a partial mapping with a natural number, we apply this definition by viewing each element of as a mapping from to . A partial mapping is a partial polymorphism of a relational structure if it is a partial polymorphism of each of the relations of the structure.

The following is a known result; it connects -definability to closure under partial polymorphisms.

###### Theorem 1.1

 Let be a structure. Let be a set of non-empty mappings from a finite set to ; for each , let denote the map defined by . The set is equal to the set of maps from to having a definition of the form , where is a partial polymorphism (of ) with domain .

A polymorphism is a partial polymorphism that is a total mapping. A total mapping is essentially unary if there exists and a unary operation such that, for each mapping , it holds that . An automorphism of a structure is a bijection such that, for each relation of and for each tuple whose arity is that of , it holds that if and only if . It is well-known and straightforward to verify that, for each finite structure , a bijection is an automorphism if and only if it is a polymorphism.

Let be a partial mapping. For each , let denote the mapping from to that sends each element to . The diagonal of , denoted by , is the partial unary mapping from to such that for each . With respect to a structure , we say that a partial mapping is automorphism-like when there exists and an automorphism (of ) such that, for each mapping , if is defined, then it is equal to .

## 2 Framework

Throughout this section, let be a finite relational structure, and let be its universe. Let be a finite set; let be a set of mappings from to . Let us say that is surjectively closed over if each surjective mapping in is contained in . The following is essentially a consequence of Theorem 1.1.

###### Proposition 2.1

Let , be as described. For each , let denote the mapping defined by . The following are equivalent:

• The set is surjectively closed over .

• Each surjective partial polymorphism (of ) with domain is automorphism-like.

In what follows, we generally use to denote a finite set, to denote a finite set of variables, and to denote the set of all mappings from to ; we will sometimes refer to elements of as assignments.

Define an encoding (for ) to be a finite set of mappings, each of which is from a finite power of a finite set to ; we refer to as the arity of such a mapping. Formally, an encoding for is a finite set such that there exists a finite set where, for each , there exists such that is a mapping from to . In what follows, we will give a sufficient condition for an encoding to yield a reduction from a classical CSP over a structure with universe to the problem . Assume to be an encoding; define a -application to be a pair consisting of a tuple of variables from and a mapping such that the length of is equal to the arity of . Let denote the set of all -applications.

###### Example 2.2

Let , , and let be the encoding that contains the mappings from to as well as the injective mappings from to . We have . (This encoding will be used in Section 3.2.)

Let be a set of size . As and , we have . The arity mappings in give rise to -applications and the arity mappings in give rise to -applications. Thus we have .

For each , when is an application in , define to be the value ; define to be the map from to where each application is mapped to . Define .

###### Proposition 2.3

Let be an encoding. There exists a polynomial-time algorithm that, given a finite set , computes an -formula (over the signature of ) defining .

###### Definition 2.4

Let be an encoding. Define a relational structure to be -stable if, for each non-empty finite set , it holds that each map in is surjective, and is surjectively closed (over ).

Note that only the size of matters in the definition of in Definition 2.4, in the sense that when and are of the same size, and are equal up to relabelling of indices.

###### Definition 2.5

Let be an encoding. An -induced relation of is a relation (with ) such that, letting be a tuple of pairwise distinct variables, there exists:

• a relation that is either a relation of or the equality relation on , and

• a tuple

such that . We refer to as the relation that induces , and to the pair as the definition of .

###### Definition 2.6

Let be an encoding. An -induced template of is a relational structure with universe and whose relations are all -induced relations of .

###### Theorem 2.7

Let be an encoding. Suppose that is -stable, and that is an -induced template of . Then, the problem polynomial-time many-one reduces to .

Proof. Let be an instance of with variables . We may assume (up to polynomial-time computation) that does not include any variable equalities. We create an instance of ; this is done by computing two -formulas and , and setting .

Compute to be an -formula defining , where ; such a formula is polynomial-time computable by Proposition 2.3.

Compute as follows. For each atom of where is induced by a relation , let be the mapping sending each to , and include the atom in ; here, is the tuple from Definition 2.5, and acts on an application by being applied individually to each variable in the variable tuple of , that is, when , we have . For each atom of where is induced by the equality relation on , let and be as above, and include the atom in . We make the observation that, from Definition 2.5, a mapping satisfies an atom of if and only if satisfies the corresponding atom or equality in .

We argue that is a yes instance of if and only if is a yes instance of . Suppose that is a satisfying assignment of . The assignment satisfies since . Since the assignment satisfies each atom of , by the observation, the assignment satisfies each atom and equality of , and so is a satisfying assignment of . It also holds that is surjective by the definition of -stable. Thus, we have that is a surjective satisfying assignment of . Next, suppose that there exists a surjective satisfying assignment of . Since satisfies , it holds that . Since is surjectively closed (over ) by -stability, there exists such that for an automorphism of . Since is a satisfying assignment of , so is ; it then follows from the observation that is a satisfying assignment of .

### Inner symmetry

Each set of the form is closed under the automorphisms of , since each automorphism is a partial polymorphism (recall Theorem 1.1). We here present another form of symmetry that such a set may possess, which we dub inner symmetry. Relative to a structure and an encoding , we define an inner symmetry to be a pair where is a bijection, and is an automorphism of such that ; here, when is a mapping, is defined as the composition , where denotes the mapping from to that applies to each entry of a tuple in . When is an inner symmetry, we naturally extend the definition of so that it is defined on each application: when is an application, define .

The following theorem describes the symmetry on induced by an inner symmetry.

###### Theorem 2.8

Let be a structure, let be an encoding, and let be an inner symmetry thereof. Let be a non-empty finite set. For any map , define by ; it holds that if and only if .

Proof. For each , define to map each to . Define as . By definition, ; since is a bijection, we have that . Since is an automorphism of , we obtain .

Since is an inner symmetry, we have , from which it follows that the action of on applications in is a bijection on . We have . For any map , define by . For all , we have , implying that . Since , the theorem follows.

## 3 Hardness results

Throughout this section, we employ the following conventions. When is a set and , we use the notation to denote the arity function from to sending the empty tuple to . Let be a set, and let be an encoding. When , we overload the notation and also use it to denote the unique -application in which it appears. Relative to a structure (understood from the context), when are applications and is a relation symbol, we write when, for each , it holds that ; when is a symmetric binary relation, we also say that and are adjacent. When is an application in , and is a partial mapping, we simplify notation by using to denote the value (recall the definition of from Proposition 2.1).

### 3.1 Disconnected cut: the reflexive 4-cycle

Let us use to denote the reflexive -cycle, that is, the structure with universe and single binary relation . The problem was shown to be NP-complete by ; we here give a proof using our framework. When discussing this structure, we will say that two values are adjacent when . Set . We use the notation to denote the function with , so, for example denotes the identity mapping from to . Define as the encoding

 {¯¯¯0,¯¯¯1,¯¯¯2,¯¯¯3,,,,,,,}.

We will prove the following.

###### Theorem 3.1

The reflexive -cycle is -stable.

We begin by observing the following.

###### Proposition 3.2

Define as the bijection that swaps and ; define as the bijection that swaps and . The pair is an inner symmetry of and .

Proof. Consider the action of on . This action transposes and ; and ; and ; and, and . It fixes each other element of .

Proof. (Theorem 3.1) Let be a non-empty finite set; we need to show that is surjectively closed. We use Proposition 2.1. It is straightforward to verify that each surjective partial polymorphism of the described form that has a surjective diagonal is automorphism-like. We consider a partial polymorphism whose domain is over all -applications . We show that if has a non-surjective diagonal, then it is not surjective.

By considerations of symmetry (namely, by the automorphisms and by the inner symmetries), it suffices to consider the following values for the diagonal values : , , , , , , , . We consider each of these cases.

In each of the first cases, we argue as follows. Consider an application with in and ; it is adjacent to , adjacent to , or adjacent to both and ; thus, for such an application, we have is adjacent to . It follows that for no such application do we have , and so is not surjective.

Case: diagonal . Observe that any application with in and ; is adjacent to , , or , and thus, for any such application, is adjacent to . Thus if is in the image of , there exists a variable such that . But then, for each in , we have that and are adjacent. and are adjacent to , which maps to , and to , which maps to ; this, by the observation, . and are adjacent to the just-mentioned applications, from which we obtain .

In order for to be surjective, there exists a different variable and such that . It must be that is not adjacent to . But then is or , and this contradicts that is adjacent to .

Case: diagonal . There must be an application with . Since cannot be adjacent to nor , it must be that . There must also be an application with ; this application cannot be adjacent to nor , and so is or . is adjacent to , to , and to , and so is . is adjacent to , to , to , and to , and thus it cannot be mapped to any value.

Case: diagonal or . For each variable and each in , it holds that is adjacent to either or . It follows that no such pair maps to under .

Case: diagonal . If is surjective, there exists such that . cannot be adjacent to , implying that or . When , we infer that , and then that . Similarly, when , we infer that , and then that . There exists such that . cannot be adjacent to nor , so is one of , , . This contradicts that and are adjacent.

###### Theorem 3.3

The problem is NP-complete.

Proof. Define (following [7, Section 2]) to be the structure with universe and with relations

 SD′1={(0,3),(1,1),(3,1),(3,3)},SD′2={(1,0),(1,1),(3,1),(3,3)},
 SD′3={(1,3),(3,1),(3,3)},SD′4={(1,1),(1,3),(3,1)}.

Each of these relations is the intersection of binary -induced relations: for , use the definitions , ; for , the definitions , ; for , the definitions , , ; and, for , the definitions , , . Let be the -induced template of whose relations are all of the mentioned -induced relations. Then, we have reduces to , and that reduces to by Theorem 2.7. The problem is NP-complete, as argued in [7, Section 2], and thus we conclude that is NP-complete.

### 3.2 No-rainbow 3-coloring

Let be the structure with universe and a single ternary relation

 RN={(a,b,c)∈N3 | {a,b,c}≠N}.

The problem was first shown to be NP-complete by Zhuk ; we give a proof which is akin to proofs given by Zhuk , using our framework.

Define , and define as where is the set of all injective mappings from to . We use the notation to denote the mapping with . Let denote the identity mapping on ; it is straightforwardly verified that, for each bijection , the pair is an inner symmetry of and .

###### Theorem 3.4

The structure is -stable.

Proof. Let be a non-empty finite set; we need to show that is surjectively closed. We use Proposition 1.1. It is straightforward to verify that each surjective partial polymorphism of the described form having a surjective diagonal is automorphism-like. Consider a partial polymorphism whose domain is over all -applications . We show that if has a non-surjective diagonal, then it is not surjective. By considerations of symmetry (namely, by the automorphisms and by the inner symmetries), we need only consider the following values for the diagonal : , .

Diagonal . Assume is surjective; there exist applications , such that , . In the case that , we have but that these applications are, under , equal to , a contradiction. Otherwise, there is one value in ; suppose this value is . Let be the value in , and be the value in . We claim that : if it is , we get a contradiction via , and if it is , we get a contradiction via . By analogous reasoning, we obtain that . But since , we may reason as in the previous case to obtain a contradiction.

Diagonal . Assume is surjective; there exists an application such that . We have that , for if not, we would have a contradiction via . Analogously, we have that . Thus, we have . Suppose that is (the case where it is is analogous). Consider the value of : if it is , we have a contradiction via , if it is , we have a contradiction via ; if it is , we have a contradiction via .

###### Theorem 3.5

The problem is NP-complete.

Proof. The not-all-equal relation is an -induced relation of , via the definition . It is well-known that the problem on a structure having this relation is NP-complete via Schaefer’s theorem, and thus we obtain the result by Theorem 2.7.

### 3.3 Diagonal-cautious clones

We show how the notion of stability can be used to derive the previous hardness result of the present author . Let be a set of size . When is a structure with universe , we use to denote the structure obtained from by adding, for each , a relation . A set of operations on is diagonal-cautious if there exists a map such that:

• for each operation , it holds that , and

• for each tuple , if , then .

###### Theorem 3.6

Suppose that the set of polymorphisms of a relational structure is diagonal-cautious, and that the universe of has size . There exists an encoding , whose elements each have arity , such that:

• the structure is -stable, and

• there is a surjective mapping in where, for each relation of , the relation is an -induced relation.

It consequently holds that reduces to .

Proof. Suppose that the polymorphisms of are diagonal-cautious via . By Lemma 3.3 of , there exists a relation of arity with the following properties:

1. is -definable.

2. For each tuple , it holds that each entry of this tuple is in .

3. For each , there exist values such that .

4. For each tuple , there exists a polymorphism of such that .

We associate the coordinates of with the variables . In the scope of this proof, when is one of these variables, we use to denote the operator that projects a tuple onto the coordinate corresponding to . Let be the subset of that contains each tuple such that, for each , it holds that . Let be a listing of the tuples in . Let , and let contain, for each , the map defined by . Observe that is surjective, by (2).

We verify that the structure is -stable, as follows. Let be a finite non-empty set. Observe that for each and each , the map sends the applications to