Forest Categories

by   Howard Straubing, et al.

We extend Tilson's theory of the algebra of finite categories, in particular, the Derived Category Theorem, to the setting of forest algebras. As an illustration of the usefulness of this method, we provide a new proof of a result of Place and Segoufin characterizing locally testable tree languages.



There are no comments yet.


page 1

page 2

page 3

page 4


On Well-Founded and Recursive Coalgebras

This paper studies fundamental questions concerning category-theoretic m...

Proving that a Tree Language is not First-Order Definable

We explore from an algebraic viewpoint the properties of the tree langua...

Exemplars can Reciprocate Principal Components

This paper presents a clustering algorithm that is an extension of the C...

Categories for Me, and You?

A non-self-contained gathering of notes on category theory, including th...

Characterizing the invariances of learning algorithms using category theory

Many learning algorithms have invariances: when their training data is t...

Completing Simple Valuations in K-categories

We prove that Keimel and Lawson's K-completion Kc of the simple valuatio...

Binary intersection formalized

We provide a reformulation and a formalization of the classical result b...
This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

Note added, January 2018: This paper was written in 2011, submitted to a conference, and rejected. I made no further effort to publish it, since although the extension of Tilson’s theory to the forest algebra setting is formally correct, I was never persuaded of the usefulness of the method, and not happy with the rather complicated application given here. Recently, Michael Hahn and Andreas Krebs dusted off this old work of mine and applied to a quite different problem, so I thought it was a good time to make it publicly available. I have made no improvements or modifications—aside from this note—in the past seven years. Like an old house that needs a lot of work, I offer the paper ‘as is’.

While it might not appear so at first, this paper is part of an ongoing research effort to understand the expressive power of various predicate and temporal logics on trees. Analogous problems for words, rather than trees, have been studied for well over forty years, and much of this research has relied on algebraic methods. Typically, the set of words that satisfies a formula in one of the logics under consideration is a regular language, and expressibility in the logic is reflected in properties of the syntactic monoid or the syntactic morphism of A large compendium of results in this vein (up to 1994) is presented in Straubing  [17] for various predicate logics. Additional results, mostly oriented around temporal logic are in Thérien and Wilke [18] and Wilke [20].

Recently this approach has been extended, with some success, to languages of trees, especially unranked trees. Here, the syntactic forest algebra, introduced by Bojanczyk and Walukiewicz [2] plays the role of the syntactic monoid. A number of papers have appeared that use this construct either explicitly (Bojanczyk, [6, 5, 4, 3]) or implicitly (Benedikt and Segoufin [1], Place and Segoufin [14]) to characterize the languages definable in certain tree logics. A related approach for trees of bounded rank is described in Esik and Weil [8, 9].

It was recognized early on in the development of the theory for words that wreath product decompositions play an important role . Thus McNaughton and Papert [10] turned to the Krohn-Rhodes decomposition for the characterization of properties definable in first-order logic, and Brzozowski and Simon [7] studied decompositions with an idempotent and commutative factor in their work on locally testable languages. A close reading of this latter work, along with related papers, led to a more general understanding of the role played by graph congruences in obtaining these decompositions, initially in Straubing [16] and Thérien and Weiss [18]. This reached its definitive form in Tilson’s work [19] on the algebra of finite categories. An up-to-date account appears in the book by Rhodes and Steinberg [15]. Categories have emerged as an important tool in the study of finite semigroups and the languages they accept, one that has found applications well beyond the problems that originally inspired it. (See, e.g., Pin, et. al.  [13, 12].)

It is now known that wreath products of forest algebras also figure importantly in the study of logics on trees. This is seen in the many examples studied in Bojanczyk, et. al. [6], which include first-order logic with the ancestor relation, and the temporal logics and It also underlies much of what is done in  [14]. So the time is ripe for developing new algebraic tools for producing such decompositions.

In the present paper we extend the algebra of finite categories from monoids to forest algebras. After reviewing the basics of forest algebras in Section 2, we give the definition of forest categories and of the derived category of a pair of morphisms. The tricky part here is in getting the definitions just right. Once that is done, it is a simple matter to establish an analogue to the Derived Category Theorem of Tilson [19], which connects categories to wreath products. In the sections that follow, we endeavor to show that this is more than just abstract nonsense. In Section 5 we establish efficient necessary and sufficient conditions for determining if a given forest category divides an idempotent and commutative forest algebra—an analogue to the result of Simon [7] that started it all. We then show how this underlies the very recent work on locally testable forest languages by Place and Segoufin [14]. It is this paper that provided much of the inspiration for the present work. However we cannot stress enough that what we propose here is more than just a new proof of the results in  [14], or, worse yet, the same proof couched in an obscure new language. Rather, we are introducing a new mathematical tool, which like its precursor for monoids, promises to have many more applications than the one we have chosen as a proof of concept. We discuss the prospects for these in the last section.

