# Free Kleene algebras with domain

Free Kleene algebras with domain First we identify the free algebras of the class of algebras of binary relations equipped with the composition and domain operations. Elements of the free algebras are pointed labelled ﬁnite rooted trees. Then we extend to the analogous case when the signature includes all the Kleene algebra with domain operations; that is, we add union and reﬂexive transitive closure to the signature. In this second case, elements of the free algebras are ‘regular’ sets of the trees of the ﬁrst case. As a corollary, the axioms of domain semirings provide a ﬁnite quasiequational axiomatisation of the equational theory of algebras of binary relations for the intermediate signature of composition, union, and domain. Next we note that our regular sets of trees are not closed under complement, but prove that they are closed under intersection. Finally, we prove that under relational semantics the equational validities of Kleene algebras with domain form a decidable set. 2020 Mathematics subject classiﬁcation: primary 08B20; secondary 20M20. Keywords and phrases: Kleene algebra, domain, binary relation, equational theory, decidable. 1. Introduction Reasoning about binary relations, and ways of combining them, has an extensive literature and a multitude of applications. Classically, in algebraic logic, binary relations model logical formulas with two free variables [33]. In computer science, we can ﬁnd binary relations modelling the actions of programs [26, 21], and elsewhere representing relationships between items of data that compose a tree [1], or a graph [22]. When an algebraic logician thinks of binary relations, the ﬁrst signature to come to mind will always be that of Tarski’s relation algebras. In computer science, the Kleene algebra signature has the greatest prominence. In the latter case, the operations are relational composition, union, and reﬂexive transitive closure, as well as constants for the empty relation and the identity relation. Any set of binary relations closed under the ﬁve Kleene algebra operations/constants can be viewed as an algebra in the sense of universal algebra/model theory, that is, a structure over a signature of function symbols (but no predicate symbols). It is well known that this class of algebras contains its free algebras, and that the free algebra generated by a given ﬁnite set  is precisely the set of all regular languages over the alphabet . The importance of regular languages in theoretical computer science goes This project has received funding from the European Research Council (ERC) under the European Union’s Horizon 2020 research and innovation program (grant agreement No. 670624). arXiv:1907.10386v2 [math.LO] 28 Sep 2020 2 Brett McLean almost without saying [32]. The algebraic perspective on sets of regular languages was employed to great e ect by Eilenberg in his celebrated variety theorem [7], and continues to yield valuable new insights to this day [13, 12]. In this paper, we identify the analogous free algebras in the case where the signature is expanded with one extra operation on binary relations: the unary domain operation D(R) = f(x; x) j 9y : (x; y) 2 Rg, which provides a record of all points having at least one image under the given relation. This expanded signature is that of Kleene algebra with domain, a certain ﬁnite set of algebraic laws extending Kozen’s theory of Kleene algebras with a domain operation and a small number of associated equations [6]. One intended model for this theory is indeed algebras of binary relations, and there is a hope that the theory will prove useful for reasoning about the actions of nondeterministic computer programs [4, 5]. In this programs-as-relations formalism, a program P is modelled by a relation R on machine states, with R relating state x to state y precisely if, whenever the machine is in state x and P is executed, y is a possible resultant state. Hence relational composition models sequential composition of programs, union models nondeterministic choice, and reﬂexive transitive closure models the choice to iteratively execute a program any (ﬁnite) number of times. The expression D(R) then models a program that when run from certain states—those from which P would terminate—has no e ect—and otherwise fails/does not terminate. Thus domain makes provision within the syntax for expressing certain types of ‘tests’—an important component of all programming languages. In addition to identifying the free algebras, we also show that it is decidable whether an equation in this Kleene algebra with domain signature is valid over all algebras of binary relations. Of course, when reasoning about programs, the validity of an equation s = t corresponds to the programs expressed by s and t always having precisely the same e ect (independently of which ground programs the variables are instantiated with). Structure of the paper In Section 2 we give the necessary deﬁnitions and some context regarding algebras of binary relations, and their free algebras. In Section 3 we introduce the trees that we use for describing our free algebras, and certain relations and operations on those trees. In Section 4 we prove an intermediate result: we identify the free algebras for the reduced signature that omits the ‘nondeterministic’ union and reﬂexive transitive closure operators, and also the empty relation constant, that is, the signature with the composition and domain operations and the identity constant. For this signature the elements of the free algebras are ‘reduced’ pointed labelled ﬁnite rooted trees (Theorem 4.6). In Section 5 we extend the result of the previous section to identify the free algebras for the full Kleene algebra with domain signature. In this case, elements of the free algebras are certain sets of the trees of the previous case (Theorem 5.6). We term these Free Kleene algebras with domain 3 sets ‘regular’ sets of trees, by analogy with the regular languages of the Kleene algebra signature. By combining with an existing result, it follows as a corollary that the axioms of domain semirings provide a ﬁnite quasiequational axiomatisation of the equational theory of algebras of binary relations for the signature of composition, union, domain, and the two constants (but not reﬂexive transitive closure). Section 6 is devoted to closure properties of regular sets of trees. We use automata to show the regular sets of trees are closed under intersection. We also note the regular sets of trees are not closed under complement and pose the questions of whether they are closed under implication or under residuation. In Section 7 we again use automata to prove the decidability of validity for equations in the signature of Kleene algebra with domain under relational semantics (Theorem 7.2). 2. Algebras of binary relations We begin by making precise what is meant by an algebra of binary relations. Throughout, we consider that 0 2 N. Deﬁnition 2.1. An algebra of binary relations of the signature f;; +; *; 0; 1g is a universal algebra A = (A; ;; +; *; 0; 1) where the elements of the universe A are binary relations on some (common) set X, the base, and the interpretations of the symbols are given as follows: the binary operation ; is interpreted as composition of relations: R ; S B f(x; y) 2 X j 9z 2 X : (x; z) 2 R^ (z; y) 2 Sg; the binary operation + is interpreted as set-theoretic union: R + S B f(x; y) 2 X j (x; y) 2 R_ (x; y) 2 Sg; the unary operation * is interpreted as reﬂexive transitive closure: R* B f(x; y) 2 X j 9n 2 N 9x : : : x : 0 n (x = x)^ (x = y)^ (x ; x ) 2 R^ : : :^ (x ; x ) 2 Rg; 0 n 0 1 n1 n the constant 0 is interpreted as the empty relation: 0 B ;; the constant 1 is interpreted as the identity relation on X: 1 B f(x; x) 2 X g: We let Rel(;; +; *; 0; 1) denote the isomorphic closure of the class of all algebras of binary relations of the signature f;; +; *; 0; 1g. 4 Brett McLean To be clear: the universe of an algebra of binary relations is necessarily closed under the given operations, since the deﬁnition of a universal algebra requires the symbols be interpreted as total functions. Remark 2.2. (i) It is easy to see that Rel(;; +; *; 0; 1) is not a ﬁrst-order axiomatisable class, not even closed under elementary equivalence, by a simple argument showing that Rel(;; +; *; 0; 1) is not closed under ultrapowers. See the appendix for a proof of this well-known fact. (ii) Despite Rel(;; +; *; 0; 1) being far from a variety, it is easily seen to be closed under subalgebras and products. (An element of a product of algebras of binary relations is the disjoint union of all its component binary relations.) Hence, by a basic theorem of universal algebra (see, for example, [3, Theorem 10.12]), the class Rel(;; +; *; 0; 1) contains its free algebras. (iii) It is a folk theorem that the free Rel(;; +; *; 0; 1)-algebra generated by a ﬁnite set is the set of all regular languages over the alphabet  (with the operations of language concatenation, union, and so on). (iv) It is well known that the variety HS P Rel(;; +; *; 0; 1) generated by Rel(;; +; *; 0; 1) has no ﬁnite equational axiomatisation [29]. (v) We do however have Kozen’s quasivariety of Kleene algebras [20], deﬁned by a ﬁnite number of equations/quasiequations, intermediate to Rel(;; +; *; 0; 1) and HS P Rel(;; +; *; 0; 1). That is, Rel(;; +; *; 0; 1)  Kleene algebras  HS P Rel(;; +; *; 0; 1); and so HS P(Kleene algebras) = HS P Rel(;; +; *; 0; 1): Of course, the operations of Deﬁnition 2.1 are not the only operations that can be deﬁned on binary (endo)relations. In particular, various unary ‘test’ operations can be deﬁned; here is a selection. Deﬁnition 2.3. The unary operation D is the operation of taking the diagonal of the domain of a relation: D(R) = f(x; x) 2 X j 9y 2 X : (x; y) 2 Rg. The unary operation R is the operation of taking the diagonal of the range of a relation: R(R) = f(y; y) 2 X j 9x 2 X : (x; y) 2 Rg. A quasiequation is a conditional equation where the condition is a ﬁnite conjunction of equations. That is, a quasiequation is a formula of the form s = t ^^ s = t ! u = v. 1 1 n n Free Kleene algebras with domain 5 The unary operation A is the operation of taking the diagonal of the antidomain of a relation—those points of X at which the image of the relation in empty: A(R) = f(x; x) 2 X j 9y 2 X : (x; y) 2 Rg. One can vary the operations from those of Deﬁnition 2.1 and/or restrict the binary relations to some particular form. The resulting class will again contain its free algebras. If the class is of interest, then it is useful to establish a description of these free algebras. Restricting the binary relations to be some type of function (total functions, partial functions, or injective partial functions, for example) tends to yield free algebras whose elements are a ‘single object’, rather than a ‘set of objects’. The class of semigroups, for example, is the variety generated by Tot(;)—algebras of total functions with composi- tion—and an element of a free semigroup is a single string, rather than a set of strings as we have in the case Rel(;; +; *; 0; 1). Similarly, elements of free groups are also strings, with groups forming isomorphs of algebras of permutations, with the familiar operations. There is also an observable pattern when test operations are added to the signature: strings are replaced by (labelled) trees. The following results are known. -1 1. The class Inj(;; ), of isomorphs of algebras of injective partial functions with composition and inverse, is the class of inverse semigroups [35, 28]. (In this 1 1 signature D and R are deﬁnable via D(R) B R ; R and R(R) B R ; R, respectively.) Elements of free inverse semigroups are certain trees, so-called Munn trees [25]. 2. The class Par(;; D)—partial functions with composition and domain—is a variety [34], most commonly known as the (left) restriction semigroups. A description of the free algebras has been given, and again, elements can be viewed as trees [9]. 3. The class Par(;; D; R)—partial functions with composition, domain, and range— is a proper quasivariety; a ﬁnite quasiequational axiomatisation was given by Schein [31]. Once more, a description of the free algebras has been given, and elements can be viewed as trees [10]. We should also mention at this stage Hollenberg’s ﬁnite equational axiomatisation of the equational theory of the quasivariety Rel(;; A) (in which D, 0, and 1 are easily expressible) [18]. Of course, this result amounts to an implicit description of the corresponding free algebras, as quotients of term algebras by this theory. Another result involving binary relations (but not tests), is Bloom, Ésik, and Stefanescu’s explicit ^ ^ description of the free algebras for the case Rel(;; +; *; 0; 1; ), where is the converse ^ 2 operation R B f(x; y) 2 X j (y; x) 2 Rg [2]. There, the elements of the algebras are sets of strings. 2 -1 In this signature, in which is available, the inverse semigroups form a variety. To give an equational axiomatisation it suces to replace, in the natural axiomatisation, the quasiequation ‘inverses are unique’ 1 1 1 1 by the equation a ; a ; a ; a = a ; a ; a ; a [30]. 6 Brett McLean Having noted that binary relations ; sets, functions ; singletons, and tests ; trees, one can anticipate that when tests are added to the case Rel(;; +; *; 0; 1), elements of free algebras will be sets of labelled trees. We will prove that this is indeed the case (Theorem 5.6). On the way to doing this, we also identify the free algebras for the case without the ‘nondeterministic’ operators + and *, more precisely, for the case Rel(;; 1; D) (Theorem 4.6). The analogous results for signatures formed by adding/removing 0 and/or 1 follow as corollaries of these two theorems. Remark 2.4. The term ‘Kleene algebra with domain’ was originally used for a certain quasiequational theory extending the two-sorted Kleene algebra with tests with a domain operation [4]. It was subsequently redeﬁned as a (strictly less expressive) one-sorted quasiequational theory extending Kleene algebra with a domain operation [6]. 3. Trees The central objects we will be working with throughout will be labelled rooted trees. We will give two deﬁnitions of these. The ﬁrst, Terminology 3.1, is the usual graph-theoretic deﬁnition, and we give it in order to make use of basic graph-theoretic terminology: vertex, edge, and so on. The second, Deﬁnition 3.2, is cleaner, in the sense that isomorphic trees are identical, and will serve as the ‘ocial’ deﬁnition in this paper. Terminology 3.1. A tree is a connected acyclic undirected graph (reﬂexive edges are prohibited). All trees will be assumed to be ﬁnite unless otherwise stated. A rooted tree is a tree with a distinguished vertex called the root. By a labelled tree, we will mean an edge-labelled tree. That is, given a set  of labels, a labelled tree is a tree T together with a function from the edges of T to Deﬁnition 3.2. Given a set  of labels, a labelled rooted tree is deﬁned recursively as a set of pairs (a; T ), where a 2  and T is a labelled rooted tree. Some explanation may be helpful. According to Deﬁnition 3.2, the empty set is a labelled rooted tree (this is the base case of the deﬁnition). This empty set should be thought of as encoding what is, in the graph-theoretic view, the tree with a single vertex. Figure 1 illustrates how some simple examples of labelled rooted trees should be viewed. Free Kleene algebras with domain 7 a a Figure 1. The labelled rooted trees encoded as ;, f(a;;)g, and f(a;;); (a;f(b;;)g)g, respectively (with roots at the top) The reader may note that Deﬁnition 3.2 is more restrictive than the deﬁnition of labelled rooted trees obtained from Terminology 3.1—it cannot describe any tree having a vertex with two distinct but isomorphic child subtrees. However, we will have no need of such trees in this paper. Deﬁnition 3.3. A pointed tree is a tree with a distinguished vertex called the point. We will primarily work with pointed labelled rooted trees. We will usually denote a pointed labelled rooted tree (T; p) by its underlying labelled rooted tree T . We deﬁne the notion of a homomorphism of (possibly pointed) labelled rooted trees by reference to homomorphisms of relational structures. Deﬁnition 3.4. A relational structure (X; f ) for a set  of labels is a set X and an assignment f giving for each element of a 2  a binary relation a on X. A homomorphism from a relational structure (X; f ) to the relational structure (Y; g) (both with label-set ) is a map  : X ! Y validating f g (x ; x ) 2 a =) ((x ); (x )) 2 a 1 2 1 2 for each a 2 . We can view any -labelled rooted tree as a relational structure (X; f ) by taking X to be the set of vertices of the tree and for each a 2  setting a to be the set of pairs (x; y) of vertices such that x is the parent of y and the edge fx; yg is labelled by a. When we speak of a homomorphism  : S ! T of possibly pointed labelled rooted trees, we mean a homomorphism of the trees viewed as relational structures that is also required to map the root of S to the root of T and, if it exists, the point of S to the (therefore extant) point of T . Let A be an algebra of binary relations (in any of the signatures we take an interest in) with base set X. Let f be an assignment of members of A to the set  of variables. Then (A; f ) naturally deﬁnes a relational structure: (X; f ). Conversely, let (X; f ) be a relational structure and let A be any algebra of binary relations on X that includes fa j a 2 g in its universe (that is, any algebra between the algebra generated by this set and the algebra of all binary relations on X  X). Then the standard model-theoretic 8 Brett McLean A; f interpretation JtK of any -term t is independent of the precise choice of A. Thus, when interpreting terms and evaluating equations, it is safe to conﬂate the concepts of algebra + assignment and relational structure, and we will often do so. For example, the following deﬁnition is stated in terms of an algebra and assignment, but we will mainly use it in contexts where we are ostensibly talking about a relational structure. Deﬁnition 3.5. Let A be an algebra of binary relations with base X, let t be a term, and let f be an assignment to the variables in t. We say that a pair (x; y) 2 X  X satisﬁes t A; f if (x; y) 2 JtK . We want to be able to reduce trees to forms without any redundant branches. In order to do that, we ﬁrst deﬁne a preorder on trees. Deﬁnition 3.6. The preorder  on (possibly pointed) labelled rooted trees is deﬁned recursively as follows. For trees T and T with roots r and r respectively, T  T if 1 2 1 2 1 2 and only if (a) if r is the point vertex of T , then r is the point vertex of T , 2 2 1 1 (b) for each child v of r , there is a child v of r such that 2 2 1 1 (i) the labels of the edges r v and r v are equal, 1 1 2 2 (ii) T  T , where T and T are the v -rooted and v -rooted subtrees v v v v 1 2 1 2 1 2 respectively. That  is indeed a preorder is clear. In fact, by induction on the height of the trees, it is easy to see that T  T () there exists a homomorphism  : T ! T : (3.1) 1 2 2 1 In the following deﬁnition and proposition, we continue to work with trees that may or may not be pointed. Deﬁnition 3.7. Let T be a labelled tree with root r. The reduced form of T is the tree formed recursively as follows. (a) For each child v of r, replace the v-rooted subtree with its reduced form. Call the resulting tree T . (b) For each label a 2 , let C be the set of subtrees of T rooted at a vertex linked to r by an a-labelled edge. Remove all but the -minimal subtrees in C . Example 3.8 (reduction). The pointed tree on the left of Figure 2 reduces as shown. The tree on the right is already reduced. Free Kleene algebras with domain 9 a a a a a a a a b b b Figure 2. Reduction of pointed labelled rooted trees Proposition 3.9. The preorder  is a partial order on reduced labelled rooted trees. Proof. By induction on the maximum height of the two trees being compared. For the base case, take trees T ; T of height 0, so both have just a single vertex. Suppose 1 2 T  T and T  T . Then by Deﬁnition 3.6(a), the tree T is pointed if and only if T 1 2 2 1 1 2 is pointed. Hence T = T . 1 2 Now let T and T be of height at most n + 1, and assume antisymmetry of  holds 1 2 for all reduced trees of height at most n. Suppose T  T and T  T , and denote 1 2 2 1 the roots by r and r , respectively. As before, T has a point at r if and only if T 1 2 1 1 2 has a point at r . By Deﬁnition 3.7 the child subtrees of vertex r are reduced, and for 2 1 each a 2  the child subtrees linked by an a-labelled edge are pairwise -incomparable. Likewise for the child subtrees of vertex r . Let v be an arbitrary child of r . Since T  T , we can ﬁnd a child v of 2 2 1 2 1 r as in Deﬁnition 3.6(b), giving us T  T . Then using T  T and applying 1 v v 2 1 1 2 Deﬁnition 3.6(b) again, we obtain a child v of r and have T  T  T (with r v 2 v v v 2 2 1 2 and r v having the same label). Hence by pairwise -incomparability, T = T . So 2 v v 2 2 T  T  T , which by the inductive hypothesis yields T = T . Since v was v v v v v 2 2 1 2 1 2 arbitrary, we conclude that every child subtree of r is present as a child subtree of r . Symmetrically, every child subtree of r is present as a child subtree of r . Hence 1 1 2 T = T . 1 2 Note now that the partial order  on reduced trees is Noetherian (converse well- founded). Indeed, by structural induction there are a ﬁnite number of distinct labelled trees of any ﬁxed depth, hence a ﬁnite number of reduced pointed labelled trees of that depth. And T  T implies the depth of T is at most the depth of T . 1 2 2 1 0 0 0 Proposition 3.10. If a labelled rooted tree T reduces to T , then T  T and T  T . Proof. Another induction on height. All trees of height 0 are already reduced, so this base case is trivial. Now assume the result holds whenever T is of height at most n. Let T be of height 0 0 0 n + 1, with root r. It is clear that the root r of T is the point of T if and only if r is the point of T . So there is no obstruction to a homomorphism mapping r to r or vice versa. 10 Brett McLean 0 0 0 First we show T  T . Every child subtree of r is the reduced form T of some 0 0 child subtree T of r (with rv and r v having the same label). Hence, by the inductive hypothesis and (3.1), there is a homomorphism  0 : T ! T . By gluing together v v 0 0 0 0 f j v a child of r g, and mapping r to r, we obtain a homomorphism T ! T . Hence T  T . 0 00 0 Now we show T  T . Let T be the intermediate tree in the reduction of T to T , that is, T is the tree formed from T by reducing all child subtrees of r. Denote the root 00 00 of T by r . Take an arbitrary child subtree T of r, and let T 00 be its reduced form v v sitting as a subtree of T . So by the inductive hypothesis, there is a homomorphism 0 00 T ! T 00 . Since  is Noetherian on reduced trees, when T is formed from T by v v 0 0 00 applying step (b) in the deﬁnition of reduction, a subtree T with T  T (and such v v v 00 00 0 0 that r v and r v have the same label) is retained. Thus there is a homomorphism 00 0 0 T ! T , and hence, by composition, a homomorphism T ! T . Gluing together the v v v v homomorphisms for each child v of r, and mapping r to r , we obtain a homomorphism 0 0 T ! T . Hence T  T . Thus reduction selects a canonical member of every-equivalence class. Informally, we can think of  on reduced trees as corresponding to the inclusion relation on binary relations—if T  T then T is a more speciﬁc description than T . 1 2 1 2 Deﬁnition 3.11. Let  be a set and let T and S be reduced pointed -labelled rooted trees. The pointed tree concatenation T ; S of T and S is the tree formed by 1. identifying the point of T and the root of S (the root is now the root of T and the point is the point of S ), 2. reducing the resulting tree to its reduced form. The domain D(T ) of T is the tree formed by 1. reassigning the point of T to the current root of T , 2. reducing the resulting tree to its reduced form. Notation 3.12. For a symbol a from an alphabet, we write a for the pointed labelled rooted tree with two vertices, whose point is the child vertex and whose single edge is labelled by a. We write " for the pointed labelled rooted tree with a single vertex. Remark 3.13. A very similar setup to that presented in this section has already been used for investigating Kleene algebras with domain [24]. In that thesis, the graph-theoretic deﬁnition of trees is used, and pointed labelled ﬁnite rooted trees are called ‘trees with a top’. There, the relation  is termed ‘simulates’, and trees are only considered up to simulation equivalence. Thus there is no notion of a reduced form; the operations of Deﬁnition 3.11 are deﬁned without their reduction steps. We will return to say more about the thesis [24] at the end of Section 5. Free Kleene algebras with domain 11 4. Composition, identity, and domain In this section we will identify the free algebras of the class Rel(;; 1; D). From there, it is straightforward to accommodate the addition of + and * (and 0). By a term we mean a raw syntactic object belonging to a term algebra/absolutely free algebra—no background theory is assumed. Thus equality of terms means literal equality. Deﬁnition 4.1. We deﬁne the single-tree interpretation [ ] of f;; 1; Dg-terms as follows. 1. [a] B a, for any variable a, 2. [1] B ", 3. [s ; t] B [s] ; [t], 4. [D(s)] B D([s]). Here the operations and constants on the right-hand side are those deﬁned for trees in Section 3. Deﬁnition 4.1 is well deﬁned because if pressed for a formal deﬁnition of terms we would give one that satisﬁes unique readability, either by writing ; in preﬁx form, requiring parentheses, or deﬁning terms directly as trees. Lemma 4.2. The map [ ] is a surjection from the f;; 1; Dg-terms in variables  onto the reduced pointed -labelled rooted trees. Hence [ ] is a surjective homomorphism from the term algebra onto the reduced pointed -labelled rooted trees, viewed as an algebra of the signature f;; 1; Dg with the operations we have deﬁned. Proof. We show that every reduced tree is the single-tree interpretation of some term by induction on the size of the tree. A tree whose root has no children is just "—the interpretation of 1—so assume we have a tree T given by a nonempty set f(a ; T ); : : : ; (a ; T )g, and a distinguished 1 1 n n point p. First suppose p is the root of T . For each 1  i  n, let t be a term whose interpretation is the pointed tree whose tree is T and whose point is its root. Then we can realise T by the term D(a ; t ) ; ; D(a ; t ). (We write iterated ; without brackets 1 1 n n because the positioning of the brackets turns out to be immaterial.) Alternatively, suppose p is not the root of T ; so without loss of generality p is a vertex in T . Let t ; : : : ; t be as before and now let t be a term whose interpretation n 1 n1 n is the pointed tree whose tree is T and whose point is p. Then we can realise T by the term D(a ; t ) ; ; D(a ; t ) ; a ; t . 1 1 n1 n1 n n The following lemma says that the single-tree interpretation of a term records for us a tree that, in a relational structure, ‘connects’ x and y if and only if the term is satisﬁed by (x; y). 12 Brett McLean Lemma 4.3. Let A be a f;; 1; Dg-algebra of binary relations, with base X. Let t be a f;; 1; Dg-term, and let f be an assignment of elements of A—so, binary relations—to the variables in t. Then for any x; y 2 X, the following are equivalent. 1. The pair (x; y) belongs to the model-theoretic interpretation of t under the assignment f . 2. There is a homomorphism of [t] into (X; f ) such that the root of [t] is mapped to x and the point of [t] is mapped to y. A; f Proof. By structural induction on terms. As before, we write JtK for the model- theoretic interpretation of t. First, suppose t = a, for some variable a. Then [t] = a—consisting of an a-labelled A; f edge linking the root r to the point p. Therefore (x; y) 2 JtK if and only if (x; y) 2 f (a), so if and only if the map given by r 7! x and p 7! y is a homomorphism. The case t = 1 is similar. Next, suppose t = s ; s and that the equivalence holds for s and for s . Then 1 2 1 2 A; f A; f A; f (x; y) 2 JtK if and only if there is a z 2 X such that (x; z) 2 Js K and (z; y) 2 Js K . 1 2 By the inductive hypotheses, the latter is equivalent to the existence of a homomorphism from [s ] mapping its root r to x and point p to z, and a homomorphism from [s ] 1 1 1 2 mapping its root r to z and point p to y. This is equivalent to the existence of a 2 2 homomorphism from [s ; s ], mapping the root to x and point to y, since there exist 1 2 homomorphisms in both directions between a tree and its reduced form. A; f Finally, suppose t = D(s) and that the equivalence holds for s. Then (x; y) 2 JtK if A; f and only if x = y and there exists z such that (x; z) 2 JsK . By the inductive hypothesis, this is equivalent to x = y and the existence of a homomorphism mapping the root of [s] to x and the point to z. Since [t] and [s] di er only by the position of their point, which for [t] is the root, the latest condition is equivalent to the existence of a homomorphism from [t] mapping both the root/point to x/y, as required. Corollary 4.4 (soundness with respect to relations). For any pair s and t of f;; 1; Dg- terms [s] = [t] =) Rel(;; 1; D) j= s = t: Lemma 4.5 (completeness with respect to relations). For any pair s and t of f;; 1; Dg- terms Rel(;; 1; D) j= s = t =) [s] = [t]: Proof. Suppose Rel(;; 1; D) j= s = t. We will show that [s]  [t]. Then by symmetry, also [t]  [s]. So [s] = [t] and we are done. Let r be the root and p the point of [s]. On [s] viewed as a relational structure, by using Lemma 4.3 and the identity homomorphism [s] ! [s], the pair (r; p) belongs to the model-theoretic interpretation of s (under the evident variable assignment). Hence, by the assumption that Rel(;; 1; D) j= s = t, we have that (r; p) belongs to the model- theoretic interpretation of t. Then by Lemma 4.3 there is a homomorphism of labelled Free Kleene algebras with domain 13 trees from [t] into [s] mapping the root of [t] to r and the point of [t] to p. That is, there is a homomorphism of pointed labelled rooted trees from [t] into [s]. We know this is equivalent to the conclusion [s]  [t] we seek, so we are done. With Corollary 4.4 and Lemma 4.5 available, we can now complete the proof that we have identiﬁed the free algebras of the class Rel(;; 1; D). Theorem 4.6. Let  be an alphabet, and letR be the set of reduced pointed -labelled ﬁnite rooted trees. Then the free Rel(;; 1; D)-algebra over  is R equipped with the operations of pointed tree concatenation and of domain from Deﬁnition 3.11 (and the constant "). Proof. Since R is generated by , it follows by the ﬁrst isomorphism theorem of universal algebra that R is isomorphic to a quotient Q of the term algebra (for signature f;; 1; Dg) over variables . The congruence relation  deﬁning the quotient is given by s  t () [s] = [t], for terms s and t over . So by Corollary 4.4 and Lemma 4.5, the congruence is given by equational validity in Rel(;; 1; D). It is a basic result of universal algebra that Q is then precisely the free algebra over  of the class Rel(;; 1; D). The inclusion of 1 and exclusion of 0 from the signature was in fact not essential. We can easily add and remove them according to our wishes. Corollary 4.7. Let  and R (viewed as an algebra) be as in Theorem 4.6. The free Rel(;; D)-algebra over  is given by removing the tree " from R . The free Rel(;; 0; D)-algebra over  is given by the addition of a zero element—an element validating 0 ; T = T ; 0 = 0 and D(0) = 0—to the free Rel(;; D)-algebra over . The free Rel(;; 1; 0; D)-algebra over  is given by the addition of a zero element to R . Proof. For Rel(;; D), ﬁrst note that every nontrivial tree in R is the single-tree interpretation of a f;; Dg-term, and conversely, if a tree is the interpretation of a f;; Dg- term then it cannot be trivial—by induction, all such interpretations have at least one edge. Hence the nontrivial trees indeed form a f;; Dg-algebra generated by (the interpretations of elements of) . Since every f;; Dg-algebra of relations embeds in a f;; 1; Dg-algebra of relations, it follows from Corollary 4.4 that every equation validated by the nontrivial trees is validated by all f;; Dg-algebras of relations. The converse follows immediately from Lemma 4.5. For Rel(;; 0; D) and Rel(;; 1; 0; D), note that by the deﬁnition of a zero element, a term is interpreted as the zero of the algebra if and only if the symbol 0 appears in the term, and similarly a term is interpreted as ; in every algebra of relations if and only if 0 appears in the term. These observations are sucient to extend Corollary 4.4 and Lemma 4.5 to terms that may contain 0.  14 Brett McLean We remark that the class Rel(;; 1; D), as noted in [17], forms a quasivariety. It has been shown that this quasivariety is not ﬁnitely axiomatisable in ﬁrst-order logic [17]. Naturally, the same statements hold when we add/remove 0 and 1. 5. Expansion by union and reﬂexive transitive closure In this section, we extend the result of the previous section to provide a description of the free algebras of the class of relational Kleene algebras with domain, that is, the free algebras of Rel(;; +; *; 0; 1; D). Deﬁnition 5.1. For a set K of reduced trees, let maximal(K) denote the set of - maximal elements of K. We lift the notation ; and D of Deﬁnition 3.11 to sets of trees by using elementwise application. We deﬁne the standard tree interpretation J K of f;; +; *; 0; 1; Dg-terms as follows. 1. For a 2 ; JaK B fag, 2. J0K B ;, 3. J1K B f"g, 4. Js + tK B maximal(JsK[ JtK), 5. Js ; tK B maximal(JsK ; JtK), 1 i 0 i+1 i 6. JsK B maximal( JsK ), where JsK B 1 and JsK B JsK ; JsK, i=1 7. JD(s)K B maximal(DJsK). Note that JaK, for a 2 , J0K, and J1K, contain only reduced trees, and [ preserves this property on sets of trees (as do the lifted ; and D, by deﬁnition). Hence the maximal operation is applicable whenever it is used in Deﬁnition 5.1, and standard interpretations contain only reduced trees. Deﬁnition 5.2. Let  be an alphabet. A set of pointed -labelled rooted trees is regular if it is the standard tree interpretation of some f;; +; *; 0; 1; Dg-term. We can think of a regular set L of trees as a concise record of all the reduced trees in the downward-closed set #L (with respect to the  ordering). In this view (thinking of L as #L), the operation + corresponds to the real set union operation, and ; and D correspond to pointwise application of the operations of Deﬁnition 3.11. The advantage of using the arrangement of Deﬁnition 5.1 is that regular sets remain ﬁnite until such time that Kleene star is used. That the partial order  on reduced trees is Noetherian The short proof of this using general model-theoretic results consists of noting that the class is both closed under direct products and—almost by deﬁnition—has a pseudouniversal axiomatisation. (See [16, Section 9.2] for a deﬁnition of pseudouniversal.) It is not claimed that this notion of regular sets of pointed trees is the same as the notion of a regular tree language coming from the theory of tree automata [11]. Free Kleene algebras with domain 15 1 i ensures there are ‘enough’ elements in maximal( JsK ) for that to be a sensible i=1 deﬁnition of JsK (as demonstrated in the proof of the next lemma). The following lemma is the analogue of Lemma 4.3. Lemma 5.3. Let A be a f;; +; *; 0; 1; Dg-algebra of binary relations, with base X. Let t be a f;; +; *; 0; 1; Dg-term, and let f be an assignment of elements of A to the variables in t. Then for any x; y 2 X, the following are equivalent. 1. The pair (x; y) belongs to the model-theoretic interpretation of t under the assignment f . 2. There is a tree T in JtK and a homomorphism of T into (X; f ) such that the root of T is mapped to x and the point of T is mapped to y. Proof. Structural induction on terms. We give the details for the * case in the direction 1 =) 2, as this case is not entirely trivial. So suppose that t = s , that condition 1 holds for t, and that whenever condition 1 holds for s, condition 2 holds for s. Then since (x; y) belongs to the model-theoretic interpretation of s , there are z ; : : : ; z with 0 n z = x, z = y, and each (z ; z ) belonging to the interpretation of s. Hence there are 0 n i i+1 trees S ; : : : ; S 2 JsK and homomorphisms mapping each S into (X; f ) with the root 1 n i mapping to z and point mapping to z . By (3.1), there is a homomorphism of the i1 i reduced tree (: : : (S ; S ) ; ; S ) into (X; f ) mapping the root to x and the point to y. By 1 2 n 0 n 0 (3.1) again (and an induction up to n), there is a T 2 JsK with T  (: : : (S ;S );;S ) 1 2 n and a homomorphism of T into (X; f ) mapping the root to x and the point to y. Then 0 1 j T 2 JsK , and since the partial order  on reduced trees is Noetherian, there exists j=1 1 i 0 a T 2 JsK B maximal( JsK ) with T  T . Such a T fulﬁls condition 2, so we are i=1 done. Proposition 5.4 (soundness with respect to relations). For any pair s and t of f;; +; *; 0; 1; Dg-terms JsK = JtK =) Rel(;; +; *; 0; 1; D) j= s = t: Proof. Suppose JsK = JtK. Let A be a f;; +; *; 0; 1; Dg-algebra of binary relations, with base X. Let f be an assignment of elements of A to the variables appearing in s = t. A; f Write J K for the model-theoretic interpretations in A under f . Then by Lemma 5.3, A; f for any x; y 2 X, we have that (x; y) 2 JsK if and only if there is a T 2 JsK with T connecting x and y. As JsK = JtK, this is equivalent to there being a T 2 JtK with T connecting x and y, which in turn is equivalent, by Lemma 5.3 again, to having A; f A; f A; f (x; y) 2 JtK . As x and y were arbitrary, we have JsK = JtK . As A and f were arbitrary, we conclude that Rel(;; +; *; 0; 1; D) j= s = t. Proposition 5.5 (completeness with respect to relations). For any pair s and t of f;; +; *; 0; 1; Dg-terms Rel(;; +; *; 0; 1; D) j= s = t =) JsK = JtK: 16 Brett McLean Proof. Just like the proof of Lemma 4.5. Given S 2 JsK, we obtain the existence of 0 0 a T 2 JtK with S  T . By symmetry, there is an S 2 JsK with T  S . Since JsK is a -antichain, S = T . Hence JsK  JtK. By symmetry, also JtK  JsK. With Proposition 5.4 and Proposition 5.5, we can now complete the proof of Theorem 5.6 in the familiar way. Theorem 5.6. Let  be an alphabet, and letR be the set of reduced pointed -labelled rooted trees. Then the free Rel(;; +; *; 0; 1; D)-algebra over  has as its universe all the regular subsets of R . The operations are the following, where L, L , and L , are 1 2 regular sets of reduced trees. 1. 0 B ;, 2. 1 B f"g, 3. L + L B maximal(L [ L ), 1 2 1 2 4. L ; L B maximal(L ; L ), 1 2 1 2 i 0 i+1 i 5. L B maximal( L ), where L B f"g and L B L ; L, i=1 6. D(L) B maximal(D(L)). Proof. Similar to the proof of Theorem 4.6. Corollary 5.7. Let  and R be as in Theorem 5.6. The free Rel(;; +; *; 0; D)-algebra over  consists of the regular subsets ofR that do not contain the trivial tree ". The free Rel(;; +; *; 1; D)-algebra over  consists of the nonempty regular subsets of R . The free Rel(;; +; *; D)-algebra over  consists of the nonempty regular subsets of R that do not contain ". Proof. Similar to the proof of Corollary 4.7. Corollary 5.8. Let  and R be as in Theorem 5.6. Then the free Rel(;; +; 0; 1; D)- algebra over  consists of all ﬁnite regular subsets of R . Proof. First note that the regular subsets interpreting f;; +; 0; 1; Dg-terms are precisely the ﬁnite regular subsets. Then soundness and completeness follow from Proposition 5.4 and Proposition 5.5 respectively. In [24], Mbacke proves (Theorem 5.3.3 there) that a certain ﬁnite equational theory over the signature f;; +; 0; 1; Dg—the theory of domain semirings—is complete for the equational validities of what amounts to the algebras of trees identiﬁed in Corollary 5.8. Hence, we obtain the following corollary. Free Kleene algebras with domain 17 Corollary 5.9. The axioms of domain semirings provide a ﬁnite equational axiomat- isation of the equational theory of Rel(;; +; 0; 1; D). In other words, the axioms of domain semirings are (sound and) equationally complete for algebras of binary relations. In [19], Jipsen and Struth study the singly- generated free domain semiring. Corollary 5.8 now subsumes the description of that paper, though that is not to say that these free algebras are uncomplicated objects. The other main result of [24] (Theorem 5.3.12 there) is an axiomatisation of the equational validities of our algebras of regular sets of trees. The axiomatisation used consists of the second-order theory of star-continuous Kleene algebras, augmented with one additional second-order axiom: X X X X a ; ( b) ; c = (a ; b ; c) ! a ; ( D(b)) ; c = (a ; D(b) ; c); b2B b2B b2B b2B where indicates supremum. Unfortunately, this axiom is not sound for algebras of binary relations. (And so, in particular, it is not a consequence of the axioms of star-continuous Kleene algebras, which are sound for relations.) Hence, we do not obtain an analogue of Corollary 5.9 for the signature f;; +; *; 0; 1; Dg. 6. Automata, and closure under intersection It is well known that the set of regular languages over a ﬁnite alphabet  is closed under complement with respect to  . It is clear that, over a (nonempty) ﬁnite alphabet, the regular sets of trees are not closed under the complement operation (with respect to the set of reduced trees). And, more meaningfully, this is true even in the view that a regular set L represents the downward-closed set #L (since complement does not preserve downward closure). However, as we will show, the regular sets of trees are closed under the following ‘intersection’ operation. L  L B maximal(#L \#L ) 1 2 1 2 In [15], and its extended journal version [14], condition automata are deﬁned. They are an extension of ﬁnite-state automata designed speciﬁcally for working with relational queries that may contain D (among other tests such as range and antidomain). In this section, we will use a slightly simpliﬁed deﬁnition of condition automata. Deﬁnition 6.1. A domain condition automaton is a 6-tuple (; S; I; T; ; c), where (; S; I; T; ) is a ﬁnite-state automaton (nondeterministic, with -transitions permitted), and c is a function that assigns a f;; +; *; 0; 1; Dg-term (over ) to each state S . a a 1 2 n A domain condition automaton accepts a path x ! x ! : : : ! x in a relational 0 1 n structure precisely when it is accepted by the ﬁnite-state automaton with a trace such that at each step the condition D(c(s)), where s is the current state, is satisﬁed at the corresponding vertex x in the relational structure (or, to be correct, is satisﬁed by the pair (x; x)). 18 Brett McLean Lemma 6.2. Let t be a f;; +; *; 0; 1; Dg-term, and let T be a pointed labelled rooted tree, with root r and point p. Then the pair (r; p) in the relational structure T satisﬁes t 0 0 if and only if there is a T 2 JtK with T  T . Proof. This is just a specialisation of Lemma 5.3 (and the equivalence of the condition 0 0 T  T with the existence of a homomorphism from T into T ). Proposition 6.3. Let  be an alphabet and let L and L be two sets of reduced pointed 1 2 -labelled ﬁnite rooted trees. If L and L are regular, then L  L is regular. 1 2 1 2 Proof. Let L = Jt K and L = Jt K. Then by [15, Proposition 5], there is a domain 1 1 2 2 condition automatonA such that for any pointed labelled rooted tree T , with root r and point p, the pair (r; p) satisﬁes t if and only if the path from r to p is accepted by A . 1 1 Similarly, there is such a domain condition automaton A for t . By [15, Proposition 2 2 6], there is a domain condition automaton A that accepts a path if and only if that path is accepted by both A and A . Then using [15, Proposition 5] in the other direction, 1 2 applied to A, there is a f;; +; *; 0; 1; Dg-term t such that for any pointed labelled rooted tree T , with root r and point p, the pair (r; p) satisﬁes t if and only if it satisﬁes both t and t . Applying Lemma 6.2, we have (for reduced T ) that T 2 #JtK if and only if (r; p) satisﬁes t if and only if (r; p) satisﬁes both t and t if and only if T 2 #Jt K and 1 2 1 T 2 #Jt K if and only if T 2 #L \#L . Hence #JtK = #L \#L . So 2 1 2 1 2 JtK = maximal(#JtK) = maximal(#L \#L ) = L  L : 1 2 1 2 Let (O(R );[;\) be the lattice of downward-closed subsets of R . We now know that the sets of the form#L, for regular L, form a sublattice of (O(R );[;\). Given that (O(R );[;\) is a Heyting algebra, this raises the further question of whether the sets of the form #L are closed under the implication operation of (O(R );[;\). Problem 6.4. Are the regular sets of reduced trees closed under the following implication operation? L ! L B maximalf fK 2 O() j K \#L  #L gg 1 2 1 2 We conjecture that the answer to this problem is yes. We pose one additional problem, relating to extra-order-theoretic composition structure of the regular sets. Problem 6.5. Are the regular sets of reduced trees closed under the following residuation operations? L n L B maximalfT 2 R j 8S 2 #L ; S ; T 2 #L g 1 2  1 2 L / L B maximalfT 2 R j 8S 2 #L ; T ; S 2 #L g 1 2  2 1 Thanks go to one of the anonymous referees for posing this question. Free Kleene algebras with domain 19 7. Decidability of equational theory In this section we describe how to decide the validity of a f;; +; *; 0; 1; Dg-equation with respect to relational semantics. First, we give a deﬁnition of condition automata closer to that found in [15] and [14]. Recall (Deﬁnition 2.3) that A is a unary function symbol whose relational interpretation is the antidomain operation. Deﬁnition 7.1. A condition automaton is a 6-tuple (; S; I; T; ; c), where (; S; I; T; ) is a ﬁnite-state automaton (nondeterministic, with -transitions permitted), and c is a function that assigns a f;; +; *; 0; 1; Ag-term (over ) to each state S . Acceptance for condition automata is deﬁned just like acceptance for domain condition automata, where the symbol D is now shorthand for two applications of A. Theorem 7.2. The equational theory of the class of algebras of binary relations of the signature f;; +; *; 0; 1; Dg is decidable. Proof. Let s and t be f;; +; *; 0; 1; Dg-terms, and let  be the set of variables appearing in either s or t. Now s = t is valid in Rel(;; +; *; 0; 1; D) if and only if the pointed - labelled rooted trees satisfying s are precisely those satisfying t—we proved the stronger statement involving reduced trees. In the equivalence just stated, we can temporarily use the usual graph-theoretic deﬁnition of a pointed -labelled rooted tree; in particular we do not limit to ﬁnite trees. According to [15, Proposition 5], there are (domain) condition automata A and A that accept precisely the ﬁnite pointed trees satisfying s s t and t respectively. But in fact the ﬁniteness condition plays no role, and hence can be dropped. The same remark can be made for the following statements and we will make no further mention of it. By [15, Corollary 3], there are condition automata A and st A such that a pointed tree is accepted by A precisely if it is accepted by A but ts st s not byA , and a tree is accepted byA precisely if it is accepted byA but notA . By t ts t s [15, Proposition 5], there exist f;; +; *; 0; 1; Ag-terms  and  such that the pointed st ts trees satisfying  and  are precisely those accepted by A and A respectively. st ts st ts Hence s = t is valid in Rel(;; +; *; 0; 1; D) if and only if the sets of pointed -labelled rooted trees satisfying  and  are both empty. Finally, we reduce the problem of st ts deciding if a f;; +; *; 0; 1; Ag-term  is satisﬁable by a pointed labelled rooted tree to the problem of deciding the satisﬁability of a formula of propositional dynamic logic. This latter problem is known to be decidable (in EXPTIME [27]), so then we are done. See Figure 3 for a summary of the transformations we have outlined. See, for example, [8], for a description of propositional dynamic logic, including the notion of a regular frame. 20 Brett McLean A  '( ) st st st A  '( ) ts ts ts s A Figure 3. Transformations used to decide equality of t and s We deﬁne a translation from f;; +; *; 0; 1; Ag-terms to (propositional variable-free) formulas of propositional dynamic logic as follows. First we deﬁne the translation P from f;; +; *; 0; 1; Ag-terms to program terms by structural induction as follows. P(a) B a P(s ; t) B P(s) ; P(t) P(s + t) B P(s) + P(t) P(t ) B P(t) P(0) B ?? P(1) B >? P(A(t)) B (:P(t))? Then we simply deﬁne the translation '(t) of af;; +; *; 0; 1; Ag-term t to behP(t)i>. It is clear that for any given regular frame, satisﬁability of '(t) is equivalent to satisﬁability of t on the corresponding relational structure. Since propositional dynamic logic has the tree-model property (any frame with selected point can be ‘unwound’ to an equivalent labelled rooted tree), we obtain the equivalence of satisﬁability of '(t) on regular frames and satisﬁability of t on tree-based relational structures. But if t is satisﬁed by a pair (x; y) of vertices in a tree-based relational structure, then clearly y is a descendent of x, and t is satisﬁed by the tree rooted at x and having point y. (And conversely, satisfaction by a pointed rooted tree implies satisfaction by a tree-based relational structure.) Hence we have the required equivalence between satisfaction of t with respect to pointed labelled rooted trees and satisfaction of '(t) with respect to regular frames. The procedure described in the proof of Theorem 7.2 hardly seems ecient. The best upper bound that can be obtained from it is a 3EXPTIME bound. The constructions of A and A rely on determinisations involving a subset construction, so can result st ts in an exponential increase in problem size. Likewise, construction of the terms  and st from automata can also add an exponent in general. Lastly, we already mentioned ts that the ﬁnal step, deciding satisﬁability of propositional dynamic logic formulas, is in EXPTIME, and in fact this problem also has an exponential time lower bound (no O(2 ) algorithm for any " < 1 [8]). We ﬁnish with the obvious problem. Problem 7.3. Determine the precise complexity of deciding validity of f;; +; *; 0; 1; Dg- equations with respect to relational semantics. Free Kleene algebras with domain 21 A. Appendix Theorem A.1. The class Rel(;; +; *; 0; 1) is not closed under elementary equivalence. Proof. By the deﬁnition of * on relations, algebras in Rel(;; +; *; 0; 1) validate a = sup a (with respect to the ordering a  b () a + b = b). Take any relation R i2N whose star R di ers from all ﬁnite approximants sup R —for example take R to be i<n the immediate-successor relation in N. Let A be any algebra of relations containing R—for example the algebra generated by R. Let U be any non-principal ultraﬁlter on N, and let R be the element of the ultrapower A =U represented by the constant sequence (R; R; : : : ). Then (R) is represented by (R ; R ; : : : ), but this is not a supremum for i 2 fR j i 2 Ng since the strictly smaller element represented by (1; 1 + R; 1 + R + R ; : : : ) is also an upper bound. Hence the ultrapower does not validate a = sup a , so i2N Rel(;; +; *; 0; 1) is not closed under ultrapowers. It follows by Łos’ ´ s theorem [23] that Rel(;; +; *; 0; 1) cannot be closed under elementary equivalence. References [1] Michael Benedikt and Christoph Koch, XPath leashed, ACM Computing Surveys 41 (2009), no. 1, 3:1–3:54. [2] Stephen L. Bloom, Zoltán Ésik, and Gheorghe Stefanescu, Notes on equational theories of relations, Algebra Universalis 33 (1995), no. 1, 98–126. [3] Stanley Burris and Hanamantagouda P. Sankappanavar, A course in universal algebra, Graduate Texts in Mathematics, Springer, 2011. [4] Jules Desharnais, Bernhard Möller, and Georg Struth, Kleene algebra with domain, ACM Transactions on Computational Logic 7 (2006), no. 4, 798–833. [5] Jules Desharnais and Georg Struth, Domain axioms for a family of near-semirings, 12th International Conference on Algebraic Methodology and Software Technology (José Meseguer and Grigore Rosu, ¸ eds.), Lecture Notes in Computer Science, vol. 5140, Springer, 2008, pp. 330–345. [6] Jules Desharnais and Georg Struth, Internal axioms for domain semirings, Science of Computer Programming 76 (2011), no. 3, 181–203. [7] Samuel Eilenberg, Automata, languages, and machines, Academic Press, Orlando, Florida, USA, [8] Michael J. Fischer and Richard E. Ladner, Propositional dynamic logic of regular programs, Journal of Computer and System Sciences 18 (1979), no. 2, 194–211. [9] John Fountain, Free right type A semigroups, Glasgow Mathematical Journal 33 (1991), no. 2, 135–148. [10] John Fountain, Gracinda M. S. Gomes, and Victoria Gould, The free ample monoid, International Journal of Algebra and Computation 19 (2009), no. 04, 527–554. [11] Ferenc Gécseg and Magnus Steinby, Tree languages, Handbook of Formal Languages (G. Rozen- berg and A. Salomaa, eds.), vol. 3, Springer, 1997, pp. 1–68. [12] Mai Gehrke, Stone duality, topological algebra, and recognition, Journal of Pure and Applied Algebra 220 (2016), no. 7, 2711–2747. [13] Mai Gehrke, Serge Grigorie , and Jean-Éric Pin, Duality and equational theory of regular languages, International Colloquium on Automata, Languages, and Programming, Springer, 2008, pp. 246–257. [14] Jelle Hellings, Marc Gyssens, Yuqing Wu, Dirk Van Gucht, Jan Van den Bussche, Stijn Vansummeren, and George H. L. Fletcher, Comparing the expressiveness of downward fragments of the relation algebra with transitive closure on trees, Information Systems 89 (2020), 101467. 22 Brett McLean [15] Jelle Hellings, Marc Gyssens, Yuqing Wu, Dirk Van Gucht, Jan Van den Bussche, Stijn Vansummeren, and George H. L. Fletcher, Relative expressive power of downward fragments of navigational query languages on trees and chains, Proceedings of the 15th Symposium on Database Programming Languages, ACM, 2015, pp. 59–68. [16] Robin Hirsch and Ian Hodkinson, Relation algebras by games, Studies in Logic and the Foundations of Mathematics, vol. 147, North-Holland, 2002. [17] Robin Hirsch and Szabolcs Mikulás, Axiomatizability of representable domain algebras, The Journal of Logic and Algebraic Programming 80 (2011), no. 2, 75–91. [18] Marco Hollenberg, An equational axiomatization of dynamic negation and relational composition, Journal of Logic, Language, and Information 6 (1997), no. 4, 381–401. [19] Peter Jipsen and Georg Struth, The structure of the one-generated free domain semiring, Relations and Kleene Algebra in Computer Science (Berlin, Heidelberg) (Rudolf Berghammer, Bernhard Möller, and Georg Struth, eds.), Springer, 2008, pp. 234–242. [20] Dexter Kozen, A completeness theorem for Kleene algebras and the algebra of regular events, Information and Computation 110 (1994), no. 2, 366–390. [21] Dexter Kozen, Kleene algebra with tests, ACM Transactions on Programming Languages and Systems 19 (1997), no. 3, 427–443. [22] Leonid Libkin, Wim Martens, and Domagoj Vrgoc, ˇ Querying graph databases with XPath, Proceedings of the 16th International Conference on Database Theory, ACM, 2013, pp. 129–140. [23] Jerzy Łos, ´ Quelques remarques, théorèmes et problèmes sur les classes déﬁnissables d’algèbres, Mathematical Interpretation of Formal Systems (Thoralf Skolem, Gisbert Hasenjaeger, Georg Kreisel, Abraham Robinson, Hao Wang, Leon Henkin, and Jerzy Łos, ´ eds.), Studies in Logic and the Foundations of Mathematics, vol. 16, 1955, pp. 98–113 (French). [24] Sokhna Diarra Mbacke, Completeness for domain semirings and star-continuous Kleene algebras with domain, Master’s thesis, Université Laval, Québec, Canada, 2018. [25] Walter D. Munn, Free inverse semigroups, Proceedings of the London Mathematical Society 3 (1974), no. 3, 385–404. [26] Vaughan R. Pratt, Semantical considerations on Floyd–Hoare logic, 17th Annual Symposium on Foundations of Computer Science, IEEE, 1976, pp. 109–121. [27] Vaughan R. Pratt, A near-optimal method for reasoning about action, Journal of Computer and System Sciences 20 (1980), no. 2, 231–254. [28] Gordon B. Preston, Inverse semi-groups, Journal of the London Mathematical Society s1-29 (1954), no. 4, 396–403. [29] Volodymyr N. Redko, On the determinative aggregate of relationships of the algebra of regular events, Ukraïns’kyi Matematychnyi Zhurnal 16 (1964), no. 1, 120–126 (Russian). [30] Boris M. Schein, On the theory of generalized groups, Doklady Akademii Nauk SSSR 153 (1963), 296–299. [31] Boris M. Schein, Restrictively multiplicative algebras of transformations, Izvestiya Vysshikh Uchebnykh Zavedeni˘ ı. Matematika 95 (1970), no. 4, 91–102 (Russian). [32] Michael Sipser, Regular languages, Introduction to the Theory of Computation, Cengage Learning, Boston, Massachusetts, USA, third ed., 2012, pp. 31–100. [33] Alfred Tarski, On the calculus of relations, The Journal of Symbolic Logic 6 (1941), no. 3, 73–89. [34] Valentin S. Trokhimenko, Menger’s function systems, Izvestiya Vysshikh Uchebnykh Zavedeni˘ ı. Matematika (1973), 71–78 (Russian). [35] Viktor V. Wagner, Generalised groups, Proceedings of the USSR Academy of Sciences 84 (1952), 1119–1122 (Russian). Brett McLean, Laboratoire J. A. Dieudonné UMR CNRS 7351, Université Nice Sophia Antipolis, 06108 Nice Cedex 02 e-mail: brett.mclean@unice.fr http://www.deepdyve.com/assets/images/DeepDyve-Logo-lg.png Mathematics arXiv (Cornell University)

# Free Kleene algebras with domain

, Volume 2020 (1907) – Jul 24, 2019
22 pages

Loading next page...

/lp/arxiv-cornell-university/free-kleene-algebras-with-domain-h06jEYpuZ0
ISSN
2352-2208
eISSN
ARCH-3343
DOI
10.1016/j.jlamp.2020.100606
Publisher site
See Article on Publisher Site

### Abstract

First we identify the free algebras of the class of algebras of binary relations equipped with the composition and domain operations. Elements of the free algebras are pointed labelled ﬁnite rooted trees. Then we extend to the analogous case when the signature includes all the Kleene algebra with domain operations; that is, we add union and reﬂexive transitive closure to the signature. In this second case, elements of the free algebras are ‘regular’ sets of the trees of the ﬁrst case. As a corollary, the axioms of domain semirings provide a ﬁnite quasiequational axiomatisation of the equational theory of algebras of binary relations for the intermediate signature of composition, union, and domain. Next we note that our regular sets of trees are not closed under complement, but prove that they are closed under intersection. Finally, we prove that under relational semantics the equational validities of Kleene algebras with domain form a decidable set. 2020 Mathematics subject classiﬁcation: primary 08B20; secondary 20M20. Keywords and phrases: Kleene algebra, domain, binary relation, equational theory, decidable. 1. Introduction Reasoning about binary relations, and ways of combining them, has an extensive literature and a multitude of applications. Classically, in algebraic logic, binary relations model logical formulas with two free variables [33]. In computer science, we can ﬁnd binary relations modelling the actions of programs [26, 21], and elsewhere representing relationships between items of data that compose a tree [1], or a graph [22]. When an algebraic logician thinks of binary relations, the ﬁrst signature to come to mind will always be that of Tarski’s relation algebras. In computer science, the Kleene algebra signature has the greatest prominence. In the latter case, the operations are relational composition, union, and reﬂexive transitive closure, as well as constants for the empty relation and the identity relation. Any set of binary relations closed under the ﬁve Kleene algebra operations/constants can be viewed as an algebra in the sense of universal algebra/model theory, that is, a structure over a signature of function symbols (but no predicate symbols). It is well known that this class of algebras contains its free algebras, and that the free algebra generated by a given ﬁnite set  is precisely the set of all regular languages over the alphabet . The importance of regular languages in theoretical computer science goes This project has received funding from the European Research Council (ERC) under the European Union’s Horizon 2020 research and innovation program (grant agreement No. 670624). arXiv:1907.10386v2 [math.LO] 28 Sep 2020 2 Brett McLean almost without saying [32]. The algebraic perspective on sets of regular languages was employed to great e ect by Eilenberg in his celebrated variety theorem [7], and continues to yield valuable new insights to this day [13, 12]. In this paper, we identify the analogous free algebras in the case where the signature is expanded with one extra operation on binary relations: the unary domain operation D(R) = f(x; x) j 9y : (x; y) 2 Rg, which provides a record of all points having at least one image under the given relation. This expanded signature is that of Kleene algebra with domain, a certain ﬁnite set of algebraic laws extending Kozen’s theory of Kleene algebras with a domain operation and a small number of associated equations [6]. One intended model for this theory is indeed algebras of binary relations, and there is a hope that the theory will prove useful for reasoning about the actions of nondeterministic computer programs [4, 5]. In this programs-as-relations formalism, a program P is modelled by a relation R on machine states, with R relating state x to state y precisely if, whenever the machine is in state x and P is executed, y is a possible resultant state. Hence relational composition models sequential composition of programs, union models nondeterministic choice, and reﬂexive transitive closure models the choice to iteratively execute a program any (ﬁnite) number of times. The expression D(R) then models a program that when run from certain states—those from which P would terminate—has no e ect—and otherwise fails/does not terminate. Thus domain makes provision within the syntax for expressing certain types of ‘tests’—an important component of all programming languages. In addition to identifying the free algebras, we also show that it is decidable whether an equation in this Kleene algebra with domain signature is valid over all algebras of binary relations. Of course, when reasoning about programs, the validity of an equation s = t corresponds to the programs expressed by s and t always having precisely the same e ect (independently of which ground programs the variables are instantiated with). Structure of the paper In Section 2 we give the necessary deﬁnitions and some context regarding algebras of binary relations, and their free algebras. In Section 3 we introduce the trees that we use for describing our free algebras, and certain relations and operations on those trees. In Section 4 we prove an intermediate result: we identify the free algebras for the reduced signature that omits the ‘nondeterministic’ union and reﬂexive transitive closure operators, and also the empty relation constant, that is, the signature with the composition and domain operations and the identity constant. For this signature the elements of the free algebras are ‘reduced’ pointed labelled ﬁnite rooted trees (Theorem 4.6). In Section 5 we extend the result of the previous section to identify the free algebras for the full Kleene algebra with domain signature. In this case, elements of the free algebras are certain sets of the trees of the previous case (Theorem 5.6). We term these Free Kleene algebras with domain 3 sets ‘regular’ sets of trees, by analogy with the regular languages of the Kleene algebra signature. By combining with an existing result, it follows as a corollary that the axioms of domain semirings provide a ﬁnite quasiequational axiomatisation of the equational theory of algebras of binary relations for the signature of composition, union, domain, and the two constants (but not reﬂexive transitive closure). Section 6 is devoted to closure properties of regular sets of trees. We use automata to show the regular sets of trees are closed under intersection. We also note the regular sets of trees are not closed under complement and pose the questions of whether they are closed under implication or under residuation. In Section 7 we again use automata to prove the decidability of validity for equations in the signature of Kleene algebra with domain under relational semantics (Theorem 7.2). 2. Algebras of binary relations We begin by making precise what is meant by an algebra of binary relations. Throughout, we consider that 0 2 N. Deﬁnition 2.1. An algebra of binary relations of the signature f;; +; *; 0; 1g is a universal algebra A = (A; ;; +; *; 0; 1) where the elements of the universe A are binary relations on some (common) set X, the base, and the interpretations of the symbols are given as follows: the binary operation ; is interpreted as composition of relations: R ; S B f(x; y) 2 X j 9z 2 X : (x; z) 2 R^ (z; y) 2 Sg; the binary operation + is interpreted as set-theoretic union: R + S B f(x; y) 2 X j (x; y) 2 R_ (x; y) 2 Sg; the unary operation * is interpreted as reﬂexive transitive closure: R* B f(x; y) 2 X j 9n 2 N 9x : : : x : 0 n (x = x)^ (x = y)^ (x ; x ) 2 R^ : : :^ (x ; x ) 2 Rg; 0 n 0 1 n1 n the constant 0 is interpreted as the empty relation: 0 B ;; the constant 1 is interpreted as the identity relation on X: 1 B f(x; x) 2 X g: We let Rel(;; +; *; 0; 1) denote the isomorphic closure of the class of all algebras of binary relations of the signature f;; +; *; 0; 1g. 4 Brett McLean To be clear: the universe of an algebra of binary relations is necessarily closed under the given operations, since the deﬁnition of a universal algebra requires the symbols be interpreted as total functions. Remark 2.2. (i) It is easy to see that Rel(;; +; *; 0; 1) is not a ﬁrst-order axiomatisable class, not even closed under elementary equivalence, by a simple argument showing that Rel(;; +; *; 0; 1) is not closed under ultrapowers. See the appendix for a proof of this well-known fact. (ii) Despite Rel(;; +; *; 0; 1) being far from a variety, it is easily seen to be closed under subalgebras and products. (An element of a product of algebras of binary relations is the disjoint union of all its component binary relations.) Hence, by a basic theorem of universal algebra (see, for example, [3, Theorem 10.12]), the class Rel(;; +; *; 0; 1) contains its free algebras. (iii) It is a folk theorem that the free Rel(;; +; *; 0; 1)-algebra generated by a ﬁnite set is the set of all regular languages over the alphabet  (with the operations of language concatenation, union, and so on). (iv) It is well known that the variety HS P Rel(;; +; *; 0; 1) generated by Rel(;; +; *; 0; 1) has no ﬁnite equational axiomatisation [29]. (v) We do however have Kozen’s quasivariety of Kleene algebras [20], deﬁned by a ﬁnite number of equations/quasiequations, intermediate to Rel(;; +; *; 0; 1) and HS P Rel(;; +; *; 0; 1). That is, Rel(;; +; *; 0; 1)  Kleene algebras  HS P Rel(;; +; *; 0; 1); and so HS P(Kleene algebras) = HS P Rel(;; +; *; 0; 1): Of course, the operations of Deﬁnition 2.1 are not the only operations that can be deﬁned on binary (endo)relations. In particular, various unary ‘test’ operations can be deﬁned; here is a selection. Deﬁnition 2.3. The unary operation D is the operation of taking the diagonal of the domain of a relation: D(R) = f(x; x) 2 X j 9y 2 X : (x; y) 2 Rg. The unary operation R is the operation of taking the diagonal of the range of a relation: R(R) = f(y; y) 2 X j 9x 2 X : (x; y) 2 Rg. A quasiequation is a conditional equation where the condition is a ﬁnite conjunction of equations. That is, a quasiequation is a formula of the form s = t ^^ s = t ! u = v. 1 1 n n Free Kleene algebras with domain 5 The unary operation A is the operation of taking the diagonal of the antidomain of a relation—those points of X at which the image of the relation in empty: A(R) = f(x; x) 2 X j 9y 2 X : (x; y) 2 Rg. One can vary the operations from those of Deﬁnition 2.1 and/or restrict the binary relations to some particular form. The resulting class will again contain its free algebras. If the class is of interest, then it is useful to establish a description of these free algebras. Restricting the binary relations to be some type of function (total functions, partial functions, or injective partial functions, for example) tends to yield free algebras whose elements are a ‘single object’, rather than a ‘set of objects’. The class of semigroups, for example, is the variety generated by Tot(;)—algebras of total functions with composi- tion—and an element of a free semigroup is a single string, rather than a set of strings as we have in the case Rel(;; +; *; 0; 1). Similarly, elements of free groups are also strings, with groups forming isomorphs of algebras of permutations, with the familiar operations. There is also an observable pattern when test operations are added to the signature: strings are replaced by (labelled) trees. The following results are known. -1 1. The class Inj(;; ), of isomorphs of algebras of injective partial functions with composition and inverse, is the class of inverse semigroups [35, 28]. (In this 1 1 signature D and R are deﬁnable via D(R) B R ; R and R(R) B R ; R, respectively.) Elements of free inverse semigroups are certain trees, so-called Munn trees [25]. 2. The class Par(;; D)—partial functions with composition and domain—is a variety [34], most commonly known as the (left) restriction semigroups. A description of the free algebras has been given, and again, elements can be viewed as trees [9]. 3. The class Par(;; D; R)—partial functions with composition, domain, and range— is a proper quasivariety; a ﬁnite quasiequational axiomatisation was given by Schein [31]. Once more, a description of the free algebras has been given, and elements can be viewed as trees [10]. We should also mention at this stage Hollenberg’s ﬁnite equational axiomatisation of the equational theory of the quasivariety Rel(;; A) (in which D, 0, and 1 are easily expressible) [18]. Of course, this result amounts to an implicit description of the corresponding free algebras, as quotients of term algebras by this theory. Another result involving binary relations (but not tests), is Bloom, Ésik, and Stefanescu’s explicit ^ ^ description of the free algebras for the case Rel(;; +; *; 0; 1; ), where is the converse ^ 2 operation R B f(x; y) 2 X j (y; x) 2 Rg [2]. There, the elements of the algebras are sets of strings. 2 -1 In this signature, in which is available, the inverse semigroups form a variety. To give an equational axiomatisation it suces to replace, in the natural axiomatisation, the quasiequation ‘inverses are unique’ 1 1 1 1 by the equation a ; a ; a ; a = a ; a ; a ; a [30]. 6 Brett McLean Having noted that binary relations ; sets, functions ; singletons, and tests ; trees, one can anticipate that when tests are added to the case Rel(;; +; *; 0; 1), elements of free algebras will be sets of labelled trees. We will prove that this is indeed the case (Theorem 5.6). On the way to doing this, we also identify the free algebras for the case without the ‘nondeterministic’ operators + and *, more precisely, for the case Rel(;; 1; D) (Theorem 4.6). The analogous results for signatures formed by adding/removing 0 and/or 1 follow as corollaries of these two theorems. Remark 2.4. The term ‘Kleene algebra with domain’ was originally used for a certain quasiequational theory extending the two-sorted Kleene algebra with tests with a domain operation [4]. It was subsequently redeﬁned as a (strictly less expressive) one-sorted quasiequational theory extending Kleene algebra with a domain operation [6]. 3. Trees The central objects we will be working with throughout will be labelled rooted trees. We will give two deﬁnitions of these. The ﬁrst, Terminology 3.1, is the usual graph-theoretic deﬁnition, and we give it in order to make use of basic graph-theoretic terminology: vertex, edge, and so on. The second, Deﬁnition 3.2, is cleaner, in the sense that isomorphic trees are identical, and will serve as the ‘ocial’ deﬁnition in this paper. Terminology 3.1. A tree is a connected acyclic undirected graph (reﬂexive edges are prohibited). All trees will be assumed to be ﬁnite unless otherwise stated. A rooted tree is a tree with a distinguished vertex called the root. By a labelled tree, we will mean an edge-labelled tree. That is, given a set  of labels, a labelled tree is a tree T together with a function from the edges of T to Deﬁnition 3.2. Given a set  of labels, a labelled rooted tree is deﬁned recursively as a set of pairs (a; T ), where a 2  and T is a labelled rooted tree. Some explanation may be helpful. According to Deﬁnition 3.2, the empty set is a labelled rooted tree (this is the base case of the deﬁnition). This empty set should be thought of as encoding what is, in the graph-theoretic view, the tree with a single vertex. Figure 1 illustrates how some simple examples of labelled rooted trees should be viewed. Free Kleene algebras with domain 7 a a Figure 1. The labelled rooted trees encoded as ;, f(a;;)g, and f(a;;); (a;f(b;;)g)g, respectively (with roots at the top) The reader may note that Deﬁnition 3.2 is more restrictive than the deﬁnition of labelled rooted trees obtained from Terminology 3.1—it cannot describe any tree having a vertex with two distinct but isomorphic child subtrees. However, we will have no need of such trees in this paper. Deﬁnition 3.3. A pointed tree is a tree with a distinguished vertex called the point. We will primarily work with pointed labelled rooted trees. We will usually denote a pointed labelled rooted tree (T; p) by its underlying labelled rooted tree T . We deﬁne the notion of a homomorphism of (possibly pointed) labelled rooted trees by reference to homomorphisms of relational structures. Deﬁnition 3.4. A relational structure (X; f ) for a set  of labels is a set X and an assignment f giving for each element of a 2  a binary relation a on X. A homomorphism from a relational structure (X; f ) to the relational structure (Y; g) (both with label-set ) is a map  : X ! Y validating f g (x ; x ) 2 a =) ((x ); (x )) 2 a 1 2 1 2 for each a 2 . We can view any -labelled rooted tree as a relational structure (X; f ) by taking X to be the set of vertices of the tree and for each a 2  setting a to be the set of pairs (x; y) of vertices such that x is the parent of y and the edge fx; yg is labelled by a. When we speak of a homomorphism  : S ! T of possibly pointed labelled rooted trees, we mean a homomorphism of the trees viewed as relational structures that is also required to map the root of S to the root of T and, if it exists, the point of S to the (therefore extant) point of T . Let A be an algebra of binary relations (in any of the signatures we take an interest in) with base set X. Let f be an assignment of members of A to the set  of variables. Then (A; f ) naturally deﬁnes a relational structure: (X; f ). Conversely, let (X; f ) be a relational structure and let A be any algebra of binary relations on X that includes fa j a 2 g in its universe (that is, any algebra between the algebra generated by this set and the algebra of all binary relations on X  X). Then the standard model-theoretic 8 Brett McLean A; f interpretation JtK of any -term t is independent of the precise choice of A. Thus, when interpreting terms and evaluating equations, it is safe to conﬂate the concepts of algebra + assignment and relational structure, and we will often do so. For example, the following deﬁnition is stated in terms of an algebra and assignment, but we will mainly use it in contexts where we are ostensibly talking about a relational structure. Deﬁnition 3.5. Let A be an algebra of binary relations with base X, let t be a term, and let f be an assignment to the variables in t. We say that a pair (x; y) 2 X  X satisﬁes t A; f if (x; y) 2 JtK . We want to be able to reduce trees to forms without any redundant branches. In order to do that, we ﬁrst deﬁne a preorder on trees. Deﬁnition 3.6. The preorder  on (possibly pointed) labelled rooted trees is deﬁned recursively as follows. For trees T and T with roots r and r respectively, T  T if 1 2 1 2 1 2 and only if (a) if r is the point vertex of T , then r is the point vertex of T , 2 2 1 1 (b) for each child v of r , there is a child v of r such that 2 2 1 1 (i) the labels of the edges r v and r v are equal, 1 1 2 2 (ii) T  T , where T and T are the v -rooted and v -rooted subtrees v v v v 1 2 1 2 1 2 respectively. That  is indeed a preorder is clear. In fact, by induction on the height of the trees, it is easy to see that T  T () there exists a homomorphism  : T ! T : (3.1) 1 2 2 1 In the following deﬁnition and proposition, we continue to work with trees that may or may not be pointed. Deﬁnition 3.7. Let T be a labelled tree with root r. The reduced form of T is the tree formed recursively as follows. (a) For each child v of r, replace the v-rooted subtree with its reduced form. Call the resulting tree T . (b) For each label a 2 , let C be the set of subtrees of T rooted at a vertex linked to r by an a-labelled edge. Remove all but the -minimal subtrees in C . Example 3.8 (reduction). The pointed tree on the left of Figure 2 reduces as shown. The tree on the right is already reduced. Free Kleene algebras with domain 9 a a a a a a a a b b b Figure 2. Reduction of pointed labelled rooted trees Proposition 3.9. The preorder  is a partial order on reduced labelled rooted trees. Proof. By induction on the maximum height of the two trees being compared. For the base case, take trees T ; T of height 0, so both have just a single vertex. Suppose 1 2 T  T and T  T . Then by Deﬁnition 3.6(a), the tree T is pointed if and only if T 1 2 2 1 1 2 is pointed. Hence T = T . 1 2 Now let T and T be of height at most n + 1, and assume antisymmetry of  holds 1 2 for all reduced trees of height at most n. Suppose T  T and T  T , and denote 1 2 2 1 the roots by r and r , respectively. As before, T has a point at r if and only if T 1 2 1 1 2 has a point at r . By Deﬁnition 3.7 the child subtrees of vertex r are reduced, and for 2 1 each a 2  the child subtrees linked by an a-labelled edge are pairwise -incomparable. Likewise for the child subtrees of vertex r . Let v be an arbitrary child of r . Since T  T , we can ﬁnd a child v of 2 2 1 2 1 r as in Deﬁnition 3.6(b), giving us T  T . Then using T  T and applying 1 v v 2 1 1 2 Deﬁnition 3.6(b) again, we obtain a child v of r and have T  T  T (with r v 2 v v v 2 2 1 2 and r v having the same label). Hence by pairwise -incomparability, T = T . So 2 v v 2 2 T  T  T , which by the inductive hypothesis yields T = T . Since v was v v v v v 2 2 1 2 1 2 arbitrary, we conclude that every child subtree of r is present as a child subtree of r . Symmetrically, every child subtree of r is present as a child subtree of r . Hence 1 1 2 T = T . 1 2 Note now that the partial order  on reduced trees is Noetherian (converse well- founded). Indeed, by structural induction there are a ﬁnite number of distinct labelled trees of any ﬁxed depth, hence a ﬁnite number of reduced pointed labelled trees of that depth. And T  T implies the depth of T is at most the depth of T . 1 2 2 1 0 0 0 Proposition 3.10. If a labelled rooted tree T reduces to T , then T  T and T  T . Proof. Another induction on height. All trees of height 0 are already reduced, so this base case is trivial. Now assume the result holds whenever T is of height at most n. Let T be of height 0 0 0 n + 1, with root r. It is clear that the root r of T is the point of T if and only if r is the point of T . So there is no obstruction to a homomorphism mapping r to r or vice versa. 10 Brett McLean 0 0 0 First we show T  T . Every child subtree of r is the reduced form T of some 0 0 child subtree T of r (with rv and r v having the same label). Hence, by the inductive hypothesis and (3.1), there is a homomorphism  0 : T ! T . By gluing together v v 0 0 0 0 f j v a child of r g, and mapping r to r, we obtain a homomorphism T ! T . Hence T  T . 0 00 0 Now we show T  T . Let T be the intermediate tree in the reduction of T to T , that is, T is the tree formed from T by reducing all child subtrees of r. Denote the root 00 00 of T by r . Take an arbitrary child subtree T of r, and let T 00 be its reduced form v v sitting as a subtree of T . So by the inductive hypothesis, there is a homomorphism 0 00 T ! T 00 . Since  is Noetherian on reduced trees, when T is formed from T by v v 0 0 00 applying step (b) in the deﬁnition of reduction, a subtree T with T  T (and such v v v 00 00 0 0 that r v and r v have the same label) is retained. Thus there is a homomorphism 00 0 0 T ! T , and hence, by composition, a homomorphism T ! T . Gluing together the v v v v homomorphisms for each child v of r, and mapping r to r , we obtain a homomorphism 0 0 T ! T . Hence T  T . Thus reduction selects a canonical member of every-equivalence class. Informally, we can think of  on reduced trees as corresponding to the inclusion relation on binary relations—if T  T then T is a more speciﬁc description than T . 1 2 1 2 Deﬁnition 3.11. Let  be a set and let T and S be reduced pointed -labelled rooted trees. The pointed tree concatenation T ; S of T and S is the tree formed by 1. identifying the point of T and the root of S (the root is now the root of T and the point is the point of S ), 2. reducing the resulting tree to its reduced form. The domain D(T ) of T is the tree formed by 1. reassigning the point of T to the current root of T , 2. reducing the resulting tree to its reduced form. Notation 3.12. For a symbol a from an alphabet, we write a for the pointed labelled rooted tree with two vertices, whose point is the child vertex and whose single edge is labelled by a. We write " for the pointed labelled rooted tree with a single vertex. Remark 3.13. A very similar setup to that presented in this section has already been used for investigating Kleene algebras with domain [24]. In that thesis, the graph-theoretic deﬁnition of trees is used, and pointed labelled ﬁnite rooted trees are called ‘trees with a top’. There, the relation  is termed ‘simulates’, and trees are only considered up to simulation equivalence. Thus there is no notion of a reduced form; the operations of Deﬁnition 3.11 are deﬁned without their reduction steps. We will return to say more about the thesis [24] at the end of Section 5. Free Kleene algebras with domain 11 4. Composition, identity, and domain In this section we will identify the free algebras of the class Rel(;; 1; D). From there, it is straightforward to accommodate the addition of + and * (and 0). By a term we mean a raw syntactic object belonging to a term algebra/absolutely free algebra—no background theory is assumed. Thus equality of terms means literal equality. Deﬁnition 4.1. We deﬁne the single-tree interpretation [ ] of f;; 1; Dg-terms as follows. 1. [a] B a, for any variable a, 2. [1] B ", 3. [s ; t] B [s] ; [t], 4. [D(s)] B D([s]). Here the operations and constants on the right-hand side are those deﬁned for trees in Section 3. Deﬁnition 4.1 is well deﬁned because if pressed for a formal deﬁnition of terms we would give one that satisﬁes unique readability, either by writing ; in preﬁx form, requiring parentheses, or deﬁning terms directly as trees. Lemma 4.2. The map [ ] is a surjection from the f;; 1; Dg-terms in variables  onto the reduced pointed -labelled rooted trees. Hence [ ] is a surjective homomorphism from the term algebra onto the reduced pointed -labelled rooted trees, viewed as an algebra of the signature f;; 1; Dg with the operations we have deﬁned. Proof. We show that every reduced tree is the single-tree interpretation of some term by induction on the size of the tree. A tree whose root has no children is just "—the interpretation of 1—so assume we have a tree T given by a nonempty set f(a ; T ); : : : ; (a ; T )g, and a distinguished 1 1 n n point p. First suppose p is the root of T . For each 1  i  n, let t be a term whose interpretation is the pointed tree whose tree is T and whose point is its root. Then we can realise T by the term D(a ; t ) ; ; D(a ; t ). (We write iterated ; without brackets 1 1 n n because the positioning of the brackets turns out to be immaterial.) Alternatively, suppose p is not the root of T ; so without loss of generality p is a vertex in T . Let t ; : : : ; t be as before and now let t be a term whose interpretation n 1 n1 n is the pointed tree whose tree is T and whose point is p. Then we can realise T by the term D(a ; t ) ; ; D(a ; t ) ; a ; t . 1 1 n1 n1 n n The following lemma says that the single-tree interpretation of a term records for us a tree that, in a relational structure, ‘connects’ x and y if and only if the term is satisﬁed by (x; y). 12 Brett McLean Lemma 4.3. Let A be a f;; 1; Dg-algebra of binary relations, with base X. Let t be a f;; 1; Dg-term, and let f be an assignment of elements of A—so, binary relations—to the variables in t. Then for any x; y 2 X, the following are equivalent. 1. The pair (x; y) belongs to the model-theoretic interpretation of t under the assignment f . 2. There is a homomorphism of [t] into (X; f ) such that the root of [t] is mapped to x and the point of [t] is mapped to y. A; f Proof. By structural induction on terms. As before, we write JtK for the model- theoretic interpretation of t. First, suppose t = a, for some variable a. Then [t] = a—consisting of an a-labelled A; f edge linking the root r to the point p. Therefore (x; y) 2 JtK if and only if (x; y) 2 f (a), so if and only if the map given by r 7! x and p 7! y is a homomorphism. The case t = 1 is similar. Next, suppose t = s ; s and that the equivalence holds for s and for s . Then 1 2 1 2 A; f A; f A; f (x; y) 2 JtK if and only if there is a z 2 X such that (x; z) 2 Js K and (z; y) 2 Js K . 1 2 By the inductive hypotheses, the latter is equivalent to the existence of a homomorphism from [s ] mapping its root r to x and point p to z, and a homomorphism from [s ] 1 1 1 2 mapping its root r to z and point p to y. This is equivalent to the existence of a 2 2 homomorphism from [s ; s ], mapping the root to x and point to y, since there exist 1 2 homomorphisms in both directions between a tree and its reduced form. A; f Finally, suppose t = D(s) and that the equivalence holds for s. Then (x; y) 2 JtK if A; f and only if x = y and there exists z such that (x; z) 2 JsK . By the inductive hypothesis, this is equivalent to x = y and the existence of a homomorphism mapping the root of [s] to x and the point to z. Since [t] and [s] di er only by the position of their point, which for [t] is the root, the latest condition is equivalent to the existence of a homomorphism from [t] mapping both the root/point to x/y, as required. Corollary 4.4 (soundness with respect to relations). For any pair s and t of f;; 1; Dg- terms [s] = [t] =) Rel(;; 1; D) j= s = t: Lemma 4.5 (completeness with respect to relations). For any pair s and t of f;; 1; Dg- terms Rel(;; 1; D) j= s = t =) [s] = [t]: Proof. Suppose Rel(;; 1; D) j= s = t. We will show that [s]  [t]. Then by symmetry, also [t]  [s]. So [s] = [t] and we are done. Let r be the root and p the point of [s]. On [s] viewed as a relational structure, by using Lemma 4.3 and the identity homomorphism [s] ! [s], the pair (r; p) belongs to the model-theoretic interpretation of s (under the evident variable assignment). Hence, by the assumption that Rel(;; 1; D) j= s = t, we have that (r; p) belongs to the model- theoretic interpretation of t. Then by Lemma 4.3 there is a homomorphism of labelled Free Kleene algebras with domain 13 trees from [t] into [s] mapping the root of [t] to r and the point of [t] to p. That is, there is a homomorphism of pointed labelled rooted trees from [t] into [s]. We know this is equivalent to the conclusion [s]  [t] we seek, so we are done. With Corollary 4.4 and Lemma 4.5 available, we can now complete the proof that we have identiﬁed the free algebras of the class Rel(;; 1; D). Theorem 4.6. Let  be an alphabet, and letR be the set of reduced pointed -labelled ﬁnite rooted trees. Then the free Rel(;; 1; D)-algebra over  is R equipped with the operations of pointed tree concatenation and of domain from Deﬁnition 3.11 (and the constant "). Proof. Since R is generated by , it follows by the ﬁrst isomorphism theorem of universal algebra that R is isomorphic to a quotient Q of the term algebra (for signature f;; 1; Dg) over variables . The congruence relation  deﬁning the quotient is given by s  t () [s] = [t], for terms s and t over . So by Corollary 4.4 and Lemma 4.5, the congruence is given by equational validity in Rel(;; 1; D). It is a basic result of universal algebra that Q is then precisely the free algebra over  of the class Rel(;; 1; D). The inclusion of 1 and exclusion of 0 from the signature was in fact not essential. We can easily add and remove them according to our wishes. Corollary 4.7. Let  and R (viewed as an algebra) be as in Theorem 4.6. The free Rel(;; D)-algebra over  is given by removing the tree " from R . The free Rel(;; 0; D)-algebra over  is given by the addition of a zero element—an element validating 0 ; T = T ; 0 = 0 and D(0) = 0—to the free Rel(;; D)-algebra over . The free Rel(;; 1; 0; D)-algebra over  is given by the addition of a zero element to R . Proof. For Rel(;; D), ﬁrst note that every nontrivial tree in R is the single-tree interpretation of a f;; Dg-term, and conversely, if a tree is the interpretation of a f;; Dg- term then it cannot be trivial—by induction, all such interpretations have at least one edge. Hence the nontrivial trees indeed form a f;; Dg-algebra generated by (the interpretations of elements of) . Since every f;; Dg-algebra of relations embeds in a f;; 1; Dg-algebra of relations, it follows from Corollary 4.4 that every equation validated by the nontrivial trees is validated by all f;; Dg-algebras of relations. The converse follows immediately from Lemma 4.5. For Rel(;; 0; D) and Rel(;; 1; 0; D), note that by the deﬁnition of a zero element, a term is interpreted as the zero of the algebra if and only if the symbol 0 appears in the term, and similarly a term is interpreted as ; in every algebra of relations if and only if 0 appears in the term. These observations are sucient to extend Corollary 4.4 and Lemma 4.5 to terms that may contain 0.  14 Brett McLean We remark that the class Rel(;; 1; D), as noted in [17], forms a quasivariety. It has been shown that this quasivariety is not ﬁnitely axiomatisable in ﬁrst-order logic [17]. Naturally, the same statements hold when we add/remove 0 and 1. 5. Expansion by union and reﬂexive transitive closure In this section, we extend the result of the previous section to provide a description of the free algebras of the class of relational Kleene algebras with domain, that is, the free algebras of Rel(;; +; *; 0; 1; D). Deﬁnition 5.1. For a set K of reduced trees, let maximal(K) denote the set of - maximal elements of K. We lift the notation ; and D of Deﬁnition 3.11 to sets of trees by using elementwise application. We deﬁne the standard tree interpretation J K of f;; +; *; 0; 1; Dg-terms as follows. 1. For a 2 ; JaK B fag, 2. J0K B ;, 3. J1K B f"g, 4. Js + tK B maximal(JsK[ JtK), 5. Js ; tK B maximal(JsK ; JtK), 1 i 0 i+1 i 6. JsK B maximal( JsK ), where JsK B 1 and JsK B JsK ; JsK, i=1 7. JD(s)K B maximal(DJsK). Note that JaK, for a 2 , J0K, and J1K, contain only reduced trees, and [ preserves this property on sets of trees (as do the lifted ; and D, by deﬁnition). Hence the maximal operation is applicable whenever it is used in Deﬁnition 5.1, and standard interpretations contain only reduced trees. Deﬁnition 5.2. Let  be an alphabet. A set of pointed -labelled rooted trees is regular if it is the standard tree interpretation of some f;; +; *; 0; 1; Dg-term. We can think of a regular set L of trees as a concise record of all the reduced trees in the downward-closed set #L (with respect to the  ordering). In this view (thinking of L as #L), the operation + corresponds to the real set union operation, and ; and D correspond to pointwise application of the operations of Deﬁnition 3.11. The advantage of using the arrangement of Deﬁnition 5.1 is that regular sets remain ﬁnite until such time that Kleene star is used. That the partial order  on reduced trees is Noetherian The short proof of this using general model-theoretic results consists of noting that the class is both closed under direct products and—almost by deﬁnition—has a pseudouniversal axiomatisation. (See [16, Section 9.2] for a deﬁnition of pseudouniversal.) It is not claimed that this notion of regular sets of pointed trees is the same as the notion of a regular tree language coming from the theory of tree automata [11]. Free Kleene algebras with domain 15 1 i ensures there are ‘enough’ elements in maximal( JsK ) for that to be a sensible i=1 deﬁnition of JsK (as demonstrated in the proof of the next lemma). The following lemma is the analogue of Lemma 4.3. Lemma 5.3. Let A be a f;; +; *; 0; 1; Dg-algebra of binary relations, with base X. Let t be a f;; +; *; 0; 1; Dg-term, and let f be an assignment of elements of A to the variables in t. Then for any x; y 2 X, the following are equivalent. 1. The pair (x; y) belongs to the model-theoretic interpretation of t under the assignment f . 2. There is a tree T in JtK and a homomorphism of T into (X; f ) such that the root of T is mapped to x and the point of T is mapped to y. Proof. Structural induction on terms. We give the details for the * case in the direction 1 =) 2, as this case is not entirely trivial. So suppose that t = s , that condition 1 holds for t, and that whenever condition 1 holds for s, condition 2 holds for s. Then since (x; y) belongs to the model-theoretic interpretation of s , there are z ; : : : ; z with 0 n z = x, z = y, and each (z ; z ) belonging to the interpretation of s. Hence there are 0 n i i+1 trees S ; : : : ; S 2 JsK and homomorphisms mapping each S into (X; f ) with the root 1 n i mapping to z and point mapping to z . By (3.1), there is a homomorphism of the i1 i reduced tree (: : : (S ; S ) ; ; S ) into (X; f ) mapping the root to x and the point to y. By 1 2 n 0 n 0 (3.1) again (and an induction up to n), there is a T 2 JsK with T  (: : : (S ;S );;S ) 1 2 n and a homomorphism of T into (X; f ) mapping the root to x and the point to y. Then 0 1 j T 2 JsK , and since the partial order  on reduced trees is Noetherian, there exists j=1 1 i 0 a T 2 JsK B maximal( JsK ) with T  T . Such a T fulﬁls condition 2, so we are i=1 done. Proposition 5.4 (soundness with respect to relations). For any pair s and t of f;; +; *; 0; 1; Dg-terms JsK = JtK =) Rel(;; +; *; 0; 1; D) j= s = t: Proof. Suppose JsK = JtK. Let A be a f;; +; *; 0; 1; Dg-algebra of binary relations, with base X. Let f be an assignment of elements of A to the variables appearing in s = t. A; f Write J K for the model-theoretic interpretations in A under f . Then by Lemma 5.3, A; f for any x; y 2 X, we have that (x; y) 2 JsK if and only if there is a T 2 JsK with T connecting x and y. As JsK = JtK, this is equivalent to there being a T 2 JtK with T connecting x and y, which in turn is equivalent, by Lemma 5.3 again, to having A; f A; f A; f (x; y) 2 JtK . As x and y were arbitrary, we have JsK = JtK . As A and f were arbitrary, we conclude that Rel(;; +; *; 0; 1; D) j= s = t. Proposition 5.5 (completeness with respect to relations). For any pair s and t of f;; +; *; 0; 1; Dg-terms Rel(;; +; *; 0; 1; D) j= s = t =) JsK = JtK: 16 Brett McLean Proof. Just like the proof of Lemma 4.5. Given S 2 JsK, we obtain the existence of 0 0 a T 2 JtK with S  T . By symmetry, there is an S 2 JsK with T  S . Since JsK is a -antichain, S = T . Hence JsK  JtK. By symmetry, also JtK  JsK. With Proposition 5.4 and Proposition 5.5, we can now complete the proof of Theorem 5.6 in the familiar way. Theorem 5.6. Let  be an alphabet, and letR be the set of reduced pointed -labelled rooted trees. Then the free Rel(;; +; *; 0; 1; D)-algebra over  has as its universe all the regular subsets of R . The operations are the following, where L, L , and L , are 1 2 regular sets of reduced trees. 1. 0 B ;, 2. 1 B f"g, 3. L + L B maximal(L [ L ), 1 2 1 2 4. L ; L B maximal(L ; L ), 1 2 1 2 i 0 i+1 i 5. L B maximal( L ), where L B f"g and L B L ; L, i=1 6. D(L) B maximal(D(L)). Proof. Similar to the proof of Theorem 4.6. Corollary 5.7. Let  and R be as in Theorem 5.6. The free Rel(;; +; *; 0; D)-algebra over  consists of the regular subsets ofR that do not contain the trivial tree ". The free Rel(;; +; *; 1; D)-algebra over  consists of the nonempty regular subsets of R . The free Rel(;; +; *; D)-algebra over  consists of the nonempty regular subsets of R that do not contain ". Proof. Similar to the proof of Corollary 4.7. Corollary 5.8. Let  and R be as in Theorem 5.6. Then the free Rel(;; +; 0; 1; D)- algebra over  consists of all ﬁnite regular subsets of R . Proof. First note that the regular subsets interpreting f;; +; 0; 1; Dg-terms are precisely the ﬁnite regular subsets. Then soundness and completeness follow from Proposition 5.4 and Proposition 5.5 respectively. In [24], Mbacke proves (Theorem 5.3.3 there) that a certain ﬁnite equational theory over the signature f;; +; 0; 1; Dg—the theory of domain semirings—is complete for the equational validities of what amounts to the algebras of trees identiﬁed in Corollary 5.8. Hence, we obtain the following corollary. Free Kleene algebras with domain 17 Corollary 5.9. The axioms of domain semirings provide a ﬁnite equational axiomat- isation of the equational theory of Rel(;; +; 0; 1; D). In other words, the axioms of domain semirings are (sound and) equationally complete for algebras of binary relations. In [19], Jipsen and Struth study the singly- generated free domain semiring. Corollary 5.8 now subsumes the description of that paper, though that is not to say that these free algebras are uncomplicated objects. The other main result of [24] (Theorem 5.3.12 there) is an axiomatisation of the equational validities of our algebras of regular sets of trees. The axiomatisation used consists of the second-order theory of star-continuous Kleene algebras, augmented with one additional second-order axiom: X X X X a ; ( b) ; c = (a ; b ; c) ! a ; ( D(b)) ; c = (a ; D(b) ; c); b2B b2B b2B b2B where indicates supremum. Unfortunately, this axiom is not sound for algebras of binary relations. (And so, in particular, it is not a consequence of the axioms of star-continuous Kleene algebras, which are sound for relations.) Hence, we do not obtain an analogue of Corollary 5.9 for the signature f;; +; *; 0; 1; Dg. 6. Automata, and closure under intersection It is well known that the set of regular languages over a ﬁnite alphabet  is closed under complement with respect to  . It is clear that, over a (nonempty) ﬁnite alphabet, the regular sets of trees are not closed under the complement operation (with respect to the set of reduced trees). And, more meaningfully, this is true even in the view that a regular set L represents the downward-closed set #L (since complement does not preserve downward closure). However, as we will show, the regular sets of trees are closed under the following ‘intersection’ operation. L  L B maximal(#L \#L ) 1 2 1 2 In [15], and its extended journal version [14], condition automata are deﬁned. They are an extension of ﬁnite-state automata designed speciﬁcally for working with relational queries that may contain D (among other tests such as range and antidomain). In this section, we will use a slightly simpliﬁed deﬁnition of condition automata. Deﬁnition 6.1. A domain condition automaton is a 6-tuple (; S; I; T; ; c), where (; S; I; T; ) is a ﬁnite-state automaton (nondeterministic, with -transitions permitted), and c is a function that assigns a f;; +; *; 0; 1; Dg-term (over ) to each state S . a a 1 2 n A domain condition automaton accepts a path x ! x ! : : : ! x in a relational 0 1 n structure precisely when it is accepted by the ﬁnite-state automaton with a trace such that at each step the condition D(c(s)), where s is the current state, is satisﬁed at the corresponding vertex x in the relational structure (or, to be correct, is satisﬁed by the pair (x; x)). 18 Brett McLean Lemma 6.2. Let t be a f;; +; *; 0; 1; Dg-term, and let T be a pointed labelled rooted tree, with root r and point p. Then the pair (r; p) in the relational structure T satisﬁes t 0 0 if and only if there is a T 2 JtK with T  T . Proof. This is just a specialisation of Lemma 5.3 (and the equivalence of the condition 0 0 T  T with the existence of a homomorphism from T into T ). Proposition 6.3. Let  be an alphabet and let L and L be two sets of reduced pointed 1 2 -labelled ﬁnite rooted trees. If L and L are regular, then L  L is regular. 1 2 1 2 Proof. Let L = Jt K and L = Jt K. Then by [15, Proposition 5], there is a domain 1 1 2 2 condition automatonA such that for any pointed labelled rooted tree T , with root r and point p, the pair (r; p) satisﬁes t if and only if the path from r to p is accepted by A . 1 1 Similarly, there is such a domain condition automaton A for t . By [15, Proposition 2 2 6], there is a domain condition automaton A that accepts a path if and only if that path is accepted by both A and A . Then using [15, Proposition 5] in the other direction, 1 2 applied to A, there is a f;; +; *; 0; 1; Dg-term t such that for any pointed labelled rooted tree T , with root r and point p, the pair (r; p) satisﬁes t if and only if it satisﬁes both t and t . Applying Lemma 6.2, we have (for reduced T ) that T 2 #JtK if and only if (r; p) satisﬁes t if and only if (r; p) satisﬁes both t and t if and only if T 2 #Jt K and 1 2 1 T 2 #Jt K if and only if T 2 #L \#L . Hence #JtK = #L \#L . So 2 1 2 1 2 JtK = maximal(#JtK) = maximal(#L \#L ) = L  L : 1 2 1 2 Let (O(R );[;\) be the lattice of downward-closed subsets of R . We now know that the sets of the form#L, for regular L, form a sublattice of (O(R );[;\). Given that (O(R );[;\) is a Heyting algebra, this raises the further question of whether the sets of the form #L are closed under the implication operation of (O(R );[;\). Problem 6.4. Are the regular sets of reduced trees closed under the following implication operation? L ! L B maximalf fK 2 O() j K \#L  #L gg 1 2 1 2 We conjecture that the answer to this problem is yes. We pose one additional problem, relating to extra-order-theoretic composition structure of the regular sets. Problem 6.5. Are the regular sets of reduced trees closed under the following residuation operations? L n L B maximalfT 2 R j 8S 2 #L ; S ; T 2 #L g 1 2  1 2 L / L B maximalfT 2 R j 8S 2 #L ; T ; S 2 #L g 1 2  2 1 Thanks go to one of the anonymous referees for posing this question. Free Kleene algebras with domain 19 7. Decidability of equational theory In this section we describe how to decide the validity of a f;; +; *; 0; 1; Dg-equation with respect to relational semantics. First, we give a deﬁnition of condition automata closer to that found in [15] and [14]. Recall (Deﬁnition 2.3) that A is a unary function symbol whose relational interpretation is the antidomain operation. Deﬁnition 7.1. A condition automaton is a 6-tuple (; S; I; T; ; c), where (; S; I; T; ) is a ﬁnite-state automaton (nondeterministic, with -transitions permitted), and c is a function that assigns a f;; +; *; 0; 1; Ag-term (over ) to each state S . Acceptance for condition automata is deﬁned just like acceptance for domain condition automata, where the symbol D is now shorthand for two applications of A. Theorem 7.2. The equational theory of the class of algebras of binary relations of the signature f;; +; *; 0; 1; Dg is decidable. Proof. Let s and t be f;; +; *; 0; 1; Dg-terms, and let  be the set of variables appearing in either s or t. Now s = t is valid in Rel(;; +; *; 0; 1; D) if and only if the pointed - labelled rooted trees satisfying s are precisely those satisfying t—we proved the stronger statement involving reduced trees. In the equivalence just stated, we can temporarily use the usual graph-theoretic deﬁnition of a pointed -labelled rooted tree; in particular we do not limit to ﬁnite trees. According to [15, Proposition 5], there are (domain) condition automata A and A that accept precisely the ﬁnite pointed trees satisfying s s t and t respectively. But in fact the ﬁniteness condition plays no role, and hence can be dropped. The same remark can be made for the following statements and we will make no further mention of it. By [15, Corollary 3], there are condition automata A and st A such that a pointed tree is accepted by A precisely if it is accepted by A but ts st s not byA , and a tree is accepted byA precisely if it is accepted byA but notA . By t ts t s [15, Proposition 5], there exist f;; +; *; 0; 1; Ag-terms  and  such that the pointed st ts trees satisfying  and  are precisely those accepted by A and A respectively. st ts st ts Hence s = t is valid in Rel(;; +; *; 0; 1; D) if and only if the sets of pointed -labelled rooted trees satisfying  and  are both empty. Finally, we reduce the problem of st ts deciding if a f;; +; *; 0; 1; Ag-term  is satisﬁable by a pointed labelled rooted tree to the problem of deciding the satisﬁability of a formula of propositional dynamic logic. This latter problem is known to be decidable (in EXPTIME [27]), so then we are done. See Figure 3 for a summary of the transformations we have outlined. See, for example, [8], for a description of propositional dynamic logic, including the notion of a regular frame. 20 Brett McLean A  '( ) st st st A  '( ) ts ts ts s A Figure 3. Transformations used to decide equality of t and s We deﬁne a translation from f;; +; *; 0; 1; Ag-terms to (propositional variable-free) formulas of propositional dynamic logic as follows. First we deﬁne the translation P from f;; +; *; 0; 1; Ag-terms to program terms by structural induction as follows. P(a) B a P(s ; t) B P(s) ; P(t) P(s + t) B P(s) + P(t) P(t ) B P(t) P(0) B ?? P(1) B >? P(A(t)) B (:P(t))? Then we simply deﬁne the translation '(t) of af;; +; *; 0; 1; Ag-term t to behP(t)i>. It is clear that for any given regular frame, satisﬁability of '(t) is equivalent to satisﬁability of t on the corresponding relational structure. Since propositional dynamic logic has the tree-model property (any frame with selected point can be ‘unwound’ to an equivalent labelled rooted tree), we obtain the equivalence of satisﬁability of '(t) on regular frames and satisﬁability of t on tree-based relational structures. But if t is satisﬁed by a pair (x; y) of vertices in a tree-based relational structure, then clearly y is a descendent of x, and t is satisﬁed by the tree rooted at x and having point y. (And conversely, satisfaction by a pointed rooted tree implies satisfaction by a tree-based relational structure.) Hence we have the required equivalence between satisfaction of t with respect to pointed labelled rooted trees and satisfaction of '(t) with respect to regular frames. The procedure described in the proof of Theorem 7.2 hardly seems ecient. The best upper bound that can be obtained from it is a 3EXPTIME bound. The constructions of A and A rely on determinisations involving a subset construction, so can result st ts in an exponential increase in problem size. Likewise, construction of the terms  and st from automata can also add an exponent in general. Lastly, we already mentioned ts that the ﬁnal step, deciding satisﬁability of propositional dynamic logic formulas, is in EXPTIME, and in fact this problem also has an exponential time lower bound (no O(2 ) algorithm for any " < 1 [8]). We ﬁnish with the obvious problem. Problem 7.3. Determine the precise complexity of deciding validity of f;; +; *; 0; 1; Dg- equations with respect to relational semantics. Free Kleene algebras with domain 21 A. Appendix Theorem A.1. The class Rel(;; +; *; 0; 1) is not closed under elementary equivalence. Proof. By the deﬁnition of * on relations, algebras in Rel(;; +; *; 0; 1) validate a = sup a (with respect to the ordering a  b () a + b = b). Take any relation R i2N whose star R di ers from all ﬁnite approximants sup R —for example take R to be i<n the immediate-successor relation in N. Let A be any algebra of relations containing R—for example the algebra generated by R. Let U be any non-principal ultraﬁlter on N, and let R be the element of the ultrapower A =U represented by the constant sequence (R; R; : : : ). Then (R) is represented by (R ; R ; : : : ), but this is not a supremum for i 2 fR j i 2 Ng since the strictly smaller element represented by (1; 1 + R; 1 + R + R ; : : : ) is also an upper bound. Hence the ultrapower does not validate a = sup a , so i2N Rel(;; +; *; 0; 1) is not closed under ultrapowers. It follows by Łos’ ´ s theorem [23] that Rel(;; +; *; 0; 1) cannot be closed under elementary equivalence. References [1] Michael Benedikt and Christoph Koch, XPath leashed, ACM Computing Surveys 41 (2009), no. 1, 3:1–3:54. [2] Stephen L. Bloom, Zoltán Ésik, and Gheorghe Stefanescu, Notes on equational theories of relations, Algebra Universalis 33 (1995), no. 1, 98–126. [3] Stanley Burris and Hanamantagouda P. Sankappanavar, A course in universal algebra, Graduate Texts in Mathematics, Springer, 2011. [4] Jules Desharnais, Bernhard Möller, and Georg Struth, Kleene algebra with domain, ACM Transactions on Computational Logic 7 (2006), no. 4, 798–833. [5] Jules Desharnais and Georg Struth, Domain axioms for a family of near-semirings, 12th International Conference on Algebraic Methodology and Software Technology (José Meseguer and Grigore Rosu, ¸ eds.), Lecture Notes in Computer Science, vol. 5140, Springer, 2008, pp. 330–345. [6] Jules Desharnais and Georg Struth, Internal axioms for domain semirings, Science of Computer Programming 76 (2011), no. 3, 181–203. [7] Samuel Eilenberg, Automata, languages, and machines, Academic Press, Orlando, Florida, USA, [8] Michael J. Fischer and Richard E. Ladner, Propositional dynamic logic of regular programs, Journal of Computer and System Sciences 18 (1979), no. 2, 194–211. [9] John Fountain, Free right type A semigroups, Glasgow Mathematical Journal 33 (1991), no. 2, 135–148. [10] John Fountain, Gracinda M. S. Gomes, and Victoria Gould, The free ample monoid, International Journal of Algebra and Computation 19 (2009), no. 04, 527–554. [11] Ferenc Gécseg and Magnus Steinby, Tree languages, Handbook of Formal Languages (G. Rozen- berg and A. Salomaa, eds.), vol. 3, Springer, 1997, pp. 1–68. [12] Mai Gehrke, Stone duality, topological algebra, and recognition, Journal of Pure and Applied Algebra 220 (2016), no. 7, 2711–2747. [13] Mai Gehrke, Serge Grigorie , and Jean-Éric Pin, Duality and equational theory of regular languages, International Colloquium on Automata, Languages, and Programming, Springer, 2008, pp. 246–257. [14] Jelle Hellings, Marc Gyssens, Yuqing Wu, Dirk Van Gucht, Jan Van den Bussche, Stijn Vansummeren, and George H. L. Fletcher, Comparing the expressiveness of downward fragments of the relation algebra with transitive closure on trees, Information Systems 89 (2020), 101467. 22 Brett McLean [15] Jelle Hellings, Marc Gyssens, Yuqing Wu, Dirk Van Gucht, Jan Van den Bussche, Stijn Vansummeren, and George H. L. Fletcher, Relative expressive power of downward fragments of navigational query languages on trees and chains, Proceedings of the 15th Symposium on Database Programming Languages, ACM, 2015, pp. 59–68. [16] Robin Hirsch and Ian Hodkinson, Relation algebras by games, Studies in Logic and the Foundations of Mathematics, vol. 147, North-Holland, 2002. [17] Robin Hirsch and Szabolcs Mikulás, Axiomatizability of representable domain algebras, The Journal of Logic and Algebraic Programming 80 (2011), no. 2, 75–91. [18] Marco Hollenberg, An equational axiomatization of dynamic negation and relational composition, Journal of Logic, Language, and Information 6 (1997), no. 4, 381–401. [19] Peter Jipsen and Georg Struth, The structure of the one-generated free domain semiring, Relations and Kleene Algebra in Computer Science (Berlin, Heidelberg) (Rudolf Berghammer, Bernhard Möller, and Georg Struth, eds.), Springer, 2008, pp. 234–242. [20] Dexter Kozen, A completeness theorem for Kleene algebras and the algebra of regular events, Information and Computation 110 (1994), no. 2, 366–390. [21] Dexter Kozen, Kleene algebra with tests, ACM Transactions on Programming Languages and Systems 19 (1997), no. 3, 427–443. [22] Leonid Libkin, Wim Martens, and Domagoj Vrgoc, ˇ Querying graph databases with XPath, Proceedings of the 16th International Conference on Database Theory, ACM, 2013, pp. 129–140. [23] Jerzy Łos, ´ Quelques remarques, théorèmes et problèmes sur les classes déﬁnissables d’algèbres, Mathematical Interpretation of Formal Systems (Thoralf Skolem, Gisbert Hasenjaeger, Georg Kreisel, Abraham Robinson, Hao Wang, Leon Henkin, and Jerzy Łos, ´ eds.), Studies in Logic and the Foundations of Mathematics, vol. 16, 1955, pp. 98–113 (French). [24] Sokhna Diarra Mbacke, Completeness for domain semirings and star-continuous Kleene algebras with domain, Master’s thesis, Université Laval, Québec, Canada, 2018. [25] Walter D. Munn, Free inverse semigroups, Proceedings of the London Mathematical Society 3 (1974), no. 3, 385–404. [26] Vaughan R. Pratt, Semantical considerations on Floyd–Hoare logic, 17th Annual Symposium on Foundations of Computer Science, IEEE, 1976, pp. 109–121. [27] Vaughan R. Pratt, A near-optimal method for reasoning about action, Journal of Computer and System Sciences 20 (1980), no. 2, 231–254. [28] Gordon B. Preston, Inverse semi-groups, Journal of the London Mathematical Society s1-29 (1954), no. 4, 396–403. [29] Volodymyr N. Redko, On the determinative aggregate of relationships of the algebra of regular events, Ukraïns’kyi Matematychnyi Zhurnal 16 (1964), no. 1, 120–126 (Russian). [30] Boris M. Schein, On the theory of generalized groups, Doklady Akademii Nauk SSSR 153 (1963), 296–299. [31] Boris M. Schein, Restrictively multiplicative algebras of transformations, Izvestiya Vysshikh Uchebnykh Zavedeni˘ ı. Matematika 95 (1970), no. 4, 91–102 (Russian). [32] Michael Sipser, Regular languages, Introduction to the Theory of Computation, Cengage Learning, Boston, Massachusetts, USA, third ed., 2012, pp. 31–100. [33] Alfred Tarski, On the calculus of relations, The Journal of Symbolic Logic 6 (1941), no. 3, 73–89. [34] Valentin S. Trokhimenko, Menger’s function systems, Izvestiya Vysshikh Uchebnykh Zavedeni˘ ı. Matematika (1973), 71–78 (Russian). [35] Viktor V. Wagner, Generalised groups, Proceedings of the USSR Academy of Sciences 84 (1952), 1119–1122 (Russian). Brett McLean, Laboratoire J. A. Dieudonné UMR CNRS 7351, Université Nice Sophia Antipolis, 06108 Nice Cedex 02 e-mail: brett.mclean@unice.fr

### Journal

MathematicsarXiv (Cornell University)

Published: Jul 24, 2019

### References

Access the full text.

Sign up today, get DeepDyve free for 14 days.