• Non ci sono risultati.

Formal Methods: Module II: Model Checking Ch. 07: SAT-Based Model Checking

N/A
N/A
Protected

Academic year: 2021

Condividi "Formal Methods: Module II: Model Checking Ch. 07: SAT-Based Model Checking"

Copied!
140
0
0

Testo completo

(1)

Formal Methods:

Module II: Model Checking

Ch. 07: SAT-Based Model Checking

Roberto Sebastiani

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

Teaching assistant:Giuseppe Spallitta– giuseppe.spallitta@unitn.it

M.S. in Computer Science, Mathematics, & Artificial Intelligence Systems Academic year 2020-2021

last update: Thursday 6thMay, 2021, 11:31

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, C. Tinelli, 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

(2)

Outline

1 SAT-based Model Checking: Generalities

2 Bounded Model Checking Intuitions

General Encoding Relevant Subcases An Example

Computing Upper Bounds Discussion

3 Inductive reasoning on invariants (aka “K-Induction”) K-Induction

An Example

4 Exercises

(3)

Outline

1 SAT-based Model Checking: Generalities

2 Bounded Model Checking Intuitions

General Encoding Relevant Subcases An Example

Computing Upper Bounds Discussion

3 Inductive reasoning on invariants (aka “K-Induction”) K-Induction

An Example

4 Exercises

(4)

SAT-based Model Checking

Key problems with BDD’s:

they can explode in space A possible alternative:

Propositional Satisfiability Checking (SAT) SAT technology is very advanced

Advantages:

reduced memory requirements

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

techniques

Various techniques:Bounded Model Checking (BMC), K-induction, Interpolant-based, IC3/PDR,...

(5)

SAT-based Model Checking

Key problems with BDD’s:

they can explode in space A possible alternative:

Propositional Satisfiability Checking (SAT) SAT technology is very advanced

Advantages:

reduced memory requirements

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

techniques

Various techniques:Bounded Model Checking (BMC), K-induction, Interpolant-based, IC3/PDR,...

(6)

SAT-based Model Checking

Key problems with BDD’s:

they can explode in space A possible alternative:

Propositional Satisfiability Checking (SAT) SAT technology is very advanced

Advantages:

reduced memory requirements

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

techniques

Various techniques:Bounded Model Checking (BMC), K-induction, Interpolant-based, IC3/PDR,...

(7)

SAT-based Model Checking

Key problems with BDD’s:

they can explode in space A possible alternative:

Propositional Satisfiability Checking (SAT) SAT technology is very advanced

Advantages:

reduced memory requirements

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

techniques

Various techniques:Bounded Model Checking (BMC), K-induction, Interpolant-based, IC3/PDR,...

(8)

SAT-based Bounded Model Checking & K-Induction

Key Ideas:

BMC:look for counter-example paths of increasing length k

=⇒ oriented to finding bugs

K-Induction: look for an induction proofs of increasing length k

=⇒ oriented to prove correctness

BMC [resp. K-induction]: for each k , build a Boolean formula that is satisfiable [resp. unsatisfiable] iff there is a counter-example [resp. proof] of length k

can be expressed using k · |s| variables

formula construction is not subject to state explosion

satisfiability of the Boolean formulas is checked by aSAT solver can manage complex formulae on several 100K variables returns satisfying assignment (i.e., a counter-example) exploit incrementality

(9)

SAT-based Bounded Model Checking & K-Induction

Key Ideas:

BMC:look for counter-example paths of increasing length k

=⇒ oriented to finding bugs

K-Induction: look for an induction proofs of increasing length k

=⇒ oriented to prove correctness

BMC [resp. K-induction]: for each k , build a Boolean formula that is satisfiable [resp. unsatisfiable] iff there is a counter-example [resp. proof] of length k

can be expressed using k · |s| variables

formula construction is not subject to state explosion

