match_term :
term -> term -> (term,term) subst * (hol_type,hol_type) subst

SYNOPSIS
Finds instantiations to match one term to another.

DESCRIBE

When applied to two terms, match_term attempts to find a set of type and term instantiations for the first term (only) to make it alpha-convertible to the second. If it succeeds, it returns the instantiations in the form of a pair containing a term substitution and a type substitution. If the first term represents the conclusion of a theorem, the returned instantiations are of the appropriate form to be passed to INST_TY_TERM.

FAILURE
Fails if the term cannot be matched by one-way instantiation.

EXAMPLE
The following shows how match_term could be used to match the conclusion of a theorem to a term.
   - val th = REFL ``x:'a``;
   th = |- x = x

   - match_term (concl th) ``1 = 1``;
   val it = ([{redex = ``x``, residue = ``1``}],
             [{redex = ``:'a``, residue= ``:num``}])
     : term subst * hol_type subst

  - INST_TY_TERM it th;
  val it = |- 1 = 1

COMMENTS
Note that there is no guarantee that the returned instantiations will be possible for INST_TY_TERM to achieve, because some of the variables (term or type) which need to be instantiated may be free in the assumptions, eg:
   - (show_types := true; show_assums := true);
   () : unit

   - val th = ASSUME ``x:'a = x``;
   val th = [(x :'a) = (x :'a)] |- (x :'a) = (x :'a) : thm

   - match_term (concl th) (--`1 = 1`--);
   val it = ([{redex = ``x :num``, residue = ``1``}],
             [{redex = ``:'a``, residue = ``:num``}])
     : term subst * hol_type subst

   - INST_TY_TERM it th handle e => Raise e;
   Exception raised at Thm.INST_TYPE:
   type variable(s) in assumptions would be instantiated in concl

In fact, for instantiating a theorem, PART_MATCH is usually easier.

SEEALSO  match_type,   INST_TY_TERM,   PART_MATCH

HOL  Kananaskis 0