Precategories for combining probabilistic automata

17

Transcript of Precategories for combining probabilistic automata

Precategories for Combining Probabilistic AutomataPaulo Mateus, Am��lcar Sernadas and Cristina SernadasCMA, Dep. Matem�atica,IST, Av. Rovisco Pais, Lisboa, PortugalAbstractA relaxed notion of category is presented having in mind the categoricalcaracterization of the mechanisms for combining probabilistic automata,since the composition of the appropriate morphisms is not always de�ned.A detailed discussion of the required notion of morphism is provided. Thepartiality of composition of such morphisms is illustrated at the abstractlevel of countable probability spaces. The relevant fragment of the the-ory of the proposed precategories is developed, including (constrained)products and Cartesian liftings. Precategories are precisely placed in theuniverse of neocategories. Some classical results from category theory areshown to carry over to precategories. Other results are shown not to holdin general. As an application, the precategorical universal constructs areused for characterizing the basic mechanisms for combining probabilisticautomata: aggregation, interconnection and state constraining.Mathematics Subject Classi�cations: 18A10 68Q75.Key words: neocategory, precategory, Cartesian lifting, probabilistic au-tomaton, aggregation, interconnection.1 IntroductionMany relaxed notions of category have been studied with di�erent motivationsin mind, starting with Ehresmann's work on neocategories [Ehr65] which wascontinued in [Cop80]. More recently, Herrlich and his associates have beenworking on semicategories [HS98]. All these notions can be seen as special casesof compositional graphs (where composition of f : A! B and g : B ! C is notalways de�ned). The di�erences consist of di�erent laws for the identity andassociativity. Of course, categories are recovered when composition of arrows ofthe right types is a total operation and the classical identity and associativitylaws hold.We became interested in a relaxed notion of category when trying to providea categorical characterization of the mechanisms for combining probabilisticautomata. Indeed, to this end, the required notion of morphism is clear, butleads to morphism composition as a partial operation. Then, the problem wasto identify the strongest identity and associativity laws holding in the envisagedstructures. In the end, we assume that: (i) (left and right) compositions withidentities are always de�ned; (ii) the classical identity laws hold; and (iii) thefollowing law holds with respect to associativity:1

� if f � g and g � h are both de�ned then either (f � g) � h and f � (g � h)are both unde�ned or they are both de�ned and equal.Clearly, this notion of precategory is a special case of the notion of neocat-egory, but this particular choice of assumptions has not deserved attention sofar, possibly for lack of application motivation. Now, this choice does deserveattention since it allows the characterization of the mechanisms for combiningprobabilistic automata as we describe in detail herein. Clearly, precategorieswill also be useful for studying mechanisms for relating and combining randomvariables and stochastic processes in general, but we refrain to do so in thispaper. For further results on the properties of precategories, namely about ad-junctions, see [SM]. For unrelated work on categorical aspects of probabilisticstructures see [Gir81, BDEP97, Pan97, HZ98].Probabilistic automata [Rab63, Paz66] are central in the �eld of probabilis-tic methods, namely for providing the appropriate semantic domain (see forinstance [BDEP97, LS91, GSST90]). Herein, we tackle the problem of aggre-gating, interconnecting and constraining probabilistic automata, having in mindfuture work in compositional veri�cation of probabilistic systems. The objectivehere is to provide a categorical characterization of these mechanisms for relat-ing and combining probabilistic automata, following the so called categoricalimperative of [Gog91, WN95]. In fact, we have to adopt the \precategorical"point of view given that precategories are the appropriate structures for thiswork.We start the paper by �rst presenting and justifying the choice of a measurepreserving map as the candidate to the notion of morphism between probabilityspaces, using a motivating example about probabilistic automata. We provide asimple example showing that composition of morphisms is a partial operation.Then we proceed by proposing the de�nition of precategory and developingthe relevant fragment of the theory of precategories, including (constrained)products and Cartesian liftings. We prove that some results carry over fromcategory theory and point out some results that do not hold in general forprecategories. Among these, we show that products may not be unique up toisomorphism in a precategory, but we are able to provide a useful su�cientcondition for them to be unique up to isomorphism as desired for applicationsin mind.In the second part of the paper we build upon the precategory of probabilityspaces in order to obtain the envisaged category of (deterministic) probabilis-tic automata and de�ne aggregation, interconnection and constraining of suchautomata as universal constructions. These concepts extend to probabilisticautomata the established de�nitions of aggregation and interconnection of clas-sical (nonprobabilistic) automata or transition systems, as explored for examplein [Win87, SCS94, WN95, SSC98].We assume that the reader is familiar with the use of probabilistic automata,the notions of aggregation and interconnection of nonprobabilistic automata,and the basics of category theory. We also use Cartesian liftings that are pre-sented from �rst principles in [BW90]. 2

