summaryrefslogtreecommitdiff
path: root/snapshots/isabelle/lib/lem/Lem_assert_extra.thy
diff options
context:
space:
mode:
authorJon French2018-05-15 17:50:05 +0100
committerJon French2018-05-15 17:50:05 +0100
commite2d8fe4d847b6e8f71eecd7aa6d15799bd2a2e11 (patch)
treeaf5ca7ac35244a706f9631ab8f1a4dada172f27d /snapshots/isabelle/lib/lem/Lem_assert_extra.thy
parented3bb9702bd1f76041a3798f453714b0636a1b6b (diff)
parent77b393e4f53d14955d301cbd16e22d2e7b026ede (diff)
Merge branch 'sail2' into mappings
Diffstat (limited to 'snapshots/isabelle/lib/lem/Lem_assert_extra.thy')
-rw-r--r--snapshots/isabelle/lib/lem/Lem_assert_extra.thy45
1 files changed, 45 insertions, 0 deletions
diff --git a/snapshots/isabelle/lib/lem/Lem_assert_extra.thy b/snapshots/isabelle/lib/lem/Lem_assert_extra.thy
new file mode 100644
index 00000000..b56e5a19
--- /dev/null
+++ b/snapshots/isabelle/lib/lem/Lem_assert_extra.thy
@@ -0,0 +1,45 @@
+chapter \<open>Generated by Lem from assert_extra.lem.\<close>
+
+theory "Lem_assert_extra"
+
+imports
+ Main
+ "Lem"
+
+begin
+
+
+(*open import {ocaml} `Xstring`*)
+(*open import {hol} `stringTheory` `lemTheory`*)
+(*open import {coq} `Coq.Strings.Ascii` `Coq.Strings.String`*)
+(*open import {isabelle} `$LIB_DIR/Lem`*)
+
+(* ------------------------------------ *)
+(* failing with a proper error message *)
+(* ------------------------------------ *)
+
+(*val failwith: forall 'a. string -> 'a*)
+
+(* ------------------------------------ *)
+(* failing without an error message *)
+(* ------------------------------------ *)
+
+(*val fail : forall 'a. 'a*)
+definition fail :: " 'a " where
+ " fail = ( failwith (''fail''))"
+
+
+(* ------------------------------------- *)
+(* assertions *)
+(* ------------------------------------- *)
+
+(*val ensure : bool -> string -> unit*)
+definition ensure :: " bool \<Rightarrow> string \<Rightarrow> unit " where
+ " ensure test msg = (
+ if test then
+ ()
+ else
+ failwith msg )"
+
+
+end