You are on page 1of 28
Journal of Pure and Applied Algebra 83 (1992) 295-321 295 North-Holland Enriched categorical semantics for distributed calculi* Stefano Kasangian Dipartimento di Matematica, Universita di Milano, Milano, Italy Anna Labella Dipartimento di Matematica, Universita di Roma ‘La Sapienza’, Roma, Italy Communicated by GM. Kelly Received 8 February 1989 Revised 8 August 1990 Abstract Kasangian, S, and A. Labella, Enriched categorical semantics for distributed calculi, Journal of Pure and Applied Algebra 83 (1992) 295-321 Algebraic models for distributed computations, synchronization and concurrency describe computations distributed among agents performing “local” tasks and sheir interactions as well, which allow sharing and exchanging information for the solution of a common problem. Many calculi have been introduced for this purpose, like for instance Milner’s CCS and SCCS In our approach, we describe composition of computations as a tensor product in a suitable monoidal category, generalizing the free monoid generated by the alphabet A of elementary actions, The interaetive aspect, namely the synchronization operation, is given by a monoidal funetor +, which by its very definition exhibits the interchange law between the {Wo operations. Several examples of this kind of monoidal category are introduced, ‘The typical one, treated in full detail, is the topos BT of budding trees, constructed out of the topos of labelled A-trees ‘T/F(A) and the (base) monoidal closed category of nice trees NT, which provides the semantics of computations, and several process semantics 2s categories enriched over it. Good semantics are characterized in terms of a notion of hereditary fullness and computations are synchronized considering the ‘effect’ of the monoidal funcior *, ILis then pussible to describe operators such as relabelling, restriction and insertion-deletion of an idle move, showing that our set-up covers the classical semantics for synchronization calcul, like for instance Milner's CCS and Bergstra and Klop’s synchronization algebras. Further, we introduce a distinction between those structures (and properties) which make sense at the level of computations and those which ‘occur at the level of process semantics. Although the stress is generally on the enriched- categorical structure, nice topos-theoretical aspects arise, connected with Bénabou's work on the topos of trees, Correspondence to: Professor 8. Kasangian, Dipartimento di Matematica, Universita di Milano, Via . Saldini 50, 20133 Milano, Italy. * The Australian Research Grant Scheme and the Progetto finalizzato ‘Sistemi Informativi e Calcolo Parallelo” (CNR) gave financial support to this research, (0022-4049 92/$05.00 © 1992 Elsevier Science Publishers BL. All rights reserved 296 8. Kasangian, A. Labella Introduction The study of algebraic models for dis and concurrency is considered as one of the important areas in theoreti computer science for its relevant feed-back to the design and development of parallel computing systems. Several calculi have been proposed to model synchronization, often with different primitives, according to different intuitions about the kind of communi- cation among processes and even about the notion of time involved. In particular, we would like to quote [1, 4, 7, 9, 11, 15, 27] Some efforts have been devoted recently to a comparison between approaches, as for instance in [4, 27]. In particular, a categorical framework was introduced in 28] and [23} The aim of the present work is to provide a comprehensive treatment of synchronization among computing agents, in the framework of fopos theory and ributed computations, synchronization cal using extensively enriched categorical tools. ith the current terminology (see for example [26]), we mean by of elementary actions (words in a In agreement process an agent which can perform sequence free monoid) becoming thence another agent (je. another process) The ‘possible future’ of an agent, i.c. the whole ramified structure of the actions that it may perform, is called its behaviour. Hence agents are thought of as black boxes performing ‘computations’: we call computation between two agents X and U the fragment of the behaviour of X by which it becomes U. In other words, it is the fragment afier which X can perform only the actions of U. behaviour of X behaviour of U he situation has some analogies with automata theory, where behaviours and ‘computations’ between two states of an automaton are regular languages, which are studied in their own right Enriched categorical semantics 207 Here we make a distinction between a ‘semantics of computations’ (also level 0 tics) and ‘semantic of processes’ (level 1 semantics): namely by ‘semantics we mean a ‘world’ of agents, with computing capabilities and able to cooperate via an interaction calculus of some kind, and by ‘semanties of computa sem of processes tions’ we mean a ‘world’ of computations, where all the operations involved are actually executed and can be profitably observed It will turn out that semantics of processes are categories (whose objects are the agents) enriched in a suitable monoidal category of computations (the level 0 semantics) [18, 22]. In other words, computations, thought of as objects of morphisms between two agents, are objects of a monoidal category. The fun- damental operations will be defined on the base monoidal category and then lifted to semantics of processes (the actual models of our structures), i.e. to the enriched categories The objects of the category of computations considered in the present paper are a special kind of trees and the category will tum out to be monoidal closed because of the very nature of computations, which are composable, and such that between two of them the hom is still a computation, as explained above. The underlying morphisms of the category will be defined according to the particular kind of observations we allow on computations, determining the specific nature of the base monoidal category. For instance, in [5] the enrichment of automata in the monoidal category of languages is described (see Section 3.1), whereas forthcoming work by the present authors, still in the sense of generalized logic [24], considers nondeterministic observations of computations in continuous time lig). In the present case we get a category NT whose objects are labelled trees expressing the kind of nondeterminism our observations involve, namely the possibility of further choices made while the computation is going on. Morphisms. take account of the depths of the nodes and of the choices available at each node If we represent strings of actions from an alphabet A as concatenated segments and choices as bifurcations, there will be a morphism between the two following computations: which identifies the two nodes of depth one in the first tree, sinee the choices available at cach step of the first computation are included in those available at the corresponding nodes of the second one. A morphism exists also between the two following one: 298 S. Kasangian, A, Labella where the choices available at each step for the first computation are less than the corresponding ones in the second computation, even if their multiplicity is higher This idea of nondeterminism is related to the one in [26] The composition of computations in the base monoidal category corresponds to concatenation of trees, the actual tensor product of the category. Given trees S and T, they are concatenated attaching a ‘bunch’ of copies of T to each ‘budding’ node of S, according to a multiplicity (possibly 0) assigned to cach node of S In the limit case of determinism (see Section 3.1), behaviours are just sets of strings of actions. In this case no further choice can be made once a string of actions has been selected at the beginning. Morphisms are inclusions among sets of strings (languages), but they correspond to the same intuition as in the previous case. To complete our sketchy description of the semantics of computations, we still have to give an indication about the kind of cooperations we allow among agents, namely a synchronization, essentially in the sense of Milner (27, 28]. This means that we assume (for the moment) that time flows bitwise and allows a single action to be performed at each bit. Hence the synchronization operation must be definable from a partial operation on the free monoid F(A) of actions of an alphabet A. This operation is actually defined on generators (atomic actions) and then extended in the obvious way to pairs of words of the same length In fact, we are given a table such as (see [15]): and we extend it to a partial operation on the free monoid F(A) by imposing (ajay +++ a,) *(B,b3 +++ b,) = (a, * a, * by) (a, * By) 1, otherwise the result is undefined. Given whenever a,* b, is defined for 1 any table of synchronization on the generators of the monoid of actions, it i Enriched categorical semantics 299 possible to define a monoidal functor &:NTXNTNT between the monoidal categories NT x NT and NT, which represents the cotre- sponding operation at the level of computations, ic. in the category NT. In Sections | and 2 we introduce and give a detailed description of the topos of labelled A-trees T/ F(A), of the topos (and monoidal category) of labelled budding trees BY and of the (base) monoidal closed category of nice trees NT which provide the semantics of computations and several process semantics enriched over it. As particular case, BT and NTT itself are thought of as semantics, enriched in NT. Furthermore, we are able to describe, in connection with semantics, operators such as relabelling, restriction and insertion—deletion of an idle move, in order to show in Section 3 that our set-up covers the algebraic semantics for the synchronization calculi like CCS, defined for example in [27] and [4]. Moreover, we make a distinction between those structures (and properties) which make sense at the level of computations and those which occur at the level of process semantics. 1. The topos of trees and a monoidal category of computations It is well known that the topos of forests is equivalent to the topos of rooted trees [3] and that they are both equivalent to the topoi of contractions (forests) and contractions with a unique fixed point (trees). The objects of the latter are sets X with an ultimately constant endofunction f: XX with unique fixed point, i.e. an endofunction and a unique xy in X such that for all x in X there is an nin N with f"(x) = x). We have in fact as an immediate consequence that for all and for all x#x9, f"(x)#x (no loops) and that f(x,)= xy (rootedness). This notion will be the starting point for our definition of ‘labelled budding trees’ Less informally, let us denote by T the topos of trees, with as objects sets X with an ultimately constant endofunction f : ¥— X with unique fixed point and whose morphisms are equivariant functions (X, f)—>(Y, g) reflecting the fixed point, i.e. functions @ : X—> Y such that (i) bf=g¢, (ii) dy) = xy) This topos has been introduced and extensively studied (in the equivalent version of a presheaf topos) in [3]. The initial object is the singleton, denoted by +, with the identity endofunction (e, 1,), the terminal one is the tree (actually a chain) of natural numbers together with the ‘predecessor’ endofunction. Next, let us call ‘topos of labelled trees’ the slice topos T/ F(A), where F(A) is the free monoid on the alphabet A, considered as a contraction with endofunction E: F(A) > F(A) defined by erasing the rightmost letter of any word in F(A). The 300 S. Kasangian, A. Labella fixed point is of course e, the unit of the monoid F(A). The objects are then given by triples X=(X, f, Ly), where Ly is a labelling morphism from (X, f) to (F(A), E) and the morphisms. :(X, f, by) (Y, 8, Ly) are functions : X— Y satisfying (i), (ii) and (iii) Ly = Ly d as in the following picture: ; Which can in particular that L(x) = €. Ly'(e) = {Xp} and Ly f= El be rephrased this way: if Ly(x)=s, then for all x" Gf '(x) we ha for some a€ A i fr’) sd} § = Obviously X has to be thought of as the set of vertices of the tree, fis the usual function ‘child of’, the unique fixed point x, is the root of the tree and Ly labels vertices by words of the free monoid, so that the length of the word corresponds to the depth d(x) of the vertex x, measured by the number of edges, i.e. d(x) is the smallest n such that f"(x) = x9. Observe further that it makes sense to define as ‘leaves’ those elements of X’ belonging to the set Leav(X) = (X— f(X)} Let us give an example and draw a little picture, Example F%3) = HX ac. Let X be the set (x9. X10 X25 X50 Ta}s fg) =f) = FO) = to» ay, Ly(ty) =e Ly) =a, LyQt,)= by Ly(rs)= aa, LyQy) = Enriched categorical semanties 301 or more customarily since, by (iii), the labelling can be shifted from vertices to edges Observe also that by (iii) the image of a ‘path’ starting from the root of the tre X=(X, f, Ly) is the ‘same’ path in (Y, g, Ly), in the sense that it has the same length and labels Here the initial object is the tree (#14, ¢), where & denotes the labelling function sending « to the unit of the monoid F(A). The terminal object is of course F(A) viewed as a tree Since we view trees as unfolding of processes, we would like to be able to define as terminal nodes or ‘buds’ the nodes where ‘the process can stop’ and hence it can start again as a new one (i.e. it is possible to plug in another tree, possibly with multiplicity). Then in principle it might be the case that not all the leaves are terminal (we recover this way the notion of ‘unsuccessful’ stop [7]) Furthermore, we would like to be able to consider also nonteaf nodes as terminal ones. In other words, we want to assign a kind of ‘multiplicity’ (possibly zero) to cach node of the tree. Notice however that the notion of multiset does not suit us: to get the notion of multiplicity we need, it is not sufficient to assign a natural number to each node of the tree, but rather an indexing set. Morphisms should be defined accordingly. We are finally in the position to define the category of Labelled Budding Trees. Definition 2. The category BT of Labelled Budding Trees is defined as the comma category (Set/F(A)|U), where Set is the topos of sets and U is the forgetful functor from T/ F(A) as in the following diagram: 1: Set/ F(A) Set/F(A) —T/F(A): U . The objects ¥ of (Set/F(A)|U) are triples (X,, by : X, > X,X), where X= (X, f, Ly) is in T/F(A), X = UX is its image in Set/F(A), X, and by are the indexing set and morphism (both in Set/F(A)). Morphisms 6 are pairs (4, 4), where 6 : (X, f, Ly) (Y, g, Ly) is a morphism in T/F(A) and 6, : X,—> Y, isa morphism in Set/F(A), subject to the commutativity of the following diagram: >, x, X,—ex + “ ’ ’ i y, YoY «OY 302 S. Kasangian, A. Labella Remark 3. There are two objects in BT which are the ‘budding’ versions of the initial object ¢= (+, 1g, ¢) of T/F(A), namely 8 = (, Ze, 2), where @ is the initial object of Set/F(A) and @. the unique morphism to (s,e), and nil = ((e, €)s Iye,aye 8). Notice that 8 is in fact the initial object of BT, while the rdle and the importance of nil will be evident shortly. The terminal object in BT is F(A) = (Vyyays Vpqays F(A), where Ip) is the terminal object of Set/F(A) and F(A) is the labelled tree (F(A), Ey Lpqay) in T/F(A). Proposition 4, The comma category BT is @ topos. Proof. Since the forgetful functor U :'T/ F(A) Set/ F(A) is left exact, BT is in fact the ‘Artin glueing’ of T/F(A) and Set/F(A), hence a topos (see [16]). Ol Remark 5, The sum of two trees in BT is their union, modulo the identification of their roots like in the following picture Remark 6, Observe that there is a very natural notion of concatenation of budding trees which generalizes the concatenation of languages of the free monoid, namely if # and Y are budding trees, with a specified set of terminal nodes, their concatenation is the tree obtained by ‘appending copies of @" to each terminal node of #, according to its multiplicity I Notice that if X,, is empty, then the concatenation of # with any tree 4 yields again %. Next we give a precise definition of concatenation and we show that it extends to a monoidal structure on BT as in the following theorem: Enriched categorical semantics 308 Theorem 7. BY is a monoidal category with respect to concatenation Proof. Let us define the bifunctor @:BTxBT—BY on the objects. Given objects = (X,, by |X, XX), with X= (X, f, Y) with ¥=(¥, g, Ly), we denote by ¥@Y the underlying ‘a over F(A) of their tensor product % ® %, defined by the following pushout (to be thought in Set/F(A)) >X+(X,*Y) where y, is the root of Y and X, * yy: X, =X, x1 X, x ¥ sends an element x in X, to the pair (x, yg). Observe now that X,Y is in fact the sum of R={(x, y)|y=yo} and C=((x, y)| y#yo} and that we can define fib, x 1: RX, sending (x, yo) to f(b,(x)). and 1% g: CX, x Y, sending (x, y) to (x, g(9)). The ultimately constant endofunction g’ + x, fon X ® Y is then defined by the universal property of the pushout above, as in the following diagram: yy 1 Nyy p.o. ‘ Xx Y¥ ————>V + (X,Y) Q) i x raping ders] —) X + (X, x Y) ———~—> X +, (% + Y) where q is the universal arrow from the sum to the pushout. Finally, the indexing set (X@Y), is X, x Y, and the indexing morphism yoy 1 (X@Y), > XB Y is just j.(X, x by). So: ¥@BY=((X@Y),, yay: (XBY),>X@Y,XBY), where X@Y=(X@Y, g' +x, fe Lyey)+ 304 S. Kasangian, A, Labetla ‘The definition extends to morphisms in the obvious way and it is straight- forward to check that nil acts as the unit for the tensor and that left and right unit and associativity isomorphisms satisfy the usual conditions. 0 Remark 8. This tensor product is nonsymmetric by its very definition, and in fact it can be viewed as a generalization of concatenation of regular languages (see Section 3, Example 1), Putting %=< in (1), one has 5@Y=6, so 6 is a left annihilator of the tensor. On the other hand, putting & = 6 in (1) the result is %@s=2X", where X denotes * ‘without its buds’, ie. = (@,By :B—> X,X). Notice also that the tensor product ® is right distributive with respect to sums, but certainly %® - does not preserve them: Following the analogy with regular languages, where left quotients (or deriva- tives) of languages provide the closed structure with respect to the concatenation tensor product, we wish to introduce an analogous notion for trees: just to get an intuition, let us assume, with a coarse simplification, that Y is contained in 2, possibly with multiplicity; we might define then [%, 2] as the part of ¥ consisting of labelled paths ‘leading to a (homomorphic) copy of 4". Here is an example y [% 2] It is of course possible to provide a precise definition in BT, but the reader can check that the result would not define a closed structure (i.e. -® Y does not have a right adjoint [%, -]): in order to obtain the latter, we need to consider the full subcategory of BT (to be denoted by NT, nice srees) given by WENT iff Vee X- {xo}, dn ENsuch that x = f"(b(x)), for anx € X, ‘As immediate consequence of the definition we have that b(X,) 2 Leav(X), i.e, all the leaves are buds. From now on we will focus on the category NT, neglecting BT and its pleasant topos structure. Notice however that BT will appear later on, in the present paper, as a remarkable example of ‘semantics’. The topos theoretical aspects of BT will be discussed in future papers: some pleasant features, however, can be mentioned even now. For instance, BT is isomorphic to a presheaf category. In fact, notice that BT = (Set/F(A)| U) is isomorphic to (Set| U)/F(A), which is a Enriched categorical semanties 305 topos since the forgetful functor preserves pullbacks, It has been observed by Carboni [8] that, in conditions more general than ours, the comma category is a presheaf topos. Of course this can be seen directly recalling the equivalence between T and Bénabou's topos of forests Set™ Proposition 9. NY is a coreflective subcategory of BY. Proof. To define the right adjoint n to the inclusion i, let us start from the underlying sets. If X is the underlying set of # EBT, then (with a little abuse of notation) n(X) = (xp) U (x EX | Bn EN with x= f"(b(a)), for x © X,} ‘The endofunction and the labelling are the obvious restrictions, yielding the tree n(X). So, n(%) = (X,, by, R(X). It is easy to check then the functoriality of n and the adjunction. 0 Observe that for #” = (@, By :D— X, X) we have n(X") = 6 Theorem 10. NT is @ monoidal closed category. Proof. Tensor product in NT (to be denoted still ® by abuse of notation) is defined by the composite: NP x NT—> BT x BT—— BT —— NT which satisfies the usual unit and associativity laws. Notice that in NT, 2 @ 6 = 6. Further, given any tree ¥ = (Y,. by: ¥,> YY) with ¥=(¥, g, Ly), the functor Y has a right adjoint [, -], where [Y, 2] denotes the internal hom for any Z,. bz: Z,— Z, Z), with Z=(Z,k, L,). Intuitively, the underlying set of [%, 2] is the largest subset Z' of Z which is closed under the action of k and which, seen as a tree with the labelling induced by L,, is such that there exists a morphism Z'® Y— ¥ with all the possible buds. Let us give a precise definition of [%, 2]. First, let us define [%, %] on the objects: if Y=6, then [6,2] F(A), the terminal object of NT. Otherwise, denoting by [Y, Z] the underlying set of [%, 2] and by C(z’) the ‘set of children’ of z' in Z, i.e. the set of z in Z such that there exists a k in N with z€f~‘(z'), we have: [Y, Z]= {zo} U{z © Z | there exist a 2" © Z with z' € C(z) and a morphism y : Y— €(5')} . where (5") is in NT, with endofunction and buds induced by those of # and labelling defined accordingly by a suitable ‘truncation’ (see figure on p. 306) 306 8. Kasangian, A. Labetta a €s') (3") The endofunction and the labelling of [Y, Z] are those induced as restr from k and L,, whereas the buds are given by the existing morphism y, namely: LY, Z],, = (y € (@INT) | there exists a 2" Z with y : Y> €(5")} and the indexing morphism by.) :[¥. Z], LY, Z] just assigns to each y its evaluation in yy, (0) It is straightforward to extend the definition to morphisms and verify the functoriality of [2% —] As for its adjointness to /, let us just sketch the construction, To each morphism (a, @,) : # @ Y—> ¥ we can associate a morphism (A, A,): %—>[%, F] as follows: the underlying function A of A is defined as ai: ¥— Z, which in fact factors through [Y,Z], while A,:X,>[¥,Z], is defined on x@X, as @.j(x,-) : Y~> C(a(by(x))). The other way around, given A‘ and Aj, such that X——“_> x [YZ] wf [y, Z], x Y > 72 bye zy Zia Enriched categorical semantics 307 we get a’ by the universal property of the pushout and a’,:X, x ¥,—> Z, is defined on the pair (x,y) in X,Y, as a(x. y)=(A,Q) (by) = a jx, (by) It is then easy to check that this correspondence is a natural isomorphism. Notice that NT is nora biclosed category, as it is easily seen by the fact that # ~ still does not preserve sums. This lack of distributivity on the left accounts for nondeterminism. Remark 1, Some particular instances of the adjunction are of interest, There is of course only one arrow from 6 @ # = 6 to & and correspondingly between 5 and [¥, Z]. Further, notice that since [6, 2] is the terminal object of NT, there is a bijection between arrows from %@6= 8 to F and arrows from # to [3, 2] Recall finally the bijection between arrows from nil@% = ¥ to ¥ and arrows from nil to [%, %], in particular for J =, In this case observe that the identity element j, : nil [, %] corresponds to the identity of 7. Notice finally that no morphism exists between nil and # if x, @by(X,). Remark 12. Observe that by (LY, Z],) 2 Leav([%, #]), i.e. that for the hom- objects between two trees all the leaves are buds (notice also that they have finite depth). In fact, as we observed introducing the definition of NT, it is possible to define the hom-objects between two trees even in BT and they are actually in NT. So, BT turns out to be enriched over NT. Recall, however, that BT fails to be closed. So far the monoidal structure on NT and the right distributivity of the tensor with respect to the sum express the computations an agent can do interactions, yielding what may be called a ‘local calculus’, In orde interaction calculus (or global calculus) we need now to extend to trees (still at the level of computations) the ‘synchronization’ partial operation described in the Introduction In order to define a synchronization functor «:NT x NT—NT, let us first describe a functor o : BT x BT BT n absence of to obtain an Definition 13. Yo% has as underlying labelled tree (in T/F(A)) the one defined via the following pullback (in T): XoY ——> dom(*) —> YY © Xx ¥ ——> aA*xa* LyX hy 308, S. Kasangian, A. Labelia where dom(#) is the tree of pairs of composable words, according to the given table (notice that words in a pair do have the same length) Its buds (in Set/F(A)) are defined by the following pullba k (in Set) (XoY), —> XoY yf X,% Y¥, —> Xx¥ ty y ‘This functor (which we will call later loose synchronization) with the obvious definition on morphisms induces the required functor, i.e. the synchronization * as the composite *: NT XNT—“> BT x BI—"> BT—*> NT Informally, each path ending with a bud in # is compared with all the analogous paths in 9 and the result is 8 unless the two paths have the same length and the partial operation * is actually defined on their labels, For this reason, synchroniza- tion turns out to be distributive with respect to the sum. Recalling now that NT XNT is actually a monoidal category with a tensor product defined componentwise starting from the tensor product of NT, we have the following proposition: Proposition 14. The synchronization bifunctor *:NV NTN is @ monoidal functor Proof. Observe first of all that nil nil =nil. It is then immediate that a natural transformation 9 (L*#Y)@(V#F)+(LOV)+*(Y@P) (4) is defined, for any ¢ in NT, satisfying the usual axioms (see [14]). C1 Remark 15 in general 7 is not an isomorphism. This is shown already on chains by the following very simple example: We will call condition (4) above the generalized interchange law since Enriched categorical semanties 309 where ##Y and V'«¥ are 6, since #Y and ¥,F have different lengths, but ® Vand Y BF have the same lengths and hence they might be synchronizable Remark 16. Besides the obvious equivalence relation on the objects of NT (or even of the topos T/F(A)) given by isomorphisms, one can define an equivalence relation, to be denoted by ><, on the objects (for instance) of T/ F(A), which is much closer to the and X, are equivalent whenever there is an object ¥ and a pair of morphisms 4, : X,> Y, satisfying the further condition ntuition of the computer scientist, as follows: nvo objects X, {ge 'G}= OC @) f= 12 We will see later how this equivalence can be used in modelling some algebras of processes 2. Semantics as enriched categories In Section 1 we viewed NT as semantics of computations. As we said in the Introduction, it is then natural to view an NT-enriched processes and computations among them. The homs between two processes are computations consisting actually of trees (and even just chains) labelled by elementary actions. In this section we will deal with the semantics corresponding to NT egory C as a category of 2.1. Synchronization So far we have an interaction calculus (global calculus) at the level of computations, as in Proposition 14 above. In order to extend it to pro semantics (or briefly just semantics), we observe that computations in an N’ category C are closed under composition but in general fail to be closed under the synchronization operation *, Hence, we wish to assign in a ‘sensible’ way & domain and a codomain to the object C(X,X')*C(Y, Y') which represents (whenever it is defined) the synchronization between the computations C(X, X’) and C(Y.Y'). The solution of this problem is provided by a straightforward application of the basic notion of ‘effect’ of a monoidal functor [14] In fact, let us recall that we can always define a category with the same objects of the product category € x C but enriched in the monoidal category NT x NT. ‘This is done again componentwise and, since there is no risk of confusion, we denote this NT x NP-category still by C x C. The effect of the monoidal functor *:NTXNT—NT is a functor #:NTX NP-Cat>NT-Cat which assigns to the NT x NT-category C x € the NT-category € x,,€ with the same objects and homs given by: ess x, (X,Y), Y)) COX, X)#C(Y, Y')- (5) 310 8. Kasangian, A, Labella Identity and composition are defined as usual, The situation is illustrated by the following picture NY X NT-Cat fx. NT x NT ———__——» NT The object CCX, X') in NT must be interpreted as the fragment of the local calculus by which the agent X becomes the agent X", and the same applies to C(Y, ¥’). Whenever two agents X and Y are put together in a pair (X, Y) subject to the interaction calculus determined by *, they become the agent (X’, Y') via the synchronized computation given by (5) above Definition 17. A semantics for a global calculus (NT,®,*) is an pait (C, oe), where C is an NT-category and a¢ : CX, CC is an NT-functor ‘The functor o¢ provides a ‘realization’ of the formal agents of C x, € (i.e. of the form (X, Y)) as actual agents existing in C Given NT-categories C and D, we need to characterize special NT-functors among the ones between them, namely those satisfying the following definition: Definition 18. An NT-functor F : C—> Dis called hereditarily full iff for any X in C and Y in D such that D(Y, F(X) is not the initial object of NT, there exists a family of objects {X;},<, in C such that (i) for all jin 1, F(X) = Y and (ii) the family of induced morphisms {C(X,,X)>D(Y, F(X))}ic; is epi- morphic in NT. (Recall that a family { f)},<, is epimorphic iff for all h,g and i € J, if hf, = gf, then h = g.) Informally, these conditions express the fact that F is ‘nonredundant’, in the sense that if we view the objects of C and D as processes, then the actions performed by a process which is in the image of F can also be performed by some process in its inverse image Remark 19. Notice that any tree can be also viewed as a small NT-category whose objects are the budding nodes and whose internal homs are the connecting arcs, which are chains and hence belong to NT. It is then easy to check that a morphism of trees %—> % can be seen as an NT-functor which moreover is surjective if it is hereditarily full Enriched categorical semantics au antics (C, o¢) is good if the NT-functor oj is hereditarily Notice that the monoidal ‘synchronization’ functor *: NT x NT NT induces an NT-functor o, :NTX,NT—NT at the level of semantics, which we will call tight synchronization, defined on the objects just as * but with NIX, NT(#, 9), (2", 4) =NI(X, £')#NT(Y, YSN Y HY) which holds precisely because * is a monoidal (and also a closed) functor (see [ap Remark 21. Observe that though the tight synchronization (NT, o,) is a seman- tics for the global calculus (NT, *), it is not a good semantics, ic. o, is not hereditarily full. In fact, it is impossible in general to get an epimorphic family {NT(L,, L)#NT(Y,, VY) NUE * YF *Y)) er as it is easily seen considering the case where %* Y, = 6 and 7,4, 48. Remark 22. If (C, a) is a semantics for (NT, ®,*), then there is a semantics (D, oy) for any subcategory D of C which is codomain of an NT-functor a@:C—D. This holds in particular for C=NT. In fact, the functor oy: DX, DD is defined as follows: oy = a.a¢-i, where i denotes the inclusion of Dx,D in Cx,¢. Let us now introduce some remarkable examples of semantics for a given synchronization. ‘As we noticed in Remark 12, BT is an NT-category in an obvious way. On BT we defined a loase synchronization. This functor turns out to be an NT-functor o : BY X, BT BT. Informally, each path of # is compared with all the paths of %, but (differing from the tight synchronization), two paths with different length are synchronized until ‘it is possible’, i.e. until the operation is defined or the shortest path ends Let us now define an NT-category BY’ obtained from BT by excluding 8 and with a slightly different enrichment: namely the y's involved in the definition of the hom-object (see Proposition 9) are isomorphisms, instead of just morphisms We leave to the reader the details of the proof of the following proposition: Proposition 23. The loose synchronization (BY',) is a good semantics for (NT, ®,*). O 312 S. Kasangian, A. Labella At last, we can define an NT-category $ whose objects are obtained from BT’ considering only trees with a single bud in every leaf. The enrichment is obtained putting as hom object between two of such trees the minimal representative with respect to the equivalence relation >< introduced in Remark 16 (actually the direct limit of the class). It is not difficult to show then the following proposition Proposition 24. Let us define the synchronization a, over S (on the representatives) as in (3) but with the trivial budding (Xog¥),, = Leav(Xo,¥) >> U(Xoy¥) - Then (8, og) is a good semantics for (NT,@,*). O A slightly different version of this proposition can be found in [23] 2.2. Relabelling Given alphabets A and B, it is possible to ‘relabel’ A-trees using any map from A to B and lifting it to a morphism y between the trees F(A) and F(B), which gives rise to the usual pair of adjoint functors y*:T/F(B)>T/FCA) and 3, :T/F(A)T/F(B). The obvious relabelling is then given by 3,. while y* (and 17, for that matter) has a more interesting interpretation. 2.3. Restriction As a particular case, given an alphabet A and any ‘new’ symbol k, a restriction n be introduced by considering the inclusion (monoid as well as tree) morphism i : F(A)» F(B); the functor i* :'T, = 'T/ F(A U {k}) > T/ F(A) ‘cuts’ all paths just before the first occurrence of k in them. Notice that both relabelling and restriction are described at the level of computations. We will see later that these constructions correspond to the relabelling and restriction operators in CCS. operator on trees 2.4. Inserting and deleting idle moves Of course it is not always the case that a monoid morphism yields a relabelling from A-trees to B-trees, since it might not be a tree morphism. However we are interested in this kind of situation in order to recover a functorial way of connecting CCS (with 7) and SCCS (with the idle move), see [27]. This section can also be interpreted as a formalization of ‘changing observational capabilities’: we specify how to pass from a world of computations where a particular action is observed to a world where it is not observable any longer. Consider, given an alphabet A and any new symbol k, a monoid morphism d: F(AU {k})—> F(A) which sends k in © and any other generator in itself. This Enriched categorical semantics 313 does not indeed extend to a tree morphism, Nevertheless, we want to induce from da pair of functors between the topoi 'T/ F(A) and T/F(A U {k}) = Ty. Informal- ly, these functors are del :T, >'T/ F(A), which ‘deletes’ all the ares labelled by k and ins :‘T/F(A)—>T, which ‘inserts’ at each node of the tree a set of arbitrarily long (but finite) strings of arcs labelled by k. We will consider trees as particular posets. Let us call R the category whose obj equivariant functions, but are order preserving functions which preserve (but do not reffect) the roots and satisfy the weaker condition: (i') of = gd (cf. condition (i) in the definition of the topos T), where = refers to the depth of the nodes. F(A) is of course an object of R. Now, d : (AU {k})*—> F(A) R and because of the existence in R of pullbacks, it induces a pair of adjoints ts are trees, but morphisms are not a morphism in a? RIF(A) > RIF(AU{K}) and 3,2 R/F(AU {k})> R/F(A) ‘The inclusion functor 1: T/F(A)>R/F(A) has a left adjoint 4: R/F(A)—> T/F(A) which collapses two elements if they are on the same branch and with the same label. We define del as the composite 3,i and we get ins as its right adjoint, either directly or by a simple application of one of Butler's theorems (see [2, p. 135]) “These functors induce two functors D : NT, NT and J: NI NT, respective- ly, the first one acting on buds by composition of the budding function b,_, in NT, with the ‘collapsing’ function induced by del, the second one introducing a new bud on each new leaf. Proposition 28. D and I are monoidal functors. C1 Suppose now that we have a category C enriched over NT. We can consider it as enriched over NT, via the eff onsider the effect of the functor D. As n extend to an NT-category the notion of semantics for a synchronization actually defined in NT, (this possibility will enable us to define the ‘interleaving’ of two processes by consider ing k as an idle move, as we shall see later). We consider the effect of the following functor: of the functor and vice versa we ny a consequence we ca NT x Cat NT,-Cat CXC T x NP“. NT, x NT,—> NT, 34 S. Kasangian, A. Labetta Suppose now the existence of an NT,-functor Cx, C—C. The effect of the functor D on it is an NT-functor between the effects of D on €x,C and C. NT,-Cat NT-Cat D ae ee DA(CX,C)> NT, ———*——_» NT 3. Recovering the usual semantics as special cases This section is devoted to a brief comparison of suitable particularizations of our categories of trees with some of the well-known algebraic calculi mentioned in the Introduction, We hope that this comparison will show that our approach encompasses in fact most of the previous treatments and provides an algebraic explanation of some differences and controversial points among them. In fact, as a consequence of our distinction between the semantics of computa- tions (the base category) and various semantics of processes as categories enriched over it, we will split and distribute in these two levels primitives and equations of the calculi we are going to consider, placing in the base category mainly the aspects of ‘pure calculus’ and deferring the rest to the enriched level. 3.1. Languages in a monoid Let us start from computations associated with automata, namely languages whose words label the paths between two given states of an automaton. If a computation of this kind is viewed as a tree, such a tree must be seen just as the set of its paths, are not observable or are assumed to be made once for ever, at the beginning This can be obtained by imposing that in NT morphisms like the following ones must be isos via a calculus of fractions: since in automata theory the choices available at each node either —_—_—— (6) By this procedure tees are reduced to labelled paths or set of words, i.e languages of the monoid F(A). This case has been extensively studied e.g. in [ 6, 17, 21], where the bi monoidal closed category is actually the functor Enriched categorical semantics 315 category A~ = 2“, the tensor product is the Frobenius product of languages, i.e. for B and C in A~, B® C= {be | bE B, cE C} and the two internal homs are left and right quotients, Notice that the sum + : A~ x A~—> A” is the actual union of languages. We may say that we have considered a deterministic semantics of multiplication table on computations. As for the synchronization calculus =, any the generators yields a monoidal functor satisfying the interchange law. The reader can look at examples like the one in the Introduction which realizes the intersection of languages. antics here is just automata theory. As it has been shown first in [5], ‘nondeterministi ategories, Given an automaton C, a semanties is an A SC. Even the analogues of BT and § (se: Section 2) and the corresponding loose syr particular cases of Propositions 23 and 24 Observe finally that automata are classically called ‘nondete kind of nondeterminism is casily fixed by the (still classical) ‘subset construction’, which corresponds for instance to replacing ° et a ee “ ; whose unfolding is precisely (6). Process sei semiautomata are A”~ functor s¢: CX, hronization as good semantics are ministic”, but their 3.2. Synchronous CCS and related calculi [27] Synchronous CCS (SCCS) has been in fact our starting point and guiding model, since it subsumes many of the previous calculi in a comprehensive view, which is a conscious attempt to build a theory of synchronization along the lines of an algebraic approach Recall that in SCS are given a set P of agents (processes) and a set A of ‘atomic’ actions (i.c. actions indivisible in a discrete time). Atomic actions are labels for derivations between agents, represented by p——o meaning that an agent P ‘may perform the action a and become the agent Q in doing so’ [27] ‘A. synchronization ope Actually, A is supposed to be an abelian monoid (even a group), in order to avoid partial operations. Disregarding recursion, operators among agents are defined by the following derivations rules: ation x (corresponding to our #) is defined on A. 316 S. Kasangian, A. Labella action P—-@ P,—-+@ summation Spozsp Hed p—op 9" product ee Px Q—, prx gr restriction relabelling Sa P[A|——> Qf] We can consider as ‘computations’ between two agents (finite) strings of atomic actions which label sequences of derivations leading from the first agent to the second one. Bifurcations will occur when after a state (agent) more than one derivation is possible. Hence, computations are modelled via NT-trees (actually, those containing only a single bud in each leaf), assuming that e-derivations are added in order to represent ‘identity’ moves. In this interpretation, the action operator (which is a left prefix concatenation) can be seen as a particular case of Our tensor product ®, when the first tree reduces to a single path labelled by an atomic action: in fact, a new tree of derivation is obtained from a tree associated with an agent P, by adding @ on the top. The product operator is our tight synchronization of computations, defined according to a (parametric) synchroni- zation table on atomic actions, Notice however that in our setting a partial operation is sufficient to define a synchronization monoidal functor * on the category of trees labelled by A. The summation operator is the coproduct + in NT, since the tree of derivations from Y) P, to Q is given by the sum of the derivation trees from each of the P,’s to Q. Notice further that restriction and relabelling are functors induced by a morphism A*—> (AU {b})* or an auto- morphism 0 of A* (sce Sections 2.3 and 2.4) Moreover, via this interpretation, we get equations like (see [27]) T+S=S+T, (LT 4S)+V=T+H(S#V), which are just the associativity and symmetry of our sum + and TXS=SxT, since the synchronization table is symmetric , Enriched categorical semantics 317 (1% 8)xV=Tx(SXV), TX (S+V)=(TXS)+(TXV), by the definition of synchroni- zation a:TXb:S=axb:TxS (where : denotes the left prefix concatenation) which is an instance of our interchange law, (T+ S)\b= T\b + S\b, a:T\a=NIL, a: T\b=T ifaxb, OT +S)=OT+ OS, O(T x S)= OT x OS Oa: T= 0a: OT. So far we have considered synchronizations of computations, but as in Section 2, we want to define also synchronization of agents. Agents should be considered as obj introduced operator among agents and the following equations hold: (i) T+NIL=NIL+T=T, (i) TX NIL=NIL, (ii) TX1=T (i) depends on the fact that we forgot some buds, (ii) is due to the loose synchronization, (iii) asserts that the idle agent 1 acts as an identity with respect to the ‘lifted’ synchronization. It is easy to check that the enrichment of $ over NT implies that (iv) T+ T=T as a consequence of the equivalence relation ><. In fact by this relation, which is a sort of bisimulation [12] in absence of 7, we induce a calculus of ts of a category enriched over NT, like for instance the category S Section 2. In this particular case, for instance, sum is still an fractions on NT in a similar way as we did in the previous section in the case of automata Restriction and relabelling with all the usual properties are provided by suitable “change of base’ of the monoidal categories involved In order to recover CCS, let us assume the original alphabet A= {a, b,....4 b>...,7). Now let an idle move 1 to be added to A (as in ACCS) and a synchronization table as the following one to be considered Iesxtl=x, xT, 38 S. Kasangian, A. Labelta otherwise undefined, Recall that + represents the unobservable move and there- fore equivalences are usually introduced among computations in order to ignore reasonably undetectable moves (see {12]) The category §, originally enriched over NT. Proposition 25 and following paragraph); hence we are able to reconstruct Milner’s parallelism operator | as the semantics synchronization operator by using the following device: insert idle moves and then transfer the result of a synchroni- zation performed in § (over NT,), to § (over NT), by deleting, as we showed above, the undesired I's recovered by analogous equivalence present in the literature, this aspect is left to future work, The catastrophic agent 6 does not appear in Milner’s work and little attention is paid to the sequential structure (our tensor product), which is considered only in the left prefix form a: ~. Quite on the contrary, concatenation is a fundamental operator in the approach of Bergstra and Klop (see [4]), which we describe in the next section. is now enriched over NT, (see ome of the further equations concerning + could be constructions, but because of the variety of the notions of 3.3. ACP and related calculi [4] As the authors claim, their paper [4] is a further step towards an algebraic formalization of concurrency, along the line of SCCS. In particular, they stress the advantage of having a ‘general multiplication’ (concatenation) instead of prefix multiplication, Their basic operations are alternative composition + (our sum +), sequential composition « (our tensor product) and parallel composition | (an instance of our #). Axioms for ACP are satisfied in our framework with (as like usual) the warning that some of them hold at level of computations. (Al) xtysyte (symmetry of the sum +), (A2) x + (9 + Z)=(e+y) +2 (associativity of +), (A4) (wt y)z=aztyz (one sided distributivity of + with respect to @), (A5) (xyz = x(y2) (associativity of ®) , whereas other ones hold at the level of semantics for suitable eniched categories. An example is provided by the idempotence of + (induced by our equivalence): (A3) xtxex Another specific feature of ACP is a 6 which apparently behaves like a unit for the sum and a left annihilator for the tensor product as well (as in our setting): (A6) x+8=~x, (AT) bx =5 This 5 is interpreted as a ‘deadlock’, an action “by which a process acknowl- edges that it is stagnating’ Enriched categorical semanties 319 3.4, Scattered remarks The reader has certainly noticed that many of the special objects (ic. units, initial or terminal objects) of our computations semantics already exist in the nd slight differences in the meaning, literature, sometimes with various names according to the different sources, Here are some examples: (a) nil, the unit of the tensor product ®, occurs in [26] as NIL, the agent which OP in CSP [7]. Milne [25] uses an operator A with the essful does nothing, and as § axiom x + A=x, denoting not only deadlock (like 6 in ACP) but also suc termination, like Milner’s NIL The interpretation of nil could more properly be the following one (see [13]): when nil appears in a step of a process (a node has a bud in the corresponding tree) a further knowledge can be assumed in that point, i.e. the process is still open to continue according to another process; when 6 occurs, that step is definitely closed. Our topos of budding trees considers trees with both open and aves, while its subcategory NT has only trees with open leaves (sce [12]) closed | 6 is strictly 4, but also with the empty process of de Bakker and Zucker [10], where a successful stop process py also occurs (b) The terminal object #(s/) corresponds to CHAOS in CSP, while the tr (©, F(A), G1, E) (ie. Fd) without its buds) corresponds to RUN. related, as explained already in Section 3, with Bergstra and Klop’s 4. Final remarks It has been shown in Section 3 that most of the existing algebraic calculi for synchronization are particular cases of (or can be fruitfully compared with) our categorical set-up. ‘The distinction in swo levels of our categorical semantics for synchronization permits hopefully a very clear insight in the phenomenon, because we are able now to make a difference between the fundamental structure and occasional features required from different authors according to their particular intuitions or necessities. The central rdle of the topos BT of trees as semantics has been shown, particular kind of while the notion of ‘interleaving’ has been obtained as synchronization in the CCS case. Our categorical set-up is in fact flexible enough to be modified in order to encompass other notions of parallelism, like Petri nets [20]. We deem that this will be a way to overcome the distinction between interleaving cooperation’ and “true concurrency’ In fact, there are also phenomena which do not fit immediately within the computation semantics of NT and the process semantics of NT-Cat. For instance, a basic assumption made in the Introduction was the discreteness of time. If we drop it, as in Cardelli’s work [9], we are in a framework more general than the 320 S. Kasangian, A. Labella present one, but still in a category of generalized trees as it will be shown in a forthcoming paper [19]. Acknowledgment We would like to thank D. Benson, A. Carboni, A. Heller, G.M. Kelly, FW. Lawvere, A. Pettorossi, R. Rosebrugh, G. Rosolini, S. Schanuel, R.P.C. Walters and the Sydney Category Seminar, for many useful conversations. Special thanks are due to J. Bénabou, whose suggestions and encouragement supported the authors during the preparation of this work References [1] D. Austry and G. Boudol, Algebre de Processus et Synchronization, Theoret, Comput. Sei. 30 (1984) 91-131 2] M. Barr and C. Wells, Toposes, Triples and Theories (Springer, Berlin, 1985). [3] J. Benabou, Wandering and wondering about the high trees, Manuscript, 1984 [4] JA. Bergstra and J.W. Klop, Algebra of Communicating Processes with Abstraction, Theoret Comput, Sci, 37 (1985) 77-121 [5] R. Betti, Automi e categorie [6] R. Betti and 8. Kasangian, A quasi universal r Trieste, XIV (1982) 41-48. [7] 8.D. Brookes, C.A.R. Hoare and AW. Roscoe, A theory of communicating sequential pro- cesses, J. ACM 31 (1984) 560-509, [8] A. Carboni, Familialy representable functors, Manuscript [9] L. Cardelli, Real time agents, in: Proceedings ICALP 1982, Lecture Notes in Computer Science 140 (Springer, Berlin, 1982) 94-106. [10] J.W. De Bakker and J.1. Zucker, Denotational semantics of coneurreney, in: Proceedings 14th ACM Symposium on Theory of Computing, pp. 153-158 [11] P. Degano and U. Montanari, Specification languages for distributed systems, in: Proceedings Mathematical Foundations of Software Development, Lecture Notes in Computer Science 185 (Springer, Berlin, 1985) 29-51 [12] R. De Nicola, Extensional equivalen [13] R. De Nicola and M. Hennessy, Testing equivale (1984) 83-133, [14] S. Bitenberg and G.M. Kelly, Closed categories, in: Proceedings of the Conference on Categori- cal Algebra, La Jolla 1965 (Springer, Berlin, 1966) 421-562. [15] C.A.R. Hoare, Communicating sequential processes, Comm, ACM 21 (1978) 666-677. [16] P-T. Johnstone. Topos Theory (Academic Press, New York, 1977). [17] 8. Kasangian, G.M. Kelly and F, Rossi, Cofibrations and the Realization of Nondeterministie Automata, Cahiers Topologie Géom. Différentielle XXIV I (1983) 23-46 [18] S. Kasangian, A. Labella and A. Pettorossi, Enriched Categories for Local and Interaction Caleuli, Lecture Notes in Computer Science 283 (Springer, Berlin, 1987). [19] S. Kasangian and A. Labella, On continuous time agents, in: Mathematical Foundations of Programming, Lecture Notes in Computer Science, Vol. 598 (Springer, Berlin} 403-425, [20] S. Kasangian, A. Labella and A. Pettorossi, Observers, experiments and agents: A comprehen- sive approach to concurrency, in: Semantics of Concurrency, Lecture Notes in Computer Science, Vol. 469 (Springer, Berlin, 1990) 375406. [21] S. Kasangian and R. Rosebrugh, Decomposition of automata and enriched category theory, Cahiers Topologie Géom. Différenticlle Catégoriques XXWIL 4 (1986) 137-148. Boll, Un. Mat, Ital. (5) 17-13 (1980) 44-58, slization of automata, Rend, Istit, Mat, Univ. 's for transition systems, Acta Inform, 24 (1987) 211-237. s for processes, Theoret, Comput. Sei. 34 Enriched categorical semantics 321 [22] GM. Kelly, Basic Concepts of Enriched Category Theory (Cambridge University Press, Cam bridge, 1982). [23] A. Labelia and) A. Pettorossi, Categorical models of process cooperation, in: Proceedings Category Theory and Computer Programming, Guildford, UK, September 1985, Lecture Notes in Computer Science 240 (Springer, Berlin, 1986) 282-298. [24] FLW. Lawvere, Metric spaces, generalized logic, and closed categories, Rend, Sem. Mat. Fis Milano 43 (1973) 135-166. [25] G. Milne, Abstraction and non determinism in concurrent systems, in: Proceedings of the 3rd IEEE International Conference on distributed Systems (1982) 358-364. [26] R. Milner, A Calculus of Communicating Systems, Lecture Notes in Compu (Springer, Berlin, 1980). [27] R. Milnet, Calcuti for synchrony and asynchrony, Theoret. Comput, Sei. 25 (1983) 267-310. [28] G_ Winskel, Categories of models for concurrency, in: Proceedings Seminar om Concurrency. Catnegie-Mellon University. July 9-11, 1984, Lecture Notes in Computer Scienee, Vol. 197 (Springer, Berlin, 1985) 246-267. + Science 92

You might also like