Tutorial: Implementing Algebraic Structures

<span id="tutorial-implementing-algebraic-structures"></span>

<table class="docinfo" frame="void" rules="none">
<col class="docinfo-name">
<col class="docinfo-content">
<tbody valign="top">
<tr><th class="docinfo-name">Author:</th>
<td>Nicolas M. Thiéry &lt;nthiery at users.sf.net&gt; et al.</td></tr>
</tbody>
</table>
<p>This tutorial will discuss five concepts:</p>
<blockquote>
<ul class="simple">
<li>constructing and manipulating new modules/vector spaces</li>
<li>adding more algebraic structure</li>
<li>defining morphisms</li>
<li>defining coercions and conversions</li>
<li>algebraic structures with several realizations</li>
</ul>
</blockquote>
<p>At the end of this tutorial, the reader should be able to reimplement
by himself the example of algebra with several realizations:</p>

{{{id=0|
Sets().WithRealizations()
///
}}}

<p>Namely, we consider an algebra $A(S)$ whose basis is indexed by the
subsets $s$ of a given set $S$. $A(S)$ is endowed with three natural
basis: <tt class="docutils literal">F</tt>, <tt class="docutils literal">In</tt>, <tt class="docutils literal">Out</tt>; in the first basis, the product is
given by the union of the indexing sets. The <tt class="docutils literal">In</tt> basis and <tt class="docutils literal">Out</tt>
basis are defined respectively by:</p>
<blockquote>
$In_s  = \sum_{t\subset s} F_t
F_s   = \sum_{t\supset s} Out_t$</blockquote>
<p>Each such basis gives a realization of $A$, where the elements are
represented by their expansion in this basis. In the running exercises
we will progressively implement this algebra and its three
realizations, with coercions and mixed arithmetic between them.</p>
<p>This tutorial heavily depends on the <a href="#id5"><span class="problematic" id="id6">`tutorial-using-free-modules`_</span></a>.</p>

<h1>Subclassing free modules and including category information</h1>

{{{id=1|
class MyCyclicGroupModule(CombinatorialFreeModule):
       &quot;&quot;&quot;An absolutely minimal implementation of a module whose basis is a cyclic group&quot;&quot;&quot;
       def __init__(self, R, n, *args, **kwargs):
           CombinatorialFreeModule.__init__(self, R, Zmod(n), *args, **kwargs)
///
}}}

{{{id=2|
A = MyCyclicGroupModule(QQ, 6, prefix='a') # or 4 or 5 or 11     ...
a = A.basis()
A.an_element()
///
a[0] + 3*a[1] + 3*a[2]
}}}

<p>We now want to endow $A$ with its natural product structure, to get
the group algebra of the cyclic group. Of course this is solely for
pedagogical purposes; group algebras are already implemented (see
<tt class="docutils literal"><span class="pre">ZMod(3).algebra(QQ)</span></tt>).</p>
<p>To define a multiplication, we should be in a category where
multiplication makes sense, which is not yet the case:</p>

{{{id=3|
A.category()
///
Category of modules with basis over Rational Field
}}}

<p>We can look at the available categories from the documentation in the
reference manual: <a class="reference external" href="http://sagemath.com/doc/reference/categories.html">http://sagemath.com/doc/reference/categories.html</a></p>
<p>Or we can use introspection:</p>

{{{id=4|
sage.categories.  # Look through the list of categories to pick one we want
///
}}}

<p>Once we have chosen an appropriate category (here
<tt class="docutils literal">AlgebrasWithBasis</tt>), one can look at one example:</p>

{{{id=5|
E = AlgebrasWithBasis(QQ).example(); E
///
An example of an algebra with basis: the free algebra on the generators ('a', 'b', 'c') over Rational Field
}}}

{{{id=6|
e = E.an_element(); e
///
B[word: ] + 2*B[word: a] + 3*B[word: b]
}}}

<p>and browse its code:</p>

{{{id=7|
E??
///
}}}

<p>This code is meant as a template from which to start implementing a
new algebra. In particular it suggests that we need to implement the
methods <tt class="docutils literal">product_on_basis</tt>, <tt class="docutils literal">one_basis</tt>, <tt class="docutils literal">_repr_</tt> and
<tt class="docutils literal">algebra_generators</tt>. Another way to get this lists of methods is to
ask the category (TODO: find a slicker idiom for this):</p>

