The function Ops.free() passes binary arithmetic operators
(“+”, “-”, “*”,
“^”, and “==”) to the appropriate
specialist function.
There are two non-trivial basic operations: juxtaposition, denoted
“a+b”, and inversion, denoted “-a”. Note
that juxtaposition is noncommutative and a+b will not, in
general, be equal to b+a.
All operations return a reduced word.
The caret, as in a^b, denotes group-theoretic exponentiation
(-b+a+b); the notation is motivated by the identities
x^(yz) == (x^y)^z and (xy)^z == x^z * y^z, as in the
permutations package.
As an experimental feature the package now accepts
multiplicative notation, so these identities manifest in package idiom
as written. However, this renders distributivity incorrect so that
x*(y + z) and x*y + x*z are not equal, in general
[distributivity manifests as x*c(y, z) == c(x*y, x*z)].
Multiplication between a free object a and an integer n
(as in a*n or n*a) is defined as juxtaposing n
copies of a and reducing. Zero and negative values of n
work as expected.
Comparing a free object with a numeric does not make sense and
idiom such as rfree() > 4 will return an error. Comparing a
free object with another free object might be desirable
[specifically, lexicographic ordering], but is not currently
implemented.