# nLab algebra over a monad

Contents

### Context

#### Categorical algebra

internalization and categorical algebra

universal algebra

categorical semantics

# Contents

## Idea

There are different, related ways in which one could view the notion of algebra over a monad:

Algebras over a monad are usually objects equipped with extra structure, not just properties. (They can also be seen as algebras over the underlying endofunctor, satisfying extra compatibility properties.)

The corresponding dual notion is that of coalgebra over a comonad.

## Definition

Let $(T,\eta, \mu)$ be a monad on a category $\mathcal{C}$.

### Algebras

###### Definition

An algebra over $T$ (or just $T$-algebra or $T$-module) consists of:

1. an object $A$ of $\mathcal{C}$,

2. a morphism $a \colon T (A) \longrightarrow A$ of $\mathcal{C}$,

such that the following diagrams commute in $\mathcal{C}$ (cf. the definition of module object here):

(1)$\text{Unit Property:}$

(2)$\text{Action Property:}$

###### Remark

The diagram (1) is also sometimes called the unit triangle, and the diagram (2) is also called the multiplication square or algebra square.

### Homomorphisms

Let $(A,a)$ and $(B,b)$ be $T$-algebra. A homomorphism of $T$-algebras is a morphism $f \colon A \to B$ of $\mathcal{C}$ which makes the following diagram commute.

The category formed by $T$-algebras and their homomorphisms is known as the Eilenberg-Moore category of $T$ and often denoted by $\mathcal{C}^T$.

### Free algebras

Given a monad $(T,\mu,\eta)$ on a category $\mathcal{C}$, then for every object $X$ of $\mathcal{C}$, the object $T X$ is canonically equipped with a $T$-algebra structure, given by the multiplication map $\mu$ of the monad. The relevant diagrams commute by the monad axioms.

$T$-Algebras of this sort are called free $T$-algebras.

Given any morphism $\phi \colon X \to Y$ of $\mathcal{C}$, the morphism $T \phi \colon T X \longrightarrow T Y$ is evidently a homomorphism of $T$-algebras, by naturality of $\mu$. But not every homomorphism of $T$-algebras between the free $T$-algebras $T X$ and $T Y$ arises this way, in general.

However, for any morphism of the form

$f \colon X \longrightarrow T Y$

in $\mathcal{C}$ (called a $T$-Kleisli morphism), the induced morphism

(3)$\mu_{Y} \circ T f \;\colon\; T X \xrightarrow{\;\; T f \;\;} T T Y \xrightarrow{\;\; \mu_Y \;\;} TY$

is a homomorphism of $T$-algebras between these free $T$-algebras, as one verifies again using the naturality of $\mu$. Now, all homomorphisms of $T$-algebras between the free algebras $T X$ and $T Y$ do arise this way.

Moreover, given in addition a morphism in $\mathcal{C}$ of the form $g \colon Y \longrightarrow T Z$, then, under this association, the composition of the corresponding $T$-algebra morphisms (3) of $f$ and $g$ equals the $T$-algebra homomorphism corresponding to their Kleisli composite, defined by

$g \circ_T f \;\coloneqq\; X \xrightarrow{ f } T Y \xrightarrow{ T g } T T Z \xrightarrow{ \mu_Z } T Z \,.$

The category of Kleisli morphisms equipped with this Kleisli composition is called the Kleisli category and is equivalent to the full subcategory of $T$-algebras on the free $T$-algebras (see there for more).

### Tensor product

In the case of a commutative monad $T$ , one can define a tensor product of monad algebras, see there for more.

## Examples

Many monads are named after their (free) algebras:

• The algebras of the free monoid monad on Set are monoids, and the morphisms of algebras the monoid homomorphisms.

• The algebras of the free commutative monoid monad on Set are commutative monoids, and their morphisms the monoid homomorphisms between them.

• The algebras of the free group monad on Set are groups, and their morphisms are the group homomorphisms.

• โฆand so on.

In these cases, the notion of free group, free monoid, et cetera coincide with the notion of free algebra given above.

## Generalizations

An algebra over a monad is a special case of a module over a monad in a bicategory. See there for more information.

The Eilenberg-Moore and Kleisli categories are also special cases of more general 2-dimensional universal constructions, namely the Eilenberg-Moore object and the Kleisli object. See those pages for more information.

## References

### General

See the References at monad, such as:

An introduction to the basic ideas, which gives some intuition for newcomers, can be found in

### Kleisli/extension system-style

For monads presented in โextension systemโ/โKleisli tripleโ-form (the way traditionally used for monads in computer science โ i.e. in terms of a โbindโ-operation taking Kleisli maps to actual morphisms, not explicitly referring to the monad product) there is the corresponding โKleisli-triple styleโ or โMendler styleโ [Uustalu (2021), p. 4] for presenting the algebra/module-structures for these monads: