theory Retype_C

lemma createObjects_ccorres_user_data_device:
  defines "ko \<equiv> KOUserDataDevice"
  shows "\<forall>\<sigma> x. (\<sigma>, x) \<in> rf_sr \<and> range_cover ptr sz (gbits + pageBits) n
  \<and> ptr \<noteq> 0
  \<and> pspace_aligned' \<sigma> \<and> pspace_distinct' \<sigma>
  \<and> pspace_no_overlap' ptr sz \<sigma>
  \<and> ret_zero ptr (n * 2 ^ (gbits + pageBits)) \<sigma>
  \<and> region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x
  \<and> {ptr ..+ n * (2 ^ (gbits + pageBits))} \<inter> kernel_data_refs = {}
  \<longrightarrow>
  (\<sigma>\<lparr>ksPSpace :=
               foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2^gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)\<rparr>,
           x\<lparr>globals := globals x\<lparr>t_hrs_' :=
                      hrs_htd_update
                       (ptr_retyps_gen (n * 2 ^ gbits) (Ptr ptr :: user_data_device_C ptr) arr)
                       (t_hrs_' (globals x))\<rparr> \<rparr>) \<in> rf_sr"
  (is "\<forall>\<sigma> x. ?P \<sigma> x \<longrightarrow>
    (\<sigma>\<lparr>ksPSpace := ?ks \<sigma>\<rparr>, x\<lparr>globals := globals x\<lparr>t_hrs_' := ?ks' x\<rparr>\<rparr>) \<in> rf_sr") proof (intro impI allI) fix \<sigma> x let ?thesis = "(\<sigma>\<lparr>ksPSpace := ?ks \<sigma>\<rparr>, x\<lparr>globals := globals x\<lparr>t_hrs_' := ?ks' x\<rparr>\<rparr>) \<in> rf_sr" let ?ks = "?ks \<sigma>" let ?ks' = "?ks' x" let ?ptr = "Ptr ptr :: user_data_device_C ptr" note Kernel_C.user_data_C_size [simp del] assume "?P \<sigma> x" hence rf: "(\<sigma>, x) \<in> rf_sr" and al: "is_aligned ptr (gbits + pageBits)"
    and ptr0: "ptr \<noteq> 0"
    and sz: "gbits + pageBits \<le> sz"
    and szb: "sz < word_bits"
    and pal: "pspace_aligned' \<sigma>" and pdst: "pspace_distinct' \<sigma>"
    and pno: "pspace_no_overlap' ptr sz \<sigma>"
    and rzo: "ret_zero ptr (n * 2 ^ (gbits + pageBits)) \<sigma>"
    and empty: "region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x"
    and rc: "range_cover ptr sz (gbits + pageBits) n"
    and rc': "range_cover ptr sz (objBitsKO ko) (n * 2^ gbits)"
    and kdr: "{ptr..+n * 2 ^ (gbits + pageBits)} \<inter> kernel_data_refs = {}" by (auto simp: range_cover.aligned objBits_simps  ko_def
                   range_cover_rel[where sbit' = pageBits]
                   range_cover.sz[where 'a=32, folded word_bits_def]) hence al': "is_aligned ptr (objBitsKO ko)" by (clarsimp dest!:is_aligned_weaken range_cover.aligned) note range_cover.no_overflow_n[OF rc'] hence sz_word_bits:
    "n * 2 ^ gbits * size_of TYPE(user_data_device_C)  < 2 ^ word_bits" by (simp add:word_bits_def objBits_simps ko_def pageBits_def) 

  (* This is a hack *)
   have mko: "\<And>dev. makeObjectKO True (Inr object_type.SmallPageObject) = Some ko" by (simp add: makeObjectKO_def ko_def) from sz have "2 \<le> sz" by (simp add: objBits_simps pageBits_def ko_def) hence sz2: "2 ^ (sz - 2) * 4 = (2 :: nat) ^ sz" apply (subgoal_tac "(4 :: nat) = 2 ^ 2") apply (erule ssubst) apply (subst power_add [symmetric]) apply (rule arg_cong [where f = "\<lambda>n. 2 ^ n"]) apply simp apply simp done have p2dist: "n * (2::nat) ^ (gbits + pageBits) = n * 2 ^ gbits * 2 ^ pageBits" (is "?lhs = ?rhs") by (simp add:monoid_mult_class.power_add) note blah[simp del] =  atLeastAtMost_iff atLeastatMost_subset_iff atLeastLessThan_iff
      Int_atLeastAtMost atLeastatMost_empty_iff split_paired_Ex 

  (* /obj specific *)

  (* s/obj/obj'/ *)

   have szo: "size_of TYPE(user_data_device_C) = 2 ^ objBitsKO ko" by (simp add: size_of_def objBits_simps archObjSize_def ko_def pageBits_def) have szo': "n * 2 ^ (gbits + pageBits) = n * 2 ^ gbits * size_of TYPE(user_data_device_C)" using sz apply (subst szo) apply (clarsimp simp: power_add[symmetric] objBits_simps ko_def) done have rb': "region_is_bytes ptr (n * 2 ^ gbits * 2 ^ objBitsKO ko) x" using empty by (simp add: mult.commute mult.left_commute power_add objBits_simps ko_def) from rb' have rbu: "region_is_bytes ptr (n * 2 ^ gbits * size_of TYPE(user_data_device_C)) x" by (simp add:szo[symmetric]) note rl' = clift_ptr_retyps_gen_other[where p = "Ptr ptr",simplified, OF rbu  sz_word_bits] 

  (* rest is generic *)

   note rl = projectKO_opt_retyp_other [OF rc' pal pno,unfolded ko_def] note cterl = retype_ctes_helper[OF pal pdst pno al' range_cover.sz(2)[OF rc'] range_cover.sz(1)[OF rc', folded word_bits_def] mko rc'] note ht_rl = clift_eq_h_t_valid_eq[OF rl', OF tag_disj_via_td_name, simplified] have guard:
    "\<forall>t<n * 2 ^ gbits. c_guard (CTypesDefs.ptr_add ?ptr (of_nat t))" apply (rule retype_guard_helper[OF rc' ptr0 szo,where m = 2]) apply (clarsimp simp: align_of_def objBits_simps ko_def pageBits_def)+ done have cud2: "\<And>xa v y.
              \<lbrakk> heap_to_device_data
                     (\<lambda>x. if x \<in> set (new_cap_addrs (n*2^gbits) ptr KOUserDataDevice)
                           then Some KOUserData else ksPSpace \<sigma> x)
                     (underlying_memory (ksMachineState \<sigma>)) xa =
              Some v; xa \<notin> set (new_cap_addrs (n*2^gbits) ptr KOUserDataDevice);
              heap_to_device_data (ksPSpace \<sigma>) (underlying_memory (ksMachineState \<sigma>)) xa = Some y \<rbrakk> \<Longrightarrow> y = v" using range_cover_intvl[OF rc] by (clarsimp simp add: heap_to_device_data_def Let_def sz2
      byte_to_word_heap_def[abs_def] map_comp_Some_iff projectKOs) note ptr_retyps_valid = h_t_valid_ptr_retyps_gen_same[OF guard rbu,unfolded addr_card_wb,OF _ sz_word_bits,simplified] from rf have "cpspace_relation (ksPSpace \<sigma>) (underlying_memory (ksMachineState \<sigma>)) (t_hrs_' (globals x))" unfolding rf_sr_def cstate_relation_def by (simp add: Let_def) hence "cpspace_relation ?ks (underlying_memory (ksMachineState \<sigma>)) ?ks'" unfolding cpspace_relation_def using empty rc' szo supply if_cong[cong] apply - apply (clarsimp simp: rl' tag_disj_via_td_name cte_C_size ht_rl
                          clift_ptr_retyps_gen_other
                          foldr_upd_app_if [folded data_map_insert_def]) apply (simp add: rl ko_def projectKOs p2dist
                     cterl[unfolded ko_def]) apply (rule cmap_relationI) apply (clarsimp simp: dom_heap_to_device_data cmap_relation_def dom_if image_Un
                           projectKO_opt_retyp_same projectKOs liftt_if[folded hrs_mem_def hrs_htd_def]
                           hrs_htd_update hrs_mem_update ptr_retyps_valid dom_disj_union
                simp flip: ptr_add_to_new_cap_addrs) apply (simp add: heap_to_device_data_def cuser_user_data_device_relation_def) done  (* dont need to track all the device memory *)

   thus  ?thesis using rf empty kdr rzo apply (simp add: rf_sr_def cstate_relation_def Let_def rl' tag_disj_via_td_name ) apply (simp add: carch_state_relation_def cmachine_state_relation_def) apply (simp add: tag_disj_via_td_name rl' tcb_C_size h_t_valid_clift_Some_iff) apply (clarsimp simp: hrs_htd_update szo'[symmetric] cvariable_array_ptr_retyps[OF szo] rb') apply (subst zero_ranges_ptr_retyps, simp_all only: szo'[symmetric] power_add,
      simp) apply (simp add:szo  p2dist objBits_simps ko_def ptr_retyps_htd_safe_neg
                    kernel_data_refs_domain_eq_rotate
                    rl foldr_upd_app_if [folded data_map_insert_def]
                    projectKOs cvariable_array_ptr_retyps) apply (subst cvariable_array_ptr_retyps[OF szo]) apply (simp add: rb' ptr_retyps_htd_safe_neg)+ apply (erule ptr_retyps_htd_safe_neg; simp add:pageBits_def field_simps) done qed

(* Proof state trace *)
proof (prove)
goal (1 subgoal):
 1. \<forall>\<sigma> x. (\<sigma>, x) \<in> rf_sr \<and> range_cover ptr sz (gbits + pageBits) n \<and> ptr \<noteq> 0 \<and> pspace_aligned' \<sigma> \<and> pspace_distinct' \<sigma> \<and> pspace_no_overlap' ptr sz \<sigma> \<and> (valid_objs' and untyped_ranges_zero' and caps_overlap_reserved' {ptr..+n * 2 ^ (gbits + pageBits)}) \<sigma> \<and> region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x \<and> {ptr..+n * 2 ^ (gbits + pageBits)} \<inter> kernel_data_refs = {} \<longrightarrow> (\<sigma>\<lparr>ksPSpace := foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)\<rparr>, x\<lparr>globals := globals x\<lparr>t_hrs_' := hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))\<rparr>\<rparr>) \<in> rf_sr proof (state)
goal (1 subgoal):
 1. \<And>\<sigma> x. (\<sigma>, x) \<in> rf_sr \<and> range_cover ptr sz (gbits + pageBits) n \<and> ptr \<noteq> 0 \<and> pspace_aligned' \<sigma> \<and> pspace_distinct' \<sigma> \<and> pspace_no_overlap' ptr sz \<sigma> \<and> (valid_objs' and untyped_ranges_zero' and caps_overlap_reserved' {ptr..+n * 2 ^ (gbits + pageBits)}) \<sigma> \<and> region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x \<and> {ptr..+n * 2 ^ (gbits + pageBits)} \<inter> kernel_data_refs = {} \<Longrightarrow> (\<sigma>\<lparr>ksPSpace := foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)\<rparr>, x\<lparr>globals := globals x\<lparr>t_hrs_' := hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))\<rparr>\<rparr>) \<in> rf_sr proof (state)
goal (1 subgoal):
 1. \<And>\<sigma> x. (\<sigma>, x) \<in> rf_sr \<and> range_cover ptr sz (gbits + pageBits) n \<and> ptr \<noteq> 0 \<and> pspace_aligned' \<sigma> \<and> pspace_distinct' \<sigma> \<and> pspace_no_overlap' ptr sz \<sigma> \<and> (valid_objs' and untyped_ranges_zero' and caps_overlap_reserved' {ptr..+n * 2 ^ (gbits + pageBits)}) \<sigma> \<and> region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x \<and> {ptr..+n * 2 ^ (gbits + pageBits)} \<inter> kernel_data_refs = {} \<Longrightarrow> (\<sigma>\<lparr>ksPSpace := foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)\<rparr>, x\<lparr>globals := globals x\<lparr>t_hrs_' := hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))\<rparr>\<rparr>) \<in> rf_sr proof (state)
goal (1 subgoal):
 1. \<And>\<sigma> x. (\<sigma>, x) \<in> rf_sr \<and> range_cover ptr sz (gbits + pageBits) n \<and> ptr \<noteq> 0 \<and> pspace_aligned' \<sigma> \<and> pspace_distinct' \<sigma> \<and> pspace_no_overlap' ptr sz \<sigma> \<and> (valid_objs' and untyped_ranges_zero' and caps_overlap_reserved' {ptr..+n * 2 ^ (gbits + pageBits)}) \<sigma> \<and> region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x \<and> {ptr..+n * 2 ^ (gbits + pageBits)} \<inter> kernel_data_refs = {} \<Longrightarrow> (\<sigma>\<lparr>ksPSpace := foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)\<rparr>, x\<lparr>globals := globals x\<lparr>t_hrs_' := hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))\<rparr>\<rparr>) \<in> rf_sr proof (state)
goal (1 subgoal):
 1. \<And>\<sigma> x. (\<sigma>, x) \<in> rf_sr \<and> range_cover ptr sz (gbits + pageBits) n \<and> ptr \<noteq> 0 \<and> pspace_aligned' \<sigma> \<and> pspace_distinct' \<sigma> \<and> pspace_no_overlap' ptr sz \<sigma> \<and> (valid_objs' and untyped_ranges_zero' and caps_overlap_reserved' {ptr..+n * 2 ^ (gbits + pageBits)}) \<sigma> \<and> region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x \<and> {ptr..+n * 2 ^ (gbits + pageBits)} \<inter> kernel_data_refs = {} \<Longrightarrow> (\<sigma>\<lparr>ksPSpace := foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)\<rparr>, x\<lparr>globals := globals x\<lparr>t_hrs_' := hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))\<rparr>\<rparr>) \<in> rf_sr proof (state)
goal (1 subgoal):
 1. \<And>\<sigma> x. (\<sigma>, x) \<in> rf_sr \<and> range_cover ptr sz (gbits + pageBits) n \<and> ptr \<noteq> 0 \<and> pspace_aligned' \<sigma> \<and> pspace_distinct' \<sigma> \<and> pspace_no_overlap' ptr sz \<sigma> \<and> (valid_objs' and untyped_ranges_zero' and caps_overlap_reserved' {ptr..+n * 2 ^ (gbits + pageBits)}) \<sigma> \<and> region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x \<and> {ptr..+n * 2 ^ (gbits + pageBits)} \<inter> kernel_data_refs = {} \<Longrightarrow> (\<sigma>\<lparr>ksPSpace := foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)\<rparr>, x\<lparr>globals := globals x\<lparr>t_hrs_' := hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))\<rparr>\<rparr>) \<in> rf_sr proof (state)
goal (1 subgoal):
 1. \<And>\<sigma> x. (\<sigma>, x) \<in> rf_sr \<and> range_cover ptr sz (gbits + pageBits) n \<and> ptr \<noteq> 0 \<and> pspace_aligned' \<sigma> \<and> pspace_distinct' \<sigma> \<and> pspace_no_overlap' ptr sz \<sigma> \<and> (valid_objs' and untyped_ranges_zero' and caps_overlap_reserved' {ptr..+n * 2 ^ (gbits + pageBits)}) \<sigma> \<and> region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x \<and> {ptr..+n * 2 ^ (gbits + pageBits)} \<inter> kernel_data_refs = {} \<Longrightarrow> (\<sigma>\<lparr>ksPSpace := foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)\<rparr>, x\<lparr>globals := globals x\<lparr>t_hrs_' := hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))\<rparr>\<rparr>) \<in> rf_sr proof (state)
this:
size_of TYPE(user_data_C) \<equiv> 4096

goal (1 subgoal):
 1. \<And>\<sigma> x. (\<sigma>, x) \<in> rf_sr \<and> range_cover ptr sz (gbits + pageBits) n \<and> ptr \<noteq> 0 \<and> pspace_aligned' \<sigma> \<and> pspace_distinct' \<sigma> \<and> pspace_no_overlap' ptr sz \<sigma> \<and> (valid_objs' and untyped_ranges_zero' and caps_overlap_reserved' {ptr..+n * 2 ^ (gbits + pageBits)}) \<sigma> \<and> region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x \<and> {ptr..+n * 2 ^ (gbits + pageBits)} \<inter> kernel_data_refs = {} \<Longrightarrow> (\<sigma>\<lparr>ksPSpace := foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)\<rparr>, x\<lparr>globals := globals x\<lparr>t_hrs_' := hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))\<rparr>\<rparr>) \<in> rf_sr proof (state)
