4 types state = "atom set";
6 datatype ctl_form = Atom atom
8 | And ctl_form ctl_form
13 consts valid :: "state \<Rightarrow> ctl_form \<Rightarrow> bool" ("(_ \<Turnstile> _)" [80,80] 80)
14 M :: "(state \<times> state)set";
16 constdefs Paths :: "state \<Rightarrow> (nat \<Rightarrow> state)set"
17 "Paths s \<equiv> {p. s = p 0 \<and> (\<forall>i. (p i, p(i+1)) \<in> M)}";
20 "s \<Turnstile> Atom a = (a\<in>s)"
21 "s \<Turnstile> NOT f = (~(s \<Turnstile> f))"
22 "s \<Turnstile> And f g = (s \<Turnstile> f \<and> s \<Turnstile> g)"
23 "s \<Turnstile> AX f = (\<forall>t. (s,t) \<in> M \<longrightarrow> t \<Turnstile> f)"
24 "s \<Turnstile> EF f = (\<exists>t. (s,t) \<in> M^* \<and> t \<Turnstile> f)"
25 "s \<Turnstile> AF f = (\<forall>p \<in> Paths s. \<exists>i. p i \<Turnstile> f)";
27 constdefs af :: "state set \<Rightarrow> state set \<Rightarrow> state set"
28 "af A T \<equiv> A \<union> {s. \<forall>t. (s, t) \<in> M \<longrightarrow> t \<in> T}";
30 lemma mono_af: "mono(af A)";
31 by(force simp add: af_def intro:monoI);
33 consts mc :: "ctl_form \<Rightarrow> state set";
35 "mc(Atom a) = {s. a\<in>s}"
37 "mc(And f g) = mc f \<inter> mc g"
38 "mc(AX f) = {s. \<forall>t. (s,t) \<in> M \<longrightarrow> t \<in> mc f}"
39 "mc(EF f) = lfp(\<lambda>T. mc f \<union> {s. \<exists>t. (s,t)\<in>M \<and> t\<in>T})"
40 "mc(AF f) = lfp(af(mc f))";
42 lemma mono_ef: "mono(\<lambda>T. A \<union> {s. \<exists>t. (s,t)\<in>M \<and> t\<in>T})";
47 "lfp(\<lambda>T. A \<union> {s. \<exists>t. (s,t)\<in>M \<and> t\<in>T}) = {s. \<exists>t. (s,t) \<in> M^* \<and> t \<in> A}";
48 apply(rule equalityI);
51 apply(erule Lfp.induct);
54 apply(blast intro: r_into_rtrancl rtrancl_trans);
59 apply(erule_tac P = "t\<in>A" in rev_mp);
60 apply(erule converse_rtrancl_induct);
61 apply(rule ssubst [OF lfp_Tarski[OF mono_ef]]);
63 apply(rule ssubst [OF lfp_Tarski[OF mono_ef]]);
66 theorem lfp_subset_AF:
67 "lfp(af A) \<subseteq> {s. \<forall> p \<in> Paths s. \<exists> i. p i \<in> A}";
69 apply(erule Lfp.induct[OF _ mono_af]);
70 apply(simp add: af_def Paths_def);
74 apply(erule_tac x = "p 1" in allE);
76 apply(erule_tac x = "\<lambda>i. p(i+1)" in allE);
81 The opposite direction is proved by contradiction: if some state
82 {term s} is not in @{term"lfp(af A)"}, then we can construct an
83 infinite @{term A}-avoiding path starting from @{term s}. The reason is
84 that by unfolding @{term"lfp"} we find that if @{term s} is not in
85 @{term"lfp(af A)"}, then @{term s} is not in @{term A} and there is a
86 direct successor of @{term s} that is again not in @{term"lfp(af
87 A)"}. Iterating this argument yields the promised infinite
88 @{term A}-avoiding path. Let us formalize this sketch.
90 The one-step argument in the above sketch
94 "s \<notin> lfp(af A) \<Longrightarrow> s \<notin> A \<and> (\<exists> t. (s,t)\<in>M \<and> t \<notin> lfp(af A))";
96 apply(rule ssubst[OF lfp_Tarski[OF mono_af]]);
100 is proved by a variant of contraposition (@{thm[source]swap}:
101 @{thm swap[no_vars]}), i.e.\ assuming the negation of the conclusion
102 and proving @{term"s : lfp(af A)"}. Unfolding @{term lfp} once and
103 simplifying with the definition of @{term af} finishes the proof.
105 Now we iterate this process. The following construction of the desired
106 path is parameterized by a predicate @{term P} that should hold along the path:
109 consts path :: "state \<Rightarrow> (state \<Rightarrow> bool) \<Rightarrow> (nat \<Rightarrow> state)";
112 "path s P (Suc n) = (SOME t. (path s P n,t) \<in> M \<and> P t)";
115 Element @{term"n+1"} on this path is some arbitrary successor
116 @{term"t"} of element @{term"n"} such that @{term"P t"} holds. Of
117 course, such a @{term"t"} may in general not exist, but that is of no
118 concern to us since we will only use @{term path} in such cases where a
119 suitable @{term"t"} does exist.
121 Now we prove that if each state @{term"s"} that satisfies @{term"P"}
122 has a successor that again satisfies @{term"P"}, then there exists an infinite @{term"P"}-path.
126 "\<lbrakk> P s; \<forall>s. P s \<longrightarrow> (\<exists> t. (s,t)\<in>M \<and> P t) \<rbrakk> \<Longrightarrow> \<exists>p\<in>Paths s. \<forall>i. P(p i)";
129 First we rephrase the conclusion slightly because we need to prove both the path property
130 and the fact that @{term"P"} holds simultaneously:
133 apply(subgoal_tac "\<exists> p. s = p 0 \<and> (\<forall> i. (p i,p(i+1)) \<in> M \<and> P(p i))");
136 From this proposition the original goal follows easily
139 apply(simp add:Paths_def, blast);
140 apply(rule_tac x = "path s P" in exI);
145 apply(fast intro:selectI2EX);
147 apply(rule selectI2EX);
149 apply(rule selectI2EX);
154 "\<lbrakk> P s; \<forall> s. P s \<longrightarrow> (\<exists> t. (s,t)\<in>M \<and> P t) \<rbrakk> \<Longrightarrow>
155 \<exists> p\<in>Paths s. \<forall> i. P(p i)";
157 "\<exists> p. s = p 0 \<and> (\<forall> i. (p i,p(Suc i))\<in>M \<and> P(p i))");
158 apply(simp add:Paths_def);
160 apply(rule_tac x = "nat_rec s (\<lambda>n t. SOME u. (t,u)\<in>M \<and> P u)" in exI);
165 apply(fast intro:selectI2EX);
167 apply(rule selectI2EX);
169 apply(rule selectI2EX);
173 theorem AF_subset_lfp:
174 "{s. \<forall> p \<in> Paths s. \<exists> i. p i \<in> A} \<subseteq> lfp(af A)";
176 apply(erule contrapos2);
178 apply(drule seq_lemma);
179 by(auto dest:not_in_lfp_afD);
183 Second proof of opposite direction, directly by wellfounded induction
184 on the initial segment of M that avoids A.
186 Avoid s A = the set of successors of s that can be reached by a finite A-avoiding path
189 consts Avoid :: "state \<Rightarrow> state set \<Rightarrow> state set";
190 inductive "Avoid s A"
191 intros "s \<in> Avoid s A"
192 "\<lbrakk> t \<in> Avoid s A; t \<notin> A; (t,u) \<in> M \<rbrakk> \<Longrightarrow> u \<in> Avoid s A";
194 (* For any infinite A-avoiding path (f) in Avoid s A,
195 there is some infinite A-avoiding path (p) in Avoid s A that starts with s.
197 lemma ex_infinite_path[rule_format]:
198 "t \<in> Avoid s A \<Longrightarrow>
199 \<forall>f. t = f 0 \<longrightarrow> (\<forall>i. (f i, f (Suc i)) \<in> M \<and> f i \<in> Avoid s A \<and> f i \<notin> A)
200 \<longrightarrow> (\<exists> p\<in>Paths s. \<forall>i. p i \<notin> A)";
201 apply(simp add:Paths_def);
202 apply(erule Avoid.induct);
205 apply(erule_tac x = "\<lambda>i. case i of 0 \<Rightarrow> t | Suc i \<Rightarrow> f i" in allE);
206 by(force split:nat.split);
208 lemma Avoid_in_lfp[rule_format(no_asm)]:
209 "\<forall>p\<in>Paths s. \<exists>i. p i \<in> A \<Longrightarrow> t \<in> Avoid s A \<longrightarrow> t \<in> lfp(af A)";
210 apply(subgoal_tac "wf{(y,x). (x,y)\<in>M \<and> x \<in> Avoid s A \<and> y \<in> Avoid s A \<and> x \<notin> A}");
211 apply(erule_tac a = t in wf_induct);
213 apply(rule ssubst [OF lfp_Tarski[OF mono_af]]);
214 apply(unfold af_def);
215 apply(blast intro:Avoid.intros);
216 apply(erule contrapos2);
217 apply(simp add:wf_iff_no_infinite_down_chain);
219 apply(rule ex_infinite_path);
222 theorem AF_subset_lfp:
223 "{s. \<forall>p \<in> Paths s. \<exists> i. p i \<in> A} \<subseteq> lfp(af A)";
226 apply(erule Avoid_in_lfp);
227 by(rule Avoid.intros);
230 theorem "mc f = {s. s \<Turnstile> f}";
232 by(auto simp add: lfp_conv_EF equalityI[OF lfp_subset_AF AF_subset_lfp]);