nLab
terminal coalgebra

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 α:XF(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.

Details

Given two coalgebras (x,η:xFx), (y,θ:yFy), a coalgebra map is a morphism f:xy which respects the coalgebra structures:

θf=F(f)η\theta \circ f = F(f) \circ \eta

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 Fxx. This is the dual form of a theorem discovered long ago by Lambek:

Theorem

If (x,θ:xFx) is a terminal object in the category of F-coalgebras, then θ is an isomorphism.

Proof

Define a coalgebra structure on Fx by Fθ:FxFFx. By terminality of x, there is a unique coalgebra map f:Fxx. We claim this is inverse to θ. Indeed, by how we defined the coalgebra structure on Fx, it is tautological that θ is a coalgebra map. By terminality of x again, this gives an equation of coalgebra maps:

fθ=1 x.f \circ \theta = 1_x.

On the other hand,

θf=F(f)F(θ)=F(fθ)=F(1 x)=1 Fx\theta \circ f = F(f) \circ F(\theta) = F(f \circ \theta) = F(1_x) = 1_{F x}

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:

Theorem (Adamek)

If C has a terminal object 1 and the limit L of the diagram

F 31F 2!F 21F!F1!1(1)\ldots F^3 1 \stackrel{F^2 !}{\to} F^2 1 \stackrel{F !}{\to} F 1 \stackrel{!}{\to} 1 \qquad (1)

exists in C and F preserves this limit, then the limit carries a structure of terminal coalgebra.

Proof

Let π n:LF n1 be the n th projection of the limiting cone. Then we have a cone from FL to the diagram (1) whose components are

FLFπ nF n+11F n!F n1F L \stackrel{F\pi_n}{\to} F^{n+1} 1 \stackrel{F^n !}{\to} F^n 1

and the induced map FLL to the limit is invertible by hypothesis; let θ:LFL be the inverse. We claim the coalgebra (L,θ) is terminal.

Indeed, suppose (x,η:xFx) is any coalgebra. We recursively define maps f n:xF n1: let f 0:x1 be the unique map, and

f n+1=F(f n)ηf_{n+1} = F(f_n) \circ \eta

It is easily checked by induction that these maps define a cone from x to the diagram (1), and so we get a map f:xL. (More later)