theory Separation_Algebra_Alt

lemma sep_conj_assoc:
  "P ** (Q ** R) = (P ** Q) ** R" unfolding sep_conj_def apply (rule ext) apply (rule iffI) apply clarsimp apply (drule (1) lift_to_add2) apply (subst (asm) add_assoc) apply (fastforce simp: add2_Some_Some add2_Some) apply clarsimp apply (drule (1) lift_to_add2') apply (subst (asm) add_assoc [symmetric]) apply (fastforce simp: add2_Some_Some Some_add2) done

(* Proof state trace *)
proof (prove)
goal (1 subgoal):
 1. P ** (Q ** R) = P ** Q ** R proof (prove)
goal (1 subgoal):
 1. (\<lambda>s. \<exists>p q. p \<oplus> q = Some s \<and> P p \<and> (\<exists>p qa. p \<oplus> qa = Some q \<and> Q p \<and> R qa)) = (\<lambda>s. \<exists>p q. p \<oplus> q = Some s \<and> (\<exists>pa q. pa \<oplus> q = Some p \<and> P pa \<and> Q q) \<and> R q) proof (prove)
goal (1 subgoal):
 1. \<And>s. (\<exists>p q. p \<oplus> q = Some s \<and> P p \<and> (\<exists>p qa. p \<oplus> qa = Some q \<and> Q p \<and> R qa)) = (\<exists>p q. p \<oplus> q = Some s \<and> (\<exists>pa q. pa \<oplus> q = Some p \<and> P pa \<and> Q q) \<and> R q) proof (prove)
goal (2 subgoals):
 1. \<And>s. \<exists>p q. p \<oplus> q = Some s \<and> P p \<and> (\<exists>p qa. p \<oplus> qa = Some q \<and> Q p \<and> R qa) \<Longrightarrow> \<exists>p q. p \<oplus> q = Some s \<and> (\<exists>pa q. pa \<oplus> q = Some p \<and> P pa \<and> Q q) \<and> R q
 2. \<And>s. \<exists>p q. p \<oplus> q = Some s \<and> (\<exists>pa q. pa \<oplus> q = Some p \<and> P pa \<and> Q q) \<and> R q \<Longrightarrow> \<exists>p q. p \<oplus> q = Some s \<and> P p \<and> (\<exists>p qa. p \<oplus> qa = Some q \<and> Q p \<and> R qa) proof (prove)
goal (2 subgoals):
 1. \<And>s p q pa qa. \<lbrakk>p \<oplus> q = Some s; P p; pa \<oplus> qa = Some q; Q pa; R qa\<rbrakk> \<Longrightarrow> \<exists>p q. p \<oplus> q = Some s \<and> (\<exists>pa q. pa \<oplus> q = Some p \<and> P pa \<and> Q q) \<and> R q
 2. \<And>s. \<exists>p q. p \<oplus> q = Some s \<and> (\<exists>pa q. pa \<oplus> q = Some p \<and> P pa \<and> Q q) \<and> R q \<Longrightarrow> \<exists>p q. p \<oplus> q = Some s \<and> P p \<and> (\<exists>p qa. p \<oplus> qa = Some q \<and> Q p \<and> R qa) proof (prove)
goal (2 subgoals):
 1. \<And>s p q pa qa. \<lbrakk>P p; pa \<oplus> qa = Some q; Q pa; R qa; Some p ++ Some pa ++ Some qa = Some s\<rbrakk> \<Longrightarrow> \<exists>p q. p \<oplus> q = Some s \<and> (\<exists>pa q. pa \<oplus> q = Some p \<and> P pa \<and> Q q) \<and> R q
 2. \<And>s. \<exists>p q. p \<oplus> q = Some s \<and> (\<exists>pa q. pa \<oplus> q = Some p \<and> P pa \<and> Q q) \<and> R q \<Longrightarrow> \<exists>p q. p \<oplus> q = Some s \<and> P p \<and> (\<exists>p qa. p \<oplus> qa = Some q \<and> Q p \<and> R qa) proof (prove)
goal (2 subgoals):
 1. \<And>s p q pa qa. \<lbrakk>P p; pa \<oplus> qa = Some q; Q pa; R qa; (Some p ++ Some pa) ++ Some qa = Some s\<rbrakk> \<Longrightarrow> \<exists>p q. p \<oplus> q = Some s \<and> (\<exists>pa q. pa \<oplus> q = Some p \<and> P pa \<and> Q q) \<and> R q
 2. \<And>s. \<exists>p q. p \<oplus> q = Some s \<and> (\<exists>pa q. pa \<oplus> q = Some p \<and> P pa \<and> Q q) \<and> R q \<Longrightarrow> \<exists>p q. p \<oplus> q = Some s \<and> P p \<and> (\<exists>p qa. p \<oplus> qa = Some q \<and> Q p \<and> R qa) proof (prove)
goal (1 subgoal):
 1. \<And>s. \<exists>p q. p \<oplus> q = Some s \<and> (\<exists>pa q. pa \<oplus> q = Some p \<and> P pa \<and> Q q) \<and> R q \<Longrightarrow> \<exists>p q. p \<oplus> q = Some s \<and> P p \<and> (\<exists>p qa. p \<oplus> qa = Some q \<and> Q p \<and> R qa) proof (prove)
goal (1 subgoal):
 1. \<And>s p q pa qa. \<lbrakk>p \<oplus> q = Some s; R q; pa \<oplus> qa = Some p; P pa; Q qa\<rbrakk> \<Longrightarrow> \<exists>p q. p \<oplus> q = Some s \<and> P p \<and> (\<exists>p qa. p \<oplus> qa = Some q \<and> Q p \<and> R qa) proof (prove)
goal (1 subgoal):
 1. \<And>s p q pa qa. \<lbrakk>R q; pa \<oplus> qa = Some p; P pa; Q qa; (Some pa ++ Some qa) ++ Some q = Some s\<rbrakk> \<Longrightarrow> \<exists>p q. p \<oplus> q = Some s \<and> P p \<and> (\<exists>p qa. p \<oplus> qa = Some q \<and> Q p \<and> R qa) proof (prove)
goal (1 subgoal):
 1. \<And>s p q pa qa. \<lbrakk>R q; pa \<oplus> qa = Some p; P pa; Q qa; Some pa ++ Some qa ++ Some q = Some s\<rbrakk> \<Longrightarrow> \<exists>p q. p \<oplus> q = Some s \<and> P p \<and> (\<exists>p qa. p \<oplus> qa = Some q \<and> Q p \<and> R qa) proof (prove)
goal:
No subgoals!