Current_prop.thy
author chunhan
Thu, 01 Aug 2013 12:19:42 +0800
changeset 29 622516c0fe34
parent 28 e298d755bc35
child 30 01274a64aece
permissions -rw-r--r--
path_by_shm reconstrain path without duplicated process AND shm
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
19
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
     1
(*<*)
18
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
     2
theory Current_prop
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
     3
imports Main Flask_type Flask My_list_prefix Init_prop Valid_prop Delete_prop
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
     4
begin
19
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
     5
(*>*)
18
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
     6
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
     7
ML {*quick_and_dirty := true*}
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
     8
18
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
     9
context flask begin
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    10
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    11
lemma procs_of_shm_prop1: "\<lbrakk> p_flag \<in> procs_of_shm s h; valid s\<rbrakk> \<Longrightarrow> h \<in> current_shms s"
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    12
apply (induct s arbitrary:p_flag)
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    13
apply (case_tac p_flag, simp, drule init_procs_has_shm, simp)
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    14
apply (frule vd_cons, frule vt_grant_os)
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    15
apply (case_tac a, auto split:if_splits option.splits)
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    16
done
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    17
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    18
lemma procs_of_shm_prop2: "\<lbrakk>(p, flag) \<in> procs_of_shm s h; valid s\<rbrakk> \<Longrightarrow> p \<in> current_procs s"
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    19
apply (induct s arbitrary:p flag)
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    20
apply (simp, drule init_procs_has_shm, simp)
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    21
apply (frule vd_cons, frule vt_grant_os)
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    22
apply (case_tac a, auto split:if_splits option.splits)
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    23
done
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    24
26
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
    25
lemma procs_of_shm_prop2':
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
    26
  "\<lbrakk>p \<notin> current_procs s; valid s\<rbrakk> \<Longrightarrow> \<forall> flag h. (p, flag) \<notin> procs_of_shm s h"
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
    27
by (auto dest:procs_of_shm_prop2)
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
    28
