Normal Forms for Partitions and Relations - CiteSeerX

0 downloads 0 Views 423KB Size Report
Aug 4, 1999 - a Dipartimento di Informatica, Universit a di Pisa, Pisa, Italia, fbruni ... and show that those normal forms can be thought of as arrows of suitableĀ ...
Normal Forms for Partitions and Relations ? a

Roberto Bruni , Fabio Gadducci

b

and Ugo Montanari

a

a Dipartimento di Informatica, Universita di Pisa, Pisa, Italia,

fbruni,[email protected]

b University of Edinburgh, Division of Informatics, Edinburgh, Great Britain, [email protected]

Abstract Recent years have seen a growing interest towards algebraic structures that are able to express formalisms di erent from the standard, tree-like presentation of terms. Many of these approaches reveal a speci c interest towards the application to the \distributed and concurrent systems" eld, but an exhaustive comparison between them is dicult because their presentations can be quite dissimilar. This work is a rst step towards a uni ed view, which is able to recast all those formalisms into a more general one, where they can be easily compared. We introduce a general schema for describing a characteristic normal form for many algebraic formalisms, and show that those normal forms can be thought of as arrows of suitable concrete monoidal categories.

Contents 1

Introduction

2

2

A categorical view for di erent formalisms

4

2.1 Enriching the Monoidal Structure

7

3

The general model: -spaces

12

4

-spaces for Nets, Term Graphs and Relations

18

Research partly supported by the EC TMR Network GETGRATS (General Theory of Graph Transformation Systems) through the Technical University of Berlin and the University of Pisa; by Esprit Working Groups CONFER2 and COORDINA, through the University of Pisa; and by the British EPSRC grant R29375, through the University fo Edinburgh. Research partly carried out during the stay of the second author at Fachbereich 13 Informatik, Technical University of Berlin, Franklinstrae 28/29, D-10587 Berlin, Germany.

?

Preprint submitted to Elsevier Preprint

4 August 1999

4.1 Symmetric Monoidal

18

4.2 GS-Monoidal

21

4.3 Relations

24

4.4 Partial Orders

26

4.5 Monoids over Monoids

29

5

30

-spaces for Partitions and Contextual Nets

5.1 Partitions

30

5.2 Contextual Nets

32

6

33

Conclusion

References

34

1 Introduction Since models of computation based on the notion of free and bound names are widespread, the notion of name sharing is essential for several applications ranging from logic programming, -calculus, functional programming and process algebra with restriction (or name hiding mechanisms) to mobile processes (where local names may be communicated to the external world, thus becoming global names). We can think of names as links to communication channels, or to objects, or to locations, or to remote shared resources, or also to some cause in the event history of the system. In general, names can be freely -converted, because the only important information they o er is sharing. The simplest example is given by non-linear contexts over a certain signature, where the same variables can occur twice or even more: When the context is instantiated the actual values of such non-linear parameters must be suitably duplicated so to ll all the \holes" in the context. An informal \wire and box notation" gives an intuitive understanding of the name sharing mechanism, and of the r^ole played by auxiliary structure: Wires represents variables and the operators of the signature are denoted by boxes labeled with the corresponding operation symbols. Connection points between wires attached to boxes and variables are marked by the corresponding sort (i.e., the type of the wire). For instance, the term y1 = f (x1 ; g(x2); h(x1 ; a)) over the one-sorted signature  = fa : 0 ?! 1; g : 1 ?! 1; h : 2 ?! 1; f : 3 ?! 1g 2

x1 x2 a

6 6 6  6666 /g 6 / /h

/

"/ :f v vv v v /

/

y1

Fig. 1: Wire and box representation for the term y1 = f (x1 ; g(x2); h(x1 ; a)). a c1  a

/ J J JJJ $ :h t t ttt

/

c2  a

/

8h '

/

/