satisfiability of the Boolean formulas is checked by aSAT solver can manage complex formulae on several 100K variables returns satisfying assignment (i.e., a counter-example) exploit incrementality

(10)

SAT-based Bounded Model Checking & K-Induction

Key Ideas:

BMC:look for counter-example paths of increasing length k

=⇒ oriented to finding bugs

K-Induction: look for an induction proofs of increasing length k

=⇒ oriented to prove correctness

BMC [resp. K-induction]: for each k , build a Boolean formula that is satisfiable [resp. unsatisfiable] iff there is a counter-example [resp. proof] of length k

can be expressed using k · |s| variables

formula construction is not subject to state explosion

satisfiability of the Boolean formulas is checked by aSAT solver can manage complex formulae on several 100K variables returns satisfying assignment (i.e., a counter-example) exploit incrementality

(11)

SAT-based Bounded Model Checking & K-Induction

Key Ideas:

BMC:look for counter-example paths of increasing length k

=⇒ oriented to finding bugs

K-Induction: look for an induction proofs of increasing length k

=⇒ oriented to prove correctness

BMC [resp. K-induction]: for each k , build a Boolean formula that is satisfiable [resp. unsatisfiable] iff there is a counter-example [resp. proof] of length k

can be expressed using k · |s| variables

formula construction is not subject to state explosion

satisfiability of the Boolean formulas is checked by aSAT solver can manage complex formulae on several 100K variables returns satisfying assignment (i.e., a counter-example) exploit incrementality

(12)

Outline

1 SAT-based Model Checking: Generalities

2 Bounded Model Checking Intuitions

General Encoding Relevant Subcases An Example

Computing Upper Bounds Discussion

3 Inductive reasoning on invariants (aka “K-Induction”) K-Induction

An Example

4 Exercises

(13)

Outline

1 SAT-based Model Checking: Generalities

2 Bounded Model Checking Intuitions

General Encoding Relevant Subcases An Example

Computing Upper Bounds Discussion

3 Inductive reasoning on invariants (aka “K-Induction”) K-Induction

An Example

4 Exercises

(14)

Bounded Model Checking: Example

p q

1

2

3 4

p

LTL Formula: G(p → Fq)

Negated Formula (violation): F(p ∧ G¬q) k = 0:

1

p

No counter-example found.

(15)

Bounded Model Checking: Example

p q

1

2

3 4

p

LTL Formula: G(p → Fq)

Negated Formula (violation): F(p ∧ G¬q) k = 1:

1 2

p q

No counter-example found.

(16)

Bounded Model Checking: Example

p q

1

2

3 4

p

LTL Formula: G(p → Fq)

Negated Formula (violation): F(p ∧ G¬q) k = 2:

1 2 3

p q p

No counter-example found.

(17)

Bounded Model Checking: Example

p q

1

2

3 4

p

LTL Formula: G(p → Fq)

Negated Formula (violation): F(p ∧ G¬q) k = 3:

1 2 3 4

p q p

1 2 3 4

p q p

The 2nd trace is a counter-example!

(18)

Outline

1 SAT-based Model Checking: Generalities

2 Bounded Model Checking Intuitions

General Encoding Relevant Subcases An Example

Computing Upper Bounds Discussion

3 Inductive reasoning on invariants (aka “K-Induction”) K-Induction

An Example

4 Exercises

(19)

The problem [Biere et al, 1999]

Ingredients:

Assume states represented by an array s of n Boolean variables asystemwritten as a Kripke structureM := hI(s), R(s, s0)i aproperty f written as aLTL formula

an integerk ≥ 0(bound) Problem

Is there an execution path π of M of length k satisfying the temporal property f ?

M |=k Ef

Note: f is the negation of the property in the LTL model checking problem M |= ¬f , and π is a counter-example of length k (bug).

The check is repeated for increasing values of k = 0, 1, 2, 3, ...

(20)

The problem [Biere et al, 1999]

Ingredients:

Assume states represented by an array s of n Boolean variables asystemwritten as a Kripke structureM := hI(s), R(s, s0)i aproperty f written as aLTL formula

an integerk ≥ 0(bound) Problem

Is there an execution path π of M of length k satisfying the temporal property f ?

M |=k Ef

Note: f is the negation of the property in the LTL model checking problem M |= ¬f , and π is a counter-example of length k (bug).

The check is repeated for increasing values of k = 0, 1, 2, 3, ...

(21)

The problem [Biere et al, 1999]

Ingredients:

Assume states represented by an array s of n Boolean variables asystemwritten as a Kripke structureM := hI(s), R(s, s0)i aproperty f written as aLTL formula

an integerk ≥ 0(bound) Problem

Is there an execution path π of M of length k satisfying the temporal property f ?

M |=k Ef

Note: f is the negation of the property in the LTL model checking problem M |= ¬f , and π is a counter-example of length k (bug).

The check is repeated for increasing values of k = 0, 1, 2, 3, ...

(22)

The problem [Biere et al, 1999]

Ingredients:

Assume states represented by an array s of n Boolean variables asystemwritten as a Kripke structureM := hI(s), R(s, s0)i aproperty f written as aLTL formula

an integerk ≥ 0(bound) Problem

Is there an execution path π of M of length k satisfying the temporal property f ?

M |=k Ef

Note: f is the negation of the property in the LTL model checking problem M |= ¬f , and π is a counter-example of length k (bug).

The check is repeated for increasing values of k = 0, 1, 2, 3, ...

(23)

The encoding

Equivalent to the satisfiability problem of a Boolean formula [[M, f ]]k defined as follows:

[[M, f ]]k := [[M]]k ∧ [[f ]]k

[[M]]k := I(s0) ∧

k −1

^

i=0

R(si,si+1),

[[f ]]k :=

k

_

l=0

R(sk,sl) ∧ [[f ]]0k) ∨

k

_

l=0

(R(sk,sl) ∧ l[[f ]]0k),

The vectors of propositional variables is replicated k+1 times s0, s1, ..., sk

[[M]]k encodes the fact that the k -path is an execution of M [[f ]]k encodes the fact that the k -path satisfies f

(24)

The encoding

Equivalent to the satisfiability problem of a Boolean formula [[M, f ]]k defined as follows:

[[M, f ]]k := [[M]]k ∧ [[f ]]k

[[M]]k := I(s0) ∧

k −1

^

i=0

R(si,si+1),

[[f ]]k :=

k

_

l=0

R(sk,sl) ∧ [[f ]]0k) ∨

k

_

l=0

(R(sk,sl) ∧ l[[f ]]0k),

The vectors of propositional variables is replicated k+1 times s0, s1, ..., sk

[[M]]k encodes the fact that the k -path is an execution of M [[f ]]k encodes the fact that the k -path satisfies f

(25)

The encoding

Equivalent to the satisfiability problem of a Boolean formula [[M, f ]]k defined as follows:

[[M, f ]]k := [[M]]k ∧ [[f ]]k

[[M]]k := I(s0) ∧

k −1

^

i=0

R(si,si+1),

[[f ]]k :=

k

_

l=0

R(sk,sl) ∧ [[f ]]0k) ∨

k

_

l=0

(R(sk,sl) ∧ l[[f ]]0k),

The vectors of propositional variables is replicated k+1 times s0, s1, ..., sk

[[M]]k encodes the fact that the k -path is an execution of M [[f ]]k encodes the fact that the k -path satisfies f

(26)

The encoding

Equivalent to the satisfiability problem of a Boolean formula [[M, f ]]k defined as follows:

[[M, f ]]k := [[M]]k ∧ [[f ]]k

[[M]]k := I(s0) ∧

k −1

^

i=0

R(si,si+1),

[[f ]]k :=

k

_

l=0

R(sk,sl) ∧ [[f ]]0k) ∨

k

_