2 What morphism?The key problem in following the categorical imperative of [Gog91, WN95] whendealing with probabilistic automata is to �nd the \right" notion of morphismbetween two such automata. We expect to obtain aggregation as a categori-cal product and interconnection as a Cartesian lifting, following the programof [WN95] originally developed for processes and classical (nonprobabilistic)transition systems. ?>=<89:;r01 ?>=<89:;r001?>=<89:;s0 1=3 222=3 ,, ?>=<89:;s00 1=3 111=3 --1=3 // ?>=<89:;r002?>=<89:;r02 ?>=<89:;r003m0 m00Figure 1It is worthwhile to see how the goal of obtaining aggregation as a producthelps in choosing the candidate to morphism. Consider two probabilistic au-tomata m0 and m00 and their aggregation m. Assume that s0 and s00 are statesof m0 and m00, respectively. Then, we want hs0; s00i to be a state of the aggre-gation m. Furthermore, assuming that the probability distributions of the twogiven automata at these states are as in Figure 1, then we want the probabilitydistribution of the aggregation at hs0; s00i to be as in Figure 2. That is, let p0be the probability of going from, say, a state s0 to a state r0 in m0 and p00 theprobability of going from s00 to r00 in m00. Then, it is clear that in m the proba-bility of going from hs0; s00i to hr0; r00i should be p0� p00. Therefore, we want thejoint probability distribution assuming independence.GFED@ABCr01r001GFED@ABCr01r002GFED@ABCr01r003GFED@ABCs0s00 1=9 771=9 331=9 002=9 ''2=9 ++2=9 .. GFED@ABCr02r001GFED@ABCr02r002GFED@ABCr02r003Figure 23

On the other hand, from the perspective of category theory, since we wantm to be a categorical product, it is easy to see that the envisaged notion ofmorphism should be a map between the state spaces with some additionalrequirements on the probabilities. Indeed, if we forget for the moment thetransition relation and associated probabilities, an automaton is just a set (ofstates) and the aggregation we described is just the Cartesian product of thegiven state spaces.Recall that (see for instance [Hal50]), in all its generality, a probability spaceis a triple h;B; P i where is a nonempty set (the outcome space), B is a�-algebra over (ie: B � }, ; 2 B, B closed for complements, B closed forcountable unions), and P : B ! R+0 (the probability map), such that P () = 1and P ([n2NBn) = Xn2N P (Bn) for every family fBngn2N such that Bn 2 B forevery n 2 N and Bn \ Bm = ; for every n 6= m 2 N. But we do not needto work with such generality for the purpose of studying �nite even countableautomata. To this end it is su�cient to work with the following notion of(countable) probability presentation.De�nition 2.1 A probability presentation is a pair h; pi where is a count-able nonempty set and p : ! R+0 is a map such thatX!2 p(!) = 1.Obviously, every such probability presentation h; pi induces a probabilityspace (by taking the whole } as the �-algebra) that we denote in the sequelby h; }; P i.Returning to the problem of choosing the appropriate notion of morphism,from the discussion above it is clear that we want it to be such that the cat-egorical product of two probability presentations re ect the notion of productof probability distributions. Hence it should be a map between the outcomespaces with some requirements on the probabilities. We expect to have to im-pose some preservation of probability. Furthermore, it is necessary to considerwith care the case where the map of outcomes is not surjective, since this isimperative for constraining. Hence we are led to the following de�nition:De�nition 2.2 A probability presentation morphism f : h; pi ! h0; p0i is amap f : ! 0 such that P 0(B0 \ f()) = P (f�1(B0))� P 0(f()).This de�nition also re ects the intuitions we had a priori on Cartesian liftingsfor interconnecting probabilistic automata and hence probability presentations.Incidentally, this notion when the map is probabilistically surjective (that is,the probability of the image of the source outcome space is 1) collapses into theclassical notion of measure preserving transformation, as de�ned for instancein [Hal50]. Such transformations are by de�nition probabilistically surjectiveand behave well with respect to composition. However, precisely because of theCartesian lifting we need to work with nonsurjective morphisms which reservethe surprise of not always composing as illustrated below in Figure 3.4

