• Non ci sono risultati.

Introduction to Formal Methods Chapter 10: Abstraction in Model Checking

N/A
N/A
Protected

Academic year: 2021

Condividi "Introduction to Formal Methods Chapter 10: Abstraction in Model Checking"

Copied!
123
0
0

Testo completo

(1)

Introduction to Formal Methods

Chapter 10: Abstraction in Model Checking

Roberto Sebastiani

DISI, Università di Trento, Italy – roberto.sebastiani@unitn.it URL: http://disi.unitn.it/rseba/DIDATTICA/fm2020/

Teaching assistant: Enrico Magnago – enrico.magnago@unitn.it

CDLM in Informatica, academic year 2019-2020

last update: Monday 18thMay, 2020, 14:49

Copyright notice: some material (text, figures) displayed in these slides is courtesy of R. Alur, M. Benerecetti, A. Cimatti, M.

Di Natale, P. Pandya, M. Pistore, M. Roveri, and S.Tonetta, who detain its copyright. Some exampes displayed in these slides are taken from [Clarke, Grunberg & Peled, “Model Checking”, MIT Press], and their copyright is detained by the authors. All the other material is copyrighted by Roberto Sebastiani. Every commercial use of this material is strictly forbidden by the copyright laws without the authorization of the authors. No copy of these slides can be displayed in public

without containing this copyright notice.

th

(2)

Outline

1 Abstraction

2 Abstraction-Based Symbolic Model Cheching Abstraction

Checking the counter-examples Refinement

3 Exercises

th

(3)

Abstraction

Outline

1 Abstraction

2 Abstraction-Based Symbolic Model Cheching Abstraction

Checking the counter-examples Refinement

3 Exercises

th

(4)

Abstraction

Model Checking Safety Properties: M |= AG¬BAD

Add reachable states until reaching a fixed-point or a “bad” state

S11

S12

S13

S21

S22

S23

S31

S32

S33

S41

S42

S43

S51

S52

S53

S61

S62

S63

Problem: too many states to handle! (even for symbolic MC)

th

(5)

Abstraction

Model Checking Safety Properties: M |= AG¬BAD

Add reachable states until reaching a fixed-point or a “bad” state

S11

S12

S13

S21

S22

S23

S31

S32

S33

S41

S42

S43

S51

S52

S53

S61

S62

S63

Problem: too many states to handle! (even for symbolic MC)

th

(6)

Abstraction

Model Checking Safety Properties: M |= AG¬BAD

Add reachable states until reaching a fixed-point or a “bad” state

S11

S12

S13

S21

S22

S23

S31

S32

S33

S41

S42

S43

S51

S52

S53

S61

S62

S63

Problem: too many states to handle! (even for symbolic MC)

th

(7)

Abstraction

Model Checking Safety Properties: M |= AG¬BAD

Add reachable states until reaching a fixed-point or a “bad” state

S11

S12

S13

S21

S22

S23

S31

S32

S33

S41

S42

S43

S51

S52

S53

S61

S62

S63

Problem: too many states to handle! (even for symbolic MC)

th

(8)

Abstraction

Model Checking Safety Properties: M |= AG¬BAD

Add reachable states until reaching a fixed-point or a “bad” state

S11

S12

S13

S21

S22

S23

S31

S32

S33

S41

S42

S43

S51

S52

S53

S61

S62

S63

Problem: too many states to handle! (even for symbolic MC)

th

(9)

Abstraction

Model Checking Safety Properties: M |= AG¬BAD

Add reachable states until reaching a fixed-point or a “bad” state

S11

S12

S13

S21

S22

S23

S31

S32

S33

S41

S42

S43

S51

S52

S53

S61

S62

S63

Problem: too many states to handle! (even for symbolic MC)

th

(10)

Abstraction

Model Checking Safety Properties: M |= AG¬BAD

Add reachable states until reaching a fixed-point or a “bad” state

S11

S12

S13

S21

S22

S23

S31

S32

S33

S41

S42

S43

S51

S52

S53

S61

S62

S63

Problem: too many states to handle! (even for symbolic MC)

th

(11)

Abstraction

Model Checking Safety Properties: M |= AG¬BAD

Add reachable states until reaching a fixed-point or a “bad” state

S11

S12

S13

S21

S22

S23

S31

S32

S33

S41

S42

S43

S51

S52

S53

S61

S62

S63

Problem: too many states to handle! (even for symbolic MC)

th

(12)

Abstraction

Model Checking Safety Properties: M |= AG¬BAD

Add reachable states until reaching a fixed-point or a “bad” state

S11

S12

S13

S21

S22

S23

S31

S32

S33

S41

S42

S43

S51

S52

S53

S61

S62

S63

Problem: too many states to handle! (even for symbolic MC)

th

(13)

Abstraction

Idea: Abstraction

Apply a (non-injective) Abstraction Function h to M

=⇒ Build an abstract (and much smaller) system M’

Ground System

Abstract System S11

S12

S13

S21

S22

S23

S31

S32

S33

S41

S42

S43

S51

S52

S53

S61

S62

S63

T1 T2 T3 T4 T5 T6

M

M’

h h h h h h

th

(14)

Abstraction

Abstraction & Refinement

Abstraction & Refinement

Let S be the ground (concrete) state space Let S 0 be the abstract state space

Abstraction: a (typically non-injective) map h : S 7−→ S 0 h typically a many-to-one function

Refinement: a map r : S 0 7−→ 2 S s.t. r (s 0 )

def

= {s ∈ S | s 0 = h(s)}

th

(15)

Abstraction

Simulation and Bisimulation

Simulation

Let M 1

def

= hS 1 , I 1 , R 1 , AP 1 , L 1 i and M 2

def

= hS 2 , I 2 , R 2 , AP 2 , L 2 i. Then p ⊆ S 1 × S 2 is a simulation between M 1 and M 2 iff

for every s 2 ∈ I 2 exists s 1 ∈ I 1 s.t. hs 1 , s 2 i ∈ p for every hs 1 , s 2 i ∈ p:

for every hs 2 , t 2 i ∈ R 2 , exists hs 1 , t 1 i ∈ R 1 s.t. ht 1 , t 2 i ∈ p

