The Power-Set Construction for Tree Algebras

We study power-set operations on classes of trees and tree algebras. Our main result consists of a distributive law between the tree monad and the upwards-closed power-set monad, in the case where all trees are assumed to be linear. For non-linear ones, we prove that such a distributive law does not exist.


Introduction
The main approaches to formal language theory are based on automata, logic, and algebra.Each comes with their own strengths and weaknesses and thereby complements the other two.In the present article we focus on the algebraic approach, which is well-known for producing proofs that are often simpler than automaton-based ones, if not as elementary and at the cost of yielding worse complexity bounds.Algebraic methods are especially successful at deriving structural results about classes of languages.In particular, they are the method of choice when deriving characterisations of subclasses of regular languages.A prominent example of such a result is the Theorem of Schützenberger [Sch65] stating that a language is first-order definable if, and only if, its syntactic monoid is aperiodic.By now algebraic language theory is well-developed for a wide variety of settings and types of languages, including finite words, infinite words, and finite trees.
In recent years several groups have started to work on a category-theoretic unification of algebraic language theory [Boj,UACM17,Boj20,Blu20,Blu21].The motivations include both the wish to simplify the existing theories and the need to generalise them to new settings, like infinite trees or data words.Here, we are interested in the case of languages of infinite trees, where an algebraic language theory has so far been missing.We continue the technical development of the framework presented in [Blu20,Blu21] by integrating a power-set operation.(To be precise, we use the upwards-closed power set since our framework is based on ordered sets.)Such an operation has numerous uses in language theory: for instance, when introducing regular expressions, for determinisation, or when proving closure under projections.We will present two such applications in Sections 5 and 6 below.
There are several ways to formalise languages of infinite trees.Most of the choices involved do not make much of a difference, but we isolate one design choice that does: a framework built on linear trees is much better behaved than one using possibly non-linear ones.This continues a trend already established in [Blu21] indicating that non-linear trees are more complicated than linear ones.
The main technical result needed for an integration of the power-set operation is a theorem stating that this operation can be lifted to the category of algebras under consideration.In category-theoretical lingo this means we have to establish a distributive law between the power-set monad and the monad our algebras are based on.Note that there has been recent renewed interest in distributive laws also in other parts of category theory (see, e.g., [GPA21,ZM22]), but the focus there is on different settings and, in particular, different functors.
We start in Section 2 by presenting our category-theoretical framework for infinite trees.Furthermore, we define the power-set operation we will be investigating, and we recall the notion of a distributive law, which will be central to our work.Section 3 contains a general derivation of such laws for a certain kind of polynomial monad, including the monad for linear trees, and a proof that the same is not possible for non-linear trees.The heart of the article is Section 4 where we will derive a partial result for non-linear trees that sometimes can be used as a substitute for a full distributive law.Finally, Sections 5 and 6 contain two applications: the first one is a simplified proof of a recently published result on substitutions for tree languages; while the second one describes how regular expressions can be defined using power sets of non-linear trees.

Monads for trees
In algebraic language theory one uses tools from algebra to study sets K of labelled objects.In the monadic framework from [Blu20,Blu21] these take the form K ⊆ MΣ where Σ is some alphabet and M is a suitable monad mapping a given set X to a set MX of X-labelled objects of a certain kind.Here we are mostly interested in three such monads: (i) the monad R of rooted directed graphs; (ii) the monad T of linear trees; and (iii) the monad T × of possibly non-linear trees.One of our results is that the latter two behave quite differently.Fix a countably infinite set X of variables and let Ξ be the set of all finite subsets of X.As in [Blu21], we will be working in the category Pos Ξ , the category of Ξ-sorted partial orders with monotone maps as morphisms.Thus, the objects are families A = (A ξ ) ξ∈Ξ where each sort A ξ is equipped with a partial order, and the morphisms f : A → B are families f = (f ξ ) ξ∈Ξ of monotone maps f ξ : A ξ → B ξ .From this point on, we will use the terms 'set' and 'function' as a short-hand for 'ordered Ξ-sorted set' and 'order-preserving Ξ-sorted function'.For simplicity, we will frequently identify a sorted set A = (A ξ ) ξ∈Ξ with its disjoint union A = ξ∈Ξ A ξ .Using this point of view, a morphism f : A → B corresponds to a sort-preserving and order-preserving function between the corresponding unions.
Given a set A, we consider A-labelled, rooted, directed graphs which are (possibly infinite) directed graphs with a distinguished vertex called the root such that every vertex is reachable by some directed path from the root.The edges of such graphs are labelled by elements of X and the vertices by elements of A in such a way that a vertex with label a ∈ A ξ has exactly one outgoing edge for each variable x ∈ ξ and this edge is labelled by x.If there is an edge from v to u with label x, we call u the x-successor of v.We denote the set of vertices of a graph g by dom(g).Usually, we identify a graph g with the function g : dom(g) → A mapping vertices of g to their labels.We can regard dom(g) as a set in Pos Ξ by equipping it with the trivial order and by assigning sort ξ to a vertex v if ξ is the set of labels of the edges leaving v. Then g : dom(g) → A is sort-preserving and order-preserving.• each variable x ∈ ξ occurs at least once in g, and • the root of g is not labelled by a variable.
The ordering on R ξ A is defined componentwise: g ≤ h : iff dom(g) = dom(h) and g(v) ≤ h(v) , for all v ∈ dom(g) .
(We assume that the ordering on ξ is just the identity.)We set If f : A → B is a function, then Rf : RA → RB is the function that applies f to each label of the given graph (leaving the labels not in A unchanged).(b) The flattening function flat : RRA → RA maps an (RA + ξ)-labelled digraph g to the (A + ξ)-labelled digraph flat(g) that is obtained (see Figure 1) from the disjoint union of all digraphs g(v), for v ∈ dom(g), by • deleting from each component g(v) every vertex labelled by a variable x ∈ X and • replacing every edge of g(v) leading to such a vertex by an edge to the root of g(u x ), where u x is the x-successor of v in g.
The singleton function sing : A → RA maps an element a ∈ A ξ to the digraph g consisting of a root labelled by a and |ξ| successors labelled by the variables in ξ.
(c) For g ∈ RA, we denote by dom 0 (g) the set of all vertices v ∈ dom(g) that are labelled by an element in A.

