forked from CakeML/cakeml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fpValTreeScript.sml
68 lines (53 loc) · 1.16 KB
/
fpValTreeScript.sml
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
(*
Values used to model floating-points, in the style of Icing
*)
open HolKernel Parse boolLib bossLib;
open libTheory;
val _ = numLib.prefer_num();
val _ = new_theory "fpValTree";
(*
Definition of floating point value trees for CakeML
*)
(*open import Pervasives*)
(*open import Lib*)
Datatype:
fp_opt = Opt | NoOpt
End
Datatype:
fp_cmp = FP_Less | FP_LessEqual | FP_Greater | FP_GreaterEqual | FP_Equal
End
Datatype:
fp_uop = FP_Abs | FP_Neg | FP_Sqrt
End
Datatype:
fp_bop = FP_Add | FP_Sub | FP_Mul | FP_Div
End
Datatype:
fp_top = FP_Fma
End
Datatype:
fp_word_val =
Fp_const word64
| Fp_uop fp_uop fp_word_val
| Fp_bop fp_bop fp_word_val fp_word_val
| Fp_top fp_top fp_word_val fp_word_val fp_word_val
| Fp_wopt fp_opt fp_word_val
End
Datatype:
fp_bool_val =
Fp_cmp fp_cmp fp_word_val fp_word_val
| Fp_bopt fp_opt fp_bool_val
End
Definition fp_cmp_def:
fp_cmp fop f1 f2 = Fp_cmp fop f1 f2
End
Definition fp_uop_def:
fp_uop fop f1 = Fp_uop fop f1
End
Definition fp_bop_def:
fp_bop fop f1 f2 = Fp_bop fop f1 f2
End
Definition fp_top_def:
fp_top fop f1 f2 f3 = Fp_top fop f1 f2 f3
End
val _ = export_theory()