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.


Background
The constraint satisfaction problem (CSP) is a computational problem in which one is to decide, given a set of constraints on variables, whether or not there is an assignment to the variables satisfying all of the constraints.This problem appears in many guises throughout computer science, for instance, in database theory, artificial intelligence, and the study of graph homomorphisms.One obtains a rich and natural family of problems by defining, for each relational structure B, the problem CSP(B) to be the case of the CSP where the relations used to specify constraints must come from B. Recall that a relational structure consists of a universe, a set-assumed to be finite throughout this article-and indexed relations over this universe; we will refer to a relational structure whose universe has size k as a k-element structure.Let us refer to a problem of the form CSP(B) as a classical CSP.In a celebrated development, Bulatov [3] and Zhuk [32], independently, classified the complexity of all classical CSPs, showing each to be either polynomial-time tractable or NP-complete; the algorithmic and complexity aspects of this problem family, and their many links to numerous regions of theoretical computer science, had drawn significant attention over the preceding two decades or so [21].
A natural variant of the CSP is the problem where an instance is again a set of constraints, but the question is to decide whether or not there is a surjective satisfying assignment to the variables.For each relational structure B, in analogy to the definition of the problem CSP(B), one can define the surjective CSP over B, denoted by SCSP(B), as the case of this variant where the relations used to specify constraints must come from B; then, the question is to decide if there exists a satisfying assignment that is surjective onto the universe of B. Let us refer to a problem of the form SCSP(B) as a surjective CSP; each such problem is readily seen to be in NP.We remark that such a problem SCSP(B) can be formulated as the problem of deciding, given as input a relational structure A, whether or not A admits a homomorphism to B that is surjective onto the universe of B. Surjective CSPs are studied and relevant in a number of contexts: • In graph theory, there is a literature studying the problems SCSP(H), over graphs H (see for example [1,16,27,15,24] and the references therein).Typically, in this literature such a problem is formulated as a homomorphism problem, and referred to as the surjective Hcoloring problem.
Here, we want to introduce a particular such problem, the disconnected cut problem: given a graph G, decide if it has a cut that is disconnected; that is, decide if there exists a nonempty, proper subset U of its vertex set V such that the induced subgraphs G[U ] and G[V \ U ] are disconnected.This problem arises in numerous contexts [27, Section 1], including the theory of vertex cuts and graph connectivity, graph partitions, and vertex covers of graphs; it is equivalent to the problem SCSP(H) where H is the reflexive 4-cycle.This problem was proved to be NP-complete by Martin and Paulusma [27].
• In the theory of hypergraphs, colorings of hypergraphs with varied edge types have been studied.For example, mixed hypergraphs [31,19] consist of edges and co-edges; an assignment of colors to vertices is considered to properly color an edge when two vertices therein are mapped to different colors, and to properly color a co-edge when two vertices therein are mapped to the same color.
Here, we wish to introduce the no-rainbow 3-coloring problem: given a hypergraph consisting of size 3 co-edges, decide if there is a coloring with 3 colors in its image.Equivalently, one is given a 3-uniform hypergraph, and the question is whether or not there is a vertex coloring, with image size 3, such that for each edge, it is not the case that the three vertices therein are mapped to three different colors-that is, no edge yields a rainbow.This problem is equivalent to the problem SCSP(N) where N is the structure with universe N = {0, 1, 2} and a single ternary relation {(a, b, c) ∈ N 3 | {a, b, c} = N }; it was highlighted as an open problem in a survey on surjective CSPs [1], and this relation arises naturally in universal algebra within the theory of maximal clones [28].This problem was recently proved to be NP-complete by Zhuk [33].
• In the context of constraint satisfaction, surjectivity is a form of global cardinality constraint; such constraints are studied heavily in constraint processing and in constraint programming, and have been investigated from the complexity-theoretic viewpoint [30,4].
The natural research program in this area is to work towards the obtention of a full classification of all surjective CSPs, akin to the classification of all classical CSPs.In addition to providing information on the complexity of individual surjective CSPs of interest, such a classification could provide a rich source of problems from which one could try to reduce in developing NP-hardness proofs. 1 Moreover, the classification of classical CSPs is appealing in that the criterion delineating the two complexity behaviors [3,32,9] is a relatively simple algebraic one which robustly admits multiple natural characterizations (and which possesses relatively low complexity!); one could hope for such a criterion in the context of surjective CSPs.Furthermore, studying the complexity of classical CSPs led to a rich general theory having interactions with many other areas of theoretical computer science, and one might hope for a similar situation with surjective CSPs.Regarding known classifications, a dichotomy theorem that classifies the complexity of each surjective CSP on a 2-element structure has been known for many years [11,Theorem 6.12], but a classification for all 3-element structures is currently open.Here, we can mention that optimization and counting flavors of the surjective CSP have also been studied [14,13,6].
A striking, frustrating, and somewhat mysterious aspect of the literature on surjective CSPs thus far is the apparent difficulty of establishing intractability results; this has been mentioned on a number of occasions (Sections 1 of [1,15,24]).In particular, the various techniques used for proving intractability seem disparate, ad hoc, and not obviously amenable to generalization.As barometers of this claim, consider that the intractability of the disconnected cut problem was the subject of an entire article [27], and that this article as well as the one [33] exhibiting the intractability of no-rainbow 3-coloring do not explicitly develop machinery nor technology that permits the derivation of other hardness results in the literature.The situation here can be contrasted with even the early work on classical CSPs, where results tended to address classes of relational structures [20], as opposed to individual relational structures.The present author did present an algebraic sufficient condition of hardness for surjective CSPs [5]; while this condition applies to each 2-element structure having a hard surjective CSP, it provably does not apply to prominent examples such as disconnected cut and no-rainbow 3-coloring.2