⌟
It is straightforward to check that R forms a monad.(Each of the three equations can be proved by exhibiting a label-preserving bijection between the respective domains.)Proposition 2.2.⟨R, flat, sing⟩ forms a monad on Pos Ξ .
The functors T and T × can now be derived from R.

9:4
Definition 2.3.(a) For a set A, we denote by T × A ⊆ RA the subset of all rooted graphs that are trees, and by TA ⊆ T × A the subset consisting of all trees where every variable x appears exactly once.We call the elements of TA linear trees over A and those of T × A non-linear trees.
For finite trees in T × A, we will frequently use the usual term notation like a(x, b(y, x)) , for a, b ∈ A , x, y ∈ X .
(b) We denote the functions TTA → TA and A → TA induced by, respectively, flat : RRA → RA and sing : A → RA also by flat and sing.In cases where we want to distinguish between these versions, we add the functor as a superscript: flat R , flat T , etc.
(c) We denote the category of all R-algebras by Alg(R), and similarly for the other monads. ⌟ The variants of flat and sing for the functor T × will be defined in a later section as T × does not form a submonad of R. (The family of sets T × A is not closed under flat.) The fact that T is a monad now follows directly from the fact that it is a restriction of R. To see this, we need the notion of a morphism of monads.
(a) A natural transformation ϱ : In this case we say that M is a reduct of N.
(b) Let ϱ : M ⇒ N be a morphism of monads and A = ⟨A, π⟩ an N-algebra.The ϱ-reduct of A is the M-algebra A| ϱ := ⟨A, π • ϱ⟩.If ϱ is understood, we also speak of the M-reduct of A. ⌟ The following lemma is frequently useful to prove that a functor forms a monad.The proof is straightforward.
Lemma 2.5.Let M and N be functors, µ : MM ⇒ M, ν : NN ⇒ N, ε : Id ⇒ M, η : Id ⇒ N natural transformations, and let ϱ : M ⇒ N be a natural transformation satisfying (a) Suppose that ϱ is a monomorphism.If ⟨N, ν, η⟩ is a monad, then so is ⟨M, µ, ε⟩ and ϱ : M ⇒ N is a morphism of monads.(b) Suppose that ϱ is an epimorphism and that M preserves epimorphisms.If ⟨M, µ, ε⟩ is a monad, then so is ⟨N, ν, η⟩ and ϱ : M ⇒ N is a morphism of monads.
Since our algebras are ordered it is natural to add meets (and joins) as operations.We start by defining a monad just for meets and then add it to our algebras via a standard construction based on so-called distributive laws.In this and the next section we only consider the monads R and T. The more complicated case of T × will be dealt with separately in Section 4 below.Definition 2.7.Let A ∈ Pos Ξ .
(a) For X ⊆ A, we write and ⇓X := { a ∈ A | a ≤ x for some x ∈ X } .
For single elements x ∈ A, we omit the braces and simply write ⇑x and ⇓x.
(b) The (upward) power set UA of A is the ordered set with domains and ordering (c) The (downward) power set DA of A is the ordered set with domains and ordering In the following we will state and prove most results only for the functor U.The case of D can be handled in exactly the same way.First, let us note that it is straightforward to check that U forms a monad on Pos Ξ .
Proposition 2.8.The functor U : Pos Ξ → Pos Ξ forms a monad where the multiplication union : UUA → UA : X → X is given by taking the union and the singleton function pt : A → UA : a → ⇑{a} is given by the principal filter operation.
Example 2.9.The algebras for the monad U are exactly those of the form ⟨A, inf⟩ where A is a completely ordered set.A function f : A → B preserves arbitrary meets if, and only if, it is a morphism ⟨A, inf⟩ → ⟨B, inf⟩ of the corresponding U-algebras.The same holds for D and suprema.⌟ To show that U lifts to a monad on Alg(R), we use a standard technique based on distributive laws [Bec69].Let us recall the basic definitions and results.
(a) We say that a monad ⟨ N, ν, η⟩ is a lift of N to the category of M-algebras if (b) The Kleisli category Free(N) of N is the full subcategory of Alg(N) induced by all free N-algebras.The free functor F N : C → Free(N) maps an object C ∈ C to the free N-algebra generated by C, that is, (c) An extension of M to Free(N) is a monad ⟨ M, μ, ε⟩ on Free(N) satisfying . Let ⟨M, µ, ε⟩ and ⟨N, ν, η⟩ be monads.There exist bijections between the following objects: (1) distributive laws δ : MN ⇒ NM; (2) liftings N of N to the category of M-algebras; (3) extensions M of M to the Kleisli category Free(N); (4) functions κ such that (m1) ⟨NM, κ, η • ε⟩ is a monad, (m2) the functions Nε and η induce morphisms of monads N ⇒ NM and M ⇒ NM, (m3) κ satisfies the middle unit law: κ • N(ε • η) = id .

