This paper was converted on www.awesomepapers.org from LaTeX by an anonymous user.
Want to know more? Visit the Converter page.

Quantaloidal Approach to Constraint Satisfaction111Most of the work was done while Kei Kimura was at Saitama University.

Soichiro Fujii Supported by JST, ERATO Grant Number JPMJER1603 (HASUO Metamathematics for Systems Design Project).Research Institute for Mathematical Sciences
Kyoto University
Kyoto, Japan [email protected] Department of Communications and Computer Engineering
Graduate School of Informatics
Kyoto University
Kyoto, JapanFaculty of Information Science and Electrical Engineering
Kyushu University
Fukuoka, Japan
   Yuni Iwamasa Supported by JSPS KAKENHI Grant Numbers 20K23323, 20H05795.Department of Communications and Computer Engineering
Graduate School of Informatics
Kyoto University
Kyoto, Japan [email protected] Faculty of Information Science and Electrical Engineering
Kyushu University
Fukuoka, Japan
   Kei Kimura Supported by JST, ACT-X Grant Number JPMJAX200C, Japan, and JSPS KAKENHI Grant Numbers JP19K22841, JP21K17700.Faculty of Information Science and Electrical Engineering
Kyushu University
Fukuoka, Japan [email protected]
Abstract

The constraint satisfaction problem (CSP) is a computational problem that includes a range of important problems in computer science. We point out that fundamental concepts of the CSP, such as the solution set of an instance and polymorphisms, can be formulated abstractly inside the 2-category 𝒫𝐅𝐢𝐧𝐒𝐞𝐭\mathcal{P}\mathbf{FinSet} of finite sets and sets of functions between them. The 2-category 𝒫𝐅𝐢𝐧𝐒𝐞𝐭\mathcal{P}\mathbf{FinSet} is a quantaloid, and the formulation relies mainly on structure available in any quantaloid. This observation suggests a formal development of generalisations of the CSP and concomitant notions of polymorphism in a large class of quantaloids. We extract a class of optimisation problems as a special case, and show that their computational complexity can be classified by the associated notion of polymorphism.

1 Introduction

1.1 Background

The constraint satisfaction problem (CSP) is a computational problem of determining whether it is possible to assign values to variables while satisfying all given constraints. The CSP provides a general framework capturing a variety of problems in diverse fields such as artificial intelligence (see, e.g., [39, 15, 34]), theoretical computer science (e.g., [14]) and operations research (e.g., [18]), and has been studied from both practical and theoretical points of view. Many heuristic algorithms have been developed and incorporated into CSP solvers, and these solvers are used for various purposes including corporate decision making (e.g., [34, 7, 25]). Generalisations of the CSP are also widely studied; these include optimisation problems (e.g., [42]) and counting problems (e.g., [11]).

Formally, a CSP instance I=(V,D,𝒞)I=(V,D,\mathcal{C}) is given by a finite set VV of variables, a finite set DD called the domain, and a finite set 𝒞\mathcal{C} of constraints. Here, each constraint is a triple (k,𝐱,ρ)(k,\mathbf{x},\rho) consisting of a natural number kk called the arity, a kk-tuple 𝐱Vk\mathbf{x}\in V^{k} of variables called the constraint scope, and a kk-ary relation ρDk\rho\subseteq D^{k} on DD called the constraint relation of the constraint. A solution of II is a function s:VDs\colon V\to D satisfying all constraints, i.e., such that for each (k,𝐱,ρ)𝒞(k,\mathbf{x},\rho)\in\mathcal{C} with 𝐱=(x_1,,x_k)\mathbf{x}=(x_{\_}1,\dots,x_{\_}k), we have s(𝐱)=(s(x_1),,s(x_k))ρs(\mathbf{x})=(s(x_{\_}1),\dots,s(x_{\_}k))\in\rho. The set of all solutions of II is denoted by 𝒮(I)\mathcal{S}(I), and is called the solution set of II. To solve the CSP instance II is to output “yes” if there exists a solution of II, and “no” otherwise.

The following are two typical problems that can be modelled as CSPs.

Example 1.1.

The Boolean satisfiability problem (SAT) is the problem of determining whether a given conjunctive normal form (CNF) propositional formula is satisfiable or not. Here, a CNF formula is a conjunction of clauses, a clause being a disjunction of literals, and a literal being a propositional variable or its negation. For example, (x_1x¯_2x_4)(x¯_1x¯_2x_2x_4)(x_2x_4)(x_{\_}1\vee\overline{x}_{\_}2\vee x_{\_}4)\wedge(\overline{x}_{\_}1\vee\overline{x}_{\_}2\vee x_{\_}2\vee x_{\_}{4})\wedge(x_{\_}2\vee x_{\_}4) is a CNF formula. A CNF formula φ(x_1,,x_n)\varphi(x_{\_}1,\dots,x_{\_}n) can be thought of as a CSP instance I_φI_{\_}\varphi with V={x_1,,x_n}V=\{x_{\_}1,\dots,x_{\_}n\} and D={0,1}D=\{0,1\}; each clause ψ(x_i_1,,x_i_k)\psi(x_{\_}{i_{\_}1},\dots,x_{\_}{i_{\_}k}) of φ\varphi gives rise to a constraint of I_φI_{\_}\varphi expressing the condition for a truth value assignment to {x_i_1,,x_i_k}\{x_{\_}{i_{\_}1},\dots,x_{\_}{i_{\_}k}\} to make ψ\psi true. For example, the clause (x_1x¯_2x_4)(x_{\_}1\vee\overline{x}_{\_}2\vee x_{\_}4) corresponds to the constraint (3,(x_1,x_2,x_4),{0,1}3{(0,1,0)})(3,(x_{\_}1,x_{\_}2,x_{\_}4),\{0,1\}^{3}\setminus\{(0,1,0)\}).

A well-known subclass of SAT is 3-SAT, in which the input is restricted to a 3-CNF formula, i.e., a CNF formula such that every clause is a disjunction of three literals. SAT and 3-SAT are fundamental in computer science; for example they are among the first problems shown to be NP-complete [13, 29].

Example 1.2.

Let kk be a positive integer. In the graph kk-colouring problem, we are given a simple undirected graph, i.e., a pair consisting of a finite set VV of vertices and a symmetric and irreflexive binary relation EE on VV representing the adjacency relation. Our task is to determine whether it is possible to assign kk colours to the vertices so that adjacent vertices are assigned different colours. The graph kk-colouring problem is intensively studied in combinatorics (e.g., [17, 6]). It is known that the graph kk-colouring problem is in P (solvable in polynomial time) if k2k\leq 2, and is NP-complete if k3k\geq 3. To formulate the graph kk-colouring problem as a CSP, let D_kD_{\_}k be the kk-element set of colours and _k={(d_1,d_2)D_k2d_1d_2}{\neq_{\_}k}=\{(d_{\_}1,d_{\_}2)\in D_{\_}{k}^{2}\mid d_{\_}1\neq d_{\_}2\}. An instance (V,E)(V,E) of the graph kk-colouring problem can be cast as the CSP instance (V,D_k,𝒞)(V,D_{\_}k,\mathcal{C}), where 𝒞={(2,(v_1,v_2),_k)(v_1,v_2)E}\mathcal{C}=\{\,(2,(v_{\_}1,v_{\_}2),\neq_{\_}k)\mid(v_{\_}1,v_{\_}2)\in E\,\}.

A notable theoretical result in this field is the dichotomy theorem for CSPs [35, 9, 41]. To state the theorem, we need some definitions. A constraint language is a pair (D,𝒟)(D,\mathcal{D}) of a finite set DD and a finite family 𝒟=(𝒟_k)_k_k𝒫(𝒫(Dk))\mathcal{D}=(\mathcal{D}_{\_}k)_{\_}{k\in\mathbb{N}}\in\prod_{\_}{k\in\mathbb{N}}\mathcal{P}(\mathcal{P}(D^{k})) of relations on DD (i.e., 𝒟_k\mathcal{D}_{\_}k is empty for all but finitely many kk). Each constraint language (D,𝒟)(D,\mathcal{D}) determines the class CSP(𝒟)\mathrm{CSP}(\mathcal{D}) consisting of all CSP instances (V,D,𝒞)(V,D^{\prime},\mathcal{C}) such that D=DD^{\prime}=D and, for each constraint (k,𝐱,ρ)𝒞(k,\mathbf{x},\rho)\in\mathcal{C}, we have ρ𝒟_k\rho\in\mathcal{D}_{\_}k. For example, CSP(𝒟)\mathrm{CSP}(\mathcal{D}) reduces to 3-SAT when (D,𝒟)=({0,1},{{0,1}3{(d_1,d_2,d_3)}d_1,d_2,d_3{0,1}})(D,\mathcal{D})=\left(\{0,1\},\big{\{}\,\{0,1\}^{3}\setminus\{(d_{\_}1,d_{\_}2,d_{\_}3)\}\mid d_{\_}1,d_{\_}2,d_{\_}3\in\{0,1\}\,\big{\}}\right), and to the graph kk-colouring problem (for possibly directed graphs with loops) when (D,𝒟)=(D_k{_k})(D,\mathcal{D})=(D_{\_}k,\{\neq_{\_}k\}). Roughly, the dichotomy theorem states that CSP(𝒟)\mathrm{CSP}(\mathcal{D}) is in P if 𝒟\mathcal{D} satisfies a certain property, and is NP-complete otherwise. Notice that this dichotomy result is highly nontrivial, given the fact that under the assumption P \neq NP, there exists an infinite hierarchy of complexity classes (up to a polynomial time reduction) containing P and contained in NP [26]. An interesting aspect of the dichotomy theorem is the fact that the border between P and NP-completeness can be captured by a purely algebraic criterion based on the notion of polymorphism, to which we now turn.

In the long chain of research devoted to the analysis of computational complexity of CSP(𝒟)\mathrm{CSP}(\mathcal{D}) (e.g., [35, 21, 20, 16, 10, 8, 9, 41]), special attention has been paid to the symmetry of problems. The idea is that a problem should be easy to solve if it admits enough symmetry. It is clear (at least intuitively) that if a CSP instance has certain symmetry, then so does its solution set. For example, the graph kk-colouring problem is invariant under an arbitrary permutation of colours, and thus it follows that so is the solution set of each of its instances. Although the symmetry of a mathematical object is often captured by its group of automorphisms, this is not sufficient for the analysis of CSPs; for example, while the graph kk-colouring problem admits the maximum automorphism group, it is NP-complete if k3k\geq 3. It turns out that we need to enlarge the group of automorphisms to the clone of polymorphisms; here, a polymorphism of a mathematical object XX refers to a homomorphism from its finite power XnX^{n} to XX.222Our usage of the term “polymorphism” follows a tradition in universal algebra (see, e.g., [31]). In particular, it has nothing to do with polymorphism in type theory and programming language theory, nor with poly-morphism in the sense of [30], which incidentally refers to a morphism in the free quantaloid 𝒫𝒜\mathcal{P}\mathcal{A} over a category 𝒜\mathcal{A} (see Example 2.6).

The adequacy of polymorphisms in the current context is well-attested by their crucial use in a precise statement of the dichotomy theorem (Theorem 3.5): given a constraint language (D,𝒟)(D,\mathcal{D}), CSP(𝒟)\mathrm{CSP}(\mathcal{D}) is in P if the relational structure (D,(ρ)_k,ρ𝒟_k)(D,(\rho)_{\_}{k\in\mathbb{N},\rho\in\mathcal{D}_{\_}k}) admits a Siggers operation (see Definition 3.4) as a polymorphism, and is NP-complete otherwise.

1.2 Our results

In this paper, we shed a new light on the CSP and its variants by formulating their fundamental concepts in suitable quantaloids. A quantaloid is a particularly well-behaved 2-category, in which right extensions and right liftings (right adjoints of precomposition and postcomposition by a morphism) always exist.

First we capture the ordinary CSP in the quantaloid 𝒫𝐅𝐢𝐧𝐒𝐞𝐭\mathcal{P}\mathbf{FinSet} whose objects are finite sets, whose morphisms ABA\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}B are sets of functions ABA\to B, and whose 2-cells are given by the inclusion relation. Observe that a kk-ary relation ρ\rho on a finite set DD can be seen as a morphism ρ:[k]={1,,k}D\rho\colon[k]=\{1,\dots,k\}\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}D in 𝒫𝐅𝐢𝐧𝐒𝐞𝐭\mathcal{P}\mathbf{FinSet}. Thus each constraint (k,𝐱,ρ)𝒞(k,\mathbf{x},\rho)\in\mathcal{C} of a CSP instance I=(V,D,𝒞)I=(V,D,\mathcal{C}) gives rise to the solid arrows in the diagram below, from which we obtain the right extension ρ{𝐱}\rho\swarrow\{\mathbf{x}\}:

[k][k]VVDD.{𝐱}\{\mathbf{x}\}ρ\rhoρ{𝐱}\rho\swarrow\{\mathbf{x}\}

As we shall see, ρ{𝐱}:VD\rho\swarrow\{\mathbf{x}\}\colon V\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}D is precisely the set of all functions VDV\to D satisfying the constraint (k,𝐱,ρ)(k,\mathbf{x},\rho). Thus the solution set 𝒮(I)\mathcal{S}(I) can be seen as the morphism VDV\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}D in 𝒫𝐅𝐢𝐧𝐒𝐞𝐭\mathcal{P}\mathbf{FinSet} expressed as 𝒮(I)=_(k,𝐱,ρ)𝒞ρ{𝐱}.\mathcal{S}(I)=\bigcap_{\_}{(k,\mathbf{x},\rho)\in\mathcal{C}}\rho\swarrow\{\mathbf{x}\}.

We also give a quantaloidal formulation of polymorphisms. An nn-ary polymorphism of a kk-ary relation ρ\rho on DD is a homomorphism of relational structures (D,(ρ))n(D,(ρ))(D,(\rho))^{n}\to(D,(\rho)). The set Pol(ρ)_n\mathrm{Pol}(\rho)_{\_}n of all nn-ary polymorphisms of ρ\rho can be seen as a morphism DnDD^{n}\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}D in 𝒫𝐅𝐢𝐧𝐒𝐞𝐭\mathcal{P}\mathbf{FinSet}, and is expressed as Pol(ρ)_n=ρ({π_i}_i=1nρ)\mathrm{Pol}(\rho)_{\_}n=\rho\swarrow(\{\pi_{\_}i\}_{\_}{i=1}^{n}\searrow\rho), where \searrow denotes right lifting and the morphism {π_i}_i=1n:DnD\{\pi_{\_}i\}_{\_}{i=1}^{n}\colon D^{n}\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}D is the set of projections. This provides a novel view to the set of polymorphisms of ρ\rho as the “double dualisation” with respect to ρ\rho of the set of projections.

