The next major point is not to go into a loop. To this end one must select an ordering, call it COM, on monomials. For mnemonic purposes it is best to select the ordering to reflect your intuitive idea of which monomials are more complicated than others. For example if all of your formulas involve polynomials in
x, inv[x], inv[1-x ** y], inv[1-y ** x],
y, inv[y]
a natural partial ordering is given by
low degree We then subdivide equivalence classes of this ordering with
x inv[x] inv[1-x ** y]
commutative expr < < <
y inv[y] inv[1-y ** x]
then we subdivide equivalence classes of this ordering with
lexicographical order, i.e , x A reasonable convention is that higher order expressions move RIGHT.
For example, a basic equality is
inv[1-x ** y] ** x- x ** inv[1 - y ** x]==0 .This translates to the rule
inv[1-x ** y] ** x -> x ** inv[1-y ** x]because inv[1-x ** y] is 'complicated' and we move it RIGHT. To harp on an earlier point we would suggest using the more powerful delayed assignment form of the rule:
inv[1-x__ ** y_] ** x__ :> x ** inv[1- y ** x]IMPORTANT: these are the ordering conventions we use in NCSR. If you write rules consistent with them then you will then you can use them and NCSR without going into a loop. Indeed NCSR contains a ``Gröbner basis'' for reducing the set of polynomials in the expressions (inv).
Here is a summary of the ordering conventions ranked from most complicated to the least:
high degree>low degree
inv of complicated polynomials
inv of simple polynomials
complicated polynomials
simple polynomials
commuting elements and expressions in them.
REMEMBER HIGHER ORDER EXPRESSIONS MOVE RIGHT.