39
A Calculus of Petri Net Components Semantics for Petri nets with hierarchy N.Sidorova, M. Voorhoeve, J.v.d.Woude (TUE)

A Calculus of Petri Net Components Semantics for Petri nets with hierarchy N.Sidorova, M. Voorhoeve, J.v.d.Woude (TUE)

  • View
    221

  • Download
    1

Embed Size (px)

Citation preview

Page 1: A Calculus of Petri Net Components Semantics for Petri nets with hierarchy N.Sidorova, M. Voorhoeve, J.v.d.Woude (TUE)

A Calculus of Petri Net Components

Semantics for Petri nets with hierarchy

N.Sidorova, M. Voorhoeve, J.v.d.Woude (TUE)

Page 2: A Calculus of Petri Net Components Semantics for Petri nets with hierarchy N.Sidorova, M. Voorhoeve, J.v.d.Woude (TUE)

Dedication

Gordon PlotkinA Structural Approach to Operational Semantics

Aarhus Univ Tech Report DAIMI FN-19

plm. 650 citations (citeseer.nj.nec.com)

tech. report world record?

Page 3: A Calculus of Petri Net Components Semantics for Petri nets with hierarchy N.Sidorova, M. Voorhoeve, J.v.d.Woude (TUE)

Contents

• Introductionnets with hierarchy

• Challengefrom hierarchy to components

• Solutionstates as events, nets as terms,bisimilarity, Structured Operational Semantics

• Example

• Conclusions

Page 4: A Calculus of Petri Net Components Semantics for Petri nets with hierarchy N.Sidorova, M. Voorhoeve, J.v.d.Woude (TUE)

Introduction

• Research motivated by CPN and ExSpect: Petri Nets with hierarchy.

• Correctness (e.g. verification) issues handicapped by semantics problems.

• What is a hierarchical net?.

Page 5: A Calculus of Petri Net Components Semantics for Petri nets with hierarchy N.Sidorova, M. Voorhoeve, J.v.d.Woude (TUE)

Hierarchical Petri netsHierarchical Petri nets

transition place subnet

fire

enabled

unfold

produce

token

Page 6: A Calculus of Petri Net Components Semantics for Petri nets with hierarchy N.Sidorova, M. Voorhoeve, J.v.d.Woude (TUE)

Hierarchical Petri netsHierarchical Petri nets

disabled

unfold

Page 7: A Calculus of Petri Net Components Semantics for Petri nets with hierarchy N.Sidorova, M. Voorhoeve, J.v.d.Woude (TUE)

Hierarchical Petri netsHierarchical Petri nets

enabled disabled

fire

consume

consume

produce

Page 8: A Calculus of Petri Net Components Semantics for Petri nets with hierarchy N.Sidorova, M. Voorhoeve, J.v.d.Woude (TUE)

fire

Hierarchical Petri netsHierarchical Petri nets

consume

produce

produce

Page 9: A Calculus of Petri Net Components Semantics for Petri nets with hierarchy N.Sidorova, M. Voorhoeve, J.v.d.Woude (TUE)

Hierarchical Petri netsHierarchical Petri nets

fire

enabled

enabled

Page 10: A Calculus of Petri Net Components Semantics for Petri nets with hierarchy N.Sidorova, M. Voorhoeve, J.v.d.Woude (TUE)

Challenge

• From hierarchy to components• Interface (external) vs. realization (internal)• Compositional semantics• Equivalence of hierarchical nets and their

unfoldings• Respecting state/event duality of nets

Page 11: A Calculus of Petri Net Components Semantics for Petri nets with hierarchy N.Sidorova, M. Voorhoeve, J.v.d.Woude (TUE)

1-server queue component

enter

external free

busy

leave

start finish

internal

environment of a componentcannot access internal parts

Page 12: A Calculus of Petri Net Components Semantics for Petri nets with hierarchy N.Sidorova, M. Voorhoeve, J.v.d.Woude (TUE)

Compositionality

• Semantics of component determines its behavior in any context

• Semantics maps component to mathematical object

• Semantics defined only on interface

