author | chunhan |
Thu, 06 Jun 2013 12:38:44 +0800 | |
changeset 20 | e2c6af3ccb0d |
parent 19 | ced0fcfbcf8e |
child 31 | aa1375b6c0eb |
permissions | -rw-r--r-- |
1 | 1 |
(*<*) |
2 |
theory Co2sobj_prop |
|
10 | 3 |
imports Main Flask Flask_type Static Static_type Sectxt_prop Init_prop Current_files_prop Current_sockets_prop Delete_prop Proc_fd_of_file_prop |
1 | 4 |
begin |
5 |
(*<*) |
|
6 |
||
7 |
context tainting_s begin |
|
8 |
||
19 | 9 |
(********************* cm2smsg simpset ***********************) |
10 |
||
11 |
lemma cm2smsg_other: "\<lbrakk>valid (e # s); \<forall> p q m. e \<noteq> SendMsg p q m\<rbrakk> \<Longrightarrow> cm2smsg (e # s) = cm2smsg s" |
|
12 |
apply (frule vt_grant_os, frule vd_cons, rule ext, rule ext) |
|
13 |
apply (case_tac e) |
|
14 |
apply (auto simp:cm2smsg_def sectxt_of_obj_simps split:option.splits if_splits |
|
15 |
intro:tainted.intro |
|
16 |
||
17 |
lemmas cm2smsg_simps = cm2smsg_nil cm2smsg_nil' cm2smsg_createmsg cm2smsg_other |
|
18 |
||
19 |
||
20 |
||
21 |
(********************* cq2smsgq simpset ***********************) |
|
1 | 22 |
|
19 | 23 |
lemma cq2smsgq_other: "\<forall> p m. e \<noteq> CreateMsg p m \<Longrightarrow> cm2smsg (e # \<tau>) m' = cm2smsg \<tau> m'" |
24 |
apply (case_tac e) |
|
25 |
by (auto simp:cm2smsg_def index_of_msg.simps d2s_aux.simps) |
|
26 |
||
27 |
lemmas cq2smsgq_simps = cm2smsg_nil cm2smsg_nil' cm2smsg_createmsg cm2smsg_other |
|
28 |
||
29 |
||
30 |
lemma sm_in_sqsms: |
|
31 |
"\<lbrakk>m \<in> set (msgs_of_queue s q); q \<in> current_msgqs s; valid s; cq2smsgq s q = Some (qi, qsec, sms); |
|
32 |
cm2smsg s q m = Some sm\<rbrakk> \<Longrightarrow> sm \<in> set sms" |
|
33 |
sorry |
|
34 |
||
35 |
||
36 |
||
37 |
(****************** cf2sfile path simpset ***************) |
|
11 | 38 |
|
6
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
39 |
lemma sroot_only: |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
40 |
"cf2sfile s [] = Some sroot" |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
41 |
by (simp add:cf2sfile_def) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
42 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
43 |
lemma not_file_is_dir: |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
44 |
"\<lbrakk>\<not> is_file s f; f \<in> current_files s; valid s\<rbrakk> \<Longrightarrow> is_dir s f" |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
45 |
by (auto simp:is_file_def current_files_def is_dir_def |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
46 |
dest:finum_has_itag finum_has_ftag' split:t_inode_tag.splits option.splits) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
47 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
48 |
lemma not_dir_is_file: |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
49 |
"\<lbrakk>\<not> is_dir s f; f \<in> current_files s; valid s\<rbrakk> \<Longrightarrow> is_file s f" |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
50 |
by (auto simp:is_file_def current_files_def is_dir_def |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
51 |
dest:finum_has_itag finum_has_ftag' split:t_inode_tag.splits option.splits) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
52 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
53 |
lemma is_file_or_dir: |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
54 |
"\<lbrakk>f \<in> current_files s; valid s\<rbrakk> \<Longrightarrow> is_file s f \<or> is_dir s f" |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
55 |
by (auto dest:not_dir_is_file) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
56 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
57 |
lemma current_file_has_sfile: |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
58 |
"\<lbrakk>f \<in> current_files s; valid s\<rbrakk> \<Longrightarrow> \<exists> sf. cf2sfile s f = Some sf" |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
59 |
apply (induct f) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
60 |
apply (rule_tac x = "sroot" in exI, simp add:sroot_only) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
61 |
apply (frule parentf_in_current', simp, clarsimp) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
62 |
apply (frule parentf_is_dir'', simp) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
63 |
apply (frule is_file_or_dir, simp) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
64 |
apply (auto dest!:current_has_sec' |
8 | 65 |
simp:cf2sfile_def split:option.splits if_splits dest!:get_pfs_secs_prop') |
6
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
66 |
done |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
67 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
68 |
definition sectxt_of_pf :: "t_state \<Rightarrow> t_file \<Rightarrow> security_context_t option" |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
69 |
where |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
70 |
"sectxt_of_pf s f = (case f of [] \<Rightarrow> None | (a # pf) \<Rightarrow> sectxt_of_obj s (O_dir pf))" |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
71 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
72 |
definition get_parentfs_ctxts' :: "t_state \<Rightarrow> t_file \<Rightarrow> (security_context_t list) option" |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
73 |
where |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
74 |
"get_parentfs_ctxts' s f = (case f of [] \<Rightarrow> None | (a # pf) \<Rightarrow> get_parentfs_ctxts s pf)" |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
75 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
76 |
lemma is_file_has_sfile: |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
77 |
"\<lbrakk>is_file s f; valid s\<rbrakk> \<Longrightarrow> \<exists> sec psec asecs. cf2sfile s f = Some |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
78 |
(if (\<not> deleted (O_file f) s \<and> is_init_file f) then Init f else Created, |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
79 |
sec, Some psec, set asecs) \<and> (sectxt_of_obj s (O_file f) = Some sec) \<and> |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
80 |
(sectxt_of_pf s f = Some psec) \<and> (get_parentfs_ctxts' s f = Some asecs)" |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
81 |
apply (case_tac f, simp, drule root_is_dir', simp, simp) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
82 |
apply (frule is_file_in_current) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
83 |
apply (drule current_file_has_sfile, simp) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
84 |
apply (auto simp:cf2sfile_def sectxt_of_pf_def get_parentfs_ctxts'_def split:if_splits option.splits) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
85 |
done |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
86 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
87 |
lemma is_dir_has_sfile: |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
88 |
"\<lbrakk>is_dir s f; valid s\<rbrakk> \<Longrightarrow> (case f of |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
89 |
[] \<Rightarrow> cf2sfile s f = Some sroot |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
90 |
| a # pf \<Rightarrow> (\<exists> sec psec asecs. cf2sfile s f = Some |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
91 |
(if (\<not> deleted (O_dir f) s \<and> is_init_dir f) then Init f else Created, |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
92 |
sec, Some psec, set asecs) \<and> (sectxt_of_obj s (O_dir f) = Some sec) \<and> |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
93 |
(sectxt_of_obj s (O_dir pf) = Some psec) \<and> (get_parentfs_ctxts s pf = Some asecs)))" |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
94 |
apply (case_tac f, simp add:sroot_only) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
95 |
apply (frule is_dir_in_current, frule is_dir_not_file) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
96 |
apply (drule current_file_has_sfile, simp) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
97 |
apply (auto simp:cf2sfile_def split:if_splits option.splits) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
98 |
done |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
99 |
|
7 | 100 |
lemma sroot_set: |
101 |
"valid s \<Longrightarrow> \<exists> sec. sroot = (Init [], sec, None, {}) \<and> sectxt_of_obj s (O_dir []) = Some sec" |
|
102 |
apply (frule root_is_dir) |
|
103 |
apply (drule is_dir_has_sec, simp) |
|
104 |
apply (auto simp:sroot_def sec_of_root_def sectxt_of_obj_def type_of_obj.simps |
|
105 |
root_type_remains root_user_remains |
|
106 |
dest!:root_has_type' root_has_user' root_has_init_type' root_has_init_user' |
|
107 |
split:option.splits) |
|
108 |
done |
|
109 |
||
110 |
lemma cf2sfile_path_file: |
|
111 |
"\<lbrakk>is_file s (f # pf); valid s\<rbrakk> |
|
112 |
\<Longrightarrow> cf2sfile s (f # pf) = ( |
|
113 |
case (cf2sfile s pf) of |
|
114 |
Some (pfi, pfsec, psec, asecs) \<Rightarrow> |
|
115 |
(case (sectxt_of_obj s (O_file (f # pf))) of |
|
116 |
Some fsec \<Rightarrow> Some (if (\<not> deleted (O_file (f # pf)) s \<and> is_init_file (f # pf)) then Init (f # pf) |
|
117 |
else Created, fsec, Some pfsec, asecs \<union> {pfsec}) |
|
118 |
| None \<Rightarrow> None) |
|
119 |
| _ \<Rightarrow> None)" |
|
120 |
apply (frule is_file_in_current, drule parentf_is_dir'', simp) |
|
121 |
apply (frule is_dir_has_sfile, simp, frule is_file_has_sfile, simp) |
|
122 |
apply (frule sroot_set) |
|
123 |
apply (case_tac pf, (clarsimp simp:get_parentfs_ctxts'_def sectxt_of_pf_def)+) |
|
124 |
done |
|
125 |
||
126 |
lemma cf2sfile_path_dir: |
|
127 |
"\<lbrakk>is_dir s (f # pf); valid s\<rbrakk> |
|
128 |
\<Longrightarrow> cf2sfile s (f # pf) = ( |
|
129 |
case (cf2sfile s pf) of |
|
130 |
Some (pfi, pfsec, psec, asecs) \<Rightarrow> |
|
131 |
(case (sectxt_of_obj s (O_dir (f # pf))) of |
|
132 |
Some fsec \<Rightarrow> Some (if (\<not> deleted (O_dir (f # pf)) s \<and> is_init_dir (f # pf)) then Init (f # pf) |
|
133 |
else Created, fsec, Some pfsec, asecs \<union> {pfsec}) |
|
134 |
| None \<Rightarrow> None) |
|
135 |
| _ \<Rightarrow> None)" |
|
136 |
apply (frule is_dir_in_current, drule parentf_is_dir'', simp) |
|
137 |
apply (frule_tac f = "f # pf" in is_dir_has_sfile, simp) |
|
138 |
apply (frule_tac f = "pf" in is_dir_has_sfile, simp) |
|
139 |
apply (frule sroot_set) |
|
140 |
apply (case_tac pf, (clarsimp simp:get_parentfs_ctxts'_def sectxt_of_pf_def)+) |
|
141 |
done |
|
142 |
||
6
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
143 |
lemma cf2sfile_path: |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
144 |
"\<lbrakk>f # pf \<in> current_files s; valid s\<rbrakk> \<Longrightarrow> cf2sfile s (f # pf) = ( |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
145 |
case (cf2sfile s pf) of |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
146 |
Some (pfi, pfsec, psec, asecs) \<Rightarrow> (if (is_file s (f # pf)) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
147 |
then (case (sectxt_of_obj s (O_file (f # pf))) of |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
148 |
Some fsec \<Rightarrow> Some (if (\<not> deleted (O_file (f # pf)) s \<and> is_init_file (f # pf)) then Init (f # pf) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
149 |
else Created, fsec, Some pfsec, asecs \<union> {pfsec}) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
150 |
| None \<Rightarrow> None) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
151 |
else (case (sectxt_of_obj s (O_dir (f # pf))) of |
7 | 152 |
Some fsec \<Rightarrow> Some (if (\<not> deleted (O_dir (f # pf)) s \<and> is_init_dir (f # pf)) then Init (f # pf) |
6
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
153 |
else Created, fsec, Some pfsec, asecs \<union> {pfsec}) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
154 |
| None \<Rightarrow> None) ) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
155 |
| None \<Rightarrow> None)" |
7 | 156 |
apply (drule is_file_or_dir, simp) |
157 |
apply (erule disjE) |
|
158 |
apply (frule cf2sfile_path_file, simp) defer |
|
159 |
apply (frule cf2sfile_path_dir, simp, drule is_dir_not_file) |
|
160 |
apply (auto split:option.splits) |
|
161 |
done |
|
162 |
||
8 | 163 |
lemma cf2sfile_path_file_prop1: |
164 |
"\<lbrakk>is_file s (f # pf); cf2sfile s pf = Some (pfi, pfsec, psec, asecs); valid s\<rbrakk> |
|
165 |
\<Longrightarrow> \<exists> fsec. cf2sfile s (f # pf) = |
|
166 |
Some (if (\<not> deleted (O_file (f # pf)) s \<and> is_init_file (f # pf)) then Init (f # pf) |
|
167 |
else Created, fsec, Some pfsec, asecs \<union> {pfsec}) \<and> |
|
168 |
sectxt_of_obj s (O_file (f # pf)) = Some fsec" |
|
169 |
apply (frule is_file_has_sfile, simp) |
|
170 |
by (auto simp:cf2sfile_path_file) |
|
7 | 171 |
|
8 | 172 |
lemma cf2sfile_path_file_prop2: |
173 |
"\<lbrakk>is_file s (f # pf); cf2sfile s pf = Some (pfi, pfsec, psec, asecs); |
|
174 |
sectxt_of_obj s (O_file (f # pf)) = Some fsec; valid s\<rbrakk> \<Longrightarrow> cf2sfile s (f # pf) = |
|
175 |
Some (if (\<not> deleted (O_file (f # pf)) s \<and> is_init_file (f # pf)) then Init (f # pf) |
|
176 |
else Created, fsec, Some pfsec, asecs \<union> {pfsec})" |
|
177 |
by (drule cf2sfile_path_file_prop1, auto) |
|
7 | 178 |
|
8 | 179 |
lemma cf2sfile_path_dir_prop1: |
180 |
"\<lbrakk>is_dir s (f # pf); cf2sfile s pf = Some (pfi, pfsec, psec, asecs); valid s\<rbrakk> |
|
181 |
\<Longrightarrow> \<exists> fsec. cf2sfile s (f # pf) = |
|
182 |
Some (if (\<not> deleted (O_dir (f # pf)) s \<and> is_init_dir (f # pf)) then Init (f # pf) |
|
183 |
else Created, fsec, Some pfsec, asecs \<union> {pfsec}) \<and> |
|
184 |
sectxt_of_obj s (O_dir (f # pf)) = Some fsec" |
|
185 |
apply (frule is_dir_has_sfile, simp) |
|
186 |
by (auto simp:cf2sfile_path_dir) |
|
6
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
187 |
|
8 | 188 |
lemma cf2sfile_path_dir_prop2: |
189 |
"\<lbrakk>is_dir s (f # pf); cf2sfile s pf = Some (pfi, pfsec, psec, asecs); |
|
190 |
sectxt_of_obj s (O_dir (f # pf)) = Some fsec; valid s\<rbrakk> \<Longrightarrow> cf2sfile s (f # pf) = |
|
191 |
Some (if (\<not> deleted (O_dir (f # pf)) s \<and> is_init_dir (f # pf)) then Init (f # pf) |
|
192 |
else Created, fsec, Some pfsec, asecs \<union> {pfsec})" |
|
193 |
by (drule cf2sfile_path_dir_prop1, auto) |
|
6
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
194 |
|
8 | 195 |
(**************** cf2sfile event list simpset ****************) |
4 | 196 |
|
8 | 197 |
lemma cf2sfile_open_none': |
198 |
"valid (Open p f flag fd None # s) \<Longrightarrow> cf2sfile (Open p f flag fd None # s) f'= cf2sfile s f'" |
|
4 | 199 |
apply (frule vd_cons, frule vt_grant_os) |
200 |
apply (induct f', simp add:cf2sfile_def) |
|
201 |
apply (simp add:cf2sfile_def is_file_simps is_dir_simps current_files_simps sectxt_of_obj_simps |
|
202 |
get_parentfs_ctxts_simps) |
|
203 |
done |
|
204 |
||
205 |
lemma cf2sfile_open_none: |
|
206 |
"valid (Open p f flag fd None # s) \<Longrightarrow> cf2sfile (Open p f flag fd None # s) = cf2sfile s" |
|
8 | 207 |
apply (rule ext) |
208 |
by (simp add:cf2sfile_open_none') |
|
1 | 209 |
|
210 |
lemma cf2sfile_open_some1: |
|
211 |
"\<lbrakk>valid (Open p f flag fd (Some inum) # s); f' \<in> current_files s\<rbrakk> |
|
212 |
\<Longrightarrow> cf2sfile (Open p f flag fd (Some inum) # s) f' = cf2sfile s f'" |
|
8 | 213 |
apply (frule vd_cons, frule vt_grant_os, frule noroot_events) |
4 | 214 |
apply (case_tac "f = f'", simp) |
215 |
apply (induct f', simp add:sroot_only, simp) |
|
3 | 216 |
apply (frule parentf_in_current', simp+) |
4 | 217 |
apply (simp add:cf2sfile_def is_file_simps is_dir_simps current_files_simps sectxt_of_obj_simps |
1 | 218 |
get_parentfs_ctxts_simps) |
219 |
done |
|
220 |
||
221 |
lemma cf2sfile_open_some2: |
|
222 |
"\<lbrakk>valid (Open p f flag fd (Some inum) # s); is_file s f'\<rbrakk> |
|
8 | 223 |
\<Longrightarrow> cf2sfile (Open p f flag fd (Some inum) # s) f' = cf2sfile s f'" |
1 | 224 |
apply (frule vd_cons, drule is_file_in_current) |
225 |
by (simp add:cf2sfile_open_some1) |
|
226 |
||
227 |
lemma cf2sfile_open_some3: |
|
228 |
"\<lbrakk>valid (Open p f flag fd (Some inum) # s); is_dir s f'\<rbrakk> |
|
8 | 229 |
\<Longrightarrow> cf2sfile (Open p f flag fd (Some inum) # s) f' = cf2sfile s f'" |
1 | 230 |
apply (frule vd_cons, drule is_dir_in_current) |
231 |
by (simp add:cf2sfile_open_some1) |
|
232 |
||
6
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
233 |
lemma cf2sfile_open_some4: |
8 | 234 |
"valid (Open p f flag fd (Some inum) # s) \<Longrightarrow> cf2sfile (Open p f flag fd (Some inum) # s) f = ( |
1 | 235 |
case (parent f) of |
236 |
Some pf \<Rightarrow> (case (sectxt_of_obj (Open p f flag fd (Some inum) # s) (O_file f), sectxt_of_obj s (O_dir pf), |
|
237 |
get_parentfs_ctxts s pf) of |
|
238 |
(Some sec, Some psec, Some asecs) \<Rightarrow> Some (Created, sec, Some psec, set asecs) |
|
239 |
| _ \<Rightarrow> None) |
|
240 |
| None \<Rightarrow> None)" |
|
241 |
apply (frule vd_cons, frule vt_grant_os, frule noroot_events) |
|
4 | 242 |
apply (case_tac f, simp) |
243 |
apply (simp add:cf2sfile_def is_file_simps is_dir_simps current_files_simps sectxt_of_obj_simps |
|
244 |
get_parentfs_ctxts_simps) |
|
6
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
245 |
apply (rule impI, (erule conjE)+) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
246 |
apply (drule not_deleted_init_file, simp+) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
247 |
apply (simp add:is_file_in_current) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
248 |
done |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
249 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
250 |
lemma cf2sfile_open: |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
251 |
"\<lbrakk>valid (Open p f flag fd opt # s); f' \<in> current_files (Open p f flag fd opt # s)\<rbrakk> |
8 | 252 |
\<Longrightarrow> cf2sfile (Open p f flag fd opt # s) f' = ( |
253 |
if (opt = None) then cf2sfile s f' |
|
254 |
else if (f' = f) |
|
6
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
255 |
then (case (parent f) of |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
256 |
Some pf \<Rightarrow> (case (sectxt_of_obj (Open p f flag fd opt # s) (O_file f), sectxt_of_obj s (O_dir pf), |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
257 |
get_parentfs_ctxts s pf) of |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
258 |
(Some sec, Some psec, Some asecs) \<Rightarrow> Some (Created, sec, Some psec, set asecs) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
259 |
| _ \<Rightarrow> None) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
260 |
| None \<Rightarrow> None) |
8 | 261 |
else cf2sfile s f')" |
6
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
262 |
apply (case_tac opt) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
263 |
apply (simp add:cf2sfile_open_none) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
264 |
apply (case_tac "f = f'") |
8 | 265 |
apply (simp add:cf2sfile_open_some4 split:option.splits) |
266 |
apply (simp add:cf2sfile_open_some1 current_files_simps) |
|
6
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
267 |
done |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
268 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
269 |
lemma cf2sfile_mkdir1: |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
270 |
"\<lbrakk>valid (Mkdir p f i # s); f' \<in> current_files s\<rbrakk> |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
271 |
\<Longrightarrow> cf2sfile (Mkdir p f i # s) f' = cf2sfile s f'" |
8 | 272 |
apply (frule vd_cons, frule vt_grant_os, frule noroot_events) |
6
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
273 |
apply (case_tac "f = f'", simp) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
274 |
apply (induct f', simp add:sroot_only, simp) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
275 |
apply (frule parentf_in_current', simp+) |
8 | 276 |
apply (case_tac "f = f'", simp) |
277 |
apply (simp add:cf2sfile_path is_file_simps is_dir_simps current_files_simps sectxt_of_obj_simps |
|
6
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
278 |
get_parentfs_ctxts_simps split:if_splits option.splits) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
279 |
done |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
280 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
281 |
lemma cf2sfile_mkdir2: |
8 | 282 |
"\<lbrakk>valid (Mkdir p f i # s); is_file s f'\<rbrakk> |
283 |
\<Longrightarrow> cf2sfile (Mkdir p f i # s) f' = cf2sfile s f'" |
|
6
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
284 |
apply (frule vd_cons, drule is_file_in_current) |
8 | 285 |
by (simp add:cf2sfile_mkdir1) |
6
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
286 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
287 |
lemma cf2sfile_mkdir3: |
8 | 288 |
"\<lbrakk>valid (Mkdir p f i # s); is_dir s f'\<rbrakk> |
289 |
\<Longrightarrow> cf2sfile (Mkdir p f i # s) f' = cf2sfile s f'" |
|
6
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
290 |
apply (frule vd_cons, drule is_dir_in_current) |
8 | 291 |
by (simp add:cf2sfile_mkdir1) |
6
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
292 |
|
8 | 293 |
lemma cf2sfile_mkdir4: |
294 |
"valid (Mkdir p f i # s) |
|
295 |
\<Longrightarrow> cf2sfile (Mkdir p f i # s) f = (case (parent f) of |
|
296 |
Some pf \<Rightarrow> (case (sectxt_of_obj (Mkdir p f i # s) (O_dir f), sectxt_of_obj s (O_dir pf), |
|
297 |
get_parentfs_ctxts s pf) of |
|
298 |
(Some sec, Some psec, Some asecs) \<Rightarrow> Some (Created, sec, Some psec, set asecs) |
|
299 |
| _ \<Rightarrow> None) |
|
300 |
| None \<Rightarrow> None)" |
|
301 |
apply (frule vd_cons, frule vt_grant_os, frule noroot_events) |
|
302 |
apply (case_tac f, simp) |
|
303 |
apply (clarsimp simp:os_grant.simps) |
|
304 |
apply (simp add:sectxt_of_obj_simps) |
|
305 |
apply (frule current_proc_has_sec, simp) |
|
306 |
apply (frule is_dir_has_sec, simp) |
|
307 |
apply (frule get_pfs_secs_prop, simp) |
|
308 |
apply (frule is_dir_not_file) |
|
309 |
apply (auto simp add:cf2sfile_def is_file_simps is_dir_simps current_files_simps sectxt_of_obj_simps |
|
310 |
get_parentfs_ctxts_simps split:option.splits if_splits |
|
311 |
dest:not_deleted_init_dir is_dir_in_current not_deleted_init_file is_file_in_current) |
|
312 |
done |
|
6
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
313 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
314 |
lemma cf2sfile_mkdir: |
8 | 315 |
"\<lbrakk>valid (Mkdir p f i # s); f' \<in> current_files (Mkdir p f i # s)\<rbrakk> |
316 |
\<Longrightarrow> cf2sfile (Mkdir p f i # s) f' = ( |
|
317 |
if (f' = f) |
|
6
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
318 |
then (case (parent f) of |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
319 |
Some pf \<Rightarrow> (case (sectxt_of_obj (Mkdir p f i # s) (O_dir f), sectxt_of_obj s (O_dir pf), |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
320 |
get_parentfs_ctxts s pf) of |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
321 |
(Some sec, Some psec, Some asecs) \<Rightarrow> Some (Created, sec, Some psec, set asecs) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
322 |
| _ \<Rightarrow> None) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
323 |
| None \<Rightarrow> None) |
8 | 324 |
else cf2sfile s f')" |
325 |
apply (case_tac "f = f'") |
|
326 |
apply (simp add:cf2sfile_mkdir4 split:option.splits) |
|
327 |
apply (simp add:cf2sfile_mkdir1 current_files_simps) |
|
328 |
done |
|
329 |
||
330 |
lemma cf2sfile_linkhard1: |
|
331 |
"\<lbrakk>valid (LinkHard p oldf f # s); f' \<in> current_files s\<rbrakk> |
|
332 |
\<Longrightarrow> cf2sfile (LinkHard p oldf f# s) f' = cf2sfile s f'" |
|
333 |
apply (frule vd_cons, frule vt_grant_os, frule noroot_events) |
|
334 |
apply (case_tac "f = f'", simp) |
|
335 |
apply (induct f', simp add:sroot_only, simp) |
|
336 |
apply (frule parentf_in_current', simp+) |
|
337 |
apply (simp add:cf2sfile_def is_file_simps is_dir_simps current_files_simps sectxt_of_obj_simps |
|
338 |
get_parentfs_ctxts_simps split:if_splits option.splits) |
|
339 |
done |
|
340 |
||
341 |
lemma cf2sfile_linkhard2: |
|
342 |
"\<lbrakk>valid (LinkHard p oldf f # s); is_file s f'\<rbrakk> |
|
343 |
\<Longrightarrow> cf2sfile (LinkHard p oldf f # s) f' = cf2sfile s f'" |
|
344 |
apply (frule vd_cons, drule is_file_in_current) |
|
345 |
by (simp add:cf2sfile_linkhard1) |
|
346 |
||
347 |
lemma cf2sfile_linkhard3: |
|
348 |
"\<lbrakk>valid (LinkHard p oldf f # s); is_dir s f'\<rbrakk> |
|
349 |
\<Longrightarrow> cf2sfile (LinkHard p oldf f # s) f' = cf2sfile s f'" |
|
350 |
apply (frule vd_cons, drule is_dir_in_current) |
|
351 |
by (simp add:cf2sfile_linkhard1) |
|
352 |
||
353 |
lemma cf2sfile_linkhard4: |
|
354 |
"valid (LinkHard p oldf f # s) |
|
355 |
\<Longrightarrow> cf2sfile (LinkHard p oldf f # s) f = (case (parent f) of |
|
356 |
Some pf \<Rightarrow> (case (sectxt_of_obj (LinkHard p oldf f # s) (O_file f), sectxt_of_obj s (O_dir pf), |
|
357 |
get_parentfs_ctxts s pf) of |
|
358 |
(Some sec, Some psec, Some asecs) \<Rightarrow> Some (Created, sec, Some psec, set asecs) |
|
359 |
| _ \<Rightarrow> None) |
|
360 |
| None \<Rightarrow> None)" |
|
361 |
apply (frule vd_cons, frule vt_grant_os, frule noroot_events) |
|
362 |
apply (case_tac f, simp) |
|
363 |
apply (simp add:cf2sfile_def is_file_simps is_dir_simps current_files_simps sectxt_of_obj_simps |
|
364 |
get_parentfs_ctxts_simps) |
|
365 |
apply (rule impI, (erule conjE)+) |
|
366 |
apply (drule not_deleted_init_file, simp+) |
|
367 |
apply (simp add:is_file_in_current) |
|
368 |
done |
|
369 |
||
370 |
lemma cf2sfile_linkhard: |
|
371 |
"\<lbrakk>valid (LinkHard p oldf f # s); f' \<in> current_files (LinkHard p oldf f # s)\<rbrakk> |
|
372 |
\<Longrightarrow> cf2sfile (LinkHard p oldf f # s) f' = ( |
|
373 |
if (f' = f) |
|
374 |
then (case (parent f) of |
|
375 |
Some pf \<Rightarrow> (case (sectxt_of_obj (LinkHard p oldf f # s) (O_file f), sectxt_of_obj s (O_dir pf), |
|
376 |
get_parentfs_ctxts s pf) of |
|
377 |
(Some sec, Some psec, Some asecs) \<Rightarrow> Some (Created, sec, Some psec, set asecs) |
|
378 |
| _ \<Rightarrow> None) |
|
379 |
| None \<Rightarrow> None) |
|
380 |
else cf2sfile s f')" |
|
381 |
apply (case_tac "f = f'") |
|
382 |
apply (simp add:cf2sfile_linkhard4 split:option.splits) |
|
383 |
apply (simp add:cf2sfile_linkhard1 current_files_simps) |
|
384 |
done |
|
385 |
||
386 |
lemma cf2sfile_other: |
|
387 |
"\<lbrakk>ff \<in> current_files s; |
|
388 |
\<forall> p f flag fd opt. e \<noteq> Open p f flag fd opt; |
|
389 |
\<forall> p fd. e \<noteq> CloseFd p fd; |
|
390 |
\<forall> p f. e \<noteq> UnLink p f; |
|
391 |
\<forall> p f. e \<noteq> Rmdir p f; |
|
392 |
\<forall> p f i. e \<noteq> Mkdir p f i; |
|
393 |
\<forall> p f f'. e \<noteq> LinkHard p f f'; |
|
394 |
valid (e # s)\<rbrakk> \<Longrightarrow> cf2sfile (e # s) ff = cf2sfile s ff" |
|
6
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
395 |
apply (frule vd_cons, frule vt_grant_os) |
8 | 396 |
apply (induct ff, simp add:sroot_only) |
397 |
apply (frule parentf_in_current', simp+, case_tac e) |
|
398 |
apply (auto simp:current_files_simps is_file_simps is_dir_simps sectxt_of_obj_simps cf2sfile_path |
|
399 |
split:if_splits option.splits) |
|
400 |
done |
|
6
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
401 |
|
10 | 402 |
lemma cf2sfile_other': |
403 |
"\<lbrakk>valid (e # s); |
|
404 |
\<forall> p f flag fd opt. e \<noteq> Open p f flag fd opt; |
|
405 |
\<forall> p fd. e \<noteq> CloseFd p fd; |
|
406 |
\<forall> p f. e \<noteq> UnLink p f; |
|
407 |
\<forall> p f. e \<noteq> Rmdir p f; |
|
408 |
\<forall> p f i. e \<noteq> Mkdir p f i; |
|
409 |
\<forall> p f f'. e \<noteq> LinkHard p f f'; |
|
410 |
ff \<in> current_files s\<rbrakk> \<Longrightarrow> cf2sfile (e # s) ff = cf2sfile s ff" |
|
411 |
by (auto intro!:cf2sfile_other) |
|
412 |
||
8 | 413 |
lemma cf2sfile_unlink: |
414 |
"\<lbrakk>valid (UnLink p f # s); f' \<in> current_files (UnLink p f # s)\<rbrakk> |
|
415 |
\<Longrightarrow> cf2sfile (UnLink p f # s) f' = cf2sfile s f'" |
|
416 |
apply (frule vd_cons, frule vt_grant_os) |
|
417 |
apply (simp add:current_files_simps split:if_splits) |
|
418 |
apply (auto simp:cf2sfile_def sectxt_of_obj_simps get_parentfs_ctxts_simps is_file_simps is_dir_simps |
|
10 | 419 |
split:if_splits option.splits) |
1 | 420 |
done |
421 |
||
10 | 422 |
lemma cf2sfile_rmdir: |
423 |
"\<lbrakk>valid (Rmdir p f # s); f' \<in> current_files (Rmdir p f # s)\<rbrakk> |
|
424 |
\<Longrightarrow> cf2sfile (Rmdir p f # s) f' = cf2sfile s f'" |
|
425 |
apply (frule vd_cons, frule vt_grant_os) |
|
426 |
apply (simp add:current_files_simps split:if_splits) |
|
427 |
apply (auto simp:cf2sfile_def sectxt_of_obj_simps get_parentfs_ctxts_simps is_file_simps is_dir_simps |
|
428 |
split:if_splits option.splits) |
|
1 | 429 |
done |
430 |
||
10 | 431 |
lemma pfdof_simp5: "\<lbrakk>proc_fd_of_file s f = {(p, fd)}; file_of_proc_fd s p fd = None\<rbrakk> \<Longrightarrow> False" |
432 |
apply (subgoal_tac "(p, fd) \<in> proc_fd_of_file s f") |
|
433 |
by (simp add:pfdof_simp2, simp) |
|
434 |
||
435 |
lemma pfdof_simp6: "proc_fd_of_file s f = {(p, fd)} \<Longrightarrow> file_of_proc_fd s p fd = Some f" |
|
436 |
apply (subgoal_tac "(p, fd) \<in> proc_fd_of_file s f") |
|
437 |
by (simp add:pfdof_simp2, simp) |
|
438 |
||
439 |
lemma cf2sfile_closefd: |
|
440 |
"\<lbrakk>valid (CloseFd p fd # s); f \<in> current_files (CloseFd p fd # s)\<rbrakk> |
|
441 |
\<Longrightarrow> cf2sfile (CloseFd p fd # s) f = cf2sfile s f" |
|
442 |
apply (frule vd_cons, frule vt_grant_os) |
|
443 |
apply (simp add:current_files_simps split:if_splits option.splits) |
|
444 |
(* costs too much time, but solved |
|
445 |
||
446 |
apply (auto simp:cf2sfile_def sectxt_of_obj_simps get_parentfs_ctxts_simps is_file_simps is_dir_simps |
|
447 |
split:if_splits option.splits |
|
448 |
dest:init_file_dir_conflict pfdof_simp5 pfdof_simp6 file_of_pfd_is_file |
|
449 |
not_deleted_init_file not_deleted_init_dir is_file_not_dir is_dir_not_file |
|
450 |
dest!:current_has_sec') |
|
451 |
done |
|
452 |
*) |
|
453 |
sorry |
|
1 | 454 |
|
10 | 455 |
lemmas cf2sfile_simps = cf2sfile_open cf2sfile_mkdir cf2sfile_linkhard cf2sfile_other |
456 |
cf2sfile_unlink cf2sfile_rmdir cf2sfile_closefd |
|
457 |
||
458 |
(*********** cfd2sfd simpset *********) |
|
459 |
||
460 |
lemma cfd2sfd_open1: |
|
461 |
"valid (Open p f flags fd opt # s) |
|
462 |
\<Longrightarrow> cfd2sfd (Open p f flags fd opt # s) p fd = |
|
463 |
(case (sectxt_of_obj (Open p f flags fd opt # s) (O_fd p fd), cf2sfile (Open p f flags fd opt # s) f) of |
|
464 |
(Some sec, Some sf) \<Rightarrow> Some (sec, flags, sf) |
|
465 |
| _ \<Rightarrow> None)" |
|
466 |
by (simp add:cfd2sfd_def sectxt_of_obj_simps split:if_splits) |
|
1 | 467 |
|
10 | 468 |
lemma cfd2sfd_open_some2: |
469 |
"\<lbrakk>valid (Open p f flags fd (Some inum) # s); file_of_proc_fd s p' fd' = Some f'\<rbrakk> |
|
470 |
\<Longrightarrow> cfd2sfd (Open p f flags fd (Some inum) # s) p' fd' = cfd2sfd s p' fd'" |
|
471 |
apply (frule vd_cons, frule vt_grant_os) |
|
472 |
apply (frule proc_fd_in_fds, simp) |
|
473 |
apply (frule file_of_proc_fd_in_curf, simp) |
|
474 |
apply (case_tac "f = f'", simp) |
|
475 |
apply (simp add:cfd2sfd_def sectxt_of_obj_simps cf2sfile_open_some1) |
|
476 |
apply (case_tac "p = p'", simp) |
|
477 |
apply (rule conjI, rule impI, simp) |
|
478 |
apply (drule cf2sfile_open_some1, simp) |
|
479 |
apply (auto split:option.splits)[1] |
|
480 |
apply simp |
|
481 |
apply (drule cf2sfile_open_some1, simp) |
|
482 |
apply (auto split:option.splits)[1] |
|
1 | 483 |
done |
484 |
||
10 | 485 |
lemma cfd2sfd_open_none2: |
486 |
"\<lbrakk>valid (Open p f flags fd None # s); file_of_proc_fd s p' fd' = Some f'\<rbrakk> |
|
487 |
\<Longrightarrow> cfd2sfd (Open p f flags fd None # s) p' fd' = cfd2sfd s p' fd'" |
|
488 |
apply (frule vd_cons, frule vt_grant_os) |
|
489 |
apply (frule proc_fd_in_fds, simp) |
|
490 |
apply (frule file_of_proc_fd_in_curf, simp) |
|
491 |
apply (simp add:cfd2sfd_def sectxt_of_obj_simps cf2sfile_open_none) |
|
492 |
apply (case_tac "p = p'", simp) |
|
493 |
apply (rule conjI, rule impI, simp) |
|
494 |
apply (drule cf2sfile_open_none) |
|
495 |
apply (auto split:option.splits)[1] |
|
496 |
apply simp |
|
497 |
apply (drule cf2sfile_open_none) |
|
498 |
apply (auto split:option.splits)[1] |
|
499 |
done |
|
500 |
||
501 |
lemma cfd2sfd_open2: |
|
502 |
"\<lbrakk>valid (Open p f flags fd opt # s); file_of_proc_fd s p' fd' = Some f'\<rbrakk> |
|
503 |
\<Longrightarrow> cfd2sfd (Open p f flags fd opt # s) p' fd' = cfd2sfd s p' fd'" |
|
504 |
apply (case_tac opt) |
|
505 |
apply (simp add:cfd2sfd_open_none2) |
|
506 |
apply (simp add:cfd2sfd_open_some2) |
|
1 | 507 |
done |
508 |
||
10 | 509 |
lemma cfd2sfd_open: |
510 |
"\<lbrakk>valid (Open p f flags fd opt # s); file_of_proc_fd (Open p f flags fd opt # s) p' fd' = Some f'\<rbrakk> |
|
511 |
\<Longrightarrow> cfd2sfd (Open p f flags fd opt # s) p' fd' = (if (p' = p \<and> fd' = fd) then |
|
512 |
(case (sectxt_of_obj (Open p f flags fd opt # s) (O_fd p fd), cf2sfile (Open p f flags fd opt # s) f) of |
|
513 |
(Some sec, Some sf) \<Rightarrow> Some (sec, flags, sf) |
|
514 |
| _ \<Rightarrow> None) else cfd2sfd s p' fd')" |
|
515 |
apply (simp split:if_splits) |
|
516 |
apply (simp add:cfd2sfd_open1 split:option.splits) |
|
517 |
apply (simp add:cfd2sfd_open2) |
|
518 |
apply (rule impI, simp) |
|
1 | 519 |
done |
520 |
||
10 | 521 |
lemma cfd2sfd_closefd: |
522 |
"\<lbrakk>valid (CloseFd p fd # s); file_of_proc_fd (CloseFd p fd # s) p' fd' = Some f\<rbrakk> |
|
523 |
\<Longrightarrow> cfd2sfd (CloseFd p fd # s) p' fd' = cfd2sfd s p' fd'" |
|
524 |
apply (frule vd_cons, frule vt_grant_os) |
|
525 |
apply (frule proc_fd_in_fds, simp) |
|
526 |
apply (frule file_of_proc_fd_in_curf, simp) |
|
527 |
apply (frule cf2sfile_closefd, simp) |
|
528 |
apply (simp add:cfd2sfd_def sectxt_of_obj_simps) |
|
529 |
apply (auto split:option.splits if_splits) |
|
530 |
done |
|
1 | 531 |
|
10 | 532 |
lemma cfd2sfd_clone: |
533 |
"\<lbrakk>valid (Clone p p' fds shms # s); file_of_proc_fd (Clone p p' fds shms # s) p'' fd' = Some f\<rbrakk> |
|
534 |
\<Longrightarrow> cfd2sfd (Clone p p' fds shms # s) p'' fd' = ( |
|
535 |
if (p'' = p') then cfd2sfd s p fd' |
|
536 |
else cfd2sfd s p'' fd')" |
|
537 |
apply (frule vd_cons, frule vt_grant_os) |
|
538 |
apply (frule proc_fd_in_fds, simp) |
|
539 |
apply (frule file_of_proc_fd_in_curf, simp, simp add:current_files_simps) |
|
540 |
apply (frule_tac cf2sfile_other', simp+) |
|
541 |
apply (simp add:cfd2sfd_def sectxt_of_obj_simps) |
|
542 |
apply (case_tac "p'' = p'", simp) |
|
543 |
apply (auto split:option.splits if_splits)[1] |
|
544 |
apply (simp) |
|
545 |
apply (auto split:option.splits if_splits)[1] |
|
1 | 546 |
done |
547 |
||
10 | 548 |
lemma cfd2sfd_execve: |
549 |
"\<lbrakk>valid (Execve p f fds # s); file_of_proc_fd (Execve p f fds # s) p' fd' = Some f'\<rbrakk> |
|
550 |
\<Longrightarrow> cfd2sfd (Execve p f fds # s) p' fd' = cfd2sfd s p' fd'" |
|
551 |
apply (frule vd_cons, frule vt_grant_os) |
|
552 |
apply (frule proc_fd_in_fds, simp) |
|
553 |
apply (frule file_of_proc_fd_in_curf, simp, simp add:current_files_simps) |
|
554 |
apply (frule_tac cf2sfile_other', simp+) |
|
555 |
apply (simp add:cfd2sfd_def sectxt_of_obj_simps) |
|
556 |
apply (case_tac "p' = p", simp) |
|
557 |
apply (auto split:option.splits if_splits)[1] |
|
558 |
apply (simp) |
|
559 |
apply (auto split:option.splits if_splits)[1] |
|
1 | 560 |
done |
561 |
||
10 | 562 |
lemma cfd2sfd_kill: |
563 |
"\<lbrakk>valid (Kill p p'' # s); file_of_proc_fd (Kill p p'' # s) p' fd' = Some f'\<rbrakk> |
|
564 |
\<Longrightarrow> cfd2sfd (Kill p p'' # s) p' fd' = cfd2sfd s p' fd'" |
|
565 |
apply (frule vd_cons, frule vt_grant_os) |
|
566 |
apply (frule proc_fd_in_fds, simp) |
|
567 |
apply (frule proc_fd_in_procs, simp) |
|
568 |
apply (frule file_of_proc_fd_in_curf, simp, simp add:current_files_simps) |
|
569 |
apply (frule_tac cf2sfile_other', simp+) |
|
570 |
apply (simp add:cfd2sfd_def sectxt_of_obj_simps) |
|
571 |
apply (auto split:option.splits if_splits) |
|
1 | 572 |
done |
573 |
||
10 | 574 |
lemma cfd2sfd_exit: |
575 |
"\<lbrakk>valid (Exit p # s); file_of_proc_fd (Exit p # s) p' fd' = Some f'\<rbrakk> |
|
576 |
\<Longrightarrow> cfd2sfd (Exit p # s) p' fd' = cfd2sfd s p' fd'" |
|
577 |
apply (frule vd_cons, frule vt_grant_os) |
|
578 |
apply (frule proc_fd_in_fds, simp) |
|
579 |
apply (frule proc_fd_in_procs, simp) |
|
580 |
apply (frule file_of_proc_fd_in_curf, simp, simp add:current_files_simps) |
|
581 |
apply (frule_tac cf2sfile_other', simp+) |
|
582 |
apply (simp add:cfd2sfd_def sectxt_of_obj_simps) |
|
583 |
apply (auto split:option.splits if_splits) |
|
1 | 584 |
done |
585 |
||
10 | 586 |
lemma cfd2sfd_other: |
587 |
"\<lbrakk>valid (e # s); file_of_proc_fd (e # s) p' fd' = Some f'; |
|
588 |
\<forall> p f flags fd opt. e \<noteq> Open p f flags fd opt; |
|
589 |
\<forall> p p'' fds shms. e \<noteq> Clone p p'' fds shms\<rbrakk> |
|
590 |
\<Longrightarrow> cfd2sfd (e # s) p' fd' = cfd2sfd s p' fd'" |
|
591 |
apply (frule vd_cons, frule vt_grant_os) |
|
592 |
apply (frule proc_fd_in_fds, simp) |
|
593 |
apply (frule proc_fd_in_procs, simp) |
|
594 |
apply (frule file_of_proc_fd_in_curf, simp) |
|
595 |
apply (case_tac e) |
|
596 |
apply (auto intro!:cfd2sfd_execve cfd2sfd_closefd cfd2sfd_kill cfd2sfd_exit) |
|
597 |
apply (auto simp:cfd2sfd_def sectxt_of_obj_simps current_files_simps cf2sfile_simps split:option.splits) |
|
598 |
apply (auto dest!:current_has_sec' dest:file_of_proc_fd_in_curf proc_fd_in_fds) |
|
599 |
done |
|
600 |
||
601 |
lemmas cfd2sfd_simps = cfd2sfd_open cfd2sfd_clone cfd2sfd_other |
|
602 |
||
603 |
(********** cpfd2sfds simpset **********) |
|
604 |
||
605 |
lemma current_filefd_has_flags: |
|
606 |
"\<lbrakk>file_of_proc_fd s p fd = Some f; valid s\<rbrakk> \<Longrightarrow> \<exists> flags. flags_of_proc_fd s p fd = Some flags" |
|
607 |
apply (induct s arbitrary:p) |
|
608 |
apply (simp only:flags_of_proc_fd.simps file_of_proc_fd.simps init_filefd_prop4) |
|
609 |
apply (frule vd_cons, frule vt_grant_os, case_tac a) |
|
610 |
apply (auto split:if_splits option.splits dest:proc_fd_in_fds) |
|
611 |
done |
|
612 |
||
613 |
lemma current_filefd_has_flags': |
|
614 |
"\<lbrakk>flags_of_proc_fd s p fd = None; valid s\<rbrakk> \<Longrightarrow> file_of_proc_fd s p fd = None" |
|
615 |
apply (case_tac "file_of_proc_fd s p fd") |
|
616 |
apply (simp, drule current_filefd_has_flags, simp+) |
|
1 | 617 |
done |
618 |
||
10 | 619 |
lemma current_file_has_sfile': |
620 |
"\<lbrakk>cf2sfile s f = None; valid s\<rbrakk> \<Longrightarrow> f \<notin> current_files s" |
|
621 |
by (rule notI, drule current_file_has_sfile, simp+) |
|
1 | 622 |
|
10 | 623 |
lemma current_filefd_has_sfd: |
624 |
"\<lbrakk>file_of_proc_fd s p fd = Some f; valid s\<rbrakk> \<Longrightarrow> \<exists>sfd. cfd2sfd s p fd = Some sfd" |
|
625 |
by (auto simp:cfd2sfd_def split:option.splits dest!:current_has_sec' current_file_has_sfile' |
|
626 |
dest:file_of_proc_fd_in_curf proc_fd_in_fds current_filefd_has_flags) |
|
627 |
||
628 |
lemma current_filefd_has_sfd': |
|
629 |
"\<lbrakk>cfd2sfd s p fd = None; valid s\<rbrakk> \<Longrightarrow> file_of_proc_fd s p fd = None" |
|
630 |
by (case_tac "file_of_proc_fd s p fd", auto dest:current_filefd_has_sfd) |
|
1 | 631 |
|
12 | 632 |
lemma cpfd2sfds_open1: |
633 |
"valid (Open p f flags fd opt # s) \<Longrightarrow> |
|
634 |
cpfd2sfds (Open p f flags fd opt # s) p = ( |
|
635 |
case (cfd2sfd (Open p f flags fd opt # s) p fd) of |
|
10 | 636 |
Some sfd \<Rightarrow> (cpfd2sfds s p) \<union> {sfd} |
637 |
| _ \<Rightarrow> cpfd2sfds s p)" |
|
638 |
apply (frule vd_cons, frule vt_grant_os) |
|
639 |
apply (split option.splits) |
|
640 |
apply (rule conjI, rule impI, drule current_filefd_has_sfd', simp, simp) |
|
641 |
apply (rule allI, rule impI) |
|
642 |
apply (rule set_eqI, rule iffI) |
|
12 | 643 |
apply (case_tac "x = a", simp) |
10 | 644 |
unfolding cpfd2sfds_def |
13 | 645 |
apply (erule CollectE, (erule conjE|erule bexE)+) |
646 |
apply (simp add:proc_file_fds_def split:if_splits) |
|
647 |
apply (erule exE, rule_tac x = fda in exI) |
|
648 |
apply (simp add:cfd2sfd_open2) |
|
649 |
apply (case_tac "x = a", simp add:proc_file_fds_def) |
|
12 | 650 |
apply (rule_tac x = fd in exI, simp+) |
13 | 651 |
apply (erule conjE|erule bexE)+ |
652 |
apply (rule_tac x = fda in bexI) |
|
653 |
apply (simp add:proc_file_fds_def, erule exE) |
|
654 |
apply (simp add:cfd2sfd_open2) |
|
655 |
apply (simp add:proc_file_fds_def) |
|
12 | 656 |
done |
1 | 657 |
|
12 | 658 |
lemma cpfd2sfds_open1': |
10 | 659 |
"valid (Open p f flags fd opt # s) \<Longrightarrow> |
660 |
cpfd2sfds (Open p f flags fd opt # s) p = ( |
|
661 |
case (sectxt_of_obj (Open p f flags fd opt # s) (O_fd p fd), cf2sfile (Open p f flags fd opt # s) f) of |
|
662 |
(Some sec, Some sf) \<Rightarrow> (cpfd2sfds s p) \<union> {(sec, flags, sf)} |
|
663 |
| _ \<Rightarrow> cpfd2sfds s p)" |
|
664 |
apply (frule cfd2sfd_open1) |
|
12 | 665 |
apply (auto dest:cpfd2sfds_open1 split:option.splits) |
666 |
done |
|
667 |
||
668 |
lemma cpfd2sfds_open2: |
|
669 |
"\<lbrakk>valid (Open p f flags fd opt # s); p' \<noteq> p\<rbrakk> \<Longrightarrow> cpfd2sfds (Open p f flags fd opt # s) p' = cpfd2sfds s p'" |
|
670 |
apply (frule vt_grant_os, frule vd_cons) |
|
671 |
unfolding cpfd2sfds_def |
|
672 |
apply (rule set_eqI, rule iffI) |
|
13 | 673 |
apply (simp add:proc_file_fds_def) |
674 |
apply (erule exE|erule conjE)+ |
|
12 | 675 |
apply (simp only:file_of_proc_fd.simps cfd2sfd_open2 split:if_splits) |
13 | 676 |
apply (rule_tac x = fda in exI, simp) |
677 |
apply (simp add:proc_file_fds_def) |
|
678 |
apply (erule exE|erule conjE)+ |
|
12 | 679 |
apply (rule_tac x = fda in exI, simp add:cfd2sfd_open2) |
680 |
done |
|
1 | 681 |
|
10 | 682 |
lemma cpfd2sfds_open: |
683 |
"valid (Open p f flags fd opt # s) |
|
684 |
\<Longrightarrow> cpfd2sfds (Open p f flags fd opt # s) = (cpfd2sfds s) (p := ( |
|
685 |
case (sectxt_of_obj (Open p f flags fd opt # s) (O_fd p fd), cf2sfile (Open p f flags fd opt # s) f) of |
|
686 |
(Some sec, Some sf) \<Rightarrow> (cpfd2sfds s p) \<union> {(sec, flags, sf)} |
|
687 |
| _ \<Rightarrow> cpfd2sfds s p))" |
|
688 |
apply (rule ext) |
|
12 | 689 |
apply (case_tac "x \<noteq> p") |
690 |
apply (simp add:cpfd2sfds_open2) |
|
691 |
apply (simp add:cpfd2sfds_open1') |
|
692 |
done |
|
1 | 693 |
|
12 | 694 |
lemma cpfd2sfds_execve: |
13 | 695 |
"valid (Execve p f fds # s) |
696 |
\<Longrightarrow> cpfd2sfds (Execve p f fds # s) = (cpfd2sfds s) (p := {sfd. \<exists> fd \<in> fds. \<exists> f. file_of_proc_fd s p fd = Some f \<and> cfd2sfd s p fd = Some sfd})" |
|
697 |
apply (frule vd_cons, frule vt_grant_os) |
|
698 |
apply (rule ext) |
|
699 |
apply (rule set_eqI, rule iffI) |
|
700 |
unfolding cpfd2sfds_def proc_file_fds_def |
|
701 |
apply (erule CollectE| erule bexE| erule conjE| erule exE| rule conjI)+ |
|
702 |
apply (simp split:if_splits) |
|
703 |
apply (frule_tac p' = p and fd' = fd in cfd2sfd_other, simp+) |
|
704 |
apply (rule_tac x = fd in bexI, simp+) |
|
705 |
apply (simp add:cpfd2sfds_def proc_file_fds_def) |
|
706 |
apply (frule_tac p' = x and fd' = fd in cfd2sfd_other, simp+) |
|
707 |
apply (rule_tac x = fd in exI, simp) |
|
708 |
apply (simp split:if_splits) |
|
709 |
apply (erule CollectE| erule bexE| erule conjE| erule exE| rule conjI)+ |
|
710 |
apply (rule_tac x = fd in exI, simp) |
|
711 |
apply (frule_tac p' = x and fd' = fd in cfd2sfd_other, simp+) |
|
712 |
apply (simp add:cpfd2sfds_def proc_file_fds_def) |
|
713 |
apply (erule CollectE| erule bexE| erule conjE| erule exE| rule conjI)+ |
|
714 |
apply (rule_tac x = fd in exI, simp) |
|
715 |
apply (frule_tac p' = x and fd' = fd in cfd2sfd_other, simp+) |
|
716 |
done |
|
717 |
||
718 |
lemma cpfd2sfds_clone: |
|
719 |
"valid (Clone p p' fds shms # s) |
|
720 |
\<Longrightarrow> cpfd2sfds (Clone p p' fds shms # s) = (cpfd2sfds s) (p' := {sfd. \<exists> fd \<in> fds. \<exists> f. file_of_proc_fd s p fd = Some f \<and> cfd2sfd s p fd = Some sfd})" |
|
721 |
apply (frule vd_cons, frule vt_grant_os) |
|
722 |
apply (rule ext) |
|
723 |
apply (rule set_eqI, rule iffI) |
|
724 |
unfolding cpfd2sfds_def proc_file_fds_def |
|
725 |
apply (erule CollectE| erule bexE| erule conjE| erule exE| rule conjI)+ |
|
726 |
apply (simp split:if_splits) |
|
727 |
apply (frule_tac p'' = p' and fd' = fd in cfd2sfd_clone, simp+) |
|
728 |
apply (rule_tac x = fd in bexI, simp+) |
|
729 |
apply (simp add:cpfd2sfds_def proc_file_fds_def) |
|
730 |
apply (frule_tac p'' = x and fd' = fd in cfd2sfd_clone, simp+) |
|
731 |
apply (rule_tac x = fd in exI, simp) |
|
732 |
apply (simp split:if_splits) |
|
733 |
apply (erule CollectE| erule bexE| erule conjE| erule exE| rule conjI)+ |
|
734 |
apply (rule_tac x = fd in exI, simp) |
|
735 |
apply (frule_tac p'' = p' and fd' = fd in cfd2sfd_clone, simp+) |
|
736 |
apply (simp add:cpfd2sfds_def proc_file_fds_def) |
|
737 |
apply (erule CollectE| erule bexE| erule conjE| erule exE| rule conjI)+ |
|
738 |
apply (rule_tac x = fd in exI, simp) |
|
739 |
apply (frule_tac p'' = x and fd' = fd in cfd2sfd_clone, simp+) |
|
740 |
done |
|
12 | 741 |
|
742 |
lemma cpfd2sfds_other: |
|
743 |
"\<lbrakk>valid (e # s); |
|
13 | 744 |
\<forall> p f flags fd opt. e \<noteq> Open p f flags fd opt; |
745 |
\<forall> p f fds. e \<noteq> Execve p f fds; |
|
746 |
\<forall> p p'. e \<noteq> Kill p p'; |
|
747 |
\<forall> p. e \<noteq> Exit p; |
|
748 |
\<forall> p fd. e \<noteq> CloseFd p fd; |
|
749 |
\<forall> p p' fds shms. e \<noteq> Clone p p' fds shms\<rbrakk> \<Longrightarrow> cpfd2sfds (e # s) = cpfd2sfds s" |
|
750 |
apply (frule vd_cons, frule vt_grant_os) |
|
751 |
apply (rule ext) |
|
752 |
unfolding cpfd2sfds_def proc_file_fds_def |
|
753 |
apply (case_tac e) |
|
754 |
using cfd2sfd_other |
|
755 |
by auto |
|
756 |
||
757 |
lemma cpfd2sfds_kill: |
|
758 |
"valid (Kill p p' # s) \<Longrightarrow> cpfd2sfds (Kill p p' # s) = (cpfd2sfds s) (p' := {})" |
|
759 |
apply (frule vd_cons, frule vt_grant_os) |
|
760 |
apply (rule ext, rule set_eqI) |
|
761 |
unfolding cpfd2sfds_def proc_file_fds_def |
|
762 |
apply (rule iffI) |
|
763 |
apply (erule CollectE| erule bexE| erule conjE| erule exE| rule conjI)+ |
|
764 |
apply (simp split:if_splits add: cpfd2sfds_def proc_file_fds_def) |
|
765 |
apply (rule_tac x = fd in exI, simp) |
|
766 |
apply (drule_tac p' = x and fd' = fd in cfd2sfd_other, simp+) |
|
767 |
apply (simp split:if_splits add: cpfd2sfds_def proc_file_fds_def) |
|
768 |
apply (erule CollectE| erule bexE| erule conjE| erule exE| rule conjI)+ |
|
769 |
apply (rule_tac x = fd in exI, simp) |
|
770 |
apply (drule_tac p' = x and fd' = fd in cfd2sfd_other, simp+) |
|
771 |
done |
|
772 |
||
773 |
lemma cpfd2sfds_exit: |
|
774 |
"valid (Exit p # s) \<Longrightarrow> cpfd2sfds (Exit p # s) = (cpfd2sfds s) (p := {})" |
|
775 |
apply (frule vd_cons, frule vt_grant_os) |
|
776 |
apply (rule ext, rule set_eqI) |
|
777 |
unfolding cpfd2sfds_def proc_file_fds_def |
|
778 |
apply (rule iffI) |
|
779 |
apply (erule CollectE| erule bexE| erule conjE| erule exE| rule conjI)+ |
|
780 |
apply (simp split:if_splits add: cpfd2sfds_def proc_file_fds_def) |
|
781 |
apply (rule_tac x = fd in exI, simp) |
|
782 |
apply (drule_tac p' = x and fd' = fd in cfd2sfd_other, simp+) |
|
783 |
apply (simp split:if_splits add: cpfd2sfds_def proc_file_fds_def) |
|
784 |
apply (erule CollectE| erule bexE| erule conjE| erule exE| rule conjI)+ |
|
785 |
apply (rule_tac x = fd in exI, simp) |
|
786 |
apply (drule_tac p' = x and fd' = fd in cfd2sfd_other, simp+) |
|
787 |
done |
|
788 |
||
789 |
lemma cpfd2sfds_closefd: |
|
790 |
"valid (CloseFd p fd # s) \<Longrightarrow> cpfd2sfds (CloseFd p fd # s) = (cpfd2sfds s) (p := |
|
791 |
if (fd \<in> proc_file_fds s p) |
|
792 |
then (case (cfd2sfd s p fd) of |
|
793 |
Some sfd \<Rightarrow> (if (\<exists> fd' f'. fd' \<noteq> fd \<and> file_of_proc_fd s p fd' = Some f' \<and> cfd2sfd s p fd' = Some sfd) |
|
794 |
then cpfd2sfds s p else cpfd2sfds s p - {sfd}) |
|
795 |
| _ \<Rightarrow> cpfd2sfds s p) |
|
796 |
else cpfd2sfds s p)" |
|
797 |
apply (frule vd_cons) |
|
798 |
apply (rule ext, rule set_eqI, rule iffI) |
|
799 |
unfolding cpfd2sfds_def proc_file_fds_def |
|
800 |
apply (erule CollectE| erule bexE| erule conjE| erule exE| rule conjI)+ |
|
801 |
apply (simp split:if_splits) |
|
802 |
apply (rule conjI, rule impI, rule conjI, rule impI, erule exE) |
|
803 |
apply (frule_tac p = p and fd = fd in current_filefd_has_sfd, simp) |
|
804 |
apply (erule exE, simp) |
|
805 |
apply (rule conjI, rule impI, (erule exE|erule conjE)+) |
|
806 |
apply (rule_tac x = fda in exI, simp, simp add:cfd2sfd_closefd) |
|
807 |
||
808 |
apply (rule impI, rule conjI) |
|
809 |
apply (rule_tac x = fda in exI, simp, simp add:cfd2sfd_closefd) |
|
810 |
apply (rule notI, simp) |
|
811 |
apply (erule_tac x = fda in allE, simp add:cfd2sfd_closefd) |
|
812 |
||
813 |
apply (rule impI, simp add:cpfd2sfds_def proc_file_fds_def) |
|
814 |
apply (erule exE, rule_tac x = fda in exI, simp add:cfd2sfd_closefd) |
|
815 |
||
816 |
apply (rule impI| rule conjI)+ |
|
817 |
apply (rule_tac x = fda in exI, simp add:cfd2sfd_closefd) |
|
818 |
||
819 |
apply (rule impI, simp add:cpfd2sfds_def proc_file_fds_def) |
|
820 |
apply (rule_tac x = fda in exI, simp add:cfd2sfd_closefd) |
|
12 | 821 |
|
13 | 822 |
apply (simp split:if_splits) |
823 |
apply (frule_tac p = p and fd = fd in current_filefd_has_sfd, simp) |
|
824 |
apply (erule exE, simp) |
|
825 |
apply (case_tac "\<exists>fd'. fd' \<noteq> fd \<and> (\<exists>f'. file_of_proc_fd s p fd' = Some f') \<and> cfd2sfd s p fd' = Some sfd") |
|
826 |
apply simp |
|
827 |
apply (case_tac "xa = sfd") |
|
828 |
apply (erule exE|erule conjE)+ |
|
829 |
apply (rule_tac x = fd' in exI, simp add:cfd2sfd_closefd) |
|
830 |
apply (erule exE|erule conjE)+ |
|
831 |
apply (rule_tac x = fda in exI, simp add:cfd2sfd_closefd) |
|
832 |
apply (rule notI, simp) |
|
833 |
apply (simp, (erule exE|erule conjE)+) |
|
834 |
apply (rule_tac x = fda in exI, simp add:cfd2sfd_closefd) |
|
835 |
apply (rule notI, simp) |
|
836 |
apply (erule exE|erule conjE)+ |
|
837 |
apply (rule_tac x = fda in exI, simp add:cfd2sfd_closefd) |
|
838 |
apply (rule notI, simp) |
|
839 |
apply (simp add:cpfd2sfds_def proc_file_fds_def) |
|
840 |
apply (erule exE|erule conjE)+ |
|
841 |
apply (rule_tac x = fda in exI, simp add:cfd2sfd_closefd) |
|
842 |
done |
|
843 |
||
844 |
lemmas cpfd2sfds_simps = cpfd2sfds_open cpfd2sfds_execve cpfd2sfds_clone cpfd2sfds_kill cpfd2sfds_exit |
|
845 |
cpfd2sfds_closefd cpfd2sfds_other |
|
846 |
||
847 |
(********* ch2sshm simpset ********) |
|
848 |
||
849 |
lemma ch2sshm_createshm: |
|
850 |
"valid (CreateShM p h # s) |
|
851 |
\<Longrightarrow> ch2sshm (CreateShM p h # s) = (ch2sshm s) (h := |
|
852 |
(case (sectxt_of_obj (CreateShM p h # s) (O_shm h)) of |
|
853 |
Some sec \<Rightarrow> |
|
854 |
Some (if (\<not> deleted (O_shm h) s \<and> h \<in> init_shms) then Init h else Created, sec) |
|
855 |
| _ \<Rightarrow> None))" |
|
856 |
apply (frule vd_cons, frule vt_grant_os) |
|
857 |
apply (auto simp:ch2sshm_def sectxt_of_obj_simps dest!:current_has_sec' split:option.splits if_splits) |
|
858 |
done |
|
859 |
||
860 |
lemma ch2sshm_other: |
|
861 |
"\<lbrakk>valid (e # s); |
|
862 |
\<forall> p h. e \<noteq> CreateShM p h; |
|
863 |
h' \<in> current_shms (e # s)\<rbrakk> \<Longrightarrow> ch2sshm (e # s) h' = ch2sshm s h'" |
|
864 |
apply (frule vd_cons, frule vt_grant_os) |
|
865 |
apply (case_tac e) |
|
866 |
apply (auto simp:ch2sshm_def sectxt_of_obj_simps dest!:current_has_sec' split:option.splits if_splits) |
|
867 |
done |
|
868 |
||
869 |
lemmas ch2sshm_simps = ch2sshm_createshm ch2sshm_other |
|
870 |
||
871 |
lemma current_shm_has_sh: |
|
872 |
"\<lbrakk>h \<in> current_shms s; valid s\<rbrakk> \<Longrightarrow> \<exists> sh. ch2sshm s h = Some sh" |
|
873 |
by (auto simp:ch2sshm_def split:option.splits dest!:current_has_sec') |
|
874 |
||
875 |
lemma current_shm_has_sh': |
|
876 |
"\<lbrakk>ch2sshm s h = None; valid s\<rbrakk> \<Longrightarrow> h \<notin> current_shms s" |
|
877 |
by (auto dest:current_shm_has_sh) |
|
878 |
||
879 |
(********** cph2spshs simpset **********) |
|
880 |
||
14 | 881 |
lemma cph2spshs_attach: |
13 | 882 |
"valid (Attach p h flag # s) \<Longrightarrow> |
883 |
cph2spshs (Attach p h flag # s) = (cph2spshs s) (p := |
|
884 |
(case (ch2sshm s h) of |
|
885 |
Some sh \<Rightarrow> cph2spshs s p \<union> {(sh, flag)} |
|
886 |
| _ \<Rightarrow> cph2spshs s p) )" |
|
887 |
apply (frule vd_cons, frule vt_grant_os, rule ext) |
|
888 |
using ch2sshm_other[where e = "Attach p h flag" and s = s] |
|
889 |
apply (auto split del:t_open_must_flag.splits t_open_option_flag.splits split add:if_splits option.splits |
|
14 | 890 |
dest!:current_shm_has_sh' dest: procs_of_shm_prop1 simp:cph2spshs_def) |
891 |
apply (erule_tac x = ha in allE, frule procs_of_shm_prop1, simp, simp) |
|
892 |
apply (erule_tac x = ha in allE, frule procs_of_shm_prop1, simp, simp) |
|
893 |
apply (erule_tac x = ha in allE, frule procs_of_shm_prop1, simp, simp) |
|
894 |
apply (erule_tac x = ha in allE, frule procs_of_shm_prop1, simp, simp) |
|
895 |
apply (erule_tac x = ha in allE, frule procs_of_shm_prop1, simp, simp) |
|
896 |
apply (case_tac "ha = h", simp, frule procs_of_shm_prop1, simp) |
|
897 |
apply (rule_tac x = ha in exI, simp) |
|
898 |
apply (rule_tac x = ha in exI, simp, drule procs_of_shm_prop1, simp, simp) |
|
899 |
apply (rule_tac x = ha in exI, simp) |
|
900 |
apply (frule procs_of_shm_prop1, simp, simp) |
|
901 |
apply (rule impI, simp) |
|
902 |
done |
|
903 |
||
904 |
lemma cph2spshs_detach: "valid (Detach p h # s) \<Longrightarrow> |
|
905 |
cph2spshs (Detach p h # s) = (cph2spshs s) (p := |
|
15 | 906 |
(case (ch2sshm s h, flag_of_proc_shm s p h) of |
907 |
(Some sh, Some flag) \<Rightarrow> if (\<exists> h'. h' \<noteq> h \<and> (p,flag) \<in> procs_of_shm s h' \<and> ch2sshm s h' = Some sh) |
|
908 |
then cph2spshs s p else cph2spshs s p - {(sh, flag)} |
|
14 | 909 |
| _ \<Rightarrow> cph2spshs s p) )" |
910 |
apply (frule vd_cons, frule vt_grant_os, rule ext) |
|
15 | 911 |
apply (case_tac "x = p") defer |
912 |
using ch2sshm_other[where e = "Detach p h" and s = s] |
|
14 | 913 |
apply (auto split del:t_open_must_flag.splits t_open_option_flag.splits split add:if_splits option.splits |
15 | 914 |
dest!:current_shm_has_sh' procs_of_shm_prop4' dest:procs_of_shm_prop1 procs_of_shm_prop3 simp:cph2spshs_def) [1] |
915 |
apply (rule_tac x = ha in exI, frule_tac h = ha in procs_of_shm_prop1, simp, simp) |
|
14 | 916 |
apply (rule_tac x = ha in exI, frule_tac h = ha in procs_of_shm_prop1, simp, simp) |
917 |
apply (rule impI, simp) |
|
15 | 918 |
|
919 |
apply (clarsimp) |
|
920 |
apply (frule current_shm_has_sh, simp, erule exE) |
|
921 |
apply (frule procs_of_shm_prop4, simp, simp) |
|
922 |
apply (rule allI | rule conjI| erule conjE | erule exE | rule impI)+ |
|
923 |
||
924 |
apply (simp only:cph2spshs_def, rule set_eqI, rule iffI) |
|
925 |
apply (erule CollectE | erule exE| erule conjE| rule CollectI)+ |
|
926 |
apply (case_tac "ha = h", simp) |
|
927 |
apply (rule_tac x = sha in exI, rule_tac x = flaga in exI, rule_tac x = ha in exI, simp) |
|
928 |
using ch2sshm_other[where e = "Detach p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
929 |
||
930 |
apply (erule CollectE | erule exE| erule conjE| rule CollectI)+ |
|
931 |
apply (case_tac "ha = h", simp) |
|
932 |
apply (rule_tac x = h' in exI, simp) |
|
933 |
apply (frule_tac flag = flag and flag' = flaga in procs_of_shm_prop3, simp+) |
|
934 |
apply (frule_tac flag = flaga in procs_of_shm_prop4, simp+) |
|
935 |
using ch2sshm_other[where e = "Detach p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
936 |
apply (frule_tac h = h' in procs_of_shm_prop1, simp, simp) |
|
937 |
apply (rule_tac x = ha in exI, simp, frule_tac h = ha in procs_of_shm_prop1, simp+) |
|
938 |
using ch2sshm_other[where e = "Detach p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
939 |
||
940 |
apply (rule allI | rule conjI| erule conjE | erule exE | rule impI)+ |
|
941 |
apply (simp only:cph2spshs_def, rule set_eqI, rule iffI) |
|
942 |
apply (erule CollectE | erule exE| erule conjE| rule DiffI |rule CollectI)+ |
|
943 |
apply (simp split:if_splits) |
|
944 |
apply (rule_tac x = ha in exI, simp, frule_tac h = ha in procs_of_shm_prop1, simp+) |
|
945 |
using ch2sshm_other[where e = "Detach p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
946 |
apply (rule notI, simp split:if_splits) |
|
947 |
apply (erule_tac x = ha in allE, simp, frule_tac h = ha in procs_of_shm_prop1, simp+) |
|
948 |
using ch2sshm_other[where e = "Detach p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
949 |
apply (erule CollectE | erule exE| erule conjE| erule DiffE |rule CollectI)+ |
|
950 |
apply (simp split:if_splits) |
|
951 |
apply (erule_tac x = ha in allE, simp, rule_tac x = ha in exI, simp) |
|
952 |
apply (case_tac "ha = h", simp add:procs_of_shm_prop3, frule_tac h = ha in procs_of_shm_prop1, simp+) |
|
953 |
using ch2sshm_other[where e = "Detach p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
14 | 954 |
done |
13 | 955 |
|
16 | 956 |
lemma cph2spshs_deleteshm: |
957 |
"valid (DeleteShM p h # s) \<Longrightarrow> |
|
958 |
cph2spshs (DeleteShM p h # s) = (\<lambda> p'. |
|
959 |
(case (ch2sshm s h, flag_of_proc_shm s p' h) of |
|
960 |
(Some sh, Some flag) \<Rightarrow> if (\<exists> h'. h' \<noteq> h \<and> (p', flag) \<in> procs_of_shm s h' \<and> ch2sshm s h' = Some sh) |
|
961 |
then cph2spshs s p' else cph2spshs s p' - {(sh, flag)} |
|
962 |
| _ \<Rightarrow> cph2spshs s p') )" |
|
963 |
apply (frule vd_cons, frule vt_grant_os, rule ext) |
|
15 | 964 |
|
16 | 965 |
apply (clarsimp) |
966 |
apply (frule current_shm_has_sh, simp, erule exE, simp, simp split:option.splits) |
|
967 |
apply (rule conjI, rule impI) |
|
968 |
using ch2sshm_other[where e = "DeleteShM p h" and s = s] |
|
969 |
apply (auto split del:t_open_must_flag.splits t_open_option_flag.splits split add:if_splits option.splits |
|
970 |
dest!:current_shm_has_sh' procs_of_shm_prop4' dest:procs_of_shm_prop1 procs_of_shm_prop3 simp:cph2spshs_def) [1] |
|
971 |
apply (rule_tac x = ha in exI, frule_tac h = ha in procs_of_shm_prop1, simp+) |
|
972 |
apply (rule_tac x = ha in exI, simp) |
|
973 |
apply (case_tac "ha = h", simp+, frule_tac h = ha in procs_of_shm_prop1, simp+) |
|
974 |
||
975 |
apply (rule allI | rule conjI| erule conjE | erule exE | rule impI)+ |
|
976 |
||
977 |
apply (simp only:cph2spshs_def, rule set_eqI, rule iffI) |
|
978 |
apply (erule CollectE | erule exE| erule conjE| rule CollectI)+ |
|
979 |
apply (case_tac "ha = h", simp) |
|
980 |
apply (rule_tac x = sha in exI, rule_tac x = flag in exI, rule_tac x = ha in exI, simp) |
|
981 |
using ch2sshm_other[where e = "DeleteShM p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
982 |
||
983 |
apply (erule CollectE | erule exE| erule conjE| rule CollectI)+ |
|
984 |
apply (case_tac "ha = h", simp) |
|
985 |
apply (rule_tac x = h' in exI, simp) |
|
986 |
apply (frule_tac flag = flag in procs_of_shm_prop4, simp+) |
|
987 |
using ch2sshm_other[where e = "DeleteShM p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
988 |
apply (frule_tac h = h' in procs_of_shm_prop1, simp, simp) |
|
989 |
apply (rule_tac x = ha in exI, simp, frule_tac h = ha in procs_of_shm_prop1, simp+) |
|
990 |
using ch2sshm_other[where e = "DeleteShM p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
991 |
||
992 |
apply (rule allI | rule conjI| erule conjE | erule exE | rule impI)+ |
|
993 |
apply (simp only:cph2spshs_def, rule set_eqI, rule iffI) |
|
994 |
apply (erule CollectE | erule exE| erule conjE| rule DiffI |rule CollectI)+ |
|
995 |
apply (simp split:if_splits) |
|
996 |
apply (rule_tac x = ha in exI, simp, frule_tac h = ha in procs_of_shm_prop1, simp+) |
|
997 |
using ch2sshm_other[where e = "DeleteShM p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
998 |
apply (rule notI, simp split:if_splits) |
|
999 |
apply (erule_tac x = ha in allE, simp, frule_tac h = ha in procs_of_shm_prop1, simp+) |
|
1000 |
using ch2sshm_other[where e = "DeleteShM p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
1001 |
apply (erule CollectE | erule exE| erule conjE| erule DiffE |rule CollectI)+ |
|
1002 |
apply (simp split:if_splits) |
|
1003 |
apply (erule_tac x = ha in allE, simp, rule_tac x = ha in exI, simp) |
|
1004 |
apply (case_tac "ha = h", simp add:procs_of_shm_prop4) |
|
1005 |
apply (frule_tac h = ha in procs_of_shm_prop1, simp+) |
|
1006 |
using ch2sshm_other[where e = "DeleteShM p h" and s = s] apply (simp add:procs_of_shm_prop1) |
|
1007 |
done |
|
1008 |
||
1009 |
lemma flag_of_proc_shm_prop1: |
|
1010 |
"\<lbrakk>flag_of_proc_shm s p h = Some flag; valid s\<rbrakk> \<Longrightarrow> (p, flag) \<in> procs_of_shm s h" |
|
1011 |
apply (induct s arbitrary:p) |
|
1012 |
apply (simp add:init_shmflag_has_proc) |
|
1013 |
apply (frule vt_grant_os, frule vd_cons, case_tac a, auto split:if_splits option.splits) |
|
1014 |
done |
|
1015 |
||
1016 |
lemma cph2spshs_clone: |
|
1017 |
"valid (Clone p p' fds shms # s) \<Longrightarrow> |
|
1018 |
cph2spshs (Clone p p' fds shms # s) = (cph2spshs s) (p' := |
|
1019 |
{(sh, flag) | h sh flag. h \<in> shms \<and> ch2sshm s h = Some sh \<and> flag_of_proc_shm s p h = Some flag} )" |
|
1020 |
apply (frule vd_cons, frule vt_grant_os, rule ext) |
|
1021 |
using ch2sshm_other[where e = "Clone p p' fds shms" and s = s] |
|
1022 |
apply (auto split del:t_open_must_flag.splits t_open_option_flag.splits split add:if_splits option.splits |
|
1023 |
dest!:current_shm_has_sh' dest: procs_of_shm_prop1 procs_of_shm_prop2 procs_of_shm_prop3 simp:cph2spshs_def) |
|
1024 |
apply (erule_tac x = h in allE, frule procs_of_shm_prop1, simp, simp add:procs_of_shm_prop4) |
|
1025 |
apply (rule_tac x = h in exI, simp, frule flag_of_proc_shm_prop1, simp+, simp add:procs_of_shm_prop1) |
|
1026 |
apply (rule_tac x = h in exI, simp, frule procs_of_shm_prop1, simp+)+ |
|
1027 |
done |
|
1028 |
||
1029 |
lemma cph2spshs_execve: |
|
1030 |
"valid (Execve p f fds # s) \<Longrightarrow> |
|
1031 |
cph2spshs (Execve p f fds # s) = (cph2spshs s) (p := {})" |
|
1032 |
apply (frule vd_cons, frule vt_grant_os, rule ext) |
|
1033 |
using ch2sshm_other[where e = "Execve p f fds" and s = s] |
|
1034 |
apply (auto split del:t_open_must_flag.splits t_open_option_flag.splits split add:if_splits option.splits |
|
1035 |
dest!:current_shm_has_sh' dest: procs_of_shm_prop1 procs_of_shm_prop2 procs_of_shm_prop3 simp:cph2spshs_def) |
|
1036 |
apply (rule_tac x = h in exI, simp add:procs_of_shm_prop1)+ |
|
1037 |
done |
|
1038 |
||
1039 |
lemma cph2spshs_kill: |
|
1040 |
"valid (Kill p p' # s) \<Longrightarrow> cph2spshs (Kill p p' # s) = (cph2spshs s) (p' := {})" |
|
1041 |
apply (frule vd_cons, frule vt_grant_os, rule ext) |
|
1042 |
using ch2sshm_other[where e = "Kill p p'" and s = s] |
|
1043 |
apply (auto split del:t_open_must_flag.splits t_open_option_flag.splits split add:if_splits option.splits |
|
1044 |
dest!:current_shm_has_sh' dest: procs_of_shm_prop1 procs_of_shm_prop2 procs_of_shm_prop3 simp:cph2spshs_def) |
|
1045 |
apply (rule_tac x = h in exI, simp add:procs_of_shm_prop1)+ |
|
1046 |
done |
|
1047 |
||
1048 |
lemma cph2spshs_exit: |
|
1049 |
"valid (Exit p # s) \<Longrightarrow> cph2spshs (Exit p # s) = (cph2spshs s) (p := {})" |
|
1050 |
apply (frule vd_cons, frule vt_grant_os, rule ext) |
|
1051 |
using ch2sshm_other[where e = "Exit p" and s = s] |
|
1052 |
apply (auto split del:t_open_must_flag.splits t_open_option_flag.splits split add:if_splits option.splits |
|
1053 |
dest!:current_shm_has_sh' dest: procs_of_shm_prop1 procs_of_shm_prop2 procs_of_shm_prop3 simp:cph2spshs_def) |
|
1054 |
apply (rule_tac x = h in exI, simp add:procs_of_shm_prop1)+ |
|
1055 |
done |
|
1056 |
||
1057 |
lemma cph2spshs_createshm: |
|
1058 |
"valid (CreateShM p h # s) \<Longrightarrow> cph2spshs (CreateShM p h # s) = cph2spshs s" |
|
1059 |
apply (frule vt_grant_os, frule vd_cons, rule ext) |
|
1060 |
apply (auto simp:cph2spshs_def) |
|
1061 |
using ch2sshm_createshm |
|
1062 |
apply (auto split del:t_open_must_flag.splits t_open_option_flag.splits split add:if_splits option.splits |
|
1063 |
dest!:current_shm_has_sh' dest: procs_of_shm_prop1 procs_of_shm_prop2 procs_of_shm_prop3 simp:cph2spshs_def) |
|
1064 |
apply (rule_tac x = ha in exI, auto simp:procs_of_shm_prop1) |
|
1065 |
done |
|
15 | 1066 |
|
13 | 1067 |
lemma cph2spshs_other: |
16 | 1068 |
"\<lbrakk>valid (e # s); |
1069 |
\<forall> p h flag. e \<noteq> Attach p h flag; |
|
1070 |
\<forall> p h. e \<noteq> Detach p h; |
|
1071 |
\<forall> p h. e \<noteq> DeleteShM p h; |
|
1072 |
\<forall> p p' fds shms. e \<noteq> Clone p p' fds shms; |
|
1073 |
\<forall> p f fds. e \<noteq> Execve p f fds; |
|
1074 |
\<forall> p p'. e \<noteq> Kill p p'; |
|
1075 |
\<forall> p. e \<noteq> Exit p\<rbrakk> \<Longrightarrow> cph2spshs (e # s) = cph2spshs s" |
|
1076 |
apply (frule vt_grant_os, frule vd_cons, rule ext) |
|
1077 |
unfolding cph2spshs_def |
|
1078 |
apply (rule set_eqI, rule iffI) |
|
1079 |
apply (erule CollectE | erule conjE| erule exE| rule conjI| rule impI| rule CollectI)+ |
|
1080 |
apply (frule procs_of_shm_prop1, simp, rule_tac x= sh in exI, rule_tac x = flag in exI, rule_tac x = h in exI) |
|
1081 |
apply (case_tac e) |
|
1082 |
using ch2sshm_other[where e = e and s = s] |
|
1083 |
apply (auto split del:t_open_must_flag.splits t_open_option_flag.splits split add:if_splits option.splits |
|
1084 |
dest!:current_shm_has_sh' dest: procs_of_shm_prop1 procs_of_shm_prop2 procs_of_shm_prop3 |
|
1085 |
simp:ch2sshm_createshm) |
|
1086 |
apply (rule_tac x = h in exI, case_tac e) |
|
1087 |
using ch2sshm_other[where e = e and s = s] |
|
1088 |
apply (auto split del:t_open_must_flag.splits t_open_option_flag.splits split add:if_splits option.splits |
|
1089 |
dest!:current_shm_has_sh' dest: procs_of_shm_prop1 procs_of_shm_prop2 procs_of_shm_prop3 |
|
1090 |
simp:ch2sshm_createshm) |
|
1091 |
done |
|
13 | 1092 |
|
16 | 1093 |
lemmas cph2spshs_simps = cph2spshs_attach cph2spshs_detach cph2spshs_deleteshm cph2spshs_clone cph2spshs_execve |
1094 |
cph2spshs_exit cph2spshs_kill cph2spshs_other |
|
1 | 1095 |
|
10 | 1096 |
(******** cp2sproc simpset *********) |
1 | 1097 |
|
17 | 1098 |
lemma cp2sproc_clone: |
1099 |
"valid (Clone p p' fds shms # s) \<Longrightarrow> cp2sproc (Clone p p' fds shms # s) = (cp2sproc s) (p' := |
|
1100 |
case (sectxt_of_obj s (O_proc p)) of |
|
1101 |
Some sec \<Rightarrow> Some (Created, sec, |
|
1102 |
{sfd. \<exists> fd \<in> fds. \<exists> f. file_of_proc_fd s p fd = Some f \<and> cfd2sfd s p fd = Some sfd}, |
|
1103 |
{(sh, flag) | h sh flag. h \<in> shms \<and> ch2sshm s h = Some sh \<and> flag_of_proc_shm s p h = Some flag}) |
|
1104 |
| _ \<Rightarrow> None)" |
|
1105 |
apply (frule cph2spshs_clone, frule cpfd2sfds_clone) |
|
1106 |
apply (frule vd_cons, frule vt_grant_os, simp only:os_grant.simps) |
|
1107 |
apply ((erule exE| erule conjE)+, frule not_init_intro_proc, simp, rule ext, case_tac "x = p'", simp) |
|
1108 |
apply (auto simp:cp2sproc_def sectxt_of_obj_simps dest!:current_has_sec' |
|
1109 |
dest:current_proc_has_sec split:option.splits if_splits) |
|
1110 |
done |
|
1111 |
||
1112 |
lemma cp2sproc_other: |
|
1113 |
"\<lbrakk>valid (e # s); |
|
1114 |
\<forall> p f flags fd opt. e \<noteq> Open p f flags fd opt; |
|
1115 |
\<forall> p fd. e \<noteq> CloseFd p fd; |
|
1116 |
\<forall> p h flag. e \<noteq> Attach p h flag; |
|
1117 |
\<forall> p h. e \<noteq> Detach p h; |
|
1118 |
\<forall> p h. e \<noteq> DeleteShM p h; |
|
1119 |
\<forall> p p' fds shms. e \<noteq> Clone p p' fds shms; |
|
1120 |
\<forall> p f fds. e \<noteq> Execve p f fds; |
|
1121 |
\<forall> p p'. e \<noteq> Kill p p'; |
|
1122 |
\<forall> p. e \<noteq> Exit p\<rbrakk> \<Longrightarrow> cp2sproc (e # s) = cp2sproc s" |
|
1123 |
apply (frule cph2spshs_other, simp+, frule cpfd2sfds_other, simp+) |
|
1124 |
apply (frule vt_grant_os, frule vd_cons, rule ext, case_tac e, simp_all) |
|
1125 |
apply (auto simp:cp2sproc_def sectxt_of_obj_simps dest!:current_has_sec' |
|
1126 |
dest:current_proc_has_sec not_deleted_init_proc split:option.splits if_splits) |
|
1127 |
done |
|
1 | 1128 |
|
17 | 1129 |
lemma cp2sproc_open: |
1130 |
"valid (Open p f flags fd opt # s) \<Longrightarrow> |
|
1131 |
cp2sproc (Open p f flags fd opt # s) = (cp2sproc s) (p := |
|
1132 |
case (sectxt_of_obj s (O_proc p), sectxt_of_obj (Open p f flags fd opt # s) (O_fd p fd), |
|
1133 |
cf2sfile (Open p f flags fd opt # s) f) of |
|
1134 |
(Some sec, Some fdsec, Some sf) \<Rightarrow> Some (if (\<not> deleted (O_proc p) s \<and> p \<in> init_procs) |
|
1135 |
then Init p else Created, sec, |
|
1136 |
(cpfd2sfds s p) \<union> {(fdsec, flags, sf)}, cph2spshs s p) |
|
1137 |
| _ \<Rightarrow> None)" |
|
1138 |
apply (frule cph2spshs_other, simp, simp, simp, simp, simp, simp, simp) |
|
1139 |
apply (frule cpfd2sfds_open, frule vt_grant_os, frule vd_cons, rule ext) |
|
1140 |
apply (case_tac "x = p") |
|
1141 |
apply (auto simp:cp2sproc_def sectxt_of_obj_simps current_files_simps |
|
1142 |
dest!:current_has_sec' dest!:current_file_has_sfile' dest:is_file_in_current is_dir_in_current |
|
1143 |
dest:current_proc_has_sec not_deleted_init_proc split:option.splits if_splits) |
|
1144 |
done |
|
1145 |
||
1146 |
lemma cp2sproc_closefd: |
|
1147 |
"valid (CloseFd p fd # s) \<Longrightarrow> |
|
1148 |
cp2sproc (CloseFd p fd # s) = (cp2sproc s) (p := |
|
1149 |
if (fd \<in> proc_file_fds s p) |
|
1150 |
then (case (cfd2sfd s p fd) of |
|
1151 |
Some sfd \<Rightarrow> (if (\<exists> fd' f'. fd' \<noteq> fd \<and> file_of_proc_fd s p fd' = Some f' \<and> cfd2sfd s p fd' = Some sfd) |
|
1152 |
then cp2sproc s p |
|
1153 |
else (case (sectxt_of_obj s (O_proc p)) of |
|
1154 |
Some sec \<Rightarrow> Some (if (\<not> deleted (O_proc p) s \<and> p \<in> init_procs) |
|
1155 |
then Init p else Created, |
|
1156 |
sec, cpfd2sfds s p - {sfd}, cph2spshs s p) |
|
1157 |
| _ \<Rightarrow> None)) |
|
1158 |
| _ \<Rightarrow> cp2sproc s p) |
|
1159 |
else cp2sproc s p)" |
|
1160 |
apply (frule cpfd2sfds_closefd, frule cph2spshs_other, simp, simp, simp, simp, simp, simp, simp) |
|
1161 |
apply (frule vt_grant_os, frule vd_cons, rule ext) |
|
1162 |
apply (case_tac "x = p") |
|
1163 |
apply (auto simp:cp2sproc_def sectxt_of_obj_simps current_files_simps |
|
1164 |
dest!:current_has_sec' dest!:current_file_has_sfile' dest:is_file_in_current is_dir_in_current |
|
1165 |
dest:current_proc_has_sec not_deleted_init_proc split:option.splits if_splits) |
|
1166 |
done |
|
1 | 1167 |
|
17 | 1168 |
lemma cp2sproc_attach: |
1169 |
"valid (Attach p h flag # s) \<Longrightarrow> |
|
1170 |
cp2sproc (Attach p h flag # s) = (cp2sproc s) (p := |
|
1171 |
(case (ch2sshm s h) of |
|
1172 |
Some sh \<Rightarrow> (case (sectxt_of_obj s (O_proc p)) of |
|
1173 |
Some sec \<Rightarrow> Some (if (\<not> deleted (O_proc p) s \<and> p \<in> init_procs) |
|
1174 |
then Init p else Created, |
|
1175 |
sec, cpfd2sfds s p, cph2spshs s p \<union> {(sh, flag)}) |
|
1176 |
| _ \<Rightarrow> None) |
|
1177 |
| _ \<Rightarrow> cp2sproc s p) )" |
|
1178 |
apply (frule cph2spshs_attach, frule cpfd2sfds_other, simp, simp, simp, simp, simp, simp) |
|
1179 |
apply (frule vt_grant_os, frule vd_cons, rule ext) |
|
1180 |
apply (case_tac "x = p") |
|
1181 |
apply (auto simp:cp2sproc_def sectxt_of_obj_simps current_files_simps |
|
1182 |
dest!:current_has_sec' dest!:current_file_has_sfile' dest:is_file_in_current is_dir_in_current |
|
1183 |
dest:current_proc_has_sec not_deleted_init_proc split:option.splits if_splits) |
|
1184 |
done |
|
1185 |
||
1186 |
lemma cp2sproc_detach: |
|
1187 |
"valid (Detach p h # s) \<Longrightarrow> |
|
1188 |
cp2sproc (Detach p h # s) = (cp2sproc s) (p := |
|
1189 |
(case (ch2sshm s h, flag_of_proc_shm s p h) of |
|
1190 |
(Some sh, Some flag) \<Rightarrow> if (\<exists> h'. h' \<noteq> h \<and> (p,flag) \<in> procs_of_shm s h' \<and> ch2sshm s h' = Some sh) |
|
1191 |
then cp2sproc s p |
|
1192 |
else (case (sectxt_of_obj s (O_proc p)) of |
|
1193 |
Some sec \<Rightarrow> Some (if (\<not> deleted (O_proc p) s \<and> p \<in> init_procs) |
|
1194 |
then Init p else Created, sec, |
|
1195 |
cpfd2sfds s p, cph2spshs s p - {(sh, flag)}) |
|
1196 |
| None \<Rightarrow> None) |
|
1197 |
| _ \<Rightarrow> cp2sproc s p) )" |
|
1198 |
apply (frule cph2spshs_detach, frule cpfd2sfds_other, simp, simp, simp, simp, simp, simp) |
|
1199 |
apply (frule vt_grant_os, frule vd_cons, rule ext) |
|
1200 |
apply (case_tac "x = p") |
|
1201 |
apply (auto simp:cp2sproc_def sectxt_of_obj_simps current_files_simps |
|
1202 |
dest!:current_has_sec' dest!:current_file_has_sfile' dest:is_file_in_current is_dir_in_current |
|
1203 |
dest:current_proc_has_sec not_deleted_init_proc split:option.splits if_splits) |
|
1204 |
done |
|
1 | 1205 |
|
17 | 1206 |
lemma cp2sproc_deleteshm: |
1207 |
"valid (DeleteShM p h # s) \<Longrightarrow> |
|
1208 |
cp2sproc (DeleteShM p h # s) = (\<lambda> p'. |
|
1209 |
(case (ch2sshm s h, flag_of_proc_shm s p' h) of |
|
1210 |
(Some sh, Some flag) \<Rightarrow> if (\<exists> h'. h' \<noteq> h \<and> (p', flag) \<in> procs_of_shm s h' \<and> ch2sshm s h' = Some sh) |
|
1211 |
then cp2sproc s p' |
|
1212 |
else (case (sectxt_of_obj s (O_proc p')) of |
|
1213 |
Some sec \<Rightarrow> Some (if (\<not> deleted (O_proc p') s \<and> p' \<in> init_procs) |
|
1214 |
then Init p' else Created, sec, |
|
1215 |
cpfd2sfds s p', cph2spshs s p' - {(sh, flag)}) |
|
1216 |
| None \<Rightarrow> None) |
|
1217 |
| _ \<Rightarrow> cp2sproc s p') )" |
|
1218 |
apply (frule cph2spshs_deleteshm, frule cpfd2sfds_other, simp, simp, simp, simp, simp, simp) |
|
1219 |
apply (frule vt_grant_os, frule vd_cons, rule ext) |
|
1220 |
apply (auto simp:cp2sproc_def sectxt_of_obj_simps current_files_simps |
|
1221 |
dest!:current_has_sec' dest!:current_file_has_sfile' dest:is_file_in_current is_dir_in_current |
|
1222 |
dest:current_proc_has_sec not_deleted_init_proc split:option.splits if_splits) |
|
1223 |
done |
|
1224 |
||
1225 |
lemma cp2sproc_execve: |
|
1226 |
"valid (Execve p f fds # s) \<Longrightarrow> |
|
1227 |
cp2sproc (Execve p f fds # s) = (cp2sproc s) (p := |
|
1228 |
(case (sectxt_of_obj (Execve p f fds # s) (O_proc p)) of |
|
1229 |
Some sec \<Rightarrow> Some (if (\<not> deleted (O_proc p) s \<and> p \<in> init_procs) then Init p else Created, sec, |
|
1230 |
{sfd. \<exists> fd \<in> fds. \<exists> f. file_of_proc_fd s p fd = Some f \<and> cfd2sfd s p fd = Some sfd}, {}) |
|
1231 |
| _ \<Rightarrow> None) )" |
|
1232 |
apply (frule cph2spshs_execve, frule cpfd2sfds_execve) |
|
1233 |
apply (frule vt_grant_os, frule vd_cons, rule ext) |
|
1234 |
apply (auto simp:cp2sproc_def sectxt_of_obj_simps current_files_simps |
|
1235 |
dest!:current_has_sec' dest!:current_file_has_sfile' dest:is_file_in_current is_dir_in_current |
|
1236 |
dest:current_proc_has_sec not_deleted_init_proc split:option.splits if_splits) |
|
1237 |
done |
|
1 | 1238 |
|
17 | 1239 |
lemma cp2sproc_kill: |
1240 |
"\<lbrakk>valid (Kill p p' # s); p'' \<noteq> p'\<rbrakk> \<Longrightarrow> |
|
1241 |
cp2sproc (Kill p p' # s) p'' = (cp2sproc s) p''" |
|
1242 |
apply (frule cph2spshs_kill, frule cpfd2sfds_kill) |
|
1243 |
apply (frule vt_grant_os, frule vd_cons) |
|
1244 |
apply (auto simp:cp2sproc_def sectxt_of_obj_simps current_files_simps |
|
1245 |
dest!:current_has_sec' dest!:current_file_has_sfile' dest:is_file_in_current is_dir_in_current |
|
1246 |
dest:current_proc_has_sec not_deleted_init_proc split:option.splits if_splits) |
|
1247 |
done |
|
1248 |
||
1249 |
lemma cp2sproc_kill': |
|
1250 |
"\<lbrakk>valid (Kill p p' # s); p'' \<in> current_procs (Kill p p' # s)\<rbrakk> \<Longrightarrow> |
|
1251 |
cp2sproc (Kill p p' # s) p'' = (cp2sproc s) p''" |
|
1252 |
by (drule_tac p'' = p'' in cp2sproc_kill, simp+) |
|
1253 |
||
1254 |
lemma cp2sproc_exit: |
|
1255 |
"\<lbrakk>valid (Exit p # s); p' \<noteq> p\<rbrakk> \<Longrightarrow> |
|
1256 |
cp2sproc (Exit p # s) p' = (cp2sproc s) p'" |
|
1257 |
apply (frule cph2spshs_exit, frule cpfd2sfds_exit) |
|
1258 |
apply (frule vt_grant_os, frule vd_cons) |
|
1259 |
apply (auto simp:cp2sproc_def sectxt_of_obj_simps current_files_simps |
|
1260 |
dest!:current_has_sec' dest!:current_file_has_sfile' dest:is_file_in_current is_dir_in_current |
|
1261 |
dest:current_proc_has_sec not_deleted_init_proc split:option.splits if_splits) |
|
1262 |
done |
|
1263 |
||
1264 |
lemma cp2sproc_exit': |
|
1265 |
"\<lbrakk>valid (Exit p # s); p' \<in> current_procs (Exit p # s)\<rbrakk> \<Longrightarrow> |
|
1266 |
cp2sproc (Exit p # s) p' = (cp2sproc s) p'" |
|
1267 |
by (drule_tac p'= p' in cp2sproc_exit, simp+) |
|
1268 |
||
1269 |
lemmas cp2sproc_simps = cp2sproc_open cp2sproc_closefd cp2sproc_attach cp2sproc_detach cp2sproc_deleteshm |
|
1270 |
cp2sproc_clone cp2sproc_execve cp2sproc_kill cp2sproc_exit cp2sproc_other |
|
1 | 1271 |
|
17 | 1272 |
|
1273 |
||
1274 |
||
1275 |
||
1 | 1276 |
end |
1277 |
||
1278 |
(*<*) |
|
1279 |
end |
|
1280 |
(*>*) |