x : 1=3 // u : 7=9a : 2=3 // y : 4=9 33ggggggggggggggg v : 2=9b : 1=3 // z : 2=9 33gggggggggggggggf gFigure 3Indeed, although both f and g are probability presentation morphisms, let-ting h be the map g � f , P 00(fvg \ h(fa; bg)) = P 00(fvg) = 2=9 but on the otherhand P (h�1(fvg))� P 00(h(fa; bg)) = 1=3, and, therefore, h is not a probabilitypresentation morphism. In other words, the requirement on probability preser-vation characteristic of the proposed notion of morphism is not respected by thecomposition of maps. The partiality of composition of probability presentationmorphisms is at �rst sight very bad news indeed: we are thrown out of thescope of category theory! Fortunately, we are able to choose one speci�c re-laxed notion of category in order to encompass the partiality of composition ofmorphisms and the appropriate identity and associativity laws, setting up theproposed notion of precategory and showing that some of the relevant techniquesand results of classical category theory are preserved.3 PrecategoriesIn the sequel, concerning partially de�ned expressions, we say that E1 = E2 i�both E1 and E2 are de�ned and are equal or both are unde�ned.De�nition 3.1 A precategory is a tuple S = hO;Hom; id; �i where O is a class(of objects), Hom = fHom(A;B)gA;B2O where each Hom(A;B) is a class (ofmorphisms from A to B), id = fidAgA2O where idA 2 Hom(A;A) for everyA 2 O, � : Hom(A;B)�Hom(B;C) *Hom(A;C) is a partial map such thatf�idA = f , idB�f = f , if f�g and g�h are both de�ned then (f�g)�h = f�(g�h).As usual, when necessary, we use jSj, HomS and �S to denote the objects,the morphisms and the composition of S, respectively.Note that the associativity requirement for composition is very weak. Wechose it as strong as applicable to the envisaged precategory of probabilitypresentations. Later on, we shall see a couple of results of category theory thatare not carried over to precategories precisely because of the weakness of theassociativity requirement.The notion of precategory as proposed above is a special case of the notionof neocategory. It is worthwhile to place more precisely precategories in theuniverse of weaker concepts of categories. The notion of compositional graph isthe weakest one: a graph endowed identities and partial composition withoutany laws on identity and associativity. A neocategory [Ehr65] is a composi-tional graph ful�lling the strong identitivity law (left and right) compositions5

with identities are always de�ned and the classical identity laws hold). A semi-category [HS98] is a compositional graph ful�lling the weak identitivity law (theidentity laws hold whenever the compositions exist) and the strictly associativelaw (if f � g and g �h are both de�ned so are (f � g) �h and f � (g � h) and theyare equal).Precategories are neocategories since they are strongly identitive composi-tional graphs. With respect to associativity, the proposed law of precategories(well associativity) is one of the weakest although we might conceive workingwith a weaker one (if both (f � g) � h and f � (g � h) exist then they are equal).Note that the well associativity law can be stated for arbitrary length com-positions: call it �-well associativity. Clearly, �-well associativity implies wellassociativity. But not the other way around except in special cases. Later on,we shall see that some useful precategories (\material" over a category) alsoful�ll the �-well associativity.4 Some universal constructions in precategoriesThe notions of cone and limit over a diagram from classical category theoryare adopted without any change for precategories. For example, a productof A0 and A00 is the triple hA0 � A00; �0; �00i where �0 : A0 � A00 ! A0 andmutatis mutandis for the other projection such that for any A and morphismsg0 : A! A0; g00 : A! A00 there is a unique u : A! A0�A00 such that �0 �u = g0and �00 � u = g00.As in the theory of categories, the product is a terminal cone in the precate-gory of commutative cones f 0 : A! A0; f 00 : A! A00 over the discrete diagramcomposed of A0 and A00.Of course, we would like to have limits unique up to isomorphism. Notethat in a precategory we say that f : A ! B is an isomorphism i� there is amorphism g : B ! A such that f �g = idB and g�f = idA. Note that accordingto our conventions these equalities imply that both f � g and g � f exist.We start with a negative result: limits are not unique up to isomorphism inan arbitrary precategory. However, we soon discovered that in the precategoryof probability presentations existing limits were isomorphic. And we managedto establish a positive result exploiting the forgetful \functor" from the pre-category of probability presentations to the category of sets. Therefore, it isworthwhile to establish the notions of prefunctor and of material precategoryover a (pre)category, which we proceed to do.When dealing with partial functions we write, as usual, f � g for denotingthat g(x) is de�ned and equal to f(x) whenever f(x) is de�ned.De�nition 4.1 A prefunctor from precategory S to precategory S0 is a pairF = hF0; F1i where F0 : jSj ! jS0j, F1 = fF1ABgA;B2jSj where each F1AB is amap fromHomS(A;B) to HomS0(F0(A); F0(B)) such that F1AA(idA) = idF0(A)and �fg:F1AC(f � g) � �fg:(F1BC (f) � F1AB(g)).It is easy to verify for instance that prefunctors preserve isomorphisms.Adapting from the theory of functors, we say that a prefunctor is faithful i�6

F1AB is injective for every A;B in jSj. As usual we may write F (A) for F0(A)and F (f) for F1(f).De�nition 4.2 A precategory S is said to be a material precategory over aprecategory R i� there exists a map F0 : jSj ! jRj such that:1. HomS(A;B) � HomR(F0(A); F0(B));2. idA = idF0(A);3. for every f 2 HomS(A;B); g 2 HomS(B;C):f �S g = � f �R g provided that f �R g 2 HomS(A;C)unde�ned otherwise .A material precategory over a category has many interesting properties aswe shall see below. But it is worthwhile to point out immediately that such amaterial precategory over a category satis�es the �-well associativity law. Thatis, well associativity holds for compositions of arbitrary length.Prop/De�nition 4.3 The faithful prefunctor F : S ! R induced by a mate-rial precategory S over R is the pair hF0; ,!i.Therefore we look at materialness as the precategory counterpart of con-creteness of categories. For details on concrete categories see for instance[AHS90]. We now state a lemma that will be used several times in the se-quel.Lemma 4.4 Let F : S ! R be the prefunctor induced by a material precate-gory S over R. Then: F (f) �R F (g) = idF (A) ) f �S g = idA.Proof: By hypothesis, we have F (f) �R F (g) = idF (A). Thus, by requirement1 of De�nition 4.2, f �R g = idF (A). Hence, by requirement 2, f �R g = idA.Since idA is a morphism in S, by requirement 3, f �S g = f �R g. Therefore,f �S g = idA. 4Proposition 4.5 Limits are unique up to isomorphism in a material precate-gory over a category provided that the induced prefunctor preserves limits.Proof: Let S be a material precategory over a category R. Let F be theinduced prefunctor that preserves limits objects. Let C and C 0 be limits ofsome diagram d in S with the morphisms u : C 0 ! C and u0 : C ! C 0provided by the universal property. Then, F (C) and F (C 0) are limits in R of dwith morphisms F (u) and F (u0) provided by the universal property. Because Ris a category we have that F (u)�R F (u0) = idF (C) and F (u0)�R F (u) = idF (C0).Hence, by Lemma 4.4 we conclude that u �S u0 = idC and u0 �S u = idC0 and asa consequence C and C 0 are isomorphic in S. 4Unfortunately, we need a further concept related to limits. In many appli-cations the universal property applies only to a subclass of the cones at hand.We are thus led to the notion of \constrained limit". And we further prove7

