17 val sym : thm (* a=b ==> b=a *) |
17 val sym : thm (* a=b ==> b=a *) |
18 end; |
18 end; |
19 |
19 |
20 signature HYPSUBST = |
20 signature HYPSUBST = |
21 sig |
21 sig |
22 val bound_hyp_subst_tac : int -> tactic |
22 val bound_hyp_subst_tac : Proof.context -> int -> tactic |
23 val hyp_subst_tac : int -> tactic |
23 val hyp_subst_tac : Proof.context -> int -> tactic |
24 (*exported purely for debugging purposes*) |
24 (*exported purely for debugging purposes*) |
25 val eq_var : bool -> term -> int * thm |
25 val eq_var : bool -> term -> int * thm |
26 val inspect_pair : bool -> term * term -> thm |
26 val inspect_pair : bool -> term * term -> thm |
27 end; |
27 end; |
28 |
28 |
66 | eq_var_aux k _ = raise EQ_VAR |
66 | eq_var_aux k _ = raise EQ_VAR |
67 in eq_var_aux 0 end; |
67 in eq_var_aux 0 end; |
68 |
68 |
69 (*Select a suitable equality assumption and substitute throughout the subgoal |
69 (*Select a suitable equality assumption and substitute throughout the subgoal |
70 Replaces only Bound variables if bnd is true*) |
70 Replaces only Bound variables if bnd is true*) |
71 fun gen_hyp_subst_tac bnd = SUBGOAL(fn (Bi,i) => |
71 fun gen_hyp_subst_tac bnd ctxt = SUBGOAL(fn (Bi,i) => |
72 let val n = length(Logic.strip_assums_hyp Bi) - 1 |
72 let val n = length(Logic.strip_assums_hyp Bi) - 1 |
73 val (k,symopt) = eq_var bnd Bi |
73 val (k,symopt) = eq_var bnd Bi |
74 in |
74 in |
75 DETERM |
75 DETERM |
76 (EVERY [REPEAT_DETERM_N k (etac rev_mp i), |
76 (EVERY [REPEAT_DETERM_N k (eresolve_tac ctxt [rev_mp] i), |
77 etac revcut_rl i, |
77 eresolve_tac ctxt [revcut_rl] i, |
78 REPEAT_DETERM_N (n-k) (etac rev_mp i), |
78 REPEAT_DETERM_N (n-k) (eresolve_tac ctxt [rev_mp] i), |
79 etac (symopt RS subst) i, |
79 eresolve_tac ctxt [symopt RS subst] i, |
80 REPEAT_DETERM_N n (rtac imp_intr i)]) |
80 REPEAT_DETERM_N n (resolve_tac ctxt [imp_intr] i)]) |
81 end |
81 end |
82 handle THM _ => no_tac | EQ_VAR => no_tac); |
82 handle THM _ => no_tac | EQ_VAR => no_tac); |
83 |
83 |
84 (*Substitutes for Free or Bound variables*) |
84 (*Substitutes for Free or Bound variables*) |
85 val hyp_subst_tac = gen_hyp_subst_tac false; |
85 val hyp_subst_tac = gen_hyp_subst_tac false; |