Final_theorem.thy
author chunhan
Thu, 24 Oct 2013 09:41:33 +0800
changeset 63 051b0ee98852
child 74 271e9818b6f6
permissions -rw-r--r--
restructured
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
63
051b0ee98852 restructured
chunhan
parents:
diff changeset
     1
theory Final_theorem
051b0ee98852 restructured
chunhan
parents:
diff changeset
     2
imports Main Flask Static Init_prop Valid_prop Tainted_prop Delete_prop Co2sobj_prop S2ss_prop S2ss_prop2 Dynamic_static
051b0ee98852 restructured
chunhan
parents:
diff changeset
     3
begin
051b0ee98852 restructured
chunhan
parents:
diff changeset
     4
051b0ee98852 restructured
chunhan
parents:
diff changeset
     5
context tainting_s begin
051b0ee98852 restructured
chunhan
parents:
diff changeset
     6
051b0ee98852 restructured
chunhan
parents:
diff changeset
     7
lemma t2ts:
051b0ee98852 restructured
chunhan
parents:
diff changeset
     8
  "obj \<in> tainted s \<Longrightarrow> co2sobj s obj = Some sobj \<Longrightarrow> tainted_s (s2ss s) sobj"
051b0ee98852 restructured
chunhan
parents:
diff changeset
     9
apply (frule tainted_in_current, frule tainted_is_valid)
051b0ee98852 restructured
chunhan
parents:
diff changeset
    10
apply (frule s2ss_included_sobj, simp)
051b0ee98852 restructured
chunhan
parents:
diff changeset
    11
apply (case_tac sobj, simp_all)
051b0ee98852 restructured
chunhan
parents:
diff changeset
    12
apply (case_tac [!] obj, simp_all add:co2sobj.simps split:option.splits if_splits)
051b0ee98852 restructured
chunhan
parents:
diff changeset
    13
apply (drule dir_not_tainted, simp)
051b0ee98852 restructured
chunhan
parents:
diff changeset
    14
apply (drule msgq_not_tainted, simp)
051b0ee98852 restructured
chunhan
parents:
diff changeset
    15
apply (drule shm_not_tainted, simp)
051b0ee98852 restructured
chunhan
parents:
diff changeset
    16
done
051b0ee98852 restructured
chunhan
parents:
diff changeset
    17
051b0ee98852 restructured
chunhan
parents:
diff changeset
    18
lemma delq_imp_delqm:
051b0ee98852 restructured
chunhan
parents:
diff changeset
    19
  "deleted (O_msgq q) s \<Longrightarrow> deleted (O_msg q m) s"
051b0ee98852 restructured
chunhan
parents:
diff changeset
    20
apply (induct s, simp)
051b0ee98852 restructured
chunhan
parents:
diff changeset
    21
by (case_tac a, auto)
051b0ee98852 restructured
chunhan
parents:
diff changeset
    22
051b0ee98852 restructured
chunhan
parents:
diff changeset
    23
lemma tainted_s_subset_prop:
051b0ee98852 restructured
chunhan
parents:
diff changeset
    24
  "\<lbrakk>tainted_s ss sobj; ss \<subseteq> ss'\<rbrakk> \<Longrightarrow> tainted_s ss' sobj"
051b0ee98852 restructured
chunhan
parents:
diff changeset
    25
apply (case_tac sobj)
051b0ee98852 restructured
chunhan
parents:
diff changeset
    26
apply auto
051b0ee98852 restructured
chunhan
parents:
diff changeset
    27
done
051b0ee98852 restructured
chunhan
parents:
diff changeset
    28
051b0ee98852 restructured
chunhan
parents:
diff changeset
    29
theorem static_complete: 
051b0ee98852 restructured
chunhan
parents:
diff changeset
    30
  assumes undel: "undeletable obj" and tbl: "taintable obj"
051b0ee98852 restructured
chunhan
parents:
diff changeset
    31
  shows "taintable_s obj"
051b0ee98852 restructured
chunhan
parents:
diff changeset
    32
proof-
051b0ee98852 restructured
chunhan
parents:
diff changeset
    33
  from tbl obtain s where tainted: "obj \<in> tainted s"
051b0ee98852 restructured
chunhan
parents:
diff changeset
    34
    by (auto simp:taintable_def)
051b0ee98852 restructured
chunhan
parents:
diff changeset
    35
  hence vs: "valid s" by (simp add:tainted_is_valid)