that uniqueness up to isomorphism is also valid for such constrained limits in aprecategory material over a category where the induced prefunctor maps suchconstrained limits to limits. We delay until the next section the discussion of aconcrete example of constrained limit.As already pointed out above and illustrated for the case of the productconstruction, a limit over a given diagram is de�ned as the terminal cone in theprecategory of the cones over the diagram. Of course such a terminal cone maynot exist.In addition if we are given a predicate � on such cones, the constrained�-limit over the given diagram is de�ned as the terminal cone in the full sub-precategory of the cones ful�lling � over the diagram. Again such a terminalcone may not exist.Proposition 4.6 Constrained limits are unique up to isomorphism in a ma-terial precategory over a category provided that the induced prefunctor mapsconstrained limits in limits.Proof: Straightforward adaptation of the proof of Proposition 4.5. 4Clearly, we could have obtained Proposition 4.5 as a simple corollary ofProposition 4.6. But, for the sake of easier understanding we preferred topresent the result about limits on its own.Finally, we consider Cartesian liftings (useful later on for interconnectingprobabilistic automata) within the scope of precategories.De�nition 4.7 A Cartesian lifting by the prefunctor F : S ! R for u : X ! Yin R at object B of S is a morphism f : A ! B in S such that F (f) = u andsatis�es the following universal property: for any morphisms g : C ! B andw : Z ! X such that u �w = F (g) there is a unique morphism h : C ! A suchthat F (h) = w and f � h = g.Now we have a positive result on the uniqueness up to isomorphism ofCartesian liftings in precategories:Proposition 4.8 Let S be a material precategory over a category R. Thedomain of a Cartesian lifting by the induced prefunctor F is unique up toisomorphism.Proof: Let A and A0 be the domains of two Cartesian liftings by F for u at B.A f //h0��? 3 * B X u //idX�� YA0 f 0EE��������hSS ?3* F : S // R X u EE��������idXSSWe have: F (h) � F (h0) = idX , thus, by Lemma 4.4, h � h0 = idA and F (h0) �F (h) = idX , thus h0 � h = idA0 . 48

5 Probability presentationsIn this section we explore the precategory Prob of probability presentations. Itis straightforward to verify that probability presentations and their morphismsconstitute a precategory. Furthermore, the precategory Prob is material overthe category Set with induced prefunctor Out.In the sequel, the following lemma will be useful when checking if a mapbetween outcome spaces constitutes a probability presentation morphism.Lemma 5.1 Let h; pi; h0; p0i be probability presentations and f : ! 0 amorphism in Set. Then, f : h; pi ! h0; p0i is a morphism in Prob wheneverP 0(f!0g \ f()) = P (f�1(f!0g))� P 0(f()) for every !0 in 0.As motivated before, we would like to obtain the product probability dis-tribution as the categorical product (unique up to isomorphism since Prob ismaterial over the category Set). However, products do not always exist in Prob.What we can achieve in Prob is the existence in all cases of the so called \inde-pendent products": the universal property is guaranteed only for \independentcones" (corresponding to two independent random variables). So, we are in thepresence of a constrained limit in the terminology of the previous section.De�nition 5.2 An independent cone in Prob is a cone hh; pi; g0; g00i, whereg0 : h; pi ! h0; p0i and g00 : h; pi ! h00; p00i are morphisms in Prob, suchthat P (g0�1(B0) \ g00�1(B00)) = P (g0�1(B0))� P (g00�1(B00)).In such an independent cone, g0 and g00 behave as two independent randomvariables, respectively over 0 and 00. Note that to verify if a cone is anindependent one it is su�cient to check if the condition holds for singleton setsB0 and B00.De�nition 5.3 Let h0; p0i and h00; p00i be probability presentations. An inde-pendent product of h0; p0i and h00; p00i in Prob is a terminal independent conein the class of independent cones over h0; p0i and h00; p00i.Proposition 5.4 Let h0; p0i and h00; p00i be probability presentations. Anindependent product of h0; p0i and h00; p00i is hh; pi; �0; �00i = h0; p0i� h00; p00iwhere = 0 �00, p(h!0; !00i) = p0(!0)� p00(!00), �0 and �00 are the projectionmaps.Proof:1. It is straightforward to verify that hh; pi; �0; �00i is an independent cone.2. We now prove the envisaged universal property. Let f 0 : h000; pi ! h0; p0iand f 00 : h000; p000i ! h00; p00i be morphisms in Prob constituting an in-dependent cone and f : 000 ! the unique morphism in Set such that�0 � f = f 0 and �00 � f = f 00. We have to show that f is a morphism inProb. We start by proving two preliminary results:9

