Symbolic Model Checking Binary Decision Diagrams 2 Combinatorial - - PDF document

symbolic model checking
SMART_READER_LITE
LIVE PREVIEW

Symbolic Model Checking Binary Decision Diagrams 2 Combinatorial - - PDF document

1 Randal Bryant 86 Ken McMillan 90 Symbolic Model Checking Binary Decision Diagrams 2 Combinatorial Circuits 3 Eight Queen Combinatorial Problems Sudoku Control Programs A Train Simulator, visualSTATE (VVS) 1421 machines 11102


slide-1
SLIDE 1

1

Binary Decision Diagrams

Randal Bryant ’86

Symbolic Model Checking

Ken McMillan ’90

slide-2
SLIDE 2

2

Combinatorial Circuits

slide-3
SLIDE 3

3

Combinatorial Problems

Sudoku Eight Queen

slide-4
SLIDE 4

4

Control Programs

A Train Simulator, visualSTATE (VVS)

1421 machines 11102 transitions 2981 inputs 2667 outputs 3204 local states Declare state sp.: 10^ 476

BUGS ?

“ I d e a l ” p r e s e n t a t i

  • n

: 1 b i t / s t a t e w i l l c l e a r l y N O T w

  • r

k !

slide-5
SLIDE 5

5

Reduced Ordered Binary Decision Diagrams

[Bryant’86]

  • Compact represetation of boolean functions

allowing effective manipulation (satifiability, validity,….)

  • r
  • Compact representation of sets over finite

universe allowing effective manipulations.

slide-6
SLIDE 6

6

Binary Decision Diagrams

[Randal Bryant’86]

A short review

slide-7
SLIDE 7

7

If-Then-Else Normal Form

slide-8
SLIDE 8

8

Shannon Expansion

slide-9
SLIDE 9

9

Binary Decision Trees

Variable is set to 0 Variable is set to 1 Each path determines a partial (set of) truth assignments. Result of the boolean expression under the given assigment found in value of terminal.

slide-10
SLIDE 10

10

Orderedness & Redundant TESTS

slide-11
SLIDE 11

11

Orderedness & Reducedness

x y z x x x x<y x<z

slide-12
SLIDE 12

12

ROBDDs formally

slide-13
SLIDE 13

13

Reduced Ordered Binary Decision Diagrams

Iben

Edges to 0 implicit

slide-14
SLIDE 14

14

Ordering DOES matter

slide-15
SLIDE 15

15

Canonicity of ROBDDs

slide-16
SLIDE 16

16

Build

Complexity ??

slide-17
SLIDE 17

17

APPLY operation

slide-18
SLIDE 18

18

APPLY example

slide-19
SLIDE 19

19

APPLY operation

with dynamic programming

slide-20
SLIDE 20

20

Other operations

slide-21
SLIDE 21

21

Constraint Solving using BDDs

slide-22
SLIDE 22

22

4 x 4 Sudoku

288 solutions !

1 2 3 4

slide-23
SLIDE 23

23

Encoding

1 2 3 4

Boolean variables xi,j,k for all i, j, k ∈ {1,2,3,4}. Idea: xi,j,k = 1 ; if the number k is in position (i,j) in the solution 0 ; otherwise

1 2 3 4 1 2 3 4

x2,2,2 =1 x4,4,4 =1 x2,2,1 =0

slide-24
SLIDE 24

24

Constraints

Precisely one value in each position i, j:

x1,j,1 + xi,j,2 + xi,j,3 + xi,j,4 = 1

for each i, j Each value k appears in each row i exactly ones:

xi,1,k + xi,2,k + xi,3,k + xi,4,k = 1

for each i, k Each value k appears in each colomn j exactly ones:

x1,j,k + x2,j,k + x3,j,k + x4,j,k = 1

for each j, k Each value k appears in each 2x2 box exactly ones:

x1,1,k + x1,2,k + x2,1,k + x2,2,k = 1

(e.g.)

1 2 3 4

1 2 3 4 1 2 3 4

slide-25
SLIDE 25

25

Solving Sudoku

1 2 3 4 1 2 3 4

1 2 3 4

1 2 3 4 1 2 3 4

slide-26
SLIDE 26

26

ROBDDs and Verification

[…,McMillan’90,…..,VVS’97]

slide-27
SLIDE 27

