theory RPCTo

lemma get_echo_parameter_pin_nf:
  "\<forall>s28'.
    \<lbrace>\<lambda>s29'. globals_frame_intact s29' \<and>
            ipc_buffer_valid s29' \<and>
            tls_valid s29' \<and>
            thread_index_C (tls s29') \<in> {1..thread_count} \<and>
            is_valid_w32 s29' (Ptr (symbol_table ''echo_parameter_pin_1'')) \<and>
            is_valid_w32 s29' (Ptr (symbol_table ''echo_parameter_pin_2'')) \<and>
            s29' = s28'\<rbrace>
     get_echo_parameter_pin'
    \<lbrace>\<lambda>r30' s29'. r30' \<in> {Ptr (symbol_table
      ''echo_parameter_pin_1''), Ptr (symbol_table ''echo_parameter_pin_2'')}
      \<and>
      s29' = s28'\<rbrace>!" apply (rule allI) apply (simp add:get_echo_parameter_pin'_def) apply (wp seL4_GetIPCBuffer_wp) apply (clarsimp simp:thread_count_def tls_valid_def tls_def) apply unat_arith done

(* Proof state trace *)
proof (prove)
goal (1 subgoal):
 1. \<forall>s28'. \<lbrace>\<lambda>s29'. globals_frame_intact s29' \<and> ipc_buffer_valid s29' \<and> tls_valid s29' \<and> thread_index_C (tls s29') \<in> {1..thread_count} \<and> is_valid_w32 s29' (PTR(32 word) (symbol_table ''echo_parameter_pin_1'')) \<and> is_valid_w32 s29' (PTR(32 word) (symbol_table ''echo_parameter_pin_2'')) \<and> s29' = s28'\<rbrace> get_echo_parameter_pin' \<lbrace>\<lambda>r30' s29'. r30' \<in> {PTR(32 signed word) (symbol_table ''echo_parameter_pin_1''), PTR(32 signed word) (symbol_table ''echo_parameter_pin_2'')} \<and> s29' = s28'\<rbrace>! proof (prove)
goal (1 subgoal):
 1. \<And>s28'. \<lbrace>\<lambda>s29'. globals_frame_intact s29' \<and> ipc_buffer_valid s29' \<and> tls_valid s29' \<and> thread_index_C (tls s29') \<in> {1..thread_count} \<and> is_valid_w32 s29' (PTR(32 word) (symbol_table ''echo_parameter_pin_1'')) \<and> is_valid_w32 s29' (PTR(32 word) (symbol_table ''echo_parameter_pin_2'')) \<and> s29' = s28'\<rbrace> get_echo_parameter_pin' \<lbrace>\<lambda>r30' s29'. r30' \<in> {PTR(32 signed word) (symbol_table ''echo_parameter_pin_1''), PTR(32 signed word) (symbol_table ''echo_parameter_pin_2'')} \<and> s29' = s28'\<rbrace>! proof (prove)
goal (1 subgoal):
 1. \<And>s28'. \<lbrace>\<lambda>s29'. globals_frame_intact s29' \<and> ipc_buffer_valid s29' \<and> tls_valid s29' \<and> 1 \<le> thread_index_C (tls s29') \<and> thread_index_C (tls s29') \<le> thread_count \<and> is_valid_w32 s29' (PTR(32 word) (symbol_table ''echo_parameter_pin_1'')) \<and> is_valid_w32 s29' (PTR(32 word) (symbol_table ''echo_parameter_pin_2'')) \<and> s29' = s28'\<rbrace> do ret' <- camkes_get_tls';
y <- guard (\<lambda>s. is_valid_camkes_tls_t_C s ret');
condition (\<lambda>s. thread_index_C (heap_camkes_tls_t_C s ret') = 1)
  (do y <- guard (\<lambda>s. is_valid_w32 s (PTR(32 word) (symbol_table ''echo_parameter_pin_1'')));
return (PTR(32 signed word) (symbol_table ''echo_parameter_pin_1''))
od)
  condition (\<lambda>s. thread_index_C (heap_camkes_tls_t_C s ret') = 2)
  (do y <- guard (\<lambda>s. is_valid_w32 s (PTR(32 word) (symbol_table ''echo_parameter_pin_2'')));
return (PTR(32 signed word) (symbol_table ''echo_parameter_pin_2''))
od)
  (do y <- abort';
fail
od)
od \<lbrace>\<lambda>r30' s29'. (r30' = PTR(32 signed word) (symbol_table ''echo_parameter_pin_1'') \<or> r30' = PTR(32 signed word) (symbol_table ''echo_parameter_pin_2'')) \<and> s29' = s28'\<rbrace>! proof (prove)
goal (1 subgoal):
 1. \<And>s28' s. globals_frame_intact s \<and> ipc_buffer_valid s \<and> tls_valid s \<and> 1 \<le> thread_index_C (tls s) \<and> thread_index_C (tls s) \<le> thread_count \<and> is_valid_w32 s (PTR(32 word) (symbol_table ''echo_parameter_pin_1'')) \<and> is_valid_w32 s (PTR(32 word) (symbol_table ''echo_parameter_pin_2'')) \<and> s = s28' \<Longrightarrow> tls_valid s \<and> globals_frame_intact s \<and> (if thread_index_C (heap_camkes_tls_t_C s (tls_ptr s)) = 1 then ((PTR(32 signed word) (symbol_table ''echo_parameter_pin_1'') = PTR(32 signed word) (symbol_table ''echo_parameter_pin_1'') \<or> PTR(32 signed word) (symbol_table ''echo_parameter_pin_1'') = PTR(32 signed word) (symbol_table ''echo_parameter_pin_2'')) \<and> s = s28') \<and> is_valid_w32 s (PTR(32 word) (symbol_table ''echo_parameter_pin_1'')) else if thread_index_C (heap_camkes_tls_t_C s (tls_ptr s)) = 2 then ((PTR(32 signed word) (symbol_table ''echo_parameter_pin_2'') = PTR(32 signed word) (symbol_table ''echo_parameter_pin_1'') \<or> PTR(32 signed word) (symbol_table ''echo_parameter_pin_2'') = PTR(32 signed word) (symbol_table ''echo_parameter_pin_2'')) \<and> s = s28') \<and> is_valid_w32 s (PTR(32 word) (symbol_table ''echo_parameter_pin_2'')) else False) \<and> is_valid_camkes_tls_t_C s (tls_ptr s) proof (prove)
goal (1 subgoal):
 1. \<And>s28'. \<lbrakk>globals_frame_intact s28'; ipc_buffer_valid s28'; is_valid_camkes_tls_t_C s28' (tls_ptr s28'); 1 \<le> thread_index_C (heap_camkes_tls_t_C s28' (tls_ptr s28')); thread_index_C (heap_camkes_tls_t_C s28' (tls_ptr s28')) \<le> 2; is_valid_w32 s28' (PTR(32 word) (symbol_table ''echo_parameter_pin_1'')); is_valid_w32 s28' (PTR(32 word) (symbol_table ''echo_parameter_pin_2'')); thread_index_C (heap_camkes_tls_t_C s28' (tls_ptr s28')) \<noteq> 2\<rbrakk> \<Longrightarrow> thread_index_C (heap_camkes_tls_t_C s28' (tls_ptr s28')) = 1 proof (prove)
goal:
No subgoals!