Interaction and observation, categorically

This paper proposes to use dialgebras to specify the semantics of interactive systems in a natural way. Dialgebras are a conservative extension of coalgebras. In this categorical model, from the point of view that we provide, the notions of observati…

Authors: Vincenzo Ciancia

Bliudze, S., Bruni, R., Carbone, M., Silva, A. (Eds.); ICE 2011 EPTCS 59, 2011, pp. 25–36, doi:10.4204 /EPTCS. 59.3 Interacti on and observation, categoric ally V incenzo Ciancia ∗ Institute for Logic, Language and Computation Univ ersity of Amsterdam This paper pro poses to use dialgebras to specify th e semantics o f interactive systems in a natural way . Dialgebra s are a conservati ve exten sion of coalgebr as. In this categorical mo del, from the point of view th at we provide, the notio ns of observation an d interaction are separate featur es. This is useful, f or example, in the sp ecification of proce ss equivalences, which are obtained as kernels of the homom orphisms of dialge bras. As an example we present the asynchrono us seman tics of the CCS. 1 Introd uction The notion s of inter actio n and observ ation play a k ey ro le in the s emantics of conc urrent and interac ti ve systems. An interact ive system or proc ess (imagine a web servi ce, or an opera ting system) is typically not req uired to ter minate, bu t it is not al ways eq ui v alen t to the deadlock ed m achin e. This is because, along the ex ecu tion of a s ystem, the external en vi ronment is allo wed to intera ct with the progr am an d observ e some side effe cts (typically , output from the system itself). Ho wev er clear in princi ple, thi s intuitio n is lost whene ve r the semantic s of an interac ti ve syst em is model led using labelled tran sition systems (L TSs) or their categor ical generalisa tion, the so-c alled coalg ebr as . The reason is that ev ery interact ion that a system makes with the ext ernal world, be it origin ated from the en vironment, or from an internal action of the system itself, is describ ed in the same way , as a transition from one state to the next. In th is wo rk we turn our atten tion to a clas s of categori cal models cal led d ialg ebr as . Dialg ebras are a straigh tforw ard g eneral isatio n of both algebra s and coalgebr as. W e interpret these models as a frame work where one can describe separatel y the states of the system, th e interactio ns tha t the en viro nment and a proces s may hav e in each state, and the resulting observ atio ns. In our interpretatio n, di algebr as pro vide side-e f fecting operation s, therefore provi ding both conte xts and observ ati ons simultaneou sly . The abo v e is strongly reminiscent of the distinction between input and output in computer science. Thinking of interact ion with the en vi ronment as an input to a proces s, and obs erv atio n as its output, Mealy m achine s [5] come to mind. These are functions I × X → O × X , for X , I and O the set of state s of the system, possible input value s, and possible output valu es, respecti vely . It turns out that one of the simplest and more familiar example s of a dialgebra is a Mealy machine; in the same fashion , one of the simplest and more familiar e xamples of coalg ebra is an L TS. This moti v ates the follo wing slogan . Coalgebras generali se labelled transitio n systems; dialgebras generalise Mealy machines. As it happens with coalgebras w .r .t. L TSs, the merit of the generalis ation is in the fact that, since dialge bras form a catego ry , th ese generali sed Mealy machines are no w equipp ed with a standard notion of equi v ale nce, which is gi ven by the ke rnel of morphisms of the cate gory . So, in our framew ork, th e semantics of a programming lang uage is gi ve n in terms of a dialgeb ra. T he latter , as we will see, is a function f from a set F X to a set BX . F and B are parametrised in X , which is ∗ Research supported by the Netherlands Organization for Scientific Research VICI grant 639.073.501 26 Interac tion and observ ation , cate goric ally the set of stat es of a system. F describes a type of e xper iments that an ideal obser ver can conduc t. Then , results are observe d, belongi ng to the set BX of possible observation s . The way to define the semantics is by choosing appr opriate expe riments and observ atio ns, and defining such a function f . From this informat ion, using a small amou nt of cate gor y theory , a standard equi v alence relation, called dialgebra ic bisimilar ity , is defined on X . Roughly speaking, t wo processes are dialgeb raic b isimilar if they exhibi t the same obse rv ation s in the same exp eriments, and the sta tes they rea ch after the ex perimen ts are bisimilar . An e xample where it is us eful to di stingu ish betwee n inter action and observ ation is asynchr onou s semantic s. Asynchron ous communication may be summarise d by saying that “the observ er can not see the input actions of a process”. Mor e precisely , the observ er can not tell input actions from inte rnal computa tions. In the dialgeb raic perspe cti v e that we propose on asyn chron y , the observe r can either sit and look at the syste m, seeing its outp ut and inter nal comput ations , or try to send messa ges to it. Ho wev er , a pr ocess can either read a message, or co nsume a message without actu ally read ing it, and store it for later process ing. The obser ver can not tell the two case s apart. W e provid e a dialgebraic semantics of the asynchro nous CCS, and pr ov e that the obtai ned equiv - alence relation coincides with strong asynchrono us bisimilarity . In this case, we make a distin ction between an unde rlying operati onal semantics which is ex press ed by the well-kno wn L TS for the C CS, and the dialgebrai c seman tics, b uilt on top of it, which specifies the semantic equi v alen ce re lation . B isim- ilarity o f the L T S of th e op eration al semantics, which is also the synchr onou s semantics, is not tak en into accoun t in the definition of the dialgeb raic semantics. Using a L T S is not nece ssary at all to specif y a dialg ebra. W e do so m ostly for the sake of sim- plicity : the asynchro nous L TS semantics of process calculi is alread y well-u nderst ood. T he operation al semantic s could in turn be defined as a d ialgeb ra directly on the str ucture of proce sses (see § 7 for a brie f discus sion). On the ot her ha nd, the usage of a (ho we ver sp ecified) ope rationa l seman tics upon which a pr ocess equ i v alen ce is based can be co nside red at least a recurri ng pattern for the desig n of process equi v alences. The de finition of the s emantic eq ui v ale nce may be split in three step s, tha t we call e xecu te , inter act , observe : execute: the s ystem is run by th e means of its op eratio nal semantics, specifyin g some side e f fects of the proces s at each state of its ex ecuti on; interact: the observ er does exp eriments on the running system; obser ve: results are collected , allo wing the observ er to class ify process es by ho w they react to exper i- ments, gi vin g rise to the beha viour al equiv alence of cho ice. In coalge bras, th ese three step s are often tied to each other and not so easily separate d. Dialgebr as gi ve us a diffe rent perspecti ve on bisimilarity , where some actions are originated by a running process , and some others by the ex ternal en vironment. The process and the en vironment may be ve ry dif fere nt, and th e synt ax of experiment s is not (necessarily ) the same as the syntax of processe s. T his is not s o uncommon . Think e.g. of analysis or monito ring for security protocols . The entit ies (systems) that are being “observ ed” may be unkno wn machin es or e ve n human beings. The syntax of experime nts condu cted on such entities may ha ve noth ing in common with the entiti es themselv es. Example 1. For a classi cal example, think of an human (the observ er) in front of a drink -ve nding ma- chine. T he observ er can make experimen ts, such as pressing the b utton s, inserting coin s etc. A pre - condit ion for being able to te ll somethin g (and ev ent ually get a drin k) is that the machin e is runn ing. That is, a curren t state of the machine is defined, and the machine has an underlyin g oper ation al se- mantics , which is what the machine real ly does, inde pende ntly from what the observ er sees. While the V incenzo Ciancia 27 machine is running, the observer performs its e xperimen ts, and observe s some side-ef fect s. The ma- chines reaches a new sta te. This is an exampl e w here the “syntax of experimen ts” (e.g. insert ing a coin, or pressing a butto n) is not the “syn tax of the vending machine” w hich would be desc ribing its internal mechanic s. Related work. The stud y of dialgeb ras in computer scienc e was initiated in [4] for the categ orical specifica tion of da ta typ es, and fur ther in vesti gated for the same purpose in [9]. So far , they ha v e no t been e xplore d in deta il. In this wor k w e di vert from the earlier resea rch line: we find applications of dialge bras to programmin g language semantic s, and look at the beha vio ural equiv alences they indu ce on proces ses. Moreov er , ev en though we do not provide examples in the current paper , we do n ot restrict our attenti on just t o the polyno mial functor s as the synta x of experimen ts (therefo re, we u se t he eq ui v ale nces from k erne ls of mor phisms in stead o f t he re lation al lifting us ed in [9]). This is since we expect th at more comple x functors may hav e useful applica tions (see § 7). Map of the paper . In § 2 we giv e the definitions of algebras and coalgebra s, for compariso n with dialge bras. In § 3 we giv e the definition of a dialgebr a and expla in their intended use. In § 4 we present the asyn chron ous semantics of the CCS. In § 5 we gi v e a di algebr aic semantics to the CCS t hat coin cides with the asynchron ous one. In § 6 we informally discuss other examples of dialgebras . Finally in § 7 we ske tch some possible future direction s. 2 Algebras and Coalgebras Algebras and coalgebr as provid e an established method ology for the spec ification of progr amming lan- guage s yntax a nd semantics. W e giv e her e a brief introdu ction to the definit ions of algebra and coalge bra in a categ ory , tailored to a compa rison betwee n the se two constru ctions and tha t of a dialg ebra. For mor e details and pointe rs to the rich exist ing literature on algebras and coalgebras, see [10]. First we giv e the preliminary notion of a kerne l . For the category -theor etical concepts that we men- tion, we refer the reader to some basic cate gory theory book (see e.g. [2 ]). Definition 1. The k ernel of f : X → Y in a cate go ry C is the pullback (if it exists) of the diagr am f , f . When C = Set , the kern el of f (up-to iso morphism) is the set ker f = { ( x 1 , x 2 ) ∈ X × X | f ( x 1 ) = f ( x 2 ) } , equipped with the two ob vious projec tions; this is an equi v ale nce relation on X . Definition 2. (algebr a) Giv en a endofuncto r F in a cate gor y C , an F -algeb ra is a pair ( X , f : F X → X ) . An ho momorphis m between two F -algebras ( X , f ) and ( Y , g ) is an arro w h : X → Y such th at h ◦ f = g ◦ F h , that is, the follo wing diagra m commutes: F X FY X Y f g F h h When F is a polynomial functo r , and C is Set , t hen the notion of F -algebra coincides with the classical notion of algebra fo r a signatur e (to recove r the full po wer of equ ationa l specifications , one needs the strong er notion of algebra of a monad , which is out of the scope of this discussio n). 28 Interac tion and observ ation , cate goric ally Reminder: algebras specify opera tions on the elements of a set. For e xample, one can specif y the signature (not the equatio ns) of a monoid by providi ng a set X and the inter pretati on of compos ition and identit y . In othe r words, a monoid can be regarded as an algebra for th e fu nctor FX = 1 + X × X , th at is , a set X and a function f : 1 + ( X × X ) → X . The function f is the co-pai ring of f 1 : 1 → X , which is the interpretat ion of the identity of the m onoid , and f × : X × X → X , which interpr ets compositi on. Of particular rele v anc e for programming language semant ics is that alge bras specify the abstr act syntax of programming languages, by providin g operations on abstract syntax terms that can be applied to b uild larg er terms. The f unctor F pro vides a syntax to describe operat ions on elements, and an algebra ( X , f ) gi ve s the semantics of such a syntax, by computing elements out of these operation s. Definition 3. (coal geb ra ) Gi v en an endofu nctor B in a catego ry C , a B -coalg ebra is a pair ( X , f : X → BX ) . An homomorphis m between tw o B -coalgebras ( X , f ) and ( Y , g ) is an arro w h : X → Y such th at Bh ◦ f = g ◦ h , th at is, the follo wing diagram commutes: X Y BX B Y f g h Bh A coalgeb ra in the category Set of sets and functio ns is a function f : X → BX for some beha vio ural endofu nctor B : X → X . T he action of B on objects yield s a set B X for each X , which is intended to be the tran sition type or observatio n type of the system. When BX = P fin ( L × X ) an d C is Set , so tha t X is a set, then a B -coalgebr a f coincid es with the classic al not ion of la belled transition system (L TS) with lab els in L . Here, X is the se t of states of th e system, L is the set of label s, and for all x ∈ X , f ( x ) is a set of label led trans itions , that is, pairs ( ℓ, x ′ ) consis ting of a label and a destinati on state. Reminder: coalge bras specify observa tions on the elements of a set. For ex ample, on e can specify an in teracti ve syste m by pro vid ing a set X of states , and a transit ion functi on f : X → P fin ( L × X ) des cribin g the non-det erministi c observ ations that we can make about the ex ecut ion of a process, such as an input, an output, or an internal computati on. It is useful to think of L , in this specific case, as the type of side ef fects of the program exe cution . The crucial fact about co algebr as is that they form a ca tego ry , and the natural equi v alenc e relation obtain ed by the kernel of homomorp hisms generali ses bisimilarity of L T Ss. By changing the transi tion type B , one gains generality w .r .t. L T Ss. For inst ance, one can use the prob ability di strib ut ion fu nctor D in combination with other functors to expr ess va rious degre es of probab ilistic systems [11]. 3 Dialgebras Beha viou ral e qui v ale nces, such as bisimilarity , are typical ly no t based on the syntax of process es. R ather , an e xter nal observ er is assume d, that c an s ee their beha viour . Processes are eq ui v ale nt when the externa l observ er can not tell them apart. V incenzo Ciancia 29 In this section we introduce dialgebras . W e will see that the natural equi v alen ce relatio n induced by morphisms is still based on beha viou rs. Howe v er , the external observ er is now endo wed with the power to interact with the system, by doing ex periment s and observing the results. Definition 4. (dialg ebr a) Give n a category C , and two endofunc tors 1 F , B : C → C , a ( F , B ) - dialg ebr a is a pair ( X , f ) where X is an object and f : F X → BX is an arro w of C . W e w ill just refer to such a structure as a dialgeb ra w hen F and B are clear from the cont ext . In the remainde r of this section, let us fix two endof uncto rs F and B . W e call F the inter action func tor , as it is intended to pro vid e a syntax for const ructin g experime nts. The functo r B is the observa tion functor , which is the type of the observ ed results. Definition 5. (dialgebr a homomorphis m) Giv en tw o d ialgeb ras ( X , f ) an d ( Y , g ) , a dialg ebr a homomor - phism f rom ( X , f ) to ( Y , g ) is an arrow h : X → Y such that g ◦ F h = Bh ◦ f , that is , th e fol lo wing dia gram commutes F X FY BX B Y f g F h Bh ( F , B ) -dialgebr as and their homomorp hisms form a cate gory . Clearly , w hen B = Id (the identity functo r) one recov ers the categor y of F -algeb ras, and when F = Id one reco ver s the cate gory of B - coalge bras. In this wo rk, we only focus on dialgeb ras in the categor y Set of set s and function s. Example 2. Non-d etermini stic Mealy machine s ar e dialgebra s for the functors F X = I × X and B X = P fin ( O × X ) , for I th e set of input v alues and O the set of outpu t valu es. A dialgebra allows one to specify a set of exp eriments F X that , when ex ecut ed tro ugh f , giv e rise to observ ation s in BX . For a compariso n, we mention bia lge bra s . A bialg ebra [12] is a pair ( f , g ) of an algebra f : F X → X and a coa lgebra g : X → BX ha ving the same under lying set X . The al gebra is used to constru ct elements, the coalgeb ra to observ e them. Ev ery bi algebr a is also a dialgebra (the composi te g ◦ f : F X → BX ). Whereas a bialgebra specifies a set equ ipped with two separate, althou gh possib ly nicely inter acting , coalge braic and algebraic operations, a dialg ebr a spec ifies a set equipped with operatio ns that behav e algebrai cally and coalgebr aically at the same time. The interpre tation of the “algeb raic operation s” (the exper iments) of a dialgebr a does not yield a result, bu t rather an observ ation on it. When using dialgebra s, just like in algeb ras, the obse rve r can formally specify a structur e (the exp eriment) that will be ex ecute d; just like in coalgebras, the observ er interacts w ith the system in a step-wise fashi on: at each state, an expe riment can be condu cted, yielding obs erv atio ns and possibly subseq uent states, on which further exper iments are possible. Reminder: d ialgebra s specify operatio ns o n the elements of a set, th at yield observati ons as a result. W e now define the unde rlying equi v alen ce of a dialgebra. Definition 6. (dialg ebr aic bisimilar ity) Gi ve n a dialgebra ( X , f ) , dialgebraic bisi milarity is the relat ion ≈⊆ X × X induced by the kerne l of an y homomorphisms h : ( X , f ) → ( Y , g ) on the underly ing set X . That is, we say that x ≈ y ⇐ ⇒ ∃ ( Y , g ) . ∃ h : ( X , f ) → ( Y , g ) . h ( x ) = h ( y ) . 1 In [4], F and B just are required t o hav e the same codomain, not to be end ofunctors. The simplifi ed definition we adopt is suf ficient for this paper . 30 Interac tion and observ ation , cate goric ally In the rest of the pa per , we are going to see ho w to use di algebr as to model asynch ron y . An e xample charac terisat ion of th e equi valen ce induced by morphisms as a back-and-fo rth cond ition, as typical in bisimilar ity of L T Ss, is g i ven in Definition 12 and Theore m 1. 4 The asynchr onous CCS 4.1 Syntax and operational semantics The cal culus of communica ting systems (CCS) [6] is a simple langu age for studyin g interacti v e systems, featuri ng int erlea v ed parallel compositio n and synchroniz ation ov er named channels. In this paper , we use the asynchron ous seman tics. The definitio ns we adopt come from the ones for the π -calcu lus in [1]; we refer the reader to that work for an in-d epth study of asynchron y in process calculi . Let C denote a countab le set of channels . Define L i = C , L o = { ¯ c | c ∈ C } , L τ = { τ } , L = L i ∪ L o ∪ L τ , the set of input labels , output labels , interna l labels , and labels , respec ti ve ly . T hese labels are observ ations on a syste m, represe nting sending ( ¯ c ) or rece i ving ( c ) an input signa l on a channel c , or doing an internal computat ion step τ . Definition 7. (CC S syntax) The syntax of the async hrono us CC S is defined by the following grammar , where c ranges ov er a count able set C of channel names . P :: = / 0 | τ . P | c . P | ¯ c | P k P | P + Q W e omit the replic ation and restricti on constructs. This is done fo r ease of e xplan ation as addin g them does not af fect our proofs. From now on, let X denot e the set of agents. In the syntax, / 0 rep resent s the empty process, that does nothing; τ . P performs an internal computation step and then behav es as P ; c . P waits for an input signal on channel c , and then beha ve s as P ; ¯ c sends an output signal on channel c ; P 1 k P 2 is the parall el composition of P 1 and P 2 ; P + Q denotes non-deter ministic choice. Definition 8. (CCS oper ationa l semantics ) The operational semantics is giv en in the form of a L TS t : X → P fin ( L × X ) , de fined by the follo wing rules: c . P c − → P ( in ) τ . P τ − → P ( t au ) ¯ c ¯ c − → / 0 ( ou t ) P α − → P ′ P k Q α − → P ′ k Q ( par ) Q α − → Q ′ P k Q α − → P k Q ′ ( par ′ ) P c − → P ′ Q ¯ c − → Q ′ P k Q τ − → P ′ k Q ′ ( syn ) P α − → P ′ P + Q α − → P ′ ( sum ) Q α − → Q ′ P + Q α − → Q ′ ( sum ′ ) Rules ( in ) , ( t au ) , and ( ou t ) are strai ghtfor ward. R ules ( par ) and ( par ′ ) allo w componen ts to run in paralle l in an int erlea v ed fashi on. Rule ( syn ) allo ws a pro cess that ca n do a n in put and a process that can do an outpu t to synchron ise. Rules ( sum ) and ( sum ′ ) allo w a non-d etermini stic choi ce to take place. 4.2 Asynchr onous bisimilarity W e define asynchrono us bisimulation and bisimilarit y directly for CCS terms. Definition 9. (CCS async hr onous bis imilarity ) A relation R ⊆ X × X is an asyn chr onous simulation if and only if, whene ve r ( x , y ) ∈ R , and x α − → x ′ , then there is y ′ such that: V incenzo Ciancia 31 • if α = τ or α = ¯ c for some c , then y α − → y ′ and ( x ′ , y ′ ) ∈ R ; • if α = c for some c , then ¯ c k y τ − → y ′ and ( x ′ , y ′ ) ∈ R or , equiv alently if α = c for some c , then ( x ′ , y ′ ) ∈ R and eith er y c − → y ′ or y τ − → y ′′ with y ′ = ¯ c k y ′′ . An a sync hr onous bisimula tion is a s imulatio n R such that R − 1 is a simulat ion. A sync hr onous bisimila rity is the lar ges t bisimulation . W e write x ∼ y whenev er x is asynchron ous bisimila r to y , or equiv alently ther e is some a synch ronou s bisimula tion R such that ( x , y ) ∈ R . In asynchrono us bisimilarit y , inp ut labels can be matched “loosely” by a τ transit ion that stores an output pr ocess in pa rallel with the e x ecutio n. W e are going to se e how to turn this definition into dialgebraic bisimilarity . Before that, we remark that synchro nous bisimila rity (that would be obtain ed by empl oyi ng stro ng bisimilari ty on the L TS from Definition 8) is include d in the asynchr onous one. The inclusion is stric t. T wo processes that are not synchronou s bisimilar b ut are asynch ronou s bisimilar are c . ¯ c . / 0 + τ . / 0 and τ . / 0 (examp le adapted from [1], where a thorough discussio n can be found). 5 Observing interaction s Asynchro nous bisimilarity does not coincide with the co algebr aic bisimilarity obtain ed from the tra n- sition system of Definition 8. W e de fine a dialgeb ra whose set of states is that of the CCS agents, and where dialgeb raic bisimilarity is asynchro nous bisimilarity . 5.1 Dialgebra for th e asynchr onous CCS First, we define, and fix hereafter , a specific pair of interact ion and observ atio n func tors. Definition 10. (CCS interac tion and obse rvatio n functor s) W e let the interaction functor be F X = X + L o × X , and the obs erv atio n functor be B X = P fin (( L o ∪ L τ ) × X ) . For any set X , an element e of the disjoint union F X is either in the form x or ( ¯ c , x ) , for c ∈ C and x ∈ X . Roughly , e is the syn tax of an exp eriment where we can either observ e the ex ecutio n of x , or send a signal to x on channel c . An elemen t t of BX is a set of pairs ( ¯ c , x ′ ) or ( τ , x ′ ) for c ∈ C and x ′ ∈ X . The element t is a transition to x ′ labelle d with either the ob serv at ion of an output sig nal on a certain channel , or of an intern al compu tation step. No input labels appear . Inpu t is modelled as the ar gument of a func tion, inst ead of as a side-ef fect. This is in line w ith the idea that input is an action of the en vironment, not an action of the process. W e now define a ( F , B ) -dialgeb ra for the CCS. From no w on, whenev er f is a dialgebra , we use the shorth and e β − → f x ′ to deno te that ( β , x ′ ) ∈ f ( e ) , and omit f when clear from the contex t. Definition 11. (CCS dialgebr aic se mantics) The ( F , B ) -dialg ebra f : F X → B X , where X is the se t of CCS process es equip ped w ith the operationa l semantic s of Definition 8 , is defined by the follo wing ru les: x α − → x ′ α = τ ∨ α = ¯ c x α − → f x ′ ( run ) x c − → x ′ ( ¯ c , x ) τ − → f x ′ ( in ) x τ − → x ′ ( ¯ c , x ) τ − → f ¯ c k x ′ ( s t ore ) 32 Interac tion and observ ation , cate goric ally Premises of ru les us e the ope ration al semantic s of Definition 8 . Rule ( r un ) expresse s the fact that we can observ e th e o utput and interna l computati on steps of a system. Rule ( in ) stat es that whenev er a proc ess x can do input, the ex perimen t ( ¯ c , x ) yields the observ ation of an internal computatio n step . By Rule ( st ore ) , w hene v er a process can do an internal computation step, then it can also store an input signal from the en viro nment for subse quent processing . T he observ ation s fo r the ( in ) and ( st ore ) rules are the same, therefo re an observ er can not distinguish the applicatio n of either one of the two rules. 5.2 Characterising dialgebraic bisimilari ty A characte rizatio n of the equi v alen ce induced by dialgeb ra homomorphisms for the functors F and B of Definition 10 can be gi ven as fo llo ws. Definition 12. (Bac k-a nd-fo rth bisimilarity of dial geb ra s) Giv en a ( F , B ) -dialgeb ra f : F X → BX , a relatio n R ⊆ X × X is a back- and-fo rth simula tion if and only if, for all ( x , y ) ∈ R and c ∈ C : 1. whene v er x α − → f x ′ , there is y ′ such that y α − → f y ′ and ( x ′ , y ′ ) ∈ R ; 2. whene v er ( ¯ c , x ) τ − → f x ′ , there is y ′ such that ( ¯ c , y ) τ − → f y ′ and ( x ′ , y ′ ) ∈ R . A bisimulation is a simula tion R such that R − 1 is a simulatio n. T wo elements of X are said bisimila r if and only if there is a bisimulati on relating them. The correspon ding relation is called bisimilarit y . W e write x ≃ y to denote that x is bisimilar to y . Pro position 1. Bac k-and -forth bisimilarity is an equivalence rela tion. Theor em 1. (back-and-fo rth vs. kernel) When F and B ar e as in Definition 10, dialgebr aic bisimila rity fr om Definition 6 and bac k-an d-for th bisimila rity fr om Definition 12 coincide . Pr oof. Fix a dialge bra ( X , f ) . First, co nsider a dialge bra ( Y , g ) and h : ( X , f ) → ( Y , g ) . W e sho w that ker h is a back -and-f orth bisimulation , therefore it is included in ≃ . A ssume hx = hy for some x , y ∈ X . For all α ∈ L , by de finition of homomorphism, we ha v e g ( Fh ( α , x )) = Bh ( f ( α , x )) . There- fore g ( α , hy ) = Bh ( f ( α , x )) . Let ( β , x ′ ) ∈ f ( α , x ) . T hen ( β , hx ′ ) ∈ Bh ( f ( α , x )) , therefore ( β , hx ′ ) ∈ g ( α , hy ) = g ( F h ( α , y )) , thus by commutati vity ( β , hx ′ ) ∈ Bh ( f ( α , y )) . T hen there is some y ′ such that ( β , y ′ ) ∈ f ( α , y ) and hx ′ = hy ′ . This pro ve s that k er h is a s imulatio n. Notic e that th e k ernel of a function is an equi v ale nce relat ion, therefore ( ker h ) − 1 = ker h ) , thus prov ing that ker h is a bisimulatio n. For the other di rectio n of the pr oof, let [ x ] denote the equiv alence class of x i n X / ≃ . Conside r the quo tient dialg e- bra ( X / ≃ , f / ≃ ) , with f / ≃ ( α , [ x ]) = { ( β , [ x ′ ]) | ( β , x ′ ) ∈ f ( x ) } . N otice that f / ≃ is well defined by definition of ≃ . The quotient function hx = [ x ] is obviousl y a homomorphism of dialgebras, and it is the case that whene v er x ≃ y then h ( x ) = h ( y ) . Finally , we prov e that asynch ronou s and back-an d-fort h bisimilar ity coincid e. Theor em 2. (asy nchron ous vs. back-a nd-for th) Async hr onous bisimilari ty fr o m Definitio n 9 and bac k- and-fo rth bisimilarity coincide for the set X of C CS ag ents, that is: fo r all x , y ∈ X , we have x ∼ y if and only if x ≃ y. Ther efor e , by Theor em 1, async hr onous bisimilarit y and dialge bra ic bisimilarity coincide . Pr oof. W e provid e the proof just for completeness, as it is immediate from the character isatio n of asyn- chrono us bisimilarity as a 1-bisimilarity in [1 ]. W e prov e that ∼ is a back-and -forth bisimu lation . Sym- metry , and C ase 1 from Definiti on 12 are obv ious. For Case 2, sup pose ( ¯ c , x ) τ − → x ′ . Then we dis tingu ish two cas es. V incenzo Ciancia 33 • if Rule ( in ) is applied to ( ¯ c , x ) , w e ha v e x c − → x ′ . W e no w look at Definition 9. Since x ∼ y , w e ha v e ¯ c k y τ − → y ′ with x ′ ∼ y ′ . W e insp ect the rules in Definition 8. T he rules that can be appl ied to ¯ c k y are ( par ) and ( syn ) (and ( par ′ ) which is treated in the same way as ( par ) ). Therefor e we ha v e ei ther y τ − → y ′′ with y ′ = ¯ c k y ′′ , or y c − → y ′ . By apply ing either Rule ( in ) or ( st ore ) from Definition 11, we obta in ( ¯ c , y ) τ − → f y ′ and since x ′ ∼ y ′ we get the thesis. • if Rul e ( s t ore ) is appl ied to ( ¯ c , x ) , then x τ − → x ′′ with x ′ = ¯ c k x ′′ . Therefore, y τ − → y ′′ and x ′′ ∼ y ′′ . It is w ell kno wn and easy to prove that x ′′ ∼ y ′′ = ⇒ ¯ c k x ′′ ∼ ¯ c k y ′′ . Therefore by applying Rule ( s t ore ) we get ( ¯ c , y ) τ − → y ′ and x ′ ∼ y ′ , q.e.d. Next, we prov e that ≃ is an asynch ronou s bisimul ation. Suppose x ≃ y and x α − → x ′ . W e look at Definition 9. The cases for α = τ or α = ¯ c are obviou s. Suppose α = c for some c . By Rule ( in ) in Definition 11 we ha v e ( ¯ c , x ) τ − → f x ′ and by x ≃ y we get ( ¯ c , y ) τ − → f y ′ with x ′ ≃ y ′ . E ither Rule ( in ) or ( s t ore ) from Definition 11 can be applied to ( ¯ c , y ) . Therefore either y c − → y ′ , or y τ − → y ′′ with y ′ = ¯ c k y ′′ . In both cases, we ha v e ¯ c k y τ − → y ′ and x ′ ≃ y ′ , from which the thesis. 6 Discussion on further examples The e xample that we present is very simple, an d purpos ed to illustrat e just th e idea of an observ er that can inter act with the examined syst em. More interesting dialgebras can be descri bed by either moving to a riche r catego ry than Set , or by changin g the interaction and observ ation functor . W e briefly desc ribe some possibl e construct ions, whose detailed study is left for future work. Complex syst ems Consid er dialge bras of the form f : P fin ( X ) → L × P fin ( X ) . At each step in time, from a se t p ∈ P fin ( X ) , a side effect in L is obser ved , and a ne w set of elements p ′ is obtained . Suc h a functio n m ay be used to represent systems where the semantics depends on a number of entitie s that collab orate. At each step in time, the system ev olves, some old elements may be “destro ye d” and ne w elements can be create d, while some side effect in L tak es place . The beha viour of the system is mor e than the sum of its parts , in the sense that it is not determined by the beha vio ur of singletons. The semantic s of { x } , that is, x in isolatio n, may be tota lly unrelate d to the semantics of, say , the set { x , y } . Notice that f : P fin ( X ) → L × P fin ( X ) is also a coalgeb ra in Set fo r the functor T ( X ) = L × X , ha vin g P fin ( X ) as und erlyin g set. Ho we ve r , it’ s ob viou s that the obtaine d notion of bisimul ation is not the same, ev en by just look ing at types. Seeing f as a coalgebra, on e gets a relation on P fin ( X ) ; seeing it as a dialgebra, one gets a relation on X , that takes into account ho w elements behav e when joined to the same sets of other elements. Chemical reac tions In many cases prog ramming languag e semantics has been inspired by chemi- cal and biol ogical proc esses. Consider the finite mult i-set functor M ( X ) = { m : X → N | { x | m ( x ) 6 = 0 } is finite } . Think o f X as a se t o f elements that take part in r eactio ns in vari able qu antitie s. A dialgeb ra f : M ( X ) → M ( X ) specifies ho w a giv en reaction ev olv es by creat ing a multi-se t of produc ts from a multi-set of reagent s. T he obtain ed notion of bisimilarity m ake s reagen ts equ i v alent when substit uting one with the other in any rea ction yields equi v ale nt products , in the same quantities. The π -calculus A very similar dev elopme nt to the one prese nted here, ex empli fying the use of a dif- ferent base cate gory , is the semanti cs of the async hrono us π -calcu lus. Similarly to what happen s for 34 Interac tion and observ ation , cate goric ally the synchro nous pi-calcul us and coalgebras [3 ], one would use the functor cate gory Set I , w here I is the cate gory of of finite sets and injections . The semanti cs would in volv e the endofunctor for fr esh na me alloca tion δ which is typical of func tor categori es, which is needed to properly model boun d outp ut. Dialgebr as using δ corres pond to Mealy mach ines with name allocat ion along outp ut, whose study is possib ly of interest independ ently from the specific applicati on of the π -calcu lus. T esting se mantics Even though we spoke of interaction and ob serv at ion, we di d not mention so f ar the fa mily of testin g eq uival ences (see [7]), where interactio n and observ ation play a ke y role. T esting equi v alences are defined as thos e obtain ed by putting a process in parallel with an arbi trary other process making use of a distingu ished ch annel. O utput on such channe l si gnals that a test has been successful. Binary dialgeb ras come to mind as an ef fecti v e way to represent such kinds of equiv alence relation s. Ho wev er , in testing eq ui v ale nces, one is not ab le to obs erv e ho w many synchron isation steps b etween proces ses are needed befo re the succ ess sign al is sent. Such a semant ics could be defined by observing the beha viour of a proc ess as a sing le “big step”; ho wev er , this w ould defe at the implicit coind ucti v e proper ties of dialg ebras . A common feature of dialgebras and coalg ebras is that obse rv atio ns lead to succes sor states, and the n in a coinducti ve fashion further e xperi ments/ob serv at ions can b e done on these succes sor states. Howe ve r , in the case of testi ng equi v alences, th ere is no succes sor state : once success is sig nalled , the e xperi ment is con clude d. Further in vestigati on may yi eld non-ob vio us coinducti ve ways to represen t these kind of relations on process es. 7 Conclusions and futur e w ork The con struct ion w e ha v e see n in § 5 has obv ious similar ities with barb ed equi v ale nce and with th e asyn- chrono us semantics of the π -calcu lus by Honda and T okoro (both describe d in [1]). That’ s expectab le, since in the end we are trying to describ e the same equi v alen ce relation. In the case of the asynchrono us CCS, it is not difficult to recov er a coalge braic semantics. This is done by translati ng the dialgebrai c semantics along the isomorphi sms X + L o × X → P fin (( L o + L τ ) × X ) ∼ = ( L i + 1 ) × X → P fin (( L o + L τ ) × X ) ∼ = X → ( P fin (( L o + L τ ) × X )) L i + 1 (indee d, after noting tha t L i ∼ = L o ). Notice that the latte r is genuinely a coalgebra fo r the fun ctor ( P fin ( L o + L τ ) × − ) L i + 1 . It is n ot difficult to see that such a translation preserve s and reflects the equi v ale nce induced by kernel s of homomorphisms (of dialgeb ras in one case, of coalgeb ras in the other). Even thoug h it might be interestin g to deriv e a coalgeb raic semantics for the asy nchron ous CCS, we do not discu ss the details of such a const ructio n: the purpose of using this language as an examp le is not to pro vi de a new semantics for asynch ronou s proc ess calcu li. Rather , the asynchro nous CCS is possib ly the simplest language where it m ake s sense to distingu ish be tween mov es of the en vironment and mo v es of the system being e xamined in ord er to define t he semantics. O ur aim is to show how such a distin ction is naturall y encoded using dialgebr as, and their built -in definition of beha vioural equ i v alenc e makes the m appealing as an alternati v e to coalge bras in the specificatio n of interacti v e systems. W e summarise below some poss ible future direction s and ope n question s. Inductiv ely defined dialgebra s. W e defined a dialgebr a for the asy nchro nous C CS by as suming an exi sting operation al semantics. It is indeed possible to specify such a semantics using dialg ebras. First, becaus e coalgebra s actually ar e dialgebra s with F = Id . Moreo ve r , one cou ld easily define an ( F , B ) - dialge bra, for F and B as in § 5, directly by induction on terms forming the set of agents X , in the same fashion of bialgebra s and distrib uti ve laws. It would be relev ant to study distrib uti v e laws and V incenzo Ciancia 35 specifica tion langu ages for induct i vel y defined dialgeb ras, follo wing the sa me r oute of b ialgeb ras. D oing so, it would be possib le to g uaran tee that a gi ve n di algebr aic semantics of a calcu lus is also a congruenc e with respect to the operato rs of the algebra describin g its syntax. Logics Dialgeb ras are equipped in [9] with dialg ebr aic spec ificati ons , ev en though neither a full ade- quac y result relating logical equi v alenc e an d bisimilarity , nor Birko f f-sty le theorems are establish ed. It ought to be clarified what i s a logical formalis m that adeq uately specifies dial gebras . Such a logic woul d be an intermedia te lang uage between modal and equational logic. The work [8], relati ng dialgebras to the so-called abstrac t lo gics is possibly r ele v an t. T his research line should ta ke adv anta ge of, and extend, the many e xist ing studies in the field of coalge braic modal logic. Non-polynomial in teract ion functors Dialgebra s are parametrised in the interactio n and observ atio n functo rs. Non-p olyno mial interaction functors, such as e.g. a prob abilit y distrib ution ov er the input v alues , could provide v alua ble case stud ies. M odulo the observ ati on fun ctor being “probabilis ed”, too, such dialgebras may be used to represent a kind of probabilist ic Mealy m achine s, where the probabili ty distrib ution of the inp ut determin es that of the output. It should be understo od w hether in the case of non-p olynomia l interac tion functors there is some gain in expr essi v e power w . r .t. coalgeb ras. Minimisation Coalgebras hav e an eleg ant and simple minimis ation procedu re, based on iterati on along the terminal sequence and gen eralisi ng partition refinement for automata . Are there canon ical models in dialgeb ras? The resu lts in [9] seem to point out that such a theory woul d be very dif ficult in the prese nce of so-calle d binary meth ods , due to non -closu re of bisimulations under union, and the lack o f a final dia lgebra . Howe v er , the (dialgeb raic) bisimilarity quoti ent may still exis t in interestin g cases. More work is required on this side. The precise conditions w hen final dialgebras and bisimilarity quotie nts exist should be clarified. Also notice that in [9] F is assumed to be polynomia l. Since we seek for non-pol ynomial interacti on functors too, w e expect that some work on the side of canon ical m odels will b e need ed in order to und erstan d how b isimilarit y of dial gebra can be decided, possibly by fi nite repres entatio ns deri v ed from the definition s of F and B . Refer ences [1] Roberto M. Amad io, Ilaria Castellani & Davide Sang iorgi (199 8): On b isimulations for the asynchr o nous pi-calculu s . Theoretical Computer Science 195(2 ), p p. 291 – 324. doi: 10.1007/3- 540- 616 04- 7_ 53 [2] Ste ve A wodey (201 0): Category Theory (Oxfo r d Logic Gu ides) , 2 edition. Oxfor d University Press, USA.doi: 10.1093/acpro f: oso/978019 856861 2. 001.00 01 [3] Marcelo P . Fiore & Daniele T u ri ( 2001) : Se mantics of Name and V alu e P assing . In: 16th Annual IEEE Symposium on Lo gic in Com puter Science (L ICS) , IEEE Computer Society , pp. 93– 104. doi: 10.1109/ LICS.2001.93248 6 [4] T atsuya Hagin o (1987): A Categorical Pr ogramming Language . Ph .D. thesis, Uni versity of Edinb urgh. [5] G.H. Mealy (1955): A Method to Synthesizing Sequential Cir cuits . Bell System T echnica l Journal , p p. 1045– 1079 . [6] R. Milner (1982) : A Calcu lus of Communicating Systems . Sp ringer-V erlag New Y ork, Inc. [7] Rocco De Nico la & M atthew Hennessy (1 984): T esting Eq uivalences for Pr ocesses . Theoretical Co mputer Science 34, pp. 83–13 3. doi: 10.1016/ 0304- 3975 (84)9 0113- 0 36 Interac tion and observ ation , cate goric ally [8] Alessandra Palmigian o (20 02): Abstract Logics as Dialgebras . Electronic Notes in Th eoretical Com- puter Scien ce 65(1) , pp. 254 –269. CMCS’2002, Co algebraic Me thods in Comp uter Science. doi: 10 .1016/ S1571- 0 661(04 )80367- 0 [9] Erik Poll & Jan Zwanen burg (2001) : F r om Alg ebras and Coa lgebras to Dialgebras . Electronic Notes in The- oretical Co mputer Scien ce 44(1) , pp . 289 – 307. CMCS’2001 , Coalgeb raic Meth ods in Co mputer Science . doi: 10.1016/S1571 - 0 661(0 4)80915- 0 [10] J. J. M. M. Rutten ( 2000) : Unive rsal coalgebra: a th eory of systems . Theoretical Comp uter Science 249(1 ), pp. 3 – 80. doi: 10.1016 / S0304- 397 5(00) 00056- 6 [11] A. Sokolov a (2005): Coalgebraic Analysis of Pr oba bilistic Systems . Ph.D. thesis, TU Eind hoven. [12] Daniele T uri & Gordon Plotkin ( 1997) : T owards a Mathematical Operational Semantics . In: 12th Ann ual IEEE Symposium on Logic in Computer Scien ce (LI CS) , IEEE Computer Society , pp . 280–2 91. doi: 10. 1109/LICS.1997.61495 5

Original Paper

Loading high-quality paper...

Comments & Academic Discussion

Loading comments...

Leave a Comment