theory structures_proofs

lemma (in kernel_all_substitute) cap_untyped_cap_new_spec:
  "\<forall>s. \<Gamma> \<turnstile> {s}
       \<acute>ret__struct_cap_C :== PROC cap_untyped_cap_new(\<acute>capFreeIndex, \<acute>capIsDevice, \<acute>capBlockSize, \<acute>capPtr)
       \<lbrace>cap_untyped_cap_lift \<acute>ret__struct_cap_C = \<lparr>
          cap_untyped_cap_CL.capFreeIndex_CL = (\<^bsup>s\<^esup>capFreeIndex___unsigned AND mask 26),
          cap_untyped_cap_CL.capIsDevice_CL = (\<^bsup>s\<^esup>capIsDevice___unsigned AND mask 1),
          cap_untyped_cap_CL.capBlockSize_CL = (\<^bsup>s\<^esup>capBlockSize___unsigned AND mask 5),
          cap_untyped_cap_CL.capPtr_CL = (\<^bsup>s\<^esup>capPtr___unsigned AND NOT (mask 4)) \<rparr> \<and>
        cap_get_tag \<acute>ret__struct_cap_C = scast cap_untyped_cap\<rbrace>" apply (rule allI, rule conseqPre, vcg) apply (clarsimp simp: guard_simps o_def mask_def shift_over_ao_dists) apply (rule context_conjI[THEN iffD1[OF conj_commute]],
         fastforce simp: cap_get_tag_eq_x cap_untyped_cap_def
                         mask_def shift_over_ao_dists word_bw_assocs word_ao_dist) apply (simp add: cap_untyped_cap_lift_def) apply (erule cap_lift_untyped_cap[THEN subst[OF sym]]; simp?) apply ((intro conjI sign_extend_eq)?;
         (simp add: mask_def shift_over_ao_dists multi_shift_simps word_size
                    word_ao_dist word_bw_assocs word_and_max_simps cap_untyped_cap_def))? done

(* Proof state trace *)
proof (prove)
goal (1 subgoal):
 1. \<forall>s. \<Gamma>\<turnstile> {s} Call cap_untyped_cap_new_'proc \<lbrace>cap_untyped_cap_lift \<acute>ret__struct_cap_C = \<lparr>capFreeIndex_CL = \<^bsup>s\<^esup>capFreeIndex && mask 26, capIsDevice_CL = \<^bsup>s\<^esup>capIsDevice && mask 1, capBlockSize_CL = \<^bsup>s\<^esup>capBlockSize && mask 5, capPtr_CL = \<^bsup>s\<^esup>capPtr && ~~ mask 4\<rparr> \<and> cap_get_tag \<acute>ret__struct_cap_C = SCAST(32 signed \<rightarrow> 32) cap_untyped_cap\<rbrace> proof (prove)
goal (1 subgoal):
 1. \<And>s. {s} \<subseteq> \<lbrace>\<forall>v. 0 <s 2 \<and> 0 \<le>s 0 \<and> 0 <s 0x20 \<and> 0 \<le>s 0 \<and> 0 <s 0x20 \<and> 1 <s 2 \<and> 0 \<le>s 1 \<and> 0 \<le>s 0 \<and> 0 <s 0x20 \<and> 0 \<le>s 5 \<and> 5 <s 0x20 \<and> 0 \<le>s 6 \<and> 6 <s 0x20 \<and> cap_untyped_cap_lift (cap_C.words_C_update (\<lambda>v. Arrays.update v (unat 1) (((SCAST(32 signed \<rightarrow> 32) 0 || (\<acute>capFreeIndex && 0x3FFFFFF << unat 6)) || (\<acute>capIsDevice && 1 << unat 5)) || (\<acute>capBlockSize && 0x1F << unat 0))) (cap_C.words_C_update (\<lambda>v. Arrays.update v (unat 0) ((SCAST(32 signed \<rightarrow> 32) 0 || (\<acute>capPtr && 0xFFFFFFF0 >> unat 0)) || (SCAST(32 signed \<rightarrow> 32) cap_untyped_cap && 0xF << unat 0))) v)) = \<lparr>capFreeIndex_CL = \<^bsup>s\<^esup>capFreeIndex && mask 26, capIsDevice_CL = \<^bsup>s\<^esup>capIsDevice && mask 1, capBlockSize_CL = \<^bsup>s\<^esup>capBlockSize && mask 5, capPtr_CL = \<^bsup>s\<^esup>capPtr && ~~ mask 4\<rparr> \<and> cap_get_tag (cap_C.words_C_update (\<lambda>v. Arrays.update v (unat 1) (((SCAST(32 signed \<rightarrow> 32) 0 || (\<acute>capFreeIndex && 0x3FFFFFF << unat 6)) || (\<acute>capIsDevice && 1 << unat 5)) || (\<acute>capBlockSize && 0x1F << unat 0))) (cap_C.words_C_update (\<lambda>v. Arrays.update v (unat 0) ((SCAST(32 signed \<rightarrow> 32) 0 || (\<acute>capPtr && 0xFFFFFFF0 >> unat 0)) || (SCAST(32 signed \<rightarrow> 32) cap_untyped_cap && 0xF << unat 0))) v)) = SCAST(32 signed \<rightarrow> 32) cap_untyped_cap\<rbrace> proof (prove)
