key: cord-0060834-wbbmwekh authors: Bodirsky, Manuel; Knäuer, Simon title: Hardness of Network Satisfaction for Relation Algebras with Normal Representations date: 2020-04-01 journal: Relational and Algebraic Methods in Computer Science DOI: 10.1007/978-3-030-43520-2_3 sha: 8d8746e772a36f9c2365dbe9dbef677044f29ea6 doc_id: 60834 cord_uid: wbbmwekh We study the computational complexity of the general network satisfaction problem for a finite relation algebra A with a normal representation B. If B contains a non-trivial equivalence relation with a finite number of equivalence classes, then the network satisfaction problem for A is NP-hard. As a second result, we prove hardness if B has domain size at least three and contains no non-trivial equivalence relations but a symmetric atom a with a forbidden triple (a, a, a), that is, [Formula: see text]. We illustrate how to apply our conditions on two small relation algebras. square, and homogeneous [Hir96] . The network satisfaction problem for a relation algebra with a normal representation can be seen as the constraint satisfaction problem for an infinite structure B that is homogeneous and finitely bounded (these concepts from model theory will be introduced in Sect. 3). The network satisfaction problem is in this case in NP and a complexity dichotomy has been conjectured [BPP14] . There is even a promising candidate condition for the boundary between NP-completeness and containment in P; the condition can be phrased in several equivalent ways [BKO+17, Bod18] . However, this conjecture has not yet been verified for the homogeneous finitely bounded structures that arise as the normal representation of a finite relation algebra. We present some first steps towards a solution to the RBCP for relation algebras A with a normal representation B. Our approach is to study the automorphism group Aut(B) of B and to identify properties that imply hardness. Because of the homogeneity of B, one can translate back and forth between properties of A and properties of Aut(B). For example, Aut(B) is primitive if and only if A contains no equivalence relation which is different from the trivial equivalence relations Id and 1. Specifically, we show that the network satisfaction problem for A is NP-complete if -Aut(B) is primitive, |B| > 2 and A has a symmetric atom a with a forbidden triple (a, a, a), that is, a ≤ a • a (Sect. 5); -Aut(B) has a congruence with at least two but finitely many equivalence classes (Sect. 6). In our proof we use the so-called universal-algebraic approach which has recently led to a full classification of the computational complexity of constraint satisfaction problems for B if the domain of B is finite [Bul17, Zhu17] . The central insight is that the complexity of the CSP is for finite B fully determined by the polymorphism clone Pol(B) of B. This result extends to homogeneous structures with finite relational signature (more generally, to ω-categorical structures [BN06] ). Both of our hardness proofs come from the technique of factoring Pol(B) with respect to a congruence with finitely many classes, and using known hardness conditions from corresponding finite-domain constraint satisfaction problems. The article is fully self-contained: we introduce the network satisfaction problem (Sect. 2), normal representations (Sect. 3), and the universal algebraic approach (Sect. 4). Network satisfaction problems have been introduced in [LM94], capturing well-known computational problems, e.g., for Allen's Interval Algebra [All83] ; see [Dün05] for a survey. An algebra in the sense of universal algebra is a set together with operations on this set, each equipped with an arity n ∈ N. In this context, operations of arity zero are viewed as constants. The type of an algebra is a tuple that represents the arities of the operations. For the definitions concerning relation algebras, we basically follow [Mad06] . Definition 1. Let D be a set and E ⊆ D 2 an equivalence relation. Let (P(E); ∪,¯, 0, 1, Id, , •) be an algebra of type (2, 1, 0, 0, 0, 1, 2) with the following operations: A subalgebra of (P(E); ∪,¯, 0, 1, Id, , •) is called a proper relation algebra. A representable relation algebra is an algebra of type (2, 1, 0, 0, 0, 1, 2) that is isomorphic (as an algebra) to a proper relation algebra. We denote algebras by bold letters, like A; the underlying domain of an algebra A is denoted with the regular letter A. An algebra A is finite if A is finite. We do not need the more general definition of an (abstract) relation algebra (for a definition see for example [Mad06] ) because the network satisfaction problem for relation algebras that are not representable is trivial. We use the language of model theory to define representations of relation algebras; the definition is essentially the same as the one given in [Mad06] . -B is an A-structure with domain B (i.e., each element a ∈ A is used as a relation symbol denoting a binary relation a B on B); -there exists an equivalence relation E ⊆ B 2 such that the set of relations of B is the domain of a subalgebra of (P(E); ∪,¯, 0, 1, Id, , •); -the map that sends a ∈ A to a B is an isomorphism between A and this subalgebra. Remark 3. For a relation algebra A = (A; ∪,¯, 0, 1, Id, , •) the algebra (A; ∪,¯, 0, 1) is a Boolean algebra. With respect to this algebra there is a partial ordering on the elements of a relation algebra. We denote this with ⊆ since in proper relation algebras this ordering is with respect to set inclusion. The minimal non-empty relations with respect to ⊆ are called the atomic relations or atoms; we denote the set of atoms of A by A 0 . Definition 5. The (general) network satisfaction problem for a finite relation algebra A, denoted by NSP(A), is the problem of deciding whether a given Anetwork is satisfiable. We recall a connection between network satisfaction problems and constraint satisfaction problems that is presented in more detail in [BJ17, Bod18] . Definition 6 (from [Hir96] The last line ensures a "local consistency" of the atomic A-network with respect to the multiplication rules in the relation algebra A. This property is in the literature sometimes called "closedness" of an A-network [Hir97] . Definition 7 (from [Hir96] If a relation algebra A has a normal representation B then the problem of deciding whether an A-network is satisfiable in some representation reduces to a question whether it is satisfiable in the concrete representation B. Such decision problems are known as constraint satisfaction problems, which are formally defined in the following. Definition 8. Let B be a τ -structure for a finite relational signature τ . The constraint satisfaction problem of B is the problem of deciding for a given finite τ -structure C whether there exists a homomorphism from C to B. To formulate the connection between NSPs and CSPs, we have to give a translation between networks and structures. On the one hand we may view On the other hand we can transform an A-structure C into an Anetwork (V ; f ) with V = C and by defining the network function f (x, y) for x, y ∈ C as follows: let X be the set of all relations that hold on (x, y) in C. If X is non-empty we define f (x, y) := X; otherwise f (x, y) := 1. Proposition 9 (see [Bod18] ). Let B be a normal representation of a finite relation algebra A. Then NSP(A) and CSP(B) are the same problem (up to the translation showed above). The following is an important notion in model theory and the study of infinite-domain CSPs. Let F be a finite set of finite τ -structures. Then Forb(F) is the class of all finite τ -structures that embed no C ∈ F. A class C of finite τ -structures is called finitely bounded if C = Forb(F) for a finite set F. A structure B is called finitely bounded if the class of finite structures that embed into B is finitely bounded. Proposition 10 (see [Bod18] ). Let A be a finite relation algebra with a normal representation B. Then B is finitely bounded and CSP(B) and NSP(A) are in NP. This section gives a short overview of the important notions and concepts for the universal-algebraic approach to the computational complexity of CSPs. We start with the definition of an operation clone. if it contains all projections and is closed under composition, that is, for every f ∈ C and all g 1 , . . . , g k ∈ C the n-ary operation f (g 1 , . . . , g k ) with is also in C . We denote the k-ary operations of C by C [k] . Polymorphisms are closed under the composition and a projection is always a polymorphism, therefore a polymorphism clone is indeed an operation clone. Definition 13 Let C and D be operation clones. A function μ : C → D is called minor-preserving if it maps every operation to an operation of the same arity and satisfies for every f ∈ Pol k (C ) and all projections p 1 , . . . , p k ∈ Pol (n) (B) the following identity: Operation clones C on countable sets B can be equipped with the following complete ultrametric d. Assume that B = N. For two polymorphisms f and g of different arity we define d(f, g) = 1. If f and g are both of arity k we have The following is a straightforward consequence of the definition. In order to demonstrate the use of polymorphisms in the study of CSPs we have to define primitive positive formulas. Let τ be a relational signature. A first-order formula ϕ( where ϕ 1 , . . . , ϕ s are atomic formulas, i.e., formulas of the form R(y 1 , . . . , y l ) for R ∈ τ and y i ∈ {x 1 , . . . , x m }, of the form y = y for y, y ∈ {x 1 , . . . x m }, or of the form false and true. We have the following correspondence between polymorphisms and primitive positive formulas (or relations that are defined by them). Note that all of the statements in the following hold in a more general setting, but we only state them here for normal representations of finite relation algebras. Theorem 15 (follows from [BN06] ). Let B be a normal representation of a finite relation algebra A. Then the set of primitive positive definable relations in B is exactly the set of relations that are preserved by Pol(B). A special type of polymorphism plays an important role in our analysis. Definition 16. Let f be an n-ary operation on a countable set X. Then f is called cyclic if We write Proj for the operation clone on a two-element set that consists of only the projections. Theorem 17 (from [BK12, BOP18] ). Let C be an operation clone on a finite set C. If there exists no minor-preserving map C → Proj then C contains for every prime p > |C| a p-ary cyclic operation. Note that every map between operation clones on finite domains is uniformly continuous. Theorem 18 (from [BOP18] ). Let B be normal representation of a finite relation algebra. If there is a uniformly continuous minor-preserving map Pol(B) → Proj, then CSP(B) is NP-complete. Let B be a normal representation of a finite relation algebra A. Definition 19 . Let a 1 , . . . , a k ∈ A. Then (a 1 , . . . , a k ) B denotes a binary relation on B k such that for x, y ∈ B k (a 1 , . . . , a k Recall that A 0 denotes the set of atoms of a representable relation algebra A. Definition 20. Let x, y ∈ B k . Since B is square there are unique a 1 , . . . , a k ∈ A 0 such that (a 1 , . . . , a k ) B (x, y). Then we call (a 1 , . . . , a k ) B the configuration of (x, y) . If a 1 , . . . , a k ∈ X ⊆ A 0 then (a 1 , . . . , a k ) is called an X-configuration. We specialise the concept of canonical functions (see, e.g., [BP16] ) to our setting. Definition 21. Let f be a k-ary operation on B. Let X ⊆ A 0 and let T be the set of all X-configurations. Then f is called X-canonical if there exists a map f : T → A 0 such that for every (a 1 , . . . , a k ) ∈ T and (x, y) ∈ (a 1 , . . . , a k (a 1 , . . . , a k If B is a finite structure such that every polymorphism of B is conservative, then CSP(B) has been classified already before the proof of the Feder-Vardi conjecture, and there are several proofs [Bul03, Bul14, Bar11] . The polymorphisms of normal representations of finite relation algebras satisfy a strong property that resembles conservativity. Proposition 22. Let B be a normal representation. Then every f ∈ Pol (n) is edge-conservative, that is, for all x, y ∈ B n with configuration (a 1 , . . . , a n ) B it holds that Proof. By definition, b := i∈{1,...,n} a i is part of the signature of B. Moreover, for every i ∈ {1, . . . , n} we have that (x i , y i ) ∈ b B by the assumption on the configuration of x and y. Then (f (x), f(y)) ∈ b B because f preserves b B . In the following, A denotes a finite relation algebra with a normal representation B. Theorem 23. Suppose that e ∈ A is such that e B is a non-trivial equivalence relation with finitely many classes. Then CSP(B) is NP-complete. Proof. We use the notation n : Suppose for contradiction that C contains a p-ary cyclic operation for every prime p > m. Case 1: m = 2. By assumption there exists a ternary cyclic operation f ∈ C . Since e B is non-trivial, one of the equivalence classes of e B must have size at least two. So we may without loss of generality assume that c 1 contains at least two elements. Let c 1 ∈ c 1 with c 1 = c 1 . We have that f (c 1 , c 1 , c 2 ) = f (c 2 , c 1 , c 1 ) which means that (1) On the other hand (n, Id, n) B (c 1 , c 1 , c 2 ), (c 2 , c 1 , c 1 ) . Since f is an edge conservative polymorphism we have that Combining (1) and (2) we obtain that Similarly, f (c 2 , c 1 , c 1 ) = f (c 1 , c 2 , c 1 ). Since f preserves the equivalence relation e B we also have f (c 1 , c 2 , c 1 ), f(c 1 , c 2 , c 1 ) ∈ e B . But then (f (c 2 , c 1 , c 1 ), f(c 1 , c 2 , c 1 ) ) ∈ e B holds. Also note that (n, n, Id) B (c 2 , c 1 , c 1 ), (c 1 , c 2 , c 1 ) implies that f (c 2 , c 1 , c 1 ), f(c 1 , c 2 , c 1 ) ∈ (n ∪ Id) B . These two facts together imply f (c 2 , c 1 , c 1 ) = f (c 1 , c 2 , c 1 ). By (3) and the transitivity of equality we get f (c 1 , c 1 , c 2 ) = f (c 1 , c 2 , c 1 ) . But this is impossible because (e, n, n) B (c 1 , c 1 , c 2 ), (c 1 , c 2 , c 1 ) implies that f (c 1 , c 1 , c 2 ) = f (c 1 , c 2 , c 1 ) . Case 2: m > 2. Let f be a p-ary cyclic operation for some prime p > m. Consider the representatives c 1 , c 2 and c 3 . By the cyclicity of f we have f (c 1 , c 2 , . . . , c 1 , c 2 , c 3 ) = f (c 3 , c 1 , c 2 . . . , c 1 , c 2 ) and therefore f (c 1 , c 2 , . . . , c 1 , c 2 , c 3 ), f(c 3 , c 1 , c 2 . . . , c 1 , c 2 On the other hand, n, n, . . . , n, n) B (c 1 , c 2 , . . . , c 1 , c 2 , c 3 ), (c 3 , c 1 , c 2 . . . , c 1 , c 2 ) and since f preserves n B we get that contradicting (4). We showed that there exists a prime p > m such that C does not contain a p-ary cyclic polymorphism and therefore Theorem 17 implies the existence of a (uniformly continuous) minor-preserving map ν : C → Proj. Since the composition of uniformly continuous minor-preserving maps is again uniformly continuous and minor-preserving, there exists a uniformly continuous minor-preserving map ν • μ : Pol(B) → Proj. This map implies the NP-hardness of CSP(B) by Theorem 18. In this section A denotes a finite relation algebra with a normal representation B with |B| > 2. These elements are now all connected by the atomic relation a B . This is a contradiction to our assumption a B • a B = Id B . Higman's lemma states that a permutation group G on a set B is primitive if and only if for every two distinct elements x, y ∈ B the undirected graph with vertex set B and edge set {α(x), α(y)} | α ∈ G is connected (see, e.g., [Cam99] ). We need the following variant of this result for Aut(B); we also present its proof since we are unaware of any reference in the literature. If a ∈ A then a sequence Proof. If R is a binary relation then R k = R•R•· · ·•R denotes the k-th relational power of R. The sequence of binary relations L n := Id B ∪ n k=1 (a B ) 2k is nondecreasing by definition and terminates because all binary relations are unions of at most finitely many atoms. Therefore, there exists k ∈ N such for all n ≥ k we have L n = L k . Note that L k is an equivalence relation, namely the relation "there exists an a B -walk of even length between x and y". Since B is primitive L k must be trivial. If L k = B 2 then there exists an a B -walk of length 2k between any two x, y ∈ B and we are done. Otherwise, Since a is symmetric a B • a B = 0 and a B • a B contains therefore an atom. But then a B • a B ⊆ L k implies by Proposition 25 a B • a B = L k . This is a contradiction to Proposition 26. and (a, a, a) is forbidden. Then all polymorphisms of B are {Id, a}-canonical. In the proof, we need the following notation. Let a 1 , . . . , a k ∈ A be such that a 1 = . . . = a j and a j+1 = . . . = a k . Instead of writing (a 1 , . . . , a n ) B we use the shortcut (a 1 | j a j+1 ) B . Proof (of Lemma 28). The following ternary relation R on B is primitive positive definable in B. Observe that c ∈ R if and only if a B (c 1 , c 2 ) ∧ Id B (c 2 , c 3 ) or Id B (c 1 , c 2 ) ∧ a B (c 2 , c 3 ). Since (a, a, a) is forbidden, the second case holds. Note that A must have an atom b = Id such that the triple (a, a, b) is allowed, because otherwise a would be an equivalence relation. Now consider u, v, w ∈ B 3 such that We conclude that C 2 does not contain a ternary cyclic operation. Since the domain of C 2 has size two, Theorem 17 implies the existence of a u.c. minorpreserving map ν : C 2 → Proj. The composition ν • μ : Pol(B) → Proj is also a u.c. minor-preserving map and therefore by Theorem 18 the CSP(B) is NP-hard. Andréka and Maddux classified small relation algebras, i.e., finite relation algebras with at most 3 atoms [AM94] . We consider the complexity of the network satisfaction problem of two of them, namely the relation algebras #13 and #17 (we use the enumeration from [AM94] ). Both relation algebras have normal representations (see below) and fall into the scope of our hardness criteria. Cristani and Hirsch [CH04] classified the complexities of the network satisfaction problems for small relation algebras, but due to a mistake the algebras #13 and #17 were left open. Example 1 (Relation Algebra #13). The relation algebra #13 is given by the multiplication table in Fig. 1 . This finite relation algebra has a normal representation B defined as follows. Let V 1 and V 2 be countable, disjoint sets. We set B := V 1 ∪ V 2 and define the following atomic relations: It is easy to check that this structure is a square representation for #13. Moreover, this structure is fully universal for #13 and homogeneous, and therefore a normal representation. Note that the relation (Id ∪ a) B is an equivalence relation where V 1 and V 2 are the two equivalence classes. Therefore we get by Theorem 23 that the (general) network satisfaction problem for the relation algebra #13 is NP-hard. We mention that this result can also be deduced from the results in [BMPP19] . Example 2 (Relation Algebra #17). The relation algebra #17 is given by the multiplication table in Fig. 1 . Let N = (V ; E N ) be the countable, homogeneous, universal triangle-free, undirected graph (see [Hod97] ), also called a Henson graph. We use this Henson graph to obtain a square representation B with domain V for the relation algebra #17 as follows: This structure is homogeneous and fully universal since N is homogeneous and embeds every triangle free graph. It is easy to see that there exists no non-trivial equivalence relation in this relation algebra. For the atom a the triangle (a, a, a) is forbidden, which means we can apply Theorem 29 and get NP-hardness for the (general) network satisfaction problem for the relation algebra #17. Also in this case, the hardness result can also be deduced from the results in [BMPP19] . To the best of our knowledge the computational complexity of the (general) network satisfaction problem was previously only known for a small number of isolated finite relation algebras, for example the point algebra, Allens interval algebra, or the 18 small relation algebras from [AM94] . Both of our criteria, Theorems 23 and 29, show the NP-hardness for relatively large classes of finite relation algebras. In Sect. 7 we applied these results to settle the complexity status of two problems that were left open in [CH04] . To obtain our general hardness conditions we used the universal algebraic approach for studying the complexity of constraint satisfaction problems. This approach will hopefully lead to a solution of Hirsch's RBCP for all finite relation algebras A with a normal representation B. It is also relatively easy to prove that the network satisfaction problem for A is NP-complete if B has an equivalence relation with an equivalence class of finite size larger than two. Hence, the next steps that have to be taken with this approach are the following. -Classify the complexity of the network satisfaction problem for finite relation algebras A where the normal representation has a primitive automorphism group. -Classify the complexity of the network satisfaction problem for relation algebras that have equivalence relations with infinitely many classes of size two. -Classify the complexity of the network satisfaction problem for relation algebras that have equivalence relations with infinitely many infinite classes. Maintaining knowledge about temporal intervals Representations for small relation algebras The dichotomy for conservative constraint satisfaction problems revisited A model-theoretic view on qualitative constraint reasoning Determining the consistency of partial tree descriptions Absorbing subalgebras, cyclic terms and the constraint satisfaction problem The equivalence of two dichotomy conjectures for infinite domain constraint satisfaction problems Constraint satisfaction problems for reducts of homogeneous graphs Constraint satisfaction with countable homogeneous templates Finite relation algebras with normal representations The wonderland of reflections Canonical Functions: a Proof via Topological Dynamics Projective clone homomorphisms. Accepted for publication in the Tractable conservative constraint satisfaction problems Conservative constraint satisfaction revisited A dichotomy theorem for nonuniform CSPs Permutation Groups. LMS Student Text 45 The complexity of the constraint satisfaction problem for small relation algebras Relation algebras and their application in temporal and spatial reasoning Relation Algebras by Games Relation algebras of intervals Expressive power and complexity in algebraic logic A finite relation algebra with undecidable network satisfaction problem A Shorter Model Theory On binary constraint problems Relation Algebras On the complexity of qualitative spatial reasoning: a maximal tractable fragment of the region connection calculus Qualitative spatial reasoning using constraint calculi Constraint propagation algorithms for temporal reasoning: a revised report A proof of CSP dichotomy conjecture Let f be a polymorphism of B of arity n. Let x, y, u, v ∈ B n be arbitrary such that (x, y) and (u, v) have the same {Id, a}-configuration. Without loss of generality we may assume that (a| j Id) B (x, y) and (a| j Id) B (u, v). Now consider p, q ∈ B n such that (Id | j a) B (p, q) holds.Note that by the edge-conservativeness of f the following holds:By Lemma 27 there exists a k ∈ N such that for every i ∈ {1, . . . , n} there exists an a B -walk (s 0 i , . . . , s k i ) with s 0 i = y i and s k i = p i . Now consider the following walk in B n :Every three consecutive elements on this walk are component wise in the relation R. Since R is primitive positive definable the polymorphism f preserves R by Theorem 15. This means that f maps this walk on a walk where the atomic relations are an alternating sequence of a B and Id B , which impliesIf we repeat the same argument with a walk from q to v we get:Combining these two equivalences gives usSince the tuples x, y, u, v ∈ B n were arbitrary this shows that f is {Id, a}canonical.Theorem 29. Let Aut(B) be primitive and let a be a symmetric atom of A such that (a, a, a) is forbidden. Then CSP(B) is NP-hard.