CDA 5416 : CAV Symbolic CTL Model Checking Hao Zheng Department of - - PowerPoint PPT Presentation

cda 5416 cav
SMART_READER_LITE
LIVE PREVIEW

CDA 5416 : CAV Symbolic CTL Model Checking Hao Zheng Department of - - PowerPoint PPT Presentation

CDA 5416 : CAV Symbolic CTL Model Checking Hao Zheng Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: zheng@cse.usf.edu Phone: (813)974-4757 Fax: (813)974-5456 Hao Zheng ( Department of


slide-1
SLIDE 1

CDA 5416: CAV

Symbolic CTL Model Checking Hao Zheng

Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: zheng@cse.usf.edu Phone: (813)974-4757 Fax: (813)974-5456

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: zheng@cse.usf.edu CDA 5416: CAV 1 / 18

slide-2
SLIDE 2

1

Switching Functions

2

Symbolic Encoding

3

Symbolic Model Checking Algorithms

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: zheng@cse.usf.edu CDA 5416: CAV 2 / 18

slide-3
SLIDE 3

Explicit Algorithms

  • Transition systems are stored as graphs using hash tables.
  • States are labeled with appropriate AP/subformlas.
  • Complexity of model checking algorithms is linear in the structure

sizes.

  • Structure size can be exponential!
  • Problems
  • Demand of large amount of memory.
  • Low performance.

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: zheng@cse.usf.edu CDA 5416: CAV 3 / 18

slide-4
SLIDE 4

Symbolic CTL Model Checking

  • Idea: reformulate model-checking in a symbolic way.
  • Concept: represent sets of states and transitions symbolically.
  • Approach: binary encoding of states + switching functions for sets.
  • Compact representation of switching functions is possible using

binary decision diagrams (BDDs).

  • Alternative representation is the conjunctive normal form which is

the basis for SAT-based model checking.

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: zheng@cse.usf.edu CDA 5416: CAV 4 / 18

slide-5
SLIDE 5

Contents

1

Switching Functions

2

Symbolic Encoding

3

Symbolic Model Checking Algorithms

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: zheng@cse.usf.edu CDA 5416: CAV 5 / 18

slide-6
SLIDE 6

Switching Functions

  • Let Var = {z1, . . . , zm} be a finite set of Boolean variables, m ≥ 0.
  • An evaluation is a function η : Var → { 0, 1 }.
  • Let Eval(z1, . . . , zm) denote the set of evaluations for z1, . . . , zm.
  • Shorthand [z1 = b1, . . . , zm = bm] for η(z1) = b1, . . . , η(zm) = bm.
  • f : Eval(Var) → { 0, 1 } is a switching function for

Var = {z1, . . . , zm}.

  • Can be defined by Boolean expressions, i.e. (z1 ∨ ¬z2) ∧ z3

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: zheng@cse.usf.edu CDA 5416: CAV 6 / 18

slide-7
SLIDE 7

Switching Functions: Definitions

  • f1 ∧ f2 = min{ f1, f2 }
  • f1 ∨ f2 = max{ f1, f2 }
  • f |zi=bi(z1, . . . , zi, . . . , zm) = f (z1, . . . , bi, . . . , zm)

(cofactor).

  • f |zi=bi,...,zk=bk = ((f |zi=bi) . . .)|zk=bk

(iterated cofactor).

  • If f |zi=0 = f |zi=1 then zi is an

essential variable.

  • f = (¬z ∧ f |z=0) ∨ (z ∧ f |z=1)

(Shannon expansion).

  • ∃z. f

= f |z=0 ∨ f |z=1 (existential quantification).

  • ∀z. f

= f |z=0 ∧ f |z=1 (universal quantification).

  • f {z ← y}(s) = f (s{y ← z})

(rename operator).

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: zheng@cse.usf.edu CDA 5416: CAV 7 / 18

slide-8
SLIDE 8

Switching Functions: Examples

Let f (z1, z2, z3) = z1 ∧ (¬z2 ∨ z3)

  • f |z1=1 = ¬z2 ∨ z3, and f |z1=0 = 0.
  • z1 is essentail for f .
  • Quantification

∃z1.f = f |z1=0 ∨ f |z1=1 = ¬z2 ∨ z3 ∀z1.f = f |z1=0 ∧ f |z1=1 = 0

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: zheng@cse.usf.edu CDA 5416: CAV 8 / 18

slide-9
SLIDE 9

Switching Functions: Examples

Let f (z1, z2, z3) = z1 ∧ (¬z2 ∨ z3)

  • Shannon expansion

f = (¬z1 ∧ f |z1=0) ∨ (z1 ∧ f |z1=1)

z1 z2 z2 z3 z3 z3 z3 1 1 1

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: zheng@cse.usf.edu CDA 5416: CAV 9 / 18

slide-10
SLIDE 10

Contents

1

Switching Functions

2

Symbolic Encoding

3

Symbolic Model Checking Algorithms

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: zheng@cse.usf.edu CDA 5416: CAV 10 / 18

slide-11
SLIDE 11

Symbolic Representation of TS

  • Let TS = (S, →, I, AP, L) be a “large” finite transition system.

Note: the set of actions is irrelevant and has been omitted, i.e., →⊆ S × S.

  • For n ≥ ⌈log |S|⌉, let injective function enc : S → { 0, 1 }n.

Note: enc(S) = {0, 1}n is no restriction, as all elements { 0, 1 }n \ enc(S) can be treated as the encoding of pseudo states that are unreachable.

  • Identify:
  • The states s ∈ S = enc−1({ 0, 1 }n) with enc(s) ∈ {0, 1}n.
  • B ⊆ S by its characteristic function χB : { 0, 1 }n → { 0, 1 }, that is

χB(enc(s)) = 1 if and only if s ∈ B.

  • → ⊆ S × S by the Boolean function ∆ : { 0, 1 }2n → { 0, 1 }, such

that ∆ (enc(s), enc(s′)) = 1 if and only if s → s′.

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: zheng@cse.usf.edu CDA 5416: CAV 11 / 18

slide-12
SLIDE 12

Symbolic Representation of TS: Example

/

s0 s1 s3 s2 a b

{a,b}

  • Four states: two Boolean variables needed for encoding, i.e. x1, x2.

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: zheng@cse.usf.edu CDA 5416: CAV 12 / 18

slide-13
SLIDE 13

Symbolic Representation of TS: Example

/

s0 s1 s3 s2 a b

{a,b}

  • State encoding:

fS = 1

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: zheng@cse.usf.edu CDA 5416: CAV 12 / 18

slide-14
SLIDE 14

Symbolic Representation of TS: Example

/

s0 s1 s3 s2 a b

{a,b}

  • Switching function: ∆(x1, x2

s

, x′

1, x′ 2 s′

) = 1 if and only if s → s′ ∆(x1, x2, x′

1, x′ 2) =

( ¬ x1 ∧ ¬ x2 ∧ ¬ x′

1 ∧ x′ 2)

∨ ( ¬ x1 ∧ ¬ x2 ∧ x′

1 ∧ x′ 2)

∨ ( ¬ x1 ∧ x2 ∧ x′

1 ∧ ¬ x′ 2)

∨ . . . ∨ (x1 ∧ x2 ∧ x′

1 ∧ x′ 2)

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: zheng@cse.usf.edu CDA 5416: CAV 12 / 18

slide-15
SLIDE 15

Another Encoding Example

MODULE main VAR request : boolean; state : {ready, busy}; ASSIGN init(state) := ready; next(state) := case state = ready & request = 1 : busy; 1 : {ready, busy}; esac;

  • Boolean variables, x1, x2.
  • x1 ↔ (request = 1),

¬x1 ↔ (request = 0), x2 ↔ (state = ready), ¬x2 ↔ (state = busy)

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: zheng@cse.usf.edu CDA 5416: CAV 13 / 18

slide-16
SLIDE 16

Another Encoding Example

MODULE main VAR request : boolean; state : {ready, busy}; ASSIGN init(state) := ready; next(state) := case state = ready & request = 1 : busy; 1 : {ready, busy}; esac;

  • Initial state: (x1 ∨ ¬x1) ∧ x2 = x2.

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: zheng@cse.usf.edu CDA 5416: CAV 13 / 18

slide-17
SLIDE 17

Another Encoding Example

MODULE main VAR request : boolean; state : {ready, busy}; ASSIGN init(state) := ready; next(state) := case state = ready & request = 1 : busy; 1 : {ready, busy}; esac;

  • Transition relation:

∆( x, x′) = (state=ready ∧ request=1 → state′ = busy)∧ (¬(state=ready ∧ request=1) → ((state′ = ready) ∨ (state′ = busy))

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: zheng@cse.usf.edu CDA 5416: CAV 13 / 18

slide-18
SLIDE 18

Another Encoding Example

MODULE main VAR request : boolean; state : {ready, busy}; ASSIGN init(state) := ready; next(state) := case state = ready & request = 1 : busy; 1 : {ready, busy}; esac;

  • Transition relation:

∆( x, x′) = (x2 ∧ x1 → ¬x′

2) ∧ (¬(x2 ∧ x1) → (x′ 2 ∨ ¬x′ 2))

= (x2 ∧ x1 → ¬x′

2) ∧ (¬(x2 ∧ x1))

= (x2 ∧ x1 → ¬x′

2)

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: zheng@cse.usf.edu CDA 5416: CAV 13 / 18

slide-19
SLIDE 19

Contents

1

Switching Functions

2

Symbolic Encoding

3

Symbolic Model Checking Algorithms

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: zheng@cse.usf.edu CDA 5416: CAV 14 / 18

slide-20
SLIDE 20

Symbolic Model Checking

  • Take a symbolic representation of a transition system (∆ and χB).
  • Backward reachability Pre∗(B) = { s ∈ S | s |

= ∃♦ B }.

  • Sat(∃ B) = Pre(B).
  • Initially: f0 = χB that characterizes the set T0 = B.
  • Then, successively compute the functions fj+1 = χTj+1 for:

Tj+1 = Tj ∪ {s ∈ S | ∃s′ ∈ S. s′ ∈ Post(s) ∧ s′ ∈ Tj }

  • Second set is given by: ∃x′. ( ∆(x, x′)

s′ ∈ Post(s)

∧ fj(x′)

s′∈Tj

).

  • fj(x′) is fj after renaming the variables xi to their primed copies x′

i .

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: zheng@cse.usf.edu CDA 5416: CAV 15 / 18

slide-21
SLIDE 21

Preimage Computatioin: Example

/

s0 s1 s3 s2 a b

{a,b}

∆(x1, x2, x′

1, x′ 2) =

( ¬ x1 ∧ ¬ x2 ∧ ¬ x′

1 ∧ x′ 2)

∨ ( ¬ x1 ∧ ¬ x2 ∧ x′

1 ∧ x′ 2)

∨ ( ¬ x1 ∧ x2 ∧ x′

1 ∧ ¬ x′ 2)

∨ . . . ∨ (x1 ∧ x2 ∧ x′

1 ∧ x′ 2)

Compute Preimage of s2 (x1 ∧ ¬x2)

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: zheng@cse.usf.edu CDA 5416: CAV 16 / 18

slide-22
SLIDE 22

Preimage Computatioin: Example

/

s0 s1 s3 s2 a b

{a,b}

∃x′

1, x′ 2, ∆(x1, x2, x′ 1, x′ 2) ∧ x′ 1 ∧ ¬x′ 2 =

∃x′

1, x′ 2,

    

( ¬ x1 ∧ ¬ x2 ∧ ¬ x′

1 ∧ x′ 2)

∨ ( ¬ x1 ∧ ¬ x2 ∧ x′

1 ∧ x′ 2)

∨ ( ¬ x1 ∧ x2 ∧ x′

1 ∧ ¬ x′ 2)

∨ . . . ∨ (x1 ∧ x2 ∧ x′

1 ∧ x′ 2)

     ∧ (x′

1 ∧ ¬x′ 2)

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: zheng@cse.usf.edu CDA 5416: CAV 16 / 18

slide-23
SLIDE 23

Preimage Computatioin: Example

/

s0 s1 s3 s2 a b

{a,b}

∃x′

1, x′ 2,

 

(x1 ∧ x2 ∧ x′

1 ∧ ¬x′ 2)

∨ (¬x1 ∧ x2 ∧ x′

1 ∧ ¬x′ 2)

∨ (x1 ∧ ¬x2 ∧ x′

1 ∧ ¬x′ 2)

 

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: zheng@cse.usf.edu CDA 5416: CAV 16 / 18

slide-24
SLIDE 24

Preimage Computatioin: Example

/

s0 s1 s3 s2 a b

{a,b}

(x1 ∧ x2) ∨ (¬x1 ∧ x2) ∨ (x1 ∧ ¬x2) =x1 ∨ x2

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: zheng@cse.usf.edu CDA 5416: CAV 16 / 18

slide-25
SLIDE 25

Symbolic Computation of Sat(∃(C U B))

f0(x) := χB(x); j := 0; repeat fj+1(x) := fj(x) ∨

  • χC(x) ∧ ∃x′. ( ∆(x, x′) ∧ fj(x′) )
  • ;

j := j + 1 until fj(x) = fj−1(x); return fj(x).

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: zheng@cse.usf.edu CDA 5416: CAV 17 / 18

slide-26
SLIDE 26

Symbolic Computation of Sat(∃ B)

Compute the largest set T ⊆ B with Post(t) ∩ T = ∅ for all t ∈ T Take T0 = B and Tj+1 = Tj ∩ {s ∈ S | ∃s′ ∈ S. s′ ∈ Post(s) ∧ s′ ∈ Tj }

Symbolically this amounts to: f0(x) := χB(x); j := 0; repeat fj+1(x) := fj(x) ∧ ∃x′. ( ∆(x, x′) ∧ fj(x′) ); j := j + 1 until fj(x) = fj−1(x); return fj(x).

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: zheng@cse.usf.edu CDA 5416: CAV 18 / 18