Polynomial functors
It is not hard to manually find a distributive law between U and the monads R and T, but it is not that much more difficult to prove a much more general result.The monads used in language theory, including R, T, and T × , construct sets of labelled objects.The following definition captures the general form of such a monad.
where the sum ranges over all countable unlabelled graphs, i.e., the set R1.The same holds for the other two functors.
(b) As one can see from the above expression, our notation for domains is not entirely consistent.What we call dom(s) for elements of a polynomial functor, is called dom 0 (g) for graphs g ∈ RA. ⌟ As observed in [SN] we can describe natural transformations between polynomial functors in the following way.
Lemma 3.3.Let FX = i∈I X D i and GX = j∈J X E j be polynomial functors.There exists a one-to-one correspondence between natural transformations This correspondence is given by the equation The above equations induce a function mapping α ′ , α ′′ i to α.This function is clearly injective.Hence, it remains to show surjectivity.Let α : F ⇒ G be a natural transformation.We start by recovering the function α ′ : I → J. Let 1 be a set with exactly 1 element * ξ of each sort ξ.Then 1 D i = 1 E j is a 1-element set.Hence, there are bijections between F1 and I and between G1 and J.In particular, the component α 1 : F1 → G1 of α induces a function α ′ : I → J. Given some set A, let u : A → 1 be the unique function.For ⟨i, s⟩ ∈ FA it follows that where ξ is the sort of ⟨i, s⟩.This implies that

It thus remains to construct the functions α ′′
We set as desired.
We will need the following notation for relations between elements of polynomial functors.Definition 3.4.Let F : Pos Ξ → Pos Ξ be a functor, A, B sets, and p : If s ≃ sh t, we say that s and t have the same shape.⌟ Remark 3.5.(a) For a polynomial functor FX = i∈I X D i and s ∈ FA, t ∈ FB, we have (This implies that s and t have the same sort, namely that of i.) Then (b) In particular, two graphs g, h ∈ RA have the same shape if they have the same underlying graph, the same sort, and the same labelling with variables.Only the labelling with elements of A may differ.⌟ The goal of this section is to derive a distributive law between certain polynomial functors and the monad U. Our proof closely follows similar work from [Jac04, GPA21, BKS].The differences are mainly technical and immaterial.The only part of the following that can be considered original seems to be • the notion of linearity in Definition 3.14, • Theorem 3.22, which states that the distributive law we present is unique, and • Theorem 3.23, which states that there is no distributive law for non-linear monads.
Our existence proof is based on the characterisation in terms of extensions to the Kleisli category.We start by developing a few tools to construct such extensions.The first observation is that we can reduce the number of conditions we have to check.
Lemma 3.6.Let ⟨M, µ, ε⟩ and ⟨N, ν, η⟩ be monads on C and let M : Free(N) → Free(N) be a functor satisfying Proof.Our assumptions immediately imply that are natural transformations.Hence, we only have to check the monad laws for ⟨ M, F N µ, F N ε⟩.
Note that the action of M on objects is already completely determined by the requirement that M • F N = F N • M. Hence, we only have to find a suitable definition of M on morphisms φ : NA → NB.For the functor N = U, we adapt a construction from [Jac04, Gar20, GPA21] based on the category of relations.Note that every morphism φ : UA → UB of U-algebras is uniquely determined by its restriction f : A → UB to A. The key idea is to use the following encoding of such functions.(b) A span is a pair of morphisms A ← p R → q B with the same domain.We call a span and we call it closed if, for all a ∈ A, b ∈ B, and c ∈ R, and the representation of f is the span A ← G(f ) → B consisting of the two projections.⌟ Lemma 3.8.The correspondence between a function A → UB and its representation forms a bijection between (i) the set of all functions A → UB in Pos Ξ and (ii) the set of all spans A ← R → B that are injective and closed.
Proof.Let f : A → UB be a function with representation A ← p G(f ) → q B. This span is injective as every pair is uniquely determined by the values of its two components.To see that it is also closed, suppose that b ≥ q(c), for some b ∈ B and c ∈ G(f ).By definition of G(f ), we have Conversely, consider an injective, closed span A ← p R → q B and let f : A → P(B) be the function it represents.We have to show that f is monotone and that f (a) is upwards closed, for each a ∈ A. For monotonicity, let a ≤ a ′ and b ′ ∈ f (a ′ ).We have to show that b ′ ∈ f (a).By definition of f , there is some c ∈ R with p(c) = a ′ and q(c) = b ′ .Then a ≤ p(c) implies that there is some Then we can find some element c ∈ R with p(c) = a and q(c) = b ′ .Hence, b ≥ q(c) and closedness implies that we can find some element To conclude the proof, we have to show that these two operations are inverse to each other.Given a function f : A → UB, let g be the function represented by Conversely, consider an injective, closed span A ← p R → q B, let f : A → UB be the function it represents, and let A ← u G(f ) → v B be the representation of f .Then Since the span A ← p R → q B is injective, it follows that the function ⟨p, q⟩ : R → G(f ) is a bijection that commutes with the two projections.Thus, the two spans We can compose spans by performing a pullback.Lemma 3.9.Let f : A → UB and g : B → UC be represented by, respectively, Proof.Note that the pullback in Pos Ξ is given by and k and l are the respective projections.For a ∈ A, we therefore have It remains to prove that polynomial functors satisfy the conditions in Lemma 3.6.We start by taking a look at how such a functor operates on spans.
(a) M preserves injective and closed spans.
Proof.(a) Let A ← p R → q B be injective and closed and let MA ← Mp MR → Mq MB be its image under M.
For injectivity, consider elements s, t ∈ MR.Then For closedness, suppose that s ≥ Mq(t).Then s(v) ≥ q(t(v)) , for all v .

