author | chunhan |
Wed, 04 Sep 2013 09:58:30 +0800 | |
changeset 40 | 8557d7872fdb |
parent 34 | e7f850d1e08e |
child 41 | db15ef2ee18c |
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 |
|
40 | 418 |
lemma is_file_has_sfile': |
419 |
"\<lbrakk>is_file s f; valid s\<rbrakk> \<Longrightarrow> \<exists> sf. cf2sfile s f = Some sf" |
|
420 |
by (drule is_file_has_sfile, auto) |
|
421 |
||
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
|
422 |
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
|
423 |
"\<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
|
424 |
[] \<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
|
425 |
| 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
|
426 |
(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
|
427 |
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
|
428 |
(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
|
429 |
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
|
430 |
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
|
431 |
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
|
432 |
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
|
433 |
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
|
434 |
|
40 | 435 |
lemma is_dir_has_sdir': |
436 |
"\<lbrakk>is_dir s f; valid s\<rbrakk> \<Longrightarrow> \<exists> sf. cf2sfile s f = Some sf" |
|
437 |
apply (case_tac f) |
|
438 |
apply (rule_tac x = sroot in exI) |
|
439 |
apply (simp add:sroot_only) |
|
440 |
apply (drule is_dir_has_sfile, auto) |
|
441 |
done |
|
442 |
||
7 | 443 |
lemma sroot_set: |
444 |
"valid s \<Longrightarrow> \<exists> sec. sroot = (Init [], sec, None, {}) \<and> sectxt_of_obj s (O_dir []) = Some sec" |
|
445 |
apply (frule root_is_dir) |
|
446 |
apply (drule is_dir_has_sec, simp) |
|
447 |
apply (auto simp:sroot_def sec_of_root_def sectxt_of_obj_def type_of_obj.simps |
|
448 |
root_type_remains root_user_remains |
|
449 |
dest!:root_has_type' root_has_user' root_has_init_type' root_has_init_user' |
|
450 |
split:option.splits) |
|
451 |
done |
|
452 |
||
453 |
lemma cf2sfile_path_file: |
|
454 |
"\<lbrakk>is_file s (f # pf); valid s\<rbrakk> |
|
455 |
\<Longrightarrow> cf2sfile s (f # pf) = ( |
|
456 |
case (cf2sfile s pf) of |
|
457 |
Some (pfi, pfsec, psec, asecs) \<Rightarrow> |
|
458 |
(case (sectxt_of_obj s (O_file (f # pf))) of |
|
459 |
Some fsec \<Rightarrow> Some (if (\<not> deleted (O_file (f # pf)) s \<and> is_init_file (f # pf)) then Init (f # pf) |
|
460 |
else Created, fsec, Some pfsec, asecs \<union> {pfsec}) |
|
461 |
| None \<Rightarrow> None) |
|
462 |
| _ \<Rightarrow> None)" |
|
463 |
apply (frule is_file_in_current, drule parentf_is_dir'', simp) |
|
464 |
apply (frule is_dir_has_sfile, simp, frule is_file_has_sfile, simp) |
|
465 |
apply (frule sroot_set) |
|
466 |
apply (case_tac pf, (clarsimp simp:get_parentfs_ctxts'_def sectxt_of_pf_def)+) |
|
467 |
done |
|
468 |
||
469 |
lemma cf2sfile_path_dir: |
|
470 |
"\<lbrakk>is_dir s (f # pf); valid s\<rbrakk> |
|
471 |
\<Longrightarrow> cf2sfile s (f # pf) = ( |
|
472 |
case (cf2sfile s pf) of |
|
473 |
Some (pfi, pfsec, psec, asecs) \<Rightarrow> |
|
474 |
(case (sectxt_of_obj s (O_dir (f # pf))) of |
|
475 |
Some fsec \<Rightarrow> Some (if (\<not> deleted (O_dir (f # pf)) s \<and> is_init_dir (f # pf)) then Init (f # pf) |
|
476 |
else Created, fsec, Some pfsec, asecs \<union> {pfsec}) |
|
477 |
| None \<Rightarrow> None) |
|
478 |
| _ \<Rightarrow> None)" |
|
479 |
apply (frule is_dir_in_current, drule parentf_is_dir'', simp) |
|
480 |
apply (frule_tac f = "f # pf" in is_dir_has_sfile, simp) |
|
481 |
apply (frule_tac f = "pf" in is_dir_has_sfile, simp) |
|
482 |
apply (frule sroot_set) |
|
483 |
apply (case_tac pf, (clarsimp simp:get_parentfs_ctxts'_def sectxt_of_pf_def)+) |
|
484 |
done |
|
485 |
||
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
|
486 |
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
|
487 |
"\<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
|
488 |
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
|
489 |
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
|
490 |
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
|
491 |
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
|
492 |
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
|
493 |
| 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
|
494 |
else (case (sectxt_of_obj s (O_dir (f # pf))) of |
7 | 495 |
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
|
496 |
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
|
497 |
| 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
|
498 |
| None \<Rightarrow> None)" |
7 | 499 |
apply (drule is_file_or_dir, simp) |
500 |
apply (erule disjE) |
|
501 |
apply (frule cf2sfile_path_file, simp) defer |
|
502 |
apply (frule cf2sfile_path_dir, simp, drule is_dir_not_file) |
|
503 |
apply (auto split:option.splits) |
|
504 |
done |
|
505 |
||
8 | 506 |
lemma cf2sfile_path_file_prop1: |
507 |
"\<lbrakk>is_file s (f # pf); cf2sfile s pf = Some (pfi, pfsec, psec, asecs); valid s\<rbrakk> |
|
508 |
\<Longrightarrow> \<exists> fsec. cf2sfile s (f # pf) = |
|
509 |
Some (if (\<not> deleted (O_file (f # pf)) s \<and> is_init_file (f # pf)) then Init (f # pf) |
|
510 |
else Created, fsec, Some pfsec, asecs \<union> {pfsec}) \<and> |
|
511 |
sectxt_of_obj s (O_file (f # pf)) = Some fsec" |
|
512 |
apply (frule is_file_has_sfile, simp) |
|
513 |
by (auto simp:cf2sfile_path_file) |
|
7 | 514 |
|
8 | 515 |
lemma cf2sfile_path_file_prop2: |
516 |
"\<lbrakk>is_file s (f # pf); cf2sfile s pf = Some (pfi, pfsec, psec, asecs); |
|
517 |
sectxt_of_obj s (O_file (f # pf)) = Some fsec; valid s\<rbrakk> \<Longrightarrow> cf2sfile s (f # pf) = |
|
518 |
Some (if (\<not> deleted (O_file (f # pf)) s \<and> is_init_file (f # pf)) then Init (f # pf) |
|
519 |
else Created, fsec, Some pfsec, asecs \<union> {pfsec})" |
|
520 |
by (drule cf2sfile_path_file_prop1, auto) |
|
7 | 521 |
|
8 | 522 |
lemma cf2sfile_path_dir_prop1: |
523 |
"\<lbrakk>is_dir s (f # pf); cf2sfile s pf = Some (pfi, pfsec, psec, asecs); valid s\<rbrakk> |
|
524 |
\<Longrightarrow> \<exists> fsec. cf2sfile s (f # pf) = |
|
525 |
Some (if (\<not> deleted (O_dir (f # pf)) s \<and> is_init_dir (f # pf)) then Init (f # pf) |
|
526 |
else Created, fsec, Some pfsec, asecs \<union> {pfsec}) \<and> |
|
527 |
sectxt_of_obj s (O_dir (f # pf)) = Some fsec" |
|
528 |
apply (frule is_dir_has_sfile, simp) |
|
529 |
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
|
530 |
|
8 | 531 |
lemma cf2sfile_path_dir_prop2: |
532 |
"\<lbrakk>is_dir s (f # pf); cf2sfile s pf = Some (pfi, pfsec, psec, asecs); |
|
533 |
sectxt_of_obj s (O_dir (f # pf)) = Some fsec; valid s\<rbrakk> \<Longrightarrow> cf2sfile s (f # pf) = |
|
534 |
Some (if (\<not> deleted (O_dir (f # pf)) s \<and> is_init_dir (f # pf)) then Init (f # pf) |
|
535 |
else Created, fsec, Some pfsec, asecs \<union> {pfsec})" |
|
536 |
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
|
537 |
|
8 | 538 |
(**************** cf2sfile event list simpset ****************) |
4 | 539 |
|
8 | 540 |
lemma cf2sfile_open_none': |
541 |
"valid (Open p f flag fd None # s) \<Longrightarrow> cf2sfile (Open p f flag fd None # s) f'= cf2sfile s f'" |
|
4 | 542 |
apply (frule vd_cons, frule vt_grant_os) |
543 |
apply (induct f', simp add:cf2sfile_def) |
|
544 |
apply (simp add:cf2sfile_def is_file_simps is_dir_simps current_files_simps sectxt_of_obj_simps |
|
545 |
get_parentfs_ctxts_simps) |
|
546 |
done |
|
547 |
||
548 |
lemma cf2sfile_open_none: |
|
549 |
"valid (Open p f flag fd None # s) \<Longrightarrow> cf2sfile (Open p f flag fd None # s) = cf2sfile s" |
|
8 | 550 |
apply (rule ext) |
551 |
by (simp add:cf2sfile_open_none') |
|
1 | 552 |
|
553 |
lemma cf2sfile_open_some1: |
|
554 |
"\<lbrakk>valid (Open p f flag fd (Some inum) # s); f' \<in> current_files s\<rbrakk> |
|
555 |
\<Longrightarrow> cf2sfile (Open p f flag fd (Some inum) # s) f' = cf2sfile s f'" |
|
8 | 556 |
apply (frule vd_cons, frule vt_grant_os, frule noroot_events) |
4 | 557 |
apply (case_tac "f = f'", simp) |
558 |
apply (induct f', simp add:sroot_only, simp) |
|
3 | 559 |
apply (frule parentf_in_current', simp+) |
4 | 560 |
apply (simp add:cf2sfile_def is_file_simps is_dir_simps current_files_simps sectxt_of_obj_simps |
1 | 561 |
get_parentfs_ctxts_simps) |
562 |
done |
|
563 |
||
564 |
lemma cf2sfile_open_some2: |
|
565 |
"\<lbrakk>valid (Open p f flag fd (Some inum) # s); is_file s f'\<rbrakk> |
|
8 | 566 |
\<Longrightarrow> cf2sfile (Open p f flag fd (Some inum) # s) f' = cf2sfile s f'" |
1 | 567 |
apply (frule vd_cons, drule is_file_in_current) |
568 |
by (simp add:cf2sfile_open_some1) |
|
569 |
||
570 |
lemma cf2sfile_open_some3: |
|
571 |
"\<lbrakk>valid (Open p f flag fd (Some inum) # s); is_dir s f'\<rbrakk> |
|
8 | 572 |
\<Longrightarrow> cf2sfile (Open p f flag fd (Some inum) # s) f' = cf2sfile s f'" |
1 | 573 |
apply (frule vd_cons, drule is_dir_in_current) |
574 |
by (simp add:cf2sfile_open_some1) |
|
575 |
||
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 |
lemma cf2sfile_open_some4: |
8 | 577 |
"valid (Open p f flag fd (Some inum) # s) \<Longrightarrow> cf2sfile (Open p f flag fd (Some inum) # s) f = ( |
1 | 578 |
case (parent f) of |
579 |
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), |
|
580 |
get_parentfs_ctxts s pf) of |
|
581 |
(Some sec, Some psec, Some asecs) \<Rightarrow> Some (Created, sec, Some psec, set asecs) |
|
582 |
| _ \<Rightarrow> None) |
|
583 |
| None \<Rightarrow> None)" |
|
584 |
apply (frule vd_cons, frule vt_grant_os, frule noroot_events) |
|
4 | 585 |
apply (case_tac f, simp) |
586 |
apply (simp add:cf2sfile_def is_file_simps is_dir_simps current_files_simps sectxt_of_obj_simps |
|
587 |
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
|
588 |
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
|
589 |
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
|
590 |
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
|
591 |
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
|
592 |
|
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 |
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
|
594 |
"\<lbrakk>valid (Open p f flag fd opt # s); f' \<in> current_files (Open p f flag fd opt # s)\<rbrakk> |
8 | 595 |
\<Longrightarrow> cf2sfile (Open p f flag fd opt # s) f' = ( |
596 |
if (opt = None) then cf2sfile s f' |
|
597 |
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
|
598 |
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
|
599 |
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
|
600 |
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
|
601 |
(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
|
602 |
| _ \<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
|
603 |
| None \<Rightarrow> None) |
8 | 604 |
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
|
605 |
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
|
606 |
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
|
607 |
apply (case_tac "f = f'") |
8 | 608 |
apply (simp add:cf2sfile_open_some4 split:option.splits) |
609 |
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
|
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_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
|
613 |
"\<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
|
614 |
\<Longrightarrow> cf2sfile (Mkdir p f i # s) f' = cf2sfile s f'" |
8 | 615 |
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
|
616 |
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
|
617 |
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
|
618 |
apply (frule parentf_in_current', simp+) |
8 | 619 |
apply (case_tac "f = f'", simp) |
620 |
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
|
621 |
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
|
622 |
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
|
623 |
|
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
|
624 |
lemma cf2sfile_mkdir2: |
8 | 625 |
"\<lbrakk>valid (Mkdir p f i # s); is_file s f'\<rbrakk> |
626 |
\<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
|
627 |
apply (frule vd_cons, drule is_file_in_current) |
8 | 628 |
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
|
629 |
|
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
|
630 |
lemma cf2sfile_mkdir3: |
8 | 631 |
"\<lbrakk>valid (Mkdir p f i # s); is_dir s f'\<rbrakk> |
632 |
\<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
|
633 |
apply (frule vd_cons, drule is_dir_in_current) |
8 | 634 |
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
|
635 |
|
8 | 636 |
lemma cf2sfile_mkdir4: |
637 |
"valid (Mkdir p f i # s) |
|
638 |
\<Longrightarrow> cf2sfile (Mkdir p f i # s) f = (case (parent f) of |
|
639 |
Some pf \<Rightarrow> (case (sectxt_of_obj (Mkdir p f i # s) (O_dir f), sectxt_of_obj s (O_dir pf), |
|
640 |
get_parentfs_ctxts s pf) of |
|
641 |
(Some sec, Some psec, Some asecs) \<Rightarrow> Some (Created, sec, Some psec, set asecs) |
|
642 |
| _ \<Rightarrow> None) |
|
643 |
| None \<Rightarrow> None)" |
|
644 |
apply (frule vd_cons, frule vt_grant_os, frule noroot_events) |
|
645 |
apply (case_tac f, simp) |
|
646 |
apply (clarsimp simp:os_grant.simps) |
|
647 |
apply (simp add:sectxt_of_obj_simps) |
|
648 |
apply (frule current_proc_has_sec, simp) |
|
649 |
apply (frule is_dir_has_sec, simp) |
|
650 |
apply (frule get_pfs_secs_prop, simp) |
|
651 |
apply (frule is_dir_not_file) |
|
652 |
apply (auto simp add:cf2sfile_def is_file_simps is_dir_simps current_files_simps sectxt_of_obj_simps |
|
653 |
get_parentfs_ctxts_simps split:option.splits if_splits |
|
654 |
dest:not_deleted_init_dir is_dir_in_current not_deleted_init_file is_file_in_current) |
|
655 |
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
|
656 |
|
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
|
657 |
lemma cf2sfile_mkdir: |
8 | 658 |
"\<lbrakk>valid (Mkdir p f i # s); f' \<in> current_files (Mkdir p f i # s)\<rbrakk> |
659 |
\<Longrightarrow> cf2sfile (Mkdir p f i # s) f' = ( |
|
660 |
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
|
661 |
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
|
662 |
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
|
663 |
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
|
664 |
(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
|
665 |
| _ \<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
|
666 |
| None \<Rightarrow> None) |
8 | 667 |
else cf2sfile s f')" |
668 |
apply (case_tac "f = f'") |
|
669 |
apply (simp add:cf2sfile_mkdir4 split:option.splits) |
|
670 |
apply (simp add:cf2sfile_mkdir1 current_files_simps) |
|
671 |
done |
|
672 |
||
673 |
lemma cf2sfile_linkhard1: |
|
674 |
"\<lbrakk>valid (LinkHard p oldf f # s); f' \<in> current_files s\<rbrakk> |
|
675 |
\<Longrightarrow> cf2sfile (LinkHard p oldf f# s) f' = cf2sfile s f'" |
|
676 |
apply (frule vd_cons, frule vt_grant_os, frule noroot_events) |
|
677 |
apply (case_tac "f = f'", simp) |
|
678 |
apply (induct f', simp add:sroot_only, simp) |
|
679 |
apply (frule parentf_in_current', simp+) |
|
680 |
apply (simp add:cf2sfile_def is_file_simps is_dir_simps current_files_simps sectxt_of_obj_simps |
|
681 |
get_parentfs_ctxts_simps split:if_splits option.splits) |
|
682 |
done |
|
683 |
||
684 |
lemma cf2sfile_linkhard2: |
|
685 |
"\<lbrakk>valid (LinkHard p oldf f # s); is_file s f'\<rbrakk> |
|
686 |
\<Longrightarrow> cf2sfile (LinkHard p oldf f # s) f' = cf2sfile s f'" |
|
687 |
apply (frule vd_cons, drule is_file_in_current) |
|
688 |
by (simp add:cf2sfile_linkhard1) |
|
689 |
||
690 |
lemma cf2sfile_linkhard3: |
|
691 |
"\<lbrakk>valid (LinkHard p oldf f # s); is_dir s f'\<rbrakk> |
|
692 |
\<Longrightarrow> cf2sfile (LinkHard p oldf f # s) f' = cf2sfile s f'" |
|
693 |
apply (frule vd_cons, drule is_dir_in_current) |
|
694 |
by (simp add:cf2sfile_linkhard1) |
|
695 |
||
696 |
lemma cf2sfile_linkhard4: |
|
697 |
"valid (LinkHard p oldf f # s) |
|
698 |
\<Longrightarrow> cf2sfile (LinkHard p oldf f # s) f = (case (parent f) of |
|
699 |
Some pf \<Rightarrow> (case (sectxt_of_obj (LinkHard p oldf f # s) (O_file f), sectxt_of_obj s (O_dir pf), |
|
700 |
get_parentfs_ctxts s pf) of |
|
701 |
(Some sec, Some psec, Some asecs) \<Rightarrow> Some (Created, sec, Some psec, set asecs) |
|
702 |
| _ \<Rightarrow> None) |
|
703 |
| None \<Rightarrow> None)" |
|
704 |
apply (frule vd_cons, frule vt_grant_os, frule noroot_events) |
|
705 |
apply (case_tac f, simp) |
|
706 |
apply (simp add:cf2sfile_def is_file_simps is_dir_simps current_files_simps sectxt_of_obj_simps |
|
707 |
get_parentfs_ctxts_simps) |
|
708 |
apply (rule impI, (erule conjE)+) |
|
709 |
apply (drule not_deleted_init_file, simp+) |
|
710 |
apply (simp add:is_file_in_current) |
|
711 |
done |
|
712 |
||
713 |
lemma cf2sfile_linkhard: |
|
714 |
"\<lbrakk>valid (LinkHard p oldf f # s); f' \<in> current_files (LinkHard p oldf f # s)\<rbrakk> |
|
715 |
\<Longrightarrow> cf2sfile (LinkHard p oldf f # s) f' = ( |
|
716 |
if (f' = f) |
|
717 |
then (case (parent f) of |
|
718 |
Some pf \<Rightarrow> (case (sectxt_of_obj (LinkHard p oldf f # s) (O_file f), sectxt_of_obj s (O_dir pf), |
|
719 |
get_parentfs_ctxts s pf) of |
|
720 |
(Some sec, Some psec, Some asecs) \<Rightarrow> Some (Created, sec, Some psec, set asecs) |
|
721 |
| _ \<Rightarrow> None) |
|
722 |
| None \<Rightarrow> None) |
|
723 |
else cf2sfile s f')" |
|
724 |
apply (case_tac "f = f'") |
|
725 |
apply (simp add:cf2sfile_linkhard4 split:option.splits) |
|
726 |
apply (simp add:cf2sfile_linkhard1 current_files_simps) |
|
727 |
done |
|
728 |
||
729 |
lemma cf2sfile_other: |
|
730 |
"\<lbrakk>ff \<in> current_files s; |
|
731 |
\<forall> p f flag fd opt. e \<noteq> Open p f flag fd opt; |
|
732 |
\<forall> p fd. e \<noteq> CloseFd p fd; |
|
733 |
\<forall> p f. e \<noteq> UnLink p f; |
|
734 |
\<forall> p f. e \<noteq> Rmdir p f; |
|
735 |
\<forall> p f i. e \<noteq> Mkdir p f i; |
|
736 |
\<forall> p f f'. e \<noteq> LinkHard p f f'; |
|
737 |
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
|
738 |
apply (frule vd_cons, frule vt_grant_os) |
8 | 739 |
apply (induct ff, simp add:sroot_only) |
740 |
apply (frule parentf_in_current', simp+, case_tac e) |
|
741 |
apply (auto simp:current_files_simps is_file_simps is_dir_simps sectxt_of_obj_simps cf2sfile_path |
|
742 |
split:if_splits option.splits) |
|
743 |
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
|
744 |
|
10 | 745 |
lemma cf2sfile_other': |
746 |
"\<lbrakk>valid (e # s); |
|
747 |
\<forall> p f flag fd opt. e \<noteq> Open p f flag fd opt; |
|
748 |
\<forall> p fd. e \<noteq> CloseFd p fd; |
|
749 |
\<forall> p f. e \<noteq> UnLink p f; |
|
750 |
\<forall> p f. e \<noteq> Rmdir p f; |
|
751 |
\<forall> p f i. e \<noteq> Mkdir p f i; |
|
752 |
\<forall> p f f'. e \<noteq> LinkHard p f f'; |
|
753 |
ff \<in> current_files s\<rbrakk> \<Longrightarrow> cf2sfile (e # s) ff = cf2sfile s ff" |
|
754 |
by (auto intro!:cf2sfile_other) |
|
755 |
||
8 | 756 |
lemma cf2sfile_unlink: |
757 |
"\<lbrakk>valid (UnLink p f # s); f' \<in> current_files (UnLink p f # s)\<rbrakk> |
|
758 |
\<Longrightarrow> cf2sfile (UnLink p f # s) f' = cf2sfile s f'" |
|
759 |
apply (frule vd_cons, frule vt_grant_os) |
|
760 |
apply (simp add:current_files_simps split:if_splits) |
|
761 |
apply (auto simp:cf2sfile_def sectxt_of_obj_simps get_parentfs_ctxts_simps is_file_simps is_dir_simps |
|
10 | 762 |
split:if_splits option.splits) |
1 | 763 |
done |
764 |
||
10 | 765 |
lemma cf2sfile_rmdir: |
766 |
"\<lbrakk>valid (Rmdir p f # s); f' \<in> current_files (Rmdir p f # s)\<rbrakk> |
|
767 |
\<Longrightarrow> cf2sfile (Rmdir p f # s) f' = cf2sfile s f'" |
|
768 |
apply (frule vd_cons, frule vt_grant_os) |
|
769 |
apply (simp add:current_files_simps split:if_splits) |
|
770 |
apply (auto simp:cf2sfile_def sectxt_of_obj_simps get_parentfs_ctxts_simps is_file_simps is_dir_simps |
|
771 |
split:if_splits option.splits) |
|
1 | 772 |
done |
773 |
||
10 | 774 |
lemma pfdof_simp5: "\<lbrakk>proc_fd_of_file s f = {(p, fd)}; file_of_proc_fd s p fd = None\<rbrakk> \<Longrightarrow> False" |
775 |
apply (subgoal_tac "(p, fd) \<in> proc_fd_of_file s f") |
|
776 |
by (simp add:pfdof_simp2, simp) |
|
777 |
||
778 |
lemma pfdof_simp6: "proc_fd_of_file s f = {(p, fd)} \<Longrightarrow> file_of_proc_fd s p fd = Some f" |
|
779 |
apply (subgoal_tac "(p, fd) \<in> proc_fd_of_file s f") |
|
780 |
by (simp add:pfdof_simp2, simp) |
|
781 |
||
782 |
lemma cf2sfile_closefd: |
|
783 |
"\<lbrakk>valid (CloseFd p fd # s); f \<in> current_files (CloseFd p fd # s)\<rbrakk> |
|
784 |
\<Longrightarrow> cf2sfile (CloseFd p fd # s) f = cf2sfile s f" |
|
785 |
apply (frule vd_cons, frule vt_grant_os) |
|
786 |
apply (simp add:current_files_simps split:if_splits option.splits) |
|
34 | 787 |
(* costs too much time, but solved *) |
10 | 788 |
|
789 |
apply (auto simp:cf2sfile_def sectxt_of_obj_simps get_parentfs_ctxts_simps is_file_simps is_dir_simps |
|
790 |
split:if_splits option.splits |
|
791 |
dest:init_file_dir_conflict pfdof_simp5 pfdof_simp6 file_of_pfd_is_file |
|
792 |
not_deleted_init_file not_deleted_init_dir is_file_not_dir is_dir_not_file |
|
793 |
dest!:current_has_sec') |
|
794 |
done |
|
1 | 795 |
|
10 | 796 |
lemmas cf2sfile_simps = cf2sfile_open cf2sfile_mkdir cf2sfile_linkhard cf2sfile_other |
797 |
cf2sfile_unlink cf2sfile_rmdir cf2sfile_closefd |
|
798 |
||
799 |
(*********** cfd2sfd simpset *********) |
|
800 |
||
801 |
lemma cfd2sfd_open1: |
|
802 |
"valid (Open p f flags fd opt # s) |
|
803 |
\<Longrightarrow> cfd2sfd (Open p f flags fd opt # s) p fd = |
|
804 |
(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 |
|
805 |
(Some sec, Some sf) \<Rightarrow> Some (sec, flags, sf) |
|
806 |
| _ \<Rightarrow> None)" |
|
807 |
by (simp add:cfd2sfd_def sectxt_of_obj_simps split:if_splits) |
|
1 | 808 |
|
10 | 809 |
lemma cfd2sfd_open_some2: |
810 |
"\<lbrakk>valid (Open p f flags fd (Some inum) # s); file_of_proc_fd s p' fd' = Some f'\<rbrakk> |
|
811 |
\<Longrightarrow> cfd2sfd (Open p f flags fd (Some inum) # s) p' fd' = cfd2sfd s p' fd'" |
|
812 |
apply (frule vd_cons, frule vt_grant_os) |
|
813 |
apply (frule proc_fd_in_fds, simp) |
|
814 |
apply (frule file_of_proc_fd_in_curf, simp) |
|
815 |
apply (case_tac "f = f'", simp) |
|
816 |
apply (simp add:cfd2sfd_def sectxt_of_obj_simps cf2sfile_open_some1) |
|
817 |
apply (case_tac "p = p'", simp) |
|
818 |
apply (rule conjI, rule impI, simp) |
|
819 |
apply (drule cf2sfile_open_some1, simp) |
|
820 |
apply (auto split:option.splits)[1] |
|
821 |
apply simp |
|
822 |
apply (drule cf2sfile_open_some1, simp) |
|
823 |
apply (auto split:option.splits)[1] |
|
1 | 824 |
done |
825 |
||
10 | 826 |
lemma cfd2sfd_open_none2: |
827 |
"\<lbrakk>valid (Open p f flags fd None # s); file_of_proc_fd s p' fd' = Some f'\<rbrakk> |
|
828 |
\<Longrightarrow> cfd2sfd (Open p f flags fd None # s) p' fd' = cfd2sfd s p' fd'" |
|
829 |
apply (frule vd_cons, frule vt_grant_os) |
|
830 |
apply (frule proc_fd_in_fds, simp) |
|
831 |
apply (frule file_of_proc_fd_in_curf, simp) |
|
832 |
apply (simp add:cfd2sfd_def sectxt_of_obj_simps cf2sfile_open_none) |
|
833 |
apply (case_tac "p = p'", simp) |
|
834 |
apply (rule conjI, rule impI, simp) |
|
835 |
apply (drule cf2sfile_open_none) |
|
836 |
apply (auto split:option.splits)[1] |
|
837 |
apply simp |
|
838 |
apply (drule cf2sfile_open_none) |
|
839 |
apply (auto split:option.splits)[1] |
|
840 |
done |
|
841 |
||
842 |
lemma cfd2sfd_open2: |
|
843 |
"\<lbrakk>valid (Open p f flags fd opt # s); file_of_proc_fd s p' fd' = Some f'\<rbrakk> |
|
844 |
\<Longrightarrow> cfd2sfd (Open p f flags fd opt # s) p' fd' = cfd2sfd s p' fd'" |
|
845 |
apply (case_tac opt) |
|
846 |
apply (simp add:cfd2sfd_open_none2) |
|
847 |
apply (simp add:cfd2sfd_open_some2) |
|
1 | 848 |
done |
849 |
||
10 | 850 |
lemma cfd2sfd_open: |
851 |
"\<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> |
|
852 |
\<Longrightarrow> cfd2sfd (Open p f flags fd opt # s) p' fd' = (if (p' = p \<and> fd' = fd) then |
|
853 |
(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 |
|
854 |
(Some sec, Some sf) \<Rightarrow> Some (sec, flags, sf) |
|
855 |
| _ \<Rightarrow> None) else cfd2sfd s p' fd')" |
|
856 |
apply (simp split:if_splits) |
|
857 |
apply (simp add:cfd2sfd_open1 split:option.splits) |
|
858 |
apply (simp add:cfd2sfd_open2) |
|
859 |
apply (rule impI, simp) |
|
1 | 860 |
done |
861 |
||
10 | 862 |
lemma cfd2sfd_closefd: |
863 |
"\<lbrakk>valid (CloseFd p fd # s); file_of_proc_fd (CloseFd p fd # s) p' fd' = Some f\<rbrakk> |
|
864 |
\<Longrightarrow> cfd2sfd (CloseFd p fd # s) p' fd' = cfd2sfd s p' fd'" |
|
865 |
apply (frule vd_cons, frule vt_grant_os) |
|
866 |
apply (frule proc_fd_in_fds, simp) |
|
867 |
apply (frule file_of_proc_fd_in_curf, simp) |
|
868 |
apply (frule cf2sfile_closefd, simp) |
|
869 |
apply (simp add:cfd2sfd_def sectxt_of_obj_simps) |
|
870 |
apply (auto split:option.splits if_splits) |
|
871 |
done |
|
1 | 872 |
|
10 | 873 |
lemma cfd2sfd_clone: |
874 |
"\<lbrakk>valid (Clone p p' fds shms # s); file_of_proc_fd (Clone p p' fds shms # s) p'' fd' = Some f\<rbrakk> |
|
875 |
\<Longrightarrow> cfd2sfd (Clone p p' fds shms # s) p'' fd' = ( |
|
876 |
if (p'' = p') then cfd2sfd s p fd' |
|
877 |
else cfd2sfd s p'' fd')" |
|
878 |
apply (frule vd_cons, frule vt_grant_os) |
|
879 |
apply (frule proc_fd_in_fds, simp) |
|
880 |
apply (frule file_of_proc_fd_in_curf, simp, simp add:current_files_simps) |
|
881 |
apply (frule_tac cf2sfile_other', simp+) |
|
882 |
apply (simp add:cfd2sfd_def sectxt_of_obj_simps) |
|
883 |
apply (case_tac "p'' = p'", simp) |
|
884 |
apply (auto split:option.splits if_splits)[1] |
|
885 |
apply (simp) |
|
886 |
apply (auto split:option.splits if_splits)[1] |
|
1 | 887 |
done |
888 |
||
10 | 889 |
lemma cfd2sfd_execve: |
890 |
"\<lbrakk>valid (Execve p f fds # s); file_of_proc_fd (Execve p f fds # s) p' fd' = Some f'\<rbrakk> |
|
891 |
\<Longrightarrow> cfd2sfd (Execve p f fds # s) p' fd' = cfd2sfd s p' fd'" |
|
892 |
apply (frule vd_cons, frule vt_grant_os) |
|
893 |
apply (frule proc_fd_in_fds, simp) |
|
894 |
apply (frule file_of_proc_fd_in_curf, simp, simp add:current_files_simps) |
|
895 |
apply (frule_tac cf2sfile_other', simp+) |
|
896 |
apply (simp add:cfd2sfd_def sectxt_of_obj_simps) |
|
897 |
apply (case_tac "p' = p", simp) |
|
898 |
apply (auto split:option.splits if_splits)[1] |
|
899 |
apply (simp) |
|
900 |
apply (auto split:option.splits if_splits)[1] |
|
1 | 901 |
done |
902 |
||
10 | 903 |
lemma cfd2sfd_kill: |
904 |
"\<lbrakk>valid (Kill p p'' # s); file_of_proc_fd (Kill p p'' # s) p' fd' = Some f'\<rbrakk> |
|
905 |
\<Longrightarrow> cfd2sfd (Kill p 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_exit: |
916 |
"\<lbrakk>valid (Exit p # s); file_of_proc_fd (Exit p # s) p' fd' = Some f'\<rbrakk> |
|
917 |
\<Longrightarrow> cfd2sfd (Exit p # s) p' fd' = cfd2sfd s p' fd'" |
|
918 |
apply (frule vd_cons, frule vt_grant_os) |
|
919 |
apply (frule proc_fd_in_fds, simp) |
|
920 |
apply (frule proc_fd_in_procs, simp) |
|
921 |
apply (frule file_of_proc_fd_in_curf, simp, simp add:current_files_simps) |
|
922 |
apply (frule_tac cf2sfile_other', simp+) |
|
923 |
apply (simp add:cfd2sfd_def sectxt_of_obj_simps) |
|
924 |
apply (auto split:option.splits if_splits) |
|
1 | 925 |
done |
926 |
||
10 | 927 |
lemma cfd2sfd_other: |
928 |
"\<lbrakk>valid (e # s); file_of_proc_fd (e # s) p' fd' = Some f'; |
|
929 |
\<forall> p f flags fd opt. e \<noteq> Open p f flags fd opt; |
|
930 |
\<forall> p p'' fds shms. e \<noteq> Clone p p'' fds shms\<rbrakk> |
|
931 |
\<Longrightarrow> cfd2sfd (e # s) p' fd' = cfd2sfd s p' fd'" |
|
932 |
apply (frule vd_cons, frule vt_grant_os) |
|
933 |
apply (frule proc_fd_in_fds, simp) |
|
934 |
apply (frule proc_fd_in_procs, simp) |
|
935 |
apply (frule file_of_proc_fd_in_curf, simp) |
|
936 |
apply (case_tac e) |
|
937 |
apply (auto intro!:cfd2sfd_execve cfd2sfd_closefd cfd2sfd_kill cfd2sfd_exit) |
|
938 |
apply (auto simp:cfd2sfd_def sectxt_of_obj_simps current_files_simps cf2sfile_simps split:option.splits) |
|
939 |
apply (auto dest!:current_has_sec' dest:file_of_proc_fd_in_curf proc_fd_in_fds) |
|
940 |
done |
|
941 |
||
942 |
lemmas cfd2sfd_simps = cfd2sfd_open cfd2sfd_clone cfd2sfd_other |
|
943 |
||
944 |
(********** cpfd2sfds simpset **********) |
|
945 |
||
946 |
lemma current_filefd_has_flags: |
|
947 |
"\<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" |
|
948 |
apply (induct s arbitrary:p) |
|
949 |
apply (simp only:flags_of_proc_fd.simps file_of_proc_fd.simps init_filefd_prop4) |
|
950 |
apply (frule vd_cons, frule vt_grant_os, case_tac a) |
|
951 |
apply (auto split:if_splits option.splits dest:proc_fd_in_fds) |
|
952 |
done |
|
953 |
||
954 |
lemma current_filefd_has_flags': |
|
955 |
"\<lbrakk>flags_of_proc_fd s p fd = None; valid s\<rbrakk> \<Longrightarrow> file_of_proc_fd s p fd = None" |
|
956 |
apply (case_tac "file_of_proc_fd s p fd") |
|
957 |
apply (simp, drule current_filefd_has_flags, simp+) |
|
1 | 958 |
done |
959 |
||
10 | 960 |
lemma current_file_has_sfile': |
961 |
"\<lbrakk>cf2sfile s f = None; valid s\<rbrakk> \<Longrightarrow> f \<notin> current_files s" |
|
962 |
by (rule notI, drule current_file_has_sfile, simp+) |
|
1 | 963 |
|
10 | 964 |
lemma current_filefd_has_sfd: |
965 |
"\<lbrakk>file_of_proc_fd s p fd = Some f; valid s\<rbrakk> \<Longrightarrow> \<exists>sfd. cfd2sfd s p fd = Some sfd" |
|
966 |
by (auto simp:cfd2sfd_def split:option.splits dest!:current_has_sec' current_file_has_sfile' |
|
967 |
dest:file_of_proc_fd_in_curf proc_fd_in_fds current_filefd_has_flags) |
|
968 |
||
969 |
lemma current_filefd_has_sfd': |
|
970 |
"\<lbrakk>cfd2sfd s p fd = None; valid s\<rbrakk> \<Longrightarrow> file_of_proc_fd s p fd = None" |
|
971 |
by (case_tac "file_of_proc_fd s p fd", auto dest:current_filefd_has_sfd) |
|
1 | 972 |
|
12 | 973 |
lemma cpfd2sfds_open1: |
974 |
"valid (Open p f flags fd opt # s) \<Longrightarrow> |
|
975 |
cpfd2sfds (Open p f flags fd opt # s) p = ( |
|
976 |
case (cfd2sfd (Open p f flags fd opt # s) p fd) of |
|
10 | 977 |
Some sfd \<Rightarrow> (cpfd2sfds s p) \<union> {sfd} |
978 |
| _ \<Rightarrow> cpfd2sfds s p)" |
|
979 |
apply (frule vd_cons, frule vt_grant_os) |
|
980 |
apply (split option.splits) |
|
981 |
apply (rule conjI, rule impI, drule current_filefd_has_sfd', simp, simp) |
|
982 |
apply (rule allI, rule impI) |
|
983 |
apply (rule set_eqI, rule iffI) |
|
12 | 984 |
apply (case_tac "x = a", simp) |
10 | 985 |
unfolding cpfd2sfds_def |
13 | 986 |
apply (erule CollectE, (erule conjE|erule bexE)+) |
987 |
apply (simp add:proc_file_fds_def split:if_splits) |
|
988 |
apply (erule exE, rule_tac x = fda in exI) |
|
989 |
apply (simp add:cfd2sfd_open2) |
|
990 |
apply (case_tac "x = a", simp add:proc_file_fds_def) |
|
12 | 991 |
apply (rule_tac x = fd in exI, simp+) |
13 | 992 |
apply (erule conjE|erule bexE)+ |
993 |
apply (rule_tac x = fda in bexI) |
|
994 |
apply (simp add:proc_file_fds_def, erule exE) |
|
995 |
apply (simp add:cfd2sfd_open2) |
|
996 |
apply (simp add:proc_file_fds_def) |
|
12 | 997 |
done |
1 | 998 |
|
12 | 999 |
lemma cpfd2sfds_open1': |
10 | 1000 |
"valid (Open p f flags fd opt # s) \<Longrightarrow> |
1001 |
cpfd2sfds (Open p f flags fd opt # s) p = ( |
|
1002 |
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 |
|
1003 |
(Some sec, Some sf) \<Rightarrow> (cpfd2sfds s p) \<union> {(sec, flags, sf)} |
|
1004 |
| _ \<Rightarrow> cpfd2sfds s p)" |
|
1005 |
apply (frule cfd2sfd_open1) |
|
12 | 1006 |
apply (auto dest:cpfd2sfds_open1 split:option.splits) |
1007 |
done |
|
1008 |
||
1009 |
lemma cpfd2sfds_open2: |
|
1010 |
"\<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'" |
|
1011 |
apply (frule vt_grant_os, frule vd_cons) |
|
1012 |
unfolding cpfd2sfds_def |
|
1013 |
apply (rule set_eqI, rule iffI) |
|
13 | 1014 |
apply (simp add:proc_file_fds_def) |
1015 |
apply (erule exE|erule conjE)+ |
|
12 | 1016 |
apply (simp only:file_of_proc_fd.simps cfd2sfd_open2 split:if_splits) |
13 | 1017 |
apply (rule_tac x = fda in exI, simp) |
1018 |
apply (simp add:proc_file_fds_def) |
|
1019 |
apply (erule exE|erule conjE)+ |
|
12 | 1020 |
apply (rule_tac x = fda in exI, simp add:cfd2sfd_open2) |
1021 |
done |
|
1 | 1022 |
|
10 | 1023 |
lemma cpfd2sfds_open: |
1024 |
"valid (Open p f flags fd opt # s) |
|
1025 |
\<Longrightarrow> cpfd2sfds (Open p f flags fd opt # s) = (cpfd2sfds s) (p := ( |
|
1026 |
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 |
|
1027 |
(Some sec, Some sf) \<Rightarrow> (cpfd2sfds s p) \<union> {(sec, flags, sf)} |
|
1028 |
| _ \<Rightarrow> cpfd2sfds s p))" |
|
1029 |
apply (rule ext) |
|
12 | 1030 |
apply (case_tac "x \<noteq> p") |
1031 |
apply (simp add:cpfd2sfds_open2) |
|
1032 |
apply (simp add:cpfd2sfds_open1') |
|
1033 |
done |
|
1 | 1034 |
|
12 | 1035 |
lemma cpfd2sfds_execve: |
13 | 1036 |
"valid (Execve p f fds # s) |
1037 |
\<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})" |
|
1038 |
apply (frule vd_cons, frule vt_grant_os) |
|
1039 |
apply (rule ext) |
|
1040 |
apply (rule set_eqI, rule iffI) |
|
1041 |
unfolding cpfd2sfds_def proc_file_fds_def |
|
1042 |
apply (erule CollectE| erule bexE| erule conjE| erule exE| rule conjI)+ |
|
1043 |
apply (simp split:if_splits) |
|
1044 |
apply (frule_tac p' = p and fd' = fd in cfd2sfd_other, simp+) |
|
1045 |
apply (rule_tac x = fd in bexI, simp+) |
|
1046 |
apply (simp add:cpfd2sfds_def proc_file_fds_def) |
|
1047 |
apply (frule_tac p' = x and fd' = fd in cfd2sfd_other, simp+) |
|
1048 |
apply (rule_tac x = fd in exI, simp) |
|
1049 |
apply (simp split:if_splits) |
|
1050 |
apply (erule CollectE| erule bexE| erule conjE| erule exE| rule conjI)+ |
|
1051 |
apply (rule_tac x = fd in exI, simp) |
|
1052 |
apply (frule_tac p' = x and fd' = fd in cfd2sfd_other, simp+) |
|
1053 |
apply (simp add:cpfd2sfds_def proc_file_fds_def) |
|
1054 |
apply (erule CollectE| erule bexE| erule conjE| erule exE| rule conjI)+ |
|
1055 |
apply (rule_tac x = fd in exI, simp) |
|
1056 |
apply (frule_tac p' = x and fd' = fd in cfd2sfd_other, simp+) |
|
1057 |
done |
|
1058 |
||
1059 |
lemma cpfd2sfds_clone: |
|
1060 |
"valid (Clone p p' fds shms # s) |
|
1061 |
\<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})" |
|
1062 |
apply (frule vd_cons, frule vt_grant_os) |
|
1063 |
apply (rule ext) |
|
1064 |
apply (rule set_eqI, rule iffI) |
|
1065 |
unfolding cpfd2sfds_def proc_file_fds_def |
|
1066 |
apply (erule CollectE| erule bexE| erule conjE| erule exE| rule conjI)+ |
|
1067 |
apply (simp split:if_splits) |
|
1068 |
apply (frule_tac p'' = p' and fd' = fd in cfd2sfd_clone, simp+) |
|
1069 |
apply (rule_tac x = fd in bexI, simp+) |
|
1070 |
apply (simp add:cpfd2sfds_def proc_file_fds_def) |
|
1071 |
apply (frule_tac p'' = x and fd' = fd in cfd2sfd_clone, simp+) |
|
1072 |
apply (rule_tac x = fd in exI, simp) |
|
1073 |
apply (simp split:if_splits) |
|
1074 |
apply (erule CollectE| erule bexE| erule conjE| erule exE| rule conjI)+ |
|
1075 |
apply (rule_tac x = fd in exI, simp) |
|
1076 |
apply (frule_tac p'' = p' and fd' = fd in cfd2sfd_clone, simp+) |
|
1077 |
apply (simp add:cpfd2sfds_def proc_file_fds_def) |
|
1078 |
apply (erule CollectE| erule bexE| erule conjE| erule exE| rule conjI)+ |
|
1079 |
apply (rule_tac x = fd in exI, simp) |
|
1080 |
apply (frule_tac p'' = x and fd' = fd in cfd2sfd_clone, simp+) |
|
1081 |
done |
|
12 | 1082 |
|
1083 |
lemma cpfd2sfds_other: |
|
1084 |
"\<lbrakk>valid (e # s); |
|
13 | 1085 |
\<forall> p f flags fd opt. e \<noteq> Open p f flags fd opt; |
1086 |
\<forall> p f fds. e \<noteq> Execve p f fds; |
|
1087 |
\<forall> p p'. e \<noteq> Kill p p'; |
|
1088 |
\<forall> p. e \<noteq> Exit p; |
|
1089 |
\<forall> p fd. e \<noteq> CloseFd p fd; |
|
1090 |
\<forall> p p' fds shms. e \<noteq> Clone p p' fds shms\<rbrakk> \<Longrightarrow> cpfd2sfds (e # s) = cpfd2sfds s" |
|
1091 |
apply (frule vd_cons, frule vt_grant_os) |
|
1092 |
apply (rule ext) |
|
1093 |
unfolding cpfd2sfds_def proc_file_fds_def |
|
1094 |
apply (case_tac e) |
|
1095 |
using cfd2sfd_other |
|
1096 |
by auto |
|
1097 |
||
1098 |
lemma cpfd2sfds_kill: |
|
1099 |
"valid (Kill p p' # s) \<Longrightarrow> cpfd2sfds (Kill p p' # s) = (cpfd2sfds s) (p' := {})" |
|
1100 |
apply (frule vd_cons, frule vt_grant_os) |
|
1101 |
apply (rule ext, rule set_eqI) |
|
1102 |
unfolding cpfd2sfds_def proc_file_fds_def |
|
1103 |
apply (rule iffI) |
|
1104 |
apply (erule CollectE| erule bexE| erule conjE| erule exE| rule conjI)+ |
|
1105 |
apply (simp split:if_splits add: cpfd2sfds_def proc_file_fds_def) |
|
1106 |
apply (rule_tac x = fd in exI, simp) |
|
1107 |
apply (drule_tac p' = x and fd' = fd in cfd2sfd_other, simp+) |
|
1108 |
apply (simp split:if_splits add: cpfd2sfds_def proc_file_fds_def) |
|
1109 |
apply (erule CollectE| erule bexE| erule conjE| erule exE| rule conjI)+ |
|
1110 |
apply (rule_tac x = fd in exI, simp) |
|
1111 |
apply (drule_tac p' = x and fd' = fd in cfd2sfd_other, simp+) |
|
1112 |
done |
|
1113 |
||
1114 |
lemma cpfd2sfds_exit: |
|
1115 |
"valid (Exit p # s) \<Longrightarrow> cpfd2sfds (Exit p # s) = (cpfd2sfds s) (p := {})" |
|
1116 |
apply (frule vd_cons, frule vt_grant_os) |
|
1117 |
apply (rule ext, rule set_eqI) |
|
1118 |
unfolding cpfd2sfds_def proc_file_fds_def |
|
1119 |
apply (rule iffI) |
|
1120 |
apply (erule CollectE| erule bexE| erule conjE| erule exE| rule conjI)+ |
|
1121 |
apply (simp split:if_splits add: cpfd2sfds_def proc_file_fds_def) |
|
1122 |
apply (rule_tac x = fd in exI, simp) |
|
1123 |
apply (drule_tac p' = x and fd' = fd in cfd2sfd_other, simp+) |
|
1124 |
apply (simp split:if_splits add: cpfd2sfds_def proc_file_fds_def) |
|
1125 |
apply (erule CollectE| erule bexE| erule conjE| erule exE| rule conjI)+ |
|
1126 |
apply (rule_tac x = fd in exI, simp) |
|
1127 |
apply (drule_tac p' = x and fd' = fd in cfd2sfd_other, simp+) |
|
1128 |
done |
|
1129 |
||
1130 |
lemma cpfd2sfds_closefd: |
|
1131 |
"valid (CloseFd p fd # s) \<Longrightarrow> cpfd2sfds (CloseFd p fd # s) = (cpfd2sfds s) (p := |
|
1132 |
if (fd \<in> proc_file_fds s p) |
|
1133 |
then (case (cfd2sfd s p fd) of |
|
1134 |
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) |
|
1135 |
then cpfd2sfds s p else cpfd2sfds s p - {sfd}) |
|
1136 |
| _ \<Rightarrow> cpfd2sfds s p) |
|
1137 |
else cpfd2sfds s p)" |
|
1138 |
apply (frule vd_cons) |
|
1139 |
apply (rule ext, rule set_eqI, rule iffI) |
|
1140 |
unfolding cpfd2sfds_def proc_file_fds_def |
|
1141 |
apply (erule CollectE| erule bexE| erule conjE| erule exE| rule conjI)+ |
|
1142 |
apply (simp split:if_splits) |
|
1143 |
apply (rule conjI, rule impI, rule conjI, rule impI, erule exE) |
|
1144 |
apply (frule_tac p = p and fd = fd in current_filefd_has_sfd, simp) |
|
1145 |
apply (erule exE, simp) |
|
1146 |
apply (rule conjI, rule impI, (erule exE|erule conjE)+) |
|
1147 |
apply (rule_tac x = fda in exI, simp, simp add:cfd2sfd_closefd) |
|
1148 |
||
1149 |
apply (rule impI, rule conjI) |
|
1150 |
apply (rule_tac x = fda in exI, simp, simp add:cfd2sfd_closefd) |
|
1151 |
apply (rule notI, simp) |
|
1152 |
apply (erule_tac x = fda in allE, simp add:cfd2sfd_closefd) |
|
1153 |
||
1154 |
apply (rule impI, simp add:cpfd2sfds_def proc_file_fds_def) |
|
1155 |
apply (erule exE, rule_tac x = fda in exI, simp add:cfd2sfd_closefd) |
|
1156 |
||
1157 |
apply (rule impI| rule conjI)+ |
|
1158 |
apply (rule_tac x = fda in exI, simp add:cfd2sfd_closefd) |
|
1159 |
||
1160 |
apply (rule impI, simp add:cpfd2sfds_def proc_file_fds_def) |
|
1161 |
apply (rule_tac x = fda in exI, simp add:cfd2sfd_closefd) |
|
12 | 1162 |
|
13 | 1163 |
apply (simp split:if_splits) |
1164 |
apply (frule_tac p = p and fd = fd in current_filefd_has_sfd, simp) |
|
1165 |
apply (erule exE, simp) |
|
1166 |
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") |
|
1167 |
apply simp |
|
1168 |
apply (case_tac "xa = sfd") |
|
1169 |
apply (erule exE|erule conjE)+ |
|
1170 |
apply (rule_tac x = fd' in exI, simp add:cfd2sfd_closefd) |
|
1171 |
apply (erule exE|erule conjE)+ |
|
1172 |
apply (rule_tac x = fda in exI, simp add:cfd2sfd_closefd) |
|
1173 |
apply (rule notI, simp) |
|
1174 |
apply (simp, (erule exE|erule conjE)+) |
|
1175 |
apply (rule_tac x = fda in exI, simp add:cfd2sfd_closefd) |
|
1176 |
apply (rule notI, simp) |
|
1177 |
apply (erule exE|erule conjE)+ |
|
1178 |
apply (rule_tac x = fda in exI, simp add:cfd2sfd_closefd) |
|
1179 |
apply (rule notI, simp) |
|
1180 |
apply (simp add:cpfd2sfds_def proc_file_fds_def) |
|
1181 |
apply (erule exE|erule conjE)+ |
|
1182 |
apply (rule_tac x = fda in exI, simp add:cfd2sfd_closefd) |
|
1183 |
done |
|
1184 |
||
1185 |
lemmas cpfd2sfds_simps = cpfd2sfds_open cpfd2sfds_execve cpfd2sfds_clone cpfd2sfds_kill cpfd2sfds_exit |
|
1186 |
cpfd2sfds_closefd cpfd2sfds_other |
|
1187 |
||
1188 |
(********* ch2sshm simpset ********) |
|
1189 |
||
1190 |
lemma ch2sshm_createshm: |
|
1191 |
"valid (CreateShM p h # s) |
|
1192 |
\<Longrightarrow> ch2sshm (CreateShM p h # s) = (ch2sshm s) (h := |
|
1193 |
(case (sectxt_of_obj (CreateShM p h # s) (O_shm h)) of |
|
1194 |
Some sec \<Rightarrow> |
|
1195 |
Some (if (\<not> deleted (O_shm h) s \<and> h \<in> init_shms) then Init h else Created, sec) |
|
1196 |
| _ \<Rightarrow> None))" |
|
1197 |
apply (frule vd_cons, frule vt_grant_os) |
|
1198 |
apply (auto simp:ch2sshm_def sectxt_of_obj_simps dest!:current_has_sec' split:option.splits if_splits) |
|
1199 |
done |
|
1200 |
||
1201 |
lemma ch2sshm_other: |
|
1202 |
"\<lbrakk>valid (e # s); |
|
1203 |
\<forall> p h. e \<noteq> CreateShM p h; |
|
1204 |
h' \<in> current_shms (e # s)\<rbrakk> \<Longrightarrow> ch2sshm (e # s) h' = ch2sshm s h'" |
|
1205 |
apply (frule vd_cons, frule vt_grant_os) |
|
1206 |
apply (case_tac e) |
|
1207 |
apply (auto simp:ch2sshm_def sectxt_of_obj_simps dest!:current_has_sec' split:option.splits if_splits) |
|
1208 |
done |
|
1209 |
||
1210 |
lemmas ch2sshm_simps = ch2sshm_createshm ch2sshm_other |
|
1211 |
||
1212 |
lemma current_shm_has_sh: |
|
1213 |
"\<lbrakk>h \<in> current_shms s; valid s\<rbrakk> \<Longrightarrow> \<exists> sh. ch2sshm s h = Some sh" |
|
1214 |
by (auto simp:ch2sshm_def split:option.splits dest!:current_has_sec') |
|
1215 |
||
1216 |
lemma current_shm_has_sh': |
|
1217 |
"\<lbrakk>ch2sshm s h = None; valid s\<rbrakk> \<Longrightarrow> h \<notin> current_shms s" |
|
1218 |
by (auto dest:current_shm_has_sh) |
|
1219 |
||
1220 |
(********** cph2spshs simpset **********) |
|
1221 |
||
14 | 1222 |
lemma cph2spshs_attach: |
13 | 1223 |
"valid (Attach p h flag # s) \<Longrightarrow> |
1224 |
cph2spshs (Attach p h flag # s) = (cph2spshs s) (p := |
|
1225 |
(case (ch2sshm s h) of |
|
1226 |
Some sh \<Rightarrow> cph2spshs s p \<union> {(sh, flag)} |
|
1227 |
| _ \<Rightarrow> cph2spshs s p) )" |
|
1228 |
apply (frule vd_cons, frule vt_grant_os, rule ext) |
|
1229 |
using ch2sshm_other[where e = "Attach p h flag" and s = s] |
|
1230 |
apply (auto split del:t_open_must_flag.splits t_open_option_flag.splits split add:if_splits option.splits |
|
14 | 1231 |
dest!:current_shm_has_sh' dest: procs_of_shm_prop1 simp:cph2spshs_def) |
1232 |
apply (erule_tac x = ha in allE, frule procs_of_shm_prop1, simp, simp) |
|
1233 |
apply (erule_tac x = ha in allE, frule procs_of_shm_prop1, simp, simp) |
|
1234 |
apply (erule_tac x = ha in allE, frule procs_of_shm_prop1, simp, simp) |
|
1235 |
apply (erule_tac x = ha in allE, frule procs_of_shm_prop1, simp, simp) |
|
1236 |
apply (erule_tac x = ha in allE, frule procs_of_shm_prop1, simp, simp) |
|
1237 |
apply (case_tac "ha = h", simp, frule procs_of_shm_prop1, simp) |
|
1238 |
apply (rule_tac x = ha in exI, simp) |
|
1239 |
apply (rule_tac x = ha in exI, simp, drule procs_of_shm_prop1, simp, simp) |
|
1240 |
apply (rule_tac x = ha in exI, simp) |
|
1241 |
apply (frule procs_of_shm_prop1, simp, simp) |
|
1242 |
apply (rule impI, simp) |
|
1243 |
done |
|
1244 |
||
1245 |
lemma cph2spshs_detach: "valid (Detach p h # s) \<Longrightarrow> |
|
1246 |
cph2spshs (Detach p h # s) = (cph2spshs s) (p := |
|
15 | 1247 |
(case (ch2sshm s h, flag_of_proc_shm s p h) of |
1248 |
(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) |
|
1249 |
then cph2spshs s p else cph2spshs s p - {(sh, flag)} |
|
14 | 1250 |
| _ \<Rightarrow> cph2spshs s p) )" |
1251 |
apply (frule vd_cons, frule vt_grant_os, rule ext) |
|
15 | 1252 |
apply (case_tac "x = p") defer |
1253 |
using ch2sshm_other[where e = "Detach p h" and s = s] |
|
14 | 1254 |
apply (auto split del:t_open_must_flag.splits t_open_option_flag.splits split add:if_splits option.splits |
15 | 1255 |
dest!:current_shm_has_sh' procs_of_shm_prop4' dest:procs_of_shm_prop1 procs_of_shm_prop3 simp:cph2spshs_def) [1] |
1256 |
apply (rule_tac x = ha in exI, frule_tac h = ha in procs_of_shm_prop1, simp, simp) |
|
14 | 1257 |
apply (rule_tac x = ha in exI, frule_tac h = ha in procs_of_shm_prop1, simp, simp) |
1258 |
apply (rule impI, simp) |
|
15 | 1259 |
|
1260 |
apply (clarsimp) |
|
1261 |
apply (frule current_shm_has_sh, simp, erule exE) |
|
1262 |
apply (frule procs_of_shm_prop4, simp, simp) |
|
1263 |
apply (rule allI | rule conjI| erule conjE | erule exE | rule impI)+ |
|
1264 |
||
1265 |
apply (simp only:cph2spshs_def, rule set_eqI, rule iffI) |
|
1266 |
apply (erule CollectE | erule exE| erule conjE| rule CollectI)+ |
|
1267 |
apply (case_tac "ha = h", simp) |
|
1268 |
apply (rule_tac x = sha in exI, rule_tac x = flaga in exI, rule_tac x = ha in exI, simp) |
|
1269 |
using ch2sshm_other[where e = "Detach p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
1270 |
||
1271 |
apply (erule CollectE | erule exE| erule conjE| rule CollectI)+ |
|
1272 |
apply (case_tac "ha = h", simp) |
|
1273 |
apply (rule_tac x = h' in exI, simp) |
|
1274 |
apply (frule_tac flag = flag and flag' = flaga in procs_of_shm_prop3, simp+) |
|
1275 |
apply (frule_tac flag = flaga in procs_of_shm_prop4, simp+) |
|
1276 |
using ch2sshm_other[where e = "Detach p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
1277 |
apply (frule_tac h = h' in procs_of_shm_prop1, simp, simp) |
|
1278 |
apply (rule_tac x = ha in exI, simp, frule_tac h = ha in procs_of_shm_prop1, simp+) |
|
1279 |
using ch2sshm_other[where e = "Detach p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
1280 |
||
1281 |
apply (rule allI | rule conjI| erule conjE | erule exE | rule impI)+ |
|
1282 |
apply (simp only:cph2spshs_def, rule set_eqI, rule iffI) |
|
1283 |
apply (erule CollectE | erule exE| erule conjE| rule DiffI |rule CollectI)+ |
|
1284 |
apply (simp split:if_splits) |
|
1285 |
apply (rule_tac x = ha in exI, simp, frule_tac h = ha in procs_of_shm_prop1, simp+) |
|
1286 |
using ch2sshm_other[where e = "Detach p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
1287 |
apply (rule notI, simp split:if_splits) |
|
1288 |
apply (erule_tac x = ha in allE, simp, frule_tac h = ha in procs_of_shm_prop1, simp+) |
|
1289 |
using ch2sshm_other[where e = "Detach p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
1290 |
apply (erule CollectE | erule exE| erule conjE| erule DiffE |rule CollectI)+ |
|
1291 |
apply (simp split:if_splits) |
|
1292 |
apply (erule_tac x = ha in allE, simp, rule_tac x = ha in exI, simp) |
|
1293 |
apply (case_tac "ha = h", simp add:procs_of_shm_prop3, frule_tac h = ha in procs_of_shm_prop1, simp+) |
|
1294 |
using ch2sshm_other[where e = "Detach p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
14 | 1295 |
done |
13 | 1296 |
|
16 | 1297 |
lemma cph2spshs_deleteshm: |
1298 |
"valid (DeleteShM p h # s) \<Longrightarrow> |
|
1299 |
cph2spshs (DeleteShM p h # s) = (\<lambda> p'. |
|
1300 |
(case (ch2sshm s h, flag_of_proc_shm s p' h) of |
|
1301 |
(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) |
|
1302 |
then cph2spshs s p' else cph2spshs s p' - {(sh, flag)} |
|
1303 |
| _ \<Rightarrow> cph2spshs s p') )" |
|
1304 |
apply (frule vd_cons, frule vt_grant_os, rule ext) |
|
15 | 1305 |
|
16 | 1306 |
apply (clarsimp) |
1307 |
apply (frule current_shm_has_sh, simp, erule exE, simp, simp split:option.splits) |
|
1308 |
apply (rule conjI, rule impI) |
|
1309 |
using ch2sshm_other[where e = "DeleteShM p h" and s = s] |
|
1310 |
apply (auto split del:t_open_must_flag.splits t_open_option_flag.splits split add:if_splits option.splits |
|
1311 |
dest!:current_shm_has_sh' procs_of_shm_prop4' dest:procs_of_shm_prop1 procs_of_shm_prop3 simp:cph2spshs_def) [1] |
|
1312 |
apply (rule_tac x = ha in exI, frule_tac h = ha in procs_of_shm_prop1, simp+) |
|
1313 |
apply (rule_tac x = ha in exI, simp) |
|
1314 |
apply (case_tac "ha = h", simp+, frule_tac h = ha in procs_of_shm_prop1, simp+) |
|
1315 |
||
1316 |
apply (rule allI | rule conjI| erule conjE | erule exE | rule impI)+ |
|
1317 |
||
1318 |
apply (simp only:cph2spshs_def, rule set_eqI, rule iffI) |
|
1319 |
apply (erule CollectE | erule exE| erule conjE| rule CollectI)+ |
|
1320 |
apply (case_tac "ha = h", simp) |
|
1321 |
apply (rule_tac x = sha in exI, rule_tac x = flag in exI, rule_tac x = ha in exI, simp) |
|
1322 |
using ch2sshm_other[where e = "DeleteShM p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
1323 |
||
1324 |
apply (erule CollectE | erule exE| erule conjE| rule CollectI)+ |
|
1325 |
apply (case_tac "ha = h", simp) |
|
1326 |
apply (rule_tac x = h' in exI, simp) |
|
1327 |
apply (frule_tac flag = flag in procs_of_shm_prop4, simp+) |
|
1328 |
using ch2sshm_other[where e = "DeleteShM p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
1329 |
apply (frule_tac h = h' in procs_of_shm_prop1, simp, simp) |
|
1330 |
apply (rule_tac x = ha in exI, simp, frule_tac h = ha in procs_of_shm_prop1, simp+) |
|
1331 |
using ch2sshm_other[where e = "DeleteShM p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
1332 |
||
1333 |
apply (rule allI | rule conjI| erule conjE | erule exE | rule impI)+ |
|
1334 |
apply (simp only:cph2spshs_def, rule set_eqI, rule iffI) |
|
1335 |
apply (erule CollectE | erule exE| erule conjE| rule DiffI |rule CollectI)+ |
|
1336 |
apply (simp split:if_splits) |
|
1337 |
apply (rule_tac x = ha in exI, simp, frule_tac h = ha in procs_of_shm_prop1, simp+) |
|
1338 |
using ch2sshm_other[where e = "DeleteShM p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
1339 |
apply (rule notI, simp split:if_splits) |
|
1340 |
apply (erule_tac x = ha in allE, simp, frule_tac h = ha in procs_of_shm_prop1, simp+) |
|
1341 |
using ch2sshm_other[where e = "DeleteShM p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
1342 |
apply (erule CollectE | erule exE| erule conjE| erule DiffE |rule CollectI)+ |
|
1343 |
apply (simp split:if_splits) |
|
1344 |
apply (erule_tac x = ha in allE, simp, rule_tac x = ha in exI, simp) |
|
1345 |
apply (case_tac "ha = h", simp add:procs_of_shm_prop4) |
|
1346 |
apply (frule_tac h = ha in procs_of_shm_prop1, simp+) |
|
1347 |
using ch2sshm_other[where e = "DeleteShM p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
1348 |
done |
|
1349 |
||
1350 |
lemma flag_of_proc_shm_prop1: |
|
1351 |
"\<lbrakk>flag_of_proc_shm s p h = Some flag; valid s\<rbrakk> \<Longrightarrow> (p, flag) \<in> procs_of_shm s h" |
|
1352 |
apply (induct s arbitrary:p) |
|
1353 |
apply (simp add:init_shmflag_has_proc) |
|
1354 |
apply (frule vt_grant_os, frule vd_cons, case_tac a, auto split:if_splits option.splits) |
|
1355 |
done |
|
1356 |
||
1357 |
lemma cph2spshs_clone: |
|
1358 |
"valid (Clone p p' fds shms # s) \<Longrightarrow> |
|
1359 |
cph2spshs (Clone p p' fds shms # s) = (cph2spshs s) (p' := |
|
1360 |
{(sh, flag) | h sh flag. h \<in> shms \<and> ch2sshm s h = Some sh \<and> flag_of_proc_shm s p h = Some flag} )" |
|
1361 |
apply (frule vd_cons, frule vt_grant_os, rule ext) |
|
1362 |
using ch2sshm_other[where e = "Clone p p' fds shms" 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 (erule_tac x = h in allE, frule procs_of_shm_prop1, simp, simp add:procs_of_shm_prop4) |
|
1366 |
apply (rule_tac x = h in exI, simp, frule flag_of_proc_shm_prop1, simp+, simp add:procs_of_shm_prop1) |
|
1367 |
apply (rule_tac x = h in exI, simp, frule procs_of_shm_prop1, simp+)+ |
|
1368 |
done |
|
1369 |
||
1370 |
lemma cph2spshs_execve: |
|
1371 |
"valid (Execve p f fds # s) \<Longrightarrow> |
|
1372 |
cph2spshs (Execve p f fds # s) = (cph2spshs s) (p := {})" |
|
1373 |
apply (frule vd_cons, frule vt_grant_os, rule ext) |
|
1374 |
using ch2sshm_other[where e = "Execve p f fds" and s = s] |
|
1375 |
apply (auto split del:t_open_must_flag.splits t_open_option_flag.splits split add:if_splits option.splits |
|
1376 |
dest!:current_shm_has_sh' dest: procs_of_shm_prop1 procs_of_shm_prop2 procs_of_shm_prop3 simp:cph2spshs_def) |
|
1377 |
apply (rule_tac x = h in exI, simp add:procs_of_shm_prop1)+ |
|
1378 |
done |
|
1379 |
||
1380 |
lemma cph2spshs_kill: |
|
1381 |
"valid (Kill p p' # s) \<Longrightarrow> cph2spshs (Kill p p' # s) = (cph2spshs s) (p' := {})" |
|
1382 |
apply (frule vd_cons, frule vt_grant_os, rule ext) |
|
1383 |
using ch2sshm_other[where e = "Kill p p'" and s = s] |
|
1384 |
apply (auto split del:t_open_must_flag.splits t_open_option_flag.splits split add:if_splits option.splits |
|
1385 |
dest!:current_shm_has_sh' dest: procs_of_shm_prop1 procs_of_shm_prop2 procs_of_shm_prop3 simp:cph2spshs_def) |
|
1386 |
apply (rule_tac x = h in exI, simp add:procs_of_shm_prop1)+ |
|
1387 |
done |
|
1388 |
||
1389 |
lemma cph2spshs_exit: |
|
1390 |
"valid (Exit p # s) \<Longrightarrow> cph2spshs (Exit p # s) = (cph2spshs s) (p := {})" |
|
1391 |
apply (frule vd_cons, frule vt_grant_os, rule ext) |
|
1392 |
using ch2sshm_other[where e = "Exit p" and s = s] |
|
1393 |
apply (auto split del:t_open_must_flag.splits t_open_option_flag.splits split add:if_splits option.splits |
|
1394 |
dest!:current_shm_has_sh' dest: procs_of_shm_prop1 procs_of_shm_prop2 procs_of_shm_prop3 simp:cph2spshs_def) |
|
1395 |
apply (rule_tac x = h in exI, simp add:procs_of_shm_prop1)+ |
|
1396 |
done |
|
1397 |
||
1398 |
lemma cph2spshs_createshm: |
|
1399 |
"valid (CreateShM p h # s) \<Longrightarrow> cph2spshs (CreateShM p h # s) = cph2spshs s" |
|
1400 |
apply (frule vt_grant_os, frule vd_cons, rule ext) |
|
1401 |
apply (auto simp:cph2spshs_def) |
|
1402 |
using ch2sshm_createshm |
|
1403 |
apply (auto split del:t_open_must_flag.splits t_open_option_flag.splits split add:if_splits option.splits |
|
1404 |
dest!:current_shm_has_sh' dest: procs_of_shm_prop1 procs_of_shm_prop2 procs_of_shm_prop3 simp:cph2spshs_def) |
|
1405 |
apply (rule_tac x = ha in exI, auto simp:procs_of_shm_prop1) |
|
1406 |
done |
|
15 | 1407 |
|
13 | 1408 |
lemma cph2spshs_other: |
16 | 1409 |
"\<lbrakk>valid (e # s); |
1410 |
\<forall> p h flag. e \<noteq> Attach p h flag; |
|
1411 |
\<forall> p h. e \<noteq> Detach p h; |
|
1412 |
\<forall> p h. e \<noteq> DeleteShM p h; |
|
1413 |
\<forall> p p' fds shms. e \<noteq> Clone p p' fds shms; |
|
1414 |
\<forall> p f fds. e \<noteq> Execve p f fds; |
|
1415 |
\<forall> p p'. e \<noteq> Kill p p'; |
|
1416 |
\<forall> p. e \<noteq> Exit p\<rbrakk> \<Longrightarrow> cph2spshs (e # s) = cph2spshs s" |
|
1417 |
apply (frule vt_grant_os, frule vd_cons, rule ext) |
|
1418 |
unfolding cph2spshs_def |
|
1419 |
apply (rule set_eqI, rule iffI) |
|
1420 |
apply (erule CollectE | erule conjE| erule exE| rule conjI| rule impI| rule CollectI)+ |
|
1421 |
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) |
|
1422 |
apply (case_tac e) |
|
1423 |
using ch2sshm_other[where e = e and s = s] |
|
1424 |
apply (auto split del:t_open_must_flag.splits t_open_option_flag.splits split add:if_splits option.splits |
|
1425 |
dest!:current_shm_has_sh' dest: procs_of_shm_prop1 procs_of_shm_prop2 procs_of_shm_prop3 |
|
1426 |
simp:ch2sshm_createshm) |
|
1427 |
apply (rule_tac x = h in exI, case_tac e) |
|
1428 |
using ch2sshm_other[where e = e and s = s] |
|
1429 |
apply (auto split del:t_open_must_flag.splits t_open_option_flag.splits split add:if_splits option.splits |
|
1430 |
dest!:current_shm_has_sh' dest: procs_of_shm_prop1 procs_of_shm_prop2 procs_of_shm_prop3 |
|
1431 |
simp:ch2sshm_createshm) |
|
1432 |
done |
|
13 | 1433 |
|
16 | 1434 |
lemmas cph2spshs_simps = cph2spshs_attach cph2spshs_detach cph2spshs_deleteshm cph2spshs_clone cph2spshs_execve |
1435 |
cph2spshs_exit cph2spshs_kill cph2spshs_other |
|
1 | 1436 |
|
10 | 1437 |
(******** cp2sproc simpset *********) |
1 | 1438 |
|
17 | 1439 |
lemma cp2sproc_clone: |
1440 |
"valid (Clone p p' fds shms # s) \<Longrightarrow> cp2sproc (Clone p p' fds shms # s) = (cp2sproc s) (p' := |
|
1441 |
case (sectxt_of_obj s (O_proc p)) of |
|
1442 |
Some sec \<Rightarrow> Some (Created, sec, |
|
1443 |
{sfd. \<exists> fd \<in> fds. \<exists> f. file_of_proc_fd s p fd = Some f \<and> cfd2sfd s p fd = Some sfd}, |
|
1444 |
{(sh, flag) | h sh flag. h \<in> shms \<and> ch2sshm s h = Some sh \<and> flag_of_proc_shm s p h = Some flag}) |
|
1445 |
| _ \<Rightarrow> None)" |
|
1446 |
apply (frule cph2spshs_clone, frule cpfd2sfds_clone) |
|
1447 |
apply (frule vd_cons, frule vt_grant_os, simp only:os_grant.simps) |
|
1448 |
apply ((erule exE| erule conjE)+, frule not_init_intro_proc, simp, rule ext, case_tac "x = p'", simp) |
|
1449 |
apply (auto simp:cp2sproc_def sectxt_of_obj_simps dest!:current_has_sec' |
|
1450 |
dest:current_proc_has_sec split:option.splits if_splits) |
|
1451 |
done |
|
1452 |
||
1453 |
lemma cp2sproc_other: |
|
1454 |
"\<lbrakk>valid (e # s); |
|
1455 |
\<forall> p f flags fd opt. e \<noteq> Open p f flags fd opt; |
|
1456 |
\<forall> p fd. e \<noteq> CloseFd p fd; |
|
1457 |
\<forall> p h flag. e \<noteq> Attach p h flag; |
|
1458 |
\<forall> p h. e \<noteq> Detach p h; |
|
1459 |
\<forall> p h. e \<noteq> DeleteShM p h; |
|
1460 |
\<forall> p p' fds shms. e \<noteq> Clone p p' fds shms; |
|
1461 |
\<forall> p f fds. e \<noteq> Execve p f fds; |
|
1462 |
\<forall> p p'. e \<noteq> Kill p p'; |
|
1463 |
\<forall> p. e \<noteq> Exit p\<rbrakk> \<Longrightarrow> cp2sproc (e # s) = cp2sproc s" |
|
1464 |
apply (frule cph2spshs_other, simp+, frule cpfd2sfds_other, simp+) |
|
1465 |
apply (frule vt_grant_os, frule vd_cons, rule ext, case_tac e, simp_all) |
|
1466 |
apply (auto simp:cp2sproc_def sectxt_of_obj_simps dest!:current_has_sec' |
|
1467 |
dest:current_proc_has_sec not_deleted_init_proc split:option.splits if_splits) |
|
1468 |
done |
|
1 | 1469 |
|
17 | 1470 |
lemma cp2sproc_open: |
1471 |
"valid (Open p f flags fd opt # s) \<Longrightarrow> |
|
1472 |
cp2sproc (Open p f flags fd opt # s) = (cp2sproc s) (p := |
|
1473 |
case (sectxt_of_obj s (O_proc p), sectxt_of_obj (Open p f flags fd opt # s) (O_fd p fd), |
|
1474 |
cf2sfile (Open p f flags fd opt # s) f) of |
|
1475 |
(Some sec, Some fdsec, Some sf) \<Rightarrow> Some (if (\<not> deleted (O_proc p) s \<and> p \<in> init_procs) |
|
1476 |
then Init p else Created, sec, |
|
1477 |
(cpfd2sfds s p) \<union> {(fdsec, flags, sf)}, cph2spshs s p) |
|
1478 |
| _ \<Rightarrow> None)" |
|
1479 |
apply (frule cph2spshs_other, simp, simp, simp, simp, simp, simp, simp) |
|
1480 |
apply (frule cpfd2sfds_open, frule vt_grant_os, frule vd_cons, rule ext) |
|
1481 |
apply (case_tac "x = p") |
|
1482 |
apply (auto simp:cp2sproc_def sectxt_of_obj_simps current_files_simps |
|
1483 |
dest!:current_has_sec' dest!:current_file_has_sfile' dest:is_file_in_current is_dir_in_current |
|
1484 |
dest:current_proc_has_sec not_deleted_init_proc split:option.splits if_splits) |
|
1485 |
done |
|
1486 |
||
1487 |
lemma cp2sproc_closefd: |
|
1488 |
"valid (CloseFd p fd # s) \<Longrightarrow> |
|
1489 |
cp2sproc (CloseFd p fd # s) = (cp2sproc s) (p := |
|
1490 |
if (fd \<in> proc_file_fds s p) |
|
1491 |
then (case (cfd2sfd s p fd) of |
|
1492 |
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) |
|
1493 |
then cp2sproc s p |
|
1494 |
else (case (sectxt_of_obj s (O_proc p)) of |
|
1495 |
Some sec \<Rightarrow> Some (if (\<not> deleted (O_proc p) s \<and> p \<in> init_procs) |
|
1496 |
then Init p else Created, |
|
1497 |
sec, cpfd2sfds s p - {sfd}, cph2spshs s p) |
|
1498 |
| _ \<Rightarrow> None)) |
|
1499 |
| _ \<Rightarrow> cp2sproc s p) |
|
1500 |
else cp2sproc s p)" |
|
1501 |
apply (frule cpfd2sfds_closefd, frule cph2spshs_other, simp, simp, simp, simp, simp, simp, simp) |
|
1502 |
apply (frule vt_grant_os, frule vd_cons, rule ext) |
|
1503 |
apply (case_tac "x = p") |
|
1504 |
apply (auto simp:cp2sproc_def sectxt_of_obj_simps current_files_simps |
|
1505 |
dest!:current_has_sec' dest!:current_file_has_sfile' dest:is_file_in_current is_dir_in_current |
|
1506 |
dest:current_proc_has_sec not_deleted_init_proc split:option.splits if_splits) |
|
1507 |
done |
|
1 | 1508 |
|
17 | 1509 |
lemma cp2sproc_attach: |
1510 |
"valid (Attach p h flag # s) \<Longrightarrow> |
|
1511 |
cp2sproc (Attach p h flag # s) = (cp2sproc s) (p := |
|
1512 |
(case (ch2sshm s h) of |
|
1513 |
Some sh \<Rightarrow> (case (sectxt_of_obj s (O_proc p)) of |
|
1514 |
Some sec \<Rightarrow> Some (if (\<not> deleted (O_proc p) s \<and> p \<in> init_procs) |
|
1515 |
then Init p else Created, |
|
1516 |
sec, cpfd2sfds s p, cph2spshs s p \<union> {(sh, flag)}) |
|
1517 |
| _ \<Rightarrow> None) |
|
1518 |
| _ \<Rightarrow> cp2sproc s p) )" |
|
1519 |
apply (frule cph2spshs_attach, frule cpfd2sfds_other, simp, simp, simp, simp, simp, simp) |
|
1520 |
apply (frule vt_grant_os, frule vd_cons, rule ext) |
|
1521 |
apply (case_tac "x = p") |
|
1522 |
apply (auto simp:cp2sproc_def sectxt_of_obj_simps current_files_simps |
|
1523 |
dest!:current_has_sec' dest!:current_file_has_sfile' dest:is_file_in_current is_dir_in_current |
|
1524 |
dest:current_proc_has_sec not_deleted_init_proc split:option.splits if_splits) |
|
1525 |
done |
|
1526 |
||
1527 |
lemma cp2sproc_detach: |
|
1528 |
"valid (Detach p h # s) \<Longrightarrow> |
|
1529 |
cp2sproc (Detach p h # s) = (cp2sproc s) (p := |
|
1530 |
(case (ch2sshm s h, flag_of_proc_shm s p h) of |
|
1531 |
(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) |
|
1532 |
then cp2sproc s p |
|
1533 |
else (case (sectxt_of_obj s (O_proc p)) of |
|
1534 |
Some sec \<Rightarrow> Some (if (\<not> deleted (O_proc p) s \<and> p \<in> init_procs) |
|
1535 |
then Init p else Created, sec, |
|
1536 |
cpfd2sfds s p, cph2spshs s p - {(sh, flag)}) |
|
1537 |
| None \<Rightarrow> None) |
|
1538 |
| _ \<Rightarrow> cp2sproc s p) )" |
|
1539 |
apply (frule cph2spshs_detach, frule cpfd2sfds_other, simp, simp, simp, simp, simp, simp) |
|
1540 |
apply (frule vt_grant_os, frule vd_cons, rule ext) |
|
1541 |
apply (case_tac "x = p") |
|
1542 |
apply (auto simp:cp2sproc_def sectxt_of_obj_simps current_files_simps |
|
1543 |
dest!:current_has_sec' dest!:current_file_has_sfile' dest:is_file_in_current is_dir_in_current |
|
1544 |
dest:current_proc_has_sec not_deleted_init_proc split:option.splits if_splits) |
|
1545 |
done |
|
1 | 1546 |
|
17 | 1547 |
lemma cp2sproc_deleteshm: |
1548 |
"valid (DeleteShM p h # s) \<Longrightarrow> |
|
1549 |
cp2sproc (DeleteShM p h # s) = (\<lambda> p'. |
|
1550 |
(case (ch2sshm s h, flag_of_proc_shm s p' h) of |
|
1551 |
(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) |
|
1552 |
then cp2sproc s p' |
|
1553 |
else (case (sectxt_of_obj s (O_proc p')) of |
|
1554 |
Some sec \<Rightarrow> Some (if (\<not> deleted (O_proc p') s \<and> p' \<in> init_procs) |
|
1555 |
then Init p' else Created, sec, |
|
1556 |
cpfd2sfds s p', cph2spshs s p' - {(sh, flag)}) |
|
1557 |
| None \<Rightarrow> None) |
|
1558 |
| _ \<Rightarrow> cp2sproc s p') )" |
|
1559 |
apply (frule cph2spshs_deleteshm, frule cpfd2sfds_other, simp, simp, simp, simp, simp, simp) |
|
1560 |
apply (frule vt_grant_os, frule vd_cons, rule ext) |
|
1561 |
apply (auto simp:cp2sproc_def sectxt_of_obj_simps current_files_simps |
|
1562 |
dest!:current_has_sec' dest!:current_file_has_sfile' dest:is_file_in_current is_dir_in_current |
|
1563 |
dest:current_proc_has_sec not_deleted_init_proc split:option.splits if_splits) |
|
1564 |
done |
|
1565 |
||
1566 |
lemma cp2sproc_execve: |
|
1567 |
"valid (Execve p f fds # s) \<Longrightarrow> |
|
1568 |
cp2sproc (Execve p f fds # s) = (cp2sproc s) (p := |
|
1569 |
(case (sectxt_of_obj (Execve p f fds # s) (O_proc p)) of |
|
1570 |
Some sec \<Rightarrow> Some (if (\<not> deleted (O_proc p) s \<and> p \<in> init_procs) then Init p else Created, sec, |
|
1571 |
{sfd. \<exists> fd \<in> fds. \<exists> f. file_of_proc_fd s p fd = Some f \<and> cfd2sfd s p fd = Some sfd}, {}) |
|
1572 |
| _ \<Rightarrow> None) )" |
|
1573 |
apply (frule cph2spshs_execve, frule cpfd2sfds_execve) |
|
1574 |
apply (frule vt_grant_os, frule vd_cons, rule ext) |
|
1575 |
apply (auto simp:cp2sproc_def sectxt_of_obj_simps current_files_simps |
|
1576 |
dest!:current_has_sec' dest!:current_file_has_sfile' dest:is_file_in_current is_dir_in_current |
|
1577 |
dest:current_proc_has_sec not_deleted_init_proc split:option.splits if_splits) |
|
1578 |
done |
|
1 | 1579 |
|
17 | 1580 |
lemma cp2sproc_kill: |
1581 |
"\<lbrakk>valid (Kill p p' # s); p'' \<noteq> p'\<rbrakk> \<Longrightarrow> |
|
1582 |
cp2sproc (Kill p p' # s) p'' = (cp2sproc s) p''" |
|
1583 |
apply (frule cph2spshs_kill, frule cpfd2sfds_kill) |
|
1584 |
apply (frule vt_grant_os, frule vd_cons) |
|
1585 |
apply (auto simp:cp2sproc_def sectxt_of_obj_simps current_files_simps |
|
1586 |
dest!:current_has_sec' dest!:current_file_has_sfile' dest:is_file_in_current is_dir_in_current |
|
1587 |
dest:current_proc_has_sec not_deleted_init_proc split:option.splits if_splits) |
|
1588 |
done |
|
1589 |
||
1590 |
lemma cp2sproc_kill': |
|
1591 |
"\<lbrakk>valid (Kill p p' # s); p'' \<in> current_procs (Kill p p' # s)\<rbrakk> \<Longrightarrow> |
|
1592 |
cp2sproc (Kill p p' # s) p'' = (cp2sproc s) p''" |
|
1593 |
by (drule_tac p'' = p'' in cp2sproc_kill, simp+) |
|
1594 |
||
1595 |
lemma cp2sproc_exit: |
|
1596 |
"\<lbrakk>valid (Exit p # s); p' \<noteq> p\<rbrakk> \<Longrightarrow> |
|
1597 |
cp2sproc (Exit p # s) p' = (cp2sproc s) p'" |
|
1598 |
apply (frule cph2spshs_exit, frule cpfd2sfds_exit) |
|
1599 |
apply (frule vt_grant_os, frule vd_cons) |
|
1600 |
apply (auto simp:cp2sproc_def sectxt_of_obj_simps current_files_simps |
|
1601 |
dest!:current_has_sec' dest!:current_file_has_sfile' dest:is_file_in_current is_dir_in_current |
|
1602 |
dest:current_proc_has_sec not_deleted_init_proc split:option.splits if_splits) |
|
1603 |
done |
|
1604 |
||
1605 |
lemma cp2sproc_exit': |
|
1606 |
"\<lbrakk>valid (Exit p # s); p' \<in> current_procs (Exit p # s)\<rbrakk> \<Longrightarrow> |
|
1607 |
cp2sproc (Exit p # s) p' = (cp2sproc s) p'" |
|
1608 |
by (drule_tac p'= p' in cp2sproc_exit, simp+) |
|
1609 |
||
1610 |
lemmas cp2sproc_simps = cp2sproc_open cp2sproc_closefd cp2sproc_attach cp2sproc_detach cp2sproc_deleteshm |
|
1611 |
cp2sproc_clone cp2sproc_execve cp2sproc_kill cp2sproc_exit cp2sproc_other |
|
1 | 1612 |
|
40 | 1613 |
lemma current_proc_has_sp: |
1614 |
"\<lbrakk>p \<in> current_procs s; valid s\<rbrakk> \<Longrightarrow> \<exists> sp. cp2sproc s p = Some sp" |
|
1615 |
by (auto simp:cp2sproc_def split:option.splits dest!:current_has_sec') |
|
1616 |
||
1617 |
lemma current_proc_has_sp': |
|
1618 |
"\<lbrakk>cp2sproc s p = None; valid s\<rbrakk> \<Longrightarrow> p \<notin> current_procs s" |
|
1619 |
by (auto dest:current_proc_has_sp) |
|
1620 |
||
1621 |
||
1622 |
||
1623 |
(* simpset for cf2sfiles *) |
|
1624 |
||
1625 |
lemma cf2sfiles_open: |
|
1626 |
"\<lbrakk>valid (Open p f flag fd opt # s); f' \<in> current_files (Open p f flag fd opt # s)\<rbrakk> |
|
1627 |
\<Longrightarrow> cf2sfiles (Open p f flag fd opt # s) f' = ( |
|
1628 |
if (f' = f \<and> opt \<noteq> None) |
|
1629 |
then (case cf2sfile (Open p f flag fd opt # s) f of |
|
1630 |
Some sf \<Rightarrow> {sf} |
|
1631 |
| _ \<Rightarrow> {} ) |
|
1632 |
else cf2sfiles s f')" |
|
1633 |
apply (frule vt_grant_os, frule vd_cons) |
|
1634 |
apply (auto simp:cf2sfiles_def cf2sfile_open_none cf2sfile_simps same_inode_files_open |
|
1635 |
split:if_splits option.splits dest!:current_file_has_sfile' dest:cf2sfile_open) |
|
1636 |
apply (rule_tac x = "f'a" in bexI, drule same_inode_files_prop1, simp add:cf2sfile_open_some1, simp)+ |
|
1637 |
done |
|
1638 |
||
1639 |
lemma cf2sfiles_other: |
|
1640 |
"\<lbrakk>valid (e # s); |
|
1641 |
\<forall> p f flag fd opt. e \<noteq> Open p f flag fd opt; |
|
1642 |
\<forall> p fd. e \<noteq> CloseFd p fd; |
|
1643 |
\<forall> p f. e \<noteq> UnLink p f; |
|
1644 |
\<forall> p f f'. e \<noteq> LinkHard p f f'\<rbrakk> \<Longrightarrow> cf2sfiles (e # s) = cf2sfiles s" |
|
1645 |
apply (frule vt_grant_os, frule vd_cons, rule ext) |
|
1646 |
apply (simp add:cf2sfiles_def, rule set_eqI, rule iffI) |
|
1647 |
apply (drule Set.CollectD, erule bexE, rule CollectI) |
|
1648 |
apply (rule_tac x = f' in bexI, case_tac e) |
|
1649 |
apply (auto simp:cf2sfiles_def cf2sfile_simps same_inode_files_simps current_files_simps |
|
1650 |
split:if_splits option.splits dest!:current_file_has_sfile' dest:same_inode_files_prop1 cf2sfile_other') |
|
1651 |
apply (drule_tac f' = f' in cf2sfile_rmdir) |
|
1652 |
apply (simp add:current_files_simps same_inode_files_prop1 same_inode_files_prop3 dir_is_empty_def)+ |
|
1653 |
||
1654 |
apply (rule_tac x = f' in bexI, case_tac e) |
|
1655 |
apply (auto simp:cf2sfiles_def cf2sfile_simps same_inode_files_simps current_files_simps |
|
1656 |
split:if_splits option.splits dest!:current_file_has_sfile' dest:same_inode_files_prop1 cf2sfile_other') |
|
1657 |
apply (drule_tac f' = f' in cf2sfile_rmdir) |
|
1658 |
apply (simp add:current_files_simps same_inode_files_prop1 same_inode_files_prop3 dir_is_empty_def)+ |
|
1659 |
done |
|
1660 |
||
1661 |
lemma cf2sfile_linkhard1': |
|
1662 |
"\<lbrakk>valid (LinkHard p oldf f # s); f' \<in> same_inode_files s f''\<rbrakk> |
|
1663 |
\<Longrightarrow> cf2sfile (LinkHard p oldf f# s) f' = cf2sfile s f'" |
|
1664 |
apply (drule same_inode_files_prop1) |
|
1665 |
by (simp add:cf2sfile_linkhard1) |
|
1666 |
||
1667 |
lemma cf2sfiles_linkhard: |
|
1668 |
"valid (LinkHard p oldf f # s) \<Longrightarrow> cf2sfiles (LinkHard p oldf f # s) = (\<lambda> f'. |
|
1669 |
if (f' = f \<or> f' \<in> same_inode_files s oldf) |
|
1670 |
then (case (cf2sfile (LinkHard p oldf f # s) f) of |
|
1671 |
Some sf \<Rightarrow> cf2sfiles s oldf \<union> {sf} |
|
1672 |
| _ \<Rightarrow> {}) |
|
1673 |
else cf2sfiles s f')" |
|
1674 |
apply (frule vt_grant_os, frule vd_cons, rule ext) |
|
1675 |
apply (auto simp:cf2sfiles_def cf2sfile_linkhard1' same_inode_files_linkhard current_files_linkhard |
|
1676 |
split:if_splits option.splits dest!:current_file_has_sfile' current_has_sec' dest:same_inode_files_prop1) |
|
1677 |
done |
|
1678 |
||
1679 |
lemma cf2sfile_unlink': |
|
1680 |
"\<lbrakk>valid (UnLink p f # s); f' \<in> same_inode_files (UnLink p f # s) f''\<rbrakk> |
|
1681 |
\<Longrightarrow> cf2sfile (UnLink p f # s) f' = cf2sfile s f'" |
|
1682 |
apply (drule same_inode_files_prop1) |
|
1683 |
by (simp add:cf2sfile_unlink) |
|
1684 |
||
1685 |
lemma cf2sfiles_unlink: |
|
1686 |
"\<lbrakk>valid (UnLink p f # s); f' \<in> current_files (UnLink p f # s)\<rbrakk> \<Longrightarrow> cf2sfiles (UnLink p f # s) f' = ( |
|
1687 |
if (f' \<in> same_inode_files s f \<and> proc_fd_of_file s f = {} \<and> |
|
1688 |
(\<forall> f'' \<in> same_inode_files s f. f'' \<noteq> f \<longrightarrow> cf2sfile s f'' \<noteq> cf2sfile s f)) then |
|
1689 |
(case (cf2sfile s f) of |
|
1690 |
Some sf \<Rightarrow> cf2sfiles s f' - {sf} |
|
1691 |
| _ \<Rightarrow> {}) |
|
1692 |
else cf2sfiles s f')" |
|
1693 |
apply (frule vt_grant_os, frule vd_cons, simp add:current_files_simps split:if_splits) |
|
1694 |
apply (rule conjI, clarify, frule is_file_has_sfile', simp, erule exE, simp) |
|
1695 |
apply (simp add:cf2sfiles_def, rule set_eqI, rule iffI, drule CollectD) |
|
1696 |
apply (erule bexE, frule_tac f' = f' in same_inode_files_unlink) |
|
1697 |
apply (simp add:current_files_unlink, simp, erule conjE) |
|
1698 |
apply (erule_tac x = f'a in ballE, frule_tac f' = "f'a" in cf2sfile_unlink) |
|
1699 |
apply (simp add:current_files_unlink same_inode_files_prop1, simp) |
|
1700 |
apply (rule_tac x = f'a in bexI, simp, simp) |
|
1701 |
apply (drule_tac f = f and f' = f' and f'' = f'a in same_inode_files_prop4, simp+) |
|
1702 |
apply (erule conjE|erule exE|erule bexE)+ |
|
1703 |
apply (case_tac "f'a = f", simp) |
|
1704 |
apply (frule_tac f' = f' in same_inode_files_unlink, simp add:current_files_unlink) |
|
1705 |
apply (frule_tac f' = f'a in cf2sfile_unlink, simp add:current_files_unlink same_inode_files_prop1) |
|
1706 |
apply (rule_tac x = f'a in bexI, simp, simp) |
|
1707 |
||
1708 |
apply (rule impI)+ |
|
1709 |
apply (simp add:cf2sfiles_def, rule set_eqI, rule iffI, drule CollectD) |
|
1710 |
apply (erule bexE, frule_tac f' = f' in same_inode_files_unlink) |
|
1711 |
apply (simp add:current_files_unlink, simp, (erule conjE)+) |
|
1712 |
apply (rule_tac x = f'a in bexI, frule_tac f' = "f'a" in cf2sfile_unlink) |
|
1713 |
apply (simp add:current_files_unlink same_inode_files_prop1, simp, simp) |
|
1714 |
apply (drule CollectD, erule bexE, frule_tac f' = f' in same_inode_files_unlink) |
|
1715 |
apply (simp add:current_files_unlink, simp) |
|
1716 |
apply (case_tac "f'a = f", simp) |
|
1717 |
apply (frule_tac f = f' and f' = f in same_inode_files_prop5, simp) |
|
1718 |
apply (erule bexE, erule conjE) |
|
1719 |
apply (rule_tac x = f'' in bexI) |
|
1720 |
apply (drule_tac f' = f'' in cf2sfile_unlink, simp add:current_files_unlink same_inode_files_prop1) |
|
1721 |
apply (simp, simp, erule same_inode_files_prop4, simp) |
|
1722 |
apply (rule_tac x = f'a in bexI) |
|
1723 |
apply (drule_tac f' = f'a in cf2sfile_unlink, simp add:current_files_unlink same_inode_files_prop1) |
|
1724 |
apply (simp, simp) |
|
1725 |
||
1726 |
||
1727 |
apply (simp add:cf2sfiles_def, rule set_eqI, rule iffI, drule CollectD) |
|
1728 |
apply (erule bexE, frule_tac f' = f' in same_inode_files_unlink) |
|
1729 |
apply (simp add:current_files_unlink, simp) |
|
1730 |
apply (rule_tac x = f'a in bexI) |
|
1731 |
apply (frule_tac f' = f'a in cf2sfile_unlink) |
|
1732 |
apply (simp add:same_inode_files_prop1 current_files_unlink, simp, simp) |
|
1733 |
apply (drule CollectD, erule bexE, frule_tac f' = f' in same_inode_files_unlink) |
|
1734 |
apply (simp add:current_files_unlink, simp) |
|
1735 |
apply (rule_tac x = f'a in bexI) |
|
1736 |
apply (frule_tac f' = f'a in cf2sfile_unlink) |
|
1737 |
apply (simp add:same_inode_files_prop1 current_files_unlink, simp, simp) |
|
1738 |
done |
|
1739 |
||
1740 |
lemma cf2sfiles_closefd: |
|
1741 |
"\<lbrakk>valid (CloseFd p fd # s); f' \<in> current_files (CloseFd p fd # s)\<rbrakk> \<Longrightarrow> cf2sfiles (CloseFd p fd # s) f' = ( |
|
1742 |
case (file_of_proc_fd s p fd) of |
|
1743 |
Some f \<Rightarrow> if (f' \<in> same_inode_files s f \<and> proc_fd_of_file s f = {(p, fd)} \<and> f \<in> files_hung_by_del s \<and> |
|
1744 |
(\<forall> f'' \<in> same_inode_files s f. f'' \<noteq> f \<longrightarrow> cf2sfile s f'' \<noteq> cf2sfile s f)) |
|
1745 |
then (case (cf2sfile s f) of |
|
1746 |
Some sf \<Rightarrow> cf2sfiles s f' - {sf} |
|
1747 |
| _ \<Rightarrow> {}) |
|
1748 |
else cf2sfiles s f' |
|
1749 |
| _ \<Rightarrow> cf2sfiles s f')" |
|
1750 |
||
1751 |
apply (frule vt_grant_os, frule vd_cons, case_tac "file_of_proc_fd s p fd") |
|
1752 |
apply (simp_all add:current_files_simps split:if_splits) |
|
1753 |
||
1754 |
apply (simp add:cf2sfiles_def, rule set_eqI, rule iffI, drule CollectD) |
|
1755 |
apply (erule bexE, frule_tac f' = f' in same_inode_files_closefd) |
|
1756 |
apply (simp add:current_files_closefd, simp) |
|
1757 |
apply (rule_tac x = f'a in bexI) |
|
1758 |
apply (frule_tac f = f'a in cf2sfile_closefd) |
|
1759 |
apply (simp add:same_inode_files_prop1 current_files_closefd, simp, simp) |
|
1760 |
apply (drule CollectD, erule bexE, frule_tac f' = f' in same_inode_files_closefd) |
|
1761 |
apply (simp add:current_files_closefd, simp) |
|
1762 |
apply (rule_tac x = f'a in bexI) |
|
1763 |
apply (frule_tac f = f'a in cf2sfile_closefd) |
|
1764 |
apply (simp add:same_inode_files_prop1 current_files_closefd, simp, simp) |
|
1765 |
||
1766 |
apply (rule conjI, clarify, frule file_of_pfd_is_file, simp) |
|
1767 |
apply (frule is_file_has_sfile', simp, erule exE, simp) |
|
1768 |
apply (simp add:cf2sfiles_def, rule set_eqI, rule iffI, drule CollectD) |
|
1769 |
apply (erule bexE, frule_tac f' = f' in same_inode_files_closefd) |
|
1770 |
apply (simp add:current_files_closefd, simp, erule conjE) |
|
1771 |
apply (erule_tac x = f'a in ballE, frule_tac f = "f'a" in cf2sfile_closefd) |
|
1772 |
apply (simp add:current_files_closefd same_inode_files_prop1, simp) |
|
1773 |
apply (rule_tac x = f'a in bexI, simp, simp) |
|
1774 |
apply (drule_tac f = a and f' = f' and f'' = f'a in same_inode_files_prop4, simp+) |
|
1775 |
apply (erule conjE|erule exE|erule bexE)+ |
|
1776 |
apply (case_tac "f'a = a", simp) |
|
1777 |
apply (frule_tac f' = f' in same_inode_files_closefd, simp add:current_files_closefd, simp) |
|
1778 |
apply (frule_tac f = f'a in cf2sfile_closefd, simp add:current_files_closefd same_inode_files_prop1) |
|
1779 |
apply (rule_tac x = f'a in bexI, simp, simp) |
|
1780 |
||
1781 |
apply (rule impI)+ |
|
1782 |
apply (simp add:cf2sfiles_def, rule set_eqI, rule iffI, drule CollectD) |
|
1783 |
apply (erule bexE, frule_tac f' = f' in same_inode_files_closefd) |
|
1784 |
apply (simp add:current_files_closefd, simp, (erule conjE)+) |
|
1785 |
apply (rule_tac x = f'a in bexI, frule_tac f = f'a in cf2sfile_closefd) |
|
1786 |
apply (simp add:current_files_closefd same_inode_files_prop1, simp, simp) |
|
1787 |
apply (drule CollectD, erule bexE, frule_tac f' = f' in same_inode_files_closefd) |
|
1788 |
apply (simp add:current_files_closefd, simp) |
|
1789 |
apply (case_tac "f'a = a", simp) |
|
1790 |
apply (frule_tac f = f' and f' = a in same_inode_files_prop5, simp) |
|
1791 |
apply (erule bexE, erule conjE) |
|
1792 |
apply (rule_tac x = f'' in bexI) |
|
1793 |
apply (drule_tac f = f'' in cf2sfile_closefd, simp add:current_files_closefd same_inode_files_prop1) |
|
1794 |
apply (simp, simp, erule same_inode_files_prop4, simp) |
|
1795 |
apply (rule_tac x = f'a in bexI) |
|
1796 |
apply (drule_tac f = f'a in cf2sfile_closefd, simp add:current_files_closefd same_inode_files_prop1) |
|
1797 |
apply (simp, simp) |
|
1798 |
||
1799 |
apply (rule conjI, clarify) |
|
1800 |
||
1801 |
apply (rule impI) |
|
1802 |
apply (case_tac "a \<in> files_hung_by_del s", simp_all) |
|
1803 |
apply (simp add:cf2sfiles_def, rule set_eqI, rule iffI, drule CollectD) |
|
1804 |
apply (erule bexE, frule_tac f' = f' in same_inode_files_closefd) |
|
1805 |
apply (simp add:current_files_closefd, simp) |
|
1806 |
apply (rule_tac x = f'a in bexI) |
|
1807 |
apply (frule_tac f = f'a in cf2sfile_closefd) |
|
1808 |
apply (simp add:same_inode_files_prop1 current_files_closefd, simp, simp) |
|
1809 |
apply (drule CollectD, erule bexE, frule_tac f' = f' in same_inode_files_closefd) |
|
1810 |
apply (simp add:current_files_closefd, simp) |
|
1811 |
apply (rule_tac x = f'a in bexI) |
|
1812 |
apply (frule_tac f = f'a in cf2sfile_closefd) |
|
1813 |
apply (simp add:same_inode_files_prop1 current_files_closefd, simp, simp) |
|
1814 |
apply (simp add:cf2sfiles_def, rule set_eqI, rule iffI, drule CollectD) |
|
1815 |
apply (erule bexE, frule_tac f' = f' in same_inode_files_closefd) |
|
1816 |
apply (simp add:current_files_closefd, simp) |
|
1817 |
apply (rule_tac x = f'a in bexI) |
|
1818 |
apply (frule_tac f = f'a in cf2sfile_closefd) |
|
1819 |
apply (simp add:same_inode_files_prop1 current_files_closefd, simp, simp) |
|
1820 |
apply (drule CollectD, erule bexE, frule_tac f' = f' in same_inode_files_closefd) |
|
1821 |
apply (simp add:current_files_closefd, simp) |
|
1822 |
apply (rule_tac x = f'a in bexI) |
|
1823 |
apply (frule_tac f = f'a in cf2sfile_closefd) |
|
1824 |
apply (simp add:same_inode_files_prop1 current_files_closefd, simp, simp) |
|
1825 |
done |
|
1826 |
||
1827 |
lemmas cf2sfiles_simps = cf2sfiles_open cf2sfiles_linkhard cf2sfiles_other |
|
1828 |
cf2sfiles_unlink cf2sfiles_closefd |
|
1829 |
||
1830 |
||
1831 |
(* simpset for co2sobj *) |
|
1832 |
||
1833 |
lemma co2sobj_execve: |
|
1834 |
"\<lbrakk>valid (Execve p f fds # s); alive s obj\<rbrakk> \<Longrightarrow> co2sobj (Execve p f fds # s) obj = ( |
|
1835 |
if (obj = O_proc p) |
|
1836 |
then (case (cp2sproc (Execve p f fds # s) p) of |
|
1837 |
Some sp \<Rightarrow> Some (S_proc sp (O_proc p \<in> Tainted s \<or> O_file f \<in> Tainted s)) |
|
1838 |
| _ \<Rightarrow> None) |
|
1839 |
else co2sobj s obj )" |
|
1840 |
apply (frule vt_grant_os, frule vd_cons, case_tac obj) |
|
1841 |
apply (simp_all add:current_files_simps cf2sfiles_other ch2sshm_other cq2smsgq_other tainted_eq_Tainted) |
|
1842 |
apply (case_tac "cp2sproc (Execve p f fds # s) p") |
|
1843 |
apply (drule current_proc_has_sp', simp, simp) |
|
1844 |
apply (simp (no_asm_simp) add:cp2sproc_execve tainted_eq_Tainted split:option.splits) |
|
1845 |
apply (frule_tac s = s in is_dir_has_sdir', simp, erule exE, simp) |
|
1846 |
apply (frule_tac ff = list in cf2sfile_other', simp_all) |
|
1847 |
apply (simp add:is_dir_in_current) |
|
1848 |
done |
|
1849 |
||
1850 |
lemma co2sobj_clone: |
|
1851 |
"\<lbrakk>valid (Clone p p' fds shms # s); alive s obj\<rbrakk> \<Longrightarrow> co2sobj (Clone p p' fds shms # s) obj = ( |
|
1852 |
if (obj = O_proc p') |
|
1853 |
then (case (cp2sproc (Clone p p' fds shms # s) p') of |
|
1854 |
Some sp \<Rightarrow> Some (S_proc sp (O_proc p \<in> Tainted s)) |
|
1855 |
| _ \<Rightarrow> None) |
|
1856 |
else co2sobj s obj )" |
|
1857 |
apply (frule vt_grant_os, frule vd_cons, case_tac obj) |
|
1858 |
apply (simp_all add:current_files_simps cf2sfiles_other ch2sshm_other cq2smsgq_other tainted_eq_Tainted) |
|
1859 |
apply (case_tac "cp2sproc (Clone p p' fds shms # s) p'") |
|
1860 |
apply (drule current_proc_has_sp', simp, simp) |
|
1861 |
apply ((erule conjE)+, frule_tac p = p in current_proc_has_sec, simp, erule exE, simp) |
|
1862 |
apply (rule conjI, rule impI, simp) |
|
1863 |
apply (simp (no_asm_simp) add:cp2sproc_clone tainted_eq_Tainted split:option.splits) |
|
1864 |
||
1865 |
apply (frule_tac s = s in is_dir_has_sdir', simp, erule exE, simp) |
|
1866 |
apply (frule_tac ff = list in cf2sfile_other', simp_all) |
|
1867 |
apply (simp add:is_dir_in_current) |
|
1868 |
done |
|
1869 |
||
1870 |
lemma co2sobj_ptrace: |
|
1871 |
"\<lbrakk>valid (Ptrace p p' # s); alive s obj\<rbrakk>\<Longrightarrow> co2sobj (Ptrace p p' # s) obj = ( |
|
1872 |
case obj of |
|
1873 |
O_proc p'' \<Rightarrow> if (info_flow_shm s p' p'') |
|
1874 |
then (case (cp2sproc s p'') of |
|
1875 |
Some sp \<Rightarrow> Some (S_proc sp (O_proc p'' \<in> Tainted s \<or> O_proc p \<in> Tainted s)) |
|
1876 |
| _ \<Rightarrow> None) |
|
1877 |
else if (info_flow_shm s p p'') |
|
1878 |
then (case (cp2sproc s p'') of |
|
1879 |
Some sp \<Rightarrow> Some (S_proc sp (O_proc p'' \<in> Tainted s \<or> O_proc p' \<in> Tainted s)) |
|
1880 |
| _ \<Rightarrow> None) |
|
1881 |
else co2sobj s (O_proc p'') |
|
1882 |
| _ \<Rightarrow> co2sobj s obj)" |
|
1883 |
apply (frule vt_grant_os, frule vd_cons, case_tac obj) |
|
1884 |
apply (simp_all add:current_files_simps ch2sshm_other cq2smsgq_other cf2sfiles_other tainted_eq_Tainted) |
|
1885 |
||
1886 |
apply (auto simp:cp2sproc_other tainted_eq_Tainted split:option.splits |
|
1887 |
dest!:current_proc_has_sec' current_proc_has_sp' intro:info_flow_shm_Tainted)[1] |
|
1888 |
||
1889 |
apply (frule_tac s = s in is_dir_has_sdir', simp, erule exE, simp) |
|
1890 |
apply (frule_tac ff = list in cf2sfile_other', simp_all) |
|
1891 |
apply (simp add:is_dir_in_current) |
|
1892 |
done |
|
1893 |
||
1894 |
lemma co2sobj_open: |
|
1895 |
"\<lbrakk>valid (Open p f flag fd opt # s); alive (Open p f flag fd opt # s) obj\<rbrakk> |
|
1896 |
\<Longrightarrow> co2sobj (Open p f flag fd opt # s) obj = (case obj of |
|
1897 |
O_file f' \<Rightarrow> if (f' = f \<and> opt \<noteq> None) |
|
1898 |
then (case (cf2sfile (Open p f flag fd opt # s) f) of |
|
1899 |
Some sf \<Rightarrow> Some (S_file {sf} (O_proc p \<in> Tainted s)) |
|
1900 |
| _ \<Rightarrow> None) |
|
1901 |
else co2sobj s (O_file f') |
|
1902 |
| O_proc p' \<Rightarrow> if (p' = p) |
|
1903 |
then (case (cp2sproc (Open p f flag fd opt # s) p) of |
|
1904 |
Some sp \<Rightarrow> Some (S_proc sp (O_proc p \<in> Tainted s)) |
|
1905 |
| _ \<Rightarrow> None) |
|
1906 |
else co2sobj s (O_proc p') |
|
1907 |
| _ \<Rightarrow> co2sobj s obj )" |
|
1908 |
apply (frule vt_grant_os, frule vd_cons, case_tac obj) |
|
1909 |
apply (auto simp:cp2sproc_simps tainted_eq_Tainted split:option.splits |
|
1910 |
dest!:current_proc_has_sp' intro:info_flow_shm_Tainted)[1] |
|
1911 |
||
1912 |
apply (simp split:if_splits t_object.splits) |
|
1913 |
apply (rule conjI, rule impI, erule conjE, erule exE, simp, (erule exE|erule conjE)+) |
|
1914 |
apply (case_tac "cf2sfile (Open p f flag fd (Some y) # s) f") |
|
1915 |
apply (drule current_file_has_sfile', simp, simp add:current_files_simps, simp) |
|
1916 |
apply (frule_tac f' = f in cf2sfiles_open, simp add:current_files_simps) |
|
1917 |
apply (simp add:tainted_eq_Tainted) |
|
1918 |
apply (rule impI, rule notI, drule Tainted_in_current, simp, simp add:is_file_in_current) |
|
1919 |
apply (rule impI, simp add:tainted_eq_Tainted cf2sfiles_open is_file_in_current split:option.splits) |
|
1920 |
||
1921 |
apply (simp_all add:current_files_simps is_dir_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted) |
|
1922 |
||
1923 |
apply (frule is_dir_in_current) |
|
1924 |
apply (frule_tac f' = list in cf2sfile_open) |
|
1925 |
apply (simp add:current_files_simps split:option.splits) |
|
1926 |
apply (simp split:if_splits option.splits) |
|
1927 |
done |
|
1928 |
||
1929 |
lemma co2sobj_readfile: |
|
1930 |
"\<lbrakk>valid (ReadFile p fd # s); alive s obj\<rbrakk> \<Longrightarrow> co2sobj (ReadFile p fd # s) obj = ( |
|
1931 |
case obj of |
|
1932 |
O_proc p' \<Rightarrow> (case (file_of_proc_fd s p fd) of |
|
1933 |
Some f \<Rightarrow> (if (info_flow_shm s p p' \<and> O_file f \<in> Tainted s) |
|
1934 |
then (case (cp2sproc s p') of |
|
1935 |
Some sp \<Rightarrow> Some (S_proc sp True) |
|
1936 |
| _ \<Rightarrow> None) |
|
1937 |
else co2sobj s obj) |
|
1938 |
| _ \<Rightarrow> None) |
|
1939 |
| _ \<Rightarrow> co2sobj s obj)" |
|
1940 |
apply (frule vt_grant_os, frule vd_cons, case_tac obj) |
|
1941 |
apply (auto simp:cp2sproc_simps tainted_eq_Tainted split:option.splits |
|
1942 |
dest!:current_proc_has_sp' intro:info_flow_shm_Tainted)[1] |
|
1943 |
apply (simp_all add:current_files_simps is_dir_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted) |
|
1944 |
||
1945 |
apply (auto split:if_splits option.splits dest!:current_file_has_sfile' |
|
1946 |
simp:current_files_simps cf2sfiles_simps cf2sfile_simps |
|
1947 |
dest:is_file_in_current is_dir_in_current) |
|
1948 |
done |
|
1949 |
||
1950 |
lemma co2sobj_writefile: |
|
1951 |
"\<lbrakk>valid (WriteFile p fd # s); alive s obj\<rbrakk> \<Longrightarrow> co2sobj (WriteFile p fd # s) obj = ( |
|
1952 |
case obj of |
|
1953 |
O_file f' \<Rightarrow> (case (file_of_proc_fd s p fd) of |
|
1954 |
Some f \<Rightarrow> (if (f \<in> same_inode_files s f') |
|
1955 |
then Some (S_file (cf2sfiles s f') |
|
1956 |
(O_file f' \<in> Tainted s \<or> O_proc p \<in> Tainted s)) |
|
1957 |
else co2sobj s obj) |
|
1958 |
| _ \<Rightarrow> None) |
|
1959 |
| _ \<Rightarrow> co2sobj s obj)" |
|
1960 |
apply (frule vt_grant_os, frule vd_cons, case_tac obj) |
|
1961 |
apply (simp_all add:current_files_simps is_dir_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted) |
|
1962 |
||
1963 |
apply (auto split:if_splits option.splits dest!:current_file_has_sfile' current_proc_has_sp' |
|
1964 |
simp:current_files_simps cf2sfiles_simps cf2sfile_simps cp2sproc_simps tainted_eq_Tainted |
|
1965 |
same_inode_files_prop6 |
|
1966 |
dest:is_file_in_current is_dir_in_current) |
|
1967 |
||
1968 |
(* should delete has_same_inode !?!?*) |
|
1969 |
by (auto simp:same_inode_files_def is_file_def has_same_inode_def split:if_splits option.splits) |
|
1970 |
||
1971 |
lemma co2sobj_closefd: |
|
1972 |
"\<lbrakk>valid (CloseFd p fd # s); alive (CloseFd p fd # s) obj\<rbrakk> \<Longrightarrow> co2sobj (CloseFd p fd # s) obj = ( |
|
1973 |
case obj of |
|
1974 |
O_file f' \<Rightarrow> (case (file_of_proc_fd s p fd) of |
|
1975 |
Some f \<Rightarrow> (if (f' \<in> same_inode_files s f \<and> proc_fd_of_file s f = {(p, fd)} \<and> |
|
1976 |
f \<in> files_hung_by_del s \<and> (\<forall> f'' \<in> same_inode_files s f. |
|
1977 |
f'' \<noteq> f \<longrightarrow> cf2sfile s f'' \<noteq> cf2sfile s f)) |
|
1978 |
then (case (cf2sfile s f, co2sobj s (O_file f')) of |
|
1979 |
(Some sf, Some (S_file sfs b)) \<Rightarrow> Some (S_file (sfs - {sf}) b) |
|
1980 |
| _ \<Rightarrow> None) |
|
1981 |
else co2sobj s obj) |
|
1982 |
| _ \<Rightarrow> co2sobj s obj) |
|
1983 |
| O_proc p' \<Rightarrow> (if (p = p') |
|
1984 |
then (case (cp2sproc (CloseFd p fd # s) p) of |
|
1985 |
Some sp \<Rightarrow> Some (S_proc sp (O_proc p \<in> Tainted s)) |
|
1986 |
| _ \<Rightarrow> None) |
|
1987 |
else co2sobj s obj) |
|
1988 |
| _ \<Rightarrow> co2sobj s obj) " |
|
1989 |
apply (frule vt_grant_os, frule vd_cons, case_tac obj) |
|
1990 |
apply (simp_all add:current_files_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted) |
|
1991 |
apply (auto simp:cp2sproc_simps tainted_eq_Tainted split:option.splits if_splits |
|
1992 |
dest!:current_proc_has_sp' intro:info_flow_shm_Tainted)[1] |
|
1993 |
||
1994 |
apply (frule is_file_in_current) |
|
1995 |
apply (case_tac "file_of_proc_fd s p fd") |
|
1996 |
apply (simp add:tainted_eq_Tainted) |
|
1997 |
apply (drule_tac f' = list in cf2sfiles_closefd, simp add:current_files_closefd, simp) |
|
1998 |
apply (frule_tac f' = list in cf2sfiles_closefd, simp) |
|
1999 |
apply (simp add:is_file_simps current_files_simps) |
|
2000 |
apply (auto simp add:tainted_eq_Tainted cf2sfile_closefd split:if_splits option.splits |
|
2001 |
dest!:current_file_has_sfile' dest:hung_file_in_current)[1] |
|
2002 |
||
2003 |
apply (simp add:is_dir_simps, frule is_dir_in_current) |
|
2004 |
apply (frule_tac f = list in cf2sfile_closefd) |
|
2005 |
apply (clarsimp simp:current_files_closefd split:option.splits) |
|
2006 |
apply (drule file_of_pfd_is_file', simp+) |
|
2007 |
done |
|
2008 |
||
2009 |
lemma co2sobj_unlink: |
|
2010 |
"\<lbrakk>valid (UnLink p f # s); alive (UnLink p f # s) obj\<rbrakk> \<Longrightarrow> co2sobj (UnLink p f # s) obj = ( |
|
2011 |
case obj of |
|
2012 |
O_file f' \<Rightarrow> if (f' \<in> same_inode_files s f \<and> proc_fd_of_file s f = {} \<and> |
|
2013 |
(\<forall> f'' \<in> same_inode_files s f. f'' \<noteq> f \<longrightarrow> cf2sfile s f'' \<noteq> cf2sfile s f)) |
|
2014 |
then (case (cf2sfile s f, co2sobj s (O_file f')) of |
|
2015 |
(Some sf, Some (S_file sfs b)) \<Rightarrow> Some (S_file (sfs - {sf}) b) |
|
2016 |
| _ \<Rightarrow> None) |
|
2017 |
else co2sobj s obj |
|
2018 |
| _ \<Rightarrow> co2sobj s obj)" |
|
2019 |
apply (frule vt_grant_os, frule vd_cons, case_tac obj) |
|
2020 |
apply (simp_all add:current_files_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted) |
|
2021 |
apply (auto simp:cp2sproc_simps tainted_eq_Tainted split:option.splits if_splits |
|
2022 |
dest!:current_proc_has_sp' intro:info_flow_shm_Tainted)[1] |
|
2023 |
apply (frule is_file_in_current) |
|
2024 |
apply (frule_tac f' = list in cf2sfile_unlink, simp) |
|
2025 |
apply (frule_tac f' = list in cf2sfiles_unlink, simp) |
|
2026 |
apply (simp add:is_file_simps current_files_simps) |
|
2027 |
apply (auto simp add:tainted_eq_Tainted is_file_in_current split:if_splits option.splits |
|
2028 |
dest!:current_file_has_sfile')[1] |
|
2029 |
||
2030 |
apply (simp add:is_dir_simps, frule is_dir_in_current) |
|
2031 |
apply (frule_tac f' = list in cf2sfile_unlink) |
|
2032 |
apply (clarsimp simp:current_files_unlink split:option.splits) |
|
2033 |
apply (drule file_dir_conflict, simp+) |
|
2034 |
done |
|
2035 |
||
2036 |
lemma co2sobj_rmdir: |
|
2037 |
"\<lbrakk>valid (Rmdir p f # s); alive (Rmdir p f # s) obj\<rbrakk> \<Longrightarrow> co2sobj (Rmdir p f # s) obj = co2sobj s obj" |
|
2038 |
apply (frule vt_grant_os, frule vd_cons, case_tac obj) |
|
2039 |
apply (simp_all add:current_files_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted) |
|
2040 |
apply (auto simp:cp2sproc_simps tainted_eq_Tainted split:option.splits if_splits |
|
2041 |
dest!:current_proc_has_sp' intro:info_flow_shm_Tainted)[1] |
|
2042 |
apply (simp add:is_file_simps dir_is_empty_def) |
|
2043 |
apply (case_tac "f = list", drule file_dir_conflict, simp, simp) |
|
2044 |
apply (simp add:cf2sfiles_other) |
|
2045 |
apply (auto simp:cf2sfile_simps dest:is_dir_in_current) |
|
2046 |
done |
|
2047 |
||
2048 |
lemma co2sobj_mkdir: |
|
2049 |
"\<lbrakk>valid (Mkdir p f i # s); alive (Mkdir p f i # s) obj\<rbrakk> \<Longrightarrow> co2sobj (Mkdir p f i # s) obj = ( |
|
2050 |
if (obj = O_dir f) |
|
2051 |
then (case (cf2sfile (Mkdir p f i # s) f) of |
|
2052 |
Some sf \<Rightarrow> Some (S_dir sf) |
|
2053 |
| _ \<Rightarrow> None) |
|
2054 |
else co2sobj s obj)" |
|
2055 |
apply (frule vt_grant_os, frule vd_cons, case_tac obj) |
|
2056 |
apply (simp_all add:current_files_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted) |
|
2057 |
apply (auto simp:cp2sproc_simps tainted_eq_Tainted split:option.splits if_splits |
|
2058 |
dest!:current_proc_has_sp' intro:info_flow_shm_Tainted)[1] |
|
2059 |
apply (frule_tac cf2sfiles_other, simp+) |
|
2060 |
apply (frule is_dir_in_current, rule impI, simp add:current_files_mkdir) |
|
2061 |
apply (frule current_file_has_sfile, simp, erule exE, simp) |
|
2062 |
apply (drule cf2sfile_mkdir1, simp+) |
|
2063 |
done |
|
2064 |
||
2065 |
lemma same_inodes_Tainted: |
|
2066 |
"\<lbrakk>f \<in> same_inode_files s f'; valid s\<rbrakk> \<Longrightarrow> (O_file f \<in> Tainted s) = (O_file f' \<in> Tainted s)" |
|
2067 |
apply (frule same_inode_files_prop8, frule same_inode_files_prop7) |
|
2068 |
apply (auto intro:has_same_inode_Tainted) |
|
2069 |
done |
|
2070 |
||
2071 |
lemma co2sobj_linkhard: |
|
2072 |
"\<lbrakk>valid (LinkHard p oldf f # s); alive (LinkHard p oldf f # s) obj\<rbrakk> |
|
2073 |
\<Longrightarrow> co2sobj (LinkHard p oldf f # s) obj = ( |
|
2074 |
case obj of |
|
2075 |
O_file f' \<Rightarrow> if (f' = f \<or> f' \<in> same_inode_files s oldf) |
|
2076 |
then (case (cf2sfile (LinkHard p oldf f # s) f) of |
|
2077 |
Some sf \<Rightarrow> Some (S_file (cf2sfiles s oldf \<union> {sf}) (O_file oldf \<in> Tainted s)) |
|
2078 |
| _ \<Rightarrow> None) |
|
2079 |
else co2sobj s obj |
|
2080 |
| _ \<Rightarrow> co2sobj s obj)" |
|
2081 |
apply (frule vt_grant_os, frule vd_cons, case_tac obj) |
|
2082 |
apply (simp_all add:current_files_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted) |
|
2083 |
apply (auto simp:cp2sproc_simps tainted_eq_Tainted split:option.splits if_splits |
|
2084 |
dest!:current_proc_has_sp' intro:info_flow_shm_Tainted)[1] |
|
2085 |
apply (frule_tac cf2sfiles_linkhard, simp+) |
|
2086 |
apply (frule_tac f' = f in cf2sfile_linkhard, simp add:current_files_linkhard) |
|
2087 |
apply (auto simp:is_file_simps sectxt_of_obj_simps current_files_simps is_file_in_current same_inodes_Tainted |
|
2088 |
split:option.splits if_splits dest:Tainted_in_current |
|
2089 |
dest!:current_has_sec' current_file_has_sfile')[1] |
|
2090 |
||
2091 |
apply (frule is_dir_in_current, simp add:current_files_linkhard is_dir_simps is_dir_in_current) |
|
2092 |
apply (frule is_dir_in_current) |
|
2093 |
apply (frule current_file_has_sfile, simp) |
|
2094 |
apply (drule cf2sfile_linkhard1, simp+) |
|
2095 |
done |
|
2096 |
||
2097 |
lemma co2sobj_truncate: |
|
2098 |
"\<lbrakk>valid (Truncate p f len # s); alive s obj\<rbrakk> \<Longrightarrow> co2sobj (Truncate p f len # s) obj = ( |
|
2099 |
case obj of |
|
2100 |
O_file f' \<Rightarrow> if (f' \<in> same_inode_files s f \<and> len > 0) |
|
2101 |
then Some (S_file (cf2sfiles s f') (O_file f' \<in> Tainted s \<or> O_proc p \<in> Tainted s)) |
|
2102 |
else co2sobj s obj |
|
2103 |
| _ \<Rightarrow> co2sobj s obj)" |
|
2104 |
apply (frule vt_grant_os, frule vd_cons, case_tac obj) |
|
2105 |
apply (simp_all add:current_files_simps is_dir_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted) |
|
2106 |
||
2107 |
apply (auto split:if_splits option.splits dest!:current_file_has_sfile' current_proc_has_sp' |
|
2108 |
simp:current_files_simps cf2sfiles_simps cf2sfile_simps cp2sproc_simps tainted_eq_Tainted |
|
2109 |
same_inode_files_prop6 |
|
2110 |
dest:is_file_in_current is_dir_in_current) |
|
2111 |
||
2112 |
(* should delete has_same_inode !?!?*) |
|
2113 |
by (auto simp:same_inode_files_def is_file_def has_same_inode_def split:if_splits option.splits) |
|
2114 |
||
2115 |
lemma co2sobj_kill: |
|
2116 |
"\<lbrakk>valid (Kill p p' # s); alive (Kill p p' # s) obj\<rbrakk> \<Longrightarrow> co2sobj (Kill p p' # s) obj = co2sobj s obj" |
|
2117 |
apply (frule vt_grant_os, frule vd_cons, case_tac obj) |
|
2118 |
apply (simp_all add:current_files_simps is_dir_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted) |
|
2119 |
apply (auto split:if_splits option.splits dest!:current_file_has_sfile' current_proc_has_sp' |
|
2120 |
simp:current_files_simps cf2sfiles_simps cf2sfile_simps cp2sproc_simps tainted_eq_Tainted |
|
2121 |
same_inode_files_prop6 |
|
2122 |
dest:is_file_in_current is_dir_in_current) |
|
2123 |
done |
|
2124 |
||
2125 |
lemma co2sobj_exit: |
|
2126 |
"\<lbrakk>valid (Exit p # s); alive (Exit p # s) obj\<rbrakk> \<Longrightarrow> co2sobj (Exit p # s) obj = co2sobj s obj" |
|
2127 |
apply (frule vt_grant_os, frule vd_cons, case_tac obj) |
|
2128 |
apply (simp_all add:current_files_simps is_dir_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted) |
|
2129 |
apply (auto split:if_splits option.splits dest!:current_file_has_sfile' current_proc_has_sp' |
|
2130 |
simp:current_files_simps cf2sfiles_simps cf2sfile_simps cp2sproc_simps tainted_eq_Tainted |
|
2131 |
same_inode_files_prop6 |
|
2132 |
dest:is_file_in_current is_dir_in_current) |
|
2133 |
done |
|
2134 |
||
2135 |
lemma co2sobj_createmsgq: |
|
2136 |
"\<lbrakk>valid (CreateMsgq p q # s); alive (CreateMsgq p q # s) obj\<rbrakk> \<Longrightarrow> co2sobj (CreateMsgq p q # s) obj = ( |
|
2137 |
case obj of |
|
2138 |
O_msgq q' \<Rightarrow> if (q' = q) then (case (cq2smsgq (CreateMsgq p q # s) q) of |
|
2139 |
Some sq \<Rightarrow> Some (S_msgq sq) |
|
2140 |
| _ \<Rightarrow> None) |
|
2141 |
else co2sobj s obj |
|
2142 |
| _ \<Rightarrow> co2sobj s obj)" |
|
2143 |
apply (frule vt_grant_os, frule vd_cons, case_tac obj) |
|
2144 |
apply (simp_all add:current_files_simps is_dir_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted) |
|
2145 |
apply (auto split:if_splits option.splits dest!:current_file_has_sfile' current_proc_has_sp' |
|
2146 |
simp:current_files_simps cf2sfiles_simps cf2sfile_simps cp2sproc_simps tainted_eq_Tainted |
|
2147 |
same_inode_files_prop6 |
|
2148 |
dest!:current_has_smsgq' |
|
2149 |
dest:is_file_in_current is_dir_in_current cq2smsg_createmsgq) |
|
2150 |
done |
|
2151 |
||
2152 |
lemma co2sobj_sendmsg: |
|
2153 |
"\<lbrakk>valid (SendMsg p q m # s); alive (SendMsg p q m # s) obj\<rbrakk> \<Longrightarrow> co2sobj (SendMsg p q m # s) obj = ( |
|
2154 |
case obj of |
|
2155 |
O_msgq q' \<Rightarrow> if (q' = q) then (case (cq2smsgq (SendMsg p q m # s) q) of |
|
2156 |
Some sq \<Rightarrow> Some (S_msgq sq) |
|
2157 |
| _ \<Rightarrow> None) |
|
2158 |
else co2sobj s obj |
|
2159 |
| _ \<Rightarrow> co2sobj s obj)" |
|
2160 |
apply (frule vt_grant_os, frule vd_cons, case_tac obj) |
|
2161 |
apply (simp_all add:current_files_simps is_dir_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted) |
|
2162 |
apply (auto split:if_splits option.splits dest!:current_file_has_sfile' current_proc_has_sp' |
|
2163 |
simp:current_files_simps cf2sfiles_simps cf2sfile_simps cp2sproc_simps tainted_eq_Tainted |
|
2164 |
same_inode_files_prop6 |
|
2165 |
dest!:current_has_smsgq' |
|
2166 |
dest:is_file_in_current is_dir_in_current cq2smsg_sendmsg) |
|
2167 |
done |
|
2168 |
||
2169 |
lemma co2sobj_recvmsg: |
|
2170 |
"\<lbrakk>valid (RecvMsg p q m # s); alive (RecvMsg p q m # s) obj\<rbrakk> \<Longrightarrow> co2sobj (RecvMsg p q m # s) obj = ( |
|
2171 |
case obj of |
|
2172 |
O_msgq q' \<Rightarrow> if (q' = q) then (case (cq2smsgq (RecvMsg p q m # s) q) of |
|
2173 |
Some sq \<Rightarrow> Some (S_msgq sq) |
|
2174 |
| _ \<Rightarrow> None) |
|
2175 |
else co2sobj s obj |
|
2176 |
| O_proc p' \<Rightarrow> if (info_flow_shm s p p' \<and> O_msg q m \<in> Tainted s) |
|
2177 |
then (case (cp2sproc s p') of |
|
2178 |
Some sp \<Rightarrow> Some (S_proc sp True) |
|
2179 |
| _ \<Rightarrow> None) |
|
2180 |
else co2sobj s obj |
|
2181 |
| _ \<Rightarrow> co2sobj s obj)" |
|
2182 |
apply (frule vt_grant_os, frule vd_cons, case_tac obj) |
|
2183 |
apply (simp_all add:current_files_simps is_dir_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted) |
|
2184 |
apply (auto split:if_splits option.splits dest!:current_file_has_sfile' current_proc_has_sp' |
|
2185 |
simp:current_files_simps cf2sfiles_simps cf2sfile_simps cp2sproc_simps tainted_eq_Tainted |
|
2186 |
same_inode_files_prop6 |
|
2187 |
dest!:current_has_smsgq' |
|
2188 |
dest:is_file_in_current is_dir_in_current cq2smsg_recvmsg) |
|
2189 |
done |
|
2190 |
||
2191 |
lemma co2sobj_removemsgq: |
|
2192 |
"\<lbrakk>valid (RemoveMsgq p q # s); alive (RemoveMsgq p q # s) obj\<rbrakk> |
|
2193 |
\<Longrightarrow> co2sobj (RemoveMsgq p q # s) obj = co2sobj s obj" |
|
2194 |
apply (frule vt_grant_os, frule vd_cons, case_tac obj) |
|
2195 |
apply (simp_all add:current_files_simps is_dir_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted) |
|
2196 |
apply (auto split:if_splits option.splits dest!:current_file_has_sfile' current_proc_has_sp' |
|
2197 |
simp:current_files_simps cf2sfiles_simps cf2sfile_simps cp2sproc_simps tainted_eq_Tainted |
|
2198 |
same_inode_files_prop6 |
|
2199 |
dest!:current_has_smsgq' |
|
2200 |
dest:is_file_in_current is_dir_in_current cq2smsg_removemsgq) |
|
2201 |
done |
|
2202 |
||
2203 |
lemma co2sobj_createshm: |
|
2204 |
"\<lbrakk>valid (CreateShM p h # s); alive s obj\<rbrakk> \<Longrightarrow> co2sobj (CreateShM p h # s) obj = co2sobj s obj" |
|
2205 |
apply (frule vt_grant_os, frule vd_cons, case_tac obj) |
|
2206 |
apply (simp_all add:current_files_simps is_dir_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted) |
|
2207 |
apply (auto split:if_splits option.splits dest!:current_file_has_sfile' current_proc_has_sp' |
|
2208 |
simp:current_files_simps cf2sfiles_simps cf2sfile_simps cp2sproc_simps tainted_eq_Tainted |
|
2209 |
same_inode_files_prop6 ch2sshm_simps |
|
2210 |
dest!:current_shm_has_sh' |
|
2211 |
dest:is_file_in_current is_dir_in_current) |
|
2212 |
done |
|
2213 |
||
2214 |
lemma co2sobj_detach: |
|
2215 |
"\<lbrakk>valid (Detach p h # s); alive s obj\<rbrakk> \<Longrightarrow> co2sobj (Detach p h # s) obj = ( |
|
2216 |
case obj of |
|
2217 |
O_proc p' \<Rightarrow> if (p' = p) then (case (cp2sproc (Detach p h # s) p) of |
|
2218 |
Some sp \<Rightarrow> Some (S_proc sp (O_proc p \<in> Tainted s)) |
|
2219 |
| _ \<Rightarrow> None) |
|
2220 |
else co2sobj s obj |
|
2221 |
| _ \<Rightarrow> co2sobj s obj)" |
|
2222 |
apply (frule vt_grant_os, frule vd_cons, case_tac obj) |
|
2223 |
apply (simp_all add:current_files_simps is_dir_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted) |
|
2224 |
||
2225 |
apply (auto split:if_splits option.splits dest!:current_file_has_sfile' current_proc_has_sp' |
|
2226 |
simp:current_files_simps cf2sfiles_simps cf2sfile_simps cp2sproc_simps tainted_eq_Tainted |
|
2227 |
same_inode_files_prop6 ch2sshm_simps |
|
2228 |
dest!:current_shm_has_sh' |
|
2229 |
dest:is_file_in_current is_dir_in_current) |
|
2230 |
done |
|
2231 |
||
2232 |
lemma co2sobj_deleteshm: |
|
2233 |
"\<lbrakk>valid (DeleteShM p h # s); alive (DeleteShM p h # s) obj\<rbrakk> \<Longrightarrow> co2sobj (DeleteShM p h # s) obj = ( |
|
2234 |
case obj of |
|
2235 |
O_proc p' \<Rightarrow> (case (cp2sproc (DeleteShM p h # s) p') of |
|
2236 |
Some sp \<Rightarrow> Some (S_proc sp (O_proc p' \<in> Tainted s)) |
|
2237 |
| _ \<Rightarrow> None) |
|
2238 |
| _ \<Rightarrow> co2sobj s obj)" |
|
2239 |
apply (frule vt_grant_os, frule vd_cons, case_tac obj) |
|
2240 |
apply (simp_all add:current_files_simps is_dir_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted) |
|
2241 |
||
2242 |
apply (auto split:if_splits option.splits dest!:current_file_has_sfile' current_proc_has_sp' |
|
2243 |
simp:current_files_simps cf2sfiles_simps cf2sfile_simps tainted_eq_Tainted |
|
2244 |
same_inode_files_prop6 ch2sshm_simps |
|
2245 |
dest!:current_shm_has_sh' |
|
2246 |
dest:is_file_in_current is_dir_in_current) |
|
2247 |
done |
|
2248 |
||
2249 |
lemma co2sobj_attach: |
|
2250 |
"\<lbrakk>valid (Attach p h flag # s); alive s obj\<rbrakk> \<Longrightarrow> co2sobj (Attach p h flag # s) obj = ( |
|
2251 |
case obj of |
|
2252 |
O_proc p' \<Rightarrow> if (p' = p) |
|
2253 |
then (case (cp2sproc (Attach p h flag # s) p) of |
|
2254 |
Some sp \<Rightarrow> Some (S_proc sp (O_proc p \<in> Tainted s \<or> |
|
2255 |
(\<exists> p'. O_proc p' \<in> Tainted s \<and> (p', SHM_RDWR) \<in> procs_of_shm s h))) |
|
2256 |
| _ \<Rightarrow> None) |
|
2257 |
else if (\<exists> flag'. (p', flag') \<in> procs_of_shm s h) |
|
2258 |
then (case (cp2sproc s p') of |
|
2259 |
Some sp \<Rightarrow> Some (S_proc sp (O_proc p' \<in> Tainted s \<or> |
|
2260 |
(O_proc p \<in> Tainted s \<and> flag = SHM_RDWR))) |
|
2261 |
| _ \<Rightarrow> None) |
|
2262 |
else co2sobj s obj |
|
2263 |
| _ \<Rightarrow> co2sobj s obj)" |
|
2264 |
apply (frule vt_grant_os, frule vd_cons, case_tac obj) |
|
2265 |
apply (simp_all add:current_files_simps is_dir_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted) |
|
2266 |
||
2267 |
apply (rule conjI|rule impI|erule exE)+ |
|
2268 |
apply (simp split:option.splits) |
|
2269 |
apply (rule impI, frule current_proc_has_sp, simp) |
|
2270 |
apply ((erule exE)+, auto simp:cp2sproc_attach tainted_eq_Tainted)[1] |
|
2271 |
apply (rule impI|rule conjI)+ |
|
2272 |
apply (subgoal_tac "p \<in> current_procs (Attach p h flag # s)") |
|
2273 |
apply (drule_tac p = p in current_proc_has_sp, simp, erule exE) |
|
2274 |
apply (auto simp:tainted_eq_Tainted)[1] |
|
2275 |
apply (simp, rule impI) |
|
2276 |
apply (subgoal_tac "nat \<in> current_procs (Attach p h flag # s)") |
|
2277 |
apply (drule_tac p = nat in current_proc_has_sp, simp, erule exE) |
|
2278 |
apply (drule_tac p = nat in current_proc_has_sp, simp, erule exE) |
|
2279 |
apply (auto simp:cp2sproc_attach tainted_eq_Tainted)[1] |
|
2280 |
apply simp |
|
2281 |
||
2282 |
apply (auto split:if_splits option.splits dest!:current_file_has_sfile' |
|
2283 |
simp:current_files_simps cf2sfiles_simps cf2sfile_simps tainted_eq_Tainted |
|
2284 |
same_inode_files_prop6 |
|
2285 |
dest:is_file_in_current is_dir_in_current) |
|
2286 |
done |
|
2287 |
||
2288 |
||
2289 |
lemma co2sobj_other: |
|
2290 |
"\<lbrakk>valid (e # s); alive (e # s) obj; |
|
2291 |
\<forall> p f fds. e \<noteq> Execve p f fds; |
|
2292 |
\<forall> p p' fds shms. e \<noteq> Clone p p' fds shms; |
|
2293 |
\<forall> p p'. e \<noteq> Ptrace p p'; |
|
2294 |
\<forall> p f flags fd opt. e \<noteq> Open p f flags fd opt; |
|
2295 |
\<forall> p fd. e \<noteq> ReadFile p fd; |
|
2296 |
\<forall> p fd. e \<noteq> WriteFile p fd; |
|
2297 |
\<forall> p fd. e \<noteq> CloseFd p fd; |
|
2298 |
\<forall> p f. e \<noteq> UnLink p f; |
|
2299 |
\<forall> p f. e \<noteq> Rmdir p f; |
|
2300 |
\<forall> p f i. e \<noteq> Mkdir p f i; |
|
2301 |
\<forall> p f f'. e \<noteq> LinkHard p f f'; |
|
2302 |
\<forall> p f len. e \<noteq> Truncate p f len; |
|
2303 |
\<forall> p q. e \<noteq> CreateMsgq p q; |
|
2304 |
\<forall> p q m. e \<noteq> SendMsg p q m; |
|
2305 |
\<forall> p q m. e \<noteq> RecvMsg p q m; |
|
2306 |
\<forall> p q. e \<noteq> RemoveMsgq p q; |
|
2307 |
\<forall> p h. e \<noteq> CreateShM p h; |
|
2308 |
\<forall> p h flag. e \<noteq> Attach p h flag; |
|
2309 |
\<forall> p h. e \<noteq> Detach p h; |
|
2310 |
\<forall> p h. e \<noteq> DeleteShM p h |
|
2311 |
\<rbrakk> \<Longrightarrow> co2sobj (e # s) obj = co2sobj s obj" |
|
2312 |
apply (frule vt_grant, case_tac e) |
|
2313 |
apply (auto intro:co2sobj_kill co2sobj_exit) |
|
2314 |
done |
|
2315 |
||
2316 |
lemmas co2sobj_simps = co2sobj_execve co2sobj_clone co2sobj_ptrace co2sobj_open co2sobj_readfile |
|
2317 |
co2sobj_writefile co2sobj_closefd co2sobj_unlink co2sobj_rmdir co2sobj_mkdir co2sobj_linkhard |
|
2318 |
co2sobj_truncate co2sobj_kill co2sobj_exit co2sobj_createmsgq co2sobj_sendmsg co2sobj_recvmsg |
|
2319 |
co2sobj_removemsgq co2sobj_attach co2sobj_detach co2sobj_createshm co2sobj_deleteshm |
|
2320 |
||
1 | 2321 |
end |
2322 |
||
2323 |
(*<*) |
|
2324 |
end |
|
2325 |
(*>*) |