explicit state model checking algorithm for ctlcse814/lectures/17_ctlexplicitstatemcalgo.pdf ·...

17
Explicit State Model Checking Algorithm for CTL CSE 814 1 CTL Explicit-State Model Checking Algorithm

Upload: trinhduong

Post on 24-Apr-2019

223 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Explicit State Model Checking Algorithm for CTLcse814/Lectures/17_CTLexplicitStateMCalgo.pdf · Explicit-State MC Algorithm • Operates on a FSM M of a system and a CTL specification

Explicit State Model Checking Algorithm for CTL

CSE 814 1 CTL Explicit-State Model Checking Algorithm

Page 2: Explicit State Model Checking Algorithm for CTLcse814/Lectures/17_CTLexplicitStateMCalgo.pdf · Explicit-State MC Algorithm • Operates on a FSM M of a system and a CTL specification

CTL Model Checking Problem

•  Given –  A model describing the behaviors of a system –  A set of specifications expressed in CTL

•  Algorithmically –  Check that every behavior satisfies the specifications

CSE 814 CTL Explicit-State Model Checking Algorithm

2

Page 3: Explicit State Model Checking Algorithm for CTLcse814/Lectures/17_CTLexplicitStateMCalgo.pdf · Explicit-State MC Algorithm • Operates on a FSM M of a system and a CTL specification

Explicit-State MC Algorithm

•  Operates on a FSM M of a system and a CTL specification f that has been put in a special form : –  Uses only the operators: ¬, ∧, EX, EU, and EG

•  The algorithm proceeds in stages –  Each stage considers a sub-formula f’ of f –  Based on the Boolean structure of f’ and knowing the

states at which the sub-formulas of f’ are true, determines the states at which f’ is true

–  Starts with the “smallest” sub-formulas of f and works up to f

CSE 814 CTL Explicit-State Model Checking Algorithm

3

Page 4: Explicit State Model Checking Algorithm for CTLcse814/Lectures/17_CTLexplicitStateMCalgo.pdf · Explicit-State MC Algorithm • Operates on a FSM M of a system and a CTL specification

Example

CSE 814 CTL Explicit-State Model Checking Algorithm

4

{ p }

{ q }

System model:

CTL Specification: AG( p ⇒ AF(q) )

Page 5: Explicit State Model Checking Algorithm for CTLcse814/Lectures/17_CTLexplicitStateMCalgo.pdf · Explicit-State MC Algorithm • Operates on a FSM M of a system and a CTL specification

Example

Rewrite spec to use only ¬, ∧, EX, EU, EG:

CSE 814 CTL Explicit-State Model Checking Algorithm

5

AG( p ⇒ AF(q) )

≡ ¬EF[¬( p ⇒ AF(q) )]

≡ ¬EF[ p ∧ ¬AF(q) ]

≡ ¬E[ True U (p ∧¬AF(q)) ]

≡ ¬E[ True U (p ∧EG(¬q)) ]

¬

EU

EG

¬

q p True True, p, q

¬q

EG(¬q)

p ∧ EG(¬q)

E[ True U (p ∧ EG(¬q)) ]

¬E[ True U (p ∧ EG(¬q)) ]

Sub-formulas considered, bottom up:

Page 6: Explicit State Model Checking Algorithm for CTLcse814/Lectures/17_CTLexplicitStateMCalgo.pdf · Explicit-State MC Algorithm • Operates on a FSM M of a system and a CTL specification

Example

CSE 814 CTL Explicit-State Model Checking Algorithm

6

Label states satisfying:

True p q ¬q

{ p }

{ q }

Specification: ¬E[ True U (p ∧ EG(¬q)) ]

True True

True

True

True

p

q

¬q

¬q

¬q

¬q

Page 7: Explicit State Model Checking Algorithm for CTLcse814/Lectures/17_CTLexplicitStateMCalgo.pdf · Explicit-State MC Algorithm • Operates on a FSM M of a system and a CTL specification

Example

CSE 814 CTL Explicit-State Model Checking Algorithm

7

Label states satisfying:

EG(¬q))

{ p }

{ q }

Specification: ¬E[ True U (p ∧ EG(¬q)) ]

True True

True

True

True

p

q

¬q

¬q

¬q

¬q

EG(¬q)

EG(¬q)

Page 8: Explicit State Model Checking Algorithm for CTLcse814/Lectures/17_CTLexplicitStateMCalgo.pdf · Explicit-State MC Algorithm • Operates on a FSM M of a system and a CTL specification

Example

CSE 814 CTL Explicit-State Model Checking Algorithm

8

p ∧ EG(¬q))

{ p }

{ q }

Specification: ¬E[ True U (p ∧ EG(¬q)) ]

True True

True

True

True

p

q

¬q

¬q

¬q

¬q

EG(¬q)

EG(¬q)

Label states satisfying:

EG(¬q))

Page 9: Explicit State Model Checking Algorithm for CTLcse814/Lectures/17_CTLexplicitStateMCalgo.pdf · Explicit-State MC Algorithm • Operates on a FSM M of a system and a CTL specification

Example

CSE 814 CTL Explicit-State Model Checking Algorithm

9

{ p }

{ q }

Specification: ¬E[ True U (p ∧ EG(¬q)) ]

True True

True

True

True

p

q

¬q

¬q

¬q

¬q

EG(¬q)

EG(¬q)

p ∧ EG(¬q))

Label states satisfying:

EG(¬q))

