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

Tractability of Quantified Temporal Constraints To The Max

Manuel Bodirsky Institut für Algebra, TU Dresden, Germany [email protected] Hubie Chen Department of Computer Science, Birkbeck, University of London, Malet Street, London WC1E 7HX, United Kingdom [email protected]  and  Michał Wrona Theoretical Computer Science Department, Jagiellonian University, Poland [email protected]
Abstract.

A temporal constraint language is a set of relations that are first-order definable over (;<)({\mathbb{Q}};<). We show that several temporal constraint languages whose constraint satisfaction problem is maximally tractable are also maximally tractable for the more expressive quantified constraint satisfaction problem. These constraint languages are defined in terms of preservation under certain binary polymorphisms. We also present syntactic characterizations of the relations in these languages.

Key words and phrases:
Highly Set-Transitive Structures, Constraint Satisfaction Problems, Temporal Constraint Languages, Max-Closed Constraints, Quantified Constraint Satisfaction.
The research leading to the results presented here has also received funding from the European Research Council under the European Community’s Seventh Framework Program (FP7/2007-2013 Grant Agreement no. 257039
The author is supported by the Swedish Research Council (VR) under grant 621-2012-3239.

1. Introduction

For a fixed structure Γ\Gamma with finite relational signature τ\tau, the constraint satisfaction problem of  Γ\Gamma, denoted by CSP(Γ)\operatorname{CSP}(\Gamma), is the problem of deciding whether a given sentence of the form x1xn(ψ1ψm)\exists x_{1}\dots\exists x_{n}(\psi_{1}\wedge\dots\wedge\psi_{m}) is true in Γ\Gamma; here, each ψi\psi_{i} is an atomic τ\tau-sentence, that is, of the form R(y1,,yk)R(y_{1},\dots,y_{k}) for RτR\in\tau and y1,,yk{x1,,xn}y_{1},\dots,y_{k}\in\{x_{1},\dots,x_{n}\}. The given sentence is called an instance of CSP(Γ)\operatorname{CSP}(\Gamma), and the formulas ψi\psi_{i} are called the constraints of the instance. The set of relations of Γ\Gamma is called the constraint language of Γ\Gamma.

A very active research program attempts to classify the computational complexity of CSP(Γ)\operatorname{CSP}(\Gamma) for all finite structures Γ\Gamma; see e.g. the collection of survey articles [16]. Particularly interesting are structures Γ\Gamma that are maximally tractable; the idea is that those structures Γ\Gamma are the structures that sit at the frontier between the easy and the hard CSPs. The notion of maximal tractability also applies to structures Γ\Gamma with an infinite relational signature. We say that Γ\Gamma is maximally tractable for the CSP with respect to a class 𝒞\mathcal{C} of relations over the same domain (and in this case we also say that the constraint language of Γ\Gamma is maximally tractable) if

  • for every structure Γ\Gamma^{\prime} whose constraint language is finite and contained in the constraint language of Γ\Gamma, the problem CSP(Γ)\operatorname{CSP}(\Gamma^{\prime}) is in P, and

  • for every set of relations 𝒞{\mathcal{R}}\subseteq{\mathcal{C}} that properly contains the constraint language of Γ\Gamma there exists a structure Γ′′\Gamma^{\prime\prime} with a finite constraint language that is contained in \mathcal{R} such that CSP(Γ′′)\operatorname{CSP}(\Gamma^{\prime\prime}) is NP-hard.

Surprisingly often, when Γ\Gamma is maximally tractable for the CSP with respect to a class of relations, the more expressive quantified constraint satisfaction problem for Γ\Gamma, denoted by QCSP(Γ)\operatorname{QCSP}(\Gamma), can be solved in polynomial time as well. The problem QCSP(Γ)\operatorname{QCSP}(\Gamma) is defined analogously to CSP(Γ)\operatorname{CSP}(\Gamma), with the difference that, in addition to existential quantification, universal quantification is also permitted in the input. That is, an instance of QCSP(Γ)\operatorname{QCSP}(\Gamma) is a sentence of the form Q1v1Qnvn(ψ1ψm)Q_{1}v_{1}\dots Q_{n}v_{n}(\psi_{1}\wedge\dots\wedge\psi_{m}), for Q1,,Qn{,}Q_{1},\dots,Q_{n}\in\{\exists,\forall\}, to be evaluated in Γ\Gamma.

While one might expect that QCSP(Γ)\operatorname{QCSP}(\Gamma) is typically harder than CSP(Γ)\operatorname{CSP}(\Gamma), for the following structures Γ\Gamma both CSP(Γ)\operatorname{CSP}(\Gamma) and QCSP(Γ)\operatorname{QCSP}(\Gamma) are polynomial-time decidable:

  1. (1)

    2-element structures Γ\Gamma preserved by min\min or by max\max [20];

  2. (2)

    2-element structures Γ\Gamma preserved by the majority operation [1];

  3. (3)

    2-element structures Γ\Gamma preserved by the minority operation [15];

  4. (4)

    structures Γ\Gamma preserved by a near-unanimity operation [13];

  5. (5)

    structures Γ\Gamma preserved by a Maltsev operation [9];

  6. (6)

    structures Γ\Gamma that contain a unary relation UU for every subset of its domain, and CSP(Γ)\operatorname{CSP}(\Gamma) is tractable [5].

See [14] for a survey on the state of the art of complexity classification for QCSP(Γ)\operatorname{QCSP}(\Gamma) for finite structures Γ\Gamma.

Maximal tractability of a structure Γ\Gamma for the QCSP is defined analogously to maximal tractability of Γ\Gamma for the CSP. Note that if Γ\Gamma is maximally tractable for the CSP with respect to some class of relations 𝒞\mathcal{C}, and if for all structures Γ\Gamma^{\prime} whose constraint language is finite and contained in the constraint language of Γ\Gamma the problem QCSP(Γ)\operatorname{QCSP}(\Gamma^{\prime}) is in P as well, then Γ\Gamma^{\prime} is maximally tractable for the QCSP with respect to 𝒞\mathcal{C} as well. This is for instance the case for all the maximally tractable structures Γ\Gamma that appear in (1)-(6) above (each of those 6 items contains structures Γ\Gamma that are maximally tractable for the CSP with respect to the class of all relations over the same domain). If structures that are maximally tractable for the CSP are also maximally tractable for the QCSP, then this is interesting because it tells us that in this case the restriction to only existential quantifiers does not make a hard problem easy.

In this article we study this transfer of maximal tractability for the CSP to maximal tractability for the QCSP for structures Γ\Gamma with an infinite domain. One of the best-understood classes of infinite structures is the class of all highly set-transitive structures; these are the structures Γ\Gamma with the property that for all finite subsets AA, BB of equal size, there exists an automorphism of Γ\Gamma which sends AA to BB. By a theorem due to Cameron [10], this is the case if and only if Γ\Gamma is isomorphic to a structure with domain {\mathbb{Q}} whose relations are first-order definable over (;<)({\mathbb{Q}};<), i.e., for each relation RR of Γ\Gamma there is a first-order formula that defines RR over (;<)({\mathbb{Q}};<) (without parameters). In the context of constraint satisfaction, the constraint languages of highly set-transitive structures have also been called temporal constraint languages, since many problems in qualitative temporal reasoning can be formulated as CSP(Γ)\operatorname{CSP}(\Gamma) for such structures Γ\Gamma (see [7, 8] for examples). We refer to a relation having a first-order definition in (;<)({\mathbb{Q}};<) as a temporal relation. From now on, maximal tractability will be with respect to the class of all temporal relations over {\mathbb{Q}}.

The class of temporal constraint languages is very rich, and often provides examples and counterexamples for CSPs of infinite structures Γ\Gamma. For example, for finite structures Γ\Gamma it is known that CSP(Γ)\operatorname{CSP}(\Gamma) can be solved by Datalog if and only if the core of Γ\Gamma expanded by constants does not interpret primitively positively the structure (p;{(x,y,z)|xy+z=1})({\mathbb{Z}}_{p};\{(x,y,z)\;|\;x-y+z=1\}); this follows from the main result in [2] in combination with [17]. The same statement is false already for the simple structure (;{(x,y,z)|x>yx>z})({\mathbb{Q}};\{(x,y,z)\;|\;x>y\vee x>z\}), which does not interpret (p;{(x,y,z)|xy+z=1})({\mathbb{Z}}_{p};\{(x,y,z)\;|\;x-y+z=1\}) primitively positively with constants111Since it has the polymorphism f(x,y)=min(x,y)f(x,y)=\min(x,y) satisfying x,y(f(x,y)=f(y,x))\forall x,y(f(x,y)=f(y,x)); see [3] for an introduction to primitive positive interpretations and the related universal algebra., but which cannot be solved by Datalog; see [8]. The list of phenomena that are specific to infinite-domain constraint satisfaction and that are exemplified already for temporal constraint languages can be prolonged easily; we refer to [3] for more detail.

The complexity of CSP(Γ)\operatorname{CSP}(\Gamma) has been completely classified for structures Γ\Gamma with a temporal constraint language (due to [7]; also see [3]). In this paper we visit some of the CSP maximally tractable temporal constraint languages and study their QCSP\operatorname{QCSP}. For the languages that we study, we show that even the QCSP\operatorname{QCSP} is polynomial-time tractable. Our results are as follows.

  • When all relations of Γ\Gamma are preserved by the operation (x,y)min(x,y)(x,y)\mapsto\min(x,y), then QCSP(Γ)\operatorname{QCSP}(\Gamma) is in P.

  • When all relations in Γ\Gamma are preserved by the operation mx\operatorname{mx} (introduced in [7]), then QCSP(Γ)\operatorname{QCSP}(\Gamma) is in P. As with min\min, the operation mx\operatorname{mx} is binary and commutative; we repeat the definition in Section 3.3.

We complement those results by giving intuitive syntactic descriptions of the temporal relations that are preserved by min\min, and likewise of those that are preserved by mx\operatorname{mx}. That is, we present a class of syntactically restricted first-order formulas with the property that a temporal relation is preserved by min if and only if it has a definition by a formula from the class, and likewise for mx\operatorname{mx}. Those characterizations are important since they give a more explicit description of the allowed constraints in the respective QCSPs. A similar syntactic description of relations over finite domains preserved by min\min can be found in [19].

The results that we present for temporal constraint languages preserved by min\min also hold in analogous form for those that are preserved by max\max. The operations min\min and max\max are dual in the following sense: max(x,y)=min(x,y)\max(x,y)=-\min(-x,-y). Similarly, the operation mx\operatorname{mx} has the dual operation (x,y)mx(x,y)(x,y)\mapsto-\operatorname{mx}(-x,-y), and again the results that we have obtained for mx\operatorname{mx} also hold analogously for the dual of mx\operatorname{mx}.

2. Temporal Constraint Languages

Let f:DkDf\colon D^{k}\rightarrow D be a function. When t1=(t11,,tm1),,tk=(t1k,,tmk)Dmt^{1}=(t^{1}_{1},\dots,t^{1}_{m}),\dots,t^{k}=(t^{k}_{1},\dots,t^{k}_{m})\in D^{m}, then f(t1,,tk)f(t^{1},\dots,t^{k}) denotes the tuple (f(t11,,t1k),,f(tm1,,tmk))(f(t_{1}^{1},\dots,t^{k}_{1}),\dots,f(t_{m}^{1},\dots,t^{k}_{m})) from DmD^{m} that we obtain by applying ff componentwise. A function f:DkDf\colon D^{k}\rightarrow D preserves a relation RDmR\subseteq D^{m} if for all t1,,tkRt^{1},\dots,t^{k}\in R it holds that f(t1,,tk)Rf(t^{1},\dots,t^{k})\in R. If ff preserves all relations of a structure Γ\Gamma, we say that ff is a polymorphism of Γ\Gamma.

Example. The operation min:2\min\colon{\mathbb{Q}}^{2}\rightarrow{\mathbb{Q}} that maps two rational numbers to the minimum of the two numbers is a polymorphism of the temporal constraint language (;,<)({\mathbb{Q}};\leq,<), but not of the temporal constraint language (;)({\mathbb{Q}};\neq), since it maps for instance the tuples (1,0)(1,0)\in\mathop{\neq} and (0,1)(0,1)\in\mathop{\neq} to (0,0)(0,0)\notin\mathop{\neq}.

See Figure 1 for an illustration of the operation min\min. In diagrams for binary operations ff as in Figure 3, we draw a directed edge from (a,b)(a,b) to (a,b)(a^{\prime},b^{\prime}) if f(a,b)<f(a,b)f(a,b)<f(a^{\prime},b^{\prime}). Unoriented lines in rows and columns of picture for an operation ff relate pairs of values that get the same value under ff.

Refer to caption
Figure 1. Illustration of the operation min\min.

A non-trivial relation that is preserved by min\min is the ternary relation defined by the formula x1>x2x1>x3x_{1}>x_{2}\vee x_{1}>x_{3}, and the ternary relation UU defined as follows.

U(x,y,z)\displaystyle U(x,y,z)\;\equiv\; (x=yy<z)\displaystyle(x=y\wedge y<z)
\displaystyle\vee\; (x=zz<y)\displaystyle(x=z\wedge z<y)
\displaystyle\vee\; (x=yy=z)\displaystyle(x=y\wedge y=z)

Another important operation for temporal constraint satisfaction is the binary operation ‘mx’, which is defined as follows [7].

mx(x,y):={α(min(x,y))if xyβ(x)if x=y\text{mx}(x,y):=\left\{\begin{array}[]{l l l}\alpha(\min(x,y))&\text{if }x\neq y\\ \beta(x)&\text{if }x=y\end{array}\right.

where α\alpha and β\beta are unary operations that preserve << such that α(x)<β(x)<α(x+ε)\alpha(x)<\beta(x)<\alpha(x+\varepsilon) for all xx\in\mathbb{Q} and all 0<ε0<\varepsilon\in\mathbb{Q} (see Figure 2). It is not difficult to show that such operations α,β\alpha,\beta do exist; see [7].

Refer to caption
Figure 2. Illustration of the operation mx\operatorname{mx}.

Note that mx does not preserve the relation \leq. It also does not preserve the relation UU introduced above. An example of a relation that is preserved by mx is the ternary relation XX defined as follows.

X(x,y,z)\displaystyle X(x,y,z)\;\equiv\; (x=yy<z)\displaystyle(x=y\wedge y<z)
\displaystyle\vee\; (x=zz<y)\displaystyle(x=z\wedge z<y)
\displaystyle\vee\; (y=zy<x)\displaystyle(y=z\wedge y<x)

Finally, let pp\operatorname{pp} be an arbitrary binary operation on \mathbb{Q} such that pp(a,b)pp(a,b)\operatorname{pp}(a,b)\leq\operatorname{pp}(a^{\prime},b^{\prime}) iff one of the following cases applies:

  • a0a\leq 0 and aaa\leq a^{\prime}

  • 0<a0<a, 0<a0<a^{\prime}, and bbb\leq b^{\prime}.

Clearly, such an operation exists. For an illustration, see the left diagram in Figure 3. The right diagram of Figure 3 is an illustration of the dualpp\operatorname{dual-pp} operation. The name of the operation pp\operatorname{pp} is derived from the word ‘projection-projection’, since the operation behaves as a projection to the first argument for negative first argument, and a projection to the second argument for positive first argument.

Refer to caption
Refer to caption
Figure 3. A visualization of pp\operatorname{pp} (left) and dualpp\operatorname{dual-pp} (right).

The following two propositions have been shown in [7].

Proposition 2.1 ([7]).

Let R1,,RkR_{1},\dots,R_{k} be temporal relations that are preserved by min (respectively, mx). Then CSP(;R1,,Rk)\operatorname{CSP}({\mathbb{Q}};R_{1},\dots,R_{k}) is in P.

Proposition 2.2 ([7]).

Let RR be a relation with a first-order definition in (;<)(\mathbb{Q};<) that is not preserved by min (respectively, mx). Then there exists a finite set of temporal relations R1,,RkR_{1},\dots,R_{k} preserved by min (respectively, mx) such that CSP(;R,R1,,Rk)\operatorname{CSP}({\mathbb{Q}};R,R_{1},\dots,R_{k}) is NP-hard.

A straightforward corollary of Proposition 2.1 and Proposition 2.2 is that the sets of temporal relations preserved by min\min and by mx\operatorname{mx}, respectively, are maximally tractable constraint languages.

The set of temporal relations that is preserved by min\min is a proper subset of the set of temporal relations that is preserved by pp\operatorname{pp} (see [7]); e.g., the relation {(x,y,z)3|(x=yy<z)(x>yy=z)}\{(x,y,z)\in{\mathbb{Q}}^{3}\;|\;(x=y\wedge y<z)\vee(x>y\wedge y=z)\} is preserved by pp\operatorname{pp}, but not by min\min and not by mx\operatorname{mx}. Indeed, the CSP for the temporal constraint language that just contains this ternary relation is NP-hard.

3. Syntactic Characterizations

It is known that the structure (;<)({\mathbb{Q}};<) has quantifier-elimination [18], that is, for every first-order formula ϕ\phi there exists a quantifier-free formula that is equivalent to ϕ\phi over (;<)({\mathbb{Q}};<) (we always allow equality == in our formulas). We will call such a quantifier-free formula over the signature {<}\{<\} a temporal formula. For the sake of presentation, we write temporal formulas using all symbols in {<,>,,,=,}\{<,>,\leq,\geq,=,\neq\}. Let ϕR\phi_{R} be a temporal formula that defines a temporal relation RR. For a tuple tRt\in R and a variable vv occurring in ϕR\phi_{R}, we write t(v)t(v) to indicate the value in tt corresponding to the variable vv.

It is also well-known that (;<)({\mathbb{Q}};<) is a homogeneous structure [21], that is, every isomorphism between finite substructures extends to an automorphism. The set of automorphisms of (;<)({\mathbb{Q}};<) will be denoted by Aut(;<)\operatorname{Aut}({\mathbb{Q}};<). A set of the form {α(t1),,α(tk)αAut(;<)}\{\alpha(t_{1}),\ldots,\alpha(t_{k})\mid\alpha\in\operatorname{Aut}({\mathbb{Q}};<)\} is called an orbit of kk-tuples (the orbit of (t1,,tk)(t_{1},\ldots,t_{k})). It is well known that every kk-ary temporal relation is a union of orbits of kk-tuples.

Let ϕ1\phi_{1} and ϕ2\phi_{2} be two temporal formulas. We say that ϕ1\phi_{1} entails ϕ2\phi_{2} if and only if (;<)v1,,vn(ϕ1ϕ2)({\mathbb{Q}};<)\models\forall v_{1},\dots,v_{n}(\phi_{1}\Rightarrow\phi_{2}). We also say that an nn-ary temporal relation RR entails ϕ\phi if and only if (;<)v1,,vn(ϕR(v1,vn)ϕ)({\mathbb{Q}};<)\models\forall v_{1},\dots,v_{n}(\phi_{R}(v_{1},\ldots v_{n})\Rightarrow\phi), where ϕR\phi_{R} is a temporal formula defining RR. We will use the following fact, which follows directly from the definition of entailment.

Observation 3.1.

Let ϕR:=Φψ\phi_{R}:=\Phi\wedge\psi be a temporal formula defining a temporal relation RR and ψ\psi^{\prime} a temporal formula entailed by RR which entails ψ\psi. Then ϕR:=Φψ\phi^{\prime}_{R}:=\Phi\wedge\psi^{\prime} also defines RR.

3.1. Characterization of pp\operatorname{pp}-closed Relations

Theorem 3.2.

A temporal relation RR is preserved by pp\operatorname{pp} if and only if it can be defined as a conjunction of clauses of the form

(1) xy1xykxz1xzl,x\neq y_{1}\vee\cdots\vee x\neq y_{k}\vee x\geq z_{1}\vee\cdots\vee x\geq z_{l},

where it is permitted that l=0l=0 or k=0k=0, in which cases the clause is a disjunction of disequalities or contains no disequalities, respectively.

To provide the proof we fix nn, and consider a temporal relation of arity nn. All the temporal formulas considered in the proof of Theorem 3.2 are meant to have all variables in {v1,,vn}\{v_{1},\ldots,v_{n}\}. In particular we take advantage of temporal formulas of the form:

(2) ¬(x11x2xk1k1xk),\neg(x_{1}\circ_{1}x_{2}\wedge\cdots\wedge x_{k-1}\circ_{k-1}x_{k}),

where x1,,xk{v1,,vn}x_{1},\ldots,x_{k}\in\{v_{1},\ldots,v_{n}\} are pairwise different and every i\circ_{i} is in {<,=}\{<,=\}. We focus on formulas of the form (2) that satisfy an extra condition that we call the unambiguity condition which states that if (vi=vj)(v_{i}=v_{j}) occurs in ϕ\phi, then i<ji<j. Let ΦR\Phi_{R} be the set containing all temporal formulas ϕ\phi over variables {v1,,vn}\{v_{1},\ldots,v_{n}\} of the form (2) entailed by RR that satisfy the unambiguity condition. We will now argue that ΦR\bigwedge\Phi_{R} defines RR. Observe first that for every orbit of nn-tuples in Aut(;<)\operatorname{Aut}({\mathbb{Q}};<), there is the negation ϕ\phi of a formula of the form (2) that defines this orbit. We can certainly assume that ϕ\phi is over variables {v1,,vn}\{v_{1},\ldots,v_{n}\} and satisfies the unambiguity condition. On the other hand, to see that every such ϕ\phi defines exactly one orbit observe that any two tuples t:=(t1,,tn)t:=(t_{1},\ldots,t_{n}) and t:=(t1,,tn)t^{\prime}:=(t^{\prime}_{1},\ldots,t^{\prime}_{n}) that are in the relation defined by ϕ\phi induce isomorphic substructures in (;<)({\mathbb{Q}};<). By the homogeneity of (;<)({\mathbb{Q}};<), an isomorphism between such substructures can be extended to an automorphism of (;<)({\mathbb{Q}};<). It follows that every orbit may be defined by the negation ϕ\phi of a formula of the form (2). We are now ready to prove that RR^{\prime} defined by ΦR\bigwedge\Phi_{R} is equal to RR. By the definition of RR^{\prime} we have that RRR\subseteq R^{\prime}. On the other hand if there is an orbit in Aut(;<)\operatorname{Aut}({\mathbb{Q}};<) which is not in RR, then an appropriate formula of the form (2) is entailed by RR. Thus RR^{\prime} does not contain the orbit as well. Hence we obtain that ΦR\bigwedge\Phi_{R} defines RR.

Finally, we define an order on ΦR\Phi_{R}. For ϕ1,ϕ2ΦR\phi_{1},\phi_{2}\in\Phi_{R} of the form ¬(x11x2xk1k1xk)\neg(x_{1}\circ_{1}x_{2}\wedge\cdots\wedge x_{k-1}\circ_{k-1}x_{k}) and ¬(y11y2yl1l1yl)\neg(y_{1}\circ_{1}y_{2}\wedge\cdots\wedge y_{l-1}\circ_{l-1}y_{l}), respectively, we will say that ϕ1\phi_{1} is less than ϕ2\phi_{2}, in symbols ϕ1ϕ2\phi_{1}\preceq\phi_{2}, if x1,,xkx_{1},\ldots,x_{k} is a subsequence of y1,,yly_{1},\ldots,y_{l} and ϕ1\phi_{1} entails ϕ2\phi_{2}. It is easy to see that this relation is reflexive and transitive. By the definition of ΦR\Phi_{R}, we have that two formulas ϕ1,ϕ2ΦR\phi_{1},\phi_{2}\in\Phi_{R} with the same set of variables entail each other if and only if they are the same formula. Hence, (ΦR;)(\Phi_{R};\preceq) is also antisymmetric, and we have defined a partial order on ΦR\Phi_{R}. Let ΦRm\Phi_{R}^{m} be the set of minimal elements of (ΦR;)(\Phi_{R};\preceq). By Observation 3.1, it holds that ΦRm\bigwedge\Phi^{m}_{R} defines RR.

Proof.

To prove the right-to-left implication, it is certainly enough to show that every relation RCR_{C} defined by a single clause CC of the form (1) is preserved by pp\operatorname{pp}. Assume on the contrary that there are t1,t2RCt_{1},t_{2}\in R_{C} but t3=pp(t1,t2)t_{3}=\operatorname{pp}(t_{1},t_{2}) is not in RCR_{C}. It implies that t3(x)=t3(y1)==t3(yk)t_{3}(x)=t_{3}(y_{1})=\cdots=t_{3}(y_{k}), and hence by the definition of pp\operatorname{pp} it holds that t1(x)=t1(y1)==t1(yk)t_{1}(x)=t_{1}(y_{1})=\cdots=t_{1}(y_{k}) or t2(x)=t2(y1)==t2(yk)t_{2}(x)=t_{2}(y_{1})=\cdots=t_{2}(y_{k}). In the first case, t1(x)0t_{1}(x)\leq 0 and since for at least one zjz_{j} we have that t1(zj)t1(x)t_{1}(z_{j})\leq t_{1}(x), it follows that t3(zj)t3(x)t_{3}(z_{j})\leq t_{3}(x). Otherwise, we have that t1(x)>0t_{1}(x)>0. Again, for at least one zjz_{j} it holds that t2(zj)t2(x)t_{2}(z_{j})\leq t_{2}(x). It follows that t3(zj)t3(x)t_{3}(z_{j})\leq t_{3}(x). Thus, every clause of the form (1) is preserved by pp\operatorname{pp}.

We now show that every temporal relation RR preserved by pp\operatorname{pp} may be defined as a conjunction of clauses of the desired form. Recall that ΦRm\bigwedge\Phi_{R}^{m} defines RR. We will obtain the desired definition of RR by replacing every member ϕ\phi of ΦRm\Phi_{R}^{m}, which is of the form (2), with a clause of the form (1). If ϕ\phi is ¬(x=y1yk1=yk)\neg(x=y_{1}\wedge\cdots\wedge y_{k-1}=y_{k}), then we replace it by (xy1xyk)(x\neq y_{1}\vee\cdots\vee x\neq y_{k}). Since these formulas are equivalent, the transformation does not change the defined relation.

Otherwise, ϕ\phi contains at least one occurrence of << and hence we can assume that ϕ\phi is of the form:

¬(x=y1yk1=ykyk<z1z11z2zl1l1zl),\neg(x=y_{1}\wedge\cdots\wedge y_{k-1}=y_{k}\wedge y_{k}<z_{1}\wedge z_{1}\circ_{1}z_{2}\wedge\cdots\wedge z_{l-1}\circ_{l-1}z_{l}),

where every i\circ_{i} is in {=,<}\{=,<\}. Here we will consider two cases. The first is where RR contains no tuple tt satisfying t(x)=t(y1)==t(yk)<t(zi)t(x)=t(y_{1})=\cdots=t(y_{k})<t(z_{i}) for all i[l]i\in[l]. Observe that in this case RR entails ψ\psi equal to (xy1xykxz1xzl)(x\neq y_{1}\vee\cdots\vee x\neq y_{k}\vee x\geq z_{1}\vee\cdots\vee x\geq z_{l}). It is easy to verify that ψ\psi entails ϕ\phi. Hence, by Observation 3.1, it follows that we can safely replace ϕ\phi by ψ\psi in ΦRm\Phi^{m}_{R}.

If RR contains a tuple tt satisfying t(x)=t(y1)==t(yk)<t(zi)t(x)=t(y_{1})=\cdots=t(y_{k})<t(z_{i}) for all i[l]i\in[l], then, as we show, RR is not preserved by pp\operatorname{pp}. This leads to a contradiction with the assumption. Consider a formula θ\theta equal to ¬(z11z2zl1l1zl)\neg(z_{1}\circ_{1}z_{2}\wedge\cdots\wedge z_{l-1}\circ_{l-1}z_{l}). We have θϕ\theta\preceq\phi. Since ϕ\phi is in ΦRm\Phi^{m}_{R}, it follows that θ\theta is not in ΦR\Phi_{R}, and hence not entailed by RR. It implies that RR contains a tuple t1t_{1} satisfying (z11z2zl1l1zl)(z_{1}\circ_{1}z_{2}\wedge\cdots\wedge z_{l-1}\circ_{l-1}z_{l}). Let α\alpha be automorphisms of (;<)({\mathbb{Q}};<) such that α(t(x))<0<α(t(zi))\alpha(t(x))<0<\alpha(t(z_{i})) for all i[l]i\in[l]. Then t2=pp(α(t),t1)t_{2}=\operatorname{pp}(\alpha(t),t_{1}) satisfies ¬ϕ\neg\phi. Since ϕ\phi is entailed by RR, it follows t2Rt_{2}\notin R, and thus that RR is not preserved by pp\operatorname{pp}. ∎

3.2. Characterization of min\min-closed Relations

Theorem 3.3.

A temporal relation RR is preserved by min\min if and only if it can be defined as a conjunction of clauses of the form

(3) x1z1xlzl,x\circ_{1}z_{1}\vee\cdots\vee x\circ_{l}z_{l},

where for all i[l]i\in[l], we have that i\circ_{i} is in {,>}\{\geq,>\}.

Proof.

Observe that to prove the left-to-right implication, it is enough to show that every relation RCR_{C} defined by a single clause CC of the form (3) is preserved by min\min. Let t1,t2t_{1},t_{2} be some tuples in RR and t3=min(t1,t2)t_{3}=\min(t_{1},t_{2}). Then t1,t2t_{1},t_{2} satisfy xizix\circ_{i}z_{i}, and xjzjx\circ_{j}z_{j} for some i,j[l]i,j\in[l], respectively. We consider two cases. Assume first that t1(zi)=t2(zj)t_{1}(z_{i})=t_{2}(z_{j}). Here, it is easy to see that t3(x)t3(zi)t_{3}(x)\geq t_{3}(z_{i}) and t3(x)t3(zj)t_{3}(x)\geq t_{3}(z_{j}). Thus if either i\circ_{i} or j\circ_{j} is \geq, then we are done. Otherwise, it holds that t1(x)>t1(zi)t_{1}(x)>t_{1}(z_{i}) and t2(x)>t2(zj)t_{2}(x)>t_{2}(z_{j}). It follows that t3(x)t_{3}(x) is greater than both t3(zi)t_{3}(z_{i}) and t3(zj)t_{3}(z_{j}). This settles the case where t1(zi)=t2(zj)t_{1}(z_{i})=t_{2}(z_{j}). Assume now without loss of generality that t1(zi)<t2(zj)t_{1}(z_{i})<t_{2}(z_{j}). Observe that t3(zi)t3(x)t_{3}(z_{i})\leq t_{3}(x). Thus we are done when i\circ_{i} is \leq. Otherwise we have that t1(zi)<t1(x)t_{1}(z_{i})<t_{1}(x) and that t1(zi)<t2(zj)t2(x)t_{1}(z_{i})<t_{2}(z_{j})\leq t_{2}(x). It follows that t3(zi)<t3(x)t_{3}(z_{i})<t_{3}(x). It completes the proof of the left-to-right implication.

We now turn to prove the reverse implication. Assume that there is some relation RR preserved by min\min that cannot be defined by a conjunction of clauses of the form (3). By Lemma 23 in [7], we have that every relation preserved by min\min is also preserved by pp\operatorname{pp}. Hence, by Theorem 3.2, the relation RR may be defined as a conjunction of clauses of the form

(4) xy1xykx1z1xlzl,x\neq y_{1}\vee\cdots\vee x\neq y_{k}\vee x\circ_{1}z_{1}\vee\cdots\vee x\circ_{l}z_{l},

where i{>,}\circ_{i}\in\{>,\geq\} for every i[l]i\in[l]. Consider the set of such definitions of RR with a minimal number of disequalities and from this set choose one with a minimal number of literals. Denote that formula by ϕR\phi_{R}.

If ϕR\phi_{R} does not have any disequalities, then we are done. Otherwise it contains a clause CC of the form (4) with at least one disequality (xy1)(x\neq y_{1}). Since ϕR\phi_{R} does not contain any unnecessary literals, there is a tuple in RR that falsifies all literals in CC except for (xy1)(x\neq y_{1}). Suppose that RR contains both tuples t1,t2t_{1},t_{2} that falsify all literals in CC except for (xy1)(x\neq y_{1}) and satisfy (x<y1)(x<y_{1}) and (x>y1)(x>y_{1}), respectively. Let α1\alpha_{1} be an automorphism of (;<)({\mathbb{Q}};<) that sends (t1(x),t1(y1))(t_{1}(x),t_{1}(y_{1})) to (0,1)(0,1), and α2\alpha_{2} an automorphism of (;<)({\mathbb{Q}};<) that sends (t2(x),t2(y1))(t_{2}(x),t_{2}(y_{1})) to (1,0)(1,0). Observe that t3=min(α1(t1),α2(t2))t_{3}=\min(\alpha_{1}(t_{1}),\alpha_{2}(t_{2})) satisfies (x=y1)(x=y_{1}). Since min\min preserves ==, \leq, and <<, we have that t3t_{3} falsifies all literals in CC, hence we have a contradiction with the fact that RR is preserved by min\min. It follows that RR does not have either t1t_{1} or t2t_{2}. If RR does not contain t1t_{1}, then in ϕR\phi_{R} we can replace CC by (x>y1xy2xykx1z1xlzl)(x>y_{1}\vee x\neq y_{2}\vee\cdots\vee x\neq y_{k}\vee x\circ_{1}z_{1}\vee\cdots\vee x\circ_{l}z_{l}) obtaining a definition of RR guaranteed by Theorem 3.2 with a smaller number of disequalities. From now on we can therefore assume that RR contains t1t_{1}.

Consider now the formula ϕR\phi^{\prime}_{R} obtained from ϕR\phi_{R} by replacing the clause CC by the clause C:=(y1xy1y2y1yky11z1y1lzl)C^{\prime}:=(y_{1}\neq x\vee y_{1}\neq y_{2}\vee\cdots\vee y_{1}\neq y_{k}\vee y_{1}\circ_{1}z_{1}\vee\cdots\vee y_{1}\circ_{l}z_{l}). Observe that CC and CC^{\prime} entail each other. Hence ϕR\phi^{\prime}_{R} also defines RR. Consider CC^{\prime} as a part of ϕR\phi^{\prime}_{R} and observe that no literal from CC^{\prime} can be removed. Indeed, the new definition would have less disequlities or the same number of disequalities and less literals than ϕR\phi_{R}. Thus RR contains a tuple tt^{\prime} that satisfies all disjuncts of CC^{\prime} except for (y1x)(y_{1}\neq x). As in the previous papragraph, we argue that RR cannot have both tuples t1t^{\prime}_{1}, and t2t^{\prime}_{2} that falsify all literals in CC^{\prime} except for (xy1)(x\neq y_{1}) and satisfy (y1<x)(y_{1}<x) and (y1>x)(y_{1}>x), respectively. If RR does not contain t1t^{\prime}_{1}, then in ϕR\phi^{\prime}_{R} we can replace CC^{\prime} by (y1>xy1y2y1yky11z1y1lzl)(y_{1}>x\vee y_{1}\neq y_{2}\vee\cdots\vee y_{1}\neq y_{k}\vee y_{1}\circ_{1}z_{1}\vee\cdots\vee y_{1}\circ_{l}z_{l}) obtaining a definition of RR in the form guaranteed by Theorem 3.2 with a smaller number of disequalities. Thus, we can assume that RR contains t1t^{\prime}_{1}.

Now, suppose towards the contradiction that RR has both: t1t_{1} that falsifies all disjuncts of CC except for (xy1)(x\neq y_{1}) and satisfies (x<y1)(x<y_{1}); and t1t^{\prime}_{1} that falsifies all disjuncts of CC^{\prime} except for (y1x)(y_{1}\neq x) and satisfies (y1<x)(y_{1}<x). Let α,α\alpha,\alpha^{\prime} be automorphisms of Aut(;<)\operatorname{Aut}({\mathbb{Q}};<) such that α\alpha sends (t1(x),t1(y1))(t_{1}(x),t_{1}(y_{1})) to (0,1)(0,1) and α\alpha^{\prime} sends (t1(x),t1(y1))(t^{\prime}_{1}(x),t^{\prime}_{1}(y_{1})) to (1,0)(1,0). To complete the proof we will show that t4=min(α(t1),α(t1))t_{4}=\min(\alpha(t_{1}),\alpha^{\prime}(t^{\prime}_{1})) falsifies all disjuncts of CC. Since both t1t_{1} and t1t^{\prime}_{1} are in RR, we obtain a contradiction to the assumption that RR is preserved by min\min. Since α(t1(x))=α(t1(y2))==α(t1(yk))=0\alpha(t_{1}(x))=\alpha(t_{1}(y_{2}))=\cdots=\alpha(t_{1}(y_{k}))=0 and α(t1(y1))=α(t1(y2))==α(t1(yk))=0\alpha^{\prime}(t^{\prime}_{1}(y_{1}))=\alpha^{\prime}(t^{\prime}_{1}(y_{2}))=\cdots=\alpha^{\prime}(t^{\prime}_{1}(y_{k}))=0, it follows that t4(x)=t4(y1)==t4(yk)=0t_{4}(x)=t_{4}(y_{1})=\cdots=t_{4}(y_{k})=0 and hence t4t_{4} falsifies all disequalities in CC. Now, the clause CC contains a disjunct (xizi)(x\circ_{i}z_{i}) with i{>,}\circ_{i}\in\{>,\geq\} and i[k]i\in[k] if and only if CC^{\prime} contains (y1izi)(y_{1}\circ_{i}z_{i}). Assume that i\circ_{i} is >>. The same argument will work for \geq. Observe that α(t1)\alpha(t_{1}) satisfies (xzi)(x\leq z_{i}) and sends xx to 0; and that α(t1)\alpha^{\prime}(t^{\prime}_{1}) satisfies (y1zi)(y_{1}\leq z_{i}) and sends y1y_{1} to 0. It follows that t4(x)0t4(zi)t_{4}(x)\leq 0\leq t_{4}(z_{i}). Thus t4t_{4} falsifies (x<zi)(x<z_{i}) and we are done. ∎

Example. According to Theorem 3.3, the relation UU from Section 2 can be defined by a conjunction of clauses of the form 3. Indeed, observe that ((xyxz)yxzx)((x\geq y\vee x\geq z)\wedge y\geq x\wedge z\geq x) defines UU.

3.3. Characterization of mx\operatorname{mx}-closed relations

Let us say that a boolean relation S{0,1}nS\subseteq\{0,1\}^{n} is near-affine if it holds that S{(1,,1)}S\cup\{(1,\ldots,1)\} is preserved by the operation a(x,y)=xy1a(x,y)=x\oplus y\oplus 1. Let us say that a formula ϕ\phi is min-affine if there exists a near-affine relation T{0,1}nT\subseteq\{0,1\}^{n} such that ϕ\phi is of the form

tT((i,j:ti=tj=0xi=xj)(i,j:ti=0,tj=1xi<xj))\bigvee_{t\in T}\big{(}(\bigwedge_{i,j:t_{i}=t_{j}=0}x_{i}=x_{j})\wedge(\bigwedge_{i,j:t_{i}=0,t_{j}=1}x_{i}<x_{j})\big{)}

where x1,,xnx_{1},\ldots,x_{n} are variables; here, the formula ϕ\phi is intended to be interpreted over the ordered rationals.

Theorem 3.4.

A temporal relation RkR\subseteq{\mathbb{Q}}^{k} is preserved by mx\operatorname{mx} if and only if it is definable by a formula ϕ(v1,,vk)\phi(v_{1},\ldots,v_{k}) that is the conjunction of min-affine formulas, each of which is over a subset of {v1,,vk}\{v_{1},\ldots,v_{k}\}.

For a tuple b=(b1,,bn)nb=(b_{1},\ldots,b_{n})\in{\mathbb{Q}}^{n}, we define the min-tuple of bb to be the tuple t=(t1,,tn){0,1}nt=(t_{1},\ldots,t_{n})\in\{0,1\}^{n} such that ti=0t_{i}=0 if and only if bib_{i} is the minimum value in {b1,,bn}\{b_{1},\ldots,b_{n}\}; note that the min-tuple of a {\mathbb{Q}}-tuple of nontrivial arity always contains at least one entry equal to 0. Observe also that a tuple bnb\in{\mathbb{Q}}^{n} is in the relation defined by a min-affine formula if and only if the min-tuple of bb is in TT.

We remark that we permit the empty conjunction of min-affine formulas, which we consider to be true, and we also permit min-affine formulas where the near-affine relation TT is empty, which formulas are considered to be false.

Proof.

For the right-to-left direction, it suffices to show that the claim holds in the case that ϕ\phi is defined by a single min-affine formula. So suppose that ϕ\phi is of the form described above, with respect to T{0,1}nT\subseteq\{0,1\}^{n}. Let b=(b1,,bn)b=(b_{1},\ldots,b_{n}), b=(b1,,bn)b^{\prime}=(b^{\prime}_{1},\ldots,b^{\prime}_{n}) be two tuples in n{\mathbb{Q}}^{n} that satisfy ϕ\phi. Let t,tTt,t^{\prime}\in T be the min-tuples of b,bb,b^{\prime}, respectively; so, t,tt,t^{\prime} witness that b,bb,b^{\prime} satisfy ϕ\phi. Let m,mm,m^{\prime} denote the minimum values in the tuples b,bb,b^{\prime}, respectively.

We consider two cases.

Case m=mm=m^{\prime}. If t=tt=t^{\prime}, then the tuple mx(b,b)\operatorname{mx}(b,b^{\prime}) is witnessed to satisfy ϕ\phi via the tuple t=tt=t^{\prime}; this can be verified by the definition of mx\operatorname{mx}. If ttt\neq t^{\prime}, then we claim that the tuple mx(b,b)\operatorname{mx}(b,b^{\prime}) is witnessed to satisfy ϕ\phi via the tuple tt1t\oplus t^{\prime}\oplus 1. First, observe that tt1t\oplus t^{\prime}\oplus 1 is contained in T{(1,,1)}T\cup\{(1,\ldots,1)\} by the assumption that this relation is preserved by the operation aa; since ttt\neq t^{\prime}, it holds that tt1t\oplus t^{\prime}\oplus 1 is not equal to (1,,1)(1,\ldots,1) and is thus contained in TT. Next, it is straightforwardly verified from the definition of mx\operatorname{mx} that mx(b,b)\operatorname{mx}(b,b^{\prime}) takes on its minimum value at exactly the coordinates where one of b,bb,b^{\prime} takes on its minimum value and the other does not, which are precisely the coordinates where tt1t\oplus t^{\prime}\oplus 1 is equal to 0.

Case mmm\neq m^{\prime}. We assume for the sake of notation that m<mm<m^{\prime}. In this case, the minimum entries among all entries in bb and bb^{\prime} are the entries in bb that have value mm. It follows from the definition of mx\operatorname{mx} that mx(b,b)\operatorname{mx}(b,b^{\prime}) takes on its minimum value at exactly the coordinates where bb does so, and hence the tuple mx(b,b)\operatorname{mx}(b,b^{\prime}) satisfies ϕ\phi via the tuple tTt\in T.

For the left-to-right direction, we proceed by induction on the arity kk of the relation RkR\subseteq{\mathbb{Q}}^{k}. The case k=0k=0 is verified as follows: if RR is empty, then take the empty conjunction; if RR is non-empty, then take the conjunction consisting of the single min-affine formula on no variables with T=T=\emptyset. In what follows, we assume that k>0k>0. Let ϕ\phi be the conjunction of all min-affine formulas that are entailed by R(v1,,vk)R(v_{1},\ldots,v_{k}). Suppose that b=(b1,bk)kb=(b_{1},\ldots b_{k})\in{\mathbb{Q}}^{k} satisfies ϕ\phi. Our goal is to show bRb\in R. Let t{0,1}kt\in\{0,1\}^{k} be the min-tuple of bb.

We claim that there is a tuple cRc\in R with min-tuple tt. Let T{0,1}kT\in\{0,1\}^{k} be the set of min-tuples of tuples in RR. It follows directly from (Lemma 28 of [7]) that if s,sTs,s^{\prime}\in T, then ss1T{(1,,1)}s\oplus s^{\prime}\oplus 1\in T\cup\{(1,\ldots,1)\}. From this implication, it is straightforward to verify that TT is near-affine. Hence, the conjunction ϕ\phi contains as a conjunct a min-affine formula α\alpha with relation TT. Since bb satisfies α\alpha, it follows that tTt\in T, from which the claim follows.

If t=(0,,0)t=(0,\ldots,0), then cRc\in R and bb are both constant tuples. Since bb is equal to cc under an automorphism of (;<)({\mathbb{Q}};<), we have bRb\in R. So, we suppose that tt contains 11 as an entry; for the sake of notation, we assume that tt has the form (1,,1,0,,0)(1,\ldots,1,0,\ldots,0), where the first mm entries are 11; here, 0<m<k0<m<k. We have that (b1,,bm)(b_{1},\ldots,b_{m}) satisfies all min-affine formulas on variables from v1,,vmv_{1},\ldots,v_{m} which are entailed by R(v1,,vk)R(v_{1},\ldots,v_{k}). Hence, by induction, it holds that (b1,,bm)π1,,mR(b_{1},\ldots,b_{m})\in\pi_{1,\ldots,m}R, and that there exists a tuple of the form (b1,,bm,d)(b_{1},\ldots,b_{m},d) in RR, where dd is a tuple of length (km)(k-m). We can apply an automorphism to the tuple (b1,,bm,d)(b_{1},\ldots,b_{m},d) to obtain a tuple (b1,,bm,d)R(b^{\prime}_{1},\ldots,b^{\prime}_{m},d^{\prime})\in R where all entries are positive. Also, by applying an automorphism to cRc\in R, we can obtain a tuple of the form (c1,,cm,0,,0)(c^{\prime}_{1},\ldots,c^{\prime}_{m},0,\ldots,0) where, for all coordinates ii from 11 to mm, it holds that ci>bic^{\prime}_{i}>b^{\prime}_{i}. Applying mx\operatorname{mx} to the tuples (b1,,bm,d)(b^{\prime}_{1},\ldots,b^{\prime}_{m},d^{\prime}) and (c1,,cm,0,,0)(c^{\prime}_{1},\ldots,c^{\prime}_{m},0,\ldots,0), one obtains the tuple (mx(b1,c1),,mx(bm,cm),mx(d,0¯))(\operatorname{mx}(b^{\prime}_{1},c^{\prime}_{1}),\ldots,\operatorname{mx}(b^{\prime}_{m},c^{\prime}_{m}),\operatorname{mx}(d^{\prime},\overline{0})), where 0¯\overline{0} is a tuple of length (km)(k-m) with all entries equal to 0, which is equivalent to bb under an automorphism. ∎

Example. Observe that the relation XX closed under mx\operatorname{mx} presented in Section 2 is defined there as a conjunction of min-affine formulas.

4. Tractability Results

In this section, we prove the following theorem.

Theorem 4.1.

Let Γ\Gamma be a temporal constraint language preserved by an operation h{min,mx}h\in\{\operatorname{min},\operatorname{mx}\}. The problem QCSP(Γ)\operatorname{QCSP}(\Gamma) is polynomial-time decidable.

Let Γ\Gamma be a relational τ\tau-structure. Formulas of the form

Q1v1Qnvn(ψ1ψm)Q_{1}v_{1}\dots Q_{n}v_{n}(\psi_{1}\wedge\dots\wedge\psi_{m})

where each ψi\psi_{i} is of the form R(y1,,yk)R(y_{1},\dots,y_{k}) for RτR\in\tau, and where Q1,,Qn{,}Q_{1},\dots,Q_{n}\in\{\exists,\forall\}, will be called quantified constraint formulas (over Γ)\Gamma). Existentially quantified variables are typically (but not exclusively) denoted by x,x1,x2,x,x_{1},x_{2},\dots, and universally quantified variables by y,y1,y2,y,y_{1},y_{2},\dots.

Lemma 4.2.

Let Γ\Gamma be a temporal constraint language preserved by an operation h{min,mx}h\in\{\operatorname{min},\operatorname{mx}\}. Let Φ(z1,,zm)=yx1xnϕ\Phi(z_{1},\ldots,z_{m})=\forall y\exists x_{1}\ldots\exists x_{n}\phi be a quantified constraint formula over Γ\Gamma having free variables {z1,,zm}\{z_{1},\ldots,z_{m}\}. Let Φ(z1,,zm)\Phi^{\prime}(z_{1},\ldots,z_{m}) be the formula yx1xn(ϕi[m](zi<y))\exists y\exists x_{1}\ldots\exists x_{n}(\phi\wedge\bigwedge_{i\in[m]}(z_{i}<y)). If the formula Φ\Phi is satisfiable, then the formulas Φ\Phi, Φ\Phi^{\prime} have the same satisfying assignments over Γ\Gamma.

Proof.

Observe that for every qq\in{\mathbb{Q}} there exists a value α(q)\alpha(q) such that h(q,p)=h(p,q)=α(q)h(q,p)=h(p,q)=\alpha(q) for all p>qp>q. Notice that α(q)\alpha(q) is injective and preserves <<.

Let Ψ\Psi be the formula x1xnϕ\exists x_{1}\ldots\exists x_{n}\phi with free variables {z1,,zm,y}\{z_{1},\ldots,z_{m},y\}. Assume that Φ\Phi is satisfiable; then, there exists a tuple (g1,,gm)m(g_{1},\ldots,g_{m})\in{\mathbb{Q}}^{m} such that, for all dd\in{\mathbb{Q}}, the tuple (g1,,gm,d)(g_{1},\ldots,g_{m},d) satisfies Ψ\Psi. Clearly, all satisfying assignments of Φ\Phi are satisfying assignments of Φ\Phi^{\prime}. We thus need to show that each satisfying assignment of Φ\Phi^{\prime} is a satisfying assignment of Φ\Phi.

Let (f1,,fm)m(f_{1},\ldots,f_{m})\in{\mathbb{Q}}^{m} be a satisfying assignment of Φ\Phi^{\prime}. By the definitions of the formulas, there exists a value bb\in{\mathbb{Q}} with b>fib>f_{i} for all i[m]i\in[m] such that (f1,,fm,b)(f_{1},\ldots,f_{m},b) satisfies Ψ\Psi. By applying a suitable automorphism to (g1,,gm)(g_{1},\ldots,g_{m}), we may assume that fi<gif_{i}<g_{i} for all i[m]i\in[m]. Now consider h((f1,,fm,b),(g1,,gm,d))h((f_{1},\ldots,f_{m},b),(g_{1},\ldots,g_{m},d)) where dd\in{\mathbb{Q}}. In the first mm coordinates, this tuple is equal to (α(f1),,α(fm))(\alpha(f_{1}),\ldots,\alpha(f_{m})). In the last coordinate, this tuple is equal to h(b,d)h(b,d); by varying dd, the value h(b,d)h(b,d) can take on values from every orbit, where here we understand orbit to be with respect to the group consisting of the automorphisms of (,<)({\mathbb{Q}},<) that fix the values α(fi)\alpha(f_{i}). It follows that (α(f1),,α(fm))(\alpha(f_{1}),\dots,\alpha(f_{m})) satisfies Φ\Phi; since α1\alpha^{-1} preserves all first-order definable relations, we conclude that (f1,,fm)(f_{1},\dots,f_{m}) satisfies Φ\Phi. ∎

With this lemma in hand, we now prove the theorem. Let Γ\Gamma be a structure that is preserved by min\operatorname{min} or by mx\operatorname{mx}. We now present an algorithm for QCSP(Γ)\operatorname{QCSP}(\Gamma). For the sake of notation, we assume that the input instance is of the form y1x1ynxnϕ\forall y_{1}\exists x_{1}\ldots\forall y_{n}\exists x_{n}\phi, that is, it exhibits a strict alternation between the two quantifier types. The result for the general case can be obtained, for example, by considering an algorithm that inserts dummy variables/quantifiers into an arbitrary instance of QCSP(Γ)\operatorname{QCSP}(\Gamma) to massage it into the described form, and then passes to the algorithm that we describe. We make use of the fact that CSP(Γ)(\Gamma) can be decided by the algorithms given in [7]; indeed, those algorithms describe how to compute satisfying assignments in the event that they exist.

Algorithm for QCSP(Γ)\operatorname{QCSP}(\Gamma) where Γ\Gamma is preserved by min/mx. Input: an instance y1x1ynxnϕ\forall y_{1}\exists x_{1}\ldots\forall y_{n}\exists x_{n}\phi of QCSP(Γ)\operatorname{QCSP}(\Gamma). Set Ψn(y1,x1,,yn,xn)=ϕ\Psi_{n}(y_{1},x_{1},\ldots,y_{n},x_{n})=\phi. Loop i=i= nn to 11         Let Φi=yixiΨi\Phi_{i}=\forall y_{i}\exists x_{i}\Psi_{i}         Let Φi\Phi^{\prime}_{i} be yixi(Ψi(x1<yixi1<yi)(y1<yiyi1<yi))\exists y_{i}\exists x_{i}\big{(}\Psi_{i}\wedge(x_{1}<y_{i}\wedge\cdots\wedge x_{i-1}<y_{i})\wedge(y_{1}<y_{i}\wedge\cdots\wedge y_{i-1}<y_{i}))         If Φi\Phi^{\prime}_{i} is satisfiable             Let ww be a satisfying assignment         Else              Return False         If ww does not satisfy Φi\Phi_{i},              Return False         [Comment: Φi\Phi_{i}, Φi\Phi^{\prime}_{i} are equivalent and both satisfiable]         Let Ψi1=Φi\Psi_{i-1}=\Phi^{\prime}_{i} End Loop Return True

We now discuss the correctness of this algorithm. The algorithm maintains the invariant that, at the beginning of each loop, the formula Ψi(y1,x1,,yi,xi)\Psi_{i}(y_{1},x_{1},\ldots,y_{i},x_{i}) is equivalent to the formula yi+1xi+1ynxnϕ\forall y_{i+1}\exists x_{i+1}\ldots\forall y_{n}\exists x_{n}\phi. (By equivalent, we mean that the formulas have the same satisfying assignments over Γ\Gamma.) This is certainly true for i=ni=n by the initialization of Ψn\Psi_{n}.

We now consider the behavior of the algorithm for an execution of the loop. If the formula Φi\Phi^{\prime}_{i} is not satisfiable, it follows that the formula Φi\Phi_{i} is not satisfiable (as any satisfying assignment for Φi\Phi_{i} is clearly one for Φi\Phi^{\prime}_{i}), and hence that the original sentence is false; the algorithm hence reports “False” correctly.

In the case that Φi\Phi^{\prime}_{i} is found to be satisfiable, consider first the case that the satisfying assignment ww for Φi\Phi^{\prime}_{i} does not satisfy Φi\Phi_{i}. It follows by Lemma 4.2 that Φi\Phi_{i} is not satisfiable, and hence that the original sentence is false; the algorithm hence reports “False” correctly.

In the case that the assignment ww does satisfy Φi\Phi_{i}, by Lemma 4.2, the formulas Φi\Phi_{i}, Φi\Phi^{\prime}_{i} are equivalent. Consequently, when Ψi1\Psi_{i-1} is set equal to Φi\Phi^{\prime}_{i}, by the definition of Φi\Phi_{i} and the fact that the invariant held at the beginning of the loop, the invariant will hold for the next execution of the loop. In the case that i=1i=1, if the loop does not return false, by the given argumentation, we have that both Φ1\Phi_{1} and Φ1\Phi^{\prime}_{1} are true, and hence that the original sentence is true.

5. Discussion

The polynomial-time algorithms for the QCSP of temporal constraint languages that are preserved by min\min or preserved by mx\operatorname{mx} that we have seen in this paper properly strengthen previously known algorithmic results for the QCSP:

  • In [12], it has been shown that instances of the QCSP where all constraints are of the form xy1xykx\geq y_{1}\vee\cdots\vee x\geq y_{k} can be solved in polynomial time. All such constraints are preserved by min\min (this follows immediately from the syntactic characterization that we gave for temporal relations that are preserved by min\min).

  • In [4], it has been shown that the QCSP for all temporal constraint languages preserved by min\min is in NP.

There are (up to duality) two more temporal constraint languages whose CSP is maximally tractable [7]. One of them is characterized by a certain binary polymorphism called ll\operatorname{ll}. The tractability for the CSP for ll\operatorname{ll}-closed languages has been shown in [8]. The QCSP for ll\operatorname{ll}-closed languages is coNP-hard [6], so this is an instance where maximal tractability doesn’t transfer to the QCSP. There is the temporal constraint language that contains all relations preserved by the binary operation mi\operatorname{mi} (for a definition, see [7]). In this case, the tractability of the QCSP is open. In fact, already the following is open.

Question 5.1.

Is QCSP((;{(x,y,z)|x=yyz}))\operatorname{QCSP}(({\mathbb{Q}};\{(x,y,z)\;|\;x=y\Rightarrow y\leq z\})) in P?

The relation defined by x=yyzx=y\Rightarrow y\leq z is indeed preserved by mi\operatorname{mi} (see [7]). Finally, the temporal languages preserved by a constant operation have a tractable CSP [7]. As shown in previous work [12, 11], the QCSP for such languages may be contained in LOGSPACE, be NLOGSPACE-complete, be P-complete, be NP-complete, or be PSPACE-complete.

Another field of open problems is related to the question how bad the complexity of the QCSP becomes when we are outside the maximal tractable classes. From maximal tractability of the CSP we only obtain NP-hardness, but very often the problem might become even PSPACE-hard. Very often, questions in this context lead to the following notorious open problem.

Question 5.2.

Is QCSP((;{(x,y,z)|x=yy=z}))\operatorname{QCSP}(({\mathbb{Q}};\{(x,y,z)\;|\;x=y\Rightarrow y=z\})) PSPACE-complete?

We only know that this QCSP is coNP-hard [6].

Postprint note: D. Zhuk and B. Martin solved Question 5.2 [22].

References

  • [1] B. Aspvall, M. F. Plass, and R. E. Tarjan. A linear-time algorithm for testing the truth of certain quantified boolean formulas. Information Processing Letters, 8(3):121–123, 1979.
  • [2] L. Barto and M. Kozik. Constraint satisfaction problems of bounded width. In Proceedings of the Annual Symposium on Foundations of Computer Science (FOCS), pages 595–603, 2009.
  • [3] M. Bodirsky. Complexity classification in infinite-domain constraint satisfaction. Memoire d’habilitation à diriger des recherches, Université Diderot – Paris 7. Available at arXiv:1201.0856, 2012.
  • [4] M. Bodirsky and H. Chen. Collapsibility in infinite-domain quantified constraint satisfaction. In Proceedings of Computer Science Logic (CSL), Szeged, Hungary, 2006.
  • [5] M. Bodirsky and H. Chen. Relatively quantified constraint satisfaction. Constraints, 14(1):3–15, 2009.
  • [6] M. Bodirsky and H. Chen. Quantified equality constraints. SIAM Journal on Computing, 39(8):3682–3699, 2010. A preliminary version of the paper appeared in the proceedings of LICS’07.
  • [7] M. Bodirsky and J. Kára. The complexity of temporal constraint satisfaction problems. Journal of the ACM, 57(2):1–41, 2009. An extended abstract appeared in the Proceedings of the Symposium on Theory of Computing (STOC’08).
  • [8] M. Bodirsky and J. Kára. A fast algorithm and Datalog inexpressibility for temporal reasoning. ACM Transactions on Computational Logic, 11(3), 2010.
  • [9] F. Börner, A. A. Bulatov, H. Chen, P. Jeavons, and A. A. Krokhin. The complexity of constraint satisfaction games and QCSP. Information and Computation, 207(9):923–944, 2009.
  • [10] P. J. Cameron. The random graph. R. L. Graham and J. Nešetřil, Editors, The Mathematics of Paul Erdös, 1996.
  • [11] W. Charatonik and M. Wrona. Quantified positive temporal constraints. In Proceedings of CSL, pages 94–108, 2008.
  • [12] W. Charatonik and M. Wrona. Tractable quantified constraint satisfaction problems over positive temporal templates. In LPAR, pages 543–557, 2008.
  • [13] H. Chen. The computational complexity of quantified constraint satisfaction. Ph.D. thesis, Cornell University, August 2004.
  • [14] H. Chen. Meditations on quantified constraint satisfaction. In Logic and Program Semantics - Essays Dedicated to Dexter Kozen on the Occasion of His 60th Birthday, Lecture Notes in Computer Science 7230. Springer, 2012.
  • [15] N. Creignou, S. Khanna, and M. Sudan. Complexity Classifications of Boolean Constraint Satisfaction Problems. SIAM Monographs on Discrete Mathematics and Applications 7, 2001.
  • [16] N. Creignou, P. G. Kolaitis, and H. Vollmer, editors. Complexity of Constraints - An Overview of Current Research Themes [Result of a Dagstuhl Seminar], volume 5250 of Lecture Notes in Computer Science. Springer, 2008.
  • [17] T. Feder and M. Y. Vardi. The computational structure of monotone monadic SNP and constraint satisfaction: a study through Datalog and group theory. SIAM Journal on Computing, 28:57–104, 1999.
  • [18] W. Hodges. A shorter model theory. Cambridge University Press, Cambridge, 1997.
  • [19] P. G. Jeavons and M. C. Cooper. Tractable constraints on ordered domains. Artificial Intelligence, 79(2):327–339, 1995.
  • [20] M. Karpinski, H. K. Büning, and P. H. Schmitt. On the computational complexity of quantified Horn clauses. In Proceedings of CSL, pages 129–137, 1987.
  • [21] D. Macpherson. A survey of homogeneous structures. Discrete Mathematics, 311(15):1599–1634, 2011.
  • [22] D. Zhuk and B. Martin. The complete classification for quantified equality constraints. CoRR, abs/2104.00406, 2021.