# No-Rainbow Problem and the Surjective Constraint Satisfaction Problem

Surjective Constraint Satisfaction Problem (SCSP) is the problem of deciding whether there exists a surjective assignment to a set of variables subject to some specified constraints. In this paper we show that one of the most popular variants of the SCSP, called No-Rainbow Problem, is NP-Hard. Additionally, we disprove the conjecture saying that SCSP over a constraint language Γ is equivalent to CSP over the same language with constants. Our counter example also shows that the complexity of SCSP cannot be described in terms of polymorphisms of the constraint language.

## Authors

• 12 publications
03/26/2020

### No-Rainbow Problem is NP-Hard

Surjective Constraint Satisfaction Problem (SCSP) is the problem of deci...
07/16/2020

### A dichotomy theorem for nonuniform CSPs simplified

In a non-uniform Constraint Satisfaction problem CSP(G), where G is a se...
03/08/2011

### On Minimal Constraint Networks

In a minimal binary constraint network, every tuple of a constraint rela...
05/01/2020

### Strong subalgebras and the Constraint Satisfaction Problem

In 2007 it was conjectured that the Constraint Satisfaction Problem (CSP...
11/17/2011

### Unbiased Statistics of a CSP - A Controlled-Bias Generator

We show that estimating the complexity (mean and distribution) of the in...
07/13/2020

### Strengthening neighbourhood substitution

Domain reduction is an essential tool for solving the constraint satisfa...
09/01/2020

### Formally Verified Transformation of Non-binary Constraints into Binary Constraints

It is well known in the Constraint Programming community that any non-bi...
##### This week in AI

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

## 1 Main Results

Let be a finite set, be a set of relations on , called a constraint language. Then the Constraint Satisfaction Problem over the constraint language , denoted by , is the following decision problem: given a formula of the form

 R1(z1,1,…,z1,n1)∧⋯∧Rs(zs,1,…,zs,ns),

where and each ; decide whether the formula is satisfiable. The Surjective Constraint Satisfaction Problem over the constraint language , denoted by , is the problem of deciding whether there is a solution such that . In [HubieSlides] Hubie Chen conjectured the following characterization of the complexity of .

###### Conjecture 1.

For any constraint language the problems and are polynomially equivalent.

As it was proved in [SCSPforTwo1997] (see also [SCSPforTwoBook]) this conjecture holds for a 2-element domain. In [chen2014algebraic] Hubie Chen confirmed that polymorphisms of can be used to describe the complexity of . For instance he proved NP-hardness of for admitting only essentially unary polymorphisms. More information about the complexity of the SCSP can be found in the survey [SCSPSURVEY].

Let . The problem is called No-Rainbow-Problem. In fact if we interpret , and 2 as colors, then the relation forbids rainbow. The complexity of was an open question for many years and was formulated in many papers as an important open problem [SCSPSURVEY, HubieSlides]. In the paper we prove that this problem is NP-hard.

###### Theorem 1.

is NP-complete.

Thus, our result confirms Conjecture 1. Unfortunately, we found a counter example to this conjecture.

Let , (here columns are tuples).

Note that is the projection of onto coordinates 2,3 and 4. Hence, every polymorphism of is also a polymorphism of .

###### Theorem 2.

We have

1. is NP-hard.

2. is solvable in polynomial time.

3. is NP-Hard.

Comparing (2) and (3) we derive that the complexity of cannot be described in terms of polymorphisms.

The paper is organized as follows. In Section 2 and Section 3 we give two different proofs of Theorem 1. In Section 4 we prove Theorem 2.

## 2 No-Rainbow problem is NP-Hard (the first proof)

Let be a constraint language on .

The problem is known to be NP-Hard [Schaefer]. Hence, to prove Theorem 1 it is sufficient to prove the following theorem.

###### Theorem 3.

can be polynomially reduced to .

Let us define the reduction. Let be an instance of . Let us build an instance of such that holds if and only if has a surjective solution. Note that the problems and are equivalent because we can always propagate out the equalities.

Construction. Let be the variables of .

Choose variables . We define 14 sets of constraints:

,

,

,

,

,

,

,

,

,

,

,

,

,

.

###### Lemma 4.

holds if and only if has a surjective solution, where .

###### Proof.

Let us show both implications.

Let be a solution of . Put , , , , , for every .

Let us check that all constraints are satisfied.

holds because for any .

holds because for any .

holds because for any .

holds because are from the set .

holds because are from the set .

holds because are from the set .

holds because for any .

holds because for any .

holds because for any .

holds because for any .

holds because each constraint is equivalent to and equivalent to .

holds because each constraint is equivalent to and equivalent to .

holds because whenever .

holds because whenever .

Choose a surjective solution of . By we can choose such that and . Since the solution is surjective, there should be an element in the solution equal to .

Case 1. Assume that and . WLOG we may assume (everything is symmetric) that .

By , , we know that

 {x,x′,x1,…,xn}={0,1},{x,y′,y1,…,yn}={1,2},{x′,y′,z1,…,zn}={0,2}.

Let us show that . If and , then we get a contradiction with .

If , then by we have , by we have , which implies and contradicts .

Let us show that is a solution of .

guarantees that all the constraints of the form hold, guarantees that all the constraints of the form hold, guarantees that all the constraints of the form hold, guarantees that all the constraints of the form hold. Thus, we proved that it is a solution.

Case 2. Assume that and . By we have . By we have . Since the solution is surjective, there should be such that . By we have , by we have . Contradiction.

Case 3. Assume that and for some . By we have , hence . By we have , hence . Since the solution is surjective, there should be such that . By , we have . By we have for every . Contradiction.

Case 4. Assume that and for some . By we have , hence . By , we have . By we obtain and since we have . Then by we obtain for every . If for some , then we get a contradiction with applied to . Since the solution is surjective, the only remaining option is , which contradicts .

Case 5. Assume that . Since the solution is surjective, there exists such that . By and we have . By we have for every , by we have for every . By we have , by we have . Therefore and by we obtain . Hence, none of the variables can be equal to . Contradiction. ∎

## 3 No-Rainbow problem is NP-Hard (the second proof)

Here we present another proof of the fact that the No-Rainbow problem is NP-Hard. By we denote the ternary relation on consisting of all tuples but and .

It is known from [Schaefer] that is NP-hard. Hence, to prove Theorem 1 it is sufficient to prove the following theorem.

###### Theorem 5.

can be polynomially reduced to .

For a relation by we denote the set of all operations preserving (set of all polymorphisms). Note that consists of all essentially unary operations, and all operations such that .

Let be the matrix with 2 columns and rows whose rows are all pairs from . We know that can be defined by a quantifier-free pp-formula over . Here is the set of all graphs of binary operations from .

Let us show how to encode as . Consider an instance of . Let be the variables of and be the set of all triples such that appears in the instance.

We encode every variable with nine variables on . The nine variables assigned to express the binary operation on preserving . We want to be the first projection if and to be the second projection if .

By we denote the following instance

 ⋀i∈[n](fi(M)∈S)⋀i∈[n](f1(x,x)=fi(x,x))⋀(i,j,k)∈TN(fi(0,1),fj(1,2),fk(2,0)) ⋀i,j∈[n],a,b,c∈AN(fi(a,b),fi(c,b),fj(a,c))⋀i,j∈[n],a,b,c∈AN(fi(b,a),fi(b,c),fj(a,c)) ⋀i,j∈[n],a,b,c∈AN(fi(a,b),fi(c,b),fj(c,a))⋀i,j∈[n],a,b,c∈AN(fi(b,a),fi(b,c),fj(c,a))

This instance can be viewed as an instance of because we use only equalities, the relation and the relation .

###### Lemma 6.

holds if and only if has a surjective solution.

###### Proof.

. As we mentioned earlier, it is sufficient to put if , and if .

. Let .

If , then all the functions are essentially unary (and bijective). Assign if depends essentially on the first variable, and if depends essentially on the second variable. Then the third conjunction guarantees that we defined a solution to .

Assume that , then by the properties of , we have for every , which contradicts the surjectivity of the solution.

Assume that . Since the solution is surjective, the remaining two values should appear in the images of some functions and . Note that for every . To get a contradiction we use the last four conjunctions. The last three conjunctions are obtained by permutations of variables in and . Therefore, without loss of generality we consider and such that . By the fourth conjunction we obtain , and then by the fifth conjunction we get . Then by the fourth conjunction we have , which contradicts our assumption. ∎

## 4 Counter example

Recall that , .

is NP-hard.

###### Proof.

Note that . We can check that is not preserved by any idempotent WNU on . Hence, is NP-hard. Therefore, is NP-hard. ∎

is NP-hard.

###### Proof.

can be viewed as the SCSP on the two-element set (we just add a variable that never appears), which is known to be NP-Hard [SCSPforTwo1997, SCSPforTwoBook]. ∎

###### Lemma 9.

can be solved in polynomial time.

###### Proof.

Let We will prove a stronger claim that is tractable for . Consider an instance of .

First, we want to make the instance 1-consistent. The coordinates of have the domains , , and . If a variable has different domains in different constraints then the instance can be simplified. For example, if a variable appears at the fifth position of but it has a smaller domain in some other constraint then we do the following :

 R(x1,x2,x3,x4,x5)∧(x5∈{1,2})=(x1=0)∧σ(x2,x4)∧(x3=1)∧(x5∈{1,2})
 R(x1,x2,x3,x4,x5)∧(x5=0)=(x1=0)∧σ(x2,x3)∧(x4=1)∧(x5=0).

Thus, after we achieved 1-consistency, we may have two cases:

Case 1. The instance does not contain at all. Then the instance is tractable. Indeed, we guess three variables taking values , and and solve a CSP instance over .

Case 2. The instance contains . Then we send the variables with the domain to , the variables with the domain to 1, and the variables with the domain to a. We can check that as a result we obtain a surjective solution of the instance. ∎