This quantaloidal reformulation of the ordinary CSP opens the way to a formal definition of the quantaloidal CSP and the associated notion of polymorphism in an abstract setting. We shall sketch such a definition in an arbitrary quantaloid of the form 𝒬𝒜\mathcal{QA} (see Example 2.7) generated by a quantale (one-object quantaloid) 𝒬\mathcal{Q} and a locally small category 𝒜\mathcal{A} with finite products. In particular, we show in this generality the claim that the solution set 𝒮(I)\mathcal{S}(I) inherits the symmetry of an instance II, formulated suitably in terms of 𝒬\mathcal{Q}-valued polymorphisms (Proposition 4.2).

We then instantiate this general framework by setting 𝒬𝒜=¯𝐅𝐢𝐧𝐒𝐞𝐭\mathcal{QA}=\overline{\mathbb{R}}\mathbf{FinSet} or ¯𝐒𝐞𝐭\overline{\mathbb{R}}\mathbf{Set}, where ¯\overline{\mathbb{R}} is a quantale of extended real numbers. In these cases, the quantaloidal CSP contains a certain class of optimisation problems which we call the tropical valued CSP (TVCSP). The TVCSP is different from the more widely studied optimisation variant of the CSP called the valued CSP (VCSP), but is able to formulate certain scheduling problems as well as (via its infinitary variant) important concepts in continuous optimisation, such as quasiconvex functions and piecewise-linear convex functions. We shall establish a dichotomy theorem for TVCSPs (satisfying suitable finiteness conditions) by reducing it to the dichotomy for CSPs. The border between P and NP-hardness for TVCSPs can be captured by the notion of ¯\overline{\mathbb{R}}-valued polymorphism, which is a special case of our general notion of 𝒬\mathcal{Q}-valued polymorphism.

Related work.

Interaction between category theory and the field of algorithms and computational complexity is rare, and to the best of our knowledge this is the first paper relating the CSP and 2-category theory. We cite [24] as a recent paper applying categorical ideas to a generalisation of the CSP called the promise CSP, although its approach and goal are entirely different from ours. A generalisation of the CSP valued in a certain class of idempotent semirings has been introduced in [4, 3]. Whereas quantales are an infinitary version of idempotent semirings, our definition of 𝒮(I)\mathcal{S}(I) in the quantaloidal CSP is incomparable with the corresponding notion (called consistency level) in their framework. In a more recent work [19], polymorphisms in the context of the above semiring-based generalised CSP are considered. Over a fixed constraint language, their notion of instance can capture a wider class of problems than ours, but as a consequence, their computational complexity results rely on extra assumptions; as the valuation structure (corresponding to our 𝒬\mathcal{Q}), they adopt totally ordered commutative monoids whose unit element is the largest element and satisfying certain finiteness conditions. We have not been able to find any clear relationship between their notion of polymorphism and ours.

Outline.

The remainder of this paper is organised as follows. In Section 2 we recall the notion of quantaloid. In Section 3 we give a quantaloidal formulation of the CSP, and then proceed in Section 4 to its generalisation in quantaloids of the form 𝒬𝒜\mathcal{QA}. Section 5 is devoted to the TVCSP; we introduce it as a special case of the quantaloidal CSP, analyse its computational complexity and explore examples.

Acknowledgements.

We thank Stanislav Živný for providing a comment on an early draft of this paper and calling our attention to [19], and Takehide Soh for bibliographical information on CSP solvers [34, 7, 25].

2 Quantaloids

In this section we review the definition and basic structure of quantaloids. See, e.g., [33, 38] for more information on quantaloids.

Definition 2.1.

A quantaloid is a locally small category 𝒦\mathcal{K} equipped with a partial order _A,B\leq_{\_}{A,B} on each hom-set 𝒦(A,B)\mathcal{K}(A,B) such that

  • for each A,B𝒦A,B\in\mathcal{K}, (𝒦(A,B),_A,B)(\mathcal{K}(A,B),\leq_{\_}{A,B}) is a complete lattice;

  • for each A,B,C𝒦A,B,C\in\mathcal{K}, the composition law 𝒦(B,C)×𝒦(A,B)𝒦(A,C)\mathcal{K}(B,C)\times\mathcal{K}(A,B)\to\mathcal{K}(A,C) preserves arbitrary suprema in each variable: for each set JJ and φ:AB\varphi\colon A\to B, (φ_j:AB)_jJ(\varphi_{\_}j\colon A\to B)_{\_}{j\in J}, ψ:BC\psi\colon B\to C and (ψ_j:BC)_jJ(\psi_{\_}j\colon B\to C)_{\_}{j\in J} in 𝒦\mathcal{K}, we have

    (_jJψ_j)φ=_jJ(ψ_jφ)andψ(_jJφ_j)=_jJ(ψφ_j).\big{(}\bigvee_{\_}{j\in J}\psi_{\_}j\big{)}\circ\varphi=\bigvee_{\_}{j\in J}(\psi_{\_}j\circ\varphi)\quad\textrm{and}\quad\psi\circ\big{(}\bigvee_{\_}{j\in J}\varphi_{\_}j\big{)}=\bigvee_{\_}{j\in J}(\psi\circ\varphi_{\_}j).

A quantaloid whose set of objects is a singleton is called a quantale. Explicitly, a quantale is a tuple 𝒬=(Q,,e,)\mathcal{Q}=(Q,\leq,e,\otimes) such that (Q,)(Q,\leq) is a complete lattice, (Q,e,)(Q,e,\otimes) is a monoid, and the multiplication :Q×QQ\otimes\colon Q\times Q\to Q preserves arbitrary suprema in each variable.

Note that a quantaloid 𝒦\mathcal{K} can be regarded as a 2-category, whose 2-cells are given by the partial order relation _A,B\leq_{\_}{A,B} on each hom-set (that is, there exists a necessarily unique 2-cell φφ\varphi\Rightarrow\varphi^{\prime} between a parallel pair of morphisms φ,φ:AB\varphi,\varphi^{\prime}\colon A\to B precisely when φ_A,Bφ\varphi\leq_{\_}{A,B}\varphi^{\prime}). Each quantaloid is a biclosed 2-category, meaning that right (Kan) extensions and right liftings always exist:

Proposition 2.2.

Let 𝒦\mathcal{K} be a quantaloid. For each A,B,C𝒦A,B,C\in\mathcal{K}, φ:AB\varphi\colon A\to B and ψ:BC\psi\colon B\to C in 𝒦\mathcal{K}, both

()φ:𝒦(B,C)𝒦(A,C)andψ():𝒦(A,B)𝒦(A,C)(-)\circ\varphi\colon\mathcal{K}(B,C)\to\mathcal{K}(A,C)\quad\textrm{and}\quad\psi\circ(-)\colon\mathcal{K}(A,B)\to\mathcal{K}(A,C) (1)

have right adjoints.

The right adjoints of (1) are denoted by

()φ:𝒦(A,C)𝒦(B,C)andψ():𝒦(A,C)𝒦(A,B)(-)\swarrow\varphi\colon\mathcal{K}(A,C)\to\mathcal{K}(B,C)\quad\textrm{and}\quad\psi\searrow(-)\colon\mathcal{K}(A,C)\to\mathcal{K}(A,B)

respectively. If θ:AC\theta\colon A\to C is a morphism in 𝒦\mathcal{K}, then the morphism θφ:BC\theta\swarrow\varphi\colon B\to C is called the right extension of θ\theta along φ\varphi, and ψθ:AB\psi\searrow\theta\colon A\to B the right lifting of θ\theta along ψ\psi. By the adjointness we have

ψ_B,Cθφψφ_A,Cθφ_A,Bψθ.\psi\leq_{\_}{B,C}\theta\swarrow\varphi\iff\psi\circ\varphi\leq_{\_}{A,C}\theta\iff\varphi\leq_{\_}{A,B}\psi\searrow\theta. (2)

The following are formal properties of these operations in a quantaloid which we shall use later.

Proposition 2.3.

Let 𝒦\mathcal{K} be a quantaloid.

  1. 1.

    For each set JJ and φ:AB\varphi\colon A\to B, (φ_j:AB)_jJ(\varphi_{\_}j\colon A\to B)_{\_}{j\in J}, ψ:BC\psi\colon B\to C, (ψ_j:BC)_jJ(\psi_{\_}j\colon B\to C)_{\_}{j\in J}, θ:AC\theta\colon A\to C and (θ_j:AC)_jJ(\theta_{\_}j\colon A\to C)_{\_}{j\in J} in 𝒦\mathcal{K}, we have

    (_jJθ_j)φ\displaystyle\big{(}\bigwedge_{\_}{j\in J}\theta_{\_}j\big{)}\swarrow\varphi =_jJ(θ_jφ),\displaystyle=\bigwedge_{\_}{j\in J}(\theta_{\_}j\swarrow\varphi), θ(_jJφ_j)\displaystyle\theta\swarrow\big{(}\bigvee_{\_}{j\in J}\varphi_{\_}j\big{)} =_jJ(θφ_j),\displaystyle=\bigwedge_{\_}{j\in J}(\theta\swarrow\varphi_{\_}j),
    ψ(_jJθ_j)\displaystyle\psi\searrow\big{(}\bigwedge_{\_}{j\in J}\theta_{\_}j\big{)} =_jJ(ψθ_j),\displaystyle=\bigwedge_{\_}{j\in J}(\psi\searrow\theta_{\_}j), (_jJψ_j)θ\displaystyle\big{(}\bigvee_{\_}{j\in J}\psi_{\_}j\big{)}\searrow\theta =_jJ(ψ_jθ).\displaystyle=\bigwedge_{\_}{j\in J}(\psi_{\_}j\searrow\theta).
  2. 2.

    For each φ:AB\varphi\colon A\to B, ψ:BC\psi\colon B\to C, θ:CD\theta\colon C\to D and γ:AD\gamma\colon A\to D in 𝒦\mathcal{K}, we have

    γ(ψφ)=(γφ)ψ,(θψ)γ=ψ(θγ),θ(γφ)=(θγ)φ.\gamma\swarrow(\psi\circ\varphi)=(\gamma\swarrow\varphi)\swarrow\psi,\qquad(\theta\circ\psi)\searrow\gamma=\psi\searrow(\theta\searrow\gamma),\qquad\theta\searrow(\gamma\swarrow\varphi)=(\theta\searrow\gamma)\swarrow\varphi.
Proof.

These are all straightforward consequences of the adjointness (2). As an example, we shall prove the last equation. For any ψ:BC\psi^{\prime}\colon B\to C in 𝒦\mathcal{K}, we have

ψ_B,Cθ(γφ)\displaystyle\psi^{\prime}\leq_{\_}{B,C}\theta\searrow(\gamma\swarrow\varphi) θψ_B,Dγφ\displaystyle\iff\theta\circ\psi^{\prime}\leq_{\_}{B,D}\gamma\swarrow\varphi
(θψ)φ_A,Dγ\displaystyle\iff(\theta\circ\psi^{\prime})\circ\varphi\leq_{\_}{A,D}\gamma
θ(ψφ)_A,Dγ\displaystyle\iff\theta\circ(\psi^{\prime}\circ\varphi)\leq_{\_}{A,D}\gamma
ψφ_A,Cθγ\displaystyle\iff\psi^{\prime}\circ\varphi\leq_{\_}{A,C}\theta\searrow\gamma
ψ_B,C(θγ)φ.\displaystyle\iff\psi^{\prime}\leq_{\_}{B,C}(\theta\searrow\gamma)\swarrow\varphi.

Since ψ\psi^{\prime} was arbitrary, we must have θ(γφ)=(θγ)φ\theta\searrow(\gamma\swarrow\varphi)=(\theta\searrow\gamma)\swarrow\varphi. ∎

We conclude this section with several examples of quantales and quantaloids.

Example 2.4.

The two-element quantale 𝟐=({0,1},,1,)\mathbf{2}=(\{0,1\},\leq,1,\wedge) consists of the two-element chain (with 010\leq 1) equipped with the monoid structure given by infima (or conjunction). Since the multiplication \wedge is commutative, right extensions and right liftings coincide, and are given by implication.

β+α\beta+\alpha α\alpha
\infty ss -\infty
\infty \infty \infty \infty
β\beta tt \infty t+st+s -\infty
-\infty \infty -\infty -\infty
γβ\gamma-\beta β\beta
\infty tt -\infty
\infty -\infty \infty \infty
γ\gamma uu -\infty utu-t \infty
-\infty -\infty -\infty -\infty
Table 1: The operation tables for β+α\beta+\alpha and γβ(=γβ=βγ)\gamma-\beta\ (=\gamma\swarrow\beta=\beta\searrow\gamma) in ¯\overline{\mathbb{R}}. The symbols s,ts,t and uu denote real numbers.
Example 2.5 ([28]).

The quantale ¯=({±},,0,+)\overline{\mathbb{R}}=(\mathbb{R}\cup\{\pm\infty\},\geq,0,+) of extended real numbers consists of the totally ordered set of real numbers ordered by the opposite \geq of the usual order \leq, extended with the least element \infty and the greatest element -\infty, and equipped with (an extension of) the usual addition. We have chosen the direction \geq in order to match the standard setting of the VCSP, in which the goal is usually to minimise a certain quantity rather than to maximise it. To avoid confusion, we shall use the notations inf\inf and sup\sup to denote infima and suprema in {±}\mathbb{R}\cup\{\pm\infty\} with respect to the usual order \leq (so that, e.g., inf{3,5}=3\inf\{3,5\}=3). As a consequence, when we specialise certain formulas for general quantales to the quantale ¯\overline{\mathbb{R}}, \bigvee is translated to inf\inf and \bigwedge to sup\sup. The requirement that ++ should preserve arbitrary \bigvee (== inf\inf) in each variable determines its extension to ¯{±}\overline{\mathbb{R}}\cup\{\pm\infty\} uniquely [28]. The right extensions and right liftings coincide and are given by a suitable extension of subtraction; see Table 1.

Variants of ¯\overline{\mathbb{R}} may be obtained for example by restricting it to non-negative numbers [27] or to integers.

