1 (*********************************)
\r
2 (* The natural number arithmetic *)
\r
3 (*********************************)
\r
6 needs "../formal_lp/arith/arith_options.hl";;
\r
7 needs "../formal_lp/arith/arith_cache.hl";;
\r
9 module Arith_nat = struct
\r
11 open Arith_options;;
\r
14 let mk_small_numeral_array = Arith_hash.mk_small_numeral_array;;
\r
15 let mk_numeral_array = Arith_hash.mk_numeral_array;;
\r
16 let NUMERAL_TO_NUM_CONV = Arith_hash.NUMERAL_TO_NUM_CONV;;
\r
17 let NUM_TO_NUMERAL_CONV = Arith_hash.NUM_TO_NUMERAL_CONV;;
\r
20 let raw_dest_hash = Arith_hash.raw_dest_hash;;
\r
23 let raw_suc_conv_hash =
\r
24 if cached then Arith_cache.raw_suc_conv_hash else Arith_hash.raw_suc_conv_hash;;
\r
26 let NUM_SUC_HASH_CONV = Arith_hash.NUM_SUC_HASH_CONV;;
\r
29 let raw_eq0_hash_conv =
\r
30 if cached then Arith_cache.raw_eq0_hash_conv else Arith_hash.raw_eq0_hash_conv;;
\r
32 let NUM_EQ0_HASH_CONV = Arith_hash.NUM_EQ0_HASH_CONV;;
\r
35 let raw_pre_hash_conv =
\r
36 if cached then Arith_cache.raw_pre_hash_conv else Arith_hash.raw_pre_hash_conv;;
\r
38 let NUM_PRE_HASH_CONV = Arith_hash.NUM_PRE_HASH_CONV;;
\r
41 let raw_gt0_hash_conv =
\r
42 if cached then Arith_cache.raw_gt0_hash_conv else Arith_hash.raw_gt0_hash_conv;;
\r
44 let NUM_GT0_HASH_CONV = Arith_hash.NUM_GT0_HASH_CONV;;
\r
47 let raw_lt_hash_conv =
\r
48 if cached then Arith_cache.raw_lt_hash_conv else Arith_hash.raw_lt_hash_conv;;
\r
50 let raw_le_hash_conv =
\r
51 if cached then Arith_cache.raw_le_hash_conv else Arith_hash.raw_le_hash_conv;;
\r
53 let NUM_LT_HASH_CONV = Arith_hash.NUM_LT_HASH_CONV;;
\r
55 let NUM_LE_HASH_CONV = Arith_hash.NUM_LE_HASH_CONV;;
\r
58 let raw_add_conv_hash =
\r
59 if cached then Arith_cache.raw_add_conv_hash else Arith_hash.raw_add_conv_hash;;
\r
61 let NUM_ADD_HASH_CONV = Arith_hash.NUM_ADD_HASH_CONV;;
\r
64 let raw_sub_hash_conv =
\r
65 if cached then Arith_cache.raw_sub_hash_conv else Arith_hash.raw_sub_hash_conv;;
\r
67 let raw_sub_and_le_hash_conv =
\r
68 if cached then Arith_cache.raw_sub_and_le_hash_conv else Arith_hash.raw_sub_and_le_hash_conv;;
\r
70 let NUM_SUB_HASH_CONV = Arith_hash.NUM_SUB_HASH_CONV;;
\r
73 let raw_mul_conv_hash =
\r
74 if cached then Arith_cache.raw_mul_conv_hash else Arith_hash.raw_mul_conv_hash;;
\r
76 let NUM_MULT_HASH_CONV = Arith_hash.NUM_MULT_HASH_CONV;;
\r
79 let raw_div_hash_conv =
\r
80 if cached then Arith_cache.raw_div_hash_conv else Arith_hash.raw_div_hash_conv;;
\r
82 let NUM_DIV_HASH_CONV = Arith_hash.NUM_DIV_HASH_CONV;;
\r
85 let raw_even_hash_conv =
\r
86 if cached then Arith_cache.raw_even_hash_conv else Arith_hash.raw_even_hash_conv;;
\r
88 let raw_odd_hash_conv =
\r
89 if cached then Arith_cache.raw_odd_hash_conv else Arith_hash.raw_odd_hash_conv;;
\r
91 let NUM_EVEN_HASH_CONV = Arith_hash.NUM_EVEN_HASH_CONV;;
\r
93 let NUM_ODD_HASH_CONV = Arith_hash.NUM_ODD_HASH_CONV;;
\r
96 let NUMERALS_TO_NUM =
\r
97 PURE_REWRITE_RULE[Arith_hash.NUM_THM] o CONV_RULE (DEPTH_CONV NUMERAL_TO_NUM_CONV);;
\r