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