theory DetSchedSchedule_AI

lemma set_scheduler_action_cnt_valid_blocked_except:
  "\<lbrace>valid_blocked_except target and (\<lambda>s. \<forall>t. scheduler_action s = switch_thread t \<longrightarrow>
      (\<exists>d p. t \<in> set (ready_queues s d p)))\<rbrace>
   set_scheduler_action choose_new_thread  \<lbrace>\<lambda>_. valid_blocked_except target\<rbrace>" apply (simp add: valid_blocked_except_def, wp set_scheduler_action_wp) apply clarsimp apply (erule_tac x=t in allE) apply (erule impCE) apply force apply (force simp: not_queued_def) done

(* Proof state trace *)
proof (prove)
goal (1 subgoal):
 1. \<lbrace>valid_blocked_except target and (\<lambda>s. \<forall>t. scheduler_action s = switch_thread t \<longrightarrow> (\<exists>d p. t \<in> set (ready_queues s d p)))\<rbrace> set_scheduler_action choose_new_thread \<lbrace>\<lambda>_. valid_blocked_except target\<rbrace> proof (prove)
goal (1 subgoal):
 1. \<And>s. ((\<lambda>s. \<forall>t. t \<noteq> target \<longrightarrow> not_queued t s \<longrightarrow> (\<forall>st. st_tcb_at ((=) st) t s \<longrightarrow> t \<noteq> cur_thread s \<longrightarrow> scheduler_action s \<noteq> switch_thread t \<longrightarrow> st \<noteq> Running \<and> st \<noteq> Restart)) and (\<lambda>s. \<forall>t. scheduler_action s = switch_thread t \<longrightarrow> (\<exists>d p. t \<in> set (ready_queues s d p)))) s \<Longrightarrow> \<forall>t. t \<noteq> target \<longrightarrow> not_queued t (scheduler_action_update (\<lambda>_. choose_new_thread) s) \<longrightarrow> (\<forall>st. st_tcb_at ((=) st) t (scheduler_action_update (\<lambda>_. choose_new_thread) s) \<longrightarrow> t \<noteq> cur_thread (scheduler_action_update (\<lambda>_. choose_new_thread) s) \<longrightarrow> scheduler_action (scheduler_action_update (\<lambda>_. choose_new_thread) s) \<noteq> switch_thread t \<longrightarrow> st \<noteq> Running \<and> st \<noteq> Restart) proof (prove)
goal (1 subgoal):
 1. \<And>s t st. \<lbrakk>\<forall>t. t \<noteq> target \<longrightarrow> not_queued t s \<longrightarrow> (\<forall>st. st_tcb_at ((=) st) t s \<longrightarrow> t \<noteq> cur_thread s \<longrightarrow> scheduler_action s \<noteq> switch_thread t \<longrightarrow> st \<noteq> Running \<and> st \<noteq> Restart); \<forall>t. scheduler_action s = switch_thread t \<longrightarrow> (\<exists>d p. t \<in> set (ready_queues s d p)); t \<noteq> target; not_queued t s; st_tcb_at ((=) st) t s; t \<noteq> cur_thread s\<rbrakk> \<Longrightarrow> st \<noteq> Running \<and> st \<noteq> Restart proof (prove)
goal (1 subgoal):
 1. \<And>s t st. \<lbrakk>\<forall>t. scheduler_action s = switch_thread t \<longrightarrow> (\<exists>d p. t \<in> set (ready_queues s d p)); t \<noteq> target; not_queued t s; st_tcb_at ((=) st) t s; t \<noteq> cur_thread s; t \<noteq> target \<longrightarrow> not_queued t s \<longrightarrow> (\<forall>st. st_tcb_at ((=) st) t s \<longrightarrow> t \<noteq> cur_thread s \<longrightarrow> scheduler_action s \<noteq> switch_thread t \<longrightarrow> st \<noteq> Running \<and> st \<noteq> Restart)\<rbrakk> \<Longrightarrow> st \<noteq> Running \<and> st \<noteq> Restart proof (prove)
goal (2 subgoals):
 1. \<And>s t st. \<lbrakk>\<forall>t. scheduler_action s = switch_thread t \<longrightarrow> (\<exists>d p. t \<in> set (ready_queues s d p)); t \<noteq> target; not_queued t s; st_tcb_at ((=) st) t s; t \<noteq> cur_thread s; \<not> t \<noteq> target\<rbrakk> \<Longrightarrow> st \<noteq> Running \<and> st \<noteq> Restart
 2. \<And>s t st. \<lbrakk>\<forall>t. scheduler_action s = switch_thread t \<longrightarrow> (\<exists>d p. t \<in> set (ready_queues s d p)); t \<noteq> target; not_queued t s; st_tcb_at ((=) st) t s; t \<noteq> cur_thread s; not_queued t s \<longrightarrow> (\<forall>st. st_tcb_at ((=) st) t s \<longrightarrow> t \<noteq> cur_thread s \<longrightarrow> scheduler_action s \<noteq> switch_thread t \<longrightarrow> st \<noteq> Running \<and> st \<noteq> Restart)\<rbrakk> \<Longrightarrow> st \<noteq> Running \<and> st \<noteq> Restart proof (prove)
goal (1 subgoal):
 1. \<And>s t st. \<lbrakk>\<forall>t. scheduler_action s = switch_thread t \<longrightarrow> (\<exists>d p. t \<in> set (ready_queues s d p)); t \<noteq> target; not_queued t s; st_tcb_at ((=) st) t s; t \<noteq> cur_thread s; not_queued t s \<longrightarrow> (\<forall>st. st_tcb_at ((=) st) t s \<longrightarrow> t \<noteq> cur_thread s \<longrightarrow> scheduler_action s \<noteq> switch_thread t \<longrightarrow> st \<noteq> Running \<and> st \<noteq> Restart)\<rbrakk> \<Longrightarrow> st \<noteq> Running \<and> st \<noteq> Restart proof (prove)
goal:
No subgoals!