1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification...

83
1 Model Checking, Abstraction-Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006
  • date post

    19-Dec-2015
  • Category

    Documents

  • view

    216
  • download

    1

Transcript of 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification...

Page 1: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

1

Model Checking, Abstraction-Refinement, and Their

Implementation

Orna Grumberg

Verification seminarMarch 2006

Page 2: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

2

CTL*• Allows any combination of temporal

operators and path quantifiers• More expressive than LTL or CTL

ACTL / ACTL*The universal fragments of CTL/CTL* with

only universal path quantifiers

-calculus: More expressive than CTL*

Page 3: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

3

Model Checking

An efficient procedure that receives: A finite-state model M, describing a system A temporal logic formula , describing a

property

It returns yes, M |= no + Counterexample, otherwise

Page 4: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

4

Main limitation:

The state explosion problem:Model checking is efficient in time

but suffers from high space requirements:

The number of states in the system model grows exponentially with

the number of variables the number of components in the system

Page 5: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

5

Possible solutionReplacing the system model by a

smaller one (less states and transitions) that still preserves properties of interest

• Modular verification• Symmetry• Abstraction

Page 6: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

6

We define:equivalence between models that

strongly preserves CTL* (-calculus)

If M1 M2 then for every CTL* formula ,

M1 |= M2 |=

preorder on models that weakly preserves ACTL*

If M2 M1 then for every ACTL* formula ,

M2 |= M1 |=

Page 7: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

7

The simulation preorder [Milner]

Given two models M1 = (S1,I1,R1,L1), M2 = (S2,I2,R2,L2)

H S1 x S2 is a simulation iff

for every (s1, s2 ) H :

• s1 and s2 satisfy the same propositions

• For every successor t1 of s1 there is a successor t2 of s2 such that (t1,t2) H

Notation: s1 s2

Page 8: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

8

The simulation preorder [Milner]

Given two models M1 = (S1,I1,R1,L1), M2 = (S2,I2,R2,L2)

H S1 x S2 is a simulation iff

for every (s1, s2 ) H :

• L(s1) = L(s2)

t1 [ (s1,t1) R1 t2 [ (s2,t2) R2 (t1,t2) H ] ]

Notation: s1 s2

Page 9: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

9

Simulation preorder (cont.)

H S1 x S2 is a simulation from M1

to M2 iff

H is a simulation and for every s1 I1 there is s2 I2 s.t. (s1,

s2) H

Notation: M1 M2

Page 10: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

10

Bisimulation relation [Park]

For models M1 and M2, H S1 x S2 is a bisimulation

iff for every (s1, s2 ) H :

• L(s2) = L(s1) t1 [ (s1,t1) R1 t2 [ (s2,t2) R2 (t1,t2) H ] ]

t2 [(s2,t2) R2 t1 [(s1,t1) R1 (t1,t2) H ]]

Notation: s1 s2

Page 11: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

11

Bisimulation relation (cont.)

H S1 x S2 is a Bisimulation between M1 and M2

iff H is a bisimulation and for every s1 I1 there is s2 I2 s.t. (s1, s2 ) H

andfor every s2 I2 there is s1 I1 s.t. (s1, s2 )

H

Notation: M1 M2

Page 12: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

12

H={ (1,1’), (2,4’), (4,2’), (3,5’), (3,6’), (5,3’), (6,3’) }

a b aab

b

Bisimulation equivalence

M1 M2

ab b

d dc

14

3 6

2

5

M1a

b b

c cd

1’

2’

3’

4’

5’ 6’

M2

Page 13: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

13

M1 M2

Simulation preorder

M1 M2

wait

coin coin

pepsicoke

wait

coin

coke pepsi

Page 14: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

14

M1 M2

a

b

cdd dc

a

bb

M1 M2

Page 15: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

15

M1 M2

a

b

cdd dc

a

bb

M1 M2 and M1 M2 but not M1 M2

Page 16: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

16

(bi)simulation and logic preservation

Theorem:If M1 M2 then for every CTL* formula ,

M1 |= M2 |=

If M2 M1 then for every ACTL* formula ,

M2 |= M1 |=

Holds also for -calculus and its universal fragment

Page 17: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

17

Abstraction

• One of the most useful ways to fight the state explosion problem

• They should preserve properties of interest: properties that hold for the abstract model should hold for the concrete model

• Abstractions should be constructed directly from the program

Page 18: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

18

Abstraction