l=0

(R(sk,sl) ∧ l[[f ]]0k),

The vectors of propositional variables is replicated k+1 times s0, s1, ..., sk

[[M]]k encodes the fact that the k -path is an execution of M [[f ]]k encodes the fact that the k -path satisfies f

(27)

The Encoding [cont.]

The encoding for a formula f with k steps, [[f ]]k is the disjunction of The constraints needed to express a model without loopback:

(¬(Wk

l=0R(sk,sl)) ∧ [[f ]]0k)

S0 S1 Sl Sk−1 Sk

[[f ]]ik, i ∈ [0, k ]: encodes the fact that f holds in si under the assumption that s0, ...,sk is a no-loopback path

The constraints needed to express a given loopback, for all possible points of loopback:

Wk

l=0(R(sk,sl) ∧ l[[f ]]0k)

l[[f ]]ik, i ∈ [0, k ]: encodes the fact that f holds in si under the assumption that s0, ...,sk is a path with a loopback from sk to sl

(28)

The Encoding [cont.]

The encoding for a formula f with k steps, [[f ]]k is the disjunction of The constraints needed to express a model without loopback:

(¬(Wk

l=0R(sk,sl)) ∧ [[f ]]0k)

S0 S1 Sl Sk−1 Sk

[[f ]]ik, i ∈ [0, k ]: encodes the fact that f holds in si under the assumption that s0, ...,sk is a no-loopback path

The constraints needed to express a given loopback, for all possible points of loopback:

Wk

l=0(R(sk,sl) ∧ l[[f ]]0k)

l[[f ]]ik, i ∈ [0, k ]: encodes the fact that f holds in si under the assumption that s0, ...,sk is a path with a loopback from sk to sl

(29)

The Encoding [cont.]

The encoding for a formula f with k steps, [[f ]]k is the disjunction of The constraints needed to express a model without loopback:

(¬(Wk

l=0R(sk,sl)) ∧ [[f ]]0k)

S0 S1 Sl Sk−1 Sk

[[f ]]ik, i ∈ [0, k ]: encodes the fact that f holds in si under the assumption that s0, ...,sk is a no-loopback path

The constraints needed to express a given loopback, for all possible points of loopback:

Wk

l=0(R(sk,sl) ∧ l[[f ]]0k)

S0 S1 Sl Sk−1 Sk

l[[f ]]ik, i ∈ [0, k ]: encodes the fact that f holds in si under the assumption that s0, ...,sk is a path with a loopback from sk to sl

(30)

The Encoding of [[f ]]

ik

and

l

[[f ]]

ik

f [[f ]]ik l[[f ]]ik

p pi pi

¬p ¬pi ¬pi

h ∧ g [[h]]ik∧ [[g]]ik l[[h]]ik l[[g]]ik h ∨ g [[h]]ik∨ [[g]]ik l[[h]]ik l[[g]]ik Xg [[g]]i+1k if i < k

otherwise.

l[[g]]i+1k if i < k

l[[g]]lk otherwise.

Gg Vk

j=min(i,l) l[[g]]jk Fg Wk

j=i [[g]]jk Wk

j=min(i,l) l[[g]]jk hUg Wk

j=i



[[g]]jkVj−1 n=i [[h]]nk

Wk j=i



l[[g]]jkVj−1 n=i l[[h]]nk

Wi−1

j=l



l[[g]]jkVk

n=i l[[h]]nkVj−1 n=l l[[h]]nk hRg Wk

j=i



[[h]]jkVj

n=i [[g]]nk Vk

j=min(i,l) l[[g]]jk Wk

j=i



l[[h]]jkVj

n=i l[[g]]nk

Wi−1

j=l



l[[h]]jk Vk

n=i l[[g]]nkVj

n=l l[[g]]nk

(31)

Outline

1 SAT-based Model Checking: Generalities

2 Bounded Model Checking Intuitions

General Encoding Relevant Subcases An Example

