• Non ci sono risultati.

Introduction to Formal Methods Chapter 07: LTL Symbolic Model Checking

N/A
N/A
Protected

Academic year: 2021

Condividi "Introduction to Formal Methods Chapter 07: LTL Symbolic Model Checking"

Copied!
49
0
0

Testo completo

(1)

Introduction to Formal Methods

Chapter 07: LTL Symbolic 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 18

th

May, 2020, 14:48

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.

Roberto Sebastiani Ch. 07: LTL Symbolic Model Checking Monday 18

th

May, 2020 1 / 56

(2)

Outline

1 The problem

2 The general algorithm Compute the tableau T ψ Compute the product M × T ψ Check the emptiness of L(M × T ψ )

3 An example

4 Exercises

th

(3)

The problem

Given a Kripke structure M and an LTL specification ϕ, does M satisfy ϕ?:

M |= ϕ

Equivalent to the CTL M.C. problem:

M |=

Dual CTL M.C. problem:

M |= E¬ϕ

Roberto Sebastiani Ch. 07: LTL Symbolic Model Checking Monday 18

th

May, 2020 4 / 56

(4)

LTL Symbolic M.C.

Let M be a Kripke model and ϕ be an LTL formula:

M |= (CTL )

⇐⇒ M |= ϕ (LTL)

⇐⇒ L(M) ⊆ L(ϕ)

⇐⇒ L(M) ∩ L(ϕ) = ∅

⇐⇒ L(M) ∩ L(¬ϕ) = ∅

⇐⇒ L(M) ∩ L(T ¬ϕ ) = ∅

⇐⇒ L(M × T ¬ϕ ) = ∅

⇐⇒ M × T ¬ϕ 6|= EGtrue

T ¬ϕ is a fair Kripke structure, called Tableau, which represents all and only the paths that satisfy ¬ϕ (do not satisfy ϕ)

=⇒ M × T ¬ϕ represents all and only the paths appearing in M and not in ϕ.

th

(5)

LTL Symbolic M.C. (dual version)

Let M be a Kripke model and ψ = ¬ϕ def be an LTL formula:

M |=

⇐⇒ M 6|= A¬ψ

⇐⇒ ...

⇐⇒ L(M × T ψ ) 6= ∅

⇐⇒ M × T ψ |= EGtrue

T ψ is a fair Kripke structure, called Tableau, which represents all and only the paths that satisfy the LTL formula ψ

=⇒ M × T ψ represents all and only the paths appearing in both M and T ψ .

Roberto Sebastiani Ch. 07: LTL Symbolic Model Checking Monday 18

th

May, 2020 6 / 56

(6)

LTL Symbolic Model Checking

Three steps:

(i) Compute the tableau T ψ (T ψ is a fair Kripke structure) (ii) Compute the product M × T ψ

(M × T ψ is a fair Kripke structure) (iii) Check the emptiness of L(M × T ψ )

(e.i., check that M × T ψ 6|= EGTrue)

th

(7)

Building the tableau T ψ for ψ: the set of states

Elementary subformulas of ψ: el(ψ) el(p) := {p}

el(¬ϕ 1 ) := el(ϕ 1 )

el(ϕ 1 ∧ ϕ 2 ) := el(ϕ 1 ) ∪ el(ϕ 2 ) el(Xϕ 1 ) = {Xϕ 1 } ∪ el(ϕ 1 )

el(ϕ 1 2 ) := {X(ϕ 1 2 )} ∪ el(ϕ 1 ) ∪ el(ϕ 2 )

Intuition: el(ψ) is the set of propositions and X-formulas occurring ψ 0 , ψ 0 being the result of applying recursively the tableau

expansion rules to ψ

The set of states S T ψ of T ψ is given by 2 el(ψ)

The labeling function L T ψ of T ψ comes straightforwardly (the label is the Boolean component of each state)

Roberto Sebastiani Ch. 07: LTL Symbolic Model Checking Monday 18

th

May, 2020 10 / 56

(8)

Example: ψ := pUq

