theory structures_proofs

lemma (in kernel_all_substitute) cap_small_frame_cap_new_spec:
  "\<forall>s. \<Gamma> \<turnstile> {s}
       \<acute>ret__struct_cap_C :== PROC cap_small_frame_cap_new(\<acute>capFMappedASIDLow, \<acute>capFVMRights, \<acute>capFMappedAddress, \<acute>capFIsDevice, \<acute>capFMappedASIDHigh, \<acute>capFBasePtr)
       \<lbrace>cap_small_frame_cap_lift \<acute>ret__struct_cap_C = \<lparr>
          cap_small_frame_cap_CL.capFMappedASIDLow_CL = (\<^bsup>s\<^esup>capFMappedASIDLow___unsigned AND mask 10),
          cap_small_frame_cap_CL.capFVMRights_CL = (\<^bsup>s\<^esup>capFVMRights___unsigned AND mask 2),
          cap_small_frame_cap_CL.capFMappedAddress_CL = (\<^bsup>s\<^esup>capFMappedAddress___unsigned AND NOT (mask 12)),
          cap_small_frame_cap_CL.capFIsDevice_CL = (\<^bsup>s\<^esup>capFIsDevice___unsigned AND mask 1),
          cap_small_frame_cap_CL.capFMappedASIDHigh_CL = (\<^bsup>s\<^esup>capFMappedASIDHigh___unsigned AND mask 7),
          cap_small_frame_cap_CL.capFBasePtr_CL = (\<^bsup>s\<^esup>capFBasePtr___unsigned AND NOT (mask 12)) \<rparr> \<and>
        cap_get_tag \<acute>ret__struct_cap_C = scast cap_small_frame_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_small_frame_cap_def
                         mask_def shift_over_ao_dists word_bw_assocs word_ao_dist) apply (simp add: cap_small_frame_cap_lift_def) apply (erule cap_lift_small_frame_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_small_frame_cap_def))? done

(* Proof state trace *)
proof (prove)
goal (1 subgoal):
 1. \<forall>s. \<Gamma>\<turnstile> {s} Call cap_small_frame_cap_new_'proc \<lbrace>cap_small_frame_cap_lift \<acute>ret__struct_cap_C = \<lparr>cap_small_frame_cap_CL.capFMappedASIDLow_CL = \<^bsup>s\<^esup>capFMappedASIDLow && mask 10, capFVMRights_CL = \<^bsup>s\<^esup>capFVMRights && mask 2, capFMappedAddress_CL = \<^bsup>s\<^esup>capFMappedAddress && ~~ mask 12, capFIsDevice_CL = \<^bsup>s\<^esup>capFIsDevice && mask 1, capFMappedASIDHigh_CL = \<^bsup>s\<^esup>capFMappedASIDHigh && mask 7, capFBasePtr_CL = \<^bsup>s\<^esup>capFBasePtr && ~~ mask 12\<rparr> \<and> cap_get_tag \<acute>ret__struct_cap_C = SCAST(32 signed \<rightarrow> 32) cap_small_frame_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 8 \<and> 8 <s 0x20 \<and> 0 \<le>s 0x18 \<and> 0x18 <s 0x20 \<and> 0 \<le>s 0x1F \<and> 0x1F <s 0x20 \<and> 1 <s 2 \<and> 0 \<le>s 1 \<and> 0 \<le>s 0xC \<and> 0xC <s 0x20 \<and> 0 \<le>s 0x14 \<and> 0x14 <s 0x20 \<and> 0 \<le>s 0x16 \<and> 0x16 <s 0x20 \<and> cap_small_frame_cap_lift (cap_C.words_C_update (\<lambda>v. Arrays.update v (unat 1) (((SCAST(32 signed \<rightarrow> 32) 0 || (\<acute>capFMappedASIDLow && 0x3FF << unat 0x16)) || (\<acute>capFVMRights && 3 << unat 0x14)) || (\<acute>capFMappedAddress && 0xFFFFF000 >> unat 0xC))) (cap_C.words_C_update (\<lambda>v. Arrays.update v (unat 0) ((((SCAST(32 signed \<rightarrow> 32) 0 || (\<acute>capFIsDevice && 1 << unat 0x1F)) || (\<acute>capFMappedASIDHigh && 0x7F << unat 0x18)) || (\<acute>capFBasePtr && 0xFFFFF000 >> unat 8)) || (SCAST(32 signed \<rightarrow> 32) cap_small_frame_cap && 0xF << unat 0))) v)) = \<lparr>cap_small_frame_cap_CL.capFMappedASIDLow_CL = \<^bsup>s\<^esup>capFMappedASIDLow && mask 10, capFVMRights_CL = \<^bsup>s\<^esup>capFVMRights && mask 2, capFMappedAddress_CL = \<^bsup>s\<^esup>capFMappedAddress && ~~ mask 12, capFIsDevice_CL = \<^bsup>s\<^esup>capFIsDevice && mask 1, capFMappedASIDHigh_CL = \<^bsup>s\<^esup>capFMappedASIDHigh && mask 7, capFBasePtr_CL = \<^bsup>s\<^esup>capFBasePtr && ~~ mask 12\<rparr> \<and> cap_get_tag (cap_C.words_C_update (\<lambda>v. Arrays.update v (unat 1) (((SCAST(32 signed \<rightarrow> 32) 0 || (\<acute>capFMappedASIDLow && 0x3FF << unat 0x16)) || (\<acute>capFVMRights && 3 << unat 0x14)) || (\<acute>capFMappedAddress && 0xFFFFF000 >> unat 0xC))) (cap_C.words_C_update (\<lambda>v. Arrays.update v (unat 0) ((((SCAST(32 signed \<rightarrow> 32) 0 || (\<acute>capFIsDevice && 1 << unat 0x1F)) || (\<acute>capFMappedASIDHigh && 0x7F << unat 0x18)) || (\<acute>capFBasePtr && 0xFFFFF000 >> unat 8)) || (SCAST(32 signed \<rightarrow> 32) cap_small_frame_cap && 0xF << unat 0))) v)) = SCAST(32 signed \<rightarrow> 32) cap_small_frame_cap\<rbrace> proof (prove)
