all_sobj_prop.thy
author chunhan
Thu, 13 Jun 2013 22:15:32 +0800
changeset 7 64b14b35454e
parent 6 4294abb1f38c
permissions -rw-r--r--
merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
dcde836219bc add thy files
chunhan
parents:
diff changeset
     1
theory all_sobj_prop
dcde836219bc add thy files
chunhan
parents:
diff changeset
     2
imports Main rc_theory os_rc obj2sobj_prop deleted_prop sound_defs_prop source_prop
dcde836219bc add thy files
chunhan
parents:
diff changeset
     3
begin
dcde836219bc add thy files
chunhan
parents:
diff changeset
     4
dcde836219bc add thy files
chunhan
parents:
diff changeset
     5
context tainting_s_complete begin
dcde836219bc add thy files
chunhan
parents:
diff changeset
     6
dcde836219bc add thy files
chunhan
parents:
diff changeset
     7
lemma initf_has_effinitialrole:
dcde836219bc add thy files
chunhan
parents:
diff changeset
     8
  "f \<in> init_files ==> \<exists> r. effinitialrole [] f = Some r"
dcde836219bc add thy files
chunhan
parents:
diff changeset
     9
by (rule_tac f = f in file_has_effinitialrole, simp, simp add:vs_nil)
dcde836219bc add thy files
chunhan
parents:
diff changeset
    10
dcde836219bc add thy files
chunhan
parents:
diff changeset
    11
lemma initf_has_effforcedrole:
dcde836219bc add thy files
chunhan
parents:
diff changeset
    12
  "f \<in> init_files ==> \<exists> r. effforcedrole [] f = Some r"
dcde836219bc add thy files
chunhan
parents:
diff changeset
    13
by (rule_tac f = f in file_has_effforcedrole, simp, simp add:vs_nil)
dcde836219bc add thy files
chunhan
parents:
diff changeset
    14
dcde836219bc add thy files
chunhan
parents:
diff changeset
    15
lemma efffrole_sdir_some:
dcde836219bc add thy files
chunhan
parents:
diff changeset
    16
  "sd \<in> init_files ==> \<exists> r. erole_functor init_file_forcedrole InheritUpMixed sd = Some r"
dcde836219bc add thy files
chunhan
parents:
diff changeset
    17
apply (frule_tac s = "[]" in undel_initf_keeps_efrole, simp, simp add:vs_nil)
dcde836219bc add thy files
chunhan
parents:
diff changeset
    18
by (drule initf_has_effforcedrole, simp)
dcde836219bc add thy files
chunhan
parents:
diff changeset
    19
dcde836219bc add thy files
chunhan
parents:
diff changeset
    20
lemma efffrole_sdir_some':
dcde836219bc add thy files
chunhan
parents:
diff changeset
    21
  "erole_functor init_file_forcedrole InheritUpMixed sd = None ==> sd \<notin> init_files"
dcde836219bc add thy files
chunhan
parents:
diff changeset
    22
by (rule notI, auto dest!:efffrole_sdir_some)
dcde836219bc add thy files
chunhan
parents:
diff changeset
    23
dcde836219bc add thy files
chunhan
parents:
diff changeset
    24
lemma effirole_sdir_some:
dcde836219bc add thy files
chunhan
parents:
diff changeset
    25
  "sd \<in> init_files ==> \<exists> r. erole_functor init_file_initialrole UseForcedRole sd = Some r"
dcde836219bc add thy files
chunhan
parents:
diff changeset
    26
apply (frule_tac s = "[]" in undel_initf_keeps_eirole, simp, simp add:vs_nil)
dcde836219bc add thy files
chunhan
parents:
diff changeset
    27
by (drule initf_has_effinitialrole, simp)
dcde836219bc add thy files
chunhan
parents:
diff changeset
    28
dcde836219bc add thy files
chunhan
parents:
diff changeset
    29
lemma effirole_sdir_some':
dcde836219bc add thy files
chunhan
parents:
diff changeset
    30
  "erole_functor init_file_initialrole UseForcedRole sd = None ==> sd \<notin> init_files"
dcde836219bc add thy files
chunhan
parents:
diff changeset
    31
by (rule notI, auto dest:effirole_sdir_some)
dcde836219bc add thy files
chunhan
parents:
diff changeset
    32
dcde836219bc add thy files
chunhan
parents:
diff changeset
    33
lemma erole_func_irole_simp:
dcde836219bc add thy files
chunhan
parents:
diff changeset
    34
  "erole_functor init_file_initialrole UseForcedRole sd = effinitialrole [] sd"
dcde836219bc add thy files
chunhan
parents:
diff changeset
    35
by (simp add:effinitialrole_def)
dcde836219bc add thy files
chunhan
parents:
diff changeset
    36
dcde836219bc add thy files
chunhan
parents:
diff changeset
    37
lemma erole_func_frole_simp:
dcde836219bc add thy files
chunhan
parents:
diff changeset
    38
  "erole_functor init_file_forcedrole InheritUpMixed sd = effforcedrole [] sd"
dcde836219bc add thy files
chunhan
parents:
diff changeset
    39
by (simp add:effforcedrole_def)
dcde836219bc add thy files
chunhan
parents:
diff changeset
    40
dcde836219bc add thy files
chunhan
parents:
diff changeset
    41
lemma init_effforcedrole_valid: "erole_functor init_file_forcedrole InheritUpMixed sd = Some r \<Longrightarrow> r = InheritUserRole \<or> r = InheritProcessRole  \<or> r = InheritUpMixed \<or> (\<exists> nr. r = NormalRole nr)"
dcde836219bc add thy files
chunhan
parents:
diff changeset
    42
by (simp add:erole_func_frole_simp, erule effforcedrole_valid)
dcde836219bc add thy files
chunhan
parents:
diff changeset
    43
dcde836219bc add thy files
chunhan
parents:
diff changeset
    44
lemma init_effinitialrole_valid: "erole_functor init_file_initialrole UseForcedRole sd = Some r \<Longrightarrow> r = UseForcedRole \<or> (\<exists> nr. r = NormalRole nr)" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
    45
by (simp add:erole_func_irole_simp, erule effinitialrole_valid)
dcde836219bc add thy files
chunhan
parents:
diff changeset
    46
dcde836219bc add thy files
chunhan
parents:
diff changeset
    47
lemma exec_role_some:
dcde836219bc add thy files
chunhan
parents:
diff changeset
    48
  "[|sd \<in> init_files; u \<in> init_users|] ==> \<exists> r'. exec_role_aux r sd u = Some r'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
    49
by (auto simp:exec_role_aux_def split:option.splits t_role.splits 
dcde836219bc add thy files
chunhan
parents:
diff changeset
    50
        dest!:effirole_sdir_some' efffrole_sdir_some'
dcde836219bc add thy files
chunhan
parents:
diff changeset
    51
        dest:init_effforcedrole_valid init_effinitialrole_valid
dcde836219bc add thy files
chunhan
parents:
diff changeset
    52
       intro:effirole_sdir_some efffrole_sdir_some user_has_normalrole)
dcde836219bc add thy files
chunhan
parents:
diff changeset
    53
dcde836219bc add thy files
chunhan
parents:
diff changeset
    54
lemma chown_role_some:
dcde836219bc add thy files
chunhan
parents:
diff changeset
    55
  "u \<in> init_users ==> \<exists> r'. chown_role_aux r fr u = Some r'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
    56
by (auto simp:chown_role_aux_def split:option.splits t_role.splits 
dcde836219bc add thy files
chunhan
parents:
diff changeset
    57
        dest!:effirole_sdir_some' efffrole_sdir_some'
dcde836219bc add thy files
chunhan
parents:
diff changeset
    58
        dest:init_effforcedrole_valid init_effinitialrole_valid
dcde836219bc add thy files
chunhan
parents:
diff changeset
    59
       intro:effirole_sdir_some efffrole_sdir_some user_has_normalrole)
dcde836219bc add thy files
chunhan
parents:
diff changeset
    60
  
dcde836219bc add thy files
chunhan
parents:
diff changeset
    61
declare obj2sobj.simps [simp del]
dcde836219bc add thy files
chunhan
parents:
diff changeset
    62
dcde836219bc add thy files
chunhan
parents:
diff changeset
    63
lemma all_sobjs_I:
dcde836219bc add thy files
chunhan
parents:
diff changeset
    64
  assumes ex: "exists s obj"
dcde836219bc add thy files
chunhan
parents:
diff changeset
    65
  and vd: "valid s"
dcde836219bc add thy files
chunhan
parents:
diff changeset
    66
  shows "obj2sobj s obj \<in> all_sobjs"
dcde836219bc add thy files
chunhan
parents:
diff changeset
    67
using ex vd
dcde836219bc add thy files
chunhan
parents:
diff changeset
    68
proof (induct s arbitrary:obj)
dcde836219bc add thy files
chunhan
parents:
diff changeset
    69
  case Nil
dcde836219bc add thy files
chunhan
parents:
diff changeset
    70
  assume ex:"exists [] obj"
dcde836219bc add thy files
chunhan
parents:
diff changeset
    71
  show ?case
dcde836219bc add thy files
chunhan
parents:
diff changeset
    72
  proof (cases obj)
dcde836219bc add thy files
chunhan
parents:
diff changeset
    73
    case (Proc p) assume prem: "obj = Proc p" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
    74
    with ex have initp:"p \<in> init_processes" by simp 
dcde836219bc add thy files
chunhan
parents:
diff changeset
    75
    from initp obtain r where "init_currentrole p = Some r" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
    76
      using init_proc_has_role by (auto simp:bidirect_in_init_def)  
dcde836219bc add thy files
chunhan
parents:
diff changeset
    77
    moreover from initp obtain t where "init_process_type p = Some t" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
    78
      using init_proc_has_type by (auto simp:bidirect_in_init_def)  
dcde836219bc add thy files
chunhan
parents:
diff changeset
    79
    moreover from initp obtain fr where "init_proc_forcedrole p = Some fr" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
    80
      using init_proc_has_frole by (auto simp:bidirect_in_init_def)  
dcde836219bc add thy files
chunhan
parents:
diff changeset
    81
    moreover from initp obtain u where "init_owner p = Some u" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
    82
      using init_proc_has_owner by (auto simp:bidirect_in_init_def)  
dcde836219bc add thy files
chunhan
parents:
diff changeset
    83
    ultimately have "obj2sobj [] (Proc p) \<in> all_sobjs" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
    84
      using initp by (auto intro!:ap_init simp:obj2sobj.simps)
dcde836219bc add thy files
chunhan
parents:
diff changeset
    85
    with prem show ?thesis by simp
dcde836219bc add thy files
chunhan
parents:
diff changeset
    86
  next
dcde836219bc add thy files
chunhan
parents:
diff changeset
    87
    case (File f) assume prem: "obj = File f"
dcde836219bc add thy files
chunhan
parents:
diff changeset
    88
    with ex have initf: "f \<in> init_files" by simp
dcde836219bc add thy files
chunhan
parents:
diff changeset
    89
    from initf obtain t where "etype_aux init_file_type_aux f = Some t" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
    90
      using init_file_has_etype by auto
dcde836219bc add thy files
chunhan
parents:
diff changeset
    91
    moreover from initf have "source_dir [] f = Some f"
dcde836219bc add thy files
chunhan
parents:
diff changeset
    92
      by (simp add:source_dir_of_init')
dcde836219bc add thy files
chunhan
parents:
diff changeset
    93
    ultimately have "obj2sobj [] (File f) \<in> all_sobjs"
dcde836219bc add thy files
chunhan
parents:
diff changeset
    94
      using initf by (auto simp:etype_of_file_def obj2sobj.simps intro!:af_init)
dcde836219bc add thy files
chunhan
parents:
diff changeset
    95
    with prem show ?thesis by simp
dcde836219bc add thy files
chunhan
parents:
diff changeset
    96
  next
dcde836219bc add thy files
chunhan
parents:
diff changeset
    97
    case (IPC i) assume prem: "obj = IPC i"
dcde836219bc add thy files
chunhan
parents:
diff changeset
    98
    with ex have initi: "i \<in> init_ipcs" by simp
dcde836219bc add thy files
chunhan
parents:
diff changeset
    99
    from initi obtain t where "init_ipc_type i = Some t" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   100
      using init_ipc_has_type by (auto simp:bidirect_in_init_def)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   101
    hence "obj2sobj [] (IPC i) \<in> all_sobjs"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   102
      using initi by (auto intro!:ai_init simp:obj2sobj.simps) 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   103
    with prem show ?thesis by simp
dcde836219bc add thy files
chunhan
parents:
diff changeset
   104
  qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
   105
next
dcde836219bc add thy files
chunhan
parents:
diff changeset
   106
  case (Cons e s)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   107
  assume prem: "\<And> obj. \<lbrakk>exists s obj; valid s\<rbrakk> \<Longrightarrow> obj2sobj s obj \<in> all_sobjs"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   108
    and ex_cons: "exists (e # s) obj" and vs_cons: "valid (e # s)"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   109
  have vs: "valid s" and rc: "rc_grant s e" and os: "os_grant s e" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   110
    using vs_cons by (auto intro:valid_cons valid_os valid_rc)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   111
  from prem and vs have prem': "\<And> obj. exists s obj \<Longrightarrow> obj2sobj s obj \<in> all_sobjs" by simp
dcde836219bc add thy files
chunhan
parents:
diff changeset
   112
  show ?case
dcde836219bc add thy files
chunhan
parents:
diff changeset
   113
  proof (cases e)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   114
    case (ChangeOwner p u)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   115
    assume ev: "e = ChangeOwner p u"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   116
    show ?thesis
dcde836219bc add thy files
chunhan
parents:
diff changeset
   117
    proof (cases "obj = Proc p")
dcde836219bc add thy files
chunhan
parents:
diff changeset
   118
      case True 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   119
      have curp: "p \<in> current_procs s" and exp: "exists s (Proc p)" using os ev by auto
dcde836219bc add thy files
chunhan
parents:
diff changeset
   120
      from curp obtain r fr t u' srp where sp: "obj2sobj s (Proc p) = SProc (r,fr,t,u') (Some srp)" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   121
        using vs apply (drule_tac current_proc_has_sobj, simp) by blast
dcde836219bc add thy files
chunhan
parents:
diff changeset
   122
      hence sp_in: "SProc (r,fr,t,u') (Some srp) \<in> all_sobjs" using prem' exp by metis
dcde836219bc add thy files
chunhan
parents:
diff changeset
   123
      have comp: "(r, Proc_type t, CHANGE_OWNER) \<in> compatible" using sp ev rc