(Intuitively, for every transition in M 2 there is a corresponding transition in M 1 .) We say that M 1 simulates M 2 .

Example of p (spy game): “follower M 1 keeps escaper M 2 at eyesight” Bisimulation

P is a bisimulation between M and M 0 iff it is both a simulation between M and M 0 and between M 0 and M. We say that M and M 0 bisimulate each other.

th

(16)

Abstraction

Simulation and Bisimulation

Simulation

Let M 1

def

= hS 1 , I 1 , R 1 , AP 1 , L 1 i and M 2

def

= hS 2 , I 2 , R 2 , AP 2 , L 2 i. Then p ⊆ S 1 × S 2 is a simulation between M 1 and M 2 iff

for every s 2 ∈ I 2 exists s 1 ∈ I 1 s.t. hs 1 , s 2 i ∈ p for every hs 1 , s 2 i ∈ p:

for every hs 2 , t 2 i ∈ R 2 , exists hs 1 , t 1 i ∈ R 1 s.t. ht 1 , t 2 i ∈ p

(Intuitively, for every transition in M 2 there is a corresponding transition in M 1 .) We say that M 1 simulates M 2 .

Example of p (spy game): “follower M 1 keeps escaper M 2 at eyesight”

Bisimulation

P is a bisimulation between M and M 0 iff it is both a simulation between M and M 0 and between M 0 and M. We say that M and M 0 bisimulate each other.

th

(17)

Abstraction

Simulation and Bisimulation

Simulation

Let M 1

def

= hS 1 , I 1 , R 1 , AP 1 , L 1 i and M 2

def

= hS 2 , I 2 , R 2 , AP 2 , L 2 i. Then p ⊆ S 1 × S 2 is a simulation between M 1 and M 2 iff

for every s 2 ∈ I 2 exists s 1 ∈ I 1 s.t. hs 1 , s 2 i ∈ p for every hs 1 , s 2 i ∈ p:

for every hs 2 , t 2 i ∈ R 2 , exists hs 1 , t 1 i ∈ R 1 s.t. ht 1 , t 2 i ∈ p

(Intuitively, for every transition in M 2 there is a corresponding transition in M 1 .) We say that M 1 simulates M 2 .

Example of p (spy game): “follower M 1 keeps escaper M 2 at eyesight”

Bisimulation

P is a bisimulation between M and M 0 iff it is both a simulation between M and M 0 and between M 0 and M. We say that M and M 0 bisimulate each other.

th

(18)

Abstraction

Example I

Ground System

Abstract System S11

S12

S13

S21

S22

S23

S31

S32

S33

S41

S42

S43

S51

S52

S53

S61

S62

S63

T1 T2 T3 T4 T5 T6

M

M’

Does M simulate M’?

No: e.g., no arc from S23 to any S3i.

Does M’ simulate M?

Yes

th

(19)

Abstraction

Example I

Ground System

Abstract System S11

S12

S13

S21

S22

S23

S31

S32

S33

S41

S42

S43

S51

S52

S53

S61

S62

S63

T1 T2 T3 T4 T5 T6

M

M’

Does M simulate M’?

No: e.g., no arc from S23 to any S3i. Does M’ simulate M?

Yes

th

(20)

Abstraction

Example I

Ground System

Abstract System S11

S12

S13

S21

S22

S23

S31

S32

S33

S41

S42

S43

S51

S52

S53

S61

S62

S63

T1 T2 T3 T4 T5 T6

M

M’

Does M simulate M’? No: e.g., no arc from S23 to any S3i.

Does M’ simulate M?

Yes

th

(21)

Abstraction

Example I

Ground System

Abstract System S11

S12

S13

S21

S22

S23

S31

S32

S33

S41

S42

S43

S51

S52

S53

S61

S62

S63

T1 T2 T3 T4 T5 T6

M

M’

Does M simulate M’? No: e.g., no arc from S23 to any S3i.

Does M’ simulate M?

Yes

th

(22)

Abstraction

Example I

Ground System

Abstract System S11

S12

S13

S21

S22

S23

S31

S32

S33

S41

S42

S43

S51

S52

S53

S61

S62

S63

T1 T2 T3 T4 T5 T6

M

M’

Does M simulate M’? No: e.g., no arc from S23 to any S3i.

Does M’ simulate M? Yes

th

(23)

Abstraction

Example II

Ground System

Abstract System S11

S12

S13

S21

S22

S23

S31

S32

S33

S41

S42

S43

S51

S52

S53

S61

S62

S63

T1 T2 T3 T4 T5 T6

M

M’

h h h h h h

Does M simulate M’?

Yes

Does M’ simulate M?

No: e.g., no arc from T 4 to T 3.

th

(24)

Abstraction

Example II

Ground System

Abstract System S11

S12

S13

S21

S22

S23

S31

S32

S33

S41

S42

S43

S51

S52

S53

S61

S62

S63

T1 T2 T3 T4 T5 T6

M

M’

h h h h h h

Does M simulate M’?

Yes Does M’ simulate M?

No: e.g., no arc from T 4 to T 3.

th

(25)

Abstraction

Example II

Ground System

Abstract System S11

S12

S13

S21

S22

S23

S31

S32

S33

S41

S42

S43

S51

S52

S53

S61

S62

S63

T1 T2 T3 T4 T5 T6

M

M’

h h h h h h

Does M simulate M’? Yes

Does M’ simulate M?

No: e.g., no arc from T 4 to T 3.

th

(26)

Abstraction

Example II

Ground System

Abstract System S11

S12

S13

S21

S22

S23

S31

S32

S33

S41

S42

S43

S51

S52

S53

S61

S62

S63

T1 T2 T3 T4 T5 T6

M

M’

h h h h h h

Does M simulate M’? Yes Does M’ simulate M?

No: e.g., no arc from T 4 to T 3.

th

(27)

Abstraction

Example II

Ground System

Abstract System S11

S12

S13

S21

S22

S23

S31

S32

S33

S41

S42

S43

S51

S52

S53

S61

S62

S63

T1 T2 T3 T4 T5 T6

