no_shm_selinux/Enrich2.thy
author chunhan
Mon, 30 Dec 2013 12:01:09 +0800
changeset 84 cebdef333899
parent 83 e79e3a8a4ceb
child 85 1d1aa5bdd37d
permissions -rw-r--r--
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
82
chunhan
parents:
diff changeset
     1
theory Enrich
chunhan
parents:
diff changeset
     2
imports Main Flask Static Init_prop Valid_prop Tainted_prop Delete_prop Co2sobj_prop S2ss_prop S2ss_prop2
83
chunhan
parents: 82
diff changeset
     3
 Temp Enrich Proc_fd_of_file_prop
82
chunhan
parents:
diff changeset
     4
begin
chunhan
parents:
diff changeset
     5
chunhan
parents:
diff changeset
     6
context tainting_s begin
chunhan
parents:
diff changeset
     7
84
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
     8
(* \<And> *)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
     9
lemma current_proc_fds_in_curp:
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    10
  "\<lbrakk>fd \<in> current_proc_fds s p; valid s\<rbrakk> \<Longrightarrow> p \<in> current_procs s"
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    11
apply (induct s)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    12
apply (simp add:init_fds_of_proc_prop1)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    13
apply (frule vt_grant_os, frule vd_cons)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    14
apply (case_tac a, auto split:if_splits option.splits)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    15
done
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    16
82
chunhan
parents:
diff changeset
    17
lemma get_parentfs_ctxts_prop:
chunhan
parents:
diff changeset
    18
  "\<lbrakk>get_parentfs_ctxts s (a # f) = Some ctxts; sectxt_of_obj s (O_dir f) = Some ctxt; valid s\<rbrakk>
chunhan
parents:
diff changeset
    19
   \<Longrightarrow> ctxt \<in> set (ctxts)"
chunhan
parents:
diff changeset
    20
apply (induct f)
chunhan
parents:
diff changeset
    21
apply (auto split:option.splits)
chunhan
parents:
diff changeset
    22
done
chunhan
parents:
diff changeset
    23
chunhan
parents:
diff changeset
    24
lemma search_check_allp_intro:
chunhan
parents:
diff changeset
    25
  "\<lbrakk>search_check s sp pf; get_parentfs_ctxts s pf = Some ctxts; valid s; is_dir s pf\<rbrakk>
chunhan
parents:
diff changeset
    26
   \<Longrightarrow> search_check_allp sp (set ctxts)"
chunhan
parents:
diff changeset
    27
apply (case_tac pf)
chunhan
parents:
diff changeset
    28
apply (simp split:option.splits if_splits add:search_check_allp_def)
chunhan
parents:
diff changeset
    29
apply (rule ballI)
chunhan
parents:
diff changeset
    30
apply (auto simp:search_check_ctxt_def search_check_dir_def split:if_splits option.splits)
chunhan
parents:
diff changeset
    31
apply (auto simp:search_check_allp_def search_check_file_def)
chunhan
parents:
diff changeset
    32
apply (frule is_dir_not_file, simp)
chunhan
parents:
diff changeset
    33
done
chunhan
parents:
diff changeset
    34
chunhan
parents:
diff changeset
    35
lemma search_check_leveling_f:
chunhan
parents:
diff changeset
    36
  "\<lbrakk>search_check s sp pf; parent f = Some pf; is_file s f; valid s;
chunhan
parents:
diff changeset
    37
    sectxt_of_obj s (O_file f) = Some fctxt; search_check_file sp fctxt\<rbrakk>
chunhan
parents:
diff changeset
    38
   \<Longrightarrow> search_check s sp f"
chunhan
parents:
diff changeset
    39
apply (case_tac f, simp+)
chunhan
parents:
diff changeset
    40
apply (auto split:option.splits simp:search_check_ctxt_def)
chunhan
parents:
diff changeset
    41
apply (frule parentf_is_dir_prop2, simp)
chunhan
parents:
diff changeset
    42
apply (erule get_pfs_secs_prop, simp)
chunhan
parents:
diff changeset
    43
apply (erule_tac search_check_allp_intro, simp_all)
chunhan
parents:
diff changeset
    44
apply (simp add:parentf_is_dir_prop2)
chunhan
parents:
diff changeset
    45
done
chunhan
parents:
diff changeset
    46