{{{id=8|
from sage.misc.abstract_method import abstract_methods_of_class
abstract_methods_of_class(AlgebrasWithBasis(QQ).element_class)
///
{'required': [], 'optional': ['_add_', '_mul_']}
}}}

{{{id=9|
abstract_methods_of_class(AlgebrasWithBasis(QQ).parent_class)
///
{'required': ['__contains__'], 'optional': ['one_basis', 'product_on_basis']}
}}}

<p class="first admonition-title">Warning</p>
<p class="last">the result above is not yet necessarily complete; many
required methods in the categories are not yet marked as
<tt class="docutils literal">abstract_methods</tt>. We also recommend browsing the
documentation of this category: <tt class="docutils literal">AlgebrasWithBasis</tt>.</p>

<p>Here is the obtained implementation of the group algebra:</p>

{{{id=10|
class MyCyclicGroupAlgebra(CombinatorialFreeModule):

       def __init__(self, R, n, **keywords):
           self._group = Zmod(n)
           CombinatorialFreeModule.__init__(self, R, self._group,
               category=AlgebrasWithBasis(R), **keywords)

       def product_on_basis(self, left, right):
           return self.monomial( left + right )

       def one_basis(self):
           return self._group.zero()

       def algebra_generators(self):
           return Family( [self.monomial( self._group(1) ) ] )

       def _repr_(self):
           return &quot;Jason's group algebra of %s over %s&quot;%(self._group, self.base_ring())
///
}}}

<p>Some notes about this implementation:</p>
<blockquote>
<ul>
<li><p class="first">Alternatively, we could have defined <tt class="docutils literal">product</tt> instead of
<tt class="docutils literal">product_on_basis</tt>:</p>
<pre class="literal-block">
...       # def product(self, left, right):
...       #     return ## something ##

</pre></li>
<li><p class="first">For the sake of readability in this tutorial, we have stripped out
all the documentation strings. Of course all of those should be
present as in <tt class="docutils literal">E</tt>.</p>
</li>
<li><p class="first">The purpose of <tt class="docutils literal">**keywords</tt> is to pass down options like
<tt class="docutils literal">prefix</tt> to <tt class="docutils literal">CombinatorialFreeModules</tt>.</p>
</li>
</ul>
</blockquote>
<p>Let us do some calculations:</p>