Example 2.6 ([32]).

For any locally small category 𝒜\mathcal{A}, the free quantaloid 𝒫𝒜\mathcal{P}\mathcal{A} on 𝒜\mathcal{A} has the same objects as 𝒜\mathcal{A}, and for each A,B𝒜A,B\in\mathcal{A}, (𝒫𝒜)(A,B)(\mathcal{P}\mathcal{A})(A,B) is the powerset 𝒫(𝒜(A,B))\mathcal{P}(\mathcal{A}(A,B)) equipped with the inclusion order. An element f𝒜(A,B)f\in\mathcal{A}(A,B) is written as f:ABf\colon A\to B and φ(𝒫𝒜)(A,B)\varphi\in(\mathcal{P}\mathcal{A})(A,B) as φ:AB\varphi\colon A\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}B; we shall adopt a similar convention throughout this paper. The composition of φ:AB\varphi\colon A\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}B and ψ:BC\psi\colon B\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}C is defined as ψφ={gffφ,gψ}\psi\circ\varphi=\{\,g\circ f\mid f\in\varphi,\,g\in\psi\,\}. Any morphism f:ABf\colon A\to B in 𝒜\mathcal{A} gives rise to a “singleton” morphism {f}:AB\{f\}\colon A\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}B in 𝒫𝒜\mathcal{P}\mathcal{A}. The identity on A𝒫𝒜A\in\mathcal{P}\mathcal{A} is {id_A}\{\mathrm{id}_{\_}A\}. Given φ:AB\varphi\colon A\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}B, ψ:BC\psi\colon B\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}C and θ:AC\theta\colon A\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}C in 𝒫𝒜\mathcal{P}\mathcal{A}, we have

θφ={g𝒜(B,C)fφ,gfθ}andψθ={f𝒜(A,B)gψ,gfθ}.\theta\swarrow\varphi=\{\,g\in\mathcal{A}(B,C)\mid\forall f\in\varphi,\,g\circ f\in\theta\,\}\quad\textrm{and}\quad\psi\searrow\theta=\{\,f\in\mathcal{A}(A,B)\mid\forall g\in\psi,\,g\circ f\in\theta\,\}. (3)
Example 2.7.

Given any quantale 𝒬=(Q,,e,)\mathcal{Q}=(Q,\leq,e,\otimes) and any locally small category 𝒜\mathcal{A}, we can define the quantaloid 𝒬𝒜\mathcal{QA} by setting ob(𝒬𝒜)=ob(𝒜)\mathrm{ob}(\mathcal{QA})=\mathrm{ob}(\mathcal{A}) and (𝒬𝒜)(A,B)=[𝒜(A,B),Q](\mathcal{QA})(A,B)=[\mathcal{A}(A,B),Q] (the set of all functions 𝒜(A,B)Q\mathcal{A}(A,B)\to Q) equipped with the pointwise order. The composition of φ:AB\varphi\colon A\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}B and ψ:BC\psi\colon B\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}C maps each h𝒜(A,C)h\in\mathcal{A}(A,C) to

(ψφ)(h)={ψ(g)φ(f)f𝒜(A,B),g𝒜(B,C),gf=h}.(\psi\circ\varphi)(h)=\bigvee\{\,\psi(g)\otimes\varphi(f)\mid f\in\mathcal{A}(A,B),\,g\in\mathcal{A}(B,C),\,g\circ f=h\,\}.

A morphism f:ABf\colon A\to B in 𝒜\mathcal{A} gives rise to a “singleton” morphism {f}:AB\{f\}\colon A\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}B which assigns ee to ff and the least element \bot of QQ to all morphisms f𝒜(A,B)f^{\prime}\in\mathcal{A}(A,B) different from ff. The identity on A𝒬𝒜A\in\mathcal{QA} is {id_A}\{\mathrm{id}_{\_}A\}. The following slight generalisation of singleton morphisms will be used later: for each f:ABf\colon A\to B in 𝒜\mathcal{A} and αQ\alpha\in Q, we define the morphism {f}α:AB\{f\}^{\alpha}\colon A\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}B by assigning α\alpha to ff and \bot to all other morphisms in 𝒜(A,B)\mathcal{A}(A,B). Given φ:AB\varphi\colon A\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}B, ψ:BC\psi\colon B\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}C and θ:AC\theta\colon A\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}C in 𝒬𝒜\mathcal{QA}, we have

(θφ)(g)\displaystyle(\theta\swarrow\varphi)(g) ={θ(gf)φ(f)f𝒜(A,B)}and\displaystyle=\bigwedge\{\,\theta(g\circ f)\swarrow\varphi(f)\mid f\in\mathcal{A}(A,B)\,\}\quad\text{and}
(ψθ)(f)\displaystyle(\psi\searrow\theta)(f) ={ψ(g)θ(gf)g𝒜(B,C)}\displaystyle=\bigwedge\{\,\psi(g)\searrow\theta(g\circ f)\mid g\in\mathcal{A}(B,C)\,\}

for each g𝒜(B,C)g\in\mathcal{A}(B,C) and f𝒜(A,B)f\in\mathcal{A}(A,B), where \swarrow and \searrow inside the curly braces denote the right extension and right lifting in 𝒬\mathcal{Q}, respectively. Observe that when 𝒬=𝟐\mathcal{Q}=\mathbf{2}, we recover Example 2.6.

Example 2.8.

As a special case of Example 2.7 with 𝒬=¯\mathcal{Q}=\overline{\mathbb{R}}, we obtain the quantaloid ¯𝒜\overline{\mathbb{R}}\mathcal{A} for any locally small category 𝒜\mathcal{A}. A morphism φ:AB\varphi\colon A\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}B in ¯𝒜\overline{\mathbb{R}}\mathcal{A} is a function φ:𝒜(A,B)¯\varphi\colon\mathcal{A}(A,B)\to\overline{\mathbb{R}}. The composition of φ:AB\varphi\colon A\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}B and ψ:BC\psi\colon B\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}C in ¯𝒜\overline{\mathbb{R}}\mathcal{A} maps each h𝒜(A,C)h\in\mathcal{A}(A,C) to

(ψφ)(h)=inf{ψ(g)+φ(f)f𝒜(A,B),g𝒜(B,C),gf=h}.(\psi\circ\varphi)(h)=\inf\{\,\psi(g)+\varphi(f)\mid f\in\mathcal{A}(A,B),\,g\in\mathcal{A}(B,C),\,g\circ f=h\,\}.

Given φ:AB\varphi\colon A\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}B, ψ:BC\psi\colon B\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}C and θ:AC\theta\colon A\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}C in ¯𝒜\overline{\mathbb{R}}\mathcal{A}, we have

(θφ)(g)\displaystyle(\theta\swarrow\varphi)(g) =sup{θ(gf)φ(f)f𝒜(A,B)}and\displaystyle=\sup\{\,\theta(g\circ f)-\varphi(f)\mid f\in\mathcal{A}(A,B)\,\}\quad\text{and}
(ψθ)(f)\displaystyle(\psi\searrow\theta)(f) =sup{θ(gf)ψ(g)g𝒜(B,C)}.\displaystyle=\sup\{\,\theta(g\circ f)-\psi(g)\mid g\in\mathcal{A}(B,C)\,\}.

3 CSPs and polymorphisms via 𝒫𝐅𝐢𝐧𝐒𝐞𝐭\mathcal{P}\mathbf{FinSet}

As mentioned in the Introduction, a CSP instance I=(V,D,𝒞)I=(V,D,\mathcal{C}) and its solution set 𝒮(I)[V,D]\mathcal{S}(I)\subseteq[V,D] can be formulated inside the quantaloid 𝒫𝐅𝐢𝐧𝐒𝐞𝐭\mathcal{P}\mathbf{FinSet}, where 𝐅𝐢𝐧𝐒𝐞𝐭\mathbf{FinSet} is the category of finite sets and functions. That is, we regard both VV and DD as objects of 𝒫𝐅𝐢𝐧𝐒𝐞𝐭\mathcal{P}\mathbf{FinSet}, and each constraint (k,𝐱,ρ)𝒞(k,\mathbf{x},\rho)\in\mathcal{C} as a triple consisting of the object [k]={1,,k}[k]=\{1,\dots,k\}, the (singleton) morphism {𝐱}:[k]V\{\mathbf{x}\}\colon[k]\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}V and the morphism ρ:[k]D\rho\colon[k]\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}D in 𝒫𝐅𝐢𝐧𝐒𝐞𝐭\mathcal{P}\mathbf{FinSet}. The solution set can be regarded as a morphism 𝒮(I):VD\mathcal{S}(I)\colon V\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}D in 𝒫𝐅𝐢𝐧𝐒𝐞𝐭\mathcal{P}\mathbf{FinSet}, and may be expressed as 𝒮(I)=_(k,𝐱,ρ)𝒞ρ{𝐱}\mathcal{S}(I)=\bigcap_{\_}{(k,\mathbf{x},\rho)\in\mathcal{C}}\rho\swarrow\{\mathbf{x}\}, in light of (3).

Let us fix a constraint language (D,𝒟)(D,\mathcal{D}). Observe that a CSP instance I=(V,D,𝒞)I=(V,D,\mathcal{C}) in CSP(𝒟)\mathrm{CSP}(\mathcal{D}) can be equivalently specified by giving for each kk\in\mathbb{N} and each ρ𝒟_k\rho\in\mathcal{D}_{\_}k, a kk-ary relation σ_ρVk\sigma_{\_}\rho\subseteq V^{k} on VV; σ_ρ\sigma_{\_}\rho is the set of all constraint scopes 𝐱Vk\mathbf{x}\in V^{k} such that (k,𝐱,ρ)𝒞(k,\mathbf{x},\rho)\in\mathcal{C}. As is well-known, one can view (V,(σ_ρ)_k,ρ𝒟_k)(V,(\sigma_{\_}\rho)_{\_}{k\in\mathbb{N},\rho\in\mathcal{D}_{\_}k}) and (D,(ρ)_k,ρ𝒟_k)(D,(\rho)_{\_}{k\in\mathbb{N},\rho\in\mathcal{D}_{\_}k}) as relational structures over a common relational signature, and the solutions are precisely the homomorphisms between these relational structures [16, 20]. An alternative, quantaloidal perspective is provided as follows. For each ρ𝒟_k\rho\in\mathcal{D}_{\_}k, σ_ρ\sigma_{\_}\rho can be thought of as a (not necessarily singleton) morphism σ_ρ:[k]V\sigma_{\_}\rho\colon[k]\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}V in 𝒫𝐅𝐢𝐧𝐒𝐞𝐭\mathcal{P}\mathbf{FinSet}. With this notation, the solution set is

𝒮(I)=_kρ𝒟_kρσ_ρ.\mathcal{S}(I)=\bigcap_{\_}{\begin{subarray}{c}k\in\mathbb{N}\\ \rho\in\mathcal{D}_{\_}k\end{subarray}}\rho\swarrow\sigma_{\_}\rho. (4)

Recall that to solve a CSP instance II is to decide whether it has a solution or not. This amounts to deciding whether 𝒮(I)\mathcal{S}(I) is empty or not. We can express this in the quantaloid 𝒫𝐅𝐢𝐧𝐒𝐞𝐭\mathcal{P}\mathbf{FinSet} as well. In Section 5 we shall see that formally the same construction captures the required output (the optimal value) for a certain class of optimisation problems. The set [1][1] is the terminal object in 𝐅𝐢𝐧𝐒𝐞𝐭\mathbf{FinSet} (albeit not so in 𝒫𝐅𝐢𝐧𝐒𝐞𝐭\mathcal{P}\mathbf{FinSet}), and thus there exists a unique function !_D:D[1]!_{\_}D\colon D\to[1]. This yields a canonical singleton morphism {!_D}:D[1]\{!_{\_}D\}\colon D\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}[1] in 𝒫𝐅𝐢𝐧𝐒𝐞𝐭\mathcal{P}\mathbf{FinSet}. The composition 𝒪(I)={!_D}𝒮(I):V[1]\mathcal{O}(I)=\{!_{\_}D\}\circ\mathcal{S}(I)\colon V\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}[1] (which can take two values, as 𝒫𝐅𝐢𝐧𝐒𝐞𝐭(V,[1])=𝒫({!_V})={,{!_V}}\mathcal{P}\mathbf{FinSet}(V,[1])=\mathcal{P}(\{!_{\_}V\})=\{\emptyset,\{!_{\_}V\}\}) is empty precisely when 𝒮(I)\mathcal{S}(I) is empty, and is the singleton morphism {!_V}\{!_{\_}V\} otherwise. Therefore, to solve II is to determine the morphism 𝒪(I):V[1]\mathcal{O}(I)\colon V\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}[1].

We now move on to polymorphisms, starting with a review of basic definitions. For any finite set AA and natural numbers nn and kk, an nn-ary operation on AA is a function f:AnAf\colon A^{n}\to A, and a kk-ary relation on AA is a subset ρAk\rho\subseteq A^{k}. We say that ff is a polymorphism of ρ\rho if for all (x_ij)An×k(x_{\_}{ij})\in A^{n\times k} we have

(ρ(x_11,,x_1k)ρ(x_n1,,x_nk))ρ(f(x_11,,x_n1),,f(x_1k,,x_nk)).\big{(}\rho(x_{\_}{11},\dots,x_{\_}{1k})\wedge\dots\wedge\rho(x_{\_}{n1},\dots,x_{\_}{nk})\big{)}\implies\rho(f(x_{\_}{11},\dots,x_{\_}{n1}),\dots,f(x_{\_}{1k},\dots,x_{\_}{nk})). (5)

We denote the set of all nn-ary polymorphisms of ρ\rho by Pol(ρ)_n\mathrm{Pol}(\rho)_{\_}n.

We express the construction ρPol(ρ)_n\rho\mapsto\mathrm{Pol}(\rho)_{\_}n by means of basic operations in the quantaloid 𝒫𝐅𝐢𝐧𝐒𝐞𝐭\mathcal{P}\mathbf{FinSet}. First note that, as before, the relation ρAk\rho\subseteq A^{k} can be seen as a morphism ρ:[k]A\rho\colon[k]\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}A in 𝒫𝐅𝐢𝐧𝐒𝐞𝐭\mathcal{P}\mathbf{FinSet}. Similarly, the antecedent of (5), namely the (n×k)(n\times k)-ary relation

