theory Ipc_AC

lemma set_scheduler_action_respects_in_ipc_autarch:
  "\<lbrace>integrity_tcb_in_ipc aag X receiver epptr ctxt st\<rbrace>
   set_scheduler_action action
   \<lbrace>\<lambda>_. integrity_tcb_in_ipc aag X receiver epptr ctxt st\<rbrace>" unfolding set_scheduler_action_def apply (wpsimp simp: integrity_tcb_in_ipc_def integrity_def tcb_states_of_state_def get_tcb_def) apply (subst (asm) integrity_asids_updates(4)[symmetric]) apply (subst integrity_asids_updates(4)[where f=id, symmetric]) apply (subst (asm) integrity_asids_updates(4)[where f=id, symmetric]) apply (fastforce simp: trans_state_def) done

(* Proof state trace *)
proof (prove)
goal (1 subgoal):
 1. \<lbrace>integrity_tcb_in_ipc aag X receiver epptr ctxt st\<rbrace> set_scheduler_action action \<lbrace>\<lambda>_. integrity_tcb_in_ipc aag X receiver epptr ctxt st\<rbrace> proof (prove)
goal (1 subgoal):
 1. \<lbrace>integrity_tcb_in_ipc aag X receiver epptr ctxt st\<rbrace> modify (scheduler_action_update (\<lambda>_. action)) \<lbrace>\<lambda>_. integrity_tcb_in_ipc aag X receiver epptr ctxt st\<rbrace> proof (prove)
goal (1 subgoal):
 1. \<And>s x a. \<lbrakk>pasObjectAbs aag receiver \<noteq> pasSubject aag; pas_refined aag st; \<forall>x. object_integrity aag (pasObjectAbs aag x) (kheap st x) (if x = receiver then kheap st receiver else kheap s x); \<forall>x. integrity_eobj aag {pasSubject aag} (pasObjectAbs aag x) (ekheap st x) (ekheap s x); \<forall>a b. cdt_integrity aag (cdt st) (\<lambda>p. map_option tcb_state (case kheap st p of None \<Rightarrow> None | Some (TCB x) \<Rightarrow> Some x | Some _ \<Rightarrow> None)) (a, b) (cdt st (a, b), is_original_cap st (a, b)) (cdt s (a, b), is_original_cap s (a, b)); \<forall>a b. cdt_list_integrity aag (cdt st) (\<lambda>p. map_option tcb_state (case kheap st p of None \<Rightarrow> None | Some (TCB x) \<Rightarrow> Some x | Some _ \<Rightarrow> None)) (a, b) (cdt_list st (a, b)) (cdt_list s (a, b)); \<forall>x. integrity_interrupts aag {pasSubject aag} x (interrupt_irq_node st x, interrupt_states st x) (interrupt_irq_node s x, interrupt_states s x); \<forall>d p. integrity_ready_queues aag {pasSubject aag} (pasDomainAbs aag d) (ready_queues st d p) (ready_queues s d p); \<forall>x. memory_integrity X aag x (\<lambda>p. map_option tcb_state (case kheap st p of None \<Rightarrow> None | Some (TCB x) \<Rightarrow> Some x | Some _ \<Rightarrow> None)) (\<lambda>p. map_option tcb_state (case if p = receiver then kheap st receiver else kheap s p of None \<Rightarrow> None | Some (TCB x) \<Rightarrow> Some x | Some _ \<Rightarrow> None)) (auth_ipc_buffers st) (underlying_memory (machine_state st) x) (if x \<in> auth_ipc_buffers st receiver then underlying_memory (machine_state st) x else underlying_memory (machine_state s) x); \<forall>x. integrity_device aag {pasSubject aag} x (\<lambda>p. map_option tcb_state (case kheap st p of None \<Rightarrow> None | Some (TCB x) \<Rightarrow> Some x | Some _ \<Rightarrow> None)) (\<lambda>p. map_option tcb_state (case if p = receiver then kheap st receiver else kheap s p of None \<Rightarrow> None | Some (TCB x) \<Rightarrow> Some x | Some _ \<Rightarrow> None)) (device_state (machine_state st) x) (device_state (machine_state s) x); \<forall>x a. integrity_asids aag {pasSubject aag} x a st (s\<lparr>kheap := (kheap s)(receiver := kheap st receiver)\<rparr>); tcb_in_ipc aag ctxt (pasObjectAbs aag receiver) epptr (kheap st receiver) (kheap s receiver)\<rbrakk> \<Longrightarrow> integrity_asids aag {pasSubject aag} x a st (s\<lparr>scheduler_action := action, kheap := (kheap s)(receiver := kheap st receiver)\<rparr>) proof (prove)
