Abstract 1 Introduction 2 Preliminaries 3 Results 4 Decidability of Meta-Problem 5 Conclusion and Open Problems References Appendix A Appendix Appendix B Remarks on Related Results

Symmetric Linear Arc Monadic Datalog and Gadget Reductions

Manuel Bodirsky ORCID Institut für Algebra, TU Dresden, Germany Florian Starke ORCID Institut für Algebra, TU Dresden, Germany
Abstract

A Datalog program solves a constraint satisfaction problem (CSP) if and only if it derives the goal predicate precisely on the unsatisfiable instances of the CSP. There are three Datalog fragments that are particularly important for finite-domain constraint satisfaction: arc monadic Datalog, linear Datalog, and symmetric linear Datalog, each having good computational properties. We consider the fragment of Datalog where we impose all of these restrictions simultaneously, i.e., we study symmetric linear arc monadic (slam) Datalog. We characterise the CSPs that can be solved by a slam Datalog program as those that have a gadget reduction to a particular Boolean constraint satisfaction problem. We also present exact characterisations in terms of a homomorphism duality (which we call unfolded caterpillar duality), and in universal-algebraic terms (using known minor conditions, namely the existence of quasi Maltsev operations and k-absorptive operations of arity nk, for all n,k1). Our characterisations also imply that the question whether a given finite-domain CSP can be expressed by a slam Datalog program is decidable.

Keywords and phrases:
Datalog, Gadget Reductions, Homomorphism Dualities, Minor Conditions
Copyright and License:
[Uncaptioned image] © Manuel Bodirsky and Florian Starke; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Theory of computation Finite Model Theory
Related Version:
Full Version: https://arxiv.org/abs/2407.04924  [10]
Funding:
Both authors have been funded by the European Research Council (Project POCOCOP, ERC Synergy Grant 101071674). Views and opinions expressed are however those of the authors only and do not necessarily reflect those of the European Union or the European Research Council Executive Agency. Neither the European Union nor the granting authority can be held responsible for them.
Editors:
Sudeepa Roy and Ahmet Kara

1 Introduction

Datalog is an important concept linking database theory with the theory of constraint satisfaction. It is by far the most intensively studied formalism for polynomial-time tractability in constraint satisfaction. Datalog allows to formulate algorithms that are based on iterating local inferences, aka constraint propagation or establishing local consistency; this has been made explicit by Feder and Vardi in their groundbreaking work where they also formulate the finite-domain CSP dichotomy conjecture [25]. Following their convention, we say that a Datalog program Π solves a CSP if Π derives the goal predicate on an instance of the CSP if and only if the instance is unsatisfiable.

The class of CSPs that can be solved by Datalog is closed under so-called “gadget reductions” (a result due to Larose and Zádori [33]). In such a reduction, the variables in an instance of a constraint satisfaction problem are replaced by tuples of variables of some fixed finite length, and the constraints are replaced by gadgets (implemented by conjunctive queries; a formal definition can be found in Section 2.3); many of the well-known reductions between computational problems can be phrased as gadget reductions. Datalog is sufficiently powerful to simulate such gadget reductions; this has been formalised by Atserias, Bulatov, and Dawar in [2] and the connection has been sharpened recently by Dalmau and Opršal [21].

Feder and Vardi showed that Datalog cannot solve systems of linear equations over finite fields, even though such systems can be solved in polynomial time [25]. They suggest that the ability to simulate systems of linear equations should essentially be the only reason for a CSP to not be in Datalog. This conjecture was formalised by Larose and Zádori [33]: they observed that if systems of linear equations admit a gadget reduction to a CSP, then the CSP is not in Datalog, and they conjectured that otherwise the CSP can be solved by Datalog. This conjecture was proved by Barto and Kozik in 2009 [4], long before the resolution of the finite-domain CSP dichotomy conjecture by Bulatov [12] and by Zhuk [41, 40].

Datalog programs can be evaluated in polynomial time; but even a running time in O(n3) on a sequential computer can be prohibitively expensive in practise. This is one of the reasons why syntactic fragments of Datalog have been studied, which often come with better computational properties.

1.1 Arc Monadic Datalog

In monadic Datalog, we restrict the arity of the inferred predicates of the Datalog program to one (i.e., all the IDBs are monadic). In arc Datalog we restrict each rule to a single input relation symbol (i.e., the body contains a single EDB; for formal definitions, see Section 2.4).

An important Datalog fragment is arc monadic Datalog, which is still powerful enough to express the famous arc consistency procedure in constraint satisfaction. The arc consistency procedure has already been studied by Feder and Vardi [25], and has many favorable properties: it can be evaluated in linear time and linear space. It is used as an important pre-processing step in the algorithms for both of the mentioned CSP dichotomy proofs, and it is also used in many practical implementations of algorithms in constraint satisfaction. The arc consistency procedure is still extremely powerful, and can for instance solve the P-complete HornSat Problem.

Feder and Vardi characterised the power of the arc consistency procedure in terms of tree duality (see Section 2.6), a natural combinatorial property which has been studied intensively in the graph homomorphism literature in the 90s (see, e.g., [26, 27]). Their characterisation has several remarkable consequences: one is that also the class of CSPs that can be solved by an arc monadic Datalog program is closed under gadget reductions. Another one is a collapse result for Datalog when it comes to finite-domain CSPs, namely that monadic Datalog collapses to arc monadic Datalog: in fact, if a finite-domain CSP can be solved by a monadic Datalog program, then it can already be solved by the arc consistency procedure (i.e., by a program in arc monadic Datalog). This statement is false without the restriction to finite-domain CSPs; in fact, there are infinite-domain CSPs that can be solved by a monadic Datalog program, but not by a program in arc monadic Datalog (Bodirsky and Dalmau [8]).

1.2 Linear Datalog

Besides arc monadic Datalog, there are other natural fragments of Datalog. The most notable one is linear Datalog [29]. Linear Datalog programs can be evaluated in non-deterministic logarithmic space (NL), and hence cannot express P-hard problems (unless P=NL). Dalmau [19] asked whether the converse is true as well, i.e., whether every finite-domain CSP which is in NL can be solved by a linear Datalog program [19]. This is widely treated as a conjecture, to which we refer as the linear Datalog conjecture; it is one of the biggest open problems in finite-domain constraint satisfaction.

There are some sufficient conditions for solvability by linear Datalog (see Bulatov, Kozik, and Willard [3] and Carvalho, Dalmau, and Krokhin [15]) and some necessary conditions (Larose and Tesson [32]) but the results still leave a large gap. For examples of CSPs of orientations of trees that fall into this gap, see Bodirsky, Bulín, Starke, and Wernthaler [7]. Again, linear Datalog is closed under gadget reductions [38]. And indeed, if HornSat has a gadget-reduction in a finite-domain CSP, then the finite-domain CSP cannot be solved by a linear Datalog program [1].

1.3 Symmetric Linear Datalog

A further restriction is symmetric linear Datalog, introduced by Egri, Larose, and Tesson [23]. Symmetric linear Datalog programs can be evaluated in deterministic logspace (L). Egri, Larose, and Tesson conjecture that every finite-domain CSP which is in L can be be solved by a symmetric linear Datalog program [23]; we refer to this conjecture as the symmetric linear Datalog conjecture.

Symmetric linear Datalog is closed under gadget reductions [38]. Since directed reachability is not in symmetric linear Datalog [24], it follows that every CSP that admits a gadget reduction from directed reachability cannot be solved by a symmetric linear Datalog program. Egri, Larose, and Tesson also suggest that this might be the only additional condition for containment in symmetric linear Datalog, besides the known necessary conditions to be in linear Datalog. Kazda [30] confirms the symmetric linear Datalog conjecture conditionally on the truth of the linear Datalog conjecture, i.e., he shows that if a finite-domain CSP is in linear Datalog and does not admit a gadget reduction from a CSP that corresponds to the directed reachability problem, then it is in symmetric linear Datalog (generalizing an earlier result of Dalmau and Larose [20]).

1.4 Our Contributions

In this paper, we study the Datalog fragment that can be obtained by combining all the previously considered restrictions, namely symmetric linear arc monadic (slam) Datalog. Before stating our result we illustrate this fragment with some examples. For n1, let 𝔓n be the directed path with n vertices and n1 edges. An example of a slam Datalog program which solves CSP(𝔓2) is

A(x) :E(x,y) goal :E(x,y),A(y)

(in this case, the program is even recursion-free). An example of a slam Datalog program which solves CSP(𝔓3), this time with recursion and IDBs A and B, is

A(x) :E(x,y) B(x) :A(y),E(x,y)
A(y) :B(x),E(x,y) goal :B(y),E(x,y).

The idea why this program is correct is that a finite digraph 𝔄 has a homomorphism to 𝔓3 if and only if certain orientations of paths (those of net length three; for a formal description, see Example 8) do not have a homomorphism to 𝔄; and the program derives the goal predicate on 𝔄 precisely if there is a homomorphism from such a path to 𝔄.

It follows from our results that the class of CSPs that can be solved by slam Datalog programs is closed under gadget reductions, despite the many restrictions that we imposed.

We provide a full description of the power of a Datalog fragment in terms of gadget reductions: we show that a CSP can be solved by a slam Datalog program if and only if it has a gadget reduction to CSP(𝔓2).111The statement even holds for infinite-domain CSPs, since being solved by an arc monadic Datalog program implies the existence of a finite template [8] and admitting a gadget reduction to a finite-domain CSP implies the existence of a finite template as well [21]. The particular role of the structure 𝔓2 is explained by the fact that it is a representative of the unique class of CSPs which is non-trivial and weakest with respect to gadget reductions – a formalisation of this can be found in Section 2.3.222We mention that 𝔓2 is a Boolean structure which simultaneously satisfies the Schaefer conditions of being Horn, dual Horn, affine, and bijunctive [37]. This shows that slam Datalog is the smallest non-trivial fragment of Datalog that is closed under gadget reductions.

Our main result (Theorem 18) establishes a tight connection between the power of slam Datalog and various central themes in structural combinatorics and universal algebra. Specifically, the power of slam Datalog can be characterised by a combinatorial duality which we call unfolded caterpillar duality (restricting the concept of caterpillar duality of Carvalho, Dalmau, and Krokhin [16], and using ideas that appear implicitly in the literature on symmetric Datalog [20, 23, 30]), and by the existence of a quasi Maltsev polymorphism (a central concept in universal algebra) in combination with kn-ary k-absorbing polymorphisms for every k,n1 (introduced in  [16] as well). Our result also implies that the following meta-problem can be decided algorithmically: given a finite structure 𝔅, can CSP(𝔅) be solved by a slam Datalog program?

1.5 Related Results

Solvability of finite-domain CSPs by (unrestricted) Datalog was first studied by Feder and Vardi; they proved that CSP(𝔅) can be solved by Datalog if and only if 𝔅 has bounded treewidth duality, and they showed that CSPs for systems of linear equations over finite Abelian groups cannot be solved by Datalog. Larose and Zadori [33] showed that solvability by Datalog is preserved by gadget reductions and they asked whether having a gadget reduction from CSPs for systems of linear equations is not only a sufficient, but also a necessary condition for not being solvable by Datalog. This questions was answered positive by Barto and Kozik [4]. Kozik, Krokhin, and Willard [31] gave a characterisation of Datalog in terms of minor conditions.

Linear (but not necessarily symmetric) monadic arc Datalog has been studied by Carvalho, Dalmau, and Krokhin [16]; our proof builds on their result. In their survey on Datalog fragments and dualities in constraint satisfaction [13] Bulatov, Krokhin, and Larose write “it would be interesting to find (…) an appropriate notion of duality for symmetric (Linear) Datalog (…)”. We do find such a notion for symmetric linear arc monadic Datalog, namely unfolded caterpillar duality (Theorem 18).

Another fragment of Datalog consists of the set of conjunctive queries; the CSPs that can be solved by such Datalog programs are precisely the CSPs that are first-order expressible, by Rossman’s theorem [36]. This is also known to be equivalent to CSPs having finite duality. However, note that first-order definability is not preserved under gadget reductions (as we will see in Section 2.6).

2 Preliminaries

We write [n] for the set {1,,n} and [m,n] for the set {m,m+1,,n}. We say that a tuple aAk, for k, is injective if a is injective when viewed as a function from [k] to A.

2.1 Structures and Graphs

We assume familiarity with the concepts of relational structures and first-order formulas from mathematical logic, as introduced for instance in [28]. The arity of a relation symbol R is denoted by ar(R). If 𝔄 is a τ-structure, then we sometimes use the same symbol for Rτ and the respective relation R𝔄 of 𝔄. We write 𝔄[S] for the substructure of 𝔄 induced on S.

A (directed) graph is a relational structure with a single binary relation E. For instance the clique with n vertices is the graph 𝔎n with domain [n] and edges E𝔎n:={(a,b)ab}. Let 𝔊 be a graph. An (undirected) path from a to b in 𝔊 is a tuple P=(a1,,an) such that a1,,an are pairwise distinct, a1=a, an=b, and for all i[n1] there is an edge between ai and ai+1 (from ai to ai+1 or from ai+1 to ai). If i[2,n1], then we say that P passes through ai. A graph 𝔊 is called connected if for any two elements a,b there exists a path from a to b in 𝔊. A cycle is a path from a to b of length n at least three such that there is an edge between a and b. A graph is called acyclic if it does not contain any cycle. A graph is called a tree if it is connected and acyclic. A graph has girth k if the length of the shortest cycle is k.

2.2 Homomorphisms and CSPs

Let τ be a relational signature and let 𝔄 and 𝔅 be τ-structures. Then a homomorphism from 𝔄 to 𝔅 is a map h:AB such that for Rτ, say of arity k, we have (h(a1),,h(ak))R𝔅 whenever (a1,,ak)R𝔄. An embedding of 𝔄 into 𝔅 is an injective map e:AB such that (e(a1),,e(ak))R𝔅 if and only if (a1,,ak)R𝔄. We write 𝔄𝔅 if there exists a homomorphism from 𝔄 to 𝔅 and 𝔄↛𝔅 if there exists no homomorphism from 𝔄 to 𝔅.

If τ is a finite relational signature and 𝔅 is a τ-structure, then CSP(𝔅) denotes the class of all finite τ-structures 𝔄 such that 𝔄𝔅. It can be viewed as a computational problem. For example, CSP(𝔎n) consists of the set of all finite n-colourable graphs, and can therefore be viewed as the n-colorability problem. Clearly, for finite structures 𝔅, this problem is always in NP. Note that from the database perspective, by the work of Chandra and Merlin [17], CSP(𝔅) can be viewed as the expression complexity of conjunctive queries over 𝔅.

A τ-structure 𝔅 is homomorphically equivalent to a τ-structure if there are homomorphisms from 𝔅 to and vice versa. Clearly, homomorphically equivalent structures have the same CSP. A relational τ-structure is called a core if all endomorphisms of are embeddings. It is well-known and easy to see that every finite structure 𝔅 is homomorphically equivalent to a core , and that all core structures that are homomorphically equivalent to 𝔅 are isomorphic; therefore, we refer to as the core of 𝔅.

2.3 Primitive Positive Constructions

A τ-formula ϕ is called a conjunctive query (in constraint satisfaction and model theory such formulas are called primitive positive, or short pp) if it is built from atomic formulas (including atomic formulas of the form x=y) using only conjunction and existential quantification. If 𝔅 is a τ-structure, and ϕ is a conjunctive query over the signature τ, then the relation R={(t1,,tk)𝔅ϕ(t1,,tk)} is called the relation defined by ϕ.

Definition 1.

The canonical database of a conjunctive query ϕ over the signature τ is the τ-structure 𝔅 that can be constructed as follows: Let ϕ be obtained from ϕ be renaming all existentially quantified variables such that no two quantified variables have the same name. Let ϕ′′ be obtained from ϕ by removing all conjuncts of the form x=y in ϕ and by identifying variables x and y if there is a conjunct x=y in ϕ. Then 𝔅 is the τ-structure whose domain is the set of variables of ϕ′′ such that for every Rτ we have

R𝔅={(v1,,vk)R(v1,,vk) is a conjunct of ϕ′′}.

The canonical conjunctive query of a structure 𝔅 with signature τ is the primitve positive τ-formula with variables B that contains for every Rτ and every tR𝔅 the conjunct R(t1,,tar(R)).

Observe that the canonical database of the canonical conjunctive query of a structure 𝔅 equals 𝔅. The following concepts have been introduced by Barto, Opršal, and Pinsker [5].

Definition 2.

A (d-th) pp-power of a τ-structure 𝔅 is a structure with domain Bd such that every relation of of arity k is definable by a conjunctive query in 𝔅 as a relation of arity dk. A structure has a primitive positive (pp) construction from 𝔅 if it is homomorphically equivalent to a pp-power of 𝔅.

Primitive positive constructions turned out to the the essential tool for classifying the complexity of finite-domain CSPs, because if has a pp-construction from 𝔅, then there is a so-called gadget reduction from CSP() to CSP(𝔅); in fact, the converse is true as well, see Dalmau and Opršal [21].

Definition 3.

Let be a class of finite τ-structures and let 𝒞 be a class of finite ρ-structures. Then a (d-dimensional) gadget reduction from 𝒞 to consists of a conjunctive query ϕR of arity dk over the signature τ for every Rρ of arity k. This defines the following map r from finite ρ-structures to finite τ-structures:

  • replace each element c of by the d-tuple ((c,1),,(c,d));

  • for every Rρ of arity k and every tuple (t1,,tk)R, introduce a new element for every existentially quantified variable in ϕR and define relations for the relation symbols from τ such that the substructure induced by the new elements and {(t1,1),,(t1,d),,(tk,1),,(tk,d)} induce a copy of the canonical database of ϕR in the natural way, where ϕR is obtained from ϕR by removing all conjuncts of the form x=y. Let be the resulting structure.

  • let S be the smallest equivalence relation that contains all ordered pairs of elements ((c,i),(d,j)) such that there exists Rρ and (t1,,tk)R with tp=c, tq=d such that ϕR(x1,1,,xk,d) contains the conjunct xp,i=xq,j. Then r():=/S.

For instance, the solution to the Feder-Vardi conjecture mentioned in the introduction states that CSP(𝔅), for a finite structure 𝔅, is NP-hard if and only if 𝔎3 has a pp-construction from 𝔅 (unless P=NP); by what we have stated above, this is true if and only if the 3-coloring problem has a gadget reduction to CSP(𝔅).

Example 4.

Let τ={E} be the signature that consists of a single binary relation symbol E whose elements we call edges. Let 𝔓n be the τ-structure with the domain {1,2,,n} and edges {(1,2),(2,3),,(n1,n)}. Then 𝔓2 pp-constructs 𝔓3 [9], so CSP(𝔓3) has a gadget reduction to CSP(𝔓2).

 Remark 5.

It is known that pp-constructibility is transitive [5], and the corresponding poset has a largest element (which is represented by 𝔓1), and all other elements are below the element which is represented by 𝔓2; see, e.g., [11]).

Given the fundamental importance of conjunctive queries and homomorphisms in database theory, we believe that pp-constructions and gadget reductions are an interesting concept for database theory as well.

2.4 Datalog

Let τ and ρ be finite relational signatures such that τρ. A Datalog program is a finite set of rules of the form ϕ0:ϕ1,,ϕn where each ϕi is an atomic τ-formula. The formula ϕ0 is called the head of the rule, and the sequence ϕ1,,ϕn is called the body of the rule. The symbols in τ are called EDBs (extensional database predicates) and the other symbols from ρ are called IDBs (intensional database predicates). In the rule heads, only IDBs are allowed. There is one special IDB of arity 0, which is called the goal predicate. IDBs might also appear in the rule bodies. We view the set of rules as a recursive specification of the IDBs in terms of the EDBs – for a detailed introduction, see, e.g., [8]. A Datalog program is called

  • linear if in each rule, at most one IDB appears in the body (we then assume without loss of generality that in every rule whose body contains an IDB, the IDB is listed first).

  • arc if each rule involves at most one EDB.

  • symmetric if it is linear and for every rule ϕ0:ϕ1,ϕ2,,ϕn where ϕ0 and ϕ1 are build from IDBs, the Datalog program also contains the reversed rule ϕ1:ϕ0,ϕ2,,ϕn.333Note that we do not have to exclude that ϕ0 is the goal predicate, because we may always add its symmetric version without changing the set of structures on which the goal predicate is derived.

If 𝔅 is a τ-structure, then we say that CSP(𝔅) is solved by a Datalog program Π with EDBs τ if the following holds: the goal predicate is derived by Π on a finite τ-structure 𝔄 if and only if there is no homomorphism from 𝔄 to 𝔅. We say that a Datalog program has width (,k) if all IDBs have arity at most , and if every rule has at most k variables. For given (,k) and a structure 𝔅, there exists a Datalog program Π of width (,k) with the remarkable property that if some Datalog program of width (,k)) solves CSP(𝔅), then Π solves CSP(𝔅). This Datalog program is referred to as the canonical Datalog program for 𝔅 of width (,k), and is constructed as follows [25]: For every relation R over B of arity at most , we introduce a new IDB. The empty relation of arity 0 is the goal predicate. Then Π contains all rules ϕ:ϕ1,,ϕn with at most k variables such that the formula x¯(ϕ1ϕnϕ) holds in the expansion of 𝔅 by all IDBs. If the canonical Datalog program for 𝔅 derives the goal predicate on a finite structure 𝔄, then there is no homomorphism from 𝔄 to 𝔅 (see, e.g., [8]).

If k is the maximal arity of the EDBs, we may restrict the canonical Datalog program of width (1,k) to those rules with only unary IDBs and at most one EDB; in this case, we obtain the canonical arc monadic Datalog program, which is also known as the arc consistency procedure. Analogously, we may define the canonical linear, and the canonical symmetric Datalog program. We may also combine these restrictions, and in particular obtain a definition the canonical slam Datalog program, i.e., the canonical symmetric linear arc monadic Datalog program, which has not yet been studied in the literature before. The following lemma can be shown analogously to the well-known fact for unrestricted canonical Datalog programs of width (,k) (see, e.g., [8]).

Lemma 6.

Let 𝔅 be a finite structure with a finite relational signature, and let Π be the canonical slam Datalog program for 𝔅. If 𝔄 is a finite structure with a homomorphism to 𝔅, then Π does not derive the goal predicate on 𝔄.

2.5 The Incidence Graph

Several results from graph theory concerning acyclicity and high girth can be generalised to general structures. To formulate these generalisations, we need the following notion. The incidence graph of a structure 𝔄 with the relational signature τ is the bipartite graph where one color class is A, and the other consists of all pairs of the form (t,R) such that tR𝔄 and Rτ. We put an edge between a and (t,R) if ti=a for some i. The girth of an (undirected) graph 𝔊 is the length of the shortest cycle in 𝔊. We say that a relational structure is a generalised tree if its incidence graph is a tree. A leaf of a generalised tree 𝔗 is an element of T which has degree one in the incidence graph of 𝔗. A structure 𝔅 is called injective if all tuples that are in some relation in 𝔅 are injective (i.e., have no repeated entries). A structure is called an (injective) tree if it is injective and its incidence graph is a tree.

Theorem 7 (Sparse incomparability lemma for structures [25]).

Let τ be a finite relational signature. Let 𝔄 and 𝔅 be τ-structure with finite domains such that 𝔄↛𝔅. Then for every m there exists an injective finite structure 𝔄 whose incidence graph has girth at least m, such that 𝔄𝔄 and 𝔄↛𝔅.

2.6 Dualities

For a τ-structure 𝔅 and a class of τ-structures the pair (,𝔅) is called a duality pair if a finite structure 𝔄 has a homomorphism to 𝔅 if and only if no structure 𝔉 has a homomorphism to 𝔄. Several forms of duality pairs will be relevant here, depending on the class of structures . A τ-structure 𝔅 has finite duality if there exists a finite set of τ-structures such that (,𝔅) is a duality pair. The property of having finite duality is among the very few notions studied in the context of constraint satisfaction which is not preserved under gadget reductions, as illustrated in the following example.

Example 8.

As in Example 4, let τ={E}. Let n be the τ-structure with the domain {1,2,,2n+3} and edges {(1,2),(2,3),(4,3),(4,5),,(2n2,2n1),(n1,n)}. Then

  • 𝔓2 has finite duality, witnessed by the duality pair ({𝔓3},𝔓2),

  • recall from 4 that 𝔓2 pp-constructs 𝔓3 [9], so CSP(𝔓3) has a gadget reduction to CSP(𝔓2), but

  • 𝔓3 does not have finite duality: this is witnessed by the fact that ({nn},𝔓3) is a duality pair [27], and that there is no homomorphism from n to m for n<m.

Example 9.

Let ρ={E,Z} be the signature that consists of a binary relation symbol E and a unary relation symbol Z. Let 𝔅2 be the structure with domain {0,1} where

E𝔅2 :={(1,1),(0,1),(1,0)} and Z𝔅2 :={0}

Let 𝔓2 be the ρ-expansion of 𝔓2 where Z𝔓2:={0,1}. Then ({𝔓2},𝔅2) is a duality pair.

A more robust form of duality is tree duality, which plays a central role in constraint satisfaction, and is studied in the graph homomorphism literature in the 90s. A structure 𝔅 has tree duality if there exists a (not necessarily finite) set of trees such that (,𝔅) is a duality pair. The following is well known; see Theorem 7.4 in [14]. The equivalence of 1. and 3. is from [25]; also see [6].

Figure 1: An example of the incidence graph of a caterpillar (left) and of a structure that is not a caterpillar (right).
Theorem 10.

Let 𝔅 be a finite τ-structure. Then the following are equivalent:

  1. 1.

    𝔅 has tree duality;

  2. 2.

    𝔅 has a pp-construction from ({0,1};{0},{1},{0,1}3{(1,1,0)});

  3. 3.

    𝔅 can be solved by arc consistency.

There are finite structures with tree duality that have a P-complete CSP, such as the structure ({0,1};{0},{1},{0,1}3{(1,1,0)}), which is essentially the Boolean HornSAT problem. In the following, we therefore introduce more restrictive forms of dualities.

Definition 11.

A relational structure 𝔄 is called a generalised caterpillar if it is a generalised tree and its incidence graph 𝔊 contains a path P=(a1,,an) such that every vertex in G{a1,,an} of the form (t,R) is connected (in 𝔊) to a vertex in P.

See Figure 1 (left) for an example. A relational structure 𝔄 is called an (injective) caterpillar if it is injective and a generalised caterpillar (this definition of a caterpillar is equivalent to the one given in [16]). A structure 𝔅 has caterpillar duality if there exists a set of caterpillars such that (,𝔅) is a duality pair. The structures 𝔅 with caterpillar duality have been characterised by [16] (Theorem 17) in terms of linear arc Datalog.

To capture the power of symmetric linear arc Datalog, we present a more restrictive form of duality. Let 𝔗 be an (injective) tree and let a and b be distinct elements of 𝔗. Write the canonical query of 𝔗 as ϕaϕa,bϕb where ϕa contains all conjuncts of the form R(u¯) such that in the incidence graph, all paths from the vertex (u¯,R) to the vertex b pass though a. Similarly, we define ϕb, switching the roles of a and b. Note that ϕa and ϕb do not share any conjuncts. All the remaining conjuncts of the canonical query form ψ. Let ϕ1 be obtained from ϕa (ϕb) by existentially quantifying all variables except for a (b), and let ψ be obtained from ϕa,b by existentially quantifying all variables except for a and b. We introduce the following concept; see Figure 2 for an example.

Definition 12.

Let 𝔗 be an (injective) tree and let a and b be distinct elements of 𝔗 that are not leaves. The (a,b)-unfolding of 𝔗 is the canonical database of the formula

ϕ1(a)ψ(a,b)ψ(a,b)ψ(a,b)ϕ2(b)

where ϕ1, ϕ2, and ψ are defined as above. A unfolding of 𝔗 is a structure 𝔗 that is obtained by a sequence 𝔗=𝔗1,𝔗2,,𝔗n=𝔗 such that 𝔗i is an (ai,bi)-unfolding of 𝔗i1, for all i{2,,n}.

Figure 2: Example of an (a,b)-unfolding 𝔗 of a tree 𝔗.

Note that an unfolding of a tree 𝔗 is again a tree and has a homomorphism to 𝔗. It can also be shown that the unfolding of a caterpillar is a caterpillar as well (Lemma 24). We say that a structure 𝔅 has unfolded caterpillar duality if there exists a set of caterpillars such that (,𝔅) is a duality pair, and contains every unfolding of a caterpillar in . Clearly, unfolded caterpillar duality implies caterpillar duality. Unfolded generalised caterpillar duality is defined analogously.

2.7 Minor Conditions

If 𝔅 is a structure and k1, then a polymorphism of 𝔅 of arity k is a homomorphism from 𝔅k to 𝔅. The set of all polymorphisms of 𝔅 is denoted by Pol(𝔅). An (operation) clone is a set of operations which contains the projections and is closed under composition. Note that Pol(𝔅) is a clone. An operation f:BnB is called idempotent if f(x,,x)=x for all xB. A clone is called idempotent if all of its operations are idempotent.

If 𝔄 and 𝔅 are a structures and k1, then a polymorphism of (𝔄,𝔅) of arity k is a homomorphism from 𝔄k to 𝔅. The set of all polymorphisms of (𝔄,𝔅) is denoted by Pol(𝔄,𝔅). Let f:AnB be a function and let σ:[n][m], then the map

fσ:AmB,(a1,,am)f(aσ(1),,aσ(n))

is called a minor of f. A minion is a set or functions from An to B that is closed under taking minors. Note that Pol(𝔄,𝔅) is a minion. Let and 𝒩 be minions. A map ξ:𝒩 is called a minion homomorphism if ξ preserves arity and for every f of arity n and every map σ:[n][m] we have ξ(fσ)=(ξ(f))σ.

Let τ be a function signature, i.e., a set of function symbols, each equipped with an arity. A minor condition is a finite set Σ of minor identities, i.e., expressions of the form

f(x1,,xn)g(y1,,ym)

where f is an n-ary function symbol from τ, g is an m-ary function symbol from τ, and x1,,xn,y1,,ym are (not necessarily distinct) variables. If is a minion, then a map ξ:τ satisfies a minor condition Σ if for every minor identity f(x1,,xn)g(y1,,ym)Σ and for every assignment s:{x1,,xn,y1,,yn}B we have

ξ(f)(s1(x1),,s(xn))=ξ(g)(s(y1),,s(ym)).