M

M’

h h h h h h

Does M simulate M’? Yes

Does M’ simulate M? No: e.g., no arc from T 4 to T 3.

th

(28)

Abstraction

Example III

Ground System

Abstract System S11

S12

S13

S21

S22

S23

S31

S32

S33

S41

S42

S43

S51

S52

S53

S61

S62

S63

T1 T2 T3 T4 T5 T6

M

M’

h h h h h h

Does M simulate M’?

Yes

Does M’ simulate M?

Yes

th

(29)

Abstraction

Example III

Ground System

Abstract System S11

S12

S13

S21

S22

S23

S31

S32

S33

S41

S42

S43

S51

S52

S53

S61

S62

S63

T1 T2 T3 T4 T5 T6

M

M’

h h h h h h

Does M simulate M’?

Yes Does M’ simulate M?

Yes

th

(30)

Abstraction

Example III

Ground System

Abstract System S11

S12

S13

S21

S22

S23

S31

S32

S33

S41

S42

S43

S51

S52

S53

S61

S62

S63

T1 T2 T3 T4 T5 T6

M

M’

h h h h h h

Does M simulate M’? Yes

Does M’ simulate M?

Yes

th

(31)

Abstraction

Example III

Ground System

Abstract System S11

S12

S13

S21

S22

S23

S31

S32

S33

S41

S42

S43

S51

S52

S53

S61

S62

S63

T1 T2 T3 T4 T5 T6

M

M’

h h h h h h

Does M simulate M’? Yes Does M’ simulate M?

Yes

th

(32)

Abstraction

Example III

Ground System

Abstract System S11

S12

S13

S21

S22

S23

S31

S32

S33

S41

S42

S43

S51

S52

S53

S61

S62

S63

T1 T2 T3 T4 T5 T6

M

M’

h h h h h h

Does M simulate M’? Yes Does M’ simulate M? Yes

th

(33)

Abstraction

Existential Abstraction (Over-Approximation)

An Abstraction from M to M’ is an Existential Abstraction (aka Over-Approximation) iff M 0 simulates M

Ground System

Abstract System S11

S12

S13

S21

S22

S23

S31

S32

S33

S41

S42

S43

S51

S52

S53

S61

S62

S63

T1 T2 T3 T4 T5 T6

M

M’

th

(34)

Abstraction

Model Checking with Existential Abstractions

Preservation Theorem

Let ϕ be a universally-quantified property (e.g., in LTL or ACTL) Let M 0 simulate M

Then we have that

M 0 |= ϕ =⇒ M |= ϕ

Intuition: if M has a countermodel, then M’ simulates it The converse does not hold

M |= ϕ 6=⇒ M 0 |= ϕ

=⇒ The abstract counter-example may be spurious

(e.g., in previous figure, T 1 → T 2 → T 3 → T 4 → T 5 → T 6)

th

(35)

Abstraction

Model Checking with Existential Abstractions

Preservation Theorem

Let ϕ be a universally-quantified property (e.g., in LTL or ACTL) Let M 0 simulate M

Then we have that

M 0 |= ϕ =⇒ M |= ϕ

Intuition: if M has a countermodel, then M’ simulates it

The converse does not hold

M |= ϕ 6=⇒ M 0 |= ϕ

=⇒ The abstract counter-example may be spurious

(e.g., in previous figure, T 1 → T 2 → T 3 → T 4 → T 5 → T 6)

th

(36)

Abstraction

Model Checking with Existential Abstractions

Preservation Theorem

Let ϕ be a universally-quantified property (e.g., in LTL or ACTL) Let M 0 simulate M

Then we have that

M 0 |= ϕ =⇒ M |= ϕ

Intuition: if M has a countermodel, then M’ simulates it The converse does not hold

M |= ϕ 6=⇒ M 0 |= ϕ

=⇒ The abstract counter-example may be spurious

(e.g., in previous figure, T 1 → T 2 → T 3 → T 4 → T 5 → T 6)

th

(37)

Abstraction

Model Checking with Existential Abstractions

Preservation Theorem

Let ϕ be a universally-quantified property (e.g., in LTL or ACTL) Let M 0 simulate M

Then we have that

M 0 |= ϕ =⇒ M |= ϕ

Intuition: if M has a countermodel, then M’ simulates it The converse does not hold

M |= ϕ 6=⇒ M 0 |= ϕ

=⇒ The abstract counter-example may be spurious

(e.g., in previous figure, T 1 → T 2 → T 3 → T 4 → T 5 → T 6)

th

(38)

Abstraction

Universal Abstraction (Under-Approximation)

An Abstraction from M to M’ is an Universal Abstraction (aka Under-Approximation) iff M simulates M 0

Ground System

Abstract System S11

S12

S13

S21

S22

S23

S31

S32

S33

S41

S42

S43

S51

S52

S53

S61

S62

S63

T1 T2 T3 T4 T5 T6

M

M’

h h h h h h

th

(39)

Abstraction

Model Checking with Universal Abstractions

Preservation Theorem

Let ϕ be a existentially-quantified property (e.g., in ECTL) Let M simulate M 0

Then we have that

M 0 |= ϕ =⇒ M |= ϕ

Intuition: if M’ has a model, then M simulates it The converse does not hold

M 0 6|= ϕ 6=⇒ M 6|= ϕ

Note: here the authors use “M |= ϕ” as “there exists a path of M verifying ϕ”, so that M 6|= ¬ϕ ⇐⇒ M |= ϕ

th

(40)

Abstraction

Model Checking with Universal Abstractions

Preservation Theorem

Let ϕ be a existentially-quantified property (e.g., in ECTL) Let M simulate M 0

Then we have that

M 0 |= ϕ =⇒ M |= ϕ Intuition: if M’ has a model, then M simulates it

The converse does not hold

M 0 6|= ϕ 6=⇒ M 6|= ϕ

Note: here the authors use “M |= ϕ” as “there exists a path of M verifying ϕ”, so that M 6|= ¬ϕ ⇐⇒ M |= ϕ

th

(41)

Abstraction

Model Checking with Universal Abstractions

Preservation Theorem

