5
Model Checking Felix Chang, Greg Dennis, Derek Rayside, Rob Seater MIT CSAIL 6.883, Prof Ernst {fschang, gdennis, drayside, rseater}@mit.edu November 23, 2005 Contents 1 Scribbles 1 2 Temporal Logics 1 2.1 CTL* (extended CTL) ............. 1 2.2 CTL (Computation Tree Logic) ........ 4 2.3 LTL (Linear Temporal Logic) ......... 4 2.4 Relative Expressive Power ........... 4 2.5 LTL vs. CTL: AFGf ............... 5 3 Optimizations 5 3.1 Explicit State .................. 5 3.2 Symbolic ..................... 5 1 Scribbles approaches explicit symbolic technologies 8 < : explicit BDD SAT checkers Spin explicit SMV symbolic, BDD-based etymology model model-theoretic sense model modeling sense properties 8 > > > < > > > : safety some specific bad thing never happens liveness some good thing eventually happens infinitely often Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. To copy otherwise, to republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. 6.883’05 MIT EECS 6.883 Program Analysis, Prof Ernst Copyright held by the authors. November 23, 2005. 2 Temporal Logics There are three temporal logics used in model checking: temporal logics 8 < : LTL linear temporal logic CTL computation tree logic CTL * subsumes LTL and CTL 2.1 CTL* (extended CTL) CTL* comprises atomic propositions (a variable from some state) logical connectives (, ¬, , ) temporal operators (X, F, G, U, W) – LTL (linear tem- poral logic), CTL (conditional tree logic), and CTL* (extended CTL). We begin with CTL*, which sub- sumes CTL and LTL. path quantifiers (A, E) Grammar: state formulae (initial token) s ::= Atomic(x) atomic fromula | !s negation |sVs disjunction |s^s conjunction |Ap all paths starting here |Ep some paths starting here path formulae p ::= s every state formula is a path formula* | !p negation |pVp disjunction |p^p conjunction |Xp next (on the second state in this path) |Fp finally (on some state in this path) |Gp generally (on all states in this path) | p1 U p2 strong until (p1 until eventually p2, p2 must occur) | p1 W p2 weak until (p1 until possibly p2, p2 needn’t occur) *A state formula used as a path formula only looks at the first state in a path. While path formulae may be composed, path formulae must always be followed by a state formulae, never by another path formula. AXX is well formed but AAX is not. Figure 2.1 shows examples of how path quantifiers work. Figure 2.1 shows examples of how state quantifiers combine with path quantifiers.

Model Checking - homes.cs.washington.edu

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Model Checking - homes.cs.washington.edu

Model Checking

Felix Chang, Greg Dennis, Derek Rayside, Rob SeaterMIT CSAIL 6.883, Prof Ernst

{fschang, gdennis, drayside, rseater}@mit.eduNovember 23, 2005

Contents

1 Scribbles 1

2 Temporal Logics 12.1 CTL* (extended CTL) . . . . . . . . . . . . . 12.2 CTL (Computation Tree Logic) . . . . . . . . 42.3 LTL (Linear Temporal Logic) . . . . . . . . . 42.4 Relative Expressive Power . . . . . . . . . . . 42.5 LTL vs. CTL: AFGf . . . . . . . . . . . . . . . 5

3 Optimizations 53.1 Explicit State . . . . . . . . . . . . . . . . . . 53.2 Symbolic . . . . . . . . . . . . . . . . . . . . . 5

1 Scribbles

approaches

explicitsymbolic

technologies

8<:

explicitBDDSAT

checkers

Spin explicitSMV symbolic, BDD-based

etymology

model model-theoretic sensemodel modeling sense

properties

8>>><>>>:

safetysome specific bad thingnever happens

livenesssome good thing eventuallyhappens infinitely often

Permission to make digital or hard copies of all or part ofthis work for personal or classroom use is granted without feeprovided that copies are not made or distributed for profit orcommercial advantage and that copies bear this notice and thefull citation on the first page. To copy otherwise, to republish,to post on servers or to redistribute to lists, requires priorspecific permission and/or a fee.6.883’05 MIT EECS 6.883 Program Analysis, Prof ErnstCopyright held by the authors. November 23, 2005.

2 Temporal Logics

There are three temporal logics used in model checking:

temporal logics

8<:

LTL linear temporal logicCTL computation tree logicCTL∗ subsumes LTL and CTL

2.1 CTL* (extended CTL)

CTL* comprises

• atomic propositions (a variable from some state)• logical connectives (⇒, ¬, ∨, ∧)• temporal operators (X, F, G, U, W) – LTL (linear tem-

poral logic), CTL (conditional tree logic), and CTL*(extended CTL). We begin with CTL*, which sub-sumes CTL and LTL.

• path quantifiers (A, E)

Grammar:

state formulae (initial token)s ::= Atomic(x) atomic fromula

| !s negation| s V s disjunction| s ^ s conjunction| A p all paths starting here| E p some paths starting here

path formulaep ::= s every state formula is a path formula*