Fig. 2: Di erent diagrams for the term h(a; a). and variables x1 ; x2 admits the graphical representation in Figure 1, where the unique sort is denoted by the symbol \". Notice that wire duplications (e.g., of x1 ) and wires swapping (e.g., of x2 and a copy of x1 ) are auxiliary, in the sense that they belong to any wire and box model, independently from the underlying signature. The properties of the auxiliary structure are far from trivial and could lead to somehow misleading system representations, when their interpretation is not well formalized. For example, let us consider the wire and box diagrams c1 and c2 in Figure 2. In a value-oriented interpretation, both c1 and c2 yield the same term h(a; a). Instead, in a reference-oriented interpretation, c1 and c2 de ne di erent situations: In the former the two arguments of the h operator are uncorrelated, while in the latter they point to the same shared location. Term graphs [41] are a reference-oriented generalization of the ordinary (valueoriented) notion of term, where the sharing of sub-terms can be speci ed also for closed (i.e., without variables) terms. 1 The distinction is made precise by the axiomatization of algebraic theories: Terms and term graphs di er for two axioms, representing, in a categorical setting, the naturality of transformations for copying and discharging arguments [9]. Many other mathematical structures have been proposed, for expressing formalisms di erent from the ordinary tree-like presentation of terms. They range from the ownomial calculus of Stefanescu [13,12], to the bicategories of processes of Walters [24,25], to the pre-monoidal categories of Power and Robinson [36], to the action structures of Milner [31], to the interaction categories of Abramsky [1], to the sharing graphs of Hasegawa [22] and to the gs-monoidal categories of Corradini and Gadducci [8,9], just to mention a few (see also [10,18,20,38]). All these structures can be seen as enrichments of symmetric monoidal categories, which give the basis for the description of a distributed environment in terms of a wire and box diagram. 1 Terms may share variables, but shared sub-terms of a closed term can be freely

copied, always yielding an equivalent term.

3

We propose a schema for describing normal forms for this kind of structures, generalizing the one in [16] (and that bears some similarity to the equational term graph of [2]), thus obtaining a universal framework where each structure nds its unique standard representation. We describe distributed spaces as sets of assignments over sets of variables, distinguishing between four di erent kinds of assignment, each representing a basic functionality of the space, namely input and output interfaces, basic modules, and connections. Changing the constraints on the admissible connections is the key to move between formalisms. We call -spaces the distributed spaces over a signature , and show that the classes of -spaces we are interested in always form a symmetric monoidal category. We then establish a sort of triangular correspondence between various formalisms proposed in the literature (usually in a set-theoretical way), -spaces and suitable enriched symmetric monoidal categories. The structure of the paper is as follows: In Section 2 we give a categorical account of the various formalisms presented in the literature that we want to embed in our concrete normal-form representation. In section 3 we formally de ne -spaces, equip them with two operations of parallel and sequential composition, and state some additional properties for a relevant class of acyclic -spaces, called relational. In Section 4 we show how it is possible to have a normal form representation for net processes, term graphs, open graphs, relations, labeled partial orders, in terms of acyclic spaces. In Section 5 we show that by dropping the acyclic requirement it is possible to model both partitions and contextual nets in a suitable way. We want to remark that all the classes under consideration are characterized by simple restrictions on the admissible links of -spaces. In Section 6 we draw some conclusion and sketch a promising future research aimed at the integration of the structures considered in this paper via an implementation of their normal form representation as -spaces.

2 A categorical view for di erent formalisms We recall here a few categorical de nitions, which allow to recast the usual notion of term over a signature in a more general setting. Moreover, the progressive enrichment of a basic theory with di erent auxiliary mathematical constructors generates a great variety of di erent model classes, where the usual notions of relation, partial order, partition, and many others can be represented. Definition 2.1 (Signatures)

A many-sorted hyper-signature  over a set S of sorts is a family f!;!0 g!;!02S of sets of operators. If S is a singleton, we denote the hypersignature  by the family fn;mgn;m2lIN . 4