this:
(\<sigma>, x) \<in> rf_sr \<and> range_cover ptr sz (gbits + pageBits) n \<and> ptr \<noteq> 0 \<and> pspace_aligned' \<sigma> \<and> pspace_distinct' \<sigma> \<and> pspace_no_overlap' ptr sz \<sigma> \<and> (valid_objs' and untyped_ranges_zero' and caps_overlap_reserved' {ptr..+n * 2 ^ (gbits + pageBits)}) \<sigma> \<and> region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x \<and> {ptr..+n * 2 ^ (gbits + pageBits)} \<inter> kernel_data_refs = {}

goal (1 subgoal):
 1. \<And>\<sigma> x. (\<sigma>, x) \<in> rf_sr \<and> range_cover ptr sz (gbits + pageBits) n \<and> ptr \<noteq> 0 \<and> pspace_aligned' \<sigma> \<and> pspace_distinct' \<sigma> \<and> pspace_no_overlap' ptr sz \<sigma> \<and> (valid_objs' and untyped_ranges_zero' and caps_overlap_reserved' {ptr..+n * 2 ^ (gbits + pageBits)}) \<sigma> \<and> region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x \<and> {ptr..+n * 2 ^ (gbits + pageBits)} \<inter> kernel_data_refs = {} \<Longrightarrow> (\<sigma>\<lparr>ksPSpace := foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)\<rparr>, x\<lparr>globals := globals x\<lparr>t_hrs_' := hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))\<rparr>\<rparr>) \<in> rf_sr proof (prove)
using this:
(\<sigma>, x) \<in> rf_sr \<and> range_cover ptr sz (gbits + pageBits) n \<and> ptr \<noteq> 0 \<and> pspace_aligned' \<sigma> \<and> pspace_distinct' \<sigma> \<and> pspace_no_overlap' ptr sz \<sigma> \<and> (valid_objs' and untyped_ranges_zero' and caps_overlap_reserved' {ptr..+n * 2 ^ (gbits + pageBits)}) \<sigma> \<and> region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x \<and> {ptr..+n * 2 ^ (gbits + pageBits)} \<inter> kernel_data_refs = {}

goal (1 subgoal):
 1. (((\<sigma>, x) \<in> rf_sr &&& is_aligned ptr (gbits + pageBits) &&& ptr \<noteq> 0) &&& gbits + pageBits \<le> sz &&& sz < word_bits &&& pspace_aligned' \<sigma>) &&& (pspace_distinct' \<sigma> &&& pspace_no_overlap' ptr sz \<sigma> &&& (valid_objs' and untyped_ranges_zero' and caps_overlap_reserved' {ptr..+n * 2 ^ (gbits + pageBits)}) \<sigma>) &&& (region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x &&& range_cover ptr sz (gbits + pageBits) n) &&& range_cover ptr sz (objBitsKO ko) (n * 2 ^ gbits) &&& {ptr..+n * 2 ^ (gbits + pageBits)} \<inter> kernel_data_refs = {} proof (state)
this:
(\<sigma>, x) \<in> rf_sr
is_aligned ptr (gbits + pageBits)
ptr \<noteq> 0
gbits + pageBits \<le> sz
sz < word_bits
pspace_aligned' \<sigma>
pspace_distinct' \<sigma>
pspace_no_overlap' ptr sz \<sigma>
(valid_objs' and untyped_ranges_zero' and caps_overlap_reserved' {ptr..+n * 2 ^ (gbits + pageBits)}) \<sigma>
region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x
range_cover ptr sz (gbits + pageBits) n
range_cover ptr sz (objBitsKO ko) (n * 2 ^ gbits)
{ptr..+n * 2 ^ (gbits + pageBits)} \<inter> kernel_data_refs = {}

goal (1 subgoal):
 1. \<And>\<sigma> x. (\<sigma>, x) \<in> rf_sr \<and> range_cover ptr sz (gbits + pageBits) n \<and> ptr \<noteq> 0 \<and> pspace_aligned' \<sigma> \<and> pspace_distinct' \<sigma> \<and> pspace_no_overlap' ptr sz \<sigma> \<and> (valid_objs' and untyped_ranges_zero' and caps_overlap_reserved' {ptr..+n * 2 ^ (gbits + pageBits)}) \<sigma> \<and> region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x \<and> {ptr..+n * 2 ^ (gbits + pageBits)} \<inter> kernel_data_refs = {} \<Longrightarrow> (\<sigma>\<lparr>ksPSpace := foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)\<rparr>, x\<lparr>globals := globals x\<lparr>t_hrs_' := hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))\<rparr>\<rparr>) \<in> rf_sr proof (prove)
using this:
(\<sigma>, x) \<in> rf_sr
is_aligned ptr (gbits + pageBits)
ptr \<noteq> 0
gbits + pageBits \<le> sz
sz < word_bits
pspace_aligned' \<sigma>
pspace_distinct' \<sigma>
pspace_no_overlap' ptr sz \<sigma>
(valid_objs' and untyped_ranges_zero' and caps_overlap_reserved' {ptr..+n * 2 ^ (gbits + pageBits)}) \<sigma>
region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x
range_cover ptr sz (gbits + pageBits) n
range_cover ptr sz (objBitsKO ko) (n * 2 ^ gbits)
{ptr..+n * 2 ^ (gbits + pageBits)} \<inter> kernel_data_refs = {}

goal (1 subgoal):
 1. is_aligned ptr (objBitsKO ko) proof (state)
this:
is_aligned ptr (objBitsKO ko)

goal (1 subgoal):
 1. \<And>\<sigma> x. (\<sigma>, x) \<in> rf_sr \<and> range_cover ptr sz (gbits + pageBits) n \<and> ptr \<noteq> 0 \<and> pspace_aligned' \<sigma> \<and> pspace_distinct' \<sigma> \<and> pspace_no_overlap' ptr sz \<sigma> \<and> (valid_objs' and untyped_ranges_zero' and caps_overlap_reserved' {ptr..+n * 2 ^ (gbits + pageBits)}) \<sigma> \<and> region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x \<and> {ptr..+n * 2 ^ (gbits + pageBits)} \<inter> kernel_data_refs = {} \<Longrightarrow> (\<sigma>\<lparr>ksPSpace := foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)\<rparr>, x\<lparr>globals := globals x\<lparr>t_hrs_' := hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))\<rparr>\<rparr>) \<in> rf_sr proof (state)
this:
n * 2 ^ gbits * 2 ^ objBitsKO ko < 2 ^ LENGTH(32)

goal (1 subgoal):
 1. \<And>\<sigma> x. (\<sigma>, x) \<in> rf_sr \<and> range_cover ptr sz (gbits + pageBits) n \<and> ptr \<noteq> 0 \<and> pspace_aligned' \<sigma> \<and> pspace_distinct' \<sigma> \<and> pspace_no_overlap' ptr sz \<sigma> \<and> (valid_objs' and untyped_ranges_zero' and caps_overlap_reserved' {ptr..+n * 2 ^ (gbits + pageBits)}) \<sigma> \<and> region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x \<and> {ptr..+n * 2 ^ (gbits + pageBits)} \<inter> kernel_data_refs = {} \<Longrightarrow> (\<sigma>\<lparr>ksPSpace := foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)\<rparr>, x\<lparr>globals := globals x\<lparr>t_hrs_' := hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))\<rparr>\<rparr>) \<in> rf_sr proof (prove)
using this:
n * 2 ^ gbits * 2 ^ objBitsKO ko < 2 ^ LENGTH(32)

goal (1 subgoal):
 1. n * 2 ^ gbits * size_of TYPE(user_data_device_C) < 2 ^ word_bits proof (state)
this:
n * 2 ^ gbits * size_of TYPE(user_data_device_C) < 2 ^ word_bits

goal (1 subgoal):
 1. \<And>\<sigma> x. (\<sigma>, x) \<in> rf_sr \<and> range_cover ptr sz (gbits + pageBits) n \<and> ptr \<noteq> 0 \<and> pspace_aligned' \<sigma> \<and> pspace_distinct' \<sigma> \<and> pspace_no_overlap' ptr sz \<sigma> \<and> (valid_objs' and untyped_ranges_zero' and caps_overlap_reserved' {ptr..+n * 2 ^ (gbits + pageBits)}) \<sigma> \<and> region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x \<and> {ptr..+n * 2 ^ (gbits + pageBits)} \<inter> kernel_data_refs = {} \<Longrightarrow> (\<sigma>\<lparr>ksPSpace := foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)\<rparr>, x\<lparr>globals := globals x\<lparr>t_hrs_' := hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))\<rparr>\<rparr>) \<in> rf_sr proof (state)
this:
n * 2 ^ gbits * size_of TYPE(user_data_device_C) < 2 ^ word_bits

goal (1 subgoal):
 1. \<And>\<sigma> x. (\<sigma>, x) \<in> rf_sr \<and> range_cover ptr sz (gbits + pageBits) n \<and> ptr \<noteq> 0 \<and> pspace_aligned' \<sigma> \<and> pspace_distinct' \<sigma> \<and> pspace_no_overlap' ptr sz \<sigma> \<and> (valid_objs' and untyped_ranges_zero' and caps_overlap_reserved' {ptr..+n * 2 ^ (gbits + pageBits)}) \<sigma> \<and> region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x \<and> {ptr..+n * 2 ^ (gbits + pageBits)} \<inter> kernel_data_refs = {} \<Longrightarrow> (\<sigma>\<lparr>ksPSpace := foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)\<rparr>, x\<lparr>globals := globals x\<lparr>t_hrs_' := hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))\<rparr>\<rparr>) \<in> rf_sr proof (prove)
goal (1 subgoal):
 1. \<And>dev. makeObjectKO True (Inr object_type.SmallPageObject) = Some ko proof (state)
this:
makeObjectKO True (Inr object_type.SmallPageObject) = Some ko

goal (1 subgoal):
 1. \<And>\<sigma> x. (\<sigma>, x) \<in> rf_sr \<and> range_cover ptr sz (gbits + pageBits) n \<and> ptr \<noteq> 0 \<and> pspace_aligned' \<sigma> \<and> pspace_distinct' \<sigma> \<and> pspace_no_overlap' ptr sz \<sigma> \<and> (valid_objs' and untyped_ranges_zero' and caps_overlap_reserved' {ptr..+n * 2 ^ (gbits + pageBits)}) \<sigma> \<and> region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x \<and> {ptr..+n * 2 ^ (gbits + pageBits)} \<inter> kernel_data_refs = {} \<Longrightarrow> (\<sigma>\<lparr>ksPSpace := foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)\<rparr>, x\<lparr>globals := globals x\<lparr>t_hrs_' := hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))\<rparr>\<rparr>) \<in> rf_sr proof (chain)
picking this:
gbits + pageBits \<le> sz proof (prove)
using this:
gbits + pageBits \<le> sz

goal (1 subgoal):
 1. 2 \<le> sz proof (state)
this:
2 \<le> sz

goal (1 subgoal):
 1. \<And>\<sigma> x. (\<sigma>, x) \<in> rf_sr \<and> range_cover ptr sz (gbits + pageBits) n \<and> ptr \<noteq> 0 \<and> pspace_aligned' \<sigma> \<and> pspace_distinct' \<sigma> \<and> pspace_no_overlap' ptr sz \<sigma> \<and> (valid_objs' and untyped_ranges_zero' and caps_overlap_reserved' {ptr..+n * 2 ^ (gbits + pageBits)}) \<sigma> \<and> region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x \<and> {ptr..+n * 2 ^ (gbits + pageBits)} \<inter> kernel_data_refs = {} \<Longrightarrow> (\<sigma>\<lparr>ksPSpace := foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)\<rparr>, x\<lparr>globals := globals x\<lparr>t_hrs_' := hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))\<rparr>\<rparr>) \<in> rf_sr proof (prove)
using this:
2 \<le> sz

goal (1 subgoal):
 1. 2 ^ (sz - 2) * 4 = 2 ^ sz proof (prove)
goal (2 subgoals):
 1. \<lbrakk>2 \<le> sz; 4 = 2\<^sup>2\<rbrakk> \<Longrightarrow> 2 ^ (sz - 2) * 4 = 2 ^ sz
 2. 2 \<le> sz \<Longrightarrow> 4 = 2\<^sup>2 proof (prove)
goal (2 subgoals):
 1. 2 \<le> sz \<Longrightarrow> 2 ^ (sz - 2) * 2\<^sup>2 = 2 ^ sz
 2. 2 \<le> sz \<Longrightarrow> 4 = 2\<^sup>2 proof (prove)
goal (2 subgoals):
 1. 2 \<le> sz \<Longrightarrow> 2 ^ (sz - 2 + 2) = 2 ^ sz
 2. 2 \<le> sz \<Longrightarrow> 4 = 2\<^sup>2 proof (prove)
goal (2 subgoals):
 1. 2 \<le> sz \<Longrightarrow> sz - 2 + 2 = sz
 2. 2 \<le> sz \<Longrightarrow> 4 = 2\<^sup>2 proof (prove)
goal (1 subgoal):
 1. 2 \<le> sz \<Longrightarrow> 4 = 2\<^sup>2 proof (prove)
goal:
No subgoals! proof (state)
this:
2 ^ (sz - 2) * 4 = 2 ^ sz

goal (1 subgoal):
 1. \<And>\<sigma> x. (\<sigma>, x) \<in> rf_sr \<and> range_cover ptr sz (gbits + pageBits) n \<and> ptr \<noteq> 0 \<and> pspace_aligned' \<sigma> \<and> pspace_distinct' \<sigma> \<and> pspace_no_overlap' ptr sz \<sigma> \<and> (valid_objs' and untyped_ranges_zero' and caps_overlap_reserved' {ptr..+n * 2 ^ (gbits + pageBits)}) \<sigma> \<and> region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x \<and> {ptr..+n * 2 ^ (gbits + pageBits)} \<inter> kernel_data_refs = {} \<Longrightarrow> (\<sigma>\<lparr>ksPSpace := foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)\<rparr>, x\<lparr>globals := globals x\<lparr>t_hrs_' := hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))\<rparr>\<rparr>) \<in> rf_sr proof (prove)
goal (1 subgoal):
 1. n * 2 ^ (gbits + pageBits) = n * 2 ^ gbits * 2 ^ pageBits proof (state)
this:
n * 2 ^ (gbits + pageBits) = n * 2 ^ gbits * 2 ^ pageBits

goal (1 subgoal):
 1. \<And>\<sigma> x. (\<sigma>, x) \<in> rf_sr \<and> range_cover ptr sz (gbits + pageBits) n \<and> ptr \<noteq> 0 \<and> pspace_aligned' \<sigma> \<and> pspace_distinct' \<sigma> \<and> pspace_no_overlap' ptr sz \<sigma> \<and> (valid_objs' and untyped_ranges_zero' and caps_overlap_reserved' {ptr..+n * 2 ^ (gbits + pageBits)}) \<sigma> \<and> region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x \<and> {ptr..+n * 2 ^ (gbits + pageBits)} \<inter> kernel_data_refs = {} \<Longrightarrow> (\<sigma>\<lparr>ksPSpace := foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)\<rparr>, x\<lparr>globals := globals x\<lparr>t_hrs_' := hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))\<rparr>\<rparr>) \<in> rf_sr proof (state)
this:
(?i \<in> {?l..?u}) = (?l \<le> ?i \<and> ?i \<le> ?u)
({?a..?b} \<subseteq> {?c..?d}) = (\<not> ?a \<le> ?b \<or> ?c \<le> ?a \<and> ?b \<le> ?d)
(?i \<in> {?l..<?u}) = (?l \<le> ?i \<and> ?i < ?u)
{?a..?b} \<inter> {?c..?d} = {max ?a ?c..min ?b ?d}
({?a..?b} = {}) = (\<not> ?a \<le> ?b)
(\<exists>x. ?P x) = (\<exists>a b. ?P (a, b))

goal (1 subgoal):
 1. \<And>\<sigma> x. (\<sigma>, x) \<in> rf_sr \<and> range_cover ptr sz (gbits + pageBits) n \<and> ptr \<noteq> 0 \<and> pspace_aligned' \<sigma> \<and> pspace_distinct' \<sigma> \<and> pspace_no_overlap' ptr sz \<sigma> \<and> (valid_objs' and untyped_ranges_zero' and caps_overlap_reserved' {ptr..+n * 2 ^ (gbits + pageBits)}) \<sigma> \<and> region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x \<and> {ptr..+n * 2 ^ (gbits + pageBits)} \<inter> kernel_data_refs = {} \<Longrightarrow> (\<sigma>\<lparr>ksPSpace := foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)\<rparr>, x\<lparr>globals := globals x\<lparr>t_hrs_' := hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))\<rparr>\<rparr>) \<in> rf_sr proof (state)
