theory Finalise_R

lemma n_next:
  "n p = Some (CTE cap node) \<Longrightarrow>
  (\<exists>cap' node'. m p = Some (CTE cap' node') \<and>
              (if p = slot
               then mdbNext node = 0
               else if p = mdbPrev s_node
               then mdbNext node = mdbNext s_node
               else mdbNext node = mdbNext node'))" apply (subgoal_tac "p \<noteq> 0") prefer 2 apply (insert no_0_n)[1] apply clarsimp apply (cases "p = slot") apply (clarsimp simp: n_def modify_map_if initMDBNode_def split: if_split_asm) apply (cases "p = mdbPrev s_node") apply (auto simp: n_def modify_map_if initMDBNode_def split: if_split_asm) done

(* Proof state trace *)
proof (prove)
goal (1 subgoal):
 1. n p = Some (CTE cap node) \<Longrightarrow> \<exists>cap' node'. m p = Some (CTE cap' node') \<and> (if p = slot then mdbNext node = 0 else if p = mdbPrev s_node then mdbNext node = mdbNext s_node else mdbNext node = mdbNext node') proof (prove)
goal (2 subgoals):
 1. \<lbrakk>n p = Some (CTE cap node); p \<noteq> 0\<rbrakk> \<Longrightarrow> \<exists>cap' node'. m p = Some (CTE cap' node') \<and> (if p = slot then mdbNext node = 0 else if p = mdbPrev s_node then mdbNext node = mdbNext s_node else mdbNext node = mdbNext node')
 2. n p = Some (CTE cap node) \<Longrightarrow> p \<noteq> 0 proof (prove)
goal (2 subgoals):
 1. n p = Some (CTE cap node) \<Longrightarrow> p \<noteq> 0
 2. \<lbrakk>n p = Some (CTE cap node); p \<noteq> 0\<rbrakk> \<Longrightarrow> \<exists>cap' node'. m p = Some (CTE cap' node') \<and> (if p = slot then mdbNext node = 0 else if p = mdbPrev s_node then mdbNext node = mdbNext s_node else mdbNext node = mdbNext node') proof (prove)
goal (2 subgoals):
 1. \<lbrakk>n p = Some (CTE cap node); no_0 n\<rbrakk> \<Longrightarrow> p \<noteq> 0
 2. \<lbrakk>n p = Some (CTE cap node); p \<noteq> 0\<rbrakk> \<Longrightarrow> \<exists>cap' node'. m p = Some (CTE cap' node') \<and> (if p = slot then mdbNext node = 0 else if p = mdbPrev s_node then mdbNext node = mdbNext s_node else mdbNext node = mdbNext node') proof (prove)
goal (1 subgoal):
 1. \<lbrakk>n p = Some (CTE cap node); p \<noteq> 0\<rbrakk> \<Longrightarrow> \<exists>cap' node'. m p = Some (CTE cap' node') \<and> (if p = slot then mdbNext node = 0 else if p = mdbPrev s_node then mdbNext node = mdbNext s_node else mdbNext node = mdbNext node') proof (prove)
goal (2 subgoals):
 1. \<lbrakk>n p = Some (CTE cap node); p \<noteq> 0; p = slot\<rbrakk> \<Longrightarrow> \<exists>cap' node'. m p = Some (CTE cap' node') \<and> (if p = slot then mdbNext node = 0 else if p = mdbPrev s_node then mdbNext node = mdbNext s_node else mdbNext node = mdbNext node')
 2. \<lbrakk>n p = Some (CTE cap node); p \<noteq> 0; p \<noteq> slot\<rbrakk> \<Longrightarrow> \<exists>cap' node'. m p = Some (CTE cap' node') \<and> (if p = slot then mdbNext node = 0 else if p = mdbPrev s_node then mdbNext node = mdbNext s_node else mdbNext node = mdbNext node') proof (prove)
goal (1 subgoal):
 1. \<lbrakk>n p = Some (CTE cap node); p \<noteq> 0; p \<noteq> slot\<rbrakk> \<Longrightarrow> \<exists>cap' node'. m p = Some (CTE cap' node') \<and> (if p = slot then mdbNext node = 0 else if p = mdbPrev s_node then mdbNext node = mdbNext s_node else mdbNext node = mdbNext node') proof (prove)
goal (2 subgoals):
 1. \<lbrakk>n p = Some (CTE cap node); p \<noteq> 0; p \<noteq> slot; p = mdbPrev s_node\<rbrakk> \<Longrightarrow> \<exists>cap' node'. m p = Some (CTE cap' node') \<and> (if p = slot then mdbNext node = 0 else if p = mdbPrev s_node then mdbNext node = mdbNext s_node else mdbNext node = mdbNext node')
 2. \<lbrakk>n p = Some (CTE cap node); p \<noteq> 0; p \<noteq> slot; p \<noteq> mdbPrev s_node\<rbrakk> \<Longrightarrow> \<exists>cap' node'. m p = Some (CTE cap' node') \<and> (if p = slot then mdbNext node = 0 else if p = mdbPrev s_node then mdbNext node = mdbNext s_node else mdbNext node = mdbNext node') proof (prove)
goal:
No subgoals!