Let ϕ be a existentially-quantified property (e.g., in ECTL) Let M simulate M 0

Then we have that

M 0 |= ϕ =⇒ M |= ϕ

Intuition: if M’ has a model, then M simulates it The converse does not hold

M 0 6|= ϕ 6=⇒ M 6|= ϕ

Note: here the authors use “M |= ϕ” as “there exists a path of M verifying ϕ”, so that M 6|= ¬ϕ ⇐⇒ M |= ϕ

th

(42)

Abstraction

Bisimulation Abstraction

An Abstraction from M to M’ is a Bisimulation Abstraction iff M simulates M 0 and M 0 simulates M

Ground System

Abstract System S11

S12

S13

S21

S22

S23

S31

S32

S33

S41

S42

S43

S51

S52

S53

S61

S62

S63

T1 T2 T3 T4 T5 T6

M

M’

h h h h h h

th

(43)

Abstraction

Model Checking with Bisimulation Abstractions

Preservation Theorem

Let ϕ be any CTL/LTL property Let M simulate M 0 and M 0 simulate M Then we have that

M 0 |= ϕ ⇐⇒ M |= ϕ

th

(44)

Abstraction-Based Symbolic Model Cheching

Outline

1 Abstraction

2 Abstraction-Based Symbolic Model Cheching Abstraction

Checking the counter-examples Refinement

3 Exercises

th

(45)

Abstraction-Based Symbolic Model Cheching

Counter-Example Guided Abstraction Refinement - CEGAR

GENERAL SCHEMA:

Model Checking

M,p,h

M’,p Spurious

No

counter example

h’

M 6|= p M |= p

Yes: Real:

Check

Abstraction Refinement

Counterex.

th

(46)

Abstraction-Based Symbolic Model Cheching Abstraction

Outline

1 Abstraction

2 Abstraction-Based Symbolic Model Cheching Abstraction

Checking the counter-examples Refinement

3 Exercises

th

(47)

Abstraction-Based Symbolic Model Cheching Abstraction

Counter-Example Guided Abstraction Refinement

GENERAL SCHEMA:

Model Checking

M,p,h

M’,p Spurious

No

counter example

h’

M 6|= p M |= p

Yes: Real:

Check

Abstraction Refinement

Counterex.

th

(48)

Abstraction-Based Symbolic Model Cheching Abstraction

Counter-Example Guided Abstraction Refinement

GENERAL SCHEMA:

Model Checking

M,p,h

M’,p Spurious

No

counter example

h’

M 6|= p M |= p

Yes: Real:

Check

Abstraction Refinement

Counterex.

th

(49)

Abstraction-Based Symbolic Model Cheching Abstraction

A Popular Abstraction for Symbolic MC of AG¬BAD I

A.k.a. “Localization Reduction”

Partition Boolean variables into visible (V) and invisible (I) ones The abstract model built on visible variables only.

Invisible variables are made inputs (no updates in the transition relation)

All variables occurring in “¬BAD” must be visible

The abstraction function maps each state to its projection over V.

=⇒ Group ground states with same visible part to a single abstract state.

visible invisible x 1 x 2 x 3 x 4 S 11 : 0 0 0 0 S 12 : 0 0 0 1 S 13 : 0 0 1 0 S 14 : 0 0 1 1

=⇒ 

T 1 : 0 0 

th

(50)

Abstraction-Based Symbolic Model Cheching Abstraction

A Popular Abstraction for Symbolic MC of AG¬BAD I

A.k.a. “Localization Reduction”

Partition Boolean variables into visible (V) and invisible (I) ones The abstract model built on visible variables only.

Invisible variables are made inputs (no updates in the transition relation)

All variables occurring in “¬BAD” must be visible

The abstraction function maps each state to its projection over V.

=⇒ Group ground states with same visible part to a single abstract state.

visible invisible x 1 x 2 x 3 x 4 S 11 : 0 0 0 0 S 12 : 0 0 0 1 S 13 : 0 0 1 0 S 14 : 0 0 1 1

=⇒ 

T 1 : 0 0 

th

(51)

Abstraction-Based Symbolic Model Cheching Abstraction

A Popular Abstraction for Symbolic MC of AG¬BAD I

A.k.a. “Localization Reduction”

Partition Boolean variables into visible (V) and invisible (I) ones The abstract model built on visible variables only.

Invisible variables are made inputs (no updates in the transition relation)

All variables occurring in “¬BAD” must be visible

The abstraction function maps each state to its projection over V.

=⇒ Group ground states with same visible part to a single abstract state.

visible invisible x 1 x 2 x 3 x 4 S 11 : 0 0 0 0 S 12 : 0 0 0 1 S 13 : 0 0 1 0 S 14 : 0 0 1 1

=⇒ 

T 1 : 0 0 

th

(52)

Abstraction-Based Symbolic Model Cheching Abstraction

A Popular Abstraction for Symbolic MC of AG¬BAD II

M’ can be computed efficiently if M is in functional form (e.g. sequential circuits).

next(x 1 ) := f 1 (x 1 , x 2 , x 3 , x 4 ) next(x 2 ) := f 2 (x 1 , x 2 , x 3 , x 4 ) next(x 3 ) := f 3 (x 1 , x 2 , x 3 , x 4 ) next(x 4 ) := f 4 (x 1 , x 2 , x 3 , x 4 )

=⇒

 next(x 1 ) := f 1 (x 1 , x 2 , x 3 , x 4 ) next(x 2 ) := f 2 (x 1 , x 2 , x 3 , x 4 )



Note: The next values of invisible variables, next(x 3 ) and next(x 4 ), can assume every value nondeterministically

=⇒ do not constrain the transition relation

Since M 0 obviously simulates M, this is an Existential Abstraction M 0 |= ϕ =⇒ M |= ϕ

may produce spurious counter-examples

th

(53)

Abstraction-Based Symbolic Model Cheching Abstraction

A Popular Abstraction for Symbolic MC of AG¬BAD II

M’ can be computed efficiently if M is in functional form (e.g. sequential circuits).

