-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathLem_assert_extra.thy
executable file
·45 lines (31 loc) · 1.03 KB
/
Lem_assert_extra.thy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
chapter {* Generated by Lem from assert_extra.lem. *}
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