gen_find_terms : (term list * term -> 'a option) -> term -> 'a list
The additional list of terms passed to the function f is the list of bound variables “governing” the sub-term in question, with the innermost bound variable first in the list.
> gen_find_terms (fn x => SOME x) ``SUC x``;
val it =
[([], ``x``), ([], ``SUC``), ([], ``SUC x``)]:
(term list * term) list
> gen_find_terms
(fn (bvs,t) => if null bvs andalso
(is_var t orelse numSyntax.is_numeral t)
then
Lib.total (match_term ``x:num``) t
else NONE)
``SUC z + (\y. y) 5``;
val it =
[([{redex = ``x``, residue = ``5``}], []),
([{redex = ``x``, residue = ``z``}], [])]:
((term, term) Term.subst * (hol_type, hol_type) Term.subst) list