S2ss_prop.thy
author chunhan
Mon, 02 Sep 2013 11:12:42 +0800
changeset 36 1397b2a763ab
parent 35 f2e620d799cf
child 37 029cccce84b4
permissions -rw-r--r--
done with cf2sfiles simpset
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
35
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   140
(* simpset for cf2sfiles *)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   141
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   142
lemma cf2sfiles_open:
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   143
  "\<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
   144
   \<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
   145
     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
   146
     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
   147
             Some sf \<Rightarrow> {sf}  
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   148
           | _       \<Rightarrow> {} )
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   149
     else cf2sfiles s f')"
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   150
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
   151
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
   152
  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
   153
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
   154
done
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   155
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   156
lemma cf2sfiles_other:
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   157
  "\<lbrakk>valid (e # s);
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   158
    \<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
   159
    \<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
   160
    \<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
   161
    \<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
   162
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
   163
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
   164
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
   165
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
   166
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
   167
  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
   168
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
   169
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
   170
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   171
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
   172
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
   173
  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
   174
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
   175
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
   176
done
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   177
36
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   178
lemma cf2sfile_linkhard1':
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   179
  "\<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
   180
   \<Longrightarrow> cf2sfile (LinkHard p oldf f# s) f' = cf2sfile s f'"
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   181
apply (drule same_inode_files_prop1)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   182
by (simp add:cf2sfile_linkhard1)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   183
35
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   184
lemma cf2sfiles_linkhard:
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   185
  "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
   186
     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
   187
     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
   188
             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
   189
           | _       \<Rightarrow> {})
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   190
     else cf2sfiles s f')"
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   191
apply (frule vt_grant_os, frule vd_cons, rule ext)
36
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   192
apply (auto simp:cf2sfiles_def cf2sfile_linkhard1' same_inode_files_linkhard current_files_linkhard 
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   193
  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
   194
done
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   195
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   196
lemma cf2sfile_unlink':
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   197
  "\<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
   198
   \<Longrightarrow> cf2sfile (UnLink p f # s) f' = cf2sfile s f'"
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   199
apply (drule same_inode_files_prop1)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   200
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
   201
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   202
lemma cf2sfiles_unlink:
36
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   203
  "\<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
   204
     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
   205
         (\<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
   206
        (case (cf2sfile s f) of 
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   207
           Some sf \<Rightarrow> cf2sfiles s f' - {sf}
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   208
         | _       \<Rightarrow> {})
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   209
     else cf2sfiles s f')"
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   210
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
   211
apply (rule conjI, clarify, frule is_file_has_sfile', simp, erule exE, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   212
apply (simp add:cf2sfiles_def, rule set_eqI, rule iffI, drule CollectD)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   213
apply (erule bexE, frule_tac f' = f' in same_inode_files_unlink)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   214
apply (simp add:current_files_unlink, simp, erule conjE)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   215
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
   216
apply (simp add:current_files_unlink same_inode_files_prop1, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   217
apply (rule_tac x = f'a in bexI, simp, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   218
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
   219
apply (erule conjE|erule exE|erule bexE)+
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   220
apply (case_tac "f'a = f", simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   221
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
   222
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
   223
apply (rule_tac x = f'a in bexI, simp, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   224
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   225
apply (rule impI)+
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   226
apply (simp add:cf2sfiles_def, rule set_eqI, rule iffI, drule CollectD)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   227
apply (erule bexE, frule_tac f' = f' in same_inode_files_unlink)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   228
apply (simp add:current_files_unlink, simp, (erule conjE)+)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   229
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
   230
apply (simp add:current_files_unlink same_inode_files_prop1, simp, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   231
apply (drule CollectD, erule bexE, frule_tac f' = f' in same_inode_files_unlink)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   232
apply (simp add:current_files_unlink, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   233
apply (case_tac "f'a = f", simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   234
apply (frule_tac f = f' and f' = f in same_inode_files_prop5, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   235
apply (erule bexE, erule conjE)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   236
apply (rule_tac x = f'' in bexI)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   237
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
   238
apply (simp, simp, erule same_inode_files_prop4, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   239
apply (rule_tac x = f'a in bexI)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   240
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
   241
apply (simp, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   242
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   243
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   244
apply (simp add:cf2sfiles_def, rule set_eqI, rule iffI, drule CollectD)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   245
apply (erule bexE, frule_tac f' = f' in same_inode_files_unlink)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   246
apply (simp add:current_files_unlink, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   247
apply (rule_tac x = f'a in bexI)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   248
apply (frule_tac f' = f'a in cf2sfile_unlink)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   249
apply (simp add:same_inode_files_prop1 current_files_unlink, simp, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   250
apply (drule CollectD, erule bexE, frule_tac f' = f' in same_inode_files_unlink)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   251
apply (simp add:current_files_unlink, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   252
apply (rule_tac x = f'a in bexI)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   253
apply (frule_tac f' = f'a in cf2sfile_unlink)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   254
apply (simp add:same_inode_files_prop1 current_files_unlink, simp, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   255
done
35
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   256
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   257
lemma cf2sfiles_closefd:
36
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   258
  "\<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
   259
     case (file_of_proc_fd s p fd) of
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   260
       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
   261
                    (\<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
   262
                 then (case (cf2sfile s f) of 
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   263
                         Some sf \<Rightarrow> cf2sfiles s f' - {sf}
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   264
                       | _       \<Rightarrow> {})
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   265
                 else cf2sfiles s f'
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   266
     | _       \<Rightarrow> cf2sfiles s f')"
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   267
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   268
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
   269
apply (simp_all add:current_files_simps split:if_splits)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   270
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   271
apply (simp add:cf2sfiles_def, rule set_eqI, rule iffI, drule CollectD)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   272
apply (erule bexE, frule_tac f' = f' in same_inode_files_closefd)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   273
apply (simp add:current_files_closefd, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   274
apply (rule_tac x = f'a in bexI)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   275
apply (frule_tac f = f'a in cf2sfile_closefd)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   276
apply (simp add:same_inode_files_prop1 current_files_closefd, simp, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   277
apply (drule CollectD, erule bexE, frule_tac f' = f' in same_inode_files_closefd)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   278
apply (simp add:current_files_closefd, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   279
apply (rule_tac x = f'a in bexI)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   280
apply (frule_tac f = f'a in cf2sfile_closefd)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   281
apply (simp add:same_inode_files_prop1 current_files_closefd, simp, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   282
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   283
apply (rule conjI, clarify, frule file_of_pfd_is_file, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   284
apply (frule is_file_has_sfile', simp, erule exE, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   285
apply (simp add:cf2sfiles_def, rule set_eqI, rule iffI, drule CollectD)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   286
apply (erule bexE, frule_tac f' = f' in same_inode_files_closefd)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   287
apply (simp add:current_files_closefd, simp, erule conjE)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   288
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
   289
apply (simp add:current_files_closefd same_inode_files_prop1, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   290
apply (rule_tac x = f'a in bexI, simp, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   291
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
   292
apply (erule conjE|erule exE|erule bexE)+
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   293
apply (case_tac "f'a = a", simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   294
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
   295
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
   296
apply (rule_tac x = f'a in bexI, simp, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   297
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   298
apply (rule impI)+
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   299
apply (simp add:cf2sfiles_def, rule set_eqI, rule iffI, drule CollectD)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   300
apply (erule bexE, frule_tac f' = f' in same_inode_files_closefd)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   301
apply (simp add:current_files_closefd, simp, (erule conjE)+)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   302
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
   303
apply (simp add:current_files_closefd same_inode_files_prop1, simp, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   304
apply (drule CollectD, erule bexE, frule_tac f' = f' in same_inode_files_closefd)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   305
apply (simp add:current_files_closefd, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   306
apply (case_tac "f'a = a", simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   307
apply (frule_tac f = f' and f' = a in same_inode_files_prop5, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   308
apply (erule bexE, erule conjE)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   309
apply (rule_tac x = f'' in bexI)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   310
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
   311
apply (simp, simp, erule same_inode_files_prop4, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   312
apply (rule_tac x = f'a in bexI)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   313
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
   314
apply (simp, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   315
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   316
apply (rule conjI, clarify)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   317
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   318
apply (rule impI)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   319
apply (case_tac "a \<in> files_hung_by_del s", simp_all)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   320
apply (simp add:cf2sfiles_def, rule set_eqI, rule iffI, drule CollectD)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   321
apply (erule bexE, frule_tac f' = f' in same_inode_files_closefd)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   322
apply (simp add:current_files_closefd, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   323
apply (rule_tac x = f'a in bexI)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   324
apply (frule_tac f = f'a in cf2sfile_closefd)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   325
apply (simp add:same_inode_files_prop1 current_files_closefd, simp, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   326
apply (drule CollectD, erule bexE, frule_tac f' = f' in same_inode_files_closefd)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   327
apply (simp add:current_files_closefd, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   328
apply (rule_tac x = f'a in bexI)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   329
apply (frule_tac f = f'a in cf2sfile_closefd)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   330
apply (simp add:same_inode_files_prop1 current_files_closefd, simp, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   331
apply (simp add:cf2sfiles_def, rule set_eqI, rule iffI, drule CollectD)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   332
apply (erule bexE, frule_tac f' = f' in same_inode_files_closefd)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   333
apply (simp add:current_files_closefd, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   334
apply (rule_tac x = f'a in bexI)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   335
apply (frule_tac f = f'a in cf2sfile_closefd)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   336
apply (simp add:same_inode_files_prop1 current_files_closefd, simp, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   337
apply (drule CollectD, erule bexE, frule_tac f' = f' in same_inode_files_closefd)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   338
apply (simp add:current_files_closefd, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   339
apply (rule_tac x = f'a in bexI)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   340
apply (frule_tac f = f'a in cf2sfile_closefd)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   341
apply (simp add:same_inode_files_prop1 current_files_closefd, simp, simp)
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   342
done
35
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   343
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   344
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
   345
  cf2sfiles_unlink cf2sfiles_closefd
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   346
  
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   347
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   348
(* simpset for co2sobj *)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   349
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   350
lemma co2sobj_execve:
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   351
  "\<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
   352
      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
   353
      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
   354
              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
   355
            | _       \<Rightarrow> None) 
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   356
      else co2sobj s obj )"
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   357
apply (frule vt_grant_os, frule vd_cons, case_tac obj)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   358
apply (simp_all add:current_files_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   359
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
   360
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
   361
apply (simp (no_asm_simp) add:cp2sproc_execve tainted_eq_Tainted split:option.splits)
36
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   362
apply (rule impI, simp add:cf2sfiles_other) 
35
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   363
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
   364
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
   365
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
   366
done
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   367
36
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   368
lemma co2sobj_
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   369
1397b2a763ab done with cf2sfiles simpset
chunhan
parents: 35
diff changeset
   370
35
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   371
end
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   372
33
6884b3c9284b fix bug of static.thy for the static of recvmsg case
chunhan
parents: 32
diff changeset
   373
(* simpset for s2ss*)
6884b3c9284b fix bug of static.thy for the static of recvmsg case
chunhan
parents: 32
diff changeset
   374
6884b3c9284b fix bug of static.thy for the static of recvmsg case
chunhan
parents: 32
diff changeset
   375
lemma s2ss_execve:
34
e7f850d1e08e remove O_msg from co2sobj/init_obj2sobj
chunhan
parents: 33
diff changeset
   376
  "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
   377
     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
   378
     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
   379
             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
   380
           | _ \<Rightarrow> s2ss s)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   381
     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
   382
             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
   383
                              \<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
   384
           | _ \<Rightarrow> s2ss s) )"
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   385
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
   386
apply (rule conjI, clarify)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   387
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
   388
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
   389
apply (simp, (erule conjE)+)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   390
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
   391
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
   392
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
   393
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   394
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
   395
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
   396
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
   397
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   398
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   399
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
   400
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
   401
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
   402
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
   403
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
   404
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
   405
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
   406
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
   407
apply (auto split:if_splits)