interpolation-sequence based model checkingi-cav.org/cavlinks/wp-content/uploads/2019/07/... ·...

43
1 Interpolation-Sequence Based Model Checking Yakir Vizel and Orna Grumberg FMCAD 2009 Verification course, June 5, 2017

Upload: others

Post on 12-Aug-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Interpolation-Sequence Based Model Checkingi-cav.org/cavlinks/wp-content/uploads/2019/07/... · Interpolation-Sequence Based Model Checking Yakir Vizel and Orna Grumberg FMCAD 2009

1

Interpolation-Sequence Based Model Checking

Yakir Vizel and Orna GrumbergFMCAD 2009

Verification course, June 5, 2017

Page 2: Interpolation-Sequence Based Model Checkingi-cav.org/cavlinks/wp-content/uploads/2019/07/... · Interpolation-Sequence Based Model Checking Yakir Vizel and Orna Grumberg FMCAD 2009

2

Inspired by:• forward reachability analysisCombines:• Bounded Model Checking• Interpolation-sequence

Obtains:• SAT-based model checking algorithm for

full verification

Page 3: Interpolation-Sequence Based Model Checkingi-cav.org/cavlinks/wp-content/uploads/2019/07/... · Interpolation-Sequence Based Model Checking Yakir Vizel and Orna Grumberg FMCAD 2009

3

…… Sn

…… Sn

S2S2S1S1INITBAD ¬q

BAD ¬q

Forward Reachability Analysis

Page 4: Interpolation-Sequence Based Model Checkingi-cav.org/cavlinks/wp-content/uploads/2019/07/... · Interpolation-Sequence Based Model Checking Yakir Vizel and Orna Grumberg FMCAD 2009

4

Forward reachability analysis

• Sj is the set of states reachable from some initial state in j steps

• termination when– either a bad state satisfying q is found– or a fixpoint is reached:

Sj i=1,j-1Si

Page 5: Interpolation-Sequence Based Model Checkingi-cav.org/cavlinks/wp-content/uploads/2019/07/... · Interpolation-Sequence Based Model Checking Yakir Vizel and Orna Grumberg FMCAD 2009

SAT-based model checking:A solution for the state explosion problem

Main idea

• Translate the model and the specification to propositional formulas

• Use efficient tools (SAT solvers) for solving the satisfiability problem

5

Page 6: Interpolation-Sequence Based Model Checkingi-cav.org/cavlinks/wp-content/uploads/2019/07/... · Interpolation-Sequence Based Model Checking Yakir Vizel and Orna Grumberg FMCAD 2009

Bounded Model Checking (BMC)for checking AGp

• Unwind the model for k levels, i.e., construct all computations of length k

• If a state satisfying p is encountered, produce a counterexample;Otherwise, increase k

[BCCZ 99]

6

Page 7: Interpolation-Sequence Based Model Checkingi-cav.org/cavlinks/wp-content/uploads/2019/07/... · Interpolation-Sequence Based Model Checking Yakir Vizel and Orna Grumberg FMCAD 2009

7

• Does the system have a counterexample of length k?

0 0 1 1 2 1( ) ( , ) ( , ) ( , ) ( )k k kINIT V T V V T V V T V V p V

0 0( ) ( )INIT V p V

0 0 1 1( ) ( , ) ( )INIT V T V V p V

0 0 1 1 2 2( ) ( , ) ( , ) ( )INIT V T V V T V V p V

.

.

.

7

Page 8: Interpolation-Sequence Based Model Checkingi-cav.org/cavlinks/wp-content/uploads/2019/07/... · Interpolation-Sequence Based Model Checking Yakir Vizel and Orna Grumberg FMCAD 2009

Bounded Model Checking

Terminates • with a counterexample or • with time- or memory-out

The method is suitable for falsification, not verification

8

Page 9: Interpolation-Sequence Based Model Checkingi-cav.org/cavlinks/wp-content/uploads/2019/07/... · Interpolation-Sequence Based Model Checking Yakir Vizel and Orna Grumberg FMCAD 2009