{(x_ij)An×kρ(x_11,,x_1k)ρ(x_n1,,x_nk)}\{\,(x_{\_}{ij})\in A^{n\times k}\mid\rho(x_{\_}{11},\dots,x_{\_}{1k})\wedge\dots\wedge\rho(x_{\_}{n1},\dots,x_{\_}{nk})\,\}

on AA, can be regarded as a morphism ρn:[k]An\rho^{\wedge n}\colon[k]\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}A^{n} in 𝒫𝐅𝐢𝐧𝐒𝐞𝐭\mathcal{P}\mathbf{FinSet}. We claim that ρn\rho^{\wedge n} is equal to the right lifting {π_i}_i=1nρ\{\pi_{\_}i\}_{\_}{i=1}^{n}\searrow\rho, where {π_i}_i=1n:AnA\{\pi_{\_}i\}_{\_}{i=1}^{n}\colon A^{n}\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}A is the morphism in 𝒫𝐅𝐢𝐧𝐒𝐞𝐭\mathcal{P}\mathbf{FinSet} defined as the set of projections from the power AnA^{n}. Indeed, if the tuple (x_ij)An×k(x_{\_}{ij})\in A^{n\times k} corresponds to the function χ:[k]An\chi\colon[k]\to A^{n} (so that χ(j)=(x_1j,,x_nj)An\chi(j)=(x_{\_}{1j},\dots,x_{\_}{nj})\in A^{n}), then the function π_iχ:[k]A\pi_{\_}i\circ\chi\colon[k]\to A corresponds to the tuple (x_i1,,x_ik)Ak(x_{\_}{i1},\dots,x_{\_}{ik})\in A^{k}, hence the equality ρn={π_i}_i=1nρ\rho^{\wedge n}=\{\pi_{\_}i\}_{\_}{i=1}^{n}\searrow\rho follows from (3). Now for each nn\in\mathbb{N}, the set of all nn-ary operations on AA preserving ρ\rho can be expressed as the right extension ρρn\rho\swarrow\rho^{\wedge n}, since

ρρn={f:AnA(x_ij)ρn,(f(x_11,,x_n1),,f(x_1k,,x_nk))ρ},\rho\swarrow\rho^{\wedge n}=\{\,f\colon A^{n}\to A\mid\forall(x_{\_}{ij})\in\rho^{\wedge n},(f(x_{\_}{11},\dots,x_{\_}{n1}),\dots,f(x_{\_}{1k},\dots,x_{\_}{nk}))\in\rho\,\},

thus recovering the condition (5). Hence the set Pol(ρ)_n\mathrm{Pol}(\rho)_{\_}n of all nn-ary polymorphisms of ρ\rho can be written as the “double dualisation” ρ({π_i}_i=1nρ)\rho\swarrow\big{(}\{\pi_{\_}i\}_{\_}{i=1}^{n}\searrow\rho\big{)} of {π_i}_i=1n\{\pi_{\_}i\}_{\_}{i=1}^{n} with respect to ρ\rho. Note that for each f:AnAf\colon A^{n}\to A, we have

f is a polymorphism of ρ{π_i}_i=1nρ{f}ρ,f\text{ is a polymorphism of }\rho\iff\{\pi_{\_}i\}_{\_}{i=1}^{n}\searrow\rho\subseteq\{f\}\searrow\rho, (6)

because

fρ({π_i}_i=1nρ)\displaystyle f\in\rho\swarrow\big{(}\{\pi_{\_}i\}_{\_}{i=1}^{n}\searrow\rho\big{)} {f}ρ({π_i}_i=1nρ)\displaystyle\iff\{f\}\subseteq\rho\swarrow\big{(}\{\pi_{\_}i\}_{\_}{i=1}^{n}\searrow\rho\big{)}
{f}({π_i}_i=1nρ)ρ\displaystyle\iff\{f\}\circ\big{(}\{\pi_{\_}i\}_{\_}{i=1}^{n}\searrow\rho\big{)}\subseteq\rho
{π_i}_i=1nρ{f}ρ.\displaystyle\iff\{\pi_{\_}i\}_{\_}{i=1}^{n}\searrow\rho\subseteq\{f\}\searrow\rho.

Given a family =(_k)_k_k𝒫(𝒫(Ak))\mathcal{R}=(\mathcal{R}_{\_}k)_{\_}{k\in\mathbb{N}}\in\prod_{\_}{k\in\mathbb{N}}\mathcal{P}(\mathcal{P}(A^{k})) of relations on AA, we define for each nn\in\mathbb{N},

Pol()_n=_kρ_kPol(ρ)_n.\mathrm{Pol}(\mathcal{R})_{\_}n=\bigcap_{\_}{\begin{subarray}{c}k\in\mathbb{N}\\ \rho\in\mathcal{R}_{\_}k\end{subarray}}\mathrm{Pol}(\rho)_{\_}n.
Proposition 3.1.

Let AA be a finite set and _k𝒫(𝒫(Ak))\mathcal{R}\in\prod_{\_}{k\in\mathbb{N}}\mathcal{P}(\mathcal{P}(A^{k})).333Precisely speaking, the projection in clause 1 and the tupling in clause 2 must be taken with respect to the (chosen) set {π_i}_i=1n\{\pi_{\_}i\}_{\_}{i=1}^{n} of projections used in the definition of Pol()\mathrm{Pol}(\mathcal{R}). In particular, the property of being a polymorphism for \mathcal{R} is not invariant under composition of bijections. A similar remark applies to Proposition 4.1 below.

  1. 1.

    For each nn\in\mathbb{N} and i{1,,n}i\in\{1,\dots,n\}, the ii-th projection π_i:AnA\pi_{\_}i\colon A^{n}\to A is in Pol()_n\mathrm{Pol}(\mathcal{R})_{\_}n.

  2. 2.

    For each m,nm,n\in\mathbb{N}, gPol()_mg\in\mathrm{Pol}(\mathcal{R})_{\_}m and f_1,,f_mPol()_nf_{\_}1,\dots,f_{\_}m\in\mathrm{Pol}(\mathcal{R})_{\_}n, we have gf_1,,f_mPol()_ng\circ\langle f_{\_}1,\dots,f_{\_}m\rangle\in\mathrm{Pol}(\mathcal{R})_{\_}n. (Here, f_1,,f_m:AnAm\langle f_{\_}1,\dots,f_{\_}m\rangle\colon A^{n}\to A^{m} is the tupling of f_1,,f_m:AnAf_{\_}1,\dots,f_{\_}m\colon A^{n}\to A.)

Proof.

One can easily show these using (5). We shall present an alternative proof making full use of quantaloidal structure ((2) and Proposition 2.3), as a warm-up for a similar proof of Proposition 4.1.

Clearly, it suffices to consider the case where \mathcal{R} consists of a single (say, kk-ary) relation ρ\rho. We shall use the criterion (6). Clause 1 is clear because ()ρ(-)\searrow\rho is order-reversing. Under the assumption of clause 2, we have {π_i}_i=1mρ{g}ρ\{\pi_{\_}i\}_{\_}{i=1}^{m}\searrow\rho\subseteq\{g\}\searrow\rho and {π_i}_i=1nρ{f_1,,f_m}ρ\{\pi_{\_}i\}_{\_}{i=1}^{n}\searrow\rho\subseteq\{f_{\_}1,\dots,f_{\_}m\}\searrow\rho. Hence,

{π_i}_i=1nρ\displaystyle\{\pi_{\_}i\}_{\_}{i=1}^{n}\searrow\rho {f_1,,f_m}ρ\displaystyle\subseteq\{f_{\_}1,\dots,f_{\_}m\}\searrow\rho
=({π_i}_i=1m{f_1,,f_m})ρ\displaystyle=\big{(}\{\pi_{\_}i\}_{\_}{i=1}^{m}\circ\{\langle f_{\_}1,\dots,f_{\_}m\rangle\}\big{)}\searrow\rho
={f_1,,f_m}({π_i}_i=1mρ)\displaystyle=\{\langle f_{\_}1,\dots,f_{\_}m\rangle\}\searrow\big{(}\{\pi_{\_}i\}_{\_}{i=1}^{m}\searrow\rho\big{)}
{f_1,,f_m}({g}ρ)\displaystyle\subseteq\{\langle f_{\_}1,\dots,f_{\_}m\rangle\}\searrow\big{(}\{g\}\searrow\rho\big{)}
=({g}{f_1,,f_m})ρ\displaystyle=\big{(}\{g\}\circ\{\langle f_{\_}1,\dots,f_{\_}m\rangle\}\big{)}\searrow\rho
={gf_1,,f_m}ρ.\displaystyle=\{g\circ\langle f_{\_}1,\dots,f_{\_}m\rangle\}\searrow\rho.\qed

Proposition 3.1 states that polymorphisms form a clone: recall that a (concrete) clone on a set AA is a family _n𝒫([An,A])\mathcal{F}\in\prod_{\_}{n\in\mathbb{N}}\mathcal{P}([A^{n},A]) of operations on AA satisfying the following.

  1. 1.

    For each nn\in\mathbb{N} and i{1,,n}i\in\{1,\dots,n\}, the ii-th projection π_i:AnA\pi_{\_}i\colon A^{n}\to A is in _n\mathcal{F}_{\_}n.

  2. 2.

    For each m,nm,n\in\mathbb{N}, g_mg\in\mathcal{F}_{\_}m and f_1,,f_m_nf_{\_}1,\dots,f_{\_}m\in\mathcal{F}_{\_}n, we have gf_1,,f_m_ng\circ\langle f_{\_}1,\dots,f_{\_}m\rangle\in\mathcal{F}_{\_}n.

Let us now formalise the informal claim that if a problem has certain symmetry, then so does its solution.

Proposition 3.2.

Let AA be a finite set.

  1. 1.

    If kk\in\mathbb{N} and (ρ_j:[k]A)_jJ(\rho_{\_}j\colon[k]\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}A)_{\_}{j\in J} is a family of kk-ary relations on AA, then for each nn\in\mathbb{N} we have _jJPol(ρ_j)_nPol(_jJρ_j)_n\bigcap_{\_}{j\in J}\mathrm{Pol}(\rho_{\_}j)_{\_}n\subseteq\mathrm{Pol}(\bigcap_{\_}{j\in J}\rho_{\_}j)_{\_}n.

  2. 2.

    If k,lk,l\in\mathbb{N}, ρ:[k]A\rho\colon[k]\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}A is a kk-ary relation on AA, and σ:[k][l]\sigma\colon[k]\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}[l] is a morphism in 𝒫𝐅𝐢𝐧𝐒𝐞𝐭\mathcal{P}\mathbf{FinSet}, then for each nn\in\mathbb{N} we have Pol(ρ)_nPol(ρσ)_n\mathrm{Pol}(\rho)_{\_}n\subseteq\mathrm{Pol}(\rho\swarrow\sigma)_{\_}n.

Proof.

Recall that the condition for an nn-ary operation ff to be a polymorphism can be expressed as (6).

  1. 1.

    If f_jJPol(ρ_j)_nf\in\bigcap_{\_}{j\in J}\mathrm{Pol}(\rho_{\_}{j})_{\_}n, then we have {π_i}_i=1nρ_j{f}ρ_j\{\pi_{\_}i\}_{\_}{i=1}^{n}\searrow\rho_{\_}{j}\subseteq\{f\}\searrow\rho_{\_}{j} for each jJj\in J. By Proposition 2.3,

    {π_i}_i=1n_jJρ_j=_jJ({π_i}_i=1nρ_j)_jJ({f}ρ_j)={f}_jJρ_j.\{\pi_{\_}i\}_{\_}{i=1}^{n}\searrow\bigcap_{\_}{j\in J}\rho_{\_}{j}=\bigcap_{\_}{j\in J}(\{\pi_{\_}i\}_{\_}{i=1}^{n}\searrow\rho_{\_}{j})\subseteq\bigcap_{\_}{j\in J}(\{f\}\searrow\rho_{\_}{j})=\{f\}\searrow\bigcap_{\_}{j\in J}\rho_{\_}{j}.
  2. 2.

    If fPol(ρ)_nf\in\mathrm{Pol}(\rho)_{\_}n, then we have {π_i}_i=1nρ{f}ρ\{\pi_{\_}i\}_{\_}{i=1}^{n}\searrow\rho\subseteq\{f\}\searrow\rho. By Proposition 2.3,

    {π_i}_i=1n(ρσ)=({π_i}_i=1nρ)σ({f}ρ)σ={f}(ρσ).\{\pi_{\_}i\}_{\_}{i=1}^{n}\searrow(\rho\swarrow\sigma)=(\{\pi_{\_}i\}_{\_}{i=1}^{n}\searrow\rho)\swarrow\sigma\subseteq(\{f\}\searrow\rho)\swarrow\sigma=\{f\}\searrow(\rho\swarrow\sigma).\qed

In view of (4), we immediately have the following.

Corollary 3.3.

Let DD be a finite set, 𝒟_k𝒫(𝒫(Dk))\mathcal{D}\in\prod_{\_}{k\in\mathbb{N}}\mathcal{P}(\mathcal{P}(D^{k})) and I=(V,D,𝒞)CSP(𝒟)I=(V,D,\mathcal{C})\in\mathrm{CSP}(\mathcal{D}). Then for each nn\in\mathbb{N} we have Pol(𝒟)_nPol(𝒮(I))_n\mathrm{Pol}(\mathcal{D})_{\_}n\subseteq\mathrm{Pol}(\mathcal{S}(I))_{\_}n.

We conclude this section with a precise statement of the dichotomy theorem. There are several possible ways to phrase the theorem, the following being one of them (see [2, Theorem 41]).

Definition 3.4.

A 44-ary operation f:D4Df:D^{4}\to D on a finite set DD is said to be Siggers if it satisfies

f(y,x,y,z)=f(x,y,z,x)\displaystyle f(y,x,y,z)=f(x,y,z,x)

for all (x,y,z)D3(x,y,z)\in D^{3}.

Theorem 3.5 (Dichotomy theorem [9, 41]).

Let DD be a finite set and 𝒟\mathcal{D} a finite set of relations on DD. If some Siggers operation is a polymorphism of 𝒟\mathcal{D}, then CSP(𝒟)\mathrm{CSP}(\mathcal{D}) is in P. Otherwise, it is NP-complete.

4 The quantaloidal CSP