Contributions
What seems to be lacking in this research area is unified, general technology for proving hardness results.In this article, we make a contribution in this direction by presenting a framework wherein one can establish reductions from classical CSPs to surjective CSPs.We derive the following frontier results using our framework: • The NP-hardness of the disconnected cut problem (Section 4.1).
• The NP-hardness of each problem SCSP(B) that is intractable according to the mentioned dichotomy theorem on 2-element structures B (Section 4.3).
We believe that our hardness proof for the disconnected cut problem is more succinct than the original, not just literally, but also in a conceptual sense; consider that the original proof centrally involved reasoning about the diameter of produced instance graphs, whereas such reasoning is fully absent from our proof.The third hardness result named here is obtained by showing that the present author's previous algebraic sufficient condition for hardness [5] can be obtained within the framework of the present article.
Our framework (presented in Section 3) can be described on a high-level as follows.Let B be a structure.When the framework is applicable to the structure B, it permits, for any finite set V of variables, the computation of an instance Φ V of SCSP(B) with the following properties: each surjective satisfying assignment of Φ V encodes an assignment g : V → D, where D is a finite set (which is uniform over all V ); and, conversely, each assignment g : V → D is encoded by a surjective satisfying assignment of Φ V .Thus, the instance Φ V , in essence, encodes the space G V,D of all assignments g : V → D.Then, adding constraints to Φ V places constraints on the allowable assignments in this space G V,D ; in this way, the problem SCSP(B) can simulate-formally, admit a reduction from-a problem CSP(D), where D is a structure with universe D and appropriately defined relations.
We conceive of the instances Φ V as a form of global gadgetry or of scaffolding that, once configured, enables the use of local gadgetry encoding individual constraints.We believe that our framework makes very transparent why and how surjective CSPs permit reductions from classical CSPs; also, we believe that the roles of the various introduced constraints in these reductions is highly transparent.We hypothesize that progress in this area was hindered by the lack of systematic tools for computing and reasoning about such global gadgetry.We provide evidence for the well-behavedness of our framework, by showing that under a certain assumption, whether or not the framework is applicable is decidable (Section 5).
Our framework has implications beyond those described for the complexity of the decision problems SCSP(B).We show (Section 6) that the framework can also be used to derive NP-hardness of cases of the problem of deciding if a given relational structure A has a condensation to a second relational structure B, where a condensation is a surjective satisfying assignment that also maps the tuples of each relation of A surjectively onto the corresponding relation of B. We also discuss implications for the sparsifiability of the problems SCSP(B) (Section 7); this setting concerns polynomial-time reductions from a hard problem SCSP(B) to a second problem, such that the output instance obeys a size guarantee.
Overall, we wish to emphasize our introduction of systematic machinery, the unifying nature of this machinery in terms of yielding a common understanding of previously disparate hardness proofs, and the clarifying and transparent nature of our approach.Our work also ties into a large body of work on CSPs and other problems that utilizes algebraic closure properties of solution spaces as a way of obtaining insight into the complexity of problems.In particular, we make use of such properties in the form of so-called partial polymorphisms, and our work contributes to a growing literature which uses partial polymorphisms as a tool to understand the complexity of various computational problems [18,22,7,10,23].

