theory structures_proofs

lemma (in kernel_all_substitute) endpoint_ptr_set_state_spec:
           defines "ptrval s \<equiv> cslift s \<^bsup>s\<^esup>endpoint_ptr"
           shows "\<forall>s. \<Gamma> \<turnstile> \<lbrace>s. s \<Turnstile>\<^sub>c \<^bsup>s\<^esup>endpoint_ptr\<rbrace>
            PROC endpoint_ptr_set_state(\<acute>endpoint_ptr, \<acute>v32)
            {t. \<exists>endpoint.
                              endpoint_lift endpoint =
                              endpoint_lift ((the (ptrval s))) \<lparr> endpoint_CL.state_CL := (\<^bsup>s\<^esup>v32 AND mask 2) \<rparr> \<and>
                              t_hrs_' (globals t) = hrs_mem_update (heap_update
                                      (\<^bsup>s\<^esup>endpoint_ptr)
                                      endpoint)
                                  (t_hrs_' (globals s))
                              } " unfolding ptrval_def apply (rule allI, rule conseqPre, vcg) apply (clarsimp simp: guard_simps) apply (clarsimp simp add: packed_heap_update_collapse_hrs typ_heap_simps)? apply (rule exI, rule conjI[rotated], rule refl) apply (clarsimp simp: h_t_valid_clift_Some_iff endpoint_lift_def typ_heap_simps) 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))? done

(* Proof state trace *)
proof (prove)
goal (1 subgoal):
 1. \<forall>s. \<Gamma>\<turnstile> \<lbrace>s. s \<Turnstile>\<^sub>c \<^bsup>s\<^esup>endpoint_ptr\<rbrace> Call endpoint_ptr_set_state_'proc \<lbrace>\<exists>endpoint. endpoint_lift endpoint = endpoint_lift (the (ptrval s))\<lparr>endpoint_CL.state_CL := \<^bsup>s\<^esup>v32 && mask 2\<rparr> \<and> \<acute>t_hrs = hrs_mem_update (heap_update \<^bsup>s\<^esup>endpoint_ptr endpoint) \<^bsup>s\<^esup>t_hrs\<rbrace> proof (prove)
goal (1 subgoal):
 1. \<forall>s. \<Gamma>\<turnstile> \<lbrace>s. s \<Turnstile>\<^sub>c \<^bsup>s\<^esup>endpoint_ptr\<rbrace> Call endpoint_ptr_set_state_'proc \<lbrace>\<exists>endpoint. endpoint_lift endpoint = endpoint_lift (the (cslift s \<^bsup>s\<^esup>endpoint_ptr))\<lparr>endpoint_CL.state_CL := \<^bsup>s\<^esup>v32 && mask 2\<rparr> \<and> \<acute>t_hrs = hrs_mem_update (heap_update \<^bsup>s\<^esup>endpoint_ptr endpoint) \<^bsup>s\<^esup>t_hrs\<rbrace> proof (prove)
