author | chunhan |
Thu, 16 May 2013 15:18:44 +0800 | |
changeset 8 | 289a30c4cfb7 |
parent 7 | f27882976251 |
child 10 | ac66d8ba86d9 |
permissions | -rw-r--r-- |
1 | 1 |
(*<*) |
2 |
theory Co2sobj_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
|
3 |
imports Main Flask Flask_type Static Static_type Sectxt_prop Init_prop Current_files_prop Current_sockets_prop Delete_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 |
|
8 | 374 |
lemma cf2sfile_unlink: |
375 |
"\<lbrakk>valid (UnLink p f # s); f' \<in> current_files (UnLink p f # s)\<rbrakk> |
|
376 |
\<Longrightarrow> cf2sfile (UnLink p f # s) f' = cf2sfile s f'" |
|
377 |
apply (frule vd_cons, frule vt_grant_os) |
|
378 |
apply (simp add:current_files_simps split:if_splits) |
|
379 |
apply (auto simp:cf2sfile_def sectxt_of_obj_simps get_parentfs_ctxts_simps is_file_simps is_dir_simps |
|
380 |
split:if_splits option.splits) |
|
1 | 381 |
|
382 |
||
8 | 383 |
lemmas cf2sfile_simps = cf2sfile_open cf2sfile_mkdir cf2sfile_linkhard cf2sfile_other |
384 |
||
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
|
385 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
386 |
|
1 | 387 |
|
388 |
||
389 |
||
390 |
||
391 |
||
392 |
||
393 |
||
394 |
||
395 |
||
396 |
||
397 |
||
398 |
||
399 |
lemma cf2sfile_keep_path: "\<lbrakk>f \<preceq> f'; \<tau> \<in> vt rc_cs\<rbrakk> \<Longrightarrow> cf2sfile \<tau> f \<preceq> cf2sfile \<tau> f'" |
|
400 |
apply (induct f', simp add:no_junior_def) |
|
401 |
apply (case_tac "f = a # f'", simp add:cf2sfile.simps) |
|
402 |
apply (drule no_junior_noteq, simp, simp add:cf2sfile.simps) |
|
403 |
done |
|
404 |
||
405 |
lemma ckp'_aux: "\<not> f \<preceq> a # f' \<Longrightarrow> \<not> f \<preceq> f'" |
|
406 |
by (auto simp:no_junior_def) |
|
407 |
||
408 |
lemma cf2sfile_keep_path': "\<lbrakk>\<not> f \<preceq> f'; \<tau> \<in> vt rc_cs; f \<in> current_files \<tau>; f' \<in> current_files \<tau>\<rbrakk> \<Longrightarrow> \<not> cf2sfile \<tau> f \<preceq> cf2sfile \<tau> f'" |
|
409 |
apply (induct f', simp add:no_junior_def cf2sfile.simps, rule notI, drule cf2sfile_root_file, simp) |
|
410 |
apply (case_tac "f = a # f'", simp add:cf2sfile.simps) |
|
411 |
apply (rule notI) |
|
412 |
apply (frule ckp'_aux, simp, frule parentf_in_current', simp+) |
|
413 |
apply (case_tac "cf2sfile \<tau> f = cf2sfile \<tau> (a # f')", drule cf2sfile_inj, simp+) |
|
414 |
apply (simp add:cf2sfile.simps) |
|
415 |
by (drule no_junior_noteq, simp+) |
|
416 |
||
417 |
lemma cf2sfile_keep_path'': "\<lbrakk>cf2sfile \<tau> f \<preceq> cf2sfile \<tau> f'; \<tau> \<in> vt rc_cs; f \<in> current_files \<tau>; f' \<in> current_files \<tau>\<rbrakk> \<Longrightarrow> f \<preceq> f'" |
|
418 |
using cf2sfile_keep_path' |
|
419 |
by (auto) |
|
420 |
||
421 |
lemma cf2sfile_open_some': "\<lbrakk>f \<in> current_files \<tau>; Open p f' flags fd (Some inum) # \<tau> \<in> vt rc_cs\<rbrakk> \<Longrightarrow> cf2sfile (Open p f' flags fd (Some inum) # \<tau>) f = cf2sfile \<tau> f" |
|
422 |
apply (frule vt_cons') |
|
423 |
apply (drule vt_grant_os) |
|
424 |
apply (induct f) |
|
425 |
apply (simp add:cf2sfile.simps)+ |
|
426 |
apply (frule parentf_in_current', simp) |
|
427 |
apply (auto simp:os_grant.simps index_of_file.simps split:option.splits) |
|
428 |
done |
|
429 |
||
430 |
lemma cf2sfile_open_some: "\<lbrakk>Open p f flags fd (Some inum) # \<tau> \<in> vt rc_cs; parent f = Some pf\<rbrakk> |
|
431 |
\<Longrightarrow> cf2sfile (Open p f flags fd (Some inum) # \<tau>) f = (SCrea (Suc (length \<tau>)) # (cf2sfile \<tau> pf))" |
|
432 |
apply (case_tac f, simp) |
|
433 |
apply (frule vt_grant_os) |
|
434 |
apply (simp add:cf2sfile.simps os_grant.simps current_files_simps index_of_file.simps cf2sfile_open_some') |
|
435 |
done |
|
436 |
||
437 |
lemma cf2sfile_open_none: "cf2sfile (Open p f flags fd None # \<tau>) f' = cf2sfile \<tau> f'" |
|
438 |
apply (induct f') |
|
439 |
by (simp add:cf2sfile.simps index_of_file.simps split:option.splits nat.splits)+ |
|
440 |
||
441 |
lemma cf2sfile_open: "\<lbrakk>Open p f flags fd opt # \<tau> \<in> vt rc_cs; f' \<in> current_files (Open p f flags fd opt # \<tau>)\<rbrakk> \<Longrightarrow> |
|
442 |
cf2sfile (Open p f flags fd opt # \<tau>) f' = ( |
|
443 |
if (opt = None) then cf2sfile \<tau> f' |
|
444 |
else if (f' = f) then (case (parent f) of |
|
445 |
Some pf \<Rightarrow> (SCrea (Suc (length \<tau>)) # (cf2sfile \<tau> pf)) |
|
446 |
| _ \<Rightarrow> []) |
|
447 |
else cf2sfile \<tau> f' )" |
|
448 |
apply (frule vt_grant_os) |
|
449 |
by (auto simp:os_grant.simps current_files_simps intro:cf2sfile_open_none cf2sfile_open_some cf2sfile_open_some' split:if_splits option.splits) |
|
450 |
||
451 |
lemma cf2sfile_mkdir_some': "\<lbrakk>Mkdir p f' inum # \<tau> \<in> vt rc_cs; f \<in> current_files \<tau>\<rbrakk> \<Longrightarrow> cf2sfile (Mkdir p f' inum # \<tau>) f = cf2sfile \<tau> f" |
|
452 |
apply (frule vt_cons', drule vt_grant_os) |
|
453 |
apply (induct f, (simp add:cf2sfile.simps)+) |
|
454 |
apply (frule parentf_in_current', simp) |
|
455 |
apply (auto simp:os_grant.simps index_of_file.simps split:option.splits) |
|
456 |
done |
|
457 |
||
458 |
lemma cf2sfile_mkdir_some: "\<lbrakk>Mkdir p f inum # \<tau> \<in> vt rc_cs; parent f = Some pf\<rbrakk> |
|
459 |
\<Longrightarrow> cf2sfile (Mkdir p f inum # \<tau>) f = (SCrea (Suc (length \<tau>)) # (cf2sfile \<tau> pf))" |
|
460 |
apply (case_tac f, simp) |
|
461 |
apply (frule vt_grant_os) |
|
462 |
apply (simp add:cf2sfile.simps os_grant.simps current_files_simps index_of_file.simps cf2sfile_mkdir_some') |
|
463 |
done |
|
464 |
||
465 |
lemma cf2sfile_mkdir: "\<lbrakk>Mkdir p f inum # \<tau> \<in> vt rc_cs; f' \<in> current_files (Mkdir p f inum # \<tau>)\<rbrakk> \<Longrightarrow> |
|
466 |
cf2sfile (Mkdir p f inum # \<tau>) f' = ( |
|
467 |
if (f' = f) then (case (parent f) of |
|
468 |
Some pf \<Rightarrow> (SCrea (Suc (length \<tau>)) # (cf2sfile \<tau> pf)) |
|
469 |
| _ \<Rightarrow> []) |
|
470 |
else cf2sfile \<tau> f' ) " |
|
471 |
apply (frule vt_grant_os) |
|
472 |
by (auto simp:os_grant.simps current_files_simps intro:cf2sfile_mkdir_some cf2sfile_mkdir_some' split:if_splits option.splits) |
|
473 |
||
474 |
lemma cf2sfile_linkhard_none: "\<lbrakk>LinkHard p f\<^isub>1 f\<^isub>2 # \<tau> \<in> vt rc_cs; f \<in> current_files \<tau>\<rbrakk> \<Longrightarrow> cf2sfile (LinkHard p f\<^isub>1 f\<^isub>2 # \<tau>) f = cf2sfile \<tau> f" |
|
475 |
apply (frule vt_cons') |
|
476 |
apply (drule vt_grant_os) |
|
477 |
apply (induct f) |
|
478 |
apply (simp add:cf2sfile.simps)+ |
|
479 |
apply (frule parentf_in_current', simp) |
|
480 |
apply (auto simp:os_grant.simps index_of_file.simps split:option.splits) |
|
481 |
done |
|
482 |
||
483 |
lemma cf2sfile_linkhard_some: |
|
484 |
"\<lbrakk>LinkHard p f\<^isub>1 f\<^isub>2 # \<tau> \<in> vt rc_cs; parent f\<^isub>2 = Some pf\<^isub>2\<rbrakk> \<Longrightarrow> cf2sfile (LinkHard p f\<^isub>1 f\<^isub>2 # \<tau>) f\<^isub>2 = (SCrea (Suc (length \<tau>)) # (cf2sfile \<tau> pf\<^isub>2))" |
|
485 |
apply (case_tac f\<^isub>2, simp) |
|
486 |
apply (frule vt_grant_os) |
|
487 |
apply (simp add:cf2sfile.simps os_grant.simps current_files_simps index_of_file.simps cf2sfile_linkhard_none) |
|
488 |
done |
|
489 |
||
490 |
lemma cf2sfile_linkhard: "\<lbrakk>LinkHard p f\<^isub>1 f\<^isub>2 # \<tau> \<in> vt rc_cs; f \<in> current_files (LinkHard p f\<^isub>1 f\<^isub>2 # \<tau>)\<rbrakk> \<Longrightarrow> |
|
491 |
cf2sfile (LinkHard p f\<^isub>1 f\<^isub>2 # \<tau>) f = ( |
|
492 |
if (f = f\<^isub>2) then (case (parent f\<^isub>2) of |
|
493 |
Some pf\<^isub>2 \<Rightarrow> SCrea (Suc (length \<tau>)) # (cf2sfile \<tau> pf\<^isub>2) |
|
494 |
| _ \<Rightarrow> []) |
|
495 |
else cf2sfile \<tau> f )" |
|
496 |
apply (frule vt_grant_os) |
|
497 |
by (auto simp:os_grant.simps current_files_simps intro:cf2sfile_linkhard_none cf2sfile_linkhard_some split:if_splits option.splits) |
|
498 |
||
499 |
||
500 |
lemma no_junior_aux: "\<not> f\<^isub>2 \<preceq> a # f \<Longrightarrow> \<not> f\<^isub>2 \<preceq> f" |
|
501 |
by (auto simp:no_junior_def) |
|
502 |
||
503 |
lemma cf2sfile_rename_aux: "\<lbrakk>Rename p f\<^isub>2 f\<^isub>3 # \<tau> \<in> vt rc_cs; f \<in> current_files \<tau>\<rbrakk> \<Longrightarrow> f \<noteq> f\<^isub>3 \<and> \<not> f\<^isub>3 \<preceq> f" |
|
504 |
apply (frule vt_grant_os, simp add:os_grant.simps, (erule exE|erule conjE)+) |
|
505 |
apply (rule conjI, rule notI, simp) |
|
506 |
apply (rule notI, drule vt_cons', simp add:ancenf_in_current) |
|
507 |
done |
|
508 |
||
509 |
lemma cf2sfile_rename'1: |
|
510 |
"\<lbrakk>Rename p f\<^isub>2 f\<^isub>3 # \<tau> \<in> vt rc_cs; f \<in> current_files \<tau>; \<not> (f\<^isub>2 \<preceq> f)\<rbrakk> \<Longrightarrow> cf2sfile (Rename p f\<^isub>2 f\<^isub>3 # \<tau>) f = cf2sfile \<tau> f" |
|
511 |
apply (frule vt_cons',frule vt_grant_os, induct f) |
|
512 |
apply (simp add:cf2sfile.simps) |
|
513 |
apply (frule parentf_in_current', simp, simp) |
|
514 |
apply (frule no_junior_aux, simp) |
|
515 |
apply (simp add:os_grant.simps, (erule exE|erule conjE)+) |
|
516 |
apply (drule cf2sfile_rename_aux, simp, erule conjE) |
|
517 |
apply (auto simp add:cf2sfile.simps index_of_file.simps split:option.splits nat.splits) |
|
518 |
done |
|
519 |
||
520 |
lemma cf2sfile_rename'2: |
|
521 |
"\<lbrakk>Rename p f\<^isub>2 f\<^isub>3 # \<tau> \<in> vt rc_cs; \<not> (f\<^isub>3 \<preceq> f)\<rbrakk> \<Longrightarrow> cf2sfile (Rename p f\<^isub>2 f\<^isub>3 # \<tau>) f = cf2sfile \<tau> f" |
|
522 |
apply (frule vt_cons', induct f) |
|
523 |
by (auto simp add:index_of_file.simps cf2sfile.simps no_junior_def split:option.splits nat.splits) |
|
524 |
||
525 |
lemma cf2sfile_rename1: |
|
526 |
"\<lbrakk>Rename p f\<^isub>2 f\<^isub>3 # \<tau> \<in> vt rc_cs; parent f\<^isub>3 = Some pf\<^isub>3\<rbrakk> \<Longrightarrow> cf2sfile (Rename p f\<^isub>2 f\<^isub>3 # \<tau>) f\<^isub>3 = SCrea (Suc (length \<tau>)) # (cf2sfile \<tau> pf\<^isub>3)" |
|
527 |
apply (case_tac f\<^isub>3, simp add:cf2sfile.simps) |
|
528 |
apply (auto dest!:cf2sfile_rename'2 simp add:no_junior_def cf2sfile.simps index_of_file.simps split:option.splits) |
|
529 |
done |
|
530 |
||
531 |
lemma index_of_file_rename1: "\<lbrakk>f\<^isub>2 \<preceq> f; f \<noteq> f\<^isub>2\<rbrakk> \<Longrightarrow> index_of_file (Rename p f\<^isub>2 f\<^isub>3 # \<tau>) (file_after_rename f\<^isub>2 f\<^isub>3 f) = index_of_file \<tau> f" |
|
532 |
apply (clarsimp simp add:index_of_file.simps split:option.splits) |
|
533 |
by (frule_tac f\<^isub>3 = f\<^isub>3 in file_renaming_prop3, simp, erule conjE, simp add:file_renaming_prop5) |
|
534 |
||
535 |
lemma cf2sfile_rename2: "\<lbrakk>Rename p f\<^isub>2 f\<^isub>3 # \<tau> \<in> vt rc_cs; (file_before_rename f\<^isub>2 f\<^isub>3 f) \<in> current_files \<tau>; parent f\<^isub>3 = Some pf\<^isub>3; f\<^isub>3 \<preceq> f\<rbrakk> |
|
536 |
\<Longrightarrow> cf2sfile (Rename p f\<^isub>2 f\<^isub>3 # \<tau>) f = file_after_rename (cf2sfile \<tau> f\<^isub>2) (SCrea (Suc (length \<tau>)) # (cf2sfile \<tau> pf\<^isub>3)) (cf2sfile \<tau> (file_before_rename f\<^isub>2 f\<^isub>3 f))" |
|
537 |
apply (induct f, simp add:no_junior_def) |
|
538 |
apply (case_tac "a # f = f\<^isub>3", simp) |
|
539 |
apply (drule cf2sfile_rename1, simp, simp add:file_renaming_prop0' file_renaming_prop0) |
|
540 |
||
541 |
apply (frule no_junior_noteq, simp, simp) |
|
542 |
apply (frule_tac file_renaming_prop1') |
|
543 |
apply (frule_tac f = f\<^isub>2 and \<tau> = \<tau> in cf2sfile_keep_path, simp add:vt_cons') |
|
544 |
apply (frule_tac f\<^isub>2 = f\<^isub>2 and a = a in file_renaming_prop8') |
|
545 |
apply (frule_tac f\<^isub>2 = f\<^isub>2 and a = a in file_renaming_prop6') |
|
546 |
apply (frule_tac f = "file_before_rename f\<^isub>2 f\<^isub>3 (a # f)" and \<tau> = \<tau> and f\<^isub>2 = f\<^isub>2 and f\<^isub>3 = f\<^isub>3 and p = p in index_of_file_rename1, simp add:file_before_rename_def) |
|
547 |
apply (drule_tac f\<^isub>3 = f\<^isub>3 and f\<^isub>1 = f and a = a and f\<^isub>2 = f\<^isub>2 in file_renaming_prop9', simp) |
|
548 |
apply (drule parentf_in_current', simp add:vt_cons') |
|
549 |
apply (simp add:cf2sfile.simps) |
|
550 |
apply (erule file_renaming_prop6[THEN sym]) |
|
551 |
done |
|
552 |
||
553 |
lemma cf2sfile_rename2': "\<lbrakk>Rename p f\<^isub>2 f\<^isub>3 # \<tau> \<in> vt rc_cs; f \<in> current_files \<tau>; parent f\<^isub>3 = Some pf\<^isub>3; f\<^isub>2 \<preceq> f\<rbrakk> |
|
554 |
\<Longrightarrow> cf2sfile (Rename p f\<^isub>2 f\<^isub>3 # \<tau>) (file_after_rename f\<^isub>2 f\<^isub>3 f) = file_after_rename (cf2sfile \<tau> f\<^isub>2) (SCrea (Suc (length \<tau>)) # (cf2sfile \<tau> pf\<^isub>3)) (cf2sfile \<tau> f)" |
|
555 |
apply (frule_tac f\<^isub>3 = f\<^isub>3 in file_renaming_prop5) |
|
556 |
apply (frule_tac f\<^isub>3 = f\<^isub>3 in file_renaming_prop1) |
|
557 |
apply (drule_tac f = "file_after_rename f\<^isub>2 f\<^isub>3 f" in cf2sfile_rename2, simp+) |
|
558 |
done |
|
559 |
||
560 |
lemma cf2sfile_rename3: "\<lbrakk>Rename p f\<^isub>2 f\<^isub>3 # \<tau> \<in> vt rc_cs; f \<in> current_files \<tau>; parent f\<^isub>3 = Some pf\<^isub>3\<rbrakk> |
|
561 |
\<Longrightarrow> cf2sfile (Rename p f\<^isub>2 f\<^isub>3 # \<tau>) (file_after_rename f\<^isub>2 f\<^isub>3 f) = file_after_rename (cf2sfile \<tau> f\<^isub>2) (SCrea (Suc (length \<tau>)) # (cf2sfile \<tau> pf\<^isub>3)) (cf2sfile \<tau> f)" |
|
562 |
apply (case_tac "f\<^isub>2 \<preceq> f") |
|
563 |
apply (rule cf2sfile_rename2', simp+) |
|
564 |
apply (frule vt_grant_os) |
|
565 |
apply (frule_tac \<tau> = \<tau> in cf2sfile_keep_path', simp add:vt_cons', simp add:os_grant.simps, simp) |
|
566 |
apply (simp add:file_after_rename_def) |
|
567 |
by (rule cf2sfile_rename'1, simp+) |
|
568 |
||
569 |
lemma cf2sfile_rename: "\<lbrakk>Rename p f\<^isub>2 f\<^isub>3 # \<tau> \<in> vt rc_cs; f \<in> current_files (Rename p f\<^isub>2 f\<^isub>3 # \<tau>)\<rbrakk> \<Longrightarrow> |
|
570 |
cf2sfile (Rename p f\<^isub>2 f\<^isub>3 # \<tau>) f = ( |
|
571 |
if (f\<^isub>3 \<preceq> f) then (case (parent f\<^isub>3) of |
|
572 |
Some pf\<^isub>3 \<Rightarrow> file_after_rename (cf2sfile \<tau> f\<^isub>2) (SCrea (Suc (length \<tau>)) # (cf2sfile \<tau> pf\<^isub>3)) (cf2sfile \<tau> (file_before_rename f\<^isub>2 f\<^isub>3 f)) |
|
573 |
| _ \<Rightarrow> []) |
|
574 |
else cf2sfile \<tau> f )" |
|
575 |
apply (frule vt_grant_os) |
|
576 |
apply (case_tac "f = f\<^isub>3", clarsimp simp:os_grant.simps, drule cf2sfile_rename1, simp+, simp add:file_renaming_prop0' file_renaming_prop0) |
|
577 |
||
578 |
apply (auto simp:os_grant.simps current_files_simps intro:cf2sfile_rename'2 cf2sfile_rename1 split:if_splits option.splits) |
|
579 |
apply (rule cf2sfile_rename2, simp, drule rename_renaming_decom, simp+) |
|
580 |
apply (drule_tac f\<^isub>2 = f\<^isub>2 and f\<^isub>1 = f\<^isub>1 and f\<^isub>3 = f\<^isub>3 in file_renaming_prop5, simp+) |
|
581 |
done |
|
582 |
||
583 |
lemma cf2sfile_other: "\<lbrakk> |
|
584 |
\<forall> p f flags fd opt. e \<noteq> Open p f flags fd opt; |
|
585 |
\<forall> p f im. e \<noteq> Mkdir p f im; |
|
586 |
\<forall> p f\<^isub>1 f\<^isub>2. e \<noteq> LinkHard p f\<^isub>1 f\<^isub>2; |
|
587 |
\<forall> p f\<^isub>2 f\<^isub>3. e \<noteq> Rename p f\<^isub>2 f\<^isub>3\<rbrakk> \<Longrightarrow> cf2sfile (e # \<tau>) f' = cf2sfile \<tau> f'" |
|
588 |
apply (induct f', simp add:cf2sfile.simps index_of_file.simps split:option.splits nat.splits) |
|
589 |
apply (case_tac e, auto simp add:cf2sfile.simps index_of_file.simps split:option.splits nat.splits) |
|
590 |
done |
|
591 |
||
592 |
lemmas cf2sfile_nil = init_cf2sfile |
|
593 |
||
594 |
lemma cf2sfile_nil': "f \<in> current_files [] \<Longrightarrow> cf2sfile [] f = map SInit f" |
|
595 |
by (simp add:cf2sfile_nil current_files_simps) |
|
596 |
||
597 |
lemmas cf2sfile_simps = cf2sfile_nil cf2sfile_nil' cf2sfile_open cf2sfile_mkdir cf2sfile_linkhard cf2sfile_rename cf2sfile_other |
|
598 |
||
599 |
lemmas cf2sfile_simpss = cf2sfile_nil cf2sfile_nil' cf2sfile_open_some' cf2sfile_open_some cf2sfile_open_none cf2sfile_open cf2sfile_mkdir_some' cf2sfile_mkdir_some |
|
600 |
cf2sfile_mkdir cf2sfile_linkhard_none cf2sfile_linkhard_some cf2sfile_linkhard cf2sfile_rename'1 cf2sfile_rename'2 cf2sfile_rename1 |
|
601 |
cf2sfile_rename2 cf2sfile_rename2' cf2sfile_rename3 cf2sfile_rename cf2sfile_other |
|
602 |
||
603 |
lemma cf2sfile_open_some'_inum: "\<lbrakk>Open p f' flags fd (Some inum) # \<tau> \<in> vt rc_cs; inum_of_file \<tau> f = Some im\<rbrakk> \<Longrightarrow> cf2sfile (Open p f' flags fd (Some inum) # \<tau>) f = cf2sfile \<tau> f" |
|
604 |
by (simp add:cf2sfile_open_some' current_files_def) |
|
605 |
||
606 |
lemma cf2sfile_mkdir_some'_inum: "\<lbrakk>Mkdir p f' inum # \<tau> \<in> vt rc_cs; inum_of_file \<tau> f = Some im\<rbrakk> \<Longrightarrow> cf2sfile (Mkdir p f' inum # \<tau>) f = cf2sfile \<tau> f" |
|
607 |
by (simp add:cf2sfile_mkdir_some' current_files_def) |
|
608 |
||
609 |
lemma cf2sfile_linkhard_none_inum: "\<lbrakk>LinkHard p f\<^isub>1 f\<^isub>2 # \<tau> \<in> vt rc_cs; inum_of_file \<tau> f = Some im\<rbrakk> \<Longrightarrow> cf2sfile (LinkHard p f\<^isub>1 f\<^isub>2 # \<tau>) f = cf2sfile \<tau> f" |
|
610 |
by (simp add:cf2sfile_linkhard_none current_files_def) |
|
611 |
||
612 |
lemma cf2sfile_rename'1_inum: |
|
613 |
"\<lbrakk>Rename p f\<^isub>2 f\<^isub>3 # \<tau> \<in> vt rc_cs; inum_of_file \<tau> f = Some im ; \<not> (f\<^isub>2 \<preceq> f)\<rbrakk> \<Longrightarrow> cf2sfile (Rename p f\<^isub>2 f\<^isub>3 # \<tau>) f = cf2sfile \<tau> f" |
|
614 |
by (simp add:cf2sfile_rename'1 current_files_def) |
|
615 |
||
616 |
lemma cf2sfile_rename2_inum: "\<lbrakk>Rename p f\<^isub>2 f\<^isub>3 # \<tau> \<in> vt rc_cs; inum_of_file \<tau> (file_before_rename f\<^isub>2 f\<^isub>3 f) = Some im; parent f\<^isub>3 = Some pf\<^isub>3; f\<^isub>3 \<preceq> f\<rbrakk> |
|
617 |
\<Longrightarrow> cf2sfile (Rename p f\<^isub>2 f\<^isub>3 # \<tau>) f = file_after_rename (cf2sfile \<tau> f\<^isub>2) (SCrea (Suc (length \<tau>)) # (cf2sfile \<tau> pf\<^isub>3)) (cf2sfile \<tau> (file_before_rename f\<^isub>2 f\<^isub>3 f))" |
|
618 |
by (simp add:cf2sfile_rename2 current_files_def) |
|
619 |
||
620 |
lemma cf2sfile_rename2'_inum: "\<lbrakk>Rename p f\<^isub>2 f\<^isub>3 # \<tau> \<in> vt rc_cs; inum_of_file \<tau> f = Some im; parent f\<^isub>3 = Some pf\<^isub>3; f\<^isub>2 \<preceq> f\<rbrakk> |
|
621 |
\<Longrightarrow> cf2sfile (Rename p f\<^isub>2 f\<^isub>3 # \<tau>) (file_after_rename f\<^isub>2 f\<^isub>3 f) = file_after_rename (cf2sfile \<tau> f\<^isub>2) (SCrea (Suc (length \<tau>)) # (cf2sfile \<tau> pf\<^isub>3)) (cf2sfile \<tau> f)" |
|
622 |
by (simp add:cf2sfile_rename2' current_files_def) |
|
623 |
||
624 |
lemma cf2sfile_rename3_inum: "\<lbrakk>Rename p f\<^isub>2 f\<^isub>3 # \<tau> \<in> vt rc_cs; inum_of_file \<tau> f = Some im; parent f\<^isub>3 = Some pf\<^isub>3\<rbrakk> |
|
625 |
\<Longrightarrow> cf2sfile (Rename p f\<^isub>2 f\<^isub>3 # \<tau>) (file_after_rename f\<^isub>2 f\<^isub>3 f) = file_after_rename (cf2sfile \<tau> f\<^isub>2) (SCrea (Suc (length \<tau>)) # (cf2sfile \<tau> pf\<^isub>3)) (cf2sfile \<tau> f)" |
|
626 |
by (simp add:cf2sfile_rename3 current_files_def) |
|
627 |
||
628 |
lemma cf2sfile_nil'_inum: "inum_of_file [] f = Some im \<Longrightarrow> cf2sfile [] f = map SInit f" |
|
629 |
by (simp add:cf2sfile_nil' current_files_def) |
|
630 |
||
631 |
lemmas cf2sfile_simps_inum = cf2sfile_nil cf2sfile_nil'_inum cf2sfile_open_some'_inum cf2sfile_open_some cf2sfile_open_none cf2sfile_open cf2sfile_mkdir_some'_inum cf2sfile_mkdir_some |
|
632 |
cf2sfile_mkdir cf2sfile_linkhard_none_inum cf2sfile_linkhard_some cf2sfile_linkhard cf2sfile_rename'1_inum cf2sfile_rename'2 cf2sfile_rename1 |
|
633 |
cf2sfile_rename2_inum cf2sfile_rename2'_inum cf2sfile_rename3_inum cf2sfile_rename cf2sfile_other |
|
634 |
||
635 |
(*************** cp2sproc simpset *********************) |
|
636 |
||
637 |
lemma cp2sproc_nil: "p \<in> init_processes \<Longrightarrow> cp2sproc [] p = SInit p" |
|
638 |
by (simp add:cp2sproc_def index_of_proc.simps) |
|
639 |
||
640 |
lemma cp2sproc_nil': "p \<in> current_procs [] \<Longrightarrow> cp2sproc [] p = SInit p" |
|
641 |
by (simp add:cp2sproc_nil current_procs.simps) |
|
642 |
||
643 |
lemma cp2sproc_clone: "cp2sproc (Clone p p' # \<tau>) p'' = ( |
|
644 |
if (p'' = p') then SCrea (Suc (length \<tau>)) |
|
645 |
else cp2sproc \<tau> p'' )" |
|
646 |
by (auto simp:cp2sproc_def index_of_proc.simps d2s_aux.simps) |
|
647 |
||
648 |
lemma cp2sproc_other: "\<forall> p p'. e \<noteq> Clone p p' \<Longrightarrow> cp2sproc (e # \<tau>) p'' = cp2sproc \<tau> p''" |
|
649 |
apply (case_tac e) |
|
650 |
by (auto simp:cp2sproc_def index_of_proc.simps d2s_aux.simps) |
|
651 |
||
652 |
lemmas cp2sproc_simps = cp2sproc_nil cp2sproc_nil' cp2sproc_clone cp2sproc_other |
|
653 |
||
654 |
(******************** ch2sshm simpset **************************) |
|
655 |
||
656 |
lemma ch2sshm_nil: "h \<in> init_shms \<Longrightarrow> ch2sshm [] h = SInit h" |
|
657 |
by (simp add:ch2sshm_def index_of_shm.simps) |
|
658 |
||
659 |
lemma ch2sshm_nil': "h \<in> current_shms [] \<Longrightarrow> ch2sshm [] h = SInit h" |
|
660 |
by (simp add:ch2sshm_nil current_shms.simps) |
|
661 |
||
662 |
lemma ch2sshm_createshm: "ch2sshm (CreateShM p h # \<tau>) h' = (if (h' = h) then SCrea (Suc (length \<tau>)) else ch2sshm \<tau> h')" |
|
663 |
by (simp add:ch2sshm_def index_of_shm.simps d2s_aux.simps) |
|
664 |
||
665 |
lemma ch2sshm_other: "\<forall> p h. e \<noteq> CreateShM p h \<Longrightarrow> ch2sshm (e # \<tau>) h' = ch2sshm \<tau> h'" |
|
666 |
apply (case_tac e) |
|
667 |
by (auto simp add:ch2sshm_def index_of_shm.simps d2s_aux.simps) |
|
668 |
||
669 |
lemmas ch2sshm_simps = ch2sshm_nil ch2sshm_nil' ch2sshm_createshm ch2sshm_other |
|
670 |
||
671 |
(********************* cm2smsg simpset ***********************) |
|
672 |
||
673 |
lemma cm2smsg_nil: "m \<in> init_msgs \<Longrightarrow> cm2smsg [] m = SInit m" |
|
674 |
by (simp add:cm2smsg_def index_of_msg.simps) |
|
675 |
||
676 |
lemma cm2smsg_nil': "m \<in> current_msgs [] \<Longrightarrow> cm2smsg [] m = SInit m" |
|
677 |
by (simp add:cm2smsg_nil current_msgs.simps) |
|
678 |
||
679 |
lemma cm2smsg_createmsg: "cm2smsg (CreateMsg p m # \<tau>) m' = (if (m' = m) then SCrea (Suc (length \<tau>)) else cm2smsg \<tau> m')" |
|
680 |
by (simp add:cm2smsg_def index_of_msg.simps d2s_aux.simps) |
|
681 |
||
682 |
lemma cm2smsg_other: "\<forall> p m. e \<noteq> CreateMsg p m \<Longrightarrow> cm2smsg (e # \<tau>) m' = cm2smsg \<tau> m'" |
|
683 |
apply (case_tac e) |
|
684 |
by (auto simp:cm2smsg_def index_of_msg.simps d2s_aux.simps) |
|
685 |
||
686 |
lemmas cm2smsg_simps = cm2smsg_nil cm2smsg_nil' cm2smsg_createmsg cm2smsg_other |
|
687 |
||
688 |
(********************** cfd2fd_s simpset ******************************) |
|
689 |
||
690 |
lemma cfd2fd_s_nil: "fd \<in> init_fds_of_proc p \<Longrightarrow> cfd2fd_s [] p fd = SInit fd" |
|
691 |
by (simp add:cfd2fd_s_def index_of_fd.simps) |
|
692 |
||
693 |
lemma cfd2fd_s_nil': "fd \<in> current_proc_fds [] p \<Longrightarrow> cfd2fd_s [] p fd = SInit fd" |
|
694 |
by (simp add:cfd2fd_s_nil current_proc_fds.simps) |
|
695 |
||
696 |
lemma cfd2fd_s_open: "cfd2fd_s (Open p f flags fd opt # \<tau>) p' fd' = ( |
|
697 |
if (p = p') then (if (fd = fd') then SCrea (Suc (length \<tau>)) |
|
698 |
else cfd2fd_s \<tau> p' fd') |
|
699 |
else cfd2fd_s \<tau> p' fd' )" |
|
700 |
by (simp add:cfd2fd_s_def index_of_fd.simps d2s_aux.simps) |
|
701 |
||
702 |
lemma cfd2fd_s_createsock: "cfd2fd_s (CreateSock p af st fd im # \<tau>) p' fd' = ( |
|
703 |
if (p = p') then (if (fd = fd') then SCrea (Suc (length \<tau>)) |
|
704 |
else cfd2fd_s \<tau> p' fd') |
|
705 |
else cfd2fd_s \<tau> p' fd' )" |
|
706 |
by (simp add:cfd2fd_s_def index_of_fd.simps d2s_aux.simps) |
|
707 |
||
708 |
lemma cfd2fd_s_accept: "cfd2fd_s (Accept p fd addr port fd' im # \<tau>) p' fd'' = ( |
|
709 |
if (p' = p) then (if (fd'' = fd') then SCrea (Suc (length \<tau>)) |
|
710 |
else cfd2fd_s \<tau> p' fd'') |
|
711 |
else cfd2fd_s \<tau> p' fd'' )" |
|
712 |
by (simp add:cfd2fd_s_def index_of_fd.simps d2s_aux.simps) |
|
713 |
||
714 |
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)" |
|
715 |
by (simp add:cfd2fd_s_def index_of_fd.simps d2s_aux.simps) |
|
716 |
||
717 |
lemma cfd2fd_s_other: "\<lbrakk>\<forall> p f flags fd opt. e \<noteq> Open p f flags fd opt; |
|
718 |
\<forall> p af st fd im. e \<noteq> CreateSock p af st fd im; |
|
719 |
\<forall> p fd addr port fd' im. e \<noteq> Accept p fd addr port fd' im; |
|
720 |
\<forall> p p'. e \<noteq> Clone p p'\<rbrakk> \<Longrightarrow> cfd2fd_s (e # \<tau>) p'' fd'' = cfd2fd_s \<tau> p'' fd''" |
|
721 |
by (case_tac e, auto simp:cfd2fd_s_def index_of_fd.simps d2s_aux.simps) |
|
722 |
||
723 |
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 |
|
724 |
||
725 |
(************* cim2im_s simpset **************************) |
|
726 |
||
727 |
(* no such lemma |
|
728 |
lemma cim2im_s_nil: "init_itag_of_inum im = Some tag \<Longrightarrow> cim2im_s [] im = SInit im" |
|
729 |
by (simp add:cim2im_s_def) |
|
730 |
*) |
|
731 |
||
732 |
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')" |
|
733 |
by (simp add:cim2im_s_def) |
|
734 |
||
735 |
lemma cim2im_s_open': "cim2im_s (Open p f flags fd None # \<tau>) im = cim2im_s \<tau> im" |
|
736 |
by (simp add:cim2im_s_def) |
|
737 |
||
738 |
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')" |
|
739 |
by (simp add:cim2im_s_def) |
|
740 |
||
741 |
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')" |
|
742 |
by (simp add:cim2im_s_def) |
|
743 |
||
744 |
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')" |
|
745 |
by (simp add:cim2im_s_def) |
|
746 |
||
747 |
lemma cim2im_s_other: "\<lbrakk>\<forall> p f flags fd opt. e \<noteq> Open p f flags fd opt; |
|
748 |
\<forall> p f im. e \<noteq> Mkdir p f im; |
|
749 |
\<forall> p sf st fd im. e \<noteq> CreateSock p sf st fd im; |
|
750 |
\<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" |
|
751 |
by (case_tac e, auto simp:cim2im_s_def) |
|
752 |
||
753 |
lemmas cim2im_s_simps = cim2im_s_open cim2im_s_open' cim2im_s_mkdir cim2im_s_createsock cim2im_s_accept cim2im_s_other |
|
754 |
||
755 |
||
756 |
lemma cig2ig_s_simp: "cig2ig_s (e # \<tau>) tag = cig2ig_s \<tau> tag" |
|
757 |
apply (case_tac tag) |
|
758 |
by auto |
|
759 |
||
760 |
(******************* cobj2sobj no Suc (length \<tau>) ***********************) |
|
761 |
||
762 |
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" |
|
763 |
apply (case_tac f, (simp add:cf2sfile.simps d2s_aux.simps)+) |
|
764 |
apply (case_tac "index_of_file \<tau> (a # list)", (simp add:d2s_aux.simps)+) |
|
765 |
by (drule index_of_file_le_length', simp+) |
|
766 |
||
767 |
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" |
|
768 |
apply (induct f) |
|
769 |
apply (simp add:no_junior_def cf2sfile.simps d2s_aux.simps) |
|
770 |
apply (case_tac "cf2sfile \<tau> (a # f) = SCrea (Suc (length \<tau>)) # spf") |
|
771 |
apply (drule_tac f = "a # f" in cf2sfile_le_len, simp+) |
|
772 |
apply (simp only:cf2sfile.simps d2s_aux.simps) |
|
773 |
apply (drule_tac no_junior_noteq, simp+) |
|
774 |
apply (rule impI, erule impE, simp+) |
|
775 |
apply (drule parentf_in_current', simp+) |
|
776 |
done |
|
777 |
||
778 |
lemma cp2sproc_le_len: "cp2sproc \<tau> p = SCrea (Suc (length \<tau>)) \<Longrightarrow> False" |
|
779 |
apply (simp add:cp2sproc_def, case_tac "index_of_proc \<tau> p") |
|
780 |
apply (simp add:d2s_aux.simps)+ |
|
781 |
by (drule index_of_proc_le_length', simp) |
|
782 |
||
783 |
lemma ch2sshm_le_len: "ch2sshm \<tau> h = SCrea (Suc (length \<tau>)) \<Longrightarrow> False" |
|
784 |
apply (simp add:ch2sshm_def, case_tac "index_of_shm \<tau> h") |
|
785 |
apply (simp add:d2s_aux.simps)+ |
|
786 |
by (drule index_of_shm_le_length', simp) |
|
787 |
||
788 |
lemma cm2smsg_le_len: "cm2smsg \<tau> m = SCrea (Suc (length \<tau>)) \<Longrightarrow> False" |
|
789 |
apply (simp add:cm2smsg_def, case_tac "index_of_msg \<tau> m") |
|
790 |
apply (simp add:d2s_aux.simps)+ |
|
791 |
by (drule index_of_msg_le_length', simp) |
|
792 |
||
793 |
lemma cim2im_s_le_len: "cim2im_s \<tau> im = SCrea (Suc (length \<tau>)) \<Longrightarrow> False" |
|
794 |
apply (simp add:cim2im_s_def, case_tac "inum2ind \<tau> im") |
|
795 |
apply (simp add:d2s_aux.simps)+ |
|
796 |
by (drule inum2ind_le_length', simp) |
|
797 |
||
798 |
lemma cfd2fd_s_le_len: "cfd2fd_s \<tau> p fd = SCrea (Suc (length \<tau>)) \<Longrightarrow> False" |
|
799 |
apply (simp add:cfd2fd_s_def, case_tac "index_of_fd \<tau> p fd") |
|
800 |
apply (simp add:d2s_aux.simps)+ |
|
801 |
by (drule index_of_fd_le_length', simp) |
|
802 |
||
803 |
end |
|
804 |
||
805 |
(*<*) |
|
806 |
end |
|
807 |
(*>*) |