Tag. F-coalgebra
Notes (6)
The co-EilenbergβMoore category as a displayed category co-eilenberg-moore-displayed
A comonad on is a monad on . Everything about its coalgebras is then inherited from the EilenbergβMoore construction, instantiated at the opposite category β nothing is defined twice.
Algebras of over are coalgebras of the underlying endofunctor, and the monad algebra laws, read in , are the comonad coalgebra laws β the unit and multiplication of , viewed in , are the counit and comultiplication :
The co-EilenbergβMoore category is the opposite of the total category:
Definition. Terminal coalgebra terminal-coalgebra
Fix an endofunctor . A terminal -coalgebra, written , is a terminal object of the category of coalgebras β equivalently, an initial algebra for .
Unfolding the universal property: a terminal coalgebra is a coalgebra such that every coalgebra admits a unique morphism satisfying
Definition. Corecursive algebra corecursive-algebra
Fix an endofunctor . An algebra is corecursive when for every coalgebra there is exactly one hylomorphism from to . Equivalently, the functor of the hylomorphism profunctor is constantly a singleton. It is the dual of a recursive coalgebra: an -algebra in is corecursive exactly when it is recursive as an -coalgebra in .
Example. If is a terminal coalgebra, then is invertible and is a corecursive algebra: a solution of is the same thing as a solution of , that is, a coalgebra map into the terminal coalgebra, and there is exactly one, .
Definition. Hylomorphism hylomorphism
Definition. The hylomorphism profunctor hylomorphism-profunctor
Fix an endofunctor . Hylomorphisms form a profunctor from coalgebras to algebras,
where is the set of with .
The action is by composition. If is a coalgebra morphism () and is an algebra morphism (), then is again a hylomorphism:
In these terms, a coalgebra is recursive when is the terminal functor, and an algebra is corecursive when is. For the inverse of an initial algebra the profunctor is representable, , and dually for a terminal coalgebra.
When every value of is a singleton, every divide-and-conquer specification over has exactly one solution. This is what local contractivity guarantees.
Definition. Recursive coalgebra recursive-coalgebra
Fix an endofunctor . A coalgebra is recursive when for every algebra there is exactly one hylomorphism from to , that is, exactly one solution of
Equivalently, the functor of the hylomorphism profunctor is constantly a singleton.
Recursiveness is a coalgebraic form of well-foundedness: decomposes each input into subproblems, and recursiveness says that every divide-and-conquer program built on this decomposition has a unique meaning, without mentioning an order on inputs. [1] use recursive coalgebras on categories of indexed families to obtain algorithms that are correct by the type of the map they compute.
Example. If is an initial algebra, then is invertible (Lambekβs lemma) and is a recursive coalgebra. Precomposing with the isomorphism , the equation is equivalent to , which says is an algebra map out of the initial algebra; there is exactly one, .
The dual notion is a corecursive algebra.