• Removes or simplifies details• Removes entire componentsthat are irrelevant to the propertyunder consideration, thus reducing # of states

Manual abstraction requires great creativity.

Page 19: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

19

Outline for abstraction

• Define an abstract model that preserves the checked property

• Consider different types of abstractions• Automatically construct an abstract

model– Different constructions for different types

• Automatically refine it, if the abstraction is not detailed enough

Page 20: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

20

• We first define an abstract model Mh based on a concrete (full) model M of the system

• Goal: constructing Mh directly from the program text

P

M MhConcrete model Abstract model

Page 21: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

21

Abstraction preserving ACTL/ACTL*

We use Existential Abstraction in which the abstract model is an over-approximation of the concrete model:

– The abstract model has more behaviors– But no concrete behavior is lost

• Every ACTL/ACTL* property true in the abstract model is also true in the concrete model

Page 22: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

22

Existential Abstraction

M

Mh

Given an abstraction function h : S Sh, the concrete states are grouped and mapped into abstract states :

h h h

M < Mh

Page 23: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

23

How to define an abstract model:

Given M and , choose • Sh - a set of abstract states

• AP – a set of atomic propositions that label concrete and abstract states

• h : S Sh - a mapping from S on Sh that satisfies:

h(s) = h(t) only if L(s)=L(t)

Page 24: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

24

The abstract model Mh = ( Sh, Ih, Rh, Lh )

• sh Ih sI : h(s) = sh

• (sh,th) Rh

s,t [ h(s) = sh h(t) = th (s,t)R ]

• Lh(sh) = L(s) for some s where h(s) = sh

This is an exact abstraction

Page 25: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

25

An approximated abstraction

(an approximation )

• sh Ih sI : h(s) = sh

• (sh,th) Rh

s,t [ h(s) = sh h(t) = th (s,t)R ]

• Lh is as before

Notation: Mr – reduced (exact) Mh - approximated

Page 26: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

26

Logic preservation

• Mh (exact or approximated) has less states but more behaviors: Mh M therefore:

Theorem If is an ACTL/ACTL* specification over AP, then

Mh |= M |=

Page 27: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

27

Example

Program with one variable x over the integers

Initially x may be either 0 or 1

At any step, x may non-deterministically

either decrease or increase by 1

Page 28: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

28

Example (cont.)

Abstraction 1:Sh1 = { a–, a0, a+ }

a+ if s(x)>0

h1(s) = a0 if s(x)=0

a– if s(x)<0

Abstraction 2:Sh2 = { aeven, aodd }

h2(s) = if even( |s(x)| ) then aeven else aodd

Page 29: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

29

The concrete modelx=0 x=1

x=-1

x=-2 x=3

x=2

aeven aodd

Abstraction 2

a0

a+a–

Abstraction 1

Page 30: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

30

Types of Abstraction (Sh, h)

Localization reduction: each variable either keeps its concrete behavior or is fully abstracted (has free behavior) [Kurshan94]

Predicate abstraction: concrete states are grouped together according to the set of predicates they satisfy [GS97,SS99]

Data abstraction: the domain of each variable is abstracted into a small abstract domain [CGL94,LONG94]

Page 31: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

31

Depending on h and the size of M, Mh (I.e. Ih, Rh ) can be built using:

BDDs or

SAT solver or

Theorem prover

We later demonstrate such constructions

for specific types of abstractions

Page 32: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

32

Predicate abstraction

• Given a program over variables V• Predicate Pi is a first-order atomic

formula over VExamples: x+y < z2 , x=5

• Choose: AP = { P1,…,Pk } that includes– the atomic formulas in the property and– conditions in if, while statements of the

program

Page 33: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

33

• Labeling of concrete states:

L(s) = { Pi | s |= Pi }

Page 34: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

34

Abstract model

• Abstract states are defined over Boolean variables { B1,...,Bk }:Sh { 0,1 }k

• h(s) = sh for all 1jk : [ s |= Pj sh |= Bj ]

• Lh(sh) = { Pj | sh |= Bj }

Page 35: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

35

Example

Program over natural variables x, yAP = { P1, P2, P3 } where

P1 = x≤1 , P2 = x>y , P3 = y=2AP = { x≤1 , x>y , y=2 }

L((0,0)) = L((1,1)) = L(0,1)) = { P1 }

L((0,2)) = L((1,2)) = { P1, P3 }

L((2,0)) = { P2 }

Page 36: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

36

Sh { 0,1 }3

