The free algebra \(\mathcal B\) is a graded algebra: that
is, for each integer \(n\geq 0\) there is a homogeneous
subspace \(\mathcal{B}_n\) with
\(\mathcal{B}_0=\mathcal{R}\) and
$$
\mathcal{B}=\bigoplus_{n=0}^\infty\mathcal{B}_n,\quad\mbox{and}\quad\mathcal{B}_n\mathcal{B}_m\subseteq\mathcal{B}_{n+m}\quad\mbox{for all $m,n\geq 0.$}
$$
The elements of \(\cup_{n\geq 0}\mathcal{B}_n\) are
called homogeneous and those of \(\mathcal{B}_n\) are
called homogenous of degree (or grade) \(n\).
The grade of a term is the number of symbols in it. Thus the
grade of xxx
and 4xxy
is 3; the grade of a constant is
zero. Because the terms are stored in an implementation-specific way,
the grade of a multi-term object is a disord
object.
The grade of the zero freealg
object,
grade(as.freealg(0))
, is defined to be \(-\infty\),
as per Knuth [TAOCP, volume 2, p436]. This ensures that
max(grades(abelianize(x))) <= max(grades(x))
is always satisfied.
However, a case for NULL
could be made.