el(pUq) = el((q ∨ (p ∧ X(pUq))) = {p, q, X(pUq)}

=⇒ S T ψ = {

1 : {p, q, X(pUq)}, [pUq]

2 : {¬p, q, X(pUq)}, [pUq]

3 : {p, ¬q, X(pUq)}, [pUq]

4 : {¬p, q, ¬X(pUq)}, [pUq]

5 : {¬p, ¬q, X(pUq)}, [¬pUq]

6 : {p, q, ¬X(pUq)}, [pUq]

7 : {p, ¬q, ¬X(pUq)}, [¬pUq]

8 : {¬p, ¬q, ¬X(pUq)} [¬pUq]

}

th

(9)

Example: ψ := pUq [cont.]

−Xψ −Xψ

−Xψ −Xψ

3

4

5 6

7 8

2

1 p q −p p −q

−p q −p −q p q

p −q −p −q

q

Roberto Sebastiani Ch. 07: LTL Symbolic Model Checking Monday 18

th

May, 2020 12 / 56

(10)

Building the tableau T ψ for ψ: sat()

Set of states in S T ψ satisfying ϕ i : sat(ϕ i ) sat(ϕ 1 ) := {s | ϕ 1 ∈ s}, ϕ 1 ∈ el(ψ) sat(¬ϕ 1 ) := S T

ψ

/sat(ϕ 1 )

sat(ϕ 1 ∧ ϕ 2 ) := sat(ϕ 1 ) ∩ sat(ϕ 2 )

sat(ϕ 1 2 ) := sat(ϕ 2 ) ∪ (sat(ϕ 1 ) ∩ sat(X(ϕ 1 2 )))

intuition: sat() establishes in which states subformulas are true

th

(11)

Example: ψ := pUq [cont.]

−Xψ −Xψ

−Xψ −Xψ

3

4

5 6

7 8

2

1 p q −p p −q

−p q −p −q p q

p −q −p −q

q

ψ ψ ψ

ψ −ψ ψ

−ψ −ψ

Roberto Sebastiani Ch. 07: LTL Symbolic Model Checking Monday 18

th

May, 2020 14 / 56

(12)

Building the tableau T ψ for ψ: initial states and transition relation

Set of states in S T ψ satisfying ϕ i : sat(ϕ i ) sat(ϕ 1 ) := {s | ϕ 1 ∈ s}, ϕ 1 ∈ el(ψ) sat(¬ϕ 1 ) := S T

ψ

/sat(ϕ 1 )

sat(ϕ 1 ∧ ϕ 2 ) := sat(ϕ 1 ) ∩ sat(ϕ 2 )

sat(ϕ 1 2 ) := sat(ϕ 2 ) ∪ (sat(ϕ 1 ) ∩ sat(X(ϕ 1 2 )))

Intuition: sat() establishes in which states subformulas are true The set of initial states I T ψ is defined as

I T ψ = sat(ψ)

The transition relation R T ψ is defined as R T ψ (s, s 0 ) = \

i ∈el(ψ)

(s, s 0 ) | s ∈ sat(Xϕ i ) ⇔ s 0 ∈ sat(ϕ i )

th

(13)

Example: ψ := pUq [cont.]

−Xψ −Xψ

−Xψ −Xψ

3

4

5 6

7 8

2 1 p q

ψ

−p p −q

−p q −p −q p q

p −q −p −q

ψ

ψ −ψ ψ

−ψ

−ψ

q ψ

Roberto Sebastiani Ch. 07: LTL Symbolic Model Checking Monday 18

th

May, 2020 16 / 56

(14)

Problems with U-subformulas

R T ψ does not guarantee that the U-subformulas are fulfilled Example: state 3 {p, ¬q, X(pUq)}:

although state 3 belongs to

sat(pUq) := sat(q) ∪ (sat(p) ∩ sat(X(pUq))),

the path which loops forever in state 3 does not satisfy pUq, as q never holds in that path.

th

(15)

Tableaux rules: a quote

“After all... tomorrow is another day."

[Scarlett O’Hara, “Gone with the Wind”]

Roberto Sebastiani Ch. 07: LTL Symbolic Model Checking Monday 18

th

May, 2020 18 / 56

(16)

Fairness conditions for every U-subformula

it must never happen that we get into a state s 0 from which we can enter a path π 0 in which ϕ 1 2 holds forever and ϕ 2 never holds.

In CTL*: ¬EFEG((ϕ 1 2 ) ∧ ¬ϕ 2 ) (“bad loop”)

ϕ1Uϕ2 ϕ1Uϕ2

−ϕ2

ϕ1Uϕ2 ϕ1Uϕ2

−ϕ2 . . . .

−ϕ2 −ϕ2

=⇒ For every [positive] U-subformula ϕ 1 2 of ψ, we must add a fairness CTL* condition AGAF(¬(ϕ 1 2 ) ∨ ϕ 2 )

(in LTL: GF(¬(ϕ 1 2 ) ∨ ϕ 2 ))

If no [positive] U-subformulas, then add one fairness condition AGAF>.

=⇒ We restrict the admissible paths of T ψ to those which verify the fairness condition: T ψ := hS T ψ , I T ψ , R T ψ , L T ψ , F T ψ i

F T ψ := {sat(¬(ϕ 1 2 ) ∨ ϕ 2 )) s.t. (ϕ 1 2 ) occurs [positively ]in ψ}

