Elgot Algebras

Denotational semantics can be based on algebras with additional structure (order, metric, etc.) which makes it possible to interpret recursive specifications. It was the idea of Elgot to base denotational semantics on iterative theories instead, i.e., theories in which abstract recursive specifications are required to have unique solutions. Later Bloom and Esik studied iteration theories and iteration algebras in which a specified solution has to obey certain axioms. We propose so-called Elgot algebras as a convenient structure for semantics in the present paper. An Elgot algebra is an algebra with a specified solution for every system of flat recursive equations. That specification satisfies two simple and well motivated axioms: functoriality (stating that solutions are stable under renaming of recursion variables) and compositionality (stating how to perform simultaneous recursion). These two axioms stem canonically from Elgot's iterative theories: We prove that the category of Elgot algebras is the Eilenberg-Moore category of the monad given by a free iterative theory.


Introduction
We study Elgot algebras, a new notion of algebra useful for application in the semantics of recursive computations.In programming, functions are often specified by a recursive program scheme such as where F and G are given functions and ϕ and ψ are recursively defined in terms of the given ones by (1.1).We are interested in the semantics of such schemes.Actually, one has to distinguish between uninterpreted and interpreted semantics.In the uninterpreted semantics the givens are not functions but merely function symbols from a signature Σ.
In the present paper we prepare a basis for the interpreted semantics in which a program scheme comes together with a suitable Σ-algebra A, which gives an interpretation to all the given function symbols.The actual application of Elgot algebras to semantics will be dealt with in joint work of the second author with Larry Moss [MM].By "suitable algebra" we mean, of course, one in which recursive program schemes can be given a semantics.For example, for the recursive program scheme (1.1) we are only interested in those Σ-algebras A, where Σ = { F, G }, in which the program scheme (1.1) has a solution, i. e., we can canonically obtain new operations ϕ A and ψ A on A so that the formal equations (1.1) become valid identities.The question we address is: What Σ-algebras are suitable for semantics?(1.2) Several answers have been proposed in the literature.One well-known approach is to work with complete posets (CPO) in lieu of sets, see e.g.[GTWW].Here algebras have an additional CPO structure making all operations continuous.Another approach works with complete metric spaces, see e.g.[ARu].Here we have an additional complete metric making all operations contracting.In both of these approaches one imposes extra structure on the algebra in a way that makes it possible to obtain the semantics of a recursive computation as a join (or limit, respectively) of finite approximations.
It was the idea of Calvin Elgot to try and work in a purely algebraic setting avoiding extra structure like order or metric.In [El] he introduced iterative theories which are algebraic theories in which certain systems of recursive equations have unique solutions.Later Evelyn Nelson [N] and Jerzy Tiuryn [T] studied iterative algebras, which are algebras for a signature Σ with unique solutions of recursive equations.While avoiding extra structure, these are still not the unifying concept one would hope for, since they do not subsume continuous algebras-least fixed points are typically not unique.
However, analyzing all the above types of algebras we find an interesting common feature which makes continuous, metrizable and iterative algebras fit for use in semantics of recursive program schemes: these algebras allow for an interpretation of infinite Σ-trees.Let us make this more precise.For a given signature Σ consider the algebra T Σ X of all (finite and infinite) Σ-trees over X, i. e., rooted ordered trees where inner nodes with n children are labelled by n-ary operation symbols from Σ, and leaves are labelled by constants or elements from X.It is well-known that for any continuous (or metrizable) algebra A there is a unique continuous (or contracting, respectively) homomorphism from T Σ A to A which provides for any Σ-tree over A its result of computation in A. It is then easy to give semantics to recursive program schemes in A. For example, for (1.1) one can simply take the tree unfolding which yields the infinite trees GGx and then for any argument x ∈ A compute these infinite trees in A.
Actually, we do not need to be able to compute all infinite trees: all recursive program schemes unfold to algebraic trees, see [C] (we discuss these briefly in Section 6 below).Another important subclass are rational trees, which are obtained as all solutions of guarded finitary recursive equations.They were characterized by Sussanna Ginali [G] as those Σtrees having up to isomorphism finitely many subtrees only.We denote by R Σ X the subalgebra of all rational trees in T Σ X.With this in mind, we can restate problem (1.2) more formally: What Σ-algebras have a suitable computation of all trees?Or all rational trees?( This means, one further step more formally: what is the largest category of Σ-algebras in which T Σ X, or R Σ X, respectively, act as free algebras on X?The answer in the case of T Σ X is: complete Elgot algebras.These are Σ-algebras A with an additional operation "dagger" assigning to every system e of recursive equations in A a solution e † .Two (surprisingly simple) axioms are put on (−) † which stem from the internal structure of T Σ X: the functor T Σ given by X −→ T Σ X is part of a monad on Set, and this monad yields the free completely iterative theory on Σ, as proved in [EBT].We will prove that the algebras for this monad (i.e., the Eilenberg-Moore category of T Σ ) are complete Elgot algebras.Basic examples: continuous algebras or metrizable algebras are complete Elgot algebras.Analogously, the largest category of Σ-algebras in which each R Σ X acts as a free algebra is the category of Elgot algebras.They are defined precisely as the complete Elgot algebras, except that the systems e of recursive equations considered there are required to be finite.For example, every iterative algebra is an Elgot algebra.We present the results for suitable endofunctors of an arbitrary category A satisfying very mild conditions: for complete Elgot algebras we just need A to have finite coproducts, for Elgot algebras we work with locally finitely presentable categories in the sense of Peter Gabriel and Friedrich Ulmer [AR].
Related Work: Solutions of recursive equations are a fundamental part of a number of models of computation, e. g., iterative theories of C. Elgot [El], iteration theories of S. Bloom and Z. Ésik [B É], traced monoidal categories of A. Joyal, R. Street and D. Verity [JSV], fixed-point theories for domains, see S. Eilenberg [Ei] or G. Plotkin [P], etc.In some of these models the assignment of a solution e † to a given type of recursive equation e is unique (e. g., in iterative theories every ideal system has a unique solution, or in domains given by a complete metric space there are unique solutions of fixed-point equations, see [ARu]).The operation e −→ e † then satisfies a number of equational properties.In other models, like in iteration theories, for example, a specific choice of a solution e † is assumed, and certain properties (inspired by the models with unique solutions) are formulated as axioms.Recall that in a traced monoidal category whose tensor product is just the ordinary product the trace is equivalently presented in form of an operation e † satisfying certain axioms, see [Ha] and [H].
The approach of the present paper is more elementary in asking for solutions e −→ e † in a concrete algebra A.Here we work with flat equations e in A, which are morphisms of the form e : X −→ HX + A. However, flatness is just a technical restriction: in future research we will prove that more general non-flat equations obtain solutions "automatically".The fact that we work with a fixed algebra A (and let only X and e vary) is partly responsible for the simplicity of our axioms in comparison to the work on theories (where A varies as well), see e. g. [B É] or [SP 1 ].Iterative algebras of Evelyn Nelson [N] and Jerzy Tiuryn [T], where solutions e † are required to be unique, are a similar approach.Furthermore, iteration algebras of Zoltan Ésik [ É] are another one.Unfortunately, the number of axioms (seven) and their complexity make the question of the relationship of that notion to Elgot algebras a nontrivial one.We intend to study this question in the future.
We work with two variations: Elgot algebras, related to R Σ X, where the function (−) † assigns a solution only to finitary flat recursive systems, and complete Elgot algebras, related to T Σ X, where the function (−) † assigns solutions to all flat recursive systems.This is based on our previous research [AAMV, M, AMV 1 , AMV 2 ] in which we proved that every finitary endofunctor H generates a free iterative monad R, and a free completely iterative monad T .In the present paper we study the Eilenberg-Moore categories of the monads R and T .

Organization of the Paper:
In Section 2 we recall (completely) iterative algebras and prove that the assignment of unique solutions in these algebras fulfills the axioms of functoriality and compositionality.
Elgot algebras and complete Elgot algebras are introduced in Section 3 as algebras equipped with a chosen assignment of a solution that satisfies functoriality and compositionality.
In Sections 4 and 5 we prove that (complete) Elgot algebras form Eilenberg-Moore category of a free (completely) iterative monad.

Iterative Algebras and CIAs
Assumption 2.1.Throughout the paper H denotes an endofunctor of a category A having binary coproducts.We denote the corresponding injections by inl : Recall that an object X of a category with filtered colimits is called finitely presentable if the hom-functor A(X, −) : A −→ Set is finitary, i. e., if it preserves filtered colimits.(In Set, these are precisely the finite sets.In equational classes of algebras these are precisely the finitely presentable algebras in the usual sense.)Recall further that a category A is called locally finitely presentable if it has colimits and a set of finitely presentable objects whose closure under filtered colimits is all of A, see [AR].(Examples: the categories of sets, posets, graphs or any finitary variety of algebras are locally finitely presentable categories.)Definition 2.2.By a flat equation morphism in an object A we understand a morphism e : X −→ HX + A in A. We call e finitary provided that X is finitely presentable.1 Suppose that A is the carrier of an H-algebra α : HA −→ A. A solution of e is a morphism e † : X −→ A such that the square If every finitary flat equation morphism has a unique solution, then A is said to be an iterative algebra.The algebra A is called a completely iterative algebra (CIA) if every flat equation morphism has a unique solution.
Remark 2.3.Iterative algebras for polynomial endofunctors of Set were introduced and studied by Evelyn Nelson [N].She proved that the algebras R Σ X of rational Σ-trees on X are free iterative algebras, and that the algebraic theory obtained from them is a free iterative theory of Calvin Elgot [El].We have recently studied iterative algebras in a much more general setting, working with a finitary endofunctor of a locally finitely presentable category.Completely iterative algebras were studied by Stefan Milius [M].
Example 2.4.Consider algebras in Set with one binary operation * .In that case, the functor is HX = X × X.A flat equation morphism e in an algebra A assigns to every variable x either a flat term y * z (y and z are variables) or an element of A. A solution e † : X −→ A assigns to x ∈ X either the same element as e, in case e(x) ∈ A, or the result of e † (y) * e † (z), in case e(x) = y * z.For example, the following recursive equation represented by the obvious morphism e : { x } −→ { x } × { x } + A, has as solution e † an element a = e † (x) which is idempotent.Consequently, every iterative algebra has a unique idempotent.If A is even completely iterative, then it has, for each sequence a 0 , a 1 , a 2 , . . . of elements, a unique interpretation of In fact, we consider here the equations Iterative algebras have unique solutions of many non-flat equations because we can flatten them.For example the following recursive equations are not flat.But they can be easily flattened to obtain a system represented by a morphism e : X −→ X × X + A, where X = { x 1 , x 2 , z 1 , z 2 , z 3 }.Its solution is a map e † : X −→ A yielding a pair of elements s = e † (x 1 ) and t = e † (x 2 ) satisfying s = (t * a) * b and t = s * b.
Example 2.5.Iterative Σ-algebras.For every finitary signature Σ = (Σ n ) n∈N we can identify Σ-algebras with algebras for the polynomial endofunctor H Σ of Set defined on objects X by H Σ X = Σ 0 + Σ 1 × X + Σ 2 × X × X + . . .A Σ-term which has the form σ(x 1 , . . ., x k ) for some σ ∈ Σ k and for variables x 1 , . . ., x k from X is called flat.Then a flat equation morphism e : X −→ H Σ X + A in an algebra A represents a system x ≈ t x of recursive equations, one for every variable x ∈ X, where each t x is either a flat term in X, or an element of A. A solution e † assigns to every variable x with t x = a, a ∈ A, the element a, and if t x = σ(x 1 , . . ., x k ) then e † (x) = σ A (e † (x 1 ), . . ., e † (x k )).
Example 2.6.In particular, for unary algebras (H = Id ), an algebra α : A −→ A is iterative iff α k has a unique fixed point (k ≥ 1), see [AMV 2 ].The algebra A is a CIA iff, in addition to a unique fixed point of each α k , there exists no infinite sequence (a n ) n∈N in A with αa n+1 = a n , see [M].
Remark 2.7.In [AMV 2 ] we have proved that for every finitary functor H of a locally finitely presentable category A, a free iterative algebra RY exists on every object Y .Furthermore, we have given a canonical construction of RY as a colimit of all coalgebras X −→ HX + Y carried by finitely presentable objects, in other words, for every object Y of A, RY is a colimit of all finitary flat equations in Y .For example, for a polynomial functor H Σ of Set the free iterative algebra on a set Y is the algebra R Σ Y of all rational Σ-trees over Y .In general, we call the monad R of free iterative algebras the rational monad generated by H.We have proved in [AMV 2 ] that the rational monad R is a free iterative monad on H.
Example 2.8.Completely metrizable algebras.Complete metric spaces are well-known to be a suitable basis for semantics.The first categorical treatment of complete metric spaces for semantics is due to Pierre America and Jan Rutten [ARu].Let

CMS
denote the category of all complete metric spaces (i.e., such that every Cauchy sequence has a limit) with metrics in the interval [0, 1].The morphisms are maps f : where the inequality d Y (f (x), f (x ′ )) ≤ d X (x, x ′ ) holds for all x, x ′ in X.Such maps f are called nonexpanding.
Given complete metric spaces X and Y , the hom-set CMS(X, Y ) carries the pointwise metric d X,Y defined as follows: America and Rutten call a functor H : CMS −→ CMS contracting if there exists a constant ε < 1 such that for arbitrary morphisms f, g : X −→ Y we have (2.2) Lemma 2.9.If H : CMS −→ CMS is a contracting functor, then every nonempty H-algebra is a CIA.
Proof.Let α : HA −→ A be a nonempty H-algebra.Recall that the hom-set CMS(X, A) is a complete metric space with the supremum metric.Definition 2.2 of a solution of a flat equation morphism e : X −→ HX + A states that e † is a fixed point of the function F on CMS(X, A) given by This function is a contraction on CMS(X, A).In fact, for two nonexpanding maps s, t : where ε < 1 is the constant of (2.2) above.By Banach's Fixed Point Theorem, there exists a unique fixed point of F : a unique solution of e.
(1) The proof of the last theorem yields a concrete formula for the unique solution e † of a given flat equation morphism e : X −→ HX + A. This unique solution is given as the limit of a Cauchy sequence in CMS(X, A) as follows: where e † 0 : X −→ A is any nonexpanding map (for example a constant map: use that A is nonempty) and e † n+1 is defined by the commutativity of the diagram below: O O (2.3) (2) Many set functors H have a lifting to contracting endofunctors H ′ of CMS.That is, for the forgetful functor U : CMS −→ Set the following square where d ′ is the maximum metric.Then H ′ is a contracting functor with ε = 1 2 .Since coproducts of 1 2 -contracting liftings are 1 2 -contracting liftings of coproducts, we conclude that every polynomial endofunctor has a contracting lifting to CMS.
Let us call an H-algebra α : HA −→ A completely metrizable if there exists a complete metric, d, on A such that α is a nonexpanding map from H ′ (A, d) to (A, d).
Corollary 2.11.Every completely metrizable algebra A is a CIA.
In fact, to every equation morphism e : X −→ HX + A assign the unique solution of e : (X, Remark 2.12.Stefan Milius [M] proved that for any endofunctor H of A a final coalgebra T Y for H(−) + Y is a free CIA on Y , and conversely.Furthermore, assuming that the free CIAs exist, it follows that the monad T of free CIAs is a free completely iterative monad on H.This generalizes and extends the classical result of Elgot, Bloom and Tindell [EBT] since for a polynomial functor H Σ of Set the free completely iterative algebra on a set Y is the algebra T Σ Y of all Σ-trees over Y .
Remark 2.13.We are going to prove two properties of iterative algebras and CIA's: functoriality and compositionality of solutions.We will use two "operations" on equation morphisms.One, •, is just change of parameter names: given a flat equation morphism e : X −→ HX + Y and a morphism h : Y −→ Z we obtain the following equation morphism (2.4) Functoriality.This states that solutions are invariant under renaming of variables, provided, of course, that the right-hand sides of equations are renamed accordingly.Formally, observe that every flat equation morphism is a coalgebra for the endofunctor H(−) + A.
Given two such coalgebras e and f , a renaming of the variables (or morphism of equations) is a morphism h : X −→ Y which forms a coalgebra homomorphism: Definition 2.14.Let A be an algebra with a choice e −→ e † of solutions, for all flat equation morphisms e in A. We say that the choice is functorial provided that holds for all morphisms h : e −→ f of equations.In other words: (−) † is a functor from the category of all flat equation morphisms in the algebra A into the comma-category of the object A.
Proof.For each morphism h of equations the diagram Uniqueness of solutions now implies the desired result.
Remark.The same holds for every iterative algebra, except that there we restrict X and Y in Definition 2.14 to finitely presentable objects.
Compositionality.This tells us how to perform simultaneous recursion: given an equation morphism f in A with a variable object Y , we can combine it with any equation morphism e in Y with a variable object X to obtain the equation morphism f e in A of Remark 2.13.Compositionality decrees that the left-hand component of (f e) † is just the solution of f † • e.In other words: in lieu of solving f and e simultaneously we first solve f , plug in the solution in e and solve the resulting equation morphism.
Definition 2.16.Let A be an algebra with a choice e −→ e † of solutions, for all flat equation morphisms e in A. We say that the choice is compositional if for each pair e : X −→ HX +Y and f : Y −→ HY + A of flat equation morphisms, we have Remark 2.17.Notice that the coproduct injection inr : Y −→ X + Y is a morphism of equations from f to f e. Functoriality then implies that f † = (f e) † • inr.Thus, in the presence of functoriality, compositionality is equivalent to (2.8) Lemma 2.18.In every CIA, the assignment (−) † is compositional.
Proof.Denote by It is sufficient to prove that the equation below holds: We establish this using the uniqueness of solutions and by showing that the following diagram O O (2.9) commutes.Commutation of the right-hand components (with domain Y ) of the diagram: For the left-hand components (with domain X) use the commutativity of the square defining r = (f † • e) † : O O (2.10) We now only need to show that the passages from HX + Y to A in the above squares (2.9) and (2.10) are equal.The left-hand components are, in both cases, α • Hr : HX −→ A. For the right-hand components use Remark 2.19.The same holds for every iterative algebra, except that here we work in a locally finitely presentable category and restrict X and Y in Definition 2.16 to finitely presentable objects.
Remark 2.20.As mentioned in the Introduction, our two axioms, functoriality and compositionality, are not new as ideas of axiomatizing recursion-we believe however, that their concrete form is new, and their motivation strengthened by the results below.Functoriality resembles the "functorial dagger implication" of S. Bloom and Z. Ésik [B É], 5.3.3, which states that for every object p of an iterative theory the formation f −→ f † of solutions for ideal morphisms f : m −→ m + p is a functor.Compositionality resembles the "left pairing identity" of [B É], 5.3.1, which for f : where This identity corresponds also to the Bekić-Scott identity, see e. g. [Mo], 2.1.

Elgot Algebras
Definition 3.1.Let H be an endofunctor of a category with finite coproducts.An Elgot algebra is an H-algebra α : HA −→ A together with a function (−) † which to every finitary flat equation morphism e : X −→ HX + A assigns a solution e † : X −→ A in such a way that functoriality (2.6) and compositionality (2.7) are satisfied.
By a complete Elgot algebra we analogously understand an H-algebra together with a function (−) † assigning to every flat equation e a solution e † so that functoriality and compositionality are satisfied.
Example 3.2.Every join semilattice A is an Elgot algebra.More precisely: consider the polynomial endofunctor HX = X × X of Set (expressing one binary operation).Then for every join semilattice A there is a "canonical" Elgot algebra structure on A obtained as follows: the algebra RA of all rational binary trees on A has an interpretation on A given by the function α : RA −→ A forming, for every rational binary tree t the join of all the (finitely many!) labels of leaves of t in A. Now given a finitary flat equation morphism e : X −→ X × X + A, it has a unique solution e † : X −→ RA in the free iterative algebra RA, and composed with α this yields an Elgot algebra structure e −→ α • e † on A. See Example 4.10 for a proof.
Remark 3.3.In contrast, no nontrivial join semilattice is iterative.In fact, in an iterative join semilattice there must be a unique solution of the formal equation x ≈ x ∨ x.
Example 3.4.Continuous algebras on cpos are complete Elgot algebras.Let us work here in the category CPO of all ω-complete posets, which are posets having joins of increasing ω-chains; morphisms are the continuous functions, i.e., functions preserving joins of ω-chains.A functor H : CPO −→ CPO is called locally continuous provided that for arbitrary CPOs, X and Y , the associated function from CPO(X, Y ) to CPO(HX, HY ) is continuous (i.e., H( f n ) = Hf n holds for all increasing ω-chains f n : X −→ Y ).For example, every polynomial endofunctor X −→ n Σ n × X n of CPO (where Σ n are cpos) is locally continuous.
Observe that the category CPO has coproducts: they are the disjoint unions with elements of different summands incompatible.
Proposition 3.5.Let H : CPO −→ CPO be a locally continuous functor and let α : HA −→ A be an H-algebra with a least element ⊥ ∈ A. Then (A, α, (−) † ) is a complete Elgot algebra w.r.t. the assignment of the least solution e † to every flat equation morphism e.
Remark 3.6.Notice that the least solution of e : X −→ HX + A refers to the elementwise order of the hom-set CPO(X, A).We can actually prove a concrete formula for e † as a join of the ω-chain e † = n∈ω e † n of "approximations": e † 0 is the constant function to ⊥, the least element of A, and given e † n , then e † n+1 is defined by the commutativity of (2.3).Proof of Proposition 3.5.(1) Let e : X −→ HX + A be a flat equation morphism in A. We define a function F on CPO(X, A) by Since H is locally continuous and composition in the category CPO is continuous, we see that F is continuous too.
By the Kleene Fixed Point Theorem, there exists a least fixed point of F and this is the least solution as described in Remark 3.6.
(2) The assignment e −→ e † is functorial.In fact, let (3) We prove compositionality.Let e : X −→ HX + Y and f : Y −→ HY + A be given.We shall show that the equality holds.It suffices to prove, by induction on n, that the following two inequalities hold.First recall that inr : (Y, f ) −→ (X + Y, f e) is a coalgebra homomorphism.Thus, the equation (f e) † • inr = f † holds by functoriality.For the induction step for (3.1) consider the following diagram In order to prove the desired inequality in the upper triangle, we use the fact that the outer square commutes by definition of (−) For the induction step for (3.2) consider the following diagram 4 4 j j j j j j j j j j j j j j j j j j j j The outer square commutes by definition of (f † • e) † n+1 .The three middle parts behave as indicated (for the inequality use the induction hypothesis), and the lowest part commutes when extended by [α, A] as before.Thus, we obtain the desired inequality in the upper triangle.
Remark 3.7.Many set functors H have a lifting to locally continuous endofunctors H ′ of CPO.That is, for the forgetful functor U : CPO −→ Set the following square For example, every polynomial functor H Σ has such a lifting.An H-algebra α : HA −→ A is called CPO-enrichable if there exists a CPO-ordering ⊑ with a least element on the set A such that α is a continuous function from H ′ (A, ⊑) to (A, ⊑).
Corollary 3.8.Every CPO-enrichable H-algebra A in Set is a complete Elgot algebra.
In fact, to every equation morphism e : X −→ HX + A assign the least solution of e : (X, ≤) −→ H ′ (X, ≤) + (A, ⊑) where ≤ is the discrete ordering of X (x ≤ y iff x = y).
Example 3.9.Unary algebras.Let H = Id as an endofunctor of Set.Given an H-algebra α : A −→ A , if α has no fixed point, then A carries no Elgot algebra structure: consider the equation x ≈ α(x).
Conversely, every fixed point a 0 of α yields a flat cpo structure with a least element a 0 on A, i. e., x ≤ y iff x = y or x = a 0 .Thus, A is a complete Elgot algebra since it is CPO-enrichable.Notice that for every flat equation morphism e : X −→ X + A, the least solutions e † operates as follows: for a variable x we have if there is a sequence x = x 0 , x 1 , . . .x k in X that fulfils e(x 0 ) = x 1 , . . .e(x k−1 ) = x k and e(x k ) = a a 0 else .
Remark 3.10.For unary algebras, Example 3.9 describes all existing Elgot algebras.In fact, let (A, α, (−) † ) be an Elgot algebra and let a 0 ∈ A be the chosen solution of x ≈ α(x); more precisely, a 0 = e † ( * ) where e = inl : 1 −→ 1 + A and * is the unique element of 1. Then for every flat equation morphism e : X −→ X + A the chosen solution sends a variable x ∈ X to one of the above values α k (a) or a 0 .To prove this denote by Y ⊆ X the set of all variables for which the "else" case holds above.Hence no sequence x = x 0 , . . .x k in X fulfils e(x i ) = x i+1 , for i = 0, . . ., k − 1, and e(x k ) ∈ A. Apply functoriality to the morphism h from e to 1 + e : 1 + X −→ 1 + X + A defined by h(y) ∈ 1 for y ∈ Y and h(x) = x ∈ X else.In fact, the chosen solution of the unique element of 1 in 1 + X must be a 0 by functoriality (consider the left-hand coproduct injection from the flat equation morphism inl : 1 −→ 1 + A to 1 + e).Here we work with the category Pos of all posets and order-preserving functions.(In fact, everything we say holds, much more generally, in every category enriched over Pos with Pos-enriched finite coproducts.)A functor H : Pos −→ Pos is called locally order-preserving if for all order-preserving functions f, g : A −→ B with f ⊑ g (in the pointwise ordering of Pos(A, B), of course), we have Hf ⊑ Hg.Proposition 3.12.Let H : Pos −→ Pos be locally order-preserving and let α : HA −→ A be an H-algebra which is carried by a complete lattice A. Then (A, α, (−) † ) is a complete Elgot algebra w.r.t. the assignment of a least solution e † to every flat equation morphism e. Remark 3.13.Again, the least solution of e : X −→ HX + A refers to the elementwise order of the hom-set Pos(X, A).We can actually prove a concrete formula for e † as a join of the ordinal chain e † = n∈Ord e † n of "approximations": e † 0 is the constant function to ⊥, the least element of A, given e † n , then e † n+1 is defined by the commutativity of (2.3) and for limit ordinals n we put e † n = k<n e † k .Proof of Proposition 3.12.One essentially repeats the proof of Proposition 3.5 for e † as defined in the previous Remark.In part (1) apply the Knaster-Tarski Fixed Point Theorem in lieu of the Kleene Fixed Point Theorem.For part (2) replace every induction argument by a corresponding transfinite induction argument and notice that the limit step is always trivial.
Example 3.14.Every complete lattice A is a complete Elgot algebra for HX = X × X. Analogously to Example 3.2 we have a function α : T A −→ A assigning to every binary tree t in T A the join of all labels of leaves of t in A. Now for every flat equation morphism e in A we have its unique solution e † in T A and this yields a complete Elgot algebra structure e −→ α • e † .See Example 5.9 for a proof.

The Eilenberg-Moore Category of the Monad R
We prove now that the category of all Elgot algebras and solution-preserving morphisms, defined as expected, is the category A R of Eilenberg-Moore algebras of the rational monad R of H, see Remark 2.7.Assumption 4.1.Throughout this section H denotes a finitary endofunctor of a locally finitely presentable category A.
We denote by A fp a small full subcategory representing all finitely presentable objects of A. Recall the operations • and from Remark 2.13.Definition 4.2.Let (A, α, (−) † ), and (B, β, (−) ‡ ) be Elgot algebras.We say that a morphism h : A −→ B in A preserves solutions provided that for every finitary flat equation morphism e : X −→ HX + A we have the following equation Proof.Let A fp /A be the comma-category of all arrows q : X −→ A with X in A fp .Since A is locally finitely presentable, A is a filtered colimit of the canonical diagram D A : A fp /A −→ A given by (q : X −→ A) −→ X.Now A fp is a generator of A, thus, in order to prove the lemma it is sufficient to prove that for every morphism p : Z −→ HA with Z in A fp we have Since H is finitary, it preserves the above colimit D A .This implies, since A(Z, −) preserves filtered colimits, that p has a factorization for some q : X −→ A in A fp /A and some s.For the following equation morphism Consequently, e † • inr = q, and this implies e On the other hand, consider the following diagram / / H[αp,q]+B 8 8 q q q q q q q q q q q q q q q q q q q q q q q q q q q q HB + B  (2) We are prepared to prove the Proposition.Suppose that (A, α, (−) † ) is an Elgot algebra and let m : Y −→ A be a morphism.We are to prove that there exists a unique solutionpreserving h : In order to show existence, we define a morphism h : RY −→ A by commutativity of the following triangles For arbitrary objects Y the equation h • η Y = m follows easily.
Let us show that h preserves solutions.We have ((4.5) and the definition of •) Theorem 4.8.The category Alg † H of Elgot algebras is isomorphic to the Eilenberg-Moore category A R of R-algebras for the rational monad R of H.
Remark 4.9.The shortest proof we know is based on Beck's Theorem, see below.But this proof is not very intuitive.A slightly more technical (and much more illuminating) proof has the following sketch: Denote for any object Y by (RY, ρ Y , (−) ‡ ) a free Elgot algebra on Y with a universal arrow η Y : Y −→ RY .
(1) For every R-algebra α 0 : RA −→ A we have an "underlying" H-algebra and the following formula for solving equations: given a finitary flat equation morphism e : X −→ HX + A put It is not difficult to see that this formula indeed yields a choice of solutions satisfying functoriality and compositionality.(2) Conversely, given an Elgot algebra α : HA −→ A, define α 0 : RA −→ A as the unique solution-preserving morphism such that α 0 • η A = id .It is easy to see that α 0 satisfies the two axioms of an Eilenberg-Moore algebra.
(3) It is necessary to prove that the above passages extend to the level of morphisms and they form functors which are inverse to each other.
In fact, for any finitary flat equation morphism e : X −→ HX + B we have the desired equation: We prove that h is solution-preserving.Let e : X −→ HX + C be a finitary flat equation morphism.Then we have as desired.This completes the proof.
Example 4.10.Let A be a join semilattice.Recall from Example 3.2 the function α : RA −→ A assigning to a rational binary tree t in RA the join of the labels of all leaves of t in A. Since joins commute with joins it follows that this is the structure of an Eilenberg-Moore algebra on A. Thus, A is an Elgot algebra as described in Example 3.2.

Complete Elgot Algebras
Recall our standing assumptions that H is an endofunctor of a category A with finite coproducts.Stefan Milius [M] has established that for every object-mapping T of A the following three statements are equivalent: (a) for every object Y , T Y is a final coalgebra for H(−) + Y , (b) for every object Y , T Y is a free completely iterative H-algebra on Y , and (c) T is the object part of a free completely iterative monad T on H. See also [AAMV], where the monad T is described and the implication that (a) implies (c) is proved.
We are going to add another equivalent item to the above list, bringing complete Elgot algebras into the picture.The statements (a) to (c) are equivalent to (d) for every object Y , T Y is a free complete Elgot algebra on Y .Furthermore, recall from [AAMV] that H is iteratable if there exist objects T Y such that one of the above equivalent statements holds.We will describe for every iteratable endofunctor the category A T of Eilenberg-Moore algebras-it is isomorphic to the category of complete Elgot algebras for H.
Example 5.1.For a polynomial endofunctor H Σ of Set, the above monad T is the monad T Σ of all (finite and infinite) Σ-trees.
In the following result the concept of solution-preserving morphism is defined for complete Elgot algebras analogously to Definition 4.2: the equation (4.1) holds for all flat equation morphisms e.We denote by Alg † c H the category of all complete Elgot algebras and solution-preserving morphisms.
Lemma 5.2.Every solution-preserving morphism between complete Elgot algebras is a homomorphism of H-algebras.
Remark 5.3.If the base category A is locally finitely presentable and H is finitary, then this lemma is a special case of Lemma 4.3.However, the statement of Lemma 5.2 is more general, and the proof is completely different.
commutes.Thus, e † • inr = id, and then it follows that e † • inl = α.Since h preserves solutions we know that h • α is the left-hand component of the solution of the following flat equation morphism By a similar argument as for e † above we obtain [β, B] = (Hinr + B) ‡ .Thus, by functoriality we conclude that h is an H-algebra homomorphism: This completes the proof.
Theorem 5.4.Let Y be an object of A. Then the following are equivalent: (1) T Y is a final coalgebra for H(−) + Y , and (2) T Y is a free complete Elgot algebra on Y .
Before we prove this theorem, we need a technical lemma: The lower left-hand part commutes since e † solves e; the upper part is the definition of (−) ‡ , the left-hand triangle is the definition of e, and all components of the inner right-hand part are clear.
(2) The morphism e ‡ is a solution of e.In fact, the following diagram O O commutes: the upper and lower part as well as the left-hand square are obvious, and so are the middle and right-hand components of the right-hand square.To see that the left-hand component commutes, we remove H and observe that the following diagram commutes: Observe that (g ‡ • f ) ‡ is the following morphism

HA
(5.1) and (g f ) ‡ • inl is the following morphism In fact, to see that the last triangle commutes consider the components separately.The right-hand one with domain HA + Y is trivial, and for the left-hand one with domain HX + HZ it suffices to observe the following equations: To show the desired identity of the morphisms in (5.1) and (5.2) it suffices to prove that the slanting arrows in those diagrams are equal.The last three components are clear, and for the first one the following equations are sufficient: This completes the proof.
Proof.(Theorem 5.4.)By Theorems 2.8 and 2.10 of [M], statement ( 1 (5.3)Then e † is a coalgebra homomorphism from (X, c) to (T Y, i); in fact, it suffices to establish that the diagram commutes.The upper part is (5.3), the left-hand part commutes since e † is a solution of e, the right-hand one commutes trivially, and the lower part is obvious.Now suppose that s is a coalgebra homomorphism from (X, c) to (T Y, i).We prove that s = e † .Observe first that s is a morphism of equations from e to the following flat equation morphism In fact, the following diagram f commutes: the left-hand square does since s is a coalgebra homomorphism, the right-hand one commutes trivially and the upper and lower parts are due to (5.3) and (5.4).By functoriality of (−) † we obtain f † • s = e † .We shall show below that f By the freeness of T Y , we then conclude that f † = id , whence e † = s as desired.
To see that which commutes since f † is a solution of f .Follow the right-hand component of the coproduct HT Y + Y to see the desired equation.
To complete our proof we must show that the following triangle By functoriality we obtain the following equality whose left-hand component proves due to (5.6) the desired commutativity of (5.5).
To show uniqueness suppose that h : T Y −→ A is any solution-preserving morphism with h • η Y = m.Observe that we have g = h • f , where f is the flat equation morphism of (5.4).Since h preserves solutions we have To complete the proof it suffices to show that f † = id .This can be done with precisely the same argument as in the part (2) ⇒ (1) of the present proof.One shows that f † : T Y −→ T Y is a solution-preserving morphism such that f † • η Y = η Y .From the universal property of the free CIA T Y it follows that f † = id , see also Proposition 2.3 in [M].
Corollary 5.7.For any endofunctor H : A −→ A the following are equivalent: (1) H is iteratable, i. e., there exist final coalgebras for all functors H(−) + Y ; (2) there exist free completely iterative H-algebras on every object Y ; (3) there exist free complete Elgot algebras on every object Y .Example 5.9.Let A be a complete lattice.Recall from Example 3.14 the function α : T A −→ A assigning to every binary tree t in T A the join of all labels of leaves of t in A. Since joins commute with joins it follows that α : T A −→ A is the structure of an Eilenberg-Moore algebra on A. Thus, A is a complete Elgot algebra as described in Example 3.14.

Summary and Future Work
In this paper we introduce Elgot algebras: these are algebras in which finitary flat equation morphisms have solutions satisfying two simple axioms, one for change of parameters and one for simultaneous recursion.Analogously, complete Elgot algebras are algebras in which flat equation morphisms (not necessarily finitary) have solutions subject to the same two axioms.These axioms are strikingly simple and have a clear intuitive meaning.
Moreover, the motivation for Elgot algebras is provided canonically by Elgot's iterative theories: Elgot algebras are precisely the Eilenberg-Moore algebras for the free iterative theory (as described by Calvin Elgot et al. for signatures in [EBT] and by the present authors [AMV 1 , AMV 2 ] for general endofunctors).Analogously, complete Elgot algebras are precisely the Eilenberg-Moore algebras for the free completely iterative monad of Calvin Elgot et al. [EBT] (generalized by Peter Aczel and the present authors [AAMV], see also the work of Stefan Milius [M]).
The assignment e −→ e † , which forms an Elgot algebra structure, extends canonically from the above flat equation morphisms e to a much broader class of "rational" equation morphisms.In that sense one gets close to iteration algebras of Zoltán Ésik [ É].The relationship of the latter to Elgot algebras needs further investigation.
One reason for presenting Elgot algebras not only in Set but in general locally finitely presentable categories is the fact that for the important class of algebraic trees of Bruno Courcelle [C] (i.e., for the trees obtained by tree unfoldings of recursive program schemes) no abstract treatment has been presented so far.We believe that algebraic trees can be treated abstractly when working in the category Fin(Set), the locally finitely presentable category of all finitary endofunctors of Set.
Finally, our paper can be considered as part of a program proposed by Larry Moss to rework the theory of recursive program schemes and their semantics using coalgebraic methods.Stefan Milius and Larry Moss [MM] introduce a general notion of recursive program scheme and prove that any guarded recursive program scheme has a unique "uninterpreted" solution in the final coalgebra for the functor describing the given operations.For interpreted semantics of recursive program schemes one needs a "suitable" notion of an algebra.It is proved in [MM] that for every recursive program scheme an interpreted solution can be given in any complete Elgot algebra.As an application one obtains the classical theory of recursive program schemes interpreted in continuous or completely metrizable algebras.New applications include, for example, recursively defined operations satisfying extra conditions like commutativity, or applications pertaining to non-well founded sets or fractals.

h
• e ≡ X e / / HX + Y HX+h / / HX + Z .The other operation combines two flat equation morphisms e : X −→ HX + Y and f : Y −→ HY + A into the single flat equation morphism f e : X + Y −→ H(X + Y ) + A in a canonical way: put can = [Hinl, Hinr] : HX + HY −→ H(X + Y ) and define † .The three middle parts clearly behave as indicated (for the triangle use the induction hypothesis (3.1) and (f e) † n • inr ⊑ (f e) † • inr = f † ), and the lowest part commutes when extended by [α, A]: In fact, for the left-hand component with domain HX this is trivial; for the right-hand component with domain Y use f † = [α, A] • (Hf † + A) • f , see (2.1).

Example 3. 11 .
Just as Example 3.4 is based on the Kleene Fixed Point Theorem, we obtain examples of complete Elgot algebras based on the Knaster-Tarski Fixed Point Theorem.
It commutes: the outer shape commutes since (h • e) ‡ is a solution.For the lower triangle use equation (4.3), and the remaining triangles are trivial.Thus, the upper right-hand part More precisely, form a colimit of the above diagram Eq Y .This is a coalgebra RY with the following coalgebra structure i : RY −→ HRY + Y and with colimit injections e ♯ : (X, e) −→ (RY, i) for all e : X −→ HX + Y in EQ Y .Notice that this colimit is preserved by the forgetful functor Coalg (H(−) + Y ) −→ A since H is finitary.The coalgebra structure i : RY −→ HRY + Y is an isomorphism; its inverse gives an H-algebra structure ρ Y : HRY −→ RY and a morphism η Y : Y −→ RY.Furthermore, we proved that the algebra (RY, ρ Y ) is a free iterative H-algebra on Y with the universal arrow η Y .Recall further from [AMV 2 ] that the unique solution e ‡ : X −→ RY for a finitary flat equation morphism e : X −→ HX + RY is obtained as follows.

Construction 5. 5 .
Let (A, α, (−) † ) be a complete Elgot algebra.For every morphism m : Y −→ A we construct a new complete Elgot algebra on HA + Y as follows:(1) The algebra structure isH(HA + Y ) H[α,m] / / HA inl / / HA + Y .(2)The choice (−) ‡ of solutions is as follows: for every flat equation morphism e : X −→ HX + HA + Y consider the flat equation morphism e ≡ X e / / HX + HA + Y HX+[α,m] / / HX + A , and put e ‡ ≡ X e / / HX + HA + Y [He † ,HA]+Y / / HA + Y .Notice that e = [α, m] • e. Lemma 5.6.The above construction defines a complete Elgot algebra such that [α, m] : HA + Y −→ A is a solution-preserving morphism into the original algebra.Proof.(1) The morphism [α, m] is solution-preserving: In fact, for any flat equation morphism e : X −→ HX + HA + Y we have the following commutative diagram † ,HA]+Y )+HA+Y / / H(HA+Y )+HA+Y [inl•H[α,m],HA+Y ] + HA + Y HX+[α,m] (3) Functoriality: Suppose we have a morphism h : e −→ f of equations.Then h : e −→ f is also one, and we obtain the following diagram It commutes: in the triangle the components with domains HA and Y are clear, for the left-hand component remove H and use functoriality of (−) † , and all other parts are obvious.(4) Compositionality: Suppose we have two flat equation morphisms f : X −→ HX + Z and g : Z −→ HZ + HA + Y .
) is equivalent to (1') T Y is a free CIA on Y , We prove now that (2) is equivalent to (1) by showing the implications (1 ′ ) ⇒ (2) ⇒ (1).We first observe that for a free complete Elgot algebra on Y , (T Y, τ Y , (−) † ), with a universal arrow η Y : Y −→ T Y , the morphism [τ Y , η Y ] : HT Y + Y −→ T Y is an isomorphism.In fact, by Lemma 5.6, HT Y + Y carries the complete Elgot algebra structure and j = [τ Y , η Y ] is solution-preserving and fulfils j • inr = η Y .Invoke the freeness of T Y to obtain a unique solution-preserving morphism i : T Y −→ HT Y + Y such that i • η Y = inr.It follows that j • i = id .By Lemma 5.2, i is an H-algebra homomorphism.Thus the following square Y + Y ) + Y Hj+Y / / HT Y + Y commutes, whence i • j = id.Proof of (2) ⇒ (1).Let (T Y, τ Y , (−) † ) be a free complete Elgot algebra on Y with a universal arrow η Y : Y −→ T Y .Then [τ Y , η Y ] : HT Y + Y −→ T Y is an isomorphism with an inverse i.We prove that (T Y, i) is a final coalgebra for H(−) + Y .So let c : X −→ HX + Y be any coalgebra, and form the flat equation morphism e ≡ X c / / HX + Y HX+η Y / / HX + T Y .
5.5) commutes for any flat equation morphism e : X −→ HX + T Y .Notice first that (f † • e) † = (f e) † • inl : X −→ T Y (5.6) by compositionality.Furthermore, we have a morphism [e † , T Y ] of equations from f e to f .In fact, the diagram below commutes: ') ⇒ (2).We only need to show the universal property.Suppose that (T Y, τ Y , (−) † ) is a free CIA on Y with a universal arrow η Y : Y −→ T Y .Due to the equivalence of (1) and (1'), [τ Y , η Y ] has an inverse i, and (T Y, i) is a final coalgebra for the functor H(−) + Y .Now let (A, α, (−) ‡ ) be a complete Elgot algebra and let m : Y −→ A be a morphism of A. Solve the following flat equation morphism g ≡ T Y i / / HT Y + Y HT Y +m / / HT Y + A in A to obtain a morphism h = g ‡ : T Y −→ A. We first check that h • η Y = m.In fact, h is a solution of g.Consider the right-hand component of the coproduct HT Y + Y to obtain the desired equation.Next let us show that h is a solution-preserving morphism.More precisely, we show that for any equation morphism e : X −→ HX + T Y the triangle

g
8)holds due to compositionality of (−) ‡ .Moreover, [e † , T Y ] is a morphism of equations from g e to g.In fact, consider the following commutative diagram By functoriality of (−) ‡ we obtain the equationg ‡ • [e † , T Y ] = (g e) ‡ Proof.See[M], Corollary 2.11 for (1) ⇔ (2).The equivalence (2) ⇔ (3) follows from Theorem 5.4.Theorem 5.8.If H is an iteratable functor, then the category Alg † c H of complete Elgot algebras is isomorphic to the Eilenberg-Moore category A T of T-algebras for the free completely iterative monad T of H.Proof.By Corollary 5.7, the natural forgetful functor U : Alg † c H −→ A has a left adjoint Y −→ T Y .Thus, the monad obtained by this adjunction is T. To prove that the comparison functor K : Alg † c H −→ A T is an isomorphism use Beck's Theorem.In fact, the argument that U creates coequalizers of U -split pairs is entirely analogous to that of Theorem 4.8.