 
 
 
 
 
 
 
  
In addition to its simplifier,  IMPS also provides a separate
mechanism for manipulating formal expressions by applying theorems.
Unlike simplification, it is under the control of the user.  The basic
idea is that some expression manipulation procedures--for instance,
conditional rewrite rules--are in fact direct applications of
theorems.  Other expression manipulation procedures can be formed from
existing ones using a simple combination language.  These expression
manipulation procedures are called macetes.14.1 Formally, a macete
is a function M which takes as arguments a context  and an
expression e (called the source expression) and returns
another expression
and an
expression e (called the source expression) and returns
another expression 
 (called the replacement expression).
In general, the replacement expression does not have to be equal to
the source expression.
(called the replacement expression).
In general, the replacement expression does not have to be equal to
the source expression.
Macetes serve two somewhat different purposes:
A macete can be atomic or compound. Compound macetes are obtained by applying a macete constructor to a list of one or more macetes.
Atomic macetes are classified as:
Macetes can be also classified according to the relation between the source and replacement expressions.
 
A schematic macete can be associated to any formula in two ways depending on the kind of matching procedure used. IMPS has two general forms of matching called expression matching and translation matching.
Let us consider first the case of expression matching. To any IMPS formula we can associate:
 
 where
where  itself is not a universal
formula. The patterns are extracted from
itself is not a universal
formula. The patterns are extracted from  depending on the form
of
depending on the form
of  as described by the following table:
as described by the following table:
| Form | Source | Replacement | Conditions | Spec. | 
|  | t1 | t2 |  | Bid. | 
|  | t1 | t2 |  | Bid. | 
|  |  |  |  | Bid. | 
|  |  |  | None | Back. | 
|  | t1 | t2 | None | Bid. | 
|  | t1 | t2 | None | Bid. | 
|  |  |  | None | Bid. | 
|  |  |  | None | Bid. | 
|  |  |  | None | Bid. | 
Notes
 according to the above
table is of sort
according to the above
table is of sort  and contains free variables
and contains free variables 
 not occurring freely in the source pattern
not occurring freely in the source pattern  then consider
instead the replacement pattern
then consider
instead the replacement pattern  
 are treated as single implications
are treated as single implications
 when applying the above table.
when applying the above table.
 if 
t2 contains free variables which do not occur freely in t1, then
consider instead the source pattern t1 = t2 or
if 
t2 contains free variables which do not occur freely in t1, then
consider instead the source pattern t1 = t2 or 
 and replacement pattern
and replacement pattern 
 or
or 
 
We now describe how a schematic macete M is obtained from the
source, replacement, condition patterns, and direction specifier of a
formula. Given a context  and an expression t, the result of
applying M to
and an expression t, the result of
applying M to  and t is determined as follows: Let
and t is determined as follows: Let  be the set of paths
be the set of paths 
 to subexpressions elof t which satisfy all of the following conditions:
to subexpressions elof t which satisfy all of the following conditions:
 such that
such that  applied to s gives el.
applied to s gives el.
 and all the formulas
and all the formulas 
 in the context
in the context  localized at the path l are called
the minor premises generated by the macete application.
These formulas may or may not generate applicability conditions:
localized at the path l are called
the minor premises generated by the macete application.
These formulas may or may not generate applicability conditions:
 satisfies the preceding conditions.
satisfies the preceding conditions.
 Macetes obtained in this way are called elementary macetes.
Macetes obtained in this way are called elementary macetes. 
Whenever you enter a theorem into a theory, the associated schematic macete is automatically installed, so that you can use it in deductions by hitting the key m.
The case of translation matching is similar, but instead of considering only convergence requirements, we need to insure that the translation component of the translation match is a theory interpretation. Macetes obtained in this way are called transportable macetes. The use of a theorem as a transportable macete must be entered into its usage list when the theorem is entered.
Frequently it is useful to construct a schematic macete from an arbitrary formula by using a matching and substitution procedure which does not obey the variable capturing protections and other restrictions of normal matching. We refer to this as nullary matching and substitution. For instance, to apply a theorem which involves quantification over functions, one often has to build a lambda-abstraction of a sub-expression. We shall see later on how this can be done.
Compound macetes are built from atomic macetes and other compound macetes using macete constructors. The constructors are:
 of macetes as arguments and yields a macete
of macetes as arguments and yields a macete 
 which applies every macete in the list
once, from left to right. Thus given a context
which applies every macete in the list
once, from left to right. Thus given a context  and an expression
e,
and an expression
e,  
 of macetes as arguments and yields a macete
of macetes as arguments and yields a macete 
 which applies macetes in the list from
left to right until a macete changes the expression. Thus given a
context
which applies macetes in the list from
left to right until a macete changes the expression. Thus given a
context  and an expression e,
and an expression e,  
 and
and 
 for all
for all 
 
 as arguments and yields a macete in the
following way: The series composition M of
as arguments and yields a macete in the
following way: The series composition M of 
 is
applied repeatedly to the expression e until no more change occurs.
It may possibly compute forever.  Thus the macete terminates if
is
applied repeatedly to the expression e until no more change occurs.
It may possibly compute forever.  Thus the macete terminates if
 
 
 and an expression e,
and an expression e, 
 is
is
 if
if 
 is 
alpha-equivalent to
is 
alpha-equivalent to 
 
Now whether the resulting macete is bidirectional or backward-directional, can be determined by considering the bidirectionality or backward-directionality each of the components.
 
 
Schematic macetes are for the most part installed by the system when theorems installed.
Macetes are also automatically built when atomic sort and constant definitions are made by the user.
constant-name-equation_theory-name.If the usage list of the definition includes the rewrite modifier and the defined constant is a function, the constant defining equation in applied form is also include as a macete named
constant-name-applied-equation_theory-name.
constant-name-equation_theory-name
definition-name-strong-minimality_theory-name
definition-name-minimality_theory-name
sort-name-defining-axiom_theory-name.
sort-name-in-quasi-sort_theory-nameand
sort-name-in-quasi-sort-domain_theory-name
Nondirectional schematic macetes usually are not associated to theorems. The form def-schematic-macete can be used for building schematic macetes of all kinds. You can build compound macetes using the form def-compound-macete.
A macete is ``applicable'' to a formula if applying the macete modifies the formula in some way. The only sure-fire way of determining whether a macete is applicable, is to actually apply the macete and see the result. However, there are simple heuristic conditions which can be used to quickly determine that some macetes are not applicable. For example, for an elementary bidirectional macete, if the left hand side of the macete does not match any subexpression of the formula, then clearly the macete it is not applicable. For transportable macetes other similar inapplicability conditions are used. Macetes are tabulated in such a way that it is possible to quickly throw out inapplicable ones using these heuristic conditions. IMPS exploits this to provide users with a dynamic help facility for selecting macetes. The use of this facility is explained more extensively in Chapter 4.
 
 
 
 
 
 