Hence, we can fix elements c
Similarly, suppose that s ≤ Mp(t).Then s(v) ≤ p(t(v)), for all v. Hence, we can fix elements and p and q are the respective projections.Similarly, the pullback of MA → Mf MC ← Mg MB is Consequently, the map ⟨Mp, Mq⟩ : M(A × B) → MA × MB induces a bijection between MP and Q.
Proof.We have shown in Lemma 3.10 that polynomial functors preserve injective closed spans.For s ∈ MA, it therefore follows that We obtain the following proof that every polynomial functor M on Pos Ξ has an extension to Free(U).
Proposition 3.12.Every polynomial functor M on Pos Ξ induces a functor M on Free(U) satisfying where A ← p R → q B is the span representing the morphism φ • pt.
Proof.As we have already explained above, for objects we are forced to set M⟨UA, union⟩ := ⟨UMA, union⟩ .
For a morphism φ : ⟨UA, union⟩ → ⟨UB, union⟩ of free U-algebras we define Mφ as follows.Let A ← p G(φ) → q B be the representation of φ • pt : A → UB, and let φ : MA → UMB be the function represented by the span MA ← Mp MG(φ) → Mq MB.Then we set We claim that this defines the desired functor M.
First, let us prove that M is a functor Free(U) → Free(U).Clearly, M maps free Ualgebras to free U-algebras.Furthermore, by the above definition Mφ is the free extension of φ : MA → UMB to a morphism UMA → UMB of U-algebras.Hence, we only have to show that Let MB ← Mp MG(φ) → Mq MC and MA ← Mu MG(ψ) → Mv MB be the representations of φ and ψ.By Lemma 3.9, the morphism Furthermore, it follows by Lemma 3.9 that As M(φ • ψ) and Mφ • Mψ are morphisms of U-algebras, which are determined by their restriction to the range of pt, it follows that To conclude the proof, it remains to show that M • F U = F U • M. For objects A ∈ Pos Ξ , this is obvious from the definition.Hence, consider a function f : A → B and set φ := Uf .Let A ← p G(Uf ) → q B be the span representing Uf .Then φ : MA → UMB is represented by MA ← Mp MG(Uf ) → Mq MB.By Lemma 3.11, it follows that To find the desired distributive law for polynomial monads, it remains to prove the two remaining conditions of Lemma 3.6.To do so, we have to make additional assumptions on our monad: we require that the multiplication MM ⇒ M does not duplicate labels.We will call such monads linear.Before we can give the formal definition, we need to take a look at the special form the multiplication morphism for a polynomial functor takes.
Remark 3.13.Let ⟨M, µ, ε⟩ be a monad with a polynomial functor MX = i∈I X D i .Note that the composition M • M is also a polynomial functor.A straightforward computation yields MMX = i∈I g:D i →I X v∈D i dom(g(v)) .
Thus MMX = j∈J X E j where Note that the identity functor Id is polynomial, since where 1 ξ is a set with a single element, which has sort ξ.Therefore, we can apply Lemma 3.3 to the natural transformations µ : MM ⇒ M and ε : Id ⇒ M and we obtain induced maps With our conventions regarding polynomial functors, we can write the latter as dom(s(v)) , for s ∈ MMA .⌟ Definition 3.14.Let ⟨M, µ, ε⟩ be a monad where M is polynomial and let µ ′ , µ ′′ j , ε ′ , and ε ′′ j be the functions corresponding to the natural transformations µ : MM ⇒ M and ε : Id ⇒ M as above.We call ⟨M, µ, ε⟩ linear if, for all indices j, the maps µ ′′ j are injective and the maps ε ′′ j are bijective.⌟ Example 3.15.The monads R and T are linear since each vertex of flat(g) corresponds to exactly one vertex of exactly one component g(v).The monad T × (defined below) on the other hand is not linear, since its multiplication duplicates labels: substituting b(z) for x in a(x, x) creates two copies of b. ⌟ Remark 3.16.Concerning terminology, the notion of a linear monad is not a priori related to that of a linear tree.But note that a submonad T 0 of T × is linear in the above sense if, and only if, it is a submonad of T. ⌟ For linear monads, we can now establish the missing identities.We start with a technical lemma.
(b) Choose s ′ ∈ MMA such that s ′ ≃ sh t, s ′ (v) ≃ sh t(v), for all v, and otherwise .
Lemma 3.18.Let ⟨M, µ, ε⟩ be a linear monad on Pos Ξ , M its extension to Free(U) from Proposition 3.12, and let φ : UA → UB be a morphism of free U-algebras.
To conclude the proof, note that where we have used implicit universal quantification over u and v and where the eight step follows by Lemma 3.17 (b) and the nineth step by the above claim.
Theorem 3.19.Let M be a linear monad on Pos Ξ .The functions dist A : MUA → UMA defined by Proof.By (the proof of) Theorem 2.12, we can obtain the desired distributive law from an extension M of M to Free(U) by setting where V : Free(U) → Pos Ξ is the forgetful functor.Note that the span representing the identity id : Corollary 3.20.The functions dist from above form distributive laws TU ⇒ UT and RU ⇒ UR.
Remark 3.21.The distributive law dist above was first stated in [Jac04] for functors (not monads) on Set preserving weak pullbacks.Our proof follows basically the same lines, except that we cannot use the algebra of relations for Pos, so we have to resort to direct calculations in several places.See also [GPA21,BKS] for similar arguments.⌟ We can strengthen this theorem in two ways: (i) the distributive law dist is unique and (ii) there is no distributive law for non-linear monads.We start with the former.
Theorem 3.22.Let M be a polynomial monad on Pos Ξ and δ : MU ⇒ UM a distributive law.Then δ = dist.
Proof.(⊇) Since δ is monotone, we have (⊆) Suppose that s ∈ δ(t) for t ∈ MUA.To prove that s ∈ dist(t) it is sufficient to show that s(v) ∈ t(v), for all v. Hence, fix v ∈ dom(t) and let θ : A → [2] be the map with As a consequence, we obtain the following strengthening of Theorem 3.19.
(⇒) Suppose that M is not linear and let µ ′ , µ ′′ j , ε ′ , and ε ′′ j be the functions corresponding to the natural transformations µ : MM ⇒ M and ε : Id ⇒ M as in the definition of linearity.By Theorem 3.22, it is sufficient to show that dist is not a distributive law.For a contradiction, suppose otherwise.
By assumption, there is some index j such that µ ′′ j is not injective or ε ′′ j not bijective.First, assume that µ ′′ j : D µ ′ (j) → E j is not injective, for some index j.Then there are two positions u, v ∈ D µ ′ (j) with µ ′′ j (u) = µ ′′ j (v).Set w := µ ′′ j (u), Let A be a set with at least two elements a and b of the same sort as these positions (and trivial ordering), and let s ∈ MMUMA be such that dom(s) = E j , s(w) := {ε(a), ε(b)} and s(x) = {ε(c x )} , for all x ̸ = w .
Thus π(µ(s)) ̸ = π(Mπ(s)).A contradiction.It remains to consider the case where ε ′′ j is not bijective, for some j.Then there is some sort ξ such that, for every element a of sort ξ, the domain D := dom(ε(a)) is either empty or of size at least 2. Let A := {a, b} be a set with two elements of sort ξ and the trivial ordering.If D is empty, we set s := ε(a) and t := ε(b).Then Consequently, D must have at least two elements and ε(a) : D → {a} is the constant function with value a.Note that A ∈ UA and As |D| > 1, there exist non-constant functions D → {a, b}.This implies that dist • ε ̸ = Uε, a violation of one of the axioms of a distributive law.
Remark 3.24.(a) We did not make essential use of the fact that we are working with ordered sets.All results of this section also hold in the category Set Ξ .
(b) In the literature one can find many cases where there is no distributive law between some variant of the power-set monad and some other monad.In particular, there is no such law between the power-set monad and itself.As a workaround there has been a lot of recent work (see, e.g., [Gar20,GPA21]) on so-called weak distributive laws which satisfy the axioms for a distributive law, except possibly for δ • ε = Nε.A closer look at the proofs above reveals that our results also hold for weak distributive laws if we replace linearity with the weaker condition that only the functions µ ′′ j are injective.If we call such a monad weakly linear it follows in particular that there is a weak distributive law δ : MU ⇒ UM if, and only if, M is weakly linear.
(c) In light of the above theorem, it is unsurprising that all known distributive laws for variants of the power-set monad require some form of linearity, although it is frequently expressed in terms of which equations the free algebra satisfies, instead of using properties of the monad multiplication.
For instance, there is a distributive law [MM07] in Set between so-call 'commutative monads' (like the power-set monad) and finitary term monads (which are linear in our sense).Similarly, there is a distributive law [MM08] between certain monads and quotients of finitary term monads by linear equations (i.e., term equations where every variable appears exactly once on each side).
In [ZM22] a variety of non-existence results for distributive laws between quotients of finitary term monads is proved.In many of the cases, one of the assumptions is that there is some term s satisfying the equation s(x, . . ., x) = x (which is non-linear).
It seems that much of the existing theory could be unified if the results of this section (which also apply to monads that are non-finitary) could be generalised from linear polynomial monads to suitable 'linear' quotients of such monads.⌟

