# RewriteRule(Base, R, F)ΒΆ

- Base: SetCategory
- R: Join(Ring, PatternMatchable Base, Comparable, ConvertibleTo Pattern Base)
- F: Join(FunctionSpace R, PatternMatchable Base, ConvertibleTo Pattern Base)

Rules for the pattern matcher Author: Manuel Bronstein Date Created: 24 Oct 1988 Keywords: pattern, matching, rule.

- =: (%, %) -> Boolean
- from BasicType
- ~=: (%, %) -> Boolean
- from BasicType
- coerce: % -> OutputForm
- from CoercibleTo OutputForm
- coerce: Equation F -> %
- from RetractableTo Equation F
- elt: (%, F) -> F
- from Eltable(F, F)

- elt: (%, F, PositiveInteger) -> F
`elt(r, f, n)`

or`r`

(`f`

,`n`

) applies the rule`r`

to`f`

at most`n`

times.- hash: % -> SingleInteger
- from SetCategory
- hashUpdate!: (HashState, %) -> HashState
- from SetCategory
- latex: % -> String
- from SetCategory

- lhs: % -> F
`lhs(r)`

returns the left hand side of the rule`r`

.

- pattern: % -> Pattern Base
`pattern(r)`

returns the pattern corresponding to the left hand side of the rule`r`

.

- quotedOperators: % -> List Symbol
`quotedOperators(r)`

returns the list of operators on the right hand side of`r`

that are considered quoted, that is they are not evaluated during any rewrite, but just applied formally to their arguments.- retract: % -> Equation F
- from RetractableTo Equation F
- retractIfCan: % -> Union(Equation F, failed)
- from RetractableTo Equation F

- rhs: % -> F
`rhs(r)`

returns the right hand side of the rule`r`

.

- rule: (F, F) -> %
`rule(f, g)`

creates the rewrite rule:`f == eval(g, g is f)`

, with left-hand side`f`

and right-hand side`g`

.

- rule: (F, F, List Symbol) -> %
`rule(f, g, [f1, ..., fn])`

creates the rewrite rule`f == eval(eval(g, g is f), [f1, ..., fn])`

, that is a rule with left-hand side`f`

and right-hand side`g`

; The symbols`f1`

, ...,`fn`

are the operators that are considered quoted, that is they are not evaluated during any rewrite, but just applied formally to their arguments.

- suchThat: (%, List Symbol, List F -> Boolean) -> %
`suchThat(r, [a1, ..., an], f)`

returns the rewrite rule`r`

with the predicate`f(a1, ..., an)`

attached to it.

Eltable(F, F)