theory Detype_R

lemma modify_pde_pspace_aligned':
  "\<lbrace>pde_at' ptr and pspace_aligned'\<rbrace>
   modify (ksPSpace_update (\<lambda>ps. ps(ptr \<mapsto> KOArch (KOPDE new_pde))))
   \<lbrace>\<lambda>a. pspace_aligned'\<rbrace>" apply (clarsimp simp: simpler_modify_def ko_wp_at'_def valid_def typ_at'_def) apply (case_tac ko,simp_all) apply (rename_tac arch_kernel_object) apply (case_tac arch_kernel_object,simp_all) apply (subst pspace_aligned'_def) apply (intro ballI) apply (erule domE) apply (clarsimp split:if_splits) apply (drule(1) pspace_alignedD') apply (simp add:objBits_simps archObjSize_def) apply (simp add:ps_clear_def) apply (drule_tac x = x in pspace_alignedD') apply simp apply simp done

(* Proof state trace *)
proof (prove)
goal (1 subgoal):
 1. \<lbrace>pde_at' ptr and pspace_aligned'\<rbrace> modify (ksPSpace_update (\<lambda>ps. ps(ptr \<mapsto> KOArch (KOPDE new_pde)))) \<lbrace>\<lambda>a. pspace_aligned'\<rbrace> proof (prove)
goal (1 subgoal):
 1. \<And>s ko. \<lbrakk>pspace_aligned' s; ksPSpace s ptr = Some ko; is_aligned ptr (objBitsKO ko); koTypeOf ko = ArchT PDET; ps_clear ptr (objBitsKO ko) s\<rbrakk> \<Longrightarrow> pspace_aligned' (ksPSpace_update (\<lambda>ps. ps(ptr \<mapsto> KOArch (KOPDE new_pde))) s) proof (prove)
goal (1 subgoal):
 1. \<And>s ko x8. \<lbrakk>pspace_aligned' s; ksPSpace s ptr = Some (KOArch x8); is_aligned ptr (objBitsKO (KOArch x8)); archTypeOf x8 = PDET; ps_clear ptr (objBitsKO (KOArch x8)) s; ko = KOArch x8\<rbrakk> \<Longrightarrow> pspace_aligned' (ksPSpace_update (\<lambda>ps. ps(ptr \<mapsto> KOArch (KOPDE new_pde))) s) proof (prove)
goal (1 subgoal):
 1. \<And>s ko arch_kernel_object. \<lbrakk>pspace_aligned' s; ksPSpace s ptr = Some (KOArch arch_kernel_object); is_aligned ptr (objBitsKO (KOArch arch_kernel_object)); archTypeOf arch_kernel_object = PDET; ps_clear ptr (objBitsKO (KOArch arch_kernel_object)) s; ko = KOArch arch_kernel_object\<rbrakk> \<Longrightarrow> pspace_aligned' (ksPSpace_update (\<lambda>ps. ps(ptr \<mapsto> KOArch (KOPDE new_pde))) s) proof (prove)
goal (1 subgoal):
 1. \<And>s ko arch_kernel_object x3. \<lbrakk>pspace_aligned' s; ksPSpace s ptr = Some (KOArch (KOPDE x3)); is_aligned ptr (objBitsKO (KOArch (KOPDE x3))); ps_clear ptr (objBitsKO (KOArch (KOPDE x3))) s; ko = KOArch (KOPDE x3); arch_kernel_object = KOPDE x3\<rbrakk> \<Longrightarrow> pspace_aligned' (ksPSpace_update (\<lambda>ps. ps(ptr \<mapsto> KOArch (KOPDE new_pde))) s) proof (prove)
goal (1 subgoal):
 1. \<And>s ko arch_kernel_object x3. \<lbrakk>pspace_aligned' s; ksPSpace s ptr = Some (KOArch (KOPDE x3)); is_aligned ptr (objBitsKO (KOArch (KOPDE x3))); ps_clear ptr (objBitsKO (KOArch (KOPDE x3))) s; ko = KOArch (KOPDE x3); arch_kernel_object = KOPDE x3\<rbrakk> \<Longrightarrow> \<forall>x\<in>dom (ksPSpace (ksPSpace_update (\<lambda>ps. ps(ptr \<mapsto> KOArch (KOPDE new_pde))) s)). is_aligned x (objBitsKO (the (ksPSpace (ksPSpace_update (\<lambda>ps. ps(ptr \<mapsto> KOArch (KOPDE new_pde))) s) x))) proof (prove)
goal (1 subgoal):
 1. \<And>s ko arch_kernel_object x3 x. \<lbrakk>pspace_aligned' s; ksPSpace s ptr = Some (KOArch (KOPDE x3)); is_aligned ptr (objBitsKO (KOArch (KOPDE x3))); ps_clear ptr (objBitsKO (KOArch (KOPDE x3))) s; ko = KOArch (KOPDE x3); arch_kernel_object = KOPDE x3; x \<in> dom (ksPSpace (ksPSpace_update (\<lambda>ps. ps(ptr \<mapsto> KOArch (KOPDE new_pde))) s))\<rbrakk> \<Longrightarrow> is_aligned x (objBitsKO (the (ksPSpace (ksPSpace_update (\<lambda>ps. ps(ptr \<mapsto> KOArch (KOPDE new_pde))) s) x))) proof (prove)