goal (1 subgoal):
 1. \<And>s x a. \<lbrakk>pasObjectAbs aag receiver \<noteq> pasSubject aag; pas_refined aag st; \<forall>x. object_integrity aag (pasObjectAbs aag x) (kheap st x) (if x = receiver then kheap st receiver else kheap s x); \<forall>x. integrity_eobj aag {pasSubject aag} (pasObjectAbs aag x) (ekheap st x) (ekheap s x); \<forall>a b. cdt_integrity aag (cdt st) (\<lambda>p. map_option tcb_state (case kheap st p of None \<Rightarrow> None | Some (TCB x) \<Rightarrow> Some x | Some _ \<Rightarrow> None)) (a, b) (cdt st (a, b), is_original_cap st (a, b)) (cdt s (a, b), is_original_cap s (a, b)); \<forall>a b. cdt_list_integrity aag (cdt st) (\<lambda>p. map_option tcb_state (case kheap st p of None \<Rightarrow> None | Some (TCB x) \<Rightarrow> Some x | Some _ \<Rightarrow> None)) (a, b) (cdt_list st (a, b)) (cdt_list s (a, b)); \<forall>x. integrity_interrupts aag {pasSubject aag} x (interrupt_irq_node st x, interrupt_states st x) (interrupt_irq_node s x, interrupt_states s x); \<forall>d p. integrity_ready_queues aag {pasSubject aag} (pasDomainAbs aag d) (ready_queues st d p) (ready_queues s d p); \<forall>x. memory_integrity X aag x (\<lambda>p. map_option tcb_state (case kheap st p of None \<Rightarrow> None | Some (TCB x) \<Rightarrow> Some x | Some _ \<Rightarrow> None)) (\<lambda>p. map_option tcb_state (case if p = receiver then kheap st receiver else kheap s p of None \<Rightarrow> None | Some (TCB x) \<Rightarrow> Some x | Some _ \<Rightarrow> None)) (auth_ipc_buffers st) (underlying_memory (machine_state st) x) (if x \<in> auth_ipc_buffers st receiver then underlying_memory (machine_state st) x else underlying_memory (machine_state s) x); \<forall>x. integrity_device aag {pasSubject aag} x (\<lambda>p. map_option tcb_state (case kheap st p of None \<Rightarrow> None | Some (TCB x) \<Rightarrow> Some x | Some _ \<Rightarrow> None)) (\<lambda>p. map_option tcb_state (case if p = receiver then kheap st receiver else kheap s p of None \<Rightarrow> None | Some (TCB x) \<Rightarrow> Some x | Some _ \<Rightarrow> None)) (device_state (machine_state st) x) (device_state (machine_state s) x); \<forall>xa aa. integrity_asids aag {pasSubject aag} xa aa st (trans_state (?f26 s x a) (s\<lparr>kheap := (kheap s)(receiver := kheap st receiver)\<rparr>)); tcb_in_ipc aag ctxt (pasObjectAbs aag receiver) epptr (kheap st receiver) (kheap s receiver)\<rbrakk> \<Longrightarrow> integrity_asids aag {pasSubject aag} x a st (s\<lparr>scheduler_action := action, kheap := (kheap s)(receiver := kheap st receiver)\<rparr>) proof (prove)
goal (1 subgoal):
 1. \<And>s x a. \<lbrakk>pasObjectAbs aag receiver \<noteq> pasSubject aag; pas_refined aag st; \<forall>x. object_integrity aag (pasObjectAbs aag x) (kheap st x) (if x = receiver then kheap st receiver else kheap s x); \<forall>x. integrity_eobj aag {pasSubject aag} (pasObjectAbs aag x) (ekheap st x) (ekheap s x); \<forall>a b. cdt_integrity aag (cdt st) (\<lambda>p. map_option tcb_state (case kheap st p of None \<Rightarrow> None | Some (TCB x) \<Rightarrow> Some x | Some _ \<Rightarrow> None)) (a, b) (cdt st (a, b), is_original_cap st (a, b)) (cdt s (a, b), is_original_cap s (a, b)); \<forall>a b. cdt_list_integrity aag (cdt st) (\<lambda>p. map_option tcb_state (case kheap st p of None \<Rightarrow> None | Some (TCB x) \<Rightarrow> Some x | Some _ \<Rightarrow> None)) (a, b) (cdt_list st (a, b)) (cdt_list s (a, b)); \<forall>x. integrity_interrupts aag {pasSubject aag} x (interrupt_irq_node st x, interrupt_states st x) (interrupt_irq_node s x, interrupt_states s x); \<forall>d p. integrity_ready_queues aag {pasSubject aag} (pasDomainAbs aag d) (ready_queues st d p) (ready_queues s d p); \<forall>x. memory_integrity X aag x (\<lambda>p. map_option tcb_state (case kheap st p of None \<Rightarrow> None | Some (TCB x) \<Rightarrow> Some x | Some _ \<Rightarrow> None)) (\<lambda>p. map_option tcb_state (case if p = receiver then kheap st receiver else kheap s p of None \<Rightarrow> None | Some (TCB x) \<Rightarrow> Some x | Some _ \<Rightarrow> None)) (auth_ipc_buffers st) (underlying_memory (machine_state st) x) (if x \<in> auth_ipc_buffers st receiver then underlying_memory (machine_state st) x else underlying_memory (machine_state s) x); \<forall>x. integrity_device aag {pasSubject aag} x (\<lambda>p. map_option tcb_state (case kheap st p of None \<Rightarrow> None | Some (TCB x) \<Rightarrow> Some x | Some _ \<Rightarrow> None)) (\<lambda>p. map_option tcb_state (case if p = receiver then kheap st receiver else kheap s p of None \<Rightarrow> None | Some (TCB x) \<Rightarrow> Some x | Some _ \<Rightarrow> None)) (device_state (machine_state st) x) (device_state (machine_state s) x); \<forall>xa aa. integrity_asids aag {pasSubject aag} xa aa st (trans_state (?f26 s x a) (s\<lparr>kheap := (kheap s)(receiver := kheap st receiver)\<rparr>)); tcb_in_ipc aag ctxt (pasObjectAbs aag receiver) epptr (kheap st receiver) (kheap s receiver)\<rbrakk> \<Longrightarrow> integrity_asids aag {pasSubject aag} x a st (trans_state id (s\<lparr>scheduler_action := action, kheap := (kheap s)(receiver := kheap st receiver)\<rparr>)) proof (prove)
