| 1 |
(* ========================================================================== *) |
| 2 |
(* Formal verification of nonlinear inequalities in HOL Light *) |
| 3 |
(* *) |
| 4 |
(* Copyright (c) 2012 Alexey Solovyev *) |
| 5 |
(* *) |
| 6 |
(* This file is distributed under the terms of the MIT licence *) |
| 7 |
(* ========================================================================== *) |
| 8 |
|
| 9 |
(* -------------------------------------------------------------------------- *) |
| 10 |
(* Formal natural number arithmetic *) |
| 11 |
(* -------------------------------------------------------------------------- *) |
| 12 |
|
| 13 |
(* Dependencies *) |
| 14 |
needs "Formal_ineqs/arith_options.hl";; |
| 15 |
needs "Formal_ineqs/arith/arith_cache.hl";; |
| 16 |
|
| 17 |
module Arith_nat = struct |
| 18 |
|
| 19 |
open Arith_options;; |
| 20 |
|
| 21 |
(* mk *) |
| 22 |
let mk_small_numeral_array = Arith_num.mk_small_numeral_array;; |
| 23 |
let mk_numeral_array = Arith_num.mk_numeral_array;; |
| 24 |
let NUMERAL_TO_NUM_CONV = Arith_num.NUMERAL_TO_NUM_CONV;; |
| 25 |
let NUM_TO_NUMERAL_CONV = Arith_num.NUM_TO_NUMERAL_CONV;; |
| 26 |
|
| 27 |
(* dest *) |
| 28 |
let raw_dest_hash = Arith_num.raw_dest_hash;; |
| 29 |
|
| 30 |
(* SUC *) |
| 31 |
let raw_suc_conv_hash = |
| 32 |
if !cached then Arith_cache.raw_suc_conv_hash else Arith_num.raw_suc_conv_hash;; |
| 33 |
|
| 34 |
let NUM_SUC_HASH_CONV = Arith_num.NUM_SUC_HASH_CONV;; |
| 35 |
|
| 36 |
(* x = 0 *) |
| 37 |
let raw_eq0_hash_conv = |
| 38 |
if !cached then Arith_cache.raw_eq0_hash_conv else Arith_num.raw_eq0_hash_conv;; |
| 39 |
|
| 40 |
let NUM_EQ0_HASH_CONV = Arith_num.NUM_EQ0_HASH_CONV;; |
| 41 |
|
| 42 |
(* PRE *) |
| 43 |
let raw_pre_hash_conv = |
| 44 |
if !cached then Arith_cache.raw_pre_hash_conv else Arith_num.raw_pre_hash_conv;; |
| 45 |
|
| 46 |
let NUM_PRE_HASH_CONV = Arith_num.NUM_PRE_HASH_CONV;; |
| 47 |
|
| 48 |
(* x > 0 *) |
| 49 |
let raw_gt0_hash_conv = |
| 50 |
if !cached then Arith_cache.raw_gt0_hash_conv else Arith_num.raw_gt0_hash_conv;; |
| 51 |
|
| 52 |
let NUM_GT0_HASH_CONV = Arith_num.NUM_GT0_HASH_CONV;; |
| 53 |
|
| 54 |
(* x = y *) |
| 55 |
let raw_eq_hash_conv = Arith_num.raw_eq_hash_conv;; |
| 56 |
let NUM_EQ_HASH_CONV = Arith_num.NUM_EQ_HASH_CONV;; |
| 57 |
|
| 58 |
(* x < y, x <= y *) |
| 59 |
let raw_lt_hash_conv = |
| 60 |
if !cached then Arith_cache.raw_lt_hash_conv else Arith_num.raw_lt_hash_conv;; |
| 61 |
|
| 62 |
let raw_le_hash_conv = |
| 63 |
if !cached then Arith_cache.raw_le_hash_conv else Arith_num.raw_le_hash_conv;; |
| 64 |
|
| 65 |
let NUM_LT_HASH_CONV = Arith_num.NUM_LT_HASH_CONV;; |
| 66 |
|
| 67 |
let NUM_LE_HASH_CONV = Arith_num.NUM_LE_HASH_CONV;; |
| 68 |
|
| 69 |
(* x + y *) |
| 70 |
let raw_add_conv_hash = |
| 71 |
if !cached then Arith_cache.raw_add_conv_hash else Arith_num.raw_add_conv_hash;; |
| 72 |
|
| 73 |
let NUM_ADD_HASH_CONV = Arith_num.NUM_ADD_HASH_CONV;; |
| 74 |
|
| 75 |
(* x - y *) |
| 76 |
let raw_sub_hash_conv = |
| 77 |
if !cached then Arith_cache.raw_sub_hash_conv else Arith_num.raw_sub_hash_conv;; |
| 78 |
|
| 79 |
let raw_sub_and_le_hash_conv = |
| 80 |
if !cached then Arith_cache.raw_sub_and_le_hash_conv else Arith_num.raw_sub_and_le_hash_conv;; |
| 81 |
|
| 82 |
let NUM_SUB_HASH_CONV = Arith_num.NUM_SUB_HASH_CONV;; |
| 83 |
|
| 84 |
(* x * y *) |
| 85 |
let raw_mul_conv_hash = |
| 86 |
if !cached then Arith_cache.raw_mul_conv_hash else Arith_num.raw_mul_conv_hash;; |
| 87 |
|
| 88 |
let NUM_MULT_HASH_CONV = Arith_num.NUM_MULT_HASH_CONV;; |
| 89 |
|
| 90 |
(* x / y *) |
| 91 |
let raw_div_hash_conv = |
| 92 |
if !cached then Arith_cache.raw_div_hash_conv else Arith_num.raw_div_hash_conv;; |
| 93 |
|
| 94 |
let NUM_DIV_HASH_CONV = Arith_num.NUM_DIV_HASH_CONV;; |
| 95 |
|
| 96 |
(* EVEN, ODD *) |
| 97 |
let raw_even_hash_conv = |
| 98 |
if !cached then Arith_cache.raw_even_hash_conv else Arith_num.raw_even_hash_conv;; |
| 99 |
|
| 100 |
let raw_odd_hash_conv = |
| 101 |
if !cached then Arith_cache.raw_odd_hash_conv else Arith_num.raw_odd_hash_conv;; |
| 102 |
|
| 103 |
let NUM_EVEN_HASH_CONV = Arith_num.NUM_EVEN_HASH_CONV;; |
| 104 |
|
| 105 |
let NUM_ODD_HASH_CONV = Arith_num.NUM_ODD_HASH_CONV;; |
| 106 |
|
| 107 |
|
| 108 |
let NUMERALS_TO_NUM = |
| 109 |
PURE_REWRITE_RULE[Arith_num.NUM_THM] o CONV_RULE (DEPTH_CONV NUMERAL_TO_NUM_CONV);; |
| 110 |
|
| 111 |
|
| 112 |
end;; |