{'fraction_non_alphanumeric': 0.04170622780180751, 'fraction_numerical': 0.011745261455146464, 'mean_word_length': 4.216067498165811, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 9, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Finite Relation Algebras with Normal Representations

One of the traditional applications of relation algebras is to provide a setting for infinite-domain constraint satisfaction problems. Complexity classification for these computational problems has been one of the major open research challenges of this application field. The past decade has brought significant progress on the theory of constraint satisfaction, both over finite and infinite domains. This progress has been achieved independently from the relation algebra approach. The present article translates the recent findings into the traditional relation algebra setting, and points out a series of open problems at the interface between model theory and the theory of relation algebras.


Introduction
One of the fundamental computational problems for a relation algebra A is the network satisfaction problem for A, which is to determine for a given A-network N whether it is satisfiable in some representation of A (for definitions, see Sections 2 and 3). Robin Hirsch named in 1995 the Really Big Complexity Problem (RBCP) for relation algebras, which is to 'clearly map out which (finite) relation algebras are tractable and which are intractable' [Hir96]. For example, for the Point Algebra the network satisfaction problem is in P and for Allen's Interval Algebra it is NP-hard. One of the standard methods to show that the network satisfaction problem for a finite relation algebra is in P is via establishing local consistency. The question whether the network satisfaction problem for A can be solved by local consistency methods is another question that has been studied intensively for finite relation algebras A (see [BJ17] for a survey on the second question).
If A has a fully universal square representation (we follow the terminology of Hirsch [Hir96]) then the network satisfaction problem for A can be formulated as a constraint satisfaction problem (CSP) for a countably infinite structure. The complexity of constraint satisfaction is a research direction that has seen quite some progress in the past years. The dichotomy conjecture of Feder and Vardi from 1993 states that every CSP for a finite structure is in P or NP-hard; the tractability conjecture [BKJ05] is a stronger conjecture that predicts precisely which CSPs are in P and which are NP-hard. Two independent proofs of these conjectures appeared in 2017 [Bul17,Zhu17], based on concepts and tools from universal algebra. An earlier result of Barto and Kozik [BK09] gives an exact characterisation of those finite-domain CSPs that can be solved by local consistency methods.
Usually, the network satisfaction problem for a finite relation algebra A cannot be formulated as a CSP for a finite structure. However, suprisingly often it can be formulated as a CSP for a countably infinite ω-categorical structure B. For an important subclass of ω-categorical structures we have a tractability conjecture, too. The condition that supposedly characterises containment in P can be formulated in many non-trivially equivalent ways [BKO + 17,BP16,BOP17] and has been confirmed in numerous special cases, see for instance the articles [BK08, BMPP16, KP17, BJP17, BMM18, BM16] and the references therein.
In the light of the recent advances in constraint satisfaction, both over finite and infinite domains, we revisit the RBCP and discuss the current state of the art. In particular, we observe that if A has a normal representation (again, we follow the terminology of Hirsch [Hir96]), then the network satisfaction problem for A falls into the scope of the infinite-domain tractability conjecture. We also show that there is an algorithm that decides for a given finite relation algebra A with a fully universal square representation whether A has a normal representation. (In other words, there is an algorithm that decides for a given A whether the class of atomic A-networks has the amalgamation property.) The scope of the tractability conjecture is larger, though. We describe an example of a finite relation algebra which has an ω-categorical fully universal square representation (and a polynomial-time tractable network satisfaction problem) which is not normal, but which does fall into the scope of the conjecture.
Whether the infinite-domain tractability conjecture might contribute to the resolution of the RBCP in general remains open; we present several questions in Section 7 whose answer would shed some light on this question. These questions concern the existence of ω-categorical fully universal square representations and are of independent interest, and in my view they are central to the theory of representable finite relation algebras.

Relation Algebras
A proper relation algebra is a set B together with a set R of binary relations over B such that (1) Id := {(x, x) | x ∈ B} ∈ R; (2) If R 1 and R 2 are from R, then R 1 ∨ R 2 := R 1 ∪ R 2 ∈ R; (3) 1 := R∈R R ∈ R; (4) 0 := ∅ ∈ R; We want to point out that in this standard definition of proper relation algebras it is not required that 1 denotes B 2 . However, in most examples, 1 indeed denotes B 2 ; in this case we say that the proper relation algebra is square. The inclusion-wise minimal non-empty elements of R are called the basic relations of the proper relation algebra.
Example 1 (The Point Algebra). Let B = Q be the set of rational numbers, and consider Those relations form a proper relation algebra (with the basic relations <, >, =, and where 1 denotes Q 2 ) which is known under the name point algebra.
The relation algebra associated to (B, R) is the algebra A with the domain A := R and the signature τ := {∨, −, 0, 1, •, , Id} obtained from (B, R) in the obvious way. An abstract relation algebra is a τ -algebra that satisfies some of the laws that hold for the respective operators in a proper relation algebra. We do not need the precise definition of an abstract relation algebra in this article since we deal exclusively with representable relation algebras: a representation of an abstract relation algebra A is a relational structure B whose signature is A; that is, the elements of the relation algebra are the relation symbols of B. Each relation symbol a ∈ A is associated to a binary relation a B over B such that the set of relations of B induces a proper relation algebra, and the map a → a B is an isomorphism with respect to the operations (and constants) {∨, −, 0, 1, •, , Id}. In this case, we also say that A is the abstract relation algebra of B. An abstract relation algebra that has a representation is called representable. For x, y ∈ A, we write x ≤ y as a shortcut for the partial order defined by x ∨ y = y. The minimal elements of A \ {0} with respect to ≤ are called the atoms of A. In every representation of A, the atoms denote the basic relations of the representation. We mention that there are abstract finite relation algebras that are not representable [Lyn50], and that the question whether a finite relation algebra is representable is undecidable [HH01].
Example 2. The (abstract) point algebra is a relation algebra with 8 elements and 3 atoms, =, <, and >, and can be described as follows. The values of the composition operator for the atoms of the point algebra are shown in the table of Figure 1. Note that this table determines the full composition table. The inverse (<) of < is >, and Id denotes = which is its own inverse. This fully determines the relation algebra. The proper relation algebra with domain Q presented in Example 1 is a representation of the point algebra.

The network satisfaction problem
Let A be a finite relation algebra with domain A. An A-network N = (V ; f ) consists of a finite set of nodes V and a function f : (here we follow again the definitions in [Hir96]); • satisfiable if N is satisfiable in some representation B of A. The (general) network satisfaction problem for a finite relation algebra A is the computational problem to decide whether a given A-network is satisfiable. There are finite relation algebras A where this problem is undecidable [Hir99].
• square if its relations form a proper relation algebra that is square. The point algebra is an example of a relation algebra with a fully universal square representation. Note that if A has a fully universal representation, then the network satisfaction problem for A is decidable in NP: for a given network (V, f ), simply select for each x ∈ V 2 an atom a ∈ A with a ≤ f (x), replace f (x) by a, and then exhaustively check condition (1). Also note that a finite relation algebra has a fully universal representation if and only if the so-called path-consistency procedure decides satisfiability of atomic A-networks (see, e.g., [BJ17,HLR13]).
However, not all finite relation algebras have a fully universal representation. An example of a relation algebra with 4 atoms which has a representation with seven elements but where path consistency of atomic networks does not imply consistency, called B 9 , has been given in [LKRL08]. A representation of B 9 with domain {0, 1, . . . , 6} is given by the basic In fact, every representation of B 9 is isomorphic to this representation. Let N be the Then N is atomic but not satisfiable.

Constraint Satisfaction Problems
Let B be a structure with a (finite or infinite) domain B and a finite relational signature ρ. Then the constraint satisfaction problem for B is the computational problem of deciding whether a finite ρ-structure E homomorphically maps to B. Note that if B is a square representation of A, then the input E can be viewed as an A-network N . The nodes of N are the elements of E. To define f (x, y) for variables x, y of the network, let a 1 , . . . , a k be a list of all elements a ∈ A such that (x, y) ∈ a E . Then define f (x, y) = (a 1 ∧ · · · ∧ a k ); if k = 0, then f (x, y) = 1. Observe that E has a homomorphism to B if and only if N is satisfiable in B (here we use the assumption that B is a square representation).
Conversely, when N is an A-network, then we view N as the A-structure E whose domain are the nodes of N , and where (x, y) ∈ r E if and only if r = f (x, y). Again, E has a homomorphism to B if and only if N is satisfiable in B.
Proposition 3. Let B be a fully universal square representation of a finite relation algebra A. Then the network satisfaction problem for A equals the constraint satisfaction problem for B (up to the translation between A-networks and finite A-structures presented above).
Proof. We have to show that a network is satisfiable if and only if it has a homomorphism to B. Clearly, if N has a homomorphism to B then it is satisfiable in B, and hence satisfiable. For the other direction, suppose that the A-network N = (V, f ) is satisfiable in some representation of A. Then there exists for each x ∈ V 2 an atomic a ∈ A such that a ≤ f (x) and such that the network N obtained from N by replacing f (x) by a satisfies (1); hence, N is atomic and satisfiable in B since B is fully universal. Hence, N is satisfiable in B, too.
For general infinite structures B a systematic understanding of the computational complexity of CSP(B) is a hopeless endeavour [BG08]. However, if B is a first-order reduct of a finitely bounded homogeneous structure (the definitions can be found below), then the universal-algebraic tractability conjecture for finite-domain CSPs can be generalised. This condition is sufficiently general so that it includes fully universal square representations of almost all the concrete finite relation algebras studied in the literature, and the condition also captures the class of finite-domain CSPs. As we will see, the concepts of finite boundedness and homogeneity are conditions that have already been studied in the relation algebra literature.
4.1. Finite boundedness. Let ρ be a relational signature, and let F be a set of ρstructures. Then Forb(F) denotes the class of all finite ρ-structures A such that no structure in F embeds into A. For a ρ-structure B we write Age(B) for the class of all finite ρ-structures that embed into B. We say that B is finitely bounded if B has a finite relational signature and there exists a finite set of finite τ -structures F such that Age(B) = Forb(F). A simple example of a finitely bounded structure is (Q; <). It is easy to see that the constraint satisfaction problem of a finitely bounded structure B is in NP.
Proposition 4. Let A be a finite relation algebra with a fully universal square representation B. Then B is finitely bounded.
Proof sketch. Besides some bounds of size at most two that make sure that the atomic relations partition B 2 , it suffices to include appropriate three-element structures into F that can be read off from the composition table of A.

Homogeneity.
A relational structure B is homogeneous (or ultra-homogeneous [Hod97]) if every isomorphism between finite substructures of B can be extended to an automorphism of B. A simple example of a homogeneous structure is (Q; <).
A representation of a finite relation algebra A is called normal if it is square, fully universal, and homogeneous [Hir96]. The following is an immediate consequence of Proposition 3 and Proposition 4.
Corollary 5. Let A be a finite relation algebra with a normal representation B. Then the network satisfaction problem for A equals the constraint satisfaction problem for a finitely bounded homogeneous structure.
A versatile tool to construct homogeneous structures from classes of finite structures is amalgamationà la Fraïssé. We present it for the special case of relational structures; this is all that is needed here. An embedding of A into B is an isomorphism between A and a substructure of B. An amalgamation diagram is a pair (B 1 , B 2 ) where B 1 , B 2 are τstructures such that there exists a substructure A of both B 1 and B 2 such that all common elements of B 1 and B 2 are elements of A. We say that (B 1 , B 2 ) is a 2-point amalgamation diagram if |B 1 \ A| = |B 2 \ A| = 1. A τ -structure C is an amalgam of (B 1 , B 2 ) over A if for i = 1, 2 there are embeddings e i of B i to C such that e 1 (a) = e 2 (a) for all a ∈ A.
In the context of relation algebras A, the amalgamation property can also be formulated with atomic A-networks, in which case it has been called the patchwork property [HLR13]; we stick with the model-theoretic terminology here since it is older and well-established.
Definition 1. An isomorphism-closed class C of τ -structures has the amalgamation property if every amalgamation diagram of structures in C has an amalgam in C. A class of finite τ -structures that contains at most countably many non-isomorphic structures, has the amalgamation property, and is closed under taking induced substructures and isomorphisms is called an amalgamation class.
Note that since we only look at relational structures here (and since we allow structures to have an empty domain), the amalgamation property of C implies the joint embedding property (JEP) for C, which says that for any two structures B 1 , B 2 ∈ C there exists a structure C ∈ C that embeds both B 1 and B 2 .
Theorem 6 (Fraïssé [Fra54,Fra86]; see [Hod97]). Let C be an amalgamation class. Then there is a homogeneous and at most countable τ -structure C whose age equals C. The structure C is unique up to isomorphism, and called the Fraïssé-limit of C.
The following is a well-known example of a finite relation algebra which has a fully universal square representation, but not a normal one.
Example 7. The left linear point algebra (see [Hir97,Dün05]) is a relation algebra with four atoms, denoted by =, <, >, and |. Here we imagine that 'x < y' signifies that x is earlier in time than y. The idea is that at every point in time the past is linearly ordered; the future, however, is not yet determined and might branch into different worlds; incomparability of time points x and y is denoted by x|y. We might also think of x < y as x is to the left of y if we draw points in the plane, and this motivates the name left linear point algebra. The composition operator on those four basic relations is given in Figure 2. The inverse (<) of < is >, Id denotes =, and | is its own inverse, and the relation algebra is uniquely given by this data. It is well known (for details, see [Bod04]) that the left linear point algebra has a fully universal square representation. On the other hand, the networks drawn in Figure 3 show the failure of amalgamation.  An algorithm to test whether a finite relation algebra has a normal representation can be found in Section 6. 4.3. The infinite-domain dichotomy conjecture. The infinite-domain dichotomy conjecture applies to a class which is larger than the class of homogeneous finitely bounded structures. To introduce this class we need the concept of first-order reducts.
Suppose that two relational structures A and B have the same domain, that the signature of a structure A is a subset of the signature of B, and that R A = R B for all common relation symbols R. Then we call A a reduct of B, and B an expansion of A. In other words, A is obtained from B by dropping some of the relations. A first-order reduct of B is a reduct of the expansion of B by all relations that are first-order definable in B. The CSP for a first-order reduct of a finitely bounded homogeneous structure is in NP (see [Bod12]). An example of a structure which is not homogeneous, but a reduct of finitely bounded homogeneous structure is the representation of the left-linear point algebra (Example 7) given in [Bod04].
Conjecture 8 (Infinite-domain dichotomy conjecture). Let B be a first-order reduct of a finitely bounded homogeneous structure. Then CSP(B) is either in P or NP-complete.
Hence, the infinite-domain dichotomy conjecture implies the RBCP for finite relation algebras with a normal representation. In Section 5 we will see a more specific conjecture that characterises the NP-complete cases and the cases that are in P.

The Infinite-Domain Tractability Conjecture
To state the infinite-domain tractability conjecture, we need a couple of concepts that are most naturally introduced for the class of all ω-categorical structures. A theory is called ω-categorical if all its countably infinite models are isomorphic. A structure is called ω-categorical if its first-order theory is ω-categorical. Note that finite structures are ω-categorical since their first-order theories do not have countably infinite models. Homogeneous structures B with finite relational signature are ω-categorical. This follows from a very useful characterisation of ω-categoricity given by Engeler, Svenonius, and Ryll-Nardzewski (Theorem 9). The set of all automorphisms of B is denoted by Aut(B). The orbit of a k-tuple (t 1 , . . . , t n ) under Aut(B) is the set {(a(t 1 ), . . . , a(t n )) | a ∈ Aut(B)}. Orbits of pairs (i.e., 2-tuples) are also called orbitals.
Theorem 9 (see [Hod97]). A countable structure B is ω-categorical if and only if Aut(B) has only finitely many orbits of n-tuples, for all n ≥ 1.
The following is an easy consequence of Theorem 9.
First-order reducts of homogeneous structures, on the other hand, need not be homogeneous. An example of an ω-categorical structure which is not homogeneous is the ωcategorical representation of the left linear point algebra given in [Bod04] (see Example 7). Note that every ω-categorical structure B, and more generally every structure with finitely many orbitals, gives rise to a finite relation algebra, namely the relation algebra associated to the unions of orbitals of B (see [BJ17]); we refer to this relation algebra as the orbital relation algebra of B.
We first present a condition that implies that an ω-categorical structure has an NP-hard constraint satisfaction problem (Section 5.1). The tractability conjecture says that every reduct of a finitely bounded homogeneous structure that does not satisfy this condition is NP-complete. We then present an equivalent characterisation of the condition due to Barto and Pinsker (Section 5.2), and then yet another condition due to Barto, Opršal, and Pinsker, which was later shown to be equivalent (Section 5.3).
5.1. The original formulation of the conjecture. Let B be an ω-categorical structure. Then B is called • a core if all endomorphisms of B (i.e., homomorphisms from B to B) are embeddings (i.e., are injective and also preserve the complement of each relation). • model complete if all self-embeddings of B are elementary, i.e., preserve all firstorder formulas. Clearly, if B is a representation of a finite relation algebra A, then B is a core. However, not all representations of finite relation algebras are model complete. A simple example is the orbital relation algebra of the structure (Q + 0 ; <) where Q + 0 denotes the non-negative rationals: its representation with domain Q + 0 has self-embeddings that do not preserve the orbital {(0, 0)}.
Let τ be a relational signature. A τ -formula is called primitive positive if it is of the form ∃x 1 , . . . , x n (ψ 1 ∧ · · · ∧ ψ m ) where ψ i is of the form y 1 = y 2 or of the form R(y 1 , . . . , y k ) for R ∈ τ of arity k. The variables y 1 , . . . , y k can be free or from x 1 , . . . , x n . Clearly, primitive positive formulas are preserved by homomorphisms.
Theorem 11 ( [Bod07,BHM10]). Every ω-categorical structure B is homomorphically equivalent to a model-complete core C, which is unique up to isomorphism, and again ωcategorical. All orbits of k-tuples are primitive positive definable in C.
The (up to isomorphism unique) structure C from Theorem 11 is called the modelcomplete core of B. Let B and A be structures, let D ⊆ B n , and let I : D → A be a surjection. Then I is called a primitive positive interpretation if the pre-image under I of A, of the equality relation = A on A, and of all relations of A is primitive positive definable in A. In this case we also say that B interprets A primitively positively. The complete graph with three vertices (but without loops) is denoted by K 3 .
Theorem 12 ([Bod08]). Let B be an ω-categorical structure. If the model-complete core of B has an expansion by finitely many constants so that the resulting structure interprets K 3 primitively positively, then CSP(B) is NP-hard.
We can now state the infinite-domain tractability conjecture.
Conjecture 13. Let B be a first-order reduct of a finitely bounded homogeneous structure. If B does not satisfy the condition from Theorem 12 then CSP(B) is in P.
This conjecture has been verified in numerous special cases (see, for instance, the articles [BK08, BMPP16, KP17, BJP17, BMM18, BM16]), including the class of finitestructures [Bul17,Zhu17]. 5.2. The theorem of Barto and Pinsker. The tractability conjecture has a fundamentally different, but equivalent formulation: instead of the non-existence of a hardnesscondition, we require the existence of a polymorphism satisfying a certain identity; the concept of polymorphisms is fundamental to the resolution of the Feder-Vardi conjecture in both [Bul17] and [Zhu17].
Definition 2. A polymorphism of a structure B is a homomorphism from B k to B, for some k ∈ N. We write Pol(B) for the set of all polymorphisms of B.
Theorem 14 ( [BP16]). Let B be an ω-categorical model-complete core. Then either • B can be expanded by finitely many constants so that the resulting structure interprets K 3 primitively positively, or • B has a pseudo-Siggers polymorphism modulo endomorphisms of B.
5.3. The wonderland conjecture. A weaker condition that implies that an ω-categorical structure has an NP-hard CSP has been presented in [BOP17]. For reducts of homogeneous structures with finite signature, however, the two conditions are equivalent [BKO + 17]. Hence, we obtain yet another different but equivalent formulation of the tractability conjecture. The advantage of the new formulation is that it does not require that the structure is a model-complete core.
We mention that there are ω-categorical structures where the condition from Theorem 15 applies, but not the condition from Theorem 12 [BKO + 17].
Theorem 16 (of [BKO + 17]). If B is a reduct of a homogeneous structure with finite relational signature, then the conditions given in Theorem 12 and in Theorem 15 are equivalent.

Testing the Existence of Normal Representations
In this section we present an algorithm that tests whether a given finite relation algebra has a normal representation. This follows from a model-theoretic result that seems to be folklore, namely that testing the amalgamation property for a class of structures that has the JEP and a signature of maximal arity two which is given by a finite set of forbidden substructures is decidable. We are not aware of a proof of this in the literature.
Theorem 17. There is an algorithm that decides for a given finite relation algebra A which has a fully universal square representation whether A also has a normal representation.
Proof. First observe that the class C of all atomic A-networks, viewed as A-structures, has the JEP: if N 1 and N 2 are atomic networks, then they are satisfiable in B since B is fully universal, and hence embed into B when viewed as structures. Since B is square the substructure of B induced by the union of the images of N 1 and N 2 is an atomic network, too, and it embeds N 1 and N 2 .
Let k be the number of atoms of A. It clearly suffices to show the following claim, since the condition given there can be effectively checked exhaustively.
Claim. C has the AP if and only if all 2-point amalgamation diagrams of size at most k + 2 amalgamate.
So suppose that D = (B 1 , B 2 ) is an amalgamation diagram without amalgam. Let B 1 be a maximal substructure of B 1 that contains B 1 ∩B 2 such that (B 1 , B 2 ) has an amalgam. Let B 2 be a maximal substructure of B 2 that contains B 1 ∩ B 2 such that (B 1 , B 2 ) has an amalgam. Then B i = B i for some i ∈ {1, 2}; let C 1 be a substructure of B i that extends B i by one element, and let C 2 := B 3−i . Then (C 1 , C 2 ) is a 2-point amalgamation diagram without an amalgam. Let C 0 := C 1 ∩ C 2 . Let C 1 \ C 0 = {p} and C 2 \ C 0 = {q}. For each a ∈ A there exists an element r a ∈ C 0 such that the network ({r, p, q}, f ) with f (p, q) = a, f (p, r) = f B 1 (p, r), f (r, q) = f B 2 (r, q) fails the atomicity property (1). Let C 1 be the substructure of C 1 induced by {p} ∪ {r a | a ∈ A} and A 1 be the substructure of C 2 induced by {q} ∪ {r a | a ∈ A}. Then the amalgamation diagram (C 1 , C 2 ) has no amalgam, and has size at most k + 2.

Conclusion and Open Problems
Hirsch's Really Big Complexity Problem (RBCP) for finite relation algebras remains really big. However, the network satisfaction problem of every finite relation algebra known to the author can be formulated as the CSP of a structure that falls into the scope of the infinite-domain tractability conjecture. Most of the classical examples even have a normal representation, and therefore the RBCP for those is implied by the infinite-domain tractability conjecture (Corollary 5). We presented an algorithm that tests whether a given finite relation algebra has a normal representation.
To better understand the RBCP in general, or at least for finite relation algebras with fully universal square representation, we need a better understanding of representations of finite relation algebras with good model-theoretic properties. We mention some concrete open questions; also see Figure 4.
(1) Is there a finite relation algebra with a fully universal square representation, but without an ω-categorical fully universal square representation? (2) Is there a finite relation algebra with an ω-categorical fully universal square representation but without a fully universal square representation which is not a firstorder reduct of a finitely bounded homogeneous structure? (3) Find a finite relation algebra A such that there is no ω-categorical structure B such that the general network satisfaction problem for A equals the constraint satisfaction problem for B. (Note that we do not insist on B being a representation of A.) (4) Find a finite relation algebra A with an ω-categorical fully universal square representation which is not the orbital relation algebra of an ω-categorical structure.   [Hir99] separates Box D and E. Box B falls into the scope of the infinite-domain tractability conjecture. Boxes C and D might also fall into the scope of this conjecture (see Problem (1) and Problem (2)).