h((0,0)) = L((1,1)) = L(0,1)) = (1,0,0)h((0,2)) = L((1,2)) = (1,0,1)h((2,0)) = (0,1,0)No concrete state is mapped to (1,1,1)

Lh((1,0,0)) = { P1 }Lh((1,0,1)) = { P1, P3 }The concrete state and its abstract state are

labeled identically

(sh,th) Rh s,t [ h(s) = sh h(t) = th (s,t)R ]

Page 37: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

37

Computing Rh (same example)

• Program with one statement: x := x+1

Page 38: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

38

( (b1,b2,b3) , (b’1,b’2,b’3) ) Rh xyx’y’ [ P1(x,y) b1

P2(x,y) b2

P3(x,y) b3

x’=x+1 y’=y P1( x’,y’ ) b’1

P2( x’,y’ ) b’2

P3( x’,y’ ) b’3 ]

Page 39: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

39

Computing Rh using BDDs

If the program is over finite, relatively small domains, use BDDs

We need BDDs for:• the concrete transition relation R

(possibly partitioned)• the abstraction mapping h

Rh is computed according to the formula above, using BDD operations

Page 40: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

40

Computing Rh using SAT or Theorem Prover

• If the program is over finite, relatively large domains, use SAT

• If the program is over infinite domains,use theorem prover

• Theorem prover and SAT solve the problem for each pair of states separately: |Sh|x|Sh| applications

Page 41: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

41

Computing Rh with SAT or Theorem Prover (example cont.)

• Given Sh = (1,0,0) th = (0,0,0)

• To determine if (sh, th) Rh , check:

xyx’y’ [ h((x,y)) = (1,0,0) h((x’,y’)) = (0,0,0)

((x,y),(x’y’))R ] xyx’y’ [ P1(x,y) P2(x,y) P3(x,y) x’=x+1 y’=y

P1(x’,y’) P2(x’,y’) P3(x’,y’) ]

Page 42: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

42

• Using BDDs, Rh is computed based on the concrete model M

• Using SAT or Theorem prover, Rh can be viewed as computed directly from the program text

• We later show a more direct construction from the program text

Page 43: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

43

Approximation

• For BDDs:Approximate the computation of Rh

For SAT and theorem prover:

• In case of check failure for a pair (sh,th), include the pair in Rh

Page 44: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

44

Data Abstraction

• Given a program over variables v1,…vn where vi is over a domain Di

• Program states (concrete) S = D1 x…x Dn

Choose for each vi:• an abstract domain Ai

• hi : Di Ai

Sh = A1 x…x An

Page 45: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

45

AP = { viA

=a | a Ai , i=1,…n }

where viA refers to the abstract value of vi

• h : S Sh is defined:h ((d1,…,dn)) = (a1,…,an) where ai = hi(di)

• L ((d1,…,dn)) ={ viA

=ai | hi(di) = ai , i=1,…,n }

• Lh ((a1,…,an)) ={ viA

=ai | i=1,…,n }

As before: L(s) = Lh (h(s))

Page 46: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

46

Constructing Mh from program text

we assume that the program is given by first order formulas • I(V) – describing the initial states• R(V, V’ ) – describing the transition

relation

whereV=( v1,...,vn ) and V'=( v1’,...,vn’ )

Page 47: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

47

Representing a program by formulas: example

program: k: x:=e k’

Formula R(x, pc, x’, pc’) : pc=k x’=e pc’=k’

Page 48: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

48

Representing a program by formulas: example (cont)

program: k: if x=0 then k1: x:=1 else k2: x:=x+1 k’

Formula R (x, pc, x’, pc’):( pc=k x=0 x’=x pc’ = k1) ( pc=k x 0 x’=x pc’ = k2) ( pc=k1 x’=1 pc’=k’) ( pc=k2 x’=x+1 pc’=k’)

Page 49: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

49

What does it mean for a formula to represent a model M?

I (V) and R (V, V’) represent (describe) the

model M=(S, I, R, L) as follows:

Let s=(d1,...dn), s’=(d1’,...,dn’)

s I I [vidi] = true

(s, s’) R R [vi di, vi’ di’ ] = true

Page 50: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

50

Notation:For a formula over variables v1, ...,vk [] (v1

A, ..., vkA) =

v1,...,vk ( h(v1)= v1A ... h(vk)= vk

A

(v1, ...,vk) )

Note: [I (V) ] and [R (V, V’)] are formulas over abstract variables