th

(17)

Example: ψ := pUq [cont.]

−Xψ −Xψ

−Xψ −Xψ

3

4

5 6

7 8

2 1 p q

ψ

−p p −q

−p q −p −q p q

p −q −p −q

ψ

ψ −ψ ψ

−ψ

−ψ

q ψ

Roberto Sebastiani Ch. 07: LTL Symbolic Model Checking Monday 18

th

May, 2020 20 / 56

(18)

Symbolic representation of T ψ

State variables: one Boolean variable for each formula in el(ψ) EX: p, q and x and primed versions p 0 , q 0 and x 0

[ x is a Boolean label for X(pUq) ] sat(ϕ i ):

sat(p) := p, s.t. p Boolean state variable sat(¬ϕ 1 ) := ¬sat(ϕ 1 )

sat(ϕ 1 ∧ ϕ 2 ) := sat(ϕ 1 ) ∧ sat(ϕ 2 )

sat(Xϕ i ) := x [Xϕ

i

] , s.t. x [Xϕ

i

] Boolean state variable sat(ϕ 1 2 ) := sat(ϕ 2 ) ∨ (sat(ϕ 1 ) ∧ sat(X(ϕ 1 2 )))

=⇒ sat(ϕ 1 2 ) := sat(ϕ 2 ) ∨ (sat(ϕ 1 ) ∧ x [Xϕ

1

2

] ) ...

th

(19)

Symbolic representation of T ψ [cont.]

...

Initial states: I T ψ = sat(ψ) EX: I(p, q, x ) = q ∨ (p ∧ x ) Transition Relation:

R T ψ (s, s 0 ) = T

i ∈el(ψ) {(s, s 0 ) | s ∈ sat(Xϕ i ) ⇔ s 0 ∈ sat(ϕ i )}

R T

ψ

= V

i

∈el(ψ) (sat(Xϕ i ) ↔ sat 0i )) where sat 0i ) is sat(ϕ i ) on primed variables EX: R T

ψ

(p, q, x , p 0 , q 0 , x 0 ) = x ↔ (q 0 ∨ (p 0 ∧ x 0 )) Fairness Conditions:

F T ψ := {sat(¬(ϕ 1 2 ) ∨ ϕ 2 )) s.t. (ϕ 1 2 ) occurs [positively ]in ψ}

EX: F T

ψ

(p, q, x ) = ¬(q ∨ (p ∧ x )) ∨ q = ... = ¬p ∨ ¬x ∨ q

Roberto Sebastiani Ch. 07: LTL Symbolic Model Checking Monday 18

th

May, 2020 22 / 56

(20)

Symbolic representation of T ψ : examples

I T ψ (p, q, x ) = q ∨ (p ∧ x ) 1 : {p, q, x } |= I T ψ 3 : {p, ¬q, x } |= I T ψ 6 5 : {¬p, ¬q, x} 6|= I T ψ R T ψ (p, q, x , p 0 , q 0 , x 0 ) = x ↔ (q 0 ∨ (p 0 ∧ x 0 ))

1 ⇒ 1 : {p, q, x , p 0 , q 0 , x 0 } |= R T ψ 6 ⇒ 7 : {p, q, ¬x , p 0 , ¬q 0 , ¬x 0 } |= R T ψ 6 6⇒ 1 : {p, q, ¬x , p 0 , q 0 , x 0 } 6|= R T ψ F T ψ (p, q, x ) = ¬p ∨ ¬x ∨ q

1 : {p, q, x } |= F T ψ 5 : {¬p, ¬q, x } |= F T ψ 6 3 : {p, ¬q, x} 6|= F T ψ

−Xψ −Xψ

−Xψ −Xψ

3

4

5 6

7 8

2 1 pq

ψ

−p p−q

−p q −p−q p q

p −q −p −q

ψ

ψ −ψ ψ

−ψ

−ψ

q ψ

th

(21)

Computing the product P := T ψ × M

Given M := hS M , I M , R M , L M i and T ψ := hS T ψ , I T ψ , R T ψ , L T ψ , F T ψ i, we compute the product P := T ψ × M = hS, I, R, L, F i as follows:

S := {(s, s 0 ) | s ∈ S T

ψ

, s 0 ∈ S M and L M (s 0 )| ψ = L T

ψ

(s)}

I := {(s, s 0 ) | s ∈ I T

ψ

, s 0 ∈ I M and L M (s 0 )| ψ = L T

ψ

(s)}

Given (s, s 0 ), (t, t 0 ) ∈ S, ((s, s 0 ), (t, t 0 )) ∈ R iff (s, t) ∈ R T

ψ

