Professional Documents
Culture Documents
Tutorial I - An Introduction To Model Checking: Peng WU
Tutorial I - An Introduction To Model Checking: Peng WU
Tutorial I - An Introduction To Model Checking: Peng WU
Model Checking
Peng WU
INRIA Futurs
LIX, École Polytechnique
Outline
Model Checking
Temporal Logic
Model Checking Algorithms
Symbolic Model Checking
Advanced Topics
Symmetry Reduction
Partial-Order Reduction
Infinite Model Checking
Principles
Model
(System Requirements) Answer:
M |= p if (M): M, |= p
LTL
p
p p p p p p
p
p p p p p p p p p p p...
pUq
p p p p p p p p p q
pRq
q q q q q q q q q q,p
LTL Satisfiability
The satisfiability problem of LTL is
PSPACE-complete.
If a LTL formula is satisfiable, then the
formula is satisfiable by a finite kripke
model.
LTL Model Checking: PSAPCE-
complete
LTL Model Checking
ω-Regular Languages
ω-Automata
Finite states
Representing infinite executions
Büchi Automata
<Σ, S, Δ, I, L, F >
<AP, S, R , {s0}, L> - Kripke Model
M, s |= Ap if (s): M, |= p
M, s |= Ep if (s): M, |= p
CTL Semantics
M, |= Xp if M, 1 |= p
M, |= Fp if i≥0: M, i |= p
M, |= Gp if i≥0: M, i |= p
M, |= pUq if i≥0: M, i |= q and
j< i: M, j |= p
M, |= pRq if i≥0: M, i |= q or
i≥0: M, i |= p and
j≤i: M, j |= q
M |= p if M, s0 |= p
CTL Satisfiability
The satisfiability problem of CTL is
EXPTIME-complete.
If a CTL formula is satisfiable, then the
formula is satisfiable by a finite kripke
model.
CTL Model Checking: O(|p|·(|S|+|R|))
Equivalence
EXp EGp E(pUq)
---------------------------------------------------
AXp EXp
AFp EGp
AGp EFp
A(pRq) E(pUq)
A(pUq) E(pRq)
EFp E(true U p)
E(pRq) E(qU(pq))EGq
CTL Model Checking
Six Cases:
p is an atomic proposition
p = q
p = qr
p = EXq
p = EGq
p = E(qUr)
Extension of L – L’: S →2AP {subformulas of p}
CTL Model Checking
p is an atomic proposition:
L’(s) = L(s)
p = q :
L’(s) = L’(s) { p } if qL’(s)
p = qr :
L’(s) = L’(s) { p } if qL’(s) or rL’(s)
p = EX q :
L’(s) = L’(s) { p } if (s,s’)R: qL’(s’)
E(qUr)
procedure checkEU(q,r)
T := { s | r L(s) };
for (all s T) do L’(s) := L(s) { p };
while (T≠) do
choose s T;
T := T \ {s};
for (all t such that R(t,s)) do
if (p L’(t) and q L’(t)) then
q
BFS L’(t) := L(t) { p };
r
T := T { t };
Example: E(qUr)
r q
q q q,r
EGq
procedure checkEG(q)
S’ := { s | q L(s) };
SCC := { C | C is a non-trivial SCC of S’ };
T := { s | s some C of SCC };
for (all s T) do L’(s) := L(s) { p };
while (T≠) do
choose s T;
T := T \ {s};
for (all t such that t S’ and R(t,s)) do
if (p L’(t)) then
L’(t) := L(t) { p };
q
SCC T := T { t };
EG q
SCC
SCC
Example: EGq
r q
q q q,r
CTL*
State Formulas
p – atomic proposition
p, pq, pq
Ap, Ep if p is a path formula
Path Formulas
p if p is a state formula
p, pq, pq
Xp, Fp, Gp, pUq, pRq
CTL* Semantics – State
Formulas
M, s |= p if pL(s)
M, s |= p if not M, s |= p
M, s |= pq if M, s |= p and M, s |= p
M, s |= pq if M, s |= p or M, s |= p
M, s |= Ap if (s): M, |= p
M, s |= Ep if (s): M, |= p
CTL* Semantics – Path
Formulas
M, |= p if M, 0 |= p
(p is a state formula)
M, |= p if not M, |= p
M, |= pq if M, |= p and M, |= q
M, |= pq if M, |= p or M, |= q
CTL* Semantics – Path
Formulas
M, |= Xp if M, 1 |= p
M, |= Fp if i≥0: M, i |= p
M, |= Gp if i≥0: M, i |= p
M, |= pUq if i≥0: M, i |= q and
j< i: M, j |= p
M, |= pRq if i≥0: M, i |= q or
i≥0: M, i |= p and
j≤i: M, j |= q
X.p
, F(), F (),…, F ()=F
2 i i+1()
O(|p|·(|S|+|R|)·|S|k)
k: nesting depth
Emerson-Lei: O(|p|·(|S|+|R|)·(|p|·|S|)d)
Local Model Checking
Extension of Modal -Calculus
XW.p
X.p X.p
Let F be a function on 2S,
PX.F(X) iff PF(X.(PF(X)))
M, s |=V XW.p if
sW or, if not, M, s |=V p[XW{s}.p/X]
Tableau System
Fixpoint Equation System
Modal -Calculus Satisfiability
The satisfiability problem of modal -
calculus is EXPTIME-complete.
If a modal -calculus formula is
satisfiable, then the formula is
satisfiable by a finite kripke model.
Modal -Calculus Model Checking: O(?)
Symbolic Model Checking
State Space Explosion Problem
Reduce memory requirement by
utilizing compact representations of
states/transitions
Boolean formulas represent sets and
relations
Use fixed point characterizations of CTL
operators
Ordered Binary Decision
Diagram (OBDD)
a1
0 1
b1 b1
0 1 0 1
a2 a2 a2 a2
0 1 0 1 0 1 0 1
b2 b2 b2 b2 b2 b2 b2 b2
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
1 0 0 1 0 0 0 0 0 0 0 0 1 0 0 1
(a1 b1) (a2 b2)
Reduced OBDD
a1
0 1
b1 b1
0 1 0 1
a2 a2 a2 a2
0 1 0 1 0 1 0 1
b2 b2 b2 b2 b2 b2 b2 b2
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
1 0 0 1 0 0 0 0 0 0 0 0 1 0 0 1
(a1 b1) (a2 b2)
Reduced Ordered BDD
a1
0 1
b1 b1
0 1 0 1
a2 a2 a2
0 1 0 1 0 1
b2 b2 b2 b2 b2 b2
0 1 0 1 0 1 0 1 0 1 0 1
1 0 0 1 0 0 0 0 0 1 0 0 1
(a1 b1) (a2 b2)
Reduced Ordered BDD
a1
0 1
b1 b1
0 1 0 1
a2 a2
0 1 0 1
b2 b2 b2 b2
0 1 0 1 0 1 0 1
1 0 0 1 0 1 0 0 1
(a1 b1) (a2 b2)
Reduced Ordered BDD
a1
0 1
b1 b1
0 1 1 0
a2
0 1
b2 b2
0 1 0 1
1 0 0 1 0
(a1 b1) (a2 b2)
Reduced Ordered BDD
a1
0 1
b1 b1
0 1 1
a2 0
0 1
b2 b2
0 11 0
1 0
(a1 b1) (a2 b2)
Representation for States
States as Boolean Formulas
2m states encoded by m proposition variables
State - conjunction of proposition or negative
proposition
Set of States – conjunction of state (encoding)
formula
Example: m = 2, S={s1,s2,s3,s4}
Proposition Variables {a, b}
S={00, 01, 10, 11}={ab, a b, ab, ab}
{s1,s2}={00, 01}=(ab)(ab)
Representation for Transitions
Transitions as Boolean Formulas
(s, s’) encoded by two sets of proposition
variables
Transition – conjunction of s and s’
Set of Transitions – conjunction of
transition (encoding) formula
Example
(s4,s3) = (11, 10) = aba’b’
Symbolic Model Checking
Atomic Propositions
ROBDD(p) = {s | pL(s)}
ROBDD(p) = reversion of ROBDD(p)
ROBDD(pq) = ROBDD (p)ROBDD(q)
is or
ROBDD(EXp(v)) = v’:[p(v’)R(v, v’)]
(E(pUq)) = Z.[q(pEX Z)]
(EGp) = Z.[pEX Z]
Genealogy
Floyd/Hoare Aristotle 300’s BCE
late 60s Kripke 59
Logics of Temporal/
Programs Modal Logics
Büchi, 60
Tarski 50’s
w-automata Pnueli
late 70’s Clarke/Emerson Park, 60’s
S1S Early 80’s
Kurshan Vardi/Wolper -Calculus
mid 80’s CTL Model
LTL Model Checking
Bryant, mid 80’s
ATV
Checking QBF BDD
Symbolic
Model Checking late 80’s
Anything Else?
Model Checking
Temporal Logic
Model Checking Algorithms
Symbolic Model Checking
Advanced Topics
Symmetry Reduction
Partial Order Reduction
Infinite Model Checking
Symmetry Reduction
If state space is symmetric, explore only a
symmetric “quotient” of the state space
A permutation is an automorphism of M if
for any s1,s2S,
R(s1,s2) R((s1), (s2))
G is an automorphism group for M iff every
permutation G is an automorphism of M.
An automorphism group G is an invariance
group for an atomic proposition p iff for any
G, sS, pL(s) pL((s))
Quotient Models
G – Automorphism Group
Orbit - (s) = {t | G: (s)=t}
MG=(SG, (s0), RG, LG)
SG={(s) | sS}
RG={((s1), (s2)) | (s1, s2)R}
LG((s))=L(rep((s))) – representative
If G is an invariance group for all the atomic
propositions occurring in a CTL* formula p, then
M, s |= p iff MG, (s) |= p
The orbit problem is as hard as the Graph
Isomorphism problem, which is in NP.
Partial Order Reduction
Reduce the number of interleavings of
independent concurrent transitions
Enabledness + Commutativity
s s s
a b a b a
s1 s2 s1 s2 s1
b a b b
r r r