Preliminaries Q1 Is p & G(p -> XX p) a solution to the p - - PowerPoint PPT Presentation

preliminaries
SMART_READER_LITE
LIVE PREVIEW

Preliminaries Q1 Is p & G(p -> XX p) a solution to the p - - PowerPoint PPT Presentation

Preliminaries Q1 Is p & G(p -> XX p) a solution to the p on even states but saying nothing about odd states puzzle? A: no if p holds in an odd state, then it holds in all future odd states. We didnt want this. Preliminaries


slide-1
SLIDE 1

Preliminaries

Q1 Is p & G(p -> XX p) a solution to the ”p on even states but saying nothing about

  • dd states” puzzle?

A: no if p holds in an odd state, then it holds in all future odd states. We didn’t want this.

slide-2
SLIDE 2

Preliminaries

Q2 Is E k really a formula in CTL ? A: No! (Not in the syntax) E needs to be combined with F, G or X And anyway, what would it actually mean? (fixed this on earlier slide)

slide-3
SLIDE 3

Model Checking II

How CTL model checking works

slide-4
SLIDE 4

CTL

A E X F G U Model checking problem Determine M, s0 f Or find all s s.t. M, s f

slide-5
SLIDE 5

Explicit state model checking

Option 1 CES (original paper) Represent state transition graph explicitly Walk around marking states Graph algorithms involving strongly connected components etc. Not covered in this course (cf. SPIN) Used particularly in software model checking

slide-6
SLIDE 6

Symbolic MC

Option 2 McMillan et al because of STATE EXPLOSION problem

State graph exponential in program/circuit size Graph algorithms linear in state graph size

INSTEAD

Use symbolic representation both of sets of states and of state transtion graph

slide-7
SLIDE 7

First, think just about sets of states in which CTL formulas hold

Need only the boolean connectives (¬ , & ) and A X F G U (different choice from yesterday to follow Seger paper more closely) Define others e.g. EG p ⇔ ¬ AF ¬p E(p U q) ⇔ ¬ (A(¬ q U (¬ p & ¬ q)) ∨ AG(¬ q))

slide-8
SLIDE 8

CTL formula f H(f) set of states satisfying f

a (atomic) {s | a in L(s)} (cf.Lars)

slide-9
SLIDE 9

CTL formula f H(f) set of states satisfying f

a (atomic) {s | a in L(s)} (cf.Lars) ¬p S – H(p)

slide-10
SLIDE 10

CTL formula f H(f) set of states satisfying f

a (atomic) {s | a in L(s)} (cf.Lars) ¬p S – H(p) p & q H(p) ∩ H(q)

slide-11
SLIDE 11

CTL formula f H(f) set of states satisfying f

AX f {s | forall t sRt => t ∈ H(f)}

slide-12
SLIDE 12

Now gets harder

AG p  p & AX AG p Recursive Want to write something like H(AG p) = H(p) ∩ {s | forall t sRt => t ∈ H(AG p)} Doesn’t quite make sense, but nearly…

slide-13
SLIDE 13

want to find a set U such that U = H(p) ∩ {s | forall t sRt => t ∈ U } form is U = f(U ) We need to compute a fixed point (or fixpoint)

  • f function f
slide-14
SLIDE 14

Fixed points (Tarski)

If working in a complete lattice, and f monotonic, then the set of fixed points will also form a complete lattice. There will be a greatest fixed point Gfp U. f(U) and a least fixed point Lfp U. f(U) All is fine with the sets of states and functions on these sets that we are dealing with.

slide-15
SLIDE 15

Next question