Non-linear trees
It is time to properly define our third monad, that of non-linear trees, and to prove its limited compatibility with the power-set monad.Unfortunately, this turns out to be much more complex than the case of linear trees.In fact, as we have seen in Theorem 3.23, there does not exist a distributive law between T × and U. We will therefore forego distributive laws and directly prove the existence of a lift of U to the class of free T × -algebras, a partial result that is sufficient for many applications.We start by defining the monad structure of T × .
Definition 4.1.(a) We denote the unravelling (in the usual graph-theoretic sense) of a graph g ∈ R ξ A by un 0 (g) ∈ R ξ A. That is, un 0 (g) is the graph whose vertices consist of all finite paths of g that start at the root and there is an edge between two such paths if the second one is the corresponding prolongation of the first one.Lemma 4.2.⟨T × , flat × , sing × ⟩ is a monad.
In contrast to T, the monad T × is not a submonad of R. Instead it is a quotient.
Proof.We have to check that sing × = un 0 • sing and flat The first equation immediately follows form the fact that un 0 (sing(a)) = sing(a).For the second one, note that the vertices of un 0 (flat(g)) correspond to the finite paths of flat(g), while those of un 0 (flat(un 0 (Run 0 (g)))) correspond to those of flat(un 0 (Run 0 (g))).Furthermore, every path α in a graph of the form flat(h) corresponds to a path (v n ) n of h and a family of paths β n of h(v n ) such that α can be identified with the concatenation β 0 β 1 . . . .Finally, a path in un 0 (h) is the same as a path in h.Consequently, each path of flat(un 0 (Run 0 (g))) corresponds to (i) a path of g together with (ii) a family of paths in some components g(v) as above.This correspondence induces a bijection between dom(un 0 (flat(g))) and dom(un 0 (flat(un 0 (Run 0 )))) .
The fact that there is no distributive law for T × follows directly from Theorem 3.23 since T × is not linear.This means that our main goal is unreachable.But having a distributive law between T × and U would be very useful.For instance, it is needed when introducing regular expressions for infinite trees.Therefore we will try to find a useable workaround, something weaker than an actual distributive law that nevertheless covers the applications we have in mind.The rest of this section is meant to get an overview over our options in this regard, and to probe the dividing line between the possible and the impossible.
Remark 4.4.We have already mentioned above that, for cases where there is no distributive law, there is the notion of a weak distributive law which often can be used instead.Unfortunately, this does not work in our case since the problem above is the monad multiplication, not the unit.(T × is not even weakly linear.)⌟ 4.1.Infinite sorts.We start with some technical remarks considering sorts.Below we will need to deal with trees with infinitely many different variables, that is, we have to work in the category Pos P(X) instead of Pos Ξ .It is straightforward to extend the monads R, T, and T × to this more general setting.Hence, let us consider the following situation: we are given two sets ∆ ⊆ Γ of sorts and a monad M on Pos Γ .The following technical tools allow us to translate between the associated categories Pos ∆ and Pos Γ .
(a) The extension of A = (A ξ ) ξ∈∆ ∈ Pos ∆ to Pos Γ is the set A ↑ ∈ Pos Γ defined by Similarly, for a function f : A → B in Pos Γ , we denote by f | ∆ : A| ∆ → B| ∆ the restriction to ∆.Finally, for an M-algebra A = ⟨A, π⟩, we set where i : (A| ∆ ) ↑ → A is the inclusion map.
(b) Note that the product has the correct type since For the axioms of an M| ∆ -algebra, we have In the remainder of this section, we work in the category Pos Ξ + where Ξ + := P(ω).The functors R, T, and T × have canonical extensions to this category, which we will denote by the same letters to keep notation readable.4.2.The action on the variables.The problem with finding a distributive law for T × is that this monad is not linear.Its multiplication contains an unravelling operation un 0 which is used to duplicate arguments for variables appearing multiple times.To continue we need a variant of this operation that also modifies the variables of the given graph.where t is the tree obtained from the unravelling un 0 (g) by renaming the variables so that each of them appears exactly once (note that this changes the sort) and σ is the function such that σ t = un 0 (g).(To make this well-defined, we can fix a standard well-ordering on the domain, say, the length-lexicographic one, and we number the variables in increasing order with respect to this ordering, i.e., if v 0 < llex v 1 < llex . . . is an enumeration of all vertices labelled by a variable, we set t(v i ) := x i , where x 0 , x 1 , . . . is some fixed sequence of variables.)(c) We denote by T • A the set of trees t ∈ T × A such that un(t) = ⟨id, t⟩.Let ι : T • ⇒ T × be the inclusion.(In actual calculations we will frequently omit ι to keep the notation simple.)⌟ Remark 4.9.Note that the operation un can introduce infinitely many different variables.This is the reason why we have to work in Pos Ξ + .⌟ Example 4.10.un(a(x, y, x)) = ⟨σ, a(x 0 , x 1 , x 2 )⟩ where the function σ maps x 0 , x 1 , x 2 to x, y, x.Then σ a(x 0 , x 1 , x 2 ) = a(x, y, z).⌟ To make sense of the type of the above operations, we introduce the following monad where every element is annotated by some function renaming the variables.Definition 4.11.(a) We define a functor X : Pos + → Pos Ξ + as follows.For A ∈ Pos Ξ + , we set We define the order on X ξ A by ⟨σ, a⟩ ≤ ⟨τ, b⟩ : iff σ = τ and a ≤ b .The set T × A carries a canonical structure of a X-algebra.
We denote its restriction to XT • by re 0 := re • Xι : The unravelling operation on trees can now be formalised using the following two natural transformations.
Proof.The fact that ι is a morphism of monads is straightforward.To see that un is natural, it is sufficient to note that un for every function f : A → B. For re, we have Since re 0 = re • Xι, this implies that re 0 is natural as well.
(b) Suppose that un(t) = ⟨σ, s⟩ and un( τ t) = ⟨ρ, r⟩.Then (g) By (c), we have We can understand point (a) of this lemma as saying that T × is a retract of XT • , but only as functors, not necessarily as monads.For the latter we first have to establish that XT • forms a monad and that the operations un and re 0 are morphisms of monads.
As re 0 is a surjective natural transformation, most of the claim therefore follows by Lemma 2.5.It only remains to check that un is also a morphism of monads.For this, note that by Lemma 4.14 (c), (a), and (e) we have in (c) As un and ι are morphisms of monads, so is un • ι = in.Corollary 4.16.T × ∼ = XT • (as monads) One could hope to construct a distributive law T • X ⇒ XT • by applying the Theorem of Beck (Theorem 2.12) to the monad structure on XT • .This does not work for the following reason.
Lemma 4.17.The natural transformation Xsing : X ⇒ XT • is not a morphism of monads.
Proof.The following of the two axioms fails: Clearly, the operations re and un defined above for trees t ∈ T × A induce an unravelling structure on T × A. But note that this is not the case for RA since we have re(un(g)) ̸ = g, for every g ∈ RA that is not a tree.
Example 4.19.For each T × -algebra A = ⟨A, π⟩, we can equip the universe A with the trivial unravelling structure where un := in and σ a := π( σ sing(a)) .⌟ Remark 4.20.Note that the monad multiplication flat × is not a morphism of unravelling structures since un In what follows we will therefore not work in the category of unravelling structures and their morphisms.Instead we will work in the weaker category of unravelling structures with arbitrary monotone maps as morphisms.⌟ As a technical tool, we use the following generalisation of the unravelling relation for graphs where we do not only unravel the graph itself but also each label.The intuition is as follows.Suppose we are given a relation θ ⊆ A × B and a graph h ∈ RB.We construct an (unravelled) graph g ∈ RA as follows.Starting at the root v, we pick some element c θ h(v), and label g(v) by the unravelling of c.Then we recursively choose labellings for the successors.Note that the shapes of g and h are different since we are unravelling g, so the labels in h might have a higher arity than the corresponding ones in g.Consequently, we simultaneously construct a graph homomorphism φ : g → h to keep track of which vertices of g correspond to which ones of h.
To simplify the definition, we will split the construction into two stages.In the first step we apply the unravelling operation to every label of h, resulting in a graph Run(h) ∈ RXB.What is then left for the second step is the following relation, which does the choosing of the label and the unravelling of the tree.What makes this operation complicated is the fact that the unravelling depends on the chosen label, while the label may depend on which copy (produced by previous unravelling steps) of a vertex we are at.So we cannot separate the second stage into two independent phases.• ⟨φ /v , s(v)⟩ θ t(φ(v)) , for every v ∈ dom 0 (g) .• σ(s(v)) = t(φ(v)) , if s(v) = x is a variable.⌟ We are mostly interested in the cases where θ is either the identity = or set membership ∈.The resulting relations are φ, σ : s = sel t , for s ∈ T × A and t ∈ T × XA , φ, σ : s ∈ sel t , for s ∈ T × A and t ∈ T × UXA .

