Model-Checking: A Tutorial Introduction: January 1999
Model-Checking: A Tutorial Introduction: January 1999
net/publication/221477319
CITATIONS READS
139 1,267
3 authors, including:
Some of the authors of this publication are also working on these related projects:
All content following this page was uploaded by Bernhard Steffen on 01 June 2014.
1 Introduction
In the last two decades model-checking [11,34] has emerged as a promising and
powerful approach to automatic verification of systems. Roughly speaking, a
model checker is a procedure that decides whether a given structure M is a
model of a logical formula φ, i.e. whether M satisfies φ, abbreviated M |= φ.
Intuitively, M is an (abstract) model of the system in question, typically a finite
automata-like structure, and φ, typically drawn from a temporal or modal logic,
specifies a desirable property. The model-checker then provides a push-button
approach for proving that the system modeled by M enjoys this property. This
full automation together with the fact that efficient model-checkers can be con-
structed for powerful logics, forms the attractiveness of model-checking.
The above “generic” description of model-checking leaves room for refine-
ment. What exactly is a model to be checked? What kind of formulas are used?
What is the precise interpretation of satisfaction, |=? We present a rough map
over the various answers to these questions, and in the process, we introduce the
main approaches.
The various model-checking approaches provide a cornucopia of generic deci-
sion procedures that can be applied to scenarios that go far beyond the problem
domains for which the approaches were originally invented. (The work of some of
the authors on casting data flow analysis questions as model-checking problems
is an example [35].) We intend to provide a practitioner with a basis she can use
to translate problems into model structures and formulas that can be solved by
model checking.
The rest of this article is organized as follows: In the next section we dis-
cuss the model structures underlying model-checking—Kripke structures, labeled
transition systems and a structure combining both called Kripke transition sys-
tems. Section 3 surveys the spectrum of the logics used for specifying properties
to be automatically checked for model structures. We then introduce three basic
approaches to model-checking: the semantic or iterative approach, the automata-
theoretic approach, and the tableau method. The paper finishes with a number
of concluding remarks.
2 Models
Model-checking typically depends on a discrete model of a system—the system’s
behavior is (abstractly) represented by a graph structure, where the nodes rep-
resent the system’s states and the arcs represent possible transitions between the
states. It is common to abstract from the identity of the nodes. Graphs alone
are too weak to provide an interesting description, so they are annotated with
more specific information. Two approaches are in common use: Kripke struc-
tures, where the nodes are annotated with so-called atomic propositions, and
labeled transition systems (LTS), where the arcs are annotated with so-called
actions. We study these two structures and introduce a third called Kripke tran-
sition systems, which combines Kripke structures and labeled transition systems
and which is often more convenient for modeling purposes.
ity (“may”). In this use of a Kripke structure, the states correspond to different
“worlds” in which different basic facts (the atomic propositions) are true; tran-
sitions represent reachability between worlds. The assertion that some fact is
possibly true is interpreted to mean there is a reachable state (world) in which
the fact holds; the assertion that a fact is necessarily true means that the fact
holds in all reachable worlds. Kripke showed that the axioms and rules in dif-
ferent systems of modal logics correspond to properties that hold in different
classes of Kripke structures [28,29]. These logical settings for Kripke structures
(in particular, the notion of “worlds”) can provide useful guidance for expressing
computing applications as Kripke structures [5,16].
Kripke Transition Systems. Labels on arcs appear naturally when the labeling
models the dynamics of a system, whereas labels on node appear naturally when
the labeling models static properties of states. There are various ways to encode
arc labelings by node labelings and vice versa. (One of them is described below.)
And, logical considerations usually can be translated between these two repre-
sentations. For these reasons, theoretical analyses study just one form of labeling.
For modeling purposes, however, it is often natural to have both kinds of labeling
available. Therefore, we introduce a third model structure that combines labeled
transition systems and Kripke structures.
A Kripke transition system (KTS) over a set AP of atomic propositions is a
structure T = (S, Act, →, I), where S is a set of states, Act is a set of actions,
→⊆ S × Act × S is a transition relation and I : S → 2AP is an interpretation.
For technical reasons we assume that AP and Act are disjoint. Kripke transition
systems generalize both Kripke structures and labeled transition systems: A
Kripke structure is a Kripke transition system with an empty set of actions,
Act, and a labeled transition system is a Kripke transition system with a trivial
interpretation, I.
Kripke transition systems work well for modeling sequential imperative pro-
grams for data flow analysis purposes, as they concisely express the implied
predicate transformer scheme: nodes express the predicates or results of the
considered analysis, and edges labeled with the statements express the nodes’
Model-Checking 333
{true} {y}
z:=0 z:=0
i:=0 i:=0
{z=i*x} {i,y}
i!=y i=y i!=y i=y
3 Logics
π |= p iff p ∈ I(π0 )
π |= ¬φ iff π 6|= φ
π |= φ1 ∨ φ2 iff π |= φ1 or π |= φ2
π |= X(φ) iff |π| > 1 and π 1 |= φ
π |= U(φ, ψ) iff there is k, 0 ≤ k < |π|, with π k |= ψ and for all i, 0 ≤ i < k, π i |= φ
π |= F(φ) iff there is k, 0 ≤ k < |π|, with π k |= ψ
π |= G(φ) iff for all k with 0 ≤ k < |π|, π k |= ψ
φ
X(φ): ...
φ φ φ φ φ φ
G(φ): ...
φ
F(φ): ...
φ φ φ ψ
U(φ, ψ): ...
φ φ φ ψ
WU(φ, ψ): . . . or
φ φ φ φ φ φ
...
φ
a ... a ...
a a
[a]φ: φ haiφ: φ
.. ..
a . a .
φ
We also write [ ] for [Act] and h i for hActi. A version of HML suitable for Kripke
structures would provide just the modalities [ ] and h i.
338 M. Müller-Olm, D. Schmidt, and B. Steffen
Here, X ranges over Var and a over Act. The two fixpoint operators, µX and νX,
bind free occurrences of variable X. We will apply the usual terminology of free
and bound variables in a formula, closed and open formulas, etc. Given a least
(resp., greatest) fixpoint formula, µX . φ (νX . φ), we say that the µ (ν) is the
formula’s parity.
The above grammar does not permit negations in formulas. Of course, nega-
tion is convenient for specification purposes, but negation-free formulas, known
as formulas in positive form, are more easily handled by model-checkers. In most
logics, formulas with negation can easily be transformed into equivalent formulas
in positive form by driving negations inwards to the atomic propositions with
duality laws like
MT (true)(ρ) = S
MT (false)(ρ) = ∅
a
MT ([a]φ)(ρ) = {s | ∀s0 : s → s0 ⇒ s0 ∈ MT (φ)(ρ)}
a
MT (haiφ)(ρ) = {s | ∃s0 : s → s0 ∧ s0 ∈ MT (φ)(ρ)}
MT (φ1 ∧ φ2 )(ρ) = MT (φ1 )(ρ) ∩ MT (φ2 )(ρ)
MT (φ1 ∨ φ2 )(ρ) = MT (φ1 )(ρ) ∪ MT (φ2 )(ρ)
MT (X)(ρ) = ρ(X)
MT (µX . φ)(ρ) = fixµ Fφ,ρ
MT (νX . φ)(ρ) = fixν Fφ,ρ
set. These sets can be characterized as the least and greatest fixpoints, fixµ Fφ,ρ
and fixν Fφ,ρ , of the functional Fφ,ρ : 2S → 2S defined by
Here, ρ[X 7→ x] denotes, for a set x ⊆ S and a variable X ∈ Var, the environment
that maps X to x and that coincides on the other variables with ρ. We now must
review the basic theory of fixpoints.
Computational Tree Logic. Computational Tree Logic (CTL) was the first
temporal logic for which an efficient model-checking procedure was proposed
[11]. Its syntax looks as follows:
CTL has the six modalities AU, EU, AF, EF, AG, AF. Each takes the form QL,
where Q is one of the path quantifiers A and E, and L is one of the linear-time
modalities U, F, and G. The path quantifier provides a universal (A) or existential
(E) quantification over the paths emanating from a state, and on these paths the
corresponding linear-time property must hold. For example, the formula EF(φ)
is true for a state, s, if there is a path, π, starting in s on which φ becomes
true at some later situation; i.e., the path π has to satisfy π |= F(φ) in the sense
of PLTL. In contrast, AF(φ) holds if on all paths starting in s φ becomes true
finally.
The meaning of the CTL modalities can be expressed by means of fixpoint
formulas. In this sense, CTL provides useful abbreviations for frequently used
formulas of the modal µ-calculus. Here are the fixpoint definitions of the U
modalities:
def
AU(φ, ψ) = µX . (ψ ∨ (φ ∧ [ ]X ∧ h itrue))
def
EU(φ, ψ) = µX . (ψ ∨ (φ ∧ h iX)) .
and the G modalities are easily defined as the duals of the F modalities:
def def
AG(φ) = ¬EF(¬φ) EG(φ) = ¬AG(¬φ) .
342 M. Müller-Olm, D. Schmidt, and B. Steffen
4 Model Checking
4.1 Global vs. Local Model-Checking
There are two ways in which the model-checking problem can be specified:
the problem, and the part of the structure that is not inspected need not even
be constructed. Thus, local model-checking is one means for fighting the state-
explosion problem.
For other applications, like the use of model-checking for data-flow analysis,
one is really interested in solving the global question, as the very purpose of the
model-checking activity is to gain knowledge about all the states of a structure.
(For example, in Figure 2, the structure is the flow graph of the program to be
analyzed, and the property specified by a formula might be whether a certain
variable is “definitely live.”) Such applications use structures that are rather
small in comparison to those arising in verification activities, and the state-
explosion problem holds less importance. Global methods are preferred in such
situations.
1. Associate all variables belonging to greatest fixpoints to the full set of states
S and all variables belonging to least fixpoints with ∅.
2. Choose a subformula, φ = µX.φ0 (or νX.φ0 ), where φ0 is fixpoint free, de-
termine its semantics, and replace it by an atomic proposition Aφ , whose
valuation is defined by its semantics.
3. Repeat the second step until the whole formula is processed.
def
We illustrate this hierarchical procedure for φ = AF{b} (EF{b} (haitrue) and
the following transition system T :
b
b b a
s t u v
b
Intuitively φ describes the property that from all states reachable via b-transition,
an a-transition is finitely reachable along a path of b-transitions; u and v enjoy
this property while s and t do not.
Unfolding the CTL-like operators in φ using the corresponding fixpoint def-
initions, we obtain
A hierarchical model-checker first evaluates (µY . haitrue ∨ hbiY ), the inner fix-
point formula: Letting φY denote the formula haitrue ∨ hbiY ), we have, for any
environment ρ,
MT (φ)(ρ) = fixµ FφY ,ρ .
Model-Checking 345
Now, by the Kleene fixpoint theorem this fixpoint formula can be calculated
by iterated application of FφY ,ρ to the smallest element in 2S , ∅. Here are the
resulting approximations:
Fφ0Y ,ρ (∅) = ∅
Fφ1Y ,ρ (∅) = M(haitrue)(ρ[Y 7→ ∅]) ∪ M(hbiY )(ρ[Y 7→ ∅])
= {u} ∪ ∅ = {u}
2
FφY ,ρ (∅) = FφY ,ρ ({u})
= M(haitrue)(ρ[Y 7→ {u}]) ∪ M(hbiY )(ρ[Y 7→ {u}])
= {u} ∪ {t, u, v} = {t, u, v}
Fφ3Y ,ρ (∅) = FφY ,ρ ({t, u, v})
= M(haitrue)(ρ[Y 7→ {t, u, v}]) ∪ M(hbiY )(ρ[Y 7→ {t, u, v}])
= {u} ∪ {t, u, v} = {t, u, v} .
Fφ0X ,ρ (S) = S
Fφ1X ,ρ (S) = M(pY )(ρ[X 7→ S]) ∩ M([b]X)(ρ[X 7→ S])
= {t, u, v} ∩ S = {t, u, v}
2
FφY ,ρ (S) = FφY ,ρ ({t, u, v})
= M(pY )(ρ[X 7→ {t, u, v}]) ∩ M([b]X)(ρ[X 7→ {t, u, v}])
= {t, u, v} ∩ {s, u, v} = {u, v}
Fφ3Y ,ρ (S) = FφY ,ρ ({u, v})
= M(pY )(ρ[X 7→ {u, v}]) ∩ M([b]X)(ρ[X 7→ {u, v}])
= {t, u, v} ∩ {s, u, v} = {u, v} .
The model-checking confirms our expectation that just states u and v have
property φ.
In the above example, the inner fixpoint formula, (µY . haitrue ∨ hbiY ), does
not use the variable introduced by the outer fixpoint operator, X. Therefore,
its value does not depend on the environment, ρ. This is always the case for
CTL-like formulas and enables the hierarchical approach to work correctly. If,
however, the inner fixpoint depends on the variable introduced further outwards,
we must—at least in principle—evaluate the inner fixpoint formula again and
again in each iteration of the outer formula. Fortunately, if the fixpoint formulas
have the same parity, i.e., they are either both least fixpoint formulas or both
greatest fixpoint formulas, we can avoid the problem and correctly compute the
346 M. Müller-Olm, D. Schmidt, and B. Steffen
values of the inner and outer formulas simultaneously, because the value of a
fixpoint formula depends monotonically on the value of its free variables and the
iterations of both formulas proceed in the same direction.
In the case of mutual dependencies between least and greatest fixpoints,
however, the iterations proceed in opposite directions, which excludes a simple
monotonic iteration process. Such formulas are called alternating fixpoint formu-
las. They require backtracking (or resets) in the iteration process. The following
is a minimal illustrative example.
def
Example 1. Consider the formula ψ = νZ . µY . (hbiZ ∨ haiY ), which intuitively
specifies that there is a path consisting of a- and b-steps with infinitely many
b-steps. We would like to check it for the following LTS:
b
s t a
Here are the results of the iterations for the outer fixpoint variable Z with
the nested iterations for Y :
Iteration for Z 1 2 3
Assumption for Z {s, t} {t} ∅
Iterations for Y ∅ {t} {t} ∅ ∅ ∅ ∅
Iteration for Z 1 2
Assumption for Z {s, t} {t}
Iterations for Y ∅ {t} {t} {t} {t}
q true
r
p q q∧r q
p∧r
p p
{P,Q} {P,Q}
1 3 1 3
2 2
Automata construction, Complementation
F(P) & G(Q)
Determinization, and
Minimization {},{P},{Q},{P,Q} {},{P},{Q},{P,Q}
Q P,Q Q Q P,Q
1 2 3 1 2 3
{P,Q} {P,Q}
{P,Q} {P,Q}
{P,Q} {P,Q}
32 32
{P,Q} {P,Q}
Fig. 11. Two Kripke structures, the corresponding automata, and their products with
the formula automaton from Fig. 10. Model-checking succeeds for the left Kripke struc-
ture and fails for the right one.
automaton in the figure is Aφ , the automaton that accepts the language over
2{P,Q} corresponding to φ. Complementation of a finite automaton is partic-
ularly simple if the automaton is deterministic and fully defined, because the
automaton has for any state exactly one transition for any input symbol. An au-
tomaton can be made deterministic by the well-known power-set construction;
full definedness can be obtained by adding a (non-final) state that “catches”
all undefined transitions. The automaton Aφ shown in Fig. 10 has been made
deterministic and is fully defined; to keep it small, it has also been minimized.
Such transformations preserve the language accepted by the automaton and are
admissible and commonly applied. The second automaton in Fig. 10, to which
we refer by Acφ in the following, accepts the complement of the language corre-
sponding to φ. As Aφ has been made deterministic and is fully defined, it can
easily be complemented by exchanging final and non-final states.
In Fig. 11, we show two rooted Kripke structures K, the corresponding Au-
tomata AK , and the product automata Acφ × AK .1 In order to allow easy com-
parison, the states in Acφ × AK have been named by pairs ij; i indicates the
corresponding state in Acφ and j the corresponding state in AK .
It is intuitively clear that the left Kripke structure satisfies φ. An automata-
theoretic model-checker would analyze whether the language of Acφ × AK is
empty. Here, it would check whether a final state is reachable from the initial
state. It is easy to see that no final state is reachable; this means that K indeed
satisfies φ.
Now, consider the rooted right Kripke structure in Fig. 11. As its final state
does not satisfy the atomic proposition, Q, the Kripke structure does not satisfy
φ—a final state is reachable from the initial state in the product automaton.
The tableau approach addresses the local-model checking problem: For a model,
M, and property, φ, we wish to learn whether s |=M φ holds for just the one
state, s—global information is unneeded. We might attack the problem by a
1
Strictly speaking, only that part of the state space is shown that is reachable from
the initial state, and not the full product automaton.
350 M. Müller-Olm, D. Schmidt, and B. Steffen
search of the state space accessible from s, driving the search by decomposing
φ. We write our query as s `∆ φ (taking the M as implicit) and use subgoaling
rules, like the following, to generate a proof search, a tableau. For the moment,
the rules operate on just the Hennessy-Milner calculus; the subscript, ∆, will be
explained momentarily:
s `∆ φ1 ∧ φ2 s `∆ φ1 ∨ φ2 s `∆ φ1 ∨ φ2
s `∆ φ1 s `∆ φ2 s `∆ φ1 s `∆ φ2
s `∆ [a]φ a s `∆ haiφ a
if {s1 , . . . , sn } = {s0 | s → s0 } if s → s0
s1 `∆ φ · · · sn `∆ φ s0 `∆ φ
A tableau for a Hennessy-Milner formula must be finite. We say that the tableau
succeeds if all its leaves are successful, that is, they have form (i) s `∆ true, or
(ii) s `∆ [a]φ (which implies there are no a-transitions from s).
It is easy to prove that a succesful tableau for s `∆ φ implies s |=M φ; con-
M
versely, if there exists no successful tableau, we correctly conclude that s6 |= φ.
(Of course, a proof search that implements and/or subgoaling builds just one
“meta-tableau” to decide the query.)
When formulas in the modal-mu calculus are analyzed by tableau, there is
the danger of infinite search. But for finite-state models, we can limit search due
to the semantics of the fixed-point operators: Say that s `∆ µX.φX subgoals to
s `∆ X. We conclude that the latter subgoal is unsuccessful, because
_ X0 = false
s |=M µX.φX iff s |=M Xi , where
Xi+1 = φXi
i≥0
That is, the path in the tableau from s `∆ µX.φX to s `∆ X can be unfolded
an arbitrary number of times, generating the Xi formulas, all of which subgoal
to X0 , which fails.
Dually, a path from s `∆ νX.φX to s `∆ X succeeds, because
^ X0 = true
s |=M νX.φX iff s |=M Xi , where
Xi+1 = φXi
i≥0
Transition system:
Tableau for s `∅ φ :
b a s `∅ φ
s t s `∆1 U1
b s `∆1 φ0U1 ∧ [b]U1
s `∆1 φ0U1 s `∆1 [b]U1
Let : s `∆2 U2 s `∆1 U1
φ = νX.φ0X ∧ [b]X s `∆2 haitrue ∨ hbiU2
φ0X = µY.haitrue ∨ hbiY s `∆2 haitrue
∆1 = [U1 7→ φ] t `∆2 true
∆2 = ∆1 + [U2 7→ φ0U1 ]
Note: The second rule can be applied only when s `∆0 U has not already ap-
peared as an ancestor goal. This is how proof search is terminated.
A leaf of form, s `∆ U, is successful iff ∆(U) = νX.φX . Figure 12 shows a
small transition system and proof by tableau that its state, s, has the property,
νX.(µY.haitrue ∨ hbiY ) ∧ [b]X, that is, an a-transition is always finitely reachable
along a path of b-transitions. The tableau uses no property of state, t.
The tableau technique is pleasant because it is elegant, immune to the trou-
bles of alternating fixpoints, and applicable to both branching-time and linear-
time logics.
5 Conclusion
details that are irrelevant for verification, see, e.g., [15,9,22,30]. Abstraction is
particularly effective when it is combined with the other techniques.
In this article we have focused on finite model structures, but recent research
shows that effective model-checking is possible also for certain classes of finitely
presented infinite structures. Work in this direction falls in two categories: First,
continuous variables have been added to finite structures. This work was moti-
vated by considerations on verified design of embedded controllers. Timed sys-
tems have found much attention (Alur and Dill’s work on timed automata [1]
is a prominent example) but also more general classes of hybrid systems have
been considered. A study of this work could start with [38] where besides a gen-
eral introduction three implemented systems, HyTech, Kronos, and Uppaal, are
described. Second, certain classes of discrete infinite systems have been studied
that are generated by various types of grammars in various ways. The interested
reader is pointed to the surveys [8,7] that also contain numerous references.
References
1. R. Alur and D. L. Dill, A theory of timed automata. Theoretical Computer Science
126 (1994) 183–235.
2. H. Andersen, C. Stirling, and G. Winskel, A compositional proof system for the
modal mu-calculus. In Proc. 9th LICS. IEEE Computer Society Press, 1994.
3. G. Birkhoff, Lattice Theory, 3d edition. Amer. Math. Soc., 1967.
4. R. Bryant, Graph-based algorithms for boolean function manipulation. IEEE
Transactions on Computation, 8(35), 1986.
5. R. Bull and K. Segerberg, Basic Modal Logic. In Handbook of Philosophical Logic,
Vol. 2, D. Gabbay and F. Guenther, eds., Kluwer, Dortdrecht, 1994, pp. 1-88.
6. J. Burch, E. Clarke, K. McMillan, D. Dill, and L. Hwang, Symbolic model checking:
1020 states and beyond. In Proc. 5th LICS. IEEE Computer Society Press, 1990.
7. O. Burkart, D. Caucal, F. Moller, and B. Steffen, Verification on infinite structures.
In Handbook of Process algebra, Jan Bergstra, Alban Ponse, and Scott Smolka, eds.,
Elsevier, to appear.
8. O. Burkart and J. Esparza, More infinite results. Electronic Notes in Theoretical
Computer Science 6 (1997).
URL: http://www.elsevier.nl/locate/entcs/volume6.html.
9. K. Čerāns, J.C. Godesken, and K.G. Larsen, Timed modal specification – theory
and tools. In Computer Aided Verification (CAV’93), C. Courcoubetis, ed., Lecture
Notes in Computer Science 697, Springer, 1993, pp. 253–267.
10. E. Clarke, D. Long, and K. McMillan, Compositional model checking. In Proc. 4th
LICS. IEEE Computer Society Press, 1989.
11. E. M. Clarke, E. A. Emerson, and A. P. Sistla, Automatic verification of finite-
state concurrent systems using temporal logic specifications. ACM Transactions
on Programming Languages and Systems 8 (1996) 244–263.
12. E. M. Clarke, O. Grumberg, and D. Long, Verification tools for finite-state con-
current systems. In A Decade of Concurrency: Reflections and Perspectives, J.W.
de Bakker, W.-P. de Roever, and G. Rozenberg, eds., Lecture Notes in Computer
Science 803, Springer, 1993, pp. 124-175.
13. R. Cleaveland, M. Klein, and B. Steffen, Faster model checking for the modal mu-
calculus. In Computer Aided Verification (CAV’92), G. v. Bochmann and D. K.
Probst, eds., Lecture Notes in Computer Science 663, 1992, pp. 410–422.
Model-Checking 353
35. D. Schmidt and B. Steffen, Program analysis as model checking of abstract in-
terpretations. In Static Analysis (SAS’98), Giorgio Levi, ed., Lecture Notes in
Computer Science 1503, Springer, 1998, 351–380.
36. C. Stirling, Modal and temporal logics. In Handbook of Logic in Computer Science
S. Abramsky, Dov M. Gabbay, and T. S. E. Maibaum, eds., Clarendon Press, 1992,
pp 477–563.
37. C. Stirling and D. Walker, Local model checking in the modal mu-calculus, Proc.
TAPSOFT ’89, J. Diaz and F. Orejas, eds., Lecture Notes in Computer Science
351, Springer, 1989, pp. 369–383.
38. Special section on timed and hybrid systems, Software Tools for Technology Trans-
fer 1 (1997) 64–153.
39. Special section on model checking, Software Tools for Technology Transfer 2/3
(1999).
40. A. Tarski, A lattice-theoretical fixpoint theorem and its application. Pacific Journal
of Mathematics 5 (1955) 285–309.
41. W. Thomas, Automata on infinite objects. In Handbook of Theoretical Computer
Science, Vol B. J. van Leeuwen, ed., Elsevier Science Publishers B.V., 1990,
pp. 133–191.
42. M. Y. Vardi and P. Wolper, Reasoning about infinite computations. Information
and Computation 115 (1994) 1–37.
43. A. Valmari, On-the-fly verification with stubborn sets. In Computer Aided Veri-
fication (CAV’93), C. Courcoubetis, ed., Lecture Notes in Computer Science 697,
Springer, pp. 397–408.