Professional Documents
Culture Documents
Lecture #11: Model Checking I
Lecture #11: Model Checking I
Topics 1) Formal Verification Overview 2) Model Checking Overview 3) Computational Tree Logics
Why Verification??
Design Validation aims to ensure that the design of a computer system, eg. software, hardware or communication protocols, is correct.
Implementation Validation aims to ensure that the implementation of such a computer system is correct.
The traditionally practiced methods for both design validation and implementation validation are the techniques of simulation and testing.
Those methods are effective in the very early stages of debugging. But those methods can never offer the guarantee of the correctness. An alternative to simulation and testing is the approach of formal verification.
While simulation and testing explore some of the possible behavior of the system, formal verification conducts an exhaustive exploration of all possible behaviors.
Formal Verification
Formal verification techniques can be thought of as comprising three parts:
1) A framework for modeling system, typically a description language of some sort; 2) A specification language for describing the properties to be verified; 3) A verification method to establish whether the description of a system satisfies the specification.
In a proof-based approach, the verification method consists of trying to find a proof |- where represents the model and represents the specification.
In a model-based approach, the system is represented by a finite model M for an appropriate logic.
The specification is again represented by a formula and the verification method consists of computing whether a model M satisfies
. (M |= )
Model Checking
Model Checking is an automatic technique for finite state concurrent systems. Developed independently by Clarke and Emerson, and by Queille and Sifakis in early 1980s. Specification is written in propositional temporal logic. Verification procedure is an exhaustive search of the state space of the design.
Model of Computation
State Transition System is the model of Temporal Logic. The model contains several states and transition between states. A state contains current values of something that we are interested in, eg. current values of variables in a program, actual states of physical devices, etc. A formula can be true in some states and false in others. A transition between states represents a computation step. Consider the figure for Microwave Oven.
Clarkes System
Model the system using a description language of a model checker, arriving at a model M. Code the property using the specification language of the model checker, resulting in a temporal logic formula . Run the model checker with input M and . Consider the Clarkes model checker system.
10
11
12
13
Model of Computation
Formally, a Kripke structure is a triple M = (S, R, L), where o S is the set of states, o R S S is the transition relation, and o L : S P(AP) gives the set AP of atomic propositions true in each state. For example, let S = {s0, s1, s2} and R = { (s0, s2), (s2, s2), (s1, s2), (s1, s0), (s0,s1) }. L(s0) = {p, q} L(s1) = {q, r} L(s2) = {r}. This model is illustrated as a graph in figure 3.2. We assume that R is total (ie. for all states s S there exists a state s
15
2) Linear time operators : Xp p holds next time Fp p holds sometime in the future Gp p holds globally in the future pUq p holds until q holds.
16
17
State formulae
If f is a state formula, the notation M, s |= f means that f holds at state s in the Kripke structure M. Assume f1 and f2 are state formulae and g is a path formula. The relation M, s |= f is defined inductively as follows: 1) s |= p iff p L(s) 2) s |= f1 iff it is not true that s |= f1 3) s |= f1 f2 iff s |= f1 or s |= f2 4) s |= Eg iff there exists a path starting with s such that |= g. 5) s |= Ag iff for all paths starting with s, |= g.
18
Path Formulae
If f is a path formula, M, |= f means that f holds along path in Kripke structure M. Assume g1 and g2 are path formulae and f is a state formula. The relation M, |= f is defined inductively as follows: 1) |= f iff s is the first state of and s |= f. 2) |= g1 iff it is not the case that |= g1. 3) |= g1 g2 iff |= g1 or |= g2. 4) |= Xg1 iff 1 |= g1. 5) |= Gg1 iff for all i 0, i |= g1. 6) |= Fg1 iff there exists i 0 such that i |= g1. 7) |= (g1 U g2) iff there exists i 0 such that
19
t0 |= Ep
t0 |= Ap t0, t1, t2, t2, t2, |= (p q) t0, t1, t2, t2, t2, |= G(p q r) t0, t1, t2, t2, t2, |= X( q r) t0, t1, t0, t2, t2, |= q U q t0 |= EX (q r) (because t1 |= q r ) (because t2 |= q but t0 and t1 |= q) (because t0 |= (p q))
t0 |= AX r t0 |= EF (p q)
20
Standard Abbreviations
Af is equivalent to E(f) This is because A represents the universal quantification on paths whereas E represents the existential quantification on paths. In first-order predicate logic, X p(X) is equivalent to X p(X). Gf is equivalent to F(f). This is because G represents the universal quantification of states in a path whereas F stands for the existential quantification of states in a path. Ff is equivalent to (T U f)
21
CTL
CTL is a restricted subset of CTL* that permits only branching-time operators each of the linear-time operators G, F, X, and U must be immediately preceded by a path quantifier. For example, AG(EF p) Note that we will focus on CTL in this course. More precisely, CTL is the subset of CTL* that is obtained by restricting the syntax of path formulae. The rule for the syntax of path formulae is as follows: If f and g are state formulae, then Xf, Ff, Gf and f U g are path formulae. In summary, the syntax of CTL is defined by the following. Definition 1 We define CTL formula inductively via a Backus Naur form.
::= | T | p | () | ( ) | ( ) | () | AX | EX |
A[ U ] | E[ U ] | AG | EG | AF | EF.
where p ranges over atomic formulae. There are eight basic CTL operators:
22
LTL
LTL consists of formulae that have the form Af where f is a path formula in which the only state subformulae permitted are atomic propositions. For example, A(FG p) More precisely, an LTL path formula is defined by the following: If p AP, then p is a path formula. If f and g are path formulae, then f, f g, Xf, Ff, Gf and are path formulae. Note that the semantics for path quantifiers and linear-time operators in CTL*, CTL and LTL are defined identically. fUg
23
Expressive Power
It can be shown that the three logics, namely CTL*, CTL, LTL, have different expressive powers. For example, there is no CTL formula that is equivalent to the LTL formula A(FG p). Like wise, there is no LTL formula that is equivalent to the CTL formula AG(EF p). The disjunction A(FG p) AG(EF p) is a CTL* formula that is not expressible in either CTL or LTL.
24
Example of CTL
Consider the model in figure 3.2, the following holds. M, t0 |= EX (q r) M, t0 |= AX (q r) M, t0 |= EF (p r) M, t2 |= EG r M, t2 |= AG r M, t0 |= AF r M, t0 |= E( (p q) U r) M, t0 |= A(p U r)
25
EF(started ready)
For any state, if a requested (of some resource) occurs, then it will eventually be acknowledged:
AG(requested AF acknowledged)
A certain process is enabled infinitely often on every computation path:
AG(AF enabled)
Note that AG enabled means that a process is always enabled infinitely. AF enabled : eventually enabled on every computation path. Whatever happens, a certain process will eventually be permanently deadlocked:
AF(AG deadlock)
From any state it is possible to get to a restart state:
AG(EF restart)
Note that EF restart means that it is possible to get to a restart state from a specific state (possibly from the initial state).
26
The elevator can remain idle on the third floor with its doors closed:
27
AF EG AG EF
On any particular path, each state has a unique successor. Therefore, X is its own dual on computation paths and we have
AX EX
We also have the equivalence
AF A(T U )
EF E(T U )
The connective AX can be written EX and AG, AF, EG and EF can be written in terms of AU and EU.
AG EF E(T U ) EG AF A(T U )
28
A[p U q] (E (p U (p q) ) EG q)
In other words, AU can be represented by EU and EG. Theorem 1 The set of operator , and together with AU, EU and
EX are adequate for CTL: any CTL formula can be transformed into a
semantically equivalent CTL formula which uses only those logical connectives This is because EG can be represented by AF.
29