(a) Let A = fh!0; !00i : h!0; !00i 2 f(000) ^ p(h!0; !00i) 6= 0g andB = f!0 : !0 2 f 0(000)^ p0(!0) 6= 0g � f!00 : !00 2 f 00(000)^ p00(!00) 6=0g. Then, A = B.� A � B: straightforward.� B � A :!0 2 f 0(000) ^ p0(!0) 6= 0 ^ !00 2 f 00(000) ^ p00(!00) 6= 0)P 000(f 0�1(!0) \ f 00�1(!00)) 6= 0 ^ p0(!0) 6= 0 ^ p00(!00) 6= 0)f 0�1(!0) \ f 00�1(!00) 6= ; ^ p0(!0) 6= 0 ^ p00(!00) 6= 0)h!0; !00i 2 f(000) ^ p(h!0; !00i) 6= 0.(b) P (f(000)) = P 0(f 0(000))� P 00(f 00(000)).P (f(000)) = P (fh!0; !00i : h!0; !00i 2 f(000) ^ p(h!0; !00i) 6= 0g) =P (f!0 : !0 2 f 0(000) ^ p0(!0) 6= 0g � f!00 : !00 2 f 00(000) ^ p00(!00) 6=0g) = P 0(f!0 : !0 2 f 0(000) ^ p0(!0) 6= 0g)� P 00(f!00 : !00 2 f 00(000) ^p00(!00) 6= 0g) = P 0(f 0(000))� P 00(f 00(000)).3. Finally we show that f is a morphism in Prob, that is:P 000(f�1(h!0; !00i)) � P (f(000)) = P (fh!0; !00ig \ f(000))We just consider the case when h!0; !00i 2 f(000):P 000(f�1(h!0; !00i))�P (f(000)) = P 000(f 0�1(!0)\f 00�1(!00))�P (f(000)) =P 000(f 0�1(!0))� P 000(f 00�1(!00))� P 0(f 0(000))� P 00(f 00(000)) =P 0(f!0g \ f 0(000))� P 00(f!00g \ f 00(000)) =P (fh!0; !00ig \ f(000)). 4Therefore, independent products always exist and they correspond to theprobabilistic notion of joint distribution assuming independence (as it was ourgoal). Furthermore, as a direct corollary of the general result in the previoussection about constrained limits we have:Proposition 5.5 Independent products are unique up to isomorphism.Finally, we show that there are Cartesian liftings by Out for some inclusions.Such inclusions are precisely what we shall need in the sequel for constrainingprobabilistic automata.Proposition 5.6 Let h0; p0i be a probability presentation and f : ,! 0 bean inclusion such that P 0(f()) > 0. A Cartesian lifting by the induced prefunc-tor Out for f at h0; p0i is f : h; pi ! h0; p0i where p(!) = P 0(f(f!g)=f())(where P 0(A0=B0) is the conditional probability of A0 given B0).Proof:1. It is straightforward to show that f is a morphism in Prob.2. We now prove the envisaged universal property. Let g : h00; p00i ! h0; p0iand h : 00 ! be morphisms such that f �h = g. We have to verify thath is a morphism in Prob. We just consider the case when ! 2 h(00)):P 00(h�1(f!g)) � P (h(00)) =P 00(g�1(f(f!g))) � P (h(00)) = 10

