equal
deleted
inserted
replaced
271 |
271 |
272 lemma execute_bind [execute_simps]: |
272 lemma execute_bind [execute_simps]: |
273 "execute f h = Some (x, h') \<Longrightarrow> execute (f \<guillemotright>= g) h = execute (g x) h'" |
273 "execute f h = Some (x, h') \<Longrightarrow> execute (f \<guillemotright>= g) h = execute (g x) h'" |
274 "execute f h = None \<Longrightarrow> execute (f \<guillemotright>= g) h = None" |
274 "execute f h = None \<Longrightarrow> execute (f \<guillemotright>= g) h = None" |
275 by (simp_all add: bind_def) |
275 by (simp_all add: bind_def) |
|
276 |
|
277 lemma execute_bind_case: |
|
278 "execute (f \<guillemotright>= g) h = (case (execute f h) of |
|
279 Some (x, h') \<Rightarrow> execute (g x) h' | None \<Rightarrow> None)" |
|
280 by (simp add: bind_def) |
276 |
281 |
277 lemma execute_bind_success: |
282 lemma execute_bind_success: |
278 "success f h \<Longrightarrow> execute (f \<guillemotright>= g) h = execute (g (fst (the (execute f h)))) (snd (the (execute f h)))" |
283 "success f h \<Longrightarrow> execute (f \<guillemotright>= g) h = execute (g (fst (the (execute f h)))) (snd (the (execute f h)))" |
279 by (cases f h rule: Heap_cases) (auto elim!: successE simp add: bind_def) |
284 by (cases f h rule: Heap_cases) (auto elim!: successE simp add: bind_def) |
280 |
285 |