We usually omit the pre x \hyper". When it is clear from the context that a set S is the underlying set of sorts of a signature , we drop the subscript  . A many-sorted signature  over S can be viewed as a graph with pairing 2 G, where its nodes (also objects ) are strings on S (S  is the set of objects, string concatenation  yields the monoidal operator, and the empty string  is the neutral element), and its edges (also arrows ) are the operators of the signature (i.e., G contains an edge 3 f : ! ?! !0 if and only if f 2 !;!0 ). In the same way, a signature morphism F from  to 0 is just a graph morphism whose object component is a monoid homomorphism. A chain of structural enrichments enhances the expressiveness of di erent classes of models, e.g., the usual algebraic notion of terms over a signature. However, we are interested in weaker theories, where name sharing nds a natural embedding. The rst enrichment is common to all the formalisms we will consider, and introduces the sequential and parallel compositions between arrows together with all the arrows necessary for arbitrary permutations of objects (corresponding to the swappings of wires in the wire and box presentation). Then, the models of the resulting symmetric theory of  are just suitable symmetric monoidal categories [27] (i.e., also equipped with the -structure). We recall that a category C is a graph together with a total map id : O ?! A that associates an arrow ida : a ?! a to each object a 2 O, and a partial operation for sequential composition of arrows ; : A  A ?! A which is de ned if and only if the target of its rst argument matches the source of its second argument. Moreover, if f : a ?! b and g : b ?! c are arrows of C then f ; g : a ?! c, sequential composition is associative and for all f : a ?! b we have ida ; f = f = f ; idb. Abusing the notation we will often denote the arrow ida by the object name a itself. The obvious notion of morphism between categories (mapping arrows into arrows and objects into objects) preserves the categorical structure (source, targets, identities and sequential composition) and is called functor. In what follows, we will sometimes refer to the opposite category C op of a category C as the category having the same objects as C , but where the direction of the arrows is reversed (e.g., if f : a ?! b and g : b ?! c are arrows of C , then f op : b ?! a, gop : c ?! b and (f ; g)op = gop; f op). 2 A graph is with pairing if its nodes are the elements of a monoid. 3 We use the standard notation f : a ?! b to denote an arrow f with source a and

target b.

5

aF F x b x x Fx F bx a

Fig. 3: The symmetry a;b in the wire and box notation. a

aG G w c w Gw G bF F F x cw a x xF F cx b b

=

aG G

c a

c

b

G G

b F F F

F

F

aF F x bF F F x a x xF F x x Fx F bx ax b

=

a

a

b

b

Fig. 4: Wire and box representation of coherence axioms for symmetries. Definition 2.2 (Monoidal and Symmetric Monoidal Categories)

A (strict) monoidal category is a triple hC ; ; ei, where C is the underlying category, the tensor product : C  C ?! C is a functor satisfying the associative law (t1 t2) t3 = t1 (t2 t3 ), and e is an object of C satisfying the identity law t e = t = e t, for all arrows t; t1 ; t2; t3 2 C . A symmetric monoidal category is a 4-tuple hC ; ; e; i, where hC ; ; ei is a monoidal category, and : 1 2 ) 2 1 : C  C ?! C is a natural transformation satisfying the coherence axioms:

a b;c = (a b;c); ( a;c b)

a;b; b;a = a b

for all objects a, b and c, i.e., using a diagrammatic presentation: a

a b LcL b;c/ a c b L

a b;cL L L &  a;c b c a b

a bG G a;b/ b a GG

a b G #  b;a a b

A functor F : C ?! C 0 between two (symmetric) monoidal categories is called monoidal if F (t1 t2 ) = F (t1) 0 F (t2) and F (e) = e0 ; it is symmetric if F ( a;b) = F0 (a);F (b) . We denote by SMCat the category of symmetric functors. Note that sequential composition is written in the diagrammatic order. Symmetries and the other auxiliary constructors we will present can be pictured in the wire and box notation as wire rearrangements. Such representation illustrates very well the meaning of coherence axioms. In particular, the generic symmetry a;b is illustrated in Figure 3, and the coherence axioms in Figure 4 (the labels a, b and c just denote wire types). The naturality of is expressed by saying that for all arrows f : a ?! b, g : c ?! d we have (see Figure 5): (f g); b;d = a;c; (g f ) 6

a

f g

c

bD D z d zD zz D d b

=

aD D z c z Dz D cz a

g

d

f

b

Fig. 5: Wire and box representation of the naturality axiom for symmetries. a

f

