author | zhangx |
Wed, 13 Jan 2016 23:39:59 +0800 | |
changeset 73 | b0054fb0d1ce |
parent 64 | b4bcd1edbb6d |
child 90 | ed938e2246b9 |
permissions | -rw-r--r-- |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1 |
theory PrioG |
64
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
2 |
imports PrioGDef RTree |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
3 |
begin |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
4 |
|
63 | 5 |
locale valid_trace = |
6 |
fixes s |
|
7 |
assumes vt : "vt s" |
|
8 |
||
9 |
locale valid_trace_e = valid_trace + |
|
10 |
fixes e |
|
11 |
assumes vt_e: "vt (e#s)" |
|
12 |
begin |
|
13 |
||
14 |
lemma pip_e: "PIP s e" |
|
15 |
using vt_e by (cases, simp) |
|
16 |
||
17 |
end |
|
18 |
||
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
19 |
lemma runing_ready: |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
20 |
shows "runing s \<subseteq> readys s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
21 |
unfolding runing_def readys_def |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
22 |
by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
23 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
24 |
lemma readys_threads: |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
25 |
shows "readys s \<subseteq> threads s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
26 |
unfolding readys_def |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
27 |
by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
28 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
29 |
lemma wq_v_neq: |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
30 |
"cs \<noteq> cs' \<Longrightarrow> wq (V thread cs#s) cs' = wq s cs'" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
31 |
by (auto simp:wq_def Let_def cp_def split:list.splits) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
32 |
|
63 | 33 |
context valid_trace |
34 |
begin |
|
35 |
||
36 |
lemma ind [consumes 0, case_names Nil Cons, induct type]: |
|
37 |
assumes "PP []" |
|
38 |
and "(\<And>s e. valid_trace s \<Longrightarrow> valid_trace (e#s) \<Longrightarrow> |
|
39 |
PP s \<Longrightarrow> PIP s e \<Longrightarrow> PP (e # s))" |
|
40 |
shows "PP s" |
|
41 |
proof(rule vt.induct[OF vt]) |
|
42 |
from assms(1) show "PP []" . |
|
43 |
next |
|
44 |
fix s e |
|
45 |
assume h: "vt s" "PP s" "PIP s e" |
|
46 |
show "PP (e # s)" |
|
47 |
proof(cases rule:assms(2)) |
|
48 |
from h(1) show v1: "valid_trace s" by (unfold_locales, simp) |
|
49 |
next |
|
50 |
from h(1,3) have "vt (e#s)" by auto |
|
51 |
thus "valid_trace (e # s)" by (unfold_locales, simp) |
|
52 |
qed (insert h, auto) |
|
53 |
qed |
|
54 |
||
55 |
lemma wq_distinct: "distinct (wq s cs)" |
|
56 |
proof(rule ind, simp add:wq_def) |
|
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
57 |
fix s e |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
58 |
assume h1: "step s e" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
59 |
and h2: "distinct (wq s cs)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
60 |
thus "distinct (wq (e # s) cs)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
61 |
proof(induct rule:step.induct, auto simp: wq_def Let_def split:list.splits) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
62 |
fix thread s |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
63 |
assume h1: "(Cs cs, Th thread) \<notin> (RAG s)\<^sup>+" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
64 |
and h2: "thread \<in> set (wq_fun (schs s) cs)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
65 |
and h3: "thread \<in> runing s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
66 |
show "False" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
67 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
68 |
from h3 have "\<And> cs. thread \<in> set (wq_fun (schs s) cs) \<Longrightarrow> |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
69 |
thread = hd ((wq_fun (schs s) cs))" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
70 |
by (simp add:runing_def readys_def s_waiting_def wq_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
71 |
from this [OF h2] have "thread = hd (wq_fun (schs s) cs)" . |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
72 |
with h2 |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
73 |
have "(Cs cs, Th thread) \<in> (RAG s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
74 |
by (simp add:s_RAG_def s_holding_def wq_def cs_holding_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
75 |
with h1 show False by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
76 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
77 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
78 |
fix thread s a list |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
79 |
assume dst: "distinct list" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
80 |
show "distinct (SOME q. distinct q \<and> set q = set list)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
81 |
proof(rule someI2) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
82 |
from dst show "distinct list \<and> set list = set list" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
83 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
84 |
fix q assume "distinct q \<and> set q = set list" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
85 |
thus "distinct q" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
86 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
87 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
88 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
89 |
|
63 | 90 |
end |
91 |
||
92 |
||
93 |
context valid_trace_e |
|
94 |
begin |
|
95 |
||
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
96 |
text {* |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
97 |
The following lemma shows that only the @{text "P"} |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
98 |
operation can add new thread into waiting queues. |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
99 |
Such kind of lemmas are very obvious, but need to be checked formally. |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
100 |
This is a kind of confirmation that our modelling is correct. |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
101 |
*} |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
102 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
103 |
lemma block_pre: |
63 | 104 |
assumes s_ni: "thread \<notin> set (wq s cs)" |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
105 |
and s_i: "thread \<in> set (wq (e#s) cs)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
106 |
shows "e = P thread cs" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
107 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
108 |
show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
109 |
proof(cases e) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
110 |
case (P th cs) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
111 |
with assms |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
112 |
show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
113 |
by (auto simp:wq_def Let_def split:if_splits) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
114 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
115 |
case (Create th prio) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
116 |
with assms show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
117 |
by (auto simp:wq_def Let_def split:if_splits) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
118 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
119 |
case (Exit th) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
120 |
with assms show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
121 |
by (auto simp:wq_def Let_def split:if_splits) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
122 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
123 |
case (Set th prio) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
124 |
with assms show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
125 |
by (auto simp:wq_def Let_def split:if_splits) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
126 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
127 |
case (V th cs) |
63 | 128 |
with vt_e assms show ?thesis |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
129 |
apply (auto simp:wq_def Let_def split:if_splits) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
130 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
131 |
fix q qs |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
132 |
assume h1: "thread \<notin> set (wq_fun (schs s) cs)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
133 |
and h2: "q # qs = wq_fun (schs s) cs" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
134 |
and h3: "thread \<in> set (SOME q. distinct q \<and> set q = set qs)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
135 |
and vt: "vt (V th cs # s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
136 |
from h1 and h2[symmetric] have "thread \<notin> set (q # qs)" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
137 |
moreover have "thread \<in> set qs" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
138 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
139 |
have "set (SOME q. distinct q \<and> set q = set qs) = set qs" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
140 |
proof(rule someI2) |
63 | 141 |
from wq_distinct [of cs] |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
142 |
and h2[symmetric, folded wq_def] |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
143 |
show "distinct qs \<and> set qs = set qs" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
144 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
145 |
fix x assume "distinct x \<and> set x = set qs" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
146 |
thus "set x = set qs" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
147 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
148 |
with h3 show ?thesis by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
149 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
150 |
ultimately show "False" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
151 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
152 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
153 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
154 |
|
63 | 155 |
end |
156 |
||
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
157 |
text {* |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
158 |
The following lemmas is also obvious and shallow. It says |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
159 |
that only running thread can request for a critical resource |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
160 |
and that the requested resource must be one which is |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
161 |
not current held by the thread. |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
162 |
*} |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
163 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
164 |
lemma p_pre: "\<lbrakk>vt ((P thread cs)#s)\<rbrakk> \<Longrightarrow> |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
165 |
thread \<in> runing s \<and> (Cs cs, Th thread) \<notin> (RAG s)^+" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
166 |
apply (ind_cases "vt ((P thread cs)#s)") |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
167 |
apply (ind_cases "step s (P thread cs)") |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
168 |
by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
169 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
170 |
lemma abs1: |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
171 |
assumes ein: "e \<in> set es" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
172 |
and neq: "hd es \<noteq> hd (es @ [x])" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
173 |
shows "False" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
174 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
175 |
from ein have "es \<noteq> []" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
176 |
then obtain e ess where "es = e # ess" by (cases es, auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
177 |
with neq show ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
178 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
179 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
180 |
lemma q_head: "Q (hd es) \<Longrightarrow> hd es = hd [th\<leftarrow>es . Q th]" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
181 |
by (cases es, auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
182 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
183 |
inductive_cases evt_cons: "vt (a#s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
184 |
|
63 | 185 |
context valid_trace_e |
186 |
begin |
|
187 |
||
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
188 |
lemma abs2: |
63 | 189 |
assumes inq: "thread \<in> set (wq s cs)" |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
190 |
and nh: "thread = hd (wq s cs)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
191 |
and qt: "thread \<noteq> hd (wq (e#s) cs)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
192 |
and inq': "thread \<in> set (wq (e#s) cs)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
193 |
shows "False" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
194 |
proof - |
63 | 195 |
from vt_e assms show "False" |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
196 |
apply (cases e) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
197 |
apply ((simp split:if_splits add:Let_def wq_def)[1])+ |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
198 |
apply (insert abs1, fast)[1] |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
199 |
apply (auto simp:wq_def simp:Let_def split:if_splits list.splits) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
200 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
201 |
fix th qs |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
202 |
assume vt: "vt (V th cs # s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
203 |
and th_in: "thread \<in> set (SOME q. distinct q \<and> set q = set qs)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
204 |
and eq_wq: "wq_fun (schs s) cs = thread # qs" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
205 |
show "False" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
206 |
proof - |
63 | 207 |
from wq_distinct[of cs] |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
208 |
and eq_wq[folded wq_def] have "distinct (thread#qs)" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
209 |
moreover have "thread \<in> set qs" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
210 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
211 |
have "set (SOME q. distinct q \<and> set q = set qs) = set qs" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
212 |
proof(rule someI2) |
63 | 213 |
from wq_distinct [of cs] |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
214 |
and eq_wq [folded wq_def] |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
215 |
show "distinct qs \<and> set qs = set qs" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
216 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
217 |
fix x assume "distinct x \<and> set x = set qs" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
218 |
thus "set x = set qs" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
219 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
220 |
with th_in show ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
221 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
222 |
ultimately show ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
223 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
224 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
225 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
226 |
|
63 | 227 |
end |
228 |
||
229 |
context valid_trace |
|
230 |
begin |
|
231 |
||
232 |
lemma vt_moment: "\<And> t. vt (moment t s)" |
|
233 |
proof(induct rule:ind) |
|
234 |
case Nil |
|
235 |
thus ?case by (simp add:vt_nil) |
|
236 |
next |
|
237 |
case (Cons s e t) |
|
238 |
show ?case |
|
239 |
proof(cases "t \<ge> length (e#s)") |
|
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
240 |
case True |
63 | 241 |
from True have "moment t (e#s) = e#s" by simp |
242 |
thus ?thesis using Cons |
|
243 |
by (simp add:valid_trace_def) |
|
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
244 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
245 |
case False |
63 | 246 |
from Cons have "vt (moment t s)" by simp |
247 |
moreover have "moment t (e#s) = moment t s" |
|
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
248 |
proof - |
63 | 249 |
from False have "t \<le> length s" by simp |
250 |
from moment_app [OF this, of "[e]"] |
|
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
251 |
show ?thesis by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
252 |
qed |
63 | 253 |
ultimately show ?thesis by simp |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
254 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
255 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
256 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
257 |
(* Wrong: |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
258 |
lemma \<lbrakk>thread \<in> set (wq_fun cs1 s); thread \<in> set (wq_fun cs2 s)\<rbrakk> \<Longrightarrow> cs1 = cs2" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
259 |
*) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
260 |
|
58 | 261 |
text {* (* ddd *) |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
262 |
The nature of the work is like this: since it starts from a very simple and basic |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
263 |
model, even intuitively very `basic` and `obvious` properties need to derived from scratch. |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
264 |
For instance, the fact |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
265 |
that one thread can not be blocked by two critical resources at the same time |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
266 |
is obvious, because only running threads can make new requests, if one is waiting for |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
267 |
a critical resource and get blocked, it can not make another resource request and get |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
268 |
blocked the second time (because it is not running). |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
269 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
270 |
To derive this fact, one needs to prove by contraction and |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
271 |
reason about time (or @{text "moement"}). The reasoning is based on a generic theorem |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
272 |
named @{text "p_split"}, which is about status changing along the time axis. It says if |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
273 |
a condition @{text "Q"} is @{text "True"} at a state @{text "s"}, |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
274 |
but it was @{text "False"} at the very beginning, then there must exits a moment @{text "t"} |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
275 |
in the history of @{text "s"} (notice that @{text "s"} itself is essentially the history |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
276 |
of events leading to it), such that @{text "Q"} switched |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
277 |
from being @{text "False"} to @{text "True"} and kept being @{text "True"} |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
278 |
till the last moment of @{text "s"}. |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
279 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
280 |
Suppose a thread @{text "th"} is blocked |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
281 |
on @{text "cs1"} and @{text "cs2"} in some state @{text "s"}, |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
282 |
since no thread is blocked at the very beginning, by applying |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
283 |
@{text "p_split"} to these two blocking facts, there exist |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
284 |
two moments @{text "t1"} and @{text "t2"} in @{text "s"}, such that |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
285 |
@{text "th"} got blocked on @{text "cs1"} and @{text "cs2"} |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
286 |
and kept on blocked on them respectively ever since. |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
287 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
288 |
Without lose of generality, we assume @{text "t1"} is earlier than @{text "t2"}. |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
289 |
However, since @{text "th"} was blocked ever since memonent @{text "t1"}, so it was still |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
290 |
in blocked state at moment @{text "t2"} and could not |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
291 |
make any request and get blocked the second time: Contradiction. |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
292 |
*} |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
293 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
294 |
lemma waiting_unique_pre: |
63 | 295 |
assumes h11: "thread \<in> set (wq s cs1)" |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
296 |
and h12: "thread \<noteq> hd (wq s cs1)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
297 |
assumes h21: "thread \<in> set (wq s cs2)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
298 |
and h22: "thread \<noteq> hd (wq s cs2)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
299 |
and neq12: "cs1 \<noteq> cs2" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
300 |
shows "False" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
301 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
302 |
let "?Q cs s" = "thread \<in> set (wq s cs) \<and> thread \<noteq> hd (wq s cs)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
303 |
from h11 and h12 have q1: "?Q cs1 s" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
304 |
from h21 and h22 have q2: "?Q cs2 s" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
305 |
have nq1: "\<not> ?Q cs1 []" by (simp add:wq_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
306 |
have nq2: "\<not> ?Q cs2 []" by (simp add:wq_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
307 |
from p_split [of "?Q cs1", OF q1 nq1] |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
308 |
obtain t1 where lt1: "t1 < length s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
309 |
and np1: "\<not>(thread \<in> set (wq (moment t1 s) cs1) \<and> |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
310 |
thread \<noteq> hd (wq (moment t1 s) cs1))" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
311 |
and nn1: "(\<forall>i'>t1. thread \<in> set (wq (moment i' s) cs1) \<and> |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
312 |
thread \<noteq> hd (wq (moment i' s) cs1))" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
313 |
from p_split [of "?Q cs2", OF q2 nq2] |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
314 |
obtain t2 where lt2: "t2 < length s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
315 |
and np2: "\<not>(thread \<in> set (wq (moment t2 s) cs2) \<and> |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
316 |
thread \<noteq> hd (wq (moment t2 s) cs2))" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
317 |
and nn2: "(\<forall>i'>t2. thread \<in> set (wq (moment i' s) cs2) \<and> |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
318 |
thread \<noteq> hd (wq (moment i' s) cs2))" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
319 |
show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
320 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
321 |
{ |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
322 |
assume lt12: "t1 < t2" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
323 |
let ?t3 = "Suc t2" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
324 |
from lt2 have le_t3: "?t3 \<le> length s" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
325 |
from moment_plus [OF this] |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
326 |
obtain e where eq_m: "moment ?t3 s = e#moment t2 s" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
327 |
have "t2 < ?t3" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
328 |
from nn2 [rule_format, OF this] and eq_m |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
329 |
have h1: "thread \<in> set (wq (e#moment t2 s) cs2)" and |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
330 |
h2: "thread \<noteq> hd (wq (e#moment t2 s) cs2)" by auto |
63 | 331 |
have "vt (e#moment t2 s)" |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
332 |
proof - |
63 | 333 |
from vt_moment |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
334 |
have "vt (moment ?t3 s)" . |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
335 |
with eq_m show ?thesis by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
336 |
qed |
63 | 337 |
then interpret vt_e: valid_trace_e "moment t2 s" "e" |
338 |
by (unfold_locales, auto, cases, simp) |
|
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
339 |
have ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
340 |
proof(cases "thread \<in> set (wq (moment t2 s) cs2)") |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
341 |
case True |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
342 |
from True and np2 have eq_th: "thread = hd (wq (moment t2 s) cs2)" |
63 | 343 |
by auto |
344 |
from vt_e.abs2 [OF True eq_th h2 h1] |
|
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
345 |
show ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
346 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
347 |
case False |
63 | 348 |
from vt_e.block_pre[OF False h1] |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
349 |
have "e = P thread cs2" . |
63 | 350 |
with vt_e.vt_e have "vt ((P thread cs2)# moment t2 s)" by simp |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
351 |
from p_pre [OF this] have "thread \<in> runing (moment t2 s)" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
352 |
with runing_ready have "thread \<in> readys (moment t2 s)" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
353 |
with nn1 [rule_format, OF lt12] |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
354 |
show ?thesis by (simp add:readys_def wq_def s_waiting_def, auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
355 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
356 |
} moreover { |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
357 |
assume lt12: "t2 < t1" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
358 |
let ?t3 = "Suc t1" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
359 |
from lt1 have le_t3: "?t3 \<le> length s" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
360 |
from moment_plus [OF this] |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
361 |
obtain e where eq_m: "moment ?t3 s = e#moment t1 s" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
362 |
have lt_t3: "t1 < ?t3" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
363 |
from nn1 [rule_format, OF this] and eq_m |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
364 |
have h1: "thread \<in> set (wq (e#moment t1 s) cs1)" and |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
365 |
h2: "thread \<noteq> hd (wq (e#moment t1 s) cs1)" by auto |
63 | 366 |
have "vt (e#moment t1 s)" |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
367 |
proof - |
63 | 368 |
from vt_moment |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
369 |
have "vt (moment ?t3 s)" . |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
370 |
with eq_m show ?thesis by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
371 |
qed |
63 | 372 |
then interpret vt_e: valid_trace_e "moment t1 s" e |
373 |
by (unfold_locales, auto, cases, auto) |
|
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
374 |
have ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
375 |
proof(cases "thread \<in> set (wq (moment t1 s) cs1)") |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
376 |
case True |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
377 |
from True and np1 have eq_th: "thread = hd (wq (moment t1 s) cs1)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
378 |
by auto |
63 | 379 |
from vt_e.abs2 True eq_th h2 h1 |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
380 |
show ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
381 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
382 |
case False |
63 | 383 |
from vt_e.block_pre [OF False h1] |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
384 |
have "e = P thread cs1" . |
63 | 385 |
with vt_e.vt_e have "vt ((P thread cs1)# moment t1 s)" by simp |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
386 |
from p_pre [OF this] have "thread \<in> runing (moment t1 s)" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
387 |
with runing_ready have "thread \<in> readys (moment t1 s)" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
388 |
with nn2 [rule_format, OF lt12] |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
389 |
show ?thesis by (simp add:readys_def wq_def s_waiting_def, auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
390 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
391 |
} moreover { |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
392 |
assume eqt12: "t1 = t2" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
393 |
let ?t3 = "Suc t1" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
394 |
from lt1 have le_t3: "?t3 \<le> length s" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
395 |
from moment_plus [OF this] |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
396 |
obtain e where eq_m: "moment ?t3 s = e#moment t1 s" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
397 |
have lt_t3: "t1 < ?t3" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
398 |
from nn1 [rule_format, OF this] and eq_m |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
399 |
have h1: "thread \<in> set (wq (e#moment t1 s) cs1)" and |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
400 |
h2: "thread \<noteq> hd (wq (e#moment t1 s) cs1)" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
401 |
have vt_e: "vt (e#moment t1 s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
402 |
proof - |
63 | 403 |
from vt_moment |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
404 |
have "vt (moment ?t3 s)" . |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
405 |
with eq_m show ?thesis by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
406 |
qed |
63 | 407 |
then interpret vt_e: valid_trace_e "moment t1 s" e |
408 |
by (unfold_locales, auto, cases, auto) |
|
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
409 |
have ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
410 |
proof(cases "thread \<in> set (wq (moment t1 s) cs1)") |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
411 |
case True |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
412 |
from True and np1 have eq_th: "thread = hd (wq (moment t1 s) cs1)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
413 |
by auto |
63 | 414 |
from vt_e.abs2 [OF True eq_th h2 h1] |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
415 |
show ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
416 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
417 |
case False |
63 | 418 |
from vt_e.block_pre [OF False h1] |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
419 |
have eq_e1: "e = P thread cs1" . |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
420 |
have lt_t3: "t1 < ?t3" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
421 |
with eqt12 have "t2 < ?t3" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
422 |
from nn2 [rule_format, OF this] and eq_m and eqt12 |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
423 |
have h1: "thread \<in> set (wq (e#moment t2 s) cs2)" and |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
424 |
h2: "thread \<noteq> hd (wq (e#moment t2 s) cs2)" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
425 |
show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
426 |
proof(cases "thread \<in> set (wq (moment t2 s) cs2)") |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
427 |
case True |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
428 |
from True and np2 have eq_th: "thread = hd (wq (moment t2 s) cs2)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
429 |
by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
430 |
from vt_e and eqt12 have "vt (e#moment t2 s)" by simp |
63 | 431 |
then interpret vt_e2: valid_trace_e "moment t2 s" e |
432 |
by (unfold_locales, auto, cases, auto) |
|
433 |
from vt_e2.abs2 [OF True eq_th h2 h1] |
|
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
434 |
show ?thesis . |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
435 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
436 |
case False |
63 | 437 |
have "vt (e#moment t2 s)" |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
438 |
proof - |
63 | 439 |
from vt_moment eqt12 |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
440 |
have "vt (moment (Suc t2) s)" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
441 |
with eq_m eqt12 show ?thesis by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
442 |
qed |
63 | 443 |
then interpret vt_e2: valid_trace_e "moment t2 s" e |
444 |
by (unfold_locales, auto, cases, auto) |
|
445 |
from vt_e2.block_pre [OF False h1] |
|
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
446 |
have "e = P thread cs2" . |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
447 |
with eq_e1 neq12 show ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
448 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
449 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
450 |
} ultimately show ?thesis by arith |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
451 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
452 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
453 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
454 |
text {* |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
455 |
This lemma is a simple corrolary of @{text "waiting_unique_pre"}. |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
456 |
*} |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
457 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
458 |
lemma waiting_unique: |
63 | 459 |
assumes "waiting s th cs1" |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
460 |
and "waiting s th cs2" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
461 |
shows "cs1 = cs2" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
462 |
using waiting_unique_pre assms |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
463 |
unfolding wq_def s_waiting_def |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
464 |
by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
465 |
|
63 | 466 |
end |
467 |
||
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
468 |
(* not used *) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
469 |
text {* |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
470 |
Every thread can only be blocked on one critical resource, |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
471 |
symmetrically, every critical resource can only be held by one thread. |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
472 |
This fact is much more easier according to our definition. |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
473 |
*} |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
474 |
lemma held_unique: |
63 | 475 |
assumes "holding (s::event list) th1 cs" |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
476 |
and "holding s th2 cs" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
477 |
shows "th1 = th2" |
63 | 478 |
by (insert assms, unfold s_holding_def, auto) |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
479 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
480 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
481 |
lemma last_set_lt: "th \<in> threads s \<Longrightarrow> last_set th s < length s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
482 |
apply (induct s, auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
483 |
by (case_tac a, auto split:if_splits) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
484 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
485 |
lemma last_set_unique: |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
486 |
"\<lbrakk>last_set th1 s = last_set th2 s; th1 \<in> threads s; th2 \<in> threads s\<rbrakk> |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
487 |
\<Longrightarrow> th1 = th2" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
488 |
apply (induct s, auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
489 |
by (case_tac a, auto split:if_splits dest:last_set_lt) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
490 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
491 |
lemma preced_unique : |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
492 |
assumes pcd_eq: "preced th1 s = preced th2 s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
493 |
and th_in1: "th1 \<in> threads s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
494 |
and th_in2: " th2 \<in> threads s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
495 |
shows "th1 = th2" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
496 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
497 |
from pcd_eq have "last_set th1 s = last_set th2 s" by (simp add:preced_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
498 |
from last_set_unique [OF this th_in1 th_in2] |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
499 |
show ?thesis . |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
500 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
501 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
502 |
lemma preced_linorder: |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
503 |
assumes neq_12: "th1 \<noteq> th2" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
504 |
and th_in1: "th1 \<in> threads s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
505 |
and th_in2: " th2 \<in> threads s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
506 |
shows "preced th1 s < preced th2 s \<or> preced th1 s > preced th2 s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
507 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
508 |
from preced_unique [OF _ th_in1 th_in2] and neq_12 |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
509 |
have "preced th1 s \<noteq> preced th2 s" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
510 |
thus ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
511 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
512 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
513 |
(* An aux lemma used later *) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
514 |
lemma unique_minus: |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
515 |
fixes x y z r |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
516 |
assumes unique: "\<And> a b c. \<lbrakk>(a, b) \<in> r; (a, c) \<in> r\<rbrakk> \<Longrightarrow> b = c" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
517 |
and xy: "(x, y) \<in> r" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
518 |
and xz: "(x, z) \<in> r^+" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
519 |
and neq: "y \<noteq> z" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
520 |
shows "(y, z) \<in> r^+" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
521 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
522 |
from xz and neq show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
523 |
proof(induct) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
524 |
case (base ya) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
525 |
have "(x, ya) \<in> r" by fact |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
526 |
from unique [OF xy this] have "y = ya" . |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
527 |
with base show ?case by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
528 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
529 |
case (step ya z) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
530 |
show ?case |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
531 |
proof(cases "y = ya") |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
532 |
case True |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
533 |
from step True show ?thesis by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
534 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
535 |
case False |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
536 |
from step False |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
537 |
show ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
538 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
539 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
540 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
541 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
542 |
lemma unique_base: |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
543 |
fixes r x y z |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
544 |
assumes unique: "\<And> a b c. \<lbrakk>(a, b) \<in> r; (a, c) \<in> r\<rbrakk> \<Longrightarrow> b = c" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
545 |
and xy: "(x, y) \<in> r" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
546 |
and xz: "(x, z) \<in> r^+" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
547 |
and neq_yz: "y \<noteq> z" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
548 |
shows "(y, z) \<in> r^+" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
549 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
550 |
from xz neq_yz show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
551 |
proof(induct) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
552 |
case (base ya) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
553 |
from xy unique base show ?case by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
554 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
555 |
case (step ya z) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
556 |
show ?case |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
557 |
proof(cases "y = ya") |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
558 |
case True |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
559 |
from True step show ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
560 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
561 |
case False |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
562 |
from False step |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
563 |
have "(y, ya) \<in> r\<^sup>+" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
564 |
with step show ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
565 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
566 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
567 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
568 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
569 |
lemma unique_chain: |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
570 |
fixes r x y z |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
571 |
assumes unique: "\<And> a b c. \<lbrakk>(a, b) \<in> r; (a, c) \<in> r\<rbrakk> \<Longrightarrow> b = c" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
572 |
and xy: "(x, y) \<in> r^+" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
573 |
and xz: "(x, z) \<in> r^+" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
574 |
and neq_yz: "y \<noteq> z" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
575 |
shows "(y, z) \<in> r^+ \<or> (z, y) \<in> r^+" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
576 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
577 |
from xy xz neq_yz show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
578 |
proof(induct) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
579 |
case (base y) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
580 |
have h1: "(x, y) \<in> r" and h2: "(x, z) \<in> r\<^sup>+" and h3: "y \<noteq> z" using base by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
581 |
from unique_base [OF _ h1 h2 h3] and unique show ?case by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
582 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
583 |
case (step y za) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
584 |
show ?case |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
585 |
proof(cases "y = z") |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
586 |
case True |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
587 |
from True step show ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
588 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
589 |
case False |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
590 |
from False step have "(y, z) \<in> r\<^sup>+ \<or> (z, y) \<in> r\<^sup>+" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
591 |
thus ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
592 |
proof |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
593 |
assume "(z, y) \<in> r\<^sup>+" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
594 |
with step have "(z, za) \<in> r\<^sup>+" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
595 |
thus ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
596 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
597 |
assume h: "(y, z) \<in> r\<^sup>+" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
598 |
from step have yza: "(y, za) \<in> r" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
599 |
from step have "za \<noteq> z" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
600 |
from unique_minus [OF _ yza h this] and unique |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
601 |
have "(za, z) \<in> r\<^sup>+" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
602 |
thus ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
603 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
604 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
605 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
606 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
607 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
608 |
text {* |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
609 |
The following three lemmas show that @{text "RAG"} does not change |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
610 |
by the happening of @{text "Set"}, @{text "Create"} and @{text "Exit"} |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
611 |
events, respectively. |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
612 |
*} |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
613 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
614 |
lemma RAG_set_unchanged: "(RAG (Set th prio # s)) = RAG s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
615 |
apply (unfold s_RAG_def s_waiting_def wq_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
616 |
by (simp add:Let_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
617 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
618 |
lemma RAG_create_unchanged: "(RAG (Create th prio # s)) = RAG s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
619 |
apply (unfold s_RAG_def s_waiting_def wq_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
620 |
by (simp add:Let_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
621 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
622 |
lemma RAG_exit_unchanged: "(RAG (Exit th # s)) = RAG s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
623 |
apply (unfold s_RAG_def s_waiting_def wq_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
624 |
by (simp add:Let_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
625 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
626 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
627 |
text {* |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
628 |
The following lemmas are used in the proof of |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
629 |
lemma @{text "step_RAG_v"}, which characterizes how the @{text "RAG"} is changed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
630 |
by @{text "V"}-events. |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
631 |
However, since our model is very concise, such seemingly obvious lemmas need to be derived from scratch, |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
632 |
starting from the model definitions. |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
633 |
*} |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
634 |
lemma step_v_hold_inv[elim_format]: |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
635 |
"\<And>c t. \<lbrakk>vt (V th cs # s); |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
636 |
\<not> holding (wq s) t c; holding (wq (V th cs # s)) t c\<rbrakk> \<Longrightarrow> |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
637 |
next_th s th cs t \<and> c = cs" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
638 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
639 |
fix c t |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
640 |
assume vt: "vt (V th cs # s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
641 |
and nhd: "\<not> holding (wq s) t c" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
642 |
and hd: "holding (wq (V th cs # s)) t c" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
643 |
show "next_th s th cs t \<and> c = cs" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
644 |
proof(cases "c = cs") |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
645 |
case False |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
646 |
with nhd hd show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
647 |
by (unfold cs_holding_def wq_def, auto simp:Let_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
648 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
649 |
case True |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
650 |
with step_back_step [OF vt] |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
651 |
have "step s (V th c)" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
652 |
hence "next_th s th cs t" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
653 |
proof(cases) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
654 |
assume "holding s th c" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
655 |
with nhd hd show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
656 |
apply (unfold s_holding_def cs_holding_def wq_def next_th_def, |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
657 |
auto simp:Let_def split:list.splits if_splits) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
658 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
659 |
assume " hd (SOME q. distinct q \<and> q = []) \<in> set (SOME q. distinct q \<and> q = [])" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
660 |
moreover have "\<dots> = set []" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
661 |
proof(rule someI2) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
662 |
show "distinct [] \<and> [] = []" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
663 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
664 |
fix x assume "distinct x \<and> x = []" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
665 |
thus "set x = set []" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
666 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
667 |
ultimately show False by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
668 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
669 |
assume " hd (SOME q. distinct q \<and> q = []) \<in> set (SOME q. distinct q \<and> q = [])" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
670 |
moreover have "\<dots> = set []" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
671 |
proof(rule someI2) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
672 |
show "distinct [] \<and> [] = []" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
673 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
674 |
fix x assume "distinct x \<and> x = []" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
675 |
thus "set x = set []" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
676 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
677 |
ultimately show False by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
678 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
679 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
680 |
with True show ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
681 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
682 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
683 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
684 |
text {* |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
685 |
The following @{text "step_v_wait_inv"} is also an obvious lemma, which, however, needs to be |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
686 |
derived from scratch, which confirms the correctness of the definition of @{text "next_th"}. |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
687 |
*} |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
688 |
lemma step_v_wait_inv[elim_format]: |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
689 |
"\<And>t c. \<lbrakk>vt (V th cs # s); \<not> waiting (wq (V th cs # s)) t c; waiting (wq s) t c |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
690 |
\<rbrakk> |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
691 |
\<Longrightarrow> (next_th s th cs t \<and> cs = c)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
692 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
693 |
fix t c |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
694 |
assume vt: "vt (V th cs # s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
695 |
and nw: "\<not> waiting (wq (V th cs # s)) t c" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
696 |
and wt: "waiting (wq s) t c" |
63 | 697 |
from vt interpret vt_v: valid_trace_e s "V th cs" |
698 |
by (cases, unfold_locales, simp) |
|
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
699 |
show "next_th s th cs t \<and> cs = c" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
700 |
proof(cases "cs = c") |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
701 |
case False |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
702 |
with nw wt show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
703 |
by (auto simp:cs_waiting_def wq_def Let_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
704 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
705 |
case True |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
706 |
from nw[folded True] wt[folded True] |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
707 |
have "next_th s th cs t" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
708 |
apply (unfold next_th_def, auto simp:cs_waiting_def wq_def Let_def split:list.splits) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
709 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
710 |
fix a list |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
711 |
assume t_in: "t \<in> set list" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
712 |
and t_ni: "t \<notin> set (SOME q. distinct q \<and> set q = set list)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
713 |
and eq_wq: "wq_fun (schs s) cs = a # list" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
714 |
have " set (SOME q. distinct q \<and> set q = set list) = set list" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
715 |
proof(rule someI2) |
63 | 716 |
from vt_v.wq_distinct[of cs] and eq_wq[folded wq_def] |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
717 |
show "distinct list \<and> set list = set list" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
718 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
719 |
show "\<And>x. distinct x \<and> set x = set list \<Longrightarrow> set x = set list" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
720 |
by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
721 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
722 |
with t_ni and t_in show "a = th" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
723 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
724 |
fix a list |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
725 |
assume t_in: "t \<in> set list" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
726 |
and t_ni: "t \<notin> set (SOME q. distinct q \<and> set q = set list)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
727 |
and eq_wq: "wq_fun (schs s) cs = a # list" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
728 |
have " set (SOME q. distinct q \<and> set q = set list) = set list" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
729 |
proof(rule someI2) |
63 | 730 |
from vt_v.wq_distinct[of cs] and eq_wq[folded wq_def] |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
731 |
show "distinct list \<and> set list = set list" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
732 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
733 |
show "\<And>x. distinct x \<and> set x = set list \<Longrightarrow> set x = set list" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
734 |
by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
735 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
736 |
with t_ni and t_in show "t = hd (SOME q. distinct q \<and> set q = set list)" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
737 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
738 |
fix a list |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
739 |
assume eq_wq: "wq_fun (schs s) cs = a # list" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
740 |
from step_back_step[OF vt] |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
741 |
show "a = th" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
742 |
proof(cases) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
743 |
assume "holding s th cs" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
744 |
with eq_wq show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
745 |
by (unfold s_holding_def wq_def, auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
746 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
747 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
748 |
with True show ?thesis by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
749 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
750 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
751 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
752 |
lemma step_v_not_wait[consumes 3]: |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
753 |
"\<lbrakk>vt (V th cs # s); next_th s th cs t; waiting (wq (V th cs # s)) t cs\<rbrakk> \<Longrightarrow> False" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
754 |
by (unfold next_th_def cs_waiting_def wq_def, auto simp:Let_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
755 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
756 |
lemma step_v_release: |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
757 |
"\<lbrakk>vt (V th cs # s); holding (wq (V th cs # s)) th cs\<rbrakk> \<Longrightarrow> False" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
758 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
759 |
assume vt: "vt (V th cs # s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
760 |
and hd: "holding (wq (V th cs # s)) th cs" |
63 | 761 |
from vt interpret vt_v: valid_trace_e s "V th cs" |
762 |
by (cases, unfold_locales, simp+) |
|
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
763 |
from step_back_step [OF vt] and hd |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
764 |
show "False" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
765 |
proof(cases) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
766 |
assume "holding (wq (V th cs # s)) th cs" and "holding s th cs" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
767 |
thus ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
768 |
apply (unfold s_holding_def wq_def cs_holding_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
769 |
apply (auto simp:Let_def split:list.splits) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
770 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
771 |
fix list |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
772 |
assume eq_wq[folded wq_def]: |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
773 |
"wq_fun (schs s) cs = hd (SOME q. distinct q \<and> set q = set list) # list" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
774 |
and hd_in: "hd (SOME q. distinct q \<and> set q = set list) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
775 |
\<in> set (SOME q. distinct q \<and> set q = set list)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
776 |
have "set (SOME q. distinct q \<and> set q = set list) = set list" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
777 |
proof(rule someI2) |
63 | 778 |
from vt_v.wq_distinct[of cs] and eq_wq |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
779 |
show "distinct list \<and> set list = set list" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
780 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
781 |
show "\<And>x. distinct x \<and> set x = set list \<Longrightarrow> set x = set list" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
782 |
by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
783 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
784 |
moreover have "distinct (hd (SOME q. distinct q \<and> set q = set list) # list)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
785 |
proof - |
63 | 786 |
from vt_v.wq_distinct[of cs] and eq_wq |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
787 |
show ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
788 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
789 |
moreover note eq_wq and hd_in |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
790 |
ultimately show "False" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
791 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
792 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
793 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
794 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
795 |
lemma step_v_get_hold: |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
796 |
"\<And>th'. \<lbrakk>vt (V th cs # s); \<not> holding (wq (V th cs # s)) th' cs; next_th s th cs th'\<rbrakk> \<Longrightarrow> False" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
797 |
apply (unfold cs_holding_def next_th_def wq_def, |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
798 |
auto simp:Let_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
799 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
800 |
fix rest |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
801 |
assume vt: "vt (V th cs # s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
802 |
and eq_wq[folded wq_def]: " wq_fun (schs s) cs = th # rest" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
803 |
and nrest: "rest \<noteq> []" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
804 |
and ni: "hd (SOME q. distinct q \<and> set q = set rest) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
805 |
\<notin> set (SOME q. distinct q \<and> set q = set rest)" |
63 | 806 |
from vt interpret vt_v: valid_trace_e s "V th cs" |
807 |
by (cases, unfold_locales, simp+) |
|
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
808 |
have "(SOME q. distinct q \<and> set q = set rest) \<noteq> []" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
809 |
proof(rule someI2) |
63 | 810 |
from vt_v.wq_distinct[of cs] and eq_wq |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
811 |
show "distinct rest \<and> set rest = set rest" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
812 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
813 |
fix x assume "distinct x \<and> set x = set rest" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
814 |
hence "set x = set rest" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
815 |
with nrest |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
816 |
show "x \<noteq> []" by (case_tac x, auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
817 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
818 |
with ni show "False" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
819 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
820 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
821 |
lemma step_v_release_inv[elim_format]: |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
822 |
"\<And>c t. \<lbrakk>vt (V th cs # s); \<not> holding (wq (V th cs # s)) t c; holding (wq s) t c\<rbrakk> \<Longrightarrow> |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
823 |
c = cs \<and> t = th" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
824 |
apply (unfold cs_holding_def wq_def, auto simp:Let_def split:if_splits list.splits) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
825 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
826 |
fix a list |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
827 |
assume vt: "vt (V th cs # s)" and eq_wq: "wq_fun (schs s) cs = a # list" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
828 |
from step_back_step [OF vt] show "a = th" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
829 |
proof(cases) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
830 |
assume "holding s th cs" with eq_wq |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
831 |
show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
832 |
by (unfold s_holding_def wq_def, auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
833 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
834 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
835 |
fix a list |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
836 |
assume vt: "vt (V th cs # s)" and eq_wq: "wq_fun (schs s) cs = a # list" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
837 |
from step_back_step [OF vt] show "a = th" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
838 |
proof(cases) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
839 |
assume "holding s th cs" with eq_wq |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
840 |
show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
841 |
by (unfold s_holding_def wq_def, auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
842 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
843 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
844 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
845 |
lemma step_v_waiting_mono: |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
846 |
"\<And>t c. \<lbrakk>vt (V th cs # s); waiting (wq (V th cs # s)) t c\<rbrakk> \<Longrightarrow> waiting (wq s) t c" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
847 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
848 |
fix t c |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
849 |
let ?s' = "(V th cs # s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
850 |
assume vt: "vt ?s'" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
851 |
and wt: "waiting (wq ?s') t c" |
63 | 852 |
from vt interpret vt_v: valid_trace_e s "V th cs" |
853 |
by (cases, unfold_locales, simp+) |
|
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
854 |
show "waiting (wq s) t c" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
855 |
proof(cases "c = cs") |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
856 |
case False |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
857 |
assume neq_cs: "c \<noteq> cs" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
858 |
hence "waiting (wq ?s') t c = waiting (wq s) t c" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
859 |
by (unfold cs_waiting_def wq_def, auto simp:Let_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
860 |
with wt show ?thesis by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
861 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
862 |
case True |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
863 |
with wt show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
864 |
apply (unfold cs_waiting_def wq_def, auto simp:Let_def split:list.splits) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
865 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
866 |
fix a list |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
867 |
assume not_in: "t \<notin> set list" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
868 |
and is_in: "t \<in> set (SOME q. distinct q \<and> set q = set list)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
869 |
and eq_wq: "wq_fun (schs s) cs = a # list" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
870 |
have "set (SOME q. distinct q \<and> set q = set list) = set list" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
871 |
proof(rule someI2) |
63 | 872 |
from vt_v.wq_distinct [of cs] |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
873 |
and eq_wq[folded wq_def] |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
874 |
show "distinct list \<and> set list = set list" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
875 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
876 |
fix x assume "distinct x \<and> set x = set list" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
877 |
thus "set x = set list" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
878 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
879 |
with not_in is_in show "t = a" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
880 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
881 |
fix list |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
882 |
assume is_waiting: "waiting (wq (V th cs # s)) t cs" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
883 |
and eq_wq: "wq_fun (schs s) cs = t # list" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
884 |
hence "t \<in> set list" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
885 |
apply (unfold wq_def, auto simp:Let_def cs_waiting_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
886 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
887 |
assume " t \<in> set (SOME q. distinct q \<and> set q = set list)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
888 |
moreover have "\<dots> = set list" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
889 |
proof(rule someI2) |
63 | 890 |
from vt_v.wq_distinct [of cs] |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
891 |
and eq_wq[folded wq_def] |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
892 |
show "distinct list \<and> set list = set list" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
893 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
894 |
fix x assume "distinct x \<and> set x = set list" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
895 |
thus "set x = set list" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
896 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
897 |
ultimately show "t \<in> set list" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
898 |
qed |
63 | 899 |
with eq_wq and vt_v.wq_distinct [of cs, unfolded wq_def] |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
900 |
show False by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
901 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
902 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
903 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
904 |
|
58 | 905 |
text {* (* ddd *) |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
906 |
The following @{text "step_RAG_v"} lemma charaterizes how @{text "RAG"} is changed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
907 |
with the happening of @{text "V"}-events: |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
908 |
*} |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
909 |
lemma step_RAG_v: |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
910 |
fixes th::thread |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
911 |
assumes vt: |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
912 |
"vt (V th cs#s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
913 |
shows " |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
914 |
RAG (V th cs # s) = |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
915 |
RAG s - {(Cs cs, Th th)} - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
916 |
{(Th th', Cs cs) |th'. next_th s th cs th'} \<union> |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
917 |
{(Cs cs, Th th') |th'. next_th s th cs th'}" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
918 |
apply (insert vt, unfold s_RAG_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
919 |
apply (auto split:if_splits list.splits simp:Let_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
920 |
apply (auto elim: step_v_waiting_mono step_v_hold_inv |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
921 |
step_v_release step_v_wait_inv |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
922 |
step_v_get_hold step_v_release_inv) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
923 |
apply (erule_tac step_v_not_wait, auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
924 |
done |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
925 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
926 |
text {* |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
927 |
The following @{text "step_RAG_p"} lemma charaterizes how @{text "RAG"} is changed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
928 |
with the happening of @{text "P"}-events: |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
929 |
*} |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
930 |
lemma step_RAG_p: |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
931 |
"vt (P th cs#s) \<Longrightarrow> |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
932 |
RAG (P th cs # s) = (if (wq s cs = []) then RAG s \<union> {(Cs cs, Th th)} |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
933 |
else RAG s \<union> {(Th th, Cs cs)})" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
934 |
apply(simp only: s_RAG_def wq_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
935 |
apply (auto split:list.splits prod.splits simp:Let_def wq_def cs_waiting_def cs_holding_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
936 |
apply(case_tac "csa = cs", auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
937 |
apply(fold wq_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
938 |
apply(drule_tac step_back_step) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
939 |
apply(ind_cases " step s (P (hd (wq s cs)) cs)") |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
940 |
apply(simp add:s_RAG_def wq_def cs_holding_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
941 |
apply(auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
942 |
done |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
943 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
944 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
945 |
lemma RAG_target_th: "(Th th, x) \<in> RAG (s::state) \<Longrightarrow> \<exists> cs. x = Cs cs" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
946 |
by (unfold s_RAG_def, auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
947 |
|
63 | 948 |
context valid_trace |
949 |
begin |
|
950 |
||
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
951 |
text {* |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
952 |
The following lemma shows that @{text "RAG"} is acyclic. |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
953 |
The overall structure is by induction on the formation of @{text "vt s"} |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
954 |
and then case analysis on event @{text "e"}, where the non-trivial cases |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
955 |
for those for @{text "V"} and @{text "P"} events. |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
956 |
*} |
63 | 957 |
lemma acyclic_RAG: |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
958 |
shows "acyclic (RAG s)" |
63 | 959 |
using vt |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
960 |
proof(induct) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
961 |
case (vt_cons s e) |
63 | 962 |
interpret vt_s: valid_trace s using vt_cons(1) |
963 |
by (unfold_locales, simp) |
|
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
964 |
assume ih: "acyclic (RAG s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
965 |
and stp: "step s e" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
966 |
and vt: "vt s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
967 |
show ?case |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
968 |
proof(cases e) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
969 |
case (Create th prio) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
970 |
with ih |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
971 |
show ?thesis by (simp add:RAG_create_unchanged) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
972 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
973 |
case (Exit th) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
974 |
with ih show ?thesis by (simp add:RAG_exit_unchanged) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
975 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
976 |
case (V th cs) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
977 |
from V vt stp have vtt: "vt (V th cs#s)" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
978 |
from step_RAG_v [OF this] |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
979 |
have eq_de: |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
980 |
"RAG (e # s) = |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
981 |
RAG s - {(Cs cs, Th th)} - {(Th th', Cs cs) |th'. next_th s th cs th'} \<union> |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
982 |
{(Cs cs, Th th') |th'. next_th s th cs th'}" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
983 |
(is "?L = (?A - ?B - ?C) \<union> ?D") by (simp add:V) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
984 |
from ih have ac: "acyclic (?A - ?B - ?C)" by (auto elim:acyclic_subset) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
985 |
from step_back_step [OF vtt] |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
986 |
have "step s (V th cs)" . |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
987 |
thus ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
988 |
proof(cases) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
989 |
assume "holding s th cs" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
990 |
hence th_in: "th \<in> set (wq s cs)" and |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
991 |
eq_hd: "th = hd (wq s cs)" unfolding s_holding_def wq_def by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
992 |
then obtain rest where |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
993 |
eq_wq: "wq s cs = th#rest" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
994 |
by (cases "wq s cs", auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
995 |
show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
996 |
proof(cases "rest = []") |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
997 |
case False |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
998 |
let ?th' = "hd (SOME q. distinct q \<and> set q = set rest)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
999 |
from eq_wq False have eq_D: "?D = {(Cs cs, Th ?th')}" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1000 |
by (unfold next_th_def, auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1001 |
let ?E = "(?A - ?B - ?C)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1002 |
have "(Th ?th', Cs cs) \<notin> ?E\<^sup>*" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1003 |
proof |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1004 |
assume "(Th ?th', Cs cs) \<in> ?E\<^sup>*" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1005 |
hence " (Th ?th', Cs cs) \<in> ?E\<^sup>+" by (simp add: rtrancl_eq_or_trancl) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1006 |
from tranclD [OF this] |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1007 |
obtain x where th'_e: "(Th ?th', x) \<in> ?E" by blast |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1008 |
hence th_d: "(Th ?th', x) \<in> ?A" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1009 |
from RAG_target_th [OF this] |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1010 |
obtain cs' where eq_x: "x = Cs cs'" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1011 |
with th_d have "(Th ?th', Cs cs') \<in> ?A" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1012 |
hence wt_th': "waiting s ?th' cs'" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1013 |
unfolding s_RAG_def s_waiting_def cs_waiting_def wq_def by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1014 |
hence "cs' = cs" |
63 | 1015 |
proof(rule vt_s.waiting_unique) |
1016 |
from eq_wq vt_s.wq_distinct[of cs] |
|
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1017 |
show "waiting s ?th' cs" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1018 |
apply (unfold s_waiting_def wq_def, auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1019 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1020 |
assume hd_in: "hd (SOME q. distinct q \<and> set q = set rest) \<notin> set rest" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1021 |
and eq_wq: "wq_fun (schs s) cs = th # rest" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1022 |
have "(SOME q. distinct q \<and> set q = set rest) \<noteq> []" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1023 |
proof(rule someI2) |
63 | 1024 |
from vt_s.wq_distinct[of cs] and eq_wq |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1025 |
show "distinct rest \<and> set rest = set rest" unfolding wq_def by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1026 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1027 |
fix x assume "distinct x \<and> set x = set rest" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1028 |
with False show "x \<noteq> []" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1029 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1030 |
hence "hd (SOME q. distinct q \<and> set q = set rest) \<in> |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1031 |
set (SOME q. distinct q \<and> set q = set rest)" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1032 |
moreover have "\<dots> = set rest" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1033 |
proof(rule someI2) |
63 | 1034 |
from vt_s.wq_distinct[of cs] and eq_wq |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1035 |
show "distinct rest \<and> set rest = set rest" unfolding wq_def by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1036 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1037 |
show "\<And>x. distinct x \<and> set x = set rest \<Longrightarrow> set x = set rest" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1038 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1039 |
moreover note hd_in |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1040 |
ultimately show "hd (SOME q. distinct q \<and> set q = set rest) = th" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1041 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1042 |
assume hd_in: "hd (SOME q. distinct q \<and> set q = set rest) \<notin> set rest" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1043 |
and eq_wq: "wq s cs = hd (SOME q. distinct q \<and> set q = set rest) # rest" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1044 |
have "(SOME q. distinct q \<and> set q = set rest) \<noteq> []" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1045 |
proof(rule someI2) |
63 | 1046 |
from vt_s.wq_distinct[of cs] and eq_wq |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1047 |
show "distinct rest \<and> set rest = set rest" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1048 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1049 |
fix x assume "distinct x \<and> set x = set rest" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1050 |
with False show "x \<noteq> []" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1051 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1052 |
hence "hd (SOME q. distinct q \<and> set q = set rest) \<in> |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1053 |
set (SOME q. distinct q \<and> set q = set rest)" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1054 |
moreover have "\<dots> = set rest" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1055 |
proof(rule someI2) |
63 | 1056 |
from vt_s.wq_distinct[of cs] and eq_wq |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1057 |
show "distinct rest \<and> set rest = set rest" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1058 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1059 |
show "\<And>x. distinct x \<and> set x = set rest \<Longrightarrow> set x = set rest" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1060 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1061 |
moreover note hd_in |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1062 |
ultimately show False by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1063 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1064 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1065 |
with th'_e eq_x have "(Th ?th', Cs cs) \<in> ?E" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1066 |
with False |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1067 |
show "False" by (auto simp: next_th_def eq_wq) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1068 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1069 |
with acyclic_insert[symmetric] and ac |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1070 |
and eq_de eq_D show ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1071 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1072 |
case True |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1073 |
with eq_wq |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1074 |
have eq_D: "?D = {}" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1075 |
by (unfold next_th_def, auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1076 |
with eq_de ac |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1077 |
show ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1078 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1079 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1080 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1081 |
case (P th cs) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1082 |
from P vt stp have vtt: "vt (P th cs#s)" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1083 |
from step_RAG_p [OF this] P |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1084 |
have "RAG (e # s) = |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1085 |
(if wq s cs = [] then RAG s \<union> {(Cs cs, Th th)} else |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1086 |
RAG s \<union> {(Th th, Cs cs)})" (is "?L = ?R") |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1087 |
by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1088 |
moreover have "acyclic ?R" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1089 |
proof(cases "wq s cs = []") |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1090 |
case True |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1091 |
hence eq_r: "?R = RAG s \<union> {(Cs cs, Th th)}" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1092 |
have "(Th th, Cs cs) \<notin> (RAG s)\<^sup>*" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1093 |
proof |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1094 |
assume "(Th th, Cs cs) \<in> (RAG s)\<^sup>*" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1095 |
hence "(Th th, Cs cs) \<in> (RAG s)\<^sup>+" by (simp add: rtrancl_eq_or_trancl) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1096 |
from tranclD2 [OF this] |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1097 |
obtain x where "(x, Cs cs) \<in> RAG s" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1098 |
with True show False by (auto simp:s_RAG_def cs_waiting_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1099 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1100 |
with acyclic_insert ih eq_r show ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1101 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1102 |
case False |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1103 |
hence eq_r: "?R = RAG s \<union> {(Th th, Cs cs)}" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1104 |
have "(Cs cs, Th th) \<notin> (RAG s)\<^sup>*" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1105 |
proof |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1106 |
assume "(Cs cs, Th th) \<in> (RAG s)\<^sup>*" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1107 |
hence "(Cs cs, Th th) \<in> (RAG s)\<^sup>+" by (simp add: rtrancl_eq_or_trancl) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1108 |
moreover from step_back_step [OF vtt] have "step s (P th cs)" . |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1109 |
ultimately show False |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1110 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1111 |
show " \<lbrakk>(Cs cs, Th th) \<in> (RAG s)\<^sup>+; step s (P th cs)\<rbrakk> \<Longrightarrow> False" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1112 |
by (ind_cases "step s (P th cs)", simp) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1113 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1114 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1115 |
with acyclic_insert ih eq_r show ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1116 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1117 |
ultimately show ?thesis by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1118 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1119 |
case (Set thread prio) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1120 |
with ih |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1121 |
thm RAG_set_unchanged |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1122 |
show ?thesis by (simp add:RAG_set_unchanged) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1123 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1124 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1125 |
case vt_nil |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1126 |
show "acyclic (RAG ([]::state))" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1127 |
by (auto simp: s_RAG_def cs_waiting_def |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1128 |
cs_holding_def wq_def acyclic_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1129 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1130 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1131 |
|
63 | 1132 |
lemma finite_RAG: |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1133 |
shows "finite (RAG s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1134 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1135 |
from vt show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1136 |
proof(induct) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1137 |
case (vt_cons s e) |
63 | 1138 |
interpret vt_s: valid_trace s using vt_cons(1) |
1139 |
by (unfold_locales, simp) |
|
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1140 |
assume ih: "finite (RAG s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1141 |
and stp: "step s e" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1142 |
and vt: "vt s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1143 |
show ?case |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1144 |
proof(cases e) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1145 |
case (Create th prio) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1146 |
with ih |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1147 |
show ?thesis by (simp add:RAG_create_unchanged) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1148 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1149 |
case (Exit th) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1150 |
with ih show ?thesis by (simp add:RAG_exit_unchanged) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1151 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1152 |
case (V th cs) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1153 |
from V vt stp have vtt: "vt (V th cs#s)" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1154 |
from step_RAG_v [OF this] |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1155 |
have eq_de: "RAG (e # s) = |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1156 |
RAG s - {(Cs cs, Th th)} - {(Th th', Cs cs) |th'. next_th s th cs th'} \<union> |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1157 |
{(Cs cs, Th th') |th'. next_th s th cs th'} |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1158 |
" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1159 |
(is "?L = (?A - ?B - ?C) \<union> ?D") by (simp add:V) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1160 |
moreover from ih have ac: "finite (?A - ?B - ?C)" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1161 |
moreover have "finite ?D" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1162 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1163 |
have "?D = {} \<or> (\<exists> a. ?D = {a})" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1164 |
by (unfold next_th_def, auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1165 |
thus ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1166 |
proof |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1167 |
assume h: "?D = {}" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1168 |
show ?thesis by (unfold h, simp) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1169 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1170 |
assume "\<exists> a. ?D = {a}" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1171 |
thus ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1172 |
by (metis finite.simps) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1173 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1174 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1175 |
ultimately show ?thesis by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1176 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1177 |
case (P th cs) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1178 |
from P vt stp have vtt: "vt (P th cs#s)" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1179 |
from step_RAG_p [OF this] P |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1180 |
have "RAG (e # s) = |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1181 |
(if wq s cs = [] then RAG s \<union> {(Cs cs, Th th)} else |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1182 |
RAG s \<union> {(Th th, Cs cs)})" (is "?L = ?R") |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1183 |
by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1184 |
moreover have "finite ?R" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1185 |
proof(cases "wq s cs = []") |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1186 |
case True |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1187 |
hence eq_r: "?R = RAG s \<union> {(Cs cs, Th th)}" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1188 |
with True and ih show ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1189 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1190 |
case False |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1191 |
hence "?R = RAG s \<union> {(Th th, Cs cs)}" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1192 |
with False and ih show ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1193 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1194 |
ultimately show ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1195 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1196 |
case (Set thread prio) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1197 |
with ih |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1198 |
show ?thesis by (simp add:RAG_set_unchanged) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1199 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1200 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1201 |
case vt_nil |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1202 |
show "finite (RAG ([]::state))" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1203 |
by (auto simp: s_RAG_def cs_waiting_def |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1204 |
cs_holding_def wq_def acyclic_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1205 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1206 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1207 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1208 |
text {* Several useful lemmas *} |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1209 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1210 |
lemma wf_dep_converse: |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1211 |
shows "wf ((RAG s)^-1)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1212 |
proof(rule finite_acyclic_wf_converse) |
63 | 1213 |
from finite_RAG |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1214 |
show "finite (RAG s)" . |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1215 |
next |
63 | 1216 |
from acyclic_RAG |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1217 |
show "acyclic (RAG s)" . |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1218 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1219 |
|
63 | 1220 |
end |
1221 |
||
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1222 |
lemma hd_np_in: "x \<in> set l \<Longrightarrow> hd l \<in> set l" |
63 | 1223 |
by (induct l, auto) |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1224 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1225 |
lemma th_chasing: "(Th th, Cs cs) \<in> RAG (s::state) \<Longrightarrow> \<exists> th'. (Cs cs, Th th') \<in> RAG s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1226 |
by (auto simp:s_RAG_def s_holding_def cs_holding_def cs_waiting_def wq_def dest:hd_np_in) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1227 |
|
63 | 1228 |
context valid_trace |
1229 |
begin |
|
1230 |
||
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1231 |
lemma wq_threads: |
63 | 1232 |
assumes h: "th \<in> set (wq s cs)" |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1233 |
shows "th \<in> threads s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1234 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1235 |
from vt and h show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1236 |
proof(induct arbitrary: th cs) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1237 |
case (vt_cons s e) |
63 | 1238 |
interpret vt_s: valid_trace s |
1239 |
using vt_cons(1) by (unfold_locales, auto) |
|
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1240 |
assume ih: "\<And>th cs. th \<in> set (wq s cs) \<Longrightarrow> th \<in> threads s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1241 |
and stp: "step s e" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1242 |
and vt: "vt s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1243 |
and h: "th \<in> set (wq (e # s) cs)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1244 |
show ?case |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1245 |
proof(cases e) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1246 |
case (Create th' prio) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1247 |
with ih h show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1248 |
by (auto simp:wq_def Let_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1249 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1250 |
case (Exit th') |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1251 |
with stp ih h show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1252 |
apply (auto simp:wq_def Let_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1253 |
apply (ind_cases "step s (Exit th')") |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1254 |
apply (auto simp:runing_def readys_def s_holding_def s_waiting_def holdents_def |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1255 |
s_RAG_def s_holding_def cs_holding_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1256 |
done |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1257 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1258 |
case (V th' cs') |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1259 |
show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1260 |
proof(cases "cs' = cs") |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1261 |
case False |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1262 |
with h |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1263 |
show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1264 |
apply(unfold wq_def V, auto simp:Let_def V split:prod.splits, fold wq_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1265 |
by (drule_tac ih, simp) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1266 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1267 |
case True |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1268 |
from h |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1269 |
show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1270 |
proof(unfold V wq_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1271 |
assume th_in: "th \<in> set (wq_fun (schs (V th' cs' # s)) cs)" (is "th \<in> set ?l") |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1272 |
show "th \<in> threads (V th' cs' # s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1273 |
proof(cases "cs = cs'") |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1274 |
case False |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1275 |
hence "?l = wq_fun (schs s) cs" by (simp add:Let_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1276 |
with th_in have " th \<in> set (wq s cs)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1277 |
by (fold wq_def, simp) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1278 |
from ih [OF this] show ?thesis by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1279 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1280 |
case True |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1281 |
show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1282 |
proof(cases "wq_fun (schs s) cs'") |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1283 |
case Nil |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1284 |
with h V show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1285 |
apply (auto simp:wq_def Let_def split:if_splits) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1286 |
by (fold wq_def, drule_tac ih, simp) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1287 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1288 |
case (Cons a rest) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1289 |
assume eq_wq: "wq_fun (schs s) cs' = a # rest" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1290 |
with h V show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1291 |
apply (auto simp:Let_def wq_def split:if_splits) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1292 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1293 |
assume th_in: "th \<in> set (SOME q. distinct q \<and> set q = set rest)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1294 |
have "set (SOME q. distinct q \<and> set q = set rest) = set rest" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1295 |
proof(rule someI2) |
63 | 1296 |
from vt_s.wq_distinct[of cs'] and eq_wq[folded wq_def] |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1297 |
show "distinct rest \<and> set rest = set rest" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1298 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1299 |
show "\<And>x. distinct x \<and> set x = set rest \<Longrightarrow> set x = set rest" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1300 |
by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1301 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1302 |
with eq_wq th_in have "th \<in> set (wq_fun (schs s) cs')" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1303 |
from ih[OF this[folded wq_def]] show "th \<in> threads s" . |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1304 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1305 |
assume th_in: "th \<in> set (wq_fun (schs s) cs)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1306 |
from ih[OF this[folded wq_def]] |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1307 |
show "th \<in> threads s" . |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1308 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1309 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1310 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1311 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1312 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1313 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1314 |
case (P th' cs') |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1315 |
from h stp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1316 |
show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1317 |
apply (unfold P wq_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1318 |
apply (auto simp:Let_def split:if_splits, fold wq_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1319 |
apply (auto intro:ih) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1320 |
apply(ind_cases "step s (P th' cs')") |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1321 |
by (unfold runing_def readys_def, auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1322 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1323 |
case (Set thread prio) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1324 |
with ih h show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1325 |
by (auto simp:wq_def Let_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1326 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1327 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1328 |
case vt_nil |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1329 |
thus ?case by (auto simp:wq_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1330 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1331 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1332 |
|
63 | 1333 |
lemma range_in: "\<lbrakk>(Th th) \<in> Range (RAG (s::state))\<rbrakk> \<Longrightarrow> th \<in> threads s" |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1334 |
apply(unfold s_RAG_def cs_waiting_def cs_holding_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1335 |
by (auto intro:wq_threads) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1336 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1337 |
lemma readys_v_eq: |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1338 |
fixes th thread cs rest |
63 | 1339 |
assumes neq_th: "th \<noteq> thread" |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1340 |
and eq_wq: "wq s cs = thread#rest" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1341 |
and not_in: "th \<notin> set rest" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1342 |
shows "(th \<in> readys (V thread cs#s)) = (th \<in> readys s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1343 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1344 |
from assms show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1345 |
apply (auto simp:readys_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1346 |
apply(simp add:s_waiting_def[folded wq_def]) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1347 |
apply (erule_tac x = csa in allE) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1348 |
apply (simp add:s_waiting_def wq_def Let_def split:if_splits) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1349 |
apply (case_tac "csa = cs", simp) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1350 |
apply (erule_tac x = cs in allE) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1351 |
apply(auto simp add: s_waiting_def[folded wq_def] Let_def split: list.splits) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1352 |
apply(auto simp add: wq_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1353 |
apply (auto simp:s_waiting_def wq_def Let_def split:list.splits) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1354 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1355 |
assume th_nin: "th \<notin> set rest" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1356 |
and th_in: "th \<in> set (SOME q. distinct q \<and> set q = set rest)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1357 |
and eq_wq: "wq_fun (schs s) cs = thread # rest" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1358 |
have "set (SOME q. distinct q \<and> set q = set rest) = set rest" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1359 |
proof(rule someI2) |
63 | 1360 |
from wq_distinct[of cs, unfolded wq_def] and eq_wq[unfolded wq_def] |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1361 |
show "distinct rest \<and> set rest = set rest" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1362 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1363 |
show "\<And>x. distinct x \<and> set x = set rest \<Longrightarrow> set x = set rest" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1364 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1365 |
with th_nin th_in show False by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1366 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1367 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1368 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1369 |
text {* \noindent |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1370 |
The following lemmas shows that: starting from any node in @{text "RAG"}, |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1371 |
by chasing out-going edges, it is always possible to reach a node representing a ready |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1372 |
thread. In this lemma, it is the @{text "th'"}. |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1373 |
*} |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1374 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1375 |
lemma chain_building: |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1376 |
shows "node \<in> Domain (RAG s) \<longrightarrow> (\<exists> th'. th' \<in> readys s \<and> (node, Th th') \<in> (RAG s)^+)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1377 |
proof - |
63 | 1378 |
from wf_dep_converse |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1379 |
have h: "wf ((RAG s)\<inverse>)" . |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1380 |
show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1381 |
proof(induct rule:wf_induct [OF h]) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1382 |
fix x |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1383 |
assume ih [rule_format]: |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1384 |
"\<forall>y. (y, x) \<in> (RAG s)\<inverse> \<longrightarrow> |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1385 |
y \<in> Domain (RAG s) \<longrightarrow> (\<exists>th'. th' \<in> readys s \<and> (y, Th th') \<in> (RAG s)\<^sup>+)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1386 |
show "x \<in> Domain (RAG s) \<longrightarrow> (\<exists>th'. th' \<in> readys s \<and> (x, Th th') \<in> (RAG s)\<^sup>+)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1387 |
proof |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1388 |
assume x_d: "x \<in> Domain (RAG s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1389 |
show "\<exists>th'. th' \<in> readys s \<and> (x, Th th') \<in> (RAG s)\<^sup>+" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1390 |
proof(cases x) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1391 |
case (Th th) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1392 |
from x_d Th obtain cs where x_in: "(Th th, Cs cs) \<in> RAG s" by (auto simp:s_RAG_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1393 |
with Th have x_in_r: "(Cs cs, x) \<in> (RAG s)^-1" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1394 |
from th_chasing [OF x_in] obtain th' where "(Cs cs, Th th') \<in> RAG s" by blast |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1395 |
hence "Cs cs \<in> Domain (RAG s)" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1396 |
from ih [OF x_in_r this] obtain th' |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1397 |
where th'_ready: " th' \<in> readys s" and cs_in: "(Cs cs, Th th') \<in> (RAG s)\<^sup>+" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1398 |
have "(x, Th th') \<in> (RAG s)\<^sup>+" using Th x_in cs_in by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1399 |
with th'_ready show ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1400 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1401 |
case (Cs cs) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1402 |
from x_d Cs obtain th' where th'_d: "(Th th', x) \<in> (RAG s)^-1" by (auto simp:s_RAG_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1403 |
show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1404 |
proof(cases "th' \<in> readys s") |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1405 |
case True |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1406 |
from True and th'_d show ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1407 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1408 |
case False |
63 | 1409 |
from th'_d and range_in have "th' \<in> threads s" by auto |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1410 |
with False have "Th th' \<in> Domain (RAG s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1411 |
by (auto simp:readys_def wq_def s_waiting_def s_RAG_def cs_waiting_def Domain_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1412 |
from ih [OF th'_d this] |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1413 |
obtain th'' where |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1414 |
th''_r: "th'' \<in> readys s" and |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1415 |
th''_in: "(Th th', Th th'') \<in> (RAG s)\<^sup>+" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1416 |
from th'_d and th''_in |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1417 |
have "(x, Th th'') \<in> (RAG s)\<^sup>+" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1418 |
with th''_r show ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1419 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1420 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1421 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1422 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1423 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1424 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1425 |
text {* \noindent |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1426 |
The following is just an instance of @{text "chain_building"}. |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1427 |
*} |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1428 |
lemma th_chain_to_ready: |
63 | 1429 |
assumes th_in: "th \<in> threads s" |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1430 |
shows "th \<in> readys s \<or> (\<exists> th'. th' \<in> readys s \<and> (Th th, Th th') \<in> (RAG s)^+)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1431 |
proof(cases "th \<in> readys s") |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1432 |
case True |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1433 |
thus ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1434 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1435 |
case False |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1436 |
from False and th_in have "Th th \<in> Domain (RAG s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1437 |
by (auto simp:readys_def s_waiting_def s_RAG_def wq_def cs_waiting_def Domain_def) |
63 | 1438 |
from chain_building [rule_format, OF this] |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1439 |
show ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1440 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1441 |
|
63 | 1442 |
end |
1443 |
||
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1444 |
lemma waiting_eq: "waiting s th cs = waiting (wq s) th cs" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1445 |
by (unfold s_waiting_def cs_waiting_def wq_def, auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1446 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1447 |
lemma holding_eq: "holding (s::state) th cs = holding (wq s) th cs" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1448 |
by (unfold s_holding_def wq_def cs_holding_def, simp) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1449 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1450 |
lemma holding_unique: "\<lbrakk>holding (s::state) th1 cs; holding s th2 cs\<rbrakk> \<Longrightarrow> th1 = th2" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1451 |
by (unfold s_holding_def cs_holding_def, auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1452 |
|
63 | 1453 |
context valid_trace |
1454 |
begin |
|
1455 |
||
1456 |
lemma unique_RAG: "\<lbrakk>(n, n1) \<in> RAG s; (n, n2) \<in> RAG s\<rbrakk> \<Longrightarrow> n1 = n2" |
|
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1457 |
apply(unfold s_RAG_def, auto, fold waiting_eq holding_eq) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1458 |
by(auto elim:waiting_unique holding_unique) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1459 |
|
63 | 1460 |
end |
1461 |
||
1462 |
||
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1463 |
lemma trancl_split: "(a, b) \<in> r^+ \<Longrightarrow> \<exists> c. (a, c) \<in> r" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1464 |
by (induct rule:trancl_induct, auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1465 |
|
63 | 1466 |
context valid_trace |
1467 |
begin |
|
1468 |
||
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1469 |
lemma dchain_unique: |
63 | 1470 |
assumes th1_d: "(n, Th th1) \<in> (RAG s)^+" |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1471 |
and th1_r: "th1 \<in> readys s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1472 |
and th2_d: "(n, Th th2) \<in> (RAG s)^+" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1473 |
and th2_r: "th2 \<in> readys s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1474 |
shows "th1 = th2" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1475 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1476 |
{ assume neq: "th1 \<noteq> th2" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1477 |
hence "Th th1 \<noteq> Th th2" by simp |
63 | 1478 |
from unique_chain [OF _ th1_d th2_d this] and unique_RAG |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1479 |
have "(Th th1, Th th2) \<in> (RAG s)\<^sup>+ \<or> (Th th2, Th th1) \<in> (RAG s)\<^sup>+" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1480 |
hence "False" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1481 |
proof |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1482 |
assume "(Th th1, Th th2) \<in> (RAG s)\<^sup>+" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1483 |
from trancl_split [OF this] |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1484 |
obtain n where dd: "(Th th1, n) \<in> RAG s" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1485 |
then obtain cs where eq_n: "n = Cs cs" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1486 |
by (auto simp:s_RAG_def s_holding_def cs_holding_def cs_waiting_def wq_def dest:hd_np_in) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1487 |
from dd eq_n have "th1 \<notin> readys s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1488 |
by (auto simp:readys_def s_RAG_def wq_def s_waiting_def cs_waiting_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1489 |
with th1_r show ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1490 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1491 |
assume "(Th th2, Th th1) \<in> (RAG s)\<^sup>+" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1492 |
from trancl_split [OF this] |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1493 |
obtain n where dd: "(Th th2, n) \<in> RAG s" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1494 |
then obtain cs where eq_n: "n = Cs cs" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1495 |
by (auto simp:s_RAG_def s_holding_def cs_holding_def cs_waiting_def wq_def dest:hd_np_in) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1496 |
from dd eq_n have "th2 \<notin> readys s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1497 |
by (auto simp:readys_def wq_def s_RAG_def s_waiting_def cs_waiting_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1498 |
with th2_r show ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1499 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1500 |
} thus ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1501 |
qed |
63 | 1502 |
|
1503 |
end |
|
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1504 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1505 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1506 |
lemma step_holdents_p_add: |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1507 |
fixes th cs s |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1508 |
assumes vt: "vt (P th cs#s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1509 |
and "wq s cs = []" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1510 |
shows "holdents (P th cs#s) th = holdents s th \<union> {cs}" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1511 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1512 |
from assms show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1513 |
unfolding holdents_test step_RAG_p[OF vt] by (auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1514 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1515 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1516 |
lemma step_holdents_p_eq: |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1517 |
fixes th cs s |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1518 |
assumes vt: "vt (P th cs#s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1519 |
and "wq s cs \<noteq> []" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1520 |
shows "holdents (P th cs#s) th = holdents s th" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1521 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1522 |
from assms show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1523 |
unfolding holdents_test step_RAG_p[OF vt] by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1524 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1525 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1526 |
|
63 | 1527 |
lemma (in valid_trace) finite_holding : |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1528 |
shows "finite (holdents s th)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1529 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1530 |
let ?F = "\<lambda> (x, y). the_cs x" |
63 | 1531 |
from finite_RAG |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1532 |
have "finite (RAG s)" . |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1533 |
hence "finite (?F `(RAG s))" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1534 |
moreover have "{cs . (Cs cs, Th th) \<in> RAG s} \<subseteq> \<dots>" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1535 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1536 |
{ have h: "\<And> a A f. a \<in> A \<Longrightarrow> f a \<in> f ` A" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1537 |
fix x assume "(Cs x, Th th) \<in> RAG s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1538 |
hence "?F (Cs x, Th th) \<in> ?F `(RAG s)" by (rule h) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1539 |
moreover have "?F (Cs x, Th th) = x" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1540 |
ultimately have "x \<in> (\<lambda>(x, y). the_cs x) ` RAG s" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1541 |
} thus ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1542 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1543 |
ultimately show ?thesis by (unfold holdents_test, auto intro:finite_subset) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1544 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1545 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1546 |
lemma cntCS_v_dec: |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1547 |
fixes s thread cs |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1548 |
assumes vtv: "vt (V thread cs#s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1549 |
shows "(cntCS (V thread cs#s) thread + 1) = cntCS s thread" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1550 |
proof - |
63 | 1551 |
from vtv interpret vt_s: valid_trace s |
1552 |
by (cases, unfold_locales, simp) |
|
1553 |
from vtv interpret vt_v: valid_trace "V thread cs#s" |
|
1554 |
by (unfold_locales, simp) |
|
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1555 |
from step_back_step[OF vtv] |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1556 |
have cs_in: "cs \<in> holdents s thread" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1557 |
apply (cases, unfold holdents_test s_RAG_def, simp) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1558 |
by (unfold cs_holding_def s_holding_def wq_def, auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1559 |
moreover have cs_not_in: |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1560 |
"(holdents (V thread cs#s) thread) = holdents s thread - {cs}" |
63 | 1561 |
apply (insert vt_s.wq_distinct[of cs]) |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1562 |
apply (unfold holdents_test, unfold step_RAG_v[OF vtv], |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1563 |
auto simp:next_th_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1564 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1565 |
fix rest |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1566 |
assume dst: "distinct (rest::thread list)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1567 |
and ne: "rest \<noteq> []" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1568 |
and hd_ni: "hd (SOME q. distinct q \<and> set q = set rest) \<notin> set rest" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1569 |
moreover have "set (SOME q. distinct q \<and> set q = set rest) = set rest" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1570 |
proof(rule someI2) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1571 |
from dst show "distinct rest \<and> set rest = set rest" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1572 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1573 |
show "\<And>x. distinct x \<and> set x = set rest \<Longrightarrow> set x = set rest" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1574 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1575 |
ultimately have "hd (SOME q. distinct q \<and> set q = set rest) \<notin> |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1576 |
set (SOME q. distinct q \<and> set q = set rest)" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1577 |
moreover have "(SOME q. distinct q \<and> set q = set rest) \<noteq> []" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1578 |
proof(rule someI2) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1579 |
from dst show "distinct rest \<and> set rest = set rest" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1580 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1581 |
fix x assume " distinct x \<and> set x = set rest" with ne |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1582 |
show "x \<noteq> []" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1583 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1584 |
ultimately |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1585 |
show "(Cs cs, Th (hd (SOME q. distinct q \<and> set q = set rest))) \<in> RAG s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1586 |
by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1587 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1588 |
fix rest |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1589 |
assume dst: "distinct (rest::thread list)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1590 |
and ne: "rest \<noteq> []" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1591 |
and hd_ni: "hd (SOME q. distinct q \<and> set q = set rest) \<notin> set rest" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1592 |
moreover have "set (SOME q. distinct q \<and> set q = set rest) = set rest" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1593 |
proof(rule someI2) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1594 |
from dst show "distinct rest \<and> set rest = set rest" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1595 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1596 |
show "\<And>x. distinct x \<and> set x = set rest \<Longrightarrow> set x = set rest" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1597 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1598 |
ultimately have "hd (SOME q. distinct q \<and> set q = set rest) \<notin> |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1599 |
set (SOME q. distinct q \<and> set q = set rest)" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1600 |
moreover have "(SOME q. distinct q \<and> set q = set rest) \<noteq> []" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1601 |
proof(rule someI2) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1602 |
from dst show "distinct rest \<and> set rest = set rest" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1603 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1604 |
fix x assume " distinct x \<and> set x = set rest" with ne |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1605 |
show "x \<noteq> []" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1606 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1607 |
ultimately show "False" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1608 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1609 |
ultimately |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1610 |
have "holdents s thread = insert cs (holdents (V thread cs#s) thread)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1611 |
by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1612 |
moreover have "card \<dots> = |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1613 |
Suc (card ((holdents (V thread cs#s) thread) - {cs}))" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1614 |
proof(rule card_insert) |
63 | 1615 |
from vt_v.finite_holding |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1616 |
show " finite (holdents (V thread cs # s) thread)" . |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1617 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1618 |
moreover from cs_not_in |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1619 |
have "cs \<notin> (holdents (V thread cs#s) thread)" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1620 |
ultimately show ?thesis by (simp add:cntCS_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1621 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1622 |
|
63 | 1623 |
context valid_trace |
1624 |
begin |
|
1625 |
||
58 | 1626 |
text {* (* ddd *) \noindent |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1627 |
The relationship between @{text "cntP"}, @{text "cntV"} and @{text "cntCS"} |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1628 |
of one particular thread. |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1629 |
*} |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1630 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1631 |
lemma cnp_cnv_cncs: |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1632 |
shows "cntP s th = cntV s th + (if (th \<in> readys s \<or> th \<notin> threads s) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1633 |
then cntCS s th else cntCS s th + 1)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1634 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1635 |
from vt show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1636 |
proof(induct arbitrary:th) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1637 |
case (vt_cons s e) |
63 | 1638 |
interpret vt_s: valid_trace s using vt_cons(1) by (unfold_locales, simp) |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1639 |
assume vt: "vt s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1640 |
and ih: "\<And>th. cntP s th = cntV s th + |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1641 |
(if (th \<in> readys s \<or> th \<notin> threads s) then cntCS s th else cntCS s th + 1)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1642 |
and stp: "step s e" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1643 |
from stp show ?case |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1644 |
proof(cases) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1645 |
case (thread_create thread prio) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1646 |
assume eq_e: "e = Create thread prio" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1647 |
and not_in: "thread \<notin> threads s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1648 |
show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1649 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1650 |
{ fix cs |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1651 |
assume "thread \<in> set (wq s cs)" |
63 | 1652 |
from vt_s.wq_threads [OF this] have "thread \<in> threads s" . |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1653 |
with not_in have "False" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1654 |
} with eq_e have eq_readys: "readys (e#s) = readys s \<union> {thread}" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1655 |
by (auto simp:readys_def threads.simps s_waiting_def |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1656 |
wq_def cs_waiting_def Let_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1657 |
from eq_e have eq_cnp: "cntP (e#s) th = cntP s th" by (simp add:cntP_def count_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1658 |
from eq_e have eq_cnv: "cntV (e#s) th = cntV s th" by (simp add:cntV_def count_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1659 |
have eq_cncs: "cntCS (e#s) th = cntCS s th" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1660 |
unfolding cntCS_def holdents_test |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1661 |
by (simp add:RAG_create_unchanged eq_e) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1662 |
{ assume "th \<noteq> thread" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1663 |
with eq_readys eq_e |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1664 |
have "(th \<in> readys (e # s) \<or> th \<notin> threads (e # s)) = |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1665 |
(th \<in> readys (s) \<or> th \<notin> threads (s))" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1666 |
by (simp add:threads.simps) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1667 |
with eq_cnp eq_cnv eq_cncs ih not_in |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1668 |
have ?thesis by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1669 |
} moreover { |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1670 |
assume eq_th: "th = thread" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1671 |
with not_in ih have " cntP s th = cntV s th + cntCS s th" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1672 |
moreover from eq_th and eq_readys have "th \<in> readys (e#s)" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1673 |
moreover note eq_cnp eq_cnv eq_cncs |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1674 |
ultimately have ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1675 |
} ultimately show ?thesis by blast |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1676 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1677 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1678 |
case (thread_exit thread) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1679 |
assume eq_e: "e = Exit thread" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1680 |
and is_runing: "thread \<in> runing s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1681 |
and no_hold: "holdents s thread = {}" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1682 |
from eq_e have eq_cnp: "cntP (e#s) th = cntP s th" by (simp add:cntP_def count_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1683 |
from eq_e have eq_cnv: "cntV (e#s) th = cntV s th" by (simp add:cntV_def count_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1684 |
have eq_cncs: "cntCS (e#s) th = cntCS s th" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1685 |
unfolding cntCS_def holdents_test |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1686 |
by (simp add:RAG_exit_unchanged eq_e) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1687 |
{ assume "th \<noteq> thread" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1688 |
with eq_e |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1689 |
have "(th \<in> readys (e # s) \<or> th \<notin> threads (e # s)) = |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1690 |
(th \<in> readys (s) \<or> th \<notin> threads (s))" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1691 |
apply (simp add:threads.simps readys_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1692 |
apply (subst s_waiting_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1693 |
apply (simp add:Let_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1694 |
apply (subst s_waiting_def, simp) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1695 |
done |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1696 |
with eq_cnp eq_cnv eq_cncs ih |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1697 |
have ?thesis by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1698 |
} moreover { |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1699 |
assume eq_th: "th = thread" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1700 |
with ih is_runing have " cntP s th = cntV s th + cntCS s th" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1701 |
by (simp add:runing_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1702 |
moreover from eq_th eq_e have "th \<notin> threads (e#s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1703 |
by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1704 |
moreover note eq_cnp eq_cnv eq_cncs |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1705 |
ultimately have ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1706 |
} ultimately show ?thesis by blast |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1707 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1708 |
case (thread_P thread cs) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1709 |
assume eq_e: "e = P thread cs" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1710 |
and is_runing: "thread \<in> runing s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1711 |
and no_dep: "(Cs cs, Th thread) \<notin> (RAG s)\<^sup>+" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1712 |
from thread_P vt stp ih have vtp: "vt (P thread cs#s)" by auto |
63 | 1713 |
then interpret vt_p: valid_trace "(P thread cs#s)" |
1714 |
by (unfold_locales, simp) |
|
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1715 |
show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1716 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1717 |
{ have hh: "\<And> A B C. (B = C) \<Longrightarrow> (A \<and> B) = (A \<and> C)" by blast |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1718 |
assume neq_th: "th \<noteq> thread" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1719 |
with eq_e |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1720 |
have eq_readys: "(th \<in> readys (e#s)) = (th \<in> readys (s))" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1721 |
apply (simp add:readys_def s_waiting_def wq_def Let_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1722 |
apply (rule_tac hh) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1723 |
apply (intro iffI allI, clarify) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1724 |
apply (erule_tac x = csa in allE, auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1725 |
apply (subgoal_tac "wq_fun (schs s) cs \<noteq> []", auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1726 |
apply (erule_tac x = cs in allE, auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1727 |
by (case_tac "(wq_fun (schs s) cs)", auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1728 |
moreover from neq_th eq_e have "cntCS (e # s) th = cntCS s th" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1729 |
apply (simp add:cntCS_def holdents_test) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1730 |
by (unfold step_RAG_p [OF vtp], auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1731 |
moreover from eq_e neq_th have "cntP (e # s) th = cntP s th" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1732 |
by (simp add:cntP_def count_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1733 |
moreover from eq_e neq_th have "cntV (e#s) th = cntV s th" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1734 |
by (simp add:cntV_def count_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1735 |
moreover from eq_e neq_th have "threads (e#s) = threads s" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1736 |
moreover note ih [of th] |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1737 |
ultimately have ?thesis by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1738 |
} moreover { |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1739 |
assume eq_th: "th = thread" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1740 |
have ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1741 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1742 |
from eq_e eq_th have eq_cnp: "cntP (e # s) th = 1 + (cntP s th)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1743 |
by (simp add:cntP_def count_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1744 |
from eq_e eq_th have eq_cnv: "cntV (e#s) th = cntV s th" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1745 |
by (simp add:cntV_def count_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1746 |
show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1747 |
proof (cases "wq s cs = []") |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1748 |
case True |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1749 |
with is_runing |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1750 |
have "th \<in> readys (e#s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1751 |
apply (unfold eq_e wq_def, unfold readys_def s_RAG_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1752 |
apply (simp add: wq_def[symmetric] runing_def eq_th s_waiting_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1753 |
by (auto simp:readys_def wq_def Let_def s_waiting_def wq_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1754 |
moreover have "cntCS (e # s) th = 1 + cntCS s th" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1755 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1756 |
have "card {csa. csa = cs \<or> (Cs csa, Th thread) \<in> RAG s} = |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1757 |
Suc (card {cs. (Cs cs, Th thread) \<in> RAG s})" (is "card ?L = Suc (card ?R)") |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1758 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1759 |
have "?L = insert cs ?R" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1760 |
moreover have "card \<dots> = Suc (card (?R - {cs}))" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1761 |
proof(rule card_insert) |
63 | 1762 |
from vt_s.finite_holding [of thread] |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1763 |
show " finite {cs. (Cs cs, Th thread) \<in> RAG s}" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1764 |
by (unfold holdents_test, simp) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1765 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1766 |
moreover have "?R - {cs} = ?R" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1767 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1768 |
have "cs \<notin> ?R" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1769 |
proof |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1770 |
assume "cs \<in> {cs. (Cs cs, Th thread) \<in> RAG s}" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1771 |
with no_dep show False by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1772 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1773 |
thus ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1774 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1775 |
ultimately show ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1776 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1777 |
thus ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1778 |
apply (unfold eq_e eq_th cntCS_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1779 |
apply (simp add: holdents_test) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1780 |
by (unfold step_RAG_p [OF vtp], auto simp:True) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1781 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1782 |
moreover from is_runing have "th \<in> readys s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1783 |
by (simp add:runing_def eq_th) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1784 |
moreover note eq_cnp eq_cnv ih [of th] |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1785 |
ultimately show ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1786 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1787 |
case False |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1788 |
have eq_wq: "wq (e#s) cs = wq s cs @ [th]" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1789 |
by (unfold eq_th eq_e wq_def, auto simp:Let_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1790 |
have "th \<notin> readys (e#s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1791 |
proof |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1792 |
assume "th \<in> readys (e#s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1793 |
hence "\<forall>cs. \<not> waiting (e # s) th cs" by (simp add:readys_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1794 |
from this[rule_format, of cs] have " \<not> waiting (e # s) th cs" . |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1795 |
hence "th \<in> set (wq (e#s) cs) \<Longrightarrow> th = hd (wq (e#s) cs)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1796 |
by (simp add:s_waiting_def wq_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1797 |
moreover from eq_wq have "th \<in> set (wq (e#s) cs)" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1798 |
ultimately have "th = hd (wq (e#s) cs)" by blast |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1799 |
with eq_wq have "th = hd (wq s cs @ [th])" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1800 |
hence "th = hd (wq s cs)" using False by auto |
63 | 1801 |
with False eq_wq vt_p.wq_distinct [of cs] |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1802 |
show False by (fold eq_e, auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1803 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1804 |
moreover from is_runing have "th \<in> threads (e#s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1805 |
by (unfold eq_e, auto simp:runing_def readys_def eq_th) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1806 |
moreover have "cntCS (e # s) th = cntCS s th" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1807 |
apply (unfold cntCS_def holdents_test eq_e step_RAG_p[OF vtp]) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1808 |
by (auto simp:False) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1809 |
moreover note eq_cnp eq_cnv ih[of th] |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1810 |
moreover from is_runing have "th \<in> readys s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1811 |
by (simp add:runing_def eq_th) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1812 |
ultimately show ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1813 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1814 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1815 |
} ultimately show ?thesis by blast |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1816 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1817 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1818 |
case (thread_V thread cs) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1819 |
from assms vt stp ih thread_V have vtv: "vt (V thread cs # s)" by auto |
63 | 1820 |
then interpret vt_v: valid_trace "(V thread cs # s)" by (unfold_locales, simp) |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1821 |
assume eq_e: "e = V thread cs" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1822 |
and is_runing: "thread \<in> runing s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1823 |
and hold: "holding s thread cs" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1824 |
from hold obtain rest |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1825 |
where eq_wq: "wq s cs = thread # rest" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1826 |
by (case_tac "wq s cs", auto simp: wq_def s_holding_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1827 |
have eq_threads: "threads (e#s) = threads s" by (simp add: eq_e) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1828 |
have eq_set: "set (SOME q. distinct q \<and> set q = set rest) = set rest" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1829 |
proof(rule someI2) |
63 | 1830 |
from vt_v.wq_distinct[of cs] and eq_wq |
1831 |
show "distinct rest \<and> set rest = set rest" |
|
1832 |
by (metis distinct.simps(2) vt_s.wq_distinct) |
|
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1833 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1834 |
show "\<And>x. distinct x \<and> set x = set rest \<Longrightarrow> set x = set rest" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1835 |
by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1836 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1837 |
show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1838 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1839 |
{ assume eq_th: "th = thread" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1840 |
from eq_th have eq_cnp: "cntP (e # s) th = cntP s th" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1841 |
by (unfold eq_e, simp add:cntP_def count_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1842 |
moreover from eq_th have eq_cnv: "cntV (e#s) th = 1 + cntV s th" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1843 |
by (unfold eq_e, simp add:cntV_def count_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1844 |
moreover from cntCS_v_dec [OF vtv] |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1845 |
have "cntCS (e # s) thread + 1 = cntCS s thread" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1846 |
by (simp add:eq_e) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1847 |
moreover from is_runing have rd_before: "thread \<in> readys s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1848 |
by (unfold runing_def, simp) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1849 |
moreover have "thread \<in> readys (e # s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1850 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1851 |
from is_runing |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1852 |
have "thread \<in> threads (e#s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1853 |
by (unfold eq_e, auto simp:runing_def readys_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1854 |
moreover have "\<forall> cs1. \<not> waiting (e#s) thread cs1" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1855 |
proof |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1856 |
fix cs1 |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1857 |
{ assume eq_cs: "cs1 = cs" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1858 |
have "\<not> waiting (e # s) thread cs1" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1859 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1860 |
from eq_wq |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1861 |
have "thread \<notin> set (wq (e#s) cs1)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1862 |
apply(unfold eq_e wq_def eq_cs s_holding_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1863 |
apply (auto simp:Let_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1864 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1865 |
assume "thread \<in> set (SOME q. distinct q \<and> set q = set rest)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1866 |
with eq_set have "thread \<in> set rest" by simp |
63 | 1867 |
with vt_v.wq_distinct[of cs] |
1868 |
and eq_wq show False |
|
1869 |
by (metis distinct.simps(2) vt_s.wq_distinct) |
|
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1870 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1871 |
thus ?thesis by (simp add:wq_def s_waiting_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1872 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1873 |
} moreover { |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1874 |
assume neq_cs: "cs1 \<noteq> cs" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1875 |
have "\<not> waiting (e # s) thread cs1" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1876 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1877 |
from wq_v_neq [OF neq_cs[symmetric]] |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1878 |
have "wq (V thread cs # s) cs1 = wq s cs1" . |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1879 |
moreover have "\<not> waiting s thread cs1" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1880 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1881 |
from runing_ready and is_runing |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1882 |
have "thread \<in> readys s" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1883 |
thus ?thesis by (simp add:readys_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1884 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1885 |
ultimately show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1886 |
by (auto simp:wq_def s_waiting_def eq_e) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1887 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1888 |
} ultimately show "\<not> waiting (e # s) thread cs1" by blast |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1889 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1890 |
ultimately show ?thesis by (simp add:readys_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1891 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1892 |
moreover note eq_th ih |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1893 |
ultimately have ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1894 |
} moreover { |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1895 |
assume neq_th: "th \<noteq> thread" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1896 |
from neq_th eq_e have eq_cnp: "cntP (e # s) th = cntP s th" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1897 |
by (simp add:cntP_def count_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1898 |
from neq_th eq_e have eq_cnv: "cntV (e # s) th = cntV s th" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1899 |
by (simp add:cntV_def count_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1900 |
have ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1901 |
proof(cases "th \<in> set rest") |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1902 |
case False |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1903 |
have "(th \<in> readys (e # s)) = (th \<in> readys s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1904 |
apply (insert step_back_vt[OF vtv]) |
63 | 1905 |
by (simp add: False eq_e eq_wq neq_th vt_s.readys_v_eq) |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1906 |
moreover have "cntCS (e#s) th = cntCS s th" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1907 |
apply (insert neq_th, unfold eq_e cntCS_def holdents_test step_RAG_v[OF vtv], auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1908 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1909 |
have "{csa. (Cs csa, Th th) \<in> RAG s \<or> csa = cs \<and> next_th s thread cs th} = |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1910 |
{cs. (Cs cs, Th th) \<in> RAG s}" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1911 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1912 |
from False eq_wq |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1913 |
have " next_th s thread cs th \<Longrightarrow> (Cs cs, Th th) \<in> RAG s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1914 |
apply (unfold next_th_def, auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1915 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1916 |
assume ne: "rest \<noteq> []" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1917 |
and ni: "hd (SOME q. distinct q \<and> set q = set rest) \<notin> set rest" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1918 |
and eq_wq: "wq s cs = thread # rest" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1919 |
from eq_set ni have "hd (SOME q. distinct q \<and> set q = set rest) \<notin> |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1920 |
set (SOME q. distinct q \<and> set q = set rest) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1921 |
" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1922 |
moreover have "(SOME q. distinct q \<and> set q = set rest) \<noteq> []" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1923 |
proof(rule someI2) |
63 | 1924 |
from vt_s.wq_distinct[ of cs] and eq_wq |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1925 |
show "distinct rest \<and> set rest = set rest" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1926 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1927 |
fix x assume "distinct x \<and> set x = set rest" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1928 |
with ne show "x \<noteq> []" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1929 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1930 |
ultimately show |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1931 |
"(Cs cs, Th (hd (SOME q. distinct q \<and> set q = set rest))) \<in> RAG s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1932 |
by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1933 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1934 |
thus ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1935 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1936 |
thus "card {csa. (Cs csa, Th th) \<in> RAG s \<or> csa = cs \<and> next_th s thread cs th} = |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1937 |
card {cs. (Cs cs, Th th) \<in> RAG s}" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1938 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1939 |
moreover note ih eq_cnp eq_cnv eq_threads |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1940 |
ultimately show ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1941 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1942 |
case True |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1943 |
assume th_in: "th \<in> set rest" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1944 |
show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1945 |
proof(cases "next_th s thread cs th") |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1946 |
case False |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1947 |
with eq_wq and th_in have |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1948 |
neq_hd: "th \<noteq> hd (SOME q. distinct q \<and> set q = set rest)" (is "th \<noteq> hd ?rest") |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1949 |
by (auto simp:next_th_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1950 |
have "(th \<in> readys (e # s)) = (th \<in> readys s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1951 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1952 |
from eq_wq and th_in |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1953 |
have "\<not> th \<in> readys s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1954 |
apply (auto simp:readys_def s_waiting_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1955 |
apply (rule_tac x = cs in exI, auto) |
63 | 1956 |
by (insert vt_s.wq_distinct[of cs], auto simp add: wq_def) |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1957 |
moreover |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1958 |
from eq_wq and th_in and neq_hd |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1959 |
have "\<not> (th \<in> readys (e # s))" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1960 |
apply (auto simp:readys_def s_waiting_def eq_e wq_def Let_def split:list.splits) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1961 |
by (rule_tac x = cs in exI, auto simp:eq_set) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1962 |
ultimately show ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1963 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1964 |
moreover have "cntCS (e#s) th = cntCS s th" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1965 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1966 |
from eq_wq and th_in and neq_hd |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1967 |
have "(holdents (e # s) th) = (holdents s th)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1968 |
apply (unfold eq_e step_RAG_v[OF vtv], |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1969 |
auto simp:next_th_def eq_set s_RAG_def holdents_test wq_def |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1970 |
Let_def cs_holding_def) |
63 | 1971 |
by (insert vt_s.wq_distinct[of cs], auto simp:wq_def) |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1972 |
thus ?thesis by (simp add:cntCS_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1973 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1974 |
moreover note ih eq_cnp eq_cnv eq_threads |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1975 |
ultimately show ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1976 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1977 |
case True |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1978 |
let ?rest = " (SOME q. distinct q \<and> set q = set rest)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1979 |
let ?t = "hd ?rest" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1980 |
from True eq_wq th_in neq_th |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1981 |
have "th \<in> readys (e # s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1982 |
apply (auto simp:eq_e readys_def s_waiting_def wq_def |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1983 |
Let_def next_th_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1984 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1985 |
assume eq_wq: "wq_fun (schs s) cs = thread # rest" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1986 |
and t_in: "?t \<in> set rest" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1987 |
show "?t \<in> threads s" |
63 | 1988 |
proof(rule vt_s.wq_threads) |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1989 |
from eq_wq and t_in |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1990 |
show "?t \<in> set (wq s cs)" by (auto simp:wq_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1991 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1992 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1993 |
fix csa |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1994 |
assume eq_wq: "wq_fun (schs s) cs = thread # rest" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1995 |
and t_in: "?t \<in> set rest" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1996 |
and neq_cs: "csa \<noteq> cs" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1997 |
and t_in': "?t \<in> set (wq_fun (schs s) csa)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1998 |
show "?t = hd (wq_fun (schs s) csa)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
1999 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2000 |
{ assume neq_hd': "?t \<noteq> hd (wq_fun (schs s) csa)" |
63 | 2001 |
from vt_s.wq_distinct[of cs] and |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2002 |
eq_wq[folded wq_def] and t_in eq_wq |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2003 |
have "?t \<noteq> thread" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2004 |
with eq_wq and t_in |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2005 |
have w1: "waiting s ?t cs" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2006 |
by (auto simp:s_waiting_def wq_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2007 |
from t_in' neq_hd' |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2008 |
have w2: "waiting s ?t csa" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2009 |
by (auto simp:s_waiting_def wq_def) |
63 | 2010 |
from vt_s.waiting_unique[OF w1 w2] |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2011 |
and neq_cs have "False" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2012 |
} thus ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2013 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2014 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2015 |
moreover have "cntP s th = cntV s th + cntCS s th + 1" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2016 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2017 |
have "th \<notin> readys s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2018 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2019 |
from True eq_wq neq_th th_in |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2020 |
show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2021 |
apply (unfold readys_def s_waiting_def, auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2022 |
by (rule_tac x = cs in exI, auto simp add: wq_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2023 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2024 |
moreover have "th \<in> threads s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2025 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2026 |
from th_in eq_wq |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2027 |
have "th \<in> set (wq s cs)" by simp |
63 | 2028 |
from vt_s.wq_threads [OF this] |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2029 |
show ?thesis . |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2030 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2031 |
ultimately show ?thesis using ih by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2032 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2033 |
moreover from True neq_th have "cntCS (e # s) th = 1 + cntCS s th" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2034 |
apply (unfold cntCS_def holdents_test eq_e step_RAG_v[OF vtv], auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2035 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2036 |
show "card {csa. (Cs csa, Th th) \<in> RAG s \<or> csa = cs} = |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2037 |
Suc (card {cs. (Cs cs, Th th) \<in> RAG s})" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2038 |
(is "card ?A = Suc (card ?B)") |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2039 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2040 |
have "?A = insert cs ?B" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2041 |
hence "card ?A = card (insert cs ?B)" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2042 |
also have "\<dots> = Suc (card ?B)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2043 |
proof(rule card_insert_disjoint) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2044 |
have "?B \<subseteq> ((\<lambda> (x, y). the_cs x) ` RAG s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2045 |
apply (auto simp:image_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2046 |
by (rule_tac x = "(Cs x, Th th)" in bexI, auto) |
63 | 2047 |
with vt_s.finite_RAG |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2048 |
show "finite {cs. (Cs cs, Th th) \<in> RAG s}" by (auto intro:finite_subset) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2049 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2050 |
show "cs \<notin> {cs. (Cs cs, Th th) \<in> RAG s}" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2051 |
proof |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2052 |
assume "cs \<in> {cs. (Cs cs, Th th) \<in> RAG s}" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2053 |
hence "(Cs cs, Th th) \<in> RAG s" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2054 |
with True neq_th eq_wq show False |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2055 |
by (auto simp:next_th_def s_RAG_def cs_holding_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2056 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2057 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2058 |
finally show ?thesis . |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2059 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2060 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2061 |
moreover note eq_cnp eq_cnv |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2062 |
ultimately show ?thesis by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2063 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2064 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2065 |
} ultimately show ?thesis by blast |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2066 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2067 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2068 |
case (thread_set thread prio) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2069 |
assume eq_e: "e = Set thread prio" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2070 |
and is_runing: "thread \<in> runing s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2071 |
show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2072 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2073 |
from eq_e have eq_cnp: "cntP (e#s) th = cntP s th" by (simp add:cntP_def count_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2074 |
from eq_e have eq_cnv: "cntV (e#s) th = cntV s th" by (simp add:cntV_def count_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2075 |
have eq_cncs: "cntCS (e#s) th = cntCS s th" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2076 |
unfolding cntCS_def holdents_test |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2077 |
by (simp add:RAG_set_unchanged eq_e) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2078 |
from eq_e have eq_readys: "readys (e#s) = readys s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2079 |
by (simp add:readys_def cs_waiting_def s_waiting_def wq_def, |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2080 |
auto simp:Let_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2081 |
{ assume "th \<noteq> thread" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2082 |
with eq_readys eq_e |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2083 |
have "(th \<in> readys (e # s) \<or> th \<notin> threads (e # s)) = |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2084 |
(th \<in> readys (s) \<or> th \<notin> threads (s))" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2085 |
by (simp add:threads.simps) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2086 |
with eq_cnp eq_cnv eq_cncs ih is_runing |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2087 |
have ?thesis by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2088 |
} moreover { |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2089 |
assume eq_th: "th = thread" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2090 |
with is_runing ih have " cntP s th = cntV s th + cntCS s th" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2091 |
by (unfold runing_def, auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2092 |
moreover from eq_th and eq_readys is_runing have "th \<in> readys (e#s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2093 |
by (simp add:runing_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2094 |
moreover note eq_cnp eq_cnv eq_cncs |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2095 |
ultimately have ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2096 |
} ultimately show ?thesis by blast |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2097 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2098 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2099 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2100 |
case vt_nil |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2101 |
show ?case |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2102 |
by (unfold cntP_def cntV_def cntCS_def, |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2103 |
auto simp:count_def holdents_test s_RAG_def wq_def cs_holding_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2104 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2105 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2106 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2107 |
lemma not_thread_cncs: |
63 | 2108 |
assumes not_in: "th \<notin> threads s" |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2109 |
shows "cntCS s th = 0" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2110 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2111 |
from vt not_in show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2112 |
proof(induct arbitrary:th) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2113 |
case (vt_cons s e th) |
63 | 2114 |
interpret vt_s: valid_trace s using vt_cons(1) |
2115 |
by (unfold_locales, simp) |
|
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2116 |
assume vt: "vt s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2117 |
and ih: "\<And>th. th \<notin> threads s \<Longrightarrow> cntCS s th = 0" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2118 |
and stp: "step s e" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2119 |
and not_in: "th \<notin> threads (e # s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2120 |
from stp show ?case |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2121 |
proof(cases) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2122 |
case (thread_create thread prio) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2123 |
assume eq_e: "e = Create thread prio" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2124 |
and not_in': "thread \<notin> threads s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2125 |
have "cntCS (e # s) th = cntCS s th" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2126 |
apply (unfold eq_e cntCS_def holdents_test) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2127 |
by (simp add:RAG_create_unchanged) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2128 |
moreover have "th \<notin> threads s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2129 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2130 |
from not_in eq_e show ?thesis by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2131 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2132 |
moreover note ih ultimately show ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2133 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2134 |
case (thread_exit thread) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2135 |
assume eq_e: "e = Exit thread" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2136 |
and nh: "holdents s thread = {}" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2137 |
have eq_cns: "cntCS (e # s) th = cntCS s th" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2138 |
apply (unfold eq_e cntCS_def holdents_test) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2139 |
by (simp add:RAG_exit_unchanged) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2140 |
show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2141 |
proof(cases "th = thread") |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2142 |
case True |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2143 |
have "cntCS s th = 0" by (unfold cntCS_def, auto simp:nh True) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2144 |
with eq_cns show ?thesis by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2145 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2146 |
case False |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2147 |
with not_in and eq_e |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2148 |
have "th \<notin> threads s" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2149 |
from ih[OF this] and eq_cns show ?thesis by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2150 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2151 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2152 |
case (thread_P thread cs) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2153 |
assume eq_e: "e = P thread cs" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2154 |
and is_runing: "thread \<in> runing s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2155 |
from assms thread_P ih vt stp thread_P have vtp: "vt (P thread cs#s)" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2156 |
have neq_th: "th \<noteq> thread" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2157 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2158 |
from not_in eq_e have "th \<notin> threads s" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2159 |
moreover from is_runing have "thread \<in> threads s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2160 |
by (simp add:runing_def readys_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2161 |
ultimately show ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2162 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2163 |
hence "cntCS (e # s) th = cntCS s th " |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2164 |
apply (unfold cntCS_def holdents_test eq_e) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2165 |
by (unfold step_RAG_p[OF vtp], auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2166 |
moreover have "cntCS s th = 0" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2167 |
proof(rule ih) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2168 |
from not_in eq_e show "th \<notin> threads s" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2169 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2170 |
ultimately show ?thesis by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2171 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2172 |
case (thread_V thread cs) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2173 |
assume eq_e: "e = V thread cs" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2174 |
and is_runing: "thread \<in> runing s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2175 |
and hold: "holding s thread cs" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2176 |
have neq_th: "th \<noteq> thread" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2177 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2178 |
from not_in eq_e have "th \<notin> threads s" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2179 |
moreover from is_runing have "thread \<in> threads s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2180 |
by (simp add:runing_def readys_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2181 |
ultimately show ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2182 |
qed |
63 | 2183 |
from assms thread_V vt stp ih |
2184 |
have vtv: "vt (V thread cs#s)" by auto |
|
2185 |
then interpret vt_v: valid_trace "(V thread cs#s)" |
|
2186 |
by (unfold_locales, simp) |
|
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2187 |
from hold obtain rest |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2188 |
where eq_wq: "wq s cs = thread # rest" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2189 |
by (case_tac "wq s cs", auto simp: wq_def s_holding_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2190 |
from not_in eq_e eq_wq |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2191 |
have "\<not> next_th s thread cs th" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2192 |
apply (auto simp:next_th_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2193 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2194 |
assume ne: "rest \<noteq> []" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2195 |
and ni: "hd (SOME q. distinct q \<and> set q = set rest) \<notin> threads s" (is "?t \<notin> threads s") |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2196 |
have "?t \<in> set rest" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2197 |
proof(rule someI2) |
63 | 2198 |
from vt_v.wq_distinct[of cs] and eq_wq |
2199 |
show "distinct rest \<and> set rest = set rest" |
|
2200 |
by (metis distinct.simps(2) vt_s.wq_distinct) |
|
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2201 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2202 |
fix x assume "distinct x \<and> set x = set rest" with ne |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2203 |
show "hd x \<in> set rest" by (cases x, auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2204 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2205 |
with eq_wq have "?t \<in> set (wq s cs)" by simp |
63 | 2206 |
from vt_s.wq_threads[OF this] and ni |
2207 |
show False |
|
2208 |
using `hd (SOME q. distinct q \<and> set q = set rest) \<in> set (wq s cs)` |
|
2209 |
ni vt_s.wq_threads by blast |
|
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2210 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2211 |
moreover note neq_th eq_wq |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2212 |
ultimately have "cntCS (e # s) th = cntCS s th" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2213 |
by (unfold eq_e cntCS_def holdents_test step_RAG_v[OF vtv], auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2214 |
moreover have "cntCS s th = 0" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2215 |
proof(rule ih) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2216 |
from not_in eq_e show "th \<notin> threads s" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2217 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2218 |
ultimately show ?thesis by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2219 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2220 |
case (thread_set thread prio) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2221 |
print_facts |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2222 |
assume eq_e: "e = Set thread prio" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2223 |
and is_runing: "thread \<in> runing s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2224 |
from not_in and eq_e have "th \<notin> threads s" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2225 |
from ih [OF this] and eq_e |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2226 |
show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2227 |
apply (unfold eq_e cntCS_def holdents_test) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2228 |
by (simp add:RAG_set_unchanged) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2229 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2230 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2231 |
case vt_nil |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2232 |
show ?case |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2233 |
by (unfold cntCS_def, |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2234 |
auto simp:count_def holdents_test s_RAG_def wq_def cs_holding_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2235 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2236 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2237 |
|
63 | 2238 |
end |
2239 |
||
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2240 |
lemma eq_waiting: "waiting (wq (s::state)) th cs = waiting s th cs" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2241 |
by (auto simp:s_waiting_def cs_waiting_def wq_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2242 |
|
63 | 2243 |
context valid_trace |
2244 |
begin |
|
2245 |
||
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2246 |
lemma dm_RAG_threads: |
63 | 2247 |
assumes in_dom: "(Th th) \<in> Domain (RAG s)" |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2248 |
shows "th \<in> threads s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2249 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2250 |
from in_dom obtain n where "(Th th, n) \<in> RAG s" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2251 |
moreover from RAG_target_th[OF this] obtain cs where "n = Cs cs" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2252 |
ultimately have "(Th th, Cs cs) \<in> RAG s" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2253 |
hence "th \<in> set (wq s cs)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2254 |
by (unfold s_RAG_def, auto simp:cs_waiting_def) |
63 | 2255 |
from wq_threads [OF this] show ?thesis . |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2256 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2257 |
|
63 | 2258 |
end |
2259 |
||
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2260 |
lemma cp_eq_cpreced: "cp s th = cpreced (wq s) s th" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2261 |
unfolding cp_def wq_def |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2262 |
apply(induct s rule: schs.induct) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2263 |
thm cpreced_initial |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2264 |
apply(simp add: Let_def cpreced_initial) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2265 |
apply(simp add: Let_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2266 |
apply(simp add: Let_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2267 |
apply(simp add: Let_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2268 |
apply(subst (2) schs.simps) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2269 |
apply(simp add: Let_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2270 |
apply(subst (2) schs.simps) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2271 |
apply(simp add: Let_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2272 |
done |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2273 |
|
63 | 2274 |
context valid_trace |
2275 |
begin |
|
2276 |
||
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2277 |
lemma runing_unique: |
63 | 2278 |
assumes runing_1: "th1 \<in> runing s" |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2279 |
and runing_2: "th2 \<in> runing s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2280 |
shows "th1 = th2" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2281 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2282 |
from runing_1 and runing_2 have "cp s th1 = cp s th2" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2283 |
unfolding runing_def |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2284 |
apply(simp) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2285 |
done |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2286 |
hence eq_max: "Max ((\<lambda>th. preced th s) ` ({th1} \<union> dependants (wq s) th1)) = |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2287 |
Max ((\<lambda>th. preced th s) ` ({th2} \<union> dependants (wq s) th2))" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2288 |
(is "Max (?f ` ?A) = Max (?f ` ?B)") |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2289 |
unfolding cp_eq_cpreced |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2290 |
unfolding cpreced_def . |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2291 |
obtain th1' where th1_in: "th1' \<in> ?A" and eq_f_th1: "?f th1' = Max (?f ` ?A)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2292 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2293 |
have h1: "finite (?f ` ?A)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2294 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2295 |
have "finite ?A" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2296 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2297 |
have "finite (dependants (wq s) th1)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2298 |
proof- |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2299 |
have "finite {th'. (Th th', Th th1) \<in> (RAG (wq s))\<^sup>+}" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2300 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2301 |
let ?F = "\<lambda> (x, y). the_th x" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2302 |
have "{th'. (Th th', Th th1) \<in> (RAG (wq s))\<^sup>+} \<subseteq> ?F ` ((RAG (wq s))\<^sup>+)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2303 |
apply (auto simp:image_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2304 |
by (rule_tac x = "(Th x, Th th1)" in bexI, auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2305 |
moreover have "finite \<dots>" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2306 |
proof - |
63 | 2307 |
from finite_RAG have "finite (RAG s)" . |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2308 |
hence "finite ((RAG (wq s))\<^sup>+)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2309 |
apply (unfold finite_trancl) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2310 |
by (auto simp: s_RAG_def cs_RAG_def wq_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2311 |
thus ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2312 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2313 |
ultimately show ?thesis by (auto intro:finite_subset) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2314 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2315 |
thus ?thesis by (simp add:cs_dependants_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2316 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2317 |
thus ?thesis by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2318 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2319 |
thus ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2320 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2321 |
moreover have h2: "(?f ` ?A) \<noteq> {}" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2322 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2323 |
have "?A \<noteq> {}" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2324 |
thus ?thesis by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2325 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2326 |
from Max_in [OF h1 h2] |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2327 |
have "Max (?f ` ?A) \<in> (?f ` ?A)" . |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2328 |
thus ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2329 |
thm cpreced_def |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2330 |
unfolding cpreced_def[symmetric] |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2331 |
unfolding cp_eq_cpreced[symmetric] |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2332 |
unfolding cpreced_def |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2333 |
using that[intro] by (auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2334 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2335 |
obtain th2' where th2_in: "th2' \<in> ?B" and eq_f_th2: "?f th2' = Max (?f ` ?B)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2336 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2337 |
have h1: "finite (?f ` ?B)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2338 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2339 |
have "finite ?B" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2340 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2341 |
have "finite (dependants (wq s) th2)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2342 |
proof- |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2343 |
have "finite {th'. (Th th', Th th2) \<in> (RAG (wq s))\<^sup>+}" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2344 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2345 |
let ?F = "\<lambda> (x, y). the_th x" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2346 |
have "{th'. (Th th', Th th2) \<in> (RAG (wq s))\<^sup>+} \<subseteq> ?F ` ((RAG (wq s))\<^sup>+)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2347 |
apply (auto simp:image_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2348 |
by (rule_tac x = "(Th x, Th th2)" in bexI, auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2349 |
moreover have "finite \<dots>" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2350 |
proof - |
63 | 2351 |
from finite_RAG have "finite (RAG s)" . |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2352 |
hence "finite ((RAG (wq s))\<^sup>+)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2353 |
apply (unfold finite_trancl) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2354 |
by (auto simp: s_RAG_def cs_RAG_def wq_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2355 |
thus ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2356 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2357 |
ultimately show ?thesis by (auto intro:finite_subset) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2358 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2359 |
thus ?thesis by (simp add:cs_dependants_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2360 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2361 |
thus ?thesis by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2362 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2363 |
thus ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2364 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2365 |
moreover have h2: "(?f ` ?B) \<noteq> {}" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2366 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2367 |
have "?B \<noteq> {}" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2368 |
thus ?thesis by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2369 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2370 |
from Max_in [OF h1 h2] |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2371 |
have "Max (?f ` ?B) \<in> (?f ` ?B)" . |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2372 |
thus ?thesis by (auto intro:that) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2373 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2374 |
from eq_f_th1 eq_f_th2 eq_max |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2375 |
have eq_preced: "preced th1' s = preced th2' s" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2376 |
hence eq_th12: "th1' = th2'" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2377 |
proof (rule preced_unique) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2378 |
from th1_in have "th1' = th1 \<or> (th1' \<in> dependants (wq s) th1)" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2379 |
thus "th1' \<in> threads s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2380 |
proof |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2381 |
assume "th1' \<in> dependants (wq s) th1" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2382 |
hence "(Th th1') \<in> Domain ((RAG s)^+)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2383 |
apply (unfold cs_dependants_def cs_RAG_def s_RAG_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2384 |
by (auto simp:Domain_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2385 |
hence "(Th th1') \<in> Domain (RAG s)" by (simp add:trancl_domain) |
63 | 2386 |
from dm_RAG_threads[OF this] show ?thesis . |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2387 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2388 |
assume "th1' = th1" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2389 |
with runing_1 show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2390 |
by (unfold runing_def readys_def, auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2391 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2392 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2393 |
from th2_in have "th2' = th2 \<or> (th2' \<in> dependants (wq s) th2)" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2394 |
thus "th2' \<in> threads s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2395 |
proof |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2396 |
assume "th2' \<in> dependants (wq s) th2" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2397 |
hence "(Th th2') \<in> Domain ((RAG s)^+)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2398 |
apply (unfold cs_dependants_def cs_RAG_def s_RAG_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2399 |
by (auto simp:Domain_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2400 |
hence "(Th th2') \<in> Domain (RAG s)" by (simp add:trancl_domain) |
63 | 2401 |
from dm_RAG_threads[OF this] show ?thesis . |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2402 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2403 |
assume "th2' = th2" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2404 |
with runing_2 show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2405 |
by (unfold runing_def readys_def, auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2406 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2407 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2408 |
from th1_in have "th1' = th1 \<or> th1' \<in> dependants (wq s) th1" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2409 |
thus ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2410 |
proof |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2411 |
assume eq_th': "th1' = th1" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2412 |
from th2_in have "th2' = th2 \<or> th2' \<in> dependants (wq s) th2" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2413 |
thus ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2414 |
proof |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2415 |
assume "th2' = th2" thus ?thesis using eq_th' eq_th12 by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2416 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2417 |
assume "th2' \<in> dependants (wq s) th2" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2418 |
with eq_th12 eq_th' have "th1 \<in> dependants (wq s) th2" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2419 |
hence "(Th th1, Th th2) \<in> (RAG s)^+" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2420 |
by (unfold cs_dependants_def s_RAG_def cs_RAG_def, simp) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2421 |
hence "Th th1 \<in> Domain ((RAG s)^+)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2422 |
apply (unfold cs_dependants_def cs_RAG_def s_RAG_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2423 |
by (auto simp:Domain_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2424 |
hence "Th th1 \<in> Domain (RAG s)" by (simp add:trancl_domain) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2425 |
then obtain n where d: "(Th th1, n) \<in> RAG s" by (auto simp:Domain_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2426 |
from RAG_target_th [OF this] |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2427 |
obtain cs' where "n = Cs cs'" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2428 |
with d have "(Th th1, Cs cs') \<in> RAG s" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2429 |
with runing_1 have "False" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2430 |
apply (unfold runing_def readys_def s_RAG_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2431 |
by (auto simp:eq_waiting) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2432 |
thus ?thesis by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2433 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2434 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2435 |
assume th1'_in: "th1' \<in> dependants (wq s) th1" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2436 |
from th2_in have "th2' = th2 \<or> th2' \<in> dependants (wq s) th2" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2437 |
thus ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2438 |
proof |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2439 |
assume "th2' = th2" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2440 |
with th1'_in eq_th12 have "th2 \<in> dependants (wq s) th1" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2441 |
hence "(Th th2, Th th1) \<in> (RAG s)^+" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2442 |
by (unfold cs_dependants_def s_RAG_def cs_RAG_def, simp) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2443 |
hence "Th th2 \<in> Domain ((RAG s)^+)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2444 |
apply (unfold cs_dependants_def cs_RAG_def s_RAG_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2445 |
by (auto simp:Domain_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2446 |
hence "Th th2 \<in> Domain (RAG s)" by (simp add:trancl_domain) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2447 |
then obtain n where d: "(Th th2, n) \<in> RAG s" by (auto simp:Domain_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2448 |
from RAG_target_th [OF this] |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2449 |
obtain cs' where "n = Cs cs'" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2450 |
with d have "(Th th2, Cs cs') \<in> RAG s" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2451 |
with runing_2 have "False" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2452 |
apply (unfold runing_def readys_def s_RAG_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2453 |
by (auto simp:eq_waiting) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2454 |
thus ?thesis by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2455 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2456 |
assume "th2' \<in> dependants (wq s) th2" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2457 |
with eq_th12 have "th1' \<in> dependants (wq s) th2" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2458 |
hence h1: "(Th th1', Th th2) \<in> (RAG s)^+" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2459 |
by (unfold cs_dependants_def s_RAG_def cs_RAG_def, simp) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2460 |
from th1'_in have h2: "(Th th1', Th th1) \<in> (RAG s)^+" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2461 |
by (unfold cs_dependants_def s_RAG_def cs_RAG_def, simp) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2462 |
show ?thesis |
63 | 2463 |
proof(rule dchain_unique[OF h1 _ h2, symmetric]) |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2464 |
from runing_1 show "th1 \<in> readys s" by (simp add:runing_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2465 |
from runing_2 show "th2 \<in> readys s" by (simp add:runing_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2466 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2467 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2468 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2469 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2470 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2471 |
|
63 | 2472 |
lemma "card (runing s) \<le> 1" |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2473 |
apply(subgoal_tac "finite (runing s)") |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2474 |
prefer 2 |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2475 |
apply (metis finite_nat_set_iff_bounded lessI runing_unique) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2476 |
apply(rule ccontr) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2477 |
apply(simp) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2478 |
apply(case_tac "Suc (Suc 0) \<le> card (runing s)") |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2479 |
apply(subst (asm) card_le_Suc_iff) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2480 |
apply(simp) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2481 |
apply(auto)[1] |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2482 |
apply (metis insertCI runing_unique) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2483 |
apply(auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2484 |
done |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2485 |
|
63 | 2486 |
end |
2487 |
||
2488 |
||
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2489 |
lemma create_pre: |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2490 |
assumes stp: "step s e" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2491 |
and not_in: "th \<notin> threads s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2492 |
and is_in: "th \<in> threads (e#s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2493 |
obtains prio where "e = Create th prio" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2494 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2495 |
from assms |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2496 |
show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2497 |
proof(cases) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2498 |
case (thread_create thread prio) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2499 |
with is_in not_in have "e = Create th prio" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2500 |
from that[OF this] show ?thesis . |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2501 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2502 |
case (thread_exit thread) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2503 |
with assms show ?thesis by (auto intro!:that) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2504 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2505 |
case (thread_P thread) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2506 |
with assms show ?thesis by (auto intro!:that) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2507 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2508 |
case (thread_V thread) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2509 |
with assms show ?thesis by (auto intro!:that) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2510 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2511 |
case (thread_set thread) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2512 |
with assms show ?thesis by (auto intro!:that) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2513 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2514 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2515 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2516 |
lemma length_down_to_in: |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2517 |
assumes le_ij: "i \<le> j" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2518 |
and le_js: "j \<le> length s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2519 |
shows "length (down_to j i s) = j - i" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2520 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2521 |
have "length (down_to j i s) = length (from_to i j (rev s))" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2522 |
by (unfold down_to_def, auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2523 |
also have "\<dots> = j - i" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2524 |
proof(rule length_from_to_in[OF le_ij]) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2525 |
from le_js show "j \<le> length (rev s)" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2526 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2527 |
finally show ?thesis . |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2528 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2529 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2530 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2531 |
lemma moment_head: |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2532 |
assumes le_it: "Suc i \<le> length t" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2533 |
obtains e where "moment (Suc i) t = e#moment i t" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2534 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2535 |
have "i \<le> Suc i" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2536 |
from length_down_to_in [OF this le_it] |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2537 |
have "length (down_to (Suc i) i t) = 1" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2538 |
then obtain e where "down_to (Suc i) i t = [e]" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2539 |
apply (cases "(down_to (Suc i) i t)") by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2540 |
moreover have "down_to (Suc i) 0 t = down_to (Suc i) i t @ down_to i 0 t" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2541 |
by (rule down_to_conc[symmetric], auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2542 |
ultimately have eq_me: "moment (Suc i) t = e#(moment i t)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2543 |
by (auto simp:down_to_moment) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2544 |
from that [OF this] show ?thesis . |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2545 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2546 |
|
63 | 2547 |
context valid_trace |
2548 |
begin |
|
2549 |
||
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2550 |
lemma cnp_cnv_eq: |
63 | 2551 |
assumes "th \<notin> threads s" |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2552 |
shows "cntP s th = cntV s th" |
63 | 2553 |
using assms |
2554 |
using cnp_cnv_cncs not_thread_cncs by auto |
|
2555 |
||
2556 |
end |
|
2557 |
||
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2558 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2559 |
lemma eq_RAG: |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2560 |
"RAG (wq s) = RAG s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2561 |
by (unfold cs_RAG_def s_RAG_def, auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2562 |
|
63 | 2563 |
context valid_trace |
2564 |
begin |
|
2565 |
||
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2566 |
lemma count_eq_dependants: |
63 | 2567 |
assumes eq_pv: "cntP s th = cntV s th" |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2568 |
shows "dependants (wq s) th = {}" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2569 |
proof - |
63 | 2570 |
from cnp_cnv_cncs and eq_pv |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2571 |
have "cntCS s th = 0" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2572 |
by (auto split:if_splits) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2573 |
moreover have "finite {cs. (Cs cs, Th th) \<in> RAG s}" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2574 |
proof - |
63 | 2575 |
from finite_holding[of th] show ?thesis |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2576 |
by (simp add:holdents_test) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2577 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2578 |
ultimately have h: "{cs. (Cs cs, Th th) \<in> RAG s} = {}" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2579 |
by (unfold cntCS_def holdents_test cs_dependants_def, auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2580 |
show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2581 |
proof(unfold cs_dependants_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2582 |
{ assume "{th'. (Th th', Th th) \<in> (RAG (wq s))\<^sup>+} \<noteq> {}" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2583 |
then obtain th' where "(Th th', Th th) \<in> (RAG (wq s))\<^sup>+" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2584 |
hence "False" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2585 |
proof(cases) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2586 |
assume "(Th th', Th th) \<in> RAG (wq s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2587 |
thus "False" by (auto simp:cs_RAG_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2588 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2589 |
fix c |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2590 |
assume "(c, Th th) \<in> RAG (wq s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2591 |
with h and eq_RAG show "False" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2592 |
by (cases c, auto simp:cs_RAG_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2593 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2594 |
} thus "{th'. (Th th', Th th) \<in> (RAG (wq s))\<^sup>+} = {}" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2595 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2596 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2597 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2598 |
lemma dependants_threads: |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2599 |
shows "dependants (wq s) th \<subseteq> threads s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2600 |
proof |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2601 |
{ fix th th' |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2602 |
assume h: "th \<in> {th'a. (Th th'a, Th th') \<in> (RAG (wq s))\<^sup>+}" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2603 |
have "Th th \<in> Domain (RAG s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2604 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2605 |
from h obtain th' where "(Th th, Th th') \<in> (RAG (wq s))\<^sup>+" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2606 |
hence "(Th th) \<in> Domain ( (RAG (wq s))\<^sup>+)" by (auto simp:Domain_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2607 |
with trancl_domain have "(Th th) \<in> Domain (RAG (wq s))" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2608 |
thus ?thesis using eq_RAG by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2609 |
qed |
63 | 2610 |
from dm_RAG_threads[OF this] |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2611 |
have "th \<in> threads s" . |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2612 |
} note hh = this |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2613 |
fix th1 |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2614 |
assume "th1 \<in> dependants (wq s) th" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2615 |
hence "th1 \<in> {th'a. (Th th'a, Th th) \<in> (RAG (wq s))\<^sup>+}" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2616 |
by (unfold cs_dependants_def, simp) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2617 |
from hh [OF this] show "th1 \<in> threads s" . |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2618 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2619 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2620 |
lemma finite_threads: |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2621 |
shows "finite (threads s)" |
63 | 2622 |
using vt by (induct) (auto elim: step.cases) |
2623 |
||
2624 |
end |
|
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2625 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2626 |
lemma Max_f_mono: |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2627 |
assumes seq: "A \<subseteq> B" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2628 |
and np: "A \<noteq> {}" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2629 |
and fnt: "finite B" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2630 |
shows "Max (f ` A) \<le> Max (f ` B)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2631 |
proof(rule Max_mono) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2632 |
from seq show "f ` A \<subseteq> f ` B" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2633 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2634 |
from np show "f ` A \<noteq> {}" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2635 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2636 |
from fnt and seq show "finite (f ` B)" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2637 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2638 |
|
63 | 2639 |
context valid_trace |
2640 |
begin |
|
2641 |
||
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2642 |
lemma cp_le: |
63 | 2643 |
assumes th_in: "th \<in> threads s" |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2644 |
shows "cp s th \<le> Max ((\<lambda> th. (preced th s)) ` threads s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2645 |
proof(unfold cp_eq_cpreced cpreced_def cs_dependants_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2646 |
show "Max ((\<lambda>th. preced th s) ` ({th} \<union> {th'. (Th th', Th th) \<in> (RAG (wq s))\<^sup>+})) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2647 |
\<le> Max ((\<lambda>th. preced th s) ` threads s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2648 |
(is "Max (?f ` ?A) \<le> Max (?f ` ?B)") |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2649 |
proof(rule Max_f_mono) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2650 |
show "{th} \<union> {th'. (Th th', Th th) \<in> (RAG (wq s))\<^sup>+} \<noteq> {}" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2651 |
next |
63 | 2652 |
from finite_threads |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2653 |
show "finite (threads s)" . |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2654 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2655 |
from th_in |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2656 |
show "{th} \<union> {th'. (Th th', Th th) \<in> (RAG (wq s))\<^sup>+} \<subseteq> threads s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2657 |
apply (auto simp:Domain_def) |
63 | 2658 |
apply (rule_tac dm_RAG_threads) |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2659 |
apply (unfold trancl_domain [of "RAG s", symmetric]) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2660 |
by (unfold cs_RAG_def s_RAG_def, auto simp:Domain_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2661 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2662 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2663 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2664 |
lemma le_cp: |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2665 |
shows "preced th s \<le> cp s th" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2666 |
proof(unfold cp_eq_cpreced preced_def cpreced_def, simp) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2667 |
show "Prc (priority th s) (last_set th s) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2668 |
\<le> Max (insert (Prc (priority th s) (last_set th s)) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2669 |
((\<lambda>th. Prc (priority th s) (last_set th s)) ` dependants (wq s) th))" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2670 |
(is "?l \<le> Max (insert ?l ?A)") |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2671 |
proof(cases "?A = {}") |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2672 |
case False |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2673 |
have "finite ?A" (is "finite (?f ` ?B)") |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2674 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2675 |
have "finite ?B" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2676 |
proof- |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2677 |
have "finite {th'. (Th th', Th th) \<in> (RAG (wq s))\<^sup>+}" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2678 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2679 |
let ?F = "\<lambda> (x, y). the_th x" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2680 |
have "{th'. (Th th', Th th) \<in> (RAG (wq s))\<^sup>+} \<subseteq> ?F ` ((RAG (wq s))\<^sup>+)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2681 |
apply (auto simp:image_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2682 |
by (rule_tac x = "(Th x, Th th)" in bexI, auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2683 |
moreover have "finite \<dots>" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2684 |
proof - |
63 | 2685 |
from finite_RAG have "finite (RAG s)" . |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2686 |
hence "finite ((RAG (wq s))\<^sup>+)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2687 |
apply (unfold finite_trancl) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2688 |
by (auto simp: s_RAG_def cs_RAG_def wq_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2689 |
thus ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2690 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2691 |
ultimately show ?thesis by (auto intro:finite_subset) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2692 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2693 |
thus ?thesis by (simp add:cs_dependants_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2694 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2695 |
thus ?thesis by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2696 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2697 |
from Max_insert [OF this False, of ?l] show ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2698 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2699 |
case True |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2700 |
thus ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2701 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2702 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2703 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2704 |
lemma max_cp_eq: |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2705 |
shows "Max ((cp s) ` threads s) = Max ((\<lambda> th. (preced th s)) ` threads s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2706 |
(is "?l = ?r") |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2707 |
proof(cases "threads s = {}") |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2708 |
case True |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2709 |
thus ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2710 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2711 |
case False |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2712 |
have "?l \<in> ((cp s) ` threads s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2713 |
proof(rule Max_in) |
63 | 2714 |
from finite_threads |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2715 |
show "finite (cp s ` threads s)" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2716 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2717 |
from False show "cp s ` threads s \<noteq> {}" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2718 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2719 |
then obtain th |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2720 |
where th_in: "th \<in> threads s" and eq_l: "?l = cp s th" by auto |
63 | 2721 |
have "\<dots> \<le> ?r" by (rule cp_le[OF th_in]) |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2722 |
moreover have "?r \<le> cp s th" (is "Max (?f ` ?A) \<le> cp s th") |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2723 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2724 |
have "?r \<in> (?f ` ?A)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2725 |
proof(rule Max_in) |
63 | 2726 |
from finite_threads |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2727 |
show " finite ((\<lambda>th. preced th s) ` threads s)" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2728 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2729 |
from False show " (\<lambda>th. preced th s) ` threads s \<noteq> {}" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2730 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2731 |
then obtain th' where |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2732 |
th_in': "th' \<in> ?A " and eq_r: "?r = ?f th'" by auto |
63 | 2733 |
from le_cp [of th'] eq_r |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2734 |
have "?r \<le> cp s th'" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2735 |
moreover have "\<dots> \<le> cp s th" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2736 |
proof(fold eq_l) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2737 |
show " cp s th' \<le> Max (cp s ` threads s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2738 |
proof(rule Max_ge) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2739 |
from th_in' show "cp s th' \<in> cp s ` threads s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2740 |
by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2741 |
next |
63 | 2742 |
from finite_threads |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2743 |
show "finite (cp s ` threads s)" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2744 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2745 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2746 |
ultimately show ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2747 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2748 |
ultimately show ?thesis using eq_l by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2749 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2750 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2751 |
lemma max_cp_readys_threads_pre: |
63 | 2752 |
assumes np: "threads s \<noteq> {}" |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2753 |
shows "Max (cp s ` readys s) = Max (cp s ` threads s)" |
63 | 2754 |
proof(unfold max_cp_eq) |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2755 |
show "Max (cp s ` readys s) = Max ((\<lambda>th. preced th s) ` threads s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2756 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2757 |
let ?p = "Max ((\<lambda>th. preced th s) ` threads s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2758 |
let ?f = "(\<lambda>th. preced th s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2759 |
have "?p \<in> ((\<lambda>th. preced th s) ` threads s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2760 |
proof(rule Max_in) |
63 | 2761 |
from finite_threads show "finite (?f ` threads s)" by simp |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2762 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2763 |
from np show "?f ` threads s \<noteq> {}" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2764 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2765 |
then obtain tm where tm_max: "?f tm = ?p" and tm_in: "tm \<in> threads s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2766 |
by (auto simp:Image_def) |
63 | 2767 |
from th_chain_to_ready [OF tm_in] |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2768 |
have "tm \<in> readys s \<or> (\<exists>th'. th' \<in> readys s \<and> (Th tm, Th th') \<in> (RAG s)\<^sup>+)" . |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2769 |
thus ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2770 |
proof |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2771 |
assume "\<exists>th'. th' \<in> readys s \<and> (Th tm, Th th') \<in> (RAG s)\<^sup>+ " |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2772 |
then obtain th' where th'_in: "th' \<in> readys s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2773 |
and tm_chain:"(Th tm, Th th') \<in> (RAG s)\<^sup>+" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2774 |
have "cp s th' = ?f tm" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2775 |
proof(subst cp_eq_cpreced, subst cpreced_def, rule Max_eqI) |
63 | 2776 |
from dependants_threads finite_threads |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2777 |
show "finite ((\<lambda>th. preced th s) ` ({th'} \<union> dependants (wq s) th'))" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2778 |
by (auto intro:finite_subset) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2779 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2780 |
fix p assume p_in: "p \<in> (\<lambda>th. preced th s) ` ({th'} \<union> dependants (wq s) th')" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2781 |
from tm_max have " preced tm s = Max ((\<lambda>th. preced th s) ` threads s)" . |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2782 |
moreover have "p \<le> \<dots>" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2783 |
proof(rule Max_ge) |
63 | 2784 |
from finite_threads |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2785 |
show "finite ((\<lambda>th. preced th s) ` threads s)" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2786 |
next |
63 | 2787 |
from p_in and th'_in and dependants_threads[of th'] |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2788 |
show "p \<in> (\<lambda>th. preced th s) ` threads s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2789 |
by (auto simp:readys_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2790 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2791 |
ultimately show "p \<le> preced tm s" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2792 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2793 |
show "preced tm s \<in> (\<lambda>th. preced th s) ` ({th'} \<union> dependants (wq s) th')" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2794 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2795 |
from tm_chain |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2796 |
have "tm \<in> dependants (wq s) th'" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2797 |
by (unfold cs_dependants_def s_RAG_def cs_RAG_def, auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2798 |
thus ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2799 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2800 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2801 |
with tm_max |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2802 |
have h: "cp s th' = Max ((\<lambda>th. preced th s) ` threads s)" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2803 |
show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2804 |
proof (fold h, rule Max_eqI) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2805 |
fix q |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2806 |
assume "q \<in> cp s ` readys s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2807 |
then obtain th1 where th1_in: "th1 \<in> readys s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2808 |
and eq_q: "q = cp s th1" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2809 |
show "q \<le> cp s th'" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2810 |
apply (unfold h eq_q) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2811 |
apply (unfold cp_eq_cpreced cpreced_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2812 |
apply (rule Max_mono) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2813 |
proof - |
63 | 2814 |
from dependants_threads [of th1] th1_in |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2815 |
show "(\<lambda>th. preced th s) ` ({th1} \<union> dependants (wq s) th1) \<subseteq> |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2816 |
(\<lambda>th. preced th s) ` threads s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2817 |
by (auto simp:readys_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2818 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2819 |
show "(\<lambda>th. preced th s) ` ({th1} \<union> dependants (wq s) th1) \<noteq> {}" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2820 |
next |
63 | 2821 |
from finite_threads |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2822 |
show " finite ((\<lambda>th. preced th s) ` threads s)" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2823 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2824 |
next |
63 | 2825 |
from finite_threads |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2826 |
show "finite (cp s ` readys s)" by (auto simp:readys_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2827 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2828 |
from th'_in |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2829 |
show "cp s th' \<in> cp s ` readys s" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2830 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2831 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2832 |
assume tm_ready: "tm \<in> readys s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2833 |
show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2834 |
proof(fold tm_max) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2835 |
have cp_eq_p: "cp s tm = preced tm s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2836 |
proof(unfold cp_eq_cpreced cpreced_def, rule Max_eqI) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2837 |
fix y |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2838 |
assume hy: "y \<in> (\<lambda>th. preced th s) ` ({tm} \<union> dependants (wq s) tm)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2839 |
show "y \<le> preced tm s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2840 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2841 |
{ fix y' |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2842 |
assume hy' : "y' \<in> ((\<lambda>th. preced th s) ` dependants (wq s) tm)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2843 |
have "y' \<le> preced tm s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2844 |
proof(unfold tm_max, rule Max_ge) |
63 | 2845 |
from hy' dependants_threads[of tm] |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2846 |
show "y' \<in> (\<lambda>th. preced th s) ` threads s" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2847 |
next |
63 | 2848 |
from finite_threads |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2849 |
show "finite ((\<lambda>th. preced th s) ` threads s)" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2850 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2851 |
} with hy show ?thesis by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2852 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2853 |
next |
63 | 2854 |
from dependants_threads[of tm] finite_threads |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2855 |
show "finite ((\<lambda>th. preced th s) ` ({tm} \<union> dependants (wq s) tm))" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2856 |
by (auto intro:finite_subset) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2857 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2858 |
show "preced tm s \<in> (\<lambda>th. preced th s) ` ({tm} \<union> dependants (wq s) tm)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2859 |
by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2860 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2861 |
moreover have "Max (cp s ` readys s) = cp s tm" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2862 |
proof(rule Max_eqI) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2863 |
from tm_ready show "cp s tm \<in> cp s ` readys s" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2864 |
next |
63 | 2865 |
from finite_threads |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2866 |
show "finite (cp s ` readys s)" by (auto simp:readys_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2867 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2868 |
fix y assume "y \<in> cp s ` readys s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2869 |
then obtain th1 where th1_readys: "th1 \<in> readys s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2870 |
and h: "y = cp s th1" by auto |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2871 |
show "y \<le> cp s tm" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2872 |
apply(unfold cp_eq_p h) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2873 |
apply(unfold cp_eq_cpreced cpreced_def tm_max, rule Max_mono) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2874 |
proof - |
63 | 2875 |
from finite_threads |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2876 |
show "finite ((\<lambda>th. preced th s) ` threads s)" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2877 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2878 |
show "(\<lambda>th. preced th s) ` ({th1} \<union> dependants (wq s) th1) \<noteq> {}" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2879 |
by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2880 |
next |
63 | 2881 |
from dependants_threads[of th1] th1_readys |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2882 |
show "(\<lambda>th. preced th s) ` ({th1} \<union> dependants (wq s) th1) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2883 |
\<subseteq> (\<lambda>th. preced th s) ` threads s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2884 |
by (auto simp:readys_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2885 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2886 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2887 |
ultimately show " Max (cp s ` readys s) = preced tm s" by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2888 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2889 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2890 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2891 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2892 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2893 |
text {* (* ccc *) \noindent |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2894 |
Since the current precedence of the threads in ready queue will always be boosted, |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2895 |
there must be one inside it has the maximum precedence of the whole system. |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2896 |
*} |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2897 |
lemma max_cp_readys_threads: |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2898 |
shows "Max (cp s ` readys s) = Max (cp s ` threads s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2899 |
proof(cases "threads s = {}") |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2900 |
case True |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2901 |
thus ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2902 |
by (auto simp:readys_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2903 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2904 |
case False |
63 | 2905 |
show ?thesis by (rule max_cp_readys_threads_pre[OF False]) |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2906 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2907 |
|
63 | 2908 |
end |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2909 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2910 |
lemma eq_holding: "holding (wq s) th cs = holding s th cs" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2911 |
apply (unfold s_holding_def cs_holding_def wq_def, simp) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2912 |
done |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2913 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2914 |
lemma f_image_eq: |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2915 |
assumes h: "\<And> a. a \<in> A \<Longrightarrow> f a = g a" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2916 |
shows "f ` A = g ` A" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2917 |
proof |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2918 |
show "f ` A \<subseteq> g ` A" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2919 |
by(rule image_subsetI, auto intro:h) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2920 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2921 |
show "g ` A \<subseteq> f ` A" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2922 |
by (rule image_subsetI, auto intro:h[symmetric]) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2923 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2924 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2925 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2926 |
definition detached :: "state \<Rightarrow> thread \<Rightarrow> bool" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2927 |
where "detached s th \<equiv> (\<not>(\<exists> cs. holding s th cs)) \<and> (\<not>(\<exists>cs. waiting s th cs))" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2928 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2929 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2930 |
lemma detached_test: |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2931 |
shows "detached s th = (Th th \<notin> Field (RAG s))" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2932 |
apply(simp add: detached_def Field_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2933 |
apply(simp add: s_RAG_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2934 |
apply(simp add: s_holding_abv s_waiting_abv) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2935 |
apply(simp add: Domain_iff Range_iff) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2936 |
apply(simp add: wq_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2937 |
apply(auto) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2938 |
done |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2939 |
|
63 | 2940 |
context valid_trace |
2941 |
begin |
|
2942 |
||
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2943 |
lemma detached_intro: |
63 | 2944 |
assumes eq_pv: "cntP s th = cntV s th" |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2945 |
shows "detached s th" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2946 |
proof - |
63 | 2947 |
from cnp_cnv_cncs |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2948 |
have eq_cnt: "cntP s th = |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2949 |
cntV s th + (if th \<in> readys s \<or> th \<notin> threads s then cntCS s th else cntCS s th + 1)" . |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2950 |
hence cncs_zero: "cntCS s th = 0" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2951 |
by (auto simp:eq_pv split:if_splits) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2952 |
with eq_cnt |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2953 |
have "th \<in> readys s \<or> th \<notin> threads s" by (auto simp:eq_pv) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2954 |
thus ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2955 |
proof |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2956 |
assume "th \<notin> threads s" |
63 | 2957 |
with range_in dm_RAG_threads |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2958 |
show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2959 |
by (auto simp add: detached_def s_RAG_def s_waiting_abv s_holding_abv wq_def Domain_iff Range_iff) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2960 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2961 |
assume "th \<in> readys s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2962 |
moreover have "Th th \<notin> Range (RAG s)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2963 |
proof - |
63 | 2964 |
from card_0_eq [OF finite_holding] and cncs_zero |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2965 |
have "holdents s th = {}" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2966 |
by (simp add:cntCS_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2967 |
thus ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2968 |
apply(auto simp:holdents_test) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2969 |
apply(case_tac a) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2970 |
apply(auto simp:holdents_test s_RAG_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2971 |
done |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2972 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2973 |
ultimately show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2974 |
by (auto simp add: detached_def s_RAG_def s_waiting_abv s_holding_abv wq_def readys_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2975 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2976 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2977 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2978 |
lemma detached_elim: |
63 | 2979 |
assumes dtc: "detached s th" |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2980 |
shows "cntP s th = cntV s th" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2981 |
proof - |
63 | 2982 |
from cnp_cnv_cncs |
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2983 |
have eq_pv: " cntP s th = |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2984 |
cntV s th + (if th \<in> readys s \<or> th \<notin> threads s then cntCS s th else cntCS s th + 1)" . |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2985 |
have cncs_z: "cntCS s th = 0" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2986 |
proof - |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2987 |
from dtc have "holdents s th = {}" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2988 |
unfolding detached_def holdents_test s_RAG_def |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2989 |
by (simp add: s_waiting_abv wq_def s_holding_abv Domain_iff Range_iff) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2990 |
thus ?thesis by (auto simp:cntCS_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2991 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2992 |
show ?thesis |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2993 |
proof(cases "th \<in> threads s") |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2994 |
case True |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2995 |
with dtc |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2996 |
have "th \<in> readys s" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2997 |
by (unfold readys_def detached_def Field_def Domain_def Range_def, |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2998 |
auto simp:eq_waiting s_RAG_def) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
2999 |
with cncs_z and eq_pv show ?thesis by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
3000 |
next |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
3001 |
case False |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
3002 |
with cncs_z and eq_pv show ?thesis by simp |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
3003 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
3004 |
qed |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
3005 |
|
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
3006 |
lemma detached_eq: |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
3007 |
shows "(detached s th) = (cntP s th = cntV s th)" |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
3008 |
by (insert vt, auto intro:detached_intro detached_elim) |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
3009 |
|
63 | 3010 |
end |
3011 |
||
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
3012 |
text {* |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
3013 |
The lemmas in this .thy file are all obvious lemmas, however, they still needs to be derived |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
3014 |
from the concise and miniature model of PIP given in PrioGDef.thy. |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
3015 |
*} |
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
3016 |
|
62 | 3017 |
lemma eq_dependants: "dependants (wq s) = dependants s" |
3018 |
by (simp add: s_dependants_abv wq_def) |
|
3019 |
||
3020 |
lemma next_th_unique: |
|
3021 |
assumes nt1: "next_th s th cs th1" |
|
3022 |
and nt2: "next_th s th cs th2" |
|
3023 |
shows "th1 = th2" |
|
3024 |
using assms by (unfold next_th_def, auto) |
|
3025 |
||
64
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3026 |
lemma birth_time_lt: "s \<noteq> [] \<Longrightarrow> last_set th s < length s" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3027 |
apply (induct s, simp) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3028 |
proof - |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3029 |
fix a s |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3030 |
assume ih: "s \<noteq> [] \<Longrightarrow> last_set th s < length s" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3031 |
and eq_as: "a # s \<noteq> []" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3032 |
show "last_set th (a # s) < length (a # s)" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3033 |
proof(cases "s \<noteq> []") |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3034 |
case False |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3035 |
from False show ?thesis |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3036 |
by (cases a, auto simp:last_set.simps) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3037 |
next |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3038 |
case True |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3039 |
from ih [OF True] show ?thesis |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3040 |
by (cases a, auto simp:last_set.simps) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3041 |
qed |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3042 |
qed |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3043 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3044 |
lemma th_in_ne: "th \<in> threads s \<Longrightarrow> s \<noteq> []" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3045 |
by (induct s, auto simp:threads.simps) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3046 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3047 |
lemma preced_tm_lt: "th \<in> threads s \<Longrightarrow> preced th s = Prc x y \<Longrightarrow> y < length s" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3048 |
apply (drule_tac th_in_ne) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3049 |
by (unfold preced_def, auto intro: birth_time_lt) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3050 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3051 |
text {* @{text "the_preced"} is also the same as @{text "preced"}, the only |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3052 |
difference is the order of arguemts. *} |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3053 |
definition "the_preced s th = preced th s" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3054 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3055 |
lemma inj_the_preced: |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3056 |
"inj_on (the_preced s) (threads s)" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3057 |
by (metis inj_onI preced_unique the_preced_def) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3058 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3059 |
text {* @{term "the_thread"} extracts thread out of RAG node. *} |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3060 |
fun the_thread :: "node \<Rightarrow> thread" where |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3061 |
"the_thread (Th th) = th" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3062 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3063 |
text {* The following @{text "wRAG"} is the waiting sub-graph of @{text "RAG"}. *} |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3064 |
definition "wRAG (s::state) = {(Th th, Cs cs) | th cs. waiting s th cs}" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3065 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3066 |
text {* The following @{text "hRAG"} is the holding sub-graph of @{text "RAG"}. *} |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3067 |
definition "hRAG (s::state) = {(Cs cs, Th th) | th cs. holding s th cs}" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3068 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3069 |
text {* The following lemma splits @{term "RAG"} graph into the above two sub-graphs. *} |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3070 |
lemma RAG_split: "RAG s = (wRAG s \<union> hRAG s)" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3071 |
by (unfold s_RAG_abv wRAG_def hRAG_def s_waiting_abv |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3072 |
s_holding_abv cs_RAG_def, auto) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3073 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3074 |
text {* |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3075 |
The following @{text "tRAG"} is the thread-graph derived from @{term "RAG"}. |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3076 |
It characterizes the dependency between threads when calculating current |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3077 |
precedences. It is defined as the composition of the above two sub-graphs, |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3078 |
names @{term "wRAG"} and @{term "hRAG"}. |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3079 |
*} |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3080 |
definition "tRAG s = wRAG s O hRAG s" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3081 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3082 |
(* ccc *) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3083 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3084 |
definition "cp_gen s x = |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3085 |
Max ((the_preced s \<circ> the_thread) ` subtree (tRAG s) x)" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3086 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3087 |
lemma tRAG_alt_def: |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3088 |
"tRAG s = {(Th th1, Th th2) | th1 th2. |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3089 |
\<exists> cs. (Th th1, Cs cs) \<in> RAG s \<and> (Cs cs, Th th2) \<in> RAG s}" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3090 |
by (auto simp:tRAG_def RAG_split wRAG_def hRAG_def) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3091 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3092 |
lemma tRAG_Field: |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3093 |
"Field (tRAG s) \<subseteq> Field (RAG s)" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3094 |
by (unfold tRAG_alt_def Field_def, auto) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3095 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3096 |
lemma tRAG_ancestorsE: |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3097 |
assumes "x \<in> ancestors (tRAG s) u" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3098 |
obtains th where "x = Th th" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3099 |
proof - |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3100 |
from assms have "(u, x) \<in> (tRAG s)^+" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3101 |
by (unfold ancestors_def, auto) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3102 |
from tranclE[OF this] obtain c where "(c, x) \<in> tRAG s" by auto |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3103 |
then obtain th where "x = Th th" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3104 |
by (unfold tRAG_alt_def, auto) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3105 |
from that[OF this] show ?thesis . |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3106 |
qed |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3107 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3108 |
lemma tRAG_mono: |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3109 |
assumes "RAG s' \<subseteq> RAG s" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3110 |
shows "tRAG s' \<subseteq> tRAG s" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3111 |
using assms |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3112 |
by (unfold tRAG_alt_def, auto) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3113 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3114 |
lemma holding_next_thI: |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3115 |
assumes "holding s th cs" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3116 |
and "length (wq s cs) > 1" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3117 |
obtains th' where "next_th s th cs th'" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3118 |
proof - |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3119 |
from assms(1)[folded eq_holding, unfolded cs_holding_def] |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3120 |
have " th \<in> set (wq s cs) \<and> th = hd (wq s cs)" . |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3121 |
then obtain rest where h1: "wq s cs = th#rest" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3122 |
by (cases "wq s cs", auto) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3123 |
with assms(2) have h2: "rest \<noteq> []" by auto |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3124 |
let ?th' = "hd (SOME q. distinct q \<and> set q = set rest)" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3125 |
have "next_th s th cs ?th'" using h1(1) h2 |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3126 |
by (unfold next_th_def, auto) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3127 |
from that[OF this] show ?thesis . |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3128 |
qed |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3129 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3130 |
lemma RAG_tRAG_transfer: |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3131 |
assumes "vt s'" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3132 |
assumes "RAG s = RAG s' \<union> {(Th th, Cs cs)}" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3133 |
and "(Cs cs, Th th'') \<in> RAG s'" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3134 |
shows "tRAG s = tRAG s' \<union> {(Th th, Th th'')}" (is "?L = ?R") |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3135 |
proof - |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3136 |
interpret vt_s': valid_trace "s'" using assms(1) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3137 |
by (unfold_locales, simp) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3138 |
interpret rtree: rtree "RAG s'" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3139 |
proof |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3140 |
show "single_valued (RAG s')" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3141 |
apply (intro_locales) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3142 |
by (unfold single_valued_def, |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3143 |
auto intro:vt_s'.unique_RAG) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3144 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3145 |
show "acyclic (RAG s')" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3146 |
by (rule vt_s'.acyclic_RAG) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3147 |
qed |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3148 |
{ fix n1 n2 |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3149 |
assume "(n1, n2) \<in> ?L" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3150 |
from this[unfolded tRAG_alt_def] |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3151 |
obtain th1 th2 cs' where |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3152 |
h: "n1 = Th th1" "n2 = Th th2" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3153 |
"(Th th1, Cs cs') \<in> RAG s" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3154 |
"(Cs cs', Th th2) \<in> RAG s" by auto |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3155 |
from h(4) and assms(2) have cs_in: "(Cs cs', Th th2) \<in> RAG s'" by auto |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3156 |
from h(3) and assms(2) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3157 |
have "(Th th1, Cs cs') = (Th th, Cs cs) \<or> |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3158 |
(Th th1, Cs cs') \<in> RAG s'" by auto |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3159 |
hence "(n1, n2) \<in> ?R" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3160 |
proof |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3161 |
assume h1: "(Th th1, Cs cs') = (Th th, Cs cs)" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3162 |
hence eq_th1: "th1 = th" by simp |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3163 |
moreover have "th2 = th''" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3164 |
proof - |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3165 |
from h1 have "cs' = cs" by simp |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3166 |
from assms(3) cs_in[unfolded this] rtree.sgv |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3167 |
show ?thesis |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3168 |
by (unfold single_valued_def, auto) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3169 |
qed |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3170 |
ultimately show ?thesis using h(1,2) by auto |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3171 |
next |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3172 |
assume "(Th th1, Cs cs') \<in> RAG s'" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3173 |
with cs_in have "(Th th1, Th th2) \<in> tRAG s'" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3174 |
by (unfold tRAG_alt_def, auto) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3175 |
from this[folded h(1, 2)] show ?thesis by auto |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3176 |
qed |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3177 |
} moreover { |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3178 |
fix n1 n2 |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3179 |
assume "(n1, n2) \<in> ?R" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3180 |
hence "(n1, n2) \<in>tRAG s' \<or> (n1, n2) = (Th th, Th th'')" by auto |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3181 |
hence "(n1, n2) \<in> ?L" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3182 |
proof |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3183 |
assume "(n1, n2) \<in> tRAG s'" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3184 |
moreover have "... \<subseteq> ?L" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3185 |
proof(rule tRAG_mono) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3186 |
show "RAG s' \<subseteq> RAG s" by (unfold assms(2), auto) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3187 |
qed |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3188 |
ultimately show ?thesis by auto |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3189 |
next |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3190 |
assume eq_n: "(n1, n2) = (Th th, Th th'')" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3191 |
from assms(2, 3) have "(Cs cs, Th th'') \<in> RAG s" by auto |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3192 |
moreover have "(Th th, Cs cs) \<in> RAG s" using assms(2) by auto |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3193 |
ultimately show ?thesis |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3194 |
by (unfold eq_n tRAG_alt_def, auto) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3195 |
qed |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3196 |
} ultimately show ?thesis by auto |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3197 |
qed |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3198 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3199 |
context valid_trace |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3200 |
begin |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3201 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3202 |
lemmas RAG_tRAG_transfer = RAG_tRAG_transfer[OF vt] |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3203 |
|
57
f1b39d77db00
Added generic theory "RTree.thy"
xingyuan zhang <xingyuanzhang@126.com>
parents:
diff
changeset
|
3204 |
end |
64
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3205 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3206 |
lemma cp_alt_def: |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3207 |
"cp s th = |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3208 |
Max ((the_preced s) ` {th'. Th th' \<in> (subtree (RAG s) (Th th))})" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3209 |
proof - |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3210 |
have "Max (the_preced s ` ({th} \<union> dependants (wq s) th)) = |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3211 |
Max (the_preced s ` {th'. Th th' \<in> subtree (RAG s) (Th th)})" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3212 |
(is "Max (_ ` ?L) = Max (_ ` ?R)") |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3213 |
proof - |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3214 |
have "?L = ?R" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3215 |
by (auto dest:rtranclD simp:cs_dependants_def cs_RAG_def s_RAG_def subtree_def) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3216 |
thus ?thesis by simp |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3217 |
qed |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3218 |
thus ?thesis by (unfold cp_eq_cpreced cpreced_def, fold the_preced_def, simp) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3219 |
qed |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3220 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3221 |
lemma cp_gen_alt_def: |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3222 |
"cp_gen s = (Max \<circ> (\<lambda>x. (the_preced s \<circ> the_thread) ` subtree (tRAG s) x))" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3223 |
by (auto simp:cp_gen_def) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3224 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3225 |
lemma tRAG_nodeE: |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3226 |
assumes "(n1, n2) \<in> tRAG s" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3227 |
obtains th1 th2 where "n1 = Th th1" "n2 = Th th2" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3228 |
using assms |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3229 |
by (auto simp: tRAG_def wRAG_def hRAG_def tRAG_def) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3230 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3231 |
lemma subtree_nodeE: |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3232 |
assumes "n \<in> subtree (tRAG s) (Th th)" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3233 |
obtains th1 where "n = Th th1" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3234 |
proof - |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3235 |
show ?thesis |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3236 |
proof(rule subtreeE[OF assms]) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3237 |
assume "n = Th th" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3238 |
from that[OF this] show ?thesis . |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3239 |
next |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3240 |
assume "Th th \<in> ancestors (tRAG s) n" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3241 |
hence "(n, Th th) \<in> (tRAG s)^+" by (auto simp:ancestors_def) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3242 |
hence "\<exists> th1. n = Th th1" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3243 |
proof(induct) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3244 |
case (base y) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3245 |
from tRAG_nodeE[OF this] show ?case by metis |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3246 |
next |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3247 |
case (step y z) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3248 |
thus ?case by auto |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3249 |
qed |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3250 |
with that show ?thesis by auto |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3251 |
qed |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3252 |
qed |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3253 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3254 |
lemma tRAG_star_RAG: "(tRAG s)^* \<subseteq> (RAG s)^*" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3255 |
proof - |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3256 |
have "(wRAG s O hRAG s)^* \<subseteq> (RAG s O RAG s)^*" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3257 |
by (rule rtrancl_mono, auto simp:RAG_split) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3258 |
also have "... \<subseteq> ((RAG s)^*)^*" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3259 |
by (rule rtrancl_mono, auto) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3260 |
also have "... = (RAG s)^*" by simp |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3261 |
finally show ?thesis by (unfold tRAG_def, simp) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3262 |
qed |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3263 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3264 |
lemma tRAG_subtree_RAG: "subtree (tRAG s) x \<subseteq> subtree (RAG s) x" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3265 |
proof - |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3266 |
{ fix a |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3267 |
assume "a \<in> subtree (tRAG s) x" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3268 |
hence "(a, x) \<in> (tRAG s)^*" by (auto simp:subtree_def) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3269 |
with tRAG_star_RAG[of s] |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3270 |
have "(a, x) \<in> (RAG s)^*" by auto |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3271 |
hence "a \<in> subtree (RAG s) x" by (auto simp:subtree_def) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3272 |
} thus ?thesis by auto |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3273 |
qed |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3274 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3275 |
lemma tRAG_trancl_eq: |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3276 |
"{th'. (Th th', Th th) \<in> (tRAG s)^+} = |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3277 |
{th'. (Th th', Th th) \<in> (RAG s)^+}" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3278 |
(is "?L = ?R") |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3279 |
proof - |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3280 |
{ fix th' |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3281 |
assume "th' \<in> ?L" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3282 |
hence "(Th th', Th th) \<in> (tRAG s)^+" by auto |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3283 |
from tranclD[OF this] |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3284 |
obtain z where h: "(Th th', z) \<in> tRAG s" "(z, Th th) \<in> (tRAG s)\<^sup>*" by auto |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3285 |
from tRAG_subtree_RAG[of s] and this(2) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3286 |
have "(z, Th th) \<in> (RAG s)^*" by (meson subsetCE tRAG_star_RAG) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3287 |
moreover from h(1) have "(Th th', z) \<in> (RAG s)^+" using tRAG_alt_def by auto |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3288 |
ultimately have "th' \<in> ?R" by auto |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3289 |
} moreover |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3290 |
{ fix th' |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3291 |
assume "th' \<in> ?R" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3292 |
hence "(Th th', Th th) \<in> (RAG s)^+" by (auto) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3293 |
from plus_rpath[OF this] |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3294 |
obtain xs where rp: "rpath (RAG s) (Th th') xs (Th th)" "xs \<noteq> []" by auto |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3295 |
hence "(Th th', Th th) \<in> (tRAG s)^+" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3296 |
proof(induct xs arbitrary:th' th rule:length_induct) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3297 |
case (1 xs th' th) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3298 |
then obtain x1 xs1 where Cons1: "xs = x1#xs1" by (cases xs, auto) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3299 |
show ?case |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3300 |
proof(cases "xs1") |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3301 |
case Nil |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3302 |
from 1(2)[unfolded Cons1 Nil] |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3303 |
have rp: "rpath (RAG s) (Th th') [x1] (Th th)" . |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3304 |
hence "(Th th', x1) \<in> (RAG s)" by (cases, simp) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3305 |
then obtain cs where "x1 = Cs cs" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3306 |
by (unfold s_RAG_def, auto) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3307 |
from rpath_nnl_lastE[OF rp[unfolded this]] |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3308 |
show ?thesis by auto |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3309 |
next |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3310 |
case (Cons x2 xs2) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3311 |
from 1(2)[unfolded Cons1[unfolded this]] |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3312 |
have rp: "rpath (RAG s) (Th th') (x1 # x2 # xs2) (Th th)" . |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3313 |
from rpath_edges_on[OF this] |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3314 |
have eds: "edges_on (Th th' # x1 # x2 # xs2) \<subseteq> RAG s" . |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3315 |
have "(Th th', x1) \<in> edges_on (Th th' # x1 # x2 # xs2)" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3316 |
by (simp add: edges_on_unfold) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3317 |
with eds have rg1: "(Th th', x1) \<in> RAG s" by auto |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3318 |
then obtain cs1 where eq_x1: "x1 = Cs cs1" by (unfold s_RAG_def, auto) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3319 |
have "(x1, x2) \<in> edges_on (Th th' # x1 # x2 # xs2)" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3320 |
by (simp add: edges_on_unfold) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3321 |
from this eds |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3322 |
have rg2: "(x1, x2) \<in> RAG s" by auto |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3323 |
from this[unfolded eq_x1] |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3324 |
obtain th1 where eq_x2: "x2 = Th th1" by (unfold s_RAG_def, auto) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3325 |
from rg1[unfolded eq_x1] rg2[unfolded eq_x1 eq_x2] |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3326 |
have rt1: "(Th th', Th th1) \<in> tRAG s" by (unfold tRAG_alt_def, auto) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3327 |
from rp have "rpath (RAG s) x2 xs2 (Th th)" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3328 |
by (elim rpath_ConsE, simp) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3329 |
from this[unfolded eq_x2] have rp': "rpath (RAG s) (Th th1) xs2 (Th th)" . |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3330 |
show ?thesis |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3331 |
proof(cases "xs2 = []") |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3332 |
case True |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3333 |
from rpath_nilE[OF rp'[unfolded this]] |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3334 |
have "th1 = th" by auto |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3335 |
from rt1[unfolded this] show ?thesis by auto |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3336 |
next |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3337 |
case False |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3338 |
from 1(1)[rule_format, OF _ rp' this, unfolded Cons1 Cons] |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3339 |
have "(Th th1, Th th) \<in> (tRAG s)\<^sup>+" by simp |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3340 |
with rt1 show ?thesis by auto |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3341 |
qed |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3342 |
qed |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3343 |
qed |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3344 |
hence "th' \<in> ?L" by auto |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3345 |
} ultimately show ?thesis by blast |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3346 |
qed |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3347 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3348 |
lemma tRAG_trancl_eq_Th: |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3349 |
"{Th th' | th'. (Th th', Th th) \<in> (tRAG s)^+} = |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3350 |
{Th th' | th'. (Th th', Th th) \<in> (RAG s)^+}" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3351 |
using tRAG_trancl_eq by auto |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3352 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3353 |
lemma dependants_alt_def: |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3354 |
"dependants s th = {th'. (Th th', Th th) \<in> (tRAG s)^+}" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3355 |
by (metis eq_RAG s_dependants_def tRAG_trancl_eq) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3356 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3357 |
context valid_trace |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3358 |
begin |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3359 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3360 |
lemma count_eq_tRAG_plus: |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3361 |
assumes "cntP s th = cntV s th" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3362 |
shows "{th'. (Th th', Th th) \<in> (tRAG s)^+} = {}" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3363 |
using assms count_eq_dependants dependants_alt_def eq_dependants by auto |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3364 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3365 |
lemma count_eq_RAG_plus: |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3366 |
assumes "cntP s th = cntV s th" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3367 |
shows "{th'. (Th th', Th th) \<in> (RAG s)^+} = {}" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3368 |
using assms count_eq_dependants cs_dependants_def eq_RAG by auto |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3369 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3370 |
lemma count_eq_RAG_plus_Th: |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3371 |
assumes "cntP s th = cntV s th" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3372 |
shows "{Th th' | th'. (Th th', Th th) \<in> (RAG s)^+} = {}" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3373 |
using count_eq_RAG_plus[OF assms] by auto |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3374 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3375 |
lemma count_eq_tRAG_plus_Th: |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3376 |
assumes "cntP s th = cntV s th" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3377 |
shows "{Th th' | th'. (Th th', Th th) \<in> (tRAG s)^+} = {}" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3378 |
using count_eq_tRAG_plus[OF assms] by auto |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3379 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3380 |
end |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3381 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3382 |
lemma tRAG_subtree_eq: |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3383 |
"(subtree (tRAG s) (Th th)) = {Th th' | th'. Th th' \<in> (subtree (RAG s) (Th th))}" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3384 |
(is "?L = ?R") |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3385 |
proof - |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3386 |
{ fix n |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3387 |
assume h: "n \<in> ?L" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3388 |
hence "n \<in> ?R" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3389 |
by (smt mem_Collect_eq subsetCE subtree_def subtree_nodeE tRAG_subtree_RAG) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3390 |
} moreover { |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3391 |
fix n |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3392 |
assume "n \<in> ?R" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3393 |
then obtain th' where h: "n = Th th'" "(Th th', Th th) \<in> (RAG s)^*" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3394 |
by (auto simp:subtree_def) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3395 |
from rtranclD[OF this(2)] |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3396 |
have "n \<in> ?L" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3397 |
proof |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3398 |
assume "Th th' \<noteq> Th th \<and> (Th th', Th th) \<in> (RAG s)\<^sup>+" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3399 |
with h have "n \<in> {Th th' | th'. (Th th', Th th) \<in> (RAG s)^+}" by auto |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3400 |
thus ?thesis using subtree_def tRAG_trancl_eq by fastforce |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3401 |
qed (insert h, auto simp:subtree_def) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3402 |
} ultimately show ?thesis by auto |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3403 |
qed |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3404 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3405 |
lemma threads_set_eq: |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3406 |
"the_thread ` (subtree (tRAG s) (Th th)) = |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3407 |
{th'. Th th' \<in> (subtree (RAG s) (Th th))}" (is "?L = ?R") |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3408 |
by (auto intro:rev_image_eqI simp:tRAG_subtree_eq) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3409 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3410 |
lemma cp_alt_def1: |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3411 |
"cp s th = Max ((the_preced s o the_thread) ` (subtree (tRAG s) (Th th)))" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3412 |
proof - |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3413 |
have "(the_preced s ` the_thread ` subtree (tRAG s) (Th th)) = |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3414 |
((the_preced s \<circ> the_thread) ` subtree (tRAG s) (Th th))" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3415 |
by auto |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3416 |
thus ?thesis by (unfold cp_alt_def, fold threads_set_eq, auto) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3417 |
qed |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3418 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3419 |
lemma cp_gen_def_cond: |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3420 |
assumes "x = Th th" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3421 |
shows "cp s th = cp_gen s (Th th)" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3422 |
by (unfold cp_alt_def1 cp_gen_def, simp) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3423 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3424 |
lemma cp_gen_over_set: |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3425 |
assumes "\<forall> x \<in> A. \<exists> th. x = Th th" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3426 |
shows "cp_gen s ` A = (cp s \<circ> the_thread) ` A" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3427 |
proof(rule f_image_eq) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3428 |
fix a |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3429 |
assume "a \<in> A" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3430 |
from assms[rule_format, OF this] |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3431 |
obtain th where eq_a: "a = Th th" by auto |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3432 |
show "cp_gen s a = (cp s \<circ> the_thread) a" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3433 |
by (unfold eq_a, simp, unfold cp_gen_def_cond[OF refl[of "Th th"]], simp) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3434 |
qed |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3435 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3436 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3437 |
context valid_trace |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3438 |
begin |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3439 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3440 |
lemma RAG_threads: |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3441 |
assumes "(Th th) \<in> Field (RAG s)" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3442 |
shows "th \<in> threads s" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3443 |
using assms |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3444 |
by (metis Field_def UnE dm_RAG_threads range_in vt) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3445 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3446 |
lemma subtree_tRAG_thread: |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3447 |
assumes "th \<in> threads s" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3448 |
shows "subtree (tRAG s) (Th th) \<subseteq> Th ` threads s" (is "?L \<subseteq> ?R") |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3449 |
proof - |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3450 |
have "?L = {Th th' |th'. Th th' \<in> subtree (RAG s) (Th th)}" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3451 |
by (unfold tRAG_subtree_eq, simp) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3452 |
also have "... \<subseteq> ?R" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3453 |
proof |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3454 |
fix x |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3455 |
assume "x \<in> {Th th' |th'. Th th' \<in> subtree (RAG s) (Th th)}" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3456 |
then obtain th' where h: "x = Th th'" "Th th' \<in> subtree (RAG s) (Th th)" by auto |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3457 |
from this(2) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3458 |
show "x \<in> ?R" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3459 |
proof(cases rule:subtreeE) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3460 |
case 1 |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3461 |
thus ?thesis by (simp add: assms h(1)) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3462 |
next |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3463 |
case 2 |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3464 |
thus ?thesis by (metis ancestors_Field dm_RAG_threads h(1) image_eqI) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3465 |
qed |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3466 |
qed |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3467 |
finally show ?thesis . |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3468 |
qed |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3469 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3470 |
lemma readys_root: |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3471 |
assumes "th \<in> readys s" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3472 |
shows "root (RAG s) (Th th)" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3473 |
proof - |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3474 |
{ fix x |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3475 |
assume "x \<in> ancestors (RAG s) (Th th)" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3476 |
hence h: "(Th th, x) \<in> (RAG s)^+" by (auto simp:ancestors_def) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3477 |
from tranclD[OF this] |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3478 |
obtain z where "(Th th, z) \<in> RAG s" by auto |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3479 |
with assms(1) have False |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3480 |
apply (case_tac z, auto simp:readys_def s_RAG_def s_waiting_def cs_waiting_def) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3481 |
by (fold wq_def, blast) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3482 |
} thus ?thesis by (unfold root_def, auto) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3483 |
qed |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3484 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3485 |
lemma readys_in_no_subtree: |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3486 |
assumes "th \<in> readys s" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3487 |
and "th' \<noteq> th" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3488 |
shows "Th th \<notin> subtree (RAG s) (Th th')" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3489 |
proof |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3490 |
assume "Th th \<in> subtree (RAG s) (Th th')" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3491 |
thus False |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3492 |
proof(cases rule:subtreeE) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3493 |
case 1 |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3494 |
with assms show ?thesis by auto |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3495 |
next |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3496 |
case 2 |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3497 |
with readys_root[OF assms(1)] |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3498 |
show ?thesis by (auto simp:root_def) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3499 |
qed |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3500 |
qed |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3501 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3502 |
lemma not_in_thread_isolated: |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3503 |
assumes "th \<notin> threads s" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3504 |
shows "(Th th) \<notin> Field (RAG s)" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3505 |
proof |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3506 |
assume "(Th th) \<in> Field (RAG s)" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3507 |
with dm_RAG_threads and range_in assms |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3508 |
show False by (unfold Field_def, blast) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3509 |
qed |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3510 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3511 |
lemma wf_RAG: "wf (RAG s)" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3512 |
proof(rule finite_acyclic_wf) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3513 |
from finite_RAG show "finite (RAG s)" . |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3514 |
next |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3515 |
from acyclic_RAG show "acyclic (RAG s)" . |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3516 |
qed |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3517 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3518 |
lemma sgv_wRAG: "single_valued (wRAG s)" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3519 |
using waiting_unique |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3520 |
by (unfold single_valued_def wRAG_def, auto) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3521 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3522 |
lemma sgv_hRAG: "single_valued (hRAG s)" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3523 |
using holding_unique |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3524 |
by (unfold single_valued_def hRAG_def, auto) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3525 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3526 |
lemma sgv_tRAG: "single_valued (tRAG s)" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3527 |
by (unfold tRAG_def, rule single_valued_relcomp, |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3528 |
insert sgv_wRAG sgv_hRAG, auto) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3529 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3530 |
lemma acyclic_tRAG: "acyclic (tRAG s)" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3531 |
proof(unfold tRAG_def, rule acyclic_compose) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3532 |
show "acyclic (RAG s)" using acyclic_RAG . |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3533 |
next |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3534 |
show "wRAG s \<subseteq> RAG s" unfolding RAG_split by auto |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3535 |
next |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3536 |
show "hRAG s \<subseteq> RAG s" unfolding RAG_split by auto |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3537 |
qed |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3538 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3539 |
lemma sgv_RAG: "single_valued (RAG s)" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3540 |
using unique_RAG by (auto simp:single_valued_def) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3541 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3542 |
lemma rtree_RAG: "rtree (RAG s)" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3543 |
using sgv_RAG acyclic_RAG |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3544 |
by (unfold rtree_def rtree_axioms_def sgv_def, auto) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3545 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3546 |
end |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3547 |
context valid_trace |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3548 |
begin |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3549 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3550 |
(* ddd *) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3551 |
lemma cp_gen_rec: |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3552 |
assumes "x = Th th" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3553 |
shows "cp_gen s x = Max ({the_preced s th} \<union> (cp_gen s) ` children (tRAG s) x)" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3554 |
proof(cases "children (tRAG s) x = {}") |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3555 |
case True |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3556 |
show ?thesis |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3557 |
by (unfold True cp_gen_def subtree_children, simp add:assms) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3558 |
next |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3559 |
case False |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3560 |
hence [simp]: "children (tRAG s) x \<noteq> {}" by auto |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3561 |
note fsbttRAGs.finite_subtree[simp] |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3562 |
have [simp]: "finite (children (tRAG s) x)" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3563 |
by (intro rev_finite_subset[OF fsbttRAGs.finite_subtree], |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3564 |
rule children_subtree) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3565 |
{ fix r x |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3566 |
have "subtree r x \<noteq> {}" by (auto simp:subtree_def) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3567 |
} note this[simp] |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3568 |
have [simp]: "\<exists>x\<in>children (tRAG s) x. subtree (tRAG s) x \<noteq> {}" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3569 |
proof - |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3570 |
from False obtain q where "q \<in> children (tRAG s) x" by blast |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3571 |
moreover have "subtree (tRAG s) q \<noteq> {}" by simp |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3572 |
ultimately show ?thesis by blast |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3573 |
qed |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3574 |
have h: "Max ((the_preced s \<circ> the_thread) ` |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3575 |
({x} \<union> \<Union>(subtree (tRAG s) ` children (tRAG s) x))) = |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3576 |
Max ({the_preced s th} \<union> cp_gen s ` children (tRAG s) x)" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3577 |
(is "?L = ?R") |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3578 |
proof - |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3579 |
let "Max (?f ` (?A \<union> \<Union> (?g ` ?B)))" = ?L |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3580 |
let "Max (_ \<union> (?h ` ?B))" = ?R |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3581 |
let ?L1 = "?f ` \<Union>(?g ` ?B)" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3582 |
have eq_Max_L1: "Max ?L1 = Max (?h ` ?B)" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3583 |
proof - |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3584 |
have "?L1 = ?f ` (\<Union> x \<in> ?B.(?g x))" by simp |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3585 |
also have "... = (\<Union> x \<in> ?B. ?f ` (?g x))" by auto |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3586 |
finally have "Max ?L1 = Max ..." by simp |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3587 |
also have "... = Max (Max ` (\<lambda>x. ?f ` subtree (tRAG s) x) ` ?B)" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3588 |
by (subst Max_UNION, simp+) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3589 |
also have "... = Max (cp_gen s ` children (tRAG s) x)" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3590 |
by (unfold image_comp cp_gen_alt_def, simp) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3591 |
finally show ?thesis . |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3592 |
qed |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3593 |
show ?thesis |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3594 |
proof - |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3595 |
have "?L = Max (?f ` ?A \<union> ?L1)" by simp |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3596 |
also have "... = max (the_preced s (the_thread x)) (Max ?L1)" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3597 |
by (subst Max_Un, simp+) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3598 |
also have "... = max (?f x) (Max (?h ` ?B))" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3599 |
by (unfold eq_Max_L1, simp) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3600 |
also have "... =?R" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3601 |
by (rule max_Max_eq, (simp)+, unfold assms, simp) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3602 |
finally show ?thesis . |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3603 |
qed |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3604 |
qed thus ?thesis |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3605 |
by (fold h subtree_children, unfold cp_gen_def, simp) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3606 |
qed |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3607 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3608 |
lemma cp_rec: |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3609 |
"cp s th = Max ({the_preced s th} \<union> |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3610 |
(cp s o the_thread) ` children (tRAG s) (Th th))" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3611 |
proof - |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3612 |
have "Th th = Th th" by simp |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3613 |
note h = cp_gen_def_cond[OF this] cp_gen_rec[OF this] |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3614 |
show ?thesis |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3615 |
proof - |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3616 |
have "cp_gen s ` children (tRAG s) (Th th) = |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3617 |
(cp s \<circ> the_thread) ` children (tRAG s) (Th th)" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3618 |
proof(rule cp_gen_over_set) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3619 |
show " \<forall>x\<in>children (tRAG s) (Th th). \<exists>th. x = Th th" |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3620 |
by (unfold tRAG_alt_def, auto simp:children_def) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3621 |
qed |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3622 |
thus ?thesis by (subst (1) h(1), unfold h(2), simp) |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3623 |
qed |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3624 |
qed |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3625 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3626 |
end |
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3627 |
|
b4bcd1edbb6d
renamed files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
63
diff
changeset
|
3628 |
end |