Alive_prop.thy
author chunhan
Wed, 25 Sep 2013 11:29:13 +0800
changeset 49 68649272054c
parent 41 db15ef2ee18c
child 70 002c34a6ff4f
permissions -rw-r--r--
600 loc to finish s2ss_closefd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
     1
theory Alive_prop
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
     2
imports Main Flask_type Flask Current_files_prop Current_sockets_prop Init_prop
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
     3
begin
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
     4
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
     5
context flask begin
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
     6
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
     7
lemma distinct_queue_msgs:
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
     8
  "\<lbrakk>q \<in> current_msgqs s; valid s\<rbrakk> \<Longrightarrow> distinct (msgs_of_queue s q)"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
     9
apply (induct s)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    10
apply (simp add:init_msgs_distinct)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    11
apply (frule vd_cons, frule vt_grant_os, case_tac a)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    12
apply auto
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    13
apply (case_tac "msgs_of_queue s q", simp+)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    14
done
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    15
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    16
lemma received_msg_notin: 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    17
  "\<lbrakk>hd (msgs_of_queue s q) \<in> set (tl (msgs_of_queue s q)); q \<in> current_msgqs s; valid s\<rbrakk> \<Longrightarrow> False"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    18
apply (drule distinct_queue_msgs, simp)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    19
apply (case_tac "msgs_of_queue s q", auto)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    20
done
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    21
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    22
lemma other_msg_remains:
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    23
  "\<lbrakk>m \<noteq> hd (msgs_of_queue s q); q \<in> current_msgqs s; valid s\<rbrakk>
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    24
   \<Longrightarrow> (m \<in> set (tl (msgs_of_queue s q))) = (m \<in> set (msgs_of_queue s q))"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    25
apply (drule distinct_queue_msgs, simp)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    26
apply (case_tac "msgs_of_queue s q", auto)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    27
done
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    28
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    29
lemma is_tcp_in_current:
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    30
  "is_tcp_sock \<tau> s \<Longrightarrow> s \<in> current_sockets \<tau>"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    31
by (auto simp:is_tcp_sock_def current_sockets_def split:option.splits)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    32
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    33
lemma is_udp_in_current:
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    34
  "is_udp_sock \<tau> s \<Longrightarrow> s \<in> current_sockets \<tau>"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    35
by (auto simp:is_udp_sock_def current_sockets_def split:option.splits)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    36
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    37
(************ alive simpset **************)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    38
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    39
lemma alive_open: 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    40
  "valid (Open p f flag fd opt # s) \<Longrightarrow> alive (Open p f flag fd opt # s) = (
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    41
     \<lambda> obj. case obj of 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    42
              O_fd p' fd' \<Rightarrow> if (p' = p \<and> fd' = fd) then True
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    43
                             else alive s obj
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    44
            | O_file f' \<Rightarrow> (if (opt = None) then alive s obj
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    45
                           else if (f = f') then True 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    46
                                else alive s obj)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    47
            | _ \<Rightarrow> alive s obj)"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    48
apply (frule vd_cons, frule vt_grant_os, rule ext, case_tac obj)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    49
apply (auto simp:current_files_simps current_sockets_simps is_file_simps is_dir_simps 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    50
                 is_tcp_sock_simps is_udp_sock_simps
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    51
            dest:is_dir_in_current split:if_splits option.splits)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    52