Preliminaries
When f : A → B and g : B → C are mappings, we use g • f to denote their composition.We adhere to the convention that for any set S, there is a single element in S 0 ; this element is referred to as the empty tuple, and is denoted by ǫ.

Structures, formulas, and problems
A signature is a set of relation symbols; each relation symbol R has an associated arity (a natural number), denoted by ar(R).A structure B over signature σ consists of a universe B which is a set, and an interpretation R B ⊆ B ar(R) for each relation symbol R ∈ σ.We tend to use the letters A, B, . . . to denote structures, and the letters A, B, . . . 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 R(v 1 , . . ., v k ) where R is a relation symbol (in σ), k = ar(R), and the v i are variables.An ∧-formula (over a signature σ) is a conjunction Here, we permit an empty conjunction.With respect to a structure B, an ∧-formula φ over the signature of B is satisfied by an mapping f to B defined on the variables of φ when: When this holds, we refer to f as a satisfying assignment of φ (over B).Note that the empty conjunction is considered to be satisfied by any such mapping f .We now define the computational problems to be studied.For each structure B, define CSP(B) to be the problem of deciding, given a ∧-formula φ (over the signature of B), whether or not there exists a satisfying assignment, that is, a map f to B, defined on the variables of φ, that satisfies φ over B. For each structure B, define SCSP(B) to be the problem of deciding, given a pair (U, φ) where U is a set of variables and φ is a ∧-formula (over the signature of B) with variables from U , whether or not there exists a surjective satisfying assignment on U , that is, a surjective map f : U → B that satisfies φ over B. 3Unless mentioned otherwise, when discussing NP-hardness and NP-completeness, we refer to these notions as defined with respect to polynomial-time many-one reductions.

Definability and algebra
Let B be a relational structure.Let S be a finite set, and let F be a set of mappings, each of which is from S to B. We say that F is ∧-definable over B if there exists a ∧-formula φ, whose variables are drawn from S, such that F is the set of satisfying assignments f : S → B of φ, with respect to B. Let S be a finite set; when T is a set of mappings, each of which is from S to B, we use T B to denote the smallest ∧-definable set of mappings from S to B (over B) that contains T .(Such a smallest set exists: over a structure B, the set of all mappings from a finite set S to is B ∧-definable via the empty conjunction; and, one clearly has ∧-definability of the intersection of two ∧-definable sets of mappings all sharing the same type.)Let T be a set of mappings from a finite set I to a finite set B. A partial polymorphism of T is a partial mapping p : B J → B such that, for any selection s : J → T of maps, letting c i ∈ B J denote the mapping taking each j ∈ J to (s(j))(i): if the mapping from I to B sending each i ∈ I to the value p(c i ) is defined at each point i ∈ I, then it is contained in T .
Conventionally, one speaks of a partial polymorphism of a relation Q ⊆ B k ; we here give a more general formulation, as it will be convenient for us to deal here with arbitrary index sets I.When Q ⊆ B k is a relation, we apply the just-given definition by viewing each element of Q as a set of mappings from the set {1, . . ., k} to B; likewise, when p : B k → B is a partial mapping with k ≥ 0 a natural number, we apply this definition by viewing each element of B k as a mapping from {1, . . ., k} to B. A partial mapping p : B J → B 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 2.1 [29] Let B be a structure.Let T be a set of non-empty mappings from a finite set I to B; for each i ∈ I, let π i : T → B denote the map defined by π i (t) = t(i).The set T B is equal to the set T ′ of maps from I to B having a definition of the form i → p(π i ), where p : We provide a proof of this theorem for the sake of completeness.Proof.It is straightforward to verify that each partial polymorphism of B is also a partial polymorphism of T B .It thus holds that In order to establish that T B ⊆ T ′ , it suffices to show that T ′ is ∧-definable over B. Since equalities are permitted in ∧-formulas, it suffices to prove the result in the case that the maps π i are pairwise distinct.Let θ be the ∧-formula where, for each relation symbol R, the atom R(i 1 , . . ., i k ) is included as a conjunct if and only if each t ∈ T satisfies (t(i 1 ), . . ., t(i k )) ∈ R B .By the definition of partial polymorphism, we have that each map in T ′ satisfies θ.On the other hand, when u : I → B is a map that satisfies the formula θ, consider the partial mapping q : B T → B sending π i to u(i); this is well-defined since the π i are pairwise distinct, and is a partial polymorphism, by the construction of θ.
A polymorphism is a partial polymorphism that is a total mapping.A total mapping p : B J → B is essentially unary if there exists j ∈ J and a unary operation u : B → B such that, for each mapping h : It is well-known and straightforward to verify that, for each finite structure B, a bijection σ : B → B is an automorphism if and only if it is a polymorphism.
Let p : B J → B be a partial mapping.For each b ∈ B, let b J denote the mapping from J to B that sends each element j ∈ J to b.The diagonal of p, denoted by p, is the partial unary mapping from B to B such that p(b) = p(b J ) for each b ∈ B. With respect to a structure B, we say that a partial mapping p : B J → B is automorphism-like when there exists j ∈ J and an automorphism γ (of B) such that, for each mapping h : J → B, if p(h) is defined, then it is equal to γ(h(j)).

