diff --git a/lib/Corres_UL.thy b/lib/Corres_UL.thy index 3af797da51..2748d2a4cc 100644 --- a/lib/Corres_UL.thy +++ b/lib/Corres_UL.thy @@ -905,11 +905,24 @@ qed lemma corres_inst: "corres_underlying sr nf nf' r P P' f g \ corres_underlying sr nf nf' r P P' f g" . lemma corres_assert_opt_assume: - assumes "\x. P' = Some x \ corres_underlying sr nf nf' r P Q f (g x)" - assumes "\s. Q s \ P' \ None" - shows "corres_underlying sr nf nf' r P Q f (assert_opt P' >>= g)" using assms - by (auto simp: bind_def assert_opt_def assert_def fail_def return_def - corres_underlying_def split: option.splits) + "\\x. opt = Some x \ corres_underlying sr nf nf' r P Q f (g x); \s. Q s \ opt \ None\ + \ corres_underlying sr nf nf' r P Q f (assert_opt opt >>= g)" + by (fastforce simp: bind_def return_def corres_underlying_def) + +lemma corres_assert_opt_assume': + "(\x. opt = Some x \ corres_underlying sr nf nf' r P Q f (g x)) + \ corres_underlying sr nf nf' r P (Q and K (opt \ None)) f (assert_opt opt >>= g)" + by (fastforce intro: corres_gen_asm2 stronger_corres_guard_imp corres_assert_opt_assume) + +lemma corres_assert_opt_assume_lhs: + "\\x. opt = Some x \ corres_underlying sr nf nf' r P Q (f x) g; \s. P s \ opt \ None\ + \ corres_underlying sr nf nf' r P Q (assert_opt opt >>= f) g" + by (fastforce simp: bind_def return_def corres_underlying_def) + +lemma corres_assert_opt_assume_lhs': + "(\x. opt = Some x \ corres_underlying sr nf nf' r P Q (f x) g) + \ corres_underlying sr nf nf' r (P and K (opt \ None)) Q (assert_opt opt >>= f) g" + by (fastforce intro: corres_gen_asm stronger_corres_guard_imp corres_assert_opt_assume_lhs) lemma corres_assert_opt[corres]: "r x x' \