18
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    29
lemma procs_of_shm_prop3: "\<lbrakk>(p, flag) \<in> procs_of_shm s h; (p, flag') \<in> procs_of_shm s h; valid s\<rbrakk>
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    30
  \<Longrightarrow> flag = flag'"
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    31
apply (induct s arbitrary:p flag flag')
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    32
apply (simp, drule_tac flag = flag in init_procs_has_shm, drule_tac flag = flag' in init_procs_has_shm, simp)
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    33
apply (frule vd_cons, frule vt_grant_os)
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    34
apply (case_tac a, auto split:if_splits option.splits dest:procs_of_shm_prop2)
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    35
done
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    36
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    37
lemma procs_of_shm_prop4: "\<lbrakk>(p, flag) \<in> procs_of_shm s h; valid s\<rbrakk> \<Longrightarrow> flag_of_proc_shm s p h = Some flag"
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    38
apply (induct s arbitrary:p flag)
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    39
apply (simp, drule init_procs_has_shm, simp)
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    40
apply (frule vd_cons, frule vt_grant_os)
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    41
apply (case_tac a, auto split:if_splits option.splits dest:procs_of_shm_prop2)
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    42
done
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    43
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    44
lemma procs_of_shm_prop4':
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    45
  "\<lbrakk>flag_of_proc_shm s p h = None; valid s\<rbrakk> \<Longrightarrow> \<forall> flag. (p, flag) \<notin> procs_of_shm s h"
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    46
by (auto dest:procs_of_shm_prop4)
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    47
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    48
lemma not_init_intro_proc:
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    49
  "\<lbrakk>p \<notin> current_procs s; valid s\<rbrakk> \<Longrightarrow> deleted (O_proc p) s \<or> p \<notin> init_procs"
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    50
using not_deleted_init_proc by auto
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    51
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    52
lemma not_init_intro_proc':
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    53
  "\<lbrakk>p \<notin> current_procs s; valid s\<rbrakk> \<Longrightarrow> \<not> (\<not> deleted (O_proc p) s \<and> p \<in> init_procs)"
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    54
using not_deleted_init_proc by auto
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    55
23
25e55731ed01 locale of tainting for seeds when same shm/inode bugs
chunhan
parents: 19
diff changeset
    56
lemma info_shm_flow_in_procs:
25e55731ed01 locale of tainting for seeds when same shm/inode bugs
chunhan
parents: 19
diff changeset
    57
  "\<lbrakk>info_flow_shm s p p'; valid s\<rbrakk> \<Longrightarrow> p \<in> current_procs s \<and> p' \<in> current_procs s"
26
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
    58
by (auto intro:procs_of_shm_prop2 simp:info_flow_shm_def one_flow_shm_def)
25
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
    59
27
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    60
lemma flag_of_proc_shm_prop1:
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    61
  "\<lbrakk>flag_of_proc_shm s p h = Some flag; valid s\<rbrakk> \<Longrightarrow> (p, flag) \<in> procs_of_shm s h"
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    62
apply (induct s arbitrary:p flag)
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    63
apply (simp, drule init_shmflag_has_proc, simp)
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    64
apply (frule vd_cons, frule vt_grant_os)
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    65
apply (case_tac a, auto split:if_splits option.splits dest:procs_of_shm_prop2)
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    66
done
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    67
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    68
(*********** simpset for one_flow_shm **************)
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    69
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    70
lemma one_flow_not_self:
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    71
  "one_flow_shm s h p p \<Longrightarrow> False"
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    72
by (simp add:one_flow_shm_def)
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    73
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    74
lemma one_flow_shm_attach:
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    75
  "valid (Attach p h flag # s) \<Longrightarrow> one_flow_shm (Attach p h flag # s) = (\<lambda> h' pa pb. 
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    76
     if (h' = h) 
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    77
     then (pa = p \<and> pb \<noteq> p \<and> flag = SHM_RDWR \<and> (\<exists> flagb. (pb, flagb) \<in> procs_of_shm s h)) \<or>
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    78
          (pb = p \<and> pa \<noteq> p \<and> (pa, SHM_RDWR) \<in> procs_of_shm s h) \<or>
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    79
          (one_flow_shm s h pa pb)               
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    80
     else one_flow_shm s h' pa pb        )"
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    81
apply (rule ext, rule ext, rule ext, frule vd_cons, frule vt_grant_os)
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    82
by (auto simp add: one_flow_shm_def)
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    83
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    84
lemma one_flow_shm_detach:
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    85
  "valid (Detach p h # s) \<Longrightarrow> one_flow_shm (Detach p h # s) = (\<lambda> h' pa pb.
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    86
     if (h' = h) 
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    87
     then (pa \<noteq> p \<and> pb \<noteq> p \<and> one_flow_shm s h' pa pb)
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    88
     else one_flow_shm s h' pa pb)"
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    89
apply (rule ext, rule ext, rule ext, frule vt_grant_os)
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    90
by (auto simp:one_flow_shm_def)
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    91
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    92
lemma one_flow_shm_deleteshm:
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    93
  "valid (DeleteShM p h # s) \<Longrightarrow> one_flow_shm (DeleteShM p h # s) = (\<lambda> h' pa pb. 
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    94
     if (h' = h) 
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    95
     then False
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    96
     else one_flow_shm s h' pa pb)"
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    97
apply (rule ext, rule ext, rule ext, frule vt_grant_os)
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    98
by (auto simp: one_flow_shm_def)
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    99
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   100
lemma one_flow_shm_clone:
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   101
  "valid (Clone p p' fds shms # s) \<Longrightarrow> one_flow_shm (Clone p p' fds shms # s) = (\<lambda> h pa pb. 
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   102
     if (pa = p' \<and> pb \<noteq> p' \<and> h \<in> shms)
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   103
     then (if (pb = p) then (flag_of_proc_shm s p h = Some SHM_RDWR) else one_flow_shm s h p pb)
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   104
     else if (pb = p' \<and> pa \<noteq> p' \<and> h \<in> shms)
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   105
          then (if (pa = p) then (flag_of_proc_shm s p h = Some SHM_RDWR) else one_flow_shm s h pa p)
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   106
          else one_flow_shm s h pa pb)"
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   107
apply (rule ext, rule ext, rule ext, frule vt_grant_os, frule vd_cons, clarsimp)
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   108
apply (frule_tac p = p' in procs_of_shm_prop2', simp)
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   109
apply (auto simp:one_flow_shm_def intro:procs_of_shm_prop4 flag_of_proc_shm_prop1)
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   110
done
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   111
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   112
lemma one_flow_shm_execve:
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   113
  "valid (Execve p f fds # s) \<Longrightarrow> one_flow_shm (Execve p f fds # s) = (\<lambda> h pa pb. 
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   114
     pa \<noteq> p \<and> pb \<noteq> p \<and> one_flow_shm s h pa pb    )"
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   115
apply (rule ext, rule ext, rule ext, frule vt_grant_os, frule vd_cons)
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   116
by (auto simp:one_flow_shm_def)
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   117
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   118
lemma one_flow_shm_kill:
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   119
  "valid (Kill p p' # s) \<Longrightarrow> one_flow_shm (Kill p p' # s) = (\<lambda> h pa pb. 
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   120
     pa \<noteq> p' \<and> pb \<noteq> p' \<and> one_flow_shm s h pa pb                 )"
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   121
apply (rule ext, rule ext, rule ext, frule vt_grant_os, frule vd_cons)
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   122
by (auto simp:one_flow_shm_def)
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   123
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   124
lemma one_flow_shm_exit:
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   125
  "valid (Exit p # s) \<Longrightarrow> one_flow_shm (Exit p # s) = (\<lambda> h pa pb. 
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   126
     pa \<noteq> p \<and> pb \<noteq> p \<and> one_flow_shm s h pa pb                          )"
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   127
apply (rule ext, rule ext, rule ext, frule vt_grant_os, frule vd_cons)
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   128
by (auto simp:one_flow_shm_def)
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   129
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   130
lemma one_flow_shm_other:
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   131
  "\<lbrakk>valid (e # s); 
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   132
    \<forall> p h flag. e \<noteq> Attach p h flag;
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   133
    \<forall> p h. e \<noteq> Detach p h;
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   134
    \<forall> p h. e \<noteq> DeleteShM p h;
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   135
    \<forall> p p' fds shms. e \<noteq> Clone p p' fds shms;
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   136
    \<forall> p f fds. e \<noteq> Execve p f fds;
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   137
    \<forall> p p'. e \<noteq> Kill p p';
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   138
    \<forall> p. e \<noteq> Exit p
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   139
   \<rbrakk> \<Longrightarrow> one_flow_shm (e # s) = one_flow_shm s"
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   140
apply (rule ext, rule ext, rule ext, frule vt_grant_os, frule vd_cons)
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   141
apply (case_tac e, auto simp:one_flow_shm_def dest:procs_of_shm_prop2)
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   142
apply (drule procs_of_shm_prop1, auto)
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   143
done
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   144
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   145
lemmas one_flow_shm_simps = one_flow_shm_other one_flow_shm_attach one_flow_shm_detach one_flow_shm_deleteshm
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   146
  one_flow_shm_clone one_flow_shm_execve one_flow_shm_kill one_flow_shm_exit
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   147
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   148
type_synonym t_edge_shm = "t_process \<times> t_shm \<times> t_process"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   149
fun Fst:: "t_edge_shm \<Rightarrow> t_process" where "Fst (a, b, c) = a"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   150
fun Snd:: "t_edge_shm \<Rightarrow> t_shm" where "Snd (a, b, c) = b"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   151
fun Trd:: "t_edge_shm \<Rightarrow> t_process" where "Trd (a, b, c) = c"
27
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   152
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   153
fun edge_related:: "t_edge_shm list \<Rightarrow> t_process \<Rightarrow> t_shm \<Rightarrow> bool"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   154
where
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   155
  "edge_related [] p h = False"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   156
| "edge_related ((from, shm, to) # path) p h = 
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   157
     (if (((p = from) \<or> (p = to)) \<and> (h = shm)) then True 
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   158
      else edge_related path p h)"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   159
         
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   160
inductive path_by_shm :: "t_state \<Rightarrow> t_process \<Rightarrow> t_edge_shm list \<Rightarrow> t_process \<Rightarrow> bool"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   161
where
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   162
  pbs1: "p \<in> current_procs s \<Longrightarrow> path_by_shm s p [] p"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   163
| pbs2: "\<lbrakk>path_by_shm s p path p'; one_flow_shm s h p' p''; p'' \<notin> set (map Fst path)\<rbrakk> 
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   164
         \<Longrightarrow> path_by_shm s p ((p', h, p'')# path) p''"
27
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   165
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   166
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   167
lemma one_step_path: "\<lbrakk>one_flow_shm s h p p'; valid s\<rbrakk> \<Longrightarrow> path_by_shm s p [(p, h, p')] p'"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   168
apply (rule_tac path = "[]" and p = p in path_by_shm.intros(2))
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   169
apply (rule path_by_shm.intros(1))
27
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   170
apply (auto intro:procs_of_shm_prop2 simp:one_flow_shm_def)
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   171
done
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   172
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   173
lemma pbs_prop1:
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   174
  "path_by_shm s p path p' \<Longrightarrow> ((path = []) = (p = p')) \<and> (path \<noteq> [] \<longrightarrow> p \<in> set (map Fst path))"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   175
apply (erule path_by_shm.induct, simp)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   176
apply (auto simp:one_flow_shm_def)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   177
done
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   178
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   179
lemma pbs_prop2:
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   180
  "path_by_shm s p path p' \<Longrightarrow> (path = []) = (p = p')"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   181
by (simp add:pbs_prop1)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   182
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   183
lemma pbs_prop2':
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   184
  "path_by_shm s p path p \<Longrightarrow> path = []"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   185
by (simp add:pbs_prop2)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   186
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   187
lemma pbs_prop3:
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   188
  "\<lbrakk>path_by_shm s p path p'; path \<noteq> []\<rbrakk> \<Longrightarrow> p \<in> set (map Fst path)"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   189
by (drule pbs_prop1, auto)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   190
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   191
lemma pbs_prop4[rule_format]:
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   192
  "path_by_shm s p path p'\<Longrightarrow> path \<noteq> [] \<longrightarrow> p' \<in> set (map Trd path)"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   193
by (erule path_by_shm.induct, auto)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   194
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   195
lemma pbs_prop5[rule_format]:
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   196
  "path_by_shm s p path p' \<Longrightarrow> path \<noteq> [] \<longrightarrow> p' \<notin> set (map Fst path)"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   197
by (erule path_by_shm.induct, auto simp:one_flow_shm_def)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   198
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   199
lemma pbs_prop6_aux:
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   200
  "path_by_shm s pa pathac pc \<Longrightarrow> valid s \<longrightarrow> (\<forall> pb \<in> set (map Fst pathac). \<exists> pathab pathbc. path_by_shm s pa pathab pb \<and> path_by_shm s pb pathbc pc \<and> pathac = pathbc @ pathab)"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   201
apply (erule path_by_shm.induct)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   202
apply simp
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   203
apply clarify
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   204
apply (case_tac "pb = p'", simp)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   205
apply (rule_tac x = path in exI, simp)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   206
apply (erule one_step_path, simp)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   207
apply (erule_tac x = pb in ballE, simp_all, clarsimp)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   208
apply (rule_tac x = pathab in exI, simp)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   209
apply (erule pbs2, auto)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   210
done
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   211
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   212
lemma pbs_prop6:
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   213
  "\<lbrakk>path_by_shm s pa pathac pc; pb \<in> set (map Fst pathac); valid s\<rbrakk>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   214
   \<Longrightarrow> \<exists> pathab pathbc. path_by_shm s pa pathab pb \<and> path_by_shm s pb pathbc pc \<and> pathac = pathbc @ pathab"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   215
by (drule pbs_prop6_aux, auto)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   216
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   217
lemma pbs_prop7_aux:
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   218
  "path_by_shm s pa pathac pc \<Longrightarrow> valid s \<longrightarrow> (\<forall> pb \<in> set (map Trd pathac). \<exists> pathab pathbc. path_by_shm s pa pathab pb \<and> path_by_shm s pb pathbc pc \<and> pathac = pathbc @ pathab)"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   219
apply (erule path_by_shm.induct)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   220
apply simp
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   221
apply clarify
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   222
apply (case_tac "pb = p''", simp)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   223
apply (rule_tac x = "(p',h,p'') # path" in exI, simp)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   224
apply (rule conjI, erule pbs2, simp+)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   225
apply (rule pbs1, clarsimp simp:one_flow_shm_def procs_of_shm_prop2)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   226
apply (erule_tac x = pb in ballE, simp_all, clarsimp)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   227
apply (rule_tac x = pathab in exI, simp)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   228
apply (erule pbs2, auto)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   229
done
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   230
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   231
lemma pbs_prop7:
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   232
  "\<lbrakk>path_by_shm s pa pathac pc; pb \<in> set (map Trd pathac); valid s\<rbrakk>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   233
   \<Longrightarrow> \<exists> pathab pathbc. path_by_shm s pa pathab pb \<and> path_by_shm s pb pathbc pc \<and> pathac = pathbc @ pathab"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   234
by (drule pbs_prop7_aux, drule mp, simp, erule_tac x = pb in ballE, auto)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   235
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   236
lemma pbs_prop8:
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   237
  "path_by_shm s p path p' \<Longrightarrow> (set (map Fst path) - {p}) = (set (map Trd path) - {p'})"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   238
proof (induct rule:path_by_shm.induct)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   239
  case (pbs1 p s)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   240
  thus ?case by simp
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   241
next
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   242
  case (pbs2 s p path p' h p'')
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   243
  assume p1:"path_by_shm s p path p'" and p2: "set (map Fst path) - {p} = set (map Trd path) - {p'}"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   244
    and p3: "one_flow_shm s h p' p''" and p4: "p'' \<notin> set (map Fst path)" 
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   245
  show "set (map Fst ((p', h, p'') # path)) - {p} = set (map Trd ((p', h, p'') # path)) - {p''}"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   246
    (is "?left = ?right")
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   247
  proof (cases "path = []")
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   248
    case True
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   249
    with p1 have "p = p'" by (drule_tac pbs_prop2, simp)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   250
    thus ?thesis using True
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   251
      using p2 by (simp)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   252
  next
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   253
    case False
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   254
    with p1 have a1: "p \<noteq> p'" by (drule_tac pbs_prop2, simp)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   255
    from p3 have a2: "p' \<noteq> p''" by (simp add:one_flow_shm_def)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   256
    from p1 False have a3: "p' \<in> set (map Trd path)" by (drule_tac pbs_prop4, simp+)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   257
    from p4 p1 False have a4: "p \<noteq> p''" by (drule_tac pbs_prop3, auto)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   258
    with p2 a2 p4 have a5: "p'' \<notin> set (map Trd path)" by auto
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   259
    
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   260
    have "?left = (set (map Fst path) - {p}) \<union> {p'}" using a1 by auto
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   261
    moreover have "... = (set (map Trd path) - {p'}) \<union> {p'}"  
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   262
      using p2 by auto
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   263
    moreover have "... = set (map Trd path)" using a3 by auto
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   264
    moreover have "... = set (map Trd path) - {p''}" using a5 by simp
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   265
    moreover have "... = ?right" by simp
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   266
    ultimately show ?thesis by simp
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   267
  qed
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   268
qed
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   269
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   270
lemma pbs_prop9_aux[rule_format]:
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   271
  "path_by_shm s p path p' \<Longrightarrow> h \<in> set (map Snd path) \<and> valid s \<longrightarrow> (\<exists> pa pb patha pathb. path_by_shm s p patha pa \<and> path_by_shm s pb pathb p' \<and> one_flow_shm s h pa pb \<and> path = pathb @ [(pa, h, pb)] @ patha \<and> h \<notin> set (map Snd patha))"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   272
apply (erule path_by_shm.induct, simp)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   273
apply (rule impI, case_tac "h \<in> set (map Snd path)", simp_all)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   274
apply (erule exE|erule conjE)+
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   275
apply (rule_tac x = pa in exI, rule_tac x = pb in exI, rule_tac x = patha in exI, simp)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   276
apply (rule pbs2, auto)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   277
apply (rule_tac x = p' in exI, rule_tac x = p'' in exI, rule_tac x = path in exI, simp)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   278
apply (rule pbs1, clarsimp simp:one_flow_shm_def procs_of_shm_prop2)
27
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   279
done
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   280
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   281
lemma pbs_prop9:
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   282
  "\<lbrakk>h \<in> set (map Snd path); path_by_shm s p path p'; valid s\<rbrakk>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   283
   \<Longrightarrow> \<exists> pa pb patha pathb. path_by_shm s p patha pa \<and> path_by_shm s pb pathb p' \<and> 
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   284
        one_flow_shm s h pa pb \<and> path = pathb @ [(pa, h, pb)] @ patha \<and> h \<notin> set (map Snd patha)"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   285
by (rule pbs_prop9_aux, auto)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   286
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   287
lemma path_by_shm_trans_aux[rule_format]:
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   288
  "path_by_shm s p' path' p'' \<Longrightarrow> valid s \<longrightarrow> (\<forall> p path. path_by_shm s p path p' \<longrightarrow> (\<exists> path''. path_by_shm s p path'' p''))"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   289
proof (induct rule:path_by_shm.induct)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   290
  case (pbs1 p s)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   291
  thus ?case
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   292
    by (clarify, rule_tac x = path in exI, simp)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   293
next
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   294
  case (pbs2 s p path p' h p'')
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   295
  hence p1: "path_by_shm s p path p'" and p2: "one_flow_shm s h p' p''" 
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   296
    and p3: "valid s \<longrightarrow> (\<forall>pa path. path_by_shm s pa path p \<longrightarrow> (\<exists>path''. path_by_shm s pa path'' p'))"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   297
    and p4: "p'' \<notin> set (map Fst path)" by auto
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   298
  show ?case
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   299
  proof clarify
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   300
    fix pa path'
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   301
    assume p5: "path_by_shm s pa path' p" and p6: "valid s"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   302
    with p3 obtain path'' where a1: "path_by_shm s pa path'' p'" by auto
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   303
    have p3': "\<forall>pa path. path_by_shm s pa path p \<longrightarrow> (\<exists>path''. path_by_shm s pa path'' p')" 
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   304
      using p3 p6 by simp
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   305
    show "\<exists>path''. path_by_shm s pa path'' p''"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   306
    proof (cases "p'' \<in> set (map Fst path'')")
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   307
      case True
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   308
      then obtain res where "path_by_shm s pa res p''" using a1 pbs_prop6 p6 by blast
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   309
      thus ?thesis by auto
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   310
    next
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   311
      case False
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   312
      with p2 a1 show ?thesis 
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   313
        apply (rule_tac x = "(p', h, p'') # path''" in exI)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   314
        apply (rule path_by_shm.intros(2), auto)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   315
        done
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   316
    qed
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   317
  qed
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   318
qed
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   319
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   320
lemma path_by_shm_trans:
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   321
  "\<lbrakk>path_by_shm s p path p'; path_by_shm s p' path' p''; valid s\<rbrakk> \<Longrightarrow> \<exists> path''. path_by_shm s p path'' p''"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   322
by (drule_tac p' = p' and p'' = p'' in path_by_shm_trans_aux, auto)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   323
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   324
lemma path_by_shm_intro1_prop:
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   325
  "\<not> path_by_shm s p [] p \<Longrightarrow> p \<notin> current_procs s"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   326
by (auto dest:path_by_shm.intros(1))
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   327
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   328
lemma path_by_shm_intro3:
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   329
  "\<lbrakk>path_by_shm s p path from; (from, SHM_RDWR) \<in> procs_of_shm s h; (to, flag) \<in> procs_of_shm s h; 
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   330
    to \<notin> set (map Fst path); from \<noteq> to\<rbrakk>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   331
   \<Longrightarrow> path_by_shm s p ((from, h, to)#path) to"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   332
apply (rule path_by_shm.intros(2), simp_all)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   333
by (auto simp:one_flow_shm_def)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   334
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   335
lemma path_by_shm_intro4:
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   336
  "\<lbrakk>(p, flag) \<in> procs_of_shm s h; valid s\<rbrakk> \<Longrightarrow> path_by_shm s p [] p"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   337
by (drule procs_of_shm_prop2, simp, simp add:path_by_shm.intros(1))
27
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   338
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   339
lemma path_by_shm_intro5:
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   340
  "\<lbrakk>(from, SHM_RDWR) \<in> procs_of_shm s h; (to,flag) \<in> procs_of_shm s h; valid s; from \<noteq> to\<rbrakk>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   341
   \<Longrightarrow> path_by_shm s from [(from, h, to)] to"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   342
apply (rule_tac p' = "from" and h = h in path_by_shm.intros(2))
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   343
apply (rule path_by_shm.intros(1), simp add:procs_of_shm_prop2)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   344
apply (simp add:one_flow_shm_def, rule_tac x = flag in exI, auto)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   345
done
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   346
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   347
(* p'' \<notin> set (map Fst path): not duplicated target process;
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   348
 * p1 - ha \<rightarrow> p2; p2 - hb \<rightarrow> p3; p3 - ha \<rightarrow> p4; so path_by_shm p1 [(p3,ha,p4), (p2,hb,p3),(p1,ha,p2)] p4,
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   349
 * but this could be also path_by_shm p1 [(p1,ha,p4)] p4, so the former one is redundant!  *)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   350
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   351
inductive path_by_shm':: "t_state \<Rightarrow> t_process \<Rightarrow> t_edge_shm list \<Rightarrow> t_process \<Rightarrow> bool"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   352
where
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   353
  pbs1': "p \<in> current_procs s \<Longrightarrow> path_by_shm' s p [] p"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   354
| pbs2': "\<lbrakk>path_by_shm s p path p'; one_flow_shm s h p' p''; p'' \<notin> set (map Fst path); 
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   355
           h \<notin> set (map Snd path)\<rbrakk> 
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   356
          \<Longrightarrow> path_by_shm' s p ((p', h, p'')# path) p''"
27
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   357
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   358
lemma pbs_imp_pbs'[rule_format]:
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   359
  "path_by_shm s p path p' \<Longrightarrow> valid s \<longrightarrow> (\<exists> path'. path_by_shm' s p path' p')"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   360
apply (erule path_by_shm.induct)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   361
apply (rule impI, rule_tac x = "[]" in exI, erule pbs1')
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   362
apply (rule impI, simp,  erule exE, case_tac "h \<in> set (map Snd path)")
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   363
apply (drule_tac s = s and p = p and p' = p' in pbs_prop9, simp+) defer
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   364
apply (rule_tac x = "(p', h, p'') # path" in exI, erule pbs2', simp+) 
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   365
apply ((erule exE|erule conjE)+)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   366
apply (rule_tac x = "(pa, h, p'') # patha" in exI)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   367
apply (erule pbs2', auto simp:one_flow_shm_def)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   368
done
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   369
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   370
lemma pbs'_imp_pbs[rule_format]:
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   371
  "path_by_shm' s p path p' \<Longrightarrow> valid s \<longrightarrow> (\<exists> path'. path_by_shm s p path' p')"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   372
apply (erule path_by_shm'.induct)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   373
apply (rule impI, rule_tac x = "[]" in exI, simp add:pbs1)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   374
apply (rule impI, rule_tac x = "(p', h, p'') # path" in exI, simp add:pbs2)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   375
done
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   376
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   377
definition flow_by_shm :: "t_state \<Rightarrow> t_process \<Rightarrow> t_process \<Rightarrow> bool"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   378
where
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   379
  "flow_by_shm s p p' \<equiv> \<exists> path. path_by_shm s p path p'"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   380
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   381
lemma flow_by_shm_intro':
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   382
  "valid s \<Longrightarrow> flow_by_shm s p p' = (\<exists> path. path_by_shm' s p path p')"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   383
by (auto simp:flow_by_shm_def intro: pbs_imp_pbs' pbs'_imp_pbs)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   384
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   385
lemma one_step_flows: "\<lbrakk>one_flow_shm s h p p'; valid s\<rbrakk> \<Longrightarrow> flow_by_shm s p p'"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   386
by (drule one_step_path, auto simp:flow_by_shm_def)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   387
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   388
lemma flow_by_shm_trans:
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   389
  "\<lbrakk>flow_by_shm s p p'; flow_by_shm s p' p''; valid s\<rbrakk> \<Longrightarrow> flow_by_shm s p p''"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   390
by (auto simp:flow_by_shm_def intro!:path_by_shm_trans)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   391
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   392
lemma flow_by_shm_intro1_prop:
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   393
  "\<not> flow_by_shm s p p \<Longrightarrow> p \<notin> current_procs s"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   394
by (auto dest:path_by_shm.intros(1) simp:flow_by_shm_def)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   395
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   396
lemma flow_by_shm_intro1:
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   397
  "p \<in> current_procs s \<Longrightarrow> flow_by_shm s p p"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   398
by (auto dest:path_by_shm.intros(1) simp:flow_by_shm_def)
27
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   399
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   400
lemma flow_by_shm_intro2:
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   401
  "\<lbrakk>flow_by_shm s p p'; one_flow_shm s h p' p''; valid s\<rbrakk> \<Longrightarrow> flow_by_shm s p p''"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   402
by (auto intro:flow_by_shm_trans dest:one_step_flows)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   403
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   404
lemma flow_by_shm_intro3:
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   405
  "\<lbrakk>flow_by_shm s p from; (from, SHM_RDWR) \<in> procs_of_shm s h; (to, flag) \<in> procs_of_shm s h; from \<noteq> to; valid s\<rbrakk>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   406
   \<Longrightarrow> flow_by_shm s p to"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   407
apply (rule flow_by_shm_intro2)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   408
by (auto simp:one_flow_shm_def)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   409
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   410
lemma flow_by_shm_intro4:
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   411
  "\<lbrakk>(p, flag) \<in> procs_of_shm s h; valid s\<rbrakk> \<Longrightarrow> flow_by_shm s p p"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   412
by (drule procs_of_shm_prop2, simp, simp add:flow_by_shm_intro1)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   413
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   414
lemma flow_by_shm_intro5:
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   415
  "\<lbrakk>(from, SHM_RDWR) \<in> procs_of_shm s h; (to,flag) \<in> procs_of_shm s h; valid s; from \<noteq> to\<rbrakk>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   416
   \<Longrightarrow> flow_by_shm s from  to"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   417
apply (rule_tac p' = "from" and h = h in flow_by_shm_intro2)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   418
apply (rule flow_by_shm_intro1, simp add:procs_of_shm_prop2)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   419
apply (simp add:one_flow_shm_def, rule_tac x = flag in exI, auto)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   420
done
28
e298d755bc35 finally finish Info_flow_shm_attach
chunhan
parents: 27
diff changeset
   421
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   422
lemma flow_by_shm_intro6:
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   423
  "path_by_shm s p path p' \<Longrightarrow> flow_by_shm s p p'"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   424
by (auto simp:flow_by_shm_def)
28
e298d755bc35 finally finish Info_flow_shm_attach
chunhan
parents: 27
diff changeset
   425
(********* simpset for inductive Info_flow_shm **********)
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   426
term edge_related
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   427
lemma path_by_shm_detach1_aux:
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   428
  "path_by_shm s' pa path pb \<Longrightarrow> valid (Detach p h # s) \<and> (s' = Detach p h # s) 
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   429
     \<longrightarrow> \<not> edge_related path p h \<and> path_by_shm s pa path pb"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   430
apply (erule path_by_shm.induct, simp)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   431
apply (rule impI, rule path_by_shm.intros(1), simp+)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   432
by (auto simp:one_flow_shm_def split:if_splits intro:path_by_shm_intro3)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   433
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   434
lemma path_by_shm_detach1:
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   435
  "\<lbrakk>path_by_shm (Detach p h # s) pa path pb; valid (Detach p h # s)\<rbrakk> 
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   436
   \<Longrightarrow> \<not> edge_related path p h \<and> path_by_shm s pa path pb"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   437
by (auto dest:path_by_shm_detach1_aux)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   438
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   439
lemma path_by_shm_detach2_aux[rule_format]:
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   440
  "path_by_shm s pa path pb \<Longrightarrow> valid (Detach p h # s) \<and> \<not> edge_related path p h 
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   441
   \<longrightarrow> path_by_shm (Detach p h # s) pa path pb"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   442
apply (induct rule:path_by_shm.induct)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   443
apply (rule impI, rule path_by_shm.intros(1), simp)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   444
apply (rule impI, erule conjE, simp split:if_splits)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   445
apply (rule path_by_shm.intros(2), simp)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   446
apply (simp add:one_flow_shm_detach)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   447
apply (rule impI, simp+)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   448
done
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   449
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   450
lemma path_by_shm_detach2:
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   451
  "\<lbrakk>valid (Detach p h # s); \<not> edge_related path p h; path_by_shm s pa path pb\<rbrakk> 
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   452
   \<Longrightarrow> path_by_shm (Detach p h # s) pa path pb"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   453
by (auto intro!:path_by_shm_detach2_aux)
28
e298d755bc35 finally finish Info_flow_shm_attach
chunhan
parents: 27
diff changeset
   454
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   455
lemma path_by_shm_detach:
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   456
  "valid (Detach p h # s) \<Longrightarrow>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   457
   path_by_shm (Detach p h # s) pa path pb = (\<not> edge_related path p h  \<and> path_by_shm s pa path pb)"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   458
by (auto dest:path_by_shm_detach1 path_by_shm_detach2)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   459
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   460
lemma flow_by_shm_detach:
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   461
  "valid (Detach p h # s) \<Longrightarrow> 
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   462
   flow_by_shm (Detach p h # s) pa pb = (\<exists> path. \<not> edge_related path p h \<and> path_by_shm s pa path pb)"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   463
by (auto dest:path_by_shm_detach simp:flow_by_shm_def)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   464
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   465
lemma path_by_shm_attach1_aux:
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   466
  "path_by_shm s' pa path pb \<Longrightarrow> valid s' \<and> (s' = Attach p h flag # s) \<longrightarrow>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   467
     (path_by_shm s pa path pb) \<or>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   468
     (\<exists> path1 path2 p'. path_by_shm s pa path1 p' \<and> path_by_shm s p path2 pb \<and> 
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   469
         (p', SHM_RDWR) \<in> procs_of_shm s h \<and> path = path2 @ [(p', h, p)] @ path1 ) \<or>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   470
     (\<exists> path1 path2 p' flag'. path_by_shm s pa path1 p \<and> path_by_shm s p' path2 pb \<and> 
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   471
         (p', flag') \<in> procs_of_shm s h \<and> path = path2 @ [(p, h, p')] @ path1 \<and> flag = SHM_RDWR)"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   472
apply (erule path_by_shm.induct)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   473
apply (simp, rule impI, rule pbs1, simp)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   474
apply (rule impI, erule impE, clarsimp)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   475
apply (erule disjE)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   476
apply (clarsimp simp:one_flow_shm_attach split:if_splits)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   477
apply (erule disjE, clarsimp)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   478
apply (erule_tac x = path in allE, clarsimp)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   479
apply (erule impE, rule pbs1, erule procs_of_shm_prop2, erule vd_cons, simp)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   480
apply (erule disjE, clarsimp)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   481
apply (rule_tac x = path in exI, rule_tac x = "[]" in exI, rule_tac x = p' in exI, simp)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   482
apply (rule pbs1, drule vt_grant_os, clarsimp)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   483
apply (drule_tac p = pa and p' = p' and p'' = p'' in pbs2, simp+)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   484
apply (drule_tac p = pa and p' = p' and p'' = p'' in pbs2, simp+)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   485
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   486
apply (erule disjE)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   487
apply ((erule exE|erule conjE)+, simp split:if_splits add:one_flow_shm_attach)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   488
apply (clarsimp simp:one_flow_shm_attach split:if_splits)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   489
apply (erule disjE, clarsimp)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   490
apply (clarsimp)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   491
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   492
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   493
apply (erule conjE)+
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   494
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   495
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   496
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   497
apply (erule conjE, clarsimp simp only:one_flow_shm_attach split:if_splits)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   498
apply simp
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   499
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   500
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   501
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   502
lemma path_by_shm_attach1_aux:
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   503
  "path_by_shm s' pa path pb \<Longrightarrow> valid s' \<and> (s' = Attach p h flag # s) \<longrightarrow> 
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   504
     path_by_shm s pa path pb \<or>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   505
      (if (pa = p \<and> flag = SHM_RDWR)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   506
       then \<exists> p' flagb path'. (p', flagb) \<in> procs_of_shm s h \<and> 
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   507
               path_by_shm s p' path' pb \<and> path = path' @ [(p, h, p')]
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   508
       else if (pb = p)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   509
            then \<exists> p' path'. path_by_shm s pa path' p' \<and> path = (p', h, p) # path' \<and> 
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   510
                   (p', SHM_RDWR) \<in> procs_of_shm s h
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   511
            else (\<exists> p' flag' patha pathb. path_by_shm s pa patha p \<and> flag = SHM_RDWR \<and> 
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   512
                   (p', flag') \<in> procs_of_shm s h \<and> path_by_shm s p' pathb pb \<and> 
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   513
                   path = pathb @ [(p, h, p')] @ patha) \<or>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   514
                 (\<exists> p' patha pathb. path_by_shm s pa patha p' \<and> (p', SHM_RDWR) \<in> procs_of_shm s h \<and> 
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   515
                   path_by_shm s p pathb pb \<and> path = pathb @ [(p', h, p)] @ patha))"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   516
proof (induct rule:path_by_shm.induct)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   517
  case (pbs1 proc \<tau>)
27
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   518
  show ?case
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   519
  proof (rule impI)
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   520
    assume pre: "valid \<tau> \<and> \<tau> = Attach p h flag # s"
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   521
    from pbs1 pre have "proc \<in> current_procs s" by simp 
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   522
    thus "path_by_shm s proc [] proc \<or>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   523
         (if proc = p \<and> flag = SHM_RDWR
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   524
          then \<exists>p' flagb path'.
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   525
                  (p', flagb) \<in> procs_of_shm s h \<and> path_by_shm s p' path' proc \<and> [] = path' @ [(p, h, p')]
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   526
          else if proc = p
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   527
               then \<exists>p' path'.
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   528
                       path_by_shm s proc path' p' \<and> [] = (p', h, p) # path' \<and> (p', SHM_RDWR) \<in> procs_of_shm s h
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   529
               else (\<exists>p' flag' patha pathb.
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   530
                        path_by_shm s proc patha p \<and>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   531
                        flag = SHM_RDWR \<and>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   532
                        (p', flag') \<in> procs_of_shm s h \<and>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   533
                        path_by_shm s p' pathb proc \<and> [] = pathb @ [(p, h, p')] @ patha) \<or>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   534
                    (\<exists>p' patha pathb.
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   535
                        path_by_shm s proc patha p' \<and>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   536
                        (p', SHM_RDWR) \<in> procs_of_shm s h \<and>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   537
                        path_by_shm s p pathb proc \<and> [] = pathb @ [(p', h, p)] @ patha))"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   538
      by (auto intro:path_by_shm.intros)
27
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   539
  qed
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   540
next
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   541
  case (pbs2 \<tau> pa path pb h' pc)
27
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   542
  thus ?case
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   543
  proof (rule_tac impI)
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   544
    assume p1:"path_by_shm \<tau> pa path pb" and p2: "valid \<tau> \<and> \<tau> = Attach p h flag # s \<longrightarrow>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   545
     path_by_shm s pa path pb \<or>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   546
     (if pa = p \<and> flag = SHM_RDWR
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   547
      then \<exists>p' flagb path'. (p', flagb) \<in> procs_of_shm s h \<and> path_by_shm s p' path' pb \<and> path = path' @ [(p, h, p')]
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   548
      else if pb = p
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   549
           then \<exists>p' path'. path_by_shm s pa path' p' \<and> path = (p', h, p) # path' \<and> (p', SHM_RDWR) \<in> procs_of_shm s h
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   550
           else (\<exists>p' flag' pathaa pathb. path_by_shm s pa pathaa p \<and> flag = SHM_RDWR \<and> 
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   551
                    (p', flag') \<in> procs_of_shm s h \<and> path_by_shm s p' pathb pb \<and> 
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   552
                    path = pathb @ [(p, h, p')] @ pathaa) \<or>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   553
                (\<exists>p' pathaa pathb. path_by_shm s pa pathaa p' \<and> (p', SHM_RDWR) \<in> procs_of_shm s h \<and>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   554
                    path_by_shm s p pathb pb \<and> path = pathb @ [(p', h, p)] @ pathaa))"
27
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   555
      and p3: "one_flow_shm \<tau> h' pb pc" and p4: "valid \<tau> \<and> \<tau> = Attach p h flag # s"
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   556
    
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   557
    from p2 and p4 have p2': "
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   558
      path_by_shm s pa path pb \<or>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   559
     (if pa = p \<and> flag = SHM_RDWR
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   560
      then \<exists>p' flagb path'. (p', flagb) \<in> procs_of_shm s h \<and> path_by_shm s p' path' pb \<and> path = path' @ [(p, h, p')]
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   561
      else if pb = p
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   562
           then \<exists>p' path'. path_by_shm s pa path' p' \<and> path = (p', h, p) # path' \<and> (p', SHM_RDWR) \<in> procs_of_shm s h
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   563
           else (\<exists>p' flag' pathaa pathb. path_by_shm s pa pathaa p \<and> flag = SHM_RDWR \<and> 
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   564
                    (p', flag') \<in> procs_of_shm s h \<and> path_by_shm s p' pathb pb \<and> 
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   565
                    path = pathb @ [(p, h, p')] @ pathaa) \<or>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   566
                (\<exists>p' pathaa pathb. path_by_shm s pa pathaa p' \<and> (p', SHM_RDWR) \<in> procs_of_shm s h \<and>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   567
                    path_by_shm s p pathb pb \<and> path = pathb @ [(p', h, p)] @ pathaa))"
27
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   568
      by (erule_tac impE, simp)
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   569
    from p4 have p5: "valid s" and p6: "os_grant s (Attach p h flag)" by (auto intro:vd_cons dest:vt_grant_os)
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   570
    from p6 have "p \<in> current_procs s" by simp hence p7:"path_by_shm s p [] p" by (erule_tac path_by_shm.intros)
27
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   571
    from p3 p4 have p8: "if (h' = h) 
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   572
     then (pb = p \<and> pc \<noteq> p \<and> flag = SHM_RDWR \<and> (\<exists> flagb. (pc, flagb) \<in> procs_of_shm s h)) \<or>
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   573
          (pc = p \<and> pb \<noteq> p \<and> (pb, SHM_RDWR) \<in> procs_of_shm s h) \<or>
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   574
          (one_flow_shm s h pb pc)               
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   575
     else one_flow_shm s h' pb pc" by (auto simp add:one_flow_shm_attach) 
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   576
    
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   577
    
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   578
(*
27
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   579
    have "\<And> flagb. (pc, flagb) \<in> procs_of_shm s h 
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   580
      \<Longrightarrow> \<exists> p' flagb. (p', flagb) \<in> procs_of_shm s h \<and> path_by_shm s p' [] pc"
27
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   581
      apply (rule_tac x= pc in exI, rule_tac x = flagb in exI, frule procs_of_shm_prop2)
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   582
      by (simp add:p5, simp add:path_by_shm.intros(1))
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   583
    hence p10: "\<not> path_by_shm s p path pc \<Longrightarrow> (\<exists>p' flagb. (p', flagb) \<in> procs_of_shm s h \<and> path_by_shm s p'  pc) \<or>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   584
      path_by_shm s pa pc"
27
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   585
      using p2' p7 p8 p5
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   586
      by (auto split:if_splits dest:path_by_shm.intros(2))      
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   587
  (*     apply (rule_tac x = pb in exI, simp add:one_flow_flows, rule_tac x = flagb in exI, simp)+  *) *)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   588
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   589
    from p1 have a0: "(path = []) = (pa = pb)" using pbs_prop2 by simp
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   590
    have a1:"\<lbrakk>pa = p; flag = SHM_RDWR; \<not> path_by_shm s pa path pb\<rbrakk> \<Longrightarrow> 
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   591
      \<exists>p' flagb path'. (p', flagb) \<in> procs_of_shm s h \<and> path_by_shm s p' path' pb \<and> path = path' @ [(p, h, p')]"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   592
      using p2' by auto
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   593
    have b1: "\<lbrakk>pa = p; flag = SHM_RDWR; \<not> path_by_shm s pa path pc\<rbrakk> \<Longrightarrow> 
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   594
      \<exists>p' flagb path'. (p', flagb) \<in> procs_of_shm s h \<and> path_by_shm s p' path' pc \<and>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   595
        (pb, h', pc) # path = path' @ [(p, h, p')]"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   596
      
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   597
      
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   598
      using p8 a1 p7 p5 a0 
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   599
      apply (auto split:if_splits elim:path_by_shm_intro4)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   600
      apply (rule_tac x = pb in exI, rule conjI, rule_tac x = SHM_RDWR in exI, simp)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   601
      apply (rule_tac x = pc in exI, rule conjI, rule_tac x = flagb in exI, simp)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   602
      apply (rule_tac x = "[]" in exI, rule conjI)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   603
apply (erule path_by_shm_intro4, simp)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   604
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   605
      apply (case_tac "path_by_shm s pa path pb", simp) defer
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   606
      apply (drule a1, simp+, clarsimp)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   607
      apply (rule conjI, rule_tac x = flagb in exI, simp)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   608
      apply (rule path_by_shm_
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   609
      using p2' p8 p5
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   610
      apply (auto split:if_splits dest!:pbs_prop2' simp:path_by_shm_intro4)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   611
      apply (drule pbs_prop2', simp)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   612
      apply (erule_tac x = pc in allE, simp add:path_by_shm_intro4)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   613
     
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   614
      apply (drule_tac x = "pc" in allE)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   615
      
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   616
      apply simp
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   617
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   618
      sorry
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   619
    moreover have "pc = p \<Longrightarrow> (\<exists>p' path'. path_by_shm s pa path' p' \<and>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   620
             (pb, h', pc) # path = path' @ [(p', h, p)] \<and> (p', SHM_RDWR) \<in> procs_of_shm s h) \<or>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   621
      (path_by_shm s pa path pc \<and> \<not> edge_related path p h)"
27
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   622
      using p2' p7 p8 p5
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   623
      sorry (*
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   624
      apply (auto split:if_splits intro:path_by_shm_intro3 simp:one_flow_shm_def) *)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   625
    moreover have "\<lbrakk>pc \<noteq> p; pa \<noteq> p \<or> flag \<noteq> SHM_RDWR\<rbrakk> \<Longrightarrow> 
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   626
      (\<exists>p' flag' pathaa pathb. path_by_shm s pa pathaa p \<and> flag = SHM_RDWR \<and> (p', flag') \<in> procs_of_shm s h \<and>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   627
           path_by_shm s p' pathb pc \<and> (pb, h', pc) # path = pathaa @ [(p, h, p')] @ pathb) \<or>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   628
      (\<exists>p' pathaa pathb. path_by_shm s pa pathaa p' \<and> (p', SHM_RDWR) \<in> procs_of_shm s h \<and>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   629
           path_by_shm s p pathb pc \<and> (pb, h', pc) # path = pathaa @ [(p', h, p)] @ pathb) \<or>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   630
      (path_by_shm s pa path pc \<and> \<not> edge_related path p h)"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   631
      using p2' p7 p8 p5 (*
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   632
      apply (auto split:if_splits intro:path_by_shm_intro3 simp:one_flow_shm_def)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   633
      apply (rule_tac x = pc in exI, simp add:path_by_shm_intro4)
27
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   634
      apply (rule_tac x = flagb in exI, simp)      
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   635
      done *)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   636
      sorry
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   637
    ultimately  
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   638
    show "if (pb, h', pc) # path = [] then pa = pc \<and> pa \<in> current_procs s
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   639
       else path_by_shm s pa ((pb, h', pc) # path) pc \<and> \<not> edge_related ((pb, h', pc) # path) p h \<or>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   640
       (if pa = p \<and> flag = SHM_RDWR
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   641
        then \<exists>p' flagb path'. (p', flagb) \<in> procs_of_shm s h \<and>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   642
                path_by_shm s p' path' pc \<and> (pb, h', pc) # path = path' @ [(p, h, p')]
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   643
        else if pc = p
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   644
             then \<exists>p' path'. path_by_shm s pa path' p' \<and>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   645
                     (pb, h', pc) # path = (p', h, p) # path' \<and> (p', SHM_RDWR) \<in> procs_of_shm s h
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   646
             else (\<exists>p' flag' pathaa pathb. path_by_shm s pa pathaa p \<and> flag = SHM_RDWR \<and>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   647
                      (p', flag') \<in> procs_of_shm s h \<and>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   648
                      path_by_shm s p' pathb pc \<and> (pb, h', pc) # path = pathb @ [(p, h, p')] @ pathaa) \<or>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   649
                  (\<exists>p' pathaa pathb. path_by_shm s pa pathaa p' \<and> (p', SHM_RDWR) \<in> procs_of_shm s h \<and>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   650
                      path_by_shm s p pathb pc \<and> (pb, h', pc) # path = pathb @ [(p', h, p)] @ pathaa))"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   651
        apply (auto split:if_splits)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   652
        using p7 by auto
27
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   653
  qed
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   654
qed
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   655
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   656
lemma path_by_shm_attach1:
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   657
  "\<lbrakk>valid (Attach p h flag # s); path_by_shm (Attach p h flag # s) pa pb\<rbrakk>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   658
   \<Longrightarrow> (if path_by_shm s pa pb then True else
28
e298d755bc35 finally finish Info_flow_shm_attach
chunhan
parents: 27
diff changeset
   659
     (if (pa = p \<and> flag = SHM_RDWR) 
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   660
      then (\<exists> p' flagb. (p', flagb) \<in> procs_of_shm s h \<and> path_by_shm s p' pb)
28
e298d755bc35 finally finish Info_flow_shm_attach
chunhan
parents: 27
diff changeset
   661
      else if (pb = p) 
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   662
           then (\<exists> p'. (p', SHM_RDWR) \<in> procs_of_shm s h \<and> path_by_shm s pa p')
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   663
           else (\<exists> p' flag'. path_by_shm s pa p \<and> flag = SHM_RDWR \<and> (p', flag') \<in> procs_of_shm s h \<and> 
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   664
                             path_by_shm s p' pb) \<or>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   665
                (\<exists> p'. path_by_shm s pa p' \<and> (p', SHM_RDWR) \<in> procs_of_shm s h \<and> path_by_shm s p pb)
28
e298d755bc35 finally finish Info_flow_shm_attach
chunhan
parents: 27
diff changeset
   666
     )  )"
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   667
apply (drule_tac p = p and h = h and flag = flag in path_by_shm_attach1_aux)
28
e298d755bc35 finally finish Info_flow_shm_attach
chunhan
parents: 27
diff changeset
   668
by auto
27
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   669
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   670
lemma path_by_shm_attach_aux[rule_format]:
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   671
  "path_by_shm s pa pb \<Longrightarrow> valid (Attach p h flag # s) \<longrightarrow> path_by_shm (Attach p h flag # s) pa pb"
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   672
apply (erule path_by_shm.induct)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   673
apply (rule impI, rule path_by_shm.intros(1), simp)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   674
apply (rule impI, simp, rule_tac h = ha in path_by_shm.intros(2), simp)
28
e298d755bc35 finally finish Info_flow_shm_attach
chunhan
parents: 27
diff changeset
   675
apply (auto simp add:one_flow_shm_simps)
e298d755bc35 finally finish Info_flow_shm_attach
chunhan
parents: 27
diff changeset
   676
done
27
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   677
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   678
lemma path_by_shm_attach2:
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   679
  "\<lbrakk>valid (Attach p h flag # s); if path_by_shm s pa pb then True else
28
e298d755bc35 finally finish Info_flow_shm_attach
chunhan
parents: 27
diff changeset
   680
     (if (pa = p \<and> flag = SHM_RDWR) 
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   681
      then (\<exists> p' flagb. (p', flagb) \<in> procs_of_shm s h \<and> path_by_shm s p' pb)
28
e298d755bc35 finally finish Info_flow_shm_attach
chunhan
parents: 27
diff changeset
   682
      else if (pb = p) 
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   683
           then (\<exists> p'. (p', SHM_RDWR) \<in> procs_of_shm s h \<and> path_by_shm s pa p')
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   684
           else (\<exists> p' flag'. path_by_shm s pa p \<and> flag = SHM_RDWR \<and> (p', flag') \<in> procs_of_shm s h \<and> 
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   685
                             path_by_shm s p' pb) \<or>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   686
                (\<exists> p'. path_by_shm s pa p' \<and> (p', SHM_RDWR) \<in> procs_of_shm s h \<and> path_by_shm s p pb))\<rbrakk>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   687
   \<Longrightarrow> path_by_shm (Attach p h flag # s) pa pb"
28
e298d755bc35 finally finish Info_flow_shm_attach
chunhan
parents: 27
diff changeset
   688
apply (frule vt_grant_os, frule vd_cons)
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   689
apply (auto split:if_splits intro:path_by_shm_intro3 simp:one_flow_shm_def intro:path_by_shm_attach_aux)
28
e298d755bc35 finally finish Info_flow_shm_attach
chunhan
parents: 27
diff changeset
   690
apply (rule_tac p' = p' in Info_flow_trans)
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   691
apply (rule_tac p' = p and h = h in path_by_shm.intros(2))
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   692
apply (rule path_by_shm.intros(1), simp)
28
e298d755bc35 finally finish Info_flow_shm_attach
chunhan
parents: 27
diff changeset
   693
apply (simp add:one_flow_shm_simps, simp add:one_flow_shm_def)
e298d755bc35 finally finish Info_flow_shm_attach
chunhan
parents: 27
diff changeset
   694
apply (rule conjI, rule notI, simp, rule_tac x = flagb in exI, simp)
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   695
apply (simp add:path_by_shm_attach_aux)
27
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   696
28
e298d755bc35 finally finish Info_flow_shm_attach
chunhan
parents: 27
diff changeset
   697
apply (rule_tac p' = p' in Info_flow_trans)
e298d755bc35 finally finish Info_flow_shm_attach
chunhan
parents: 27
diff changeset
   698
apply (rule_tac p' = p in Info_flow_trans)
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   699
apply (simp add:path_by_shm_attach_aux)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   700
apply (rule_tac p' = p and h = h in path_by_shm.intros(2))
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   701
apply (rule path_by_shm.intros(1), simp)
28
e298d755bc35 finally finish Info_flow_shm_attach
chunhan
parents: 27
diff changeset
   702
apply (simp add:one_flow_shm_simps, simp add:one_flow_shm_def)
e298d755bc35 finally finish Info_flow_shm_attach
chunhan
parents: 27
diff changeset
   703
apply (rule conjI, rule notI, simp, rule_tac x = flag' in exI, simp)
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   704
apply (simp add:path_by_shm_attach_aux)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   705
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   706
apply (rule_tac p' = p in Info_flow_trans)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   707
apply (rule_tac p' = p' in Info_flow_trans)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   708
apply (simp add:path_by_shm_attach_aux)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   709
apply (rule_tac p' = p' and h = h in path_by_shm.intros(2))
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   710
apply (rule path_by_shm.intros(1), simp add:procs_of_shm_prop2)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   711
apply (simp add:one_flow_shm_simps, simp add:one_flow_shm_def)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   712
apply (rule notI, simp)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   713
apply (simp add:path_by_shm_attach_aux)
27
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   714
28
e298d755bc35 finally finish Info_flow_shm_attach
chunhan
parents: 27
diff changeset
   715
apply (rule_tac p' = p in Info_flow_trans)
e298d755bc35 finally finish Info_flow_shm_attach
chunhan
parents: 27
diff changeset
   716
apply (rule_tac p' = p' in Info_flow_trans)
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   717
apply (simp add:path_by_shm_attach_aux)
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   718
apply (rule_tac p' = p' and h = h in path_by_shm.intros(2))
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   719
apply (rule path_by_shm.intros(1), simp add:procs_of_shm_prop2)
28
e298d755bc35 finally finish Info_flow_shm_attach
chunhan
parents: 27
diff changeset
   720
apply (simp add:one_flow_shm_simps, simp add:one_flow_shm_def)
e298d755bc35 finally finish Info_flow_shm_attach
chunhan
parents: 27
diff changeset
   721
apply (rule notI, simp)
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   722
apply (simp add:path_by_shm_attach_aux)
28
e298d755bc35 finally finish Info_flow_shm_attach
chunhan
parents: 27
diff changeset
   723
done
27
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   724
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   725
lemma path_by_shm_attach:
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   726
  "valid (Attach p h flag # s) \<Longrightarrow> path_by_shm (Attach p h flag # s) = (\<lambda> pa pb. 
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   727
     path_by_shm s pa pb \<or>
28
e298d755bc35 finally finish Info_flow_shm_attach
chunhan
parents: 27
diff changeset
   728
     (if (pa = p \<and> flag = SHM_RDWR) 
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   729
      then (\<exists> p' flagb. (p', flagb) \<in> procs_of_shm s h \<and> path_by_shm s p' pb)
28
e298d755bc35 finally finish Info_flow_shm_attach
chunhan
parents: 27
diff changeset
   730
      else if (pb = p) 
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   731
           then (\<exists> p'. (p', SHM_RDWR) \<in> procs_of_shm s h \<and> path_by_shm s pa p')
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   732
           else (\<exists> p' flag'. path_by_shm s pa p \<and> flag = SHM_RDWR \<and> (p', flag') \<in> procs_of_shm s h \<and> 
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   733
                             path_by_shm s p' pb) \<or>
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   734
                (\<exists> p'. path_by_shm s pa p' \<and> (p', SHM_RDWR) \<in> procs_of_shm s h \<and> path_by_shm s p pb)
28
e298d755bc35 finally finish Info_flow_shm_attach
chunhan
parents: 27
diff changeset
   735
     )  )"
27
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   736
apply (rule ext, rule ext, rule iffI)
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   737
apply (drule_tac pa = pa and pb = pb in path_by_shm_attach1, simp)
28
e298d755bc35 finally finish Info_flow_shm_attach
chunhan
parents: 27
diff changeset
   738
apply (auto split:if_splits)[1]
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   739
apply (drule_tac pa = pa and pb = pb in path_by_shm_attach2)
28
e298d755bc35 finally finish Info_flow_shm_attach
chunhan
parents: 27
diff changeset
   740
apply (auto split:if_splits)
e298d755bc35 finally finish Info_flow_shm_attach
chunhan
parents: 27
diff changeset
   741
done
27
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
   742
26
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   743
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   744
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   745
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   746
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   747
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   748
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   749
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   750
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   751
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   752
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   753
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   754
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   755
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   756
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   757
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   758
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   759
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   760
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   761
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   762
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   763
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   764
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   765
26
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   766
lemma info_flow_shm_detach:
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   767
  "valid (Detach p h # s) \<Longrightarrow> info_flow_shm (Detach p h # s) = (\<lambda> pa pb. 
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   768
     self_shm s pa pb \<or> ((p = pa \<or> p = pb) \<and> (\<exists> h'. h' \<noteq> h \<and> one_flow_shm s h' pa pb)) \<or>
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   769
     (pa \<noteq> p \<and> pb \<noteq> p \<and> info_flow_shm s pa pb) )"
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   770
apply (rule ext, rule ext, frule vt_grant_os)
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   771
by (auto simp:info_flow_shm_def one_flow_shm_def)
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   772
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   773
lemma info_flow_shm_deleteshm:
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   774
  "valid (DeleteShM p h # s) \<Longrightarrow> info_flow_shm (DeleteShM p h # s) = (\<lambda> pa pb. 
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   775
     self_shm s pa pb \<or> (\<exists> h'. h' \<noteq> h \<and> one_flow_shm s h' pa pb)     )"
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   776
apply (rule ext, rule ext, frule vt_grant_os)
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   777
by (auto simp:info_flow_shm_def one_flow_shm_def)
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   778
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   779
lemma info_flow_shm_clone:
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   780
  "valid (Clone p p' fds shms # s) \<Longrightarrow> info_flow_shm (Clone p p' fds shms # s) = (\<lambda> pa pb. 
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   781
     (pa = p' \<and> pb = p') \<or> (pa = p' \<and> pb \<noteq> p' \<and> (\<exists> h \<in> shms. one_flow_shm s h p pb)) \<or> 
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   782
     (pb = p' \<and> pa \<noteq> p' \<and> (\<exists> h \<in> shms. one_flow_shm s h pa p)) \<or> 
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   783
     (pa \<noteq> p' \<and> pb \<noteq> p' \<and> info_flow_shm s pa pb))"
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   784
apply (rule ext, rule ext, frule vt_grant_os, frule vd_cons, clarsimp)
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   785
apply (frule_tac p = p' in procs_of_shm_prop2', simp)
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   786
sorry (*
26
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   787
apply (auto simp:info_flow_shm_def one_flow_shm_def)
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   788
done *)
26
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   789
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   790
lemma info_flow_shm_execve:
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   791
  "valid (Execve p f fds # s) \<Longrightarrow> info_flow_shm (Execve p f fds # s) = (\<lambda> pa pb. 
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   792
     (pa = p \<and> pb = p) \<or> (pa \<noteq> p \<and> pb \<noteq> p \<and> info_flow_shm s pa pb)    )"
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   793
apply (rule ext, rule ext, frule vt_grant_os, frule vd_cons)
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   794
by (auto simp:info_flow_shm_def one_flow_shm_def)
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   795
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   796
lemma info_flow_shm_kill:
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   797
  "valid (Kill p p' # s) \<Longrightarrow> info_flow_shm (Kill p p' # s) = (\<lambda> pa pb. 
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   798
     pa \<noteq> p' \<and> pb \<noteq> p' \<and> info_flow_shm s pa pb                 )"
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   799
apply (rule ext, rule ext, frule vt_grant_os, frule vd_cons)
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   800
by (auto simp:info_flow_shm_def one_flow_shm_def)
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   801
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   802
lemma info_flow_shm_exit:
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   803
  "valid (Exit p # s) \<Longrightarrow> info_flow_shm (Exit p # s) = (\<lambda> pa pb. 
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   804
     pa \<noteq> p \<and> pb \<noteq> p \<and> info_flow_shm s pa pb                          )"
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   805
apply (rule ext, rule ext, frule vt_grant_os, frule vd_cons)
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   806
by (auto simp:info_flow_shm_def one_flow_shm_def)
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   807
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   808
lemma info_flow_shm_other:
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   809
  "\<lbrakk>valid (e # s); 
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   810
    \<forall> p h flag. e \<noteq> Attach p h flag;
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   811
    \<forall> p h. e \<noteq> Detach p h;
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   812
    \<forall> p h. e \<noteq> DeleteShM p h;
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   813
    \<forall> p p' fds shms. e \<noteq> Clone p p' fds shms;
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   814
    \<forall> p f fds. e \<noteq> Execve p f fds;
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   815
    \<forall> p p'. e \<noteq> Kill p p';
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   816
    \<forall> p. e \<noteq> Exit p
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   817
   \<rbrakk> \<Longrightarrow> info_flow_shm (e # s) = info_flow_shm s"
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   818
apply (rule ext, rule ext, frule vt_grant_os, frule vd_cons)
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   819
apply (case_tac e, auto simp:info_flow_shm_def one_flow_shm_def dest:procs_of_shm_prop2)
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   820
apply (erule_tac x = h in allE, simp)
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   821
apply (drule procs_of_shm_prop1, auto)
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   822
done
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   823
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   824
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   825
(*
25
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   826
lemma info_flow_shm_prop1: 
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   827
  "\<lbrakk>info_flow_shm s p p'; p \<noteq> p'; valid s\<rbrakk> 
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   828
   \<Longrightarrow> \<exists> h h' flag. (p, SHM_RDWR) \<in> procs_of_shm s h \<and> (p', flag) \<in> procs_of_shm s h'"
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   829
by (induct rule: info_flow_shm.induct, auto)
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   830
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   831
lemma info_flow_shm_cases:
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   832
  "\<lbrakk>info_flow_shm \<tau> pa pb; \<And>p s. \<lbrakk>s = \<tau> ; pa = p; pb = p; p \<in> current_procs s\<rbrakk> \<Longrightarrow> P;
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   833
  \<And>s p p' h p'' flag. \<lbrakk>s = \<tau>; pa = p; pb = p''; info_flow_shm s p p'; (p', SHM_RDWR) \<in> procs_of_shm s h;
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   834
                       (p'', flag) \<in> procs_of_shm s h\<rbrakk>\<Longrightarrow> P\<rbrakk>
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   835
  \<Longrightarrow> P"
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   836
by (erule info_flow_shm.cases, auto)
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   837
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   838
definition one_flow_shm :: "t_state \<Rightarrow> t_process \<Rightarrow> t_process \<Rightarrow> bool"
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   839
where
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   840
  "one_flow_shm s p p' \<equiv> p \<noteq> p' \<and> (\<exists> h flag. (p, SHM_RDWR) \<in> procs_of_shm s h \<and> (p', flag) \<in> procs_of_shm s h)"
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   841
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   842
inductive flows_shm :: "t_state \<Rightarrow> t_process \<Rightarrow> t_process \<Rightarrow> bool"
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   843
where
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   844
  "p \<in> current_procs s \<Longrightarrow> flows_shm s p p"
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   845
| "\<lbrakk>flows_shm s p p'; one_flow_shm s p' p''\<rbrakk> \<Longrightarrow> flows_shm s p p''"
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   846
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   847
definition attached_procs :: "t_state \<Rightarrow> t_shm \<Rightarrow> t_process set"
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   848
where
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   849
  "attached_procs s h \<equiv> {p. \<exists> flag. (p, flag) \<in> procs_of_shm s h}"
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   850
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   851
definition flowed_procs:: "t_state \<Rightarrow> t_shm \<Rightarrow> t_process set"
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   852
where
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   853
  "flowed_procs s h \<equiv> {p'. \<exists> p \<in> attached_procs s h. flows_shm s p p'}"
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   854
26
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   855
inductive flowed_shm:: "t_state \<Rightarrow> t_process \<Rightarrow> t_shm set"
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   856
25
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   857
fun Info_flow_shm :: "t_state \<Rightarrow> t_process \<Rightarrow> t_process set"
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   858
where
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   859
  "Info_flow_shm [] = (\<lambda> p. {p'. flows_shm [] p p'})"
26
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   860
| "Info_flow_shm (Attach p h flag # s) = (\<lambda> p'. 
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   861
     if (p' = p) then flowed_procs s h 
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   862
     else if ()
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   863
    "
25
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   864
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   865
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   866
lemma info_flow_shm_attach:
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   867
  "valid (Attach p h flag # s) \<Longrightarrow> info_flow_shm (Attach p h flag # s) = (\<lambda> pa pb. (info_flow_shm s pa pb) \<or> 
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   868
     (if (pa = p) 
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   869
      then (if (flag = SHM_RDWR) 
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   870
            then (\<exists> flag. (pb, flag) \<in> procs_of_shm s h)
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   871
            else (pb = p)) 
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   872
      else (if (pb = p) 
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   873
            then (pa, SHM_RDWR) \<in> procs_of_shm s h
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   874
            else info_flow_shm s pa pb)) )"
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   875
apply (frule vd_cons, frule vt_grant_os, rule ext, rule ext)
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   876
apply (case_tac "info_flow_shm s pa pb", simp)
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   877
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   878
thm info_flow_shm.cases
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   879
apply (auto split:if_splits intro:info_flow_shm.intros elim:info_flow_shm_cases)
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   880
apply (erule info_flow_shm_cases, simp, simp split:if_splits)
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   881
apply (rule_tac p = pa and p' = p' in info_flow_shm.intros(2), simp+)
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   882
apply (rule notI, erule info_flow_shm.cases, simp+)
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
   883
pr 5
26
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   884
*)
29
622516c0fe34 path_by_shm reconstrain path without duplicated process AND shm
chunhan
parents: 28
diff changeset
   885
lemmas info_flow_shm_simps = info_flow_shm_other (* info_flow_shm_attach *) info_flow_shm_detach info_flow_shm_deleteshm
26
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
   886
  info_flow_shm_clone info_flow_shm_execve info_flow_shm_kill info_flow_shm_exit
23
25e55731ed01 locale of tainting for seeds when same shm/inode bugs
chunhan
parents: 19
diff changeset
   887
19
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
   888
lemma has_same_inode_in_current:
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
   889
  "\<lbrakk>has_same_inode s f f'; valid s\<rbrakk> \<Longrightarrow> f \<in> current_files s \<and> f' \<in> current_files s"
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
   890
by (auto simp add:has_same_inode_def current_files_def)
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
   891
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
   892
lemma has_same_inode_prop1:
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
   893
  "\<lbrakk>has_same_inode s f f'; is_file s f; valid s\<rbrakk> \<Longrightarrow> is_file s f'"
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
   894
by (auto simp:has_same_inode_def is_file_def)
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
   895
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
   896
lemma has_same_inode_prop1':
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
   897
  "\<lbrakk>has_same_inode s f f'; is_file s f'; valid s\<rbrakk> \<Longrightarrow> is_file s f"
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
   898
by (auto simp:has_same_inode_def is_file_def)
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
   899
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
   900
lemma has_same_inode_prop2:
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
   901
  "\<lbrakk>has_same_inode s f f'; file_of_proc_fd s p fd = Some f; valid s\<rbrakk> \<Longrightarrow> is_file s f'"
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
   902
apply (drule has_same_inode_prop1)
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
   903
apply (simp add:file_of_pfd_is_file, simp+)
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
   904
done
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
   905
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
   906
lemma has_same_inode_prop2':
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
   907
  "\<lbrakk>has_same_inode s f f'; file_of_proc_fd s p fd = Some f'; valid s\<rbrakk> \<Longrightarrow> is_file s f"
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
   908
apply (drule has_same_inode_prop1')
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
   909
apply (simp add:file_of_pfd_is_file, simp+)
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
   910
done
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
   911
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
   912
lemma tobj_in_init_alive:
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
   913
  "tobj_in_init obj \<Longrightarrow> init_alive obj"
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
   914
by (case_tac obj, auto)
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
   915
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
   916
lemma tobj_in_alive:
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
   917
  "tobj_in_init obj \<Longrightarrow> alive [] obj"
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
   918
by (case_tac obj, auto simp:is_file_nil)
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
   919
18
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
   920
end
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
   921
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
   922
end