Framework
Throughout this section, let B be a finite relational structure, and let B be its universe.Let I be a finite set; let T be a set of mappings from I to B. Let us say that T is surjectively closed over B if each surjective mapping in T B is contained in {γ • t | γ is an automorphism of B, t ∈ T }.The following is essentially a consequence of Theorem 2.1.Proposition 3.1 Let I, T be as described.For each i ∈ I, let π i : T → B denote the mapping defined by π i (t) = t(i).The following are equivalent: • The set T is surjectively closed over B.
• Each surjective partial polymorphism p : We consider a partial polymorphism p : B T → B to be surjective when, for each b ∈ B, there exists h ∈ B T such that p(h) is defined and is equal to b. Proof.Suppose that T is surjectively closed over B. Let p : B T → B be a surjective partial polymorphism with the described domain.By Theorem 2.1, the map t ′ defined by i → p(π i ) is an element of T B ; note also that this map is surjective.By the definition of surjectively closed, it holds that t ′ has the form γ(t), where γ is an automorphism of B, and t ∈ T .It follows that p is automorphism-like.
Suppose that each surjective partial polymorphism from B T to B with the described domain is automorphism-like.By Theorem 2.1, each surjective mapping t ′ in T B is defined by i → p(π i ) where p is a partial polymorphism; note that p is surjective.By hypothesis, p is automorphism-like; it follows that t ′ has the form γ(t) where γ is an automorphism of B, and t ∈ T .We conclude that T is surjectively closed.
In what follows, we generally use D to denote a finite set, V to denote a finite set of variables, and G V,D to denote the set of all mappings from V to D; we will sometimes refer to elements of G V,D as assignments.
Define an encoding (for B) to be a finite set F of mappings, each of which is from a finite power D k of a finite set D to B; we refer to k as the arity of such a mapping.Formally, an encoding for B is a finite set F such that there exists a finite set D where, for each f ∈ F , there exists k ≥ 0 such that f is a mapping from D k to B. 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 D to the problem SCSP(B).Assume F to be an encoding; define a (V, F )-application to be a pair (v, f ) consisting of a tuple of variables from V and a mapping f ∈ F such that the length of v is equal to the arity of f .Let A V,F denote the set of all (V, F )-applications.Let V be a finite set of variables; let F be an encoding.For each g ∈ G V,D , when α = ((v 1 , . . ., v k ), f ) is an application in A V,F , define α[g] to be the value f (g(v 1 ), . . ., g(v k )); define t[g] to be the map from A V,F to B where each application α is mapped to α Proposition 3.3 Let F be an encoding.There exists a polynomial-time algorithm that, given a finite set V , computes an ∧-formula (over the signature of B) defining T V,F B .
Let us clarify how polynomial time is measured here: we assume that the input to the algorithm is simply a finite set V , and that such a set is encoded by a list where each element appears explicitly; so, in particular, the length of a set's encoding is larger than |V |.Proof.The algorithm performs the following.For each relation R B of B, let k be its arity.For each tuple (α 1 , . . ., α k ) ∈ A k V,F , the projection of T onto (α 1 , . . ., α k ) can be computed, by considering all possible assignments on the variables in V that appear in the α i ; note that the number of such variables is bounded by a constant, since both the signature of B and F are assumed to be finite.If this projection is a subset of R B , then include R(α 1 , . . ., α k ) in the formula; otherwise, do not.Perform the same process for the equality relation on B, with k = 2; whenever the projection is a subset of this relation, include α 1 = α 2 in the formula.Definition 3.4 Let F be an encoding.Define a relational structure B to be F -stable if, for each non-empty finite set V , it holds that each map in T V,F is surjective, and T V,F is surjectively closed (over B).
Note that, relative to an encoding F , only the size of V matters in the definition of T V,F in Definition 3.4, in the sense that when V and V ′ are of the same size, T V,F and T V ′ ,F are equal up to relabelling of indices.Definition 3.5 Let F be an encoding.An F -induced relation of B is a relation Q ′ ⊆ D s (with s ≥ 1) such that, letting (u 1 , . . ., u s ) be a tuple of pairwise distinct variables, there exists: • a relation Q ⊆ B r that is either a relation of B or the equality relation on B, and We refer to Q as the relation that induces Q ′ , and to the pair (Q, (α 1 , . . ., α r )) as the definition of Q ′ .Definition 3.6 Let F be an encoding.An F -induced template of B is a relational structure D with universe D and whose relations are all F -induced relations of B. Theorem 3.7 Let F be an encoding.Suppose that B is F -stable, and that D is an F -induced template of B. Then, the problem CSP(D) polynomial-time many-one reduces to SCSP(B).
Proof.Let φ be an instance of CSP(D) with variables V .We may assume (up to polynomial-time computation) that φ does not include any variable equalities.We create an instance (A V,F , ψ) of SCSP(B); this is done by computing two ∧-formulas ψ 0 and ψ 1 , and setting ψ = ψ 0 ∧ ψ 1 .
Compute ψ 0 to be an ∧-formula defining T V,F B , where Compute ψ 1 as follows.For each atom R ′ (v 1 , . . ., v s ) of φ where R ′D is induced by a relation R B , let c : {u 1 , . . ., u s } → V be the mapping sending each u i to v i , and include the atom R(c(α 1 ), . . ., c(α r )) in ψ 1 ; here, (α 1 , . . ., α r ) is the tuple from Definition 3.5, and c acts on an application α by being applied individually to each variable in the variable tuple of α, that is, when α = ((u ′ 1 , . . ., u ′ k ), f ), we have c(α) = ((c(u ′ 1 ), . . ., c(u ′ k )), f ).For each atom R ′ (v 1 , . . ., v s ) of φ where R ′D is induced by the equality relation on B, let c and (α 1 , α 2 ) be as above, and include the atom c(α 1 ) = c(α 2 ) in ψ 1 .We make the observation that, from Definition 3.5, a mapping g ∈ G V,D satisfies an atom R ′ (v 1 , . . ., v s ) of φ if and only if t[g] satisfies the corresponding atom or equality in ψ 1 .
We argue that φ is a yes instance of CSP(D) if and only if (A V,F , ψ) is a yes instance of SCSP(B).Suppose that g ∈ G V,D is a satisfying assignment of φ.The assignment t[g] satisfies ψ 0 since t[g] ∈ T V,F .Since the assignment g satisfies each atom of φ, by the observation, the assignment t[g] satisfies each atom and equality of ψ 1 , and so t[g] is a satisfying assignment of ψ 1 .It also holds that t[g] is surjective by the definition of F -stable.Thus, we have that t[g] is a surjective satisfying assignment of ψ.Next, suppose that there exists a surjective satisfying assignment t ′ of ψ.Since t ′ satisfies ψ 0 , it holds that t ′ ∈ T V,F B .Since T V,F is surjectively closed (over B) by F -stability, there exists g ∈ G V,D such that t ′ = γ(t[g]) for an automorphism γ of B. Since t ′ is a satisfying assignment of ψ, so is t[g]; it then follows from the observation that g is a satisfying assignment of φ.