For the usual reasons of space, the three most detailed and technical proofs are omitted. However it should be noted that all three of these (the proofs of Theorems 1 and 5, and Lemma 7) closely follow arguments that already appear in the literature.

2 Forest Algebras

For more background on forest algebras, see Bojanczyk, et. al.  [2, 6]. A forest algebra is little more than a pair of monoids, where one of the monoids (the vertical monoid) acts on the underlying set of the other (the horizontal monoid). In this paper we depart from the tradition that has begun to be established in the articles that have appeared on forest algebras—and return to the much longer-established traditions of semigroup theory—by writing the action as a right action. We do this precisely because we are generalizing the algebra of finite categories, and we would be forced to reverse the normal left-to-right direction of arrows in categories in order to accommodate left actions in forest algebras.

Here is the precise definition: A forest algebra is a pair of monoids with some additional properties, which we will specify shortly. The operation in is written additively and the identity written 0. In this paper we will also suppose that

is commutative. This is not usually a requirement in discussions of forest algebras, and our theory of forest categories will probably work just fine without it, but it does simplify the presentation and will serve for our purposes. The operation in

is written multiplicatively, and its identity is denoted 1. acts on on the right, so that given there is an element of The properties that make this an action are (i) if and and (ii) for all We require this action to be faithful, which means that if for all then There is just one additional property in the definition: If and then there is an element of such that for all We usually write the more natural-looking instead of Observe that the map embeds the monoid into

A homomorphism of forest algebras is actually a pair of monoid homomorphisms with the additional property that for all We usually drop the subscript and write for both components. Notice that a homomorphism in this sense automatically preserves the operation, and thanks to our various notational conventions we very conveniently have for any We say a forest algebra divides a forest algebra and write if is a homomorphic image of a subalgebra of Given two forest algebras we define the wreath product

exactly as one defines the wreath product of transformation monoids: The action is given by

The monoid structure on is simply the direct product. The multiplication in the vertical monoid is defined by

where for all It is straightforward to show the wreath product is a forest algebra. The pair of maps projecting onto the right-hand coordinates is a forest algebra homomorphism

Let be a finite alphabet. We describe the free forest algebra as follows: consists of expressions built starting with 0 and closing under adjunction of a letter on the right and under An example of such an expression, with is

We will usually drop the 0’s that appear in such an expression, as well as the parentheses whenever the action axioms make these redundant, so we will write this more simply as

and depict it in the obvious fashion as a forest with two trees, both with at the root and with four leaves altogether, two labeled and two labeled Since we are assuming is commutative, we identify many different forests: For instance, the one above is identical to

consists of contexts: These are forests in which one of the leaves has been removed and replaced by a hole: For example

Contexts act on forests by substituting a forest for the hole in a context to form a forest Contexts are composed by substituting for the hole in to form a context As a result is indeed a forest algebra. What makes it the ‘free’ forest algebra is this universal property: If is a forest algebra, then any map extends to a unique forest algebra homomorphism such that for all

A subset of is called a forest language. A forest language is recognized by a forest algebra if there is a homomorphism such that for some A forest language is regular if it is recognized by a finite forest algebra—this is equivalent to recognition by a bottom-up deterministic automaton. For every regular forest language there is a unique minimal algebra recognizing in the sense that for every forest algebra recognizing is called the syntactic forest algebra of and the homomorphism that recognizes is called the syntactic morphism of Both the syntactic monoid and syntactic morphism are effectively computable from any automaton that recognizes

3 Forest Categories and Division