051b0ee98852 restructured
chunhan
parents:
diff changeset
    36
  hence static: "s2ss s \<propto> static" using d2s_main by auto
051b0ee98852 restructured
chunhan
parents:
diff changeset
    37
  from tainted tbl vs obtain sobj where sobj: "co2sobj s obj = Some sobj" 
051b0ee98852 restructured
chunhan
parents:
diff changeset
    38
    apply (clarsimp simp add:taintable_def)
051b0ee98852 restructured
chunhan
parents:
diff changeset
    39
    apply (frule tainted_in_current)
051b0ee98852 restructured
chunhan
parents:
diff changeset
    40
    apply (case_tac obj, simp_all add:co2sobj.simps)
051b0ee98852 restructured
chunhan
parents:
diff changeset
    41
    apply (frule current_proc_has_sp, simp, auto)
051b0ee98852 restructured
chunhan
parents:
diff changeset
    42
    done
051b0ee98852 restructured
chunhan
parents:
diff changeset
    43
  from undel vs have "\<not> deleted obj s" and init_alive: "init_alive obj" 
051b0ee98852 restructured
chunhan
parents:
diff changeset
    44
    by (auto simp:undeletable_def)
051b0ee98852 restructured
chunhan
parents:
diff changeset
    45
  with vs sobj have "init_obj_related sobj obj"
051b0ee98852 restructured
chunhan
parents:
diff changeset
    46
    apply (case_tac obj, case_tac [!] sobj)
051b0ee98852 restructured
chunhan
parents:
diff changeset
    47
    apply (auto split:option.splits if_splits simp:co2sobj.simps cp2sproc_def ch2sshm_def cq2smsgq_def cm2smsg_def delq_imp_delqm)
051b0ee98852 restructured
chunhan
parents:
diff changeset
    48
    apply (frule not_deleted_init_file, simp+) 