Inner symmetry
Each set of the form T V,F B is closed under the automorphisms of B, since each automorphism is a partial polymorphism (recall Theorem 2.1).We here present another form of symmetry that such a set T V,F B may possess, which we dub inner symmetry.Relative to a structure B and an encoding F , we define an inner symmetry to be a pair σ = (ρ, τ ) where ρ : D → D is a bijection, and τ : B → B is an automorphism of B such that F = { σ • f | f ∈ F }; here, when g : D k → B is a mapping, σ(g) : D k → B is defined as the composition τ • g • (ρ, . . ., ρ), where (ρ, . . ., ρ) denotes the mapping from D k to D k that applies ρ to each entry of a tuple in D k .When σ is an inner symmetry, we naturally extend the definition of σ so that it is defined on each application: when α = (v, f ) is an application, define σ(α) = (v, σ(f )).
The following theorem describes the symmetry on T V,F B induced by an inner symmetry.
Theorem 3.8 Let B be a structure, let F be an encoding, and let σ = (ρ, τ ) be an inner symmetry thereof.Let V be a non-empty finite set.For any map u :

Hardness results
Throughout this section, we employ the following conventions.When B is a set and b ∈ B, we use the notation b to denote the arity 0 function from D 0 to B sending the empty tuple to b.Let V be a set, and let F be an encoding.When b ∈ F , we overload the notation b and also use it to denote the unique (V, F )-application in which it appears.Relative to a structure B (understood from the context), when α 1 , . . ., α k ∈ A V,F are applications and R is a relation symbol, we write R(α 1 , . . ., α k ) when, for each g ∈ G V,D , it holds that (α 1 [g], . . ., α k [g]) ∈ R B ; when R is a symmetric binary relation, we also say that α 1 and α 2 are adjacent.When α is an application in A V,F , and p : B T V,F → B is a partial mapping, we simplify notation by using p(α) to denote the value p(π α ) (recall the definition of π α from Proposition 3.1).