done
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    53
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    54
lemma alive_execve:
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    55
  "valid (Execve p f fds # s) \<Longrightarrow> alive (Execve p f fds # s) = (
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    56
     \<lambda> obj. case obj of
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    57
              O_fd p' fd \<Rightarrow> (if (p = p' \<and> fd \<in> fds) then alive s (O_fd p fd)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    58
                             else if (p = p') then False
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    59
                                  else alive s (O_fd p' fd))
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    60
            | O_tcp_sock (p', fd) \<Rightarrow> (if (p = p' \<and> fd \<in> fds) then alive s (O_tcp_sock (p, fd))
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    61
                                     else if (p = p') then False
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    62
                                          else alive s (O_tcp_sock (p', fd)))
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    63
            | O_udp_sock (p', fd) \<Rightarrow> (if (p = p' \<and> fd \<in> fds) then alive s (O_udp_sock (p, fd))
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    64
                                     else if (p = p') then False
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    65
                                          else alive s (O_udp_sock (p', fd)))
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    66
            | _ \<Rightarrow> alive s obj )"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    67
apply (frule vd_cons, frule vt_grant_os, rule ext, case_tac obj)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    68
apply (auto simp:current_files_simps current_sockets_simps is_file_simps is_dir_simps 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    69
                 is_tcp_sock_simps is_udp_sock_simps
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    70
            dest:is_dir_in_current split:if_splits option.splits)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    71
done
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    72
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    73
lemma alive_clone:
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    74
  "valid (Clone p p' fds shms # s) \<Longrightarrow> alive (Clone p p' fds shms # s) = (
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    75
     \<lambda> obj. case obj of
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    76
              O_proc p'' \<Rightarrow> if (p'' = p') then True else alive s obj
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    77
            | O_fd p'' fd \<Rightarrow> if (p'' = p' \<and> fd \<in> fds) then True
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    78
                             else if (p'' = p') then False
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    79
                                  else alive s obj
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    80
            | O_tcp_sock (p'', fd) \<Rightarrow> (if (p'' = p' \<and> fd \<in> fds) then alive s (O_tcp_sock (p, fd))
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    81
                                      else if (p'' = p') then False
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    82
                                           else alive s (O_tcp_sock (p'', fd)))
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    83
            | O_udp_sock (p'', fd) \<Rightarrow> (if (p'' = p' \<and> fd \<in> fds) then alive s (O_udp_sock (p, fd))
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    84
                                      else if (p'' = p') then False
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    85
                                           else alive s (O_udp_sock (p'', fd)))
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    86
            | _ \<Rightarrow> alive s obj )"  
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    87
apply (frule vd_cons, frule vt_grant_os, rule ext, case_tac obj)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    88
apply (auto simp:current_files_simps current_sockets_simps is_file_simps is_dir_simps 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    89
                 is_tcp_sock_simps is_udp_sock_simps
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    90
           intro:is_tcp_in_current is_udp_in_current
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    91
            dest:is_dir_in_current split:if_splits option.splits)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    92
done
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    93
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    94
lemma alive_kill:
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    95
  "valid (Kill p p' # s) \<Longrightarrow> alive (Kill p p' # s) = (
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    96
     \<lambda> obj. case obj of 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    97
              O_proc p'' \<Rightarrow> if (p'' = p') then False else alive s obj
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    98
            | O_fd p'' fd \<Rightarrow> if (p'' = p') then False else alive s obj
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    99
            | O_tcp_sock (p'', fd) \<Rightarrow> if (p'' = p') then False else alive s obj
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   100
            | O_udp_sock (p'', fd) \<Rightarrow> if (p'' = p') then False else alive s obj
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   101
            | _ \<Rightarrow> alive s obj)"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   102
apply (frule vd_cons, frule vt_grant_os, rule ext, case_tac obj)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   103
apply (auto simp:current_files_simps current_sockets_simps is_file_simps is_dir_simps 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   104
                 is_tcp_sock_simps is_udp_sock_simps
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   105
           intro:is_tcp_in_current is_udp_in_current
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   106
            dest:is_dir_in_current split:if_splits option.splits)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   107
done
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   108
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   109
lemma alive_exit:
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   110
  "valid (Exit p' # s) \<Longrightarrow> alive (Exit p' # s) = (
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   111
     \<lambda> obj. case obj of 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   112
              O_proc p'' \<Rightarrow> if (p'' = p') then False else alive s obj
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   113
            | O_fd p'' fd \<Rightarrow> if (p'' = p') then False else alive s obj
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   114
            | O_tcp_sock (p'', fd) \<Rightarrow> if (p'' = p') then False else alive s obj
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   115
            | O_udp_sock (p'', fd) \<Rightarrow> if (p'' = p') then False else alive s obj
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   116
            | _ \<Rightarrow> alive s obj)"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   117
apply (frule vd_cons, frule vt_grant_os, rule ext, case_tac obj)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   118
apply (auto simp:current_files_simps current_sockets_simps is_file_simps is_dir_simps 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   119
                 is_tcp_sock_simps is_udp_sock_simps
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   120
           intro:is_tcp_in_current is_udp_in_current
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   121
            dest:is_dir_in_current split:if_splits option.splits)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   122
done
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   123
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   124
lemma alive_closefd:
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   125
  "valid (CloseFd p fd # s) \<Longrightarrow> alive (CloseFd p fd # s) = (
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   126
     \<lambda> obj. case obj of 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   127
              O_fd p' fd' \<Rightarrow> if (p' = p \<and> fd' = fd) then False else alive s obj
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   128
            | O_tcp_sock (p', fd') \<Rightarrow> if (p' = p \<and> fd' = fd) then False else alive s obj
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   129
            | O_udp_sock (p', fd') \<Rightarrow> if (p' = p \<and> fd' = fd) then False else alive s obj
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   130
            | O_file f \<Rightarrow> (case (file_of_proc_fd s p fd) of
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   131
                            Some f' \<Rightarrow> (if (f = f' \<and> proc_fd_of_file s f = {(p, fd)} \<and> f \<in> files_hung_by_del s) 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   132
                                      then False else alive s obj)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   133
                          | _ \<Rightarrow> alive s obj)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   134
            | _ \<Rightarrow> alive s obj)"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   135
apply (frule vd_cons, frule vt_grant_os, rule ext, case_tac obj)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   136
apply (auto simp:current_files_simps current_sockets_simps is_file_simps is_dir_simps 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   137
                 is_tcp_sock_simps is_udp_sock_simps
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   138
           intro:is_tcp_in_current is_udp_in_current
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   139
            dest:is_dir_in_current file_of_pfd_is_file' split:if_splits 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 alive_unlink:
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   143
  "valid (UnLink p f # s) \<Longrightarrow> alive (UnLink p f # s) = (
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   144
     \<lambda> obj. case obj of
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   145
              O_file f' \<Rightarrow> if (f' = f \<and> proc_fd_of_file s f = {}) then False else alive s obj
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   146
            | _ \<Rightarrow> alive s obj)"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   147
apply (frule vd_cons, frule vt_grant_os, rule ext, case_tac obj)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   148
apply (auto simp:current_files_simps current_sockets_simps is_file_simps is_dir_simps 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   149
                 is_tcp_sock_simps is_udp_sock_simps
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   150
           intro:is_tcp_in_current is_udp_in_current
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   151
            dest:is_dir_in_current file_of_pfd_is_file' file_dir_conflict 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   152
           split:if_splits option.splits)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   153
done
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   154
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   155
lemma alive_rmdir:
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   156
  "valid (Rmdir p d # s) \<Longrightarrow> alive (Rmdir p d # s) = (alive s) (O_dir d := False)"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   157
apply (frule vd_cons, frule vt_grant_os, rule ext, case_tac x)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   158
apply (auto simp:current_files_simps current_sockets_simps is_file_simps is_dir_simps 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   159
                 is_tcp_sock_simps is_udp_sock_simps dir_is_empty_def
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   160
           intro:is_tcp_in_current is_udp_in_current
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   161
            dest:is_dir_in_current file_of_pfd_is_file' file_dir_conflict 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   162
           split:if_splits option.splits)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   163
done
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   164
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   165
lemma alive_mkdir:
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   166
  "valid (Mkdir p d inum # s) \<Longrightarrow> alive (Mkdir p d inum # s) = (alive s) (O_dir d := True)"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   167
apply (frule vd_cons, frule vt_grant_os, rule ext, case_tac x)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   168
apply (auto simp:current_files_simps current_sockets_simps is_file_simps is_dir_simps 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   169
                 is_tcp_sock_simps is_udp_sock_simps dir_is_empty_def
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   170
           intro:is_tcp_in_current is_udp_in_current
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   171
            dest:is_dir_in_current file_of_pfd_is_file' is_file_in_current
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   172
           split:if_splits option.splits)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   173
done
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   174
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   175
lemma alive_linkhard:
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   176
  "valid (LinkHard p f f' # s) \<Longrightarrow> alive (LinkHard p f f' # s) = (alive s) (O_file f' := True)"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   177
apply (frule vd_cons, frule vt_grant_os, rule ext, case_tac x)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   178
apply (auto simp:current_files_simps current_sockets_simps is_file_simps is_dir_simps 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   179
                 is_tcp_sock_simps is_udp_sock_simps dir_is_empty_def
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   180
           intro:is_tcp_in_current is_udp_in_current
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   181
            dest:is_dir_in_current file_of_pfd_is_file' is_file_in_current
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   182
           split:if_splits option.splits)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   183
done
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   184
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   185
lemma alive_createmsgq:
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   186
  "valid (CreateMsgq p q # s) \<Longrightarrow> alive (CreateMsgq p q # s) = (alive s) (O_msgq q := True)"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   187
apply (frule vd_cons, frule vt_grant_os, rule ext, case_tac x)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   188
apply (auto simp:current_files_simps current_sockets_simps is_file_simps is_dir_simps
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   189
                 is_tcp_sock_simps is_udp_sock_simps dir_is_empty_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   190
done
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   191
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   192
lemma alive_sendmsg:
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   193
  "valid (SendMsg p q m # s) \<Longrightarrow> alive (SendMsg p q m # s) = (alive s) (O_msg q m := True)"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   194
apply (frule vd_cons, frule vt_grant_os, rule ext, case_tac x)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   195
apply (auto simp:current_files_simps current_sockets_simps is_file_simps is_dir_simps
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   196
                 is_tcp_sock_simps is_udp_sock_simps dir_is_empty_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   197
done
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   198
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   199
lemma alive_recvmsg:
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   200
  "valid (RecvMsg p q m # s) \<Longrightarrow> alive (RecvMsg p q m # s) = (alive s) (O_msg q m := False)"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   201
apply (frule vd_cons, frule vt_grant_os, rule ext, case_tac x)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   202
apply (auto simp:current_files_simps current_sockets_simps is_file_simps is_dir_simps
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   203
                 is_tcp_sock_simps is_udp_sock_simps dir_is_empty_def other_msg_remains
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   204
            dest:received_msg_notin)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   205
done
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   206
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   207
lemma alive_removemsgq: 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   208
  "valid (RemoveMsgq p q # s) \<Longrightarrow> alive (RemoveMsgq p q # s) = (
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   209
     \<lambda> obj. case obj of
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   210
              O_msgq q' \<Rightarrow> if (q' = q) then False else alive s obj
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   211
            | O_msg q' m \<Rightarrow> if (q' = q) then False else alive s obj
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   212
            | _ \<Rightarrow> alive s obj)"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   213
apply (frule vd_cons, frule vt_grant_os, rule ext, case_tac obj)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   214
apply (auto simp:current_files_simps current_sockets_simps is_file_simps is_dir_simps
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   215
                 is_tcp_sock_simps is_udp_sock_simps dir_is_empty_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   216
done
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   217
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   218
lemma alive_createshm:
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   219
  "valid (CreateShM p h # s) \<Longrightarrow> alive (CreateShM p h # s) = (alive s) (O_shm h := True)"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   220
apply (frule vd_cons, frule vt_grant_os, rule ext, case_tac x)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   221
apply (auto simp:current_files_simps current_sockets_simps is_file_simps is_dir_simps
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   222
                 is_tcp_sock_simps is_udp_sock_simps dir_is_empty_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   223
done
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   224
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   225
lemma alive_deleteshm:
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   226
  "valid (DeleteShM p h # s) \<Longrightarrow> alive (DeleteShM p h # s) = (alive s) (O_shm h := False)"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   227
apply (frule vd_cons, frule vt_grant_os, rule ext, case_tac x)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   228
apply (auto simp:current_files_simps current_sockets_simps is_file_simps is_dir_simps
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   229
                 is_tcp_sock_simps is_udp_sock_simps dir_is_empty_def)
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 alive_createsock:
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   233
  "valid (CreateSock p af st fd inum # s) \<Longrightarrow> alive (CreateSock p af st fd inum # s) = (
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   234
     \<lambda> obj. case obj of
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   235
              O_fd p' fd' \<Rightarrow> if (p' = p \<and> fd' = fd) then True else alive s obj
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   236
            | O_tcp_sock (p', fd') \<Rightarrow> if (p' = p \<and> fd' = fd \<and> st = STREAM) then True else alive s obj
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   237
            | O_udp_sock (p', fd') \<Rightarrow> if (p' = p \<and> fd' = fd \<and> st = DGRAM) then True else alive s obj
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   238
            | _ \<Rightarrow> alive s obj)"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   239
apply (frule vd_cons, frule vt_grant_os, rule ext, case_tac obj)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   240
apply (auto simp:current_files_simps current_sockets_simps is_file_simps is_dir_simps
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   241
                 is_tcp_sock_simps is_udp_sock_simps dir_is_empty_def
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   242
           intro:is_tcp_in_current is_udp_in_current split:t_socket_type.splits)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   243
done
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   244
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   245
lemma alive_accept:
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   246
  "valid (Accept p fd addr port fd' inum # s) \<Longrightarrow> alive (Accept p fd addr port fd' inum # s) = (
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   247
     \<lambda> obj. case obj of
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   248
              O_fd p' fd'' \<Rightarrow> if (p' = p \<and> fd'' = fd') then True else alive s obj
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   249
            | O_tcp_sock (p', fd'') \<Rightarrow> if (p' = p \<and> fd'' = fd') then True else alive s obj
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   250
            | _ \<Rightarrow> alive s obj)"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   251
apply (frule vd_cons, frule vt_grant_os, rule ext, case_tac obj)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   252
apply (auto simp:current_files_simps current_sockets_simps is_file_simps is_dir_simps
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   253
                 is_tcp_sock_simps is_udp_sock_simps dir_is_empty_def
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   254
           intro:is_tcp_in_current is_udp_in_current split:t_socket_type.splits)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   255
done
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   256
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   257
lemma alive_other:
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   258
  "\<lbrakk>valid (e # s); 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   259
    \<forall> p f flag fd opt. e \<noteq> Open p f flag fd opt;
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   260
    \<forall> p f fds. e \<noteq> Execve p f fds;
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   261
    \<forall> p p' fds shms. e \<noteq> Clone p p' fds shms;
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   262
    \<forall> p p'. e \<noteq> Kill p p';
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   263
    \<forall> p. e \<noteq> Exit p; 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   264
    \<forall> p fd. e \<noteq> CloseFd p fd;
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   265
    \<forall> p f. e \<noteq> UnLink p f;
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   266
    \<forall> p d. e \<noteq> Rmdir p d;
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   267
    \<forall> p d inum. e \<noteq> Mkdir p d inum;
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   268
    \<forall> p f f'. e \<noteq> LinkHard p f f';
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   269
    \<forall> p q. e \<noteq> CreateMsgq p q;
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   270
    \<forall> p q m. e \<noteq> SendMsg p q m;
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   271
    \<forall> p q m. e \<noteq> RecvMsg p q m;
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   272
    \<forall> p q. e \<noteq> RemoveMsgq p q;
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   273
    \<forall> p h. e \<noteq> CreateShM p h; 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   274
    \<forall> p h. e \<noteq> DeleteShM p h;
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   275
    \<forall> p af st fd inum. e \<noteq> CreateSock p af st fd inum;
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   276
    \<forall> p fd addr port fd' inum. e \<noteq> Accept p fd addr port fd' inum\<rbrakk>
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   277
   \<Longrightarrow> alive (e # s) = alive s"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   278
apply (frule vd_cons, frule vt_grant_os, rule ext, case_tac x, case_tac [!] e)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   279
apply (auto simp:current_files_simps current_sockets_simps is_file_simps is_dir_simps
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   280
                 is_tcp_sock_simps is_udp_sock_simps dir_is_empty_def
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   281
           intro:is_tcp_in_current is_udp_in_current split:t_socket_type.splits)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   282
done
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   283
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   284
lemmas alive_simps = alive_open alive_execve alive_clone alive_kill alive_exit alive_closefd alive_unlink
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   285
  alive_rmdir alive_mkdir alive_linkhard alive_createmsgq alive_removemsgq alive_createshm alive_deleteshm
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   286
  alive_createsock alive_accept alive_other alive_sendmsg alive_recvmsg
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   287
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   288
  
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   289
end
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   290
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   291
end