E[ True U (p ∧EG(¬q)) ]

Page 10: Explicit State Model Checking Algorithm for CTLcse814/Lectures/17_CTLexplicitStateMCalgo.pdf · Explicit-State MC Algorithm • Operates on a FSM M of a system and a CTL specification

Example

CSE 814 CTL Explicit-State Model Checking Algorithm

10 ¬E[ True U (p ∧EG(¬q)) ]

{ p }

{ q }

Specification: ¬E[ True U (p ∧ EG(¬q)) ]

True True

True

True

True

p

q

¬q

¬q

¬q

¬q

EG(¬q)

EG(¬q)

¬E[ True U (p ∧EG(¬q)) ]

¬E[ True U (p ∧EG(¬q)) ]

¬E[ True U (p ∧EG(¬q)) ]

¬E[ True U (p ∧EG(¬q)) ]

¬E[ True U (p ∧EG(¬q)) ]

p ∧ EG(¬q))

Label states satisfying:

EG(¬q))

E[ True U (p ∧EG(¬q)) ]

Page 11: Explicit State Model Checking Algorithm for CTLcse814/Lectures/17_CTLexplicitStateMCalgo.pdf · Explicit-State MC Algorithm • Operates on a FSM M of a system and a CTL specification

CTL MC Algorithm

Input: FSM M = (S, R, L) and CTL spec f

Algorithm: Compute Labels(s) for each s ∈ S :

•  For each s ∈ S, initialize Labels(s) = L(s)

•  For i = 1 .. d, where d is the depth of the parse tree of f :

–  For each sub-formula g at depth d − i, perform the “stage computation”

•  On termination, (M, s) ⊨ f iff f ∈ Labels(s)

CSE 814 CTL Explicit-State Model Checking Algorithm

11

Page 12: Explicit State Model Checking Algorithm for CTLcse814/Lectures/17_CTLexplicitStateMCalgo.pdf · Explicit-State MC Algorithm • Operates on a FSM M of a system and a CTL specification

Stage Computation for CTL formulas

Five cases: ¬, ∧, EX, EU, EG

•  Case g has the form ¬f : If f ∉ Labels(s), then add g to Labels(s)

•  Case g has the form f ∧ g : If f ∈ Labels(s) and g ∈ Labels(s), then add g to Labels(s)

•  Case g has the form EXf : If there is some some t such that (s, t ) ∈ R and f ∈ Labels(t), then add g to Labels(s)

CSE 814 CTL Explicit-State Model Checking Algorithm

12

Page 13: Explicit State Model Checking Algorithm for CTLcse814/Lectures/17_CTLexplicitStateMCalgo.pdf · Explicit-State MC Algorithm • Operates on a FSM M of a system and a CTL specification

Stage Computation for CTL formulas

Five cases: ¬, ∨, EX, EU, EG

•  Case g has the form E[ f U h ]

–  If h ∈ Labels(s), then add g to Labels(s)

–  Repeat until a fixed point is reached: If there is some some t such that (s, t ) ∈ R and f ∈ Labels(s) and g ∈ Labels(t), then add g to Labels(s)

CSE 814 CTL Explicit-State Model Checking Algorithm

13

Page 14: Explicit State Model Checking Algorithm for CTLcse814/Lectures/17_CTLexplicitStateMCalgo.pdf · Explicit-State MC Algorithm • Operates on a FSM M of a system and a CTL specification

Stage Computation for CTL formulas

Five cases: ¬, ∨, EX, EU, EG

•  Case g has the form EG( f ):

–  Compute the sub-FSM M’ of M produced by deleting all states for which f ∉ Labels(s).

–  Find the maximal strongly connected components (SCCs) of M’

–  For each non-trivial SCC of M’ and every s in M’, if s reaches the SCC, add g to Labels(s)

CSE 814 CTL Explicit-State Model Checking Algorithm

14

Page 15: Explicit State Model Checking Algorithm for CTLcse814/Lectures/17_CTLexplicitStateMCalgo.pdf · Explicit-State MC Algorithm • Operates on a FSM M of a system and a CTL specification

Example: EG(q)

CSE 814 CTL Explicit-State Model Checking Algorithm

15

{ q }

{ q }

{ q }

{ q } { q }

{ q }

{ q }

{ q }

{ q } { q }

Given FSM M :

Compute sub-FSM M’ :

Page 16: Explicit State Model Checking Algorithm for CTLcse814/Lectures/17_CTLexplicitStateMCalgo.pdf · Explicit-State MC Algorithm • Operates on a FSM M of a system and a CTL specification

Example: EG(q)

CSE 814 CTL Explicit-State Model Checking Algorithm

16

{ q }

{ q }

{ q }

{ q } { q }

Compute max’l SCCs of M’ :

Compute states that reach the SCC :

{ q }

{ q }

{ q }

{ q } { q }

EG( q )

EG( q )

EG( q )

Page 17: Explicit State Model Checking Algorithm for CTLcse814/Lectures/17_CTLexplicitStateMCalgo.pdf · Explicit-State MC Algorithm • Operates on a FSM M of a system and a CTL specification

Summary

•  Stage computation labels each state of the FSM with sub-formulas that are true at that state –  sub-formulas considered bottom-up –  based on Boolean structure of sub-formulas

•  Complexity is linear in the size of the formula and the size of the FSM

•  Explicit-state because it needs to examine every state in a FSM, which is typically a source of state explosion

CSE 814 CTL Explicit-State Model Checking Algorithm

17