Do we need a least or a greatest fixed point for U = H(p) ∩ {s | forall t sRt => t ∈ U} ? Answer is Gfp Idea: start with S (entire set of states) as first approx. Then compute f(S), f (f (S) until no change in set

slide-16
SLIDE 16

Conclusion

H(AG p) = Gfp U . H(p) ∩ {s | forall t sRt => t ∈ U}

slide-17
SLIDE 17

Fixed point iteration

P

slide-18
SLIDE 18

Fixed point iteration

p

p ∧ AX p

slide-19
SLIDE 19

Fixed point interation in the other direction

p

p ∧ AX (p ∧ AX p)

slide-20
SLIDE 20

Fixed point iteration

p

p ∧ AX (p ∧ AX (p ∧ AX p)

….

slide-21
SLIDE 21

AF

AF p  p ∨ AX AF P Same kind of pattern but this time need least fixed point (starting with empty set) H(AF p) = Lfp U. H(p) ∪ {s | forall t sRt => t ∈ U}

slide-22
SLIDE 22

Fixed point iteration

p

slide-23
SLIDE 23

Fixed point iteration

p ∨ AX p

p

slide-24
SLIDE 24

Fixed point iteration

p ∨ AX (p ∨ AX p)

p

slide-25
SLIDE 25

Fixed point iteration

Evetually stops!

P . . . .

slide-26
SLIDE 26

Similar story for Until

A (p U q) ⇔ q ∨ (p ∧ AX (A (p U q) )) H(A (p U q)) = Lfp U. H(q) ∪ (H(q) ∩ {s | forall t sRt . => t ∈ U})

slide-27
SLIDE 27

Rest are defined in terms of these

e.g. EG p ⇔ ¬ AF ¬p E(p U q) ⇔ ¬ (A(¬ q U ¬ p & ¬ q) ∨ AG(¬ q)) Put H around each side

slide-28
SLIDE 28

So far so good

Only talked about sets of states so far Will come back to concrete calculations with these What about BDDs to represent them??

slide-29
SLIDE 29

BDD based Symbolic MC

Sets of states relations between states BDDs

Fixed point characerisations of CTL ops NO explicit state graph

slide-30
SLIDE 30

A state

Vector of boolean variables (v1,v2,v3, …., vn) ∈ {0,1}n

slide-31
SLIDE 31

Boolean formulas

(x ⊕ y) ⊕ z (⊕ is exclusive or) (1 ⊕ 0) ⊕ 0 = 1 assignment [x=1,y=0,z=0] gives answer 1 is a model or satisfying assignment Write as 100 Exercise: Find another model

slide-32
SLIDE 32

Boolean formulas

(x ⊕ y) ⊕ z (1 ⊕ 1) ⊕ 0 = 0 assignment [x=1,y=1,z=0] is not a model

slide-33
SLIDE 33

Formula is a tautology if ALL assignments are models and is contradictory if NONE is.

slide-34
SLIDE 34

Boolean formulas

For us, interesting formulas are somewhere in between: some assignments are models, some not IDEA: A formula can represent a set of states (its models)

slide-35
SLIDE 35

{} false {111} x ∧ y ∧ z {101} x ∧ ¬y ∧ z {111,101} x ∧ z

. .

{000,001, … , 111} true

slide-36
SLIDE 36

Example

(x ⊕ y) ⊕ z represents {100,010,001,111} for states of the form xyz Exercise: Find formulas (with var. names x,y,z) for the sets {} {100} {110,100,010,000}

slide-37
SLIDE 37

What is needed now?

A good data structure for boolean formulas Have already seen Binary Decision Diagrams (BDDs)

Bryant (IEEE Trans. Comp. 86, most cited CS paper!) see also Bryant’s document about a Hitachi patent from 93 McMillan saw application to symbolic MC

slide-38
SLIDE 38

Represent a set of states

Just make the BDD for a corresponding formula!

slide-39
SLIDE 39

Represent a transition relation R

Remember that R is just a set of pairs of states Use two sets of variables, v and v’ (with the primed variables representing next states) Make a formula involving both v and v’ and from that a BDD bdd(R,(v,v’))

slide-40
SLIDE 40

What set of states can we reach from set P in one step?

P Image(P,R)

{t  ∃s s ∈ P ∧ s R t}

R R R R

slide-41
SLIDE 41

What set of states can we reach from set P in one step?

P Image(P,R)

{t  ∃s s ∈ P ∧ s R t}

R R R R bdd(Image(P,R),v’) = ∃ v bdd(P,v) ∧ bdd(R,(v,v’))

slide-42
SLIDE 42

So far

BDDs for 1) sets of states 2) transition relation 3) calculating forward image of a set

slide-43
SLIDE 43

Before we go on with MC, note that we can now compute Reachable States (see Hu paper)

Let T be the transition relation R0(v) = BDD for reset (or initial) state R1(v) = R0(v) ∨ bdd(Image(R0,T),v) … Ri+1(v) = Ri(v) ∨ bdd(Image(Ri,T),v) Will eventually converge with Ri+1(v) = Ri(v). Why???

slide-44
SLIDE 44

Before we go on with MC, note that we can now compute Reachable States (see Hu paper)

