Tag. F-algebra
Notes (10)
Algebras as a displayed category algebras-displayed
Fix an endofunctor . The -algebras form a displayed category over .
Over an object , a displayed object of is a structure map
Over , a displayed morphism from to is the proposition that is an algebra homomorphism:
The total category is the category of -algebras.
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:
Coalgebras as a displayed category coalgebras-displayed
Fix an endofunctor . Coalgebras require no new construction: a coalgebra is an algebra in the opposite category. Define
a displayed category over , where is acting on the opposite category.
Concretely, over an object a displayed object is a structure map
The category of coalgebras is the opposite of the total category:
The outer opposite returns morphisms to the direction of : a morphism is a map with
The EilenbergβMoore category as a displayed category eilenberg-moore-displayed
Fix a monad on . Its EilenbergβMoore category arises in two displayed layers. The first layer is the displayed category of algebras of the underlying endofunctor.
The second layer, , is displayed over the total category . Over an algebra the displayed objects are the propositions that satisfies the monad algebra laws:
The EilenbergβMoore category is the total category of the tower:
Definition. Initial algebra initial-algebra
Fix an endofunctor . An initial -algebra, written , is an initial object of the category of algebras .
Unfolding the universal property: an initial algebra is an algebra such that every algebra admits a unique morphism satisfying
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.