We say that a minion satisfies Σ if there exists a map ξ:τ that satisfies Σ.444It is convenient and standard practise to notationally drop the distinction between fτ and ξ(f). If Σ and Σ are minor conditions, then we say that Σ implies Σ if every clone that satisfies Σ also satisfies Σ. We present some concrete minor conditions that are relevant in the following.

Definition 13.

An operation m:B3B is called a quasi Maltsev operation if it satisfies the minor condition

m(x,x,y)m(y,x,x)m(y,y,y).

A Maltsev operation is an idempotent quasi Maltsev operation. A quasi minority operation is a quasi Maltsev operation m that additionally satisfies

m(x,y,x)m(x,x,x)

and a minority operation is an idempotent quasi minority operation.

Definition 14.

Let k,n>0. An operation f:BknB is called k-block symmetric if it satisfies the following condition

f(x11,,x1k,,xn1,,xnk)f(y11,,y1k,,yn1,,ynk) (1)

whenever {S1,,Sn}={T1,,Tn} where Si={xi1,,xik} and Ti={yi1,,yik}. If k=1 or n=1 then f is called totally symmetric.

If f is k-block symmetric and S1,,Sn are subsets of B of size at most k, then we also write f(S1,,Sn) instead of f(x11,,x1k,,xn1,,xnk) where {xi1,,xik}=Si. We say that f is k-absorptive if it satisfies

f(S1,S2,,Sn)f(S2,S2,S3,,Sn) whenever S2S1.
 Remark 15.

Note that every structure with a 2-absorptive polymorphism f of arity 6 also has the quasi majority polymorphism m given by m(x,y,z):=f(x,y,z,x,y,z), because {x}{x,z} and hence

m(x,x,z)=f(x,x,z,x,x,z)=f(x,x,x,x,x,x)=m(x,x,x)

and similarly m(x,z,x)=m(z,x,x)=m(x,x,x).

The list of equivalent statements from Theorem 10 can now be extended as follows.

Theorem 16 ([22, 25]).

Let 𝔅 be a finite τ-structure. Then 𝔅 has tree duality if and only if 𝔅 has totally symmetric polymorphisms of all arities.

We will make crucial use of the following theorem.

Theorem 17 (Theorem 16 in [16]).

Let 𝔅 be a finite relational τ-structure. Then the following are equivalent.

  1. 1.

    𝔅 has caterpillar duality.

  2. 2.

    CSP(𝔅) can be solved by a linear arc monadic Datalog program.

  3. 3.

    Pol(𝔅) contains for every k,n1 an k-absorbing operation of arity kn.

  4. 4.

    𝔅 is homomorphically equivalent to a structure 𝔅 with binary polymorphisms and such that (B,,) is a (distributive) lattice.

3 Results

In this section we state and prove our main result (Theorem 18), which characterises the power of slam Datalog in many different ways, including descriptions in terms of pp-constructability in 𝔓2, minor conditions, unfolded caterpillar duality, and homomorphic equivalence to a structure with both lattice and quasi Maltsev polymorphisms.

Theorem 18.

Let 𝔅 be a structure with a finite domain and a finite relational signature τ. Then the following are equivalent.

  1. 1.

    Pol(𝔅) contains a quasi Maltsev operation and k-absorptive operations of arity nk, for all n,k1.

  2. 2.

    The canonical slam Datalog program for 𝔅 solves CSP(𝔅).

  3. 3.

    Some slam Datalog program solves CSP(𝔅).

  4. 4.

    𝔅 has unfolded caterpillar duality.

  5. 5.

    If Pol(𝔅) does not satisfy a minor condition Σ, then Σ implies f(x)f(y).

  6. 6.

    Every minor condition that holds in Pol(𝔓2) also holds in Pol(𝔅).

  7. 7.

    There is a minion homomorphism from Pol(𝔓2) to Pol(𝔅).

  8. 8.

    There is a pp-construction of 𝔅 from 𝔓2.

  9. 9.

    𝔅 is homomorphically equivalent to a structure 𝔅 such that Pol(𝔅) contains a quasi Maltsev operation and operations and such that (B,,) forms a (distributive) lattice.

We first prove the equivalence of (1)-(6) in cyclic order. We then explain how the equivalence of (6)-(8) follows from general results in the literature, and show the equivalence of (1) and (9). The proof of the theorem stretches over the following subsections.

 Remark 19.

If one of the items of Theorem 18 holds for a structure 𝔅, then there exists a structure 𝔅 with a binary relational signature such that Pol(𝔅)=Pol(𝔅), and all the statements hold for 𝔅 in place of 𝔅 as well.

Example 20.

The structure 𝔗n is the transitive tournament with n vertices, i.e., it has the domain [n] and the binary relation <. Note that 𝔗2 equals 𝔓2. It is easy to see that ({𝔓n+1},𝔗n) is a duality pair. Since 𝔓n+1 is a caterpillar Theorem 17 implies that CSP(𝔗n) can be solved by a linear arc monadic Datalog program. However, 𝔗n does not have a quasi Maltsev polymorphism for n3, and hence Theorem 18 implies that CSP(𝔗n) cannot be solved by slam Datalog.

3.1 Symmetrizing Linear Arc Monadic Datalog

The following lemma is used for the implication from (1) to (2) in the proof of Theorem 18. Note that in the canonical linear arc monadic Datalog program Π we can use the “strongest possible rules”555These comments are intended to illustrate the challenges in the proof of next lemma; it will not be necessary to formalise what we mean by strongest possible rules. when deriving the goal predicate. However, the canonical slam Datalog program ΠS might need to use weaker rules in order to be able to apply symmetric rules later on in the derivation. See Example 22.

Lemma 21.

Let 𝔅 be a finite structure with relational signature τ such that Pol(𝔅) contains a quasi Maltsev operation. Let Π be the canonical linear arc monadic Datalog program for 𝔅 and ΠS be the canonical slam Datalog program for 𝔅. Then Π can derive the goal predicate on a finite τ-structure 𝔄 if and only if ΠS can derive the goal predicate on 𝔄.

A proof of the lemma can be found in the long version of the article which is available on ArXiv [10].

Example 22.

Consider the structure 𝔅 with domain {0,0,1,a,b,b}, binary relation E={(0,1),(0,1),(a,b),(a,b)}, and all constants. Let 𝔄 be the structure with domain {0,b}, E={(0,b)}, and all constants. Clearly, 𝔄↛𝔅. The canonical linear arc monadic Datalog program Π for 𝔅 can derive the goal predicate using the derivation

R0{0}(0)R1{1}(b)R2G.

The canonical slam Datalog program ΠS for 𝔅 can also derive the goal predicate on 𝔄. Since the rule R1 is not symmetric it cannot use R1. However, it may use a different rule R~1:

R~0{0,0}(0)R~1{1}(b)R2G.

Note that R0 is also a rule of ΠS but in order to apply R~1 the program needs to use the rule R~0 which is weaker than the rule R0 (in the sense that the derived IDB is a strict superset).

3.2 Unfolded Caterpillar Duality

This section is devoted to the implication (3) to (4) in Theorem 18; the full proofs can be found in the long version of the article which is available on ArXiv [10]. We first present a general result about obstruction sets for finite-domain CSPs that closes a gap in the presentation of the proof of Lemma 21 in [16] and essentially follows from the sparse incomparability lemma (Theorem 7); we thank Víctor Dalmau for clarification.

Lemma 23.

Let 𝔅 be a finite structure and a class of finite structures such that (,𝔅) is a duality pair. Define :={𝔉𝔉 is injective}. Then (,𝔅) is a duality pair.

Note that Theorem 17 implies that if CSP(𝔅) is solved by a linear arc monadic Datalog program, then 𝔅 has caterpillar duality; the proof given in [16] only shows generalised caterpillar duality. However, Lemma 23 implies that 𝔅 in this case also has (injective) caterpillar duality.