Computing Upper Bounds Discussion

3 Inductive reasoning on invariants (aka “K-Induction”) K-Induction

An Example

4 Exercises

(32)

Relevant Subcase: Fp (reachability)

f :=Fp, s.t. p Boolean:

is there a reachable state in which p holds?

a finite path can show that the property holds [[M, f ]]k is:

I(s0) ∧

k −1

^

i=0

R(si,si+1) ∧

k

_

j=0

pj

s

0

s

1

s

k−1

s

k

−p −p −p p

Important: incremental encoding

if done for increasing value of k , then it suffices that [[M, f ]]k is:

I(s0) ∧Vk −1

i=0 R(si,si+1) ∧ ¬pi ∧ pk

(33)

Relevant Subcase: Fp (reachability)

f :=Fp, s.t. p Boolean:

is there a reachable state in which p holds?

a finite path can show that the property holds [[M, f ]]k is:

I(s0) ∧

k −1

^

i=0

R(si,si+1) ∧

k

_

j=0

pj

s

0

s

1

s

k−1

s

k

−p −p −p p

Important: incremental encoding

if done for increasing value of k , then it suffices that [[M, f ]]k is:

I(s0) ∧Vk −1

i=0 R(si,si+1) ∧ ¬pi ∧ pk

(34)

Relevant Subcase: Fp (reachability)

f :=Fp, s.t. p Boolean:

is there a reachable state in which p holds?

a finite path can show that the property holds [[M, f ]]k is:

I(s0) ∧

k −1

^

i=0

R(si,si+1) ∧

k

_

j=0

pj

s

0

s

1

s

k−1

s

k

−p −p −p p

Important: incremental encoding

if done for increasing value of k , then it suffices that [[M, f ]]k is:

I(s0) ∧Vk −1

i=0 R(si,si+1) ∧ ¬pi ∧ pk

(35)

Relevant Subcase: Fp (reachability)

f :=Fp, s.t. p Boolean:

is there a reachable state in which p holds?

a finite path can show that the property holds [[M, f ]]k is:

I(s0) ∧

k −1

^

i=0

R(si,si+1) ∧

k

_

j=0

pj

s

0

s

1

s

k−1

s

k

−p −p −p p

Important: incremental encoding

if done for increasing value of k , then it suffices that [[M, f ]]k is:

I(s0) ∧Vk −1

i=0 R(si,si+1) ∧ ¬pi ∧ pk

(36)

Relevant Subcase: Gp

f :=Gp, s.t. p Boolean: is there a path where p holds forever?

We need to produce an infinite behaviour, with a finite number of transitions

We can do it by imposing that the path loops back

s0 s1 sk−1 sk

p p p p

[[M, f ]]k is:

I(s0) ∧

k −1

^

i=0

R(si,si+1) ∧

k

_

l=0

R(sk,sl) ∧

k

^

j=0

pj

(37)

Relevant Subcase: Gp

f :=Gp, s.t. p Boolean: is there a path where p holds forever?

We need to produce an infinite behaviour, with a finite number of transitions

We can do it by imposing that the path loops back

s0 s1 sk−1 sk

p p p p

[[M, f ]]k is:

I(s0) ∧

k −1

^

i=0

R(si,si+1) ∧

k

_

l=0

R(sk,sl) ∧

k

^

j=0

pj

(38)

Relevant Subcase: Gp

f :=Gp, s.t. p Boolean: is there a path where p holds forever?

We need to produce an infinite behaviour, with a finite number of transitions

We can do it by imposing that the path loops back

s0 s1 sk−1 sk

p p p p

[[M, f ]]k is:

I(s0) ∧

k −1

^

i=0

R(si,si+1) ∧

k

_

l=0

R(sk,sl) ∧

k

^

j=0

pj

(39)

Relevant Subcase: Gp

f :=Gp, s.t. p Boolean: is there a path where p holds forever?