| !p negation| p V p disjunction| p ^ p conjunction| X p next (on the second state in this path)| F p finally (on some state in this path)| G p generally (on all states in this path)| p1 U p2 strong until (p1 until eventually p2,

p2 must occur)| p1 W p2 weak until (p1 until possibly p2,

p2 needn’t occur)

*A state formula used as a path formula only looks at thefirst state in a path.

While path formulae may be composed, path formulae mustalways be followed by a state formulae, never by anotherpath formula. AXX is well formed but AAX is not. Figure 2.1shows examples of how path quantifiers work. Figure 2.1shows examples of how state quantifiers combine with pathquantifiers.

Page 2: Model Checking - homes.cs.washington.edu

Figure 1 Path quantifiers in CTL*

� �

� �

�� �

�� � � � � � � �

� � � � � � �� �

� �

� �

� � �

� � � � � � � � � � � � � � � � � � � � � � � � � �

� � � � � �

� �� � � � � �

� � � � �

� � � �

� � � �

� � �

� � � �

� � �

� � � �

� � �

� � � �

� � �

� �� �

� ��

�� �

� ��

� ��

�� �

� �� �

� �� �

� �� �

� �� �

� ��

� ��

� �� �

�� �

� �� �

� ��

� ��

� ��

� ��

� ��

� � � �

� � � �

2

Page 3: Model Checking - homes.cs.washington.edu

Figure 2 Interaction of state and path quantifiers in CTL*

� � � �

� � � �

� �

� �

� �

� �

� �� �

� � � �

� �

� �� �� �

� � � �

� �

� � � � �

� � � �

� � � � � �

� � � � � �

� �

� �

� �

� �� �

� �

� �

� �� �

� � � �

3

Page 4: Model Checking - homes.cs.washington.edu

Sample Specifications:

AG(req => F ack)each request will eventually be acknowledged

AG(!(!req U ack))each acknowledgement follows some request

AG !(def(x) & AX !EF use(x))x is never definied if not used (dead code)

AG(!(def(x) & AX (A (!use(x) W def(x)) )))x is defined but not used before re-defined

AGF reqrequest occurs infinitely often

Identities:

!A f = E !f!G f = F !f!X f = X !fF f = true U !f

The following operators are sufficient to express any CTL*expression: !, V, X, U, E.

2.2 CTL (Computation Tree Logic)

CTL is CTL* with the restriction that path quantifiers (X,F, G, U, W) must be preceeded by state quantifiers (A,E) and never by another path quantifier. Another way oflooking at CTL is that there are 10 quantifiers.

AX, EX for all/some successor statesAF inevitablyEF potentiallyAG invariablyEG potentially alwaysAU, EU for all some paths, until eventuallyAW, EW for all some paths, until possibly

A minimal subset is !, V, EX, EG, EU.

Examples in CTL:

EF AG fAG EF f

Examples not in CTL:

AFG fAXX f

The first is not expressible in CTL. The second is expressibleas AX AX f.

2.3 LTL (Linear Temporal Logic)

LTL is CTL* with the restriction that the first quantifiermust be A, and the only state formulae permitted are atomicpropositions. That is,

s ::= atomic(p)| A p

p ::= ! p| p V p| p ^ p| X p| F p| G p| p U p| p W p

When writing LTL in isolation from CTL or CTL*, the Ais generally left off the front of each formula.

Examples in LTL:

A FG fA (!GFp V Fg)

Examples not in LTL:

AF AG fAG EF f

2.4 Relative Expressive Power

In CTL and LTL:

AF fAG f

In CTL but not LTL:

AG EF f from any state, it is possible to get to astate for which f holds

AF EG fit is possible to get to a state from whichf holds no matter where you go

In LTL but not CTL:

A GF f infinitely oftenA FG f almost everywhere

In CTL* but neither CTL nor LTL:

(AF EF f) V (A FG f)

In none of the three:

AA f

Most properties that get written are in LTL∩CTL, exceptfor fairness which is in CTL ∗ −(LTL ∩ CTL)

4

Page 5: Model Checking - homes.cs.washington.edu

Figure 3 FG f is expressible in LTL but not in CTL.

� � � �

2.5 LTL vs. CTL: AFGf

The most unintuitive result of those above is that LTL isnot subsumed by CTL. We will thus take a more detailedlook at AFGf and why it is in not in CTL.

FG f holds if there is a point after which f is always true.For example, it holds for the case shown in Figure 2.5. AFGfis not valid CTL since it has a G directly following a F. Wemight consider AFAGf, but that is not equivalent to AFGf –it is too strong and does not hold for the example shownin Figures 2.5. Consider the path that follows the leftmostself-arc infinitely. It need never reach a state where f is false,but it always could reach such a state.

3 Optimizations

3.1 Explicit State

nested DFS

partial order reductions

coarsening

state indexing

bit-state hashing

abstraction

3.2 Symbolic

Macro Steps helpfull, reasonable

References

[1] Ph Schnoebelen. The complexity of temporal logicmodel checking. In Advances in Modal Logic, pages 1–44. World Scientific Publishing, 2002.

5