Verification with SAT solvers

Two successful methods for SAT-based verification are based on:• Interpolation [McMillan 03]• IC3 [Bradley 11]

we present two methods for enhancing interpolation and IC3 model checking

9

Page 10: Interpolation-Sequence Based Model Checkingi-cav.org/cavlinks/wp-content/uploads/2019/07/... · Interpolation-Sequence Based Model Checking Yakir Vizel and Orna Grumberg FMCAD 2009

10

INIT

INIT I3I3

BAD ¬p

I1I1 I2I2

S1 S2 S3

10

Page 11: Interpolation-Sequence Based Model Checkingi-cav.org/cavlinks/wp-content/uploads/2019/07/... · Interpolation-Sequence Based Model Checking Yakir Vizel and Orna Grumberg FMCAD 2009

Interpolation• If A B = false, there exists an

interpolant I for (A,B) such that:

A II B = false

I refers only to common variables of A,B

[Craig 57]

11

Page 12: Interpolation-Sequence Based Model Checkingi-cav.org/cavlinks/wp-content/uploads/2019/07/... · Interpolation-Sequence Based Model Checking Yakir Vizel and Orna Grumberg FMCAD 2009

12

),()( 100 VVTVINIT

• Given the following BMC formula k

1 2 1( , ) ( , ) ( )k k kT V V T V V p V

A B

I

1I is over the common variables of A and B, i.e V

A II B false

12

Page 13: Interpolation-Sequence Based Model Checkingi-cav.org/cavlinks/wp-content/uploads/2019/07/... · Interpolation-Sequence Based Model Checking Yakir Vizel and Orna Grumberg FMCAD 2009

Interpolation in the context of model checking

• I is over V1• A I

– I over-approximates the set S1

• I B false– States in I cannot reach a bug in k-1

steps

13

Page 14: Interpolation-Sequence Based Model Checkingi-cav.org/cavlinks/wp-content/uploads/2019/07/... · Interpolation-Sequence Based Model Checking Yakir Vizel and Orna Grumberg FMCAD 2009

14

),()( 100 VVTVINIT 1 2 2 3 1( , ) ( , ) ( , ) ( )k k kT V V T V V T V V p V

A1A2 A3 Ak Ak+1

I1 I2 I3 Ik-1 Ik

0 1

1

j 1 j j 1 k 1 j

,

I is over the common variables of A , , A and A , , A , i.e V

k

j j j

I true I falseI A I

• The same BMC formula partitioned in a different manner:

14

Page 15: Interpolation-Sequence Based Model Checkingi-cav.org/cavlinks/wp-content/uploads/2019/07/... · Interpolation-Sequence Based Model Checking Yakir Vizel and Orna Grumberg FMCAD 2009

Interpolation-Sequence

• Ij – over-approximation of the set of states reachable in j steps

• Ik Ak+1 falsethe states in Ik do not violate p

15

Page 16: Interpolation-Sequence Based Model Checkingi-cav.org/cavlinks/wp-content/uploads/2019/07/... · Interpolation-Sequence Based Model Checking Yakir Vizel and Orna Grumberg FMCAD 2009

16

• Can easily be computed in the same way a single interpolation is computed:

• For 1 ≤ j < n– A(j) = A1 … Aj

– B(j) = Aj+1 … An

– Ij is the interpolant for the pair (A(j), B(j))

Page 17: Interpolation-Sequence Based Model Checkingi-cav.org/cavlinks/wp-content/uploads/2019/07/... · Interpolation-Sequence Based Model Checking Yakir Vizel and Orna Grumberg FMCAD 2009

17

• Uses BMC for bug finding

• Uses Interpolation-sequence for computing over-approximation of sets Sj of reachable states

17

Page 18: Interpolation-Sequence Based Model Checkingi-cav.org/cavlinks/wp-content/uploads/2019/07/... · Interpolation-Sequence Based Model Checking Yakir Vizel and Orna Grumberg FMCAD 2009

18

Always terminates• either when BMC finds a bug:

M | AGp

• or when all reachable states has been found: M |= AGp

18

Page 19: Interpolation-Sequence Based Model Checkingi-cav.org/cavlinks/wp-content/uploads/2019/07/... · Interpolation-Sequence Based Model Checking Yakir Vizel and Orna Grumberg FMCAD 2009

19

I1,1

0 0 1 1 2 2( ) ( , ) ( , ) ( )INIT V T V V T V V p V

I1,2I2,2

0 0 1 1( ) ( , ) ( )INIT V T V V p V

I1

19

Page 20: Interpolation-Sequence Based Model Checkingi-cav.org/cavlinks/wp-content/uploads/2019/07/... · Interpolation-Sequence Based Model Checking Yakir Vizel and Orna Grumberg FMCAD 2009

20

Checking if a “fixpoint” has been reached

• Ij Vk=1,j-1 Ik

• Similar to checking fixpoint in forward reachability analysis :Sj Uk=1,j-1 Sk

• But here we check inclusion for every 2 j N– No monotonicity because of the approximation

• “Fixpoint” is checked with a SAT solver20

Page 21: Interpolation-Sequence Based Model Checkingi-cav.org/cavlinks/wp-content/uploads/2019/07/... · Interpolation-Sequence Based Model Checking Yakir Vizel and Orna Grumberg FMCAD 2009

21

INIT S1

INIT

S2 S3

I1I1 I2I2 I3I3

BAD ¬p

0 0 1 1 2 2 3 3( ) ( , ) ( , ) ( , ) ( )INIT V T V V T V V T V V p V 0 0 1 1( ) ( , ) ( )INIT V T V V p V

I1,1I1,1

0 0 1 1 2 2( ) ( , ) ( , ) ( )INIT V T V V T V V p V

I2,2I2,2I1,2I1,2

I1I1 I2I2

I3,3I3,3I2,3I2,3I1,3I1,3

21

Page 22: Interpolation-Sequence Based Model Checkingi-cav.org/cavlinks/wp-content/uploads/2019/07/... · Interpolation-Sequence Based Model Checking Yakir Vizel and Orna Grumberg FMCAD 2009

22

Notation:If no counterexample of length N or less

exists in M, then:

• Ijk is the j-th element in the interpolation-

sequence extracted from the BMC-partition of k

• Ij = k=j,N Ijk [Vj V]

• The reachability vector is:Î = ( I1, I2, … , IN )

Page 23: Interpolation-Sequence Based Model Checkingi-cav.org/cavlinks/wp-content/uploads/2019/07/... · Interpolation-Sequence Based Model Checking Yakir Vizel and Orna Grumberg FMCAD 2009

explanationIj = k=j,N Ij

k [Vj V]

• Each Ijk over-approximates Sj

– Their conjunction results in a more accurate over-approximation

• Only Ijj is guaranteed to satisfy p

– Ij satisfies p

23

Page 24: Interpolation-Sequence Based Model Checkingi-cav.org/cavlinks/wp-content/uploads/2019/07/... · Interpolation-Sequence Based Model Checking Yakir Vizel and Orna Grumberg FMCAD 2009

24

function UpdateReachable( Î, Î k )j=1while (j < k ) do

Ij = Ij Ijk

Î [j] = Ij

end whileÎ [k] = Ik

k

end function

Page 25: Interpolation-Sequence Based Model Checkingi-cav.org/cavlinks/wp-content/uploads/2019/07/... · Interpolation-Sequence Based Model Checking Yakir Vizel and Orna Grumberg FMCAD 2009

25

function FixpointReached (Î )j=2while (j Î .length) do

R = Vk=1,j-1 Ik = Ij R // negation of IjRif (SAT()==false) then return trueend ifj = j+1

end whilereturn false

end function

Page 26: Interpolation-Sequence Based Model Checkingi-cav.org/cavlinks/wp-content/uploads/2019/07/... · Interpolation-Sequence Based Model Checking Yakir Vizel and Orna Grumberg FMCAD 2009

26

Function ISB(M, f) // f = AGqk = 0result = BMC (M, f, 0)if (result == cex) then return cexÎ = // the reachability vector

while (true) dok = k+1result = BMC (M, f, k)if (result==cex) then return cexÎ k = ( T, I1

k, … , Ikk, F )

UpdateReachable (Î , Î k )if ( FixpointReached (Î ) == true) then

return trueend if

end whileend function

Page 27: Interpolation-Sequence Based Model Checkingi-cav.org/cavlinks/wp-content/uploads/2019/07/... · Interpolation-Sequence Based Model Checking Yakir Vizel and Orna Grumberg FMCAD 2009

27

Interpolation-Based Model Checking [McM03]

Page 28: Interpolation-Sequence Based Model Checkingi-cav.org/cavlinks/wp-content/uploads/2019/07/... · Interpolation-Sequence Based Model Checking Yakir Vizel and Orna Grumberg FMCAD 2009

28

• We can check several bounds with one formula• Given a BMC formula with possibly several bad states

),()( 100 VVTVINIT ))(...)((),(),( 1121 kkk VqVqVVTVVT

A B

I

1V i.e B, andA of iablescommon var over the is IFBI

IA

Page 29: Interpolation-Sequence Based Model Checkingi-cav.org/cavlinks/wp-content/uploads/2019/07/... · Interpolation-Sequence Based Model Checking Yakir Vizel and Orna Grumberg FMCAD 2009

29

• The interpolant represents an over-approximation of reachable states after one transition.

• Also, there is no path of length k-1 or lessthat can reach a bad state.

Page 30: Interpolation-Sequence Based Model Checkingi-cav.org/cavlinks/wp-content/uploads/2019/07/... · Interpolation-Sequence Based Model Checking Yakir Vizel and Orna Grumberg FMCAD 2009

30

I1

I2

)(),()( 1100 VqVVTVINIT

)(),()( 11001 VqVVTVI

)(),()( 11002 VqVVTVI BAD ¬q

Page 31: Interpolation-Sequence Based Model Checkingi-cav.org/cavlinks/wp-content/uploads/2019/07/... · Interpolation-Sequence Based Model Checking Yakir Vizel and Orna Grumberg FMCAD 2009

31

I’1

))()((),(),()( 2121100 VqVqVVTVVTVINIT

))()((),(),()(' 21211001 VqVqVVTVVTVI

))()((),(),()(' 2121100 VqVqVVTVVTVIk

.

.

.

Page 32: Interpolation-Sequence Based Model Checkingi-cav.org/cavlinks/wp-content/uploads/2019/07/... · Interpolation-Sequence Based Model Checking Yakir Vizel and Orna Grumberg FMCAD 2009

32

INIT S1

INIT

S2 S3

BAD ¬q

))()((),(),()(' 21211002 VqVqVVTVVTVI ))()((),(),()( 2110100 VqVqVVTVVTVINIT

I’1I’1

))()((),(),()(' 21211001 VqVqVVTVVTVI

I’2I’2I’3I’3

Page 33: Interpolation-Sequence Based Model Checkingi-cav.org/cavlinks/wp-content/uploads/2019/07/... · Interpolation-Sequence Based Model Checking Yakir Vizel and Orna Grumberg FMCAD 2009

• If BMC finds a satisfying assignment the counterexample might be spurious– The set of initial states is

over-approximated• Increase k and start with the original

INIT

33

Page 34: Interpolation-Sequence Based Model Checkingi-cav.org/cavlinks/wp-content/uploads/2019/07/... · Interpolation-Sequence Based Model Checking Yakir Vizel and Orna Grumberg FMCAD 2009

34

• When calculating the interpolant for the i-th iteration, for bound k the following holds:– The interpolant represents an over-

approximation of reachable states after itransitions

– Also, it cannot reach a bad state in k-1+i steps or less• It is similar to Ii calculated in ISB after k+i iterations

Page 35: Interpolation-Sequence Based Model Checkingi-cav.org/cavlinks/wp-content/uploads/2019/07/... · Interpolation-Sequence Based Model Checking Yakir Vizel and Orna Grumberg FMCAD 2009

35

• The computation itself is different– Uses interpolation, not interpolation sequence– Based on nested loops– Not incremental

• The computed over-approximated sets are different.

S1 I1I1J1J1

35

Page 36: Interpolation-Sequence Based Model Checkingi-cav.org/cavlinks/wp-content/uploads/2019/07/... · Interpolation-Sequence Based Model Checking Yakir Vizel and Orna Grumberg FMCAD 2009

36

• Experiments were conducted on two future CPU designs from Intel (two different architectures)

Page 37: Interpolation-Sequence Based Model Checkingi-cav.org/cavlinks/wp-content/uploads/2019/07/... · Interpolation-Sequence Based Model Checking Yakir Vizel and Orna Grumberg FMCAD 2009

37

Page 38: Interpolation-Sequence Based Model Checkingi-cav.org/cavlinks/wp-content/uploads/2019/07/... · Interpolation-Sequence Based Model Checking Yakir Vizel and Orna Grumberg FMCAD 2009

38

Page 39: Interpolation-Sequence Based Model Checkingi-cav.org/cavlinks/wp-content/uploads/2019/07/... · Interpolation-Sequence Based Model Checking Yakir Vizel and Orna Grumberg FMCAD 2009

39

Spec #Vars

Bound(Ours)

Bound(M)

#Int(Ours)

#Int(M)

#BMC(Ours)

#BMC(M)

Time [s]

(Ours)

Time [s](M)

F1 3406 16 15 136 80 16 80 970 5518

F2 1753 9 8 45 40 9 40 91 388

F3 1753 16 15 136 94 16 94 473 1901

F4 3406 6 5 21 13 6 13 68 208

F5 1761 2 1 3 2 2 2 5 4

F6 3972 3 1 6 3 3 3 19 14

F7 2197 3 1 6 3 3 3 2544 1340

F8 4894 5 1 15 3 5 3 635 101

Page 40: Interpolation-Sequence Based Model Checkingi-cav.org/cavlinks/wp-content/uploads/2019/07/... · Interpolation-Sequence Based Model Checking Yakir Vizel and Orna Grumberg FMCAD 2009

40

• False properties is always faster.• True properties – results vary. Heavier

properties favor ISB where the easier favor IB.

• Some properties cannot be verified by one method but can be verified by the other and vise-versa.

Page 41: Interpolation-Sequence Based Model Checkingi-cav.org/cavlinks/wp-content/uploads/2019/07/... · Interpolation-Sequence Based Model Checking Yakir Vizel and Orna Grumberg FMCAD 2009

41

• A new SAT-based method for unbounded model checking.– BMC is used for falsification.– Simulating forward reachability analysis

for verification.• Method was successfully applied to

industrial sized systems.

Page 42: Interpolation-Sequence Based Model Checkingi-cav.org/cavlinks/wp-content/uploads/2019/07/... · Interpolation-Sequence Based Model Checking Yakir Vizel and Orna Grumberg FMCAD 2009

Additional comments:

• Interpolation and interpolation sequence: defined for additional logics, not just propositional logic

• Interpolation sequence was suggested in “Lazy abstraction with interpolation”, McMillan, CAV 2006

42

Page 43: Interpolation-Sequence Based Model Checkingi-cav.org/cavlinks/wp-content/uploads/2019/07/... · Interpolation-Sequence Based Model Checking Yakir Vizel and Orna Grumberg FMCAD 2009

43

Thank you!