theory CSpace_R

lemma cteInsert_simple_invs:
 "\<lbrace>invs' and cte_wp_at' (\<lambda>c. cteCap c=NullCap) dest and valid_cap' cap and
  (\<lambda>s. src \<noteq> dest) and (\<lambda>s. safe_parent_for' (ctes_of s) src cap)
  and (\<lambda>s. \<forall>irq. cap = IRQHandlerCap irq \<longrightarrow> irq_issued' irq s)
  and cte_at' src
  and ex_cte_cap_to' dest and K (is_simple_cap' cap)\<rbrace>
  cteInsert cap src dest
  \<lbrace>\<lambda>rv. invs'\<rbrace>" apply (rule hoare_pre) apply (simp add: invs'_def valid_state'_def valid_pspace'_def) apply (wp cur_tcb_lift sch_act_wf_lift valid_queues_lift tcb_in_cur_domain'_lift
             valid_irq_node_lift valid_queues_lift' irqs_masked_lift
             cteInsert_simple_mdb' cteInsert_valid_globals_simple
             cteInsert_norq | simp add: pred_tcb_at'_def)+ apply (auto simp: invs'_def valid_state'_def valid_pspace'_def
                    is_simple_cap'_def untyped_derived_eq_def o_def
              elim: valid_capAligned) done

(* Proof state trace *)
proof (prove)
goal (1 subgoal):
 1. \<lbrace>invs' and cte_wp_at' (\<lambda>c. cteCap c = capability.NullCap) dest and valid_cap' cap and (\<lambda>s. src \<noteq> dest) and (\<lambda>s. safe_parent_for' (ctes_of s) src cap) and (\<lambda>s. \<forall>irq. cap = capability.IRQHandlerCap irq \<longrightarrow> irq_issued' irq s) and cte_wp_at' (\<lambda>_. True) src and ex_cte_cap_wp_to' (\<lambda>_. True) dest and K (is_simple_cap' cap)\<rbrace> cteInsert cap src dest \<lbrace>\<lambda>rv. invs'\<rbrace> proof (prove)
goal (2 subgoals):
 1. \<lbrace>?Q\<rbrace> cteInsert cap src dest \<lbrace>\<lambda>rv. invs'\<rbrace>
 2. \<And>s. (invs' and cte_wp_at' (\<lambda>c. cteCap c = capability.NullCap) dest and valid_cap' cap and (\<lambda>s. src \<noteq> dest) and (\<lambda>s. safe_parent_for' (ctes_of s) src cap) and (\<lambda>s. \<forall>irq. cap = capability.IRQHandlerCap irq \<longrightarrow> irq_issued' irq s) and cte_wp_at' (\<lambda>_. True) src and ex_cte_cap_wp_to' (\<lambda>_. True) dest and K (is_simple_cap' cap)) s \<Longrightarrow> ?Q s proof (prove)
goal (2 subgoals):
 1. \<lbrace>?Q\<rbrace> cteInsert cap src dest \<lbrace>\<lambda>rv. (\<lambda>s. valid_objs' s \<and> pspace_aligned' s \<and> pspace_distinct' s \<and> no_0_obj' s \<and> valid_mdb' s \<and> sch_act_wf (ksSchedulerAction s) s \<and> Invariants_H.valid_queues s \<and> sym_refs (state_refs_of' s) \<and> if_live_then_nonz_cap' s \<and> if_unsafe_then_cap' s \<and> valid_idle' s \<and> valid_global_refs' s \<and> valid_arch_state' s \<and> valid_irq_node' (irq_node' s) s \<and> valid_irq_handlers' s \<and> valid_irq_states' s \<and> valid_machine_state' s \<and> irqs_masked' s \<and> valid_queues' s \<and> ct_not_inQ s \<and> ct_idle_or_in_cur_domain' s \<and> valid_pde_mappings' s \<and> pspace_domain_valid s \<and> ksCurDomain s \<le> maxDomain \<and> ksDomSchedule s \<noteq> [] \<and> (\<forall>x\<in>set (ksDomSchedule s). dschDomain x \<le> maxDomain \<and> 0 < dschLength x) \<and> ksDomSchedule s = ksDomSchedule (KernelInit_H.newKernelState undefined) \<and> ksDomScheduleIdx s < length (ksDomSchedule (KernelInit_H.newKernelState undefined)) \<and> untyped_ranges_zero' s) and cur_tcb'\<rbrace>
 2. \<And>s. (invs' and cte_wp_at' (\<lambda>c. cteCap c = capability.NullCap) dest and valid_cap' cap and (\<lambda>s. src \<noteq> dest) and (\<lambda>s. safe_parent_for' (ctes_of s) src cap) and (\<lambda>s. \<forall>irq. cap = capability.IRQHandlerCap irq \<longrightarrow> irq_issued' irq s) and cte_wp_at' (\<lambda>_. True) src and ex_cte_cap_wp_to' (\<lambda>_. True) dest and K (is_simple_cap' cap)) s \<Longrightarrow> ?Q s proof (prove)
goal (1 subgoal):
 1. \<And>s. invs' s \<and> cte_wp_at' (\<lambda>c. cteCap c = capability.NullCap) dest s \<and> valid_cap' cap s \<and> src \<noteq> dest \<and> safe_parent_for' (ctes_of s) src cap \<and> (\<forall>irq. cap = capability.IRQHandlerCap irq \<longrightarrow> irq_issued' irq s) \<and> cte_wp_at' (\<lambda>_. True) src s \<and> ex_cte_cap_wp_to' (\<lambda>_. True) dest s \<and> is_simple_cap' cap \<Longrightarrow> valid_objs' s \<and> pspace_aligned' s \<and> pspace_distinct' s \<and> no_0_obj' s \<and> valid_mdb' s \<and> pspace_aligned' s \<and> pspace_distinct' s \<and> capAligned cap \<and> sch_act_wf (ksSchedulerAction s) s \<and> Invariants_H.valid_queues s \<and> sym_refs (state_refs_of' s) \<and> if_live_then_nonz_cap' s \<and> if_unsafe_then_cap' s \<and> valid_idle' s \<and> valid_global_refs' s \<and> valid_arch_state' s \<and> valid_irq_node' (irq_node' s) s \<and> valid_irq_handlers' s \<and> valid_irq_states' s \<and> valid_machine_state' s \<and> irqs_masked' s \<and> valid_queues' s \<and> ct_not_inQ s \<and> ct_idle_or_in_cur_domain' s \<and> valid_pde_mappings' s \<and> pspace_domain_valid s \<and> ksCurDomain s \<le> maxDomain \<and> ksDomSchedule s \<noteq> [] \<and> (\<forall>x\<in>set (ksDomSchedule s). dschDomain x \<le> maxDomain \<and> 0 < dschLength x) \<and> ksDomSchedule s = ksDomSchedule (KernelInit_H.newKernelState undefined) \<and> ksDomScheduleIdx s < length (ksDomSchedule (KernelInit_H.newKernelState undefined)) \<and> untyped_ranges_zero' s \<and> valid_mdb' s \<and> valid_objs' s \<and> cte_wp_at' (untyped_derived_eq cap \<circ> cteCap) src s \<and> cur_tcb' s proof (prove)
goal:
No subgoals!