Dynamic2static.thy
author chunhan
Thu, 24 Oct 2013 09:41:33 +0800
changeset 63 051b0ee98852
parent 62 9fc384154e84
permissions -rw-r--r--
restructured
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
     1
theory Dynamic2static
61
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
     2
imports Main Flask Static Init_prop Valid_prop Tainted_prop Delete_prop Co2sobj_prop S2ss_prop S2ss_prop2
1
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
     3
begin
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
     4
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
     5
context tainting_s begin
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
     6
61
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
     7
lemma many_sq_imp_sms:
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
     8
  "\<lbrakk>S_msgq (Create, sec, sms) \<in> ss; ss \<in> static\<rbrakk> \<Longrightarrow> \<forall> sm \<in> (set sms). is_many_smsg sm"
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
     9
sorry
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
    10
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
    11
definition init_ss_eq:: "t_static_state \<Rightarrow> t_static_state \<Rightarrow> bool" (infix "\<doteq>" 100)
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
    12
where
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
    13
  "ss \<doteq> ss' \<equiv> ss \<subseteq> ss' \<and> {sobj. is_init_sobj sobj \<and> sobj \<in> ss'} \<subseteq> ss"
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
    14
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
    15
lemma [simp]: "ss \<doteq> ss"
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
    16
by (auto simp:init_ss_eq_def)
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
    17
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
    18
definition init_ss_in:: "t_static_state \<Rightarrow> t_static_state set \<Rightarrow> bool" (infix "\<propto>" 101)
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
    19
where
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
    20
  "ss \<propto> sss \<equiv> \<exists> ss' \<in> sss. ss \<doteq> ss'"
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
    21
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
    22
lemma s2ss_included_sobj:
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
    23
  "\<lbrakk>alive s obj; co2sobj s obj= Some sobj\<rbrakk> \<Longrightarrow> sobj \<in> (s2ss s)"
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
    24
by (simp add:s2ss_def, rule_tac x = obj in exI, simp)
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
    25
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
    26
lemma init_ss_in_prop:
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
    27
  "\<lbrakk>s2ss s \<propto> static; co2sobj s obj = Some sobj; alive s obj; init_obj_related sobj obj\<rbrakk>
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
    28
   \<Longrightarrow> \<exists> ss \<in> static. sobj \<in> ss"
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
    29
apply (simp add:init_ss_in_def init_ss_eq_def)
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
    30
apply (erule bexE, erule conjE)
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
    31
