# Group algebras and beyond: the Algebra functorial construction¶

## Introduction: group algebras¶

Let $$G$$ be a group and $$R$$ be a ring. For example:

sage: G = DihedralGroup(3)
sage: R = QQ


The group algebra $$A = RG$$ of $$G$$ over $$R$$ is the space of formal linear combinations of elements of $$group$$ with coefficients in $$R$$:

sage: A = G.algebra(R); A
Algebra of Dihedral group of order 6 as a permutation group
over Rational Field
sage: a = A.an_element(); a
() + (1,2) + 3*(1,2,3) + 2*(1,3,2)


This space is endowed with an algebra structure, obtained by extending by bilinearity the multiplication of $$G$$ to a multiplication on $$RG$$:

sage: A in Algebras
True
sage: a * a
14*() + 5*(2,3) + 2*(1,2) + 10*(1,2,3) + 13*(1,3,2) + 5*(1,3)


In particular, the product of two basis elements is induced by the product of the corresponding elements of the group, and the unit of the group algebra is indexed by the unit of the group:

sage: (s, t) = A.algebra_generators()
sage: s*t
(1,2)
sage: A.one_basis()
()
sage: A.one()
()


For the user convenience and backward compatibility, the group algebra can also be constructed with:

sage: GroupAlgebra(G, R)
Algebra of Dihedral group of order 6 as a permutation group
over Rational Field


Since trac ticket #18700, both constructions are strictly equivalent:

sage: GroupAlgebra(G, R) is G.algebra(R)
True


Group algebras are further endowed with a Hopf algebra structure; see below.

## Generalizations¶

The above construction extends to weaker multiplicative structures than groups: magmas, semigroups, monoids. For a monoid $$S$$, we obtain the monoid algebra $$RS$$, which is defined exactly as above:

sage: S = Monoids().example(); S
An example of a monoid: the free monoid generated by ('a', 'b', 'c', 'd')
sage: A = S.algebra(QQ); A
Algebra of An example of a monoid: the free monoid generated by ('a', 'b', 'c', 'd')
over Rational Field
sage: A.category()
Category of monoid algebras over Rational Field


This construction also extends to additive structures: magmas, semigroups, monoids, or groups:

sage: S = CommutativeAdditiveMonoids().example(); S
An example of a commutative monoid:
the free commutative monoid generated by ('a', 'b', 'c', 'd')
sage: U = S.algebra(QQ); U
Algebra of An example of a commutative monoid:
the free commutative monoid generated by ('a', 'b', 'c', 'd')
over Rational Field


Despite saying “free module”, this is really an algebra, whose multiplication is induced by the addition of elements of $$S$$:

sage: U in Algebras(QQ)
True
sage: U(a) * U(b)
B[a + b]


To catter uniformly for the use cases above and some others, for $$S$$ a set and $$K$$ a ring, we define in Sage the algebra of S as the $$K$$-free module with basis indexed by $$S$$, endowed with whatever algebraic structure can be induced from that of $$S$$.

Warning

In most use cases, the result is actually an algebra, hence the name of this construction. In other cases this name is misleading:

sage: A = Sets().example().algebra(QQ); A
Algebra of Set of prime numbers (basic implementation)
over Rational Field
sage: A.category()
Category of set algebras over Rational Field
sage: A in Algebras(QQ)
False


Suggestions for a uniform, meaningful, and non misleading name are welcome!

To achieve this flexibility, the features are implemented as a Covariant Functorial Constructions that is essentially a hierarchy of categories each providing the relevant additional features:

sage: A = DihedralGroup(3).algebra(QQ)
sage: A.categories()
[Category of finite group algebras over Rational Field,
...
Category of group algebras over Rational Field,
...
Category of monoid algebras over Rational Field,
...
Category of semigroup algebras over Rational Field,
...
Category of unital magma algebras over Rational Field,
...
Category of magma algebras over Rational Field,
...
Category of set algebras over Rational Field,
...]


## Specifying the algebraic structure¶

Constructing the algebra of a set endowed with both an additive and a multiplicative structure is ambiguous:

sage: Z3 = IntegerModRing(3)
sage: A = Z3.algebra(QQ)
Traceback (most recent call last):
...
TypeError:  S = Ring of integers modulo 3 is both
an additive and a multiplicative semigroup.
Constructing its algebra is ambiguous.


