4 Copyright 1997 University of Cambridge |
4 Copyright 1997 University of Cambridge |
5 |
5 |
6 Emulation of HOL inference rules for TFL |
6 Emulation of HOL inference rules for TFL |
7 *) |
7 *) |
8 |
8 |
9 structure FastRules : Rules_sig = |
9 structure Rules : Rules_sig = |
10 struct |
10 struct |
11 |
11 |
12 open Utils; |
12 open Utils; |
13 |
13 |
14 structure USyntax = USyntax; |
14 structure USyntax = USyntax; |
15 structure S = USyntax; |
15 structure S = USyntax; |
16 structure U = Utils; |
16 structure U = Utils; |
17 structure D = Dcterm; |
17 structure D = Dcterm; |
18 |
18 |
19 |
19 |
20 fun RULES_ERR{func,mesg} = Utils.ERR{module = "FastRules",func=func,mesg=mesg}; |
20 fun RULES_ERR{func,mesg} = Utils.ERR{module = "Rules",func=func,mesg=mesg}; |
21 |
21 |
22 |
22 |
23 fun cconcl thm = D.drop_prop(#prop(crep_thm thm)); |
23 fun cconcl thm = D.drop_prop(#prop(crep_thm thm)); |
24 fun chyps thm = map D.drop_prop(#hyps(crep_thm thm)); |
24 fun chyps thm = map D.drop_prop(#hyps(crep_thm thm)); |
25 |
25 |
500 | (vlist,body) => |
500 | (vlist,body) => |
501 let val eq = Logic.strip_imp_concl body |
501 let val eq = Logic.strip_imp_concl body |
502 val (f,args) = S.strip_comb (get_lhs eq) |
502 val (f,args) = S.strip_comb (get_lhs eq) |
503 val (vstrl,_) = S.strip_abs f |
503 val (vstrl,_) = S.strip_abs f |
504 val names = map (#1 o dest_Free) |
504 val names = map (#1 o dest_Free) |
505 (variants (S.free_vars body) vstrl) |
505 (variants (term_frees body) vstrl) |
506 in get (rst, n+1, (names,n)::L) |
506 in get (rst, n+1, (names,n)::L) |
507 end handle _ => get (rst, n+1, L); |
507 end handle _ => get (rst, n+1, L); |
508 |
508 |
509 (* Note: rename_params_rule counts from 1, not 0 *) |
509 (* Note: rename_params_rule counts from 1, not 0 *) |
510 fun rename thm = |
510 fun rename thm = |
748 let val dummy = say "restrict_prover:\n" |
748 let val dummy = say "restrict_prover:\n" |
749 val cntxt = rev(prems_of_mss mss) |
749 val cntxt = rev(prems_of_mss mss) |
750 val dummy = print_thms "cntxt:\n" cntxt |
750 val dummy = print_thms "cntxt:\n" cntxt |
751 val {prop = Const("==>",_) $ (Const("Trueprop",_) $ A) $ _, |
751 val {prop = Const("==>",_) $ (Const("Trueprop",_) $ A) $ _, |
752 sign,...} = rep_thm thm |
752 sign,...} = rep_thm thm |
753 fun genl tm = let val vlist = U.set_diff (curry(op aconv)) |
753 fun genl tm = let val vlist = gen_rems (op aconv) |
754 (add_term_frees(tm,[])) [func,R] |
754 (add_term_frees(tm,[]), [func,R]) |
755 in U.itlist Forall vlist tm |
755 in U.itlist Forall vlist tm |
756 end |
756 end |
757 (*-------------------------------------------------------------- |
757 (*-------------------------------------------------------------- |
758 * This actually isn't quite right, since it will think that |
758 * This actually isn't quite right, since it will think that |
759 * not-fully applied occs. of "f" in the context mean that the |
759 * not-fully applied occs. of "f" in the context mean that the |