- F-algebra
In
mathematics , specifically incategory theory , an -algebra for anendofunctor :
is an object of together with a -
morphism :.
In this sense F-algebras are dual to
F-coalgebra s.A
homomorphism from -algebra to -algebra is a morphism:
in such that
:.
Thus the -algebras constitute a category.
Example
Consider the functor that sends a set to . Here, Set denotes the
category of sets , denotes the usualcoproduct given bydisjoint union , and 1 is a terminal object (i.e. any singleton set). Then the set ofnatural number s together with the function , which is the coproduct of the functions (whose image is "0") and (which sends an integer "n" to "n+1"), is an -algebra.Initial F-algebra
If the category of -algebras for a given endofunctor "F" has an
initial object , it is called an initial algebra. The algebra in the above example is an initial algebra. Various finitedata structures used inprogramming , such as lists and trees, can be obtained as initial algebras of specific endofunctors.Types defined by using
least fixed point construct with functor F can be regarded as an initial F-algebra, provided thatparametricity holds for the type.Philip Wadler: [http://homepages.inf.ed.ac.uk/wadler/papers/free-rectypes/free-rectypes.txt Recursive types for free!] University of Glasgow, July 1998. Draft.]See also
Universal algebra .Terminal F-coalgebra
In a dual way, similar relationship exists between notions of
greatest fixed point and terminalF-coalgebra , these can be used for allowing potentially infinite objects while maintaining strong normalization property. In the strongly normalizing Charity programming language (i.e. each program terminates in it), coinductive data types can be used achieving surprising results, e.g. defining lookup constructs to implement such “strong” functions like theAckermann function . [Robin Cockett: Charitable Thoughts ( [ftp://ftp.cpsc.ucalgary.ca/pub/projects/charity/literature/papers_and_reports/charitable.ps ps] and [ftp://ftp.cpsc.ucalgary.ca/pub/projects/charity/literature/papers_and_reports/charitable.ps.gz ps.gz] )]See also
*
Algebraic data type
*Catamorphism Notes
External links
* [http://www.cs.ut.ee/~varmo/papers/thesis.pdf Categorical programming with inductive and coinductive types] by Varmo Vene
* Philip Wadler: [http://homepages.inf.ed.ac.uk/wadler/papers/free-rectypes/free-rectypes.txt Recursive types for free!] University of Glasgow, July 1998. Draft.
* [http://tunes.org/wiki/algebra_20and_20coalgebra.html Algebra and coalgebra] from CLiki
Wikimedia Foundation. 2010.