The above reformulation of CSPs and polymorphisms in the quantaloid 𝒫𝐅𝐢𝐧𝐒𝐞𝐭\mathcal{P}\mathbf{FinSet} suggests that a certain part of the mathematical theory of the CSP can be developed in a much broader context. In this section we shall embark on such a development. Although the discussion below might look rather formal, we shall apply it to a certain class of optimisation problems in the next section (which can be read independently of this section). We remark that in the special case where 𝒬=𝟐\mathcal{Q}=\mathbf{2} (hence 𝒬𝒜\mathcal{QA} is the free quantaloid 𝒫𝒜\mathcal{PA}), some of the notions introduced below appear in [22].

Let us take any quantale 𝒬=(Q,,e,)\mathcal{Q}=(Q,\leq,e,\otimes) and any locally small category 𝒜\mathcal{A} with finite products; we shall work within the quantaloid 𝒬𝒜\mathcal{QA} instead of 𝒫𝐅𝐢𝐧𝐒𝐞𝐭\mathcal{P}\mathbf{FinSet}. For objects A,K𝒜A,K\in\mathcal{A}, we define a KK-ary 𝒬\mathcal{Q}-valued relation on AA to be a morphism KAK\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}A in 𝒬𝒜\mathcal{QA}. Given such a 𝒬\mathcal{Q}-valued relation ρ:KA\rho\colon K\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}A and a natural number nn, we define the (totality of) nn-ary 𝒬\mathcal{Q}-valued polymorphisms for ρ\rho as Pol(ρ)_n=ρ({π_i}_i=1nρ)\mathrm{Pol}(\rho)_{\_}n=\rho\swarrow\big{(}\{\pi_{\_}i\}_{\_}{i=1}^{n}\searrow\rho\big{)}, where {π_i}_i=1n:AnA\{\pi_{\_}i\}_{\_}{i=1}^{n}\colon A^{n}\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}A is the morphism in 𝒬𝒜\mathcal{QA} defined as

{π_i}_i=1n(f)={eif f is the i-th projection π_i:AnA for some i{1,,n},the least element  of Qotherwise,\{\pi_{\_}i\}_{\_}{i=1}^{n}(f)=\begin{cases}e&\text{if $f$ is the $i$-th projection $\pi_{\_}i\colon A^{n}\to A$ for some $i\in\{1,\dots,n\}$},\\ \text{the least element $\bot$ of $Q$}&\text{otherwise},\end{cases}

for all f𝒜(An,A)f\in\mathcal{A}(A^{n},A). Notice that Pol(ρ)_n\mathrm{Pol}(\rho)_{\_}n is a morphism AnAA^{n}\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}A in 𝒬𝒜\mathcal{QA}, i.e., it assigns to each morphism f:AnAf\colon A^{n}\to A in 𝒜\mathcal{A} an element Pol(ρ)_n(f)\mathrm{Pol}(\rho)_{\_}n(f) of QQ, which may be thought of as the degree to which ff is a polymorphism of ρ\rho.

Individual polymorphisms (as opposed to the totality of them) can then be defined as follows. An (individual) nn-ary 𝒬\mathcal{Q}-valued polymorphism for ρ:KA\rho\colon K\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}A is a pair (f𝒜(An,A),αQ)(f\in\mathcal{A}(A^{n},A),\alpha\in Q) such that αPol(ρ)_n(f)\alpha\leq\mathrm{Pol}(\rho)_{\_}n(f). Using a notation introduced in Example 2.7, the latter condition is equivalent to {π_i}_i=1nρ{f}αρ\{\pi_{\_}i\}_{\_}{i=1}^{n}\searrow\rho\leq\{f\}^{\alpha}\searrow\rho; cf. (6). This in turn amounts to the following more explicit condition, generalising (5): for any χ:KAn\chi\colon K\to A^{n} in 𝒜\mathcal{A}, we have α(ρ(π_1χ)ρ(π_nχ))ρ(fχ)\alpha\otimes\big{(}\rho(\pi_{\_}1\circ\chi)\wedge\dots\wedge\rho(\pi_{\_}n\circ\chi)\big{)}\leq\rho(f\circ\chi).

For a set \mathcal{R} of 𝒬\mathcal{Q}-valued relations on A𝒜A\in\mathcal{A} (i.e., \mathcal{R} is a set of morphisms in 𝒬𝒜\mathcal{QA} with codomain AA) and nn\in\mathbb{N}, we define Pol()_n=_ρPol(ρ)_n\mathrm{Pol}(\mathcal{R})_{\_}n=\bigwedge_{\_}{\rho\in\mathcal{R}}\mathrm{Pol}(\rho)_{\_}n. We say (f𝒜(An,A),αQ)(f\in\mathcal{A}(A^{n},A),\alpha\in Q) is an nn-ary 𝒬\mathcal{Q}-valued polymorphism of \mathcal{R} if αPol()_n(f)\alpha\leq\mathrm{Pol}(\mathcal{R})_{\_}n(f).

The following propositions generalise Propositions 3.1 and 3.2, respectively.

Proposition 4.1.

Let 𝒬=(Q,,e,)\mathcal{Q}=(Q,\leq,e,\otimes) be a quantale, 𝒜\mathcal{A} a locally small category with finite products, A𝒜A\in\mathcal{A} and \mathcal{R} a set of 𝒬\mathcal{Q}-valued relations on AA.

  1. 1.

    For each nn\in\mathbb{N} and i{1,,n}i\in\{1,\dots,n\}, the ii-th projection π_i:AnA\pi_{\_}i\colon A^{n}\to A satisfies ePol()_n(π_i)e\leq\mathrm{Pol}(\mathcal{R})_{\_}n(\pi_{\_}i).

  2. 2.

    For each m,nm,n\in\mathbb{N}, g:AmAg\colon A^{m}\to A and f_1,,f_m:AnAf_{\_}1,\dots,f_{\_}m\colon A^{n}\to A in 𝒜\mathcal{A}, we have

    Pol()_m(g)(Pol()_n(f_1)Pol()_n(f_m))Pol()_n(gf_1,,f_m).\mathrm{Pol}(\mathcal{R})_{\_}m(g)\otimes\big{(}\mathrm{Pol}(\mathcal{R})_{\_}n(f_{\_}1)\wedge\dots\wedge\mathrm{Pol}(\mathcal{R})_{\_}n(f_{\_}m)\big{)}\leq\mathrm{Pol}(\mathcal{R})_{\_}n(g\circ\langle f_{\_}1,\dots,f_{\_}m\rangle).
Proof.

We consider the case where \mathcal{R} consists of a single morphism ρ:KA\rho\colon K\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}A in 𝒬𝒜\mathcal{QA}. Clause 1 amounts to the claim that {π_i}ρ({π_i}_i=1nρ)\{\pi_{\_}i\}\leq\rho\swarrow\big{(}\{\pi_{\_}i\}_{\_}{i=1}^{n}\searrow\rho\big{)}, and can be shown as in the proof of Proposition 3.1. For clause 2, it suffices to show that for any α,βQ\alpha,\beta\in Q, βPol(ρ)_m(g)\beta\leq\mathrm{Pol}(\rho)_{\_}m(g) and αPol(ρ)_n(f_1)Pol(ρ)_n(f_m)\alpha\leq\mathrm{Pol}(\rho)_{\_}n(f_{\_}1)\wedge\dots\wedge\mathrm{Pol}(\rho)_{\_}n(f_{\_}m) imply βαPol(ρ)_n(gf_1,,f_m)\beta\otimes\alpha\leq\mathrm{Pol}(\rho)_{\_}n(g\circ\langle f_{\_}1,\dots,f_{\_}m\rangle). Define {f_1,,f_m}α:AnA\{f_{\_}1,\dots,f_{\_}m\}^{\alpha}\colon A^{n}\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}A as the join of {f_1}α,,{f_m}α\{f_{\_}1\}^{\alpha},\dots,\{f_{\_}m\}^{\alpha} (cf. Example 2.7); that is,

{f_1,,f_m}α(f)={αif f=f_i for some i{1,,m},otherwise\{f_{\_}1,\dots,f_{\_}m\}^{\alpha}(f^{\prime})=\begin{cases}\alpha&\text{if $f^{\prime}=f_{\_}i$ for some $i\in\{1,\dots,m\}$},\\ \bot&\text{otherwise}\end{cases}

for all f𝒜(An,A)f^{\prime}\in\mathcal{A}(A^{n},A). The assumptions amount to {g}βρ({π_i}_i=1mρ)\{g\}^{\beta}\leq\rho\swarrow\big{(}\{\pi_{\_}i\}_{\_}{i=1}^{m}\searrow\rho\big{)} and {f_1,,f_m}αρ({π_i}_i=1nρ)\{f_{\_}1,\dots,f_{\_}m\}^{\alpha}\leq\rho\swarrow\big{(}\{\pi_{\_}i\}_{\_}{i=1}^{n}\searrow\rho\big{)}, i.e., {π_i}_i=1mρ{g}βρ\{\pi_{\_}i\}_{\_}{i=1}^{m}\searrow\rho\leq\{g\}^{\beta}\searrow\rho and {π_i}_i=1nρ{f_1,,f_m}αρ\{\pi_{\_}i\}_{\_}{i=1}^{n}\searrow\rho\leq\{f_{\_}1,\dots,f_{\_}m\}^{\alpha}\searrow\rho. Hence

{π_i}_i=1nρ\displaystyle\{\pi_{\_}i\}_{\_}{i=1}^{n}\searrow\rho {f_1,,f_m}αρ\displaystyle\leq\{f_{\_}1,\dots,f_{\_}m\}^{\alpha}\searrow\rho
=({π_i}_i=1m{f_1,,f_m}α)ρ\displaystyle=\big{(}\{\pi_{\_}i\}_{\_}{i=1}^{m}\circ\{\langle f_{\_}1,\dots,f_{\_}m\rangle\}^{\alpha}\big{)}\searrow\rho
={f_1,,f_m}α({π_i}_i=1mρ)\displaystyle=\{\langle f_{\_}1,\dots,f_{\_}m\rangle\}^{\alpha}\searrow\big{(}\{\pi_{\_}i\}_{\_}{i=1}^{m}\searrow\rho\big{)}
{f_1,,f_m}α({g}βρ)\displaystyle\leq\{\langle f_{\_}1,\dots,f_{\_}m\rangle\}^{\alpha}\searrow\big{(}\{g\}^{\beta}\searrow\rho\big{)}
=({g}β{f_1,,f_m}α)ρ\displaystyle=\big{(}\{g\}^{\beta}\circ\{\langle f_{\_}1,\dots,f_{\_}m\rangle\}^{\alpha}\big{)}\searrow\rho
={gf_1,,f_m}βαρ,\displaystyle=\{g\circ\langle f_{\_}1,\dots,f_{\_}m\rangle\}^{\beta\otimes\alpha}\searrow\rho,

showing βαPol(ρ)_n(gf_1,,f_m)\beta\otimes\alpha\leq\mathrm{Pol}(\rho)_{\_}n(g\circ\langle f_{\_}1,\dots,f_{\_}m\rangle). ∎

Proposition 4.2.

Let 𝒬\mathcal{Q} be a quantale, 𝒜\mathcal{A} a locally small category with finite products and A𝒜A\in\mathcal{A}.

  1. 1.

    If K𝒜K\in\mathcal{A} and (ρ_j:KA)_jJ(\rho_{\_}j\colon K\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}A)_{\_}{j\in J} is a family of KK-ary 𝒬\mathcal{Q}-valued relations on AA, then for each nn\in\mathbb{N}, we have _jJPol(ρ_j)_nPol(_jJρ_j)_n\bigwedge_{\_}{j\in J}\mathrm{Pol}(\rho_{\_}j)_{\_}n\leq\mathrm{Pol}(\bigwedge_{\_}{j\in J}\rho_{\_}j)_{\_}n.

  2. 2.

    If K,L𝒜K,L\in\mathcal{A}, ρ:KA\rho\colon K\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}A is a KK-ary 𝒬\mathcal{Q}-valued relation on AA, and σ:KL\sigma\colon K\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}L is a morphism in 𝒬𝒜\mathcal{QA}, then for each nn\in\mathbb{N}, we have Pol(ρ)_nPol(ρσ)_n\mathrm{Pol}(\rho)_{\_}n\leq\mathrm{Pol}(\rho\swarrow\sigma)_{\_}n.

Proof.

One can show these by a straightforward modification of the proof of Proposition 3.2, along the lines of the proof of Proposition 4.1. ∎

In the remainder of this section, we shall sketch the quantaloidal CSP in 𝒬𝒜\mathcal{QA}. In order to render the following as a well-defined computational problem, we would have to specify suitable machine representations of the data involved. We shall omit such considerations in this section, and simplify the discussion by allowing infinitely many constraints as well as infinite constraint languages.