goal (1 subgoal):
 1. \<And>s x a. \<lbrakk>pasObjectAbs aag receiver \<noteq> pasSubject aag; pas_refined aag st; \<forall>x. object_integrity aag (pasObjectAbs aag x) (kheap st x) (if x = receiver then kheap st receiver else kheap s x); \<forall>x. integrity_eobj aag {pasSubject aag} (pasObjectAbs aag x) (ekheap st x) (ekheap s x); \<forall>a b. cdt_integrity aag (cdt st) (\<lambda>p. map_option tcb_state (case kheap st p of None \<Rightarrow> None | Some (TCB x) \<Rightarrow> Some x | Some _ \<Rightarrow> None)) (a, b) (cdt st (a, b), is_original_cap st (a, b)) (cdt s (a, b), is_original_cap s (a, b)); \<forall>a b. cdt_list_integrity aag (cdt st) (\<lambda>p. map_option tcb_state (case kheap st p of None \<Rightarrow> None | Some (TCB x) \<Rightarrow> Some x | Some _ \<Rightarrow> None)) (a, b) (cdt_list st (a, b)) (cdt_list s (a, b)); \<forall>x. integrity_interrupts aag {pasSubject aag} x (interrupt_irq_node st x, interrupt_states st x) (interrupt_irq_node s x, interrupt_states s x); \<forall>d p. integrity_ready_queues aag {pasSubject aag} (pasDomainAbs aag d) (ready_queues st d p) (ready_queues s d p); \<forall>x. memory_integrity X aag x (\<lambda>p. map_option tcb_state (case kheap st p of None \<Rightarrow> None | Some (TCB x) \<Rightarrow> Some x | Some _ \<Rightarrow> None)) (\<lambda>p. map_option tcb_state (case if p = receiver then kheap st receiver else kheap s p of None \<Rightarrow> None | Some (TCB x) \<Rightarrow> Some x | Some _ \<Rightarrow> None)) (auth_ipc_buffers st) (underlying_memory (machine_state st) x) (if x \<in> auth_ipc_buffers st receiver then underlying_memory (machine_state st) x else underlying_memory (machine_state s) x); \<forall>x. integrity_device aag {pasSubject aag} x (\<lambda>p. map_option tcb_state (case kheap st p of None \<Rightarrow> None | Some (TCB x) \<Rightarrow> Some x | Some _ \<Rightarrow> None)) (\<lambda>p. map_option tcb_state (case if p = receiver then kheap st receiver else kheap s p of None \<Rightarrow> None | Some (TCB x) \<Rightarrow> Some x | Some _ \<Rightarrow> None)) (device_state (machine_state st) x) (device_state (machine_state s) x); \<forall>xa aa. integrity_asids aag {pasSubject aag} xa aa st (trans_state id (trans_state (?f29 s s x a (?x28 s x a) (?a28 s x a)) (s\<lparr>kheap := (kheap s)(receiver := kheap st receiver)\<rparr>))); tcb_in_ipc aag ctxt (pasObjectAbs aag receiver) epptr (kheap st receiver) (kheap s receiver)\<rbrakk> \<Longrightarrow> integrity_asids aag {pasSubject aag} x a st (trans_state id (s\<lparr>scheduler_action := action, kheap := (kheap s)(receiver := kheap st receiver)\<rparr>)) proof (prove)
goal:
No subgoals!