Disconnected cut: the reflexive 4-cycle
Let us use C to denote the reflexive 4-cycle, that is, the structure with universe C = {0, 1, 2, 3} and single binary relation (1,3), (3, 1)}.The problem SCSP(C) was shown to be NP-complete by [27]; we here give a proof using our framework.When discussing this structure, we will say that two values c, c ′ ∈ C are adjacent when We will prove the following.Proof.(Theorem 4.1) Let V be a non-empty finite set; we need to show that T V,F is surjectively closed.We make use of Proposition 3.1.Consider a partial polymorphism p : We first consider the situation where p has a surjective diagonal; we want to show that p is automorphism-like.Define β : C → C by β(c) = p(c).We have that β is surjective and a polymorphism of C, implying that it is an automorphism of C. By considerations of symmetry (in particular, by replacing p with the translation β −1 •p, and then translating back post-argument), we may assume that (p(0), p(1), p(2), p(3)) = (0, 1, 2, 3).Under this assumption, it is straightforward to verify the following fact: for any application (v, [abc]), it holds that p(v, [abc]) ∈ {a, b, c}.For example, in the case that the set {a, b, c} has size 2 and its two elements a ′ , b ′ are adjacent in C, (v, [abc]) is adjacent to a ′ and b ′ , implying that p(v, [abc]) is adjacent to both p(a ′ ) = a ′ and p(b ′ ) = b ′ , and is thus in {a ′ , b ′ }.In the following reasoning, we implicitly use this fact, continually.Fix v to be a variable.We show that there exists a map g v : {v} → D such that, for each f ∈ F , p(v, f ) = f (g v (v)).This suffices, since then one can define a map g ∈ G V,D that extends all of the maps (g v ) to derive the map t[g] ∈ T V,F equal to the map sending each application α to p(α) = p(π α ).
We have analyzed the situation where p has a surjective diagonal.To establish the result, it suffices to show that if p has a non-surjective diagonal, then it is not surjective; this is what we do in the rest of the proof.
In each of the first 3 cases, we argue as follows.Consider an application (v, f ) with f : D → B in F and v ∈ V ; it is adjacent to 0, adjacent to 3, or adjacent to both 1 and 2; thus, for such an application, we have p(v, f ) is adjacent to 0. It follows that for no such application do we have p(v, f ) = 2, and so p is not surjective.
Case: diagonal (1, 0, 0, 0).Observe that any application (v, f ) with f : D → C in F \ {[013]} and v ∈ V ; is adjacent to 1, 2, or 3, and thus, for any such application, p(v, f ) is adjacent to 0. Thus if 2 is in the image of p, there exists a variable u ∈ V such that p(u, In order for p to be surjective, there exists a different variable u ′ ∈ V and f ′ ∈ F such that p(u ′ , f ′ ) = 3.It must be that (u ′ , f ′ ) is not adjacent to 0. But then f ′ is [323] or [112], and this contradicts that (u ′ , f ′ ) is adjacent to (u, f ).
Case: diagonal (0, 0, 1, 1).There must be an application (v, f ) with p(v, f ) = 2. Since (v, f ) cannot be adjacent to 0 nor 1, it must be that f = [323].There must also be an application (v ′ , f ′ ) with p(v ′ , f ′ ) = 3; this application cannot be adjacent to 2 nor 3, and so ]), to f ′ , to 0, and to 2, and thus it cannot be mapped to any value.

