author | chunhan |
Wed, 15 May 2013 11:21:39 +0800 | |
changeset 6 | 8779d321cc2e |
parent 4 | e9c5594d5963 |
child 7 | f27882976251 |
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 |
||
9 |
(************ simpset for cf2sfile ***************) |
|
10 |
||
11 |
declare get_parentfs_ctxts.simps [simp del] |
|
12 |
||
6
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
13 |
lemma sroot_only: |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
14 |
"cf2sfile s [] = Some sroot" |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
15 |
by (simp add:cf2sfile_def) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
16 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
17 |
lemma not_file_is_dir: |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
18 |
"\<lbrakk>\<not> is_file s f; f \<in> current_files s; valid s\<rbrakk> \<Longrightarrow> is_dir s f" |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
19 |
by (auto simp:is_file_def current_files_def is_dir_def |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
20 |
dest:finum_has_itag finum_has_ftag' split:t_inode_tag.splits option.splits) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
21 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
22 |
lemma not_dir_is_file: |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
23 |
"\<lbrakk>\<not> is_dir s f; f \<in> current_files s; valid s\<rbrakk> \<Longrightarrow> is_file s f" |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
24 |
by (auto simp:is_file_def current_files_def is_dir_def |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
25 |
dest:finum_has_itag finum_has_ftag' split:t_inode_tag.splits option.splits) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
26 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
27 |
lemma is_file_or_dir: |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
28 |
"\<lbrakk>f \<in> current_files s; valid s\<rbrakk> \<Longrightarrow> is_file s f \<or> is_dir s f" |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
29 |
by (auto dest:not_dir_is_file) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
30 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
31 |
lemma current_file_has_sfile: |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
32 |
"\<lbrakk>f \<in> current_files s; valid s\<rbrakk> \<Longrightarrow> \<exists> sf. cf2sfile s f = Some sf" |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
33 |
apply (induct f) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
34 |
apply (rule_tac x = "sroot" in exI, simp add:sroot_only) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
35 |
apply (frule parentf_in_current', simp, clarsimp) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
36 |
apply (frule parentf_is_dir'', simp) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
37 |
apply (frule is_file_or_dir, simp) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
38 |
apply (auto dest!:current_has_sec' |
8779d321cc2e
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 |
simp:cf2sfile_def split:option.splits if_splits dest!:get_pfs_secs_prop) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
40 |
done |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
41 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
42 |
definition sectxt_of_pf :: "t_state \<Rightarrow> t_file \<Rightarrow> security_context_t option" |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
43 |
where |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
44 |
"sectxt_of_pf s f = (case f of [] \<Rightarrow> None | (a # pf) \<Rightarrow> sectxt_of_obj s (O_dir pf))" |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
45 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
46 |
definition get_parentfs_ctxts' :: "t_state \<Rightarrow> t_file \<Rightarrow> (security_context_t list) option" |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
47 |
where |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
48 |
"get_parentfs_ctxts' s f = (case f of [] \<Rightarrow> None | (a # pf) \<Rightarrow> get_parentfs_ctxts s pf)" |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
49 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
50 |
lemma is_file_has_sfile: |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
51 |
"\<lbrakk>is_file s f; valid s\<rbrakk> \<Longrightarrow> \<exists> sec psec asecs. cf2sfile s f = Some |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
52 |
(if (\<not> deleted (O_file f) s \<and> is_init_file f) then Init f else Created, |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
53 |
sec, Some psec, set asecs) \<and> (sectxt_of_obj s (O_file f) = Some sec) \<and> |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
54 |
(sectxt_of_pf s f = Some psec) \<and> (get_parentfs_ctxts' s f = Some asecs)" |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
55 |
apply (case_tac f, simp, drule root_is_dir', simp, simp) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
56 |
apply (frule is_file_in_current) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
57 |
apply (drule current_file_has_sfile, simp) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
58 |
apply (auto simp:cf2sfile_def sectxt_of_pf_def get_parentfs_ctxts'_def split:if_splits option.splits) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
59 |
done |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
60 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
61 |
lemma is_dir_has_sfile: |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
62 |
"\<lbrakk>is_dir s f; valid s\<rbrakk> \<Longrightarrow> (case f of |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
63 |
[] \<Rightarrow> cf2sfile s f = Some sroot |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
64 |
| a # pf \<Rightarrow> (\<exists> sec psec asecs. cf2sfile s f = Some |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
65 |
(if (\<not> deleted (O_dir f) s \<and> is_init_dir f) then Init f else Created, |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
66 |
sec, Some psec, set asecs) \<and> (sectxt_of_obj s (O_dir f) = Some sec) \<and> |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
67 |
(sectxt_of_obj s (O_dir pf) = Some psec) \<and> (get_parentfs_ctxts s pf = Some asecs)))" |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
68 |
apply (case_tac f, simp add:sroot_only) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
69 |
apply (frule is_dir_in_current, frule is_dir_not_file) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
70 |
apply (drule current_file_has_sfile, simp) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
71 |
apply (auto simp:cf2sfile_def split:if_splits option.splits) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
72 |
done |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
73 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
74 |
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
|
75 |
"\<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
|
76 |
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
|
77 |
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
|
78 |
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
|
79 |
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
|
80 |
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
|
81 |
| 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
|
82 |
else (case (sectxt_of_obj s (O_dir (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
|
83 |
Some fsec \<Rightarrow> Some (if (\<not> deleted (O_dir (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
|
84 |
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
|
85 |
| 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
|
86 |
| 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
|
87 |
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
|
88 |
apply (frule parentf_in_current', 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
|
89 |
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
|
90 |
apply (frule_tac f = pf in current_file_has_sfile, simp, erule exE) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
91 |
apply (auto dest!:is_file_has_sec' is_dir_has_sec' get_pfs_secs_prop |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
92 |
simp:cf2sfile_def split:option.splits if_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
|
93 |
apply (case_tac "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
|
94 |
apply (frule is_file_has_sec, 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
|
95 |
apply (frule is_dir_has_sec, 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
|
96 |
apply (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
|
97 |
apply (erule exE)+ |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
98 |
apply (auto split:option.splits)[1] |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
99 |
apply 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
|
100 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
101 |
apply (rule ext) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
102 |
apply (subst (1) 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
|
103 |
apply (auto simp del:deleted.simps get_parentfs_ctxts.simps split:option.splits if_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
|
104 |
|
4 | 105 |
lemma cf2sfile_open_none1: |
1 | 106 |
"valid (Open p f flag fd None # s) \<Longrightarrow> cf2sfile (Open p f flag fd None # s) f b = cf2sfile s f b" |
107 |
apply (frule vd_cons, frule vt_grant_os) |
|
4 | 108 |
apply (frule noroot_events, case_tac f, simp) |
109 |
apply (auto split:if_splits option.splits dest!:current_has_sec' dest:parentf_in_current' |
|
1 | 110 |
simp:cf2sfile_def is_file_simps is_dir_simps current_files_simps sectxt_of_obj_simps |
111 |
get_parentfs_ctxts_simps) |
|
4 | 112 |
done |
113 |
||
114 |
lemma cf2sfile_open_none2: |
|
115 |
"valid (Open p f flag fd None # s) \<Longrightarrow> cf2sfile (Open p f flag fd None # s) f' b = cf2sfile s f' b" |
|
116 |
apply (frule vd_cons, frule vt_grant_os) |
|
117 |
apply (induct f', simp add:cf2sfile_def) |
|
118 |
apply (simp add:cf2sfile_def is_file_simps is_dir_simps current_files_simps sectxt_of_obj_simps |
|
119 |
get_parentfs_ctxts_simps) |
|
120 |
done |
|
121 |
||
122 |
lemma cf2sfile_open_none: |
|
123 |
"valid (Open p f flag fd None # s) \<Longrightarrow> cf2sfile (Open p f flag fd None # s) = cf2sfile s" |
|
124 |
apply (rule ext, rule ext) |
|
125 |
apply (simp add:cf2sfile_open_none1 cf2sfile_open_none2) |
|
126 |
done |
|
1 | 127 |
|
128 |
lemma cf2sfile_open_some1: |
|
129 |
"\<lbrakk>valid (Open p f flag fd (Some inum) # s); f' \<in> current_files s\<rbrakk> |
|
130 |
\<Longrightarrow> cf2sfile (Open p f flag fd (Some inum) # s) f' = cf2sfile s f'" |
|
131 |
apply (frule vd_cons, frule vt_grant_os, frule noroot_events, rule ext) |
|
4 | 132 |
apply (case_tac "f = f'", simp) |
133 |
apply (induct f', simp add:sroot_only, simp) |
|
3 | 134 |
apply (frule parentf_in_current', simp+) |
4 | 135 |
apply (simp add:cf2sfile_def is_file_simps is_dir_simps current_files_simps sectxt_of_obj_simps |
1 | 136 |
get_parentfs_ctxts_simps) |
137 |
done |
|
138 |
||
139 |
lemma cf2sfile_open_some2: |
|
140 |
"\<lbrakk>valid (Open p f flag fd (Some inum) # s); is_file s f'\<rbrakk> |
|
141 |
\<Longrightarrow> cf2sfile (Open p f flag fd (Some inum) # s) f' True = cf2sfile s f' True" |
|
142 |
apply (frule vd_cons, drule is_file_in_current) |
|
143 |
by (simp add:cf2sfile_open_some1) |
|
144 |
||
145 |
lemma cf2sfile_open_some3: |
|
146 |
"\<lbrakk>valid (Open p f flag fd (Some inum) # s); is_dir s f'\<rbrakk> |
|
147 |
\<Longrightarrow> cf2sfile (Open p f flag fd (Some inum) # s) f' False = cf2sfile s f' False" |
|
148 |
apply (frule vd_cons, drule is_dir_in_current) |
|
149 |
by (simp add:cf2sfile_open_some1) |
|
150 |
||
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
|
151 |
lemma cf2sfile_open_some4: |
1 | 152 |
"valid (Open p f flag fd (Some inum) # s) \<Longrightarrow> cf2sfile (Open p f flag fd (Some inum) # s) f True = ( |
153 |
case (parent f) of |
|
154 |
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), |
|
155 |
get_parentfs_ctxts s pf) of |
|
156 |
(Some sec, Some psec, Some asecs) \<Rightarrow> Some (Created, sec, Some psec, set asecs) |
|
157 |
| _ \<Rightarrow> None) |
|
158 |
| None \<Rightarrow> None)" |
|
159 |
apply (frule vd_cons, frule vt_grant_os, frule noroot_events) |
|
4 | 160 |
apply (case_tac f, simp) |
161 |
apply (simp add:cf2sfile_def is_file_simps is_dir_simps current_files_simps sectxt_of_obj_simps |
|
162 |
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
|
163 |
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
|
164 |
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
|
165 |
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
|
166 |
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
|
167 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
168 |
lemma cf2sfile_open_some5: |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
169 |
"valid (Open p f flag fd (Some inum) # s) \<Longrightarrow> |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
170 |
cf2sfile (Open p f flag fd (Some inum) # s) f False = cf2sfile s f False" |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
171 |
apply (frule vd_cons, frule vt_grant_os, frule noroot_events) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
172 |
apply (case_tac 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
|
173 |
apply (auto simp add:cf2sfile_def is_file_simps is_dir_simps current_files_simps sectxt_of_obj_simps |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
174 |
get_parentfs_ctxts_simps split: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
|
175 |
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
|
176 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
177 |
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
|
178 |
"\<lbrakk>valid (Open p f flag fd opt # s); f' \<in> current_files (Open p f flag fd opt # 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
|
179 |
\<Longrightarrow> cf2sfile (Open p f flag fd opt # s) f' b = ( |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
180 |
if (opt = None) then cf2sfile s f' b |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
181 |
else if (f' = f \<and> b) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
182 |
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
|
183 |
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
|
184 |
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
|
185 |
(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
|
186 |
| _ \<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
|
187 |
| 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
|
188 |
else cf2sfile s f' b)" |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
189 |
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
|
190 |
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
|
191 |
apply (case_tac "f = 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
|
192 |
apply (auto simp:cf2sfile_open_some1 cf2sfile_open_some4 cf2sfile_open_some5 current_files_simps) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
193 |
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
|
194 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
195 |
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
|
196 |
"\<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
|
197 |
\<Longrightarrow> cf2sfile (Mkdir p f i # s) f' = cf2sfile 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
|
198 |
apply (frule vd_cons, frule vt_grant_os, frule noroot_events, rule ext) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
199 |
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
|
200 |
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
|
201 |
apply (frule parentf_in_current', 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
|
202 |
apply 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
|
203 |
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
|
204 |
apply (simp (no_asm_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
|
205 |
apply (auto simp add:cf2sfile_def is_file_simps is_dir_simps current_files_simps sectxt_of_obj_simps |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
206 |
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
|
207 |
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
|
208 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
209 |
lemma cf2sfile_mkdir2: |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
210 |
"\<lbrakk>valid (Open p f flag fd (Some inum) # s); is_file s f'\<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
|
211 |
\<Longrightarrow> cf2sfile (Open p f flag fd (Some inum) # s) f' True = cf2sfile s f' True" |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
212 |
apply (frule vd_cons, drule 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
|
213 |
by (simp add:cf2sfile_open_some1) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
214 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
215 |
lemma cf2sfile_mkdir3: |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
216 |
"\<lbrakk>valid (Open p f flag fd (Some inum) # s); is_dir s f'\<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
|
217 |
\<Longrightarrow> cf2sfile (Open p f flag fd (Some inum) # s) f' False = cf2sfile s f' False" |
8779d321cc2e
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 (frule vd_cons, drule is_dir_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
|
219 |
by (simp add:cf2sfile_open_some1) |
8779d321cc2e
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 |
|
8779d321cc2e
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_mkdir: |
8779d321cc2e
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 |
"valid (Mkdir p f i # s) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
224 |
\<Longrightarrow> cf2sfile (Mkdir p f i # s) = (\<lambda> f' b. |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
225 |
if (f' = f \<and> \<not> b) |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
226 |
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
|
227 |
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
|
228 |
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
|
229 |
(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
|
230 |
| _ \<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
|
231 |
| 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
|
232 |
else cf2sfile s f' b)" |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
233 |
apply (frule vd_cons, frule vt_grant_os) |
8779d321cc2e
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 (rule ext, rule ext) |
8779d321cc2e
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 |
|
8779d321cc2e
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 (auto simp:cf2sfile_def is_file_simps is_dir_simps current_files_simps sectxt_of_obj_simps |
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
237 |
get_parentfs_ctxts_simps split:if_splits option.splits) |
1 | 238 |
|
239 |
||
240 |
||
6
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
241 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
242 |
|
8779d321cc2e
remove duplicated pre-condition of current_files in OS_grant, since it is property if is_file/is_dir.
chunhan
parents:
4
diff
changeset
|
243 |
|
1 | 244 |
|
245 |
||
246 |
||
247 |
||
248 |
||
249 |
||
250 |
||
251 |
||
252 |
||
253 |
||
254 |
||
255 |
||
256 |
lemma cf2sfile_keep_path: "\<lbrakk>f \<preceq> f'; \<tau> \<in> vt rc_cs\<rbrakk> \<Longrightarrow> cf2sfile \<tau> f \<preceq> cf2sfile \<tau> f'" |
|
257 |
apply (induct f', simp add:no_junior_def) |
|
258 |
apply (case_tac "f = a # f'", simp add:cf2sfile.simps) |
|
259 |
apply (drule no_junior_noteq, simp, simp add:cf2sfile.simps) |
|
260 |
done |
|
261 |
||
262 |
lemma ckp'_aux: "\<not> f \<preceq> a # f' \<Longrightarrow> \<not> f \<preceq> f'" |
|
263 |
by (auto simp:no_junior_def) |
|
264 |
||
265 |
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'" |
|
266 |
apply (induct f', simp add:no_junior_def cf2sfile.simps, rule notI, drule cf2sfile_root_file, simp) |
|
267 |
apply (case_tac "f = a # f'", simp add:cf2sfile.simps) |
|
268 |
apply (rule notI) |
|
269 |
apply (frule ckp'_aux, simp, frule parentf_in_current', simp+) |
|
270 |
apply (case_tac "cf2sfile \<tau> f = cf2sfile \<tau> (a # f')", drule cf2sfile_inj, simp+) |
|
271 |
apply (simp add:cf2sfile.simps) |
|
272 |
by (drule no_junior_noteq, simp+) |
|
273 |
||
274 |
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'" |
|
275 |
using cf2sfile_keep_path' |
|
276 |
by (auto) |
|
277 |
||
278 |
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" |
|
279 |
apply (frule vt_cons') |
|
280 |
apply (drule vt_grant_os) |
|
281 |
apply (induct f) |
|
282 |
apply (simp add:cf2sfile.simps)+ |
|
283 |
apply (frule parentf_in_current', simp) |
|
284 |
apply (auto simp:os_grant.simps index_of_file.simps split:option.splits) |
|
285 |
done |
|
286 |
||
287 |
lemma cf2sfile_open_some: "\<lbrakk>Open p f flags fd (Some inum) # \<tau> \<in> vt rc_cs; parent f = Some pf\<rbrakk> |
|
288 |
\<Longrightarrow> cf2sfile (Open p f flags fd (Some inum) # \<tau>) f = (SCrea (Suc (length \<tau>)) # (cf2sfile \<tau> pf))" |
|
289 |
apply (case_tac f, simp) |
|
290 |
apply (frule vt_grant_os) |
|
291 |
apply (simp add:cf2sfile.simps os_grant.simps current_files_simps index_of_file.simps cf2sfile_open_some') |
|
292 |
done |
|
293 |
||
294 |
lemma cf2sfile_open_none: "cf2sfile (Open p f flags fd None # \<tau>) f' = cf2sfile \<tau> f'" |
|
295 |
apply (induct f') |
|
296 |
by (simp add:cf2sfile.simps index_of_file.simps split:option.splits nat.splits)+ |
|
297 |
||
298 |
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> |
|
299 |
cf2sfile (Open p f flags fd opt # \<tau>) f' = ( |
|
300 |
if (opt = None) then cf2sfile \<tau> f' |
|
301 |
else if (f' = f) then (case (parent f) of |
|
302 |
Some pf \<Rightarrow> (SCrea (Suc (length \<tau>)) # (cf2sfile \<tau> pf)) |
|
303 |
| _ \<Rightarrow> []) |
|
304 |
else cf2sfile \<tau> f' )" |
|
305 |
apply (frule vt_grant_os) |
|
306 |
by (auto simp:os_grant.simps current_files_simps intro:cf2sfile_open_none cf2sfile_open_some cf2sfile_open_some' split:if_splits option.splits) |
|
307 |
||
308 |
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" |
|
309 |
apply (frule vt_cons', drule vt_grant_os) |
|
310 |
apply (induct f, (simp add:cf2sfile.simps)+) |
|
311 |
apply (frule parentf_in_current', simp) |
|
312 |
apply (auto simp:os_grant.simps index_of_file.simps split:option.splits) |
|
313 |
done |
|
314 |
||
315 |
lemma cf2sfile_mkdir_some: "\<lbrakk>Mkdir p f inum # \<tau> \<in> vt rc_cs; parent f = Some pf\<rbrakk> |
|
316 |
\<Longrightarrow> cf2sfile (Mkdir p f inum # \<tau>) f = (SCrea (Suc (length \<tau>)) # (cf2sfile \<tau> pf))" |
|
317 |
apply (case_tac f, simp) |
|
318 |
apply (frule vt_grant_os) |
|
319 |
apply (simp add:cf2sfile.simps os_grant.simps current_files_simps index_of_file.simps cf2sfile_mkdir_some') |
|
320 |
done |
|
321 |
||
322 |
lemma cf2sfile_mkdir: "\<lbrakk>Mkdir p f inum # \<tau> \<in> vt rc_cs; f' \<in> current_files (Mkdir p f inum # \<tau>)\<rbrakk> \<Longrightarrow> |
|
323 |
cf2sfile (Mkdir p f inum # \<tau>) f' = ( |
|
324 |
if (f' = f) then (case (parent f) of |
|
325 |
Some pf \<Rightarrow> (SCrea (Suc (length \<tau>)) # (cf2sfile \<tau> pf)) |
|
326 |
| _ \<Rightarrow> []) |
|
327 |
else cf2sfile \<tau> f' ) " |
|
328 |
apply (frule vt_grant_os) |
|
329 |
by (auto simp:os_grant.simps current_files_simps intro:cf2sfile_mkdir_some cf2sfile_mkdir_some' split:if_splits option.splits) |
|
330 |
||
331 |
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" |
|
332 |
apply (frule vt_cons') |
|
333 |
apply (drule vt_grant_os) |
|
334 |
apply (induct f) |
|
335 |
apply (simp add:cf2sfile.simps)+ |
|
336 |
apply (frule parentf_in_current', simp) |
|
337 |
apply (auto simp:os_grant.simps index_of_file.simps split:option.splits) |
|
338 |
done |
|
339 |
||
340 |
lemma cf2sfile_linkhard_some: |
|
341 |
"\<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))" |
|
342 |
apply (case_tac f\<^isub>2, simp) |
|
343 |
apply (frule vt_grant_os) |
|
344 |
apply (simp add:cf2sfile.simps os_grant.simps current_files_simps index_of_file.simps cf2sfile_linkhard_none) |
|
345 |
done |
|
346 |
||
347 |
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> |
|
348 |
cf2sfile (LinkHard p f\<^isub>1 f\<^isub>2 # \<tau>) f = ( |
|
349 |
if (f = f\<^isub>2) then (case (parent f\<^isub>2) of |
|
350 |
Some pf\<^isub>2 \<Rightarrow> SCrea (Suc (length \<tau>)) # (cf2sfile \<tau> pf\<^isub>2) |
|
351 |
| _ \<Rightarrow> []) |
|
352 |
else cf2sfile \<tau> f )" |
|
353 |
apply (frule vt_grant_os) |
|
354 |
by (auto simp:os_grant.simps current_files_simps intro:cf2sfile_linkhard_none cf2sfile_linkhard_some split:if_splits option.splits) |
|
355 |
||
356 |
||
357 |
lemma no_junior_aux: "\<not> f\<^isub>2 \<preceq> a # f \<Longrightarrow> \<not> f\<^isub>2 \<preceq> f" |
|
358 |
by (auto simp:no_junior_def) |
|
359 |
||
360 |
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" |
|
361 |
apply (frule vt_grant_os, simp add:os_grant.simps, (erule exE|erule conjE)+) |
|
362 |
apply (rule conjI, rule notI, simp) |
|
363 |
apply (rule notI, drule vt_cons', simp add:ancenf_in_current) |
|
364 |
done |
|
365 |
||
366 |
lemma cf2sfile_rename'1: |
|
367 |
"\<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" |
|
368 |
apply (frule vt_cons',frule vt_grant_os, induct f) |
|
369 |
apply (simp add:cf2sfile.simps) |
|
370 |
apply (frule parentf_in_current', simp, simp) |
|
371 |
apply (frule no_junior_aux, simp) |
|
372 |
apply (simp add:os_grant.simps, (erule exE|erule conjE)+) |
|
373 |
apply (drule cf2sfile_rename_aux, simp, erule conjE) |
|
374 |
apply (auto simp add:cf2sfile.simps index_of_file.simps split:option.splits nat.splits) |
|
375 |
done |
|
376 |
||
377 |
lemma cf2sfile_rename'2: |
|
378 |
"\<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" |
|
379 |
apply (frule vt_cons', induct f) |
|
380 |
by (auto simp add:index_of_file.simps cf2sfile.simps no_junior_def split:option.splits nat.splits) |
|
381 |
||
382 |
lemma cf2sfile_rename1: |
|
383 |
"\<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)" |
|
384 |
apply (case_tac f\<^isub>3, simp add:cf2sfile.simps) |
|
385 |
apply (auto dest!:cf2sfile_rename'2 simp add:no_junior_def cf2sfile.simps index_of_file.simps split:option.splits) |
|
386 |
done |
|
387 |
||
388 |
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" |
|
389 |
apply (clarsimp simp add:index_of_file.simps split:option.splits) |
|
390 |
by (frule_tac f\<^isub>3 = f\<^isub>3 in file_renaming_prop3, simp, erule conjE, simp add:file_renaming_prop5) |
|
391 |
||
392 |
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> |
|
393 |
\<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))" |
|
394 |
apply (induct f, simp add:no_junior_def) |
|
395 |
apply (case_tac "a # f = f\<^isub>3", simp) |
|
396 |
apply (drule cf2sfile_rename1, simp, simp add:file_renaming_prop0' file_renaming_prop0) |
|
397 |
||
398 |
apply (frule no_junior_noteq, simp, simp) |
|
399 |
apply (frule_tac file_renaming_prop1') |
|
400 |
apply (frule_tac f = f\<^isub>2 and \<tau> = \<tau> in cf2sfile_keep_path, simp add:vt_cons') |
|
401 |
apply (frule_tac f\<^isub>2 = f\<^isub>2 and a = a in file_renaming_prop8') |
|
402 |
apply (frule_tac f\<^isub>2 = f\<^isub>2 and a = a in file_renaming_prop6') |
|
403 |
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) |
|
404 |
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) |
|
405 |
apply (drule parentf_in_current', simp add:vt_cons') |
|
406 |
apply (simp add:cf2sfile.simps) |
|
407 |
apply (erule file_renaming_prop6[THEN sym]) |
|
408 |
done |
|
409 |
||
410 |
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> |
|
411 |
\<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)" |
|
412 |
apply (frule_tac f\<^isub>3 = f\<^isub>3 in file_renaming_prop5) |
|
413 |
apply (frule_tac f\<^isub>3 = f\<^isub>3 in file_renaming_prop1) |
|
414 |
apply (drule_tac f = "file_after_rename f\<^isub>2 f\<^isub>3 f" in cf2sfile_rename2, simp+) |
|
415 |
done |
|
416 |
||
417 |
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> |
|
418 |
\<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)" |
|
419 |
apply (case_tac "f\<^isub>2 \<preceq> f") |
|
420 |
apply (rule cf2sfile_rename2', simp+) |
|
421 |
apply (frule vt_grant_os) |
|
422 |
apply (frule_tac \<tau> = \<tau> in cf2sfile_keep_path', simp add:vt_cons', simp add:os_grant.simps, simp) |
|
423 |
apply (simp add:file_after_rename_def) |
|
424 |
by (rule cf2sfile_rename'1, simp+) |
|
425 |
||
426 |
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> |
|
427 |
cf2sfile (Rename p f\<^isub>2 f\<^isub>3 # \<tau>) f = ( |
|
428 |
if (f\<^isub>3 \<preceq> f) then (case (parent f\<^isub>3) of |
|
429 |
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)) |
|
430 |
| _ \<Rightarrow> []) |
|
431 |
else cf2sfile \<tau> f )" |
|
432 |
apply (frule vt_grant_os) |
|
433 |
apply (case_tac "f = f\<^isub>3", clarsimp simp:os_grant.simps, drule cf2sfile_rename1, simp+, simp add:file_renaming_prop0' file_renaming_prop0) |
|
434 |
||
435 |
apply (auto simp:os_grant.simps current_files_simps intro:cf2sfile_rename'2 cf2sfile_rename1 split:if_splits option.splits) |
|
436 |
apply (rule cf2sfile_rename2, simp, drule rename_renaming_decom, simp+) |
|
437 |
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+) |
|
438 |
done |
|
439 |
||
440 |
lemma cf2sfile_other: "\<lbrakk> |
|
441 |
\<forall> p f flags fd opt. e \<noteq> Open p f flags fd opt; |
|
442 |
\<forall> p f im. e \<noteq> Mkdir p f im; |
|
443 |
\<forall> p f\<^isub>1 f\<^isub>2. e \<noteq> LinkHard p f\<^isub>1 f\<^isub>2; |
|
444 |
\<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'" |
|
445 |
apply (induct f', simp add:cf2sfile.simps index_of_file.simps split:option.splits nat.splits) |
|
446 |
apply (case_tac e, auto simp add:cf2sfile.simps index_of_file.simps split:option.splits nat.splits) |
|
447 |
done |
|
448 |
||
449 |
lemmas cf2sfile_nil = init_cf2sfile |
|
450 |
||
451 |
lemma cf2sfile_nil': "f \<in> current_files [] \<Longrightarrow> cf2sfile [] f = map SInit f" |
|
452 |
by (simp add:cf2sfile_nil current_files_simps) |
|
453 |
||
454 |
lemmas cf2sfile_simps = cf2sfile_nil cf2sfile_nil' cf2sfile_open cf2sfile_mkdir cf2sfile_linkhard cf2sfile_rename cf2sfile_other |
|
455 |
||
456 |
lemmas cf2sfile_simpss = cf2sfile_nil cf2sfile_nil' cf2sfile_open_some' cf2sfile_open_some cf2sfile_open_none cf2sfile_open cf2sfile_mkdir_some' cf2sfile_mkdir_some |
|
457 |
cf2sfile_mkdir cf2sfile_linkhard_none cf2sfile_linkhard_some cf2sfile_linkhard cf2sfile_rename'1 cf2sfile_rename'2 cf2sfile_rename1 |
|
458 |
cf2sfile_rename2 cf2sfile_rename2' cf2sfile_rename3 cf2sfile_rename cf2sfile_other |
|
459 |
||
460 |
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" |
|
461 |
by (simp add:cf2sfile_open_some' current_files_def) |
|
462 |
||
463 |
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" |
|
464 |
by (simp add:cf2sfile_mkdir_some' current_files_def) |
|
465 |
||
466 |
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" |
|
467 |
by (simp add:cf2sfile_linkhard_none current_files_def) |
|
468 |
||
469 |
lemma cf2sfile_rename'1_inum: |
|
470 |
"\<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" |
|
471 |
by (simp add:cf2sfile_rename'1 current_files_def) |
|
472 |
||
473 |
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> |
|
474 |
\<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))" |
|
475 |
by (simp add:cf2sfile_rename2 current_files_def) |
|
476 |
||
477 |
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> |
|
478 |
\<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)" |
|
479 |
by (simp add:cf2sfile_rename2' current_files_def) |
|
480 |
||
481 |
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> |
|
482 |
\<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)" |
|
483 |
by (simp add:cf2sfile_rename3 current_files_def) |
|
484 |
||
485 |
lemma cf2sfile_nil'_inum: "inum_of_file [] f = Some im \<Longrightarrow> cf2sfile [] f = map SInit f" |
|
486 |
by (simp add:cf2sfile_nil' current_files_def) |
|
487 |
||
488 |
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 |
|
489 |
cf2sfile_mkdir cf2sfile_linkhard_none_inum cf2sfile_linkhard_some cf2sfile_linkhard cf2sfile_rename'1_inum cf2sfile_rename'2 cf2sfile_rename1 |
|
490 |
cf2sfile_rename2_inum cf2sfile_rename2'_inum cf2sfile_rename3_inum cf2sfile_rename cf2sfile_other |
|
491 |
||
492 |
(*************** cp2sproc simpset *********************) |
|
493 |
||
494 |
lemma cp2sproc_nil: "p \<in> init_processes \<Longrightarrow> cp2sproc [] p = SInit p" |
|
495 |
by (simp add:cp2sproc_def index_of_proc.simps) |
|
496 |
||
497 |
lemma cp2sproc_nil': "p \<in> current_procs [] \<Longrightarrow> cp2sproc [] p = SInit p" |
|
498 |
by (simp add:cp2sproc_nil current_procs.simps) |
|
499 |
||
500 |
lemma cp2sproc_clone: "cp2sproc (Clone p p' # \<tau>) p'' = ( |
|
501 |
if (p'' = p') then SCrea (Suc (length \<tau>)) |
|
502 |
else cp2sproc \<tau> p'' )" |
|
503 |
by (auto simp:cp2sproc_def index_of_proc.simps d2s_aux.simps) |
|
504 |
||
505 |
lemma cp2sproc_other: "\<forall> p p'. e \<noteq> Clone p p' \<Longrightarrow> cp2sproc (e # \<tau>) p'' = cp2sproc \<tau> p''" |
|
506 |
apply (case_tac e) |
|
507 |
by (auto simp:cp2sproc_def index_of_proc.simps d2s_aux.simps) |
|
508 |
||
509 |
lemmas cp2sproc_simps = cp2sproc_nil cp2sproc_nil' cp2sproc_clone cp2sproc_other |
|
510 |
||
511 |
(******************** ch2sshm simpset **************************) |
|
512 |
||
513 |
lemma ch2sshm_nil: "h \<in> init_shms \<Longrightarrow> ch2sshm [] h = SInit h" |
|
514 |
by (simp add:ch2sshm_def index_of_shm.simps) |
|
515 |
||
516 |
lemma ch2sshm_nil': "h \<in> current_shms [] \<Longrightarrow> ch2sshm [] h = SInit h" |
|
517 |
by (simp add:ch2sshm_nil current_shms.simps) |
|
518 |
||
519 |
lemma ch2sshm_createshm: "ch2sshm (CreateShM p h # \<tau>) h' = (if (h' = h) then SCrea (Suc (length \<tau>)) else ch2sshm \<tau> h')" |
|
520 |
by (simp add:ch2sshm_def index_of_shm.simps d2s_aux.simps) |
|
521 |
||
522 |
lemma ch2sshm_other: "\<forall> p h. e \<noteq> CreateShM p h \<Longrightarrow> ch2sshm (e # \<tau>) h' = ch2sshm \<tau> h'" |
|
523 |
apply (case_tac e) |
|
524 |
by (auto simp add:ch2sshm_def index_of_shm.simps d2s_aux.simps) |
|
525 |
||
526 |
lemmas ch2sshm_simps = ch2sshm_nil ch2sshm_nil' ch2sshm_createshm ch2sshm_other |
|
527 |
||
528 |
(********************* cm2smsg simpset ***********************) |
|
529 |
||
530 |
lemma cm2smsg_nil: "m \<in> init_msgs \<Longrightarrow> cm2smsg [] m = SInit m" |
|
531 |
by (simp add:cm2smsg_def index_of_msg.simps) |
|
532 |
||
533 |
lemma cm2smsg_nil': "m \<in> current_msgs [] \<Longrightarrow> cm2smsg [] m = SInit m" |
|
534 |
by (simp add:cm2smsg_nil current_msgs.simps) |
|
535 |
||
536 |
lemma cm2smsg_createmsg: "cm2smsg (CreateMsg p m # \<tau>) m' = (if (m' = m) then SCrea (Suc (length \<tau>)) else cm2smsg \<tau> m')" |
|
537 |
by (simp add:cm2smsg_def index_of_msg.simps d2s_aux.simps) |
|
538 |
||
539 |
lemma cm2smsg_other: "\<forall> p m. e \<noteq> CreateMsg p m \<Longrightarrow> cm2smsg (e # \<tau>) m' = cm2smsg \<tau> m'" |
|
540 |
apply (case_tac e) |
|
541 |
by (auto simp:cm2smsg_def index_of_msg.simps d2s_aux.simps) |
|
542 |
||
543 |
lemmas cm2smsg_simps = cm2smsg_nil cm2smsg_nil' cm2smsg_createmsg cm2smsg_other |
|
544 |
||
545 |
(********************** cfd2fd_s simpset ******************************) |
|
546 |
||
547 |
lemma cfd2fd_s_nil: "fd \<in> init_fds_of_proc p \<Longrightarrow> cfd2fd_s [] p fd = SInit fd" |
|
548 |
by (simp add:cfd2fd_s_def index_of_fd.simps) |
|
549 |
||
550 |
lemma cfd2fd_s_nil': "fd \<in> current_proc_fds [] p \<Longrightarrow> cfd2fd_s [] p fd = SInit fd" |
|
551 |
by (simp add:cfd2fd_s_nil current_proc_fds.simps) |
|
552 |
||
553 |
lemma cfd2fd_s_open: "cfd2fd_s (Open p f flags fd opt # \<tau>) p' fd' = ( |
|
554 |
if (p = p') then (if (fd = fd') then SCrea (Suc (length \<tau>)) |
|
555 |
else cfd2fd_s \<tau> p' fd') |
|
556 |
else cfd2fd_s \<tau> p' fd' )" |
|
557 |
by (simp add:cfd2fd_s_def index_of_fd.simps d2s_aux.simps) |
|
558 |
||
559 |
lemma cfd2fd_s_createsock: "cfd2fd_s (CreateSock p af st fd im # \<tau>) p' fd' = ( |
|
560 |
if (p = p') then (if (fd = fd') then SCrea (Suc (length \<tau>)) |
|
561 |
else cfd2fd_s \<tau> p' fd') |
|
562 |
else cfd2fd_s \<tau> p' fd' )" |
|
563 |
by (simp add:cfd2fd_s_def index_of_fd.simps d2s_aux.simps) |
|
564 |
||
565 |
lemma cfd2fd_s_accept: "cfd2fd_s (Accept p fd addr port fd' im # \<tau>) p' fd'' = ( |
|
566 |
if (p' = p) then (if (fd'' = fd') then SCrea (Suc (length \<tau>)) |
|
567 |
else cfd2fd_s \<tau> p' fd'') |
|
568 |
else cfd2fd_s \<tau> p' fd'' )" |
|
569 |
by (simp add:cfd2fd_s_def index_of_fd.simps d2s_aux.simps) |
|
570 |
||
571 |
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)" |
|
572 |
by (simp add:cfd2fd_s_def index_of_fd.simps d2s_aux.simps) |
|
573 |
||
574 |
lemma cfd2fd_s_other: "\<lbrakk>\<forall> p f flags fd opt. e \<noteq> Open p f flags fd opt; |
|
575 |
\<forall> p af st fd im. e \<noteq> CreateSock p af st fd im; |
|
576 |
\<forall> p fd addr port fd' im. e \<noteq> Accept p fd addr port fd' im; |
|
577 |
\<forall> p p'. e \<noteq> Clone p p'\<rbrakk> \<Longrightarrow> cfd2fd_s (e # \<tau>) p'' fd'' = cfd2fd_s \<tau> p'' fd''" |
|
578 |
by (case_tac e, auto simp:cfd2fd_s_def index_of_fd.simps d2s_aux.simps) |
|
579 |
||
580 |
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 |
|
581 |
||
582 |
(************* cim2im_s simpset **************************) |
|
583 |
||
584 |
(* no such lemma |
|
585 |
lemma cim2im_s_nil: "init_itag_of_inum im = Some tag \<Longrightarrow> cim2im_s [] im = SInit im" |
|
586 |
by (simp add:cim2im_s_def) |
|
587 |
*) |
|
588 |
||
589 |
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')" |
|
590 |
by (simp add:cim2im_s_def) |
|
591 |
||
592 |
lemma cim2im_s_open': "cim2im_s (Open p f flags fd None # \<tau>) im = cim2im_s \<tau> im" |
|
593 |
by (simp add:cim2im_s_def) |
|
594 |
||
595 |
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')" |
|
596 |
by (simp add:cim2im_s_def) |
|
597 |
||
598 |
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')" |
|
599 |
by (simp add:cim2im_s_def) |
|
600 |
||
601 |
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')" |
|
602 |
by (simp add:cim2im_s_def) |
|
603 |
||
604 |
lemma cim2im_s_other: "\<lbrakk>\<forall> p f flags fd opt. e \<noteq> Open p f flags fd opt; |
|
605 |
\<forall> p f im. e \<noteq> Mkdir p f im; |
|
606 |
\<forall> p sf st fd im. e \<noteq> CreateSock p sf st fd im; |
|
607 |
\<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" |
|
608 |
by (case_tac e, auto simp:cim2im_s_def) |
|
609 |
||
610 |
lemmas cim2im_s_simps = cim2im_s_open cim2im_s_open' cim2im_s_mkdir cim2im_s_createsock cim2im_s_accept cim2im_s_other |
|
611 |
||
612 |
||
613 |
lemma cig2ig_s_simp: "cig2ig_s (e # \<tau>) tag = cig2ig_s \<tau> tag" |
|
614 |
apply (case_tac tag) |
|
615 |
by auto |
|
616 |
||
617 |
(******************* cobj2sobj no Suc (length \<tau>) ***********************) |
|
618 |
||
619 |
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" |
|
620 |
apply (case_tac f, (simp add:cf2sfile.simps d2s_aux.simps)+) |
|
621 |
apply (case_tac "index_of_file \<tau> (a # list)", (simp add:d2s_aux.simps)+) |
|
622 |
by (drule index_of_file_le_length', simp+) |
|
623 |
||
624 |
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" |
|
625 |
apply (induct f) |
|
626 |
apply (simp add:no_junior_def cf2sfile.simps d2s_aux.simps) |
|
627 |
apply (case_tac "cf2sfile \<tau> (a # f) = SCrea (Suc (length \<tau>)) # spf") |
|
628 |
apply (drule_tac f = "a # f" in cf2sfile_le_len, simp+) |
|
629 |
apply (simp only:cf2sfile.simps d2s_aux.simps) |
|
630 |
apply (drule_tac no_junior_noteq, simp+) |
|
631 |
apply (rule impI, erule impE, simp+) |
|
632 |
apply (drule parentf_in_current', simp+) |
|
633 |
done |
|
634 |
||
635 |
lemma cp2sproc_le_len: "cp2sproc \<tau> p = SCrea (Suc (length \<tau>)) \<Longrightarrow> False" |
|
636 |
apply (simp add:cp2sproc_def, case_tac "index_of_proc \<tau> p") |
|
637 |
apply (simp add:d2s_aux.simps)+ |
|
638 |
by (drule index_of_proc_le_length', simp) |
|
639 |
||
640 |
lemma ch2sshm_le_len: "ch2sshm \<tau> h = SCrea (Suc (length \<tau>)) \<Longrightarrow> False" |
|
641 |
apply (simp add:ch2sshm_def, case_tac "index_of_shm \<tau> h") |
|
642 |
apply (simp add:d2s_aux.simps)+ |
|
643 |
by (drule index_of_shm_le_length', simp) |
|
644 |
||
645 |
lemma cm2smsg_le_len: "cm2smsg \<tau> m = SCrea (Suc (length \<tau>)) \<Longrightarrow> False" |
|
646 |
apply (simp add:cm2smsg_def, case_tac "index_of_msg \<tau> m") |
|
647 |
apply (simp add:d2s_aux.simps)+ |
|
648 |
by (drule index_of_msg_le_length', simp) |
|
649 |
||
650 |
lemma cim2im_s_le_len: "cim2im_s \<tau> im = SCrea (Suc (length \<tau>)) \<Longrightarrow> False" |
|
651 |
apply (simp add:cim2im_s_def, case_tac "inum2ind \<tau> im") |
|
652 |
apply (simp add:d2s_aux.simps)+ |
|
653 |
by (drule inum2ind_le_length', simp) |
|
654 |
||
655 |
lemma cfd2fd_s_le_len: "cfd2fd_s \<tau> p fd = SCrea (Suc (length \<tau>)) \<Longrightarrow> False" |
|
656 |
apply (simp add:cfd2fd_s_def, case_tac "index_of_fd \<tau> p fd") |
|
657 |
apply (simp add:d2s_aux.simps)+ |
|
658 |
by (drule index_of_fd_le_length', simp) |
|
659 |
||
660 |
end |
|
661 |
||
662 |
(*<*) |
|
663 |
end |
|
664 |
(*>*) |