diff --git a/Core_DOM/preliminaries/Heap_Error_Monad.thy b/Core_DOM/preliminaries/Heap_Error_Monad.thy index e035a64..853056d 100644 --- a/Core_DOM/preliminaries/Heap_Error_Monad.thy +++ b/Core_DOM/preliminaries/Heap_Error_Monad.thy @@ -79,9 +79,23 @@ definition where "returns_heap h p h' \ (case h \ p of Inr (_ , h'') \ h' = h'' | Inl _ \ False)" +fun select_heap ("|(_)|\<^sub>h") + where + "select_heap (Inr ( _, h)) = h" + | "select_heap (Inl _) = undefined" + lemma returns_heap_eq [elim]: "h \ f \\<^sub>h h' \ h \ f \\<^sub>h h'' \ h' = h''" by(auto simp add: returns_heap_def split: sum.splits) +definition + returns_result_heap :: "'heap \ ('heap, 'e, 'result) prog \ 'result \ 'heap \ bool" + ("((_)/ \ (_)/ \\<^sub>r (_) \\<^sub>h (_))" [60, 35, 61, 62] 65) + where + "returns_result_heap h p r h' \ h \ p \\<^sub>r r \ h \ p \\<^sub>h h'" + +lemma [code]: "returns_result_heap h p r h' \ (case h \ p of Inr (r', h'') \ r = r' \ h' = h'' | Inl _ \ False)" + by(auto simp add: returns_result_heap_def returns_result_def returns_heap_def split: sum.splits) + definition returns_error :: "'heap \ ('heap, 'e, 'result) prog \ 'e \ bool" ("((_)/ \ (_)/ \\<^sub>e (_))" [60, 35, 61] 65)