<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://en.formulasearchengine.com/index.php?action=history&amp;feed=atom&amp;title=Optical_flat</id>
	<title>Optical flat - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://en.formulasearchengine.com/index.php?action=history&amp;feed=atom&amp;title=Optical_flat"/>
	<link rel="alternate" type="text/html" href="https://en.formulasearchengine.com/index.php?title=Optical_flat&amp;action=history"/>
	<updated>2026-04-14T04:23:09Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.0-wmf.28</generator>
	<entry>
		<id>https://en.formulasearchengine.com/index.php?title=Optical_flat&amp;diff=13018&amp;oldid=prev</id>
		<title>en&gt;Nick Number: sp surface WP:TYPO</title>
		<link rel="alternate" type="text/html" href="https://en.formulasearchengine.com/index.php?title=Optical_flat&amp;diff=13018&amp;oldid=prev"/>
		<updated>2014-01-22T15:51:02Z</updated>

		<summary type="html">&lt;p&gt;sp surface &lt;a href=&quot;/index.php?title=WP:TYPO&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;WP:TYPO (page does not exist)&quot;&gt;WP:TYPO&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;In [[category theory]], the concept of &amp;#039;&amp;#039;&amp;#039;catamorphism&amp;#039;&amp;#039;&amp;#039; (from [[Greek language|Greek]]: [[wikt:κατά|κατά]] = &amp;#039;&amp;#039;downwards&amp;#039;&amp;#039; or &amp;#039;&amp;#039;according to&amp;#039;&amp;#039;; [[wikt:μορφή|μορφή]] = &amp;#039;&amp;#039;form&amp;#039;&amp;#039; or &amp;#039;&amp;#039;shape&amp;#039;&amp;#039;) denotes the unique [[homomorphism]] from an [[initial algebra]] into some other algebra. The concept has been applied to [[functional programming]] as &amp;#039;&amp;#039;[[Fold (higher-order function)|folds]]&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