27

ROBDD encoding of transition system

00 10 01 11

Trans(x1,x2,y1,y2):= !x1 & !x2 & !y1 & y2 + !x1 & !x2 & y1 & y2 + x1 & !x2 & !y1 & y2 + x1 & !x2 & y1 & y2 + x1 & x2 & y1 & !y2;

Encoding of states using binary variables (here x1 and x2). Encoding of transition relation using source and target variables (here x1, x2, y1, and y2)

slide-28
SLIDE 28

28

ROBDD representation (cont.)

Trans(x1,x2,y1,y2):= !x1 & !x2 & !y1 & y2 + !x1 & !x2 & y1 & y2 + x1 & !x2 & !y1 & y2 + x1 & !x2 & y1 & y2 + x1 & x2 & y1 & !y2;

00 10 01 11

slide-29
SLIDE 29

29

ROBDD for parallel composition

00 10 01 11 00 10 01 11

Trans(x,y,u,v) =

(ATrans(x,y) & v=u)

+ (BTrans(u,v) & y=x)

ATrans(x,y) BTrans(u,v)

Asynchronous composition Synchronous composition

Trans(x,y,u,v) =

(ATrans(x,y) & BTrans(u,v)) Which ordering to choose?

slide-30
SLIDE 30

30

Ordering?

23 nodes x1,x2,y1,y2,u1,u2,v1,v2 45 nodes x1,x2,u1,u2, y1,y2 ,v1,v2 20 nodes x1,y1,x2,y2,u1,v1,u2,v2

Polynomial size BDDs guaranteed in size of argument BDDs [Enders,Filkorn, Taubner’91]

slide-31
SLIDE 31

31

Reach1 Reach1

Reach(x) := Init(x); REPEAT Old(x) := Reach(x); New(y) := Exists x.(Reach(x) & Trans(x,y)); Reach(x) := Old(x) + New(x) UNTIL Old(x) = Reach(x)

Reachable States

00 10 01 11 Reach0 Reach2 Relational Product: May be constructed without building intermediate (often large) &-BDD.

slide-32
SLIDE 32

32

A MUTEX Algorithm

Clarke & Emerson

P1 :: while True do T1 : wait(turn=1) C1 : turn:=0 endwhile || P2 :: while True do T2 : wait(turn=0) C2 : turn:=1 endwhile P1 :: while True do T1 : wait(turn=1) C1 : turn:=0 endwhile || P2 :: while True do T2 : wait(turn=0) C2 : turn:=1 endwhile Mutual Exclusion Program

slide-33
SLIDE 33

33

Global Transition System

I 1 I 2 t= 0 T1 I 2 t= 0 T1 T2 t= 0 I 1 T2 t= 0 I 1 C2 t= 0 T1 C2 t= 0 C1 I 2 t= 1 T1 T2 t= 1 C1 T2 t= 1 T1 I 2 t= 1 I 1 T2 t= 1 I 1 I 2 t= 1

slide-34
SLIDE 34

34

A MUTEX Algorithm

Clarke & Emerson

vars x1 x2; vars y1 y2; vars u1 u2; vars v1 v2; vars t s; ATrans := (!x1 & !x2 & !y1 & y2 & (s=t)) + (!x1 & x2 & !y1 & y2 & !t & !s) + (!x1 & x2 & y1 & !y2 & t & s) + (x1 & !x2 & !y1 & !y2 & !s); BTrans := (!u1 & !u2 & !v1 & v2 & (s=t)) + (!u1 & u2 & !v1 & v2 & t & s) + (!u1 & u2 & v1 & !v2 & !t & !s) + (u1 & !u2 & !v1 & !v2 & s); TT := (ATrans & (u1=v1) & (u2=v2)) + (BTrans & (x1=y1) & (x2=y2));

00 01 10

slide-35
SLIDE 35

35

BDDs for Transition Relations

ATrans TT

slide-36
SLIDE 36

36

Reachable States

Reach(x) := Init(x); REPEAT Old(x) := Reach(x); New(y) := Exists x.(Reach(x) & Trans(x,y)); Reach(x) := Old(x) + New(x) UNTIL Old(x) = Reach(x)

slide-37
SLIDE 37

37

Reachable States

