S2ss_prop.thy
author chunhan
Wed, 04 Sep 2013 09:07:39 +0800
changeset 39 13bba99ca090
parent 38 9dfc8c72565a
child 41 db15ef2ee18c
permissions -rw-r--r--
done with co2sobj_simps
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
32
705e1e41faf7 add event-trace simpset for s2ss
chunhan
parents:
diff changeset
     1
(*<*)
705e1e41faf7 add event-trace simpset for s2ss
chunhan
parents:
diff changeset
     2
theory S2ss_prop
705e1e41faf7 add event-trace simpset for s2ss
chunhan
parents:
diff changeset
     3
imports Main Flask Flask_type Static Static_type Init_prop Tainted_prop Valid_prop Alive_prop Co2sobj_prop
705e1e41faf7 add event-trace simpset for s2ss
chunhan
parents:
diff changeset
     4
begin
705e1e41faf7 add event-trace simpset for s2ss
chunhan
parents:
diff changeset
     5
(*>*)
705e1e41faf7 add event-trace simpset for s2ss
chunhan
parents:
diff changeset
     6
33
6884b3c9284b fix bug of static.thy for the static of recvmsg case
chunhan
parents: 32
diff changeset
     7
context tainting_s begin
6884b3c9284b fix bug of static.thy for the static of recvmsg case
chunhan
parents: 32
diff changeset
     8