An instance I=(V,D,𝒞)I=(V,D,\mathcal{C}) consists of objects V,D𝒜V,D\in\mathcal{A} and a set 𝒞\mathcal{C} of 𝒬\mathcal{Q}-valued constraints (in 𝒜\mathcal{A}). There seems to be a few possibilities concerning the detail of a definition of 𝒬\mathcal{Q}-valued constraint.

  1. 1.

    A straightforward approach is to define a 𝒬\mathcal{Q}-valued constraint as a triple (K,𝐱,ρ)(K,\mathbf{x},\rho) consisting of an object K𝒜K\in\mathcal{A}, a morphism 𝐱:KV\mathbf{x}\colon K\to V in 𝒜\mathcal{A} and a morphism ρ:KD\rho\colon K\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}D in 𝒬𝒜\mathcal{QA}. We may then define the morphism 𝒮(I):VD\mathcal{S}(I)\colon V\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}D by 𝒮(I)=_(K,𝐱,ρ)𝒞ρ{𝐱}\mathcal{S}(I)=\bigwedge_{\_}{(K,\mathbf{x},\rho)\in\mathcal{C}}\rho\swarrow\{\mathbf{x}\}.

  2. 2.

    The second possibility is to define a 𝒬\mathcal{Q}-valued constraint as a quadruple (K,𝐱,α,ρ)(K,\mathbf{x},\alpha,\rho), adding a new component αQ\alpha\in Q. 𝒮(I)\mathcal{S}(I) is now given as _(K,𝐱,α,ρ)𝒞ρ{𝐱}α\bigwedge_{\_}{(K,\mathbf{x},\alpha,\rho)\in\mathcal{C}}\rho\swarrow\{\mathbf{x}\}^{\alpha}. This latter formulation seems to be better suited for considerations involving 𝒬\mathcal{Q}-valued constraint languages. A 𝒬\mathcal{Q}-valued constraint language consists of a pair (D,𝒟)(D,\mathcal{D}) of an object D𝒜D\in\mathcal{A} and a set 𝒟\mathcal{D} of morphisms in 𝒬𝒜\mathcal{QA} with codomain DD. Given an instance I=(V,D,𝒞)I=(V,D,\mathcal{C}) such that ρ𝒟\rho\in\mathcal{D} for each (K,𝐱,α,ρ)𝒞(K,\mathbf{x},\alpha,\rho)\in\mathcal{C}, we may define for each (say, KK-ary) ρ𝒟\rho\in\mathcal{D} the morphism σ_ρ:KV\sigma_{\_}\rho\colon K\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}V as the supremum of all morphisms {𝐱}α\{\mathbf{x}\}^{\alpha} with (K,𝐱,α,ρ)𝒞(K,\mathbf{x},\alpha,\rho)\in\mathcal{C}. In view of the equation _jJ(ρσ_j)=ρ(_jJσ_j)\bigwedge_{\_}{j\in J}\big{(}\rho\swarrow\sigma_{\_}j\big{)}=\rho\swarrow\big{(}\bigvee_{\_}{j\in J}\sigma_{\_}j\big{)}, we have 𝒮(I)=_ρ𝒟ρσ_ρ\mathcal{S}(I)=\bigwedge_{\_}{\rho\in\mathcal{D}}\rho\swarrow\sigma_{\_}\rho. Notice that Proposition 4.2 implies that any 𝒬\mathcal{Q}-valued polymorphism for 𝒟\mathcal{D} is a 𝒬\mathcal{Q}-valued polymorphism for 𝒮(I)\mathcal{S}(I).

  3. 3.

    This suggests the third, most general definition of 𝒬\mathcal{Q}-valued constraint; it is a triple (K,σ,ρ)(K,\sigma,\rho) consisting of an object K𝒜K\in\mathcal{A} and morphisms σ:KV\sigma\colon K\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}V and ρ:KD\rho\colon K\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}D in 𝒬𝒜\mathcal{QA}. We now have 𝒮(I)=_(K,σ,ρ)𝒞ρσ\mathcal{S}(I)=\bigwedge_{\_}{(K,\sigma,\rho)\in\mathcal{C}}\rho\swarrow\sigma. In the next section, we shall adopt (a finitary version of) this definition.

In each case, the goal is to determine the value 𝒪(I)={!_D}𝒮(I):V1\mathcal{O}(I)=\{!_{\_}D\}\circ\mathcal{S}(I)\colon V\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}1, where 11 is the terminal object of 𝒜\mathcal{A}. Notice that since (𝒬𝒜)(V,1)=[𝒜(V,1),Q]Q(\mathcal{QA})(V,1)=[\mathcal{A}(V,1),Q]\cong Q, we can naturally identify 𝒪(I)\mathcal{O}(I) with an element of QQ, the “optimal value” of II.

5 Quantaloidal CSPs in ¯𝐅𝐢𝐧𝐒𝐞𝐭\overline{\mathbb{R}}\mathbf{FinSet} and ¯𝐒𝐞𝐭\overline{\mathbb{R}}\mathbf{Set} as optimisation problems

In this section, we consider a certain class of optimisation problems which we call the tropical valued CSP (TVCSP). The TVCSP is a subclass of the quantaloidal CSP in the quantaloid ¯𝐒𝐞𝐭\overline{\mathbb{R}}\mathbf{Set}. A TVCSP instance II consists of a finite set VV of variables, a (possibly infinite) set DD called the domain, and a finite set 𝒞\mathcal{C} of ¯\overline{\mathbb{R}}-valued constraints. Here, we define an ¯\overline{\mathbb{R}}-valued constraint as a triple (k,σ,ρ)(k,\sigma,\rho) consisting of a natural number kk and morphisms σ:[k]V\sigma:[k]\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}V and ρ:[k]D\rho:[k]\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}D in ¯𝐒𝐞𝐭\overline{\mathbb{R}}\mathbf{Set}. For a TVCSP instance I=(V,D,𝒞)I=(V,D,\mathcal{C}), the morphism 𝒮(I):VD\mathcal{S}(I):V\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}D in ¯𝐒𝐞𝐭\overline{\mathbb{R}}\mathbf{Set} maps each s:VDs:V\to D to

𝒮(I)(s)=sup_(k,σ,ρ)𝒞sup_𝐱Vk(ρ(s(𝐱))σ(𝐱)),\displaystyle\mathcal{S}(I)(s)=\sup_{\_}{(k,\sigma,\rho)\in\mathcal{C}}\sup_{\_}{\mathbf{x}\in V^{k}}\left(\rho(s(\mathbf{x}))-\sigma(\mathbf{x})\right), (7)

where s(𝐱)s(\mathbf{x}) denotes the composite s𝐱:[k]Ds\circ\mathbf{x}\colon[k]\to D. To solve the TVCSP instance II is to compute

𝒪(I)=inf_s:VD𝒮(I)(s).\displaystyle\mathcal{O}(I)=\inf_{\_}{s:V\to D}\mathcal{S}(I)(s).

Thus the TVCSP is a problem of computing a minimax value, and it can model scenarios in which we wish to “minimise the maximum loss” or “optimise the worst case”.

Example 5.1.

Consider a scheduling problem, in which we are given multiple activities 1,,n1,\dots,n, precedence relations among the activities of the form “activity jj cannot start until activity ii finishes”, the processing time p_ip_{\_}i\in\mathbb{N} of each activity ii (so that if activity ii starts at time s(i)s(i)\in\mathbb{N}, then it finishes at time s(i)+p_is(i)+p_{\_}i\in\mathbb{N}) and the due date d_id_{\_}i\in\mathbb{N} of each activity ii. We are interested in a schedule of the activities (a function s:[n]s\colon[n]\to\mathbb{N}) that minimises the maximum deviation from due dates (max_i[n]|d_i(s(i)+p_i)|\max_{\_}{i\in[n]}|d_{\_}i-(s(i)+p_{\_}i)|). We can model this as a TVCSP instance by setting V=[n]V=[n] and D=D=\mathbb{N} (or D=[N]D=[N] for a suitably large NN\in\mathbb{N}), expressing the maximum deviation by an ¯\overline{\mathbb{R}}-valued relation, and encoding the precedence relations (and the processing time) using ¯\overline{\mathbb{R}}-valued constraints taking values in {0,}\{0,\infty\}.

We explain our choice of the name “tropical valued CSP”. The valued CSP (VCSP) is a well-known optimisation variant of the CSP (see, e.g., [42]). The data of a VCSP instance I=(V,D,𝒞)I=(V,D,\mathcal{C}) is similar to that of a TVCSP instance, and the goal is to compute the infimum of

_(k,σ,ρ)𝒞_𝐱Vkσ(𝐱)ρ(s(𝐱))\sum_{\_}{(k,\sigma,\rho)\in\mathcal{C}}\sum_{\_}{\mathbf{x}\in V^{k}}\sigma(\mathbf{x})\cdot\rho(s(\mathbf{x})) (8)

over s:VDs:V\to D. (Precisely, we have to assume, e.g., that 0σ(𝐱)<0\leq\sigma(\mathbf{x})<\infty for each 𝐱Vk\mathbf{x}\in V^{k} in the VCSP.) We can regard (7) as a variant of (8), in which addition is replaced by supremum and multiplication by subtraction. This is analogous to the transition from the field \mathbb{R} of real numbers to the quantale ¯\overline{\mathbb{R}}, which may be thought of as a variant of the tropical semiring (see, e.g., [37]); roughly, the latter is obtained from the former by replacing addition by infimum and multiplication by addition.444It is known that computational complexity of VCSPs can be captured by the notion of weighted polymorphism [12]. Weighted polymorphisms differ substantially from our ¯\overline{\mathbb{R}}-valued polymorphisms, and we have not been able to understand the former from a categorical perspective.

5.1 The dichotomy theorem for TVCSPs with finite domains

In this subsection, we consider TVCSPs in which the domains DD are also finite. Thus we may think of our problems as a subclass of the quantaloidal CSP in the quantaloid ¯𝐅𝐢𝐧𝐒𝐞𝐭\overline{\mathbb{R}}\mathbf{FinSet}.

We shall classify TVCSPs in terms of computational complexity. In order to do so rigorously, we specify a representation of instances as follows. We assume that σ\sigma and ρ\rho in each ¯\overline{\mathbb{R}}-valued constraint (k,σ,ρ)(k,\sigma,\rho) take values in {±}\mathbb{Q}\cup\{\pm\infty\}. Furthermore, (k,σ,ρ)(k,\sigma,\rho) is given by the lists of all pairs (𝐱,σ(𝐱))(\mathbf{x},\sigma(\mathbf{x})) for 𝐱domσ\mathbf{x}\in\operatorname{dom}\sigma and of all pairs (𝐝,ρ(𝐝))(\mathbf{d},\rho(\mathbf{d})) for 𝐝domρ\mathbf{d}\in\operatorname{dom}\rho, where domσ={𝐱Vkσ(𝐱)<}\operatorname{dom}\sigma=\{\,\mathbf{x}\in V^{k}\mid\sigma(\mathbf{x})<\infty\,\} and domρ={𝐝Dkρ(𝐝)<}\operatorname{dom}\rho=\{\,\mathbf{d}\in D^{k}\mid\rho(\mathbf{d})<\infty\,\}. Hence the input size of an instance I=(V,D,𝒞)I=(V,D,\mathcal{C}) is O(|V|+|D|+_(k,σ,ρ)𝒞(|domσ|+|domρ|))O(|V|+|D|+\sum_{\_}{(k,\sigma,\rho)\in\mathcal{C}}(|\operatorname{dom}\sigma|+|\operatorname{dom}\rho|)). Let 𝒟\mathcal{D} be a finite set of ¯\overline{\mathbb{R}}-valued relations on a finite set DD. TVCSP(𝒟)\mathrm{TVCSP}(\mathcal{D}) denotes the class of all TVCSP instances I=(V,D,𝒞)I=(V,D^{\prime},\mathcal{C}) such that D=DD^{\prime}=D and, for each ¯\overline{\mathbb{R}}-valued constraint (k,σ,ρ)𝒞(k,\sigma,\rho)\in\mathcal{C}, we have ρ𝒟\rho\in\mathcal{D}.

For a kk-ary ¯\overline{\mathbb{R}}-valued relation ρ\rho and α¯\alpha\in\overline{\mathbb{R}} with α<\alpha<\infty, we denote by ρα{\rho}^{\alpha} the sublevel set of ρ\rho with respect to α\alpha, i.e., ρα={𝐝Dkαρ(𝐝)}{\rho}^{\alpha}=\{\,\mathbf{d}\in D^{k}\mid\alpha\geq\rho(\mathbf{d})\,\}. We define U𝒟={ραρ𝒟,α<}U\mathcal{D}=\{\,{\rho}^{\alpha}\mid\rho\in\mathcal{D},\,\alpha<\infty\,\}.

Proposition 5.2.

Let DD be a finite set and 𝒟\mathcal{D} a finite set of ¯\overline{\mathbb{R}}-valued relations on DD. Then TVCSP(𝒟)\mathrm{TVCSP}(\mathcal{D}) and CSP(U𝒟)\mathrm{CSP}(U\mathcal{D}) are polynomial-time reducible to each other.

Proof.

We first give a polynomial-time reduction from TVCSP(𝒟)\mathrm{TVCSP}(\mathcal{D}) to CSP(U𝒟)\mathrm{CSP}(U\mathcal{D}). Take an arbitrary TVCSP instance I=(V,D,𝒞)TVCSP(𝒟)I=(V,D,\mathcal{C})\in\mathrm{TVCSP}(\mathcal{D}). For any α<\alpha<\infty, we obtain

α𝒪(I)\displaystyle\alpha\geq\mathcal{O}(I) s:VD.(k,σ,ρ)𝒞.𝐱Vk.αρ(s(𝐱))σ(𝐱)\displaystyle\iff\exists s:V\to D.~{}\forall(k,\sigma,\rho)\in\mathcal{C}.~{}\forall\mathbf{x}\in V^{k}.~{}\alpha\geq\rho(s(\mathbf{x}))-\sigma(\mathbf{x})
s:VD.(k,σ,ρ)𝒞.𝐱Vk.σ(𝐱)+αρ(s(𝐱))\displaystyle\iff\exists s:V\to D.~{}\forall(k,\sigma,\rho)\in\mathcal{C}.~{}\forall\mathbf{x}\in V^{k}.~{}\sigma(\mathbf{x})+\alpha\geq\rho(s(\mathbf{x}))
s:VD.(k,σ,ρ)𝒞.𝐱domσ.σ(𝐱)+αρ(s(𝐱))\displaystyle\iff\exists s:V\to D.~{}\forall(k,\sigma,\rho)\in\mathcal{C}.~{}\forall\mathbf{x}\in\operatorname{dom}\sigma.~{}\sigma(\mathbf{x})+\alpha\geq\rho(s(\mathbf{x}))
s:VD.(k,σ,ρ)𝒞.𝐱domσ.s(𝐱)ρσ(𝐱)+α.\displaystyle\iff\exists s:V\to D.~{}\forall(k,\sigma,\rho)\in\mathcal{C}.~{}\forall\mathbf{x}\in\operatorname{dom}\sigma.~{}s(\mathbf{x})\in\rho^{\sigma(\mathbf{x})+\alpha}.

Define the CSP instance Iα=(V,D,𝒞α)I^{\alpha}=(V,D,\mathcal{C}^{\alpha}) by

𝒞α={(k,𝐱,ρσ(𝐱)+α)(k,σ,ρ)𝒞,𝐱domσ}.\displaystyle\mathcal{C}^{\alpha}=\{\,(k,\mathbf{x},{\rho}^{\sigma(\mathbf{x})+\alpha})\mid(k,\sigma,\rho)\in\mathcal{C},\,\mathbf{x}\in\operatorname{dom}\sigma\,\}.

Then we have

α𝒪(I)𝒮(Iα).\displaystyle\alpha\geq\mathcal{O}(I)\iff\mathcal{S}(I^{\alpha})\neq\emptyset. (9)