Reach(x) := Init(x); REPEAT Old(x) := Reach(x); New(y) := Exists x.(Reach(x) & Trans(x,y)); Reach(x) := Old(x) + New(x) UNTIL Old(x) = Reach(x)

slide-38
SLIDE 38

38

Reachable States

Reach(x) := Init(x); REPEAT Old(x) := Reach(x); New(y) := Exists x.(Reach(x) & Trans(x,y)); Reach(x) := Old(x) + New(x) UNTIL Old(x) = Reach(x)

Reach Reach & x1 & !x2 & u1 & !u2 MUTEX ?

slide-39
SLIDE 39

39

Bisimulation

00 10 01 11 00 10 01 11

Bis(x,u):= 1; REPEAT Old(x,u) := Bis(x,u); Bis(x,u) := Forall y. Trans(x,y) => (Exists v. Trans(u,v) & Bis(y,v)) & Forall v. Trans(u,v) => (Exists y. Trans(x,y) & Bis(y,v)); UNTIL Bis(x,u)=Old(x,u)

vars x (y) vars u (v)

slide-40
SLIDE 40

40

Bisimulation (cont.)

00 10 01 11

3 equivalence classes = 6 pairs in final bisimulation Bis0 Bis1 Bis2

slide-41
SLIDE 41

41

Model Checking

p p q p,q

1 3 2

vars x1 x2; vars y1 y2; Trans(x1,x2,y1,y2) := !x1 & !x2 & !y1 & y2 + !x1 & !x2 & y1 & y2 + ………… ; P(x1,x2) := !x1 & !x2 + !x1 & x2 + x1 & !x2; Q(x1,x2) := ……… ;

slide-42
SLIDE 42

42

Model Checking

p p q p,q

1 3 2

EX P

Exists y1,y2. Trans(x1,x2,y1,y2) & P(y1,y2);

slide-43
SLIDE 43

43

Model Checking

p p q p,q

1 3 2

EX P

Exists y1,y2. Trans(x1,x2,y1,y2) & P(y1,y2);

slide-44
SLIDE 44

44

Model Checking

p p q p,q

1 3 2

AX P

Forall y1,y2. Trans(x1,x2,y1,y2) => P(y1,y2);

slide-45
SLIDE 45

45

Model Checking

p p q p,q

1 3 2

AX P

Forall y1,y2. Trans(x1,x2,y1,y2) => P(y1,y2);

slide-46
SLIDE 46

46

Model Checking

p p q p,q

1 3 2

AG P

A(x1,x2) = P(x1,x2) & Forall y1,y2. Trans(x1,x2,y1,y2) => A(y1,y2); max fixpoint

slide-47
SLIDE 47

47

Model Checking

p p q p,q

1 3 2

AG P

A(x1,x2) = P(X1,x2) & Forall y1,y2. Trans(x1,x2,y1,y2) => A(y1,y2); max fixpoint

slide-48
SLIDE 48

48

Model Checking

p p q p,q

1 3 2

A( P UNTIL Q )

U(x1,x2) = Q(x1,x2) + { P(x1,x2) & Forall y1,y2. Trans(x1,x2,y1,y2) => U(y1,y2) }; min fixpoint

slide-49
SLIDE 49

49

Model Checking

p p q p,q

1 3 2

A( P UNTIL Q )

U(x1,x2) = Q(X1,x2) + { P(x1,x2) & Forall y1,y2. Trans(x1,x2,y1,y2) => U(y1,y2) }; min fixpoint

slide-50
SLIDE 50

50

Partitioned Transition Relation

T(xu,yv) =

(ATrans(x,y) & v=u)

+ (BTrans(u,v) & y=x) T(xu,yv) = ATrans(x,y) & BTrans(u,v)

Exists yv. (T(xu,yv) & S(yv)) Relational Product

Asynchronous Synchronous

Exists y. ATrans(x,y) & S(yu) + Exists v. BTrans(u,v) & S(xv)

LARGE

Exists yv. Atrans(x,y) & Btrans(u,v) & S(yv) Exists y. Atrans(x,y) & (Exists v. Btrans(u,v) & S(yv))

slide-51
SLIDE 51

51

visualSTATE

CIT project VVS (w DTU)

Beologic’s Products: salesPLUS salesPLUS visualSTATE visualSTATE