Figure 1 :
Figure 1: The flattening operation: g and flat(g) (edge directions not shown to reduce noise)

For a function
f : A → B, we define Uf : UA → UB by Uf (I) := ⇑f [I] , for I ∈ UA .

For a function
f : A → B, we define Df : DA → DB by Df (I) := ⇓f [I] , for I ∈ DA .⌟

⌟
We can use distributive laws to lift a monad from the base category to the category of algebras.
Definition 3.7.(a) We denote the (sort-wise) power set of A ∈ Pos Ξ by P(A) ∈ Pos Ξ .
(b) We define flat × : T × T × A → T × A and sing × : A → T × A by flat × := un 0 • flat and sing × := sing .⌟ This gives us the desired monad structure for T × .The proof is straightforward.

Lemma 4. 7 .
Let ⟨M, µ, ε⟩ be a monad on Pos Γ .(a) M| ∆ forms a monad with multiplication (µ • Mi)| ∆ and unit map ε| ∆ .(b) If A is an M-algebra, then A| ∆ is an M| ∆ -algebra.Proof.To improve readability, let us denote the functor (−)| ∆ by R and the functor (−) ↑ by E. Then M| ∆ = R • M • E. We denote the inclusion ER ⇒ Id by i and the identity function Id ⇒ RE by e.One can show that E ⊣ R is an adjunction with unit e and counit i, but for our purposes it is sufficient to note that we have the following equalities i • Ee = id and Ri • e = id , whose proofs are trivial.(a)We have to check three axioms.