Page 13: A Calculus of Petri Net Components Semantics for Petri nets with hierarchy N.Sidorova, M. Voorhoeve, J.v.d.Woude (TUE)

Example

subnets with context

C.N

C.M

Different components

N

M

Xsemanticssame math. object

semantics

different objects

Y

Z

Page 14: A Calculus of Petri Net Components Semantics for Petri nets with hierarchy N.Sidorova, M. Voorhoeve, J.v.d.Woude (TUE)

Process Algebra

• Components are terms

• Terms define transition systems by SOS (structured operational semantics) production rules

• Bisimilarity equivalence allows rewriting of terms (calculus)

Page 15: A Calculus of Petri Net Components Semantics for Petri nets with hierarchy N.Sidorova, M. Voorhoeve, J.v.d.Woude (TUE)

Transition systems (TS)

Directed graphNodes (states)

Labeled arcs (events)

a bc

c d

e

d

f

Page 16: A Calculus of Petri Net Components Semantics for Petri nets with hierarchy N.Sidorova, M. Voorhoeve, J.v.d.Woude (TUE)

SOS production rules

terms TS a.b+c

a

b

b

c

X X’

X+Y X’aX X’

premise

conclusion

Page 17: A Calculus of Petri Net Components Semantics for Petri nets with hierarchy N.Sidorova, M. Voorhoeve, J.v.d.Woude (TUE)

Bisimilarity

a a

b b b b

c cd

d

a

b b

c

d

relationbetweenstateswith

samefuture

behavior

Page 18: A Calculus of Petri Net Components Semantics for Petri nets with hierarchy N.Sidorova, M. Voorhoeve, J.v.d.Woude (TUE)

Component semantics:Equivalence classes of TS modulo bisimilarity

Temporal predicates, e.g.:S |- A B State S satisfies A and not B

S |- aC In S an a-step can occurto a state satisfying C

S |- a:a T S is a deadlock state

Bisimilar states = satisfying same predicates

Page 19: A Calculus of Petri Net Components Semantics for Petri nets with hierarchy N.Sidorova, M. Voorhoeve, J.v.d.Woude (TUE)

Calculus of terms

x+y = y+x

(x+y)+z = x+(y+z)

x+x = x

proven by constructing bisimulations

Page 20: A Calculus of Petri Net Components Semantics for Petri nets with hierarchy N.Sidorova, M. Voorhoeve, J.v.d.Woude (TUE)

Roadmap net components

• Net component is term describing its subcomponents and the way they’re connected

• Graphical representation (colored) net

• Rewrite rules, e.g. unfolding or consistent relabeling of subcomponent

Page 21: A Calculus of Petri Net Components Semantics for Petri nets with hierarchy N.Sidorova, M. Voorhoeve, J.v.d.Woude (TUE)

Net Component Semantics

3 event types:- external consumption- firing- external productionexternal prod/cons added to cons/prod due to firing!

X c, f, p

X'

In X, consuming c, firing f and producing p results in X'

addition of events:simultaneous occurrence

X X0, 0, 0

empty event always possible

Page 22: A Calculus of Petri Net Components Semantics for Petri nets with hierarchy N.Sidorova, M. Voorhoeve, J.v.d.Woude (TUE)

busyenter

free

leave

start finish

X X 0, s, 0

Y

Y0, f, 0

Z

Z l, 0, e

X

Z l, s, e

Y

busyenter

free

leave

start finish

Y

busyenter

free

leave

start finish

ZX Z

Z e, s, 0

?

not:

0, s+f, 0

Page 23: A Calculus of Petri Net Components Semantics for Petri nets with hierarchy N.Sidorova, M. Voorhoeve, J.v.d.Woude (TUE)

enter leave

start finish

X

X |- 2e,0,0 (0,s,0 T):In X , removal of twoe-tokens will cause a state where s cannot fire.

At the same time, a token can be removed from e and s can fire in X.

X |- e,s,0 T

X |- 0,s,0 (l,0,0 T):After firing s in X , nol-token is available.

In X, s then f can fire, after which both e and l contain at least 1 token.

X |- 0,s,0 (0,f,0 (e+l,0,0 T))

