rule.spad line 130 [edit on github]
This package apply rewrite rules to expressions, calling the pattern matcher.
applyRules([r1, ..., rn], expr) applies the rules r1, ..., rn to f an unlimited number of times, i.e. until none of r1, ..., rn is applicable to the expression.
applyRules([r1, ..., rn], expr, n) applies the rules r1, ..., rn to f a most n times.