dcde836219bc add thy files
chunhan
parents:
diff changeset
   124
        by (auto simp:obj2sobj.simps split:option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   125
      from os ev have uinit: "u \<in> init_users" by simp
dcde836219bc add thy files
chunhan
parents:
diff changeset
   126
      then obtain nr where chown: "chown_role_aux r fr u = Some nr" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   127
        by (auto dest:chown_role_some)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   128
      hence nsp_in:"obj2sobj (e#s) (Proc p) = SProc (nr,fr,chown_type_aux r nr t, u) (Some srp)" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   129
        using sp ev os
dcde836219bc add thy files
chunhan
parents:
diff changeset
   130
        by (auto split:option.splits t_role.splits 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   131
          simp del:currentrole.simps type_of_process.simps
dcde836219bc add thy files
chunhan
parents:
diff changeset
   132
          simp add:chown_role_aux_valid chown_type_aux_valid obj2sobj.simps)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   133
      thus ?thesis using True ev os rc sp_in sp
dcde836219bc add thy files
chunhan
parents:
diff changeset
   134
        by (auto simp:chown comp intro!:ap_chown[where u'=u']) 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   135
    next
dcde836219bc add thy files
chunhan
parents:
diff changeset
   136
      case False
dcde836219bc add thy files
chunhan
parents:
diff changeset
   137
      hence "obj2sobj (e#s) obj = obj2sobj s obj" using ev vs_cons
dcde836219bc add thy files
chunhan
parents:
diff changeset
   138
        by (case_tac obj, auto simp:obj2sobj.simps etype_of_file_def source_dir_simps
dcde836219bc add thy files
chunhan
parents:
diff changeset
   139
                              split:option.splits t_role.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   140
      thus ?thesis using False prem' ex_cons ev by (case_tac obj, auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   141
    qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
   142
  next
dcde836219bc add thy files
chunhan
parents:
diff changeset
   143
    case (Clone p p')
dcde836219bc add thy files
chunhan
parents:
diff changeset
   144
    assume ev: "e = Clone p p'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   145
    show ?thesis 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   146
    proof (cases "obj = Proc p'")
dcde836219bc add thy files
chunhan
parents:
diff changeset
   147
      case True
dcde836219bc add thy files
chunhan
parents:
diff changeset
   148
      from ev os have exp: "exists s (Proc p)" by (simp add:os_grant.simps)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   149
      from exp obtain r fr pt u sp where sproc: "cp2sproc s p = Some (r, fr, pt, u)"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   150
        and srp: "source_proc s p = Some sp" using vs
dcde836219bc add thy files
chunhan
parents:
diff changeset
   151
        apply (simp del:cp2sproc.simps)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   152
        by (frule current_proc_has_sproc, simp, frule current_proc_has_srp, simp, blast)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   153
      hence SP: "SProc (r,fr,pt,u) (Some sp) \<in> all_sobjs" using exp prem'[where obj = "Proc p"] vs
dcde836219bc add thy files
chunhan
parents:
diff changeset
   154
        by (auto split:option.splits simp add:obj2sobj.simps)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   155
      have "obj2sobj (e # s) (Proc p') = SProc (r,fr,clone_type_aux r pt, u) (Some sp)"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   156
        using ev sproc srp vs_cons 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   157
        by (simp add:obj2sobj.simps cp2sproc_clone del:cp2sproc.simps)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   158
      thus ?thesis using True SP by (simp add:ap_clone)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   159
    next
dcde836219bc add thy files
chunhan
parents:
diff changeset
   160
      case False
dcde836219bc add thy files
chunhan
parents:
diff changeset
   161
      hence "obj2sobj (e#s) obj = obj2sobj s obj" using ev vs_cons
dcde836219bc add thy files
chunhan
parents:
diff changeset
   162
        by (case_tac obj, auto simp:obj2sobj.simps etype_of_file_def source_dir_simps
dcde836219bc add thy files
chunhan
parents:
diff changeset
   163
                              split:option.splits t_role.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   164
      thus ?thesis using False prem' ex_cons ev by (case_tac obj, auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   165
    qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
   166
  next
dcde836219bc add thy files
chunhan
parents:
diff changeset
   167
    case (Execute p f)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   168
    assume ev: "e = Execute p f"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   169
    show ?thesis
dcde836219bc add thy files
chunhan
parents:
diff changeset
   170
    proof (cases "obj = Proc p")
dcde836219bc add thy files
chunhan
parents:
diff changeset
   171
      case True
dcde836219bc add thy files
chunhan
parents:
diff changeset
   172
      from ev os have exp: "exists s (Proc p)" and exf: "exists s (File f)" by auto
dcde836219bc add thy files
chunhan
parents:
diff changeset
   173
      from exp obtain r fr pt u sp where sproc: "cp2sproc s p = Some (r, fr, pt, u)"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   174
        and srp: "source_proc s p = Some sp" using vs
dcde836219bc add thy files
chunhan
parents:
diff changeset
   175
        apply (simp del:cp2sproc.simps)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   176
        by (frule current_proc_has_sproc, simp, frule current_proc_has_srp, simp, blast)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   177
      hence SP: "SProc (r,fr,pt,u) (Some sp) \<in> all_sobjs" using exp prem'[where obj = "Proc p"] vs
dcde836219bc add thy files
chunhan
parents:
diff changeset
   178
        by (auto split:option.splits simp add:obj2sobj.simps)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   179
      from exf obtain sd t where srdir: "source_dir s f = Some sd" and 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   180
        etype: "etype_of_file s f = Some t" using vs
dcde836219bc add thy files
chunhan
parents:
diff changeset
   181
        by (simp, drule_tac current_file_has_sd, auto dest:current_file_has_etype)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   182
      then obtain srf where SF: "SFile (t, sd) srf \<in> all_sobjs" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   183
        using exf prem'[where obj = "File f"] vs
dcde836219bc add thy files
chunhan
parents:
diff changeset
   184
        by (auto split:option.splits if_splits simp:obj2sobj.simps dest:current_file_has_etype)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   185
      from sproc srdir have "u \<in> init_users" and "sd \<in> init_files" using vs
dcde836219bc add thy files
chunhan
parents:
diff changeset
   186
        by (auto intro:source_dir_in_init owner_in_users split:option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   187
      then obtain nr where "exec_role_aux r sd u = Some nr" by (auto dest:exec_role_some) 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   188
      
dcde836219bc add thy files
chunhan
parents:
diff changeset
   189
      hence "obj2sobj (e # s) (Proc p) \<in> all_sobjs" using ev vs_cons srdir sproc srp 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   190
        apply (auto simp:obj2sobj.simps cp2sproc_simps source_proc.simps 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   191
                   intro:source_dir_in_init simp del:cp2sproc.simps 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   192
                   split:option.splits dest!:efffrole_sdir_some')
dcde836219bc add thy files
chunhan
parents:
diff changeset
   193
        apply (rule ap_exec) using SF SP rc ev etype by (auto split:option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   194
      with True show ?thesis by simp
dcde836219bc add thy files
chunhan
parents:
diff changeset
   195
    next
dcde836219bc add thy files
chunhan
parents:
diff changeset
   196
      case False
dcde836219bc add thy files
chunhan
parents:
diff changeset
   197
      hence "obj2sobj (e#s) obj = obj2sobj s obj" using ev vs_cons
dcde836219bc add thy files
chunhan
parents:
diff changeset
   198
        by (case_tac obj, auto simp:obj2sobj.simps etype_of_file_def source_dir_simps
dcde836219bc add thy files
chunhan
parents:
diff changeset
   199
                              split:option.splits t_role.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   200
      thus ?thesis using False prem' ex_cons ev by (case_tac obj, auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   201
    qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
   202
  next
dcde836219bc add thy files
chunhan
parents:
diff changeset
   203
    case (CreateFile p f)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   204
    assume ev: "e = CreateFile p f"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   205
    show ?thesis
dcde836219bc add thy files
chunhan
parents:
diff changeset
   206
    proof (cases "obj = File f")
dcde836219bc add thy files
chunhan
parents:
diff changeset
   207
      case True
dcde836219bc add thy files
chunhan
parents:
diff changeset
   208
      from os ev obtain pf where expf: "exists s (File pf)" and parent:"parent f = Some pf" by auto
dcde836219bc add thy files
chunhan
parents:
diff changeset
   209
      from expf obtain pft sd srpf where SF: "SFile (pft, sd) srpf \<in> all_sobjs"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   210
        and eptype: "etype_of_file s pf = Some pft" and srpf: "source_dir s pf = Some sd"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   211
        using prem'[where obj = "File pf"] vs
dcde836219bc add thy files
chunhan
parents:
diff changeset
   212
        by (auto split:option.splits if_splits simp:obj2sobj.simps 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   213
                  dest:current_file_has_etype current_file_has_sd)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   214
      from os ev have exp: "exists s (Proc p)" by simp
dcde836219bc add thy files
chunhan
parents:
diff changeset
   215
      then obtain r pt fr u srp where SP: "SProc (r, fr, pt, u) srp \<in> all_sobjs"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   216
        and sproc: "cp2sproc s p = Some (r, fr, pt, u)" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   217
        using prem'[where obj = "Proc p"] vs
dcde836219bc add thy files
chunhan
parents:
diff changeset
   218
        by (auto split:option.splits if_splits simp:obj2sobj.simps 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   219
                  dest:current_proc_has_sproc)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   220
      have "obj2sobj (e # s) (File f) \<in> all_sobjs" using ev vs_cons sproc srpf parent os
dcde836219bc add thy files
chunhan
parents:
diff changeset
   221
        apply (auto simp:obj2sobj.simps source_dir_simps init_notin_curf_deleted  
dcde836219bc add thy files
chunhan
parents:
diff changeset
   222
                   split:option.splits dest!:current_file_has_etype')
dcde836219bc add thy files
chunhan
parents:
diff changeset
   223
        apply (case_tac "default_fd_create_type r")
dcde836219bc add thy files
chunhan
parents:
diff changeset
   224
        using SF SP rc ev eptype sproc
dcde836219bc add thy files
chunhan
parents:
diff changeset
   225
        apply (rule_tac sf = srpf in af_cfd', auto simp:etype_of_file_def etype_aux_prop3) [1]
dcde836219bc add thy files
chunhan
parents:
diff changeset
   226
        using SF SP rc ev eptype sproc
dcde836219bc add thy files
chunhan
parents:
diff changeset
   227
        apply (rule_tac sf = srpf in af_cfd)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   228
        apply (auto simp:etype_of_file_def etype_aux_prop4)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   229
        done
dcde836219bc add thy files
chunhan
parents:
diff changeset
   230
      with True show ?thesis by simp
dcde836219bc add thy files
chunhan
parents:
diff changeset
   231
    next
dcde836219bc add thy files
chunhan
parents:
diff changeset
   232
      case False 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   233
      hence "obj2sobj (e#s) obj = obj2sobj s obj" using ev vs_cons ex_cons os vs
dcde836219bc add thy files
chunhan
parents:
diff changeset
   234
        by (case_tac obj, auto simp:obj2sobj.simps etype_of_file_def source_dir_simps etype_aux_prop2
dcde836219bc add thy files
chunhan
parents:
diff changeset
   235
                              split:option.splits t_role.splits )
dcde836219bc add thy files
chunhan
parents:
diff changeset
   236
      thus ?thesis using False prem' ex_cons ev by (case_tac obj, auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   237
    qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
   238
  next
dcde836219bc add thy files
chunhan
parents:
diff changeset
   239
    case (CreateIPC p i)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   240
    assume ev: "e = CreateIPC p i"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   241
    show ?thesis
dcde836219bc add thy files
chunhan
parents:
diff changeset
   242
    proof (cases "obj = IPC i")
dcde836219bc add thy files
chunhan
parents:
diff changeset
   243
      case True
dcde836219bc add thy files
chunhan
parents:
diff changeset
   244
      from os ev have exp: "exists s (Proc p)" by simp
dcde836219bc add thy files
chunhan
parents:
diff changeset
   245
      then obtain r pt fr u srp where SP: "SProc (r, fr, pt, u) srp \<in> all_sobjs"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   246
        and sproc: "cp2sproc s p = Some (r, fr, pt, u)" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   247
        using prem'[where obj = "Proc p"] vs
dcde836219bc add thy files
chunhan
parents:
diff changeset
   248
        by (auto split:option.splits if_splits simp:obj2sobj.simps 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   249
                  dest:current_proc_has_sproc)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   250
      have "obj2sobj (e # s) (IPC i) \<in> all_sobjs" using ev vs_cons sproc os
6
4294abb1f38c update scripts with no new_* in admissable-check
chunhan
parents: 1
diff changeset
   251
        apply (auto simp:obj2sobj.simps split:option.splits)
4294abb1f38c update scripts with no new_* in admissable-check
chunhan
parents: 1
diff changeset
   252
        apply (drule_tac obj = "IPC i" in not_deleted_imp_exists, simp+)      
4294abb1f38c update scripts with no new_* in admissable-check
chunhan
parents: 1
diff changeset
   253
        using SP sproc rc ev 
4294abb1f38c update scripts with no new_* in admissable-check
chunhan
parents: 1
diff changeset
   254
        by (auto intro:ai_cipc)
1
dcde836219bc add thy files
chunhan
parents:
diff changeset
   255
      with True show ?thesis by simp
dcde836219bc add thy files
chunhan
parents:
diff changeset
   256
    next
dcde836219bc add thy files
chunhan
parents:
diff changeset
   257
      case False 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   258
      hence "obj2sobj (e#s) obj = obj2sobj s obj" using ev vs_cons ex_cons os vs
dcde836219bc add thy files
chunhan
parents:
diff changeset
   259
        by (case_tac obj, auto simp:obj2sobj.simps etype_of_file_def source_dir_simps 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   260
                              split:option.splits t_role.splits )
dcde836219bc add thy files
chunhan
parents:
diff changeset
   261
      thus ?thesis using False prem' ex_cons ev by (case_tac obj, auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   262
    qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
   263
  next
dcde836219bc add thy files
chunhan
parents:
diff changeset
   264
    case (ChangeRole p r')
dcde836219bc add thy files
chunhan
parents:
diff changeset
   265
    assume ev: "e = ChangeRole p r'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   266
    show ?thesis
dcde836219bc add thy files
chunhan
parents:
diff changeset
   267
    proof (cases "obj = Proc p")
dcde836219bc add thy files
chunhan
parents:
diff changeset
   268
      case True
dcde836219bc add thy files
chunhan
parents:
diff changeset
   269
      from os ev have exp: "exists s (Proc p)" by simp
dcde836219bc add thy files
chunhan
parents:
diff changeset
   270
      then obtain r pt fr u srp where SP: "SProc (r, fr, pt, u) srp \<in> all_sobjs"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   271
        and sproc: "cp2sproc s p = Some (r, fr, pt, u)" and srproc: "source_proc s p = srp"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   272
        using prem'[where obj = "Proc p"] vs
dcde836219bc add thy files
chunhan
parents:
diff changeset
   273
        by (auto split:option.splits if_splits simp:obj2sobj.simps 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   274
                  dest:current_proc_has_sproc)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   275
      have "obj2sobj (e # s) (Proc p) \<in> all_sobjs" using ev vs_cons sproc os 
6
4294abb1f38c update scripts with no new_* in admissable-check
chunhan
parents: 1
diff changeset
   276
        apply (auto simp:obj2sobj.simps split:option.splits)
1
dcde836219bc add thy files
chunhan
parents:
diff changeset
   277
        apply (rule ap_crole) using SP sproc rc ev srproc by auto
dcde836219bc add thy files
chunhan
parents:
diff changeset
   278
      with True show ?thesis by simp
dcde836219bc add thy files
chunhan
parents:
diff changeset
   279
    next
dcde836219bc add thy files
chunhan
parents:
diff changeset
   280
      case False 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   281
      hence "obj2sobj (e#s) obj = obj2sobj s obj" using ev vs_cons ex_cons os vs
dcde836219bc add thy files
chunhan
parents:
diff changeset
   282
        by (case_tac obj, auto simp:obj2sobj.simps etype_of_file_def source_dir_simps 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   283
                              split:option.splits t_role.splits )
dcde836219bc add thy files
chunhan
parents:
diff changeset
   284
      thus ?thesis using False prem' ex_cons ev by (case_tac obj, auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   285
    qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
   286
  next
dcde836219bc add thy files
chunhan
parents:
diff changeset
   287
    case (ReadFile p f)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   288
    assume ev: "e = ReadFile p f"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   289
    have "obj2sobj (e#s) obj = obj2sobj s obj" using ev vs_cons ex_cons os vs
dcde836219bc add thy files
chunhan
parents:
diff changeset
   290
      by (case_tac obj, auto simp:obj2sobj.simps etype_of_file_def source_dir_simps 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   291
                            split:option.splits t_role.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   292
    moreover have "exists s obj" using ev ex_cons
dcde836219bc add thy files
chunhan
parents:
diff changeset
   293
      by (case_tac obj, auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   294
    ultimately show ?thesis using prem[where obj = obj] vs by simp
dcde836219bc add thy files
chunhan
parents:
diff changeset
   295
  next
dcde836219bc add thy files
chunhan
parents:
diff changeset
   296
    case (WriteFile p f)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   297
    assume ev: "e = WriteFile p f"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   298
    have "obj2sobj (e#s) obj = obj2sobj s obj" using ev vs_cons ex_cons os vs
dcde836219bc add thy files
chunhan
parents:
diff changeset
   299
      by (case_tac obj, auto simp:obj2sobj.simps etype_of_file_def source_dir_simps 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   300
                            split:option.splits t_role.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   301
    moreover have "exists s obj" using ev ex_cons
dcde836219bc add thy files
chunhan
parents:
diff changeset
   302
      by (case_tac obj, auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   303
    ultimately show ?thesis using prem[where obj = obj] vs by simp
dcde836219bc add thy files
chunhan
parents:
diff changeset
   304
  next
dcde836219bc add thy files
chunhan
parents:
diff changeset
   305
    case (Send p i)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   306
    assume ev: "e = Send p i"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   307
    have "obj2sobj (e#s) obj = obj2sobj s obj" using ev vs_cons ex_cons os vs
dcde836219bc add thy files
chunhan
parents:
diff changeset
   308
      by (case_tac obj, auto simp:obj2sobj.simps etype_of_file_def source_dir_simps 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   309
                            split:option.splits t_role.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   310
    moreover have "exists s obj" using ev ex_cons
dcde836219bc add thy files
chunhan
parents:
diff changeset
   311
      by (case_tac obj, auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   312
    ultimately show ?thesis using prem[where obj = obj] vs by simp
dcde836219bc add thy files
chunhan
parents:
diff changeset
   313
  next
dcde836219bc add thy files
chunhan
parents:
diff changeset
   314
    case (Recv p i)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   315
    assume ev: "e = Recv p i"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   316
    have "obj2sobj (e#s) obj = obj2sobj s obj" using ev vs_cons ex_cons os vs
dcde836219bc add thy files
chunhan
parents:
diff changeset
   317
      by (case_tac obj, auto simp:obj2sobj.simps etype_of_file_def source_dir_simps 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   318
                            split:option.splits t_role.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   319
    moreover have "exists s obj" using ev ex_cons
dcde836219bc add thy files
chunhan
parents:
diff changeset
   320
      by (case_tac obj, auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   321
    ultimately show ?thesis using prem[where obj = obj] vs by simp
dcde836219bc add thy files
chunhan
parents:
diff changeset
   322
  next
dcde836219bc add thy files
chunhan
parents:
diff changeset
   323
    case (Kill p p')
dcde836219bc add thy files
chunhan
parents:
diff changeset
   324
    assume ev: "e = Kill p p'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   325
    have "obj2sobj (e#s) obj = obj2sobj s obj" using ev vs_cons ex_cons os vs
dcde836219bc add thy files
chunhan
parents:
diff changeset
   326
      by (case_tac obj, auto simp:obj2sobj.simps etype_of_file_def source_dir_simps 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   327
                            split:option.splits t_role.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   328
    thus ?thesis using prem[where obj = obj] vs ex_cons ev
dcde836219bc add thy files
chunhan
parents:
diff changeset
   329
      by (case_tac obj, auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   330
  next
dcde836219bc add thy files
chunhan
parents:
diff changeset
   331
    case (DeleteFile p f')
dcde836219bc add thy files
chunhan
parents:
diff changeset
   332
    assume ev: "e = DeleteFile p f'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   333
    have "obj2sobj (e#s) obj = obj2sobj s obj"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   334
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
   335
      have "\<And> f. obj = File f ==> obj2sobj (e#s) (File f) = obj2sobj s (File f)"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   336
        using ev vs os ex_cons vs_cons
dcde836219bc add thy files
chunhan
parents:
diff changeset
   337
        by (auto simp:obj2sobj.simps etype_of_file_delete source_dir_simps
dcde836219bc add thy files
chunhan
parents:
diff changeset
   338
                split:option.splits t_role.splits if_splits
dcde836219bc add thy files
chunhan
parents:
diff changeset
   339
                dest!:current_file_has_etype' current_file_has_sd'
dcde836219bc add thy files
chunhan
parents:
diff changeset
   340
                 dest:source_dir_prop)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   341
      moreover have "\<forall> f. obj \<noteq> File f ==> obj2sobj (e#s) obj = obj2sobj s obj"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   342
        using ev vs_cons ex_cons os vs
dcde836219bc add thy files
chunhan
parents:
diff changeset
   343
        by (case_tac obj, auto simp:obj2sobj.simps split:option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   344
      ultimately show ?thesis by auto
dcde836219bc add thy files
chunhan
parents:
diff changeset
   345
    qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
   346
    thus ?thesis using prem[where obj = obj] vs ex_cons ev 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   347
      by (case_tac obj, auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   348
  next
dcde836219bc add thy files
chunhan
parents:
diff changeset
   349
    case (DeleteIPC p i)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   350
    assume ev: "e = DeleteIPC p i"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   351
    have "obj2sobj (e#s) obj = obj2sobj s obj" using ev vs_cons ex_cons os vs
dcde836219bc add thy files
chunhan
parents:
diff changeset
   352
      by (case_tac obj, auto simp:obj2sobj.simps etype_of_file_def source_dir_simps 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   353
                            split:option.splits t_role.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   354
    thus ?thesis using prem[where obj = obj] vs ex_cons ev
dcde836219bc add thy files
chunhan
parents:
diff changeset
   355
      by (case_tac obj, auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   356
  qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
   357
qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
   358
dcde836219bc add thy files
chunhan
parents:
diff changeset
   359
declare obj2sobj.simps [simp add]
dcde836219bc add thy files
chunhan
parents:
diff changeset
   360
dcde836219bc add thy files
chunhan
parents:
diff changeset
   361
lemma seeds_in_all_sobjs: 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   362
  assumes seed: "obj \<in> seeds" shows "init_obj2sobj obj \<in> all_sobjs"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   363
proof (cases obj)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   364
  case (Proc p)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   365
  assume p0: "obj = Proc p" (*?*)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   366
  from seed p0 have pinit: "p \<in> init_processes" by (drule_tac seeds_in_init, simp)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   367
  from pinit obtain r where "init_currentrole p = Some r" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   368
    using init_proc_has_role by (auto simp:bidirect_in_init_def)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   369
  moreover from pinit obtain fr where "init_proc_forcedrole p = Some fr"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   370
    using init_proc_has_frole by (auto simp:bidirect_in_init_def)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   371
  moreover from pinit obtain pt where "init_process_type p = Some pt"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   372
    using init_proc_has_type by (auto simp:bidirect_in_init_def)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   373
  moreover from pinit obtain u where "init_owner p = Some u"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   374
    using init_proc_has_owner by (auto simp:bidirect_in_init_def)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   375
  ultimately show ?thesis using p0 by (auto intro:ap_init)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   376
next
dcde836219bc add thy files
chunhan
parents:
diff changeset
   377
  case (File f) 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   378
  assume p0: "obj = File f" (*?*)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   379
  from seed p0 have finit: "f \<in> init_files" by (drule_tac seeds_in_init, simp)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   380
  then obtain t where "etype_aux init_file_type_aux f = Some t"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   381
    by (auto dest:init_file_has_etype)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   382
  with finit p0 show ?thesis by (auto intro:af_init)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   383
next
dcde836219bc add thy files
chunhan
parents:
diff changeset
   384
  case (IPC i)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   385
  assume p0: "obj = IPC i" (*?*)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   386
  from seed p0 have iinit: "i \<in> init_ipcs" by (drule_tac seeds_in_init, simp)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   387
  then obtain t where "init_ipc_type i = Some t" using init_ipc_has_type
dcde836219bc add thy files
chunhan
parents:
diff changeset
   388
    by (auto simp:bidirect_in_init_def)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   389
  with iinit p0 show ?thesis by (auto intro:ai_init)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   390
qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
   391
dcde836219bc add thy files
chunhan
parents:
diff changeset
   392
lemma tainted_s_in_all_sobjs:
dcde836219bc add thy files
chunhan
parents:
diff changeset
   393
  "sobj \<in> tainted_s \<Longrightarrow> sobj \<in> all_sobjs"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   394
apply (erule tainted_s.induct)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   395
apply (erule seeds_in_all_sobjs)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   396
apply (auto intro:ap_crole ap_exec ap_chown ai_cipc af_cfd af_cfd' ap_clone)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   397
done
dcde836219bc add thy files
chunhan
parents:
diff changeset
   398
dcde836219bc add thy files
chunhan
parents:
diff changeset
   399
end
dcde836219bc add thy files
chunhan
parents:
diff changeset
   400
dcde836219bc add thy files
chunhan
parents:
diff changeset
   401
context tainting_s_sound begin
dcde836219bc add thy files
chunhan
parents:
diff changeset
   402
dcde836219bc add thy files
chunhan
parents:
diff changeset
   403
(*** all_sobjs' equal with all_sobjs in the view of soundness ***)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   404
dcde836219bc add thy files
chunhan
parents:
diff changeset
   405
lemma all_sobjs'_eq1: "sobj \<in> all_sobjs \<Longrightarrow> sobj \<in> all_sobjs'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   406
apply (erule all_sobjs.induct)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   407
apply (auto intro:af'_init af'_cfd af'_cfd' ai'_init ai'_cipc ap'_init ap'_crole ap'_exec ap'_chown)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   408
by (simp add:clone_type_aux_def clone_type_unchange)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   409
dcde836219bc add thy files
chunhan
parents:
diff changeset
   410
lemma all_sobjs'_eq2: "sobj \<in> all_sobjs' \<Longrightarrow> sobj \<in> all_sobjs"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   411
apply (erule all_sobjs'.induct)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   412
by (auto intro:af_init af_cfd af_cfd' ai_init ai_cipc ap_init ap_crole ap_exec ap_chown)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   413
dcde836219bc add thy files
chunhan
parents:
diff changeset
   414
lemma all_sobjs'_eq: "(sobj \<in> all_sobjs) = (sobj \<in> all_sobjs')"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   415
by (auto intro:iffI all_sobjs'_eq1 all_sobjs'_eq2)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   416
dcde836219bc add thy files
chunhan
parents:
diff changeset
   417
(************************ all_sobjs Elim Rules ********************)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   418
dcde836219bc add thy files
chunhan
parents:
diff changeset
   419
declare obj2sobj.simps [simp del]
dcde836219bc add thy files
chunhan
parents:
diff changeset
   420
declare cp2sproc.simps [simp del]
dcde836219bc add thy files
chunhan
parents:
diff changeset
   421
dcde836219bc add thy files
chunhan
parents:
diff changeset
   422
lemma all_sobjs_E0_aux[rule_format]:
dcde836219bc add thy files
chunhan
parents:
diff changeset
   423
  "sobj \<in> all_sobjs' \<Longrightarrow> (\<forall> s' obj' sobj'. valid s' \<and> obj2sobj s' obj' = sobj' \<and> exists s' obj' \<and> sobj' \<noteq> Unknown \<and> no_del_event s' \<and> initp_intact s' \<longrightarrow> (\<exists> s obj. valid (s @ s') \<and> obj2sobj (s @ s') obj' = sobj' \<and> exists (s @ s') obj' \<and> no_del_event (s @ s') \<and> initp_intact (s @ s') \<and> obj2sobj (s @ s') obj = sobj \<and> exists (s @ s') obj))"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   424
proof (induct rule:all_sobjs'.induct)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   425
  case (af'_init f t) show ?case
dcde836219bc add thy files
chunhan
parents:
diff changeset
   426
  proof (rule allI|rule impI|erule conjE)+
dcde836219bc add thy files
chunhan
parents:
diff changeset
   427
    fix s' obj' sobj'
dcde836219bc add thy files
chunhan
parents:
diff changeset
   428
    assume vss': "valid s'" and sobjs': "obj2sobj s' obj' = sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   429
      and nodels': "no_del_event s'"and intacts':"initp_intact s'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   430
      and exso': "exists s' obj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   431
    from nodels' af'_init(1) have exf: "f \<in> current_files s'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   432
      by (drule_tac obj = "File f" in nodel_imp_exists, simp+)    
dcde836219bc add thy files
chunhan
parents:
diff changeset
   433
    have "obj2sobj s' (File f) = SFile (t, f) (Some f)"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   434
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
   435
      have "obj2sobj [] (File f) = SFile (t, f) (Some f)"  using af'_init 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   436
        by (auto simp:etype_of_file_def source_dir_of_init' obj2sobj.simps
dcde836219bc add thy files
chunhan
parents:
diff changeset
   437
                split:option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   438
      thus ?thesis using vss' exf nodels' af'_init(1) 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   439
        by (drule_tac obj2sobj_file_remains_app', auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   440
    qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
   441
    thus "\<exists>s obj. valid (s @ s') \<and> obj2sobj (s @ s') obj' = sobj' \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
   442
             exists (s @ s') obj' \<and> no_del_event (s @ s') \<and> initp_intact (s @ s') \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
   443
             obj2sobj (s @ s') obj = SFile (t, f) (Some f) \<and> exists (s @ s') obj"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   444
      apply (rule_tac x = "[]" in exI, rule_tac x = "File f" in exI)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   445
      by (simp add:vss' sobjs' nodels' intacts' exf exso')
dcde836219bc add thy files
chunhan
parents:
diff changeset
   446
  qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
   447
next
dcde836219bc add thy files
chunhan
parents:
diff changeset
   448
  case (af'_cfd t sd srf r fr pt u srp t') 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   449
  show ?case 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   450
  proof (rule allI|rule impI|erule conjE)+
dcde836219bc add thy files
chunhan
parents:
diff changeset
   451
    fix s' obj' sobj'
dcde836219bc add thy files
chunhan
parents:
diff changeset
   452
    assume "valid s'" and "obj2sobj s' obj' = sobj'" and "no_del_event s'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   453
      and "initp_intact s'" and notUkn: "sobj' \<noteq> Unknown" and exobj':"exists s' obj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   454
    with af'_cfd(1,2) obtain sa pf where
dcde836219bc add thy files
chunhan
parents:
diff changeset
   455
      "valid (sa@s')" and "obj2sobj (sa@s') obj'=sobj' \<and> no_del_event (sa@s')" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
   456
      "exists (sa@s') obj'" and "initp_intact (sa@s')" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
   457
      SFa: "obj2sobj (sa@s') (File pf) = SFile (t, sd) srf" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
   458
      exfa: "pf \<in> current_files (sa@s')" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   459
      apply (erule_tac x = s' in allE, erule_tac x = obj' in allE, auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   460
      by (frule obj2sobj_file, auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   461
    with af'_cfd(3,4) notUkn obtain sb p where
dcde836219bc add thy files
chunhan
parents:
diff changeset
   462
      SPab: "obj2sobj (sb@sa@s') (Proc p) = SProc (r,fr,pt,u) srp" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
   463
      expab: "exists (sb@sa@s') (Proc p)" and vsab: "valid (sb@sa@s')" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
   464
      soab: "obj2sobj (sb@sa@s') obj' = sobj'" and 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   465
      exsoab: "exists (sb@sa@s') obj'" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
   466
      intactab: "initp_intact (sb@sa@s')" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
   467
      nodelab: "no_del_event (sb@sa@s')"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   468
      by (blast dest:obj2sobj_proc intro:nodel_exists_remains)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   469
    from exfa nodelab have exf:"pf \<in> current_files (sb@sa@s')"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   470
      apply (drule_tac obj = "File pf" in nodel_imp_un_deleted)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   471
      by (drule_tac s' = "sb" in not_deleted_imp_exists', auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   472
    from SFa vsab exfa nodelab have SFab: "obj2sobj (sb@sa@s') (File pf) = SFile (t,sd) srf"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   473
      by (rule_tac s = "sa@s'" in obj2sobj_file_remains_app', simp_all)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   474
    obtain e \<tau> where ev: "e = CreateFile p (new_childf pf \<tau>)" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   475
      and tau: "\<tau>=sb@sa@s'" by auto
dcde836219bc add thy files
chunhan
parents:
diff changeset
   476
    
dcde836219bc add thy files
chunhan
parents:
diff changeset
   477
    have valid: "valid (e # \<tau>)" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   478
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
   479
      have "os_grant \<tau> e"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   480
        using ev tau expab exf by (simp add:ncf_notin_curf ncf_parent)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   481
      moreover have "rc_grant \<tau> e" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   482
        using ev tau af'_cfd(5,6,7) SPab SFab
dcde836219bc add thy files
chunhan
parents:
diff changeset
   483
        by (auto simp:etype_of_file_def cp2sproc.simps ncf_parent obj2sobj.simps
dcde836219bc add thy files
chunhan
parents:
diff changeset
   484
                split:if_splits option.splits t_rc_file_type.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   485
      ultimately show ?thesis using vsab tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
   486
        by (rule_tac vs_step, simp+)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   487
    qed  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
   488
    have nodel: "no_del_event (e#\<tau>)" using nodelab tau ev by simp  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
   489
    have exobj': "exists (e#\<tau>) obj'" using exsoab valid ev tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
   490
        by (case_tac obj', simp+)   moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
   491
    have "obj2sobj (e#\<tau>) obj' = sobj'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   492
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
   493
      have "\<And> f. obj' = File f \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   494
        using soab tau valid notUkn nodel ev exsoab
dcde836219bc add thy files
chunhan
parents:
diff changeset
   495
        by (auto intro!:obj2sobj_file_remains' simp:ncf_notin_curf)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   496
      moreover have "\<And> i. obj' = IPC i \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'"  
dcde836219bc add thy files
chunhan
parents:
diff changeset
   497
        using soab tau valid notUkn nodel ev exsoab
dcde836219bc add thy files
chunhan
parents:
diff changeset
   498
        by (auto intro!:obj2sobj_ipc_remains' simp:ncf_notin_curf)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   499
      moreover have "\<And> p. obj' = Proc p \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'"  
dcde836219bc add thy files
chunhan
parents:
diff changeset
   500
        using soab tau valid notUkn nodel ev exsoab
dcde836219bc add thy files
chunhan
parents:
diff changeset
   501
        by (auto simp:obj2sobj.simps cp2sproc_simps 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   502
             simp del:cp2sproc.simps split:option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   503
      ultimately show ?thesis by (case_tac obj', auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   504
    qed  moreover 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   505
    have "initp_intact (e#\<tau>)" using intactab tau ev valid nodel
dcde836219bc add thy files
chunhan
parents:
diff changeset
   506
      by (simp_all add:initp_intact_I_others)  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
   507
    have "obj2sobj (e#\<tau>) (File (new_childf pf \<tau>)) = SFile (t', sd) None"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   508
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
   509
      have "etype_of_file (e#\<tau>) (new_childf pf \<tau>) = Some t'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   510
        using ev tau SFab SPab af'_cfd(5)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   511
        by (auto simp:obj2sobj.simps cp2sproc.simps etype_of_file_def
dcde836219bc add thy files
chunhan
parents:
diff changeset
   512
          split:option.splits if_splits  intro!:etype_aux_prop4)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   513
      moreover have "source_dir (e#\<tau>) (new_childf pf \<tau>) = Some sd"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   514
        using ev tau SFab SPab valid ncf_parent
dcde836219bc add thy files
chunhan
parents:
diff changeset
   515
        by (auto simp:source_dir_simps obj2sobj.simps 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   516
                split:if_splits option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   517
      ultimately show ?thesis  using nodel ncf_notin_curf[where s = \<tau>]
dcde836219bc add thy files
chunhan
parents:
diff changeset
   518
        nodel_imp_exists[where obj = "File (new_childf pf \<tau>)" and s =\<tau>]
dcde836219bc add thy files
chunhan
parents:
diff changeset
   519
        by (auto simp:obj2sobj.simps dest:no_del_event_cons_D)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   520
    qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
   521
    ultimately show "\<exists>s obj. valid (s @ s') \<and> obj2sobj (s @ s') obj' = sobj' \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
   522
      exists (s @ s') obj' \<and> no_del_event (s @ s') \<and> initp_intact (s @ s') \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
   523
      obj2sobj (s @ s') obj = SFile (t', sd) None \<and> exists (s @ s') obj "
dcde836219bc add thy files
chunhan
parents:
diff changeset
   524
      using tau ev
dcde836219bc add thy files
chunhan
parents:
diff changeset
   525
      by (rule_tac x = "e#sb@sa" in exI, rule_tac x = "File (new_childf pf \<tau>)" in exI, simp+)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   526
  qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
   527
next
dcde836219bc add thy files
chunhan
parents:
diff changeset
   528
  case (af'_cfd' t sd srf r fr pt u srp)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   529
  show ?case 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   530
  proof (rule allI|rule impI|erule conjE)+
dcde836219bc add thy files
chunhan
parents:
diff changeset
   531
    fix s' obj' sobj'
dcde836219bc add thy files
chunhan
parents:
diff changeset
   532
    assume "valid s'" and "obj2sobj s' obj' = sobj'" and "no_del_event s'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   533
      and "initp_intact s'" and notUkn: "sobj' \<noteq> Unknown" and exobj':"exists s' obj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   534
    with af'_cfd'(1,2) obtain sa pf where
dcde836219bc add thy files
chunhan
parents:
diff changeset
   535
      "valid (sa@s')" and "obj2sobj (sa@s') obj'=sobj' \<and> no_del_event (sa@s')" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
   536
      "exists (sa@s') obj'" and "initp_intact (sa@s')" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
   537
      SFa: "obj2sobj (sa@s') (File pf) = SFile (t, sd) srf" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
   538
      exfa: "pf \<in> current_files (sa@s')" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   539
      apply (erule_tac x = s' in allE, erule_tac x = obj' in allE, auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   540
      by (frule obj2sobj_file, auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   541
    with af'_cfd'(3,4) notUkn obtain sb p where
dcde836219bc add thy files
chunhan
parents:
diff changeset
   542
      SPab: "obj2sobj (sb@sa@s') (Proc p) = SProc (r,fr,pt,u) srp" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
   543
      expab: "exists (sb@sa@s') (Proc p)" and vsab: "valid (sb@sa@s')" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
   544
      soab: "obj2sobj (sb@sa@s') obj' = sobj'" and 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   545
      exsoab: "exists (sb@sa@s') obj'" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
   546
      intactab: "initp_intact (sb@sa@s')" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
   547
      nodelab: "no_del_event (sb@sa@s')"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   548
      by (blast dest:obj2sobj_proc intro:nodel_exists_remains)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   549
    from exfa nodelab have exf:"pf \<in> current_files (sb@sa@s')"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   550
      apply (drule_tac obj = "File pf" in nodel_imp_un_deleted)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   551
      by (drule_tac s' = "sb" in not_deleted_imp_exists', auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   552
    from SFa vsab exfa nodelab have SFab: "obj2sobj (sb@sa@s') (File pf) = SFile (t,sd) srf"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   553
      by (rule_tac s = "sa@s'" in obj2sobj_file_remains_app', simp_all)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   554
    obtain e \<tau> where ev: "e = CreateFile p (new_childf pf \<tau>)" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   555
      and tau: "\<tau>=sb@sa@s'" by auto
dcde836219bc add thy files
chunhan
parents:
diff changeset
   556
    
dcde836219bc add thy files
chunhan
parents:
diff changeset
   557
    have valid: "valid (e # \<tau>)" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   558
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
   559
      have "os_grant \<tau> e"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   560
        using ev tau expab exf by (simp add:ncf_notin_curf ncf_parent)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   561
      moreover have "rc_grant \<tau> e" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   562
        using ev tau af'_cfd'(5,6) SPab SFab
dcde836219bc add thy files
chunhan
parents:
diff changeset
   563
        by (auto simp:etype_of_file_def cp2sproc.simps ncf_parent obj2sobj.simps
dcde836219bc add thy files
chunhan
parents:
diff changeset
   564
                split:if_splits option.splits t_rc_file_type.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   565
      ultimately show ?thesis using vsab tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
   566
        by (rule_tac vs_step, simp+)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   567
    qed  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
   568
    have nodel: "no_del_event (e#\<tau>)" using nodelab tau ev by simp  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
   569
    have exobj': "exists (e#\<tau>) obj'" using exsoab valid ev tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
   570
        by (case_tac obj', simp+)   moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
   571
    have "obj2sobj (e#\<tau>) obj' = sobj'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   572
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
   573
      have "\<And> f. obj' = File f \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   574
        using soab tau valid notUkn nodel ev exsoab
dcde836219bc add thy files
chunhan
parents:
diff changeset
   575
        by (auto  intro!:obj2sobj_file_remains' simp:ncf_notin_curf)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   576
      moreover have "\<And> i. obj' = IPC i \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'"  
dcde836219bc add thy files
chunhan
parents:
diff changeset
   577
        using soab tau valid notUkn nodel ev exsoab
dcde836219bc add thy files
chunhan
parents:
diff changeset
   578
        by (auto intro!:obj2sobj_ipc_remains' simp:ncf_notin_curf)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   579
      moreover have "\<And> p. obj' = Proc p \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'"  
dcde836219bc add thy files
chunhan
parents:
diff changeset
   580
        using soab tau valid notUkn nodel ev exsoab
dcde836219bc add thy files
chunhan
parents:
diff changeset
   581
        by (auto simp:obj2sobj.simps cp2sproc_simps 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   582
             simp del:cp2sproc.simps split:option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   583
      ultimately show ?thesis by (case_tac obj', auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   584
    qed  moreover 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   585
    have "initp_intact (e#\<tau>)" using intactab tau ev valid nodel
dcde836219bc add thy files
chunhan
parents:
diff changeset
   586
      by (simp add:initp_intact_I_others)  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
   587
    have "obj2sobj (e#\<tau>) (File (new_childf pf \<tau>)) = SFile (t, sd) None"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   588
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
   589
      have "etype_of_file (e#\<tau>) (new_childf pf \<tau>) = Some t"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   590
      proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
   591
        have "etype_of_file (e#\<tau>) (new_childf pf \<tau>) = etype_of_file \<tau> pf"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   592
          using ev tau SPab af'_cfd'(5) 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   593
          by (auto simp:obj2sobj.simps ncf_parent etype_of_file_def cp2sproc.simps
dcde836219bc add thy files
chunhan
parents:
diff changeset
   594
            split:option.splits   intro!:etype_aux_prop3)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   595
        thus ?thesis using SFab tau ev
dcde836219bc add thy files
chunhan
parents:
diff changeset
   596
          by (auto simp:obj2sobj.simps split:option.splits if_splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   597
      qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
   598
      moreover have "source_dir (e#\<tau>) (new_childf pf \<tau>) = Some sd"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   599
        using ev tau SFab SPab valid ncf_parent
dcde836219bc add thy files
chunhan
parents:
diff changeset
   600
        by (auto simp:source_dir_simps obj2sobj.simps 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   601
                split:if_splits option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   602
      ultimately show ?thesis  using nodel ncf_notin_curf[where s = \<tau>]
dcde836219bc add thy files
chunhan
parents:
diff changeset
   603
        nodel_imp_exists[where obj = "File (new_childf pf \<tau>)" and s =\<tau>]
dcde836219bc add thy files
chunhan
parents:
diff changeset
   604
        by (auto simp:obj2sobj.simps dest:no_del_event_cons_D)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   605
    qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
   606
    ultimately show "\<exists>s obj. valid (s @ s') \<and> obj2sobj (s @ s') obj' = sobj' \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
   607
      exists (s @ s') obj' \<and> no_del_event (s @ s') \<and> initp_intact (s @ s') \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
   608
      obj2sobj (s @ s') obj = SFile (t, sd) None \<and> exists (s @ s') obj"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   609
      using tau ev
dcde836219bc add thy files
chunhan
parents:
diff changeset
   610
      by (rule_tac x = "e#sb@sa" in exI, rule_tac x = "File (new_childf pf \<tau>)" in exI, simp+)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   611
  qed 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   612
next
dcde836219bc add thy files
chunhan
parents:
diff changeset
   613
  case (ai'_init i t) 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   614
  hence initi: "i \<in> init_ipcs" using init_ipc_has_type
dcde836219bc add thy files
chunhan
parents:
diff changeset
   615
    by (simp add:bidirect_in_init_def)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   616
  show ?case 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   617
  proof (rule allI|rule impI|erule conjE)+
dcde836219bc add thy files
chunhan
parents:
diff changeset
   618
    fix s' obj' sobj'
dcde836219bc add thy files
chunhan
parents:
diff changeset
   619
    assume vss': "valid s'" and sobjs': "obj2sobj s' obj' = sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   620
      and nodels': "no_del_event s'"and intacts':"initp_intact s'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   621
      and exso': "exists s' obj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   622
    from nodels' initi have exi: "i \<in> current_ipcs s'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   623
      by (drule_tac obj = "IPC i" in nodel_imp_exists, simp+)    
dcde836219bc add thy files
chunhan
parents:
diff changeset
   624
    have "obj2sobj s' (IPC i) = SIPC t (Some i)"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   625
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
   626
      have "obj2sobj [] (IPC i) = SIPC t (Some i)"  
dcde836219bc add thy files
chunhan
parents:
diff changeset
   627
        using ai'_init initi by (auto simp:obj2sobj.simps)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   628
      thus ?thesis using vss' exi nodels' initi 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   629
        by (drule_tac obj2sobj_ipc_remains'', auto simp:obj2sobj.simps)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   630
    qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
   631
    thus "\<exists>s obj. valid (s @ s') \<and> obj2sobj (s @ s') obj' = sobj' \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
   632
             exists (s @ s') obj' \<and> no_del_event (s @ s') \<and> initp_intact (s @ s') \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
   633
             obj2sobj (s @ s') obj = SIPC t (Some i) \<and> exists (s @ s') obj"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   634
      apply (rule_tac x = "[]" in exI, rule_tac x = "IPC i" in exI)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   635
      by (simp add:vss' sobjs' nodels' exi exso' intacts' del:obj2sobj.simps)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   636
  qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
   637
next
dcde836219bc add thy files
chunhan
parents:
diff changeset
   638
  case (ai'_cipc r fr pt u srp)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   639
  show ?case
dcde836219bc add thy files
chunhan
parents:
diff changeset
   640
  proof (rule allI|rule impI|erule conjE)+
dcde836219bc add thy files
chunhan
parents:
diff changeset
   641
    fix s' obj' sobj'
dcde836219bc add thy files
chunhan
parents:
diff changeset
   642
    assume "valid s'" and "obj2sobj s' obj' = sobj'" and "no_del_event s'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   643
      and "initp_intact s'" and notUkn: "sobj' \<noteq> Unknown" and exobj':"exists s' obj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   644
    with ai'_cipc(1,2) notUkn obtain s p where
dcde836219bc add thy files
chunhan
parents:
diff changeset
   645
      SPab: "obj2sobj (s@s') (Proc p) = SProc (r,fr,pt,u) srp" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
   646
      expab: "exists (s@s') (Proc p)" and vsab: "valid (s@s')" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
   647
      soab: "obj2sobj (s@s') obj' = sobj'" and 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   648
      exsoab: "exists (s@s') obj'" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
   649
      intactab: "initp_intact (s@s')" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
   650
      nodelab: "no_del_event (s@s')"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   651
      by (blast dest:obj2sobj_proc intro:nodel_exists_remains)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   652
    obtain e \<tau> where ev: "e = CreateIPC p (new_ipc \<tau>)" and tau: "\<tau>=s@s'" by auto
dcde836219bc add thy files
chunhan
parents:
diff changeset
   653
    
dcde836219bc add thy files
chunhan
parents:
diff changeset
   654
    have valid: "valid (e # \<tau>)" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   655
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
   656
      have "os_grant \<tau> e"
6
4294abb1f38c update scripts with no new_* in admissable-check
chunhan
parents: 1
diff changeset
   657
        using ev tau expab by (simp add:ni_notin_curi)
1
dcde836219bc add thy files
chunhan
parents:
diff changeset
   658
      moreover have "rc_grant \<tau> e" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   659
        using ev tau ai'_cipc(3) SPab
dcde836219bc add thy files
chunhan
parents:
diff changeset
   660
        by (auto simp:cp2sproc.simps obj2sobj.simps split:option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   661
      ultimately show ?thesis using vsab tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
   662
        by (rule_tac vs_step, simp+)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   663
    qed  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
   664
    have nodel: "no_del_event (e#\<tau>)" using nodelab tau ev by simp  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
   665
    have exobj': "exists (e#\<tau>) obj'" using exsoab valid ev tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
   666
        by (case_tac obj', simp+)   moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
   667
    have "obj2sobj (e#\<tau>) obj' = sobj'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   668
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
   669
      have "\<And> f. obj' = File f \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   670
        using soab tau valid notUkn nodel ev exsoab
dcde836219bc add thy files
chunhan
parents:
diff changeset
   671
        by (auto  intro!:obj2sobj_file_remains' simp:ncf_notin_curf)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   672
      moreover have "\<And> i. obj' = IPC i \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'"  
dcde836219bc add thy files
chunhan
parents:
diff changeset
   673
        using soab tau valid notUkn nodel ev exsoab
dcde836219bc add thy files
chunhan
parents:
diff changeset
   674
        by (auto intro!:obj2sobj_ipc_remains' simp:ncf_notin_curf)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   675
      moreover have "\<And> p. obj' = Proc p \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'"  
dcde836219bc add thy files
chunhan
parents:
diff changeset
   676
        using soab tau valid notUkn nodel ev exsoab
dcde836219bc add thy files
chunhan
parents:
diff changeset
   677
        by (auto simp:obj2sobj.simps cp2sproc_simps 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   678
             simp del:cp2sproc.simps split:option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   679
      ultimately show ?thesis by (case_tac obj', auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   680
    qed  moreover 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   681
    have "initp_intact (e#\<tau>)" using intactab tau ev valid nodel
dcde836219bc add thy files
chunhan
parents:
diff changeset
   682
      by (simp add:initp_intact_I_others)  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
   683
    have "obj2sobj (e#\<tau>) (IPC (new_ipc \<tau>)) = SIPC (default_ipc_create_type r) None"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   684
      using ev tau SPab nodel 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   685
        nodel_imp_exists[where obj = "IPC (new_ipc \<tau>)" and s =\<tau>]
dcde836219bc add thy files
chunhan
parents:
diff changeset
   686
      by (auto simp:obj2sobj.simps ni_notin_curi cp2sproc.simps 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   687
              split:option.splits  dest:no_del_event_cons_D)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   688
    ultimately show "\<exists>s obj. valid (s @ s') \<and> obj2sobj (s @ s') obj' = sobj' \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
   689
      exists (s @ s') obj' \<and> no_del_event (s @ s') \<and> initp_intact (s @ s') \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
   690
      obj2sobj (s @ s') obj = SIPC (default_ipc_create_type r) None \<and> exists (s @ s') obj"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   691
      using tau ev
dcde836219bc add thy files
chunhan
parents:
diff changeset
   692
      by (rule_tac x = "e#s" in exI, rule_tac x = "IPC (new_ipc \<tau>)" in exI, simp+)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   693
  qed 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   694
next
dcde836219bc add thy files
chunhan
parents:
diff changeset
   695
  case (ap'_init p r fr t u)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   696
  hence initp: "p \<in> init_processes" using init_proc_has_role
dcde836219bc add thy files
chunhan
parents:
diff changeset
   697
    by (simp add:bidirect_in_init_def)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   698
  show ?case
dcde836219bc add thy files
chunhan
parents:
diff changeset
   699
  proof (rule allI|rule impI|erule conjE)+
dcde836219bc add thy files
chunhan
parents:
diff changeset
   700
    fix s' obj' sobj'
dcde836219bc add thy files
chunhan
parents:
diff changeset
   701
    assume VSs': "valid s'" and SOs': "obj2sobj s' obj' = sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   702
      and Nodels': "no_del_event s'"and Intacts':"initp_intact s'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   703
      and exso': "exists s' obj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   704
    from Nodels' initp have exp: "p \<in> current_procs s'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   705
      apply (drule_tac obj = "Proc p" in nodel_imp_un_deleted)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   706
      by (drule not_deleted_imp_exists, simp+)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   707
    with Intacts' initp ap'_init have "obj2sobj s' (Proc p) = SProc (r, fr, t, u) (Some p)"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   708
      by (auto simp:initp_intact_def split:option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   709
    thus "\<exists>s obj. valid (s @ s') \<and> obj2sobj (s @ s') obj' = sobj' \<and> 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   710
             exists (s @ s') obj' \<and> no_del_event (s @ s') \<and> initp_intact (s @ s') \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
   711
             obj2sobj (s @ s') obj = SProc (r, fr, t, u) (Some p) \<and> exists (s @ s') obj"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   712
      apply (rule_tac x = "[]" in exI, rule_tac x = "Proc p" in exI)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   713
      by (simp add:VSs' SOs' Nodels' exp exso' initp intact_imp_butp Intacts'
dcde836219bc add thy files
chunhan
parents:
diff changeset
   714
               del:obj2sobj.simps)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   715
  qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
   716
next
dcde836219bc add thy files
chunhan
parents:
diff changeset
   717
  case (ap'_crole r fr t u srp r')
dcde836219bc add thy files
chunhan
parents:
diff changeset
   718
  show ?case 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   719
  proof (rule allI|rule impI|erule conjE)+
dcde836219bc add thy files
chunhan
parents:
diff changeset
   720
    fix s' obj' sobj'
dcde836219bc add thy files
chunhan
parents:
diff changeset
   721
    assume "valid s'" and "obj2sobj s' obj' = sobj'" and "no_del_event s'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   722
      and "initp_intact s'" and notUkn: "sobj' \<noteq> Unknown" and "exists s' obj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   723
    with ap'_crole(1,2) obtain s p where
dcde836219bc add thy files
chunhan
parents:
diff changeset
   724
      VSab: "valid (s@s')" and SOab': "obj2sobj (s@s') obj' = sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   725
      and nodelab: "no_del_event (s@s')"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   726
      and intactab: "initp_intact (s@s')"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   727
      and SPab: "obj2sobj (s@s') (Proc p) = SProc (r, fr, t, u) srp"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   728
      and exp:"exists (s@s') (Proc p)" and exobj'ab:"exists (s@s') obj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   729
      by (blast dest:obj2sobj_proc intro:nodel_exists_remains)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   730
    obtain e \<tau> where ev: "e = ChangeRole (new_proc (s@s')) r'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   731
      and tau: "\<tau> = Clone p (new_proc (s@s'))#s@s'" by auto
dcde836219bc add thy files
chunhan
parents:
diff changeset
   732
    hence vs_tau:"valid \<tau>" using exp VSab by (auto intro:clone_event_no_limit)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   733
dcde836219bc add thy files
chunhan
parents:
diff changeset
   734
    have valid: "valid (e#\<tau>)" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   735
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
   736
      have "os_grant \<tau> e"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   737
        using ev tau exp by (simp)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   738
      moreover have "rc_grant \<tau> e" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   739
        using ev tau ap'_crole(3) SPab 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   740
        by (auto simp:cp2sproc.simps obj2sobj.simps split:option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   741
      ultimately show ?thesis using vs_tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
   742
        by (erule_tac vs_step, simp+)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   743
    qed  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
   744
    have nodel: "no_del_event (e#\<tau>)" using nodelab tau ev by simp  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
   745
    have "initp_intact (e#\<tau>)" using tau ev intactab valid
dcde836219bc add thy files
chunhan
parents:
diff changeset
   746
      by (simp add:initp_intact_I_crole)   moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
   747
    have exobj': "exists (e#\<tau>) obj'" using exobj'ab valid ev tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
   748
      by (case_tac obj', simp+)  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
   749
    have "obj2sobj (e#\<tau>) obj' = sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   750
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
   751
      have "\<And> f. obj' = File f \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   752
        using SOab' tau ev valid notUkn nodel exobj'
dcde836219bc add thy files
chunhan
parents:
diff changeset
   753
        obj2sobj_file_remains''[where s'="[e,Clone p (new_proc (s @ s'))]"]
dcde836219bc add thy files
chunhan
parents:
diff changeset
   754
        by (auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   755
      moreover have "\<And> i. obj' = IPC i \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   756
        using SOab' tau ev valid notUkn nodel exobj'
dcde836219bc add thy files
chunhan
parents:
diff changeset
   757
        obj2sobj_ipc_remains''[where s'="[e,Clone p (new_proc (s @ s'))]"]
dcde836219bc add thy files
chunhan
parents:
diff changeset
   758
        by auto
dcde836219bc add thy files
chunhan
parents:
diff changeset
   759
      moreover have "\<And> p'. obj' = Proc p' \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   760
        apply (case_tac "p' = new_proc (s @ s')") 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   761
        using vs_tau exobj'ab tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
   762
        apply (simp, drule_tac valid_os, simp add:np_notin_curp)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   763
        using tau ev SOab' valid notUkn vs_tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
   764
        by (auto simp:obj2sobj.simps cp2sproc_simps split:option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   765
      ultimately show ?thesis by (case_tac obj', auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   766
    qed  moreover 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   767
    have "obj2sobj (e#\<tau>) (Proc (new_proc (s@s'))) = SProc (r', fr, t, u) srp"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   768
      using SPab tau vs_tau ev valid
dcde836219bc add thy files
chunhan
parents:
diff changeset
   769
      by (auto simp:obj2sobj.simps cp2sproc_simps' simp del:cp2sproc.simps
dcde836219bc add thy files
chunhan
parents:
diff changeset
   770
              split:option.splits)  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
   771
    have "exists (e#\<tau>) (Proc p)" using exp tau ev by simp  
dcde836219bc add thy files
chunhan
parents:
diff changeset
   772
    ultimately show "\<exists>s obj. valid (s @ s') \<and> obj2sobj (s @ s') obj' = sobj' \<and> 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   773
      exists (s @ s') obj' \<and> no_del_event (s @ s') \<and> initp_intact (s @ s') \<and> 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   774
      obj2sobj (s @ s') obj = SProc (r', fr, t, u) srp \<and> exists (s @ s') obj"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   775
      using ev tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
   776
      apply (rule_tac x = "e # Clone p (new_proc (s @ s')) # s" in exI)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   777
      by (rule_tac x = "Proc (new_proc (s@s'))" in exI, auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   778
  qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
   779
next
dcde836219bc add thy files
chunhan
parents:
diff changeset
   780
  case (ap'_chown r fr t u srp u' nr)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   781
  show ?case 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   782
  proof (rule allI|rule impI|erule conjE)+
dcde836219bc add thy files
chunhan
parents:
diff changeset
   783
    fix s' obj' sobj'
dcde836219bc add thy files
chunhan
parents:
diff changeset
   784
    assume "valid s'" and "obj2sobj s' obj' = sobj'" and "no_del_event s'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   785
      and "initp_intact s'" and notUkn: "sobj' \<noteq> Unknown" and "exists s' obj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   786
    with ap'_chown(1,2) obtain s p where
dcde836219bc add thy files
chunhan
parents:
diff changeset
   787
      VSab: "valid (s@s')" and SOab': "obj2sobj (s@s') obj' = sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   788
      and nodelab: "no_del_event (s@s')" and intactab: "initp_intact (s@s')"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   789
      and SPab: "obj2sobj (s@s') (Proc p) = SProc (r, fr, t, u) srp"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   790
      and exp:"exists (s@s') (Proc p)" and exobj'ab:"exists (s@s') obj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   791
      by (blast dest:obj2sobj_proc intro:nodel_exists_remains)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   792
    obtain e \<tau> where ev: "e = ChangeOwner (new_proc (s@s')) u'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   793
      and tau: "\<tau> = Clone p (new_proc (s@s'))#s@s'" by auto
dcde836219bc add thy files
chunhan
parents:
diff changeset
   794
    hence vs_tau:"valid \<tau>" using exp VSab by (auto intro:clone_event_no_limit)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   795
dcde836219bc add thy files
chunhan
parents:
diff changeset
   796
    have valid: "valid (e#\<tau>)" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   797
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
   798
      have "os_grant \<tau> e"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   799
        using ev tau exp ap'_chown(3) by (simp)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   800
      moreover have "rc_grant \<tau> e" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   801
        using ev tau ap'_chown(5) SPab 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   802
        by (auto simp:cp2sproc.simps obj2sobj.simps pct_def clone_type_unchange
dcde836219bc add thy files
chunhan
parents:
diff changeset
   803
                split:option.splits t_rc_proc_type.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   804
          (* here is another place of no_limit of clone event assumption *)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   805
      ultimately show ?thesis using vs_tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
   806
        by (erule_tac vs_step, simp+)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   807
    qed  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
   808
    have nodel: "no_del_event (e#\<tau>)" using nodelab tau ev by simp  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
   809
    have "initp_intact (e#\<tau>)" using intactab tau ev valid 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   810
      by (simp add:initp_intact_I_chown)  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
   811
    have exobj': "exists (e#\<tau>) obj'" using exobj'ab valid ev tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
   812
      by (case_tac obj', simp+)  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
   813
    have "obj2sobj (e#\<tau>) obj' = sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   814
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
   815
      have "\<And> f. obj' = File f \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   816
        using SOab' tau ev valid notUkn nodel exobj'
dcde836219bc add thy files
chunhan
parents:
diff changeset
   817
        obj2sobj_file_remains''[where s'="[e,Clone p (new_proc (s @ s'))]"]
dcde836219bc add thy files
chunhan
parents:
diff changeset
   818
        by (auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   819
      moreover have "\<And> i. obj' = IPC i \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   820
        using SOab' tau ev valid notUkn nodel exobj'
dcde836219bc add thy files
chunhan
parents:
diff changeset
   821
        obj2sobj_ipc_remains''[where s'="[e,Clone p (new_proc (s @ s'))]"]
dcde836219bc add thy files
chunhan
parents:
diff changeset
   822
        by auto
dcde836219bc add thy files
chunhan
parents:
diff changeset
   823
      moreover have "\<And> p'. obj' = Proc p' \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   824
        apply (case_tac "p' = new_proc (s @ s')") 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   825
        using vs_tau exobj'ab tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
   826
        apply (simp, drule_tac valid_os, simp add:np_notin_curp)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   827
        using tau ev SOab' valid notUkn vs_tau 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   828
        by (auto simp:obj2sobj.simps cp2sproc_simps' split:option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   829
      ultimately show ?thesis by (case_tac obj', auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   830
    qed  moreover 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   831
    have "obj2sobj (e#\<tau>) (Proc (new_proc (s@s'))) = 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   832
          SProc (nr,fr,chown_type_aux r nr t,u') srp"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   833
      using SPab tau vs_tau ev valid ap'_chown(4)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   834
      by (auto simp:obj2sobj.simps cp2sproc_simps' simp del:cp2sproc.simps
dcde836219bc add thy files
chunhan
parents:
diff changeset
   835
              split:option.splits)  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
   836
    have "exists (e#\<tau>) (Proc p)" using exp tau ev by simp   moreover 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   837
    ultimately show "\<exists>s obj. valid (s @ s') \<and> obj2sobj (s @ s') obj' = sobj' \<and> 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   838
      exists (s @ s') obj' \<and> no_del_event (s @ s') \<and> initp_intact (s @ s') \<and> 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   839
      obj2sobj (s @ s') obj = SProc (nr,fr,chown_type_aux r nr t,u') srp \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
   840
      exists (s @ s') obj"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   841
      using ev tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
   842
      apply (rule_tac x = "e # Clone p (new_proc (s @ s')) # s" in exI)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   843
      by (rule_tac x = "Proc (new_proc (s@s'))" in exI, auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   844
  qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
   845
next
dcde836219bc add thy files
chunhan
parents:
diff changeset
   846
  case (ap'_exec r fr pt u sp t sd sf r' fr')
dcde836219bc add thy files
chunhan
parents:
diff changeset
   847
  show ?case
dcde836219bc add thy files
chunhan
parents:
diff changeset
   848
  proof (rule allI|rule impI|erule conjE)+
dcde836219bc add thy files
chunhan
parents:
diff changeset
   849
    fix s' obj' sobj'
dcde836219bc add thy files
chunhan
parents:
diff changeset
   850
    assume "valid s'" and "obj2sobj s' obj' = sobj'" and "no_del_event s'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   851
      and "initp_intact s'" and notUkn: "sobj' \<noteq> Unknown" and "exists s' obj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   852
    with ap'_exec(3,4) obtain sa f where
dcde836219bc add thy files
chunhan
parents:
diff changeset
   853
      SFa: "obj2sobj (sa @ s') (File f) = SFile (t, sd) sf" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
   854
      Exfa: "exists (sa @ s') (File f)" and 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   855
      butsa: "initp_intact (sa @ s')" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
   856
      othersa:"valid (sa @ s') \<and> obj2sobj (sa @ s') obj' = sobj' \<and> 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   857
               exists (sa @s') obj' \<and> no_del_event (sa @ s')" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   858
      by (blast dest:obj2sobj_file intro:nodel_exists_remains)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   859
    with ap'_exec(1,2) notUkn obtain sb p where
dcde836219bc add thy files
chunhan
parents:
diff changeset
   860
      VSab: "valid (sb@sa@s')" and SOab': "obj2sobj (sb@sa@s') obj' = sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   861
      and nodelab: "no_del_event (sb@sa@s')"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   862
      and intactab: "initp_intact (sb@sa@s')"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   863
      and SPab: "obj2sobj (sb@sa@s') (Proc p) = SProc (r, fr, pt, u) sp"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   864
      and exp:"exists (sb@sa@s') (Proc p)" and exobj'ab:"exists (sb@sa@s') obj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   865
      by (blast dest:obj2sobj_proc intro:nodel_exists_remains)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   866
    obtain e \<tau> where ev: "e = Execute (new_proc (sb@sa@s')) f" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   867
      and tau: "\<tau> = Clone p (new_proc (sb@sa@s'))#sb@sa@s'" by auto
dcde836219bc add thy files
chunhan
parents:
diff changeset
   868
    hence vs_tau:"valid \<tau>" using exp VSab by (auto intro:clone_event_no_limit)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   869
    from Exfa nodelab have exf:"f \<in> current_files (sb@sa@s')" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   870
      apply (drule_tac obj = "File f" in nodel_imp_un_deleted)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   871
      by (drule_tac s' = "sb" in not_deleted_imp_exists', auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   872
    from SFa VSab Exfa nodelab have SFab: "obj2sobj (sb@sa@s') (File f) = SFile (t,sd) sf"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   873
      by (rule_tac s = "sa@s'" in obj2sobj_file_remains'', simp_all)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   874
dcde836219bc add thy files
chunhan
parents:
diff changeset
   875
    have valid: "valid (e#\<tau>)" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   876
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
   877
      have "os_grant \<tau> e"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   878
        using ev tau exp by (simp add:exf)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   879
      moreover have "rc_grant \<tau> e" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   880
        using ev tau ap'_exec(5) SPab SFab
dcde836219bc add thy files
chunhan
parents:
diff changeset
   881
        by (auto simp:etype_of_file_def cp2sproc.simps obj2sobj.simps
dcde836219bc add thy files
chunhan
parents:
diff changeset
   882
                split:if_splits option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   883
      ultimately show ?thesis using vs_tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
   884
        by (erule_tac vs_step, simp+)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   885
    qed  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
   886
    have nodel: "no_del_event (e#\<tau>)" using nodelab tau ev by simp  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
   887
    have "initp_intact (e#\<tau>)" using tau ev intactab valid
dcde836219bc add thy files
chunhan
parents:
diff changeset
   888
      by (simp add:initp_intact_I_exec)  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
   889
    have exobj': "exists (e#\<tau>) obj'" using exobj'ab valid ev tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
   890
      by (case_tac obj', simp+) moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
   891
    have "obj2sobj (e#\<tau>) obj' = sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   892
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
   893
      have "\<And> f. obj' = File f \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   894
        using SOab' tau ev valid notUkn nodel exobj'
dcde836219bc add thy files
chunhan
parents:
diff changeset
   895
        obj2sobj_file_remains''[where s'="[e,Clone p (new_proc (sb @ sa @ s'))]"]
dcde836219bc add thy files
chunhan
parents:
diff changeset
   896
        by (auto simp del:obj2sobj.simps)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   897
      moreover have "\<And> i. obj' = IPC i \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   898
        using SOab' tau ev valid notUkn nodel exobj'
dcde836219bc add thy files
chunhan
parents:
diff changeset
   899
        obj2sobj_ipc_remains''[where s'="[e,Clone p (new_proc (sb @ sa @ s'))]"]
dcde836219bc add thy files
chunhan
parents:
diff changeset
   900
        by (auto simp del:obj2sobj.simps)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   901
      moreover have "\<And> p'. obj' = Proc p' \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   902
        apply (case_tac "p' = new_proc (sb @ sa @ s')") 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   903
        using vs_tau exobj'ab tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
   904
        apply (simp, drule_tac valid_os, simp add:np_notin_curp)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   905
        using tau ev SOab' valid notUkn vs_tau 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   906
        by (auto simp:obj2sobj.simps cp2sproc_simps' split:option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   907
      ultimately show ?thesis by (case_tac obj', auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   908
    qed  moreover 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   909
    have "obj2sobj (e#\<tau>) (Proc (new_proc (sb @ sa @ s'))) = 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   910
          SProc (r',fr',exec_type_aux r pt, u) sp"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   911
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
   912
      have "obj2sobj (sb@sa@s') (Proc p) = SProc (r,fr,pt,u) sp" using SPab tau vs_tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
   913
        by (auto split:option.splits simp:cp2sproc_simps' obj2sobj.simps)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   914
      hence "obj2sobj \<tau> (Proc (new_proc (sb@sa@s'))) = SProc (r,fr,pt,u) sp" using tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
   915
      by (auto simp:obj2sobj.simps cp2sproc.simps pct_def clone_type_unchange 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   916
              split:option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   917
      moreover have "source_dir \<tau> f = Some sd" using vs_tau SFab tau 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   918
        by (auto simp:source_dir_simps obj2sobj.simps split:option.splits if_splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   919
      ultimately show ?thesis using valid ev ap'_exec(6,7) 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   920
        by (auto simp:cp2sproc_exec obj2sobj.simps split:option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   921
    qed 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   922
    ultimately 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   923
    show "\<exists>s obj. valid (s @ s') \<and> obj2sobj (s @ s') obj' = sobj' \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
   924
      exists (s @ s') obj' \<and> no_del_event (s @ s') \<and> initp_intact (s @ s') \<and> 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   925
      obj2sobj (s @ s') obj = SProc (r', fr', exec_type_aux r pt, u) sp \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
   926
      exists (s @ s') obj"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   927
      using ev tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
   928
      apply (rule_tac x = "e#Clone p (new_proc (sb @ sa @ s')) #sb@sa" in exI)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   929
      by (rule_tac x = "Proc (new_proc (sb @ sa @ s'))" in exI, auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   930
  qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
   931
qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
   932
dcde836219bc add thy files
chunhan
parents:
diff changeset
   933
(* this is for ts2t createfile case ... *)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   934
lemma all_sobjs_E0:
dcde836219bc add thy files
chunhan
parents:
diff changeset
   935
  "\<lbrakk>sobj \<in> all_sobjs'; valid s'; obj2sobj s' obj' = sobj'; exists s' obj'; sobj' \<noteq> Unknown; 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   936
    no_del_event s'; initp_intact s'\<rbrakk>
dcde836219bc add thy files
chunhan
parents:
diff changeset
   937
   \<Longrightarrow> \<exists> s obj. valid (s @ s') \<and> obj2sobj (s @ s') obj' = sobj' \<and> exists (s@s') obj \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
   938
                no_del_event (s @ s') \<and> initp_intact (s @ s') \<and> 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   939
                obj2sobj (s @ s') obj = sobj \<and> exists (s @ s') obj"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   940
by (drule all_sobjs_E0_aux, auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   941
dcde836219bc add thy files
chunhan
parents:
diff changeset
   942
lemma all_sobjs_E1_aux[rule_format]:
dcde836219bc add thy files
chunhan
parents:
diff changeset
   943
  "sobj \<in> all_sobjs' \<Longrightarrow> (\<forall> s' obj' sobj'. valid s' \<and> obj2sobj s' obj' = sobj' \<and> exists s' obj' \<and> sobj' \<noteq> Unknown \<and> no_del_event s' \<and> initp_intact_but s' sobj' \<longrightarrow> (\<exists> s obj. valid (s @ s') \<and> obj2sobj (s @ s') obj' = sobj' \<and> exists (s @ s') obj' \<and> no_del_event (s @ s') \<and> initp_intact_but (s @ s') sobj' \<and> obj2sobj (s @ s') obj = sobj \<and> exists (s @ s') obj))"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   944
proof (induct rule:all_sobjs'.induct)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   945
  case (af'_init f t) show ?case
dcde836219bc add thy files
chunhan
parents:
diff changeset
   946
  proof (rule allI|rule impI|erule conjE)+
dcde836219bc add thy files
chunhan
parents:
diff changeset
   947
    fix s' obj' sobj'
dcde836219bc add thy files
chunhan
parents:
diff changeset
   948
    assume vss': "valid s'" and sobjs': "obj2sobj s' obj' = sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   949
      and nodels': "no_del_event s'"and intacts':"initp_intact_but s' sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   950
      and exso': "exists s' obj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   951
    from nodels' af'_init(1) have exf: "f \<in> current_files s'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   952
      by (drule_tac obj = "File f" in nodel_imp_exists, simp+)    
dcde836219bc add thy files
chunhan
parents:
diff changeset
   953
    have "obj2sobj s' (File f) = SFile (t, f) (Some f)"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   954
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
   955
      have "obj2sobj [] (File f) = SFile (t, f) (Some f)"  using af'_init 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   956
        by (auto simp:etype_of_file_def source_dir_of_init' obj2sobj.simps
dcde836219bc add thy files
chunhan
parents:
diff changeset
   957
                split:option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   958
      thus ?thesis using vss' exf nodels' af'_init(1) 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   959
        by (drule_tac obj2sobj_file_remains_app', auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   960
    qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
   961
    thus "\<exists>s obj. valid (s @ s') \<and> obj2sobj (s @ s') obj' = sobj' \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
   962
             exists (s @ s') obj' \<and> no_del_event (s @ s') \<and> initp_intact_but (s @ s') sobj' \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
   963
             obj2sobj (s @ s') obj = SFile (t, f) (Some f) \<and> exists (s @ s') obj"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   964
      apply (rule_tac x = "[]" in exI, rule_tac x = "File f" in exI)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   965
      by (simp add:vss' sobjs' nodels' intacts' exf exso')
dcde836219bc add thy files
chunhan
parents:
diff changeset
   966
  qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
   967
next
dcde836219bc add thy files
chunhan
parents:
diff changeset
   968
  case (af'_cfd t sd srf r fr pt u srp t') 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   969
  show ?case 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   970
  proof (rule allI|rule impI|erule conjE)+
dcde836219bc add thy files
chunhan
parents:
diff changeset
   971
    fix s' obj' sobj'
dcde836219bc add thy files
chunhan
parents:
diff changeset
   972
    assume "valid s'" and "obj2sobj s' obj' = sobj'" and "no_del_event s'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   973
      and "initp_intact_but s' sobj'" and notUkn: "sobj' \<noteq> Unknown" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   974
      and exobj':"exists s' obj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   975
    with af'_cfd(1,2) obtain sa pf where
dcde836219bc add thy files
chunhan
parents:
diff changeset
   976
      "valid (sa@s')" and "obj2sobj (sa@s') obj'=sobj' \<and> no_del_event (sa@s')" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
   977
      "exists (sa@s') obj'" and "initp_intact_but (sa@s') sobj'" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
   978
      SFa: "obj2sobj (sa@s') (File pf) = SFile (t, sd) srf" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
   979
      exfa: "pf \<in> current_files (sa@s')" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   980
      apply (erule_tac x = s' in allE, erule_tac x = obj' in allE, auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   981
      by (frule obj2sobj_file, auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   982
    with af'_cfd(3,4) notUkn obtain sb p where
dcde836219bc add thy files
chunhan
parents:
diff changeset
   983
      SPab: "obj2sobj (sb@sa@s') (Proc p) = SProc (r,fr,pt,u) srp" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
   984
      expab: "exists (sb@sa@s') (Proc p)" and vsab: "valid (sb@sa@s')" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
   985
      soab: "obj2sobj (sb@sa@s') obj' = sobj'" and 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   986
      exsoab: "exists (sb@sa@s') obj'" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
   987
      intactab: "initp_intact_but (sb@sa@s') sobj'" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
   988
      nodelab: "no_del_event (sb@sa@s')"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   989
      by (blast dest:obj2sobj_proc intro:nodel_exists_remains)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   990
    from exfa nodelab have exf:"pf \<in> current_files (sb@sa@s')"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   991
      apply (drule_tac obj = "File pf" in nodel_imp_un_deleted)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   992
      by (drule_tac s' = "sb" in not_deleted_imp_exists', auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   993
    from SFa vsab exfa nodelab have SFab: "obj2sobj (sb@sa@s') (File pf) = SFile (t,sd) srf"
dcde836219bc add thy files
chunhan
parents:
diff changeset
   994
      by (rule_tac s = "sa@s'" in obj2sobj_file_remains_app', simp_all)
dcde836219bc add thy files
chunhan
parents:
diff changeset
   995
    obtain e \<tau> where ev: "e = CreateFile p (new_childf pf \<tau>)" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   996
      and tau: "\<tau>=sb@sa@s'" by auto
dcde836219bc add thy files
chunhan
parents:
diff changeset
   997
    
dcde836219bc add thy files
chunhan
parents:
diff changeset
   998
    have valid: "valid (e # \<tau>)" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
   999
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1000
      have "os_grant \<tau> e"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1001
        using ev tau expab exf by (simp add:ncf_notin_curf ncf_parent)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1002
      moreover have "rc_grant \<tau> e" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1003
        using ev tau af'_cfd(5,6,7) SPab SFab
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1004
        by (auto simp:etype_of_file_def cp2sproc.simps ncf_parent obj2sobj.simps
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1005
                split:if_splits option.splits t_rc_file_type.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1006
      ultimately show ?thesis using vsab tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1007
        by (rule_tac vs_step, simp+)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1008
    qed  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1009
    have nodel: "no_del_event (e#\<tau>)" using nodelab tau ev by simp  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1010
    have exobj': "exists (e#\<tau>) obj'" using exsoab valid ev tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1011
        by (case_tac obj', simp+)   moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1012
    have "obj2sobj (e#\<tau>) obj' = sobj'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1013
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1014
      have "\<And> f. obj' = File f \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1015
        using soab tau valid notUkn nodel ev exsoab
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1016
        by (auto  intro!:obj2sobj_file_remains' simp:ncf_notin_curf)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1017
      moreover have "\<And> i. obj' = IPC i \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'"  
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1018
        using soab tau valid notUkn nodel ev exsoab
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1019
        by (auto intro!:obj2sobj_ipc_remains' simp:ncf_notin_curf)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1020
      moreover have "\<And> p. obj' = Proc p \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'"  
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1021
        using soab tau valid notUkn nodel ev exsoab
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1022
        by (auto simp:obj2sobj.simps cp2sproc_simps' 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1023
             simp del:cp2sproc.simps split:option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1024
      ultimately show ?thesis by (case_tac obj', auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1025
    qed  moreover 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1026
    have "obj2sobj (e#\<tau>) (File (new_childf pf \<tau>)) = SFile (t', sd) None"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1027
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1028
      have "etype_of_file (e#\<tau>) (new_childf pf \<tau>) = Some t'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1029
        using ev tau SFab SPab af'_cfd(5)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1030
        by (auto simp:obj2sobj.simps cp2sproc.simps etype_of_file_def
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1031
          split:option.splits if_splits  intro!:etype_aux_prop4)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1032
      moreover have "source_dir (e#\<tau>) (new_childf pf \<tau>) = Some sd"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1033
        using ev tau SFab SPab valid ncf_parent
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1034
        by (auto simp:source_dir_simps obj2sobj.simps 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1035
                split:if_splits option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1036
      ultimately show ?thesis  using nodel ncf_notin_curf[where s = \<tau>]
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1037
        nodel_imp_exists[where obj = "File (new_childf pf \<tau>)" and s =\<tau>]
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1038
        by (auto simp:obj2sobj.simps dest:no_del_event_cons_D)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1039
    qed  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1040
    have "initp_intact_but (e#\<tau>) sobj'" using intactab tau ev valid nodel
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1041
        apply (case_tac sobj', case_tac option)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1042
        by (simp_all add:initp_intact_butp_I_others initp_intact_I_others)  
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1043
    ultimately show "\<exists>s obj. valid (s @ s') \<and> obj2sobj (s @ s') obj' = sobj' \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1044
      exists (s @ s') obj' \<and> no_del_event (s @ s') \<and> initp_intact_but (s @ s') sobj' \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1045
      obj2sobj (s @ s') obj = SFile (t', sd) None \<and> exists (s @ s') obj "
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1046
      using tau ev
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1047
      apply (rule_tac x = "e#sb@sa" in exI)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1048
      by (rule_tac x = "File (new_childf pf \<tau>)" in exI, auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1049
  qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1050
next
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1051
  case (af'_cfd' t sd srf r fr pt u srp)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1052
  show ?case 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1053
  proof (rule allI|rule impI|erule conjE)+
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1054
    fix s' obj' sobj'
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1055
    assume "valid s'" and "obj2sobj s' obj' = sobj'" and "no_del_event s'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1056
      and "initp_intact_but s' sobj'" and notUkn: "sobj' \<noteq> Unknown" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1057
      and exobj':"exists s' obj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1058
    with af'_cfd'(1,2) obtain sa pf where
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1059
      "valid (sa@s')" and "obj2sobj (sa@s') obj'=sobj' \<and> no_del_event (sa@s')" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1060
      "exists (sa@s') obj'" and "initp_intact_but (sa@s') sobj'" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1061
      SFa: "obj2sobj (sa@s') (File pf) = SFile (t, sd) srf" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1062
      exfa: "pf \<in> current_files (sa@s')" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1063
      apply (erule_tac x = s' in allE, erule_tac x = obj' in allE, auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1064
      by (frule obj2sobj_file, auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1065
    with af'_cfd'(3,4) notUkn obtain sb p where
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1066
      SPab: "obj2sobj (sb@sa@s') (Proc p) = SProc (r,fr,pt,u) srp" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1067
      expab: "exists (sb@sa@s') (Proc p)" and vsab: "valid (sb@sa@s')" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1068
      soab: "obj2sobj (sb@sa@s') obj' = sobj'" and 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1069
      exsoab: "exists (sb@sa@s') obj'" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1070
      intactab: "initp_intact_but (sb@sa@s') sobj'" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1071
      nodelab: "no_del_event (sb@sa@s')"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1072
      by (blast dest:obj2sobj_proc intro:nodel_exists_remains)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1073
    from exfa nodelab have exf:"pf \<in> current_files (sb@sa@s')"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1074
      apply (drule_tac obj = "File pf" in nodel_imp_un_deleted)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1075
      by (drule_tac s' = "sb" in not_deleted_imp_exists', auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1076
    from SFa vsab exfa nodelab have SFab: "obj2sobj (sb@sa@s') (File pf) = SFile (t,sd) srf"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1077
      by (rule_tac s = "sa@s'" in obj2sobj_file_remains_app', simp_all)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1078
    obtain e \<tau> where ev: "e = CreateFile p (new_childf pf \<tau>)" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1079
      and tau: "\<tau>=sb@sa@s'" by auto
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1080
    
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1081
    have valid: "valid (e # \<tau>)" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1082
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1083
      have "os_grant \<tau> e"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1084
        using ev tau expab exf by (simp add:ncf_notin_curf ncf_parent)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1085
      moreover have "rc_grant \<tau> e" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1086
        using ev tau af'_cfd'(5,6) SPab SFab
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1087
        by (auto simp:etype_of_file_def cp2sproc.simps ncf_parent obj2sobj.simps
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1088
                split:if_splits option.splits t_rc_file_type.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1089
      ultimately show ?thesis using vsab tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1090
        by (rule_tac vs_step, simp+)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1091
    qed  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1092
    have nodel: "no_del_event (e#\<tau>)" using nodelab tau ev by simp  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1093
    have exobj': "exists (e#\<tau>) obj'" using exsoab valid ev tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1094
        by (case_tac obj', simp+)   moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1095
    have "obj2sobj (e#\<tau>) obj' = sobj'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1096
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1097
      have "\<And> f. obj' = File f \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1098
        using soab tau valid notUkn nodel ev exsoab
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1099
        by (auto  intro!:obj2sobj_file_remains' simp:ncf_notin_curf)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1100
      moreover have "\<And> i. obj' = IPC i \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'"  
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1101
        using soab tau valid notUkn nodel ev exsoab
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1102
        by (auto intro!:obj2sobj_ipc_remains' simp:ncf_notin_curf)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1103
      moreover have "\<And> p. obj' = Proc p \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'"  
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1104
        using soab tau valid notUkn nodel ev exsoab
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1105
        by (auto simp:obj2sobj.simps cp2sproc_simps' 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1106
             simp del:cp2sproc.simps split:option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1107
      ultimately show ?thesis by (case_tac obj', auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1108
    qed  moreover 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1109
    have "obj2sobj (e#\<tau>) (File (new_childf pf \<tau>)) = SFile (t, sd) None"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1110
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1111
      have "etype_of_file (e#\<tau>) (new_childf pf \<tau>) = Some t"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1112
      proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1113
        have "etype_of_file (e#\<tau>) (new_childf pf \<tau>) = etype_of_file \<tau> pf"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1114
          using ev tau SPab af'_cfd'(5) 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1115
          by (auto simp:obj2sobj.simps cp2sproc.simps ncf_parent etype_of_file_def
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1116
            split:option.splits   intro!:etype_aux_prop3)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1117
        thus ?thesis using SFab tau ev
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1118
          by (auto simp:obj2sobj.simps split:option.splits if_splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1119
      qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1120
      moreover have "source_dir (e#\<tau>) (new_childf pf \<tau>) = Some sd"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1121
        using ev tau SFab SPab valid ncf_parent
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1122
        by (auto simp:source_dir_simps obj2sobj.simps 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1123
                split:if_splits option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1124
      ultimately show ?thesis  using nodel ncf_notin_curf[where s = \<tau>]
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1125
        nodel_imp_exists[where obj = "File (new_childf pf \<tau>)" and s =\<tau>]
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1126
        by (auto simp:obj2sobj.simps dest:no_del_event_cons_D)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1127
    qed  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1128
    have "initp_intact_but (e#\<tau>) sobj'" using intactab tau ev valid nodel
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1129
        apply (case_tac sobj', case_tac option)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1130
        by (simp_all add:initp_intact_butp_I_others initp_intact_I_others)  
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1131
    ultimately show "\<exists>s obj. valid (s @ s') \<and> obj2sobj (s @ s') obj' = sobj' \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1132
      exists (s @ s') obj' \<and> no_del_event (s @ s') \<and> initp_intact_but (s @ s') sobj' \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1133
      obj2sobj (s @ s') obj = SFile (t, sd) None \<and> exists (s @ s') obj"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1134
      using tau ev
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1135
      apply (rule_tac x = "e#sb@sa" in exI)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1136
      by (rule_tac x = "File (new_childf pf \<tau>)" in exI, auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1137
  qed 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1138
next
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1139
  case (ai'_init i t) 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1140
  hence initi: "i \<in> init_ipcs" using init_ipc_has_type
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1141
    by (simp add:bidirect_in_init_def)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1142
  show ?case 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1143
  proof (rule allI|rule impI|erule conjE)+
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1144
    fix s' obj' sobj'
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1145
    assume vss': "valid s'" and sobjs': "obj2sobj s' obj' = sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1146
      and nodels': "no_del_event s'"and intacts':"initp_intact_but s' sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1147
      and exso': "exists s' obj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1148
    from nodels' initi have exi: "i \<in> current_ipcs s'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1149
      by (drule_tac obj = "IPC i" in nodel_imp_exists, simp+)    
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1150
    have "obj2sobj s' (IPC i) = SIPC t (Some i)"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1151
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1152
      have "obj2sobj [] (IPC i) = SIPC t (Some i)"  
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1153
        using ai'_init initi by (auto simp:obj2sobj.simps)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1154
      thus ?thesis using vss' exi nodels' initi 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1155
        by (drule_tac obj2sobj_ipc_remains'', auto simp:obj2sobj.simps)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1156
    qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1157
    thus "\<exists>s obj. valid (s @ s') \<and> obj2sobj (s @ s') obj' = sobj' \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1158
             exists (s @ s') obj' \<and> no_del_event (s @ s') \<and> initp_intact_but (s @ s') sobj' \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1159
             obj2sobj (s @ s') obj = SIPC t (Some i) \<and> exists (s @ s') obj"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1160
      apply (rule_tac x = "[]" in exI, rule_tac x = "IPC i" in exI)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1161
      by (simp add:vss' sobjs' nodels' exi exso' intacts' del:obj2sobj.simps)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1162
  qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1163
next
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1164
  case (ai'_cipc r fr pt u srp)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1165
  show ?case
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1166
  proof (rule allI|rule impI|erule conjE)+
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1167
    fix s' obj' sobj'
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1168
    assume "valid s'" and "obj2sobj s' obj' = sobj'" and "no_del_event s'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1169
      and "initp_intact_but s' sobj'" and notUkn: "sobj' \<noteq> Unknown" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1170
      and exobj':"exists s' obj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1171
    with ai'_cipc(1,2) notUkn obtain s p where
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1172
      SPab: "obj2sobj (s@s') (Proc p) = SProc (r,fr,pt,u) srp" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1173
      expab: "exists (s@s') (Proc p)" and vsab: "valid (s@s')" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1174
      soab: "obj2sobj (s@s') obj' = sobj'" and 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1175
      exsoab: "exists (s@s') obj'" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1176
      intactab: "initp_intact_but (s@s') sobj'" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1177
      nodelab: "no_del_event (s@s')"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1178
      by (blast dest:obj2sobj_proc intro:nodel_exists_remains)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1179
    obtain e \<tau> where ev: "e = CreateIPC p (new_ipc \<tau>)" and tau: "\<tau>=s@s'" by auto
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1180
    
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1181
    have valid: "valid (e # \<tau>)" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1182
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1183
      have "os_grant \<tau> e"
6
4294abb1f38c update scripts with no new_* in admissable-check
chunhan
parents: 1
diff changeset
  1184
        using ev tau expab by (simp add:ni_notin_curi)
1
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1185
      moreover have "rc_grant \<tau> e" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1186
        using ev tau ai'_cipc(3) SPab
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1187
        by (auto simp:cp2sproc.simps obj2sobj.simps split:option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1188
      ultimately show ?thesis using vsab tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1189
        by (rule_tac vs_step, simp+)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1190
    qed  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1191
    have nodel: "no_del_event (e#\<tau>)" using nodelab tau ev by simp  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1192
    have exobj': "exists (e#\<tau>) obj'" using exsoab valid ev tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1193
        by (case_tac obj', simp+)   moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1194
    have "obj2sobj (e#\<tau>) obj' = sobj'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1195
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1196
      have "\<And> f. obj' = File f \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1197
        using soab tau valid notUkn nodel ev exsoab
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1198
        by (auto  intro!:obj2sobj_file_remains' simp:ncf_notin_curf)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1199
      moreover have "\<And> i. obj' = IPC i \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'"  
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1200
        using soab tau valid notUkn nodel ev exsoab
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1201
        by (auto intro!:obj2sobj_ipc_remains' simp:ncf_notin_curf)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1202
      moreover have "\<And> p. obj' = Proc p \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'"  
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1203
        using soab tau valid notUkn nodel ev exsoab
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1204
        by (auto simp:obj2sobj.simps cp2sproc_simps' 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1205
             simp del:cp2sproc.simps split:option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1206
      ultimately show ?thesis by (case_tac obj', auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1207
    qed  moreover 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1208
    have "obj2sobj (e#\<tau>) (IPC (new_ipc \<tau>)) = SIPC (default_ipc_create_type r) None"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1209
      using ev tau SPab nodel 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1210
        nodel_imp_exists[where obj = "IPC (new_ipc \<tau>)" and s =\<tau>]
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1211
      by (auto simp:obj2sobj.simps ni_notin_curi cp2sproc.simps 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1212
              split:option.splits dest:no_del_event_cons_D)  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1213
    have "initp_intact_but (e#\<tau>) sobj'" using intactab tau ev valid nodel
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1214
        apply (case_tac sobj', case_tac option)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1215
        by (simp_all add:initp_intact_butp_I_others initp_intact_I_others)  
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1216
    ultimately show "\<exists>s obj. valid (s @ s') \<and> obj2sobj (s @ s') obj' = sobj' \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1217
      exists (s @ s') obj' \<and> no_del_event (s @ s') \<and> initp_intact_but (s @ s') sobj' \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1218
      obj2sobj (s @ s') obj = SIPC (default_ipc_create_type r) None \<and> exists (s @ s') obj"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1219
      using tau ev
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1220
      by (rule_tac x = "e#s" in exI, rule_tac x = "IPC (new_ipc \<tau>)" in exI, auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1221
  qed 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1222
next
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1223
  case (ap'_init p r fr t u)  (* the big difference from other elims is in this case *)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1224
  hence initp: "p \<in> init_processes" using init_proc_has_role
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1225
    by (simp add:bidirect_in_init_def)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1226
  show ?case
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1227
  proof (rule allI|rule impI|erule conjE)+
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1228
    fix s' obj' sobj'
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1229
    assume VSs': "valid s'" and SOs': "obj2sobj s' obj' = sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1230
      and Nodels': "no_del_event s'"and Intacts':"initp_intact_but s' sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1231
      and exso': "exists s' obj'" and notUkn: "sobj' \<noteq> Unknown"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1232
    from Nodels' initp have exp: "p \<in> current_procs s'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1233
      by (drule_tac obj = "Proc p" in nodel_imp_exists, simp+)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1234
    have "\<exists> p'. obj2sobj s' (Proc p') = SProc (r,fr,t,u) (Some p) \<and> p' \<in> current_procs s'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1235
    proof (cases sobj')
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1236
      case (SProc sp srp)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1237
      show ?thesis
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1238
      proof (cases srp)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1239
        case None
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1240
        with SProc Intacts' have "initp_intact s'" by simp
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1241
        thus ?thesis using initp ap'_init
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1242
          apply (rule_tac x = p in exI)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1243
          by (auto simp:initp_intact_def exp split:option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1244
      next
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1245
        case (Some p')
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1246
        show ?thesis
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1247
        proof (cases "p' = p")
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1248
          case True
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1249
          with Intacts' SProc Some have "initp_alter s' p" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1250
            by (simp add:initp_intact_butp_def)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1251
          then obtain pa where "pa \<in> current_procs s'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1252
            and "obj2sobj s' (Proc pa) = init_obj2sobj (Proc p)"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1253
            by (auto simp only:initp_alter_def)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1254
          thus ?thesis using ap'_init initp 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1255
            by (rule_tac x = pa in exI, auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1256
        next
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1257
          case False
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1258
          with Intacts' SProc Some initp
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1259
          have "obj2sobj s' (Proc p) = init_obj2sobj (Proc p)"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1260
            apply (simp only:initp_intact_butp_def initp_intact_but.simps)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1261
            by (erule conjE, erule_tac x = p in allE, simp)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1262
          thus ?thesis using ap'_init exp
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1263
            by (rule_tac x = p in exI, auto split:option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1264
        qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1265
      qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1266
    next
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1267
      case (SFile sf srf)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1268
      thus ?thesis using ap'_init exp Intacts' initp
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1269
        by (rule_tac x = p in exI, auto split:option.splits simp:initp_intact_def)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1270
    next
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1271
      case (SIPC si sri)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1272
      thus ?thesis using ap'_init exp Intacts' initp
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1273
        by (rule_tac x = p in exI, auto split:option.splits simp:initp_intact_def)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1274
    next
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1275
      case Unknown
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1276
      thus ?thesis using notUkn by simp
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1277
    qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1278
    then obtain p' where "obj2sobj s' (Proc p') = SProc (r, fr, t, u) (Some p)"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1279
      and "p' \<in> current_procs s'" by blast
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1280
    thus "\<exists>s obj. valid (s @ s') \<and> obj2sobj (s @ s') obj' = sobj' \<and> 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1281
             exists (s @ s') obj' \<and> no_del_event (s @ s') \<and> initp_intact_but (s @ s') sobj' \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1282
             obj2sobj (s @ s') obj = SProc (r, fr, t, u) (Some p) \<and> exists (s @ s') obj"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1283
      apply (rule_tac x = "[]" in exI, rule_tac x = "Proc p'" in exI)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1284
      by (simp add:VSs' SOs' Nodels' exp exso' Intacts') 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1285
  qed 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1286
next
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1287
  case (ap'_crole r fr t u srp r')
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1288
  show ?case 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1289
  proof (rule allI|rule impI|erule conjE)+
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1290
    fix s' obj' sobj'
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1291
    assume "valid s'" and "obj2sobj s' obj' = sobj'" and "no_del_event s'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1292
      and "initp_intact_but s' sobj'" and notUkn: "sobj' \<noteq> Unknown" and "exists s' obj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1293
    with ap'_crole(1,2) obtain s p where
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1294
      VSab: "valid (s@s')" and SOab': "obj2sobj (s@s') obj' = sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1295
      and nodelab: "no_del_event (s@s')"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1296
      and intactab: "initp_intact_but (s@s') sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1297
      and SPab: "obj2sobj (s@s') (Proc p) = SProc (r, fr, t, u) srp"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1298
      and exp:"exists (s@s') (Proc p)" and exobj'ab:"exists (s@s') obj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1299
      by (blast dest:obj2sobj_proc intro:nodel_exists_remains)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1300
    obtain e \<tau> where ev: "e = ChangeRole (new_proc (s@s')) r'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1301
      and tau: "\<tau> = Clone p (new_proc (s@s'))#s@s'" by auto
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1302
    hence vs_tau:"valid \<tau>" using exp VSab by (auto intro:clone_event_no_limit)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1303
    have np_not_initp: "new_proc (s@s') \<notin> init_processes" using nodelab 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1304
      apply (rule_tac notI, drule_tac obj = "Proc (new_proc (s@s'))" in nodel_imp_exists)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1305
      by (auto simp:np_notin_curp)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1306
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1307
    have valid: "valid (e#\<tau>)" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1308
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1309
      have "os_grant \<tau> e"
6
4294abb1f38c update scripts with no new_* in admissable-check
chunhan
parents: 1
diff changeset
  1310
        using ev tau exp by (simp add:np_notin_curp)
1
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1311
      moreover have "rc_grant \<tau> e" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1312
        using ev tau ap'_crole(3) SPab 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1313
        by (auto simp:cp2sproc.simps obj2sobj.simps split:option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1314
      ultimately show ?thesis using vs_tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1315
        by (erule_tac vs_step, simp+)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1316
    qed  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1317
    have nodel: "no_del_event (e#\<tau>)" using nodelab tau ev by simp  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1318
    have "initp_intact_but (e#\<tau>) sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1319
    proof (cases sobj')
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1320
      case (SProc sp srp)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1321
      show ?thesis
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1322
      proof (cases srp)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1323
        case (Some p')
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1324
        with SOab' exobj'ab VSab intactab notUkn SProc
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1325
        have butp: "p' \<in> init_processes \<and> initp_intact_butp (s@s') p'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1326
          by (case_tac obj', auto intro:source_proc_in_init simp:obj2sobj.simps
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1327
                                split:if_splits option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1328
        then obtain p'' where exp': "p'' \<in> current_procs (s@s')" and 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1329
          SP': "obj2sobj (s@s') (Proc p'') = init_obj2sobj (Proc p')"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1330
          by (auto simp:initp_alter_def initp_intact_butp_def)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1331
        hence "initp_alter (e#\<tau>) p'" using tau ev notUkn nodel
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1332
          apply (simp add:initp_alter_def del:init_obj2sobj.simps)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1333
          apply (rule_tac x = p'' in exI, rule conjI, simp)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1334
          apply (subgoal_tac "p'' \<noteq> new_proc (s @s')")
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1335
          apply (auto simp:obj2sobj.simps cp2sproc.simps 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1336
                  simp del:init_obj2sobj.simps  split:option.splits)[1]
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1337
          by (rule notI, simp add:np_notin_curp)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1338
        thus ?thesis using SProc Some intactab tau ev valid vs_tau np_not_initp
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1339
          apply (simp add:initp_intact_butp_def del:init_obj2sobj.simps)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1340
          apply (rule impI|rule allI|rule conjI|erule conjE)+
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1341
          apply (erule_tac x = pa in allE)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1342
          by (auto simp:obj2sobj.simps cp2sproc_simps' simp del:init_obj2sobj.simps
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1343
                  split:option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1344
      next
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1345
        case None
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1346
        with intactab SProc 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1347
        have "initp_intact (s@s')" by simp
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1348
        hence "initp_intact (e#\<tau>)" using tau ev valid
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1349
          by (simp add:initp_intact_I_crole)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1350
        thus ?thesis using SProc None by simp
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1351
      qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1352
    next
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1353
      case (SFile sf srf)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1354
      with intactab SFile
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1355
      have "initp_intact (s@s')" by simp
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1356
      hence "initp_intact (e#\<tau>)" using tau ev valid
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1357
        by (simp add:initp_intact_I_crole)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1358
      thus ?thesis using SFile by simp
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1359
    next
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1360
      case (SIPC si sri)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1361
      with intactab SIPC
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1362
      have "initp_intact (s@s')" by simp
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1363
      hence "initp_intact (e#\<tau>)" using tau ev valid
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1364
        by (simp add:initp_intact_I_crole)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1365
      thus ?thesis using SIPC by simp
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1366
    next
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1367
      case Unknown 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1368
      with notUkn show ?thesis by simp
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1369
    qed  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1370
    have exobj': "exists (e#\<tau>) obj'" using exobj'ab valid ev tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1371
      by (case_tac obj', simp+)  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1372
    have "obj2sobj (e#\<tau>) obj' = sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1373
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1374
      have "\<And> f. obj' = File f \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1375
        using SOab' tau ev valid notUkn nodel exobj'
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1376
        obj2sobj_file_remains''[where s'="[e,Clone p (new_proc (s @ s'))]"]
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1377
        by (auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1378
      moreover have "\<And> i. obj' = IPC i \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1379
        using SOab' tau ev valid notUkn nodel exobj'
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1380
        obj2sobj_ipc_remains''[where s'="[e,Clone p (new_proc (s @ s'))]"]
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1381
        by auto
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1382
      moreover have "\<And> p'. obj' = Proc p' \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1383
        apply (case_tac "p' = new_proc (s @ s')") 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1384
        using vs_tau exobj'ab tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1385
        apply (simp, drule_tac valid_os, simp add:np_notin_curp)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1386
        using tau ev SOab' valid notUkn vs_tau 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1387
        by (auto simp:obj2sobj.simps cp2sproc_simps' split:option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1388
      ultimately show ?thesis by (case_tac obj', auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1389
    qed  moreover 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1390
    have "obj2sobj (e#\<tau>) (Proc (new_proc (s@s'))) = SProc (r', fr, t, u) srp"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1391
      using SPab tau vs_tau ev valid
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1392
      by (auto simp:obj2sobj.simps cp2sproc_simps' simp del:cp2sproc.simps
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1393
              split:option.splits)  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1394
    have "exists (e#\<tau>) (Proc p)" using exp tau ev by simp  
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1395
    ultimately show "\<exists>s obj. valid (s @ s') \<and> obj2sobj (s @ s') obj' = sobj' \<and> 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1396
      exists (s @ s') obj' \<and> no_del_event (s @ s') \<and> initp_intact_but (s @ s') sobj' \<and> 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1397
      obj2sobj (s @ s') obj = SProc (r', fr, t, u) srp \<and> exists (s @ s') obj"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1398
      using ev tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1399
      apply (rule_tac x = "e # Clone p (new_proc (s @ s')) # s" in exI)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1400
      by (rule_tac x = "Proc (new_proc (s@s'))" in exI, auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1401
  qed 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1402
next
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1403
  case (ap'_chown r fr t u srp u' nr)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1404
  show ?case 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1405
  proof (rule allI|rule impI|erule conjE)+
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1406
    fix s' obj' sobj'
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1407
    assume "valid s'" and "obj2sobj s' obj' = sobj'" and "no_del_event s'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1408
      and "initp_intact_but s' sobj'" and notUkn: "sobj' \<noteq> Unknown" and "exists s' obj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1409
    with ap'_chown(1,2) obtain s p where
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1410
      VSab: "valid (s@s')" and SOab': "obj2sobj (s@s') obj' = sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1411
      and nodelab: "no_del_event (s@s')" and intactab: "initp_intact_but (s@s') sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1412
      and SPab: "obj2sobj (s@s') (Proc p) = SProc (r, fr, t, u) srp"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1413
      and exp:"exists (s@s') (Proc p)" and exobj'ab:"exists (s@s') obj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1414
      by (blast dest:obj2sobj_proc intro:nodel_exists_remains)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1415
    obtain e \<tau> where ev: "e = ChangeOwner (new_proc (s@s')) u'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1416
      and tau: "\<tau> = Clone p (new_proc (s@s'))#s@s'" by auto
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1417
    hence vs_tau:"valid \<tau>" using exp VSab by (auto intro:clone_event_no_limit)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1418
    have np_not_initp: "new_proc (s@s') \<notin> init_processes" using nodelab 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1419
      apply (rule_tac notI, drule_tac obj = "Proc (new_proc (s@s'))" in nodel_imp_exists)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1420
      by (auto simp:np_notin_curp)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1421
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1422
    have valid: "valid (e#\<tau>)" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1423
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1424
      have "os_grant \<tau> e"
6
4294abb1f38c update scripts with no new_* in admissable-check
chunhan
parents: 1
diff changeset
  1425
        using ev tau exp ap'_chown(3) by (simp add:np_notin_curp)
1
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1426
      moreover have "rc_grant \<tau> e" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1427
        using ev tau ap'_chown(5) SPab 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1428
        by (auto simp:cp2sproc.simps obj2sobj.simps pct_def clone_type_unchange
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1429
                split:option.splits t_rc_proc_type.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1430
          (* here is another place of no_limit of clone event assumption *)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1431
      ultimately show ?thesis using vs_tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1432
        by (erule_tac vs_step, simp+)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1433
    qed  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1434
    have nodel: "no_del_event (e#\<tau>)" using nodelab tau ev by simp  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1435
    have "initp_intact_but (e#\<tau>) sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1436
    proof (cases sobj')
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1437
      case (SProc sp srp)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1438
      show ?thesis
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1439
      proof (cases srp)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1440
        case (Some p')
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1441
        with SOab' exobj'ab VSab intactab notUkn SProc
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1442
        have butp: "p' \<in> init_processes \<and> initp_intact_butp (s@s') p'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1443
          by (case_tac obj', auto intro:source_proc_in_init simp:obj2sobj.simps
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1444
                                split:if_splits option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1445
        then obtain p'' where exp': "p'' \<in> current_procs (s@s')" and 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1446
          SP': "obj2sobj (s@s') (Proc p'') = init_obj2sobj (Proc p')"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1447
          by (auto simp:initp_alter_def initp_intact_butp_def)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1448
        hence "initp_alter (e#\<tau>) p'" using tau ev notUkn nodel
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1449
          apply (simp add:initp_alter_def del:init_obj2sobj.simps)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1450
          apply (rule_tac x = p'' in exI, rule conjI, simp)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1451
          apply (subgoal_tac "p'' \<noteq> new_proc (s @s')")
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1452
          apply (auto simp:obj2sobj.simps cp2sproc.simps 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1453
                  simp del:init_obj2sobj.simps  split:option.splits)[1]
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1454
          by (rule notI, simp add:np_notin_curp)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1455
        thus ?thesis using SProc Some intactab tau ev valid vs_tau np_not_initp
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1456
          apply (simp add:initp_intact_butp_def del:init_obj2sobj.simps)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1457
          apply (rule impI|rule allI|rule conjI|erule conjE)+
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1458
          apply (erule_tac x = pa in allE)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1459
          by (auto simp:obj2sobj.simps cp2sproc_simps' simp del:init_obj2sobj.simps
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1460
                  split:option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1461
      next
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1462
        case None
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1463
        with intactab SProc 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1464
        have "initp_intact (s@s')" by simp
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1465
        hence "initp_intact (e#\<tau>)" using tau ev valid
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1466
          by (simp add:initp_intact_I_chown)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1467
        thus ?thesis using SProc None by simp
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1468
      qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1469
    next
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1470
      case (SFile sf srf)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1471
      with intactab SFile
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1472
      have "initp_intact (s@s')" by simp
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1473
      hence "initp_intact (e#\<tau>)" using tau ev valid
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1474
        by (simp add:initp_intact_I_chown)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1475
      thus ?thesis using SFile by simp
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1476
    next
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1477
      case (SIPC si sri)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1478
      with intactab SIPC
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1479
      have "initp_intact (s@s')" by simp
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1480
      hence "initp_intact (e#\<tau>)" using tau ev valid
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1481
        by (simp add:initp_intact_I_chown)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1482
      thus ?thesis using SIPC by simp
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1483
    next
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1484
      case Unknown 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1485
      with notUkn show ?thesis by simp
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1486
    qed  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1487
    have exobj': "exists (e#\<tau>) obj'" using exobj'ab valid ev tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1488
      by (case_tac obj', simp+)  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1489
    have "obj2sobj (e#\<tau>) obj' = sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1490
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1491
      have "\<And> f. obj' = File f \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1492
        using SOab' tau ev valid notUkn nodel exobj'
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1493
        obj2sobj_file_remains''[where s'="[e,Clone p (new_proc (s @ s'))]"]
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1494
        by (auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1495
      moreover have "\<And> i. obj' = IPC i \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1496
        using SOab' tau ev valid notUkn nodel exobj'
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1497
        obj2sobj_ipc_remains''[where s'="[e,Clone p (new_proc (s @ s'))]"]
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1498
        by auto
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1499
      moreover have "\<And> p'. obj' = Proc p' \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1500
        apply (case_tac "p' = new_proc (s @ s')") 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1501
        using vs_tau exobj'ab tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1502
        apply (simp, drule_tac valid_os, simp add:np_notin_curp)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1503
        using tau ev SOab' valid notUkn vs_tau 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1504
        by (auto simp:obj2sobj.simps cp2sproc_simps' split:option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1505
      ultimately show ?thesis by (case_tac obj', auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1506
    qed  moreover 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1507
    have "obj2sobj (e#\<tau>) (Proc (new_proc (s@s'))) = 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1508
          SProc (nr,fr,chown_type_aux r nr t,u') srp"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1509
      using SPab tau vs_tau ev valid ap'_chown(4)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1510
      by (auto simp:obj2sobj.simps cp2sproc_simps' simp del:cp2sproc.simps
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1511
              split:option.splits)  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1512
    have "exists (e#\<tau>) (Proc p)" using exp tau ev by simp   moreover 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1513
    ultimately show "\<exists>s obj. valid (s @ s') \<and> obj2sobj (s @ s') obj' = sobj' \<and> 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1514
      exists (s @ s') obj' \<and> no_del_event (s @ s') \<and> initp_intact_but (s @ s') sobj' \<and> 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1515
      obj2sobj (s @ s') obj = SProc (nr,fr,chown_type_aux r nr t,u') srp \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1516
      exists (s @ s') obj"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1517
      using ev tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1518
      apply (rule_tac x = "e # Clone p (new_proc (s @ s')) # s" in exI)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1519
      by (rule_tac x = "Proc (new_proc (s@s'))" in exI, auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1520
  qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1521
next
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1522
  case (ap'_exec r fr pt u sp t sd sf r' fr')
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1523
  show ?case 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1524
  proof (rule allI|rule impI|erule conjE)+
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1525
    fix s' obj' sobj'
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1526
    assume "valid s'" and "obj2sobj s' obj' = sobj'" and "no_del_event s'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1527
      and "initp_intact_but s' sobj'" and notUkn: "sobj' \<noteq> Unknown" and "exists s' obj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1528
    with ap'_exec(3,4) obtain sa f where
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1529
      SFa: "obj2sobj (sa @ s') (File f) = SFile (t, sd) sf" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1530
      Exfa: "exists (sa @ s') (File f)" and 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1531
      butsa: "initp_intact_but (sa @ s') sobj'" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1532
      othersa:"valid (sa @ s') \<and> obj2sobj (sa @ s') obj' = sobj' \<and> 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1533
               exists (sa @s') obj' \<and> no_del_event (sa @ s')" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1534
      by (blast dest:obj2sobj_file intro:nodel_exists_remains)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1535
    with ap'_exec(1,2) notUkn obtain sb p where
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1536
      VSab: "valid (sb@sa@s')" and SOab': "obj2sobj (sb@sa@s') obj' = sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1537
      and nodelab: "no_del_event (sb@sa@s')"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1538
      and intactab: "initp_intact_but (sb@sa@s') sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1539
      and SPab: "obj2sobj (sb@sa@s') (Proc p) = SProc (r, fr, pt, u) sp"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1540
      and exp:"exists (sb@sa@s') (Proc p)" and exobj'ab:"exists (sb@sa@s') obj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1541
      by (blast dest:obj2sobj_proc intro:nodel_exists_remains)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1542
    obtain e \<tau> where ev: "e = Execute (new_proc (sb@sa@s')) f" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1543
      and tau: "\<tau> = Clone p (new_proc (sb@sa@s'))#sb@sa@s'" by auto
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1544
    hence vs_tau:"valid \<tau>" using exp VSab by (auto intro:clone_event_no_limit)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1545
    from Exfa nodelab have exf:"f \<in> current_files (sb@sa@s')" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1546
      apply (drule_tac obj = "File f" in nodel_imp_un_deleted)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1547
      by (drule_tac s' = "sb" in not_deleted_imp_exists', auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1548
    from SFa VSab Exfa nodelab have SFab: "obj2sobj (sb@sa@s') (File f) = SFile (t,sd) sf"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1549
      by (rule_tac s = "sa@s'" in obj2sobj_file_remains'', simp_all)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1550
    have np_not_initp: "new_proc (sb@sa@s') \<notin> init_processes" using nodelab 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1551
      apply (rule_tac notI, drule_tac obj = "Proc (new_proc (sb@sa@s'))" in nodel_imp_exists)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1552
      by (auto simp:np_notin_curp)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1553
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1554
    have valid: "valid (e#\<tau>)" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1555
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1556
      have "os_grant \<tau> e"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1557
        using ev tau exp by (simp add:exf)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1558
      moreover have "rc_grant \<tau> e" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1559
        using ev tau ap'_exec(5) SPab SFab
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1560
        by (auto simp:etype_of_file_def cp2sproc.simps obj2sobj.simps
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1561
                split:if_splits option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1562
      ultimately show ?thesis using vs_tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1563
        by (erule_tac vs_step, simp+)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1564
    qed  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1565
    have nodel: "no_del_event (e#\<tau>)" using nodelab tau ev by simp  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1566
    have "initp_intact_but (e#\<tau>) sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1567
    proof (cases sobj')
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1568
      case (SProc sp srp)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1569
      show ?thesis
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1570
      proof (cases srp)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1571
        case (Some p')
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1572
        with SOab' exobj'ab VSab intactab notUkn SProc
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1573
        have butp: "p' \<in> init_processes \<and> initp_intact_butp (sb@sa@s') p'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1574
          by (case_tac obj', auto intro:source_proc_in_init simp:obj2sobj.simps
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1575
                                split:if_splits option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1576
        then obtain p'' where exp': "p'' \<in> current_procs (sb@sa@s')" and 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1577
          SP': "obj2sobj (sb@sa@s') (Proc p'') = init_obj2sobj (Proc p')"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1578
          by (auto simp:initp_alter_def initp_intact_butp_def)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1579
        hence "initp_alter (e#\<tau>) p'" using tau ev notUkn nodel
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1580
          apply (simp add:initp_alter_def del:init_obj2sobj.simps)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1581
          apply (rule_tac x = p'' in exI, rule conjI, simp)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1582
          apply (subgoal_tac "p'' \<noteq> new_proc (sb@sa@s')")
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1583
          apply (auto simp:obj2sobj.simps cp2sproc.simps 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1584
                  simp del:init_obj2sobj.simps  split:option.splits)[1]
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1585
          by (rule notI, simp add:np_notin_curp)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1586
        thus ?thesis using SProc Some intactab tau ev valid vs_tau np_not_initp
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1587
          apply (simp add:initp_intact_butp_def del:init_obj2sobj.simps)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1588
          apply (rule impI|rule allI|rule conjI|erule conjE)+
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1589
          apply (erule_tac x = pa in allE)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1590
          by (auto simp:obj2sobj.simps cp2sproc_simps' simp del:init_obj2sobj.simps
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1591
                  split:option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1592
      next
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1593
        case None
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1594
        with intactab SProc 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1595
        have "initp_intact (sb@sa@s')" by simp
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1596
        hence "initp_intact (e#\<tau>)" using tau ev valid
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1597
          by (simp add:initp_intact_I_exec)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1598
        thus ?thesis using SProc None by simp
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1599
      qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1600
    next
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1601
      case (SFile sf srf)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1602
      with intactab SFile
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1603
      have "initp_intact (sb@sa@s')" by simp
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1604
      hence "initp_intact (e#\<tau>)" using tau ev valid
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1605
        by (simp add:initp_intact_I_exec)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1606
      thus ?thesis using SFile by simp
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1607
    next
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1608
      case (SIPC si sri)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1609
      with intactab SIPC
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1610
      have "initp_intact (sb@sa@s')" by simp
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1611
      hence "initp_intact (e#\<tau>)" using tau ev valid
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1612
        by (simp add:initp_intact_I_exec)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1613
      thus ?thesis using SIPC by simp
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1614
    next
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1615
      case Unknown 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1616
      with notUkn show ?thesis by simp
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1617
    qed  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1618
    have exobj': "exists (e#\<tau>) obj'" using exobj'ab valid ev tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1619
      by (case_tac obj', simp+) moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1620
    have "obj2sobj (e#\<tau>) obj' = sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1621
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1622
      have "\<And> f. obj' = File f \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1623
        using SOab' tau ev valid notUkn nodel exobj'
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1624
        obj2sobj_file_remains''[where s'="[e,Clone p (new_proc (sb @ sa @ s'))]"]
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1625
        by (auto simp del:obj2sobj.simps)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1626
      moreover have "\<And> i. obj' = IPC i \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1627
        using SOab' tau ev valid notUkn nodel exobj'
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1628
        obj2sobj_ipc_remains''[where s'="[e,Clone p (new_proc (sb @ sa @ s'))]"]
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1629
        by (auto simp del:obj2sobj.simps)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1630
      moreover have "\<And> p'. obj' = Proc p' \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1631
        apply (case_tac "p' = new_proc (sb @ sa @ s')") 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1632
        using vs_tau exobj'ab tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1633
        apply (simp, drule_tac valid_os, simp add:np_notin_curp)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1634
        using tau ev SOab' valid notUkn vs_tau 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1635
        by (auto simp:obj2sobj.simps cp2sproc_simps' split:option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1636
      ultimately show ?thesis by (case_tac obj', auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1637
    qed  moreover 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1638
    have "obj2sobj (e#\<tau>) (Proc (new_proc (sb @ sa @ s'))) = 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1639
          SProc (r',fr',exec_type_aux r pt, u) sp"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1640
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1641
      have "obj2sobj (sb@sa@s') (Proc p) = SProc (r,fr,pt,u) sp" using SPab tau vs_tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1642
        by (auto split:option.splits simp:cp2sproc_simps' obj2sobj.simps)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1643
      hence "obj2sobj \<tau> (Proc (new_proc (sb@sa@s'))) = SProc (r,fr,pt,u) sp" using tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1644
      by (auto simp:obj2sobj.simps cp2sproc.simps pct_def clone_type_unchange 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1645
              split:option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1646
      moreover have "source_dir \<tau> f = Some sd" using vs_tau SFab tau 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1647
        by (auto simp:source_dir_simps obj2sobj.simps split:option.splits if_splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1648
      ultimately show ?thesis using valid ev ap'_exec(6,7) 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1649
        by (auto simp:cp2sproc_exec obj2sobj.simps split:option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1650
    qed 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1651
    ultimately  show "\<exists>s obj. valid (s @ s') \<and> obj2sobj (s @ s') obj' = sobj' \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1652
      exists (s @ s') obj' \<and> no_del_event (s @ s') \<and> initp_intact_but (s @ s') sobj' \<and> 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1653
      obj2sobj (s @ s') obj = SProc (r', fr', exec_type_aux r pt, u) sp \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1654
      exists (s @ s') obj"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1655
      using ev tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1656
      apply (rule_tac x = "e#Clone p (new_proc (sb @ sa @ s')) #sb@sa" in exI)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1657
      by (rule_tac x = "Proc (new_proc (sb @ sa @ s'))" in exI, auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1658
  qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1659
qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1660
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1661
(* this is for all_sobjs_E2 *)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1662
lemma all_sobjs_E1:
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1663
  "\<lbrakk>sobj \<in> all_sobjs'; valid s'; obj2sobj s' obj' = sobj'; exists s' obj'; sobj' \<noteq> Unknown; 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1664
    no_del_event s'; initp_intact_but s' sobj'\<rbrakk>
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1665
   \<Longrightarrow> \<exists> s obj. valid (s @ s') \<and> obj2sobj (s @ s') obj' = sobj' \<and>  exists (s@s') obj \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1666
                no_del_event (s @ s') \<and> initp_intact_but (s @ s') sobj' \<and> 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1667
                obj2sobj (s @ s') obj = sobj \<and> exists (s @ s') obj"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1668
by (drule all_sobjs_E1_aux, auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1669
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1670
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1671
lemma all_sobjs_E2_aux[rule_format]:
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1672
  "sobj \<in> all_sobjs' \<Longrightarrow> (\<forall> s' obj' sobj'. valid s' \<and> obj2sobj s' obj' = sobj' \<and> exists s' obj' \<and> sobj' \<noteq> Unknown \<and> not_both_sproc sobj sobj' \<and> no_del_event s' \<and> initp_intact s' \<longrightarrow> (\<exists> s obj. valid (s @ s') \<and> obj2sobj (s @ s') obj' = sobj' \<and> exists (s @ s') obj' \<and> no_del_event (s @ s') \<and> initp_intact_but (s @ s') sobj \<and> obj2sobj (s @ s') obj = sobj \<and> exists (s @ s') obj \<and> sobj_source_eq_obj sobj obj))"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1673
proof (induct rule:all_sobjs'.induct)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1674
  case (af'_init f t) show ?case
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1675
  proof (rule allI|rule impI|erule conjE)+
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1676
    fix s' obj' sobj'
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1677
    assume vss': "valid s'" and sobjs': "obj2sobj s' obj' = sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1678
      and nodels': "no_del_event s'"and intacts':"initp_intact s'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1679
      and notboth: "not_both_sproc (SFile (t, f) (Some f)) sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1680
      and exso': "exists s' obj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1681
    from nodels' af'_init(1) have exf: "f \<in> current_files s'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1682
      by (drule_tac obj = "File f" in nodel_imp_exists, simp+)    
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1683
    have "obj2sobj s' (File f) = SFile (t, f) (Some f)"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1684
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1685
      have "obj2sobj [] (File f) = SFile (t, f) (Some f)"  using af'_init 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1686
        by (auto simp:etype_of_file_def source_dir_of_init' obj2sobj.simps
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1687
                split:option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1688
      thus ?thesis using vss' exf nodels' af'_init(1) 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1689
        by (drule_tac obj2sobj_file_remains_app', auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1690
    qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1691
    thus "\<exists>s obj. valid (s @ s') \<and> obj2sobj (s @ s') obj' = sobj' \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1692
             exists (s @ s') obj' \<and> no_del_event (s @ s') \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1693
             initp_intact_but (s @ s') (SFile (t, f) (Some f)) \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1694
             obj2sobj (s @ s') obj = SFile (t, f) (Some f) \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1695
             exists (s @ s') obj \<and> sobj_source_eq_obj (SFile (t, f) (Some f)) obj"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1696
      apply (rule_tac x = "[]" in exI, rule_tac x = "File f" in exI)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1697
      by (simp add:vss' sobjs' nodels' intacts' exf exso')
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1698
  qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1699
next
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1700
  case (af'_cfd t sd srf r fr pt u srp t') 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1701
  show ?case 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1702
  proof (rule allI|rule impI|erule conjE)+
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1703
    fix s' obj' sobj'
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1704
    assume "valid s'" and "obj2sobj s' obj' = sobj'" and "no_del_event s'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1705
      and Both:"not_both_sproc (SFile (t', sd) None) sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1706
      and "initp_intact s'" and notUkn: "sobj' \<noteq> Unknown" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1707
      and exobj':"exists s' obj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1708
    with af'_cfd(1,2) obtain sa pf where
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1709
      "valid (sa@s')" and "obj2sobj (sa@s') obj'=sobj' \<and> no_del_event (sa@s')" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1710
      "exists (sa@s') obj'" and "initp_intact (sa@s')" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1711
      SFa: "obj2sobj (sa@s') (File pf) = SFile (t, sd) srf" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1712
      exfa: "pf \<in> current_files (sa@s')" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1713
      apply (drule_tac sf' = "(t, sd)" and srf' = srf in not_both_I_file)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1714
      apply (erule_tac x = s' in allE, erule_tac x = obj' in allE, auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1715
      by (frule obj2sobj_file, auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1716
    with af'_cfd(3) notUkn obtain sb p where
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1717
      SPab: "obj2sobj (sb@sa@s') (Proc p) = SProc (r,fr,pt,u) srp" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1718
      expab: "exists (sb@sa@s') (Proc p)" and vsab: "valid (sb@sa@s')" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1719
      soab: "obj2sobj (sb@sa@s') obj' = sobj'" and 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1720
      exsoab: "exists (sb@sa@s') obj'" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1721
      intactab: "initp_intact (sb@sa@s')" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1722
      nodelab: "no_del_event (sb@sa@s')"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1723
      apply (drule_tac s'= "sa@s'" and obj' = obj' in all_sobjs_E0, auto) 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1724
      apply (frule obj2sobj_proc, erule exE)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1725
      by (auto intro:nodel_exists_remains)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1726
    from exfa nodelab have exf:"pf \<in> current_files (sb@sa@s')"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1727
      apply (drule_tac obj = "File pf" in nodel_imp_un_deleted)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1728
      by (drule_tac s' = "sb" in not_deleted_imp_exists', auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1729
    from SFa vsab exfa nodelab have SFab: "obj2sobj (sb@sa@s') (File pf) = SFile (t,sd) srf"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1730
      by (rule_tac s = "sa@s'" in obj2sobj_file_remains_app', simp_all)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1731
    obtain e \<tau> where ev: "e = CreateFile p (new_childf pf \<tau>)" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1732
      and tau: "\<tau>=sb@sa@s'" by auto
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1733
    
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1734
    have valid: "valid (e # \<tau>)" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1735
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1736
      have "os_grant \<tau> e"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1737
        using ev tau expab exf by (simp add:ncf_notin_curf ncf_parent)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1738
      moreover have "rc_grant \<tau> e" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1739
        using ev tau af'_cfd(5,6,7) SPab SFab
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1740
        by (auto simp:etype_of_file_def cp2sproc.simps ncf_parent obj2sobj.simps
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1741
                split:if_splits option.splits t_rc_file_type.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1742
      ultimately show ?thesis using vsab tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1743
        by (rule_tac vs_step, simp+)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1744
    qed  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1745
    have nodel: "no_del_event (e#\<tau>)" using nodelab tau ev by simp  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1746
    have exobj': "exists (e#\<tau>) obj'" using exsoab valid ev tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1747
        by (case_tac obj', simp+)   moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1748
    have "obj2sobj (e#\<tau>) obj' = sobj'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1749
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1750
      have "\<And> f. obj' = File f \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1751
        using soab tau valid notUkn nodel ev exsoab
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1752
        by (auto  intro!:obj2sobj_file_remains' simp:ncf_notin_curf)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1753
      moreover have "\<And> i. obj' = IPC i \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'"  
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1754
        using soab tau valid notUkn nodel ev exsoab
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1755
        by (auto intro!:obj2sobj_ipc_remains' simp:ncf_notin_curf)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1756
      moreover have "\<And> p. obj' = Proc p \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'"  
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1757
        using soab tau valid notUkn nodel ev exsoab
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1758
        by (auto simp:obj2sobj.simps cp2sproc_simps' 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1759
             simp del:cp2sproc.simps split:option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1760
      ultimately show ?thesis by (case_tac obj', auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1761
    qed  moreover 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1762
    have "initp_intact (e#\<tau>)" using intactab tau ev valid nodel
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1763
      by (simp add:initp_intact_I_others)  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1764
    have "obj2sobj (e#\<tau>) (File (new_childf pf \<tau>)) = SFile (t', sd) None"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1765
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1766
      have "etype_of_file (e#\<tau>) (new_childf pf \<tau>) = Some t'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1767
        using ev tau SFab SPab af'_cfd(5)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1768
        by (auto simp:obj2sobj.simps etype_of_file_def cp2sproc.simps
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1769
          split:option.splits if_splits  intro!:etype_aux_prop4)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1770
      moreover have "source_dir (e#\<tau>) (new_childf pf \<tau>) = Some sd"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1771
        using ev tau SFab SPab valid ncf_parent
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1772
        by (auto simp:source_dir_simps obj2sobj.simps 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1773
                split:if_splits option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1774
      ultimately show ?thesis  using nodel ncf_notin_curf[where s = \<tau>]
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1775
        nodel_imp_exists[where obj = "File (new_childf pf \<tau>)" and s =\<tau>]
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1776
        by (auto simp:obj2sobj.simps dest:no_del_event_cons_D)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1777
    qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1778
    ultimately show "\<exists>s obj. valid (s @ s') \<and> obj2sobj (s @ s') obj' = sobj' \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1779
      exists (s @ s') obj' \<and> no_del_event (s @ s') \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1780
      initp_intact_but (s @ s') (SFile (t', sd) None) \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1781
      obj2sobj (s @ s') obj = SFile (t', sd) None \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1782
      exists (s @ s') obj \<and> sobj_source_eq_obj (SFile (t', sd) None) obj"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1783
      using tau ev
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1784
      apply (rule_tac x = "e#sb@sa" in exI)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1785
      by (rule_tac x = "File (new_childf pf \<tau>)" in exI, auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1786
  qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1787
next
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1788
  case (af'_cfd' t sd srf r fr pt u srp)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1789
  show ?case 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1790
  proof (rule allI|rule impI|erule conjE)+
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1791
    fix s' obj' sobj'
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1792
    assume "valid s'" and "obj2sobj s' obj' = sobj'" and "no_del_event s'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1793
      and Both:"not_both_sproc (SFile (t, sd) None) sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1794
      and "initp_intact s'" and notUkn: "sobj' \<noteq> Unknown" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1795
      and exobj':"exists s' obj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1796
    with af'_cfd'(1,2) obtain sa pf where
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1797
      "valid (sa@s')" and "obj2sobj (sa@s') obj'=sobj' \<and> no_del_event (sa@s')" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1798
      "exists (sa@s') obj'" and "initp_intact (sa@s')" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1799
      SFa: "obj2sobj (sa@s') (File pf) = SFile (t, sd) srf" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1800
      exfa: "pf \<in> current_files (sa@s')" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1801
      apply (drule_tac sf' = "(t, sd)" and srf' = srf in not_both_I_file)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1802
      apply (erule_tac x = s' in allE, erule_tac x = obj' in allE, auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1803
      by (frule obj2sobj_file, auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1804
    with af'_cfd'(3) notUkn obtain sb p where
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1805
      SPab: "obj2sobj (sb@sa@s') (Proc p) = SProc (r,fr,pt,u) srp" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1806
      expab: "exists (sb@sa@s') (Proc p)" and vsab: "valid (sb@sa@s')" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1807
      soab: "obj2sobj (sb@sa@s') obj' = sobj'" and 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1808
      exsoab: "exists (sb@sa@s') obj'" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1809
      intactab: "initp_intact (sb@sa@s')" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1810
      nodelab: "no_del_event (sb@sa@s')"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1811
      apply (drule_tac s'= "sa@s'" and obj' = obj' in all_sobjs_E0, auto) 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1812
      apply (frule obj2sobj_proc, erule exE)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1813
      by (auto intro:nodel_exists_remains)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1814
    from exfa nodelab have exf:"pf \<in> current_files (sb@sa@s')"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1815
      apply (drule_tac obj = "File pf" in nodel_imp_un_deleted)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1816
      by (drule_tac s' = "sb" in not_deleted_imp_exists', auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1817
    from SFa vsab exfa nodelab have SFab: "obj2sobj (sb@sa@s') (File pf) = SFile (t,sd) srf"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1818
      by (rule_tac s = "sa@s'" in obj2sobj_file_remains_app', simp_all)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1819
    obtain e \<tau> where ev: "e = CreateFile p (new_childf pf \<tau>)" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1820
      and tau: "\<tau>=sb@sa@s'" by auto
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1821
    
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1822
    have valid: "valid (e # \<tau>)" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1823
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1824
      have "os_grant \<tau> e"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1825
        using ev tau expab exf by (simp add:ncf_notin_curf ncf_parent)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1826
      moreover have "rc_grant \<tau> e" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1827
        using ev tau af'_cfd'(5,6) SPab SFab
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1828
        by (auto simp:etype_of_file_def cp2sproc.simps ncf_parent obj2sobj.simps
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1829
                split:if_splits option.splits t_rc_file_type.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1830
      ultimately show ?thesis using vsab tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1831
        by (rule_tac vs_step, simp+)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1832
    qed  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1833
    have nodel: "no_del_event (e#\<tau>)" using nodelab tau ev by simp  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1834
    have exobj': "exists (e#\<tau>) obj'" using exsoab valid ev tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1835
        by (case_tac obj', simp+)   moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1836
    have "obj2sobj (e#\<tau>) obj' = sobj'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1837
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1838
      have "\<And> f. obj' = File f \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1839
        using soab tau valid notUkn nodel ev exsoab
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1840
        by (auto  intro!:obj2sobj_file_remains' simp:ncf_notin_curf)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1841
      moreover have "\<And> i. obj' = IPC i \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'"  
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1842
        using soab tau valid notUkn nodel ev exsoab
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1843
        by (auto intro!:obj2sobj_ipc_remains' simp:ncf_notin_curf)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1844
      moreover have "\<And> p. obj' = Proc p \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'"  
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1845
        using soab tau valid notUkn nodel ev exsoab
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1846
        by (auto simp:obj2sobj.simps cp2sproc_simps' 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1847
             simp del:cp2sproc.simps split:option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1848
      ultimately show ?thesis by (case_tac obj', auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1849
    qed  moreover 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1850
    have "initp_intact (e#\<tau>)" using intactab tau ev valid nodel
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1851
      by (simp add:initp_intact_I_others)  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1852
    have "obj2sobj (e#\<tau>) (File (new_childf pf \<tau>)) = SFile (t, sd) None"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1853
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1854
      have "etype_of_file (e#\<tau>) (new_childf pf \<tau>) = Some t"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1855
      proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1856
        have "etype_of_file (e#\<tau>) (new_childf pf \<tau>) = etype_of_file \<tau> pf"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1857
          using ev tau SPab af'_cfd'(5) 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1858
          by (auto simp:obj2sobj.simps cp2sproc.simps ncf_parent etype_of_file_def
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1859
            split:option.splits   intro!:etype_aux_prop3)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1860
        thus ?thesis using SFab tau ev
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1861
          by (auto simp:obj2sobj.simps split:option.splits if_splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1862
      qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1863
      moreover have "source_dir (e#\<tau>) (new_childf pf \<tau>) = Some sd"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1864
        using ev tau SFab SPab valid ncf_parent
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1865
        by (auto simp:source_dir_simps obj2sobj.simps 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1866
                split:if_splits option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1867
      ultimately show ?thesis  using nodel ncf_notin_curf[where s = \<tau>]
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1868
        nodel_imp_exists[where obj = "File (new_childf pf \<tau>)" and s =\<tau>]
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1869
        by (auto simp:obj2sobj.simps dest:no_del_event_cons_D)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1870
    qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1871
    ultimately show "\<exists>s obj. valid (s @ s') \<and> obj2sobj (s @ s') obj' = sobj' \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1872
      exists (s @ s') obj' \<and> no_del_event (s @ s') \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1873
      initp_intact_but (s @ s') (SFile (t, sd) None) \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1874
      obj2sobj (s @ s') obj = SFile (t, sd) None \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1875
      exists (s @ s') obj \<and> sobj_source_eq_obj (SFile (t, sd) None) obj"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1876
      using tau ev
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1877
      apply (rule_tac x = "e#sb@sa" in exI)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1878
      by (rule_tac x = "File (new_childf pf \<tau>)" in exI, auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1879
  qed 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1880
next
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1881
  case (ai'_init i t) 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1882
  hence initi: "i \<in> init_ipcs" using init_ipc_has_type
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1883
    by (simp add:bidirect_in_init_def)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1884
  show ?case 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1885
  proof (rule allI|rule impI|erule conjE)+
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1886
    fix s' obj' sobj'
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1887
    assume vss': "valid s'" and sobjs': "obj2sobj s' obj' = sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1888
      and nodels': "no_del_event s'"and intacts':"initp_intact s'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1889
      and notboth: "not_both_sproc (SIPC t (Some i)) sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1890
      and exso': "exists s' obj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1891
    from nodels' initi have exi: "i \<in> current_ipcs s'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1892
      by (drule_tac obj = "IPC i" in nodel_imp_exists, simp+)    
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1893
    have "obj2sobj s' (IPC i) = SIPC t (Some i)"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1894
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1895
      have "obj2sobj [] (IPC i) = SIPC t (Some i)"  
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1896
        using ai'_init initi by (auto simp:obj2sobj.simps)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1897
      thus ?thesis using vss' exi nodels' initi
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1898
        by (drule_tac obj2sobj_ipc_remains'', auto simp:obj2sobj.simps)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1899
    qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1900
    thus "\<exists>s obj. valid (s @ s') \<and> obj2sobj (s @ s') obj' = sobj' \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1901
             exists (s @ s') obj' \<and> no_del_event (s @ s') \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1902
             initp_intact_but (s @ s') (SIPC t (Some i)) \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1903
             obj2sobj (s @ s') obj = SIPC t (Some i) \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1904
             exists (s @ s') obj \<and> sobj_source_eq_obj (SIPC t (Some i)) obj"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1905
      apply (rule_tac x = "[]" in exI, rule_tac x = "IPC i" in exI)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1906
      by (simp add:vss' sobjs' nodels' intacts' exi exso' del:obj2sobj.simps)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1907
  qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1908
next
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1909
  case (ai'_cipc r fr pt u srp)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1910
  show ?case
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1911
  proof (rule allI|rule impI|erule conjE)+
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1912
    fix s' obj' sobj'
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1913
    assume "valid s'" and "obj2sobj s' obj' = sobj'" and "no_del_event s'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1914
      and Both:"not_both_sproc (SIPC (default_ipc_create_type r) None) sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1915
      and "initp_intact s'" and notUkn: "sobj' \<noteq> Unknown" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1916
      and exobj':"exists s' obj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1917
    with ai'_cipc(1) notUkn obtain s p where
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1918
      SPab: "obj2sobj (s@s') (Proc p) = SProc (r,fr,pt,u) srp" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1919
      expab: "exists (s@s') (Proc p)" and vsab: "valid (s@s')" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1920
      soab: "obj2sobj (s@s') obj' = sobj'" and 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1921
      exsoab: "exists (s@s') obj'" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1922
      intactab: "initp_intact (s@s')" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1923
      nodelab: "no_del_event (s@s')"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1924
      apply (drule_tac s'= "s'" and obj' = obj' in all_sobjs_E0, auto) 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1925
      apply (frule obj2sobj_proc, erule exE)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1926
      by (auto intro:nodel_exists_remains)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1927
    obtain e \<tau> where ev: "e = CreateIPC p (new_ipc \<tau>)" and tau: "\<tau>=s@s'" by auto
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1928
    
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1929
    have valid: "valid (e # \<tau>)" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1930
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1931
      have "os_grant \<tau> e"
6
4294abb1f38c update scripts with no new_* in admissable-check
chunhan
parents: 1
diff changeset
  1932
        using ev tau expab by (simp add:ni_notin_curi)
1
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1933
      moreover have "rc_grant \<tau> e" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1934
        using ev tau ai'_cipc(3) SPab
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1935
        by (auto simp:cp2sproc.simps obj2sobj.simps split:option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1936
      ultimately show ?thesis using vsab tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1937
        by (rule_tac vs_step, simp+)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1938
    qed  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1939
    have nodel: "no_del_event (e#\<tau>)" using nodelab tau ev by simp  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1940
    have exobj': "exists (e#\<tau>) obj'" using exsoab valid ev tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1941
        by (case_tac obj', simp+)   moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1942
    have "obj2sobj (e#\<tau>) obj' = sobj'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1943
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1944
      have "\<And> f. obj' = File f \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1945
        using soab tau valid notUkn nodel ev exsoab
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1946
        by (auto  intro!:obj2sobj_file_remains' simp:ncf_notin_curf)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1947
      moreover have "\<And> i. obj' = IPC i \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'"  
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1948
        using soab tau valid notUkn nodel ev exsoab
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1949
        by (auto intro!:obj2sobj_ipc_remains' simp:ncf_notin_curf)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1950
      moreover have "\<And> p. obj' = Proc p \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'"  
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1951
        using soab tau valid notUkn nodel ev exsoab
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1952
        by (auto simp:obj2sobj.simps cp2sproc_simps' 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1953
             simp del:cp2sproc.simps split:option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1954
      ultimately show ?thesis by (case_tac obj', auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1955
    qed  moreover 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1956
    have "initp_intact (e#\<tau>)" using intactab tau ev valid nodel
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1957
      by (simp add:initp_intact_I_others)  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1958
    have "obj2sobj (e#\<tau>) (IPC (new_ipc \<tau>)) = SIPC (default_ipc_create_type r) None"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1959
      using ev tau SPab nodel 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1960
        nodel_imp_exists[where obj = "IPC (new_ipc \<tau>)" and s =\<tau>]
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1961
      by (auto simp:obj2sobj.simps ni_notin_curi cp2sproc.simps 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1962
              split:option.splits  dest:no_del_event_cons_D)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1963
    ultimately show "\<exists>s obj. valid (s @ s') \<and> obj2sobj (s @ s') obj' = sobj' \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1964
      exists (s @ s') obj' \<and> no_del_event (s @ s') \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1965
      initp_intact_but (s @ s') (SIPC (default_ipc_create_type r) None) \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1966
      obj2sobj (s @ s') obj = SIPC (default_ipc_create_type r) None \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1967
      exists (s @ s') obj \<and> sobj_source_eq_obj (SIPC (default_ipc_create_type r) None) obj"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1968
      using tau ev
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1969
      by (rule_tac x = "e#s" in exI, rule_tac x = "IPC (new_ipc \<tau>)" in exI, auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1970
  qed 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1971
next
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1972
  case (ap'_init p r fr t u)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1973
  hence initp: "p \<in> init_processes" using init_proc_has_role
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1974
    by (simp add:bidirect_in_init_def)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1975
  show ?case
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1976
  proof (rule allI|rule impI|erule conjE)+
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1977
    fix s' obj' sobj'
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1978
    assume VSs': "valid s'" and SOs': "obj2sobj s' obj' = sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1979
      and Nodels': "no_del_event s'"and Intacts':"initp_intact s'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1980
      and notboth: "not_both_sproc (SProc (r,fr,t,u) (Some p)) sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1981
      and exso': "exists s' obj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1982
    from Nodels' initp have exp: "p \<in> current_procs s'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1983
      apply (drule_tac obj = "Proc p" in nodel_imp_un_deleted)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1984
      by (drule not_deleted_imp_exists, simp+)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1985
    with Intacts' initp ap'_init 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1986
    have "obj2sobj s' (Proc p) = SProc (r, fr, t, u) (Some p)"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1987
      by (auto simp:initp_intact_def split:option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1988
    thus "\<exists>s obj. valid (s @ s') \<and> obj2sobj (s @ s') obj' = sobj' \<and> 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1989
             exists (s @ s') obj' \<and> no_del_event (s @ s') \<and> 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1990
             initp_intact_but (s @ s') (SProc (r, fr, t, u) (Some p)) \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1991
             obj2sobj (s @ s') obj = SProc (r, fr, t, u) (Some p) \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1992
             exists (s @ s') obj \<and> 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1993
             sobj_source_eq_obj (SProc (r, fr, t, u) (Some p)) obj"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1994
      apply (rule_tac x = "[]" in exI, rule_tac x = "Proc p" in exI)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1995
      by (simp add:VSs' SOs' Nodels' Intacts' initp intact_imp_butp exp exso' 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1996
               del:obj2sobj.simps)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1997
  qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1998
next
dcde836219bc add thy files
chunhan
parents:
diff changeset
  1999
  case (ap'_crole r fr t u srp r')
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2000
  show ?case 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2001
  proof (rule allI|rule impI|erule conjE)+
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2002
    fix s' obj' sobj'
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2003
    assume "valid s'" and "obj2sobj s' obj' = sobj'" and "no_del_event s'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2004
      and Both:"not_both_sproc (SProc (r', fr, t, u) srp) sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2005
      and "initp_intact s'" and notUkn: "sobj' \<noteq> Unknown" and "exists s' obj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2006
    with ap'_crole(1,2) obtain s p where
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2007
      VSab: "valid (s@s')" and SOab': "obj2sobj (s@s') obj' = sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2008
      and nodelab: "no_del_event (s@s')"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2009
      and butab: "initp_intact_but (s@s') (SProc (r, fr, t, u) srp)"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2010
      and SPab: "obj2sobj (s@s') (Proc p) = SProc (r, fr, t, u) srp"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2011
      and exp:"exists (s@s') (Proc p)" and exobj':"exists (s@s') obj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2012
      and sreq: "sobj_source_eq_obj (SProc (r, fr, t, u) srp) (Proc p)"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2013
      by (blast dest:not_both_I obj2sobj_proc intro:nodel_exists_remains)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2014
    from VSab SPab sreq exp have srpeq: "srp = Some p" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2015
      by (simp add:proc_source_eq_prop)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2016
    with exp VSab SPab have initp: "p \<in> init_processes"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2017
      by (auto dest:source_proc_in_init simp:obj2sobj.simps split:option.splits) 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2018
    obtain e \<tau> where ev: "e = ChangeRole p r'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2019
      and tau: "\<tau> = Clone p (new_proc (s@s'))#s@s'" by auto
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2020
    hence vs_tau:"valid \<tau>" using exp VSab by (auto intro:clone_event_no_limit)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2021
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2022
    have valid: "valid (e#\<tau>)" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2023
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2024
      have "os_grant \<tau> e"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2025
        using ev tau exp by (simp)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2026
      moreover have "rc_grant \<tau> e" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2027
        using ev tau ap'_crole(3) SPab 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2028
        by (auto simp:cp2sproc.simps obj2sobj.simps split:option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2029
      ultimately show ?thesis using vs_tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2030
        by (erule_tac vs_step, simp+)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2031
    qed  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2032
    have nodel: "no_del_event (e#\<tau>)" using nodelab tau ev by simp  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2033
    have "initp_intact_but (e#\<tau>) (SProc (r', fr, t, u) srp)"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2034
      using butab tau ev valid initp srpeq nodel
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2035
      by (simp add:initp_intact_butp_I_crole)  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2036
    have exobj': "exists (e#\<tau>) obj'" using exobj' valid ev tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2037
      by (case_tac obj', simp+)  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2038
    have "obj2sobj (e#\<tau>) obj' = sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2039
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2040
      have "\<And> f. obj' = File f \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2041
        using SOab' tau ev valid notUkn nodel exobj'
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2042
        obj2sobj_file_remains''[where s'="[e,Clone p (new_proc (s @ s'))]"]
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2043
        by (auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2044
      moreover have "\<And> i. obj' = IPC i \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2045
        using SOab' tau ev valid notUkn nodel exobj'
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2046
        obj2sobj_ipc_remains''[where s'="[e,Clone p (new_proc (s @ s'))]"]
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2047
        by auto
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2048
      moreover have "\<And> p. obj' = Proc p \<Longrightarrow>False"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2049
        using Both SOab' notUkn 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2050
        by (simp del:obj2sobj.simps, drule_tac obj2sobj_proc', auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2051
      ultimately show ?thesis by (case_tac obj', auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2052
    qed  moreover 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2053
    have "obj2sobj (e#\<tau>) (Proc p) = SProc (r', fr, t, u) srp"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2054
      using SPab tau vs_tau ev valid
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2055
      by (auto simp:obj2sobj.simps cp2sproc_simps' simp del:cp2sproc.simps
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2056
              split:option.splits)  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2057
    have "exists (e#\<tau>) (Proc p)" using exp tau ev by simp   moreover 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2058
    have "sobj_source_eq_obj (SProc (r', fr, t, u) srp) (Proc p)"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2059
      using sreq by (case_tac srp, simp+)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2060
    ultimately show "\<exists>s obj. valid (s @ s') \<and> obj2sobj (s @ s') obj' = sobj' \<and> 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2061
      exists (s @ s') obj' \<and> no_del_event (s @ s') \<and> 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2062
      initp_intact_but (s @ s') (SProc (r', fr, t, u) srp) \<and> 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2063
      obj2sobj (s @ s') obj = SProc (r', fr, t, u) srp \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2064
      exists (s @ s') obj \<and> sobj_source_eq_obj (SProc (r', fr, t, u) srp) obj"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2065
      using ev tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2066
      apply (rule_tac x = "e # Clone p (new_proc (s @ s')) # s" in exI)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2067
      by (rule_tac x = "Proc p" in exI, auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2068
  qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2069
next
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2070
  case (ap'_chown r fr t u srp u' nr)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2071
  show ?case 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2072
  proof (rule allI|rule impI|erule conjE)+
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2073
    fix s' obj' sobj'
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2074
    assume "valid s'" and "obj2sobj s' obj' = sobj'" and "no_del_event s'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2075
      and Both:"not_both_sproc (SProc (nr,fr,chown_type_aux r nr t,u') srp) sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2076
      and "initp_intact s'" and notUkn: "sobj' \<noteq> Unknown" and "exists s' obj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2077
    with ap'_chown(1,2) obtain s p where
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2078
      VSab: "valid (s@s')" and SOab': "obj2sobj (s@s') obj' = sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2079
      and nodelab: "no_del_event (s@s')"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2080
      and butab: "initp_intact_but (s@s') (SProc (r, fr, t, u) srp)"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2081
      and SPab: "obj2sobj (s@s') (Proc p) = SProc (r, fr, t, u) srp"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2082
      and exp:"exists (s@s') (Proc p)" and exobj':"exists (s@s') obj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2083
      and sreq: "sobj_source_eq_obj (SProc (r, fr, t, u) srp) (Proc p)"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2084
      by (blast dest:not_both_I obj2sobj_proc intro:nodel_exists_remains)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2085
    from VSab SPab sreq exp have srpeq: "srp = Some p" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2086
      by (simp add:proc_source_eq_prop)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2087
    with exp VSab SPab have initp: "p \<in> init_processes"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2088
      by (auto dest:source_proc_in_init simp:obj2sobj.simps split:option.splits) 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2089
    obtain e \<tau> where ev: "e = ChangeOwner p u'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2090
      and tau: "\<tau> = Clone p (new_proc (s@s'))#s@s'" by auto
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2091
    hence vs_tau:"valid \<tau>" using exp VSab by (auto intro:clone_event_no_limit)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2092
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2093
    have valid: "valid (e#\<tau>)" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2094
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2095
      have "os_grant \<tau> e"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2096
        using ev tau exp ap'_chown(3) by (simp)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2097
      moreover have "rc_grant \<tau> e" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2098
        using ev tau ap'_chown(5) SPab 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2099
        by (auto simp:cp2sproc.simps obj2sobj.simps pct_def clone_type_unchange
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2100
                split:option.splits t_rc_proc_type.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2101
          (* here is another place of no_limit of clone event assumption *)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2102
      ultimately show ?thesis using vs_tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2103
        by (erule_tac vs_step, simp+)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2104
    qed  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2105
    have nodel: "no_del_event (e#\<tau>)" using nodelab tau ev by simp  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2106
    have "initp_intact_but (e#\<tau>) (SProc (nr,fr,chown_type_aux r nr t,u') srp)"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2107
      using butab tau ev valid initp srpeq nodel
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2108
      by (simp add:initp_intact_butp_I_chown)  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2109
    have exobj': "exists (e#\<tau>) obj'" using exobj' valid ev tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2110
      by (case_tac obj', simp+)  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2111
    have "obj2sobj (e#\<tau>) obj' = sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2112
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2113
      have "\<And> f. obj' = File f \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2114
        using SOab' tau ev valid notUkn nodel exobj'
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2115
        obj2sobj_file_remains''[where s'="[e,Clone p (new_proc (s @ s'))]"]
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2116
        by (auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2117
      moreover have "\<And> i. obj' = IPC i \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2118
        using SOab' tau ev valid notUkn nodel exobj'
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2119
        obj2sobj_ipc_remains''[where s'="[e,Clone p (new_proc (s @ s'))]"]
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2120
        by auto
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2121
      moreover have "\<And> p. obj' = Proc p \<Longrightarrow>False"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2122
        using Both SOab' notUkn 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2123
        by (simp del:obj2sobj.simps, drule_tac obj2sobj_proc', auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2124
      ultimately show ?thesis by (case_tac obj', auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2125
    qed  moreover 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2126
    have "obj2sobj (e#\<tau>) (Proc p) = SProc (nr,fr,chown_type_aux r nr t,u') srp"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2127
      using SPab tau vs_tau ev valid ap'_chown(4)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2128
      by (auto simp:obj2sobj.simps cp2sproc_simps' simp del:cp2sproc.simps
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2129
              split:option.splits)  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2130
    have "exists (e#\<tau>) (Proc p)" using exp tau ev by simp   moreover 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2131
    have "sobj_source_eq_obj (SProc (nr,fr,chown_type_aux r nr t,u') srp) (Proc p)"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2132
      using sreq by (case_tac srp, simp+)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2133
    ultimately show "\<exists>s obj. valid (s @ s') \<and> obj2sobj (s @ s') obj' = sobj' \<and> 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2134
      exists (s @ s') obj' \<and> no_del_event (s @ s') \<and> 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2135
      initp_intact_but (s @ s') (SProc (nr,fr,chown_type_aux r nr t,u') srp) \<and> 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2136
      obj2sobj (s @ s') obj = SProc (nr,fr,chown_type_aux r nr t,u') srp \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2137
      exists (s @ s') obj \<and> sobj_source_eq_obj (SProc (nr,fr,chown_type_aux r nr t,u') srp) obj"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2138
      using ev tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2139
      apply (rule_tac x = "e # Clone p (new_proc (s @ s')) # s" in exI)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2140
      by (rule_tac x = "Proc p" in exI, auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2141
  qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2142
next
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2143
  case (ap'_exec r fr pt u sp t sd sf r' fr')
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2144
  show ?case
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2145
  proof (rule allI|rule impI|erule conjE)+
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2146
    fix s' obj' sobj'
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2147
    assume "valid s'" and "obj2sobj s' obj' = sobj'" and "no_del_event s'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2148
      and Both:"not_both_sproc (SProc (r', fr', exec_type_aux r pt, u) sp) sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2149
      and "initp_intact s'" and notUkn: "sobj' \<noteq> Unknown" and "exists s' obj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2150
    with ap'_exec(3,4) obtain sa f where
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2151
      SFa: "obj2sobj (sa @ s') (File f) = SFile (t, sd) sf" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2152
      Exfa: "exists (sa @ s') (File f)" and 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2153
      buta: "initp_intact (sa @ s')" and
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2154
      othersa:"valid (sa @ s') \<and> obj2sobj (sa @ s') obj' = sobj' \<and> exists (sa @s') obj' \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2155
      no_del_event (sa @ s') \<and> sobj_source_eq_obj (SFile (t, sd) sf) (File f)" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2156
      apply (simp only:not_both_sproc.simps)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2157
      apply (erule_tac x = s' in allE, erule_tac x = obj' in allE)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2158
      apply (erule_tac x = sobj' in allE, auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2159
      by (frule obj2sobj_file, auto intro:nodel_exists_remains)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2160
    with SFa Exfa othersa ap'_exec(1,2) Both notUkn obtain sb p where
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2161
      VSab: "valid (sb@sa@s')" and SOab': "obj2sobj (sb@sa@s') obj' = sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2162
      and nodelab: "no_del_event (sb@sa@s')"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2163
      and butab: "initp_intact_but (sb@sa@s') (SProc (r, fr, pt, u) sp)"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2164
      and SPab: "obj2sobj (sb@sa@s') (Proc p) = SProc (r, fr, pt, u) sp"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2165
      and exp:"exists (sb@sa@s') (Proc p)" and exobj':"exists (sb@sa@s') obj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2166
      and sreq: "sobj_source_eq_obj (SProc (r, fr, pt, u) sp) (Proc p)"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2167
      by (blast dest:not_both_I obj2sobj_proc intro:nodel_exists_remains)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2168
    from VSab SPab sreq exp have srpeq: "sp = Some p" by (simp add:proc_source_eq_prop)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2169
    with exp VSab SPab have initp: "p \<in> init_processes"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2170
      by (auto dest:source_proc_in_init simp:obj2sobj.simps split:option.splits) 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2171
    obtain e \<tau> where ev: "e = Execute p f" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2172
      and tau: "\<tau> = Clone p (new_proc (sb@sa@s'))#sb@sa@s'" by auto
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2173
    hence vs_tau:"valid \<tau>" using exp VSab by (auto intro:clone_event_no_limit)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2174
    from Exfa nodelab have exf:"f \<in> current_files (sb@sa@s')" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2175
      apply (drule_tac obj = "File f" in nodel_imp_un_deleted)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2176
      by (drule_tac s' = "sb" in not_deleted_imp_exists', auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2177
    from SFa VSab Exfa nodelab have SFab: "obj2sobj (sb@sa@s') (File f) = SFile (t,sd) sf"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2178
      by (rule_tac s = "sa@s'" in obj2sobj_file_remains'', simp_all)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2179
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2180
    have valid: "valid (e#\<tau>)" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2181
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2182
      have "os_grant \<tau> e"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2183
        using ev tau exp by (simp add:exf)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2184
      moreover have "rc_grant \<tau> e" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2185
        using ev tau ap'_exec(5) SPab SFab
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2186
        by (auto simp:etype_of_file_def cp2sproc.simps obj2sobj.simps
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2187
                split:if_splits option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2188
      ultimately show ?thesis using vs_tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2189
        by (erule_tac vs_step, simp+)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2190
    qed  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2191
    have nodel: "no_del_event (e#\<tau>)" using nodelab tau ev by simp  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2192
    have "initp_intact_but (e#\<tau>) (SProc (r', fr', exec_type_aux r pt, u) sp)"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2193
      using butab tau ev valid initp srpeq nodel
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2194
      by (simp add:initp_intact_butp_I_exec)  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2195
    have exobj': "exists (e#\<tau>) obj'" using exobj' valid ev tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2196
      by (case_tac obj', simp+) moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2197
    have "obj2sobj (e#\<tau>) obj' = sobj'"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2198
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2199
      have "\<And> f. obj' = File f \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2200
        using SOab' tau ev valid notUkn nodel exobj'
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2201
        obj2sobj_file_remains''[where s'="[e,Clone p (new_proc (sb @ sa @ s'))]"]
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2202
        by (auto simp del:obj2sobj.simps)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2203
      moreover have "\<And> i. obj' = IPC i \<Longrightarrow> obj2sobj (e#\<tau>) obj' = sobj'" 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2204
        using SOab' tau ev valid notUkn nodel exobj'
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2205
        obj2sobj_ipc_remains''[where s'="[e,Clone p (new_proc (sb @ sa @ s'))]"]
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2206
        by (auto simp del:obj2sobj.simps)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2207
      moreover have "\<And> p. obj' = Proc p \<Longrightarrow>False"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2208
        using Both SOab' notUkn 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2209
        by (simp del:obj2sobj.simps, drule_tac obj2sobj_proc', auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2210
      ultimately show ?thesis by (case_tac obj', auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2211
    qed  moreover 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2212
    have "obj2sobj (e#\<tau>) (Proc p) = SProc (r',fr',exec_type_aux r pt, u) sp"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2213
    proof-
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2214
      have "obj2sobj \<tau> (Proc p) = SProc (r,fr,pt,u) sp" using SPab tau vs_tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2215
        by (auto split:option.splits simp:cp2sproc_simps' obj2sobj.simps)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2216
      moreover have "source_dir \<tau> f = Some sd" using vs_tau SFab tau 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2217
        by (auto simp:source_dir_simps obj2sobj.simps split:option.splits if_splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2218
      ultimately show ?thesis using valid ev ap'_exec(6,7) 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2219
        by (auto simp:cp2sproc_exec obj2sobj.simps split:option.splits)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2220
    qed  moreover
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2221
    have "exists (e#\<tau>) (Proc p)" using exp tau ev by simp   moreover 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2222
    have "sobj_source_eq_obj (SProc (r',fr',exec_type_aux r pt,u) sp) (Proc p)"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2223
      using sreq by (case_tac sp, simp+)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2224
    ultimately 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2225
    show "\<exists>s obj. valid (s @ s') \<and> obj2sobj (s @ s') obj' = sobj' \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2226
      exists (s @ s') obj' \<and> no_del_event (s @ s') \<and> 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2227
      initp_intact_but (s @ s') (SProc (r', fr', exec_type_aux r pt, u) sp) \<and> 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2228
      obj2sobj (s @ s') obj = SProc (r', fr', exec_type_aux r pt, u) sp \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2229
      exists (s @ s') obj \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2230
      sobj_source_eq_obj (SProc (r', fr', exec_type_aux r pt, u) sp) obj"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2231
      using ev tau
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2232
      apply (rule_tac x = "e#Clone p (new_proc (sb @ sa @ s')) #sb@sa" in exI)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2233
      by (rule_tac x = "Proc p" in exI, auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2234
  qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2235
qed
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2236
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2237
lemma all_sobjs_E2: 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2238
  "\<lbrakk>sobj \<in> all_sobjs'; valid s'; obj2sobj s' obj' = sobj'; exists s' obj'; sobj' \<noteq> Unknown; 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2239
    not_both_sproc sobj sobj'; no_del_event s'; initp_intact s'\<rbrakk>
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2240
   \<Longrightarrow> \<exists> s obj. valid (s @ s') \<and> obj2sobj (s @ s') obj' = sobj' \<and> exists (s@s') obj \<and>
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2241
                no_del_event (s @ s') \<and> initp_intact_but (s @ s') sobj \<and> 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2242
                obj2sobj (s @ s') obj = sobj \<and> exists (s @ s') obj \<and> 
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2243
                sobj_source_eq_obj sobj obj"
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2244
by (drule all_sobjs_E2_aux, auto)
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2245
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2246
end
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2247
dcde836219bc add thy files
chunhan
parents:
diff changeset
  2248
end