11235
|
1 |
theory Sets = Main:
|
|
2 |
|
|
3 |
section{*Sets, Functions and Relations*}
|
|
4 |
|
|
5 |
subsection{*Set Notation*}
|
|
6 |
|
|
7 |
term "A \<union> B"
|
|
8 |
term "A \<inter> B"
|
|
9 |
term "A - B"
|
|
10 |
term "a \<in> A"
|
|
11 |
term "b \<notin> A"
|
|
12 |
term "{a,b}"
|
|
13 |
term "{x. P x}"
|
|
14 |
term "{x+y+eps |x y. x < y}"
|
|
15 |
term "\<Union> M"
|
|
16 |
term "\<Union>a \<in> A. F a"
|
|
17 |
|
|
18 |
subsection{*Functions*}
|
|
19 |
|
|
20 |
thm id_def
|
|
21 |
thm o_assoc
|
|
22 |
thm image_Int
|
|
23 |
thm vimage_Compl
|
|
24 |
|
|
25 |
|
|
26 |
subsection{*Relations*}
|
|
27 |
|
|
28 |
thm Id_def
|
|
29 |
thm converse_comp
|
|
30 |
thm Image_def
|
|
31 |
thm relpow.simps
|
|
32 |
thm rtrancl_idemp
|
|
33 |
thm trancl_converse
|
|
34 |
|
|
35 |
subsection{*Wellfoundedness*}
|
|
36 |
|
|
37 |
thm wf_def
|
|
38 |
thm wf_iff_no_infinite_down_chain
|
|
39 |
|
|
40 |
|
|
41 |
subsection{*Fixed Point Operators*}
|
|
42 |
|
|
43 |
thm lfp_def gfp_def
|
|
44 |
thm lfp_unfold
|
|
45 |
thm lfp_induct
|
|
46 |
|
|
47 |
|
|
48 |
subsection{*Case Study: Verified Model Checking*}
|
|
49 |
|
|
50 |
|
|
51 |
typedecl state
|
|
52 |
|
|
53 |
consts M :: "(state \<times> state)set";
|
|
54 |
|
|
55 |
typedecl atom
|
|
56 |
|
|
57 |
consts L :: "state \<Rightarrow> atom set"
|
|
58 |
|
|
59 |
datatype formula = Atom atom
|
|
60 |
| Neg formula
|
|
61 |
| And formula formula
|
|
62 |
| AX formula
|
|
63 |
| EF formula
|
|
64 |
|
|
65 |
consts valid :: "state \<Rightarrow> formula \<Rightarrow> bool" ("(_ \<Turnstile> _)" [80,80] 80)
|
|
66 |
|
|
67 |
primrec
|
|
68 |
"s \<Turnstile> Atom a = (a \<in> L s)"
|
|
69 |
"s \<Turnstile> Neg f = (\<not>(s \<Turnstile> f))"
|
|
70 |
"s \<Turnstile> And f g = (s \<Turnstile> f \<and> s \<Turnstile> g)"
|
|
71 |
"s \<Turnstile> AX f = (\<forall>t. (s,t) \<in> M \<longrightarrow> t \<Turnstile> f)"
|
|
72 |
"s \<Turnstile> EF f = (\<exists>t. (s,t) \<in> M\<^sup>* \<and> t \<Turnstile> f)";
|
|
73 |
|
|
74 |
consts mc :: "formula \<Rightarrow> state set";
|
|
75 |
primrec
|
|
76 |
"mc(Atom a) = {s. a \<in> L s}"
|
|
77 |
"mc(Neg f) = -mc f"
|
|
78 |
"mc(And f g) = mc f \<inter> mc g"
|
|
79 |
"mc(AX f) = {s. \<forall>t. (s,t) \<in> M \<longrightarrow> t \<in> mc f}"
|
|
80 |
"mc(EF f) = lfp(\<lambda>T. mc f \<union> (M\<inverse> `` T))"
|
|
81 |
|
|
82 |
lemma mono_ef: "mono(\<lambda>T. A \<union> (M\<inverse> `` T))"
|
|
83 |
apply(rule monoI)
|
|
84 |
apply blast
|
|
85 |
done
|
|
86 |
|
|
87 |
lemma EF_lemma:
|
|
88 |
"lfp(\<lambda>T. A \<union> (M\<inverse> `` T)) = {s. \<exists>t. (s,t) \<in> M\<^sup>* \<and> t \<in> A}"
|
|
89 |
apply(rule equalityI)
|
|
90 |
thm lfp_lowerbound
|
|
91 |
apply(rule lfp_lowerbound)
|
|
92 |
apply(blast intro: rtrancl_trans);
|
|
93 |
apply(rule subsetI)
|
|
94 |
apply(simp, clarify)
|
|
95 |
apply(erule converse_rtrancl_induct)
|
|
96 |
thm lfp_unfold[OF mono_ef]
|
|
97 |
apply(subst lfp_unfold[OF mono_ef])
|
|
98 |
apply(blast)
|
|
99 |
apply(subst lfp_unfold[OF mono_ef])
|
|
100 |
apply(blast)
|
|
101 |
done
|
|
102 |
|
|
103 |
theorem "mc f = {s. s \<Turnstile> f}";
|
|
104 |
apply(induct_tac f);
|
|
105 |
apply(auto simp add:EF_lemma);
|
|
106 |
done;
|
|
107 |
|
|
108 |
text{*
|
|
109 |
\begin{exercise}
|
|
110 |
@{term AX} has a dual operator @{term EN}\footnote{We cannot use the customary @{text EX}
|
|
111 |
as that is the \textsc{ascii}-equivalent of @{text"\<exists>"}}
|
|
112 |
(``there exists a next state such that'') with the intended semantics
|
|
113 |
@{prop[display]"(s \<Turnstile> EN f) = (EX t. (s,t) : M & t \<Turnstile> f)"}
|
|
114 |
Fortunately, @{term"EN f"} can already be expressed as a PDL formula. How?
|
|
115 |
|
|
116 |
Show that the semantics for @{term EF} satisfies the following recursion equation:
|
|
117 |
@{prop[display]"(s \<Turnstile> EF f) = (s \<Turnstile> f | s \<Turnstile> EN(EF f))"}
|
|
118 |
\end{exercise}
|
|
119 |
*}
|
|
120 |
|
|
121 |
end
|
|
122 |
|
|
123 |
|