570 likes | 645 Views
ICTCS 2003, Bertinoro (FC), 13-15 Ottobre 2003. Algebraic Theories for Contextual Pre-Nets Roberto Bruni - Dipartimento di Informatica, Università di Pisa. joint work with: José Meseguer (UIUC) Ugo Montanari (UNIPI) Vladimiro Sassone (COGS). Plan of the Talk. Introduction
E N D
ICTCS 2003, Bertinoro (FC), 13-15 Ottobre 2003 Algebraic Theories for Contextual Pre-NetsRoberto Bruni - Dipartimento di Informatica, Università di Pisa joint work with: José Meseguer (UIUC) Ugo Montanari (UNIPI) Vladimiro Sassone (COGS)
Plan of the Talk • Introduction • P/T Petri nets and pre-nets • Read arcs, molecules and match-share • Partial membership equational logic • Algebraic theories • Final remarks and conclusions Algebraic Theories for Contextual Pre-Nets
Plan of the Talk • Introduction • P/T Petri nets and pre-nets • Read arcs, molecules and match-share • Partial membership equational logic • Algebraic theories • Final remarks and conclusions Algebraic Theories for Contextual Pre-Nets
Petri Nets and Read Arcs • P/T Petri nets [Petri’62] • basic model of concurrency supported by a large community and by industrial-quality tools • a media for conveying ideas to non-expert thanks to a suggestive graphical presentation • Nets with read arcs • aka nets with test arcs, aka nets with activator arcs, aka contextual nets • model a non-destructive read operation • multiple concurrent readings of resources are possible • naïve encoding in P/T nets would serialize these accesses, with a dramatic loss of concurrency and efficiency Algebraic Theories for Contextual Pre-Nets
Semantic Approaches • Petri nets • processes • causality and concurrency within a single run • unfolding • causality, concurrency and conflict between all possible events • algebraic • algebra of computations • logic • deduction theories • Contextual nets • processes • unfolding • (asymmetric conflict) • algebraic • molecules • tokens are not atomic entities • match-share • too many fictitious behaviours • logic Algebraic Theories for Contextual Pre-Nets
Aim • Neat algebraic / logic characterization of the (monoidal) category of concurrent computation of contextual nets • Functorial construction • net morphisms are preserved • Universal construction • compositionality • Exploit PMEqtl theories • proofs simplified by PMEqtl techniques • Follow the individual token philosophy • more informative semantics • 1 + 4 = Pre-nets must be used Algebraic Theories for Contextual Pre-Nets
Plan of the Talk • Introduction • P/T Petri nets and pre-nets • Read arcs, molecules and match-share • Partial membership equational logic • Algebraic theories • Final remarks and conclusions Algebraic Theories for Contextual Pre-Nets
Terminology and Notation • Places a,b,c,…classes of resources • Transitions t,t’,…basic activities • Tokens instances of a resource class • Markings u,v,w,…multisets of resources • Multiset union uw • Empty marking • Places are unary markings a • Pre-sets tresources necessary to execute t • multiset fetched by the execution of t • Post-sets tresources produced by t • We write t:uv for t=u and t=v Algebraic Theories for Contextual Pre-Nets
Formal Definition • A P/T Petri net is a graph N=(S,T,pre,post,u0) • Sis the set of markings • (is the free monoid over the set of places S) • (Nodes of the graph) • T is the set of transitions • (Arcs of the graph) • pre:T S assigns pre-sets to transitions • pre(t) = t • (Source map of the graph) • post:T S assigns post-sets to transitions • post(t) = t • (Target map of the graph) • u0 is the initial marking Algebraic Theories for Contextual Pre-Nets
Circles and Boxes a1 a2 • Circles are places • Boxes are transitions • Weighted arcs model pre- and post-sets • Bullets are tokens t1 t2 a3 2 2 2 uo=a1a2 t1:a12a3 t2:a2 2a3 t3:2a3a4 t3 a4 Algebraic Theories for Contextual Pre-Nets
CTPh vs. ITPh • Collective Token Philosophy (CTPh) • Any two tokens in the same place are • indistinguishable one from the other • computationally equivalent • Individual Token Philosophy (ITPh) • Any token carries its own history • tokens have unique origins • fetching one token makes an activity causally dependent from the activities that produced it • such analysis can be important for recovery purposes, detecting intrusions, increase parallelism, … Algebraic Theories for Contextual Pre-Nets
CTPh vs. ITPh: Graphically a1 a2 a1 a2 t1 t2 t1 t2 a3 a3 2 2 2 2 2 2 t3 t3 a4 a4 Algebraic Theories for Contextual Pre-Nets
CTPh vs. ITPh: Graphically a1 a2 a1 a2 t1 t2 t1 t2 a3 a3 2 2 2 2 2 2 e1 e2 t3 t3 a4 a4 Algebraic Theories for Contextual Pre-Nets
CTPh vs. ITPh: Graphically a1 a2 a1 a2 t1 t2 t1 t2 a3 a3 2 2 2 2 2 2 e1 e2 t3 t3 e’3 e’’3 a4 a4 Algebraic Theories for Contextual Pre-Nets
CTPh vs. ITPh: Graphically a1 a2 a1 a2 t1 t2 t1 t2 a3 a3 2 2 2 2 2 2 e1 e2 t3 t3 e’3 e’’3 a4 a4 Algebraic Theories for Contextual Pre-Nets
uS t:uvT [idle] [firing] u:uNu t:uNv commutative associative unit :N :uNv :u’Nv’ [parallel composition] :uu’Nvv’ :uNv :vNw monoid homomorphism identities u:uNu [sequential composition] ;:uNw Petri Nets are Monoids • Proof terms denote CTPh computations: • commutative processes Algebraic Theories for Contextual Pre-Nets
ITPh and Pre-Nets • T(.) : Petri CMonCat • CTPh, functorial, universal, expressed in PMEqtl • P(.), DP(.), Q(.) : Petri SMonCat • ITPh, non functorial • Pre-Net RN as implementation of N [BMMS99] • pre- and post-sets are strings, not multisets • for each t:uv, one implementation tp,q:pq, with p,qS (p)=u and (q)=v • Z(.) : PreNets SMonCat • ITPh, functorial, universal, expressed in PMEqtl • all pre-nets implementations of N have the same semantics Algebraic Theories for Contextual Pre-Nets
pS p,qS t:pqT [idle] [firing] [symmetry] p:pRp p,q:pqRqp t:pRq commutative associative unit :R :pRq :p’Rq’ [parallel composition] :pp’Rqq’ :pRq :qRr monoid homomorphism identities p:pRp [sequential composition] ;:pRr Pre-Nets are Monoids • Proof terms denote ITPh computations: • concatenable processes Algebraic Theories for Contextual Pre-Nets
Example a1 a2 p0=a1a2 (t1t2) ; (t3t3) = (t1;t3) (t2;t3) t1 t2 a3 a3 a3 a3 t3 t3 Algebraic Theories for Contextual Pre-Nets
Example a1 a2 p0=a1a2 (t1t2) ; (a3a3,a3a3) ; (t3t3) t1 t2 a3 a3 a3 a3 t3 t3 Algebraic Theories for Contextual Pre-Nets
Plan of the Talk • Introduction • P/T Petri nets and pre-nets • Read arcs, molecules and match-share • Partial membership equational logic • Algebraic theories • Final remarks and conclusions Algebraic Theories for Contextual Pre-Nets
Nets with Read Arcs • Graphically rendered as undirected arcs • Equivalent to self-loops from the point of view of reachability • Allow more parallelism • Ex. readL and readR can fire concurrently! u0=aLbaR (aLreadR) ; (readLcR) (readLaR) ; (cLreadR) aL aR b readL readR we need syntax to write readL(?)readR cL cR Algebraic Theories for Contextual Pre-Nets
Molecules, Atoms, Electrons • token a • context [a] • Non free monoid of places [Mes96] • a = {a|0} and {a|n} = {a|n+1}[a] • Molecules for CTPh and ITPh [BM01] • Two monoid homomorphisms: (.)+ and (.)- • (uv)+ = (u)+ (v)+ and ()+ = • (uv)- = (u)- (v)- and ()- = • Suitable laws • u = (u)+ (u)- • ((u)+)- = ((u)-)+ = (u)- • ((u)-)- = • (u)k = ((u)+ …)+ • (u)0 = u and (u)1 = (u)+ and (u)k+1 = ((u)k)+ • atom a • nucleus (a)k • electron (a)- Algebraic Theories for Contextual Pre-Nets
Example u0=aLbaR readL b2 readR = (readLb+aR) ; (cLb+readR) = (aLb+readR) ; (readLb+cR) b+ aL aR b- readL readR Drawback: Tokens are not atomic entities cL cR Algebraic Theories for Contextual Pre-Nets
Match-Share Categories • Match-Share categories [GM98] • symmetric monoidal categories, plus • with suitable axioms • p,p;p = p and p;p,p = p • (pp);p = (pp);p and p;(pp) = p;(pp) • = and = • pq = (pq,pq);(pq) and pq = (p q);(pp,qq) • p;p = (pp);(pp) • p;p = p pS pS [match] [share] p:ppRp p:pRpp commutativity associativity monoidality { MAIN AXIOMS { Algebraic Theories for Contextual Pre-Nets
Match-Share Graphically a b a a a a,b a a b a a a a a a a,a a a a a a = a a a Algebraic Theories for Contextual Pre-Nets
Match-Share Graphically a b a a a a,b a a b a a a a a a a a a a a a a a = a a a a a a Algebraic Theories for Contextual Pre-Nets
Match-Share Graphically a b a a a a,b a a b a a a a a a a a a = a a a Algebraic Theories for Contextual Pre-Nets
Match-Share Graphically a b a a a a,b a a b a a a a a a a a a a a a a a = a a a = a a a a a a a a a a a a Algebraic Theories for Contextual Pre-Nets
Transitions as Arrows aL b b aR b b readL readR b b cL b b cR Algebraic Theories for Contextual Pre-Nets
Example aL b aR readL cL b aR readR cL b cR Algebraic Theories for Contextual Pre-Nets
Example aL b aR readL cL b aR readR cL b cR Algebraic Theories for Contextual Pre-Nets
Example aL b aR readL cL aR readR cL b cR Algebraic Theories for Contextual Pre-Nets
Example aL b aR readL cL aR readR cL b cR Algebraic Theories for Contextual Pre-Nets
Example aL b aR readL cL aR readR cL b cR Algebraic Theories for Contextual Pre-Nets
Example aL b aR readL readR cL b cR Algebraic Theories for Contextual Pre-Nets
Example aL b aR readR readL cL b cR Algebraic Theories for Contextual Pre-Nets
Example aL b aR readR • S(R) free SMonCat • distinguishes too much • MS(R) free MSCat • too many arrows • E(R) : S(R) MS(R) • E(a) = a • E(t:uwv) = (uw) ; (tw) ; (vw) • Drawback: • is MS(R) meaningful? readL cL b cR Algebraic Theories for Contextual Pre-Nets
Plan of the Talk • Introduction • P/T Petri nets and pre-nets • Read arcs, molecules and match-share • Partial membership equational logic • Algebraic theories • Final remarks and conclusions Algebraic Theories for Contextual Pre-Nets
PMEqtl • Partial Membership Equational Logic • convenient definition of theories for nets and their computations • subsort for regarding objects as idle steps • partiality of sequential composition • membership predicates for selecting admissible behaviours • tensor product of theories for MonCat • efficiently supported by Maude 2.0 • proof of freeness follows by PMEqtl results • adjunctions proved by existence of theory morphisms Algebraic Theories for Contextual Pre-Nets
MON fth MON is sort Monoid . op e : Monoid . op __ : Monoid Monoid -> Monoid [assoc id:e] . endfth Algebraic Theories for Contextual Pre-Nets
CAT fth CAT is sorts Object Arrow . subsort Object < Arrow . ops d(_) c(_) : Arrow -> Object . op _;_ . var a : Object . vars f g h : Arrow . eq d(a) = a . eq c(a) = a . ceq a;f = f if d(f)=a . ceq f;a = f if c(f)=a . cmb f;g : Arrow if c(f)=d(g) . ceq d(f;g) = d(f) if c(f)=d(g) . ceq c(f;g) = c(g) if c(f)=d(g) . ceq f;(g;h) = (f;g);h if c(f)=d(g) and c(g)=d(h) . endfth Algebraic Theories for Contextual Pre-Nets
SMONCAT fth SMONCAT is including MONCAT . op (_,_) : Object Object -> Arrow . vars a a’ b b’ c : Object . vars f f’ : Arrow . eq d((a,b)) = ab . eq c((a,b)) = ba . eq (a,e) = a . eq (e,a) = a . eq (ab,c) = (a(b,c)) ; ((a,c)b) . eq (a,b);(b,a) = ab . ceq (ff’);(b,b’) = (a,a’);(f’f) if d(f)=a and d(f’)=a’ and c(f)=b and c(f’)=b’ . endfth Algebraic Theories for Contextual Pre-Nets
MSCAT fth MSCAT is including SMONCAT . ops (_)(_) : Object -> Arrow . vars a b : Object . eq d((a)) = aa .eq d((a)) = a . eq c((a)) = a . eq c((a)) = aa . eq (e) = e . eq (e) = e . eq (a,a);(a) = (a) . eq (a);(a,a) = (a) . eq (ab) = (a(b,a)b);((a)(b)) . eq (ab) = ((a)(b));(a(a,b)b) . eq ((a)a);(a) = (a(a));(a) . eq (a);((a)a) = (a);(a(a)) . eq (a);(a) = a . eq (a);(a) = (a(a));((a)a). endfth Algebraic Theories for Contextual Pre-Nets
Plan of the Talk • Introduction • P/T Petri nets and pre-nets • Read arcs, molecules and match-share • Partial membership equational logic • Algebraic theories • Final remarks and conclusions Algebraic Theories for Contextual Pre-Nets
RAUT (Read-Automata) fth RAUT is including MON . sort Rtrans . subsort Monoid < Rtrans . ops pre(_) post(_) ctx(_) : Rtrans -> Monoid . var u : Monoid . eq pre(u) = e . eq post(u) = e . eq ctx(u) = u . endfth Algebraic Theories for Contextual Pre-Nets
markings idle+transitions RCOMP (Read-Computation) E(MS(R)) fth RCOMP is including MSCAT . sort Rtrans Rarrow . subsort Object < Rtrans < Rarrow < Arrow . ops pre(_) post(_) ctx(_) : Rtrans -> Object . op mk(_) : Rtrans -> Arrow vars h k : Rarrow . var t : Rtrans . vars u v : Object . mb hk : Rarrow . mb (u,v) : Rarrow . cmb h;k : Rarrow if c(h)=d(k) . eq d(t) = pre(t)ctx(t) . eq c(t) = post(t)ctx(t) . eq pre(u) = e . eq post(u) = e . eq ctx(u) = u . eq d(mk(t)) = d(t) . eq c(mk(t)) = c(t) . eq mk(u) = u . eq t = (pre(t)(ctx(t)));(mk(t)ctx(t));(post(t)(ctx(t))) . endfth MS(R) self-loop version Rarrow is symmetric monoidal relation between t and its self-loop version Algebraic Theories for Contextual Pre-Nets
t and mk(t) b b a b b t c b b b b Algebraic Theories for Contextual Pre-Nets
t and mk(t) b b a b b b mk(t) b c b b b b Algebraic Theories for Contextual Pre-Nets
t and mk(t) b b a b b b mk(t) b c b b b b Algebraic Theories for Contextual Pre-Nets