this:
(?i \<in> {?l..?u}) = (?l \<le> ?i \<and> ?i \<le> ?u)
({?a..?b} \<subseteq> {?c..?d}) = (\<not> ?a \<le> ?b \<or> ?c \<le> ?a \<and> ?b \<le> ?d)
(?i \<in> {?l..<?u}) = (?l \<le> ?i \<and> ?i < ?u)
{?a..?b} \<inter> {?c..?d} = {max ?a ?c..min ?b ?d}
({?a..?b} = {}) = (\<not> ?a \<le> ?b)
(\<exists>x. ?P x) = (\<exists>a b. ?P (a, b))

goal (1 subgoal):
 1. \<And>\<sigma> x. (\<sigma>, x) \<in> rf_sr \<and> range_cover ptr sz (gbits + pageBits) n \<and> ptr \<noteq> 0 \<and> pspace_aligned' \<sigma> \<and> pspace_distinct' \<sigma> \<and> pspace_no_overlap' ptr sz \<sigma> \<and> (valid_objs' and untyped_ranges_zero' and caps_overlap_reserved' {ptr..+n * 2 ^ (gbits + pageBits)}) \<sigma> \<and> region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x \<and> {ptr..+n * 2 ^ (gbits + pageBits)} \<inter> kernel_data_refs = {} \<Longrightarrow> (\<sigma>\<lparr>ksPSpace := foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)\<rparr>, x\<lparr>globals := globals x\<lparr>t_hrs_' := hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))\<rparr>\<rparr>) \<in> rf_sr proof (prove)
goal (1 subgoal):
 1. size_of TYPE(user_data_device_C) = 2 ^ objBitsKO ko proof (state)
this:
size_of TYPE(user_data_device_C) = 2 ^ objBitsKO ko

goal (1 subgoal):
 1. \<And>\<sigma> x. (\<sigma>, x) \<in> rf_sr \<and> range_cover ptr sz (gbits + pageBits) n \<and> ptr \<noteq> 0 \<and> pspace_aligned' \<sigma> \<and> pspace_distinct' \<sigma> \<and> pspace_no_overlap' ptr sz \<sigma> \<and> (valid_objs' and untyped_ranges_zero' and caps_overlap_reserved' {ptr..+n * 2 ^ (gbits + pageBits)}) \<sigma> \<and> region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x \<and> {ptr..+n * 2 ^ (gbits + pageBits)} \<inter> kernel_data_refs = {} \<Longrightarrow> (\<sigma>\<lparr>ksPSpace := foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)\<rparr>, x\<lparr>globals := globals x\<lparr>t_hrs_' := hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))\<rparr>\<rparr>) \<in> rf_sr proof (prove)
goal (1 subgoal):
 1. n * 2 ^ (gbits + pageBits) = n * 2 ^ gbits * size_of TYPE(user_data_device_C) proof (prove)
using this:
gbits + pageBits \<le> sz

goal (1 subgoal):
 1. n * 2 ^ (gbits + pageBits) = n * 2 ^ gbits * size_of TYPE(user_data_device_C) proof (prove)
goal (1 subgoal):
 1. gbits + pageBits \<le> sz \<Longrightarrow> n * 2 ^ (gbits + pageBits) = n * 2 ^ gbits * 2 ^ objBitsKO ko proof (prove)
goal:
No subgoals! proof (state)
this:
n * 2 ^ (gbits + pageBits) = n * 2 ^ gbits * size_of TYPE(user_data_device_C)

goal (1 subgoal):
 1. \<And>\<sigma> x. (\<sigma>, x) \<in> rf_sr \<and> range_cover ptr sz (gbits + pageBits) n \<and> ptr \<noteq> 0 \<and> pspace_aligned' \<sigma> \<and> pspace_distinct' \<sigma> \<and> pspace_no_overlap' ptr sz \<sigma> \<and> (valid_objs' and untyped_ranges_zero' and caps_overlap_reserved' {ptr..+n * 2 ^ (gbits + pageBits)}) \<sigma> \<and> region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x \<and> {ptr..+n * 2 ^ (gbits + pageBits)} \<inter> kernel_data_refs = {} \<Longrightarrow> (\<sigma>\<lparr>ksPSpace := foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)\<rparr>, x\<lparr>globals := globals x\<lparr>t_hrs_' := hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))\<rparr>\<rparr>) \<in> rf_sr proof (prove)
goal (1 subgoal):
 1. region_is_bytes ptr (n * 2 ^ gbits * 2 ^ objBitsKO ko) x proof (prove)
using this:
region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x

goal (1 subgoal):
 1. region_is_bytes ptr (n * 2 ^ gbits * 2 ^ objBitsKO ko) x proof (state)
this:
region_is_bytes ptr (n * 2 ^ gbits * 2 ^ objBitsKO ko) x

goal (1 subgoal):
 1. \<And>\<sigma> x. (\<sigma>, x) \<in> rf_sr \<and> range_cover ptr sz (gbits + pageBits) n \<and> ptr \<noteq> 0 \<and> pspace_aligned' \<sigma> \<and> pspace_distinct' \<sigma> \<and> pspace_no_overlap' ptr sz \<sigma> \<and> (valid_objs' and untyped_ranges_zero' and caps_overlap_reserved' {ptr..+n * 2 ^ (gbits + pageBits)}) \<sigma> \<and> region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x \<and> {ptr..+n * 2 ^ (gbits + pageBits)} \<inter> kernel_data_refs = {} \<Longrightarrow> (\<sigma>\<lparr>ksPSpace := foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)\<rparr>, x\<lparr>globals := globals x\<lparr>t_hrs_' := hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))\<rparr>\<rparr>) \<in> rf_sr proof (chain)
picking this:
region_is_bytes ptr (n * 2 ^ gbits * 2 ^ objBitsKO ko) x proof (prove)
using this:
region_is_bytes ptr (n * 2 ^ gbits * 2 ^ objBitsKO ko) x

goal (1 subgoal):
 1. region_is_bytes ptr (n * 2 ^ gbits * size_of TYPE(user_data_device_C)) x proof (state)
this:
region_is_bytes ptr (n * 2 ^ gbits * size_of TYPE(user_data_device_C)) x

goal (1 subgoal):
 1. \<And>\<sigma> x. (\<sigma>, x) \<in> rf_sr \<and> range_cover ptr sz (gbits + pageBits) n \<and> ptr \<noteq> 0 \<and> pspace_aligned' \<sigma> \<and> pspace_distinct' \<sigma> \<and> pspace_no_overlap' ptr sz \<sigma> \<and> (valid_objs' and untyped_ranges_zero' and caps_overlap_reserved' {ptr..+n * 2 ^ (gbits + pageBits)}) \<sigma> \<and> region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x \<and> {ptr..+n * 2 ^ (gbits + pageBits)} \<inter> kernel_data_refs = {} \<Longrightarrow> (\<sigma>\<lparr>ksPSpace := foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)\<rparr>, x\<lparr>globals := globals x\<lparr>t_hrs_' := hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))\<rparr>\<rparr>) \<in> rf_sr proof (state)
this:
\<lbrakk>typ_uinfo_t TYPE(?'b) \<bottom>\<^sub>t typ_uinfo_t TYPE(user_data_device_C); typ_uinfo_t TYPE(?'b) \<noteq> typ_uinfo_t TYPE(8 word)\<rbrakk> \<Longrightarrow> clift (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) ?arr) (t_hrs_' (globals x))) = cslift x

goal (1 subgoal):
 1. \<And>\<sigma> x. (\<sigma>, x) \<in> rf_sr \<and> range_cover ptr sz (gbits + pageBits) n \<and> ptr \<noteq> 0 \<and> pspace_aligned' \<sigma> \<and> pspace_distinct' \<sigma> \<and> pspace_no_overlap' ptr sz \<sigma> \<and> (valid_objs' and untyped_ranges_zero' and caps_overlap_reserved' {ptr..+n * 2 ^ (gbits + pageBits)}) \<sigma> \<and> region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x \<and> {ptr..+n * 2 ^ (gbits + pageBits)} \<inter> kernel_data_refs = {} \<Longrightarrow> (\<sigma>\<lparr>ksPSpace := foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)\<rparr>, x\<lparr>globals := globals x\<lparr>t_hrs_' := hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))\<rparr>\<rparr>) \<in> rf_sr proof (state)
this:
\<lbrakk>typ_uinfo_t TYPE(?'b) \<bottom>\<^sub>t typ_uinfo_t TYPE(user_data_device_C); typ_uinfo_t TYPE(?'b) \<noteq> typ_uinfo_t TYPE(8 word)\<rbrakk> \<Longrightarrow> clift (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) ?arr) (t_hrs_' (globals x))) = cslift x

goal (1 subgoal):
 1. \<And>\<sigma> x. (\<sigma>, x) \<in> rf_sr \<and> range_cover ptr sz (gbits + pageBits) n \<and> ptr \<noteq> 0 \<and> pspace_aligned' \<sigma> \<and> pspace_distinct' \<sigma> \<and> pspace_no_overlap' ptr sz \<sigma> \<and> (valid_objs' and untyped_ranges_zero' and caps_overlap_reserved' {ptr..+n * 2 ^ (gbits + pageBits)}) \<sigma> \<and> region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x \<and> {ptr..+n * 2 ^ (gbits + pageBits)} \<inter> kernel_data_refs = {} \<Longrightarrow> (\<sigma>\<lparr>ksPSpace := foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)\<rparr>, x\<lparr>globals := globals x\<lparr>t_hrs_' := hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))\<rparr>\<rparr>) \<in> rf_sr proof (state)
this:
\<lbrakk>KOUserDataDevice \<equiv> ?x; \<forall>v. projectKO_opt ?x \<noteq> Some v\<rbrakk> \<Longrightarrow> projectKO_opt \<circ>\<^sub>m (\<lambda>x. if x \<in> set (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) then Some KOUserDataDevice else ksPSpace \<sigma> x) = projectKO_opt \<circ>\<^sub>m ksPSpace \<sigma>

goal (1 subgoal):
 1. \<And>\<sigma> x. (\<sigma>, x) \<in> rf_sr \<and> range_cover ptr sz (gbits + pageBits) n \<and> ptr \<noteq> 0 \<and> pspace_aligned' \<sigma> \<and> pspace_distinct' \<sigma> \<and> pspace_no_overlap' ptr sz \<sigma> \<and> (valid_objs' and untyped_ranges_zero' and caps_overlap_reserved' {ptr..+n * 2 ^ (gbits + pageBits)}) \<sigma> \<and> region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x \<and> {ptr..+n * 2 ^ (gbits + pageBits)} \<inter> kernel_data_refs = {} \<Longrightarrow> (\<sigma>\<lparr>ksPSpace := foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)\<rparr>, x\<lparr>globals := globals x\<lparr>t_hrs_' := hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))\<rparr>\<rparr>) \<in> rf_sr proof (state)
this:
map_to_ctes (\<lambda>xa. if xa \<in> set (new_cap_addrs (n * 2 ^ gbits) ptr ko) then Some ko else ksPSpace \<sigma> xa) = (\<lambda>x. if Inr object_type.SmallPageObject = Inr (APIObjectType ArchTypes_H.apiobject_type.CapTableObject) \<and> x \<in> set (new_cap_addrs (n * 2 ^ gbits) ptr ko) \<or> Inr object_type.SmallPageObject = Inr (APIObjectType ArchTypes_H.apiobject_type.TCBObject) \<and> x && ~~ mask tcbBlockSizeBits \<in> set (new_cap_addrs (n * 2 ^ gbits) ptr ko) \<and> x && mask tcbBlockSizeBits \<in> dom tcb_cte_cases then Some (CTE capability.NullCap nullMDBNode) else ctes_of \<sigma> x)

goal (1 subgoal):
 1. \<And>\<sigma> x. (\<sigma>, x) \<in> rf_sr \<and> range_cover ptr sz (gbits + pageBits) n \<and> ptr \<noteq> 0 \<and> pspace_aligned' \<sigma> \<and> pspace_distinct' \<sigma> \<and> pspace_no_overlap' ptr sz \<sigma> \<and> (valid_objs' and untyped_ranges_zero' and caps_overlap_reserved' {ptr..+n * 2 ^ (gbits + pageBits)}) \<sigma> \<and> region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x \<and> {ptr..+n * 2 ^ (gbits + pageBits)} \<inter> kernel_data_refs = {} \<Longrightarrow> (\<sigma>\<lparr>ksPSpace := foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)\<rparr>, x\<lparr>globals := globals x\<lparr>t_hrs_' := hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))\<rparr>\<rparr>) \<in> rf_sr proof (state)
this:
\<lbrakk>typ_name (typ_info_t TYPE(?'b1)) \<noteq> ''!pad_typ''; typ_name (typ_info_t TYPE(?'b1)) \<noteq> ''word0000010'' \<and> typ_name (typ_info_t TYPE(?'b1)) \<noteq> ''user_data_device_C'' \<and> typ_name (typ_info_t TYPE(?'b1)) \<noteq> ''word0000010_array_000000000010''; ''user_data_device_C'' \<notin> td_names (typ_info_t TYPE(?'b1)); typ_uinfo_t TYPE(?'b1) \<noteq> typ_uinfo_t TYPE(8 word)\<rbrakk> \<Longrightarrow> h_t_valid (hrs_htd (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) ?arr1) (t_hrs_' (globals x)))) c_guard = c_h_t_valid x

goal (1 subgoal):
 1. \<And>\<sigma> x. (\<sigma>, x) \<in> rf_sr \<and> range_cover ptr sz (gbits + pageBits) n \<and> ptr \<noteq> 0 \<and> pspace_aligned' \<sigma> \<and> pspace_distinct' \<sigma> \<and> pspace_no_overlap' ptr sz \<sigma> \<and> (valid_objs' and untyped_ranges_zero' and caps_overlap_reserved' {ptr..+n * 2 ^ (gbits + pageBits)}) \<sigma> \<and> region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x \<and> {ptr..+n * 2 ^ (gbits + pageBits)} \<inter> kernel_data_refs = {} \<Longrightarrow> (\<sigma>\<lparr>ksPSpace := foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)\<rparr>, x\<lparr>globals := globals x\<lparr>t_hrs_' := hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))\<rparr>\<rparr>) \<in> rf_sr proof (prove)
goal (1 subgoal):
 1. \<forall>t<n * 2 ^ gbits. c_guard (PTR(user_data_device_C) ptr +\<^sub>p int t) proof (prove)
goal (2 subgoals):
 1. 2 \<le> objBitsKO ko
 2. align_of TYPE(user_data_device_C) = 2\<^sup>2 proof (prove)
goal:
No subgoals! proof (state)
this:
\<forall>t<n * 2 ^ gbits. c_guard (PTR(user_data_device_C) ptr +\<^sub>p int t)

goal (1 subgoal):
 1. \<And>\<sigma> x. (\<sigma>, x) \<in> rf_sr \<and> range_cover ptr sz (gbits + pageBits) n \<and> ptr \<noteq> 0 \<and> pspace_aligned' \<sigma> \<and> pspace_distinct' \<sigma> \<and> pspace_no_overlap' ptr sz \<sigma> \<and> (valid_objs' and untyped_ranges_zero' and caps_overlap_reserved' {ptr..+n * 2 ^ (gbits + pageBits)}) \<sigma> \<and> region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x \<and> {ptr..+n * 2 ^ (gbits + pageBits)} \<inter> kernel_data_refs = {} \<Longrightarrow> (\<sigma>\<lparr>ksPSpace := foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)\<rparr>, x\<lparr>globals := globals x\<lparr>t_hrs_' := hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))\<rparr>\<rparr>) \<in> rf_sr proof (prove)
goal (1 subgoal):
 1. \<And>xa v y. \<lbrakk>heap_to_device_data (\<lambda>x. if x \<in> set (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) then Some KOUserData else ksPSpace \<sigma> x) (underlying_memory (ksMachineState \<sigma>)) xa = Some v; xa \<notin> set (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice); heap_to_device_data (ksPSpace \<sigma>) (underlying_memory (ksMachineState \<sigma>)) xa = Some y\<rbrakk> \<Longrightarrow> y = v proof (prove)
using this:
n \<noteq> 0 \<Longrightarrow> {ptr..+n * 2 ^ (gbits + pageBits)} = {ptr..ptr + (word_of_nat n * 2 ^ (gbits + pageBits) - 1)}

goal (1 subgoal):
 1. \<And>xa v y. \<lbrakk>heap_to_device_data (\<lambda>x. if x \<in> set (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) then Some KOUserData else ksPSpace \<sigma> x) (underlying_memory (ksMachineState \<sigma>)) xa = Some v; xa \<notin> set (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice); heap_to_device_data (ksPSpace \<sigma>) (underlying_memory (ksMachineState \<sigma>)) xa = Some y\<rbrakk> \<Longrightarrow> y = v proof (state)
