theory structures_proofs

lemma (in kernel_all_substitute) cap_cnode_cap_new_spec:
  "\<forall>s. \<Gamma> \<turnstile> {s}
       \<acute>ret__struct_cap_C :== PROC cap_cnode_cap_new(\<acute>capCNodeRadix, \<acute>capCNodeGuardSize, \<acute>capCNodeGuard, \<acute>capCNodePtr)
       \<lbrace>cap_cnode_cap_lift \<acute>ret__struct_cap_C = \<lparr>
          cap_cnode_cap_CL.capCNodeRadix_CL = (\<^bsup>s\<^esup>capCNodeRadix___unsigned AND mask 5),
          cap_cnode_cap_CL.capCNodeGuardSize_CL = (\<^bsup>s\<^esup>capCNodeGuardSize___unsigned AND mask 5),
          cap_cnode_cap_CL.capCNodeGuard_CL = (\<^bsup>s\<^esup>capCNodeGuard___unsigned AND mask 18),
          cap_cnode_cap_CL.capCNodePtr_CL = (\<^bsup>s\<^esup>capCNodePtr___unsigned AND NOT (mask 5)) \<rparr> \<and>
        cap_get_tag \<acute>ret__struct_cap_C = scast cap_cnode_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_cnode_cap_def
                         mask_def shift_over_ao_dists word_bw_assocs word_ao_dist) apply (simp add: cap_cnode_cap_lift_def) apply (erule cap_lift_cnode_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_cnode_cap_def))? done

(* Proof state trace *)
proof (prove)
goal (1 subgoal):
 1. \<forall>s. \<Gamma>\<turnstile> {s} Call cap_cnode_cap_new_'proc \<lbrace>cap_cnode_cap_lift \<acute>ret__struct_cap_C = \<lparr>capCNodeRadix_CL = \<^bsup>s\<^esup>capCNodeRadix && mask 5, capCNodeGuardSize_CL = \<^bsup>s\<^esup>capCNodeGuardSize && mask 5, capCNodeGuard_CL = \<^bsup>s\<^esup>capCNodeGuard && mask 18, capCNodePtr_CL = \<^bsup>s\<^esup>capCNodePtr && ~~ mask 5\<rparr> \<and> cap_get_tag \<acute>ret__struct_cap_C = SCAST(32 signed \<rightarrow> 32) cap_cnode_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 0x17 \<and> 0x17 <s 0x20 \<and> 0 \<le>s 0x12 \<and> 0x12 <s 0x20 \<and> cap_cnode_cap_lift (cap_C.words_C_update (\<lambda>v. Arrays.update v (unat 1) (((SCAST(32 signed \<rightarrow> 32) 0 || (\<acute>capCNodeRadix && 0x1F << unat 0x12)) || (\<acute>capCNodeGuardSize && 0x1F << unat 0x17)) || (\<acute>capCNodeGuard && 0x3FFFF << unat 0))) (cap_C.words_C_update (\<lambda>v. Arrays.update v (unat 0) ((SCAST(32 signed \<rightarrow> 32) 0 || (\<acute>capCNodePtr && 0xFFFFFFE0 >> unat 0)) || (SCAST(32 signed \<rightarrow> 32) cap_cnode_cap && 0xF << unat 0))) v)) = \<lparr>capCNodeRadix_CL = \<^bsup>s\<^esup>capCNodeRadix && mask 5, capCNodeGuardSize_CL = \<^bsup>s\<^esup>capCNodeGuardSize && mask 5, capCNodeGuard_CL = \<^bsup>s\<^esup>capCNodeGuard && mask 18, capCNodePtr_CL = \<^bsup>s\<^esup>capCNodePtr && ~~ mask 5\<rparr> \<and> cap_get_tag (cap_C.words_C_update (\<lambda>v. Arrays.update v (unat 1) (((SCAST(32 signed \<rightarrow> 32) 0 || (\<acute>capCNodeRadix && 0x1F << unat 0x12)) || (\<acute>capCNodeGuardSize && 0x1F << unat 0x17)) || (\<acute>capCNodeGuard && 0x3FFFF << unat 0))) (cap_C.words_C_update (\<lambda>v. Arrays.update v (unat 0) ((SCAST(32 signed \<rightarrow> 32) 0 || (\<acute>capCNodePtr && 0xFFFFFFE0 >> unat 0)) || (SCAST(32 signed \<rightarrow> 32) cap_cnode_cap && 0xF << unat 0))) v)) = SCAST(32 signed \<rightarrow> 32) cap_cnode_cap\<rbrace> proof (prove)