goal (1 subgoal):
 1. \<And>s v. cap_small_frame_cap_lift (cap_C.words_C_update (\<lambda>x. Arrays.update (Arrays.update x (Suc 0) (((capFMappedASIDLow_' s << 22) && 0xFFC00000 || (capFVMRights_' s << 20) && 0x300000) || (capFMappedAddress_' s >> 12) && 0xFFFFF)) 0 ((((capFIsDevice_' s << 31) && 0x80000000 || (capFMappedASIDHigh_' s << 24) && 0x7F000000) || (capFBasePtr_' s >> 8) && 0xFFFFF0) || SCAST(32 signed \<rightarrow> 32) cap_small_frame_cap && 0xF)) v) = \<lparr>cap_small_frame_cap_CL.capFMappedASIDLow_CL = capFMappedASIDLow_' s && 0x3FF, capFVMRights_CL = capFVMRights_' s && 3, capFMappedAddress_CL = capFMappedAddress_' s && 0xFFFFF000, capFIsDevice_CL = capFIsDevice_' s && 1, capFMappedASIDHigh_CL = capFMappedASIDHigh_' s && 0x7F, capFBasePtr_CL = capFBasePtr_' s && 0xFFFFF000\<rparr> \<and> cap_get_tag (cap_C.words_C_update (\<lambda>x. Arrays.update (Arrays.update x (Suc 0) (((capFMappedASIDLow_' s << 22) && 0xFFC00000 || (capFVMRights_' s << 20) && 0x300000) || (capFMappedAddress_' s >> 12) && 0xFFFFF)) 0 ((((capFIsDevice_' s << 31) && 0x80000000 || (capFMappedASIDHigh_' s << 24) && 0x7F000000) || (capFBasePtr_' s >> 8) && 0xFFFFF0) || SCAST(32 signed \<rightarrow> 32) cap_small_frame_cap && 0xF)) v) = SCAST(32 signed \<rightarrow> 32) cap_small_frame_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 (Suc 0) (((capFMappedASIDLow_' s << 22) && 0xFFC00000 || (capFVMRights_' s << 20) && 0x300000) || (capFMappedAddress_' s >> 12) && 0xFFFFF)) 0 ((((capFIsDevice_' s << 31) && 0x80000000 || (capFMappedASIDHigh_' s << 24) && 0x7F000000) || (capFBasePtr_' s >> 8) && 0xFFFFF0) || SCAST(32 signed \<rightarrow> 32) cap_small_frame_cap && 0xF)) v) = SCAST(32 signed \<rightarrow> 32) cap_small_frame_cap \<Longrightarrow> cap_small_frame_cap_lift (cap_C.words_C_update (\<lambda>x. Arrays.update (Arrays.update x (Suc 0) (((capFMappedASIDLow_' s << 22) && 0xFFC00000 || (capFVMRights_' s << 20) && 0x300000) || (capFMappedAddress_' s >> 12) && 0xFFFFF)) 0 ((((capFIsDevice_' s << 31) && 0x80000000 || (capFMappedASIDHigh_' s << 24) && 0x7F000000) || (capFBasePtr_' s >> 8) && 0xFFFFF0) || SCAST(32 signed \<rightarrow> 32) cap_small_frame_cap && 0xF)) v) = \<lparr>cap_small_frame_cap_CL.capFMappedASIDLow_CL = capFMappedASIDLow_' s && 0x3FF, capFVMRights_CL = capFVMRights_' s && 3, capFMappedAddress_CL = capFMappedAddress_' s && 0xFFFFF000, capFIsDevice_CL = capFIsDevice_' s && 1, capFMappedASIDHigh_CL = capFMappedASIDHigh_' s && 0x7F, capFBasePtr_CL = capFBasePtr_' s && 0xFFFFF000\<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 (Suc 0) (((capFMappedASIDLow_' s << 22) && 0xFFC00000 || (capFVMRights_' s << 20) && 0x300000) || (capFMappedAddress_' s >> 12) && 0xFFFFF)) 0 ((((capFIsDevice_' s << 31) && 0x80000000 || (capFMappedASIDHigh_' s << 24) && 0x7F000000) || (capFBasePtr_' s >> 8) && 0xFFFFF0) || SCAST(32 signed \<rightarrow> 32) cap_small_frame_cap && 0xF)) v) = SCAST(32 signed \<rightarrow> 32) cap_small_frame_cap \<Longrightarrow> (case cap_lift (cap_C.words_C_update (\<lambda>x. Arrays.update (Arrays.update x (Suc 0) (((capFMappedASIDLow_' s << 22) && 0xFFC00000 || (capFVMRights_' s << 20) && 0x300000) || (capFMappedAddress_' s >> 12) && 0xFFFFF)) 0 ((((capFIsDevice_' s << 31) && 0x80000000 || (capFMappedASIDHigh_' s << 24) && 0x7F000000) || (capFBasePtr_' s >> 8) && 0xFFFFF0) || SCAST(32 signed \<rightarrow> 32) cap_small_frame_cap && 0xF)) v) of Some (Cap_small_frame_cap rec) \<Rightarrow> rec) = \<lparr>cap_small_frame_cap_CL.capFMappedASIDLow_CL = capFMappedASIDLow_' s && 0x3FF, capFVMRights_CL = capFVMRights_' s && 3, capFMappedAddress_CL = capFMappedAddress_' s && 0xFFFFF000, capFIsDevice_CL = capFIsDevice_' s && 1, capFMappedASIDHigh_CL = capFMappedASIDHigh_' s && 0x7F, capFBasePtr_CL = capFBasePtr_' s && 0xFFFFF000\<rparr> proof (prove)
