diff --git a/lib/Corres_UL.thy b/lib/Corres_UL.thy index cfe0858522..cc8cf82047 100644 --- a/lib/Corres_UL.thy +++ b/lib/Corres_UL.thy @@ -592,6 +592,134 @@ lemma corres_symb_exec_r: apply simp+ done + + + +lemma corres_underlying_split_r: + assumes ac: "corres_underlying s nf nf' r' G G' a c" + assumes valid: "\G\ a \P\" "\G'\ c \P'\" + assumes bd: "\rv rv'. r' rv rv' \ + corres_underlying s nf nf' r (P rv) (P' rv') (return rv) (d rv')" + shows "corres_underlying s nf nf' r G G' a (c >>= (\rv'. d rv'))" + using corres_underlying_split[where b = "return"] + using ac bd valid + by (smt corres_bind_return corres_split') + +lemma corres_underlying_split_l: + assumes ac: "corres_underlying s nf nf' r' G G' a c" + assumes valid: "\G\ a \P\" "\G'\ c \P'\" + assumes bd: "\rv rv'. r' rv rv' \ + corres_underlying s nf nf' r (P rv) (P' rv') (b rv) (return rv')" + shows "corres_underlying s nf nf' r G G' (a >>= (\rv'. b rv')) c" + using corres_underlying_split[where d = "return"] + using ac bd valid + by (smt corres_bind_return2 corres_underlying_split) + + +lemma corres_underlying_split_r_ret: + assumes ac: "corres_underlying s nf nf' r' G G' ( return() ) c" + assumes valid: "\G\ return () \P\" "\G'\ c \P'\" + assumes bd: "\rv rv'. r' rv rv' \ + corres_underlying s nf nf' r (P rv) (P' rv') b (d rv')" + shows "corres_underlying s nf nf' r G G' b (c >>= (\rv'. d rv'))" + using corres_underlying_split[where a = "return ()" and b = "\_. b"] + using ac bd valid + by (metis corres_add_noop_lhs) + + +lemma corres_if_noPreCond: + "\ \(s,t)\sr. P s \ P' t \ G = G' ; + corres_underlying sr nf nf' r P P' a c; + corres_underlying sr nf nf' r P P' b d \ \ + corres_underlying sr nf nf' r + P P' (if G then a else b) (if G' then c else d)" + unfolding corres_underlying_def + apply simp unfolding case_prod_unfold + by auto + +lemma corres_if_preCond: + "\ \(s,t)\sr. P s \ P' t \ G = G' ; + G \ G' \ corres_underlying sr nf nf' r P P' a c; + \(G \ G') \ corres_underlying sr nf nf' r P P' b d \ \ + corres_underlying sr nf nf' r + P P' (if G then a else b) (if G' then c else d)" + unfolding corres_underlying_def + apply simp unfolding case_prod_unfold + by auto + + +lemma corres_if_condition_noPreCond : + "\ \(s,t)\sr. P s \ P' t \ G = G' t ; + corres_underlying sr nf nf' r P P' a c; + corres_underlying sr nf nf' r P P' b d \ \ + corres_underlying sr nf nf' r + P P' (if G then a else b) (condition G' c d)" + unfolding corres_underlying_def condition_def + apply simp unfolding case_prod_unfold + by auto + +lemma corres_if_condition_preCond : + "\ \(s,t)\sr. P s \ P' t \ G = G' t ; + corres_underlying sr nf nf' r P (P' and G') a c; + corres_underlying sr nf nf' r P (\s. P' s \ \(G' s)) b d \ \ + corres_underlying sr nf nf' r + P P' (if G then a else b) (condition G' c d)" + unfolding corres_underlying_def condition_def + apply simp unfolding case_prod_unfold + by auto + +lemma corres_if_condition_preCond2 : + "\ \(s,t)\sr. P s \ P' t \ G = G' t ; + corres_underlying sr nf nf' r (\s. P s \ G) (P' and G') a c; + corres_underlying sr nf nf' r P (\s. P' s \ \(G' s)) b d \ \ + corres_underlying sr nf nf' r + P P' (if G then a else b) (condition G' c d)" + unfolding corres_underlying_def condition_def + apply simp unfolding case_prod_unfold + by auto + +lemma corres_condition_noPreCond: + "\ \(s,t)\sr. P s \ P' t \ G s = G' t; + corres_underlying sr nf nf' r P P' a c; + corres_underlying sr nf nf' r P P' b d \ \ + corres_underlying sr nf nf' r + P P' (condition G a b) (condition G' c d)" + unfolding condition_def corres_underlying_def + apply simp + unfolding case_prod_unfold + by auto + +lemma corres_condition_preCond: + "\ \(s,t)\sr. P s \ P' t \ G s = G' t; + corres_underlying sr nf nf' r (\s. G s \ P s) (\s. G' s \ P' s) a c; + corres_underlying sr nf nf' r (\s. \G s \ P s) (\s. \G' s \ P' s) b d \ \ + corres_underlying sr nf nf' r + P P' (condition G a b) (condition G' c d)" + unfolding condition_def corres_underlying_def + apply simp + unfolding case_prod_unfold + by auto + +lemma corres_condition_G : + "\ \s. P' s \ G' s ; + corres_underlying sr nf nf' r P P' a c \ \ + corres_underlying sr nf nf' r P P' a (condition G' c d)" + unfolding condition_def corres_underlying_def + by simp + +lemma corres_condition_notG : + "\ \s. P' s \ \G' s ; + corres_underlying sr nf nf' r P P' a d \ \ + corres_underlying sr nf nf' r P P' a (condition G' c d)" + unfolding condition_def corres_underlying_def + by simp + + + + + + + lemma corres_symb_exec_r_conj: assumes z: "\rv. corres_underlying sr nf nf' r Q (R' rv) x (y rv)" assumes y: "\Q'\ m \R'\"