and (s 0 , t 0 ) ∈ R M

L((s, s 0 )) = L T

ψ

(s) ∪ L M (s 0 ) Extension of sat() and F T ψ to P:

(s, s 0 ) ∈ sat(ψ) ⇐⇒ s ∈ sat(ψ)

F := {sat(¬(ϕ 1 2 ) ∨ ϕ 2 ) s.t. (ϕ 1 2 ) occurs [positively ]in ψ}

Roberto Sebastiani Ch. 07: LTL Symbolic Model Checking Monday 18

th

May, 2020 25 / 56

(22)

Computing the product P := T ψ × M symbolically

Let V , W be the array of Boolean state variables of T ψ and M respectively:

Initial states: I(V ∪ W ) = I T ψ (V ) ∧ I M (W )

Transition Relation: R(V ∪ W , V 0 ∪ W 0 ) = R T ψ (V , V 0 ) ∧ R M (W , W 0 ) Fairness conditions:

{F 1 (V ∪ W ), ..., F k (V ∪ W )} = {F T ψ 1 (V ), ..., F T ψ k (V )}

th

(23)

Main theorem [Clarke, Grumberg & Hamaguchi; 94]

Theorem

THEOREM: M.s 0 |= Eψ iff there is a state s in T ψ s.t. (s, s 0 ) ∈ sat(ψ) and T ψ × M, (s, s 0 ) |= EGtrue under the fairness conditions:

{sat(¬(ϕ 1 2 ) ∨ ϕ 2 )) s.t. (ϕ 1 2 ) occurs in ψ}.

=⇒ M |= Eψ iff T ψ × M |= E f Gtrue

=⇒ M |= ¬ψ iff T ψ × M 6|= E f Gtrue LTL M.C. reduced to Fair CTL M.C.!!!

Symbolic OBDD-based techniques apply.

Note

The transition relation R of T ψ × M may not be total.

=⇒ Check_FairEG does not need to consider states without successors, restricting R to the remaining states.

Roberto Sebastiani Ch. 07: LTL Symbolic Model Checking Monday 18

th

May, 2020 28 / 56

(24)

A microwave oven

4 variables: start, close, heat, error

Actions (implicit): start_oven,open_door, close_door, reset, warmup, start_cooking, cook, done

Error situation: if oven is started while the door is open Represented as a Kripke structure (and hence as a OBDD’s)

th

(25)

A microwave oven [cont.]

1

2 3 4

5 6 7

−start

−close

−heat

−error

−close

−heat

−start

−heat

−error

−start

−error

−error

−heat

−error

−heat start

error

close close

heat

start close error

start close

start close heat start_owen open_door

close_door

open_door

open_door

close_door reset start_owen start_cooking

warmup done

cook

Roberto Sebastiani Ch. 07: LTL Symbolic Model Checking Monday 18

th

May, 2020 31 / 56

(26)

A microwave oven: symbolic representation

Initial states: I M (s, c, h, e) = ¬s ∧ ¬h ∧ ¬e

Transition relation: R M (s, c, h, e, s 0 , c 0 , h 0 , e 0 ) = [a simplification of]

( ¬s∧¬c∧¬h∧¬e∧¬s 0 ∧ c 0 ∧¬h 0 ∧¬e 0 ) ∨ (close_door , no error ) ( s∧¬c∧¬h∧ e∧ s 0 ∧ c 0 ∧¬h 0 ∧ e 0 ) ∨ (close_door , error ) ( ¬s∧ c ∧¬e∧¬s 0 ∧¬c 0 ∧¬h 0 ∧¬e 0 ) ∨ (open_door , no error ) ( s∧ c∧¬h∧ e∧ s 0 ∧¬c 0 ∧¬h 0 ∧ e 0 ) ∨ (open_door , error ) ( ¬s∧ c∧¬h∧¬e∧ s 0 ∧ c 0 ∧¬h 0 ∧¬e 0 ) ∨ (start_oven, no error ) ( ¬s∧¬c∧¬h∧¬e∧ s 0 ∧¬c 0 ∧¬h 0 ∧ e 0 ) ∨ (start_oven, error ) ( s∧ c∧¬h∧ e∧¬s 0 ∧ c 0 ∧¬h 0 ∧¬e 0 ) ∨ (reset)

( s∧ c∧¬h∧¬e∧ s 0 ∧ c 0 ∧ h 0 ∧¬e 0 ) ∨ (warmup) ( s∧ c∧ h∧¬e∧¬s 0 ∧ c 0 ∧ h 0 ∧¬e 0 ) ∨ (start_cooking) ( ¬s∧ c∧ h∧¬e∧¬s 0 ∧ c 0 ∧ h 0 ∧¬e 0 ) ∨ (cook )

