10123
|
1 |
(*<*)theory Base = Main:(*>*)
|
|
2 |
|
|
3 |
section{*A verified model checker*}
|
|
4 |
|
|
5 |
text{*
|
|
6 |
Model checking is a very popular technique for the verification of finite
|
|
7 |
state systems (implementations) w.r.t.\ temporal logic formulae
|
|
8 |
(specifications) \cite{Clark}. Its foundations are completely set theoretic
|
|
9 |
and this section shall develop them in HOL. This is done in two steps: first
|
|
10 |
we consider a very simple ``temporal'' logic called propositional dynamic
|
|
11 |
logic (PDL) which we then extend to the temporal logic CTL used in many real
|
|
12 |
model checkers. In each case we give both a traditional semantics (@{text \<Turnstile>}) and a
|
|
13 |
recursive function @{term mc} that maps a formula into the set of all states of
|
|
14 |
the system where the formula is valid. If the system has a finite number of
|
|
15 |
states, @{term mc} is directly executable, i.e.\ a model checker, albeit not a
|
|
16 |
very efficient one. The main proof obligation is to show that the semantics
|
|
17 |
and the model checker agree.
|
|
18 |
|
|
19 |
Our models are transition systems.
|
|
20 |
|
|
21 |
START with simple example: mutex or something.
|
|
22 |
|
|
23 |
Abstracting from this concrete example, we assume there is some type of
|
|
24 |
atomic propositions
|
|
25 |
*}
|
|
26 |
|
|
27 |
typedecl atom
|
|
28 |
|
|
29 |
text{*\noindent
|
|
30 |
which we merely declare rather than define because it is an implicit parameter of our model.
|
|
31 |
Of course it would have been more generic to make @{typ atom} a type parameter of everything
|
|
32 |
but fixing @{typ atom} as above reduces clutter.
|
|
33 |
|
|
34 |
Instead of introducing both a separate type of states and a function
|
|
35 |
telling us which atoms are true in each state we simply identify each
|
|
36 |
state with that set of atoms:
|
|
37 |
*}
|
|
38 |
|
|
39 |
types state = "atom set";
|
|
40 |
|
|
41 |
text{*\noindent
|
|
42 |
Finally we declare an arbitrary but fixed transition system, i.e.\ relation between states:
|
|
43 |
*}
|
|
44 |
|
|
45 |
consts M :: "(state \<times> state)set";
|
|
46 |
|
|
47 |
text{*\noindent
|
|
48 |
Again, we could have made @{term M} a parameter of everything.
|
|
49 |
*}
|
|
50 |
(*<*)end(*>*)
|