P 0(f(f!g) \ g(00))� P (h(00))P 0(g(00)) = P 0(f(f!g))P (f()) = p(!): 4In the sequel, we denote by f�1(h0; p0i) the domain of the Cartesian liftingby Out for f at h0; p0i.6 Stochastic matrixesIn this section we de�ne a precategory of stochastic matrixes Stx and extend thework presented in the previous section having in mind the characterization ofprobabilistic automata. Instead of presenting stochastic matrixes via standardlinear algebra constructs as usual, we de�ne them as a family of probabilitypresentations. By doing so we have a natural de�nition of the correspondingcategory capitalizing on the morphisms introduced in the previous section.De�nition 6.1 A (�nite) stochastic matrix is a pair k = hS; �i such that:� S is a �nite set (state space);� � = f�sgs2S where �s = hS; psi 2 jProbj for each s 2 S.Note that the outcome space of all indexed probability presentations is thestate space of the matrix. Taking into account this last remark, we de�ne amorphism between stochastic matrixes as a map between the state spaces thatis also a morphism in Prob for each probability presentation.De�nition 6.2 A stochastic matrix morphism f : k ! k0 is a morphism f :�s ! �0f(s) in Prob for each s in S.Clearly, stochastic matrixes and their morphisms constitute a material pre-category Stx over Set with induced prefunctor St.Guided by the envisaged categorical characterization of the aggregation ofprobabilistic automata, we provide a similar characterization for the Kroneckerproduct of matrixes.Prop/De�nition 6.3 The Kronecker product of two stochastic matrixes k0and k00 is a stochastic matrix k0 � k00 = hS0�S00; �0 � �00i such that (�0 � �00)s0s00 =�0s0 � �00s00 for all s0 2 S0 and s00 2 S00.An independent cone in Stx is a cone hk; g0; g00i, where g0 : k ! k0 andg00 : k ! k00 are morphisms in Stx, such that hhS; psi; g0; g00i is an independentcone in Prob for each s 2 S. Hence, it is straightforward to verify that theKronecker product of stochastic matrixes is an independent product in Stx.We �nally check that there are Cartesian liftings by St for some inclusions.Such inclusions are precisely what we shall need in the sequel for state constrain-ing probabilistic automata. We delay until the next section the illustration andinterpretation of Cartesian liftings. 11

Proposition 6.4 Let hS0; �0i be a stochastic matrix and f : S ,! S be aninclusion such that P 0f(s)(f(S)) > 0 for all s 2 S. The Cartesian lifting by Stfor f at hS0; �0i is f : hS; �i ! hS0; �0i where �s = f�1(�f(s)).Proof: Straightforward using Proposition 5.6. 47 Probabilistic automataIn this section, we �nally deal with (deterministic) probabilistic automata, pro-viding a categorical characterization of their aggregation, interconnection andconstraining. Note that we need an alphabet of actions for labeling the tran-sitions so that we can de�ne the interconnection of automata via those labels.The use of transition labels is standard in the classical (nonprobabilistic) theoryof interconnection of transition systems. Therefore, we expect a probabilisticautomata to provide a probability distribution over the state space for eachaction a 2 A and state s 2 S. Hence we are led to the following de�nition:De�nition 7.1 A probabilistic automaton is a triple m = hA;S; ki such thatA is a �nite pointed set with distinguished element ?, S is a �nite pointed setwith distinguished element i and k = fkaga2A where each ka is a stochasticmatrix with space S such that k? is the identity matrix.The elements of A are called actions. The distinguished element is the idleaction. The elements of S are called states. The distinguished element is theinitial state. Each ka is the transition matrix for action a.De�nition 7.2 A probabilistic automaton morphism f : hA;S; �i ! hA0; S0; �0iis a pair hf; fi where f : A ! A0 and f : S ! S0 are maps preserving dis-tinguished elements such that f : ka ! kf(a) is a morphism in Stx for eacha 2 A:The two components of the morphism are standard in the classical (non-probabilistic) theory of transition systems. The requirement on the probabilityfront is very natural given the results of the previous section. The concept ofzig-zag morphism, used to characterize probabilistic bisimulation [BDEP97], isa special case of the proposed morphism. They coincide when considering a�xed set of actions and a surjective map between the states. Of course, suchsurjective morphisms always compose but they are not enough to provide acategorical characterization of state constraining as we envisage.Clearly, probabilistic automata and their morphisms constitute a materialprecategory Aut over the category Set� � Set� with induced prefunctor Crs.We turn now our attention to the basic mechanisms for combining proba-bilistic automata, in order to provide a precategorical characterization for eachof them as a universal construct in Aut.Prop/De�nition 7.3 Let m0 = hS0; A0; k0i and m00 = hS00; A00; k00i be proba-bilistic automata. Their aggregation is m0jjm00 = hS;A; ki where:12

