On 2/2/08, Edwin Woollett <woollett at charter.net> wrote:
> (%i5) matchdeclare(m,integerp);
> (%o5) done
> (%i6) matchdeclare(m,is(m>4) );
> (%o6) done
Only the last matchdeclare is significant --- any previous declarations are
thrown away. Also, the predicate has to be the name of a function,
a lambda expression, or a function call missing its final argument
e.g. freeof(x) which is called as freeof(x, some_expr) when the rule is
attempted. matchdeclare doesn't automatically construct a function from
a general expression such as is(m > 4).
You could write the rule for exponent > 4 like this:
matchdeclare (foo, lambda ([e], integerp(e) and e > 4));
tellsimp (i^foo, i^mod(foo, 4));
Probably matchdeclare should complain if the expression specified
for the predicate is unsuitable.
HTH
Robert Dodier