We need to produce an infinite behaviour, with a finite number of transitions

We can do it by imposing that the path loops back

s0 s1 sk−1 sk

p p p p

[[M, f ]]k is:

I(s0) ∧

k −1

^

i=0

R(si,si+1) ∧

k

_

l=0

R(sk,sl) ∧

k

^

j=0

pj

(40)

Relevant Subcase: GFq (fair states)

f :=GFq, s.t. q Boolean: does q hold infinitely often?

Again, we need to produce an infinite behaviour, with a finite number of transitions

s0 s1 sk−1 sk

q p

[[M, f ]]k is:

I(s0) ∧

k −1

^

i=0

R(si,si+1) ∧

k

_

l=0

R(sk,sl) ∧

k

_

j=l

qj

(41)

Relevant Subcase: GFq (fair states)

f :=GFq, s.t. q Boolean: does q hold infinitely often?

Again, we need to produce an infinite behaviour, with a finite number of transitions

s0 s1 sk−1 sk

q p

[[M, f ]]k is:

I(s0) ∧

k −1

^

i=0

R(si,si+1) ∧

k

_

l=0

R(sk,sl) ∧

k

_

j=l

qj

(42)

Relevant Subcase: GFq (fair states)

f :=GFq, s.t. q Boolean: does q hold infinitely often?

Again, we need to produce an infinite behaviour, with a finite number of transitions

s0 s1 sk−1 sk

q p

[[M, f ]]k is:

I(s0) ∧

k −1

^

i=0

R(si,si+1) ∧

k

_

l=0

R(sk,sl) ∧

k

_

j=l

qj

(43)

Subcase Combination: GFq ∧ Fp (fair reachability)

f :=GFq ∧ Fp, s.t. p, q Boolean:provided that q holds infinitely often, is there a reachable state in which p holds?

Again, we need to produce an infinite behaviour, with a finite number of transitions

s0 s1 sk−1 sk

q p

[[M, f ]]k is:

I(s0) ∧

k −1

^

i=0

R(si,si+1) ∧

k

_

j=0

pj

k

_

l=0

R(sk,sl) ∧

k

_

j=l

qj

(44)

Subcase Combination: GFq ∧ Fp (fair reachability)

f :=GFq ∧ Fp, s.t. p, q Boolean:provided that q holds infinitely often, is there a reachable state in which p holds?

Again, we need to produce an infinite behaviour, with a finite number of transitions

s0 s1 sk−1 sk

q p

[[M, f ]]k is:

I(s0) ∧

k −1

^

i=0

R(si,si+1) ∧

k

_

j=0

pj

k

_

l=0

R(sk,sl) ∧

k

_

j=l

qj

(45)

Subcase Combination: GFq ∧ Fp (fair reachability)

f :=GFq ∧ Fp, s.t. p, q Boolean:provided that q holds infinitely often, is there a reachable state in which p holds?

Again, we need to produce an infinite behaviour, with a finite number of transitions

s0 s1 sk−1 sk

q p

[[M, f ]]k is:

I(s0) ∧

k −1

^

i=0

R(si,si+1) ∧

k

_

j=0

pj

k

_

l=0

R(sk,sl) ∧

k

_

j=l

qj

(46)

Outline

1 SAT-based Model Checking: Generalities

2 Bounded Model Checking Intuitions

General Encoding Relevant Subcases An Example

Computing Upper Bounds Discussion

3 Inductive reasoning on invariants (aka “K-Induction”) K-Induction

An Example

4 Exercises

(47)

Example: a bugged 3-bit shift register

System M:

I(x ) := ¬x [0] ∧ ¬x [1] ∧ x [2]

Correct R:R(x , x0) := (x0[0] ↔ x [1]) ∧ (x0[1] ↔ x [2]) ∧ (x0[2] ↔ 0) Bugged R:R(x , x0) := (x0[0] ↔ x [1]) ∧ (x0[1] ↔ x [2]) ∧ (x0[2] ↔1) Property: F(¬x [0] ∧ ¬x [1] ∧ ¬x [2])

