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$ to 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.
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)