author | chunhan |
Tue, 27 Aug 2013 08:50:53 +0800 | |
changeset 31 | aa1375b6c0eb |
parent 19 | ced0fcfbcf8e |
child 32 | 705e1e41faf7 |
permissions | -rw-r--r-- |
1 | 1 |
(*<*) |
2 |
theory Co2sobj_prop |
|
31 | 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 |
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) |
|
225 |
apply (auto split:if_splits option.splits simp:cqm2sms_recvmsg1 cqm2sms_recvmsg2) |
|
226 |
using cm2smsg_recvmsg1 cm2smsg_recvmsg2 |
|
227 |
apply (auto split:if_splits option.splits) |
|
228 |
||
229 |
||
230 |
lemmas cqm2sms_simps = cqm2sms_other cqm2sms_createmsgq cqm2sms_sendmsg cqm2sms_recvmsg |
|
231 |
||
232 |
(********************* cq2smsgq simpset ***********************) |
|
233 |
||
234 |
lemma cq2smsgq_other: |
|
235 |
"\<lbrakk>valid (e # s); \<forall> p m. e \<noteq> CreateMsgq p q; \<forall> p q m. e \<noteq> SendMsg p q m; |
|
236 |
\<forall> p q m. e \<noteq> RecvMsg p q m; \<forall> p q. e \<noteq> RemoveMsgq p q\<rbrakk> |
|
237 |
\<Longrightarrow> cq2smsgq (e # s) = cq2smsgq s" |
|
238 |
apply (frule vd_cons, frule vt_grant_os, rule ext, case_tac e) |
|
239 |
apply (auto simp:cq2smsgq_def sectxt_of_obj_simps |
|
240 |
split:t_object.splits option.splits if_splits |
|
241 |
dest:not_deleted_init_msg dest!:current_has_sec') |
|
19 | 242 |
|
243 |
||
31 | 244 |
|
1 | 245 |
|
19 | 246 |
|
247 |
lemmas cq2smsgq_simps = cm2smsg_nil cm2smsg_nil' cm2smsg_createmsg cm2smsg_other |
|
248 |
||
249 |
||
250 |
lemma sm_in_sqsms: |
|
251 |
"\<lbrakk>m \<in> set (msgs_of_queue s q); q \<in> current_msgqs s; valid s; cq2smsgq s q = Some (qi, qsec, sms); |
|
252 |
cm2smsg s q m = Some sm\<rbrakk> \<Longrightarrow> sm \<in> set sms" |
|
253 |
sorry |
|
254 |
||
255 |
||
256 |
||
257 |
(****************** cf2sfile path simpset ***************) |
|
11 | 258 |
|
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
|
259 |
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
|
260 |
"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
|
261 |
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
|
262 |
|
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
|
263 |
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
|
264 |
"\<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
|
265 |
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
|
266 |
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
|
267 |
|
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
|
268 |
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
|
269 |
"\<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
|
270 |
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
|
271 |
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
|
272 |
|
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
|
273 |
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
|
274 |
"\<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
|
275 |
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
|
276 |
|
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
|
277 |
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
|
278 |
"\<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
|
279 |
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
|
280 |
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
|
281 |
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
|
282 |
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
|
283 |
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
|
284 |
apply (auto dest!:current_has_sec' |
8 | 285 |
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
|
286 |
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
|
287 |
|
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
|
288 |
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
|
289 |
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
|
290 |
"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
|
291 |
|
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
|
292 |
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
|
293 |
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
|
294 |
"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
|
295 |
|
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
|
296 |
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
|
297 |
"\<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
|
298 |
(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
|
299 |
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
|
300 |
(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
|
301 |
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
|
302 |
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
|
303 |
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
|
304 |
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
|
305 |
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
|
306 |
|
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
|
307 |
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
|
308 |
"\<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
|
309 |
[] \<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
|
310 |
| 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
|
311 |
(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
|
312 |
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
|
313 |
(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
|
314 |
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
|
315 |
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
|
316 |
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
|
317 |
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
|
318 |
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
|
319 |
|
7 | 320 |
lemma sroot_set: |
321 |
"valid s \<Longrightarrow> \<exists> sec. sroot = (Init [], sec, None, {}) \<and> sectxt_of_obj s (O_dir []) = Some sec" |
|
322 |
apply (frule root_is_dir) |
|
323 |
apply (drule is_dir_has_sec, simp) |
|
324 |
apply (auto simp:sroot_def sec_of_root_def sectxt_of_obj_def type_of_obj.simps |
|
325 |
root_type_remains root_user_remains |
|
326 |
dest!:root_has_type' root_has_user' root_has_init_type' root_has_init_user' |
|
327 |
split:option.splits) |
|
328 |
done |
|
329 |
||
330 |
lemma cf2sfile_path_file: |
|
331 |
"\<lbrakk>is_file s (f # pf); valid s\<rbrakk> |
|
332 |
\<Longrightarrow> cf2sfile s (f # pf) = ( |
|
333 |
case (cf2sfile s pf) of |
|
334 |
Some (pfi, pfsec, psec, asecs) \<Rightarrow> |
|
335 |
(case (sectxt_of_obj s (O_file (f # pf))) of |
|
336 |
Some fsec \<Rightarrow> Some (if (\<not> deleted (O_file (f # pf)) s \<and> is_init_file (f # pf)) then Init (f # pf) |
|
337 |
else Created, fsec, Some pfsec, asecs \<union> {pfsec}) |
|
338 |
| None \<Rightarrow> None) |
|
339 |
| _ \<Rightarrow> None)" |
|
340 |
apply (frule is_file_in_current, drule parentf_is_dir'', simp) |
|
341 |
apply (frule is_dir_has_sfile, simp, frule is_file_has_sfile, simp) |
|
342 |
apply (frule sroot_set) |
|
343 |
apply (case_tac pf, (clarsimp simp:get_parentfs_ctxts'_def sectxt_of_pf_def)+) |
|
344 |
done |
|
345 |
||
346 |
lemma cf2sfile_path_dir: |
|
347 |
"\<lbrakk>is_dir s (f # pf); valid s\<rbrakk> |
|
348 |
\<Longrightarrow> cf2sfile s (f # pf) = ( |
|
349 |
case (cf2sfile s pf) of |
|
350 |
Some (pfi, pfsec, psec, asecs) \<Rightarrow> |
|
351 |
(case (sectxt_of_obj s (O_dir (f # pf))) of |
|
352 |
Some fsec \<Rightarrow> Some (if (\<not> deleted (O_dir (f # pf)) s \<and> is_init_dir (f # pf)) then Init (f # pf) |
|
353 |
else Created, fsec, Some pfsec, asecs \<union> {pfsec}) |
|
354 |
| None \<Rightarrow> None) |
|
355 |
| _ \<Rightarrow> None)" |
|
356 |
apply (frule is_dir_in_current, drule parentf_is_dir'', simp) |
|
357 |
apply (frule_tac f = "f # pf" in is_dir_has_sfile, simp) |
|
358 |
apply (frule_tac f = "pf" in is_dir_has_sfile, simp) |
|
359 |
apply (frule sroot_set) |
|
360 |
apply (case_tac pf, (clarsimp simp:get_parentfs_ctxts'_def sectxt_of_pf_def)+) |
|
361 |
done |
|
362 |
||
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
|
363 |
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
|
364 |
"\<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
|
365 |
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
|
366 |
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
|
367 |
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
|
368 |
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
|
369 |
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
|
370 |
| 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
|
371 |
else (case (sectxt_of_obj s (O_dir (f # pf))) of |
7 | 372 |
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
|
373 |
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
|
374 |
| 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
|
375 |
| None \<Rightarrow> None)" |
7 | 376 |
apply (drule is_file_or_dir, simp) |
377 |
apply (erule disjE) |
|
378 |
apply (frule cf2sfile_path_file, simp) defer |
|
379 |
apply (frule cf2sfile_path_dir, simp, drule is_dir_not_file) |
|
380 |
apply (auto split:option.splits) |
|
381 |
done |
|
382 |
||
8 | 383 |
lemma cf2sfile_path_file_prop1: |
384 |
"\<lbrakk>is_file s (f # pf); cf2sfile s pf = Some (pfi, pfsec, psec, asecs); valid s\<rbrakk> |
|
385 |
\<Longrightarrow> \<exists> fsec. cf2sfile s (f # pf) = |
|
386 |
Some (if (\<not> deleted (O_file (f # pf)) s \<and> is_init_file (f # pf)) then Init (f # pf) |
|
387 |
else Created, fsec, Some pfsec, asecs \<union> {pfsec}) \<and> |
|
388 |
sectxt_of_obj s (O_file (f # pf)) = Some fsec" |
|
389 |
apply (frule is_file_has_sfile, simp) |
|
390 |
by (auto simp:cf2sfile_path_file) |
|
7 | 391 |
|
8 | 392 |
lemma cf2sfile_path_file_prop2: |
393 |
"\<lbrakk>is_file s (f # pf); cf2sfile s pf = Some (pfi, pfsec, psec, asecs); |
|
394 |
sectxt_of_obj s (O_file (f # pf)) = Some fsec; valid s\<rbrakk> \<Longrightarrow> cf2sfile s (f # pf) = |
|
395 |
Some (if (\<not> deleted (O_file (f # pf)) s \<and> is_init_file (f # pf)) then Init (f # pf) |
|
396 |
else Created, fsec, Some pfsec, asecs \<union> {pfsec})" |
|
397 |
by (drule cf2sfile_path_file_prop1, auto) |
|
7 | 398 |
|
8 | 399 |
lemma cf2sfile_path_dir_prop1: |
400 |
"\<lbrakk>is_dir s (f # pf); cf2sfile s pf = Some (pfi, pfsec, psec, asecs); valid s\<rbrakk> |
|
401 |
\<Longrightarrow> \<exists> fsec. cf2sfile s (f # pf) = |
|
402 |
Some (if (\<not> deleted (O_dir (f # pf)) s \<and> is_init_dir (f # pf)) then Init (f # pf) |
|
403 |
else Created, fsec, Some pfsec, asecs \<union> {pfsec}) \<and> |
|
404 |
sectxt_of_obj s (O_dir (f # pf)) = Some fsec" |
|
405 |
apply (frule is_dir_has_sfile, simp) |
|
406 |
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
|
407 |
|
8 | 408 |
lemma cf2sfile_path_dir_prop2: |
409 |
"\<lbrakk>is_dir s (f # pf); cf2sfile s pf = Some (pfi, pfsec, psec, asecs); |
|
410 |
sectxt_of_obj s (O_dir (f # pf)) = Some fsec; valid s\<rbrakk> \<Longrightarrow> cf2sfile s (f # pf) = |
|
411 |
Some (if (\<not> deleted (O_dir (f # pf)) s \<and> is_init_dir (f # pf)) then Init (f # pf) |
|
412 |
else Created, fsec, Some pfsec, asecs \<union> {pfsec})" |
|
413 |
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
|
414 |
|
8 | 415 |
(**************** cf2sfile event list simpset ****************) |
4 | 416 |
|
8 | 417 |
lemma cf2sfile_open_none': |
418 |
"valid (Open p f flag fd None # s) \<Longrightarrow> cf2sfile (Open p f flag fd None # s) f'= cf2sfile s f'" |
|
4 | 419 |
apply (frule vd_cons, frule vt_grant_os) |
420 |
apply (induct f', simp add:cf2sfile_def) |
|
421 |
apply (simp add:cf2sfile_def is_file_simps is_dir_simps current_files_simps sectxt_of_obj_simps |
|
422 |
get_parentfs_ctxts_simps) |
|
423 |
done |
|
424 |
||
425 |
lemma cf2sfile_open_none: |
|
426 |
"valid (Open p f flag fd None # s) \<Longrightarrow> cf2sfile (Open p f flag fd None # s) = cf2sfile s" |
|
8 | 427 |
apply (rule ext) |
428 |
by (simp add:cf2sfile_open_none') |
|
1 | 429 |
|
430 |
lemma cf2sfile_open_some1: |
|
431 |
"\<lbrakk>valid (Open p f flag fd (Some inum) # s); f' \<in> current_files s\<rbrakk> |
|
432 |
\<Longrightarrow> cf2sfile (Open p f flag fd (Some inum) # s) f' = cf2sfile s f'" |
|
8 | 433 |
apply (frule vd_cons, frule vt_grant_os, frule noroot_events) |
4 | 434 |
apply (case_tac "f = f'", simp) |
435 |
apply (induct f', simp add:sroot_only, simp) |
|
3 | 436 |
apply (frule parentf_in_current', simp+) |
4 | 437 |
apply (simp add:cf2sfile_def is_file_simps is_dir_simps current_files_simps sectxt_of_obj_simps |
1 | 438 |
get_parentfs_ctxts_simps) |
439 |
done |
|
440 |
||
441 |
lemma cf2sfile_open_some2: |
|
442 |
"\<lbrakk>valid (Open p f flag fd (Some inum) # s); is_file s f'\<rbrakk> |
|
8 | 443 |
\<Longrightarrow> cf2sfile (Open p f flag fd (Some inum) # s) f' = cf2sfile s f'" |
1 | 444 |
apply (frule vd_cons, drule is_file_in_current) |
445 |
by (simp add:cf2sfile_open_some1) |
|
446 |
||
447 |
lemma cf2sfile_open_some3: |
|
448 |
"\<lbrakk>valid (Open p f flag fd (Some inum) # s); is_dir s f'\<rbrakk> |
|
8 | 449 |
\<Longrightarrow> cf2sfile (Open p f flag fd (Some inum) # s) f' = cf2sfile s f'" |
1 | 450 |
apply (frule vd_cons, drule is_dir_in_current) |
451 |
by (simp add:cf2sfile_open_some1) |
|
452 |
||
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
|
453 |
lemma cf2sfile_open_some4: |
8 | 454 |
"valid (Open p f flag fd (Some inum) # s) \<Longrightarrow> cf2sfile (Open p f flag fd (Some inum) # s) f = ( |
1 | 455 |
case (parent f) of |
456 |
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), |
|
457 |
get_parentfs_ctxts s pf) of |
|
458 |
(Some sec, Some psec, Some asecs) \<Rightarrow> Some (Created, sec, Some psec, set asecs) |
|
459 |
| _ \<Rightarrow> None) |
|
460 |
| None \<Rightarrow> None)" |
|
461 |
apply (frule vd_cons, frule vt_grant_os, frule noroot_events) |
|
4 | 462 |
apply (case_tac f, simp) |
463 |
apply (simp add:cf2sfile_def is_file_simps is_dir_simps current_files_simps sectxt_of_obj_simps |
|
464 |
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
|
465 |
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
|
466 |
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
|
467 |
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
|
468 |
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
|
469 |
|
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
|
470 |
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
|
471 |
"\<lbrakk>valid (Open p f flag fd opt # s); f' \<in> current_files (Open p f flag fd opt # s)\<rbrakk> |
8 | 472 |
\<Longrightarrow> cf2sfile (Open p f flag fd opt # s) f' = ( |
473 |
if (opt = None) then cf2sfile s f' |
|
474 |
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
|
475 |
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
|
476 |
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
|
477 |
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
|
478 |
(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
|
479 |
| _ \<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
|
480 |
| None \<Rightarrow> None) |
8 | 481 |
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
|
482 |
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
|
483 |
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
|
484 |
apply (case_tac "f = f'") |
8 | 485 |
apply (simp add:cf2sfile_open_some4 split:option.splits) |
486 |
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
|
487 |
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
|
488 |
|
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 |
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
|
490 |
"\<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
|
491 |
\<Longrightarrow> cf2sfile (Mkdir p f i # s) f' = cf2sfile s f'" |
8 | 492 |
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
|
493 |
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
|
494 |
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
|
495 |
apply (frule parentf_in_current', simp+) |
8 | 496 |
apply (case_tac "f = f'", simp) |
497 |
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
|
498 |
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
|
499 |
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
|
500 |
|
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
|
501 |
lemma cf2sfile_mkdir2: |
8 | 502 |
"\<lbrakk>valid (Mkdir p f i # s); is_file s f'\<rbrakk> |
503 |
\<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
|
504 |
apply (frule vd_cons, drule is_file_in_current) |
8 | 505 |
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
|
506 |
|
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
|
507 |
lemma cf2sfile_mkdir3: |
8 | 508 |
"\<lbrakk>valid (Mkdir p f i # s); is_dir s f'\<rbrakk> |
509 |
\<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
|
510 |
apply (frule vd_cons, drule is_dir_in_current) |
8 | 511 |
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
|
512 |
|
8 | 513 |
lemma cf2sfile_mkdir4: |
514 |
"valid (Mkdir p f i # s) |
|
515 |
\<Longrightarrow> cf2sfile (Mkdir p f i # s) f = (case (parent f) of |
|
516 |
Some pf \<Rightarrow> (case (sectxt_of_obj (Mkdir p f i # s) (O_dir f), sectxt_of_obj s (O_dir pf), |
|
517 |
get_parentfs_ctxts s pf) of |
|
518 |
(Some sec, Some psec, Some asecs) \<Rightarrow> Some (Created, sec, Some psec, set asecs) |
|
519 |
| _ \<Rightarrow> None) |
|
520 |
| None \<Rightarrow> None)" |
|
521 |
apply (frule vd_cons, frule vt_grant_os, frule noroot_events) |
|
522 |
apply (case_tac f, simp) |
|
523 |
apply (clarsimp simp:os_grant.simps) |
|
524 |
apply (simp add:sectxt_of_obj_simps) |
|
525 |
apply (frule current_proc_has_sec, simp) |
|
526 |
apply (frule is_dir_has_sec, simp) |
|
527 |
apply (frule get_pfs_secs_prop, simp) |
|
528 |
apply (frule is_dir_not_file) |
|
529 |
apply (auto simp add:cf2sfile_def is_file_simps is_dir_simps current_files_simps sectxt_of_obj_simps |
|
530 |
get_parentfs_ctxts_simps split:option.splits if_splits |
|
531 |
dest:not_deleted_init_dir is_dir_in_current not_deleted_init_file is_file_in_current) |
|
532 |
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
|
533 |
|
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
|
534 |
lemma cf2sfile_mkdir: |
8 | 535 |
"\<lbrakk>valid (Mkdir p f i # s); f' \<in> current_files (Mkdir p f i # s)\<rbrakk> |
536 |
\<Longrightarrow> cf2sfile (Mkdir p f i # s) f' = ( |
|
537 |
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
|
538 |
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
|
539 |
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
|
540 |
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
|
541 |
(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
|
542 |
| _ \<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
|
543 |
| None \<Rightarrow> None) |
8 | 544 |
else cf2sfile s f')" |
545 |
apply (case_tac "f = f'") |
|
546 |
apply (simp add:cf2sfile_mkdir4 split:option.splits) |
|
547 |
apply (simp add:cf2sfile_mkdir1 current_files_simps) |
|
548 |
done |
|
549 |
||
550 |
lemma cf2sfile_linkhard1: |
|
551 |
"\<lbrakk>valid (LinkHard p oldf f # s); f' \<in> current_files s\<rbrakk> |
|
552 |
\<Longrightarrow> cf2sfile (LinkHard p oldf f# s) f' = cf2sfile s f'" |
|
553 |
apply (frule vd_cons, frule vt_grant_os, frule noroot_events) |
|
554 |
apply (case_tac "f = f'", simp) |
|
555 |
apply (induct f', simp add:sroot_only, simp) |
|
556 |
apply (frule parentf_in_current', simp+) |
|
557 |
apply (simp add:cf2sfile_def is_file_simps is_dir_simps current_files_simps sectxt_of_obj_simps |
|
558 |
get_parentfs_ctxts_simps split:if_splits option.splits) |
|
559 |
done |
|
560 |
||
561 |
lemma cf2sfile_linkhard2: |
|
562 |
"\<lbrakk>valid (LinkHard p oldf f # s); is_file s f'\<rbrakk> |
|
563 |
\<Longrightarrow> cf2sfile (LinkHard p oldf f # s) f' = cf2sfile s f'" |
|
564 |
apply (frule vd_cons, drule is_file_in_current) |
|
565 |
by (simp add:cf2sfile_linkhard1) |
|
566 |
||
567 |
lemma cf2sfile_linkhard3: |
|
568 |
"\<lbrakk>valid (LinkHard p oldf f # s); is_dir s f'\<rbrakk> |
|
569 |
\<Longrightarrow> cf2sfile (LinkHard p oldf f # s) f' = cf2sfile s f'" |
|
570 |
apply (frule vd_cons, drule is_dir_in_current) |
|
571 |
by (simp add:cf2sfile_linkhard1) |
|
572 |
||
573 |
lemma cf2sfile_linkhard4: |
|
574 |
"valid (LinkHard p oldf f # s) |
|
575 |
\<Longrightarrow> cf2sfile (LinkHard p oldf f # s) f = (case (parent f) of |
|
576 |
Some pf \<Rightarrow> (case (sectxt_of_obj (LinkHard p oldf f # s) (O_file f), sectxt_of_obj s (O_dir pf), |
|
577 |
get_parentfs_ctxts s pf) of |
|
578 |
(Some sec, Some psec, Some asecs) \<Rightarrow> Some (Created, sec, Some psec, set asecs) |
|
579 |
| _ \<Rightarrow> None) |
|
580 |
| None \<Rightarrow> None)" |
|
581 |
apply (frule vd_cons, frule vt_grant_os, frule noroot_events) |
|
582 |
apply (case_tac f, simp) |
|
583 |
apply (simp add:cf2sfile_def is_file_simps is_dir_simps current_files_simps sectxt_of_obj_simps |
|
584 |
get_parentfs_ctxts_simps) |
|
585 |
apply (rule impI, (erule conjE)+) |
|
586 |
apply (drule not_deleted_init_file, simp+) |
|
587 |
apply (simp add:is_file_in_current) |
|
588 |
done |
|
589 |
||
590 |
lemma cf2sfile_linkhard: |
|
591 |
"\<lbrakk>valid (LinkHard p oldf f # s); f' \<in> current_files (LinkHard p oldf f # s)\<rbrakk> |
|
592 |
\<Longrightarrow> cf2sfile (LinkHard p oldf f # s) f' = ( |
|
593 |
if (f' = f) |
|
594 |
then (case (parent f) of |
|
595 |
Some pf \<Rightarrow> (case (sectxt_of_obj (LinkHard p oldf f # s) (O_file f), sectxt_of_obj s (O_dir pf), |
|
596 |
get_parentfs_ctxts s pf) of |
|
597 |
(Some sec, Some psec, Some asecs) \<Rightarrow> Some (Created, sec, Some psec, set asecs) |
|
598 |
| _ \<Rightarrow> None) |
|
599 |
| None \<Rightarrow> None) |
|
600 |
else cf2sfile s f')" |
|
601 |
apply (case_tac "f = f'") |
|
602 |
apply (simp add:cf2sfile_linkhard4 split:option.splits) |
|
603 |
apply (simp add:cf2sfile_linkhard1 current_files_simps) |
|
604 |
done |
|
605 |
||
606 |
lemma cf2sfile_other: |
|
607 |
"\<lbrakk>ff \<in> current_files s; |
|
608 |
\<forall> p f flag fd opt. e \<noteq> Open p f flag fd opt; |
|
609 |
\<forall> p fd. e \<noteq> CloseFd p fd; |
|
610 |
\<forall> p f. e \<noteq> UnLink p f; |
|
611 |
\<forall> p f. e \<noteq> Rmdir p f; |
|
612 |
\<forall> p f i. e \<noteq> Mkdir p f i; |
|
613 |
\<forall> p f f'. e \<noteq> LinkHard p f f'; |
|
614 |
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
|
615 |
apply (frule vd_cons, frule vt_grant_os) |
8 | 616 |
apply (induct ff, simp add:sroot_only) |
617 |
apply (frule parentf_in_current', simp+, case_tac e) |
|
618 |
apply (auto simp:current_files_simps is_file_simps is_dir_simps sectxt_of_obj_simps cf2sfile_path |
|
619 |
split:if_splits option.splits) |
|
620 |
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
|
621 |
|
10 | 622 |
lemma cf2sfile_other': |
623 |
"\<lbrakk>valid (e # s); |
|
624 |
\<forall> p f flag fd opt. e \<noteq> Open p f flag fd opt; |
|
625 |
\<forall> p fd. e \<noteq> CloseFd p fd; |
|
626 |
\<forall> p f. e \<noteq> UnLink p f; |
|
627 |
\<forall> p f. e \<noteq> Rmdir p f; |
|
628 |
\<forall> p f i. e \<noteq> Mkdir p f i; |
|
629 |
\<forall> p f f'. e \<noteq> LinkHard p f f'; |
|
630 |
ff \<in> current_files s\<rbrakk> \<Longrightarrow> cf2sfile (e # s) ff = cf2sfile s ff" |
|
631 |
by (auto intro!:cf2sfile_other) |
|
632 |
||
8 | 633 |
lemma cf2sfile_unlink: |
634 |
"\<lbrakk>valid (UnLink p f # s); f' \<in> current_files (UnLink p f # s)\<rbrakk> |
|
635 |
\<Longrightarrow> cf2sfile (UnLink p f # s) f' = cf2sfile s f'" |
|
636 |
apply (frule vd_cons, frule vt_grant_os) |
|
637 |
apply (simp add:current_files_simps split:if_splits) |
|
638 |
apply (auto simp:cf2sfile_def sectxt_of_obj_simps get_parentfs_ctxts_simps is_file_simps is_dir_simps |
|
10 | 639 |
split:if_splits option.splits) |
1 | 640 |
done |
641 |
||
10 | 642 |
lemma cf2sfile_rmdir: |
643 |
"\<lbrakk>valid (Rmdir p f # s); f' \<in> current_files (Rmdir p f # s)\<rbrakk> |
|
644 |
\<Longrightarrow> cf2sfile (Rmdir p f # s) f' = cf2sfile s f'" |
|
645 |
apply (frule vd_cons, frule vt_grant_os) |
|
646 |
apply (simp add:current_files_simps split:if_splits) |
|
647 |
apply (auto simp:cf2sfile_def sectxt_of_obj_simps get_parentfs_ctxts_simps is_file_simps is_dir_simps |
|
648 |
split:if_splits option.splits) |
|
1 | 649 |
done |
650 |
||
10 | 651 |
lemma pfdof_simp5: "\<lbrakk>proc_fd_of_file s f = {(p, fd)}; file_of_proc_fd s p fd = None\<rbrakk> \<Longrightarrow> False" |
652 |
apply (subgoal_tac "(p, fd) \<in> proc_fd_of_file s f") |
|
653 |
by (simp add:pfdof_simp2, simp) |
|
654 |
||
655 |
lemma pfdof_simp6: "proc_fd_of_file s f = {(p, fd)} \<Longrightarrow> file_of_proc_fd s p fd = Some f" |
|
656 |
apply (subgoal_tac "(p, fd) \<in> proc_fd_of_file s f") |
|
657 |
by (simp add:pfdof_simp2, simp) |
|
658 |
||
659 |
lemma cf2sfile_closefd: |
|
660 |
"\<lbrakk>valid (CloseFd p fd # s); f \<in> current_files (CloseFd p fd # s)\<rbrakk> |
|
661 |
\<Longrightarrow> cf2sfile (CloseFd p fd # s) f = cf2sfile s f" |
|
662 |
apply (frule vd_cons, frule vt_grant_os) |
|
663 |
apply (simp add:current_files_simps split:if_splits option.splits) |
|
664 |
(* costs too much time, but solved |
|
665 |
||
666 |
apply (auto simp:cf2sfile_def sectxt_of_obj_simps get_parentfs_ctxts_simps is_file_simps is_dir_simps |
|
667 |
split:if_splits option.splits |
|
668 |
dest:init_file_dir_conflict pfdof_simp5 pfdof_simp6 file_of_pfd_is_file |
|
669 |
not_deleted_init_file not_deleted_init_dir is_file_not_dir is_dir_not_file |
|
670 |
dest!:current_has_sec') |
|
671 |
done |
|
672 |
*) |
|
673 |
sorry |
|
1 | 674 |
|
10 | 675 |
lemmas cf2sfile_simps = cf2sfile_open cf2sfile_mkdir cf2sfile_linkhard cf2sfile_other |
676 |
cf2sfile_unlink cf2sfile_rmdir cf2sfile_closefd |
|
677 |
||
678 |
(*********** cfd2sfd simpset *********) |
|
679 |
||
680 |
lemma cfd2sfd_open1: |
|
681 |
"valid (Open p f flags fd opt # s) |
|
682 |
\<Longrightarrow> cfd2sfd (Open p f flags fd opt # s) p fd = |
|
683 |
(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 |
|
684 |
(Some sec, Some sf) \<Rightarrow> Some (sec, flags, sf) |
|
685 |
| _ \<Rightarrow> None)" |
|
686 |
by (simp add:cfd2sfd_def sectxt_of_obj_simps split:if_splits) |
|
1 | 687 |
|
10 | 688 |
lemma cfd2sfd_open_some2: |
689 |
"\<lbrakk>valid (Open p f flags fd (Some inum) # s); file_of_proc_fd s p' fd' = Some f'\<rbrakk> |
|
690 |
\<Longrightarrow> cfd2sfd (Open p f flags fd (Some inum) # s) p' fd' = cfd2sfd s p' fd'" |
|
691 |
apply (frule vd_cons, frule vt_grant_os) |
|
692 |
apply (frule proc_fd_in_fds, simp) |
|
693 |
apply (frule file_of_proc_fd_in_curf, simp) |
|
694 |
apply (case_tac "f = f'", simp) |
|
695 |
apply (simp add:cfd2sfd_def sectxt_of_obj_simps cf2sfile_open_some1) |
|
696 |
apply (case_tac "p = p'", simp) |
|
697 |
apply (rule conjI, rule impI, simp) |
|
698 |
apply (drule cf2sfile_open_some1, simp) |
|
699 |
apply (auto split:option.splits)[1] |
|
700 |
apply simp |
|
701 |
apply (drule cf2sfile_open_some1, simp) |
|
702 |
apply (auto split:option.splits)[1] |
|
1 | 703 |
done |
704 |
||
10 | 705 |
lemma cfd2sfd_open_none2: |
706 |
"\<lbrakk>valid (Open p f flags fd None # s); file_of_proc_fd s p' fd' = Some f'\<rbrakk> |
|
707 |
\<Longrightarrow> cfd2sfd (Open p f flags fd None # s) p' fd' = cfd2sfd s p' fd'" |
|
708 |
apply (frule vd_cons, frule vt_grant_os) |
|
709 |
apply (frule proc_fd_in_fds, simp) |
|
710 |
apply (frule file_of_proc_fd_in_curf, simp) |
|
711 |
apply (simp add:cfd2sfd_def sectxt_of_obj_simps cf2sfile_open_none) |
|
712 |
apply (case_tac "p = p'", simp) |
|
713 |
apply (rule conjI, rule impI, simp) |
|
714 |
apply (drule cf2sfile_open_none) |
|
715 |
apply (auto split:option.splits)[1] |
|
716 |
apply simp |
|
717 |
apply (drule cf2sfile_open_none) |
|
718 |
apply (auto split:option.splits)[1] |
|
719 |
done |
|
720 |
||
721 |
lemma cfd2sfd_open2: |
|
722 |
"\<lbrakk>valid (Open p f flags fd opt # s); file_of_proc_fd s p' fd' = Some f'\<rbrakk> |
|
723 |
\<Longrightarrow> cfd2sfd (Open p f flags fd opt # s) p' fd' = cfd2sfd s p' fd'" |
|
724 |
apply (case_tac opt) |
|
725 |
apply (simp add:cfd2sfd_open_none2) |
|
726 |
apply (simp add:cfd2sfd_open_some2) |
|
1 | 727 |
done |
728 |
||
10 | 729 |
lemma cfd2sfd_open: |
730 |
"\<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> |
|
731 |
\<Longrightarrow> cfd2sfd (Open p f flags fd opt # s) p' fd' = (if (p' = p \<and> fd' = fd) then |
|
732 |
(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 |
|
733 |
(Some sec, Some sf) \<Rightarrow> Some (sec, flags, sf) |
|
734 |
| _ \<Rightarrow> None) else cfd2sfd s p' fd')" |
|
735 |
apply (simp split:if_splits) |
|
736 |
apply (simp add:cfd2sfd_open1 split:option.splits) |
|
737 |
apply (simp add:cfd2sfd_open2) |
|
738 |
apply (rule impI, simp) |
|
1 | 739 |
done |
740 |
||
10 | 741 |
lemma cfd2sfd_closefd: |
742 |
"\<lbrakk>valid (CloseFd p fd # s); file_of_proc_fd (CloseFd p fd # s) p' fd' = Some f\<rbrakk> |
|
743 |
\<Longrightarrow> cfd2sfd (CloseFd p fd # s) p' fd' = cfd2sfd s p' fd'" |
|
744 |
apply (frule vd_cons, frule vt_grant_os) |
|
745 |
apply (frule proc_fd_in_fds, simp) |
|
746 |
apply (frule file_of_proc_fd_in_curf, simp) |
|
747 |
apply (frule cf2sfile_closefd, simp) |
|
748 |
apply (simp add:cfd2sfd_def sectxt_of_obj_simps) |
|
749 |
apply (auto split:option.splits if_splits) |
|
750 |
done |
|
1 | 751 |
|
10 | 752 |
lemma cfd2sfd_clone: |
753 |
"\<lbrakk>valid (Clone p p' fds shms # s); file_of_proc_fd (Clone p p' fds shms # s) p'' fd' = Some f\<rbrakk> |
|
754 |
\<Longrightarrow> cfd2sfd (Clone p p' fds shms # s) p'' fd' = ( |
|
755 |
if (p'' = p') then cfd2sfd s p fd' |
|
756 |
else cfd2sfd s p'' fd')" |
|
757 |
apply (frule vd_cons, frule vt_grant_os) |
|
758 |
apply (frule proc_fd_in_fds, simp) |
|
759 |
apply (frule file_of_proc_fd_in_curf, simp, simp add:current_files_simps) |
|
760 |
apply (frule_tac cf2sfile_other', simp+) |
|
761 |
apply (simp add:cfd2sfd_def sectxt_of_obj_simps) |
|
762 |
apply (case_tac "p'' = p'", simp) |
|
763 |
apply (auto split:option.splits if_splits)[1] |
|
764 |
apply (simp) |
|
765 |
apply (auto split:option.splits if_splits)[1] |
|
1 | 766 |
done |
767 |
||
10 | 768 |
lemma cfd2sfd_execve: |
769 |
"\<lbrakk>valid (Execve p f fds # s); file_of_proc_fd (Execve p f fds # s) p' fd' = Some f'\<rbrakk> |
|
770 |
\<Longrightarrow> cfd2sfd (Execve p f fds # s) p' fd' = cfd2sfd s p' fd'" |
|
771 |
apply (frule vd_cons, frule vt_grant_os) |
|
772 |
apply (frule proc_fd_in_fds, simp) |
|
773 |
apply (frule file_of_proc_fd_in_curf, simp, simp add:current_files_simps) |
|
774 |
apply (frule_tac cf2sfile_other', simp+) |
|
775 |
apply (simp add:cfd2sfd_def sectxt_of_obj_simps) |
|
776 |
apply (case_tac "p' = p", simp) |
|
777 |
apply (auto split:option.splits if_splits)[1] |
|
778 |
apply (simp) |
|
779 |
apply (auto split:option.splits if_splits)[1] |
|
1 | 780 |
done |
781 |
||
10 | 782 |
lemma cfd2sfd_kill: |
783 |
"\<lbrakk>valid (Kill p p'' # s); file_of_proc_fd (Kill p p'' # s) p' fd' = Some f'\<rbrakk> |
|
784 |
\<Longrightarrow> cfd2sfd (Kill p p'' # s) p' fd' = cfd2sfd s p' fd'" |
|
785 |
apply (frule vd_cons, frule vt_grant_os) |
|
786 |
apply (frule proc_fd_in_fds, simp) |
|
787 |
apply (frule proc_fd_in_procs, simp) |
|
788 |
apply (frule file_of_proc_fd_in_curf, simp, simp add:current_files_simps) |
|
789 |
apply (frule_tac cf2sfile_other', simp+) |
|
790 |
apply (simp add:cfd2sfd_def sectxt_of_obj_simps) |
|
791 |
apply (auto split:option.splits if_splits) |
|
1 | 792 |
done |
793 |
||
10 | 794 |
lemma cfd2sfd_exit: |
795 |
"\<lbrakk>valid (Exit p # s); file_of_proc_fd (Exit p # s) p' fd' = Some f'\<rbrakk> |
|
796 |
\<Longrightarrow> cfd2sfd (Exit p # s) p' fd' = cfd2sfd s p' fd'" |
|
797 |
apply (frule vd_cons, frule vt_grant_os) |
|
798 |
apply (frule proc_fd_in_fds, simp) |
|
799 |
apply (frule proc_fd_in_procs, simp) |
|
800 |
apply (frule file_of_proc_fd_in_curf, simp, simp add:current_files_simps) |
|
801 |
apply (frule_tac cf2sfile_other', simp+) |
|
802 |
apply (simp add:cfd2sfd_def sectxt_of_obj_simps) |
|
803 |
apply (auto split:option.splits if_splits) |
|
1 | 804 |
done |
805 |
||
10 | 806 |
lemma cfd2sfd_other: |
807 |
"\<lbrakk>valid (e # s); file_of_proc_fd (e # s) p' fd' = Some f'; |
|
808 |
\<forall> p f flags fd opt. e \<noteq> Open p f flags fd opt; |
|
809 |
\<forall> p p'' fds shms. e \<noteq> Clone p p'' fds shms\<rbrakk> |
|
810 |
\<Longrightarrow> cfd2sfd (e # s) p' fd' = cfd2sfd s p' fd'" |
|
811 |
apply (frule vd_cons, frule vt_grant_os) |
|
812 |
apply (frule proc_fd_in_fds, simp) |
|
813 |
apply (frule proc_fd_in_procs, simp) |
|
814 |
apply (frule file_of_proc_fd_in_curf, simp) |
|
815 |
apply (case_tac e) |
|
816 |
apply (auto intro!:cfd2sfd_execve cfd2sfd_closefd cfd2sfd_kill cfd2sfd_exit) |
|
817 |
apply (auto simp:cfd2sfd_def sectxt_of_obj_simps current_files_simps cf2sfile_simps split:option.splits) |
|
818 |
apply (auto dest!:current_has_sec' dest:file_of_proc_fd_in_curf proc_fd_in_fds) |
|
819 |
done |
|
820 |
||
821 |
lemmas cfd2sfd_simps = cfd2sfd_open cfd2sfd_clone cfd2sfd_other |
|
822 |
||
823 |
(********** cpfd2sfds simpset **********) |
|
824 |
||
825 |
lemma current_filefd_has_flags: |
|
826 |
"\<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" |
|
827 |
apply (induct s arbitrary:p) |
|
828 |
apply (simp only:flags_of_proc_fd.simps file_of_proc_fd.simps init_filefd_prop4) |
|
829 |
apply (frule vd_cons, frule vt_grant_os, case_tac a) |
|
830 |
apply (auto split:if_splits option.splits dest:proc_fd_in_fds) |
|
831 |
done |
|
832 |
||
833 |
lemma current_filefd_has_flags': |
|
834 |
"\<lbrakk>flags_of_proc_fd s p fd = None; valid s\<rbrakk> \<Longrightarrow> file_of_proc_fd s p fd = None" |
|
835 |
apply (case_tac "file_of_proc_fd s p fd") |
|
836 |
apply (simp, drule current_filefd_has_flags, simp+) |
|
1 | 837 |
done |
838 |
||
10 | 839 |
lemma current_file_has_sfile': |
840 |
"\<lbrakk>cf2sfile s f = None; valid s\<rbrakk> \<Longrightarrow> f \<notin> current_files s" |
|
841 |
by (rule notI, drule current_file_has_sfile, simp+) |
|
1 | 842 |
|
10 | 843 |
lemma current_filefd_has_sfd: |
844 |
"\<lbrakk>file_of_proc_fd s p fd = Some f; valid s\<rbrakk> \<Longrightarrow> \<exists>sfd. cfd2sfd s p fd = Some sfd" |
|
845 |
by (auto simp:cfd2sfd_def split:option.splits dest!:current_has_sec' current_file_has_sfile' |
|
846 |
dest:file_of_proc_fd_in_curf proc_fd_in_fds current_filefd_has_flags) |
|
847 |
||
848 |
lemma current_filefd_has_sfd': |
|
849 |
"\<lbrakk>cfd2sfd s p fd = None; valid s\<rbrakk> \<Longrightarrow> file_of_proc_fd s p fd = None" |
|
850 |
by (case_tac "file_of_proc_fd s p fd", auto dest:current_filefd_has_sfd) |
|
1 | 851 |
|
12 | 852 |
lemma cpfd2sfds_open1: |
853 |
"valid (Open p f flags fd opt # s) \<Longrightarrow> |
|
854 |
cpfd2sfds (Open p f flags fd opt # s) p = ( |
|
855 |
case (cfd2sfd (Open p f flags fd opt # s) p fd) of |
|
10 | 856 |
Some sfd \<Rightarrow> (cpfd2sfds s p) \<union> {sfd} |
857 |
| _ \<Rightarrow> cpfd2sfds s p)" |
|
858 |
apply (frule vd_cons, frule vt_grant_os) |
|
859 |
apply (split option.splits) |
|
860 |
apply (rule conjI, rule impI, drule current_filefd_has_sfd', simp, simp) |
|
861 |
apply (rule allI, rule impI) |
|
862 |
apply (rule set_eqI, rule iffI) |
|
12 | 863 |
apply (case_tac "x = a", simp) |
10 | 864 |
unfolding cpfd2sfds_def |
13 | 865 |
apply (erule CollectE, (erule conjE|erule bexE)+) |
866 |
apply (simp add:proc_file_fds_def split:if_splits) |
|
867 |
apply (erule exE, rule_tac x = fda in exI) |
|
868 |
apply (simp add:cfd2sfd_open2) |
|
869 |
apply (case_tac "x = a", simp add:proc_file_fds_def) |
|
12 | 870 |
apply (rule_tac x = fd in exI, simp+) |
13 | 871 |
apply (erule conjE|erule bexE)+ |
872 |
apply (rule_tac x = fda in bexI) |
|
873 |
apply (simp add:proc_file_fds_def, erule exE) |
|
874 |
apply (simp add:cfd2sfd_open2) |
|
875 |
apply (simp add:proc_file_fds_def) |
|
12 | 876 |
done |
1 | 877 |
|
12 | 878 |
lemma cpfd2sfds_open1': |
10 | 879 |
"valid (Open p f flags fd opt # s) \<Longrightarrow> |
880 |
cpfd2sfds (Open p f flags fd opt # s) p = ( |
|
881 |
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 |
|
882 |
(Some sec, Some sf) \<Rightarrow> (cpfd2sfds s p) \<union> {(sec, flags, sf)} |
|
883 |
| _ \<Rightarrow> cpfd2sfds s p)" |
|
884 |
apply (frule cfd2sfd_open1) |
|
12 | 885 |
apply (auto dest:cpfd2sfds_open1 split:option.splits) |
886 |
done |
|
887 |
||
888 |
lemma cpfd2sfds_open2: |
|
889 |
"\<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'" |
|
890 |
apply (frule vt_grant_os, frule vd_cons) |
|
891 |
unfolding cpfd2sfds_def |
|
892 |
apply (rule set_eqI, rule iffI) |
|
13 | 893 |
apply (simp add:proc_file_fds_def) |
894 |
apply (erule exE|erule conjE)+ |
|
12 | 895 |
apply (simp only:file_of_proc_fd.simps cfd2sfd_open2 split:if_splits) |
13 | 896 |
apply (rule_tac x = fda in exI, simp) |
897 |
apply (simp add:proc_file_fds_def) |
|
898 |
apply (erule exE|erule conjE)+ |
|
12 | 899 |
apply (rule_tac x = fda in exI, simp add:cfd2sfd_open2) |
900 |
done |
|
1 | 901 |
|
10 | 902 |
lemma cpfd2sfds_open: |
903 |
"valid (Open p f flags fd opt # s) |
|
904 |
\<Longrightarrow> cpfd2sfds (Open p f flags fd opt # s) = (cpfd2sfds s) (p := ( |
|
905 |
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 |
|
906 |
(Some sec, Some sf) \<Rightarrow> (cpfd2sfds s p) \<union> {(sec, flags, sf)} |
|
907 |
| _ \<Rightarrow> cpfd2sfds s p))" |
|
908 |
apply (rule ext) |
|
12 | 909 |
apply (case_tac "x \<noteq> p") |
910 |
apply (simp add:cpfd2sfds_open2) |
|
911 |
apply (simp add:cpfd2sfds_open1') |
|
912 |
done |
|
1 | 913 |
|
12 | 914 |
lemma cpfd2sfds_execve: |
13 | 915 |
"valid (Execve p f fds # s) |
916 |
\<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})" |
|
917 |
apply (frule vd_cons, frule vt_grant_os) |
|
918 |
apply (rule ext) |
|
919 |
apply (rule set_eqI, rule iffI) |
|
920 |
unfolding cpfd2sfds_def proc_file_fds_def |
|
921 |
apply (erule CollectE| erule bexE| erule conjE| erule exE| rule conjI)+ |
|
922 |
apply (simp split:if_splits) |
|
923 |
apply (frule_tac p' = p and fd' = fd in cfd2sfd_other, simp+) |
|
924 |
apply (rule_tac x = fd in bexI, simp+) |
|
925 |
apply (simp add:cpfd2sfds_def proc_file_fds_def) |
|
926 |
apply (frule_tac p' = x and fd' = fd in cfd2sfd_other, simp+) |
|
927 |
apply (rule_tac x = fd in exI, simp) |
|
928 |
apply (simp split:if_splits) |
|
929 |
apply (erule CollectE| erule bexE| erule conjE| erule exE| rule conjI)+ |
|
930 |
apply (rule_tac x = fd in exI, simp) |
|
931 |
apply (frule_tac p' = x and fd' = fd in cfd2sfd_other, simp+) |
|
932 |
apply (simp add:cpfd2sfds_def proc_file_fds_def) |
|
933 |
apply (erule CollectE| erule bexE| erule conjE| erule exE| rule conjI)+ |
|
934 |
apply (rule_tac x = fd in exI, simp) |
|
935 |
apply (frule_tac p' = x and fd' = fd in cfd2sfd_other, simp+) |
|
936 |
done |
|
937 |
||
938 |
lemma cpfd2sfds_clone: |
|
939 |
"valid (Clone p p' fds shms # s) |
|
940 |
\<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})" |
|
941 |
apply (frule vd_cons, frule vt_grant_os) |
|
942 |
apply (rule ext) |
|
943 |
apply (rule set_eqI, rule iffI) |
|
944 |
unfolding cpfd2sfds_def proc_file_fds_def |
|
945 |
apply (erule CollectE| erule bexE| erule conjE| erule exE| rule conjI)+ |
|
946 |
apply (simp split:if_splits) |
|
947 |
apply (frule_tac p'' = p' and fd' = fd in cfd2sfd_clone, simp+) |
|
948 |
apply (rule_tac x = fd in bexI, simp+) |
|
949 |
apply (simp add:cpfd2sfds_def proc_file_fds_def) |
|
950 |
apply (frule_tac p'' = x and fd' = fd in cfd2sfd_clone, simp+) |
|
951 |
apply (rule_tac x = fd in exI, simp) |
|
952 |
apply (simp split:if_splits) |
|
953 |
apply (erule CollectE| erule bexE| erule conjE| erule exE| rule conjI)+ |
|
954 |
apply (rule_tac x = fd in exI, simp) |
|
955 |
apply (frule_tac p'' = p' and fd' = fd in cfd2sfd_clone, simp+) |
|
956 |
apply (simp add:cpfd2sfds_def proc_file_fds_def) |
|
957 |
apply (erule CollectE| erule bexE| erule conjE| erule exE| rule conjI)+ |
|
958 |
apply (rule_tac x = fd in exI, simp) |
|
959 |
apply (frule_tac p'' = x and fd' = fd in cfd2sfd_clone, simp+) |
|
960 |
done |
|
12 | 961 |
|
962 |
lemma cpfd2sfds_other: |
|
963 |
"\<lbrakk>valid (e # s); |
|
13 | 964 |
\<forall> p f flags fd opt. e \<noteq> Open p f flags fd opt; |
965 |
\<forall> p f fds. e \<noteq> Execve p f fds; |
|
966 |
\<forall> p p'. e \<noteq> Kill p p'; |
|
967 |
\<forall> p. e \<noteq> Exit p; |
|
968 |
\<forall> p fd. e \<noteq> CloseFd p fd; |
|
969 |
\<forall> p p' fds shms. e \<noteq> Clone p p' fds shms\<rbrakk> \<Longrightarrow> cpfd2sfds (e # s) = cpfd2sfds s" |
|
970 |
apply (frule vd_cons, frule vt_grant_os) |
|
971 |
apply (rule ext) |
|
972 |
unfolding cpfd2sfds_def proc_file_fds_def |
|
973 |
apply (case_tac e) |
|
974 |
using cfd2sfd_other |
|
975 |
by auto |
|
976 |
||
977 |
lemma cpfd2sfds_kill: |
|
978 |
"valid (Kill p p' # s) \<Longrightarrow> cpfd2sfds (Kill p p' # s) = (cpfd2sfds s) (p' := {})" |
|
979 |
apply (frule vd_cons, frule vt_grant_os) |
|
980 |
apply (rule ext, rule set_eqI) |
|
981 |
unfolding cpfd2sfds_def proc_file_fds_def |
|
982 |
apply (rule iffI) |
|
983 |
apply (erule CollectE| erule bexE| erule conjE| erule exE| rule conjI)+ |
|
984 |
apply (simp split:if_splits add: cpfd2sfds_def proc_file_fds_def) |
|
985 |
apply (rule_tac x = fd in exI, simp) |
|
986 |
apply (drule_tac p' = x and fd' = fd in cfd2sfd_other, simp+) |
|
987 |
apply (simp split:if_splits add: cpfd2sfds_def proc_file_fds_def) |
|
988 |
apply (erule CollectE| erule bexE| erule conjE| erule exE| rule conjI)+ |
|
989 |
apply (rule_tac x = fd in exI, simp) |
|
990 |
apply (drule_tac p' = x and fd' = fd in cfd2sfd_other, simp+) |
|
991 |
done |
|
992 |
||
993 |
lemma cpfd2sfds_exit: |
|
994 |
"valid (Exit p # s) \<Longrightarrow> cpfd2sfds (Exit p # s) = (cpfd2sfds s) (p := {})" |
|
995 |
apply (frule vd_cons, frule vt_grant_os) |
|
996 |
apply (rule ext, rule set_eqI) |
|
997 |
unfolding cpfd2sfds_def proc_file_fds_def |
|
998 |
apply (rule iffI) |
|
999 |
apply (erule CollectE| erule bexE| erule conjE| erule exE| rule conjI)+ |
|
1000 |
apply (simp split:if_splits add: cpfd2sfds_def proc_file_fds_def) |
|
1001 |
apply (rule_tac x = fd in exI, simp) |
|
1002 |
apply (drule_tac p' = x and fd' = fd in cfd2sfd_other, simp+) |
|
1003 |
apply (simp split:if_splits add: cpfd2sfds_def proc_file_fds_def) |
|
1004 |
apply (erule CollectE| erule bexE| erule conjE| erule exE| rule conjI)+ |
|
1005 |
apply (rule_tac x = fd in exI, simp) |
|
1006 |
apply (drule_tac p' = x and fd' = fd in cfd2sfd_other, simp+) |
|
1007 |
done |
|
1008 |
||
1009 |
lemma cpfd2sfds_closefd: |
|
1010 |
"valid (CloseFd p fd # s) \<Longrightarrow> cpfd2sfds (CloseFd p fd # s) = (cpfd2sfds s) (p := |
|
1011 |
if (fd \<in> proc_file_fds s p) |
|
1012 |
then (case (cfd2sfd s p fd) of |
|
1013 |
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) |
|
1014 |
then cpfd2sfds s p else cpfd2sfds s p - {sfd}) |
|
1015 |
| _ \<Rightarrow> cpfd2sfds s p) |
|
1016 |
else cpfd2sfds s p)" |
|
1017 |
apply (frule vd_cons) |
|
1018 |
apply (rule ext, rule set_eqI, rule iffI) |
|
1019 |
unfolding cpfd2sfds_def proc_file_fds_def |
|
1020 |
apply (erule CollectE| erule bexE| erule conjE| erule exE| rule conjI)+ |
|
1021 |
apply (simp split:if_splits) |
|
1022 |
apply (rule conjI, rule impI, rule conjI, rule impI, erule exE) |
|
1023 |
apply (frule_tac p = p and fd = fd in current_filefd_has_sfd, simp) |
|
1024 |
apply (erule exE, simp) |
|
1025 |
apply (rule conjI, rule impI, (erule exE|erule conjE)+) |
|
1026 |
apply (rule_tac x = fda in exI, simp, simp add:cfd2sfd_closefd) |
|
1027 |
||
1028 |
apply (rule impI, rule conjI) |
|
1029 |
apply (rule_tac x = fda in exI, simp, simp add:cfd2sfd_closefd) |
|
1030 |
apply (rule notI, simp) |
|
1031 |
apply (erule_tac x = fda in allE, simp add:cfd2sfd_closefd) |
|
1032 |
||
1033 |
apply (rule impI, simp add:cpfd2sfds_def proc_file_fds_def) |
|
1034 |
apply (erule exE, rule_tac x = fda in exI, simp add:cfd2sfd_closefd) |
|
1035 |
||
1036 |
apply (rule impI| rule conjI)+ |
|
1037 |
apply (rule_tac x = fda in exI, simp add:cfd2sfd_closefd) |
|
1038 |
||
1039 |
apply (rule impI, simp add:cpfd2sfds_def proc_file_fds_def) |
|
1040 |
apply (rule_tac x = fda in exI, simp add:cfd2sfd_closefd) |
|
12 | 1041 |
|
13 | 1042 |
apply (simp split:if_splits) |
1043 |
apply (frule_tac p = p and fd = fd in current_filefd_has_sfd, simp) |
|
1044 |
apply (erule exE, simp) |
|
1045 |
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") |
|
1046 |
apply simp |
|
1047 |
apply (case_tac "xa = sfd") |
|
1048 |
apply (erule exE|erule conjE)+ |
|
1049 |
apply (rule_tac x = fd' in exI, simp add:cfd2sfd_closefd) |
|
1050 |
apply (erule exE|erule conjE)+ |
|
1051 |
apply (rule_tac x = fda in exI, simp add:cfd2sfd_closefd) |
|
1052 |
apply (rule notI, simp) |
|
1053 |
apply (simp, (erule exE|erule conjE)+) |
|
1054 |
apply (rule_tac x = fda in exI, simp add:cfd2sfd_closefd) |
|
1055 |
apply (rule notI, simp) |
|
1056 |
apply (erule exE|erule conjE)+ |
|
1057 |
apply (rule_tac x = fda in exI, simp add:cfd2sfd_closefd) |
|
1058 |
apply (rule notI, simp) |
|
1059 |
apply (simp add:cpfd2sfds_def proc_file_fds_def) |
|
1060 |
apply (erule exE|erule conjE)+ |
|
1061 |
apply (rule_tac x = fda in exI, simp add:cfd2sfd_closefd) |
|
1062 |
done |
|
1063 |
||
1064 |
lemmas cpfd2sfds_simps = cpfd2sfds_open cpfd2sfds_execve cpfd2sfds_clone cpfd2sfds_kill cpfd2sfds_exit |
|
1065 |
cpfd2sfds_closefd cpfd2sfds_other |
|
1066 |
||
1067 |
(********* ch2sshm simpset ********) |
|
1068 |
||
1069 |
lemma ch2sshm_createshm: |
|
1070 |
"valid (CreateShM p h # s) |
|
1071 |
\<Longrightarrow> ch2sshm (CreateShM p h # s) = (ch2sshm s) (h := |
|
1072 |
(case (sectxt_of_obj (CreateShM p h # s) (O_shm h)) of |
|
1073 |
Some sec \<Rightarrow> |
|
1074 |
Some (if (\<not> deleted (O_shm h) s \<and> h \<in> init_shms) then Init h else Created, sec) |
|
1075 |
| _ \<Rightarrow> None))" |
|
1076 |
apply (frule vd_cons, frule vt_grant_os) |
|
1077 |
apply (auto simp:ch2sshm_def sectxt_of_obj_simps dest!:current_has_sec' split:option.splits if_splits) |
|
1078 |
done |
|
1079 |
||
1080 |
lemma ch2sshm_other: |
|
1081 |
"\<lbrakk>valid (e # s); |
|
1082 |
\<forall> p h. e \<noteq> CreateShM p h; |
|
1083 |
h' \<in> current_shms (e # s)\<rbrakk> \<Longrightarrow> ch2sshm (e # s) h' = ch2sshm s h'" |
|
1084 |
apply (frule vd_cons, frule vt_grant_os) |
|
1085 |
apply (case_tac e) |
|
1086 |
apply (auto simp:ch2sshm_def sectxt_of_obj_simps dest!:current_has_sec' split:option.splits if_splits) |
|
1087 |
done |
|
1088 |
||
1089 |
lemmas ch2sshm_simps = ch2sshm_createshm ch2sshm_other |
|
1090 |
||
1091 |
lemma current_shm_has_sh: |
|
1092 |
"\<lbrakk>h \<in> current_shms s; valid s\<rbrakk> \<Longrightarrow> \<exists> sh. ch2sshm s h = Some sh" |
|
1093 |
by (auto simp:ch2sshm_def split:option.splits dest!:current_has_sec') |
|
1094 |
||
1095 |
lemma current_shm_has_sh': |
|
1096 |
"\<lbrakk>ch2sshm s h = None; valid s\<rbrakk> \<Longrightarrow> h \<notin> current_shms s" |
|
1097 |
by (auto dest:current_shm_has_sh) |
|
1098 |
||
1099 |
(********** cph2spshs simpset **********) |
|
1100 |
||
14 | 1101 |
lemma cph2spshs_attach: |
13 | 1102 |
"valid (Attach p h flag # s) \<Longrightarrow> |
1103 |
cph2spshs (Attach p h flag # s) = (cph2spshs s) (p := |
|
1104 |
(case (ch2sshm s h) of |
|
1105 |
Some sh \<Rightarrow> cph2spshs s p \<union> {(sh, flag)} |
|
1106 |
| _ \<Rightarrow> cph2spshs s p) )" |
|
1107 |
apply (frule vd_cons, frule vt_grant_os, rule ext) |
|
1108 |
using ch2sshm_other[where e = "Attach p h flag" and s = s] |
|
1109 |
apply (auto split del:t_open_must_flag.splits t_open_option_flag.splits split add:if_splits option.splits |
|
14 | 1110 |
dest!:current_shm_has_sh' dest: procs_of_shm_prop1 simp:cph2spshs_def) |
1111 |
apply (erule_tac x = ha in allE, frule procs_of_shm_prop1, simp, simp) |
|
1112 |
apply (erule_tac x = ha in allE, frule procs_of_shm_prop1, simp, simp) |
|
1113 |
apply (erule_tac x = ha in allE, frule procs_of_shm_prop1, simp, simp) |
|
1114 |
apply (erule_tac x = ha in allE, frule procs_of_shm_prop1, simp, simp) |
|
1115 |
apply (erule_tac x = ha in allE, frule procs_of_shm_prop1, simp, simp) |
|
1116 |
apply (case_tac "ha = h", simp, frule procs_of_shm_prop1, simp) |
|
1117 |
apply (rule_tac x = ha in exI, simp) |
|
1118 |
apply (rule_tac x = ha in exI, simp, drule procs_of_shm_prop1, simp, simp) |
|
1119 |
apply (rule_tac x = ha in exI, simp) |
|
1120 |
apply (frule procs_of_shm_prop1, simp, simp) |
|
1121 |
apply (rule impI, simp) |
|
1122 |
done |
|
1123 |
||
1124 |
lemma cph2spshs_detach: "valid (Detach p h # s) \<Longrightarrow> |
|
1125 |
cph2spshs (Detach p h # s) = (cph2spshs s) (p := |
|
15 | 1126 |
(case (ch2sshm s h, flag_of_proc_shm s p h) of |
1127 |
(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) |
|
1128 |
then cph2spshs s p else cph2spshs s p - {(sh, flag)} |
|
14 | 1129 |
| _ \<Rightarrow> cph2spshs s p) )" |
1130 |
apply (frule vd_cons, frule vt_grant_os, rule ext) |
|
15 | 1131 |
apply (case_tac "x = p") defer |
1132 |
using ch2sshm_other[where e = "Detach p h" and s = s] |
|
14 | 1133 |
apply (auto split del:t_open_must_flag.splits t_open_option_flag.splits split add:if_splits option.splits |
15 | 1134 |
dest!:current_shm_has_sh' procs_of_shm_prop4' dest:procs_of_shm_prop1 procs_of_shm_prop3 simp:cph2spshs_def) [1] |
1135 |
apply (rule_tac x = ha in exI, frule_tac h = ha in procs_of_shm_prop1, simp, simp) |
|
14 | 1136 |
apply (rule_tac x = ha in exI, frule_tac h = ha in procs_of_shm_prop1, simp, simp) |
1137 |
apply (rule impI, simp) |
|
15 | 1138 |
|
1139 |
apply (clarsimp) |
|
1140 |
apply (frule current_shm_has_sh, simp, erule exE) |
|
1141 |
apply (frule procs_of_shm_prop4, simp, simp) |
|
1142 |
apply (rule allI | rule conjI| erule conjE | erule exE | rule impI)+ |
|
1143 |
||
1144 |
apply (simp only:cph2spshs_def, rule set_eqI, rule iffI) |
|
1145 |
apply (erule CollectE | erule exE| erule conjE| rule CollectI)+ |
|
1146 |
apply (case_tac "ha = h", simp) |
|
1147 |
apply (rule_tac x = sha in exI, rule_tac x = flaga in exI, rule_tac x = ha in exI, simp) |
|
1148 |
using ch2sshm_other[where e = "Detach p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
1149 |
||
1150 |
apply (erule CollectE | erule exE| erule conjE| rule CollectI)+ |
|
1151 |
apply (case_tac "ha = h", simp) |
|
1152 |
apply (rule_tac x = h' in exI, simp) |
|
1153 |
apply (frule_tac flag = flag and flag' = flaga in procs_of_shm_prop3, simp+) |
|
1154 |
apply (frule_tac flag = flaga in procs_of_shm_prop4, simp+) |
|
1155 |
using ch2sshm_other[where e = "Detach p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
1156 |
apply (frule_tac h = h' in procs_of_shm_prop1, simp, simp) |
|
1157 |
apply (rule_tac x = ha in exI, simp, frule_tac h = ha in procs_of_shm_prop1, simp+) |
|
1158 |
using ch2sshm_other[where e = "Detach p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
1159 |
||
1160 |
apply (rule allI | rule conjI| erule conjE | erule exE | rule impI)+ |
|
1161 |
apply (simp only:cph2spshs_def, rule set_eqI, rule iffI) |
|
1162 |
apply (erule CollectE | erule exE| erule conjE| rule DiffI |rule CollectI)+ |
|
1163 |
apply (simp split:if_splits) |
|
1164 |
apply (rule_tac x = ha in exI, simp, frule_tac h = ha in procs_of_shm_prop1, simp+) |
|
1165 |
using ch2sshm_other[where e = "Detach p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
1166 |
apply (rule notI, simp split:if_splits) |
|
1167 |
apply (erule_tac x = ha in allE, simp, frule_tac h = ha in procs_of_shm_prop1, simp+) |
|
1168 |
using ch2sshm_other[where e = "Detach p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
1169 |
apply (erule CollectE | erule exE| erule conjE| erule DiffE |rule CollectI)+ |
|
1170 |
apply (simp split:if_splits) |
|
1171 |
apply (erule_tac x = ha in allE, simp, rule_tac x = ha in exI, simp) |
|
1172 |
apply (case_tac "ha = h", simp add:procs_of_shm_prop3, frule_tac h = ha in procs_of_shm_prop1, simp+) |
|
1173 |
using ch2sshm_other[where e = "Detach p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
14 | 1174 |
done |
13 | 1175 |
|
16 | 1176 |
lemma cph2spshs_deleteshm: |
1177 |
"valid (DeleteShM p h # s) \<Longrightarrow> |
|
1178 |
cph2spshs (DeleteShM p h # s) = (\<lambda> p'. |
|
1179 |
(case (ch2sshm s h, flag_of_proc_shm s p' h) of |
|
1180 |
(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) |
|
1181 |
then cph2spshs s p' else cph2spshs s p' - {(sh, flag)} |
|
1182 |
| _ \<Rightarrow> cph2spshs s p') )" |
|
1183 |
apply (frule vd_cons, frule vt_grant_os, rule ext) |
|
15 | 1184 |
|
16 | 1185 |
apply (clarsimp) |
1186 |
apply (frule current_shm_has_sh, simp, erule exE, simp, simp split:option.splits) |
|
1187 |
apply (rule conjI, rule impI) |
|
1188 |
using ch2sshm_other[where e = "DeleteShM p h" and s = s] |
|
1189 |
apply (auto split del:t_open_must_flag.splits t_open_option_flag.splits split add:if_splits option.splits |
|
1190 |
dest!:current_shm_has_sh' procs_of_shm_prop4' dest:procs_of_shm_prop1 procs_of_shm_prop3 simp:cph2spshs_def) [1] |
|
1191 |
apply (rule_tac x = ha in exI, frule_tac h = ha in procs_of_shm_prop1, simp+) |
|
1192 |
apply (rule_tac x = ha in exI, simp) |
|
1193 |
apply (case_tac "ha = h", simp+, frule_tac h = ha in procs_of_shm_prop1, simp+) |
|
1194 |
||
1195 |
apply (rule allI | rule conjI| erule conjE | erule exE | rule impI)+ |
|
1196 |
||
1197 |
apply (simp only:cph2spshs_def, rule set_eqI, rule iffI) |
|
1198 |
apply (erule CollectE | erule exE| erule conjE| rule CollectI)+ |
|
1199 |
apply (case_tac "ha = h", simp) |
|
1200 |
apply (rule_tac x = sha in exI, rule_tac x = flag in exI, rule_tac x = ha in exI, simp) |
|
1201 |
using ch2sshm_other[where e = "DeleteShM p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
1202 |
||
1203 |
apply (erule CollectE | erule exE| erule conjE| rule CollectI)+ |
|
1204 |
apply (case_tac "ha = h", simp) |
|
1205 |
apply (rule_tac x = h' in exI, simp) |
|
1206 |
apply (frule_tac flag = flag in procs_of_shm_prop4, simp+) |
|
1207 |
using ch2sshm_other[where e = "DeleteShM p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
1208 |
apply (frule_tac h = h' in procs_of_shm_prop1, simp, simp) |
|
1209 |
apply (rule_tac x = ha in exI, simp, frule_tac h = ha in procs_of_shm_prop1, simp+) |
|
1210 |
using ch2sshm_other[where e = "DeleteShM p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
1211 |
||
1212 |
apply (rule allI | rule conjI| erule conjE | erule exE | rule impI)+ |
|
1213 |
apply (simp only:cph2spshs_def, rule set_eqI, rule iffI) |
|
1214 |
apply (erule CollectE | erule exE| erule conjE| rule DiffI |rule CollectI)+ |
|
1215 |
apply (simp split:if_splits) |
|
1216 |
apply (rule_tac x = ha in exI, simp, frule_tac h = ha in procs_of_shm_prop1, simp+) |
|
1217 |
using ch2sshm_other[where e = "DeleteShM p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
1218 |
apply (rule notI, simp split:if_splits) |
|
1219 |
apply (erule_tac x = ha in allE, simp, frule_tac h = ha in procs_of_shm_prop1, simp+) |
|
1220 |
using ch2sshm_other[where e = "DeleteShM p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
1221 |
apply (erule CollectE | erule exE| erule conjE| erule DiffE |rule CollectI)+ |
|
1222 |
apply (simp split:if_splits) |
|
1223 |
apply (erule_tac x = ha in allE, simp, rule_tac x = ha in exI, simp) |
|
1224 |
apply (case_tac "ha = h", simp add:procs_of_shm_prop4) |
|
1225 |
apply (frule_tac h = ha in procs_of_shm_prop1, simp+) |
|
1226 |
using ch2sshm_other[where e = "DeleteShM p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
1227 |
done |
|
1228 |
||
1229 |
lemma flag_of_proc_shm_prop1: |
|
1230 |
"\<lbrakk>flag_of_proc_shm s p h = Some flag; valid s\<rbrakk> \<Longrightarrow> (p, flag) \<in> procs_of_shm s h" |
|
1231 |
apply (induct s arbitrary:p) |
|
1232 |
apply (simp add:init_shmflag_has_proc) |
|
1233 |
apply (frule vt_grant_os, frule vd_cons, case_tac a, auto split:if_splits option.splits) |
|
1234 |
done |
|
1235 |
||
1236 |
lemma cph2spshs_clone: |
|
1237 |
"valid (Clone p p' fds shms # s) \<Longrightarrow> |
|
1238 |
cph2spshs (Clone p p' fds shms # s) = (cph2spshs s) (p' := |
|
1239 |
{(sh, flag) | h sh flag. h \<in> shms \<and> ch2sshm s h = Some sh \<and> flag_of_proc_shm s p h = Some flag} )" |
|
1240 |
apply (frule vd_cons, frule vt_grant_os, rule ext) |
|
1241 |
using ch2sshm_other[where e = "Clone p p' fds shms" and s = s] |
|
1242 |
apply (auto split del:t_open_must_flag.splits t_open_option_flag.splits split add:if_splits option.splits |
|
1243 |
dest!:current_shm_has_sh' dest: procs_of_shm_prop1 procs_of_shm_prop2 procs_of_shm_prop3 simp:cph2spshs_def) |
|
1244 |
apply (erule_tac x = h in allE, frule procs_of_shm_prop1, simp, simp add:procs_of_shm_prop4) |
|
1245 |
apply (rule_tac x = h in exI, simp, frule flag_of_proc_shm_prop1, simp+, simp add:procs_of_shm_prop1) |
|
1246 |
apply (rule_tac x = h in exI, simp, frule procs_of_shm_prop1, simp+)+ |
|
1247 |
done |
|
1248 |
||
1249 |
lemma cph2spshs_execve: |
|
1250 |
"valid (Execve p f fds # s) \<Longrightarrow> |
|
1251 |
cph2spshs (Execve p f fds # s) = (cph2spshs s) (p := {})" |
|
1252 |
apply (frule vd_cons, frule vt_grant_os, rule ext) |
|
1253 |
using ch2sshm_other[where e = "Execve p f fds" and s = s] |
|
1254 |
apply (auto split del:t_open_must_flag.splits t_open_option_flag.splits split add:if_splits option.splits |
|
1255 |
dest!:current_shm_has_sh' dest: procs_of_shm_prop1 procs_of_shm_prop2 procs_of_shm_prop3 simp:cph2spshs_def) |
|
1256 |
apply (rule_tac x = h in exI, simp add:procs_of_shm_prop1)+ |
|
1257 |
done |
|
1258 |
||
1259 |
lemma cph2spshs_kill: |
|
1260 |
"valid (Kill p p' # s) \<Longrightarrow> cph2spshs (Kill p p' # s) = (cph2spshs s) (p' := {})" |
|
1261 |
apply (frule vd_cons, frule vt_grant_os, rule ext) |
|
1262 |
using ch2sshm_other[where e = "Kill p p'" and s = s] |
|
1263 |
apply (auto split del:t_open_must_flag.splits t_open_option_flag.splits split add:if_splits option.splits |
|
1264 |
dest!:current_shm_has_sh' dest: procs_of_shm_prop1 procs_of_shm_prop2 procs_of_shm_prop3 simp:cph2spshs_def) |
|
1265 |
apply (rule_tac x = h in exI, simp add:procs_of_shm_prop1)+ |
|
1266 |
done |
|
1267 |
||
1268 |
lemma cph2spshs_exit: |
|
1269 |
"valid (Exit p # s) \<Longrightarrow> cph2spshs (Exit p # s) = (cph2spshs s) (p := {})" |
|
1270 |
apply (frule vd_cons, frule vt_grant_os, rule ext) |
|
1271 |
using ch2sshm_other[where e = "Exit p" and s = s] |
|
1272 |
apply (auto split del:t_open_must_flag.splits t_open_option_flag.splits split add:if_splits option.splits |
|
1273 |
dest!:current_shm_has_sh' dest: procs_of_shm_prop1 procs_of_shm_prop2 procs_of_shm_prop3 simp:cph2spshs_def) |
|
1274 |
apply (rule_tac x = h in exI, simp add:procs_of_shm_prop1)+ |
|
1275 |
done |
|
1276 |
||
1277 |
lemma cph2spshs_createshm: |
|
1278 |
"valid (CreateShM p h # s) \<Longrightarrow> cph2spshs (CreateShM p h # s) = cph2spshs s" |
|
1279 |
apply (frule vt_grant_os, frule vd_cons, rule ext) |
|
1280 |
apply (auto simp:cph2spshs_def) |
|
1281 |
using ch2sshm_createshm |
|
1282 |
apply (auto split del:t_open_must_flag.splits t_open_option_flag.splits split add:if_splits option.splits |
|
1283 |
dest!:current_shm_has_sh' dest: procs_of_shm_prop1 procs_of_shm_prop2 procs_of_shm_prop3 simp:cph2spshs_def) |
|
1284 |
apply (rule_tac x = ha in exI, auto simp:procs_of_shm_prop1) |
|
1285 |
done |
|
15 | 1286 |
|
13 | 1287 |
lemma cph2spshs_other: |
16 | 1288 |
"\<lbrakk>valid (e # s); |
1289 |
\<forall> p h flag. e \<noteq> Attach p h flag; |
|
1290 |
\<forall> p h. e \<noteq> Detach p h; |
|
1291 |
\<forall> p h. e \<noteq> DeleteShM p h; |
|
1292 |
\<forall> p p' fds shms. e \<noteq> Clone p p' fds shms; |
|
1293 |
\<forall> p f fds. e \<noteq> Execve p f fds; |
|
1294 |
\<forall> p p'. e \<noteq> Kill p p'; |
|
1295 |
\<forall> p. e \<noteq> Exit p\<rbrakk> \<Longrightarrow> cph2spshs (e # s) = cph2spshs s" |
|
1296 |
apply (frule vt_grant_os, frule vd_cons, rule ext) |
|
1297 |
unfolding cph2spshs_def |
|
1298 |
apply (rule set_eqI, rule iffI) |
|
1299 |
apply (erule CollectE | erule conjE| erule exE| rule conjI| rule impI| rule CollectI)+ |
|
1300 |
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) |
|
1301 |
apply (case_tac e) |
|
1302 |
using ch2sshm_other[where e = e and s = s] |
|
1303 |
apply (auto split del:t_open_must_flag.splits t_open_option_flag.splits split add:if_splits option.splits |
|
1304 |
dest!:current_shm_has_sh' dest: procs_of_shm_prop1 procs_of_shm_prop2 procs_of_shm_prop3 |
|
1305 |
simp:ch2sshm_createshm) |
|
1306 |
apply (rule_tac x = h in exI, case_tac e) |
|
1307 |
using ch2sshm_other[where e = e and s = s] |
|
1308 |
apply (auto split del:t_open_must_flag.splits t_open_option_flag.splits split add:if_splits option.splits |
|
1309 |
dest!:current_shm_has_sh' dest: procs_of_shm_prop1 procs_of_shm_prop2 procs_of_shm_prop3 |
|
1310 |
simp:ch2sshm_createshm) |
|
1311 |
done |
|
13 | 1312 |
|
16 | 1313 |
lemmas cph2spshs_simps = cph2spshs_attach cph2spshs_detach cph2spshs_deleteshm cph2spshs_clone cph2spshs_execve |
1314 |
cph2spshs_exit cph2spshs_kill cph2spshs_other |
|
1 | 1315 |
|
10 | 1316 |
(******** cp2sproc simpset *********) |
1 | 1317 |
|
17 | 1318 |
lemma cp2sproc_clone: |
1319 |
"valid (Clone p p' fds shms # s) \<Longrightarrow> cp2sproc (Clone p p' fds shms # s) = (cp2sproc s) (p' := |
|
1320 |
case (sectxt_of_obj s (O_proc p)) of |
|
1321 |
Some sec \<Rightarrow> Some (Created, sec, |
|
1322 |
{sfd. \<exists> fd \<in> fds. \<exists> f. file_of_proc_fd s p fd = Some f \<and> cfd2sfd s p fd = Some sfd}, |
|
1323 |
{(sh, flag) | h sh flag. h \<in> shms \<and> ch2sshm s h = Some sh \<and> flag_of_proc_shm s p h = Some flag}) |
|
1324 |
| _ \<Rightarrow> None)" |
|
1325 |
apply (frule cph2spshs_clone, frule cpfd2sfds_clone) |
|
1326 |
apply (frule vd_cons, frule vt_grant_os, simp only:os_grant.simps) |
|
1327 |
apply ((erule exE| erule conjE)+, frule not_init_intro_proc, simp, rule ext, case_tac "x = p'", simp) |
|
1328 |
apply (auto simp:cp2sproc_def sectxt_of_obj_simps dest!:current_has_sec' |
|
1329 |
dest:current_proc_has_sec split:option.splits if_splits) |
|
1330 |
done |
|
1331 |
||
1332 |
lemma cp2sproc_other: |
|
1333 |
"\<lbrakk>valid (e # s); |
|
1334 |
\<forall> p f flags fd opt. e \<noteq> Open p f flags fd opt; |
|
1335 |
\<forall> p fd. e \<noteq> CloseFd p fd; |
|
1336 |
\<forall> p h flag. e \<noteq> Attach p h flag; |
|
1337 |
\<forall> p h. e \<noteq> Detach p h; |
|
1338 |
\<forall> p h. e \<noteq> DeleteShM p h; |
|
1339 |
\<forall> p p' fds shms. e \<noteq> Clone p p' fds shms; |
|
1340 |
\<forall> p f fds. e \<noteq> Execve p f fds; |
|
1341 |
\<forall> p p'. e \<noteq> Kill p p'; |
|
1342 |
\<forall> p. e \<noteq> Exit p\<rbrakk> \<Longrightarrow> cp2sproc (e # s) = cp2sproc s" |
|
1343 |
apply (frule cph2spshs_other, simp+, frule cpfd2sfds_other, simp+) |
|
1344 |
apply (frule vt_grant_os, frule vd_cons, rule ext, case_tac e, simp_all) |
|
1345 |
apply (auto simp:cp2sproc_def sectxt_of_obj_simps dest!:current_has_sec' |
|
1346 |
dest:current_proc_has_sec not_deleted_init_proc split:option.splits if_splits) |
|
1347 |
done |
|
1 | 1348 |
|
17 | 1349 |
lemma cp2sproc_open: |
1350 |
"valid (Open p f flags fd opt # s) \<Longrightarrow> |
|
1351 |
cp2sproc (Open p f flags fd opt # s) = (cp2sproc s) (p := |
|
1352 |
case (sectxt_of_obj s (O_proc p), sectxt_of_obj (Open p f flags fd opt # s) (O_fd p fd), |
|
1353 |
cf2sfile (Open p f flags fd opt # s) f) of |
|
1354 |
(Some sec, Some fdsec, Some sf) \<Rightarrow> Some (if (\<not> deleted (O_proc p) s \<and> p \<in> init_procs) |
|
1355 |
then Init p else Created, sec, |
|
1356 |
(cpfd2sfds s p) \<union> {(fdsec, flags, sf)}, cph2spshs s p) |
|
1357 |
| _ \<Rightarrow> None)" |
|
1358 |
apply (frule cph2spshs_other, simp, simp, simp, simp, simp, simp, simp) |
|
1359 |
apply (frule cpfd2sfds_open, frule vt_grant_os, frule vd_cons, rule ext) |
|
1360 |
apply (case_tac "x = p") |
|
1361 |
apply (auto simp:cp2sproc_def sectxt_of_obj_simps current_files_simps |
|
1362 |
dest!:current_has_sec' dest!:current_file_has_sfile' dest:is_file_in_current is_dir_in_current |
|
1363 |
dest:current_proc_has_sec not_deleted_init_proc split:option.splits if_splits) |
|
1364 |
done |
|
1365 |
||
1366 |
lemma cp2sproc_closefd: |
|
1367 |
"valid (CloseFd p fd # s) \<Longrightarrow> |
|
1368 |
cp2sproc (CloseFd p fd # s) = (cp2sproc s) (p := |
|
1369 |
if (fd \<in> proc_file_fds s p) |
|
1370 |
then (case (cfd2sfd s p fd) of |
|
1371 |
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) |
|
1372 |
then cp2sproc s p |
|
1373 |
else (case (sectxt_of_obj s (O_proc p)) of |
|
1374 |
Some sec \<Rightarrow> Some (if (\<not> deleted (O_proc p) s \<and> p \<in> init_procs) |
|
1375 |
then Init p else Created, |
|
1376 |
sec, cpfd2sfds s p - {sfd}, cph2spshs s p) |
|
1377 |
| _ \<Rightarrow> None)) |
|
1378 |
| _ \<Rightarrow> cp2sproc s p) |
|
1379 |
else cp2sproc s p)" |
|
1380 |
apply (frule cpfd2sfds_closefd, frule cph2spshs_other, simp, simp, simp, simp, simp, simp, simp) |
|
1381 |
apply (frule vt_grant_os, frule vd_cons, rule ext) |
|
1382 |
apply (case_tac "x = p") |
|
1383 |
apply (auto simp:cp2sproc_def sectxt_of_obj_simps current_files_simps |
|
1384 |
dest!:current_has_sec' dest!:current_file_has_sfile' dest:is_file_in_current is_dir_in_current |
|
1385 |
dest:current_proc_has_sec not_deleted_init_proc split:option.splits if_splits) |
|
1386 |
done |
|
1 | 1387 |
|
17 | 1388 |
lemma cp2sproc_attach: |
1389 |
"valid (Attach p h flag # s) \<Longrightarrow> |
|
1390 |
cp2sproc (Attach p h flag # s) = (cp2sproc s) (p := |
|
1391 |
(case (ch2sshm s h) of |
|
1392 |
Some sh \<Rightarrow> (case (sectxt_of_obj s (O_proc p)) of |
|
1393 |
Some sec \<Rightarrow> Some (if (\<not> deleted (O_proc p) s \<and> p \<in> init_procs) |
|
1394 |
then Init p else Created, |
|
1395 |
sec, cpfd2sfds s p, cph2spshs s p \<union> {(sh, flag)}) |
|
1396 |
| _ \<Rightarrow> None) |
|
1397 |
| _ \<Rightarrow> cp2sproc s p) )" |
|
1398 |
apply (frule cph2spshs_attach, frule cpfd2sfds_other, simp, simp, simp, simp, simp, simp) |
|
1399 |
apply (frule vt_grant_os, frule vd_cons, rule ext) |
|
1400 |
apply (case_tac "x = p") |
|
1401 |
apply (auto simp:cp2sproc_def sectxt_of_obj_simps current_files_simps |
|
1402 |
dest!:current_has_sec' dest!:current_file_has_sfile' dest:is_file_in_current is_dir_in_current |
|
1403 |
dest:current_proc_has_sec not_deleted_init_proc split:option.splits if_splits) |
|
1404 |
done |
|
1405 |
||
1406 |
lemma cp2sproc_detach: |
|
1407 |
"valid (Detach p h # s) \<Longrightarrow> |
|
1408 |
cp2sproc (Detach p h # s) = (cp2sproc s) (p := |
|
1409 |
(case (ch2sshm s h, flag_of_proc_shm s p h) of |
|
1410 |
(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) |
|
1411 |
then cp2sproc s p |
|
1412 |
else (case (sectxt_of_obj s (O_proc p)) of |
|
1413 |
Some sec \<Rightarrow> Some (if (\<not> deleted (O_proc p) s \<and> p \<in> init_procs) |
|
1414 |
then Init p else Created, sec, |
|
1415 |
cpfd2sfds s p, cph2spshs s p - {(sh, flag)}) |
|
1416 |
| None \<Rightarrow> None) |
|
1417 |
| _ \<Rightarrow> cp2sproc s p) )" |
|
1418 |
apply (frule cph2spshs_detach, frule cpfd2sfds_other, simp, simp, simp, simp, simp, simp) |
|
1419 |
apply (frule vt_grant_os, frule vd_cons, rule ext) |
|
1420 |
apply (case_tac "x = p") |
|
1421 |
apply (auto simp:cp2sproc_def sectxt_of_obj_simps current_files_simps |
|
1422 |
dest!:current_has_sec' dest!:current_file_has_sfile' dest:is_file_in_current is_dir_in_current |
|
1423 |
dest:current_proc_has_sec not_deleted_init_proc split:option.splits if_splits) |
|
1424 |
done |
|
1 | 1425 |
|
17 | 1426 |
lemma cp2sproc_deleteshm: |
1427 |
"valid (DeleteShM p h # s) \<Longrightarrow> |
|
1428 |
cp2sproc (DeleteShM p h # s) = (\<lambda> p'. |
|
1429 |
(case (ch2sshm s h, flag_of_proc_shm s p' h) of |
|
1430 |
(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) |
|
1431 |
then cp2sproc s p' |
|
1432 |
else (case (sectxt_of_obj s (O_proc p')) of |
|
1433 |
Some sec \<Rightarrow> Some (if (\<not> deleted (O_proc p') s \<and> p' \<in> init_procs) |
|
1434 |
then Init p' else Created, sec, |
|
1435 |
cpfd2sfds s p', cph2spshs s p' - {(sh, flag)}) |
|
1436 |
| None \<Rightarrow> None) |
|
1437 |
| _ \<Rightarrow> cp2sproc s p') )" |
|
1438 |
apply (frule cph2spshs_deleteshm, frule cpfd2sfds_other, simp, simp, simp, simp, simp, simp) |
|
1439 |
apply (frule vt_grant_os, frule vd_cons, rule ext) |
|
1440 |
apply (auto simp:cp2sproc_def sectxt_of_obj_simps current_files_simps |
|
1441 |
dest!:current_has_sec' dest!:current_file_has_sfile' dest:is_file_in_current is_dir_in_current |
|
1442 |
dest:current_proc_has_sec not_deleted_init_proc split:option.splits if_splits) |
|
1443 |
done |
|
1444 |
||
1445 |
lemma cp2sproc_execve: |
|
1446 |
"valid (Execve p f fds # s) \<Longrightarrow> |
|
1447 |
cp2sproc (Execve p f fds # s) = (cp2sproc s) (p := |
|
1448 |
(case (sectxt_of_obj (Execve p f fds # s) (O_proc p)) of |
|
1449 |
Some sec \<Rightarrow> Some (if (\<not> deleted (O_proc p) s \<and> p \<in> init_procs) then Init p else Created, sec, |
|
1450 |
{sfd. \<exists> fd \<in> fds. \<exists> f. file_of_proc_fd s p fd = Some f \<and> cfd2sfd s p fd = Some sfd}, {}) |
|
1451 |
| _ \<Rightarrow> None) )" |
|
1452 |
apply (frule cph2spshs_execve, frule cpfd2sfds_execve) |
|
1453 |
apply (frule vt_grant_os, frule vd_cons, rule ext) |
|
1454 |
apply (auto simp:cp2sproc_def sectxt_of_obj_simps current_files_simps |
|
1455 |
dest!:current_has_sec' dest!:current_file_has_sfile' dest:is_file_in_current is_dir_in_current |
|
1456 |
dest:current_proc_has_sec not_deleted_init_proc split:option.splits if_splits) |
|
1457 |
done |
|
1 | 1458 |
|
17 | 1459 |
lemma cp2sproc_kill: |
1460 |
"\<lbrakk>valid (Kill p p' # s); p'' \<noteq> p'\<rbrakk> \<Longrightarrow> |
|
1461 |
cp2sproc (Kill p p' # s) p'' = (cp2sproc s) p''" |
|
1462 |
apply (frule cph2spshs_kill, frule cpfd2sfds_kill) |
|
1463 |
apply (frule vt_grant_os, frule vd_cons) |
|
1464 |
apply (auto simp:cp2sproc_def sectxt_of_obj_simps current_files_simps |
|
1465 |
dest!:current_has_sec' dest!:current_file_has_sfile' dest:is_file_in_current is_dir_in_current |
|
1466 |
dest:current_proc_has_sec not_deleted_init_proc split:option.splits if_splits) |
|
1467 |
done |
|
1468 |
||
1469 |
lemma cp2sproc_kill': |
|
1470 |
"\<lbrakk>valid (Kill p p' # s); p'' \<in> current_procs (Kill p p' # s)\<rbrakk> \<Longrightarrow> |
|
1471 |
cp2sproc (Kill p p' # s) p'' = (cp2sproc s) p''" |
|
1472 |
by (drule_tac p'' = p'' in cp2sproc_kill, simp+) |
|
1473 |
||
1474 |
lemma cp2sproc_exit: |
|
1475 |
"\<lbrakk>valid (Exit p # s); p' \<noteq> p\<rbrakk> \<Longrightarrow> |
|
1476 |
cp2sproc (Exit p # s) p' = (cp2sproc s) p'" |
|
1477 |
apply (frule cph2spshs_exit, frule cpfd2sfds_exit) |
|
1478 |
apply (frule vt_grant_os, frule vd_cons) |
|
1479 |
apply (auto simp:cp2sproc_def sectxt_of_obj_simps current_files_simps |
|
1480 |
dest!:current_has_sec' dest!:current_file_has_sfile' dest:is_file_in_current is_dir_in_current |
|
1481 |
dest:current_proc_has_sec not_deleted_init_proc split:option.splits if_splits) |
|
1482 |
done |
|
1483 |
||
1484 |
lemma cp2sproc_exit': |
|
1485 |
"\<lbrakk>valid (Exit p # s); p' \<in> current_procs (Exit p # s)\<rbrakk> \<Longrightarrow> |
|
1486 |
cp2sproc (Exit p # s) p' = (cp2sproc s) p'" |
|
1487 |
by (drule_tac p'= p' in cp2sproc_exit, simp+) |
|
1488 |
||
1489 |
lemmas cp2sproc_simps = cp2sproc_open cp2sproc_closefd cp2sproc_attach cp2sproc_detach cp2sproc_deleteshm |
|
1490 |
cp2sproc_clone cp2sproc_execve cp2sproc_kill cp2sproc_exit cp2sproc_other |
|
1 | 1491 |
|
17 | 1492 |
|
1493 |
||
1494 |
||
1495 |
||
1 | 1496 |
end |
1497 |
||
1498 |
(*<*) |
|
1499 |
end |
|
1500 |
(*>*) |