BMC Problem: is there an execution π of M of length k s.t.

π |=G((x [0] ∨ x [1] ∨ x [2]))?

(48)

Example: a bugged 3-bit shift register

System M:

I(x ) := ¬x [0] ∧ ¬x [1] ∧ x [2]

Correct R:R(x , x0) := (x0[0] ↔ x [1]) ∧ (x0[1] ↔ x [2]) ∧ (x0[2] ↔ 0) Bugged R:R(x , x0) := (x0[0] ↔ x [1]) ∧ (x0[1] ↔ x [2]) ∧ (x0[2] ↔1) Property: F(¬x [0] ∧ ¬x [1] ∧ ¬x [2])

BMC Problem: is there an execution π of M of length k s.t.

π |=G((x [0] ∨ x [1] ∨ x [2]))?

(49)

Example: a bugged 3-bit shift register

System M:

I(x ) := ¬x [0] ∧ ¬x [1] ∧ x [2]

Correct R:R(x , x0) := (x0[0] ↔ x [1]) ∧ (x0[1] ↔ x [2]) ∧ (x0[2] ↔ 0) Bugged R:R(x , x0) := (x0[0] ↔ x [1]) ∧ (x0[1] ↔ x [2]) ∧ (x0[2] ↔1) Property: F(¬x [0] ∧ ¬x [1] ∧ ¬x [2])

BMC Problem: is there an execution π of M of length k s.t.

π |=G((x [0] ∨ x [1] ∨ x [2]))?

(50)

Example: a bugged 3-bit shift register

System M:

I(x ) := ¬x [0] ∧ ¬x [1] ∧ x [2]

Correct R:R(x , x0) := (x0[0] ↔ x [1]) ∧ (x0[1] ↔ x [2]) ∧ (x0[2] ↔ 0) Bugged R:R(x , x0) := (x0[0] ↔ x [1]) ∧ (x0[1] ↔ x [2]) ∧ (x0[2] ↔1) Property: F(¬x [0] ∧ ¬x [1] ∧ ¬x [2])

BMC Problem: is there an execution π of M of length k s.t.

π |=G((x [0] ∨ x [1] ∨ x [2]))?

(51)

Example: a bugged 3-bit shift register

System M:

I(x ) := ¬x [0] ∧ ¬x [1] ∧ x [2]

Correct R:R(x , x0) := (x0[0] ↔ x [1]) ∧ (x0[1] ↔ x [2]) ∧ (x0[2] ↔ 0) Bugged R:R(x , x0) := (x0[0] ↔ x [1]) ∧ (x0[1] ↔ x [2]) ∧ (x0[2] ↔1) Property: F(¬x [0] ∧ ¬x [1] ∧ ¬x [2])

BMC Problem: is there an execution π of M of length k s.t.

π |=G((x [0] ∨ x [1] ∨ x [2]))?

(52)

Example: a bugged 3-bit shift register

System M:

I(x ) := ¬x [0] ∧ ¬x [1] ∧ x [2]

Correct R:R(x , x0) := (x0[0] ↔ x [1]) ∧ (x0[1] ↔ x [2]) ∧ (x0[2] ↔ 0) Bugged R:R(x , x0) := (x0[0] ↔ x [1]) ∧ (x0[1] ↔ x [2]) ∧ (x0[2] ↔1) Property: F(¬x [0] ∧ ¬x [1] ∧ ¬x [2])

BMC Problem: is there an execution π of M of length k s.t.

π |=G((x [0] ∨ x [1] ∨ x [2]))?

(53)

Example: a bugged 3-bit shift register [cont.]

k = 0:

x0 x x x0

0 0

[0]

[1]

[2]

x x x x [0]

[1]

[2]

1 1 1

1 x

x x x [0]

[1]

[2]

