author | zhangx |
Tue, 15 Dec 2015 21:45:46 +0800 | |
changeset 58 | ad57323fd4d6 |
parent 56 | 0fd478e14e87 |
child 59 | 0a069a667301 |
permissions | -rw-r--r-- |
53
8142e80f5d58
Finished comments on PrioGDef.thy
xingyuan zhang <xingyuanzhang@126.com>
parents:
45
diff
changeset
|
1 |
section {* |
8142e80f5d58
Finished comments on PrioGDef.thy
xingyuan zhang <xingyuanzhang@126.com>
parents:
45
diff
changeset
|
2 |
This file contains lemmas used to guide the recalculation of current precedence |
8142e80f5d58
Finished comments on PrioGDef.thy
xingyuan zhang <xingyuanzhang@126.com>
parents:
45
diff
changeset
|
3 |
after every system call (or system operation) |
8142e80f5d58
Finished comments on PrioGDef.thy
xingyuan zhang <xingyuanzhang@126.com>
parents:
45
diff
changeset
|
4 |
*} |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
5 |
theory CpsG |
56
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
6 |
imports PrioG Max RTree |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
7 |
begin |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
8 |
|
58 | 9 |
definition "wRAG (s::state) = {(Th th, Cs cs) | th cs. waiting s th cs}" |
10 |
||
11 |
definition "hRAG (s::state) = {(Cs cs, Th th) | th cs. holding s th cs}" |
|
12 |
||
13 |
definition "tRAG s = wRAG s O hRAG s" |
|
56
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
14 |
|
58 | 15 |
lemma RAG_split: "RAG s = (wRAG s \<union> hRAG s)" |
16 |
by (unfold s_RAG_abv wRAG_def hRAG_def s_waiting_abv |
|
17 |
s_holding_abv cs_RAG_def, auto) |
|
18 |
||
19 |
lemma tRAG_alt_def: |
|
20 |
"tRAG s = {(Th th1, Th th2) | th1 th2. |
|
21 |
\<exists> cs. (Th th1, Cs cs) \<in> RAG s \<and> (Cs cs, Th th2) \<in> RAG s}" |
|
22 |
by (auto simp:tRAG_def RAG_split wRAG_def hRAG_def) |
|
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
23 |
|
58 | 24 |
lemma tRAG_mono: |
25 |
assumes "RAG s' \<subseteq> RAG s" |
|
26 |
shows "tRAG s' \<subseteq> tRAG s" |
|
27 |
using assms |
|
28 |
by (unfold tRAG_alt_def, auto) |
|
56
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
29 |
|
58 | 30 |
lemma holding_next_thI: |
31 |
assumes "holding s th cs" |
|
32 |
and "length (wq s cs) > 1" |
|
33 |
obtains th' where "next_th s th cs th'" |
|
34 |
proof - |
|
35 |
from assms(1)[folded eq_holding, unfolded cs_holding_def] |
|
36 |
have " th \<in> set (wq s cs) \<and> th = hd (wq s cs)" . |
|
37 |
then obtain rest where h1: "wq s cs = th#rest" |
|
38 |
by (cases "wq s cs", auto) |
|
39 |
with assms(2) have h2: "rest \<noteq> []" by auto |
|
40 |
let ?th' = "hd (SOME q. distinct q \<and> set q = set rest)" |
|
41 |
have "next_th s th cs ?th'" using h1(1) h2 |
|
42 |
by (unfold next_th_def, auto) |
|
43 |
from that[OF this] show ?thesis . |
|
56
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
44 |
qed |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
45 |
|
58 | 46 |
lemma RAG_tRAG_transfer: |
47 |
assumes "vt s'" |
|
48 |
assumes "RAG s = RAG s' \<union> {(Th th, Cs cs)}" |
|
49 |
and "(Cs cs, Th th'') \<in> RAG s'" |
|
50 |
shows "tRAG s = tRAG s' \<union> {(Th th, Th th'')}" (is "?L = ?R") |
|
51 |
proof - |
|
52 |
interpret rtree: rtree "RAG s'" |
|
53 |
proof |
|
54 |
show "single_valued (RAG s')" |
|
55 |
apply (intro_locales) |
|
56 |
by (unfold single_valued_def, |
|
57 |
auto intro:unique_RAG[OF assms(1)]) |
|
56
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
58 |
|
58 | 59 |
show "acyclic (RAG s')" |
60 |
by (rule acyclic_RAG[OF assms(1)]) |
|
61 |
qed |
|
62 |
{ fix n1 n2 |
|
63 |
assume "(n1, n2) \<in> ?L" |
|
64 |
from this[unfolded tRAG_alt_def] |
|
65 |
obtain th1 th2 cs' where |
|
66 |
h: "n1 = Th th1" "n2 = Th th2" |
|
67 |
"(Th th1, Cs cs') \<in> RAG s" |
|
68 |
"(Cs cs', Th th2) \<in> RAG s" by auto |
|
69 |
from h(4) and assms(2) have cs_in: "(Cs cs', Th th2) \<in> RAG s'" by auto |
|
70 |
from h(3) and assms(2) |
|
71 |
have "(Th th1, Cs cs') = (Th th, Cs cs) \<or> |
|
72 |
(Th th1, Cs cs') \<in> RAG s'" by auto |
|
73 |
hence "(n1, n2) \<in> ?R" |
|
74 |
proof |
|
75 |
assume h1: "(Th th1, Cs cs') = (Th th, Cs cs)" |
|
76 |
hence eq_th1: "th1 = th" by simp |
|
77 |
moreover have "th2 = th''" |
|
78 |
proof - |
|
79 |
from h1 have "cs' = cs" by simp |
|
80 |
from assms(3) cs_in[unfolded this] rtree.sgv |
|
81 |
show ?thesis |
|
82 |
by (unfold single_valued_def, auto) |
|
83 |
qed |
|
84 |
ultimately show ?thesis using h(1,2) by auto |
|
85 |
next |
|
86 |
assume "(Th th1, Cs cs') \<in> RAG s'" |
|
87 |
with cs_in have "(Th th1, Th th2) \<in> tRAG s'" |
|
88 |
by (unfold tRAG_alt_def, auto) |
|
89 |
from this[folded h(1, 2)] show ?thesis by auto |
|
90 |
qed |
|
91 |
} moreover { |
|
92 |
fix n1 n2 |
|
93 |
assume "(n1, n2) \<in> ?R" |
|
94 |
hence "(n1, n2) \<in>tRAG s' \<or> (n1, n2) = (Th th, Th th'')" by auto |
|
95 |
hence "(n1, n2) \<in> ?L" |
|
96 |
proof |
|
97 |
assume "(n1, n2) \<in> tRAG s'" |
|
98 |
moreover have "... \<subseteq> ?L" |
|
99 |
proof(rule tRAG_mono) |
|
100 |
show "RAG s' \<subseteq> RAG s" by (unfold assms(2), auto) |
|
101 |
qed |
|
102 |
ultimately show ?thesis by auto |
|
103 |
next |
|
104 |
assume eq_n: "(n1, n2) = (Th th, Th th'')" |
|
105 |
from assms(2, 3) have "(Cs cs, Th th'') \<in> RAG s" by auto |
|
106 |
moreover have "(Th th, Cs cs) \<in> RAG s" using assms(2) by auto |
|
107 |
ultimately show ?thesis |
|
108 |
by (unfold eq_n tRAG_alt_def, auto) |
|
109 |
qed |
|
110 |
} ultimately show ?thesis by auto |
|
111 |
qed |
|
56
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
112 |
|
58 | 113 |
lemma readys_root: |
114 |
assumes "vt s" |
|
115 |
and "th \<in> readys s" |
|
116 |
shows "root (RAG s) (Th th)" |
|
117 |
proof - |
|
118 |
{ fix x |
|
119 |
assume "x \<in> ancestors (RAG s) (Th th)" |
|
120 |
hence h: "(Th th, x) \<in> (RAG s)^+" by (auto simp:ancestors_def) |
|
121 |
from tranclD[OF this] |
|
122 |
obtain z where "(Th th, z) \<in> RAG s" by auto |
|
123 |
with assms(2) have False |
|
124 |
apply (case_tac z, auto simp:readys_def s_RAG_def s_waiting_def cs_waiting_def) |
|
125 |
by (fold wq_def, blast) |
|
126 |
} thus ?thesis by (unfold root_def, auto) |
|
127 |
qed |
|
128 |
||
129 |
lemma readys_in_no_subtree: |
|
130 |
assumes "vt s" |
|
131 |
and "th \<in> readys s" |
|
132 |
and "th' \<noteq> th" |
|
133 |
shows "Th th \<notin> subtree (RAG s) (Th th')" |
|
134 |
proof |
|
135 |
assume "Th th \<in> subtree (RAG s) (Th th')" |
|
136 |
thus False |
|
137 |
proof(cases rule:subtreeE) |
|
138 |
case 1 |
|
139 |
with assms show ?thesis by auto |
|
140 |
next |
|
141 |
case 2 |
|
142 |
with readys_root[OF assms(1,2)] |
|
143 |
show ?thesis by (auto simp:root_def) |
|
144 |
qed |
|
145 |
qed |
|
146 |
||
147 |
lemma image_id: |
|
148 |
assumes "\<And> x. x \<in> A \<Longrightarrow> f x = x" |
|
149 |
shows "f ` A = A" |
|
150 |
using assms by (auto simp:image_def) |
|
56
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
151 |
|
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
152 |
definition "the_preced s th = preced th s" |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
153 |
|
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
154 |
lemma cp_alt_def: |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
155 |
"cp s th = |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
156 |
Max ((the_preced s) ` {th'. Th th' \<in> (subtree (RAG s) (Th th))})" |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
157 |
proof - |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
158 |
have "Max (the_preced s ` ({th} \<union> dependants (wq s) th)) = |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
159 |
Max (the_preced s ` {th'. Th th' \<in> subtree (RAG s) (Th th)})" |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
160 |
(is "Max (_ ` ?L) = Max (_ ` ?R)") |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
161 |
proof - |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
162 |
have "?L = ?R" |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
163 |
by (auto dest:rtranclD simp:cs_dependants_def cs_RAG_def s_RAG_def subtree_def) |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
164 |
thus ?thesis by simp |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
165 |
qed |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
166 |
thus ?thesis by (unfold cp_eq_cpreced cpreced_def, fold the_preced_def, simp) |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
167 |
qed |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
168 |
|
58 | 169 |
fun the_thread :: "node \<Rightarrow> thread" where |
170 |
"the_thread (Th th) = th" |
|
171 |
||
172 |
definition "cp_gen s x = |
|
173 |
Max ((the_preced s \<circ> the_thread) ` subtree (tRAG s) x)" |
|
174 |
||
175 |
lemma cp_gen_alt_def: |
|
176 |
"cp_gen s = (Max \<circ> (\<lambda>x. (the_preced s \<circ> the_thread) ` subtree (tRAG s) x))" |
|
177 |
by (auto simp:cp_gen_def) |
|
178 |
||
179 |
lemma tRAG_nodeE: |
|
180 |
assumes "(n1, n2) \<in> tRAG s" |
|
181 |
obtains th1 th2 where "n1 = Th th1" "n2 = Th th2" |
|
182 |
using assms |
|
183 |
by (auto simp: tRAG_def wRAG_def hRAG_def tRAG_def) |
|
184 |
||
185 |
lemma subtree_nodeE: |
|
186 |
assumes "n \<in> subtree (tRAG s) (Th th)" |
|
187 |
obtains th1 where "n = Th th1" |
|
188 |
proof - |
|
189 |
show ?thesis |
|
190 |
proof(rule subtreeE[OF assms]) |
|
191 |
assume "n = Th th" |
|
192 |
from that[OF this] show ?thesis . |
|
193 |
next |
|
194 |
assume "Th th \<in> ancestors (tRAG s) n" |
|
195 |
hence "(n, Th th) \<in> (tRAG s)^+" by (auto simp:ancestors_def) |
|
196 |
hence "\<exists> th1. n = Th th1" |
|
197 |
proof(induct) |
|
198 |
case (base y) |
|
199 |
from tRAG_nodeE[OF this] show ?case by metis |
|
200 |
next |
|
201 |
case (step y z) |
|
202 |
thus ?case by auto |
|
203 |
qed |
|
204 |
with that show ?thesis by auto |
|
205 |
qed |
|
206 |
qed |
|
207 |
||
208 |
lemma threads_set_eq: |
|
209 |
"the_thread ` (subtree (tRAG s) (Th th)) = |
|
210 |
{th'. Th th' \<in> (subtree (RAG s) (Th th))}" (is "?L = ?R") |
|
211 |
proof - |
|
212 |
{ fix th' |
|
213 |
assume "th' \<in> ?L" |
|
214 |
then obtain n where h: "th' = the_thread n" "n \<in> subtree (tRAG s) (Th th)" by auto |
|
215 |
from subtree_nodeE[OF this(2)] |
|
216 |
obtain th1 where "n = Th th1" by auto |
|
217 |
with h have "Th th' \<in> subtree (tRAG s) (Th th)" by auto |
|
218 |
hence "Th th' \<in> subtree (RAG s) (Th th)" |
|
219 |
proof(cases rule:subtreeE[consumes 1]) |
|
220 |
case 1 |
|
221 |
thus ?thesis by (auto simp:subtree_def) |
|
222 |
next |
|
223 |
case 2 |
|
224 |
hence "(Th th', Th th) \<in> (tRAG s)^+" by (auto simp:ancestors_def) |
|
225 |
thus ?thesis |
|
226 |
proof(induct) |
|
227 |
case (step y z) |
|
228 |
from this(2)[unfolded tRAG_alt_def] |
|
229 |
obtain u where |
|
230 |
h: "(y, u) \<in> RAG s" "(u, z) \<in> RAG s" |
|
231 |
by auto |
|
232 |
hence "y \<in> subtree (RAG s) z" by (auto simp:subtree_def) |
|
233 |
with step(3) |
|
234 |
show ?case by (auto simp:subtree_def) |
|
235 |
next |
|
236 |
case (base y) |
|
237 |
from this[unfolded tRAG_alt_def] |
|
238 |
show ?case by (auto simp:subtree_def) |
|
239 |
qed |
|
240 |
qed |
|
241 |
hence "th' \<in> ?R" by auto |
|
242 |
} moreover { |
|
243 |
fix th' |
|
244 |
assume "th' \<in> ?R" |
|
245 |
hence "(Th th', Th th) \<in> (RAG s)^*" by (auto simp:subtree_def) |
|
246 |
from star_rpath[OF this] |
|
247 |
obtain xs where "rpath (RAG s) (Th th') xs (Th th)" by auto |
|
248 |
hence "Th th' \<in> subtree (tRAG s) (Th th)" |
|
249 |
proof(induct xs arbitrary:th' th rule:length_induct) |
|
250 |
case (1 xs th' th) |
|
251 |
show ?case |
|
252 |
proof(cases xs) |
|
253 |
case Nil |
|
254 |
from rpath_nilE[OF 1(2)[unfolded this]] |
|
255 |
have "th' = th" by auto |
|
256 |
thus ?thesis by (auto simp:subtree_def) |
|
257 |
next |
|
258 |
case (Cons x1 xs1) note Cons1 = Cons |
|
259 |
show ?thesis |
|
260 |
proof(cases "xs1") |
|
261 |
case Nil |
|
262 |
from 1(2)[unfolded Cons[unfolded this]] |
|
263 |
have rp: "rpath (RAG s) (Th th') [x1] (Th th)" . |
|
264 |
hence "(Th th', x1) \<in> (RAG s)" by (cases, simp) |
|
265 |
then obtain cs where "x1 = Cs cs" |
|
266 |
by (unfold s_RAG_def, auto) |
|
267 |
find_theorems rpath "_ = _@[_]" |
|
268 |
from rpath_nnl_lastE[OF rp[unfolded this]] |
|
269 |
show ?thesis by auto |
|
270 |
next |
|
271 |
case (Cons x2 xs2) |
|
272 |
from 1(2)[unfolded Cons1[unfolded this]] |
|
273 |
have rp: "rpath (RAG s) (Th th') (x1 # x2 # xs2) (Th th)" . |
|
274 |
from rpath_edges_on[OF this] |
|
275 |
have eds: "edges_on (Th th' # x1 # x2 # xs2) \<subseteq> RAG s" . |
|
276 |
have "(Th th', x1) \<in> edges_on (Th th' # x1 # x2 # xs2)" |
|
277 |
by (simp add: edges_on_unfold) |
|
278 |
with eds have rg1: "(Th th', x1) \<in> RAG s" by auto |
|
279 |
then obtain cs1 where eq_x1: "x1 = Cs cs1" by (unfold s_RAG_def, auto) |
|
280 |
have "(x1, x2) \<in> edges_on (Th th' # x1 # x2 # xs2)" |
|
281 |
by (simp add: edges_on_unfold) |
|
282 |
from this eds |
|
283 |
have rg2: "(x1, x2) \<in> RAG s" by auto |
|
284 |
from this[unfolded eq_x1] |
|
285 |
obtain th1 where eq_x2: "x2 = Th th1" by (unfold s_RAG_def, auto) |
|
286 |
from rp have "rpath (RAG s) x2 xs2 (Th th)" |
|
287 |
by (elim rpath_ConsE, simp) |
|
288 |
from this[unfolded eq_x2] have rp': "rpath (RAG s) (Th th1) xs2 (Th th)" . |
|
289 |
from 1(1)[rule_format, OF _ this, unfolded Cons1 Cons] |
|
290 |
have "Th th1 \<in> subtree (tRAG s) (Th th)" by simp |
|
291 |
moreover have "(Th th', Th th1) \<in> (tRAG s)^*" |
|
292 |
proof - |
|
293 |
from rg1[unfolded eq_x1] rg2[unfolded eq_x1 eq_x2] |
|
294 |
show ?thesis by (unfold RAG_split tRAG_def wRAG_def hRAG_def, auto) |
|
295 |
qed |
|
296 |
ultimately show ?thesis by (auto simp:subtree_def) |
|
297 |
qed |
|
298 |
qed |
|
299 |
qed |
|
300 |
from imageI[OF this, of the_thread] |
|
301 |
have "th' \<in> ?L" by simp |
|
302 |
} ultimately show ?thesis by auto |
|
303 |
qed |
|
304 |
||
305 |
lemma cp_alt_def1: |
|
306 |
"cp s th = Max ((the_preced s o the_thread) ` (subtree (tRAG s) (Th th)))" |
|
307 |
proof - |
|
308 |
have "(the_preced s ` the_thread ` subtree (tRAG s) (Th th)) = |
|
309 |
((the_preced s \<circ> the_thread) ` subtree (tRAG s) (Th th))" |
|
310 |
by auto |
|
311 |
thus ?thesis by (unfold cp_alt_def, fold threads_set_eq, auto) |
|
312 |
qed |
|
313 |
||
314 |
lemma cp_gen_def_cond: |
|
315 |
assumes "x = Th th" |
|
316 |
shows "cp s th = cp_gen s (Th th)" |
|
317 |
by (unfold cp_alt_def1 cp_gen_def, simp) |
|
318 |
||
319 |
lemma cp_gen_over_set: |
|
320 |
assumes "\<forall> x \<in> A. \<exists> th. x = Th th" |
|
321 |
shows "cp_gen s ` A = (cp s \<circ> the_thread) ` A" |
|
322 |
proof(rule f_image_eq) |
|
323 |
fix a |
|
324 |
assume "a \<in> A" |
|
325 |
from assms[rule_format, OF this] |
|
326 |
obtain th where eq_a: "a = Th th" by auto |
|
327 |
show "cp_gen s a = (cp s \<circ> the_thread) a" |
|
328 |
by (unfold eq_a, simp, unfold cp_gen_def_cond[OF refl[of "Th th"]], simp) |
|
329 |
qed |
|
330 |
||
331 |
||
332 |
||
333 |
locale valid_trace = |
|
334 |
fixes s |
|
335 |
assumes vt : "vt s" |
|
336 |
||
337 |
context valid_trace |
|
338 |
begin |
|
339 |
||
340 |
lemma wf_RAG: "wf (RAG s)" |
|
341 |
proof(rule finite_acyclic_wf) |
|
342 |
from finite_RAG[OF vt] show "finite (RAG s)" . |
|
343 |
next |
|
344 |
from acyclic_RAG[OF vt] show "acyclic (RAG s)" . |
|
345 |
qed |
|
346 |
||
347 |
end |
|
348 |
||
349 |
context valid_trace |
|
350 |
begin |
|
351 |
||
352 |
lemma sgv_wRAG: "single_valued (wRAG s)" |
|
353 |
using waiting_unique[OF vt] |
|
354 |
by (unfold single_valued_def wRAG_def, auto) |
|
355 |
||
356 |
lemma sgv_hRAG: "single_valued (hRAG s)" |
|
357 |
using holding_unique |
|
358 |
by (unfold single_valued_def hRAG_def, auto) |
|
359 |
||
360 |
lemma sgv_tRAG: "single_valued (tRAG s)" |
|
361 |
by (unfold tRAG_def, rule single_valued_relcomp, |
|
362 |
insert sgv_wRAG sgv_hRAG, auto) |
|
363 |
||
364 |
lemma acyclic_tRAG: "acyclic (tRAG s)" |
|
365 |
proof(unfold tRAG_def, rule acyclic_compose) |
|
366 |
show "acyclic (RAG s)" using acyclic_RAG[OF vt] . |
|
367 |
next |
|
368 |
show "wRAG s \<subseteq> RAG s" unfolding RAG_split by auto |
|
369 |
next |
|
370 |
show "hRAG s \<subseteq> RAG s" unfolding RAG_split by auto |
|
371 |
qed |
|
372 |
||
373 |
lemma sgv_RAG: "single_valued (RAG s)" |
|
374 |
using unique_RAG[OF vt] by (auto simp:single_valued_def) |
|
375 |
||
376 |
lemma rtree_RAG: "rtree (RAG s)" |
|
377 |
using sgv_RAG acyclic_RAG[OF vt] |
|
378 |
by (unfold rtree_def rtree_axioms_def sgv_def, auto) |
|
379 |
||
380 |
end |
|
381 |
||
382 |
sublocale valid_trace < rtree_s: rtree "tRAG s" |
|
383 |
proof(unfold_locales) |
|
384 |
from sgv_tRAG show "single_valued (tRAG s)" . |
|
385 |
next |
|
386 |
from acyclic_tRAG show "acyclic (tRAG s)" . |
|
387 |
qed |
|
388 |
||
389 |
sublocale valid_trace < fsbtRAGs : fsubtree "RAG s" |
|
390 |
proof - |
|
391 |
show "fsubtree (RAG s)" |
|
392 |
proof(intro_locales) |
|
393 |
show "fbranch (RAG s)" using finite_fbranchI[OF finite_RAG[OF vt]] . |
|
394 |
next |
|
395 |
show "fsubtree_axioms (RAG s)" |
|
396 |
proof(unfold fsubtree_axioms_def) |
|
397 |
find_theorems wf RAG |
|
398 |
from wf_RAG show "wf (RAG s)" . |
|
399 |
qed |
|
400 |
qed |
|
401 |
qed |
|
402 |
||
403 |
sublocale valid_trace < fsbttRAGs: fsubtree "tRAG s" |
|
404 |
proof - |
|
405 |
have "fsubtree (tRAG s)" |
|
406 |
proof - |
|
407 |
have "fbranch (tRAG s)" |
|
408 |
proof(unfold tRAG_def, rule fbranch_compose) |
|
409 |
show "fbranch (wRAG s)" |
|
410 |
proof(rule finite_fbranchI) |
|
411 |
from finite_RAG[OF vt] show "finite (wRAG s)" |
|
412 |
by (unfold RAG_split, auto) |
|
413 |
qed |
|
414 |
next |
|
415 |
show "fbranch (hRAG s)" |
|
416 |
proof(rule finite_fbranchI) |
|
417 |
from finite_RAG[OF vt] |
|
418 |
show "finite (hRAG s)" by (unfold RAG_split, auto) |
|
419 |
qed |
|
420 |
qed |
|
421 |
moreover have "wf (tRAG s)" |
|
422 |
proof(rule wf_subset) |
|
423 |
show "wf (RAG s O RAG s)" using wf_RAG |
|
424 |
by (fold wf_comp_self, simp) |
|
425 |
next |
|
426 |
show "tRAG s \<subseteq> (RAG s O RAG s)" |
|
427 |
by (unfold tRAG_alt_def, auto) |
|
428 |
qed |
|
429 |
ultimately show ?thesis |
|
430 |
by (unfold fsubtree_def fsubtree_axioms_def,auto) |
|
431 |
qed |
|
432 |
from this[folded tRAG_def] show "fsubtree (tRAG s)" . |
|
433 |
qed |
|
434 |
||
435 |
lemma Max_UNION: |
|
436 |
assumes "finite A" |
|
437 |
and "A \<noteq> {}" |
|
438 |
and "\<forall> M \<in> f ` A. finite M" |
|
439 |
and "\<forall> M \<in> f ` A. M \<noteq> {}" |
|
440 |
shows "Max (\<Union>x\<in> A. f x) = Max (Max ` f ` A)" (is "?L = ?R") |
|
441 |
using assms[simp] |
|
442 |
proof - |
|
443 |
have "?L = Max (\<Union>(f ` A))" |
|
444 |
by (fold Union_image_eq, simp) |
|
445 |
also have "... = ?R" |
|
446 |
by (subst Max_Union, simp+) |
|
447 |
finally show ?thesis . |
|
448 |
qed |
|
449 |
||
450 |
lemma max_Max_eq: |
|
451 |
assumes "finite A" |
|
452 |
and "A \<noteq> {}" |
|
453 |
and "x = y" |
|
454 |
shows "max x (Max A) = Max ({y} \<union> A)" (is "?L = ?R") |
|
455 |
proof - |
|
456 |
have "?R = Max (insert y A)" by simp |
|
457 |
also from assms have "... = ?L" |
|
458 |
by (subst Max.insert, simp+) |
|
459 |
finally show ?thesis by simp |
|
460 |
qed |
|
461 |
||
462 |
||
463 |
context valid_trace |
|
464 |
begin |
|
465 |
||
466 |
(* ddd *) |
|
467 |
lemma cp_gen_rec: |
|
468 |
assumes "x = Th th" |
|
469 |
shows "cp_gen s x = Max ({the_preced s th} \<union> (cp_gen s) ` children (tRAG s) x)" |
|
470 |
proof(cases "children (tRAG s) x = {}") |
|
471 |
case True |
|
472 |
show ?thesis |
|
473 |
by (unfold True cp_gen_def subtree_children, simp add:assms) |
|
474 |
next |
|
475 |
case False |
|
476 |
hence [simp]: "children (tRAG s) x \<noteq> {}" by auto |
|
477 |
note fsbttRAGs.finite_subtree[simp] |
|
478 |
have [simp]: "finite (children (tRAG s) x)" |
|
479 |
by (intro rev_finite_subset[OF fsbttRAGs.finite_subtree], |
|
480 |
rule children_subtree) |
|
481 |
{ fix r x |
|
482 |
have "subtree r x \<noteq> {}" by (auto simp:subtree_def) |
|
483 |
} note this[simp] |
|
484 |
have [simp]: "\<exists>x\<in>children (tRAG s) x. subtree (tRAG s) x \<noteq> {}" |
|
485 |
proof - |
|
486 |
from False obtain q where "q \<in> children (tRAG s) x" by blast |
|
487 |
moreover have "subtree (tRAG s) q \<noteq> {}" by simp |
|
488 |
ultimately show ?thesis by blast |
|
489 |
qed |
|
490 |
have h: "Max ((the_preced s \<circ> the_thread) ` |
|
491 |
({x} \<union> \<Union>(subtree (tRAG s) ` children (tRAG s) x))) = |
|
492 |
Max ({the_preced s th} \<union> cp_gen s ` children (tRAG s) x)" |
|
493 |
(is "?L = ?R") |
|
494 |
proof - |
|
495 |
let "Max (?f ` (?A \<union> \<Union> (?g ` ?B)))" = ?L |
|
496 |
let "Max (_ \<union> (?h ` ?B))" = ?R |
|
497 |
let ?L1 = "?f ` \<Union>(?g ` ?B)" |
|
498 |
have eq_Max_L1: "Max ?L1 = Max (?h ` ?B)" |
|
499 |
proof - |
|
500 |
have "?L1 = ?f ` (\<Union> x \<in> ?B.(?g x))" by simp |
|
501 |
also have "... = (\<Union> x \<in> ?B. ?f ` (?g x))" by auto |
|
502 |
finally have "Max ?L1 = Max ..." by simp |
|
503 |
also have "... = Max (Max ` (\<lambda>x. ?f ` subtree (tRAG s) x) ` ?B)" |
|
504 |
by (subst Max_UNION, simp+) |
|
505 |
also have "... = Max (cp_gen s ` children (tRAG s) x)" |
|
506 |
by (unfold image_comp cp_gen_alt_def, simp) |
|
507 |
finally show ?thesis . |
|
508 |
qed |
|
509 |
show ?thesis |
|
510 |
proof - |
|
511 |
have "?L = Max (?f ` ?A \<union> ?L1)" by simp |
|
512 |
also have "... = max (the_preced s (the_thread x)) (Max ?L1)" |
|
513 |
by (subst Max_Un, simp+) |
|
514 |
also have "... = max (?f x) (Max (?h ` ?B))" |
|
515 |
by (unfold eq_Max_L1, simp) |
|
516 |
also have "... =?R" |
|
517 |
by (rule max_Max_eq, (simp)+, unfold assms, simp) |
|
518 |
finally show ?thesis . |
|
519 |
qed |
|
520 |
qed thus ?thesis |
|
521 |
by (fold h subtree_children, unfold cp_gen_def, simp) |
|
522 |
qed |
|
523 |
||
524 |
lemma cp_rec: |
|
525 |
"cp s th = Max ({the_preced s th} \<union> |
|
526 |
(cp s o the_thread) ` children (tRAG s) (Th th))" |
|
527 |
proof - |
|
528 |
have "Th th = Th th" by simp |
|
529 |
note h = cp_gen_def_cond[OF this] cp_gen_rec[OF this] |
|
530 |
show ?thesis |
|
531 |
proof - |
|
532 |
have "cp_gen s ` children (tRAG s) (Th th) = |
|
533 |
(cp s \<circ> the_thread) ` children (tRAG s) (Th th)" |
|
534 |
proof(rule cp_gen_over_set) |
|
535 |
show " \<forall>x\<in>children (tRAG s) (Th th). \<exists>th. x = Th th" |
|
536 |
by (unfold tRAG_alt_def, auto simp:children_def) |
|
537 |
qed |
|
538 |
thus ?thesis by (subst (1) h(1), unfold h(2), simp) |
|
539 |
qed |
|
540 |
qed |
|
541 |
||
542 |
end |
|
543 |
||
544 |
||
55
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
545 |
lemma eq_dependants: "dependants (wq s) = dependants s" |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
546 |
by (simp add: s_dependants_abv wq_def) |
58 | 547 |
|
548 |
||
53
8142e80f5d58
Finished comments on PrioGDef.thy
xingyuan zhang <xingyuanzhang@126.com>
parents:
45
diff
changeset
|
549 |
(* obvious lemma *) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
550 |
lemma not_thread_holdents: |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
551 |
fixes th s |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
552 |
assumes vt: "vt s" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
553 |
and not_in: "th \<notin> threads s" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
554 |
shows "holdents s th = {}" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
555 |
proof - |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
556 |
from vt not_in show ?thesis |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
557 |
proof(induct arbitrary:th) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
558 |
case (vt_cons s e th) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
559 |
assume vt: "vt s" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
560 |
and ih: "\<And>th. th \<notin> threads s \<Longrightarrow> holdents s th = {}" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
561 |
and stp: "step s e" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
562 |
and not_in: "th \<notin> threads (e # s)" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
563 |
from stp show ?case |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
564 |
proof(cases) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
565 |
case (thread_create thread prio) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
566 |
assume eq_e: "e = Create thread prio" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
567 |
and not_in': "thread \<notin> threads s" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
568 |
have "holdents (e # s) th = holdents s th" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
569 |
apply (unfold eq_e holdents_test) |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
570 |
by (simp add:RAG_create_unchanged) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
571 |
moreover have "th \<notin> threads s" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
572 |
proof - |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
573 |
from not_in eq_e show ?thesis by simp |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
574 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
575 |
moreover note ih ultimately show ?thesis by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
576 |
next |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
577 |
case (thread_exit thread) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
578 |
assume eq_e: "e = Exit thread" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
579 |
and nh: "holdents s thread = {}" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
580 |
show ?thesis |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
581 |
proof(cases "th = thread") |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
582 |
case True |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
583 |
with nh eq_e |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
584 |
show ?thesis |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
585 |
by (auto simp:holdents_test RAG_exit_unchanged) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
586 |
next |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
587 |
case False |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
588 |
with not_in and eq_e |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
589 |
have "th \<notin> threads s" by simp |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
590 |
from ih[OF this] False eq_e show ?thesis |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
591 |
by (auto simp:holdents_test RAG_exit_unchanged) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
592 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
593 |
next |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
594 |
case (thread_P thread cs) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
595 |
assume eq_e: "e = P thread cs" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
596 |
and is_runing: "thread \<in> runing s" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
597 |
from assms thread_exit ih stp not_in vt eq_e have vtp: "vt (P thread cs#s)" by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
598 |
have neq_th: "th \<noteq> thread" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
599 |
proof - |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
600 |
from not_in eq_e have "th \<notin> threads s" by simp |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
601 |
moreover from is_runing have "thread \<in> threads s" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
602 |
by (simp add:runing_def readys_def) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
603 |
ultimately show ?thesis by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
604 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
605 |
hence "holdents (e # s) th = holdents s th " |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
606 |
apply (unfold cntCS_def holdents_test eq_e) |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
607 |
by (unfold step_RAG_p[OF vtp], auto) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
608 |
moreover have "holdents s th = {}" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
609 |
proof(rule ih) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
610 |
from not_in eq_e show "th \<notin> threads s" by simp |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
611 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
612 |
ultimately show ?thesis by simp |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
613 |
next |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
614 |
case (thread_V thread cs) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
615 |
assume eq_e: "e = V thread cs" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
616 |
and is_runing: "thread \<in> runing s" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
617 |
and hold: "holding s thread cs" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
618 |
have neq_th: "th \<noteq> thread" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
619 |
proof - |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
620 |
from not_in eq_e have "th \<notin> threads s" by simp |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
621 |
moreover from is_runing have "thread \<in> threads s" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
622 |
by (simp add:runing_def readys_def) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
623 |
ultimately show ?thesis by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
624 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
625 |
from assms thread_V eq_e ih stp not_in vt have vtv: "vt (V thread cs#s)" by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
626 |
from hold obtain rest |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
627 |
where eq_wq: "wq s cs = thread # rest" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
628 |
by (case_tac "wq s cs", auto simp: wq_def s_holding_def) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
629 |
from not_in eq_e eq_wq |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
630 |
have "\<not> next_th s thread cs th" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
631 |
apply (auto simp:next_th_def) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
632 |
proof - |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
633 |
assume ne: "rest \<noteq> []" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
634 |
and ni: "hd (SOME q. distinct q \<and> set q = set rest) \<notin> threads s" (is "?t \<notin> threads s") |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
635 |
have "?t \<in> set rest" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
636 |
proof(rule someI2) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
637 |
from wq_distinct[OF step_back_vt[OF vtv], of cs] and eq_wq |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
638 |
show "distinct rest \<and> set rest = set rest" by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
639 |
next |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
640 |
fix x assume "distinct x \<and> set x = set rest" with ne |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
641 |
show "hd x \<in> set rest" by (cases x, auto) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
642 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
643 |
with eq_wq have "?t \<in> set (wq s cs)" by simp |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
644 |
from wq_threads[OF step_back_vt[OF vtv], OF this] and ni |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
645 |
show False by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
646 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
647 |
moreover note neq_th eq_wq |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
648 |
ultimately have "holdents (e # s) th = holdents s th" |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
649 |
by (unfold eq_e cntCS_def holdents_test step_RAG_v[OF vtv], auto) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
650 |
moreover have "holdents s th = {}" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
651 |
proof(rule ih) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
652 |
from not_in eq_e show "th \<notin> threads s" by simp |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
653 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
654 |
ultimately show ?thesis by simp |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
655 |
next |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
656 |
case (thread_set thread prio) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
657 |
print_facts |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
658 |
assume eq_e: "e = Set thread prio" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
659 |
and is_runing: "thread \<in> runing s" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
660 |
from not_in and eq_e have "th \<notin> threads s" by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
661 |
from ih [OF this] and eq_e |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
662 |
show ?thesis |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
663 |
apply (unfold eq_e cntCS_def holdents_test) |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
664 |
by (simp add:RAG_set_unchanged) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
665 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
666 |
next |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
667 |
case vt_nil |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
668 |
show ?case |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
669 |
by (auto simp:count_def holdents_test s_RAG_def wq_def cs_holding_def) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
670 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
671 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
672 |
|
53
8142e80f5d58
Finished comments on PrioGDef.thy
xingyuan zhang <xingyuanzhang@126.com>
parents:
45
diff
changeset
|
673 |
(* obvious lemma *) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
674 |
lemma next_th_neq: |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
675 |
assumes vt: "vt s" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
676 |
and nt: "next_th s th cs th'" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
677 |
shows "th' \<noteq> th" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
678 |
proof - |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
679 |
from nt show ?thesis |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
680 |
apply (auto simp:next_th_def) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
681 |
proof - |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
682 |
fix rest |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
683 |
assume eq_wq: "wq s cs = hd (SOME q. distinct q \<and> set q = set rest) # rest" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
684 |
and ne: "rest \<noteq> []" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
685 |
have "hd (SOME q. distinct q \<and> set q = set rest) \<in> set rest" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
686 |
proof(rule someI2) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
687 |
from wq_distinct[OF vt, of cs] eq_wq |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
688 |
show "distinct rest \<and> set rest = set rest" by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
689 |
next |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
690 |
fix x |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
691 |
assume "distinct x \<and> set x = set rest" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
692 |
hence eq_set: "set x = set rest" by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
693 |
with ne have "x \<noteq> []" by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
694 |
hence "hd x \<in> set x" by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
695 |
with eq_set show "hd x \<in> set rest" by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
696 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
697 |
with wq_distinct[OF vt, of cs] eq_wq show False by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
698 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
699 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
700 |
|
53
8142e80f5d58
Finished comments on PrioGDef.thy
xingyuan zhang <xingyuanzhang@126.com>
parents:
45
diff
changeset
|
701 |
(* obvious lemma *) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
702 |
lemma next_th_unique: |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
703 |
assumes nt1: "next_th s th cs th1" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
704 |
and nt2: "next_th s th cs th2" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
705 |
shows "th1 = th2" |
33
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
706 |
using assms by (unfold next_th_def, auto) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
707 |
|
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
708 |
lemma wf_RAG: |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
709 |
assumes vt: "vt s" |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
710 |
shows "wf (RAG s)" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
711 |
proof(rule finite_acyclic_wf) |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
712 |
from finite_RAG[OF vt] show "finite (RAG s)" . |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
713 |
next |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
714 |
from acyclic_RAG[OF vt] show "acyclic (RAG s)" . |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
715 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
716 |
|
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
717 |
definition child :: "state \<Rightarrow> (node \<times> node) set" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
718 |
where "child s \<equiv> |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
719 |
{(Th th', Th th) | th th'. \<exists>cs. (Th th', Cs cs) \<in> RAG s \<and> (Cs cs, Th th) \<in> RAG s}" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
720 |
|
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
721 |
definition children :: "state \<Rightarrow> thread \<Rightarrow> thread set" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
722 |
where "children s th \<equiv> {th'. (Th th', Th th) \<in> child s}" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
723 |
|
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
724 |
lemma children_def2: |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
725 |
"children s th \<equiv> {th'. \<exists> cs. (Th th', Cs cs) \<in> RAG s \<and> (Cs cs, Th th) \<in> RAG s}" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
726 |
unfolding child_def children_def by simp |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
727 |
|
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
728 |
lemma children_dependants: |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
729 |
"children s th \<subseteq> dependants (wq s) th" |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
730 |
unfolding children_def2 |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
731 |
unfolding cs_dependants_def |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
732 |
by (auto simp add: eq_RAG) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
733 |
|
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
734 |
lemma child_unique: |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
735 |
assumes vt: "vt s" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
736 |
and ch1: "(Th th, Th th1) \<in> child s" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
737 |
and ch2: "(Th th, Th th2) \<in> child s" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
738 |
shows "th1 = th2" |
33
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
739 |
using ch1 ch2 |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
740 |
proof(unfold child_def, clarsimp) |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
741 |
fix cs csa |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
742 |
assume h1: "(Th th, Cs cs) \<in> RAG s" |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
743 |
and h2: "(Cs cs, Th th1) \<in> RAG s" |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
744 |
and h3: "(Th th, Cs csa) \<in> RAG s" |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
745 |
and h4: "(Cs csa, Th th2) \<in> RAG s" |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
746 |
from unique_RAG[OF vt h1 h3] have "cs = csa" by simp |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
747 |
with h4 have "(Cs cs, Th th2) \<in> RAG s" by simp |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
748 |
from unique_RAG[OF vt h2 this] |
33
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
749 |
show "th1 = th2" by simp |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
750 |
qed |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
751 |
|
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
752 |
lemma RAG_children: |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
753 |
assumes h: "(Th th1, Th th2) \<in> (RAG s)^+" |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
754 |
shows "th1 \<in> children s th2 \<or> (\<exists> th3. th3 \<in> children s th2 \<and> (Th th1, Th th3) \<in> (RAG s)^+)" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
755 |
proof - |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
756 |
from h show ?thesis |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
757 |
proof(induct rule: tranclE) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
758 |
fix c th2 |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
759 |
assume h1: "(Th th1, c) \<in> (RAG s)\<^sup>+" |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
760 |
and h2: "(c, Th th2) \<in> RAG s" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
761 |
from h2 obtain cs where eq_c: "c = Cs cs" |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
762 |
by (case_tac c, auto simp:s_RAG_def) |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
763 |
show "th1 \<in> children s th2 \<or> (\<exists>th3. th3 \<in> children s th2 \<and> (Th th1, Th th3) \<in> (RAG s)\<^sup>+)" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
764 |
proof(rule tranclE[OF h1]) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
765 |
fix ca |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
766 |
assume h3: "(Th th1, ca) \<in> (RAG s)\<^sup>+" |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
767 |
and h4: "(ca, c) \<in> RAG s" |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
768 |
show "th1 \<in> children s th2 \<or> (\<exists>th3. th3 \<in> children s th2 \<and> (Th th1, Th th3) \<in> (RAG s)\<^sup>+)" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
769 |
proof - |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
770 |
from eq_c and h4 obtain th3 where eq_ca: "ca = Th th3" |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
771 |
by (case_tac ca, auto simp:s_RAG_def) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
772 |
from eq_ca h4 h2 eq_c |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
773 |
have "th3 \<in> children s th2" by (auto simp:children_def child_def) |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
774 |
moreover from h3 eq_ca have "(Th th1, Th th3) \<in> (RAG s)\<^sup>+" by simp |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
775 |
ultimately show ?thesis by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
776 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
777 |
next |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
778 |
assume "(Th th1, c) \<in> RAG s" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
779 |
with h2 eq_c |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
780 |
have "th1 \<in> children s th2" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
781 |
by (auto simp:children_def child_def) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
782 |
thus ?thesis by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
783 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
784 |
next |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
785 |
assume "(Th th1, Th th2) \<in> RAG s" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
786 |
thus ?thesis |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
787 |
by (auto simp:s_RAG_def) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
788 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
789 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
790 |
|
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
791 |
lemma sub_child: "child s \<subseteq> (RAG s)^+" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
792 |
by (unfold child_def, auto) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
793 |
|
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
794 |
lemma wf_child: |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
795 |
assumes vt: "vt s" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
796 |
shows "wf (child s)" |
33
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
797 |
apply(rule wf_subset) |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
798 |
apply(rule wf_trancl[OF wf_RAG[OF vt]]) |
33
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
799 |
apply(rule sub_child) |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
800 |
done |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
801 |
|
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
802 |
lemma RAG_child_pre: |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
803 |
assumes vt: "vt s" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
804 |
shows |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
805 |
"(Th th, n) \<in> (RAG s)^+ \<longrightarrow> (\<forall> th'. n = (Th th') \<longrightarrow> (Th th, Th th') \<in> (child s)^+)" (is "?P n") |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
806 |
proof - |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
807 |
from wf_trancl[OF wf_RAG[OF vt]] |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
808 |
have wf: "wf ((RAG s)^+)" . |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
809 |
show ?thesis |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
810 |
proof(rule wf_induct[OF wf, of ?P], clarsimp) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
811 |
fix th' |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
812 |
assume ih[rule_format]: "\<forall>y. (y, Th th') \<in> (RAG s)\<^sup>+ \<longrightarrow> |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
813 |
(Th th, y) \<in> (RAG s)\<^sup>+ \<longrightarrow> (\<forall>th'. y = Th th' \<longrightarrow> (Th th, Th th') \<in> (child s)\<^sup>+)" |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
814 |
and h: "(Th th, Th th') \<in> (RAG s)\<^sup>+" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
815 |
show "(Th th, Th th') \<in> (child s)\<^sup>+" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
816 |
proof - |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
817 |
from RAG_children[OF h] |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
818 |
have "th \<in> children s th' \<or> (\<exists>th3. th3 \<in> children s th' \<and> (Th th, Th th3) \<in> (RAG s)\<^sup>+)" . |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
819 |
thus ?thesis |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
820 |
proof |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
821 |
assume "th \<in> children s th'" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
822 |
thus "(Th th, Th th') \<in> (child s)\<^sup>+" by (auto simp:children_def) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
823 |
next |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
824 |
assume "\<exists>th3. th3 \<in> children s th' \<and> (Th th, Th th3) \<in> (RAG s)\<^sup>+" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
825 |
then obtain th3 where th3_in: "th3 \<in> children s th'" |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
826 |
and th_dp: "(Th th, Th th3) \<in> (RAG s)\<^sup>+" by auto |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
827 |
from th3_in have "(Th th3, Th th') \<in> (RAG s)^+" by (auto simp:children_def child_def) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
828 |
from ih[OF this th_dp, of th3] have "(Th th, Th th3) \<in> (child s)\<^sup>+" by simp |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
829 |
with th3_in show "(Th th, Th th') \<in> (child s)\<^sup>+" by (auto simp:children_def) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
830 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
831 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
832 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
833 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
834 |
|
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
835 |
lemma RAG_child: "\<lbrakk>vt s; (Th th, Th th') \<in> (RAG s)^+\<rbrakk> \<Longrightarrow> (Th th, Th th') \<in> (child s)^+" |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
836 |
by (insert RAG_child_pre, auto) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
837 |
|
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
838 |
lemma child_RAG_p: |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
839 |
assumes "(n1, n2) \<in> (child s)^+" |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
840 |
shows "(n1, n2) \<in> (RAG s)^+" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
841 |
proof - |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
842 |
from assms show ?thesis |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
843 |
proof(induct) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
844 |
case (base y) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
845 |
with sub_child show ?case by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
846 |
next |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
847 |
case (step y z) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
848 |
assume "(y, z) \<in> child s" |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
849 |
with sub_child have "(y, z) \<in> (RAG s)^+" by auto |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
850 |
moreover have "(n1, y) \<in> (RAG s)^+" by fact |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
851 |
ultimately show ?case by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
852 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
853 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
854 |
|
55
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
855 |
text {* (* ddd *) |
53
8142e80f5d58
Finished comments on PrioGDef.thy
xingyuan zhang <xingyuanzhang@126.com>
parents:
45
diff
changeset
|
856 |
*} |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
857 |
lemma child_RAG_eq: |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
858 |
assumes vt: "vt s" |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
859 |
shows "(Th th1, Th th2) \<in> (child s)^+ \<longleftrightarrow> (Th th1, Th th2) \<in> (RAG s)^+" |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
860 |
by (auto intro: RAG_child[OF vt] child_RAG_p) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
861 |
|
55
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
862 |
text {* (* ddd *) |
53
8142e80f5d58
Finished comments on PrioGDef.thy
xingyuan zhang <xingyuanzhang@126.com>
parents:
45
diff
changeset
|
863 |
*} |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
864 |
lemma children_no_dep: |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
865 |
fixes s th th1 th2 th3 |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
866 |
assumes vt: "vt s" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
867 |
and ch1: "(Th th1, Th th) \<in> child s" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
868 |
and ch2: "(Th th2, Th th) \<in> child s" |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
869 |
and ch3: "(Th th1, Th th2) \<in> (RAG s)^+" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
870 |
shows "False" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
871 |
proof - |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
872 |
from RAG_child[OF vt ch3] |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
873 |
have "(Th th1, Th th2) \<in> (child s)\<^sup>+" . |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
874 |
thus ?thesis |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
875 |
proof(rule converse_tranclE) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
876 |
assume "(Th th1, Th th2) \<in> child s" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
877 |
from child_unique[OF vt ch1 this] have "th = th2" by simp |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
878 |
with ch2 have "(Th th2, Th th2) \<in> child s" by simp |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
879 |
with wf_child[OF vt] show ?thesis by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
880 |
next |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
881 |
fix c |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
882 |
assume h1: "(Th th1, c) \<in> child s" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
883 |
and h2: "(c, Th th2) \<in> (child s)\<^sup>+" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
884 |
from h1 obtain th3 where eq_c: "c = Th th3" by (unfold child_def, auto) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
885 |
with h1 have "(Th th1, Th th3) \<in> child s" by simp |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
886 |
from child_unique[OF vt ch1 this] have eq_th3: "th3 = th" by simp |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
887 |
with eq_c and h2 have "(Th th, Th th2) \<in> (child s)\<^sup>+" by simp |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
888 |
with ch2 have "(Th th, Th th) \<in> (child s)\<^sup>+" by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
889 |
moreover have "wf ((child s)\<^sup>+)" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
890 |
proof(rule wf_trancl) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
891 |
from wf_child[OF vt] show "wf (child s)" . |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
892 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
893 |
ultimately show False by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
894 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
895 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
896 |
|
55
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
897 |
text {* (* ddd *) |
53
8142e80f5d58
Finished comments on PrioGDef.thy
xingyuan zhang <xingyuanzhang@126.com>
parents:
45
diff
changeset
|
898 |
*} |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
899 |
lemma unique_RAG_p: |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
900 |
assumes vt: "vt s" |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
901 |
and dp1: "(n, n1) \<in> (RAG s)^+" |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
902 |
and dp2: "(n, n2) \<in> (RAG s)^+" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
903 |
and neq: "n1 \<noteq> n2" |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
904 |
shows "(n1, n2) \<in> (RAG s)^+ \<or> (n2, n1) \<in> (RAG s)^+" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
905 |
proof(rule unique_chain [OF _ dp1 dp2 neq]) |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
906 |
from unique_RAG[OF vt] |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
907 |
show "\<And>a b c. \<lbrakk>(a, b) \<in> RAG s; (a, c) \<in> RAG s\<rbrakk> \<Longrightarrow> b = c" by auto |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
908 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
909 |
|
55
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
910 |
text {* (* ddd *) |
53
8142e80f5d58
Finished comments on PrioGDef.thy
xingyuan zhang <xingyuanzhang@126.com>
parents:
45
diff
changeset
|
911 |
*} |
32
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
912 |
lemma dependants_child_unique: |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
913 |
fixes s th th1 th2 th3 |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
914 |
assumes vt: "vt s" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
915 |
and ch1: "(Th th1, Th th) \<in> child s" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
916 |
and ch2: "(Th th2, Th th) \<in> child s" |
32
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
917 |
and dp1: "th3 \<in> dependants s th1" |
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
918 |
and dp2: "th3 \<in> dependants s th2" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
919 |
shows "th1 = th2" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
920 |
proof - |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
921 |
{ assume neq: "th1 \<noteq> th2" |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
922 |
from dp1 have dp1: "(Th th3, Th th1) \<in> (RAG s)^+" |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
923 |
by (simp add:s_dependants_def eq_RAG) |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
924 |
from dp2 have dp2: "(Th th3, Th th2) \<in> (RAG s)^+" |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
925 |
by (simp add:s_dependants_def eq_RAG) |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
926 |
from unique_RAG_p[OF vt dp1 dp2] and neq |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
927 |
have "(Th th1, Th th2) \<in> (RAG s)\<^sup>+ \<or> (Th th2, Th th1) \<in> (RAG s)\<^sup>+" by auto |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
928 |
hence False |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
929 |
proof |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
930 |
assume "(Th th1, Th th2) \<in> (RAG s)\<^sup>+ " |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
931 |
from children_no_dep[OF vt ch1 ch2 this] show ?thesis . |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
932 |
next |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
933 |
assume " (Th th2, Th th1) \<in> (RAG s)\<^sup>+" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
934 |
from children_no_dep[OF vt ch2 ch1 this] show ?thesis . |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
935 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
936 |
} thus ?thesis by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
937 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
938 |
|
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
939 |
lemma RAG_plus_elim: |
33
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
940 |
assumes "vt s" |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
941 |
fixes x |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
942 |
assumes "(Th x, Th th) \<in> (RAG (wq s))\<^sup>+" |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
943 |
shows "\<exists>th'\<in>children s th. x = th' \<or> (Th x, Th th') \<in> (RAG (wq s))\<^sup>+" |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
944 |
using assms(2)[unfolded eq_RAG, folded child_RAG_eq[OF `vt s`]] |
33
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
945 |
apply (unfold children_def) |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
946 |
by (metis assms(2) children_def RAG_children eq_RAG) |
33
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
947 |
|
55
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
948 |
text {* (* ddd *) |
53
8142e80f5d58
Finished comments on PrioGDef.thy
xingyuan zhang <xingyuanzhang@126.com>
parents:
45
diff
changeset
|
949 |
*} |
33
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
950 |
lemma dependants_expand: |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
951 |
assumes "vt s" |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
952 |
shows "dependants (wq s) th = (children s th) \<union> (\<Union>((dependants (wq s)) ` children s th))" |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
953 |
apply(simp add: image_def) |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
954 |
unfolding cs_dependants_def |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
955 |
apply(auto) |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
956 |
apply (metis assms RAG_plus_elim mem_Collect_eq) |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
957 |
apply (metis child_RAG_p children_def eq_RAG mem_Collect_eq r_into_trancl') |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
958 |
by (metis assms child_RAG_eq children_def eq_RAG mem_Collect_eq trancl.trancl_into_trancl) |
33
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
959 |
|
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
960 |
lemma finite_children: |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
961 |
assumes "vt s" |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
962 |
shows "finite (children s th)" |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
963 |
using children_dependants dependants_threads[OF assms] finite_threads[OF assms] |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
964 |
by (metis rev_finite_subset) |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
965 |
|
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
966 |
lemma finite_dependants: |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
967 |
assumes "vt s" |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
968 |
shows "finite (dependants (wq s) th')" |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
969 |
using dependants_threads[OF assms] finite_threads[OF assms] |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
970 |
by (metis rev_finite_subset) |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
971 |
|
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
972 |
abbreviation |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
973 |
"preceds s ths \<equiv> {preced th s| th. th \<in> ths}" |
33
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
974 |
|
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
975 |
abbreviation |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
976 |
"cpreceds s ths \<equiv> (cp s) ` ths" |
33
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
977 |
|
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
978 |
lemma Un_compr: |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
979 |
"{f th | th. R th \<or> Q th} = ({f th | th. R th} \<union> {f th' | th'. Q th'})" |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
980 |
by auto |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
981 |
|
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
982 |
lemma in_disj: |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
983 |
shows "x \<in> A \<or> (\<exists>y \<in> A. x \<in> Q y) \<longleftrightarrow> (\<exists>y \<in> A. x = y \<or> x \<in> Q y)" |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
984 |
by metis |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
985 |
|
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
986 |
lemma UN_exists: |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
987 |
shows "(\<Union>x \<in> A. {f y | y. Q y x}) = ({f y | y. (\<exists>x \<in> A. Q y x)})" |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
988 |
by auto |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
989 |
|
55
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
990 |
text {* (* ddd *) |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
991 |
This is the recursive equation used to compute the current precedence of |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
992 |
a thread (the @{text "th"}) here. |
53
8142e80f5d58
Finished comments on PrioGDef.thy
xingyuan zhang <xingyuanzhang@126.com>
parents:
45
diff
changeset
|
993 |
*} |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
994 |
lemma cp_rec: |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
995 |
fixes s th |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
996 |
assumes vt: "vt s" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
997 |
shows "cp s th = Max ({preced th s} \<union> (cp s ` children s th))" |
33
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
998 |
proof(cases "children s th = {}") |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
999 |
case True |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1000 |
show ?thesis |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1001 |
unfolding cp_eq_cpreced cpreced_def |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1002 |
by (subst dependants_expand[OF `vt s`]) (simp add: True) |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1003 |
next |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1004 |
case False |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1005 |
show ?thesis (is "?LHS = ?RHS") |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1006 |
proof - |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1007 |
have eq_cp: "cp s = (\<lambda>th. Max (preceds s ({th} \<union> dependants (wq s) th)))" |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1008 |
by (simp add: fun_eq_iff cp_eq_cpreced cpreced_def Un_compr image_Collect[symmetric]) |
33
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1009 |
|
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1010 |
have not_emptyness_facts[simp]: |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1011 |
"dependants (wq s) th \<noteq> {}" "children s th \<noteq> {}" |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1012 |
using False dependants_expand[OF assms] by(auto simp only: Un_empty) |
33
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1013 |
|
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1014 |
have finiteness_facts[simp]: |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1015 |
"\<And>th. finite (dependants (wq s) th)" "\<And>th. finite (children s th)" |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1016 |
by (simp_all add: finite_dependants[OF `vt s`] finite_children[OF `vt s`]) |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1017 |
|
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1018 |
(* expanding definition *) |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1019 |
have "?LHS = Max ({preced th s} \<union> preceds s (dependants (wq s) th))" |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1020 |
unfolding eq_cp by (simp add: Un_compr) |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1021 |
|
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1022 |
(* moving Max in *) |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1023 |
also have "\<dots> = max (Max {preced th s}) (Max (preceds s (dependants (wq s) th)))" |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1024 |
by (simp add: Max_Un) |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1025 |
|
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1026 |
(* expanding dependants *) |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1027 |
also have "\<dots> = max (Max {preced th s}) |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1028 |
(Max (preceds s (children s th \<union> \<Union>(dependants (wq s) ` children s th))))" |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1029 |
by (subst dependants_expand[OF `vt s`]) (simp) |
33
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1030 |
|
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1031 |
(* moving out big Union *) |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1032 |
also have "\<dots> = max (Max {preced th s}) |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1033 |
(Max (preceds s (\<Union> ({children s th} \<union> (dependants (wq s) ` children s th)))))" |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1034 |
by simp |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1035 |
|
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1036 |
(* moving in small union *) |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1037 |
also have "\<dots> = max (Max {preced th s}) |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1038 |
(Max (preceds s (\<Union> ((\<lambda>th. {th} \<union> (dependants (wq s) th)) ` children s th))))" |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1039 |
by (simp add: in_disj) |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1040 |
|
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1041 |
(* moving in preceds *) |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1042 |
also have "\<dots> = max (Max {preced th s}) |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1043 |
(Max (\<Union> ((\<lambda>th. preceds s ({th} \<union> (dependants (wq s) th))) ` children s th)))" |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1044 |
by (simp add: UN_exists) |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1045 |
|
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1046 |
(* moving in Max *) |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1047 |
also have "\<dots> = max (Max {preced th s}) |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1048 |
(Max ((\<lambda>th. Max (preceds s ({th} \<union> (dependants (wq s) th)))) ` children s th))" |
58 | 1049 |
by (subst Max_Union) (auto simp add: image_image) |
33
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1050 |
|
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1051 |
(* folding cp + moving out Max *) |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1052 |
also have "\<dots> = ?RHS" |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1053 |
unfolding eq_cp by (simp add: Max_insert) |
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1054 |
|
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
1055 |
finally show "?LHS = ?RHS" . |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1056 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1057 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1058 |
|
58 | 1059 |
lemma next_th_holding: |
1060 |
assumes vt: "vt s" |
|
1061 |
and nxt: "next_th s th cs th'" |
|
1062 |
shows "holding (wq s) th cs" |
|
1063 |
proof - |
|
1064 |
from nxt[unfolded next_th_def] |
|
1065 |
obtain rest where h: "wq s cs = th # rest" |
|
1066 |
"rest \<noteq> []" |
|
1067 |
"th' = hd (SOME q. distinct q \<and> set q = set rest)" by auto |
|
1068 |
thus ?thesis |
|
1069 |
by (unfold cs_holding_def, auto) |
|
1070 |
qed |
|
1071 |
||
1072 |
lemma next_th_waiting: |
|
55
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1073 |
assumes vt: "vt s" |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1074 |
and nxt: "next_th s th cs th'" |
58 | 1075 |
shows "waiting (wq s) th' cs" |
55
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1076 |
proof - |
58 | 1077 |
from nxt[unfolded next_th_def] |
1078 |
obtain rest where h: "wq s cs = th # rest" |
|
1079 |
"rest \<noteq> []" |
|
1080 |
"th' = hd (SOME q. distinct q \<and> set q = set rest)" by auto |
|
1081 |
from wq_distinct[OF vt, of cs, unfolded h] |
|
1082 |
have dst: "distinct (th # rest)" . |
|
1083 |
have in_rest: "th' \<in> set rest" |
|
1084 |
proof(unfold h, rule someI2) |
|
1085 |
show "distinct rest \<and> set rest = set rest" using dst by auto |
|
55
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1086 |
next |
58 | 1087 |
fix x assume "distinct x \<and> set x = set rest" |
1088 |
with h(2) |
|
1089 |
show "hd x \<in> set (rest)" by (cases x, auto) |
|
55
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1090 |
qed |
58 | 1091 |
hence "th' \<in> set (wq s cs)" by (unfold h(1), auto) |
1092 |
moreover have "th' \<noteq> hd (wq s cs)" |
|
1093 |
by (unfold h(1), insert in_rest dst, auto) |
|
1094 |
ultimately show ?thesis by (auto simp:cs_waiting_def) |
|
55
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1095 |
qed |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1096 |
|
58 | 1097 |
lemma next_th_RAG: |
1098 |
assumes vt: "vt s" |
|
1099 |
and nxt: "next_th s th cs th'" |
|
1100 |
shows "{(Cs cs, Th th), (Th th', Cs cs)} \<subseteq> RAG s" |
|
1101 |
using assms next_th_holding next_th_waiting |
|
1102 |
by (unfold s_RAG_def, simp) |
|
1103 |
||
56
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1104 |
-- {* A useless definition *} |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1105 |
definition cps:: "state \<Rightarrow> (thread \<times> precedence) set" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1106 |
where "cps s = {(th, cp s th) | th . th \<in> threads s}" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1107 |
|
56
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1108 |
|
55
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1109 |
text {* (* ddd *) |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1110 |
One beauty of our modelling is that we follow the definitional extension tradition of HOL. |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1111 |
The benefit of such a concise and miniature model is that large number of intuitively |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1112 |
obvious facts are derived as lemmas, rather than asserted as axioms. |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1113 |
*} |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1114 |
|
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1115 |
text {* |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1116 |
However, the lemmas in the forthcoming several locales are no longer |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1117 |
obvious. These lemmas show how the current precedences should be recalculated |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1118 |
after every execution step (in our model, every step is represented by an event, |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1119 |
which in turn, represents a system call, or operation). Each operation is |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1120 |
treated in a separate locale. |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1121 |
|
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1122 |
The complication of current precedence recalculation comes |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1123 |
because the changing of RAG needs to be taken into account, |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1124 |
in addition to the changing of precedence. |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1125 |
The reason RAG changing affects current precedence is that, |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1126 |
according to the definition, current precedence |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1127 |
of a thread is the maximum of the precedences of its dependants, |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1128 |
where the dependants are defined in terms of RAG. |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1129 |
|
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1130 |
Therefore, each operation, lemmas concerning the change of the precedences |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1131 |
and RAG are derived first, so that the lemmas about |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1132 |
current precedence recalculation can be based on. |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1133 |
*} |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1134 |
|
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1135 |
text {* (* ddd *) |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1136 |
The following locale @{text "step_set_cps"} investigates the recalculation |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1137 |
after the @{text "Set"} operation. |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1138 |
*} |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1139 |
locale step_set_cps = |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1140 |
fixes s' th prio s |
55
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1141 |
-- {* @{text "s'"} is the system state before the operation *} |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1142 |
-- {* @{text "s"} is the system state after the operation *} |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1143 |
defines s_def : "s \<equiv> (Set th prio#s')" |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1144 |
-- {* @{text "s"} is assumed to be a legitimate state, from which |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1145 |
the legitimacy of @{text "s"} can be derived. *} |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1146 |
assumes vt_s: "vt s" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1147 |
|
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1148 |
context step_set_cps |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1149 |
begin |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1150 |
|
55
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1151 |
text {* (* ddd *) |
58 | 1152 |
The following two lemmas confirm that @{text "Set"}-operating only changes the precedence |
1153 |
of the initiating thread. |
|
55
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1154 |
*} |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1155 |
|
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1156 |
lemma eq_preced: |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1157 |
fixes th' |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1158 |
assumes "th' \<noteq> th" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1159 |
shows "preced th' s = preced th' s'" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1160 |
proof - |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1161 |
from assms show ?thesis |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1162 |
by (unfold s_def, auto simp:preced_def) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1163 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1164 |
|
58 | 1165 |
lemma eq_the_preced: |
1166 |
fixes th' |
|
1167 |
assumes "th' \<noteq> th" |
|
1168 |
shows "the_preced s th' = the_preced s' th'" |
|
1169 |
using assms |
|
1170 |
by (unfold the_preced_def, intro eq_preced, simp) |
|
1171 |
||
1172 |
text {* |
|
55
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1173 |
The following lemma assures that the resetting of priority does not change the RAG. |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1174 |
*} |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1175 |
|
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1176 |
lemma eq_dep: "RAG s = RAG s'" |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1177 |
by (unfold s_def RAG_set_unchanged, auto) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1178 |
|
58 | 1179 |
text {* (* ddd *) |
1180 |
Th following lemma @{text "eq_cp_pre"} says the priority change of @{text "th"} |
|
1181 |
only affects those threads, which as @{text "Th th"} in their sub-trees. |
|
1182 |
||
1183 |
The proof of this lemma is simplified by using the alternative definition of @{text "cp"}. |
|
55
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1184 |
*} |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1185 |
|
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1186 |
lemma eq_cp_pre: |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1187 |
fixes th' |
58 | 1188 |
assumes nd: "Th th \<notin> subtree (RAG s') (Th th')" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1189 |
shows "cp s th' = cp s' th'" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1190 |
proof - |
58 | 1191 |
-- {* After unfolding using the alternative definition, elements |
1192 |
affecting the @{term "cp"}-value of threads become explicit. |
|
1193 |
We only need to prove the following: *} |
|
1194 |
have "Max (the_preced s ` {th'a. Th th'a \<in> subtree (RAG s) (Th th')}) = |
|
1195 |
Max (the_preced s' ` {th'a. Th th'a \<in> subtree (RAG s') (Th th')})" |
|
1196 |
(is "Max (?f ` ?S1) = Max (?g ` ?S2)") |
|
55
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1197 |
proof - |
58 | 1198 |
-- {* The base sets are equal. *} |
1199 |
have "?S1 = ?S2" using eq_dep by simp |
|
1200 |
-- {* The function values on the base set are equal as well. *} |
|
1201 |
moreover have "\<forall> e \<in> ?S2. ?f e = ?g e" |
|
1202 |
proof |
|
1203 |
fix th1 |
|
1204 |
assume "th1 \<in> ?S2" |
|
1205 |
with nd have "th1 \<noteq> th" by (auto) |
|
1206 |
from eq_the_preced[OF this] |
|
1207 |
show "the_preced s th1 = the_preced s' th1" . |
|
1208 |
qed |
|
1209 |
-- {* Therefore, the image of the functions are equal. *} |
|
1210 |
ultimately have "(?f ` ?S1) = (?g ` ?S2)" by (auto intro!:f_image_eq) |
|
1211 |
thus ?thesis by simp |
|
1212 |
qed |
|
1213 |
thus ?thesis by (simp add:cp_alt_def) |
|
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1214 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1215 |
|
55
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1216 |
text {* |
58 | 1217 |
The following lemma shows that @{term "th"} is not in the |
1218 |
sub-tree of any other thread. |
|
55
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1219 |
*} |
58 | 1220 |
lemma th_in_no_subtree: |
1221 |
assumes "th' \<noteq> th" |
|
1222 |
shows "Th th \<notin> subtree (RAG s') (Th th')" |
|
1223 |
proof - |
|
1224 |
have "th \<in> readys s'" |
|
55
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1225 |
proof - |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1226 |
from step_back_step [OF vt_s[unfolded s_def]] |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1227 |
have "step s' (Set th prio)" . |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1228 |
hence "th \<in> runing s'" by (cases, simp) |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1229 |
thus ?thesis by (simp add:readys_def runing_def) |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1230 |
qed |
58 | 1231 |
from readys_in_no_subtree[OF step_back_vt[OF vt_s[unfolded s_def]] this assms(1)] |
1232 |
show ?thesis by blast |
|
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1233 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1234 |
|
55
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1235 |
text {* |
58 | 1236 |
By combining @{thm "eq_cp_pre"} and @{thm "th_in_no_subtree"}, |
1237 |
it is obvious that the change of priority only affects the @{text "cp"}-value |
|
1238 |
of the initiating thread @{text "th"}. |
|
55
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1239 |
*} |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1240 |
lemma eq_cp: |
55
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1241 |
fixes th' |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1242 |
assumes "th' \<noteq> th" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1243 |
shows "cp s th' = cp s' th'" |
58 | 1244 |
by (rule eq_cp_pre[OF th_in_no_subtree[OF assms]]) |
55
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1245 |
|
56
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1246 |
end |
55
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1247 |
|
56
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1248 |
text {* |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1249 |
The following @{text "step_v_cps"} is the locale for @{text "V"}-operation. |
55
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1250 |
*} |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
1251 |
|
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1252 |
locale step_v_cps = |
56
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1253 |
-- {* @{text "th"} is the initiating thread *} |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1254 |
-- {* @{text "cs"} is the critical resource release by the @{text "V"}-operation *} |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1255 |
fixes s' th cs s -- {* @{text "s'"} is the state before operation*} |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1256 |
defines s_def : "s \<equiv> (V th cs#s')" -- {* @{text "s"} is the state after operation*} |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1257 |
-- {* @{text "s"} is assumed to be valid, which implies the validity of @{text "s'"} *} |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1258 |
assumes vt_s: "vt s" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1259 |
|
58 | 1260 |
context step_v_cps |
1261 |
begin |
|
1262 |
||
1263 |
lemma rtree_RAGs: "rtree (RAG s)" |
|
1264 |
proof |
|
1265 |
show "single_valued (RAG s)" |
|
1266 |
apply (intro_locales) |
|
1267 |
by (unfold single_valued_def, auto intro: unique_RAG[OF vt_s]) |
|
1268 |
||
1269 |
show "acyclic (RAG s)" |
|
1270 |
by (rule acyclic_RAG[OF vt_s]) |
|
1271 |
qed |
|
1272 |
||
1273 |
lemma rtree_RAGs': "rtree (RAG s')" |
|
1274 |
proof |
|
1275 |
show "single_valued (RAG s')" |
|
1276 |
apply (intro_locales) |
|
1277 |
by (unfold single_valued_def, |
|
1278 |
auto intro:unique_RAG[OF step_back_vt[OF vt_s[unfolded s_def]]]) |
|
1279 |
||
1280 |
show "acyclic (RAG s')" |
|
1281 |
by (rule acyclic_RAG[OF step_back_vt[OF vt_s[unfolded s_def]]]) |
|
1282 |
qed |
|
1283 |
||
1284 |
lemmas vt_s' = step_back_vt[OF vt_s[unfolded s_def]] |
|
1285 |
||
1286 |
lemma ready_th_s': "th \<in> readys s'" |
|
1287 |
using step_back_step[OF vt_s[unfolded s_def]] |
|
1288 |
by (cases, simp add:runing_def) |
|
1289 |
||
1290 |
||
1291 |
lemma ancestors_th: "ancestors (RAG s') (Th th) = {}" |
|
1292 |
proof - |
|
1293 |
from readys_root[OF vt_s' ready_th_s'] |
|
1294 |
show ?thesis |
|
1295 |
by (unfold root_def, simp) |
|
1296 |
qed |
|
1297 |
||
1298 |
lemma holding_th: "holding s' th cs" |
|
1299 |
proof - |
|
1300 |
from vt_s[unfolded s_def] |
|
1301 |
have " PIP s' (V th cs)" by (cases, simp) |
|
1302 |
thus ?thesis by (cases, auto) |
|
1303 |
qed |
|
1304 |
||
1305 |
lemma edge_of_th: |
|
1306 |
"(Cs cs, Th th) \<in> RAG s'" |
|
1307 |
proof - |
|
1308 |
from holding_th |
|
1309 |
show ?thesis |
|
1310 |
by (unfold s_RAG_def holding_eq, auto) |
|
1311 |
qed |
|
1312 |
||
1313 |
lemma ancestors_cs: |
|
1314 |
"ancestors (RAG s') (Cs cs) = {Th th}" |
|
1315 |
proof - |
|
1316 |
find_theorems ancestors |
|
1317 |
have "ancestors (RAG s') (Cs cs) = ancestors (RAG s') (Th th) \<union> {Th th}" |
|
1318 |
proof(rule RTree.rtree.ancestors_accum[OF rtree_RAGs']) |
|
1319 |
from vt_s[unfolded s_def] |
|
1320 |
have " PIP s' (V th cs)" by (cases, simp) |
|
1321 |
thus "(Cs cs, Th th) \<in> RAG s'" |
|
1322 |
proof(cases) |
|
1323 |
assume "holding s' th cs" |
|
1324 |
from this[unfolded holding_eq] |
|
1325 |
show ?thesis by (unfold s_RAG_def, auto) |
|
1326 |
qed |
|
1327 |
qed |
|
1328 |
from this[unfolded ancestors_th] show ?thesis by simp |
|
1329 |
qed |
|
1330 |
||
1331 |
lemma preced_kept: "the_preced s = the_preced s'" |
|
1332 |
by (auto simp: s_def the_preced_def preced_def) |
|
1333 |
||
1334 |
end |
|
1335 |
||
1336 |
||
56
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1337 |
text {* |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1338 |
The following @{text "step_v_cps_nt"} is the sub-locale for @{text "V"}-operation, |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1339 |
which represents the case when there is another thread @{text "th'"} |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1340 |
to take over the critical resource released by the initiating thread @{text "th"}. |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1341 |
*} |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1342 |
locale step_v_cps_nt = step_v_cps + |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1343 |
fixes th' |
56
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1344 |
-- {* @{text "th'"} is assumed to take over @{text "cs"} *} |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1345 |
assumes nt: "next_th s' th cs th'" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1346 |
|
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1347 |
context step_v_cps_nt |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1348 |
begin |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1349 |
|
56
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1350 |
text {* |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1351 |
Lemma @{text "RAG_s"} confirms the change of RAG: |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1352 |
two edges removed and one added, as shown by the following diagram. |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1353 |
*} |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1354 |
|
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1355 |
(* |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1356 |
RAG before the V-operation |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1357 |
th1 ----| |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1358 |
| |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1359 |
th' ----| |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1360 |
|----> cs -----| |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1361 |
th2 ----| | |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1362 |
| | |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1363 |
th3 ----| | |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1364 |
|------> th |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1365 |
th4 ----| | |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1366 |
| | |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1367 |
th5 ----| | |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1368 |
|----> cs'-----| |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1369 |
th6 ----| |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1370 |
| |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1371 |
th7 ----| |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1372 |
|
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1373 |
RAG after the V-operation |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1374 |
th1 ----| |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1375 |
| |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1376 |
|----> cs ----> th' |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1377 |
th2 ----| |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1378 |
| |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1379 |
th3 ----| |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1380 |
|
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1381 |
th4 ----| |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1382 |
| |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1383 |
th5 ----| |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1384 |
|----> cs'----> th |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1385 |
th6 ----| |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1386 |
| |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1387 |
th7 ----| |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1388 |
*) |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1389 |
|
58 | 1390 |
lemma sub_RAGs': "{(Cs cs, Th th), (Th th', Cs cs)} \<subseteq> RAG s'" |
1391 |
using next_th_RAG[OF vt_s' nt] . |
|
1392 |
||
1393 |
lemma ancestors_th': |
|
1394 |
"ancestors (RAG s') (Th th') = {Th th, Cs cs}" |
|
1395 |
proof - |
|
1396 |
have "ancestors (RAG s') (Th th') = ancestors (RAG s') (Cs cs) \<union> {Cs cs}" |
|
1397 |
proof(rule RTree.rtree.ancestors_accum[OF rtree_RAGs']) |
|
1398 |
from sub_RAGs' show "(Th th', Cs cs) \<in> RAG s'" by auto |
|
1399 |
qed |
|
1400 |
thus ?thesis using ancestors_th ancestors_cs by auto |
|
1401 |
qed |
|
1402 |
||
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1403 |
lemma RAG_s: |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1404 |
"RAG s = (RAG s' - {(Cs cs, Th th), (Th th', Cs cs)}) \<union> |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1405 |
{(Cs cs, Th th')}" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1406 |
proof - |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1407 |
from step_RAG_v[OF vt_s[unfolded s_def], folded s_def] |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1408 |
and nt show ?thesis by (auto intro:next_th_unique) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1409 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1410 |
|
58 | 1411 |
lemma subtree_kept: |
1412 |
assumes "th1 \<notin> {th, th'}" |
|
1413 |
shows "subtree (RAG s) (Th th1) = subtree (RAG s') (Th th1)" (is "_ = ?R") |
|
1414 |
proof - |
|
1415 |
let ?RAG' = "(RAG s' - {(Cs cs, Th th), (Th th', Cs cs)})" |
|
1416 |
let ?RAG'' = "?RAG' \<union> {(Cs cs, Th th')}" |
|
1417 |
have "subtree ?RAG' (Th th1) = ?R" |
|
1418 |
proof(rule subset_del_subtree_outside) |
|
1419 |
show "Range {(Cs cs, Th th), (Th th', Cs cs)} \<inter> subtree (RAG s') (Th th1) = {}" |
|
1420 |
proof - |
|
1421 |
have "(Th th) \<notin> subtree (RAG s') (Th th1)" |
|
1422 |
proof(rule subtree_refute) |
|
1423 |
show "Th th1 \<notin> ancestors (RAG s') (Th th)" |
|
1424 |
by (unfold ancestors_th, simp) |
|
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1425 |
next |
58 | 1426 |
from assms show "Th th1 \<noteq> Th th" by simp |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1427 |
qed |
58 | 1428 |
moreover have "(Cs cs) \<notin> subtree (RAG s') (Th th1)" |
1429 |
proof(rule subtree_refute) |
|
1430 |
show "Th th1 \<notin> ancestors (RAG s') (Cs cs)" |
|
1431 |
by (unfold ancestors_cs, insert assms, auto) |
|
1432 |
qed simp |
|
1433 |
ultimately have "{Th th, Cs cs} \<inter> subtree (RAG s') (Th th1) = {}" by auto |
|
1434 |
thus ?thesis by simp |
|
1435 |
qed |
|
1436 |
qed |
|
1437 |
moreover have "subtree ?RAG'' (Th th1) = subtree ?RAG' (Th th1)" |
|
1438 |
proof(rule subtree_insert_next) |
|
1439 |
show "Th th' \<notin> subtree (RAG s' - {(Cs cs, Th th), (Th th', Cs cs)}) (Th th1)" |
|
1440 |
proof(rule subtree_refute) |
|
1441 |
show "Th th1 \<notin> ancestors (RAG s' - {(Cs cs, Th th), (Th th', Cs cs)}) (Th th')" |
|
1442 |
(is "_ \<notin> ?R") |
|
1443 |
proof - |
|
1444 |
have "?R \<subseteq> ancestors (RAG s') (Th th')" by (rule ancestors_mono, auto) |
|
1445 |
moreover have "Th th1 \<notin> ..." using ancestors_th' assms by simp |
|
1446 |
ultimately show ?thesis by auto |
|
1447 |
qed |
|
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1448 |
next |
58 | 1449 |
from assms show "Th th1 \<noteq> Th th'" by simp |
1450 |
qed |
|
1451 |
qed |
|
1452 |
ultimately show ?thesis by (unfold RAG_s, simp) |
|
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1453 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1454 |
|
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1455 |
lemma cp_kept: |
58 | 1456 |
assumes "th1 \<notin> {th, th'}" |
1457 |
shows "cp s th1 = cp s' th1" |
|
1458 |
by (unfold cp_alt_def preced_kept subtree_kept[OF assms], simp) |
|
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1459 |
|
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1460 |
end |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1461 |
|
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1462 |
locale step_v_cps_nnt = step_v_cps + |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1463 |
assumes nnt: "\<And> th'. (\<not> next_th s' th cs th')" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1464 |
|
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1465 |
context step_v_cps_nnt |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1466 |
begin |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1467 |
|
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1468 |
lemma RAG_s: "RAG s = RAG s' - {(Cs cs, Th th)}" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1469 |
proof - |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1470 |
from nnt and step_RAG_v[OF vt_s[unfolded s_def], folded s_def] |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1471 |
show ?thesis by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1472 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1473 |
|
58 | 1474 |
lemma subtree_kept: |
1475 |
assumes "th1 \<noteq> th" |
|
1476 |
shows "subtree (RAG s) (Th th1) = subtree (RAG s') (Th th1)" |
|
1477 |
proof(unfold RAG_s, rule subset_del_subtree_outside) |
|
1478 |
show "Range {(Cs cs, Th th)} \<inter> subtree (RAG s') (Th th1) = {}" |
|
1479 |
proof - |
|
1480 |
have "(Th th) \<notin> subtree (RAG s') (Th th1)" |
|
1481 |
proof(rule subtree_refute) |
|
1482 |
show "Th th1 \<notin> ancestors (RAG s') (Th th)" |
|
1483 |
by (unfold ancestors_th, simp) |
|
1484 |
next |
|
1485 |
from assms show "Th th1 \<noteq> Th th" by simp |
|
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1486 |
qed |
58 | 1487 |
thus ?thesis by auto |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1488 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1489 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1490 |
|
58 | 1491 |
lemma cp_kept_1: |
1492 |
assumes "th1 \<noteq> th" |
|
1493 |
shows "cp s th1 = cp s' th1" |
|
1494 |
by (unfold cp_alt_def preced_kept subtree_kept[OF assms], simp) |
|
1495 |
||
1496 |
lemma subtree_cs: "subtree (RAG s') (Cs cs) = {Cs cs}" |
|
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1497 |
proof - |
58 | 1498 |
{ fix n |
1499 |
have "(Cs cs) \<notin> ancestors (RAG s') n" |
|
1500 |
proof |
|
1501 |
assume "Cs cs \<in> ancestors (RAG s') n" |
|
1502 |
hence "(n, Cs cs) \<in> (RAG s')^+" by (auto simp:ancestors_def) |
|
1503 |
from tranclE[OF this] obtain nn where h: "(nn, Cs cs) \<in> RAG s'" by auto |
|
1504 |
then obtain th' where "nn = Th th'" |
|
1505 |
by (unfold s_RAG_def, auto) |
|
1506 |
from h[unfolded this] have "(Th th', Cs cs) \<in> RAG s'" . |
|
1507 |
from this[unfolded s_RAG_def] |
|
1508 |
have "waiting (wq s') th' cs" by auto |
|
1509 |
from this[unfolded cs_waiting_def] |
|
1510 |
have "1 < length (wq s' cs)" |
|
1511 |
by (cases "wq s' cs", auto) |
|
1512 |
from holding_next_thI[OF holding_th this] |
|
1513 |
obtain th' where "next_th s' th cs th'" by auto |
|
1514 |
with nnt show False by auto |
|
1515 |
qed |
|
1516 |
} note h = this |
|
1517 |
{ fix n |
|
1518 |
assume "n \<in> subtree (RAG s') (Cs cs)" |
|
1519 |
hence "n = (Cs cs)" |
|
1520 |
by (elim subtreeE, insert h, auto) |
|
1521 |
} moreover have "(Cs cs) \<in> subtree (RAG s') (Cs cs)" |
|
1522 |
by (auto simp:subtree_def) |
|
1523 |
ultimately show ?thesis by auto |
|
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1524 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1525 |
|
58 | 1526 |
lemma subtree_th: |
1527 |
"subtree (RAG s) (Th th) = subtree (RAG s') (Th th) - {Cs cs}" |
|
1528 |
proof(unfold RAG_s, fold subtree_cs, rule RTree.rtree.subtree_del_inside[OF rtree_RAGs']) |
|
1529 |
from edge_of_th |
|
1530 |
show "(Cs cs, Th th) \<in> edges_in (RAG s') (Th th)" |
|
1531 |
by (unfold edges_in_def, auto simp:subtree_def) |
|
1532 |
qed |
|
1533 |
||
1534 |
lemma cp_kept_2: |
|
1535 |
shows "cp s th = cp s' th" |
|
1536 |
by (unfold cp_alt_def subtree_th preced_kept, auto) |
|
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1537 |
|
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1538 |
lemma eq_cp: |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1539 |
fixes th' |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1540 |
shows "cp s th' = cp s' th'" |
58 | 1541 |
using cp_kept_1 cp_kept_2 |
1542 |
by (cases "th' = th", auto) |
|
1543 |
||
1544 |
end |
|
1545 |
||
1546 |
find_theorems "_`_" "\<Union> _" |
|
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1547 |
|
58 | 1548 |
find_theorems "Max" "\<Union> _" |
1549 |
||
1550 |
find_theorems wf RAG |
|
1551 |
||
1552 |
thm wf_def |
|
1553 |
||
1554 |
thm image_Union |
|
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1555 |
|
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1556 |
locale step_P_cps = |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1557 |
fixes s' th cs s |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1558 |
defines s_def : "s \<equiv> (P th cs#s')" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1559 |
assumes vt_s: "vt s" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1560 |
|
58 | 1561 |
sublocale step_P_cps < vat_s : valid_trace "s" |
1562 |
proof |
|
1563 |
from vt_s show "vt s" . |
|
1564 |
qed |
|
1565 |
||
1566 |
sublocale step_P_cps < vat_s' : valid_trace "s'" |
|
1567 |
proof |
|
1568 |
from step_back_vt[OF vt_s[unfolded s_def]] show "vt s'" . |
|
1569 |
qed |
|
1570 |
||
1571 |
||
1572 |
context step_P_cps |
|
1573 |
begin |
|
1574 |
||
1575 |
lemma rtree_RAGs: "rtree (RAG s)" |
|
1576 |
proof |
|
1577 |
show "single_valued (RAG s)" |
|
1578 |
apply (intro_locales) |
|
1579 |
by (unfold single_valued_def, auto intro: unique_RAG[OF vt_s]) |
|
1580 |
||
1581 |
show "acyclic (RAG s)" |
|
1582 |
by (rule acyclic_RAG[OF vt_s]) |
|
1583 |
qed |
|
1584 |
||
1585 |
lemma rtree_RAGs': "rtree (RAG s')" |
|
1586 |
proof |
|
1587 |
show "single_valued (RAG s')" |
|
1588 |
apply (intro_locales) |
|
1589 |
by (unfold single_valued_def, |
|
1590 |
auto intro:unique_RAG[OF step_back_vt[OF vt_s[unfolded s_def]]]) |
|
1591 |
||
1592 |
show "acyclic (RAG s')" |
|
1593 |
by (rule acyclic_RAG[OF step_back_vt[OF vt_s[unfolded s_def]]]) |
|
1594 |
qed |
|
1595 |
||
1596 |
lemma preced_kept: "the_preced s = the_preced s'" |
|
1597 |
by (auto simp: s_def the_preced_def preced_def) |
|
1598 |
||
1599 |
end |
|
1600 |
||
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1601 |
locale step_P_cps_ne =step_P_cps + |
58 | 1602 |
fixes th' |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1603 |
assumes ne: "wq s' cs \<noteq> []" |
58 | 1604 |
defines th'_def: "th' \<equiv> hd (wq s' cs)" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1605 |
|
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1606 |
locale step_P_cps_e =step_P_cps + |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1607 |
assumes ee: "wq s' cs = []" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1608 |
|
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1609 |
context step_P_cps_e |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1610 |
begin |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1611 |
|
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1612 |
lemma RAG_s: "RAG s = RAG s' \<union> {(Cs cs, Th th)}" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1613 |
proof - |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1614 |
from ee and step_RAG_p[OF vt_s[unfolded s_def], folded s_def] |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1615 |
show ?thesis by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1616 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1617 |
|
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1618 |
lemma child_kept_left: |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1619 |
assumes |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1620 |
"(n1, n2) \<in> (child s')^+" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1621 |
shows "(n1, n2) \<in> (child s)^+" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1622 |
proof - |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1623 |
from assms show ?thesis |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1624 |
proof(induct rule: converse_trancl_induct) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1625 |
case (base y) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1626 |
from base obtain th1 cs1 th2 |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1627 |
where h1: "(Th th1, Cs cs1) \<in> RAG s'" |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1628 |
and h2: "(Cs cs1, Th th2) \<in> RAG s'" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1629 |
and eq_y: "y = Th th1" and eq_n2: "n2 = Th th2" by (auto simp:child_def) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1630 |
have "cs1 \<noteq> cs" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1631 |
proof |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1632 |
assume eq_cs: "cs1 = cs" |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1633 |
with h1 have "(Th th1, Cs cs) \<in> RAG s'" by simp |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1634 |
with ee show False |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1635 |
by (auto simp:s_RAG_def cs_waiting_def) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1636 |
qed |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1637 |
with h1 h2 RAG_s have |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1638 |
h1': "(Th th1, Cs cs1) \<in> RAG s" and |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1639 |
h2': "(Cs cs1, Th th2) \<in> RAG s" by auto |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1640 |
hence "(Th th1, Th th2) \<in> child s" by (auto simp:child_def) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1641 |
with eq_y eq_n2 have "(y, n2) \<in> child s" by simp |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1642 |
thus ?case by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1643 |
next |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1644 |
case (step y z) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1645 |
have "(y, z) \<in> child s'" by fact |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1646 |
then obtain th1 cs1 th2 |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1647 |
where h1: "(Th th1, Cs cs1) \<in> RAG s'" |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1648 |
and h2: "(Cs cs1, Th th2) \<in> RAG s'" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1649 |
and eq_y: "y = Th th1" and eq_z: "z = Th th2" by (auto simp:child_def) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1650 |
have "cs1 \<noteq> cs" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1651 |
proof |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1652 |
assume eq_cs: "cs1 = cs" |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1653 |
with h1 have "(Th th1, Cs cs) \<in> RAG s'" by simp |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1654 |
with ee show False |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1655 |
by (auto simp:s_RAG_def cs_waiting_def) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1656 |
qed |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1657 |
with h1 h2 RAG_s have |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1658 |
h1': "(Th th1, Cs cs1) \<in> RAG s" and |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1659 |
h2': "(Cs cs1, Th th2) \<in> RAG s" by auto |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1660 |
hence "(Th th1, Th th2) \<in> child s" by (auto simp:child_def) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1661 |
with eq_y eq_z have "(y, z) \<in> child s" by simp |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1662 |
moreover have "(z, n2) \<in> (child s)^+" by fact |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1663 |
ultimately show ?case by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1664 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1665 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1666 |
|
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1667 |
lemma child_kept_right: |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1668 |
assumes |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1669 |
"(n1, n2) \<in> (child s)^+" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1670 |
shows "(n1, n2) \<in> (child s')^+" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1671 |
proof - |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1672 |
from assms show ?thesis |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1673 |
proof(induct) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1674 |
case (base y) |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1675 |
from base and RAG_s |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1676 |
have "(n1, y) \<in> child s'" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1677 |
apply (auto simp:child_def) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1678 |
proof - |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1679 |
fix th' |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1680 |
assume "(Th th', Cs cs) \<in> RAG s'" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1681 |
with ee have "False" |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1682 |
by (auto simp:s_RAG_def cs_waiting_def) |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1683 |
thus "\<exists>cs. (Th th', Cs cs) \<in> RAG s' \<and> (Cs cs, Th th) \<in> RAG s'" by auto |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1684 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1685 |
thus ?case by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1686 |
next |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1687 |
case (step y z) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1688 |
have "(y, z) \<in> child s" by fact |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1689 |
with RAG_s have "(y, z) \<in> child s'" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1690 |
apply (auto simp:child_def) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1691 |
proof - |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1692 |
fix th' |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1693 |
assume "(Th th', Cs cs) \<in> RAG s'" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1694 |
with ee have "False" |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1695 |
by (auto simp:s_RAG_def cs_waiting_def) |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1696 |
thus "\<exists>cs. (Th th', Cs cs) \<in> RAG s' \<and> (Cs cs, Th th) \<in> RAG s'" by auto |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1697 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1698 |
moreover have "(n1, y) \<in> (child s')\<^sup>+" by fact |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1699 |
ultimately show ?case by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1700 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1701 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1702 |
|
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1703 |
lemma eq_child: "(child s)^+ = (child s')^+" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1704 |
by (insert child_kept_left child_kept_right, auto) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1705 |
|
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1706 |
lemma eq_cp: |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1707 |
fixes th' |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1708 |
shows "cp s th' = cp s' th'" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1709 |
apply (unfold cp_eq_cpreced cpreced_def) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1710 |
proof - |
32
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
1711 |
have eq_dp: "\<And> th. dependants (wq s) th = dependants (wq s') th" |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1712 |
apply (unfold cs_dependants_def, unfold eq_RAG) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1713 |
proof - |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1714 |
from eq_child |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1715 |
have "\<And>th. {th'. (Th th', Th th) \<in> (child s)\<^sup>+} = {th'. (Th th', Th th) \<in> (child s')\<^sup>+}" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1716 |
by auto |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1717 |
with child_RAG_eq[OF vt_s] child_RAG_eq[OF step_back_vt[OF vt_s[unfolded s_def]]] |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1718 |
show "\<And>th. {th'. (Th th', Th th) \<in> (RAG s)\<^sup>+} = {th'. (Th th', Th th) \<in> (RAG s')\<^sup>+}" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1719 |
by simp |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1720 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1721 |
moreover { |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1722 |
fix th1 |
32
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
1723 |
assume "th1 \<in> {th'} \<union> dependants (wq s') th'" |
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
1724 |
hence "th1 = th' \<or> th1 \<in> dependants (wq s') th'" by auto |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1725 |
hence "preced th1 s = preced th1 s'" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1726 |
proof |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1727 |
assume "th1 = th'" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1728 |
show "preced th1 s = preced th1 s'" by (simp add:s_def preced_def) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1729 |
next |
32
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
1730 |
assume "th1 \<in> dependants (wq s') th'" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1731 |
show "preced th1 s = preced th1 s'" by (simp add:s_def preced_def) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1732 |
qed |
32
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
1733 |
} ultimately have "((\<lambda>th. preced th s) ` ({th'} \<union> dependants (wq s) th')) = |
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
1734 |
((\<lambda>th. preced th s') ` ({th'} \<union> dependants (wq s') th'))" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1735 |
by (auto simp:image_def) |
32
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
1736 |
thus "Max ((\<lambda>th. preced th s) ` ({th'} \<union> dependants (wq s) th')) = |
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
1737 |
Max ((\<lambda>th. preced th s') ` ({th'} \<union> dependants (wq s') th'))" by simp |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1738 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1739 |
|
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1740 |
end |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1741 |
|
58 | 1742 |
lemma tRAG_ancestorsE: |
1743 |
assumes "x \<in> ancestors (tRAG s) u" |
|
1744 |
obtains th where "x = Th th" |
|
1745 |
proof - |
|
1746 |
from assms have "(u, x) \<in> (tRAG s)^+" |
|
1747 |
by (unfold ancestors_def, auto) |
|
1748 |
from tranclE[OF this] obtain c where "(c, x) \<in> tRAG s" by auto |
|
1749 |
then obtain th where "x = Th th" |
|
1750 |
by (unfold tRAG_alt_def, auto) |
|
1751 |
from that[OF this] show ?thesis . |
|
1752 |
qed |
|
1753 |
||
1754 |
||
1755 |
context step_P_cps_ne |
|
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1756 |
begin |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1757 |
|
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1758 |
lemma RAG_s: "RAG s = RAG s' \<union> {(Th th, Cs cs)}" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1759 |
proof - |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1760 |
from step_RAG_p[OF vt_s[unfolded s_def]] and ne |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1761 |
show ?thesis by (simp add:s_def) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1762 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1763 |
|
58 | 1764 |
lemma cs_held: "(Cs cs, Th th') \<in> RAG s'" |
1765 |
proof - |
|
1766 |
have "(Cs cs, Th th') \<in> hRAG s'" |
|
1767 |
proof - |
|
1768 |
from ne |
|
1769 |
have " holding s' th' cs" |
|
1770 |
by (unfold th'_def holding_eq cs_holding_def, auto) |
|
1771 |
thus ?thesis |
|
1772 |
by (unfold hRAG_def, auto) |
|
1773 |
qed |
|
1774 |
thus ?thesis by (unfold RAG_split, auto) |
|
1775 |
qed |
|
1776 |
||
1777 |
lemma tRAG_s: |
|
1778 |
"tRAG s = tRAG s' \<union> {(Th th, Th th')}" |
|
1779 |
using RAG_tRAG_transfer[OF step_back_vt[OF vt_s[unfolded s_def]] RAG_s cs_held] . |
|
1780 |
||
1781 |
lemma cp_kept: |
|
1782 |
assumes "Th th'' \<notin> ancestors (tRAG s) (Th th)" |
|
1783 |
shows "cp s th'' = cp s' th''" |
|
1784 |
proof - |
|
1785 |
have h: "subtree (tRAG s) (Th th'') = subtree (tRAG s') (Th th'')" |
|
1786 |
proof - |
|
1787 |
have "Th th' \<notin> subtree (tRAG s') (Th th'')" |
|
1788 |
proof |
|
1789 |
assume "Th th' \<in> subtree (tRAG s') (Th th'')" |
|
1790 |
thus False |
|
1791 |
proof(rule subtreeE) |
|
1792 |
assume "Th th' = Th th''" |
|
1793 |
from assms[unfolded tRAG_s ancestors_def, folded this] |
|
1794 |
show ?thesis by auto |
|
1795 |
next |
|
1796 |
assume "Th th'' \<in> ancestors (tRAG s') (Th th')" |
|
1797 |
moreover have "... \<subseteq> ancestors (tRAG s) (Th th')" |
|
1798 |
proof(rule ancestors_mono) |
|
1799 |
show "tRAG s' \<subseteq> tRAG s" by (unfold tRAG_s, auto) |
|
1800 |
qed |
|
1801 |
ultimately have "Th th'' \<in> ancestors (tRAG s) (Th th')" by auto |
|
1802 |
moreover have "Th th' \<in> ancestors (tRAG s) (Th th)" |
|
1803 |
by (unfold tRAG_s, auto simp:ancestors_def) |
|
1804 |
ultimately have "Th th'' \<in> ancestors (tRAG s) (Th th)" |
|
1805 |
by (auto simp:ancestors_def) |
|
1806 |
with assms show ?thesis by auto |
|
1807 |
qed |
|
1808 |
qed |
|
1809 |
from subtree_insert_next[OF this] |
|
1810 |
have "subtree (tRAG s' \<union> {(Th th, Th th')}) (Th th'') = subtree (tRAG s') (Th th'')" . |
|
1811 |
from this[folded tRAG_s] show ?thesis . |
|
1812 |
qed |
|
1813 |
show ?thesis by (unfold cp_alt_def1 h preced_kept, simp) |
|
1814 |
qed |
|
1815 |
||
1816 |
lemma set_prop_split: |
|
1817 |
"A = {x. x \<in> A \<and> PP x} \<union> {x. x \<in> A \<and> \<not> PP x}" |
|
1818 |
by auto |
|
1819 |
||
1820 |
lemma f_image_union_eq: |
|
1821 |
assumes "f ` A = g ` A" |
|
1822 |
and "f ` B = g ` B" |
|
1823 |
shows "f ` (A \<union> B) = g ` (A \<union> B)" |
|
1824 |
using assms by auto |
|
1825 |
||
1826 |
(* ccc *) |
|
1827 |
||
1828 |
lemma cp_gen_update_stop: |
|
1829 |
assumes "u \<in> ancestors (tRAG s) (Th th)" |
|
1830 |
and "cp_gen s u = cp_gen s' u" |
|
1831 |
and "y \<in> ancestors (tRAG s) u" |
|
1832 |
shows "cp_gen s y = cp_gen s' y" |
|
1833 |
using assms(3) |
|
1834 |
proof(induct rule:wf_induct[OF vat_s.fsbttRAGs.wf]) |
|
1835 |
case (1 x) |
|
1836 |
show ?case (is "?L = ?R") |
|
1837 |
proof - |
|
1838 |
from tRAG_ancestorsE[OF 1(2)] |
|
1839 |
obtain th2 where eq_x: "x = Th th2" by blast |
|
1840 |
from vat_s.cp_gen_rec[OF this] |
|
1841 |
have "?L = |
|
1842 |
Max ({the_preced s th2} \<union> cp_gen s ` RTree.children (tRAG s) x)" . |
|
1843 |
also have "... = |
|
1844 |
Max ({the_preced s' th2} \<union> cp_gen s' ` RTree.children (tRAG s') x)" |
|
1845 |
proof - |
|
1846 |
from preced_kept have "the_preced s th2 = the_preced s' th2" by simp |
|
1847 |
moreover have "cp_gen s ` RTree.children (tRAG s) x = |
|
1848 |
cp_gen s' ` RTree.children (tRAG s') x" |
|
1849 |
proof - |
|
1850 |
have "RTree.children (tRAG s) x = RTree.children (tRAG s') x" |
|
1851 |
proof(unfold tRAG_s, rule children_union_kept) |
|
1852 |
have start: "(Th th, Th th') \<in> tRAG s" |
|
1853 |
by (unfold tRAG_s, auto) |
|
1854 |
note x_u = 1(2) |
|
1855 |
show "x \<notin> Range {(Th th, Th th')}" |
|
1856 |
proof |
|
1857 |
assume "x \<in> Range {(Th th, Th th')}" |
|
1858 |
hence eq_x: "x = Th th'" using RangeE by auto |
|
1859 |
show False |
|
1860 |
proof(cases rule:vat_s.rtree_s.ancestors_headE[OF assms(1) start]) |
|
1861 |
case 1 |
|
1862 |
from x_u[folded this, unfolded eq_x] vat_s.acyclic_tRAG |
|
1863 |
show ?thesis by (auto simp:ancestors_def acyclic_def) |
|
1864 |
next |
|
1865 |
case 2 |
|
1866 |
with x_u[unfolded eq_x] |
|
1867 |
have "(Th th', Th th') \<in> (tRAG s)^+" by (auto simp:ancestors_def) |
|
1868 |
with vat_s.acyclic_tRAG show ?thesis by (auto simp:acyclic_def) |
|
1869 |
qed |
|
1870 |
qed |
|
1871 |
qed |
|
1872 |
moreover have "cp_gen s ` RTree.children (tRAG s) x = |
|
1873 |
cp_gen s' ` RTree.children (tRAG s) x" (is "?f ` ?A = ?g ` ?A") |
|
1874 |
proof(rule f_image_eq) |
|
1875 |
fix a |
|
1876 |
assume a_in: "a \<in> ?A" |
|
1877 |
from 1(2) |
|
1878 |
show "?f a = ?g a" |
|
1879 |
proof(cases rule:vat_s.rtree_s.ancestors_childrenE[case_names in_ch out_ch]) |
|
1880 |
case in_ch |
|
1881 |
show ?thesis |
|
1882 |
proof(cases "a = u") |
|
1883 |
case True |
|
1884 |
from assms(2)[folded this] show ?thesis . |
|
1885 |
next |
|
1886 |
case False |
|
1887 |
have a_not_in: "a \<notin> ancestors (tRAG s) (Th th)" |
|
1888 |
proof |
|
1889 |
assume a_in': "a \<in> ancestors (tRAG s) (Th th)" |
|
1890 |
have "a = u" |
|
1891 |
proof(rule vat_s.rtree_s.ancestors_children_unique) |
|
1892 |
from a_in' a_in show "a \<in> ancestors (tRAG s) (Th th) \<inter> |
|
1893 |
RTree.children (tRAG s) x" by auto |
|
1894 |
next |
|
1895 |
from assms(1) in_ch show "u \<in> ancestors (tRAG s) (Th th) \<inter> |
|
1896 |
RTree.children (tRAG s) x" by auto |
|
1897 |
qed |
|
1898 |
with False show False by simp |
|
1899 |
qed |
|
1900 |
from a_in obtain th_a where eq_a: "a = Th th_a" |
|
1901 |
by (unfold RTree.children_def tRAG_alt_def, auto) |
|
1902 |
from cp_kept[OF a_not_in[unfolded eq_a]] |
|
1903 |
have "cp s th_a = cp s' th_a" . |
|
1904 |
from this [unfolded cp_gen_def_cond[OF eq_a], folded eq_a] |
|
1905 |
show ?thesis . |
|
1906 |
qed |
|
1907 |
next |
|
1908 |
case (out_ch z) |
|
1909 |
hence h: "z \<in> ancestors (tRAG s) u" "z \<in> RTree.children (tRAG s) x" by auto |
|
1910 |
show ?thesis |
|
1911 |
proof(cases "a = z") |
|
1912 |
case True |
|
1913 |
from h(2) have zx_in: "(z, x) \<in> (tRAG s)" by (auto simp:RTree.children_def) |
|
1914 |
from 1(1)[rule_format, OF this h(1)] |
|
1915 |
have eq_cp_gen: "cp_gen s z = cp_gen s' z" . |
|
1916 |
with True show ?thesis by metis |
|
1917 |
next |
|
1918 |
case False |
|
1919 |
from a_in obtain th_a where eq_a: "a = Th th_a" |
|
1920 |
by (auto simp:RTree.children_def tRAG_alt_def) |
|
1921 |
have "a \<notin> ancestors (tRAG s) (Th th)" sorry |
|
1922 |
from cp_kept[OF this[unfolded eq_a]] |
|
1923 |
have "cp s th_a = cp s' th_a" . |
|
1924 |
from this[unfolded cp_gen_def_cond[OF eq_a], folded eq_a] |
|
1925 |
show ?thesis . |
|
1926 |
qed |
|
1927 |
qed |
|
1928 |
qed |
|
1929 |
ultimately show ?thesis by metis |
|
1930 |
qed |
|
1931 |
ultimately show ?thesis by simp |
|
1932 |
qed |
|
1933 |
also have "... = ?R" |
|
1934 |
by (fold vat_s'.cp_gen_rec[OF eq_x], simp) |
|
1935 |
finally show ?thesis . |
|
1936 |
qed |
|
1937 |
qed |
|
1938 |
||
1939 |
||
1940 |
||
1941 |
(* ccc *) |
|
56
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
1942 |
|
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1943 |
lemma eq_child_left: |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1944 |
assumes nd: "(Th th, Th th') \<notin> (child s)^+" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1945 |
shows "(n1, Th th') \<in> (child s)^+ \<Longrightarrow> (n1, Th th') \<in> (child s')^+" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1946 |
proof(induct rule:converse_trancl_induct) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1947 |
case (base y) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1948 |
from base obtain th1 cs1 |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1949 |
where h1: "(Th th1, Cs cs1) \<in> RAG s" |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1950 |
and h2: "(Cs cs1, Th th') \<in> RAG s" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1951 |
and eq_y: "y = Th th1" by (auto simp:child_def) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1952 |
have "th1 \<noteq> th" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1953 |
proof |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1954 |
assume "th1 = th" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1955 |
with base eq_y have "(Th th, Th th') \<in> child s" by simp |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1956 |
with nd show False by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1957 |
qed |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1958 |
with h1 h2 RAG_s |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1959 |
have h1': "(Th th1, Cs cs1) \<in> RAG s'" and |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1960 |
h2': "(Cs cs1, Th th') \<in> RAG s'" by auto |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1961 |
with eq_y show ?case by (auto simp:child_def) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1962 |
next |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1963 |
case (step y z) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1964 |
have yz: "(y, z) \<in> child s" by fact |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1965 |
then obtain th1 cs1 th2 |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1966 |
where h1: "(Th th1, Cs cs1) \<in> RAG s" |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1967 |
and h2: "(Cs cs1, Th th2) \<in> RAG s" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1968 |
and eq_y: "y = Th th1" and eq_z: "z = Th th2" by (auto simp:child_def) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1969 |
have "th1 \<noteq> th" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1970 |
proof |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1971 |
assume "th1 = th" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1972 |
with yz eq_y have "(Th th, z) \<in> child s" by simp |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1973 |
moreover have "(z, Th th') \<in> (child s)^+" by fact |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1974 |
ultimately have "(Th th, Th th') \<in> (child s)^+" by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1975 |
with nd show False by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1976 |
qed |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1977 |
with h1 h2 RAG_s have h1': "(Th th1, Cs cs1) \<in> RAG s'" |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1978 |
and h2': "(Cs cs1, Th th2) \<in> RAG s'" by auto |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1979 |
with eq_y eq_z have "(y, z) \<in> child s'" by (auto simp:child_def) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1980 |
moreover have "(z, Th th') \<in> (child s')^+" by fact |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1981 |
ultimately show ?case by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1982 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1983 |
|
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1984 |
lemma eq_child_right: |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1985 |
shows "(n1, Th th') \<in> (child s')^+ \<Longrightarrow> (n1, Th th') \<in> (child s)^+" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1986 |
proof(induct rule:converse_trancl_induct) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1987 |
case (base y) |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1988 |
with RAG_s show ?case by (auto simp:child_def) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1989 |
next |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1990 |
case (step y z) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1991 |
have "(y, z) \<in> child s'" by fact |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
1992 |
with RAG_s have "(y, z) \<in> child s" by (auto simp:child_def) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1993 |
moreover have "(z, Th th') \<in> (child s)^+" by fact |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1994 |
ultimately show ?case by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1995 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1996 |
|
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1997 |
lemma eq_child: |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1998 |
assumes nd: "(Th th, Th th') \<notin> (child s)^+" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1999 |
shows "((n1, Th th') \<in> (child s)^+) = ((n1, Th th') \<in> (child s')^+)" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2000 |
by (insert eq_child_left[OF nd] eq_child_right, auto) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2001 |
|
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2002 |
lemma eq_cp: |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2003 |
fixes th' |
32
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
2004 |
assumes nd: "th \<notin> dependants s th'" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2005 |
shows "cp s th' = cp s' th'" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2006 |
apply (unfold cp_eq_cpreced cpreced_def) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2007 |
proof - |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2008 |
have nd': "(Th th, Th th') \<notin> (child s)^+" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2009 |
proof |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2010 |
assume "(Th th, Th th') \<in> (child s)\<^sup>+" |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2011 |
with child_RAG_eq[OF vt_s] |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2012 |
have "(Th th, Th th') \<in> (RAG s)\<^sup>+" by simp |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2013 |
with nd show False |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2014 |
by (simp add:s_dependants_def eq_RAG) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2015 |
qed |
32
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
2016 |
have eq_dp: "dependants (wq s) th' = dependants (wq s') th'" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2017 |
proof(auto) |
32
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
2018 |
fix x assume " x \<in> dependants (wq s) th'" |
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
2019 |
thus "x \<in> dependants (wq s') th'" |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2020 |
apply (auto simp:cs_dependants_def eq_RAG) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2021 |
proof - |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2022 |
assume "(Th x, Th th') \<in> (RAG s)\<^sup>+" |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2023 |
with child_RAG_eq[OF vt_s] have "(Th x, Th th') \<in> (child s)\<^sup>+" by simp |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2024 |
with eq_child[OF nd'] have "(Th x, Th th') \<in> (child s')^+" by simp |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2025 |
with child_RAG_eq[OF step_back_vt[OF vt_s[unfolded s_def]]] |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2026 |
show "(Th x, Th th') \<in> (RAG s')\<^sup>+" by simp |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2027 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2028 |
next |
32
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
2029 |
fix x assume "x \<in> dependants (wq s') th'" |
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
2030 |
thus "x \<in> dependants (wq s) th'" |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2031 |
apply (auto simp:cs_dependants_def eq_RAG) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2032 |
proof - |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2033 |
assume "(Th x, Th th') \<in> (RAG s')\<^sup>+" |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2034 |
with child_RAG_eq[OF step_back_vt[OF vt_s[unfolded s_def]]] |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2035 |
have "(Th x, Th th') \<in> (child s')\<^sup>+" by simp |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2036 |
with eq_child[OF nd'] have "(Th x, Th th') \<in> (child s)^+" by simp |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2037 |
with child_RAG_eq[OF vt_s] |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2038 |
show "(Th x, Th th') \<in> (RAG s)\<^sup>+" by simp |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2039 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2040 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2041 |
moreover { |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2042 |
fix th1 have "preced th1 s = preced th1 s'" by (simp add:s_def preced_def) |
32
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
2043 |
} ultimately have "((\<lambda>th. preced th s) ` ({th'} \<union> dependants (wq s) th')) = |
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
2044 |
((\<lambda>th. preced th s') ` ({th'} \<union> dependants (wq s') th'))" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2045 |
by (auto simp:image_def) |
32
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
2046 |
thus "Max ((\<lambda>th. preced th s) ` ({th'} \<union> dependants (wq s) th')) = |
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
2047 |
Max ((\<lambda>th. preced th s') ` ({th'} \<union> dependants (wq s') th'))" by simp |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2048 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2049 |
|
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2050 |
lemma eq_up: |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2051 |
fixes th' th'' |
32
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
2052 |
assumes dp1: "th \<in> dependants s th'" |
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
2053 |
and dp2: "th' \<in> dependants s th''" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2054 |
and eq_cps: "cp s th' = cp s' th'" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2055 |
shows "cp s th'' = cp s' th''" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2056 |
proof - |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2057 |
from dp2 |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2058 |
have "(Th th', Th th'') \<in> (RAG (wq s))\<^sup>+" by (simp add:s_dependants_def) |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2059 |
from RAG_child[OF vt_s this[unfolded eq_RAG]] |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2060 |
have ch_th': "(Th th', Th th'') \<in> (child s)\<^sup>+" . |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2061 |
moreover { |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2062 |
fix n th'' |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2063 |
have "\<lbrakk>(Th th', n) \<in> (child s)^+\<rbrakk> \<Longrightarrow> |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2064 |
(\<forall> th'' . n = Th th'' \<longrightarrow> cp s th'' = cp s' th'')" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2065 |
proof(erule trancl_induct, auto) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2066 |
fix y th'' |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2067 |
assume y_ch: "(y, Th th'') \<in> child s" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2068 |
and ih: "\<forall>th''. y = Th th'' \<longrightarrow> cp s th'' = cp s' th''" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2069 |
and ch': "(Th th', y) \<in> (child s)\<^sup>+" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2070 |
from y_ch obtain thy where eq_y: "y = Th thy" by (auto simp:child_def) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2071 |
with ih have eq_cpy:"cp s thy = cp s' thy" by blast |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2072 |
from dp1 have "(Th th, Th th') \<in> (RAG s)^+" by (auto simp:s_dependants_def eq_RAG) |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2073 |
moreover from child_RAG_p[OF ch'] and eq_y |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2074 |
have "(Th th', Th thy) \<in> (RAG s)^+" by simp |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2075 |
ultimately have dp_thy: "(Th th, Th thy) \<in> (RAG s)^+" by auto |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2076 |
show "cp s th'' = cp s' th''" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2077 |
apply (subst cp_rec[OF vt_s]) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2078 |
proof - |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2079 |
have "preced th'' s = preced th'' s'" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2080 |
by (simp add:s_def preced_def) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2081 |
moreover { |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2082 |
fix th1 |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2083 |
assume th1_in: "th1 \<in> children s th''" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2084 |
have "cp s th1 = cp s' th1" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2085 |
proof(cases "th1 = thy") |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2086 |
case True |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2087 |
with eq_cpy show ?thesis by simp |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2088 |
next |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2089 |
case False |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2090 |
have neq_th1: "th1 \<noteq> th" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2091 |
proof |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2092 |
assume eq_th1: "th1 = th" |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2093 |
with dp_thy have "(Th th1, Th thy) \<in> (RAG s)^+" by simp |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2094 |
from children_no_dep[OF vt_s _ _ this] and |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2095 |
th1_in y_ch eq_y show False by (auto simp:children_def) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2096 |
qed |
32
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
2097 |
have "th \<notin> dependants s th1" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2098 |
proof |
32
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
2099 |
assume h:"th \<in> dependants s th1" |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2100 |
from eq_y dp_thy have "th \<in> dependants s thy" by (auto simp:s_dependants_def eq_RAG) |
32
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
2101 |
from dependants_child_unique[OF vt_s _ _ h this] |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2102 |
th1_in y_ch eq_y have "th1 = thy" by (auto simp:children_def child_def) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2103 |
with False show False by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2104 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2105 |
from eq_cp[OF this] |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2106 |
show ?thesis . |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2107 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2108 |
} |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2109 |
ultimately have "{preced th'' s} \<union> (cp s ` children s th'') = |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2110 |
{preced th'' s'} \<union> (cp s' ` children s th'')" by (auto simp:image_def) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2111 |
moreover have "children s th'' = children s' th''" |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2112 |
apply (unfold children_def child_def s_def RAG_set_unchanged, simp) |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2113 |
apply (fold s_def, auto simp:RAG_s) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2114 |
proof - |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2115 |
assume "(Cs cs, Th th'') \<in> RAG s'" |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2116 |
with RAG_s have cs_th': "(Cs cs, Th th'') \<in> RAG s" by auto |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2117 |
from dp1 have "(Th th, Th th') \<in> (RAG s)^+" |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2118 |
by (auto simp:s_dependants_def eq_RAG) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2119 |
from converse_tranclE[OF this] |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2120 |
obtain cs1 where h1: "(Th th, Cs cs1) \<in> RAG s" |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2121 |
and h2: "(Cs cs1 , Th th') \<in> (RAG s)\<^sup>+" |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2122 |
by (auto simp:s_RAG_def) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2123 |
have eq_cs: "cs1 = cs" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2124 |
proof - |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2125 |
from RAG_s have "(Th th, Cs cs) \<in> RAG s" by simp |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2126 |
from unique_RAG[OF vt_s this h1] |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2127 |
show ?thesis by simp |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2128 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2129 |
have False |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2130 |
proof(rule converse_tranclE[OF h2]) |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2131 |
assume "(Cs cs1, Th th') \<in> RAG s" |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2132 |
with eq_cs have "(Cs cs, Th th') \<in> RAG s" by simp |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2133 |
from unique_RAG[OF vt_s this cs_th'] |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2134 |
have "th' = th''" by simp |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2135 |
with ch' y_ch have "(Th th'', Th th'') \<in> (child s)^+" by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2136 |
with wf_trancl[OF wf_child[OF vt_s]] |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2137 |
show False by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2138 |
next |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2139 |
fix y |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2140 |
assume "(Cs cs1, y) \<in> RAG s" |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2141 |
and ytd: " (y, Th th') \<in> (RAG s)\<^sup>+" |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2142 |
with eq_cs have csy: "(Cs cs, y) \<in> RAG s" by simp |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2143 |
from unique_RAG[OF vt_s this cs_th'] |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2144 |
have "y = Th th''" . |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2145 |
with ytd have "(Th th'', Th th') \<in> (RAG s)^+" by simp |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2146 |
from RAG_child[OF vt_s this] |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2147 |
have "(Th th'', Th th') \<in> (child s)\<^sup>+" . |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2148 |
moreover from ch' y_ch have ch'': "(Th th', Th th'') \<in> (child s)^+" by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2149 |
ultimately have "(Th th'', Th th'') \<in> (child s)^+" by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2150 |
with wf_trancl[OF wf_child[OF vt_s]] |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2151 |
show False by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2152 |
qed |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2153 |
thus "\<exists>cs. (Th th, Cs cs) \<in> RAG s' \<and> (Cs cs, Th th'') \<in> RAG s'" by auto |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2154 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2155 |
ultimately show "Max ({preced th'' s} \<union> cp s ` children s th'') = cp s' th''" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2156 |
by (simp add:cp_rec[OF step_back_vt[OF vt_s[unfolded s_def]]]) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2157 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2158 |
next |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2159 |
fix th'' |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2160 |
assume dp': "(Th th', Th th'') \<in> child s" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2161 |
show "cp s th'' = cp s' th''" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2162 |
apply (subst cp_rec[OF vt_s]) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2163 |
proof - |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2164 |
have "preced th'' s = preced th'' s'" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2165 |
by (simp add:s_def preced_def) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2166 |
moreover { |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2167 |
fix th1 |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2168 |
assume th1_in: "th1 \<in> children s th''" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2169 |
have "cp s th1 = cp s' th1" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2170 |
proof(cases "th1 = th'") |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2171 |
case True |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2172 |
with eq_cps show ?thesis by simp |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2173 |
next |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2174 |
case False |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2175 |
have neq_th1: "th1 \<noteq> th" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2176 |
proof |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2177 |
assume eq_th1: "th1 = th" |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2178 |
with dp1 have "(Th th1, Th th') \<in> (RAG s)^+" |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2179 |
by (auto simp:s_dependants_def eq_RAG) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2180 |
from children_no_dep[OF vt_s _ _ this] |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2181 |
th1_in dp' |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2182 |
show False by (auto simp:children_def) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2183 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2184 |
show ?thesis |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2185 |
proof(rule eq_cp) |
32
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
2186 |
show "th \<notin> dependants s th1" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2187 |
proof |
32
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
2188 |
assume "th \<in> dependants s th1" |
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
2189 |
from dependants_child_unique[OF vt_s _ _ this dp1] |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2190 |
th1_in dp' have "th1 = th'" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2191 |
by (auto simp:children_def) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2192 |
with False show False by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2193 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2194 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2195 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2196 |
} |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2197 |
ultimately have "{preced th'' s} \<union> (cp s ` children s th'') = |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2198 |
{preced th'' s'} \<union> (cp s' ` children s th'')" by (auto simp:image_def) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2199 |
moreover have "children s th'' = children s' th''" |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2200 |
apply (unfold children_def child_def s_def RAG_set_unchanged, simp) |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2201 |
apply (fold s_def, auto simp:RAG_s) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2202 |
proof - |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2203 |
assume "(Cs cs, Th th'') \<in> RAG s'" |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2204 |
with RAG_s have cs_th': "(Cs cs, Th th'') \<in> RAG s" by auto |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2205 |
from dp1 have "(Th th, Th th') \<in> (RAG s)^+" |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2206 |
by (auto simp:s_dependants_def eq_RAG) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2207 |
from converse_tranclE[OF this] |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2208 |
obtain cs1 where h1: "(Th th, Cs cs1) \<in> RAG s" |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2209 |
and h2: "(Cs cs1 , Th th') \<in> (RAG s)\<^sup>+" |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2210 |
by (auto simp:s_RAG_def) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2211 |
have eq_cs: "cs1 = cs" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2212 |
proof - |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2213 |
from RAG_s have "(Th th, Cs cs) \<in> RAG s" by simp |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2214 |
from unique_RAG[OF vt_s this h1] |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2215 |
show ?thesis by simp |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2216 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2217 |
have False |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2218 |
proof(rule converse_tranclE[OF h2]) |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2219 |
assume "(Cs cs1, Th th') \<in> RAG s" |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2220 |
with eq_cs have "(Cs cs, Th th') \<in> RAG s" by simp |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2221 |
from unique_RAG[OF vt_s this cs_th'] |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2222 |
have "th' = th''" by simp |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2223 |
with dp' have "(Th th'', Th th'') \<in> (child s)^+" by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2224 |
with wf_trancl[OF wf_child[OF vt_s]] |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2225 |
show False by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2226 |
next |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2227 |
fix y |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2228 |
assume "(Cs cs1, y) \<in> RAG s" |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2229 |
and ytd: " (y, Th th') \<in> (RAG s)\<^sup>+" |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2230 |
with eq_cs have csy: "(Cs cs, y) \<in> RAG s" by simp |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2231 |
from unique_RAG[OF vt_s this cs_th'] |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2232 |
have "y = Th th''" . |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2233 |
with ytd have "(Th th'', Th th') \<in> (RAG s)^+" by simp |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2234 |
from RAG_child[OF vt_s this] |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2235 |
have "(Th th'', Th th') \<in> (child s)\<^sup>+" . |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2236 |
moreover from dp' have ch'': "(Th th', Th th'') \<in> (child s)^+" by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2237 |
ultimately have "(Th th'', Th th'') \<in> (child s)^+" by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2238 |
with wf_trancl[OF wf_child[OF vt_s]] |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2239 |
show False by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2240 |
qed |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2241 |
thus "\<exists>cs. (Th th, Cs cs) \<in> RAG s' \<and> (Cs cs, Th th'') \<in> RAG s'" by auto |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2242 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2243 |
ultimately show "Max ({preced th'' s} \<union> cp s ` children s th'') = cp s' th''" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2244 |
by (simp add:cp_rec[OF step_back_vt[OF vt_s[unfolded s_def]]]) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2245 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2246 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2247 |
} |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2248 |
ultimately show ?thesis by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2249 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2250 |
|
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2251 |
end |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2252 |
|
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2253 |
locale step_create_cps = |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2254 |
fixes s' th prio s |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2255 |
defines s_def : "s \<equiv> (Create th prio#s')" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2256 |
assumes vt_s: "vt s" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2257 |
|
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2258 |
context step_create_cps |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2259 |
begin |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2260 |
|
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2261 |
lemma eq_dep: "RAG s = RAG s'" |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2262 |
by (unfold s_def RAG_create_unchanged, auto) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2263 |
|
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2264 |
lemma eq_cp: |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2265 |
fixes th' |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2266 |
assumes neq_th: "th' \<noteq> th" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2267 |
shows "cp s th' = cp s' th'" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2268 |
apply (unfold cp_eq_cpreced cpreced_def) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2269 |
proof - |
32
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
2270 |
have nd: "th \<notin> dependants s th'" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2271 |
proof |
32
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
2272 |
assume "th \<in> dependants s th'" |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2273 |
hence "(Th th, Th th') \<in> (RAG s)^+" by (simp add:s_dependants_def eq_RAG) |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2274 |
with eq_dep have "(Th th, Th th') \<in> (RAG s')^+" by simp |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2275 |
from converse_tranclE[OF this] |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2276 |
obtain y where "(Th th, y) \<in> RAG s'" by auto |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2277 |
with dm_RAG_threads[OF step_back_vt[OF vt_s[unfolded s_def]]] |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2278 |
have in_th: "th \<in> threads s'" by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2279 |
from step_back_step[OF vt_s[unfolded s_def]] |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2280 |
show False |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2281 |
proof(cases) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2282 |
assume "th \<notin> threads s'" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2283 |
with in_th show ?thesis by simp |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2284 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2285 |
qed |
32
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
2286 |
have eq_dp: "\<And> th. dependants (wq s) th = dependants (wq s') th" |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2287 |
by (unfold cs_dependants_def, auto simp:eq_dep eq_RAG) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2288 |
moreover { |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2289 |
fix th1 |
32
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
2290 |
assume "th1 \<in> {th'} \<union> dependants (wq s') th'" |
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
2291 |
hence "th1 = th' \<or> th1 \<in> dependants (wq s') th'" by auto |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2292 |
hence "preced th1 s = preced th1 s'" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2293 |
proof |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2294 |
assume "th1 = th'" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2295 |
with neq_th |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2296 |
show "preced th1 s = preced th1 s'" by (auto simp:s_def preced_def) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2297 |
next |
32
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
2298 |
assume "th1 \<in> dependants (wq s') th'" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2299 |
with nd and eq_dp have "th1 \<noteq> th" |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2300 |
by (auto simp:eq_RAG cs_dependants_def s_dependants_def eq_dep) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2301 |
thus "preced th1 s = preced th1 s'" by (auto simp:s_def preced_def) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2302 |
qed |
32
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
2303 |
} ultimately have "((\<lambda>th. preced th s) ` ({th'} \<union> dependants (wq s) th')) = |
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
2304 |
((\<lambda>th. preced th s') ` ({th'} \<union> dependants (wq s') th'))" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2305 |
by (auto simp:image_def) |
32
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
2306 |
thus "Max ((\<lambda>th. preced th s) ` ({th'} \<union> dependants (wq s) th')) = |
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
2307 |
Max ((\<lambda>th. preced th s') ` ({th'} \<union> dependants (wq s') th'))" by simp |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2308 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2309 |
|
32
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
2310 |
lemma nil_dependants: "dependants s th = {}" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2311 |
proof - |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2312 |
from step_back_step[OF vt_s[unfolded s_def]] |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2313 |
show ?thesis |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2314 |
proof(cases) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2315 |
assume "th \<notin> threads s'" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2316 |
from not_thread_holdents[OF step_back_vt[OF vt_s[unfolded s_def]] this] |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2317 |
have hdn: " holdents s' th = {}" . |
32
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
2318 |
have "dependants s' th = {}" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2319 |
proof - |
32
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
2320 |
{ assume "dependants s' th \<noteq> {}" |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2321 |
then obtain th' where dp: "(Th th', Th th) \<in> (RAG s')^+" |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2322 |
by (auto simp:s_dependants_def eq_RAG) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2323 |
from tranclE[OF this] obtain cs' where |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2324 |
"(Cs cs', Th th) \<in> RAG s'" by (auto simp:s_RAG_def) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2325 |
with hdn |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2326 |
have False by (auto simp:holdents_test) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2327 |
} thus ?thesis by auto |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2328 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2329 |
thus ?thesis |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2330 |
by (unfold s_def s_dependants_def eq_RAG RAG_create_unchanged, simp) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2331 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2332 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2333 |
|
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2334 |
lemma eq_cp_th: "cp s th = preced th s" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2335 |
apply (unfold cp_eq_cpreced cpreced_def) |
32
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
2336 |
by (insert nil_dependants, unfold s_dependants_def cs_dependants_def, auto) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2337 |
|
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2338 |
end |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2339 |
|
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2340 |
|
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2341 |
locale step_exit_cps = |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2342 |
fixes s' th prio s |
33
9b9f2117561f
simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
32
diff
changeset
|
2343 |
defines s_def : "s \<equiv> Exit th # s'" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2344 |
assumes vt_s: "vt s" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2345 |
|
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2346 |
context step_exit_cps |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2347 |
begin |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2348 |
|
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2349 |
lemma eq_dep: "RAG s = RAG s'" |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2350 |
by (unfold s_def RAG_exit_unchanged, auto) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2351 |
|
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2352 |
lemma eq_cp: |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2353 |
fixes th' |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2354 |
assumes neq_th: "th' \<noteq> th" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2355 |
shows "cp s th' = cp s' th'" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2356 |
apply (unfold cp_eq_cpreced cpreced_def) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2357 |
proof - |
32
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
2358 |
have nd: "th \<notin> dependants s th'" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2359 |
proof |
32
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
2360 |
assume "th \<in> dependants s th'" |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2361 |
hence "(Th th, Th th') \<in> (RAG s)^+" by (simp add:s_dependants_def eq_RAG) |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2362 |
with eq_dep have "(Th th, Th th') \<in> (RAG s')^+" by simp |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2363 |
from converse_tranclE[OF this] |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2364 |
obtain cs' where bk: "(Th th, Cs cs') \<in> RAG s'" |
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2365 |
by (auto simp:s_RAG_def) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2366 |
from step_back_step[OF vt_s[unfolded s_def]] |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2367 |
show False |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2368 |
proof(cases) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2369 |
assume "th \<in> runing s'" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2370 |
with bk show ?thesis |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2371 |
apply (unfold runing_def readys_def s_waiting_def s_RAG_def) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2372 |
by (auto simp:cs_waiting_def wq_def) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2373 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2374 |
qed |
32
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
2375 |
have eq_dp: "\<And> th. dependants (wq s) th = dependants (wq s') th" |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2376 |
by (unfold cs_dependants_def, auto simp:eq_dep eq_RAG) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2377 |
moreover { |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2378 |
fix th1 |
32
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
2379 |
assume "th1 \<in> {th'} \<union> dependants (wq s') th'" |
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
2380 |
hence "th1 = th' \<or> th1 \<in> dependants (wq s') th'" by auto |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2381 |
hence "preced th1 s = preced th1 s'" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2382 |
proof |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2383 |
assume "th1 = th'" |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2384 |
with neq_th |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2385 |
show "preced th1 s = preced th1 s'" by (auto simp:s_def preced_def) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2386 |
next |
32
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
2387 |
assume "th1 \<in> dependants (wq s') th'" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2388 |
with nd and eq_dp have "th1 \<noteq> th" |
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
2389 |
by (auto simp:eq_RAG cs_dependants_def s_dependants_def eq_dep) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2390 |
thus "preced th1 s = preced th1 s'" by (auto simp:s_def preced_def) |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2391 |
qed |
32
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
2392 |
} ultimately have "((\<lambda>th. preced th s) ` ({th'} \<union> dependants (wq s) th')) = |
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
2393 |
((\<lambda>th. preced th s') ` ({th'} \<union> dependants (wq s') th'))" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2394 |
by (auto simp:image_def) |
32
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
2395 |
thus "Max ((\<lambda>th. preced th s) ` ({th'} \<union> dependants (wq s) th')) = |
e861aff29655
made some modifications.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
0
diff
changeset
|
2396 |
Max ((\<lambda>th. preced th s') ` ({th'} \<union> dependants (wq s') th'))" by simp |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2397 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2398 |
|
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2399 |
end |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2400 |
end |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2401 |