no_shm_selinux/S2ss_prop.thy
changeset 77 6f7b9039715f
child 92 d9dc04c3ea90
equal deleted inserted replaced
76:f27ba31b7e96 77:6f7b9039715f
       
     1 (*<*)
       
     2 theory S2ss_prop
       
     3 imports Main Flask Flask_type Static Static_type Init_prop Tainted_prop Valid_prop Alive_prop Co2sobj_prop
       
     4 begin
       
     5 (*>*)
       
     6 
       
     7 context tainting_s begin
       
     8 
       
     9 (* simpset for s2ss*)
       
    10 
       
    11 lemma co2sobj_some_case:
       
    12   "\<lbrakk>co2sobj s obj = Some sobj; \<And> p. obj = O_proc p \<Longrightarrow> P (O_proc p);
       
    13     \<And> f. obj = O_file f \<Longrightarrow> P (O_file f);
       
    14     \<And> f. obj = O_dir f \<Longrightarrow> P (O_dir f); \<And> q. obj = O_msgq q \<Longrightarrow> P (O_msgq q)\<rbrakk>
       
    15    \<Longrightarrow> P obj" (*  \<And> h. obj = O_shm h \<Longrightarrow> P (O_shm h); *)
       
    16 by (case_tac obj, auto)
       
    17 
       
    18 lemma co2sobj_execve_alive:
       
    19   "\<lbrakk>alive s obj; co2sobj s obj = Some x; valid (Execve p f fds # s)\<rbrakk>
       
    20    \<Longrightarrow> alive (Execve p f fds # s) obj"
       
    21 apply (erule co2sobj_some_case)
       
    22 by (auto simp:alive_simps simp del:alive.simps)
       
    23 
       
    24 lemma s2ss_execve':
       
    25   "valid (Execve p f fds # s) \<Longrightarrow> s2ss (Execve p f fds # s) = (
       
    26      if (\<exists> p'. p' \<noteq> p \<and> p' \<in> current_procs s \<and> co2sobj s (O_proc p') = co2sobj s (O_proc p))
       
    27      then (case (cp2sproc (Execve p f fds # s) p) of
       
    28              Some sp \<Rightarrow> s2ss s \<union> {S_proc sp (O_proc p \<in> tainted s \<or> O_file f \<in> tainted s)}
       
    29            | _ \<Rightarrow> {} )
       
    30      else (case (cp2sproc (Execve p f fds # s) p, cp2sproc s p) of
       
    31              (Some sp, Some sp') \<Rightarrow> s2ss s - {S_proc sp' (O_proc p \<in> tainted s)}
       
    32                                     \<union> {S_proc sp (O_proc p \<in> tainted s \<or> O_file f \<in> tainted s)}
       
    33            | _ \<Rightarrow> {} ) )"
       
    34 apply (frule vd_cons, frule vt_grant_os, simp split:if_splits)
       
    35 
       
    36 apply (rule conjI, rule impI, (erule exE|erule conjE)+)
       
    37 apply (frule_tac p = p in current_proc_has_sp, simp, erule exE)
       
    38 apply (frule_tac p = p' in current_proc_has_sp, simp, erule exE, simp)
       
    39 apply (subgoal_tac "p \<in> current_procs (Execve p f fds # s)")
       
    40 apply (drule_tac p = p and s = "Execve p f fds # s" in current_proc_has_sp, simp)
       
    41 apply (erule exE, simp)
       
    42 apply (simp add:s2ss_def, rule set_eqI, rule iffI)
       
    43 apply (drule CollectD, (erule exE|erule conjE)+)
       
    44 apply (case_tac "obj = O_proc p")
       
    45 apply (simp add:co2sobj_execve split:if_splits)
       
    46 apply (simp add:co2sobj_execve, rule disjI2)
       
    47 apply (rule_tac x = obj in exI, case_tac obj, (simp add:alive_simps)+)[1]
       
    48 apply (simp, erule disjE)
       
    49 apply (rule_tac x = "O_proc p" in exI, simp)
       
    50 apply (erule exE| erule conjE)+
       
    51 apply (case_tac "x = S_proc sp (O_proc p \<in> tainted s)")
       
    52 apply (rule_tac x = "O_proc p'" in exI)
       
    53 apply (simp add:alive_execve co2sobj_execve cp2sproc_execve)
       
    54 apply (case_tac "obj = O_proc p", simp)
       
    55 apply (frule co2sobj_execve_alive, simp, simp)
       
    56 apply (frule_tac obj = obj in co2sobj_execve, simp)
       
    57 apply (rule_tac x = obj in exI, simp, simp)
       
    58 
       
    59 apply (erule conjE, frule current_proc_has_sp, simp, erule exE, rule impI, simp)
       
    60 apply (subgoal_tac "p \<in> current_procs (Execve p f fds # s)") 
       
    61 apply (drule_tac p = p and s = "Execve p f fds # s" in current_proc_has_sp, simp)
       
    62 apply (erule exE, erule conjE, simp)
       
    63 apply (simp add:s2ss_def, rule set_eqI, rule iffI)
       
    64 apply (drule CollectD, (erule exE|erule conjE)+)
       
    65 apply (case_tac "obj = O_proc p", simp)
       
    66 apply (rule disjI1, simp split:if_splits)
       
    67 apply (simp add:co2sobj_execve, rule disjI2)
       
    68 apply (rule conjI,rule_tac x = obj in exI, simp add:alive_simps split:t_object.splits)
       
    69 apply (rule notI, simp, case_tac obj)
       
    70 apply (erule_tac x = nat in allE, simp, (simp split:option.splits)+)
       
    71 apply (erule disjE, simp)
       
    72 apply (rule_tac x = "O_proc p" in exI, simp)
       
    73 apply (erule exE|erule conjE)+
       
    74 apply (rule_tac x = obj in exI)
       
    75 apply (drule_tac obj = obj in co2sobj_execve_alive, simp+)
       
    76 apply (frule_tac obj = obj in co2sobj_execve, simp, simp)
       
    77 apply (rule impI, simp, simp)
       
    78 done
       
    79 
       
    80 lemma s2ss_clone_alive:
       
    81   "\<lbrakk>co2sobj s obj = Some x; alive s obj; obj \<noteq> O_proc p'; valid (Clone p p' fds # s)\<rbrakk>
       
    82    \<Longrightarrow> alive (Clone p p' fds # s) obj"
       
    83 by (erule co2sobj_some_case, auto simp:alive_clone)
       
    84 
       
    85 lemma s2ss_clone:
       
    86   "valid (Clone p p' fds # s) \<Longrightarrow> s2ss (Clone p p' fds # s) = (
       
    87      case (cp2sproc (Clone p p' fds # s) p') of
       
    88        Some sp \<Rightarrow> s2ss s \<union> {S_proc sp (O_proc p \<in> tainted s)}
       
    89      | _       \<Rightarrow> {})"
       
    90 apply (frule vd_cons, frule vt_grant_os, split option.splits)
       
    91 apply (rule conjI, rule impI, drule current_proc_has_sp', simp, simp)
       
    92 apply (rule allI, rule impI, simp add:s2ss_def)
       
    93 apply (rule set_eqI, rule iffI, drule CollectD, (erule exE|erule conjE)+)
       
    94 apply (case_tac "obj = O_proc p'", simp)
       
    95 apply (case_tac "O_proc p' \<in> tainted s", drule tainted_in_current, simp+)
       
    96 apply (rule disjI1, simp split:if_splits)
       
    97 apply (simp, rule disjI2)
       
    98 apply (frule co2sobj_clone, simp)
       
    99 apply (rule_tac x = obj in exI, simp add:alive_simps split:t_object.splits)
       
   100 
       
   101 apply (simp, erule disjE, simp)
       
   102 apply (rule_tac x = "O_proc p'" in exI, simp)
       
   103 apply (rule impI, rule notI, drule tainted_in_current, simp+)
       
   104 apply (erule exE| erule conjE)+
       
   105 apply (case_tac "obj = O_proc p'", simp)
       
   106 apply (rule_tac x = obj in exI)
       
   107 apply (frule s2ss_clone_alive, simp+)
       
   108 apply (auto simp:co2sobj_clone alive_simps)
       
   109 done
       
   110 
       
   111 (*
       
   112 definition s2ss_shm_no_backup:: "t_state \<Rightarrow> t_process \<Rightarrow> t_static_state"
       
   113 where
       
   114   "s2ss_shm_no_backup s pfrom \<equiv> {S_proc sp False | sp p. info_flow_shm s pfrom p \<and> cp2sproc s p = Some sp \<and>
       
   115      (\<not> (\<exists> p'. \<not> info_flow_shm s pfrom p' \<and> p' \<in> current_procs s \<and> co2sobj s (O_proc p') = Some (S_proc sp False)))}"
       
   116 
       
   117 definition update_s2ss_shm:: "t_state \<Rightarrow> t_process \<Rightarrow> t_static_state" 
       
   118 where
       
   119   "update_s2ss_shm s pfrom \<equiv> s2ss s 
       
   120      \<union> {S_proc sp True| sp p. info_flow_shm s pfrom p \<and> cp2sproc s p = Some sp}
       
   121      - (s2ss_shm_no_backup s pfrom)"
       
   122 
       
   123 lemma s2ss_shm_no_bk_elim:
       
   124   "\<lbrakk>S_proc sp False \<notin> s2ss_shm_no_backup s pfrom; co2sobj s (O_proc p) = Some (S_proc sp False); 
       
   125     valid s; info_flow_shm s pfrom p\<rbrakk>
       
   126    \<Longrightarrow> \<exists> p'. \<not> info_flow_shm s pfrom p' \<and> p' \<in> current_procs s \<and> co2sobj s (O_proc p') = Some (S_proc sp False)"
       
   127 apply (auto simp:s2ss_shm_no_backup_def co2sobj.simps split:option.splits)
       
   128 apply (erule_tac x = p in allE, auto)
       
   129 apply (rule_tac x = p' in exI, auto)
       
   130 done
       
   131 
       
   132 lemma s2ss_shm_no_bk_intro1:
       
   133   "\<lbrakk>co2sobj s' obj = Some x; \<forall> p. obj \<noteq> O_proc p\<rbrakk> \<Longrightarrow> x \<notin> s2ss_shm_no_backup s pfrom"
       
   134 apply (case_tac obj)
       
   135 apply (auto simp:co2sobj.simps s2ss_shm_no_backup_def split:option.splits)
       
   136 done
       
   137 
       
   138 lemma s2ss_shm_no_bk_intro2:
       
   139   "\<lbrakk>co2sobj s' obj = Some x; obj \<in> tainted s'; valid s'\<rbrakk> \<Longrightarrow> x \<notin> s2ss_shm_no_backup s pfrom"
       
   140 apply (case_tac obj)
       
   141 
       
   142 apply (auto simp:co2sobj.simps s2ss_shm_no_backup_def split:option.splits)
       
   143 done
       
   144 
       
   145 lemma s2ss_shm_no_bk_intro3:
       
   146   "\<lbrakk>co2sobj s (O_proc p) = Some x; \<not> info_flow_shm s pfrom p; p \<in> current_procs s
       
   147    \<rbrakk> \<Longrightarrow> x \<notin> s2ss_shm_no_backup s pfrom"
       
   148 apply (auto simp add:s2ss_shm_no_backup_def split:option.splits)
       
   149 apply (rule_tac x = p in exI, simp)
       
   150 done
       
   151 
       
   152 lemma s2ss_shm_no_bk_intro4:
       
   153   "\<lbrakk>co2sobj s (O_proc p) = Some x; info_flow_shm s pfrom p; 
       
   154     \<not> info_flow_shm s pfrom p'; p' \<in> current_procs s; co2sobj s (O_proc p') = Some x\<rbrakk>
       
   155    \<Longrightarrow> x \<notin> s2ss_shm_no_backup s pfrom"
       
   156 apply (rule notI)
       
   157 apply (auto simp add:s2ss_shm_no_backup_def co2sobj.simps split:option.splits)
       
   158 done  
       
   159 *)
       
   160 
       
   161 lemma tainted_ptrace':
       
   162   "tainted (Ptrace p p' # s) = 
       
   163      (if (O_proc p \<in> tainted s \<and> O_proc p' \<notin> tainted s)
       
   164       then tainted s \<union> {O_proc p'}
       
   165       else if (O_proc p' \<in> tainted s \<and> O_proc p \<notin> tainted s)
       
   166            then tainted s \<union> {O_proc p}
       
   167                 else tainted s)"
       
   168 by auto
       
   169 
       
   170 lemma co2sobj_some_caseD:
       
   171   "\<lbrakk>co2sobj s obj = Some sobj; \<And> p. \<lbrakk>co2sobj s obj = Some sobj; obj = O_proc p\<rbrakk> \<Longrightarrow> P (O_proc p);
       
   172     \<And> f. \<lbrakk>co2sobj s obj = Some sobj; obj = O_file f\<rbrakk> \<Longrightarrow> P (O_file f); 
       
   173     \<And> f. \<lbrakk>co2sobj s obj = Some sobj; obj = O_dir f\<rbrakk> \<Longrightarrow> P (O_dir f); 
       
   174     \<And> q. \<lbrakk>co2sobj s obj = Some sobj; obj = O_msgq q\<rbrakk> \<Longrightarrow> P (O_msgq q)\<rbrakk>
       
   175    \<Longrightarrow> P obj"
       
   176 by (case_tac obj, auto)
       
   177 
       
   178 definition update_s2ss_obj :: "t_state \<Rightarrow> t_static_state \<Rightarrow> t_object \<Rightarrow> t_sobject \<Rightarrow> t_sobject \<Rightarrow> t_static_state"
       
   179 where
       
   180   "update_s2ss_obj s ss obj sobj sobj' = 
       
   181      (if (\<exists> obj'. alive s obj' \<and> obj' \<noteq> obj \<and> co2sobj s obj' = Some sobj)
       
   182       then ss \<union> {sobj'}
       
   183       else ss - {sobj} \<union> {sobj'})"
       
   184 
       
   185 ML {*
       
   186 fun my_setiff_tac i = 
       
   187      (etac @{thm CollectE} i 
       
   188       ORELSE (     asm_full_simp_tac (HOL_ss addsimps @{thms Set.insert_iff}) i
       
   189               THEN etac @{thm disjE} i)
       
   190       ORELSE (     asm_full_simp_tac (HOL_ss addsimps @{thms Set.Diff_iff}) i
       
   191               THEN etac @{thm conjE} i 
       
   192               THEN (REPEAT (etac @{thm CollectE} i))))
       
   193 THEN (REPEAT ((        etac @{thm exE} 
       
   194                ORELSE' etac @{thm conjE}
       
   195                ORELSE' etac @{thm bexE}) i))
       
   196 THEN (rtac @{thm CollectI} i
       
   197       ORELSE (     asm_full_simp_tac (HOL_ss addsimps @{thms Set.insert_iff}) i))
       
   198 
       
   199 *}
       
   200 
       
   201 ML {*
       
   202 fun my_seteq_tac i = 
       
   203      (simp_tac (HOL_ss addsimps @{thms s2ss_def}) 1)
       
   204 THEN (rtac @{thm set_eqI} i)
       
   205 THEN (rtac @{thm iffI} i)
       
   206 THEN my_setiff_tac i
       
   207 *}
       
   208 
       
   209 ML {*fun my_clarify_tac i = 
       
   210 REPEAT ((  rtac @{thm impI}
       
   211    ORELSE' rtac @{thm allI}
       
   212    ORELSE' rtac @{thm ballI}
       
   213    ORELSE' rtac @{thm conjI}
       
   214    ORELSE' etac @{thm conjE}
       
   215    ORELSE' etac @{thm exE}
       
   216    ORELSE' etac @{thm bexE}
       
   217    ORELSE' etac @{thm disjE}) i)
       
   218 *}
       
   219 
       
   220 lemma co2sobj_sproc_imp:
       
   221   "co2sobj s obj = Some (S_proc sp tag) \<Longrightarrow> \<exists> p. obj = O_proc p"
       
   222 by (case_tac obj, auto simp:co2sobj.simps split:option.splits)
       
   223 
       
   224 lemma co2sobj_sfile_imp:
       
   225   "co2sobj s obj = Some (S_file sfs tag) \<Longrightarrow> \<exists> f. obj = O_file f"
       
   226 by (case_tac obj, auto simp:co2sobj.simps split:option.splits)
       
   227 
       
   228 lemma co2sobj_sdir_imp:
       
   229   "co2sobj s obj = Some (S_dir sf) \<Longrightarrow> \<exists> f. obj = O_dir f"
       
   230 by (case_tac obj, auto simp:co2sobj.simps split:option.splits)
       
   231 
       
   232 lemma co2sobj_smsgq_imp:
       
   233   "co2sobj s obj = Some (S_msgq sq) \<Longrightarrow> \<exists> q. obj = O_msgq q"
       
   234 by (case_tac obj, auto simp:co2sobj.simps split:option.splits)
       
   235 
       
   236 lemma s2ss_execve:
       
   237   "valid (Execve p f fds # s) \<Longrightarrow> 
       
   238      (case (cp2sproc s p, cp2sproc (Execve p f fds # s) p) of
       
   239         (Some sp, Some sp') \<Rightarrow> s2ss (Execve p f fds # s) = 
       
   240             update_s2ss_obj s (s2ss s) (O_proc p) (S_proc sp (O_proc p \<in> tainted s))
       
   241                           (S_proc sp' (O_proc p \<in> tainted s \<or> O_file f \<in> tainted s))
       
   242       | _ \<Rightarrow> s2ss (Execve p f fds # s) = {})"
       
   243 apply (frule vd_cons, frule vt_grant_os)
       
   244 apply (clarsimp simp only:os_grant.simps)
       
   245 apply (case_tac "cp2sproc s p")
       
   246 apply (drule current_proc_has_sp', simp, simp)
       
   247 apply (case_tac "cp2sproc (Execve p f fds # s) p")
       
   248 apply (drule current_proc_has_sp', simp, simp, simp)
       
   249 apply (simp add:update_s2ss_obj_def)
       
   250 apply (tactic {*my_clarify_tac 1*})
       
   251 apply (frule co2sobj_sproc_imp, erule exE, simp split:option.splits)
       
   252 apply (simp add:s2ss_execve')
       
   253 apply (rule impI)
       
   254 apply (erule_tac x = pa in allE, simp)
       
   255 apply (rule impI)
       
   256 apply (simp add:s2ss_execve')
       
   257 apply (rule impI)
       
   258 apply (tactic {*my_clarify_tac 1*})
       
   259 apply (simp split:option.splits)
       
   260 apply (erule_tac x = "O_proc p'" in allE, simp)
       
   261 done
       
   262 
       
   263 lemma s2ss_ptrace1_aux: "x \<notin> {x. P x} \<Longrightarrow> \<not> P x" by simp
       
   264 
       
   265 lemma s2ss_ptrace1:
       
   266   "\<lbrakk>valid (Ptrace p p' # s); O_proc p \<in> tainted s; O_proc p' \<notin> tainted s\<rbrakk>
       
   267    \<Longrightarrow> (case (cp2sproc s p') of 
       
   268           Some sp' \<Rightarrow> s2ss (Ptrace p p' # s) = 
       
   269                      update_s2ss_obj s (s2ss s) (O_proc p') (S_proc sp' False) (S_proc sp' True)
       
   270         | _        \<Rightarrow> s2ss (Ptrace p p' # s) = {})"
       
   271 apply (frule vd_cons, frule vt_grant_os)
       
   272 apply (clarsimp simp only:os_grant.simps)
       
   273 apply (case_tac "cp2sproc s p'")
       
   274 apply (drule current_proc_has_sp', simp+)
       
   275 apply (case_tac "cp2sproc s p")
       
   276 apply (drule current_proc_has_sp', simp+)
       
   277 
       
   278 apply (simp add:update_s2ss_obj_def)
       
   279 apply (tactic {*my_clarify_tac 1*})
       
   280 apply (simp add:s2ss_def)
       
   281 apply (tactic {*my_seteq_tac 1*})
       
   282 apply (case_tac "obj = O_proc p'")
       
   283 apply (rule disjI1, simp add:co2sobj.simps cp2sproc_other)
       
   284 apply (rule disjI2, simp, rule_tac x = obj in exI)
       
   285 apply (simp add:co2sobj_ptrace is_file_simps is_dir_simps alive_other split:t_object.splits if_splits)
       
   286 apply (tactic {*my_setiff_tac 1*})
       
   287 apply (rule_tac x = "O_proc p'" in exI, simp add:co2sobj.simps cp2sproc_other)
       
   288 apply (tactic {*my_setiff_tac 1*})
       
   289 apply (case_tac "obj = O_proc p'")
       
   290 apply (rule_tac x = obj' in exI)
       
   291 apply (simp add:co2sobj_ptrace alive_other split:t_object.splits if_splits)
       
   292 apply (auto simp:co2sobj.simps)[1]
       
   293 apply (rule_tac x = obj in exI, simp add:co2sobj_ptrace alive_other split:t_object.splits)
       
   294 apply (auto simp:co2sobj.simps)[1]
       
   295 
       
   296 apply (rule impI)
       
   297 apply (simp add:s2ss_def)
       
   298 apply (tactic {*my_seteq_tac 1*})
       
   299 apply (case_tac "obj = O_proc p'")
       
   300 apply (rule disjI1, simp add:co2sobj.simps cp2sproc_other)
       
   301 apply (rule disjI2, simp, rule conjI, rule_tac x = obj in exI)
       
   302 apply (simp add:co2sobj_ptrace is_file_simps is_dir_simps alive_other split:t_object.splits if_splits)
       
   303 apply (rule notI, simp)
       
   304 apply (frule_tac obj = obj in co2sobj_sproc_imp, erule exE, simp)
       
   305 apply (erule_tac x = obj in allE, simp add:co2sobj_ptrace cp2sproc_other split:option.splits)
       
   306 apply (tactic {*my_setiff_tac 1*})
       
   307 apply (rule_tac x = "O_proc p'" in exI, simp add:co2sobj.simps cp2sproc_other)
       
   308 apply (tactic {*my_setiff_tac 1*})
       
   309 apply (case_tac "obj = O_proc p'")
       
   310 apply (simp add:co2sobj.simps cp2sproc_other)
       
   311 apply (rule_tac x = obj in exI, simp add:co2sobj_ptrace alive_other split:t_object.splits)
       
   312 apply (auto simp:co2sobj.simps)[1]
       
   313 done
       
   314 
       
   315 lemma s2ss_ptrace2:
       
   316   "\<lbrakk>valid (Ptrace p p' # s); O_proc p' \<in> tainted s; O_proc p \<notin> tainted s\<rbrakk>
       
   317    \<Longrightarrow> (case (cp2sproc s p) of 
       
   318           Some sp \<Rightarrow> s2ss (Ptrace p p' # s) = 
       
   319                     update_s2ss_obj s (s2ss s) (O_proc p) (S_proc sp False) (S_proc sp True)
       
   320         | _       \<Rightarrow> s2ss (Ptrace p p' # s) = {})"
       
   321 apply (frule vd_cons, frule vt_grant_os)
       
   322 apply (clarsimp simp only:os_grant.simps)
       
   323 apply (case_tac "cp2sproc s p'")
       
   324 apply (drule current_proc_has_sp', simp+)
       
   325 apply (case_tac "cp2sproc s p")
       
   326 apply (drule current_proc_has_sp', simp+)
       
   327 
       
   328 apply (simp add:update_s2ss_obj_def)
       
   329 apply (tactic {*my_clarify_tac 1*})
       
   330 apply (simp add:s2ss_def)
       
   331 apply (tactic {*my_seteq_tac 1*})
       
   332 apply (case_tac "obj = O_proc p")
       
   333 apply (rule disjI1, simp add:co2sobj.simps cp2sproc_other)
       
   334 apply (rule disjI2, simp, rule_tac x = obj in exI)
       
   335 apply (simp add:co2sobj_ptrace is_file_simps is_dir_simps alive_other split:t_object.splits if_splits)
       
   336 apply (tactic {*my_setiff_tac 1*})
       
   337 apply (rule_tac x = "O_proc p" in exI, simp add:co2sobj.simps cp2sproc_other)
       
   338 apply (tactic {*my_setiff_tac 1*})
       
   339 apply (case_tac "obj = O_proc p")
       
   340 apply (rule_tac x = obj' in exI)
       
   341 apply (simp add:co2sobj_ptrace alive_other split:t_object.splits if_splits)
       
   342 apply (auto simp:co2sobj.simps)[1]
       
   343 apply (rule_tac x = obj in exI, simp add:co2sobj_ptrace alive_other split:t_object.splits)
       
   344 apply (auto simp:co2sobj.simps)[1]
       
   345 
       
   346 apply (rule impI)
       
   347 apply (simp add:s2ss_def)
       
   348 apply (tactic {*my_seteq_tac 1*})
       
   349 apply (case_tac "obj = O_proc p")
       
   350 apply (rule disjI1, simp add:co2sobj.simps cp2sproc_other)
       
   351 apply (rule disjI2, simp, rule conjI, rule_tac x = obj in exI)
       
   352 apply (simp add:co2sobj_ptrace is_file_simps is_dir_simps alive_other split:t_object.splits if_splits)
       
   353 apply (rule notI, simp)
       
   354 apply (frule_tac obj = obj in co2sobj_sproc_imp, erule exE, simp)
       
   355 apply (erule_tac x = obj in allE, simp add:co2sobj_ptrace cp2sproc_other split:option.splits)
       
   356 apply (tactic {*my_setiff_tac 1*})
       
   357 apply (rule_tac x = "O_proc p" in exI, simp add:co2sobj.simps cp2sproc_other)
       
   358 apply (tactic {*my_setiff_tac 1*})
       
   359 apply (case_tac "obj = O_proc p")
       
   360 apply (simp add:co2sobj.simps cp2sproc_other)
       
   361 apply (rule_tac x = obj in exI, simp add:co2sobj_ptrace alive_other split:t_object.splits)
       
   362 apply (auto simp:co2sobj.simps)[1]
       
   363 done
       
   364 
       
   365 lemma s2ss_ptrace3:
       
   366   "\<lbrakk>valid (Ptrace p p' # s); (O_proc p' \<in> tainted s) = (O_proc p \<in> tainted s)\<rbrakk>
       
   367    \<Longrightarrow> s2ss (Ptrace p p' # s) = s2ss s"
       
   368 unfolding s2ss_def
       
   369 apply (frule vd_cons, frule vt_grant_os, rule set_eqI, rule iffI)
       
   370 apply (erule CollectE, (erule exE|erule conjE)+, rule CollectI)
       
   371 apply (rule_tac x = obj in exI)
       
   372 apply (frule alive_other, simp+)
       
   373 apply (frule_tac obj = obj in co2sobj_ptrace, simp)
       
   374 apply (auto split:t_object.splits option.splits if_splits)[1]
       
   375 
       
   376 apply (tactic {*my_setiff_tac 1*})
       
   377 apply (rule_tac x = obj in exI)
       
   378 apply (frule alive_other, simp+)
       
   379 apply (frule_tac obj = obj in co2sobj_ptrace, simp)
       
   380 apply (case_tac "cp2sproc s p'")
       
   381 apply (drule current_proc_has_sp', simp, simp)
       
   382 apply (case_tac "cp2sproc s p")
       
   383 apply (drule current_proc_has_sp', simp, simp)
       
   384 apply (case_tac "O_proc p' \<in> tainted s")
       
   385 apply (auto split:t_object.splits option.splits if_splits simp:co2sobj.simps)
       
   386 done
       
   387 
       
   388 lemma s2ss_ptrace:
       
   389   "valid (Ptrace p p' # s) \<Longrightarrow> s2ss (Ptrace p p' # s) = (
       
   390      if (O_proc p \<in> tainted s \<and> O_proc p' \<notin> tainted s) 
       
   391      then (case (cp2sproc s p') of 
       
   392              Some sp \<Rightarrow> update_s2ss_obj s (s2ss s) (O_proc p') (S_proc sp False) (S_proc sp True)
       
   393            | _       \<Rightarrow> {})
       
   394      else if (O_proc p' \<in> tainted s \<and> O_proc p \<notin> tainted s)
       
   395           then (case (cp2sproc s p) of 
       
   396                   Some sp \<Rightarrow> update_s2ss_obj s (s2ss s) (O_proc p) (S_proc sp False) (S_proc sp True)
       
   397                 | _       \<Rightarrow> {})
       
   398           else s2ss s                                   )"
       
   399 apply (case_tac "O_proc p \<in> tainted s \<and> O_proc p' \<notin> tainted s")
       
   400 apply (drule s2ss_ptrace1, simp, simp, simp split:option.splits)
       
   401 apply (case_tac "O_proc p' \<in> tainted s \<and> O_proc p \<notin> tainted s")
       
   402 apply (drule s2ss_ptrace2, simp, simp, simp split:option.splits)
       
   403 apply (drule s2ss_ptrace3, auto)
       
   404 done
       
   405 
       
   406 lemma s2ss_kill':
       
   407   "valid (Kill p p' # s) \<Longrightarrow> s2ss (Kill p p' # s) = (
       
   408      if (\<exists> p''. p'' \<in> current_procs s \<and> p'' \<noteq> p' \<and> co2sobj s (O_proc p'') = co2sobj s (O_proc p'))
       
   409      then s2ss s 
       
   410      else (case (co2sobj s (O_proc p')) of
       
   411              Some sp \<Rightarrow> s2ss s - {sp}
       
   412            | _       \<Rightarrow> {}))"
       
   413 apply (frule vt_grant_os, frule vd_cons)
       
   414 unfolding s2ss_def
       
   415 apply (simp split:if_splits, rule conjI)
       
   416 apply (rule impI, (erule exE|erule conjE)+)
       
   417 apply (split option.splits)
       
   418 apply (drule current_proc_has_sp', simp, simp)
       
   419 apply (simp split: option.splits, (erule conjE)+)
       
   420 apply (rule set_eqI, rule iffI, erule CollectE, (erule exE|erule conjE)+, rule CollectI)
       
   421 apply (rule_tac x = obj in exI)
       
   422 apply (simp add:co2sobj_kill alive_kill split:t_object.splits if_splits)
       
   423 apply (erule CollectE, erule exE, erule conjE, rule CollectI)
       
   424 apply (erule co2sobj_some_caseD)
       
   425 apply (case_tac "pa = p'")
       
   426 apply (rule_tac x = "O_proc p''" in exI)
       
   427 apply (simp add:cp2sproc_kill alive_kill
       
   428   split:t_object.splits if_splits option.splits)
       
   429 apply (rule_tac x = "O_proc pa" in exI)
       
   430 apply (clarsimp simp add:cp2sproc_kill alive_kill
       
   431   split:t_object.splits if_splits option.splits)
       
   432 apply (rule_tac x = obj in exI, frule alive_kill, simp add:co2sobj_kill del:co2sobj.simps)+
       
   433 
       
   434 apply (rule impI, erule conjE, frule current_proc_has_sp, simp, erule exE, simp)
       
   435 apply (rule set_eqI, rule iffI)
       
   436 apply (erule CollectE, erule exE, erule conjE, rule DiffI)
       
   437 apply (rule CollectI, rule_tac x = obj in exI)
       
   438 apply (simp add:co2sobj_kill alive_kill split:t_object.splits if_splits)
       
   439 apply (rule notI, simp, case_tac obj)
       
   440 apply (erule_tac x = nat in allE)
       
   441 apply (simp add:co2sobj_kill cp2sproc_kill split:option.splits)
       
   442 apply (simp split:option.splits)+
       
   443 apply (erule co2sobj_some_caseD)
       
   444 apply (case_tac "pa = p'")
       
   445 apply (rule_tac x = "O_proc p''" in exI)
       
   446 apply (simp add:cp2sproc_kill alive_kill
       
   447   split:t_object.splits if_splits option.splits)
       
   448 apply (rule_tac x = "O_proc pa" in exI)
       
   449 apply (clarsimp simp add:cp2sproc_kill alive_kill
       
   450   split:t_object.splits if_splits option.splits)
       
   451 apply (rule_tac x = obj in exI, frule alive_kill, simp add:co2sobj_kill del:co2sobj.simps)+
       
   452 done
       
   453 
       
   454 definition del_s2ss_obj :: "t_state \<Rightarrow> t_static_state \<Rightarrow> t_object \<Rightarrow> t_sobject \<Rightarrow> t_static_state"
       
   455 where
       
   456   "del_s2ss_obj s ss obj sobj \<equiv> 
       
   457      if (\<exists> obj'. alive s obj' \<and> obj' \<noteq> obj \<and> co2sobj s obj' = Some sobj)
       
   458      then ss
       
   459      else ss - {sobj}"
       
   460 
       
   461 lemma del_update_s2ss_obj:
       
   462   "update_s2ss_obj s ss obj sobj sobj' = del_s2ss_obj s ss obj sobj \<union> {sobj'}"
       
   463 by (auto simp:update_s2ss_obj_def del_s2ss_obj_def split:if_splits)
       
   464 
       
   465 lemma s2ss_kill:
       
   466   "valid (Kill p p' # s) \<Longrightarrow> (
       
   467       case (cp2sproc s p') of 
       
   468         Some sp \<Rightarrow> s2ss (Kill p p' # s) = del_s2ss_obj s (s2ss s) (O_proc p') (S_proc sp (O_proc p' \<in> tainted s))
       
   469       | _       \<Rightarrow> s2ss (Kill p p' # s) = {})"
       
   470 apply (frule vd_cons, frule vt_grant_os)
       
   471 apply (clarsimp simp only:os_grant.simps)
       
   472 apply (split option.splits, rule conjI, rule impI)
       
   473 apply (drule current_proc_has_sp', simp, simp)
       
   474 apply (rule allI, rule impI)
       
   475 apply (simp add:del_s2ss_obj_def split:option.splits)
       
   476 apply (tactic {*my_clarify_tac 1*})
       
   477 apply (frule co2sobj_sproc_imp, erule exE)
       
   478 apply (simp add:s2ss_kill')
       
   479 apply (rule impI)
       
   480 apply (erule_tac x = pa in allE, simp)
       
   481 apply (rule impI)
       
   482 apply (simp add:s2ss_kill')
       
   483 apply (rule impI)
       
   484 apply (tactic {*my_clarify_tac 1*})
       
   485 apply (simp split:option.splits)
       
   486 apply (erule_tac x = "O_proc p''" in allE, simp)
       
   487 done
       
   488 
       
   489 lemma s2ss_exit':
       
   490   "valid (Exit p # s) \<Longrightarrow> s2ss (Exit p # s) = (
       
   491      if (\<exists> p'. p' \<in> current_procs s \<and> p' \<noteq> p \<and> co2sobj s (O_proc p') = co2sobj s (O_proc p))
       
   492      then s2ss s 
       
   493      else (case (co2sobj s (O_proc p)) of
       
   494              Some sp \<Rightarrow> s2ss s - {sp}
       
   495            | _       \<Rightarrow> {}))"
       
   496 apply (frule vt_grant_os, frule vd_cons)
       
   497 unfolding s2ss_def
       
   498 apply (simp split:if_splits, rule conjI)
       
   499 apply (rule impI, (erule exE|erule conjE)+)
       
   500 apply (split option.splits)
       
   501 apply (drule current_proc_has_sp', simp, simp)
       
   502 apply (simp split: option.splits, (erule conjE)+)
       
   503 apply (rule set_eqI, rule iffI, erule CollectE, (erule exE|erule conjE)+, rule CollectI)
       
   504 apply (rule_tac x = obj in exI)
       
   505 apply (simp add:co2sobj_exit alive_exit split:t_object.splits if_splits)
       
   506 apply (erule CollectE, erule exE, erule conjE, rule CollectI)
       
   507 apply (erule co2sobj_some_caseD)
       
   508 apply (case_tac "pa = p")
       
   509 apply (rule_tac x = "O_proc p'" in exI)
       
   510 apply (simp add:cp2sproc_exit alive_exit
       
   511   split:t_object.splits if_splits option.splits)
       
   512 apply (rule_tac x = "O_proc pa" in exI)
       
   513 apply (clarsimp simp add:cp2sproc_exit alive_exit
       
   514   split:t_object.splits if_splits option.splits)
       
   515 apply (rule_tac x = obj in exI, frule alive_exit, simp add:co2sobj_exit del:co2sobj.simps)+
       
   516 
       
   517 apply (rule impI, frule current_proc_has_sp, simp, erule exE, simp)
       
   518 apply (rule set_eqI, rule iffI)
       
   519 apply (erule CollectE, erule exE, erule conjE, rule DiffI)
       
   520 apply (rule CollectI, rule_tac x = obj in exI)
       
   521 apply (simp add:co2sobj_exit alive_exit split:t_object.splits if_splits)
       
   522 apply (rule notI, simp, case_tac obj)
       
   523 apply (erule_tac x = nat in allE)
       
   524 apply (simp add:co2sobj_exit cp2sproc_exit split:option.splits)
       
   525 apply (simp split:option.splits)+
       
   526 apply (erule co2sobj_some_caseD)
       
   527 apply (case_tac "pa = p")
       
   528 apply (rule_tac x = "O_proc p'" in exI)
       
   529 apply (simp add:cp2sproc_exit alive_exit
       
   530   split:t_object.splits if_splits option.splits)
       
   531 apply (rule_tac x = "O_proc pa" in exI)
       
   532 apply (clarsimp simp add:cp2sproc_exit alive_exit
       
   533   split:t_object.splits if_splits option.splits)
       
   534 apply (rule_tac x = obj in exI, frule alive_exit, simp add:co2sobj_exit del:co2sobj.simps)+
       
   535 done
       
   536 
       
   537 lemma s2ss_exit:
       
   538   "valid (Exit p # s) \<Longrightarrow> (
       
   539       case (cp2sproc s p) of 
       
   540         Some sp \<Rightarrow> s2ss (Exit p # s) = del_s2ss_obj s (s2ss s) (O_proc p) (S_proc sp (O_proc p \<in> tainted s))
       
   541       | _       \<Rightarrow> s2ss (Exit p # s) = {})"
       
   542 apply (frule vd_cons, frule vt_grant_os)
       
   543 apply (clarsimp simp only:os_grant.simps)
       
   544 apply (split option.splits, rule conjI, rule impI)
       
   545 apply (drule current_proc_has_sp', simp, simp)
       
   546 apply (rule allI, rule impI)
       
   547 apply (simp add:del_s2ss_obj_def split:option.splits)
       
   548 apply (tactic {*my_clarify_tac 1*})
       
   549 apply (frule co2sobj_sproc_imp, erule exE)
       
   550 apply (simp add:s2ss_exit')
       
   551 apply (rule impI)
       
   552 apply (erule_tac x = pa in allE, simp)
       
   553 apply (rule impI)
       
   554 apply (simp add:s2ss_exit')
       
   555 apply (rule impI)
       
   556 apply (tactic {*my_clarify_tac 1*})
       
   557 apply (simp split:option.splits)
       
   558 apply (erule_tac x = "O_proc p'" in allE, simp)
       
   559 done
       
   560 
       
   561 lemma alive_has_sobj':
       
   562   "\<lbrakk>co2sobj s obj = None; valid s\<rbrakk> \<Longrightarrow> \<not> alive s obj"
       
   563 apply (case_tac obj)
       
   564 apply (auto split:option.splits)
       
   565 oops
       
   566 
       
   567 declare co2sobj.simps [simp del]
       
   568 
       
   569 lemma co2sobj_open_none:
       
   570   "\<lbrakk>valid (Open p f flag fd None # s); alive s obj\<rbrakk> \<Longrightarrow> co2sobj (Open p f flag fd None # s) obj = (
       
   571       if (obj = O_proc p) 
       
   572       then (case (cp2sproc (Open p f flag fd None # s) p) of
       
   573               Some sp \<Rightarrow> Some (S_proc sp (O_proc p \<in> tainted s))
       
   574            | _       \<Rightarrow> None)
       
   575       else co2sobj s obj)"
       
   576 apply (frule vt_grant_os, frule vd_cons)
       
   577 apply (frule_tac obj = obj in co2sobj_open, simp add:alive_open)
       
   578 apply (auto split:t_object.splits option.splits dest!:current_proc_has_sp')
       
   579 done
       
   580 
       
   581 lemma co2sobj_open_some:
       
   582   "\<lbrakk>valid (Open p f flag fd (Some i) # s); alive s obj\<rbrakk> \<Longrightarrow> co2sobj (Open p f flag fd (Some i) # s) obj = (
       
   583       if (obj = O_proc p) 
       
   584       then (case (cp2sproc (Open p f flag fd (Some i) # s) p) of
       
   585               Some sp \<Rightarrow> Some (S_proc sp (O_proc p \<in> tainted s))
       
   586            | _       \<Rightarrow> None)
       
   587       else if (obj = O_file f) 
       
   588            then (case (cf2sfile (Open p f flag fd (Some i) # s) f) of
       
   589                    Some sf \<Rightarrow> Some (S_file {sf} (O_proc p \<in> tainted s))
       
   590                  | _       \<Rightarrow> None)
       
   591            else co2sobj s obj)"
       
   592 apply (frule vt_grant_os, frule vd_cons)
       
   593 apply (frule_tac obj = obj in co2sobj_open, simp add:alive_open)
       
   594 apply (auto split:t_object.splits option.splits dest!:current_proc_has_sp')
       
   595 done
       
   596 
       
   597 lemma alive_co2sobj_some_open_none:
       
   598   "\<lbrakk>co2sobj s obj = Some sobj; alive s obj; valid (Open p f flag fd None # s)\<rbrakk>
       
   599    \<Longrightarrow> alive (Open p f flag fd None # s) obj"
       
   600 by (erule co2sobj_some_caseD, auto simp:alive_simps is_file_simps is_dir_simps)
       
   601 
       
   602 lemma alive_co2sobj_some_open_none':
       
   603   "\<lbrakk>co2sobj (Open p f flag fd None # s) obj = Some sobj; alive (Open p f flag fd None # s) obj; 
       
   604     valid (Open p f flag fd None # s)\<rbrakk> \<Longrightarrow> alive s obj"
       
   605 by (erule co2sobj_some_caseD, auto simp:alive_simps is_file_simps is_dir_simps)
       
   606 
       
   607 lemma co2sobj_proc_obj:
       
   608   "\<lbrakk>co2sobj s obj = Some x; co2sobj s (O_proc p) = Some x\<rbrakk>
       
   609    \<Longrightarrow> \<exists> p'. obj = O_proc p'"
       
   610 by (case_tac obj, auto simp:co2sobj.simps split:option.splits)
       
   611 
       
   612 lemma s2ss_open_none:
       
   613   "valid (Open p f flag fd None # s) \<Longrightarrow> s2ss (Open p f flag fd None # s) = (
       
   614       case (co2sobj s (O_proc p), co2sobj (Open p f flag fd None # s) (O_proc p)) of
       
   615         (Some sp, Some sp') \<Rightarrow> 
       
   616            if (\<exists> p'. p' \<in> current_procs s \<and> p' \<noteq> p \<and> co2sobj s (O_proc p') = Some sp)
       
   617            then s2ss s \<union> {sp'}
       
   618            else s2ss s - {sp} \<union> {sp'} 
       
   619       | _                   \<Rightarrow> {} )"
       
   620 unfolding s2ss_def
       
   621 apply (frule vt_grant_os, frule vd_cons)
       
   622 apply (case_tac "co2sobj s (O_proc p)", simp add:co2sobj.simps split:option.splits)
       
   623 apply (drule current_proc_has_sp', simp, simp)
       
   624 apply (case_tac "co2sobj (Open p f flag fd None # s) (O_proc p)")
       
   625 apply (simp add:co2sobj.simps split:option.splits)
       
   626 apply (drule current_proc_has_sp', simp, simp)
       
   627 apply (rule set_eqI, rule iffI, erule CollectE, erule exE, erule conjE, simp)
       
   628 apply (frule_tac obj = obj in alive_co2sobj_some_open_none', simp, simp)
       
   629 apply (rule conjI, rule impI, erule exE, (erule conjE)+)
       
   630 apply (rule Meson.disj_comm, rule disjCI, case_tac "obj = O_proc p", simp)
       
   631 apply (rule_tac x = obj in exI, simp add:co2sobj_open_none)
       
   632 apply (rule impI)
       
   633 apply (case_tac "obj = O_proc p", simp)
       
   634 apply (rule Meson.disj_comm, rule disjCI, rule conjI)
       
   635 apply (rule_tac x = obj in exI, simp add:co2sobj_open_none)
       
   636 apply (simp add:co2sobj_open_none split:option.splits)
       
   637 apply (rule notI)
       
   638 apply (frule co2sobj_proc_obj, simp, erule exE)
       
   639 apply (erule_tac x = p' in allE, simp)
       
   640 
       
   641 apply (simp split:if_splits)
       
   642 apply (erule disjE, rule_tac x = "O_proc p" in exI, simp)
       
   643 apply (erule exE, erule conjE, case_tac "obj = O_proc p")
       
   644 apply (rule_tac x = "O_proc p'" in exI, simp add:co2sobj_open_none)
       
   645 apply (rule_tac x = obj in exI, simp add:co2sobj_open_none alive_co2sobj_some_open_none)
       
   646 apply (erule disjE, rule_tac x = "O_proc p" in exI, simp)
       
   647 apply (erule conjE, erule exE, erule conjE, case_tac "obj = O_proc p")
       
   648 apply (rule_tac x = "O_proc p'" in exI, simp add:co2sobj_open_none)
       
   649 apply (rule_tac x = obj in exI, simp add:co2sobj_open_none alive_co2sobj_some_open_none)
       
   650 done
       
   651 
       
   652 lemma alive_co2sobj_some_open_some:
       
   653   "\<lbrakk>alive s obj; valid (Open p f flag fd (Some i) # s)\<rbrakk>
       
   654    \<Longrightarrow> alive (Open p f flag fd (Some i) # s) obj"
       
   655 by (case_tac obj, auto simp:alive_simps is_file_simps is_dir_simps)
       
   656 
       
   657 lemma alive_co2sobj_some_open_some':
       
   658   "\<lbrakk>co2sobj (Open p f flag fd (Some i) # s) obj = Some sobj; alive (Open p f flag fd (Some i) # s) obj; 
       
   659     valid (Open p f flag fd (Some i) # s); obj \<noteq> O_file f\<rbrakk> \<Longrightarrow> alive s obj"
       
   660 by (erule co2sobj_some_caseD, auto simp:alive_simps is_file_simps is_dir_simps)
       
   661 
       
   662 lemma s2ss_open_some:
       
   663   "valid (Open p f flag fd (Some i) # s) \<Longrightarrow> s2ss (Open p f flag fd (Some i) # s) = (
       
   664       case (co2sobj s (O_proc p), co2sobj (Open p f flag fd (Some i) # s) (O_proc p),
       
   665             co2sobj (Open p f flag fd (Some i) # s) (O_file f)) of
       
   666         (Some sp, Some sp', Some sf) \<Rightarrow> 
       
   667            if (\<exists> p'. p' \<in> current_procs s \<and> p' \<noteq> p \<and> co2sobj s (O_proc p') = Some sp)
       
   668            then s2ss s \<union> {sp', sf} 
       
   669            else s2ss s - {sp} \<union> {sp', sf} 
       
   670       | _                   \<Rightarrow> {} )"
       
   671 unfolding s2ss_def
       
   672 apply (frule vt_grant_os, frule vd_cons)
       
   673 apply (case_tac "co2sobj s (O_proc p)", simp add:co2sobj.simps split:option.splits)
       
   674 apply (drule current_proc_has_sp', simp, simp)
       
   675 apply (case_tac "co2sobj (Open p f flag fd (Some i) # s) (O_proc p)")
       
   676 apply (simp add:co2sobj.simps split:option.splits)
       
   677 apply (drule current_proc_has_sp', simp, simp)
       
   678 apply (case_tac "co2sobj (Open p f flag fd (Some i) # s) (O_file f)")
       
   679 apply (simp add:co2sobj.simps split:option.splits)
       
   680 apply (clarsimp split del:if_splits)
       
   681 
       
   682 apply (rule set_eqI, rule iffI, erule CollectE, erule exE, erule conjE)
       
   683 apply (split if_splits, rule conjI, rule impI, erule exE, erule conjE, erule conjE)
       
   684 apply (case_tac "obj = O_proc p", simp, case_tac "obj = O_file f", simp)
       
   685 apply (rule UnI1, rule CollectI, rule_tac x = obj in exI)
       
   686 apply (frule_tac obj = obj in alive_co2sobj_some_open_some', simp+)
       
   687 apply (simp add:co2sobj_open split:t_object.splits)
       
   688 apply (rule impI, case_tac "obj = O_proc p", simp, case_tac "obj = O_file f", simp)
       
   689 apply (rule UnI1, rule DiffI, rule CollectI, rule_tac x = obj in exI)
       
   690 apply (frule_tac obj = obj in alive_co2sobj_some_open_some', simp+)
       
   691 apply (simp add:co2sobj_open split:t_object.splits)
       
   692 apply (frule_tac obj = obj in co2sobj_open_some, simp+)
       
   693 apply (simp add:alive_co2sobj_some_open_some', simp)
       
   694 apply (rule notI)
       
   695 apply (frule_tac obj = obj and p = p in co2sobj_proc_obj, simp+, erule exE)
       
   696 apply (erule_tac x = p' in allE, simp)
       
   697 
       
   698 apply (simp split:if_splits, erule disjE)
       
   699 apply (rule_tac x = "O_proc p" in exI, simp)
       
   700 apply (erule disjE, rule_tac x = "O_file f" in exI, simp add:is_file_simps)
       
   701 apply (erule exE, erule conjE)
       
   702 apply (case_tac "obj = O_proc p", simp)
       
   703 apply (rule_tac x = "O_proc p'" in exI, simp add:co2sobj_open_some)
       
   704 apply (case_tac "obj = O_file f", simp add:is_file_in_current)
       
   705 apply (rule_tac x = obj in exI, simp add:co2sobj_open_some alive_co2sobj_some_open_some)
       
   706 apply (erule disjE, rule_tac x = "O_proc p" in exI, simp)
       
   707 apply (erule disjE, rule_tac x = "O_file f" in exI, simp add:is_file_simps)
       
   708 apply (erule conjE, erule exE, erule conjE)
       
   709 apply (case_tac "obj = O_proc p", simp)
       
   710 apply (case_tac "obj = O_file f", simp add:is_file_in_current)
       
   711 apply (rule_tac x = obj in exI, simp add:co2sobj_open_some alive_co2sobj_some_open_some)
       
   712 done
       
   713 
       
   714 lemma s2ss_open':
       
   715   "valid (Open p f flag fd opt # s) \<Longrightarrow> s2ss (Open p f flag fd opt # s) = (
       
   716      if opt = None
       
   717      then (case (co2sobj s (O_proc p), co2sobj (Open p f flag fd opt # s) (O_proc p)) of
       
   718         (Some sp, Some sp') \<Rightarrow> 
       
   719            if (\<exists> p'. p' \<in> current_procs s \<and> p' \<noteq> p \<and> co2sobj s (O_proc p') = Some sp)
       
   720            then s2ss s \<union> {sp'}
       
   721            else s2ss s - {sp} \<union> {sp'} 
       
   722       | _                   \<Rightarrow> {} )
       
   723      else (case (co2sobj s (O_proc p), co2sobj (Open p f flag fd opt # s) (O_proc p),
       
   724             co2sobj (Open p f flag fd opt # s) (O_file f)) of
       
   725         (Some sp, Some sp', Some sf) \<Rightarrow> 
       
   726            if (\<exists> p'. p' \<in> current_procs s \<and> p' \<noteq> p \<and> co2sobj s (O_proc p') = Some sp)
       
   727            then s2ss s \<union> {sp', sf} 
       
   728            else s2ss s - {sp} \<union> {sp', sf} 
       
   729       | _                   \<Rightarrow> {} ) )"
       
   730 apply (case_tac opt)
       
   731 apply (simp add:s2ss_open_some s2ss_open_none)+
       
   732 done
       
   733 
       
   734 lemma co2sobj_proc_eq_some:
       
   735   "\<lbrakk>co2sobj s (O_proc p) = Some sp; co2sobj s obj = Some sp\<rbrakk>
       
   736    \<Longrightarrow> \<exists> p'. obj = O_proc p'"
       
   737 apply (case_tac obj, case_tac[!] sp)
       
   738 by (auto simp:co2sobj.simps split:option.splits)
       
   739 
       
   740 lemma s2ss_open:
       
   741   "valid (Open p f flag fd opt # s) \<Longrightarrow> 
       
   742     (case (co2sobj s (O_proc p), co2sobj (Open p f flag fd opt # s) (O_proc p), 
       
   743            co2sobj (Open p f flag fd opt # s) (O_file f)) of
       
   744        (Some sp, Some sp', Some sf) \<Rightarrow> s2ss (Open p f flag fd opt # s) = (
       
   745        if opt = None
       
   746        then update_s2ss_obj s (s2ss s) (O_proc p) sp sp'
       
   747        else update_s2ss_obj s (s2ss s) (O_proc p) sp sp' \<union> {sf})
       
   748      | _ \<Rightarrow> s2ss (Open p f flag fd opt # s) = {})"
       
   749 apply (frule vt_grant_os, frule vd_cons, clarsimp simp only:os_grant.simps)
       
   750 apply (case_tac "co2sobj s (O_proc p)")
       
   751 apply (simp add:co2sobj.simps split:option.splits)
       
   752 apply (drule current_proc_has_sp', simp, simp)
       
   753 apply (drule current_proc_has_sp', simp, simp)
       
   754 apply (case_tac "co2sobj (Open p f flag fd opt # s) (O_proc p)")
       
   755 apply (simp add:co2sobj.simps split:option.splits)
       
   756 apply (drule current_proc_has_sp', simp, simp)
       
   757 apply (drule current_proc_has_sp', simp, simp)
       
   758 apply (case_tac "co2sobj (Open p f flag fd opt # s) (O_file f)")
       
   759 apply (simp add:co2sobj.simps split:option.splits)
       
   760 apply (simp split:option.splits add:s2ss_open' update_s2ss_obj_def)
       
   761 apply (auto)
       
   762 apply (erule_tac x = "O_proc p'" in allE, simp)
       
   763 apply (frule_tac obj = obj' in co2sobj_proc_eq_some, simp, erule exE, simp)
       
   764 apply (erule_tac x = "p'" in allE, simp)
       
   765 apply (erule_tac x = "O_proc p'" in allE, simp)
       
   766 apply (frule_tac obj = obj' in co2sobj_proc_eq_some, simp, erule exE, simp)
       
   767 apply (erule_tac x = "p'" in allE, simp)
       
   768 apply (erule_tac x = "O_proc p'" in allE, simp)
       
   769 apply (frule_tac obj = obj' in co2sobj_proc_eq_some, simp, erule exE, simp)
       
   770 apply (erule_tac x = "p'" in allE, simp)
       
   771 done
       
   772 
       
   773 lemma s2ss_readfile:
       
   774   "valid (ReadFile p fd # s) \<Longrightarrow> s2ss (ReadFile p fd # s) = (
       
   775      case (file_of_proc_fd s p fd) of 
       
   776        Some f \<Rightarrow> if (O_file f \<in> tainted s \<and> O_proc p \<notin> tainted s)
       
   777                  then (case (cp2sproc s p) of 
       
   778                          Some sp \<Rightarrow> update_s2ss_obj s (s2ss s) (O_proc p) (S_proc sp False) (S_proc sp True)
       
   779                        | _       \<Rightarrow> {})
       
   780                  else s2ss s
       
   781      | _      \<Rightarrow> {})"
       
   782 apply (frule vt_grant_os, frule vd_cons, clarsimp simp only:os_grant.simps)
       
   783 apply (case_tac "cp2sproc s p")
       
   784 apply (drule current_proc_has_sp', simp+)
       
   785 apply (rule conjI, rule impI, erule conjE)
       
   786 
       
   787 apply (simp add:update_s2ss_obj_def)
       
   788 apply (tactic {*my_clarify_tac 1*})
       
   789 apply (frule co2sobj_sproc_imp, erule exE, simp split:option.splits)
       
   790 apply (simp add:s2ss_def)
       
   791 apply (tactic {*my_seteq_tac 1*})
       
   792 apply (case_tac "obj = O_proc p")
       
   793 apply (rule disjI1, simp add:co2sobj_readfile)
       
   794 apply (rule disjI2, simp)
       
   795 apply (rule_tac x = obj in exI)
       
   796 apply (simp add:alive_other co2sobj_readfile split:t_object.splits option.splits)
       
   797 apply (tactic {*my_setiff_tac 1*})
       
   798 apply (rule_tac x= "O_proc p" in exI, simp add:alive_other co2sobj_readfile)
       
   799 apply (tactic {*my_setiff_tac 1*})
       
   800 apply (case_tac "obj = O_proc p")
       
   801 apply (rule_tac x = "O_proc pa" in exI, simp add:alive_other co2sobj_readfile)
       
   802 apply (simp add:co2sobj.simps)
       
   803 apply (rule_tac x = obj in exI)
       
   804 apply (auto simp add:alive_other co2sobj_readfile split:t_object.splits option.splits)[1]
       
   805 apply (tactic {*my_clarify_tac 1*})
       
   806 apply (simp add:s2ss_def)
       
   807 apply (tactic {*my_seteq_tac 1*})
       
   808 apply (case_tac "obj = O_proc p")
       
   809 apply (rule disjI1, simp add:co2sobj_readfile)
       
   810 apply (rule disjI2, rule DiffI)
       
   811 apply (simp, rule_tac x = obj in exI)
       
   812 apply (simp add:alive_other co2sobj_readfile split:t_object.splits option.splits)
       
   813 apply (rule notI, erule_tac x = obj in allE)
       
   814 apply (auto simp add:alive_other co2sobj_readfile split:t_object.splits option.splits)[1]
       
   815 apply (tactic {*my_setiff_tac 1*})
       
   816 apply (rule_tac x = "O_proc p" in exI, simp add:alive_other co2sobj_readfile)
       
   817 apply (tactic {*my_setiff_tac 1*})
       
   818 apply (rule_tac x = obj in exI)
       
   819 apply (auto simp add:alive_other co2sobj_readfile split:t_object.splits option.splits)[1]
       
   820 apply (simp add:co2sobj.simps)
       
   821 
       
   822 apply (simp add:s2ss_def, rule impI)
       
   823 apply (tactic {*my_seteq_tac 1*})
       
   824 apply (rule_tac x = obj in exI)
       
   825 apply (simp add:alive_other co2sobj_readfile split:t_object.splits option.splits if_splits)
       
   826 apply (simp add:co2sobj.simps)
       
   827 apply (tactic {*my_setiff_tac 1*})
       
   828 apply (rule_tac x = obj in exI)
       
   829 apply (auto simp add:alive_other co2sobj_readfile split:t_object.splits option.splits if_splits)
       
   830 apply (simp add:co2sobj.simps)
       
   831 done
       
   832 
       
   833 lemma same_inode_files_prop9:
       
   834   "is_file s f \<Longrightarrow> f \<in> same_inode_files s f"
       
   835 by (simp add:same_inode_files_def)
       
   836 
       
   837 lemma cf2sfiles_prop:
       
   838   "\<lbrakk>f \<in> same_inode_files s f'; valid s\<rbrakk> \<Longrightarrow> cf2sfiles s f = cf2sfiles s f'"
       
   839 apply (auto simp:cf2sfiles_def)
       
   840 apply (rule_tac x = f'a in bexI, simp)
       
   841 apply (erule same_inode_files_prop4, simp)
       
   842 apply (rule_tac x = f'a in bexI, simp)
       
   843 apply (drule same_inode_files_prop5)
       
   844 apply (erule same_inode_files_prop4, simp)
       
   845 done
       
   846 
       
   847 lemma co2sobj_writefile_unchange:
       
   848   "\<lbrakk>valid (WriteFile p fd # s); alive s obj; file_of_proc_fd s p fd = Some f;
       
   849     O_proc p \<in> tainted s \<longrightarrow> O_file f \<in> tainted s\<rbrakk> 
       
   850    \<Longrightarrow> co2sobj (WriteFile p fd # s) obj = co2sobj s obj"
       
   851 apply (frule vd_cons, frule co2sobj_writefile, simp, simp split:t_object.splits if_splits)
       
   852 apply (simp add:co2sobj.simps)
       
   853 apply (case_tac "O_proc p \<in> tainted s")
       
   854 apply (simp add:same_inodes_tainted)+
       
   855 done
       
   856 
       
   857 lemma s2ss_writefile':
       
   858   "valid (WriteFile p fd # s) \<Longrightarrow> s2ss (WriteFile p fd # s) = (
       
   859      case (file_of_proc_fd s p fd) of
       
   860        Some f \<Rightarrow> if (O_proc p \<in> tainted s \<and> O_file f \<notin> tainted s)
       
   861                  then (if (\<exists> f'. f' \<notin> same_inode_files s f \<and> is_file s f' \<and>
       
   862                                  co2sobj s (O_file f') = co2sobj s (O_file f))
       
   863                        then s2ss s \<union> {S_file (cf2sfiles s f) True}
       
   864                        else s2ss s - {S_file (cf2sfiles s f) False} 
       
   865                                    \<union> {S_file (cf2sfiles s f) True})
       
   866                  else s2ss s
       
   867      | _      \<Rightarrow> {})"
       
   868 apply (frule vd_cons, frule vt_grant_os)
       
   869 apply (clarsimp split:option.splits)
       
   870 unfolding s2ss_def
       
   871 apply (rule conjI|rule impI|erule exE|erule conjE)+
       
   872 apply (rule set_eqI, rule iffI, erule CollectE, erule exE, erule conjE)
       
   873 apply (frule_tac obj =  obj in co2sobj_writefile, simp add:alive_other)
       
   874 apply (simp split:t_object.splits if_splits)
       
   875 apply (rule disjI2, rule_tac x= "O_proc nat" in exI, simp)
       
   876 apply (rule disjI1, simp add:cf2sfiles_prop)
       
   877 apply (rule disjI2, rule_tac x = obj in exI, simp add:is_file_simps)
       
   878 apply (simp add:co2sobj.simps)
       
   879 apply (rule disjI2, rule_tac x = obj in exI, simp add:is_dir_simps)
       
   880 apply (simp add:co2sobj.simps)
       
   881 apply (simp add:co2sobj.simps)
       
   882 apply (simp add:co2sobj.simps)
       
   883 apply (rule disjI2, rule_tac x = obj in exI, simp)
       
   884 apply (rule disjI2, rule_tac x = obj in exI, simp)
       
   885 apply (simp add:co2sobj.simps)
       
   886 
       
   887 apply (erule disjE)
       
   888 apply (rule_tac x = "O_file aa" in exI, simp add:is_file_simps file_of_pfd_is_file)
       
   889 apply (frule_tac obj = "O_file aa" in co2sobj_writefile, simp add:file_of_pfd_is_file)
       
   890 apply (simp split:if_splits add:same_inode_files_def file_of_pfd_is_file)
       
   891 apply (erule exE, erule conjE, erule conjE)
       
   892 apply (erule_tac obj = obj in co2sobj_some_caseD)
       
   893 apply (rule_tac x = obj in exI, simp add:co2sobj_writefile)
       
   894 apply (case_tac "fa \<in> same_inode_files s aa")
       
   895 apply (frule_tac f = fa and f' = aa in cf2sfiles_prop, simp)
       
   896 apply (rule_tac x = "O_file f'" in exI, simp add:co2sobj_writefile is_file_simps)
       
   897 apply (rule conjI, rule impI, simp add:same_inode_files_prop5)
       
   898 apply (rule impI, simp add:co2sobj.simps same_inodes_tainted)
       
   899 apply (rule_tac x = "O_file fa" in exI, simp add:co2sobj_writefile is_file_simps)
       
   900 apply (rule impI, simp add:same_inode_files_prop5)
       
   901 apply (rule_tac x = obj in exI, simp add:co2sobj_writefile is_dir_simps)
       
   902 apply (rule_tac x = obj in exI, simp add:co2sobj_writefile)
       
   903 
       
   904 apply (rule impI, rule impI, simp, rule set_eqI, rule iffI, erule CollectE, (erule conjE|erule exE)+)
       
   905 apply (rule CollectI, rule_tac x = obj in exI, simp add:alive_simps)
       
   906 apply (simp add:co2sobj_writefile split:t_object.splits if_splits)
       
   907 apply (simp add:co2sobj.simps same_inodes_tainted)
       
   908 apply (case_tac "O_proc p \<in> tainted s", simp, simp)
       
   909 apply (erule CollectE, (erule conjE|erule exE)+, rule CollectI)
       
   910 apply (rule_tac x = obj in exI)
       
   911 apply (simp add:co2sobj_writefile_unchange alive_simps)
       
   912 
       
   913 apply (rule impI| rule conjI|erule conjE)+
       
   914 apply (rule set_eqI, rule iffI, erule CollectE, erule exE, erule conjE)
       
   915 apply (simp add:alive_simps co2sobj_writefile split:t_object.splits)
       
   916 apply (rule disjI2, rule conjI, rule_tac x = obj in exI, simp,
       
   917   rule notI, simp add:co2sobj.simps split:option.splits)
       
   918 apply (simp split:if_splits)
       
   919 apply (rule disjI1, simp add:cf2sfiles_prop)
       
   920 apply (rule disjI2, rule conjI, rule_tac x = obj in exI, simp)
       
   921 apply (rule notI, simp add:co2sobj.simps split:option.splits)
       
   922 apply (erule_tac x = list in allE, simp add:same_inode_files_prop5)
       
   923 apply (simp add:co2sobj.simps)
       
   924 apply (rule disjI2, rule conjI, rule_tac x = obj in exI, simp,
       
   925   rule notI, simp add:co2sobj.simps split:option.splits)
       
   926 apply (simp add:co2sobj.simps)
       
   927 apply (simp add:co2sobj.simps)
       
   928 apply (simp add:co2sobj.simps)
       
   929 apply (rule disjI2, rule conjI, rule_tac x = obj in exI, simp,
       
   930   rule notI, simp add:co2sobj.simps split:option.splits)
       
   931 apply (rule disjI2, rule conjI, rule_tac x = obj in exI, simp,
       
   932   rule notI, simp add:co2sobj.simps split:option.splits)
       
   933 apply (simp add:co2sobj.simps)
       
   934 apply (erule disjE)
       
   935 apply (rule_tac x= "O_file aa" in exI, simp add:co2sobj_writefile alive_simps file_of_pfd_is_file)
       
   936 apply (rule impI, simp add:same_inode_files_def file_of_pfd_is_file)
       
   937 apply (erule exE|erule conjE)+
       
   938 apply (erule co2sobj_some_caseD)
       
   939 apply (rule_tac x = obj in exI, simp add:co2sobj_writefile)
       
   940 apply (case_tac "fa \<in> same_inode_files s aa")
       
   941 apply (frule cf2sfiles_prop, simp, simp add:co2sobj.simps same_inodes_tainted)
       
   942 apply (rule_tac x = obj in exI, simp add:co2sobj_writefile is_file_simps)
       
   943 apply (rule impI, simp add:same_inode_files_prop5)
       
   944 apply (rule_tac x = obj in exI, simp add:co2sobj_writefile is_dir_simps)
       
   945 apply (rule_tac x = obj in exI, simp add:co2sobj_writefile)
       
   946 apply (rule impI, rule impI)
       
   947 
       
   948 apply (rule set_eqI, rule iffI, erule CollectE,erule exE,erule conjE,rule CollectI)
       
   949 apply (rule_tac x = obj in exI)
       
   950 apply (simp add:co2sobj_writefile_unchange alive_simps)
       
   951 apply (erule CollectE, erule exE, erule conjE)
       
   952 apply (rule CollectI, rule_tac x = obj in exI)
       
   953 apply (simp add:co2sobj_writefile_unchange alive_simps)
       
   954 done
       
   955 
       
   956 definition update_s2ss_sfile_tainted:: "t_state \<Rightarrow> t_static_state \<Rightarrow> t_file \<Rightarrow> bool \<Rightarrow> t_static_state"
       
   957 where
       
   958  "update_s2ss_sfile_tainted s ss f tag \<equiv>
       
   959     if (\<exists> f'. is_file s f' \<and> f' \<notin> same_inode_files s f \<and> 
       
   960               co2sobj s (O_file f') = Some (S_file (cf2sfiles s f) False))
       
   961        then ss \<union> {S_file (cf2sfiles s f) True}
       
   962        else ss - {S_file (cf2sfiles s f) False} 
       
   963                \<union> {S_file (cf2sfiles s f) True}"
       
   964 
       
   965 lemma s2ss_writefile:
       
   966   "valid (WriteFile p fd # s) \<Longrightarrow> s2ss (WriteFile p fd # s) = (
       
   967      case (file_of_proc_fd s p fd) of
       
   968        Some f \<Rightarrow> if (O_proc p \<in> tainted s \<and> O_file f \<notin> tainted s)
       
   969                  then update_s2ss_sfile_tainted s (s2ss s) f True
       
   970                  else s2ss s
       
   971      | _      \<Rightarrow> {})"
       
   972 apply (drule s2ss_writefile')
       
   973 apply (simp)
       
   974 apply (case_tac "file_of_proc_fd s p fd", simp)
       
   975 apply (simp add:update_s2ss_sfile_tainted_def)
       
   976 apply auto
       
   977 apply (erule_tac x = f' in allE, simp add:co2sobj.simps)+
       
   978 done
       
   979 
       
   980 definition update_s2ss_sfile_del :: "t_state \<Rightarrow> t_static_state \<Rightarrow> t_file \<Rightarrow> t_sfile \<Rightarrow> t_static_state"
       
   981 where 
       
   982   "update_s2ss_sfile_del s ss f sf \<equiv> 
       
   983      if (same_inode_files s f = {f})
       
   984      then ss
       
   985      else ss \<union> {S_file (cf2sfiles s f - {sf}) (O_file f \<in> tainted s)}"
       
   986 
       
   987 definition del_s2ss_file:: "t_state \<Rightarrow> t_static_state \<Rightarrow> t_file \<Rightarrow> t_sfile \<Rightarrow> t_static_state"
       
   988 where
       
   989   "del_s2ss_file s ss f sf = 
       
   990      (if (\<exists> f' \<in> same_inode_files s f. f' \<noteq> f \<and> cf2sfile s f' = Some sf)
       
   991       then ss
       
   992       else if (\<exists> f'. is_file s f' \<and> f' \<notin> same_inode_files s f \<and> co2sobj s (O_file f') = co2sobj s (O_file f))
       
   993            then update_s2ss_sfile_del s ss f sf
       
   994            else update_s2ss_sfile_del s (ss - {S_file (cf2sfiles s f) (O_file f \<in> tainted s)}) f sf)"
       
   995 
       
   996 
       
   997 lemma alive_co2sobj_closefd1:
       
   998   "\<lbrakk>alive s obj; valid (CloseFd p fd # s); co2sobj s obj = Some sobj; 
       
   999     file_of_proc_fd s p fd = Some f; \<not> (f \<in> files_hung_by_del s \<and> proc_fd_of_file s f = {(p, fd)})\<rbrakk>
       
  1000    \<Longrightarrow> alive (CloseFd p fd # s) obj"
       
  1001 apply (erule co2sobj_some_caseD)
       
  1002 by (auto simp:alive_simps is_file_simps is_dir_simps split:option.splits)
       
  1003 
       
  1004 lemma alive_co2sobj_closefd3:
       
  1005   "\<lbrakk>alive s obj; valid (CloseFd p fd # s); co2sobj s obj = Some sobj; obj \<noteq> O_file f;
       
  1006     file_of_proc_fd s p fd = Some f; f \<in> files_hung_by_del s; proc_fd_of_file s f = {(p, fd)}\<rbrakk>
       
  1007    \<Longrightarrow> alive (CloseFd p fd # s) obj"
       
  1008 apply (erule co2sobj_some_caseD)
       
  1009 by (auto simp:alive_simps is_file_simps is_dir_simps split:option.splits)
       
  1010 
       
  1011 lemma alive_co2sobj_closefd2:
       
  1012   "\<lbrakk>alive s obj; valid (CloseFd p fd # s); co2sobj s obj = Some sobj; file_of_proc_fd s p fd = None\<rbrakk>
       
  1013    \<Longrightarrow> alive (CloseFd p fd # s) obj"
       
  1014 apply (erule co2sobj_some_caseD)
       
  1015 by (auto simp:alive_simps is_file_simps is_dir_simps split:option.splits)
       
  1016 
       
  1017 lemma alive_co2sobj_closefd':
       
  1018   "\<lbrakk>co2sobj (CloseFd p fd # s) obj = Some sobj; alive (CloseFd p fd # s) obj; 
       
  1019     valid (CloseFd p fd # s)\<rbrakk> \<Longrightarrow> alive s obj"
       
  1020 apply (erule co2sobj_some_caseD)
       
  1021 by (auto simp:alive_simps is_file_simps is_dir_simps split:option.splits if_splits)
       
  1022 
       
  1023 ML {*asm_full_simp_tac*}
       
  1024 
       
  1025 lemma same_inode_files_prop10:
       
  1026   "\<lbrakk>same_inode_files s f \<noteq> {f}; is_file s f\<rbrakk> \<Longrightarrow> \<exists> f'. f' \<in> same_inode_files s f \<and> f' \<noteq> f"
       
  1027 by (auto simp:same_inode_files_def split:if_splits)
       
  1028 
       
  1029 lemma same_inode_files_prop11:
       
  1030   "f \<in> same_inode_files s f' \<Longrightarrow> is_file s f"
       
  1031 by (auto simp:same_inode_files_def is_file_def split:if_splits)
       
  1032 
       
  1033 lemma same_inode_files_prop11':
       
  1034   "f \<in> same_inode_files s f' \<Longrightarrow> is_file s f'"
       
  1035 by (auto simp:same_inode_files_def is_file_def split:if_splits)
       
  1036 
       
  1037 lemma s2ss_closefd:
       
  1038   "valid (CloseFd p fd # s) \<Longrightarrow> s2ss (CloseFd p fd # s) = (
       
  1039      case (file_of_proc_fd s p fd) of
       
  1040        Some f \<Rightarrow> if (f \<in> files_hung_by_del s \<and> proc_fd_of_file s f = {(p, fd)})
       
  1041                  then (case (cf2sfile s f, cp2sproc s p, cp2sproc (CloseFd p fd # s) p) of
       
  1042                          (Some sf, Some sp, Some sp') \<Rightarrow> 
       
  1043                             (del_s2ss_file s (
       
  1044                                update_s2ss_obj s (s2ss s) (O_proc p) 
       
  1045                                  (S_proc sp (O_proc p \<in> tainted s))
       
  1046                                  (S_proc sp' (O_proc p \<in> tainted s))) f sf)
       
  1047                       | _ \<Rightarrow> {})
       
  1048                  else (case (cp2sproc s p, cp2sproc (CloseFd p fd # s) p) of 
       
  1049                          (Some sp, Some sp') \<Rightarrow> 
       
  1050                             (update_s2ss_obj s (s2ss s) (O_proc p)
       
  1051                                (S_proc sp (O_proc p \<in> tainted s))
       
  1052                                (S_proc sp' (O_proc p \<in> tainted s)))
       
  1053                       | _ \<Rightarrow> {})
       
  1054       | _     \<Rightarrow> s2ss s)"
       
  1055 apply (frule vd_cons, frule vt_grant_os)
       
  1056 apply (clarsimp simp only:os_grant.simps)
       
  1057 apply (frule current_proc_has_sp, simp, erule exE)
       
  1058 apply (case_tac "file_of_proc_fd s p fd")
       
  1059 
       
  1060 apply (simp add:s2ss_def)
       
  1061 apply (rule set_eqI, rule iffI, erule CollectE, erule exE, erule conjE, rule CollectI)
       
  1062 apply (rule_tac x = obj in exI, simp add:alive_co2sobj_closefd')
       
  1063 apply (frule co2sobj_closefd, simp)
       
  1064 apply (frule cp2sproc_closefd, simp)
       
  1065 apply (simp add:proc_file_fds_def split:t_object.splits)
       
  1066 apply (simp split:if_splits add:co2sobj.simps)
       
  1067 apply (erule CollectE, erule exE, erule conjE, rule CollectI)
       
  1068 apply (rule_tac x = obj in exI, simp add:alive_co2sobj_closefd2)
       
  1069 apply (frule_tac obj = obj in co2sobj_closefd, simp add:alive_co2sobj_closefd2)
       
  1070 apply (frule cp2sproc_closefd, simp)
       
  1071 apply (auto simp add:proc_file_fds_def co2sobj.simps 
       
  1072             split:t_object.splits option.splits if_splits)[1]
       
  1073 
       
  1074 apply (case_tac "cp2sproc (CloseFd p fd # s) p")
       
  1075 apply (drule current_proc_has_sp', simp, simp)
       
  1076 apply (case_tac "cf2sfile s a")
       
  1077 apply (drule current_file_has_sfile', simp, simp add:file_of_pfd_in_current)
       
  1078 apply (simp)
       
  1079 
       
  1080 apply (rule conjI, rule impI, erule conjE)
       
  1081 apply (simp add:del_s2ss_file_def)
       
  1082 apply (rule conjI|rule impI|erule exE|erule conjE|erule bexE)+
       
  1083 
       
  1084 apply (simp add:update_s2ss_obj_def)
       
  1085 apply (rule conjI|rule impI|erule exE|erule conjE|erule bexE)+
       
  1086 apply (tactic {*my_seteq_tac 1*})
       
  1087 apply simp
       
  1088 apply (case_tac "obj = O_proc p")
       
  1089 apply (simp add:co2sobj.simps)
       
  1090 apply (rule disjI2, rule_tac x = obj in exI)
       
  1091 apply (frule_tac obj = obj in co2sobj_closefd, simp add:alive_simps)
       
  1092 apply (simp add:alive_simps co2sobj.simps split:t_object.splits if_splits)
       
  1093 apply (tactic {*my_setiff_tac 1*})
       
  1094 apply (rule_tac x = "O_proc p" in exI)
       
  1095 apply (simp add:co2sobj.simps)
       
  1096 apply (tactic {*my_setiff_tac 1*})
       
  1097 apply (case_tac "obj = O_proc p")
       
  1098 apply (rule_tac x = obj' in exI)
       
  1099 apply (frule co2sobj_sproc_imp, erule exE, simp add:co2sobj_closefd)
       
  1100 apply (simp add:co2sobj.simps)
       
  1101 apply (case_tac "obj = O_file a")
       
  1102 apply (rule_tac x = "O_file f'" in exI)
       
  1103 apply (case_tac "f' = a", simp add:same_inode_files_prop9 file_of_pfd_is_file)
       
  1104 apply (frule_tac obj = "O_file f'" in co2sobj_closefd, simp add:alive_simps)
       
  1105 apply (simp add:alive_simps co2sobj.simps split:t_object.splits if_splits)
       
  1106 apply (rule_tac x = obj in exI)
       
  1107 apply (frule_tac obj = obj in alive_co2sobj_closefd3, simp+)
       
  1108 apply (frule_tac obj = obj in co2sobj_closefd, simp)
       
  1109 apply (auto simp add:alive_simps co2sobj.simps split:t_object.splits if_splits)[1]
       
  1110 
       
  1111 apply (rule impI)+
       
  1112 apply (tactic {*my_seteq_tac 1*})
       
  1113 apply (case_tac "obj = O_proc p", rule disjI1, simp add:co2sobj.simps)
       
  1114 apply (rule disjI2)
       
  1115 apply (case_tac "obj = O_file a", simp add:alive_simps)
       
  1116 apply (rule DiffI, simp)
       
  1117 apply (rule_tac x = obj in exI)
       
  1118 apply (frule_tac obj = obj in alive_co2sobj_closefd', simp+)
       
  1119 apply (frule_tac obj = obj in co2sobj_closefd, simp)
       
  1120 apply (simp add:alive_simps co2sobj.simps split:t_object.splits if_splits)
       
  1121 apply (simp, rule notI, simp, frule co2sobj_sproc_imp, erule exE, simp add:co2sobj_closefd)
       
  1122 apply (erule_tac x = "O_proc pa" in allE, simp)
       
  1123 apply (tactic {*my_setiff_tac 1*})
       
  1124 apply (rule_tac x = "O_proc p" in exI, simp add:co2sobj.simps)
       
  1125 apply (tactic {*my_setiff_tac 1*})
       
  1126 apply (case_tac "obj = O_proc p", simp add:co2sobj.simps)
       
  1127 apply (case_tac "obj = O_file a", rule_tac x = "O_file f'" in exI)
       
  1128 apply (case_tac "f' = a", simp add:same_inode_files_prop9 file_of_pfd_is_file)
       
  1129 apply (frule_tac obj = "O_file f'" in co2sobj_closefd, simp add:alive_simps)
       
  1130 apply (simp add:alive_simps co2sobj.simps split:t_object.splits if_splits)
       
  1131 apply (rule_tac x = obj in exI)
       
  1132 apply (frule_tac obj = obj in alive_co2sobj_closefd3, simp+)
       
  1133 apply (frule_tac obj = obj in co2sobj_closefd, simp)
       
  1134 apply (auto simp add:co2sobj.simps split:t_object.splits if_splits)[1]
       
  1135 
       
  1136 apply (rule impI, tactic {*my_seteq_tac 1*})
       
  1137 apply (simp add:update_s2ss_obj_def update_s2ss_sfile_del_def)
       
  1138 apply (rule conjI| rule impI|erule exE|erule conjE)+
       
  1139 apply (erule_tac obj = obj in co2sobj_some_caseD)
       
  1140 apply (case_tac "pa = p", simp add:co2sobj.simps)
       
  1141 apply (rule disjI2, rule_tac x = obj in exI)
       
  1142 apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
       
  1143 apply (case_tac "f = a", simp add:alive_simps)
       
  1144 apply (rule disjI2, rule_tac x = obj in exI)
       
  1145 apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
       
  1146 apply (rule disjI2, rule_tac x = obj in exI)
       
  1147 apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
       
  1148 apply (rule disjI2, rule_tac x = obj in exI)
       
  1149 apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
       
  1150 apply (rule conjI| rule impI|erule exE|erule conjE)+
       
  1151 apply (erule_tac obj = obj in co2sobj_some_caseD)
       
  1152 apply (case_tac "pa = p", simp add:co2sobj.simps)
       
  1153 apply (rule disjI2, rule disjI2, rule_tac x = obj in exI)
       
  1154 apply (frule_tac obj = obj in co2sobj_closefd, simp)
       
  1155 apply (auto simp add:co2sobj.simps split:t_object.splits if_splits)[1]
       
  1156 apply (case_tac "f = a", simp add:alive_simps)
       
  1157 apply (case_tac "f \<in> same_inode_files s a", rule disjI1)
       
  1158 apply (simp add:co2sobj_simps split:if_splits option.splits t_sobject.splits)
       
  1159 apply (simp add:co2sobj.simps same_inodes_tainted cf2sfiles_prop)
       
  1160 apply (erule bexE, erule conjE)
       
  1161 apply (erule_tac x = f'' in ballE, simp, simp)
       
  1162 apply (rule disjI2, rule disjI2, rule_tac x = obj in exI)
       
  1163 apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
       
  1164 apply (rule disjI2, rule disjI2, rule_tac x = obj in exI)
       
  1165 apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
       
  1166 apply (rule disjI2, rule disjI2, rule_tac x = obj in exI)
       
  1167 apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
       
  1168 apply (rule impI, rule conjI, rule impI)
       
  1169 apply (erule_tac obj = obj in co2sobj_some_caseD)
       
  1170 apply (case_tac "pa = p", simp add:co2sobj.simps)
       
  1171 apply (rule disjI2, rule conjI, rule_tac x = obj in exI)
       
  1172 apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
       
  1173 apply (rule notI, simp add:co2sobj_closefd, erule_tac x = obj in allE, simp add:is_file_simps)
       
  1174 apply (case_tac "f = a", simp add:alive_simps)
       
  1175 apply (rule disjI2, rule conjI, rule_tac x = obj in exI)
       
  1176 apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
       
  1177 apply (rule notI, simp add:co2sobj_closefd, erule_tac x = obj in allE, simp add:is_file_simps)
       
  1178 apply (rule disjI2, rule conjI, rule_tac x = obj in exI)
       
  1179 apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
       
  1180 apply (rule notI, simp add:co2sobj_closefd, erule_tac x = obj in allE, simp add:is_dir_simps)
       
  1181 apply (rule disjI2, rule conjI, rule_tac x = obj in exI)
       
  1182 apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
       
  1183 apply (rule notI, simp add:co2sobj_closefd, erule_tac x = obj in allE, simp)
       
  1184 apply (rule impI)
       
  1185 apply (erule_tac obj = obj in co2sobj_some_caseD)
       
  1186 apply (case_tac "pa = p", simp add:co2sobj.simps)
       
  1187 apply (rule disjI2, rule disjI2, rule conjI, rule_tac x = obj in exI)
       
  1188 apply (frule_tac obj = obj in co2sobj_closefd, simp)
       
  1189 apply (auto simp add:co2sobj.simps split:t_object.splits if_splits)[1]
       
  1190 apply (rule notI, simp add:co2sobj_closefd)
       
  1191 apply (erule_tac x = obj in allE, simp)
       
  1192 apply (case_tac "f = a", simp add:alive_simps)
       
  1193 apply (case_tac "f \<in> same_inode_files s a", rule disjI1)
       
  1194 apply (simp add:co2sobj_simps split:if_splits option.splits t_sobject.splits)
       
  1195 apply (simp add:co2sobj.simps same_inodes_tainted cf2sfiles_prop)
       
  1196 apply (erule bexE, erule conjE)
       
  1197 apply (erule_tac x = f'' in ballE, simp, simp)
       
  1198 apply (rule disjI2, rule disjI2, rule conjI, rule_tac x = obj in exI)
       
  1199 apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
       
  1200 apply (rule notI, simp add:co2sobj_closefd, erule_tac x = obj in allE, simp add:is_file_simps)
       
  1201 apply (rule disjI2, rule disjI2, rule conjI, rule_tac x = obj in exI)
       
  1202 apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
       
  1203 apply (rule notI, simp add:co2sobj_closefd, erule_tac x = obj in allE, simp add:is_dir_simps)
       
  1204 apply (rule disjI2, rule disjI2, rule conjI, rule_tac x = obj in exI)
       
  1205 apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
       
  1206 apply (rule notI, simp add:co2sobj_closefd, erule_tac x = obj in allE, simp)
       
  1207 
       
  1208 apply (simp add:update_s2ss_sfile_del_def update_s2ss_obj_def split:if_splits)
       
  1209 apply (erule disjE, rule_tac x = "O_proc p" in exI, simp add:co2sobj.simps)
       
  1210 apply (erule exE, erule conjE)
       
  1211 apply (case_tac "obj = O_proc p")
       
  1212 apply (rule_tac x = obj' in exI)
       
  1213 apply (frule co2sobj_sproc_imp, erule exE, simp add:co2sobj_closefd)
       
  1214 apply (simp add:co2sobj.simps)
       
  1215 apply (case_tac "obj = O_file a")
       
  1216 apply (rule_tac x = "O_file f'" in exI)
       
  1217 apply (case_tac "f' = a", simp add:same_inode_files_prop9 file_of_pfd_is_file)
       
  1218 apply (frule_tac obj = "O_file f'" in co2sobj_closefd, simp add:alive_simps)
       
  1219 apply (simp add:alive_simps co2sobj.simps split:t_object.splits if_splits)
       
  1220 apply (rule_tac x = obj in exI)
       
  1221 apply (frule_tac obj = obj in alive_co2sobj_closefd3, simp+)
       
  1222 apply (frule_tac obj = obj in co2sobj_closefd, simp)
       
  1223 apply (auto simp add:alive_simps co2sobj.simps split:t_object.splits if_splits)[1]
       
  1224 apply (erule disjE, rule_tac x = "O_proc p" in exI, simp add:co2sobj.simps)
       
  1225 apply (erule conjE, erule exE, erule conjE)
       
  1226 apply (case_tac "obj = O_proc p")
       
  1227 apply (simp add:co2sobj.simps)
       
  1228 apply (case_tac "obj = O_file a")
       
  1229 apply (rule_tac x = "O_file f'" in exI)
       
  1230 apply (case_tac "f' = a", simp add:same_inode_files_prop9 file_of_pfd_is_file)
       
  1231 apply (frule_tac obj = "O_file f'" in co2sobj_closefd, simp add:alive_simps)
       
  1232 apply (simp add:alive_simps co2sobj.simps split:t_object.splits if_splits)
       
  1233 apply (rule_tac x = obj in exI)
       
  1234 apply (frule_tac obj = obj in alive_co2sobj_closefd3, simp+)
       
  1235 apply (frule_tac obj = obj in co2sobj_closefd, simp)
       
  1236 apply (auto simp add:alive_simps co2sobj.simps split:t_object.splits if_splits)[1]
       
  1237 apply (erule disjE)
       
  1238 apply (drule same_inode_files_prop10, simp add:file_of_pfd_is_file, erule exE, erule conjE)
       
  1239 apply (rule_tac x = "O_file f'a" in exI)
       
  1240 apply (frule same_inode_files_prop11)
       
  1241 apply (frule_tac obj = "O_file f'a" in co2sobj_closefd)
       
  1242 apply (simp add:alive_simps)+
       
  1243 apply (frule_tac f = "f'a" in is_file_has_sfile', simp, erule exE)
       
  1244 apply (simp add:co2sobj.simps cf2sfiles_prop same_inodes_tainted split:if_splits)
       
  1245 apply (rule impI, erule bexE, erule conjE, erule_tac x = f'' in ballE, simp, simp)
       
  1246 apply (erule bexE, erule conjE, erule_tac x = f'' in ballE, simp, simp)
       
  1247 apply (erule disjE)
       
  1248 apply (rule_tac x = "O_proc p" in exI, simp add:co2sobj.simps)
       
  1249 apply (erule exE, erule conjE)
       
  1250 apply (case_tac "obj = O_proc p")
       
  1251 apply (rule_tac x = obj' in exI)
       
  1252 apply (frule co2sobj_sproc_imp, erule exE, simp add:co2sobj_closefd)
       
  1253 apply (simp add:co2sobj.simps)
       
  1254 apply (erule_tac obj = obj in co2sobj_some_caseD)
       
  1255 apply (rule_tac x = obj in exI)
       
  1256 apply (simp add:co2sobj_closefd)
       
  1257 apply (case_tac "f \<in> same_inode_files s a")
       
  1258 apply (rule_tac x = "O_file f'" in exI)
       
  1259 apply (simp add:co2sobj_simps is_file_simps split:if_splits option.splits t_sobject.splits)
       
  1260 apply (rule conjI, rule notI, simp add:same_inode_files_prop9)
       
  1261 apply (rule impI, simp add:co2sobj.simps cf2sfiles_prop same_inodes_tainted)
       
  1262 apply (rule_tac x = obj in exI)
       
  1263 apply (simp add:co2sobj_closefd is_file_simps)
       
  1264 apply (rule notI, simp add:same_inode_files_prop9)
       
  1265 apply (rule_tac x = obj in exI, simp add:co2sobj_closefd is_dir_simps)
       
  1266 apply (rule_tac x = obj in exI, simp add:co2sobj_closefd)
       
  1267 
       
  1268 apply (erule disjE)
       
  1269 apply (drule same_inode_files_prop10, simp add:file_of_pfd_is_file, erule exE, erule conjE)
       
  1270 apply (rule_tac x = "O_file f'a" in exI)
       
  1271 apply (frule same_inode_files_prop11)
       
  1272 apply (frule_tac obj = "O_file f'a" in co2sobj_closefd)
       
  1273 apply (simp add:alive_simps)+
       
  1274 apply (frule_tac f = "f'a" in is_file_has_sfile', simp, erule exE)
       
  1275 apply (simp add:co2sobj.simps cf2sfiles_prop same_inodes_tainted split:if_splits)
       
  1276 apply (rule impI, erule bexE, erule conjE, erule_tac x = f'' in ballE, simp, simp)
       
  1277 apply (erule bexE, erule conjE, erule_tac x = f'' in ballE, simp, simp)
       
  1278 apply (erule disjE)
       
  1279 apply (rule_tac x = "O_proc p" in exI)
       
  1280 apply (simp add:co2sobj.simps)
       
  1281 apply (erule conjE, erule exE, erule conjE)
       
  1282 apply (case_tac "obj = O_proc p")
       
  1283 apply (simp add:co2sobj.simps)
       
  1284 apply (erule_tac obj = obj in co2sobj_some_caseD)
       
  1285 apply (rule_tac x = obj in exI)
       
  1286 apply (simp add:co2sobj_closefd)
       
  1287 apply (case_tac "f \<in> same_inode_files s a")
       
  1288 apply (rule_tac x = "O_file f'" in exI)
       
  1289 apply (simp add:co2sobj_simps is_file_simps split:if_splits option.splits t_sobject.splits)
       
  1290 apply (rule conjI, rule notI, simp add:same_inode_files_prop9)
       
  1291 apply (rule impI, simp add:co2sobj.simps cf2sfiles_prop same_inodes_tainted)
       
  1292 apply (rule_tac x = obj in exI)
       
  1293 apply (simp add:co2sobj_closefd is_file_simps)
       
  1294 apply (rule notI, simp add:same_inode_files_prop9)
       
  1295 apply (rule_tac x = obj in exI, simp add:co2sobj_closefd is_dir_simps)
       
  1296 apply (rule_tac x = obj in exI, simp add:co2sobj_closefd)
       
  1297 
       
  1298 apply (rule impI, rule conjI, rule impI)
       
  1299 apply (tactic {*my_seteq_tac 1*})
       
  1300 apply (simp add:update_s2ss_obj_def update_s2ss_sfile_del_def)
       
  1301 apply (rule conjI| rule impI|erule exE|erule conjE)+
       
  1302 apply (erule_tac obj = obj in co2sobj_some_caseD)
       
  1303 apply (case_tac "pa = p", simp add:co2sobj.simps)
       
  1304 apply (rule disjI2, rule_tac x = obj in exI)
       
  1305 apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
       
  1306 apply (case_tac "f = a", simp add:alive_simps)
       
  1307 apply (rule disjI2, rule_tac x = obj in exI)
       
  1308 apply (frule_tac obj = obj in co2sobj_closefd, simp, clarsimp simp:alive_simps split:if_splits)
       
  1309 apply (rule disjI2, rule_tac x = obj in exI)
       
  1310 apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
       
  1311 apply (rule disjI2, rule_tac x = obj in exI)
       
  1312 apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
       
  1313 apply (rule conjI| rule impI|erule exE|erule conjE)+
       
  1314 apply (erule_tac obj = obj in co2sobj_some_caseD)
       
  1315 apply (case_tac "pa = p", simp add:co2sobj.simps)
       
  1316 apply (rule disjI2, rule conjI, rule_tac x = obj in exI)
       
  1317 apply (frule_tac obj = obj in co2sobj_closefd, simp)
       
  1318 apply (auto simp add:co2sobj.simps split:t_object.splits if_splits)[1]
       
  1319 apply (rule notI, simp, erule_tac x = "O_proc pa" in allE, simp add:co2sobj_closefd)
       
  1320 apply (case_tac "f = a", simp add:alive_simps)
       
  1321 apply (case_tac "f \<in> same_inode_files s a", rule disjI2)
       
  1322 apply (simp add:co2sobj_simps split:if_splits option.splits t_sobject.splits)
       
  1323 apply (simp add:co2sobj.simps same_inodes_tainted cf2sfiles_prop)
       
  1324 apply (erule bexE, erule conjE)
       
  1325 apply (rule conjI, rule_tac x = "O_file f''" in exI)
       
  1326 apply (simp add:same_inode_files_prop11 co2sobj.simps cf2sfiles_prop same_inodes_tainted)
       
  1327 apply (rule notI, simp)
       
  1328 apply (rule disjI2, rule conjI, rule_tac x = obj in exI)
       
  1329 apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
       
  1330 apply (rule notI, simp add:co2sobj.simps)
       
  1331 apply (rule disjI2, rule conjI, rule_tac x = obj in exI)
       
  1332 apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
       
  1333 apply (rule notI, simp add:co2sobj.simps split:option.splits)
       
  1334 apply (rule disjI2, rule conjI, rule_tac x = obj in exI)
       
  1335 apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
       
  1336 apply (rule notI, simp add:co2sobj.simps split:option.splits)
       
  1337 
       
  1338 apply (erule bexE, erule conjE)
       
  1339 apply (simp add:update_s2ss_obj_def split:if_splits)
       
  1340 apply (erule disjE, rule_tac x = "O_proc p" in exI, simp add:co2sobj.simps)
       
  1341 apply (erule exE, erule conjE)
       
  1342 apply (case_tac "obj = O_proc p")
       
  1343 apply (rule_tac x = obj' in exI)
       
  1344 apply (frule co2sobj_sproc_imp, erule exE, simp add:co2sobj_closefd)
       
  1345 apply (simp add:co2sobj.simps)
       
  1346 apply (case_tac "obj = O_file a")
       
  1347 apply (rule_tac x = "O_file f'" in exI)
       
  1348 apply (frule_tac obj = "O_file f'" in co2sobj_closefd, simp add:alive_simps same_inode_files_prop11)
       
  1349 apply (simp add:alive_simps co2sobj.simps split:t_object.splits if_splits)
       
  1350 apply (rule conjI)
       
  1351 apply (rule impI)
       
  1352 apply (rule_tac x = f' in ballE, simp, simp, simp)
       
  1353 apply (simp add:same_inode_files_prop11 co2sobj.simps cf2sfiles_prop same_inodes_tainted)
       
  1354 apply (rule_tac x = obj in exI)
       
  1355 apply (frule_tac obj = obj in alive_co2sobj_closefd3, simp+)
       
  1356 apply (frule_tac obj = obj in co2sobj_closefd, simp)
       
  1357 apply (auto simp add:alive_simps co2sobj.simps split:t_object.splits if_splits)[1]
       
  1358 apply (erule disjE, rule_tac x = "O_proc p" in exI, simp add:co2sobj.simps)
       
  1359 apply (erule conjE, erule exE, erule conjE)
       
  1360 apply (case_tac "obj = O_proc p")
       
  1361 apply (simp add:co2sobj.simps)
       
  1362 apply (case_tac "obj = O_file a")
       
  1363 apply (rule_tac x = "O_file f'" in exI)
       
  1364 apply (frule_tac obj = "O_file f'" in co2sobj_closefd, simp add:alive_simps same_inode_files_prop11)
       
  1365 apply (simp add:alive_simps co2sobj.simps split:t_object.splits if_splits)
       
  1366 apply (rule conjI)
       
  1367 apply (rule impI)
       
  1368 apply (rule_tac x = f' in ballE, simp, simp, simp)
       
  1369 apply (simp add:same_inode_files_prop11 co2sobj.simps cf2sfiles_prop same_inodes_tainted)
       
  1370 apply (rule_tac x = obj in exI)
       
  1371 apply (frule_tac obj = obj in alive_co2sobj_closefd3, simp+)
       
  1372 apply (frule_tac obj = obj in co2sobj_closefd, simp)
       
  1373 apply (auto simp add:alive_simps co2sobj.simps split:t_object.splits if_splits)[1]
       
  1374 
       
  1375 apply (rule impI)
       
  1376 apply (tactic {*my_seteq_tac 1*})
       
  1377 apply (simp add:update_s2ss_obj_def update_s2ss_sfile_del_def)
       
  1378 apply (rule conjI| rule impI|erule exE|erule conjE)+
       
  1379 apply (erule_tac obj = obj in co2sobj_some_caseD)
       
  1380 apply (case_tac "pa = p", simp add:co2sobj.simps)
       
  1381 apply (rule disjI2, rule_tac x = obj in exI)
       
  1382 apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
       
  1383 apply (case_tac "f = a", simp add:alive_simps)
       
  1384 apply (rule disjI2, rule_tac x = obj in exI)
       
  1385 apply (frule_tac obj = obj in co2sobj_closefd, simp, clarsimp simp:alive_simps split:if_splits)
       
  1386 apply (rule disjI2, rule_tac x = obj in exI)
       
  1387 apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
       
  1388 apply (rule disjI2, rule_tac x = obj in exI)
       
  1389 apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
       
  1390 apply (frule_tac obj = obj in co2sobj_closefd, simp, rule notI, simp)
       
  1391 apply (frule_tac obj = obj in co2sobj_sfile_imp, erule exE, simp add:is_file_simps split:if_splits)
       
  1392 apply (erule_tac x= f in allE, simp add:co2sobj.simps)
       
  1393 apply (rule conjI| rule impI|erule exE|erule conjE)+
       
  1394 apply (erule_tac obj = obj in co2sobj_some_caseD)
       
  1395 apply (case_tac "pa = p", simp add:co2sobj.simps)
       
  1396 apply (rule disjI2, rule notI, simp)
       
  1397 apply (rule disjI2, rule conjI, rule disjI2, rule_tac x = obj in exI)
       
  1398 apply (frule_tac obj = obj in co2sobj_closefd, simp)
       
  1399 apply (auto simp add:co2sobj.simps split:t_object.splits if_splits)[1]
       
  1400 apply (rule notI, simp add:co2sobj.simps split:option.splits)
       
  1401 apply (case_tac "f = a", simp add:alive_simps)
       
  1402 apply (case_tac "f \<in> same_inode_files s a", rule disjI1)
       
  1403 apply (simp add:co2sobj_simps split:if_splits option.splits t_sobject.splits)
       
  1404 apply (simp add:co2sobj.simps same_inodes_tainted cf2sfiles_prop)
       
  1405 apply (erule bexE, erule conjE)
       
  1406 apply (erule_tac x = f'' in ballE, simp, simp)
       
  1407 apply (rule disjI2, rule conjI, rule disjI2, rule_tac x = obj in exI)
       
  1408 apply (simp add:is_file_simps co2sobj_closefd)
       
  1409 apply (rule notI, simp add:co2sobj_closefd)
       
  1410 apply (erule_tac x = f in allE, simp add:is_file_simps co2sobj.simps) 
       
  1411 apply (rule disjI2, rule conjI, rule disjI2, rule_tac x = obj in exI)
       
  1412 apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
       
  1413 apply (rule notI, simp add:co2sobj.simps split:option.splits)
       
  1414 apply (rule disjI2, rule conjI, rule disjI2, rule_tac x = obj in exI)
       
  1415 apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
       
  1416 apply (rule notI, simp add:co2sobj.simps split:option.splits)
       
  1417 apply (rule impI, rule conjI, rule impI)
       
  1418 
       
  1419 apply (erule_tac obj = obj in co2sobj_some_caseD)
       
  1420 apply (case_tac "pa = p", simp add:co2sobj.simps)
       
  1421 apply (rule notI, simp)
       
  1422 apply (rule conjI, rule disjI2, rule conjI, rule_tac x = obj in exI)
       
  1423 apply (frule_tac obj = obj in co2sobj_closefd, simp)
       
  1424 apply (auto simp add:co2sobj.simps split:t_object.splits if_splits)[1]
       
  1425 apply (erule_tac x = obj in allE, simp add:co2sobj_closefd)
       
  1426 apply (rule notI, simp add:co2sobj.simps split:option.splits)
       
  1427 apply (case_tac "f = a", simp add:alive_simps)
       
  1428 apply (case_tac "f \<in> same_inode_files s a", rule conjI, rule disjI2, rule conjI)
       
  1429 apply (simp add:co2sobj_simps split:if_splits option.splits t_sobject.splits)
       
  1430 apply (simp add:co2sobj.simps)
       
  1431 apply (rule notI, simp add:co2sobj.simps)
       
  1432 apply (rule conjI, rule disjI2, rule conjI, rule_tac x = obj in exI)
       
  1433 apply (simp add:is_file_simps co2sobj_closefd)
       
  1434 apply (rule notI, simp add:co2sobj.simps)
       
  1435 apply (rule notI, simp add:co2sobj_closefd)
       
  1436 apply (erule_tac x = f in allE, simp add:is_file_simps co2sobj.simps)
       
  1437 apply (rule conjI, rule disjI2, rule conjI, rule_tac x = obj in exI)
       
  1438 apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
       
  1439 apply (rule notI, simp add:co2sobj.simps split:option.splits)+
       
  1440 apply (rule conjI, rule disjI2, rule conjI, rule_tac x = obj in exI)
       
  1441 apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
       
  1442 apply (rule notI, simp add:co2sobj.simps split:option.splits)+
       
  1443 apply (rule impI)
       
  1444 apply (erule_tac obj = obj in co2sobj_some_caseD)
       
  1445 apply (case_tac "pa = p", simp add:co2sobj.simps)
       
  1446 apply (rule disjI2, rule notI, simp)
       
  1447 apply (rule disjI2, rule conjI, rule disjI2, rule conjI, rule_tac x = obj in exI)
       
  1448 apply (frule_tac obj = obj in co2sobj_closefd, simp)
       
  1449 apply (auto simp add:co2sobj.simps split:t_object.splits if_splits)[1]
       
  1450 apply (erule_tac x = obj in allE, simp add:co2sobj_closefd)
       
  1451 apply (rule notI, simp add:co2sobj.simps split:option.splits)
       
  1452 apply (case_tac "f = a", simp add:alive_simps)
       
  1453 apply (case_tac "f \<in> same_inode_files s a", rule disjI1)
       
  1454 apply (simp add:co2sobj_closefd split:if_splits option.splits t_sobject.splits)
       
  1455 apply (simp add:co2sobj.simps cf2sfiles_prop same_inodes_tainted)
       
  1456 apply (erule bexE, erule conjE, erule_tac x = "f''" in ballE, simp, simp)
       
  1457 apply (rule disjI2, rule conjI, rule disjI2, rule conjI, rule_tac x = obj in exI)
       
  1458 apply (simp add:is_file_simps co2sobj_closefd)
       
  1459 apply (rule notI, simp add:co2sobj.simps)
       
  1460 apply (rule notI, simp add:co2sobj_closefd)
       
  1461 apply (erule_tac x = f in allE, simp add:is_file_simps co2sobj.simps)
       
  1462 apply (rule disjI2, rule conjI, rule disjI2, rule conjI, rule_tac x = obj in exI)
       
  1463 apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
       
  1464 apply (rule notI, simp add:co2sobj.simps split:option.splits)+
       
  1465 apply (rule disjI2, rule conjI, rule disjI2, rule conjI, rule_tac x = obj in exI)
       
  1466 apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
       
  1467 apply (rule notI, simp add:co2sobj.simps split:option.splits)+
       
  1468 
       
  1469 apply (simp add:update_s2ss_sfile_del_def update_s2ss_obj_def split:if_splits)
       
  1470 apply (erule conjE, erule disjE)
       
  1471 apply (rule_tac x = "O_proc p" in exI, simp add:co2sobj.simps)
       
  1472 apply (erule exE, erule conjE)
       
  1473 apply (case_tac "obj = O_file a", simp add:co2sobj.simps)
       
  1474 apply (case_tac "obj = O_proc p")
       
  1475 apply (rule_tac x = obj' in exI, frule_tac obj = obj' in co2sobj_sproc_imp, erule exE)
       
  1476 apply (frule_tac obj = obj' in alive_co2sobj_closefd3, simp+)
       
  1477 apply (simp add:co2sobj_closefd)
       
  1478 apply (simp add:co2sobj.simps)
       
  1479 apply (frule_tac obj = obj in alive_co2sobj_closefd3, simp+)
       
  1480 apply (rule_tac x = obj in exI, simp add:co2sobj_closefd)
       
  1481 apply (auto simp add:co2sobj.simps split:t_object.splits if_splits)[1]
       
  1482 apply (erule conjE|erule exE|erule disjE)+
       
  1483 apply (rule_tac x = "O_proc p" in exI, simp add:co2sobj.simps)
       
  1484 apply (erule conjE, erule exE, erule conjE)
       
  1485 apply (case_tac "obj = O_file a", simp add:co2sobj.simps)
       
  1486 apply (case_tac "obj = O_proc p")
       
  1487 apply (simp add:co2sobj.simps)
       
  1488 apply (frule_tac obj = obj in alive_co2sobj_closefd3, simp+)
       
  1489 apply (rule_tac x = obj in exI, simp add:co2sobj_closefd)
       
  1490 apply (auto simp add:co2sobj.simps split:t_object.splits if_splits)[1]
       
  1491 apply (erule conjE|erule exE|erule disjE)+
       
  1492 apply (drule same_inode_files_prop10, simp add:file_of_pfd_is_file, erule exE, erule conjE)
       
  1493 apply (rule_tac x = "O_file f'" in exI)
       
  1494 apply (frule same_inode_files_prop11)
       
  1495 apply (frule_tac obj = "O_file f'" in co2sobj_closefd)
       
  1496 apply (simp add:alive_simps)+
       
  1497 apply (frule_tac f = "f'" in is_file_has_sfile', simp, erule exE)
       
  1498 apply (simp add:co2sobj.simps cf2sfiles_prop same_inodes_tainted split:if_splits)
       
  1499 apply (rule impI, erule bexE, erule conjE, erule_tac x = f'' in ballE, simp, simp)
       
  1500 apply (erule bexE, erule conjE, erule_tac x = f'' in ballE, simp, simp)
       
  1501 apply (erule conjE, erule disjE)
       
  1502 apply (rule_tac x = "O_proc p" in exI)
       
  1503 apply (simp add:co2sobj.simps)
       
  1504 apply (erule exE, erule conjE)
       
  1505 apply (case_tac "obj = O_proc p")
       
  1506 apply (rule_tac x = "obj'" in exI, simp, frule_tac obj = obj' in co2sobj_sproc_imp, erule exE)
       
  1507 apply (frule_tac obj = obj' in alive_co2sobj_closefd3, simp+)
       
  1508 apply (simp add:co2sobj_closefd)
       
  1509 apply (simp add:co2sobj.simps)
       
  1510 apply (case_tac "obj = O_file a", simp add:co2sobj.simps)
       
  1511 apply (frule_tac obj = obj in alive_co2sobj_closefd3, simp+)
       
  1512 apply (erule_tac obj = obj in co2sobj_some_caseD)
       
  1513 apply (rule_tac x = obj in exI)
       
  1514 apply (simp add:co2sobj_closefd)
       
  1515 apply (case_tac "f = a", simp add:alive_simps)
       
  1516 apply (case_tac "f \<in> same_inode_files s a")
       
  1517 apply (simp add:co2sobj.simps cf2sfiles_prop same_inodes_tainted)
       
  1518 apply (rule_tac x = obj in exI, simp add:co2sobj_closefd)
       
  1519 apply (rule_tac x = obj in exI, simp add:co2sobj_closefd)
       
  1520 apply (rule_tac x = obj in exI, simp add:co2sobj_closefd)
       
  1521 apply (erule disjE)
       
  1522 apply (drule same_inode_files_prop10, simp add:file_of_pfd_is_file, erule exE, erule conjE)
       
  1523 apply (rule_tac x = "O_file f'" in exI)
       
  1524 apply (frule same_inode_files_prop11)
       
  1525 apply (frule_tac obj = "O_file f'" in co2sobj_closefd)
       
  1526 apply (simp add:alive_simps)+
       
  1527 apply (frule_tac f = "f'" in is_file_has_sfile', simp, erule exE)
       
  1528 apply (simp add:co2sobj.simps cf2sfiles_prop same_inodes_tainted split:if_splits)
       
  1529 apply (rule impI, erule bexE, erule conjE, erule_tac x = f'' in ballE, simp, simp)
       
  1530 apply (erule bexE, erule conjE, erule_tac x = f'' in ballE, simp, simp)
       
  1531 apply (erule conjE, erule disjE)
       
  1532 apply (rule_tac x = "O_proc p" in exI)
       
  1533 apply (simp add:co2sobj.simps)
       
  1534 apply (erule conjE, erule exE, erule conjE)
       
  1535 apply (case_tac "obj = O_proc p", simp add:co2sobj.simps)
       
  1536 apply (case_tac "obj = O_file a", simp add:co2sobj.simps)
       
  1537 apply (erule_tac obj = obj in co2sobj_some_caseD)
       
  1538 apply (rule_tac x = obj in exI)
       
  1539 apply (simp add:co2sobj_closefd)
       
  1540 apply (case_tac "f \<in> same_inode_files s a")
       
  1541 apply (simp add:co2sobj.simps cf2sfiles_prop same_inodes_tainted)
       
  1542 apply (rule_tac x = obj in exI, simp add:co2sobj_closefd is_file_simps)
       
  1543 apply (rule_tac x = obj in exI, simp add:co2sobj_closefd is_dir_simps)
       
  1544 apply (rule_tac x = obj in exI, simp add:co2sobj_closefd)
       
  1545 
       
  1546 apply (rule impI)
       
  1547 apply (simp add:update_s2ss_obj_def)
       
  1548 apply (rule conjI, rule impI, erule exE, erule conjE)
       
  1549 apply (simp add:s2ss_def)
       
  1550 apply (rule set_eqI, rule iffI, erule CollectE, erule exE, erule conjE)
       
  1551 apply (simp)
       
  1552 apply (case_tac "obj = O_proc p")
       
  1553 apply (simp add:co2sobj.simps split:if_splits)
       
  1554 apply (rule disjI2, rule_tac x = obj in exI, erule conjE)
       
  1555 apply (simp add:alive_co2sobj_closefd')
       
  1556 apply (frule_tac obj = obj in co2sobj_closefd, simp, simp split:t_object.splits if_splits)
       
  1557 apply (simp, erule disjE)
       
  1558 apply (rule_tac x = "O_proc p" in exI, simp add:co2sobj.simps)
       
  1559 apply (erule exE, erule conjE)
       
  1560 apply (case_tac "obj = O_proc p")
       
  1561 apply (rule_tac x = obj' in exI, simp add:alive_co2sobj_closefd1)
       
  1562 apply (frule_tac obj = obj' in co2sobj_closefd, simp add:alive_co2sobj_closefd1)
       
  1563 apply (clarsimp split:t_object.splits if_splits option.splits simp:co2sobj.simps)
       
  1564 apply (rule_tac x = obj in exI, simp add:alive_co2sobj_closefd1)
       
  1565 apply (frule_tac obj = obj in co2sobj_closefd, simp add:alive_co2sobj_closefd1)
       
  1566 apply (clarsimp split:t_object.splits if_splits option.splits simp: co2sobj.simps)
       
  1567 apply (rule impI)
       
  1568 apply (simp add:s2ss_def)
       
  1569 apply (rule set_eqI, rule iffI, erule CollectE, erule exE, erule conjE)
       
  1570 apply (simp)
       
  1571 apply (case_tac "obj = O_proc p")
       
  1572 apply (rule disjI1, simp add:co2sobj.simps split:if_splits)
       
  1573 apply (rule disjI2, rule conjI, rule_tac x = obj in exI, simp add:alive_co2sobj_closefd')
       
  1574 apply (frule_tac obj = obj in co2sobj_closefd, simp add:alive_co2sobj_closefd1)
       
  1575 apply (clarsimp split:t_object.splits if_splits option.splits simp: co2sobj.simps)
       
  1576 apply (rule notI, erule_tac x = obj in allE, simp add:alive_co2sobj_closefd')
       
  1577 apply (frule_tac obj = obj in co2sobj_closefd, simp add:alive_co2sobj_closefd1)
       
  1578 apply (clarsimp split:t_object.splits if_splits option.splits)
       
  1579 apply (simp)
       
  1580 apply (erule disjE)
       
  1581 apply (rule_tac x = "O_proc p" in exI, simp add:co2sobj.simps)
       
  1582 apply (erule exE|erule conjE)+
       
  1583 apply (rule_tac x = obj in exI)
       
  1584 apply (frule_tac obj = obj in co2sobj_closefd, simp add:alive_co2sobj_closefd1)
       
  1585 apply (clarsimp split:t_object.splits if_splits option.splits 
       
  1586                 simp: co2sobj.simps alive_co2sobj_closefd1)
       
  1587 done
       
  1588 
       
  1589 lemma alive_co2sobj_unlink:
       
  1590   "\<lbrakk>alive s obj; valid (UnLink p f # s); obj \<noteq> O_file f\<rbrakk>
       
  1591    \<Longrightarrow> alive (UnLink p f # s) obj"
       
  1592 by (auto simp add:alive_simps split:t_object.splits)
       
  1593 
       
  1594 lemma s2ss_unlink:
       
  1595   "valid (UnLink p f # s) \<Longrightarrow> s2ss (UnLink p f # s) = (
       
  1596      if (proc_fd_of_file s f = {}) 
       
  1597      then (case (cf2sfile s f) of 
       
  1598              Some sf \<Rightarrow> del_s2ss_file s (s2ss s) f sf
       
  1599            | _       \<Rightarrow> {})
       
  1600      else s2ss s)"
       
  1601 apply (frule vd_cons, frule vt_grant_os, clarsimp split:if_splits)
       
  1602 apply (frule is_file_has_sfile', simp, erule exE, simp)
       
  1603 apply (rule conjI, rule impI)
       
  1604 apply (simp add:update_s2ss_sfile_del_def del_s2ss_file_def)
       
  1605 apply (rule impI|erule conjE|erule exE|rule conjI|erule bexE)+ defer
       
  1606 apply (rule impI|erule conjE|erule exE|rule conjI|erule bexE)+ 
       
  1607 
       
  1608 apply (simp add:s2ss_def)
       
  1609 apply (tactic {*my_seteq_tac 1*})
       
  1610 apply (case_tac "obj = O_file f", simp add:is_file_simps)
       
  1611 apply simp
       
  1612 apply (rule conjI)
       
  1613 apply (rule_tac x = obj in exI,simp add:co2sobj_unlink is_file_simps is_dir_simps split:t_object.splits)
       
  1614 apply (simp add:co2sobj.simps)
       
  1615 apply (simp add:co2sobj.simps)
       
  1616 apply (rule notI, simp, frule_tac obj = obj in co2sobj_sfile_imp, erule exE, simp)
       
  1617 apply (frule_tac obj = obj in co2sobj_unlink, simp)
       
  1618 apply (erule_tac x = fa in allE, simp add:is_file_simps)
       
  1619 apply (simp add:co2sobj.simps)
       
  1620 apply (tactic {*my_setiff_tac 1*})
       
  1621 apply (case_tac "obj = O_file f", simp add:co2sobj.simps)
       
  1622 apply (frule_tac alive_co2sobj_unlink, simp, simp)
       
  1623 apply (frule_tac obj = obj in co2sobj_unlink, simp)
       
  1624 apply (rule_tac x = obj in exI)
       
  1625 apply (simp add:co2sobj.simps split:t_object.splits if_splits)
       
  1626 
       
  1627 apply (rule impI|erule conjE|erule exE|rule conjI|erule bexE)+  defer
       
  1628 
       
  1629 apply (rule impI|erule conjE|erule exE|rule conjI|erule bexE)+ 
       
  1630 apply (simp add:s2ss_def)
       
  1631 apply (tactic {*my_seteq_tac 1*})
       
  1632 apply (case_tac "obj = O_file f", simp add:alive_simps)
       
  1633 apply (erule_tac obj = obj in co2sobj_some_caseD)
       
  1634 apply (rule disjI2, simp, rule_tac x = obj in exI)
       
  1635 apply (simp add:co2sobj_unlink)
       
  1636 apply (case_tac "fa \<in> same_inode_files s f")
       
  1637 apply (rule disjI1)
       
  1638 apply (simp add:co2sobj_unlink)
       
  1639 apply (simp add:co2sobj.simps same_inodes_tainted cf2sfiles_prop split:if_splits)
       
  1640 apply (erule bexE, erule_tac x = f'' in ballE, simp, simp)
       
  1641 apply (rule disjI2, simp, rule_tac x = obj in exI)
       
  1642 apply (simp add:co2sobj_unlink is_file_simps)
       
  1643 apply (rule disjI2, simp, rule_tac x = obj in exI, simp add:co2sobj_unlink is_dir_simps)
       
  1644 apply (rule disjI2, simp, rule_tac x = obj in exI, simp add:co2sobj_unlink)
       
  1645 apply (tactic {*my_setiff_tac 1*})
       
  1646 apply (drule same_inode_files_prop10, simp, erule exE, erule conjE)
       
  1647 apply (rule_tac x = "O_file f'a" in exI, simp add:is_file_simps)
       
  1648 apply (frule_tac obj = "O_file f'a" in co2sobj_unlink, simp add:same_inode_files_prop11 is_file_simps)
       
  1649 apply (simp add:co2sobj.simps same_inodes_tainted cf2sfiles_prop 
       
  1650   is_file_simps same_inode_files_prop11 split:if_splits)
       
  1651 apply (rule impI, erule bexE, erule_tac x = f'' in ballE, simp, simp)
       
  1652 apply (erule bexE, erule_tac x = f'' in ballE, simp, simp)
       
  1653 
       
  1654 apply (tactic {*my_setiff_tac 1*})
       
  1655 apply (case_tac "f' = f", simp add:same_inode_files_prop9) 
       
  1656 apply (case_tac "obj= O_file f")
       
  1657 apply (rule_tac x = "O_file f'" in exI, simp add:is_file_simps)
       
  1658 apply (frule_tac f' = f' in cf2sfiles_unlink, simp add:current_files_simps is_file_in_current)
       
  1659 apply (simp add:co2sobj.simps)
       
  1660 apply (erule_tac obj = obj in co2sobj_some_caseD)
       
  1661 apply (rule_tac x = obj in exI, simp add:co2sobj_unlink)
       
  1662 apply (case_tac "fa \<in> same_inode_files s f")
       
  1663 apply (rule_tac x = "O_file f'" in exI)
       
  1664 apply (frule_tac f' = f' in cf2sfiles_unlink, simp add:current_files_simps is_file_in_current)
       
  1665 apply (simp add:co2sobj.simps is_file_simps cf2sfiles_prop same_inodes_tainted)
       
  1666 apply (rule_tac x = obj in exI, simp add:co2sobj_unlink is_file_simps)
       
  1667 apply (rule_tac x = obj in exI, simp add:co2sobj_unlink is_dir_simps)
       
  1668 apply (rule_tac x = obj in exI, simp add:co2sobj_unlink)
       
  1669 
       
  1670 apply (rule impI|erule conjE|erule exE|rule conjI|erule bexE)+  defer
       
  1671 
       
  1672 apply (rule impI|erule conjE|erule exE|rule conjI|erule bexE)+ 
       
  1673 apply (simp add:s2ss_def)
       
  1674 apply (tactic {*my_seteq_tac 1*})
       
  1675 apply (case_tac "obj = O_file f", simp add:alive_simps, simp)
       
  1676 apply (erule_tac obj = obj in co2sobj_some_caseD)
       
  1677 apply (rule disjI2, rule conjI, simp, rule_tac x = obj in exI)
       
  1678 apply (simp add:co2sobj_unlink)
       
  1679 apply (rule notI, simp add:co2sobj.simps split:option.splits)
       
  1680 apply (case_tac "fa \<in> same_inode_files s f")
       
  1681 apply (rule disjI1)
       
  1682 apply (simp add:co2sobj_unlink)
       
  1683 apply (simp add:co2sobj.simps same_inodes_tainted cf2sfiles_prop split:if_splits)
       
  1684 apply (erule bexE, erule_tac x = f'' in ballE, simp, simp)
       
  1685 apply (rule disjI2, rule conjI, simp, rule_tac x = obj in exI)
       
  1686 apply (simp add:co2sobj_unlink is_file_simps)
       
  1687 apply (rule notI, simp add:co2sobj_unlink)
       
  1688 apply (erule_tac x = fa in allE, simp add:co2sobj.simps is_file_simps)
       
  1689 apply (rule disjI2, rule conjI, simp, rule_tac x = obj in exI, simp add:co2sobj_unlink is_dir_simps)
       
  1690 apply (rule notI, simp add:co2sobj.simps split:option.splits)
       
  1691 apply (rule disjI2, rule conjI, simp, rule_tac x = obj in exI, simp add:co2sobj_unlink)
       
  1692 apply (rule notI, simp add:co2sobj.simps split:option.splits)
       
  1693 apply (tactic {*my_setiff_tac 1*})
       
  1694 apply (drule same_inode_files_prop10, simp, erule exE, erule conjE)
       
  1695 apply (rule_tac x = "O_file f'" in exI, simp add:is_file_simps)
       
  1696 apply (frule_tac obj = "O_file f'" in co2sobj_unlink, simp add:same_inode_files_prop11 is_file_simps)
       
  1697 apply (simp add:co2sobj.simps same_inodes_tainted cf2sfiles_prop 
       
  1698   is_file_simps same_inode_files_prop11 split:if_splits)
       
  1699 apply (rule impI, erule bexE, erule_tac x = f'' in ballE, simp, simp)
       
  1700 apply (erule bexE, erule_tac x = f'' in ballE, simp, simp)
       
  1701 apply (tactic {*my_setiff_tac 1*}, simp)
       
  1702 apply (case_tac "obj = O_file f", simp add:co2sobj.simps)
       
  1703 apply (erule_tac obj = obj in co2sobj_some_caseD)
       
  1704 apply (rule_tac x = obj in exI, simp add:co2sobj_unlink)
       
  1705 apply (case_tac "fa \<in> same_inode_files s f")
       
  1706 apply (simp add:co2sobj.simps cf2sfiles_prop same_inodes_tainted)
       
  1707 apply (rule_tac x = obj in exI, simp add:co2sobj_unlink is_file_simps)
       
  1708 apply (rule_tac x = obj in exI, simp add:co2sobj_unlink is_dir_simps)
       
  1709 apply (rule_tac x = obj in exI, simp add:co2sobj_unlink)
       
  1710 
       
  1711 apply (rule impI)
       
  1712 apply (simp add:s2ss_def)
       
  1713 apply (tactic {*my_seteq_tac 1*})
       
  1714 apply (rule_tac x = obj in exI)
       
  1715 apply (simp add:co2sobj_unlink is_file_simps is_dir_simps split:t_object.splits)
       
  1716 apply (simp add:co2sobj.simps)
       
  1717 apply (simp add:co2sobj.simps)
       
  1718 apply (tactic {*my_setiff_tac 1*})
       
  1719 apply (rule_tac x = obj in exI)
       
  1720 apply (subgoal_tac "alive (UnLink p f # s) obj")
       
  1721 apply (auto simp add:co2sobj_unlink is_file_simps is_dir_simps split:t_object.splits)[1]
       
  1722 apply (auto simp add:co2sobj_unlink alive_simps split:t_object.splits)[1]
       
  1723 
       
  1724 apply (simp add:s2ss_def)
       
  1725 apply (tactic {*my_seteq_tac 1*})
       
  1726 apply (case_tac "obj = O_file f", simp add:alive_simps)
       
  1727 apply (rule_tac x = obj in exI, simp add:co2sobj_unlink is_file_simps is_dir_simps split:t_object.splits)
       
  1728 apply (simp add:co2sobj.simps)
       
  1729 apply (simp add:co2sobj.simps)
       
  1730 apply (tactic {*my_setiff_tac 1*})
       
  1731 apply (case_tac "obj = O_file f")
       
  1732 apply (rule_tac x = "O_file f'" in exI)
       
  1733 apply (auto simp add:co2sobj_unlink is_file_simps is_dir_simps split:t_object.splits)[1]
       
  1734 apply (rule_tac x =obj in exI)
       
  1735 apply (subgoal_tac "alive (UnLink p f # s) obj")
       
  1736 apply (auto simp add:co2sobj_unlink is_file_simps is_dir_simps split:t_object.splits)[1]
       
  1737 apply (auto simp add:co2sobj_unlink alive_simps split:t_object.splits)[1]
       
  1738 
       
  1739 apply (simp add:s2ss_def)
       
  1740 apply (tactic {*my_seteq_tac 1*})
       
  1741 apply (case_tac "obj = O_file f", simp add:alive_simps)
       
  1742 apply (rule_tac x = obj in exI, simp add:co2sobj_unlink is_file_simps is_dir_simps split:t_object.splits if_splits)
       
  1743 apply (simp add:co2sobj.simps)
       
  1744 apply (simp add:co2sobj.simps)
       
  1745 apply (tactic {*my_setiff_tac 1*})
       
  1746 apply (case_tac "obj = O_file f")
       
  1747 apply (rule_tac x = "O_file f'" in exI)
       
  1748 apply (auto simp add:co2sobj_unlink is_file_simps is_dir_simps same_inode_files_prop9 split:t_object.splits)[1]
       
  1749 apply (erule_tac obj = obj in co2sobj_some_caseD)
       
  1750 apply (rule_tac x = obj in exI, simp add:co2sobj_unlink)
       
  1751 apply (case_tac "fa \<in> same_inode_files s f")
       
  1752 apply (rule_tac x = "O_file f'" in exI)
       
  1753 apply (simp add:alive_simps co2sobj.simps)
       
  1754 apply (rule conjI, rule notI, simp add:same_inode_files_prop9)
       
  1755 apply (rule impI, frule_tac f' = f' in cf2sfiles_unlink)
       
  1756 apply (simp add:current_files_simps is_file_simps is_file_in_current)
       
  1757 apply (simp add:same_inodes_tainted cf2sfiles_prop)
       
  1758 apply (rule_tac x = obj in exI, simp add:co2sobj_unlink is_file_simps)
       
  1759 apply (rule_tac x = obj in exI, simp add:co2sobj_unlink is_dir_simps)
       
  1760 apply (rule_tac x = obj in exI, simp add:co2sobj_unlink)
       
  1761 
       
  1762 apply (simp add:s2ss_def)
       
  1763 apply (tactic {*my_seteq_tac 1*})
       
  1764 apply (case_tac "obj = O_file f", simp add:alive_simps)
       
  1765 apply (rule_tac x = obj in exI, simp add:co2sobj_unlink is_file_simps is_dir_simps split:t_object.splits if_splits)
       
  1766 apply (simp add:co2sobj.simps)
       
  1767 apply (simp add:co2sobj.simps)
       
  1768 apply (tactic {*my_setiff_tac 1*})
       
  1769 apply (case_tac "obj = O_file f")
       
  1770 apply (rule_tac x = "O_file f'" in exI)
       
  1771 apply (subgoal_tac "alive (UnLink p f # s) (O_file f')")
       
  1772 apply (frule same_inode_files_prop11, frule_tac f = f' in is_file_has_sfile', simp add:vd_cons, erule exE)
       
  1773 apply (frule_tac obj = "O_file f'" in co2sobj_unlink, simp)
       
  1774 apply (simp split:if_splits option.splits add:is_file_simps)
       
  1775 apply (simp add:co2sobj.simps cf2sfiles_prop same_inodes_tainted)
       
  1776 apply (auto split:t_sobject.splits)[1]
       
  1777 apply (simp add:is_file_simps same_inode_files_prop11)
       
  1778 apply (erule_tac obj = obj in co2sobj_some_caseD)
       
  1779 apply (rule_tac x = obj in exI, simp add:co2sobj_unlink)
       
  1780 apply (case_tac "fa \<in> same_inode_files s f")
       
  1781 apply (rule_tac x = "O_file f'" in exI)
       
  1782 apply (subgoal_tac "alive (UnLink p f # s) (O_file f')")
       
  1783 apply (frule same_inode_files_prop11, frule_tac f = f' in is_file_has_sfile', simp add:vd_cons, erule exE)
       
  1784 apply (frule_tac obj = "O_file f'" in co2sobj_unlink, simp)
       
  1785 apply (simp split:if_splits option.splits add:is_file_simps)
       
  1786 apply (simp add:co2sobj.simps cf2sfiles_prop same_inodes_tainted)
       
  1787 apply (auto split:t_sobject.splits)[1]
       
  1788 apply (simp add:is_file_simps same_inode_files_prop11)
       
  1789 apply (rule_tac x = obj in exI, simp add:co2sobj_unlink is_file_simps)
       
  1790 apply (rule_tac x = obj in exI, simp add:co2sobj_unlink is_dir_simps)
       
  1791 apply (rule_tac x = obj in exI, simp add:co2sobj_unlink)
       
  1792 done
       
  1793 
       
  1794 lemma s2ss_rmdir: "valid (Rmdir p f # s) \<Longrightarrow> s2ss (Rmdir p f # s) = (
       
  1795   case (co2sobj s (O_dir f)) of
       
  1796     Some sdir \<Rightarrow> del_s2ss_obj s (s2ss s) (O_dir f) sdir
       
  1797   | _         \<Rightarrow> {})"
       
  1798 apply (frule vd_cons, frule vt_grant_os)
       
  1799 apply (clarsimp simp:dir_is_empty_def)
       
  1800 apply (frule is_dir_has_sdir', simp, erule exE)
       
  1801 apply (simp split:option.splits, rule conjI, rule impI, simp add:co2sobj.simps)
       
  1802 apply (rule allI, rule impI)
       
  1803 
       
  1804 apply (simp add:del_s2ss_obj_def)
       
  1805 apply (rule conjI|rule impI|erule exE|erule conjE)+
       
  1806 apply (simp add:s2ss_def)
       
  1807 apply (tactic {*my_seteq_tac 1*})
       
  1808 apply (rule_tac x = obj in exI)
       
  1809 apply (simp add:co2sobj_rmdir is_file_simps is_dir_simps alive_simps split:t_object.splits if_splits)
       
  1810 apply (tactic {*my_setiff_tac 1*})
       
  1811 apply (case_tac "obj = O_dir f")
       
  1812 apply (rule_tac x = obj' in exI)
       
  1813 apply (subgoal_tac "alive (Rmdir p f # s) obj'")
       
  1814 apply (auto simp add:co2sobj_rmdir is_file_simps is_dir_simps split:t_object.splits)[1]
       
  1815 apply (simp add:alive_rmdir)
       
  1816 apply (rule_tac x = obj in exI)
       
  1817 apply (subgoal_tac "alive (Rmdir p f # s) obj")
       
  1818 apply (auto simp add:co2sobj_rmdir is_file_simps is_dir_simps split:t_object.splits)[1]
       
  1819 apply (simp add:alive_rmdir)
       
  1820 
       
  1821 apply (rule conjI|rule impI|erule exE|erule conjE)+
       
  1822 apply (simp add:s2ss_def)
       
  1823 apply (tactic {*my_seteq_tac 1*})
       
  1824 apply simp
       
  1825 apply (case_tac "obj = O_dir f", simp add:alive_rmdir)
       
  1826 apply (rule conjI)
       
  1827 apply (rule_tac x = obj in exI, simp add:co2sobj_rmdir alive_rmdir)
       
  1828 apply (simp add:co2sobj_rmdir)
       
  1829 apply (simp add:alive_rmdir, erule_tac x = obj in allE, simp)
       
  1830 apply (tactic {*my_setiff_tac 1*}, simp)
       
  1831 apply (case_tac "obj = O_dir f", simp)
       
  1832 apply (rule_tac x = obj in exI, simp add:co2sobj_rmdir alive_rmdir)
       
  1833 done
       
  1834 
       
  1835 lemma s2ss_mkdir: "valid (Mkdir p f inum # s) \<Longrightarrow> s2ss (Mkdir p f inum # s) = (
       
  1836   case (cf2sfile (Mkdir p f inum # s) f) of
       
  1837     Some sf \<Rightarrow> (s2ss s) \<union> {S_dir sf}
       
  1838   | _       \<Rightarrow> {})"
       
  1839 apply (frule vt_grant_os, frule vd_cons, clarsimp)
       
  1840 apply (case_tac "cf2sfile (Mkdir p f inum # s) f")
       
  1841 apply (drule current_file_has_sfile', simp, simp add:current_files_simps, simp)
       
  1842 
       
  1843 apply (simp add:s2ss_def)
       
  1844 apply (tactic {*my_seteq_tac 1*}, simp)
       
  1845 apply (case_tac "obj = O_dir f")
       
  1846 apply (rule disjI1, simp add:co2sobj.simps)
       
  1847 apply (rule disjI2, rule_tac x = obj in exI, simp add:co2sobj_mkdir alive_simps)
       
  1848 apply (tactic {*my_setiff_tac 1*}, simp)
       
  1849 apply (rule_tac x = "O_dir f" in exI, simp add:alive_mkdir co2sobj.simps)
       
  1850 apply (tactic {*my_setiff_tac 1*})
       
  1851 apply (case_tac "obj = O_dir f", simp add:is_dir_in_current)
       
  1852 apply (rule_tac x = obj in exI, simp add:co2sobj_mkdir alive_mkdir)
       
  1853 done
       
  1854 
       
  1855 definition update_s2ss_sfile_add :: "t_state \<Rightarrow> t_static_state \<Rightarrow> t_file \<Rightarrow> t_sfile \<Rightarrow> t_static_state"
       
  1856 where
       
  1857  "update_s2ss_sfile_add s ss f sf \<equiv>
       
  1858     if (\<exists> f'. is_file s f' \<and> f' \<notin> same_inode_files s f \<and> co2sobj s (O_file f') = co2sobj s (O_file f))
       
  1859        then ss \<union> {S_file (cf2sfiles s f \<union> {sf}) (O_file f \<in> tainted s)}
       
  1860        else ss - {S_file (cf2sfiles s f) (O_file f \<in> tainted s)} 
       
  1861                \<union> {S_file (cf2sfiles s f \<union> {sf}) (O_file f \<in> tainted s)}"
       
  1862 
       
  1863 lemma s2ss_linkhard: "valid (LinkHard p f f' # s) \<Longrightarrow> s2ss (LinkHard p f f' # s) = (
       
  1864   case (cf2sfile (LinkHard p f f' # s) f') of
       
  1865     Some sf \<Rightarrow> update_s2ss_sfile_add s (s2ss s) f sf
       
  1866   | _       \<Rightarrow> {})"
       
  1867 apply (frule vt_grant_os, frule vd_cons, clarsimp)
       
  1868 apply (split option.splits)
       
  1869 apply (rule conjI, rule impI, drule current_file_has_sfile', simp, simp add:current_files_simps)
       
  1870 apply (rule allI, rule impI)
       
  1871 
       
  1872 apply (simp add:update_s2ss_sfile_add_def)
       
  1873 apply (rule conjI, rule impI, erule exE, erule conjE, erule conjE)
       
  1874 apply (simp add:s2ss_def)
       
  1875 apply (tactic {*my_seteq_tac 1*})
       
  1876 apply (case_tac "obj = O_file f'")
       
  1877 apply (rule disjI1, simp add:co2sobj.simps cf2sfiles_linkhard
       
  1878   same_inode_files_linkhard split:if_splits)
       
  1879 apply (case_tac "O_file f' \<in> tainted s")
       
  1880 apply (drule tainted_in_current, simp, simp add:is_file_in_current alive.simps, simp)
       
  1881 apply (erule_tac obj = obj in co2sobj_some_caseD)
       
  1882 apply (rule disjI2, simp, rule_tac x = obj in exI)
       
  1883 apply (simp add:co2sobj_linkhard alive_linkhard)
       
  1884 apply (case_tac "fa \<in> same_inode_files s f")
       
  1885 apply (rule disjI1, simp add:co2sobj.simps cf2sfiles_linkhard 
       
  1886   same_inodes_tainted split:if_splits)
       
  1887 apply (rule disjI2, simp, rule_tac x = obj in exI, simp add:co2sobj_linkhard is_file_simps)
       
  1888 apply (rule disjI2, simp, rule_tac x = obj in exI, simp add:co2sobj_linkhard is_dir_simps)
       
  1889 apply (rule disjI2, simp, rule_tac x = obj in exI, simp add:co2sobj_linkhard)
       
  1890 apply (tactic {*my_setiff_tac 1*})
       
  1891 apply (rule_tac x = "O_file f" in exI)
       
  1892 apply (frule_tac obj = "O_file f" in co2sobj_linkhard)
       
  1893 apply (simp add:alive_linkhard)
       
  1894 apply (simp add:alive_linkhard same_inode_files_prop9 split:t_object.splits)
       
  1895 apply (tactic {*my_setiff_tac 1*})
       
  1896 apply (case_tac "obj = O_file f'", simp add:alive_linkhard is_file_in_current)
       
  1897 apply (erule_tac obj = obj in co2sobj_some_caseD)
       
  1898 apply (rule_tac x = obj in exI, simp add:co2sobj_linkhard alive_linkhard)
       
  1899 apply (case_tac "fa \<in> same_inode_files s f")
       
  1900 apply (rule_tac x = "O_file f'a" in exI, simp add:co2sobj_linkhard alive_linkhard)
       
  1901 apply (rule conjI, rule impI, simp add:is_file_in_current)
       
  1902 apply (rule impI, simp add:co2sobj.simps cf2sfiles_prop same_inodes_tainted)
       
  1903 apply (rule_tac x = obj in exI, simp add:co2sobj_linkhard alive_linkhard)
       
  1904 apply (rule_tac x = obj in exI, simp add:co2sobj_linkhard alive_linkhard)
       
  1905 apply (rule_tac x = obj in exI, simp add:co2sobj_linkhard alive_linkhard)
       
  1906 
       
  1907 apply (rule impI)
       
  1908 apply (simp add:s2ss_def)
       
  1909 apply (tactic {*my_seteq_tac 1*})
       
  1910 apply (case_tac "obj = O_file f'", simp)
       
  1911 apply (rule disjI1, simp add:co2sobj.simps cf2sfiles_linkhard
       
  1912   same_inode_files_linkhard split:if_splits)
       
  1913 apply (case_tac "O_file f' \<in> tainted s")
       
  1914 apply (drule tainted_in_current, simp, simp add:is_file_in_current alive.simps, simp)
       
  1915 apply (erule_tac obj = obj in co2sobj_some_caseD, simp)
       
  1916 apply (rule disjI2, rule conjI, rule_tac x = obj in exI)
       
  1917 apply (simp add:co2sobj_linkhard alive_linkhard)
       
  1918 apply (rule notI, simp add:co2sobj.simps split:option.splits)
       
  1919 apply (case_tac "fa \<in> same_inode_files s f")
       
  1920 apply (rule disjI1, simp add:co2sobj.simps cf2sfiles_linkhard 
       
  1921   same_inodes_tainted split:if_splits)
       
  1922 apply (simp, rule disjI2, rule conjI, rule_tac x = obj in exI, simp add:co2sobj_linkhard is_file_simps)
       
  1923 apply (erule_tac x = fa in allE, rule notI)
       
  1924 apply (simp add:co2sobj_linkhard is_file_simps)
       
  1925 apply (simp add:co2sobj.simps)
       
  1926 apply (rule disjI2, simp, rule conjI, rule_tac x = obj in exI, simp add:co2sobj_linkhard is_dir_simps)
       
  1927 apply (rule notI, simp add:co2sobj.simps split:option.splits)
       
  1928 apply (rule disjI2, simp, rule conjI, rule_tac x = obj in exI, simp add:co2sobj_linkhard)
       
  1929 apply (rule notI, simp add:co2sobj.simps split:option.splits)
       
  1930 apply (tactic {*my_setiff_tac 1*})
       
  1931 apply (rule_tac x = "O_file f" in exI)
       
  1932 apply (frule_tac obj = "O_file f" in co2sobj_linkhard)
       
  1933 apply (simp add:alive_linkhard)
       
  1934 apply (simp add:alive_linkhard same_inode_files_prop9 split:t_object.splits)
       
  1935 apply (tactic {*my_setiff_tac 1*})
       
  1936 apply (case_tac "obj = O_file f'", simp add:alive_linkhard is_file_in_current)
       
  1937 apply (erule_tac obj = obj in co2sobj_some_caseD)
       
  1938 apply (rule_tac x = obj in exI, simp add:co2sobj_linkhard alive_linkhard)
       
  1939 apply (case_tac "fa \<in> same_inode_files s f")
       
  1940 apply (simp add:co2sobj.simps cf2sfiles_prop same_inodes_tainted)
       
  1941 apply (rule_tac x = obj in exI, simp add:co2sobj_linkhard alive_linkhard)
       
  1942 apply (rule_tac x = obj in exI, simp add:co2sobj_linkhard alive_linkhard)
       
  1943 apply (rule_tac x = obj in exI, simp add:co2sobj_linkhard alive_linkhard)
       
  1944 done
       
  1945 
       
  1946 lemma same_inode_files_prop12:
       
  1947   "is_file s f \<Longrightarrow> f \<in> same_inode_files s f "
       
  1948 by (auto simp:is_file_def  same_inode_files_def split:option.splits)
       
  1949 
       
  1950 lemma s2ss_truncate: "valid (Truncate p f len # s) \<Longrightarrow> s2ss (Truncate p f len # s) = (
       
  1951   if (O_file f \<notin> tainted s \<and> O_proc p \<in> tainted s \<and> len > 0)
       
  1952   then update_s2ss_sfile_tainted s (s2ss s) f True
       
  1953   else s2ss s)"
       
  1954 apply (frule vt_grant_os, frule vd_cons, simp split:if_splits)
       
  1955 apply (rule conjI, rule impI, (erule conjE)+)
       
  1956 
       
  1957 apply (simp add:update_s2ss_sfile_tainted_def)
       
  1958 apply (rule conjI|rule impI|erule exE|erule conjE)+
       
  1959 apply (simp add:s2ss_def)
       
  1960 apply (tactic {*my_seteq_tac 1*})
       
  1961 apply (case_tac "obj = O_file f")
       
  1962 apply (rule disjI1, simp add:co2sobj.simps same_inode_files_prop12 cf2sfiles_other)
       
  1963 apply (erule_tac obj = obj in co2sobj_some_caseD)
       
  1964 apply (rule disjI2, simp, rule_tac x = obj in exI, simp add:co2sobj_truncate alive_simps)
       
  1965 apply (case_tac "fa \<in> same_inode_files s f")
       
  1966 apply (rule disjI1, simp add:co2sobj.simps cf2sfiles_prop cf2sfiles_other)
       
  1967 apply (rule disjI2, simp, rule_tac x = obj in exI)
       
  1968 apply (simp add:co2sobj_truncate is_file_simps)
       
  1969 apply (rule disjI2, simp, rule_tac x = obj in exI)
       
  1970 apply (simp add:co2sobj_truncate is_dir_simps)
       
  1971 apply (rule disjI2, simp, rule_tac x = obj in exI)
       
  1972 apply (simp add:co2sobj_truncate)
       
  1973 apply (tactic {*my_setiff_tac 1*})
       
  1974 apply (rule_tac x = "O_file f" in exI)
       
  1975 apply (simp add:co2sobj.simps is_file_simps cf2sfiles_other same_inode_files_prop12)
       
  1976 apply (tactic {*my_setiff_tac 1*})
       
  1977 apply (erule_tac obj = obj in co2sobj_some_caseD)
       
  1978 apply (rule_tac x = obj in exI, simp add:co2sobj_truncate)
       
  1979 apply (case_tac "fa \<in> same_inode_files s f")
       
  1980 apply (rule_tac x = "O_file f'" in exI)
       
  1981 apply (auto simp:co2sobj_truncate is_file_simps is_dir_simps split:t_object.splits)[1]
       
  1982 apply (simp add:co2sobj.simps same_inodes_tainted cf2sfiles_prop)
       
  1983 apply (rule_tac x = obj in exI, simp add:co2sobj_truncate is_file_simps)
       
  1984 apply (rule_tac x = obj in exI, simp add:co2sobj_truncate is_dir_simps)
       
  1985 apply (rule_tac x = obj in exI, simp add:co2sobj_truncate)
       
  1986 
       
  1987 apply (rule conjI|rule impI|erule exE|erule conjE)+
       
  1988 apply (simp add:s2ss_def)
       
  1989 apply (tactic {*my_seteq_tac 1*})
       
  1990 apply (case_tac "obj = O_file f")
       
  1991 apply (rule disjI1, simp add:co2sobj.simps same_inode_files_prop12 cf2sfiles_other)
       
  1992 apply (erule_tac obj = obj in co2sobj_some_caseD)
       
  1993 apply (rule disjI2, simp, rule conjI, rule_tac x = obj in exI, simp add:co2sobj_truncate alive_simps)
       
  1994 apply (rule notI, simp add:co2sobj.simps split:option.splits)
       
  1995 apply (case_tac "fa \<in> same_inode_files s f")
       
  1996 apply (rule disjI1, simp add:co2sobj.simps cf2sfiles_prop cf2sfiles_other)
       
  1997 apply (rule disjI2, simp, rule conjI, rule_tac x = obj in exI)
       
  1998 apply (simp add:co2sobj_truncate is_file_simps)
       
  1999 apply (rule notI, simp add:co2sobj_truncate is_file_simps)
       
  2000 apply (erule_tac x = fa in allE)
       
  2001 apply (simp add:co2sobj.simps)
       
  2002 apply (rule disjI2, simp, rule conjI, rule_tac x = obj in exI)
       
  2003 apply (simp add:co2sobj_truncate is_dir_simps)
       
  2004 apply (rule notI, simp add:co2sobj.simps split:option.splits)
       
  2005 apply (rule disjI2, simp, rule conjI, rule_tac x = obj in exI)
       
  2006 apply (simp add:co2sobj_truncate)
       
  2007 apply (rule notI, simp add:co2sobj.simps split:option.splits)
       
  2008 apply (tactic {*my_setiff_tac 1*})
       
  2009 apply (rule_tac x = "O_file f" in exI)
       
  2010 apply (simp add:co2sobj.simps is_file_simps cf2sfiles_other same_inode_files_prop12)
       
  2011 apply (tactic {*my_setiff_tac 1*})
       
  2012 apply (erule_tac obj = obj in co2sobj_some_caseD)
       
  2013 apply (rule_tac x = obj in exI, simp add:co2sobj_truncate)
       
  2014 apply (case_tac "fa \<in> same_inode_files s f")
       
  2015 apply (simp add:co2sobj.simps same_inodes_tainted cf2sfiles_prop)
       
  2016 apply (rule_tac x = obj in exI, simp add:co2sobj_truncate is_file_simps)
       
  2017 apply (rule_tac x = obj in exI, simp add:co2sobj_truncate is_dir_simps)
       
  2018 apply (rule_tac x = obj in exI, simp add:co2sobj_truncate)
       
  2019 
       
  2020 apply (rule impI, simp add:s2ss_def)
       
  2021 apply (tactic {*my_seteq_tac 1*})
       
  2022 apply (rule_tac x = obj in exI)
       
  2023 apply (simp add:alive_simps co2sobj_truncate)
       
  2024 apply (simp split:t_object.splits if_splits add:co2sobj.simps)
       
  2025 apply (case_tac "O_proc p \<in> tainted s", simp add:same_inodes_tainted)
       
  2026 apply simp
       
  2027 apply (tactic {*my_setiff_tac 1*})
       
  2028 apply (rule_tac x = obj in exI)
       
  2029 apply (simp add:alive_simps co2sobj_truncate)
       
  2030 apply (auto split:t_object.splits if_splits simp:co2sobj.simps same_inodes_tainted)
       
  2031 done
       
  2032 
       
  2033 lemma s2ss_createmsgq: "valid (CreateMsgq p q # s) \<Longrightarrow> s2ss (CreateMsgq p q # s) = 
       
  2034   (case (cq2smsgq (CreateMsgq p q # s) q) of 
       
  2035      Some sq \<Rightarrow> s2ss s \<union> {S_msgq sq}
       
  2036    | _       \<Rightarrow> {})"
       
  2037 apply (frule vd_cons, frule vt_grant_os, clarsimp)
       
  2038 apply (case_tac "cq2smsgq (CreateMsgq p q # s) q")
       
  2039 apply (drule current_has_smsgq', simp+)
       
  2040 apply (simp add:s2ss_def)
       
  2041 apply (tactic {*my_seteq_tac 1*})
       
  2042 apply (case_tac "obj = O_msgq q")
       
  2043 apply (rule disjI1, simp add:co2sobj.simps)
       
  2044 apply (rule disjI2, simp, rule_tac x = obj in exI)
       
  2045 apply (simp add:co2sobj_createmsgq is_file_simps is_dir_simps split:t_object.splits if_splits)
       
  2046 apply (simp add:co2sobj.simps)
       
  2047 apply (simp add:co2sobj.simps)
       
  2048 apply (tactic {*my_setiff_tac 1*})
       
  2049 apply (rule_tac x = "O_msgq q" in exI, simp add:co2sobj.simps)
       
  2050 apply (tactic {*my_setiff_tac 1*})
       
  2051 apply (case_tac "obj = O_msgq q")
       
  2052 apply simp
       
  2053 apply (rule_tac x = obj in exI)
       
  2054 apply (auto simp add:co2sobj_createmsgq alive_simps split:t_object.splits if_splits)
       
  2055 done
       
  2056 
       
  2057 lemma s2ss_sendmsg: "valid (SendMsg p q m # s) \<Longrightarrow> s2ss (SendMsg p q m # s) = (
       
  2058   case (cq2smsgq s q, cq2smsgq (SendMsg p q m # s) q) of
       
  2059     (Some sq, Some sq') \<Rightarrow> update_s2ss_obj s (s2ss s) (O_msgq q) (S_msgq sq) (S_msgq sq')
       
  2060   | _  \<Rightarrow> {})"
       
  2061 apply (frule vd_cons, frule vt_grant_os, clarsimp)
       
  2062 apply (case_tac "cq2smsgq s q")
       
  2063 apply (drule current_has_smsgq', simp+)
       
  2064 apply (case_tac "cq2smsgq (SendMsg p q m # s) q")
       
  2065 apply (drule current_has_smsgq', simp+)
       
  2066 
       
  2067 apply (simp add:update_s2ss_obj_def)
       
  2068 apply (tactic {*my_clarify_tac 1*})
       
  2069 apply (simp add:s2ss_def)
       
  2070 apply (tactic {*my_seteq_tac 1*})
       
  2071 apply (case_tac "obj = O_msgq q")
       
  2072 apply (rule disjI1, simp add:co2sobj.simps)
       
  2073 apply (rule disjI2, simp, rule_tac x = obj in exI)
       
  2074 apply (simp add:co2sobj_sendmsg is_file_simps is_dir_simps split:t_object.splits if_splits)
       
  2075 apply (simp add:co2sobj.simps)
       
  2076 apply (simp add:co2sobj.simps)
       
  2077 apply (simp add:co2sobj.simps)
       
  2078 apply (tactic {*my_setiff_tac 1*})
       
  2079 apply (rule_tac x = "O_msgq q" in exI, simp add:co2sobj.simps)
       
  2080 apply (tactic {*my_setiff_tac 1*})
       
  2081 apply (case_tac "obj = O_msgq q")
       
  2082 apply (rule_tac x = obj' in exI)
       
  2083 apply (simp add:co2sobj_sendmsg alive_sendmsg split:t_object.splits if_splits)
       
  2084 apply (auto simp:co2sobj.simps)[1]
       
  2085 apply (rule_tac x = obj in exI, simp add:co2sobj_sendmsg alive_sendmsg split:t_object.splits)
       
  2086 apply (auto simp:co2sobj.simps)[1]
       
  2087 
       
  2088 apply (rule impI)
       
  2089 apply (simp add:s2ss_def)
       
  2090 apply (tactic {*my_seteq_tac 1*})
       
  2091 apply (case_tac "obj = O_msgq q")
       
  2092 apply (rule disjI1, simp add:co2sobj.simps)
       
  2093 apply (rule disjI2, simp, rule conjI, rule_tac x = obj in exI)
       
  2094 apply (simp add:co2sobj_sendmsg is_file_simps is_dir_simps split:t_object.splits if_splits)
       
  2095 apply (simp add:co2sobj.simps)
       
  2096 apply (simp add:co2sobj.simps)
       
  2097 apply (simp add:co2sobj.simps)
       
  2098 apply (rule notI, simp)
       
  2099 apply (frule_tac obj = obj in co2sobj_smsgq_imp, erule exE, simp)
       
  2100 apply (erule_tac x = obj in allE, simp add:co2sobj_sendmsg)
       
  2101 apply (tactic {*my_setiff_tac 1*})
       
  2102 apply (rule_tac x = "O_msgq q" in exI, simp add:co2sobj.simps)
       
  2103 apply (tactic {*my_setiff_tac 1*})
       
  2104 apply (case_tac "obj = O_msgq q")
       
  2105 apply (simp add:co2sobj.simps)
       
  2106 apply (rule_tac x = obj in exI, simp add:co2sobj_sendmsg alive_sendmsg split:t_object.splits)
       
  2107 apply (auto simp:co2sobj.simps)[1]
       
  2108 done
       
  2109 
       
  2110 lemma alive_co2sobj_removemsgq:
       
  2111   "\<lbrakk>alive s obj; valid (RemoveMsgq p q # s); co2sobj s obj = Some sobj; obj \<noteq> O_msgq q\<rbrakk> 
       
  2112    \<Longrightarrow> alive (RemoveMsgq p q # s) obj"
       
  2113 apply (erule co2sobj_some_caseD)
       
  2114 apply (auto simp:is_file_simps is_dir_simps)
       
  2115 done
       
  2116 
       
  2117 lemma s2ss_removemsgq: "valid (RemoveMsgq p q # s) \<Longrightarrow> s2ss (RemoveMsgq p q # s) = 
       
  2118   (case (cq2smsgq s q) of
       
  2119      Some sq \<Rightarrow> del_s2ss_obj s (s2ss s) (O_msgq q) (S_msgq sq)
       
  2120    | _       \<Rightarrow> {})"
       
  2121 apply (frule vd_cons, frule vt_grant_os, clarsimp)
       
  2122 apply (split option.splits, rule conjI, rule impI)
       
  2123 apply (drule current_has_smsgq', simp, simp)
       
  2124 apply (rule allI, rule impI)
       
  2125 
       
  2126 apply (simp add:del_s2ss_obj_def)
       
  2127 apply (tactic {*my_clarify_tac 1*})
       
  2128 apply (simp add:s2ss_def)
       
  2129 apply (tactic {*my_seteq_tac 1*})
       
  2130 apply (case_tac "obj = O_msgq q", simp)
       
  2131 apply (rule_tac x = obj in exI)
       
  2132 apply (simp add:co2sobj_removemsgq alive_simps split:t_object.splits if_splits)
       
  2133 apply (tactic {*my_setiff_tac 1*})
       
  2134 apply (case_tac "obj = O_msgq q", simp)
       
  2135 apply (rule_tac x = obj' in exI)
       
  2136 apply (frule_tac obj = obj' in co2sobj_smsgq_imp, erule exE)
       
  2137 apply (simp add:co2sobj_removemsgq alive_simps split:t_object.splits if_splits)
       
  2138 apply (simp add:co2sobj.simps)
       
  2139 apply (rule_tac x = obj in exI)
       
  2140 apply (simp add:co2sobj_removemsgq alive_co2sobj_removemsgq)
       
  2141 
       
  2142 apply (rule impI)
       
  2143 apply (simp add:s2ss_def)
       
  2144 apply (tactic {*my_seteq_tac 1*})
       
  2145 apply (case_tac "obj = O_msgq q", simp)
       
  2146 apply (simp, rule conjI, rule_tac x = obj in exI)
       
  2147 apply (simp add:co2sobj_removemsgq alive_simps split:t_object.splits if_splits)
       
  2148 apply (rule notI, simp, frule_tac obj = obj in co2sobj_smsgq_imp, erule exE)
       
  2149 apply (erule_tac x = obj in allE, simp add:co2sobj_removemsgq alive_co2sobj_removemsgq)
       
  2150 apply (tactic {*my_setiff_tac 1*})
       
  2151 apply (case_tac "obj = O_msgq q", simp)
       
  2152 apply (simp add:co2sobj.simps)
       
  2153 apply (rule_tac x = obj in exI)
       
  2154 apply (simp add:co2sobj_removemsgq alive_co2sobj_removemsgq)
       
  2155 done
       
  2156 
       
  2157 declare Product_Type.split_paired_Ex Product_Type.split_paired_All [simp del]
       
  2158 
       
  2159 lemma s2ss_recvmsg: "valid (RecvMsg p q m # s) \<Longrightarrow> s2ss (RecvMsg p q m # s) = (
       
  2160   case (cq2smsgq s q, cq2smsgq (RecvMsg p q m # s) q, cp2sproc s p) of
       
  2161     (Some sq, Some sq', Some sp) \<Rightarrow> if (O_msg q m \<in> tainted s \<and> O_proc p \<notin> tainted s)
       
  2162                                     then update_s2ss_obj s (update_s2ss_obj s (s2ss s)
       
  2163                                                             (O_proc p) (S_proc sp False) (S_proc sp True))
       
  2164                                          (O_msgq q) (S_msgq sq) (S_msgq sq')
       
  2165                                     else update_s2ss_obj s (s2ss s) (O_msgq q) (S_msgq sq) (S_msgq sq')
       
  2166   | _ \<Rightarrow> {})"
       
  2167 apply (frule vt_grant_os, frule vd_cons)
       
  2168 apply (case_tac "cq2smsgq s q")
       
  2169 apply (drule current_has_smsgq', simp, simp)
       
  2170 apply (case_tac "cq2smsgq (RecvMsg p q m # s) q")
       
  2171 apply (drule current_has_smsgq', simp, simp)
       
  2172 apply (case_tac "cp2sproc s p")
       
  2173 apply (drule current_proc_has_sp', simp, simp+)
       
  2174 
       
  2175 apply (tactic {*my_clarify_tac 1*})
       
  2176 apply (simp add:update_s2ss_obj_def)
       
  2177 
       
  2178 apply (tactic {*my_clarify_tac 1*})
       
  2179 apply (simp add:s2ss_def)
       
  2180 apply (tactic {*my_seteq_tac 1*})
       
  2181 apply (case_tac "obj = O_msgq q")
       
  2182 apply (rule disjI1, simp add:co2sobj.simps)
       
  2183 apply (case_tac "obj = O_proc p")
       
  2184 apply (rule disjI2, rule disjI1, simp add:co2sobj.simps cp2sproc_other)
       
  2185 apply (rule disjI2, rule disjI2, simp)
       
  2186 apply (rule_tac x = obj in exI)
       
  2187 apply (simp add:alive_recvmsg co2sobj_recvmsg split:t_object.splits if_splits)
       
  2188 apply (tactic {*my_setiff_tac 1*})
       
  2189 apply (rule_tac x = "O_msgq q" in exI, simp add:co2sobj.simps)
       
  2190 apply (tactic {*my_setiff_tac 1*})
       
  2191 apply (rule_tac x = "O_proc p" in exI, simp add:co2sobj.simps cp2sproc_other)
       
  2192 apply (tactic {*my_setiff_tac 1*})
       
  2193 apply (case_tac "obj = O_msgq q")
       
  2194 apply (frule co2sobj_smsgq_imp, erule exE)
       
  2195 apply (rule_tac x = "O_msgq qa" in exI, simp add:alive_recvmsg co2sobj_recvmsg)
       
  2196 apply (simp add:co2sobj.simps)
       
  2197 apply (case_tac "obj = O_proc p")
       
  2198 apply (frule co2sobj_sproc_imp, erule exE)
       
  2199 apply (rule_tac x = "O_proc pa" in exI, simp add:alive_recvmsg co2sobj_recvmsg)
       
  2200 apply (simp add:co2sobj.simps)
       
  2201 apply (rule_tac x = obj in exI)
       
  2202 apply (auto simp add:alive_recvmsg co2sobj_recvmsg split:t_object.splits if_splits)[1]
       
  2203 apply (simp add:co2sobj.simps)
       
  2204 
       
  2205 apply (tactic {*my_clarify_tac 1*})
       
  2206 apply (simp add:s2ss_def)
       
  2207 apply (tactic {*my_seteq_tac 1*})
       
  2208 apply (case_tac "obj = O_msgq q")
       
  2209 apply (rule disjI1, simp add:co2sobj.simps)
       
  2210 apply (case_tac "obj = O_proc p")
       
  2211 apply (rule disjI2,  simp add:co2sobj.simps cp2sproc_other)
       
  2212 apply (rule notI, simp)
       
  2213 apply (rule disjI2, simp, rule conjI, rule disjI2)
       
  2214 apply (rule_tac x = obj in exI)
       
  2215 apply (simp add:alive_recvmsg co2sobj_recvmsg split:t_object.splits if_splits)
       
  2216 apply (rule notI, simp)
       
  2217 apply (frule co2sobj_smsgq_imp, erule exE)
       
  2218 apply (erule_tac x = "O_msgq qa" in allE, simp add:alive_recvmsg co2sobj_recvmsg split:if_splits)
       
  2219 apply (tactic {*my_setiff_tac 1*})
       
  2220 apply (rule_tac x = "O_msgq q" in exI, simp add:co2sobj.simps)
       
  2221 apply (tactic {*my_setiff_tac 1*}, simp, erule disjE)
       
  2222 apply (rule_tac x = "O_proc p" in exI, simp add:co2sobj.simps cp2sproc_other)
       
  2223 apply (erule exE, erule conjE)
       
  2224 apply (case_tac "obj = O_msgq q", simp add:co2sobj.simps)
       
  2225 apply (case_tac "obj = O_proc p")
       
  2226 apply (frule_tac co2sobj_sproc_imp, erule exE)
       
  2227 apply (rule_tac x = "O_proc pa" in exI, simp add:alive_recvmsg co2sobj_recvmsg)
       
  2228 apply (simp add:co2sobj.simps)
       
  2229 apply (rule_tac x = obj in exI)
       
  2230 apply (auto simp add:alive_recvmsg co2sobj_recvmsg split:t_object.splits if_splits)[1]
       
  2231 apply (simp add:co2sobj.simps)
       
  2232 
       
  2233 apply (tactic {*my_clarify_tac 1*})
       
  2234 apply (simp add:s2ss_def)
       
  2235 apply (tactic {*my_seteq_tac 1*})
       
  2236 apply (case_tac "obj = O_msgq q")
       
  2237 apply (rule disjI1, simp add:co2sobj.simps)
       
  2238 apply (case_tac "obj = O_proc p")
       
  2239 apply (rule disjI2, rule disjI1, simp add:co2sobj.simps cp2sproc_other)
       
  2240 apply (rule disjI2, rule disjI2, simp, rule conjI)
       
  2241 apply (rule_tac x = obj in exI)
       
  2242 apply (simp add:alive_recvmsg co2sobj_recvmsg split:t_object.splits if_splits)
       
  2243 apply (rule notI, simp)
       
  2244 apply (frule co2sobj_sproc_imp, erule exE)
       
  2245 apply (erule_tac x = "O_proc pa" in allE, simp add:co2sobj_recvmsg split:t_object.splits)
       
  2246 apply (tactic {*my_setiff_tac 1*})
       
  2247 apply (rule_tac x = "O_msgq q" in exI, simp add:co2sobj.simps)
       
  2248 apply (tactic {*my_setiff_tac 1*})
       
  2249 apply (rule_tac x = "O_proc p" in exI, simp add:co2sobj.simps cp2sproc_other)
       
  2250 apply (tactic {*my_setiff_tac 1*})
       
  2251 apply (case_tac "obj = O_msgq q")
       
  2252 apply (frule co2sobj_smsgq_imp, erule exE)
       
  2253 apply (rule_tac x = "O_msgq qa" in exI, simp add:alive_recvmsg co2sobj_recvmsg)
       
  2254 apply (simp add:co2sobj.simps)
       
  2255 apply (case_tac "obj = O_proc p")
       
  2256 apply (simp add:co2sobj.simps)
       
  2257 apply (rule_tac x = obj in exI)
       
  2258 apply (auto simp add:alive_recvmsg co2sobj_recvmsg split:t_object.splits if_splits)[1]
       
  2259 apply (simp add:co2sobj.simps)
       
  2260 
       
  2261 apply (tactic {*my_clarify_tac 1*})
       
  2262 apply (simp add:s2ss_def)
       
  2263 apply (tactic {*my_seteq_tac 1*})
       
  2264 apply (case_tac "obj = O_msgq q")
       
  2265 apply (rule disjI1, simp add:co2sobj.simps)
       
  2266 apply (case_tac "obj = O_proc p")
       
  2267 apply (rule disjI2, simp, rule conjI)
       
  2268 apply (rule disjI1, simp add:co2sobj.simps cp2sproc_other)
       
  2269 apply (rule notI, simp add:co2sobj.simps cp2sproc_other)
       
  2270 apply (rule disjI2, simp, rule conjI, rule disjI2, rule conjI)
       
  2271 apply (rule_tac x = obj in exI)
       
  2272 apply (simp add:alive_recvmsg co2sobj_recvmsg split:t_object.splits if_splits)
       
  2273 apply (rule notI, simp, frule co2sobj_sproc_imp, erule exE)
       
  2274 apply (erule_tac x = "O_proc pa" in allE, simp add:co2sobj_recvmsg)
       
  2275 apply (rule notI, simp, frule co2sobj_smsgq_imp, erule exE)
       
  2276 apply (rotate_tac 12, erule_tac x = "O_msgq qa" in allE, simp add:co2sobj_recvmsg)
       
  2277 apply (tactic {*my_setiff_tac 1*})
       
  2278 apply (rule_tac x = "O_msgq q" in exI, simp add:co2sobj.simps)
       
  2279 apply (tactic {*my_setiff_tac 1*}, simp)
       
  2280 apply (tactic {*my_clarify_tac 1*})
       
  2281 apply (rule_tac x = "O_proc p" in exI, simp add:co2sobj.simps cp2sproc_other)
       
  2282 apply (tactic {*my_clarify_tac 1*})
       
  2283 apply (case_tac "obj = O_msgq q")
       
  2284 apply (simp add:co2sobj.simps)
       
  2285 apply (case_tac "obj = O_proc p")
       
  2286 apply (simp add:co2sobj.simps)
       
  2287 apply (rule_tac x = obj in exI)
       
  2288 apply (auto simp add:alive_recvmsg co2sobj_recvmsg split:t_object.splits if_splits)[1]
       
  2289 apply (simp add:co2sobj.simps)
       
  2290 
       
  2291 apply (simp add:update_s2ss_obj_def)
       
  2292 
       
  2293 apply (tactic {*my_clarify_tac 1*})
       
  2294 apply (simp add:s2ss_def)
       
  2295 apply (tactic {*my_seteq_tac 1*})
       
  2296 apply (case_tac "obj = O_msgq q")
       
  2297 apply (rule disjI1, simp add:co2sobj.simps)
       
  2298 apply (rule disjI2, simp)
       
  2299 apply (rule_tac x = obj in exI)
       
  2300 apply (simp add:alive_recvmsg co2sobj_recvmsg split:t_object.splits if_splits)
       
  2301 apply (simp add:co2sobj.simps)
       
  2302 apply (tactic {*my_setiff_tac 1*})
       
  2303 apply (rule_tac x = "O_msgq q" in exI, simp add:co2sobj.simps)
       
  2304 apply (tactic {*my_setiff_tac 1*})
       
  2305 apply (case_tac "obj = O_msgq q")
       
  2306 apply (frule co2sobj_smsgq_imp, erule exE)
       
  2307 apply (rule_tac x = "O_msgq qa" in exI, simp add:alive_recvmsg co2sobj_recvmsg)
       
  2308 apply (simp add:co2sobj.simps)
       
  2309 apply (rule_tac x = obj in exI)
       
  2310 apply (auto simp add:alive_recvmsg co2sobj_recvmsg split:t_object.splits if_splits)[1]
       
  2311 apply (simp add:co2sobj.simps)
       
  2312 apply (simp add:co2sobj.simps)
       
  2313 apply (simp add:co2sobj.simps)
       
  2314 
       
  2315 apply (tactic {*my_clarify_tac 1*})
       
  2316 apply (simp add:s2ss_def)
       
  2317 apply (tactic {*my_seteq_tac 1*})
       
  2318 apply (case_tac "obj = O_msgq q")
       
  2319 apply (rule disjI1, simp add:co2sobj.simps)
       
  2320 apply (rule disjI2, simp, rule conjI)
       
  2321 apply (rule_tac x = obj in exI)
       
  2322 apply (simp add:alive_recvmsg co2sobj_recvmsg split:t_object.splits if_splits)
       
  2323 apply (simp add:co2sobj.simps)
       
  2324 apply (rule notI, simp)
       
  2325 apply (frule co2sobj_smsgq_imp, erule exE, erule_tac x = "O_msgq qa" in allE)
       
  2326 apply (simp add:co2sobj_recvmsg)
       
  2327 apply (tactic {*my_setiff_tac 1*})
       
  2328 apply (rule_tac x = "O_msgq q" in exI, simp add:co2sobj.simps)
       
  2329 apply (tactic {*my_setiff_tac 1*})
       
  2330 apply (case_tac "obj = O_msgq q")
       
  2331 apply (simp add:co2sobj.simps)
       
  2332 apply (rule_tac x = obj in exI)
       
  2333 apply (auto simp add:alive_recvmsg co2sobj_recvmsg split:t_object.splits if_splits)[1]
       
  2334 apply (simp add:co2sobj.simps)
       
  2335 apply (simp add:co2sobj.simps)
       
  2336 apply (simp add:co2sobj.simps)
       
  2337 done
       
  2338 
       
  2339 end
       
  2340 
       
  2341 end