goal (1 subgoal):
 1. \<And>s ko arch_kernel_object x3 x r. \<lbrakk>pspace_aligned' s; ksPSpace s ptr = Some (KOArch (KOPDE x3)); is_aligned ptr (objBitsKO (KOArch (KOPDE x3))); ps_clear ptr (objBitsKO (KOArch (KOPDE x3))) s; ko = KOArch (KOPDE x3); arch_kernel_object = KOPDE x3; ksPSpace (ksPSpace_update (\<lambda>ps. ps(ptr \<mapsto> KOArch (KOPDE new_pde))) s) x = Some r\<rbrakk> \<Longrightarrow> is_aligned x (objBitsKO (the (ksPSpace (ksPSpace_update (\<lambda>ps. ps(ptr \<mapsto> KOArch (KOPDE new_pde))) s) x))) proof (prove)
goal (2 subgoals):
 1. \<And>s x3. \<lbrakk>pspace_aligned' s; ksPSpace s ptr = Some (KOArch (KOPDE x3)); is_aligned ptr (objBitsKO (KOArch (KOPDE x3))); ps_clear ptr (objBitsKO (KOArch (KOPDE x3))) s\<rbrakk> \<Longrightarrow> is_aligned ptr (objBitsKO (KOArch (KOPDE new_pde)))
 2. \<And>s x3 x r. \<lbrakk>pspace_aligned' s; ksPSpace s ptr = Some (KOArch (KOPDE x3)); is_aligned ptr (objBitsKO (KOArch (KOPDE x3))); ps_clear ptr (objBitsKO (KOArch (KOPDE x3))) s; x \<noteq> ptr; ksPSpace s x = Some r\<rbrakk> \<Longrightarrow> is_aligned x (objBitsKO r) proof (prove)
goal (2 subgoals):
 1. \<And>s x3. \<lbrakk>pspace_aligned' s; is_aligned ptr (objBitsKO (KOArch (KOPDE x3))); ps_clear ptr (objBitsKO (KOArch (KOPDE x3))) s; is_aligned ptr (objBitsKO (KOArch (KOPDE x3)))\<rbrakk> \<Longrightarrow> is_aligned ptr (objBitsKO (KOArch (KOPDE new_pde)))
 2. \<And>s x3 x r. \<lbrakk>pspace_aligned' s; ksPSpace s ptr = Some (KOArch (KOPDE x3)); is_aligned ptr (objBitsKO (KOArch (KOPDE x3))); ps_clear ptr (objBitsKO (KOArch (KOPDE x3))) s; x \<noteq> ptr; ksPSpace s x = Some r\<rbrakk> \<Longrightarrow> is_aligned x (objBitsKO r) proof (prove)
goal (1 subgoal):
 1. \<And>s x3 x r. \<lbrakk>pspace_aligned' s; ksPSpace s ptr = Some (KOArch (KOPDE x3)); is_aligned ptr (objBitsKO (KOArch (KOPDE x3))); ps_clear ptr (objBitsKO (KOArch (KOPDE x3))) s; x \<noteq> ptr; ksPSpace s x = Some r\<rbrakk> \<Longrightarrow> is_aligned x (objBitsKO r) proof (prove)
goal (1 subgoal):
 1. \<And>s x3 x r. \<lbrakk>pspace_aligned' s; ksPSpace s ptr = Some (KOArch (KOPDE x3)); is_aligned ptr (objBitsKO (KOArch (KOPDE x3))); ({ptr..ptr + 2 ^ objBitsKO (KOArch (KOPDE x3)) - 1} - {ptr}) \<inter> dom (ksPSpace s) = {}; x \<noteq> ptr; ksPSpace s x = Some r\<rbrakk> \<Longrightarrow> is_aligned x (objBitsKO r) proof (prove)
goal (2 subgoals):
 1. \<And>s x3 x r. \<lbrakk>pspace_aligned' s; ksPSpace s ptr = Some (KOArch (KOPDE x3)); is_aligned ptr (objBitsKO (KOArch (KOPDE x3))); ({ptr..ptr + 2 ^ objBitsKO (KOArch (KOPDE x3)) - 1} - {ptr}) \<inter> dom (ksPSpace s) = {}; x \<noteq> ptr\<rbrakk> \<Longrightarrow> pspace_aligned' s
 2. \<And>s x3 x r. \<lbrakk>pspace_aligned' s; ksPSpace s ptr = Some (KOArch (KOPDE x3)); is_aligned ptr (objBitsKO (KOArch (KOPDE x3))); ({ptr..ptr + 2 ^ objBitsKO (KOArch (KOPDE x3)) - 1} - {ptr}) \<inter> dom (ksPSpace s) = {}; x \<noteq> ptr; is_aligned x (objBitsKO r)\<rbrakk> \<Longrightarrow> is_aligned x (objBitsKO r) proof (prove)
goal (1 subgoal):
 1. \<And>s x3 x r. \<lbrakk>pspace_aligned' s; ksPSpace s ptr = Some (KOArch (KOPDE x3)); is_aligned ptr (objBitsKO (KOArch (KOPDE x3))); ({ptr..ptr + 2 ^ objBitsKO (KOArch (KOPDE x3)) - 1} - {ptr}) \<inter> dom (ksPSpace s) = {}; x \<noteq> ptr; is_aligned x (objBitsKO r)\<rbrakk> \<Longrightarrow> is_aligned x (objBitsKO r) proof (prove)
goal:
No subgoals!