� S = S0 � S00;� A = A0 �A00;� ka0a00 = ka0 � ka00 for every a0 2 A0; a00 2 A00.Clearly, m0jjm00 is an independent product in Aut. We refrain from spellingout the independence constraint.Proposition 7.4 Let hS0; A0; k0i be a probabilistic automaton, f : A ,! A0and f : S ,! S0 be inclusions preserving distinguished elements such thatP 0f(a)f(s)(f(S)) > 0 for all s 2 S and a 2 A. The Cartesian lifting by Crs for fat hS0; A0; k0i is f : hS;A; ki ! hS0; A0; k0i where ka = f�1(kf(a)) (the domainof the Cartesian lifting by St for f at kf(a)).Proof: Straightforward using the de�nition and Proposition 6.4. 4In the sequel, we denote by f�1(hA0;X 0; �0i) the domain of the Cartesianlifting by Crs for f at hA0;X 0; �0i.We are ready to use Cartesian liftings for interconnecting probabilistic au-tomata. The basic idea | originally proposed by Winskel for classical (non-probabilistic) machines, see for instance [WN95] | is as follows. Given twoautomata m0 and m00, if we want to join them in parallel (aggregation) withoutany interaction we just calculate their independent product. But if we want toimpose some interaction, for instance a calling interaction like whenever actiona0 ofm0 happens then a00 ofm00 should also happen, we calculate (the domain of)the Cartesian lifting over the appropriate inclusion of alphabets. In the envis-aged alphabet a0 should always go together with a00. The other pairs involvinga0 are dropped. Therefore, we reach the following notion of interconnection byaction calling:De�nition 7.5 Let m0 = hA0; S0; k0i and m00 = hA00; S00; k00i be probabilisticautomata and let a0 be an action in A0 and a00 be an action in A00. Then, theinterconnection of m0 and m00 by a0 calling a00 ism0jja0>>a00m00 = f�1(m0jjm00)where:� f : ((A0 n fa0g)�A00) [ fha0; a00ig ,! A0 �A00;� f : idS0�S00 .Finally, we are able to constrain probabilistic automata via Cartesian lifting.By constraining we mean state constraining, and therefore we want to restrictthe automata to a suitable subset of states. The constraining is useful, forinstance, whenever we impose some property over the states and therefore someof these states are dropped. As it is expected, constraining is obtained by liftingan inclusion over the states, leading us to the following de�nition:13

De�nition 7.6 Let m0 = hS0; A0; k0i be probabilistic automaton and let S bea subset of S0 such that P 0a0s (S) > 0 for all a0 2 A0 and s 2 S. Then, theconstraining of m0 to S is m0jS = f�1(m0) where:� f : idA0 ;� f : S ,! S0.We are ready to give an example. Consider the stochastic matrixes for twoprobabilistic automata m0 and m00 with two states and two actions (we refrainfrom showing the stochastic matrix for the idle actions and from identifying theinitial state of each automaton):m0 m00k0a0 = 00 10 000 10000 3=4 1=4 k00a00 = 000 1=2 1=210 1=3 2=3 100 1=2 1=2Figure 4The aggregation of these two automata will result in the following automa-ton (still omitting the stochastic matrix for the joint idle action):m000 = m0jjm00k0?0 � k00a00 = k000?0a00 = h00; 000i h00; 100i h10; 000i h10; 100ih00; 000i 1=2 1=2 0 0h00; 100i 1=2 1=2 0 0h10; 000i 0 0 1=2 1=2h10; 100i 0 0 1=2 1=2k0a0 � k00?00 = k000a0?00 = h00; 000i h00; 100i h10; 000i h10; 100ih00; 000i 3=4 0 1=4 0h00; 100i 0 3=4 0 1=4h10; 000i 1=3 0 2=3 0h10; 100i 0 1=3 0 2=3k0a0 � k00a00 = k000a0a00 = h00; 000i h00; 100i h10; 000i h10; 100ih00; 000i 3=8 3=8 1=8 1=8h00; 100i 3=8 3=8 1=8 1=8h10; 000i 1=6 1=6 2=6 2=6h10; 100i 1=6 1=6 2=6 2=6Figure 5If we wish to interconnect m0 and m00 by a0 calling a00 then the resultingautomaton m is as follows (again omitting the joint idle action):14

m = m0jja0>>a00m00k?0a00 = h00; 000i h00; 100i h10; 000i h10; 100ih00; 000i 1=2 1=2 0 0h00; 100i 1=2 1=2 0 0h10; 000i 0 0 1=2 1=2h10; 100i 0 0 1=2 1=2ka0a00 = h00; 000i h00; 100i h10; 000i h10; 100ih00; 000i 3=8 3=8 1=8 1=8h00; 100i 3=8 3=8 1=8 1=8h10; 000i 1=6 1=6 2=6 2=6h10; 100i 1=6 1=6 2=6 2=6Figure 6Finally let us constrain m such that, for instance, the states hold the fol-lowing property: s0 � s00 for all s0 2 S0 and s00 2 S00. In this case, we get thefollowing automaton (again omitting the stochastic matrix for the idle action):mjf00000;00100;10100gk?0a00c = h00; 000i h00; 100i h10; 100ih00; 000i 1=2 1=2 0h00; 100i 1=2 1=2 0h10; 100i 0 0 1ka0a00c = h00; 000i h00; 100i h10; 100ih00; 000i 3=7 3=7 1=7h00; 100i 3=7 3=7 1=7h10; 100i 1=5 1=5 2=5Figure 78 ConclusionsMotivated by applications in probabilistic automata, we proposed a relaxednotion of category: the concept of precategory as a special case of neocate-gory. We developed the relevant fragment of the basic theory of precategoriesincluding (constrained) products and Cartesian liftings. These precategoricalconstructs deserved our special attention since we envisaged from the begin-ning to use them for characterizing the mechanisms for combining probabilisticautomata. We also proved that some results carry over from classical categorytheory and pointed out some results that do not hold in general for precate-gories. The uniqueness up to isomorphism of these universal constructs wasstudied in detail.In the second part of the paper that we dedicated to applications, westarted by presenting the precategories of probability presentations, stochas-tic matrixes, and probabilistic automata. Then, we provided a precategorical15

characterization of free aggregation, interconnection via action calling and stateconstraining of probabilistic automata. All mechanisms were shown to corre-spond to universal constructions in the precategory of probabilistic automata.The proposed precategorical characterization of these mechanisms together withthe underlying notion of probabilistic automaton morphism constitute key in-gredients of a compositional semantics for stochastic systems, notwithstandingthe need to work with precategories instead of categories.Further work is under way in di�erent directions. A probabilistic automatonde�nes a Markov chain. We expect to bring in results from the theory of Markovchains, such as those on recurrence/transience and �rst passage times. On theother hand, it may be worthwhile to explore the precategorical characterizationswithin the �eld of Markov chains, in particular, and stochastic processes, ingeneral. The extension of the approach to noncountable probability spaces isalready under way. The stochastic properties of the proposed morphismwill alsobe studied, namely with respect to preservation results. A parallel developmentof the theory of precategories is mandatory. Some very interesting results onadjunctions for precategories are presented in [SM].AcknowledgmentsThe authors are greatly indebted to Lutz Schr�oder for many rewarding dis-cussions on the relationship of precategories to other relaxed notions of cate-gory. This work was partially supported by FCT, the PRAXIS XXI ProjectsPRAXIS/P/MAT/10002/1998 ProbLog, PCEX/P/MAT/46/96 ACL and2/2.1/TIT/1658/95 LogComp, as well as by the ESPRIT IV Working Groups22704 ASPIRE and 23531 FIREworks.References[AHS90] J. Ad�amek, H. Herrlich, and G. Strecker. Abstract and concretecategories: the joy of cats. John Wiley & Sons, 1990.[BDEP97] R. Blute, J. Desharnais, A. Edalat, and P. Panangaden. Bisimu-lation for labelled Markov processes. In Proceedings, Twelth An-nual IEEE Symposium on Logic in Computer Science, pages 149{158, Warsaw, Poland, 29 June{2 July 1997. IEEE Computer SocietyPress.[BW90] M. Barr and C. Wells. Category Theory for Computing Science.Prentice-Hall International Series in Computer Science. Prentice-Hall, 1990.[Cop80] L. Coppey. Quelques probl�emes typiques concernant les graphes.Diagrammes, 3:C1{C46, 1980.[Ehr65] C. Ehresmann. Cat�egories et structures. Dunod, 1965.16

[Gir81] M. Giry. A categorial approach to probability theory. Cat-egorical Aspects of Topology and Analysis, Lecture Notes inMathematics(915):68{65, 1981.[Gog91] J. Goguen. A categorical manifesto. Math. Structures Comput. Sci.,1(1):49{67, 1991.[GSST90] R. van Glabbeek, S. Smolka, B. Ste�en, and C. Tofts. Reactive,generativem and strati�ed models for probabilistic processes. InProc. LICS, pages 130{141, 1990.[Hal50] P. Halmos. Measure Theory. Van Nostrand, New York, NY, 1950.(July 1969 reprinting).[HS98] H. Herrlich and L. Schr�oder. Free adjunction of morphisms. Sub-mitted for publication, 1998.[HZ98] H. Herrlich and D. Zhang. Categorical properties of probabilisticconvergence spaces. Applied Categorical Structures, 6:495{513, 1998.[LS91] K. Larsen and A. Skou. Bisimulation through probabilistic testing.Information and Computation, 94(1):1{28, September 1991.[Pan97] P. Panangaden. Stochastic Techniques in Concurrency. Draft pro-vided by CISM, 1997.[Paz66] A. Paz. Some aspects of probabalistic automata. Information andControl, 9(1):26{60, February 1966.[Rab63] M. Rabin. Probabilistic automata. Information and Control,6(3):230{245, September 1963.[SCS94] A. Sernadas, J. F. Costa, and C. Sernadas. An institution of objectbehaviour. In H. Ehrig and F. Orejas, editors, Recent Trends in DataType Speci�cation, volume LNCS 785, pages 337{350. Springer-Verlag, 1994.[SM] L. Schr�oder and P. Mateus. Adjunctions in precategories. In prepa-ration.[SSC98] A. Sernadas, C. Sernadas, and C. Caleiro. Denotational semanticsof object speci�cation. Acta Informatica, 35:729{773, 1998.[Win87] G. Winskel. Petri nets, algebras, morphisms, and compositionality.Inform. and Comput., 72(3):197{238, 1987.[WN95] G. Winskel and M. Nielsen. Models of concurrency. In D. GabbayS. Abramsky and T. Maibaum, editors, Handbook of Logic in Com-puter Science 4, pages 1{148. Oxford Science Publications, 1995.17