this:
\<lbrakk>heap_to_device_data (\<lambda>x. if x \<in> set (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) then Some KOUserData else ksPSpace \<sigma> x) (underlying_memory (ksMachineState \<sigma>)) ?xa3 = Some ?v3; ?xa3 \<notin> set (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice); heap_to_device_data (ksPSpace \<sigma>) (underlying_memory (ksMachineState \<sigma>)) ?xa3 = Some ?y3\<rbrakk> \<Longrightarrow> ?y3 = ?v3

goal (1 subgoal):
 1. \<And>\<sigma> x. (\<sigma>, x) \<in> rf_sr \<and> range_cover ptr sz (gbits + pageBits) n \<and> ptr \<noteq> 0 \<and> pspace_aligned' \<sigma> \<and> pspace_distinct' \<sigma> \<and> pspace_no_overlap' ptr sz \<sigma> \<and> (valid_objs' and untyped_ranges_zero' and caps_overlap_reserved' {ptr..+n * 2 ^ (gbits + pageBits)}) \<sigma> \<and> region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x \<and> {ptr..+n * 2 ^ (gbits + pageBits)} \<inter> kernel_data_refs = {} \<Longrightarrow> (\<sigma>\<lparr>ksPSpace := foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)\<rparr>, x\<lparr>globals := globals x\<lparr>t_hrs_' := hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))\<rparr>\<rparr>) \<in> rf_sr proof (state)
this:
ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) ?arr (hrs_htd (t_hrs_' (globals x))) \<Turnstile>\<^sub>t ?p' = (?p' \<in> (\<lambda>x. PTR(user_data_device_C) (ptr + word_of_nat x * 0x1000)) ` {k. k < n * 2 ^ gbits} \<or> x \<Turnstile>\<^sub>c ?p')

goal (1 subgoal):
 1. \<And>\<sigma> x. (\<sigma>, x) \<in> rf_sr \<and> range_cover ptr sz (gbits + pageBits) n \<and> ptr \<noteq> 0 \<and> pspace_aligned' \<sigma> \<and> pspace_distinct' \<sigma> \<and> pspace_no_overlap' ptr sz \<sigma> \<and> (valid_objs' and untyped_ranges_zero' and caps_overlap_reserved' {ptr..+n * 2 ^ (gbits + pageBits)}) \<sigma> \<and> region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x \<and> {ptr..+n * 2 ^ (gbits + pageBits)} \<inter> kernel_data_refs = {} \<Longrightarrow> (\<sigma>\<lparr>ksPSpace := foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)\<rparr>, x\<lparr>globals := globals x\<lparr>t_hrs_' := hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))\<rparr>\<rparr>) \<in> rf_sr proof (chain)
picking this:
(\<sigma>, x) \<in> rf_sr proof (prove)
using this:
(\<sigma>, x) \<in> rf_sr

goal (1 subgoal):
 1. cpspace_relation (ksPSpace \<sigma>) (underlying_memory (ksMachineState \<sigma>)) (t_hrs_' (globals x)) proof (prove)
using this:
(\<sigma>, x) \<in> {(s, s'). let cheap = t_hrs_' (globals s') in cpspace_relation (ksPSpace s) (underlying_memory (ksMachineState s)) cheap \<and> cready_queues_relation (clift cheap) (ksReadyQueues_' (globals s')) (ksReadyQueues s) \<and> zero_ranges_are_zero (gsUntypedZeroRanges s) cheap \<and> cbitmap_L1_relation (ksReadyQueuesL1Bitmap_' (globals s')) (ksReadyQueuesL1Bitmap s) \<and> cbitmap_L2_relation (ksReadyQueuesL2Bitmap_' (globals s')) (ksReadyQueuesL2Bitmap s) \<and> ksCurThread_' (globals s') = tcb_ptr_to_ctcb_ptr (ksCurThread s) \<and> ksIdleThread_' (globals s') = tcb_ptr_to_ctcb_ptr (ksIdleThread s) \<and> cinterrupt_relation (ksInterruptState s) intStateIRQNode_array_Ptr (intStateIRQTable_' (globals s')) \<and> cscheduler_action_relation (ksSchedulerAction s) (ksSchedulerAction_' (globals s')) \<and> carch_state_relation (ksArchState s) (globals s') \<and> cmachine_state_relation (ksMachineState s) (globals s') \<and> cte_array_relation s (globals s') \<and> tcb_cte_array_relation s (globals s') \<and> apsnd fst (ghost'state_' (globals s')) = (gsUserPages s, gsCNodes s) \<and> ghost_size_rel (ghost'state_' (globals s')) (gsMaxObjectSize s) \<and> ksWorkUnitsCompleted_' (globals s') = ksWorkUnitsCompleted s \<and> s' \<Turnstile>\<^sub>c intStateIRQNode_array_Ptr \<and> ptr_span intStateIRQNode_array_Ptr \<subseteq> kernel_data_refs \<and> s' \<Turnstile>\<^sub>c armKSGlobalPD_Ptr \<and> ptr_span armKSGlobalPD_Ptr \<subseteq> kernel_data_refs \<and> htd_safe domain (hrs_htd (t_hrs_' (globals s'))) \<and> - domain \<subseteq> kernel_data_refs \<and> globals_list_distinct (- kernel_data_refs) symbol_table kernel_all_global_addresses.global_data_list \<and> cdom_schedule_relation (kernel_state.ksDomSchedule s) kernel_all_global_addresses.ksDomSchedule \<and> ksDomScheduleIdx_' (globals s') = word_of_nat (ksDomScheduleIdx s) \<and> ksCurDomain_' (globals s') = UCAST(8 \<rightarrow> 32) (ksCurDomain s) \<and> ksDomainTime_' (globals s') = ksDomainTime s}

goal (1 subgoal):
 1. cpspace_relation (ksPSpace \<sigma>) (underlying_memory (ksMachineState \<sigma>)) (t_hrs_' (globals x)) proof (state)
this:
cpspace_relation (ksPSpace \<sigma>) (underlying_memory (ksMachineState \<sigma>)) (t_hrs_' (globals x))

goal (1 subgoal):
 1. \<And>\<sigma> x. (\<sigma>, x) \<in> rf_sr \<and> range_cover ptr sz (gbits + pageBits) n \<and> ptr \<noteq> 0 \<and> pspace_aligned' \<sigma> \<and> pspace_distinct' \<sigma> \<and> pspace_no_overlap' ptr sz \<sigma> \<and> (valid_objs' and untyped_ranges_zero' and caps_overlap_reserved' {ptr..+n * 2 ^ (gbits + pageBits)}) \<sigma> \<and> region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x \<and> {ptr..+n * 2 ^ (gbits + pageBits)} \<inter> kernel_data_refs = {} \<Longrightarrow> (\<sigma>\<lparr>ksPSpace := foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)\<rparr>, x\<lparr>globals := globals x\<lparr>t_hrs_' := hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))\<rparr>\<rparr>) \<in> rf_sr proof (prove)
using this:
cpspace_relation (ksPSpace \<sigma>) (underlying_memory (ksMachineState \<sigma>)) (t_hrs_' (globals x))

goal (1 subgoal):
 1. cpspace_relation (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)) (underlying_memory (ksMachineState \<sigma>)) (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))) proof (prove)
using this:
cmap_relation (ctes_of \<sigma>) (cslift x) cte_Ptr ccte_relation \<and> cmap_relation (map_to_tcbs (ksPSpace \<sigma>)) (cslift x) tcb_ptr_to_ctcb_ptr ctcb_relation \<and> cmap_relation (map_to_eps (ksPSpace \<sigma>)) (cslift x) ep_Ptr (cendpoint_relation (cslift x)) \<and> cmap_relation (map_to_ntfns (ksPSpace \<sigma>)) (cslift x) ntfn_Ptr (cnotification_relation (cslift x)) \<and> cmap_relation (map_to_pdes (ksPSpace \<sigma>)) (cslift x) pde_Ptr cpde_relation \<and> cmap_relation (map_to_ptes (ksPSpace \<sigma>)) (cslift x) pte_Ptr cpte_relation \<and> cmap_relation (map_to_asidpools (ksPSpace \<sigma>)) (cslift x) ap_Ptr casid_pool_relation \<and> cmap_relation (heap_to_user_data (ksPSpace \<sigma>) (underlying_memory (ksMachineState \<sigma>))) (cslift x) PTR(user_data_C) cuser_user_data_relation \<and> cmap_relation (heap_to_device_data (ksPSpace \<sigma>) (underlying_memory (ksMachineState \<sigma>))) (cslift x) PTR(user_data_device_C) cuser_user_data_device_relation \<and> carray_map_relation pdBits (map_to_pdes (ksPSpace \<sigma>)) (c_h_t_valid x) pd_Ptr \<and> carray_map_relation ptBits (map_to_ptes (ksPSpace \<sigma>)) (c_h_t_valid x) pt_Ptr

goal (1 subgoal):
 1. cmap_relation (map_to_ctes (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>))) (clift (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x)))) cte_Ptr ccte_relation \<and> cpspace_tcb_relation (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)) (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))) \<and> cmap_relation (map_to_eps (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>))) (clift (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x)))) ep_Ptr (cendpoint_relation (clift (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))))) \<and> cmap_relation (map_to_ntfns (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>))) (clift (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x)))) ntfn_Ptr (cnotification_relation (clift (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))))) \<and> cmap_relation (map_to_pdes (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>))) (clift (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x)))) pde_Ptr cpde_relation \<and> cmap_relation (map_to_ptes (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>))) (clift (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x)))) pte_Ptr cpte_relation \<and> cmap_relation (map_to_asidpools (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>))) (clift (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x)))) ap_Ptr casid_pool_relation \<and> cpspace_user_data_relation (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)) (underlying_memory (ksMachineState \<sigma>)) (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))) \<and> cpspace_device_data_relation (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)) (underlying_memory (ksMachineState \<sigma>)) (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))) \<and> cpspace_pde_array_relation (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)) (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))) \<and> cpspace_pte_array_relation (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)) (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))) proof (prove)
using this:
cmap_relation (ctes_of \<sigma>) (cslift x) cte_Ptr ccte_relation \<and> cmap_relation (map_to_tcbs (ksPSpace \<sigma>)) (cslift x) tcb_ptr_to_ctcb_ptr ctcb_relation \<and> cmap_relation (map_to_eps (ksPSpace \<sigma>)) (cslift x) ep_Ptr (cendpoint_relation (cslift x)) \<and> cmap_relation (map_to_ntfns (ksPSpace \<sigma>)) (cslift x) ntfn_Ptr (cnotification_relation (cslift x)) \<and> cmap_relation (map_to_pdes (ksPSpace \<sigma>)) (cslift x) pde_Ptr cpde_relation \<and> cmap_relation (map_to_ptes (ksPSpace \<sigma>)) (cslift x) pte_Ptr cpte_relation \<and> cmap_relation (map_to_asidpools (ksPSpace \<sigma>)) (cslift x) ap_Ptr casid_pool_relation \<and> cmap_relation (heap_to_user_data (ksPSpace \<sigma>) (underlying_memory (ksMachineState \<sigma>))) (cslift x) PTR(user_data_C) cuser_user_data_relation \<and> cmap_relation (heap_to_device_data (ksPSpace \<sigma>) (underlying_memory (ksMachineState \<sigma>))) (cslift x) PTR(user_data_device_C) cuser_user_data_device_relation \<and> carray_map_relation pdBits (map_to_pdes (ksPSpace \<sigma>)) (c_h_t_valid x) pd_Ptr \<and> carray_map_relation ptBits (map_to_ptes (ksPSpace \<sigma>)) (c_h_t_valid x) pt_Ptr
region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x
range_cover ptr sz (objBitsKO ko) (n * 2 ^ gbits)
size_of TYPE(user_data_device_C) = 2 ^ objBitsKO ko

goal (1 subgoal):
 1. cmap_relation (map_to_ctes (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>))) (clift (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x)))) cte_Ptr ccte_relation \<and> cpspace_tcb_relation (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)) (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))) \<and> cmap_relation (map_to_eps (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>))) (clift (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x)))) ep_Ptr (cendpoint_relation (clift (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))))) \<and> cmap_relation (map_to_ntfns (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>))) (clift (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x)))) ntfn_Ptr (cnotification_relation (clift (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))))) \<and> cmap_relation (map_to_pdes (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>))) (clift (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x)))) pde_Ptr cpde_relation \<and> cmap_relation (map_to_ptes (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>))) (clift (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x)))) pte_Ptr cpte_relation \<and> cmap_relation (map_to_asidpools (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>))) (clift (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x)))) ap_Ptr casid_pool_relation \<and> cpspace_user_data_relation (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)) (underlying_memory (ksMachineState \<sigma>)) (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))) \<and> cpspace_device_data_relation (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)) (underlying_memory (ksMachineState \<sigma>)) (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))) \<and> cpspace_pde_array_relation (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)) (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))) \<and> cpspace_pte_array_relation (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)) (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))) proof (prove)
using this:
cmap_relation (ctes_of \<sigma>) (cslift x) cte_Ptr ccte_relation \<and> cmap_relation (map_to_tcbs (ksPSpace \<sigma>)) (cslift x) tcb_ptr_to_ctcb_ptr ctcb_relation \<and> cmap_relation (map_to_eps (ksPSpace \<sigma>)) (cslift x) ep_Ptr (cendpoint_relation (cslift x)) \<and> cmap_relation (map_to_ntfns (ksPSpace \<sigma>)) (cslift x) ntfn_Ptr (cnotification_relation (cslift x)) \<and> cmap_relation (map_to_pdes (ksPSpace \<sigma>)) (cslift x) pde_Ptr cpde_relation \<and> cmap_relation (map_to_ptes (ksPSpace \<sigma>)) (cslift x) pte_Ptr cpte_relation \<and> cmap_relation (map_to_asidpools (ksPSpace \<sigma>)) (cslift x) ap_Ptr casid_pool_relation \<and> cmap_relation (heap_to_user_data (ksPSpace \<sigma>) (underlying_memory (ksMachineState \<sigma>))) (cslift x) PTR(user_data_C) cuser_user_data_relation \<and> cmap_relation (heap_to_device_data (ksPSpace \<sigma>) (underlying_memory (ksMachineState \<sigma>))) (cslift x) PTR(user_data_device_C) cuser_user_data_device_relation \<and> carray_map_relation pdBits (map_to_pdes (ksPSpace \<sigma>)) (c_h_t_valid x) pd_Ptr \<and> carray_map_relation ptBits (map_to_ptes (ksPSpace \<sigma>)) (c_h_t_valid x) pt_Ptr
region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x
range_cover ptr sz (objBitsKO ko) (n * 2 ^ gbits)
size_of TYPE(user_data_device_C) = 2 ^ objBitsKO ko

goal (1 subgoal):
 1. cmap_relation (map_to_ctes (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>))) (clift (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x)))) cte_Ptr ccte_relation \<and> cpspace_tcb_relation (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)) (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))) \<and> cmap_relation (map_to_eps (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>))) (clift (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x)))) ep_Ptr (cendpoint_relation (clift (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))))) \<and> cmap_relation (map_to_ntfns (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>))) (clift (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x)))) ntfn_Ptr (cnotification_relation (clift (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))))) \<and> cmap_relation (map_to_pdes (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>))) (clift (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x)))) pde_Ptr cpde_relation \<and> cmap_relation (map_to_ptes (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>))) (clift (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x)))) pte_Ptr cpte_relation \<and> cmap_relation (map_to_asidpools (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>))) (clift (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x)))) ap_Ptr casid_pool_relation \<and> cpspace_user_data_relation (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)) (underlying_memory (ksMachineState \<sigma>)) (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))) \<and> cpspace_device_data_relation (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)) (underlying_memory (ksMachineState \<sigma>)) (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))) \<and> cpspace_pde_array_relation (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)) (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))) \<and> cpspace_pte_array_relation (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)) (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))) proof (prove)
