Petri Net Theory and Its Applications Hsu-Chun Yen Dept. of Electrical Engineering National Taiwan University [email protected] http://www.ee.ntu.edu.tw/~yen Instructor Hsu-Chun Yen Educational background: Ph.d., 1986, Computer Science Dept. Univ. of Texas at Austin, USA Work Experiences: Professor: EE Dept. National Taiwan Univ. 1991 – present Assistant Prof.: CS Dept. Iowa State U. USA, 1986-1990 Research Interests: Automata Theory, Petri net theory, Algorithms Goals Introducing various models of restricted and extended Petri nets and their related problems Understanding the analytical techniques for reasoning about Petri net problems Analyzing the complexities of Petri net problems Investigating applications of Petri net theory in various CS related disciplines Modeling and Analysis System Model Revise Petri net model Analysis Properties of the system History Model introduced by C. A. Petri (U. Darmstadt, W. Germany) in 1962 – Ph.D. Thesis: “Communication with Automata” Applications: distributed computing, manufacturing, control, communication networks, transportation… PNs describe explicitly and graphically: – sequencing/causality – conflict/non-deterministic choice – concurrency For recent developments, see http://www.daimi.au.dk/PetriNets/ Applications Membrane computing Discrete event dynamic systems Communication protocols Performance evaluation Asynchronous circuit design/synthesis Database systems Concurrent and parallel programs Flexible manufacturing systems Dataflow-computing systems Fault-tolerant systems …etc, etc, etc Outline Definitions of Petri nets (equiv. Vector Addition Systems, VAS with states, …) Various PN problems Analytical techniques and complexity results Extended PNs Conclusions and open problems PART 1: Definitions and Notations of Petri Nets Petri Nets In addition to their popularity in modeling systems of concurrent nature (such as communication protocols, asynchronous circuits, and more), Petri nets (C. Petri, 1962) also pose many interesting and challenging mathematical questions! Petri Nets place P4 P1 t2 t1 toke n t3 t4 P3 transition P2 P5 Transition Firing P4 P1 t2 t1 t3 P3 P2 P5 t4 Transition Transition Firing Firing Goals P4 P1 t2 t1 t3 t4 P3 P2 P5 Interleaving semantics Formal definition A classical Petri net is a four-tuple (P,T,I,O) where: P is a finite set of places, T is a finite set of transitions, I : P x T N is the input function, and O : T x P N is the output function. : (P x T) (T x P) N An example P4 P1 I(p3,t3) = 3 t1 t2 3 t3 t4 O(t2, p3) = 2 I(t3,p5) = 1 … 2 P3 P2 P5 Marking The marking of a Petri net (P,T,I,O) is defined as follows: : P N, i.e., a function mapping the set of places onto {0,1,2, … }. Firing of an enabled transition A transition t is enabled at a marking iff (p) I(p, t), p P The firing of transition t results in marking ’ such that ’ (p)= (p) + O(t, p) - I(p, t) , p P Modeling FSMs transition state State machines: each transition has exactly one input and one output Allowing conflict, decision, choice, nondeterminism Modeling concurrency t2 t1 concurrency t4 t3 Marked graph: each place has exactly one incoming arc and one outgoing arc. Conventionally, interleaving semantics is assumed Modeling communication protocols Asynchronous communication ready to send ready to receive send msg. receive msg. wait for ack. proc.1 proc.2 msg. received receive ack. send ack. ack. received ack. sent Computation P4 P1 t1 t2 Initial marking (1,0,0,1,0) t3 t2 t4 (0,1,1,1,0) P3 P2 t3 t1 P5 Reachable markings (1,0,1,1,0) { t2 (0,1,2,1,0) (0,1,0,0,1) t3 t1 (1,0,0,0,1) Let a marking be represented as a vector (place 1, place 2, place 3, place 4, place 5) The initial marking for the above Petri net is: 0=(1,0,0,1,0) A path: t1 t2 t2 (1,0,0,1,0) (0,1,1,1,0) (1,0,1,1,0)(0,1,2,1,0) 0 1 2 3 The markings 0, 1, 2 , 3 …are said to be reachable. The set of reachable markings is known as the reachability set: R(0 , P). Reachability Tree Analysis Initial marking (1,0,0,1,0) Exhaustive search: only applicable to bounded Petri nets of small size t2 (0,1,1,1,0) t3 t1 (1,0,1,1,0) t2 (0,1,2,1,0) (0,1,0,0,1) t3 t1 (1,0,0,0,1) Vector Addition Systems addition vector P4 P1 + (-1,1,1,0,0) t1 t2 t3 t4 (1,0,0,1,0) Petri Nets + (1,-1,0,0,0) (1,0,1,1,0) P3 P2 (0,1,1,1,0) P5 base vector Vector Addition Systems ( v0; {a1, …, an} ) Equivalent Models (-1,1,1,0,0) (1,-1,0,0,0) Petri Nets (-2, -1,0,+3,0) Vector Addition Systems Vector Addition Systems with States Vector Replacement Systems Equivalence between n-dim VASS & (n+3)-dim VAS Theorem [HP’79] n-dim VASS (n+3)-dim VAS (Proof) Let q1, q2,…, qk be states of VASS (0, -ai, ak-i+1-bi, bk-i+1) Let ai=i and bi = (k+1)(k+1-i) -:j>i VASS in state (qi , u) VAS-- in (u, ai, bi:, j0)< i To simulate VASS trans. q i (qj, w) (u, ai , bi , 0) (u, 0, ak-i+1, bk-i+1 ) (u, bi, 0, ai ) --- (w, aj - bi, bj , - ai ) (u+w, aj, bj, 0) NOTE: ai < ai+1, bi > bi+1, ai < bj, bi - bi+1 =k+1 > aj Hence, (…) can be applied only at (… , bi, 0, ai ) because am - ai < 0 (m < i); bm + aj - bi aj – (k+1) < 0 (m > i) Petri Net Properties Behavioral marking 2 Structural marking properties: depending on the initial 2 properties: Bounded but not structurally bounded independent of the initial Structurally bounded Behavioral properties (1) Reachability – Marking n is reachable from initial marking 0 if existss a sequence of firings that transform 0 into n – reachability is decidable, but exponential-space hard Boundedness – a PN is bounded if the number of tokens in each place doesn’t exceed a finite number k for any marking reachable from 0 – a PN is safe if it is 1-bounded Behavioral properties (2) Liveness – a PN is live if, no matter what marking has been reached, it is possible to fire any transition with an appropriate firing sequence – equivalent to deadlock-free – different levels of liveness are defined Reversibility – a PN is reversible if, for each marking n reachable from 0, 0 is reachable from n – relaxed condition: a marking is a home state if, for each marking n reachable from 0, is reachable from n Behavioral properties (3) Coverability – a marking is coverable if exists n reachable from o s.t. n(p) (p) for all places p Persistence – a PN is persistent if, for every reachable marking and any two enabled transitions, the firing of one of them will not disable the other – then, once a transition is enabled, it remains enabled until it’s fired Behavioral properties (4) Synchronic distance – maximum difference of times two transitions are fired for any firing sequence d12 max (t1 ) (t2 ) – well defined metric for condition/event nets and marked graphs Number of occurrences of Fairness t1 in σ – bounded-fairness: the number of times one transition can fire while the other is not firing is bounded – unconditional(global)-fairness: every transition appears infinitely often in a firing sequence –… More on liveness A transition t in a Petri net (N, M0) is said to be: Dead (L0-live) if t can never be fired in any firing sequence in L(M0); L1-live (potentially firable) if t can be fired at least once in some firing sequence in L(M0); L2-live if, given any positive integer k, t can be fired at least k times in some firing sequence in L(M0); L3-live if t appears infinitely often in some firing sequence in L(M0); L4-live or live if t is L1-live for every marking M in R(M0); L4-liveness is the strongest => L3-liveness => L2-liveness => L1-liveness The Classical Problems The boundedness problem: EXPSPACE-c Is | R(0 , P)| < ? Lipton (Yale TR., 1976); Rackoff (TCS 1978) The containment (equivalence) Undecidable problem: Rabin (Baker, MIT TR. 1973) Hack (TCS 1976) Is R(0 , P) R(’0 , P’) ? (Is R(0 , P) = R(’0 , P’) ?) The reachability problem: Is R(0 , P)? Decidable Mayr (SICOMP, 1984) Petri Net Problems Boundedness Containment Liveness Model Checking Language equivalence Reachability Bisimulation equivalence Regularity ... Self-stabilization Fairness Controllability Reachability is key to many of the Petri net problems Complexity Hierarchy Recursive Boundary between decidability /undecidabil ity Primitive recursive EXPSPACE EXPTIME PSPACE p2 Languages expressible as x1 x2 … y1 y2 … P(x1,x2,…,y1,y2,…) p2 CoNP NP P The study of Petri net complexity/decidability Since the original work by C.A. Petri in 1962, an outburst of theoretical work on decidability/complexity of problem for Petri nets was done in the late seventies and early eighties. Researchers include some well-known computer scientists, like Rabin, Rackoff, Lipton, Mayr, Meyer, Kosaraju, …just to name a few. PART 2: Analytical Techniques Analysis techniques State Space Analysis techniques – Reachability graph – Coverability Tree –… – Normally for analyzing behavioral property Structural analysis techniques – Place & transition invariants – Incidence matrix –… – Normally for analyzing structural property Simulation … Reachability graph 3 1 (1,0,1,0,1) (0,1,1,0,0) 5 2 4 (1,0,0,1,0) • Places 2 and 4 cannot both contain tokens – mutual exclusion property • PN is bounded (safe) Reachability graph Graph containing a node for each reachable marking. Starting from the initial state, generate all directly reachable markings. Expensive technique. Only feasible if finitely many markings (otherwise use coverability graph). Applicable to certain properties only. Infinite reachability graph 3 1 5 2 6 4 Coverability Tree Coverability tree – tree representation of all possible markings root = M0 (initial marking) nodes = markings reachable from M0 arcs = transition firings – if net is unbounded, then tree is kept finite by introducing the symbol PN is bounded iff doesn’t appear in any node Coverability tree example M0=(100) t3 p2 t2 p1 t1 p3 t0 Coverability tree example M0=(100) t1 t3 p2 t2 p1 t1 p3 M1=(001) “dead end” t0 Coverability tree example M0=(100) t1 t3 p2 t2 p1 t1 p3 M1=(001) “dead end” t0 t3 M3=(110) Coverability tree example M0=(100) t1 t3 p2 t2 p1 t1 p3 M1=(001) “dead end” t0 t3 M3=(10) Coverability tree example M0=(100) t1 t3 p2 p1 t1 M1=(001) “dead end” t0 t3 M3=(10) t1 M4=(01) t2 p3 Coverability tree example M0=(100) t1 t3 p2 p1 t1 M1=(001) “dead end” t0 t3 M3=(10) t1 M4=(01) t2 p3 t3 M3=(10) “old” Coverability tree example M0=(100) t1 t3 p2 p1 t1 t3 M1=(001) “dead end” t0 M3=(10) t1 M4=(01) t2 p3 t2 M5=(01) “old” t3 M6=(10) “old” Coverability tree example M0=(100) 100 t1 t1 t3 001 M1=(001) “dead end” 10 t1 t2 t3 01 t3 M3=(10) t1 M4=(01) t2 M5=(01) “old” coverability graph coverability tree t3 M6=(10) “old” State Equation 1 t1 4 t2 3 t2 t1 t2 2 1 0 0 1 0 5 + 1 -1 -1 1 0 1 0 0 0 0 0 0 -1 -1 1 0 0 0 1 -1 State Equation: 1 2 0 0 = 0 + M x = 0 1 2 1 0 Condition for Reachability State equation is a necessary but not sufficient condition for reachability i.e. 0 + M x = reachable from 0 Example 1 (0,0,1) is not reachable even though it satisfies the state equation 3 2 Structural analysis techniques To avoid state-explosion phenomenon. Properties independent of initial state. We only consider place and transition invariants. Invariants can be computed using linear algebraic techniques. Place invariant man Assigns x z couple marriage divorce y woman 1x+1y+2z a weight to each place. The weight of a token depends on the weight of the place. The weighted token sum is invariant, i.e., no transition can change it Other invariants man z couple marriage divorce y woman 1x +0y+1z 2x+3y+5z -2 x + 3 y + z x–y y–x (Any linear combination of invariants is an invariant.) x Transition invariant man Assigns a weight to each transition. couple x ydivorce marriage woman 2 x+2y Firing the number of times indicated bring the system back in the initial state. Other invariants 1 man couple x y marriage divorce woman x+ 1y 20 x + 20 y Any linear combination of invariants is an invariant, but transition invariants with negative weights have no obvious meaning. Two ways of calculating invariants “Trial-and-error": Formulate the property that you think holds and verify it. "Linear-algebraic way": Solve a system of linear equations. Incidence matrix of a Petri net y Each row corresponds to a place. Each column corresponds to a transition. man m couple x m 1 1 N 1 1 1 1 x z d marriage divorce woman y z d Place invariant Let N be the incidence matrix of a net with n places and m transitions Any solution of the equation XN = 0 is a transition invariant – X is a row vector (i.e., 1 x n matrix) – O is a row vector (i.e., 1 x m matrix) Note that (0,0,... 0) is always a place invariant. Basis can be calculated in polynomial time. Example 1 1 ( x, y, z ) 1 1 (0, 0) 1 1 man x z couple marriage divorce y woman Solutions: (0,0,0) (1,0,1) (0,1,1) (1,1,2) (1,-1,0) Transition invariant Let N be the incidence matrix of a net with n places and m transitions Any solution of the equation NX = 0 is a place invariant – X is a column vector (i.e., m x 1 matrix) – 0 is a column vector (i.e., n x 1 matrix) that (0,0,... 0)T is always a place invariant. Basis can be calculated in polynomial time. Note Example 1 1 0 1 1 m 0 d 1 1 0 man m couple x z d marriage divorce woman y Solutions: (0,0)T (1,1)T (32,32)T Applications of S- and T-invariants T-invariant – Cyclic schedules: need to return to the initial state S-invariant – Structural Boundedness: bounded for any finite initial marking – Existence of a positive S-invariant is CS for structural boundedness initial marking is finite weighted token count does not change Petri Net Transformations Preserving boundedness, liveness, …
© Copyright 2026 Paperzz