author | chunhan |
Tue, 03 Sep 2013 09:31:40 +0800 | |
changeset 38 | 9dfc8c72565a |
parent 34 | e7f850d1e08e |
child 40 | 8557d7872fdb |
permissions | -rw-r--r-- |
1 | 1 |
(*<*) |
2 |
theory Co2sobj_prop |
|
32 | 3 |
imports Main Flask Flask_type Static Static_type Sectxt_prop Init_prop Current_files_prop Current_sockets_prop Delete_prop Proc_fd_of_file_prop Tainted_prop Valid_prop Init_prop Alive_prop |
1 | 4 |
begin |
5 |
(*<*) |
|
6 |
||
31 | 7 |
ML {* |
8 |
fun print_ss ss = |
|
9 |
let |
|
10 |
val {simps, congs, procs, ...} = Raw_Simplifier.dest_ss ss |
|
11 |
in |
|
12 |
simps |
|
13 |
end |
|
14 |
*} |
|
15 |
||
16 |
||
1 | 17 |
context tainting_s begin |
18 |
||
19 | 19 |
(********************* cm2smsg simpset ***********************) |
20 |
||
31 | 21 |
lemma cm2smsg_other: |
22 |
"\<lbrakk>valid (e # s); \<forall> p q m. e \<noteq> SendMsg p q m; \<forall> p q m. e \<noteq> RecvMsg p q m; \<forall> p q. e \<noteq> RemoveMsgq p q\<rbrakk> |
|
23 |
\<Longrightarrow> cm2smsg (e # s) = cm2smsg s" |
|
19 | 24 |
apply (frule vt_grant_os, frule vd_cons, rule ext, rule ext) |
31 | 25 |
unfolding cm2smsg_def |
19 | 26 |
apply (case_tac e) |
31 | 27 |
apply (auto simp:sectxt_of_obj_simps tainted_eq_Tainted |
28 |
split:t_object.splits option.splits if_splits |
|
29 |
dest:not_deleted_init_msg dest!:current_has_sec') |
|
30 |
done |
|
31 |
||
32 |
lemma cm2smsg_sendmsg: |
|
33 |
"valid (SendMsg p q m # s) \<Longrightarrow> cm2smsg (SendMsg p q m # s) = (\<lambda> q' m'. |
|
34 |
if (q' = q \<and> m' = m) |
|
35 |
then (case (sectxt_of_obj (SendMsg p q m # s) (O_msg q m)) of |
|
36 |
Some sec \<Rightarrow> Some (Created, sec, O_msg q m \<in> tainted (SendMsg p q m # s)) |
|
37 |
| _ \<Rightarrow> None) |
|
38 |
else cm2smsg s q' m') " |
|
39 |
apply (frule vd_cons, frule vt_grant_os, rule ext, rule ext) |
|
40 |
apply (auto simp:cm2smsg_def tainted_eq_Tainted sectxt_of_obj_simps |
|
41 |
split:if_splits option.splits |
|
42 |
dest:not_deleted_init_msg dest!:current_has_sec') |
|
43 |
done |
|
44 |
||
45 |
lemma cm2smsg_recvmsg1: |
|
46 |
"\<lbrakk>q' \<noteq> q; valid (RecvMsg p q m # s)\<rbrakk> \<Longrightarrow> cm2smsg (RecvMsg p q m # s) q' = cm2smsg s q'" |
|
47 |
apply (frule vd_cons, frule vt_grant_os, rule ext) |
|
48 |
apply (auto simp:cm2smsg_def tainted_eq_Tainted sectxt_of_obj_simps |
|
49 |
split:if_splits option.splits) |
|
50 |
done |
|
51 |
||
52 |
lemma cm2smsg_recvmsg2: |
|
53 |
"\<lbrakk>m' \<noteq> m; valid (RecvMsg p q m # s)\<rbrakk> \<Longrightarrow> cm2smsg (RecvMsg p q m # s) q m' = cm2smsg s q m'" |
|
54 |
apply (frule vd_cons, frule vt_grant_os) |
|
55 |
apply (auto simp:cm2smsg_def tainted_eq_Tainted sectxt_of_obj_simps |
|
56 |
split:if_splits option.splits) |
|
57 |
done |
|
58 |
||
59 |
lemma cm2smsg_recvmsg1': |
|
60 |
"\<lbrakk>valid (RecvMsg p q m # s); q' \<noteq> q\<rbrakk> \<Longrightarrow> cm2smsg (RecvMsg p q m # s) q' = cm2smsg s q'" |
|
61 |
apply (frule vd_cons, frule vt_grant_os, rule ext) |
|
62 |
apply (auto simp:cm2smsg_def tainted_eq_Tainted sectxt_of_obj_simps |
|
63 |
split:if_splits option.splits) |
|
64 |
done |
|
65 |
||
66 |
lemma cm2smsg_recvmsg2': |
|
67 |
"\<lbrakk>valid (RecvMsg p q m # s); m' \<noteq> m\<rbrakk> \<Longrightarrow> cm2smsg (RecvMsg p q m # s) q m' = cm2smsg s q m'" |
|
68 |
apply (frule vd_cons, frule vt_grant_os) |
|
69 |
apply (auto simp:cm2smsg_def tainted_eq_Tainted sectxt_of_obj_simps |
|
70 |
split:if_splits option.splits) |
|
71 |
done |
|
72 |
||
73 |
lemma cm2smsg_removemsgq: |
|
74 |
"\<lbrakk>q' \<noteq> q; valid (RemoveMsgq p q # s)\<rbrakk> \<Longrightarrow> cm2smsg (RemoveMsgq p q # s) q' = cm2smsg s q'" |
|
75 |
apply (frule vd_cons, frule vt_grant_os, rule ext) |
|
76 |
apply (auto simp:cm2smsg_def tainted_eq_Tainted sectxt_of_obj_simps |
|
77 |
split:if_splits option.splits) |
|
78 |
done |
|
79 |
||
80 |
lemmas cm2smsg_simps = cm2smsg_nil_prop cm2smsg_sendmsg cm2smsg_recvmsg1' cm2smsg_recvmsg2' |
|
81 |
cm2smsg_removemsgq cm2smsg_other |
|
82 |
||
83 |
lemma init_cm2smsg_has_smsg: |
|
84 |
"\<lbrakk>m \<in> set (init_msgs_of_queue q); q \<in> init_msgqs\<rbrakk> \<Longrightarrow> \<exists> sm. init_cm2smsg q m = Some sm" |
|
85 |
by (auto simp:init_cm2smsg_def split:option.splits dest:init_msg_has_ctxt) |
|
86 |
||
87 |
lemma hd_set_prop1: |
|
88 |
"hd l \<notin> set l \<Longrightarrow> l = []" |
|
89 |
by (case_tac l, auto) |
|
90 |
||
91 |
lemma tl_set_prop1: |
|
92 |
"a \<in> set (tl l) \<Longrightarrow> a \<in> set l" |
|
93 |
by (case_tac l, auto) |
|
94 |
||
95 |
lemma current_has_smsg: |
|
96 |
"\<lbrakk>m \<in> set (msgs_of_queue s q); q \<in> current_msgqs s; valid s\<rbrakk> \<Longrightarrow> \<exists> sm. cm2smsg s q m = Some sm" |
|
97 |
apply (induct s) |
|
98 |
apply (simp only:cm2smsg_nil_prop msgs_of_queue.simps current_msgqs.simps init_cm2smsg_has_smsg) |
|
99 |
||
100 |
apply (frule vt_grant_os, frule vd_cons, case_tac a) |
|
101 |
apply (auto simp:cm2smsg_def sectxt_of_obj_simps split:if_splits option.splits |
|
102 |
dest!:current_has_sec' hd_set_prop1 dest:not_deleted_init_msg tl_set_prop1) |
|
103 |
done |
|
104 |
||
105 |
lemma current_has_smsg': |
|
106 |
"\<lbrakk>cm2smsg s q m = None; q \<in> current_msgqs s; valid s\<rbrakk> \<Longrightarrow> m \<notin> set (msgs_of_queue s q)" |
|
107 |
by (auto dest:current_has_smsg) |
|
108 |
||
109 |
lemma cqm2sms_has_sms_aux: |
|
110 |
"\<forall> m \<in> set ms. sectxt_of_obj s (O_msg q m) \<noteq> None \<Longrightarrow> (\<exists> sms. cqm2sms s q ms = Some sms)" |
|
111 |
by (induct ms, auto split:option.splits simp:cm2smsg_def) |
|
112 |
||
113 |
lemma current_has_sms: |
|
114 |
"\<lbrakk>q \<in> current_msgqs s; valid s\<rbrakk> \<Longrightarrow> \<exists> sms. cqm2sms s q (msgs_of_queue s q) = Some sms" |
|
115 |
apply (rule cqm2sms_has_sms_aux) |
|
116 |
apply (auto dest:current_msg_has_sec) |
|
117 |
done |
|
118 |
||
119 |
lemma current_has_sms': |
|
120 |
"\<lbrakk>cqm2sms s q (msgs_of_queue s q) = None; valid s\<rbrakk> \<Longrightarrow> q \<notin> current_msgqs s" |
|
121 |
by (auto dest:current_has_sms) |
|
122 |
||
123 |
(********************* cqm2sms simpset ***********************) |
|
124 |
||
125 |
lemma cqm2sms_other: |
|
126 |
"\<lbrakk>valid (e # s); \<forall> p m. e \<noteq> CreateMsgq p q; \<forall> p q m. e \<noteq> SendMsg p q m; |
|
127 |
\<forall> p q m. e \<noteq> RecvMsg p q m; \<forall> p q. e \<noteq> RemoveMsgq p q\<rbrakk> |
|
128 |
\<Longrightarrow> cqm2sms (e # s) = cqm2sms s" |
|
129 |
apply (rule ext, rule ext) |
|
130 |
apply (induct_tac xa, simp) |
|
131 |
apply (frule vt_grant_os, frule vd_cons, case_tac e) |
|
132 |
apply (auto split:option.splits dest:cm2smsg_other) |
|
133 |
done |
|
19 | 134 |
|
31 | 135 |
lemma cqm2sms_createmsgq: |
136 |
"valid (CreateMsgq p q # s) \<Longrightarrow> cqm2sms (CreateMsgq p q # s) = (\<lambda> q' ms'. |
|
137 |
if (q' = q \<and> ms' = []) then Some [] |
|
138 |
else cqm2sms s q' ms')" |
|
139 |
apply (rule ext, rule ext) |
|
140 |
apply (frule vt_grant_os, frule vd_cons, induct_tac ms') |
|
141 |
apply (auto split:if_splits option.splits dest:cm2smsg_other) |
|
142 |
done |
|
143 |
||
144 |
lemma cqm2sms_2: |
|
145 |
"cqm2sms s q (ms @ [m]) = |
|
146 |
(case (cqm2sms s q ms, cm2smsg s q m) of |
|
147 |
(Some sms, Some sm) \<Rightarrow> Some (sms @ [sm]) |
|
148 |
| _ \<Rightarrow> None)" |
|
149 |
apply (induct ms, simp split:option.splits) |
|
150 |
by (auto split:option.splits) |
|
151 |
||
152 |
lemmas cqm2sms_simps2 = cqm2sms.simps(1) cqm2sms_2 |
|
153 |
||
154 |
declare cqm2sms.simps [simp del] |
|
155 |
||
156 |
lemma cqm2sms_prop1: |
|
157 |
"cqm2sms s q ms = None \<Longrightarrow> \<exists> m \<in> set ms. cm2smsg s q m = None" |
|
158 |
by (induct ms, auto simp:cqm2sms.simps split:option.splits) |
|
159 |
||
160 |
lemma cqm2sms_sendmsg1: |
|
161 |
"\<lbrakk>valid (SendMsg p q m # s); m \<notin> set ms\<rbrakk> |
|
162 |
\<Longrightarrow> cqm2sms (SendMsg p q m # s) q' ms = cqm2sms s q' ms" |
|
163 |
apply (frule vt_grant_os, frule vd_cons) |
|
164 |
apply (frule cm2smsg_sendmsg) |
|
165 |
apply (induct ms rule:rev_induct) |
|
166 |
apply (auto split:if_splits option.splits simp:cqm2sms_simps2) |
|
167 |
done |
|
168 |
||
169 |
lemma cqm2sms_sendmsg2: |
|
170 |
"\<lbrakk>valid (SendMsg p q m # s); q' \<noteq> q\<rbrakk> |
|
171 |
\<Longrightarrow> cqm2sms (SendMsg p q m # s) q' ms = cqm2sms s q' ms" |
|
172 |
apply (frule vt_grant_os, frule vd_cons) |
|
173 |
apply (frule cm2smsg_sendmsg) |
|
174 |
apply (induct ms rule:rev_induct) |
|
175 |
apply (auto split:if_splits option.splits simp:cqm2sms_simps2) |
|
176 |
done |
|
177 |
||
178 |
lemma cqm2sms_sendmsg3: |
|
179 |
"\<lbrakk>valid (SendMsg p q m # s); ms' = msgs_of_queue (SendMsg p q m # s) q\<rbrakk> |
|
180 |
\<Longrightarrow> cqm2sms (SendMsg p q m # s) q ms' = |
|
181 |
(case (cqm2sms s q (msgs_of_queue s q), sectxt_of_obj (SendMsg p q m # s) (O_msg q m)) of |
|
182 |
(Some sms, Some sec) \<Rightarrow> Some (sms @ [(Created, sec, O_msg q m \<in> tainted (SendMsg p q m # s))]) |
|
183 |
| _ \<Rightarrow> None)" |
|
184 |
apply (frule vt_grant_os, frule vd_cons) |
|
185 |
apply (frule cm2smsg_sendmsg) |
|
186 |
apply (auto split:if_splits option.splits simp:cqm2sms_simps2 cqm2sms_sendmsg1) |
|
187 |
done |
|
188 |
||
189 |
lemma cqm2sms_sendmsg: |
|
190 |
"\<lbrakk>valid (SendMsg p q m # s); ms' = msgs_of_queue (SendMsg p q m # s) q'\<rbrakk> |
|
191 |
\<Longrightarrow> cqm2sms (SendMsg p q m # s) q' ms' = ( |
|
192 |
if (q' = q) |
|
193 |
then (case (cqm2sms s q (msgs_of_queue s q), sectxt_of_obj (SendMsg p q m # s) (O_msg q m)) of |
|
194 |
(Some sms, Some sec) \<Rightarrow> Some (sms @ [(Created, sec, O_msg q m \<in> tainted (SendMsg p q m # s))]) |
|
195 |
| _ \<Rightarrow> None) |
|
196 |
else cqm2sms s q' ms' )" |
|
197 |
apply (simp split:if_splits add:cqm2sms_sendmsg2 cqm2sms_sendmsg3) |
|
198 |
done |
|
199 |
||
200 |
lemma cqm2sms_recvmsg1: |
|
201 |
"\<lbrakk>valid (RecvMsg p q m # s); m \<notin> set ms\<rbrakk> |
|
202 |
\<Longrightarrow> cqm2sms (RecvMsg p q m # s) q ms = cqm2sms s q ms" |
|
203 |
apply (frule vt_grant_os, frule vd_cons) |
|
204 |
apply (induct ms rule:rev_induct) |
|
205 |
apply (auto split:if_splits option.splits simp:cqm2sms_simps2 cm2smsg_recvmsg2') |
|
206 |
done |
|
207 |
||
208 |
lemma cqm2sms_recvmsg2: |
|
209 |
"\<lbrakk>valid (RecvMsg p q m # s); q' \<noteq> q\<rbrakk> |
|
210 |
\<Longrightarrow> cqm2sms (RecvMsg p q m # s) q' ms = cqm2sms s q' ms" |
|
211 |
apply (frule vt_grant_os, frule vd_cons) |
|
212 |
apply (induct ms rule:rev_induct) |
|
213 |
apply (auto split:if_splits option.splits simp:cqm2sms_simps2 cm2smsg_recvmsg1') |
|
214 |
done |
|
215 |
||
216 |
lemma cqm2sms_recvmsg: |
|
217 |
"\<lbrakk>valid (RecvMsg p q m # s); ms = msgs_of_queue (RecvMsg p q m # s) q'\<rbrakk> |
|
218 |
\<Longrightarrow> cqm2sms (RecvMsg p q m # s) q' ms = ( |
|
219 |
if (q' = q) |
|
220 |
then (case (cqm2sms s q (msgs_of_queue s q)) of |
|
221 |
Some sms \<Rightarrow> Some (tl sms) |
|
222 |
| _ \<Rightarrow> None) |
|
223 |
else cqm2sms s q' ms)" |
|
224 |
apply (frule vt_grant_os, frule vd_cons) |
|
32 | 225 |
apply (auto split:if_splits option.splits simp:cqm2sms_recvmsg1 cqm2sms_recvmsg2 |
226 |
dest!:current_has_sms') |
|
227 |
apply (case_tac "msgs_of_queue s q", simp) |
|
228 |
apply (frule_tac ms = "tl (msgs_of_queue s q)" in cqm2sms_recvmsg1) |
|
229 |
apply (drule_tac q = q in distinct_queue_msgs, simp+) |
|
230 |
apply (case_tac a, auto simp:cqm2sms.simps split:option.splits if_splits) |
|
231 |
done |
|
31 | 232 |
|
32 | 233 |
lemma cqm2sms_removemsgq: |
234 |
"\<lbrakk>valid (RemoveMsgq p q # s); q' \<noteq> q; q' \<in> current_msgqs s\<rbrakk> |
|
235 |
\<Longrightarrow> cqm2sms (RemoveMsgq p q # s) q' ms = cqm2sms s q' ms" |
|
236 |
apply (frule vt_grant_os, frule vd_cons) |
|
237 |
apply (induct ms rule:rev_induct) |
|
238 |
apply (auto simp:cqm2sms_simps2 cm2smsg_removemsgq split:option.splits if_splits) |
|
239 |
done |
|
31 | 240 |
|
32 | 241 |
lemmas cqm2sms_simps = cqm2sms_other cqm2sms_createmsgq cqm2sms_sendmsg cqm2sms_recvmsg cqm2sms_removemsgq |
31 | 242 |
|
243 |
(********************* cq2smsgq simpset ***********************) |
|
244 |
||
245 |
lemma cq2smsgq_other: |
|
32 | 246 |
"\<lbrakk>valid (e # s); \<forall> p q. e \<noteq> CreateMsgq p q; \<forall> p q m. e \<noteq> SendMsg p q m; |
31 | 247 |
\<forall> p q m. e \<noteq> RecvMsg p q m; \<forall> p q. e \<noteq> RemoveMsgq p q\<rbrakk> |
248 |
\<Longrightarrow> cq2smsgq (e # s) = cq2smsgq s" |
|
32 | 249 |
apply (frule cqm2sms_other, simp+) |
31 | 250 |
apply (frule vd_cons, frule vt_grant_os, rule ext, case_tac e) |
251 |
apply (auto simp:cq2smsgq_def sectxt_of_obj_simps |
|
252 |
split:t_object.splits option.splits if_splits |
|
32 | 253 |
dest:not_deleted_init_msg) |
254 |
done |
|
255 |
||
256 |
lemma cq2smsg_createmsgq: |
|
257 |
"valid (CreateMsgq p q # s) |
|
258 |
\<Longrightarrow> cq2smsgq (CreateMsgq p q # s) = (cq2smsgq s) (q := |
|
259 |
case (sectxt_of_obj s (O_proc p)) of |
|
260 |
Some psec \<Rightarrow> Some (Created, (fst psec, R_object, (snd o snd) psec), []) |
|
261 |
| None \<Rightarrow> None)" |
|
262 |
apply (frule vd_cons, frule vt_grant_os) |
|
263 |
apply (frule cqm2sms_createmsgq) |
|
264 |
apply (rule ext, auto simp:cq2smsgq_def sec_createmsgq |
|
265 |
split:option.splits if_splits dest:not_deleted_init_msgq) |
|
266 |
done |
|
19 | 267 |
|
32 | 268 |
lemma cq2smsg_sendmsg: |
269 |
"valid (SendMsg p q m # s) |
|
270 |
\<Longrightarrow> cq2smsgq (SendMsg p q m # s) = (cq2smsgq s) (q := |
|
271 |
case (cq2smsgq s q, sectxt_of_obj (SendMsg p q m # s) (O_msg q m)) of |
|
272 |
(Some (qi, sec, sms), Some msec) \<Rightarrow> |
|
273 |
Some (qi, sec, sms @ [(Created, msec, O_msg q m \<in> tainted (SendMsg p q m # s))]) |
|
274 |
| _ \<Rightarrow> None)" |
|
275 |
apply (frule vd_cons, frule vt_grant_os) |
|
276 |
apply (rule ext) |
|
277 |
apply (frule_tac q' = x in cqm2sms_sendmsg, simp) |
|
278 |
apply (auto simp:cq2smsgq_def sectxt_of_obj_simps split:option.splits if_splits |
|
279 |
dest!:current_has_sms' current_has_sec') |
|
280 |
done |
|
281 |
||
282 |
lemma current_has_smsgq: |
|
283 |
"\<lbrakk>q \<in> current_msgqs s; valid s\<rbrakk> \<Longrightarrow> \<exists> sq. cq2smsgq s q = Some sq" |
|
284 |
by (auto simp:cq2smsgq_def split:option.splits dest!:current_has_sec' current_has_sms') |
|
285 |
||
286 |
lemma current_has_smsgq': |
|
287 |
"\<lbrakk>cq2smsgq s q = None; valid s\<rbrakk> \<Longrightarrow> q \<notin> current_msgqs s" |
|
288 |
by (auto dest:current_has_smsgq) |
|
19 | 289 |
|
32 | 290 |
lemma cq2smsg_recvmsg: |
291 |
"valid (RecvMsg p q m # s) |
|
292 |
\<Longrightarrow> cq2smsgq (RecvMsg p q m # s) = (cq2smsgq s) (q := |
|
293 |
case (cq2smsgq s q) of |
|
294 |
Some (qi, sec, sms) \<Rightarrow> Some (qi, sec, tl sms) |
|
295 |
| _ \<Rightarrow> None)" |
|
296 |
apply (frule vd_cons, frule vt_grant_os) |
|
297 |
apply (rule ext, frule_tac q' = x in cqm2sms_recvmsg, simp) |
|
298 |
apply (auto simp add:cq2smsgq_def sectxt_of_obj_simps split:option.splits if_splits |
|
299 |
dest!:current_has_sec' current_has_sms' current_has_smsgq') |
|
300 |
done |
|
19 | 301 |
|
32 | 302 |
lemma cq2smsg_removemsgq: |
303 |
"\<lbrakk>valid (RemoveMsgq p q # s); q' \<noteq> q; q' \<in> current_msgqs s\<rbrakk> |
|
304 |
\<Longrightarrow> cq2smsgq (RemoveMsgq p q # s) q' = cq2smsgq s q'" |
|
305 |
apply (frule vd_cons, frule vt_grant_os) |
|
306 |
apply (auto simp:cq2smsgq_def sectxt_of_obj_simps cqm2sms_removemsgq split:if_splits option.splits |
|
307 |
dest!:current_has_sec' current_has_sms' current_has_smsgq') |
|
308 |
done |
|
309 |
||
310 |
lemmas cq2smsgq_simps = cq2smsgq_other cq2smsg_sendmsg cq2smsg_recvmsg cq2smsg_removemsgq |
|
19 | 311 |
|
32 | 312 |
lemma sm_in_sqsms_init_aux: |
313 |
"\<lbrakk>m \<in> set ms; init_cm2smsg q m = Some sm; q \<in> init_msgqs; |
|
314 |
init_cqm2sms q ms = Some sms\<rbrakk> \<Longrightarrow> sm \<in> set sms" |
|
315 |
apply (induct ms arbitrary:m sm sms) |
|
316 |
by (auto split:if_splits option.splits) |
|
317 |
||
318 |
lemma sm_in_sqsms_init: |
|
319 |
"\<lbrakk>m \<in> set (init_msgs_of_queue q); init_cm2smsg q m = Some sm; q \<in> init_msgqs; |
|
320 |
init_cqm2sms q (init_msgs_of_queue q) = Some sms\<rbrakk> \<Longrightarrow> sm \<in> set sms" |
|
321 |
by (simp add:sm_in_sqsms_init_aux) |
|
322 |
||
323 |
lemma cqm2sms_prop0: |
|
324 |
"\<lbrakk>m \<in> set ms; cm2smsg s q m = Some sm; cqm2sms s q ms = Some sms\<rbrakk> \<Longrightarrow> sm \<in> set sms" |
|
325 |
apply (induct ms arbitrary:m sm sms) |
|
326 |
apply (auto simp:cqm2sms.simps split:option.splits) |
|
327 |
done |
|
19 | 328 |
|
329 |
lemma sm_in_sqsms: |
|
330 |
"\<lbrakk>m \<in> set (msgs_of_queue s q); q \<in> current_msgqs s; valid s; cq2smsgq s q = Some (qi, qsec, sms); |
|
331 |
cm2smsg s q m = Some sm\<rbrakk> \<Longrightarrow> sm \<in> set sms" |
|
32 | 332 |
proof (induct s arbitrary:m q qi qsec sms sm) |
333 |
case Nil |
|
334 |
thus ?case |
|
335 |
by (simp add:cq2smsga_nil_prop cm2smsg_nil_prop init_cq2smsgq_def sm_in_sqsms_init |
|
336 |
split:option.splits) |
|
337 |
next |
|
338 |
case (Cons e s) |
|
339 |
hence p1:"\<And> m q qi qsec sms sm. \<lbrakk>m \<in> set (msgs_of_queue s q); q \<in> current_msgqs s; valid s; |
|
340 |
cq2smsgq s q = Some (qi, qsec, sms); cm2smsg s q m = Some sm\<rbrakk> |
|
341 |
\<Longrightarrow> sm \<in> set sms" and p2: "m \<in> set (msgs_of_queue (e # s) q)" |
|
342 |
and p3: "q \<in> current_msgqs (e # s)" and p4: "valid (e # s)" |
|
343 |
and p5: "cq2smsgq (e # s) q = Some (qi, qsec, sms)" |
|
344 |
and p6: "cm2smsg (e # s) q m = Some sm" by auto |
|
345 |
from p4 have os: "os_grant s e" and vd: "valid s" by (auto dest:vd_cons vt_grant_os) |
|
346 |
(* |
|
347 |
from p1 have p1': |
|
348 |
"\<And> m q qi qsec sms sm ms. \<lbrakk>m \<in> set ms; set ms \<subseteq> set (msgs_of_queue s q); q \<in> current_msgqs s; |
|
349 |
valid s; cq2smsgq s q = Some (qi, qsec, sms); cm2smsg s q m = Some sm\<rbrakk> |
|
350 |
\<Longrightarrow> sm \<in> set " |
|
351 |
*) |
|
352 |
show ?case using p2 p3 p4 p5 p6 vd os |
|
353 |
apply (case_tac e) |
|
354 |
apply (auto simp:cq2smsgq_simps cm2smsg_simps split:if_splits option.splits intro:p1) |
|
19 | 355 |
|
32 | 356 |
apply (rule_tac m = m and q = q and qi = qi and qsec = qsec in p1, simp+) |
357 |
apply (case_tac "q = nat2", simp) |
|
358 |
apply (drule cq2smsg_createmsgq, simp, simp) |
|
19 | 359 |
|
32 | 360 |
apply (drule_tac m = m and q = q and qi = qi and qsec = "(aa,ab,b)" in p1, simp+) |
361 |
||
362 |
apply (simp add:cq2smsgq_def split:option.splits) |
|
363 |
apply (rule_tac m = m and sm = sm in cqm2sms_prop0, simp+) |
|
364 |
apply (simp add:cqm2sms_recvmsg) |
|
365 |
done |
|
366 |
qed |
|
19 | 367 |
|
368 |
(****************** cf2sfile path simpset ***************) |
|
11 | 369 |
|
6
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
370 |
lemma sroot_only: |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
371 |
"cf2sfile s [] = Some sroot" |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
372 |
by (simp add:cf2sfile_def) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
373 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
374 |
lemma not_file_is_dir: |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
375 |
"\<lbrakk>\<not> is_file s f; f \<in> current_files s; valid s\<rbrakk> \<Longrightarrow> is_dir s f" |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
376 |
by (auto simp:is_file_def current_files_def is_dir_def |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
377 |
dest:finum_has_itag finum_has_ftag' split:t_inode_tag.splits option.splits) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
378 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
379 |
lemma not_dir_is_file: |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
380 |
"\<lbrakk>\<not> is_dir s f; f \<in> current_files s; valid s\<rbrakk> \<Longrightarrow> is_file s f" |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
381 |
by (auto simp:is_file_def current_files_def is_dir_def |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
382 |
dest:finum_has_itag finum_has_ftag' split:t_inode_tag.splits option.splits) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
383 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
384 |
lemma is_file_or_dir: |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
385 |
"\<lbrakk>f \<in> current_files s; valid s\<rbrakk> \<Longrightarrow> is_file s f \<or> is_dir s f" |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
386 |
by (auto dest:not_dir_is_file) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
387 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
388 |
lemma current_file_has_sfile: |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
389 |
"\<lbrakk>f \<in> current_files s; valid s\<rbrakk> \<Longrightarrow> \<exists> sf. cf2sfile s f = Some sf" |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
390 |
apply (induct f) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
391 |
apply (rule_tac x = "sroot" in exI, simp add:sroot_only) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
392 |
apply (frule parentf_in_current', simp, clarsimp) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
393 |
apply (frule parentf_is_dir'', simp) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
394 |
apply (frule is_file_or_dir, simp) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
395 |
apply (auto dest!:current_has_sec' |
8 | 396 |
simp:cf2sfile_def split:option.splits if_splits dest!:get_pfs_secs_prop') |
6
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
397 |
done |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
398 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
399 |
definition sectxt_of_pf :: "t_state \<Rightarrow> t_file \<Rightarrow> security_context_t option" |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
400 |
where |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
401 |
"sectxt_of_pf s f = (case f of [] \<Rightarrow> None | (a # pf) \<Rightarrow> sectxt_of_obj s (O_dir pf))" |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
402 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
403 |
definition get_parentfs_ctxts' :: "t_state \<Rightarrow> t_file \<Rightarrow> (security_context_t list) option" |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
404 |
where |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
405 |
"get_parentfs_ctxts' s f = (case f of [] \<Rightarrow> None | (a # pf) \<Rightarrow> get_parentfs_ctxts s pf)" |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
406 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
407 |
lemma is_file_has_sfile: |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
408 |
"\<lbrakk>is_file s f; valid s\<rbrakk> \<Longrightarrow> \<exists> sec psec asecs. cf2sfile s f = Some |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
409 |
(if (\<not> deleted (O_file f) s \<and> is_init_file f) then Init f else Created, |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
410 |
sec, Some psec, set asecs) \<and> (sectxt_of_obj s (O_file f) = Some sec) \<and> |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
411 |
(sectxt_of_pf s f = Some psec) \<and> (get_parentfs_ctxts' s f = Some asecs)" |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
412 |
apply (case_tac f, simp, drule root_is_dir', simp, simp) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
413 |
apply (frule is_file_in_current) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
414 |
apply (drule current_file_has_sfile, simp) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
415 |
apply (auto simp:cf2sfile_def sectxt_of_pf_def get_parentfs_ctxts'_def split:if_splits option.splits) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
416 |
done |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
417 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
418 |
lemma is_dir_has_sfile: |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
419 |
"\<lbrakk>is_dir s f; valid s\<rbrakk> \<Longrightarrow> (case f of |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
420 |
[] \<Rightarrow> cf2sfile s f = Some sroot |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
421 |
| a # pf \<Rightarrow> (\<exists> sec psec asecs. cf2sfile s f = Some |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
422 |
(if (\<not> deleted (O_dir f) s \<and> is_init_dir f) then Init f else Created, |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
423 |
sec, Some psec, set asecs) \<and> (sectxt_of_obj s (O_dir f) = Some sec) \<and> |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
424 |
(sectxt_of_obj s (O_dir pf) = Some psec) \<and> (get_parentfs_ctxts s pf = Some asecs)))" |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
425 |
apply (case_tac f, simp add:sroot_only) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
426 |
apply (frule is_dir_in_current, frule is_dir_not_file) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
427 |
apply (drule current_file_has_sfile, simp) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
428 |
apply (auto simp:cf2sfile_def split:if_splits option.splits) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
429 |
done |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
430 |
|
7 | 431 |
lemma sroot_set: |
432 |
"valid s \<Longrightarrow> \<exists> sec. sroot = (Init [], sec, None, {}) \<and> sectxt_of_obj s (O_dir []) = Some sec" |
|
433 |
apply (frule root_is_dir) |
|
434 |
apply (drule is_dir_has_sec, simp) |
|
435 |
apply (auto simp:sroot_def sec_of_root_def sectxt_of_obj_def type_of_obj.simps |
|
436 |
root_type_remains root_user_remains |
|
437 |
dest!:root_has_type' root_has_user' root_has_init_type' root_has_init_user' |
|
438 |
split:option.splits) |
|
439 |
done |
|
440 |
||
441 |
lemma cf2sfile_path_file: |
|
442 |
"\<lbrakk>is_file s (f # pf); valid s\<rbrakk> |
|
443 |
\<Longrightarrow> cf2sfile s (f # pf) = ( |
|
444 |
case (cf2sfile s pf) of |
|
445 |
Some (pfi, pfsec, psec, asecs) \<Rightarrow> |
|
446 |
(case (sectxt_of_obj s (O_file (f # pf))) of |
|
447 |
Some fsec \<Rightarrow> Some (if (\<not> deleted (O_file (f # pf)) s \<and> is_init_file (f # pf)) then Init (f # pf) |
|
448 |
else Created, fsec, Some pfsec, asecs \<union> {pfsec}) |
|
449 |
| None \<Rightarrow> None) |
|
450 |
| _ \<Rightarrow> None)" |
|
451 |
apply (frule is_file_in_current, drule parentf_is_dir'', simp) |
|
452 |
apply (frule is_dir_has_sfile, simp, frule is_file_has_sfile, simp) |
|
453 |
apply (frule sroot_set) |
|
454 |
apply (case_tac pf, (clarsimp simp:get_parentfs_ctxts'_def sectxt_of_pf_def)+) |
|
455 |
done |
|
456 |
||
457 |
lemma cf2sfile_path_dir: |
|
458 |
"\<lbrakk>is_dir s (f # pf); valid s\<rbrakk> |
|
459 |
\<Longrightarrow> cf2sfile s (f # pf) = ( |
|
460 |
case (cf2sfile s pf) of |
|
461 |
Some (pfi, pfsec, psec, asecs) \<Rightarrow> |
|
462 |
(case (sectxt_of_obj s (O_dir (f # pf))) of |
|
463 |
Some fsec \<Rightarrow> Some (if (\<not> deleted (O_dir (f # pf)) s \<and> is_init_dir (f # pf)) then Init (f # pf) |
|
464 |
else Created, fsec, Some pfsec, asecs \<union> {pfsec}) |
|
465 |
| None \<Rightarrow> None) |
|
466 |
| _ \<Rightarrow> None)" |
|
467 |
apply (frule is_dir_in_current, drule parentf_is_dir'', simp) |
|
468 |
apply (frule_tac f = "f # pf" in is_dir_has_sfile, simp) |
|
469 |
apply (frule_tac f = "pf" in is_dir_has_sfile, simp) |
|
470 |
apply (frule sroot_set) |
|
471 |
apply (case_tac pf, (clarsimp simp:get_parentfs_ctxts'_def sectxt_of_pf_def)+) |
|
472 |
done |
|
473 |
||
6
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
474 |
lemma cf2sfile_path: |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
475 |
"\<lbrakk>f # pf \<in> current_files s; valid s\<rbrakk> \<Longrightarrow> cf2sfile s (f # pf) = ( |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
476 |
case (cf2sfile s pf) of |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
477 |
Some (pfi, pfsec, psec, asecs) \<Rightarrow> (if (is_file s (f # pf)) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
478 |
then (case (sectxt_of_obj s (O_file (f # pf))) of |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
479 |
Some fsec \<Rightarrow> Some (if (\<not> deleted (O_file (f # pf)) s \<and> is_init_file (f # pf)) then Init (f # pf) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
480 |
else Created, fsec, Some pfsec, asecs \<union> {pfsec}) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
481 |
| None \<Rightarrow> None) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
482 |
else (case (sectxt_of_obj s (O_dir (f # pf))) of |
7 | 483 |
Some fsec \<Rightarrow> Some (if (\<not> deleted (O_dir (f # pf)) s \<and> is_init_dir (f # pf)) then Init (f # pf) |
6
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
484 |
else Created, fsec, Some pfsec, asecs \<union> {pfsec}) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
485 |
| None \<Rightarrow> None) ) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
486 |
| None \<Rightarrow> None)" |
7 | 487 |
apply (drule is_file_or_dir, simp) |
488 |
apply (erule disjE) |
|
489 |
apply (frule cf2sfile_path_file, simp) defer |
|
490 |
apply (frule cf2sfile_path_dir, simp, drule is_dir_not_file) |
|
491 |
apply (auto split:option.splits) |
|
492 |
done |
|
493 |
||
8 | 494 |
lemma cf2sfile_path_file_prop1: |
495 |
"\<lbrakk>is_file s (f # pf); cf2sfile s pf = Some (pfi, pfsec, psec, asecs); valid s\<rbrakk> |
|
496 |
\<Longrightarrow> \<exists> fsec. cf2sfile s (f # pf) = |
|
497 |
Some (if (\<not> deleted (O_file (f # pf)) s \<and> is_init_file (f # pf)) then Init (f # pf) |
|
498 |
else Created, fsec, Some pfsec, asecs \<union> {pfsec}) \<and> |
|
499 |
sectxt_of_obj s (O_file (f # pf)) = Some fsec" |
|
500 |
apply (frule is_file_has_sfile, simp) |
|
501 |
by (auto simp:cf2sfile_path_file) |
|
7 | 502 |
|
8 | 503 |
lemma cf2sfile_path_file_prop2: |
504 |
"\<lbrakk>is_file s (f # pf); cf2sfile s pf = Some (pfi, pfsec, psec, asecs); |
|
505 |
sectxt_of_obj s (O_file (f # pf)) = Some fsec; valid s\<rbrakk> \<Longrightarrow> cf2sfile s (f # pf) = |
|
506 |
Some (if (\<not> deleted (O_file (f # pf)) s \<and> is_init_file (f # pf)) then Init (f # pf) |
|
507 |
else Created, fsec, Some pfsec, asecs \<union> {pfsec})" |
|
508 |
by (drule cf2sfile_path_file_prop1, auto) |
|
7 | 509 |
|
8 | 510 |
lemma cf2sfile_path_dir_prop1: |
511 |
"\<lbrakk>is_dir s (f # pf); cf2sfile s pf = Some (pfi, pfsec, psec, asecs); valid s\<rbrakk> |
|
512 |
\<Longrightarrow> \<exists> fsec. cf2sfile s (f # pf) = |
|
513 |
Some (if (\<not> deleted (O_dir (f # pf)) s \<and> is_init_dir (f # pf)) then Init (f # pf) |
|
514 |
else Created, fsec, Some pfsec, asecs \<union> {pfsec}) \<and> |
|
515 |
sectxt_of_obj s (O_dir (f # pf)) = Some fsec" |
|
516 |
apply (frule is_dir_has_sfile, simp) |
|
517 |
by (auto simp:cf2sfile_path_dir) |
|
6
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
518 |
|
8 | 519 |
lemma cf2sfile_path_dir_prop2: |
520 |
"\<lbrakk>is_dir s (f # pf); cf2sfile s pf = Some (pfi, pfsec, psec, asecs); |
|
521 |
sectxt_of_obj s (O_dir (f # pf)) = Some fsec; valid s\<rbrakk> \<Longrightarrow> cf2sfile s (f # pf) = |
|
522 |
Some (if (\<not> deleted (O_dir (f # pf)) s \<and> is_init_dir (f # pf)) then Init (f # pf) |
|
523 |
else Created, fsec, Some pfsec, asecs \<union> {pfsec})" |
|
524 |
by (drule cf2sfile_path_dir_prop1, auto) |
|
6
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
525 |
|
8 | 526 |
(**************** cf2sfile event list simpset ****************) |
4 | 527 |
|
8 | 528 |
lemma cf2sfile_open_none': |
529 |
"valid (Open p f flag fd None # s) \<Longrightarrow> cf2sfile (Open p f flag fd None # s) f'= cf2sfile s f'" |
|
4 | 530 |
apply (frule vd_cons, frule vt_grant_os) |
531 |
apply (induct f', simp add:cf2sfile_def) |
|
532 |
apply (simp add:cf2sfile_def is_file_simps is_dir_simps current_files_simps sectxt_of_obj_simps |
|
533 |
get_parentfs_ctxts_simps) |
|
534 |
done |
|
535 |
||
536 |
lemma cf2sfile_open_none: |
|
537 |
"valid (Open p f flag fd None # s) \<Longrightarrow> cf2sfile (Open p f flag fd None # s) = cf2sfile s" |
|
8 | 538 |
apply (rule ext) |
539 |
by (simp add:cf2sfile_open_none') |
|
1 | 540 |
|
541 |
lemma cf2sfile_open_some1: |
|
542 |
"\<lbrakk>valid (Open p f flag fd (Some inum) # s); f' \<in> current_files s\<rbrakk> |
|
543 |
\<Longrightarrow> cf2sfile (Open p f flag fd (Some inum) # s) f' = cf2sfile s f'" |
|
8 | 544 |
apply (frule vd_cons, frule vt_grant_os, frule noroot_events) |
4 | 545 |
apply (case_tac "f = f'", simp) |
546 |
apply (induct f', simp add:sroot_only, simp) |
|
3 | 547 |
apply (frule parentf_in_current', simp+) |
4 | 548 |
apply (simp add:cf2sfile_def is_file_simps is_dir_simps current_files_simps sectxt_of_obj_simps |
1 | 549 |
get_parentfs_ctxts_simps) |
550 |
done |
|
551 |
||
552 |
lemma cf2sfile_open_some2: |
|
553 |
"\<lbrakk>valid (Open p f flag fd (Some inum) # s); is_file s f'\<rbrakk> |
|
8 | 554 |
\<Longrightarrow> cf2sfile (Open p f flag fd (Some inum) # s) f' = cf2sfile s f'" |
1 | 555 |
apply (frule vd_cons, drule is_file_in_current) |
556 |
by (simp add:cf2sfile_open_some1) |
|
557 |
||
558 |
lemma cf2sfile_open_some3: |
|
559 |
"\<lbrakk>valid (Open p f flag fd (Some inum) # s); is_dir s f'\<rbrakk> |
|
8 | 560 |
\<Longrightarrow> cf2sfile (Open p f flag fd (Some inum) # s) f' = cf2sfile s f'" |
1 | 561 |
apply (frule vd_cons, drule is_dir_in_current) |
562 |
by (simp add:cf2sfile_open_some1) |
|
563 |
||
6
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
564 |
lemma cf2sfile_open_some4: |
8 | 565 |
"valid (Open p f flag fd (Some inum) # s) \<Longrightarrow> cf2sfile (Open p f flag fd (Some inum) # s) f = ( |
1 | 566 |
case (parent f) of |
567 |
Some pf \<Rightarrow> (case (sectxt_of_obj (Open p f flag fd (Some inum) # s) (O_file f), sectxt_of_obj s (O_dir pf), |
|
568 |
get_parentfs_ctxts s pf) of |
|
569 |
(Some sec, Some psec, Some asecs) \<Rightarrow> Some (Created, sec, Some psec, set asecs) |
|
570 |
| _ \<Rightarrow> None) |
|
571 |
| None \<Rightarrow> None)" |
|
572 |
apply (frule vd_cons, frule vt_grant_os, frule noroot_events) |
|
4 | 573 |
apply (case_tac f, simp) |
574 |
apply (simp add:cf2sfile_def is_file_simps is_dir_simps current_files_simps sectxt_of_obj_simps |
|
575 |
get_parentfs_ctxts_simps) |
|
6
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
576 |
apply (rule impI, (erule conjE)+) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
577 |
apply (drule not_deleted_init_file, simp+) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
578 |
apply (simp add:is_file_in_current) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
579 |
done |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
580 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
581 |
lemma cf2sfile_open: |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
582 |
"\<lbrakk>valid (Open p f flag fd opt # s); f' \<in> current_files (Open p f flag fd opt # s)\<rbrakk> |
8 | 583 |
\<Longrightarrow> cf2sfile (Open p f flag fd opt # s) f' = ( |
584 |
if (opt = None) then cf2sfile s f' |
|
585 |
else if (f' = f) |
|
6
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
586 |
then (case (parent f) of |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
587 |
Some pf \<Rightarrow> (case (sectxt_of_obj (Open p f flag fd opt # s) (O_file f), sectxt_of_obj s (O_dir pf), |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
588 |
get_parentfs_ctxts s pf) of |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
589 |
(Some sec, Some psec, Some asecs) \<Rightarrow> Some (Created, sec, Some psec, set asecs) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
590 |
| _ \<Rightarrow> None) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
591 |
| None \<Rightarrow> None) |
8 | 592 |
else cf2sfile s f')" |
6
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
593 |
apply (case_tac opt) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
594 |
apply (simp add:cf2sfile_open_none) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
595 |
apply (case_tac "f = f'") |
8 | 596 |
apply (simp add:cf2sfile_open_some4 split:option.splits) |
597 |
apply (simp add:cf2sfile_open_some1 current_files_simps) |
|
6
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
598 |
done |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
599 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
600 |
lemma cf2sfile_mkdir1: |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
601 |
"\<lbrakk>valid (Mkdir p f i # s); f' \<in> current_files s\<rbrakk> |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
602 |
\<Longrightarrow> cf2sfile (Mkdir p f i # s) f' = cf2sfile s f'" |
8 | 603 |
apply (frule vd_cons, frule vt_grant_os, frule noroot_events) |
6
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
604 |
apply (case_tac "f = f'", simp) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
605 |
apply (induct f', simp add:sroot_only, simp) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
606 |
apply (frule parentf_in_current', simp+) |
8 | 607 |
apply (case_tac "f = f'", simp) |
608 |
apply (simp add:cf2sfile_path is_file_simps is_dir_simps current_files_simps sectxt_of_obj_simps |
|
6
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
609 |
get_parentfs_ctxts_simps split:if_splits option.splits) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
610 |
done |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
611 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
612 |
lemma cf2sfile_mkdir2: |
8 | 613 |
"\<lbrakk>valid (Mkdir p f i # s); is_file s f'\<rbrakk> |
614 |
\<Longrightarrow> cf2sfile (Mkdir p f i # s) f' = cf2sfile s f'" |
|
6
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
615 |
apply (frule vd_cons, drule is_file_in_current) |
8 | 616 |
by (simp add:cf2sfile_mkdir1) |
6
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
617 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
618 |
lemma cf2sfile_mkdir3: |
8 | 619 |
"\<lbrakk>valid (Mkdir p f i # s); is_dir s f'\<rbrakk> |
620 |
\<Longrightarrow> cf2sfile (Mkdir p f i # s) f' = cf2sfile s f'" |
|
6
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
621 |
apply (frule vd_cons, drule is_dir_in_current) |
8 | 622 |
by (simp add:cf2sfile_mkdir1) |
6
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
623 |
|
8 | 624 |
lemma cf2sfile_mkdir4: |
625 |
"valid (Mkdir p f i # s) |
|
626 |
\<Longrightarrow> cf2sfile (Mkdir p f i # s) f = (case (parent f) of |
|
627 |
Some pf \<Rightarrow> (case (sectxt_of_obj (Mkdir p f i # s) (O_dir f), sectxt_of_obj s (O_dir pf), |
|
628 |
get_parentfs_ctxts s pf) of |
|
629 |
(Some sec, Some psec, Some asecs) \<Rightarrow> Some (Created, sec, Some psec, set asecs) |
|
630 |
| _ \<Rightarrow> None) |
|
631 |
| None \<Rightarrow> None)" |
|
632 |
apply (frule vd_cons, frule vt_grant_os, frule noroot_events) |
|
633 |
apply (case_tac f, simp) |
|
634 |
apply (clarsimp simp:os_grant.simps) |
|
635 |
apply (simp add:sectxt_of_obj_simps) |
|
636 |
apply (frule current_proc_has_sec, simp) |
|
637 |
apply (frule is_dir_has_sec, simp) |
|
638 |
apply (frule get_pfs_secs_prop, simp) |
|
639 |
apply (frule is_dir_not_file) |
|
640 |
apply (auto simp add:cf2sfile_def is_file_simps is_dir_simps current_files_simps sectxt_of_obj_simps |
|
641 |
get_parentfs_ctxts_simps split:option.splits if_splits |
|
642 |
dest:not_deleted_init_dir is_dir_in_current not_deleted_init_file is_file_in_current) |
|
643 |
done |
|
6
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
644 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
645 |
lemma cf2sfile_mkdir: |
8 | 646 |
"\<lbrakk>valid (Mkdir p f i # s); f' \<in> current_files (Mkdir p f i # s)\<rbrakk> |
647 |
\<Longrightarrow> cf2sfile (Mkdir p f i # s) f' = ( |
|
648 |
if (f' = f) |
|
6
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
649 |
then (case (parent f) of |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
650 |
Some pf \<Rightarrow> (case (sectxt_of_obj (Mkdir p f i # s) (O_dir f), sectxt_of_obj s (O_dir pf), |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
651 |
get_parentfs_ctxts s pf) of |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
652 |
(Some sec, Some psec, Some asecs) \<Rightarrow> Some (Created, sec, Some psec, set asecs) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
653 |
| _ \<Rightarrow> None) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
654 |
| None \<Rightarrow> None) |
8 | 655 |
else cf2sfile s f')" |
656 |
apply (case_tac "f = f'") |
|
657 |
apply (simp add:cf2sfile_mkdir4 split:option.splits) |
|
658 |
apply (simp add:cf2sfile_mkdir1 current_files_simps) |
|
659 |
done |
|
660 |
||
661 |
lemma cf2sfile_linkhard1: |
|
662 |
"\<lbrakk>valid (LinkHard p oldf f # s); f' \<in> current_files s\<rbrakk> |
|
663 |
\<Longrightarrow> cf2sfile (LinkHard p oldf f# s) f' = cf2sfile s f'" |
|
664 |
apply (frule vd_cons, frule vt_grant_os, frule noroot_events) |
|
665 |
apply (case_tac "f = f'", simp) |
|
666 |
apply (induct f', simp add:sroot_only, simp) |
|
667 |
apply (frule parentf_in_current', simp+) |
|
668 |
apply (simp add:cf2sfile_def is_file_simps is_dir_simps current_files_simps sectxt_of_obj_simps |
|
669 |
get_parentfs_ctxts_simps split:if_splits option.splits) |
|
670 |
done |
|
671 |
||
672 |
lemma cf2sfile_linkhard2: |
|
673 |
"\<lbrakk>valid (LinkHard p oldf f # s); is_file s f'\<rbrakk> |
|
674 |
\<Longrightarrow> cf2sfile (LinkHard p oldf f # s) f' = cf2sfile s f'" |
|
675 |
apply (frule vd_cons, drule is_file_in_current) |
|
676 |
by (simp add:cf2sfile_linkhard1) |
|
677 |
||
678 |
lemma cf2sfile_linkhard3: |
|
679 |
"\<lbrakk>valid (LinkHard p oldf f # s); is_dir s f'\<rbrakk> |
|
680 |
\<Longrightarrow> cf2sfile (LinkHard p oldf f # s) f' = cf2sfile s f'" |
|
681 |
apply (frule vd_cons, drule is_dir_in_current) |
|
682 |
by (simp add:cf2sfile_linkhard1) |
|
683 |
||
684 |
lemma cf2sfile_linkhard4: |
|
685 |
"valid (LinkHard p oldf f # s) |
|
686 |
\<Longrightarrow> cf2sfile (LinkHard p oldf f # s) f = (case (parent f) of |
|
687 |
Some pf \<Rightarrow> (case (sectxt_of_obj (LinkHard p oldf f # s) (O_file f), sectxt_of_obj s (O_dir pf), |
|
688 |
get_parentfs_ctxts s pf) of |
|
689 |
(Some sec, Some psec, Some asecs) \<Rightarrow> Some (Created, sec, Some psec, set asecs) |
|
690 |
| _ \<Rightarrow> None) |
|
691 |
| None \<Rightarrow> None)" |
|
692 |
apply (frule vd_cons, frule vt_grant_os, frule noroot_events) |
|
693 |
apply (case_tac f, simp) |
|
694 |
apply (simp add:cf2sfile_def is_file_simps is_dir_simps current_files_simps sectxt_of_obj_simps |
|
695 |
get_parentfs_ctxts_simps) |
|
696 |
apply (rule impI, (erule conjE)+) |
|
697 |
apply (drule not_deleted_init_file, simp+) |
|
698 |
apply (simp add:is_file_in_current) |
|
699 |
done |
|
700 |
||
701 |
lemma cf2sfile_linkhard: |
|
702 |
"\<lbrakk>valid (LinkHard p oldf f # s); f' \<in> current_files (LinkHard p oldf f # s)\<rbrakk> |
|
703 |
\<Longrightarrow> cf2sfile (LinkHard p oldf f # s) f' = ( |
|
704 |
if (f' = f) |
|
705 |
then (case (parent f) of |
|
706 |
Some pf \<Rightarrow> (case (sectxt_of_obj (LinkHard p oldf f # s) (O_file f), sectxt_of_obj s (O_dir pf), |
|
707 |
get_parentfs_ctxts s pf) of |
|
708 |
(Some sec, Some psec, Some asecs) \<Rightarrow> Some (Created, sec, Some psec, set asecs) |
|
709 |
| _ \<Rightarrow> None) |
|
710 |
| None \<Rightarrow> None) |
|
711 |
else cf2sfile s f')" |
|
712 |
apply (case_tac "f = f'") |
|
713 |
apply (simp add:cf2sfile_linkhard4 split:option.splits) |
|
714 |
apply (simp add:cf2sfile_linkhard1 current_files_simps) |
|
715 |
done |
|
716 |
||
717 |
lemma cf2sfile_other: |
|
718 |
"\<lbrakk>ff \<in> current_files s; |
|
719 |
\<forall> p f flag fd opt. e \<noteq> Open p f flag fd opt; |
|
720 |
\<forall> p fd. e \<noteq> CloseFd p fd; |
|
721 |
\<forall> p f. e \<noteq> UnLink p f; |
|
722 |
\<forall> p f. e \<noteq> Rmdir p f; |
|
723 |
\<forall> p f i. e \<noteq> Mkdir p f i; |
|
724 |
\<forall> p f f'. e \<noteq> LinkHard p f f'; |
|
725 |
valid (e # s)\<rbrakk> \<Longrightarrow> cf2sfile (e # s) ff = cf2sfile s ff" |
|
6
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
726 |
apply (frule vd_cons, frule vt_grant_os) |
8 | 727 |
apply (induct ff, simp add:sroot_only) |
728 |
apply (frule parentf_in_current', simp+, case_tac e) |
|
729 |
apply (auto simp:current_files_simps is_file_simps is_dir_simps sectxt_of_obj_simps cf2sfile_path |
|
730 |
split:if_splits option.splits) |
|
731 |
done |
|
6
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
732 |
|
10 | 733 |
lemma cf2sfile_other': |
734 |
"\<lbrakk>valid (e # s); |
|
735 |
\<forall> p f flag fd opt. e \<noteq> Open p f flag fd opt; |
|
736 |
\<forall> p fd. e \<noteq> CloseFd p fd; |
|
737 |
\<forall> p f. e \<noteq> UnLink p f; |
|
738 |
\<forall> p f. e \<noteq> Rmdir p f; |
|
739 |
\<forall> p f i. e \<noteq> Mkdir p f i; |
|
740 |
\<forall> p f f'. e \<noteq> LinkHard p f f'; |
|
741 |
ff \<in> current_files s\<rbrakk> \<Longrightarrow> cf2sfile (e # s) ff = cf2sfile s ff" |
|
742 |
by (auto intro!:cf2sfile_other) |
|
743 |
||
8 | 744 |
lemma cf2sfile_unlink: |
745 |
"\<lbrakk>valid (UnLink p f # s); f' \<in> current_files (UnLink p f # s)\<rbrakk> |
|
746 |
\<Longrightarrow> cf2sfile (UnLink p f # s) f' = cf2sfile s f'" |
|
747 |
apply (frule vd_cons, frule vt_grant_os) |
|
748 |
apply (simp add:current_files_simps split:if_splits) |
|
749 |
apply (auto simp:cf2sfile_def sectxt_of_obj_simps get_parentfs_ctxts_simps is_file_simps is_dir_simps |
|
10 | 750 |
split:if_splits option.splits) |
1 | 751 |
done |
752 |
||
10 | 753 |
lemma cf2sfile_rmdir: |
754 |
"\<lbrakk>valid (Rmdir p f # s); f' \<in> current_files (Rmdir p f # s)\<rbrakk> |
|
755 |
\<Longrightarrow> cf2sfile (Rmdir p f # s) f' = cf2sfile s f'" |
|
756 |
apply (frule vd_cons, frule vt_grant_os) |
|
757 |
apply (simp add:current_files_simps split:if_splits) |
|
758 |
apply (auto simp:cf2sfile_def sectxt_of_obj_simps get_parentfs_ctxts_simps is_file_simps is_dir_simps |
|
759 |
split:if_splits option.splits) |
|
1 | 760 |
done |
761 |
||
10 | 762 |
lemma pfdof_simp5: "\<lbrakk>proc_fd_of_file s f = {(p, fd)}; file_of_proc_fd s p fd = None\<rbrakk> \<Longrightarrow> False" |
763 |
apply (subgoal_tac "(p, fd) \<in> proc_fd_of_file s f") |
|
764 |
by (simp add:pfdof_simp2, simp) |
|
765 |
||
766 |
lemma pfdof_simp6: "proc_fd_of_file s f = {(p, fd)} \<Longrightarrow> file_of_proc_fd s p fd = Some f" |
|
767 |
apply (subgoal_tac "(p, fd) \<in> proc_fd_of_file s f") |
|
768 |
by (simp add:pfdof_simp2, simp) |
|
769 |
||
770 |
lemma cf2sfile_closefd: |
|
771 |
"\<lbrakk>valid (CloseFd p fd # s); f \<in> current_files (CloseFd p fd # s)\<rbrakk> |
|
772 |
\<Longrightarrow> cf2sfile (CloseFd p fd # s) f = cf2sfile s f" |
|
773 |
apply (frule vd_cons, frule vt_grant_os) |
|
774 |
apply (simp add:current_files_simps split:if_splits option.splits) |
|
34 | 775 |
(* costs too much time, but solved *) |
10 | 776 |
|
777 |
apply (auto simp:cf2sfile_def sectxt_of_obj_simps get_parentfs_ctxts_simps is_file_simps is_dir_simps |
|
778 |
split:if_splits option.splits |
|
779 |
dest:init_file_dir_conflict pfdof_simp5 pfdof_simp6 file_of_pfd_is_file |
|
780 |
not_deleted_init_file not_deleted_init_dir is_file_not_dir is_dir_not_file |
|
781 |
dest!:current_has_sec') |
|
782 |
done |
|
1 | 783 |
|
10 | 784 |
lemmas cf2sfile_simps = cf2sfile_open cf2sfile_mkdir cf2sfile_linkhard cf2sfile_other |
785 |
cf2sfile_unlink cf2sfile_rmdir cf2sfile_closefd |
|
786 |
||
787 |
(*********** cfd2sfd simpset *********) |
|
788 |
||
789 |
lemma cfd2sfd_open1: |
|
790 |
"valid (Open p f flags fd opt # s) |
|
791 |
\<Longrightarrow> cfd2sfd (Open p f flags fd opt # s) p fd = |
|
792 |
(case (sectxt_of_obj (Open p f flags fd opt # s) (O_fd p fd), cf2sfile (Open p f flags fd opt # s) f) of |
|
793 |
(Some sec, Some sf) \<Rightarrow> Some (sec, flags, sf) |
|
794 |
| _ \<Rightarrow> None)" |
|
795 |
by (simp add:cfd2sfd_def sectxt_of_obj_simps split:if_splits) |
|
1 | 796 |
|
10 | 797 |
lemma cfd2sfd_open_some2: |
798 |
"\<lbrakk>valid (Open p f flags fd (Some inum) # s); file_of_proc_fd s p' fd' = Some f'\<rbrakk> |
|
799 |
\<Longrightarrow> cfd2sfd (Open p f flags fd (Some inum) # s) p' fd' = cfd2sfd s p' fd'" |
|
800 |
apply (frule vd_cons, frule vt_grant_os) |
|
801 |
apply (frule proc_fd_in_fds, simp) |
|
802 |
apply (frule file_of_proc_fd_in_curf, simp) |
|
803 |
apply (case_tac "f = f'", simp) |
|
804 |
apply (simp add:cfd2sfd_def sectxt_of_obj_simps cf2sfile_open_some1) |
|
805 |
apply (case_tac "p = p'", simp) |
|
806 |
apply (rule conjI, rule impI, simp) |
|
807 |
apply (drule cf2sfile_open_some1, simp) |
|
808 |
apply (auto split:option.splits)[1] |
|
809 |
apply simp |
|
810 |
apply (drule cf2sfile_open_some1, simp) |
|
811 |
apply (auto split:option.splits)[1] |
|
1 | 812 |
done |
813 |
||
10 | 814 |
lemma cfd2sfd_open_none2: |
815 |
"\<lbrakk>valid (Open p f flags fd None # s); file_of_proc_fd s p' fd' = Some f'\<rbrakk> |
|
816 |
\<Longrightarrow> cfd2sfd (Open p f flags fd None # s) p' fd' = cfd2sfd s p' fd'" |
|
817 |
apply (frule vd_cons, frule vt_grant_os) |
|
818 |
apply (frule proc_fd_in_fds, simp) |
|
819 |
apply (frule file_of_proc_fd_in_curf, simp) |
|
820 |
apply (simp add:cfd2sfd_def sectxt_of_obj_simps cf2sfile_open_none) |
|
821 |
apply (case_tac "p = p'", simp) |
|
822 |
apply (rule conjI, rule impI, simp) |
|
823 |
apply (drule cf2sfile_open_none) |
|
824 |
apply (auto split:option.splits)[1] |
|
825 |
apply simp |
|
826 |
apply (drule cf2sfile_open_none) |
|
827 |
apply (auto split:option.splits)[1] |
|
828 |
done |
|
829 |
||
830 |
lemma cfd2sfd_open2: |
|
831 |
"\<lbrakk>valid (Open p f flags fd opt # s); file_of_proc_fd s p' fd' = Some f'\<rbrakk> |
|
832 |
\<Longrightarrow> cfd2sfd (Open p f flags fd opt # s) p' fd' = cfd2sfd s p' fd'" |
|
833 |
apply (case_tac opt) |
|
834 |
apply (simp add:cfd2sfd_open_none2) |
|
835 |
apply (simp add:cfd2sfd_open_some2) |
|
1 | 836 |
done |
837 |
||
10 | 838 |
lemma cfd2sfd_open: |
839 |
"\<lbrakk>valid (Open p f flags fd opt # s); file_of_proc_fd (Open p f flags fd opt # s) p' fd' = Some f'\<rbrakk> |
|
840 |
\<Longrightarrow> cfd2sfd (Open p f flags fd opt # s) p' fd' = (if (p' = p \<and> fd' = fd) then |
|
841 |
(case (sectxt_of_obj (Open p f flags fd opt # s) (O_fd p fd), cf2sfile (Open p f flags fd opt # s) f) of |
|
842 |
(Some sec, Some sf) \<Rightarrow> Some (sec, flags, sf) |
|
843 |
| _ \<Rightarrow> None) else cfd2sfd s p' fd')" |
|
844 |
apply (simp split:if_splits) |
|
845 |
apply (simp add:cfd2sfd_open1 split:option.splits) |
|
846 |
apply (simp add:cfd2sfd_open2) |
|
847 |
apply (rule impI, simp) |
|
1 | 848 |
done |
849 |
||
10 | 850 |
lemma cfd2sfd_closefd: |
851 |
"\<lbrakk>valid (CloseFd p fd # s); file_of_proc_fd (CloseFd p fd # s) p' fd' = Some f\<rbrakk> |
|
852 |
\<Longrightarrow> cfd2sfd (CloseFd p fd # s) p' fd' = cfd2sfd s p' fd'" |
|
853 |
apply (frule vd_cons, frule vt_grant_os) |
|
854 |
apply (frule proc_fd_in_fds, simp) |
|
855 |
apply (frule file_of_proc_fd_in_curf, simp) |
|
856 |
apply (frule cf2sfile_closefd, simp) |
|
857 |
apply (simp add:cfd2sfd_def sectxt_of_obj_simps) |
|
858 |
apply (auto split:option.splits if_splits) |
|
859 |
done |
|
1 | 860 |
|
10 | 861 |
lemma cfd2sfd_clone: |
862 |
"\<lbrakk>valid (Clone p p' fds shms # s); file_of_proc_fd (Clone p p' fds shms # s) p'' fd' = Some f\<rbrakk> |
|
863 |
\<Longrightarrow> cfd2sfd (Clone p p' fds shms # s) p'' fd' = ( |
|
864 |
if (p'' = p') then cfd2sfd s p fd' |
|
865 |
else cfd2sfd s p'' fd')" |
|
866 |
apply (frule vd_cons, frule vt_grant_os) |
|
867 |
apply (frule proc_fd_in_fds, simp) |
|
868 |
apply (frule file_of_proc_fd_in_curf, simp, simp add:current_files_simps) |
|
869 |
apply (frule_tac cf2sfile_other', simp+) |
|
870 |
apply (simp add:cfd2sfd_def sectxt_of_obj_simps) |
|
871 |
apply (case_tac "p'' = p'", simp) |
|
872 |
apply (auto split:option.splits if_splits)[1] |
|
873 |
apply (simp) |
|
874 |
apply (auto split:option.splits if_splits)[1] |
|
1 | 875 |
done |
876 |
||
10 | 877 |
lemma cfd2sfd_execve: |
878 |
"\<lbrakk>valid (Execve p f fds # s); file_of_proc_fd (Execve p f fds # s) p' fd' = Some f'\<rbrakk> |
|
879 |
\<Longrightarrow> cfd2sfd (Execve p f fds # s) p' fd' = cfd2sfd s p' fd'" |
|
880 |
apply (frule vd_cons, frule vt_grant_os) |
|
881 |
apply (frule proc_fd_in_fds, simp) |
|
882 |
apply (frule file_of_proc_fd_in_curf, simp, simp add:current_files_simps) |
|
883 |
apply (frule_tac cf2sfile_other', simp+) |
|
884 |
apply (simp add:cfd2sfd_def sectxt_of_obj_simps) |
|
885 |
apply (case_tac "p' = p", simp) |
|
886 |
apply (auto split:option.splits if_splits)[1] |
|
887 |
apply (simp) |
|
888 |
apply (auto split:option.splits if_splits)[1] |
|
1 | 889 |
done |
890 |
||
10 | 891 |
lemma cfd2sfd_kill: |
892 |
"\<lbrakk>valid (Kill p p'' # s); file_of_proc_fd (Kill p p'' # s) p' fd' = Some f'\<rbrakk> |
|
893 |
\<Longrightarrow> cfd2sfd (Kill p p'' # s) p' fd' = cfd2sfd s p' fd'" |
|
894 |
apply (frule vd_cons, frule vt_grant_os) |
|
895 |
apply (frule proc_fd_in_fds, simp) |
|
896 |
apply (frule proc_fd_in_procs, simp) |
|
897 |
apply (frule file_of_proc_fd_in_curf, simp, simp add:current_files_simps) |
|
898 |
apply (frule_tac cf2sfile_other', simp+) |
|
899 |
apply (simp add:cfd2sfd_def sectxt_of_obj_simps) |
|
900 |
apply (auto split:option.splits if_splits) |
|
1 | 901 |
done |
902 |
||
10 | 903 |
lemma cfd2sfd_exit: |
904 |
"\<lbrakk>valid (Exit p # s); file_of_proc_fd (Exit p # s) p' fd' = Some f'\<rbrakk> |
|
905 |
\<Longrightarrow> cfd2sfd (Exit p # s) p' fd' = cfd2sfd s p' fd'" |
|
906 |
apply (frule vd_cons, frule vt_grant_os) |
|
907 |
apply (frule proc_fd_in_fds, simp) |
|
908 |
apply (frule proc_fd_in_procs, simp) |
|
909 |
apply (frule file_of_proc_fd_in_curf, simp, simp add:current_files_simps) |
|
910 |
apply (frule_tac cf2sfile_other', simp+) |
|
911 |
apply (simp add:cfd2sfd_def sectxt_of_obj_simps) |
|
912 |
apply (auto split:option.splits if_splits) |
|
1 | 913 |
done |
914 |
||
10 | 915 |
lemma cfd2sfd_other: |
916 |
"\<lbrakk>valid (e # s); file_of_proc_fd (e # s) p' fd' = Some f'; |
|
917 |
\<forall> p f flags fd opt. e \<noteq> Open p f flags fd opt; |
|
918 |
\<forall> p p'' fds shms. e \<noteq> Clone p p'' fds shms\<rbrakk> |
|
919 |
\<Longrightarrow> cfd2sfd (e # s) p' fd' = cfd2sfd s p' fd'" |
|
920 |
apply (frule vd_cons, frule vt_grant_os) |
|
921 |
apply (frule proc_fd_in_fds, simp) |
|
922 |
apply (frule proc_fd_in_procs, simp) |
|
923 |
apply (frule file_of_proc_fd_in_curf, simp) |
|
924 |
apply (case_tac e) |
|
925 |
apply (auto intro!:cfd2sfd_execve cfd2sfd_closefd cfd2sfd_kill cfd2sfd_exit) |
|
926 |
apply (auto simp:cfd2sfd_def sectxt_of_obj_simps current_files_simps cf2sfile_simps split:option.splits) |
|
927 |
apply (auto dest!:current_has_sec' dest:file_of_proc_fd_in_curf proc_fd_in_fds) |
|
928 |
done |
|
929 |
||
930 |
lemmas cfd2sfd_simps = cfd2sfd_open cfd2sfd_clone cfd2sfd_other |
|
931 |
||
932 |
(********** cpfd2sfds simpset **********) |
|
933 |
||
934 |
lemma current_filefd_has_flags: |
|
935 |
"\<lbrakk>file_of_proc_fd s p fd = Some f; valid s\<rbrakk> \<Longrightarrow> \<exists> flags. flags_of_proc_fd s p fd = Some flags" |
|
936 |
apply (induct s arbitrary:p) |
|
937 |
apply (simp only:flags_of_proc_fd.simps file_of_proc_fd.simps init_filefd_prop4) |
|
938 |
apply (frule vd_cons, frule vt_grant_os, case_tac a) |
|
939 |
apply (auto split:if_splits option.splits dest:proc_fd_in_fds) |
|
940 |
done |
|
941 |
||
942 |
lemma current_filefd_has_flags': |
|
943 |
"\<lbrakk>flags_of_proc_fd s p fd = None; valid s\<rbrakk> \<Longrightarrow> file_of_proc_fd s p fd = None" |
|
944 |
apply (case_tac "file_of_proc_fd s p fd") |
|
945 |
apply (simp, drule current_filefd_has_flags, simp+) |
|
1 | 946 |
done |
947 |
||
10 | 948 |
lemma current_file_has_sfile': |
949 |
"\<lbrakk>cf2sfile s f = None; valid s\<rbrakk> \<Longrightarrow> f \<notin> current_files s" |
|
950 |
by (rule notI, drule current_file_has_sfile, simp+) |
|
1 | 951 |
|
10 | 952 |
lemma current_filefd_has_sfd: |
953 |
"\<lbrakk>file_of_proc_fd s p fd = Some f; valid s\<rbrakk> \<Longrightarrow> \<exists>sfd. cfd2sfd s p fd = Some sfd" |
|
954 |
by (auto simp:cfd2sfd_def split:option.splits dest!:current_has_sec' current_file_has_sfile' |
|
955 |
dest:file_of_proc_fd_in_curf proc_fd_in_fds current_filefd_has_flags) |
|
956 |
||
957 |
lemma current_filefd_has_sfd': |
|
958 |
"\<lbrakk>cfd2sfd s p fd = None; valid s\<rbrakk> \<Longrightarrow> file_of_proc_fd s p fd = None" |
|
959 |
by (case_tac "file_of_proc_fd s p fd", auto dest:current_filefd_has_sfd) |
|
1 | 960 |
|
12 | 961 |
lemma cpfd2sfds_open1: |
962 |
"valid (Open p f flags fd opt # s) \<Longrightarrow> |
|
963 |
cpfd2sfds (Open p f flags fd opt # s) p = ( |
|
964 |
case (cfd2sfd (Open p f flags fd opt # s) p fd) of |
|
10 | 965 |
Some sfd \<Rightarrow> (cpfd2sfds s p) \<union> {sfd} |
966 |
| _ \<Rightarrow> cpfd2sfds s p)" |
|
967 |
apply (frule vd_cons, frule vt_grant_os) |
|
968 |
apply (split option.splits) |
|
969 |
apply (rule conjI, rule impI, drule current_filefd_has_sfd', simp, simp) |
|
970 |
apply (rule allI, rule impI) |
|
971 |
apply (rule set_eqI, rule iffI) |
|
12 | 972 |
apply (case_tac "x = a", simp) |
10 | 973 |
unfolding cpfd2sfds_def |
13 | 974 |
apply (erule CollectE, (erule conjE|erule bexE)+) |
975 |
apply (simp add:proc_file_fds_def split:if_splits) |
|
976 |
apply (erule exE, rule_tac x = fda in exI) |
|
977 |
apply (simp add:cfd2sfd_open2) |
|
978 |
apply (case_tac "x = a", simp add:proc_file_fds_def) |
|
12 | 979 |
apply (rule_tac x = fd in exI, simp+) |
13 | 980 |
apply (erule conjE|erule bexE)+ |
981 |
apply (rule_tac x = fda in bexI) |
|
982 |
apply (simp add:proc_file_fds_def, erule exE) |
|
983 |
apply (simp add:cfd2sfd_open2) |
|
984 |
apply (simp add:proc_file_fds_def) |
|
12 | 985 |
done |
1 | 986 |
|
12 | 987 |
lemma cpfd2sfds_open1': |
10 | 988 |
"valid (Open p f flags fd opt # s) \<Longrightarrow> |
989 |
cpfd2sfds (Open p f flags fd opt # s) p = ( |
|
990 |
case (sectxt_of_obj (Open p f flags fd opt # s) (O_fd p fd), cf2sfile (Open p f flags fd opt # s) f) of |
|
991 |
(Some sec, Some sf) \<Rightarrow> (cpfd2sfds s p) \<union> {(sec, flags, sf)} |
|
992 |
| _ \<Rightarrow> cpfd2sfds s p)" |
|
993 |
apply (frule cfd2sfd_open1) |
|
12 | 994 |
apply (auto dest:cpfd2sfds_open1 split:option.splits) |
995 |
done |
|
996 |
||
997 |
lemma cpfd2sfds_open2: |
|
998 |
"\<lbrakk>valid (Open p f flags fd opt # s); p' \<noteq> p\<rbrakk> \<Longrightarrow> cpfd2sfds (Open p f flags fd opt # s) p' = cpfd2sfds s p'" |
|
999 |
apply (frule vt_grant_os, frule vd_cons) |
|
1000 |
unfolding cpfd2sfds_def |
|
1001 |
apply (rule set_eqI, rule iffI) |
|
13 | 1002 |
apply (simp add:proc_file_fds_def) |
1003 |
apply (erule exE|erule conjE)+ |
|
12 | 1004 |
apply (simp only:file_of_proc_fd.simps cfd2sfd_open2 split:if_splits) |
13 | 1005 |
apply (rule_tac x = fda in exI, simp) |
1006 |
apply (simp add:proc_file_fds_def) |
|
1007 |
apply (erule exE|erule conjE)+ |
|
12 | 1008 |
apply (rule_tac x = fda in exI, simp add:cfd2sfd_open2) |
1009 |
done |
|
1 | 1010 |
|
10 | 1011 |
lemma cpfd2sfds_open: |
1012 |
"valid (Open p f flags fd opt # s) |
|
1013 |
\<Longrightarrow> cpfd2sfds (Open p f flags fd opt # s) = (cpfd2sfds s) (p := ( |
|
1014 |
case (sectxt_of_obj (Open p f flags fd opt # s) (O_fd p fd), cf2sfile (Open p f flags fd opt # s) f) of |
|
1015 |
(Some sec, Some sf) \<Rightarrow> (cpfd2sfds s p) \<union> {(sec, flags, sf)} |
|
1016 |
| _ \<Rightarrow> cpfd2sfds s p))" |
|
1017 |
apply (rule ext) |
|
12 | 1018 |
apply (case_tac "x \<noteq> p") |
1019 |
apply (simp add:cpfd2sfds_open2) |
|
1020 |
apply (simp add:cpfd2sfds_open1') |
|
1021 |
done |
|
1 | 1022 |
|
12 | 1023 |
lemma cpfd2sfds_execve: |
13 | 1024 |
"valid (Execve p f fds # s) |
1025 |
\<Longrightarrow> cpfd2sfds (Execve p f fds # s) = (cpfd2sfds s) (p := {sfd. \<exists> fd \<in> fds. \<exists> f. file_of_proc_fd s p fd = Some f \<and> cfd2sfd s p fd = Some sfd})" |
|
1026 |
apply (frule vd_cons, frule vt_grant_os) |
|
1027 |
apply (rule ext) |
|
1028 |
apply (rule set_eqI, rule iffI) |
|
1029 |
unfolding cpfd2sfds_def proc_file_fds_def |
|
1030 |
apply (erule CollectE| erule bexE| erule conjE| erule exE| rule conjI)+ |
|
1031 |
apply (simp split:if_splits) |
|
1032 |
apply (frule_tac p' = p and fd' = fd in cfd2sfd_other, simp+) |
|
1033 |
apply (rule_tac x = fd in bexI, simp+) |
|
1034 |
apply (simp add:cpfd2sfds_def proc_file_fds_def) |
|
1035 |
apply (frule_tac p' = x and fd' = fd in cfd2sfd_other, simp+) |
|
1036 |
apply (rule_tac x = fd in exI, simp) |
|
1037 |
apply (simp split:if_splits) |
|
1038 |
apply (erule CollectE| erule bexE| erule conjE| erule exE| rule conjI)+ |
|
1039 |
apply (rule_tac x = fd in exI, simp) |
|
1040 |
apply (frule_tac p' = x and fd' = fd in cfd2sfd_other, simp+) |
|
1041 |
apply (simp add:cpfd2sfds_def proc_file_fds_def) |
|
1042 |
apply (erule CollectE| erule bexE| erule conjE| erule exE| rule conjI)+ |
|
1043 |
apply (rule_tac x = fd in exI, simp) |
|
1044 |
apply (frule_tac p' = x and fd' = fd in cfd2sfd_other, simp+) |
|
1045 |
done |
|
1046 |
||
1047 |
lemma cpfd2sfds_clone: |
|
1048 |
"valid (Clone p p' fds shms # s) |
|
1049 |
\<Longrightarrow> cpfd2sfds (Clone p p' fds shms # s) = (cpfd2sfds s) (p' := {sfd. \<exists> fd \<in> fds. \<exists> f. file_of_proc_fd s p fd = Some f \<and> cfd2sfd s p fd = Some sfd})" |
|
1050 |
apply (frule vd_cons, frule vt_grant_os) |
|
1051 |
apply (rule ext) |
|
1052 |
apply (rule set_eqI, rule iffI) |
|
1053 |
unfolding cpfd2sfds_def proc_file_fds_def |
|
1054 |
apply (erule CollectE| erule bexE| erule conjE| erule exE| rule conjI)+ |
|
1055 |
apply (simp split:if_splits) |
|
1056 |
apply (frule_tac p'' = p' and fd' = fd in cfd2sfd_clone, simp+) |
|
1057 |
apply (rule_tac x = fd in bexI, simp+) |
|
1058 |
apply (simp add:cpfd2sfds_def proc_file_fds_def) |
|
1059 |
apply (frule_tac p'' = x and fd' = fd in cfd2sfd_clone, simp+) |
|
1060 |
apply (rule_tac x = fd in exI, simp) |
|
1061 |
apply (simp split:if_splits) |
|
1062 |
apply (erule CollectE| erule bexE| erule conjE| erule exE| rule conjI)+ |
|
1063 |
apply (rule_tac x = fd in exI, simp) |
|
1064 |
apply (frule_tac p'' = p' and fd' = fd in cfd2sfd_clone, simp+) |
|
1065 |
apply (simp add:cpfd2sfds_def proc_file_fds_def) |
|
1066 |
apply (erule CollectE| erule bexE| erule conjE| erule exE| rule conjI)+ |
|
1067 |
apply (rule_tac x = fd in exI, simp) |
|
1068 |
apply (frule_tac p'' = x and fd' = fd in cfd2sfd_clone, simp+) |
|
1069 |
done |
|
12 | 1070 |
|
1071 |
lemma cpfd2sfds_other: |
|
1072 |
"\<lbrakk>valid (e # s); |
|
13 | 1073 |
\<forall> p f flags fd opt. e \<noteq> Open p f flags fd opt; |
1074 |
\<forall> p f fds. e \<noteq> Execve p f fds; |
|
1075 |
\<forall> p p'. e \<noteq> Kill p p'; |
|
1076 |
\<forall> p. e \<noteq> Exit p; |
|
1077 |
\<forall> p fd. e \<noteq> CloseFd p fd; |
|
1078 |
\<forall> p p' fds shms. e \<noteq> Clone p p' fds shms\<rbrakk> \<Longrightarrow> cpfd2sfds (e # s) = cpfd2sfds s" |
|
1079 |
apply (frule vd_cons, frule vt_grant_os) |
|
1080 |
apply (rule ext) |
|
1081 |
unfolding cpfd2sfds_def proc_file_fds_def |
|
1082 |
apply (case_tac e) |
|
1083 |
using cfd2sfd_other |
|
1084 |
by auto |
|
1085 |
||
1086 |
lemma cpfd2sfds_kill: |
|
1087 |
"valid (Kill p p' # s) \<Longrightarrow> cpfd2sfds (Kill p p' # s) = (cpfd2sfds s) (p' := {})" |
|
1088 |
apply (frule vd_cons, frule vt_grant_os) |
|
1089 |
apply (rule ext, rule set_eqI) |
|
1090 |
unfolding cpfd2sfds_def proc_file_fds_def |
|
1091 |
apply (rule iffI) |
|
1092 |
apply (erule CollectE| erule bexE| erule conjE| erule exE| rule conjI)+ |
|
1093 |
apply (simp split:if_splits add: cpfd2sfds_def proc_file_fds_def) |
|
1094 |
apply (rule_tac x = fd in exI, simp) |
|
1095 |
apply (drule_tac p' = x and fd' = fd in cfd2sfd_other, simp+) |
|
1096 |
apply (simp split:if_splits add: cpfd2sfds_def proc_file_fds_def) |
|
1097 |
apply (erule CollectE| erule bexE| erule conjE| erule exE| rule conjI)+ |
|
1098 |
apply (rule_tac x = fd in exI, simp) |
|
1099 |
apply (drule_tac p' = x and fd' = fd in cfd2sfd_other, simp+) |
|
1100 |
done |
|
1101 |
||
1102 |
lemma cpfd2sfds_exit: |
|
1103 |
"valid (Exit p # s) \<Longrightarrow> cpfd2sfds (Exit p # s) = (cpfd2sfds s) (p := {})" |
|
1104 |
apply (frule vd_cons, frule vt_grant_os) |
|
1105 |
apply (rule ext, rule set_eqI) |
|
1106 |
unfolding cpfd2sfds_def proc_file_fds_def |
|
1107 |
apply (rule iffI) |
|
1108 |
apply (erule CollectE| erule bexE| erule conjE| erule exE| rule conjI)+ |
|
1109 |
apply (simp split:if_splits add: cpfd2sfds_def proc_file_fds_def) |
|
1110 |
apply (rule_tac x = fd in exI, simp) |
|
1111 |
apply (drule_tac p' = x and fd' = fd in cfd2sfd_other, simp+) |
|
1112 |
apply (simp split:if_splits add: cpfd2sfds_def proc_file_fds_def) |
|
1113 |
apply (erule CollectE| erule bexE| erule conjE| erule exE| rule conjI)+ |
|
1114 |
apply (rule_tac x = fd in exI, simp) |
|
1115 |
apply (drule_tac p' = x and fd' = fd in cfd2sfd_other, simp+) |
|
1116 |
done |
|
1117 |
||
1118 |
lemma cpfd2sfds_closefd: |
|
1119 |
"valid (CloseFd p fd # s) \<Longrightarrow> cpfd2sfds (CloseFd p fd # s) = (cpfd2sfds s) (p := |
|
1120 |
if (fd \<in> proc_file_fds s p) |
|
1121 |
then (case (cfd2sfd s p fd) of |
|
1122 |
Some sfd \<Rightarrow> (if (\<exists> fd' f'. fd' \<noteq> fd \<and> file_of_proc_fd s p fd' = Some f' \<and> cfd2sfd s p fd' = Some sfd) |
|
1123 |
then cpfd2sfds s p else cpfd2sfds s p - {sfd}) |
|
1124 |
| _ \<Rightarrow> cpfd2sfds s p) |
|
1125 |
else cpfd2sfds s p)" |
|
1126 |
apply (frule vd_cons) |
|
1127 |
apply (rule ext, rule set_eqI, rule iffI) |
|
1128 |
unfolding cpfd2sfds_def proc_file_fds_def |
|
1129 |
apply (erule CollectE| erule bexE| erule conjE| erule exE| rule conjI)+ |
|
1130 |
apply (simp split:if_splits) |
|
1131 |
apply (rule conjI, rule impI, rule conjI, rule impI, erule exE) |
|
1132 |
apply (frule_tac p = p and fd = fd in current_filefd_has_sfd, simp) |
|
1133 |
apply (erule exE, simp) |
|
1134 |
apply (rule conjI, rule impI, (erule exE|erule conjE)+) |
|
1135 |
apply (rule_tac x = fda in exI, simp, simp add:cfd2sfd_closefd) |
|
1136 |
||
1137 |
apply (rule impI, rule conjI) |
|
1138 |
apply (rule_tac x = fda in exI, simp, simp add:cfd2sfd_closefd) |
|
1139 |
apply (rule notI, simp) |
|
1140 |
apply (erule_tac x = fda in allE, simp add:cfd2sfd_closefd) |
|
1141 |
||
1142 |
apply (rule impI, simp add:cpfd2sfds_def proc_file_fds_def) |
|
1143 |
apply (erule exE, rule_tac x = fda in exI, simp add:cfd2sfd_closefd) |
|
1144 |
||
1145 |
apply (rule impI| rule conjI)+ |
|
1146 |
apply (rule_tac x = fda in exI, simp add:cfd2sfd_closefd) |
|
1147 |
||
1148 |
apply (rule impI, simp add:cpfd2sfds_def proc_file_fds_def) |
|
1149 |
apply (rule_tac x = fda in exI, simp add:cfd2sfd_closefd) |
|
12 | 1150 |
|
13 | 1151 |
apply (simp split:if_splits) |
1152 |
apply (frule_tac p = p and fd = fd in current_filefd_has_sfd, simp) |
|
1153 |
apply (erule exE, simp) |
|
1154 |
apply (case_tac "\<exists>fd'. fd' \<noteq> fd \<and> (\<exists>f'. file_of_proc_fd s p fd' = Some f') \<and> cfd2sfd s p fd' = Some sfd") |
|
1155 |
apply simp |
|
1156 |
apply (case_tac "xa = sfd") |
|
1157 |
apply (erule exE|erule conjE)+ |
|
1158 |
apply (rule_tac x = fd' in exI, simp add:cfd2sfd_closefd) |
|
1159 |
apply (erule exE|erule conjE)+ |
|
1160 |
apply (rule_tac x = fda in exI, simp add:cfd2sfd_closefd) |
|
1161 |
apply (rule notI, simp) |
|
1162 |
apply (simp, (erule exE|erule conjE)+) |
|
1163 |
apply (rule_tac x = fda in exI, simp add:cfd2sfd_closefd) |
|
1164 |
apply (rule notI, simp) |
|
1165 |
apply (erule exE|erule conjE)+ |
|
1166 |
apply (rule_tac x = fda in exI, simp add:cfd2sfd_closefd) |
|
1167 |
apply (rule notI, simp) |
|
1168 |
apply (simp add:cpfd2sfds_def proc_file_fds_def) |
|
1169 |
apply (erule exE|erule conjE)+ |
|
1170 |
apply (rule_tac x = fda in exI, simp add:cfd2sfd_closefd) |
|
1171 |
done |
|
1172 |
||
1173 |
lemmas cpfd2sfds_simps = cpfd2sfds_open cpfd2sfds_execve cpfd2sfds_clone cpfd2sfds_kill cpfd2sfds_exit |
|
1174 |
cpfd2sfds_closefd cpfd2sfds_other |
|
1175 |
||
1176 |
(********* ch2sshm simpset ********) |
|
1177 |
||
1178 |
lemma ch2sshm_createshm: |
|
1179 |
"valid (CreateShM p h # s) |
|
1180 |
\<Longrightarrow> ch2sshm (CreateShM p h # s) = (ch2sshm s) (h := |
|
1181 |
(case (sectxt_of_obj (CreateShM p h # s) (O_shm h)) of |
|
1182 |
Some sec \<Rightarrow> |
|
1183 |
Some (if (\<not> deleted (O_shm h) s \<and> h \<in> init_shms) then Init h else Created, sec) |
|
1184 |
| _ \<Rightarrow> None))" |
|
1185 |
apply (frule vd_cons, frule vt_grant_os) |
|
1186 |
apply (auto simp:ch2sshm_def sectxt_of_obj_simps dest!:current_has_sec' split:option.splits if_splits) |
|
1187 |
done |
|
1188 |
||
1189 |
lemma ch2sshm_other: |
|
1190 |
"\<lbrakk>valid (e # s); |
|
1191 |
\<forall> p h. e \<noteq> CreateShM p h; |
|
1192 |
h' \<in> current_shms (e # s)\<rbrakk> \<Longrightarrow> ch2sshm (e # s) h' = ch2sshm s h'" |
|
1193 |
apply (frule vd_cons, frule vt_grant_os) |
|
1194 |
apply (case_tac e) |
|
1195 |
apply (auto simp:ch2sshm_def sectxt_of_obj_simps dest!:current_has_sec' split:option.splits if_splits) |
|
1196 |
done |
|
1197 |
||
1198 |
lemmas ch2sshm_simps = ch2sshm_createshm ch2sshm_other |
|
1199 |
||
1200 |
lemma current_shm_has_sh: |
|
1201 |
"\<lbrakk>h \<in> current_shms s; valid s\<rbrakk> \<Longrightarrow> \<exists> sh. ch2sshm s h = Some sh" |
|
1202 |
by (auto simp:ch2sshm_def split:option.splits dest!:current_has_sec') |
|
1203 |
||
1204 |
lemma current_shm_has_sh': |
|
1205 |
"\<lbrakk>ch2sshm s h = None; valid s\<rbrakk> \<Longrightarrow> h \<notin> current_shms s" |
|
1206 |
by (auto dest:current_shm_has_sh) |
|
1207 |
||
1208 |
(********** cph2spshs simpset **********) |
|
1209 |
||
14 | 1210 |
lemma cph2spshs_attach: |
13 | 1211 |
"valid (Attach p h flag # s) \<Longrightarrow> |
1212 |
cph2spshs (Attach p h flag # s) = (cph2spshs s) (p := |
|
1213 |
(case (ch2sshm s h) of |
|
1214 |
Some sh \<Rightarrow> cph2spshs s p \<union> {(sh, flag)} |
|
1215 |
| _ \<Rightarrow> cph2spshs s p) )" |
|
1216 |
apply (frule vd_cons, frule vt_grant_os, rule ext) |
|
1217 |
using ch2sshm_other[where e = "Attach p h flag" and s = s] |
|
1218 |
apply (auto split del:t_open_must_flag.splits t_open_option_flag.splits split add:if_splits option.splits |
|
14 | 1219 |
dest!:current_shm_has_sh' dest: procs_of_shm_prop1 simp:cph2spshs_def) |
1220 |
apply (erule_tac x = ha in allE, frule procs_of_shm_prop1, simp, simp) |
|
1221 |
apply (erule_tac x = ha in allE, frule procs_of_shm_prop1, simp, simp) |
|
1222 |
apply (erule_tac x = ha in allE, frule procs_of_shm_prop1, simp, simp) |
|
1223 |
apply (erule_tac x = ha in allE, frule procs_of_shm_prop1, simp, simp) |
|
1224 |
apply (erule_tac x = ha in allE, frule procs_of_shm_prop1, simp, simp) |
|
1225 |
apply (case_tac "ha = h", simp, frule procs_of_shm_prop1, simp) |
|
1226 |
apply (rule_tac x = ha in exI, simp) |
|
1227 |
apply (rule_tac x = ha in exI, simp, drule procs_of_shm_prop1, simp, simp) |
|
1228 |
apply (rule_tac x = ha in exI, simp) |
|
1229 |
apply (frule procs_of_shm_prop1, simp, simp) |
|
1230 |
apply (rule impI, simp) |
|
1231 |
done |
|
1232 |
||
1233 |
lemma cph2spshs_detach: "valid (Detach p h # s) \<Longrightarrow> |
|
1234 |
cph2spshs (Detach p h # s) = (cph2spshs s) (p := |
|
15 | 1235 |
(case (ch2sshm s h, flag_of_proc_shm s p h) of |
1236 |
(Some sh, Some flag) \<Rightarrow> if (\<exists> h'. h' \<noteq> h \<and> (p,flag) \<in> procs_of_shm s h' \<and> ch2sshm s h' = Some sh) |
|
1237 |
then cph2spshs s p else cph2spshs s p - {(sh, flag)} |
|
14 | 1238 |
| _ \<Rightarrow> cph2spshs s p) )" |
1239 |
apply (frule vd_cons, frule vt_grant_os, rule ext) |
|
15 | 1240 |
apply (case_tac "x = p") defer |
1241 |
using ch2sshm_other[where e = "Detach p h" and s = s] |
|
14 | 1242 |
apply (auto split del:t_open_must_flag.splits t_open_option_flag.splits split add:if_splits option.splits |
15 | 1243 |
dest!:current_shm_has_sh' procs_of_shm_prop4' dest:procs_of_shm_prop1 procs_of_shm_prop3 simp:cph2spshs_def) [1] |
1244 |
apply (rule_tac x = ha in exI, frule_tac h = ha in procs_of_shm_prop1, simp, simp) |
|
14 | 1245 |
apply (rule_tac x = ha in exI, frule_tac h = ha in procs_of_shm_prop1, simp, simp) |
1246 |
apply (rule impI, simp) |
|
15 | 1247 |
|
1248 |
apply (clarsimp) |
|
1249 |
apply (frule current_shm_has_sh, simp, erule exE) |
|
1250 |
apply (frule procs_of_shm_prop4, simp, simp) |
|
1251 |
apply (rule allI | rule conjI| erule conjE | erule exE | rule impI)+ |
|
1252 |
||
1253 |
apply (simp only:cph2spshs_def, rule set_eqI, rule iffI) |
|
1254 |
apply (erule CollectE | erule exE| erule conjE| rule CollectI)+ |
|
1255 |
apply (case_tac "ha = h", simp) |
|
1256 |
apply (rule_tac x = sha in exI, rule_tac x = flaga in exI, rule_tac x = ha in exI, simp) |
|
1257 |
using ch2sshm_other[where e = "Detach p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
1258 |
||
1259 |
apply (erule CollectE | erule exE| erule conjE| rule CollectI)+ |
|
1260 |
apply (case_tac "ha = h", simp) |
|
1261 |
apply (rule_tac x = h' in exI, simp) |
|
1262 |
apply (frule_tac flag = flag and flag' = flaga in procs_of_shm_prop3, simp+) |
|
1263 |
apply (frule_tac flag = flaga in procs_of_shm_prop4, simp+) |
|
1264 |
using ch2sshm_other[where e = "Detach p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
1265 |
apply (frule_tac h = h' in procs_of_shm_prop1, simp, simp) |
|
1266 |
apply (rule_tac x = ha in exI, simp, frule_tac h = ha in procs_of_shm_prop1, simp+) |
|
1267 |
using ch2sshm_other[where e = "Detach p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
1268 |
||
1269 |
apply (rule allI | rule conjI| erule conjE | erule exE | rule impI)+ |
|
1270 |
apply (simp only:cph2spshs_def, rule set_eqI, rule iffI) |
|
1271 |
apply (erule CollectE | erule exE| erule conjE| rule DiffI |rule CollectI)+ |
|
1272 |
apply (simp split:if_splits) |
|
1273 |
apply (rule_tac x = ha in exI, simp, frule_tac h = ha in procs_of_shm_prop1, simp+) |
|
1274 |
using ch2sshm_other[where e = "Detach p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
1275 |
apply (rule notI, simp split:if_splits) |
|
1276 |
apply (erule_tac x = ha in allE, simp, frule_tac h = ha in procs_of_shm_prop1, simp+) |
|
1277 |
using ch2sshm_other[where e = "Detach p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
1278 |
apply (erule CollectE | erule exE| erule conjE| erule DiffE |rule CollectI)+ |
|
1279 |
apply (simp split:if_splits) |
|
1280 |
apply (erule_tac x = ha in allE, simp, rule_tac x = ha in exI, simp) |
|
1281 |
apply (case_tac "ha = h", simp add:procs_of_shm_prop3, frule_tac h = ha in procs_of_shm_prop1, simp+) |
|
1282 |
using ch2sshm_other[where e = "Detach p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
14 | 1283 |
done |
13 | 1284 |
|
16 | 1285 |
lemma cph2spshs_deleteshm: |
1286 |
"valid (DeleteShM p h # s) \<Longrightarrow> |
|
1287 |
cph2spshs (DeleteShM p h # s) = (\<lambda> p'. |
|
1288 |
(case (ch2sshm s h, flag_of_proc_shm s p' h) of |
|
1289 |
(Some sh, Some flag) \<Rightarrow> if (\<exists> h'. h' \<noteq> h \<and> (p', flag) \<in> procs_of_shm s h' \<and> ch2sshm s h' = Some sh) |
|
1290 |
then cph2spshs s p' else cph2spshs s p' - {(sh, flag)} |
|
1291 |
| _ \<Rightarrow> cph2spshs s p') )" |
|
1292 |
apply (frule vd_cons, frule vt_grant_os, rule ext) |
|
15 | 1293 |
|
16 | 1294 |
apply (clarsimp) |
1295 |
apply (frule current_shm_has_sh, simp, erule exE, simp, simp split:option.splits) |
|
1296 |
apply (rule conjI, rule impI) |
|
1297 |
using ch2sshm_other[where e = "DeleteShM p h" and s = s] |
|
1298 |
apply (auto split del:t_open_must_flag.splits t_open_option_flag.splits split add:if_splits option.splits |
|
1299 |
dest!:current_shm_has_sh' procs_of_shm_prop4' dest:procs_of_shm_prop1 procs_of_shm_prop3 simp:cph2spshs_def) [1] |
|
1300 |
apply (rule_tac x = ha in exI, frule_tac h = ha in procs_of_shm_prop1, simp+) |
|
1301 |
apply (rule_tac x = ha in exI, simp) |
|
1302 |
apply (case_tac "ha = h", simp+, frule_tac h = ha in procs_of_shm_prop1, simp+) |
|
1303 |
||
1304 |
apply (rule allI | rule conjI| erule conjE | erule exE | rule impI)+ |
|
1305 |
||
1306 |
apply (simp only:cph2spshs_def, rule set_eqI, rule iffI) |
|
1307 |
apply (erule CollectE | erule exE| erule conjE| rule CollectI)+ |
|
1308 |
apply (case_tac "ha = h", simp) |
|
1309 |
apply (rule_tac x = sha in exI, rule_tac x = flag in exI, rule_tac x = ha in exI, simp) |
|
1310 |
using ch2sshm_other[where e = "DeleteShM p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
1311 |
||
1312 |
apply (erule CollectE | erule exE| erule conjE| rule CollectI)+ |
|
1313 |
apply (case_tac "ha = h", simp) |
|
1314 |
apply (rule_tac x = h' in exI, simp) |
|
1315 |
apply (frule_tac flag = flag in procs_of_shm_prop4, simp+) |
|
1316 |
using ch2sshm_other[where e = "DeleteShM p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
1317 |
apply (frule_tac h = h' in procs_of_shm_prop1, simp, simp) |
|
1318 |
apply (rule_tac x = ha in exI, simp, frule_tac h = ha in procs_of_shm_prop1, simp+) |
|
1319 |
using ch2sshm_other[where e = "DeleteShM p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
1320 |
||
1321 |
apply (rule allI | rule conjI| erule conjE | erule exE | rule impI)+ |
|
1322 |
apply (simp only:cph2spshs_def, rule set_eqI, rule iffI) |
|
1323 |
apply (erule CollectE | erule exE| erule conjE| rule DiffI |rule CollectI)+ |
|
1324 |
apply (simp split:if_splits) |
|
1325 |
apply (rule_tac x = ha in exI, simp, frule_tac h = ha in procs_of_shm_prop1, simp+) |
|
1326 |
using ch2sshm_other[where e = "DeleteShM p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
1327 |
apply (rule notI, simp split:if_splits) |
|
1328 |
apply (erule_tac x = ha in allE, simp, frule_tac h = ha in procs_of_shm_prop1, simp+) |
|
1329 |
using ch2sshm_other[where e = "DeleteShM p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
1330 |
apply (erule CollectE | erule exE| erule conjE| erule DiffE |rule CollectI)+ |
|
1331 |
apply (simp split:if_splits) |
|
1332 |
apply (erule_tac x = ha in allE, simp, rule_tac x = ha in exI, simp) |
|
1333 |
apply (case_tac "ha = h", simp add:procs_of_shm_prop4) |
|
1334 |
apply (frule_tac h = ha in procs_of_shm_prop1, simp+) |
|
1335 |
using ch2sshm_other[where e = "DeleteShM p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
1336 |
done |
|
1337 |
||
1338 |
lemma flag_of_proc_shm_prop1: |
|
1339 |
"\<lbrakk>flag_of_proc_shm s p h = Some flag; valid s\<rbrakk> \<Longrightarrow> (p, flag) \<in> procs_of_shm s h" |
|
1340 |
apply (induct s arbitrary:p) |
|
1341 |
apply (simp add:init_shmflag_has_proc) |
|
1342 |
apply (frule vt_grant_os, frule vd_cons, case_tac a, auto split:if_splits option.splits) |
|
1343 |
done |
|
1344 |
||
1345 |
lemma cph2spshs_clone: |
|
1346 |
"valid (Clone p p' fds shms # s) \<Longrightarrow> |
|
1347 |
cph2spshs (Clone p p' fds shms # s) = (cph2spshs s) (p' := |
|
1348 |
{(sh, flag) | h sh flag. h \<in> shms \<and> ch2sshm s h = Some sh \<and> flag_of_proc_shm s p h = Some flag} )" |
|
1349 |
apply (frule vd_cons, frule vt_grant_os, rule ext) |
|
1350 |
using ch2sshm_other[where e = "Clone p p' fds shms" and s = s] |
|
1351 |
apply (auto split del:t_open_must_flag.splits t_open_option_flag.splits split add:if_splits option.splits |
|
1352 |
dest!:current_shm_has_sh' dest: procs_of_shm_prop1 procs_of_shm_prop2 procs_of_shm_prop3 simp:cph2spshs_def) |
|
1353 |
apply (erule_tac x = h in allE, frule procs_of_shm_prop1, simp, simp add:procs_of_shm_prop4) |
|
1354 |
apply (rule_tac x = h in exI, simp, frule flag_of_proc_shm_prop1, simp+, simp add:procs_of_shm_prop1) |
|
1355 |
apply (rule_tac x = h in exI, simp, frule procs_of_shm_prop1, simp+)+ |
|
1356 |
done |
|
1357 |
||
1358 |
lemma cph2spshs_execve: |
|
1359 |
"valid (Execve p f fds # s) \<Longrightarrow> |
|
1360 |
cph2spshs (Execve p f fds # s) = (cph2spshs s) (p := {})" |
|
1361 |
apply (frule vd_cons, frule vt_grant_os, rule ext) |
|
1362 |
using ch2sshm_other[where e = "Execve p f fds" and s = s] |
|
1363 |
apply (auto split del:t_open_must_flag.splits t_open_option_flag.splits split add:if_splits option.splits |
|
1364 |
dest!:current_shm_has_sh' dest: procs_of_shm_prop1 procs_of_shm_prop2 procs_of_shm_prop3 simp:cph2spshs_def) |
|
1365 |
apply (rule_tac x = h in exI, simp add:procs_of_shm_prop1)+ |
|
1366 |
done |
|
1367 |
||
1368 |
lemma cph2spshs_kill: |
|
1369 |
"valid (Kill p p' # s) \<Longrightarrow> cph2spshs (Kill p p' # s) = (cph2spshs s) (p' := {})" |
|
1370 |
apply (frule vd_cons, frule vt_grant_os, rule ext) |
|
1371 |
using ch2sshm_other[where e = "Kill p p'" and s = s] |
|
1372 |
apply (auto split del:t_open_must_flag.splits t_open_option_flag.splits split add:if_splits option.splits |
|
1373 |
dest!:current_shm_has_sh' dest: procs_of_shm_prop1 procs_of_shm_prop2 procs_of_shm_prop3 simp:cph2spshs_def) |
|
1374 |
apply (rule_tac x = h in exI, simp add:procs_of_shm_prop1)+ |
|
1375 |
done |
|
1376 |
||
1377 |
lemma cph2spshs_exit: |
|
1378 |
"valid (Exit p # s) \<Longrightarrow> cph2spshs (Exit p # s) = (cph2spshs s) (p := {})" |
|
1379 |
apply (frule vd_cons, frule vt_grant_os, rule ext) |
|
1380 |
using ch2sshm_other[where e = "Exit p" and s = s] |
|
1381 |
apply (auto split del:t_open_must_flag.splits t_open_option_flag.splits split add:if_splits option.splits |
|
1382 |
dest!:current_shm_has_sh' dest: procs_of_shm_prop1 procs_of_shm_prop2 procs_of_shm_prop3 simp:cph2spshs_def) |
|
1383 |
apply (rule_tac x = h in exI, simp add:procs_of_shm_prop1)+ |
|
1384 |
done |
|
1385 |
||
1386 |
lemma cph2spshs_createshm: |
|
1387 |
"valid (CreateShM p h # s) \<Longrightarrow> cph2spshs (CreateShM p h # s) = cph2spshs s" |
|
1388 |
apply (frule vt_grant_os, frule vd_cons, rule ext) |
|
1389 |
apply (auto simp:cph2spshs_def) |
|
1390 |
using ch2sshm_createshm |
|
1391 |
apply (auto split del:t_open_must_flag.splits t_open_option_flag.splits split add:if_splits option.splits |
|
1392 |
dest!:current_shm_has_sh' dest: procs_of_shm_prop1 procs_of_shm_prop2 procs_of_shm_prop3 simp:cph2spshs_def) |
|
1393 |
apply (rule_tac x = ha in exI, auto simp:procs_of_shm_prop1) |
|
1394 |
done |
|
15 | 1395 |
|
13 | 1396 |
lemma cph2spshs_other: |
16 | 1397 |
"\<lbrakk>valid (e # s); |
1398 |
\<forall> p h flag. e \<noteq> Attach p h flag; |
|
1399 |
\<forall> p h. e \<noteq> Detach p h; |
|
1400 |
\<forall> p h. e \<noteq> DeleteShM p h; |
|
1401 |
\<forall> p p' fds shms. e \<noteq> Clone p p' fds shms; |
|
1402 |
\<forall> p f fds. e \<noteq> Execve p f fds; |
|
1403 |
\<forall> p p'. e \<noteq> Kill p p'; |
|
1404 |
\<forall> p. e \<noteq> Exit p\<rbrakk> \<Longrightarrow> cph2spshs (e # s) = cph2spshs s" |
|
1405 |
apply (frule vt_grant_os, frule vd_cons, rule ext) |
|
1406 |
unfolding cph2spshs_def |
|
1407 |
apply (rule set_eqI, rule iffI) |
|
1408 |
apply (erule CollectE | erule conjE| erule exE| rule conjI| rule impI| rule CollectI)+ |
|
1409 |
apply (frule procs_of_shm_prop1, simp, rule_tac x= sh in exI, rule_tac x = flag in exI, rule_tac x = h in exI) |
|
1410 |
apply (case_tac e) |
|
1411 |
using ch2sshm_other[where e = e and s = s] |
|
1412 |
apply (auto split del:t_open_must_flag.splits t_open_option_flag.splits split add:if_splits option.splits |
|
1413 |
dest!:current_shm_has_sh' dest: procs_of_shm_prop1 procs_of_shm_prop2 procs_of_shm_prop3 |
|
1414 |
simp:ch2sshm_createshm) |
|
1415 |
apply (rule_tac x = h in exI, case_tac e) |
|
1416 |
using ch2sshm_other[where e = e and s = s] |
|
1417 |
apply (auto split del:t_open_must_flag.splits t_open_option_flag.splits split add:if_splits option.splits |
|
1418 |
dest!:current_shm_has_sh' dest: procs_of_shm_prop1 procs_of_shm_prop2 procs_of_shm_prop3 |
|
1419 |
simp:ch2sshm_createshm) |
|
1420 |
done |
|
13 | 1421 |
|
16 | 1422 |
lemmas cph2spshs_simps = cph2spshs_attach cph2spshs_detach cph2spshs_deleteshm cph2spshs_clone cph2spshs_execve |
1423 |
cph2spshs_exit cph2spshs_kill cph2spshs_other |
|
1 | 1424 |
|
10 | 1425 |
(******** cp2sproc simpset *********) |
1 | 1426 |
|
17 | 1427 |
lemma cp2sproc_clone: |
1428 |
"valid (Clone p p' fds shms # s) \<Longrightarrow> cp2sproc (Clone p p' fds shms # s) = (cp2sproc s) (p' := |
|
1429 |
case (sectxt_of_obj s (O_proc p)) of |
|
1430 |
Some sec \<Rightarrow> Some (Created, sec, |
|
1431 |
{sfd. \<exists> fd \<in> fds. \<exists> f. file_of_proc_fd s p fd = Some f \<and> cfd2sfd s p fd = Some sfd}, |
|
1432 |
{(sh, flag) | h sh flag. h \<in> shms \<and> ch2sshm s h = Some sh \<and> flag_of_proc_shm s p h = Some flag}) |
|
1433 |
| _ \<Rightarrow> None)" |
|
1434 |
apply (frule cph2spshs_clone, frule cpfd2sfds_clone) |
|
1435 |
apply (frule vd_cons, frule vt_grant_os, simp only:os_grant.simps) |
|
1436 |
apply ((erule exE| erule conjE)+, frule not_init_intro_proc, simp, rule ext, case_tac "x = p'", simp) |
|
1437 |
apply (auto simp:cp2sproc_def sectxt_of_obj_simps dest!:current_has_sec' |
|
1438 |
dest:current_proc_has_sec split:option.splits if_splits) |
|
1439 |
done |
|
1440 |
||
1441 |
lemma cp2sproc_other: |
|
1442 |
"\<lbrakk>valid (e # s); |
|
1443 |
\<forall> p f flags fd opt. e \<noteq> Open p f flags fd opt; |
|
1444 |
\<forall> p fd. e \<noteq> CloseFd p fd; |
|
1445 |
\<forall> p h flag. e \<noteq> Attach p h flag; |
|
1446 |
\<forall> p h. e \<noteq> Detach p h; |
|
1447 |
\<forall> p h. e \<noteq> DeleteShM p h; |
|
1448 |
\<forall> p p' fds shms. e \<noteq> Clone p p' fds shms; |
|
1449 |
\<forall> p f fds. e \<noteq> Execve p f fds; |
|
1450 |
\<forall> p p'. e \<noteq> Kill p p'; |
|
1451 |
\<forall> p. e \<noteq> Exit p\<rbrakk> \<Longrightarrow> cp2sproc (e # s) = cp2sproc s" |
|
1452 |
apply (frule cph2spshs_other, simp+, frule cpfd2sfds_other, simp+) |
|
1453 |
apply (frule vt_grant_os, frule vd_cons, rule ext, case_tac e, simp_all) |
|
1454 |
apply (auto simp:cp2sproc_def sectxt_of_obj_simps dest!:current_has_sec' |
|
1455 |
dest:current_proc_has_sec not_deleted_init_proc split:option.splits if_splits) |
|
1456 |
done |
|
1 | 1457 |
|
17 | 1458 |
lemma cp2sproc_open: |
1459 |
"valid (Open p f flags fd opt # s) \<Longrightarrow> |
|
1460 |
cp2sproc (Open p f flags fd opt # s) = (cp2sproc s) (p := |
|
1461 |
case (sectxt_of_obj s (O_proc p), sectxt_of_obj (Open p f flags fd opt # s) (O_fd p fd), |
|
1462 |
cf2sfile (Open p f flags fd opt # s) f) of |
|
1463 |
(Some sec, Some fdsec, Some sf) \<Rightarrow> Some (if (\<not> deleted (O_proc p) s \<and> p \<in> init_procs) |
|
1464 |
then Init p else Created, sec, |
|
1465 |
(cpfd2sfds s p) \<union> {(fdsec, flags, sf)}, cph2spshs s p) |
|
1466 |
| _ \<Rightarrow> None)" |
|
1467 |
apply (frule cph2spshs_other, simp, simp, simp, simp, simp, simp, simp) |
|
1468 |
apply (frule cpfd2sfds_open, frule vt_grant_os, frule vd_cons, rule ext) |
|
1469 |
apply (case_tac "x = p") |
|
1470 |
apply (auto simp:cp2sproc_def sectxt_of_obj_simps current_files_simps |
|
1471 |
dest!:current_has_sec' dest!:current_file_has_sfile' dest:is_file_in_current is_dir_in_current |
|
1472 |
dest:current_proc_has_sec not_deleted_init_proc split:option.splits if_splits) |
|
1473 |
done |
|
1474 |
||
1475 |
lemma cp2sproc_closefd: |
|
1476 |
"valid (CloseFd p fd # s) \<Longrightarrow> |
|
1477 |
cp2sproc (CloseFd p fd # s) = (cp2sproc s) (p := |
|
1478 |
if (fd \<in> proc_file_fds s p) |
|
1479 |
then (case (cfd2sfd s p fd) of |
|
1480 |
Some sfd \<Rightarrow> (if (\<exists> fd' f'. fd' \<noteq> fd \<and> file_of_proc_fd s p fd' = Some f' \<and> cfd2sfd s p fd' = Some sfd) |
|
1481 |
then cp2sproc s p |
|
1482 |
else (case (sectxt_of_obj s (O_proc p)) of |
|
1483 |
Some sec \<Rightarrow> Some (if (\<not> deleted (O_proc p) s \<and> p \<in> init_procs) |
|
1484 |
then Init p else Created, |
|
1485 |
sec, cpfd2sfds s p - {sfd}, cph2spshs s p) |
|
1486 |
| _ \<Rightarrow> None)) |
|
1487 |
| _ \<Rightarrow> cp2sproc s p) |
|
1488 |
else cp2sproc s p)" |
|
1489 |
apply (frule cpfd2sfds_closefd, frule cph2spshs_other, simp, simp, simp, simp, simp, simp, simp) |
|
1490 |
apply (frule vt_grant_os, frule vd_cons, rule ext) |
|
1491 |
apply (case_tac "x = p") |
|
1492 |
apply (auto simp:cp2sproc_def sectxt_of_obj_simps current_files_simps |
|
1493 |
dest!:current_has_sec' dest!:current_file_has_sfile' dest:is_file_in_current is_dir_in_current |
|
1494 |
dest:current_proc_has_sec not_deleted_init_proc split:option.splits if_splits) |
|
1495 |
done |
|
1 | 1496 |
|
17 | 1497 |
lemma cp2sproc_attach: |
1498 |
"valid (Attach p h flag # s) \<Longrightarrow> |
|
1499 |
cp2sproc (Attach p h flag # s) = (cp2sproc s) (p := |
|
1500 |
(case (ch2sshm s h) of |
|
1501 |
Some sh \<Rightarrow> (case (sectxt_of_obj s (O_proc p)) of |
|
1502 |
Some sec \<Rightarrow> Some (if (\<not> deleted (O_proc p) s \<and> p \<in> init_procs) |
|
1503 |
then Init p else Created, |
|
1504 |
sec, cpfd2sfds s p, cph2spshs s p \<union> {(sh, flag)}) |
|
1505 |
| _ \<Rightarrow> None) |
|
1506 |
| _ \<Rightarrow> cp2sproc s p) )" |
|
1507 |
apply (frule cph2spshs_attach, frule cpfd2sfds_other, simp, simp, simp, simp, simp, simp) |
|
1508 |
apply (frule vt_grant_os, frule vd_cons, rule ext) |
|
1509 |
apply (case_tac "x = p") |
|
1510 |
apply (auto simp:cp2sproc_def sectxt_of_obj_simps current_files_simps |
|
1511 |
dest!:current_has_sec' dest!:current_file_has_sfile' dest:is_file_in_current is_dir_in_current |
|
1512 |
dest:current_proc_has_sec not_deleted_init_proc split:option.splits if_splits) |
|
1513 |
done |
|
1514 |
||
1515 |
lemma cp2sproc_detach: |
|
1516 |
"valid (Detach p h # s) \<Longrightarrow> |
|
1517 |
cp2sproc (Detach p h # s) = (cp2sproc s) (p := |
|
1518 |
(case (ch2sshm s h, flag_of_proc_shm s p h) of |
|
1519 |
(Some sh, Some flag) \<Rightarrow> if (\<exists> h'. h' \<noteq> h \<and> (p,flag) \<in> procs_of_shm s h' \<and> ch2sshm s h' = Some sh) |
|
1520 |
then cp2sproc s p |
|
1521 |
else (case (sectxt_of_obj s (O_proc p)) of |
|
1522 |
Some sec \<Rightarrow> Some (if (\<not> deleted (O_proc p) s \<and> p \<in> init_procs) |
|
1523 |
then Init p else Created, sec, |
|
1524 |
cpfd2sfds s p, cph2spshs s p - {(sh, flag)}) |
|
1525 |
| None \<Rightarrow> None) |
|
1526 |
| _ \<Rightarrow> cp2sproc s p) )" |
|
1527 |
apply (frule cph2spshs_detach, frule cpfd2sfds_other, simp, simp, simp, simp, simp, simp) |
|
1528 |
apply (frule vt_grant_os, frule vd_cons, rule ext) |
|
1529 |
apply (case_tac "x = p") |
|
1530 |
apply (auto simp:cp2sproc_def sectxt_of_obj_simps current_files_simps |
|
1531 |
dest!:current_has_sec' dest!:current_file_has_sfile' dest:is_file_in_current is_dir_in_current |
|
1532 |
dest:current_proc_has_sec not_deleted_init_proc split:option.splits if_splits) |
|
1533 |
done |
|
1 | 1534 |
|
17 | 1535 |
lemma cp2sproc_deleteshm: |
1536 |
"valid (DeleteShM p h # s) \<Longrightarrow> |
|
1537 |
cp2sproc (DeleteShM p h # s) = (\<lambda> p'. |
|
1538 |
(case (ch2sshm s h, flag_of_proc_shm s p' h) of |
|
1539 |
(Some sh, Some flag) \<Rightarrow> if (\<exists> h'. h' \<noteq> h \<and> (p', flag) \<in> procs_of_shm s h' \<and> ch2sshm s h' = Some sh) |
|
1540 |
then cp2sproc s p' |
|
1541 |
else (case (sectxt_of_obj s (O_proc p')) of |
|
1542 |
Some sec \<Rightarrow> Some (if (\<not> deleted (O_proc p') s \<and> p' \<in> init_procs) |
|
1543 |
then Init p' else Created, sec, |
|
1544 |
cpfd2sfds s p', cph2spshs s p' - {(sh, flag)}) |
|
1545 |
| None \<Rightarrow> None) |
|
1546 |
| _ \<Rightarrow> cp2sproc s p') )" |
|
1547 |
apply (frule cph2spshs_deleteshm, frule cpfd2sfds_other, simp, simp, simp, simp, simp, simp) |
|
1548 |
apply (frule vt_grant_os, frule vd_cons, rule ext) |
|
1549 |
apply (auto simp:cp2sproc_def sectxt_of_obj_simps current_files_simps |
|
1550 |
dest!:current_has_sec' dest!:current_file_has_sfile' dest:is_file_in_current is_dir_in_current |
|
1551 |
dest:current_proc_has_sec not_deleted_init_proc split:option.splits if_splits) |
|
1552 |
done |
|
1553 |
||
1554 |
lemma cp2sproc_execve: |
|
1555 |
"valid (Execve p f fds # s) \<Longrightarrow> |
|
1556 |
cp2sproc (Execve p f fds # s) = (cp2sproc s) (p := |
|
1557 |
(case (sectxt_of_obj (Execve p f fds # s) (O_proc p)) of |
|
1558 |
Some sec \<Rightarrow> Some (if (\<not> deleted (O_proc p) s \<and> p \<in> init_procs) then Init p else Created, sec, |
|
1559 |
{sfd. \<exists> fd \<in> fds. \<exists> f. file_of_proc_fd s p fd = Some f \<and> cfd2sfd s p fd = Some sfd}, {}) |
|
1560 |
| _ \<Rightarrow> None) )" |
|
1561 |
apply (frule cph2spshs_execve, frule cpfd2sfds_execve) |
|
1562 |
apply (frule vt_grant_os, frule vd_cons, rule ext) |
|
1563 |
apply (auto simp:cp2sproc_def sectxt_of_obj_simps current_files_simps |
|
1564 |
dest!:current_has_sec' dest!:current_file_has_sfile' dest:is_file_in_current is_dir_in_current |
|
1565 |
dest:current_proc_has_sec not_deleted_init_proc split:option.splits if_splits) |
|
1566 |
done |
|
1 | 1567 |
|
17 | 1568 |
lemma cp2sproc_kill: |
1569 |
"\<lbrakk>valid (Kill p p' # s); p'' \<noteq> p'\<rbrakk> \<Longrightarrow> |
|
1570 |
cp2sproc (Kill p p' # s) p'' = (cp2sproc s) p''" |
|
1571 |
apply (frule cph2spshs_kill, frule cpfd2sfds_kill) |
|
1572 |
apply (frule vt_grant_os, frule vd_cons) |
|
1573 |
apply (auto simp:cp2sproc_def sectxt_of_obj_simps current_files_simps |
|
1574 |
dest!:current_has_sec' dest!:current_file_has_sfile' dest:is_file_in_current is_dir_in_current |
|
1575 |
dest:current_proc_has_sec not_deleted_init_proc split:option.splits if_splits) |
|
1576 |
done |
|
1577 |
||
1578 |
lemma cp2sproc_kill': |
|
1579 |
"\<lbrakk>valid (Kill p p' # s); p'' \<in> current_procs (Kill p p' # s)\<rbrakk> \<Longrightarrow> |
|
1580 |
cp2sproc (Kill p p' # s) p'' = (cp2sproc s) p''" |
|
1581 |
by (drule_tac p'' = p'' in cp2sproc_kill, simp+) |
|
1582 |
||
1583 |
lemma cp2sproc_exit: |
|
1584 |
"\<lbrakk>valid (Exit p # s); p' \<noteq> p\<rbrakk> \<Longrightarrow> |
|
1585 |
cp2sproc (Exit p # s) p' = (cp2sproc s) p'" |
|
1586 |
apply (frule cph2spshs_exit, frule cpfd2sfds_exit) |
|
1587 |
apply (frule vt_grant_os, frule vd_cons) |
|
1588 |
apply (auto simp:cp2sproc_def sectxt_of_obj_simps current_files_simps |
|
1589 |
dest!:current_has_sec' dest!:current_file_has_sfile' dest:is_file_in_current is_dir_in_current |
|
1590 |
dest:current_proc_has_sec not_deleted_init_proc split:option.splits if_splits) |
|
1591 |
done |
|
1592 |
||
1593 |
lemma cp2sproc_exit': |
|
1594 |
"\<lbrakk>valid (Exit p # s); p' \<in> current_procs (Exit p # s)\<rbrakk> \<Longrightarrow> |
|
1595 |
cp2sproc (Exit p # s) p' = (cp2sproc s) p'" |
|
1596 |
by (drule_tac p'= p' in cp2sproc_exit, simp+) |
|
1597 |
||
1598 |
lemmas cp2sproc_simps = cp2sproc_open cp2sproc_closefd cp2sproc_attach cp2sproc_detach cp2sproc_deleteshm |
|
1599 |
cp2sproc_clone cp2sproc_execve cp2sproc_kill cp2sproc_exit cp2sproc_other |
|
1 | 1600 |
|
1601 |
end |
|
1602 |
||
1603 |
(*<*) |
|
1604 |
end |
|
1605 |
(*>*) |