goal (1 subgoal):
 1. \<And>s. (((capFMappedASIDLow_' s << 22) && 0xFFC00000 || (capFVMRights_' s << 20) && 0x300000) || (capFMappedAddress_' s >> 12) && 0xFFFFF >> 22) && mask 10 = capFMappedASIDLow_' s && 0x3FF \<and> (((capFMappedASIDLow_' s << 22) && 0xFFC00000 || (capFVMRights_' s << 20) && 0x300000) || (capFMappedAddress_' s >> 12) && 0xFFFFF >> 20) && mask 2 = capFVMRights_' s && 3 \<and> (((capFMappedASIDLow_' s << 22) && 0xFFC00000 || (capFVMRights_' s << 20) && 0x300000) || (capFMappedAddress_' s >> 12) && 0xFFFFF << 12) && ~~ mask 12 = capFMappedAddress_' s && 0xFFFFF000 \<and> ((((capFIsDevice_' s << 31) && 0x80000000 || (capFMappedASIDHigh_' s << 24) && 0x7F000000) || (capFBasePtr_' s >> 8) && 0xFFFFF0) || SCAST(32 signed \<rightarrow> 32) cap_small_frame_cap && 0xF >> 31) && 1 = capFIsDevice_' s && 1 \<and> ((((capFIsDevice_' s << 31) && 0x80000000 || (capFMappedASIDHigh_' s << 24) && 0x7F000000) || (capFBasePtr_' s >> 8) && 0xFFFFF0) || SCAST(32 signed \<rightarrow> 32) cap_small_frame_cap && 0xF >> 24) && mask 7 = capFMappedASIDHigh_' s && 0x7F \<and> ((((capFIsDevice_' s << 31) && 0x80000000 || (capFMappedASIDHigh_' s << 24) && 0x7F000000) || (capFBasePtr_' s >> 8) && 0xFFFFF0) || SCAST(32 signed \<rightarrow> 32) cap_small_frame_cap && 0xF << 8) && ~~ mask 12 = capFBasePtr_' s && 0xFFFFF000 proof (prove)
goal:
No subgoals!