Component predicates

Page 24: A Calculus of Petri Net Components Semantics for Petri nets with hierarchy N.Sidorova, M. Voorhoeve, J.v.d.Woude (TUE)

Formal DefinitionComponent: Algebraic term

built from constants & operators

Term X defines TS: SOS rulesStructured Operational Semantics

X X'c, f, p

c,p: bag(B); f: bag(A)

A: actions, B: place labels

Page 25: A Calculus of Petri Net Components Semantics for Petri nets with hierarchy N.Sidorova, M. Voorhoeve, J.v.d.Woude (TUE)

SOS rules (constants/merge)

Transition Ta

a in A

Ta 0, k.a, 0

Ta

k in Nat

Marked place Pb,k

b in B, k in Nat

Pb,k l.b, 0, m.b

Pb,m+k-l

l k, m in Nat

merge:X

c+d, f+g, p+q

X', Y d, g, q

Y'

X ||Y X' ||Y'

c, f, p

Page 26: A Calculus of Petri Net Components Semantics for Petri nets with hierarchy N.Sidorova, M. Voorhoeve, J.v.d.Woude (TUE)

SOS rules (connect)Consumption t

t in A bag.Bt in bag.A bag.Bt.0 = 0, t.[a] = [t.a],

t(x+y)=t.x+t.y

t (X)

X t.f+c, f, p

X '