Diagonal-cautious clones
We show how the notion of stability can be used to derive the previous hardness result of the present author [5].The previous hardness result [5] that we rederive here is that when B is a structure whose polymorphisms are diagonal-cautious, it holds that CSP(B * ) reduces to SCSP(B).Theorem 4.6 Suppose that the set of polymorphisms of a relational structure B is diagonal-cautious, and that the universe B of B has size n ≥ 2. There exists an encoding F , whose elements each have arity ≤ 1, such that: • the structure B is F -stable, and It consequently holds that CSP(B * ) reduces to SCSP(B).
Proof.Suppose that the polymorphisms of B are diagonal-cautious via G : B n → ℘(B).By Lemma 3.3 of [5], there exists a relation P ⊆ B (n n ) with the following properties: (0) P is ∧-definable.We associate the coordinates of P with the variables (v 1 , . . ., v n , x, y 1 , . . ., y m ).In the scope of this proof, when z is one of these variables, we use π z to denote the operator that projects a tuple onto the coordinate corresponding to z.Let P ′ be the subset of P that contains each tuple q ∈ P such that, for each i = 1, . . ., n, it holds that π v i (q) = b * i .Let q 1 , . . ., q ℓ be a listing of the tuples in P ′ .Let D = {1, . . ., ℓ}, and let F contain, for each z ∈ {v 1 , . . ., v n , x, y 1 , . . ., y m }, the map f z : D → B defined by f z (i) = π z (q i ).Observe that f x is surjective, by (2).
We verify that the structure B is F -stable, as follows.Let V be a finite non-empty set.Observe that for each g ∈ G V,D and each u ∈ V , the map t[g] sends the applications (u, f v 1 ), . . ., (u, f vn ) to b * 1 , . . ., b * n , respectively; thus, each map in T V,F is surjective.To show that T V,F is surjectively closed, consider a mapping t ′ ∈ T V,F B .Observe first that because for any u 1 , u 2 ∈ V (and any i), (u 1 , f v i ) and (u 2 , f v i ) are sent to the same value by any map in T V,F , the same holds for any map in T V,F B , and for t ′ in particular.Let u ∈ V ; since P is ∧-definable and the tuple of applications is pointwise mapped by each t ∈ T V,F to a tuple in P ′ , it holds that this tuple is sent by t ′ to a tuple in P .
• Case: Suppose that the previous case's assumption does not hold.We have that the tuple s ! is pointwise mapped by t ′ to a tuple (b 1 , . . ., b n , c, d 1 , . . ., d n ) in P .Thus, by (3), there exists a unary polymorphism p + such that p + (b * i ) = b i = t ′ (u, f v i ), for each i.By this case's assumption, we have {b 1 , . . ., b n } = B; thus, the operation p + is a bijection, and hence an automorphism of B. As p + and each of its powers is thus a partial polymorphism of P , it follows that s !mapped under (p + ) −1 (t ′ ) is inside P and, due to the choice of p + , inside P ′ .Since u was chosen arbitrarily, we obtain that (p + ) −1 (t ′ ) is in T V,F , and so t ′ has the desired form.As discussed in the previous article [5, Proof of Corollary 3.5], when a structure B (with nontrivial universe size) has only essentially unary polymorphisms, it holds that the polymorphisms of B are diagonal-cautious, and that the problem CSP(B * ) is NP-complete.With these facts in hand, we obtain the following corollary of the just-given theorem.

