author | chunhan |
Tue, 21 May 2013 08:01:33 +0800 | |
changeset 10 | ac66d8ba86d9 |
parent 8 | 289a30c4cfb7 |
child 11 | 3e7617baa6a3 |
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 |
|
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
|
11 |
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
|
12 |
"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
|
13 |
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
|
14 |
|
8779d321cc2e
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 |
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
|
16 |
"\<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
|
17 |
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
|
18 |
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
|
19 |
|
8779d321cc2e
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 |
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
|
21 |
"\<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
|
22 |
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
|
23 |
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
|
24 |
|
8779d321cc2e
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 |
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
|
26 |
"\<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
|
27 |
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
|
28 |
|
8779d321cc2e
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 |
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
|
30 |
"\<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
|
31 |
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
|
32 |
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
|
33 |
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
|
34 |
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
|
35 |
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
|
36 |
apply (auto dest!:current_has_sec' |
8 | 37 |
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
|
38 |
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
|
39 |
|
8779d321cc2e
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 |
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
|
41 |
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
|
42 |
"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
|
43 |
|
8779d321cc2e
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 |
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
|
45 |
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
|
46 |
"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
|
47 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
48 |
lemma 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
|
49 |
"\<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
|
50 |
(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
|
51 |
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
|
52 |
(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
|
53 |
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
|
54 |
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
|
55 |
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
|
56 |
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
|
57 |
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
|
58 |
|
8779d321cc2e
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 |
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
|
60 |
"\<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
|
61 |
[] \<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
|
62 |
| 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
|
63 |
(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
|
64 |
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
|
65 |
(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
|
66 |
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
|
67 |
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
|
68 |
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
|
69 |
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
|
70 |
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
|
71 |
|
7 | 72 |
lemma sroot_set: |
73 |
"valid s \<Longrightarrow> \<exists> sec. sroot = (Init [], sec, None, {}) \<and> sectxt_of_obj s (O_dir []) = Some sec" |
|
74 |
apply (frule root_is_dir) |
|
75 |
apply (drule is_dir_has_sec, simp) |
|
76 |
apply (auto simp:sroot_def sec_of_root_def sectxt_of_obj_def type_of_obj.simps |
|
77 |
root_type_remains root_user_remains |
|
78 |
dest!:root_has_type' root_has_user' root_has_init_type' root_has_init_user' |
|
79 |
split:option.splits) |
|
80 |
done |
|
81 |
||
82 |
lemma cf2sfile_path_file: |
|
83 |
"\<lbrakk>is_file s (f # pf); valid s\<rbrakk> |
|
84 |
\<Longrightarrow> cf2sfile s (f # pf) = ( |
|
85 |
case (cf2sfile s pf) of |
|
86 |
Some (pfi, pfsec, psec, asecs) \<Rightarrow> |
|
87 |
(case (sectxt_of_obj s (O_file (f # pf))) of |
|
88 |
Some fsec \<Rightarrow> Some (if (\<not> deleted (O_file (f # pf)) s \<and> is_init_file (f # pf)) then Init (f # pf) |
|
89 |
else Created, fsec, Some pfsec, asecs \<union> {pfsec}) |
|
90 |
| None \<Rightarrow> None) |
|
91 |
| _ \<Rightarrow> None)" |
|
92 |
apply (frule is_file_in_current, drule parentf_is_dir'', simp) |
|
93 |
apply (frule is_dir_has_sfile, simp, frule is_file_has_sfile, simp) |
|
94 |
apply (frule sroot_set) |
|
95 |
apply (case_tac pf, (clarsimp simp:get_parentfs_ctxts'_def sectxt_of_pf_def)+) |
|
96 |
done |
|
97 |
||
98 |
lemma cf2sfile_path_dir: |
|
99 |
"\<lbrakk>is_dir s (f # pf); valid s\<rbrakk> |
|
100 |
\<Longrightarrow> cf2sfile s (f # pf) = ( |
|
101 |
case (cf2sfile s pf) of |
|
102 |
Some (pfi, pfsec, psec, asecs) \<Rightarrow> |
|
103 |
(case (sectxt_of_obj s (O_dir (f # pf))) of |
|
104 |
Some fsec \<Rightarrow> Some (if (\<not> deleted (O_dir (f # pf)) s \<and> is_init_dir (f # pf)) then Init (f # pf) |
|
105 |
else Created, fsec, Some pfsec, asecs \<union> {pfsec}) |
|
106 |
| None \<Rightarrow> None) |
|
107 |
| _ \<Rightarrow> None)" |
|
108 |
apply (frule is_dir_in_current, drule parentf_is_dir'', simp) |
|
109 |
apply (frule_tac f = "f # pf" in is_dir_has_sfile, simp) |
|
110 |
apply (frule_tac f = "pf" in is_dir_has_sfile, simp) |
|
111 |
apply (frule sroot_set) |
|
112 |
apply (case_tac pf, (clarsimp simp:get_parentfs_ctxts'_def sectxt_of_pf_def)+) |
|
113 |
done |
|
114 |
||
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
|
115 |
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
|
116 |
"\<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
|
117 |
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
|
118 |
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
|
119 |
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
|
120 |
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
|
121 |
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
|
122 |
| 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
|
123 |
else (case (sectxt_of_obj s (O_dir (f # pf))) of |
7 | 124 |
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
|
125 |
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
|
126 |
| 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
|
127 |
| None \<Rightarrow> None)" |
7 | 128 |
apply (drule is_file_or_dir, simp) |
129 |
apply (erule disjE) |
|
130 |
apply (frule cf2sfile_path_file, simp) defer |
|
131 |
apply (frule cf2sfile_path_dir, simp, drule is_dir_not_file) |
|
132 |
apply (auto split:option.splits) |
|
133 |
done |
|
134 |
||
8 | 135 |
lemma cf2sfile_path_file_prop1: |
136 |
"\<lbrakk>is_file s (f # pf); cf2sfile s pf = Some (pfi, pfsec, psec, asecs); valid s\<rbrakk> |
|
137 |
\<Longrightarrow> \<exists> fsec. cf2sfile s (f # pf) = |
|
138 |
Some (if (\<not> deleted (O_file (f # pf)) s \<and> is_init_file (f # pf)) then Init (f # pf) |
|
139 |
else Created, fsec, Some pfsec, asecs \<union> {pfsec}) \<and> |
|
140 |
sectxt_of_obj s (O_file (f # pf)) = Some fsec" |
|
141 |
apply (frule is_file_has_sfile, simp) |
|
142 |
by (auto simp:cf2sfile_path_file) |
|
7 | 143 |
|
8 | 144 |
lemma cf2sfile_path_file_prop2: |
145 |
"\<lbrakk>is_file s (f # pf); cf2sfile s pf = Some (pfi, pfsec, psec, asecs); |
|
146 |
sectxt_of_obj s (O_file (f # pf)) = Some fsec; valid s\<rbrakk> \<Longrightarrow> cf2sfile s (f # pf) = |
|
147 |
Some (if (\<not> deleted (O_file (f # pf)) s \<and> is_init_file (f # pf)) then Init (f # pf) |
|
148 |
else Created, fsec, Some pfsec, asecs \<union> {pfsec})" |
|
149 |
by (drule cf2sfile_path_file_prop1, auto) |
|
7 | 150 |
|
8 | 151 |
lemma cf2sfile_path_dir_prop1: |
152 |
"\<lbrakk>is_dir s (f # pf); cf2sfile s pf = Some (pfi, pfsec, psec, asecs); valid s\<rbrakk> |
|
153 |
\<Longrightarrow> \<exists> fsec. cf2sfile s (f # pf) = |
|
154 |
Some (if (\<not> deleted (O_dir (f # pf)) s \<and> is_init_dir (f # pf)) then Init (f # pf) |
|
155 |
else Created, fsec, Some pfsec, asecs \<union> {pfsec}) \<and> |
|
156 |
sectxt_of_obj s (O_dir (f # pf)) = Some fsec" |
|
157 |
apply (frule is_dir_has_sfile, simp) |
|
158 |
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
|
159 |
|
8 | 160 |
lemma cf2sfile_path_dir_prop2: |
161 |
"\<lbrakk>is_dir s (f # pf); cf2sfile s pf = Some (pfi, pfsec, psec, asecs); |
|
162 |
sectxt_of_obj s (O_dir (f # pf)) = Some fsec; valid s\<rbrakk> \<Longrightarrow> cf2sfile s (f # pf) = |
|
163 |
Some (if (\<not> deleted (O_dir (f # pf)) s \<and> is_init_dir (f # pf)) then Init (f # pf) |
|
164 |
else Created, fsec, Some pfsec, asecs \<union> {pfsec})" |
|
165 |
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
|
166 |
|
8 | 167 |
(**************** cf2sfile event list simpset ****************) |
4 | 168 |
|
8 | 169 |
lemma cf2sfile_open_none': |
170 |
"valid (Open p f flag fd None # s) \<Longrightarrow> cf2sfile (Open p f flag fd None # s) f'= cf2sfile s f'" |
|
4 | 171 |
apply (frule vd_cons, frule vt_grant_os) |
172 |
apply (induct f', simp add:cf2sfile_def) |
|
173 |
apply (simp add:cf2sfile_def is_file_simps is_dir_simps current_files_simps sectxt_of_obj_simps |
|
174 |
get_parentfs_ctxts_simps) |
|
175 |
done |
|
176 |
||
177 |
lemma cf2sfile_open_none: |
|
178 |
"valid (Open p f flag fd None # s) \<Longrightarrow> cf2sfile (Open p f flag fd None # s) = cf2sfile s" |
|
8 | 179 |
apply (rule ext) |
180 |
by (simp add:cf2sfile_open_none') |
|
1 | 181 |
|
182 |
lemma cf2sfile_open_some1: |
|
183 |
"\<lbrakk>valid (Open p f flag fd (Some inum) # s); f' \<in> current_files s\<rbrakk> |
|
184 |
\<Longrightarrow> cf2sfile (Open p f flag fd (Some inum) # s) f' = cf2sfile s f'" |
|
8 | 185 |
apply (frule vd_cons, frule vt_grant_os, frule noroot_events) |
4 | 186 |
apply (case_tac "f = f'", simp) |
187 |
apply (induct f', simp add:sroot_only, simp) |
|
3 | 188 |
apply (frule parentf_in_current', simp+) |
4 | 189 |
apply (simp add:cf2sfile_def is_file_simps is_dir_simps current_files_simps sectxt_of_obj_simps |
1 | 190 |
get_parentfs_ctxts_simps) |
191 |
done |
|
192 |
||
193 |
lemma cf2sfile_open_some2: |
|
194 |
"\<lbrakk>valid (Open p f flag fd (Some inum) # s); is_file s f'\<rbrakk> |
|
8 | 195 |
\<Longrightarrow> cf2sfile (Open p f flag fd (Some inum) # s) f' = cf2sfile s f'" |
1 | 196 |
apply (frule vd_cons, drule is_file_in_current) |
197 |
by (simp add:cf2sfile_open_some1) |
|
198 |
||
199 |
lemma cf2sfile_open_some3: |
|
200 |
"\<lbrakk>valid (Open p f flag fd (Some inum) # s); is_dir s f'\<rbrakk> |
|
8 | 201 |
\<Longrightarrow> cf2sfile (Open p f flag fd (Some inum) # s) f' = cf2sfile s f'" |
1 | 202 |
apply (frule vd_cons, drule is_dir_in_current) |
203 |
by (simp add:cf2sfile_open_some1) |
|
204 |
||
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
|
205 |
lemma cf2sfile_open_some4: |
8 | 206 |
"valid (Open p f flag fd (Some inum) # s) \<Longrightarrow> cf2sfile (Open p f flag fd (Some inum) # s) f = ( |
1 | 207 |
case (parent f) of |
208 |
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), |
|
209 |
get_parentfs_ctxts s pf) of |
|
210 |
(Some sec, Some psec, Some asecs) \<Rightarrow> Some (Created, sec, Some psec, set asecs) |
|
211 |
| _ \<Rightarrow> None) |
|
212 |
| None \<Rightarrow> None)" |
|
213 |
apply (frule vd_cons, frule vt_grant_os, frule noroot_events) |
|
4 | 214 |
apply (case_tac f, simp) |
215 |
apply (simp add:cf2sfile_def is_file_simps is_dir_simps current_files_simps sectxt_of_obj_simps |
|
216 |
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
|
217 |
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
|
218 |
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
|
219 |
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
|
220 |
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
|
221 |
|
8779d321cc2e
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 |
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
|
223 |
"\<lbrakk>valid (Open p f flag fd opt # s); f' \<in> current_files (Open p f flag fd opt # s)\<rbrakk> |
8 | 224 |
\<Longrightarrow> cf2sfile (Open p f flag fd opt # s) f' = ( |
225 |
if (opt = None) then cf2sfile s f' |
|
226 |
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
|
227 |
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
|
228 |
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
|
229 |
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
|
230 |
(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
|
231 |
| _ \<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
|
232 |
| None \<Rightarrow> None) |
8 | 233 |
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
|
234 |
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
|
235 |
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
|
236 |
apply (case_tac "f = f'") |
8 | 237 |
apply (simp add:cf2sfile_open_some4 split:option.splits) |
238 |
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
|
239 |
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
|
240 |
|
8779d321cc2e
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 |
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
|
242 |
"\<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
|
243 |
\<Longrightarrow> cf2sfile (Mkdir p f i # s) f' = cf2sfile s f'" |
8 | 244 |
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
|
245 |
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
|
246 |
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
|
247 |
apply (frule parentf_in_current', simp+) |
8 | 248 |
apply (case_tac "f = f'", simp) |
249 |
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
|
250 |
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
|
251 |
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
|
252 |
|
8779d321cc2e
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 |
lemma cf2sfile_mkdir2: |
8 | 254 |
"\<lbrakk>valid (Mkdir p f i # s); is_file s f'\<rbrakk> |
255 |
\<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
|
256 |
apply (frule vd_cons, drule is_file_in_current) |
8 | 257 |
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
|
258 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
259 |
lemma cf2sfile_mkdir3: |
8 | 260 |
"\<lbrakk>valid (Mkdir p f i # s); is_dir s f'\<rbrakk> |
261 |
\<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
|
262 |
apply (frule vd_cons, drule is_dir_in_current) |
8 | 263 |
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
|
264 |
|
8 | 265 |
lemma cf2sfile_mkdir4: |
266 |
"valid (Mkdir p f i # s) |
|
267 |
\<Longrightarrow> cf2sfile (Mkdir p f i # s) f = (case (parent f) of |
|
268 |
Some pf \<Rightarrow> (case (sectxt_of_obj (Mkdir p f i # s) (O_dir f), sectxt_of_obj s (O_dir pf), |
|
269 |
get_parentfs_ctxts s pf) of |
|
270 |
(Some sec, Some psec, Some asecs) \<Rightarrow> Some (Created, sec, Some psec, set asecs) |
|
271 |
| _ \<Rightarrow> None) |
|
272 |
| None \<Rightarrow> None)" |
|
273 |
apply (frule vd_cons, frule vt_grant_os, frule noroot_events) |
|
274 |
apply (case_tac f, simp) |
|
275 |
apply (clarsimp simp:os_grant.simps) |
|
276 |
apply (simp add:sectxt_of_obj_simps) |
|
277 |
apply (frule current_proc_has_sec, simp) |
|
278 |
apply (frule is_dir_has_sec, simp) |
|
279 |
apply (frule get_pfs_secs_prop, simp) |
|
280 |
apply (frule is_dir_not_file) |
|
281 |
apply (auto simp add:cf2sfile_def is_file_simps is_dir_simps current_files_simps sectxt_of_obj_simps |
|
282 |
get_parentfs_ctxts_simps split:option.splits if_splits |
|
283 |
dest:not_deleted_init_dir is_dir_in_current not_deleted_init_file is_file_in_current) |
|
284 |
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
|
285 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
286 |
lemma cf2sfile_mkdir: |
8 | 287 |
"\<lbrakk>valid (Mkdir p f i # s); f' \<in> current_files (Mkdir p f i # s)\<rbrakk> |
288 |
\<Longrightarrow> cf2sfile (Mkdir p f i # s) f' = ( |
|
289 |
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
|
290 |
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
|
291 |
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
|
292 |
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
|
293 |
(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
|
294 |
| _ \<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
|
295 |
| None \<Rightarrow> None) |
8 | 296 |
else cf2sfile s f')" |
297 |
apply (case_tac "f = f'") |
|
298 |
apply (simp add:cf2sfile_mkdir4 split:option.splits) |
|
299 |
apply (simp add:cf2sfile_mkdir1 current_files_simps) |
|
300 |
done |
|
301 |
||
302 |
lemma cf2sfile_linkhard1: |
|
303 |
"\<lbrakk>valid (LinkHard p oldf f # s); f' \<in> current_files s\<rbrakk> |
|
304 |
\<Longrightarrow> cf2sfile (LinkHard p oldf f# s) f' = cf2sfile s f'" |
|
305 |
apply (frule vd_cons, frule vt_grant_os, frule noroot_events) |
|
306 |
apply (case_tac "f = f'", simp) |
|
307 |
apply (induct f', simp add:sroot_only, simp) |
|
308 |
apply (frule parentf_in_current', simp+) |
|
309 |
apply (simp add:cf2sfile_def is_file_simps is_dir_simps current_files_simps sectxt_of_obj_simps |
|
310 |
get_parentfs_ctxts_simps split:if_splits option.splits) |
|
311 |
done |
|
312 |
||
313 |
lemma cf2sfile_linkhard2: |
|
314 |
"\<lbrakk>valid (LinkHard p oldf f # s); is_file s f'\<rbrakk> |
|
315 |
\<Longrightarrow> cf2sfile (LinkHard p oldf f # s) f' = cf2sfile s f'" |
|
316 |
apply (frule vd_cons, drule is_file_in_current) |
|
317 |
by (simp add:cf2sfile_linkhard1) |
|
318 |
||
319 |
lemma cf2sfile_linkhard3: |
|
320 |
"\<lbrakk>valid (LinkHard p oldf f # s); is_dir s f'\<rbrakk> |
|
321 |
\<Longrightarrow> cf2sfile (LinkHard p oldf f # s) f' = cf2sfile s f'" |
|
322 |
apply (frule vd_cons, drule is_dir_in_current) |
|
323 |
by (simp add:cf2sfile_linkhard1) |
|
324 |
||
325 |
lemma cf2sfile_linkhard4: |
|
326 |
"valid (LinkHard p oldf f # s) |
|
327 |
\<Longrightarrow> cf2sfile (LinkHard p oldf f # s) f = (case (parent f) of |
|
328 |
Some pf \<Rightarrow> (case (sectxt_of_obj (LinkHard p oldf f # s) (O_file f), sectxt_of_obj s (O_dir pf), |
|
329 |
get_parentfs_ctxts s pf) of |
|
330 |
(Some sec, Some psec, Some asecs) \<Rightarrow> Some (Created, sec, Some psec, set asecs) |
|
331 |
| _ \<Rightarrow> None) |
|
332 |
| None \<Rightarrow> None)" |
|
333 |
apply (frule vd_cons, frule vt_grant_os, frule noroot_events) |
|
334 |
apply (case_tac f, simp) |
|
335 |
apply (simp add:cf2sfile_def is_file_simps is_dir_simps current_files_simps sectxt_of_obj_simps |
|
336 |
get_parentfs_ctxts_simps) |
|
337 |
apply (rule impI, (erule conjE)+) |
|
338 |
apply (drule not_deleted_init_file, simp+) |
|
339 |
apply (simp add:is_file_in_current) |
|
340 |
done |
|
341 |
||
342 |
lemma cf2sfile_linkhard: |
|
343 |
"\<lbrakk>valid (LinkHard p oldf f # s); f' \<in> current_files (LinkHard p oldf f # s)\<rbrakk> |
|
344 |
\<Longrightarrow> cf2sfile (LinkHard p oldf f # s) f' = ( |
|
345 |
if (f' = f) |
|
346 |
then (case (parent f) of |
|
347 |
Some pf \<Rightarrow> (case (sectxt_of_obj (LinkHard p oldf f # s) (O_file f), sectxt_of_obj s (O_dir pf), |
|
348 |
get_parentfs_ctxts s pf) of |
|
349 |
(Some sec, Some psec, Some asecs) \<Rightarrow> Some (Created, sec, Some psec, set asecs) |
|
350 |
| _ \<Rightarrow> None) |
|
351 |
| None \<Rightarrow> None) |
|
352 |
else cf2sfile s f')" |
|
353 |
apply (case_tac "f = f'") |
|
354 |
apply (simp add:cf2sfile_linkhard4 split:option.splits) |
|
355 |
apply (simp add:cf2sfile_linkhard1 current_files_simps) |
|
356 |
done |
|
357 |
||
358 |
lemma cf2sfile_other: |
|
359 |
"\<lbrakk>ff \<in> current_files s; |
|
360 |
\<forall> p f flag fd opt. e \<noteq> Open p f flag fd opt; |
|
361 |
\<forall> p fd. e \<noteq> CloseFd p fd; |
|
362 |
\<forall> p f. e \<noteq> UnLink p f; |
|
363 |
\<forall> p f. e \<noteq> Rmdir p f; |
|
364 |
\<forall> p f i. e \<noteq> Mkdir p f i; |
|
365 |
\<forall> p f f'. e \<noteq> LinkHard p f f'; |
|
366 |
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
|
367 |
apply (frule vd_cons, frule vt_grant_os) |
8 | 368 |
apply (induct ff, simp add:sroot_only) |
369 |
apply (frule parentf_in_current', simp+, case_tac e) |
|
370 |
apply (auto simp:current_files_simps is_file_simps is_dir_simps sectxt_of_obj_simps cf2sfile_path |
|
371 |
split:if_splits option.splits) |
|
372 |
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
|
373 |
|
10 | 374 |
lemma cf2sfile_other': |
375 |
"\<lbrakk>valid (e # s); |
|
376 |
\<forall> p f flag fd opt. e \<noteq> Open p f flag fd opt; |
|
377 |
\<forall> p fd. e \<noteq> CloseFd p fd; |
|
378 |
\<forall> p f. e \<noteq> UnLink p f; |
|
379 |
\<forall> p f. e \<noteq> Rmdir p f; |
|
380 |
\<forall> p f i. e \<noteq> Mkdir p f i; |
|
381 |
\<forall> p f f'. e \<noteq> LinkHard p f f'; |
|
382 |
ff \<in> current_files s\<rbrakk> \<Longrightarrow> cf2sfile (e # s) ff = cf2sfile s ff" |
|
383 |
by (auto intro!:cf2sfile_other) |
|
384 |
||
8 | 385 |
lemma cf2sfile_unlink: |
386 |
"\<lbrakk>valid (UnLink p f # s); f' \<in> current_files (UnLink p f # s)\<rbrakk> |
|
387 |
\<Longrightarrow> cf2sfile (UnLink p f # s) f' = cf2sfile s f'" |
|
388 |
apply (frule vd_cons, frule vt_grant_os) |
|
389 |
apply (simp add:current_files_simps split:if_splits) |
|
390 |
apply (auto simp:cf2sfile_def sectxt_of_obj_simps get_parentfs_ctxts_simps is_file_simps is_dir_simps |
|
10 | 391 |
split:if_splits option.splits) |
1 | 392 |
done |
393 |
||
10 | 394 |
lemma cf2sfile_rmdir: |
395 |
"\<lbrakk>valid (Rmdir p f # s); f' \<in> current_files (Rmdir p f # s)\<rbrakk> |
|
396 |
\<Longrightarrow> cf2sfile (Rmdir p f # s) f' = cf2sfile s f'" |
|
397 |
apply (frule vd_cons, frule vt_grant_os) |
|
398 |
apply (simp add:current_files_simps split:if_splits) |
|
399 |
apply (auto simp:cf2sfile_def sectxt_of_obj_simps get_parentfs_ctxts_simps is_file_simps is_dir_simps |
|
400 |
split:if_splits option.splits) |
|
1 | 401 |
done |
402 |
||
10 | 403 |
lemma pfdof_simp5: "\<lbrakk>proc_fd_of_file s f = {(p, fd)}; file_of_proc_fd s p fd = None\<rbrakk> \<Longrightarrow> False" |
404 |
apply (subgoal_tac "(p, fd) \<in> proc_fd_of_file s f") |
|
405 |
by (simp add:pfdof_simp2, simp) |
|
406 |
||
407 |
lemma pfdof_simp6: "proc_fd_of_file s f = {(p, fd)} \<Longrightarrow> file_of_proc_fd s p fd = Some f" |
|
408 |
apply (subgoal_tac "(p, fd) \<in> proc_fd_of_file s f") |
|
409 |
by (simp add:pfdof_simp2, simp) |
|
410 |
||
411 |
lemma cf2sfile_closefd: |
|
412 |
"\<lbrakk>valid (CloseFd p fd # s); f \<in> current_files (CloseFd p fd # s)\<rbrakk> |
|
413 |
\<Longrightarrow> cf2sfile (CloseFd p fd # s) f = cf2sfile s f" |
|
414 |
apply (frule vd_cons, frule vt_grant_os) |
|
415 |
apply (simp add:current_files_simps split:if_splits option.splits) |
|
416 |
(* costs too much time, but solved |
|
417 |
||
418 |
apply (auto simp:cf2sfile_def sectxt_of_obj_simps get_parentfs_ctxts_simps is_file_simps is_dir_simps |
|
419 |
split:if_splits option.splits |
|
420 |
dest:init_file_dir_conflict pfdof_simp5 pfdof_simp6 file_of_pfd_is_file |
|
421 |
not_deleted_init_file not_deleted_init_dir is_file_not_dir is_dir_not_file |
|
422 |
dest!:current_has_sec') |
|
423 |
done |
|
424 |
*) |
|
425 |
sorry |
|
1 | 426 |
|
10 | 427 |
lemmas cf2sfile_simps = cf2sfile_open cf2sfile_mkdir cf2sfile_linkhard cf2sfile_other |
428 |
cf2sfile_unlink cf2sfile_rmdir cf2sfile_closefd |
|
429 |
||
430 |
(*********** cfd2sfd simpset *********) |
|
431 |
||
432 |
lemma cfd2sfd_open1: |
|
433 |
"valid (Open p f flags fd opt # s) |
|
434 |
\<Longrightarrow> cfd2sfd (Open p f flags fd opt # s) p fd = |
|
435 |
(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 |
|
436 |
(Some sec, Some sf) \<Rightarrow> Some (sec, flags, sf) |
|
437 |
| _ \<Rightarrow> None)" |
|
438 |
by (simp add:cfd2sfd_def sectxt_of_obj_simps split:if_splits) |
|
1 | 439 |
|
10 | 440 |
lemma cfd2sfd_open_some2: |
441 |
"\<lbrakk>valid (Open p f flags fd (Some inum) # s); file_of_proc_fd s p' fd' = Some f'\<rbrakk> |
|
442 |
\<Longrightarrow> cfd2sfd (Open p f flags fd (Some inum) # s) p' fd' = cfd2sfd s p' fd'" |
|
443 |
apply (frule vd_cons, frule vt_grant_os) |
|
444 |
apply (frule proc_fd_in_fds, simp) |
|
445 |
apply (frule file_of_proc_fd_in_curf, simp) |
|
446 |
apply (case_tac "f = f'", simp) |
|
447 |
apply (simp add:cfd2sfd_def sectxt_of_obj_simps cf2sfile_open_some1) |
|
448 |
apply (case_tac "p = p'", simp) |
|
449 |
apply (rule conjI, rule impI, simp) |
|
450 |
apply (drule cf2sfile_open_some1, simp) |
|
451 |
apply (auto split:option.splits)[1] |
|
452 |
apply simp |
|
453 |
apply (drule cf2sfile_open_some1, simp) |
|
454 |
apply (auto split:option.splits)[1] |
|
1 | 455 |
done |
456 |
||
10 | 457 |
lemma cfd2sfd_open_none2: |
458 |
"\<lbrakk>valid (Open p f flags fd None # s); file_of_proc_fd s p' fd' = Some f'\<rbrakk> |
|
459 |
\<Longrightarrow> cfd2sfd (Open p f flags fd None # s) p' fd' = cfd2sfd s p' fd'" |
|
460 |
apply (frule vd_cons, frule vt_grant_os) |
|
461 |
apply (frule proc_fd_in_fds, simp) |
|
462 |
apply (frule file_of_proc_fd_in_curf, simp) |
|
463 |
apply (simp add:cfd2sfd_def sectxt_of_obj_simps cf2sfile_open_none) |
|
464 |
apply (case_tac "p = p'", simp) |
|
465 |
apply (rule conjI, rule impI, simp) |
|
466 |
apply (drule cf2sfile_open_none) |
|
467 |
apply (auto split:option.splits)[1] |
|
468 |
apply simp |
|
469 |
apply (drule cf2sfile_open_none) |
|
470 |
apply (auto split:option.splits)[1] |
|
471 |
done |
|
472 |
||
473 |
lemma cfd2sfd_open2: |
|
474 |
"\<lbrakk>valid (Open p f flags fd opt # s); file_of_proc_fd s p' fd' = Some f'\<rbrakk> |
|
475 |
\<Longrightarrow> cfd2sfd (Open p f flags fd opt # s) p' fd' = cfd2sfd s p' fd'" |
|
476 |
apply (case_tac opt) |
|
477 |
apply (simp add:cfd2sfd_open_none2) |
|
478 |
apply (simp add:cfd2sfd_open_some2) |
|
1 | 479 |
done |
480 |
||
10 | 481 |
lemma cfd2sfd_open: |
482 |
"\<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> |
|
483 |
\<Longrightarrow> cfd2sfd (Open p f flags fd opt # s) p' fd' = (if (p' = p \<and> fd' = fd) then |
|
484 |
(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 |
|
485 |
(Some sec, Some sf) \<Rightarrow> Some (sec, flags, sf) |
|
486 |
| _ \<Rightarrow> None) else cfd2sfd s p' fd')" |
|
487 |
apply (simp split:if_splits) |
|
488 |
apply (simp add:cfd2sfd_open1 split:option.splits) |
|
489 |
apply (simp add:cfd2sfd_open2) |
|
490 |
apply (rule impI, simp) |
|
1 | 491 |
done |
492 |
||
10 | 493 |
lemma cfd2sfd_closefd: |
494 |
"\<lbrakk>valid (CloseFd p fd # s); file_of_proc_fd (CloseFd p fd # s) p' fd' = Some f\<rbrakk> |
|
495 |
\<Longrightarrow> cfd2sfd (CloseFd p fd # s) p' fd' = cfd2sfd s p' fd'" |
|
496 |
apply (frule vd_cons, frule vt_grant_os) |
|
497 |
apply (frule proc_fd_in_fds, simp) |
|
498 |
apply (frule file_of_proc_fd_in_curf, simp) |
|
499 |
apply (frule cf2sfile_closefd, simp) |
|
500 |
apply (simp add:cfd2sfd_def sectxt_of_obj_simps) |
|
501 |
apply (auto split:option.splits if_splits) |
|
502 |
done |
|
1 | 503 |
|
10 | 504 |
lemma cfd2sfd_clone: |
505 |
"\<lbrakk>valid (Clone p p' fds shms # s); file_of_proc_fd (Clone p p' fds shms # s) p'' fd' = Some f\<rbrakk> |
|
506 |
\<Longrightarrow> cfd2sfd (Clone p p' fds shms # s) p'' fd' = ( |
|
507 |
if (p'' = p') then cfd2sfd s p fd' |
|
508 |
else cfd2sfd s p'' fd')" |
|
509 |
apply (frule vd_cons, frule vt_grant_os) |
|
510 |
apply (frule proc_fd_in_fds, simp) |
|
511 |
apply (frule file_of_proc_fd_in_curf, simp, simp add:current_files_simps) |
|
512 |
apply (frule_tac cf2sfile_other', simp+) |
|
513 |
apply (simp add:cfd2sfd_def sectxt_of_obj_simps) |
|
514 |
apply (case_tac "p'' = p'", simp) |
|
515 |
apply (auto split:option.splits if_splits)[1] |
|
516 |
apply (simp) |
|
517 |
apply (auto split:option.splits if_splits)[1] |
|
1 | 518 |
done |
519 |
||
10 | 520 |
lemma cfd2sfd_execve: |
521 |
"\<lbrakk>valid (Execve p f fds # s); file_of_proc_fd (Execve p f fds # s) p' fd' = Some f'\<rbrakk> |
|
522 |
\<Longrightarrow> cfd2sfd (Execve p f fds # s) p' fd' = cfd2sfd s p' fd'" |
|
523 |
apply (frule vd_cons, frule vt_grant_os) |
|
524 |
apply (frule proc_fd_in_fds, simp) |
|
525 |
apply (frule file_of_proc_fd_in_curf, simp, simp add:current_files_simps) |
|
526 |
apply (frule_tac cf2sfile_other', simp+) |
|
527 |
apply (simp add:cfd2sfd_def sectxt_of_obj_simps) |
|
528 |
apply (case_tac "p' = p", simp) |
|
529 |
apply (auto split:option.splits if_splits)[1] |
|
530 |
apply (simp) |
|
531 |
apply (auto split:option.splits if_splits)[1] |
|
1 | 532 |
done |
533 |
||
10 | 534 |
lemma cfd2sfd_kill: |
535 |
"\<lbrakk>valid (Kill p p'' # s); file_of_proc_fd (Kill p p'' # s) p' fd' = Some f'\<rbrakk> |
|
536 |
\<Longrightarrow> cfd2sfd (Kill p p'' # s) p' fd' = cfd2sfd s p' fd'" |
|
537 |
apply (frule vd_cons, frule vt_grant_os) |
|
538 |
apply (frule proc_fd_in_fds, simp) |
|
539 |
apply (frule proc_fd_in_procs, simp) |
|
540 |
apply (frule file_of_proc_fd_in_curf, simp, simp add:current_files_simps) |
|
541 |
apply (frule_tac cf2sfile_other', simp+) |
|
542 |
apply (simp add:cfd2sfd_def sectxt_of_obj_simps) |
|
543 |
apply (auto split:option.splits if_splits) |
|
1 | 544 |
done |
545 |
||
10 | 546 |
lemma cfd2sfd_exit: |
547 |
"\<lbrakk>valid (Exit p # s); file_of_proc_fd (Exit p # s) p' fd' = Some f'\<rbrakk> |
|
548 |
\<Longrightarrow> cfd2sfd (Exit p # s) p' fd' = cfd2sfd s p' fd'" |
|
549 |
apply (frule vd_cons, frule vt_grant_os) |
|
550 |
apply (frule proc_fd_in_fds, simp) |
|
551 |
apply (frule proc_fd_in_procs, simp) |
|
552 |
apply (frule file_of_proc_fd_in_curf, simp, simp add:current_files_simps) |
|
553 |
apply (frule_tac cf2sfile_other', simp+) |
|
554 |
apply (simp add:cfd2sfd_def sectxt_of_obj_simps) |
|
555 |
apply (auto split:option.splits if_splits) |
|
1 | 556 |
done |
557 |
||
10 | 558 |
lemma cfd2sfd_other: |
559 |
"\<lbrakk>valid (e # s); file_of_proc_fd (e # s) p' fd' = Some f'; |
|
560 |
\<forall> p f flags fd opt. e \<noteq> Open p f flags fd opt; |
|
561 |
\<forall> p p'' fds shms. e \<noteq> Clone p p'' fds shms\<rbrakk> |
|
562 |
\<Longrightarrow> cfd2sfd (e # s) p' fd' = cfd2sfd s p' fd'" |
|
563 |
apply (frule vd_cons, frule vt_grant_os) |
|
564 |
apply (frule proc_fd_in_fds, simp) |
|
565 |
apply (frule proc_fd_in_procs, simp) |
|
566 |
apply (frule file_of_proc_fd_in_curf, simp) |
|
567 |
apply (case_tac e) |
|
568 |
apply (auto intro!:cfd2sfd_execve cfd2sfd_closefd cfd2sfd_kill cfd2sfd_exit) |
|
569 |
apply (auto simp:cfd2sfd_def sectxt_of_obj_simps current_files_simps cf2sfile_simps split:option.splits) |
|
570 |
apply (auto dest!:current_has_sec' dest:file_of_proc_fd_in_curf proc_fd_in_fds) |
|
571 |
done |
|
572 |
||
573 |
lemmas cfd2sfd_simps = cfd2sfd_open cfd2sfd_clone cfd2sfd_other |
|
574 |
||
575 |
(********** cpfd2sfds simpset **********) |
|
576 |
||
577 |
lemma current_filefd_has_flags: |
|
578 |
"\<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" |
|
579 |
apply (induct s arbitrary:p) |
|
580 |
apply (simp only:flags_of_proc_fd.simps file_of_proc_fd.simps init_filefd_prop4) |
|
581 |
apply (frule vd_cons, frule vt_grant_os, case_tac a) |
|
582 |
apply (auto split:if_splits option.splits dest:proc_fd_in_fds) |
|
583 |
done |
|
584 |
||
585 |
lemma current_filefd_has_flags': |
|
586 |
"\<lbrakk>flags_of_proc_fd s p fd = None; valid s\<rbrakk> \<Longrightarrow> file_of_proc_fd s p fd = None" |
|
587 |
apply (case_tac "file_of_proc_fd s p fd") |
|
588 |
apply (simp, drule current_filefd_has_flags, simp+) |
|
1 | 589 |
done |
590 |
||
10 | 591 |
lemma current_file_has_sfile': |
592 |
"\<lbrakk>cf2sfile s f = None; valid s\<rbrakk> \<Longrightarrow> f \<notin> current_files s" |
|
593 |
by (rule notI, drule current_file_has_sfile, simp+) |
|
1 | 594 |
|
10 | 595 |
lemma current_filefd_has_sfd: |
596 |
"\<lbrakk>file_of_proc_fd s p fd = Some f; valid s\<rbrakk> \<Longrightarrow> \<exists>sfd. cfd2sfd s p fd = Some sfd" |
|
597 |
by (auto simp:cfd2sfd_def split:option.splits dest!:current_has_sec' current_file_has_sfile' |
|
598 |
dest:file_of_proc_fd_in_curf proc_fd_in_fds current_filefd_has_flags) |
|
599 |
||
600 |
lemma current_filefd_has_sfd': |
|
601 |
"\<lbrakk>cfd2sfd s p fd = None; valid s\<rbrakk> \<Longrightarrow> file_of_proc_fd s p fd = None" |
|
602 |
by (case_tac "file_of_proc_fd s p fd", auto dest:current_filefd_has_sfd) |
|
1 | 603 |
|
10 | 604 |
definition cpfd2sfds' :: "t_state \<Rightarrow> t_process \<Rightarrow> t_sfd set" |
605 |
where |
|
606 |
"cpfd2sfds' s p \<equiv> {sfd. \<exists> fd f. file_of_proc_fd s p fd = Some f \<and> cfd2sfd s p fd = Some sfd}" |
|
1 | 607 |
|
10 | 608 |
definition cph2spshs' :: "t_state \<Rightarrow> t_process \<Rightarrow> t_sproc_sshm set" |
609 |
where |
|
610 |
"cph2spshs' s p \<equiv> {(sh, flag). \<exists> h. (p, flag) \<in> procs_of_shm s h \<and> ch2sshm s h = Some sh}" |
|
1 | 611 |
|
10 | 612 |
lemma "x \<in> cph2spshs' s p \<Longrightarrow> False" |
613 |
apply (simp add:cph2spshs'_def) |
|
614 |
apply (case_tac x, simp) |
|
1 | 615 |
|
616 |
||
10 | 617 |
lemma cpfd2sfds_open_some1: |
618 |
"valid (Open p f flags fd (Some inum) # s) \<Longrightarrow> |
|
619 |
cpfd2sfds (Open p f flags fd (Some inum) # s) p = ( |
|
620 |
case (cfd2sfd (Open p f flags fd (Some inum) # s) p fd) of |
|
621 |
Some sfd \<Rightarrow> (cpfd2sfds s p) \<union> {sfd} |
|
622 |
| _ \<Rightarrow> cpfd2sfds s p)" |
|
623 |
apply (frule vd_cons, frule vt_grant_os) |
|
624 |
apply (split option.splits) |
|
625 |
apply (rule conjI, rule impI, drule current_filefd_has_sfd', simp, simp) |
|
626 |
apply (rule allI, rule impI) |
|
627 |
apply (rule set_eqI, rule iffI) |
|
628 |
unfolding cpfd2sfds_def |
|
629 |
thm CollectE |
|
630 |
apply (erule CollectE) |
|
631 |
apply (erule CollectE, (erule conjE|erule exE)+) |
|
632 |
apply (simp only:file_of_proc_fd.simps split:if_splits) |
|
633 |
apply (simp add:cpfd2sfds_def) |
|
1 | 634 |
|
10 | 635 |
apply (auto simp:cpfd2sfds_def split:option.splits if_splits dest:file_of_proc_fd_in_curf proc_fd_in_fds proc_fd_in_procs) |
1 | 636 |
|
10 | 637 |
lemma cpfd2sfds_open1: |
638 |
"valid (Open p f flags fd opt # s) \<Longrightarrow> |
|
639 |
cpfd2sfds (Open p f flags fd opt # s) p = ( |
|
640 |
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 |
|
641 |
(Some sec, Some sf) \<Rightarrow> (cpfd2sfds s p) \<union> {(sec, flags, sf)} |
|
642 |
| _ \<Rightarrow> cpfd2sfds s p)" |
|
643 |
apply (frule vd_cons, frule vt_grant_os) |
|
644 |
apply (case_tac opt) |
|
645 |
apply (auto simp:sectxt_of_obj_simps current_files_simps dest!:current_has_sec' current_file_has_sfile' |
|
646 |
split:option.splits) |
|
647 |
apply (auto simp:cpfd2sfds_def split:if_splits) |
|
648 |
apply (auto simp:cfd2sfd_open cf2sfile_open sectxt_of_obj_simps current_files_simps split:option.splits if_splits dest!:current_has_sec' current_file_has_sfile') |
|
649 |
apply (frule cfd2sfd_open1) |
|
650 |
apply ( |
|
651 |
apply (simp add:cpfd2sfds_def) |
|
652 |
apply (auto simp add:cpfd2sfds_def split:option.splits) |
|
653 |
apply (auto dest!:current_has_sec') |
|
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 (frule cfd2sfd_open1) |
|
662 |
apply (rule ext) |
|
663 |
apply (simp add:cpfd2sfds_def) |
|
664 |
apply (auto simp add:cpfd2sfds_def split:option.splits) |
|
1 | 665 |
|
10 | 666 |
lemma cpfd2sfds_simps = |
1 | 667 |
|
10 | 668 |
(******** cp2sproc simpset *********) |
1 | 669 |
|
670 |
lemma cp2sproc_nil: "p \<in> init_processes \<Longrightarrow> cp2sproc [] p = SInit p" |
|
10 | 671 |
apply (simp add:cp2sproc_def) |
1 | 672 |
by (simp add:cp2sproc_def index_of_proc.simps) |
673 |
||
674 |
lemma cp2sproc_nil': "p \<in> current_procs [] \<Longrightarrow> cp2sproc [] p = SInit p" |
|
675 |
by (simp add:cp2sproc_nil current_procs.simps) |
|
676 |
||
677 |
lemma cp2sproc_clone: "cp2sproc (Clone p p' # \<tau>) p'' = ( |
|
678 |
if (p'' = p') then SCrea (Suc (length \<tau>)) |
|
679 |
else cp2sproc \<tau> p'' )" |
|
680 |
by (auto simp:cp2sproc_def index_of_proc.simps d2s_aux.simps) |
|
681 |
||
682 |
lemma cp2sproc_other: "\<forall> p p'. e \<noteq> Clone p p' \<Longrightarrow> cp2sproc (e # \<tau>) p'' = cp2sproc \<tau> p''" |
|
683 |
apply (case_tac e) |
|
684 |
by (auto simp:cp2sproc_def index_of_proc.simps d2s_aux.simps) |
|
685 |
||
686 |
lemmas cp2sproc_simps = cp2sproc_nil cp2sproc_nil' cp2sproc_clone cp2sproc_other |
|
687 |
||
688 |
(******************** ch2sshm simpset **************************) |
|
689 |
||
690 |
lemma ch2sshm_nil: "h \<in> init_shms \<Longrightarrow> ch2sshm [] h = SInit h" |
|
691 |
by (simp add:ch2sshm_def index_of_shm.simps) |
|
692 |
||
693 |
lemma ch2sshm_nil': "h \<in> current_shms [] \<Longrightarrow> ch2sshm [] h = SInit h" |
|
694 |
by (simp add:ch2sshm_nil current_shms.simps) |
|
695 |
||
696 |
lemma ch2sshm_createshm: "ch2sshm (CreateShM p h # \<tau>) h' = (if (h' = h) then SCrea (Suc (length \<tau>)) else ch2sshm \<tau> h')" |
|
697 |
by (simp add:ch2sshm_def index_of_shm.simps d2s_aux.simps) |
|
698 |
||
699 |
lemma ch2sshm_other: "\<forall> p h. e \<noteq> CreateShM p h \<Longrightarrow> ch2sshm (e # \<tau>) h' = ch2sshm \<tau> h'" |
|
700 |
apply (case_tac e) |
|
701 |
by (auto simp add:ch2sshm_def index_of_shm.simps d2s_aux.simps) |
|
702 |
||
703 |
lemmas ch2sshm_simps = ch2sshm_nil ch2sshm_nil' ch2sshm_createshm ch2sshm_other |
|
704 |
||
705 |
(********************* cm2smsg simpset ***********************) |
|
706 |
||
707 |
lemma cm2smsg_nil: "m \<in> init_msgs \<Longrightarrow> cm2smsg [] m = SInit m" |
|
708 |
by (simp add:cm2smsg_def index_of_msg.simps) |
|
709 |
||
710 |
lemma cm2smsg_nil': "m \<in> current_msgs [] \<Longrightarrow> cm2smsg [] m = SInit m" |
|
711 |
by (simp add:cm2smsg_nil current_msgs.simps) |
|
712 |
||
713 |
lemma cm2smsg_createmsg: "cm2smsg (CreateMsg p m # \<tau>) m' = (if (m' = m) then SCrea (Suc (length \<tau>)) else cm2smsg \<tau> m')" |
|
714 |
by (simp add:cm2smsg_def index_of_msg.simps d2s_aux.simps) |
|
715 |
||
716 |
lemma cm2smsg_other: "\<forall> p m. e \<noteq> CreateMsg p m \<Longrightarrow> cm2smsg (e # \<tau>) m' = cm2smsg \<tau> m'" |
|
717 |
apply (case_tac e) |
|
718 |
by (auto simp:cm2smsg_def index_of_msg.simps d2s_aux.simps) |
|
719 |
||
720 |
lemmas cm2smsg_simps = cm2smsg_nil cm2smsg_nil' cm2smsg_createmsg cm2smsg_other |
|
721 |
||
722 |
(********************** cfd2fd_s simpset ******************************) |
|
723 |
||
724 |
lemma cfd2fd_s_nil: "fd \<in> init_fds_of_proc p \<Longrightarrow> cfd2fd_s [] p fd = SInit fd" |
|
725 |
by (simp add:cfd2fd_s_def index_of_fd.simps) |
|
726 |
||
727 |
lemma cfd2fd_s_nil': "fd \<in> current_proc_fds [] p \<Longrightarrow> cfd2fd_s [] p fd = SInit fd" |
|
728 |
by (simp add:cfd2fd_s_nil current_proc_fds.simps) |
|
729 |
||
730 |
lemma cfd2fd_s_open: "cfd2fd_s (Open p f flags fd opt # \<tau>) p' fd' = ( |
|
731 |
if (p = p') then (if (fd = fd') then SCrea (Suc (length \<tau>)) |
|
732 |
else cfd2fd_s \<tau> p' fd') |
|
733 |
else cfd2fd_s \<tau> p' fd' )" |
|
734 |
by (simp add:cfd2fd_s_def index_of_fd.simps d2s_aux.simps) |
|
735 |
||
736 |
lemma cfd2fd_s_createsock: "cfd2fd_s (CreateSock p af st fd im # \<tau>) p' fd' = ( |
|
737 |
if (p = p') then (if (fd = fd') then SCrea (Suc (length \<tau>)) |
|
738 |
else cfd2fd_s \<tau> p' fd') |
|
739 |
else cfd2fd_s \<tau> p' fd' )" |
|
740 |
by (simp add:cfd2fd_s_def index_of_fd.simps d2s_aux.simps) |
|
741 |
||
742 |
lemma cfd2fd_s_accept: "cfd2fd_s (Accept p fd addr port fd' im # \<tau>) p' fd'' = ( |
|
743 |
if (p' = p) then (if (fd'' = fd') then SCrea (Suc (length \<tau>)) |
|
744 |
else cfd2fd_s \<tau> p' fd'') |
|
745 |
else cfd2fd_s \<tau> p' fd'' )" |
|
746 |
by (simp add:cfd2fd_s_def index_of_fd.simps d2s_aux.simps) |
|
747 |
||
748 |
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)" |
|
749 |
by (simp add:cfd2fd_s_def index_of_fd.simps d2s_aux.simps) |
|
750 |
||
751 |
lemma cfd2fd_s_other: "\<lbrakk>\<forall> p f flags fd opt. e \<noteq> Open p f flags fd opt; |
|
752 |
\<forall> p af st fd im. e \<noteq> CreateSock p af st fd im; |
|
753 |
\<forall> p fd addr port fd' im. e \<noteq> Accept p fd addr port fd' im; |
|
754 |
\<forall> p p'. e \<noteq> Clone p p'\<rbrakk> \<Longrightarrow> cfd2fd_s (e # \<tau>) p'' fd'' = cfd2fd_s \<tau> p'' fd''" |
|
755 |
by (case_tac e, auto simp:cfd2fd_s_def index_of_fd.simps d2s_aux.simps) |
|
756 |
||
757 |
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 |
|
758 |
||
759 |
(************* cim2im_s simpset **************************) |
|
760 |
||
761 |
(* no such lemma |
|
762 |
lemma cim2im_s_nil: "init_itag_of_inum im = Some tag \<Longrightarrow> cim2im_s [] im = SInit im" |
|
763 |
by (simp add:cim2im_s_def) |
|
764 |
*) |
|
765 |
||
766 |
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')" |
|
767 |
by (simp add:cim2im_s_def) |
|
768 |
||
769 |
lemma cim2im_s_open': "cim2im_s (Open p f flags fd None # \<tau>) im = cim2im_s \<tau> im" |
|
770 |
by (simp add:cim2im_s_def) |
|
771 |
||
772 |
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')" |
|
773 |
by (simp add:cim2im_s_def) |
|
774 |
||
775 |
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')" |
|
776 |
by (simp add:cim2im_s_def) |
|
777 |
||
778 |
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')" |
|
779 |
by (simp add:cim2im_s_def) |
|
780 |
||
781 |
lemma cim2im_s_other: "\<lbrakk>\<forall> p f flags fd opt. e \<noteq> Open p f flags fd opt; |
|
782 |
\<forall> p f im. e \<noteq> Mkdir p f im; |
|
783 |
\<forall> p sf st fd im. e \<noteq> CreateSock p sf st fd im; |
|
784 |
\<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" |
|
785 |
by (case_tac e, auto simp:cim2im_s_def) |
|
786 |
||
787 |
lemmas cim2im_s_simps = cim2im_s_open cim2im_s_open' cim2im_s_mkdir cim2im_s_createsock cim2im_s_accept cim2im_s_other |
|
788 |
||
789 |
||
790 |
lemma cig2ig_s_simp: "cig2ig_s (e # \<tau>) tag = cig2ig_s \<tau> tag" |
|
791 |
apply (case_tac tag) |
|
792 |
by auto |
|
793 |
||
794 |
(******************* cobj2sobj no Suc (length \<tau>) ***********************) |
|
795 |
||
796 |
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" |
|
797 |
apply (case_tac f, (simp add:cf2sfile.simps d2s_aux.simps)+) |
|
798 |
apply (case_tac "index_of_file \<tau> (a # list)", (simp add:d2s_aux.simps)+) |
|
799 |
by (drule index_of_file_le_length', simp+) |
|
800 |
||
801 |
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" |
|
802 |
apply (induct f) |
|
803 |
apply (simp add:no_junior_def cf2sfile.simps d2s_aux.simps) |
|
804 |
apply (case_tac "cf2sfile \<tau> (a # f) = SCrea (Suc (length \<tau>)) # spf") |
|
805 |
apply (drule_tac f = "a # f" in cf2sfile_le_len, simp+) |
|
806 |
apply (simp only:cf2sfile.simps d2s_aux.simps) |
|
807 |
apply (drule_tac no_junior_noteq, simp+) |
|
808 |
apply (rule impI, erule impE, simp+) |
|
809 |
apply (drule parentf_in_current', simp+) |
|
810 |
done |
|
811 |
||
812 |
lemma cp2sproc_le_len: "cp2sproc \<tau> p = SCrea (Suc (length \<tau>)) \<Longrightarrow> False" |
|
813 |
apply (simp add:cp2sproc_def, case_tac "index_of_proc \<tau> p") |
|
814 |
apply (simp add:d2s_aux.simps)+ |
|
815 |
by (drule index_of_proc_le_length', simp) |
|
816 |
||
817 |
lemma ch2sshm_le_len: "ch2sshm \<tau> h = SCrea (Suc (length \<tau>)) \<Longrightarrow> False" |
|
818 |
apply (simp add:ch2sshm_def, case_tac "index_of_shm \<tau> h") |
|
819 |
apply (simp add:d2s_aux.simps)+ |
|
820 |
by (drule index_of_shm_le_length', simp) |
|
821 |
||
822 |
lemma cm2smsg_le_len: "cm2smsg \<tau> m = SCrea (Suc (length \<tau>)) \<Longrightarrow> False" |
|
823 |
apply (simp add:cm2smsg_def, case_tac "index_of_msg \<tau> m") |
|
824 |
apply (simp add:d2s_aux.simps)+ |
|
825 |
by (drule index_of_msg_le_length', simp) |
|
826 |
||
827 |
lemma cim2im_s_le_len: "cim2im_s \<tau> im = SCrea (Suc (length \<tau>)) \<Longrightarrow> False" |
|
828 |
apply (simp add:cim2im_s_def, case_tac "inum2ind \<tau> im") |
|
829 |
apply (simp add:d2s_aux.simps)+ |
|
830 |
by (drule inum2ind_le_length', simp) |
|
831 |
||
832 |
lemma cfd2fd_s_le_len: "cfd2fd_s \<tau> p fd = SCrea (Suc (length \<tau>)) \<Longrightarrow> False" |
|
833 |
apply (simp add:cfd2fd_s_def, case_tac "index_of_fd \<tau> p fd") |
|
834 |
apply (simp add:d2s_aux.simps)+ |
|
835 |
by (drule index_of_fd_le_length', simp) |
|
836 |
||
837 |
end |
|
838 |
||
839 |
(*<*) |
|
840 |
end |
|
841 |
(*>*) |