{{ {{ bC C CC

b

=

b

xx xx aF F FF

a

f

b a

a

f

f

b

!=a

!

b

Fig. 6: Wire and box representation of the naturality axiom for duplicators

and dischargers. Very informally, the meaning is that if one looks at several complex diagrams that essentially contain the same functionalities, then the most important thing one has to pay attention to is the listing order of input and output nodes. In the following, we will use just the diagrammatic presentation for the axioms that the auxiliary structure must satisfy, which are more descriptive than the algebraic equations. Among the uses of symmetric monoidal categories as a semantical framework, we recall the algebraic characterization of concatenable processes for Petri nets in [15] and especially the functorial construction given in [6] for pre-nets, and the description of a basic network algebra for data- ows in [3,12]. 2.1 Enriching the Monoidal Structure

The constructive de nition of algebraic theories [26] as enriched monoidal categories dates back to the mid-Seventies [23,35], even if it has received a new stream of attention in these days. In our opinion, it separates very nicely the auxiliary structure from the -structure (better than the ordinary description involving the meta-operation of substitution). Moreover, the naturality axioms for duplicator and discharger (see Figure 6) express a controlled form of datasharing and data-garbaging. If these axioms are missing (i.e., if duplicators and dischargers are just transformations), then the corresponding theory, called gs-monoidal , is the natural framework for the representation of term graphs rather than terms, as shown in [9]. When dischargers are possibly missing we use the terminology share categories. Definition 2.3 (Share Categories)

A share category is a 5-tuple

hC ; ; e; ; ri 7

vvv a vI I I I

a a

Fig. 7: The duplicator ra in the wire and box notation. a a vvv v a aI I I a I a

=

a vvv v aI I I a a I a a

v a6 6 6  a vvv 6

aI I I

I

a



666

a

=

v a vvv

aI I I

I

a

a aF F x x Fx F bF F bx FF b

w ww aw

a b a

=

a Fw b xF

b

w ww F x x Fx F FF F

a b a b

Fig. 8: Wire and box representation of coherence axioms for duplicators in share categories.

where hC ; ; e; i is a symmetric monoidal category and the transformation r : 1 ) 1 1 : C ?! C is such that re = e, and satis es the coherence axioms expressed by the commuting diagrams below (the rst two diagrams express a sort of \output" associativity and commutativity for the duplicator, and the third diagram tells how the duplicator for a composed object a b can be obtained by composing the duplicators for the subcomponents) a

ra

/ a a

ra   a ra a a r a/ a a a a

a D D ra/ a a D

ra D D a"  aa;a

a b Q Q rQ a r/ ab a b b Q Q ra bQ Q Q (  a

a;b b a b a b

A share functor F : C ?! C 0 between two share categories is a symmetric functor such that F (ra) = r0F (a) . We denote by ShCat the category of share functors. Using the wire and box notation, the duplicator ra can be represented as in Figure 7. The coherence axioms for duplicators in share categories are depicted in Figure 8. Definition 2.4 (GS-Monoidal Categories)

A gs-monoidal category is a 6-tuple

hC ; ; e; ; r; !i where hC ; ; e; ; ri is a share category, and ! : 1 ) e : C ?! C is a transformation such that !e = e and satisfying the coherence axioms (the rst diagram says that creating two links and then discharging one of them just 8

a

!

Fig. 9: The discharger !a in the wire and box notation. w ww w aI I I I

a

!

a

a

=

a

a

a b

! =

a b

! !

Fig. 10: Wire and box representation of coherence axioms for dischargers in gs-monoidal categories. yields the identity, the second diagram expresses the monoidality of !) a b K !aK !b / e e KK !a b K eK % e =e e

a H H ra / a a HH a H H $  a !a a=a e

A gs-monoidal functor F : C ?! C 0 is a share functor such that F (!a) =!0F (a) . We denote by GSCat the category of gs-monoidal functors. Dischargers and the associated axioms are illustrated in Figures 9 and 10 respectively. In the set-theoretical interpretation, the auxiliary structures of share categories and of gs-monoidal categories exactly correspond to the classes respectively of the converses of surjective function and of the converses of functions (cf. [14]). Interesting applications often require the presence of the categorical opposite of duplicators, which may be used to express a sort of data-matching. Analogously, co-dischargers are introduced to represent the explicit creation of data. Several combinations are then possible, where only some of the operators are considered, and their mixed compositions are di erently axiomatized, ranging from the match-share categories of [19] to the dgs-monoidal categories of [17,18,24]. Here we just sketch a survey of the categorical framework, and brie y comment their r^ole in the literature and the main di erences between similar models. We start with what we call a r-monoidal category: One of the various extensions, albeit with a di erent name, proposed in [14,11,12]. Definition 2.5 (R-Monoidal Categories)

A r-monoidal category is an 8-tuple

hC ; ; e; ; r; !; ; yi 9

aI I I I

vvv av

y

a

a

Fig. 11: The co-duplicator a and co-discharger ya in the wire and box no-

tation.

aI I I

I vvvv aI I I I vvv v a

a a

=

a aI I I v vvI aI I I av I a vvv av

aI I I I a a a v a vv av

vvv a vI I I I

aI I I vvv av

I

a

=

a

a

Fig. 12: Wire and box representation of the axioms a ; ra = (ra ra ); (a

a;a a); (a a ) and ra; a = a. such that hC ; ; e; ; r; !i and hC op; op; e; op; op; yopi are both gs-monoidal categories, and satisfying the additional coherence axioms (expressing the interplay between the gs and co-gs structures) a a a / a ra / a O a

a a ra ra  a a a a a

a;a a/ a a a a e @ @ ya / a @ e @ @  !a e

e E E ya / a

EE ya ya E "  ra

a a

a E E ra/ a a E a E E E "  a a a aE E a / a

!a !a E E " e !a E

A r-monoidal functor F : C ?! C 0 is a gs-monoidal functor such that also F op is so. We denote by RMCat the category of r-monoidal functors. The additional structure and axioms of r-monoidal categories are illustrated in Figures 11, 12 and 13. The axioms we considered naturally embed the properties of relations, and the (partial) algebraic structure of r-monoidal categories yields a useful mathematical tool for their representation [14]. A stronger version of the axiom involving the composite ; r is the basis for a di erent family of structures. In a certain sense, the stronger axiom establishes that duplicators and coduplicators embed a sort of transitive and symmetric closure of the relation, i.e., it does not matter how two objects are connected, but just the fact that they are connected. Definition 2.6 (Match-Share Categories)

A match-share category is a 6-tuple

hC ; ; e; ; r; i 10

y

a

! =e

xx xx aF F FF

y

a a

=

y y

aG G

a

GG

w a ww w a

a

!=

a a

! !

Fig. 13: Wire and box representation of the axioms ya ; !a = e, ya; ra = ya ya and a ; !a =!a !a . aI I I

I

v a vI I v vv av

vv II

a a

=

aI I I a a I aI I I I a a a

Fig. 14: Wire and box representation of the axiom a ; ra = (ra a); (a a ). such that hC ; ; e; ; ri and hC op; op; e; op; opi are both share categories, and satisfying the additional coherence axioms 4 a a a / a ra a   ra a a a a  / a a a

a E E ra/ a a E a E E E "  a a

A match-share functor F : C ?! C 0 is a share functor such that also F op is so. We denote by MShCat the category of match-share functors. Match-share categories have been introduced in [19], and used to embed the algebraic properties of processes for contextual nets [32]. They are the basis for a class of categories where suitable models of partition-based structures can live. The more interesting axiom of match-share categories is depicted in Figure 14. As in match-share categories we introduce duplicators and co-duplicators, but not dischargers and co-dischargers, we can do the reverse choice so to de ne new-bang categories. Definition 2.7 (New-Bang Categories)

A new-bang category is a 6-tuple

hC ; ; e; ; !; yi where hC ; ; e; i is a symmetric monoidal category, ! : 1 ) e : C ?! C is a transformation such that !e = e, y : e ) 1 : C ?! C is a transformation such 4 Using these axioms and the coherence axioms involving duplicators, co-

duplicators and symmetries, it can be easily proved that also the equation a ; ra = (a ra ); (a a) holds for any object a.

11

that ye = e, and satisfying the coherence axioms a b K !aK !b / e e KK !a b K eK % e e=e

e e=JyeJ a yb/ a b JJ ya b J J %  a b a b

e @ @ ya / a @ e @ @  !a e

A new-bang functor F : C ?! C 0 is a symmetric monoidal functor such that also F (!a) =!0F (a) and F (ya) = y0F (a) . We denote by NBCat the category of new-bang functors. Di erently from the previous structures, the de nition of new-bang categories is original. The basic idea is to provide the simplest enrichment able to deal with both name creation and hiding. We will see that the analysis of this structure can lead to an interesting representation of commutative monoids built on associative monoids (e.g., more concretely, multisets of strings over an alphabet). Definition 2.8 (P-Monoidal Categories)

A p-monoidal category is an 8-tuple

hC ; ; e; ; r; !; ; yi such that both hC ; ; e; ; r; !i and hC op; op; e; op; op; yopi are gs-monoidal categories, hC ; ; e; ; r; i is a match-share category, and hC ; ; e; ; !; yi is a new-bang category. A p-monoidal functor F : C ?! C 0 is a gs-monoidal functor such that also F op is so. We denote by PMCat the category of p-monoidal functors. As far as we know, the set-theoretical aspects of p-monoidal categories, has never been explicitly analyzed in the literature. The leading idea is that a generic arrow from a1    an to b1    bm (where the ai's and the bi `s are \basic" objects) represents some kind of partition of fa1; :::; an; b1 ; :::; bmg. For example, the axiom a ; !a =!a !a of r-monoidal categories does not hold for partitions, because in the partition a; !a both a sources belong to the same class, whereas in partition !a !a they belong to disjoint classes.

3 The general model: -spaces We introduce now a concrete representation for the several formalisms discussed in the previous sections. It can be thought of as a normal form presentation of the less formal wire and box diagrams illustrated in the intro12

y1 o o

AA   C   // {; ; ;; ;; 

2

/ /9 9

y ... 5 yn 

5 2 d d

G

x1| <
0 if

22

i 6= n + 1 (i.e., dischargers are allowed only in gn+1), in particular each ki;j represents the sharing degree of the corresponding variable in the associated -space, but when the sharing degree is 0, the discharger is postponed to the end of the expression representing the normal form; (2) the ui's are identities; (3) each ti is the parallel compositions of generators at depth i in the space associated to the arrow (respecting some predetermined, xed total ordering of the operators in ). In some sense we take as normal forms those terms with maximal parallelism and minimal duplication. 2 The main result of [9] states that the free gs-monoidal category over a (onesorted, ordinary) signature is isomorphic to the class of (ranked) term graphs labeled over it. Such a property is exploited in [8] to give an inductive, algebraic account of term graph rewriting, together with the resulting functorial semantics. It is in this setting that we recover the intuitive interpretation of copying and discharging as suitable operations over graphical structures. We recall that term graphs are essentially nite directed acyclic graphs labeled over a signature, allowing for the explicit representation of sub-term sharing inside terms. They found several interesting application in the study of eciency and memory costs for rewriting system implementations, as well as in the formal treatment of such systems. Also the open graphs of [33] form a free gs-monoidal category, namely the one generated by the one-sorted signature  such that h;k = ; if k 6= 0, and h;0 = Lh for h 2 lIN, where L = fLhgh2lIN is the set of (ranked) labels for the edges of the graph. Open graphs are just graphs where a tuple of output nodes (possibly with repetitions) is also speci ed. In this way, they can be used to represent systems which are not closed but can instead interact with other systems via connections on output nodes. Obviously, open graphs without output nodes are just closed systems. The whole set of nodes of an open graph is ordered and can be viewed as the input interface, to allow for sequential composition. Since open graphs can be presented as terms of a free gs-monoidal algebra, they nd a normalized presentation in terms of -spaces. Open graphs have been used in [33] to model states of simple distributed systems (consisting of concurrent processes communicating via shared ports and posing on such ports certain synchronization requirements to the adjacent processes) in such a way that the tile model paradigm [20] can be easily applied to model the coordinated dynamics of such systems. 23

4.3 Relations

Due to the presence of both co-duplicators and co-dischargers in the relational model, we have no restriction on the number of ingoing and outgoing links in the corresponding version of -spaces. The weaker constraint considered here just involves the global structure of the link sentences. Definition 4.5 (Relational -space) A -space G is called relational if (1) the only kind of link sentences allowed consists of sentences of the form y  / / x where y is a result and x is a name, (2) the ow relation induced by the assignment in G is acyclic. As we will see, the terminology \relational" is due to the application of such spaces to the modeling of relations. For example in a relational -space, each variable can be assigned and used as many times as necessary, i.e., it can be connected to several (possibly to none) other variables, as it is the case for generic relations. Proposition 4.5

The parallel and sequential composition of relational -spaces yield relational -spaces. Analogously to the gs-monoidal case, we can characterize co-duplicators and co-dischargers. Definition 4.6 (The -spaces G2! and G0! ) For each string ! 2 S , with j!j = n, we de ne the relational -spaces G2! and G0 as follows: Let Y and X be list of names such that jY j = 2n, jX j = n, !

Y [i] : ![i], Y [i + n] : ![i], and X [i] : ![i], for i = 1:::n. Then G0! = f 2  / / ; X  / / 2g; G2! = f 2  / / Y; X  / / 2g [ f Y [i]  / / X [i] j i = 1:::ng [ [ f Y [i + n]  / / X [i] j i = 1:::ng;

The families fG2! g!2S and fG0! g!2S behave respectively as the co-duplicator and the co-discharger for relational spaces. Proposition 4.6

Relational -spaces are the arrows of a concrete r-monoidal category, which is (isomorphic in RMCat to) the one freely generated by . 24

Proof sketch. We already know that relational -spaces possess a monoidal category structure. Moreover, the -spaces G!;!0 , fG2! g!2S , and fG0! g!2S de ned in the previous sections behave as symmetries, duplicators and dischargers also for generic relational spaces. Therefore, we have just to show that the families of -spaces fG2! g!2S and fG0! g!2S are transformations from 1 1 and from the constant G to 1 , respectively, verifying the coherence axioms in De nition 2.5. This can be easily done exploiting the de nition of G2! , and G0! . To show the initiality of our model we rely on the results of [14], since relational -spaces o er a concrete mathematical structure corresponding to a normalized representation for relations. The proof technique is the standard one: First, a functor is de ned by structural induction that goes from the freely generated r-monoidal category to acyclic -spaces (with the obvious preservation of symmetries, duplicators, dischargers and their cocounterparts); second, a normal form is de ned for r-monoidal terms and it is shown that whenever two di erent normal forms are mapped into the same space, then they can be proved equivalent; eventually, the inductively de ned functor is proved surjective. Here we just remark that the normal form for the arrows of the free r-monoidal category associated to  has the following shape:

r1; (u1 t1); r2; (u2 t2); :::; rn; (un tn); rn+1 where: (1) each ri is a relation, and therefore nds a normal representation (by N N ki;j m n i i the results in [14]) as the term ( j=1 rai;j ); si; ( j=1 hbi;ji;j ), with si a symmetry, r0a =!a, 0a = ya , r1a = 1a = ida, r2a = ra , 2a = a , rka+1 = ra ; (rka ida), and ka+1 = (ka ida); a if k  2; (2) the ui's are identities; (3) each ti is the parallel compositions of generators at depth i in the space associated to the arrow (respecting some predetermined, xed total ordering of the operators in ).

2 Therefore, relational -spaces de ne an initial relational model for . Corollary 4.7

Given a many-sorted signature, and any two strings !; !0 2 S , the class of relational -spaces from ! to !0 with no generators is isomorphic to the class of type-preserving relations between the components of ! and those of !0. The proof follows from Theorem 4.6 and from the results of [14,12]. 25

4.4 Partial Orders

If  is a one-sorted signature that contains only unary operators, then we may use relational -spaces for the representation of labeled partial orders. Definition 4.7

A relational -space G is called po-space if S = fsg, and  = s;s. Let (P; v; `; A) be a partial order labeled over the set A (hence, ` : P ?! A for P partial order), and let us consider the -spaces over the signature A = fa : 1 ?! 1 j a 2 Ag. In a similar fashion to the proposal of [19], the basic ingredients are the A -spaces in the family fGaga2A , where

Ga = f 2 

//

y1; x  a / / y ; x1 

//

2; y1  / / x ; y  / / x1 ; y1  / / x1 g:

Intuitively, each -space Ga represents the label a in parallel with an identity. The presence of the links y1  / / x and y1  / / x1 , acting as a duplicator of the input position, together with the presence of the links y  / / x1 and y1  / / x1 , acting as a match in the output position, creates a sort of implicit transitive closure of identities whenever the sequential composition is applied. As a result, the ordering relation of the partial order, say between e and e0 , is represented by propagating a copy of the identity of e in parallel with e0 . The A -space associated to P is obtained by composing the Ga 's following the intuitive correspondence with the labeled elements of P . Theorem 4.8 The class of poA -spaces from  to  are in one-to-one correspondence with the

nite partial orders labeled on A.

Proof sketch. The mapping from partial orders to -spaces can be de ned as follows. If the partial order is made up of disconnected partially ordered subsets, then the associated -space will be the parallel composition of the -spaces associated to the various components (the order of the parallel composition is not important, since they are all arrows from  to  and therefore can be freely permuted, i.e., we rely on a multiset structure). If the partial order is connected, then

 we divide the elements in layers according to the ordering (minimal elements go in the rst layer L1, the elements whose all predecessors are minimal elements go in the second layer L2, and so on, in suchSa way that an element is in the i-th layer Li i all its predecessors are in j