051b0ee98852 restructured
chunhan
parents:
diff changeset
    49
    apply (drule is_file_has_sfile', simp, erule exE)
051b0ee98852 restructured
chunhan
parents:
diff changeset
    50
    apply (rule_tac x = sf in bexI)
051b0ee98852 restructured
chunhan
parents:
diff changeset
    51
    apply (case_tac list, auto split:option.splits simp:is_init_file_props)[1]
051b0ee98852 restructured
chunhan
parents:
diff changeset
    52
    apply (drule root_is_init_dir', simp)
051b0ee98852 restructured
chunhan
parents:
diff changeset
    53
    apply (frule not_deleted_init_file, simp, simp)
051b0ee98852 restructured
chunhan
parents:
diff changeset
    54
    apply (simp add:cf2sfile_def split:option.splits if_splits)
051b0ee98852 restructured
chunhan
parents:
diff changeset
    55
    apply (simp add:cf2sfiles_def)
051b0ee98852 restructured
chunhan
parents:
diff changeset
    56
    apply (rule_tac x = list in bexI, simp, simp add:same_inode_files_def not_deleted_init_file)
051b0ee98852 restructured
chunhan
parents:
diff changeset
    57
051b0ee98852 restructured
chunhan
parents:
diff changeset
    58
    apply (frule not_deleted_init_dir, simp+)
051b0ee98852 restructured
chunhan
parents:
diff changeset
    59
    apply (simp add:cf2sfile_def split:option.splits if_splits)
051b0ee98852 restructured
chunhan
parents:
diff changeset
    60
    apply (case_tac list, simp add:sroot_def, simp)
051b0ee98852 restructured
chunhan
parents:
diff changeset
    61
    apply (drule file_dir_conflict, simp+)
051b0ee98852 restructured
chunhan
parents:
diff changeset
    62
    done
051b0ee98852 restructured
chunhan
parents:
diff changeset
    63
  with tainted t2ts init_alive sobj static
051b0ee98852 restructured
chunhan
parents:
diff changeset
    64
  show ?thesis unfolding taintable_s_def 
051b0ee98852 restructured
chunhan
parents:
diff changeset
    65
    apply (simp add:init_ss_in_def)
051b0ee98852 restructured
chunhan
parents:
diff changeset
    66
    apply (erule bexE)
051b0ee98852 restructured
chunhan
parents:
diff changeset
    67
    apply (simp add:init_ss_eq_def)
051b0ee98852 restructured
chunhan
parents:
diff changeset
    68
    apply (rule_tac x = "ss'" in bexI)
051b0ee98852 restructured
chunhan
parents:
diff changeset
    69
    apply (rule_tac x = "sobj" in exI)
051b0ee98852 restructured
chunhan
parents:
diff changeset
    70
    by (auto intro:tainted_s_subset_prop)
051b0ee98852 restructured
chunhan
parents:
diff changeset
    71
qed
051b0ee98852 restructured
chunhan
parents:
diff changeset
    72
051b0ee98852 restructured
chunhan
parents:
diff changeset
    73
lemma cp2sproc_pi:
051b0ee98852 restructured
chunhan
parents:
diff changeset
    74
  "\<lbrakk>cp2sproc s p = Some (Init p', sec, fds, shms); valid s\<rbrakk> \<Longrightarrow> p = p' \<and> \<not> deleted (O_proc p) s \<and> p \<in> init_procs"
051b0ee98852 restructured
chunhan
parents:
diff changeset
    75
by (simp add:cp2sproc_def split:option.splits if_splits)
051b0ee98852 restructured
chunhan
parents:
diff changeset
    76
051b0ee98852 restructured
chunhan
parents:
diff changeset
    77
lemma cq2smsgq_qi:
051b0ee98852 restructured
chunhan
parents:
diff changeset
    78
  "\<lbrakk>cq2smsgq s q = Some (Init q', sec, sms); valid s\<rbrakk> \<Longrightarrow> q = q' \<and> \<not> deleted (O_msgq q) s \<and> q \<in> init_msgqs"
051b0ee98852 restructured
chunhan
parents:
diff changeset
    79
by (simp add:cq2smsgq_def split:option.splits if_splits)
051b0ee98852 restructured
chunhan
parents:
diff changeset
    80
051b0ee98852 restructured
chunhan
parents:
diff changeset
    81
lemma cm2smsg_mi:
051b0ee98852 restructured
chunhan
parents:
diff changeset
    82
  "\<lbrakk>cm2smsg s q m = Some (Init m', sec, ttag); q \<in> init_msgqs; valid s\<rbrakk> 
051b0ee98852 restructured
chunhan
parents:
diff changeset
    83
   \<Longrightarrow> m = m' \<and> \<not> deleted (O_msg q m) s \<and> m \<in> set (init_msgs_of_queue q) \<and> q \<in> init_msgqs"
051b0ee98852 restructured
chunhan
parents:
diff changeset
    84
by (clarsimp simp add:cm2smsg_def split:if_splits option.splits)
051b0ee98852 restructured
chunhan
parents:
diff changeset
    85
051b0ee98852 restructured
chunhan
parents:
diff changeset
    86
lemma ch2sshm_hi:
051b0ee98852 restructured
chunhan
parents:
diff changeset
    87
  "\<lbrakk>ch2sshm s h = Some (Init h', sec); valid s\<rbrakk> \<Longrightarrow> h = h' \<and> \<not> deleted (O_shm h) s \<and> h \<in> init_shms"
051b0ee98852 restructured
chunhan
parents:
diff changeset
    88
by (clarsimp simp:ch2sshm_def split:if_splits option.splits)
051b0ee98852 restructured
chunhan
parents:
diff changeset
    89
051b0ee98852 restructured
chunhan
parents:
diff changeset
    90
lemma root_not_deleted:
051b0ee98852 restructured
chunhan
parents:
diff changeset
    91
  "\<lbrakk>deleted (O_dir []) s; valid s\<rbrakk> \<Longrightarrow> False"
051b0ee98852 restructured
chunhan
parents:
diff changeset
    92
apply (induct s, simp)
051b0ee98852 restructured
chunhan
parents:
diff changeset
    93
apply (frule vd_cons, frule vt_grant_os, case_tac a, auto)
051b0ee98852 restructured
chunhan
parents:
diff changeset
    94
done
051b0ee98852 restructured
chunhan
parents:
diff changeset
    95
051b0ee98852 restructured
chunhan
parents:
diff changeset
    96
lemma cf2sfile_fi:
051b0ee98852 restructured
chunhan
parents:
diff changeset
    97
  "\<lbrakk>cf2sfile s f = Some (Init f', sec, psecopt, asecs); valid s\<rbrakk> \<Longrightarrow> f = f' \<and> 
051b0ee98852 restructured
chunhan
parents:
diff changeset
    98
     (if (is_file s f) then \<not> deleted (O_file f) s \<and> is_init_file f 
051b0ee98852 restructured
chunhan
parents:
diff changeset
    99
      else \<not> deleted (O_dir f) s \<and> is_init_dir f)"
051b0ee98852 restructured
chunhan
parents:
diff changeset
   100
apply (case_tac f)
051b0ee98852 restructured
chunhan
parents:
diff changeset
   101
by (auto simp:sroot_def cf2sfile_def root_is_init_dir dest!:root_is_dir' root_not_deleted
051b0ee98852 restructured
chunhan
parents:
diff changeset
   102
        split:if_splits option.splits) 
051b0ee98852 restructured
chunhan
parents:
diff changeset
   103
051b0ee98852 restructured
chunhan
parents:
diff changeset
   104
lemma init_deled_imp_deled_s: 
051b0ee98852 restructured
chunhan
parents:
diff changeset
   105
  "\<lbrakk>deleted obj s; init_alive obj; sobj \<in> (s2ss s); valid s\<rbrakk> \<Longrightarrow> \<not> init_obj_related sobj obj"
051b0ee98852 restructured
chunhan
parents:
diff changeset
   106
apply (rule notI)
051b0ee98852 restructured
chunhan
parents:
diff changeset
   107
apply (clarsimp simp:s2ss_def)
051b0ee98852 restructured
chunhan
parents:
diff changeset
   108
apply (case_tac obj, case_tac [!] obja, case_tac sobj)
051b0ee98852 restructured
chunhan
parents:
diff changeset
   109
apply (auto split:option.splits if_splits dest!:cp2sproc_pi cq2smsgq_qi ch2sshm_hi cm2smsg_mi cf2sfile_fi simp:co2sobj.simps)
051b0ee98852 restructured
chunhan
parents:
diff changeset
   110
apply (auto simp:cf2sfiles_def same_inode_files_def has_same_inode_prop1' is_file_def is_dir_def co2sobj.simps
051b0ee98852 restructured
chunhan
parents:
diff changeset
   111
           split:option.splits t_inode_tag.splits dest!:cf2sfile_fi)
051b0ee98852 restructured
chunhan
parents:
diff changeset
   112
done
051b0ee98852 restructured
chunhan
parents:
diff changeset
   113
051b0ee98852 restructured
chunhan
parents:
diff changeset
   114
lemma deleted_imp_deletable_s:
051b0ee98852 restructured
chunhan
parents:
diff changeset
   115
  "\<lbrakk>deleted obj s; init_alive obj; valid s\<rbrakk> \<Longrightarrow> deletable_s obj"
051b0ee98852 restructured
chunhan
parents:
diff changeset
   116
apply (simp add:deletable_s_def)
051b0ee98852 restructured
chunhan
parents:
diff changeset
   117
apply (frule d2s_main)
051b0ee98852 restructured
chunhan
parents:
diff changeset
   118
apply (simp add:init_ss_in_def)
051b0ee98852 restructured
chunhan
parents:
diff changeset
   119
apply (erule bexE)
051b0ee98852 restructured
chunhan
parents:
diff changeset
   120
apply (rule_tac x = ss' in bexI)
051b0ee98852 restructured
chunhan
parents:
diff changeset
   121
apply (auto simp add: init_ss_eq_def dest!:init_deled_imp_deled_s)
051b0ee98852 restructured
chunhan
parents:
diff changeset
   122
apply (case_tac obj, case_tac [!] sobj)
051b0ee98852 restructured
chunhan
parents:
diff changeset
   123
apply auto
051b0ee98852 restructured
chunhan
parents:
diff changeset
   124
apply (erule set_mp)
051b0ee98852 restructured
chunhan
parents:
diff changeset
   125
apply (simp)
051b0ee98852 restructured
chunhan
parents:
diff changeset
   126
apply auto
051b0ee98852 restructured
chunhan
parents:
diff changeset
   127
apply (rule_tac x = "(Init list, (aa, ab, b), ac, ba)" in bexI)
051b0ee98852 restructured
chunhan
parents:
diff changeset
   128
apply auto
051b0ee98852 restructured
chunhan
parents:
diff changeset
   129
done
051b0ee98852 restructured
chunhan
parents:
diff changeset
   130
051b0ee98852 restructured
chunhan
parents:
diff changeset
   131
lemma init_related_imp_init_sobj:
051b0ee98852 restructured
chunhan
parents:
diff changeset
   132
  "init_obj_related sobj obj \<Longrightarrow> is_init_sobj sobj"
051b0ee98852 restructured
chunhan
parents:
diff changeset
   133
apply (case_tac sobj, case_tac [!] obj, auto)
051b0ee98852 restructured
chunhan
parents:
diff changeset
   134
apply (rule_tac x = "(Init list, (aa, ab, b), ac, ba)" in bexI, auto)
051b0ee98852 restructured
chunhan
parents:
diff changeset
   135
done
051b0ee98852 restructured
chunhan
parents:
diff changeset
   136
051b0ee98852 restructured
chunhan
parents:
diff changeset
   137
theorem undeletable_s_complete:
051b0ee98852 restructured
chunhan
parents:
diff changeset
   138
  assumes undel_s: "undeletable_s obj"
051b0ee98852 restructured
chunhan
parents:
diff changeset
   139
  shows "undeletable obj"
051b0ee98852 restructured
chunhan
parents:
diff changeset
   140
proof-
051b0ee98852 restructured
chunhan
parents:
diff changeset
   141
  from undel_s have init_alive: "init_alive obj"
051b0ee98852 restructured
chunhan
parents:
diff changeset
   142
    and alive_s: "\<forall> ss \<in> static. \<exists> sobj \<in> ss. init_obj_related sobj obj" 
051b0ee98852 restructured
chunhan
parents:
diff changeset
   143
    using undeletable_s_def by auto
051b0ee98852 restructured
chunhan
parents:
diff changeset
   144
  have "\<not> (\<exists> s. valid s \<and> deleted obj s)" 
051b0ee98852 restructured
chunhan
parents:
diff changeset
   145
  proof
051b0ee98852 restructured
chunhan
parents:
diff changeset
   146
    assume "\<exists> s. valid s \<and> deleted obj s"
051b0ee98852 restructured
chunhan
parents:
diff changeset
   147
    then obtain s where vs: "valid s" and del: "deleted obj s" by auto
051b0ee98852 restructured
chunhan
parents:
diff changeset
   148
    from vs have vss: "s2ss s \<propto> static" by (rule d2s_main) 
051b0ee98852 restructured
chunhan
parents:
diff changeset
   149
    with alive_s obtain sobj where in_ss: "sobj \<in> (s2ss s)" 
051b0ee98852 restructured
chunhan
parents:
diff changeset
   150
      and related: "init_obj_related sobj obj" 
051b0ee98852 restructured
chunhan
parents:
diff changeset
   151
      apply (simp add:init_ss_in_def init_ss_eq_def)
051b0ee98852 restructured
chunhan
parents:
diff changeset
   152
      apply (erule bexE, erule_tac x= ss' in ballE)
051b0ee98852 restructured
chunhan
parents:
diff changeset
   153
      apply (auto dest:init_related_imp_init_sobj)
051b0ee98852 restructured
chunhan
parents:
diff changeset
   154
      done
051b0ee98852 restructured
chunhan
parents:
diff changeset
   155
    from init_alive del vs have "deletable_s obj" 
051b0ee98852 restructured
chunhan
parents:
diff changeset
   156
      by (auto elim:deleted_imp_deletable_s)
051b0ee98852 restructured
chunhan
parents:
diff changeset
   157
    with alive_s
051b0ee98852 restructured
chunhan
parents:
diff changeset
   158
    show False by (auto simp:deletable_s_def)
051b0ee98852 restructured
chunhan
parents:
diff changeset
   159
  qed
051b0ee98852 restructured
chunhan
parents:
diff changeset
   160
  with init_alive show ?thesis 
051b0ee98852 restructured
chunhan
parents:
diff changeset
   161
    by (simp add:undeletable_def)
051b0ee98852 restructured
chunhan
parents:
diff changeset
   162
qed
051b0ee98852 restructured
chunhan
parents:
diff changeset
   163
051b0ee98852 restructured
chunhan
parents:
diff changeset
   164
theorem final_offer:
051b0ee98852 restructured
chunhan
parents:
diff changeset
   165
  "\<lbrakk>undeletable_s obj; \<not> taintable_s obj; init_alive obj\<rbrakk> \<Longrightarrow> \<not> taintable obj"
051b0ee98852 restructured
chunhan
parents:
diff changeset
   166
apply (erule swap)
051b0ee98852 restructured
chunhan
parents:
diff changeset
   167
by (simp add:static_complete undeletable_s_complete)
051b0ee98852 restructured
chunhan
parents:
diff changeset
   168
051b0ee98852 restructured
chunhan
parents:
diff changeset
   169
(************** static \<rightarrow> dynamic ***************)
051b0ee98852 restructured
chunhan
parents:
diff changeset
   170
051b0ee98852 restructured
chunhan
parents:
diff changeset
   171
051b0ee98852 restructured
chunhan
parents:
diff changeset
   172
lemma set_eq_D:
051b0ee98852 restructured
chunhan
parents:
diff changeset
   173
  "\<lbrakk>x \<in> S; {x. P x} = S\<rbrakk> \<Longrightarrow> P x"
051b0ee98852 restructured
chunhan
parents:
diff changeset
   174
by auto
051b0ee98852 restructured
chunhan
parents:
diff changeset
   175
051b0ee98852 restructured
chunhan
parents:
diff changeset
   176
lemma cqm2sms_prop1:
051b0ee98852 restructured
chunhan
parents:
diff changeset
   177
  "\<lbrakk>cqm2sms s q queue = Some sms; sm \<in> set sms\<rbrakk> \<Longrightarrow> \<exists> m. cm2smsg s q m = Some sm"
051b0ee98852 restructured
chunhan
parents:
diff changeset
   178
apply (induct queue arbitrary:sms)
051b0ee98852 restructured
chunhan
parents:
diff changeset
   179
apply (auto simp:cqm2sms.simps split:option.splits)
051b0ee98852 restructured
chunhan
parents:
diff changeset
   180
done
051b0ee98852 restructured
chunhan
parents:
diff changeset
   181
051b0ee98852 restructured
chunhan
parents:
diff changeset
   182
lemma sq_sm_prop:
051b0ee98852 restructured
chunhan
parents:
diff changeset
   183
  "\<lbrakk>sm \<in> set sms; cq2smsgq s q = Some (qi, qsec, sms); valid s\<rbrakk>
051b0ee98852 restructured
chunhan
parents:
diff changeset
   184
   \<Longrightarrow> \<exists> m. cm2smsg s q m = Some sm"
051b0ee98852 restructured
chunhan
parents:
diff changeset
   185
by (auto simp:cq2smsgq_def split: option.splits intro:cqm2sms_prop1)
051b0ee98852 restructured
chunhan
parents:
diff changeset
   186
051b0ee98852 restructured
chunhan
parents:
diff changeset
   187
declare co2sobj.simps [simp add]
051b0ee98852 restructured
chunhan
parents:
diff changeset
   188
051b0ee98852 restructured
chunhan
parents:
diff changeset
   189
lemma tainted_s_imp_tainted:
051b0ee98852 restructured
chunhan
parents:
diff changeset
   190
  "\<lbrakk>tainted_s ss sobj; ss \<in> static\<rbrakk> \<Longrightarrow> \<exists> s obj. valid s \<and> co2sobj s obj = Some sobj \<and> obj \<in> tainted s"
051b0ee98852 restructured
chunhan
parents:
diff changeset
   191
apply (drule s2d_main)
051b0ee98852 restructured
chunhan
parents:
diff changeset
   192
apply (erule exE, erule conjE, simp add:s2ss_def)
051b0ee98852 restructured
chunhan
parents:
diff changeset
   193
apply (rule_tac x = s in exI, simp)
051b0ee98852 restructured
chunhan
parents:
diff changeset
   194
apply (case_tac sobj, simp_all)
051b0ee98852 restructured
chunhan
parents:
diff changeset
   195
apply (erule conjE, drule_tac S = ss in set_eq_D, simp, (erule exE|erule conjE)+) 
051b0ee98852 restructured
chunhan
parents:
diff changeset
   196
apply (rule_tac x = obj in exI, simp)
051b0ee98852 restructured
chunhan
parents:
diff changeset
   197
apply (case_tac obj, (simp split:option.splits if_splits)+)
051b0ee98852 restructured
chunhan
parents:
diff changeset
   198
051b0ee98852 restructured
chunhan
parents:
diff changeset
   199
apply (erule conjE, drule_tac S = ss in set_eq_D, simp, (erule exE|erule conjE)+) 
051b0ee98852 restructured
chunhan
parents:
diff changeset
   200
apply (rule_tac x = obj in exI, simp)
051b0ee98852 restructured
chunhan
parents:
diff changeset
   201
apply (case_tac obj, (simp split:option.splits if_splits)+)
051b0ee98852 restructured
chunhan
parents:
diff changeset
   202
done
051b0ee98852 restructured
chunhan
parents:
diff changeset
   203
051b0ee98852 restructured
chunhan
parents:
diff changeset
   204
lemma has_same_inode_prop3:
051b0ee98852 restructured
chunhan
parents:
diff changeset
   205
  "has_same_inode s f f' \<Longrightarrow> has_same_inode s f' f"
051b0ee98852 restructured
chunhan
parents:
diff changeset
   206
by (auto simp:has_same_inode_def)
051b0ee98852 restructured
chunhan
parents:
diff changeset
   207
051b0ee98852 restructured
chunhan
parents:
diff changeset
   208
theorem static_sound:
051b0ee98852 restructured
chunhan
parents:
diff changeset
   209
  assumes tbl_s: "taintable_s obj"
051b0ee98852 restructured
chunhan
parents:
diff changeset
   210
  shows "taintable obj"
051b0ee98852 restructured
chunhan
parents:
diff changeset
   211
proof-
051b0ee98852 restructured
chunhan
parents:
diff changeset
   212
  from tbl_s obtain ss sobj where static: "ss \<in> static"
051b0ee98852 restructured
chunhan
parents:
diff changeset
   213
    and sobj: "tainted_s ss sobj" and related: "init_obj_related sobj obj"
051b0ee98852 restructured
chunhan
parents:
diff changeset
   214
    and init_alive: "init_alive obj" by (auto simp:taintable_s_def)
051b0ee98852 restructured
chunhan
parents:
diff changeset
   215
  from static sobj tainted_s_imp_tainted 
051b0ee98852 restructured
chunhan
parents:
diff changeset
   216
  obtain s obj' where co2sobj: "co2sobj s obj' = Some sobj"
051b0ee98852 restructured
chunhan
parents:
diff changeset
   217
    and tainted': "obj' \<in> tainted s" and vs: "valid s" by blast
051b0ee98852 restructured
chunhan
parents:
diff changeset
   218
  
051b0ee98852 restructured
chunhan
parents:
diff changeset
   219
  from co2sobj related vs
051b0ee98852 restructured
chunhan
parents:
diff changeset
   220
  have eq:"obj = obj' \<or> (\<exists> f f'. obj = O_file f \<and> obj' = O_file f' \<and> has_same_inode s f f')"
051b0ee98852 restructured
chunhan
parents:
diff changeset
   221
    apply (case_tac obj', case_tac [!] obj)
051b0ee98852 restructured
chunhan
parents:
diff changeset
   222
    apply (auto split:option.splits if_splits dest!:cp2sproc_pi cq2smsgq_qi ch2sshm_hi cm2smsg_mi cf2sfile_fi)
051b0ee98852 restructured
chunhan
parents:
diff changeset
   223
    apply (auto simp:cf2sfiles_def same_inode_files_def has_same_inode_def is_file_def is_dir_def
051b0ee98852 restructured
chunhan
parents:
diff changeset
   224
               split:option.splits t_inode_tag.splits dest!:cf2sfile_fi)
051b0ee98852 restructured
chunhan
parents:
diff changeset
   225
    done
051b0ee98852 restructured
chunhan
parents:
diff changeset
   226
  with tainted' vs have tainted: "obj \<in> tainted s"
051b0ee98852 restructured
chunhan
parents:
diff changeset
   227
    by (auto dest:has_same_inode_prop3 intro:has_same_inode_tainted)
051b0ee98852 restructured
chunhan
parents:
diff changeset
   228
  from sobj related init_alive have "appropriate obj"
051b0ee98852 restructured
chunhan
parents:
diff changeset
   229
    by (case_tac obj, case_tac [!] sobj, auto)
051b0ee98852 restructured
chunhan
parents:
diff changeset
   230
  with vs init_alive tainted
051b0ee98852 restructured
chunhan
parents:
diff changeset
   231
  show ?thesis by (auto simp:taintable_def)
051b0ee98852 restructured
chunhan
parents:
diff changeset
   232
qed
051b0ee98852 restructured
chunhan
parents:
diff changeset
   233
051b0ee98852 restructured
chunhan
parents:
diff changeset
   234
end
051b0ee98852 restructured
chunhan
parents:
diff changeset
   235
051b0ee98852 restructured
chunhan
parents:
diff changeset
   236
end