Datasets:

Modalities:
Text
Languages:
English
Libraries:
Datasets
License:
File size: 1,830 Bytes
4365a98
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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


(* PUT BASIC ARITHMETIC OF THE NATURALS INTO THE SIMPLIFIER *)

(* based on NUM_RED_CONV in num_calc *)

let arith_ss thml  = itlist (fun (x,y) ss -> ss_of_conv x y ss)
    [`SUC(NUMERAL n)`,NUM_SUC_CONV;
     `PRE(NUMERAL n)`,NUM_PRE_CONV;
     `FACT(NUMERAL n)`,NUM_FACT_CONV;
     `NUMERAL m < NUMERAL n`,NUM_REL_CONV;
     `NUMERAL m <= NUMERAL n`,NUM_REL_CONV;
     `NUMERAL m > NUMERAL n`,NUM_REL_CONV;
     `NUMERAL m >= NUMERAL n`,NUM_REL_CONV;
     `NUMERAL m = NUMERAL n`,NUM_REL_CONV;
     `EVEN(NUMERAL n)`,NUM_EVEN_CONV;
     `ODD(NUMERAL n)`,NUM_ODD_CONV;
     `NUMERAL m + NUMERAL n`,NUM_ADD_CONV;
     `NUMERAL m - NUMERAL n`,NUM_SUB_CONV;
     `NUMERAL m * NUMERAL n`,NUM_MULT_CONV;
     `(NUMERAL m) EXP (NUMERAL n)`,NUM_EXP_CONV;
     `(NUMERAL m) DIV (NUMERAL n)`,NUM_DIV_CONV;
     `(NUMERAL m) MOD (NUMERAL n)`,NUM_MOD_CONV]
    (basic_ss thml);;

let ARITH_SIMP_CONV thl = SIMPLIFY_CONV (arith_ss []) thl;;

let arith_net() = itlist (uncurry net_of_conv)
    [`SUC(NUMERAL n)`,NUM_SUC_CONV;
     `PRE(NUMERAL n)`,NUM_PRE_CONV;
     `FACT(NUMERAL n)`,NUM_FACT_CONV;
     `NUMERAL m < NUMERAL n`,NUM_REL_CONV;
     `NUMERAL m <= NUMERAL n`,NUM_REL_CONV;
     `NUMERAL m > NUMERAL n`,NUM_REL_CONV;
     `NUMERAL m >= NUMERAL n`,NUM_REL_CONV;
     `NUMERAL m = NUMERAL n`,NUM_REL_CONV;
     `EVEN(NUMERAL n)`,NUM_EVEN_CONV;
     `ODD(NUMERAL n)`,NUM_ODD_CONV;
     `NUMERAL m + NUMERAL n`,NUM_ADD_CONV;
     `NUMERAL m - NUMERAL n`,NUM_SUB_CONV;
     `NUMERAL m * NUMERAL n`,NUM_MULT_CONV;
     `(NUMERAL m) EXP (NUMERAL n)`,NUM_EXP_CONV;
     `(NUMERAL m) DIV (NUMERAL n)`,NUM_DIV_CONV;
     `(NUMERAL m) MOD (NUMERAL n)`,NUM_MOD_CONV]
    (basic_net());;

let ARITH_REWRITE_CONV thl =
  GENERAL_REWRITE_CONV true TOP_DEPTH_CONV (arith_net()) thl;;

let ARITH_SIMP_TAC thl = CONV_TAC (ARITH_SIMP_CONV thl);;