lemma execute_bind_case
authorhaftmann
Fri, 13 Aug 2010 14:45:07 +0200
changeset 38409 9ee71ec7db4e
parent 38408 721b4d6095b7
child 38410 8e4058f4848c
child 38435 1e1ef69ec0de
lemma execute_bind_case
src/HOL/Imperative_HOL/Heap_Monad.thy
--- a/src/HOL/Imperative_HOL/Heap_Monad.thy	Fri Aug 13 14:43:16 2010 +0200
+++ b/src/HOL/Imperative_HOL/Heap_Monad.thy	Fri Aug 13 14:45:07 2010 +0200
@@ -274,6 +274,11 @@
   "execute f h = None \<Longrightarrow> execute (f \<guillemotright>= g) h = None"
   by (simp_all add: bind_def)
 
+lemma execute_bind_case:
+  "execute (f \<guillemotright>= g) h = (case (execute f h) of
+    Some (x, h') \<Rightarrow> execute (g x) h' | None \<Rightarrow> None)"
+  by (simp add: bind_def)
+
 lemma execute_bind_success:
   "success f h \<Longrightarrow> execute (f \<guillemotright>= g) h = execute (g (fst (the (execute f h)))) (snd (the (execute f h)))"
   by (cases f h rule: Heap_cases) (auto elim!: successE simp add: bind_def)