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