This ambiguity can be resolved using the category argument of the construction:

sage: A = Z3.algebra(QQ, category=Monoids()); A
Algebra of Ring of integers modulo 3 over Rational Field
sage: A.category()
Category of finite dimensional monoid algebras over Rational Field

sage: A = Z3.algebra(QQ, category=CommutativeAdditiveGroups()); A
Algebra of Ring of integers modulo 3 over Rational Field
sage: A.category()
Category of finite dimensional commutative additive group algebras
over Rational Field


In general, the category argument can be used to specify which structure of $$S$$ shall be extended to $$KS$$.

## Group algebras, continued¶

Let us come back to the case of a group algebra $$A=RG$$. It is endowed with more structure and in particular that of a Hopf algebra:

sage: G = DihedralGroup(3)
sage: A = G.algebra(R); A
Algebra of Dihedral group of order 6 as a permutation group
over Rational Field
sage: A in HopfAlgebras(R).FiniteDimensional().WithBasis()
True


The basis elements are group-like for the coproduct: $$\Delta(g) = g \otimes g$$:

sage: s
(1,2,3)
sage: s.coproduct()
(1,2,3) # (1,2,3)


The counit is the constant function $$1$$ on the basis elements:

sage: A = GroupAlgebra(DihedralGroup(6), QQ)
sage: [A.counit(g) for g in A.basis()]
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]


The antipode is given on basis elements by $$\chi(g) = g^{-1}$$:

sage: A = GroupAlgebra(DihedralGroup(3), QQ)
sage: s
(1,2,3)
sage: s.antipode()
(1,3,2)


By Maschke’s theorem, for a finite group whose cardinality does not divide the characteristic of the base field, the algebra is semisimple:

sage: SymmetricGroup(5).algebra(QQ) in Algebras(QQ).Semisimple()
True
sage: CyclicPermutationGroup(10).algebra(FiniteField(7)) in Algebras.Semisimple
True
sage: CyclicPermutationGroup(10).algebra(FiniteField(5)) in Algebras.Semisimple
False


## Coercions¶

Let $$RS$$ be the algebra of some structure $$S$$. Then $$RS$$ admits the natural coercion from any other algebra $$R'S'$$ of some structure $$S'$$, as long as $$R'$$ coerces into $$R$$ and $$S'$$ coerces into $$S$$.

For example, since there is a natural inclusion from the dihedral group $$D_2$$ of order 4 into the symmetric group $$S_4$$ of order 4!, and since there is a natural map from the integers to the rationals, there is a natural map from $$\ZZ[D_2]$$ to $$\QQ[S_4]$$:

sage: A = DihedralGroup(2).algebra(ZZ)
sage: B = SymmetricGroup(4).algebra(QQ)
sage: a = A.an_element(); a
() + 2*(3,4) + 3*(1,2) + (1,2)(3,4)
sage: b = B.an_element(); b
() + (2,3,4) + 2*(1,3)(2,4) + 3*(1,4)(2,3)
sage: B(a)
() + 2*(3,4) + 3*(1,2) + (1,2)(3,4)
sage: a * b  # a is automatically converted to an element of B
() + 2*(3,4) + 2*(2,3) + (2,3,4) + 3*(1,2) + (1,2)(3,4) + (1,3,2)
+ 3*(1,3,4,2) + 5*(1,3)(2,4) + 13*(1,3,2,4) + 12*(1,4,2,3) + 5*(1,4)(2,3)
sage: parent(a * b)
Symmetric group algebra of order 4 over Rational Field


There is no obvious map in the other direction, though:

sage: A(b)
Traceback (most recent call last):
...
TypeError: do not know how to make x (= () + (2,3,4) + 2*(1,3)(2,4) + 3*(1,4)(2,3))
an element of self
(=Algebra of Dihedral group of order 4 as a permutation group over Integer Ring)


If $$S$$ is a unital (additive) magma, then $$RS$$ is a unital algebra, and thus admits a coercion from its base ring $$R$$ and any ring that coerces into $$R$$.

sage: G = DihedralGroup(2)
sage: A = G.algebra(ZZ)
sage: A(2)
2*()


If $$S$$ is a multiplicative group, then $$RS$$ admits a coercion from $$S$$ and from any group which coerce into $$S$$:

sage: g = DihedralGroup(2).gen(0); g
(3,4)
sage: A(g)
(3,4)
sage: A(2) * g
2*(3,4)


Note that there is an ambiguity if $$S'$$ is a group which coerces into both $$R$$ and $$S$$. For example) if $$S$$ is the additive group $$(\ZZ,+)$$, and $$A = RS$$ is its group algebra, then the integer $$2$$ can be coerced into $$A$$ in two ways – via $$S$$, or via the base ring $$R$$ – and the answers are different. It that case the coercion to $$R$$ takes precedence. In particular, if $$\ZZ$$ is the ring (or group) of integers, then $$\ZZ$$ will coerce to any $$RS$$, by sending $$\ZZ$$ to $$R$$. In generic code, it is therefore recommended to always explicitly use A.monomial(g) to convert an element of the group into $$A$$.

AUTHORS:

• David Loeffler (2008-08-24): initial version

• Martin Raum (2009-08): update to use new coercion model – see trac ticket #6670.

• John Palmieri (2011-07): more updates to coercion, categories, etc., group algebras constructed using CombinatorialFreeModule – see trac ticket #6670.

• Nicolas M. Thiéry (2010-2017), Travis Scrimshaw (2017): generalization to a covariant functorial construction for monoid algebras, and beyond – see e.g. trac ticket #18700.

class sage.categories.algebra_functor.AlgebraFunctor(base_ring)

For a fixed ring, a functor sending a group/… to the corresponding group/… algebra.

EXAMPLES:

sage: from sage.categories.algebra_functor import AlgebraFunctor
sage: F = AlgebraFunctor(QQ); F
The algebra functorial construction
sage: F(DihedralGroup(3))
Algebra of Dihedral group of order 6 as a permutation group
over Rational Field

base_ring()

Return the base ring for this functor.

EXAMPLES:

sage: from sage.categories.algebra_functor import AlgebraFunctor
sage: AlgebraFunctor(QQ).base_ring()
Rational Field

class sage.categories.algebra_functor.AlgebrasCategory(category, *args)

An abstract base class for categories of monoid algebras, groups algebras, and the like.

INPUT:

• base_ring – a ring

EXAMPLES:

sage: C = Groups().Algebras(QQ); C
Category of group algebras over Rational Field
sage: C = Monoids().Algebras(QQ); C
Category of monoid algebras over Rational Field

sage: C._short_name()
'Algebras'
sage: latex(C) # todo: improve that
\mathbf{Algebras}(\mathbf{Monoids})

class ParentMethods

Bases: object

coproduct_on_basis(g)

Return the coproduct of the element g of the basis.

Each basis element g is group-like. This method is used to compute the coproduct of any element.

EXAMPLES:

sage: PF = NonDecreasingParkingFunctions(4)
sage: A = PF.algebra(ZZ); A
Algebra of Non-decreasing parking functions of size 4 over Integer Ring
sage: g = PF.an_element(); g
[1, 1, 1, 1]
sage: A.coproduct_on_basis(g)
B[[1, 1, 1, 1]] # B[[1, 1, 1, 1]]
sage: a = A.an_element(); a
2*B[[1, 1, 1, 1]] + 2*B[[1, 1, 1, 2]] + 3*B[[1, 1, 1, 3]]
sage: a.coproduct()
2*B[[1, 1, 1, 1]] # B[[1, 1, 1, 1]] +
2*B[[1, 1, 1, 2]] # B[[1, 1, 1, 2]] +
3*B[[1, 1, 1, 3]] # B[[1, 1, 1, 3]]

class sage.categories.algebra_functor.GroupAlgebraFunctor(group)

For a fixed group, a functor sending a commutative ring to the corresponding group algebra.

INPUT:

• group – the group associated to each group algebra under consideration

EXAMPLES:

sage: from sage.categories.algebra_functor import GroupAlgebraFunctor
sage: F = GroupAlgebraFunctor(KleinFourGroup()); F
GroupAlgebraFunctor
sage: A = F(QQ); A
Algebra of The Klein 4 group of order 4, as a permutation group over Rational Field

group()

Return the group which is associated to this functor.

EXAMPLES:

sage: from sage.categories.algebra_functor import GroupAlgebraFunctor
sage: GroupAlgebraFunctor(CyclicPermutationGroup(17)).group() == CyclicPermutationGroup(17)
True