10122
|
1 |
(*<*)theory PDL = Base:(*>*)
|
9958
|
2 |
|
10122
|
3 |
subsection{*Propositional dynmic logic---PDL*}
|
9958
|
4 |
|
10133
|
5 |
text{*
|
|
6 |
The formulae of PDL are built up from atomic propositions via the customary
|
|
7 |
propositional connectives of negation and conjunction and the two temporal
|
|
8 |
connectives @{text AX} and @{text EF}. Since formulae are essentially
|
|
9 |
(syntax) trees, they are naturally modelled as a datatype:
|
|
10 |
*}
|
9958
|
11 |
|
10133
|
12 |
datatype pdl_form = Atom atom
|
|
13 |
| NOT pdl_form
|
|
14 |
| And pdl_form pdl_form
|
|
15 |
| AX pdl_form
|
|
16 |
| EF pdl_form;
|
|
17 |
|
|
18 |
text{*\noindent
|
|
19 |
The meaning of these formulae is given by saying which formula is true in
|
|
20 |
which state:
|
|
21 |
*}
|
|
22 |
|
|
23 |
consts valid :: "state \<Rightarrow> pdl_form \<Rightarrow> bool" ("(_ \<Turnstile> _)" [80,80] 80)
|
9958
|
24 |
|
|
25 |
primrec
|
10133
|
26 |
"s \<Turnstile> Atom a = (a \<in> L s)"
|
9958
|
27 |
"s \<Turnstile> NOT f = (\<not>(s \<Turnstile> f))"
|
|
28 |
"s \<Turnstile> And f g = (s \<Turnstile> f \<and> s \<Turnstile> g)"
|
|
29 |
"s \<Turnstile> AX f = (\<forall>t. (s,t) \<in> M \<longrightarrow> t \<Turnstile> f)"
|
|
30 |
"s \<Turnstile> EF f = (\<exists>t. (s,t) \<in> M^* \<and> t \<Turnstile> f)";
|
|
31 |
|
10133
|
32 |
text{*
|
|
33 |
Now we come to the model checker itself. It maps a formula into the set of
|
|
34 |
states where the formula is true and is defined by recursion over the syntax:
|
|
35 |
*}
|
|
36 |
|
|
37 |
consts mc :: "pdl_form \<Rightarrow> state set";
|
9958
|
38 |
primrec
|
10133
|
39 |
"mc(Atom a) = {s. a \<in> L s}"
|
9958
|
40 |
"mc(NOT f) = -mc f"
|
10133
|
41 |
"mc(And f g) = mc f \<inter> mc g"
|
9958
|
42 |
"mc(AX f) = {s. \<forall>t. (s,t) \<in> M \<longrightarrow> t \<in> mc f}"
|
10133
|
43 |
"mc(EF f) = lfp(\<lambda>T. mc f \<union> M^-1 ^^ T)"
|
|
44 |
|
9958
|
45 |
|
10133
|
46 |
text{*
|
|
47 |
Only the equation for @{term EF} deserves a comment: the postfix @{text"^-1"}
|
|
48 |
and the infix @{text"^^"} are predefined and denote the converse of a
|
|
49 |
relation and the application of a relation to a set. Thus @{term "M^-1 ^^ T"}
|
|
50 |
is the set of all predecessors of @{term T} and @{term"mc(EF f)"} is the least
|
|
51 |
set @{term T} containing @{term"mc f"} and all predecessors of @{term T}.
|
|
52 |
*}
|
|
53 |
|
|
54 |
lemma mono_lemma: "mono(\<lambda>T. A \<union> M^-1 ^^ T)"
|
9958
|
55 |
apply(rule monoI);
|
|
56 |
by(blast);
|
|
57 |
|
|
58 |
lemma lfp_conv_EF:
|
10133
|
59 |
"lfp(\<lambda>T. A \<union> M^-1 ^^ T) = {s. \<exists>t. (s,t) \<in> M^* \<and> t \<in> A}";
|
9958
|
60 |
apply(rule equalityI);
|
|
61 |
apply(rule subsetI);
|
|
62 |
apply(simp);
|
|
63 |
apply(erule Lfp.induct);
|
|
64 |
apply(rule mono_lemma);
|
|
65 |
apply(simp);
|
|
66 |
apply(blast intro: r_into_rtrancl rtrancl_trans);
|
|
67 |
apply(rule subsetI);
|
|
68 |
apply(simp);
|
|
69 |
apply(erule exE);
|
|
70 |
apply(erule conjE);
|
|
71 |
apply(erule_tac P = "t\<in>A" in rev_mp);
|
|
72 |
apply(erule converse_rtrancl_induct);
|
|
73 |
apply(rule ssubst[OF lfp_Tarski[OF mono_lemma]]);
|
|
74 |
apply(blast);
|
|
75 |
apply(rule ssubst[OF lfp_Tarski[OF mono_lemma]]);
|
|
76 |
by(blast);
|
|
77 |
|
|
78 |
theorem "mc f = {s. s \<Turnstile> f}";
|
|
79 |
apply(induct_tac f);
|
|
80 |
by(auto simp add:lfp_conv_EF);
|
10133
|
81 |
(*<*)end(*>*)
|