1980-95: Independent division of B&0 1995- : Independent company B&O, 2M Invest, Danish Municipal Pension Ins. Fund 1998: BAAN 2000: IAR Systems A/S Customers:

ABB B&O Daimler-Benz Ericson DIAX ESA/ESTEC FORD Grundfos LEGO PBS Siemens ……. (approx. 200)

Verification Problems:

  • 1.400 components
  • 10400 states

Our techniques has reduced verification by an order of magnitude (from 14 days to 6 sec)

  • Embedded Systems
  • Simple Model
  • Verification of Std. Checks
  • Explicit Representation

(STATEEXPLOSION)

  • Code Generation
slide-52
SLIDE 52

52

visualSTATE

Embedded World Nürnberg, 2005

slide-53
SLIDE 53

53

Control Programs

A Train Simulator, visualSTATE (VVS)

1421 machines 11102 transitions 2981 inputs 2667 outputs 3204 local states Declare state sp.: 10^ 476

BUGS ?

“ I d e a l ” p r e s e n t a t i

  • n

: 1 b i t / s t a t e w i l l c l e a r l y N O T w

  • r

k !

slide-54
SLIDE 54

54

Experimental Breakthroughs

Patented

State Space St-of-Art

ComBack

System Mach. Declared Reach

Checks Visual

ST Sec MB Sec MB

VCR 7 10^ 5 1279 50 < 1 < 1 6 < 1 7 JVC 8 10^ 4 352 22 < 1 < 1 6 < 1 6 HI-FI 9 10^ 7 1416384 120 1200 1.0 6 3.9 6 Motor 12 10^ 7 34560 123 32 < 1 6 2,0 AVS 12 10^ 7 1438416 173 3780 6.7 6 5.7 6 Video 13 10^ 8 1219440 122

  • 1.1

6 1.5 6 Car 20 10^ 11 9.2 10^ 9 83

  • 3.8

9 1.8 6 N6 14 10^ 10 6399552 443

  • 32.3

7 218 6 N5 25 10^ 12 5.0 10^ 10 269

  • 56.2

7 9.1 6 N4 23 10^ 13 3.7 10^ 8 132

  • 622

7 6.3 6

Train1 373 10^ 136

  • 1335
  • 25.9

6 Train2 1421 10^ 476

  • 4708
  • 739

11

Machine: 166 MHz Pentium PC with 32 MB RAM

  • --: Out of memory, or did not terminate after 3 hours.
slide-55
SLIDE 55

55

Experimental Breakthroughs

Patented

State Space St-of-Art

ComBack

System Mach. Declared Reach

Checks Visual

ST Sec MB Sec MB

VCR 7 10^ 5 1279 50 < 1 < 1 6 < 1 7 JVC 8 10^ 4 352 22 < 1 < 1 6 < 1 6 HI-FI 9 10^ 7 1416384 120 1200 1.0 6 3.9 6 Motor 12 10^ 7 34560 123 32 < 1 6 2,0 AVS 12 10^ 7 1438416 173 3780 6.7 6 5.7 6 Video 13 10^ 8 1219440 122

  • 1.1

6 1.5 6 Car 20 10^ 11 9.2 10^ 9 83

  • 3.8

9 1.8 6 N6 14 10^ 10 6399552 443

  • 32.3

7 218 6 N5 25 10^ 12 5.0 10^ 10 269

  • 56.2

7 9.1 6 N4 23 10^ 13 3.7 10^ 8 132

  • 622

7 6.3 6

Train1 373 10^ 136

  • 1335
  • 25.9

6 Train2 1421 10^ 476

  • 4708
  • 739

11

Machine: 166 MHz Pentium PC with 32 MB RAM

  • --: Out of memory, or did not terminate after 3 hours.

Our technique have reduced verification time by several orders of magnitude (eg. From 14 days to 6 sec)

slide-56
SLIDE 56

56

Compositional Backwards Reachability

[ TACAS’98 ]

slide-57
SLIDE 57

57

Example

The Small Train

Train Gate Signal l t r STOP BW FW t l,t r r

DOWN DOWN

t l UP DOWN GR RED d

RED

u g re

slide-58
SLIDE 58

58

State-Event Model

visualSTATE

n synchronously combined machines Mi = (Si,si

0,Ti)

where Ti ⊆ Si× E × Gi× M(O)× Si

Input Events Guards on

  • ther

