author | zhangx |
Fri, 12 Feb 2016 17:50:24 +0800 | |
changeset 116 | a7441db6f4e1 |
parent 115 | 74fc1eae4605 |
child 117 | 8a6125caead2 |
permissions | -rw-r--r-- |
107
30ed212f268a
updated Correctness, Implementation and PIPBasics so that they work with Isabelle 2014 and 2015
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
106
diff
changeset
|
1 |
theory Implementation |
30ed212f268a
updated Correctness, Implementation and PIPBasics so that they work with Isabelle 2014 and 2015
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
106
diff
changeset
|
2 |
imports PIPBasics |
30ed212f268a
updated Correctness, Implementation and PIPBasics so that they work with Isabelle 2014 and 2015
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
106
diff
changeset
|
3 |
begin |
30ed212f268a
updated Correctness, Implementation and PIPBasics so that they work with Isabelle 2014 and 2015
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
106
diff
changeset
|
4 |
|
116 | 5 |
|
6 |
context valid_trace |
|
7 |
begin |
|
8 |
||
9 |
lemma readys_root: |
|
10 |
assumes "th \<in> readys s" |
|
11 |
shows "root (RAG s) (Th th)" |
|
12 |
proof - |
|
13 |
{ fix x |
|
14 |
assume "x \<in> ancestors (RAG s) (Th th)" |
|
15 |
hence h: "(Th th, x) \<in> (RAG s)^+" by (auto simp:ancestors_def) |
|
16 |
from tranclD[OF this] |
|
17 |
obtain z where "(Th th, z) \<in> RAG s" by auto |
|
18 |
with assms(1) have False |
|
19 |
apply (case_tac z, auto simp:readys_def s_RAG_def s_waiting_def cs_waiting_def) |
|
20 |
by (fold wq_def, blast) |
|
21 |
} thus ?thesis by (unfold root_def, auto) |
|
22 |
qed |
|
23 |
||
24 |
lemma readys_in_no_subtree: |
|
25 |
assumes "th \<in> readys s" |
|
26 |
and "th' \<noteq> th" |
|
27 |
shows "Th th \<notin> subtree (RAG s) (Th th')" |
|
28 |
proof |
|
29 |
assume "Th th \<in> subtree (RAG s) (Th th')" |
|
30 |
thus False |
|
31 |
proof(cases rule:subtreeE) |
|
32 |
case 1 |
|
33 |
with assms show ?thesis by auto |
|
34 |
next |
|
35 |
case 2 |
|
36 |
with readys_root[OF assms(1)] |
|
37 |
show ?thesis by (auto simp:root_def) |
|
38 |
qed |
|
39 |
qed |
|
40 |
||
41 |
end |
|
42 |
||
53
8142e80f5d58
Finished comments on PrioGDef.thy
xingyuan zhang <xingyuanzhang@126.com>
parents:
45
diff
changeset
|
43 |
section {* |
8142e80f5d58
Finished comments on PrioGDef.thy
xingyuan zhang <xingyuanzhang@126.com>
parents:
45
diff
changeset
|
44 |
This file contains lemmas used to guide the recalculation of current precedence |
8142e80f5d58
Finished comments on PrioGDef.thy
xingyuan zhang <xingyuanzhang@126.com>
parents:
45
diff
changeset
|
45 |
after every system call (or system operation) |
8142e80f5d58
Finished comments on PrioGDef.thy
xingyuan zhang <xingyuanzhang@126.com>
parents:
45
diff
changeset
|
46 |
*} |
63 | 47 |
|
55
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
48 |
text {* (* ddd *) |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
49 |
One beauty of our modelling is that we follow the definitional extension tradition of HOL. |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
50 |
The benefit of such a concise and miniature model is that large number of intuitively |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
51 |
obvious facts are derived as lemmas, rather than asserted as axioms. |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
52 |
*} |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
53 |
|
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
54 |
text {* |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
55 |
However, the lemmas in the forthcoming several locales are no longer |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
56 |
obvious. These lemmas show how the current precedences should be recalculated |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
57 |
after every execution step (in our model, every step is represented by an event, |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
58 |
which in turn, represents a system call, or operation). Each operation is |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
59 |
treated in a separate locale. |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
60 |
|
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
61 |
The complication of current precedence recalculation comes |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
62 |
because the changing of RAG needs to be taken into account, |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
63 |
in addition to the changing of precedence. |
68 | 64 |
|
55
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
65 |
The reason RAG changing affects current precedence is that, |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
66 |
according to the definition, current precedence |
68 | 67 |
of a thread is the maximum of the precedences of every threads in its subtree, |
68 |
where the notion of sub-tree in RAG is defined in RTree.thy. |
|
55
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
69 |
|
68 | 70 |
Therefore, for each operation, lemmas about the change of precedences |
71 |
and RAG are derived first, on which lemmas about current precedence |
|
72 |
recalculation are based on. |
|
55
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
73 |
*} |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
74 |
|
68 | 75 |
section {* The @{term Set} operation *} |
76 |
||
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
77 |
context valid_trace_set |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
78 |
begin |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
79 |
|
55
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
80 |
text {* (* ddd *) |
68 | 81 |
The following two lemmas confirm that @{text "Set"}-operation |
82 |
only changes the precedence of the initiating thread (or actor) |
|
83 |
of the operation (or event). |
|
55
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
84 |
*} |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
85 |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
86 |
|
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
87 |
lemma eq_preced: |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
88 |
assumes "th' \<noteq> th" |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
89 |
shows "preced th' (e#s) = preced th' s" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
90 |
proof - |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
91 |
from assms show ?thesis |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
92 |
by (unfold is_set, auto simp:preced_def) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
93 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
94 |
|
58 | 95 |
lemma eq_the_preced: |
96 |
assumes "th' \<noteq> th" |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
97 |
shows "the_preced (e#s) th' = the_preced s th'" |
58 | 98 |
using assms |
99 |
by (unfold the_preced_def, intro eq_preced, simp) |
|
100 |
||
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
101 |
|
58 | 102 |
text {* (* ddd *) |
68 | 103 |
Th following lemma @{text "eq_cp_pre"} says that the priority change of @{text "th"} |
58 | 104 |
only affects those threads, which as @{text "Th th"} in their sub-trees. |
105 |
||
68 | 106 |
The proof of this lemma is simplified by using the alternative definition |
107 |
of @{text "cp"}. |
|
55
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
108 |
*} |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
109 |
|
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
110 |
lemma eq_cp_pre: |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
111 |
assumes nd: "Th th \<notin> subtree (RAG s) (Th th')" |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
112 |
shows "cp (e#s) th' = cp s th'" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
113 |
proof - |
58 | 114 |
-- {* After unfolding using the alternative definition, elements |
115 |
affecting the @{term "cp"}-value of threads become explicit. |
|
116 |
We only need to prove the following: *} |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
117 |
have "Max (the_preced (e#s) ` {th'a. Th th'a \<in> subtree (RAG (e#s)) (Th th')}) = |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
118 |
Max (the_preced s ` {th'a. Th th'a \<in> subtree (RAG s) (Th th')})" |
58 | 119 |
(is "Max (?f ` ?S1) = Max (?g ` ?S2)") |
55
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
120 |
proof - |
58 | 121 |
-- {* The base sets are equal. *} |
113
ce85c3c4e5bf
More improvements in PIPBasics.thy and Implemenation.thy.
zhangx
parents:
108
diff
changeset
|
122 |
have "?S1 = ?S2" using RAG_es by simp |
58 | 123 |
-- {* The function values on the base set are equal as well. *} |
124 |
moreover have "\<forall> e \<in> ?S2. ?f e = ?g e" |
|
125 |
proof |
|
126 |
fix th1 |
|
127 |
assume "th1 \<in> ?S2" |
|
128 |
with nd have "th1 \<noteq> th" by (auto) |
|
129 |
from eq_the_preced[OF this] |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
130 |
show "the_preced (e#s) th1 = the_preced s th1" . |
58 | 131 |
qed |
132 |
-- {* Therefore, the image of the functions are equal. *} |
|
133 |
ultimately have "(?f ` ?S1) = (?g ` ?S2)" by (auto intro!:f_image_eq) |
|
134 |
thus ?thesis by simp |
|
135 |
qed |
|
136 |
thus ?thesis by (simp add:cp_alt_def) |
|
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
137 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
138 |
|
55
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
139 |
text {* |
58 | 140 |
The following lemma shows that @{term "th"} is not in the |
141 |
sub-tree of any other thread. |
|
55
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
142 |
*} |
58 | 143 |
lemma th_in_no_subtree: |
144 |
assumes "th' \<noteq> th" |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
145 |
shows "Th th \<notin> subtree (RAG s) (Th th')" |
58 | 146 |
proof - |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
147 |
from readys_in_no_subtree[OF th_ready_s assms(1)] |
58 | 148 |
show ?thesis by blast |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
149 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
150 |
|
55
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
151 |
text {* |
58 | 152 |
By combining @{thm "eq_cp_pre"} and @{thm "th_in_no_subtree"}, |
153 |
it is obvious that the change of priority only affects the @{text "cp"}-value |
|
154 |
of the initiating thread @{text "th"}. |
|
55
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
155 |
*} |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
156 |
lemma eq_cp: |
55
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
157 |
assumes "th' \<noteq> th" |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
158 |
shows "cp (e#s) th' = cp s th'" |
58 | 159 |
by (rule eq_cp_pre[OF th_in_no_subtree[OF assms]]) |
55
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
160 |
|
56
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
161 |
end |
55
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
162 |
|
68 | 163 |
section {* The @{term V} operation *} |
164 |
||
56
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
165 |
text {* |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
166 |
The following @{text "step_v_cps"} is the locale for @{text "V"}-operation. |
55
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
167 |
*} |
b85cfbd58f59
Comments for Set-operation finished
xingyuan zhang <xingyuanzhang@126.com>
parents:
53
diff
changeset
|
168 |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
169 |
context valid_trace_v |
61 | 170 |
begin |
58 | 171 |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
172 |
lemma ancestors_th: "ancestors (RAG s) (Th th) = {}" |
58 | 173 |
proof - |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
174 |
from readys_root[OF th_ready_s] |
58 | 175 |
show ?thesis |
176 |
by (unfold root_def, simp) |
|
177 |
qed |
|
178 |
||
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
179 |
lemma edge_of_th: |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
180 |
"(Cs cs, Th th) \<in> RAG s" |
58 | 181 |
proof - |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
182 |
from holding_th_cs_s |
58 | 183 |
show ?thesis |
184 |
by (unfold s_RAG_def holding_eq, auto) |
|
185 |
qed |
|
186 |
||
187 |
lemma ancestors_cs: |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
188 |
"ancestors (RAG s) (Cs cs) = {Th th}" |
58 | 189 |
proof - |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
190 |
have "ancestors (RAG s) (Cs cs) = ancestors (RAG s) (Th th) \<union> {Th th}" |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
191 |
by (rule rtree_RAG.ancestors_accum[OF edge_of_th]) |
58 | 192 |
from this[unfolded ancestors_th] show ?thesis by simp |
193 |
qed |
|
194 |
||
195 |
end |
|
196 |
||
56
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
197 |
text {* |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
198 |
The following @{text "step_v_cps_nt"} is the sub-locale for @{text "V"}-operation, |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
199 |
which represents the case when there is another thread @{text "th'"} |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
200 |
to take over the critical resource released by the initiating thread @{text "th"}. |
0fd478e14e87
Before switching to generic theory of relational trees.
xingyuan zhang <xingyuanzhang@126.com>
parents:
55
diff
changeset
|
201 |
*} |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
202 |
|
113
ce85c3c4e5bf
More improvements in PIPBasics.thy and Implemenation.thy.
zhangx
parents:
108
diff
changeset
|
203 |
lemma (in valid_trace_v) |
ce85c3c4e5bf
More improvements in PIPBasics.thy and Implemenation.thy.
zhangx
parents:
108
diff
changeset
|
204 |
the_preced_es: "the_preced (e#s) = the_preced s" |
ce85c3c4e5bf
More improvements in PIPBasics.thy and Implemenation.thy.
zhangx
parents:
108
diff
changeset
|
205 |
proof |
ce85c3c4e5bf
More improvements in PIPBasics.thy and Implemenation.thy.
zhangx
parents:
108
diff
changeset
|
206 |
fix th' |
ce85c3c4e5bf
More improvements in PIPBasics.thy and Implemenation.thy.
zhangx
parents:
108
diff
changeset
|
207 |
show "the_preced (e # s) th' = the_preced s th'" |
ce85c3c4e5bf
More improvements in PIPBasics.thy and Implemenation.thy.
zhangx
parents:
108
diff
changeset
|
208 |
by (unfold the_preced_def preced_def is_v, simp) |
ce85c3c4e5bf
More improvements in PIPBasics.thy and Implemenation.thy.
zhangx
parents:
108
diff
changeset
|
209 |
qed |
ce85c3c4e5bf
More improvements in PIPBasics.thy and Implemenation.thy.
zhangx
parents:
108
diff
changeset
|
210 |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
211 |
context valid_trace_v_n |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
212 |
begin |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
213 |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
214 |
lemma sub_RAGs': |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
215 |
"{(Cs cs, Th th), (Th taker, Cs cs)} \<subseteq> RAG s" |
116 | 216 |
using waiting_taker holding_th_cs_s |
217 |
by (unfold s_RAG_def, fold waiting_eq holding_eq, auto) |
|
58 | 218 |
|
219 |
lemma ancestors_th': |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
220 |
"ancestors (RAG s) (Th taker) = {Th th, Cs cs}" |
58 | 221 |
proof - |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
222 |
have "ancestors (RAG s) (Th taker) = ancestors (RAG s) (Cs cs) \<union> {Cs cs}" |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
223 |
proof(rule rtree_RAG.ancestors_accum) |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
224 |
from sub_RAGs' show "(Th taker, Cs cs) \<in> RAG s" by auto |
58 | 225 |
qed |
226 |
thus ?thesis using ancestors_th ancestors_cs by auto |
|
227 |
qed |
|
228 |
||
35
92f61f6a0fe7
added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
33
diff
changeset
|
229 |
lemma RAG_s: |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
230 |
"RAG (e#s) = (RAG s - {(Cs cs, Th th), (Th taker, Cs cs)}) \<union> |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
231 |
{(Cs cs, Th taker)}" |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
232 |
by (unfold RAG_es waiting_set_eq holding_set_eq, auto) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
233 |
|
68 | 234 |
lemma subtree_kept: (* ddd *) |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
235 |
assumes "th1 \<notin> {th, taker}" |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
236 |
shows "subtree (RAG (e#s)) (Th th1) = |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
237 |
subtree (RAG s) (Th th1)" (is "_ = ?R") |
58 | 238 |
proof - |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
239 |
let ?RAG' = "(RAG s - {(Cs cs, Th th), (Th taker, Cs cs)})" |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
240 |
let ?RAG'' = "?RAG' \<union> {(Cs cs, Th taker)}" |
58 | 241 |
have "subtree ?RAG' (Th th1) = ?R" |
242 |
proof(rule subset_del_subtree_outside) |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
243 |
show "Range {(Cs cs, Th th), (Th taker, Cs cs)} \<inter> subtree (RAG s) (Th th1) = {}" |
58 | 244 |
proof - |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
245 |
have "(Th th) \<notin> subtree (RAG s) (Th th1)" |
58 | 246 |
proof(rule subtree_refute) |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
247 |
show "Th th1 \<notin> ancestors (RAG s) (Th th)" |
58 | 248 |
by (unfold ancestors_th, simp) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
249 |
next |
58 | 250 |
from assms show "Th th1 \<noteq> Th th" by simp |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
251 |
qed |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
252 |
moreover have "(Cs cs) \<notin> subtree (RAG s) (Th th1)" |
58 | 253 |
proof(rule subtree_refute) |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
254 |
show "Th th1 \<notin> ancestors (RAG s) (Cs cs)" |
58 | 255 |
by (unfold ancestors_cs, insert assms, auto) |
256 |
qed simp |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
257 |
ultimately have "{Th th, Cs cs} \<inter> subtree (RAG s) (Th th1) = {}" by auto |
58 | 258 |
thus ?thesis by simp |
259 |
qed |
|
260 |
qed |
|
261 |
moreover have "subtree ?RAG'' (Th th1) = subtree ?RAG' (Th th1)" |
|
262 |
proof(rule subtree_insert_next) |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
263 |
show "Th taker \<notin> subtree (RAG s - {(Cs cs, Th th), (Th taker, Cs cs)}) (Th th1)" |
58 | 264 |
proof(rule subtree_refute) |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
265 |
show "Th th1 \<notin> ancestors (RAG s - {(Cs cs, Th th), (Th taker, Cs cs)}) (Th taker)" |
58 | 266 |
(is "_ \<notin> ?R") |
267 |
proof - |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
268 |
have "?R \<subseteq> ancestors (RAG s) (Th taker)" by (rule ancestors_mono, auto) |
58 | 269 |
moreover have "Th th1 \<notin> ..." using ancestors_th' assms by simp |
270 |
ultimately show ?thesis by auto |
|
271 |
qed |
|
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
272 |
next |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
273 |
from assms show "Th th1 \<noteq> Th taker" by simp |
58 | 274 |
qed |
275 |
qed |
|
276 |
ultimately show ?thesis by (unfold RAG_s, simp) |
|
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
277 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
278 |
|
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
279 |
lemma cp_kept: |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
280 |
assumes "th1 \<notin> {th, taker}" |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
281 |
shows "cp (e#s) th1 = cp s th1" |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
282 |
by (unfold cp_alt_def the_preced_es subtree_kept[OF assms], simp) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
283 |
|
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
284 |
end |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
285 |
|
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
286 |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
287 |
context valid_trace_v_e |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
288 |
begin |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
289 |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
290 |
lemma RAG_s: "RAG (e#s) = RAG s - {(Cs cs, Th th)}" |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
291 |
by (unfold RAG_es waiting_set_eq holding_set_eq, simp) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
292 |
|
58 | 293 |
lemma subtree_kept: |
294 |
assumes "th1 \<noteq> th" |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
295 |
shows "subtree (RAG (e#s)) (Th th1) = subtree (RAG s) (Th th1)" |
58 | 296 |
proof(unfold RAG_s, rule subset_del_subtree_outside) |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
297 |
show "Range {(Cs cs, Th th)} \<inter> subtree (RAG s) (Th th1) = {}" |
58 | 298 |
proof - |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
299 |
have "(Th th) \<notin> subtree (RAG s) (Th th1)" |
58 | 300 |
proof(rule subtree_refute) |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
301 |
show "Th th1 \<notin> ancestors (RAG s) (Th th)" |
58 | 302 |
by (unfold ancestors_th, simp) |
303 |
next |
|
304 |
from assms show "Th th1 \<noteq> Th th" by simp |
|
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
305 |
qed |
58 | 306 |
thus ?thesis by auto |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
307 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
308 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
309 |
|
58 | 310 |
lemma cp_kept_1: |
311 |
assumes "th1 \<noteq> th" |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
312 |
shows "cp (e#s) th1 = cp s th1" |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
313 |
by (unfold cp_alt_def the_preced_es subtree_kept[OF assms], simp) |
58 | 314 |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
315 |
lemma subtree_cs: "subtree (RAG s) (Cs cs) = {Cs cs}" |
108 | 316 |
(is "?L = ?R") |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
317 |
proof - |
58 | 318 |
{ fix n |
108 | 319 |
assume "n \<in> ?L" |
320 |
hence "n \<in> ?R" |
|
321 |
proof(cases rule:subtreeE) |
|
322 |
case 2 |
|
323 |
from this(2) have "(n, Cs cs) \<in> (RAG s)^+" |
|
324 |
by (auto simp:ancestors_def) |
|
325 |
from tranclD2[OF this] |
|
326 |
obtain th' where "waiting s th' cs" |
|
327 |
by (auto simp:s_RAG_def waiting_eq) |
|
328 |
with no_waiter_before |
|
329 |
show ?thesis by simp |
|
330 |
qed simp |
|
331 |
} moreover { |
|
332 |
fix n |
|
333 |
assume "n \<in> ?R" |
|
334 |
hence "n \<in> ?L" by (auto simp:subtree_def) |
|
335 |
} ultimately show ?thesis by auto |
|
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
336 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
337 |
|
108 | 338 |
|
58 | 339 |
lemma subtree_th: |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
340 |
"subtree (RAG (e#s)) (Th th) = subtree (RAG s) (Th th) - {Cs cs}" |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
341 |
proof(unfold RAG_s, fold subtree_cs, rule rtree_RAG.subtree_del_inside) |
58 | 342 |
from edge_of_th |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
343 |
show "(Cs cs, Th th) \<in> edges_in (RAG s) (Th th)" |
58 | 344 |
by (unfold edges_in_def, auto simp:subtree_def) |
345 |
qed |
|
346 |
||
347 |
lemma cp_kept_2: |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
348 |
shows "cp (e#s) th = cp s th" |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
349 |
by (unfold cp_alt_def subtree_th the_preced_es, auto) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
350 |
|
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
351 |
lemma eq_cp: |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
352 |
shows "cp (e#s) th' = cp s th'" |
58 | 353 |
using cp_kept_1 cp_kept_2 |
354 |
by (cases "th' = th", auto) |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
355 |
|
58 | 356 |
end |
357 |
||
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
358 |
|
68 | 359 |
section {* The @{term P} operation *} |
360 |
||
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
361 |
context valid_trace_p |
58 | 362 |
begin |
363 |
||
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
364 |
lemma root_th: "root (RAG s) (Th th)" |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
365 |
by (simp add: ready_th_s readys_root) |
60 | 366 |
|
367 |
lemma in_no_others_subtree: |
|
368 |
assumes "th' \<noteq> th" |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
369 |
shows "Th th \<notin> subtree (RAG s) (Th th')" |
58 | 370 |
proof |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
371 |
assume "Th th \<in> subtree (RAG s) (Th th')" |
60 | 372 |
thus False |
373 |
proof(cases rule:subtreeE) |
|
374 |
case 1 |
|
375 |
with assms show ?thesis by auto |
|
376 |
next |
|
377 |
case 2 |
|
378 |
with root_th show ?thesis by (auto simp:root_def) |
|
379 |
qed |
|
58 | 380 |
qed |
381 |
||
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
382 |
lemma preced_kept: "the_preced (e#s) = the_preced s" |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
383 |
proof |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
384 |
fix th' |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
385 |
show "the_preced (e # s) th' = the_preced s th'" |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
386 |
by (unfold the_preced_def is_p preced_def, simp) |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
387 |
qed |
58 | 388 |
|
389 |
end |
|
390 |
||
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
391 |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
392 |
context valid_trace_p_h |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
393 |
begin |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
394 |
|
60 | 395 |
lemma subtree_kept: |
396 |
assumes "th' \<noteq> th" |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
397 |
shows "subtree (RAG (e#s)) (Th th') = subtree (RAG s) (Th th')" |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
398 |
proof(unfold RAG_es, rule subtree_insert_next) |
60 | 399 |
from in_no_others_subtree[OF assms] |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
400 |
show "Th th \<notin> subtree (RAG s) (Th th')" . |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
401 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
402 |
|
60 | 403 |
lemma cp_kept: |
404 |
assumes "th' \<noteq> th" |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
405 |
shows "cp (e#s) th' = cp s th'" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
406 |
proof - |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
407 |
have "(the_preced (e#s) ` {th'a. Th th'a \<in> subtree (RAG (e#s)) (Th th')}) = |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
408 |
(the_preced s ` {th'a. Th th'a \<in> subtree (RAG s) (Th th')})" |
60 | 409 |
by (unfold preced_kept subtree_kept[OF assms], simp) |
410 |
thus ?thesis by (unfold cp_alt_def, simp) |
|
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
411 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
412 |
|
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
413 |
end |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
414 |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
415 |
context valid_trace_p_w |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
416 |
begin |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
417 |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
418 |
lemma cs_held: "(Cs cs, Th holder) \<in> RAG s" |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
419 |
using holding_s_holder |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
420 |
by (unfold s_RAG_def, fold holding_eq, auto) |
58 | 421 |
|
422 |
lemma tRAG_s: |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
423 |
"tRAG (e#s) = tRAG s \<union> {(Th th, Th holder)}" |
113
ce85c3c4e5bf
More improvements in PIPBasics.thy and Implemenation.thy.
zhangx
parents:
108
diff
changeset
|
424 |
using RAG_tRAG_transfer[OF RAG_es cs_held] . |
58 | 425 |
|
426 |
lemma cp_kept: |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
427 |
assumes "Th th'' \<notin> ancestors (tRAG (e#s)) (Th th)" |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
428 |
shows "cp (e#s) th'' = cp s th''" |
58 | 429 |
proof - |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
430 |
have h: "subtree (tRAG (e#s)) (Th th'') = subtree (tRAG s) (Th th'')" |
58 | 431 |
proof - |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
432 |
have "Th holder \<notin> subtree (tRAG s) (Th th'')" |
58 | 433 |
proof |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
434 |
assume "Th holder \<in> subtree (tRAG s) (Th th'')" |
58 | 435 |
thus False |
436 |
proof(rule subtreeE) |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
437 |
assume "Th holder = Th th''" |
58 | 438 |
from assms[unfolded tRAG_s ancestors_def, folded this] |
439 |
show ?thesis by auto |
|
440 |
next |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
441 |
assume "Th th'' \<in> ancestors (tRAG s) (Th holder)" |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
442 |
moreover have "... \<subseteq> ancestors (tRAG (e#s)) (Th holder)" |
58 | 443 |
proof(rule ancestors_mono) |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
444 |
show "tRAG s \<subseteq> tRAG (e#s)" by (unfold tRAG_s, auto) |
58 | 445 |
qed |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
446 |
ultimately have "Th th'' \<in> ancestors (tRAG (e#s)) (Th holder)" by auto |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
447 |
moreover have "Th holder \<in> ancestors (tRAG (e#s)) (Th th)" |
58 | 448 |
by (unfold tRAG_s, auto simp:ancestors_def) |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
449 |
ultimately have "Th th'' \<in> ancestors (tRAG (e#s)) (Th th)" |
58 | 450 |
by (auto simp:ancestors_def) |
451 |
with assms show ?thesis by auto |
|
452 |
qed |
|
453 |
qed |
|
454 |
from subtree_insert_next[OF this] |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
455 |
have "subtree (tRAG s \<union> {(Th th, Th holder)}) (Th th'') = subtree (tRAG s) (Th th'')" . |
58 | 456 |
from this[folded tRAG_s] show ?thesis . |
457 |
qed |
|
458 |
show ?thesis by (unfold cp_alt_def1 h preced_kept, simp) |
|
459 |
qed |
|
460 |
||
60 | 461 |
lemma cp_gen_update_stop: (* ddd *) |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
462 |
assumes "u \<in> ancestors (tRAG (e#s)) (Th th)" |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
463 |
and "cp_gen (e#s) u = cp_gen s u" |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
464 |
and "y \<in> ancestors (tRAG (e#s)) u" |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
465 |
shows "cp_gen (e#s) y = cp_gen s y" |
58 | 466 |
using assms(3) |
102
3a801bbd2687
Reorganizing PIPBasics.thy and making small changes to Implementation.thy and Correctness.thy.
zhangx
parents:
93
diff
changeset
|
467 |
proof(induct rule:wf_induct[OF vat_es.fsbttRAGs.wf]) |
58 | 468 |
case (1 x) |
469 |
show ?case (is "?L = ?R") |
|
470 |
proof - |
|
471 |
from tRAG_ancestorsE[OF 1(2)] |
|
472 |
obtain th2 where eq_x: "x = Th th2" by blast |
|
102
3a801bbd2687
Reorganizing PIPBasics.thy and making small changes to Implementation.thy and Correctness.thy.
zhangx
parents:
93
diff
changeset
|
473 |
from vat_es.cp_gen_rec[OF this] |
58 | 474 |
have "?L = |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
475 |
Max ({the_preced (e#s) th2} \<union> cp_gen (e#s) ` RTree.children (tRAG (e#s)) x)" . |
58 | 476 |
also have "... = |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
477 |
Max ({the_preced s th2} \<union> cp_gen s ` RTree.children (tRAG s) x)" |
58 | 478 |
proof - |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
479 |
from preced_kept have "the_preced (e#s) th2 = the_preced s th2" by simp |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
480 |
moreover have "cp_gen (e#s) ` RTree.children (tRAG (e#s)) x = |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
481 |
cp_gen s ` RTree.children (tRAG s) x" |
58 | 482 |
proof - |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
483 |
have "RTree.children (tRAG (e#s)) x = RTree.children (tRAG s) x" |
58 | 484 |
proof(unfold tRAG_s, rule children_union_kept) |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
485 |
have start: "(Th th, Th holder) \<in> tRAG (e#s)" |
58 | 486 |
by (unfold tRAG_s, auto) |
487 |
note x_u = 1(2) |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
488 |
show "x \<notin> Range {(Th th, Th holder)}" |
58 | 489 |
proof |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
490 |
assume "x \<in> Range {(Th th, Th holder)}" |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
491 |
hence eq_x: "x = Th holder" using RangeE by auto |
58 | 492 |
show False |
102
3a801bbd2687
Reorganizing PIPBasics.thy and making small changes to Implementation.thy and Correctness.thy.
zhangx
parents:
93
diff
changeset
|
493 |
proof(cases rule:vat_es.ancestors_headE[OF assms(1) start]) |
58 | 494 |
case 1 |
102
3a801bbd2687
Reorganizing PIPBasics.thy and making small changes to Implementation.thy and Correctness.thy.
zhangx
parents:
93
diff
changeset
|
495 |
from x_u[folded this, unfolded eq_x] vat_es.acyclic_tRAG |
58 | 496 |
show ?thesis by (auto simp:ancestors_def acyclic_def) |
497 |
next |
|
498 |
case 2 |
|
499 |
with x_u[unfolded eq_x] |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
500 |
have "(Th holder, Th holder) \<in> (tRAG (e#s))^+" by (auto simp:ancestors_def) |
102
3a801bbd2687
Reorganizing PIPBasics.thy and making small changes to Implementation.thy and Correctness.thy.
zhangx
parents:
93
diff
changeset
|
501 |
with vat_es.acyclic_tRAG show ?thesis by (auto simp:acyclic_def) |
58 | 502 |
qed |
503 |
qed |
|
504 |
qed |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
505 |
moreover have "cp_gen (e#s) ` RTree.children (tRAG (e#s)) x = |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
506 |
cp_gen s ` RTree.children (tRAG (e#s)) x" (is "?f ` ?A = ?g ` ?A") |
58 | 507 |
proof(rule f_image_eq) |
508 |
fix a |
|
509 |
assume a_in: "a \<in> ?A" |
|
510 |
from 1(2) |
|
511 |
show "?f a = ?g a" |
|
102
3a801bbd2687
Reorganizing PIPBasics.thy and making small changes to Implementation.thy and Correctness.thy.
zhangx
parents:
93
diff
changeset
|
512 |
proof(cases rule:vat_es.rtree_s.ancestors_childrenE[case_names in_ch out_ch]) |
58 | 513 |
case in_ch |
514 |
show ?thesis |
|
515 |
proof(cases "a = u") |
|
516 |
case True |
|
517 |
from assms(2)[folded this] show ?thesis . |
|
518 |
next |
|
519 |
case False |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
520 |
have a_not_in: "a \<notin> ancestors (tRAG (e#s)) (Th th)" |
58 | 521 |
proof |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
522 |
assume a_in': "a \<in> ancestors (tRAG (e#s)) (Th th)" |
58 | 523 |
have "a = u" |
102
3a801bbd2687
Reorganizing PIPBasics.thy and making small changes to Implementation.thy and Correctness.thy.
zhangx
parents:
93
diff
changeset
|
524 |
proof(rule vat_es.rtree_s.ancestors_children_unique) |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
525 |
from a_in' a_in show "a \<in> ancestors (tRAG (e#s)) (Th th) \<inter> |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
526 |
RTree.children (tRAG (e#s)) x" by auto |
58 | 527 |
next |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
528 |
from assms(1) in_ch show "u \<in> ancestors (tRAG (e#s)) (Th th) \<inter> |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
529 |
RTree.children (tRAG (e#s)) x" by auto |
58 | 530 |
qed |
531 |
with False show False by simp |
|
532 |
qed |
|
533 |
from a_in obtain th_a where eq_a: "a = Th th_a" |
|
534 |
by (unfold RTree.children_def tRAG_alt_def, auto) |
|
535 |
from cp_kept[OF a_not_in[unfolded eq_a]] |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
536 |
have "cp (e#s) th_a = cp s th_a" . |
58 | 537 |
from this [unfolded cp_gen_def_cond[OF eq_a], folded eq_a] |
538 |
show ?thesis . |
|
539 |
qed |
|
540 |
next |
|
541 |
case (out_ch z) |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
542 |
hence h: "z \<in> ancestors (tRAG (e#s)) u" "z \<in> RTree.children (tRAG (e#s)) x" by auto |
58 | 543 |
show ?thesis |
544 |
proof(cases "a = z") |
|
545 |
case True |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
546 |
from h(2) have zx_in: "(z, x) \<in> (tRAG (e#s))" by (auto simp:RTree.children_def) |
58 | 547 |
from 1(1)[rule_format, OF this h(1)] |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
548 |
have eq_cp_gen: "cp_gen (e#s) z = cp_gen s z" . |
58 | 549 |
with True show ?thesis by metis |
550 |
next |
|
551 |
case False |
|
552 |
from a_in obtain th_a where eq_a: "a = Th th_a" |
|
553 |
by (auto simp:RTree.children_def tRAG_alt_def) |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
554 |
have "a \<notin> ancestors (tRAG (e#s)) (Th th)" |
60 | 555 |
proof |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
556 |
assume a_in': "a \<in> ancestors (tRAG (e#s)) (Th th)" |
60 | 557 |
have "a = z" |
102
3a801bbd2687
Reorganizing PIPBasics.thy and making small changes to Implementation.thy and Correctness.thy.
zhangx
parents:
93
diff
changeset
|
558 |
proof(rule vat_es.rtree_s.ancestors_children_unique) |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
559 |
from assms(1) h(1) have "z \<in> ancestors (tRAG (e#s)) (Th th)" |
60 | 560 |
by (auto simp:ancestors_def) |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
561 |
with h(2) show " z \<in> ancestors (tRAG (e#s)) (Th th) \<inter> |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
562 |
RTree.children (tRAG (e#s)) x" by auto |
60 | 563 |
next |
564 |
from a_in a_in' |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
565 |
show "a \<in> ancestors (tRAG (e#s)) (Th th) \<inter> RTree.children (tRAG (e#s)) x" |
60 | 566 |
by auto |
567 |
qed |
|
568 |
with False show False by auto |
|
569 |
qed |
|
58 | 570 |
from cp_kept[OF this[unfolded eq_a]] |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
571 |
have "cp (e#s) th_a = cp s th_a" . |
58 | 572 |
from this[unfolded cp_gen_def_cond[OF eq_a], folded eq_a] |
573 |
show ?thesis . |
|
574 |
qed |
|
575 |
qed |
|
576 |
qed |
|
577 |
ultimately show ?thesis by metis |
|
578 |
qed |
|
579 |
ultimately show ?thesis by simp |
|
580 |
qed |
|
581 |
also have "... = ?R" |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
582 |
by (fold cp_gen_rec[OF eq_x], simp) |
58 | 583 |
finally show ?thesis . |
584 |
qed |
|
585 |
qed |
|
586 |
||
60 | 587 |
lemma cp_up: |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
588 |
assumes "(Th th') \<in> ancestors (tRAG (e#s)) (Th th)" |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
589 |
and "cp (e#s) th' = cp s th'" |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
590 |
and "(Th th'') \<in> ancestors (tRAG (e#s)) (Th th')" |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
591 |
shows "cp (e#s) th'' = cp s th''" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
592 |
proof - |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
593 |
have "cp_gen (e#s) (Th th'') = cp_gen s (Th th'')" |
60 | 594 |
proof(rule cp_gen_update_stop[OF assms(1) _ assms(3)]) |
595 |
from assms(2) cp_gen_def_cond[OF refl[of "Th th'"]] |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
596 |
show "cp_gen (e#s) (Th th') = cp_gen s (Th th')" by metis |
60 | 597 |
qed |
598 |
with cp_gen_def_cond[OF refl[of "Th th''"]] |
|
599 |
show ?thesis by metis |
|
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
600 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
601 |
|
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
602 |
end |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
603 |
|
68 | 604 |
section {* The @{term Create} operation *} |
605 |
||
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
606 |
context valid_trace_create |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
607 |
begin |
60 | 608 |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
609 |
lemma tRAG_kept: "tRAG (e#s) = tRAG s" |
113
ce85c3c4e5bf
More improvements in PIPBasics.thy and Implemenation.thy.
zhangx
parents:
108
diff
changeset
|
610 |
by (unfold tRAG_alt_def RAG_es, auto) |
60 | 611 |
|
612 |
lemma preced_kept: |
|
613 |
assumes "th' \<noteq> th" |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
614 |
shows "the_preced (e#s) th' = the_preced s th'" |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
615 |
by (unfold the_preced_def preced_def is_create, insert assms, auto) |
60 | 616 |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
617 |
lemma th_not_in: "Th th \<notin> Field (tRAG s)" |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
618 |
by (meson not_in_thread_isolated subsetCE tRAG_Field th_not_live_s) |
60 | 619 |
|
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
620 |
lemma eq_cp: |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
621 |
assumes neq_th: "th' \<noteq> th" |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
622 |
shows "cp (e#s) th' = cp s th'" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
623 |
proof - |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
624 |
have "(the_preced (e#s) \<circ> the_thread) ` subtree (tRAG (e#s)) (Th th') = |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
625 |
(the_preced s \<circ> the_thread) ` subtree (tRAG s) (Th th')" |
60 | 626 |
proof(unfold tRAG_kept, rule f_image_eq) |
627 |
fix a |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
628 |
assume a_in: "a \<in> subtree (tRAG s) (Th th')" |
60 | 629 |
then obtain th_a where eq_a: "a = Th th_a" |
630 |
proof(cases rule:subtreeE) |
|
631 |
case 2 |
|
632 |
from ancestors_Field[OF 2(2)] |
|
633 |
and that show ?thesis by (unfold tRAG_alt_def, auto) |
|
634 |
qed auto |
|
635 |
have neq_th_a: "th_a \<noteq> th" |
|
636 |
proof - |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
637 |
have "(Th th) \<notin> subtree (tRAG s) (Th th')" |
60 | 638 |
proof |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
639 |
assume "Th th \<in> subtree (tRAG s) (Th th')" |
60 | 640 |
thus False |
641 |
proof(cases rule:subtreeE) |
|
642 |
case 2 |
|
643 |
from ancestors_Field[OF this(2)] |
|
644 |
and th_not_in[unfolded Field_def] |
|
645 |
show ?thesis by auto |
|
646 |
qed (insert assms, auto) |
|
647 |
qed |
|
648 |
with a_in[unfolded eq_a] show ?thesis by auto |
|
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
649 |
qed |
60 | 650 |
from preced_kept[OF this] |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
651 |
show "(the_preced (e#s) \<circ> the_thread) a = (the_preced s \<circ> the_thread) a" |
60 | 652 |
by (unfold eq_a, simp) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
653 |
qed |
60 | 654 |
thus ?thesis by (unfold cp_alt_def1, simp) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
655 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
656 |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
657 |
lemma children_of_th: "RTree.children (tRAG (e#s)) (Th th) = {}" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
658 |
proof - |
60 | 659 |
{ fix a |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
660 |
assume "a \<in> RTree.children (tRAG (e#s)) (Th th)" |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
661 |
hence "(a, Th th) \<in> tRAG (e#s)" by (auto simp:RTree.children_def) |
60 | 662 |
with th_not_in have False |
663 |
by (unfold Field_def tRAG_kept, auto) |
|
664 |
} thus ?thesis by auto |
|
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
665 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
666 |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
667 |
lemma eq_cp_th: "cp (e#s) th = preced th (e#s)" |
102
3a801bbd2687
Reorganizing PIPBasics.thy and making small changes to Implementation.thy and Correctness.thy.
zhangx
parents:
93
diff
changeset
|
668 |
by (unfold vat_es.cp_rec children_of_th, simp add:the_preced_def) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
669 |
|
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
670 |
end |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
671 |
|
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
672 |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
673 |
context valid_trace_exit |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
674 |
begin |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
675 |
|
60 | 676 |
lemma preced_kept: |
677 |
assumes "th' \<noteq> th" |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
678 |
shows "the_preced (e#s) th' = the_preced s th'" |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
679 |
using assms |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
680 |
by (unfold the_preced_def is_exit preced_def, simp) |
60 | 681 |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
682 |
lemma tRAG_kept: "tRAG (e#s) = tRAG s" |
113
ce85c3c4e5bf
More improvements in PIPBasics.thy and Implemenation.thy.
zhangx
parents:
108
diff
changeset
|
683 |
by (unfold tRAG_alt_def RAG_es, auto) |
60 | 684 |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
685 |
lemma th_RAG: "Th th \<notin> Field (RAG s)" |
60 | 686 |
proof - |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
687 |
have "Th th \<notin> Range (RAG s)" |
60 | 688 |
proof |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
689 |
assume "Th th \<in> Range (RAG s)" |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
690 |
then obtain cs where "holding (wq s) th cs" |
60 | 691 |
by (unfold Range_iff s_RAG_def, auto) |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
692 |
with holdents_th_s[unfolded holdents_def] |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
693 |
show False by (unfold holding_eq, auto) |
60 | 694 |
qed |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
695 |
moreover have "Th th \<notin> Domain (RAG s)" |
60 | 696 |
proof |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
697 |
assume "Th th \<in> Domain (RAG s)" |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
698 |
then obtain cs where "waiting (wq s) th cs" |
60 | 699 |
by (unfold Domain_iff s_RAG_def, auto) |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
700 |
with th_ready_s show False by (unfold readys_def waiting_eq, auto) |
60 | 701 |
qed |
702 |
ultimately show ?thesis by (auto simp:Field_def) |
|
703 |
qed |
|
704 |
||
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
705 |
lemma th_tRAG: "(Th th) \<notin> Field (tRAG s)" |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
706 |
using th_RAG tRAG_Field by auto |
60 | 707 |
|
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
708 |
lemma eq_cp: |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
709 |
assumes neq_th: "th' \<noteq> th" |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
710 |
shows "cp (e#s) th' = cp s th'" |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
711 |
proof - |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
712 |
have "(the_preced (e#s) \<circ> the_thread) ` subtree (tRAG (e#s)) (Th th') = |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
713 |
(the_preced s \<circ> the_thread) ` subtree (tRAG s) (Th th')" |
60 | 714 |
proof(unfold tRAG_kept, rule f_image_eq) |
715 |
fix a |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
716 |
assume a_in: "a \<in> subtree (tRAG s) (Th th')" |
60 | 717 |
then obtain th_a where eq_a: "a = Th th_a" |
718 |
proof(cases rule:subtreeE) |
|
719 |
case 2 |
|
720 |
from ancestors_Field[OF 2(2)] |
|
721 |
and that show ?thesis by (unfold tRAG_alt_def, auto) |
|
722 |
qed auto |
|
723 |
have neq_th_a: "th_a \<noteq> th" |
|
724 |
proof - |
|
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
725 |
from readys_in_no_subtree[OF th_ready_s assms] |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
726 |
have "(Th th) \<notin> subtree (RAG s) (Th th')" . |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
727 |
with tRAG_subtree_RAG[of s "Th th'"] |
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
728 |
have "(Th th) \<notin> subtree (tRAG s) (Th th')" by auto |
60 | 729 |
with a_in[unfolded eq_a] show ?thesis by auto |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
730 |
qed |
60 | 731 |
from preced_kept[OF this] |
92
4763aa246dbd
Original files overwrite by their parallels (Correctness.thy v.s. PrioG.thy, PIPBasics.thy v.s. CpsG.thy, Implementation v.s. ExtGG.thy).
zhangx
parents:
68
diff
changeset
|
732 |
show "(the_preced (e#s) \<circ> the_thread) a = (the_preced s \<circ> the_thread) a" |
60 | 733 |
by (unfold eq_a, simp) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
734 |
qed |
60 | 735 |
thus ?thesis by (unfold cp_alt_def1, simp) |
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
736 |
qed |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
737 |
|
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
738 |
end |
60 | 739 |
|
0
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
740 |
end |
110247f9d47e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
741 |