S2ss_prop2.thy
author chunhan
Tue, 15 Oct 2013 14:11:53 +0800
changeset 58 20207806603e
child 59 89770d3c8a9b
permissions -rw-r--r--
s2ss_deleteshm s2ss_detach
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
58
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
     1
(*<*)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
     2
theory S2ss_prop2
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
     3
imports Main Flask Flask_type Static Static_type Init_prop Tainted_prop Valid_prop Alive_prop Co2sobj_prop S2ss_prop
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
     4
begin
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
     5
(*>*)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
     6
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
     7
context tainting_s begin
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
     8
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
     9
definition unbackuped_sprocs :: "t_state \<Rightarrow> t_event \<Rightarrow> t_process set \<Rightarrow> t_sobject set"
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    10
where
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    11
  "unbackuped_sprocs s e procs \<equiv> 
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    12
    {sp | p sp. p \<in> procs \<and> co2sobj s (O_proc p) = Some sp \<and> 
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    13
                (\<forall> p' \<in> procs. co2sobj (e # s) (O_proc p') \<noteq> Some sp) \<and>
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    14
                (\<forall> p' \<in> (current_procs s - procs). co2sobj s (O_proc p') \<noteq> Some sp)}"
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    15
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    16
definition update_s2ss_procs :: "t_state \<Rightarrow> t_static_state \<Rightarrow> t_event \<Rightarrow> t_process set \<Rightarrow> t_static_state"
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    17
where
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    18
  "update_s2ss_procs s ss e procs \<equiv> 
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    19
     ss \<union> {sp | p sp. p \<in> procs \<and> co2sobj (e # s) (O_proc p) = Some sp}
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    20
        - unbackuped_sprocs s e procs"
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    21
 (* new sp after event may exists as same before the event in procs *)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    22
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    23
lemma unbked_sps_D:
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    24
  "\<lbrakk>x \<in> unbackuped_sprocs s e procs; p \<in> procs\<rbrakk> \<Longrightarrow> co2sobj (e # s) (O_proc p) \<noteq> Some x"
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    25
by (auto simp add:unbackuped_sprocs_def)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    26
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    27
lemma unbked_sps_D':
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    28
  "\<lbrakk>x \<in> unbackuped_sprocs s e procs; p \<notin> procs; p \<in> current_procs s; 
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    29
    co2sobj (e # s) (O_proc p) = co2sobj s (O_proc p)\<rbrakk>
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    30
   \<Longrightarrow> co2sobj (e # s) (O_proc p) \<noteq> Some x"
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    31
by (auto simp:unbackuped_sprocs_def)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    32
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    33
lemma not_unbked_sps_D:
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    34
  "\<lbrakk>x \<notin> unbackuped_sprocs s e procs; p \<in> procs; co2sobj s (O_proc p) = Some x\<rbrakk> 
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    35
   \<Longrightarrow> (\<exists> p' \<in> procs. co2sobj (e # s) (O_proc p') = Some x) \<or>
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    36
       (\<exists> p' \<in> current_procs s - procs. co2sobj s (O_proc p') = Some x)"
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    37
by (auto simp:unbackuped_sprocs_def)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    38
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    39
lemma unbked_sps_I:
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    40
  "\<lbrakk>co2sobj s obj = Some x; \<forall> p. obj \<noteq> O_proc p\<rbrakk> \<Longrightarrow> x \<notin> unbackuped_sprocs s' e procs"
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    41
apply (case_tac obj)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    42
apply (auto simp add:unbackuped_sprocs_def co2sobj.simps split:option.splits)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    43
done
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    44
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    45
lemma co2sobj_proc_deleteshm:
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    46
  "\<lbrakk>valid (DeleteShM p h # s); \<forall>flag. (pa, flag) \<notin> procs_of_shm s h; pa \<in> current_procs s\<rbrakk>
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    47
   \<Longrightarrow> co2sobj (DeleteShM p h # s) (O_proc pa) = co2sobj s (O_proc pa)"
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    48
thm co2sobj_deleteshm
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    49
apply (frule_tac obj = "O_proc pa" in co2sobj_deleteshm, simp)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    50
apply (frule vd_cons, frule_tac p = pa in current_proc_has_sp, simp, erule exE)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    51
apply (auto dest!:current_proc_has_sp' current_has_sec' current_shm_has_sh'
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    52
  split:t_object.splits option.splits if_splits dest:flag_of_proc_shm_prop1
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    53
  simp:co2sobj.simps tainted_eq_Tainted cp2sproc_deleteshm)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    54
done
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    55
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    56
lemma s2ss_deleteshm:
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    57
  "valid (DeleteShM p h # s) \<Longrightarrow> s2ss (DeleteShM p h # s) = 
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    58
     (case ch2sshm s h of
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    59
        Some sh \<Rightarrow> del_s2ss_obj s 
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    60
                      (update_s2ss_procs s (s2ss s) (DeleteShM p h) {p'| p' flag. (p', flag) \<in> procs_of_shm s h})
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    61
                      (O_shm h) (S_shm sh)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    62
      | _       \<Rightarrow> {})"
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    63
apply (frule vt_grant_os, frule vd_cons)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    64
apply (case_tac "ch2sshm s h")
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    65
apply (drule current_shm_has_sh', simp, simp)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    66
apply (simp add:del_s2ss_obj_def)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    67
apply (tactic {*my_clarify_tac 1*})
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    68
 
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    69
unfolding update_s2ss_procs_def
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    70
apply (tactic {*my_seteq_tac 1*})
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    71
apply (erule_tac obj = obj in co2sobj_some_caseD)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    72
apply (case_tac "\<exists> flag. (pa, flag) \<in> procs_of_shm s h")
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    73
apply (erule exE, rule DiffI, rule UnI2, simp)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    74
apply (rule_tac x = pa in exI, simp, rule_tac x = flag in exI, simp)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    75
apply (rule notI, drule_tac p = pa in unbked_sps_D, simp)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    76
apply (rule_tac x = flag in exI, simp, simp)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    77
apply (rule DiffI, rule UnI1, simp)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    78
apply (rule_tac x = obj in exI, simp add:co2sobj_deleteshm split:option.splits)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    79
apply (simp add:cp2sproc_deleteshm split:option.splits if_splits)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    80
apply (simp add:co2sobj.simps tainted_eq_Tainted)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    81
apply (drule current_has_sec', simp, simp)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    82
apply (simp add:co2sobj.simps tainted_eq_Tainted)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    83
apply (drule flag_of_proc_shm_prop1, simp, simp)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    84
apply (drule flag_of_proc_shm_prop1, simp, simp)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    85
apply (rule notI, drule_tac p = pa in unbked_sps_D', simp+)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    86
apply (simp add:co2sobj_proc_deleteshm)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    87
apply (simp add:co2sobj_proc_deleteshm)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    88
apply (rule DiffI, rule UnI1, simp, rule_tac x = obj in exI, simp add:co2sobj_deleteshm is_file_simps)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    89
apply (erule unbked_sps_I, simp)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    90
apply (rule DiffI,rule UnI1, simp, rule_tac x = obj in exI, simp add:co2sobj_deleteshm)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    91
apply (erule unbked_sps_I, simp)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    92
apply (rule DiffI, rule UnI1, simp, rule_tac x = obj in exI, simp add:co2sobj_deleteshm is_dir_simps)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    93
apply (erule unbked_sps_I, simp)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    94
apply (rule DiffI, rule UnI1, simp, rule_tac x = obj in exI, simp add:co2sobj_deleteshm)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    95
apply (erule unbked_sps_I, simp)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    96
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    97
apply (erule DiffE, erule UnE)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    98
apply (tactic {*my_setiff_tac 1*})
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
    99
apply (erule_tac obj = obj in co2sobj_some_caseD)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   100
apply (case_tac "\<exists> flag. (pa, flag) \<in> procs_of_shm s h", erule exE)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   101
apply (drule_tac p = pa in not_unbked_sps_D, simp)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   102
apply (rule_tac x = flag in exI, simp)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   103
apply (simp, erule disjE, clarsimp)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   104
apply (rule_tac x = "O_proc p'" in exI, simp add:procs_of_shm_prop2)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   105
apply (erule bexE, simp, (erule conjE)+)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   106
apply (frule_tac pa = p' in co2sobj_proc_deleteshm, simp+)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   107
apply (rule_tac x = "O_proc p'" in exI, simp)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   108
apply (frule_tac pa = pa in co2sobj_proc_deleteshm, simp+)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   109
apply (rule_tac x = "O_proc pa" in exI, simp)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   110
apply (rule_tac x = obj in exI, simp add:co2sobj_deleteshm is_file_simps)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   111
apply (frule_tac co2sobj_sshm_imp, erule exE)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   112
apply (case_tac "ha = h")
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   113
apply (rule_tac x = obj' in exI, simp add:co2sobj_deleteshm)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   114
apply (simp add:co2sobj.simps)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   115
apply (rule_tac x = obj in exI, simp add:co2sobj_deleteshm)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   116
apply (rule_tac x = obj in exI, simp add:co2sobj_deleteshm is_dir_simps)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   117
apply (rule_tac x = obj in exI, simp add:co2sobj_deleteshm)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   118
apply (tactic {*my_setiff_tac 1*}, clarsimp)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   119
apply (rule_tac x = "O_proc pa" in exI, simp add:procs_of_shm_prop2)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   120
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   121
apply (tactic {*my_clarify_tac 1*})
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   122
unfolding update_s2ss_procs_def
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   123
apply (tactic {*my_seteq_tac 1*})
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   124
apply (erule_tac obj = obj in co2sobj_some_caseD)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   125
apply (case_tac "\<exists> flag. (pa, flag) \<in> procs_of_shm s h")
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   126
apply (erule exE, rule DiffI, rule DiffI, rule UnI2, simp)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   127
apply (rule_tac x = pa in exI, simp, rule_tac x = flag in exI, simp)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   128
apply (rule notI, drule_tac p = pa in unbked_sps_D, simp)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   129
apply (rule_tac x = flag in exI, simp, simp)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   130
apply (rule notI, simp add:co2sobj.simps split:option.splits)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   131
apply (rule DiffI, rule DiffI, rule UnI1, simp)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   132
apply (rule_tac x = obj in exI, simp add:co2sobj_deleteshm split:option.splits)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   133
apply (simp add:cp2sproc_deleteshm split:option.splits if_splits)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   134
apply (simp add:co2sobj.simps tainted_eq_Tainted)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   135
apply (drule current_has_sec', simp, simp)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   136
apply (simp add:co2sobj.simps tainted_eq_Tainted)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   137
apply (drule flag_of_proc_shm_prop1, simp, simp)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   138
apply (drule flag_of_proc_shm_prop1, simp, simp)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   139
apply (rule notI, drule_tac p = pa in unbked_sps_D', simp+)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   140
apply (simp add:co2sobj_proc_deleteshm)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   141
apply (simp add:co2sobj_proc_deleteshm)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   142
apply (rule notI, simp add:co2sobj.simps split:option.splits)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   143
apply (rule DiffI, rule DiffI, rule UnI1, simp, rule_tac x = obj in exI, simp add:co2sobj_deleteshm is_file_simps)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   144
apply (erule unbked_sps_I, simp, rule notI, simp add:co2sobj.simps)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   145
apply (case_tac "ha = h", simp)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   146
apply (rule DiffI, rule DiffI, rule UnI1, simp, rule_tac x = obj in exI, simp add:co2sobj_deleteshm)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   147
apply (erule unbked_sps_I, simp)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   148
apply (rule notI, simp add:co2sobj_deleteshm, erule_tac x = "O_shm ha" in allE, simp)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   149
apply (rule DiffI, rule DiffI, rule UnI1, simp, rule_tac x = obj in exI, simp add:co2sobj_deleteshm is_dir_simps)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   150
apply (erule unbked_sps_I, simp, rule notI, simp add:co2sobj.simps split:option.splits)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   151
apply (rule DiffI, rule DiffI, rule UnI1, simp, rule_tac x = obj in exI, simp add:co2sobj_deleteshm)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   152
apply (erule unbked_sps_I, simp, rule notI, simp add:co2sobj.simps split:option.splits)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   153
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   154
apply (erule DiffE, erule DiffE, erule UnE)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   155
apply (tactic {*my_setiff_tac 1*})
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   156
apply (erule_tac obj = obj in co2sobj_some_caseD)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   157
apply (case_tac "\<exists> flag. (pa, flag) \<in> procs_of_shm s h", erule exE)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   158
apply (drule_tac p = pa in not_unbked_sps_D, simp)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   159
apply (rule_tac x = flag in exI, simp)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   160
apply (simp, erule disjE, clarsimp)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   161
apply (rule_tac x = "O_proc p'" in exI, simp add:procs_of_shm_prop2)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   162
apply (erule bexE, simp, (erule conjE)+)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   163
apply (frule_tac pa = p' in co2sobj_proc_deleteshm, simp+)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   164
apply (rule_tac x = "O_proc p'" in exI, simp)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   165
apply (frule_tac pa = pa in co2sobj_proc_deleteshm, simp+)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   166
apply (rule_tac x = "O_proc pa" in exI, simp)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   167
apply (rule_tac x = obj in exI, simp add:co2sobj_deleteshm is_file_simps)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   168
apply (case_tac "ha = h", simp add:co2sobj.simps)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   169
apply (rule_tac x = obj in exI, simp add:co2sobj_deleteshm)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   170
apply (rule_tac x = obj in exI, simp add:co2sobj_deleteshm is_dir_simps)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   171
apply (rule_tac x = obj in exI, simp add:co2sobj_deleteshm)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   172
apply (tactic {*my_setiff_tac 1*}, clarsimp)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   173
apply (rule_tac x = "O_proc pa" in exI, simp add:procs_of_shm_prop2)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   174
done
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   175
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   176
lemma s2ss_detach:
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   177
  "valid (Detach p h # s) \<Longrightarrow> s2ss (Detach p h # s) = (
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   178
     case (cp2sproc s p, cp2sproc (Detach p h # s) p) of 
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   179
       (Some sp, Some sp') \<Rightarrow> update_s2ss_obj s (s2ss s) (O_proc p) 
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   180
           (S_proc sp (O_proc p \<in> Tainted s)) (S_proc sp' (O_proc p \<in> Tainted s))
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   181
     | _ \<Rightarrow> {} )"
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   182
apply (frule vd_cons, frule vt_grant_os)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   183
apply (case_tac "cp2sproc s p")
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   184
apply (drule current_proc_has_sp', simp+)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   185
apply (case_tac "cp2sproc (Detach p h # s) p")
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   186
apply (drule current_proc_has_sp', simp+)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   187
apply (erule exE|erule conjE)+
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   188
apply (simp add:update_s2ss_obj_def)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   189
apply (tactic {*my_clarify_tac 1*})
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   190
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   191
apply (tactic {*my_seteq_tac 1*})
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   192
apply (case_tac "obj = O_proc p")
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   193
apply (rule disjI1, simp add:co2sobj.simps tainted_eq_Tainted)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   194
apply (rule disjI2, simp, rule_tac x = obj in exI)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   195
apply (frule_tac obj = obj in co2sobj_detach, simp add:alive_simps)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   196
apply (simp add:is_file_simps is_dir_simps split:t_object.splits)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   197
apply (simp add:co2sobj.simps, simp add:co2sobj.simps)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   198
apply (tactic {*my_setiff_tac 1*})
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   199
apply (rule_tac x = "O_proc p" in exI, simp add:co2sobj.simps tainted_eq_Tainted)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   200
apply (tactic {*my_setiff_tac 1*})
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   201
apply (case_tac "obj = O_proc p")
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   202
apply (rule_tac x = obj' in exI)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   203
apply (frule_tac obj = obj' in co2sobj_detach, simp)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   204
apply (auto simp add:co2sobj.simps tainted_eq_Tainted is_file_simps is_dir_simps split:t_object.splits)[1]
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   205
apply (rule_tac x = obj in exI)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   206
apply (simp add:co2sobj_detach)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   207
apply (auto simp add:co2sobj.simps tainted_eq_Tainted is_file_simps is_dir_simps split:t_object.splits)[1]
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   208
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   209
apply (tactic {*my_clarify_tac 1*})
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   210
apply (tactic {*my_seteq_tac 1*})
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   211
apply (case_tac "obj = O_proc p")
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   212
apply (rule disjI1, simp add:co2sobj.simps tainted_eq_Tainted)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   213
apply (rule disjI2, rule DiffI, simp, rule_tac x = obj in exI)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   214
apply (frule_tac obj = obj in co2sobj_detach, simp add:alive_simps)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   215
apply (simp add:is_file_simps is_dir_simps split:t_object.splits)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   216
apply (simp add:co2sobj.simps, simp add:co2sobj.simps)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   217
apply (rule notI, simp, erule_tac x = obj in allE, erule impE, simp add:alive_simps, simp)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   218
apply (frule_tac obj = obj in co2sobj_detach)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   219
apply (simp add:alive_simps)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   220
apply (simp split:t_object.splits)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   221
apply (tactic {*my_setiff_tac 1*})
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   222
apply (rule_tac x = "O_proc p" in exI, simp add:co2sobj.simps tainted_eq_Tainted)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   223
apply (tactic {*my_setiff_tac 1*}, simp)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   224
apply (case_tac "obj = O_proc p")
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   225
apply (simp add:co2sobj.simps tainted_eq_Tainted)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   226
apply (rule_tac x = obj in exI)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   227
apply (simp add:co2sobj_detach)
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   228
apply (auto simp add:co2sobj.simps tainted_eq_Tainted is_file_simps is_dir_simps split:t_object.splits)[1]
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   229
done
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   230
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   231
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   232
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   233
lemma s2ss_attach1:
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   234
  "\<lbrakk>valid (Attach p h SHM_RDWR # s); O_proc p \<in> Tainted s\<rbrakk>\<Longrightarrow> s2ss (Attach p h SHM_RDWR # s) = (
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   235
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   236
     "
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   237
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   238
lemma s2ss_attach1:
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   239
  "\<lbrakk>valid (Attach p h flag # s); O_proc p \<notin> Tainted s; (p', SHM_RDWR) \<in> procs_of_shm s; O_proc p' \<in> Tainted s\<rbrakk>
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   240
   \<Longrightarrow> s2ss (Attach p h SHM_RDONLY # s) = "
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   241
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   242
lemma s2ss_attach1:
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   243
  "valid (Attach p h flag # s) \<Longrightarrow> s2ss (Attach p h flag # s) = "
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   244
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   245
lemma s2ss_Detach:
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   246
  "valid (Detach p h # s) \<Longrightarrow> s2ss (Detach p h # s) = "
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   247
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   248
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   249
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   250
lemmas s2ss_simps = s2ss_execve s2ss_clone s2ss_ptrace s2ss_kill s2ss_exit s2ss_open
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   251
  s2ss_readfile s2ss_writefile s2ss_closefd s2ss_unlink s2ss_rmdir s2ss_linkhard
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   252
  s2ss_truncate s2ss_createmsgq s2ss_sendmsg s2ss_removemsgq s2ss_recvmsg
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   253
  s2ss_createshm
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   254
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   255
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   256
end
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   257
20207806603e s2ss_deleteshm s2ss_detach
chunhan
parents:
diff changeset
   258
end