Three mysterious Math Objects:
- Complex Numbers,
- Prime Numbers
are hiding in circle.
[Continued from previous BM Category Theory …]
Intuition: [Artificial Intelligence] You teach the computer like to a Primary 6 kid, that Algebra is a type of expression (f) which, after evaluation, returns a value.
If a = i (initial) [or u (terminal)],
Intuition: Fix-point because, the Initial “i”, after evaluating the expression f, returns itself “i”.
Note: Endo-functor is a functor (equivalent to function in Set Theory) within the same Category (Endo = Self = 自)
Video 8.1 F-Algebras & Lambek’s Lemma
Video 8.2 Catamorphism & Anamorphism
foldr ~ catamorphism (浅层变质) of a Fix-point endo-functor on a List.
Examples: Fibonacci, Sum_List
Remark: Cool Math! the more advanced concept it is, the more closer to Nature (eg.Geology, Biology) : Catamorphism 浅层(风化)变质, or “thin-layer change in nature” (in Functional Programming languages: foldr or map) eg : add1 to a list (1 5 3 8…)
= (2 6 4 9 …)
Intuition: Reverse of Algebra, given a value, Coalgebra returns an expression (f).
Anamorphism (合成变质) ~ unfoldr
Example: Prime numbers
Remark: Anamorphism (合成变质) or “synthesised change in nature“: eg. Start from a “seed” prime number “2” generates all other infinite prime numbers (3 5 7 9 11 13 17 …)
Note: In Haskell, no difference between Initial and Terminal Fix-points. However, since Fix-point is not unique, in Category Theory there is the Least Fix-point (Initial) and Greatest Fix-point (Terminal).
Reading “Understanding F-Algebra ” by BM: https://bartoszmilewski.com/2013/06/10/understanding-f-algebras/
Catamorphism (下态) : https://www.zhihu.com/question/52180621/answer/129582557
Anamorphism : https://zhuanlan.zhihu.com/cofree/21354189
F-Algebra & F-coalgebra: http://stackoverflow.com/a/16022059/5822795
Abstract Algebra studies all kinds of mathematical structures (Group, Ring, Vector Space, Category, …) , and relationship between them if the structures are preserved after mapping.
As explained in his response, functions map sets to sets, and functions themselves form sets. This is the essence of the untyped lambda calculus. Unfortunately, untyped lambda calculus suffers from the (later simplified to .
This paradox can be removed by introducing types, as in the typed lambda calculus. Simple types are equivalent to sets, but in order to pass a function as an argument to another function (or return one), we have to give this function a type. To really understand what a function type is, you need to look into category theory.
The categorical model for the typed lambda calculus is a category in which objects are types and morphism are functions. So if you want to have higher order functions, you have to be able to represent morphisms as objects — in other words, create a type for functions. This is possible only if the category is cartesian closed. In such a category you can define product types and exponential types. The latter correspond to function types.
So that’s a mathematical explanation for higher order.