A New Foundation for Finitary Corecursion The Locally FiniteFixpointand itsProperties StefanMilius1,⋆,DirkPattinson2,andThorstenWißmann1,⋆ 1 Friedrich-Alexander-Universita¨tErlangen-Nu¨rnberg 2 TheAustralianNationalUniversity Abstract. This paper contributes to a theory of the behaviour of “finite-state” systemsthatisgenericinthesystemtype.Weproposethatsuchsystemsaremod- eledascoalgebraswithafinitelygeneratedcarrierforanendofunctoronalocally finitelypresentablecategory.Theirbehaviourgivesrisetoanewfixpointofthe coalgebraictypefunctorcalledlocallyfinitefixpoint(LFF).Weprovethatifthe givenendofunctorpreservesmonomorphismsthentheLFFalwaysexistsandisa subcoalgebraofthefinalcoalgebra(unliketherationalfixpointpreviouslystudied byAda´mek,MiliusandVelebil).Moreover,weshowthattheLFFischaracterized by two universal properties: 1. as the final locally finitely generated coalgebra, and2.astheinitialfg-iterativealgebra.AsinstancesoftheLFFwefirstobtainthe knowninstancesoftherationalfixpoint,e.g.regularlanguages,rationalstreams andformalpower-series,regulartreesetc.Andweobtainanumberofnewexam- ples,e.g.(realtimedeterministicresp.non-deterministic)context-freelanguages, constructivelyS-algebraicformalpower-series(andanyotherinstanceofthegen- eralizedpowersetconstructionbySilva,Bonchi,Bonsangue,andRutten)andthe monadofCourcelle’salgebraictrees. 1 Introduction Coalgebrascapturemanytypesofstatebasedsystemwithinauniformandmathemati- callyrichframework[39].Oneoutstandingfeatureofthegeneraltheoryisfinalseman- ticswhichgivesafullyabstractaccountofsystembehaviour.Forexample,coalgebraic modellingofdeterministicautomata(withoutafinitenessrestrictiononstatesets)yields the set of all formallanguagesas a final model,and restricting to finite automataone preciselyobtainstheregularlanguages[38].Thiscorrespondencehasbeengeneralized tolocallyfinitelypresentablecategories[8,20],wherefinitelypresentableobjectsplay the role of finite sets, leading to the notion of rational fixpoint that provides final se- manticstoallmodelswithfinitelypresentablecarrier[31].Itisknownthattherational fixpointisfullyabstract(identifiesallbehaviourallyequivalentstates)aslongasfinitely presentableobjectsagreewithfinitelygeneratedobjectsinthebasecategory[12,Propo- sition3.12].Whilethisisthecaseinsomecategories(e.g.sets, posets,graphs,vector spaces, commutative monoids), it is currently unknown in other base categories that are used in the construction of system models, for example in idempotent semirings (usedinthetreatmentofcontext-freegrammars[43]),inalgebrasforthestackmonad ⋆SupportedbyDeutscheForschungsgemeinschaft(DFG)underprojectMI717/5-1 2 S.Milius,D.PattinsonandT.Wißmann (usedformodellingconfigurationsofstackmachines[23]);oritevenfails,forexample in the category of finitary monads on sets (used in the categorical study of algebraic trees[7]),orEilenberg-Moorecategoriesforamonadingeneral(thetargetcategoryof generalizeddeterminization[41],inwhichtheaboveexampleslive).Coalgebrasovera categoryofEilenberg-MoorealgebrasoverSetinparticularprovideaparadigmaticset- ting:automatathatdescribelanguagesbeyondtheregularlanguagesconsistofafinite state set, buttheirtransitionsproducesideeffectssuchasthemanipulationof astack. Thesecanbedescribedbyamonad,sothatthe(infinite)setofsystemstates(machine states plusstackcontent)isdescribedbya freealgebra(forthatmonad)thatisgener- atedbythefinitesetofmachinestates.Thisisformalizedbythegeneralizedpowerset construction[41]andinteractsnicelywiththecoalgebraicframeworkwepresent. Technically,the shortcomingof the rationalfixpointis due to the fact thatfinitely presentableobjectsarenotclosedunderquotients,sothattherationalfixpointitselfmay failtobeasubcoalgebraofthefinalcoalgebraandsoidentifiestoolittlebehaviour.The mainconceptualcontributionofthispaperistheinsightthatalsoincaseswherefinitely presentableandfinitelygenerateddonotagree,thelocallyfinitefixpointprovidesafully abstract model of finitely generated behaviour. We give a construction of the locally finite fixpoint, and support our claim both by general results and concrete examples: we show that under mild assumptions, the locally finite fixpointalways exists, and is indeed a subcoalgebraof the finalcoalgebra.Moreover,we give a characterizationof thelocallyfinitefixpointastheinitialiterativealgebra.Wetheninstantiateourresults toseveralscenariosstudiedintheliterature. First, we show that the locally finite fixpoint is universal (and fully abstract) for theclassofsystemsproducedbythegeneralizedpowersetconstructionoverSet:every determinizedfinite-state system inducesa uniquehomomorphismto the locally finite fixpoint,andthelattercontainspreciselythefinite-statebehaviours. Appliedtothecoalgebraictreatmentofcontext-freelanguages,weshowthatthelo- callyfinitefixpointyieldspreciselythecontext-freelanguages,andreal-timedetermin- istic context-freelanguages,respectively,when modelled using algebrasfor the stack monad of [23]. For context-free languages weighted in a semiring S, or equivalently for constructively S-algebraic power series [36], the locally finite fixpoint comprises preciselythose,byphrasingtheresultsofWinteretal.[44]intermsofthegeneralized powersetconstruction.Ourlastexampleshowstheapplicabilityofourresultsbeyond categories of Eilenberg-Moore algebras over Set, and we characterize the monad of Courcelle’s algebraic trees over a signature [16, 7] as the locally finite fixpointof an associatedfunctor(onacategoryofmonads),solvinganopenproblemof[7]. Theworkpresentedhereisbasedonthethirdauthor’smasterthesisin[45].Most proofsareomitted;theycanbefoundintheappendix. 2 Preliminaries andNotation Locallyfinitelypresentablecategories.A filteredcolimit isthecolimitofadiagram D → C where D is filtered (everyfinite subdiagramhas a coconein D) anddirected if D is additionally a poset. Finitary functors preserve filtered (equivalently directed) colimits. Objects C ∈ C are finitely presentable (fp) if the hom-functorC(C,−) pre- TheLocallyFiniteFixpointanditsProperties 3 serves filtered (equivalently directed) colimits, and finitely generated (fg) if C(C,−) preservesdirectedcolimitsofmonos(i.e.colimitsofdirecteddiagramswhereallcon- nectingmorphismsaremonic).Clearlyanyfpobjectisfg,butnotviceversa.Also,fg objectsareclosedunderstrongepis(quotients)whichfailsforfpobjectsingeneral.A cocomplete category is locally finitely presentable (lfp) if the full subcategory C of fp finitelypresentableobjectsisessentiallysmall,i.e.isuptoisomorphismonlyaset,and every object C ∈ C is a filtered colimit of a diagram in C . We refer to [20, 8] for fp furtherdetails. Itis wellknownthatthe categoriesofsets, posets andgraphsare lfp with finitely presentableobjectspreciselythefinitesets,posets,graphs,respectively.Thecategoryof vectorspacesislfpwithfinite-dimensionalspacesbeingfp.Everyfinitaryvarietyislfp (i.e.anequationalclassofalgebrasinducedbyfinite-arityoperationsorequivalentlythe Eilenberg-MoorecategoryforafinitarySet-Monad,seeSection4.1later).Thefinitely generatedobjectsarethefinitelygeneratedalgebras,andfinitelypresentableobjectsare algebrasspecifiedbyfinitelymanygeneratorsandrelations.Thisincludesthecategories ofgroups,monoids,(idempotent)semirings,semi-modules,etc.Everylfpcategoryhas mono/strongepifactorization[8,Proposition1.16],i.e.everyf factorsasf =m·ewith mmono(denotedby),estrongepi(denotedby։),andwecallthedomainIm(f) ofetheimageoff.Anystrongepiehasthediagonalfill-inproperty,i.e.m·g =h·e withmmonoandestrongepigivesauniquedsuchthatm·d=handg =d·e. Coalgebras. If H : C → C is an endofunctor, H-coalgebras are pairs (C,c) with c : C → HC, and C is the carrier of (C,c). Homomorphismsf : (C,c) → (D,d) are maps f : C → D such that Hf · c = d · f. This gives a category denoted by CoalgH. If its final object exists then this final H-coalgebra (νH,τ) represents a canonical domain of behaviours of H-typed systems, and induces for each (C,c) a unique homomorphism,denoted by c†, giving semantics to the system (C,c). The fi- nal coalgebra always exists provided C is lfp and H is finitary. The forgetfulfunctor CoalgH →Ccreatescolimitsandreflectsmonosandepis.Amorphismf inCoalgH is mono-carried(resp.epi-carried)iftheunderlyingmorphisminC ismonic(resp.epic). Strong epi/mono factorizations lift from C to CoalgH whenever H preserves monos yieldingepi-carried/mono-carriedfactorizations.Adirectedunionofcoalgebrasisthe colimit of a directed diagram in CoalgH where all connecting morphisms are mono- carried. The Rational Fixpoint. For C lfp and H : C → C finitary let Coalg H denote the fp full subcategoryof CoalgH of coalgebraswith fp carrier, and Coalg H the full sub- lfp categoryof CoalgH of coalgebrasthatarise as filtered colimits of coalgebraswith fp carrier[31,CorollaryIII.13].ThecoalgebrasinCoalg H arecalledlfpcoalgebrasand lfp forC =Setthosearepreciselythelocallyfinitecoalgebras(i.e.thosecoalgebraswhere everyelementiscontainedinafinitesubcoalgebra).Thefinallfpcoalgebraexistsand isthecolimitoftheinclusionCoalg H ֒→ CoalgH,anditisafixpointofH (see[6]) fp calledtherationalfixpointofH.Herearesomeexamples:therationalfixpointofapoly- nomialsetfunctorassociatedtoafinitarysignatureΣ isthesetofrationalΣ-trees[6], i.e. finite and infinite Σ-treeshaving,up to isomorphism,finitely manysubtreesonly, andoneobtainsrationalweightedlanguagesforNoetheriansemiringsS fora functor onthecategoryofS-modules[12],andrationalλ-treesforafunctoronthecategoryof 4 S.Milius,D.PattinsonandT.Wißmann presheavesonfinitesets[2]orforarelatedfunctoronnominalsets[34].Iftheclasses of fp and fg objects coincide in C, then the rational fixpoint is a subcoalgebra of the finalcoalgebra[12,Theorem3.12].Thisisthecase intheaboveexamples,butnotin general,see[12,Example3.15]foraconcreteexamplewheretherationalfixpointdoes not identifybehaviourallyequivalentstates. Conversely,even if the classes differ,the rationalfixpointcanbeasubcoalgebra,e.g.foranyconstantfunctor. Iterative Algebras. If H : C → C is an endofunctor,an H-algebra (A,a : HA → A) is iterative if every flat equation morphism e : X → HX + A where X is an fp object has a unique solution, i.e. if there exists a unique e† : X → A such that e† = [a,id ]·(He†+id )·e.Therationalfixpointisalsocharacterizedastheinitial A A iterative algebra [6] and is the starting point of the coalgebraic approach to Elgot’s iterativetheories[18]andtotheiterationtheoriesofBloomandE´sik[11,6,3,4]. 3 The LocallyFiniteFixpoint Thelocallyfinitefixpointcanbecharacterizedsimilarlytotherationalfixpoint,butwith respecttocoalgebraswithfinitelygenerated(notfinitelypresentable)carrier.Weshow thatthelocallyfinitefixpointalwaysexists,andisasubcoalgebraofthefinalcoalgebra, i.e. identifies all behaviourally equivalent states. As a consequence, the locally finite fixpointprovidesafullyabstractnotionoffinitelygeneratedbehaviour.Fromnowon, werelyonthefollowing: Assumption3.1. ThroughouttherestofthepaperweassumethatC isanlfpcategory andthatH :C →C isfinitaryandpreservesmonomorphisms. As forthe rationalfixpoint,we denotethefullsubcategoryofCoalgH comprisingall coalgebraswith finitely generatedcarrier by Coalg H and have the followingnotion fg oflocallyfinitelygeneratedcoalgebra. x Definition3.2. AcoalgebraX −→ HX iscalled locallyfinitelygenerated(lfg)iffor all f : S → X with S finitely generated, there exist a coalgebra p : P → HP in Coalg H,acoalgebramorphismh:(P,p)→(X,x)andsomef′ :S →P suchthat fg h·f′ =f.Coalg H ⊆CoalgH denotesthefullsubcategoryoflfgcoalgebras. lfg Equivalently, one can characterize lfg coalgebras in terms of subobjects and subcoal- gebras, making it a generalization of of local finiteness in Set, i.e. the property of a coalgebrathateveryelementiscontainedinafinitesubcoalgebra. x f Lemma3.3. X −→HX isanlfgcoalgebraiffforallfgsubobjectsS X,thereexist asubcoalgebrah:(P,p)(X,x)andamonof′ :S P withh·f′ =f,i.e.S is asubobjectofP. Proof. (⇒) Given some mono f : S X, factor the induced h into some strong epi-carriedandmono-carriedhomomorphismsandusethatfgobjectsareclosedunder strongepis.(⇐)Factorf :S →X intoanepiandamonog :Im(f)X andusethe diagonalfill-inpropertyforg. ⊓⊔ TheLocallyFiniteFixpointanditsProperties 5 Evidentlyall coalgebraswith finitely generatedcarriersare lfg. Moreover,lfg coalge- brasarepreciselythefilteredcolimitsofcoalgebrasfromCoalg H. fg Proposition3.4. EveryfilteredcolimitofcoalgebrasfromCoalg H islfg. fg Proof (Sketch;forthefullproofseetheappendix).Onefirstprovesthatdirectedunions ofcoalgebrasfromCoalg H arelfg.Nowgivenafilteredcolimitc : X → C where fg i i X arecoalgebrasinCoalg H,oneepi-monofactorizeseverycolimitinjection:c = i fg i ( Xi ei Ti mi C ).UsingthediagonalizationofthefactorizationoneseesthattheTi formadirecteddiagramofsubobjectsofC.FurthermoreC isthedirectedunionofthe T andthereforeanlfgcoalgebraasdesired. ⊓⊔ i Proposition3.5. Everylfgcoalgebra(X,x)isadirectedcolimitofitssubcoalgebras fromCoalg H. fg Proof. Recallfrom[8,ProofIofTheorem1.70]thatX isthecolimitofthediagramof allitsfinitelygeneratedsubobjects.Nowthesubdiagramgivenbyallsubcoalgebrasof X iscofinal.Indeed,thisfollowsdirectlyfromthefactthat(X,x)isanlfgcoalgebra: for every subobject S X, S fg, we have a subcoalgebra of (X,x) in Coalg H fg containingS. ⊓⊔ Corollary3.6. The lfg coalgebras are precisely the filtered colimits, or equivalently directedunions,ofcoalgebraswithfgcarrier. Asaconsequence,acoalgebraisfinalinCoalg F ifthereisauniquemorphismfrom lfg everycoalgebrawithfinitelygeneratedcarrier. Proposition3.7. AnlfgcoalgebraLisfinalinCoalg H iffforeveryforeverycoalge- lfg braX inCoalg H thereexistsauniquecoalgebramorphismfromX toL. fg The proof is analogousto [31, Theorem 3.14];the full argumentcan be found in the Appendix.CocompletenessofC ensuresthatthefinallfgcoalgebraalwaysexists. Theorem3.8. ThecategoryCoalg H hasafinalobject,andthefinallfgcoalgebrais lfg thecolimitoftheinclusionCoalg H ֒→Coalg H. fg lfg Proof. By Corollary3.6, the colimit of the inclusion Coalg H ֒→ Coalg H is the fg lfg sameasthecolimitoftheentireCoalg H.Andthelatterisclearlythefinalobjectof lfg Coalg H. ⊓⊔ lfg Thistheoremprovidesaconstructionofthefinallfgcoalgebracollectingpreciselythe behavioursofthe coalgebraswithfgcarriers.Inthefollowingweshallshowthatthis constructiondoesindeedidentifypreciselybehaviourallyequivalentstates,i.e.thefinal lfg coalgebra is always a subcoalgebra of the final coalgebra. Just like fg objects are closed under quotients – in contrast to fp objects – we have a similar property of lfg coalgebras: Lemma3.9. Lfgcoalgebrasareclosedunderstrongquotients,i.e.foreverystrongepi carriedcoalgebrahomomorphismsX ։Y,ifX islfgthensoisY. 6 S.Milius,D.PattinsonandT.Wißmann The failure of this property for lfp coalgebras is the reason why the rational fixpoint is not necessarily a subcoalgebra of the final coalgebra and in particular the rational fixpointin[12,Example3.15]isanlfpcoalgebraforwhichthepropertyfails. Theorem3.10. ThefinallfgH-coalgebraisasubcoalgebraofthefinalH-coalgebra. Proof. Let(L,ℓ)be the finallfg coalgebra.Considerthe uniquecoalgebramorphism L→νH andtakeitsfactorization: id (L,ℓ) e (I,i) m (νH,τ) , withestrongepiinC. i† By Lemma3.9, I is an lfg coalgebra and so by finality of L we have the coalgebra morphismi†suchthatid =i†·e.Itfollowsthateismonicandthereforeaniso. ⊓⊔ L In other words, the final lfg H-coalgebra collects precisely the finitely generated be- haviours from the final H-coalgebra. We now show that the final lfg coalgebra is a fixpointofH whichhingesonthefollowing: c Hc Lemma3.11. ForanylfgcoalgebraC −→HC,thecoalgebraHC −−→HHC islfg. Proof. Consider f : S → HC with S finitely generated. As C is lfp we know that HC is the colimit of its fg subobjects, and so f : S → HC factors through some subobject in : Q HC with Q fg and f = in · f′. On the other hand, (C,c) q q is lfg, i.e. the directed union of its subcoalgebras from Coalg H. Then, since H is fg c finitaryandmono-preserving,HC −→HHCisalsoadirectedunionandthemorphism Hp in : Q → HC factors through some HP −−→ HHP with (P,p) ∈ Coalg H via q fg in :(P,p)(C,c),i.e.Hin ·q =in .Finally,wecanconstructacoalgebrawithfg p p q carrier [q,p] Hinr Q+P −−−→HP −−−→H(Q+P) andacoalgebrahomomorphismHin ·[q,p]:Q+P →HC.Inthediagram p f Hc S HC HHC Hinp HHinp f′ inq HP Hp HHP H(Hinp·[q,p]) q [q,p] H[q,p] inl [q,p] Hinr Q Q+P HP H(Q+P) everyparttriviallycommutes,soHin ·[q,p]isthedesiredhomomorphism. ⊓⊔ p SowithaproofinvirtuetoLambek’sLemma[28,Lemma2.2],weobtainthedesired fixpoint: Theorem3.12. ThecarrierofthefinallfgH-coalgebraisafixpointofH. We denote the above fixpoint by (ϑH,ℓ) and call it the locally finite fixpoint (LFF) of H. In particular,the LFF always exists under Assumption3.1, providinga finitary corecursionprinciple. TheLocallyFiniteFixpointanditsProperties 7 3.1 IterativeAlgebras Recall from [6, 31] that the rational fixpoint of a functor H has a universal property bothasacoalgebraandasanalgebraforH.Thissituationiscompletelyanalogousfor the LFF. We already established its universalpropertyas a coalgebrain Theorem3.8. NowweturntostudytheLFFasanalgebraforH. Definition3.13. AnequationmorphismeinanobjectAisamorphismX →HX+A, whereX isafinitelygeneratedobject.IfAisthecarrierofanalgebraα : HA → A, we callthe C-morphisme† : X → Aasolutionofe if[α,id ]·He† +id ·e = e†. A A An H-algebra A is called fg-iterative if every equation morphism in A has a unique solution. Example3.14 (see [30, Example 2.5 (iii)]). The final H-coalgebra (considered as an algebraforH)isfg-iterative.Infact,inthisalgebraevenmorphismsX →HX+νH whereX isnotnecessarilyanfgobjecthaveauniquesolution. Definition3.15. For fg-iterative algebrasA andC, an equationmorphism e : X → HX +A anda morphism h : A → C of C defineanequationmorphism h•e in C as X e HX +AHX+hHX+C. Wesaythathpreservesthesolutione† of eifh·e† = (h•e)†.Themorphismhiscalledsolutionpreservingifitpreservesthe solutionofanyequationmorphisme. Similarlyto[6],thealgebrahomomorphismsarepreciselythesolutionpreservingmor- phismsbetweeniterativealgebras,theproofisalsoverysimilar. Proposition3.16. Thelocallyfinitefixpointisfg-iterative. Proof (Sketch).Onecantransforme:X →HX+ϑHintoanlfgcoalgebraonX+ϑH. Then one shows that there is a one-to-one correspondence between homomorphisms intoϑH andsolutionsofeinthealgebraℓ−1 :H(ϑH)→ϑH bydiagramchasing. ⊓⊔ Theorem3.17. For an fg-iterative algebra α : HA → A and an lfg coalgebra e : X →HX thereisauniqueC-morphismu :X →Asuchthatu =α·Hu ·e. e e e Corollary3.18. Thelocallyfinitefixpointistheinitialfg-iterativealgebra. 3.2 RelationtotheRationalFixpoint Thereareexamples,wheretherationalfixpointisnotasubcoalgebraofthefinalcoal- gebra.Incategories,wherefpandfgobjectscoincide,therationalfixpointandtheLFF coincideaswell(cf.therespectivecolimit-constructioninSection2andTheorem3.8). Inthissectionwewillsee,underslightlystrongerassumptions,thatfg-carriedcoalge- brasarequotientsoffp-carriedcoalgebras,andinparticularthelocallyfinitefixpointis aquotientoftherationalfixpoint:namelyitsimageinthefinalcoalgebra. 8 S.Milius,D.PattinsonandT.Wißmann Assumption3.19. In additiontoAssumption3.1, assume thatin the basecategoryC, everyfinitelypresentableobjectisastrongquotientofafinitelypresentablestrongepi projectiveobjectandthattheendofunctorH alsopreservesstrongepis. Theconditionthateveryfgobjectisthestrongquotientofastrongepiprojectiveoften isphrasedashavingenoughstrongepiprojectives[14].Thisassumptionisapparently verystrongbutstillismetinmanysituations: Example3.20. – Incategoriesinwhichall(strong)episaresplit,everyobjectispro- jectiveandanyendofunctorpreservesepis,e.g.inSetorVec . K – InthecategoryoffinitaryendofunctorsFun(Set),allpolynomialfunctorsarepro- f jective.ThefinitelypresentablefunctorsarequotientsofpolynomialfunctorsH , Σ whereΣ isafinitesignature. – IntheEilenberg-MoorecategorySetT forafinitarymonadT,strongepisaresur- jectiveT-algebrahomomorphisms,andthuspreservedbyanyendofunctor.InSetT, everyfreealgebraTX isprojective;thisiseasytoseeusingtheprojectivityofX in Set. Every finitely generated object of SetT is a strong quotient of some free algebraTX withX finite.Formoreprecisedefinitions,seeSection4.1later. Proposition3.21. Every coalgebra in Coalg H is a strong quotient of a coalgebra fg withfinitelypresentablecarrier. Theorem3.22. ϑH istheimageoftherationalfixpoint̺H inthefinalcoalgebra. Proof. Consider the factorization (̺H,r) ։e (B,b) m (νH,τ). Since ̺H is the colimit of all fp carried H-coalgebras it is an lfg coalgebra by Proposition3.4 us- ing that fp objects are also fg. Hence, by Lemma3.9 the coalgebra B is lfg, too. By Proposition3.7itnowsufficestoshowthatfromevery(X,x)∈Coalg H thereexists fg auniquecoalgebramorphisminto(B,b).Given(X,x)inCoalg H,itisthequotient fg q : (P,p) ։ (X,x) of an fp-carried coalgebra by Proposition3.21. Hence, we ob- tainauniquecoalgebramorphismp† : (P,p) → (̺H,r). ByfinalityofνH,wehave m·e·p† =x†·q(withx† :(X,x)→(νH,τ)).Sothediagonalfill-inpropertyinduces ahomomorphism(X,x)→(B,b),beingtheonlyhomomorphism(X,x)→(B,b)by thefinalityofνH andbecausemismonic. ⊓⊔ 4 Instances ofthe LocallyFiniteFixpoint We will now present a numberof instances of the LFF. First note, that all the known instances of the rational fixpoint(see e.g. [6, 31, 12] are also instances of the locally finitefixpoint,becauseinallthosecasesthefpandfgobjectscoincide.Forexample,the classofregularlanguagesistherationalfixpointof2×(−)ΣonSet.Inthissection,we willstudyfurtherinstancesoftheLFFthataremostlikelynotinstancesoftherational fixpointandwhich–to thebestofourknowledge–havenotbeencharacterizedbya universalpropertyyet: 1. Behavioursoffinite-statemachineswithside-effectsasconsideredbythegeneral- izedpowersetconstruction(cf.Section4.1),particularlythefollowing. TheLocallyFiniteFixpointanditsProperties 9 (a) Deterministicandordinarycontext-freelanguagesobtainedasthebehaviours ofdeterministicandnon-deterministicstack-machines,respectively. (b) ConstructivelyS-algebraicformalpowerseries,i.e.the“context-free”subclass ofweightedlanguageswithweightsfromasemiringS,yieldedfromweighted context-freegrammars. 2. ThemonadofCourcelle’salgebraictrees. 4.1 GeneralizedPowersetConstruction Thedeterminizationofanon-deterministicautomatonusingthepowersetconstruction is an instance of a more general framework, described by Silva, Bonchi, Bonsangue, and Rutten [41] based on an observation by Bartels [10] (see also Jacobs [26]). In that generalized powerset construction, an automaton with side-effects is turned into anordinaryautomatonbyinternalizingtheside-effectsinthestates.TheLFFinteracts wellwith thisconstruction,becauseitpreciselycapturesthebehavioursoffinite-state automatawithsideeffects.Thenotionofside-effectisformalizedbyamonad,which inducesthecategory,inwhichtheLFFisconsidered. In the following we assume that readers are familiar with monads and Eilenberg- Moorealgebras(seee.g.[29]foran introduction).Fora monadT onC wedenoteby CT thecategoryofEilenberg-Moorealgebras.Recallfrom[8,Corollary2.75]thatifC is lfp(in most of ourexamplesC is Set) andT is finitary thenCT is lfp, too,and for everyfpobjectX thefreeEilenberg-MoorealgebraTXisfpinCT.Inalltheexamples we consider below, the classes of fp and fg objects either provablydiffer or it is still unknownwhethertheseclassescoincide. Example4.1. InSections4.4and4.5wearegoingtomakeuseofMoggi’sexception monad transformer(see e.g. [15]). Let us recall that for a fixed object E, the finitary functor (−)+E togetherwith the unit η = inl : X → X +E and multiplication X µ =id +[id ,id ]: X +E+E →X +E formafinitarymonad,theexception X X E E monad. Its algebras are E-pointed objects, i.e. objects X, together with a morphism E → X,andhomomorphismsaremorphismspreservingthepointing.Sotheinduced Eilenberg-MoorecategoryisjusttheslicecategoryC(−)+E ∼=E/C. Now,givenanymonadT weobtainanewmonadT(−+E)withobviousunitand multiplication. An Eilenberg-Moore algebra for T(−+ E) consists of an Eilenberg- MoorealgebraforT andanE-pointing,andhomomorphismsareT-algebrahomomor- phismspreservingthepointing[25]. Now an automaton with side-effects is modelled as an HT-coalgebra, where T is a finitarymonadonCprovidingthetypeofside-effect.Forexample,forHX =2×XΣ, where Σ is an input alphabet, 2 = {0,1} and T the finite powerset monad on Set, HT-coalgebras are non-deterministic automata. However, the coalgebraic semantics using the final HT-coalgebra does not yield the usual language semantics of non- deterministicautomata.To obtainthisoneconsidersthefinalcoalgebraofa liftingof H toCT.DenotebyU :CT →C thecanonicalforgetfulfunctor. Definition4.2. ForafunctorH : C → C andamonadT : C → C,aliftingofH isa functorHT :CT →CT suchthatH ·U =U ·HT. If such a (not necessarily unique) lifting exists, the generalized powerset construc- tion transforms an HT-coalgebra into a HT-coalgebra on CT: For a coalgebra x : 10 S.Milius,D.PattinsonandT.Wißmann X → HTX, HTX carries an Eilenberg-Moore algebra, and one uses freeness of theEilenberg-MoorealgebraTX toobtainacanonicalT-algebrahomomorphismx♯ : (TX,µT) → HT(TX,µT). The coalgebraic language semantics of (X,x) is then givenbyX −η−X→ TX−x−♯→† νHT, i.e.bycomposingtheuniquecoalgebramorphismin- ducedbyx♯ withη .ThisconstructionyieldsafunctorT′ :Coalg(HT)→CoalgHT X mapping coalgebras X −→x HTX to x♯ and homomorphisms f to Tf (see e.g. [12, ProofofLemma3.27]foraproof). NowouraimistoshowthattheLFFofHT characterizespreciselythecoalgebraic languagesemanticsofallfp-carriedHT-coalgebras.As therightadjointU preserves monosandisfaithful,weknowthatHT preservesmonos,andasT isfinitary,filtered colimitsinCT arecreatedbytheforgetfulfunctortoC,andwethereforeseethatHT is finitary.Thus,byTheorem3.8,ϑHT existsandisasubcoalgebraofνHT.By[37]and [10,Corollary3.4.19],weknowthatνHT iscarriedbyνH equippedwithacanonical algebrastructure. Nowlet usturnto the desiredcharacterizationofϑHT. Formally,the coalgebraic languagesemanticsofallfp-carriedHT-coalgebrasiscollectedbyformingthecolimit k : K → HK ofthediagramCoalg HT −T→′ CoalgHT −U→ CoalgH.Thiscoalgebra fg K is not yet a subcoalgebra of νH (for C = Set that means, not all behaviourally equivalentstatesareidentifiedinK),buttakingitsimageinνH weobtaintheLFF: Proposition4.3. Theimage(I,i)oftheuniquecoalgebramorphismk† : K → νHT ispreciselythelocallyfinitefixpointoftheliftingHT. Onecanalsodirectlytaketheunionofalldesiredbehaviours,forC =Set: Theorem4.4. The locally finite fixpointof the lifting HT comprises precisely the im- agesofdeterminizedHT-coalgebras: ϑHT = x♯†[TX]= x♯†·ηT[X]⊆νHT. (1) X x:X→HTX x:X→HTX X[finite X[finite Thisresultsuggeststhatthelocallyfinitefixpointistherightobjecttoconsiderinorder torepresentfinitebehaviour.Wenowinstantiatethegeneraltheorywithexamplesfrom theliteraturetocharacterizeseveralwell-knownnotionsasLFF. 4.2 TheLanguagesofNon-deterministicAutomata Let us start with a simple standard example.We alreadymentioned that non-determi- nisticautomataarecoalgebrasforthefunctorX 7→2×P(X)Σ.HencetheyareHT- f coalgebrasforH =2×(−)Σ andT =P thefinitepowersetmonadonSet.Theabove f generalizedpowersetconstructiontheninstantiatesastheusualpowersetconstruction thatassignstoagivennon-deterministicautomatonitsdeterminization. Now note that the final coalgebra for H is carried by the set L = P(Σ∗) of all formallanguagesoverΣwiththecoalgebrastructuregivenbyo:L→2witho(L)=1 iffLcontainstheemptywordandt : L → LΣ witht(L)(s) = {w | sw ∈ L}theleft languagederivative.ThefunctorH hasacanonicalliftingHT ontheEilenberg-Moore categoryofP,viz.thecategoryofjoinsemi-lattices.ThefinalcoalgebraνHT iscarried f by all formallanguageswith the join semi-lattice structure given by union and ∅ and