author | chunhan |
Wed, 22 May 2013 15:22:50 +0800 | |
changeset 12 | 47a4b2ae0556 |
parent 11 | 3e7617baa6a3 |
child 13 | 7b5e9fbeaf93 |
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 |
619 |
apply (erule CollectE, (erule conjE|erule exE)+) |
|
12 | 620 |
apply (simp split:if_splits) |
621 |
apply (rule_tac x = fda in exI, simp add:cfd2sfd_open2) |
|
622 |
apply (case_tac "x = a", simp) |
|
623 |
apply (rule_tac x = fd in exI, simp+) |
|
624 |
apply (erule conjE|erule exE)+ |
|
625 |
apply (rule_tac x = fda in exI, simp add:cfd2sfd_open2) |
|
626 |
apply (rule impI, drule proc_fd_in_fds, simp) |
|
627 |
apply (simp split:option.splits) |
|
628 |
done |
|
1 | 629 |
|
12 | 630 |
lemma cpfd2sfds_open1': |
10 | 631 |
"valid (Open p f flags fd opt # s) \<Longrightarrow> |
632 |
cpfd2sfds (Open p f flags fd opt # s) p = ( |
|
633 |
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 |
|
634 |
(Some sec, Some sf) \<Rightarrow> (cpfd2sfds s p) \<union> {(sec, flags, sf)} |
|
635 |
| _ \<Rightarrow> cpfd2sfds s p)" |
|
636 |
apply (frule cfd2sfd_open1) |
|
12 | 637 |
apply (auto dest:cpfd2sfds_open1 split:option.splits) |
638 |
done |
|
639 |
||
640 |
lemma cpfd2sfds_open2: |
|
641 |
"\<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'" |
|
642 |
apply (frule vt_grant_os, frule vd_cons) |
|
643 |
unfolding cpfd2sfds_def |
|
644 |
apply (rule set_eqI, rule iffI) |
|
645 |
apply (erule CollectE, (erule exE|erule conjE)+) |
|
646 |
apply (simp only:file_of_proc_fd.simps cfd2sfd_open2 split:if_splits) |
|
647 |
apply (rule CollectI) |
|
648 |
apply (rule_tac x = fda in exI, rule_tac x = fa in exI, simp) |
|
649 |
apply (erule CollectE, (erule exE|erule conjE)+) |
|
650 |
apply (simp only:file_of_proc_fd.simps split:if_splits) |
|
651 |
apply (rule CollectI) |
|
652 |
apply (rule_tac x = fda in exI, simp add:cfd2sfd_open2) |
|
653 |
done |
|
1 | 654 |
|
10 | 655 |
lemma cpfd2sfds_open: |
656 |
"valid (Open p f flags fd opt # s) |
|
657 |
\<Longrightarrow> cpfd2sfds (Open p f flags fd opt # s) = (cpfd2sfds s) (p := ( |
|
658 |
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 |
|
659 |
(Some sec, Some sf) \<Rightarrow> (cpfd2sfds s p) \<union> {(sec, flags, sf)} |
|
660 |
| _ \<Rightarrow> cpfd2sfds s p))" |
|
661 |
apply (rule ext) |
|
12 | 662 |
apply (case_tac "x \<noteq> p") |
663 |
apply (simp add:cpfd2sfds_open2) |
|
664 |
apply (simp add:cpfd2sfds_open1') |
|
665 |
done |
|
1 | 666 |
|
12 | 667 |
lemma cpfd2sfds_execve: |
668 |
"valid (Execve p fds # s) |
|
669 |
\<Longrightarrow> cpfd2sfds (Execve p fds # s) = (cpfd2sfds s) (p := " |
|
670 |
||
671 |
lemma cpfd2sfds_other: |
|
672 |
"\<lbrakk>valid (e # s); |
|
673 |
\<forall> |
|
674 |
||
675 |
lemma cpfd2sfds_simps = cpfd2sfds_open cpfd2sfds_other |
|
1 | 676 |
|
10 | 677 |
(******** cp2sproc simpset *********) |
1 | 678 |
|
679 |
lemma cp2sproc_nil: "p \<in> init_processes \<Longrightarrow> cp2sproc [] p = SInit p" |
|
10 | 680 |
apply (simp add:cp2sproc_def) |
1 | 681 |
by (simp add:cp2sproc_def index_of_proc.simps) |
682 |
||
683 |
lemma cp2sproc_nil': "p \<in> current_procs [] \<Longrightarrow> cp2sproc [] p = SInit p" |
|
684 |
by (simp add:cp2sproc_nil current_procs.simps) |
|
685 |
||
686 |
lemma cp2sproc_clone: "cp2sproc (Clone p p' # \<tau>) p'' = ( |
|
687 |
if (p'' = p') then SCrea (Suc (length \<tau>)) |
|
688 |
else cp2sproc \<tau> p'' )" |
|
689 |
by (auto simp:cp2sproc_def index_of_proc.simps d2s_aux.simps) |
|
690 |
||
691 |
lemma cp2sproc_other: "\<forall> p p'. e \<noteq> Clone p p' \<Longrightarrow> cp2sproc (e # \<tau>) p'' = cp2sproc \<tau> p''" |
|
692 |
apply (case_tac e) |
|
693 |
by (auto simp:cp2sproc_def index_of_proc.simps d2s_aux.simps) |
|
694 |
||
695 |
lemmas cp2sproc_simps = cp2sproc_nil cp2sproc_nil' cp2sproc_clone cp2sproc_other |
|
696 |
||
697 |
(******************** ch2sshm simpset **************************) |
|
698 |
||
699 |
lemma ch2sshm_nil: "h \<in> init_shms \<Longrightarrow> ch2sshm [] h = SInit h" |
|
700 |
by (simp add:ch2sshm_def index_of_shm.simps) |
|
701 |
||
702 |
lemma ch2sshm_nil': "h \<in> current_shms [] \<Longrightarrow> ch2sshm [] h = SInit h" |
|
703 |
by (simp add:ch2sshm_nil current_shms.simps) |
|
704 |
||
705 |
lemma ch2sshm_createshm: "ch2sshm (CreateShM p h # \<tau>) h' = (if (h' = h) then SCrea (Suc (length \<tau>)) else ch2sshm \<tau> h')" |
|
706 |
by (simp add:ch2sshm_def index_of_shm.simps d2s_aux.simps) |
|
707 |
||
708 |
lemma ch2sshm_other: "\<forall> p h. e \<noteq> CreateShM p h \<Longrightarrow> ch2sshm (e # \<tau>) h' = ch2sshm \<tau> h'" |
|
709 |
apply (case_tac e) |
|
710 |
by (auto simp add:ch2sshm_def index_of_shm.simps d2s_aux.simps) |
|
711 |
||
712 |
lemmas ch2sshm_simps = ch2sshm_nil ch2sshm_nil' ch2sshm_createshm ch2sshm_other |
|
713 |
||
714 |
(********************* cm2smsg simpset ***********************) |
|
715 |
||
716 |
lemma cm2smsg_nil: "m \<in> init_msgs \<Longrightarrow> cm2smsg [] m = SInit m" |
|
717 |
by (simp add:cm2smsg_def index_of_msg.simps) |
|
718 |
||
719 |
lemma cm2smsg_nil': "m \<in> current_msgs [] \<Longrightarrow> cm2smsg [] m = SInit m" |
|
720 |
by (simp add:cm2smsg_nil current_msgs.simps) |
|
721 |
||
722 |
lemma cm2smsg_createmsg: "cm2smsg (CreateMsg p m # \<tau>) m' = (if (m' = m) then SCrea (Suc (length \<tau>)) else cm2smsg \<tau> m')" |
|
723 |
by (simp add:cm2smsg_def index_of_msg.simps d2s_aux.simps) |
|
724 |
||
725 |
lemma cm2smsg_other: "\<forall> p m. e \<noteq> CreateMsg p m \<Longrightarrow> cm2smsg (e # \<tau>) m' = cm2smsg \<tau> m'" |
|
726 |
apply (case_tac e) |
|
727 |
by (auto simp:cm2smsg_def index_of_msg.simps d2s_aux.simps) |
|
728 |
||
729 |
lemmas cm2smsg_simps = cm2smsg_nil cm2smsg_nil' cm2smsg_createmsg cm2smsg_other |
|
730 |
||
731 |
(********************** cfd2fd_s simpset ******************************) |
|
732 |
||
733 |
lemma cfd2fd_s_nil: "fd \<in> init_fds_of_proc p \<Longrightarrow> cfd2fd_s [] p fd = SInit fd" |
|
734 |
by (simp add:cfd2fd_s_def index_of_fd.simps) |
|
735 |
||
736 |
lemma cfd2fd_s_nil': "fd \<in> current_proc_fds [] p \<Longrightarrow> cfd2fd_s [] p fd = SInit fd" |
|
737 |
by (simp add:cfd2fd_s_nil current_proc_fds.simps) |
|
738 |
||
739 |
lemma cfd2fd_s_open: "cfd2fd_s (Open p f flags fd opt # \<tau>) p' fd' = ( |
|
740 |
if (p = p') then (if (fd = fd') then SCrea (Suc (length \<tau>)) |
|
741 |
else cfd2fd_s \<tau> p' fd') |
|
742 |
else cfd2fd_s \<tau> p' fd' )" |
|
743 |
by (simp add:cfd2fd_s_def index_of_fd.simps d2s_aux.simps) |
|
744 |
||
745 |
lemma cfd2fd_s_createsock: "cfd2fd_s (CreateSock p af st fd im # \<tau>) p' fd' = ( |
|
746 |
if (p = p') then (if (fd = fd') then SCrea (Suc (length \<tau>)) |
|
747 |
else cfd2fd_s \<tau> p' fd') |
|
748 |
else cfd2fd_s \<tau> p' fd' )" |
|
749 |
by (simp add:cfd2fd_s_def index_of_fd.simps d2s_aux.simps) |
|
750 |
||
751 |
lemma cfd2fd_s_accept: "cfd2fd_s (Accept p fd addr port fd' im # \<tau>) p' fd'' = ( |
|
752 |
if (p' = p) then (if (fd'' = fd') then SCrea (Suc (length \<tau>)) |
|
753 |
else cfd2fd_s \<tau> p' fd'') |
|
754 |
else cfd2fd_s \<tau> p' fd'' )" |
|
755 |
by (simp add:cfd2fd_s_def index_of_fd.simps d2s_aux.simps) |
|
756 |
||
757 |
lemma cfd2fd_s_clone: "cfd2fd_s (Clone p p' # \<tau>) p'' fd = (if (p'' = p') then cfd2fd_s \<tau> p fd else cfd2fd_s \<tau> p'' fd)" |
|
758 |
by (simp add:cfd2fd_s_def index_of_fd.simps d2s_aux.simps) |
|
759 |
||
760 |
lemma cfd2fd_s_other: "\<lbrakk>\<forall> p f flags fd opt. e \<noteq> Open p f flags fd opt; |
|
761 |
\<forall> p af st fd im. e \<noteq> CreateSock p af st fd im; |
|
762 |
\<forall> p fd addr port fd' im. e \<noteq> Accept p fd addr port fd' im; |
|
763 |
\<forall> p p'. e \<noteq> Clone p p'\<rbrakk> \<Longrightarrow> cfd2fd_s (e # \<tau>) p'' fd'' = cfd2fd_s \<tau> p'' fd''" |
|
764 |
by (case_tac e, auto simp:cfd2fd_s_def index_of_fd.simps d2s_aux.simps) |
|
765 |
||
766 |
lemmas cfd2fd_s_simps = cfd2fd_s_nil cfd2fd_s_nil' cfd2fd_s_open cfd2fd_s_createsock cfd2fd_s_accept cfd2fd_s_clone cfd2fd_s_other |
|
767 |
||
768 |
(************* cim2im_s simpset **************************) |
|
769 |
||
770 |
(* no such lemma |
|
771 |
lemma cim2im_s_nil: "init_itag_of_inum im = Some tag \<Longrightarrow> cim2im_s [] im = SInit im" |
|
772 |
by (simp add:cim2im_s_def) |
|
773 |
*) |
|
774 |
||
775 |
lemma cim2im_s_open: "cim2im_s (Open p f flags fd (Some im) # \<tau>) im' = (if (im' = im) then SCrea (Suc (length \<tau>)) else cim2im_s \<tau> im')" |
|
776 |
by (simp add:cim2im_s_def) |
|
777 |
||
778 |
lemma cim2im_s_open': "cim2im_s (Open p f flags fd None # \<tau>) im = cim2im_s \<tau> im" |
|
779 |
by (simp add:cim2im_s_def) |
|
780 |
||
781 |
lemma cim2im_s_mkdir: "cim2im_s (Mkdir p f im # \<tau>) im' = (if (im' = im) then SCrea (Suc (length \<tau>)) else cim2im_s \<tau> im')" |
|
782 |
by (simp add:cim2im_s_def) |
|
783 |
||
784 |
lemma cim2im_s_createsock: "cim2im_s (CreateSock p sf st fd im # \<tau>) im' = (if (im' = im) then SCrea (Suc (length \<tau>)) else cim2im_s \<tau> im')" |
|
785 |
by (simp add:cim2im_s_def) |
|
786 |
||
787 |
lemma cim2im_s_accept: "cim2im_s (Accept p fd addr port fd' im # \<tau>) im' = (if (im' = im) then SCrea (Suc (length \<tau>)) else cim2im_s \<tau> im')" |
|
788 |
by (simp add:cim2im_s_def) |
|
789 |
||
790 |
lemma cim2im_s_other: "\<lbrakk>\<forall> p f flags fd opt. e \<noteq> Open p f flags fd opt; |
|
791 |
\<forall> p f im. e \<noteq> Mkdir p f im; |
|
792 |
\<forall> p sf st fd im. e \<noteq> CreateSock p sf st fd im; |
|
793 |
\<forall> p fd addr port fd' im. e \<noteq> Accept p fd addr port fd' im\<rbrakk> \<Longrightarrow> cim2im_s (e # \<tau>) im = cim2im_s \<tau> im" |
|
794 |
by (case_tac e, auto simp:cim2im_s_def) |
|
795 |
||
796 |
lemmas cim2im_s_simps = cim2im_s_open cim2im_s_open' cim2im_s_mkdir cim2im_s_createsock cim2im_s_accept cim2im_s_other |
|
797 |
||
798 |
||
799 |
lemma cig2ig_s_simp: "cig2ig_s (e # \<tau>) tag = cig2ig_s \<tau> tag" |
|
800 |
apply (case_tac tag) |
|
801 |
by auto |
|
802 |
||
803 |
(******************* cobj2sobj no Suc (length \<tau>) ***********************) |
|
804 |
||
805 |
lemma cf2sfile_le_len: "\<lbrakk>cf2sfile \<tau> f = SCrea (Suc (length \<tau>)) # spf; f \<in> current_files \<tau>; \<tau> \<in> vt rc_cs\<rbrakk> \<Longrightarrow> False" |
|
806 |
apply (case_tac f, (simp add:cf2sfile.simps d2s_aux.simps)+) |
|
807 |
apply (case_tac "index_of_file \<tau> (a # list)", (simp add:d2s_aux.simps)+) |
|
808 |
by (drule index_of_file_le_length', simp+) |
|
809 |
||
810 |
lemma cf2sfile_le_len': "\<lbrakk>SCrea (Suc (length \<tau>)) # spf \<preceq> cf2sfile \<tau> f; f \<in> current_files \<tau>; \<tau> \<in> vt rc_cs\<rbrakk> \<Longrightarrow> False" |
|
811 |
apply (induct f) |
|
812 |
apply (simp add:no_junior_def cf2sfile.simps d2s_aux.simps) |
|
813 |
apply (case_tac "cf2sfile \<tau> (a # f) = SCrea (Suc (length \<tau>)) # spf") |
|
814 |
apply (drule_tac f = "a # f" in cf2sfile_le_len, simp+) |
|
815 |
apply (simp only:cf2sfile.simps d2s_aux.simps) |
|
816 |
apply (drule_tac no_junior_noteq, simp+) |
|
817 |
apply (rule impI, erule impE, simp+) |
|
818 |
apply (drule parentf_in_current', simp+) |
|
819 |
done |
|
820 |
||
821 |
lemma cp2sproc_le_len: "cp2sproc \<tau> p = SCrea (Suc (length \<tau>)) \<Longrightarrow> False" |
|
822 |
apply (simp add:cp2sproc_def, case_tac "index_of_proc \<tau> p") |
|
823 |
apply (simp add:d2s_aux.simps)+ |
|
824 |
by (drule index_of_proc_le_length', simp) |
|
825 |
||
826 |
lemma ch2sshm_le_len: "ch2sshm \<tau> h = SCrea (Suc (length \<tau>)) \<Longrightarrow> False" |
|
827 |
apply (simp add:ch2sshm_def, case_tac "index_of_shm \<tau> h") |
|
828 |
apply (simp add:d2s_aux.simps)+ |
|
829 |
by (drule index_of_shm_le_length', simp) |
|
830 |
||
831 |
lemma cm2smsg_le_len: "cm2smsg \<tau> m = SCrea (Suc (length \<tau>)) \<Longrightarrow> False" |
|
832 |
apply (simp add:cm2smsg_def, case_tac "index_of_msg \<tau> m") |
|
833 |
apply (simp add:d2s_aux.simps)+ |
|
834 |
by (drule index_of_msg_le_length', simp) |
|
835 |
||
836 |
lemma cim2im_s_le_len: "cim2im_s \<tau> im = SCrea (Suc (length \<tau>)) \<Longrightarrow> False" |
|
837 |
apply (simp add:cim2im_s_def, case_tac "inum2ind \<tau> im") |
|
838 |
apply (simp add:d2s_aux.simps)+ |
|
839 |
by (drule inum2ind_le_length', simp) |
|
840 |
||
841 |
lemma cfd2fd_s_le_len: "cfd2fd_s \<tau> p fd = SCrea (Suc (length \<tau>)) \<Longrightarrow> False" |
|
842 |
apply (simp add:cfd2fd_s_def, case_tac "index_of_fd \<tau> p fd") |
|
843 |
apply (simp add:d2s_aux.simps)+ |
|
844 |
by (drule index_of_fd_le_length', simp) |
|
845 |
||
846 |
end |
|
847 |
||
848 |
(*<*) |
|
849 |
end |
|
850 |
(*>*) |