Note that, since α<\alpha<\infty, IαCSP(U𝒟)I^{\alpha}\in\mathrm{CSP}(U\mathcal{D}) and the input size of IαI^{\alpha} is bounded by a polynomial in that of II. (Indeed, such a bound is provided by |V|+|D|+_(k,σ,ρ)𝒞|domσ||domρ||V|+|D|+\sum_{\_}{(k,\sigma,\rho)\in\mathcal{C}}|\operatorname{dom}\sigma||\operatorname{dom}\rho|.) The relation (9) says that the computation of 𝒪(I)\mathcal{O}(I) can be reduced to the problem of finding the minimum α\alpha such that 𝒮(Iα)\mathcal{S}(I^{\alpha})\neq\emptyset. Since

𝒪(I){ρ(𝐝)σ(𝐱)(k,σ,ρ)𝒞,𝐝domρ,𝐱domσ}{±},\displaystyle\mathcal{O}(I)\in\{\,\rho(\mathbf{d})-\sigma(\mathbf{x})\mid(k,\sigma,\rho)\in\mathcal{C},\,\mathbf{d}\in\operatorname{dom}\rho,\,\mathbf{x}\in\operatorname{dom}\sigma\,\}\cup\{\pm\infty\},

it suffices to solve the CSP instance IαI^{\alpha} only for

α({ρ(𝐝)σ(𝐱)(k,σ,ρ)𝒞,𝐝domρ,𝐱domσ}{}){}.\displaystyle\alpha\in\left(\{\,\rho(\mathbf{d})-\sigma(\mathbf{x})\mid(k,\sigma,\rho)\in\mathcal{C},\,\mathbf{d}\in\operatorname{dom}\rho,\,\mathbf{x}\in\operatorname{dom}\sigma\,\}\setminus\{\infty\}\right)\cup\{-\infty\}.

Since |{ρ(𝐝)σ(𝐱)(k,σ,ρ)𝒞,𝐝domρ,𝐱domσ}|_(k,σ,ρ)𝒞|domσ||domρ||\{\,\rho(\mathbf{d})-\sigma(\mathbf{x})\mid(k,\sigma,\rho)\in\mathcal{C},\mathbf{d}\in\operatorname{dom}\rho,\mathbf{x}\in\operatorname{dom}\sigma\,\}|\leq\sum_{\_}{(k,\sigma,\rho)\in\mathcal{C}}|\operatorname{dom}\sigma||\operatorname{dom}\rho|, we can compute 𝒪(I)\mathcal{O}(I) by solving polynomially many instances in CSP(U𝒞)\mathrm{CSP}(U\mathcal{C}). Thus TVCSP(𝒟)\mathrm{TVCSP}(\mathcal{D}) is polynomial-time reducible to CSP(U𝒟)\mathrm{CSP}(U\mathcal{D}).

We then give a polynomial-time reduction from CSP(U𝒟)\mathrm{CSP}(U\mathcal{D}) to TVCSP(𝒟)\mathrm{TVCSP}(\mathcal{D}). For α<\alpha<\infty and 𝐱Vk\mathbf{x}\in V^{k}, recall the morphism {𝐱}α:[k]V\{\mathbf{x}\}^{\alpha}:[k]\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}V in ¯𝐅𝐢𝐧𝐒𝐞𝐭\overline{\mathbb{R}}\mathbf{FinSet} defined in Example 2.7 as

{𝐱}α(𝐱)={αif 𝐱=𝐱,otherwise.\displaystyle\{\mathbf{x}\}^{\alpha}(\mathbf{x}^{\prime})=\begin{cases}\alpha&\text{if $\mathbf{x}^{\prime}=\mathbf{x}$},\\ \infty&\text{otherwise}.\end{cases}

From a CSP instance I_0=(V,D,𝒞_0)CSP(U𝒟)I_{\_}0=(V,D,\mathcal{C}_{\_}0)\in\mathrm{CSP}(U\mathcal{D}), we construct a TVCSP instance I=(V,D,𝒞)I=(V,D,\mathcal{C}) where 𝒞={(k,{𝐱}α,ρ)(k,𝐱,ρα)𝒞_0}\mathcal{C}=\{\,(k,\{\mathbf{x}\}^{\alpha},\rho)\mid(k,\mathbf{x},\rho^{\alpha})\in\mathcal{C}_{\_}0\,\}. (Note that for each (k,𝐱,ρ)𝒞_0(k,\mathbf{x},\rho^{\prime})\in\mathcal{C}_{\_}0, there exist ρ𝒟_k\rho\in\mathcal{D}_{\_}k and α<\alpha<\infty such that ρ=ρα\rho^{\prime}=\rho^{\alpha}, and we can find such a pair (ρ,α)(\rho,\alpha) in polynomial time by inspecting all ρ𝒟_k\rho\in\mathcal{D}_{\_}k and α{ρ(𝐱)𝐱domρ}\alpha\in\{\rho(\mathbf{x})\mid\mathbf{x}\in\operatorname{dom}\rho\}.) Then

𝒮(I_0)\displaystyle\mathcal{S}(I_{\_}0)\neq\emptyset s:VD.(k,𝐱,ρα)𝒞_0.αρ(s(𝐱))\displaystyle\iff\exists s:V\to D.~{}\forall(k,\mathbf{x},\rho^{\alpha})\in\mathcal{C}_{\_}0.~{}\alpha\geq\rho(s(\mathbf{x}))
s:VD.(k,𝐱,ρα)𝒞_0.0ρ(s(𝐱))α\displaystyle\iff\exists s:V\to D.~{}\forall(k,\mathbf{x},\rho^{\alpha})\in\mathcal{C}_{\_}0.~{}0\geq\rho(s(\mathbf{x}))-\alpha
s:VD.(k,{𝐱}α,ρ)𝒞.𝐱dom{𝐱}α.0ρ(s(𝐱)){𝐱}α(𝐱)\displaystyle\iff\exists s:V\to D.~{}\forall(k,\{\mathbf{x}\}^{\alpha},\rho)\in\mathcal{C}.~{}\forall\mathbf{x}^{\prime}\in\operatorname{dom}\{\mathbf{x}\}^{\alpha}.~{}0\geq\rho(s(\mathbf{x}^{\prime}))-\{\mathbf{x}\}^{\alpha}(\mathbf{x}^{\prime})
s:VD.(k,{𝐱}α,ρ)𝒞.𝐱Vk.0ρ(s(𝐱)){𝐱}α(𝐱)\displaystyle\iff\exists s:V\to D.~{}\forall(k,\{\mathbf{x}\}^{\alpha},\rho)\in\mathcal{C}.~{}\forall\mathbf{x}^{\prime}\in V^{k}.~{}0\geq\rho(s(\mathbf{x}^{\prime}))-\{\mathbf{x}\}^{\alpha}(\mathbf{x}^{\prime})
0𝒪(I).\displaystyle\iff 0\geq\mathcal{O}(I).

Thus we can solve I_0I_{\_}0 by determining if 0𝒪(I)0\geq\mathcal{O}(I). This gives a polynomial-time reduction from CSP(U𝒟)\mathrm{CSP}(U\mathcal{D}) to TVCSP(𝒟)\mathrm{TVCSP}(\mathcal{D}). ∎

Hence the classification of TVCSPs is reduced to that of CSPs. In particular, the dichotomy theorem for CSPs (Theorem 3.5) implies the dichotomy for TVCSPs: TVCSP(𝒟)\mathrm{TVCSP}(\mathcal{D}) is either in P or NP-hard. We note that a relation analogous to that between TVCSP(𝒟)\mathrm{TVCSP}(\mathcal{D}) and CSP(U𝒟)\mathrm{CSP}(U\mathcal{D}) described in Proposition 5.2 has already been observed in the context of the fuzzy CSP [34, Section 9.4.3], which can be seen as a special case of the TVCSP (see also [19]). However, the situation for the TVCSP is subtler due to the coexistence of \infty and -\infty, and our proof of Proposition 5.2 relies heavily on the adjointness relation (2) in ¯\overline{\mathbb{R}} as well as the details of the operations ++ and - (Table 1).

The above dichotomy for TVCSPs can be captured by a suitable notion of polymorphism. Specialising the notion of 𝒬\mathcal{Q}-valued polymorphism in Section 4 to the quantaloid ¯𝐅𝐢𝐧𝐒𝐞𝐭\overline{\mathbb{R}}\mathbf{FinSet}, we define an (nn-ary) ¯\overline{\mathbb{R}}-valued polymorphism of an ¯\overline{\mathbb{R}}-valued relation ρ:[k]A\rho\colon[k]\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}A on a finite set AA to be a pair (f,α)(f,\alpha) of a function f:AnAf\colon A^{n}\to A and α¯\alpha\in\overline{\mathbb{R}} such that for all (x_ij)An×k(x_{\_}{ij})\in A^{n\times k}, we have

α+sup{ρ(x_11,,x_1k),,ρ(x_n1,,x_nk)}ρ(f(x_11,,x_n1),,f(x_1k,,x_nk)).\displaystyle\alpha+\sup\{\,\rho(x_{\_}{11},\dots,x_{\_}{1k}),\dots,\rho(x_{\_}{n1},\dots,x_{\_}{nk})\,\}\geq\rho(f(x_{\_}{11},\dots,x_{\_}{n1}),\dots,f(x_{\_}{1k},\dots,x_{\_}{nk})).

Given a set \mathcal{R} of ¯\overline{\mathbb{R}}-valued relations on AA, we say (f,α)(f,\alpha) is an ¯\overline{\mathbb{R}}-valued polymorphism of \mathcal{R} if it is so for every element of \mathcal{R}.

Lemma 5.3.

Let AA be a finite set and \mathcal{R} a set of ¯\overline{\mathbb{R}}-valued relations on AA. For any function f:AnAf\colon A^{n}\to A, (f,0)(f,0) is an ¯\overline{\mathbb{R}}-valued polymorphism of \mathcal{R} if and only if ff is a polymorphism of UU\mathcal{R}.

Proof.

We may assume that \mathcal{R} consists of a single (say, kk-ary) ¯\overline{\mathbb{R}}-valued relation ρ:[k]A\rho\colon[k]\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}A.

First suppose that (f,0)(f,0) is an ¯\overline{\mathbb{R}}-valued polymorphism of ρ\rho. Our aim is to show that for every α<\alpha<\infty, ff is a polymorphism of ρα{\rho}^{\alpha}, i.e., that for any (x_ij)An×k(x_{\_}{ij})\in A^{n\times k} we have

(ρα(x_11,,x_1k)ρα(x_n1,,x_nk))ρα(f(x_11,,x_n1),,f(x_1k,,x_nk)).\big{(}\rho^{\alpha}(x_{\_}{11},\dots,x_{\_}{1k})\wedge\dots\wedge\rho^{\alpha}(x_{\_}{n1},\dots,x_{\_}{nk})\big{)}\implies\rho^{\alpha}(f(x_{\_}{11},\dots,x_{\_}{n1}),\dots,f(x_{\_}{1k},\dots,x_{\_}{nk})). (10)

Assume the antecedent of (10), i.e., that αρ(x_i1,,x_ik)\alpha\geq\rho(x_{\_}{i1},\dots,x_{\_}{ik}) for every i{1,,n}i\in\{1,\dots,n\}. Since (f,0)(f,0) is an ¯\overline{\mathbb{R}}-valued polymorphism of ρ\rho, we have

sup{ρ(x_11,,x_1k),,ρ(x_n1,,x_nk)}ρ(f(x_11,,x_n1),,f(x_1k,,x_nk)).\sup\{\,\rho(x_{\_}{11},\dots,x_{\_}{1k}),\dots,\rho(x_{\_}{n1},\dots,x_{\_}{nk})\,\}\geq\rho(f(x_{\_}{11},\dots,x_{\_}{n1}),\dots,f(x_{\_}{1k},\dots,x_{\_}{nk})).

Thus it follows that αρ(f(x_11,,x_n1),,f(x_1k,,x_nk))\alpha\geq\rho(f(x_{\_}{11},\dots,x_{\_}{n1}),\dots,f(x_{\_}{1k},\dots,x_{\_}{nk})), showing the consequent of (10).

Next suppose that (f,0)(f,0) is not an ¯\overline{\mathbb{R}}-valued polymorphism of ρ\rho. This means that there exists a tuple (x_ij)An×k(x_{\_}{ij})\in A^{n\times k} such that

sup{ρ(x_11,,x_1k),,ρ(x_n1,,x_nk)}<ρ(f(x_11,,x_n1),,f(x_1k,,x_nk)).\sup\{\,\rho(x_{\_}{11},\dots,x_{\_}{1k}),\dots,\rho(x_{\_}{n1},\dots,x_{\_}{nk})\,\}<\rho(f(x_{\_}{11},\dots,x_{\_}{n1}),\dots,f(x_{\_}{1k},\dots,x_{\_}{nk})).

Let α\alpha be the value of the left-hand side. Then α<\alpha<\infty and ff is not a polymorphism of ρα\rho^{\alpha}; indeed, our choice of (x_ij)(x_{\_}{ij}) and α\alpha implies that (10) is violated. ∎

As an easy consequence of Theorem 3.5, Proposition 5.2 and Lemma 5.3, we have the following criterion of computational complexity in terms of ¯\overline{\mathbb{R}}-valued polymorphisms. An analogous result has been obtained in [19], although in a different setting.

Theorem 5.4.

Let DD be a finite set and 𝒟\mathcal{D} a finite set of ¯\overline{\mathbb{R}}-valued relations on DD. If (f,0)(f,0) is an ¯\overline{\mathbb{R}}-valued polymorphism of 𝒟\mathcal{D} for some Siggers operation ff on DD, then TVCSP(𝒟)\mathrm{TVCSP}(\mathcal{D}) is in P. Otherwise, it is NP-hard.

Remark 5.5.

Let ρ:[k]A\rho\colon[k]\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}A be an ¯\overline{\mathbb{R}}-valued relation on a finite set AA. The ¯\overline{\mathbb{R}}-valued polymorphisms of ρ\rho give rise to the clone on AA consisting of all operations ff on AA such that (f,0)(f,0) is an ¯\overline{\mathbb{R}}-valued polymorphism of ρ\rho. By Lemma 5.3, this is the clone of polymorphisms of {ραα<}\{\rho^{\alpha}\mid\alpha<\infty\}. In addition, we also have the (in general strictly larger) clone on AA which consists of all ff such that (f,α)(f,\alpha) is an ¯\overline{\mathbb{R}}-valued polymorphism of ρ\rho for some α<\alpha<\infty. See Proposition 4.1.

