4 Eisbach-aware variants of the "where" and "of" attributes. |
4 Eisbach-aware variants of the "where" and "of" attributes. |
5 |
5 |
6 Alternate syntax for rule_insts.ML participates in token closures by |
6 Alternate syntax for rule_insts.ML participates in token closures by |
7 examining the behaviour of Rule_Insts.where_rule and instantiating token |
7 examining the behaviour of Rule_Insts.where_rule and instantiating token |
8 values accordingly. Instantiations in re-interpretation are done with |
8 values accordingly. Instantiations in re-interpretation are done with |
9 Drule.cterm_instantiate. |
9 infer_instantiate. |
10 *) |
10 *) |
11 |
11 |
12 structure Eisbach_Rule_Insts: sig end = |
12 structure Eisbach_Rule_Insts: sig end = |
13 struct |
13 struct |
14 |
14 |
55 fun add_inst (xi, t) (Ts, ts) = |
55 fun add_inst (xi, t) (Ts, ts) = |
56 (case AList.lookup (op =) tyvars xi of |
56 (case AList.lookup (op =) tyvars xi of |
57 SOME S => (((xi, S), Thm.ctyp_of ctxt (Logic.dest_type t)) :: Ts, ts) |
57 SOME S => (((xi, S), Thm.ctyp_of ctxt (Logic.dest_type t)) :: Ts, ts) |
58 | NONE => |
58 | NONE => |
59 (case AList.lookup (op =) tvars xi of |
59 (case AList.lookup (op =) tvars xi of |
60 SOME T => (Ts, (Thm.cterm_of ctxt (Var (xi, T)), Thm.cterm_of ctxt t) :: ts) |
60 SOME _ => (Ts, (xi, Thm.cterm_of ctxt t) :: ts) |
61 | NONE => error "indexname not found in thm")); |
61 | NONE => error "indexname not found in thm")); |
62 |
62 |
63 val (cTinsts, cinsts) = fold add_inst insts ([], []); |
63 val (instT, inst) = fold add_inst insts ([], []); |
64 in |
64 in |
65 (Thm.instantiate (cTinsts, []) thm |
65 (Thm.instantiate (instT, []) thm |
66 |> Drule.cterm_instantiate cinsts |
66 |> infer_instantiate ctxt inst |
67 COMP_INCR asm_rl) |
67 COMP_INCR asm_rl) |
68 |> Thm.adjust_maxidx_thm ~1 |
68 |> Thm.adjust_maxidx_thm ~1 |
69 |> restore_tags thm |
69 |> restore_tags thm |
70 end; |
70 end; |
71 |
71 |