goal (1 subgoal):
 1. \<lbrakk>cmap_relation (ctes_of \<sigma>) (cslift x) cte_Ptr ccte_relation \<and> cmap_relation (map_to_tcbs (ksPSpace \<sigma>)) (cslift x) tcb_ptr_to_ctcb_ptr ctcb_relation \<and> cmap_relation (map_to_eps (ksPSpace \<sigma>)) (cslift x) ep_Ptr (cendpoint_relation (cslift x)) \<and> cmap_relation (map_to_ntfns (ksPSpace \<sigma>)) (cslift x) ntfn_Ptr (cnotification_relation (cslift x)) \<and> cmap_relation (map_to_pdes (ksPSpace \<sigma>)) (cslift x) pde_Ptr cpde_relation \<and> cmap_relation (map_to_ptes (ksPSpace \<sigma>)) (cslift x) pte_Ptr cpte_relation \<and> cmap_relation (map_to_asidpools (ksPSpace \<sigma>)) (cslift x) ap_Ptr casid_pool_relation \<and> cmap_relation (heap_to_user_data (ksPSpace \<sigma>) (underlying_memory (ksMachineState \<sigma>))) (cslift x) PTR(user_data_C) cuser_user_data_relation \<and> cmap_relation (heap_to_device_data (ksPSpace \<sigma>) (underlying_memory (ksMachineState \<sigma>))) (cslift x) PTR(user_data_device_C) cuser_user_data_device_relation \<and> carray_map_relation pdBits (map_to_pdes (ksPSpace \<sigma>)) (c_h_t_valid x) pd_Ptr \<and> carray_map_relation ptBits (map_to_ptes (ksPSpace \<sigma>)) (c_h_t_valid x) pt_Ptr; region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x; range_cover ptr sz (objBitsKO ko) (n * 2 ^ gbits); size_of TYPE(user_data_device_C) = 2 ^ objBitsKO ko\<rbrakk> \<Longrightarrow> cmap_relation (map_to_ctes (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>))) (clift (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x)))) cte_Ptr ccte_relation \<and> cpspace_tcb_relation (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)) (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))) \<and> cmap_relation (map_to_eps (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>))) (clift (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x)))) ep_Ptr (cendpoint_relation (clift (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))))) \<and> cmap_relation (map_to_ntfns (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>))) (clift (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x)))) ntfn_Ptr (cnotification_relation (clift (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))))) \<and> cmap_relation (map_to_pdes (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>))) (clift (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x)))) pde_Ptr cpde_relation \<and> cmap_relation (map_to_ptes (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>))) (clift (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x)))) pte_Ptr cpte_relation \<and> cmap_relation (map_to_asidpools (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>))) (clift (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x)))) ap_Ptr casid_pool_relation \<and> cpspace_user_data_relation (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)) (underlying_memory (ksMachineState \<sigma>)) (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))) \<and> cpspace_device_data_relation (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)) (underlying_memory (ksMachineState \<sigma>)) (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))) \<and> cpspace_pde_array_relation (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)) (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))) \<and> cpspace_pte_array_relation (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)) (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))) proof (prove)
goal (1 subgoal):
 1. \<lbrakk>region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x; range_cover ptr sz (objBitsKO ko) (n * 2 ^ gbits); 2 ^ objBitsKO ko = 4096; cmap_relation (ctes_of \<sigma>) (cslift x) cte_Ptr ccte_relation; cmap_relation (map_to_tcbs (ksPSpace \<sigma>)) (cslift x) tcb_ptr_to_ctcb_ptr ctcb_relation; cmap_relation (map_to_eps (ksPSpace \<sigma>)) (cslift x) ep_Ptr (cendpoint_relation (cslift x)); cmap_relation (map_to_ntfns (ksPSpace \<sigma>)) (cslift x) ntfn_Ptr (cnotification_relation (cslift x)); cmap_relation (map_to_pdes (ksPSpace \<sigma>)) (cslift x) pde_Ptr cpde_relation; cmap_relation (map_to_ptes (ksPSpace \<sigma>)) (cslift x) pte_Ptr cpte_relation; cmap_relation (map_to_asidpools (ksPSpace \<sigma>)) (cslift x) ap_Ptr casid_pool_relation; cmap_relation (heap_to_user_data (ksPSpace \<sigma>) (underlying_memory (ksMachineState \<sigma>))) (cslift x) PTR(user_data_C) cuser_user_data_relation; cmap_relation (heap_to_device_data (ksPSpace \<sigma>) (underlying_memory (ksMachineState \<sigma>))) (cslift x) PTR(user_data_device_C) cuser_user_data_device_relation; carray_map_relation pdBits (map_to_pdes (ksPSpace \<sigma>)) (c_h_t_valid x) pd_Ptr; carray_map_relation ptBits (map_to_ptes (ksPSpace \<sigma>)) (c_h_t_valid x) pt_Ptr\<rbrakk> \<Longrightarrow> cmap_relation (map_to_ctes (\<lambda>x. if x \<in> set (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) then Some KOUserDataDevice else ksPSpace \<sigma> x)) (cslift x) cte_Ptr ccte_relation \<and> cmap_relation (map_to_tcbs (\<lambda>x. if x \<in> set (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) then Some KOUserDataDevice else ksPSpace \<sigma> x)) (cslift x) tcb_ptr_to_ctcb_ptr ctcb_relation \<and> cmap_relation (map_to_eps (\<lambda>x. if x \<in> set (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) then Some KOUserDataDevice else ksPSpace \<sigma> x)) (cslift x) ep_Ptr (cendpoint_relation (cslift x)) \<and> cmap_relation (map_to_ntfns (\<lambda>x. if x \<in> set (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) then Some KOUserDataDevice else ksPSpace \<sigma> x)) (cslift x) ntfn_Ptr (cnotification_relation (cslift x)) \<and> cmap_relation (map_to_pdes (\<lambda>x. if x \<in> set (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) then Some KOUserDataDevice else ksPSpace \<sigma> x)) (cslift x) pde_Ptr cpde_relation \<and> cmap_relation (map_to_ptes (\<lambda>x. if x \<in> set (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) then Some KOUserDataDevice else ksPSpace \<sigma> x)) (cslift x) pte_Ptr cpte_relation \<and> cmap_relation (map_to_asidpools (\<lambda>x. if x \<in> set (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) then Some KOUserDataDevice else ksPSpace \<sigma> x)) (cslift x) ap_Ptr casid_pool_relation \<and> cmap_relation (heap_to_user_data (\<lambda>x. if x \<in> set (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) then Some KOUserDataDevice else ksPSpace \<sigma> x) (underlying_memory (ksMachineState \<sigma>))) (cslift x) PTR(user_data_C) cuser_user_data_relation \<and> cpspace_device_data_relation (\<lambda>x. if x \<in> set (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) then Some KOUserDataDevice else ksPSpace \<sigma> x) (underlying_memory (ksMachineState \<sigma>)) (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))) \<and> carray_map_relation pdBits (map_to_pdes (\<lambda>x. if x \<in> set (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) then Some KOUserDataDevice else ksPSpace \<sigma> x)) (c_h_t_valid x) pd_Ptr \<and> carray_map_relation ptBits (map_to_ptes (\<lambda>x. if x \<in> set (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) then Some KOUserDataDevice else ksPSpace \<sigma> x)) (c_h_t_valid x) pt_Ptr proof (prove)
goal (1 subgoal):
 1. \<lbrakk>region_is_bytes ptr (n * 2 ^ gbits * 2 ^ pageBits) x; range_cover ptr sz (objBitsKO KOUserDataDevice) (n * 2 ^ gbits); 2 ^ objBitsKO KOUserDataDevice = 4096; cmap_relation (ctes_of \<sigma>) (cslift x) cte_Ptr ccte_relation; cmap_relation (map_to_tcbs (ksPSpace \<sigma>)) (cslift x) tcb_ptr_to_ctcb_ptr ctcb_relation; cmap_relation (map_to_eps (ksPSpace \<sigma>)) (cslift x) ep_Ptr (cendpoint_relation (cslift x)); cmap_relation (map_to_ntfns (ksPSpace \<sigma>)) (cslift x) ntfn_Ptr (cnotification_relation (cslift x)); cmap_relation (map_to_pdes (ksPSpace \<sigma>)) (cslift x) pde_Ptr cpde_relation; cmap_relation (map_to_ptes (ksPSpace \<sigma>)) (cslift x) pte_Ptr cpte_relation; cmap_relation (map_to_asidpools (ksPSpace \<sigma>)) (cslift x) ap_Ptr casid_pool_relation; cmap_relation (heap_to_user_data (ksPSpace \<sigma>) (underlying_memory (ksMachineState \<sigma>))) (cslift x) PTR(user_data_C) cuser_user_data_relation; cmap_relation (heap_to_device_data (ksPSpace \<sigma>) (underlying_memory (ksMachineState \<sigma>))) (cslift x) PTR(user_data_device_C) cuser_user_data_device_relation; carray_map_relation pdBits (map_to_pdes (ksPSpace \<sigma>)) (c_h_t_valid x) pd_Ptr; carray_map_relation ptBits (map_to_ptes (ksPSpace \<sigma>)) (c_h_t_valid x) pt_Ptr\<rbrakk> \<Longrightarrow> cpspace_device_data_relation (\<lambda>x. if x \<in> set (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) then Some KOUserDataDevice else ksPSpace \<sigma> x) (underlying_memory (ksMachineState \<sigma>)) (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))) proof (prove)