Let T be the transition relation R0(v) = BDD for reset (or initial) state R1(v) = R0(v) ∨ bdd(Image(R0,T),v) … Ri+1(v) = Ri(v) ∨ bdd(Image(Ri,T),v) Will eventually converge with Ri+1(v) = Ri(v). Why???

BDD or

slide-45
SLIDE 45

Before we go on with MC, note that we can now compute Reachable States (see Hu paper)

Let T be the transition relation R0(v) = BDD for reset (or initial) state R1(v) = R0(v) ∨ bdd(Image(R0,T),v) … Ri+1(v) = Ri(v) ∨ bdd(Image(Ri,T),v) Will eventually converge with Ri+1(v) = Ri(v).

Easy to check. Why?

slide-46
SLIDE 46

Back to MC

slide-47
SLIDE 47

CTL formula f H(f) set of states satisfying f

a (atomic) {s | a in L(s)} (cf.Lars) ¬p S – H(p) p & q H(p) ∩ H(q)

slide-48
SLIDE 48

CTL formula f H(f) set of states satisfying f

AX f {s | forall t sRt => t ∈ H(f)} All of the above operations easy to do with BDDs

slide-49
SLIDE 49

BDDs also fine in fixed point iterations

H(AF p) = Lfp U. H(p) ∪ {s | forall t sRt => t ∈ U} becomes U0 = empty set U1 = H(p) ∪ {s | forall t sRt => t ∈ U0} U2 = H(p) ∪ {s | forall t sRt => t ∈ U1} …

slide-50
SLIDE 50

All done with BDDS (and recursion and fixed point iteration)

slide-51
SLIDE 51

Example of manual calculation (from exam 2009)

slide-52
SLIDE 52

Example of manual calculation (from exam 2009)

y

slide-53
SLIDE 53

Example of manual calculation (from exam 2009)

y y’

slide-54
SLIDE 54

Example of manual calculation (from exam 2009)

z

slide-55
SLIDE 55

Example of manual calculation (from exam 2009)

z z’

slide-56
SLIDE 56

transitions

(x, y, z) -> (x’, y’, z’) y’ = (x ∧ y) ∨ ¬(y ∨ z) z’ = y

Show state transition diagram Calculate states in which EG y holds

slide-57
SLIDE 57

state transition graph

000 -> 010 110

slide-58
SLIDE 58

state transition graph

100 -> 010 110

slide-59
SLIDE 59

state transition graph

slide-60
SLIDE 60

H (EG y) = H (¬ AF ¬y) = S – H(AF ¬y) H(AF ¬y) = Lfp U. H(¬y) ∪ {s | forall t sRt => t in U} H(¬y )= {000,001,100,101}

slide-61
SLIDE 61

Fixed point iteration

U0 = empty set U1 = H(¬y) ∪ {s | forall t sRt => t in U0} = H(¬y) = {000,001,100,101} U2 = H(¬y) ∪ {s | forall t sRt => t in U1} = H(¬y) ∪ {011,010} U3 = H(¬y) ∪ {s | forall t sRt => t in U2} = H(¬y) ∪ {011,010}

slide-62
SLIDE 62

H(AF ¬y) = {000,001,100,101,011,010} Therefore, H (EG y) = S - H(AF ¬y) = {110,111}

slide-63
SLIDE 63

Example revisited

A sequence beginning with the assertion of signal strt, and containing two not necessarily consecutive assertions of signal get, during which signal kill is not asserted, must be followed by a sequence containing two assertions of signal put before signal end can be asserted AG~(strt & EX E[~get & ~kill U get & ~kill & EX E[~get & ~kill U get & ~kill & E[~put U end] or E[~put & ~end U (put & ~end & EX E[~put U end])]]])

slide-64
SLIDE 64

AG ~ ... strt & EX E[ ~get & ~kill U get & ~kill & ...] EX E [~get & ~kill U get & ~kill & ...] E[~put U end] or E[~put & ~end U (put & ~end & EX E[~put U end])]]

slide-65
SLIDE 65

AG ~ ... strt & EX E[ ~get & ~kill U get & ~kill & ...] EX E [~get & ~kill U get & ~kill & ...] E[~put U end] or E[~put & ~end U (put & ~end & EX E[~put U end])]] zero puts

slide-66
SLIDE 66

AG ~ ... strt & EX E[ ~get & ~kill U get & ~kill & ...] EX E [~get & ~kill U get & ~kill & ...] E[~put U end] or E[~put & ~end U (put & ~end & EX E[~put U end])]]

  • ne put