{{{id=11|
A = MyCyclicGroupAlgebra(QQ, 2, prefix='a') # or 4 or 5 or 11     ...
a = A.basis();
f = A.an_element();
A, f
///
(Jason's group algebra of the cyclic group Zmod(2) over Rational Field, a[0] + 3*a[1])
}}}

{{{id=12|
f * f
///
10*a[0] + 6*a[1]
}}}

{{{id=13|
f.
f.is_idempotent()
///
False
}}}

{{{id=14|
A.one()
///
a[0]
}}}

{{{id=15|
x = A.algebra_generators().first() # Typically x,y,    ... = A.algebra_generators()
[x^i for i in range(4)]
///
[a[0], a[1], a[0], a[1]]
}}}

{{{id=16|
g = 2*a[1]; (f + g)*f == f*f + g*f
///
True
}}}

<p>This seems to work fine, but we would like to put more stress on our
implementation to shake potential bugs out of it. To this end, we will
use <tt class="docutils literal">TestSuite</tt> a tool which will perform many routine tests on
our algebra for us:</p>

{{{id=17|
TestSuite(A).run(verbose=True)
///
running ._test_additive_associativity() . . . passrunning ._test_an_element() . . . passrunning ._test_associativity() . . . passrunning ._test_category() . . . passrunning ._test_elements() . . .  Running the test suite of self.an_element()  running ._test_category() . . . pass  running ._test_not_implemented_methods() . . . pass  running ._test_pickling() . . . pass  passrunning ._test_not_implemented_methods() . . . passrunning ._test_one() . . . passrunning ._test_pickling() . . . passrunning ._test_prod() . . . passrunning ._test_some_elements() . . . passrunning ._test_zero() . . . pass
}}}

<p>For more information on categories, see:</p>

{{{id=18|
sage.categories.primer?
///
}}}

<h2>Review</h2>
<p>We wanted to create an algebra, so we:</p>
<pre class="literal-block">
1 Created the underlying vector space using ``CombinatorialFreeModule``
2 Looked at ``sage.categories.&lt;tab&gt;`` to find an appropriate category
3 Loaded an example of that category to see what methods we needed to write
4 Added the category information and other necessary methods to our class
5 Ran ``TestSuite`` to catch potential discrepancies

</pre><h2>Exercise</h2>
<ol class="arabic">
<li><p class="first">Make a tiny modification to product_on_basis in
&quot;MyCyclicGroupAlgebra&quot; to implement the <em>dual</em> of the group algebra
of the cyclic group instead of its group algebra (product given by
$b_fb_g=\delta_{f,g}bf$).</p>
<p>Run the <tt class="docutils literal">TestSuite</tt> tests (you may ignore the &quot;pickling&quot;
errors). What do you notice?</p>
<p>Fix the implementation of <tt class="docutils literal">one</tt> and check that the tests now pass.</p>
<p>Add the hopf algebra structure. Hint: look at the example:</p>

{{{id=19|
C = HopfAlgebrasWithBasis(QQ).example()
///
}}}

</li>
<li><p class="first">Given a set $S$, say:</p>

{{{id=20|
S = Set([1,2,3,4,5])
///
}}}

<p>and a base ring, say:</p>

{{{id=21|
R = QQ
///
}}}

</li>
</ol>
<p>implement an $R$-algebra:</p>

{{{id=22|
F = SubsetAlgebraOnFundamentalBasis(S, R)   # todo: not implemented
///
}}}

<p>whose basis <tt class="docutils literal"><span class="pre">(b_s)_{s\\subset</span> S}</tt> is indexed by the subsets of
<tt class="docutils literal">S</tt>:</p>

{{{id=23|
Subsets(S)
///
Subsets of {1, 2, 3, 4, 5}
}}}

<p>and where the product is defined by $b_s b_t = b_{s\cup t}$.</p>



<h1>Morphisms</h1>
<p>To better understand relationships between algebraic spaces, one wants
to consider morphisms between them.</p>
<blockquote>
sage: A.module_morphism?
sage: A = MyCyclicGroupAlgebra(QQ, 2, prefix='a')
sage: B = MyCyclicGroupAlgebra(QQ, 6, prefix='b')
sage: A, B
(Jason's group algebra of the cyclic group Zmod(2) over Rational Field, Jason's group algebra of the cyclic group Zmod(6) over Rational Field)</blockquote>

{{{id=24|
def func_on_basis(g):
       r&quot;&quot;&quot;
       This function is the 'brains' of a (linear) morphism
       from A --&gt; B.  The input is the index of basis
       element of the domain (A).  The output is an element of the
       codomain (B).
       &quot;&quot;&quot;
       if g==1: return B.monomial(Zmod(6)(3))
       else:    return B.one()
///
}}}

<p>We can now define a morphism which extends this function to $A$ by
linearity:</p>

{{{id=25|
phi = A.module_morphism(func_on_basis, codomain=B)
f = A.an_element()
f
///
a[0] + 3*a[1]
}}}

{{{id=26|
phi(f)
///
b[0] + 3*b[3]
}}}

<h2>Exercise</h2>
<p>Define a new free module <tt class="docutils literal">In</tt> with basis indexed by the subsets of
$S$, and a morphism <tt class="docutils literal">phi</tt> from <tt class="docutils literal">In</tt> to <tt class="docutils literal">F</tt> defined by</p>
<blockquote>
$\phi(In_s) = \sum_{t\subset s} F_t$</blockquote>



<h1>Diagonal and Triangular Morphisms</h1>
<p>We now illustrate how to specify that a given morphism is diagonal or
triangular with respect to some order on the basis which makes it
invertible. Currently this feature requires the domain and codomain to
have the same index set (in progress ...).</p>

{{{id=27|
X = CombinatorialFreeModule(QQ, Partitions(), prefix='x'); x = X.basis();
Y = CombinatorialFreeModule(QQ, Partitions(), prefix='y'); y = Y.basis();
///
}}}

<p>A diagonal module_morphism takes as argument a function whose input is
the index of a basis element of the domain, and whose output is the
coefficient of the corresponding basis element of the codomain:</p>

{{{id=28|
def diag_func(p):
       if len(p)==0: return 1
       else: return p[0]


diag_func(Partition([3,2,1]))
///
3
}}}

{{{id=29|
X_to_Y = X.module_morphism(diagonal=diag_func, codomain=Y)
f = X.an_element();
f
///
x[[]] + 2*x[[1]] + 3*x[[2]]
}}}

{{{id=30|
X_to_Y(f)
///
y[[]] + 2*y[[1]] + 6*y[[2]]
}}}

<p>Python fun-fact: <tt class="docutils literal">~</tt> is the inversion operator (but be careful with
int's!):</p>

{{{id=31|
~2
///
1/2
}}}

{{{id=32|
~(int(2))
///
-3
}}}

<p>Diagonal module_morphisms are invertible:</p>

{{{id=33|
Y_to_X = ~X_to_Y
f = y[Partition([3])] - 2*y[Partition([2,1])]
f
///
-2*y[[2, 1]] + y[[3]]
}}}

{{{id=34|
Y_to_X(f)
///
-x[[2, 1]] + 1/3*x[[3]]
}}}

{{{id=35|
X_to_Y(Y_to_X(f))
///
-2*y[[2, 1]] + y[[3]]
}}}

<p>For triangular morphisms, just like ordinary morphisms, we need a
function which accepts as input the index of a basis element of the
domain and returns an element of the codomain.  We think of this
function as representing the columns of the matrix of the linear
transformation:</p>

{{{id=36|
def triang_on_basis(p):
       return Y.sum_of_monomials(mu for mu in Partitions(sum(p)) if mu &gt;= p)

triang_on_basis([3,2])
///
y[[3, 2]] + y[[4, 1]] + y[[5]]
}}}

{{{id=37|
X_to_Y = X.module_morphism(triang_on_basis, triangular='lower', unitriangular=True, codomain=Y)
f = x[Partition([1,1,1])] + 2*x[Partition([3,2])];
f
///
x[[1, 1, 1]] + 2*x[[3, 2]]
}}}


{{{id=38|
X_to_Y(f)
///
y[[1, 1, 1]] + y[[2, 1]] + y[[3]] + 2*y[[3, 2]] + 2*y[[4, 1]] + 2*y[[5]]
}}}

<p>Triangular module_morphisms are also invertible, even if <tt class="docutils literal">X</tt> and
<tt class="docutils literal">Y</tt> are both infinite-dimensional:</p>

{{{id=39|
Y_to_X = ~X_to_Y
f
///
x[[1, 1, 1]] + 2*x[[3, 2]]
}}}

{{{id=40|
Y_to_X(X_to_Y(f))
///
x[[1, 1, 1]] + 2*x[[3, 2]]
}}}

<p>For details, see
<tt class="docutils literal">ModulesWithBasis.ParentMethods.module_morphism</tt> (and also
<tt class="docutils literal">sage.categories.modules_with_basis.TriangularModuleMorphism</tt>):</p>

{{{id=41|
A.module_morphism?
///
}}}

<h2>Exercise</h2>
<p>Redefine the morphism <tt class="docutils literal">phi</tt> from the previous exercise to specify
that it is triangular w.r.t. inclusion of subsets, and inverse this
morphism. You may want to use the following comparison function as
<tt class="docutils literal">cmp</tt> argument to <tt class="docutils literal">modules_morphism</tt>:</p>

{{{id=42|
def subset_cmp(s, t):
       &quot;&quot;&quot;
       A comparison function on sets which gives a linear extension
       of the inclusion order.

       INPUT:

        - ``x``, ``y`` -- sets
       EXAMPLES::

           sage: sorted(Subsets([1,2,3]), subset_cmp)
           [{}, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}]
       &quot;&quot;&quot;
       s = cmp(len(x), len(y))
       if s != 0:
           return s
       return cmp(list(x), list(y))
///
}}}

<h1>Coercions</h1>
<p>Once we have defined a morphism from $X \to Y$, we can register it as
a coercion.  This will allow Sage to apply the morphism automatically
whenever we combine elements of $X$ and $Y$ together. See
<a class="reference external" href="http://sagemath.com/doc/reference/coercion.html">http://sagemath.com/doc/reference/coercion.html</a> for more
information. As a training step, let us first define a morphism $X$ to $h$, and
register it as a coercion:</p>

{{{id=43|
def triang_on_basis(p):
       return h.sum_of_monomials(mu for mu in Partitions(sum(p)) if mu &gt;= p)

triang_on_basis([3,2])
///
h[3, 2] + h[4, 1] + h[5]
}}}

{{{id=44|
X_to_h = X.module_morphism(triang_on_basis, triangular='lower', unitriangular=True, codomain=h)
X_to_h.
X_to_h.register_as_coercion()
///
}}}

<p>Now we can convert elements from $X$ to $h$, but also do mixed
arithmetic with them:</p>

{{{id=45|
h(x[Partition([3,2])])
///
h[3, 2] + h[4, 1] + h[5]
}}}

{{{id=46|
h([2,2,1]) + x[Partition([2,2,1])]
///
2*h[2, 2, 1] + h[3, 1, 1] + h[3, 2] + h[4, 1] + h[5]
}}}

<h2>Exercise</h2>
<p>Use the inverse of <tt class="docutils literal">phi</tt> to implement the inverse coercion from
<tt class="docutils literal">F</tt> to <tt class="docutils literal">In</tt>. Reimplement <tt class="docutils literal">In</tt> as an algebra, with a product
method making it use <tt class="docutils literal">phi</tt> and its inverse.</p>



<h1>Application: new basis and quotients of symmetric functions</h1>
<p>In the sequel, we show how to combine everything we have seen to
implement a new basis of the algebra of symmetric functions:</p>

{{{id=47|
SF = SymmetricFunctions(QQ);  # A GradedHopfAlgebraWithBasis
h  = SF.homogeneous()         # A particular basis, indexed by partitions (with some additional magic)
///
}}}

<p>$h$ is a graded algebra whose basis is indexed by partitions. Namely
<tt class="docutils literal"><span class="pre">h([i])</span></tt> represents the sum of all monomials of degree $i$:</p>

{{{id=48|
h([2]).expand(4)
///
x0^2 + x0*x1 + x1^2 + x0*x2 + x1*x2 + x2^2 + x0*x3 + x1*x3 + x2*x3 + x3^2
}}}

<p>and <tt class="docutils literal"><span class="pre">h(\\mu)</span> = prod( h(p) for p in mu )</tt>:</p>

{{{id=49|
h([3,2,2,1]) == h([3]) * h([2]) * h([2]) * h([1])
///
True
}}}


{{{id=50|
class MySFBasis(CombinatorialFreeModule):
       r&quot;&quot;&quot;
       Note: We would typically use SymmetricFunctionAlgebra_generic
       for this. This is as an example only.
       &quot;&quot;&quot;

       def __init__(self, R, *args, **kwargs):
           &quot;&quot;&quot; TODO: Informative doc-string and examples &quot;&quot;&quot;
           CombinatorialFreeModule.__init__(self, R, Partitions(), category=AlgebrasWithBasis(R), *args, **kwargs)
           self._h = SymmetricFunctions(R).homogeneous()
           self._to_h = self.module_morphism( self._to_h_on_basis, triangular='lower', unitriangular=True, codomain=self._h)
           self._from_h = ~(self._to_h)
           self._to_h.register_as_coercion()
           self._from_h.register_as_coercion()

       def _to_h_on_basis(self, la):
           return self._h.sum_of_monomials(mu for mu in Partitions(sum(la)) if mu &gt;= la)

       def product(self, left, right):
           return self( self._h(left) * self._h(right) )

       def _repr_(self):
           return &quot;Jason's basis for symmetric functions over %s&quot;%self.base_ring()

       &#64;cached_method
       def one_basis(self):
           r&quot;&quot;&quot; Returns the index of the basis element which is equal to '1'.&quot;&quot;&quot;
           return Partition([])
X = MySFBasis(QQ, prefix='x'); x = X.basis(); h = SymmetricFunctions(QQ).homogeneous()
f = X(h([2,1,1]) - 2*h([2,2]))  # Note the capital X
f
h(f)
///
x[[2, 1, 1]] - 3*x[[2, 2]] + 2*x[[3, 1]]h[2, 1, 1] - 2*h[2, 2]
}}}

{{{id=51|
f*f*f
///
x[[2, 2, 2, 1, 1, 1, 1, 1, 1]] - 7*x[[2, 2, 2, 2, 1, 1, 1, 1]] + 18*x[[2, 2, 2, 2, 2, 1, 1]] - 20*x[[2, 2, 2, 2, 2, 2]] + 8*x[[3, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
}}}

{{{id=52|
h(f*f)
///
h[2, 2, 1, 1, 1, 1] - 4*h[2, 2, 2, 1, 1] + 4*h[2, 2, 2, 2]
}}}

<p>As a final example, we implement a quotient of the algebra of
symmetric functions:</p>

{{{id=53|
class MySFQuotient(CombinatorialFreeModule):
       r&quot;&quot;&quot;
       The quotient of the ring of symmetric functions by the ideal generated
       by those monomial symmetric functions whose part is larger than some fixed
       number ``k``.
       &quot;&quot;&quot;

       def __init__(self, R, k, prefix=None, *args, **kwargs):

           #  Note: Setting self._prefix is equivalent to using the prefix keyword
           #  in CombinatorialFreeModule.__init__

           if prefix is not None:
               self._prefix = prefix
           else:
               self._prefix = 'mm'

           CombinatorialFreeModule.__init__(self, R,
               Partitions(NonNegativeIntegers(), max_part=k),
               category = GradedHopfAlgebrasWithBasis(R), *args, **kwargs)

           self._k = k
           self._m = SymmetricFunctions(R).monomial()

           self.lift = self.module_morphism(self._m.monomial)
           self.retract = self._m.module_morphism(self._retract_on_basis, codomain=self)

           self.lift.register_as_coercion()
           self.retract.register_as_coercion()

       def _retract_on_basis(self, mu):
           r&quot;&quot;&quot; Takes the index of a basis element of a monomial
           symmetric function, and returns the projection of that
           element to the quotient.&quot;&quot;&quot;

           if len(mu) &gt; 0 and mu[0] &gt; self._k:
               return self.zero()
           return self.monomial(mu)

       &#64;cached_method
       def one_basis(self):
           return Partition([])

       def product(self, left, right):
           return self( self._m(left) * self._m(right) )
MM = MySFQuotient(QQ, 3)
mm = MM.basis()
m = SymmetricFunctions(QQ).monomial()
P = Partition
f = mm[P([3,2,1])] + 2*mm[P([3,3])]
f
///
mm[[3, 2, 1]] + 2*mm[[3, 3]]
}}}

{{{id=54|
m(f)
///
m[3, 2, 1] + 2*m[3, 3]
}}}

{{{id=55|
(m(f))^2
///
8*m[3, 3, 2, 2, 1, 1] + 12*m[3, 3, 2, 2, 2] + 24*m[3, 3, 3, 2, 1] + 48*m[3, 3, 3, 3] + 4*m[4, 3, 2, 2, 1] + 4*m[4, 3, 3, 1, 1] + 14*m[4, 3, 3, 2] + 4*m[4, 4, 2, 2] + 4*m[4, 4, 3, 1] + 6*m[4, 4, 4] + 4*m[5, 3, 2, 1, 1] + 4*m[5, 3, 2, 2] + 12*m[5, 3, 3, 1] + 2*m[5, 4, 2, 1] + 6*m[5, 4, 3] + 4*m[5, 5, 1, 1] + 2*m[5, 5, 2] + 4*m[6, 2, 2, 1, 1] + 6*m[6, 2, 2, 2] + 6*m[6, 3, 2, 1] + 10*m[6, 3, 3] + 2*m[6, 4, 1, 1] + 5*m[6, 4, 2] + 4*m[6, 5, 1] + 4*m[6, 6]
}}}

{{{id=56|
f^2
///
8*mm[[3, 3, 2, 2, 1, 1]] + 12*mm[[3, 3, 2, 2, 2]] + 24*mm[[3, 3, 3, 2, 1]] + 48*mm[[3, 3, 3, 3]]
}}}

{{{id=57|
(m(f))^2 - m(f^2)
///
4*m[4, 3, 2, 2, 1] + 4*m[4, 3, 3, 1, 1] + 14*m[4, 3, 3, 2] + 4*m[4, 4, 2, 2] + 4*m[4, 4, 3, 1] + 6*m[4, 4, 4] + 4*m[5, 3, 2, 1, 1] + 4*m[5, 3, 2, 2] + 12*m[5, 3, 3, 1] + 2*m[5, 4, 2, 1] + 6*m[5, 4, 3] + 4*m[5, 5, 1, 1] + 2*m[5, 5, 2] + 4*m[6, 2, 2, 1, 1] + 6*m[6, 2, 2, 2] + 6*m[6, 3, 2, 1] + 10*m[6, 3, 3] + 2*m[6, 4, 1, 1] + 5*m[6, 4, 2] + 4*m[6, 5, 1] + 4*m[6, 6]
}}}

{{{id=58|
MM( (m(f))^2 - m(f^2) )
///
0
}}}

<h1>Docutils System Messages</h1>

<p class="system-message-title">System Message: ERROR/3 (<tt class="docutils">tutorial-implementing-algebraic-structures.rst</tt>, line 37); <em><a href="#id6">backlink</a></em></p>
Unknown target name: &quot;tutorial-using-free-modules&quot;.