84
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    47
lemma enrich_proc_dup_ffds':
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    48
  "\<lbrakk>fd \<notin> current_proc_fds (enrich_proc s p p') p'; is_created_proc s p; p' \<notin> all_procs s; no_del_event s; valid s\<rbrakk>
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    49
   \<Longrightarrow> fd \<notin> proc_file_fds s p \<and> file_of_proc_fd s p fd = None"
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    50
apply (auto simp:enrich_proc_dup_ffds_eq_fds)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    51
apply (simp add:proc_file_fds_def)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    52
done
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    53
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    54
lemma enrich_proc_cur_inof:
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    55
  "\<lbrakk>valid s; no_del_event s\<rbrakk> \<Longrightarrow> inum_of_file (enrich_proc s p p') f = inum_of_file s f"
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    56
apply (induct s arbitrary:f)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    57
apply simp
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    58
apply (frule vd_cons, frule vt_grant_os, frule vt_grant)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    59
apply (case_tac a, auto)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    60
apply (auto split:option.splits simp del:grant.simps)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    61
done
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    62
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    63
lemma not_all_procs_sock:
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    64
  "\<lbrakk>p' \<notin> all_procs s; valid s\<rbrakk> \<Longrightarrow> inum_of_socket s (p', fd) = None"
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    65
apply (frule not_all_procs_prop3)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    66
apply (case_tac "inum_of_socket s (p', fd)", simp_all)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    67
apply (drule cn_in_curp', simp+)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    68
done
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    69
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    70
lemma enrich_proc_cur_inos:
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    71
  "\<lbrakk>valid s; no_del_event s; p' \<notin> all_procs s\<rbrakk> 
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    72
   \<Longrightarrow> inum_of_socket (enrich_proc s p p') (tp, fd) = inum_of_socket s (tp, fd)"
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    73
apply (induct s arbitrary:tp)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    74
apply simp
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    75
apply (frule vd_cons, frule vt_grant_os)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    76
apply (case_tac a, auto split:option.splits simp:not_all_procs_sock)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    77
apply (simp add:proc_file_fds_def, erule exE)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    78
apply (case_tac "inum_of_socket s (nat1, fd)", simp_all)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    79
apply (drule filefd_socket_conflict, simp_all add:current_sockets_def)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    80
done
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    81
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    82
lemma enrich_proc_cur_inums:
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    83
  "\<lbrakk>p' \<notin> all_procs s; no_del_event s; valid s\<rbrakk>
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    84
   \<Longrightarrow> current_inode_nums (enrich_proc s p p') = current_inode_nums s"
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    85
apply (auto simp:current_inode_nums_def current_file_inums_def 
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    86
  current_sock_inums_def enrich_proc_cur_inof enrich_proc_cur_inos)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    87
done
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    88
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    89
lemma enrich_proc_cur_itag:
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    90
  "\<lbrakk>valid s; no_del_event s; p' \<notin> all_procs s\<rbrakk> 
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    91
   \<Longrightarrow> itag_of_inum (enrich_proc s p p') i = itag_of_inum s i"
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    92
apply (induct s)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    93
apply simp
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    94
apply (frule vd_cons, frule vt_grant_os)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    95
apply (case_tac a, auto split:option.splits t_socket_type.splits)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    96
done
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    97
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    98
lemma enrich_proc_cur_tcps:
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
    99
  "\<lbrakk>valid s; no_del_event s; p' \<notin> all_procs s\<rbrakk> 
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   100
   \<Longrightarrow> is_tcp_sock (enrich_proc s p p') = is_tcp_sock s"
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   101
apply (rule ext, case_tac x)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   102
apply (auto simp add:is_tcp_sock_def enrich_proc_cur_itag enrich_proc_cur_inos
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   103
  split:option.splits t_inode_tag.splits)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   104
done
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   105
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   106
lemma enrich_proc_cur_udps:
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   107
  "\<lbrakk>valid s; no_del_event s; p' \<notin> all_procs s\<rbrakk> 
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   108
   \<Longrightarrow> is_udp_sock (enrich_proc s p p') = is_udp_sock s"
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   109
apply (rule ext, case_tac x)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   110
apply (auto simp add:is_udp_sock_def enrich_proc_cur_itag enrich_proc_cur_inos
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   111
  split:option.splits t_inode_tag.splits)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   112
done
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   113
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   114
lemma enrich_proc_cur_msgqs:
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   115
  "valid s \<Longrightarrow> current_msgqs (enrich_proc s p p') = current_msgqs s"
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   116
apply (induct s, simp)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   117
apply (frule vt_grant_os, frule vd_cons)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   118
apply (case_tac a, auto)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   119
done
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   120
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   121
lemma enrich_proc_cur_msgs:
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   122
  "valid s \<Longrightarrow> msgs_of_queue (enrich_proc s p p') q = msgs_of_queue s q "
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   123
apply (induct s, simp)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   124
apply (frule vt_grant_os, frule vd_cons)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   125
apply (case_tac a, auto)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   126
done
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   127
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   128
lemma enrich_proc_cur_procs:
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   129
  "\<lbrakk>p' \<notin> all_procs s; no_del_event s; is_created_proc s p; valid s\<rbrakk> 
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   130
   \<Longrightarrow> current_procs (enrich_proc s p p') = current_procs s \<union> {p'}"
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   131
apply (induct s, simp add:is_created_proc_def)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   132
apply (frule vt_grant_os, frule vd_cons)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   133
apply (case_tac a, auto simp:is_created_proc_simps)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   134
done
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   135
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   136
lemma enrich_proc_cur_files:
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   137
  "\<lbrakk>valid s; no_del_event s\<rbrakk> \<Longrightarrow> current_files (enrich_proc s p p') = current_files s"
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   138
apply (auto simp:current_files_def)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   139
apply (simp add: enrich_proc_cur_inof)+
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   140
done
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   141
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   142
lemma enrich_proc_cur_fds1:
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   143
  "\<lbrakk>p' \<notin> all_procs s; no_del_event s; is_created_proc s p; valid s; tp \<in> current_procs s\<rbrakk>
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   144
   \<Longrightarrow> current_proc_fds (enrich_proc s p p') tp = current_proc_fds s tp"
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   145
apply (induct s, simp add:is_created_proc_def)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   146
apply (frule vt_grant_os, frule vd_cons)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   147
apply (frule not_all_procs_prop3)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   148
apply (case_tac a)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   149
apply (auto simp:is_created_proc_simps)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   150
done
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   151
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   152
lemma enrich_proc_cur_fds1':
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   153
  "\<lbrakk>p' \<notin> all_procs s; no_del_event s; is_created_proc s p; valid s; tp \<noteq> p'\<rbrakk>
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   154
   \<Longrightarrow> current_proc_fds (enrich_proc s p p') tp = current_proc_fds s tp"
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   155
apply (induct s, simp add:is_created_proc_def)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   156
apply (frule vt_grant_os, frule vd_cons)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   157
apply (frule not_all_procs_prop3)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   158
apply (case_tac a)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   159
apply (auto simp:is_created_proc_simps)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   160
done
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   161
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   162
lemma enrich_proc_cur_fds:
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   163
  "\<lbrakk>p' \<notin> all_procs s; no_del_event s; is_created_proc s p; valid s\<rbrakk>
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   164
   \<Longrightarrow> current_proc_fds (enrich_proc s p p') tp = (if (tp = p') then proc_file_fds s p else current_proc_fds s tp)"
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   165
apply (simp add:enrich_proc_cur_fds1' enrich_proc_dup_ffds_eq_fds split:if_splits)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   166
done
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   167
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   168
lemma enrich_proc_not_alive:
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   169
  "\<lbrakk>enrich_not_alive s (E_proc p') obj; is_created_proc s p; p' \<notin> all_procs s; no_del_event s; valid s\<rbrakk>
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   170
  \<Longrightarrow> enrich_not_alive (enrich_proc s p p') (E_proc p') obj"
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   171
apply (case_tac obj)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   172
apply (simp_all add:enrich_proc_cur_procs enrich_proc_cur_files enrich_proc_cur_inums 
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   173
  enrich_proc_cur_msgqs enrich_proc_cur_msgs enrich_proc_cur_fds)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   174
done
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   175
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   176
lemma enrich_proc_filefd:
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   177
  "\<lbrakk>file_of_proc_fd s tp fd = Some f; is_created_proc s p; p' \<notin> all_procs s; no_del_event s; valid s\<rbrakk>
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   178
  \<Longrightarrow> file_of_proc_fd (enrich_proc s p p') tp fd = Some f"
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   179
apply (induct s arbitrary:tp, simp add:is_created_proc_def)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   180
apply (frule vt_grant_os, frule vd_cons)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   181
apply (frule not_all_procs_prop3)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   182
apply (case_tac a)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   183
apply (auto simp:is_created_proc_simps dest:proc_fd_in_procs split:if_splits)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   184
done
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   185
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   186
lemma enrich_proc_flagfd:
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   187
  "\<lbrakk>flags_of_proc_fd s tp fd = Some f; is_created_proc s p; p' \<notin> all_procs s; no_del_event s; valid s\<rbrakk>
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   188
  \<Longrightarrow> flags_of_proc_fd (enrich_proc s p p') tp fd = Some f"
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   189
apply (induct s arbitrary:tp, simp add:is_created_proc_def)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   190
apply (frule vt_grant_os, frule vd_cons)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   191
apply (frule not_all_procs_prop3)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   192
apply (case_tac a)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   193
apply (auto simp:is_created_proc_simps dest:proc_fd_in_procs current_fflag_has_ffd split:if_splits option.splits)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   194
done
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   195
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   196
lemma enrich_proc_hungs:
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   197
  "\<lbrakk>valid s; no_del_event s\<rbrakk> \<Longrightarrow> files_hung_by_del (enrich_proc s p p') = files_hung_by_del s"
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   198
apply (induct s, simp)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   199
apply (frule vt_grant_os, frule vd_cons)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   200
apply (case_tac a, auto simp:files_hung_by_del.simps)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   201
done
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   202
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   203
lemma enrich_proc_is_file:
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   204
  "\<lbrakk>valid s; no_del_event s; p' \<notin> all_procs s\<rbrakk> 
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   205
   \<Longrightarrow> is_file (enrich_proc s p p') = is_file s"
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   206
apply (rule ext, case_tac x)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   207
apply (auto simp add:is_file_def enrich_proc_cur_itag enrich_proc_cur_inof
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   208
  split:option.splits t_inode_tag.splits)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   209
done
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   210
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   211
lemma enrich_proc_is_dir:
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   212
  "\<lbrakk>valid s; no_del_event s; p' \<notin> all_procs s\<rbrakk> 
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   213
   \<Longrightarrow> is_dir (enrich_proc s p p') = is_dir s"
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   214
apply (rule ext, case_tac x)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   215
apply (auto simp add:is_dir_def enrich_proc_cur_itag enrich_proc_cur_inof
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   216
  split:option.splits t_inode_tag.splits)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   217
done
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   218
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   219
lemma enrich_proc_alive:
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   220
  "\<lbrakk>alive s obj; valid s; is_created_proc s p; p' \<notin> all_procs s; no_del_event s\<rbrakk>
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   221
   \<Longrightarrow> alive (enrich_proc s p p') obj"
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   222
apply (case_tac obj)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   223
apply (simp_all add:enrich_proc_is_file enrich_proc_is_dir enrich_proc_cur_msgqs 
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   224
  enrich_proc_cur_msgs enrich_proc_cur_procs enrich_proc_cur_fds
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   225
  enrich_proc_cur_tcps enrich_proc_cur_udps)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   226
apply (rule impI, simp)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   227
apply (drule current_proc_fds_in_curp, simp, simp add:not_all_procs_prop3)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   228
done
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   229
82
chunhan
parents:
diff changeset
   230
lemma enrich_proc_prop:
84
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   231
  "\<lbrakk>valid s; is_created_proc s p; p' \<notin> all_procs s; no_del_event s\<rbrakk>
82
chunhan
parents:
diff changeset
   232
   \<Longrightarrow> valid (enrich_proc s p p') \<and> 
chunhan
parents:
diff changeset
   233
       (\<forall> tp. tp \<in> current_procs s \<longrightarrow> cp2sproc (enrich_proc s p p') tp = cp2sproc s tp) \<and>
chunhan
parents:
diff changeset
   234
       (\<forall> f. f \<in> current_files s \<longrightarrow> cf2sfile (enrich_proc s p p') f = cf2sfile s f) \<and> 
chunhan
parents:
diff changeset
   235
       (\<forall> q. q \<in> current_msgqs s \<longrightarrow> cq2smsgq (enrich_proc s p p') q = cq2smsgq s q) \<and> 
chunhan
parents:
diff changeset
   236
       (\<forall> tp fd. fd \<in> proc_file_fds s tp \<longrightarrow> cfd2sfd (enrich_proc s p p') tp fd = cfd2sfd s tp fd) \<and>
chunhan
parents:
diff changeset
   237
       (cp2sproc (enrich_proc s p p') p' = cp2sproc s p) \<and>
chunhan
parents:
diff changeset
   238
       (\<forall> fd. fd \<in> proc_file_fds s p \<longrightarrow> cfd2sfd (enrich_proc s p p') p' fd = cfd2sfd s p fd)"
chunhan
parents:
diff changeset
   239
proof (induct s)
chunhan
parents:
diff changeset
   240
  case Nil
chunhan
parents:
diff changeset
   241
  thus ?case by (auto simp:is_created_proc_def)
chunhan
parents:
diff changeset
   242
next
chunhan
parents:
diff changeset
   243
  case (Cons e s)
83
chunhan
parents: 82
diff changeset
   244
  hence vd_cons': "valid (e # s)" and created_cons: "is_created_proc (e # s) p"
82
chunhan
parents:
diff changeset
   245
    and all_procs_cons: "p' \<notin> all_procs (e # s)" and vd: "valid s" 
84
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   246
    and os: "os_grant s e" and grant: "grant s e" 
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   247
    and nodel_cons: "no_del_event (e # s)"
83
chunhan
parents: 82
diff changeset
   248
    by (auto dest:vd_cons' vt_grant_os vt_grant)
82
chunhan
parents:
diff changeset
   249
  from all_procs_cons have all_procs: "p' \<notin> all_procs s" by (case_tac e, auto)
84
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   250
  from nodel_cons have nodel: "no_del_event s" by (case_tac e, auto)
82
chunhan
parents:
diff changeset
   251
  from Cons have pre: "is_created_proc s p \<Longrightarrow> valid (enrich_proc s p p') \<and>
chunhan
parents:
diff changeset
   252
     (\<forall>tp. tp \<in> current_procs s \<longrightarrow> cp2sproc (enrich_proc s p p') tp = cp2sproc s tp) \<and>
chunhan
parents:
diff changeset
   253
     (\<forall>f. f \<in> current_files s \<longrightarrow> cf2sfile (enrich_proc s p p') f = cf2sfile s f) \<and>
chunhan
parents:
diff changeset
   254
     (\<forall>q. q \<in> current_msgqs s \<longrightarrow> cq2smsgq (enrich_proc s p p') q = cq2smsgq s q) \<and>
chunhan
parents:
diff changeset
   255
     (\<forall>tp fd. fd \<in> proc_file_fds s tp \<longrightarrow> cfd2sfd (enrich_proc s p p') tp fd = cfd2sfd s tp fd) \<and>     
chunhan
parents:
diff changeset
   256
     (cp2sproc (enrich_proc s p p') p' = cp2sproc s p) \<and>
chunhan
parents:
diff changeset
   257
     (\<forall> fd. fd \<in> proc_file_fds s p \<longrightarrow> cfd2sfd (enrich_proc s p p') p' fd = cfd2sfd s p fd)"
84
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   258
    using vd all_procs nodel by auto
82
chunhan
parents:
diff changeset
   259
  have vd_enrich_cons: "valid (enrich_proc (e # s) p p')"
chunhan
parents:
diff changeset
   260
  proof-
chunhan
parents:
diff changeset
   261
    from pre have pre': "is_created_proc s p \<Longrightarrow> valid (enrich_proc s p p')" by simp
chunhan
parents:
diff changeset
   262
    have "is_created_proc s p \<Longrightarrow> valid (e # enrich_proc s p p')" 
chunhan
parents:
diff changeset
   263
      apply (frule pre')
84
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   264
      apply (erule_tac s = s and obj' = "E_proc p'" in enrich_valid_intro_cons)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   265
      apply (simp_all add: pre nodel_cons all_procs_cons vd_cons')
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   266
      apply (clarsimp simp:enrich_proc_alive nodel all_procs vd)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   267
      apply (rule allI, rule impI, erule enrich_proc_not_alive)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   268
      apply (simp_all add:nodel all_procs vd enrich_proc_hungs enrich_proc_cur_msgs)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   269
      apply ((rule allI| rule impI)+, erule enrich_proc_filefd)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   270
      apply (simp_all add:nodel all_procs vd)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   271
      apply ((rule allI| rule impI)+, erule enrich_proc_flagfd)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   272
      apply (simp_all add:nodel all_procs vd)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   273
      done
82
chunhan
parents:
diff changeset
   274
    moreover have "\<And>f fds. \<lbrakk>valid (Execve p f fds # enrich_proc s p p'); is_created_proc s p; 
chunhan
parents:
diff changeset
   275
      valid (Execve p f fds # s); p' \<notin> all_procs s\<rbrakk>
chunhan
parents:
diff changeset
   276
      \<Longrightarrow> valid (Execve p' f (fds \<inter> proc_file_fds s p) # Execve p f fds # enrich_proc s p p')"
chunhan
parents:
diff changeset
   277
    proof-
chunhan
parents:
diff changeset
   278
      fix f fds
chunhan
parents:
diff changeset
   279
      assume a1: "valid (Execve p f fds # enrich_proc s p p')" and a2: "is_created_proc s p"
chunhan
parents:
diff changeset
   280
        and a3: "valid (Execve p f fds # s)" and a0: "p' \<notin> all_procs s"
chunhan
parents:
diff changeset
   281
      have cp2sp: "\<forall> tp. tp \<in> current_procs s \<longrightarrow> cp2sproc (enrich_proc s p p') tp = cp2sproc s tp"
chunhan
parents:
diff changeset
   282
        and cf2sf: "\<forall> tf. tf \<in> current_files s \<longrightarrow> cf2sfile (enrich_proc s p p') tf = cf2sfile s tf"
chunhan
parents:
diff changeset
   283
        and cfd2sfd: "\<forall> tp tfd. tfd \<in> proc_file_fds s tp \<longrightarrow> cfd2sfd (enrich_proc s p p') tp tfd = cfd2sfd s tp tfd"
chunhan
parents:
diff changeset
   284
        and dup_sp: "cp2sproc (enrich_proc s p p') p' = cp2sproc s p"
chunhan
parents:
diff changeset
   285
        and dup_sfd: "\<forall> fd. fd \<in> proc_file_fds s p \<longrightarrow> cfd2sfd (enrich_proc s p p') p' fd = cfd2sfd s p fd"
84
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   286
        using pre a2
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   287
        by auto
82
chunhan
parents:
diff changeset
   288
      show "valid (Execve p' f (fds \<inter> proc_file_fds s p) # Execve p f fds # enrich_proc s p p')"
chunhan
parents:
diff changeset
   289
      proof-
chunhan
parents:
diff changeset
   290
        from a0 a3 have a0': "p' \<noteq> p" by (auto dest!:vt_grant_os not_all_procs_prop3)
chunhan
parents:
diff changeset
   291
        from a3 have grant: "grant s (Execve p f fds)" and os: "os_grant s (Execve p f fds)"
chunhan
parents:
diff changeset
   292
          by (auto dest:vt_grant_os vt_grant simp del:os_grant.simps)
84
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   293
        have f_in: "is_file (enrich_proc s p p') f"
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   294
          using vd nodel os all_procs
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   295
          by (auto dest:vt_grant_os simp:enrich_proc_is_file)
82
chunhan
parents:
diff changeset
   296
        moreover have a5: "proc_file_fds s p \<subseteq> proc_file_fds (Execve p f fds # enrich_proc s p p') p'" 
chunhan
parents:
diff changeset
   297
          using a3 a0'
chunhan
parents:
diff changeset
   298
          apply (frule_tac vt_grant_os)
chunhan
parents:
diff changeset
   299
          apply (auto simp:proc_file_fds_def)
chunhan
parents:
diff changeset
   300
          apply (rule_tac x = fa in exI)
chunhan
parents:
diff changeset
   301
          apply (erule enrich_proc_dup_ffd)
chunhan
parents:
diff changeset
   302
          apply (simp_all add:vd all_procs a2)
chunhan
parents:
diff changeset
   303
          done
chunhan
parents:
diff changeset
   304
        ultimately have "os_grant (Execve p f fds # enrich_proc s p p') (Execve p' f (fds \<inter> proc_file_fds s p))"
chunhan
parents:
diff changeset
   305
          apply (auto simp:is_file_simps enrich_proc_dup_in a2 vd all_procs a1 enrich_proc_dup_ffds)
chunhan
parents:
diff changeset
   306
          done
chunhan
parents:
diff changeset
   307
        moreover have "grant (Execve p f fds # enrich_proc s p p') (Execve p' f (fds \<inter> proc_file_fds s p))"
chunhan
parents:
diff changeset
   308
        proof-
chunhan
parents:
diff changeset
   309
          from grant obtain up rp tp uf rf tf 
chunhan
parents:
diff changeset
   310
            where p1: "sectxt_of_obj s (O_proc p) = Some (up, rp, tp)"
chunhan
parents:
diff changeset
   311
            and p2: "sectxt_of_obj s (O_file f) = Some (uf, rf, tf)" 
chunhan
parents:
diff changeset
   312
            by (simp split:option.splits, blast)
chunhan
parents:
diff changeset
   313
          with grant obtain pu nr nt where p3: "npctxt_execve (up, rp, tp) (uf, rf, tf) = Some (pu, nr, nt)"
chunhan
parents:
diff changeset
   314
            by (simp split:option.splits del:npctxt_execve.simps, blast)
chunhan
parents:
diff changeset
   315
          have p1': "sectxt_of_obj (Execve p f fds # enrich_proc s p p') (O_proc p') = Some (up, rp, tp)"
chunhan
parents:
diff changeset
   316
            using p1 dup_sp a1 a0'
chunhan
parents:
diff changeset
   317
            apply (simp add:sectxt_of_obj_simps)
chunhan
parents:
diff changeset
   318
            by (simp add:cp2sproc_def split:option.splits)
chunhan
parents:
diff changeset
   319
          from os have f_in': "is_file s f"  by simp 
chunhan
parents:
diff changeset
   320
          from vd os have "\<exists> sf. cf2sfile s f = Some sf"
chunhan
parents:
diff changeset
   321
            by (auto dest!:is_file_in_current current_file_has_sfile)
chunhan
parents:
diff changeset
   322
          hence p2': "sectxt_of_obj (Execve p f fds # enrich_proc s p p') (O_file f) = Some (uf, rf, tf)" 
chunhan
parents:
diff changeset
   323
            using f_in p2 cf2sf os a1
chunhan
parents:
diff changeset
   324
            apply (erule_tac x = f in allE)
chunhan
parents:
diff changeset
   325
            apply (auto dest:is_file_in_current simp:cf2sfile_def sectxt_of_obj_simps split:option.splits)
chunhan
parents:
diff changeset
   326
            apply (case_tac f, simp)
chunhan
parents:
diff changeset
   327
            apply (drule_tac s = s in root_is_dir', simp add:vd, simp+)
chunhan
parents:
diff changeset
   328
            done 
chunhan
parents:
diff changeset
   329
          from dup_sfd a5 have "\<forall>fd. fd \<in> proc_file_fds s p \<longrightarrow> 
chunhan
parents:
diff changeset
   330
            cfd2sfd (Execve p f fds # enrich_proc s p p') p' fd = cfd2sfd s p fd"
chunhan
parents:
diff changeset
   331
            apply (rule_tac allI)
chunhan
parents:
diff changeset
   332
            apply (erule_tac x = fd in allE, clarsimp)
chunhan
parents:
diff changeset
   333
            apply (drule set_mp, simp)
chunhan
parents:
diff changeset
   334
            apply (auto simp:cfd2sfd_execve proc_file_fds_def a1)
chunhan
parents:
diff changeset
   335
            done
chunhan
parents:
diff changeset
   336
          hence "inherit_fds_check (Execve p f fds # enrich_proc s p p') (up, nr, nt) p' (fds \<inter> proc_file_fds s p)"
chunhan
parents:
diff changeset
   337
            using grant os p1 p2 p3 vd
chunhan
parents:
diff changeset
   338
            apply (clarsimp)
chunhan
parents:
diff changeset
   339
            apply (rule_tac s = s and p = p and fds = fds in enrich_inherit_fds_check_dup)
chunhan
parents:
diff changeset
   340
            apply simp_all
chunhan
parents:
diff changeset
   341
            done
chunhan
parents:
diff changeset
   342
          moreover have "search_check (Execve p f fds # enrich_proc s p p') (up, rp, tp) f"
chunhan
parents:
diff changeset
   343
            using p1 p2 p2' vd cf2sf f_in f_in' grant p3 f_in a1
chunhan
parents:
diff changeset
   344
            apply (rule_tac s = s in enrich_search_check)
chunhan
parents:
diff changeset
   345
            apply (simp_all add:is_file_simps)
chunhan
parents:
diff changeset
   346
            apply (rule allI, rule impI, erule_tac x = fa in allE, simp)
chunhan
parents:
diff changeset
   347
            apply (drule_tac ff = fa in cf2sfile_other')
84
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   348
            apply (auto simp:a2 enrich_proc_cur_files nodel)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   349
            done
82
chunhan
parents:
diff changeset
   350
          ultimately show ?thesis 
chunhan
parents:
diff changeset
   351
            using p1' p2' p3
chunhan
parents:
diff changeset
   352
            apply (simp split:option.splits)
chunhan
parents:
diff changeset
   353
            using grant p1 p2
chunhan
parents:
diff changeset
   354
            apply simp
chunhan
parents:
diff changeset
   355
            done
chunhan
parents:
diff changeset
   356
        qed
chunhan
parents:
diff changeset
   357
        ultimately show ?thesis using a1
chunhan
parents:
diff changeset
   358
          by (erule_tac valid.intros(2), auto)
chunhan
parents:
diff changeset
   359
      qed
chunhan
parents:
diff changeset
   360
    qed
chunhan
parents:
diff changeset
   361
    moreover have "\<And>tp fds. \<lbrakk>valid (Clone tp p fds # s); p' \<noteq> p; p' \<notin> all_procs s\<rbrakk> \<Longrightarrow> 
chunhan
parents:
diff changeset
   362
      valid (Clone tp p' (fds \<inter> proc_file_fds s tp) # Clone tp p fds # s)"
chunhan
parents:
diff changeset
   363
      apply (frule vt_grant_os, frule vt_grant, drule not_all_procs_prop3)
chunhan
parents:
diff changeset
   364
      apply (rule valid.intros(2))
chunhan
parents:
diff changeset
   365
      apply (simp_all split:option.splits add:sectxt_of_obj_simps)
chunhan
parents:
diff changeset
   366
      apply (auto simp add:proc_file_fds_def)[1]
chunhan
parents:
diff changeset
   367
      apply (auto simp:inherit_fds_check_def sectxt_of_obj_simps sectxts_of_fds_def inherit_fds_check_ctxt_def)
chunhan
parents:
diff changeset
   368
      done
chunhan
parents:
diff changeset
   369
    moreover have "\<And>f flags fd opt. \<lbrakk>valid (Open p f flags fd opt # enrich_proc s p p'); 
chunhan
parents:
diff changeset
   370
      is_created_proc s p; valid (Open p f flags fd opt # s); p' \<notin> all_procs s\<rbrakk>
chunhan
parents:
diff changeset
   371
       \<Longrightarrow> valid (Open p' f (remove_create_flag flags) fd None # Open p f flags fd opt # enrich_proc s p p')"
chunhan
parents:
diff changeset
   372
    proof-
chunhan
parents:
diff changeset
   373
      fix f flags fd opt
chunhan
parents:
diff changeset
   374
      assume a1: "valid (Open p f flags fd opt # enrich_proc s p p')" and a2: "is_created_proc s p"
chunhan
parents:
diff changeset
   375
        and a3: "valid (Open p f flags fd opt # s)" and a4: "p' \<notin> all_procs s"
chunhan
parents:
diff changeset
   376
      have cp2sp: "\<forall> tp. tp \<in> current_procs s \<longrightarrow> cp2sproc (enrich_proc s p p') tp = cp2sproc s tp"
chunhan
parents:
diff changeset
   377
        and cf2sf: "\<forall> tf. tf \<in> current_files s \<longrightarrow> cf2sfile (enrich_proc s p p') tf = cf2sfile s tf"
chunhan
parents:
diff changeset
   378
        and cfd2sfd: "\<forall> tp tfd. tfd \<in> proc_file_fds s tp \<longrightarrow> cfd2sfd (enrich_proc s p p') tp tfd = cfd2sfd s tp tfd"
chunhan
parents:
diff changeset
   379
        and dup_sp: "cp2sproc (enrich_proc s p p') p' = cp2sproc s p"
chunhan
parents:
diff changeset
   380
        and dup_sfd: "\<forall> fd. fd \<in> proc_file_fds s p \<longrightarrow> cfd2sfd (enrich_proc s p p') p' fd = cfd2sfd s p fd"
chunhan
parents:
diff changeset
   381
        using pre a2 by auto
chunhan
parents:
diff changeset
   382
      from a4 a3 have a0: "p' \<noteq> p" by (auto dest!:vt_grant_os not_all_procs_prop3 split:option.splits)
chunhan
parents:
diff changeset
   383
      have a5: "p' \<in> current_procs (enrich_proc s p p')" 
chunhan
parents:
diff changeset
   384
        using a2 a3 vd
chunhan
parents:
diff changeset
   385
        apply (erule_tac enrich_proc_dup_in)
chunhan
parents:
diff changeset
   386
        by (simp_all add:vd a4)
chunhan
parents:
diff changeset
   387
      have a6: "is_file (Open p f flags fd opt # enrich_proc s p p') f"
chunhan
parents:
diff changeset
   388
        using a1 a3
chunhan
parents:
diff changeset
   389
        by (auto simp:is_file_open dest:vt_grant_os)
chunhan
parents:
diff changeset
   390
      have a7: "fd \<notin> current_proc_fds (enrich_proc s p p') p'"
84
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   391
        using a2 a4 vd nodel
82
chunhan
parents:
diff changeset
   392
        apply (simp add:enrich_proc_dup_ffds_eq_fds)
chunhan
parents:
diff changeset
   393
        apply (rule notI)
chunhan
parents:
diff changeset
   394
        apply (drule_tac p = p in file_fds_subset_pfds)
chunhan
parents:
diff changeset
   395
        apply (drule set_mp, simp)
chunhan
parents:
diff changeset
   396
        using a3
chunhan
parents:
diff changeset
   397
        apply (drule_tac vt_grant_os)
chunhan
parents:
diff changeset
   398
        apply (auto split:option.splits)
chunhan
parents:
diff changeset
   399
        done
chunhan
parents:
diff changeset
   400
      from a1 have a8: "valid (enrich_proc s p p')" by (erule_tac valid.cases, auto)
chunhan
parents:
diff changeset
   401
      from a3 have grant: "grant s (Open p f flags fd opt)" and os: "os_grant s (Open p f flags fd opt)"
chunhan
parents:
diff changeset
   402
        by (auto dest:vt_grant_os vt_grant)
chunhan
parents:
diff changeset
   403
      show "valid (Open p' f (remove_create_flag flags) fd None # Open p f flags fd opt # enrich_proc s p p')"
chunhan
parents:
diff changeset
   404
      proof (cases opt)
chunhan
parents:
diff changeset
   405
        case None
84
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   406
        have f_in: "is_file (enrich_proc s p p') f"
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   407
          using vd nodel os all_procs None
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   408
          by (auto dest:vt_grant_os simp:enrich_proc_is_file) 
82
chunhan
parents:
diff changeset
   409
        from grant None obtain up rp tp uf rf tf 
chunhan
parents:
diff changeset
   410
          where p1: "sectxt_of_obj s (O_proc p) = Some (up, rp, tp)"
chunhan
parents:
diff changeset
   411
          and p2: "sectxt_of_obj s (O_file f) = Some (uf, rf, tf)" 
chunhan
parents:
diff changeset
   412
          apply (simp split:option.splits)
chunhan
parents:
diff changeset
   413
          by (case_tac a, case_tac aa, blast)
chunhan
parents:
diff changeset
   414
        have p1': "sectxt_of_obj (Open p f flags fd opt # enrich_proc s p p') (O_proc p') = Some (up, rp, tp)"
chunhan
parents:
diff changeset
   415
          using p1 dup_sp a1
chunhan
parents:
diff changeset
   416
          apply (simp add:sectxt_of_obj_simps)
chunhan
parents:
diff changeset
   417
          by (simp add:cp2sproc_def split:option.splits)
chunhan
parents:
diff changeset
   418
        from os None have f_in': "is_file s f" by simp 
chunhan
parents:
diff changeset
   419
        from vd os None have "\<exists> sf. cf2sfile s f = Some sf"
chunhan
parents:
diff changeset
   420
          by (auto dest!:is_file_in_current current_file_has_sfile)
chunhan
parents:
diff changeset
   421
        hence p2': "sectxt_of_obj (Open p f flags fd opt # enrich_proc s p p') (O_file f) = Some (uf, rf, tf)" 
chunhan
parents:
diff changeset
   422
          using p2 cf2sf os a1 None f_in' vd f_in
chunhan
parents:
diff changeset
   423
          apply (erule_tac x = f in allE)
chunhan
parents:
diff changeset
   424
          apply (auto dest:is_file_in_current simp:cf2sfile_def sectxt_of_obj_simps split:option.splits)
chunhan
parents:
diff changeset
   425
          apply (case_tac f, simp)
chunhan
parents:
diff changeset
   426
          apply (drule_tac s = s in root_is_dir', simp add:vd, simp+)
chunhan
parents:
diff changeset
   427
          done 
chunhan
parents:
diff changeset
   428
        have "search_check (Open p f flags fd opt # enrich_proc s p p') (up, rp, tp) f"
chunhan
parents:
diff changeset
   429
          using p1 p2 p2' vd cf2sf f_in f_in' grant f_in a1 None
chunhan
parents:
diff changeset
   430
          apply (rule_tac s = s in enrich_search_check)
chunhan
parents:
diff changeset
   431
          apply (simp_all add:is_file_simps)
chunhan
parents:
diff changeset
   432
          apply (rule allI, rule impI, erule_tac x = fa in allE, simp)
chunhan
parents:
diff changeset
   433
          apply (simp add:cf2sfile_open_none)
chunhan
parents:
diff changeset
   434
          done
chunhan
parents:
diff changeset
   435
        thus ?thesis using a0 a5 a6 a7 None a1
chunhan
parents:
diff changeset
   436
          apply (rule_tac valid.intros(2))
chunhan
parents:
diff changeset
   437
          apply (simp_all add:a1)
chunhan
parents:
diff changeset
   438
          apply (case_tac flags, simp add:is_creat_excl_flag_def)
chunhan
parents:
diff changeset
   439
          using p1' p2'
chunhan
parents:
diff changeset
   440
          apply simp
chunhan
parents:
diff changeset
   441
          using grant p1 p2
chunhan
parents:
diff changeset
   442
          apply (simp add:oflags_check_remove_create)
chunhan
parents:
diff changeset
   443
          done
chunhan
parents:
diff changeset
   444
      next
chunhan
parents:
diff changeset
   445
        case (Some inum)
chunhan
parents:
diff changeset
   446
        with os obtain pf where parent: "parent f = Some pf" by auto
chunhan
parents:
diff changeset
   447
        with grant Some obtain pu rp pt pfu pfr pft where
chunhan
parents:
diff changeset
   448
          p1: "sectxt_of_obj s (O_proc p) = Some (pu, rp, pt)" 
chunhan
parents:
diff changeset
   449
          and p2: "sectxt_of_obj s (O_dir pf) = Some (pfu, pfr, pft)"
chunhan
parents:
diff changeset
   450
          apply (simp split:option.splits)
chunhan
parents:
diff changeset
   451
          apply (case_tac a, case_tac aa, blast)
chunhan
parents:
diff changeset
   452
          done
chunhan
parents:
diff changeset
   453
        from p1 have p1': "sectxt_of_obj (enrich_proc s p p') (O_proc p) = Some (pu, rp, pt)"
chunhan
parents:
diff changeset
   454
          using cp2sp os
chunhan
parents:
diff changeset
   455
          apply (erule_tac x = p in allE)
chunhan
parents:
diff changeset
   456
          apply (auto split:option.splits simp:cp2sproc_def)
chunhan
parents:
diff changeset
   457
          done
chunhan
parents:
diff changeset
   458
        from os parent Some
chunhan
parents:
diff changeset
   459
        have pf_in: "is_dir s pf" by auto
chunhan
parents:
diff changeset
   460
        hence "\<exists> sf. cf2sfile s pf = Some sf" using vd
chunhan
parents:
diff changeset
   461
          by (auto dest!:is_dir_in_current current_file_has_sfile)
chunhan
parents:
diff changeset
   462
        from a1 parent Some have pf_in': "is_dir (enrich_proc s p p') pf" 
chunhan
parents:
diff changeset
   463
          apply (frule_tac vt_grant_os)
chunhan
parents:
diff changeset
   464
          by (clarsimp)
chunhan
parents:
diff changeset
   465
        have p2': "sectxt_of_obj (enrich_proc s p p') (O_dir pf) = Some (pfu, pfr, pft)"
chunhan
parents:
diff changeset
   466
        proof-
chunhan
parents:
diff changeset
   467
          have "cf2sfile (enrich_proc s p p') pf = cf2sfile s pf"
chunhan
parents:
diff changeset
   468
            using cf2sf pf_in
chunhan
parents:
diff changeset
   469
            apply (drule_tac is_dir_in_current)
chunhan
parents:
diff changeset
   470
            apply (erule_tac x = pf in allE)
chunhan
parents:
diff changeset
   471
            by simp
chunhan
parents:
diff changeset
   472
          with pf_in pf_in' p2 vd Some a8
chunhan
parents:
diff changeset
   473
          show ?thesis            
chunhan
parents:
diff changeset
   474
            apply (frule_tac is_dir_not_file)
chunhan
parents:
diff changeset
   475
            apply (frule_tac s = "enrich_proc s p p'" in is_dir_not_file)
chunhan
parents:
diff changeset
   476
            apply (simp add:cf2sfile_def)
chunhan
parents:
diff changeset
   477
            apply (case_tac pf, simp) 
chunhan
parents:
diff changeset
   478
            apply (simp add:sroot_def root_sec_remains)            
chunhan
parents:
diff changeset
   479
            by (auto split:option.splits dest!:current_has_sec' get_pfs_secs_prop' dest:parentf_is_dir_prop1)        
chunhan
parents:
diff changeset
   480
        qed
chunhan
parents:
diff changeset
   481
        from p1 have dup: "sectxt_of_obj (Open p f flags fd (Some inum) # enrich_proc s p p') (O_proc p') 
chunhan
parents:
diff changeset
   482
          = Some (pu, rp, pt)"
chunhan
parents:
diff changeset
   483
          using a1 Some
chunhan
parents:
diff changeset
   484
          apply (simp add:sec_open)
chunhan
parents:
diff changeset
   485
          using dup_sp
chunhan
parents:
diff changeset
   486
          apply (auto split:option.splits if_splits simp:cp2sproc_def)
chunhan
parents:
diff changeset
   487
          done        
chunhan
parents:
diff changeset
   488
        have nsf: "sectxt_of_obj (Open p f flags fd (Some inum) # enrich_proc s p p') (O_file f) 
chunhan
parents:
diff changeset
   489
          = Some (pu, R_object, type_transition pt pft C_file True)"
chunhan
parents:
diff changeset
   490
          using a1 Some p1 p2 parent p2' p1'
chunhan
parents:
diff changeset
   491
          by (simp add:sec_open)
chunhan
parents:
diff changeset
   492
        have "search_check (Open p f flags fd (Some inum) # enrich_proc s p p') (pu, rp, pt) f"
chunhan
parents:
diff changeset
   493
        proof-
chunhan
parents:
diff changeset
   494
          have "search_check (Open p f flags fd (Some inum) # enrich_proc s p p') (pu, rp, pt) pf"
chunhan
parents:
diff changeset
   495
            using grant Some parent p1 p2 vd a1 pf_in pf_in' p2'
chunhan
parents:
diff changeset
   496
            apply simp 
chunhan
parents:
diff changeset
   497
            apply (rule_tac s = s in enrich_search_check') 
chunhan
parents:
diff changeset
   498
            apply (simp_all add:is_dir_simps sectxt_of_obj_simps)
chunhan
parents:
diff changeset
   499
            apply (rule allI, rule impI)
chunhan
parents:
diff changeset
   500
            apply (case_tac "fa = f")
chunhan
parents:
diff changeset
   501
            using os Some
chunhan
parents:
diff changeset
   502
            apply simp
chunhan
parents:
diff changeset
   503
            apply (drule_tac f' = fa in cf2sfile_open)
chunhan
parents:
diff changeset
   504
            apply (simp add:current_files_simps)
84
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   505
            using enrich_proc_cur_files a2 nodel
82
chunhan
parents:
diff changeset
   506
            apply simp
chunhan
parents:
diff changeset
   507
            apply simp
chunhan
parents:
diff changeset
   508
            using cf2sf
chunhan
parents:
diff changeset
   509
            apply simp
chunhan
parents:
diff changeset
   510
            done
chunhan
parents:
diff changeset
   511
          moreover have "is_file (Open p f flags fd (Some inum) # enrich_proc s p p') f"
chunhan
parents:
diff changeset
   512
            using a1 Some
chunhan
parents:
diff changeset
   513
            by (simp add:is_file_open)
chunhan
parents:
diff changeset
   514
          ultimately 
chunhan
parents:
diff changeset
   515
          show ?thesis
chunhan
parents:
diff changeset
   516
            using parent a1 Some nsf
chunhan
parents:
diff changeset
   517
            apply (erule_tac search_check_leveling_f)
chunhan
parents:
diff changeset
   518
            apply (simp_all)
chunhan
parents:
diff changeset
   519
            apply (simp add:search_check_file_def)
chunhan
parents:
diff changeset
   520
            apply (simp add:permission_check.simps)
chunhan
parents:
diff changeset
   521
            sorry
chunhan
parents:
diff changeset
   522
        qed
chunhan
parents:
diff changeset
   523
        thus ?thesis using a0 a5 a6 a7 a1 Some
chunhan
parents:
diff changeset
   524
          apply (rule_tac valid.intros(2))
chunhan
parents:
diff changeset
   525
          apply (simp add:a1)
chunhan
parents:
diff changeset
   526
          apply simp
chunhan
parents:
diff changeset
   527
          apply (case_tac flags, simp add:is_creat_excl_flag_def)
chunhan
parents:
diff changeset
   528
          using grant p1 p2 parent dup nsf
chunhan
parents:
diff changeset
   529
          apply (simp add:oflags_check_remove_create)
chunhan
parents:
diff changeset
   530
          done
chunhan
parents:
diff changeset
   531
      qed
chunhan
parents:
diff changeset
   532
    qed
chunhan
parents:
diff changeset
   533
    moreover have "\<And>fd. \<lbrakk>valid (CloseFd p fd # enrich_proc s p p'); is_created_proc s p; 
chunhan
parents:
diff changeset
   534
      valid (CloseFd p fd # s); p' \<notin> all_procs s; fd \<in> proc_file_fds s p\<rbrakk>
chunhan
parents:
diff changeset
   535
      \<Longrightarrow> valid (CloseFd p' fd # CloseFd p fd # enrich_proc s p p')"
chunhan
parents:
diff changeset
   536
    proof-
chunhan
parents:
diff changeset
   537
      fix fd
chunhan
parents:
diff changeset
   538
      assume a1: "valid (CloseFd p fd # enrich_proc s p p')" and a2: "is_created_proc s p" 
chunhan
parents:
diff changeset
   539
        and a3: "p' \<notin> all_procs s" and a4: "valid (CloseFd p fd # s)"
chunhan
parents:
diff changeset
   540
        and a5: "fd \<in> proc_file_fds s p"
chunhan
parents:
diff changeset
   541
      from a4 a3 have a0: "p' \<noteq> p" by (auto dest!:vt_grant_os not_all_procs_prop3)
chunhan
parents:
diff changeset
   542
      have "p' \<in> current_procs (enrich_proc s p p')" 
chunhan
parents:
diff changeset
   543
        using a2 a3 vd
chunhan
parents:
diff changeset
   544
        by (auto intro:enrich_proc_dup_in)
chunhan
parents:
diff changeset
   545
      moreover have "fd \<in> current_proc_fds (enrich_proc s p p') p'"      
84
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   546
        using a5 a2 a3 vd pre' nodel
82
chunhan
parents:
diff changeset
   547
        apply (simp)
chunhan
parents:
diff changeset
   548
        apply (drule_tac s = "enrich_proc s p p'" and p = p' in file_fds_subset_pfds)
chunhan
parents:
diff changeset
   549
        apply (erule set_mp)
chunhan
parents:
diff changeset
   550
        apply (simp add:enrich_proc_dup_ffds)
chunhan
parents:
diff changeset
   551
        done
chunhan
parents:
diff changeset
   552
      ultimately show "valid (CloseFd p' fd # CloseFd p fd # enrich_proc s p p')"
chunhan
parents:
diff changeset
   553
        apply (rule_tac valid.intros(2))
chunhan
parents:
diff changeset
   554
        apply (simp_all add:a1 a0 a2 pre')
chunhan
parents:
diff changeset
   555
        done
chunhan
parents:
diff changeset
   556
    qed
chunhan
parents:
diff changeset
   557
    moreover have "\<And> fd. \<lbrakk>valid (ReadFile p fd # enrich_proc s p p');
chunhan
parents:
diff changeset
   558
            is_created_proc s p; valid (ReadFile p fd # s); p' \<notin> all_procs s\<rbrakk>
chunhan
parents:
diff changeset
   559
           \<Longrightarrow> valid (ReadFile p' fd # ReadFile p fd # enrich_proc s p p')"
chunhan
parents:
diff changeset
   560
    proof-
chunhan
parents:
diff changeset
   561
      fix fd
chunhan
parents:
diff changeset
   562
      assume a1: "valid (ReadFile p fd # enrich_proc s p p')" and a2: "is_created_proc s p"
chunhan
parents:
diff changeset
   563
        and a3: "valid (ReadFile p fd # s)" and a4: "p' \<notin> all_procs s"
chunhan
parents:
diff changeset
   564
      from a3 have os: "os_grant s (ReadFile p fd)" and grant: "grant s (ReadFile p fd)"
chunhan
parents:
diff changeset
   565
        by (auto dest:vt_grant_os vt_grant)
chunhan
parents:
diff changeset
   566
      have cp2sp: "\<forall> tp. tp \<in> current_procs s \<longrightarrow> cp2sproc (enrich_proc s p p') tp = cp2sproc s tp"
chunhan
parents:
diff changeset
   567
        and cf2sf: "\<forall> tf. tf \<in> current_files s \<longrightarrow> cf2sfile (enrich_proc s p p') tf = cf2sfile s tf"
chunhan
parents:
diff changeset
   568
        and cfd2sfd: "\<forall> tp tfd. tfd \<in> proc_file_fds s tp \<longrightarrow> cfd2sfd (enrich_proc s p p') tp tfd = cfd2sfd s tp tfd"
chunhan
parents:
diff changeset
   569
        and dup_sp: "cp2sproc (enrich_proc s p p') p' = cp2sproc s p"
chunhan
parents:
diff changeset
   570
        and dup_sfd: "\<forall> fd. fd \<in> proc_file_fds s p \<longrightarrow> cfd2sfd (enrich_proc s p p') p' fd = cfd2sfd s p fd"
chunhan
parents:
diff changeset
   571
        using pre a2 by auto
chunhan
parents:
diff changeset
   572
      have vd_enrich: "valid (enrich_proc s p p')" using a1 by (auto dest:valid.cases)
chunhan
parents:
diff changeset
   573
      show "valid (ReadFile p' fd # ReadFile p fd # enrich_proc s p p')"
chunhan
parents:
diff changeset
   574
      proof-
chunhan
parents:
diff changeset
   575
        have "os_grant (ReadFile p fd # enrich_proc s p p') (ReadFile p' fd)"
84
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   576
          using a1 a2 a4 vd os nodel
82
chunhan
parents:
diff changeset
   577
          apply (clarsimp simp:current_files_simps enrich_proc_dup_in enrich_proc_dup_ffds_eq_fds)
chunhan
parents:
diff changeset
   578
          apply (simp add:proc_file_fds_def)
chunhan
parents:
diff changeset
   579
          apply (rule conjI)
chunhan
parents:
diff changeset
   580
          apply (rule_tac x = f in exI, simp add:enrich_proc_dup_ffd)
84
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   581
          using enrich_proc_cur_files
82
chunhan
parents:
diff changeset
   582
          apply (simp)
chunhan
parents:
diff changeset
   583
          apply (drule enrich_proc_dup_fflags)
chunhan
parents:
diff changeset
   584
          apply simp_all
chunhan
parents:
diff changeset
   585
          apply (erule disjE)
chunhan
parents:
diff changeset
   586
          apply auto
chunhan
parents:
diff changeset
   587
          apply (simp add:is_read_flag_def)
chunhan
parents:
diff changeset
   588
          done
chunhan
parents:
diff changeset
   589
        moreover have "grant (ReadFile p fd # enrich_proc s p p') (ReadFile p' fd)"
chunhan
parents:
diff changeset
   590
        proof-
chunhan
parents:
diff changeset
   591
          from grant obtain f sp sfd sf where p1: "file_of_proc_fd s p fd = Some f"
chunhan
parents:
diff changeset
   592
            and p2: "sectxt_of_obj s (O_proc p) = Some sp" 
chunhan
parents:
diff changeset
   593
            and p3: "sectxt_of_obj s (O_fd p fd) = Some sfd"
chunhan
parents:
diff changeset
   594
            and p4: "sectxt_of_obj s (O_file f) = Some sf"
chunhan
parents:
diff changeset
   595
            by (auto split:option.splits) 
chunhan
parents:
diff changeset
   596
          from os obtain flag where p0: "flags_of_proc_fd s p fd = Some flag"
chunhan
parents:
diff changeset
   597
            by auto
chunhan
parents:
diff changeset
   598
          from os have f_in_s: "f \<in> current_files s" using p1 by simp
chunhan
parents:
diff changeset
   599
          from p1 vd have isfile_s: "is_file s f" by (erule_tac file_of_pfd_is_file, simp)
84
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   600
          hence isfile_s': "is_file (enrich_proc s p p') f"
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   601
            using vd nodel all_procs a2
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   602
            by (auto simp:enrich_proc_is_file) 
82
chunhan
parents:
diff changeset
   603
          from p0 obtain flag' where p0': "flags_of_proc_fd (enrich_proc s p p') p' fd = Some flag'"
chunhan
parents:
diff changeset
   604
            and p0'': "(flag' = flag) \<or> (flag' = remove_create_flag flag)"
chunhan
parents:
diff changeset
   605
            using a2 a4 vd
chunhan
parents:
diff changeset
   606
            apply (drule_tac enrich_proc_dup_fflags)
chunhan
parents:
diff changeset
   607
            apply auto
chunhan
parents:
diff changeset
   608
            apply (case_tac flag, auto)
chunhan
parents:
diff changeset
   609
            apply (case_tac flag, auto)
chunhan
parents:
diff changeset
   610
            done            
chunhan
parents:
diff changeset
   611
          from p1 have p1': "file_of_proc_fd (enrich_proc s p p') p' fd = Some f"
chunhan
parents:
diff changeset
   612
            using a2 a4 vd
chunhan
parents:
diff changeset
   613
            by (simp add:enrich_proc_dup_ffd)
chunhan
parents:
diff changeset
   614
          from p2 have p2': "sectxt_of_obj (enrich_proc s p p') (O_proc p') = Some sp"
chunhan
parents:
diff changeset
   615
            using dup_sp
chunhan
parents:
diff changeset
   616
            by (auto simp:cp2sproc_def split:option.splits)
chunhan
parents:
diff changeset
   617
          from p3 p1 p1' p0 p0' os have p3': "sectxt_of_obj (enrich_proc s p p') (O_fd p' fd) = Some sfd"
chunhan
parents:
diff changeset
   618
            using dup_sfd
chunhan
parents:
diff changeset
   619
            apply (erule_tac x = fd in allE)
chunhan
parents:
diff changeset
   620
            apply (auto simp:proc_file_fds_def cfd2sfd_def split:option.splits)
chunhan
parents:
diff changeset
   621
            apply (drule current_file_has_sfile')
chunhan
parents:
diff changeset
   622
            apply (simp add:vd, simp)
chunhan
parents:
diff changeset
   623
            apply (drule current_file_has_sfile')
chunhan
parents:
diff changeset
   624
            apply (simp add:vd, simp)
chunhan
parents:
diff changeset
   625
            done
chunhan
parents:
diff changeset
   626
          from p4 have p4': "sectxt_of_obj (enrich_proc s p p') (O_file f) = Some sf" 
chunhan
parents:
diff changeset
   627
            using f_in_s cf2sf isfile_s isfile_s' a1 vd_enrich vd
chunhan
parents:
diff changeset
   628
            apply (erule_tac x = f in allE)
chunhan
parents:
diff changeset
   629
            apply (simp)
chunhan
parents:
diff changeset
   630
            apply (auto simp:cf2sfile_def split:option.splits 
chunhan
parents:
diff changeset
   631
              dest!:current_has_sec' get_pfs_secs_prop' dest:parentf_is_dir is_file_in_current)
chunhan
parents:
diff changeset
   632
            apply (case_tac f, simp, drule root_is_dir', simp, simp, simp)
chunhan
parents:
diff changeset
   633
            done
chunhan
parents:
diff changeset
   634
          show ?thesis using p1' p2' p3' p4' a1
chunhan
parents:
diff changeset
   635
            apply (simp add:sectxt_of_obj_simps)
chunhan
parents:
diff changeset
   636
            using grant p1 p2 p3 p4 
chunhan
parents:
diff changeset
   637
            apply simp
chunhan
parents:
diff changeset
   638
            done
chunhan
parents:
diff changeset
   639
        qed
chunhan
parents:
diff changeset
   640
        ultimately show ?thesis
chunhan
parents:
diff changeset
   641
          using a1
chunhan
parents:
diff changeset
   642
          by (erule_tac valid.intros(2), simp+)
chunhan
parents:
diff changeset
   643
      qed
chunhan
parents:
diff changeset
   644
    qed
chunhan
parents:
diff changeset
   645
    ultimately show ?thesis 
83
chunhan
parents: 82
diff changeset
   646
      using created_cons vd_cons' all_procs_cons
82
chunhan
parents:
diff changeset
   647
      apply (case_tac e)
chunhan
parents:
diff changeset
   648
      apply (auto simp:is_created_proc_simps split:if_splits)
chunhan
parents:
diff changeset
   649
      done
chunhan
parents:
diff changeset
   650
  qed
84
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   651
  moreover have "\<forall>tp fd. fd \<in> proc_file_fds (e # s) tp \<longrightarrow> 
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   652
    cfd2sfd (enrich_proc (e # s) p p') tp fd = cfd2sfd (e # s) tp fd"
83
chunhan
parents: 82
diff changeset
   653
  proof clarify
84
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   654
    fix tp fd 
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   655
    assume a1: "fd \<in> proc_file_fds (e # s) tp"
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   656
    from a1 obtain f where a1': "file_of_proc_fd (e # s) tp fd = Some f" 
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   657
      by (auto simp:proc_file_fds_def)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   658
    from pre have pre_sfd: "\<And> tp fd. \<lbrakk>fd \<in> proc_file_fds s tp; is_created_proc s p\<rbrakk> \<Longrightarrow>
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   659
      cfd2sfd (enrich_proc s p p') tp fd = cfd2sfd s tp fd" by auto
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   660
    hence pre_sfd': "\<And> tp fd f. \<lbrakk>file_of_proc_fd s tp fd = Some f; is_created_proc s p\<rbrakk> \<Longrightarrow>
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   661
      cfd2sfd (enrich_proc s p p') tp fd = cfd2sfd s tp fd" by (auto simp:proc_file_fds_def)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   662
    hence pre_sfd'': "\<And> tp fd f proc. \<lbrakk>file_of_proc_fd s tp fd = Some f; is_created_proc s p; p = proc\<rbrakk> \<Longrightarrow>
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   663
      cfd2sfd (enrich_proc s proc p') tp fd = cfd2sfd s tp fd" by (auto simp:proc_file_fds_def)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   664
    from a1' all_procs_cons vd_cons' have a2: "tp \<noteq> p'"
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   665
      apply (drule_tac not_all_procs_prop3)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   666
      apply (drule proc_fd_in_procs, simp)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   667
      by (rule notI, simp)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   668
    have a3: "p' \<noteq> p" using all_procs_cons created_cons
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   669
      apply (drule_tac not_all_procs_prop3)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   670
      apply (rule notI, simp add:is_created_proc_def)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   671
      done      
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   672
    have a4: "file_of_proc_fd (enrich_proc (e # s) p p') tp fd = Some f" 
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   673
      using a1' nodel_cons all_procs_cons a1' created_cons vd_cons'
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   674
      apply (frule_tac enrich_proc_filefd, simp_all)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   675
      done
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   676
    show "cfd2sfd (enrich_proc (e # s) p p') tp fd = cfd2sfd (e # s) tp fd"
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   677
    proof-
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   678
      have b1: "\<And> proc f' fds. e = Execve proc f' fds
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   679
        \<Longrightarrow> cfd2sfd (enrich_proc (e # s) p p') tp fd = cfd2sfd (e # s) tp fd"
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   680
        using a4 vd_enrich_cons a1' vd_cons' created_cons
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   681
        apply (simp split:if_splits del:file_of_proc_fd.simps add:a2) 
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   682
        apply (simp only:cfd2sfd_execve)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   683
        apply (drule_tac s = "Execve proc f' fds # enrich_proc s proc p'" in vd_cons)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   684
        apply (simp split:if_splits add:a2)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   685
        apply (drule_tac p' = proc and fd' = fd and s = "enrich_proc s proc p'" in cfd2sfd_execve, simp+)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   686
        apply (erule_tac pre_sfd'', simp add:is_created_proc_simps, simp)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   687
        apply (drule_tac p' = tp and fd' = fd in cfd2sfd_execve, simp+)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   688
        apply (erule_tac pre_sfd'', simp add:is_created_proc_simps, simp)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   689
        apply (simp only:cfd2sfd_execve)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   690
        apply (rule_tac pre_sfd')
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   691
        apply (auto split:if_splits simp:is_created_proc_simps)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   692
        done 
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   693
      have b2: "\<And> proc proc' fds. e = Clone proc proc' fds
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   694
       \<Longrightarrow> cfd2sfd (enrich_proc (e # s) p p') tp fd = cfd2sfd (e # s) tp fd"
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   695
        using a4 vd_enrich_cons a1' vd_cons' created_cons
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   696
        apply (simp split:if_splits del:file_of_proc_fd.simps) 
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   697
        apply (simp add:cfd2sfd_clone add:a2)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   698
        apply (simp add:cfd2sfd_clone split:if_splits)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   699
        apply (erule pre_sfd'', simp add:is_created_proc_simps, simp)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   700
        apply (erule pre_sfd', simp add:is_created_proc_simps)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   701
        done 
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   702
      have b3: "\<And> proc f' flags fd' opt. e = Open proc f' flags fd' opt 
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   703
         \<Longrightarrow> cfd2sfd (enrich_proc (e # s) p p') tp fd = cfd2sfd (e # s) tp fd"
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   704
        apply (simp split:if_splits)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   705
        thm cfd2sfd_open
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   706
        sorry
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   707
      have b4: "\<And> proc fd'. e = ReadFile proc fd' 
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   708
         \<Longrightarrow> cfd2sfd (enrich_proc (e # s) p p') tp fd = cfd2sfd (e # s) tp fd"
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   709
        using a4 vd_enrich_cons a1' vd_cons' created_cons
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   710
        apply (simp split:if_splits del:file_of_proc_fd.simps) 
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   711
        apply (frule_tac s = "ReadFile proc fd' # enrich_proc s proc p'" in vd_cons)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   712
        apply (simp add:cfd2sfd_other)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   713
        apply (erule pre_sfd'', simp add:is_created_proc_simps, simp)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   714
        apply (simp add:cfd2sfd_other)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   715
        apply (erule pre_sfd', simp add:is_created_proc_simps)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   716
        done 
83
chunhan
parents: 82
diff changeset
   717
      show ?thesis
84
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   718
        apply (case_tac e)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   719
        apply (erule b1, erule b2) 
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   720
        prefer 4 apply (erule b3) prefer 4 apply (erule b4)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   721
        using vd created_cons nodel_cons a1' a4 vd_enrich_cons vd_cons'
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   722
        apply (auto intro!:pre_sfd' simp:cfd2sfd_simps is_created_proc_simps 
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   723
          simp del:file_of_proc_fd.simps split:if_splits dest:vd_cons enrich_proc_filefd)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   724
        apply (simp_all)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   725
        done
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   726
    qed
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   727
  qed
82
chunhan
parents:
diff changeset
   728
  moreover have "\<forall>tp. tp \<in> current_procs (e # s) \<longrightarrow> cp2sproc (enrich_proc (e # s) p p') tp = cp2sproc (e # s) tp"
chunhan
parents:
diff changeset
   729
    sorry
chunhan
parents:
diff changeset
   730
  moreover have "\<forall>f. f \<in> current_files (e # s) \<longrightarrow> cf2sfile (enrich_proc (e # s) p p') f = cf2sfile (e # s) f"
chunhan
parents:
diff changeset
   731
    sorry
chunhan
parents:
diff changeset
   732
  moreover have "\<forall>q. q \<in> current_msgqs (e # s) \<longrightarrow> cq2smsgq (enrich_proc (e # s) p p') q = cq2smsgq (e # s) q"
chunhan
parents:
diff changeset
   733
    sorry
chunhan
parents:
diff changeset
   734
  moreover have "cp2sproc (enrich_proc (e # s) p p') p' = cp2sproc (e # s) p"
chunhan
parents:
diff changeset
   735
  proof-
chunhan
parents:
diff changeset
   736
    from pre have b0: "is_created_proc s p \<Longrightarrow> cp2sproc (enrich_proc s p p') p' = cp2sproc s p" by simp
chunhan
parents:
diff changeset
   737
    have b1: "\<And> tp f fds. \<lbrakk>valid (enrich_proc (Execve tp f fds # s) p p'); valid (Execve tp f fds # s);
chunhan
parents:
diff changeset
   738
      is_created_proc (Execve tp f fds # s) p; p' \<notin> all_procs (Execve tp f fds # s)\<rbrakk>
chunhan
parents:
diff changeset
   739
      \<Longrightarrow> cp2sproc (enrich_proc (Execve tp f fds # s) p p') p' = cp2sproc (Execve tp f fds # s) p"
chunhan
parents:
diff changeset
   740
    proof-
chunhan
parents:
diff changeset
   741
      fix tp f fds
chunhan
parents:
diff changeset
   742
      assume a1: "valid (enrich_proc (Execve tp f fds # s) p p')"
chunhan
parents:
diff changeset
   743
      and a2: "valid (Execve tp f fds # s)" and a3: "is_created_proc (Execve tp f fds # s) p"
chunhan
parents:
diff changeset
   744
      and a4: "p' \<notin> all_procs (Execve tp f fds # s)"
chunhan
parents:
diff changeset
   745
      show "cp2sproc (enrich_proc (Execve tp f fds # s) p p') p' = cp2sproc (Execve tp f fds # s) p"
chunhan
parents:
diff changeset
   746
      proof (cases "tp = p")
chunhan
parents:
diff changeset
   747
        case True
84
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   748
        show ?thesis using True a1 a2 a3 a4 b0 vd
82
chunhan
parents:
diff changeset
   749
          thm not_all_procs_prop3
83
chunhan
parents: 82
diff changeset
   750
          apply (frule_tac not_all_procs_prop2)
chunhan
parents: 82
diff changeset
   751
          apply (frule not_all_procs_prop3)
84
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   752
          apply (simp add:is_created_proc_simps)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   753
          apply (frule vd_cons) (*
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   754
          apply (frule_tac vt_grant_os) 
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   755
          apply (frule_tac \<tau> = "enrich_proc s p p'" in vt_grant_os) *)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   756
          apply (frule_tac s = "enrich_proc s p p'" in vd_cons)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   757
          apply (frule_tac \<tau> = s in vt_grant_os)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   758
          apply (case_tac "p' = p", simp) (*
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   759
          apply (auto simp add:cp2sproc_execve sectxt_of_obj_simps enrich_proc_dup_in
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   760
            split:option.splits dest!:current_has_sec' dest:vt_grant is_file)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   761
          apply (simp_all add:is_created_proc_def)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   762
          apply (auto simp:cp2sproc_def)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   763
          apply (simp_all add:enrich_proc_dup_in)
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   764
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   765
          
83
chunhan
parents: 82
diff changeset
   766
          apply (auto simp:sectxt_of_obj_simps split:option.splits dest:valid.cases)
84
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   767
  *)        
82
chunhan
parents:
diff changeset
   768
          sorry
chunhan
parents:
diff changeset
   769
      next
chunhan
parents:
diff changeset
   770
        case False
chunhan
parents:
diff changeset
   771
        show ?thesis sorry
chunhan
parents:
diff changeset
   772
      qed
chunhan
parents:
diff changeset
   773
    qed
chunhan
parents:
diff changeset
   774
    have b2: "\<And> tp fd. cp2sproc (enrich_proc (ReadFile tp fd # s) p p') p' = cp2sproc (ReadFile tp fd # s) p"
chunhan
parents:
diff changeset
   775
      sorry
chunhan
parents:
diff changeset
   776
    have b3: "\<And> tp. cp2sproc (enrich_proc (Exit tp # s) p p') p' = cp2sproc (Exit tp # s) p"
chunhan
parents:
diff changeset
   777
      sorry
chunhan
parents:
diff changeset
   778
    have b4: "\<And> tp tp'. cp2sproc (enrich_proc (Kill tp tp' # s) p p') p' = cp2sproc (Kill tp tp' # s) p"
chunhan
parents:
diff changeset
   779
      sorry
chunhan
parents:
diff changeset
   780
    have b5: "\<And> tp tp' fds. cp2sproc (enrich_proc (Clone tp tp' fds # s) p p') p' = 
chunhan
parents:
diff changeset
   781
      cp2sproc (Clone tp tp' fds # s) p"
chunhan
parents:
diff changeset
   782
      sorry
chunhan
parents:
diff changeset
   783
    have b6: "\<And> tp f flags fd opt. cp2sproc (enrich_proc (Open tp f flags fd opt # s) p p') p' =
chunhan
parents:
diff changeset
   784
      cp2sproc (Open tp f flags fd opt # s) p"
chunhan
parents:
diff changeset
   785
      sorry
chunhan
parents:
diff changeset
   786
    have b7: "\<And> tp fd. cp2sproc (enrich_proc (CloseFd tp fd # s) p p') p' = cp2sproc (CloseFd tp fd # s) p"
chunhan
parents:
diff changeset
   787
      sorry
chunhan
parents:
diff changeset
   788
    show ?thesis using vd_enrich_cons
chunhan
parents:
diff changeset
   789
      apply (case_tac e)
84
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   790
      using vd_cons' created_cons all_procs_cons
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   791
      apply (auto intro!:b1 b2 b3 b4 b5 b6 b7 simp del:enrich_proc.simps)
83
chunhan
parents: 82
diff changeset
   792
      using created_cons vd_enrich_cons vd_cons' b0
82
chunhan
parents:
diff changeset
   793
      apply (auto simp:cp2sproc_other is_created_proc_def)
chunhan
parents:
diff changeset
   794
      done
chunhan
parents:
diff changeset
   795
  qed
chunhan
parents:
diff changeset
   796
  moreover have "\<forall> fd. fd \<in> proc_file_fds (e # s) p \<longrightarrow> 
chunhan
parents:
diff changeset
   797
    cfd2sfd (enrich_proc (e # s) p p') p' fd = cfd2sfd (e # s) p fd"
chunhan
parents:
diff changeset
   798
    sorry
84
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   799
  ultimately show ?case using vd_enrich_cons
82
chunhan
parents:
diff changeset
   800
    by simp
chunhan
parents:
diff changeset
   801
qed
chunhan
parents:
diff changeset
   802
  
chunhan
parents:
diff changeset
   803
chunhan
parents:
diff changeset
   804
lemma enrich_proc_valid:
chunhan
parents:
diff changeset
   805
  "\<lbrakk>valid s; is_created_proc s p; p' \<notin> all_procs s\<rbrakk> \<Longrightarrow> valid (enrich_proc s p p')"
chunhan
parents:
diff changeset
   806
by (auto dest:enrich_proc_prop)
chunhan
parents:
diff changeset
   807
chunhan
parents:
diff changeset
   808
lemma enrich_proc_valid:
chunhan
parents:
diff changeset
   809
  "\<lbrakk>valid s; is_created_proc s p; p' \<notin> all_procs s\<rbrakk> \<Longrightarrow> " 
chunhan
parents:
diff changeset
   810
chunhan
parents:
diff changeset
   811
lemma enrich_proc_tainted: 
chunhan
parents:
diff changeset
   812
  "\<lbrakk>is_created_proc s p; p' \<notin> all_procs s; valid s\<rbrakk>
chunhan
parents:
diff changeset
   813
   \<Longrightarrow> tainted (enrich_proc s p p') = (if (O_proc p \<in> tainted s) 
chunhan
parents:
diff changeset
   814
         then tainted s \<union> {O_proc p'} else tainted s)"
chunhan
parents:
diff changeset
   815
apply (induct s)
chunhan
parents:
diff changeset
   816
apply (simp add:is_created_proc_def)
chunhan
parents:
diff changeset
   817
apply (frule vt_grant_os, frule vd_cons, simp)
chunhan
parents:
diff changeset
   818
apply (frule enrich_proc_dup_in, simp+)
chunhan
parents:
diff changeset
   819
apply (frule not_all_procs_prop3)
chunhan
parents:
diff changeset
   820
apply (case_tac a)
chunhan
parents:
diff changeset
   821
prefer 3
chunhan
parents:
diff changeset
   822
apply (simp split:if_splits)
chunhan
parents:
diff changeset
   823
apply (rule impI|rule conjI)+
chunhan
parents:
diff changeset
   824
apply (simp add:is_created_proc_def)
chunhan
parents:
diff changeset
   825
apply (auto simp:is_created_proc_def split:if_splits dest:tainted_in_current)[1]
chunhan
parents:
diff changeset
   826
apply (simp add:is_created_proc_def)
chunhan
parents:
diff changeset
   827
chunhan
parents:
diff changeset
   828
prefer 4
chunhan
parents:
diff changeset
   829
apply (simp split:if_splits)
chunhan
parents:
diff changeset
   830
apply (rule impI|rule conjI)+
chunhan
parents:
diff changeset
   831
apply (simp add:is_created_proc_def)
chunhan
parents:
diff changeset
   832
apply (auto simp:is_created_proc_def split:if_splits dest:tainted_in_current)[1]
chunhan
parents:
diff changeset
   833
apply (simp add:is_created_proc_def)
chunhan
parents:
diff changeset
   834
chunhan
parents:
diff changeset
   835
prefer 4
chunhan
parents:
diff changeset
   836
apply (auto simp:is_created_proc_def split:if_splits option.splits dest:tainted_in_current)[1]
chunhan
parents:
diff changeset
   837
chunhan
parents:
diff changeset
   838
prefer 4
chunhan
parents:
diff changeset
   839
apply (auto simp:is_created_proc_def split:if_splits option.splits dest:tainted_in_current enrich_proc_dup_ffd enrich_proc_dup_ffd')[1]
chunhan
parents:
diff changeset
   840
chunhan
parents:
diff changeset
   841
chunhan
parents:
diff changeset
   842
chunhan
parents:
diff changeset
   843
lemma enrich_proc_dup_tainted:
chunhan
parents:
diff changeset
   844
  "\<lbrakk>is_created_proc s p; p' \<notin> all_procs s; valid s\<rbrakk>
chunhan
parents:
diff changeset
   845
   \<Longrightarrow> (O_proc p' \<in> tainted (enrich_proc s p p')) = (O_proc p \<in> tainted s)"
chunhan
parents:
diff changeset
   846
apply (induct s)
chunhan
parents:
diff changeset
   847
apply (simp add:is_created_proc_def)
chunhan
parents:
diff changeset
   848
apply (frule vt_grant_os, frule vd_cons)
chunhan
parents:
diff changeset
   849
apply (case_tac a)
chunhan
parents:
diff changeset
   850
apply (auto simp:is_created_proc_def)[1]
chunhan
parents:
diff changeset
   851
chunhan
parents:
diff changeset
   852
chunhan
parents:
diff changeset
   853
lemma enrich_proc_tainted:
84
cebdef333899 cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents: 83
diff changeset
   854
82
chunhan
parents:
diff changeset
   855
chunhan
parents:
diff changeset
   856
chunhan
parents:
diff changeset
   857
end
chunhan
parents:
diff changeset
   858
chunhan
parents:
diff changeset
   859
end