t (X')c, f, p

Production s

s in A bag.Bs in bag.A bag.B

s (X)

X c, f, p+s.f

X '

s (X')c, f, p

firing + consumption/production = connected firing

Page 27: A Calculus of Petri Net Components Semantics for Petri nets with hierarchy N.Sidorova, M. Voorhoeve, J.v.d.Woude (TUE)

ExampleNet:

a p b

Term:X = s(t(Pa,1||Tp||Pb,0))

s = {(p,b)}, t = {(p,a)}

SOS derivation:

Pa,1a, 0, 0

Pa,0 , Tp0, p, 0

Tp , Pb,00, 0, b

Pb,1

Pa,1||Tp||Pb,0a, p, b Pa,0||Tp||Pb,1

t(Pa,1||Tp||Pb,0) 0, p, b t(Pa,1||Tp||Pb,0)

s(t(Pa,1||Tp||Pb,0)) 0, p, 0 s(t(Pa,0||Tp||Pb,1))

Page 28: A Calculus of Petri Net Components Semantics for Petri nets with hierarchy N.Sidorova, M. Voorhoeve, J.v.d.Woude (TUE)

Hiding

a p b

C

a

p

b

D

Hidden actions invisible Hidden places inaccessible

C |- 0,0,0 (b,0,0 T)

C |- a,0,3b T

C b,0,0 T D |- 0,p,0 T

D 0,0,2a T

Page 29: A Calculus of Petri Net Components Semantics for Petri nets with hierarchy N.Sidorova, M. Voorhoeve, J.v.d.Woude (TUE)

SOS rules (hiding)

L (X)

X c, f, p

X '

L (X ')c, fL, p

L A, hidden actions

M (X)

X c, f, p X ' , cM=c, pM=p

M (X')c, f, p

Similar for hiddenplace labels M

If xbag(A), then xL defined by0L = 0, [a]L = 0 if aA

[a]L = [a] if aA(x+y)L = xL + yL

Page 30: A Calculus of Petri Net Components Semantics for Petri nets with hierarchy N.Sidorova, M. Voorhoeve, J.v.d.Woude (TUE)

Component structure

Net:Internal/externalplaces/transitionswith connections

p

a

b

q

Term:hiding (partially)of connected mergeof places/transitions

Z = Tp || Tq || Pa,1 || Pb,1

X = {(a,q),(b,p)}(Y)Y = {(q,b),(p,a)}(Z)

N = q(b(X))

Page 31: A Calculus of Petri Net Components Semantics for Petri nets with hierarchy N.Sidorova, M. Voorhoeve, J.v.d.Woude (TUE)

Problem Solution

• Net component:representable as both graph and term

• TS of term defined by SOS rules

• Compositionality realized by bisimulation equivalence

• Both state-based and event-based approaches are supported

Page 32: A Calculus of Petri Net Components Semantics for Petri nets with hierarchy N.Sidorova, M. Voorhoeve, J.v.d.Woude (TUE)

Extensions

Relabeling with loss of informationFusion/liberation of external place labelsMore actions per transitionSynchronization/encapsulation of external actionsRewrite rules flat net normal form

Colored nets: tokens and actions with valuesStandard language for functions and relationsASCII format of operators

Page 33: A Calculus of Petri Net Components Semantics for Petri nets with hierarchy N.Sidorova, M. Voorhoeve, J.v.d.Woude (TUE)

Example

Purch: Purchase of supplies

The inventory interface signals a shortage (place needed).A database query (action sqry) reveals the supplier of theneeded item, which is ordered (action order).After some time, the order is delivered (action delivery)and the information is transferred (via place rdy) forpayment to the Finance deptThe orders waiting for delivery are kept in an internalplace wo.

Page 34: A Calculus of Petri Net Components Semantics for Petri nets with hierarchy N.Sidorova, M. Voorhoeve, J.v.d.Woude (TUE)

needed[i:It,n:Nat]

wo:[s:Sup,i:It,n:Nat]

rdy[s:Sup,i:It,n:Nat]

order[s:Sup,i:It,n:Nat]

delivery[s:Sup,i:It,n:Nat]

sqry[s:Sup,i:It]

Net Model

Purch

Page 35: A Calculus of Petri Net Components Semantics for Petri nets with hierarchy N.Sidorova, M. Voorhoeve, J.v.d.Woude (TUE)

Tentative script

Purch :=extern place needed[i:It,n:Nat],

rdy[s:Sup,i:It,n:Nat] action sqry[s:Sup,i:It],

order[s:Sup,i:It,n:Nat], delivery[s:Sup,i:It,n:Nat]

intern place wo[s:Sup,i:It,n:Nat]with sync order(s,i,n) and sqry(s,i) consume order(s,i,n) from needed(i,n) produce order(s,i,n) to wo(s,i,n) consume delivery(s,i,n) from wo(s,i,n) produce delivery(s,i,n) to rdy(s,i,n)

Page 36: A Calculus of Petri Net Components Semantics for Petri nets with hierarchy N.Sidorova, M. Voorhoeve, J.v.d.Woude (TUE)

Component connections

neededrdy

ord

delivery

sqry Purch

need sqry

Inv

recv

topay

DB

Fin

pay

topay : place label

delivery: action

: action synchronization: production/consumption: place fusion

ProdFact

order

Page 37: A Calculus of Petri Net Components Semantics for Petri nets with hierarchy N.Sidorova, M. Voorhoeve, J.v.d.Woude (TUE)

Script

ProdFact :=extern action ord[s:Sup,i:It,n:Nat] = Purch.order,

recv[s:Sup,i:It,n:Nat] = Inv.recv, pay[s:Sup,m:Money] = Fin.pay

intern Purch (needed, rdy, sqry, order, delivery), DB (sqry, ... ), Inv (recv, need , ... ), Fin (topay, pay, ...)with sync recv(s,i,n) and Purch.delivery(s,i,n) sync Purch.sqry(s,i) and DB.sqry(s,i) produce Inv.need(i,n) to Purch.needed(i,n) fuse Purch.rdy(s,i,n) to Fin.topay(s,i,n)

Page 38: A Calculus of Petri Net Components Semantics for Petri nets with hierarchy N.Sidorova, M. Voorhoeve, J.v.d.Woude (TUE)

Conclusions

• Semantics for net components• Temporal predicates for requirements• Verification possible• Good practice rules (pragmatics) can be

added• Foundation of component-based

modeling

Page 39: A Calculus of Petri Net Components Semantics for Petri nets with hierarchy N.Sidorova, M. Voorhoeve, J.v.d.Woude (TUE)

Research issues

• Stronger semantics e.g. allowing transition refinement

• Language and toolsspecification, modeling, verification

• Relation to CPN/ExSpect

• Teaching

• ....