Post on 02-Feb-2016
description
1
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)
ICTCS 2003, Bertinoro (FC), 13-15 Ottobre 2003
Algebraic Theories for Contextual Pre-
Nets 2
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 3
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 4
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 5
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 6
Aim Neat algebraic / logic characterization of the
(monoidal) category of concurrent computation of contextual nets
1. Functorial construction net morphisms are preserved
2. Universal construction compositionality
3. Exploit PMEqtl theories proofs simplified by PMEqtl techniques
4. Follow the individual token philosophy more informative semantics
5. 1 + 4 = Pre-nets must be used
Algebraic Theories for Contextual Pre-
Nets 7
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 8
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 t resources necessary to execute t multiset fetched by the execution of t
Post-sets t resources produced by t We write t:uv for t=u and t=v
Algebraic Theories for Contextual Pre-
Nets 9
Formal Definition A P/T Petri net is a graph N=(S,T,pre,post,u0)
S is 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 10
Circles and Boxes
2
a1
t1
a2
t2
a3
t3
a4
2
Circles are places Boxes are transitions Weighted arcs model
pre- and post-sets Bullets are tokens
uo=a1a2
t1:a12a3
t2:a2 2a3
t3:2a3a4
2
Algebraic Theories for Contextual Pre-
Nets 11
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 12
CTPh vs. ITPh: Graphically
2
a1
t1
a2
t2
a3
t3
a4
2
2
2
a1
t1
a2
t2
a3
t3
a4
2
2
Algebraic Theories for Contextual Pre-
Nets 13
CTPh vs. ITPh: Graphically
2
a1
t1
a2
t2
a3
t3
a4
2
2
2
a1
t1
a2
t2
a3
t3
a4
2
2e1 e2
Algebraic Theories for Contextual Pre-
Nets 14
CTPh vs. ITPh: Graphically
2
a1
t1
a2
t2
a3
t3
a4
2
2
2
a1
t1
a2
t2
a3
t3
a4
2
2e1 e2
e’3 e’’3
Algebraic Theories for Contextual Pre-
Nets 15
CTPh vs. ITPh: Graphically
2
a1
t1
a2
t2
a3
t3
a4
2
2
2
a1
t1
a2
t2
a3
t3
a4
2
2e1 e2
e’3 e’’3
Algebraic Theories for Contextual Pre-
Nets 16
Petri Nets are Monoids Proof terms denote CTPh computations:
commutative processes
uS
u:uNu[idle]
:uNv :u’Nv’
:uu’Nvv’[parallel composition]
commutative associativeunit :N
:uNv :vNw
;:uNw[sequential composition]monoid homomorphism
identities u:uNu
t:uvT
t:uNv[firing]
Algebraic Theories for Contextual Pre-
Nets 17
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 18
Pre-Nets are Monoids Proof terms denote ITPh computations:
concatenable processes
pS
p:pRp[idle]
t:pqT
t:pRq[firing]
:pRq :p’Rq’
:pp’Rqq’[parallel composition]
:pRq :qRr
;:pRr[sequential composition]
commutativeassociativeunit :R
monoid homomorphismidentities p:pRp
p,qS
p,q:pqRqp[symmetry]
Algebraic Theories for Contextual Pre-
Nets 19
Examplea1 a2
t1 t2
a3 a3 a3 a3
t3t3
p0=a1a2
(t1t2) ; (t3t3) =(t1;t3) (t2;t3)
Algebraic Theories for Contextual Pre-
Nets 20
Examplea1 a2
t1 t2
a3 a3 a3 a3
t3t3
p0=a1a2
(t1t2) ; (a3a3,a3a3) ; (t3t3)
Algebraic Theories for Contextual Pre-
Nets 21
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 22
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!
readL readR
aL aR
b
cL cR
u0=aLbaR
(aLreadR) ; (readLcR) (readLaR) ; (cLreadR)
we need syntax to writereadL(?)readR
Algebraic Theories for Contextual Pre-
Nets 23
Molecules, Atoms, Electrons
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)-
token a context [a]
Algebraic Theories for Contextual Pre-
Nets 24
Example
readL readR
aL aR
b-
cL cR
u0=aLbaR
readL b2 readR =(readLb+aR) ; (cLb+readR) =(aLb+readR) ; (readLb+cR)
b+
Drawback:Tokens are not atomic entities
Algebraic Theories for Contextual Pre-
Nets 25
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
p:pp Rp[match]
pS
p:pRpp[share]
commutativityassociativity
monoidality {
MAIN AXIOMS {
Algebraic Theories for Contextual Pre-
Nets 26
Match-Share Graphically
a
a a a
aa a
a
a ba,b
b a
a aa,a
a a
a
a
=a a
a
a
Algebraic Theories for Contextual Pre-
Nets 27
Match-Share Graphically
a
a a a
aa a
a
a ba,b
b a
a a
a
a
=
a aa
a
a a
a
a
a aa
a
Algebraic Theories for Contextual Pre-
Nets 28
Match-Share Graphically
a
a a a
aa a
a
a ba,b
b a
a a
a
a
=a
a
a a
Algebraic Theories for Contextual Pre-
Nets 29
Match-Share Graphically
a
a a a
aa a
a
a ba,b
b a
a
a
=
a aa
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 30
Transitions as Arrows
aL
readL
b
cL b
b
b
aR
readR
b
cRb
b
b
Algebraic Theories for Contextual Pre-
Nets 31
ExampleaL
readL
b
cL b aR
readR
cRb
aR
cL
Algebraic Theories for Contextual Pre-
Nets 32
ExampleaL
readL
b
cL b aR
readR
cRb
aR
cL
Algebraic Theories for Contextual Pre-
Nets 33
ExampleaL
readL
b
cL aR
readR
cRb
aR
cL
Algebraic Theories for Contextual Pre-
Nets 34
ExampleaL
readL
b
cL aR
readR
cRb
aR
cL
Algebraic Theories for Contextual Pre-
Nets 35
ExampleaL
readL
b
cL aR
readR
cRb
aR
cL
Algebraic Theories for Contextual Pre-
Nets 36
ExampleaL
readL
b
readR
cRb
aR
cL
Algebraic Theories for Contextual Pre-
Nets 37
ExampleaL
readL
b
readR
cRb
aR
cL
Algebraic Theories for Contextual Pre-
Nets 38
ExampleaL
readL
b
readR
cRb
aR
cL
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?
Algebraic Theories for Contextual Pre-
Nets 39
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 40
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 41
MON
fth MON is sort Monoid . op e : Monoid . op __ : Monoid Monoid -> Monoid [assoc id:e] .endfth
Algebraic Theories for Contextual Pre-
Nets 42
CATfth 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 43
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 44
MSCATfth 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 45
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 46
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 47
RCOMP (Read-Computation)
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
self-loop version
relation between t and its self-loop version
markings idle+transitions
E(MS(R)) MS(R)
Rarrow is symmetric monoidal
Algebraic Theories for Contextual Pre-
Nets 48
t and mk(t)
a
t
b
c b
b
b
b
bb
b
Algebraic Theories for Contextual Pre-
Nets 49
t and mk(t)
a
mk(t)
b
c b
b
b
b
b
b
bb
b
Algebraic Theories for Contextual Pre-
Nets 50
t and mk(t)
a
mk(t)
b
c b
b
b
b
b
b
bb
b
Algebraic Theories for Contextual Pre-
Nets 51
t and mk(t)
a
mk(t)
b
c b
b
b
b
bb
b
Algebraic Theories for Contextual Pre-
Nets 52
t and mk(t)
a
t
c
b
b
Algebraic Theories for Contextual Pre-
Nets 53
RV (Theory Morphism)
view RV from RAUT to RCOMP is sort Monoid to Object .endview
The view RV induces a forgetful functor URV from the category of RCOMP-algebras (computational models) to the category of RAUT-algebras (contextual pre-nets)with a left-adjoint FRV
Algebraic Theories for Contextual Pre-
Nets 54
Results
FRV(R) is a match-share category isomorphic to MS(R) via a match-share functor
FRV(R)|Rarrow is a symmetric monoidal category isomorphic to E(S(R)) via a symmetric monoidal functor
A computation is meaningful iff RCOMP |- : Rarrow
Algebraic Theories for Contextual Pre-
Nets 55
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 56
Conclusions Typing discipline via membership
predicates Functorial and universal construction
contextual pre-nets seen as implementations of contextual nets
proof via PMEqtl techniques Results exploited in WADT 2002 [BBM02]
to functorially reconcile all net semantics Maude can be used as proof engine
Algebraic Theories for Contextual Pre-
Nets 57
The End
Algebraic Theories for Contextual Pre-Nets
a paper by Roberto Bruni
José Meseguer
Ugo Montanari
Vladimiro Sassone
ICTCS 2003 presentation by Roberto Bruni
Research supported by FET-GC Project IST-2001-32747 AGILEMIUR Project COFIN 2001013518 COMETAItalia CNR Fellowship and CS Department at UIUC (first author)
Front cover: electronic watercolor by Roberto Bruni