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