raw_match : hol_type list -> term set -> term -> term -> (term,term) subst * ((hol_type,hol_type) subst * hol_type list) -> (term,term) subst * ((hol_type,hol_type) subst * hol_type list)
aconv (subst S' (inst T pat)) ob.
The pair (tmS,tyS) is an accumulator argument. This allows raw_match to be folded through lists of terms to be matched. (S,T) must agree with (tmS,tyS). This means that if there is a {redex,residue} in S and also a {redex,residue} in tmS so that both redex fields are equal, then the residue fields must be alpha-convertible. Similarly for types: if there is a {redex,residue} in T and also a {redex,residue} in tyS so that both redex fields are equal, then the residue fields must also be equal. If these conditions hold, then the result (S,T) includes (tmS,tyS).
- val (S,T) = raw_match [] empty_varset (Term `\x:'a. x = f (y:'b)`) (Term `\a. a = ~p`) ([],([],[])); > val S = [{redex = `(f :'b -> 'a)`, residue = `$~`}, {redex = `(y :'b)`, residue = `(p :bool)`}] : ... val T = ([{redex = `:'b`, residue = `:bool`}, {redex = `:'a`, residue = `:bool`}], []) : ...
The returned type substitution T has two components (T1,T2). T1 is a substitution, and T2 is a list of type variables, encountered in the matching process, which have matched to themselves. These identity matches are held in the separate list T2 for obscure reasons. Once matching is finished, they can be ignored (which is why they are held on a separate list).