S2ss_prop.thy
author chunhan
Fri, 27 Sep 2013 11:36:51 +0800
changeset 53 e3ad1b294fd9
parent 52 ec73b98d4a64
child 54 e934f9a697f5
permissions -rw-r--r--
s2ss_truncate s2ss_createmsgq
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
32
705e1e41faf7 add event-trace simpset for s2ss
chunhan
parents:
diff changeset
     1
(*<*)
705e1e41faf7 add event-trace simpset for s2ss
chunhan
parents:
diff changeset
     2
theory S2ss_prop
705e1e41faf7 add event-trace simpset for s2ss
chunhan
parents:
diff changeset
     3
imports Main Flask Flask_type Static Static_type Init_prop Tainted_prop Valid_prop Alive_prop Co2sobj_prop
705e1e41faf7 add event-trace simpset for s2ss
chunhan
parents:
diff changeset
     4
begin
705e1e41faf7 add event-trace simpset for s2ss
chunhan
parents:
diff changeset
     5
(*>*)
705e1e41faf7 add event-trace simpset for s2ss
chunhan
parents:
diff changeset
     6
33
6884b3c9284b fix bug of static.thy for the static of recvmsg case
chunhan
parents: 32
diff changeset
     7
context tainting_s begin
6884b3c9284b fix bug of static.thy for the static of recvmsg case
chunhan
parents: 32
diff changeset
     8
41
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
     9
(* simpset for s2ss*)
39
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
    10
43
chunhan
parents: 42
diff changeset
    11
lemma co2sobj_some_case:
chunhan
parents: 42
diff changeset
    12
  "\<lbrakk>co2sobj s obj = Some sobj; \<And> p. obj = O_proc p \<Longrightarrow> P (O_proc p);
chunhan
parents: 42
diff changeset
    13
    \<And> f. obj = O_file f \<Longrightarrow> P (O_file f); \<And> h. obj = O_shm h \<Longrightarrow> P (O_shm h);
chunhan
parents: 42
diff changeset
    14
    \<And> f. obj = O_dir f \<Longrightarrow> P (O_dir f); \<And> q. obj = O_msgq q \<Longrightarrow> P (O_msgq q)\<rbrakk>
chunhan
parents: 42
diff changeset
    15
   \<Longrightarrow> P obj"
chunhan
parents: 42
diff changeset
    16
by (case_tac obj, auto)
chunhan
parents: 42
diff changeset
    17
chunhan
parents: 42
diff changeset
    18
lemma co2sobj_execve_alive:
chunhan
parents: 42
diff changeset
    19
  "\<lbrakk>alive s obj; co2sobj s obj = Some x; valid (Execve p f fds # s)\<rbrakk>
chunhan
parents: 42
diff changeset
    20
   \<Longrightarrow> alive (Execve p f fds # s) obj"
chunhan
parents: 42
diff changeset
    21
apply (erule co2sobj_some_case)
chunhan
parents: 42
diff changeset
    22
by (auto simp:alive_simps simp del:alive.simps)
39
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
    23
33
6884b3c9284b fix bug of static.thy for the static of recvmsg case
chunhan
parents: 32
diff changeset
    24
lemma s2ss_execve:
34
e7f850d1e08e remove O_msg from co2sobj/init_obj2sobj
chunhan
parents: 33
diff changeset
    25
  "valid (Execve p f fds # s) \<Longrightarrow> s2ss (Execve p f fds # s) = (
e7f850d1e08e remove O_msg from co2sobj/init_obj2sobj
chunhan
parents: 33
diff changeset
    26
     if (\<exists> p'. p' \<noteq> p \<and> p' \<in> current_procs s \<and> co2sobj s (O_proc p') = co2sobj s (O_proc p))
35
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    27
     then (case (cp2sproc (Execve p f fds # s) p) of
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    28
             Some sp \<Rightarrow> s2ss s \<union> {S_proc sp (O_proc p \<in> Tainted s \<or> O_file f \<in> Tainted s)}
43
chunhan
parents: 42
diff changeset
    29
           | _ \<Rightarrow> {} )
chunhan
parents: 42
diff changeset
    30
     else (case (cp2sproc (Execve p f fds # s) p, cp2sproc s p) of
chunhan
parents: 42
diff changeset
    31
             (Some sp, Some sp') \<Rightarrow> s2ss s - {S_proc sp' (O_proc p \<in> Tainted s)}
chunhan
parents: 42
diff changeset
    32
                                    \<union> {S_proc sp (O_proc p \<in> Tainted s \<or> O_file f \<in> Tainted s)}
chunhan
parents: 42
diff changeset
    33
           | _ \<Rightarrow> {} ) )"
35
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    34
apply (frule vd_cons, frule vt_grant_os, simp split:if_splits)
42
chunhan
parents: 41
diff changeset
    35
41
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
    36
apply (rule conjI, rule impI, (erule exE|erule conjE)+)
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
    37
apply (frule_tac p = p in current_proc_has_sp, simp, erule exE)
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
    38
apply (frule_tac p = p' in current_proc_has_sp, simp, erule exE, simp)
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
    39
apply (subgoal_tac "p \<in> current_procs (Execve p f fds # s)")
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
    40
apply (drule_tac p = p and s = "Execve p f fds # s" in current_proc_has_sp, simp)
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
    41
apply (erule exE, simp)
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
    42
apply (simp add:s2ss_def, rule set_eqI, rule iffI)
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
    43
apply (drule CollectD, (erule exE|erule conjE)+)
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
    44
apply (case_tac "obj = O_proc p")
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
    45
apply (simp add:co2sobj_execve tainted_eq_Tainted split:if_splits)
42
chunhan
parents: 41
diff changeset
    46
apply (simp add:co2sobj_execve, rule disjI2)
chunhan
parents: 41
diff changeset
    47
apply (rule_tac x = obj in exI, case_tac obj, (simp add:alive_simps)+)[1]
chunhan
parents: 41
diff changeset
    48
apply (simp, erule disjE)
chunhan
parents: 41
diff changeset
    49
apply (rule_tac x = "O_proc p" in exI, simp add:tainted_eq_Tainted)
chunhan
parents: 41
diff changeset
    50
apply (erule exE| erule conjE)+
chunhan
parents: 41
diff changeset
    51
apply (case_tac "x = S_proc sp (O_proc p \<in> tainted s)")
chunhan
parents: 41
diff changeset
    52
apply (rule_tac x = "O_proc p'" in exI)
chunhan
parents: 41
diff changeset
    53
apply (simp add:alive_execve co2sobj_execve tainted_eq_Tainted cp2sproc_execve)
43
chunhan
parents: 42
diff changeset
    54
apply (case_tac "obj = O_proc p", simp)
chunhan
parents: 42
diff changeset
    55
apply (frule co2sobj_execve_alive, simp, simp)
chunhan
parents: 42
diff changeset
    56
apply (frule_tac obj = obj in co2sobj_execve, simp)
chunhan
parents: 42
diff changeset
    57
apply (rule_tac x = obj in exI, simp, simp)
41
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
    58
43
chunhan
parents: 42
diff changeset
    59
apply (erule conjE, frule current_proc_has_sp, simp, erule exE, rule impI, simp)
chunhan
parents: 42
diff changeset
    60
apply (subgoal_tac "p \<in> current_procs (Execve p f fds # s)") 
chunhan
parents: 42
diff changeset
    61
apply (drule_tac p = p and s = "Execve p f fds # s" in current_proc_has_sp, simp)
chunhan
parents: 42
diff changeset
    62
apply (erule exE, erule conjE, simp)
chunhan
parents: 42
diff changeset
    63
apply (simp add:s2ss_def, rule set_eqI, rule iffI)
chunhan
parents: 42
diff changeset
    64
apply (drule CollectD, (erule exE|erule conjE)+)
chunhan
parents: 42
diff changeset
    65
apply (case_tac "obj = O_proc p", simp add:tainted_eq_Tainted)
chunhan
parents: 42
diff changeset
    66
apply (rule disjI1, simp split:if_splits)
41
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
    67
apply (simp add:co2sobj_execve, rule disjI2)
43
chunhan
parents: 42
diff changeset
    68
apply (rule conjI,rule_tac x = obj in exI, simp add:alive_simps split:t_object.splits)
chunhan
parents: 42
diff changeset
    69
apply (rule notI, simp, case_tac obj)
chunhan
parents: 42
diff changeset
    70
apply (erule_tac x = nat in allE, simp add:tainted_eq_Tainted, (simp split:option.splits)+)
chunhan
parents: 42
diff changeset
    71
apply (erule disjE, simp)
chunhan
parents: 42
diff changeset
    72
apply (rule_tac x = "O_proc p" in exI, simp add:tainted_eq_Tainted)
chunhan
parents: 42
diff changeset
    73
apply (erule exE|erule conjE)+
chunhan
parents: 42
diff changeset
    74
apply (rule_tac x = obj in exI)
chunhan
parents: 42
diff changeset
    75
apply (drule_tac obj = obj in co2sobj_execve_alive, simp+)
chunhan
parents: 42
diff changeset
    76
apply (frule_tac obj = obj in co2sobj_execve, simp, simp)
chunhan
parents: 42
diff changeset
    77
apply (rule impI, simp add:tainted_eq_Tainted, simp)
chunhan
parents: 42
diff changeset
    78
done
chunhan
parents: 42
diff changeset
    79
chunhan
parents: 42
diff changeset
    80
lemma s2ss_clone_alive:
chunhan
parents: 42
diff changeset
    81
  "\<lbrakk>co2sobj s obj = Some x; alive s obj; obj \<noteq> O_proc p'; valid (Clone p p' fds shms # s)\<rbrakk>
chunhan
parents: 42
diff changeset
    82
   \<Longrightarrow> alive (Clone p p' fds shms # s) obj"
chunhan
parents: 42
diff changeset
    83
by (erule co2sobj_some_case, auto simp:alive_clone)
chunhan
parents: 42
diff changeset
    84
chunhan
parents: 42
diff changeset
    85
lemma s2ss_clone:
chunhan
parents: 42
diff changeset
    86
  "valid (Clone p p' fds shms # s) \<Longrightarrow> s2ss (Clone p p' fds shms # s) = (
chunhan
parents: 42
diff changeset
    87
     case (cp2sproc (Clone p p' fds shms # s) p') of
chunhan
parents: 42
diff changeset
    88
       Some sp \<Rightarrow> s2ss s \<union> {S_proc sp (O_proc p \<in> Tainted s)}
chunhan
parents: 42
diff changeset
    89
     | _       \<Rightarrow> {})"
chunhan
parents: 42
diff changeset
    90
apply (frule vd_cons, frule vt_grant_os, split option.splits)
chunhan
parents: 42
diff changeset
    91
apply (rule conjI, rule impI, drule current_proc_has_sp', simp, simp)
chunhan
parents: 42
diff changeset
    92
apply (rule allI, rule impI, simp add:s2ss_def)
chunhan
parents: 42
diff changeset
    93
apply (rule set_eqI, rule iffI, drule CollectD, (erule exE|erule conjE)+)
chunhan
parents: 42
diff changeset
    94
apply (case_tac "obj = O_proc p'", simp add:tainted_eq_Tainted)
chunhan
parents: 42
diff changeset
    95
apply (case_tac "O_proc p' \<in> Tainted s", drule Tainted_in_current, simp+)
chunhan
parents: 42
diff changeset
    96
apply (rule disjI1, simp split:if_splits)
chunhan
parents: 42
diff changeset
    97
apply (simp add:tainted_eq_Tainted, rule disjI2)
chunhan
parents: 42
diff changeset
    98
apply (frule co2sobj_clone, simp)
chunhan
parents: 42
diff changeset
    99
apply (rule_tac x = obj in exI, simp add:alive_simps split:t_object.splits)
chunhan
parents: 42
diff changeset
   100
chunhan
parents: 42
diff changeset
   101
apply (simp, erule disjE, simp)
chunhan
parents: 42
diff changeset
   102
apply (rule_tac x = "O_proc p'" in exI, simp add:tainted_eq_Tainted)
chunhan
parents: 42
diff changeset
   103
apply (rule impI, rule notI, drule Tainted_in_current, simp+)
chunhan
parents: 42
diff changeset
   104
apply (erule exE| erule conjE)+
chunhan
parents: 42
diff changeset
   105
apply (case_tac "obj = O_proc p'", simp)
chunhan
parents: 42
diff changeset
   106
apply (rule_tac x = obj in exI)
chunhan
parents: 42
diff changeset
   107
apply (frule s2ss_clone_alive, simp+)
chunhan
parents: 42
diff changeset
   108
apply (auto simp:co2sobj_clone alive_simps)
chunhan
parents: 42
diff changeset
   109
done
chunhan
parents: 42
diff changeset
   110
chunhan
parents: 42
diff changeset
   111
definition update_s2ss_shm:: "t_state \<Rightarrow> t_process \<Rightarrow> t_static_state" 
chunhan
parents: 42
diff changeset
   112
where
chunhan
parents: 42
diff changeset
   113
  "update_s2ss_shm s pfrom \<equiv> s2ss s 
chunhan
parents: 42
diff changeset
   114
     \<union> {S_proc sp True| sp p. info_flow_shm s pfrom p \<and> cp2sproc s p = Some sp}
chunhan
parents: 42
diff changeset
   115
     - {S_proc sp False | sp p. info_flow_shm s pfrom p \<and> cp2sproc s p = Some sp \<and> 
chunhan
parents: 42
diff changeset
   116
           (\<not> (\<exists> p'. \<not> info_flow_shm s pfrom p' \<and> p' \<in> current_procs s \<and> 
chunhan
parents: 42
diff changeset
   117
                cp2sproc s p' = Some sp \<and> O_proc p' \<notin> Tainted s))}"
chunhan
parents: 42
diff changeset
   118
chunhan
parents: 42
diff changeset
   119
lemma Tainted_ptrace':
chunhan
parents: 42
diff changeset
   120
  "valid s \<Longrightarrow> Tainted (Ptrace p p' # s) = 
chunhan
parents: 42
diff changeset
   121
     (if (O_proc p \<in> Tainted s \<and> O_proc p' \<notin> Tainted s)
chunhan
parents: 42
diff changeset
   122
      then Tainted s \<union> {O_proc p'' | p''. info_flow_shm s p' p''}
chunhan
parents: 42
diff changeset
   123
      else if (O_proc p' \<in> Tainted s \<and> O_proc p \<notin> Tainted s)
chunhan
parents: 42
diff changeset
   124
           then Tainted s \<union> {O_proc p'' | p''. info_flow_shm s p p''}
chunhan
parents: 42
diff changeset
   125
                else Tainted s)"
chunhan
parents: 42
diff changeset
   126
using info_flow_shm_Tainted by auto
chunhan
parents: 42
diff changeset
   127
chunhan
parents: 42
diff changeset
   128
lemma co2sobj_some_caseD:
chunhan
parents: 42
diff changeset
   129
  "\<lbrakk>co2sobj s obj = Some sobj; \<And> p. \<lbrakk>co2sobj s obj = Some sobj; obj = O_proc p\<rbrakk> \<Longrightarrow> P (O_proc p);
chunhan
parents: 42
diff changeset
   130
    \<And> f. \<lbrakk>co2sobj s obj = Some sobj; obj = O_file f\<rbrakk> \<Longrightarrow> P (O_file f); 
chunhan
parents: 42
diff changeset
   131
    \<And> h. \<lbrakk>co2sobj s obj = Some sobj; obj = O_shm h\<rbrakk> \<Longrightarrow> P (O_shm h);
chunhan
parents: 42
diff changeset
   132
    \<And> f. \<lbrakk>co2sobj s obj = Some sobj; obj = O_dir f\<rbrakk> \<Longrightarrow> P (O_dir f); 
chunhan
parents: 42
diff changeset
   133
    \<And> q. \<lbrakk>co2sobj s obj = Some sobj; obj = O_msgq q\<rbrakk> \<Longrightarrow> P (O_msgq q)\<rbrakk>
chunhan
parents: 42
diff changeset
   134
   \<Longrightarrow> P obj"
chunhan
parents: 42
diff changeset
   135
by (case_tac obj, auto)
chunhan
parents: 42
diff changeset
   136
chunhan
parents: 42
diff changeset
   137
lemma s2ss_ptrace1_aux: "x \<notin> {x. P x} \<Longrightarrow> \<not> P x" by simp
chunhan
parents: 42
diff changeset
   138
chunhan
parents: 42
diff changeset
   139
lemma s2ss_ptrace1:
chunhan
parents: 42
diff changeset
   140
  "\<lbrakk>valid (Ptrace p p' # s); O_proc p \<in> Tainted s; O_proc p' \<notin> Tainted s\<rbrakk>
chunhan
parents: 42
diff changeset
   141
   \<Longrightarrow> s2ss (Ptrace p p' # s) = update_s2ss_shm s p'"
chunhan
parents: 42
diff changeset
   142
unfolding update_s2ss_shm_def s2ss_def
chunhan
parents: 42
diff changeset
   143
apply (frule vd_cons, rule set_eqI, rule iffI)
chunhan
parents: 42
diff changeset
   144
apply (drule CollectD, (erule exE|erule conjE)+)
chunhan
parents: 42
diff changeset
   145
apply (erule co2sobj_some_caseD)
chunhan
parents: 42
diff changeset
   146
apply (rule DiffI)
chunhan
parents: 42
diff changeset
   147
apply (case_tac "O_proc pa \<in> Tainted s")
chunhan
parents: 42
diff changeset
   148
apply (rule UnI1, simp, rule_tac x = "O_proc pa" in exI)
chunhan
parents: 42
diff changeset
   149
apply (clarsimp simp:Tainted_ptrace' cp2sproc_other tainted_eq_Tainted split:option.splits)
chunhan
parents: 42
diff changeset
   150
apply (case_tac "info_flow_shm s p' pa")
chunhan
parents: 42
diff changeset
   151
apply (rule UnI2, rule CollectI, simp only:co2sobj.simps split:option.splits)
chunhan
parents: 42
diff changeset
   152
apply (drule current_proc_has_sp', simp, simp)
chunhan
parents: 42
diff changeset
   153
apply (rule_tac x = a in exI, rule_tac x = pa in exI)
chunhan
parents: 42
diff changeset
   154
apply (clarsimp simp:Tainted_ptrace' cp2sproc_other tainted_eq_Tainted split:option.splits)
chunhan
parents: 42
diff changeset
   155
apply (rule UnI1, simp)
chunhan
parents: 42
diff changeset
   156
apply (rule_tac x = "O_proc pa" in exI)
chunhan
parents: 42
diff changeset
   157
apply (clarsimp simp:Tainted_ptrace' cp2sproc_other tainted_eq_Tainted split:option.splits)
chunhan
parents: 42
diff changeset
   158
apply (rule notI, clarsimp simp:cp2sproc_other tainted_eq_Tainted split:option.splits)
chunhan
parents: 42
diff changeset
   159
apply (erule_tac x = pa in allE, simp)
chunhan
parents: 42
diff changeset
   160
chunhan
parents: 42
diff changeset
   161
apply (rule DiffI, rule UnI1, rule CollectI, rule_tac x = obj in exI,
chunhan
parents: 42
diff changeset
   162
       auto split:option.splits simp:co2sobj_ptrace alive_simps simp del:co2sobj.simps)[1]
chunhan
parents: 42
diff changeset
   163
apply (simp)
chunhan
parents: 42
diff changeset
   164
apply (rule DiffI, rule UnI1, rule CollectI, rule_tac x = obj in exI,
chunhan
parents: 42
diff changeset
   165
       auto split:option.splits simp:co2sobj_ptrace alive_simps simp del:co2sobj.simps)[1]
chunhan
parents: 42
diff changeset
   166
apply (simp split:option.splits)
chunhan
parents: 42
diff changeset
   167
apply (rule DiffI, rule UnI1, rule CollectI, rule_tac x = obj in exI,
chunhan
parents: 42
diff changeset
   168
       auto split:option.splits simp:co2sobj_ptrace alive_simps simp del:co2sobj.simps)[1]
chunhan
parents: 42
diff changeset
   169
apply (simp split:option.splits)
chunhan
parents: 42
diff changeset
   170
apply (rule DiffI, rule UnI1, rule CollectI, rule_tac x = obj in exI,
chunhan
parents: 42
diff changeset
   171
       auto split:option.splits simp:co2sobj_ptrace alive_simps simp del:co2sobj.simps)[1]
chunhan
parents: 42
diff changeset
   172
apply (simp split:option.splits)
chunhan
parents: 42
diff changeset
   173
chunhan
parents: 42
diff changeset
   174
apply (erule DiffE, drule s2ss_ptrace1_aux, erule UnE)
chunhan
parents: 42
diff changeset
   175
apply (erule CollectE, (erule exE|erule conjE)+, rule CollectI)
chunhan
parents: 42
diff changeset
   176
apply (erule co2sobj_some_caseD)
chunhan
parents: 42
diff changeset
   177
apply (case_tac "O_proc pa \<in> Tainted s")
chunhan
parents: 42
diff changeset
   178
apply (rule_tac x = "O_proc pa" in exI)
chunhan
parents: 42
diff changeset
   179
apply (clarsimp simp add:tainted_eq_Tainted cp2sproc_other split:option.splits)
chunhan
parents: 42
diff changeset
   180
apply (case_tac "info_flow_shm s p' pa", simp only:co2sobj.simps split:option.splits)
chunhan
parents: 42
diff changeset
   181
apply (drule current_proc_has_sp', simp, simp)
chunhan
parents: 42
diff changeset
   182
apply (drule Meson.not_exD, erule_tac x = a in allE, drule Meson.not_exD, erule_tac x = pa in allE)
chunhan
parents: 42
diff changeset
   183
apply (simp add:tainted_eq_Tainted, (erule exE|erule conjE)+)
chunhan
parents: 42
diff changeset
   184
apply (rule_tac x = "O_proc p'a" in exI)
chunhan
parents: 42
diff changeset
   185
apply (clarsimp simp:Tainted_ptrace' cp2sproc_other tainted_eq_Tainted split:option.splits)
chunhan
parents: 42
diff changeset
   186
apply (rule_tac x = "O_proc pa" in exI)
chunhan
parents: 42
diff changeset
   187
apply (clarsimp simp:Tainted_ptrace' cp2sproc_other tainted_eq_Tainted split:option.splits)
chunhan
parents: 42
diff changeset
   188
chunhan
parents: 42
diff changeset
   189
apply (rule_tac x = obj in exI,
chunhan
parents: 42
diff changeset
   190
       auto split:option.splits simp:co2sobj_ptrace alive_simps simp del:co2sobj.simps)[1]
chunhan
parents: 42
diff changeset
   191
apply (rule_tac x = obj in exI,
chunhan
parents: 42
diff changeset
   192
       auto split:option.splits simp:co2sobj_ptrace alive_simps simp del:co2sobj.simps)[1]
chunhan
parents: 42
diff changeset
   193
apply (rule_tac x = obj in exI,
chunhan
parents: 42
diff changeset
   194
       auto split:option.splits simp:co2sobj_ptrace alive_simps simp del:co2sobj.simps)[1]
chunhan
parents: 42
diff changeset
   195
apply (rule_tac x = obj in exI,
chunhan
parents: 42
diff changeset
   196
       auto split:option.splits simp:co2sobj_ptrace alive_simps simp del:co2sobj.simps)[1]
chunhan
parents: 42
diff changeset
   197
chunhan
parents: 42
diff changeset
   198
apply (erule CollectE, (erule exE|erule conjE)+, rule CollectI)
chunhan
parents: 42
diff changeset
   199
apply (rule_tac x = "O_proc pa" in exI)
chunhan
parents: 42
diff changeset
   200
apply (clarsimp simp:Tainted_ptrace' cp2sproc_other tainted_eq_Tainted info_shm_flow_in_procs)
chunhan
parents: 42
diff changeset
   201
done
chunhan
parents: 42
diff changeset
   202
chunhan
parents: 42
diff changeset
   203
lemma s2ss_ptrace2:
chunhan
parents: 42
diff changeset
   204
  "\<lbrakk>valid (Ptrace p p' # s); O_proc p' \<in> Tainted s; O_proc p \<notin> Tainted s\<rbrakk>
chunhan
parents: 42
diff changeset
   205
   \<Longrightarrow> s2ss (Ptrace p p' # s) = update_s2ss_shm s p"
chunhan
parents: 42
diff changeset
   206
unfolding update_s2ss_shm_def s2ss_def
chunhan
parents: 42
diff changeset
   207
apply (frule vd_cons, rule set_eqI, rule iffI)
chunhan
parents: 42
diff changeset
   208
apply (drule CollectD, (erule exE|erule conjE)+)
chunhan
parents: 42
diff changeset
   209
apply (erule co2sobj_some_caseD)
chunhan
parents: 42
diff changeset
   210
apply (rule DiffI)
chunhan
parents: 42
diff changeset
   211
apply (case_tac "O_proc pa \<in> Tainted s")
chunhan
parents: 42
diff changeset
   212
apply (rule UnI1, simp, rule_tac x = "O_proc pa" in exI)
chunhan
parents: 42
diff changeset
   213
apply (clarsimp simp:Tainted_ptrace' cp2sproc_other tainted_eq_Tainted split:option.splits)
chunhan
parents: 42
diff changeset
   214
apply (case_tac "info_flow_shm s p pa")
chunhan
parents: 42
diff changeset
   215
apply (rule UnI2, rule CollectI, simp only:co2sobj.simps split:option.splits)
chunhan
parents: 42
diff changeset
   216
apply (drule current_proc_has_sp', simp, simp)
chunhan
parents: 42
diff changeset
   217
apply (rule_tac x = a in exI, rule_tac x = pa in exI)
chunhan
parents: 42
diff changeset
   218
apply (clarsimp simp:Tainted_ptrace' cp2sproc_other tainted_eq_Tainted split:option.splits)
chunhan
parents: 42
diff changeset
   219
apply (rule UnI1, simp)
chunhan
parents: 42
diff changeset
   220
apply (rule_tac x = "O_proc pa" in exI)
chunhan
parents: 42
diff changeset
   221
apply (clarsimp simp:Tainted_ptrace' cp2sproc_other tainted_eq_Tainted split:option.splits)
chunhan
parents: 42
diff changeset
   222
apply (rule notI, clarsimp simp:cp2sproc_other tainted_eq_Tainted split:option.splits)
chunhan
parents: 42
diff changeset
   223
apply (erule_tac x = pa in allE, simp)
chunhan
parents: 42
diff changeset
   224
chunhan
parents: 42
diff changeset
   225
apply (rule DiffI, rule UnI1, rule CollectI, rule_tac x = obj in exI,
chunhan
parents: 42
diff changeset
   226
       auto split:option.splits simp:co2sobj_ptrace alive_simps simp del:co2sobj.simps)[1]
chunhan
parents: 42
diff changeset
   227
apply (simp)
chunhan
parents: 42
diff changeset
   228
apply (rule DiffI, rule UnI1, rule CollectI, rule_tac x = obj in exI,
chunhan
parents: 42
diff changeset
   229
       auto split:option.splits simp:co2sobj_ptrace alive_simps simp del:co2sobj.simps)[1]
chunhan
parents: 42
diff changeset
   230
apply (simp split:option.splits)
chunhan
parents: 42
diff changeset
   231
apply (rule DiffI, rule UnI1, rule CollectI, rule_tac x = obj in exI,
chunhan
parents: 42
diff changeset
   232
       auto split:option.splits simp:co2sobj_ptrace alive_simps simp del:co2sobj.simps)[1]
chunhan
parents: 42
diff changeset
   233
apply (simp split:option.splits)
chunhan
parents: 42
diff changeset
   234
apply (rule DiffI, rule UnI1, rule CollectI, rule_tac x = obj in exI,
chunhan
parents: 42
diff changeset
   235
       auto split:option.splits simp:co2sobj_ptrace alive_simps simp del:co2sobj.simps)[1]
chunhan
parents: 42
diff changeset
   236
apply (simp split:option.splits)
chunhan
parents: 42
diff changeset
   237
chunhan
parents: 42
diff changeset
   238
apply (erule DiffE, drule s2ss_ptrace1_aux, erule UnE)
chunhan
parents: 42
diff changeset
   239
apply (erule CollectE, (erule exE|erule conjE)+, rule CollectI)
chunhan
parents: 42
diff changeset
   240
apply (erule co2sobj_some_caseD)
chunhan
parents: 42
diff changeset
   241
apply (case_tac "O_proc pa \<in> Tainted s")
chunhan
parents: 42
diff changeset
   242
apply (rule_tac x = "O_proc pa" in exI)
chunhan
parents: 42
diff changeset
   243
apply (clarsimp simp add:tainted_eq_Tainted cp2sproc_other split:option.splits)
chunhan
parents: 42
diff changeset
   244
apply (case_tac "info_flow_shm s p pa", simp only:co2sobj.simps split:option.splits)
chunhan
parents: 42
diff changeset
   245
apply (drule current_proc_has_sp', simp, simp)
chunhan
parents: 42
diff changeset
   246
apply (drule Meson.not_exD, erule_tac x = a in allE, drule Meson.not_exD, erule_tac x = pa in allE)
chunhan
parents: 42
diff changeset
   247
apply (simp add:tainted_eq_Tainted, (erule exE|erule conjE)+)
chunhan
parents: 42
diff changeset
   248
apply (rule_tac x = "O_proc p'a" in exI)
chunhan
parents: 42
diff changeset
   249
apply (clarsimp simp:Tainted_ptrace' cp2sproc_other tainted_eq_Tainted split:option.splits)
chunhan
parents: 42
diff changeset
   250
apply (rule_tac x = "O_proc pa" in exI)
chunhan
parents: 42
diff changeset
   251
apply (clarsimp simp:Tainted_ptrace' cp2sproc_other tainted_eq_Tainted split:option.splits)
chunhan
parents: 42
diff changeset
   252
chunhan
parents: 42
diff changeset
   253
apply (rule_tac x = obj in exI,
chunhan
parents: 42
diff changeset
   254
       auto split:option.splits simp:co2sobj_ptrace alive_simps simp del:co2sobj.simps)[1]
chunhan
parents: 42
diff changeset
   255
apply (rule_tac x = obj in exI,
chunhan
parents: 42
diff changeset
   256
       auto split:option.splits simp:co2sobj_ptrace alive_simps simp del:co2sobj.simps)[1]
chunhan
parents: 42
diff changeset
   257
apply (rule_tac x = obj in exI,
chunhan
parents: 42
diff changeset
   258
       auto split:option.splits simp:co2sobj_ptrace alive_simps simp del:co2sobj.simps)[1]
chunhan
parents: 42
diff changeset
   259
apply (rule_tac x = obj in exI,
chunhan
parents: 42
diff changeset
   260
       auto split:option.splits simp:co2sobj_ptrace alive_simps simp del:co2sobj.simps)[1]
chunhan
parents: 42
diff changeset
   261
chunhan
parents: 42
diff changeset
   262
apply (erule CollectE, (erule exE|erule conjE)+, rule CollectI)
chunhan
parents: 42
diff changeset
   263
apply (rule_tac x = "O_proc pa" in exI)
chunhan
parents: 42
diff changeset
   264
apply (clarsimp simp:Tainted_ptrace' cp2sproc_other tainted_eq_Tainted info_shm_flow_in_procs)
chunhan
parents: 42
diff changeset
   265
done
chunhan
parents: 42
diff changeset
   266
chunhan
parents: 42
diff changeset
   267
lemma s2ss_ptrace3:
chunhan
parents: 42
diff changeset
   268
  "\<lbrakk>valid (Ptrace p p' # s); (O_proc p' \<in> Tainted s) = (O_proc p \<in> Tainted s)\<rbrakk>
chunhan
parents: 42
diff changeset
   269
   \<Longrightarrow> s2ss (Ptrace p p' # s) = s2ss s"
chunhan
parents: 42
diff changeset
   270
unfolding s2ss_def
chunhan
parents: 42
diff changeset
   271
apply (frule vd_cons, rule set_eqI, rule iffI)
chunhan
parents: 42
diff changeset
   272
apply (erule CollectE, (erule exE|erule conjE)+, rule CollectI)
chunhan
parents: 42
diff changeset
   273
apply (rule_tac x = obj in exI)
chunhan
parents: 42
diff changeset
   274
apply (frule alive_other, simp+)
chunhan
parents: 42
diff changeset
   275
apply (frule_tac obj = obj in co2sobj_ptrace, simp)
chunhan
parents: 42
diff changeset
   276
apply (auto simp add:tainted_eq_Tainted split:t_object.splits option.splits if_splits
chunhan
parents: 42
diff changeset
   277
  intro:info_flow_shm_Tainted)[1]
chunhan
parents: 42
diff changeset
   278
chunhan
parents: 42
diff changeset
   279
apply (erule CollectE, (erule exE|erule conjE)+, rule CollectI)
chunhan
parents: 42
diff changeset
   280
apply (rule_tac x = obj in exI)
chunhan
parents: 42
diff changeset
   281
apply (frule alive_other, simp+)
chunhan
parents: 42
diff changeset
   282
apply (frule_tac obj = obj in co2sobj_ptrace, simp)
chunhan
parents: 42
diff changeset
   283
apply (auto simp add:tainted_eq_Tainted split:t_object.splits option.splits if_splits 
chunhan
parents: 42
diff changeset
   284
  intro:info_flow_shm_Tainted)
chunhan
parents: 42
diff changeset
   285
done
chunhan
parents: 42
diff changeset
   286
chunhan
parents: 42
diff changeset
   287
lemma s2ss_ptrace:
chunhan
parents: 42
diff changeset
   288
  "valid (Ptrace p p' # s) \<Longrightarrow> s2ss (Ptrace p p' # s) = (
chunhan
parents: 42
diff changeset
   289
     if (O_proc p \<in> Tainted s \<and> O_proc p' \<notin> Tainted s) 
chunhan
parents: 42
diff changeset
   290
     then update_s2ss_shm s p'
chunhan
parents: 42
diff changeset
   291
     else if (O_proc p' \<in> Tainted s \<and> O_proc p \<notin> Tainted s)
chunhan
parents: 42
diff changeset
   292
          then update_s2ss_shm s p
chunhan
parents: 42
diff changeset
   293
          else s2ss s                                   )"
chunhan
parents: 42
diff changeset
   294
apply (frule vt_grant_os, frule vd_cons)
chunhan
parents: 42
diff changeset
   295
apply (simp add:s2ss_ptrace2 s2ss_ptrace1 split:if_splits)
chunhan
parents: 42
diff changeset
   296
by (auto dest:s2ss_ptrace3)
41
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
   297
43
chunhan
parents: 42
diff changeset
   298
lemma s2ss_kill:
chunhan
parents: 42
diff changeset
   299
  "valid (Kill p p' # s) \<Longrightarrow> s2ss (Kill p p' # s) = (
chunhan
parents: 42
diff changeset
   300
     if (\<exists> p''. p'' \<in> current_procs s \<and> p'' \<noteq> p' \<and> co2sobj s (O_proc p'') = co2sobj s (O_proc p'))
chunhan
parents: 42
diff changeset
   301
     then s2ss s 
chunhan
parents: 42
diff changeset
   302
     else (case (co2sobj s (O_proc p')) of
chunhan
parents: 42
diff changeset
   303
             Some sp \<Rightarrow> s2ss s - {sp}
chunhan
parents: 42
diff changeset
   304
           | _       \<Rightarrow> {}))"
chunhan
parents: 42
diff changeset
   305
apply (frule vt_grant_os, frule vd_cons)
chunhan
parents: 42
diff changeset
   306
unfolding s2ss_def
chunhan
parents: 42
diff changeset
   307
apply (simp split:if_splits, rule conjI)
chunhan
parents: 42
diff changeset
   308
apply (rule impI, (erule exE|erule conjE)+)
chunhan
parents: 42
diff changeset
   309
apply (split option.splits)
chunhan
parents: 42
diff changeset
   310
apply (drule current_proc_has_sp', simp, simp)
chunhan
parents: 42
diff changeset
   311
apply (simp split: option.splits, (erule conjE)+)
chunhan
parents: 42
diff changeset
   312
apply (rule set_eqI, rule iffI, erule CollectE, (erule exE|erule conjE)+, rule CollectI)
chunhan
parents: 42
diff changeset
   313
apply (rule_tac x = obj in exI)
chunhan
parents: 42
diff changeset
   314
apply (simp add:co2sobj_kill tainted_eq_Tainted alive_kill split:t_object.splits if_splits)
chunhan
parents: 42
diff changeset
   315
apply (erule CollectE, erule exE, erule conjE, rule CollectI)
chunhan
parents: 42
diff changeset
   316
apply (erule co2sobj_some_caseD)
chunhan
parents: 42
diff changeset
   317
apply (case_tac "pa = p'")
chunhan
parents: 42
diff changeset
   318
apply (rule_tac x = "O_proc p''" in exI)
chunhan
parents: 42
diff changeset
   319
apply (simp add:cp2sproc_kill tainted_eq_Tainted alive_kill
chunhan
parents: 42
diff changeset
   320
  split:t_object.splits if_splits option.splits)
chunhan
parents: 42
diff changeset
   321
apply (rule_tac x = "O_proc pa" in exI)
chunhan
parents: 42
diff changeset
   322
apply (clarsimp simp add:cp2sproc_kill tainted_eq_Tainted alive_kill
chunhan
parents: 42
diff changeset
   323
  split:t_object.splits if_splits option.splits)
chunhan
parents: 42
diff changeset
   324
apply (rule_tac x = obj in exI, frule alive_kill, simp add:co2sobj_kill del:co2sobj.simps)+
chunhan
parents: 42
diff changeset
   325
chunhan
parents: 42
diff changeset
   326
apply (rule impI, erule conjE, frule current_proc_has_sp, simp, erule exE, simp)
chunhan
parents: 42
diff changeset
   327
apply (rule set_eqI, rule iffI)
chunhan
parents: 42
diff changeset
   328
apply (erule CollectE, erule exE, erule conjE, rule DiffI)
chunhan
parents: 42
diff changeset
   329
apply (rule CollectI, rule_tac x = obj in exI)
chunhan
parents: 42
diff changeset
   330
apply (simp add:co2sobj_kill tainted_eq_Tainted alive_kill split:t_object.splits if_splits)
chunhan
parents: 42
diff changeset
   331
apply (rule notI, simp, case_tac obj)
chunhan
parents: 42
diff changeset
   332
apply (erule_tac x = nat in allE)
chunhan
parents: 42
diff changeset
   333
apply (simp add:co2sobj_kill cp2sproc_kill tainted_eq_Tainted split:option.splits)
chunhan
parents: 42
diff changeset
   334
apply (simp split:option.splits)+
chunhan
parents: 42
diff changeset
   335
apply (erule co2sobj_some_caseD)
chunhan
parents: 42
diff changeset
   336
apply (case_tac "pa = p'")
chunhan
parents: 42
diff changeset
   337
apply (rule_tac x = "O_proc p''" in exI)
chunhan
parents: 42
diff changeset
   338
apply (simp add:cp2sproc_kill tainted_eq_Tainted alive_kill
chunhan
parents: 42
diff changeset
   339
  split:t_object.splits if_splits option.splits)
chunhan
parents: 42
diff changeset
   340
apply (rule_tac x = "O_proc pa" in exI)
chunhan
parents: 42
diff changeset
   341
apply (clarsimp simp add:cp2sproc_kill tainted_eq_Tainted alive_kill
chunhan
parents: 42
diff changeset
   342
  split:t_object.splits if_splits option.splits)
chunhan
parents: 42
diff changeset
   343
apply (rule_tac x = obj in exI, frule alive_kill, simp add:co2sobj_kill del:co2sobj.simps)+
chunhan
parents: 42
diff changeset
   344
done
chunhan
parents: 42
diff changeset
   345
chunhan
parents: 42
diff changeset
   346
lemma s2ss_exit:
chunhan
parents: 42
diff changeset
   347
  "valid (Exit p # s) \<Longrightarrow> s2ss (Exit p # s) = (
chunhan
parents: 42
diff changeset
   348
     if (\<exists> p'. p' \<in> current_procs s \<and> p' \<noteq> p \<and> co2sobj s (O_proc p') = co2sobj s (O_proc p))
chunhan
parents: 42
diff changeset
   349
     then s2ss s 
chunhan
parents: 42
diff changeset
   350
     else (case (co2sobj s (O_proc p)) of
chunhan
parents: 42
diff changeset
   351
             Some sp \<Rightarrow> s2ss s - {sp}
chunhan
parents: 42
diff changeset
   352
           | _       \<Rightarrow> {}))"
chunhan
parents: 42
diff changeset
   353
apply (frule vt_grant_os, frule vd_cons)
chunhan
parents: 42
diff changeset
   354
unfolding s2ss_def
chunhan
parents: 42
diff changeset
   355
apply (simp split:if_splits, rule conjI)
chunhan
parents: 42
diff changeset
   356
apply (rule impI, (erule exE|erule conjE)+)
chunhan
parents: 42
diff changeset
   357
apply (split option.splits)
chunhan
parents: 42
diff changeset
   358
apply (drule current_proc_has_sp', simp, simp)
chunhan
parents: 42
diff changeset
   359
apply (simp split: option.splits, (erule conjE)+)
chunhan
parents: 42
diff changeset
   360
apply (rule set_eqI, rule iffI, erule CollectE, (erule exE|erule conjE)+, rule CollectI)
chunhan
parents: 42
diff changeset
   361
apply (rule_tac x = obj in exI)
chunhan
parents: 42
diff changeset
   362
apply (simp add:co2sobj_exit tainted_eq_Tainted alive_exit split:t_object.splits if_splits)
chunhan
parents: 42
diff changeset
   363
apply (erule CollectE, erule exE, erule conjE, rule CollectI)
chunhan
parents: 42
diff changeset
   364
apply (erule co2sobj_some_caseD)
chunhan
parents: 42
diff changeset
   365
apply (case_tac "pa = p")
chunhan
parents: 42
diff changeset
   366
apply (rule_tac x = "O_proc p'" in exI)
chunhan
parents: 42
diff changeset
   367
apply (simp add:cp2sproc_exit tainted_eq_Tainted alive_exit
chunhan
parents: 42
diff changeset
   368
  split:t_object.splits if_splits option.splits)
chunhan
parents: 42
diff changeset
   369
apply (rule_tac x = "O_proc pa" in exI)
chunhan
parents: 42
diff changeset
   370
apply (clarsimp simp add:cp2sproc_exit tainted_eq_Tainted alive_exit
chunhan
parents: 42
diff changeset
   371
  split:t_object.splits if_splits option.splits)
chunhan
parents: 42
diff changeset
   372
apply (rule_tac x = obj in exI, frule alive_exit, simp add:co2sobj_exit del:co2sobj.simps)+
chunhan
parents: 42
diff changeset
   373
chunhan
parents: 42
diff changeset
   374
apply (rule impI, frule current_proc_has_sp, simp, erule exE, simp)
chunhan
parents: 42
diff changeset
   375
apply (rule set_eqI, rule iffI)
chunhan
parents: 42
diff changeset
   376
apply (erule CollectE, erule exE, erule conjE, rule DiffI)
chunhan
parents: 42
diff changeset
   377
apply (rule CollectI, rule_tac x = obj in exI)
chunhan
parents: 42
diff changeset
   378
apply (simp add:co2sobj_exit tainted_eq_Tainted alive_exit split:t_object.splits if_splits)
chunhan
parents: 42
diff changeset
   379
apply (rule notI, simp, case_tac obj)
chunhan
parents: 42
diff changeset
   380
apply (erule_tac x = nat in allE)
chunhan
parents: 42
diff changeset
   381
apply (simp add:co2sobj_exit cp2sproc_exit tainted_eq_Tainted split:option.splits)
chunhan
parents: 42
diff changeset
   382
apply (simp split:option.splits)+
chunhan
parents: 42
diff changeset
   383
apply (erule co2sobj_some_caseD)
chunhan
parents: 42
diff changeset
   384
apply (case_tac "pa = p")
chunhan
parents: 42
diff changeset
   385
apply (rule_tac x = "O_proc p'" in exI)
chunhan
parents: 42
diff changeset
   386
apply (simp add:cp2sproc_exit tainted_eq_Tainted alive_exit
chunhan
parents: 42
diff changeset
   387
  split:t_object.splits if_splits option.splits)
chunhan
parents: 42
diff changeset
   388
apply (rule_tac x = "O_proc pa" in exI)
chunhan
parents: 42
diff changeset
   389
apply (clarsimp simp add:cp2sproc_exit tainted_eq_Tainted alive_exit
chunhan
parents: 42
diff changeset
   390
  split:t_object.splits if_splits option.splits)
chunhan
parents: 42
diff changeset
   391
apply (rule_tac x = obj in exI, frule alive_exit, simp add:co2sobj_exit del:co2sobj.simps)+
chunhan
parents: 42
diff changeset
   392
done
chunhan
parents: 42
diff changeset
   393
chunhan
parents: 42
diff changeset
   394
lemma alive_has_sobj':
chunhan
parents: 42
diff changeset
   395
  "\<lbrakk>co2sobj s obj = None; valid s\<rbrakk> \<Longrightarrow> \<not> alive s obj"
chunhan
parents: 42
diff changeset
   396
apply (case_tac obj)
chunhan
parents: 42
diff changeset
   397
apply (auto split:option.splits)
chunhan
parents: 42
diff changeset
   398
oops
chunhan
parents: 42
diff changeset
   399
chunhan
parents: 42
diff changeset
   400
declare co2sobj.simps [simp del]
chunhan
parents: 42
diff changeset
   401
chunhan
parents: 42
diff changeset
   402
lemma co2sobj_open_none:
chunhan
parents: 42
diff changeset
   403
  "\<lbrakk>valid (Open p f flag fd None # s); alive s obj\<rbrakk> \<Longrightarrow> co2sobj (Open p f flag fd None # s) obj = (
chunhan
parents: 42
diff changeset
   404
      if (obj = O_proc p) 
chunhan
parents: 42
diff changeset
   405
      then (case (cp2sproc (Open p f flag fd None # s) p) of
chunhan
parents: 42
diff changeset
   406
              Some sp \<Rightarrow> Some (S_proc sp (O_proc p \<in> Tainted s))
chunhan
parents: 42
diff changeset
   407
           | _       \<Rightarrow> None)
chunhan
parents: 42
diff changeset
   408
      else co2sobj s obj)"
chunhan
parents: 42
diff changeset
   409
apply (frule vt_grant_os, frule vd_cons)
chunhan
parents: 42
diff changeset
   410
apply (frule_tac obj = obj in co2sobj_open, simp add:alive_open)
chunhan
parents: 42
diff changeset
   411
apply (auto split:t_object.splits option.splits dest!:current_proc_has_sp')
chunhan
parents: 42
diff changeset
   412
done
chunhan
parents: 42
diff changeset
   413
chunhan
parents: 42
diff changeset
   414
lemma co2sobj_open_some:
chunhan
parents: 42
diff changeset
   415
  "\<lbrakk>valid (Open p f flag fd (Some i) # s); alive s obj\<rbrakk> \<Longrightarrow> co2sobj (Open p f flag fd (Some i) # s) obj = (
chunhan
parents: 42
diff changeset
   416
      if (obj = O_proc p) 
chunhan
parents: 42
diff changeset
   417
      then (case (cp2sproc (Open p f flag fd (Some i) # s) p) of
chunhan
parents: 42
diff changeset
   418
              Some sp \<Rightarrow> Some (S_proc sp (O_proc p \<in> Tainted s))
chunhan
parents: 42
diff changeset
   419
           | _       \<Rightarrow> None)
chunhan
parents: 42
diff changeset
   420
      else if (obj = O_file f) 
chunhan
parents: 42
diff changeset
   421
           then (case (cf2sfile (Open p f flag fd (Some i) # s) f) of
chunhan
parents: 42
diff changeset
   422
                   Some sf \<Rightarrow> Some (S_file {sf} (O_proc p \<in> Tainted s))
chunhan
parents: 42
diff changeset
   423
                 | _       \<Rightarrow> None)
chunhan
parents: 42
diff changeset
   424
           else co2sobj s obj)"
chunhan
parents: 42
diff changeset
   425
apply (frule vt_grant_os, frule vd_cons)
chunhan
parents: 42
diff changeset
   426
apply (frule_tac obj = obj in co2sobj_open, simp add:alive_open)
chunhan
parents: 42
diff changeset
   427
apply (auto split:t_object.splits option.splits dest!:current_proc_has_sp')
chunhan
parents: 42
diff changeset
   428
done
41
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
   429
43
chunhan
parents: 42
diff changeset
   430
lemma alive_co2sobj_some_open_none:
chunhan
parents: 42
diff changeset
   431
  "\<lbrakk>co2sobj s obj = Some sobj; alive s obj; valid (Open p f flag fd None # s)\<rbrakk>
chunhan
parents: 42
diff changeset
   432
   \<Longrightarrow> alive (Open p f flag fd None # s) obj"
chunhan
parents: 42
diff changeset
   433
by (erule co2sobj_some_caseD, auto simp:alive_simps is_file_simps is_dir_simps)
chunhan
parents: 42
diff changeset
   434
chunhan
parents: 42
diff changeset
   435
lemma alive_co2sobj_some_open_none':
chunhan
parents: 42
diff changeset
   436
  "\<lbrakk>co2sobj (Open p f flag fd None # s) obj = Some sobj; alive (Open p f flag fd None # s) obj; 
chunhan
parents: 42
diff changeset
   437
    valid (Open p f flag fd None # s)\<rbrakk> \<Longrightarrow> alive s obj"
chunhan
parents: 42
diff changeset
   438
by (erule co2sobj_some_caseD, auto simp:alive_simps is_file_simps is_dir_simps)
chunhan
parents: 42
diff changeset
   439
chunhan
parents: 42
diff changeset
   440
lemma co2sobj_proc_obj:
chunhan
parents: 42
diff changeset
   441
  "\<lbrakk>co2sobj s obj = Some x; co2sobj s (O_proc p) = Some x\<rbrakk>
chunhan
parents: 42
diff changeset
   442
   \<Longrightarrow> \<exists> p'. obj = O_proc p'"
chunhan
parents: 42
diff changeset
   443
by (case_tac obj, auto simp:co2sobj.simps split:option.splits)
chunhan
parents: 42
diff changeset
   444
chunhan
parents: 42
diff changeset
   445
lemma s2ss_open_none:
chunhan
parents: 42
diff changeset
   446
  "valid (Open p f flag fd None # s) \<Longrightarrow> s2ss (Open p f flag fd None # s) = (
chunhan
parents: 42
diff changeset
   447
      case (co2sobj s (O_proc p), co2sobj (Open p f flag fd None # s) (O_proc p)) of
chunhan
parents: 42
diff changeset
   448
        (Some sp, Some sp') \<Rightarrow> 
chunhan
parents: 42
diff changeset
   449
           if (\<exists> p'. p' \<in> current_procs s \<and> p' \<noteq> p \<and> co2sobj s (O_proc p') = Some sp)
chunhan
parents: 42
diff changeset
   450
           then s2ss s \<union> {sp'}
chunhan
parents: 42
diff changeset
   451
           else s2ss s - {sp} \<union> {sp'} 
chunhan
parents: 42
diff changeset
   452
      | _                   \<Rightarrow> {} )"
chunhan
parents: 42
diff changeset
   453
unfolding s2ss_def
chunhan
parents: 42
diff changeset
   454
apply (frule vt_grant_os, frule vd_cons)
chunhan
parents: 42
diff changeset
   455
apply (case_tac "co2sobj s (O_proc p)", simp add:co2sobj.simps split:option.splits)
chunhan
parents: 42
diff changeset
   456
apply (drule current_proc_has_sp', simp, simp)
chunhan
parents: 42
diff changeset
   457
apply (case_tac "co2sobj (Open p f flag fd None # s) (O_proc p)")
chunhan
parents: 42
diff changeset
   458
apply (simp add:co2sobj.simps split:option.splits)
chunhan
parents: 42
diff changeset
   459
apply (drule current_proc_has_sp', simp, simp)
chunhan
parents: 42
diff changeset
   460
apply (rule set_eqI, rule iffI, erule CollectE, erule exE, erule conjE, simp)
chunhan
parents: 42
diff changeset
   461
apply (frule_tac obj = obj in alive_co2sobj_some_open_none', simp, simp)
chunhan
parents: 42
diff changeset
   462
apply (rule conjI, rule impI, erule exE, (erule conjE)+)
chunhan
parents: 42
diff changeset
   463
apply (rule Meson.disj_comm, rule disjCI, case_tac "obj = O_proc p", simp)
chunhan
parents: 42
diff changeset
   464
apply (rule_tac x = obj in exI, simp add:co2sobj_open_none)
chunhan
parents: 42
diff changeset
   465
apply (rule impI)
chunhan
parents: 42
diff changeset
   466
apply (case_tac "obj = O_proc p", simp)
chunhan
parents: 42
diff changeset
   467
apply (rule Meson.disj_comm, rule disjCI, rule conjI)
chunhan
parents: 42
diff changeset
   468
apply (rule_tac x = obj in exI, simp add:co2sobj_open_none)
chunhan
parents: 42
diff changeset
   469
apply (simp add:co2sobj_open_none split:option.splits)
chunhan
parents: 42
diff changeset
   470
apply (rule notI)
chunhan
parents: 42
diff changeset
   471
apply (frule co2sobj_proc_obj, simp, erule exE)
chunhan
parents: 42
diff changeset
   472
apply (erule_tac x = p' in allE, simp)
chunhan
parents: 42
diff changeset
   473
chunhan
parents: 42
diff changeset
   474
apply (simp split:if_splits)
chunhan
parents: 42
diff changeset
   475
apply (erule disjE, rule_tac x = "O_proc p" in exI, simp)
chunhan
parents: 42
diff changeset
   476
apply (erule exE, erule conjE, case_tac "obj = O_proc p")
chunhan
parents: 42
diff changeset
   477
apply (rule_tac x = "O_proc p'" in exI, simp add:co2sobj_open_none)
chunhan
parents: 42
diff changeset
   478
apply (rule_tac x = obj in exI, simp add:co2sobj_open_none alive_co2sobj_some_open_none)
chunhan
parents: 42
diff changeset
   479
apply (erule disjE, rule_tac x = "O_proc p" in exI, simp)
chunhan
parents: 42
diff changeset
   480
apply (erule conjE, erule exE, erule conjE, case_tac "obj = O_proc p")
chunhan
parents: 42
diff changeset
   481
apply (rule_tac x = "O_proc p'" in exI, simp add:co2sobj_open_none)
chunhan
parents: 42
diff changeset
   482
apply (rule_tac x = obj in exI, simp add:co2sobj_open_none alive_co2sobj_some_open_none)
chunhan
parents: 42
diff changeset
   483
done
chunhan
parents: 42
diff changeset
   484
chunhan
parents: 42
diff changeset
   485
lemma alive_co2sobj_some_open_some:
chunhan
parents: 42
diff changeset
   486
  "\<lbrakk>alive s obj; valid (Open p f flag fd (Some i) # s)\<rbrakk>
chunhan
parents: 42
diff changeset
   487
   \<Longrightarrow> alive (Open p f flag fd (Some i) # s) obj"
chunhan
parents: 42
diff changeset
   488
by (case_tac obj, auto simp:alive_simps is_file_simps is_dir_simps)
chunhan
parents: 42
diff changeset
   489
chunhan
parents: 42
diff changeset
   490
lemma alive_co2sobj_some_open_some':
chunhan
parents: 42
diff changeset
   491
  "\<lbrakk>co2sobj (Open p f flag fd (Some i) # s) obj = Some sobj; alive (Open p f flag fd (Some i) # s) obj; 
chunhan
parents: 42
diff changeset
   492
    valid (Open p f flag fd (Some i) # s); obj \<noteq> O_file f\<rbrakk> \<Longrightarrow> alive s obj"
chunhan
parents: 42
diff changeset
   493
by (erule co2sobj_some_caseD, auto simp:alive_simps is_file_simps is_dir_simps)
chunhan
parents: 42
diff changeset
   494
chunhan
parents: 42
diff changeset
   495
lemma s2ss_open_some:
chunhan
parents: 42
diff changeset
   496
  "valid (Open p f flag fd (Some i) # s) \<Longrightarrow> s2ss (Open p f flag fd (Some i) # s) = (
chunhan
parents: 42
diff changeset
   497
      case (co2sobj s (O_proc p), co2sobj (Open p f flag fd (Some i) # s) (O_proc p),
chunhan
parents: 42
diff changeset
   498
            co2sobj (Open p f flag fd (Some i) # s) (O_file f)) of
chunhan
parents: 42
diff changeset
   499
        (Some sp, Some sp', Some sf) \<Rightarrow> 
chunhan
parents: 42
diff changeset
   500
           if (\<exists> p'. p' \<in> current_procs s \<and> p' \<noteq> p \<and> co2sobj s (O_proc p') = Some sp)
chunhan
parents: 42
diff changeset
   501
           then s2ss s \<union> {sp', sf} 
chunhan
parents: 42
diff changeset
   502
           else s2ss s - {sp} \<union> {sp', sf} 
chunhan
parents: 42
diff changeset
   503
      | _                   \<Rightarrow> {} )"
chunhan
parents: 42
diff changeset
   504
unfolding s2ss_def
chunhan
parents: 42
diff changeset
   505
apply (frule vt_grant_os, frule vd_cons)
chunhan
parents: 42
diff changeset
   506
apply (case_tac "co2sobj s (O_proc p)", simp add:co2sobj.simps split:option.splits)
chunhan
parents: 42
diff changeset
   507
apply (drule current_proc_has_sp', simp, simp)
chunhan
parents: 42
diff changeset
   508
apply (case_tac "co2sobj (Open p f flag fd (Some i) # s) (O_proc p)")
chunhan
parents: 42
diff changeset
   509
apply (simp add:co2sobj.simps split:option.splits)
chunhan
parents: 42
diff changeset
   510
apply (drule current_proc_has_sp', simp, simp)
chunhan
parents: 42
diff changeset
   511
apply (case_tac "co2sobj (Open p f flag fd (Some i) # s) (O_file f)")
chunhan
parents: 42
diff changeset
   512
apply (simp add:co2sobj.simps split:option.splits)
chunhan
parents: 42
diff changeset
   513
apply (clarsimp split del:if_splits)
chunhan
parents: 42
diff changeset
   514
chunhan
parents: 42
diff changeset
   515
apply (rule set_eqI, rule iffI, erule CollectE, erule exE, erule conjE)
chunhan
parents: 42
diff changeset
   516
apply (split if_splits, rule conjI, rule impI, erule exE, erule conjE, erule conjE)
chunhan
parents: 42
diff changeset
   517
apply (case_tac "obj = O_proc p", simp, case_tac "obj = O_file f", simp)
chunhan
parents: 42
diff changeset
   518
apply (rule UnI1, rule CollectI, rule_tac x = obj in exI)
chunhan
parents: 42
diff changeset
   519
apply (frule_tac obj = obj in alive_co2sobj_some_open_some', simp+)
chunhan
parents: 42
diff changeset
   520
apply (simp add:co2sobj_open split:t_object.splits)
chunhan
parents: 42
diff changeset
   521
apply (rule impI, case_tac "obj = O_proc p", simp, case_tac "obj = O_file f", simp)
chunhan
parents: 42
diff changeset
   522
apply (rule UnI1, rule DiffI, rule CollectI, rule_tac x = obj in exI)
chunhan
parents: 42
diff changeset
   523
apply (frule_tac obj = obj in alive_co2sobj_some_open_some', simp+)
chunhan
parents: 42
diff changeset
   524
apply (simp add:co2sobj_open split:t_object.splits)
chunhan
parents: 42
diff changeset
   525
apply (frule_tac obj = obj in co2sobj_open_some, simp+)
chunhan
parents: 42
diff changeset
   526
apply (simp add:alive_co2sobj_some_open_some', simp)
chunhan
parents: 42
diff changeset
   527
apply (rule notI)
chunhan
parents: 42
diff changeset
   528
apply (frule_tac obj = obj and p = p in co2sobj_proc_obj, simp+, erule exE)
chunhan
parents: 42
diff changeset
   529
apply (erule_tac x = p' in allE, simp)
chunhan
parents: 42
diff changeset
   530
chunhan
parents: 42
diff changeset
   531
apply (simp split:if_splits, erule disjE)
chunhan
parents: 42
diff changeset
   532
apply (rule_tac x = "O_proc p" in exI, simp)
chunhan
parents: 42
diff changeset
   533
apply (erule disjE, rule_tac x = "O_file f" in exI, simp add:is_file_simps)
chunhan
parents: 42
diff changeset
   534
apply (erule exE, erule conjE)
chunhan
parents: 42
diff changeset
   535
apply (case_tac "obj = O_proc p", simp)
chunhan
parents: 42
diff changeset
   536
apply (rule_tac x = "O_proc p'" in exI, simp add:co2sobj_open_some)
chunhan
parents: 42
diff changeset
   537
apply (case_tac "obj = O_file f", simp add:is_file_in_current)
chunhan
parents: 42
diff changeset
   538
apply (rule_tac x = obj in exI, simp add:co2sobj_open_some alive_co2sobj_some_open_some)
chunhan
parents: 42
diff changeset
   539
apply (erule disjE, rule_tac x = "O_proc p" in exI, simp)
chunhan
parents: 42
diff changeset
   540
apply (erule disjE, rule_tac x = "O_file f" in exI, simp add:is_file_simps)
chunhan
parents: 42
diff changeset
   541
apply (erule conjE, erule exE, erule conjE)
chunhan
parents: 42
diff changeset
   542
apply (case_tac "obj = O_proc p", simp)
chunhan
parents: 42
diff changeset
   543
apply (case_tac "obj = O_file f", simp add:is_file_in_current)
chunhan
parents: 42
diff changeset
   544
apply (rule_tac x = obj in exI, simp add:co2sobj_open_some alive_co2sobj_some_open_some)
chunhan
parents: 42
diff changeset
   545
done
chunhan
parents: 42
diff changeset
   546
chunhan
parents: 42
diff changeset
   547
lemma s2ss_open:
chunhan
parents: 42
diff changeset
   548
  "valid (Open p f flag fd opt # s) \<Longrightarrow> s2ss (Open p f flag fd opt # s) = (
chunhan
parents: 42
diff changeset
   549
     if opt = None
chunhan
parents: 42
diff changeset
   550
     then (case (co2sobj s (O_proc p), co2sobj (Open p f flag fd opt # s) (O_proc p)) of
chunhan
parents: 42
diff changeset
   551
        (Some sp, Some sp') \<Rightarrow> 
chunhan
parents: 42
diff changeset
   552
           if (\<exists> p'. p' \<in> current_procs s \<and> p' \<noteq> p \<and> co2sobj s (O_proc p') = Some sp)
chunhan
parents: 42
diff changeset
   553
           then s2ss s \<union> {sp'}
chunhan
parents: 42
diff changeset
   554
           else s2ss s - {sp} \<union> {sp'} 
chunhan
parents: 42
diff changeset
   555
      | _                   \<Rightarrow> {} )
chunhan
parents: 42
diff changeset
   556
     else (case (co2sobj s (O_proc p), co2sobj (Open p f flag fd opt # s) (O_proc p),
chunhan
parents: 42
diff changeset
   557
            co2sobj (Open p f flag fd opt # s) (O_file f)) of
chunhan
parents: 42
diff changeset
   558
        (Some sp, Some sp', Some sf) \<Rightarrow> 
chunhan
parents: 42
diff changeset
   559
           if (\<exists> p'. p' \<in> current_procs s \<and> p' \<noteq> p \<and> co2sobj s (O_proc p') = Some sp)
chunhan
parents: 42
diff changeset
   560
           then s2ss s \<union> {sp', sf} 
chunhan
parents: 42
diff changeset
   561
           else s2ss s - {sp} \<union> {sp', sf} 
chunhan
parents: 42
diff changeset
   562
      | _                   \<Rightarrow> {} ) )"
chunhan
parents: 42
diff changeset
   563
apply (case_tac opt)
chunhan
parents: 42
diff changeset
   564
apply (simp add:s2ss_open_some s2ss_open_none)+
chunhan
parents: 42
diff changeset
   565
done
chunhan
parents: 42
diff changeset
   566
44
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   567
lemma s2ss_readfile:
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   568
  "valid (ReadFile p fd # s) \<Longrightarrow> s2ss (ReadFile p fd # s) = (
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   569
     case (file_of_proc_fd s p fd) of 
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   570
       Some f \<Rightarrow> if (O_file f \<in> Tainted s)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   571
                 then update_s2ss_shm s p
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   572
                 else s2ss s
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   573
     | _      \<Rightarrow> {})"
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   574
apply (frule vt_grant_os, frule vd_cons, clarsimp split:option.splits)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   575
apply (rule conjI, rule impI, rule impI, simp)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   576
unfolding update_s2ss_shm_def s2ss_def
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   577
apply (rule set_eqI, rule iffI)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   578
apply (drule CollectD, (erule exE|erule conjE)+)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   579
apply (erule co2sobj_some_caseD)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   580
apply (rule DiffI)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   581
apply (case_tac "O_proc pa \<in> Tainted s")
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   582
apply (rule UnI1, simp, rule_tac x = "O_proc pa" in exI)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   583
apply (clarsimp simp:cp2sproc_other tainted_eq_Tainted co2sobj.simps split:option.splits)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   584
apply (case_tac "info_flow_shm s p pa")
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   585
apply (rule UnI2, rule CollectI, simp only:co2sobj.simps split:option.splits)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   586
apply (drule current_proc_has_sp', simp, simp)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   587
apply (rule_tac x = ab in exI, rule_tac x = pa in exI)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   588
apply (clarsimp simp:cp2sproc_other tainted_eq_Tainted split:option.splits)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   589
apply (rule UnI1, simp)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   590
apply (rule_tac x = "O_proc pa" in exI)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   591
apply (clarsimp simp:cp2sproc_other tainted_eq_Tainted co2sobj.simps split:option.splits)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   592
apply (rule notI, clarsimp simp:cp2sproc_other tainted_eq_Tainted co2sobj.simps split:option.splits)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   593
apply (erule_tac x = pa in allE, simp)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   594
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   595
apply (rule DiffI, rule UnI1, rule CollectI, rule_tac x = obj in exI)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   596
apply (simp add:alive_simps co2sobj_readfile, rule notI, clarsimp simp:co2sobj.simps)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   597
apply (rule DiffI, rule UnI1, rule CollectI, rule_tac x = obj in exI)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   598
apply (simp add:alive_simps co2sobj_readfile, rule notI, clarsimp simp:co2sobj.simps split:option.splits)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   599
apply (rule DiffI, rule UnI1, rule CollectI, rule_tac x = obj in exI)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   600
apply (simp add:alive_simps co2sobj_readfile, rule notI, clarsimp simp:co2sobj.simps split:option.splits)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   601
apply (rule DiffI, rule UnI1, rule CollectI, rule_tac x = obj in exI)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   602
apply (simp add:alive_simps co2sobj_readfile, rule notI, clarsimp simp:co2sobj.simps split:option.splits)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   603
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   604
apply (erule DiffE, drule s2ss_ptrace1_aux, erule UnE)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   605
apply (erule CollectE, (erule exE|erule conjE)+, rule CollectI)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   606
apply (erule co2sobj_some_caseD)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   607
apply (case_tac "O_proc pa \<in> Tainted s")
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   608
apply (rule_tac x = "O_proc pa" in exI)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   609
apply (clarsimp simp:tainted_eq_Tainted cp2sproc_other co2sobj.simps split:option.splits)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   610
apply (case_tac "info_flow_shm s p pa", simp only:co2sobj.simps split:option.splits)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   611
apply (drule current_proc_has_sp', simp, simp)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   612
apply (drule Meson.not_exD, erule_tac x = ab in allE, drule Meson.not_exD, erule_tac x = pa in allE)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   613
apply (simp add:tainted_eq_Tainted, (erule exE|erule conjE)+)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   614
apply (rule_tac x = "O_proc p'" in exI)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   615
apply (clarsimp simp:Tainted_ptrace' cp2sproc_other tainted_eq_Tainted co2sobj.simps split:option.splits)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   616
apply (rule_tac x = "O_proc pa" in exI)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   617
apply (clarsimp simp:Tainted_ptrace' cp2sproc_other tainted_eq_Tainted co2sobj.simps split:option.splits)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   618
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   619
apply (rule_tac x = obj in exI,
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   620
       auto split:option.splits simp:co2sobj_readfile alive_simps simp del:co2sobj.simps)[1]
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   621
apply (rule_tac x = obj in exI,
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   622
       auto split:option.splits simp:co2sobj_readfile alive_simps simp del:co2sobj.simps)[1]
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   623
apply (rule_tac x = obj in exI,
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   624
       auto split:option.splits simp:co2sobj_readfile alive_simps simp del:co2sobj.simps)[1]
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   625
apply (rule_tac x = obj in exI,
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   626
       auto split:option.splits simp:co2sobj_readfile alive_simps simp del:co2sobj.simps)[1]
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   627
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   628
apply (erule CollectE, (erule exE|erule conjE)+, rule CollectI)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   629
apply (rule_tac x = "O_proc pa" in exI)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   630
apply (clarsimp simp:Tainted_ptrace' cp2sproc_other tainted_eq_Tainted info_shm_flow_in_procs co2sobj.simps)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   631
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   632
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   633
apply (rule impI, rule impI)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   634
apply (rule set_eqI, rule iffI, erule CollectE, erule exE, erule conjE, rule CollectI)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   635
apply (rule_tac x = obj in exI, simp add:alive_simps co2sobj_readfile split:t_object.splits)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   636
apply (erule CollectE, erule exE, erule conjE, rule CollectI)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   637
apply (rule_tac x = obj in exI, simp add:alive_simps)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   638
apply (drule_tac obj = obj in co2sobj_readfile, simp)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   639
apply (simp split:t_object.splits)
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   640
apply (simp add:co2sobj.simps)+
563194dcdbc6 s2ss_readfile
chunhan
parents: 43
diff changeset
   641
done
41
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
   642
45
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   643
lemma same_inode_files_prop9:
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   644
  "is_file s f \<Longrightarrow> f \<in> same_inode_files s f"
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   645
by (simp add:same_inode_files_def)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   646
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   647
lemma cf2sfiles_prop:
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   648
  "\<lbrakk>f \<in> same_inode_files s f'; valid s\<rbrakk> \<Longrightarrow> cf2sfiles s f = cf2sfiles s f'"
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   649
apply (auto simp:cf2sfiles_def)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   650
apply (rule_tac x = f'a in bexI, simp)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   651
apply (erule same_inode_files_prop4, simp)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   652
apply (rule_tac x = f'a in bexI, simp)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   653
apply (drule same_inode_files_prop5)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   654
apply (erule same_inode_files_prop4, simp)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   655
done
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   656
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   657
lemma co2sobj_writefile_unchange:
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   658
  "\<lbrakk>valid (WriteFile p fd # s); alive s obj; file_of_proc_fd s p fd = Some f;
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   659
    O_proc p \<in> Tainted s \<longrightarrow> O_file f \<in> Tainted s\<rbrakk> 
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   660
   \<Longrightarrow> co2sobj (WriteFile p fd # s) obj = co2sobj s obj"
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   661
apply (frule vd_cons, frule co2sobj_writefile, simp, simp split:t_object.splits if_splits)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   662
apply (simp add:co2sobj.simps)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   663
apply (case_tac "O_proc p \<in> Tainted s")
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   664
apply (simp add:tainted_eq_Tainted same_inodes_Tainted)+
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   665
done
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   666
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   667
lemma s2ss_writefile:
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   668
  "valid (WriteFile p fd # s) \<Longrightarrow> s2ss (WriteFile p fd # s) = (
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   669
     case (file_of_proc_fd s p fd) of
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   670
       Some f \<Rightarrow> if (O_proc p \<in> Tainted s \<and> O_file f \<notin> Tainted s)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   671
                 then (if (\<exists> f'. f' \<notin> same_inode_files s f \<and> is_file s f' \<and>
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   672
                                 co2sobj s (O_file f') = co2sobj s (O_file f))
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   673
                       then s2ss s \<union> {S_file (cf2sfiles s f) True}
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   674
                       else s2ss s - {S_file (cf2sfiles s f) False} 
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   675
                                   \<union> {S_file (cf2sfiles s f) True})
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   676
                 else s2ss s
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   677
     | _      \<Rightarrow> {})"
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   678
apply (frule vd_cons, frule vt_grant_os)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   679
apply (clarsimp split:option.splits)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   680
unfolding s2ss_def
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   681
apply (rule conjI|rule impI|erule exE|erule conjE)+
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   682
apply (rule set_eqI, rule iffI, erule CollectE, erule exE, erule conjE)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   683
apply (frule_tac obj =  obj in co2sobj_writefile, simp add:alive_other)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   684
apply (simp split:t_object.splits if_splits)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   685
apply (rule disjI2, rule_tac x= "O_proc nat" in exI, simp)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   686
apply (rule disjI1, simp add:cf2sfiles_prop)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   687
apply (rule disjI2, rule_tac x = obj in exI, simp add:is_file_simps)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   688
apply (simp add:co2sobj.simps)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   689
apply (rule disjI2, rule_tac x = obj in exI, simp add:is_dir_simps)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   690
apply (simp add:co2sobj.simps)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   691
apply (simp add:co2sobj.simps)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   692
apply (simp add:co2sobj.simps)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   693
apply (rule disjI2, rule_tac x = obj in exI, simp)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   694
apply (rule disjI2, rule_tac x = obj in exI, simp)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   695
apply (simp add:co2sobj.simps)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   696
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   697
apply (simp, erule disjE)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   698
apply (rule_tac x = "O_file aa" in exI, simp add:is_file_simps file_of_pfd_is_file)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   699
apply (frule_tac obj = "O_file aa" in co2sobj_writefile, simp add:file_of_pfd_is_file)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   700
apply (simp split:if_splits add:same_inode_files_def file_of_pfd_is_file)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   701
apply (erule exE, erule conjE)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   702
apply (erule_tac obj = obj in co2sobj_some_caseD)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   703
apply (rule_tac x = obj in exI, simp add:co2sobj_writefile)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   704
apply (case_tac "fa \<in> same_inode_files s aa")
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   705
apply (frule_tac f = fa and f' = aa in cf2sfiles_prop, simp)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   706
apply (rule_tac x = "O_file f'" in exI, simp add:co2sobj_writefile is_file_simps)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   707
apply (rule conjI, rule impI, simp add:same_inode_files_prop5)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   708
apply (rule impI, simp add:co2sobj.simps tainted_eq_Tainted same_inodes_Tainted)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   709
apply (rule_tac x = "O_file fa" in exI, simp add:co2sobj_writefile is_file_simps)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   710
apply (rule impI, simp add:same_inode_files_prop5)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   711
apply (rule_tac x = obj in exI, simp add:co2sobj_writefile)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   712
apply (rule_tac x = obj in exI, simp add:co2sobj_writefile is_dir_simps)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   713
apply (rule_tac x = obj in exI, simp add:co2sobj_writefile)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   714
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   715
apply (rule impI, rule impI, simp, rule set_eqI, rule iffI, erule CollectE, (erule conjE|erule exE)+)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   716
apply (rule CollectI, rule_tac x = obj in exI, simp add:alive_simps)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   717
apply (simp add:co2sobj_writefile split:t_object.splits if_splits)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   718
apply (simp add:co2sobj.simps tainted_eq_Tainted same_inodes_Tainted)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   719
apply (case_tac "O_proc p \<in> Tainted s", simp, simp)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   720
apply (erule CollectE, (erule conjE|erule exE)+, rule CollectI)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   721
apply (rule_tac x = obj in exI)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   722
apply (simp add:co2sobj_writefile_unchange alive_simps)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   723
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   724
apply (rule impI| rule conjI|erule conjE)+
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   725
apply (rule set_eqI, rule iffI, erule CollectE, erule exE, erule conjE)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   726
apply (simp add:alive_simps co2sobj_writefile split:t_object.splits)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   727
apply (rule disjI2, rule conjI, rule_tac x = obj in exI, simp,
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   728
  rule notI, simp add:co2sobj.simps split:option.splits)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   729
apply (simp split:if_splits)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   730
apply (rule disjI1, simp add:cf2sfiles_prop)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   731
apply (rule disjI2, rule conjI, rule_tac x = obj in exI, simp)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   732
apply (rule notI, simp add:co2sobj.simps split:option.splits)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   733
apply (erule_tac x = list in allE, simp add:tainted_eq_Tainted same_inode_files_prop5)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   734
apply (simp add:co2sobj.simps)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   735
apply (rule disjI2, rule conjI, rule_tac x = obj in exI, simp,
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   736
  rule notI, simp add:co2sobj.simps split:option.splits)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   737
apply (simp add:co2sobj.simps)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   738
apply (simp add:co2sobj.simps)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   739
apply (simp add:co2sobj.simps)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   740
apply (rule disjI2, rule conjI, rule_tac x = obj in exI, simp,
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   741
  rule notI, simp add:co2sobj.simps split:option.splits)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   742
apply (rule disjI2, rule conjI, rule_tac x = obj in exI, simp,
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   743
  rule notI, simp add:co2sobj.simps split:option.splits)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   744
apply (simp add:co2sobj.simps)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   745
apply (simp)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   746
apply (erule disjE)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   747
apply (rule_tac x= "O_file aa" in exI, simp add:co2sobj_writefile alive_simps file_of_pfd_is_file)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   748
apply (rule impI, simp add:same_inode_files_def file_of_pfd_is_file)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   749
apply (erule exE|erule conjE)+
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   750
apply (erule co2sobj_some_caseD)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   751
apply (rule_tac x = obj in exI, simp add:co2sobj_writefile)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   752
apply (case_tac "fa \<in> same_inode_files s aa")
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   753
apply (frule cf2sfiles_prop, simp, simp add:co2sobj.simps tainted_eq_Tainted same_inodes_Tainted)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   754
apply (rule_tac x = obj in exI, simp add:co2sobj_writefile is_file_simps)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   755
apply (rule impI, simp add:same_inode_files_prop5)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   756
apply (rule_tac x = obj in exI, simp add:co2sobj_writefile)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   757
apply (rule_tac x = obj in exI, simp add:co2sobj_writefile is_dir_simps)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   758
apply (rule_tac x = obj in exI, simp add:co2sobj_writefile)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   759
apply (rule impI, rule impI)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   760
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   761
apply (rule set_eqI, rule iffI, erule CollectE,erule exE,erule conjE,rule CollectI)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   762
apply (rule_tac x = obj in exI)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   763
apply (simp add:co2sobj_writefile_unchange alive_simps)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   764
apply (erule CollectE, erule exE, erule conjE)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   765
apply (rule CollectI, rule_tac x = obj in exI)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   766
apply (simp add:co2sobj_writefile_unchange alive_simps)
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   767
done
d7fab2e2a0b8 s2ss_writefile
chunhan
parents: 44
diff changeset
   768
47
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   769
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   770
definition update_s2ss_obj :: "t_state \<Rightarrow> t_static_state \<Rightarrow> t_object \<Rightarrow> t_sobject \<Rightarrow> t_sobject \<Rightarrow> t_static_state"
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   771
where
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   772
  "update_s2ss_obj s ss obj sobj sobj' = 
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   773
     (if (\<exists> obj'. alive s obj' \<and> obj' \<noteq> obj \<and> co2sobj s obj' = Some sobj)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   774
      then ss \<union> {sobj'}
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   775
      else ss - {sobj} \<union> {sobj'})"
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   776
53
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
   777
definition update_s2ss_sfile_del :: "t_state \<Rightarrow> t_static_state \<Rightarrow> t_file \<Rightarrow> t_sfile \<Rightarrow> t_static_state"
47
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   778
where 
53
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
   779
  "update_s2ss_sfile_del s ss f sf \<equiv> 
47
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   780
     if (same_inode_files s f = {f})
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   781
     then ss
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   782
     else ss \<union> {S_file (cf2sfiles s f - {sf}) (O_file f \<in> Tainted s)}"
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   783
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   784
definition del_s2ss_file:: "t_state \<Rightarrow> t_static_state \<Rightarrow> t_file \<Rightarrow> t_sfile \<Rightarrow> t_static_state"
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   785
where
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   786
  "del_s2ss_file s ss f sf = 
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   787
     (if (\<exists> f' \<in> same_inode_files s f. f' \<noteq> f \<and> cf2sfile s f' = Some sf)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   788
      then ss
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   789
      else if (\<exists> f'. is_file s f' \<and> f' \<notin> same_inode_files s f \<and> co2sobj s (O_file f') = co2sobj s (O_file f))
53
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
   790
           then update_s2ss_sfile_del s ss f sf
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
   791
           else update_s2ss_sfile_del s (ss - {S_file (cf2sfiles s f) (O_file f \<in> Tainted s)}) f sf)"
47
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   792
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   793
lemma alive_co2sobj_closefd1:
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   794
  "\<lbrakk>alive s obj; valid (CloseFd p fd # s); co2sobj s obj = Some sobj; 
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   795
    file_of_proc_fd s p fd = Some f; \<not> (f \<in> files_hung_by_del s \<and> proc_fd_of_file s f = {(p, fd)})\<rbrakk>
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   796
   \<Longrightarrow> alive (CloseFd p fd # s) obj"
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   797
apply (erule co2sobj_some_caseD)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   798
by (auto simp:alive_simps is_file_simps is_dir_simps split:option.splits)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   799
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   800
lemma alive_co2sobj_closefd3:
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   801
  "\<lbrakk>alive s obj; valid (CloseFd p fd # s); co2sobj s obj = Some sobj; obj \<noteq> O_file f;
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   802
    file_of_proc_fd s p fd = Some f; f \<in> files_hung_by_del s; proc_fd_of_file s f = {(p, fd)}\<rbrakk>
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   803
   \<Longrightarrow> alive (CloseFd p fd # s) obj"
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   804
apply (erule co2sobj_some_caseD)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   805
by (auto simp:alive_simps is_file_simps is_dir_simps split:option.splits)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   806
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   807
lemma alive_co2sobj_closefd2:
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   808
  "\<lbrakk>alive s obj; valid (CloseFd p fd # s); co2sobj s obj = Some sobj; file_of_proc_fd s p fd = None\<rbrakk>
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   809
   \<Longrightarrow> alive (CloseFd p fd # s) obj"
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   810
apply (erule co2sobj_some_caseD)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   811
by (auto simp:alive_simps is_file_simps is_dir_simps split:option.splits)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   812
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   813
lemma alive_co2sobj_closefd':
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   814
  "\<lbrakk>co2sobj (CloseFd p fd # s) obj = Some sobj; alive (CloseFd p fd # s) obj; 
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   815
    valid (CloseFd p fd # s)\<rbrakk> \<Longrightarrow> alive s obj"
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   816
apply (erule co2sobj_some_caseD)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   817
by (auto simp:alive_simps is_file_simps is_dir_simps split:option.splits if_splits)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   818
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   819
ML {*asm_full_simp_tac*}
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   820
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   821
ML {*
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   822
fun my_setiff_tac i = 
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   823
     (etac @{thm CollectE} i 
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   824
      ORELSE (     asm_full_simp_tac (HOL_ss addsimps @{thms Set.insert_iff}) i
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   825
              THEN etac @{thm disjE} i)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   826
      ORELSE (     asm_full_simp_tac (HOL_ss addsimps @{thms Set.Diff_iff}) i
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   827
              THEN etac @{thm conjE} i 
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   828
              THEN (REPEAT (etac @{thm CollectE} i))))
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   829
THEN (REPEAT ((        etac @{thm exE} 
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   830
               ORELSE' etac @{thm conjE}
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   831
               ORELSE' etac @{thm bexE}) i))
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   832
THEN (rtac @{thm CollectI} i
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   833
      ORELSE (     asm_full_simp_tac (HOL_ss addsimps @{thms Set.insert_iff}) i))
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   834
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   835
*}
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   836
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   837
ML {*
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   838
fun my_seteq_tac i = 
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   839
     (simp_tac (HOL_ss addsimps @{thms s2ss_def}) 1)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   840
THEN (rtac @{thm set_eqI} i)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   841
THEN (rtac @{thm iffI} i)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   842
THEN my_setiff_tac i
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   843
*}
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   844
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   845
lemma co2sobj_sproc_imp:
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   846
  "co2sobj s obj = Some (S_proc sp tag) \<Longrightarrow> \<exists> p. obj = O_proc p"
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   847
by (case_tac obj, auto simp:co2sobj.simps split:option.splits)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   848
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   849
lemma co2sobj_sfile_imp:
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   850
  "co2sobj s obj = Some (S_file sfs tag) \<Longrightarrow> \<exists> f. obj = O_file f"
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   851
by (case_tac obj, auto simp:co2sobj.simps split:option.splits)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   852
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   853
lemma co2sobj_sdir_imp:
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   854
  "co2sobj s obj = Some (S_dir sf) \<Longrightarrow> \<exists> f. obj = O_dir f"
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   855
by (case_tac obj, auto simp:co2sobj.simps split:option.splits)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   856
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   857
lemma co2sobj_sshm_imp:
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   858
  "co2sobj s obj = Some (S_shm sh) \<Longrightarrow> \<exists> h. obj = O_shm h"
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   859
by (case_tac obj, auto simp:co2sobj.simps split:option.splits)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   860
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   861
lemma co2sobj_smsgq_imp:
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   862
  "co2sobj s obj = Some (S_msgq sq) \<Longrightarrow> \<exists> q. obj = O_msgq q"
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   863
by (case_tac obj, auto simp:co2sobj.simps split:option.splits)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   864
48
chunhan
parents: 47
diff changeset
   865
lemma same_inode_files_prop10:
chunhan
parents: 47
diff changeset
   866
  "\<lbrakk>same_inode_files s f \<noteq> {f}; is_file s f\<rbrakk> \<Longrightarrow> \<exists> f'. f' \<in> same_inode_files s f \<and> f' \<noteq> f"
chunhan
parents: 47
diff changeset
   867
by (auto simp:same_inode_files_def split:if_splits)
chunhan
parents: 47
diff changeset
   868
chunhan
parents: 47
diff changeset
   869
lemma same_inode_files_prop11:
chunhan
parents: 47
diff changeset
   870
  "f \<in> same_inode_files s f' \<Longrightarrow> is_file s f"
chunhan
parents: 47
diff changeset
   871
by (auto simp:same_inode_files_def is_file_def split:if_splits)
chunhan
parents: 47
diff changeset
   872
chunhan
parents: 47
diff changeset
   873
lemma same_inode_files_prop11':
chunhan
parents: 47
diff changeset
   874
  "f \<in> same_inode_files s f' \<Longrightarrow> is_file s f'"
chunhan
parents: 47
diff changeset
   875
by (auto simp:same_inode_files_def is_file_def split:if_splits)
chunhan
parents: 47
diff changeset
   876
46
f66d61f5439d need a more general update_s2ss_sobj concept
chunhan
parents: 45
diff changeset
   877
lemma s2ss_closefd:
f66d61f5439d need a more general update_s2ss_sobj concept
chunhan
parents: 45
diff changeset
   878
  "valid (CloseFd p fd # s) \<Longrightarrow> s2ss (CloseFd p fd # s) = (
f66d61f5439d need a more general update_s2ss_sobj concept
chunhan
parents: 45
diff changeset
   879
     case (file_of_proc_fd s p fd) of
47
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   880
       Some f \<Rightarrow> if (f \<in> files_hung_by_del s \<and> proc_fd_of_file s f = {(p, fd)})
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   881
                 then (case (cf2sfile s f, cp2sproc s p, cp2sproc (CloseFd p fd # s) p) of
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   882
                         (Some sf, Some sp, Some sp') \<Rightarrow> 
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   883
                            (del_s2ss_file s (
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   884
                               update_s2ss_obj s (s2ss s) (O_proc p) 
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   885
                                 (S_proc sp (O_proc p \<in> Tainted s))
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   886
                                 (S_proc sp' (O_proc p \<in> Tainted s))) f sf)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   887
                      | _ \<Rightarrow> {})
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   888
                 else (case (cp2sproc s p, cp2sproc (CloseFd p fd # s) p) of 
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   889
                         (Some sp, Some sp') \<Rightarrow> 
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   890
                            (update_s2ss_obj s (s2ss s) (O_proc p)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   891
                               (S_proc sp (O_proc p \<in> Tainted s))
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   892
                               (S_proc sp' (O_proc p \<in> Tainted s)))
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   893
                      | _ \<Rightarrow> {})
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   894
      | _     \<Rightarrow> s2ss s)"
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   895
apply (frule vd_cons, frule vt_grant_os)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   896
apply (clarsimp simp only:os_grant.simps)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   897
apply (frule current_proc_has_sp, simp, erule exE)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   898
apply (case_tac "file_of_proc_fd s p fd")
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   899
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   900
apply (simp add:s2ss_def)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   901
apply (rule set_eqI, rule iffI, erule CollectE, erule exE, erule conjE, rule CollectI)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   902
apply (rule_tac x = obj in exI, simp add:alive_co2sobj_closefd')
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   903
apply (frule co2sobj_closefd, simp)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   904
apply (frule cp2sproc_closefd, simp)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   905
apply (simp add:proc_file_fds_def split:t_object.splits)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   906
apply (simp split:if_splits add:co2sobj.simps tainted_eq_Tainted)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   907
apply (erule CollectE, erule exE, erule conjE, rule CollectI)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   908
apply (rule_tac x = obj in exI, simp add:alive_co2sobj_closefd2)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   909
apply (frule_tac obj = obj in co2sobj_closefd, simp add:alive_co2sobj_closefd2)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   910
apply (frule cp2sproc_closefd, simp)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   911
apply (auto simp add:proc_file_fds_def co2sobj.simps tainted_eq_Tainted 
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   912
            split:t_object.splits option.splits if_splits)[1]
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   913
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   914
apply (case_tac "cp2sproc (CloseFd p fd # s) p")
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   915
apply (drule current_proc_has_sp', simp, simp)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   916
apply (case_tac "cf2sfile s a")
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   917
apply (drule current_file_has_sfile', simp, simp add:file_of_pfd_in_current)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   918
apply (simp)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   919
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   920
apply (rule conjI, rule impI, erule conjE)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   921
apply (simp add:del_s2ss_file_def)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   922
apply (rule conjI|rule impI|erule exE|erule conjE|erule bexE)+
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   923
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   924
apply (simp add:update_s2ss_obj_def)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   925
apply (rule conjI|rule impI|erule exE|erule conjE|erule bexE)+
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   926
apply (tactic {*my_seteq_tac 1*})
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   927
apply simp
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   928
apply (case_tac "obj = O_proc p")
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   929
apply (simp add:co2sobj.simps tainted_eq_Tainted)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   930
apply (rule disjI2, rule_tac x = obj in exI)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   931
apply (frule_tac obj = obj in co2sobj_closefd, simp add:alive_simps)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   932
apply (simp add:alive_simps co2sobj.simps tainted_eq_Tainted split:t_object.splits if_splits)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   933
apply (tactic {*my_setiff_tac 1*})
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   934
apply (rule_tac x = "O_proc p" in exI)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   935
apply (simp add:co2sobj.simps tainted_eq_Tainted)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   936
apply (tactic {*my_setiff_tac 1*})
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   937
apply (case_tac "obj = O_proc p")
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   938
apply (rule_tac x = obj' in exI)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   939
apply (frule co2sobj_sproc_imp, erule exE, simp add:co2sobj_closefd)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   940
apply (simp add:co2sobj.simps tainted_eq_Tainted)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   941
apply (case_tac "obj = O_file a")
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   942
apply (rule_tac x = "O_file f'" in exI)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   943
apply (case_tac "f' = a", simp add:same_inode_files_prop9 file_of_pfd_is_file)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   944
apply (frule_tac obj = "O_file f'" in co2sobj_closefd, simp add:alive_simps)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   945
apply (simp add:alive_simps co2sobj.simps tainted_eq_Tainted split:t_object.splits if_splits)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   946
apply (rule_tac x = obj in exI)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   947
apply (frule_tac obj = obj in alive_co2sobj_closefd3, simp+)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   948
apply (frule_tac obj = obj in co2sobj_closefd, simp)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   949
apply (auto simp add:alive_simps co2sobj.simps tainted_eq_Tainted split:t_object.splits if_splits)[1]
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   950
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   951
apply (rule impI)+
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   952
apply (tactic {*my_seteq_tac 1*})
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   953
apply (case_tac "obj = O_proc p", rule disjI1, simp add:co2sobj.simps tainted_eq_Tainted)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   954
apply (rule disjI2)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   955
apply (case_tac "obj = O_file a", simp add:alive_simps)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   956
apply (rule DiffI, simp)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   957
apply (rule_tac x = obj in exI)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   958
apply (frule_tac obj = obj in alive_co2sobj_closefd', simp+)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   959
apply (frule_tac obj = obj in co2sobj_closefd, simp)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   960
apply (simp add:alive_simps co2sobj.simps tainted_eq_Tainted split:t_object.splits if_splits)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   961
apply (simp, rule notI, simp, frule co2sobj_sproc_imp, erule exE, simp add:co2sobj_closefd)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   962
apply (erule_tac x = "O_proc pa" in allE, simp)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   963
apply (tactic {*my_setiff_tac 1*})
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   964
apply (rule_tac x = "O_proc p" in exI, simp add:co2sobj.simps tainted_eq_Tainted)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   965
apply (tactic {*my_setiff_tac 1*})
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   966
apply (case_tac "obj = O_proc p", simp add:co2sobj.simps tainted_eq_Tainted)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   967
apply (case_tac "obj = O_file a", rule_tac x = "O_file f'" in exI)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   968
apply (case_tac "f' = a", simp add:same_inode_files_prop9 file_of_pfd_is_file)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   969
apply (frule_tac obj = "O_file f'" in co2sobj_closefd, simp add:alive_simps)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   970
apply (simp add:alive_simps co2sobj.simps tainted_eq_Tainted split:t_object.splits if_splits)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   971
apply (rule_tac x = obj in exI)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   972
apply (frule_tac obj = obj in alive_co2sobj_closefd3, simp+)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   973
apply (frule_tac obj = obj in co2sobj_closefd, simp)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   974
apply (auto simp add:co2sobj.simps tainted_eq_Tainted split:t_object.splits if_splits)[1]
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   975
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   976
apply (rule impI, tactic {*my_seteq_tac 1*})
53
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
   977
apply (simp add:update_s2ss_obj_def update_s2ss_sfile_del_def)
48
chunhan
parents: 47
diff changeset
   978
apply (rule conjI| rule impI|erule exE|erule conjE)+
chunhan
parents: 47
diff changeset
   979
apply (erule_tac obj = obj in co2sobj_some_caseD)
chunhan
parents: 47
diff changeset
   980
apply (case_tac "pa = p", simp add:co2sobj.simps tainted_eq_Tainted)
chunhan
parents: 47
diff changeset
   981
apply (rule disjI2, rule_tac x = obj in exI)
chunhan
parents: 47
diff changeset
   982
apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
chunhan
parents: 47
diff changeset
   983
apply (case_tac "f = a", simp add:alive_simps)
chunhan
parents: 47
diff changeset
   984
apply (rule disjI2, rule_tac x = obj in exI)
chunhan
parents: 47
diff changeset
   985
apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
chunhan
parents: 47
diff changeset
   986
apply (rule disjI2, rule_tac x = obj in exI)
chunhan
parents: 47
diff changeset
   987
apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
chunhan
parents: 47
diff changeset
   988
apply (rule disjI2, rule_tac x = obj in exI)
chunhan
parents: 47
diff changeset
   989
apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
chunhan
parents: 47
diff changeset
   990
apply (rule disjI2, rule_tac x = obj in exI)
chunhan
parents: 47
diff changeset
   991
apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
chunhan
parents: 47
diff changeset
   992
apply (rule conjI| rule impI|erule exE|erule conjE)+
47
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   993
apply (erule_tac obj = obj in co2sobj_some_caseD)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   994
apply (case_tac "pa = p", simp add:co2sobj.simps tainted_eq_Tainted)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   995
apply (rule disjI2, rule disjI2, rule_tac x = obj in exI)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   996
apply (frule_tac obj = obj in co2sobj_closefd, simp)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   997
apply (auto simp add:co2sobj.simps tainted_eq_Tainted split:t_object.splits if_splits)[1]
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   998
apply (case_tac "f = a", simp add:alive_simps)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
   999
apply (case_tac "f \<in> same_inode_files s a", rule disjI1)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1000
apply (simp add:co2sobj_simps split:if_splits option.splits t_sobject.splits)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1001
apply (simp add:co2sobj.simps tainted_eq_Tainted same_inodes_Tainted cf2sfiles_prop)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1002
apply (erule bexE, erule conjE)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1003
apply (erule_tac x = f'' in ballE, simp, simp)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1004
apply (rule disjI2, rule disjI2, rule_tac x = obj in exI)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1005
apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1006
apply (rule disjI2, rule disjI2, rule_tac x = obj in exI)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1007
apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1008
apply (rule disjI2, rule disjI2, rule_tac x = obj in exI)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1009
apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1010
apply (rule disjI2, rule disjI2, rule_tac x = obj in exI)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1011
apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
48
chunhan
parents: 47
diff changeset
  1012
apply (rule impI, rule conjI, rule impI)
chunhan
parents: 47
diff changeset
  1013
apply (erule_tac obj = obj in co2sobj_some_caseD)
chunhan
parents: 47
diff changeset
  1014
apply (case_tac "pa = p", simp add:co2sobj.simps tainted_eq_Tainted)
chunhan
parents: 47
diff changeset
  1015
apply (rule disjI2, rule conjI, rule_tac x = obj in exI)
chunhan
parents: 47
diff changeset
  1016
apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
chunhan
parents: 47
diff changeset
  1017
apply (rule notI, simp add:co2sobj_closefd, erule_tac x = obj in allE, simp add:is_file_simps)
chunhan
parents: 47
diff changeset
  1018
apply (case_tac "f = a", simp add:alive_simps)
chunhan
parents: 47
diff changeset
  1019
apply (rule disjI2, rule conjI, rule_tac x = obj in exI)
chunhan
parents: 47
diff changeset
  1020
apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
chunhan
parents: 47
diff changeset
  1021
apply (rule notI, simp add:co2sobj_closefd, erule_tac x = obj in allE, simp add:is_file_simps)
chunhan
parents: 47
diff changeset
  1022
apply (rule disjI2, rule conjI, rule_tac x = obj in exI)
chunhan
parents: 47
diff changeset
  1023
apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
chunhan
parents: 47
diff changeset
  1024
apply (rule notI, simp add:co2sobj_closefd, erule_tac x = obj in allE, simp)
chunhan
parents: 47
diff changeset
  1025
apply (rule disjI2, rule conjI, rule_tac x = obj in exI)
chunhan
parents: 47
diff changeset
  1026
apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
chunhan
parents: 47
diff changeset
  1027
apply (rule notI, simp add:co2sobj_closefd, erule_tac x = obj in allE, simp add:is_dir_simps)
chunhan
parents: 47
diff changeset
  1028
apply (rule disjI2, rule conjI, rule_tac x = obj in exI)
chunhan
parents: 47
diff changeset
  1029
apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
chunhan
parents: 47
diff changeset
  1030
apply (rule notI, simp add:co2sobj_closefd, erule_tac x = obj in allE, simp)
47
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1031
apply (rule impI)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1032
apply (erule_tac obj = obj in co2sobj_some_caseD)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1033
apply (case_tac "pa = p", simp add:co2sobj.simps tainted_eq_Tainted)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1034
apply (rule disjI2, rule disjI2, rule conjI, rule_tac x = obj in exI)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1035
apply (frule_tac obj = obj in co2sobj_closefd, simp)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1036
apply (auto simp add:co2sobj.simps tainted_eq_Tainted split:t_object.splits if_splits)[1]
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1037
apply (rule notI, simp add:co2sobj_closefd)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1038
apply (erule_tac x = obj in allE, simp)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1039
apply (case_tac "f = a", simp add:alive_simps)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1040
apply (case_tac "f \<in> same_inode_files s a", rule disjI1)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1041
apply (simp add:co2sobj_simps split:if_splits option.splits t_sobject.splits)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1042
apply (simp add:co2sobj.simps tainted_eq_Tainted same_inodes_Tainted cf2sfiles_prop)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1043
apply (erule bexE, erule conjE)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1044
apply (erule_tac x = f'' in ballE, simp, simp)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1045
apply (rule disjI2, rule disjI2, rule conjI, rule_tac x = obj in exI)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1046
apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1047
apply (rule notI, simp add:co2sobj_closefd, erule_tac x = obj in allE, simp add:is_file_simps)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1048
apply (rule disjI2, rule disjI2, rule conjI, rule_tac x = obj in exI)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1049
apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1050
apply (rule notI, simp add:co2sobj_closefd, erule_tac x = obj in allE, simp)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1051
apply (rule disjI2, rule disjI2, rule conjI, rule_tac x = obj in exI)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1052
apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1053
apply (rule notI, simp add:co2sobj_closefd, erule_tac x = obj in allE, simp add:is_dir_simps)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1054
apply (rule disjI2, rule disjI2, rule conjI, rule_tac x = obj in exI)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1055
apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1056
apply (rule notI, simp add:co2sobj_closefd, erule_tac x = obj in allE, simp)
48
chunhan
parents: 47
diff changeset
  1057
53
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1058
apply (simp add:update_s2ss_sfile_del_def update_s2ss_obj_def split:if_splits)
48
chunhan
parents: 47
diff changeset
  1059
apply (erule disjE, rule_tac x = "O_proc p" in exI, simp add:co2sobj.simps tainted_eq_Tainted)
chunhan
parents: 47
diff changeset
  1060
apply (erule exE, erule conjE)
chunhan
parents: 47
diff changeset
  1061
apply (case_tac "obj = O_proc p")
chunhan
parents: 47
diff changeset
  1062
apply (rule_tac x = obj' in exI)
chunhan
parents: 47
diff changeset
  1063
apply (frule co2sobj_sproc_imp, erule exE, simp add:co2sobj_closefd)
chunhan
parents: 47
diff changeset
  1064
apply (simp add:co2sobj.simps tainted_eq_Tainted)
chunhan
parents: 47
diff changeset
  1065
apply (case_tac "obj = O_file a")
chunhan
parents: 47
diff changeset
  1066
apply (rule_tac x = "O_file f'" in exI)
chunhan
parents: 47
diff changeset
  1067
apply (case_tac "f' = a", simp add:same_inode_files_prop9 file_of_pfd_is_file)
chunhan
parents: 47
diff changeset
  1068
apply (frule_tac obj = "O_file f'" in co2sobj_closefd, simp add:alive_simps)
chunhan
parents: 47
diff changeset
  1069
apply (simp add:alive_simps co2sobj.simps tainted_eq_Tainted split:t_object.splits if_splits)
chunhan
parents: 47
diff changeset
  1070
apply (rule_tac x = obj in exI)
chunhan
parents: 47
diff changeset
  1071
apply (frule_tac obj = obj in alive_co2sobj_closefd3, simp+)
chunhan
parents: 47
diff changeset
  1072
apply (frule_tac obj = obj in co2sobj_closefd, simp)
chunhan
parents: 47
diff changeset
  1073
apply (auto simp add:alive_simps co2sobj.simps tainted_eq_Tainted split:t_object.splits if_splits)[1]
chunhan
parents: 47
diff changeset
  1074
apply (erule disjE, rule_tac x = "O_proc p" in exI, simp add:co2sobj.simps tainted_eq_Tainted)
chunhan
parents: 47
diff changeset
  1075
apply (erule conjE, erule exE, erule conjE)
chunhan
parents: 47
diff changeset
  1076
apply (case_tac "obj = O_proc p")
chunhan
parents: 47
diff changeset
  1077
apply (simp add:co2sobj.simps tainted_eq_Tainted)
chunhan
parents: 47
diff changeset
  1078
apply (case_tac "obj = O_file a")
chunhan
parents: 47
diff changeset
  1079
apply (rule_tac x = "O_file f'" in exI)
chunhan
parents: 47
diff changeset
  1080
apply (case_tac "f' = a", simp add:same_inode_files_prop9 file_of_pfd_is_file)
chunhan
parents: 47
diff changeset
  1081
apply (frule_tac obj = "O_file f'" in co2sobj_closefd, simp add:alive_simps)
chunhan
parents: 47
diff changeset
  1082
apply (simp add:alive_simps co2sobj.simps tainted_eq_Tainted split:t_object.splits if_splits)
chunhan
parents: 47
diff changeset
  1083
apply (rule_tac x = obj in exI)
chunhan
parents: 47
diff changeset
  1084
apply (frule_tac obj = obj in alive_co2sobj_closefd3, simp+)
chunhan
parents: 47
diff changeset
  1085
apply (frule_tac obj = obj in co2sobj_closefd, simp)
chunhan
parents: 47
diff changeset
  1086
apply (auto simp add:alive_simps co2sobj.simps tainted_eq_Tainted split:t_object.splits if_splits)[1]
chunhan
parents: 47
diff changeset
  1087
apply (erule disjE)
chunhan
parents: 47
diff changeset
  1088
apply (drule same_inode_files_prop10, simp add:file_of_pfd_is_file, erule exE, erule conjE)
chunhan
parents: 47
diff changeset
  1089
apply (rule_tac x = "O_file f'a" in exI)
chunhan
parents: 47
diff changeset
  1090
apply (frule same_inode_files_prop11)
chunhan
parents: 47
diff changeset
  1091
apply (frule_tac obj = "O_file f'a" in co2sobj_closefd)
chunhan
parents: 47
diff changeset
  1092
apply (simp add:alive_simps)+
chunhan
parents: 47
diff changeset
  1093
apply (frule_tac f = "f'a" in is_file_has_sfile', simp, erule exE)
chunhan
parents: 47
diff changeset
  1094
apply (simp add:co2sobj.simps cf2sfiles_prop tainted_eq_Tainted same_inodes_Tainted split:if_splits)
chunhan
parents: 47
diff changeset
  1095
apply (rule impI, erule bexE, erule conjE, erule_tac x = f'' in ballE, simp, simp)
chunhan
parents: 47
diff changeset
  1096
apply (erule bexE, erule conjE, erule_tac x = f'' in ballE, simp, simp)
chunhan
parents: 47
diff changeset
  1097
apply (erule disjE)
chunhan
parents: 47
diff changeset
  1098
apply (rule_tac x = "O_proc p" in exI, simp add:co2sobj.simps tainted_eq_Tainted)
chunhan
parents: 47
diff changeset
  1099
apply (erule exE, erule conjE)
chunhan
parents: 47
diff changeset
  1100
apply (case_tac "obj = O_proc p")
chunhan
parents: 47
diff changeset
  1101
apply (rule_tac x = obj' in exI)
chunhan
parents: 47
diff changeset
  1102
apply (frule co2sobj_sproc_imp, erule exE, simp add:co2sobj_closefd)
chunhan
parents: 47
diff changeset
  1103
apply (simp add:co2sobj.simps tainted_eq_Tainted)
chunhan
parents: 47
diff changeset
  1104
apply (erule_tac obj = obj in co2sobj_some_caseD)
chunhan
parents: 47
diff changeset
  1105
apply (rule_tac x = obj in exI)
chunhan
parents: 47
diff changeset
  1106
apply (simp add:co2sobj_closefd)
chunhan
parents: 47
diff changeset
  1107
apply (case_tac "f \<in> same_inode_files s a")
chunhan
parents: 47
diff changeset
  1108
apply (rule_tac x = "O_file f'" in exI)
chunhan
parents: 47
diff changeset
  1109
apply (simp add:co2sobj_simps is_file_simps split:if_splits option.splits t_sobject.splits)
chunhan
parents: 47
diff changeset
  1110
apply (rule conjI, rule notI, simp add:same_inode_files_prop9)
chunhan
parents: 47
diff changeset
  1111
apply (rule impI, simp add:co2sobj.simps cf2sfiles_prop tainted_eq_Tainted same_inodes_Tainted)
chunhan
parents: 47
diff changeset
  1112
apply (rule_tac x = obj in exI)
chunhan
parents: 47
diff changeset
  1113
apply (simp add:co2sobj_closefd is_file_simps)
chunhan
parents: 47
diff changeset
  1114
apply (rule notI, simp add:same_inode_files_prop9)
chunhan
parents: 47
diff changeset
  1115
apply (rule_tac x = obj in exI, simp add:co2sobj_closefd)
chunhan
parents: 47
diff changeset
  1116
apply (rule_tac x = obj in exI, simp add:co2sobj_closefd is_dir_simps)
chunhan
parents: 47
diff changeset
  1117
apply (rule_tac x = obj in exI, simp add:co2sobj_closefd)
chunhan
parents: 47
diff changeset
  1118
chunhan
parents: 47
diff changeset
  1119
apply (erule disjE)
chunhan
parents: 47
diff changeset
  1120
apply (drule same_inode_files_prop10, simp add:file_of_pfd_is_file, erule exE, erule conjE)
chunhan
parents: 47
diff changeset
  1121
apply (rule_tac x = "O_file f'a" in exI)
chunhan
parents: 47
diff changeset
  1122
apply (frule same_inode_files_prop11)
chunhan
parents: 47
diff changeset
  1123
apply (frule_tac obj = "O_file f'a" in co2sobj_closefd)
chunhan
parents: 47
diff changeset
  1124
apply (simp add:alive_simps)+
chunhan
parents: 47
diff changeset
  1125
apply (frule_tac f = "f'a" in is_file_has_sfile', simp, erule exE)
chunhan
parents: 47
diff changeset
  1126
apply (simp add:co2sobj.simps cf2sfiles_prop tainted_eq_Tainted same_inodes_Tainted split:if_splits)
chunhan
parents: 47
diff changeset
  1127
apply (rule impI, erule bexE, erule conjE, erule_tac x = f'' in ballE, simp, simp)
chunhan
parents: 47
diff changeset
  1128
apply (erule bexE, erule conjE, erule_tac x = f'' in ballE, simp, simp)
chunhan
parents: 47
diff changeset
  1129
apply (erule disjE)
chunhan
parents: 47
diff changeset
  1130
apply (rule_tac x = "O_proc p" in exI)
chunhan
parents: 47
diff changeset
  1131
apply (simp add:co2sobj.simps tainted_eq_Tainted)
chunhan
parents: 47
diff changeset
  1132
apply (erule conjE, erule exE, erule conjE)
chunhan
parents: 47
diff changeset
  1133
apply (case_tac "obj = O_proc p")
chunhan
parents: 47
diff changeset
  1134
apply (simp add:co2sobj.simps tainted_eq_Tainted)
chunhan
parents: 47
diff changeset
  1135
apply (erule_tac obj = obj in co2sobj_some_caseD)
chunhan
parents: 47
diff changeset
  1136
apply (rule_tac x = obj in exI)
chunhan
parents: 47
diff changeset
  1137
apply (simp add:co2sobj_closefd)
chunhan
parents: 47
diff changeset
  1138
apply (case_tac "f \<in> same_inode_files s a")
chunhan
parents: 47
diff changeset
  1139
apply (rule_tac x = "O_file f'" in exI)
chunhan
parents: 47
diff changeset
  1140
apply (simp add:co2sobj_simps is_file_simps split:if_splits option.splits t_sobject.splits)
chunhan
parents: 47
diff changeset
  1141
apply (rule conjI, rule notI, simp add:same_inode_files_prop9)
chunhan
parents: 47
diff changeset
  1142
apply (rule impI, simp add:co2sobj.simps cf2sfiles_prop tainted_eq_Tainted same_inodes_Tainted)
chunhan
parents: 47
diff changeset
  1143
apply (rule_tac x = obj in exI)
chunhan
parents: 47
diff changeset
  1144
apply (simp add:co2sobj_closefd is_file_simps)
chunhan
parents: 47
diff changeset
  1145
apply (rule notI, simp add:same_inode_files_prop9)
chunhan
parents: 47
diff changeset
  1146
apply (rule_tac x = obj in exI, simp add:co2sobj_closefd)
chunhan
parents: 47
diff changeset
  1147
apply (rule_tac x = obj in exI, simp add:co2sobj_closefd is_dir_simps)
chunhan
parents: 47
diff changeset
  1148
apply (rule_tac x = obj in exI, simp add:co2sobj_closefd)
chunhan
parents: 47
diff changeset
  1149
chunhan
parents: 47
diff changeset
  1150
apply (rule impI, rule conjI, rule impI)
chunhan
parents: 47
diff changeset
  1151
apply (tactic {*my_seteq_tac 1*})
53
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1152
apply (simp add:update_s2ss_obj_def update_s2ss_sfile_del_def)
48
chunhan
parents: 47
diff changeset
  1153
apply (rule conjI| rule impI|erule exE|erule conjE)+
chunhan
parents: 47
diff changeset
  1154
apply (erule_tac obj = obj in co2sobj_some_caseD)
chunhan
parents: 47
diff changeset
  1155
apply (case_tac "pa = p", simp add:co2sobj.simps tainted_eq_Tainted)
chunhan
parents: 47
diff changeset
  1156
apply (rule disjI2, rule_tac x = obj in exI)
chunhan
parents: 47
diff changeset
  1157
apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
chunhan
parents: 47
diff changeset
  1158
apply (case_tac "f = a", simp add:alive_simps)
chunhan
parents: 47
diff changeset
  1159
apply (rule disjI2, rule_tac x = obj in exI)
chunhan
parents: 47
diff changeset
  1160
apply (frule_tac obj = obj in co2sobj_closefd, simp, clarsimp simp:alive_simps split:if_splits)
chunhan
parents: 47
diff changeset
  1161
apply (rule disjI2, rule_tac x = obj in exI)
chunhan
parents: 47
diff changeset
  1162
apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
chunhan
parents: 47
diff changeset
  1163
apply (rule disjI2, rule_tac x = obj in exI)
chunhan
parents: 47
diff changeset
  1164
apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
chunhan
parents: 47
diff changeset
  1165
apply (rule disjI2, rule_tac x = obj in exI)
chunhan
parents: 47
diff changeset
  1166
apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
chunhan
parents: 47
diff changeset
  1167
apply (rule conjI| rule impI|erule exE|erule conjE)+
chunhan
parents: 47
diff changeset
  1168
apply (erule_tac obj = obj in co2sobj_some_caseD)
chunhan
parents: 47
diff changeset
  1169
apply (case_tac "pa = p", simp add:co2sobj.simps tainted_eq_Tainted)
chunhan
parents: 47
diff changeset
  1170
apply (rule disjI2, rule conjI, rule_tac x = obj in exI)
chunhan
parents: 47
diff changeset
  1171
apply (frule_tac obj = obj in co2sobj_closefd, simp)
chunhan
parents: 47
diff changeset
  1172
apply (auto simp add:co2sobj.simps tainted_eq_Tainted split:t_object.splits if_splits)[1]
chunhan
parents: 47
diff changeset
  1173
apply (rule notI, simp, erule_tac x = "O_proc pa" in allE, simp add:co2sobj_closefd)
chunhan
parents: 47
diff changeset
  1174
apply (case_tac "f = a", simp add:alive_simps)
chunhan
parents: 47
diff changeset
  1175
apply (case_tac "f \<in> same_inode_files s a", rule disjI2)
chunhan
parents: 47
diff changeset
  1176
apply (simp add:co2sobj_simps split:if_splits option.splits t_sobject.splits)
chunhan
parents: 47
diff changeset
  1177
apply (simp add:co2sobj.simps tainted_eq_Tainted same_inodes_Tainted cf2sfiles_prop)
chunhan
parents: 47
diff changeset
  1178
apply (erule bexE, erule conjE)
chunhan
parents: 47
diff changeset
  1179
apply (rule conjI, rule_tac x = "O_file f''" in exI)
chunhan
parents: 47
diff changeset
  1180
apply (simp add:same_inode_files_prop11 co2sobj.simps tainted_eq_Tainted cf2sfiles_prop same_inodes_Tainted)
chunhan
parents: 47
diff changeset
  1181
apply (rule notI, simp)
chunhan
parents: 47
diff changeset
  1182
apply (rule disjI2, rule conjI, rule_tac x = obj in exI)
chunhan
parents: 47
diff changeset
  1183
apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
chunhan
parents: 47
diff changeset
  1184
apply (rule notI, simp add:co2sobj.simps)
chunhan
parents: 47
diff changeset
  1185
apply (rule disjI2, rule conjI, rule_tac x = obj in exI)
chunhan
parents: 47
diff changeset
  1186
apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
chunhan
parents: 47
diff changeset
  1187
apply (rule notI, simp add:co2sobj.simps split:option.splits)
chunhan
parents: 47
diff changeset
  1188
apply (rule disjI2, rule conjI, rule_tac x = obj in exI)
chunhan
parents: 47
diff changeset
  1189
apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
chunhan
parents: 47
diff changeset
  1190
apply (rule notI, simp add:co2sobj.simps split:option.splits)
chunhan
parents: 47
diff changeset
  1191
apply (rule disjI2, rule conjI, rule_tac x = obj in exI)
chunhan
parents: 47
diff changeset
  1192
apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
chunhan
parents: 47
diff changeset
  1193
apply (rule notI, simp add:co2sobj.simps split:option.splits)
chunhan
parents: 47
diff changeset
  1194
chunhan
parents: 47
diff changeset
  1195
apply (erule bexE, erule conjE)
chunhan
parents: 47
diff changeset
  1196
apply (simp add:update_s2ss_obj_def split:if_splits)
chunhan
parents: 47
diff changeset
  1197
apply (erule disjE, rule_tac x = "O_proc p" in exI, simp add:co2sobj.simps tainted_eq_Tainted)
chunhan
parents: 47
diff changeset
  1198
apply (erule exE, erule conjE)
chunhan
parents: 47
diff changeset
  1199
apply (case_tac "obj = O_proc p")
chunhan
parents: 47
diff changeset
  1200
apply (rule_tac x = obj' in exI)
chunhan
parents: 47
diff changeset
  1201
apply (frule co2sobj_sproc_imp, erule exE, simp add:co2sobj_closefd)
chunhan
parents: 47
diff changeset
  1202
apply (simp add:co2sobj.simps tainted_eq_Tainted)
chunhan
parents: 47
diff changeset
  1203
apply (case_tac "obj = O_file a")
chunhan
parents: 47
diff changeset
  1204
apply (rule_tac x = "O_file f'" in exI)
chunhan
parents: 47
diff changeset
  1205
apply (frule_tac obj = "O_file f'" in co2sobj_closefd, simp add:alive_simps same_inode_files_prop11)
chunhan
parents: 47
diff changeset
  1206
apply (simp add:alive_simps co2sobj.simps tainted_eq_Tainted split:t_object.splits if_splits)
chunhan
parents: 47
diff changeset
  1207
apply (rule conjI)
chunhan
parents: 47
diff changeset
  1208
apply (rule impI)
chunhan
parents: 47
diff changeset
  1209
apply (rule_tac x = f' in ballE, simp, simp, simp)
chunhan
parents: 47
diff changeset
  1210
apply (simp add:same_inode_files_prop11 co2sobj.simps cf2sfiles_prop same_inodes_Tainted)
chunhan
parents: 47
diff changeset
  1211
apply (rule_tac x = obj in exI)
chunhan
parents: 47
diff changeset
  1212
apply (frule_tac obj = obj in alive_co2sobj_closefd3, simp+)
chunhan
parents: 47
diff changeset
  1213
apply (frule_tac obj = obj in co2sobj_closefd, simp)
chunhan
parents: 47
diff changeset
  1214
apply (auto simp add:alive_simps co2sobj.simps tainted_eq_Tainted split:t_object.splits if_splits)[1]
chunhan
parents: 47
diff changeset
  1215
apply (erule disjE, rule_tac x = "O_proc p" in exI, simp add:co2sobj.simps tainted_eq_Tainted)
chunhan
parents: 47
diff changeset
  1216
apply (erule conjE, erule exE, erule conjE)
chunhan
parents: 47
diff changeset
  1217
apply (case_tac "obj = O_proc p")
chunhan
parents: 47
diff changeset
  1218
apply (simp add:co2sobj.simps tainted_eq_Tainted)
chunhan
parents: 47
diff changeset
  1219
apply (case_tac "obj = O_file a")
chunhan
parents: 47
diff changeset
  1220
apply (rule_tac x = "O_file f'" in exI)
chunhan
parents: 47
diff changeset
  1221
apply (frule_tac obj = "O_file f'" in co2sobj_closefd, simp add:alive_simps same_inode_files_prop11)
chunhan
parents: 47
diff changeset
  1222
apply (simp add:alive_simps co2sobj.simps tainted_eq_Tainted split:t_object.splits if_splits)
chunhan
parents: 47
diff changeset
  1223
apply (rule conjI)
chunhan
parents: 47
diff changeset
  1224
apply (rule impI)
chunhan
parents: 47
diff changeset
  1225
apply (rule_tac x = f' in ballE, simp, simp, simp)
chunhan
parents: 47
diff changeset
  1226
apply (simp add:same_inode_files_prop11 co2sobj.simps cf2sfiles_prop same_inodes_Tainted)
chunhan
parents: 47
diff changeset
  1227
apply (rule_tac x = obj in exI)
chunhan
parents: 47
diff changeset
  1228
apply (frule_tac obj = obj in alive_co2sobj_closefd3, simp+)
chunhan
parents: 47
diff changeset
  1229
apply (frule_tac obj = obj in co2sobj_closefd, simp)
chunhan
parents: 47
diff changeset
  1230
apply (auto simp add:alive_simps co2sobj.simps tainted_eq_Tainted split:t_object.splits if_splits)[1]
chunhan
parents: 47
diff changeset
  1231
chunhan
parents: 47
diff changeset
  1232
apply (rule impI)
chunhan
parents: 47
diff changeset
  1233
apply (tactic {*my_seteq_tac 1*})
53
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1234
apply (simp add:update_s2ss_obj_def update_s2ss_sfile_del_def)
48
chunhan
parents: 47
diff changeset
  1235
apply (rule conjI| rule impI|erule exE|erule conjE)+
chunhan
parents: 47
diff changeset
  1236
apply (erule_tac obj = obj in co2sobj_some_caseD)
chunhan
parents: 47
diff changeset
  1237
apply (case_tac "pa = p", simp add:co2sobj.simps tainted_eq_Tainted)
chunhan
parents: 47
diff changeset
  1238
apply (rule disjI2, rule_tac x = obj in exI)
chunhan
parents: 47
diff changeset
  1239
apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
chunhan
parents: 47
diff changeset
  1240
apply (case_tac "f = a", simp add:alive_simps)
chunhan
parents: 47
diff changeset
  1241
apply (rule disjI2, rule_tac x = obj in exI)
chunhan
parents: 47
diff changeset
  1242
apply (frule_tac obj = obj in co2sobj_closefd, simp, clarsimp simp:alive_simps split:if_splits)
chunhan
parents: 47
diff changeset
  1243
apply (rule disjI2, rule_tac x = obj in exI)
chunhan
parents: 47
diff changeset
  1244
apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
chunhan
parents: 47
diff changeset
  1245
apply (rule disjI2, rule_tac x = obj in exI)
chunhan
parents: 47
diff changeset
  1246
apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
chunhan
parents: 47
diff changeset
  1247
apply (rule disjI2, rule_tac x = obj in exI)
chunhan
parents: 47
diff changeset
  1248
apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
chunhan
parents: 47
diff changeset
  1249
apply (frule_tac obj = obj in co2sobj_closefd, simp, rule notI, simp)
chunhan
parents: 47
diff changeset
  1250
apply (frule_tac obj = obj in co2sobj_sfile_imp, erule exE, simp add:is_file_simps split:if_splits)
chunhan
parents: 47
diff changeset
  1251
apply (erule_tac x= f in allE, simp add:co2sobj.simps tainted_eq_Tainted)
chunhan
parents: 47
diff changeset
  1252
apply (rule conjI| rule impI|erule exE|erule conjE)+
chunhan
parents: 47
diff changeset
  1253
apply (erule_tac obj = obj in co2sobj_some_caseD)
chunhan
parents: 47
diff changeset
  1254
apply (case_tac "pa = p", simp add:co2sobj.simps tainted_eq_Tainted)
chunhan
parents: 47
diff changeset
  1255
apply (rule disjI2, rule notI, simp)
chunhan
parents: 47
diff changeset
  1256
apply (rule disjI2, rule conjI, rule disjI2, rule_tac x = obj in exI)
chunhan
parents: 47
diff changeset
  1257
apply (frule_tac obj = obj in co2sobj_closefd, simp)
chunhan
parents: 47
diff changeset
  1258
apply (auto simp add:co2sobj.simps tainted_eq_Tainted split:t_object.splits if_splits)[1]
chunhan
parents: 47
diff changeset
  1259
apply (rule notI, simp add:co2sobj.simps split:option.splits)
chunhan
parents: 47
diff changeset
  1260
apply (case_tac "f = a", simp add:alive_simps)
49
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1261
apply (case_tac "f \<in> same_inode_files s a", rule disjI1)
48
chunhan
parents: 47
diff changeset
  1262
apply (simp add:co2sobj_simps split:if_splits option.splits t_sobject.splits)
chunhan
parents: 47
diff changeset
  1263
apply (simp add:co2sobj.simps tainted_eq_Tainted same_inodes_Tainted cf2sfiles_prop)
chunhan
parents: 47
diff changeset
  1264
apply (erule bexE, erule conjE)
49
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1265
apply (erule_tac x = f'' in ballE, simp, simp)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1266
apply (rule disjI2, rule conjI, rule disjI2, rule_tac x = obj in exI)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1267
apply (simp add:is_file_simps co2sobj_closefd tainted_eq_Tainted)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1268
apply (rule notI, simp add:co2sobj_closefd)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1269
apply (erule_tac x = f in allE, simp add:is_file_simps co2sobj.simps tainted_eq_Tainted) 
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1270
apply (rule disjI2, rule conjI, rule disjI2, rule_tac x = obj in exI)
48
chunhan
parents: 47
diff changeset
  1271
apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
49
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1272
apply (rule notI, simp add:co2sobj.simps split:option.splits)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1273
apply (rule disjI2, rule conjI, rule disjI2, rule_tac x = obj in exI)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1274
apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1275
apply (rule notI, simp add:co2sobj.simps split:option.splits)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1276
apply (rule disjI2, rule conjI, rule disjI2, rule_tac x = obj in exI)
48
chunhan
parents: 47
diff changeset
  1277
apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
chunhan
parents: 47
diff changeset
  1278
apply (rule notI, simp add:co2sobj.simps split:option.splits)
49
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1279
apply (rule impI, rule conjI, rule impI)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1280
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1281
apply (erule_tac obj = obj in co2sobj_some_caseD)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1282
apply (case_tac "pa = p", simp add:co2sobj.simps tainted_eq_Tainted)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1283
apply (rule notI, simp)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1284
apply (rule conjI, rule disjI2, rule conjI, rule_tac x = obj in exI)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1285
apply (frule_tac obj = obj in co2sobj_closefd, simp)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1286
apply (auto simp add:co2sobj.simps tainted_eq_Tainted split:t_object.splits if_splits)[1]
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1287
apply (erule_tac x = obj in allE, simp add:co2sobj_closefd)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1288
apply (rule notI, simp add:co2sobj.simps split:option.splits)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1289
apply (case_tac "f = a", simp add:alive_simps)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1290
apply (case_tac "f \<in> same_inode_files s a", rule conjI, rule disjI2, rule conjI)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1291
apply (simp add:co2sobj_simps split:if_splits option.splits t_sobject.splits)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1292
apply (simp add:co2sobj.simps)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1293
apply (rule notI, simp add:co2sobj.simps)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1294
apply (rule conjI, rule disjI2, rule conjI, rule_tac x = obj in exI)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1295
apply (simp add:is_file_simps co2sobj_closefd tainted_eq_Tainted)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1296
apply (rule notI, simp add:co2sobj.simps)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1297
apply (rule notI, simp add:co2sobj_closefd tainted_eq_Tainted)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1298
apply (erule_tac x = f in allE, simp add:is_file_simps co2sobj.simps tainted_eq_Tainted)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1299
apply (rule conjI, rule disjI2, rule conjI, rule_tac x = obj in exI)
48
chunhan
parents: 47
diff changeset
  1300
apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
49
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1301
apply (rule notI, simp add:co2sobj.simps split:option.splits)+
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1302
apply (rule conjI, rule disjI2, rule conjI, rule_tac x = obj in exI)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1303
apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1304
apply (rule notI, simp add:co2sobj.simps split:option.splits)+
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1305
apply (rule conjI, rule disjI2, rule conjI, rule_tac x = obj in exI)
48
chunhan
parents: 47
diff changeset
  1306
apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
49
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1307
apply (rule notI, simp add:co2sobj.simps split:option.splits)+
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1308
apply (rule impI)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1309
apply (erule_tac obj = obj in co2sobj_some_caseD)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1310
apply (case_tac "pa = p", simp add:co2sobj.simps tainted_eq_Tainted)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1311
apply (rule disjI2, rule notI, simp)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1312
apply (rule disjI2, rule conjI, rule disjI2, rule conjI, rule_tac x = obj in exI)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1313
apply (frule_tac obj = obj in co2sobj_closefd, simp)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1314
apply (auto simp add:co2sobj.simps tainted_eq_Tainted split:t_object.splits if_splits)[1]
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1315
apply (erule_tac x = obj in allE, simp add:co2sobj_closefd)
48
chunhan
parents: 47
diff changeset
  1316
apply (rule notI, simp add:co2sobj.simps split:option.splits)
49
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1317
apply (case_tac "f = a", simp add:alive_simps)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1318
apply (case_tac "f \<in> same_inode_files s a", rule disjI1)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1319
apply (simp add:co2sobj_closefd split:if_splits option.splits t_sobject.splits)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1320
apply (simp add:co2sobj.simps cf2sfiles_prop same_inodes_Tainted tainted_eq_Tainted)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1321
apply (erule bexE, erule conjE, erule_tac x = "f''" in ballE, simp, simp)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1322
apply (rule disjI2, rule conjI, rule disjI2, rule conjI, rule_tac x = obj in exI)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1323
apply (simp add:is_file_simps co2sobj_closefd tainted_eq_Tainted)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1324
apply (rule notI, simp add:co2sobj.simps)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1325
apply (rule notI, simp add:co2sobj_closefd tainted_eq_Tainted)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1326
apply (erule_tac x = f in allE, simp add:is_file_simps co2sobj.simps tainted_eq_Tainted)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1327
apply (rule disjI2, rule conjI, rule disjI2, rule conjI, rule_tac x = obj in exI)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1328
apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1329
apply (rule notI, simp add:co2sobj.simps split:option.splits)+
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1330
apply (rule disjI2, rule conjI, rule disjI2, rule conjI, rule_tac x = obj in exI)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1331
apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1332
apply (rule notI, simp add:co2sobj.simps split:option.splits)+
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1333
apply (rule disjI2, rule conjI, rule disjI2, rule conjI, rule_tac x = obj in exI)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1334
apply (frule_tac obj = obj in co2sobj_closefd, simp, simp add:alive_simps)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1335
apply (rule notI, simp add:co2sobj.simps split:option.splits)+
48
chunhan
parents: 47
diff changeset
  1336
53
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1337
apply (simp add:update_s2ss_sfile_del_def update_s2ss_obj_def split:if_splits)
49
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1338
apply (erule conjE, erule disjE)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1339
apply (rule_tac x = "O_proc p" in exI, simp add:co2sobj.simps tainted_eq_Tainted)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1340
apply (erule exE, erule conjE)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1341
apply (case_tac "obj = O_file a", simp add:co2sobj.simps tainted_eq_Tainted)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1342
apply (case_tac "obj = O_proc p")
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1343
apply (rule_tac x = obj' in exI, frule_tac obj = obj' in co2sobj_sproc_imp, erule exE)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1344
apply (frule_tac obj = obj' in alive_co2sobj_closefd3, simp+)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1345
apply (simp add:co2sobj_closefd)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1346
apply (simp add:co2sobj.simps tainted_eq_Tainted)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1347
apply (frule_tac obj = obj in alive_co2sobj_closefd3, simp+)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1348
apply (rule_tac x = obj in exI, simp add:co2sobj_closefd)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1349
apply (auto simp add:co2sobj.simps tainted_eq_Tainted split:t_object.splits if_splits)[1]
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1350
apply (erule conjE|erule exE|erule disjE)+
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1351
apply (rule_tac x = "O_proc p" in exI, simp add:co2sobj.simps tainted_eq_Tainted)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1352
apply (erule conjE, erule exE, erule conjE)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1353
apply (case_tac "obj = O_file a", simp add:co2sobj.simps tainted_eq_Tainted)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1354
apply (case_tac "obj = O_proc p")
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1355
apply (simp add:co2sobj.simps tainted_eq_Tainted)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1356
apply (frule_tac obj = obj in alive_co2sobj_closefd3, simp+)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1357
apply (rule_tac x = obj in exI, simp add:co2sobj_closefd)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1358
apply (auto simp add:co2sobj.simps tainted_eq_Tainted split:t_object.splits if_splits)[1]
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1359
apply (erule conjE|erule exE|erule disjE)+
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1360
apply (drule same_inode_files_prop10, simp add:file_of_pfd_is_file, erule exE, erule conjE)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1361
apply (rule_tac x = "O_file f'" in exI)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1362
apply (frule same_inode_files_prop11)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1363
apply (frule_tac obj = "O_file f'" in co2sobj_closefd)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1364
apply (simp add:alive_simps)+
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1365
apply (frule_tac f = "f'" in is_file_has_sfile', simp, erule exE)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1366
apply (simp add:co2sobj.simps cf2sfiles_prop tainted_eq_Tainted same_inodes_Tainted split:if_splits)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1367
apply (rule impI, erule bexE, erule conjE, erule_tac x = f'' in ballE, simp, simp)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1368
apply (erule bexE, erule conjE, erule_tac x = f'' in ballE, simp, simp)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1369
apply (erule conjE, erule disjE)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1370
apply (rule_tac x = "O_proc p" in exI)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1371
apply (simp add:co2sobj.simps tainted_eq_Tainted)
48
chunhan
parents: 47
diff changeset
  1372
apply (erule exE, erule conjE)
chunhan
parents: 47
diff changeset
  1373
apply (case_tac "obj = O_proc p")
49
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1374
apply (rule_tac x = "obj'" in exI, simp, frule_tac obj = obj' in co2sobj_sproc_imp, erule exE)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1375
apply (frule_tac obj = obj' in alive_co2sobj_closefd3, simp+)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1376
apply (simp add:co2sobj_closefd tainted_eq_Tainted)
48
chunhan
parents: 47
diff changeset
  1377
apply (simp add:co2sobj.simps tainted_eq_Tainted)
49
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1378
apply (case_tac "obj = O_file a", simp add:co2sobj.simps tainted_eq_Tainted)
48
chunhan
parents: 47
diff changeset
  1379
apply (frule_tac obj = obj in alive_co2sobj_closefd3, simp+)
49
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1380
apply (erule_tac obj = obj in co2sobj_some_caseD)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1381
apply (rule_tac x = obj in exI)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1382
apply (simp add:co2sobj_closefd)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1383
apply (case_tac "f = a", simp add:alive_simps)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1384
apply (case_tac "f \<in> same_inode_files s a")
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1385
apply (simp add:co2sobj.simps cf2sfiles_prop tainted_eq_Tainted same_inodes_Tainted)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1386
apply (rule_tac x = obj in exI, simp add:co2sobj_closefd)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1387
apply (rule_tac x = obj in exI, simp add:co2sobj_closefd)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1388
apply (rule_tac x = obj in exI, simp add:co2sobj_closefd)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1389
apply (rule_tac x = obj in exI, simp add:co2sobj_closefd)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1390
apply (erule disjE)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1391
apply (drule same_inode_files_prop10, simp add:file_of_pfd_is_file, erule exE, erule conjE)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1392
apply (rule_tac x = "O_file f'" in exI)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1393
apply (frule same_inode_files_prop11)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1394
apply (frule_tac obj = "O_file f'" in co2sobj_closefd)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1395
apply (simp add:alive_simps)+
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1396
apply (frule_tac f = "f'" in is_file_has_sfile', simp, erule exE)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1397
apply (simp add:co2sobj.simps cf2sfiles_prop tainted_eq_Tainted same_inodes_Tainted split:if_splits)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1398
apply (rule impI, erule bexE, erule conjE, erule_tac x = f'' in ballE, simp, simp)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1399
apply (erule bexE, erule conjE, erule_tac x = f'' in ballE, simp, simp)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1400
apply (erule conjE, erule disjE)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1401
apply (rule_tac x = "O_proc p" in exI)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1402
apply (simp add:co2sobj.simps tainted_eq_Tainted)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1403
apply (erule conjE, erule exE, erule conjE)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1404
apply (case_tac "obj = O_proc p", simp add:co2sobj.simps tainted_eq_Tainted)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1405
apply (case_tac "obj = O_file a", simp add:co2sobj.simps tainted_eq_Tainted)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1406
apply (erule_tac obj = obj in co2sobj_some_caseD)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1407
apply (rule_tac x = obj in exI)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1408
apply (simp add:co2sobj_closefd)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1409
apply (case_tac "f \<in> same_inode_files s a")
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1410
apply (simp add:co2sobj.simps cf2sfiles_prop tainted_eq_Tainted same_inodes_Tainted)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1411
apply (rule_tac x = obj in exI, simp add:co2sobj_closefd is_file_simps)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1412
apply (rule_tac x = obj in exI, simp add:co2sobj_closefd)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1413
apply (rule_tac x = obj in exI, simp add:co2sobj_closefd is_dir_simps)
68649272054c 600 loc to finish s2ss_closefd
chunhan
parents: 48
diff changeset
  1414
apply (rule_tac x = obj in exI, simp add:co2sobj_closefd)
47
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1415
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1416
apply (rule impI)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1417
apply (simp add:update_s2ss_obj_def)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1418
apply (rule conjI, rule impI, erule exE, erule conjE)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1419
apply (simp add:s2ss_def)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1420
apply (rule set_eqI, rule iffI, erule CollectE, erule exE, erule conjE)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1421
apply (simp)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1422
apply (case_tac "obj = O_proc p")
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1423
apply (simp add:co2sobj.simps tainted_eq_Tainted split:if_splits)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1424
apply (rule disjI2, rule_tac x = obj in exI, erule conjE)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1425
apply (simp add:alive_co2sobj_closefd')
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1426
apply (frule_tac obj = obj in co2sobj_closefd, simp, simp split:t_object.splits if_splits)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1427
apply (simp, erule disjE)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1428
apply (rule_tac x = "O_proc p" in exI, simp add:co2sobj.simps tainted_eq_Tainted)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1429
apply (erule exE, erule conjE)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1430
apply (case_tac "obj = O_proc p")
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1431
apply (rule_tac x = obj' in exI, simp add:alive_co2sobj_closefd1)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1432
apply (frule_tac obj = obj' in co2sobj_closefd, simp add:alive_co2sobj_closefd1)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1433
apply (clarsimp split:t_object.splits if_splits option.splits simp:tainted_eq_Tainted co2sobj.simps)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1434
apply (rule_tac x = obj in exI, simp add:alive_co2sobj_closefd1)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1435
apply (frule_tac obj = obj in co2sobj_closefd, simp add:alive_co2sobj_closefd1)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1436
apply (clarsimp split:t_object.splits if_splits option.splits simp:tainted_eq_Tainted co2sobj.simps)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1437
apply (rule impI)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1438
apply (simp add:s2ss_def)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1439
apply (rule set_eqI, rule iffI, erule CollectE, erule exE, erule conjE)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1440
apply (simp)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1441
apply (case_tac "obj = O_proc p")
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1442
apply (rule disjI1, simp add:co2sobj.simps tainted_eq_Tainted split:if_splits)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1443
apply (rule disjI2, rule conjI, rule_tac x = obj in exI, simp add:alive_co2sobj_closefd')
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1444
apply (frule_tac obj = obj in co2sobj_closefd, simp add:alive_co2sobj_closefd1)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1445
apply (clarsimp split:t_object.splits if_splits option.splits simp:tainted_eq_Tainted co2sobj.simps)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1446
apply (rule notI, erule_tac x = obj in allE, simp add:alive_co2sobj_closefd')
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1447
apply (frule_tac obj = obj in co2sobj_closefd, simp add:alive_co2sobj_closefd1)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1448
apply (clarsimp split:t_object.splits if_splits option.splits)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1449
apply (simp)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1450
apply (erule disjE)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1451
apply (rule_tac x = "O_proc p" in exI, simp add:co2sobj.simps tainted_eq_Tainted)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1452
apply (erule exE|erule conjE)+
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1453
apply (rule_tac x = obj in exI)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1454
apply (frule_tac obj = obj in co2sobj_closefd, simp add:alive_co2sobj_closefd1)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1455
apply (clarsimp split:t_object.splits if_splits option.splits 
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1456
                simp:tainted_eq_Tainted co2sobj.simps alive_co2sobj_closefd1)
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1457
done
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1458
50
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1459
lemma alive_co2sobj_unlink:
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1460
  "\<lbrakk>alive s obj; valid (UnLink p f # s); obj \<noteq> O_file f\<rbrakk>
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1461
   \<Longrightarrow> alive (UnLink p f # s) obj"
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1462
by (auto simp add:alive_simps split:t_object.splits)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1463
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1464
lemma s2ss_unlink:
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1465
  "valid (UnLink p f # s) \<Longrightarrow> s2ss (UnLink p f # s) = (
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1466
     if (proc_fd_of_file s f = {}) 
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1467
     then (case (cf2sfile s f) of 
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1468
             Some sf \<Rightarrow> del_s2ss_file s (s2ss s) f sf
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1469
           | _       \<Rightarrow> {})
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1470
     else s2ss s)"
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1471
apply (frule vd_cons, frule vt_grant_os, clarsimp split:if_splits)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1472
apply (frule is_file_has_sfile', simp, erule exE, simp)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1473
apply (rule conjI, rule impI)
53
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1474
apply (simp add:update_s2ss_sfile_del_def del_s2ss_file_def)
50
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1475
apply (rule impI|erule conjE|erule exE|rule conjI|erule bexE)+ defer
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1476
apply (rule impI|erule conjE|erule exE|rule conjI|erule bexE)+ 
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1477
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1478
apply (simp add:s2ss_def)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1479
apply (tactic {*my_seteq_tac 1*})
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1480
apply (case_tac "obj = O_file f", simp add:is_file_simps)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1481
apply simp
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1482
apply (rule conjI)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1483
apply (rule_tac x = obj in exI,simp add:co2sobj_unlink is_file_simps is_dir_simps split:t_object.splits)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1484
apply (simp add:co2sobj.simps)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1485
apply (simp add:co2sobj.simps)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1486
apply (rule notI, simp, frule_tac obj = obj in co2sobj_sfile_imp, erule exE, simp)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1487
apply (frule_tac obj = obj in co2sobj_unlink, simp)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1488
apply (erule_tac x = fa in allE, simp add:is_file_simps)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1489
apply (simp add:co2sobj.simps tainted_eq_Tainted)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1490
apply (tactic {*my_setiff_tac 1*})
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1491
apply (case_tac "obj = O_file f", simp add:co2sobj.simps tainted_eq_Tainted)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1492
apply (frule_tac alive_co2sobj_unlink, simp, simp)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1493
apply (frule_tac obj = obj in co2sobj_unlink, simp)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1494
apply (rule_tac x = obj in exI)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1495
apply (simp add:co2sobj.simps tainted_eq_Tainted split:t_object.splits if_splits)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1496
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1497
apply (rule impI|erule conjE|erule exE|rule conjI|erule bexE)+  defer
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1498
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1499
apply (rule impI|erule conjE|erule exE|rule conjI|erule bexE)+ 
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1500
apply (simp add:s2ss_def)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1501
apply (tactic {*my_seteq_tac 1*})
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1502
apply (case_tac "obj = O_file f", simp add:alive_simps)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1503
apply (erule_tac obj = obj in co2sobj_some_caseD)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1504
apply (rule disjI2, simp, rule_tac x = obj in exI)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1505
apply (simp add:co2sobj_unlink)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1506
apply (case_tac "fa \<in> same_inode_files s f")
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1507
apply (rule disjI1)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1508
apply (simp add:co2sobj_unlink)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1509
apply (simp add:co2sobj.simps tainted_eq_Tainted same_inodes_Tainted cf2sfiles_prop split:if_splits)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1510
apply (erule bexE, erule_tac x = f'' in ballE, simp, simp)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1511
apply (rule disjI2, simp, rule_tac x = obj in exI)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1512
apply (simp add:co2sobj_unlink is_file_simps)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1513
apply (rule disjI2, simp, rule_tac x = obj in exI, simp add:co2sobj_unlink)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1514
apply (rule disjI2, simp, rule_tac x = obj in exI, simp add:co2sobj_unlink is_dir_simps)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1515
apply (rule disjI2, simp, rule_tac x = obj in exI, simp add:co2sobj_unlink)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1516
apply (tactic {*my_setiff_tac 1*})
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1517
apply (drule same_inode_files_prop10, simp, erule exE, erule conjE)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1518
apply (rule_tac x = "O_file f'a" in exI, simp add:is_file_simps)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1519
apply (frule_tac obj = "O_file f'a" in co2sobj_unlink, simp add:same_inode_files_prop11 is_file_simps)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1520
apply (simp add:co2sobj.simps tainted_eq_Tainted same_inodes_Tainted cf2sfiles_prop 
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1521
  is_file_simps same_inode_files_prop11 split:if_splits)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1522
apply (rule impI, erule bexE, erule_tac x = f'' in ballE, simp, simp)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1523
apply (erule bexE, erule_tac x = f'' in ballE, simp, simp)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1524
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1525
apply (tactic {*my_setiff_tac 1*})
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1526
apply (case_tac "f' = f", simp add:same_inode_files_prop9) 
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1527
apply (case_tac "obj= O_file f")
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1528
apply (rule_tac x = "O_file f'" in exI, simp add:is_file_simps)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1529
apply (frule_tac f' = f' in cf2sfiles_unlink, simp add:current_files_simps is_file_in_current)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1530
apply (simp add:co2sobj.simps tainted_eq_Tainted)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1531
apply (erule_tac obj = obj in co2sobj_some_caseD)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1532
apply (rule_tac x = obj in exI, simp add:co2sobj_unlink)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1533
apply (case_tac "fa \<in> same_inode_files s f")
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1534
apply (rule_tac x = "O_file f'" in exI)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1535
apply (frule_tac f' = f' in cf2sfiles_unlink, simp add:current_files_simps is_file_in_current)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1536
apply (simp add:co2sobj.simps tainted_eq_Tainted is_file_simps cf2sfiles_prop same_inodes_Tainted)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1537
apply (rule_tac x = obj in exI, simp add:co2sobj_unlink is_file_simps)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1538
apply (rule_tac x = obj in exI, simp add:co2sobj_unlink)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1539
apply (rule_tac x = obj in exI, simp add:co2sobj_unlink is_dir_simps)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1540
apply (rule_tac x = obj in exI, simp add:co2sobj_unlink)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1541
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1542
apply (rule impI|erule conjE|erule exE|rule conjI|erule bexE)+  defer
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1543
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1544
apply (rule impI|erule conjE|erule exE|rule conjI|erule bexE)+ 
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1545
apply (simp add:s2ss_def)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1546
apply (tactic {*my_seteq_tac 1*})
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1547
apply (case_tac "obj = O_file f", simp add:alive_simps, simp)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1548
apply (erule_tac obj = obj in co2sobj_some_caseD)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1549
apply (rule disjI2, rule conjI, simp, rule_tac x = obj in exI)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1550
apply (simp add:co2sobj_unlink)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1551
apply (rule notI, simp add:co2sobj.simps split:option.splits)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1552
apply (case_tac "fa \<in> same_inode_files s f")
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1553
apply (rule disjI1)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1554
apply (simp add:co2sobj_unlink)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1555
apply (simp add:co2sobj.simps tainted_eq_Tainted same_inodes_Tainted cf2sfiles_prop split:if_splits)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1556
apply (erule bexE, erule_tac x = f'' in ballE, simp, simp)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1557
apply (rule disjI2, rule conjI, simp, rule_tac x = obj in exI)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1558
apply (simp add:co2sobj_unlink is_file_simps)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1559
apply (rule notI, simp add:co2sobj_unlink tainted_eq_Tainted)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1560
apply (erule_tac x = fa in allE, simp add:co2sobj.simps is_file_simps tainted_eq_Tainted)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1561
apply (rule disjI2, rule conjI, simp, rule_tac x = obj in exI, simp add:co2sobj_unlink)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1562
apply (rule notI, simp add:co2sobj.simps split:option.splits)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1563
apply (rule disjI2, rule conjI, simp, rule_tac x = obj in exI, simp add:co2sobj_unlink is_dir_simps)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1564
apply (rule notI, simp add:co2sobj.simps split:option.splits)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1565
apply (rule disjI2, rule conjI, simp, rule_tac x = obj in exI, simp add:co2sobj_unlink)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1566
apply (rule notI, simp add:co2sobj.simps split:option.splits)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1567
apply (tactic {*my_setiff_tac 1*})
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1568
apply (drule same_inode_files_prop10, simp, erule exE, erule conjE)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1569
apply (rule_tac x = "O_file f'" in exI, simp add:is_file_simps)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1570
apply (frule_tac obj = "O_file f'" in co2sobj_unlink, simp add:same_inode_files_prop11 is_file_simps)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1571
apply (simp add:co2sobj.simps tainted_eq_Tainted same_inodes_Tainted cf2sfiles_prop 
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1572
  is_file_simps same_inode_files_prop11 split:if_splits)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1573
apply (rule impI, erule bexE, erule_tac x = f'' in ballE, simp, simp)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1574
apply (erule bexE, erule_tac x = f'' in ballE, simp, simp)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1575
apply (tactic {*my_setiff_tac 1*}, simp)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1576
apply (case_tac "obj = O_file f", simp add:co2sobj.simps tainted_eq_Tainted)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1577
apply (erule_tac obj = obj in co2sobj_some_caseD)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1578
apply (rule_tac x = obj in exI, simp add:co2sobj_unlink)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1579
apply (case_tac "fa \<in> same_inode_files s f")
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1580
apply (simp add:co2sobj.simps cf2sfiles_prop same_inodes_Tainted tainted_eq_Tainted)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1581
apply (rule_tac x = obj in exI, simp add:co2sobj_unlink is_file_simps)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1582
apply (rule_tac x = obj in exI, simp add:co2sobj_unlink)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1583
apply (rule_tac x = obj in exI, simp add:co2sobj_unlink is_dir_simps)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1584
apply (rule_tac x = obj in exI, simp add:co2sobj_unlink)
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1585
51
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1586
apply (rule impI)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1587
apply (simp add:s2ss_def)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1588
apply (tactic {*my_seteq_tac 1*})
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1589
apply (rule_tac x = obj in exI)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1590
apply (simp add:co2sobj_unlink is_file_simps is_dir_simps split:t_object.splits)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1591
apply (simp add:co2sobj.simps)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1592
apply (simp add:co2sobj.simps)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1593
apply (tactic {*my_setiff_tac 1*})
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1594
apply (rule_tac x = obj in exI)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1595
apply (subgoal_tac "alive (UnLink p f # s) obj")
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1596
apply (auto simp add:co2sobj_unlink is_file_simps is_dir_simps split:t_object.splits)[1]
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1597
apply (auto simp add:co2sobj_unlink alive_simps split:t_object.splits)[1]
50
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1598
51
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1599
apply (simp add:s2ss_def)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1600
apply (tactic {*my_seteq_tac 1*})
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1601
apply (case_tac "obj = O_file f", simp add:alive_simps)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1602
apply (rule_tac x = obj in exI, simp add:co2sobj_unlink is_file_simps is_dir_simps split:t_object.splits)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1603
apply (simp add:co2sobj.simps)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1604
apply (simp add:co2sobj.simps)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1605
apply (tactic {*my_setiff_tac 1*})
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1606
apply (case_tac "obj = O_file f")
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1607
apply (rule_tac x = "O_file f'" in exI)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1608
apply (auto simp add:co2sobj_unlink is_file_simps is_dir_simps split:t_object.splits)[1]
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1609
apply (rule_tac x =obj in exI)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1610
apply (subgoal_tac "alive (UnLink p f # s) obj")
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1611
apply (auto simp add:co2sobj_unlink is_file_simps is_dir_simps split:t_object.splits)[1]
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1612
apply (auto simp add:co2sobj_unlink alive_simps split:t_object.splits)[1]
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1613
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1614
apply (simp add:s2ss_def)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1615
apply (tactic {*my_seteq_tac 1*})
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1616
apply (case_tac "obj = O_file f", simp add:alive_simps)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1617
apply (rule_tac x = obj in exI, simp add:co2sobj_unlink is_file_simps is_dir_simps split:t_object.splits if_splits)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1618
apply (simp add:co2sobj.simps)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1619
apply (simp add:co2sobj.simps)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1620
apply (tactic {*my_setiff_tac 1*})
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1621
apply (case_tac "obj = O_file f")
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1622
apply (rule_tac x = "O_file f'" in exI)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1623
apply (auto simp add:co2sobj_unlink is_file_simps is_dir_simps same_inode_files_prop9 split:t_object.splits)[1]
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1624
apply (erule_tac obj = obj in co2sobj_some_caseD)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1625
apply (rule_tac x = obj in exI, simp add:co2sobj_unlink)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1626
apply (case_tac "fa \<in> same_inode_files s f")
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1627
apply (rule_tac x = "O_file f'" in exI)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1628
apply (simp add:alive_simps co2sobj.simps)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1629
apply (rule conjI, rule notI, simp add:same_inode_files_prop9)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1630
apply (rule impI, frule_tac f' = f' in cf2sfiles_unlink)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1631
apply (simp add:current_files_simps is_file_simps is_file_in_current)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1632
apply (simp add:tainted_eq_Tainted same_inodes_Tainted cf2sfiles_prop)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1633
apply (rule_tac x = obj in exI, simp add:co2sobj_unlink is_file_simps)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1634
apply (rule_tac x = obj in exI, simp add:co2sobj_unlink)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1635
apply (rule_tac x = obj in exI, simp add:co2sobj_unlink is_dir_simps)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1636
apply (rule_tac x = obj in exI, simp add:co2sobj_unlink)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1637
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1638
apply (simp add:s2ss_def)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1639
apply (tactic {*my_seteq_tac 1*})
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1640
apply (case_tac "obj = O_file f", simp add:alive_simps)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1641
apply (rule_tac x = obj in exI, simp add:co2sobj_unlink is_file_simps is_dir_simps split:t_object.splits if_splits)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1642
apply (simp add:co2sobj.simps)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1643
apply (simp add:co2sobj.simps)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1644
apply (tactic {*my_setiff_tac 1*})
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1645
apply (case_tac "obj = O_file f")
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1646
apply (rule_tac x = "O_file f'" in exI)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1647
apply (subgoal_tac "alive (UnLink p f # s) (O_file f')")
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1648
apply (frule same_inode_files_prop11, frule_tac f = f' in is_file_has_sfile', simp add:vd_cons, erule exE)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1649
apply (frule_tac obj = "O_file f'" in co2sobj_unlink, simp)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1650
apply (simp split:if_splits option.splits add:is_file_simps)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1651
apply (simp add:co2sobj.simps cf2sfiles_prop same_inodes_Tainted tainted_eq_Tainted)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1652
apply (auto split:t_sobject.splits)[1]
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1653
apply (simp add:is_file_simps same_inode_files_prop11)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1654
apply (erule_tac obj = obj in co2sobj_some_caseD)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1655
apply (rule_tac x = obj in exI, simp add:co2sobj_unlink)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1656
apply (case_tac "fa \<in> same_inode_files s f")
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1657
apply (rule_tac x = "O_file f'" in exI)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1658
apply (subgoal_tac "alive (UnLink p f # s) (O_file f')")
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1659
apply (frule same_inode_files_prop11, frule_tac f = f' in is_file_has_sfile', simp add:vd_cons, erule exE)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1660
apply (frule_tac obj = "O_file f'" in co2sobj_unlink, simp)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1661
apply (simp split:if_splits option.splits add:is_file_simps)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1662
apply (simp add:co2sobj.simps cf2sfiles_prop same_inodes_Tainted tainted_eq_Tainted)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1663
apply (auto split:t_sobject.splits)[1]
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1664
apply (simp add:is_file_simps same_inode_files_prop11)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1665
apply (rule_tac x = obj in exI, simp add:co2sobj_unlink is_file_simps)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1666
apply (rule_tac x = obj in exI, simp add:co2sobj_unlink)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1667
apply (rule_tac x = obj in exI, simp add:co2sobj_unlink is_dir_simps)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1668
apply (rule_tac x = obj in exI, simp add:co2sobj_unlink)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1669
done
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1670
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1671
definition del_s2ss_obj :: "t_state \<Rightarrow> t_static_state \<Rightarrow> t_object \<Rightarrow> t_sobject \<Rightarrow> t_static_state"
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1672
where
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1673
  "del_s2ss_obj s ss obj sobj \<equiv> 
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1674
     if (\<exists> obj'. alive s obj' \<and> obj' \<noteq> obj \<and> co2sobj s obj' = Some sobj)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1675
     then ss
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1676
     else ss - {sobj}"
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1677
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1678
lemma del_update_s2ss_obj:
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1679
  "update_s2ss_obj s ss obj sobj sobj' = del_s2ss_obj s ss obj sobj \<union> {sobj'}"
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1680
by (auto simp:update_s2ss_obj_def del_s2ss_obj_def split:if_splits)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1681
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1682
lemma s2ss_rmdir: "valid (Rmdir p f # s) \<Longrightarrow> s2ss (Rmdir p f # s) = (
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1683
  case (co2sobj s (O_dir f)) of
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1684
    Some sdir \<Rightarrow> del_s2ss_obj s (s2ss s) (O_dir f) sdir
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1685
  | _         \<Rightarrow> {})"
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1686
apply (frule vd_cons, frule vt_grant_os)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1687
apply (clarsimp simp:dir_is_empty_def)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1688
apply (frule is_dir_has_sdir', simp, erule exE)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1689
apply (simp split:option.splits, rule conjI, rule impI, simp add:co2sobj.simps)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1690
apply (rule allI, rule impI)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1691
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1692
apply (simp add:del_s2ss_obj_def)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1693
apply (rule conjI|rule impI|erule exE|erule conjE)+
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1694
apply (simp add:s2ss_def)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1695
apply (tactic {*my_seteq_tac 1*})
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1696
apply (rule_tac x = obj in exI)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1697
apply (simp add:co2sobj_rmdir is_file_simps is_dir_simps alive_simps split:t_object.splits if_splits)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1698
apply (tactic {*my_setiff_tac 1*})
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1699
apply (case_tac "obj = O_dir f")
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1700
apply (rule_tac x = obj' in exI)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1701
apply (subgoal_tac "alive (Rmdir p f # s) obj'")
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1702
apply (auto simp add:co2sobj_rmdir is_file_simps is_dir_simps split:t_object.splits)[1]
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1703
apply (simp add:alive_rmdir)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1704
apply (rule_tac x = obj in exI)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1705
apply (subgoal_tac "alive (Rmdir p f # s) obj")
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1706
apply (auto simp add:co2sobj_rmdir is_file_simps is_dir_simps split:t_object.splits)[1]
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1707
apply (simp add:alive_rmdir)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1708
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1709
apply (rule conjI|rule impI|erule exE|erule conjE)+
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1710
apply (simp add:s2ss_def)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1711
apply (tactic {*my_seteq_tac 1*})
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1712
apply simp
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1713
apply (case_tac "obj = O_dir f", simp add:alive_rmdir)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1714
apply (rule conjI)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1715
apply (rule_tac x = obj in exI, simp add:co2sobj_rmdir alive_rmdir)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1716
apply (simp add:co2sobj_rmdir)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1717
apply (simp add:alive_rmdir, erule_tac x = obj in allE, simp)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1718
apply (tactic {*my_setiff_tac 1*}, simp)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1719
apply (case_tac "obj = O_dir f", simp)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1720
apply (rule_tac x = obj in exI, simp add:co2sobj_rmdir alive_rmdir)
b718662f61fa s2ss_rmdir
chunhan
parents: 50
diff changeset
  1721
done
50
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1722
52
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1723
lemma s2ss_mkdir: "valid (Mkdir p f inum # s) \<Longrightarrow> s2ss (Mkdir p f inum # s) = (
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1724
  case (cf2sfile (Mkdir p f inum # s) f) of
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1725
    Some sf \<Rightarrow> (s2ss s) \<union> {S_dir sf}
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1726
  | _       \<Rightarrow> {})"
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1727
apply (frule vt_grant_os, frule vd_cons, clarsimp)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1728
apply (case_tac "cf2sfile (Mkdir p f inum # s) f")
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1729
apply (drule current_file_has_sfile', simp, simp add:current_files_simps, simp)
50
ed90f7d5e6d7 200 loc to finish s2ss_unlink
chunhan
parents: 49
diff changeset
  1730
52
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1731
apply (simp add:s2ss_def)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1732
apply (tactic {*my_seteq_tac 1*}, simp)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1733
apply (case_tac "obj = O_dir f")
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1734
apply (rule disjI1, simp add:co2sobj.simps)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1735
apply (rule disjI2, rule_tac x = obj in exI, simp add:co2sobj_mkdir alive_simps)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1736
apply (tactic {*my_setiff_tac 1*}, simp)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1737
apply (rule_tac x = "O_dir f" in exI, simp add:alive_mkdir co2sobj.simps)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1738
apply (tactic {*my_setiff_tac 1*})
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1739
apply (case_tac "obj = O_dir f", simp add:is_dir_in_current)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1740
apply (rule_tac x = obj in exI, simp add:co2sobj_mkdir alive_mkdir)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1741
done
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1742
53
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1743
definition update_s2ss_sfile:: "t_state \<Rightarrow> t_static_state \<Rightarrow> t_file \<Rightarrow> t_sfile \<Rightarrow> t_static_state"
52
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1744
where
53
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1745
 "update_s2ss_sfile s ss f sf \<equiv>
52
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1746
    if (\<exists> f'. is_file s f' \<and> f' \<notin> same_inode_files s f \<and> co2sobj s (O_file f') = co2sobj s (O_file f))
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1747
       then ss \<union> {S_file (cf2sfiles s f \<union> {sf}) (O_file f \<in> Tainted s)}
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1748
       else ss - {S_file (cf2sfiles s f) (O_file f \<in> Tainted s)} 
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1749
               \<union> {S_file (cf2sfiles s f \<union> {sf}) (O_file f \<in> Tainted s)}"
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1750
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1751
lemma s2ss_linkhard: "valid (LinkHard p f f' # s) \<Longrightarrow> s2ss (LinkHard p f f' # s) = (
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1752
  case (cf2sfile (LinkHard p f f' # s) f') of
53
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1753
    Some sf \<Rightarrow> update_s2ss_sfile s (s2ss s) f sf
52
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1754
  | _       \<Rightarrow> {})"
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1755
apply (frule vt_grant_os, frule vd_cons, clarsimp)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1756
apply (split option.splits)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1757
apply (rule conjI, rule impI, drule current_file_has_sfile', simp, simp add:current_files_simps)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1758
apply (rule allI, rule impI)
47
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1759
53
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1760
apply (simp add:update_s2ss_sfile_def)
52
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1761
apply (rule conjI, rule impI, erule exE, erule conjE, erule conjE)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1762
apply (simp add:s2ss_def)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1763
apply (tactic {*my_seteq_tac 1*})
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1764
apply (case_tac "obj = O_file f'")
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1765
apply (rule disjI1, simp add:co2sobj.simps cf2sfiles_linkhard tainted_eq_Tainted
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1766
  same_inode_files_linkhard split:if_splits)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1767
apply (case_tac "O_file f' \<in> Tainted s")
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1768
apply (drule Tainted_in_current, simp, simp add:is_file_in_current alive.simps, simp)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1769
apply (erule_tac obj = obj in co2sobj_some_caseD)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1770
apply (rule disjI2, simp, rule_tac x = obj in exI)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1771
apply (simp add:co2sobj_linkhard alive_linkhard)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1772
apply (case_tac "fa \<in> same_inode_files s f")
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1773
apply (rule disjI1, simp add:co2sobj.simps cf2sfiles_linkhard tainted_eq_Tainted 
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1774
  same_inodes_Tainted split:if_splits)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1775
apply (rule disjI2, simp, rule_tac x = obj in exI, simp add:co2sobj_linkhard is_file_simps)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1776
apply (rule disjI2, simp, rule_tac x = obj in exI, simp add:co2sobj_linkhard)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1777
apply (rule disjI2, simp, rule_tac x = obj in exI, simp add:co2sobj_linkhard is_dir_simps)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1778
apply (rule disjI2, simp, rule_tac x = obj in exI, simp add:co2sobj_linkhard)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1779
apply (tactic {*my_setiff_tac 1*})
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1780
apply (rule_tac x = "O_file f" in exI)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1781
apply (frule_tac obj = "O_file f" in co2sobj_linkhard)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1782
apply (simp add:alive_linkhard)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1783
apply (simp add:alive_linkhard same_inode_files_prop9 split:t_object.splits)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1784
apply (tactic {*my_setiff_tac 1*})
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1785
apply (case_tac "obj = O_file f'", simp add:alive_linkhard is_file_in_current)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1786
apply (erule_tac obj = obj in co2sobj_some_caseD)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1787
apply (rule_tac x = obj in exI, simp add:co2sobj_linkhard alive_linkhard)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1788
apply (case_tac "fa \<in> same_inode_files s f")
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1789
apply (rule_tac x = "O_file f'a" in exI, simp add:co2sobj_linkhard alive_linkhard)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1790
apply (rule conjI, rule impI, simp add:is_file_in_current)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1791
apply (rule impI, simp add:co2sobj.simps cf2sfiles_prop tainted_eq_Tainted same_inodes_Tainted)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1792
apply (rule_tac x = obj in exI, simp add:co2sobj_linkhard alive_linkhard)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1793
apply (rule_tac x = obj in exI, simp add:co2sobj_linkhard alive_linkhard)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1794
apply (rule_tac x = obj in exI, simp add:co2sobj_linkhard alive_linkhard)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1795
apply (rule_tac x = obj in exI, simp add:co2sobj_linkhard alive_linkhard)
47
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1796
52
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1797
apply (rule impI)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1798
apply (simp add:s2ss_def)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1799
apply (tactic {*my_seteq_tac 1*})
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1800
apply (case_tac "obj = O_file f'", simp)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1801
apply (rule disjI1, simp add:co2sobj.simps cf2sfiles_linkhard tainted_eq_Tainted
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1802
  same_inode_files_linkhard split:if_splits)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1803
apply (case_tac "O_file f' \<in> Tainted s")
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1804
apply (drule Tainted_in_current, simp, simp add:is_file_in_current alive.simps, simp)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1805
apply (erule_tac obj = obj in co2sobj_some_caseD, simp)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1806
apply (rule disjI2, rule conjI, rule_tac x = obj in exI)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1807
apply (simp add:co2sobj_linkhard alive_linkhard)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1808
apply (rule notI, simp add:co2sobj.simps split:option.splits)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1809
apply (case_tac "fa \<in> same_inode_files s f")
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1810
apply (rule disjI1, simp add:co2sobj.simps cf2sfiles_linkhard tainted_eq_Tainted 
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1811
  same_inodes_Tainted split:if_splits)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1812
apply (simp, rule disjI2, rule conjI, rule_tac x = obj in exI, simp add:co2sobj_linkhard is_file_simps)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1813
apply (erule_tac x = fa in allE, rule notI)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1814
apply (simp add:co2sobj_linkhard is_file_simps)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1815
apply (simp add:co2sobj.simps tainted_eq_Tainted)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1816
apply (rule disjI2, simp, rule conjI, rule_tac x = obj in exI, simp add:co2sobj_linkhard)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1817
apply (rule notI, simp add:co2sobj.simps split:option.splits)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1818
apply (rule disjI2, simp, rule conjI, rule_tac x = obj in exI, simp add:co2sobj_linkhard is_dir_simps)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1819
apply (rule notI, simp add:co2sobj.simps split:option.splits)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1820
apply (rule disjI2, simp, rule conjI, rule_tac x = obj in exI, simp add:co2sobj_linkhard)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1821
apply (rule notI, simp add:co2sobj.simps split:option.splits)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1822
apply (tactic {*my_setiff_tac 1*})
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1823
apply (rule_tac x = "O_file f" in exI)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1824
apply (frule_tac obj = "O_file f" in co2sobj_linkhard)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1825
apply (simp add:alive_linkhard)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1826
apply (simp add:alive_linkhard same_inode_files_prop9 split:t_object.splits)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1827
apply (tactic {*my_setiff_tac 1*})
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1828
apply (case_tac "obj = O_file f'", simp add:alive_linkhard is_file_in_current)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1829
apply (erule_tac obj = obj in co2sobj_some_caseD)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1830
apply (rule_tac x = obj in exI, simp add:co2sobj_linkhard alive_linkhard)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1831
apply (case_tac "fa \<in> same_inode_files s f")
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1832
apply (simp add:co2sobj.simps cf2sfiles_prop tainted_eq_Tainted same_inodes_Tainted)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1833
apply (rule_tac x = obj in exI, simp add:co2sobj_linkhard alive_linkhard)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1834
apply (rule_tac x = obj in exI, simp add:co2sobj_linkhard alive_linkhard)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1835
apply (rule_tac x = obj in exI, simp add:co2sobj_linkhard alive_linkhard)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1836
apply (rule_tac x = obj in exI, simp add:co2sobj_linkhard alive_linkhard)
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1837
done
47
0960686df575 bug in s2ss_del_sfile
chunhan
parents: 46
diff changeset
  1838
53
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1839
lemma has_same_inode_prop3:
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1840
  "is_file s f \<Longrightarrow> has_same_inode s f f"
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1841
by (auto simp:is_file_def has_same_inode_def split:option.splits)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1842
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1843
definition update_s2ss_sfile_tainted:: "t_state \<Rightarrow> t_static_state \<Rightarrow> t_file \<Rightarrow> bool \<Rightarrow> t_static_state"
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1844
where
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1845
 "update_s2ss_sfile_tainted s ss f tag \<equiv>
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1846
    if (\<exists> f'. is_file s f' \<and> f' \<notin> same_inode_files s f \<and> 
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1847
              co2sobj s (O_file f') = Some (S_file (cf2sfiles s f) False))
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1848
       then ss \<union> {S_file (cf2sfiles s f) True}
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1849
       else ss - {S_file (cf2sfiles s f) False} 
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1850
               \<union> {S_file (cf2sfiles s f) True}"
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1851
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1852
lemma s2ss_truncate: "valid (Truncate p f len # s) \<Longrightarrow> s2ss (Truncate p f len # s) = (
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1853
  if (O_file f \<notin> Tainted s \<and> O_proc p \<in> Tainted s \<and> len > 0)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1854
  then update_s2ss_sfile_tainted s (s2ss s) f True
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1855
  else s2ss s)"
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1856
apply (frule vt_grant_os, frule vd_cons, simp split:if_splits)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1857
apply (rule conjI, rule impI, (erule conjE)+)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1858
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1859
apply (simp add:update_s2ss_sfile_tainted_def)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1860
apply (rule conjI|rule impI|erule exE|erule conjE)+
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1861
apply (simp add:s2ss_def)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1862
apply (tactic {*my_seteq_tac 1*})
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1863
apply (case_tac "obj = O_file f")
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1864
apply (rule disjI1, simp add:co2sobj.simps tainted_eq_Tainted has_same_inode_prop3 cf2sfiles_other)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1865
apply (erule_tac obj = obj in co2sobj_some_caseD)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1866
apply (rule disjI2, simp, rule_tac x = obj in exI, simp add:co2sobj_truncate alive_simps)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1867
apply (case_tac "fa \<in> same_inode_files s f")
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1868
apply (rule disjI1, simp add:co2sobj.simps tainted_eq_Tainted cf2sfiles_prop cf2sfiles_other)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1869
apply (simp add:same_inode_files_prop7)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1870
apply (rule disjI2, simp, rule_tac x = obj in exI)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1871
apply (simp add:co2sobj_truncate is_file_simps)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1872
apply (rule disjI2, simp, rule_tac x = obj in exI)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1873
apply (simp add:co2sobj_truncate)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1874
apply (rule disjI2, simp, rule_tac x = obj in exI)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1875
apply (simp add:co2sobj_truncate is_dir_simps)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1876
apply (rule disjI2, simp, rule_tac x = obj in exI)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1877
apply (simp add:co2sobj_truncate)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1878
apply (tactic {*my_setiff_tac 1*})
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1879
apply (rule_tac x = "O_file f" in exI)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1880
apply (simp add:co2sobj.simps is_file_simps tainted_eq_Tainted cf2sfiles_other has_same_inode_prop3)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1881
apply (tactic {*my_setiff_tac 1*})
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1882
apply (erule_tac obj = obj in co2sobj_some_caseD)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1883
apply (rule_tac x = obj in exI, simp add:co2sobj_truncate)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1884
apply (case_tac "fa \<in> same_inode_files s f")
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1885
apply (rule_tac x = "O_file f'" in exI)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1886
apply (auto simp:co2sobj_truncate is_file_simps is_dir_simps split:t_object.splits)[1]
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1887
apply (simp add:co2sobj.simps same_inodes_Tainted tainted_eq_Tainted cf2sfiles_prop)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1888
apply (rule_tac x = obj in exI, simp add:co2sobj_truncate is_file_simps)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1889
apply (rule_tac x = obj in exI, simp add:co2sobj_truncate)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1890
apply (rule_tac x = obj in exI, simp add:co2sobj_truncate is_dir_simps)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1891
apply (rule_tac x = obj in exI, simp add:co2sobj_truncate)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1892
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1893
apply (rule conjI|rule impI|erule exE|erule conjE)+
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1894
apply (simp add:s2ss_def)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1895
apply (tactic {*my_seteq_tac 1*})
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1896
apply (case_tac "obj = O_file f")
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1897
apply (rule disjI1, simp add:co2sobj.simps tainted_eq_Tainted has_same_inode_prop3 cf2sfiles_other)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1898
apply (erule_tac obj = obj in co2sobj_some_caseD)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1899
apply (rule disjI2, simp, rule conjI, rule_tac x = obj in exI, simp add:co2sobj_truncate alive_simps)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1900
apply (rule notI, simp add:co2sobj.simps split:option.splits)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1901
apply (case_tac "fa \<in> same_inode_files s f")
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1902
apply (rule disjI1, simp add:co2sobj.simps tainted_eq_Tainted cf2sfiles_prop cf2sfiles_other)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1903
apply (simp add:same_inode_files_prop7)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1904
apply (rule disjI2, simp, rule conjI, rule_tac x = obj in exI)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1905
apply (simp add:co2sobj_truncate is_file_simps)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1906
apply (rule notI, simp add:co2sobj_truncate is_file_simps)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1907
apply (erule_tac x = fa in allE)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1908
apply (simp add:co2sobj.simps)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1909
apply (rule disjI2, simp, rule conjI, rule_tac x = obj in exI)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1910
apply (simp add:co2sobj_truncate)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1911
apply (rule notI, simp add:co2sobj.simps split:option.splits)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1912
apply (rule disjI2, simp, rule conjI, rule_tac x = obj in exI)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1913
apply (simp add:co2sobj_truncate is_dir_simps)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1914
apply (rule notI, simp add:co2sobj.simps split:option.splits)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1915
apply (rule disjI2, simp, rule conjI, rule_tac x = obj in exI)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1916
apply (simp add:co2sobj_truncate)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1917
apply (rule notI, simp add:co2sobj.simps split:option.splits)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1918
apply (tactic {*my_setiff_tac 1*})
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1919
apply (rule_tac x = "O_file f" in exI)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1920
apply (simp add:co2sobj.simps is_file_simps tainted_eq_Tainted cf2sfiles_other has_same_inode_prop3)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1921
apply (tactic {*my_setiff_tac 1*})
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1922
apply (erule_tac obj = obj in co2sobj_some_caseD)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1923
apply (rule_tac x = obj in exI, simp add:co2sobj_truncate)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1924
apply (case_tac "fa \<in> same_inode_files s f")
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1925
apply (simp add:co2sobj.simps same_inodes_Tainted tainted_eq_Tainted cf2sfiles_prop)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1926
apply (rule_tac x = obj in exI, simp add:co2sobj_truncate is_file_simps)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1927
apply (rule_tac x = obj in exI, simp add:co2sobj_truncate)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1928
apply (rule_tac x = obj in exI, simp add:co2sobj_truncate is_dir_simps)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1929
apply (rule_tac x = obj in exI, simp add:co2sobj_truncate)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1930
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1931
apply (rule impI, simp add:s2ss_def)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1932
apply (tactic {*my_seteq_tac 1*})
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1933
apply (rule_tac x = obj in exI)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1934
apply (simp add:alive_simps co2sobj_truncate)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1935
apply (simp split:t_object.splits if_splits add:co2sobj.simps tainted_eq_Tainted)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1936
apply (case_tac "O_proc p \<in> Tainted s", simp add:same_inodes_Tainted)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1937
apply simp
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1938
apply (tactic {*my_setiff_tac 1*})
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1939
apply (rule_tac x = obj in exI)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1940
apply (simp add:alive_simps co2sobj_truncate)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1941
apply (auto split:t_object.splits if_splits simp:co2sobj.simps tainted_eq_Tainted same_inodes_Tainted)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1942
done
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1943
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1944
lemma s2ss_createmsgq: "valid (CreateMsgq p q # s) \<Longrightarrow> s2ss (CreateMsgq p q # s) = 
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1945
  (case (cq2smsgq (CreateMsgq p q # s) q) of 
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1946
     Some sq \<Rightarrow> s2ss s \<union> {S_msgq sq}
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1947
   | _       \<Rightarrow> {})"
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1948
apply (frule vd_cons, frule vt_grant_os, clarsimp)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1949
apply (case_tac "cq2smsgq (CreateMsgq p q # s) q")
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1950
apply (drule current_has_smsgq', simp+)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1951
apply (simp add:s2ss_def)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1952
apply (tactic {*my_seteq_tac 1*})
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1953
apply (case_tac "obj = O_msgq q")
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1954
apply (rule disjI1, simp add:co2sobj.simps)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1955
apply (rule disjI2, simp, rule_tac x = obj in exI)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1956
apply (simp add:co2sobj_createmsgq is_file_simps is_dir_simps split:t_object.splits if_splits)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1957
apply (simp add:co2sobj.simps)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1958
apply (simp add:co2sobj.simps)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1959
apply (tactic {*my_setiff_tac 1*})
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1960
apply (rule_tac x = "O_msgq q" in exI, simp add:co2sobj.simps)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1961
apply (tactic {*my_setiff_tac 1*})
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1962
apply (case_tac "obj = O_msgq q")
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1963
apply simp
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1964
apply (rule_tac x = obj in exI)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1965
apply (auto simp add:co2sobj_createmsgq alive_simps split:t_object.splits if_splits)
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1966
done
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1967
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1968
lemma s2ss_sendmsg:
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1969
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1970
lemma s2ss_recvmsg:
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1971
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1972
lemma s2ss_removemsgq:
41
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
  1973
43
chunhan
parents: 42
diff changeset
  1974
lemmas s2ss_simps = s2ss_execve s2ss_clone s2ss_ptrace s2ss_kill s2ss_exit s2ss_open
52
ec73b98d4a64 s2ss_linkhard
chunhan
parents: 51
diff changeset
  1975
  s2ss_readfile s2ss_writefile s2ss_closefd s2ss_unlink s2ss_rmdir s2ss_linkhard
53
e3ad1b294fd9 s2ss_truncate s2ss_createmsgq
chunhan
parents: 52
diff changeset
  1976
  s2ss_truncate s2ss_createmsgq 
35
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
  1977