Monads 单子(Dr. Eugenia Cheng)

Dr. Eugenia Cheng ‘s Lectures on Category Theory (2007)

1. Definition of Monad,  Example: Monad for Monoids

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

Monad = Monoid + Triad

Monad = Monoid (restricted to endofunctors)

Note: She was annoyed nobody had corrected her mistake in (red) Tμ . (I discovered it only on 2nd revision view few years later).

2. Example2: Monad for Categories

Monad for Small Categories (= Set)

3. Algebra = Monad 



What is the difference between Monoid and Monad? (Bartosz Milewski )

Monad (图解)  : 单子
Functor: 函子

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.

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)

Category Theory 范畴论 : “How to Bake Pi”

Category Theory is the “Mathematics of Mathematics”, replacing the century-old Set Theory as the Foundation of Mathematics. 

Category is also the Math of Programming in the  latest IT trend “Functional Programming” for safer “Typed” software in parallel and concurrent computing.

Dr. Eugenia Cheng – Professor of Category Theory (Chicago University).

Author of the Best Selling Category Book : (for readers from 7-year-old to high school and undergraduate students):
How to Bake Pi ? – an Edible Exploration of the Mathematics of Mathematics” 

[Loan from NLB (eg. AMK Branch)]


  • Factors of 30 = {2, 3, 5, 6, 10, 15, 30} which form a Cube with these factors as the vertices.
  • Knots
  • Bach music
  • Associativity: (sugar + milk + egg ) 
  • Button cake = order 2 group (0,1)
  • Bed mattress = rotate, flip, flop
  • Icosahedral virus


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.



Excellent Intuitive Stackoverflow Answer:  What is a Monad ?

Integral Domains 整环 (Abstract Algebra)

Remember when you cancel a common factor at both sides of an equation, you must check if the factor is non-zero, otherwise you would miss some answers.

This is about Cancellation Law, related to few Number Theory Properties : 

  • Zero Divisors,
  • Integral Domain.

Origin of “Integral” => Integers

Definition of Integral Domian:

Property: Cancellation Law  



  1. Every Field is an Integral Domain.
  2. Every finite Integral Domain is a Field