A forest category is a triple of sets with the following properties:

  1. is a finite set, called the set of objects of

  2. For all there is a set called the set of arrows from to such that is the disjoint union

    We denote an arrow from to as We write for the object and for the object

  3. For all there is a set called the set of half-arrows to such that is the disjoint union

    We denote a half-arrow to as and we write for

  4. is a commutative monoid whose operation is written and whose identity is written 0. As was the case with our treatment of forest algebras, commutativity is not really a requirement, but it makes the presentation somewhat simpler, and all the applications we discuss here will result in forest categories that are commutative in this sense.

  5. is also a commutative monoid, with operation similarly denoted and so that the map is a monoid homomorphism from onto We will often depict the half-arrow as

    but will always bear in mind that this is equivalent to a half-arrow

  6. For all there is a binary operation

    We denote this operation multiplicatively:

    or sometimes simply as

    This operation is associative in the following sense: for all

    Further, for each there exists such that for all

  7. For all there is a binary operation

    We denote this operation multiplicatively:

    or sometimes simply as

    This operation is an action in the following sense: for all

    Further, for all

    We require this action to be faithful in the sense that if

    for all then

  8. For each and each there exists

    such that for all

    and for all

    These axioms are more readable, and look more natural, if we write as and depict it as

Remarks on the Definition

  1. If we leave out everything having to do with half-arrows, this is simply the standard definition of a category with a finite set of objects.

  2. A category with a single object is a monoid. Similarly, in a forest category with only one object, the operations described in parts (f),(g),(h) of the definition are always defined, and their properties reduce to the axioms for a forest algebra. Thus a forest category with one object is a forest algebra.

  3. Suppose we have a multiset of arrows and half-arrows in a forest category We can compose these in any fashion that makes the endpoints match up correctly, and obtain a forest diagram, as illustrated in Figure 1. Such a diagram is simply a forest in which the leaf nodes are labeled by half-arrows and the internal nodes by arrows, with the constraint that the start object of each internal node must equal the sum of the end objects of its children.

    Figure 1: A Forest Diagram

    In the figure, the arrow labeled belongs to and the arrow labeled to We can view the diagram as a graphical representation of the expression

    There are other ways to parse the diagram, but thanks to the forest category axioms, all the resulting expressions have the same value in That is, any forest diagram over unambiguously determines an element of where is the sum of the rightmost objects in the diagram. If the underlying forest of such a diagram has just one component, we will call it a tree diagram.

    Similarly, if we eliminate one of the half-arrows from the diagram, leaving a single object exposed at a leaf, we obtain a diagram that unambiguously determines an element of We call such a diagram a context diagram, and denote the exposed object by In this setting, the action of an arrow on a half-arrow corresponds to the action of a forest on a context. We just have to make sure that the endpoints match up: that is, we can plug a forest diagram into a context diagram and obtain a forest diagram so long as In a like manner, the composition of two arrows corresponds to plugging one context diagram into another.


In the theory for monoids, the notion of a category dividing a monoid plays a crucial role. The idea is this: Suppose we want to evaluate the composition of a sequence of arrows

in a category We associate to each arrow an element of in such a manner that knowledge of the terminal objects and and of the product in is enough to determine the value in There is no problem in this scheme if several different elements of are associated to the same arrow, or the same element of to different arrows, so long as no element of is associated to two distinct arrows with the same endpoints (coterminal arrows).

For forest categories, the idea is much the same: We want to associate to each half-arrow and arrow of horizontal and vertical elements, respectively, of a forest algebra If we associate such a ‘covering element’ to every half-arrow and arrow of a forest diagram and evaluate the corresponding forest in then this value, together with is enough to determine and similarly for context diagrams.

Here is the formal definition: If is a forest category and a forest algebra, then we write and say divides if for each there exists a nonempty set and for each there exists a nonempty set satisfying the following properties:

  1. (Preservation of Operations) For all

  2. (Injectivity)

    1. If and are distinct arrows, then

    2. If and are distinct half-arrows, then

If is either an arrow or a half-arrow, then we say covers

4 The Derived Forest Category

Let be a finite alphabet, and consider a pair of forest algebra homomorphisms

mapping onto finite forest algebras It is a common practice, when dealing with monoids, to view this pair as defining a relational morphism and work directly with the relation (note that is in general multi-valued and therefore not a homomorphism in the usual sense), however we find it simpler to refer directly to the maps and

