theory MoreCorres

lemma corres_alternate_match:
  "\<lbrakk> corres_underlying sr nf nf' r P P' a c;
     corres_underlying sr nf nf' r P P' b d \<rbrakk> \<Longrightarrow>
   corres_underlying sr nf nf' r P P' (a \<sqinter> b) (c \<sqinter> d)" apply (simp add: corres_underlying_def alternative_def) apply (clarsimp) apply (drule (1) bspec, clarsimp)+ apply fastforce done

(* Proof state trace *)
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>corres_underlying sr nf nf' r P P' a c; corres_underlying sr nf nf' r P P' b d\<rbrakk> \<Longrightarrow> corres_underlying sr nf nf' r P P' (a \<sqinter> b) (c \<sqinter> d) proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x\<in>sr. case x of (s, s') \<Rightarrow> P s \<and> P' s' \<longrightarrow> (nf \<longrightarrow> \<not> snd (a s)) \<longrightarrow> (\<forall>x\<in>fst (c s'). case x of (r', t') \<Rightarrow> \<exists>x\<in>fst (a s). case x of (ra, t) \<Rightarrow> (t, t') \<in> sr \<and> r ra r') \<and> (nf' \<longrightarrow> \<not> snd (c s')); \<forall>x\<in>sr. case x of (s, s') \<Rightarrow> P s \<and> P' s' \<longrightarrow> (nf \<longrightarrow> \<not> snd (b s)) \<longrightarrow> (\<forall>x\<in>fst (d s'). case x of (r', t') \<Rightarrow> \<exists>x\<in>fst (b s). case x of (ra, t) \<Rightarrow> (t, t') \<in> sr \<and> r ra r') \<and> (nf' \<longrightarrow> \<not> snd (d s'))\<rbrakk> \<Longrightarrow> \<forall>x\<in>sr. case x of (s, s') \<Rightarrow> P s \<and> P' s' \<longrightarrow> (nf \<longrightarrow> \<not> snd (a s) \<and> \<not> snd (b s)) \<longrightarrow> (\<forall>x\<in>fst (c s') \<union> fst (d s'). case x of (r', t') \<Rightarrow> \<exists>x\<in>fst (a s) \<union> fst (b s). case x of (ra, t) \<Rightarrow> (t, t') \<in> sr \<and> r ra r') \<and> (nf' \<longrightarrow> \<not> snd (c s') \<and> \<not> snd (d s')) proof (prove)
goal (1 subgoal):
 1. \<And>aa ba. \<lbrakk>\<forall>x\<in>sr. case x of (s, s') \<Rightarrow> P s \<and> P' s' \<longrightarrow> (nf \<longrightarrow> \<not> snd (a s)) \<longrightarrow> (\<forall>x\<in>fst (c s'). case x of (r', t') \<Rightarrow> \<exists>x\<in>fst (a s). case x of (ra, t) \<Rightarrow> (t, t') \<in> sr \<and> r ra r') \<and> (nf' \<longrightarrow> \<not> snd (c s')); \<forall>x\<in>sr. case x of (s, s') \<Rightarrow> P s \<and> P' s' \<longrightarrow> (nf \<longrightarrow> \<not> snd (b s)) \<longrightarrow> (\<forall>x\<in>fst (d s'). case x of (r', t') \<Rightarrow> \<exists>x\<in>fst (b s). case x of (ra, t) \<Rightarrow> (t, t') \<in> sr \<and> r ra r') \<and> (nf' \<longrightarrow> \<not> snd (d s')); (aa, ba) \<in> sr; P aa; P' ba; nf \<longrightarrow> \<not> snd (a aa) \<and> \<not> snd (b aa)\<rbrakk> \<Longrightarrow> (\<forall>x\<in>fst (c ba) \<union> fst (d ba). case x of (r', t') \<Rightarrow> \<exists>x\<in>fst (a aa) \<union> fst (b aa). case x of (ra, t) \<Rightarrow> (t, t') \<in> sr \<and> r ra r') \<and> (nf' \<longrightarrow> \<not> snd (c ba) \<and> \<not> snd (d ba)) proof (prove)
goal (1 subgoal):
 1. \<And>aa ba aaa baa. \<lbrakk>(aa, ba) \<in> sr; P aa; P' ba; nf \<longrightarrow> \<not> snd (a aa) \<and> \<not> snd (b aa); \<forall>x\<in>fst (c ba). case x of (r', t') \<Rightarrow> \<exists>x\<in>fst (a aa). case x of (ra, t) \<Rightarrow> (t, t') \<in> sr \<and> r ra r'; nf' \<longrightarrow> \<not> snd (c ba); (aaa, baa) \<in> fst (c ba) \<or> (aaa, baa) \<in> fst (d ba); \<forall>x\<in>fst (d ba). case x of (r', t') \<Rightarrow> \<exists>x\<in>fst (b aa). case x of (ra, t) \<Rightarrow> (t, t') \<in> sr \<and> r ra r'; nf' \<longrightarrow> \<not> snd (d ba)\<rbrakk> \<Longrightarrow> \<exists>x\<in>fst (a aa) \<union> fst (b aa). case x of (ra, t) \<Rightarrow> (t, baa) \<in> sr \<and> r ra aaa proof (prove)
goal:
No subgoals!