# HG changeset patch # User chunhan # Date 1370331469 -28800 # Node ID 570f90f175eec2ef94d5caa1124c42c6976e8ef7 # Parent c8b7c24f1db6dae3dc23fc0b2755fa9b15dc8e45 updated diff -r c8b7c24f1db6 -r 570f90f175ee Co2sobj_prop.thy --- a/Co2sobj_prop.thy Mon Jun 03 14:18:14 2013 +0800 +++ b/Co2sobj_prop.thy Tue Jun 04 15:37:49 2013 +0800 @@ -1102,43 +1102,210 @@ (******** cp2sproc simpset *********) -lemma cp2sproc_nil: "p \ init_processes \ cp2sproc [] p = SInit p" -apply (simp add:cp2sproc_def) -by (simp add:cp2sproc_def index_of_proc.simps) +lemma not_init_intro_proc: (*???*) + "\p \ current_procs s; valid s\ \ deleted (O_proc p) s \ p \ init_procs" +using not_deleted_init_proc by auto + +lemma not_init_intro_proc': (*???*) + "\p \ current_procs s; valid s\ \ \ (\ deleted (O_proc p) s \ p \ init_procs)" +using not_deleted_init_proc by auto + +lemma cp2sproc_clone: + "valid (Clone p p' fds shms # s) \ cp2sproc (Clone p p' fds shms # s) = (cp2sproc s) (p' := + case (sectxt_of_obj s (O_proc p)) of + Some sec \ Some (Created, sec, + {sfd. \ fd \ fds. \ f. file_of_proc_fd s p fd = Some f \ cfd2sfd s p fd = Some sfd}, + {(sh, flag) | h sh flag. h \ shms \ ch2sshm s h = Some sh \ flag_of_proc_shm s p h = Some flag}) + | _ \ None)" +apply (frule cph2spshs_clone, frule cpfd2sfds_clone) +apply (frule vd_cons, frule vt_grant_os, simp only:os_grant.simps) +apply ((erule exE| erule conjE)+, frule not_init_intro_proc, simp, rule ext, case_tac "x = p'", simp) +apply (auto simp:cp2sproc_def sectxt_of_obj_simps dest!:current_has_sec' + dest:current_proc_has_sec split:option.splits if_splits) +done + +lemma cp2sproc_other: + "\valid (e # s); + \ p f flags fd opt. e \ Open p f flags fd opt; + \ p fd. e \ CloseFd p fd; + \ p h flag. e \ Attach p h flag; + \ p h. e \ Detach p h; + \ p h. e \ DeleteShM p h; + \ p p' fds shms. e \ Clone p p' fds shms; + \ p f fds. e \ Execve p f fds; + \ p p'. e \ Kill p p'; + \ p. e \ Exit p\ \ cp2sproc (e # s) = cp2sproc s" +apply (frule cph2spshs_other, simp+, frule cpfd2sfds_other, simp+) +apply (frule vt_grant_os, frule vd_cons, rule ext, case_tac e, simp_all) +apply (auto simp:cp2sproc_def sectxt_of_obj_simps dest!:current_has_sec' + dest:current_proc_has_sec not_deleted_init_proc split:option.splits if_splits) +done -lemma cp2sproc_nil': "p \ current_procs [] \ cp2sproc [] p = SInit p" -by (simp add:cp2sproc_nil current_procs.simps) +lemma cp2sproc_open: + "valid (Open p f flags fd opt # s) \ + cp2sproc (Open p f flags fd opt # s) = (cp2sproc s) (p := + case (sectxt_of_obj s (O_proc p), sectxt_of_obj (Open p f flags fd opt # s) (O_fd p fd), + cf2sfile (Open p f flags fd opt # s) f) of + (Some sec, Some fdsec, Some sf) \ Some (if (\ deleted (O_proc p) s \ p \ init_procs) + then Init p else Created, sec, + (cpfd2sfds s p) \ {(fdsec, flags, sf)}, cph2spshs s p) + | _ \ None)" +apply (frule cph2spshs_other, simp, simp, simp, simp, simp, simp, simp) +apply (frule cpfd2sfds_open, frule vt_grant_os, frule vd_cons, rule ext) +apply (case_tac "x = p") +apply (auto simp:cp2sproc_def sectxt_of_obj_simps current_files_simps + dest!:current_has_sec' dest!:current_file_has_sfile' dest:is_file_in_current is_dir_in_current + dest:current_proc_has_sec not_deleted_init_proc split:option.splits if_splits) +done + +lemma cp2sproc_closefd: + "valid (CloseFd p fd # s) \ + cp2sproc (CloseFd p fd # s) = (cp2sproc s) (p := + if (fd \ proc_file_fds s p) + then (case (cfd2sfd s p fd) of + Some sfd \ (if (\ fd' f'. fd' \ fd \ file_of_proc_fd s p fd' = Some f' \ cfd2sfd s p fd' = Some sfd) + then cp2sproc s p + else (case (sectxt_of_obj s (O_proc p)) of + Some sec \ Some (if (\ deleted (O_proc p) s \ p \ init_procs) + then Init p else Created, + sec, cpfd2sfds s p - {sfd}, cph2spshs s p) + | _ \ None)) + | _ \ cp2sproc s p) + else cp2sproc s p)" +apply (frule cpfd2sfds_closefd, frule cph2spshs_other, simp, simp, simp, simp, simp, simp, simp) +apply (frule vt_grant_os, frule vd_cons, rule ext) +apply (case_tac "x = p") +apply (auto simp:cp2sproc_def sectxt_of_obj_simps current_files_simps + dest!:current_has_sec' dest!:current_file_has_sfile' dest:is_file_in_current is_dir_in_current + dest:current_proc_has_sec not_deleted_init_proc split:option.splits if_splits) +done -lemma cp2sproc_clone: "cp2sproc (Clone p p' # \) p'' = ( - if (p'' = p') then SCrea (Suc (length \)) - else cp2sproc \ p'' )" -by (auto simp:cp2sproc_def index_of_proc.simps d2s_aux.simps) +lemma cp2sproc_attach: + "valid (Attach p h flag # s) \ + cp2sproc (Attach p h flag # s) = (cp2sproc s) (p := + (case (ch2sshm s h) of + Some sh \ (case (sectxt_of_obj s (O_proc p)) of + Some sec \ Some (if (\ deleted (O_proc p) s \ p \ init_procs) + then Init p else Created, + sec, cpfd2sfds s p, cph2spshs s p \ {(sh, flag)}) + | _ \ None) + | _ \ cp2sproc s p) )" +apply (frule cph2spshs_attach, frule cpfd2sfds_other, simp, simp, simp, simp, simp, simp) +apply (frule vt_grant_os, frule vd_cons, rule ext) +apply (case_tac "x = p") +apply (auto simp:cp2sproc_def sectxt_of_obj_simps current_files_simps + dest!:current_has_sec' dest!:current_file_has_sfile' dest:is_file_in_current is_dir_in_current + dest:current_proc_has_sec not_deleted_init_proc split:option.splits if_splits) +done + +lemma cp2sproc_detach: + "valid (Detach p h # s) \ + cp2sproc (Detach p h # s) = (cp2sproc s) (p := + (case (ch2sshm s h, flag_of_proc_shm s p h) of + (Some sh, Some flag) \ if (\ h'. h' \ h \ (p,flag) \ procs_of_shm s h' \ ch2sshm s h' = Some sh) + then cp2sproc s p + else (case (sectxt_of_obj s (O_proc p)) of + Some sec \ Some (if (\ deleted (O_proc p) s \ p \ init_procs) + then Init p else Created, sec, + cpfd2sfds s p, cph2spshs s p - {(sh, flag)}) + | None \ None) + | _ \ cp2sproc s p) )" +apply (frule cph2spshs_detach, frule cpfd2sfds_other, simp, simp, simp, simp, simp, simp) +apply (frule vt_grant_os, frule vd_cons, rule ext) +apply (case_tac "x = p") +apply (auto simp:cp2sproc_def sectxt_of_obj_simps current_files_simps + dest!:current_has_sec' dest!:current_file_has_sfile' dest:is_file_in_current is_dir_in_current + dest:current_proc_has_sec not_deleted_init_proc split:option.splits if_splits) +done -lemma cp2sproc_other: "\ p p'. e \ Clone p p' \ cp2sproc (e # \) p'' = cp2sproc \ p''" -apply (case_tac e) -by (auto simp:cp2sproc_def index_of_proc.simps d2s_aux.simps) +lemma cp2sproc_deleteshm: + "valid (DeleteShM p h # s) \ + cp2sproc (DeleteShM p h # s) = (\ p'. + (case (ch2sshm s h, flag_of_proc_shm s p' h) of + (Some sh, Some flag) \ if (\ h'. h' \ h \ (p', flag) \ procs_of_shm s h' \ ch2sshm s h' = Some sh) + then cp2sproc s p' + else (case (sectxt_of_obj s (O_proc p')) of + Some sec \ Some (if (\ deleted (O_proc p') s \ p' \ init_procs) + then Init p' else Created, sec, + cpfd2sfds s p', cph2spshs s p' - {(sh, flag)}) + | None \ None) + | _ \ cp2sproc s p') )" +apply (frule cph2spshs_deleteshm, frule cpfd2sfds_other, simp, simp, simp, simp, simp, simp) +apply (frule vt_grant_os, frule vd_cons, rule ext) +apply (auto simp:cp2sproc_def sectxt_of_obj_simps current_files_simps + dest!:current_has_sec' dest!:current_file_has_sfile' dest:is_file_in_current is_dir_in_current + dest:current_proc_has_sec not_deleted_init_proc split:option.splits if_splits) +done + +lemma cp2sproc_execve: + "valid (Execve p f fds # s) \ + cp2sproc (Execve p f fds # s) = (cp2sproc s) (p := + (case (sectxt_of_obj (Execve p f fds # s) (O_proc p)) of + Some sec \ Some (if (\ deleted (O_proc p) s \ p \ init_procs) then Init p else Created, sec, + {sfd. \ fd \ fds. \ f. file_of_proc_fd s p fd = Some f \ cfd2sfd s p fd = Some sfd}, {}) + | _ \ None) )" +apply (frule cph2spshs_execve, frule cpfd2sfds_execve) +apply (frule vt_grant_os, frule vd_cons, rule ext) +apply (auto simp:cp2sproc_def sectxt_of_obj_simps current_files_simps + dest!:current_has_sec' dest!:current_file_has_sfile' dest:is_file_in_current is_dir_in_current + dest:current_proc_has_sec not_deleted_init_proc split:option.splits if_splits) +done -lemmas cp2sproc_simps = cp2sproc_nil cp2sproc_nil' cp2sproc_clone cp2sproc_other +lemma cp2sproc_kill: + "\valid (Kill p p' # s); p'' \ p'\ \ + cp2sproc (Kill p p' # s) p'' = (cp2sproc s) p''" +apply (frule cph2spshs_kill, frule cpfd2sfds_kill) +apply (frule vt_grant_os, frule vd_cons) +apply (auto simp:cp2sproc_def sectxt_of_obj_simps current_files_simps + dest!:current_has_sec' dest!:current_file_has_sfile' dest:is_file_in_current is_dir_in_current + dest:current_proc_has_sec not_deleted_init_proc split:option.splits if_splits) +done + +lemma cp2sproc_kill': + "\valid (Kill p p' # s); p'' \ current_procs (Kill p p' # s)\ \ + cp2sproc (Kill p p' # s) p'' = (cp2sproc s) p''" +by (drule_tac p'' = p'' in cp2sproc_kill, simp+) + +lemma cp2sproc_exit: + "\valid (Exit p # s); p' \ p\ \ + cp2sproc (Exit p # s) p' = (cp2sproc s) p'" +apply (frule cph2spshs_exit, frule cpfd2sfds_exit) +apply (frule vt_grant_os, frule vd_cons) +apply (auto simp:cp2sproc_def sectxt_of_obj_simps current_files_simps + dest!:current_has_sec' dest!:current_file_has_sfile' dest:is_file_in_current is_dir_in_current + dest:current_proc_has_sec not_deleted_init_proc split:option.splits if_splits) +done + +lemma cp2sproc_exit': + "\valid (Exit p # s); p' \ current_procs (Exit p # s)\ \ + cp2sproc (Exit p # s) p' = (cp2sproc s) p'" +by (drule_tac p'= p' in cp2sproc_exit, simp+) + +lemmas cp2sproc_simps = cp2sproc_open cp2sproc_closefd cp2sproc_attach cp2sproc_detach cp2sproc_deleteshm + cp2sproc_clone cp2sproc_execve cp2sproc_kill cp2sproc_exit cp2sproc_other (********************* cm2smsg simpset ***********************) -lemma cm2smsg_nil: "m \ init_msgs \ cm2smsg [] m = SInit m" -by (simp add:cm2smsg_def index_of_msg.simps) - -lemma cm2smsg_nil': "m \ current_msgs [] \ cm2smsg [] m = SInit m" -by (simp add:cm2smsg_nil current_msgs.simps) - -lemma cm2smsg_createmsg: "cm2smsg (CreateMsg p m # \) m' = (if (m' = m) then SCrea (Suc (length \)) else cm2smsg \ m')" -by (simp add:cm2smsg_def index_of_msg.simps d2s_aux.simps) - -lemma cm2smsg_other: "\ p m. e \ CreateMsg p m \ cm2smsg (e # \) m' = cm2smsg \ m'" +lemma cm2smsg_other: "\valid (e # s); \ p q m. e \ SendMsg p q m\ \ cm2smsg (e # s) = cm2smsg s" +apply (frule vt_grant_os, frule vd_cons, rule ext, rule ext) apply (case_tac e) -by (auto simp:cm2smsg_def index_of_msg.simps d2s_aux.simps) +apply (auto simp:cm2smsg_def sectxt_of_obj_simps split:option.splits if_splits) lemmas cm2smsg_simps = cm2smsg_nil cm2smsg_nil' cm2smsg_createmsg cm2smsg_other +(********************* cq2smsgq simpset ***********************) + +lemma cq2smsgq_other: "\ p m. e \ CreateMsg p m \ cm2smsg (e # \) m' = cm2smsg \ m'" +apply (case_tac e) +by (auto simp:cm2smsg_def index_of_msg.simps d2s_aux.simps) + +lemmas cq2smsgq_simps = cm2smsg_nil cm2smsg_nil' cm2smsg_createmsg cm2smsg_other + + + + end (*<*)