We define a category as follows:

  1. We set, for

    In other words, is the graph of the relation We will depict the half-arrow as

  2. To define we first introduce an equivalence relation on the set

    We define if for all with we have We then set to be the set of equivalence classes of We will still depict an arrow as

    where but with the understanding that the same arrow has many distinct representations in this form.

  3. Note that and are commutative monoids, and that the projection of a half-arrow onto its end object is a homomorphism, as required in the definition. We must now define the other operations in the category and show that they have the desired properties. We set

    Observe that so the right-hand side of the above equation is indeed the representation of an arrow. We still need to show that this is well-defined; in other words, that


    To this end, let and Then the two equivalences imply

    and, since

    so the two together give

    as required. Associativity follows at once from associativity in and the arrow is the identity at

  4. We define the action of an arrow on a half-arrow by

    Note that the right-hand side is indeed a half-arrow, since if and then and Furthermore, this operation is well-defined, since if then by definition. The associativity of the action follows directly from the associative law for the action in The definition of equivalent arrows also ensures that this action is faithful.

  5. We can set

    where is such that We have

    so the right-hand side of the definition represents an arrow, and it is trivial to verify that this is well-defined. The required algebraic properties follow directly from those for the insertion operation in

Our main result connects the derived category to the wreath product.

Theorem 1

(Derived Category Theorem)

Let be as above, and let be a finite forest algebra.

  1. If then

  2. Suppose factors as


    and that where is the projection homomorphism from the wreath product onto its right-hand factor. Then

The proof is largely a straightforward verification, but there are lot of things to verify, so we give the complete argument in the appendix.

5 Globally Idempotent and Commutative Forest Categories

Much of the work in applying categories to automata over words entails finding effective conditions for determining when a finite category divides a monoid belonging to some specified variety of finite monoids. The earliest such result (which, of course, predates Tilson’s introduction of category division, and provided much of the inspiration for the development of the subject), implicit in the work of Brzozowski and Simon [7] and McNaughton [11] on locally testable languages, establishes necessary and sufficient conditions for a finite category to divide a finite idempotent and commutative monoid.

Theorem 2

A finite category divides a finite idempotent and commutative monoid if and only if for every the monoid is idempotent and commutative.

Here we will study an analogous question for forest categories. Let be an idempotent and commutative monoid, with its operation written additively. of course, acts faithfully on itself, and the result is a forest algebra We call such a forest algebra a flat idempotent and commutative forest algebra, because when we evaluate the homomorphic image of a forest in the value does not depend on the tree structure at all, but only on the node labels. We say that a forest category is globally idempotent and commutative if it divides a flat idempotent and commutative forest algebra.

Let be either a forest diagram or a context diagram over a forest category Recall that each such diagram has a value in either (for forest diagrams) or (for context diagrams). We denote by the set of arrows and half-arrows occurring in the diagram.

Theorem 3

A forest category is globally idempotent and commutative if and only if the following condition holds: If and are forest diagrams over with and then

First suppose divides a flat idempotent and commutative forest algebra Let be a forest diagram, and let be the set of all half-arrows and arrows in Each is covered by some and it follows that is covered by Since is idempotent and commutative, this value is completely determined by Thus if then and are covered by the same element of Thus if as well, by the injectivity property of division. Now suppose satisfies the condition in the statement of the theorem. It follows from faithfulness that satisfies an analogous condition for context diagrams: If and are context diagrams over with and then Let be the monoid consisting of all subsets of with union as the operation. Suppose is an arrow or half-arrow of We say covers if there is a context diagram or forest diagram such that and It follows readily from the conditions on forest diagrams and context diagrams that this covering relation defines a division

As corollary to the proof we obtain:

Theorem 4

It is decidable if a given finite forest category is globally idempotent and commutative.

The proof of Theorem 3 shows that is globally idempotent and commutative if and only if it divides where is the monoid of subsets of This can be effectively checked, if necessary by enumerating every possible covering relation and checking if it is a division.

When one compares the decision procedure given in Theorem 4 for globally idempotent and commutative forest categories to the one in Theorem 2 for ordinary categories, the former appears ridiculously inadequate, and scarcely deserves to be called an ‘algorithm,’ while the latter much more reasonably entails verifying identities, where is the number of arrows in the category. Of course one would like something just as reasonable for forest categories. More precisely, we wish to have a small list of identities, each involving two diagrams with a small number of objects and arrows, such that one can transform one forest diagram into another with the same support and terminal objects by repeated application of the identities. It is possible to produce such a list by going carefully through the arguments in Place and Segoufin [14] on locally testable tree languages, and noting down precisely what axioms are required to produce the analogous result there. Here is one such list:

Theorem 5

Let be a finite forest category in which is idempotent and commutative. is globally idempotent and commutative if and only if

  1. (Loop removal.) Whenever and

  2. (Horizontal absorption) For all and

  3. (Horizontal idempotence.) For all

The rather involved proof, which naturally enough closely tracks the one given in  [14], is given in the appendix.

6 Application to Locally Testable Forest Languages

In the present section we show how the theory developed in this paper leads to a new treatment of the recent results in  [14] on locally testable tree languages. While our treatment comes wrapped in a great deal of new formalism, it has the advantage of very clearly separating the two main principles of the argument: The characterization of globally idempotent and commutative forest categories given in Theorems 4 and 5 above, and bounds on the index of definiteness given in Lemma 7 below. Each of these principles can be applied separately in other problems. While our exposition here concerns only what  [14] calls ‘Idempotent Local Testability’, we have little doubt that our methods can also shed light on the other formulations of local testability given there. We discuss these briefly in the final section.

Let be a finite alphabet and let Let We will define the -definite type of a node in by induction on All nodes have the same 0-definite type. If then the -definite type of a node is the pair where is the label of the node, and is the set of -definite types of its children.

Let We define if the set of -definite types of the roots of is equal to the set of -definite types of the roots of It is clear that this equivalence relation is compatible with addition in and that and implies So is a forest algebra congruence of finite index, and thus there is a quotient forest algebra We denote by the projection homomorphism from onto this quotient. Note that if then can be thought of as the set of -definite types of the root nodes of The congruence is an analogue for forest algebras to the congruence that identifies two words if they have the same suffix of length and the quotient algebra is an analogue to the free -definite semigroup. In fact, many such analogues are possible, depending on how one defines the horizontal component of the quotient algebra; here we are just treating the case where the horizontal component is idempotent and commutative.

Again, let and let We define if and the set of -types of nodes in is equal to the set of -types of nodes of Once again, this is a congruence of finite index on We say that is -locally testable if it is a union of -classes, and locally testable if it is -locally testable for some Thus, for example, membership in a 1-locally testable forest language depends only on the set of node labels for a forest, while a condition like ‘there is a node labeled with a child labeled but no node labeled with children labeled and ’ defines a 2-locally testable forest language.

As is the case with words, locally testable languages are recognized by a particular kind of wreath product. The proof of the theorem below is an immediate consequence of the characterization of wreath products in terms of sequential compositions (Theorem 3 of [6]), and the fact that the languages recognized by flat idempotent and commutative algebras are exactly those for which membership only depends on the set of node labels.

Theorem 6

is -locally testable if and only if it is recognized by a homomorphism

where is flat idempotent and commutative, and where is the projection homomorphism from the wreath product onto its right-hand factor,

The following lemma, a critical combinatorial fact in this study, is adapted from another argument in Place and Segoufin [14]. In many respects, it plays the role of the ‘Delay Theorem’ (Tilson [19]) in analogous work on languages of words.

Lemma 7

Let be a finite forest algebra, with idempotent and commutative, and let be a homomorphism. Let and let Then the following properties hold:

  1. If with then there exist such that and

  2. If with then there exist with and

The proof is given in the appendix.

For local testability, this implies the following:

Theorem 8

If is locally testable, then it is -locally testable.

By hypothesis, is -locally testable for some Let By Theorems 6 and 1, divides a flat idempotent and commutative forest algebra. This implies, by Theorem 5, that is idempotent and commutative, and consequently its homomorphic image is idempotent and commutative. Thus Lemma 7 applies. We will use this lemma to show that satisfies the three conditions in Theorem 5, and thus is -locally testable by Theorems 6. We have already observed that is idempotent and commutative, and this gives us horizontal idempotence of for all values of

To establish the horizontal absorption condition, let with We need to show, for all that —this is precisely what it means for the two half-arrows on the two sides of the horizontal absorption identity to be equal in the derived category. If we take and as in the Lemma, then since the horizontal absorption identity is assumed to hold in we have Since and we obtain as required. The loop removal condition is established in the same way, using the other part of Lemma 7.

Theorem 9

It is decidable whether a given regular forest language (given, say, by an automaton that recognizes it) is locally testable.

Theorems 8 and Theorem 4 give an easy proof of decidability: From the presentation of we can effectively calculate the syntactic forest algebra the syntactic morphism and from this the derived category where is as i