author | Christian Urban <christian dot urban at kcl dot ac dot uk> |
Tue, 14 Jun 2016 15:06:16 +0100 | |
changeset 129 | e3cf792db636 |
parent 1 | c4783e4ef43f |
permissions | -rw-r--r-- |
1
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1 |
theory ExtS |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2 |
imports Prio |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
3 |
begin |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
4 |
|
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
5 |
locale highest_set = |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
6 |
fixes s' th prio fixes s |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
7 |
defines s_def : "s \<equiv> (Set th prio#s')" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
8 |
assumes vt_s: "vt step s" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
9 |
and highest: "preced th s = Max ((cp s)`threads s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
10 |
|
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
11 |
context highest_set |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
12 |
begin |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
13 |
|
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
14 |
|
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
15 |
lemma vt_s': "vt step s'" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
16 |
by (insert vt_s, unfold s_def, drule_tac step_back_vt, simp) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
17 |
|
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
18 |
lemma step_set: "step s' (Set th prio)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
19 |
by (insert vt_s, unfold s_def, drule_tac step_back_step, simp) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
20 |
|
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
21 |
lemma step_set_elim: |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
22 |
"\<lbrakk>\<lbrakk>th \<in> runing s'\<rbrakk> \<Longrightarrow> Q\<rbrakk> \<Longrightarrow> Q" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
23 |
by (insert step_set, ind_cases "step s' (Set th prio)", auto) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
24 |
|
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
25 |
|
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
26 |
lemma threads_s: "th \<in> threads s" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
27 |
by (rule step_set_elim, unfold runing_def readys_def, auto simp:s_def) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
28 |
|
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
29 |
lemma same_depend: "depend s = depend s'" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
30 |
by (insert depend_set_unchanged, unfold s_def, simp) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
31 |
|
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
32 |
lemma same_dependents: |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
33 |
"dependents (wq s) th = dependents (wq s') th" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
34 |
apply (unfold cs_dependents_def) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
35 |
by (unfold eq_depend same_depend, simp) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
36 |
|
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
37 |
lemma eq_cp_s_th: "cp s th = preced th s" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
38 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
39 |
from highest and max_cp_eq[OF vt_s] |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
40 |
have is_max: "preced th s = Max ((\<lambda>th. preced th s) ` threads s)" by simp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
41 |
have sbs: "({th} \<union> dependents (wq s) th) \<subseteq> threads s" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
42 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
43 |
from threads_s and dependents_threads[OF vt_s, of th] |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
44 |
show ?thesis by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
45 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
46 |
show ?thesis |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
47 |
proof(unfold cp_eq_cpreced cpreced_def, rule Max_eqI) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
48 |
show "preced th s \<in> (\<lambda>th. preced th s) ` ({th} \<union> dependents (wq s) th)" by simp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
49 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
50 |
fix y |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
51 |
assume "y \<in> (\<lambda>th. preced th s) ` ({th} \<union> dependents (wq s) th)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
52 |
then obtain th1 where th1_in: "th1 \<in> ({th} \<union> dependents (wq s) th)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
53 |
and eq_y: "y = preced th1 s" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
54 |
show "y \<le> preced th s" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
55 |
proof(unfold is_max, rule Max_ge) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
56 |
from finite_threads[OF vt_s] |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
57 |
show "finite ((\<lambda>th. preced th s) ` threads s)" by simp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
58 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
59 |
from sbs th1_in and eq_y |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
60 |
show "y \<in> (\<lambda>th. preced th s) ` threads s" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
61 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
62 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
63 |
from sbs and finite_threads[OF vt_s] |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
64 |
show "finite ((\<lambda>th. preced th s) ` ({th} \<union> dependents (wq s) th))" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
65 |
by (auto intro:finite_subset) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
66 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
67 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
68 |
|
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
69 |
lemma highest_cp_preced: "cp s th = Max ((\<lambda> th'. preced th' s) ` threads s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
70 |
by (fold max_cp_eq[OF vt_s], unfold eq_cp_s_th, insert highest, simp) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
71 |
|
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
72 |
lemma highest_preced_thread: "preced th s = Max ((\<lambda> th'. preced th' s) ` threads s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
73 |
by (fold eq_cp_s_th, unfold highest_cp_preced, simp) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
74 |
|
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
75 |
lemma is_ready: "th \<in> readys s" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
76 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
77 |
have "\<forall>cs. \<not> waiting s th cs" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
78 |
apply (rule step_set_elim, unfold s_def, insert depend_set_unchanged[of th prio s']) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
79 |
apply (unfold s_depend_def, unfold runing_def readys_def) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
80 |
apply (auto, fold s_def) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
81 |
apply (erule_tac x = cs in allE, auto simp:waiting_eq) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
82 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
83 |
fix cs |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
84 |
assume h: |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
85 |
"{(Th t, Cs c) |t c. waiting (wq s) t c} \<union> {(Cs c, Th t) |c t. holding (wq s) t c} = |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
86 |
{(Th t, Cs c) |t c. waiting (wq s') t c} \<union> {(Cs c, Th t) |c t. holding (wq s') t c}" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
87 |
(is "?L = ?R") |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
88 |
and wt: "waiting (wq s) th cs" and nwt: "\<not> waiting (wq s') th cs" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
89 |
from wt have "(Th th, Cs cs) \<in> ?L" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
90 |
with h have "(Th th, Cs cs) \<in> ?R" by simp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
91 |
hence "waiting (wq s') th cs" by auto with nwt |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
92 |
show False by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
93 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
94 |
with threads_s show ?thesis |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
95 |
by (unfold readys_def, auto) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
96 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
97 |
|
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
98 |
lemma highest': "cp s th = Max (cp s ` threads s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
99 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
100 |
from highest_cp_preced max_cp_eq[OF vt_s, symmetric] |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
101 |
show ?thesis by simp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
102 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
103 |
|
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
104 |
lemma is_runing: "th \<in> runing s" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
105 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
106 |
have "Max (cp s ` threads s) = Max (cp s ` readys s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
107 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
108 |
have " Max (cp s ` readys s) = cp s th" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
109 |
proof(rule Max_eqI) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
110 |
from finite_threads[OF vt_s] readys_threads finite_subset |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
111 |
have "finite (readys s)" by blast |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
112 |
thus "finite (cp s ` readys s)" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
113 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
114 |
from is_ready show "cp s th \<in> cp s ` readys s" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
115 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
116 |
fix y |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
117 |
assume "y \<in> cp s ` readys s" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
118 |
then obtain th1 where |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
119 |
eq_y: "y = cp s th1" and th1_in: "th1 \<in> readys s" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
120 |
show "y \<le> cp s th" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
121 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
122 |
have "y \<le> Max (cp s ` threads s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
123 |
proof(rule Max_ge) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
124 |
from eq_y and th1_in |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
125 |
show "y \<in> cp s ` threads s" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
126 |
by (auto simp:readys_def) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
127 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
128 |
from finite_threads[OF vt_s] |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
129 |
show "finite (cp s ` threads s)" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
130 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
131 |
with highest' show ?thesis by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
132 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
133 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
134 |
with highest' show ?thesis by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
135 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
136 |
thus ?thesis |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
137 |
by (unfold runing_def, insert highest' is_ready, auto) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
138 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
139 |
|
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
140 |
end |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
141 |
|
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
142 |
locale extend_highest_set = highest_set + |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
143 |
fixes t |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
144 |
assumes vt_t: "vt step (t@s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
145 |
and create_low: "Create th' prio' \<in> set t \<Longrightarrow> prio' \<le> prio" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
146 |
and set_diff_low: "Set th' prio' \<in> set t \<Longrightarrow> th' \<noteq> th \<and> prio' \<le> prio" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
147 |
and exit_diff: "Exit th' \<in> set t \<Longrightarrow> th' \<noteq> th" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
148 |
|
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
149 |
lemma step_back_vt_app: |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
150 |
assumes vt_ts: "vt cs (t@s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
151 |
shows "vt cs s" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
152 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
153 |
from vt_ts show ?thesis |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
154 |
proof(induct t) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
155 |
case Nil |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
156 |
from Nil show ?case by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
157 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
158 |
case (Cons e t) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
159 |
assume ih: " vt cs (t @ s) \<Longrightarrow> vt cs s" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
160 |
and vt_et: "vt cs ((e # t) @ s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
161 |
show ?case |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
162 |
proof(rule ih) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
163 |
show "vt cs (t @ s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
164 |
proof(rule step_back_vt) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
165 |
from vt_et show "vt cs (e # t @ s)" by simp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
166 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
167 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
168 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
169 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
170 |
|
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
171 |
context extend_highest_set |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
172 |
begin |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
173 |
|
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
174 |
lemma red_moment: |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
175 |
"extend_highest_set s' th prio (moment i t)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
176 |
apply (insert extend_highest_set_axioms, subst (asm) (1) moment_restm_s [of i t, symmetric]) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
177 |
apply (unfold extend_highest_set_def extend_highest_set_axioms_def, clarsimp) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
178 |
by (unfold highest_set_def, auto dest:step_back_vt_app) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
179 |
|
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
180 |
lemma ind [consumes 0, case_names Nil Cons, induct type]: |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
181 |
assumes |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
182 |
h0: "R []" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
183 |
and h2: "\<And> e t. \<lbrakk>vt step (t@s); step (t@s) e; |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
184 |
extend_highest_set s' th prio t; |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
185 |
extend_highest_set s' th prio (e#t); R t\<rbrakk> \<Longrightarrow> R (e#t)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
186 |
shows "R t" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
187 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
188 |
from vt_t extend_highest_set_axioms show ?thesis |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
189 |
proof(induct t) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
190 |
from h0 show "R []" . |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
191 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
192 |
case (Cons e t') |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
193 |
assume ih: "\<lbrakk>vt step (t' @ s); extend_highest_set s' th prio t'\<rbrakk> \<Longrightarrow> R t'" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
194 |
and vt_e: "vt step ((e # t') @ s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
195 |
and et: "extend_highest_set s' th prio (e # t')" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
196 |
from vt_e and step_back_step have stp: "step (t'@s) e" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
197 |
from vt_e and step_back_vt have vt_ts: "vt step (t'@s)" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
198 |
show ?case |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
199 |
proof(rule h2 [OF vt_ts stp _ _ _ ]) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
200 |
show "R t'" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
201 |
proof(rule ih) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
202 |
from et show ext': "extend_highest_set s' th prio t'" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
203 |
by (unfold extend_highest_set_def extend_highest_set_axioms_def, auto dest:step_back_vt) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
204 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
205 |
from vt_ts show "vt step (t' @ s)" . |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
206 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
207 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
208 |
from et show "extend_highest_set s' th prio (e # t')" . |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
209 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
210 |
from et show ext': "extend_highest_set s' th prio t'" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
211 |
by (unfold extend_highest_set_def extend_highest_set_axioms_def, auto dest:step_back_vt) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
212 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
213 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
214 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
215 |
|
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
216 |
lemma th_kept: "th \<in> threads (t @ s) \<and> |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
217 |
preced th (t@s) = preced th s" (is "?Q t") |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
218 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
219 |
show ?thesis |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
220 |
proof(induct rule:ind) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
221 |
case Nil |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
222 |
from threads_s |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
223 |
show "th \<in> threads ([] @ s) \<and> preced th ([] @ s) = preced th s" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
224 |
by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
225 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
226 |
case (Cons e t) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
227 |
show ?case |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
228 |
proof(cases e) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
229 |
case (Create thread prio) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
230 |
assume eq_e: " e = Create thread prio" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
231 |
show ?thesis |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
232 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
233 |
from Cons and eq_e have "step (t@s) (Create thread prio)" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
234 |
hence "th \<noteq> thread" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
235 |
proof(cases) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
236 |
assume "thread \<notin> threads (t @ s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
237 |
with Cons show ?thesis by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
238 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
239 |
hence "preced th ((e # t) @ s) = preced th (t @ s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
240 |
by (unfold eq_e, auto simp:preced_def) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
241 |
moreover note Cons |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
242 |
ultimately show ?thesis |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
243 |
by (auto simp:eq_e) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
244 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
245 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
246 |
case (Exit thread) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
247 |
assume eq_e: "e = Exit thread" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
248 |
from Cons have "extend_highest_set s' th prio (e # t)" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
249 |
from extend_highest_set.exit_diff [OF this] and eq_e |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
250 |
have neq_th: "thread \<noteq> th" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
251 |
with Cons |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
252 |
show ?thesis |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
253 |
by (unfold eq_e, auto simp:preced_def) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
254 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
255 |
case (P thread cs) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
256 |
assume eq_e: "e = P thread cs" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
257 |
with Cons |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
258 |
show ?thesis |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
259 |
by (auto simp:eq_e preced_def) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
260 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
261 |
case (V thread cs) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
262 |
assume eq_e: "e = V thread cs" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
263 |
with Cons |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
264 |
show ?thesis |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
265 |
by (auto simp:eq_e preced_def) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
266 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
267 |
case (Set thread prio') |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
268 |
assume eq_e: " e = Set thread prio'" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
269 |
show ?thesis |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
270 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
271 |
from Cons have "extend_highest_set s' th prio (e # t)" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
272 |
from extend_highest_set.set_diff_low[OF this] and eq_e |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
273 |
have "th \<noteq> thread" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
274 |
hence "preced th ((e # t) @ s) = preced th (t @ s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
275 |
by (unfold eq_e, auto simp:preced_def) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
276 |
moreover note Cons |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
277 |
ultimately show ?thesis |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
278 |
by (auto simp:eq_e) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
279 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
280 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
281 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
282 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
283 |
|
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
284 |
lemma max_kept: "Max ((\<lambda> th'. preced th' (t @ s)) ` (threads (t@s))) = preced th s" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
285 |
proof(induct rule:ind) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
286 |
case Nil |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
287 |
from highest_preced_thread |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
288 |
show "Max ((\<lambda>th'. preced th' ([] @ s)) ` threads ([] @ s)) = preced th s" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
289 |
by simp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
290 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
291 |
case (Cons e t) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
292 |
show ?case |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
293 |
proof(cases e) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
294 |
case (Create thread prio') |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
295 |
assume eq_e: " e = Create thread prio'" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
296 |
from Cons and eq_e have stp: "step (t@s) (Create thread prio')" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
297 |
hence neq_thread: "thread \<noteq> th" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
298 |
proof(cases) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
299 |
assume "thread \<notin> threads (t @ s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
300 |
moreover have "th \<in> threads (t@s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
301 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
302 |
from Cons have "extend_highest_set s' th prio t" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
303 |
from extend_highest_set.th_kept[OF this] show ?thesis by (simp add:s_def) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
304 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
305 |
ultimately show ?thesis by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
306 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
307 |
from Cons have "extend_highest_set s' th prio t" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
308 |
from extend_highest_set.th_kept[OF this] |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
309 |
have h': " th \<in> threads (t @ s) \<and> preced th (t @ s) = preced th s" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
310 |
by (auto simp:s_def) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
311 |
from stp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
312 |
have thread_ts: "thread \<notin> threads (t @ s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
313 |
by (cases, auto) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
314 |
show ?thesis (is "Max (?f ` ?A) = ?t") |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
315 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
316 |
have "Max (?f ` ?A) = Max(insert (?f thread) (?f ` (threads (t@s))))" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
317 |
by (unfold eq_e, simp) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
318 |
moreover have "\<dots> = max (?f thread) (Max (?f ` (threads (t@s))))" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
319 |
proof(rule Max_insert) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
320 |
from Cons have "vt step (t @ s)" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
321 |
from finite_threads[OF this] |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
322 |
show "finite (?f ` (threads (t@s)))" by simp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
323 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
324 |
from h' show "(?f ` (threads (t@s))) \<noteq> {}" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
325 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
326 |
moreover have "(Max (?f ` (threads (t@s)))) = ?t" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
327 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
328 |
have "(\<lambda>th'. preced th' ((e # t) @ s)) ` threads (t @ s) = |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
329 |
(\<lambda>th'. preced th' (t @ s)) ` threads (t @ s)" (is "?f1 ` ?B = ?f2 ` ?B") |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
330 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
331 |
{ fix th' |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
332 |
assume "th' \<in> ?B" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
333 |
with thread_ts eq_e |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
334 |
have "?f1 th' = ?f2 th'" by (auto simp:preced_def) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
335 |
} thus ?thesis |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
336 |
apply (auto simp:Image_def) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
337 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
338 |
fix th' |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
339 |
assume h: "\<And>th'. th' \<in> threads (t @ s) \<Longrightarrow> |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
340 |
preced th' (e # t @ s) = preced th' (t @ s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
341 |
and h1: "th' \<in> threads (t @ s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
342 |
show "preced th' (t @ s) \<in> (\<lambda>th'. preced th' (e # t @ s)) ` threads (t @ s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
343 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
344 |
from h1 have "?f1 th' \<in> ?f1 ` ?B" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
345 |
moreover from h[OF h1] have "?f1 th' = ?f2 th'" by simp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
346 |
ultimately show ?thesis by simp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
347 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
348 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
349 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
350 |
with Cons show ?thesis by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
351 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
352 |
moreover have "?f thread < ?t" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
353 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
354 |
from Cons have " extend_highest_set s' th prio (e # t)" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
355 |
from extend_highest_set.create_low[OF this] and eq_e |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
356 |
have "prio' \<le> prio" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
357 |
thus ?thesis |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
358 |
by (unfold eq_e, auto simp:preced_def s_def precedence_less_def) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
359 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
360 |
ultimately show ?thesis by (auto simp:max_def) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
361 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
362 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
363 |
case (Exit thread) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
364 |
assume eq_e: "e = Exit thread" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
365 |
from Cons have vt_e: "vt step (e#(t @ s))" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
366 |
from Cons and eq_e have stp: "step (t@s) (Exit thread)" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
367 |
from stp have thread_ts: "thread \<in> threads (t @ s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
368 |
by(cases, unfold runing_def readys_def, auto) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
369 |
from Cons have "extend_highest_set s' th prio (e # t)" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
370 |
from extend_highest_set.exit_diff[OF this] and eq_e |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
371 |
have neq_thread: "thread \<noteq> th" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
372 |
from Cons have "extend_highest_set s' th prio t" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
373 |
from extend_highest_set.th_kept[OF this, folded s_def] |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
374 |
have h': "th \<in> threads (t @ s) \<and> preced th (t @ s) = preced th s" . |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
375 |
show ?thesis (is "Max (?f ` ?A) = ?t") |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
376 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
377 |
have "threads (t@s) = insert thread ?A" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
378 |
by (insert stp thread_ts, unfold eq_e, auto) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
379 |
hence "Max (?f ` (threads (t@s))) = Max (?f ` \<dots>)" by simp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
380 |
also from this have "\<dots> = Max (insert (?f thread) (?f ` ?A))" by simp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
381 |
also have "\<dots> = max (?f thread) (Max (?f ` ?A))" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
382 |
proof(rule Max_insert) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
383 |
from finite_threads [OF vt_e] |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
384 |
show "finite (?f ` ?A)" by simp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
385 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
386 |
from Cons have "extend_highest_set s' th prio (e # t)" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
387 |
from extend_highest_set.th_kept[OF this] |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
388 |
show "?f ` ?A \<noteq> {}" by (auto simp:s_def) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
389 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
390 |
finally have "Max (?f ` (threads (t@s))) = max (?f thread) (Max (?f ` ?A))" . |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
391 |
moreover have "Max (?f ` (threads (t@s))) = ?t" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
392 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
393 |
from Cons show ?thesis |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
394 |
by (unfold eq_e, auto simp:preced_def) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
395 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
396 |
ultimately have "max (?f thread) (Max (?f ` ?A)) = ?t" by simp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
397 |
moreover have "?f thread < ?t" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
398 |
proof(unfold eq_e, simp add:preced_def, fold preced_def) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
399 |
show "preced thread (t @ s) < ?t" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
400 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
401 |
have "preced thread (t @ s) \<le> ?t" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
402 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
403 |
from Cons |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
404 |
have "?t = Max ((\<lambda>th'. preced th' (t @ s)) ` threads (t @ s))" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
405 |
(is "?t = Max (?g ` ?B)") by simp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
406 |
moreover have "?g thread \<le> \<dots>" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
407 |
proof(rule Max_ge) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
408 |
have "vt step (t@s)" by fact |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
409 |
from finite_threads [OF this] |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
410 |
show "finite (?g ` ?B)" by simp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
411 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
412 |
from thread_ts |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
413 |
show "?g thread \<in> (?g ` ?B)" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
414 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
415 |
ultimately show ?thesis by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
416 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
417 |
moreover have "preced thread (t @ s) \<noteq> ?t" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
418 |
proof |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
419 |
assume "preced thread (t @ s) = preced th s" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
420 |
with h' have "preced thread (t @ s) = preced th (t@s)" by simp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
421 |
from preced_unique [OF this] have "thread = th" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
422 |
proof |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
423 |
from h' show "th \<in> threads (t @ s)" by simp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
424 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
425 |
from thread_ts show "thread \<in> threads (t @ s)" . |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
426 |
qed(simp) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
427 |
with neq_thread show "False" by simp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
428 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
429 |
ultimately show ?thesis by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
430 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
431 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
432 |
ultimately show ?thesis |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
433 |
by (auto simp:max_def split:if_splits) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
434 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
435 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
436 |
case (P thread cs) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
437 |
with Cons |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
438 |
show ?thesis by (auto simp:preced_def) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
439 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
440 |
case (V thread cs) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
441 |
with Cons |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
442 |
show ?thesis by (auto simp:preced_def) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
443 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
444 |
case (Set thread prio') |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
445 |
show ?thesis (is "Max (?f ` ?A) = ?t") |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
446 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
447 |
let ?B = "threads (t@s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
448 |
from Cons have "extend_highest_set s' th prio (e # t)" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
449 |
from extend_highest_set.set_diff_low[OF this] and Set |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
450 |
have neq_thread: "thread \<noteq> th" and le_p: "prio' \<le> prio" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
451 |
from Set have "Max (?f ` ?A) = Max (?f ` ?B)" by simp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
452 |
also have "\<dots> = ?t" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
453 |
proof(rule Max_eqI) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
454 |
fix y |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
455 |
assume y_in: "y \<in> ?f ` ?B" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
456 |
then obtain th1 where |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
457 |
th1_in: "th1 \<in> ?B" and eq_y: "y = ?f th1" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
458 |
show "y \<le> ?t" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
459 |
proof(cases "th1 = thread") |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
460 |
case True |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
461 |
with neq_thread le_p eq_y s_def Set |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
462 |
show ?thesis |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
463 |
by (auto simp:preced_def precedence_le_def) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
464 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
465 |
case False |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
466 |
with Set eq_y |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
467 |
have "y = preced th1 (t@s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
468 |
by (simp add:preced_def) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
469 |
moreover have "\<dots> \<le> ?t" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
470 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
471 |
from Cons |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
472 |
have "?t = Max ((\<lambda> th'. preced th' (t@s)) ` (threads (t@s)))" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
473 |
by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
474 |
moreover have "preced th1 (t@s) \<le> \<dots>" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
475 |
proof(rule Max_ge) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
476 |
from th1_in |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
477 |
show "preced th1 (t @ s) \<in> (\<lambda>th'. preced th' (t @ s)) ` threads (t @ s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
478 |
by simp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
479 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
480 |
show "finite ((\<lambda>th'. preced th' (t @ s)) ` threads (t @ s))" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
481 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
482 |
from Cons have "vt step (t @ s)" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
483 |
from finite_threads[OF this] show ?thesis by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
484 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
485 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
486 |
ultimately show ?thesis by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
487 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
488 |
ultimately show ?thesis by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
489 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
490 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
491 |
from Cons and finite_threads |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
492 |
show "finite (?f ` ?B)" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
493 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
494 |
from Cons have "extend_highest_set s' th prio t" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
495 |
from extend_highest_set.th_kept [OF this, folded s_def] |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
496 |
have h: "th \<in> threads (t @ s) \<and> preced th (t @ s) = preced th s" . |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
497 |
show "?t \<in> (?f ` ?B)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
498 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
499 |
from neq_thread Set h |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
500 |
have "?t = ?f th" by (auto simp:preced_def) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
501 |
with h show ?thesis by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
502 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
503 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
504 |
finally show ?thesis . |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
505 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
506 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
507 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
508 |
|
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
509 |
lemma max_preced: "preced th (t@s) = Max ((\<lambda> th'. preced th' (t @ s)) ` (threads (t@s)))" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
510 |
by (insert th_kept max_kept, auto) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
511 |
|
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
512 |
lemma th_cp_max_preced: "cp (t@s) th = Max ((\<lambda> th'. preced th' (t @ s)) ` (threads (t@s)))" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
513 |
(is "?L = ?R") |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
514 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
515 |
have "?L = cpreced (t@s) (wq (t@s)) th" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
516 |
by (unfold cp_eq_cpreced, simp) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
517 |
also have "\<dots> = ?R" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
518 |
proof(unfold cpreced_def) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
519 |
show "Max ((\<lambda>th. preced th (t @ s)) ` ({th} \<union> dependents (wq (t @ s)) th)) = |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
520 |
Max ((\<lambda>th'. preced th' (t @ s)) ` threads (t @ s))" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
521 |
(is "Max (?f ` ({th} \<union> ?A)) = Max (?f ` ?B)") |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
522 |
proof(cases "?A = {}") |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
523 |
case False |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
524 |
have "Max (?f ` ({th} \<union> ?A)) = Max (insert (?f th) (?f ` ?A))" by simp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
525 |
moreover have "\<dots> = max (?f th) (Max (?f ` ?A))" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
526 |
proof(rule Max_insert) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
527 |
show "finite (?f ` ?A)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
528 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
529 |
from dependents_threads[OF vt_t] |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
530 |
have "?A \<subseteq> threads (t@s)" . |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
531 |
moreover from finite_threads[OF vt_t] have "finite \<dots>" . |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
532 |
ultimately show ?thesis |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
533 |
by (auto simp:finite_subset) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
534 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
535 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
536 |
from False show "(?f ` ?A) \<noteq> {}" by simp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
537 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
538 |
moreover have "\<dots> = Max (?f ` ?B)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
539 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
540 |
from max_preced have "?f th = Max (?f ` ?B)" . |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
541 |
moreover have "Max (?f ` ?A) \<le> \<dots>" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
542 |
proof(rule Max_mono) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
543 |
from False show "(?f ` ?A) \<noteq> {}" by simp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
544 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
545 |
show "?f ` ?A \<subseteq> ?f ` ?B" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
546 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
547 |
have "?A \<subseteq> ?B" by (rule dependents_threads[OF vt_t]) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
548 |
thus ?thesis by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
549 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
550 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
551 |
from finite_threads[OF vt_t] |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
552 |
show "finite (?f ` ?B)" by simp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
553 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
554 |
ultimately show ?thesis |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
555 |
by (auto simp:max_def) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
556 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
557 |
ultimately show ?thesis by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
558 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
559 |
case True |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
560 |
with max_preced show ?thesis by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
561 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
562 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
563 |
finally show ?thesis . |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
564 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
565 |
|
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
566 |
lemma th_cp_max: "cp (t@s) th = Max (cp (t@s) ` threads (t@s))" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
567 |
by (unfold max_cp_eq[OF vt_t] th_cp_max_preced, simp) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
568 |
|
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
569 |
lemma th_cp_preced: "cp (t@s) th = preced th s" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
570 |
by (fold max_kept, unfold th_cp_max_preced, simp) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
571 |
|
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
572 |
lemma preced_less': |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
573 |
fixes th' |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
574 |
assumes th'_in: "th' \<in> threads s" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
575 |
and neq_th': "th' \<noteq> th" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
576 |
shows "preced th' s < preced th s" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
577 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
578 |
have "preced th' s \<le> Max ((\<lambda>th'. preced th' s) ` threads s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
579 |
proof(rule Max_ge) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
580 |
from finite_threads [OF vt_s] |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
581 |
show "finite ((\<lambda>th'. preced th' s) ` threads s)" by simp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
582 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
583 |
from th'_in show "preced th' s \<in> (\<lambda>th'. preced th' s) ` threads s" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
584 |
by simp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
585 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
586 |
moreover have "preced th' s \<noteq> preced th s" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
587 |
proof |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
588 |
assume "preced th' s = preced th s" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
589 |
from preced_unique[OF this th'_in] neq_th' is_ready |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
590 |
show "False" by (auto simp:readys_def) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
591 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
592 |
ultimately show ?thesis using highest_preced_thread |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
593 |
by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
594 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
595 |
|
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
596 |
lemma pv_blocked: |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
597 |
fixes th' |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
598 |
assumes th'_in: "th' \<in> threads (t@s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
599 |
and neq_th': "th' \<noteq> th" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
600 |
and eq_pv: "cntP (t@s) th' = cntV (t@s) th'" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
601 |
shows "th' \<notin> runing (t@s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
602 |
proof |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
603 |
assume "th' \<in> runing (t@s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
604 |
hence "cp (t@s) th' = Max (cp (t@s) ` readys (t@s))" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
605 |
by (auto simp:runing_def) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
606 |
with max_cp_readys_threads [OF vt_t] |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
607 |
have "cp (t @ s) th' = Max (cp (t@s) ` threads (t@s))" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
608 |
by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
609 |
moreover from th_cp_max have "cp (t @ s) th = \<dots>" by simp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
610 |
ultimately have "cp (t @ s) th' = cp (t @ s) th" by simp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
611 |
moreover from th_cp_preced and th_kept have "\<dots> = preced th (t @ s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
612 |
by simp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
613 |
finally have h: "cp (t @ s) th' = preced th (t @ s)" . |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
614 |
show False |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
615 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
616 |
have "dependents (wq (t @ s)) th' = {}" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
617 |
by (rule count_eq_dependents [OF vt_t eq_pv]) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
618 |
moreover have "preced th' (t @ s) \<noteq> preced th (t @ s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
619 |
proof |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
620 |
assume "preced th' (t @ s) = preced th (t @ s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
621 |
hence "th' = th" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
622 |
proof(rule preced_unique) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
623 |
from th_kept show "th \<in> threads (t @ s)" by simp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
624 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
625 |
from th'_in show "th' \<in> threads (t @ s)" by simp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
626 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
627 |
with assms show False by simp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
628 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
629 |
ultimately show ?thesis |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
630 |
by (insert h, unfold cp_eq_cpreced cpreced_def, simp) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
631 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
632 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
633 |
|
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
634 |
lemma runing_precond_pre: |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
635 |
fixes th' |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
636 |
assumes th'_in: "th' \<in> threads s" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
637 |
and eq_pv: "cntP s th' = cntV s th'" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
638 |
and neq_th': "th' \<noteq> th" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
639 |
shows "th' \<in> threads (t@s) \<and> |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
640 |
cntP (t@s) th' = cntV (t@s) th'" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
641 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
642 |
show ?thesis |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
643 |
proof(induct rule:ind) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
644 |
case (Cons e t) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
645 |
from Cons |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
646 |
have in_thread: "th' \<in> threads (t @ s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
647 |
and not_holding: "cntP (t @ s) th' = cntV (t @ s) th'" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
648 |
have "extend_highest_set s' th prio t" by fact |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
649 |
from extend_highest_set.pv_blocked |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
650 |
[OF this, folded s_def, OF in_thread neq_th' not_holding] |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
651 |
have not_runing: "th' \<notin> runing (t @ s)" . |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
652 |
show ?case |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
653 |
proof(cases e) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
654 |
case (V thread cs) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
655 |
from Cons and V have vt_v: "vt step (V thread cs#(t@s))" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
656 |
|
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
657 |
show ?thesis |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
658 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
659 |
from Cons and V have "step (t@s) (V thread cs)" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
660 |
hence neq_th': "thread \<noteq> th'" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
661 |
proof(cases) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
662 |
assume "thread \<in> runing (t@s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
663 |
moreover have "th' \<notin> runing (t@s)" by fact |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
664 |
ultimately show ?thesis by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
665 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
666 |
with not_holding have cnt_eq: "cntP ((e # t) @ s) th' = cntV ((e # t) @ s) th'" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
667 |
by (unfold V, simp add:cntP_def cntV_def count_def) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
668 |
moreover from in_thread |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
669 |
have in_thread': "th' \<in> threads ((e # t) @ s)" by (unfold V, simp) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
670 |
ultimately show ?thesis by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
671 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
672 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
673 |
case (P thread cs) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
674 |
from Cons and P have "step (t@s) (P thread cs)" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
675 |
hence neq_th': "thread \<noteq> th'" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
676 |
proof(cases) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
677 |
assume "thread \<in> runing (t@s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
678 |
moreover note not_runing |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
679 |
ultimately show ?thesis by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
680 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
681 |
with Cons and P have eq_cnt: "cntP ((e # t) @ s) th' = cntV ((e # t) @ s) th'" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
682 |
by (auto simp:cntP_def cntV_def count_def) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
683 |
moreover from Cons and P have in_thread': "th' \<in> threads ((e # t) @ s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
684 |
by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
685 |
ultimately show ?thesis by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
686 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
687 |
case (Create thread prio') |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
688 |
from Cons and Create have "step (t@s) (Create thread prio')" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
689 |
hence neq_th': "thread \<noteq> th'" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
690 |
proof(cases) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
691 |
assume "thread \<notin> threads (t @ s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
692 |
moreover have "th' \<in> threads (t@s)" by fact |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
693 |
ultimately show ?thesis by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
694 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
695 |
with Cons and Create |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
696 |
have eq_cnt: "cntP ((e # t) @ s) th' = cntV ((e # t) @ s) th'" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
697 |
by (auto simp:cntP_def cntV_def count_def) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
698 |
moreover from Cons and Create |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
699 |
have in_thread': "th' \<in> threads ((e # t) @ s)" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
700 |
ultimately show ?thesis by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
701 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
702 |
case (Exit thread) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
703 |
from Cons and Exit have "step (t@s) (Exit thread)" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
704 |
hence neq_th': "thread \<noteq> th'" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
705 |
proof(cases) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
706 |
assume "thread \<in> runing (t @ s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
707 |
moreover note not_runing |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
708 |
ultimately show ?thesis by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
709 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
710 |
with Cons and Exit |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
711 |
have eq_cnt: "cntP ((e # t) @ s) th' = cntV ((e # t) @ s) th'" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
712 |
by (auto simp:cntP_def cntV_def count_def) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
713 |
moreover from Cons and Exit and neq_th' |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
714 |
have in_thread': "th' \<in> threads ((e # t) @ s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
715 |
by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
716 |
ultimately show ?thesis by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
717 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
718 |
case (Set thread prio') |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
719 |
with Cons |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
720 |
show ?thesis |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
721 |
by (auto simp:cntP_def cntV_def count_def) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
722 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
723 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
724 |
case Nil |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
725 |
with assms |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
726 |
show ?case by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
727 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
728 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
729 |
|
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
730 |
(* |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
731 |
lemma runing_precond: |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
732 |
fixes th' |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
733 |
assumes th'_in: "th' \<in> threads s" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
734 |
and eq_pv: "cntP s th' = cntV s th'" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
735 |
and neq_th': "th' \<noteq> th" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
736 |
shows "th' \<notin> runing (t@s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
737 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
738 |
from runing_precond_pre[OF th'_in eq_pv neq_th'] |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
739 |
have h1: "th' \<in> threads (t @ s)" and h2: "cntP (t @ s) th' = cntV (t @ s) th'" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
740 |
from pv_blocked[OF h1 neq_th' h2] |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
741 |
show ?thesis . |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
742 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
743 |
*) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
744 |
|
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
745 |
lemma runing_precond: |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
746 |
fixes th' |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
747 |
assumes th'_in: "th' \<in> threads s" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
748 |
and neq_th': "th' \<noteq> th" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
749 |
and is_runing: "th' \<in> runing (t@s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
750 |
shows "cntP s th' > cntV s th'" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
751 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
752 |
have "cntP s th' \<noteq> cntV s th'" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
753 |
proof |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
754 |
assume eq_pv: "cntP s th' = cntV s th'" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
755 |
from runing_precond_pre[OF th'_in eq_pv neq_th'] |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
756 |
have h1: "th' \<in> threads (t @ s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
757 |
and h2: "cntP (t @ s) th' = cntV (t @ s) th'" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
758 |
from pv_blocked[OF h1 neq_th' h2] have " th' \<notin> runing (t @ s)" . |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
759 |
with is_runing show "False" by simp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
760 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
761 |
moreover from cnp_cnv_cncs[OF vt_s, of th'] |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
762 |
have "cntV s th' \<le> cntP s th'" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
763 |
ultimately show ?thesis by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
764 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
765 |
|
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
766 |
lemma moment_blocked_pre: |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
767 |
assumes neq_th': "th' \<noteq> th" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
768 |
and th'_in: "th' \<in> threads ((moment i t)@s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
769 |
and eq_pv: "cntP ((moment i t)@s) th' = cntV ((moment i t)@s) th'" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
770 |
shows "cntP ((moment (i+j) t)@s) th' = cntV ((moment (i+j) t)@s) th' \<and> |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
771 |
th' \<in> threads ((moment (i+j) t)@s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
772 |
proof(induct j) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
773 |
case (Suc k) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
774 |
show ?case |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
775 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
776 |
{ assume True: "Suc (i+k) \<le> length t" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
777 |
from moment_head [OF this] |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
778 |
obtain e where |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
779 |
eq_me: "moment (Suc(i+k)) t = e#(moment (i+k) t)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
780 |
by blast |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
781 |
from red_moment[of "Suc(i+k)"] |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
782 |
and eq_me have "extend_highest_set s' th prio (e # moment (i + k) t)" by simp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
783 |
hence vt_e: "vt step (e#(moment (i + k) t)@s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
784 |
by (unfold extend_highest_set_def extend_highest_set_axioms_def |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
785 |
highest_set_def s_def, auto) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
786 |
have not_runing': "th' \<notin> runing (moment (i + k) t @ s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
787 |
proof(unfold s_def) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
788 |
show "th' \<notin> runing (moment (i + k) t @ Set th prio # s')" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
789 |
proof(rule extend_highest_set.pv_blocked) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
790 |
from Suc show "th' \<in> threads (moment (i + k) t @ Set th prio # s')" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
791 |
by (simp add:s_def) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
792 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
793 |
from neq_th' show "th' \<noteq> th" . |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
794 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
795 |
from red_moment show "extend_highest_set s' th prio (moment (i + k) t)" . |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
796 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
797 |
from Suc show "cntP (moment (i + k) t @ Set th prio # s') th' = |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
798 |
cntV (moment (i + k) t @ Set th prio # s') th'" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
799 |
by (auto simp:s_def) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
800 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
801 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
802 |
from step_back_step[OF vt_e] |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
803 |
have "step ((moment (i + k) t)@s) e" . |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
804 |
hence "cntP (e#(moment (i + k) t)@s) th' = cntV (e#(moment (i + k) t)@s) th' \<and> |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
805 |
th' \<in> threads (e#(moment (i + k) t)@s) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
806 |
" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
807 |
proof(cases) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
808 |
case (thread_create thread prio) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
809 |
with Suc show ?thesis by (auto simp:cntP_def cntV_def count_def) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
810 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
811 |
case (thread_exit thread) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
812 |
moreover have "thread \<noteq> th'" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
813 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
814 |
have "thread \<in> runing (moment (i + k) t @ s)" by fact |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
815 |
moreover note not_runing' |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
816 |
ultimately show ?thesis by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
817 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
818 |
moreover note Suc |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
819 |
ultimately show ?thesis by (auto simp:cntP_def cntV_def count_def) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
820 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
821 |
case (thread_P thread cs) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
822 |
moreover have "thread \<noteq> th'" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
823 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
824 |
have "thread \<in> runing (moment (i + k) t @ s)" by fact |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
825 |
moreover note not_runing' |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
826 |
ultimately show ?thesis by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
827 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
828 |
moreover note Suc |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
829 |
ultimately show ?thesis by (auto simp:cntP_def cntV_def count_def) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
830 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
831 |
case (thread_V thread cs) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
832 |
moreover have "thread \<noteq> th'" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
833 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
834 |
have "thread \<in> runing (moment (i + k) t @ s)" by fact |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
835 |
moreover note not_runing' |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
836 |
ultimately show ?thesis by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
837 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
838 |
moreover note Suc |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
839 |
ultimately show ?thesis by (auto simp:cntP_def cntV_def count_def) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
840 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
841 |
case (thread_set thread prio') |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
842 |
with Suc show ?thesis |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
843 |
by (auto simp:cntP_def cntV_def count_def) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
844 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
845 |
with eq_me have ?thesis using eq_me by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
846 |
} note h = this |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
847 |
show ?thesis |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
848 |
proof(cases "Suc (i+k) \<le> length t") |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
849 |
case True |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
850 |
from h [OF this] show ?thesis . |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
851 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
852 |
case False |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
853 |
with moment_ge |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
854 |
have eq_m: "moment (i + Suc k) t = moment (i+k) t" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
855 |
with Suc show ?thesis by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
856 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
857 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
858 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
859 |
case 0 |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
860 |
from assms show ?case by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
861 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
862 |
|
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
863 |
lemma moment_blocked: |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
864 |
assumes neq_th': "th' \<noteq> th" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
865 |
and th'_in: "th' \<in> threads ((moment i t)@s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
866 |
and eq_pv: "cntP ((moment i t)@s) th' = cntV ((moment i t)@s) th'" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
867 |
and le_ij: "i \<le> j" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
868 |
shows "cntP ((moment j t)@s) th' = cntV ((moment j t)@s) th' \<and> |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
869 |
th' \<in> threads ((moment j t)@s) \<and> |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
870 |
th' \<notin> runing ((moment j t)@s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
871 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
872 |
from moment_blocked_pre [OF neq_th' th'_in eq_pv, of "j-i"] and le_ij |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
873 |
have h1: "cntP ((moment j t)@s) th' = cntV ((moment j t)@s) th'" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
874 |
and h2: "th' \<in> threads ((moment j t)@s)" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
875 |
with extend_highest_set.pv_blocked [OF red_moment [of j], folded s_def, OF h2 neq_th' h1] |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
876 |
show ?thesis by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
877 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
878 |
|
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
879 |
lemma runing_inversion_1: |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
880 |
assumes neq_th': "th' \<noteq> th" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
881 |
and runing': "th' \<in> runing (t@s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
882 |
shows "th' \<in> threads s \<and> cntV s th' < cntP s th'" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
883 |
proof(cases "th' \<in> threads s") |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
884 |
case True |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
885 |
with runing_precond [OF this neq_th' runing'] show ?thesis by simp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
886 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
887 |
case False |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
888 |
let ?Q = "\<lambda> t. th' \<in> threads (t@s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
889 |
let ?q = "moment 0 t" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
890 |
from moment_eq and False have not_thread: "\<not> ?Q ?q" by simp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
891 |
from runing' have "th' \<in> threads (t@s)" by (simp add:runing_def readys_def) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
892 |
from p_split_gen [of ?Q, OF this not_thread] |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
893 |
obtain i where lt_its: "i < length t" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
894 |
and le_i: "0 \<le> i" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
895 |
and pre: " th' \<notin> threads (moment i t @ s)" (is "th' \<notin> threads ?pre") |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
896 |
and post: "(\<forall>i'>i. th' \<in> threads (moment i' t @ s))" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
897 |
from lt_its have "Suc i \<le> length t" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
898 |
from moment_head[OF this] obtain e where |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
899 |
eq_me: "moment (Suc i) t = e # moment i t" by blast |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
900 |
from red_moment[of "Suc i"] and eq_me |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
901 |
have "extend_highest_set s' th prio (e # moment i t)" by simp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
902 |
hence vt_e: "vt step (e#(moment i t)@s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
903 |
by (unfold extend_highest_set_def extend_highest_set_axioms_def |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
904 |
highest_set_def s_def, auto) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
905 |
from step_back_step[OF this] have stp_i: "step (moment i t @ s) e" . |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
906 |
from post[rule_format, of "Suc i"] and eq_me |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
907 |
have not_in': "th' \<in> threads (e # moment i t@s)" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
908 |
from create_pre[OF stp_i pre this] |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
909 |
obtain prio where eq_e: "e = Create th' prio" . |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
910 |
have "cntP (moment i t@s) th' = cntV (moment i t@s) th'" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
911 |
proof(rule cnp_cnv_eq) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
912 |
from step_back_vt [OF vt_e] |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
913 |
show "vt step (moment i t @ s)" . |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
914 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
915 |
from eq_e and stp_i |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
916 |
have "step (moment i t @ s) (Create th' prio)" by simp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
917 |
thus "th' \<notin> threads (moment i t @ s)" by (cases, simp) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
918 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
919 |
with eq_e |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
920 |
have "cntP ((e#moment i t)@s) th' = cntV ((e#moment i t)@s) th'" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
921 |
by (simp add:cntP_def cntV_def count_def) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
922 |
with eq_me[symmetric] |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
923 |
have h1: "cntP (moment (Suc i) t @ s) th' = cntV (moment (Suc i) t@ s) th'" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
924 |
by simp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
925 |
from eq_e have "th' \<in> threads ((e#moment i t)@s)" by simp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
926 |
with eq_me [symmetric] |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
927 |
have h2: "th' \<in> threads (moment (Suc i) t @ s)" by simp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
928 |
from moment_blocked [OF neq_th' h2 h1, of "length t"] and lt_its |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
929 |
and moment_ge |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
930 |
have "th' \<notin> runing (t @ s)" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
931 |
with runing' |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
932 |
show ?thesis by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
933 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
934 |
|
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
935 |
lemma runing_inversion_2: |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
936 |
assumes runing': "th' \<in> runing (t@s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
937 |
shows "th' = th \<or> (th' \<noteq> th \<and> th' \<in> threads s \<and> cntV s th' < cntP s th')" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
938 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
939 |
from runing_inversion_1[OF _ runing'] |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
940 |
show ?thesis by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
941 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
942 |
|
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
943 |
lemma live: "runing (t@s) \<noteq> {}" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
944 |
proof(cases "th \<in> runing (t@s)") |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
945 |
case True thus ?thesis by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
946 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
947 |
case False |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
948 |
then have not_ready: "th \<notin> readys (t@s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
949 |
apply (unfold runing_def, |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
950 |
insert th_cp_max max_cp_readys_threads[OF vt_t, symmetric]) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
951 |
by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
952 |
from th_kept have "th \<in> threads (t@s)" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
953 |
from th_chain_to_ready[OF vt_t this] and not_ready |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
954 |
obtain th' where th'_in: "th' \<in> readys (t@s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
955 |
and dp: "(Th th, Th th') \<in> (depend (t @ s))\<^sup>+" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
956 |
have "th' \<in> runing (t@s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
957 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
958 |
have "cp (t @ s) th' = Max (cp (t @ s) ` readys (t @ s))" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
959 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
960 |
have " Max ((\<lambda>th. preced th (t @ s)) ` ({th'} \<union> dependents (wq (t @ s)) th')) = |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
961 |
preced th (t@s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
962 |
proof(rule Max_eqI) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
963 |
fix y |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
964 |
assume "y \<in> (\<lambda>th. preced th (t @ s)) ` ({th'} \<union> dependents (wq (t @ s)) th')" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
965 |
then obtain th1 where |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
966 |
h1: "th1 = th' \<or> th1 \<in> dependents (wq (t @ s)) th'" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
967 |
and eq_y: "y = preced th1 (t@s)" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
968 |
show "y \<le> preced th (t @ s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
969 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
970 |
from max_preced |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
971 |
have "preced th (t @ s) = Max ((\<lambda>th'. preced th' (t @ s)) ` threads (t @ s))" . |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
972 |
moreover have "y \<le> \<dots>" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
973 |
proof(rule Max_ge) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
974 |
from h1 |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
975 |
have "th1 \<in> threads (t@s)" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
976 |
proof |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
977 |
assume "th1 = th'" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
978 |
with th'_in show ?thesis by (simp add:readys_def) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
979 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
980 |
assume "th1 \<in> dependents (wq (t @ s)) th'" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
981 |
with dependents_threads [OF vt_t] |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
982 |
show "th1 \<in> threads (t @ s)" by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
983 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
984 |
with eq_y show " y \<in> (\<lambda>th'. preced th' (t @ s)) ` threads (t @ s)" by simp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
985 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
986 |
from finite_threads[OF vt_t] |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
987 |
show "finite ((\<lambda>th'. preced th' (t @ s)) ` threads (t @ s))" by simp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
988 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
989 |
ultimately show ?thesis by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
990 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
991 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
992 |
from finite_threads[OF vt_t] dependents_threads [OF vt_t, of th'] |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
993 |
show "finite ((\<lambda>th. preced th (t @ s)) ` ({th'} \<union> dependents (wq (t @ s)) th'))" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
994 |
by (auto intro:finite_subset) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
995 |
next |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
996 |
from dp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
997 |
have "th \<in> dependents (wq (t @ s)) th'" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
998 |
by (unfold cs_dependents_def, auto simp:eq_depend) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
999 |
thus "preced th (t @ s) \<in> |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1000 |
(\<lambda>th. preced th (t @ s)) ` ({th'} \<union> dependents (wq (t @ s)) th')" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1001 |
by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1002 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1003 |
moreover have "\<dots> = Max (cp (t @ s) ` readys (t @ s))" |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1004 |
proof - |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1005 |
from max_preced and max_cp_eq[OF vt_t, symmetric] |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1006 |
have "preced th (t @ s) = Max (cp (t @ s) ` threads (t @ s))" by simp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1007 |
with max_cp_readys_threads[OF vt_t] show ?thesis by simp |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1008 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1009 |
ultimately show ?thesis by (unfold cp_eq_cpreced cpreced_def, simp) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1010 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1011 |
with th'_in show ?thesis by (auto simp:runing_def) |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1012 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1013 |
thus ?thesis by auto |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1014 |
qed |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1015 |
|
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1016 |
end |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1017 |
|
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1018 |
end |
c4783e4ef43f
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1019 |