In order to prove the implication (3) to (4) in Theorem 18, it only remains to prove that 𝔅 also has unfolded caterpillar duality (Lemma 25). We need the following lemma, which has already been mentioned in Section 2.6.

Lemma 24.

An unfolding of a caterpillar is a caterpillar as well.

Lemma 25.

If CSP(𝔅) is solved by a slam Datalog program Π, then 𝔅 has unfolded caterpillar duality.

From this we obtain the implication (4) to (5) in Theorem 18.

Lemma 26.

Let 𝔅 be a relational structure with unfolded caterpillar duality. If Pol(𝔅) does not satisfy a minor condition Σ, then Σ implies f(x)f(y).

3.3 Proof of the Main Result

We finally prove Theorem 18.

Proof of Theorem 18.

For the implication (1)(2) let ΠS be the canonical slam Datalog program for 𝔅 and let Π be the canonical linear arc monadic Datalog program for 𝔅. Since 𝔅 has k-absorptive operations of arity nk for all n,k1 we can apply Theorem 17 to conclude that Π solves CSP(𝔅). Furthermore, 𝔅 has a quasi Maltsev polymorphism. Hence, Lemma 21 implies that Π and ΠS can derive the goal predicate on the same instances of CSP(𝔅). Therefore, ΠS solves CSP(𝔅).

The implication (2)(3) is trivial, (3)(4) is Lemma 25, and (4)(5) is Lemma 26. For the implication from (5) to (6), suppose that Σ is a minor condition that holds in Pol(𝔓2). Since all polymorphisms of 𝔓2 are idempotent, Σ does not imply f(x)f(y). Hence, the contraposition of (5) implies that Pol(𝔅) does not satisfy Σ.

The implication from (6) to (1) is clear since Pol(𝔓2) is preserved by the Boolean minority operation and by the k-absorptive nk-ary Boolean operation

(x11,,x1k,,xn1,,xnk)i[n]j[k]xij

The equivalence between (6), (7), and (8) follows from Remark 5 and well-known general results [5].

The equivalence of (1) and (9) follows the equivalence of items (3) and (4) in Theorem 17 and from the fact that the existence of a quasi Maltsev polymorphism is preserved by homomorphic equivalence.

 Remark 27.

Consider the poset of all finite structures ordered by primitive positive constructability. It is well known that the structure 1:=({0},{(0,0)}) is a representative of the top element of this poset and that it has exactly one lower cover with representative 𝔅2. We claim that 𝔗3 is a representative of a lower cover of 𝔅2 in the poset of all finite structures ordered by primitive positive constructability. The structure 𝔗3:=({0,1,2},{(0,1),(0,2),(1,2)}) satisfies all conditions Σ that do not imply the quasi Maltsev condition (see, e.g., [9]). Clearly, 𝔗3 does not have a primitive positive construction from 𝔅2, because 𝔗3 does not have a quasi Maltsev polymorphism. Since min and max are polymorphisms of 𝔗3, Theorem 17 implies that 𝔗3 has kn-ary k-absorbing polymorphisms for all n,k1. Let 𝔅 be a structure with a primitive positive construction from 𝔗3 such that 𝔗3 does not have a pp-construction from 𝔅. Then 𝔅 must have a quasi Maltsev polymorphism and kn-ary k-absorbing polymorphisms for all n,k1. By Theorem 18, 𝔅 has a primitive positive construction from 𝔅2, which proves the claim. It is still open what other lower covers 𝔅2 has.

 Remark 28.

Another condition on finite structures 𝔅 that is equivalent to the conditions in Theorem 18 has been found by Vucaj and Zhuk [39]: they prove that there is a minion homomorphism from Pol(𝔓2) to Pol(𝔅) (item 7) if and only if Pol(𝔅) contains totally symmetric polymorphisms of all arities and generalised quasi minority polymorphisms of all odd arities n3. A operation f:BnB, for odd n3, is called a generalised quasi minority if it satisfies

f(x1,,xn) f(xπ(1),,xπ(n)) for every πSn
and f(x,x,x3,,xn) f(y,y,x3,x4,,xn).

However, it is not clear to us whether this characterisation can be used to prove the consequence of our main result from Remark 27.

 Remark 29.

Yet another remarkable equivalent condition for solvability by slam Datalog was very recently discovered by Meyer and Starke [34]: the conditions from Theorem 18 hold if and only if 𝔅 can neither pp-construct 𝔗3 nor any structure from a list of structures that correspond to the finite simple groups with a particular action; for details, we refer to [34].

4 Decidability of Meta-Problem

There are many interesting results and open problems about algorithmic meta-problems in constraint satisfaction; we refer to [18]. The natural algorithmic meta-problem in the context of our work is the one addressed in the following proposition.

Proposition 30.

There is an algorithm which decides in deterministic doubly-exponential time whether the CSP of a given finite structure 𝔅 can be solved by a slam Datalog program, and if so, computes such a program.

Proof.

The following algorithm can be used to test whether 𝔅 has k-absorptive operations of arity nk, for all n,k1. It is well-known that the existence of a quasi Maltsev polymorphism can be decided in non-deterministic polynomial time (see, e.g., [18]). Hence, the statement then follows from Theorem 18.

Let m be the maximal arity of the relations of 𝔅. Let n0:=m(|B||B|/2) and k0:=m|B|. Note that 𝔅 has k-absorptive polymorphisms of arity nk, for all k,n, if and only if it has k0-absorptive polymorphisms of arity n0k0 (similarly as the well-known fact that 𝔅 has totally symmetric polymorphisms of all arities if and only if it has totally symmetric polymorphisms of arity m|B|; the term (|B||B|/2) bounds the size of antichains in the set of all subsets of B. Also see [15] for the case of k-absorptive polymorphisms). Let Σ be the minor condition for the existence of k0-absorptive operations of arity n0k0. Let be the indicator structure of Σ with respect to 𝔅 as defined in Section A.1; clearly, this structure can be computed in doubly exponential time. We may then find a non-deterministic algorithm with the same time bound that tests whether there exists a homomorphism from to 𝔅. The non-determinism for checking whether 𝔅 can be eliminated by standard self-reduction techniques (again see, e.g., [18]). For the second part of the statement, note that there are for a given 𝔅 only finitely many potential rules of a slam Datalog program, and one can compute for a given rule whether it is part of the canonical slam Datalog program of CSP(𝔅).

5 Conclusion and Open Problems

We characterised the unique submaximal element in the primitive positive constructability poset on finite structures, linking concepts from homomorphism dualities, Datalog fragments, minor conditions, and minion homomorphisms. It is now tempting to further descend in the pp-constructability poset of finite structures in order to obtain a more systematic understanding. Particularly attractive are other dividing lines in the poset that are relevant for the complexity of the constraint satisfaction problem. We propose the following problems for future research.

  • Characterise all finite structures that are primitively positively constructible in a finite structure that has finite duality. Are these exactly the finite structures whose polymorphism clones have Hagemann-Mitschke chains of some length and extended k-absorptive polymorphisms of arity kn+1, for all n,k1, as defined in [16]? Is there a Datalog fragment that corresponds to this class?

  • What is the precise computational complexity the Meta-Problem of deciding whether the CSP of a given finite structure 𝔅 can be solved by a slam Datalog program? Proposition 30 only provides a deterministic doubly exponential time algorithm.

References

  • [1] Foto N. Afrati and Stavros S. Cosmadakis. Expressiveness of restricted recursive queries (extended abstract). In David S. Johnson, editor, Proceedings of the 21st Annual ACM Symposium on Theory of Computing, May 14-17, 1989, Seattle, Washigton, USA, pages 113–126. ACM, 1989. doi:10.1145/73007.73018.
  • [2] Albert Atserias, Andrei A. Bulatov, and Anuj Dawar. Affine systems of equations and counting infinitary logic. Theoretical Computer Science, 410(18):1666–1683, 2009. doi:10.1016/J.TCS.2008.12.049.
  • [3] L. Barto, M. Kozik, and R. Willard. Near unanimity constraints have bounded pathwidth duality. In Proceedings of the 27th ACM/IEEE Symposium on Logic in Computer Science (LICS), pages 125–134, 2012.
  • [4] Libor Barto and Marcin Kozik. Constraint satisfaction problems of bounded width. In Proceedings of the Annual Symposium on Foundations of Computer Science (FOCS), pages 595–603, 2009. doi:10.1109/FOCS.2009.32.
  • [5] Libor Barto, Jakub Opršal, and Michael Pinsker. The wonderland of reflections. Israel Journal of Mathematics, 223(1):363–398, 2018.
  • [6] Manuel Bodirsky. Graph homomorphisms and universal algebra. Lecture Notes, https://wwwpub.zih.tu-dresden.de/~bodirsky/GH-UA.pdf, 2023.
  • [7] Manuel Bodirsky, Jakub Bulín, Florian Starke, and Michael Wernthaler. The smallest hard trees. Constraints, abs/2205.07528, 2022. doi:10.48550/arXiv.2205.07528.
  • [8] Manuel Bodirsky and Víctor Dalmau. Datalog and constraint satisfaction with infinite templates. Journal on Computer and System Sciences, 79:79–100, 2013. A preliminary version appeared in the proceedings of the Symposium on Theoretical Aspects of Computer Science (STACS’05). doi:10.1016/J.JCSS.2012.05.012.
  • [9] Manuel Bodirsky and Florian Starke. Maximal digraphs with respect to primitive positive constructability. Combinatorica, 42:997–1010, 2022. doi:10.1007/S00493-022-4918-1.
  • [10] Manuel Bodirsky and Florian Starke. Symmetric linear arc monadic datalog and gadget reductions. https://arxiv.org/abs/2407.04924, 2025.
  • [11] Manuel Bodirsky, Florian Starke, and Albert Vucaj. Smooth digraphs modulo primitive positive constructability and cyclic loop conditions. International Journal on Algebra and Computation, 31(5):939–967, 2021. Preprint available at ArXiv:1906.05699.
  • [12] Andrei A. Bulatov. A dichotomy theorem for nonuniform CSPs. In 58th IEEE Annual Symposium on Foundations of Computer Science, FOCS 2017, Berkeley, CA, USA, October 15-17, pages 319–330, 2017. doi:10.1109/FOCS.2017.37.
  • [13] Andrei A. Bulatov, Andrei Krokhin, and Benoit Larose. Dualities for Constraint Satisfaction Problems, pages 93–124. Springer Berlin Heidelberg, Berlin, Heidelberg, 2008. doi:10.1007/978-3-540-92800-3_5.
  • [14] Jakub Bulín, Andrei A. Krokhin, and Jakub Opršal. Algebraic approach to promise constraint satisfaction. In Proceedings of the 51st Annual ACM SIGACT Symposium on Theory of Computing, STOC 2019, Phoenix, AZ, USA, June 23-26, 2019, pages 602–613, 2019. doi:10.1145/3313276.3316300.
  • [15] Catarina Carvalho, Víctor Dalmau, and Andrei Krokhin. CSP duality and trees of bounded pathwidth. Theoretical Computer Science, 411:3188–3208, 2010. doi:10.1016/J.TCS.2010.05.016.
  • [16] Catarina Carvalho, Víctor Dalmau, and Andrei A. Krokhin. Two new homomorphism dualities and lattice operations. J. Log. Comput., 21(6):1065–1092, 2011. doi:10.1093/LOGCOM/EXQ030.
  • [17] Ashok K. Chandra and Philip M. Merlin. Optimal implementation of conjunctive queries in relational data bases. In Proceedings of the Symposium on Theory of Computing (STOC), pages 77–90, 1977. doi:10.1145/800105.803397.
  • [18] Hubie Chen and Benoît Larose. Asking the metaquestions in constraint tractability. TOCT, 9(3):11:1–11:27, 2017. doi:10.1145/3134757.
  • [19] Víctor Dalmau. Linear Datalog and bounded path duality of relational structures. Logical Methods in Computer Science, 1(1), 2005. doi:10.2168/LMCS-1(1:5)2005.
  • [20] Víctor Dalmau and Benoît Larose. Maltsev + Datalog → symmetric Datalog. In Proceedings of the Twenty-Third Annual IEEE Symposium on Logic in Computer Science, LICS 2008, 24-27 June 2008, Pittsburgh, PA, USA, pages 297–306. IEEE Computer Society, 2008.
  • [21] Victor Dalmau and Jakub Opršal. Local consistency as a reduction between constraint satisfaction problems, 2023. arXiv:2301.05084.
  • [22] Víctor Dalmau and Justin Pearson. Closure functions and width 1 problems. In Proceedings of the International Conference on Principles and Practice of Constraint Programming (CP), pages 159–173, 1999. doi:10.1007/978-3-540-48085-3_12.
  • [23] László Egri, Benoit Larose, and Pascal Tesson. Symmetric Datalog and constraint satisfaction problems in logspace. In Proceedings of the Symposium on Logic in Computer Science (LICS), pages 193–202, 2007.
  • [24] László Egri, Benoît Larose, and Pascal Tesson. Directed st-connectivity is not expressible in symmetric Datalog. In Automata, Languages and Programming, 35th International Colloquium, ICALP 2008, Reykjavik, Iceland, July 7-11, 2008, Proceedings, Part II - Track B: Logic, Semantics, and Theory of Programming & Track C: Security and Cryptography Foundations, pages 172–183, 2008. doi:10.1007/978-3-540-70583-3_15.
  • [25] Tomás Feder and Moshe 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. doi:10.1137/S0097539794266766.
  • [26] P. Hell, J. Nešetřil, and X. Zhu. Duality and polynomial testing of tree homomorphisms. TAMS, 348(4):1281–1297, 1996.
  • [27] Pavol Hell and Jaroslav Nešetřil. Graphs and Homomorphisms. Oxford University Press, Oxford, 2004.
  • [28] Wilfrid Hodges. A shorter model theory. Cambridge University Press, Cambridge, 1997.
  • [29] P. C. Kanellakis. Logic programming and parallel complexity, pages 547–585. Morgan Kaufmann Publishers Inc., San Francisco, CA, USA, 1988. Book chapter in ‘Foundations of Deductive Databases and Logic Programming’.
  • [30] Alexandr Kazda. n-permutability and linear Datalog implies symmetric Datalog. Logical Methods in Computer Science, Volume 14, Issue 2, April 2018. doi:10.23638/LMCS-14(2:3)2018.
  • [31] Marcin Kozik, Andrei Krokhin, Matt Valeriote, and Ross Willard. Characterizations of several Maltsev conditions. Algebra universalis, 73(3):205–224, 2015. doi:10.1007/s00012-015-0327-2.
  • [32] Benoit Larose and Pascal Tesson. Universal algebra and hardness results for constraint satisfaction problems. Theoretical Computer Science, 410(18):1629–1647, 2009. doi:10.1016/J.TCS.2008.12.048.
  • [33] Benoit Larose and László Zádori. Bounded width problems and algebras. Algebra Universalis, 56(3-4):439–466, 2007.
  • [34] Sebastian Meyer and Florian Starke. Finite simple groups in the primitive positive constructability poset, 2024. arXiv:2409.06487.
  • [35] Reinhard Pöschel and Lev A. Kalužnin. Funktionen- und Relationenalgebren. Deutscher Verlag der Wissenschaften, Berlin, 1979.
  • [36] Benjamin Rossman. Homomorphism preservation theorems. Journal of the ACM, 55(3), 2008. doi:10.1145/1379759.1379763.
  • [37] Thomas J. Schaefer. The complexity of satisfiability problems. In Proceedings of the Symposium on Theory of Computing (STOC), pages 216–226, 1978. doi:10.1145/800133.804350.
  • [38] Florian Starke. Digraphs modulo primitive positive constructability. Preprint, 2024. PhD dissertation, Institute of Algebra, TU Dresden.
  • [39] Albert Vucaj and Dmitriy Zhuk. Submaximal clones over a three-element set up to minor-equivalence, 2024. arXiv:2304.12807.
  • [40] Dmitriy Zhuk. A proof of the CSP dichotomy conjecture. J. ACM, 67(5):30:1–30:78, 2020. doi:10.1145/3402029.
  • [41] Dmitriy N. Zhuk. A proof of CSP dichotomy conjecture. In 58th IEEE Annual Symposium on Foundations of Computer Science, FOCS 2017, Berkeley, CA, USA, October 15-17, pages 331–342, 2017. URL: https://arxiv.org/abs/1704.01914.

Appendix A Appendix

A.1 Indicator Structures

In this section we revisit a common theme in constraint satisfaction, the concept of an indicator structure of a minor condition. To simplify the presentation, we only define the indicator structure for minor conditions with only one function symbol. For our purposes, this is without loss of generality, because for clones over a finite domain, every minor condition is equivalent to such a restricted minor condition. If f:CnC and g:CmC are operations, then the star product fg is defined to be the operation defined as

(x1,1,,xn,m)f(g(x1,1,,x1,m),,g(xn,1,,xn,m)).
Lemma 31.

Let Σ be a minor condition. Then there exists a minor condition Σ with a single function symbol such that a clone over a finite domain satisfies Σ if and only if it satisfies Σ.

Proof.

First note that for every clone 𝒟 on a finite set there exists an idempotent clone 𝒞 on a finite set which is equivalent to it with respect to minion homomorphisms, i.e., there are minion homomorphism from 𝒟 to 𝒞 and vice versa. It is well-known and easy to see that if f1,,fn are the function symbols that appear in Σ, and 𝒞 satisfies Σ, 𝒞 also contains an operation g of arity m such that for every i[n] there exists αi:[m][k] such that gαi=fi (use that 𝒞 is closed under the star product and idempotent). Note that 𝒞 satisfies a minor identity (fi)β(fj)γ if and only if 𝒞 satisfies a minor identity (gαi)β(gαj)γ.

If 𝔅 is a relational τ-structure and is an equivalence relation on B, the 𝔅/ is the τ-structure whose domain are the equivalence classes of , and where R(C1,,Ck) holds if there exist a1C1,,akCk such that R(a1,,ak) holds in 𝔅.

Definition 32.

Let 𝔅 be a relational τ-structure and let Σ be a minor condition with a single function symbol f of arity m. Let be the smallest equivalence relation on Bm such that ab if Σ contains f(x1,,xm)f(y1,,ym) such that there is a map s:{x1,,xm,y1,,ym}B with a=(s(x1),,s(xm)) and b=(s(y1),,s(ym)). Then the indicator structure of Σ with respect to 𝔅 is the τ-structure 𝔅m/.

The following is straightforward from the definitions.

Lemma 33.

Let 𝔅 be a structure and Σ be a minor condition with a single function symbol f. Then 𝔅 has a polymorphism satisfying Σ if and only if the indicator structure of Σ with respect to 𝔅 has a homomorphism to 𝔅.

Appendix B Remarks on Related Results

The following remarks show that the results of Carvalho, Dalmau and Krokhin [15] can be extended in the same spirit as our Theorem 18.

 Remark 34.

Let 𝔇2 be the structure ({0,1};{0},{1},), also known as st-Con. Theorem 17 of Carvalho, Dalmau and Krokhin can be extended in the same spirit as our Theorem 18, by adding the following equivalent items:

  1. 5.

    Every minor condition that holds in Pol(𝔇2) also holds in Pol(𝔅).

  2. 6.

    There is a minion homomorphism from Pol(𝔇2) to Pol(𝔅).

  3. 7.

    𝔅 has a primitive positive construction from 𝔇2.

Proof.

The equivalence of 5., 6., and 7.  follows immediately from the general results in [5].

4.7. It is well known that Pol(𝔇2) is generated by the two binary operations and .666Proof sketch: clearly, and preserve the relations of 𝔇2. For the converse inclusion, it suffices to verify that every relation that is preserved by and has a primitive positive definition in 𝔇2 (see, e.g. [35]). Every Boolean relation preserved by and has a definition in CNF which is both Horn and dual Horn, so consists of clauses that can be defined using the relations in 𝔇2. This implies the claim. Let 𝔅 be a structure that is homomorphically equivalent to a structure 𝔅 with binary polymorphisms and such that (B,,) is a distributive lattice. Note that ({0,1},,) is a distributive lattice as well. Let ι be the map that maps terms over , to terms over , by replacing and by and , respectively. Define the map ξ:Pol(𝔇2)Pol(𝔅) as follows. Since Pol(𝔇2) is generated by and , for every fPol(𝔇2) there is a {,}-term t whose term operation is f. Define ξ(f) as the term operation of ι(t). Note that this term operation is a polymorphism of 𝔅. It is clear that ξ is a minion homomorphism (even a clone homomorphism). We still need to show that ξ is well defined. Let t and t be two {,}-terms that both have the term operation fPol(𝔇2). Since ({0,1},,) is a distributive lattice, there is a set of subsets of [n] such that f is the term operation of s:=IiIxi. Furthermore, t and t can both be rewritten (using associativity, commutativity, distributivity, and idempotence) into the term s. Therefore, ι(t) and ι(t) can also both be rewritten into the term ι(s). Since (B,,) is a distribute lattice, the term operations of ι(t), ι(t), and ι(s) are the same. Hence, ξ is well defined.

5.4. holds since 𝔇2 has for every n,k1 a k-absorbing polymorphism of arity kn.

 Remark 35.

We consider the structure 𝔅=({0,1},𝟎,,R1,R2,) where 𝟎:={0}, :={(0,0),(0,1),(1,1)}, and Rn:={0,1}n{(0,,0)} for every n1. It is well known that Pol(𝔅) is generated by the operation m given by (x,y,z)x(yz). Carvalho, Dalmau and Krokhin also introduce another type of duality in their paper: jellyfish duality. Their characterization in Theorem 18 in [15] can be extended by the following items:

  1. 6.

    Every minor condition that holds in Pol(𝔅) also holds in Pol(𝔅).

  2. 7.

    There is a minion homomorphism from Pol(𝔅) to Pol(𝔅).

  3. 8.

    𝔅 has a primitive positive construction from 𝔅.

The proof of Remark 35 is mostly analogous to the previous one. Here we only sketch the proof that Pol(𝔅) is generated by the operation m given by (x,y,z)x(yz).

Clearly, every relation of 𝔅 is preserved by the operation m. For the converse inclusion, it suffices to verify that every relation that is preserved by m has a primitive positive definition in 𝔅 (see, e.g., [35]). First note that m(x,y,y)=xy, and hence every Boolean relation R preserved by m has a Horn definition; pick such a definition ϕ which is shortest possible. Suppose for contradiction that a Horn clause in ϕ contains a positive literal ψ1 and two negative literals ψ2 and ψ3. By the minimality assumption there are tuples t1,t2,t3R such that ti satisfies ϕi and no other literal in that clause. Then m(t1,t2,t3) satisfies none of ψ1,ψ2,ψ3, a contradiction. It follows that each clause can be defined using the relations in 𝔅 and the statement follows.