next(x 1 ) := f 1 (x 1 , x 2 , x 3 , x 4 ) next(x 2 ) := f 2 (x 1 , x 2 , x 3 , x 4 ) next(x 3 ) := f 3 (x 1 , x 2 , x 3 , x 4 ) next(x 4 ) := f 4 (x 1 , x 2 , x 3 , x 4 )

=⇒

 next(x 1 ) := f 1 (x 1 , x 2 , x 3 , x 4 ) next(x 2 ) := f 2 (x 1 , x 2 , x 3 , x 4 )



Note: The next values of invisible variables, next(x 3 ) and next(x 4 ), can assume every value nondeterministically

=⇒ do not constrain the transition relation

Since M 0 obviously simulates M, this is an Existential Abstraction M 0 |= ϕ =⇒ M |= ϕ

may produce spurious counter-examples

th

(54)

Abstraction-Based Symbolic Model Cheching Abstraction

A Popular Abstraction for Symbolic MC of AG¬BAD II

M’ can be computed efficiently if M is in functional form (e.g. sequential circuits).

next(x 1 ) := f 1 (x 1 , x 2 , x 3 , x 4 ) next(x 2 ) := f 2 (x 1 , x 2 , x 3 , x 4 ) next(x 3 ) := f 3 (x 1 , x 2 , x 3 , x 4 ) next(x 4 ) := f 4 (x 1 , x 2 , x 3 , x 4 )

=⇒

 next(x 1 ) := f 1 (x 1 , x 2 , x 3 , x 4 ) next(x 2 ) := f 2 (x 1 , x 2 , x 3 , x 4 )



Note: The next values of invisible variables, next(x 3 ) and next(x 4 ), can assume every value nondeterministically

=⇒ do not constrain the transition relation

Since M 0 obviously simulates M, this is an Existential Abstraction M 0 |= ϕ =⇒ M |= ϕ

may produce spurious counter-examples

th

(55)

Abstraction-Based Symbolic Model Cheching Abstraction

A Popular Abstraction for Symbolic MC of AG¬BAD II

M’ can be computed efficiently if M is in functional form (e.g. sequential circuits).

next(x 1 ) := f 1 (x 1 , x 2 , x 3 , x 4 ) next(x 2 ) := f 2 (x 1 , x 2 , x 3 , x 4 ) next(x 3 ) := f 3 (x 1 , x 2 , x 3 , x 4 ) next(x 4 ) := f 4 (x 1 , x 2 , x 3 , x 4 )

=⇒

 next(x 1 ) := f 1 (x 1 , x 2 , x 3 , x 4 ) next(x 2 ) := f 2 (x 1 , x 2 , x 3 , x 4 )



Note: The next values of invisible variables, next(x 3 ) and next(x 4 ), can assume every value nondeterministically

=⇒ do not constrain the transition relation

Since M 0 obviously simulates M, this is an Existential Abstraction M 0 |= ϕ =⇒ M |= ϕ

may produce spurious counter-examples

th

(56)

Abstraction-Based Symbolic Model Cheching Checking the counter-examples

Outline

1 Abstraction

2 Abstraction-Based Symbolic Model Cheching Abstraction

Checking the counter-examples Refinement

3 Exercises

th

(57)

Abstraction-Based Symbolic Model Cheching Checking the counter-examples

Counter-Example Guided Abstraction Refinement

GENERAL SCHEMA:

Model Checking

M,p,h

M’,p Spurious

No

counter example

h’

M 6|= p M |= p

Yes: Real:

Check

Abstraction Refinement

Counterex.

th

(58)

Abstraction-Based Symbolic Model Cheching Checking the counter-examples

Counter-Example Guided Abstraction Refinement

GENERAL SCHEMA:

Model Checking

M,p,h

M’,p Spurious

No

counter example

h’

M 6|= p M |= p

Yes: Real:

Check

Abstraction Refinement

Counterex.

th

(59)

Abstraction-Based Symbolic Model Cheching Checking the counter-examples

Checking the Abstract Counter-Example I

The problem

Let c 0 , ..., c m counter-example in the abstract space Note: each c i is a truth assignment on the visible variables Problem: check if there exist a corresponding ground counterexample s 0 , ..., s m s.t. c i = h(s i ), for every i

th

(60)

Abstraction-Based Symbolic Model Cheching Checking the counter-examples

Checking the Abstract Counter-Example II

Idea

Simulate the counterexample on the concrete model Use Bounded Model Checking:

Φ

def

= I(s 0 ) ∧

m−1

^

i=0

R(s i , s i+1 ) ∧

m

^

i=0

visible(s i ) = c i

If satisfiable, the counter example is real, otherwise it is spurious

Note: much more efficient than the direct BMC problem:

Φ =

def

I(s 0 ) ∧

m−1

^

i=0

R(s i , s i+1 ) ∧

m

_

i=0

¬BAD i

=⇒ cuts a 2 (m+1)·|V | factor from the Boolean search space.

th

(61)

Abstraction-Based Symbolic Model Cheching Checking the counter-examples

Checking the Abstract Counter-Example II

Idea

Simulate the counterexample on the concrete model Use Bounded Model Checking:

Φ

def

= I(s 0 ) ∧

m−1

^

i=0

R(s i , s i+1 ) ∧

m

^

i=0

visible(s i ) = c i

If satisfiable, the counter example is real, otherwise it is spurious Note: much more efficient than the direct BMC problem:

Φ

def

= I(s 0 ) ∧

m−1

^

i=0

R(s i , s i+1 ) ∧

m

_

i=0

¬BAD i

=⇒ cuts a 2 (m+1)·|V | factor from the Boolean search space.

th

(62)

Abstraction-Based Symbolic Model Cheching Refinement

Outline

1 Abstraction

2 Abstraction-Based Symbolic Model Cheching Abstraction

Checking the counter-examples Refinement

3 Exercises

th

(63)

Abstraction-Based Symbolic Model Cheching Refinement

Counter-Example Guided Abstraction Refinement

GENERAL SCHEMA:

Model Checking

M,p,h

M’,p Spurious

No

counter example

h’

M 6|= p M |= p

Yes: Real:

Check

Abstraction Refinement

Counterex.