machines locations Syntax Semantics (s1,…,sn) – e , ∪ oi (s1’,…,sn’) iff si - e,gi,oi si’ with gi (s1,…,sn)=true

  • r

si = si’ and oi=Ø and whenever si - e, gi then gi (s1,…,sn)=false Output

i=1..n

slide-59
SLIDE 59

59

Small Train (cont)

Train Gate Signal

DOWN UP S T O P BW FW G R R E D

STOP BW FW t l,t r t r l

DOWN DOWN

UP DOW N GR RED d

RED

u g re

slide-60
SLIDE 60

60

Small Train (cont)

Train Gate Signal

DOWN UP S T O P BW FW G R R E D re d l r

STOP BW FW t l,t r t r l

DOWN DOWN

UP DOW N GR RED d

RED

u g re

slide-61
SLIDE 61

61

Generic Checks

visualSTATE offers checks for a number of predefined properties:

  • Reachability of states
  • Firing of transitions
  • Input without interpretation
  • Output without generation
  • Conflicting Rules
  • Local Deadlock
  • Global Deadlock

Not a single CHECK but several thousands!

Reachability

slide-62
SLIDE 62

62

Guard dependencies

Let g1, g2, g3, …, gN (N big) be the guards we want to show reachable If gi ⇒ gj (e.g. gi=DOWN ∧ UP, gj=DOWN) then it suffices to show that gi reachable, i.e. there is a reachable global state satisfying gi. Sort g1, g2, g3, …, gN according to size and check only if NOT implied by a previously shown reachable guard

  • 40-70-90 % reduction.
slide-63
SLIDE 63

63

Machine Dependencies

STOP BW FW t l,t r t r l

DOWN DOWN

UP DOWN GR RED d

RED

u g re

A guard g in machie Mi that depends on/refers to a state in Mj introduces a dependency from Mi to Mj

TRAIN GATE SIGNAL

Backwards statespace iterations can be restricted to dependency closed sets, e.g. DC(GATE) = {GATE,SIGNAL}

slide-64
SLIDE 64

64

Compositional Backwards

STOP BW FW t l,t r t r l

DOWN DOWN

UP DOW N GR RED d

RED

u g re

Is FW reachable ?

IDEA: Compute backward reachable states as much as possible with minimal set

  • f machines.

Increase set of considered machines when necessary!

Consider TRAIN

FW BW STOP

TRAIN

slide-65
SLIDE 65

65

Compositional Backwards

STOP BW FW t l,t r t r l

DOWN DOWN

UP DOW N GR RED d

RED

u g re

Is FW reachable ?

IDEA: Compute backward reachable states as much as possible with minimal set

  • f machines.

Increase set of considered machines when necessary!

Consider TRAIN

FW BW STOP

TRAIN

D O W N D O W N

Ignoring INPUT event

slide-66
SLIDE 66

66

Compositional Backwards

STOP BW FW t l,t r t r l

DOWN DOWN

UP DOW N GR RED d

RED

u g re

Is FW reachable ?

IDEA: Compute backward reachable states as much as possible with minimal set

  • f machines.

Increase set of considered machines when necessary!

Consider TRAIN

FW BW STOP

TRAIN

D O W N D O W N

Ignoring INPUT event

slide-67
SLIDE 67

67

Compositional Backwards

STOP BW FW t l,t r t r l

DOWN DOWN

UP DOW N GR RED d

RED

u g re

Include GATE !

FW BW

TRAIN

RED

Ignoring transtions with source in

slide-68
SLIDE 68

68

Compositional Backwards

STOP BW FW t l,t r t r l

DOWN DOWN

UP DOW N GR RED d

RED

u g re

Include GATE !

FW BW

TRAIN

RED

Ignoring transtions with source in Any state projecting to can reach a state projecting to

slide-69
SLIDE 69

69

Compositional Backwards

STOP BW FW t l,t r t r l

DOWN DOWN

UP DOW N GR RED d

RED

u g re

Include SIGNAL ! Train Gate Signal

DOWN UP S T O P BW FW G R R E D

Thus FW is reachable !

slide-70
SLIDE 70

70

Hierarchical Systems

IDEA Reuse already known reachability properties of superstates to conclude reachability of substates !

[ TACAS’99 ]

slide-71
SLIDE 71

71

Experimental results