Function: defrule (<rulename>, <pattern>, <replacement>) Defines and names a replacement rule for the given pattern. If the rule named <rulename> is applied to an expression (by
apply2), every subexpression matching the pattern will be replaced by the replacement. All variables in the replacement which have been assigned values by the pattern match are assigned those values in the replacement which is then simplified.
The rules themselves can be treated as functions which transform an expression by one operation of the pattern match and replacement. If the match fails, the rule function returns
(%o1) true (%i2)