The dual concept is that of [[anamorphism]]. See also [[Hylomorphism (computer science)]]&lt;br /&gt;
&lt;br /&gt;
== Catamorphisms in functional programming ==&lt;br /&gt;
&lt;br /&gt;
In functional programming, a &amp;#039;&amp;#039;&amp;#039;catamorphism&amp;#039;&amp;#039;&amp;#039; is a generalization of the &amp;#039;&amp;#039;[[Fold (higher-order function)|folds]]&amp;#039;&amp;#039; on [[List (computing)|lists]] known from [[functional programming]] to arbitrary [[algebraic data type]]s that can be described as [[initial algebra]]s.&lt;br /&gt;
&lt;br /&gt;
One of the first publications to introduce the notion of a catamorphism in the context of programming was the paper “Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire”, by [[Erik Meijer (computer scientist)|Erik Meijer]] &amp;#039;&amp;#039;et al.&amp;#039;&amp;#039;[http://citeseer.ist.psu.edu/meijer91functional.html], which was in the context of the [[Squiggol]] formalism.&lt;br /&gt;
&lt;br /&gt;
The dual concept is that of [[anamorphism]]s, a generalization of &amp;#039;&amp;#039;unfolds&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
The following example is in [[Haskell (programming language)|Haskell]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;haskell&amp;quot;&amp;gt;&lt;br /&gt;
data Tree a = Leaf a&lt;br /&gt;
            | Branch (Tree a) (Tree a)&lt;br /&gt;
&lt;br /&gt;
type TreeAlgebra a r = (a -&amp;gt; r, r -&amp;gt; r -&amp;gt; r)&lt;br /&gt;
&lt;br /&gt;
foldTree :: TreeAlgebra a r -&amp;gt; Tree a -&amp;gt; r&lt;br /&gt;
foldTree (f, g) (Leaf x)     = f x&lt;br /&gt;
foldTree (f, g) (Branch l r) = g (foldTree (f, g) l) (foldTree (f, g) r)&lt;br /&gt;
&lt;br /&gt;
treeDepth :: TreeAlgebra a Integer&lt;br /&gt;
treeDepth = (const 1, \l r -&amp;gt; 1 + max l r)&lt;br /&gt;
&lt;br /&gt;
sumTree :: (Num a) =&amp;gt; TreeAlgebra a a&lt;br /&gt;
sumTree = (id, (+))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here &amp;lt;code&amp;gt;foldTree (&amp;#039;&amp;#039;f&amp;#039;&amp;#039;, &amp;#039;&amp;#039;g&amp;#039;&amp;#039;)&amp;lt;/code&amp;gt; is a &amp;#039;&amp;#039;catamorphism&amp;#039;&amp;#039; for the &amp;lt;code&amp;gt;Tree &amp;#039;&amp;#039;a&amp;#039;&amp;#039;&amp;lt;/code&amp;gt; [[abstract datatype|datatype]]; &amp;lt;code&amp;gt;treeDepth&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;sumTree&amp;lt;/code&amp;gt; are called &amp;#039;&amp;#039;algebras&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
== Catamorphisms in category theory ==&lt;br /&gt;
&lt;br /&gt;
Category theory provides the necessary concepts to give a generic definition that accounts for all initial data types (using an identification of functions in functional programming with the [[morphisms]] of the [[Category (mathematics)|category]] &amp;#039;&amp;#039;&amp;#039;Set&amp;#039;&amp;#039;&amp;#039; or some related concrete category). This was done by [[Grant Malcolm]].&amp;lt;ref&amp;gt;{{Citation |last=Malcolm |first=Grant Reynold |year=1990 |title=Algebraic Data Types and Program Transformation |url=http://cgi.csc.liv.ac.uk/~grant/PS/thesis.pdf |format=PDF |type=Ph.D. Thesis |publisher=University of Groningen}}.&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;{{Citation |last=Malcolm |first=Grant |year=1990 |title=Data structures and program transformation |periodical=Science of Computer Programming |volume=14 |issue=2-3 |pages=255–279 |doi=10.1016/0167-6423(90)90023-7}}.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Returning to the above example, consider a [[functor]] &amp;#039;&amp;#039;F&amp;#039;&amp;#039; sending &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;a + r &amp;amp;times; r&amp;lt;/code&amp;gt;.&lt;br /&gt;
An [[F-algebra|&amp;#039;&amp;#039;F&amp;#039;&amp;#039;-algebra]] for this specific case is a pair (&amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt;, &amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;&amp;lt;code&amp;gt;f1&amp;lt;/code&amp;gt;,&amp;lt;code&amp;gt;f2&amp;lt;/code&amp;gt;&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;), where &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; is an object, and &amp;lt;code&amp;gt;f1&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;f2&amp;lt;/code&amp;gt; are two morphisms defined as &amp;lt;code&amp;gt;f1: a &amp;amp;rarr; r&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;f2: r &amp;amp;times; r &amp;amp;rarr; r&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In the category of &amp;#039;&amp;#039;F&amp;#039;&amp;#039;-algebras over such &amp;#039;&amp;#039;F&amp;#039;&amp;#039;, an initial algebra, if it exists, represents a &amp;lt;code&amp;gt;Tree&amp;lt;/code&amp;gt;, or, in Haskell terms, it is &amp;lt;code&amp;gt;(Tree a, [Leaf, Branch])&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Tree a&amp;lt;/code&amp;gt; being an initial object in the category of &amp;#039;&amp;#039;F&amp;#039;&amp;#039;-algebras, there is a unique homomorphism of &amp;#039;&amp;#039;F&amp;#039;&amp;#039;-algebras from &amp;lt;code&amp;gt;Tree a&amp;lt;/code&amp;gt; to any given &amp;#039;&amp;#039;F&amp;#039;&amp;#039;-algebra. This unique homomorphism is called &amp;#039;&amp;#039;catamorphism&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
=== The general case ===&lt;br /&gt;
&lt;br /&gt;
In [[category theory]], catamorphisms are the [[categorical dual]] of [[anamorphism]]s (and anamorphisms are the categorical dual of catamorphisms).&lt;br /&gt;
&lt;br /&gt;
That means the following. &lt;br /&gt;
Suppose (&amp;#039;&amp;#039;A&amp;#039;&amp;#039;, &amp;#039;&amp;#039;in&amp;#039;&amp;#039;) is an [[Initial algebra|initial]] [[F-algebra|&amp;#039;&amp;#039;F&amp;#039;&amp;#039;-algebra]] for some [[endofunctor]] &amp;#039;&amp;#039;F&amp;#039;&amp;#039; of some [[category (mathematics)|category]] into itself.&lt;br /&gt;
Thus, &amp;#039;&amp;#039;in&amp;#039;&amp;#039; is a [[morphism]] from &amp;#039;&amp;#039;FA&amp;#039;&amp;#039; to &amp;#039;&amp;#039;A&amp;#039;&amp;#039;, and since it is assumed to be initial we know that whenever (&amp;#039;&amp;#039;X&amp;#039;&amp;#039;, &amp;#039;&amp;#039;f&amp;#039;&amp;#039;) is another &amp;#039;&amp;#039;F&amp;#039;&amp;#039;-algebra (a morphism &amp;#039;&amp;#039;f&amp;#039;&amp;#039; from &amp;#039;&amp;#039;FX&amp;#039;&amp;#039; to &amp;#039;&amp;#039;X&amp;#039;&amp;#039;), there will be a unique [[homomorphism]] &amp;#039;&amp;#039;h&amp;#039;&amp;#039; from (&amp;#039;&amp;#039;A&amp;#039;&amp;#039;, &amp;#039;&amp;#039;in&amp;#039;&amp;#039;) to (&amp;#039;&amp;#039;X&amp;#039;&amp;#039;, &amp;#039;&amp;#039;f&amp;#039;&amp;#039;), that is a morphism &amp;#039;&amp;#039;h&amp;#039;&amp;#039; from &amp;#039;&amp;#039;A&amp;#039;&amp;#039; to &amp;#039;&amp;#039;X&amp;#039;&amp;#039; such that &amp;#039;&amp;#039;h &amp;#039;&amp;#039;&amp;#039;.&amp;#039;&amp;#039;&amp;#039; in = f &amp;#039;&amp;#039;&amp;#039;.&amp;#039;&amp;#039;&amp;#039; Fh&amp;#039;&amp;#039;.&lt;br /&gt;
Then for each such &amp;#039;&amp;#039;f&amp;#039;&amp;#039; we denote by &amp;#039;&amp;#039;&amp;#039;cata&amp;#039;&amp;#039;&amp;#039; &amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;f&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039; that uniquely specified morphism &amp;#039;&amp;#039;h&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
In other words, we have the following defining relationship, given some fixed &amp;#039;&amp;#039;F&amp;#039;&amp;#039;, &amp;#039;&amp;#039;A&amp;#039;&amp;#039;, and &amp;#039;&amp;#039;in&amp;#039;&amp;#039; as above:&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt;h = \mathrm{cata}\ f&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;h \circ in = f \circ Fh&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Notation ===&lt;br /&gt;
Another notation for cata &amp;#039;&amp;#039;f&amp;#039;&amp;#039; found in the literature is &amp;lt;math&amp;gt;(\!|f|\!)&amp;lt;/math&amp;gt;. The open brackets used are known as &amp;#039;&amp;#039;&amp;#039;banana brackets&amp;#039;&amp;#039;&amp;#039;, after which catamorphisms are sometimes referred to as &amp;#039;&amp;#039;bananas&amp;#039;&amp;#039;, as mentioned in {{Harvnb|Meijer|1991}}.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
*[[Anamorphism]]&lt;br /&gt;
*[[Apomorphism]]&lt;br /&gt;
*[[Hylomorphism (computer science)|Hylomorphism]]&lt;br /&gt;
*[[Paramorphism]]&lt;br /&gt;
*[[Morphism]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{reflist|2}}&lt;br /&gt;
&lt;br /&gt;
== Further reading ==&lt;br /&gt;
* {{cite conference |url=http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.41.125&lt;br /&gt;
 |title=Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire&lt;br /&gt;
 |first1=Erik |last1=Meijer |authorlink=Erik Meijer (computer scientist)&lt;br /&gt;
 |first2=Maarten |last2=Fokkinga&lt;br /&gt;
 |first3=Ross |last3=Paterson&lt;br /&gt;
 |year=1991 |conference=Conference on Functional Programming Languages and Computer Architecture (FPCA)&lt;br /&gt;
 |publisher=Springer |pages=124-144 |isbn=3-540-54396-1&lt;br /&gt;
 |id = {{citeseerx|10.1.1.41.125}} }}&lt;br /&gt;
* {{cite conference | author1 = Ki Yung Ahn | author2 = Tim Sheard | year = 2011 | url = http://dl.acm.org/citation.cfm?id=2034807 | title = A hierarchy of mendler style recursion combinators: taming inductive datatypes with negative occurrences | booktitle = Proceedings of the 16th ACM SIGPLAN international conference on Functional programming | conference = ICFP &amp;#039;11 }}&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
* [http://www.haskell.org/haskellwiki/Catamorphisms Catamorphisms] at HaskellWiki&lt;br /&gt;
* [http://comonad.com/haskell/catamorphisms.html Catamorphisms] by Edward Kmett&lt;br /&gt;
* Catamorphisms in [[F Sharp (programming language)|F#]] (Part [http://lorgonblog.wordpress.com/2008/04/05/catamorphisms-part-one/ 1], [http://lorgonblog.wordpress.com/2008/04/06/catamorphisms-part-two/ 2], [http://lorgonblog.wordpress.com/2008/04/09/catamorphisms-part-three/ 3], [http://lorgonblog.wordpress.com/2008/05/24/catamorphisms-part-four/ 4], [http://lorgonblog.wordpress.com/2008/05/31/catamorphisms-part-five/ 5], [http://lorgonblog.wordpress.com/2008/06/02/catamorphisms-part-six/ 6], [http://lorgonblog.wordpress.com/2008/06/07/catamorphisms-part-seven/ 7]) by Brian McNamara&lt;br /&gt;
* [http://ulissesaraujo.wordpress.com/2007/12/19/catamorphisms-in-haskell/ Catamorphisms in Haskell]&lt;br /&gt;
&lt;br /&gt;
[[Category:Category theory]]&lt;br /&gt;
[[Category:Recursion schemes]]&lt;br /&gt;
[[Category:Functional programming]]&lt;br /&gt;
[[Category:Morphisms]]&lt;br /&gt;
[[Category:Iteration in programming]]&lt;/div&gt;</summary>
		<author><name>en&gt;Nick Number</name></author>
	</entry>
</feed>