5.2 TVCSPs and continuous optimisation

Finally, we consider TVCSPs in which the domains DD are equal to the set \mathbb{R} of real numbers. In this case, 𝒮(I):V\mathcal{S}(I):V\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}\mathbb{R} for a TVCSP instance I=(V,,𝒞)I=(V,\mathbb{R},\mathcal{C}) amounts to a function V¯\mathbb{R}^{V}\rightarrow\overline{\mathbb{R}} and 𝒪(I)\mathcal{O}(I) is the infimum of 𝒮(I)\mathcal{S}(I). Hence, it can be regarded as a continuous optimisation problem. In continuous optimisation, convexity of a function plays a key role in the design of efficient minimisation algorithms. We investigate the relationship between convexity and the TVCSP in what follows. We note that infinite numeric domains such as D=D=\mathbb{R}, \mathbb{Q}, and \mathbb{Z} have been studied in the ordinary CSP (see, e.g., [5]).

A function ρ:k¯\rho:\mathbb{R}^{k}\rightarrow\overline{\mathbb{R}} is called quasiconvex if max{ρ(𝐱),ρ(𝐲)}ρ(λ𝐱+(1λ)𝐲)\max\{\rho(\mathbf{x}),\rho(\mathbf{y})\}\geq\rho(\lambda\mathbf{x}+(1-\lambda)\mathbf{y}) for all 𝐱,𝐲k\mathbf{x},\mathbf{y}\in\mathbb{R}^{k} and λ[0,1]\lambda\in[0,1]. In other words, a function is quasiconvex if and only if every sublevel set of it is convex. Quasiconvex functions generalise convex functions, and their minimisation algorithms have been studied (e.g., [23]). We can capture quasiconvexity by ¯\overline{\mathbb{R}}-valued polymorphisms. For each λ[0,1]\lambda\in[0,1] we define a binary operation f_λ:2f_{\_}{\lambda}:\mathbb{R}^{2}\rightarrow\mathbb{R} as f_λ(x,y)=λx+(1λ)yf_{\_}\lambda(x,y)=\lambda x+(1-\lambda)y. It is then immediate from the definition of quasiconvexity that a function ρ:k¯\rho:\mathbb{R}^{k}\rightarrow\overline{\mathbb{R}} is quasiconvex if and only if (f_λ,0)(f_{\_}\lambda,0) is an ¯\overline{\mathbb{R}}-valued polymorphism of the corresponding ¯\overline{\mathbb{R}}-valued relation ρ:[k]\rho\colon[k]\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}\mathbb{R} for all λ[0,1]\lambda\in[0,1].

Next we consider a TVCSP associated with linear ¯\overline{\mathbb{R}}-valued relations, where ρ:[k]\rho:[k]\mathrel{\mathchoice{\ooalign{$\displaystyle\mapstochar\mkern 5.0mu$\cr$\displaystyle\to$\cr}}{\ooalign{$\textstyle\mapstochar\mkern 5.0mu$\cr$\textstyle\to$\cr}}{\ooalign{$\scriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptstyle\to$\cr}}{\ooalign{$\scriptscriptstyle\mapstochar\mkern 5.0mu$\cr$\scriptscriptstyle\to$\cr}}}\mathbb{R} is linear if there exists 𝐰ρ=(w_ρ1,,w_ρk)k\mathbf{w}^{\rho}=(w^{\rho}_{\_}1,\dots,w^{\rho}_{\_}k)\in\mathbb{R}^{k} such that for all 𝐝=(d_1,,d_k)k\mathbf{d}=(d_{\_}1,\dots,d_{\_}k)\in\mathbb{R}^{k}, we have ρ(𝐝)=_j=1kw_ρjd_j\rho(\mathbf{d})=\sum_{\_}{j=1}^{k}w^{\rho}_{\_}jd_{\_}j. Given a TVCSP instance I=(V,,𝒞)I=(V,\mathbb{R},\mathcal{C}) such that ρ\rho is linear for all (k,σ,ρ)𝒞(k,\sigma,\rho)\in\mathcal{C}, 𝒮(I)\mathcal{S}(I) is the supremum of finitely many affine functions (or the constant function with the value \infty); hence it is a piecewise-linear convex function V¯\mathbb{R}^{V}\to\overline{\mathbb{R}}. Its minimisation can be reduced to linear optimisation, provided that each ¯\overline{\mathbb{R}}-valued constraint (k,σ,ρ)𝒞(k,\sigma,\rho)\in\mathcal{C} is given as follows: σ\sigma takes values in {±}\mathbb{Q}\cup\{\pm\infty\} and is given by a list as in Section 5.1, and ρ\rho is specified by a list 𝐰ρk\mathbf{w}^{\rho}\in\mathbb{Q}^{k}. Here, linear optimisation (also known as linear program) is the problem of minimising a linear function subject to a system of linear inequalities, and is one of the central problems in mathematical optimisation (e.g., [40]). We can see that 𝒪(I)\mathcal{O}(I) is equal to the value of the following optimisation problem.

minimiseαsubject toα_j=1kw_ρjs(x_j)σ(x_1,,x_k)((k,σ,ρ)𝒞,(x_1,,x_k)domσ),\displaystyle\begin{array}[]{lll}\text{minimise}&\alpha&\\ \text{subject to}&\alpha\geq\sum_{\_}{j=1}^{k}w^{\rho}_{\_}js(x_{\_}j)-\sigma(x_{\_}1,\dots,x_{\_}k)&((k,\sigma,\rho)\in\mathcal{C},\,(x_{\_}1,\dots,x_{\_}k)\in\operatorname{dom}\sigma),\end{array}

where the variables are s:Vs:V\rightarrow\mathbb{R} and α¯\alpha\in\overline{\mathbb{R}}. This is an instance of linear optimisation. Accordingly, it is solvable in polynomial time by a suitable linear optimisation algorithm (e.g., [36]).

References

  • [1]
  • [2] Libor Barto, Andrei Krokhin & Ross Willard (2017): Polymorphisms, and how to use them. In Andrei Krokhin & Stanislav Živný, editors: The Constraint Satisfaction Problem: Complexity and Approximability, Dagstuhl Follow-Ups 7, Schloss Dagstuhl–Leibniz-Zentrum für Informatik, pp. 1–44, 10.4230/DFU.Vol7.15301.1.
  • [3] S. Bistarelli, U. Montanari, F. Rossi, T. Schiex, G. Verfaillie & H. Fargier (1999): Semiring-based CSPs and valued CSPs: frameworks, properties, and comparison. Constraints 4, pp. 199–240, 10.1023/A:1026441215081.
  • [4] Stefano Bistarelli, Ugo Montanari & Francesca Rossi (1997): Semiring-based constraint satisfaction and optimization. Journal of the ACM 44, pp. 201–236, 10.1145/256303.256306.
  • [5] Manuel Bodirsky & Marcello Mamino (2017): Constraint satisfaction problems over numeric domains. In Andrei Krokhin & Stanislav Živný, editors: The Constraint Satisfaction Problem: Complexity and Approximability, 7, Schloss Dagstuhl–Leibniz-Zentrum für Informatik, pp. 79–111, 10.4230/DFU.Vol7.15301.79.
  • [6] Adrian Bondy & U.S.R. Murty (2008): Graph Theory. Springer-Verlag London.
  • [7] Lucas Bordeaux, Youssef Hamadi & Lintao Zhang (2006): Propositional satisfiability and constraint programming: a comparative survey. ACM Computing Surveys 38(4), 10.1145/1177352.1177354. Article 12.
  • [8] Andrei A. Bulatov (2006): A dichotomy theorem for constraint satisfaction problems on a 3-element set. Journal of the ACM 53(1), pp. 66–120, 10.1145/1120582.1120584.
  • [9] Andrei A. Bulatov (2017): A dichotomy theorem for nonuniform CSPs. In: Proceedings of the 58th IEEE Annual Symposium on Foundations of Computer Science, pp. 319–330, 10.1109/FOCS.2017.37.
  • [10] Andrei A. Bulatov, Peter Jeavons & Andrei A. Krokhin (2005): Classifying the complexity of constraints using finite algebras. SIAM Journal on Computing 34(3), pp. 720–742, 10.1137/S0097539700376676.
  • [11] Jin-Yi Cai & Xi Chen (2017): Complexity Dichotomies for Counting Problems. Cambridge University Press, 10.1017/9781107477063.
  • [12] David A. Cohen, Martin C. Cooper, Páidí Creed, Peter G. Jeavons & Stanislav Živný (2013): An algebraic theory of complexity for discrete optimization. SIAM Journal on Computing 42, pp. 1915–1939, 10.1137/130906398.
  • [13] Stephen A. Cook (1971): The complexity of theorem-proving procedures. In: Proceedings of the 3rd Annual ACM Symposium on Theory of Computing, pp. 151–158, 10.1145/800157.805047.
  • [14] Nadia Creignou, Sanjeev Khanna & Madhu Sudan (2001): Complexity Classifications of Boolean Constraint Satisfaction Problems. Society for Industrial and Applied Mathematics, Pennsylvania, USA, 10.1137/1.9780898718546.
  • [15] Rina Dechter (2003): Constraint Processing. Morgan Kaufmann, California, USA, 10.1016/B978-1-55860-890-0.X5000-2.
  • [16] Tomás Feder & Moshe Y. Vardi (1998): The computational structure of monotone monadic SNP and constraint satisfaction: A study through Datalog and group theory. SIAM Journal on Computing 28(1), pp. 57–104, 10.1137/S0097539794266766.
  • [17] Pavol Hell & Jaroslav Nesetril (2004): Graphs and Homomorphisms. Oxford University Press, 10.1093/acprof:oso/9780198528173.001.0001.
  • [18] John N. Hooker & W.-J. van Hoeve (2018): Constraint programming and operations research. Constraints 23, pp. 172–195, 10.1007/s10601-017-9280-3.
  • [19] Rostislav Horcík, Tommaso Moraschini & Amanda Vidal (2017): An algebraic approach to valued constraint satisfaction. In: 26th EACSL Annual Conference on Computer Science Logic (CSL 2017), Schloss Dagstuhl-Leibniz-Zentrum für Informatik, 10.4230/LIPIcs.CSL.2017.42.
  • [20] Peter Jeavons (1998): On the algebraic structure of combinatorial problems. Theoretical Computer Science 200(1-2), pp. 185–204, 10.1016/S0304-3975(97)00230-2.
  • [21] Peter Jeavons, David A. Cohen & Marc Gyssens (1997): Closure properties of constraints. Journal of the ACM 44(4), pp. 527–548, 10.1145/263867.263489.
  • [22] Sebastian Kerkhoff (2012): A general Galois theory for operations and relations in arbitrary categories. Algebra Universalis 68(3), pp. 325–352, 10.1007/s00012-012-0209-9.
  • [23] Krzysztof C. Kiwiel (2001): Convergence and efficiency of subgradient methods for quasiconvex minimization. Mathematical Programming 90, pp. 1–25, 10.1007/PL00011414.
  • [24] Andrei Krokhin, Jakub Opršal, Marcin Wrochna & Stanislav Živný (2020): Topology and adjunction in promise constraint satisfaction. arXiv:2003.11351v2.
  • [25] Philippe Laborie, Jérǒme Rogerie, Paul Shaw, & Petr Vilím (2018): IBM ILOG CP optimizer for scheduling. Constraints 23, pp. 210–250, 10.1007/s10601-018-9281-x.
  • [26] Richard E. Ladner (1975): On the structure of polynomial time reducibility. Journal of the ACM 22(1), pp. 155–171, 10.1145/321864.321877.
  • [27] F. William Lawvere (1973): Metric spaces, generalized logic, and closed categories. Rendiconti del seminario matématico e fisico di Milano XLIII, pp. 135–166, 10.1007/BF02924844. Also available online in Reprints in Theory and Applications of Categories, No. 1 (2001) pp. 1–37.
  • [28] F. William Lawvere (1984): State categories, closed categories, and the existence of semi-continuous entropy functions. IMA Preprint Series 86.
  • [29] Leonid Levin (1973): Universal search problems (in Russian). Problemy Peredachi Informatsii 9(3), pp. 115–116.
  • [30] Shinichi Mochizuki (2021): Inter-universal Teichmüller theory I: construction of Hodge theaters. Publications of the Research Institute for Mathematical Sciences 57(1), pp. 3–207, 10.4171/PRIMS/57-1-1.
  • [31] Reinhard Pöschel (1980): A General Galois Theory for Operations and Relations and Concrete Characterization of Related Algebraic Structures. Akademie der Wissenschaften der DDR Zentralinstitut für Mathematik und Mechanik. Report R-01/80.
  • [32] Kimmo I. Rosenthal (1991): Free quantaloids. Journal of Pure and Applied Algebra 72(1), pp. 67–82, 10.1016/0022-4049(91)90130-T.
  • [33] Kimmo I. Rosenthal (1996): The Theory of Quantaloids. Pitman Research Notes in Mathematics Series 348, CRC Press.
  • [34] Francesca Rossi, Peter van Beek & Toby Walsh, editors (2006): Handbook of Constraint Programming. Elsevier Science, New York, USA.
  • [35] Thomas J. Schaefer (1978): The complexity of satisfiability problems. In: Proceedings of the 10th annual ACM Symposium on Theory of Computing, pp. 216–226, 10.1145/800133.804350.
  • [36] Alexander Schrijver (1998): Theory of Linear and Integer Programming. John Wiley & Sons.
  • [37] David Speyer & Bernd Sturmfels (2009): Tropical mathematics. Mathematics Magazine 82(3), pp. 163–173, 10.1080/0025570X.2009.11953615.
  • [38] Isar Stubbe (2005): Categorical structures enriched in a quantaloid: categories, distributors and functors. Theory and Applications of Categories 14(1), pp. 1–45.
  • [39] Edward Tsang (1993): Foundations of Constraint Satisfaction. Academic Pr, London and San Diego.
  • [40] Robert J. Vanderbei (2020): Linear Programming, 5th edition. Springer International Publishing, 10.1007/978-3-030-39415-8.
  • [41] Dmitriy Zhuk (2020): A proof of the CSP dichotomy conjecture. Journal of the ACM 30, pp. 1–78, 10.1145/3402029.
  • [42] Stanislav Živný (2012): The Complexity of Valued Constraint Satisfaction Problems. Springer-Verlag Berlin Heidelberg, 10.1007/978-3-642-33974-5.