\DOC match \TYPE {Compat.match : term -> term -> ((term*term) list * (hol_type*hol_type) list)} \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 equal 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. It is also not apt to be useful unless {Old_syntax} is open, since the substitutions that {match} produces are not of the right type for the hol90 routines that use substitutions, like {subst} for instance. \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 (concl th) (--`1 = 1`--); val it = ([((--`1`--),(--`x`--))], [((==`:num`==),(==`:'a`==))]) : term subst * hol_type subst - INST_TY_TERM it th; |- 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 = ([((--`1`--),(--`x`--))], [((==`:num`==),(==`:'a`==))]) : term subst * hol_type subst - Old_syntax.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. Why is {match} in Compat? Because {match} is not provided in hol90; the more accurate name {match_term} is used. Also, hol90 provides {match_type}. \SEEALSO INST_TY_TERM, PART_MATCH. \ENDDOC