# Hardware and Petri nets Symbolic methods for analysis and verification.

## Presentation on theme: "Hardware and Petri nets Symbolic methods for analysis and verification."— Presentation transcript:

Hardware and Petri nets Symbolic methods for analysis and verification

Outline Representing Boolean functions with BDDs Symbolic traversal for reachability set calculation State encoding Structural methods for efficient encoding

Representing Boolean functions a b c b ccc 10011010 1 1 1111 1 0 0 0000 0

a bb cc 0110 1 1 11 1 0 0 00 0

a b cc 0110 1 1 11 0 0 00

a b cc 01 1 1 1 1 0 0 0 0

Binary Decision Diagrams a b cc 01 1 1 1 1 0 0 0 0 Reduced Ordered Binary Decision Diagram All variables appear in the same order No isomorphic subgraphs Canonical form Efficient form for many functions [Bryant, ACM Comp. Surveys, September 1992]

Reachable markings p1 p6 p7 p5 p3 t2 t5 t6 t1 t4 t3 t7 p2 p3 t1 p4 p5 t2 t3t5t6 p1 t5 p6 p5 t6 p4 p7 t4 p6 p7 t3 p6 p3 t4 p2 p7 p2 p4 t7

Boolean encoding p1 p6 p7 p5 p3 t2 t5 t6 t1 t4 t3 t7 p2 p4 0110000 t1 0001100 t2 t3t5 t6 1000000 t5 0000110 t6 0001001 t4 0000011 t3 0010010 t4 0100001 t7 Seven variables: p1 p2 p3 p4 p5 p6 p7

Boolean encoding 0110000 t1 0001100 t2 t3t5 t6 1000000 t5 0000110 t6 0001001 t4 0000011 t3 0010010 t4 0100001 t7 Seven variables: p1 p2 p3 p4 p5 p6 p7 p 1 p 2 p 3 (p 4  p 6 ) (p 5  p 7 ) Enabled(t 7 ) = p 6 p 7  p 1 p 2 p 3 p 4 p 5 p 6 p 7  (toggle p 1, p 6, p 7 ) p 1 p 2 p 3 p 4 p 5 p 6 p 7

Symbolic Traversal (BFS algorithm) Reached = From = {m 0 }; repeat From [ T  To; New = To \ Reached; From = New; Reached = Reached  New; until New = Ø; # iterations: sequential depth of the net

Reachability Set computation Based on BFS Image computation S 0 = M 0 S i+1 = S i  Image (S i ) S0S0 S1S1 S2S2 S3S3 Monotonic increase until fix point S i+1 = S i #iteration New markings

01100000001100 1000000 00001100001001 0000011 0010010 0100001 001100 000 110010 111 011 101 Boolean encoding t1 t2 t3t5 t6 t5t6 t4 t3 t4t7 Seven variables: p1 p2 p3 p4 p5 p6 p7 Sparse encoding: Optimal encoding: Three variables  log 2 |RG|  : v1 v2 v3 But the reachability graph should be known a priori... Very easy to derive and use Less efficient in terms of BDDs

Encoding for safe PNs Not all combinations of tokens are possible. Find relations among places to reduce the number of variables!!! p4 p2p1 p3 p3 p4 p1 p2 Ø

Encoding for safe PNs PN structure: Place Invariant Set of places with a constant weighted sum of tokens Specially efficient for safe PNs (State Machines) k 1 p 1 + k 2 p 2 +…..+ k n p n = B p 1 + p 2 +…..+ p n = 1 Computed by linear programming techniques

p1 p6 p7 p5 p3 t2 t5 t6 t1 t4 t3 t7 p2 p4 p1 p6 p7 p5 p3 t2 t5 t6 t1 t4 t3 t7 p2 p4 State Machine Components p1 p6 p7 p5 p3 t2 t5 t6 t1 t4 t3 t7 p2 p4 p1 p6 t2 t5 t1 t3 t7 p2 p4 p1 p7 p5 p3 t2 t6 t1 t4 t7

Encoding for safe PNs p1 p6 t2 t5 t1 t3 t7 p2 p4 p1 p7 p5 p3 t2 t6 t1 t4 t7 Two additional variables: v 3 v 4 Two variables: v 1 v 2 00 0110 11 00 11 01 10

Encoding for safe PNs p1 p6 p7 p5 p3 t2 t5 t6 t1 t4 t3 t7 p2 p4 Four variables: v 1 v 2 v 3 v 4 10 - - - - 10 01 - - 0000 - - 01 - - 11 11 - - 10100101 0000 11010111 1111 1110 1011 t1 t2 t3t5 t6 t5t6 t4 t3 t4t7

20103002 1206111201200214 2104 Sparse encoding: 10 variables Dense encoding: 3 variables 010000 011100111110 001 Encoding for bounded PNs p1 p3 t2 t1 p4 t3 p2 2 2 2 max(p2)=3 max(p1)=3 max(p4)=8 max(p3)=2 t2t1 t3 t2 Invariants of the PN: I1: 2p 1 + 4p 2 - p 4 = 4 I2: p 1 + p 2 + p 3 = 3

20103002 1206111201200214 2104 Dense encoding: 3 variables Encoding for bounded PNs Invariants of the PN: I1: 2p 1 + 4p 2 - p 4 = 4 I2: p 1 + p 2 + p 3 = 3 Dense encoding: 3 variables t2t1 t3 t2 0308 t2 Invariants characterize the set of all potentially reachable markings (an overestimation of the reachable markings)

Encoding for bounded PNs 2p1 + 4p2 - p4 = 4 p1 p2 p4 013567 2984 0 12 3 2123102101 0464280286 p1 + p2 + p3 = 3 p1 p2 p3 56 2 10 01 p2 7 p3 0 3 0 3 variables4 variables (8 vars)

Encoding for bounded PNs p1 + p2 + p3 = 3 p1 p2 p3 013 274 0123 212310 201100 p2 p3 34 10 01 M(p1)+M(p2) p3 012 231 210

Encoding for bounded PNs x1 x2 x3 0 TF FTFT T 0 F 0 T 1 F 1 T 2 F 2 T 3 F 12312010 p1 p2 2p1 + 4p2 - p4 = 4p3 = 3 - p1 - p2 x1 x2 x3 2 TF FTFT T 1 F 0 T 1 F 0 T 1 F 0 T 0 F p3

Upper bounds for the state space FFFFFF x2 x3 x4 T TF FTFT T T F T T T F T T T F T T T F x2 x3 x4 T TF FTFT T T FTFTFTF x1 TF 2p1 + 4p2 - p4 = 4 x1 x2 x3 T F FT T T F F Characteristic function for potentially reachable states

Experimental results

Conclusions Formal verification and synthesis often suffer from the state explosion problem Symbolic techniques can be used to efficiently represent the state space Structural techniques are crucial to overestimate and encode the state space Try to resist the temptation of using BDDs from the very beginning. Use them rationally and only if desperate.

Download ppt "Hardware and Petri nets Symbolic methods for analysis and verification."

Similar presentations