th

(64)

Abstraction-Based Symbolic Model Cheching Refinement

Counter-Example Guided Abstraction Refinement

GENERAL SCHEMA:

Model Checking

M,p,h

M’,p Spurious

No

counter example

h’

M 6|= p M |= p

Yes: Real:

Check

Abstraction Refinement

Counterex.

th

(65)

Abstraction-Based Symbolic Model Cheching Refinement

The cause of spurious counter-examples I

Problem

There is a state in the abstract counter-example (failure state) s.t. two different and un-connected kinds of ground states are mapped into it:

Deadend states: reachable states which do not allow to proceed along a refinement of the abstract counter-example

Bad states: un-reachable states which allow to proceed along a refinement of the abstract counter-example

th

(66)

Abstraction-Based Symbolic Model Cheching Refinement

The cause of spurious counter-examples II

For the spurious counter-example: T 1 → T 2 → T 3 → T 4 → T 5 → T 6

Ground System

Abstract System S11

S12

S13

S21

S22

S23

S31

S32

S33

S41

S42

S43

S51

S52

S53

S61

S62

S63

T1 T2 T3 T4 T5 T6

M

M’

th

(67)

Abstraction-Based Symbolic Model Cheching Refinement

The cause of spurious counter-examples II

For the spurious counter-example: T 1 → T 2 → T 3 → T 4 → T 5 → T 6

Ground System

Abstract System S11

S12

S13

S21

S22

S23

S31

S32

S33

S41

S42

S43

S51

S52

S53

S61

S62

S63

T1 T2 T3 T4 T5 T6

M

M’

failure state

th

(68)

Abstraction-Based Symbolic Model Cheching Refinement

The cause of spurious counter-examples II

For the spurious counter-example: T 1 → T 2 → T 3 → T 4 → T 5 → T 6

Ground System

Abstract System S11

S12

S13

S21

S22

S23

S31

S32

S33

S41

S42

S43

S51

S52

S53

S61

S62

S63

T1 T2 T3 T4 T5 T6

M

M’

deadend states

failure state

th

(69)

Abstraction-Based Symbolic Model Cheching Refinement

The cause of spurious counter-examples II

For the spurious counter-example: T 1 → T 2 → T 3 → T 4 → T 5 → T 6

Ground System

Abstract System S11

S12

S13

S21

S22

S23

S31

S32

S33

S41

S42

S43

S51

S52

S53

S61

S62

S63

T1 T2 T3 T4 T5 T6

M

M’

bad states deadend states

failure state

th

(70)

Abstraction-Based Symbolic Model Cheching Refinement

The cause of spurious counter-examples III

Problem

There is a state in the abstract counter-example (failure state) s.t. two different and un-connected kinds of ground states are mapped into it:

Deadend states: reachable states which do not allow to proceed along a refinement of the abstract counter-example

Bad states: un-reachable states which allow to proceed along a refinement of the abstract counter-example

Solution: Refine the abstraction function.

1. identify the failure state and its deadend and bad states 2. refine the abstraction function s.t. deadend and bad states are

mapped into different abstract state

th

(71)

Abstraction-Based Symbolic Model Cheching Refinement

The cause of spurious counter-examples III

Problem

There is a state in the abstract counter-example (failure state) s.t. two different and un-connected kinds of ground states are mapped into it:

Deadend states: reachable states which do not allow to proceed along a refinement of the abstract counter-example

Bad states: un-reachable states which allow to proceed along a refinement of the abstract counter-example

Solution: Refine the abstraction function.

1. identify the failure state and its deadend and bad states 2. refine the abstraction function s.t. deadend and bad states are

mapped into different abstract state

th

(72)

Abstraction-Based Symbolic Model Cheching Refinement

Identify the failure state and its deadend & bad states

The failure state is the state of maximum index f in the abstract counter-example s.t. the following formula is satisfiable:

Φ D

=

def

I(s 0 ) ∧

f −1

^

i=0

R(s i , s i+1 ) ∧

f

^

i=0

visible(s i ) = c i

The (restriction on index f of the) models of Φ D identify the deadend states {d 1 , ..., d k }

The bad states {b 1 , ..., b n } are identified by the (restriction on index f of the) models of the following formula:

Φ B

def

= R(s f , s f +1 ) ∧ visible(s f ) = c f ∧ visible(s f +1 ) = c f +1

th

(73)

Abstraction-Based Symbolic Model Cheching Refinement

Identify the failure state and its deadend & bad states

The failure state is the state of maximum index f in the abstract counter-example s.t. the following formula is satisfiable:

Φ D

=

def

I(s 0 ) ∧

f −1

^

i=0

R(s i , s i+1 ) ∧

f

^

i=0

visible(s i ) = c i

The (restriction on index f of the) models of Φ D identify the deadend states {d 1 , ..., d k }

The bad states {b 1 , ..., b n } are identified by the (restriction on index f of the) models of the following formula:

Φ B

def

= R(s f , s f +1 ) ∧ visible(s f ) = c f ∧ visible(s f +1 ) = c f +1

th

(74)

Abstraction-Based Symbolic Model Cheching Refinement

Identify the failure state and its deadend & bad states

The failure state is the state of maximum index f in the abstract counter-example s.t. the following formula is satisfiable:

Φ D

=

def

I(s 0 ) ∧

f −1

^

i=0

R(s i , s i+1 ) ∧

f

^

i=0

visible(s i ) = c i

The (restriction on index f of the) models of Φ D identify the deadend states {d 1 , ..., d k }

The bad states {b 1 , ..., b n } are identified by the (restriction on index f of the) models of the following formula:

Φ B

def

= R(s f , s f +1 ) ∧ visible(s f ) = c f ∧ visible(s f +1 ) = c f +1

th

(75)

Abstraction-Based Symbolic Model Cheching Refinement

Identify the failure state and its deadend & bad states

For the spurious counter-example: T 1 → T 2 → T 3 → T 4 → T 5 → T 6

Ground System

Abstract System S11

S12

S13

S21

S22

S23

S31

S32

S33

S41

S42

S43

S51

S52

S53

S61

S62

S63