goal (1 subgoal):
 1. \<And>s. \<lbrace>s. s \<Turnstile>\<^sub>c \<^bsup>s\<^esup>endpoint_ptr\<rbrace> \<subseteq> {sa. 0 <s 4 \<and> 0 \<le>s 0 \<and> sa \<Turnstile>\<^sub>c endpoint_ptr_' sa \<and> 0 <s 4 \<and> 0 \<le>s 0 \<and> sa \<Turnstile>\<^sub>c endpoint_ptr_' sa \<and> 0 <s 4 \<and> 0 \<le>s 0 \<and> hrs_htd (hrs_mem_update (heap_update (PTR(32 word[4]) &(endpoint_ptr_' sa\<rightarrow>[''words_C''])) (Arrays.update (h_val (hrs_mem (t_hrs_' (globals sa))) (PTR(32 word[4]) &(endpoint_ptr_' sa\<rightarrow>[''words_C'']))) (unat 0) (h_val (hrs_mem (t_hrs_' (globals sa))) (PTR(32 word[4]) &(endpoint_ptr_' sa\<rightarrow>[''words_C''])).[unat 0] && ~~ 3))) (t_hrs_' (globals sa))) \<Turnstile>\<^sub>t endpoint_ptr_' sa \<and> 0 \<le>s 0 \<and> 0 <s 0x20 \<and> 0 <s 4 \<and> 0 \<le>s 0 \<and> hrs_htd (hrs_mem_update (heap_update (PTR(32 word[4]) &(endpoint_ptr_' sa\<rightarrow>[''words_C''])) (Arrays.update (h_val (hrs_mem (t_hrs_' (globals sa))) (PTR(32 word[4]) &(endpoint_ptr_' sa\<rightarrow>[''words_C'']))) (unat 0) (h_val (hrs_mem (t_hrs_' (globals sa))) (PTR(32 word[4]) &(endpoint_ptr_' sa\<rightarrow>[''words_C''])).[unat 0] && ~~ 3))) (t_hrs_' (globals sa))) \<Turnstile>\<^sub>t endpoint_ptr_' sa \<and> (\<exists>endpoint. endpoint_lift endpoint = endpoint_lift (the (cslift s (endpoint_ptr_' s)))\<lparr>endpoint_CL.state_CL := v32_' s && mask 2\<rparr> \<and> hrs_mem_update (heap_update (PTR(32 word[4]) &(endpoint_ptr_' sa\<rightarrow>[''words_C''])) (Arrays.update (h_val (hrs_mem (hrs_mem_update (heap_update (PTR(32 word[4]) &(endpoint_ptr_' sa\<rightarrow>[''words_C''])) (Arrays.update (h_val (hrs_mem (t_hrs_' (globals sa))) (PTR(32 word[4]) &(endpoint_ptr_' sa\<rightarrow>[''words_C'']))) (unat 0) (h_val (hrs_mem (t_hrs_' (globals sa))) (PTR(32 word[4]) &(endpoint_ptr_' sa\<rightarrow>[''words_C''])).[unat 0] && ~~ 3))) (t_hrs_' (globals sa)))) (PTR(32 word[4]) &(endpoint_ptr_' sa\<rightarrow>[''words_C'']))) (unat 0) (h_val (hrs_mem (hrs_mem_update (heap_update (PTR(32 word[4]) &(endpoint_ptr_' sa\<rightarrow>[''words_C''])) (Arrays.update (h_val (hrs_mem (t_hrs_' (globals sa))) (PTR(32 word[4]) &(endpoint_ptr_' sa\<rightarrow>[''words_C'']))) (unat 0) (h_val (hrs_mem (t_hrs_' (globals sa))) (PTR(32 word[4]) &(endpoint_ptr_' sa\<rightarrow>[''words_C''])).[unat 0] && ~~ 3))) (t_hrs_' (globals sa)))) (PTR(32 word[4]) &(endpoint_ptr_' sa\<rightarrow>[''words_C''])).[unat 0] || (v32_' sa << unat 0) && SCAST(32 signed \<rightarrow> 32) 3))) (hrs_mem_update (heap_update (PTR(32 word[4]) &(endpoint_ptr_' sa\<rightarrow>[''words_C''])) (Arrays.update (h_val (hrs_mem (t_hrs_' (globals sa))) (PTR(32 word[4]) &(endpoint_ptr_' sa\<rightarrow>[''words_C'']))) (unat 0) (h_val (hrs_mem (t_hrs_' (globals sa))) (PTR(32 word[4]) &(endpoint_ptr_' sa\<rightarrow>[''words_C''])).[unat 0] && ~~ 3))) (t_hrs_' (globals sa))) = hrs_mem_update (heap_update (endpoint_ptr_' s) endpoint) (t_hrs_' (globals s)))} proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<Turnstile>\<^sub>c endpoint_ptr_' x \<Longrightarrow> \<exists>endpoint. endpoint_lift endpoint = endpoint_lift (the (cslift x (endpoint_ptr_' x)))\<lparr>endpoint_CL.state_CL := v32_' x && mask 2\<rparr> \<and> hrs_mem_update (heap_update (PTR(32 word[4]) &(endpoint_ptr_' x\<rightarrow>[''words_C''])) (Arrays.update (h_val (hrs_mem (hrs_mem_update (heap_update (PTR(32 word[4]) &(endpoint_ptr_' x\<rightarrow>[''words_C''])) (Arrays.update (h_val (hrs_mem (t_hrs_' (globals x))) (PTR(32 word[4]) &(endpoint_ptr_' x\<rightarrow>[''words_C'']))) 0 (h_val (hrs_mem (t_hrs_' (globals x))) (PTR(32 word[4]) &(endpoint_ptr_' x\<rightarrow>[''words_C''])).[0] && 0xFFFFFFFC))) (t_hrs_' (globals x)))) (PTR(32 word[4]) &(endpoint_ptr_' x\<rightarrow>[''words_C'']))) 0 (h_val (hrs_mem (hrs_mem_update (heap_update (PTR(32 word[4]) &(endpoint_ptr_' x\<rightarrow>[''words_C''])) (Arrays.update (h_val (hrs_mem (t_hrs_' (globals x))) (PTR(32 word[4]) &(endpoint_ptr_' x\<rightarrow>[''words_C'']))) 0 (h_val (hrs_mem (t_hrs_' (globals x))) (PTR(32 word[4]) &(endpoint_ptr_' x\<rightarrow>[''words_C''])).[0] && 0xFFFFFFFC))) (t_hrs_' (globals x)))) (PTR(32 word[4]) &(endpoint_ptr_' x\<rightarrow>[''words_C''])).[0] || v32_' x && 3))) (hrs_mem_update (heap_update (PTR(32 word[4]) &(endpoint_ptr_' x\<rightarrow>[''words_C''])) (Arrays.update (h_val (hrs_mem (t_hrs_' (globals x))) (PTR(32 word[4]) &(endpoint_ptr_' x\<rightarrow>[''words_C'']))) 0 (h_val (hrs_mem (t_hrs_' (globals x))) (PTR(32 word[4]) &(endpoint_ptr_' x\<rightarrow>[''words_C''])).[0] && 0xFFFFFFFC))) (t_hrs_' (globals x))) = hrs_mem_update (heap_update (endpoint_ptr_' x) endpoint) (t_hrs_' (globals x)) proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<Turnstile>\<^sub>c endpoint_ptr_' x \<Longrightarrow> \<exists>endpoint. endpoint_lift endpoint = endpoint_lift (the (cslift x (endpoint_ptr_' x)))\<lparr>endpoint_CL.state_CL := v32_' x && mask 2\<rparr> \<and> hrs_mem_update (heap_update (endpoint_ptr_' x) (endpoint_C.words_C_update (\<lambda>_. Arrays.update (h_val (hrs_mem (t_hrs_' (globals x))) (PTR(32 word[4]) &(endpoint_ptr_' x\<rightarrow>[''words_C'']))) 0 (h_val (hrs_mem (t_hrs_' (globals x))) (PTR(32 word[4]) &(endpoint_ptr_' x\<rightarrow>[''words_C''])).[0] && 0xFFFFFFFC || v32_' x && 3)) (h_val (hrs_mem (t_hrs_' (globals x))) (endpoint_ptr_' x)))) (t_hrs_' (globals x)) = hrs_mem_update (heap_update (endpoint_ptr_' x) endpoint) (t_hrs_' (globals x)) proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<Turnstile>\<^sub>c endpoint_ptr_' x \<Longrightarrow> endpoint_lift (endpoint_C.words_C_update (\<lambda>_. Arrays.update (h_val (hrs_mem (t_hrs_' (globals x))) (PTR(32 word[4]) &(endpoint_ptr_' x\<rightarrow>[''words_C'']))) 0 (h_val (hrs_mem (t_hrs_' (globals x))) (PTR(32 word[4]) &(endpoint_ptr_' x\<rightarrow>[''words_C''])).[0] && 0xFFFFFFFC || v32_' x && 3)) (h_val (hrs_mem (t_hrs_' (globals x))) (endpoint_ptr_' x))) = endpoint_lift (the (cslift x (endpoint_ptr_' x)))\<lparr>endpoint_CL.state_CL := v32_' x && mask 2\<rparr> proof (prove)
goal (1 subgoal):
 1. \<And>x v. cslift x (endpoint_ptr_' x) = Some v \<Longrightarrow> (endpoint_C.words_C v.[0] && 0xFFFFFFFC || v32_' x && 3) && ~~ mask 4 = endpoint_C.words_C v.[0] && ~~ mask 4 \<and> (endpoint_C.words_C v.[0] && 0xFFFFFFFC || v32_' x && 3) && mask 2 = v32_' x && mask 2 proof (prove)
goal:
No subgoals!