symmetric monoidal (∞,1)-category of spectra
A terminal coalgebra, also called final coalgebra, for an endofunctor $F$ on a category $C$ is a terminal object in the category of coalgebras of $F$.
If $F$ has a terminal coalgebra $\alpha\colon X \to F(X)$, then $X$ is isomorphic to $F(X)$ (see below); in this sense, $X$ is a fixed point of $F$. Being terminal, $X$ is the largest fixed point of $F$ in that there is a map to $X$ from any other fixed point (indeed, any other coalgebra), and this map is an injection if $C$ is Set.
The dual concept is initial algebra. Just as initial algebras allow for induction and recursion, so terminal coalgebras allow for coinduction and corecursion.
Given two coalgebras $(x, \eta: x \to F x)$, $(y, \theta: y \to F y)$, a coalgebra map is a morphism $f: x \to y$ which respects the coalgebra structures:
A terminal coalgebra (usually called a final coalgebra in the literature) is of course a terminal object in the category of coalgebras. Many data structures can be expressed as terminal coalgebras of suitable endofunctors; a simple but useful theorem says that terminal coalgebras $x$ are “fixed points” of their endofunctors, in that $F x \cong x$. This is the dual form of a theorem discovered long ago by Lambek:
If $(x, \theta: x \to F x)$ is a terminal object in the category of $F$-coalgebras, then $\theta$ is an isomorphism.
Define a coalgebra structure on $F x$ by $F\theta: F x \to F F x$. By terminality of $x$, there is a unique coalgebra map $f: F x \to x$. We claim this is inverse to $\theta$. Indeed, by how we defined the coalgebra structure on $F x$, it is tautological that $\theta$ is a coalgebra map. By terminality of $x$ again, this gives an equation of coalgebra maps:
On the other hand,
where the first equation holds because $f$ is a coalgebra map. This completes the proof.
To construct terminal coalgebras, the following result is useful and practical. See Adámek's theorem on terminal coalgebras? for an extension of this result.
(Adámek) If $C$ has a terminal object $1$ and the limit $L$ of the diagram
exists in $C$ and $F$ preserves this limit, then the limit carries a structure of terminal coalgebra.
Let $\pi_n: L \to F^n 1$ be the $n^{th}$ projection of the limiting cone. Then we have a cone from $F L$ to the diagram (1) whose components are
and the induced map $F L \to L$ to the limit is invertible by hypothesis; let $\theta: L \to F L$ be the inverse. We claim the coalgebra $(L, \theta)$ is terminal.
Indeed, suppose $(x, \eta: x \to F x)$ is any coalgebra. We recursively define maps $f_n: x \to F^n 1$: let $f_0: x \to 1$ be the unique map, and
It is easily checked by induction that we have a commutative diagram
defining a cone from $x$ to the diagram (1), and inducing a map $f: x \to L$ such that the following diagram commutes:
This diagram gives the fact that $f$ is a coalgebra map. Moreover, any coalgebra map $f: x \to L$ leads to a sequence $f_n = \pi_n \circ f$ that satisfies $f_{n+1} = F(f_n) \circ \eta$, by gluing the second diagram to the commutative diagram
so that we were forced to define the $f_n$ by recursion as we did, and the coalgebra map $f: x \to L$ is therefore uniquely determined.
As first observed by Peter Freyd, the unit interval $[0, 1] \hookrightarrow \mathbb{R}$ inside the real line can be characterized as a suitable terminal coalgebra. There are various ways of realizing this; we give one (but see remarks below).
Consider the category of intervals $Int$, i.e., linearly ordered sets with separate top and bottom elements $1$ and $0$, and let
be the endofunctor which takes an interval $X$ to $X \vee X$, the linear order obtained by taking two copies of $X$ and gluing the top element of the first copy to the bottom element of the second. The real interval $[0, 1]$ becomes a coalgebra if we identify $[0, 1] \vee [0, 1]$ with $[0, 2]$ and consider the multiplication-by-2 map $[0, 1] \to [0, 2]$ as giving a coalgebra structure.
The interval $[0, 1]$ is terminal in the category of coalgebras.
Given any coalgebra structure $f: X \to X \vee X$, any value $f(x)$ lands either in the “lower” half (the first $X$ in $X \vee X$), the “upper” half (the second $X$ in $X \vee X$), or at the precise spot between them, where the top element in the first copy is glued to the bottom element of the second. Intuitively, one could think of a coalgebra structure $\theta: X \to X \vee X$ as giving an automaton where on input $x_0$ there is output of the form $(x_1, h_1)$, where $h_1$ is either “upper”, “lower”, or “between”. By iteration, this generates a behavior stream $(x_n, h_n)$. Interpreting upper as 1 and lower as 0, the $h_n$ form a binary expansion to give a number between 0 and 1, and therefore we have an interval map $X \to [0, 1]$ which sends $x_0$ to that number. Of course, should we ever hit $(x_n, between)$, we have a choice to resolve it as either $(bottom_X, upper)$ or $(top_X, lower)$ and continue the stream, but these streams are identified, and this corresponds to the identification of binary expansions
as real numbers. In this way, we produce a unique well-defined interval map $X \to [0, 1]$, so that $[0, 1]$ is the terminal coalgebra.
(More material can be found at coalgebra of the real interval.)
The same proof shows that we could have considered instead the category of posets with separate top and bottom, or even the category of sets with separate top and bottom, with an analogous endofunctor. The reason we chose the category of intervals is (besides the availability of the succinct term ‘interval’) to indicate that choice of interval $[0, 1]$, as the model which classifies the geometric realization functor, can be justified on the grounds of a universal property, as shown by this theorem.
Freyd, in his original post on this result, was inspired by a similar theorem due to Pavlovic and Pratt, that the half-open interval $[0, \infty)$ can be described as the terminal coalgebra for the endofunctor that sends a linearly ordered set $X$ to $\omega \times X$ with the dictionary order.
The theorem holds in an arbitrary topos (with $[0, 1]$ being the interval of Dedekind reals), provided that the word “separate” is interpreted correctly:
and provided that the process of gluing endpoints is given correctly. See Johnstone’s Elephant, section D.4.7, for an extended discussion.
The notion of terminal coalgebra may be categorified. For example, given a 2-category $C$ and a (pseudo) functor $F: C \to C$, one may speak of a 2-terminal (pseudo) coalgebra.
A theoretically important example is the category of trees, seen as a 2-terminal coalgebra for the endofunctor on $Cat$ which takes a locally small category $C$ to its small-coproduct cocompletion. Further discussion of this point is given at pure set.
The small-coproduct cocompletion of $C$ is given by a comma category construction: objects are pairs $(X, F: X_d \to C)$ where $X$ is a set and $F$ is a functor whose domain is the discrete category on $X$, denoted $X_d$. A morphism from $(X, F)$ to $(Y, G)$ is a pair $(f, \Phi)$ where $f: X \to Y$ is a function and $\Phi: F \to G \circ f_d$ is a natural transformation. This category is denoted $Set \wr C$; it is called a “categorical wreath product” (see also the discussion at club).
Adámek’s theorem may be adapted to this 2-categorical situation. The iterated wreath product $(Set \wr)^n 1$ may be identified with the category of $n$-stage trees:
where $[n]$ is the linear order $1 \leq 2 \leq \ldots \leq n$. Or, what is the same, the category of presheaves $T: [n+1]^{op} \to Set$ with the condition that $T(0) = 1$ is terminal; the element of $T(0)$ is considered to be the root of the tree.
Indeed, we realize an explicit equivalence
by defining $\Sigma(X, F: X \to Set^{[n]^{op}})$ to be the functor $T: [n+1]^{op} \to Set$ that on the object level takes $1$ to $X$, and $i+1$ to
On the morphism level, $T(i+1 \to i)$ is the coproduct of morphisms
(and this makes sense for all $1 \leq i \leq n$ under the convention $F(x)(0) = 1$).
The morphism
used in Adámek’s theorem is identified with the restriction functor
which restricts presheaves along the inclusion $[n] \hookrightarrow [n+1]$.
The 2-limit of the diagram in Adámek’s theorem is then
aka the category of trees, where $\omega$ is the colimit of the finite ordinals $[n]$. The statement that the category of trees is equivalent to its small-coproduct cocompletion says that the category of trees is equivalent to the category of forests.
There is a category theoretic treatments of the self-similarity found in fractals in terms of terminal coalgebras, see Leinster 10, Bhattacharya-Moss-Ratnayake-Rose.
A list of notable endofunctors, and their initial algebras/terminal coalgebras.
Nonexistent (co)algebras are labelled with ‘/’, and unknown ones with ‘?’.
Base category | Endofunctor | Initial Algebra | Final Coalgebra | Note, reference |
---|---|---|---|---|
Set | Const $A$ | $A$ | $A$ | |
Set | $X \mapsto X$ | $\varnothing$ | $1$ | |
Set | $X \mapsto 1 + X$ | $\mathbb{N}$ | Conatural numbers $\mathbb{N}^\infty$ | extended natural number |
Set | $X \mapsto A + X$ | $A \times \mathbb{N}$ | $A \times \mathbb{N} + 1$, ie conatural numbers “terminated” (when they aren’t $\infty$) with $A$ | partial map classifier |
Set | $X \mapsto X + X$ or $X \mapsto 2 \times X$ | $\emptyset$ | $2^\mathbb{N}$ (i.e. one definition of Stream $2$) | |
Set | $X \mapsto A \times X$ | $\emptyset$ | $A^\mathbb{N}$ (i.e. one definition of Stream $A$) | sequence, writer monad, stream |
Set | $X \mapsto X \times X$ or $X \mapsto [2, X]$ | $\emptyset \simeq [2, \emptyset]$ | 1 (the unique infinite unlabelled binary tree) | |
Set | $X \mapsto [A, X]$ | $[A, \emptyset]$ | 1 | reader monad |
Set | $X \mapsto 1 + A \times X$ | List $A$ | another definition of Stream $A$; i.e. potentially infinite List $A$ | list, stream |
Set | $X \mapsto 1 + A \times X^2$ | Finite binary tree with $A$-labelled nodes | Potentially infinite binary tree with $A$-labelled nodes | tree |
Set | $X \mapsto B + A \times X^n$ | Finite $n$-ary tree with $A$-labelled nodes and $B$-labelled leaves | Potentially infinite $n$-ary tree with $A$-labelled nodes with and $B$-labelled leaves | |
Set | $X \mapsto O \times [I, X]$ | $O \times [I, \emptyset]$ | Potentially infinite Moore machine | |
Set | $X \mapsto [I, O \times X]$ | $[I, \emptyset]$ | Potentially infinite Mealy machine | |
Set | $X \mapsto \mathcal{P}(X)$ | / | / | |
Set | $X \mapsto \mathcal{P}_{\text{fin}}(X)$ | Finite rooted forests | Potentially infinite finitely-branching rooted forests | |
Set | polynomial endofunctor | W-type | M-type | |
Bipointed Sets | $X \mapsto X \vee X$ | dyadic rational numbers in the interval $[0,1]$ | The closed interval $[0,1] \subseteq \mathbb{R}$ | coalgebra of the real interval |
linearly ordered sets | $X \mapsto \omega \cdot X$, where $\omega \cdot X$ is the cartesian product of the natural numbers with the underlying set of $X$, equipped with the lexicographic order. | $\emptyset$ | The non-negative real numbers $\mathbb{R}_{\geq 0}$ | real number |
Archimedean ordered fields | $X \mapsto X$ the identity functor | The rational numbers $\mathbb{Q}$ | The real numbers $\mathbb{R}$ | |
Archimedean ordered fields | $X \mapsto \mathcal{D}(X)$ where $\mathcal{D}(X)$ is the Archimedean ordered field of two-sided Dedekind cuts of $X$ | The real numbers $\mathbb{R}$ | The real numbers $\mathbb{R}$ | |
Archimedean ordered fields | $X \mapsto \mathcal{C}(X)$ where $\mathcal{C}(X)$ is the quotient of Cauchy sequences in the Archimedean ordered field $X$ | The HoTT book real numbers $\mathbb{R}_H$ | The Dedekind real numbers $\mathbb{R}$ | These are the same objects in the presence of excluded middle or countable choice. |
Any category | The constant functor $X \mapsto A$ given object $A$ | $A$ | $A$ | |
Any category | The identity functor $X \mapsto X$ | initial object | terminal object | |
Any extensive category | $X \mapsto 1 + X$ given terminal object $1$ and coproduct $+$ | natural numbers object | ? | |
Any closed abelian category | $X \mapsto I \sqcup (A \otimes X)$ given tensor unit $I$, tensor product $\otimes$, coproduct $\sqcup$, and object $A$ | tensor algebra of $A$ | cofree coalgebra over $A$ | tensor algebra, cofree coalgebra |
$\infty$-Grpd | $X \mapsto \Sigma X$ | sphere spectrum $\mathbb{S}$ | ? | suspension |
Terminal coalgebras are the categorical semantics of coinductive types, for instance M-types.
Peter Freyd, Real coalgebra Mailing to the categories list, Dec. 22, 1f999. (link)
Dusko Pavlovic, Vaughan Pratt, On coalgebra of real numbers, 1999. (web)
Cross-relations between algebraic and coalgebraic aspects of real numbers may be found in this article:
For category theoretic treatments of the self-similarity found in fractals in terms of terminal coalgebras, see
Tom Leinster, A general theory of self-similarity, (arXiv:1010.4474)
Prasit Bhattacharya, Lawrence S. Moss, Jayampathy Ratnayake, and Robert Rose, Fractal Sets as Final Coalgebras Obtained by Completing an Initial Algebra, (pdf)
Last revised on January 3, 2024 at 22:23:15. See the history of this page for a list of all contributions to it.