Network satisfaction for symmetric relation algebras with a flexible atom
aa r X i v : . [ m a t h . L O ] A ug Network satisfaction for symmetric relationalgebras with a flexible atom
Manuel Bodirsky ⋆ and Simon Kn¨auer ⋆⋆ Institut f¨ur Algebra, TU Dresden, 01062 Dresden, Germany
Abstract.
Robin Hirsch posed in 1996 the
Really Big Complexity Prob-lem : classify the computational complexity of the network satisfactionproblem for all finite relation algebras A . We provide a complete clas-sification for the case that A is symmetric and has a flexible atom; theproblem is in this case NP-complete or in P. If a finite integral relationalgebra has a flexible atom, then it has a normal representation B . Wecan then study the computational complexity of the network satisfactionproblem of A using the universal-algebraic approach, via an analysis ofthe polymorphisms of B . We also use a Ramsey-type result of Neˇsetˇriland Rdl and a complexity dichotomy result of Bulatov for conservativefinite-domain constraint satisfaction problems. One of the earliest approaches to formalise constraint satisfaction problems overinfinite domains is based on relation algebras [27, 32]. We think about the ele-ments of a relation algebra as binary relations; the algebra has operations forintersection, union, complement, converse, and composition of relations, andconstants for the empty relation, the full relation, and equality, and is requiredto satisfy certain axioms. Important examples of relation algebras are the PointAlgebra, the Left Linear Point Algebra, Allen’s Interval Algebra, RCC5, andRCC8, just to name a few.The so-called network satisfaction problem for a finite relation algebra can beused to model many computational problems in temporal and spatial reasoning[8, 24, 40]. In 1996, Robin Hirsch [26] asked the
Really Big Complexity Problem(RBCP) : can we classify the computational complexity of the network satisfac-tion problem for every finite relation algebra? For example, the complexity of thenetwork satisfaction problem for the Point Algebra and the Left Linear PointAlgebra is in P [11, 42], while it is NP-complete for all of the other examplesmentioned above [1, 39]. There also exist relation algebras where the complexityof the network satisfaction problem is not in NP: Hirsch gave an example ofa finite relation algebra with an undecidable network satisfaction problem [28]. ⋆ The author has received funding from the European Research Council under the Eu-ropean Community’s Seventh Framework Programme (FP7/2007-2013 Grant Agree-ment no. 257039, CSP-Infinity) ⋆⋆ The author is supported by DFG Graduiertenkolleg 1763 (QuantLA). Manuel Bodirsky and Simon Kn¨auer
This result might be surprising at first sight; it is related to the fact that therepresentation of a finite relation algebra by concrete binary relations over someset can be quite complicated. We also mention that not every finite relation alge-bra has a representation [33]. There are even non-representable relation algebrasthat are symmetric [36]; a relation algebra is symmetric if every element is itsown converse.A simple condition that implies that a finite relation algebra has a represen-tation is the existence of a so-called flexible atom [22, 34], combined with theassumption that A is integral ; formal definitions can be found in Section 2. Suchrelation algebras have been studied intensively, for example in the context ofthe so-called flexible atoms conjecture [2, 35]. We will see that integral relationalgebras with a flexible atom even have a normal representation , i.e., a repre-sentation which is fully universal, square, and homogeneous [26]. The networksatisfaction problem for a relation algebra with a normal representation can beseen as a constraint satisfaction problem for an infinite structure B that is well-behaved from a model-theoretic point of view; in particular, we may choose B to be homogeneous and finitely bounded .Constraint satisfaction problems over finite domains have been studied in-tensively in the past two decades, and tremendous progress has been made con-cerning systematic results about their computational complexity. In 2017, Bula-tov [21] and Zhuk [43] announced proofs of the famous Feder-Vardi dichotomyconjecture which states that every finite-domain CSP is in P or NP-complete.Both proofs build on an important connection between the computational com-plexity of constraint satisfaction problems and central parts of universal algebra.The universal-algebraic approach can also be applied to study the compu-tational complexity of countably infinite homogeneous structures B with finiterelational signature [14]. If B is finitely bounded, then CSP( B ) is contained inNP. If B is homogeneous and finitely bounded then a complexity dichotomyhas been conjectured, along with a conjecture about the boundary between NP-completeness and containment in P [18]. We verify these conjectures for all nor-mal representations of finite integral symmetric relation algebras with a flexibleatom, and thereby also solve Hirschs RBCP for symmetric relation algebras witha flexible atom.The exact formulation of the conjecture from [18] in full generality requiresconcepts that we do not need to prove our results. Phrased in the terminologyof relation algebras, our result is the following. Theorem 1.
Let A be a finite integral symmetric relation algebra with a flexibleatom, and let A be the set of atoms of A . Then either – there exists an operation f : A → A that preserves the allowed triples of A and satisfies the Siggers identity ∀ x, y, z ∈ A : f ( x, x, y, y, z, z ) = f ( y, z, x, z, x, y ); in this case the network satisfaction problem for A is in P, or – the network satisfaction problem for A is NP-complete. etwork satisfaction for symmetric relation algebras with a flexible atom 3 This also implies a P versus NP-complete dichotomy theorem for network satis-faction problems of symmetric (not necessarily integral) relation algebras witha flexible atom, because for every finite relation algebra with a flexible atomthere exists an integral relation algebra with a flexible atom and polynomial-time equivalent network satisfaction problem (Proposition 25).
Every finite integral relation algebra A with a flexible atom has a normal repre-sentation B ; for completeness, and since we are not aware of a reference for thisfact, we include a proof in Section 3. It follows that the classification questionabout the complexity of the network satisfaction problem of A can be translatedinto a question about the complexity of the constraint satisfaction problem forthe relational structure B .We then associate a finite relational structure O to B and show that CSP( B )can be reduced to CSP( O ) in polynomial-time (Section 4). If the structure O satisfies the condition of the first case in Theorem 1, then known results aboutfinite-domain CSPs imply that CSP( O ) can be solved in polynomial-time [4,19, 20], and hence CSP( B ) is in P, too. If the first case in Theorem 1 does notapply, then known results about finite-domain algebras imply that there are a, b ∈ A such that the canonical polymorphisms of B act as a projection on { a, b } [4, 19, 20]. We first show NP-hardness of CSP( B ) if B does not have abinary injective polymorphism. If B has a binary injective polymorphism, weuse results from structural Ramsey theory to show that B must even have abinary injective polymorphism which is canonical. This implies that none of a, b equals Id ∈ A . We then prove that B does not have a binary { a, b } -symmetricpolymorphism; also in this step, we apply Ramsey theory. This in turn impliesthat all polymorphisms of B must be canonical on { a, b } . Finally, we show that B cannot have a polymorphism which acts as a majority or as a minority on { a, b } ,and thus by Schaefer’s theorem all polymorphisms of B act as a projection on { a, b } . It follows that CSP( B ) is NP-hard. This concludes the proof of Theorem 1. We recall some basic definitions and results about relation algebras, constraintsatisfaction, model theory, universal algebra, and structural Ramsey theory.
For relation algebras that are not representable the set of yes-instances of thenetwork satisfaction problem is empty (see Def. 6). We thus omit the definitionof relation algebras and start immediately with the simpler definition of repre-sentable relation algebras ; here we basically follow the textbook of Maddux [36].
Definition 2.
Let D be a set and E ⊆ D an equivalence relation.Let ( P ( E ); ∪ , ¯ , , , Id , ⌣ , ◦ ) be an algebra with the following operations: Manuel Bodirsky and Simon Kn¨auer a ∪ b := { ( x, y ) | ( x, y ) ∈ a ∨ ( x, y ) ∈ b } ,2. ¯ a := E \ a ,3. ∅ ,4. E ,5. Id := { ( x, x ) | x ∈ D } ,6. a ⌣ := { ( x, y ) | ( y, x ) ∈ a } ,7. a ◦ b := { ( x, z ) | ∃ y ∈ D : ( x, y ) ∈ a and ( y, z ) ∈ b } .A subalgebra of ( P ( E ); ∪ , ¯ , , , Id , ⌣ , ◦ ) is called a proper relation algebra . The class of representable relation algebras , denoted by RRA, consists of allalgebras of type (2 , , , , , ,
2) that are isomorphic to some proper relationalgebra. We use bold letters (such as A ) to denote algebras from RRA and thecorresponding roman letter (such as A ) to denote the domain of the algebra. Analgebra is called finite if its domain is finite. We call A ∈ RRA symmetric if allits elements are symmetric, i.e., a ⌣ = a for every a ∈ A .To link the theory of relation algebras with model theory, it will be convenientto view representations of algebras in RRA as relational structures. Definition 3.
Let A ∈ RRA . Then a representation of A is a relational struc-ture B such that – B is an A -structure, i.e., the elements of A are the relation symbols of B ; – The map a a B is an isomorphism between A and the proper relationalgebra induced by the relations of B in ( P (1 B ); ∪ , ¯ , , , Id , ⌣ , ◦ ) . We write ≤ for the partial order on A defined by x ≤ y : ⇔ x ∪ y = y . Notethat for proper relation algebras, this ordering coincides with the set-inclusionorder. The minimal elements of this order in A \ { } are called atoms . The setof atoms of A is denoted by A . A tuple ( x, y, z ) ∈ ( A ) is called an allowedtriple if z ≤ x ◦ y . Otherwise, ( x, y, z ) is called a forbidden triple . Definition 4.
Let A ∈ RRA . An A -network ( V ; f ) is a finite set V togetherwith a function f : V → A . An A -network ( V ; f ) is satisfiable in a representa-tion B of A if there exists an assignment s : V → B such that for all x, y ∈ V the following holds: ( s ( x ) , s ( y )) ∈ f ( x, y ) B . An A -network ( V ; f ) is satisfiable if there exists a representation B of A suchthat ( V ; f ) is satisfiable in B . We give an example of how an instance of a NSP for a relation algebra couldlook like. The numbering of the relation algebra is from [3].
Example 5 (An instance of
NSP of elation algebra ). Let A be the relationalgebra with the set of atoms { Id , a, b, } and the product rules given by the Table1. Note that the domain of A is the following set: A = {∅ , Id , a, b, Id ∪ a, Id ∪ b, a ∪ b, Id ∪ a ∪ b } . etwork satisfaction for symmetric relation algebras with a flexible atom 5 ◦ Id a b Id Id a ba a Id ∪ b a ∪ bb b a ∪ b Id ∪ a ∪ b Fig. 1.
Multiplication table of the relation algebra
Let V := { x , x , x } be a set. Consider the map f : V → A given by f ( x i , x i ) = Id for all i ∈ { , , } f ( x , x ) = f ( x , x ) = af ( x , x ) = f ( x , x ) = Id ∪ af ( x , x ) = f ( x , x ) = b ∪ a. The tuple ( V ; f ) is an example of an instance of NSP of the relation algebra A .We will in the following assume that for an A -network ( V ; f ) it holds that f ( V ) ⊆ A \ { } . Otherwise, ( V ; f ) is not satisfiable. Note that every A -network( V ; f ) can be viewed as an A -structure C on the domain V : for all x, y ∈ V and a ∈ A the relation a C ( x, y ) holds if and only if f ( x, y ) = a . Definition 6.
The (general) network satisfaction problem for a finite relationalgebra A , denoted by NSP( A ) , is the problem of deciding whether a given A -network is satisfiable. In this section we consider a subclass of RRA introduced by Hirsch in 1996. Forrelation algebras A from this class, NSP( A ) corresponds naturally to a constraintsatisfaction problem (CSP). In the last two decades a rich and fruitful theoryemerged to analyse the computational complexity of CSPs. We use this theoryto obtain results about the computational complexity of NSPs.In the following let A be in RRA. An A -network ( V ; f ) is called closed (tran-sitively closed in [27]) if for all x, y, z ∈ V it holds that f ( x, x ) ≤ Id, f ( x, y ) = f ( y, x ) ⌣ , and f ( x, z ) ≤ f ( x, y ) ◦ f ( y, z ). It is called atomic if the image of f onlycontains atoms from A . Definition 7 (from [26]).
Let B be a representation of A . Then B is called – fully universal , if every atomic closed A -network is satisfiable in B ; – square , if B = B ; – homogeneous , if for every isomorphism between finite substructures of B there exists an automorphism of B that extends this isomorphism; – normal , if it is fully universal, square and homogeneous. Manuel Bodirsky and Simon Kn¨auer
Definition 8.
Let τ be a relational signature. A first-order formula ϕ ( x , . . . , x n ) is called primitive positive (pp) if it has the form ∃ x n +1 , . . . , x m ( ϕ ∧ · · · ∧ ϕ s ) where ϕ , . . . , ϕ s are atomic formulas, i.e., formulas of the form R ( y , . . . , y l ) for R ∈ τ and y i ∈ { x , . . . , x m } , of the form y = y ′ for y, y ′ ∈ { x , . . . x m } , orof the form false . As usual, formulas without free variables are called sentences . Definition 9.
Let τ be a finite relational signature and let B be a τ -structure.Then the constraint satisfaction problem of B (CSP( B )) is the computationalproblem of deciding whether a given primitive positive τ -sentence holds in B . If B is a fully universal representation of A ∈ RRA, then NSP( A ) andCSP( B ) are the same problem (up to a straightforward translation between A -networks and A -sentences; see [8]). Let τ be a finite relational signature. The class of finite τ -structures that embedinto a τ -structure B is called the age of B , denoted by Age( B ). If F is a classof finite τ -structures, then Forb( F ) is the class of all finite τ -structures A suchthat no structure from F embeds into A . A class C of finite τ structures is called finitely bounded if there exists a finite set of finite τ -structures F such that C = Forb( F ). It is easy to see that a class C of τ -structures is finitely bounded ifand only if it is axiomatisable by a universal τ -sentence. A structure B is calledfinitely bounded if Age( B ) is finitely bounded. Definition 10.
A class of finite τ -structures has the amalgamation property iffor all structures A , B , B ∈ C with embeddings e : A → B and e : A → B there exist a structure C ∈ C and embeddings f : B → C and f : B → C suchthat f ◦ e = f ◦ e . If additionally f ( B ) ∩ f ( B ) = f ( e ( A )) = f ( e ( A )) ,then we say that C has the strong amalgamation property . Let B , B be τ -structures. Then B ∪ B is the τ -structure on the domain B ∪ B such that R B ∪ B := R B ∪ R B for every R ∈ τ . If Definition 10 holdswith C := B ∪ B then we say that C has the free amalgamation property ; notethat the free amalgamation property implies the strong amalgamation property. Theorem 11 (Fra¨ıss´e; see, e.g., [30]).
Let τ be a finite relational signatureand let C be a class of finite τ -structures that is closed under taking inducedsubstructures and isomorphisms and has the amalgamation property. Then thereexists an up to isomorphism unique countable homogeneous structure B suchthat C = Age( B ) . etwork satisfaction for symmetric relation algebras with a flexible atom 7 In this section we present basic notions for the so-called universal-algebraic ap-proach to the study of CSPs.
Definition 12.
Let B be some set. We denote by O ( n ) B the set of all n -aryoperations on B and by O B := S n ∈ N O ( n ) B the set of all operations on B . Aset C ⊂ O B is called an operation clone on B if it contains all projections of allarities and if it is closed under composition, i.e., for all f ∈ C ( n ) := C ∩ O ( n ) B and g , . . . , g n ∈ C ∩ O ( s ) B it holds that f ( g , . . . , g n ) ∈ C , where f ( g , . . . , g n ) isthe s -ary function defined as follows f ( g , . . . , g n )( x , . . . , x s ) := f ( g ( x , . . . , x s ) , . . . , g n ( x , . . . , x s )) . An operation f : B n → B is called conservative if for all x , . . . , x n ∈ B it holds that f ( x , . . . , x n ) ∈ { x , . . . , x n } . A clone is called conservative if alloperations are conservative. We later need the following classical result for clonesover a two-element set.
Theorem 13 ([38]).
Let C be a conservative operation clone on { , } . Theneither C contains only projections, or at least one of the following operations:1. the binary function min ,2. the binary function max ,3. the minority function,4. the majority function. Operation clones occur naturally as polymorphism clones of relational struc-tures. If a , . . . , a n ∈ B k and f : B n → B , then we write f ( a , . . . , a n ) for the k -tuple obtained by applying f component-wise to the tuples a , . . . , a n . Definition 14.
Let B a structure with a finite relational signature τ and let R ∈ τ . An n -ary operation preserves a relation R B if for all a , . . . , a n ∈ R B itholds that f ( a , . . . , a n ) ∈ R B . If f preserves all relations from B then f is called a polymorphism of B . The set of all polymorphisms (of all arities) of a relational structure B is anoperation clone on B , which is denoted by Pol( B ). A Siggers operation is anoperation that satisfies the Siggers identity (see Theorem 1).The following resultcan be obtained by combining known results from the literature.
Theorem 15 ([19, 41]; also see [4, 20]).
Let B be a finite structure with afinite relational signature such that Pol( B ) is conservative. Then either1. there exist distinct a, b ∈ B such that for every f ∈ Pol( B ) ( n ) the restrictionof f to { a, b } n is a projection. In this case, CSP( B ) is NP-complete.2. Pol( B ) contains a Siggers operation; in this case, CSP( B ) is in P. Manuel Bodirsky and Simon Kn¨auer
We now discuss fundamental results about the universal-algebraic approachfor constraint satisfaction problems of structures with an infinite domain.
Theorem 16 ([14]).
Let B be a homogeneous structure with finite relationalsignature. Then a relation is preserved by Pol( B ) if and only if it is primitivelypositively definable in B . The following definition is a preparation to formulate the next theorem whichis a well-known condition that implies NP-hardness of CSP( B ) for homogeneousstructures with a finite relational signature. Definition 17.
Let K be a class of algebras. Then we have – H( K ) is the class of homomorphic images of algebras from K and – S( K ) is the class of subalgebras of algebras from K . – P fin ( K ) is the class of finite products of algebras from K . An operation clone C on a set B can also be seen as an algebra B withdomain B whose signature consists of the operations of C such that f B := f forall f ∈ C .The following is a classical condition for NP-Hardness, see for example The-orem 10 in the survey [5]. Theorem 18.
Let B be a homogeneous structure with finite relational signa-ture. If HSP fin ( { Pol( B ) } ) contains a 2-element algebra where all operations areprojections, then CSP( B ) is NP-hard. In the following let A ∈ RRA be finite and with a normal representation B . Definition 19.
Let a , . . . , a n ∈ A be atoms of A . Then the n -ary relation ( a , . . . , a n ) B is defined as follows: ( a , . . . , a n ) B := (cid:8) ( x , . . . , x n , y , . . . , y n ) ∈ B n | ^ i ∈{ ,...,n } a B i ( x i , y i ) (cid:9) . An operation f : B n → B is called edge-conservative if it satisfies for all x, y ∈ B n and all a , . . . , a n ∈ A ( a , . . . , a n ) B ( x, y ) ⇒ ( f ( x ) , f ( y )) ∈ [ i ∈{ ,...,n } a B i . Note that for every D ⊆ A the structure B contains the relation S a i ∈ D a B i .Therefore the next proposition follows immediately since polymorphisms of B preserve all relations of B . Proposition 20.
All polymorphisms of B are edge-conservative. Definition 21.
Let X ⊆ A . An operation f : B n → B is called X -canonical ifthere exists a function ¯ f : X n → A such that for all a, b ∈ B n and O , . . . , O n ∈ X , if ( a i , b i ) ∈ O i for all i ∈ { , . . . , n } then ( f ( a ) , f ( b )) ∈ ¯ f ( O , . . . , O n ) B . Anoperation is called canonical if it is A -canonical. The function ¯ f is called the behaviour of f on X . If X = A then ¯ f is just called the behaviour of f . etwork satisfaction for symmetric relation algebras with a flexible atom 9 It will always be clear from the context what the domain of a behaviour ¯ f is. An operation f : S → S is called symmetric if for all x, y ∈ S it holdsthat f ( x, y ) = f ( y, x ). An X -canonical function f is called X -symmetric if thebehaviour of f on X is symmetric. We avoid giving an introduction to Ramsey theory, since the only usage of theRamsey property is via Theorem 23, and rather refer to [6] for an introduction.Let A be a homogeneous τ -structure such that Age( A ) has the strong amal-gamation property. Then the class of all ( τ ∪ { < } )-structures A such that < A isa linear order and whose τ -reduct (i.e. the structure on the same domain, butonly with the relations that are denoted by symbols from τ , see e.g. [30]) is fromAge( A ) is a strong amalgamation class, too (see for example [6]). By Theorem 11there exists an up to isomorphism unique countable homogeneous structure ofthat age, which we denote by A < . It can be shown by a straightforward back-and-forth argument that A < is isomorphic to an expansion of A , so we identifythe domain of A and of A < along this isomorphism, and call A < the expansionof A by a generic linear order . Theorem 22 ([31, 37]).
Let A be a relational τ -structure such that Age( A ) hasthe free amalgamation property. Then the expansion of A by a generic linearorder has the Ramsey property. The following theorem gives a connection of the Ramsey property with theexistence of canonical functions and plays a key role in our analysis.
Theorem 23 ([17]).
Let B be a countable homogeneous structure with finiterelational signature and the Ramsey property. Let h : B k → B be an operationand let L := (cid:8) ( x , . . . , x k ) α ( h ( β ( x ) , . . . , β k ( x k )) | α, β . . . , β k ∈ Aut( B ) (cid:9) . Then there exists a canonical operation g : B k → B such that for every finite F ⊂ B there exists g ′ ∈ L such that g ′ | F k = g | F k .Remark 24. Let A and B be homogeneous structures with finite relational sig-natures. If A and B have the same domain and the same automorphism group,then A has the Ramsey property if and only if B has it (see, e.g., [6]). In this section we define relation algebras with a flexible atom and show howto reduce the classification problem for their network satisfaction problem tothe situation where they are additionally integral . Then we show that integralrelation algebras with a flexible atom have a normal representation. Therefore,the universal-algebraic approach is applicable; in particular, we make heavy useof Theorem 16 in later sections. Finally, we prove that every normal represen-tation of a finite relation algebra with a flexible atom has a Ramsey expansion.Therefore, the tools from Section 2.5 can be applied, too.
Let A ∈ RRA and let I := { a ∈ A | a ≤ Id } . An atom s ∈ A \ I is called flexible if for all a, b ∈ A \ I it holds that s ≤ a ◦ b . A finite representable relationalgebra A is called integral if the element Id is an atom of A . Proposition 25.
Let A ∈ RRA be finite and with a flexible atom s . Then thereexists a finite integral A ′ ∈ RRA with a flexible atom such that
NSP( A ) and NSP( A ′ ) are polynomial-time equivalent.Proof. Assume that A is not integral and let s be the flexible atom. We firstshow there exists a unique e ∈ A with 0 < e < Id such that s = e ◦ s . Notethat Id ◦ s = s holds by definition and therefore it holds for all e ∈ A with0 < e < Id that e ◦ s ⊆ s . Since s is an atom either e ◦ s = 0 of e ◦ s = s holds.Then there exists at least one 0 < e < Id with e ◦ s = s , otherwise we obtain acontradiction to the assumption that Id ◦ s = s . Assume for contradiction thereexist distinct e , e ∈ A with 0 < e < Id and 0 < e < Id such that e ◦ s = s and e ◦ s = s hold. Let B be a representation of A . Since e and e are atoms,the relations e B ⊂ { ( x, x ) | x ∈ B } and e B ⊂ { ( x, x ) | x ∈ B } are disjoint. Let( x, y ) ∈ s B . By our assumption that e ◦ s = s and e ◦ s = s hold we get that( x, x ) ∈ e B and ( x, x ) ∈ e B hold, which contradicts the disjointness of e B and e B . This proves the claim that there exists a unique e ∈ A with 0 < e < Idsuch that s = e ◦ s .Assume for contradiction that there exists e ∈ A such that 0 < e < Id, e = e and e ◦ Id = 0. Let a be an atom with a ≤ e ◦ Id ′ . Then s ≤ a ◦ a ⌣ can not hold and therefore s is not a flexible atom. This means for all e ∈ A such that 0 < e < Id and e = e we have that e ◦ Id = 0.Let B be an arbitrary representation of A and let ( x, y ) ∈ Id B . By theobservations above we have that ( x, x ) ∈ e B and ( y, y ) ∈ e B hold. Let B ′ be thesubstructure of B on the domain { x ∈ B | ( x, x ) ∈ e B } . The set of relations of B ′ clearly induces a proper relation algebra which is integral. We denote this relationalgebra by A ′ . Note that we can also consider A ′ as a subalgebra of A namelythe algebra on all elements that are not above (in the lattice order) an identityatom different from e . We claim that NSP( A ) and NSP( A ′ ) are polynomial-time equivalent. For the first reduction consider an A -network ( V ; f ). Withoutloss of generality we assume that | V | ≥
2. We reduce ( V ; f ) to the A ′ -network( V ; f ′ ) given by f ′ ( x, y ) := f ( x, y ) \ { e ∈ A | e ≤ Id and e = e } . This is an A ′ -network by what we have seen before. Assume that ( V ; f ) issatisfiable in a representation C . Consider the structure C ′ . This is a represen-tation of A ′ that satisfies ( V ; f ′ ), since every element x ∈ V is mapped to { x ∈ C | ( x, x ) ∈ e C } under an satisfying assignment. Assume for the other di-rection that ( V ; f ′ ) is satisfiable in a representation C ′ . Let y i be fresh elementsfor every e i ≤ Id with e i = e . The disjoint union of C ′ with one-element { e i } -structures ( { y i } ; { ( y i , y i ) } ) is a representation of A that satisfies ( V ; f ′ ). Thisproves the first reduction. Consider now an A ′ -network ( V ; f ′ ). We reduce thisto the A -network ( V ; f ′ ). If ( V, f ′ ) is satisfiable as an A ′ -network we can do the etwork satisfaction for symmetric relation algebras with a flexible atom 11 same domain expansion as before and get a representation of A that satisfies( V ; f ′ ). Also the other direction follows by an analogous argument. ⊓⊔ Let A ∈ RRA be for the rest of the section finite, integral, and with a flexibleatom s . We consider the following subset of A : A − s := { a ∈ A | s a } . Let (
V, g ) be an A -network and let C be the corresponding A -structure. Let C − s be the ( A − s )-structure on the same domain V as C such that for all x, y ∈ V and a ∈ ( A − s ) \ { } we have a C − s ( x, y ) if and only if ( a C ( x, y ) ∨ ( a ∪ s ) C ( x, y )) . We call C − s the s -free companion of an A -network ( V, f ).The next lemma follows directly from the definitions of flexible atoms and s -free companions. Lemma 26.
Let C be the class of s -free companions of atomic closed A -networks.Then C has the free amalgamation property. As a consequence of this lemma we obtain the following.
Proposition 27. A has a normal representation B .Proof. Let C be the class from Lemma 26. This class is closed under takingsubstructures and isomorphisms. By Lemma 26 it also has the amalgamationproperty and therefore we get by Theorem 11 a homogeneous structure B ′ withAge( B ′ ) = C . Let B ′′ be the expansion of B ′ by the following relation s ( x, y ) : ⇔ ^ a ∈ A \{ s } ¬ a B ′ ( x, y ) . Let B be the (homogeneous) expansion of B ′′ by all boolean combinations ofrelations from B ′′ . Then B is a representation of the relation algebra A . SinceAge( B ′ ) is the class of all atomic closed A -networks, B is fully universal. Thedefinition of s witnesses that B is a square representation of A : for all elements x, y ∈ B there exists an atom a ∈ A such that a B ( x, y ) holds. ⊓⊔ The next theorem is another consequence of Lemma 26.
Theorem 28.
Let B be a normal representation of A . Let B < be the expansionof B by a generic linear order. Then B < has the Ramsey property.Proof. Let B ′ be the ( A \{ s } )-reduct of B . The age of this structure has the freeamalgamation property by Lemma 26. Therefore, Theorem 22 implies that theexpansion of B ′ by a generic linear order has the Ramsey property. By Remark24 the structure B < also has the Ramsey property since B < and B ′ < have thesame automorphism group. ⊓⊔ ◦ Id a b Id Id a ba a { Id , a, b, } { a, b } b b { a, b } { Id , a, b } ◦ Id a b Id Id a ba a { Id , b } { a, b } b b { a, b } { Id , a, b } Fig. 2.
Multiplication tables of relation algebras
Remark 29.
The binary first-order definable relations of B < build a proper re-lation algebra since B < has quantifier-elimination (see [30]). By the definitionof the generic order the atoms of this proper relation algebra are the relations { a B < ∩ < B < | a ∈ A \ { Id }} ∪ { a B < ∩ > B < | a ∈ A \ { Id }} ∪ { Id } . We give two concrete examples of finite, integral, symmetric relation algebraswith a flexible atom (Examples 30 and 31), and a systematic way of building suchrelation algebras from arbitrary relation algebras (Example 32). The numberingof the relation algebras in the examples is from [3].
Example 30 (Relation algebra ). The relation algebra a and b . The multi-plication table for the atoms is given in Fig. 2. In this relation algebra theatoms a and b are flexible. Consider the countable, homogeneous, undirectedgraph R = ( V ; E R ), whose age is the class of all finite undirected graphs (see,e.g., [30]), also called the Random graph . The expansion of R by all binary first-order definable relations is a normal representation of the relation algebra a and b are interpreted as the relation E R andthe relation N R , where N R is defined as ¬ E ( x, y ) ∧ x = y . Example 31 (Relation algebra ). The relation algebra b is a flexible atom. To see that a is not a flexible atom, notethat a a ◦ a = { Id , b } . Let N = ( V ; E N ) be the countable, homogeneous,undirected graph, whose age is the class of all finite undirected graphs that donot embed the complete graph on three vertices (see, e.g., [30]). This structure iscalled a Henson graph . If we expand N by all binary first-order definable relationswe get a normal representation of the relation algebra a as the relation E N . That N is triangle free, i.e. triangles of E N are forbidden, matches with the fact that a a ◦ a holds in the relation algebra. Example 32.
Consider an arbitrary finite, integral A = ( A ; ∪ , ¯ , , , Id , ⌣ , ◦ ) ∈ RRA. Clearly A does not have a flexible atom s in general. Nevertheless we canexpand the domain of A to implement an “artificial” flexible atom.Let s be some symbol not contained in A . Let us mention that every elementin A can uniquely be written as a union of atoms from A . Let A ′ be the set ofall subsets of A ∪ { s } . The set A ′ is the domain of our new relation algebra A ′ .Note that on A ′ there exists the subset-ordering and A ′ is closed under set-union etwork satisfaction for symmetric relation algebras with a flexible atom 13 and complement (in A ∪ { s } ) We define s to be symmetric and therefore getthe following unary function ∗ in A ′ as follows. For an element x ∈ A ′ we define x ∗ := (cid:26) y ⌣ ∪ { s } if x = y ∪ { s } for y ∈ A,x ⌣ otherwise.The new function symbol ◦ ′ A in A ′ is defined on the atoms A ∪ { s } as follows: x ◦ A ′ y := A ∪ { s } if { s } = { x, y } , ( A \ { Id } ) ∪ { s } if { s, a } = { x, y } for a ∈ A \ { s, Id } , { a } if { Id , a } = { x, y } for a ∈ A ∪ { s } , ( x ◦ y ) ∪ { s } otherwise.One can check that A ′ = ( A ′ ; ∪ , ¯ , ∅ , A ∪ { s } , Id , ∗ , ◦ A ′ ) is a finite integral repre-sentable relation algebra with a flexible atom s . Note that the forbidden triplesof A ′ are exactly those of A together with triples which are permutations of( s, a, Id) for some a ∈ A . In this section we introduce for every finite A ∈ RRA an associated finite struc-ture, called the atom structure of A . Note that it is closely related, but not thesame, as the type structure introduced in [13]. In the context of relation algebrasthe atom structure has the advantage that its domain is the set of atoms of A ,rather than the set of 3-types, which would be the domain of the type structurein [13]; hence, our domain is smaller and has some advantages that we discussat the end of the section. Up to a minor difference of the signature, our atomstructure is the same as the atom structure introduced in [33] (which was usedthere for different purposes; also see [25, 29, 34]).We will reduce CSP( B ) to the CSP of the atom structure. This means thatif the CSP of the atom structure is in P, then so are CSP( B ) and NSP( A ). Forour main result we will show later that every network satisfaction problem fora finite integral symmetric relation algebra with a flexible atom that cannot besolved in polynomial time by this method is NP-complete. Let B be throughoutthis section a normal representation of a finite A ∈ RRA.
Definition 33.
The atom structure of A is the finite relational structure O with domain A and the following relations: – for every x ∈ A the unary relation x O := { a ∈ A | a ≤ x } , – the binary relation E O := { ( a , a ) ∈ A | a ⌣ = a } , – the ternary relation H O := { ( a , a , a ) ∈ A | a ≤ a ◦ a } . Proposition 34.
There is a polynomial-time reduction from
CSP( B ) to CSP( O ) .Proof. Let Ψ be an instance of CSP( B ) with variable set X = { x , . . . , x n } . Weconstruct an instance Φ of CSP( O ) as follows. The variable set Y of Φ is givenby Y := { ( x i , x j ) ∈ X | i ≤ j } . The constraints of Φ are of the two kinds:
1. Let a ∈ A be an element of the relation algebra and let a ( x i , y j ) be anatomic formula of Ψ . If i < j holds, then we add the atomic (unary) formula a (( x i , x j )) to Φ ; otherwise we add the atomic formula a ⌣ (( x i , x j )).2. Let x i , x j , x l ∈ X be such that i ≤ j ≤ l . Then we add the atomic formula H (( x i , x j ) , ( x j , x l ) , ( x i , x l )) to Φ .It remains to show that this reduction is correct. Let s : X → B be a satisfyingassignment for Ψ . This assignment maps every pair of variables x i and x j to aunique atom in A and therefore induces a map s ′ : Y → A . The map s ′ clearlysatisfies all atomic formulas introduced by (1). To see that it also satisfies allformulas introduced by (2) note that s maps the elements x i , x j , x l ∈ X to asubstructure of B , which contains only allowed triples.For the other direction assume that s ′ : Y → A is a satisfying assignmentfor Φ . This induces an A -structure on X (maybe with some identification ofvariables) such that no forbidden triple from A is embeddable. Also note thatthis structure is compatible with the atomic formulas given in Ψ by the choice ofthe unary relations in (1). Since B is fully-universal for structures that do notembed a forbidden triple of A the instance Ψ is satisfiable ⊓⊔ We obtain another property of the atom structure which is fundamental forour result. Recall that every canonical polymorphism f induces a behaviour¯ f : A n → A .In the next proposition we show that then ¯ f is a polymorphism of O . More-over the other direction also holds. Every g ∈ Pol( O ) is the behaviour of acanonical polymorphism of B . Proposition 35.
Let B be a normal representation of a finite A ∈ RRA . Then:1. Let g ∈ Pol( B ) ( n ) be canonical and let g : A n → A be its behaviour. Then g ∈ Pol( O ) ( n ) .2. Let f ∈ Pol( O ) ( n ) . Then there exists a canonical g ∈ Pol( B ) ( n ) whose be-haviour equals f .Proof. For (1): Let g ∈ Pol( B ) ( n ) be canonical and let c , . . . , c n ∈ H O . Thenby the definition of H O there exist tuples x , . . . , x n ∈ B such that for all i ∈ { , . . . , n } we have c i B ( x i , x i ) , c i B ( x i , x i ) , and c i B ( x i , x i ) . We apply the canonical polymorphism g and get y := g ( x , . . . , x n ) ∈ B .Then there exists an allowed triple ( d , d , d ) ∈ A such that d B ( y , y ) , d B ( y , y ) , and d B ( y , y ) . We have that d = ( d , d , d ) ∈ H O and by the definition of the behaviourof a canonical function we get g ( c , . . . , c n ) = d . The other relations in O arepreserved trivially and therefore g ∈ Pol( O ) ( n ) . etwork satisfaction for symmetric relation algebras with a flexible atom 15 For (2): Since B is fully-universal and homogeneous it follows by a stan-dard compactness argument (see e.g. Lemma 2 in [7]) that every countable A -structure which does not embed a forbidden triple and is square has an homo-morphism to B . It is therefore enough to show that every operation h : B n → B with behaviour f does not induce a forbidden triple in the image. Assume forcontradiction that there exist tuples x , . . . , x n ∈ B such that the applicationof a canonical function with behaviour f on x , . . . , x n would give a tuple y ∈ B with d = ( d , d , d ) ∈ A such that d B ( y , y ) , d B ( y , y ) , and d B ( y , y )where d is a forbidden triple. This contradicts the assumption that f preserves H O . ⊓⊔ Recall from Proposition 20 that polymorphisms of B are edge-conservative.Note that this implies that polymorphisms of O are conservative. In fact, The-orem 15 and the previous proposition imply the following. Proposition 36. If Pol( B ) contains a canonical polymorphism s such that itsbehaviour s is a Siggers operation in Pol( O ) then CSP( B ) is polynomial-timesolvable. We demonstrate how this result can be used to prove polynomial-time tractabil-ity of NSP( A ) for a symmetric, integral A ∈ RRA with a flexible atom.
Example 37 (Polynomial-time tractability of relation algebra , see [23], seealso Section 8.4 in [16]).
We consider the following function ¯ s : { Id , a, b } →{ Id , a, b } .¯ s ( x , . . . , x ) := a if a ∈ { x , . . . , x } ,b if b ∈ { x , . . . , x } and a
6∈ { x , . . . , x } , Id otherwise.Let R ′ be the normal representation of the relation algebra s is the behaviour of an injective, canonical polymorphism of R .The injectivity follows from the last line of the definition; if ¯ s ( x , . . . , x ) = Idthen { x , . . . , x } = { Id } . Therefore ¯ s preserves all allowed triples, since in therelation algebra s is a Siggers operation and therefore we get by Proposition 36 that NSP( Example 38.
Consider the construction of relation algebras with flexible atomfrom Example 32. It is easy to see that NSP( A ) for a finite integral A ∈ RRAhas a polynomial-time reduction to NSP( A ′ ) where A ′ is the relation algebrawith a flexible atom, that is constructed in Example 32. We get as a consequencethat if the normal representation of A ′ satisfies the condition of Proposition 36then NSP( A ) is polynomial time solvable.Theorem 15 has another important consequence. Theorem 39. If Pol( O ) does not have a Siggers operation then there exist ele-ments a , a ∈ A such that the restriction of every operation from Pol( O ) ( n ) to { a , a } n is a projection. This section introduces a key method of our analysis. The “independence lemma”transfers the absence of a special partially canonical polymorphism into theexistence of certain relations of arity 4 that are primitively positively definablein B . These relations will later help us to prove the NP-hardness of CSP( B ). Alemma of a similar type appeared for example as Lemma 42 in [15]. Definition 40.
Let B be a relational structure. A set O ⊂ B n is called an n -orbit of Aut( B ) if O is preserved by all α ∈ Aut( B ) and for all x, y ∈ O thereexists α ∈ Aut( B ) such that α ( x ) = y . Lemma 41.
Let B be a homogeneous structure with finite relational signature.Let a and b be 2-orbits of Aut( B ) such that a , b , and ( a ∪ b ) are primitivelypositively definable in B . Then the following are equivalent:1. B has an { a, b } -canonical polymorphism g that is { a, b } -symmetric with g ( a, b ) = g ( b, a ) = a .2. For every primitive positive formula ϕ such that ϕ ∧ a ( x , x ) ∧ b ( y , y ) and ϕ ∧ b ( x , x ) ∧ a ( y , y ) are satisfiable over B , the formula ϕ ∧ a ( x , x ) ∧ a ( y , y ) is also satisfiable over B .3. For every finite F ⊂ B there exists a homomorphism h F from the sub-structure of B induced by F to B that is { a, b } -canonical with h F ( a, b ) = h F ( b, a ) = a .Proof. The implication from (1) to (2) follows directly by applying the symmetricpolymorphisms on tuples from the relation defined by ϕ .For the implication from (2) to (3) let F be a finite set in B . Withoutloss of generality we may assume that F is of the form { e , . . . , e n } for a largeenough n ∈ N . To construct h F consider the formula ϕ with variables x i,j for1 ≤ i, j ≤ n that is the conjunction of all atomic formulas R ( x i ,j , . . . , x i k ,j k )such that R ( e i , . . . , e i k ) and R ( e j , . . . , e j k ) hold in B . Note that this formulastates exactly which relations hold on F as a substructure of B . Let P be theset of pairs (( i , i ) , ( j , j )) such that( a ∪ b )( e i , e i )and ( a ∪ b ( e j , e j )and ( a ( e i , e i ) ∨ a ( e j , e j )) . and ( b ( e i , e i ) ∨ b ( e j , e j )) . If we show that the formula ψ := ϕ ∧ ^ (( i ,i ) , ( j ,j )) ∈ P a ( x i ,j , x i ,j ) etwork satisfaction for symmetric relation algebras with a flexible atom 17 is satisfiable by an assignment s , we get the claimed homomorphisms by set-ting h ( e i , e j ) := s ( x i,j ). We prove the satisfiability of ψ by induction overthe size of subsets I of P . For the inductive beginning consider an element(( i , i ) , ( j , j )) ∈ P . Without loss of generality we have that a ( i , i ) holds.Therefore the assignment s ( x i,j ) := e i witnesses satisfiability of the formula ϕ ∧ a ( x i ,j , x i ,j ). For the inductive step let I ⊂ P be of size m and assumethat the statement is true for subsets of size m −
1. Let p = (( u , u ) , ( v , v ))and p = (( u ′ , u ′ ) , ( v ′ , v ′ )) be two elements from I . We define the followingformula ψ := ϕ ∧ ^ (( i ,i ) , ( j ,j )) ∈ I \{ p ,p } a ( x i ,j , x i ,j ) . Then by the inductive assumption the formulas ψ ∧ a ( x u ,v , x u ,v ) and ψ ∧ a ( x u ′ ,v ′ , x u ′ ,v ′ ) are satisfiable. The assumptions on the elements in P give usthat also ψ ∧ a ( x u ,v , x u ,v ) ∧ b ( x u ′ ,v ′ , x u ′ ,v ′ ) and ψ ∧ b ( x u ,v , x u ,v ) ∧ a ( x u ′ ,v ′ , x u ′ ,v ′ ) are satisfiable; since a ∪ b is a primitive positive definable re-lation we are done otherwise. But then we can apply the assumption of (2) andget that also ψ ∧ a ( x u ,v , x u ,v ) ∧ a ( x u ′ ,v ′ , x u ′ ,v ′ ) is satisfiable, which provesthe inductive step.The direction from (3) to (1) is a standard application of K¨onig’s tree lemma.For a reference see for example Lemma 42 in [15]. ⊓⊔ We give in this section a proof of the following proposition.
Proposition 42.
Let B be a normal representation of a finite, symmetric, in-tegral A ∈ RRA with a flexible atom s . If B does not have a binary injectivepolymorphism, then HSP fin ( { Pol( B ) } ) contains a 2-element algebra where alloperations are projections. Therefore, CSP( B ) is NP-complete. Note that an injective polymorphism of B is { a, Id } -canonical, and even { a, Id } -symmetric for all atoms a ∈ A since polymorphisms of a normal repre-sentation are edge-conservative.We first apply the independence lemma on the pair { s, Id } of atoms where s is the flexible atom and analyze the situation when no { s, Id } -symmetric poly-morphism exists. The outcome is that this is sufficient for the NP-hardness.We will see in Lemma 47 that in order to prove Proposition 42 this is enough,since the absence of a binary injective polymorphism implies the absence of an { s, Id } -symmetric polymorphism. Lemma 43.
Let B be a normal representation of a finite, integral, symmetric A ∈ RRA with a flexible atom s . Let ψ be the formula ψ ( x , x , y , y ) := Id( x , y ) ∧ Id( x , y ) ∧ Id( x , y ) ∧ Id( x , y ) . Let ϕ be a primitive positive formula such that ϕ ∧ s ( x , x ) ∧ Id( y , y ) and ϕ ∧ Id( x , x ) ∧ s ( y , y ) are satisfiable over B , but the formula ϕ ∧ s ( x , x ) ∧ s ( y , y ) is not satisfiable over B . Then there exists a primitive positive formula ϕ ′ such that ϕ ′ ∧ ψ ( x , x , x , x ) ∧ s ( x , x ) ∧ Id( y , y ) and ϕ ′ ∧ ψ ( x , x , x , x ) ∧ Id( x , x ) ∧ s ( y , y ) are satisfiable over B and the formula ϕ ∧ s ( x , x ) ∧ s ( y , y ) is not satisfiableover B (we denote this property with ⋆ ).Proof. Let R Id be the ternary relation defined by the formula σ ( x , x , x ) := ( s ∪ Id)( x , x ) ∧ ( s ∪ Id)( x , x ) ∧ s ( x , x ) . For this formula it holds that σ ∧ s ( x , x ) ∧ Id( x , x ) and σ ∧ Id( x , x ) ∧ s ( x , x ) are satisfiable, but the formula σ ∧ Id( x , x ) ∧ Id( x , x ) is not satisfi-able.Assuming the statement of the lemma does not hold for ϕ we consider thefollowing cases. Without loss of generality we may assume that ϕ ∧ s ( x , x ) ∧ Id( y , y ) ∧ Id( x , y ) holds. Otherwise, we may change the roles of some variables.1. ϕ ∧ Id( x , x ) ∧ s ( y , y ) ∧ Id( x , y ) is satisfiable.2. ϕ ∧ Id( x , x ) ∧ s ( y , y ) ∧ c ( x , y ) ∧ b ( x , y ) is satisfiable for atoms c, b ∈ A \ { s } .3. ϕ ∧ Id( x , x ) ∧ s ( y , y ) ∧ Id( x , y ) is satisfiable.We prove the statement for these cases.Case 1: Let R s be the ternary relation defined by σ ′ ( x , x , y ) := ϕ ( x , x , x , y ).Then σ ′ ∧ s ( x , x ) ∧ Id( x , y ) and σ ′ ∧ Id( x , x ) ∧ s ( x , y ) are satisfiable, but theformula ψ ∧ s ( x , x ) ∧ s ( x , y ) is not satisfiable (we denote this with property ♠ ). Consider the following formula: ϕ ′ ( x , x , y , y ) := ∃ z : ( R s ( x , x , yz ∧ R Id ( x , z, y ) ∧ R s ( z, y , y )) . We show that ϕ has property ⋆ . Consider the following substructure of B onelements a , a and a such that the atomic relations that hold on this structureare s ( a , a ) , s ( a , a ) , and s ( a , a ) . Then ϕ ′ ( a , a , a , a ) holds in B if we choose a for the variable z . Thereforewe get: ϕ ′ ( a , a , a , a ) ∧ ψ ( a , a , a , a ) ∧ s ( a , a ) ∧ Id( a , a ) . This shows the first satisfiability part of property ⋆ . The other satisfiabilitypart holds also since we can choose the tuple ( a , a , a , a ) by an analogousargument. The non-satisfiability part of ⋆ follows by the definition of ϕ ′ . As-suming s ( x , x ) and s ( y , y ) hold we get by the properties of R s that Id( x , z ) etwork satisfaction for symmetric relation algebras with a flexible atom 19 and Id( z, y ) hold. This contradicts the properties of R Id . Therefore we finishedCase 1.Case 2: Consider the formula ϕ ′ ( x , x , y , y ) := ∃ z , z , z : ϕ ( x , x , z , z ) ∧ R Id ( z , z , z ) ∧ ϕ ( z , z , y , y ) . We show that ϕ ′ has property ⋆ . Let a , . . . , a ∈ B such that the followingrelations hold: s ( a , a ) , s ( a , a ) , c ( a , a ) , s ( a , a ) , s ( a , a ) and b ( a , a ) . Such a substructure clearly exists since s is a flexible atom. We claim that thetuple ( a , a , a , a ) is a witness that ϕ ′ satisfies the first satisfiability part ofproperty ⋆ . To see this, choose for the existentially quantified variables z , z and z the elements a , a and a . It is easy to check that ( a , a , a , a ) and( a , a , a , a ) satisfy ϕ and that ( a , a , a ) ∈ R Id holds. The second satisfi-ability statement in property ⋆ follows by an analogous argument. The non-satisfiability part is clear by the definition and the same argument as for Case 1.Case 3: Consider the ternary relation R s defined by σ ( x , x , x ) := ∃ z : ( ϕ ( x , x , x , z ) ∧ Id( x , y ) ∧ (Id ∪ s )( y , y )) . This relation and its defining formula have property ♠ . Therefore the proof isthe same as in Case 1. ⊓⊔ Lemma 44.
Let B be a normal representation of a finite, integral, symmetric A ∈ RRA with a flexible atom s . If there exists no { s, Id } -symmetric polymor-phism, then all polymorphisms are canonical on { s, Id } .Proof. Let ψ be the following formula: ψ ( x , x , y , y ) := Id( x , y ) ∧ Id( x , y ) ∧ Id( x , y ) ∧ Id( x , y ) . Let furthermore be R Id the ternary relation defined by the formula σ ( x , x , x ) := ( s ∪ Id)( x , x ) ∧ ( s ∪ Id)( x , x ) ∧ s ( x , x ) .σ has the property that σ ∧ s ( x , x ) ∧ Id( x , x ) and σ ∧ Id( x , x ) ∧ s ( x , x )are satisfiable, but the formula σ ∧ Id( x , x ) ∧ Id( x , x ) is not satisfiable.If there exist no { s, Id } -symmetric polymorphism then item (2) in Lemma41 is not satisfied. Therefore, by Lemma 43 we can assume that there exists aformula ϕ ′ such that ϕ ′ ∧ ψ ( x , x , x , x ) ∧ s ( x , x ) ∧ Id( y , y )and ϕ ′ ∧ ψ ( x , x , x , x ) ∧ Id( x , x ) ∧ s ( y , y )are satisfiable and the formula ϕ ∧ s ( x , x ) ∧ s ( y , y ) is not satisfiable (we denotethis property with ⋆ ). We define ϕ s ( x , x , x , x ) := ϕ ′ ( x , x , x , x ) ∧ ψ ( x , x , x , x ) ∧ ( s ∪ Id)( x , x ) ∧ ( s ∪ Id)( x , x ) . Now we define the 4-ary relation R as follows: δ ( x , x , x , x ) := s ( x , x ) ∧ s ( x , x ) ∧ s ( x , x ) ∧ s ( x , x ) ∧ ∃ y , y , y : ( ϕ s ( x , x , y , y ) ∧ R Id ( y , y , y ) ∧ ϕ s ( y , y , x , x )) ∧ ∃ z , z : ( R Id ( x , x , z ) ∧ ϕ s ( x , z , z , x ) ∧ R Id ( z , x , x ))The formulas δ ∧ s ( x , x ) ∧ Id( x , x ) and δ ∧ Id( x , x ) ∧ s ( x , x ) are sat-isfiable. To see this note that we have free amalgamation (with respect to theflexible atom) in the structure B ; we can clue tuples that satisfy ϕ s with tuplesfrom relation R Id and fill all missing edges with the flexible atom s . This is pos-sible since we ensured with ψ that the relevant entries of these tuples are notequal.A second observation is the following: u ∈ R ⇒ ( s ( u , u ) ∧ Id( u , u )) ∨ (Id( u , u ) ∧ s ( u , u ))This is because of the second and third line in the defining formula. Assume thatfor u ∈ R the formula s ( u , u ) ∧ s ( u , u ) holds. Then there exist y , y , y suchthat ϕ s ( x , x y , y ) ∧ ϕ s ( y , y , x , x ) holds. But this is by ⋆ only possible ifId( y , y ) ∧ Id( y , y ) holds. This is a contradiction since R Id ( y , y , y ) holds.The same argument works for proving that ¬ (Id( u , u ) ∧ Id( u , u )) holds.Let E s, Id be the 4-ary relation defined as( a , . . . , a ) ∈ E s, Id : ⇔ ( s ∪ Id)( a , a ) ∧ ( s ∪ Id)( a , a ) ∧ ( s ( a , a ) ⇔ s ( a , a ))We finally use R to get a primitive positive definition of E s, Id .( a , . . . , a ) ∈ E s, Id ⇔ ∃ y , y : ( R ( a , a , y , y ) ∧ R ( y , y , a , a ))This definition works since for elements in R the free predicate s holds between allits entries whenever the predicate Id does not hold. The same free amalgamationargument as before proves the claim.Since we found a primitive positive definition for the relation E Id ,s , we knowthat all polymorphisms of B have to preserve this relation. But this is by thedefinition of E Id ,s nothing else than saying that all polymorphisms are { Id , s } -canonical. ⊓⊔ Lemma 45.
Let B be a normal representation of a finite, integral, symmetric A ∈ RRA with a flexible atom s . Let a Id be an atom such that all polymor-phisms of B are { a, Id } -canonical. Then either there exists an { a, Id } -symmetricpolymorphism or all polymorphisms are a projection on { a, Id } . etwork satisfaction for symmetric relation algebras with a flexible atom 21 Proof.
The polymorphisms of B induce an idempotent operation clone on theset { a, Id } . Assume this clone does not contain projections only. Since we knowthen that one of the cases in Theorem 13 applies we make a case distinction.Case 1: Assume there exists a polymorphism f of B that induces a majorityoperation on { a, Id } . Then consider tuples x, y, z ∈ B such that(Id , Id , a )( x, y ) , (Id , a, Id)( y, z ) , and (Id , a, a )( x, z ) . If we apply f on these tuples we get on f ( x ) , f ( y ) and f ( z ) a substructurethat contains a forbidden triple. Therefore, f cannot be a majority operation on { a, Id } .Case 2: Assume there exists a polymorphism f of B that induces a minorityoperation on { a, Id } . Then consider tuples x, y, z ∈ B such that(Id , a, a )( x, y ) , ( a, a, Id)( y, z ) , and ( a, s, a )( x, z ) . Note that such tuples exist since s is a flexible atom. If we apply f on these tupleswe get on f ( x ) , f ( y ) and f ( z ) a substructure that contains a forbidden triple.By the minority operation we get Id( f ( x ) , f ( y )) and Id( f ( y ) , f ( z )), but since f is an edge-conservative polymorphism, we also have [ a ∪ s ]( f ( x ) , f ( z )). Thisis a contradiction and therefore f can not be a minority operation on { a, Id } .Therefore, item (1) or (2) in Theorem 13 hold. A polymorphism that inducesone of these two operations from (1) or (2) in Theorem 13 on the set { a, Id } isby definition an { a, Id } -symmetric polymorphism. This proves the lemma. ⊓⊔ Lemma 46.
Let B be a normal representation of a finite, integral, symmetric A ∈ RRA with a flexible atom s . Let a Id be an atom and f an { a, Id } -canonical polymorphism of B such that f is { a, Id } -symmetric. Then ¯ f ( a, Id) = a = ¯ f (Id , a ) holds.Proof. The other possibility is ¯ f ( a, Id) = Id = ¯ f (Id , a ), which is not possiblesince tuples x, y, z ∈ B with( a, Id)( x, y ) , (Id , a )( y, z ) , and ( a, a )( x, z )would give a forbidden triple on the induced substructure of f ( x ) , f ( y ) and f ( z ). ⊓⊔ Lemma 47.
Let B be a normal representation of a finite, integral, symmetric A ∈ RRA with a flexible atom s . If B does not have a binary injective polymor-phism then B does not have a { s, Id } -symmetric polymorphism.Proof. Assume for contradiction that B has an { s, Id } -symmetric polymorphism f . By Lemma 46 the only possibility is that ¯ f ( s, Id) = s = ¯ f (Id , s ) holds. Let a ∈ A be an arbitrary atom and let x, y ∈ B such that Id( x , y ) and a ( x , y )hold. We can choose z ∈ B such that (Id , s )( z, x ) and (Id , a )( z, y ) hold. Bythe assumption on f we get s ( f ( z ) , f ( x )). This implies also that a ( f ( x ) , f ( y ))holds, since otherwise we would induce a forbidden substructure. Since we chose a and x and y arbitrary and by an analogous argument for the change of thecoordinates we get that f is { a, Id } -symmetric with ¯ f ( a, Id) = a = ¯ f (Id , a ) forall a ∈ A . This means that f is injective, which contradicts the assumption. ⊓⊔ Now we are able to prove the main result of this section.
Proof (of Proposition 42).
Since B is finitely bounded CSP( B ) is in NP. As-sume that B has no injective binary polymorphism. Then Lemma 47 impliesthat there exists no { s, Id } -symmetric polymorphism and therefore by Lemma44 all polymorphisms are { s, Id } -canonical. Lemma 45 implies then that all poly-morphisms are Boolean projections on { s, Id } . It is easy to see that thereforeHSP fin ( { Pol( B ) } ) contains a 2-element algebra where all operations are projec-tions. This proves by Theorem 18 the NP-hardness of CSP( B ). ⊓⊔ We show that in some cases the existence of an { a, b } -canonical polymorphismsimplies the existence of a canonical polymorphism with the same behaviour on { a, b } . We do this separately for binary and ternary operations and use a binaryinjective polymorphism that exists by the results Section 6.Let us remark that this part of our proof fails if the relation algebra A isnot symmetric. For every relation algebra that contains a non-symmetric atoma normal representation would not satisfy Proposition 49 below, since the statedbehaviour is not well-defined. Proposition 48.
Let f be an injective polymorphism of B . Then there exists apolymorphism f < of B < and an injective endomorphism e of B such that f = e ◦ f < as mappings from B to B .Proof. Let U := f ( B n ) and consider substructure U induced by B on U . Thereexists a linear ordering on B n , namely the lexicographic order given by the linearorder of B < on each coordinate.Let U < be the expansion of U by the linear order that is induced by the lex-icographic linear order on the preimage. This is well defined since f is injective.By the definition of B < and a compactness argument the structure U ′ embedsinto B < . In this way we obtain a homomorphism f < from B < to B < . Againby a compactness argument also an endomorphism e with the desired propertiesexists. ⊓⊔ The Binary Case
For the next proposition recall Definition 40, where n -orbitsare defined. For normal representations 2-orbits are the same as the interpreta-tions of the atoms of the relation algebra. Note that since orbits are relations,we can consider formulas that hold for all tuples in this relation. Let B < be theexpansion of B by the generic linear order. We say that a polymorphism f of B < is canonical with respect to B < if f satisfies Definition 21, where the underlayingrelation algebra is the proper relation algebra induced by the binary first-orderdefinable relations of B < . etwork satisfaction for symmetric relation algebras with a flexible atom 23 Proposition 49.
Let f be a binary polymorphism of B < that is canonical withrespect to B < . Then the restriction of the behaviour of f to the 2-orbits of B < that satisfy x ≤ y induces a canonical binary polymorphism of B .Proof. The restriction of the behaviour of f to the 2-orbits that satisfy x ≤ y induces a function h : A → A . This function is well defined since all atomsare symmetric. We show that there exists a canonical polymorphism of B thathas this behaviour. Consider the following structure A on the domain B . Let x, y ∈ B and let a, a , a ∈ A be atoms of A with a B ( x , y ) and a B ( x , y ).Then we define that a A ( x, y ) holds if and only if h ( a , a ) = a .We show in the following that this structure A has a homomorphism to B .This is enough to prove the statement, because the composition of this homo-morphism with the identity mapping from B to A is a canonical polymorphismof B . In order to do this we show that every finite substructure of A homo-morphically maps to B . By an standard compactness argument and since B ishomogeneous this implies the existence of a homomorphism from A to B .Let F be a finite substructure of A and assume for contradiction that F doesnot homomorphically map to B . We can view F as an atomic A -network andsince B is fully universal F is not closed. There must exist elements b , b , b ∈ B of F and atoms a , a , a ∈ A such that a a ◦ a holds in A and a F ( b , b ) , a F ( b , b ) , and a F ( b , b ) . This means that the substructure induced on the elements b , b , b by F containsa forbidden triple.Now we consider the substructures that are induced on b , b , b and b , b , b by B . Our goal is to order these elements such that for all i, j ∈ { , , } it holdsthat ¬ ( b i < b j ∧ b i > b j ) . (1)If we achieve this we know that there exist elements in B < that induce isomor-phic copies of the induced structures of the elements b , b , b and b , b , b withthe additional ordering. Now the application of the polymorphism f on these el-ements results in a structure whose A -reduct is isomorphic to the substructureinduced by b , b and b on F by the definition of the canonical behaviour h . Thiscontradicts our assumption because a polymorphism can not have a forbiddensubstructure in its image.It remains to show that we can choose orderings on the elements b , b , b and b , b , b such that 1 holds. Without loss of generality we can assume that { b , b , b } ∩ { b , b , b } = ∅ holds.Now consider the following cases:1. |{ b , b , b }| = 3 and |{ b , b , b }| = 3.We can obviously choose linear orders on both sets such that 1 holds.2. |{ b , b , b }| = 2 and |{ b , b , b }| = 3.Assume that Id B ( b , b ) holds then the possible orders are b = b < b and b < b < b . |{ b , b , b }| = 2 and |{ b , b , b }| = 2.Here we have to distinguish two subcases, depending on whether or not thiscase means b i = b j as tuples for different i, j ∈ { , , } .Assume first that Id B ( b , b ) and Id B ( b , b ) hold. Then we choose as orders b = b < b and b = b < b . For the second case we can assume without loss of generality that Id B ( b , b )and Id B ( b , b ) hold. Note that otherwise we could change the role of two ofthe tuples b , b and b and get this case. The compatible order is then b = b < b and b < b = b . |{ b , b , b }| = 1 and |{ b , b , b }| = 3.In this case we choose the order b = b = b and b < b < b . |{ b , b , b }| = 1 and |{ b , b , b }| = 2.Assume that Id B ( b , b ) holds and we have as an order b = b = b and b = b < b . |{ b , b , b }| = 1 and |{ b , b , b }| = 1 For this case we trivially get b = b = b and b = b = b . Note that these are all possible cases up to the symmetry of the arguments forboth coordinates. This completes the proof of the proposition. ⊓⊔ Corollary 50.
If there exists an injective polymorphism of B , then there existsalso a canonical injective polymorphism.Proof. Without loss of generality we can assume that the injective polymorphismis binary. By Proposition 48 we can assume that there exists also an injectivepolymorphism of B < . With Theorem 23 there exists also an injective canonicalpolymorphism of B < . According to Proposition 49 the restriction to the orbitalsthat satisfy x ≤ y induces the behaviour of a canonical operation of B that isalso injective. ⊓⊔ Lemma 51.
Let a , a ∈ A \ { Id } be atoms. Every { a , a } -symmetric poly-morphism of B is injective.Proof. Let f be an { a , a } -symmetric polymorphism, with f ( a , a ) = a = f ( a , a ). Assume that there exist a ∈ A and x, y ∈ B with ( a, Id)( x, y ) suchthat Id( f ( x ) , f ( y )) holds.Case 1: s
6∈ { a , a } . Since s is a flexible atom we may choose z ∈ B suchthat ( a , a )( z, x ) and ( s, a )( z, y ) hold. By choice of the polymorphism f we get etwork satisfaction for symmetric relation algebras with a flexible atom 25 a ( f ( z ) , f ( x )) and ( s ∪ a )( f ( z ) , f ( y )) which induces either the forbidden triple(Id , s, a ) or the forbidden triple (Id , a , a ) on f ( x ) , f ( y ), and f ( z ).Case 2: s = a . We choose z ∈ B such that ( a , a )( z, x ) and ( a , a )( z, y ).This is possible since a is the flexible atom. We get a ( f ( z ) , f ( x )) and a ( f ( z ) , f ( y )) which induces again a forbidden triple on f ( x ) , f ( y ), and f ( z ).Case 2: s = a . We choose z ∈ B such that ( a , a )( z, x ) and ( a , a )( z, y ).This is possible sine a is the flexible atom. We get a ( f ( z ) , f ( x )) and a ( f ( z ) , f ( y )) which induces again a forbidden triple on f ( x ) , f ( y ), and f ( z ).Since we choose the a , x , and y arbitrary this means f is { a, Id } -canonicalwith ¯ f ( a, Id) = a = ¯ f (Id , a ) for every a ∈ A . Therefore f is injective. ⊓⊔ Proposition 52.
Let a , a ∈ A \ { Id } be atoms. If there exists a binary { a , a } -symmetric polymorphism of B , then B has also a binary canonical { a , a } -symmetric polymorphism.Proof. Let f be the binary { a , a } -symmetric polymorphism. By Lemma 51 weknow that f is injective and therefore by Proposition 48 it induces a polymor-phism f < on B < . Let g be the canonization of f < that exists by Theorem 23.The operation g can be viewed as a polymorphism of B and this polymorphismis clearly { a , a } -symmetric.Therefore the behaviour induced by the orbitals that satisfy x ≤ y is { a , a } -symmetric. By Proposition 49 this behaviour is the behaviour of a canonicalpolymorphism of B . ⊓⊔ The Ternary Case
We denote by Pol can ( B ) the set of all polymorphisms of B that are canonical. Definition 53.
Let B be a normal representation of a finite, integral, symmet-ric A ∈ RRA with a flexible atom s . Let Pol can ( B ) be the clone of canonicalpolymorphisms of B . We call a subset { a , a } ⊆ A an edges of Pol can ( B ) andwe call the elements in Q := (cid:8) { a , a } ⊆ A | ∃ g ∈ Pol can ( B ) such that ¯ g is symmetric on { a , a } (cid:9) , the red edges of Pol can ( B ) . The terminology of the colored edges as well as the following lemma arefrom [20].
Lemma 54.
Let B be a normal representation of a finite, integral, symmetric A ∈ RRA . Let
Pol can ( B ) be the clone of canonical polymorphisms of B . Thereexists a binary canonical polymorphism s ∈ Pol can ( B ) that is symmetric on allred edges and behaves on each edge that is not red like a projection. We call thisfunction maximal-symmetric.Proof. For { a i , a j } ∈ Q let f a i ,a j be the canonical polymorphism such that itsbehaviour is symmetric on { a i , a j } . We prove the lemma by a finite inductive argument on the size of subsets of Q . For all subsets of Q of size one, there existsa canonical polymorphism with a behaviour that is symmetric on all elementsof this subset. Let F ⊂ Q and suppose there exist a canonical polymorphism g with symmetric behaviour on elements from F and let { a , a } ∈ Q \ F . Wewant to show that there exists a canonical polymorphism with a behaviour thatis symmetric on all elements from F ∪ { a , a } . We can assume that this doesnot hold for g , otherwise we are done. Therefore and since g is edge-conservativewe have ¯ g ( a , a ) = ¯ g ( a , a ) and ¯ g ( a , a ) , ¯ g ( a , a ) ∈ { a , a } . With this it is easy to see that the following canonical polymorphism has abehaviour that is symmetric on all elements from F ∪ { a , a } f a ,a ( g ( x, y ) , g ( y, x )) . This proves the first part of the statement. For the second part note that fora binary canonical edge-conservative polymorphism there are only 4 possibilitiesfor the behaviour on a subalgebra { a , a } . If { a , a } is not a red edge everybinary canonical edge-conservative polymorphism behaves like a projection on { a , a } . ⊓⊔ Definition 55.
Let τ be a relational signature and let B be a τ -structure. For n ∈ N + the structure B n is a τ -structure on the domain B n . The interpretationof the symbols from τ is as follows. Let R ∈ τ with arity l . Then the followingholds ( x , . . . , x l ) ∈ R B n : ⇔ ∀ i ∈ { , . . . , n } : ( x i , . . . , x li ) ∈ R B . Lemma 56.
Let B be a normal representation of a finite, integral, symmetric A ∈ RRA . Let s ∈ Pol can ( B ) be an injective, maximal-symmetric polymorphism.Then the function s ∗ : B → B where s ∗ ( x , x , x ) is defined by ( s ( s ( x , x ) , s ( x , x )) , s ( s ( x , x ) , s ( x , x )) , s ( s ( x , x ) , s ( x , x ))) is a homomorphism. Moreover, for all distinct elements x, y ∈ B it holds that Id B ( s ∗ ( x ) , s ∗ ( y )) . Note that this means that two distinct tuples in the image of s ∗ have distinctentries in each coordinate. Proof.
Let x, y ∈ B and suppose that a B ( x, y ) holds for a ∈ A . By definitionof the product structure also a B ( x i , y i ) holds for all i ∈ { , , } . Since s is apolymorphism clearly a B ( s ∗ ( x ) i , s ∗ ( y ) i ) holds by the definition of s ∗ . Now weuse again the definition of a product structure and get a B ( s ∗ ( x ) , s ∗ ( y )) whichshows that s ∗ is a homomorphism.For the second part of the statement let x, y ∈ B distinct. Suppose that a B ( x , y ), a B ( x , y ) and a B ( x , y ) hold for some a , a , a ∈ A , where at etwork satisfaction for symmetric relation algebras with a flexible atom 27 least one atom is different from Id. Since s is injective we have that at least oneof the following holds:Id B ( s ( x , x ) , s ( y , y )) or Id B ( s ( x , x ) , s ( y , y )) . If we apply the injectivity of s a second time we getId B ( s ( s ( x , x ) , s ( x , x )) , s ( s ( y , y ) , s ( y , y ))) . By the definition of s ∗ this shows that Id B ( s ∗ ( x ) , s ∗ ( y ) ) holds. It is easyto see by analogous arguments that the same is true for the other coordinates.Therefore, the statement follows. ⊓⊔ Proposition 57.
Let a Id and a Id be atoms of A such that { a , a } 6∈ Q .Let m be a ternary { a , a } -canonical polymorphism of B . If B has an injective,maximal-symmetric polymorphism, then there exists a canonical polymorphism m ′ with the same behaviour on { a , a } as m .Proof. Let s be the injective maximal-symmetric polymorphism. With Lemma 54we can assume that s behaves on { a , a } like the projection to the first coordi-nate since { a , a } 6∈ Q . Let s ∗ be the function defined in Lemma 56.Claim 1: m ( s ∗ ) is injective. Let x, y ∈ B be two distinct elements. By Lemma56 we know that Id B ( s ∗ ( x ) , s ∗ ( y )) holds. Since m is a polymorphism of B wedirectly get that Id B ( m ( s ∗ ( x )) , m ( s ∗ ( y ))) holds, which proves the injectivity of m ( s ∗ ).Claim 2: m ( s ∗ ) is { a , a } -canonical and behaves on { a , a } like m . Since s behaves on { a , a } like the first projection it is easy to see that for x, y ∈ B with( q , q , q )( x, y ) where q , q , q ∈ { a , a } it follows that ( q , q , q )( s ∗ ( x ) , s ∗ ( y ))holds. This proves the claim.Since m ( s ∗ ) is injective there exists by Proposition 48 a polymorphism m ( s ∗ ) < of B < . Since B < is a Ramsey structure we can apply Theorem 23 to m ( s ∗ ) < .Let g be resulting polymorphism that is canonical with respect to B < . Note thatif we consider g as a polymorphism of B it behaves on { a , a } like m ( s ∗ ) andtherefore like m . Now we consider the induced behaviour of g on all 2-orbitalsthat satisfy x < y . Since all atoms of A are symmetric and ¯ g is conservative thisinduces a function h : ( A \ { Id } ) → A \ { Id } .Claim 3: The partial behaviour h does not induce a forbidden substructure.Assume there exist x, y, z ∈ B such that the application of a polymorphismwith behaviour h would induce a forbidden substructure. We can easily order theelements of each coordinate of x, y, z strictly with x i < y i < z i for i ∈ { , , } .Note that if on some coordinate there would be the relation Id then we are outof the domain of the behaviour h .If we choose this such an order we can find isomorphic copies A of thisstructure (with the order) in B < . If we apply the polymorphism g to this copy and forget the order of the structure g ( A ) we get an structure that is by definitionisomorphic to the forbidden substructure with which we started. This provesClaim 3.To finish the proof of the lemma note that s ∗ induces a function f : A → ( A \ { Id } ) . This is because on each coordinate of its image the operation s ∗ is acomposition of canonical, injective polymorphisms. The composition h ◦ f : A → A is a behaviour of a canonical function of B . If h ◦ f would induce a forbiddensubstructure also h would induce a forbidden substructure which contradictsClaim 3. ⊓⊔ Corollary 58.
Let B be a normal representation of a finite, integral, symmet-ric A ∈ RRA with a flexible atom such that B has an injective polymorphism.Let a , a ∈ A such that no { a , a } -symmetric polymorphism exists. Let m bea ternary { a , a } -canonical polymorphism. Then there exists a canonical poly-morphism m ′ with the same behaviour on { a , a } as m .Proof. By Proposition 52 there exists also no canonical { a , a } -symmetric poly-morphism and therefore { a , a } 6∈ Q holds.By Corollary 50 there exists an injective canonical polymorphism of B . Thispolymorphism is a witness that for all a ∈ A \ { Id } it holds that { a, Id } ∈ Q . With Lemma 54 and Lemma 46 we get an injective, maximal symmetricpolymorphism. Now we can apply Proposition 57 and get the statement. ⊓⊔ We prove in this section the following proposition. The ingredients of our proofare the Independence Lemma 41 and the fact that A ∈ RRA has a flexible atom.
Proposition 59.
Let B be a normal representation of a finite, integral, sym-metric relation algebra with a flexible atom s . Let f be a binary injective poly-morphism of B . Let a Id and b Id be two atoms such that B has no { a, b } -symmetric polymorphism. Then all polymorphisms are canonical on { a, b } .Proof. Let ψ be the following formula: ψ ( x , x , y , y ) := Id( x , y ) ∧ Id( x , y ) ∧ Id( x , y ) ∧ Id( x , y ) . Let t be the injective, maximal symmetric polymorphism that exists by Corol-lary 58. Note that t behaves like a projection on { a, b } since there exists no { a, b } -symmetric polymorphism.Claim 1: There exists a formula ϕ a ( x , x , y , y ) such that ϕ a ∧ ψ ( x , x , y , y ) ∧ a ( x , x ) ∧ b ( y , y ) and ϕ a ∧ ψ ( x , x , y , y ) ∧ b ( x , x ) ∧ a ( y , y ) are satisfiable in B and the formula ϕ a ∧ a ( x , x ) ∧ a ( y , y ) is notsatisfiable in B (we denote this property with ⋆ ).And there exists a formula and ϕ b ( x , x , y , y ) such that ϕ b ∧ ψ ( x , x , y , y ) ∧ b ( x , x ) ∧ a ( y , y ) and ϕ b ∧ ψ ( x , x , y , y ) ∧ a ( x , x ) ∧ etwork satisfaction for symmetric relation algebras with a flexible atom 29 b ( y , y ) are satisfiable in B and the formula ϕ b ∧ b ( x , x ) ∧ b ( y , y ) is notsatisfiable in B (this is also property ⋆ ).Let ϕ a and ϕ b be the formulas that exist by the Independence Lemma 41.Assume property ⋆ does not hold.Note that if we have for c ∈ { a, b } , d ∈ { a, b } \ { c } that ϕ c ( x , x , y , y ) ∧ c ( x , x ) ∧ d ( y , y ) ∧ Id( x , y ) (2)and ϕ c ( x , x , y , y ) ∧ d ( x , x ) ∧ c ( y , y ) ∧ Id( x , y ) (3)are satisfiable in B , then property ⋆ holds. To see this note that we can applythe injective, maximal symmetric polymorphism t that behaves like a projectionon { a, b } to the tuples that witness (2) and (3) (Note that the first tuple satisfiesId( x , y ) and the second Id( x , y )). We conclude with this that for ϕ c eitherproperty ⋆ holds or ϕ c ( x , x , y , y ) ∧ c ( x , x ) ∧ d ( y , y ) ∧ Id( x , y )and ϕ c ( x , x , y , y ) ∧ d ( x , x ) ∧ c ( y , y ) ∧ Id( x , y )are satisfiable in B . We refer to this property with ♠ and distinguish the followingdifferent cases.1. ϕ a has property ⋆ and ϕ b has property ♠ .2. ϕ a has property ♠ and ϕ b has property ⋆ .3. ϕ a has property ♠ and ϕ b has property ♠ .Case 1: Consider the following formula ϕ ′ b with ϕ ′ b ( x , x , y , y ) := ∃ z , z : ϕ b ( x , x , x , z ) ∧ ϕ a ( x , z , z , y ) ∧ ϕ b ( z , y , y , y ) . It is easy to see that the satisfiability part of property ⋆ holds for ϕ ′ b since itholds for ϕ a and we can clue an satisfying tuple from ϕ a together with satisfyingtuples from ϕ b . All missing edges are filled with the flexible atom s . The non-satisfiability part follows from the definition.Case 2: This case is analogous to Case 1.Case 3: Let p , . . . , p ∈ A \ { Id } be the atoms such that ϕ a ( x , x , y , y ) ∧ a ( x , x ) ∧ b ( y , y ) ∧ Id( x , y ) ∧ p ( x , x ) ,ϕ a ( x , x , y , y ) ∧ b ( x , x ) ∧ a ( y , y ) ∧ Id( x , y ) ∧ p ( x , x ) ,ϕ b ( x , x , y , y ) ∧ a ( x , x ) ∧ b ( y , y ) ∧ Id( x , y ) ∧ p ( x , x ) , and ϕ b ( x , x , y , y ) ∧ b ( x , x ) ∧ a ( y , y ) ∧ Id( x , y ) ∧ p ( x , x )are satisfiable in B . Consider the formula ϕ ′ a with ϕ ′ a ( x , x , y , y ) := ∃ z : ϕ a ( x , x , x , z ) ∧ ϕ b ( x , z , z , y ) ∧ ϕ a ( z , y , y , y ) . We show that ϕ ′ a ∧ ψ ( x , x , y , y ) ∧ a ( x , x ) ∧ b ( y , y ) is satisfiable in B . Let u , . . . , u ∈ B be such that the following atomic formulas hold: a ( u , u ) , p ( u , u ) , s ( u , u ) , s ( u , u ) ,b ( u , u ) , p ( u , u ) , s ( u , u ) ,a ( u , u ) , p ( u , u ) ,b ( u , u ) . One can check that such a structure exists. If we choose for the existentially quan-tified variable z in the definition the element u then the tuple ( u , u , u , u )satisfies the formula ϕ ′ a ∧ ψ ( x , x , y , y ) ∧ a ( x , x ) ∧ b ( y , y ). By an analo-gous argument also ϕ ′ a ∧ ψ ( x , x , y , y ) ∧ b ( x , x ) ∧ a ( y , y ) is satisfiable. Thenon-satisfiability part of property ⋆ follows from the definition of ϕ ′ a . We cando the same to prove that there exists also a formula ϕ ′ b that has property ⋆ .Therefore we are done with Case 3. Altogether this proves Claim 1.Let ϕ a and ϕ b be the two formulas that exist by Claim 1. We define thefollowing formulas ϕ ′ a := ϕ a ∧ ( a ∪ b )( x , x ) ∧ ( a ∪ b )( y , y ) ϕ ′ b := ϕ b ∧ ( a ∪ a )( x , x ) ∧ ( a ∪ b )( y , y ) . Now we define the 4-ary relation R as follows: δ ( x , x , x , x ) := s ( x , x ) ∧ s ( x , x ) ∧ s ( x , x ) ∧ s ( x , x ) ∧ ∃ y , y , y , y : ϕ ′ a ( x , x , y , y ) ∧ ϕ ′ b ( y , y , y , y ) ∧ ϕ ′ a ( y , y , x , x ) ∧ ∃ z , z , z , z : ϕ ′ b ( x , x , z , z ) ∧ ϕ ′ a ( z , z , z , z ) ∧ ϕ ′ b ( z , z , x , x ) . The formulas δ ∧ a ( x , x ) ∧ b ( x , x ) and δ ∧ b ( x , x ) ∧ a ( x , x ) are satisfiablein B , since we again can glue tuples that satisfy ϕ ′ a and ϕ ′ b in a suitable waytogether. Note that this is possible since we ensured in Claim 1 that there existtuples that additionally satisfy ψ .It also holds that u ∈ R ⇒ ( a ( u , u ) ∧ b ( u , u )) ∨ ( b ( u , u ) ∧ a ( u , u )) . Assume that for u ∈ R it holds that a ( u , u ) ∧ a ( u , u ). Then there ex-ist y , y , y , y such that ϕ ′ a ( u , u , y , y ) ∧ ϕ ′ a ( y , y , x , x ) holds. But this isby the definition of ϕ ′ a only possible if b ( y , y ) and b ( y , y ) hold. This is acontradiction to ϕ ′ b ( y , y , y , y ). The same argument works for proving that ¬ ( b ( u , u ) ∧ b ( u , u )) holds. etwork satisfaction for symmetric relation algebras with a flexible atom 31 If the following 4-ary relation E a,b is primitively positively definable in B then clearly all polymorphisms are { a, b } -canonical.( x . . . , x ) ∈ E a,b : ⇔ (( a ∪ b )( x , x ) ∧ ( a ∪ b )( x , x ) ∧ a ( x , x ) ⇔ a ( x , x ))We complete this proof with the following primitive positive definition of E a,b .( x . . . , x ) ∈ E a,b : ⇔ ∃ y , y : ( δ ( x , x , y , y ) ∧ δ ( y , y , x , x )) . This works since a tuple u that satisfies δ also satisfies s ( u , u ) ∧ s ( u , u ) ∧ s ( u , u ) ∧ s ( u , u ). Therefore, we can find always witnesses for the existentiallyquantified variables y and y . ⊓⊔ We prove the main result of this paper.
Theorem 60.
Let A be a finite, integral, symmetric relation algebra with aflexible atom, and let A be the set of atoms of A . Then either – there exists an operation f : A → A that preserves the allowed triples of A and satisfies the Siggers identity ∀ x, y, z ∈ A : f ( x, x, y, y, z, z ) = f ( y, z, x, z, x, y ); in this case the network satisfaction problem for A is in P, or – HSP fin ( { Pol( B ) } ) contains a 2-element algebra where all operations are pro-jections; in this case, the network satisfaction problem for A is NP-complete.Proof. Let B be the normal representation of A . The finitely boundedness of B implies that CSP( B ) is in NP. Let O be the atom structure of A . If Pol can ( B )contains a polymorphism that has a behaviour which satisfies the Siggers identitythe statement follows by Proposition 36.Assume therefore that the first item in the theorem does not hold. We may as-sume that B has a binary injective polymorphism. Otherwise, B has by Lemma47 no { s, Id } -symmetric polymorphism and therefore all polymorphisms of B are { s, Id } -canonical according to Lemma 44. Lemma 45 implies that all poly-morphisms are projections on { s, Id } . This means also that the atoms s, Id ∈ A satisfy the second item. The NP-hardness follows by Proposition 42.The existence of a binary injective polymorphism implies by Corollary 50 theexistence of a canonical binary injective polymorphism g .By Theorem 39 there exist elements a , a ∈ A such that the subalgebraof Pol( O ) on { a , a } contains only projections. It holds that Id
6∈ { a , a } ,since g is a witness that Id can not be in the domain of a subalgebra that con-tains only projections. Therefore, there exists no canonical polymorphism thatis { a , a } -symmetric. By Proposition 52 there exists also no { a , a } -symmetricpolymorphism. Since there exists a binary injective polymorphism we can ap-ply Proposition 59 and get that all polymorphisms of B are { a , a } -canonical. The last step is to show that all polymorphisms of B behave like projections on { a , a } .Assume for contradiction that there exists a ternary, { a , a } -canonical poly-morphism m that behaves on { a , a } like a majority or like a minority. ByCorollary 58 there exists a canonical polymorphism that is also a majority orminority on { a , a } (Here we use again the existence of an injective polymor-phism). This contradicts our assumption that Pol( O ) is trivial on { a , a } . Weget that every polymorphism of B does not behave on { a , a } as an operationfrom Theorem 13 and therefore must behave as a projection on { a , a } by The-orem 13. Thus, HSP fin ( { Pol( B ) } ) contains a 2-element algebra whose operationsare projections and CSP( B ) is NP-hard, according to Theorem 18 . ⊓⊔ The following shows how to apply our hardness result to a concrete A ∈ RRA.
Example 61 (Hardness of relation algebra , see [10, 12]).
To prove the NP-hardness of the NSP for the relation algebra from Example 31 we do not needthe full power of our classification result. It is enough and easier to see thatthe hardness condition given in Proposition 42 applies. Let N ′ be the normalrepresentation of the relation algebra N ′ does not have a binary injective polymorphism. To see this, consider asubstructure of N ′ on elements x, y, z ∈ V such that ( E, =)( x, y ), (= , E )( y, x ),and ( E, E )( x, z ) hold in N ′ . Assume there exists an injective binary polymor-phism f . This means that f ( E, Id) = E = f (Id , E ) holds. Then we get that E ( f ( x ) , f ( y )), E ( f ( y ) , f ( z )) and E ( f ( x ) , f ( z ) hold in N ′ , which is a contradic-tion, since in N ′ triangles of this form are forbidden. Therefore, Proposition 42implies NP-hardness of NSP(
10 Conclusion
We classified the computational complexity of the network satisfaction problemfor a finite symmetric A ∈ RRA with a flexible atom and obtained a P versusNP-complete dichotomy. We gave decidable criteria for A that characterize boththe containment in P and NP-hardness. We want to mention that if we drop theassumptions on A to be symmetric and to have a flexible atom the statement ofTheorem 1 is false. An example for this is the Point Algebra; although the NSPof this relation algebra is in P, the first condition of Theorem 1 does not apply.On the other hand, if we only drop the symmetry assumption we conjecture thatTheorem 1 still holds. Similarly, if we only drop the flexible atom assumptionwe conjecture that the statement also remains true. References
1. Allen, J.F.: Maintaining knowledge about temporal intervals. Communications ofthe ACM (11), 832–843 (1983)2. Alm, J.F., Maddux, R.D., Manske, J.: Chromatic graphs, ramsey numbers andthe flexible atom conjecture. The Electronic Journal of Combinatorics (1) (Mar2008). https://doi.org/10.37236/773, https://doi.org/10.37236/773 etwork satisfaction for symmetric relation algebras with a flexible atom 333. Andr´eka, H., Maddux, R.D.: Representations for small relation algebras. NotreDame Journal of Formal Logic (4), 550–562 (1994)4. Barto, L.: The dichotomy for conservative constraint satisfaction problems revis-ited. In: Proceedings of the Symposium on Logic in Computer Science (LICS).Toronto, Canada (2011)5. Bodirsky, M.: Constraint satisfaction problems with infinite templates. In: Vollmer,H. (ed.) Complexity of Constraints (a collection of survey articles), Lecture Notesin Computer Science, vol. 5250, pp. 196–228. Springer (2008)6. Bodirsky, M.: Ramsey classes: Examples and constructions. In: Surveys in Combi-natorics. London Mathematical Society Lecture Note Series 424. Cambridge Uni-versity Press (2015), invited survey article for the British Combinatorial Confer-ence; ArXiv:1502.051467. Bodirsky, M., Dalmau, V.: Datalog and constraint satisfaction with infinite tem-plates. Journal on Computer and System Sciences , 79–100 (2013), a preliminaryversion appeared in the proceedings of the Symposium on Theoretical Aspects ofComputer Science (STACS’05)8. Bodirsky, M., Jonsson, P.: A model-theoretic view on qualitative constraint rea-soning. Journal of Artificial Intelligence Research , 339–385 (2017)9. Bodirsky, M., Jonsson, P., von Oertzen, T.: Horn versus full first-order: complexitydichotomies for algebraic constraint satisfaction. Journal of Logic and Computation (3), 643–660 (2011)10. Bodirsky, M., Kn¨auer, S.: Hardness of network satisfaction for relation al-gebras with normal representations. In: Relational and Algebraic Methodsin Computer Science, pp. 31–46. Springer International Publishing (2020), https://doi.org/10.1007/978-3-030-43520-2_3
11. Bodirsky, M., Kutz, M.: Determining the consistency of partial tree descriptions.Artificial Intelligence , 185–196 (2007)12. Bodirsky, M., Martin, B., Pinsker, M., Pongr´acz, A.: Constraint satisfaction prob-lems for reducts of homogeneous graphs. SIAM Journal on Computing (4), 1224–1264 (2019), a conference version appeared in the Proceedings of the 43rd Inter-national Colloquium on Automata, Languages, and Programming, ICALP 2016,pages 119:1–119:1413. Bodirsky, M., Mottet, A.: Reducts of finitely bounded homogeneous structures,and lifting tractability from finite-domain constraint satisfaction. In: Proceedingsof the 31th Annual IEEE Symposium on Logic in Computer Science (LICS). pp.623–632 (2016), preprint available at ArXiv:1601.0452014. Bodirsky, M., Neˇsetˇril, J.: Constraint satisfaction with countable homogeneoustemplates. Journal of Logic and Computation (3), 359–373 (2006)15. Bodirsky, M., Pinsker, M.: Minimal functions on the random graph. Israel Journalof Mathematics (1), 251–296 (2014)16. Bodirsky, M., Pinsker, M.: Schaefer’s theorem for graphs. Journal of the ACM (3), 52 pages (article number 19) (2015), a conference version appeared in theProceedings of STOC 2011, pages 655–66417. Bodirsky, M., Pinsker, M.: Canonical Functions: a Proof via Topological Dynamics(2016), preprint available under http://arxiv.org/abs/1610.0966018. Bodirsky, M., Pinsker, M., Pongr´acz, A.: Projective clone homo-morphisms. The Journal of Symbolic Logic pp. 1–13 (May 2019).https://doi.org/10.1017/jsl.2019.23, https://doi.org/10.1017/jsl.2019.23
19. Bulatov, A.A.: Tractable conservative constraint satisfaction problems. In: Pro-ceedings of the Symposium on Logic in Computer Science (LICS). pp. 321–330.Ottawa, Canada (2003)4 Manuel Bodirsky and Simon Kn¨auer20. Bulatov, A.A.: Conservative constraint satisfaction re-revisited. Journal Computer and System Sciences (2),347–356 (2016). https://doi.org/10.1016/j.jcss.2015.07.004, https://doi.org/10.1016/j.jcss.2015.07.004 , arXiv:1408.369021. Bulatov, A.A.: A dichotomy theorem for nonuniform CSPs. In: 58th IEEE AnnualSymposium on Foundations of Computer Science, FOCS 2017, Berkeley, CA, USA,October 15-17, 2017. pp. 319–330 (2017)22. Comer, S.D.: Combinatorial aspects of relations. Algebra Univer-salis (1), 77–94 (Feb 1984). https://doi.org/10.1007/bf01182249, https://doi.org/10.1007/bf01182249
23. Cristiani, M., Hirsch, R.: The complexity of the constraint satisfaction problem forsmall relation algebras. Artificial Intelligence Journal , 177–196 (2004)24. D¨untsch, I.: Relation algebras and their application in temporal and spatial rea-soning. Artificial Intelligence Review , 315–357 (2005)25. Hirsch, R., Hodkinson, I.: Strongly representable atom structures of relation al-gebras. Transactions of the American Mathematical Society (6), 1819–1831)(2001)26. Hirsch, R.: Relation algebras of intervals. Artificial Intelligence Journal , 1–29(1996)27. Hirsch, R.: Expressive power and complexity in algebraic logic. Journal of Logicand Computation (3), 309 – 351 (1997)28. Hirsch, R.: A finite relation algebra with undecidable network satisfaction problem.Logic Journal of the IGPL (4), 547–554 (1999)29. Hirsch, R., Jackson, M., Kowalski, T.: Algebraic foundations for qualitative calculiand networks. Theor. Comput. Sci. , 99–116 (2019)30. Hodges, W.: A shorter model theory. Cambridge University Press, Cambridge(1997)31. Hubiˇcka, J., Neˇsetˇril, J.: All those ramsey classes (ramsey classeswith closures and forbidden homomorphisms). Advances in Mathemat-ics , 106791 (Nov 2019). https://doi.org/10.1016/j.aim.2019.106791, https://doi.org/10.1016/j.aim.2019.106791
32. Ladkin, P.B., Maddux, R.D.: On binary constraint problems. Journal of the Asso-ciation for Computing Machinery (3), 435–469 (1994)33. Lyndon, R.: The representation of relational algebras. Annals of Mathematics (3), 707–729 (1950)34. Maddux, R.: Some varieties containing relation algebras. Trans-actions of the American Mathematical Society (2), 501–501 (Feb 1982). https://doi.org/10.1090/s0002-9947-1982-0662049-7, https://doi.org/10.1090/s0002-9947-1982-0662049-7
35. Maddux, R.D.: A perspective on the theory of relation algebras. Alge-bra Universalis (3), 456–465 (Sep 1994). https://doi.org/10.1007/bf01221799, https://doi.org/10.1007/bf01221799
36. Maddux, R.D.: Finite symmetric integral relation algebras with no 3-cycles. In:Schmidt, R.A. (ed.) Relations and Kleene Algebra in Computer Science, 9th In-ternational Conference on Relational Methods in Computer Science and 4th In-ternational Workshop on Applications of Kleene Algebra, RelMiCS/AKA 2006,Manchester, UK, August 29-September 2, 2006, Proceedings. Lecture Notes inComputer Science, vol. 4136, pp. 2–29. Springer (2006)37. Neˇsetˇril, J., R¨odl, V.: The partite construction and Ramsey set systems. DiscreteMathematics (1-3), 327–334 (1989)etwork satisfaction for symmetric relation algebras with a flexible atom 3538. Post, E.L.: The two-valued iterative systems of mathematical logic. Annals ofMathematics Studies (1941)39. Renz, J., Nebel, B.: On the complexity of qualitative spatial reasoning: A maximaltractable fragment of the region connection calculus. Artificial Intelligence (1-2), 69–123 (1999)40. Renz, J., Nebel, B.: Qualitative spatial reasoning using constraint calculi. In: Aiello,M., Pratt-Hartmann, I., van Benthem, J. (eds.) Handbook of Spatial Logics, pp.161–215. Springer Verlag, Berlin (2007)41. Siggers, M.H.: A strong Mal’cev condition for varieties omitting the unary type.Algebra Universalis64