33 apply (erule get_pfs_secs_prop, simp) |
42 apply (erule get_pfs_secs_prop, simp) |
34 apply (erule_tac search_check_allp_intro, simp_all) |
43 apply (erule_tac search_check_allp_intro, simp_all) |
35 apply (simp add:parentf_is_dir_prop2) |
44 apply (simp add:parentf_is_dir_prop2) |
36 done |
45 done |
37 |
46 |
|
47 lemma enrich_proc_dup_ffds': |
|
48 "\<lbrakk>fd \<notin> current_proc_fds (enrich_proc s p p') p'; is_created_proc s p; p' \<notin> all_procs s; no_del_event s; valid s\<rbrakk> |
|
49 \<Longrightarrow> fd \<notin> proc_file_fds s p \<and> file_of_proc_fd s p fd = None" |
|
50 apply (auto simp:enrich_proc_dup_ffds_eq_fds) |
|
51 apply (simp add:proc_file_fds_def) |
|
52 done |
|
53 |
|
54 lemma enrich_proc_cur_inof: |
|
55 "\<lbrakk>valid s; no_del_event s\<rbrakk> \<Longrightarrow> inum_of_file (enrich_proc s p p') f = inum_of_file s f" |
|
56 apply (induct s arbitrary:f) |
|
57 apply simp |
|
58 apply (frule vd_cons, frule vt_grant_os, frule vt_grant) |
|
59 apply (case_tac a, auto) |
|
60 apply (auto split:option.splits simp del:grant.simps) |
|
61 done |
|
62 |
|
63 lemma not_all_procs_sock: |
|
64 "\<lbrakk>p' \<notin> all_procs s; valid s\<rbrakk> \<Longrightarrow> inum_of_socket s (p', fd) = None" |
|
65 apply (frule not_all_procs_prop3) |
|
66 apply (case_tac "inum_of_socket s (p', fd)", simp_all) |
|
67 apply (drule cn_in_curp', simp+) |
|
68 done |
|
69 |
|
70 lemma enrich_proc_cur_inos: |
|
71 "\<lbrakk>valid s; no_del_event s; p' \<notin> all_procs s\<rbrakk> |
|
72 \<Longrightarrow> inum_of_socket (enrich_proc s p p') (tp, fd) = inum_of_socket s (tp, fd)" |
|
73 apply (induct s arbitrary:tp) |
|
74 apply simp |
|
75 apply (frule vd_cons, frule vt_grant_os) |
|
76 apply (case_tac a, auto split:option.splits simp:not_all_procs_sock) |
|
77 apply (simp add:proc_file_fds_def, erule exE) |
|
78 apply (case_tac "inum_of_socket s (nat1, fd)", simp_all) |
|
79 apply (drule filefd_socket_conflict, simp_all add:current_sockets_def) |
|
80 done |
|
81 |
|
82 lemma enrich_proc_cur_inums: |
|
83 "\<lbrakk>p' \<notin> all_procs s; no_del_event s; valid s\<rbrakk> |
|
84 \<Longrightarrow> current_inode_nums (enrich_proc s p p') = current_inode_nums s" |
|
85 apply (auto simp:current_inode_nums_def current_file_inums_def |
|
86 current_sock_inums_def enrich_proc_cur_inof enrich_proc_cur_inos) |
|
87 done |
|
88 |
|
89 lemma enrich_proc_cur_itag: |
|
90 "\<lbrakk>valid s; no_del_event s; p' \<notin> all_procs s\<rbrakk> |
|
91 \<Longrightarrow> itag_of_inum (enrich_proc s p p') i = itag_of_inum s i" |
|
92 apply (induct s) |
|
93 apply simp |
|
94 apply (frule vd_cons, frule vt_grant_os) |
|
95 apply (case_tac a, auto split:option.splits t_socket_type.splits) |
|
96 done |
|
97 |
|
98 lemma enrich_proc_cur_tcps: |
|
99 "\<lbrakk>valid s; no_del_event s; p' \<notin> all_procs s\<rbrakk> |
|
100 \<Longrightarrow> is_tcp_sock (enrich_proc s p p') = is_tcp_sock s" |
|
101 apply (rule ext, case_tac x) |
|
102 apply (auto simp add:is_tcp_sock_def enrich_proc_cur_itag enrich_proc_cur_inos |
|
103 split:option.splits t_inode_tag.splits) |
|
104 done |
|
105 |
|
106 lemma enrich_proc_cur_udps: |
|
107 "\<lbrakk>valid s; no_del_event s; p' \<notin> all_procs s\<rbrakk> |
|
108 \<Longrightarrow> is_udp_sock (enrich_proc s p p') = is_udp_sock s" |
|
109 apply (rule ext, case_tac x) |
|
110 apply (auto simp add:is_udp_sock_def enrich_proc_cur_itag enrich_proc_cur_inos |
|
111 split:option.splits t_inode_tag.splits) |
|
112 done |
|
113 |
|
114 lemma enrich_proc_cur_msgqs: |
|
115 "valid s \<Longrightarrow> current_msgqs (enrich_proc s p p') = current_msgqs s" |
|
116 apply (induct s, simp) |
|
117 apply (frule vt_grant_os, frule vd_cons) |
|
118 apply (case_tac a, auto) |
|
119 done |
|
120 |
|
121 lemma enrich_proc_cur_msgs: |
|
122 "valid s \<Longrightarrow> msgs_of_queue (enrich_proc s p p') q = msgs_of_queue s q " |
|
123 apply (induct s, simp) |
|
124 apply (frule vt_grant_os, frule vd_cons) |
|
125 apply (case_tac a, auto) |
|
126 done |
|
127 |
|
128 lemma enrich_proc_cur_procs: |
|
129 "\<lbrakk>p' \<notin> all_procs s; no_del_event s; is_created_proc s p; valid s\<rbrakk> |
|
130 \<Longrightarrow> current_procs (enrich_proc s p p') = current_procs s \<union> {p'}" |
|
131 apply (induct s, simp add:is_created_proc_def) |
|
132 apply (frule vt_grant_os, frule vd_cons) |
|
133 apply (case_tac a, auto simp:is_created_proc_simps) |
|
134 done |
|
135 |
|
136 lemma enrich_proc_cur_files: |
|
137 "\<lbrakk>valid s; no_del_event s\<rbrakk> \<Longrightarrow> current_files (enrich_proc s p p') = current_files s" |
|
138 apply (auto simp:current_files_def) |
|
139 apply (simp add: enrich_proc_cur_inof)+ |
|
140 done |
|
141 |
|
142 lemma enrich_proc_cur_fds1: |
|
143 "\<lbrakk>p' \<notin> all_procs s; no_del_event s; is_created_proc s p; valid s; tp \<in> current_procs s\<rbrakk> |
|
144 \<Longrightarrow> current_proc_fds (enrich_proc s p p') tp = current_proc_fds s tp" |
|
145 apply (induct s, simp add:is_created_proc_def) |
|
146 apply (frule vt_grant_os, frule vd_cons) |
|
147 apply (frule not_all_procs_prop3) |
|
148 apply (case_tac a) |
|
149 apply (auto simp:is_created_proc_simps) |
|
150 done |
|
151 |
|
152 lemma enrich_proc_cur_fds1': |
|
153 "\<lbrakk>p' \<notin> all_procs s; no_del_event s; is_created_proc s p; valid s; tp \<noteq> p'\<rbrakk> |
|
154 \<Longrightarrow> current_proc_fds (enrich_proc s p p') tp = current_proc_fds s tp" |
|
155 apply (induct s, simp add:is_created_proc_def) |
|
156 apply (frule vt_grant_os, frule vd_cons) |
|
157 apply (frule not_all_procs_prop3) |
|
158 apply (case_tac a) |
|
159 apply (auto simp:is_created_proc_simps) |
|
160 done |
|
161 |
|
162 lemma enrich_proc_cur_fds: |
|
163 "\<lbrakk>p' \<notin> all_procs s; no_del_event s; is_created_proc s p; valid s\<rbrakk> |
|
164 \<Longrightarrow> current_proc_fds (enrich_proc s p p') tp = (if (tp = p') then proc_file_fds s p else current_proc_fds s tp)" |
|
165 apply (simp add:enrich_proc_cur_fds1' enrich_proc_dup_ffds_eq_fds split:if_splits) |
|
166 done |
|
167 |
|
168 lemma enrich_proc_not_alive: |
|
169 "\<lbrakk>enrich_not_alive s (E_proc p') obj; is_created_proc s p; p' \<notin> all_procs s; no_del_event s; valid s\<rbrakk> |
|
170 \<Longrightarrow> enrich_not_alive (enrich_proc s p p') (E_proc p') obj" |
|
171 apply (case_tac obj) |
|
172 apply (simp_all add:enrich_proc_cur_procs enrich_proc_cur_files enrich_proc_cur_inums |
|
173 enrich_proc_cur_msgqs enrich_proc_cur_msgs enrich_proc_cur_fds) |
|
174 done |
|
175 |
|
176 lemma enrich_proc_filefd: |
|
177 "\<lbrakk>file_of_proc_fd s tp fd = Some f; is_created_proc s p; p' \<notin> all_procs s; no_del_event s; valid s\<rbrakk> |
|
178 \<Longrightarrow> file_of_proc_fd (enrich_proc s p p') tp fd = Some f" |
|
179 apply (induct s arbitrary:tp, simp add:is_created_proc_def) |
|
180 apply (frule vt_grant_os, frule vd_cons) |
|
181 apply (frule not_all_procs_prop3) |
|
182 apply (case_tac a) |
|
183 apply (auto simp:is_created_proc_simps dest:proc_fd_in_procs split:if_splits) |
|
184 done |
|
185 |
|
186 lemma enrich_proc_flagfd: |
|
187 "\<lbrakk>flags_of_proc_fd s tp fd = Some f; is_created_proc s p; p' \<notin> all_procs s; no_del_event s; valid s\<rbrakk> |
|
188 \<Longrightarrow> flags_of_proc_fd (enrich_proc s p p') tp fd = Some f" |
|
189 apply (induct s arbitrary:tp, simp add:is_created_proc_def) |
|
190 apply (frule vt_grant_os, frule vd_cons) |
|
191 apply (frule not_all_procs_prop3) |
|
192 apply (case_tac a) |
|
193 apply (auto simp:is_created_proc_simps dest:proc_fd_in_procs current_fflag_has_ffd split:if_splits option.splits) |
|
194 done |
|
195 |
|
196 lemma enrich_proc_hungs: |
|
197 "\<lbrakk>valid s; no_del_event s\<rbrakk> \<Longrightarrow> files_hung_by_del (enrich_proc s p p') = files_hung_by_del s" |
|
198 apply (induct s, simp) |
|
199 apply (frule vt_grant_os, frule vd_cons) |
|
200 apply (case_tac a, auto simp:files_hung_by_del.simps) |
|
201 done |
|
202 |
|
203 lemma enrich_proc_is_file: |
|
204 "\<lbrakk>valid s; no_del_event s; p' \<notin> all_procs s\<rbrakk> |
|
205 \<Longrightarrow> is_file (enrich_proc s p p') = is_file s" |
|
206 apply (rule ext, case_tac x) |
|
207 apply (auto simp add:is_file_def enrich_proc_cur_itag enrich_proc_cur_inof |
|
208 split:option.splits t_inode_tag.splits) |
|
209 done |
|
210 |
|
211 lemma enrich_proc_is_dir: |
|
212 "\<lbrakk>valid s; no_del_event s; p' \<notin> all_procs s\<rbrakk> |
|
213 \<Longrightarrow> is_dir (enrich_proc s p p') = is_dir s" |
|
214 apply (rule ext, case_tac x) |
|
215 apply (auto simp add:is_dir_def enrich_proc_cur_itag enrich_proc_cur_inof |
|
216 split:option.splits t_inode_tag.splits) |
|
217 done |
|
218 |
|
219 lemma enrich_proc_alive: |
|
220 "\<lbrakk>alive s obj; valid s; is_created_proc s p; p' \<notin> all_procs s; no_del_event s\<rbrakk> |
|
221 \<Longrightarrow> alive (enrich_proc s p p') obj" |
|
222 apply (case_tac obj) |
|
223 apply (simp_all add:enrich_proc_is_file enrich_proc_is_dir enrich_proc_cur_msgqs |
|
224 enrich_proc_cur_msgs enrich_proc_cur_procs enrich_proc_cur_fds |
|
225 enrich_proc_cur_tcps enrich_proc_cur_udps) |
|
226 apply (rule impI, simp) |
|
227 apply (drule current_proc_fds_in_curp, simp, simp add:not_all_procs_prop3) |
|
228 done |
|
229 |
38 lemma enrich_proc_prop: |
230 lemma enrich_proc_prop: |
39 "\<lbrakk>valid s; is_created_proc s p; p' \<notin> all_procs s\<rbrakk> |
231 "\<lbrakk>valid s; is_created_proc s p; p' \<notin> all_procs s; no_del_event s\<rbrakk> |
40 \<Longrightarrow> valid (enrich_proc s p p') \<and> |
232 \<Longrightarrow> valid (enrich_proc s p p') \<and> |
41 (\<forall> obj. alive s obj \<longrightarrow> alive (enrich_proc s p p') obj) \<and> |
|
42 (\<forall> obj. enrich_not_alive s obj \<longrightarrow> enrich_not_alive (enrich_proc s p p') obj) \<and> |
|
43 (files_hung_by_del (enrich_proc s p p') = files_hung_by_del s) \<and> |
|
44 (\<forall> tp. tp \<in> current_procs s \<longrightarrow> cp2sproc (enrich_proc s p p') tp = cp2sproc s tp) \<and> |
233 (\<forall> tp. tp \<in> current_procs s \<longrightarrow> cp2sproc (enrich_proc s p p') tp = cp2sproc s tp) \<and> |
45 (\<forall> f. f \<in> current_files s \<longrightarrow> cf2sfile (enrich_proc s p p') f = cf2sfile s f) \<and> |
234 (\<forall> f. f \<in> current_files s \<longrightarrow> cf2sfile (enrich_proc s p p') f = cf2sfile s f) \<and> |
46 (\<forall> q. q \<in> current_msgqs s \<longrightarrow> cq2smsgq (enrich_proc s p p') q = cq2smsgq s q) \<and> |
235 (\<forall> q. q \<in> current_msgqs s \<longrightarrow> cq2smsgq (enrich_proc s p p') q = cq2smsgq s q) \<and> |
47 (\<forall> tp fd f. file_of_proc_fd s tp fd = Some f \<longrightarrow> file_of_proc_fd (enrich_proc s p p') tp fd = Some f) \<and> |
|
48 (\<forall> tp fd flags. flags_of_proc_fd s tp fd = Some flags \<longrightarrow> |
|
49 flags_of_proc_fd (enrich_proc s p p') tp fd = Some flags) \<and> |
|
50 (\<forall> q. msgs_of_queue (enrich_proc s p p') q = msgs_of_queue s q) \<and> |
|
51 (\<forall> tp fd. fd \<in> proc_file_fds s tp \<longrightarrow> cfd2sfd (enrich_proc s p p') tp fd = cfd2sfd s tp fd) \<and> |
236 (\<forall> tp fd. fd \<in> proc_file_fds s tp \<longrightarrow> cfd2sfd (enrich_proc s p p') tp fd = cfd2sfd s tp fd) \<and> |
52 (cp2sproc (enrich_proc s p p') p' = cp2sproc s p) \<and> |
237 (cp2sproc (enrich_proc s p p') p' = cp2sproc s p) \<and> |
53 (\<forall> fd. fd \<in> proc_file_fds s p \<longrightarrow> cfd2sfd (enrich_proc s p p') p' fd = cfd2sfd s p fd)" |
238 (\<forall> fd. fd \<in> proc_file_fds s p \<longrightarrow> cfd2sfd (enrich_proc s p p') p' fd = cfd2sfd s p fd)" |
54 proof (induct s) |
239 proof (induct s) |
55 case Nil |
240 case Nil |
56 thus ?case by (auto simp:is_created_proc_def) |
241 thus ?case by (auto simp:is_created_proc_def) |
57 next |
242 next |
58 case (Cons e s) |
243 case (Cons e s) |
59 hence vd_cons': "valid (e # s)" and created_cons: "is_created_proc (e # s) p" |
244 hence vd_cons': "valid (e # s)" and created_cons: "is_created_proc (e # s) p" |
60 and all_procs_cons: "p' \<notin> all_procs (e # s)" and vd: "valid s" |
245 and all_procs_cons: "p' \<notin> all_procs (e # s)" and vd: "valid s" |
61 and os: "os_grant s e" and grant: "grant s e" |
246 and os: "os_grant s e" and grant: "grant s e" |
|
247 and nodel_cons: "no_del_event (e # s)" |
62 by (auto dest:vd_cons' vt_grant_os vt_grant) |
248 by (auto dest:vd_cons' vt_grant_os vt_grant) |
63 from all_procs_cons have all_procs: "p' \<notin> all_procs s" by (case_tac e, auto) |
249 from all_procs_cons have all_procs: "p' \<notin> all_procs s" by (case_tac e, auto) |
|
250 from nodel_cons have nodel: "no_del_event s" by (case_tac e, auto) |
64 from Cons have pre: "is_created_proc s p \<Longrightarrow> valid (enrich_proc s p p') \<and> |
251 from Cons have pre: "is_created_proc s p \<Longrightarrow> valid (enrich_proc s p p') \<and> |
65 (\<forall>obj. alive s obj \<longrightarrow> alive (enrich_proc s p p') obj) \<and> |
|
66 (\<forall>obj. enrich_not_alive s obj \<longrightarrow> enrich_not_alive (enrich_proc s p p') obj) \<and> |
|
67 files_hung_by_del (enrich_proc s p p') = files_hung_by_del s \<and> |
|
68 (\<forall>tp. tp \<in> current_procs s \<longrightarrow> cp2sproc (enrich_proc s p p') tp = cp2sproc s tp) \<and> |
252 (\<forall>tp. tp \<in> current_procs s \<longrightarrow> cp2sproc (enrich_proc s p p') tp = cp2sproc s tp) \<and> |
69 (\<forall>f. f \<in> current_files s \<longrightarrow> cf2sfile (enrich_proc s p p') f = cf2sfile s f) \<and> |
253 (\<forall>f. f \<in> current_files s \<longrightarrow> cf2sfile (enrich_proc s p p') f = cf2sfile s f) \<and> |
70 (\<forall>q. q \<in> current_msgqs s \<longrightarrow> cq2smsgq (enrich_proc s p p') q = cq2smsgq s q) \<and> |
254 (\<forall>q. q \<in> current_msgqs s \<longrightarrow> cq2smsgq (enrich_proc s p p') q = cq2smsgq s q) \<and> |
71 (\<forall>tp fd f. file_of_proc_fd s tp fd = Some f \<longrightarrow> file_of_proc_fd (enrich_proc s p p') tp fd = Some f) \<and> |
|
72 (\<forall>tp fd flags. |
|
73 flags_of_proc_fd s tp fd = Some flags \<longrightarrow> flags_of_proc_fd (enrich_proc s p p') tp fd = Some flags) \<and> |
|
74 (\<forall>q. msgs_of_queue (enrich_proc s p p') q = msgs_of_queue s q) \<and> |
|
75 (\<forall>tp fd. fd \<in> proc_file_fds s tp \<longrightarrow> cfd2sfd (enrich_proc s p p') tp fd = cfd2sfd s tp fd) \<and> |
255 (\<forall>tp fd. fd \<in> proc_file_fds s tp \<longrightarrow> cfd2sfd (enrich_proc s p p') tp fd = cfd2sfd s tp fd) \<and> |
76 (cp2sproc (enrich_proc s p p') p' = cp2sproc s p) \<and> |
256 (cp2sproc (enrich_proc s p p') p' = cp2sproc s p) \<and> |
77 (\<forall> fd. fd \<in> proc_file_fds s p \<longrightarrow> cfd2sfd (enrich_proc s p p') p' fd = cfd2sfd s p fd)" |
257 (\<forall> fd. fd \<in> proc_file_fds s p \<longrightarrow> cfd2sfd (enrich_proc s p p') p' fd = cfd2sfd s p fd)" |
78 using vd all_procs by auto |
258 using vd all_procs nodel by auto |
79 have alive_pre: "is_created_proc s p \<Longrightarrow> (\<forall>obj. alive s obj \<longrightarrow> alive (enrich_proc s p p') obj)" |
|
80 using pre by simp |
|
81 hence curf_pre: "is_created_proc s p \<Longrightarrow> (\<forall>f. f \<in> current_files s \<longrightarrow> f \<in> current_files (enrich_proc s p p'))" |
|
82 using vd apply auto |
|
83 apply (drule is_file_or_dir, simp) |
|
84 apply (erule disjE) |
|
85 apply (erule_tac x = "O_file f" in allE, simp add:is_file_in_current) |
|
86 apply (erule_tac x = "O_dir f" in allE, simp add:is_dir_in_current) |
|
87 done |
|
88 have vd_enrich_cons: "valid (enrich_proc (e # s) p p')" |
259 have vd_enrich_cons: "valid (enrich_proc (e # s) p p')" |
89 proof- |
260 proof- |
90 from pre have pre': "is_created_proc s p \<Longrightarrow> valid (enrich_proc s p p')" by simp |
261 from pre have pre': "is_created_proc s p \<Longrightarrow> valid (enrich_proc s p p')" by simp |
91 have "is_created_proc s p \<Longrightarrow> valid (e # enrich_proc s p p')" |
262 have "is_created_proc s p \<Longrightarrow> valid (e # enrich_proc s p p')" |
92 apply (frule pre') |
263 apply (frule pre') |
93 apply (erule_tac s = s in enrich_valid_intro_cons) |
264 apply (erule_tac s = s and obj' = "E_proc p'" in enrich_valid_intro_cons) |
94 apply (simp_all add:os grant vd pre) |
265 apply (simp_all add: pre nodel_cons all_procs_cons vd_cons') |
95 done |
266 apply (clarsimp simp:enrich_proc_alive nodel all_procs vd) |
|
267 apply (rule allI, rule impI, erule enrich_proc_not_alive) |
|
268 apply (simp_all add:nodel all_procs vd enrich_proc_hungs enrich_proc_cur_msgs) |
|
269 apply ((rule allI| rule impI)+, erule enrich_proc_filefd) |
|
270 apply (simp_all add:nodel all_procs vd) |
|
271 apply ((rule allI| rule impI)+, erule enrich_proc_flagfd) |
|
272 apply (simp_all add:nodel all_procs vd) |
|
273 done |
96 moreover have "\<And>f fds. \<lbrakk>valid (Execve p f fds # enrich_proc s p p'); is_created_proc s p; |
274 moreover have "\<And>f fds. \<lbrakk>valid (Execve p f fds # enrich_proc s p p'); is_created_proc s p; |
97 valid (Execve p f fds # s); p' \<notin> all_procs s\<rbrakk> |
275 valid (Execve p f fds # s); p' \<notin> all_procs s\<rbrakk> |
98 \<Longrightarrow> valid (Execve p' f (fds \<inter> proc_file_fds s p) # Execve p f fds # enrich_proc s p p')" |
276 \<Longrightarrow> valid (Execve p' f (fds \<inter> proc_file_fds s p) # Execve p f fds # enrich_proc s p p')" |
99 proof- |
277 proof- |
100 fix f fds |
278 fix f fds |
101 assume a1: "valid (Execve p f fds # enrich_proc s p p')" and a2: "is_created_proc s p" |
279 assume a1: "valid (Execve p f fds # enrich_proc s p p')" and a2: "is_created_proc s p" |
102 and a3: "valid (Execve p f fds # s)" and a0: "p' \<notin> all_procs s" |
280 and a3: "valid (Execve p f fds # s)" and a0: "p' \<notin> all_procs s" |
103 have cp2sp: "\<forall> tp. tp \<in> current_procs s \<longrightarrow> cp2sproc (enrich_proc s p p') tp = cp2sproc s tp" |
281 have cp2sp: "\<forall> tp. tp \<in> current_procs s \<longrightarrow> cp2sproc (enrich_proc s p p') tp = cp2sproc s tp" |
104 and cf2sf: "\<forall> tf. tf \<in> current_files s \<longrightarrow> cf2sfile (enrich_proc s p p') tf = cf2sfile s tf" |
282 and cf2sf: "\<forall> tf. tf \<in> current_files s \<longrightarrow> cf2sfile (enrich_proc s p p') tf = cf2sfile s tf" |
105 and cfd2sfd: "\<forall> tp tfd. tfd \<in> proc_file_fds s tp \<longrightarrow> cfd2sfd (enrich_proc s p p') tp tfd = cfd2sfd s tp tfd" |
283 and cfd2sfd: "\<forall> tp tfd. tfd \<in> proc_file_fds s tp \<longrightarrow> cfd2sfd (enrich_proc s p p') tp tfd = cfd2sfd s tp tfd" |
106 and ffd_remain: "\<forall>tp fd f. file_of_proc_fd s tp fd = Some f \<longrightarrow> |
|
107 file_of_proc_fd (enrich_proc s p p') tp fd = Some f" |
|
108 and dup_sp: "cp2sproc (enrich_proc s p p') p' = cp2sproc s p" |
284 and dup_sp: "cp2sproc (enrich_proc s p p') p' = cp2sproc s p" |
109 and dup_sfd: "\<forall> fd. fd \<in> proc_file_fds s p \<longrightarrow> cfd2sfd (enrich_proc s p p') p' fd = cfd2sfd s p fd" |
285 and dup_sfd: "\<forall> fd. fd \<in> proc_file_fds s p \<longrightarrow> cfd2sfd (enrich_proc s p p') p' fd = cfd2sfd s p fd" |
110 using pre a2 by auto |
286 using pre a2 |
|
287 by auto |
111 show "valid (Execve p' f (fds \<inter> proc_file_fds s p) # Execve p f fds # enrich_proc s p p')" |
288 show "valid (Execve p' f (fds \<inter> proc_file_fds s p) # Execve p f fds # enrich_proc s p p')" |
112 proof- |
289 proof- |
113 from a0 a3 have a0': "p' \<noteq> p" by (auto dest!:vt_grant_os not_all_procs_prop3) |
290 from a0 a3 have a0': "p' \<noteq> p" by (auto dest!:vt_grant_os not_all_procs_prop3) |
114 from a3 have grant: "grant s (Execve p f fds)" and os: "os_grant s (Execve p f fds)" |
291 from a3 have grant: "grant s (Execve p f fds)" and os: "os_grant s (Execve p f fds)" |
115 by (auto dest:vt_grant_os vt_grant simp del:os_grant.simps) |
292 by (auto dest:vt_grant_os vt_grant simp del:os_grant.simps) |
116 have f_in: "is_file (enrich_proc s p p') f" |
293 have f_in: "is_file (enrich_proc s p p') f" |
117 proof- |
294 using vd nodel os all_procs |
118 from pre a2 |
295 by (auto dest:vt_grant_os simp:enrich_proc_is_file) |
119 have a4: "\<forall> obj. alive s obj \<longrightarrow> alive (enrich_proc s p p') obj" |
|
120 by (auto) |
|
121 show ?thesis using a3 a4 |
|
122 apply (erule_tac x = "O_file f" in allE) |
|
123 by (auto dest:vt_grant_os) |
|
124 qed |
|
125 moreover have a5: "proc_file_fds s p \<subseteq> proc_file_fds (Execve p f fds # enrich_proc s p p') p'" |
296 moreover have a5: "proc_file_fds s p \<subseteq> proc_file_fds (Execve p f fds # enrich_proc s p p') p'" |
126 using a3 a0' |
297 using a3 a0' |
127 apply (frule_tac vt_grant_os) |
298 apply (frule_tac vt_grant_os) |
128 apply (auto simp:proc_file_fds_def) |
299 apply (auto simp:proc_file_fds_def) |
129 apply (rule_tac x = fa in exI) |
300 apply (rule_tac x = fa in exI) |
485 using created_cons vd_cons' all_procs_cons |
646 using created_cons vd_cons' all_procs_cons |
486 apply (case_tac e) |
647 apply (case_tac e) |
487 apply (auto simp:is_created_proc_simps split:if_splits) |
648 apply (auto simp:is_created_proc_simps split:if_splits) |
488 done |
649 done |
489 qed |
650 qed |
490 moreover have "\<forall>obj. alive (e # s) obj \<longrightarrow> alive (enrich_proc (e # s) p p') obj" |
651 moreover have "\<forall>tp fd. fd \<in> proc_file_fds (e # s) tp \<longrightarrow> |
|
652 cfd2sfd (enrich_proc (e # s) p p') tp fd = cfd2sfd (e # s) tp fd" |
491 proof clarify |
653 proof clarify |
492 fix obj |
654 fix tp fd |
493 assume a0: "alive (e # s) obj" |
655 assume a1: "fd \<in> proc_file_fds (e # s) tp" |
494 have a1: "is_created_proc s p \<Longrightarrow> \<forall> obj. alive s obj \<longrightarrow> alive (enrich_proc s p p') obj" |
656 from a1 obtain f where a1': "file_of_proc_fd (e # s) tp fd = Some f" |
495 using pre by auto |
657 by (auto simp:proc_file_fds_def) |
496 show "alive (enrich_proc (e # s) p p') obj" (* |
658 from pre have pre_sfd: "\<And> tp fd. \<lbrakk>fd \<in> proc_file_fds s tp; is_created_proc s p\<rbrakk> \<Longrightarrow> |
497 proof (cases e) |
659 cfd2sfd (enrich_proc s p p') tp fd = cfd2sfd s tp fd" by auto |
498 case (Execve tp f fds) |
660 hence pre_sfd': "\<And> tp fd f. \<lbrakk>file_of_proc_fd s tp fd = Some f; is_created_proc s p\<rbrakk> \<Longrightarrow> |
499 with created_cons a1 |
661 cfd2sfd (enrich_proc s p p') tp fd = cfd2sfd s tp fd" by (auto simp:proc_file_fds_def) |
500 have b1: "\<forall> obj. alive s obj \<longrightarrow> alive (enrich_proc s p p') obj" |
662 hence pre_sfd'': "\<And> tp fd f proc. \<lbrakk>file_of_proc_fd s tp fd = Some f; is_created_proc s p; p = proc\<rbrakk> \<Longrightarrow> |
501 by (auto simp:is_created_proc_simps) |
663 cfd2sfd (enrich_proc s proc p') tp fd = cfd2sfd s tp fd" by (auto simp:proc_file_fds_def) |
|
664 from a1' all_procs_cons vd_cons' have a2: "tp \<noteq> p'" |
|
665 apply (drule_tac not_all_procs_prop3) |
|
666 apply (drule proc_fd_in_procs, simp) |
|
667 by (rule notI, simp) |
|
668 have a3: "p' \<noteq> p" using all_procs_cons created_cons |
|
669 apply (drule_tac not_all_procs_prop3) |
|
670 apply (rule notI, simp add:is_created_proc_def) |
|
671 done |
|
672 have a4: "file_of_proc_fd (enrich_proc (e # s) p p') tp fd = Some f" |
|
673 using a1' nodel_cons all_procs_cons a1' created_cons vd_cons' |
|
674 apply (frule_tac enrich_proc_filefd, simp_all) |
|
675 done |
|
676 show "cfd2sfd (enrich_proc (e # s) p p') tp fd = cfd2sfd (e # s) tp fd" |
|
677 proof- |
|
678 have b1: "\<And> proc f' fds. e = Execve proc f' fds |
|
679 \<Longrightarrow> cfd2sfd (enrich_proc (e # s) p p') tp fd = cfd2sfd (e # s) tp fd" |
|
680 using a4 vd_enrich_cons a1' vd_cons' created_cons |
|
681 apply (simp split:if_splits del:file_of_proc_fd.simps add:a2) |
|
682 apply (simp only:cfd2sfd_execve) |
|
683 apply (drule_tac s = "Execve proc f' fds # enrich_proc s proc p'" in vd_cons) |
|
684 apply (simp split:if_splits add:a2) |
|
685 apply (drule_tac p' = proc and fd' = fd and s = "enrich_proc s proc p'" in cfd2sfd_execve, simp+) |
|
686 apply (erule_tac pre_sfd'', simp add:is_created_proc_simps, simp) |
|
687 apply (drule_tac p' = tp and fd' = fd in cfd2sfd_execve, simp+) |
|
688 apply (erule_tac pre_sfd'', simp add:is_created_proc_simps, simp) |
|
689 apply (simp only:cfd2sfd_execve) |
|
690 apply (rule_tac pre_sfd') |
|
691 apply (auto split:if_splits simp:is_created_proc_simps) |
|
692 done |
|
693 have b2: "\<And> proc proc' fds. e = Clone proc proc' fds |
|
694 \<Longrightarrow> cfd2sfd (enrich_proc (e # s) p p') tp fd = cfd2sfd (e # s) tp fd" |
|
695 using a4 vd_enrich_cons a1' vd_cons' created_cons |
|
696 apply (simp split:if_splits del:file_of_proc_fd.simps) |
|
697 apply (simp add:cfd2sfd_clone add:a2) |
|
698 apply (simp add:cfd2sfd_clone split:if_splits) |
|
699 apply (erule pre_sfd'', simp add:is_created_proc_simps, simp) |
|
700 apply (erule pre_sfd', simp add:is_created_proc_simps) |
|
701 done |
|
702 have b3: "\<And> proc f' flags fd' opt. e = Open proc f' flags fd' opt |
|
703 \<Longrightarrow> cfd2sfd (enrich_proc (e # s) p p') tp fd = cfd2sfd (e # s) tp fd" |
|
704 apply (simp split:if_splits) |
|
705 thm cfd2sfd_open |
|
706 sorry |
|
707 have b4: "\<And> proc fd'. e = ReadFile proc fd' |
|
708 \<Longrightarrow> cfd2sfd (enrich_proc (e # s) p p') tp fd = cfd2sfd (e # s) tp fd" |
|
709 using a4 vd_enrich_cons a1' vd_cons' created_cons |
|
710 apply (simp split:if_splits del:file_of_proc_fd.simps) |
|
711 apply (frule_tac s = "ReadFile proc fd' # enrich_proc s proc p'" in vd_cons) |
|
712 apply (simp add:cfd2sfd_other) |
|
713 apply (erule pre_sfd'', simp add:is_created_proc_simps, simp) |
|
714 apply (simp add:cfd2sfd_other) |
|
715 apply (erule pre_sfd', simp add:is_created_proc_simps) |
|
716 done |
502 show ?thesis |
717 show ?thesis |
503 using created_cons all_procs_cons vd_enrich_cons Execve b1 os a0 |
718 apply (case_tac e) |
504 apply (simp add:alive_execve split:if_splits) |
719 apply (erule b1, erule b2) |
505 apply (frule_tac vd_cons) defer |
720 prefer 4 apply (erule b3) prefer 4 apply (erule b4) |
506 apply (frule_tac vd_cons) |
721 using vd created_cons nodel_cons a1' a4 vd_enrich_cons vd_cons' |
507 using vd_cons' Execve vd os |
722 apply (auto intro!:pre_sfd' simp:cfd2sfd_simps is_created_proc_simps |
508 apply (auto simp:is_file_simps is_dir_simps is_created_proc_simps alive.simps |
723 simp del:file_of_proc_fd.simps split:if_splits dest:vd_cons enrich_proc_filefd) |
509 split:t_object.splits if_splits |
724 apply (simp_all) |
510 dest:set_mp file_fds_subset_pfds) |
725 done |
511 apply (erule_tac x = "O_proc nat" in allE, simp) |
726 qed |
512 apply (erule_tac x = "O_file list" in allE, simp) |
727 qed |
513 apply (drule set_mp, simp) |
|
514 apply (drule_tac s = s and p = tp in file_fds_subset_pfds) |
|
515 apply (erule_tac x = "O_fd tp nat2" in allE, simp) |
|
516 apply (auto)[1] |
|
517 apply (erule_tac x = "O_fd nat1 nat2" in allE, auto dest:set_mp file_fds_subset_pfds)[1] |
|
518 apply (erule_tac x = "O_dir list" in allE, simp) |
|
519 sorry |
|
520 show ?thesis *) sorry |
|
521 moreover have "\<forall>obj. enrich_not_alive (e # s) obj \<longrightarrow> enrich_not_alive (enrich_proc (e # s) p p') obj" |
|
522 thm enrich_not_alive.simps |
|
523 sorry |
|
524 moreover have "files_hung_by_del (enrich_proc (e # s) p p') = files_hung_by_del (e # s)" |
|
525 proof- |
|
526 have "is_created_proc s p \<Longrightarrow> files_hung_by_del (enrich_proc s p p') = files_hung_by_del s" |
|
527 and ffd_remain: "is_created_proc s p \<Longrightarrow> |
|
528 \<forall>tp fd f. file_of_proc_fd s tp fd = Some f \<longrightarrow> |
|
529 file_of_proc_fd (enrich_proc s p p') tp fd = Some f" |
|
530 using pre by auto |
|
531 with created_cons all_procs_cons os vd_cons' vd |
|
532 show ?thesis |
|
533 apply (frule_tac not_all_procs_prop3) |
|
534 apply (case_tac e) |
|
535 apply (auto simp:files_hung_by_del.simps is_created_proc_simps) |
|
536 apply (auto simp:enrich_proc_dup_ffd_eq proc_file_fds_def procfd_of_file_eq_fpfd'' |
|
537 dest:procfd_of_file_imp_fpfd procfd_of_file_imp_fpfd' procfd_of_file_non_empty |
|
538 ) |
|
539 apply (auto simp:enrich_proc_dup_ffd_eq proc_file_fds_def split:if_splits)[1] |
|
540 |
|
541 apply (auto simp:enrich_proc_dup_ffd_eq proc_file_fds_def files_hung_by_del.simps |
|
542 split:option.splits)[1] |
|
543 apply (auto split:option.splits)[1] |
|
544 thm is_created_proc_simps |
|
545 sorry |
|
546 moreover have "\<forall>tp. tp \<in> current_procs (e # s) \<longrightarrow> cp2sproc (enrich_proc (e # s) p p') tp = cp2sproc (e # s) tp" |
728 moreover have "\<forall>tp. tp \<in> current_procs (e # s) \<longrightarrow> cp2sproc (enrich_proc (e # s) p p') tp = cp2sproc (e # s) tp" |
547 sorry |
729 sorry |
548 moreover have "\<forall>f. f \<in> current_files (e # s) \<longrightarrow> cf2sfile (enrich_proc (e # s) p p') f = cf2sfile (e # s) f" |
730 moreover have "\<forall>f. f \<in> current_files (e # s) \<longrightarrow> cf2sfile (enrich_proc (e # s) p p') f = cf2sfile (e # s) f" |
549 sorry |
731 sorry |
550 moreover have "\<forall>q. q \<in> current_msgqs (e # s) \<longrightarrow> cq2smsgq (enrich_proc (e # s) p p') q = cq2smsgq (e # s) q" |
732 moreover have "\<forall>q. q \<in> current_msgqs (e # s) \<longrightarrow> cq2smsgq (enrich_proc (e # s) p p') q = cq2smsgq (e # s) q" |
551 sorry |
733 sorry |
552 moreover have "\<forall>tp fd f. file_of_proc_fd (e # s) tp fd = Some f \<longrightarrow> |
|
553 file_of_proc_fd (enrich_proc (e # s) p p') tp fd = Some f" |
|
554 sorry |
|
555 moreover have "\<forall>tp fd flags. flags_of_proc_fd (e # s) tp fd = Some flags \<longrightarrow> |
|
556 flags_of_proc_fd (enrich_proc (e # s) p p') tp fd = Some flags" |
|
557 sorry |
|
558 moreover have "\<forall>q. msgs_of_queue (enrich_proc (e # s) p p') q = msgs_of_queue (e # s) q" |
|
559 sorry |
|
560 moreover have "\<forall>tp fd. fd \<in> proc_file_fds (e # s) tp \<longrightarrow> |
|
561 cfd2sfd (enrich_proc (e # s) p p') tp fd = cfd2sfd (e # s) tp fd" |
|
562 sorry |
|
563 moreover have "cp2sproc (enrich_proc (e # s) p p') p' = cp2sproc (e # s) p" |
734 moreover have "cp2sproc (enrich_proc (e # s) p p') p' = cp2sproc (e # s) p" |
564 proof- |
735 proof- |
565 from pre have b0: "is_created_proc s p \<Longrightarrow> cp2sproc (enrich_proc s p p') p' = cp2sproc s p" by simp |
736 from pre have b0: "is_created_proc s p \<Longrightarrow> cp2sproc (enrich_proc s p p') p' = cp2sproc s p" by simp |
566 have b1: "\<And> tp f fds. \<lbrakk>valid (enrich_proc (Execve tp f fds # s) p p'); valid (Execve tp f fds # s); |
737 have b1: "\<And> tp f fds. \<lbrakk>valid (enrich_proc (Execve tp f fds # s) p p'); valid (Execve tp f fds # s); |
567 is_created_proc (Execve tp f fds # s) p; p' \<notin> all_procs (Execve tp f fds # s)\<rbrakk> |
738 is_created_proc (Execve tp f fds # s) p; p' \<notin> all_procs (Execve tp f fds # s)\<rbrakk> |