35
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
     9
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    10
lemma current_proc_has_sp:
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    11
  "\<lbrakk>p \<in> current_procs s; valid s\<rbrakk> \<Longrightarrow> \<exists> sp. cp2sproc s p = Some sp"
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    12
by (auto simp:cp2sproc_def split:option.splits dest!:current_has_sec')
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    13
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    14
lemma current_proc_has_sp':
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    15
  "\<lbrakk>cp2sproc s p = None; valid s\<rbrakk> \<Longrightarrow> p \<notin> current_procs s"
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    16
by (auto dest:current_proc_has_sp)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    17
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    18
lemma is_dir_has_sdir':
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    19
  "\<lbrakk>is_dir s f; valid s\<rbrakk> \<Longrightarrow> \<exists> sf. cf2sfile s f = Some sf"
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    20
apply (case_tac f)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    21
apply (rule_tac x = sroot in exI)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    22
apply (simp add:sroot_only)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    23
apply (drule is_dir_has_sfile, auto)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    24
done
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    25
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    26
lemma is_file_has_sfile':
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    27
  "\<lbrakk>is_file s f; valid s\<rbrakk> \<Longrightarrow> \<exists> sf. cf2sfile s f = Some sf"
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    28
by (drule is_file_has_sfile, auto)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    29
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    30
(* simpset for same_inode_files: Current_files_prop.thy *)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    31
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    32
lemma same_inode_files_nil:
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    33
  "same_inode_files [] = init_same_inode_files"
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    34
by (rule ext, simp add:same_inode_files_def init_same_inode_files_def is_file_nil)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    35
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    36
lemma iof's_im_in_cim': "Some im = inum_of_file \<tau> f \<Longrightarrow> im \<in> current_inode_nums \<tau>"
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    37
by (auto simp add:current_inode_nums_def current_file_inums_def)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    38
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    39
lemma same_inode_files_open:
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    40
  "valid (Open p f flags fd opt # s) \<Longrightarrow> same_inode_files (Open p f flags fd opt # s) = (\<lambda> f'.
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    41
     if (f' = f \<and> opt \<noteq> None) then {f} else same_inode_files s f')"
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    42
apply (frule vt_grant_os, frule vd_cons, rule ext)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    43
apply (auto simp:same_inode_files_def is_file_simps split:if_splits option.splits
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    44
            dest:iof's_im_in_cim iof's_im_in_cim')
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    45
apply (drule is_file_in_current)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    46
apply (simp add:current_files_def)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    47
done
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    48
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    49
lemma same_inode_files_linkhard:
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    50
  "valid (LinkHard p oldf f # s) \<Longrightarrow> same_inode_files (LinkHard p oldf f # s) = (\<lambda> f'. 
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    51
     if (f' = f \<or> f' \<in> same_inode_files s oldf) 
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    52
     then same_inode_files s oldf \<union> {f}
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    53
     else same_inode_files s f')"
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    54
apply (frule vt_grant_os, frule vd_cons, rule ext)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    55
apply (auto simp:same_inode_files_def is_file_simps split:if_splits option.splits
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    56
            dest:iof's_im_in_cim iof's_im_in_cim')
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    57
apply (drule is_file_in_current)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    58
apply (simp add:current_files_def is_file_def)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    59
apply (simp add:is_file_def)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    60
done
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    61
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    62
lemma inum_of_file_none_prop:
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    63
  "\<lbrakk>inum_of_file s f = None; valid s\<rbrakk> \<Longrightarrow> f \<notin> current_files s"
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    64
by (simp add:current_files_def)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    65
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    66
lemma same_inode_files_closefd:
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    67
  "\<lbrakk>valid (CloseFd p fd # s); f' \<in> current_files (CloseFd p fd # s)\<rbrakk> \<Longrightarrow> 
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    68
   same_inode_files (CloseFd p fd # s) f' = (
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    69
     case (file_of_proc_fd s p fd) of 
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    70
       Some f \<Rightarrow> (if ((proc_fd_of_file s f = {(p, fd)}) \<and> (f \<in> files_hung_by_del s))
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    71
                 then same_inode_files s f' - {f}
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    72
                 else same_inode_files s f' )
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    73
     | None   \<Rightarrow> same_inode_files s f' )"
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    74
apply (frule vt_grant_os, frule vd_cons)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    75
apply (auto simp:same_inode_files_def is_file_closefd current_files_closefd 
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    76
           split:if_splits option.splits
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    77
            dest:iof's_im_in_cim iof's_im_in_cim' inum_of_file_none_prop)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    78
done
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    79
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    80
lemma same_inode_files_unlink:
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    81
  "\<lbrakk>valid (UnLink p f # s); f' \<in> current_files (UnLink p f # s)\<rbrakk> 
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    82
   \<Longrightarrow> same_inode_files (UnLink p f # s) f' = (
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    83
     if (proc_fd_of_file s f = {}) 
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    84
     then same_inode_files s f' - {f}
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    85
     else same_inode_files s f')"
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    86
apply (frule vt_grant_os, frule vd_cons)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    87
apply (auto simp:same_inode_files_def is_file_unlink current_files_unlink 
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    88
           split:if_splits option.splits
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    89
            dest:iof's_im_in_cim iof's_im_in_cim' inum_of_file_none_prop)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    90
done
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    91
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    92
lemma same_inode_files_mkdir:
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    93
  "valid (Mkdir p f inum # s) \<Longrightarrow> same_inode_files (Mkdir p f inum # s) = (same_inode_files s)"
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    94
apply (frule vt_grant_os, frule vd_cons, rule ext)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    95
apply (auto simp:same_inode_files_def is_file_simps current_files_simps 
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    96
           split:if_splits option.splits
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    97
            dest:iof's_im_in_cim iof's_im_in_cim' inum_of_file_none_prop is_file_in_current)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    98
apply (simp add:current_files_def is_file_def)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    99
done
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   100
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   101
lemma same_inode_files_other:
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   102
  "\<lbrakk>valid (e # s); 
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   103
    \<forall> p f flag fd opt. e \<noteq> Open p f flag fd opt;
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   104
    \<forall> p fd. e \<noteq> CloseFd p fd;
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   105
    \<forall> p f. e \<noteq> UnLink p f;
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   106
    \<forall> p f f'. e \<noteq> LinkHard p f f'\<rbrakk> \<Longrightarrow> same_inode_files (e # s)  = same_inode_files s"
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   107
apply (frule vt_grant_os, frule vd_cons, rule ext, case_tac e)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   108
apply (auto simp:same_inode_files_def is_file_simps current_files_simps dir_is_empty_def
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   109
           split:if_splits option.splits
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   110
            dest:iof's_im_in_cim iof's_im_in_cim' inum_of_file_none_prop is_file_not_dir)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   111
apply (simp add:is_file_def is_dir_def current_files_def split:option.splits t_inode_tag.splits)+
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   112
done
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   113
 
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   114
lemmas same_inode_files_simps = same_inode_files_nil same_inode_files_open same_inode_files_linkhard
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   115
  same_inode_files_closefd same_inode_files_unlink same_inode_files_mkdir same_inode_files_other
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   116
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   117
lemma same_inode_files_prop1:
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   118
  "f \<in> same_inode_files s f' \<Longrightarrow> f \<in> current_files s"
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   119
by (simp add:same_inode_files_def is_file_def current_files_def split:if_splits option.splits)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   120
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   121
lemma same_inode_files_prop2:
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   122
  "\<lbrakk>f \<in> same_inode_files s f'; f'' \<notin> current_files s\<rbrakk> \<Longrightarrow> f \<noteq> f''"
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   123
by (auto dest:same_inode_files_prop1)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   124
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   125
lemma same_inode_files_prop3:
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   126
  "\<lbrakk>f \<in> same_inode_files s f'; is_dir s f''\<rbrakk> \<Longrightarrow> f \<noteq> f''"
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   127
apply (rule notI)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   128
apply (simp add:same_inode_files_def is_file_def is_dir_def 
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   129
          split:if_splits option.splits t_inode_tag.splits)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   130
done
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   131
36
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   132
lemma same_inode_files_prop4:
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   133
  "\<lbrakk>f' \<in> same_inode_files s f; f'' \<in> same_inode_files s f'\<rbrakk> \<Longrightarrow> f'' \<in> same_inode_files s f"
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   134
by (auto simp:same_inode_files_def split:if_splits)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   135
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   136
lemma same_inode_files_prop5:
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   137
  "f' \<in> same_inode_files s f \<Longrightarrow> f \<in> same_inode_files s f'"
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   138
by (auto simp:same_inode_files_def is_file_def split:if_splits)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   139
38
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   140
lemma same_inode_files_prop6:
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   141
  "f' \<in> same_inode_files s f \<Longrightarrow> same_inode_files s f' = same_inode_files s f"
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   142
by (auto simp:same_inode_files_def is_file_def split:if_splits)
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   143
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   144
lemma same_inode_files_prop7:
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   145
  "f' \<in> same_inode_files s f \<Longrightarrow> has_same_inode s f f'"
39
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   146
by (auto simp:same_inode_files_def is_file_def has_same_inode_def split:if_splits option.splits)
38
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   147
39
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   148
lemma same_inode_files_prop8:
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   149
  "f' \<in> same_inode_files s f \<Longrightarrow> has_same_inode s f' f"
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   150
by (auto simp:same_inode_files_def is_file_def has_same_inode_def split:if_splits option.splits)
38
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   151
35
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   152
(* simpset for cf2sfiles *)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   153
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   154
lemma cf2sfiles_open:
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   155
  "\<lbrakk>valid (Open p f flag fd opt # s); f' \<in> current_files (Open p f flag fd opt # s)\<rbrakk>
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   156
   \<Longrightarrow> cf2sfiles (Open p f flag fd opt # s) f' = (
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   157
     if (f' = f \<and> opt \<noteq> None) 
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   158
     then (case cf2sfile (Open p f flag fd opt # s) f of 
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   159
             Some sf \<Rightarrow> {sf}  
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   160
           | _       \<Rightarrow> {} )
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   161
     else cf2sfiles s f')"
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   162
apply (frule vt_grant_os, frule vd_cons)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   163
apply (auto simp:cf2sfiles_def cf2sfile_open_none cf2sfile_simps same_inode_files_open
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   164
  split:if_splits option.splits dest!:current_file_has_sfile' dest:cf2sfile_open)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   165
apply (rule_tac x = "f'a" in bexI, drule same_inode_files_prop1, simp add:cf2sfile_open_some1, simp)+
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   166
done
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   167
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   168
lemma cf2sfiles_other:
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   169
  "\<lbrakk>valid (e # s);
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   170
    \<forall> p f flag fd opt. e \<noteq> Open p f flag fd opt;
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   171
    \<forall> p fd. e \<noteq> CloseFd p fd;
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   172
    \<forall> p f. e \<noteq> UnLink p f;
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   173
    \<forall> p f f'. e \<noteq> LinkHard p f f'\<rbrakk> \<Longrightarrow> cf2sfiles (e # s) = cf2sfiles s"
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   174
apply (frule vt_grant_os, frule vd_cons, rule ext)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   175
apply (simp add:cf2sfiles_def, rule set_eqI, rule iffI)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   176
apply (drule Set.CollectD, erule bexE, rule CollectI)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   177
apply (rule_tac x = f' in bexI, case_tac e)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   178
apply (auto simp:cf2sfiles_def cf2sfile_simps same_inode_files_simps current_files_simps
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   179
  split:if_splits option.splits dest!:current_file_has_sfile' dest:same_inode_files_prop1 cf2sfile_other')
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   180
apply (drule_tac f' = f' in cf2sfile_rmdir)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   181
apply (simp add:current_files_simps same_inode_files_prop1 same_inode_files_prop3 dir_is_empty_def)+
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   182
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   183
apply (rule_tac x = f' in bexI, case_tac e)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   184
apply (auto simp:cf2sfiles_def cf2sfile_simps same_inode_files_simps current_files_simps
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   185
  split:if_splits option.splits dest!:current_file_has_sfile' dest:same_inode_files_prop1 cf2sfile_other')
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   186
apply (drule_tac f' = f' in cf2sfile_rmdir)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   187
apply (simp add:current_files_simps same_inode_files_prop1 same_inode_files_prop3 dir_is_empty_def)+
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   188
done
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   189
36
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   190
lemma cf2sfile_linkhard1':
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   191
  "\<lbrakk>valid (LinkHard p oldf f # s); f' \<in> same_inode_files s f''\<rbrakk>
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   192
   \<Longrightarrow> cf2sfile (LinkHard p oldf f# s) f' = cf2sfile s f'"
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   193
apply (drule same_inode_files_prop1)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   194
by (simp add:cf2sfile_linkhard1)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   195
35
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   196
lemma cf2sfiles_linkhard:
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   197
  "valid (LinkHard p oldf f # s) \<Longrightarrow> cf2sfiles (LinkHard p oldf f # s) = (\<lambda> f'. 
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   198
     if (f' = f \<or> f' \<in> same_inode_files s oldf)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   199
     then (case (cf2sfile (LinkHard p oldf f # s) f) of
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   200
             Some sf \<Rightarrow> cf2sfiles s oldf \<union> {sf}
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   201
           | _       \<Rightarrow> {})
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   202
     else cf2sfiles s f')"
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   203
apply (frule vt_grant_os, frule vd_cons, rule ext)
36
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   204
apply (auto simp:cf2sfiles_def cf2sfile_linkhard1' same_inode_files_linkhard current_files_linkhard 
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   205
  split:if_splits option.splits dest!:current_file_has_sfile' current_has_sec' dest:same_inode_files_prop1)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   206
done
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   207
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   208
lemma cf2sfile_unlink':
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   209
  "\<lbrakk>valid (UnLink p f # s); f' \<in> same_inode_files (UnLink p f # s) f''\<rbrakk>
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   210
   \<Longrightarrow> cf2sfile (UnLink p f # s) f' = cf2sfile s f'"
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   211
apply (drule same_inode_files_prop1)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   212
by (simp add:cf2sfile_unlink)
35
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   213
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   214
lemma cf2sfiles_unlink:
36
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   215
  "\<lbrakk>valid (UnLink p f # s); f' \<in> current_files (UnLink p f # s)\<rbrakk> \<Longrightarrow> cf2sfiles (UnLink p f # s) f' = ( 
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   216
     if (f' \<in> same_inode_files s f \<and> proc_fd_of_file s f = {} \<and> 
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   217
         (\<forall> f'' \<in> same_inode_files s f. f'' \<noteq> f \<longrightarrow> cf2sfile s f'' \<noteq> cf2sfile s f)) then 
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   218
        (case (cf2sfile s f) of 
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   219
           Some sf \<Rightarrow> cf2sfiles s f' - {sf}
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   220
         | _       \<Rightarrow> {})
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   221
     else cf2sfiles s f')"
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   222
apply (frule vt_grant_os, frule vd_cons, simp add:current_files_simps split:if_splits)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   223
apply (rule conjI, clarify, frule is_file_has_sfile', simp, erule exE, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   224
apply (simp add:cf2sfiles_def, rule set_eqI, rule iffI, drule CollectD)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   225
apply (erule bexE, frule_tac f' = f' in same_inode_files_unlink)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   226
apply (simp add:current_files_unlink, simp, erule conjE)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   227
apply (erule_tac x = f'a in ballE, frule_tac f' = "f'a" in cf2sfile_unlink)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   228
apply (simp add:current_files_unlink same_inode_files_prop1, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   229
apply (rule_tac x = f'a in bexI, simp, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   230
apply (drule_tac f = f and f' = f' and f'' = f'a in same_inode_files_prop4, simp+)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   231
apply (erule conjE|erule exE|erule bexE)+
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   232
apply (case_tac "f'a = f", simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   233
apply (frule_tac f' = f' in same_inode_files_unlink, simp add:current_files_unlink)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   234
apply (frule_tac f' = f'a in cf2sfile_unlink, simp add:current_files_unlink same_inode_files_prop1)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   235
apply (rule_tac x = f'a in bexI, simp, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   236
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   237
apply (rule impI)+
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   238
apply (simp add:cf2sfiles_def, rule set_eqI, rule iffI, drule CollectD)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   239
apply (erule bexE, frule_tac f' = f' in same_inode_files_unlink)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   240
apply (simp add:current_files_unlink, simp, (erule conjE)+)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   241
apply (rule_tac x = f'a in bexI, frule_tac f' = "f'a" in cf2sfile_unlink)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   242
apply (simp add:current_files_unlink same_inode_files_prop1, simp, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   243
apply (drule CollectD, erule bexE, frule_tac f' = f' in same_inode_files_unlink)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   244
apply (simp add:current_files_unlink, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   245
apply (case_tac "f'a = f", simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   246
apply (frule_tac f = f' and f' = f in same_inode_files_prop5, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   247
apply (erule bexE, erule conjE)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   248
apply (rule_tac x = f'' in bexI)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   249
apply (drule_tac f' = f'' in cf2sfile_unlink, simp add:current_files_unlink same_inode_files_prop1)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   250
apply (simp, simp, erule same_inode_files_prop4, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   251
apply (rule_tac x = f'a in bexI)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   252
apply (drule_tac f' = f'a in cf2sfile_unlink, simp add:current_files_unlink same_inode_files_prop1)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   253
apply (simp, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   254
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   255
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   256
apply (simp add:cf2sfiles_def, rule set_eqI, rule iffI, drule CollectD)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   257
apply (erule bexE, frule_tac f' = f' in same_inode_files_unlink)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   258
apply (simp add:current_files_unlink, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   259
apply (rule_tac x = f'a in bexI)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   260
apply (frule_tac f' = f'a in cf2sfile_unlink)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   261
apply (simp add:same_inode_files_prop1 current_files_unlink, simp, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   262
apply (drule CollectD, erule bexE, frule_tac f' = f' in same_inode_files_unlink)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   263
apply (simp add:current_files_unlink, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   264
apply (rule_tac x = f'a in bexI)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   265
apply (frule_tac f' = f'a in cf2sfile_unlink)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   266
apply (simp add:same_inode_files_prop1 current_files_unlink, simp, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   267
done
35
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   268
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   269
lemma cf2sfiles_closefd:
36
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   270
  "\<lbrakk>valid (CloseFd p fd # s); f' \<in> current_files (CloseFd p fd # s)\<rbrakk> \<Longrightarrow> cf2sfiles (CloseFd p fd # s) f' = (
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   271
     case (file_of_proc_fd s p fd) of
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   272
       Some f \<Rightarrow> if (f' \<in> same_inode_files s f \<and> proc_fd_of_file s f = {(p, fd)} \<and> f \<in> files_hung_by_del s \<and> 
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   273
                    (\<forall> f'' \<in> same_inode_files s f. f'' \<noteq> f \<longrightarrow> cf2sfile s f'' \<noteq> cf2sfile s f)) 
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   274
                 then (case (cf2sfile s f) of 
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   275
                         Some sf \<Rightarrow> cf2sfiles s f' - {sf}
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   276
                       | _       \<Rightarrow> {})
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   277
                 else cf2sfiles s f'
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   278
     | _       \<Rightarrow> cf2sfiles s f')"
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   279
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   280
apply (frule vt_grant_os, frule vd_cons, case_tac "file_of_proc_fd s p fd")
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   281
apply (simp_all add:current_files_simps split:if_splits)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   282
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   283
apply (simp add:cf2sfiles_def, rule set_eqI, rule iffI, drule CollectD)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   284
apply (erule bexE, frule_tac f' = f' in same_inode_files_closefd)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   285
apply (simp add:current_files_closefd, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   286
apply (rule_tac x = f'a in bexI)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   287
apply (frule_tac f = f'a in cf2sfile_closefd)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   288
apply (simp add:same_inode_files_prop1 current_files_closefd, simp, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   289
apply (drule CollectD, erule bexE, frule_tac f' = f' in same_inode_files_closefd)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   290
apply (simp add:current_files_closefd, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   291
apply (rule_tac x = f'a in bexI)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   292
apply (frule_tac f = f'a in cf2sfile_closefd)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   293
apply (simp add:same_inode_files_prop1 current_files_closefd, simp, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   294
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   295
apply (rule conjI, clarify, frule file_of_pfd_is_file, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   296
apply (frule is_file_has_sfile', simp, erule exE, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   297
apply (simp add:cf2sfiles_def, rule set_eqI, rule iffI, drule CollectD)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   298
apply (erule bexE, frule_tac f' = f' in same_inode_files_closefd)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   299
apply (simp add:current_files_closefd, simp, erule conjE)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   300
apply (erule_tac x = f'a in ballE, frule_tac f = "f'a" in cf2sfile_closefd)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   301
apply (simp add:current_files_closefd same_inode_files_prop1, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   302
apply (rule_tac x = f'a in bexI, simp, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   303
apply (drule_tac f = a and f' = f' and f'' = f'a in same_inode_files_prop4, simp+)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   304
apply (erule conjE|erule exE|erule bexE)+
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   305
apply (case_tac "f'a = a", simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   306
apply (frule_tac f' = f' in same_inode_files_closefd, simp add:current_files_closefd, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   307
apply (frule_tac f = f'a in cf2sfile_closefd, simp add:current_files_closefd same_inode_files_prop1)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   308
apply (rule_tac x = f'a in bexI, simp, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   309
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   310
apply (rule impI)+
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   311
apply (simp add:cf2sfiles_def, rule set_eqI, rule iffI, drule CollectD)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   312
apply (erule bexE, frule_tac f' = f' in same_inode_files_closefd)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   313
apply (simp add:current_files_closefd, simp, (erule conjE)+)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   314
apply (rule_tac x = f'a in bexI, frule_tac f = f'a in cf2sfile_closefd)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   315
apply (simp add:current_files_closefd same_inode_files_prop1, simp, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   316
apply (drule CollectD, erule bexE, frule_tac f' = f' in same_inode_files_closefd)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   317
apply (simp add:current_files_closefd, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   318
apply (case_tac "f'a = a", simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   319
apply (frule_tac f = f' and f' = a in same_inode_files_prop5, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   320
apply (erule bexE, erule conjE)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   321
apply (rule_tac x = f'' in bexI)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   322
apply (drule_tac f = f'' in cf2sfile_closefd, simp add:current_files_closefd same_inode_files_prop1)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   323
apply (simp, simp, erule same_inode_files_prop4, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   324
apply (rule_tac x = f'a in bexI)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   325
apply (drule_tac f = f'a in cf2sfile_closefd, simp add:current_files_closefd same_inode_files_prop1)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   326
apply (simp, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   327
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   328
apply (rule conjI, clarify)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   329
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   330
apply (rule impI)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   331
apply (case_tac "a \<in> files_hung_by_del s", simp_all)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   332
apply (simp add:cf2sfiles_def, rule set_eqI, rule iffI, drule CollectD)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   333
apply (erule bexE, frule_tac f' = f' in same_inode_files_closefd)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   334
apply (simp add:current_files_closefd, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   335
apply (rule_tac x = f'a in bexI)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   336
apply (frule_tac f = f'a in cf2sfile_closefd)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   337
apply (simp add:same_inode_files_prop1 current_files_closefd, simp, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   338
apply (drule CollectD, erule bexE, frule_tac f' = f' in same_inode_files_closefd)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   339
apply (simp add:current_files_closefd, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   340
apply (rule_tac x = f'a in bexI)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   341
apply (frule_tac f = f'a in cf2sfile_closefd)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   342
apply (simp add:same_inode_files_prop1 current_files_closefd, simp, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   343
apply (simp add:cf2sfiles_def, rule set_eqI, rule iffI, drule CollectD)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   344
apply (erule bexE, frule_tac f' = f' in same_inode_files_closefd)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   345
apply (simp add:current_files_closefd, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   346
apply (rule_tac x = f'a in bexI)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   347
apply (frule_tac f = f'a in cf2sfile_closefd)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   348
apply (simp add:same_inode_files_prop1 current_files_closefd, simp, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   349
apply (drule CollectD, erule bexE, frule_tac f' = f' in same_inode_files_closefd)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   350
apply (simp add:current_files_closefd, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   351
apply (rule_tac x = f'a in bexI)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   352
apply (frule_tac f = f'a in cf2sfile_closefd)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   353
apply (simp add:same_inode_files_prop1 current_files_closefd, simp, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   354
done
35
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   355
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   356
lemmas cf2sfiles_simps = cf2sfiles_open cf2sfiles_linkhard cf2sfiles_other
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   357
  cf2sfiles_unlink cf2sfiles_closefd
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   358
  
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   359
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   360
(* simpset for co2sobj *)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   361
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   362
lemma co2sobj_execve:
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   363
  "\<lbrakk>valid (Execve p f fds # s); alive s obj\<rbrakk> \<Longrightarrow> co2sobj (Execve p f fds # s) obj = (
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   364
      if (obj = O_proc p)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   365
      then (case (cp2sproc (Execve p f fds # s) p) of
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   366
              Some sp \<Rightarrow> Some (S_proc sp (O_proc p \<in> Tainted s \<or> O_file f \<in> Tainted s))
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   367
            | _       \<Rightarrow> None) 
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   368
      else co2sobj s obj )"
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   369
apply (frule vt_grant_os, frule vd_cons, case_tac obj)
38
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   370
apply (simp_all add:current_files_simps cf2sfiles_other ch2sshm_other cq2smsgq_other tainted_eq_Tainted)
35
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   371
apply (case_tac "cp2sproc (Execve p f fds # s) p")
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   372
apply (drule current_proc_has_sp', simp, simp)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   373
apply (simp (no_asm_simp) add:cp2sproc_execve tainted_eq_Tainted split:option.splits)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   374
apply (frule_tac s = s in is_dir_has_sdir', simp, erule exE, simp)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   375
apply (frule_tac ff = list in cf2sfile_other', simp_all)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   376
apply (simp add:is_dir_in_current)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   377
done
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   378
37
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   379
lemma co2sobj_clone:
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   380
  "\<lbrakk>valid (Clone p p' fds shms # s); alive s obj\<rbrakk> \<Longrightarrow> co2sobj (Clone p p' fds shms # s) obj = (
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   381
      if (obj = O_proc p')
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   382
      then (case (cp2sproc (Clone p p' fds shms # s) p') of
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   383
              Some sp \<Rightarrow> Some (S_proc sp (O_proc p \<in> Tainted s))
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   384
            | _       \<Rightarrow> None)
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   385
      else co2sobj s obj )"
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   386
apply (frule vt_grant_os, frule vd_cons, case_tac obj)
38
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   387
apply (simp_all add:current_files_simps cf2sfiles_other ch2sshm_other cq2smsgq_other tainted_eq_Tainted)
37
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   388
apply (case_tac "cp2sproc (Clone p p' fds shms # s) p'")
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   389
apply (drule current_proc_has_sp', simp, simp)
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   390
apply ((erule conjE)+, frule_tac p = p in current_proc_has_sec, simp, erule exE, simp)
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   391
apply (rule conjI, rule impI, simp)
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   392
apply (simp (no_asm_simp) add:cp2sproc_clone tainted_eq_Tainted split:option.splits)
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   393
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   394
apply (frule_tac s = s in is_dir_has_sdir', simp, erule exE, simp)
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   395
apply (frule_tac ff = list in cf2sfile_other', simp_all)
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   396
apply (simp add:is_dir_in_current)
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   397
done
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   398
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   399
lemma co2sobj_ptrace:
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   400
  "\<lbrakk>valid (Ptrace p p' # s); alive s obj\<rbrakk>\<Longrightarrow> co2sobj (Ptrace p p' # s) obj = (
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   401
     case obj of
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   402
       O_proc p'' \<Rightarrow> if (info_flow_shm s p' p'') 
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   403
                     then (case (cp2sproc s p'') of 
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   404
                             Some sp \<Rightarrow> Some (S_proc sp (O_proc p'' \<in> Tainted s \<or> O_proc p \<in> Tainted s))
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   405
                           | _       \<Rightarrow> None)
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   406
                     else if (info_flow_shm s p p'')
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   407
                          then (case (cp2sproc s p'') of 
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   408
                                  Some sp \<Rightarrow> Some (S_proc sp (O_proc p'' \<in> Tainted s \<or> O_proc p' \<in> Tainted s))
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   409
                                | _       \<Rightarrow> None)
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   410
                          else co2sobj s (O_proc p'')
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   411
    | _          \<Rightarrow> co2sobj s obj)"
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   412
apply (frule vt_grant_os, frule vd_cons, case_tac obj)
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   413
apply (simp_all add:current_files_simps ch2sshm_other cq2smsgq_other cf2sfiles_other tainted_eq_Tainted)
38
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   414
37
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   415
apply (auto simp:cp2sproc_other tainted_eq_Tainted split:option.splits
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   416
  dest!:current_proc_has_sec' current_proc_has_sp' intro:info_flow_shm_Tainted)[1]
36
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   417
37
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   418
apply (frule_tac s = s in is_dir_has_sdir', simp, erule exE, simp)
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   419
apply (frule_tac ff = list in cf2sfile_other', simp_all)
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   420
apply (simp add:is_dir_in_current)
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   421
done
36
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   422
37
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   423
lemma co2sobj_open:
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   424
  "\<lbrakk>valid (Open p f flag fd opt # s); alive (Open p f flag fd opt # s) obj\<rbrakk> 
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   425
   \<Longrightarrow> co2sobj (Open p f flag fd opt # s) obj = (case obj of 
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   426
     O_file f' \<Rightarrow> if (f' = f \<and> opt \<noteq> None)
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   427
                  then (case (cf2sfile (Open p f flag fd opt # s) f) of
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   428
                          Some sf \<Rightarrow> Some (S_file {sf} (O_proc p \<in> Tainted s))
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   429
                        | _       \<Rightarrow> None)
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   430
                  else co2sobj s (O_file f')
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   431
   | O_proc p' \<Rightarrow> if (p' = p) 
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   432
                  then (case (cp2sproc (Open p f flag fd opt # s) p) of
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   433
                          Some sp \<Rightarrow> Some (S_proc sp (O_proc p \<in> Tainted s))
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   434
                        | _       \<Rightarrow> None)
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   435
                  else co2sobj s (O_proc p')
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   436
   | _         \<Rightarrow> co2sobj s obj )"
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   437
apply (frule vt_grant_os, frule vd_cons, case_tac obj)
38
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   438
apply (auto simp:cp2sproc_simps tainted_eq_Tainted split:option.splits
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   439
           dest!:current_proc_has_sp' intro:info_flow_shm_Tainted)[1]
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   440
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   441
apply (simp split:if_splits t_object.splits)
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   442
apply (rule conjI, rule impI, erule conjE, erule exE, simp, (erule exE|erule conjE)+)
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   443
apply (case_tac "cf2sfile (Open p f flag fd (Some y) # s) f")
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   444
apply (drule current_file_has_sfile', simp, simp add:current_files_simps, simp)
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   445
apply (frule_tac f' = f in cf2sfiles_open, simp add:current_files_simps)
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   446
apply (simp add:tainted_eq_Tainted)
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   447
apply (rule impI, rule notI, drule Tainted_in_current, simp, simp add:is_file_in_current)
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   448
apply (rule impI, simp add:tainted_eq_Tainted cf2sfiles_open is_file_in_current split:option.splits)
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   449
37
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   450
apply (simp_all add:current_files_simps is_dir_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted)
38
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   451
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   452
apply (frule is_dir_in_current)
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   453
apply (frule_tac f' = list in cf2sfile_open)
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   454
apply (simp add:current_files_simps split:option.splits)
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   455
apply (simp split:if_splits option.splits)
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   456
done
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   457
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   458
lemma co2sobj_readfile:
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   459
  "\<lbrakk>valid (ReadFile p fd # s); alive s obj\<rbrakk> \<Longrightarrow> co2sobj (ReadFile p fd # s) obj = (
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   460
     case obj of
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   461
       O_proc p' \<Rightarrow> (case (file_of_proc_fd s p fd) of
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   462
                       Some f \<Rightarrow> (if (info_flow_shm s p p' \<and> O_file f \<in> Tainted s)
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   463
                                  then (case (cp2sproc s p') of
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   464
                                          Some sp \<Rightarrow> Some (S_proc sp True)
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   465
                                        | _       \<Rightarrow> None)
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   466
                                  else co2sobj s obj)
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   467
                    | _       \<Rightarrow> None)
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   468
     | _         \<Rightarrow> co2sobj s obj)"
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   469
apply (frule vt_grant_os, frule vd_cons, case_tac obj)
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   470
apply (auto simp:cp2sproc_simps tainted_eq_Tainted split:option.splits
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   471
           dest!:current_proc_has_sp' intro:info_flow_shm_Tainted)[1]
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   472
apply (simp_all add:current_files_simps is_dir_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted)
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   473
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   474
apply (auto split:if_splits option.splits dest!:current_file_has_sfile' 
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   475
             simp:current_files_simps cf2sfiles_simps cf2sfile_simps 
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   476
             dest:is_file_in_current is_dir_in_current)
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   477
done
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   478
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   479
lemma co2sobj_writefile:
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   480
  "\<lbrakk>valid (WriteFile p fd # s); alive s obj\<rbrakk> \<Longrightarrow> co2sobj (WriteFile p fd # s) obj = (
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   481
     case obj of
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   482
       O_file f' \<Rightarrow> (case (file_of_proc_fd s p fd) of
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   483
                       Some f \<Rightarrow> (if (f \<in> same_inode_files s f') 
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   484
                                  then Some (S_file (cf2sfiles s f') 
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   485
                                                    (O_file f' \<in> Tainted s \<or> O_proc p \<in> Tainted s))
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   486
                                  else co2sobj s obj)
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   487
                    | _       \<Rightarrow> None)
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   488
     | _         \<Rightarrow> co2sobj s obj)"
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   489
apply (frule vt_grant_os, frule vd_cons, case_tac obj)
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   490
apply (simp_all add:current_files_simps is_dir_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted)
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   491
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   492
apply (auto split:if_splits option.splits dest!:current_file_has_sfile' current_proc_has_sp'
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   493
             simp:current_files_simps cf2sfiles_simps cf2sfile_simps cp2sproc_simps tainted_eq_Tainted
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   494
                  same_inode_files_prop6
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   495
             dest:is_file_in_current is_dir_in_current)
39
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   496
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   497
(* should delete has_same_inode !?!?*)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   498
by (auto simp:same_inode_files_def is_file_def has_same_inode_def split:if_splits option.splits)
38
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   499
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   500
lemma co2sobj_closefd:
39
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   501
  "\<lbrakk>valid (CloseFd p fd # s); alive (CloseFd p fd # s) obj\<rbrakk> \<Longrightarrow> co2sobj (CloseFd p fd # s) obj = (
38
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   502
      case obj of 
9dfc8c72565a found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
chunhan
parents: 37
diff changeset
   503
        O_file f' \<Rightarrow> (case (file_of_proc_fd s p fd) of 
39
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   504
                        Some f \<Rightarrow> (if (f' \<in> same_inode_files s f \<and> proc_fd_of_file s f = {(p, fd)} \<and>
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   505
                                       f \<in> files_hung_by_del s \<and> (\<forall> f'' \<in> same_inode_files s f. 
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   506
                                       f'' \<noteq> f \<longrightarrow> cf2sfile s f'' \<noteq> cf2sfile s f))
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   507
                                   then (case (cf2sfile s f, co2sobj s (O_file f')) of
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   508
                                           (Some sf, Some (S_file sfs b)) \<Rightarrow> Some (S_file (sfs - {sf}) b)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   509
                                         | _                              \<Rightarrow> None)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   510
                                   else co2sobj s obj)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   511
                     | _       \<Rightarrow> co2sobj s obj)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   512
      | O_proc p' \<Rightarrow> (if (p = p') 
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   513
                      then (case (cp2sproc (CloseFd p fd # s) p) of
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   514
                              Some sp \<Rightarrow> Some (S_proc sp (O_proc p \<in> Tainted s))
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   515
                            | _       \<Rightarrow> None)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   516
                      else co2sobj s obj)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   517
      | _         \<Rightarrow> co2sobj s obj) "
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   518
apply (frule vt_grant_os, frule vd_cons, case_tac obj)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   519
apply (simp_all add:current_files_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   520
apply (auto simp:cp2sproc_simps tainted_eq_Tainted split:option.splits if_splits
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   521
           dest!:current_proc_has_sp' intro:info_flow_shm_Tainted)[1]
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   522
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   523
apply (frule is_file_in_current)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   524
apply (case_tac "file_of_proc_fd s p fd")
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   525
apply (simp add:tainted_eq_Tainted)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   526
apply (drule_tac f' = list in cf2sfiles_closefd, simp add:current_files_closefd, simp)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   527
apply (frule_tac f' = list in cf2sfiles_closefd, simp)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   528
apply (simp add:is_file_simps current_files_simps)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   529
apply (auto simp add:tainted_eq_Tainted cf2sfile_closefd split:if_splits option.splits
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   530
  dest!:current_file_has_sfile' dest:hung_file_in_current)[1]
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   531
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   532
apply (simp add:is_dir_simps, frule is_dir_in_current)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   533
apply (frule_tac f = list in cf2sfile_closefd)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   534
apply (clarsimp simp:current_files_closefd split:option.splits)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   535
apply (drule file_of_pfd_is_file', simp+)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   536
done
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   537
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   538
lemma co2sobj_unlink:
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   539
  "\<lbrakk>valid (UnLink p f # s); alive (UnLink p f # s) obj\<rbrakk> \<Longrightarrow> co2sobj (UnLink p f # s) obj = (
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   540
      case obj of
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   541
        O_file f' \<Rightarrow> if (f' \<in> same_inode_files s f \<and> proc_fd_of_file s f = {} \<and> 
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   542
                        (\<forall> f'' \<in> same_inode_files s f. f'' \<noteq> f \<longrightarrow> cf2sfile s f'' \<noteq> cf2sfile s f))
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   543
                     then (case (cf2sfile s f, co2sobj s (O_file f')) of
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   544
                             (Some sf, Some (S_file sfs b)) \<Rightarrow> Some (S_file (sfs - {sf}) b)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   545
                           | _                              \<Rightarrow> None)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   546
                     else co2sobj s obj
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   547
      | _         \<Rightarrow> co2sobj s obj)"
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   548
apply (frule vt_grant_os, frule vd_cons, case_tac obj)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   549
apply (simp_all add:current_files_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   550
apply (auto simp:cp2sproc_simps tainted_eq_Tainted split:option.splits if_splits
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   551
           dest!:current_proc_has_sp' intro:info_flow_shm_Tainted)[1]
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   552
apply (frule is_file_in_current)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   553
apply (frule_tac f' = list in cf2sfile_unlink, simp)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   554
apply (frule_tac f' = list in cf2sfiles_unlink, simp)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   555
apply (simp add:is_file_simps current_files_simps)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   556
apply (auto simp add:tainted_eq_Tainted is_file_in_current split:if_splits option.splits
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   557
  dest!:current_file_has_sfile')[1]
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   558
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   559
apply (simp add:is_dir_simps, frule is_dir_in_current)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   560
apply (frule_tac f' = list in cf2sfile_unlink)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   561
apply (clarsimp simp:current_files_unlink split:option.splits)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   562
apply (drule file_dir_conflict, simp+)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   563
done
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   564
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   565
lemma co2sobj_rmdir:
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   566
  "\<lbrakk>valid (Rmdir p f # s); alive (Rmdir p f # s) obj\<rbrakk> \<Longrightarrow> co2sobj (Rmdir p f # s) obj = co2sobj s obj"
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   567
apply (frule vt_grant_os, frule vd_cons, case_tac obj)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   568
apply (simp_all add:current_files_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   569
apply (auto simp:cp2sproc_simps tainted_eq_Tainted split:option.splits if_splits
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   570
           dest!:current_proc_has_sp' intro:info_flow_shm_Tainted)[1]
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   571
apply (simp add:is_file_simps dir_is_empty_def)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   572
apply (case_tac "f = list", drule file_dir_conflict, simp, simp)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   573
apply (simp add:cf2sfiles_other)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   574
apply (auto simp:cf2sfile_simps dest:is_dir_in_current)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   575
done
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   576
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   577
lemma co2sobj_mkdir:
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   578
  "\<lbrakk>valid (Mkdir p f i # s); alive (Mkdir p f i # s) obj\<rbrakk> \<Longrightarrow> co2sobj (Mkdir p f i # s) obj = (
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   579
      if (obj = O_dir f) 
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   580
      then (case (cf2sfile (Mkdir p f i # s) f) of 
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   581
              Some sf \<Rightarrow> Some (S_dir sf)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   582
            | _       \<Rightarrow> None)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   583
      else co2sobj s obj)"
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   584
apply (frule vt_grant_os, frule vd_cons, case_tac obj)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   585
apply (simp_all add:current_files_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   586
apply (auto simp:cp2sproc_simps tainted_eq_Tainted split:option.splits if_splits
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   587
           dest!:current_proc_has_sp' intro:info_flow_shm_Tainted)[1]
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   588
apply (frule_tac cf2sfiles_other, simp+)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   589
apply (frule is_dir_in_current, rule impI, simp add:current_files_mkdir)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   590
apply (frule current_file_has_sfile, simp, erule exE, simp)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   591
apply (drule cf2sfile_mkdir1, simp+)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   592
done
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   593
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   594
lemma same_inodes_Tainted:
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   595
  "\<lbrakk>f \<in> same_inode_files s f'; valid s\<rbrakk> \<Longrightarrow> (O_file f \<in> Tainted s) = (O_file f' \<in> Tainted s)"
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   596
apply (frule same_inode_files_prop8, frule same_inode_files_prop7)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   597
apply (auto intro:has_same_inode_Tainted)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   598
done
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   599
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   600
lemma co2sobj_linkhard:
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   601
  "\<lbrakk>valid (LinkHard p oldf f # s); alive (LinkHard p oldf f # s) obj\<rbrakk> 
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   602
   \<Longrightarrow> co2sobj (LinkHard p oldf f # s) obj = (
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   603
    case obj of
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   604
      O_file f' \<Rightarrow> if (f' = f \<or> f' \<in> same_inode_files s oldf)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   605
                   then (case (cf2sfile (LinkHard p oldf f # s) f) of
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   606
                           Some sf \<Rightarrow> Some (S_file (cf2sfiles s oldf \<union> {sf}) (O_file oldf \<in> Tainted s))
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   607
                         | _       \<Rightarrow> None)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   608
                   else co2sobj s obj
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   609
    | _         \<Rightarrow> co2sobj s obj)"
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   610
apply (frule vt_grant_os, frule vd_cons, case_tac obj)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   611
apply (simp_all add:current_files_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   612
apply (auto simp:cp2sproc_simps tainted_eq_Tainted split:option.splits if_splits
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   613
           dest!:current_proc_has_sp' intro:info_flow_shm_Tainted)[1]
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   614
apply (frule_tac cf2sfiles_linkhard, simp+)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   615
apply (frule_tac f' = f in cf2sfile_linkhard, simp add:current_files_linkhard)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   616
apply (auto simp:is_file_simps sectxt_of_obj_simps current_files_simps is_file_in_current same_inodes_Tainted
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   617
  split:option.splits if_splits dest:Tainted_in_current 
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   618
  dest!:current_has_sec' current_file_has_sfile')[1]
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   619
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   620
apply (frule is_dir_in_current, simp add:current_files_linkhard is_dir_simps is_dir_in_current)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   621
apply (frule is_dir_in_current)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   622
apply (frule current_file_has_sfile, simp)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   623
apply (drule cf2sfile_linkhard1, simp+)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   624
done
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   625
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   626
lemma co2sobj_truncate:
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   627
  "\<lbrakk>valid (Truncate p f len # s); alive s obj\<rbrakk> \<Longrightarrow> co2sobj (Truncate p f len # s) obj = (
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   628
      case obj of
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   629
        O_file f' \<Rightarrow> if (f' \<in> same_inode_files s f \<and> len > 0)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   630
                     then Some (S_file (cf2sfiles s f') (O_file f' \<in> Tainted s \<or> O_proc p \<in> Tainted s))
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   631
                     else co2sobj s obj
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   632
      | _         \<Rightarrow> co2sobj s obj)"
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   633
apply (frule vt_grant_os, frule vd_cons, case_tac obj)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   634
apply (simp_all add:current_files_simps is_dir_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   635
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   636
apply (auto split:if_splits option.splits dest!:current_file_has_sfile' current_proc_has_sp'
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   637
             simp:current_files_simps cf2sfiles_simps cf2sfile_simps cp2sproc_simps tainted_eq_Tainted
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   638
                  same_inode_files_prop6
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   639
             dest:is_file_in_current is_dir_in_current)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   640
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   641
(* should delete has_same_inode !?!?*)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   642
by (auto simp:same_inode_files_def is_file_def has_same_inode_def split:if_splits option.splits)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   643
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   644
lemma co2sobj_kill:
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   645
  "\<lbrakk>valid (Kill p p' # s); alive (Kill p p' # s) obj\<rbrakk> \<Longrightarrow> co2sobj (Kill p p' # s) obj = co2sobj s obj"
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   646
apply (frule vt_grant_os, frule vd_cons, case_tac obj)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   647
apply (simp_all add:current_files_simps is_dir_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   648
apply (auto split:if_splits option.splits dest!:current_file_has_sfile' current_proc_has_sp'
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   649
             simp:current_files_simps cf2sfiles_simps cf2sfile_simps cp2sproc_simps tainted_eq_Tainted
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   650
                  same_inode_files_prop6
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   651
             dest:is_file_in_current is_dir_in_current)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   652
done
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   653
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   654
lemma co2sobj_exit:
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   655
  "\<lbrakk>valid (Exit p # s); alive (Exit p # s) obj\<rbrakk> \<Longrightarrow> co2sobj (Exit p # s) obj = co2sobj s obj"
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   656
apply (frule vt_grant_os, frule vd_cons, case_tac obj)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   657
apply (simp_all add:current_files_simps is_dir_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   658
apply (auto split:if_splits option.splits dest!:current_file_has_sfile' current_proc_has_sp'
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   659
             simp:current_files_simps cf2sfiles_simps cf2sfile_simps cp2sproc_simps tainted_eq_Tainted
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   660
                  same_inode_files_prop6
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   661
             dest:is_file_in_current is_dir_in_current)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   662
done
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   663
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   664
lemma co2sobj_createmsgq:
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   665
  "\<lbrakk>valid (CreateMsgq p q # s); alive (CreateMsgq p q # s) obj\<rbrakk> \<Longrightarrow> co2sobj (CreateMsgq p q # s) obj = (
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   666
      case obj of
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   667
        O_msgq q' \<Rightarrow> if (q' = q) then (case (cq2smsgq (CreateMsgq p q # s) q) of
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   668
                                         Some sq \<Rightarrow> Some (S_msgq sq)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   669
                                       | _       \<Rightarrow> None)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   670
                     else co2sobj s obj
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   671
      | _        \<Rightarrow> co2sobj s obj)"
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   672
apply (frule vt_grant_os, frule vd_cons, case_tac obj)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   673
apply (simp_all add:current_files_simps is_dir_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   674
apply (auto split:if_splits option.splits dest!:current_file_has_sfile' current_proc_has_sp'
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   675
             simp:current_files_simps cf2sfiles_simps cf2sfile_simps cp2sproc_simps tainted_eq_Tainted
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   676
                  same_inode_files_prop6
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   677
             dest!:current_has_smsgq'
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   678
             dest:is_file_in_current is_dir_in_current cq2smsg_createmsgq)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   679
done
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   680
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   681
lemma co2sobj_sendmsg:
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   682
  "\<lbrakk>valid (SendMsg p q m # s); alive (SendMsg p q m # s) obj\<rbrakk> \<Longrightarrow> co2sobj (SendMsg p q m # s) obj = (
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   683
      case obj of
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   684
        O_msgq q' \<Rightarrow> if (q' = q) then (case (cq2smsgq (SendMsg p q m # s) q) of
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   685
                                         Some sq \<Rightarrow> Some (S_msgq sq)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   686
                                       | _       \<Rightarrow> None)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   687
                     else co2sobj s obj
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   688
      | _        \<Rightarrow> co2sobj s obj)"
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   689
apply (frule vt_grant_os, frule vd_cons, case_tac obj)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   690
apply (simp_all add:current_files_simps is_dir_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   691
apply (auto split:if_splits option.splits dest!:current_file_has_sfile' current_proc_has_sp'
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   692
             simp:current_files_simps cf2sfiles_simps cf2sfile_simps cp2sproc_simps tainted_eq_Tainted
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   693
                  same_inode_files_prop6
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   694
             dest!:current_has_smsgq'
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   695
             dest:is_file_in_current is_dir_in_current cq2smsg_sendmsg)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   696
done
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   697
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   698
lemma co2sobj_recvmsg:
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   699
  "\<lbrakk>valid (RecvMsg p q m # s); alive (RecvMsg p q m # s) obj\<rbrakk> \<Longrightarrow> co2sobj (RecvMsg p q m # s) obj = (
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   700
      case obj of
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   701
        O_msgq q' \<Rightarrow> if (q' = q) then (case (cq2smsgq (RecvMsg p q m # s) q) of
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   702
                                         Some sq \<Rightarrow> Some (S_msgq sq)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   703
                                       | _       \<Rightarrow> None)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   704
                     else co2sobj s obj
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   705
      | O_proc p' \<Rightarrow> if (info_flow_shm s p p' \<and> O_msg q m \<in> Tainted s)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   706
                     then (case (cp2sproc s p') of
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   707
                             Some sp \<Rightarrow> Some (S_proc sp True)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   708
                           | _       \<Rightarrow> None)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   709
                     else co2sobj s obj
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   710
      | _         \<Rightarrow> co2sobj s obj)"
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   711
apply (frule vt_grant_os, frule vd_cons, case_tac obj)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   712
apply (simp_all add:current_files_simps is_dir_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   713
apply (auto split:if_splits option.splits dest!:current_file_has_sfile' current_proc_has_sp'
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   714
             simp:current_files_simps cf2sfiles_simps cf2sfile_simps cp2sproc_simps tainted_eq_Tainted
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   715
                  same_inode_files_prop6
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   716
             dest!:current_has_smsgq'
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   717
             dest:is_file_in_current is_dir_in_current cq2smsg_recvmsg)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   718
done
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   719
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   720
lemma co2sobj_removemsgq:
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   721
  "\<lbrakk>valid (RemoveMsgq p q # s); alive (RemoveMsgq p q # s) obj\<rbrakk> 
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   722
   \<Longrightarrow> co2sobj (RemoveMsgq p q # s) obj = co2sobj s obj"
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   723
apply (frule vt_grant_os, frule vd_cons, case_tac obj)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   724
apply (simp_all add:current_files_simps is_dir_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   725
apply (auto split:if_splits option.splits dest!:current_file_has_sfile' current_proc_has_sp'
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   726
             simp:current_files_simps cf2sfiles_simps cf2sfile_simps cp2sproc_simps tainted_eq_Tainted
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   727
                  same_inode_files_prop6
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   728
             dest!:current_has_smsgq'
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   729
             dest:is_file_in_current is_dir_in_current cq2smsg_removemsgq)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   730
done
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   731
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   732
lemma co2sobj_createshm:
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   733
  "\<lbrakk>valid (CreateShM p h # s); alive s obj\<rbrakk> \<Longrightarrow> co2sobj (CreateShM p h # s) obj = co2sobj s obj"
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   734
apply (frule vt_grant_os, frule vd_cons, case_tac obj)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   735
apply (simp_all add:current_files_simps is_dir_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   736
apply (auto split:if_splits option.splits dest!:current_file_has_sfile' current_proc_has_sp'
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   737
             simp:current_files_simps cf2sfiles_simps cf2sfile_simps cp2sproc_simps tainted_eq_Tainted
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   738
                  same_inode_files_prop6 ch2sshm_simps
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   739
             dest!:current_shm_has_sh'
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   740
             dest:is_file_in_current is_dir_in_current)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   741
done
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   742
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   743
lemma co2sobj_detach:
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   744
  "\<lbrakk>valid (Detach p h # s); alive s obj\<rbrakk> \<Longrightarrow> co2sobj (Detach p h # s) obj = (
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   745
      case obj of
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   746
        O_proc p' \<Rightarrow> if (p' = p) then (case (cp2sproc (Detach p h # s) p) of
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   747
                                         Some sp \<Rightarrow> Some (S_proc sp (O_proc p \<in> Tainted s))
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   748
                                       | _       \<Rightarrow> None)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   749
                     else co2sobj s obj
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   750
      | _         \<Rightarrow> co2sobj s obj)"
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   751
apply (frule vt_grant_os, frule vd_cons, case_tac obj)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   752
apply (simp_all add:current_files_simps is_dir_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   753
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   754
apply (auto split:if_splits option.splits dest!:current_file_has_sfile' current_proc_has_sp'
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   755
             simp:current_files_simps cf2sfiles_simps cf2sfile_simps cp2sproc_simps tainted_eq_Tainted
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   756
                  same_inode_files_prop6 ch2sshm_simps
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   757
             dest!:current_shm_has_sh'
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   758
             dest:is_file_in_current is_dir_in_current)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   759
done
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   760
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   761
lemma co2sobj_deleteshm:
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   762
  "\<lbrakk>valid (DeleteShM p h # s); alive (DeleteShM p h # s) obj\<rbrakk> \<Longrightarrow> co2sobj (DeleteShM p h # s) obj = (
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   763
      case obj of
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   764
        O_proc p' \<Rightarrow> (case (cp2sproc (DeleteShM p h # s) p') of
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   765
                        Some sp \<Rightarrow> Some (S_proc sp (O_proc p' \<in> Tainted s))
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   766
                      | _       \<Rightarrow> None)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   767
      | _         \<Rightarrow> co2sobj s obj)"
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   768
apply (frule vt_grant_os, frule vd_cons, case_tac obj)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   769
apply (simp_all add:current_files_simps is_dir_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   770
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   771
apply (auto split:if_splits option.splits dest!:current_file_has_sfile' current_proc_has_sp'
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   772
             simp:current_files_simps cf2sfiles_simps cf2sfile_simps tainted_eq_Tainted
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   773
                  same_inode_files_prop6 ch2sshm_simps
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   774
             dest!:current_shm_has_sh' 
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   775
             dest:is_file_in_current is_dir_in_current)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   776
done
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   777
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   778
lemma co2sobj_attach:
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   779
  "\<lbrakk>valid (Attach p h flag # s); alive s obj\<rbrakk> \<Longrightarrow> co2sobj (Attach p h flag # s) obj = (
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   780
      case obj of
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   781
        O_proc p' \<Rightarrow> if (p' = p)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   782
                     then (case (cp2sproc (Attach p h flag # s) p) of
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   783
                             Some sp \<Rightarrow> Some (S_proc sp (O_proc p \<in> Tainted s \<or> 
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   784
              (\<exists> p'. O_proc p' \<in> Tainted s \<and> (p', SHM_RDWR) \<in> procs_of_shm s h)))
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   785
                           | _       \<Rightarrow> None)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   786
                     else if (\<exists> flag'. (p', flag') \<in> procs_of_shm s h)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   787
                          then (case (cp2sproc s p') of 
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   788
                                  Some sp \<Rightarrow> Some (S_proc sp (O_proc p' \<in> Tainted s \<or>
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   789
              (O_proc p \<in> Tainted s \<and> flag = SHM_RDWR)))
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   790
                                | _       \<Rightarrow> None)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   791
                          else co2sobj s obj
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   792
      | _         \<Rightarrow> co2sobj s obj)"
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   793
apply (frule vt_grant_os, frule vd_cons, case_tac obj)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   794
apply (simp_all add:current_files_simps is_dir_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   795
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   796
apply (rule conjI|rule impI|erule exE)+
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   797
apply (simp split:option.splits)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   798
apply (rule impI, frule current_proc_has_sp, simp)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   799
apply ((erule exE)+, auto simp:cp2sproc_attach tainted_eq_Tainted)[1]
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   800
apply (rule impI|rule conjI)+
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   801
apply (subgoal_tac "p \<in> current_procs (Attach p h flag # s)")
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   802
apply (drule_tac p = p in current_proc_has_sp, simp, erule exE)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   803
apply (auto simp:tainted_eq_Tainted)[1]
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   804
apply (simp, rule impI)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   805
apply (subgoal_tac "nat \<in> current_procs (Attach p h flag # s)")
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   806
apply (drule_tac p = nat in current_proc_has_sp, simp, erule exE)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   807
apply (drule_tac p = nat in current_proc_has_sp, simp, erule exE)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   808
apply (auto simp:cp2sproc_attach tainted_eq_Tainted)[1]
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   809
apply simp
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   810
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   811
apply (auto split:if_splits option.splits dest!:current_file_has_sfile' 
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   812
             simp:current_files_simps cf2sfiles_simps cf2sfile_simps tainted_eq_Tainted
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   813
                  same_inode_files_prop6 
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   814
             dest:is_file_in_current is_dir_in_current)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   815
done
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   816
37
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   817
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   818
lemma co2sobj_other:
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   819
  "\<lbrakk>valid (e # s); alive (e # s) obj; 
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   820
    \<forall> p f fds. e \<noteq> Execve p f fds;
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   821
    \<forall> p p' fds shms. e \<noteq> Clone p p' fds shms;
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   822
    \<forall> p p'. e \<noteq> Ptrace p p';
39
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   823
    \<forall> p f flags fd opt. e \<noteq> Open p f flags fd opt;
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   824
    \<forall> p fd. e \<noteq> ReadFile p fd;
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   825
    \<forall> p fd. e \<noteq> WriteFile p fd;
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   826
    \<forall> p fd. e \<noteq> CloseFd p fd;
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   827
    \<forall> p f. e \<noteq> UnLink p f;
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   828
    \<forall> p f. e \<noteq> Rmdir p f;
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   829
    \<forall> p f i. e \<noteq> Mkdir p f i;
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   830
    \<forall> p f f'. e \<noteq> LinkHard p f f';
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   831
    \<forall> p f len. e \<noteq> Truncate p f len;
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   832
    \<forall> p q. e \<noteq> CreateMsgq p q;
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   833
    \<forall> p q m. e \<noteq> SendMsg p q m;
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   834
    \<forall> p q m. e \<noteq> RecvMsg p q m;
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   835
    \<forall> p q. e \<noteq> RemoveMsgq p q;
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   836
    \<forall> p h. e \<noteq> CreateShM p h;
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   837
    \<forall> p h flag. e \<noteq> Attach p h flag;
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   838
    \<forall> p h. e \<noteq> Detach p h;
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   839
    \<forall> p h. e \<noteq> DeleteShM p h
37
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   840
   \<rbrakk> \<Longrightarrow> co2sobj (e # s) obj = co2sobj s obj"
39
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   841
apply (frule vt_grant, case_tac e)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   842
apply (auto intro:co2sobj_kill co2sobj_exit)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   843
done
37
029cccce84b4 remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
chunhan
parents: 36
diff changeset
   844
39
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   845
lemmas co2sobj_simps = co2sobj_execve co2sobj_clone co2sobj_ptrace co2sobj_open co2sobj_readfile
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   846
  co2sobj_writefile co2sobj_closefd co2sobj_unlink co2sobj_rmdir co2sobj_mkdir co2sobj_linkhard
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   847
  co2sobj_truncate co2sobj_kill co2sobj_exit co2sobj_createmsgq co2sobj_sendmsg co2sobj_recvmsg
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
   848
  co2sobj_removemsgq co2sobj_attach co2sobj_detach co2sobj_createshm co2sobj_deleteshm
35
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   849
33
6884b3c9284b fix bug of static.thy for the static of recvmsg case
chunhan
parents: 32
diff changeset
   850
(* simpset for s2ss*)
6884b3c9284b fix bug of static.thy for the static of recvmsg case
chunhan
parents: 32
diff changeset
   851
6884b3c9284b fix bug of static.thy for the static of recvmsg case
chunhan
parents: 32
diff changeset
   852
lemma s2ss_execve:
34
e7f850d1e08e remove O_msg from co2sobj/init_obj2sobj
chunhan
parents: 33
diff changeset
   853
  "valid (Execve p f fds # s) \<Longrightarrow> s2ss (Execve p f fds # s) = (
e7f850d1e08e remove O_msg from co2sobj/init_obj2sobj
chunhan
parents: 33
diff changeset
   854
     if (\<exists> p'. p' \<noteq> p \<and> p' \<in> current_procs s \<and> co2sobj s (O_proc p') = co2sobj s (O_proc p))
35
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   855
     then (case (cp2sproc (Execve p f fds # s) p) of
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   856
             Some sp \<Rightarrow> s2ss s \<union> {S_proc sp (O_proc p \<in> Tainted s \<or> O_file f \<in> Tainted s)}
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   857
           | _ \<Rightarrow> s2ss s)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   858
     else (case (cp2sproc (Execve p f fds # s) p) of
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   859
             Some sp \<Rightarrow> s2ss s - {S_proc sp (O_proc p \<in> Tainted s)}
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   860
                              \<union> {S_proc sp (O_proc p \<in> Tainted s \<or> O_file f \<in> Tainted s)}
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   861
           | _ \<Rightarrow> s2ss s) )"
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   862
apply (frule vd_cons, frule vt_grant_os, simp split:if_splits)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   863
apply (rule conjI, clarify)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   864
apply (frule_tac p = p in current_proc_has_sp, simp, erule exE)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   865
apply (frule_tac p = p' in current_proc_has_sp, simp, erule exE)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   866
apply (simp, (erule conjE)+)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   867
apply (split option.splits, rule conjI, rule impI, drule current_proc_has_sp', simp, simp)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   868
apply (rule allI, rule impI)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   869
apply (rule set_eqI, rule iffI)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   870
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   871
apply (simp split:option.splits)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   872
apply (frule_tac p = p and s = "Execve p f fds # s" in current_proc_has_sp)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   873
thm current_proc_has_sp
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   874
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   875
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   876
apply (simp split:option.splits)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   877
apply (drule current_proc_has_sp', simp, simp)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   878
apply (rule conjI, rule impI, drule current_proc_has_sp', simp, simp)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   879
apply (simp add:s2ss_def)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   880
apply (rule allI|rule impI)+
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   881
apply (rule set_eqI, rule iffI)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   882
apply (auto simp:alive_simps)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   883
apply (case_tac obj, auto split:option.splits simp:cp2sproc_execve)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   884
apply (auto split:if_splits)