[I (V)] and [R (V, V’)] represent Mr

Page 51: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

51

Given first order formulas

I(V) and R(V, V’), representing the “program text”, we can construct

[I (V)] and [R (V, V’)], representing Mr

Page 52: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

52

Problem:Given [I (V) ] and [R (V, V’ )],

in order to determine if sr Ir, we need to find a state s I (a satisfying assignment for I(V)) so that h(s) = sr

Similarly, for (sr, tr) Rr we look for

a satisfying assignment for R (V, V’)

This is a difficult task due to the size and complexity of the two formulas

Page 53: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

53

Simplifying the formulas

For in negation normal form over basic predicates pi and pi, T() simplifies [] by “pushing” the existential quantifiers inward:

T(pi(v1,...,vn)) = [pi](v1A,...,vn

A)

T(pi(v1,...,vn)) = [pi](v1A,...,vn

A)

T(1 2) = T(1) T(2)

T(1 2) = T(1) T(2) (*)

(*) does not preserve equivalence

Page 54: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

54

Approximated model

Theorem: [] T() In particular, [I ] T(I ) and [R ] T(R )

Corollary:The approximation model Mh,defined by T(I ) and T(R ) satisfies:Mh Mr M by the simulation preorder

Page 55: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

55

Approximated model (cont.)

• Defined over the same set of abstract states as Mr

• Easier to compute since existential quantifiers are applied to simpler formulas

• Less precise: has more initial states an more transitions than Mr

Page 56: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

56

Computing approximation model from the text

• No need to construct formulas. The approximation model can be constructed directly from the program text

• The user should provide abstract predicates [pi] and [pi] for every basic action (assignment or condition) in the program

Page 57: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

57

Abstract predicates provided

by the user: Examplestatement: x := y+zpredicate p(x’,y,z): x’ = y+zA = {aeven, aodd }

[p](x’A,yA,zA) = { (aeven, aodd, aodd),

(aeven, aeven, aeven), (aodd, aodd, aeven), (aodd, aeven, aodd) }

[p](aeven, aodd, aodd) iff

x’,y,z ( h(x’) = aeven h(y) = aodd h(z)= aodd x’=y+z )

Page 58: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

58

Logic preservation Theorem

Theorem If is an ACTL/ACTL* specification over AP, then

Mh |= M |=

However, the reverse may not be

valid.

Page 59: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

59

Traffic Light Example

red

green

yellow

M

Property: =AG AF ¬ (state=red)

Abstraction function h maps green, yellow to go.

red

go

Mh

Mh |= M |=

Page 60: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

60

Traffic Light Example (Cont)

If the abstract model invalidates a specification, the actual model may still satisfy the specification.

Property: =AG AF (state=red)

M |= but Mh |=

red

green

yellow

red

go

M Mh Spurious Counterexample:

red,go,go, ...

Page 61: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

61

CounterExample-Guided Abstraction-Refinement (CEGAR)

Page 62: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

62

The CEGAR Methodology

Th is not spuriouscheck spurious

counterexample

Th

stop

Mh |=

generatecounterexample Th

Mh |=

model check

Mh

generate initialabstraction

M and

refinement

This spurious

Page 63: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

63

Refinement versus approximation

Remark:Refinement builds new Sh and h,

then recomputes Rh and Ih (exact or approximated)

Approximation uses the same Sh and h and just adds more transitions and initial states

Page 64: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

64

Assumptions for BDD-based implementation

• The concrete model M is finite but too big to directly apply model checking on

• R and I can be held as BDDs in memory, R possibly partitioned: R(V,V’) = i Ri (V, vi’ )

• h is held as a BDD over concrete and abstract states

CEGAR can also be implemented with SAT or Theorem Prover

Page 65: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

65

Generating the Initial Abstraction

If we use predicate abstraction then predicates are extracted from the program’s control flow and the checked property

If we use localization reduction then the unabstracted variables are those appearing in the predicates above

Page 66: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

66

Example

init(x) := 0next(x) := case

: 0; : x + 1; : 0;else : x;

esac;

init(y) := 1;next(y) := case

: 0; ¬ : y + 1; : 0;else : y;

esac;

reset=TRUE reset=TRUEx < y y=2x=y

x = yx = y

reset=TRUE reset=TRUEx < y x=y

x = yx = yy=2

= AF x=yAP = { reset=TRUE, x<y, x=y, y=2 }

Page 67: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

67

Model Check The Abstract Model