( ¬s∧ c∧ h∧¬e∧¬s 0 ∧ c 0 ∧¬h 0 ∧¬e 0 ) (done)

Note: the third row represents two transitions: 3 → 1 and 4 → 1.

th

(27)

LTL specification

“necessarily, the oven’s door eventually closes and, till there, the oven does not heat”:

M |= A(¬heat U close), i.e.,

M |= ¬E¬(¬heat U close)

Roberto Sebastiani Ch. 07: LTL Symbolic Model Checking Monday 18

th

May, 2020 33 / 56

(28)

Tableau construction for ψ = ¬(¬heat U close)

ϕ := ¬ψ = (¬heat U close) Tableaux expansion:

ψ = ¬(¬heat U close) = ¬(close ∨ (¬heat ∧ X(¬heat U close))) el(ψ) = el(ϕ) = {heat, close, Xϕ} ({h, c, Xϕ})

States:

1 := {¬h, c, Xϕ}, 2 := {h, c, Xϕ}, 3 := {¬h, ¬c, Xϕ}, 4 := {h, c, ¬Xϕ}, 5 := {h, ¬c, Xϕ}, 6 := {¬h, c, ¬Xϕ}, 7 := {¬h, ¬c, ¬Xϕ}, 8 := {h, ¬c, ¬Xϕ}

th

(29)

Tableau construction for ψ = ¬(¬heat U close) [cont.]

−Xϕ −Xϕ

−Xϕ −Xϕ

−h

−h

−h

−h h

h h

h

c c −c

−c

c c

−c −c

2 3 1

4

5 6

7 8

. .

. .

Roberto Sebastiani Ch. 07: LTL Symbolic Model Checking Monday 18

th

May, 2020 35 / 56

(30)

Tableau construction for ψ = ¬(¬heat U close)

...

States:

1 := {¬h, c, Xϕ}, 2 := {h, c, Xϕ}, 3 := {¬h, ¬c, Xϕ}, 4 := {h, c, ¬Xϕ}, 5 := {h, ¬c, Xϕ}, 6 := {¬h, c, ¬Xϕ}, 7 := {¬h, ¬c, ¬Xϕ}, 8 := {h, ¬c, ¬Xϕ}

sat():

sat(h) = {2, 4, 5, 8} =⇒ sat(¬h) = {1, 3, 6, 7}, sat(c) = {1, 2, 4, 6} =⇒ sat(¬c) = {3, 5, 7, 8}, sat(Xϕ) = {1, 2, 3, 5} =⇒ sat(¬Xϕ) = {4, 6, 7, 8},

sat(ϕ) = sat(c) ∪ (sat(¬h) ∩ sat(X(¬h U c))) = {1, 2, 3, 4, 6}

=⇒ sat(ψ) = sat(¬ϕ) = {5, 7, 8}

th

(31)

Tableau construction for ψ = ¬(¬heat U close) [cont.]

−Xϕ −Xϕ

−Xϕ −Xϕ

−h

−h

−h

−h h

h h

h

c c −c

−c

c c

−c −c

2 3 1

4

5 6

7 8

. .

. .

sat(−h)

sat(−h)

sat(−h)

sat(h)

Roberto Sebastiani Ch. 07: LTL Symbolic Model Checking Monday 18

th

May, 2020 37 / 56

(32)

Tableau construction for ψ = ¬(¬heat U close) [cont.]

−Xϕ −Xϕ

−Xϕ −Xϕ

−h

−h

−h

−h h

h h

h

c c −c

−c

c c

−c −c

2 3 1

4

5 6

7 8

. .

. .

sat(−h)

sat(−h)

sat(−h)

sat(h)

sat(c)

sat(c)

th

(33)

Tableau construction for ψ = ¬(¬heat U close) [cont.]

−Xϕ −Xϕ

−Xϕ −Xϕ

−h

−h

−h

−h h

h h

h

c c −c

−c

c c

−c −c

2 3 1

4

5 6

7 8

. .

. .

sat(−h)

sat(−h)

sat(−h)

sat(h)

sat(c)

sat(c) ϕ

sat(X )

Roberto Sebastiani Ch. 07: LTL Symbolic Model Checking Monday 18

th

May, 2020 39 / 56

(34)

Tableau construction for ψ = ¬(¬heat U close) [cont.]

−Xϕ −Xϕ

−Xϕ −Xϕ

sat( ) ϕ

sat( ) −ϕ

−h

−h

−h

−h h

h h

h

c c −c

−c

c c

−c −c

2 3 1

4

5 6

7 8

. .

. .

th

(35)

Tableau construction for ψ = ¬(¬heat U close) [cont.]

...

