Co2sobj_prop.thy
author chunhan
Thu, 09 May 2013 11:19:44 +0800
changeset 4 e9c5594d5963
parent 3 b6ee5f35c41f
child 6 8779d321cc2e
permissions -rw-r--r--
fixed bugs in deleted definition
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
     1
(*<*)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
     2
theory Co2sobj_prop
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
     3
imports Main Flask Flask_type Static Static_type Sectxt_prop Init_prop Current_files_prop Current_sockets_prop
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
     4
begin
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
     5
(*<*)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
     6
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
     7
context tainting_s begin
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
     8
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
     9
(************ simpset for cf2sfile ***************)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    10
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    11
declare get_parentfs_ctxts.simps [simp del]
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    12
4
e9c5594d5963 fixed bugs in deleted definition
chunhan
parents: 3
diff changeset
    13
lemma cf2sfile_open_none1:
1
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    14
  "valid (Open p f flag fd None # s) \<Longrightarrow> cf2sfile (Open p f flag fd None # s) f b = cf2sfile s f b"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    15
apply (frule vd_cons, frule vt_grant_os)
4
e9c5594d5963 fixed bugs in deleted definition
chunhan
parents: 3
diff changeset
    16
apply (frule noroot_events, case_tac f, simp)
e9c5594d5963 fixed bugs in deleted definition
chunhan
parents: 3
diff changeset
    17
apply (auto split:if_splits option.splits    dest!:current_has_sec' dest:parentf_in_current'
1
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    18
          simp:cf2sfile_def is_file_simps is_dir_simps current_files_simps sectxt_of_obj_simps 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    19
               get_parentfs_ctxts_simps)
4
e9c5594d5963 fixed bugs in deleted definition
chunhan
parents: 3
diff changeset
    20
done
e9c5594d5963 fixed bugs in deleted definition
chunhan
parents: 3
diff changeset
    21
e9c5594d5963 fixed bugs in deleted definition
chunhan
parents: 3
diff changeset
    22
lemma cf2sfile_open_none2:
e9c5594d5963 fixed bugs in deleted definition
chunhan
parents: 3
diff changeset
    23
  "valid (Open p f flag fd None # s) \<Longrightarrow> cf2sfile (Open p f flag fd None # s) f' b = cf2sfile s f' b"
e9c5594d5963 fixed bugs in deleted definition
chunhan
parents: 3
diff changeset
    24
apply (frule vd_cons, frule vt_grant_os)
e9c5594d5963 fixed bugs in deleted definition
chunhan
parents: 3
diff changeset
    25