Given the abstract model Mh

If Mh | , then the model checker

generates a counterexample trace (Th)

Most current model checkers generate paths or loops

Question : is Th spurious?

Page 68: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

68

Counterexamples

• For AGp it is a path to a state satisfying p

• For AFp it is a infinite path represented by a path+loop, where all states satisfy p

On the other hand,• For EFp we need to return the whole

computation tree (the whole model)

Page 69: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

69

Path Counterexample

Assume that we have four abstract states {1,2,3} {4,5,6} {7,8,9} {10,11,12}

Abstract counterexample Th= , , ,

therefore, M |= Th is not spurious,

Page 70: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

70

Spurious Path Counterexample

Th is spurious

failure state The concrete states mapped to the failure state are partitioned into 3 sets

dead-end bad irrelevantyes no nono yes no

statesreachableout edges

Page 71: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

71

Refining The Abstraction

Goal : refine h so that the dead-end states and bad states do not belong to the same abstract state.

For this example, two possible solutions.

Page 72: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

72

Computing a Concrete Counterexample from an Abstract

oneLet T = (a1,…an) be a path abstract

counterexampleh-1(a) = { s | h(s) = a }

The set of concrete counterexamples corresponding to T:

h-1(T) = { (s1,…sn) | i h(si)=ai I(s1)

iR(si,si+1) }

Page 73: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

73

BDD-based computation of h-1(a1),…, h-1(an)

S1 = h-1(a1) I

For i = 2,…,n do Si = Image(Si-1) h-1(ai)

if Si= then

dead-end := Si-1

return(i-1, dead-end)print (“counterexample exists”) Return (S1,…,Sn)

Page 74: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

74

Computing a concrete counterexample

from S1,…,Sn

tn = choose (Sn)

For i = n-1 to 1

ti = choose ( predecessors(ti+1) Si )

Return ( (t1,…,tn) )

Page 75: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

75

Remark:

• If h(si) = ai then for every atomic formula f, si |= f a |= f

• In particular, if an |= p then sn |= p

• Therefore, if (a1,…an) is an abstract counterexample then (s1,…sn) is a concrete counterexample

Page 76: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

76

Refining the abstraction

• Refinement separates dead-end states from bad states, thus, eliminating the spurious transition from Si-1 to Si

Page 77: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

77

Implementing CEGAR

With BDDs:• The concrete model M is finite but too big to

directly apply model checking on• R and I can be held as BDDs in memory, R

possibly partitioned: R(V,V’) = i Ri (V, vi’)

• h is held as BDD over concrete and abstract states

Can also be implemented with SAT or Theorem Prover

Page 78: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

78

Conclusion

• We defined several types of abstractions

• We showed how to extract them from the concrete model or from the program text

• We presented the CEGAR framework for abstraction-refinement

• We considered several possible implementations

Page 79: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

79

More on abstraction

• 3-valued and even multi-valued abstraction

• Static analysis for computing abstract models directly from program text

• Abstract interpretation:Instead of h: : 2S -> Sh

: Sh -> 2S

Page 80: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

80

THE END

Page 81: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

81

• BDDs:R. E. Bryant, Graph-based Algorithms for Boolean Function Manipulation, IEEE transactions on Computers, 1986

• BDD-based model checking:J.R. Burch, E.M. Clarke, K.L. McMillan, D.L. Dill, L.J. Hwang, Symbolic Model Checking: 10^20 States and Beyond, LICS’90

• SAT-based Bounded model checking:Symbolic model checking using SAT procedures instead of BDDs, A. Biere, A. Cimatti, E. M. Clarke, M. Fujita, Y. Zhu, DAC'99

Page 82: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

82

• Existential abstraction + data abstraction:E. M. Clarke, O. Grumberg, D. E. Long, Model Checking and Abstraction, TOPLAS, 1994.

• Localization reduction:R. P. Kurshan, Computer-Aided Verification of coordinating processes – the automata theoretic approach, 1994

Page 83: 1 Model Checking, Abstraction- Refinement, and Their Implementation Orna Grumberg Verification seminar March 2006.

83

• Predicate abstraction:S. Graf and H. Saidi, Construction of abstract state graphs with PVS, CAV’97

H. Saidi and N. Shankar, Abstract and Model Check while you Prove, CAV’99

• BDD-based CEGAR:Clarke, Grumberg, Jha, Lu, Veith, Counterexample-guided Abstraction Refinement, CAV2000, JACM2003