Definition 4. 8 .
Let g ∈ R ζ A be a graph.(a) For a surjective function σ : ζ → ξ, we denote by σ g ∈ R ξ A the graph obtained from g by replacing each variable x by σ(x).(b) We set un(g) := ⟨σ, t⟩ ,

⌟
Remark 4.23.(a) For every graph g, there exists a canonical graph homomorphism φ : un 0 (g) → g.(b)Note that φ, σ : g = sel k and k θ R h implies φ, σ : g θ sel h , but the converse is generally not true since the function φ does not need to be injective and we can choose different values ⟨φ /u , c u ⟩, ⟨φ /v , c v ⟩ θ h(w) for u, v ∈ φ −1 (w).For this reason, we cannot reduce the relation ∈ sel to the much simpler = sel .⌟Let us derive an algebraic description of the relation φ, σ : s = sel t that is much easier to work with.We introduce a function un + satisfying ⟨σ, s⟩ = un + (t) iff φ, σ : s = sel t , for some φ , and a similar function dun associated with the relation = un .Definition 4.24.(a) For a set A, we define the strong unravelling operation un + :T × XA → XT • A by un + := un • flat × • T × (re 0 • Xsing) .(b)For an unravelling structure A, we define the deep unravelling operation dun :T × A → XT • A by dun := un + • T × un .⌟ Example 4.25.To understand the definition of un + , let us consider the following tree t ∈ T × XA.Below we have depicted t itself, the intermediate terms t ′ := T × (re 0 • Xsing)(t) and t ′′ := flat(t ′ ), and the end result un + (t).
Here a, b ∈ A {x 0 ,x 1 } , c ∈ A {x 0 } , and σ ij denotes the function mapping x 0 → x i and x 1 → x j .⌟ Let us check that the above definitions have the desired effect.Lemma 4.26.We have ⟨σ, s⟩ = un + (t) iff φ, σ: s = sel t , for some φ , ⟨σ, s⟩ = dun(t) iff φ, σ: s = un t , for some φ .Proof.We only have to prove the first equivalence.Then the second one follows by definition of dun and = un .Hence, set r := R(re 0 • Xsing)(t) and ⟨σ, s⟩ := un(flat × (r)) , let φ : dom(flat × (r)) → dom(t) be the homomorphism from above, let φ : dom(flat × (r)) → dom(t) be the graph homomorphism induced by the canonical map dom 0 (flat × (r)) → v∈dom 0 (r) dom 0 (r(v)) , Definition 3.1.A functor F : Pos Ξ → Pos Ξ is polynomial if it is of the following form.For objects A ∈ Pos Ξ , ) i∈I of sets with I, D i ∈ Set Ξ .Hence, an element of FA is of the form ⟨i, s⟩ with i ∈ I and s : D i → A sort-preserving.The sort of ⟨i, s⟩ is the sort of i.We usually omit the first component from the notation and simply write s.The set dom(s) := D i is the called domain of s.