T1 T2 T3 T4 T5 T6

M

M’

bad states deadend states

failure state

th

(76)

Abstraction-Based Symbolic Model Cheching Refinement

Refinement: separate deadend & bad states

The state separation problem

Input: sets D

def

= {d 1 , ..., d k } and B

def

= {b 1 , ..., b n } of states Output: (possibly smallest) set U ∈ I of invisible variables s.t.

∀d i ∈ D, ∀b j ∈ B, ∃u ∈ U s.t. d i (u) 6= b j (u)

=⇒ the truth values of U allow for separating each pair hd i , b j i

=⇒ The refinement h 0 is obtained by adding U to V.

th

(77)

Abstraction-Based Symbolic Model Cheching Refinement

Example

visible, invisible

x 1 x 2 x 3 x 4 x 5 x 6 x 7

d 1 0 1 0 0 1 0 1

d 2 0 1 0 1 1 1 0

b 1 0 1 0 1 1 1 1

b 2 0 1 0 0 0 0 1

differentiating d 1 , b 1 : make x 4 visible differentiating d 1 , b 2 : make x 5 visible differentiating d 2 , b 1 : make x 7 visible differentiating d 2 , b 2 : already different

=⇒ U = {x 4 , x 5 , x 7 }, h 0 keeps only x 6 invisible Goal: Keep U as small as possible!

th

(78)

Abstraction-Based Symbolic Model Cheching Refinement

Example

visible, invisible

x 1 x 2 x 3 x 4 x 5 x 6 x 7

d 1 0 1 0 0 1 0 1

d 2 0 1 0 1 1 1 0

b 1 0 1 0 1 1 1 1

b 2 0 1 0 0 0 0 1

differentiating d 1 , b 1 : make x 4 visible

differentiating d 1 , b 2 : make x 5 visible differentiating d 2 , b 1 : make x 7 visible differentiating d 2 , b 2 : already different

=⇒ U = {x 4 , x 5 , x 7 }, h 0 keeps only x 6 invisible Goal: Keep U as small as possible!

th

(79)

Abstraction-Based Symbolic Model Cheching Refinement

Example

visible, invisible

x 1 x 2 x 3 x 4 x 5 x 6 x 7

d 1 0 1 0 0 1 0 1

d 2 0 1 0 1 1 1 0

b 1 0 1 0 1 1 1 1

b 2 0 1 0 0 0 0 1

differentiating d 1 , b 1 : make x 4 visible differentiating d 1 , b 2 : make x 5 visible

differentiating d 2 , b 1 : make x 7 visible differentiating d 2 , b 2 : already different

=⇒ U = {x 4 , x 5 , x 7 }, h 0 keeps only x 6 invisible Goal: Keep U as small as possible!

th

(80)

Abstraction-Based Symbolic Model Cheching Refinement

Example

visible, invisible

x 1 x 2 x 3 x 4 x 5 x 6 x 7

d 1 0 1 0 0 1 0 1

d 2 0 1 0 1 1 1 0

b 1 0 1 0 1 1 1 1

b 2 0 1 0 0 0 0 1

differentiating d 1 , b 1 : make x 4 visible differentiating d 1 , b 2 : make x 5 visible differentiating d 2 , b 1 : make x 7 visible

differentiating d 2 , b 2 : already different

=⇒ U = {x 4 , x 5 , x 7 }, h 0 keeps only x 6 invisible Goal: Keep U as small as possible!

th

(81)

Abstraction-Based Symbolic Model Cheching Refinement

Example

visible, invisible

x 1 x 2 x 3 x 4 x 5 x 6 x 7

d 1 0 1 0 0 1 0 1

d 2 0 1 0 1 1 1 0

b 1 0 1 0 1 1 1 1

b 2 0 1 0 0 0 0 1

differentiating d 1 , b 1 : make x 4 visible differentiating d 1 , b 2 : make x 5 visible differentiating d 2 , b 1 : make x 7 visible differentiating d 2 , b 2 : already different

=⇒ U = {x 4 , x 5 , x 7 }, h 0 keeps only x 6 invisible Goal: Keep U as small as possible!

th

(82)

Abstraction-Based Symbolic Model Cheching Refinement

Example

visible, invisible

x 1 x 2 x 3 x 4 x 5 x 6 x 7

d 1 0 1 0 0 1 0 1

d 2 0 1 0 1 1 1 0

b 1 0 1 0 1 1 1 1

b 2 0 1 0 0 0 0 1

differentiating d 1 , b 1 : make x 4 visible differentiating d 1 , b 2 : make x 5 visible differentiating d 2 , b 1 : make x 7 visible differentiating d 2 , b 2 : already different

=⇒ U = {x 4 , x 5 , x 7 }, h 0 keeps only x 6 invisible

Goal: Keep U as small as possible!

th

(83)

Abstraction-Based Symbolic Model Cheching Refinement

Example

visible, invisible

x 1 x 2 x 3 x 4 x 5 x 6 x 7

d 1 0 1 0 0 1 0 1

d 2 0 1 0 1 1 1 0

b 1 0 1 0 1 1 1 1

b 2 0 1 0 0 0 0 1

differentiating d 1 , b 1 : make x 4 visible differentiating d 1 , b 2 : make x 5 visible differentiating d 2 , b 1 : make x 7 visible differentiating d 2 , b 2 : already different

=⇒ U = {x 4 , x 5 , x 7 }, h 0 keeps only x 6 invisible Goal: Keep U as small as possible!

th

(84)

Abstraction-Based Symbolic Model Cheching Refinement

Two separation methods

Separation based on Decision-Tree Learning Not optimal.

Polynomial.

ILP-based separation Minimal separating set.

Computationally expensive.

th

(85)

Abstraction-Based Symbolic Model Cheching Refinement

Separation with decision tree (Example)

Idea: expand the decision tree until no hd i , b j i pair belongs to set.

x 1 x 2 x 3 x 4 x 5 x 6 x 7

d 1 0 1 0 0 1 0 1

d 2 0 1 0 1 1 1 0

b 1 0 1 0 1 1 1 1

b 2 0 1 0 0 0 0 1

