pvariant.doc

advertisement
\DOC pvariant
\TYPE {pvariant : (term list -> term -> term)}
\LIBRARY pair
\SYNOPSIS
Modifies variable and constant names in a paired structure to avoid
clashes.
\DESCRIBE
When applied to a list of (possibly paired structures of) variables to
avoid
clashing with, and a pair to modify, {pvariant} returns a variant of the
pair.
That is, it changes the names of variables and constants in the pair as
intuitively as possible to make them distinct from any variables in the
list,
or any (non-hidden) constants.
This is normally done by adding primes to the names.
The exact form of the altered names should
except that the original variables will be
are in the list to avoid clashing with.
Also note that if the same variable occurs
then each instance of the variable will be
not be relied on,
unmodified unless they
more that one in the pair,
modified in the same way.
\FAILURE
{pvariant l p} fails if any term in the list {l} is not a paired
structure of
variables, or if {p} is not a paired structure of variables and
constants.
\EXAMPLE
The following shows a case that exhibits most possible behaviours:
{
#pvariant ["b:*"; "(c:*,c':*)"] "((a:*,b:*),(c:*,b':*,T,b:*))";;
"(a,b''),c'',b',T',b''" : term
}
\USES
The function {pvariant} is extremely useful for complicated derived rules
which
need to rename pairs variable to avoid free variable capture while still
making the role of the pair obvious to the user.
\SEEALSO
variant, genvar, hide_constant, genlike.
\ENDDOC
Download