sat():

sat(h) = {2, 4, 5, 8} =⇒ sat(¬h) = {1, 3, 6, 7}, sat(c) = {1, 2, 4, 6} =⇒ sat(¬c) = {3, 5, 7, 8}, sat(Xϕ) = {1, 2, 3, 5} =⇒ sat(¬Xϕ) = {4, 6, 7, 8},

sat(ϕ) = sat(c) ∪ (sat(¬h) ∩ sat(X(¬h U c))) = {1, 2, 3, 4, 6}

Initial states I: sat(ψ) = sat(¬ϕ) = {5, 7, 8}

Transition Relation R:

add an edge from every state in sat(Xϕ) to every state in sat(ϕ) add an edge from every state in sat(¬Xϕ) to every state in sat(¬ϕ)

Roberto Sebastiani Ch. 07: LTL Symbolic Model Checking Monday 18

th

May, 2020 41 / 56

(36)

Tableau construction for ψ = ¬(¬heat U close) [cont.]

−Xϕ −Xϕ

−Xϕ −Xϕ

sat(X ) ϕ sat( ) ϕ

sat( ) −ϕ

sat(X ) −ϕ

−h

−h

−h

−h h

h h

h

c c −c

−c

c c

−c −c

2 3 1

4

5 6

7 8

th

(37)

Tableau construction for ψ = ¬(¬heat U close) [cont.]

−Xϕ −Xϕ

−Xϕ −Xϕ

−h

−h

−h

−h h

h h

h

c c −c

−c

c c

−c −c

2 3 1

4

5 6

7 8

Roberto Sebastiani Ch. 07: LTL Symbolic Model Checking Monday 18

th

May, 2020 43 / 56

(38)

Problems with U-subformulas

R does not guarantee that ¬heatUclose is fulfilled

Example: although state 3 belongs to sat(¬heat Uclose), the path which loops forever in 3 does not satisfy ¬heatUclose, as close never holds in that path.

We restrict the admissible paths of T ψ to those which verify the fairness condition:

{sat(¬(¬heat Uclose) ∨ close)}

Remark

Alternatively, since (¬heat Uclose) occurs with negative polarity in ψ, here we can simply state the fairness condition “>”.

th

(39)

Symbolic representation of T ψ , s.t. ψ := ¬(¬hUc)

State variables: h, c and x and primed versions h 0 , c 0 and x 0 [ x is a Boolean label for X(¬hUc) ]

Initial states: I T ψ = sat(ψ)

=⇒ I(h, c, x ) = ¬(c ∨ (¬h ∧ x )) Transition Relation: R T ψ = V

i ∈el(ψ) (sat(Xϕ i ) ↔ sat 0i ))

=⇒ R T ψ (h, c, x , h 0 , c 0 , x 0 ) = x ↔ (c 0 ∨ (¬h 0 ∧ x 0 )) Fairness Property:

F T ψ := {sat(¬(ϕ 1 2 ) ∨ ϕ 2 )) s.t. (ϕ 1 2 ) in ψ}

=⇒ F T ψ (h, c, x ) = ¬(c ∨ (¬h ∧ x )) ∨ c = ... = h ∨ ¬x ∨ c Alternative (due to negative polarity of (¬heat Uclose) in ψ):

F T ψ (h, c, x ) = >

Roberto Sebastiani Ch. 07: LTL Symbolic Model Checking Monday 18

th

May, 2020 45 / 56

(40)

Product P = T ψ × M

1

2 3

4

5 6 7

−start

−close

−heat

−error

−close

−heat

−start

−heat

−error

−start

−error

−error

−heat

−error

−heat start

error

close close

heat

start close error

start close

start close heat start_owen open_door

close_door open_door

open_door

close_door reset start_owen start_cooking

warmup done

cook

−Xϕ −Xϕ

−Xϕ −Xϕ

−h

−h

−h

−h h

h h

h

c c −c

−c

c c

−c −c

2 3 1

4

5 6

7 8

(6,5)

(6,6) (6,3)

(4,4)

(4,7)

(7,1) (7,2)

(3,1)

(3,2) (1,3) (2,4)

(1,5) (1,6) (2,7)

th

(41)

Product P = T ψ × M [cont.]

(6,5)

(6,6) (6,3)

(4,4)

(4,7)

(7,1) (7,2)

(3,1)

(3,2) (1,3) (2,4)

(1,5) (1,6) (2,7)

(3,1)

(3,2) (1,3) (2,4)

(1,5) (1,6) (2,7)

P = T ψ × M (reachable states only) compute [EGtrue] (e.g. by Emerson-Lei):

=⇒ states (4, 4), (4, 7), (6, 3), (6, 5), (6, 6), (7, 1), (7, 2) are not part of a (fair) infinite path