apply (rule_tac x = ss' in bexI, auto dest!:s2ss_included_sobj)
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
    32
done
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
    33
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
    34
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
    35
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
    36
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
    37
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
    38
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
    39
lemma d2s_main_execve:
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
    40
  "valid (Execve p f fds # s) \<Longrightarrow> s2ss (Execve p f fds # s) \<in> static"
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
    41
apply (frule vd_cons, frule vt_grant_os, clarsimp simp:s2ss_execve)
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
    42
sorry
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
    43
1
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    44
lemma d2s_main:
61
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
    45
  "valid s \<Longrightarrow> s2ss s \<propto> static"
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
    46
apply (induct s, simp add:s2ss_nil_prop init_ss_in_def)
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
    47
apply (rule_tac x = "init_static_state" in bexI, simp, simp add:s_init)
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
    48
apply (frule vd_cons, frule vt_grant_os, simp)
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
    49
apply (case_tac a) 
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
    50
apply (clarsimp simp add:s2ss_execve)
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
    51
apply (rule conjI, rule impI)
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
    52
31
aa1375b6c0eb find bugs in os_grant, case RecvMsg
chunhan
parents: 21
diff changeset
    53
aa1375b6c0eb find bugs in os_grant, case RecvMsg
chunhan
parents: 21
diff changeset
    54
1
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    55
sorry
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    56
63
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
    57
definition enrich:: "t_state \<Rightarrow> t_object set \<Rightarrow> t_state \<Rightarrow> bool"
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
    58
where
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
    59
  "enrich s objs s' \<equiv> \<forall> obj \<in> objs. \<exists> obj'. obj' \<notin> objs \<and> alive s' obj \<and> co2sobj s' obj' = co2sobj s' obj"
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
    60
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
    61
definition reserve:: "t_state \<Rightarrow> t_object set \<Rightarrow> t_state \<Rightarrow> bool"
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
    62
where
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
    63
  "reserve s objs s' \<equiv> \<forall> obj. alive s obj \<longrightarrow> alive s' obj \<and> co2sobj s' obj = co2sobj s obj"
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
    64
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
    65
definition enrichable :: "t_state \<Rightarrow> t_object set \<Rightarrow> bool"
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
    66
where
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
    67
  "enrichable s objs \<equiv> \<exists> s'. valid s' \<and> s2ss s' = s2ss s \<and> enrich s objs s' \<and> reserve s objs s'"
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
    68
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
    69
definition is_created :: "t_state \<Rightarrow> t_object \<Rightarrow> bool"
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
    70
where
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
    71
  "is_created s obj \<equiv> init_alive obj \<longrightarrow> deleted obj s"
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
    72
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
    73
definition is_inited :: "t_state \<Rightarrow> t_object \<Rightarrow> bool"
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
    74
where
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
    75
  "is_inited s obj \<equiv> init_alive obj \<and> \<not> deleted obj s"
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
    76
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
    77
lemma is_inited_eq_not_created:
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
    78
  "is_inited s obj = (\<not> is_created s obj)"
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
    79
by (auto simp:is_created_def is_inited_def)
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
    80
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
    81
(* recorded in our static world *)
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
    82
fun recorded :: "t_object \<Rightarrow> bool"
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
    83
where
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
    84
  "recorded (O_proc p)     = True"
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
    85
| "recorded (O_file f)     = True"
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
    86
| "recorded (O_dir  f)     = True"
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
    87
| "recorded (O_node n)     = False" (* cause socket is temperary not considered *)
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
    88
| "recorded (O_shm  h)     = True"
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
    89
| "recorded (O_msgq q)     = True"
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
    90
| "recorded _              = False"
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
    91
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
    92
lemma enrichability: 
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
    93
  "\<lbrakk>valid s; \<forall> obj \<in> objs. alive s obj \<and> is_created s obj \<and> recorded obj\<rbrakk>
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
    94
   \<Longrightarrow> enrichable s objs"
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
    95
proof (induct s arbitrary:objs)
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
    96
  case Nil
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
    97
  hence "objs = {}" 
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
    98
    apply (auto simp:is_created_def)
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
    99
    apply (erule_tac x = x in ballE)
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   100
    apply (auto simp:init_alive_prop)
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   101
    done
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   102
  thus ?case using Nil unfolding enrichable_def enrich_def reserve_def
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   103
    by (rule_tac x = "[]" in exI, auto)
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   104
next
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   105
  case (Cons e s)
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   106
  hence p1: "\<And> objs. \<forall> obj \<in> objs. alive s obj \<and> is_created s obj \<and> recorded obj \<Longrightarrow> enrichable s objs"
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   107
    and p2: "valid (e # s)" and p3: "\<forall>obj\<in>objs. alive (e # s) obj \<and> is_created (e # s) obj \<and> recorded obj"
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   108
    and os: "os_grant s e" and se: "grant s e" and vd: "valid s"
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   109
    by (auto dest:vt_grant_os vd_cons vt_grant)
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   110
  show ?case
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   111
  proof (cases e)
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   112
    case (Execve p f fds)
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   113
    hence p4: "e = Execve p f fds" by simp
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   114
    from p3 have p5: "is_inited s (O_proc p) \<Longrightarrow> (O_proc p) \<notin> objs"
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   115
      by (auto simp:is_created_def is_inited_def p4 elim!:ballE[where x = "O_proc p"])
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   116
    show "enrichable (e # s) objs"
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   117
    proof (case "is_inited s (O_proc p)")
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   118
      apply (simp add:enrichable_def p4)
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   119
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   120
      
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   121
  
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   122
    apply auto
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   123
    apply (auto simp:enrichable_def)
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   124
apply (induct s)
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   125
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   126
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   127
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   128
done
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   129
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   130
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   131
(* for the object set, there exists another trace which keeps this objects but also add new identical objects
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   132
 * that have the same static-signature
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   133
 *)
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   134
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   135
definition potential_trace:: "t_state \<Rightarrow> bool"
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   136
where
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   137
  "potential_trace s \<equiv> \<forall> obj. alive s obj \<and> is_created s obj \<longrightarrow> 
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   138
      (\<exists> s' obj'. valid s' \<and> s2ss s' = ss \<and> obj' \<noteq> obj \<and> co2sobj s' obj = co2sobj s' obj)
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   139
     "
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   140
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   141
lemma s2d_main_general:
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   142
  "ss \<in> static \<Longrightarrow> \<exists> s. valid s \<and> s2ss s = ss \<and> (\<forall> obj \<in> objs. alive s obj \<and> is_created s obj \<longrightarrow> (\<exists> s'. valid s' \<and> s2ss s' = ss \<and> (\<exists> obj'. obj' \<noteq> obj \<and> co2sobj s' obj = co2sobj s' obj')))"
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   143
apply (erule static.induct)
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   144
apply (rule_tac x = "[]" in exI, simp add:s2ss_nil_prop valid.intros) defer
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   145
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   146
apply (erule exE|erule conjE)+
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   147
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   148
apply (simp add:update_ss_def)
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   149
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   150
sorry
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   151
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   152
lemma s2d_main:
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   153
  "ss \<in> static \<Longrightarrow> \<exists> s. valid s \<and> s2ss s = ss"
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   154
apply (erule static.induct)
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   155
apply (rule_tac x = "[]" in exI, simp add:s2ss_nil_prop valid.intros)
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   156
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   157
apply (erule exE|erule conjE)+
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   158
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   159
apply (simp add:update_ss_def)
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   160
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   161
sorry
051b0ee98852 restructured
chunhan
parents: 62
diff changeset
   162
1
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   163
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   164
lemma t2ts:
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   165
  "obj \<in> tainted s \<Longrightarrow> co2sobj s obj = Some sobj \<Longrightarrow> tainted_s (s2ss s) sobj"
19
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 1
diff changeset
   166
apply (frule tainted_in_current, frule tainted_is_valid)
62
9fc384154e84 new structure for sound and complete
chunhan
parents: 61
diff changeset
   167
apply (frule s2ss_included_sobj, simp)
1
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   168
apply (case_tac sobj, simp_all)
61
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
   169
apply (case_tac [!] obj, simp_all add:co2sobj.simps split:option.splits if_splits)
19
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 1
diff changeset
   170
apply (drule dir_not_tainted, simp)
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 1
diff changeset
   171
apply (drule msgq_not_tainted, simp)
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 1
diff changeset
   172
apply (drule shm_not_tainted, simp)
43
chunhan
parents: 32
diff changeset
   173
done
1
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   174
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   175
lemma delq_imp_delqm:
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   176
  "deleted (O_msgq q) s \<Longrightarrow> deleted (O_msg q m) s"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   177
apply (induct s, simp)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   178
by (case_tac a, auto)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   179
61
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
   180
lemma tainted_s_subset_prop:
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
   181
  "\<lbrakk>tainted_s ss sobj; ss \<subseteq> ss'\<rbrakk> \<Longrightarrow> tainted_s ss' sobj"
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
   182
apply (case_tac sobj)
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
   183
apply auto
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
   184
done
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
   185
1
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   186
theorem static_complete: 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   187
  assumes undel: "undeletable obj" and tbl: "taintable obj"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   188
  shows "taintable_s obj"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   189
proof-
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   190
  from tbl obtain s where tainted: "obj \<in> tainted s"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   191
    by (auto simp:taintable_def)
19
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 1
diff changeset
   192
  hence vs: "valid s" by (simp add:tainted_is_valid)
61
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
   193
  hence static: "s2ss s \<propto> static" using d2s_main by auto
62
9fc384154e84 new structure for sound and complete
chunhan
parents: 61
diff changeset
   194
  from tainted tbl vs obtain sobj where sobj: "co2sobj s obj = Some sobj" 
9fc384154e84 new structure for sound and complete
chunhan
parents: 61
diff changeset
   195
    apply (clarsimp simp add:taintable_def)
9fc384154e84 new structure for sound and complete
chunhan
parents: 61
diff changeset
   196
    apply (frule tainted_in_current)
9fc384154e84 new structure for sound and complete
chunhan
parents: 61
diff changeset
   197
    apply (case_tac obj, simp_all add:co2sobj.simps)
9fc384154e84 new structure for sound and complete
chunhan
parents: 61
diff changeset
   198
    apply (frule current_proc_has_sp, simp, auto)
9fc384154e84 new structure for sound and complete
chunhan
parents: 61
diff changeset
   199
    done
1
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   200
  from undel vs have "\<not> deleted obj s" and init_alive: "init_alive obj" 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   201
    by (auto simp:undeletable_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   202
  with vs sobj have "init_obj_related sobj obj"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   203
    apply (case_tac obj, case_tac [!] sobj)
61
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
   204
    apply (auto split:option.splits if_splits simp:co2sobj.simps cp2sproc_def ch2sshm_def cq2smsgq_def cm2smsg_def delq_imp_delqm)
43
chunhan
parents: 32
diff changeset
   205
    apply (frule not_deleted_init_file, simp+) 
chunhan
parents: 32
diff changeset
   206
    apply (drule is_file_has_sfile', simp, erule exE)
1
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   207
    apply (rule_tac x = sf in bexI)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   208
    apply (case_tac list, auto split:option.splits simp:is_init_file_props)[1]
43
chunhan
parents: 32
diff changeset
   209
    apply (drule root_is_init_dir', simp)
chunhan
parents: 32
diff changeset
   210
    apply (frule not_deleted_init_file, simp, simp)
chunhan
parents: 32
diff changeset
   211
    apply (simp add:cf2sfile_def split:option.splits if_splits)
chunhan
parents: 32
diff changeset
   212
    apply (simp add:cf2sfiles_def)
chunhan
parents: 32
diff changeset
   213
    apply (rule_tac x = list in bexI, simp, simp add:same_inode_files_def not_deleted_init_file)
chunhan
parents: 32
diff changeset
   214
chunhan
parents: 32
diff changeset
   215
    apply (frule not_deleted_init_dir, simp+)
chunhan
parents: 32
diff changeset
   216
    apply (simp add:cf2sfile_def split:option.splits if_splits)
chunhan
parents: 32
diff changeset
   217
    apply (case_tac list, simp add:sroot_def, simp)
chunhan
parents: 32
diff changeset
   218
    apply (drule file_dir_conflict, simp+)
chunhan
parents: 32
diff changeset
   219
    done
1
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   220
  with tainted t2ts init_alive sobj static
61
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
   221
  show ?thesis unfolding taintable_s_def 
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
   222
    apply (simp add:init_ss_in_def)
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
   223
    apply (erule bexE)
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
   224
    apply (simp add:init_ss_eq_def)
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
   225
    apply (rule_tac x = "ss'" in bexI)
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
   226
    apply (rule_tac x = "sobj" in exI)
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
   227
    by (auto intro:tainted_s_subset_prop)
1
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   228
qed
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   229
19
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 1
diff changeset
   230
lemma cp2sproc_pi:
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 1
diff changeset
   231
  "\<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"
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 1
diff changeset
   232
by (simp add:cp2sproc_def split:option.splits if_splits)
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 1
diff changeset
   233
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 1
diff changeset
   234
lemma cq2smsgq_qi:
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 1
diff changeset
   235
  "\<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"
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 1
diff changeset
   236
by (simp add:cq2smsgq_def split:option.splits if_splits)
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 1
diff changeset
   237
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 1
diff changeset
   238
lemma cm2smsg_mi:
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 1
diff changeset
   239
  "\<lbrakk>cm2smsg s q m = Some (Init m', sec, ttag); q \<in> init_msgqs; valid s\<rbrakk> 
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 1
diff changeset
   240
   \<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"
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 1
diff changeset
   241
by (clarsimp simp add:cm2smsg_def split:if_splits option.splits)
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 1
diff changeset
   242
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 1
diff changeset
   243
lemma ch2sshm_hi:
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 1
diff changeset
   244
  "\<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"
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 1
diff changeset
   245
by (clarsimp simp:ch2sshm_def split:if_splits option.splits)
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 1
diff changeset
   246
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 1
diff changeset
   247
lemma root_not_deleted:
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 1
diff changeset
   248
  "\<lbrakk>deleted (O_dir []) s; valid s\<rbrakk> \<Longrightarrow> False"
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 1
diff changeset
   249
apply (induct s, simp)
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 1
diff changeset
   250
apply (frule vd_cons, frule vt_grant_os, case_tac a, auto)
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 1
diff changeset
   251
done
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 1
diff changeset
   252
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 1
diff changeset
   253
lemma cf2sfile_fi:
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 1
diff changeset
   254
  "\<lbrakk>cf2sfile s f = Some (Init f', sec, psecopt, asecs); valid s\<rbrakk> \<Longrightarrow> f = f' \<and> 
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 1
diff changeset
   255
     (if (is_file s f) then \<not> deleted (O_file f) s \<and> is_init_file f 
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 1
diff changeset
   256
      else \<not> deleted (O_dir f) s \<and> is_init_dir f)"
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 1
diff changeset
   257
apply (case_tac f)
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 1
diff changeset
   258
by (auto simp:sroot_def cf2sfile_def root_is_init_dir dest!:root_is_dir' root_not_deleted
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 1
diff changeset
   259
        split:if_splits option.splits) 
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 1
diff changeset
   260
1
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   261
lemma init_deled_imp_deled_s: 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   262
  "\<lbrakk>deleted obj s; init_alive obj; sobj \<in> (s2ss s); valid s\<rbrakk> \<Longrightarrow> \<not> init_obj_related sobj obj"
19
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 1
diff changeset
   263
apply (rule notI)
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 1
diff changeset
   264
apply (clarsimp simp:s2ss_def)
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 1
diff changeset
   265
apply (case_tac obj, case_tac [!] obja, case_tac sobj)
61
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
   266
apply (auto split:option.splits if_splits dest!:cp2sproc_pi cq2smsgq_qi ch2sshm_hi cm2smsg_mi cf2sfile_fi simp:co2sobj.simps)
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
   267
apply (auto simp:cf2sfiles_def same_inode_files_def has_same_inode_prop1' is_file_def is_dir_def co2sobj.simps
20
e2c6af3ccb0d fixed bug in tainted_s and update
chunhan
parents: 19
diff changeset
   268
           split:option.splits t_inode_tag.splits dest!:cf2sfile_fi)
19
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 1
diff changeset
   269
done
1
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   270
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   271
lemma deleted_imp_deletable_s:
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   272
  "\<lbrakk>deleted obj s; init_alive obj; valid s\<rbrakk> \<Longrightarrow> deletable_s obj"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   273
apply (simp add:deletable_s_def)
61
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
   274
apply (frule d2s_main)
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
   275
apply (simp add:init_ss_in_def)
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
   276
apply (erule bexE)
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
   277
apply (rule_tac x = ss' in bexI)
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
   278
apply (auto simp add: init_ss_eq_def dest!:init_deled_imp_deled_s)
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
   279
apply (case_tac obj, case_tac [!] sobj)
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
   280
apply auto
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
   281
apply (erule set_mp)
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
   282
apply (simp)
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
   283
apply auto
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
   284
apply (rule_tac x = "(Init list, (aa, ab, b), ac, ba)" in bexI)
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
   285
apply auto
1
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   286
done
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   287
62
9fc384154e84 new structure for sound and complete
chunhan
parents: 61
diff changeset
   288
lemma init_related_imp_init_sobj:
9fc384154e84 new structure for sound and complete
chunhan
parents: 61
diff changeset
   289
  "init_obj_related sobj obj \<Longrightarrow> is_init_sobj sobj"
9fc384154e84 new structure for sound and complete
chunhan
parents: 61
diff changeset
   290
apply (case_tac sobj, case_tac [!] obj, auto)
9fc384154e84 new structure for sound and complete
chunhan
parents: 61
diff changeset
   291
apply (rule_tac x = "(Init list, (aa, ab, b), ac, ba)" in bexI, auto)
9fc384154e84 new structure for sound and complete
chunhan
parents: 61
diff changeset
   292
done
9fc384154e84 new structure for sound and complete
chunhan
parents: 61
diff changeset
   293
1
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   294
theorem undeletable_s_complete:
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   295
  assumes undel_s: "undeletable_s obj"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   296
  shows "undeletable obj"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   297
proof-
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   298
  from undel_s have init_alive: "init_alive obj"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   299
    and alive_s: "\<forall> ss \<in> static. \<exists> sobj \<in> ss. init_obj_related sobj obj" 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   300
    using undeletable_s_def by auto
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   301
  have "\<not> (\<exists> s. valid s \<and> deleted obj s)" 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   302
  proof
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   303
    assume "\<exists> s. valid s \<and> deleted obj s"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   304
    then obtain s where vs: "valid s" and del: "deleted obj s" by auto
61
0d219ddd6354 appropriate object for taintable
chunhan
parents: 43
diff changeset
   305
    from vs have vss: "s2ss s \<propto> static" by (rule d2s_main) 
1
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   306
    with alive_s obtain sobj where in_ss: "sobj \<in> (s2ss s)" 
62
9fc384154e84 new structure for sound and complete
chunhan
parents: 61
diff changeset
   307
      and related: "init_obj_related sobj obj" 
9fc384154e84 new structure for sound and complete
chunhan
parents: 61
diff changeset
   308
      apply (simp add:init_ss_in_def init_ss_eq_def)
9fc384154e84 new structure for sound and complete
chunhan
parents: 61
diff changeset
   309
      apply (erule bexE, erule_tac x= ss' in ballE)
9fc384154e84 new structure for sound and complete
chunhan
parents: 61
diff changeset
   310
      apply (auto dest:init_related_imp_init_sobj)
9fc384154e84 new structure for sound and complete
chunhan
parents: 61
diff changeset
   311
      done
1
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   312
    from init_alive del vs have "deletable_s obj" 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   313
      by (auto elim:deleted_imp_deletable_s)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   314
    with alive_s
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   315
    show False by (auto simp:deletable_s_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   316
  qed
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   317
  with init_alive show ?thesis 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   318
    by (simp add:undeletable_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   319
qed
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   320
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   321
theorem final_offer:
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   322
  "\<lbrakk>undeletable_s obj; \<not> taintable_s obj; init_alive obj\<rbrakk> \<Longrightarrow> \<not> taintable obj"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   323
apply (erule swap)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   324
by (simp add:static_complete undeletable_s_complete)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   325
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   326
(************** static \<rightarrow> dynamic ***************)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   327
20
e2c6af3ccb0d fixed bug in tainted_s and update
chunhan
parents: 19
diff changeset
   328
e2c6af3ccb0d fixed bug in tainted_s and update
chunhan
parents: 19
diff changeset
   329
lemma set_eq_D:
e2c6af3ccb0d fixed bug in tainted_s and update
chunhan
parents: 19
diff changeset
   330
  "\<lbrakk>x \<in> S; {x. P x} = S\<rbrakk> \<Longrightarrow> P x"
e2c6af3ccb0d fixed bug in tainted_s and update
chunhan
parents: 19
diff changeset
   331
by auto
e2c6af3ccb0d fixed bug in tainted_s and update
chunhan
parents: 19
diff changeset
   332
e2c6af3ccb0d fixed bug in tainted_s and update
chunhan
parents: 19
diff changeset
   333
lemma cqm2sms_prop1:
e2c6af3ccb0d fixed bug in tainted_s and update
chunhan
parents: 19
diff changeset
   334
  "\<lbrakk>cqm2sms s q queue = Some sms; sm \<in> set sms\<rbrakk> \<Longrightarrow> \<exists> m. cm2smsg s q m = Some sm"
e2c6af3ccb0d fixed bug in tainted_s and update
chunhan
parents: 19
diff changeset
   335
apply (induct queue arbitrary:sms)
43
chunhan
parents: 32
diff changeset
   336
apply (auto simp:cqm2sms.simps split:option.splits)
20
e2c6af3ccb0d fixed bug in tainted_s and update
chunhan
parents: 19
diff changeset
   337
done
1
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   338
20
e2c6af3ccb0d fixed bug in tainted_s and update
chunhan
parents: 19
diff changeset
   339
lemma sq_sm_prop:
e2c6af3ccb0d fixed bug in tainted_s and update
chunhan
parents: 19
diff changeset
   340
  "\<lbrakk>sm \<in> set sms; cq2smsgq s q = Some (qi, qsec, sms); valid s\<rbrakk>
e2c6af3ccb0d fixed bug in tainted_s and update
chunhan
parents: 19
diff changeset
   341
   \<Longrightarrow> \<exists> m. cm2smsg s q m = Some sm"
e2c6af3ccb0d fixed bug in tainted_s and update
chunhan
parents: 19
diff changeset
   342
by (auto simp:cq2smsgq_def split: option.splits intro:cqm2sms_prop1)
e2c6af3ccb0d fixed bug in tainted_s and update
chunhan
parents: 19
diff changeset
   343
62
9fc384154e84 new structure for sound and complete
chunhan
parents: 61
diff changeset
   344
declare co2sobj.simps [simp add]
9fc384154e84 new structure for sound and complete
chunhan
parents: 61
diff changeset
   345
20
e2c6af3ccb0d fixed bug in tainted_s and update
chunhan
parents: 19
diff changeset
   346
lemma tainted_s_imp_tainted:
e2c6af3ccb0d fixed bug in tainted_s and update
chunhan
parents: 19
diff changeset
   347
  "\<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"
e2c6af3ccb0d fixed bug in tainted_s and update
chunhan
parents: 19
diff changeset
   348
apply (drule s2d_main)
e2c6af3ccb0d fixed bug in tainted_s and update
chunhan
parents: 19
diff changeset
   349
apply (erule exE, erule conjE, simp add:s2ss_def)
e2c6af3ccb0d fixed bug in tainted_s and update
chunhan
parents: 19
diff changeset
   350
apply (rule_tac x = s in exI, simp)
e2c6af3ccb0d fixed bug in tainted_s and update
chunhan
parents: 19
diff changeset
   351
apply (case_tac sobj, simp_all)
e2c6af3ccb0d fixed bug in tainted_s and update
chunhan
parents: 19
diff changeset
   352
apply (erule conjE, drule_tac S = ss in set_eq_D, simp, (erule exE|erule conjE)+) 
e2c6af3ccb0d fixed bug in tainted_s and update
chunhan
parents: 19
diff changeset
   353
apply (rule_tac x = obj in exI, simp)
e2c6af3ccb0d fixed bug in tainted_s and update
chunhan
parents: 19
diff changeset
   354
apply (case_tac obj, (simp split:option.splits if_splits)+)
e2c6af3ccb0d fixed bug in tainted_s and update
chunhan
parents: 19
diff changeset
   355
e2c6af3ccb0d fixed bug in tainted_s and update
chunhan
parents: 19
diff changeset
   356
apply (erule conjE, drule_tac S = ss in set_eq_D, simp, (erule exE|erule conjE)+) 
e2c6af3ccb0d fixed bug in tainted_s and update
chunhan
parents: 19
diff changeset
   357
apply (rule_tac x = obj in exI, simp)
e2c6af3ccb0d fixed bug in tainted_s and update
chunhan
parents: 19
diff changeset
   358
apply (case_tac obj, (simp split:option.splits if_splits)+)
21
chunhan
parents: 20
diff changeset
   359
done
1
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   360
62
9fc384154e84 new structure for sound and complete
chunhan
parents: 61
diff changeset
   361
lemma has_same_inode_prop3:
9fc384154e84 new structure for sound and complete
chunhan
parents: 61
diff changeset
   362
  "has_same_inode s f f' \<Longrightarrow> has_same_inode s f' f"
9fc384154e84 new structure for sound and complete
chunhan
parents: 61
diff changeset
   363
by (auto simp:has_same_inode_def)
1
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   364
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   365
theorem static_sound:
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   366
  assumes tbl_s: "taintable_s obj"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   367
  shows "taintable obj"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   368
proof-
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   369
  from tbl_s obtain ss sobj where static: "ss \<in> static"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   370
    and sobj: "tainted_s ss sobj" and related: "init_obj_related sobj obj"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   371
    and init_alive: "init_alive obj" by (auto simp:taintable_s_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   372
  from static sobj tainted_s_imp_tainted 
20
e2c6af3ccb0d fixed bug in tainted_s and update
chunhan
parents: 19
diff changeset
   373
  obtain s obj' where co2sobj: "co2sobj s obj' = Some sobj"
e2c6af3ccb0d fixed bug in tainted_s and update
chunhan
parents: 19
diff changeset
   374
    and tainted': "obj' \<in> tainted s" and vs: "valid s" by blast
1
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   375
  
20
e2c6af3ccb0d fixed bug in tainted_s and update
chunhan
parents: 19
diff changeset
   376
  from co2sobj related vs
e2c6af3ccb0d fixed bug in tainted_s and update
chunhan
parents: 19
diff changeset
   377
  have eq:"obj = obj' \<or> (\<exists> f f'. obj = O_file f \<and> obj' = O_file f' \<and> has_same_inode s f f')"
e2c6af3ccb0d fixed bug in tainted_s and update
chunhan
parents: 19
diff changeset
   378
    apply (case_tac obj', case_tac [!] obj)
e2c6af3ccb0d fixed bug in tainted_s and update
chunhan
parents: 19
diff changeset
   379
    apply (auto split:option.splits if_splits dest!:cp2sproc_pi cq2smsgq_qi ch2sshm_hi cm2smsg_mi cf2sfile_fi)
e2c6af3ccb0d fixed bug in tainted_s and update
chunhan
parents: 19
diff changeset
   380
    apply (auto simp:cf2sfiles_def same_inode_files_def has_same_inode_def is_file_def is_dir_def
e2c6af3ccb0d fixed bug in tainted_s and update
chunhan
parents: 19
diff changeset
   381
               split:option.splits t_inode_tag.splits dest!:cf2sfile_fi)
e2c6af3ccb0d fixed bug in tainted_s and update
chunhan
parents: 19
diff changeset
   382
    done
62
9fc384154e84 new structure for sound and complete
chunhan
parents: 61
diff changeset
   383
  with tainted' vs have tainted: "obj \<in> tainted s"
9fc384154e84 new structure for sound and complete
chunhan
parents: 61
diff changeset
   384
    by (auto dest:has_same_inode_prop3 intro:has_same_inode_tainted)
9fc384154e84 new structure for sound and complete
chunhan
parents: 61
diff changeset
   385
  from sobj related init_alive have "appropriate obj"
9fc384154e84 new structure for sound and complete
chunhan
parents: 61
diff changeset
   386
    by (case_tac obj, case_tac [!] sobj, auto)
9fc384154e84 new structure for sound and complete
chunhan
parents: 61
diff changeset
   387
  with vs init_alive tainted
1
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   388
  show ?thesis by (auto simp:taintable_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   389
qed
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   390
62
9fc384154e84 new structure for sound and complete
chunhan
parents: 61
diff changeset
   391
end
1
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   392
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   393
end