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