=⇒ no initial states in [EGtrue] ( (7.1) has been removed).

=⇒ T ψ × M 6|= EGtrue

=⇒ Property verified!

N.B.: fairness condition (either (h ∨ ¬x ∨ c) or >) irrelevent here

Roberto Sebastiani Ch. 07: LTL Symbolic Model Checking Monday 18

th

May, 2020 47 / 56

(42)

Product P = T ψ × M: symbolic representation

Initial states: I(s, c, h, e, x ) = (¬s ∧ ¬h ∧ ¬e) ∧ ¬(c ∨ (¬h ∧ x )) =

¬s ∧ ¬h ∧ ¬e ∧ ¬c ∧ ¬x

Transition relation: R(s, c, h, e, x , s 0 , c 0 , h 0 , e 0 , x 0 ) = (an OBDD for) (x ↔ (c 0 ∨ (¬h 0 ∧ x 0 ))) ∧ (

( ¬s∧¬c∧¬h∧¬e∧¬s 0 ∧ c 0 ∧¬h 0 ∧¬e 0 ) ∨ (close_door , no error ) ( s∧¬c∧¬h∧ e∧ s 0 ∧ c 0 ∧¬h 0 ∧ e 0 ) ∨ (close_door , error ) ( ¬s∧ c ∧¬e∧¬s 0 ∧¬c 0 ∧¬h 0 ∧¬e 0 ) ∨ (open_door , no error ) ( s∧ c∧¬h∧ e∧ s 0 ∧¬c 0 ∧¬h 0 ∧ e 0 ) ∨ (open_door , error ) ( ¬s∧ c∧¬h∧¬e∧ s 0 ∧ c 0 ∧¬h 0 ∧¬e 0 ) ∨ (start_oven, no error ) ( ¬s∧¬c∧¬h∧¬e∧ s 0 ∧¬c 0 ∧¬h 0 ∧ e 0 ) ∨ (start_oven, error ) ( s∧ c∧¬h∧ e∧¬s 0 ∧ c 0 ∧¬h 0 ∧¬e 0 ) ∨ (reset)

( s∧ c∧¬h∧¬e∧ s 0 ∧ c 0 ∧ h 0 ∧¬e 0 ) ∨ (warmup) ( s∧ c∧ h∧¬e∧¬s 0 ∧ c 0 ∧ h 0 ∧¬e 0 ) ∨ (start_cooking) ( ¬s∧ c∧ h∧¬e∧¬s 0 ∧ c 0 ∧ h 0 ∧¬e 0 ) ∨ (cook )

( ¬s∧ c∧ h∧¬e∧¬s 0 ∧ c 0 ∧¬h 0 ∧¬e 0 ) (done)

)

th

(43)

[EGtrue]: symbolic representation

Emerson-Lei returns (an OBDD equivalent to):

EGtrue =

( ¬s∧¬c∧¬h∧¬e∧ x ) ∨ (3, 1)

( s∧¬c∧¬h∧ e∧ x ) ∨ (3, 2)

( ¬s∧ c∧¬h∧¬e∧ x ) ∨ (1, 3)

( ¬s∧ c∧ h∧¬e∧ x ) ∨ (2, 4)

( s∧ c∧¬h∧ e∧ x ) ∨ (1, 5)

( s∧ c∧¬h∧¬e∧ x ) ∨ (1, 5)

( s∧ c∧ h∧¬e∧ x ) ∨ (2, 7)

... (other unreachables states) Initial states: I(s, c, h, e, x ) = ¬s ∧ ¬h ∧ ¬e ∧ ¬c ∧ ¬x

=⇒ I(s, c, h, e, x ) 6|= EGtrue

=⇒ I 6⊆ [EGtrue]

=⇒ T ψ × M 6|= EGtrue

=⇒ Property verified!

Roberto Sebastiani Ch. 07: LTL Symbolic Model Checking Monday 18

th

May, 2020 49 / 56

(44)

The property verified is...

th

(45)

Ex: Symbolic LTL Model Checking

Given the following LTL formula: ϕ def = ¬((GFp ∧ GFq) → GFr ) (a) Compute the Negative Normal Form of ϕ (NNF (ϕ)).

[ Solution:

ϕ ⇐⇒ ¬((GFp ∧ GFq) → GFr )

⇐⇒ ¬(¬(GFp ∧ GFq) ∨ GFr )

⇐⇒ (GFp ∧ GFq ∧ ¬GFr )

⇐⇒ (GFp ∧ GFq ∧ FG¬r ) ⇐⇒ NNF (ϕ) ]

(b) Compute the set of elementary subformulas of ϕ.

