| 1 |
needs "Formal_ineqs/trig/atn_eval.hl";; |
| 2 |
needs "arith/float_atn.hl";; |
| 3 |
|
| 4 |
open Misc_functions;; |
| 5 |
open Arith_float;; |
| 6 |
open More_float;; |
| 7 |
open Poly;; |
| 8 |
|
| 9 |
let x_th = (REWRITE_RULE[real_zero] o RULE o ASSUME) `interval_arith x (&2, &3)`;; |
| 10 |
|
| 11 |
|
| 12 |
let th1 = Float_atn.float_interval_atn 5 x_th;; |
| 13 |
let th2 = Atn_eval.float_interval_atn 5 x_th;; |
| 14 |
|
| 15 |
(* 10: 3.243 *) |
| 16 |
test 100 (Float_atn.float_interval_atn 5) x_th;; |
| 17 |
(* 10: 4.626 *) |
| 18 |
test 100 (Atn_eval.float_interval_atn 5) x_th;; |
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
(*****************************) |
| 24 |
|
| 25 |
let float_interval_1 = mk_float_interval_small_num 1;; |
| 26 |
|
| 27 |
let HALFATN' = (SYM o SPEC_ALL o REWRITE_RULE[REAL_POW_2]) halfatn;; |
| 28 |
let HALFATN4' = prove(`halfatn(halfatn(halfatn(halfatn x))) = halfatn4 x`, |
| 29 |
REWRITE_TAC[halfatn4; o_THM]);; |
| 30 |
|
| 31 |
let float_interval_halfatn pp x_th = |
| 32 |
let x_tm = (rand o rator o concl) x_th in |
| 33 |
let xx_th = float_interval_mul pp x_th x_th in |
| 34 |
let one_xx_th = float_interval_add pp float_interval_1 xx_th in |
| 35 |
let sqrt_th = float_interval_sqrt pp one_xx_th in |
| 36 |
let one_sqrt_th = float_interval_add pp sqrt_th float_interval_1 in |
| 37 |
let r_th = float_interval_div pp x_th one_sqrt_th in |
| 38 |
let th0 = INST[x_tm, x_var_real] HALFATN' in |
| 39 |
let ltm, rtm = dest_comb(concl r_th) in |
| 40 |
EQ_MP (AP_THM (AP_TERM (rator ltm) th0) rtm) r_th;; |
| 41 |
|
| 42 |
let float_interval_halfatn4 pp x_th = |
| 43 |
let x_tm = (rand o rator o concl) x_th in |
| 44 |
let r_th = float_interval_halfatn pp |
| 45 |
(float_interval_halfatn pp |
| 46 |
(float_interval_halfatn pp (float_interval_halfatn pp x_th))) in |
| 47 |
let th0 = INST[x_tm, x_var_real] HALFATN4' in |
| 48 |
let ltm, rtm = dest_comb(concl r_th) in |
| 49 |
EQ_MP (AP_THM (AP_TERM (rator ltm) th0) rtm) r_th;; |
| 50 |
|
| 51 |
|
| 52 |
(****************************) |
| 53 |
|
| 54 |
let y_th = (REWRITE_RULE[real_zero] o RULE o ASSUME) `interval_arith y (real_zero, &3)`;; |
| 55 |
let z_th = (REWRITE_RULE[real_zero] o RULE o ASSUME) `interval_arith (&2) (real_zero, z)`;; |
| 56 |
let x_th = (REWRITE_RULE[real_zero] o RULE o ASSUME) `interval_arith x (&2, &3)`;; |
| 57 |
|
| 58 |
(* 0.4805, 0.92708 *) |
| 59 |
float_interval_halfatn 5 x_th;; |
| 60 |
(* 0.61802 *) |
| 61 |
eval_halfatn_pos_lo 5 z_th;; |
| 62 |
(* 0.72078 *) |
| 63 |
eval_halfatn_pos_hi 5 y_th;; |
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
(* 10: 2.171 *) |
| 68 |
test 1000 (eval_halfatn_pos_hi 5) y_th;; |
| 69 |
(* 10: 2.109 *) |
| 70 |
test 1000 (eval_halfatn_pos_lo 5) z_th;; |
| 71 |
(* 10: 4.140 *) |
| 72 |
test 1000 (float_interval_halfatn 5) x_th;; |
| 73 |
|
| 74 |
|
| 75 |
(* 0.048011, 0.10853 *) |
| 76 |
float_interval_halfatn4 5 x_th;; |
| 77 |
(* 0.069298 *) |
| 78 |
eval_halfatn4_pos_lo 5 z_th;; |
| 79 |
(* 0.078238 *) |
| 80 |
eval_halfatn4_pos_hi 5 y_th;; |
| 81 |
|
| 82 |
(* 10: 1.202 *) |
| 83 |
test 100 (eval_halfatn4_pos_lo 5) z_th;; |
| 84 |
(* 10: 1.194 *) |
| 85 |
test 100 (eval_halfatn4_pos_hi 5) y_th;; |
| 86 |
(* 10: 2.308 *) |
| 87 |
test 100 (float_interval_halfatn4 5) x_th;; |
| 88 |
|
| 89 |
|