2 2 2 2 L0

L1

L2

I : (¬x0[0] ∧ ¬x0[1] ∧ x0[2]) ∧ W0

l=0Ll : ((x0[0] ↔ x0[1]) ∧ (x0[1] ↔ x0[2]) ∧ (x0[2] ↔ 1)) 

V0

i=0(x 6= 0) : (x0[0] ∨ x0[1] ∨ x0[2]) 

=⇒UNSAT: unit propagation:

¬x0[0], ¬x0[1], x0[2]

=⇒loop violated

(54)

Example: a bugged 3-bit shift register [cont.]

k = 0:

x0 x x x0

0 0

[0]

[1]

[2]

x x x x [0]

[1]

[2]

1 1 1

1 x

x x x [0]

[1]

[2]

2 2 2 2 L0

L1

L2

I : (¬x0[0] ∧ ¬x0[1] ∧ x0[2]) ∧ W0

l=0Ll : ((x0[0] ↔ x0[1]) ∧ (x0[1] ↔ x0[2]) ∧ (x0[2] ↔ 1)) 

V0

i=0(x 6= 0) : (x0[0] ∨ x0[1] ∨ x0[2]) 

=⇒UNSAT: unit propagation:

¬x0[0], ¬x0[1], x0[2]

=⇒loop violated

(55)

Example: a bugged 3-bit shift register [cont.]

k = 0:

x0 x x x0

0 0

[0]

[1]

[2]

x x x x [0]

[1]

[2]

1 1 1

1 x

x x x [0]

[1]

[2]

2 2 2 2 L0

L1

L2

I : (¬x0[0] ∧ ¬x0[1] ∧ x0[2]) ∧ W0

l=0Ll : ((x0[0] ↔ x0[1]) ∧ (x0[1] ↔ x0[2]) ∧ (x0[2] ↔ 1)) 

V0

i=0(x 6= 0) : (x0[0] ∨ x0[1] ∨ x0[2]) 

=⇒UNSAT: unit propagation:

¬x0[0], ¬x0[1], x0[2]

=⇒loop violated

(56)

Example: a bugged 3-bit shift register [cont.]

k = 1:

x0 x x x0

0 0

[0]

[1]

[2]

x x x x [0]

[1]

[2]

1 1 1

1 x

x x x [0]

[1]

[2]

2 2 2 2 L0

L1

L2

I : (¬x0[0] ∧ ¬x0[1] ∧ x0[2])∧

[[M]]1: (x1[0] ↔ x0[1]) ∧ (x1[1] ↔ x0[2]) ∧ (x1[2] ↔ 1) 

W1

l=0Ll:

 ((x0[0] ↔ x1[1]) ∧ (x0[1] ↔ x1[2]) ∧ (x0[2] ↔ 1))∨

((x1[0] ↔ x1[1]) ∧ (x1[1] ↔ x1[2]) ∧ (x1[2] ↔ 1))



V1

i=0(x 6= 0) :

 (x0[0] ∨ x0[1] ∨ x0[2]) ∧ (x1[0] ∨ x1[1] ∨ x1[2])



=⇒UNSAT: unit propagation:

¬x0[0], ¬x0[1], x0[2]

¬x1[0], x1[1], x1[2]

=⇒both loop disjuncts violated

Riferimenti

Documenti correlati

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

Some exampes displayed in these slides are taken from [Clarke, Grunberg &amp; Peled, “Model Checking”, MIT Press], and their copyright is detained by the authors?. All the

for a restricted number of students, in turn, it will be possible to follow the class physically in the classroom following the safety access protocols. for everybody else it will

If a student willingly refuses to comply to the rules (e.g., to wear a mask) the teacher is supposed to take his/her data and to call the DISI COVID19-safety responsible, who

=⇒ 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

Various techniques: Bounded Model Checking (BMC), K-induction, Interpolant-based, IC3/PDR,..... SAT-based Bounded Model Checking