simple_selinux/Current_prop.thy
changeset 74 271e9818b6f6
child 75 99af1986e1e0
equal deleted inserted replaced
73:924ab7a4e7fa 74:271e9818b6f6
       
     1 (*<*)
       
     2 theory Current_prop
       
     3 imports Main Flask_type Flask My_list_prefix Init_prop Valid_prop Delete_prop
       
     4 begin
       
     5 (*>*)
       
     6 
       
     7 context flask begin
       
     8 
       
     9 lemma procs_of_shm_prop1: "\<lbrakk> p_flag \<in> procs_of_shm s h; valid s\<rbrakk> \<Longrightarrow> h \<in> current_shms s"
       
    10 apply (induct s arbitrary:p_flag)
       
    11 apply (case_tac p_flag, simp, drule init_procs_has_shm, simp)
       
    12 apply (frule vd_cons, frule vt_grant_os)
       
    13 apply (case_tac a, auto split:if_splits option.splits)
       
    14 done
       
    15 
       
    16 lemma procs_of_shm_prop2: "\<lbrakk>(p, flag) \<in> procs_of_shm s h; valid s\<rbrakk> \<Longrightarrow> p \<in> current_procs s"
       
    17 apply (induct s arbitrary:p flag)
       
    18 apply (simp, drule init_procs_has_shm, simp)
       
    19 apply (frule vd_cons, frule vt_grant_os)
       
    20 apply (case_tac a, auto split:if_splits option.splits)
       
    21 done
       
    22 
       
    23 lemma procs_of_shm_prop2':
       
    24   "\<lbrakk>p \<notin> current_procs s; valid s\<rbrakk> \<Longrightarrow> \<forall> flag h. (p, flag) \<notin> procs_of_shm s h"
       
    25 by (auto dest:procs_of_shm_prop2)
       
    26 
       
    27 lemma procs_of_shm_prop3: "\<lbrakk>(p, flag) \<in> procs_of_shm s h; (p, flag') \<in> procs_of_shm s h; valid s\<rbrakk>
       
    28   \<Longrightarrow> flag = flag'"
       
    29 apply (induct s arbitrary:p flag flag')
       
    30 apply (simp, drule_tac flag = flag in init_procs_has_shm, drule_tac flag = flag' in init_procs_has_shm, simp)
       
    31 apply (frule vd_cons, frule vt_grant_os)
       
    32 apply (case_tac a, auto split:if_splits option.splits dest:procs_of_shm_prop2)
       
    33 done
       
    34 
       
    35 lemma procs_of_shm_prop4: "\<lbrakk>(p, flag) \<in> procs_of_shm s h; valid s\<rbrakk> \<Longrightarrow> flag_of_proc_shm s p h = Some flag"
       
    36 apply (induct s arbitrary:p flag)
       
    37 apply (simp, drule init_procs_has_shm, simp)
       
    38 apply (frule vd_cons, frule vt_grant_os)
       
    39 apply (case_tac a, auto split:if_splits option.splits dest:procs_of_shm_prop2)
       
    40 done
       
    41 
       
    42 lemma procs_of_shm_prop4':
       
    43   "\<lbrakk>flag_of_proc_shm s p h = None; valid s\<rbrakk> \<Longrightarrow> \<forall> flag. (p, flag) \<notin> procs_of_shm s h"
       
    44 by (auto dest:procs_of_shm_prop4)
       
    45 
       
    46 lemma not_init_intro_proc:
       
    47   "\<lbrakk>p \<notin> current_procs s; valid s\<rbrakk> \<Longrightarrow> deleted (O_proc p) s \<or> p \<notin> init_procs"
       
    48 using not_deleted_init_proc by auto
       
    49 
       
    50 lemma not_init_intro_proc':
       
    51   "\<lbrakk>p \<notin> current_procs s; valid s\<rbrakk> \<Longrightarrow> \<not> (\<not> deleted (O_proc p) s \<and> p \<in> init_procs)"
       
    52 using not_deleted_init_proc by auto
       
    53 
       
    54 lemma info_shm_flow_in_procs:
       
    55   "\<lbrakk>info_flow_shm s p p'; valid s\<rbrakk> \<Longrightarrow> p \<in> current_procs s \<and> p' \<in> current_procs s"
       
    56 by (auto intro:procs_of_shm_prop2 simp:info_flow_shm_def one_flow_shm_def)
       
    57 
       
    58 lemma flag_of_proc_shm_prop1:
       
    59   "\<lbrakk>flag_of_proc_shm s p h = Some flag; valid s\<rbrakk> \<Longrightarrow> (p, flag) \<in> procs_of_shm s h"
       
    60 apply (induct s arbitrary:p flag)
       
    61 apply (simp, drule init_shmflag_has_proc, simp)
       
    62 apply (frule vd_cons, frule vt_grant_os)
       
    63 apply (case_tac a, auto split:if_splits option.splits dest:procs_of_shm_prop2)
       
    64 done
       
    65 
       
    66 
       
    67 
       
    68 lemma has_same_inode_in_current:
       
    69   "\<lbrakk>has_same_inode s f f'; valid s\<rbrakk> \<Longrightarrow> f \<in> current_files s \<and> f' \<in> current_files s"
       
    70 by (auto simp add:has_same_inode_def current_files_def same_inode_files_def 
       
    71   is_file_def split:if_splits option.splits)
       
    72 
       
    73 
       
    74 lemma has_same_inode_prop1:
       
    75   "\<lbrakk>has_same_inode s f f'; is_file s f; valid s\<rbrakk> \<Longrightarrow> is_file s f'"
       
    76 by (auto simp:has_same_inode_def same_inode_files_def is_file_def)
       
    77 
       
    78 lemma has_same_inode_prop1':
       
    79   "\<lbrakk>has_same_inode s f f'; is_file s f'; valid s\<rbrakk> \<Longrightarrow> is_file s f"
       
    80 by (auto simp:has_same_inode_def is_file_def same_inode_files_def 
       
    81  split:if_splits option.splits)
       
    82 
       
    83 lemma has_same_inode_prop2:
       
    84   "\<lbrakk>has_same_inode s f f'; file_of_proc_fd s p fd = Some f; valid s\<rbrakk> \<Longrightarrow> is_file s f'"
       
    85 apply (drule has_same_inode_prop1)
       
    86 apply (simp add:file_of_pfd_is_file, simp+)
       
    87 done
       
    88 
       
    89 lemma has_same_inode_prop2':
       
    90   "\<lbrakk>has_same_inode s f f'; file_of_proc_fd s p fd = Some f'; valid s\<rbrakk> \<Longrightarrow> is_file s f"
       
    91 apply (drule has_same_inode_prop1')
       
    92 apply (simp add:file_of_pfd_is_file, simp+)
       
    93 done
       
    94 
       
    95 lemma tobj_in_init_alive:
       
    96   "tobj_in_init obj \<Longrightarrow> init_alive obj"
       
    97 by (case_tac obj, auto)
       
    98 
       
    99 lemma tobj_in_alive:
       
   100   "tobj_in_init obj \<Longrightarrow> alive [] obj"
       
   101 by (case_tac obj, auto simp:is_file_nil)
       
   102 
       
   103 end
       
   104 
       
   105 end