goal (1 subgoal):
 1. \<And>s v. cap_untyped_cap_lift (cap_C.words_C_update (\<lambda>x. Arrays.update (Arrays.update x 0 (capPtr_' s && 0xFFFFFFF0 || SCAST(32 signed \<rightarrow> 32) cap_untyped_cap && 0xF)) (Suc 0) (((capFreeIndex_' s << 6) && 0xFFFFFFC0 || (capIsDevice_' s << 5) && 0x20) || capBlockSize_' s && 0x1F)) v) = \<lparr>capFreeIndex_CL = capFreeIndex_' s && 0x3FFFFFF, capIsDevice_CL = capIsDevice_' s && 1, capBlockSize_CL = capBlockSize_' s && 0x1F, capPtr_CL = capPtr_' s && 0xFFFFFFF0\<rparr> \<and> cap_get_tag (cap_C.words_C_update (\<lambda>x. Arrays.update (Arrays.update x 0 (capPtr_' s && 0xFFFFFFF0 || SCAST(32 signed \<rightarrow> 32) cap_untyped_cap && 0xF)) (Suc 0) (((capFreeIndex_' s << 6) && 0xFFFFFFC0 || (capIsDevice_' s << 5) && 0x20) || capBlockSize_' s && 0x1F)) v) = SCAST(32 signed \<rightarrow> 32) cap_untyped_cap proof (prove)
goal (1 subgoal):
 1. \<And>s v. cap_get_tag (cap_C.words_C_update (\<lambda>x. Arrays.update (Arrays.update x 0 (capPtr_' s && 0xFFFFFFF0 || SCAST(32 signed \<rightarrow> 32) cap_untyped_cap && 0xF)) (Suc 0) (((capFreeIndex_' s << 6) && 0xFFFFFFC0 || (capIsDevice_' s << 5) && 0x20) || capBlockSize_' s && 0x1F)) v) = SCAST(32 signed \<rightarrow> 32) cap_untyped_cap \<Longrightarrow> cap_untyped_cap_lift (cap_C.words_C_update (\<lambda>x. Arrays.update (Arrays.update x 0 (capPtr_' s && 0xFFFFFFF0 || SCAST(32 signed \<rightarrow> 32) cap_untyped_cap && 0xF)) (Suc 0) (((capFreeIndex_' s << 6) && 0xFFFFFFC0 || (capIsDevice_' s << 5) && 0x20) || capBlockSize_' s && 0x1F)) v) = \<lparr>capFreeIndex_CL = capFreeIndex_' s && 0x3FFFFFF, capIsDevice_CL = capIsDevice_' s && 1, capBlockSize_CL = capBlockSize_' s && 0x1F, capPtr_CL = capPtr_' s && 0xFFFFFFF0\<rparr> proof (prove)
goal (1 subgoal):
 1. \<And>s v. cap_get_tag (cap_C.words_C_update (\<lambda>x. Arrays.update (Arrays.update x 0 (capPtr_' s && 0xFFFFFFF0 || SCAST(32 signed \<rightarrow> 32) cap_untyped_cap && 0xF)) (Suc 0) (((capFreeIndex_' s << 6) && 0xFFFFFFC0 || (capIsDevice_' s << 5) && 0x20) || capBlockSize_' s && 0x1F)) v) = SCAST(32 signed \<rightarrow> 32) cap_untyped_cap \<Longrightarrow> (case cap_lift (cap_C.words_C_update (\<lambda>x. Arrays.update (Arrays.update x 0 (capPtr_' s && 0xFFFFFFF0 || SCAST(32 signed \<rightarrow> 32) cap_untyped_cap && 0xF)) (Suc 0) (((capFreeIndex_' s << 6) && 0xFFFFFFC0 || (capIsDevice_' s << 5) && 0x20) || capBlockSize_' s && 0x1F)) v) of Some (Cap_untyped_cap rec) \<Rightarrow> rec) = \<lparr>capFreeIndex_CL = capFreeIndex_' s && 0x3FFFFFF, capIsDevice_CL = capIsDevice_' s && 1, capBlockSize_CL = capBlockSize_' s && 0x1F, capPtr_CL = capPtr_' s && 0xFFFFFFF0\<rparr> proof (prove)
goal (1 subgoal):
 1. \<And>s. (((capFreeIndex_' s << 6) && 0xFFFFFFC0 || (capIsDevice_' s << 5) && 0x20) || capBlockSize_' s && 0x1F >> 6) && mask 26 = capFreeIndex_' s && 0x3FFFFFF \<and> (((capFreeIndex_' s << 6) && 0xFFFFFFC0 || (capIsDevice_' s << 5) && 0x20) || capBlockSize_' s && 0x1F >> 5) && 1 = capIsDevice_' s && 1 \<and> (((capFreeIndex_' s << 6) && 0xFFFFFFC0 || (capIsDevice_' s << 5) && 0x20) || capBlockSize_' s && 0x1F) && mask 5 = capBlockSize_' s && 0x1F \<and> (capPtr_' s && 0xFFFFFFF0 || SCAST(32 signed \<rightarrow> 32) cap_untyped_cap && 0xF) && ~~ mask 4 = capPtr_' s && 0xFFFFFFF0 proof (prove)
goal:
No subgoals!