[ Solution: First write the formula in terms of X and U’s (write “Fψ" for “>Uψ”):

ϕ ⇐⇒ ¬((GFp ∧ GFq) → GFr )

⇐⇒ ¬((¬F¬Fp ∧ ¬F¬Fq) → ¬F¬Fr )

el(F¬Fp) = {XF¬Fp} ∪ el(¬Fp) = {XF¬Fp} ∪ {XFp} ∪ el(p) = {XF¬Fp, XFp, p}.

Hence: el(ϕ) = el(¬((¬F¬Fp ∧ ¬F¬Fq) → ¬F¬Fr ))

= el(F¬Fp) ∪ el(F¬Fq) ∪ el(F¬Fr )

= {XF¬Fp, XFp, p, XF¬Fq, XFq, q, XF¬Fr , XFr , r } ] (c) What is the (maximum) number of states of a fair Kripke Model representing ϕ?

[ Solution: By definition it is 2 |el(ϕ)| = 2 9 = 512. ]

Roberto Sebastiani Ch. 07: LTL Symbolic Model Checking Monday 18

th

May, 2020 52 / 56

(46)

Ex: Symbolic LTL Model Checking

Given the following LTL formula ψ def = ¬F¬p, compute and draw the tableau T ψ of ψ. [ Solution:

(i) The set of elementary subformulas of ψ is el(ψ) def = {p, XF¬p}. Hence, the set of states is

{s 1 : (p, ¬XF¬p), s 2 : (p, XF¬p), s 3 : (¬p, ¬XF¬p), s 4 : (¬p, XF¬p)}

(ii) The set of initial states of T ψ is sat(ψ) def = S \ (sat(¬p) ∪ sat(XF¬p)) = {s 1 }.

(iii) Since s 1 is the only state in sat(¬F¬p), then s 1 is the only successor of itself, so that the only relevant transition is a self-loop over s 1 .

(One can also —un-necessarily— draw all transitions from states where ¬XF¬p holds into {s 1 } and from from states where XF¬p holds into {s 2 , s 3 , s 4 }.)

(iv) There is one U-subformula, F¬p, so that there is one fairness condition defined as sat(¬F¬p ∨ ¬p) . Since F¬p is false in s 1 , then s 1 is part of the fairness condition.

[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 condition. ]

]

th

(47)

Ex: Symbolic LTL Model Checking (cont.)

[ Solution:

s 1 p

[¬XF¬p]

or, alternatively without simplifications:

non-reachable states [¬XF¬p]

s 1 p

¬p [¬XF¬p]

p

[¬¬XF¬p]

¬p

[¬¬XF¬p]

s 2

s 3

s 4

]

Roberto Sebastiani Ch. 07: LTL Symbolic Model Checking Monday 18

th

May, 2020 54 / 56

(48)

Ex: Symbolic LTL Model Checking

Given the following LTL formula ψ def = Gp, compute and draw the tableau T ψ of ψ.

[Without converting anything into X, U].

[ Solution:

(i) The set of elementary subformulas of ψ is el(ψ) def = {p, XGp}. Hence, the set of states is

{s 1 : (p, XGp), s 2 : (p, ¬XGp), s 3 : (¬p, XGp), s 4 : (¬p, ¬XGp)}

(ii) The set of initial states of T ψ is sat(ψ) def = sat(p) ∩ sat(XGp) = {s 1 }.

(iii) Since s 1 is the only state in sat(Gp), then s 1 is the only successor of itself, so that the only relevant transition is a self-loop over s 1 .

(One can also —un-necessarily— draw all transitions from states where XGp holds into {s 1 } and from from states where ¬XGp holds into {s 2 , s 3 , s 4 }.)

(iv) Since there is no “U” subformula, we must add a AGAF> fairness condition, which is equivalent to say that all states belong to the fairness condition.

]

th

(49)

Ex: Symbolic LTL Model Checking (cont.)

[ Solution:

[XGp]

s 1 p

or, alternatively without simplifications:

non-reachable states [XGp]

s 1 p

¬p [XGp]

p [¬XGp]

¬p [¬XGp]

s 2

s 3

s 4

]

Roberto Sebastiani Ch. 07: LTL Symbolic Model Checking Monday 18

th

May, 2020 56 / 56

Riferimenti

Documenti correlati

(E.g., 300 Boolean vars =⇒ up to 2 300 ≈ 10 100 states!) State Space Explosion:.. too much

Copyright notice: some material (text, figures) displayed in these slides is courtesy of R..

Given a fair Kripke model M, a fair non-trivial SCC is an SCC with at least one edge that contains at least one state for every fair condition. =⇒ all states in a fair (non-trivial)

[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