goal (2 subgoals):
 1. \<lbrakk>region_is_bytes ptr (n * 2 ^ gbits * 2 ^ pageBits) x; range_cover ptr sz (objBitsKO KOUserDataDevice) (n * 2 ^ gbits); 2 ^ objBitsKO KOUserDataDevice = 4096; cmap_relation (ctes_of \<sigma>) (cslift x) cte_Ptr ccte_relation; cmap_relation (map_to_tcbs (ksPSpace \<sigma>)) (cslift x) tcb_ptr_to_ctcb_ptr ctcb_relation; cmap_relation (map_to_eps (ksPSpace \<sigma>)) (cslift x) ep_Ptr (cendpoint_relation (cslift x)); cmap_relation (map_to_ntfns (ksPSpace \<sigma>)) (cslift x) ntfn_Ptr (cnotification_relation (cslift x)); cmap_relation (map_to_pdes (ksPSpace \<sigma>)) (cslift x) pde_Ptr cpde_relation; cmap_relation (map_to_ptes (ksPSpace \<sigma>)) (cslift x) pte_Ptr cpte_relation; cmap_relation (map_to_asidpools (ksPSpace \<sigma>)) (cslift x) ap_Ptr casid_pool_relation; cmap_relation (heap_to_user_data (ksPSpace \<sigma>) (underlying_memory (ksMachineState \<sigma>))) (cslift x) PTR(user_data_C) cuser_user_data_relation; cmap_relation (heap_to_device_data (ksPSpace \<sigma>) (underlying_memory (ksMachineState \<sigma>))) (cslift x) PTR(user_data_device_C) cuser_user_data_device_relation; carray_map_relation pdBits (map_to_pdes (ksPSpace \<sigma>)) (c_h_t_valid x) pd_Ptr; carray_map_relation ptBits (map_to_ptes (ksPSpace \<sigma>)) (c_h_t_valid x) pt_Ptr\<rbrakk> \<Longrightarrow> PTR(user_data_device_C) ` dom (heap_to_device_data (\<lambda>x. if x \<in> set (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) then Some KOUserDataDevice else ksPSpace \<sigma> x) (underlying_memory (ksMachineState \<sigma>))) = dom (clift (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))))
 2. \<And>xa v v'. \<lbrakk>region_is_bytes ptr (n * 2 ^ gbits * 2 ^ pageBits) x; range_cover ptr sz (objBitsKO KOUserDataDevice) (n * 2 ^ gbits); 2 ^ objBitsKO KOUserDataDevice = 4096; cmap_relation (ctes_of \<sigma>) (cslift x) cte_Ptr ccte_relation; cmap_relation (map_to_tcbs (ksPSpace \<sigma>)) (cslift x) tcb_ptr_to_ctcb_ptr ctcb_relation; cmap_relation (map_to_eps (ksPSpace \<sigma>)) (cslift x) ep_Ptr (cendpoint_relation (cslift x)); cmap_relation (map_to_ntfns (ksPSpace \<sigma>)) (cslift x) ntfn_Ptr (cnotification_relation (cslift x)); cmap_relation (map_to_pdes (ksPSpace \<sigma>)) (cslift x) pde_Ptr cpde_relation; cmap_relation (map_to_ptes (ksPSpace \<sigma>)) (cslift x) pte_Ptr cpte_relation; cmap_relation (map_to_asidpools (ksPSpace \<sigma>)) (cslift x) ap_Ptr casid_pool_relation; cmap_relation (heap_to_user_data (ksPSpace \<sigma>) (underlying_memory (ksMachineState \<sigma>))) (cslift x) PTR(user_data_C) cuser_user_data_relation; cmap_relation (heap_to_device_data (ksPSpace \<sigma>) (underlying_memory (ksMachineState \<sigma>))) (cslift x) PTR(user_data_device_C) cuser_user_data_device_relation; carray_map_relation pdBits (map_to_pdes (ksPSpace \<sigma>)) (c_h_t_valid x) pd_Ptr; carray_map_relation ptBits (map_to_ptes (ksPSpace \<sigma>)) (c_h_t_valid x) pt_Ptr; heap_to_device_data (\<lambda>x. if x \<in> set (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) then Some KOUserDataDevice else ksPSpace \<sigma> x) (underlying_memory (ksMachineState \<sigma>)) xa = Some v; clift (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))) (PTR(user_data_device_C) xa) = Some v'\<rbrakk> \<Longrightarrow> cuser_user_data_device_relation v v' proof (prove)
goal (1 subgoal):
 1. \<And>xa v v'. \<lbrakk>region_is_bytes ptr (n * 2 ^ gbits * 2 ^ pageBits) x; range_cover ptr sz (objBitsKO KOUserDataDevice) (n * 2 ^ gbits); 2 ^ objBitsKO KOUserDataDevice = 4096; cmap_relation (ctes_of \<sigma>) (cslift x) cte_Ptr ccte_relation; cmap_relation (map_to_tcbs (ksPSpace \<sigma>)) (cslift x) tcb_ptr_to_ctcb_ptr ctcb_relation; cmap_relation (map_to_eps (ksPSpace \<sigma>)) (cslift x) ep_Ptr (cendpoint_relation (cslift x)); cmap_relation (map_to_ntfns (ksPSpace \<sigma>)) (cslift x) ntfn_Ptr (cnotification_relation (cslift x)); cmap_relation (map_to_pdes (ksPSpace \<sigma>)) (cslift x) pde_Ptr cpde_relation; cmap_relation (map_to_ptes (ksPSpace \<sigma>)) (cslift x) pte_Ptr cpte_relation; cmap_relation (map_to_asidpools (ksPSpace \<sigma>)) (cslift x) ap_Ptr casid_pool_relation; cmap_relation (heap_to_user_data (ksPSpace \<sigma>) (underlying_memory (ksMachineState \<sigma>))) (cslift x) PTR(user_data_C) cuser_user_data_relation; cmap_relation (heap_to_device_data (ksPSpace \<sigma>) (underlying_memory (ksMachineState \<sigma>))) (cslift x) PTR(user_data_device_C) cuser_user_data_device_relation; carray_map_relation pdBits (map_to_pdes (ksPSpace \<sigma>)) (c_h_t_valid x) pd_Ptr; carray_map_relation ptBits (map_to_ptes (ksPSpace \<sigma>)) (c_h_t_valid x) pt_Ptr; heap_to_device_data (\<lambda>x. if x \<in> set (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) then Some KOUserDataDevice else ksPSpace \<sigma> x) (underlying_memory (ksMachineState \<sigma>)) xa = Some v; clift (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))) (PTR(user_data_device_C) xa) = Some v'\<rbrakk> \<Longrightarrow> cuser_user_data_device_relation v v' proof (prove)
goal:
No subgoals! proof (state)
this:
cpspace_relation (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)) (underlying_memory (ksMachineState \<sigma>)) (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x)))

goal (1 subgoal):
 1. \<And>\<sigma> x. (\<sigma>, x) \<in> rf_sr \<and> range_cover ptr sz (gbits + pageBits) n \<and> ptr \<noteq> 0 \<and> pspace_aligned' \<sigma> \<and> pspace_distinct' \<sigma> \<and> pspace_no_overlap' ptr sz \<sigma> \<and> (valid_objs' and untyped_ranges_zero' and caps_overlap_reserved' {ptr..+n * 2 ^ (gbits + pageBits)}) \<sigma> \<and> region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x \<and> {ptr..+n * 2 ^ (gbits + pageBits)} \<inter> kernel_data_refs = {} \<Longrightarrow> (\<sigma>\<lparr>ksPSpace := foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)\<rparr>, x\<lparr>globals := globals x\<lparr>t_hrs_' := hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))\<rparr>\<rparr>) \<in> rf_sr proof (state)
this:
cpspace_relation (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)) (underlying_memory (ksMachineState \<sigma>)) (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x)))

goal (1 subgoal):
 1. \<And>\<sigma> x. (\<sigma>, x) \<in> rf_sr \<and> range_cover ptr sz (gbits + pageBits) n \<and> ptr \<noteq> 0 \<and> pspace_aligned' \<sigma> \<and> pspace_distinct' \<sigma> \<and> pspace_no_overlap' ptr sz \<sigma> \<and> (valid_objs' and untyped_ranges_zero' and caps_overlap_reserved' {ptr..+n * 2 ^ (gbits + pageBits)}) \<sigma> \<and> region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x \<and> {ptr..+n * 2 ^ (gbits + pageBits)} \<inter> kernel_data_refs = {} \<Longrightarrow> (\<sigma>\<lparr>ksPSpace := foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)\<rparr>, x\<lparr>globals := globals x\<lparr>t_hrs_' := hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))\<rparr>\<rparr>) \<in> rf_sr proof (prove)
using this:
cpspace_relation (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)) (underlying_memory (ksMachineState \<sigma>)) (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x)))

goal (1 subgoal):
 1. (\<sigma>\<lparr>ksPSpace := foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)\<rparr>, x\<lparr>globals := globals x\<lparr>t_hrs_' := hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))\<rparr>\<rparr>) \<in> rf_sr proof (prove)
using this:
cpspace_relation (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)) (underlying_memory (ksMachineState \<sigma>)) (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x)))
(\<sigma>, x) \<in> rf_sr
region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x
{ptr..+n * 2 ^ (gbits + pageBits)} \<inter> kernel_data_refs = {}
(valid_objs' and untyped_ranges_zero' and caps_overlap_reserved' {ptr..+n * 2 ^ (gbits + pageBits)}) \<sigma>

goal (1 subgoal):
 1. (\<sigma>\<lparr>ksPSpace := foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)\<rparr>, x\<lparr>globals := globals x\<lparr>t_hrs_' := hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))\<rparr>\<rparr>) \<in> rf_sr proof (prove)
goal (1 subgoal):
 1. \<lbrakk>cpspace_relation (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)) (underlying_memory (ksMachineState \<sigma>)) (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))); cpspace_relation (ksPSpace \<sigma>) (underlying_memory (ksMachineState \<sigma>)) (t_hrs_' (globals x)) \<and> cready_queues_relation (cslift x) (ksReadyQueues_' (globals x)) (ksReadyQueues \<sigma>) \<and> zero_ranges_are_zero (gsUntypedZeroRanges \<sigma>) (t_hrs_' (globals x)) \<and> cbitmap_L1_relation (ksReadyQueuesL1Bitmap_' (globals x)) (ksReadyQueuesL1Bitmap \<sigma>) \<and> cbitmap_L2_relation (ksReadyQueuesL2Bitmap_' (globals x)) (ksReadyQueuesL2Bitmap \<sigma>) \<and> ksCurThread_' (globals x) = tcb_ptr_to_ctcb_ptr (ksCurThread \<sigma>) \<and> ksIdleThread_' (globals x) = tcb_ptr_to_ctcb_ptr (ksIdleThread \<sigma>) \<and> cinterrupt_relation (ksInterruptState \<sigma>) intStateIRQNode_array_Ptr (intStateIRQTable_' (globals x)) \<and> cscheduler_action_relation (ksSchedulerAction \<sigma>) (ksSchedulerAction_' (globals x)) \<and> carch_state_relation (ksArchState \<sigma>) (globals x) \<and> cmachine_state_relation (ksMachineState \<sigma>) (globals x) \<and> cte_array_relation \<sigma> (globals x) \<and> tcb_cte_array_relation \<sigma> (globals x) \<and> apsnd fst (ghost'state_' (globals x)) = (gsUserPages \<sigma>, gsCNodes \<sigma>) \<and> ghost_size_rel (ghost'state_' (globals x)) (gsMaxObjectSize \<sigma>) \<and> ksWorkUnitsCompleted_' (globals x) = ksWorkUnitsCompleted \<sigma> \<and> x \<Turnstile>\<^sub>c intStateIRQNode_array_Ptr \<and> {symbol_table ''intStateIRQNode''..+256 * size_of TYPE(cte_C)} \<subseteq> kernel_data_refs \<and> x \<Turnstile>\<^sub>c armKSGlobalPD_Ptr \<and> {symbol_table ''armKSGlobalPD''..+16384} \<subseteq> kernel_data_refs \<and> htd_safe domain (hrs_htd (t_hrs_' (globals x))) \<and> - domain \<subseteq> kernel_data_refs \<and> globals_list_distinct (- kernel_data_refs) symbol_table kernel_all_global_addresses.global_data_list \<and> cdom_schedule_relation (kernel_state.ksDomSchedule \<sigma>) kernel_all_global_addresses.ksDomSchedule \<and> ksDomScheduleIdx_' (globals x) = word_of_nat (ksDomScheduleIdx \<sigma>) \<and> ksCurDomain_' (globals x) = UCAST(8 \<rightarrow> 32) (ksCurDomain \<sigma>) \<and> ksDomainTime_' (globals x) = ksDomainTime \<sigma>; region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x; {ptr..+n * 2 ^ (gbits + pageBits)} \<inter> kernel_data_refs = {}; valid_objs' \<sigma> \<and> untyped_ranges_zero' \<sigma> \<and> caps_overlap_reserved' {ptr..+n * 2 ^ (gbits + pageBits)} \<sigma>\<rbrakk> \<Longrightarrow> zero_ranges_are_zero (gsUntypedZeroRanges \<sigma>) (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))) \<and> carch_state_relation (ksArchState \<sigma>) (globals x\<lparr>t_hrs_' := hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))\<rparr>) \<and> cmachine_state_relation (ksMachineState \<sigma>) (globals x\<lparr>t_hrs_' := hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))\<rparr>) \<and> cvariable_array_map_relation (gsCNodes \<sigma>) ((^) 2) cte_Ptr (hrs_htd (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x)))) \<and> cvariable_array_map_relation (map_to_tcbs (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>))) (\<lambda>x. 5) cte_Ptr (hrs_htd (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x)))) \<and> hrs_htd (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))) \<Turnstile>\<^sub>t intStateIRQNode_array_Ptr \<and> hrs_htd (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))) \<Turnstile>\<^sub>t armKSGlobalPD_Ptr \<and> htd_safe domain (hrs_htd (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x)))) proof (prove)
goal (1 subgoal):
 1. \<lbrakk>cpspace_relation (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)) (underlying_memory (ksMachineState \<sigma>)) (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))); cpspace_relation (ksPSpace \<sigma>) (underlying_memory (ksMachineState \<sigma>)) (t_hrs_' (globals x)) \<and> cready_queues_relation (cslift x) (ksReadyQueues_' (globals x)) (ksReadyQueues \<sigma>) \<and> zero_ranges_are_zero (gsUntypedZeroRanges \<sigma>) (t_hrs_' (globals x)) \<and> cbitmap_L1_relation (ksReadyQueuesL1Bitmap_' (globals x)) (ksReadyQueuesL1Bitmap \<sigma>) \<and> cbitmap_L2_relation (ksReadyQueuesL2Bitmap_' (globals x)) (ksReadyQueuesL2Bitmap \<sigma>) \<and> ksCurThread_' (globals x) = tcb_ptr_to_ctcb_ptr (ksCurThread \<sigma>) \<and> ksIdleThread_' (globals x) = tcb_ptr_to_ctcb_ptr (ksIdleThread \<sigma>) \<and> cinterrupt_relation (ksInterruptState \<sigma>) intStateIRQNode_array_Ptr (intStateIRQTable_' (globals x)) \<and> cscheduler_action_relation (ksSchedulerAction \<sigma>) (ksSchedulerAction_' (globals x)) \<and> armKSNextASID_' (globals x) = armKSNextASID (ksArchState \<sigma>) \<and> armKSKernelVSpace (ksArchState \<sigma>) = armKSKernelVSpace_C \<and> array_relation ((=) \<circ> option_to_0) 0xFF (armKSHWASIDTable (ksArchState \<sigma>)) (armKSHWASIDTable_' (globals x)) \<and> array_relation ((=) \<circ> option_to_ptr) (2 ^ local.asid_high_bits - 1) (armKSASIDTable (ksArchState \<sigma>)) (armKSASIDTable_' (globals x)) \<and> asid_map_pd_to_hwasids (armKSASIDMap (ksArchState \<sigma>)) = set_option \<circ> (pde_stored_asid \<circ>\<^sub>m cslift x \<circ>\<^sub>m pd_pointer_to_asid_slot) \<and> carch_globals (ksArchState \<sigma>) \<and> irq_masks (ksMachineState \<sigma>) = irq_masks (phantom_machine_state_' (globals x)) \<and> irq_state (ksMachineState \<sigma>) = irq_state (phantom_machine_state_' (globals x)) \<and> device_state (ksMachineState \<sigma>) = device_state (phantom_machine_state_' (globals x)) \<and> exclusive_state (ksMachineState \<sigma>) = exclusive_state (phantom_machine_state_' (globals x)) \<and> machine_state_rest (ksMachineState \<sigma>) = machine_state_rest (phantom_machine_state_' (globals x)) \<and> cte_array_relation \<sigma> (globals x) \<and> tcb_cte_array_relation \<sigma> (globals x) \<and> apsnd fst (ghost'state_' (globals x)) = (gsUserPages \<sigma>, gsCNodes \<sigma>) \<and> ghost_size_rel (ghost'state_' (globals x)) (gsMaxObjectSize \<sigma>) \<and> ksWorkUnitsCompleted_' (globals x) = ksWorkUnitsCompleted \<sigma> \<and> x \<Turnstile>\<^sub>c intStateIRQNode_array_Ptr \<and> {symbol_table ''intStateIRQNode''..+256 * size_of TYPE(cte_C)} \<subseteq> kernel_data_refs \<and> x \<Turnstile>\<^sub>c armKSGlobalPD_Ptr \<and> {symbol_table ''armKSGlobalPD''..+16384} \<subseteq> kernel_data_refs \<and> htd_safe domain (hrs_htd (t_hrs_' (globals x))) \<and> - domain \<subseteq> kernel_data_refs \<and> globals_list_distinct (- kernel_data_refs) symbol_table kernel_all_global_addresses.global_data_list \<and> cdom_schedule_relation (kernel_state.ksDomSchedule \<sigma>) kernel_all_global_addresses.ksDomSchedule \<and> ksDomScheduleIdx_' (globals x) = word_of_nat (ksDomScheduleIdx \<sigma>) \<and> ksCurDomain_' (globals x) = UCAST(8 \<rightarrow> 32) (ksCurDomain \<sigma>) \<and> ksDomainTime_' (globals x) = ksDomainTime \<sigma>; region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x; {ptr..+n * 2 ^ (gbits + pageBits)} \<inter> kernel_data_refs = {}; valid_objs' \<sigma> \<and> untyped_ranges_zero' \<sigma> \<and> caps_overlap_reserved' {ptr..+n * 2 ^ (gbits + pageBits)} \<sigma>\<rbrakk> \<Longrightarrow> zero_ranges_are_zero (gsUntypedZeroRanges \<sigma>) (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))) \<and> set_option \<circ> (pde_stored_asid \<circ>\<^sub>m cslift x \<circ>\<^sub>m pd_pointer_to_asid_slot) = set_option \<circ> (pde_stored_asid \<circ>\<^sub>m clift (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))) \<circ>\<^sub>m pd_pointer_to_asid_slot) \<and> cvariable_array_map_relation (gsCNodes \<sigma>) ((^) 2) cte_Ptr (hrs_htd (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x)))) \<and> cvariable_array_map_relation (map_to_tcbs (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>))) (\<lambda>x. 5) cte_Ptr (hrs_htd (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x)))) \<and> hrs_htd (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))) \<Turnstile>\<^sub>t intStateIRQNode_array_Ptr \<and> hrs_htd (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))) \<Turnstile>\<^sub>t armKSGlobalPD_Ptr \<and> htd_safe domain (hrs_htd (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x)))) proof (prove)
goal (1 subgoal):
 1. \<lbrakk>cpspace_relation (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)) (underlying_memory (ksMachineState \<sigma>)) (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))); cpspace_relation (ksPSpace \<sigma>) (underlying_memory (ksMachineState \<sigma>)) (t_hrs_' (globals x)) \<and> cready_queues_relation (cslift x) (ksReadyQueues_' (globals x)) (ksReadyQueues \<sigma>) \<and> zero_ranges_are_zero (gsUntypedZeroRanges \<sigma>) (t_hrs_' (globals x)) \<and> cbitmap_L1_relation (ksReadyQueuesL1Bitmap_' (globals x)) (ksReadyQueuesL1Bitmap \<sigma>) \<and> cbitmap_L2_relation (ksReadyQueuesL2Bitmap_' (globals x)) (ksReadyQueuesL2Bitmap \<sigma>) \<and> ksCurThread_' (globals x) = tcb_ptr_to_ctcb_ptr (ksCurThread \<sigma>) \<and> ksIdleThread_' (globals x) = tcb_ptr_to_ctcb_ptr (ksIdleThread \<sigma>) \<and> cinterrupt_relation (ksInterruptState \<sigma>) intStateIRQNode_array_Ptr (intStateIRQTable_' (globals x)) \<and> cscheduler_action_relation (ksSchedulerAction \<sigma>) (ksSchedulerAction_' (globals x)) \<and> armKSNextASID_' (globals x) = armKSNextASID (ksArchState \<sigma>) \<and> armKSKernelVSpace (ksArchState \<sigma>) = armKSKernelVSpace_C \<and> array_relation ((=) \<circ> option_to_0) 0xFF (armKSHWASIDTable (ksArchState \<sigma>)) (armKSHWASIDTable_' (globals x)) \<and> array_relation ((=) \<circ> option_to_ptr) (2 ^ local.asid_high_bits - 1) (armKSASIDTable (ksArchState \<sigma>)) (armKSASIDTable_' (globals x)) \<and> asid_map_pd_to_hwasids (armKSASIDMap (ksArchState \<sigma>)) = set_option \<circ> (pde_stored_asid \<circ>\<^sub>m cslift x \<circ>\<^sub>m pd_pointer_to_asid_slot) \<and> carch_globals (ksArchState \<sigma>) \<and> irq_masks (ksMachineState \<sigma>) = irq_masks (phantom_machine_state_' (globals x)) \<and> irq_state (ksMachineState \<sigma>) = irq_state (phantom_machine_state_' (globals x)) \<and> device_state (ksMachineState \<sigma>) = device_state (phantom_machine_state_' (globals x)) \<and> exclusive_state (ksMachineState \<sigma>) = exclusive_state (phantom_machine_state_' (globals x)) \<and> machine_state_rest (ksMachineState \<sigma>) = machine_state_rest (phantom_machine_state_' (globals x)) \<and> cte_array_relation \<sigma> (globals x) \<and> tcb_cte_array_relation \<sigma> (globals x) \<and> apsnd fst (ghost'state_' (globals x)) = (gsUserPages \<sigma>, gsCNodes \<sigma>) \<and> ghost_size_rel (ghost'state_' (globals x)) (gsMaxObjectSize \<sigma>) \<and> ksWorkUnitsCompleted_' (globals x) = ksWorkUnitsCompleted \<sigma> \<and> (\<exists>v. cslift x intStateIRQNode_array_Ptr = Some v) \<and> {symbol_table ''intStateIRQNode''..+256 * size_of TYPE(cte_C)} \<subseteq> kernel_data_refs \<and> (\<exists>v. cslift x armKSGlobalPD_Ptr = Some v) \<and> {symbol_table ''armKSGlobalPD''..+16384} \<subseteq> kernel_data_refs \<and> htd_safe domain (hrs_htd (t_hrs_' (globals x))) \<and> - domain \<subseteq> kernel_data_refs \<and> globals_list_distinct (- kernel_data_refs) symbol_table kernel_all_global_addresses.global_data_list \<and> cdom_schedule_relation (kernel_state.ksDomSchedule \<sigma>) kernel_all_global_addresses.ksDomSchedule \<and> ksDomScheduleIdx_' (globals x) = word_of_nat (ksDomScheduleIdx \<sigma>) \<and> ksCurDomain_' (globals x) = UCAST(8 \<rightarrow> 32) (ksCurDomain \<sigma>) \<and> ksDomainTime_' (globals x) = ksDomainTime \<sigma>; region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x; {ptr..+n * 2 ^ (gbits + pageBits)} \<inter> kernel_data_refs = {}; valid_objs' \<sigma> \<and> untyped_ranges_zero' \<sigma> \<and> caps_overlap_reserved' {ptr..+n * 2 ^ (gbits + pageBits)} \<sigma>\<rbrakk> \<Longrightarrow> zero_ranges_are_zero (gsUntypedZeroRanges \<sigma>) (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))) \<and> cvariable_array_map_relation (gsCNodes \<sigma>) ((^) 2) cte_Ptr (hrs_htd (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x)))) \<and> cvariable_array_map_relation (map_to_tcbs (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>))) (\<lambda>x. 5) cte_Ptr (hrs_htd (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x)))) \<and> htd_safe domain (hrs_htd (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x)))) proof (prove)
goal (1 subgoal):
 1. \<And>v va. \<lbrakk>cpspace_relation (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)) (underlying_memory (ksMachineState \<sigma>)) (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))); region_is_bytes ptr (n * 2 ^ (gbits + pageBits)) x; {ptr..+n * 2 ^ (gbits + pageBits)} \<inter> kernel_data_refs = {}; cpspace_relation (ksPSpace \<sigma>) (underlying_memory (ksMachineState \<sigma>)) (t_hrs_' (globals x)); valid_objs' \<sigma>; cready_queues_relation (cslift x) (ksReadyQueues_' (globals x)) (ksReadyQueues \<sigma>); untyped_ranges_zero' \<sigma>; caps_overlap_reserved' {ptr..+n * 2 ^ (gbits + pageBits)} \<sigma>; zero_ranges_are_zero (gsUntypedZeroRanges \<sigma>) (t_hrs_' (globals x)); cbitmap_L1_relation (ksReadyQueuesL1Bitmap_' (globals x)) (ksReadyQueuesL1Bitmap \<sigma>); cbitmap_L2_relation (ksReadyQueuesL2Bitmap_' (globals x)) (ksReadyQueuesL2Bitmap \<sigma>); ksCurThread_' (globals x) = tcb_ptr_to_ctcb_ptr (ksCurThread \<sigma>); ksIdleThread_' (globals x) = tcb_ptr_to_ctcb_ptr (ksIdleThread \<sigma>); cinterrupt_relation (ksInterruptState \<sigma>) intStateIRQNode_array_Ptr (intStateIRQTable_' (globals x)); cscheduler_action_relation (ksSchedulerAction \<sigma>) (ksSchedulerAction_' (globals x)); armKSNextASID_' (globals x) = armKSNextASID (ksArchState \<sigma>); armKSKernelVSpace_C = armKSKernelVSpace (ksArchState \<sigma>); array_relation ((=) \<circ> option_to_0) 0xFF (armKSHWASIDTable (ksArchState \<sigma>)) (armKSHWASIDTable_' (globals x)); array_relation ((=) \<circ> option_to_ptr) (2 ^ local.asid_high_bits - 1) (armKSASIDTable (ksArchState \<sigma>)) (armKSASIDTable_' (globals x)); asid_map_pd_to_hwasids (armKSASIDMap (ksArchState \<sigma>)) = set_option \<circ> (pde_stored_asid \<circ>\<^sub>m cslift x \<circ>\<^sub>m pd_pointer_to_asid_slot); carch_globals (ksArchState \<sigma>); irq_masks (ksMachineState \<sigma>) = irq_masks (phantom_machine_state_' (globals x)); irq_state (ksMachineState \<sigma>) = irq_state (phantom_machine_state_' (globals x)); device_state (ksMachineState \<sigma>) = device_state (phantom_machine_state_' (globals x)); exclusive_state (ksMachineState \<sigma>) = exclusive_state (phantom_machine_state_' (globals x)); machine_state_rest (ksMachineState \<sigma>) = machine_state_rest (phantom_machine_state_' (globals x)); cte_array_relation \<sigma> (globals x); tcb_cte_array_relation \<sigma> (globals x); apsnd fst (ghost'state_' (globals x)) = (gsUserPages \<sigma>, gsCNodes \<sigma>); ghost_size_rel (ghost'state_' (globals x)) (gsMaxObjectSize \<sigma>); ksWorkUnitsCompleted_' (globals x) = ksWorkUnitsCompleted \<sigma>; cslift x intStateIRQNode_array_Ptr = Some v; {symbol_table ''intStateIRQNode''..+256 * size_of TYPE(cte_C)} \<subseteq> kernel_data_refs; cslift x armKSGlobalPD_Ptr = Some va; {symbol_table ''armKSGlobalPD''..+16384} \<subseteq> kernel_data_refs; htd_safe domain (hrs_htd (t_hrs_' (globals x))); - domain \<subseteq> kernel_data_refs; globals_list_distinct (- kernel_data_refs) symbol_table kernel_all_global_addresses.global_data_list; cdom_schedule_relation (kernel_state.ksDomSchedule \<sigma>) kernel_all_global_addresses.ksDomSchedule; ksDomScheduleIdx_' (globals x) = word_of_nat (ksDomScheduleIdx \<sigma>); ksCurDomain_' (globals x) = UCAST(8 \<rightarrow> 32) (ksCurDomain \<sigma>); ksDomainTime_' (globals x) = ksDomainTime \<sigma>\<rbrakk> \<Longrightarrow> zero_ranges_are_zero (gsUntypedZeroRanges \<sigma>) (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))) \<and> cvariable_array_map_relation (map_to_tcbs (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>))) (\<lambda>x. 5) cte_Ptr (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr (hrs_htd (t_hrs_' (globals x)))) \<and> htd_safe domain (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr (hrs_htd (t_hrs_' (globals x)))) proof (prove)
goal (1 subgoal):
 1. \<And>v va. \<lbrakk>cpspace_relation (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)) (underlying_memory (ksMachineState \<sigma>)) (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))); region_is_bytes ptr (n * (2 ^ gbits * 2 ^ pageBits)) x; {ptr..+n * (2 ^ gbits * 2 ^ pageBits)} \<inter> kernel_data_refs = {}; cpspace_relation (ksPSpace \<sigma>) (underlying_memory (ksMachineState \<sigma>)) (t_hrs_' (globals x)); valid_objs' \<sigma>; cready_queues_relation (cslift x) (ksReadyQueues_' (globals x)) (ksReadyQueues \<sigma>); untyped_ranges_zero' \<sigma>; caps_overlap_reserved' {ptr..+n * (2 ^ gbits * 2 ^ pageBits)} \<sigma>; zero_ranges_are_zero (gsUntypedZeroRanges \<sigma>) (t_hrs_' (globals x)); cbitmap_L1_relation (ksReadyQueuesL1Bitmap_' (globals x)) (ksReadyQueuesL1Bitmap \<sigma>); cbitmap_L2_relation (ksReadyQueuesL2Bitmap_' (globals x)) (ksReadyQueuesL2Bitmap \<sigma>); ksCurThread_' (globals x) = tcb_ptr_to_ctcb_ptr (ksCurThread \<sigma>); ksIdleThread_' (globals x) = tcb_ptr_to_ctcb_ptr (ksIdleThread \<sigma>); cinterrupt_relation (ksInterruptState \<sigma>) intStateIRQNode_array_Ptr (intStateIRQTable_' (globals x)); cscheduler_action_relation (ksSchedulerAction \<sigma>) (ksSchedulerAction_' (globals x)); armKSNextASID_' (globals x) = armKSNextASID (ksArchState \<sigma>); armKSKernelVSpace_C = armKSKernelVSpace (ksArchState \<sigma>); array_relation ((=) \<circ> option_to_0) 0xFF (armKSHWASIDTable (ksArchState \<sigma>)) (armKSHWASIDTable_' (globals x)); array_relation ((=) \<circ> option_to_ptr) (2 ^ local.asid_high_bits - 1) (armKSASIDTable (ksArchState \<sigma>)) (armKSASIDTable_' (globals x)); asid_map_pd_to_hwasids (armKSASIDMap (ksArchState \<sigma>)) = set_option \<circ> (pde_stored_asid \<circ>\<^sub>m cslift x \<circ>\<^sub>m pd_pointer_to_asid_slot); carch_globals (ksArchState \<sigma>); irq_masks (ksMachineState \<sigma>) = irq_masks (phantom_machine_state_' (globals x)); irq_state (ksMachineState \<sigma>) = irq_state (phantom_machine_state_' (globals x)); device_state (ksMachineState \<sigma>) = device_state (phantom_machine_state_' (globals x)); exclusive_state (ksMachineState \<sigma>) = exclusive_state (phantom_machine_state_' (globals x)); machine_state_rest (ksMachineState \<sigma>) = machine_state_rest (phantom_machine_state_' (globals x)); cte_array_relation \<sigma> (globals x); tcb_cte_array_relation \<sigma> (globals x); apsnd fst (ghost'state_' (globals x)) = (gsUserPages \<sigma>, gsCNodes \<sigma>); ghost_size_rel (ghost'state_' (globals x)) (gsMaxObjectSize \<sigma>); ksWorkUnitsCompleted_' (globals x) = ksWorkUnitsCompleted \<sigma>; cslift x intStateIRQNode_array_Ptr = Some v; {symbol_table ''intStateIRQNode''..+256 * size_of TYPE(cte_C)} \<subseteq> kernel_data_refs; cslift x armKSGlobalPD_Ptr = Some va; {symbol_table ''armKSGlobalPD''..+16384} \<subseteq> kernel_data_refs; htd_safe domain (hrs_htd (t_hrs_' (globals x))); - domain \<subseteq> kernel_data_refs; globals_list_distinct (- kernel_data_refs) symbol_table kernel_all_global_addresses.global_data_list; cdom_schedule_relation (kernel_state.ksDomSchedule \<sigma>) kernel_all_global_addresses.ksDomSchedule; ksDomScheduleIdx_' (globals x) = word_of_nat (ksDomScheduleIdx \<sigma>); ksCurDomain_' (globals x) = UCAST(8 \<rightarrow> 32) (ksCurDomain \<sigma>); ksDomainTime_' (globals x) = ksDomainTime \<sigma>\<rbrakk> \<Longrightarrow> True \<and> cvariable_array_map_relation (map_to_tcbs (foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>))) (\<lambda>x. 5) cte_Ptr (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr (hrs_htd (t_hrs_' (globals x)))) \<and> htd_safe domain (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr (hrs_htd (t_hrs_' (globals x)))) proof (prove)
goal (1 subgoal):
 1. \<And>v va. \<lbrakk>cpspace_relation (\<lambda>x. if x \<in> set (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) then Some KOUserDataDevice else ksPSpace \<sigma> x) (underlying_memory (ksMachineState \<sigma>)) (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))); region_is_bytes ptr (n * (2 ^ gbits * 2 ^ pageBits)) x; {ptr..+n * (2 ^ gbits * 2 ^ pageBits)} \<inter> kernel_data_refs = {}; cpspace_relation (ksPSpace \<sigma>) (underlying_memory (ksMachineState \<sigma>)) (t_hrs_' (globals x)); valid_objs' \<sigma>; cready_queues_relation (cslift x) (ksReadyQueues_' (globals x)) (ksReadyQueues \<sigma>); untyped_ranges_zero' \<sigma>; caps_overlap_reserved' {ptr..+n * (2 ^ gbits * 2 ^ pageBits)} \<sigma>; zero_ranges_are_zero (gsUntypedZeroRanges \<sigma>) (t_hrs_' (globals x)); cbitmap_L1_relation (ksReadyQueuesL1Bitmap_' (globals x)) (ksReadyQueuesL1Bitmap \<sigma>); cbitmap_L2_relation (ksReadyQueuesL2Bitmap_' (globals x)) (ksReadyQueuesL2Bitmap \<sigma>); ksCurThread_' (globals x) = tcb_ptr_to_ctcb_ptr (ksCurThread \<sigma>); ksIdleThread_' (globals x) = tcb_ptr_to_ctcb_ptr (ksIdleThread \<sigma>); cinterrupt_relation (ksInterruptState \<sigma>) intStateIRQNode_array_Ptr (intStateIRQTable_' (globals x)); cscheduler_action_relation (ksSchedulerAction \<sigma>) (ksSchedulerAction_' (globals x)); armKSNextASID_' (globals x) = armKSNextASID (ksArchState \<sigma>); armKSKernelVSpace_C = armKSKernelVSpace (ksArchState \<sigma>); array_relation ((=) \<circ> option_to_0) 0xFF (armKSHWASIDTable (ksArchState \<sigma>)) (armKSHWASIDTable_' (globals x)); array_relation ((=) \<circ> option_to_ptr) (2 ^ local.asid_high_bits - 1) (armKSASIDTable (ksArchState \<sigma>)) (armKSASIDTable_' (globals x)); asid_map_pd_to_hwasids (armKSASIDMap (ksArchState \<sigma>)) = set_option \<circ> (pde_stored_asid \<circ>\<^sub>m cslift x \<circ>\<^sub>m pd_pointer_to_asid_slot); carch_globals (ksArchState \<sigma>); irq_masks (ksMachineState \<sigma>) = irq_masks (phantom_machine_state_' (globals x)); irq_state (ksMachineState \<sigma>) = irq_state (phantom_machine_state_' (globals x)); device_state (ksMachineState \<sigma>) = device_state (phantom_machine_state_' (globals x)); exclusive_state (ksMachineState \<sigma>) = exclusive_state (phantom_machine_state_' (globals x)); machine_state_rest (ksMachineState \<sigma>) = machine_state_rest (phantom_machine_state_' (globals x)); cte_array_relation \<sigma> (globals x); tcb_cte_array_relation \<sigma> (globals x); apsnd fst (ghost'state_' (globals x)) = (gsUserPages \<sigma>, gsCNodes \<sigma>); ghost_size_rel (ghost'state_' (globals x)) (gsMaxObjectSize \<sigma>); ksWorkUnitsCompleted_' (globals x) = ksWorkUnitsCompleted \<sigma>; cslift x intStateIRQNode_array_Ptr = Some v; {symbol_table ''intStateIRQNode''..+256 * size_of TYPE(cte_C)} \<subseteq> kernel_data_refs; cslift x armKSGlobalPD_Ptr = Some va; {symbol_table ''armKSGlobalPD''..+16384} \<subseteq> kernel_data_refs; htd_safe domain (hrs_htd (t_hrs_' (globals x))); - domain \<subseteq> kernel_data_refs; globals_list_distinct (- kernel_data_refs) symbol_table kernel_all_global_addresses.global_data_list; cdom_schedule_relation (kernel_state.ksDomSchedule \<sigma>) kernel_all_global_addresses.ksDomSchedule; ksDomScheduleIdx_' (globals x) = word_of_nat (ksDomScheduleIdx \<sigma>); ksCurDomain_' (globals x) = UCAST(8 \<rightarrow> 32) (ksCurDomain \<sigma>); ksDomainTime_' (globals x) = ksDomainTime \<sigma>\<rbrakk> \<Longrightarrow> cvariable_array_map_relation (map_to_tcbs (ksPSpace \<sigma>)) (\<lambda>x. 5) cte_Ptr (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr (hrs_htd (t_hrs_' (globals x)))) \<and> htd_safe domain (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr (hrs_htd (t_hrs_' (globals x)))) proof (prove)
goal (3 subgoals):
 1. \<And>v va. \<lbrakk>cpspace_relation (\<lambda>x. if x \<in> set (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) then Some KOUserDataDevice else ksPSpace \<sigma> x) (underlying_memory (ksMachineState \<sigma>)) (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))); region_is_bytes ptr (n * (2 ^ gbits * 2 ^ pageBits)) x; {ptr..+n * (2 ^ gbits * 2 ^ pageBits)} \<inter> kernel_data_refs = {}; cpspace_relation (ksPSpace \<sigma>) (underlying_memory (ksMachineState \<sigma>)) (t_hrs_' (globals x)); valid_objs' \<sigma>; cready_queues_relation (cslift x) (ksReadyQueues_' (globals x)) (ksReadyQueues \<sigma>); untyped_ranges_zero' \<sigma>; caps_overlap_reserved' {ptr..+n * (2 ^ gbits * 2 ^ pageBits)} \<sigma>; zero_ranges_are_zero (gsUntypedZeroRanges \<sigma>) (t_hrs_' (globals x)); cbitmap_L1_relation (ksReadyQueuesL1Bitmap_' (globals x)) (ksReadyQueuesL1Bitmap \<sigma>); cbitmap_L2_relation (ksReadyQueuesL2Bitmap_' (globals x)) (ksReadyQueuesL2Bitmap \<sigma>); ksCurThread_' (globals x) = tcb_ptr_to_ctcb_ptr (ksCurThread \<sigma>); ksIdleThread_' (globals x) = tcb_ptr_to_ctcb_ptr (ksIdleThread \<sigma>); cinterrupt_relation (ksInterruptState \<sigma>) intStateIRQNode_array_Ptr (intStateIRQTable_' (globals x)); cscheduler_action_relation (ksSchedulerAction \<sigma>) (ksSchedulerAction_' (globals x)); armKSNextASID_' (globals x) = armKSNextASID (ksArchState \<sigma>); armKSKernelVSpace_C = armKSKernelVSpace (ksArchState \<sigma>); array_relation ((=) \<circ> option_to_0) 0xFF (armKSHWASIDTable (ksArchState \<sigma>)) (armKSHWASIDTable_' (globals x)); array_relation ((=) \<circ> option_to_ptr) (2 ^ local.asid_high_bits - 1) (armKSASIDTable (ksArchState \<sigma>)) (armKSASIDTable_' (globals x)); asid_map_pd_to_hwasids (armKSASIDMap (ksArchState \<sigma>)) = set_option \<circ> (pde_stored_asid \<circ>\<^sub>m cslift x \<circ>\<^sub>m pd_pointer_to_asid_slot); carch_globals (ksArchState \<sigma>); irq_masks (ksMachineState \<sigma>) = irq_masks (phantom_machine_state_' (globals x)); irq_state (ksMachineState \<sigma>) = irq_state (phantom_machine_state_' (globals x)); device_state (ksMachineState \<sigma>) = device_state (phantom_machine_state_' (globals x)); exclusive_state (ksMachineState \<sigma>) = exclusive_state (phantom_machine_state_' (globals x)); machine_state_rest (ksMachineState \<sigma>) = machine_state_rest (phantom_machine_state_' (globals x)); cte_array_relation \<sigma> (globals x); tcb_cte_array_relation \<sigma> (globals x); apsnd fst (ghost'state_' (globals x)) = (gsUserPages \<sigma>, gsCNodes \<sigma>); ghost_size_rel (ghost'state_' (globals x)) (gsMaxObjectSize \<sigma>); ksWorkUnitsCompleted_' (globals x) = ksWorkUnitsCompleted \<sigma>; cslift x intStateIRQNode_array_Ptr = Some v; {symbol_table ''intStateIRQNode''..+256 * size_of TYPE(cte_C)} \<subseteq> kernel_data_refs; cslift x armKSGlobalPD_Ptr = Some va; {symbol_table ''armKSGlobalPD''..+16384} \<subseteq> kernel_data_refs; htd_safe domain (hrs_htd (t_hrs_' (globals x))); - domain \<subseteq> kernel_data_refs; globals_list_distinct (- kernel_data_refs) symbol_table kernel_all_global_addresses.global_data_list; cdom_schedule_relation (kernel_state.ksDomSchedule \<sigma>) kernel_all_global_addresses.ksDomSchedule; ksDomScheduleIdx_' (globals x) = word_of_nat (ksDomScheduleIdx \<sigma>); ksCurDomain_' (globals x) = UCAST(8 \<rightarrow> 32) (ksCurDomain \<sigma>); ksDomainTime_' (globals x) = ksDomainTime \<sigma>\<rbrakk> \<Longrightarrow> region_is_bytes (ptr_val (PTR(user_data_device_C) ptr)) (n * 2 ^ gbits * 2 ^ objBitsKO ko) x
 2. \<And>v va. \<lbrakk>cpspace_relation (\<lambda>x. if x \<in> set (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) then Some KOUserDataDevice else ksPSpace \<sigma> x) (underlying_memory (ksMachineState \<sigma>)) (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))); region_is_bytes ptr (n * (2 ^ gbits * 2 ^ pageBits)) x; {ptr..+n * (2 ^ gbits * 2 ^ pageBits)} \<inter> kernel_data_refs = {}; cpspace_relation (ksPSpace \<sigma>) (underlying_memory (ksMachineState \<sigma>)) (t_hrs_' (globals x)); valid_objs' \<sigma>; cready_queues_relation (cslift x) (ksReadyQueues_' (globals x)) (ksReadyQueues \<sigma>); untyped_ranges_zero' \<sigma>; caps_overlap_reserved' {ptr..+n * (2 ^ gbits * 2 ^ pageBits)} \<sigma>; zero_ranges_are_zero (gsUntypedZeroRanges \<sigma>) (t_hrs_' (globals x)); cbitmap_L1_relation (ksReadyQueuesL1Bitmap_' (globals x)) (ksReadyQueuesL1Bitmap \<sigma>); cbitmap_L2_relation (ksReadyQueuesL2Bitmap_' (globals x)) (ksReadyQueuesL2Bitmap \<sigma>); ksCurThread_' (globals x) = tcb_ptr_to_ctcb_ptr (ksCurThread \<sigma>); ksIdleThread_' (globals x) = tcb_ptr_to_ctcb_ptr (ksIdleThread \<sigma>); cinterrupt_relation (ksInterruptState \<sigma>) intStateIRQNode_array_Ptr (intStateIRQTable_' (globals x)); cscheduler_action_relation (ksSchedulerAction \<sigma>) (ksSchedulerAction_' (globals x)); armKSNextASID_' (globals x) = armKSNextASID (ksArchState \<sigma>); armKSKernelVSpace_C = armKSKernelVSpace (ksArchState \<sigma>); array_relation ((=) \<circ> option_to_0) 0xFF (armKSHWASIDTable (ksArchState \<sigma>)) (armKSHWASIDTable_' (globals x)); array_relation ((=) \<circ> option_to_ptr) (2 ^ local.asid_high_bits - 1) (armKSASIDTable (ksArchState \<sigma>)) (armKSASIDTable_' (globals x)); asid_map_pd_to_hwasids (armKSASIDMap (ksArchState \<sigma>)) = set_option \<circ> (pde_stored_asid \<circ>\<^sub>m cslift x \<circ>\<^sub>m pd_pointer_to_asid_slot); carch_globals (ksArchState \<sigma>); irq_masks (ksMachineState \<sigma>) = irq_masks (phantom_machine_state_' (globals x)); irq_state (ksMachineState \<sigma>) = irq_state (phantom_machine_state_' (globals x)); device_state (ksMachineState \<sigma>) = device_state (phantom_machine_state_' (globals x)); exclusive_state (ksMachineState \<sigma>) = exclusive_state (phantom_machine_state_' (globals x)); machine_state_rest (ksMachineState \<sigma>) = machine_state_rest (phantom_machine_state_' (globals x)); cte_array_relation \<sigma> (globals x); tcb_cte_array_relation \<sigma> (globals x); apsnd fst (ghost'state_' (globals x)) = (gsUserPages \<sigma>, gsCNodes \<sigma>); ghost_size_rel (ghost'state_' (globals x)) (gsMaxObjectSize \<sigma>); ksWorkUnitsCompleted_' (globals x) = ksWorkUnitsCompleted \<sigma>; cslift x intStateIRQNode_array_Ptr = Some v; {symbol_table ''intStateIRQNode''..+256 * size_of TYPE(cte_C)} \<subseteq> kernel_data_refs; cslift x armKSGlobalPD_Ptr = Some va; {symbol_table ''armKSGlobalPD''..+16384} \<subseteq> kernel_data_refs; htd_safe domain (hrs_htd (t_hrs_' (globals x))); - domain \<subseteq> kernel_data_refs; globals_list_distinct (- kernel_data_refs) symbol_table kernel_all_global_addresses.global_data_list; cdom_schedule_relation (kernel_state.ksDomSchedule \<sigma>) kernel_all_global_addresses.ksDomSchedule; ksDomScheduleIdx_' (globals x) = word_of_nat (ksDomScheduleIdx \<sigma>); ksCurDomain_' (globals x) = UCAST(8 \<rightarrow> 32) (ksCurDomain \<sigma>); ksDomainTime_' (globals x) = ksDomainTime \<sigma>\<rbrakk> \<Longrightarrow> tcb_cte_array_relation \<sigma> (globals x)
 3. \<And>v va. \<lbrakk>cpspace_relation (\<lambda>x. if x \<in> set (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) then Some KOUserDataDevice else ksPSpace \<sigma> x) (underlying_memory (ksMachineState \<sigma>)) (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))); region_is_bytes ptr (n * (2 ^ gbits * 2 ^ pageBits)) x; {ptr..+n * (2 ^ gbits * 2 ^ pageBits)} \<inter> kernel_data_refs = {}; cpspace_relation (ksPSpace \<sigma>) (underlying_memory (ksMachineState \<sigma>)) (t_hrs_' (globals x)); valid_objs' \<sigma>; cready_queues_relation (cslift x) (ksReadyQueues_' (globals x)) (ksReadyQueues \<sigma>); untyped_ranges_zero' \<sigma>; caps_overlap_reserved' {ptr..+n * (2 ^ gbits * 2 ^ pageBits)} \<sigma>; zero_ranges_are_zero (gsUntypedZeroRanges \<sigma>) (t_hrs_' (globals x)); cbitmap_L1_relation (ksReadyQueuesL1Bitmap_' (globals x)) (ksReadyQueuesL1Bitmap \<sigma>); cbitmap_L2_relation (ksReadyQueuesL2Bitmap_' (globals x)) (ksReadyQueuesL2Bitmap \<sigma>); ksCurThread_' (globals x) = tcb_ptr_to_ctcb_ptr (ksCurThread \<sigma>); ksIdleThread_' (globals x) = tcb_ptr_to_ctcb_ptr (ksIdleThread \<sigma>); cinterrupt_relation (ksInterruptState \<sigma>) intStateIRQNode_array_Ptr (intStateIRQTable_' (globals x)); cscheduler_action_relation (ksSchedulerAction \<sigma>) (ksSchedulerAction_' (globals x)); armKSNextASID_' (globals x) = armKSNextASID (ksArchState \<sigma>); armKSKernelVSpace_C = armKSKernelVSpace (ksArchState \<sigma>); array_relation ((=) \<circ> option_to_0) 0xFF (armKSHWASIDTable (ksArchState \<sigma>)) (armKSHWASIDTable_' (globals x)); array_relation ((=) \<circ> option_to_ptr) (2 ^ local.asid_high_bits - 1) (armKSASIDTable (ksArchState \<sigma>)) (armKSASIDTable_' (globals x)); asid_map_pd_to_hwasids (armKSASIDMap (ksArchState \<sigma>)) = set_option \<circ> (pde_stored_asid \<circ>\<^sub>m cslift x \<circ>\<^sub>m pd_pointer_to_asid_slot); carch_globals (ksArchState \<sigma>); irq_masks (ksMachineState \<sigma>) = irq_masks (phantom_machine_state_' (globals x)); irq_state (ksMachineState \<sigma>) = irq_state (phantom_machine_state_' (globals x)); device_state (ksMachineState \<sigma>) = device_state (phantom_machine_state_' (globals x)); exclusive_state (ksMachineState \<sigma>) = exclusive_state (phantom_machine_state_' (globals x)); machine_state_rest (ksMachineState \<sigma>) = machine_state_rest (phantom_machine_state_' (globals x)); cte_array_relation \<sigma> (globals x); tcb_cte_array_relation \<sigma> (globals x); apsnd fst (ghost'state_' (globals x)) = (gsUserPages \<sigma>, gsCNodes \<sigma>); ghost_size_rel (ghost'state_' (globals x)) (gsMaxObjectSize \<sigma>); ksWorkUnitsCompleted_' (globals x) = ksWorkUnitsCompleted \<sigma>; cslift x intStateIRQNode_array_Ptr = Some v; {symbol_table ''intStateIRQNode''..+256 * size_of TYPE(cte_C)} \<subseteq> kernel_data_refs; cslift x armKSGlobalPD_Ptr = Some va; {symbol_table ''armKSGlobalPD''..+16384} \<subseteq> kernel_data_refs; htd_safe domain (hrs_htd (t_hrs_' (globals x))); - domain \<subseteq> kernel_data_refs; globals_list_distinct (- kernel_data_refs) symbol_table kernel_all_global_addresses.global_data_list; cdom_schedule_relation (kernel_state.ksDomSchedule \<sigma>) kernel_all_global_addresses.ksDomSchedule; ksDomScheduleIdx_' (globals x) = word_of_nat (ksDomScheduleIdx \<sigma>); ksCurDomain_' (globals x) = UCAST(8 \<rightarrow> 32) (ksCurDomain \<sigma>); ksDomainTime_' (globals x) = ksDomainTime \<sigma>\<rbrakk> \<Longrightarrow> True \<and> htd_safe domain (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr (hrs_htd (t_hrs_' (globals x)))) proof (prove)
goal (1 subgoal):
 1. \<And>v va. \<lbrakk>cpspace_relation (\<lambda>x. if x \<in> set (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) then Some KOUserDataDevice else ksPSpace \<sigma> x) (underlying_memory (ksMachineState \<sigma>)) (hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))); region_is_bytes ptr (n * (2 ^ gbits * 2 ^ pageBits)) x; {ptr..+n * (2 ^ gbits * 2 ^ pageBits)} \<inter> kernel_data_refs = {}; cpspace_relation (ksPSpace \<sigma>) (underlying_memory (ksMachineState \<sigma>)) (t_hrs_' (globals x)); valid_objs' \<sigma>; cready_queues_relation (cslift x) (ksReadyQueues_' (globals x)) (ksReadyQueues \<sigma>); untyped_ranges_zero' \<sigma>; caps_overlap_reserved' {ptr..+n * (2 ^ gbits * 2 ^ pageBits)} \<sigma>; zero_ranges_are_zero (gsUntypedZeroRanges \<sigma>) (t_hrs_' (globals x)); cbitmap_L1_relation (ksReadyQueuesL1Bitmap_' (globals x)) (ksReadyQueuesL1Bitmap \<sigma>); cbitmap_L2_relation (ksReadyQueuesL2Bitmap_' (globals x)) (ksReadyQueuesL2Bitmap \<sigma>); ksCurThread_' (globals x) = tcb_ptr_to_ctcb_ptr (ksCurThread \<sigma>); ksIdleThread_' (globals x) = tcb_ptr_to_ctcb_ptr (ksIdleThread \<sigma>); cinterrupt_relation (ksInterruptState \<sigma>) intStateIRQNode_array_Ptr (intStateIRQTable_' (globals x)); cscheduler_action_relation (ksSchedulerAction \<sigma>) (ksSchedulerAction_' (globals x)); armKSNextASID_' (globals x) = armKSNextASID (ksArchState \<sigma>); armKSKernelVSpace_C = armKSKernelVSpace (ksArchState \<sigma>); array_relation ((=) \<circ> option_to_0) 0xFF (armKSHWASIDTable (ksArchState \<sigma>)) (armKSHWASIDTable_' (globals x)); array_relation ((=) \<circ> option_to_ptr) (2 ^ local.asid_high_bits - 1) (armKSASIDTable (ksArchState \<sigma>)) (armKSASIDTable_' (globals x)); asid_map_pd_to_hwasids (armKSASIDMap (ksArchState \<sigma>)) = set_option \<circ> (pde_stored_asid \<circ>\<^sub>m cslift x \<circ>\<^sub>m pd_pointer_to_asid_slot); carch_globals (ksArchState \<sigma>); irq_masks (ksMachineState \<sigma>) = irq_masks (phantom_machine_state_' (globals x)); irq_state (ksMachineState \<sigma>) = irq_state (phantom_machine_state_' (globals x)); device_state (ksMachineState \<sigma>) = device_state (phantom_machine_state_' (globals x)); exclusive_state (ksMachineState \<sigma>) = exclusive_state (phantom_machine_state_' (globals x)); machine_state_rest (ksMachineState \<sigma>) = machine_state_rest (phantom_machine_state_' (globals x)); cte_array_relation \<sigma> (globals x); tcb_cte_array_relation \<sigma> (globals x); apsnd fst (ghost'state_' (globals x)) = (gsUserPages \<sigma>, gsCNodes \<sigma>); ghost_size_rel (ghost'state_' (globals x)) (gsMaxObjectSize \<sigma>); ksWorkUnitsCompleted_' (globals x) = ksWorkUnitsCompleted \<sigma>; cslift x intStateIRQNode_array_Ptr = Some v; {symbol_table ''intStateIRQNode''..+256 * size_of TYPE(cte_C)} \<subseteq> kernel_data_refs; cslift x armKSGlobalPD_Ptr = Some va; {symbol_table ''armKSGlobalPD''..+16384} \<subseteq> kernel_data_refs; htd_safe domain (hrs_htd (t_hrs_' (globals x))); - domain \<subseteq> kernel_data_refs; globals_list_distinct (- kernel_data_refs) symbol_table kernel_all_global_addresses.global_data_list; cdom_schedule_relation (kernel_state.ksDomSchedule \<sigma>) kernel_all_global_addresses.ksDomSchedule; ksDomScheduleIdx_' (globals x) = word_of_nat (ksDomScheduleIdx \<sigma>); ksCurDomain_' (globals x) = UCAST(8 \<rightarrow> 32) (ksCurDomain \<sigma>); ksDomainTime_' (globals x) = ksDomainTime \<sigma>\<rbrakk> \<Longrightarrow> htd_safe domain (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr (hrs_htd (t_hrs_' (globals x)))) proof (prove)
goal:
No subgoals! proof (state)
this:
(\<sigma>\<lparr>ksPSpace := foldr (\<lambda>addr. data_map_insert addr KOUserDataDevice) (new_cap_addrs (n * 2 ^ gbits) ptr KOUserDataDevice) (ksPSpace \<sigma>)\<rparr>, x\<lparr>globals := globals x\<lparr>t_hrs_' := hrs_htd_update (ptr_retyps_gen (n * 2 ^ gbits) (PTR(user_data_device_C) ptr) arr) (t_hrs_' (globals x))\<rparr>\<rparr>) \<in> rf_sr

goal:
No subgoals!