Les Categories Pour Les Nuls

“Categories for Dummies”

Example 1:

Paris (P) -> Rome (R) -> Amsterdam (A)

Objects: cities {P, R , A…}

Morphism (Arrow)
: railway 

  • Identity: railway within the city
  • Associative: (P -> R) -> A = P -> (R ->A)

=> Category of “Euro-Rail” 

Remark: In the similar sense, China “One Belt One Road” (OBOR)” 一带一路” is a “Pan-China-Europe-Asian” Category “泛中-欧-亚” 范畴

Example 2:
A, B are categories

functor f : A -> B 

f (B) has the “information” on A, with some loss of information since f may not be a MONOMORPHISM (单射 Injective).

Remark: Technical Drawing, the views from Top , Left, Right, or Bottom of the object are Functors – which provide only 1 view from 1 direction with loss of information from 3 other directions.

Example 3: Natural Transformation

A = 0 1 2 3 

f : A -> B

B = Ladder steps:

g : A -> B

B = Staircase steps :

Natural Transformation: =>  α 

α : f (i) => g (i)

f(0)| => g(0)||
f(1)| => g(1)||
f(2)| => g(2)||
f(3)| => g(3)||

α  transforms naturally the Ladder to the Staircase.


Debate (French): Set Theory vs Category Theory


4. Category, Logic and IT

Pierre Cartier’s Key Points:

  1. The Roles of Categories in Science and Organisation of Knowledges.
  2. Homology <- cohomology (Reversed Arrow)
  3. Natural Transformation and Duality of Vector Spaces

An Introduction to N-Categories

Tom Leinster

N = 0 : 0-Cat 

  • => Set, 0-morphism = function

N= 1: 1-Cat 

  • => Cat, 1-morphism = functor

N= 2: 2-Cat 

  • => 2-morphism = Natural Transformation

\text {f, g : 1-morphism } 

\alpha \:\: \beta \text { Natural Transformations : 2-morphism } 

Definition of n-Category: 


0-Cat : Set
1-Cat : Cat

Examples of n-Categories:

  • Manifold
  • Top (Topological Space) : 2-morphism = homotopy


Best Technical Category Theory Book (2016) by Tom Leinster (Cambridge Press): “Basic Category Theory”

(Free download from arxiv)

Program = Category 

2017 : (PhD Math made simple for IT programmers)


  • Category
  • Monad = Monoid + Endofunctor
  • Lewvere Theory

Category Theory is replacing Set Theory as the foundation of Math. Nowadays, few Advanced Math papers are written without using Category to explain, and this trend is spreading to IT through Functional Programming languages (Google’s Kotlin, Haskell, Clojure…) – the latest paradigm to replace Object-Oriented languages like Java, C++, etc, as a safer “Strong Typed” languages for AI, BIG DATA…

\boxed {\text {Type = Category }}

Examples of “Types” in IT:

  • Integers
  • Real
  • Double
  • Boolean
  • String
  • etc

T-program defined in the following 6 examples:

  • list (X), eg. {2, 5 , 3, 7, 1 }
  • partial (X), eg: +1 (error msg)
  • side-effect, eg: update a record
  • continuation (X),
  • non-det (X),
  • prob-dist (X)

A Monad : a T-program which turns an arrow to a “Category” (ie + 2 properties: Identity & Associative).

Proof: List Computation is a Category

Proof: Partial operation is a Category

\boxed {\text {Monad = Lawvere Theory }}

Monad is for only one Category. Lawvere Theory is more general.


Slides: http://www.math.jhu.edu/~eriehl/compose.pdf

Excellent Intuitive Stackoverflow Answer: What is a Monad ?

Monoid and Monad

Quora: What is the difference between monoid and monad? by Mort Yao https://www.quora.com/What-is-the-difference-between-monoid-and-monad/answer/Mort-Yao?share=41115848&srid=ZyHj

A well-said, perhaps the briefest ever answer is: monad is just a monoid in the category of endofunctors.

monoid is defined as an algebraic structure (generally, a set) M with a binary operation (multiplication) • : M × M → M and an identity element (unit) η : 1 → M, following two axioms:

i. Associativity
∀ a, b, c ∈ M, (a • b) • c = a • (b • c)

ii. Identity
∃ e ∈ M ∀ a ∈ M, e • a = a • e = a

When specifying an endofunctor T : X → X (which is a functor that maps a category to itself) as the set M, the Cartesian product of two sets is just the composition of two endofunctors; what you get from here is a monad, with these two natural transformations:

1. The binary operation is just a functor composition μ : T × T → T
2. The identity element is just an identity endofunctor η : I → T

Satisfied the monoid axioms (i. & ii.), a monad can be seen as a monoid which is an endofunctor together with two natural transformations. 

The name “monad” came from “monoid” and “triad”, which indicated that it is a triple (1 functor + 2 trasformations), monoidic algebraic structure.

In other words, monoid is a more general, abstract term. When applying it to the category of endofunctors, we have a monad.


State Monad: Milewski