goal (1 subgoal):
 1. \<And>s v. cap_cnode_cap_lift (cap_C.words_C_update (\<lambda>x. Arrays.update (Arrays.update x 0 (capCNodePtr_' s && 0xFFFFFFE0 || SCAST(32 signed \<rightarrow> 32) cap_cnode_cap && 0xF)) (Suc 0) (((capCNodeRadix_' s << 18) && 0x7C0000 || (capCNodeGuardSize_' s << 23) && 0xF800000) || capCNodeGuard_' s && 0x3FFFF)) v) = \<lparr>capCNodeRadix_CL = capCNodeRadix_' s && 0x1F, capCNodeGuardSize_CL = capCNodeGuardSize_' s && 0x1F, capCNodeGuard_CL = capCNodeGuard_' s && 0x3FFFF, capCNodePtr_CL = capCNodePtr_' s && 0xFFFFFFE0\<rparr> \<and> cap_get_tag (cap_C.words_C_update (\<lambda>x. Arrays.update (Arrays.update x 0 (capCNodePtr_' s && 0xFFFFFFE0 || SCAST(32 signed \<rightarrow> 32) cap_cnode_cap && 0xF)) (Suc 0) (((capCNodeRadix_' s << 18) && 0x7C0000 || (capCNodeGuardSize_' s << 23) && 0xF800000) || capCNodeGuard_' s && 0x3FFFF)) v) = SCAST(32 signed \<rightarrow> 32) cap_cnode_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 (capCNodePtr_' s && 0xFFFFFFE0 || SCAST(32 signed \<rightarrow> 32) cap_cnode_cap && 0xF)) (Suc 0) (((capCNodeRadix_' s << 18) && 0x7C0000 || (capCNodeGuardSize_' s << 23) && 0xF800000) || capCNodeGuard_' s && 0x3FFFF)) v) = SCAST(32 signed \<rightarrow> 32) cap_cnode_cap \<Longrightarrow> cap_cnode_cap_lift (cap_C.words_C_update (\<lambda>x. Arrays.update (Arrays.update x 0 (capCNodePtr_' s && 0xFFFFFFE0 || SCAST(32 signed \<rightarrow> 32) cap_cnode_cap && 0xF)) (Suc 0) (((capCNodeRadix_' s << 18) && 0x7C0000 || (capCNodeGuardSize_' s << 23) && 0xF800000) || capCNodeGuard_' s && 0x3FFFF)) v) = \<lparr>capCNodeRadix_CL = capCNodeRadix_' s && 0x1F, capCNodeGuardSize_CL = capCNodeGuardSize_' s && 0x1F, capCNodeGuard_CL = capCNodeGuard_' s && 0x3FFFF, capCNodePtr_CL = capCNodePtr_' s && 0xFFFFFFE0\<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 (capCNodePtr_' s && 0xFFFFFFE0 || SCAST(32 signed \<rightarrow> 32) cap_cnode_cap && 0xF)) (Suc 0) (((capCNodeRadix_' s << 18) && 0x7C0000 || (capCNodeGuardSize_' s << 23) && 0xF800000) || capCNodeGuard_' s && 0x3FFFF)) v) = SCAST(32 signed \<rightarrow> 32) cap_cnode_cap \<Longrightarrow> (case cap_lift (cap_C.words_C_update (\<lambda>x. Arrays.update (Arrays.update x 0 (capCNodePtr_' s && 0xFFFFFFE0 || SCAST(32 signed \<rightarrow> 32) cap_cnode_cap && 0xF)) (Suc 0) (((capCNodeRadix_' s << 18) && 0x7C0000 || (capCNodeGuardSize_' s << 23) && 0xF800000) || capCNodeGuard_' s && 0x3FFFF)) v) of Some (Cap_cnode_cap rec) \<Rightarrow> rec) = \<lparr>capCNodeRadix_CL = capCNodeRadix_' s && 0x1F, capCNodeGuardSize_CL = capCNodeGuardSize_' s && 0x1F, capCNodeGuard_CL = capCNodeGuard_' s && 0x3FFFF, capCNodePtr_CL = capCNodePtr_' s && 0xFFFFFFE0\<rparr> proof (prove)
goal (1 subgoal):
 1. \<And>s. (((capCNodeRadix_' s << 18) && 0x7C0000 || (capCNodeGuardSize_' s << 23) && 0xF800000) || capCNodeGuard_' s && 0x3FFFF >> 18) && mask 5 = capCNodeRadix_' s && 0x1F \<and> (((capCNodeRadix_' s << 18) && 0x7C0000 || (capCNodeGuardSize_' s << 23) && 0xF800000) || capCNodeGuard_' s && 0x3FFFF >> 23) && mask 5 = capCNodeGuardSize_' s && 0x1F \<and> (((capCNodeRadix_' s << 18) && 0x7C0000 || (capCNodeGuardSize_' s << 23) && 0xF800000) || capCNodeGuard_' s && 0x3FFFF) && mask 18 = capCNodeGuard_' s && 0x3FFFF \<and> (capCNodePtr_' s && 0xFFFFFFE0 || SCAST(32 signed \<rightarrow> 32) cap_cnode_cap && 0xF) && ~~ mask 5 = capCNodePtr_' s && 0xFFFFFFE0 proof (prove)
goal:
No subgoals!