src/Provers/hypsubst.ML
changeset 4223 f60e3d2c81d3
parent 4179 cc4b6791d5dc
child 4299 22596d62ce0b
equal deleted inserted replaced
4222:d7573d6d0513 4223:f60e3d2c81d3
     1 (*  Title: 	Provers/hypsubst
     1 (*  Title: 	Provers/hypsubst
     2     ID:         $Id$
     2     ID:         $Id$
     3     Authors: 	Martin D Coen, Tobias Nipkow and Lawrence C Paulson
     3     Authors: 	Martin D Coen, Tobias Nipkow and Lawrence C Paulson
     4     Copyright   1995  University of Cambridge
     4     Copyright   1995  University of Cambridge
     5 
     5 
     6 Tactic to substitute using the assumption x=t in the rest of the subgoal,
     6 Tactic to substitute using (at least) the assumption x=t in the rest of the 
     7 and to delete that assumption.  Original version due to Martin Coen.
     7 subgoal, and to delete (at least) that assumption. 
       
     8 Original version due to Martin Coen.
     8 
     9 
     9 This version uses the simplifier, and requires it to be already present.
    10 This version uses the simplifier, and requires it to be already present.
    10 
    11 
    11 Test data:
    12 Test data:
    12 
    13 
    29   val eq_reflection    : thm		   (* a=b ==> a==b *)
    30   val eq_reflection    : thm		   (* a=b ==> a==b *)
    30   val imp_intr	       : thm		   (* (P ==> Q) ==> P-->Q *)
    31   val imp_intr	       : thm		   (* (P ==> Q) ==> P-->Q *)
    31   val rev_mp	       : thm		   (* [| P;  P-->Q |] ==> Q *)
    32   val rev_mp	       : thm		   (* [| P;  P-->Q |] ==> Q *)
    32   val subst	       : thm		   (* [| a=b;  P(a) |] ==> P(b) *)
    33   val subst	       : thm		   (* [| a=b;  P(a) |] ==> P(b) *)
    33   val sym	       : thm		   (* a=b ==> b=a *)
    34   val sym	       : thm		   (* a=b ==> b=a *)
    34   end;
    35   val thin_refl        : thm               (* [|x=x; PROP W|] ==> PROP W *)
       
    36 end;
    35 
    37 
    36 
    38 
    37 signature HYPSUBST =
    39 signature HYPSUBST =
    38   sig
    40   sig
    39   val bound_hyp_subst_tac    : int -> tactic
    41   val bound_hyp_subst_tac    : int -> tactic
   172 		   REPEAT_DETERM_N n (rtac imp_intr i THEN rotate_tac ~1 i)])
   174 		   REPEAT_DETERM_N n (rtac imp_intr i THEN rotate_tac ~1 i)])
   173       end
   175       end
   174       handle THM _ => no_tac | EQ_VAR => no_tac);
   176       handle THM _ => no_tac | EQ_VAR => no_tac);
   175 
   177 
   176 (*Substitutes for Free or Bound variables*)
   178 (*Substitutes for Free or Bound variables*)
   177 val hyp_subst_tac = 
   179 val hyp_subst_tac = FIRST' [ematch_tac [thin_refl],
   178     gen_hyp_subst_tac false ORELSE' vars_gen_hyp_subst_tac false;
   180         gen_hyp_subst_tac false, vars_gen_hyp_subst_tac false];
   179 
   181 
   180 (*Substitutes for Bound variables only -- this is always safe*)
   182 (*Substitutes for Bound variables only -- this is always safe*)
   181 val bound_hyp_subst_tac = 
   183 val bound_hyp_subst_tac = 
   182     gen_hyp_subst_tac true ORELSE' vars_gen_hyp_subst_tac true;
   184     gen_hyp_subst_tac true ORELSE' vars_gen_hyp_subst_tac true;
   183 
   185