apply (induct f', simp add:cf2sfile_def)
e9c5594d5963 fixed bugs in deleted definition
chunhan
parents: 3
diff changeset
    26
apply (simp add:cf2sfile_def is_file_simps is_dir_simps current_files_simps sectxt_of_obj_simps 
e9c5594d5963 fixed bugs in deleted definition
chunhan
parents: 3
diff changeset
    27
               get_parentfs_ctxts_simps)
e9c5594d5963 fixed bugs in deleted definition
chunhan
parents: 3
diff changeset
    28
done
e9c5594d5963 fixed bugs in deleted definition
chunhan
parents: 3
diff changeset
    29
e9c5594d5963 fixed bugs in deleted definition
chunhan
parents: 3
diff changeset
    30
lemma cf2sfile_open_none:
e9c5594d5963 fixed bugs in deleted definition
chunhan
parents: 3
diff changeset
    31
  "valid (Open p f flag fd None # s) \<Longrightarrow> cf2sfile (Open p f flag fd None # s) = cf2sfile s"
e9c5594d5963 fixed bugs in deleted definition
chunhan
parents: 3
diff changeset
    32
apply (rule ext, rule ext)
e9c5594d5963 fixed bugs in deleted definition
chunhan
parents: 3
diff changeset
    33
apply (simp add:cf2sfile_open_none1 cf2sfile_open_none2)
e9c5594d5963 fixed bugs in deleted definition
chunhan
parents: 3
diff changeset
    34
done
1
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    35
3
chunhan
parents: 1
diff changeset
    36
lemma sroot_only:
chunhan
parents: 1
diff changeset
    37
  "cf2sfile s [] = (\<lambda> b. if b then None else Some sroot)"
chunhan
parents: 1
diff changeset
    38
by (rule ext, simp add:cf2sfile_def)
chunhan
parents: 1
diff changeset
    39
1
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    40
lemma cf2sfile_open_some1:
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    41
  "\<lbrakk>valid (Open p f flag fd (Some inum) # s); f' \<in> current_files s\<rbrakk>
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    42
   \<Longrightarrow> cf2sfile (Open p f flag fd (Some inum) # s) f' = cf2sfile s f'"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    43
apply (frule vd_cons, frule vt_grant_os, frule noroot_events, rule ext)
4
e9c5594d5963 fixed bugs in deleted definition
chunhan
parents: 3
diff changeset
    44
apply (case_tac "f = f'", simp)
e9c5594d5963 fixed bugs in deleted definition
chunhan
parents: 3
diff changeset
    45
apply (induct f', simp add:sroot_only, simp)
3
chunhan
parents: 1
diff changeset
    46
apply (frule parentf_in_current', simp+)
4
e9c5594d5963 fixed bugs in deleted definition
chunhan
parents: 3
diff changeset
    47
apply (simp add:cf2sfile_def is_file_simps is_dir_simps current_files_simps sectxt_of_obj_simps 
1
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    48
               get_parentfs_ctxts_simps)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    49
done
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    50
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    51
lemma cf2sfile_open_some2:
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    52
  "\<lbrakk>valid (Open p f flag fd (Some inum) # s); is_file s f'\<rbrakk>
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    53
   \<Longrightarrow> cf2sfile (Open p f flag fd (Some inum) # s) f' True = cf2sfile s f' True"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    54
apply (frule vd_cons, drule is_file_in_current)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    55
by (simp add:cf2sfile_open_some1)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    56
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    57
lemma cf2sfile_open_some3:
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    58
  "\<lbrakk>valid (Open p f flag fd (Some inum) # s); is_dir s f'\<rbrakk>
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    59
   \<Longrightarrow> cf2sfile (Open p f flag fd (Some inum) # s) f' False = cf2sfile s f' False"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    60
apply (frule vd_cons, drule is_dir_in_current)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    61
by (simp add:cf2sfile_open_some1)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    62
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    63
lemma cf2sfile_open_some:
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    64
  "valid (Open p f flag fd (Some inum) # s) \<Longrightarrow> cf2sfile (Open p f flag fd (Some inum) # s) f True = (
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    65
     case (parent f) of
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    66
       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), 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    67
                         get_parentfs_ctxts s pf) of
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    68
                    (Some sec, Some psec, Some asecs) \<Rightarrow> Some (Created, sec, Some psec, set asecs)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    69
                  | _ \<Rightarrow> None)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    70
     | None \<Rightarrow> None)"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    71
apply (frule vd_cons, frule vt_grant_os, frule noroot_events)
4
e9c5594d5963 fixed bugs in deleted definition
chunhan
parents: 3
diff changeset
    72
apply (case_tac f, simp)
e9c5594d5963 fixed bugs in deleted definition
chunhan
parents: 3
diff changeset
    73
apply (simp add:cf2sfile_def is_file_simps is_dir_simps current_files_simps sectxt_of_obj_simps 
e9c5594d5963 fixed bugs in deleted definition
chunhan
parents: 3
diff changeset
    74
               get_parentfs_ctxts_simps)
e9c5594d5963 fixed bugs in deleted definition
chunhan
parents: 3
diff changeset
    75
apply (rule impI)
e9c5594d5963 fixed bugs in deleted definition
chunhan
parents: 3
diff changeset
    76
thm not_deleted_imp_exists
1
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    77
apply (auto split:if_splits option.splits    dest!:current_has_sec'
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    78
          simp:cf2sfile_def is_file_simps is_dir_simps current_files_simps sectxt_of_obj_simps 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    79
               get_parentfs_ctxts_simps)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    80
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    81
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    82
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    83
lemma cf2sfile_open:
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    84
  "valid (Open p f flag fd opt # s) \<Longrightarrow> cf2sfile (Open p f flag fd opt # s) = (\<lambda> f' b. 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    85
     if (opt = None) then cf2sfile s f' b
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    86
     else if (f' = f \<and> b = True) 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    87
     then (case (parent f) of
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    88
             Some pf \<Rightarrow> (case (sectxt_of_obj s (O_file f), sectxt_of_obj s (O_dir pf), 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    89
                 get_parentfs_ctxts s pf) of
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    90
                          (Some sec, Some psec, Some asecs) \<Rightarrow>
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    91
                              Some (if (\<not> deleted (O_file f) s \<and> f \<in> init_files) 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    92
                                    then Init f else Created, sec, Some psec, set asecs)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    93
                        | _ \<Rightarrow> None)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    94
           | None \<Rightarrow> None)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    95
     else cf2sfile s f' b)"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    96
apply (frule vd_cons, frule vt_grant_os, rule ext, rule ext)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    97
apply (auto split:if_splits option.splits 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    98
             simp:sectxt_of_obj_simps)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    99
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   100
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   101
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   102
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   103
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   104
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   105
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   106
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   107
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   108
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   109
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   110
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   111
lemma cf2sfile_keep_path: "\<lbrakk>f \<preceq> f'; \<tau> \<in> vt rc_cs\<rbrakk> \<Longrightarrow> cf2sfile \<tau> f \<preceq> cf2sfile \<tau> f'"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   112
apply (induct f', simp add:no_junior_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   113
apply (case_tac "f = a # f'", simp add:cf2sfile.simps)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   114
apply (drule no_junior_noteq, simp, simp add:cf2sfile.simps)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   115
done
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   116
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   117
lemma ckp'_aux: "\<not> f \<preceq> a # f' \<Longrightarrow> \<not> f \<preceq> f'"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   118
by (auto simp:no_junior_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   119
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   120
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'"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   121
apply (induct f', simp add:no_junior_def cf2sfile.simps, rule notI, drule cf2sfile_root_file, simp)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   122
apply (case_tac "f = a # f'", simp add:cf2sfile.simps)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   123
apply (rule notI)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   124
apply (frule ckp'_aux, simp, frule parentf_in_current', simp+)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   125
apply (case_tac "cf2sfile \<tau> f = cf2sfile \<tau> (a # f')", drule cf2sfile_inj, simp+)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   126
apply (simp add:cf2sfile.simps)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   127
by (drule no_junior_noteq, simp+)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   128
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   129
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'"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   130
using cf2sfile_keep_path'
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   131
by (auto)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   132
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   133
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"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   134
apply (frule vt_cons')
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   135
apply (drule vt_grant_os)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   136
apply (induct f)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   137
apply (simp add:cf2sfile.simps)+
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   138
apply (frule parentf_in_current', simp)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   139
apply (auto simp:os_grant.simps index_of_file.simps split:option.splits)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   140
done
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   141
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   142
lemma cf2sfile_open_some: "\<lbrakk>Open p f flags fd (Some inum) # \<tau> \<in> vt rc_cs; parent f = Some pf\<rbrakk> 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   143
                           \<Longrightarrow> cf2sfile (Open p f flags fd (Some inum) # \<tau>) f = (SCrea (Suc (length \<tau>)) # (cf2sfile \<tau> pf))"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   144
apply (case_tac f, simp)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   145
apply (frule vt_grant_os)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   146
apply (simp add:cf2sfile.simps os_grant.simps current_files_simps index_of_file.simps cf2sfile_open_some')
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   147
done
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   148
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   149
lemma cf2sfile_open_none: "cf2sfile (Open p f flags fd None # \<tau>) f' = cf2sfile \<tau> f'"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   150
apply (induct f')
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   151
by (simp add:cf2sfile.simps index_of_file.simps split:option.splits nat.splits)+
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   152
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   153
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> 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   154
                       cf2sfile (Open p f flags fd opt # \<tau>) f' = (
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   155
                         if (opt = None) then cf2sfile \<tau> f'
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   156
                         else if (f' = f) then (case (parent f) of
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   157
                                                  Some pf \<Rightarrow> (SCrea (Suc (length \<tau>)) # (cf2sfile \<tau> pf))
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   158
                                                | _       \<Rightarrow> [])
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   159
                              else cf2sfile \<tau> f'                                                          )"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   160
apply (frule vt_grant_os)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   161
by (auto simp:os_grant.simps current_files_simps intro:cf2sfile_open_none cf2sfile_open_some cf2sfile_open_some' split:if_splits option.splits)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   162
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   163
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"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   164
apply (frule vt_cons', drule vt_grant_os)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   165
apply (induct f, (simp add:cf2sfile.simps)+)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   166
apply (frule parentf_in_current', simp)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   167
apply (auto simp:os_grant.simps index_of_file.simps split:option.splits)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   168
done
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   169
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   170
lemma cf2sfile_mkdir_some: "\<lbrakk>Mkdir p f inum # \<tau> \<in> vt rc_cs; parent f = Some pf\<rbrakk>
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   171
                             \<Longrightarrow> cf2sfile (Mkdir p f inum # \<tau>) f = (SCrea (Suc (length \<tau>)) # (cf2sfile \<tau> pf))"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   172
apply (case_tac f, simp)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   173
apply (frule vt_grant_os)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   174
apply (simp add:cf2sfile.simps os_grant.simps current_files_simps index_of_file.simps cf2sfile_mkdir_some')
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   175
done
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   176
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   177
lemma cf2sfile_mkdir: "\<lbrakk>Mkdir p f inum # \<tau> \<in> vt rc_cs; f' \<in> current_files (Mkdir p f inum # \<tau>)\<rbrakk> \<Longrightarrow>
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   178
                        cf2sfile (Mkdir p f inum # \<tau>) f' = (
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   179
                          if (f' = f) then (case (parent f) of
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   180
                                              Some pf \<Rightarrow> (SCrea (Suc (length \<tau>)) # (cf2sfile \<tau> pf))
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   181
                                            | _       \<Rightarrow> [])
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   182
                          else cf2sfile \<tau> f'               ) "
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   183
apply (frule vt_grant_os)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   184
by (auto simp:os_grant.simps current_files_simps intro:cf2sfile_mkdir_some cf2sfile_mkdir_some' split:if_splits option.splits)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   185
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   186
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"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   187
apply (frule vt_cons')
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   188
apply (drule vt_grant_os)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   189
apply (induct f)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   190
apply (simp add:cf2sfile.simps)+
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   191
apply (frule parentf_in_current', simp)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   192
apply (auto simp:os_grant.simps index_of_file.simps split:option.splits)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   193
done
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   194
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   195
lemma cf2sfile_linkhard_some: 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   196
  "\<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))"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   197
apply (case_tac f\<^isub>2, simp)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   198
apply (frule vt_grant_os)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   199
apply (simp add:cf2sfile.simps os_grant.simps current_files_simps index_of_file.simps cf2sfile_linkhard_none)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   200
done
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   201
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   202
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>
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   203
                           cf2sfile (LinkHard p f\<^isub>1 f\<^isub>2 # \<tau>) f = (
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   204
                             if (f = f\<^isub>2) then (case (parent f\<^isub>2) of
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   205
                                                 Some pf\<^isub>2 \<Rightarrow> SCrea (Suc (length \<tau>)) # (cf2sfile \<tau> pf\<^isub>2)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   206
                                               | _        \<Rightarrow> [])
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   207
                             else cf2sfile \<tau> f                 )"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   208
apply (frule vt_grant_os)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   209
by (auto simp:os_grant.simps current_files_simps intro:cf2sfile_linkhard_none cf2sfile_linkhard_some split:if_splits option.splits)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   210
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   211
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   212
lemma no_junior_aux: "\<not> f\<^isub>2 \<preceq> a # f \<Longrightarrow> \<not> f\<^isub>2 \<preceq> f"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   213
by (auto simp:no_junior_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   214
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   215
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"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   216
apply (frule vt_grant_os, simp add:os_grant.simps, (erule exE|erule conjE)+)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   217
apply (rule conjI, rule notI, simp)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   218
apply (rule notI, drule vt_cons', simp add:ancenf_in_current)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   219
done
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   220
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   221
lemma cf2sfile_rename'1: 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   222
  "\<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"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   223
apply (frule vt_cons',frule vt_grant_os,  induct f)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   224
apply (simp add:cf2sfile.simps)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   225
apply (frule parentf_in_current', simp, simp)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   226
apply (frule no_junior_aux, simp)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   227
apply (simp add:os_grant.simps, (erule exE|erule conjE)+)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   228
apply (drule cf2sfile_rename_aux, simp, erule conjE)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   229
apply (auto simp add:cf2sfile.simps index_of_file.simps split:option.splits nat.splits)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   230
done
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   231
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   232
lemma cf2sfile_rename'2: 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   233
  "\<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"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   234
apply (frule vt_cons', induct f)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   235
by (auto simp add:index_of_file.simps cf2sfile.simps no_junior_def split:option.splits nat.splits)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   236
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   237
lemma cf2sfile_rename1:
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   238
  "\<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)"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   239
apply (case_tac f\<^isub>3, simp add:cf2sfile.simps)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   240
apply (auto dest!:cf2sfile_rename'2 simp add:no_junior_def cf2sfile.simps index_of_file.simps split:option.splits)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   241
done
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   242
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   243
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"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   244
apply (clarsimp simp add:index_of_file.simps split:option.splits)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   245
by (frule_tac f\<^isub>3 = f\<^isub>3 in file_renaming_prop3, simp, erule conjE, simp add:file_renaming_prop5)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   246
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   247
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> 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   248
   \<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))"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   249
apply (induct f, simp add:no_junior_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   250
apply (case_tac "a # f = f\<^isub>3", simp)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   251
apply (drule cf2sfile_rename1, simp, simp add:file_renaming_prop0' file_renaming_prop0)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   252
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   253
apply (frule no_junior_noteq, simp, simp)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   254
apply (frule_tac file_renaming_prop1')
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   255
apply (frule_tac f = f\<^isub>2 and \<tau> = \<tau> in cf2sfile_keep_path, simp add:vt_cons')
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   256
apply (frule_tac f\<^isub>2 = f\<^isub>2 and a = a in file_renaming_prop8')
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   257
apply (frule_tac f\<^isub>2 = f\<^isub>2 and a = a in file_renaming_prop6')
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   258
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)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   259
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)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   260
apply (drule parentf_in_current', simp add:vt_cons')
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   261
apply (simp add:cf2sfile.simps)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   262
apply (erule file_renaming_prop6[THEN sym])
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   263
done
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   264
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   265
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> 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   266
   \<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)"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   267
apply (frule_tac f\<^isub>3 = f\<^isub>3 in file_renaming_prop5)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   268
apply (frule_tac f\<^isub>3 = f\<^isub>3 in file_renaming_prop1)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   269
apply (drule_tac f = "file_after_rename f\<^isub>2 f\<^isub>3 f" in cf2sfile_rename2, simp+)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   270
done
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   271
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   272
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> 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   273
   \<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)"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   274
apply (case_tac "f\<^isub>2 \<preceq> f")
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   275
apply (rule cf2sfile_rename2', simp+)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   276
apply (frule vt_grant_os)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   277
apply (frule_tac \<tau> = \<tau> in cf2sfile_keep_path', simp add:vt_cons', simp add:os_grant.simps, simp)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   278
apply (simp add:file_after_rename_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   279
by (rule cf2sfile_rename'1, simp+)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   280
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   281
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>
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   282
                         cf2sfile (Rename p f\<^isub>2 f\<^isub>3 # \<tau>) f = (
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   283
                           if (f\<^isub>3 \<preceq> f) then (case (parent f\<^isub>3) of 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   284
                                               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))
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   285
                                             | _        \<Rightarrow> [])
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   286
                           else cf2sfile \<tau> f               )"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   287
apply (frule vt_grant_os)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   288
apply (case_tac "f = f\<^isub>3", clarsimp simp:os_grant.simps, drule cf2sfile_rename1, simp+, simp add:file_renaming_prop0' file_renaming_prop0)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   289
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   290
apply (auto simp:os_grant.simps current_files_simps intro:cf2sfile_rename'2 cf2sfile_rename1 split:if_splits option.splits) 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   291
apply (rule cf2sfile_rename2, simp, drule rename_renaming_decom, simp+)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   292
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+)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   293
done
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   294
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   295
lemma cf2sfile_other: "\<lbrakk>
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   296
                        \<forall> p f flags fd opt. e \<noteq> Open p f flags fd opt;
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   297
                        \<forall> p f im. e \<noteq> Mkdir p f im;
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   298
                        \<forall> p f\<^isub>1 f\<^isub>2. e \<noteq> LinkHard p f\<^isub>1 f\<^isub>2;
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   299
                        \<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'"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   300
apply (induct f', simp add:cf2sfile.simps index_of_file.simps split:option.splits nat.splits)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   301
apply (case_tac e, auto simp add:cf2sfile.simps index_of_file.simps split:option.splits nat.splits)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   302
done
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   303
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   304
lemmas cf2sfile_nil = init_cf2sfile
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   305
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   306
lemma cf2sfile_nil': "f \<in> current_files [] \<Longrightarrow> cf2sfile [] f = map SInit f"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   307
by (simp add:cf2sfile_nil current_files_simps)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   308
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   309
lemmas cf2sfile_simps = cf2sfile_nil cf2sfile_nil' cf2sfile_open cf2sfile_mkdir cf2sfile_linkhard cf2sfile_rename cf2sfile_other
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   310
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   311
lemmas cf2sfile_simpss = cf2sfile_nil cf2sfile_nil' cf2sfile_open_some' cf2sfile_open_some cf2sfile_open_none cf2sfile_open cf2sfile_mkdir_some' cf2sfile_mkdir_some
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   312
                         cf2sfile_mkdir cf2sfile_linkhard_none cf2sfile_linkhard_some cf2sfile_linkhard cf2sfile_rename'1 cf2sfile_rename'2 cf2sfile_rename1
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   313
                         cf2sfile_rename2 cf2sfile_rename2' cf2sfile_rename3 cf2sfile_rename cf2sfile_other
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   314
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   315
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"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   316
by (simp add:cf2sfile_open_some' current_files_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   317
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   318
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"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   319
by (simp add:cf2sfile_mkdir_some' current_files_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   320
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   321
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"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   322
by (simp add:cf2sfile_linkhard_none current_files_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   323
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   324
lemma cf2sfile_rename'1_inum: 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   325
  "\<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"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   326
by (simp add:cf2sfile_rename'1 current_files_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   327
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   328
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> 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   329
   \<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))"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   330
by (simp add:cf2sfile_rename2 current_files_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   331
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   332
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> 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   333
   \<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)"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   334
by (simp add:cf2sfile_rename2' current_files_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   335
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   336
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> 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   337
   \<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)"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   338
by (simp add:cf2sfile_rename3 current_files_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   339
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   340
lemma cf2sfile_nil'_inum: "inum_of_file [] f = Some im \<Longrightarrow> cf2sfile [] f = map SInit f"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   341
by (simp add:cf2sfile_nil' current_files_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   342
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   343
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
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   344
                         cf2sfile_mkdir cf2sfile_linkhard_none_inum cf2sfile_linkhard_some cf2sfile_linkhard cf2sfile_rename'1_inum cf2sfile_rename'2 cf2sfile_rename1
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   345
                         cf2sfile_rename2_inum cf2sfile_rename2'_inum cf2sfile_rename3_inum cf2sfile_rename cf2sfile_other
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   346
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   347
(*************** cp2sproc simpset *********************)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   348
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   349
lemma cp2sproc_nil: "p \<in> init_processes \<Longrightarrow> cp2sproc [] p = SInit p"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   350
by (simp add:cp2sproc_def index_of_proc.simps)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   351
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   352
lemma cp2sproc_nil': "p \<in> current_procs [] \<Longrightarrow> cp2sproc [] p = SInit p"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   353
by (simp add:cp2sproc_nil current_procs.simps)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   354
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   355
lemma cp2sproc_clone: "cp2sproc (Clone p p' # \<tau>) p'' = (
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   356
                         if (p'' = p') then SCrea (Suc (length \<tau>))
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   357
                         else cp2sproc \<tau> p''           )"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   358
by (auto simp:cp2sproc_def index_of_proc.simps d2s_aux.simps)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   359
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   360
lemma cp2sproc_other: "\<forall> p p'. e \<noteq> Clone p p' \<Longrightarrow> cp2sproc (e # \<tau>) p'' = cp2sproc \<tau> p''"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   361
apply (case_tac e)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   362
by (auto simp:cp2sproc_def index_of_proc.simps d2s_aux.simps)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   363
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   364
lemmas cp2sproc_simps = cp2sproc_nil cp2sproc_nil' cp2sproc_clone cp2sproc_other
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   365
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   366
(******************** ch2sshm simpset **************************)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   367
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   368
lemma ch2sshm_nil: "h \<in> init_shms \<Longrightarrow> ch2sshm [] h = SInit h"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   369
by (simp add:ch2sshm_def index_of_shm.simps)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   370
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   371
lemma ch2sshm_nil': "h \<in> current_shms [] \<Longrightarrow> ch2sshm [] h = SInit h"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   372
by (simp add:ch2sshm_nil current_shms.simps)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   373
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   374
lemma ch2sshm_createshm: "ch2sshm (CreateShM p h # \<tau>) h' = (if (h' = h) then SCrea (Suc (length \<tau>)) else ch2sshm \<tau> h')"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   375
by (simp add:ch2sshm_def index_of_shm.simps d2s_aux.simps) 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   376
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   377
lemma ch2sshm_other: "\<forall> p h. e \<noteq> CreateShM p h \<Longrightarrow> ch2sshm (e # \<tau>) h' = ch2sshm \<tau> h'"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   378
apply (case_tac e)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   379
by (auto simp add:ch2sshm_def index_of_shm.simps d2s_aux.simps) 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   380
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   381
lemmas ch2sshm_simps = ch2sshm_nil ch2sshm_nil' ch2sshm_createshm ch2sshm_other
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   382
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   383
(********************* cm2smsg simpset ***********************)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   384
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   385
lemma cm2smsg_nil: "m \<in> init_msgs \<Longrightarrow> cm2smsg [] m = SInit m"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   386
by (simp add:cm2smsg_def index_of_msg.simps)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   387
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   388
lemma cm2smsg_nil': "m \<in> current_msgs [] \<Longrightarrow> cm2smsg [] m = SInit m"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   389
by (simp add:cm2smsg_nil current_msgs.simps)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   390
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   391
lemma cm2smsg_createmsg: "cm2smsg (CreateMsg p m # \<tau>) m' = (if (m' = m) then SCrea (Suc (length \<tau>)) else cm2smsg \<tau> m')"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   392
by (simp add:cm2smsg_def index_of_msg.simps d2s_aux.simps)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   393
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   394
lemma cm2smsg_other: "\<forall> p m. e \<noteq> CreateMsg p m \<Longrightarrow> cm2smsg (e # \<tau>) m' = cm2smsg \<tau> m'"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   395
apply (case_tac e)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   396
by (auto simp:cm2smsg_def index_of_msg.simps d2s_aux.simps)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   397
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   398
lemmas cm2smsg_simps = cm2smsg_nil cm2smsg_nil' cm2smsg_createmsg cm2smsg_other
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   399
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   400
(********************** cfd2fd_s simpset ******************************)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   401
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   402
lemma cfd2fd_s_nil: "fd \<in> init_fds_of_proc p \<Longrightarrow> cfd2fd_s [] p fd = SInit fd"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   403
by (simp add:cfd2fd_s_def index_of_fd.simps)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   404
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   405
lemma cfd2fd_s_nil': "fd \<in> current_proc_fds [] p \<Longrightarrow> cfd2fd_s [] p fd = SInit fd"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   406
by (simp add:cfd2fd_s_nil current_proc_fds.simps)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   407
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   408
lemma cfd2fd_s_open: "cfd2fd_s (Open p f flags fd opt # \<tau>) p' fd' = (
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   409
                        if (p = p') then (if (fd = fd') then SCrea (Suc (length \<tau>)) 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   410
                                          else cfd2fd_s \<tau> p' fd')
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   411
                        else cfd2fd_s \<tau> p' fd'                      )"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   412
by (simp add:cfd2fd_s_def index_of_fd.simps d2s_aux.simps)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   413
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   414
lemma cfd2fd_s_createsock: "cfd2fd_s (CreateSock p af st fd im # \<tau>) p' fd' = (
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   415
                              if (p = p') then (if (fd = fd') then SCrea (Suc (length \<tau>)) 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   416
                                          else cfd2fd_s \<tau> p' fd')
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   417
                              else cfd2fd_s \<tau> p' fd'                         )"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   418
by (simp add:cfd2fd_s_def index_of_fd.simps d2s_aux.simps)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   419
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   420
lemma cfd2fd_s_accept: "cfd2fd_s (Accept p fd addr port fd' im # \<tau>) p' fd'' = (
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   421
                          if (p' = p) then (if (fd'' = fd') then SCrea (Suc (length \<tau>))
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   422
                                            else cfd2fd_s \<tau> p' fd'')
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   423
                          else cfd2fd_s \<tau> p' fd''                             )"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   424
by (simp add:cfd2fd_s_def index_of_fd.simps d2s_aux.simps)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   425
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   426
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)"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   427
by (simp add:cfd2fd_s_def index_of_fd.simps d2s_aux.simps)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   428
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   429
lemma cfd2fd_s_other: "\<lbrakk>\<forall> p f flags fd opt. e \<noteq> Open p f flags fd opt;
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   430
                        \<forall> p af st fd im. e \<noteq> CreateSock p af st fd im;
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   431
                        \<forall> p fd addr port fd' im. e \<noteq> Accept p fd addr port fd' im;
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   432
                        \<forall> p p'. e \<noteq> Clone p p'\<rbrakk> \<Longrightarrow> cfd2fd_s (e # \<tau>) p'' fd'' = cfd2fd_s \<tau> p'' fd''"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   433
by (case_tac e, auto simp:cfd2fd_s_def index_of_fd.simps d2s_aux.simps)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   434
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   435
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
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   436
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   437
(************* cim2im_s simpset **************************)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   438
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   439
(* no such lemma
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   440
lemma cim2im_s_nil: "init_itag_of_inum im = Some tag \<Longrightarrow> cim2im_s [] im = SInit im"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   441
by (simp add:cim2im_s_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   442
*)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   443
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   444
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')"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   445
by (simp add:cim2im_s_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   446
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   447
lemma cim2im_s_open': "cim2im_s (Open p f flags fd None # \<tau>) im = cim2im_s \<tau> im"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   448
by (simp add:cim2im_s_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   449
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   450
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')"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   451
by (simp add:cim2im_s_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   452
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   453
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')"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   454
by (simp add:cim2im_s_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   455
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   456
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')"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   457
by (simp add:cim2im_s_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   458
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   459
lemma cim2im_s_other: "\<lbrakk>\<forall> p f flags fd opt. e \<noteq> Open p f flags fd opt;
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   460
                        \<forall> p f im. e \<noteq> Mkdir p f im;
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   461
                        \<forall> p sf st fd im. e \<noteq> CreateSock p sf st fd im;
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   462
                        \<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"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   463
by (case_tac e, auto simp:cim2im_s_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   464
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   465
lemmas cim2im_s_simps = cim2im_s_open cim2im_s_open' cim2im_s_mkdir cim2im_s_createsock cim2im_s_accept cim2im_s_other
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   466
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   467
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   468
lemma cig2ig_s_simp: "cig2ig_s (e # \<tau>) tag = cig2ig_s \<tau> tag"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   469
apply (case_tac tag)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   470
by auto
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   471
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   472
(******************* cobj2sobj no Suc (length \<tau>) ***********************)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   473
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   474
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"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   475
apply (case_tac f, (simp add:cf2sfile.simps d2s_aux.simps)+)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   476
apply (case_tac "index_of_file \<tau> (a # list)", (simp add:d2s_aux.simps)+)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   477
by (drule index_of_file_le_length', simp+)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   478
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   479
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"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   480
apply (induct f)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   481
apply (simp add:no_junior_def cf2sfile.simps d2s_aux.simps)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   482
apply (case_tac "cf2sfile \<tau> (a # f) = SCrea (Suc (length \<tau>)) # spf") 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   483
apply (drule_tac f = "a # f" in cf2sfile_le_len, simp+)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   484
apply (simp only:cf2sfile.simps d2s_aux.simps)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   485
apply (drule_tac no_junior_noteq, simp+)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   486
apply (rule impI, erule impE, simp+)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   487
apply (drule parentf_in_current', simp+)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   488
done
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   489
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   490
lemma cp2sproc_le_len: "cp2sproc \<tau> p = SCrea (Suc (length \<tau>)) \<Longrightarrow> False"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   491
apply (simp add:cp2sproc_def, case_tac "index_of_proc \<tau> p")
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   492
apply (simp add:d2s_aux.simps)+
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   493
by (drule index_of_proc_le_length', simp)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   494
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   495
lemma ch2sshm_le_len: "ch2sshm \<tau> h = SCrea (Suc (length \<tau>)) \<Longrightarrow> False"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   496
apply (simp add:ch2sshm_def, case_tac "index_of_shm \<tau> h")
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   497
apply (simp add:d2s_aux.simps)+
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   498
by (drule index_of_shm_le_length', simp)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   499
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   500
lemma cm2smsg_le_len: "cm2smsg \<tau> m = SCrea (Suc (length \<tau>)) \<Longrightarrow> False"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   501
apply (simp add:cm2smsg_def, case_tac "index_of_msg \<tau> m")
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   502
apply (simp add:d2s_aux.simps)+
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   503
by (drule index_of_msg_le_length', simp)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   504
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   505
lemma cim2im_s_le_len: "cim2im_s \<tau> im = SCrea (Suc (length \<tau>)) \<Longrightarrow> False"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   506
apply (simp add:cim2im_s_def, case_tac "inum2ind \<tau> im")
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   507
apply (simp add:d2s_aux.simps)+
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   508
by (drule inum2ind_le_length', simp)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   509
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   510
lemma cfd2fd_s_le_len: "cfd2fd_s \<tau> p fd = SCrea (Suc (length \<tau>)) \<Longrightarrow> False"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   511
apply (simp add:cfd2fd_s_def, case_tac "index_of_fd \<tau> p fd")
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   512
apply (simp add:d2s_aux.simps)+
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   513
by (drule index_of_fd_le_length', simp)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   514
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   515
end
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   516
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   517
(*<*)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   518
end
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   519
(*>*)