10123
|
1 |
%
|
|
2 |
\begin{isabellebody}%
|
|
3 |
\def\isabellecontext{Base}%
|
|
4 |
%
|
10867
|
5 |
\isamarkupsection{Case Study: Verified Model Checking%
|
10395
|
6 |
}
|
10123
|
7 |
%
|
|
8 |
\begin{isamarkuptext}%
|
10362
|
9 |
\label{sec:VMC}
|
10867
|
10 |
This chapter ends with a case study concerning model checking for
|
|
11 |
Computation Tree Logic (CTL), a temporal logic.
|
|
12 |
Model checking is a popular technique for the verification of finite
|
10795
|
13 |
state systems (implementations) with respect to temporal logic formulae
|
10867
|
14 |
(specifications) \cite{ClarkeGP-book,Huth-Ryan-book}. Its foundations are set theoretic
|
|
15 |
and this section will explore them in HOL\@. This is done in two steps. First
|
10178
|
16 |
we consider a simple modal logic called propositional dynamic
|
10867
|
17 |
logic (PDL), which we then extend to the temporal logic CTL, which is
|
|
18 |
used in many real
|
10123
|
19 |
model checkers. In each case we give both a traditional semantics (\isa{{\isasymTurnstile}}) and a
|
|
20 |
recursive function \isa{mc} that maps a formula into the set of all states of
|
|
21 |
the system where the formula is valid. If the system has a finite number of
|
10867
|
22 |
states, \isa{mc} is directly executable: it is a model checker, albeit an
|
|
23 |
inefficient one. The main proof obligation is to show that the semantics
|
10123
|
24 |
and the model checker agree.
|
|
25 |
|
10133
|
26 |
\underscoreon
|
10123
|
27 |
|
10133
|
28 |
Our models are \emph{transition systems}, i.e.\ sets of \emph{states} with
|
|
29 |
transitions between them, as shown in this simple example:
|
|
30 |
\begin{center}
|
|
31 |
\unitlength.5mm
|
|
32 |
\thicklines
|
|
33 |
\begin{picture}(100,60)
|
|
34 |
\put(50,50){\circle{20}}
|
|
35 |
\put(50,50){\makebox(0,0){$p,q$}}
|
|
36 |
\put(61,55){\makebox(0,0)[l]{$s_0$}}
|
|
37 |
\put(44,42){\vector(-1,-1){26}}
|
|
38 |
\put(16,18){\vector(1,1){26}}
|
|
39 |
\put(57,43){\vector(1,-1){26}}
|
|
40 |
\put(10,10){\circle{20}}
|
|
41 |
\put(10,10){\makebox(0,0){$q,r$}}
|
|
42 |
\put(-1,15){\makebox(0,0)[r]{$s_1$}}
|
|
43 |
\put(20,10){\vector(1,0){60}}
|
|
44 |
\put(90,10){\circle{20}}
|
|
45 |
\put(90,10){\makebox(0,0){$r$}}
|
|
46 |
\put(98, 5){\line(1,0){10}}
|
|
47 |
\put(108, 5){\line(0,1){10}}
|
|
48 |
\put(108,15){\vector(-1,0){10}}
|
|
49 |
\put(91,21){\makebox(0,0)[bl]{$s_2$}}
|
|
50 |
\end{picture}
|
|
51 |
\end{center}
|
|
52 |
Each state has a unique name or number ($s_0,s_1,s_2$), and in each
|
|
53 |
state certain \emph{atomic propositions} ($p,q,r$) are true.
|
|
54 |
The aim of temporal logic is to formalize statements such as ``there is no
|
10186
|
55 |
path starting from $s_2$ leading to a state where $p$ or $q$
|
|
56 |
are true'', which is true, and ``on all paths starting from $s_0$ $q$ is always true'',
|
|
57 |
which is false.
|
10123
|
58 |
|
|
59 |
Abstracting from this concrete example, we assume there is some type of
|
10281
|
60 |
states:%
|
10133
|
61 |
\end{isamarkuptext}%
|
|
62 |
\isacommand{typedecl}\ state%
|
|
63 |
\begin{isamarkuptext}%
|
|
64 |
\noindent
|
10281
|
65 |
Command \isacommand{typedecl} merely declares a new type but without
|
|
66 |
defining it (see also \S\ref{sec:typedecl}). Thus we know nothing
|
|
67 |
about the type other than its existence. That is exactly what we need
|
|
68 |
because \isa{state} really is an implicit parameter of our model. Of
|
|
69 |
course it would have been more generic to make \isa{state} a type
|
|
70 |
parameter of everything but declaring \isa{state} globally as above
|
|
71 |
reduces clutter. Similarly we declare an arbitrary but fixed
|
10867
|
72 |
transition system, i.e.\ a relation between states:%
|
10133
|
73 |
\end{isamarkuptext}%
|
|
74 |
\isacommand{consts}\ M\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequote}{\isacharparenleft}state\ {\isasymtimes}\ state{\isacharparenright}set{\isachardoublequote}%
|
|
75 |
\begin{isamarkuptext}%
|
|
76 |
\noindent
|
|
77 |
Again, we could have made \isa{M} a parameter of everything.
|
|
78 |
Finally we introduce a type of atomic propositions%
|
10123
|
79 |
\end{isamarkuptext}%
|
|
80 |
\isacommand{typedecl}\ atom%
|
|
81 |
\begin{isamarkuptext}%
|
|
82 |
\noindent
|
10133
|
83 |
and a \emph{labelling function}%
|
10123
|
84 |
\end{isamarkuptext}%
|
10133
|
85 |
\isacommand{consts}\ L\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequote}state\ {\isasymRightarrow}\ atom\ set{\isachardoublequote}%
|
10123
|
86 |
\begin{isamarkuptext}%
|
|
87 |
\noindent
|
10133
|
88 |
telling us which atomic propositions are true in each state.%
|
10123
|
89 |
\end{isamarkuptext}%
|
|
90 |
\end{isabellebody}%
|
|
91 |
%%% Local Variables:
|
|
92 |
%%% mode: latex
|
|
93 |
%%% TeX-master: "root"
|
|
94 |
%%% End:
|