Structural Analysis and Petri Net Subclasses prof.dr.ir. Wil van der Aalst www.vdaalst.com
Structural Analysis and
Petri Net Subclasses
prof.dr.ir. Wil van der Aalst www.vdaalst.com
Reachability analysis
• Can be used to prove correctness of a system
• Suffers from state explosion problem
PAGE 1
1
t1
32 4
t2
5
t6
8
t3
6
t7
9
t5
7
t8
10
t9
11
t10
[1]
[2,3,4]
[5,3,4] [2,6,4] [2,3,7]
[8,3,4] [5,6,4] [2,9,4] [5,3,7] [2,6,7] [2,3,10]
[8,9,4] [8,6,7] [5,9,7] [8,3,10] [5,6,10] [2,9,10]
[8,6,4] [8,3,7] [5,9,4] [5,6,7] [2,9,7] [5,3,10] [2,6,10]
[8,9,7] [8,6,10] [5,9,10]
[8,9,10]
[11]
Example
PAGE 2
State Space (8)
Nodes: 14.158
Arcs: 81.848
State Space (5)
Nodes: 392
Arcs: 1415
State Space (9)
Nodes: 46.763
Arcs: 304.137
infinite or lossy
Can we (partially) overcome this problem? (1)
• Exploit the network structure of a Petri net for analysis
• Network structure typically much smaller than the
number of reachable markings
Structural analysis:
• Exploit that effect of firing a transition can be represented
as a vector
• Place and transition invariants
• Hold for any initial marking
• Calculated using linear algebraic techniques
• But: only for few properties applicable
PAGE 3
Can we (partially) overcome this problem? (2)
• Exploit the network structure of a Petri net for analysis
• Network structure typically much smaller than the
number of reachable markings
Simplify verification problem:
• Reducing the network structure before analysis
(reduction rules)
• Use structurally simpler models or restrict problem space
(Petri net subclasses)
PAGE 4
Outline
• Structural analysis
• Place and transition invariants
• The incidence matrix
• Calculating invariants
• Petri net reduction rules
• Subclasses of Petri nets
PAGE 5
Place invariants
• Property: marrying and divorcing cannot change
the number of persons involved (here 7)
• Need concepts of weight and weighted token
sum
PAGE 6
marriage
couple
divorce
man
woman
unmarried man
married couple
unmarried woman
Weight and weighted token sum
• A weight z of a place p is an integer value
assigned to p
• The product z m(p) gives the weight of all
tokens in p at marking m
• Let P = {p1, …, pk}. Then,
z1 m(p1) + … + zk m(pk) = z0 with z0 is the
weighted token sum of marking m
PAGE 7
Place invariant (formally)
A place invariant assigns to each place p P of a
Petri net (P, T, F), a weight z such that the
weighted token sum remains constant in every
reachable marking. A place invariant can be
written as z1 m(p1) + … + zk m(pk) = z0 .
• Weighted token sum should be constant for any
initial marking
• Thus, value of z0 is optional
• 0 m(p1) + … + 0 m(pk) is a trivial place invariant
PAGE 8
Place invariants by example (1)
PAGE 9
marriage
couple
divorce
man
woman
(1 ) man + (1 ) woman + 2 couple
(1 ) 2 + (1 ) 3 + 2 1 = 7 // Intuition: total number of persons
invariant because firing of any transition does not change z0
man + couple = 3 // Intuition: total number of men
woman + couple = 4 // Intuition: total number of women
woman - man = 1 // Intuition: difference between women and men
Check:
Invariants hold for
any initial marking
Place invariants by example (2)
PAGE 10
• r1 + g1 + o1 = 1
traffic light always in one of the three states
• r2 + g2 + o2 = 1
traffic light always in one of the three states
• x + g1 + o1 + g2 + o2 = 1
at most one traffic light is in green or orange r1
rg1
g1
go1
o1
or1
r2
rg2
g2
go2
o2
or2
x
Adding two invariants yields an invariant!
r1 + g1 + o1 + r2 + g2 + o2 = 2
Subtracting two invariants yields
an invariant!
Inv4 – Inv3: r1 + r2 - x = 1
Because x ≥ 0: r1 + r2 ≥ 1; that is,
at least one traffic light is red
Exercise
• Verify whether the following equations are place
invariants and, if so, interpret them:
1. free + busy + docu = 1
2. wait + inside + done = 4
3. free + 2 busy + docu = 1
4. free + 2 busy + docu + wait + done = 5
5. busy - inside = 0
PAGE 11
wait
start
busy
change
done
free end docu
inside
Transition invariants
• Intuition: Petri net returns to a marking after a series of
transition firings
• Corresponds to a cycle in the reachability graph
• Property: Firing both transitions in any order results in
the initial marking again
PAGE 12
marriage
couple
divorce
man
woman
unmarried man
married couple
unmarried woman
Transition invariant (formally)
A transition invariant of a Petri net (P, T, F),
assigns to each transition a nonnegative weight
z such that firing each transition z times does not
change the marking.
Let T = {t1, …, tn}. Then, a transition invariant is
defined as z1 t1 + … + zn tn .
• 0 t1 + … + 0 tn is a trivial transition invariant
• Gives no ordering in which transitions fire
• Possible that transitions cannot fire at all
PAGE 13
Transition invariants by example (1)
PAGE 14
marriage
couple
divorce
man
woman
marriage + divorce
0 marriage + 0 divorce
2 marriage + 2 divorce
17 marriage + 17 divorce
…
Product of an invariant with
a scalar is an invariant again!
Transition invariants by example (2)
PAGE 15
• rg1 + go1 + or1
Cycle of the traffic light
• rg2 + go2 + or2
Cycle of each traffic light
• rg1 + go1 + or1 + rg2 + go2 + or2
Cycle of both traffic lights
r1
rg1
g1
go1
o1
or1
r2
rg2
g2
go2
o2
or2
x
Adding two invariants yields an invariant!
Observe: invariant does not state
in which order transitions should fire
Outline
• Structural analysis
• Place and transition invariants
• The incidence matrix
• Calculating invariants
• Petri net reduction rules
• Subclasses of Petri nets
PAGE 16
Representing markings as vectors
• Can describe behavior of a Petri net with linear
algebraic equations
• Represent a marking and the effect of firing a
transition as a column vector
• Formally, m m iff m = m + t
PAGE 17
1
2
2
t
marriage
couple
divorce
man
woman
2
1
3
-1
1
-1
m = m0 + t
= + man
couple
woman
marriage
couple
divorce
man
woman
Represent a marking as a column vector
Let (P, T, F) be a Petri net with place set
P = {p1, …, pk}. We can represent a marking m as
the column vector
PAGE 18
m = with m(pi) = ui, 1 i k .
u1
…
uk
or m = [u1, …, uk]T transpose matrix
Represent the effect of a transition as a
column vector
Let (P, T, F) be a Petri net with place set
P = {p1, …, pk}. We can represent the effect of
transition t T as the column vector
PAGE 19
t = with vi = w((t, pi)) - w((pi, t)), 1 i k .
v1
…
vk
or t = [v1, …, vk]T transpose matrix
The incidence matrix
Let (P, T, F) be a Petri net with place set
P = {p1, …, pk} and transition set T = {t1, …, tn}. We
define the incidence matrix C as
PAGE 20
C = (t1 … tn) = v11 … vn1
… …
v1k … vnk
v11 … vn1
… …
v1k … vnk
places (1..k)
transitions (1..n)
Example
PAGE 21
C = (marriage divorce) = -1 1
1 -1
-1 1
marriage
couple
divorce
man
woman
Exercise
PAGE 22
111000
100110
011001
000111
100001
Give the incidence matrix!
p2
p4
t2 t3 p3
p5
t4 t5
t1
t6
p1
p1
p2
p3
p4
p5
t1 t2 t3 t4 t5 t6
The state equation of a Petri net
PAGE 23
m = m0 + C x
Parikh vector: a column vector specifying,
for each transition t, how often we
need to add t to m0
Sufficient criterion for nonreachability of a marking m :
If C x = m - m0 does not have any integer solution
for x, then m is not reachable from m0.
Reverse does not hold!
Example
PAGE 24
marriage
couple
divorce
man
woman
m = m0 + C = (marriage divorce) x
-1 1
1 -1
-1 1
2
1 2
1
3
1
2
2 + =
Fire marriage twice and divorce once
Example
PAGE 25
marriage
couple
divorce
man
woman
m = m0 + C = (marriage divorce) x
-1*2 + 1*1
1*2 + -1*1
-1*2 + 1*1
2
1
3
1
2
2 + =
Fire marriage twice and divorce once
-1
1
-1
2
1
3 + =
Exercise
• Show that the unreachable marking m = [p2,p3]
has an integer solution for x in C x = m - m0
thereby showing that the state equation cannot
be used to prove reachability.
PAGE 26
t1 t3p2
t5
p4
t2 t4p3 p5
p1
Outline
• Structural analysis
• Place and transition invariants
• The incidence matrix
• Calculating invariants
• Petri net reduction rules
• Subclasses of Petri nets
PAGE 27
Two ways of calculating invariants
• "Intuitive way": Formulate the property that you
think holds and verify it.
• "Linear-algebraic way": Solve a system of linear
equations.
Humans tend to do it the intuitive way and
computers do it the linear-algebraic way.
PAGE 28
Insufficient background knowledge in linear algebra ???
See http://en.wikipedia.org/wiki/Matrix_multiplication !!!
The linear-algebraic way
Place invariant:
• (z1 … zk) C = 0
• z0 = (z1 … zk) m0
Transition invariant:
• C x = 0 with x = (z1 … zn)T
PAGE 29
Invariants
• Trivial invariant: zi = 0, for all weights
• Adding and subtracting two invariants yields a new
invariant
• Linear combination of an invariant is an invariant
interested in minimal invariants
• |P| rank(C) minimal place invariants
• |T| rank(CT) minimal transition invariants
• Most interesting: minimal semipositive invariants (i.e.,
weight greater than or equal to 0)
PAGE 30
Example: Place invariants
Solutions for X:
• (0,0,0)
• (1,0,1)
• (0,1,1)
• (1,1,2)
• (1,-1,0)
)0,0(
11
11
11
),,(
couplewomanman
man (-1) + woman (-1) + couple 1 = 0 and
man 1 + woman 1 + couple (-1) = 0
marriage
couple
divorce
man
woman
PAGE 31
Example: transition invariants
Solutions:
• (0,0)T
• (1,1)T
• (32,32)T
0
0
0
11
11
11
divorce
marriage
-1 marriage + 1 divorce = 0
-1 marriage + 1 divorce = 0, and
1 marriage + (-1) divorce = 0
marriage
couple
divorce
man
woman
PAGE 32
PAGE 33
Example: Place invariants
)0,0,0,0,0,0(
111000
100110
011001
000111
100001
)5,4,3,2,1(
ppppp
• Solutions:
• (1,1,0,1,0) (i.e., p1+p2+p4)
• (1,0,1,0,1) (i.e., p1+p3+p5)
• (2,1,1,1,1) (i.e., 2p1+p2+p3+p4+p5)
• (6,5,1,5,1)
• ....
p2
p4
t2 t3 p3
p5
t4 t5
t1
t6
p1
Example: Transition invariants
0
0
0
0
0
6
5
4
3
2
1
111000
100110
011001
000111
100001
t
t
t
t
t
t
• Solutions:
• (1,0,1,0,1,1)T (i.e., t1+t3+t5+t6)
• (0,1,1,0,0,0)T (i.e., t2+t3)
• (0,0,0,1,1,0)T (i.e., t4+t5)
• (1,1,2,1,2,1)T (i.e., t1+t2+2 t3+t4+2 t5+t6)
• ....
p2
p4
t2 t3 p3
p5
t4 t5
t1
t6
p1
PAGE 34
Properties
• If a marking m is reachable from the initial marking m0
and i is a place invariant of the net, then i holds in m –
that is, i m = i m0.
• Every place p is bounded if there exists a semipositive
place invariant i that assigns a positive weight to p.
• There exists a place invariant i that assigns a positive
weight to all places iff the net is bounded for any initial
marking.
• If the net is live and bounded, then it has a positive
transition invariant that covers each transition.
PAGE 35
Outline
• Structural analysis
• Place and transition invariants
• The incidence matrix
• Calculating invariants
• Petri net reduction rules
• Subclasses of Petri nets
PAGE 36
Reduction rules
t2
p1
t1
p2
p3
p4
t4t3 p2 t34
PAGE 37
Goal of reduction rules
• Let (N, m0) and (N, m0) be the Petri net systems
before and after the reduction. Then (N, m0) is
live, safe, or bounded if and only if (N, m0) is live,
safe, or bounded, respectively.
PAGE 38
both are bounded and non-live
t2
p1
t1
p2
p3
p4
t4t3 p2 t34
Fusion of Series Places (FSP)
PAGE 39
Fusion of Series Transitions (FST)
PAGE 40
Fusion of Parallel Places (FPP)
PAGE 41
Fusion of Parallel Transitions (FPT)
PAGE 42
Elimination of Self-loop Places (ESP)
PAGE 43
Elimination of Self-loop Transitions (EST)
PAGE 44
Example
Fusion of Series
Transitions (FST)
t2
p1
t1
p2
p3
p4
t4t3
Fusion of Series
Places (FSP)
t12 p2 t34 p3
PAGE 45
Elimination of Self-loop
Places (ESP)
Elimination of Self-loop
Transitions (EST)
t12 p2 t34 p3 p2 t34
PAGE 46
non-live and safe,
so original net was
non-live and safe …
PAGE 47
Just the silent steps are reduced!
More information
• Supported by tools like ProM and Woflan.
• G. Berthelot: Checking properties of nets using transformation. Applications and Theory in Petri Nets 1985: 19-40
• G. Berthelot: Transformations and Decompositions of Nets. Advances in Petri Nets 1986: 359-376.
• T. Murata, Petri Nets: Properties, Analysis and Applications, Proceedings of the IEEE. 77(4): 541-580, 1989.
• J. Desel and J. Esparza. Free Choice Petri Nets, volume 40 of Cambridge Tracts in Theoretical Computer Science. Cambridge University Press, Cambridge, United Kingdom, 1995.
• M. T. Wynn, H. M. W. Verbeek, W. M. P. van der Aalst, A. H. M. ter Hofstede, D. Edmond: Soundness-preserving reduction rules for reset workflow nets. Inf. Sci. 179(6): 769-790 (2009)
• H. M. W. Verbeek, M. T. Wynn, W. M. P. van der Aalst, A. H. M. ter Hofstede: Reduction rules for reset/inhibitor nets. J. Comput. Syst. Sci. 76(2): 125-143 (2010)
PAGE 48
Outline
• Structural analysis
• Place and transition invariants
• The incidence matrix
• Calculating invariants
• Petri net reduction rules
• Subclasses of Petri nets
PAGE 49
Subclasses of Petri nets
PAGE 50
or
SMs MGs
FCs
EFCs ACs PNs
Expressiveness
Analyzability
State machines
A state machine is a net such that for all
transitions t T holds: |t| = 1 and |t| = 1.
PAGE 51
✗ ✗
Marked graph
A marked graph is a net such that for all places
p P holds: |p| = 1 and |p| = 1.
PAGE 52
✗ ✗
Free-choice net
A free-choice net is a net such that
for all places p P holds: |p| 1 or (p) = {p}
equivalently
for all places p1, p2 P holds:
p1 p2
implies |p1| = |p2
| = 1
PAGE 53
✗ ✗ ✗
Extended free-choice net
An extended free-choice net is a net such that
for all places p1, p2 P holds:
p1 p2
implies p1 = p2
PAGE 54
✗ ✗
Asymmetric choice net
An asymmetric choice net is a net such that
for all places p1, p2 P holds:
p1 p2
implies p1 p2
or p1 p2
PAGE 55
✗
Remember
PAGE 56
Live and
Deadlock
Free (L,DF)
Live and not
Deadlock
Free (L,NDF)
Not Live and
Deadlock
Free (NL,DF)
Not Live and
Not Deadlock
Free (NL,NDF)
Bounded and
Reversible (B,R)
Bounded and Not
Reversible
(B,NR)
Not Bounded and
Reversible
(NB,R)
Not Bounded and
Not Reversible
(NB,NR)
Which Class (SM, MG, FC, EFC, AC)?
PAGE 57
Live and
Deadlock
Free (L,DF)
Live and not
Deadlock
Free (L,NDF)
Not Live and
Deadlock
Free (NL,DF)
Not Live and
Not Deadlock
Free (NL,NDF)
Bounded and
Reversible (B,R)
Bounded and Not
Reversible
(B,NR)
Not Bounded and
Reversible
(NB,R)
Not Bounded and
Not Reversible
(NB,NR)
? SM
MG
FC
EFC
AC
Which Class (SM, MG, FC, EFC, AC)?
PAGE 58
Live and
Deadlock
Free (L,DF)
Live and not
Deadlock
Free (L,NDF)
Not Live and
Deadlock
Free (NL,DF)
Not Live and
Not Deadlock
Free (NL,NDF)
Bounded and
Reversible (B,R)
Bounded and Not
Reversible
(B,NR)
Not Bounded and
Reversible
(NB,R)
Not Bounded and
Not Reversible
(NB,NR)
?
SM
MG
FC
EFC
AC
Which Class (SM, MG, FC, EFC, AC)?
PAGE 59
Live and
Deadlock
Free (L,DF)
Live and not
Deadlock
Free (L,NDF)
Not Live and
Deadlock
Free (NL,DF)
Not Live and
Not Deadlock
Free (NL,NDF)
Bounded and
Reversible (B,R)
Bounded and Not
Reversible
(B,NR)
Not Bounded and
Reversible
(NB,R)
Not Bounded and
Not Reversible
(NB,NR)
?
SM
MG
FC
EFC
AC
Which Class (SM, MG, FC, EFC, AC)?
PAGE 60
Live and
Deadlock
Free (L,DF)
Live and not
Deadlock
Free (L,NDF)
Not Live and
Deadlock
Free (NL,DF)
Not Live and
Not Deadlock
Free (NL,NDF)
Bounded and
Reversible (B,R)
Bounded and Not
Reversible
(B,NR)
Not Bounded and
Reversible
(NB,R)
Not Bounded and
Not Reversible
(NB,NR)
?
SM
MG
FC
EFC
AC
Which Class (SM, MG, FC, EFC, AC)?
PAGE 61
Live and
Deadlock
Free (L,DF)
Live and not
Deadlock
Free (L,NDF)
Not Live and
Deadlock
Free (NL,DF)
Not Live and
Not Deadlock
Free (NL,NDF)
Bounded and
Reversible (B,R)
Bounded and Not
Reversible
(B,NR)
Not Bounded and
Reversible
(NB,R)
Not Bounded and
Not Reversible
(NB,NR)
?
SM
MG
FC
EFC
AC
Which Class (SM, MG, FC, EFC, AC)?
PAGE 62
SM
MG
FC
EFC
AC An asymmetric choice net is a net such that
for all places p1, p2 P holds:
p1 p2
implies p1 p2
or p1 p2
ProM
PAGE 63
t2
p1
t1
p2
t3p3
PAGE 64
PAGE 65
PAGE 66
PAGE 67
PAGE 68
PAGE 69
PAGE 70
PAGE 71
PAGE 72
PAGE 73
PAGE 74
PAGE 75
Design-time analysis vs run-time analysis
(software)
system
(process)
modelevent
logs
models
analyzes
discovery
records
events, e.g.,
messages,
transactions,
etc.
specifies
configures
implements
analyzes
supports/
controls
extension
conformance
“world”
people services
organizations
components
business
processes
verification
performance
analysis
validation
design-time
analysisrun-time
analysis
e.g., systems like
WebSphere,
Oracle, TIBCO/
Staffware, SAP,
FLOWer, etc.
e.g., dedicated formats
such as IBM’s
Common Event
Infrastructure (CEI) and
MXML or proprietary
formats stored in flat
files or database
tables.
e.g. process models
represented in BPMN,
BPEL, EPCs, Petri nets,
UML AD, etc. or other
types of models such as
social networks,
organizational networks,
decision trees, etc.
PAGE 76
Exercise!
week date Type topic to prepare
17 22-4-2013 Lect. Introduction, transition systems, Petri nets (1)
Read Chapters 1-3 of book.
25-4-2013 Lect. Petri nets (2) Read Chapter 3 of book. 26-4-2013 Inst. Transition systems, Petri nets Make all exercises in Section 1 and
part of the exercises in Section 2.
18 29-4-2013 TU/e closed 2-5-2013 Lect. Modeling with Petri nets (3) Read Chapter 4 of book. 3-5-2013 Inst. Modeling with Petri nets Make all exercises in Section 2.
19 6-5-2013 Lect. Extending Petri nets with color and time (4)
Read Chapter 5 of book.
9-5-2013 TU/e closed 10-5-2013 TU/e closed
20 13-5-2013 Lect. Colored Petri Nets (5) Read Chapter 6 of book. 16-5-2013 Lect. Colored Petri Nets (6) Read Chapter 6 of book. 17-5-2013
(14.00-15.30) Exam Pre-exam focusing on classical Petri
nets (1 point) Study Chapters 1-4 and all exercises in Sections 1-2.
17-5-2013 (15.45-17.30)
Inst. Explanation “CPN assignment” (3 points)
Start making exercises in Section 3.
21 20-5-2013 TU/e closed 23-5-2013 Lect. Functions in CPN Tools (7) Read Chapter 6 of book. 24-5-2013 Inst. Modeling in terms of CPN Make all exercises in Section 3.
22 27-5-2013 Lect. Hierarchical Petri Nets (8) Read Chapter 7. 30-5-2013 No lecture 31-5-2013 Inst. CPN modeling continued Make all exercises in Section 4.
23 3-6-2013 Lect. Simulation (9) Read Chapter 8. 6-6-2013 Lect. Reachability Analysis and basic
properties (10) Read Chapter 8.
6-6-2013 (23.59)
Ass. Deadline Part I of “CPN assignment” Hand-in assignment in time (see detailed instructions).
7-6-2013 Inst. Conclusion of CPN modeling and Reachability Analysis + Explanation of Part I of the assignment.
Make all exercises in Section 5 and start with exercises in Section 6.
24 10-6-2013 Lect. Coverability and fairness (11) Read Chapter 8 and supplementary material.
13-6-2013 Lect. Structural Analysis and Petri Net Subclasses (12)
Read Chapter 8 and supplementary material.
14-6-2013 Inst. Reachability, coverability, and net properties.
Make all exercises in Section 6 and Section 7.
25 17-6-2013 Lect. Process mining: the Alpha-algorithm (13)
Read Chapter 8 and supplementary material.
20-6-2013 Lect. Closing and old exam (14). Study old BIS exams. 21-6-2013 Inst. Invariants and process mining Make all exercises in Section 8 and
Section 9. 23-6-2013
(23.59) Ass. Deadline Part II of “CPN assignment” Hand-in assignment in time (see
detailed instructions).
27 4-7-2013 Exam Final exam (6 points)
After this lecture you should be able to:
• Understand the importance and role of invariants.
• Provide meaningful place invariants for a given net.
• Provide meaningful transition invariants for a given net.
• Understand the matrix representation of nets and
invariants.
• Understand the idea of applying Petri net reduction rules.
• Determine for a given Petri net to which subclass it
belongs.
PAGE 77