{d 1 , d 2 , b 1 , b 2 }

differentiating d 1 , b 1 : x 4 differentiating d 1 , b 2 : x 5

differentiating d 2 , b 1 : x 7

=⇒ U = {x 4 , x 5 , x 7 }

th

(86)

Abstraction-Based Symbolic Model Cheching Refinement

Separation with decision tree (Example)

Idea: expand the decision tree until no hd i , b j i pair belongs to set.

x 1 x 2 x 3 x 4 x 5 x 6 x 7

d 1 0 1 0 0 1 0 1

d 2 0 1 0 1 1 1 0

b 1 0 1 0 1 1 1 1

b 2 0 1 0 0 0 0 1

0 x 4 1

{d 1 , b 2 } {d 2 , b 1 } {d 1 , d 2 , b 1 , b 2 }

differentiating d 1 , b 1 : x 4

differentiating d 1 , b 2 : x 5

differentiating d 2 , b 1 : x 7

=⇒ U = {x 4 , x 5 , x 7 }

th

(87)

Abstraction-Based Symbolic Model Cheching Refinement

Separation with decision tree (Example)

Idea: expand the decision tree until no hd i , b j i pair belongs to set.

x 1 x 2 x 3 x 4 x 5 x 6 x 7

d 1 0 1 0 0 1 0 1

d 2 0 1 0 1 1 1 0

b 1 0 1 0 1 1 1 1

b 2 0 1 0 0 0 0 1

0 1

0 1

x 5

B

{b 2 } {d 1 } D

x 4

{d 1 , b 2 } {d 2 , b 1 } {d 1 , d 2 , b 1 , b 2 }

differentiating d 1 , b 1 : x 4 differentiating d 1 , b 2 : x 5

differentiating d 2 , b 1 : x 7

=⇒ U = {x 4 , x 5 , x 7 }

th

(88)

Abstraction-Based Symbolic Model Cheching Refinement

Separation with decision tree (Example)

Idea: expand the decision tree until no hd i , b j i pair belongs to set.

x 1 x 2 x 3 x 4 x 5 x 6 x 7

d 1 0 1 0 0 1 0 1

d 2 0 1 0 1 1 1 0

b 1 0 1 0 1 1 1 1

b 2 0 1 0 0 0 0 1

0 1

0 1

0 1

x 7

D {d 2 }

B {b 1 } x 5

B

{b 2 } {d 1 } D

x 4

{d 1 , b 2 } {d 2 , b 1 } {d 1 , d 2 , b 1 , b 2 }

differentiating d 1 , b 1 : x 4 differentiating d 1 , b 2 : x 5 differentiating d 2 , b 1 : x 7

=⇒ U = {x 4 , x 5 , x 7 }

th

(89)

Abstraction-Based Symbolic Model Cheching Refinement

Separation with 0-1 ILP

Idea

Encode the problem as a 0-1 ILP problem min X

x

k

∈I

v k , subject to : X

xk ∈I

d (x

k

)6=b(x

k

)

v k ≥ 1 ∀d ∈ D, ∀b ∈ B,

intuition: v k = > iff x k must me made visible one constraint for every pair hd i , b j i

th

(90)

Abstraction-Based Symbolic Model Cheching Refinement

Separation with 0-1 ILP: Example

x 1 x 2 x 3 x 4 x 5 x 6 x 7

d 1 0 1 0 0 1 0 1

d 2 0 1 0 1 1 1 0

b 1 0 1 0 1 1 1 1

b 2 0 1 0 0 0 0 1

min {v 4 + v 5 + v 6 + v 7 } subject to :

 

 

v 4 + v 6 ≥ 1 // separating d 1 , b 1 v 5 ≥ 1 // separating d 1 , b 2 v 7 ≥ 1 // separating d 2 , b 1 v 4 + v 5 + v 6 + v 7 ≥ 1 // separating d 2 , b 2

=⇒ return {v 4 , v 5 , v 7 } =⇒ U = {x 4 , x 5 , x 7 } or return {v 5 , v 6 , v 7 } =⇒ U = {x 5 , x 6 , x 7 }

th

(91)

Abstraction-Based Symbolic Model Cheching Refinement

Separation with 0-1 ILP: Example

x 1 x 2 x 3 x 4 x 5 x 6 x 7

d 1 0 1 0 0 1 0 1

d 2 0 1 0 1 1 1 0

b 1 0 1 0 1 1 1 1

b 2 0 1 0 0 0 0 1

min {v 4 + v 5 + v 6 + v 7 } subject to :

 

 

v 4 + v 6 ≥ 1 // separating d 1 , b 1 v 5 ≥ 1 // separating d 1 , b 2 v 7 ≥ 1 // separating d 2 , b 1 v 4 + v 5 + v 6 + v 7 ≥ 1 // separating d 2 , b 2

=⇒ return {v 4 , v 5 , v 7 } =⇒ U = {x 4 , x 5 , x 7 }

or return {v 5 , v 6 , v 7 } =⇒ U = {x 5 , x 6 , x 7 }

th

Riferimenti

Documenti correlati

[Alternatively: there is no positive U-subformula, so that we must add a AGAF> fairness condition, which is equivalent to say that all states belong to the fairness

Given the following generalized Büchi automaton A def = hQ, Σ, δ, I, FT i, with two sets of accepting states FT def = {F 1, F 2} s.t.. Ex:

From LTL Formulas to Büchi Automata: generalities On-the-fly construction of Bu¨chi Automata from LTL Complexity..

limited sensitivity: one good setting, does not require expert users much higher capacity (more variables) than BDD based techniques Various techniques: Bounded Model

all but one literals in η are as “old” as possible Learning: in future branches, when all-but-one literals in η are assigned, the remaining literal is assigned to false

Deadend states: reachable states which do not allow to proceed along a refinement of the abstract counter-example. Bad states: un-reachable states which allow to proceed along

=⇒ Substantially, add one initial state, move labels from states to incoming edges, set fair states as accepting states.. The Main Problem of M.C.: State

=⇒ It is reasonable enough to assume the protocol suitable under the condition that each user is infinitely often outside the restroom.. Such a condition is called