For any relation
there exists an atom R(u 1 , . . ., u k ) of φ such that (f (u 1 ), . . ., f (u k )) = (b 1 , . . ., b k ).Clearly, each yes instance of COND(B) is also a yes instance of SCSP(B).In graph-theoretic settings, a related notion has been studied: a compaction is defined similarly, but typically is not required to map onto self-loops of the target graph B.
There exists an elementary argument that, for each structure B, the problem SCSP(B) polynomialtime Turing reduces to the problem COND(B); see [1, Proof of Proposition 1]. 4 We observe here a condition that allows one to show NP-hardness for the problem COND(B), under polynomial-time many-one reduction, using the developed framework.Proof.The reduction is that of Theorem 3.7.We use the notation from that proof.It suffices to argue that when (A V,F , ψ) is a yes instance of it is also a yes instance of COND(B).From that proof, when there exists a surjective satisfying assignment of ψ, there exists such a surjective satisfying assignment of the form t[g]. Since t[g] maps each application of the form (•, f b ) to b, we obtain that (A V,F , ψ) is a yes instance of COND(B).
Each encoding presented in Section 4 contains all constants; thus, via Theorem 6.1, we obtain that, for each structure B treated in that section, the problem COND(B) is NP-complete.

Sparsifiability
The framework presented here also has implications for the sparsifiability of the problems SCSP(B).We explain the main ideas here; our presentation is based on the framework and terminology of [8].
For a problem Q of the form SCSP(B) or of the form CSP(B), we define a generalized kernel as a polynomial-time many-one reduction f from Q to any other decision problem Q ′ .We say that a generalized kernel f has bitsize h : N → N when, for any instance x of Q having n variables, it holds that |f (x)| ≤ h(n).That is, we grade each generalized kernel according to the image size of each instance of Q, measured as a function of the number of variables of Q.
When one has an encoding F of maps each having arity ≤ 1, and the hypotheses of Theorem 3.7 hold, this theorem's reduction from CSP(D) to SCSP(B) increases the number of variables at most linearly: for each instance of the first problem having n ≥ 1 variables, the instance's image under the reduction has at most |F |n variables.This reduction thus constitutes a linear-parameter transformation, in the parlance of [8,Definition 2.2].Such transformations allow one to transfer lower bounds from the first problem (in our case, CSP(D)) to the second problem (in our case, SCSP(B)).
We establish the following new result.

Example 3 . 2
Let D = {0, 1}, B = {0, 1, 2}, and let F be the encoding that contains the 3 mappings from D 0 to B as well as the 6 injective mappings from D 1 to B. We have |F | = 9. (This encoding will be used in Section 4.2.)Let V be a set of size 4.As |V | = 4 and |D| = 2, we have |G V,D | = 2 4 = 16.The arity 0 mappings in F give rise to 3 (V, F )-applications and the arity 1 mappings in F give rise to 6|V | = 24 (V, F )applications.Thus we have |A V,F | = 27.
Let B = {b * 1 , . . ., b * n } be a set of size n.When B is a structure with universe B, we use B * to denote the structure obtained from B by adding, for each b * i ∈ B, a relation {(b * i )}.A set C of operations on B is diagonal-cautious if there exists a map G : B n → ℘(B) such that: • for each operation f ∈ C, it holds that image(f ) ⊆ G( f (b * 1 ), . . ., f (b * n )), and • for each tuple (b 1 , . . ., b n ) ∈ B n , if {b 1 , . . ., b n } = B, then G(b 1 , . . ., b n ) = B.
over all tuples (b 1 , . . ., b k ) ∈ Q.Moreover, for each b ∈ B, each set f −1 x (b) is an F -induced relation.We may conclude that B * , the expansion of B by all constant relations (those relations {(b)}, over b ∈ B), has that CSP(B * ) reduces to SCSP(B).

Theorem 6 . 1
Let F be an encoding that contains all constants in the sense that, for each b ∈ B, there exists a map f b ∈ F such that f b (e) = b for each e in the domain of f b .Suppose that B is F -stable, and that D is an F -induced template of B. Then, the problem CSP(D) polynomial-time many-one reduces to COND(B).

Theorem 7 . 1
The problem SCSP(N) (studied in Section 4.2) has a generalized kernel of bitsize O(n 2 log n), but no generalized kernel of bitsize O(n 2−ǫ ), for any ǫ > 0, under the assumption that NP is not in coNP/poly.