<<

Approaching the Yoneda Lemma Approaching the Yoneda Lemma @EgriNagy Introduction

“Yoneda Philosophy”

Attila Egri-Nagy Groups: definition www.egri-nagy.hu and examples

Cayley’s Theorem

Semigroups, Akita International University, JAPAN monoids From Monoids to Categories

Approaching abstract theories

LambdaJam 2019 Approaching the Yoneda Lemma Introduction @EgriNagy

Introduction “Yoneda Philosophy” “Yoneda Philosophy” Groups: definition and examples Groups: definition and examples

Morphisms

Morphisms Cayley’s Theorem

Semigroups, Cayley’s Theorem monoids From Monoids to Categories

Semigroups, monoids Approaching abstract theories From Monoids to Categories

Approaching abstract theories Approaching the Yoneda Lemma

@EgriNagy

Introduction

“Yoneda Philosophy”

Groups: definition and examples

Morphisms Introduction Cayley’s Theorem Semigroups, monoids

From Monoids to Categories

Approaching abstract theories Approaching the Who am I? Yoneda Lemma @EgriNagy

Introduction

“Yoneda Philosophy”

Groups: definition and examples

Morphisms

Cayley’s Theorem

Semigroups, monoids

From Monoids to Categories

Approaching abstract theories

Software engineer disguised as a mathematician, I working in applied computational abstract algebra, I teaching traditional math classes (often in a non-traditional way, e.g. Clojure, game of Go). Approaching the Assumptions Yoneda Lemma @EgriNagy

Introduction

“Yoneda Philosophy”

Groups: definition and examples 1. You enjoy abstractions (one example: you are a programmer); Morphisms

2. you see abstractions crucial for both programming and (so Cayley’s Theorem

they are more similar than different); Semigroups, monoids

3. therefore, you are willing to learn some math, even if it does not have From Monoids to immediate benefits to your everyday work. Categories Approaching abstract theories Approaching the Abstract vs. Concrete Yoneda Lemma @EgriNagy

Mathematics is common sense executed with precision (just the right amount of Introduction “Yoneda information), thus it can get very abstract. Philosophy”

Groups: definition “The fact is that people reason much better about familiar, everyday and examples objects and circumstances than they do about abstract objects in unfa- Morphisms miliar settings, even if the logical structure of the task is the same.” Cayley’s Theorem Semigroups, monoids Keith Devlin From Monoids to Categories

Approaching abstract theories Dealing with abstractness is a real cognitive difficulty. 1. examples are helpful 2. it also happens that a general principle is easy to understand (analogy) Approaching the The “Yoneda Philosophy” Yoneda Lemma @EgriNagy

Introduction

“Yoneda Things are defined by their relationships with other things. Philosophy” Groups: definition and examples

“tell me who your friends are, and I will tell you who you are” Morphisms

Cayley’s Theorem For a collection of cultural references: Semigroups, monoids

Guillaume Boisseau and Jeremy Gibbons: What you needa know about Yoneda: From Monoids to optics and the Yoneda lemma, Proceedings of the ACM on Categories Approaching Programming Languages Volume 2 Issue ICFP 2018, Article No. 84, abstract theories DOI10.1145/3236779 Approaching the The Yoneda Lemma Yoneda Lemma @EgriNagy

Introduction

“Yoneda Lemma Philosophy” Groups: definition and examples ∼ [C, Set](C(a, −), F ) = Fa Morphisms

Cayley’s Theorem Left: natural transformations from hom- C(a, −) to functor F . Semigroups, monoids

From Monoids to Right: F is a functor from the C into the category Set, a is an object Categories of Set. Approaching abstract theories So, a from a hom-functor to any other functor F is determined by specifying the value of F at a single object. Approaching the Can we skip it? Yoneda Lemma @EgriNagy

It’s a lemma, so it must be a minor result, right? Introduction “Yoneda Philosophy”

Groups: definition “The Yoneda lemma is perhaps the single most used result in category and examples theory.” Morphisms Cayley’s Theorem Steve Awodey: 2nd Edition, 2010. Semigroups, monoids

From Monoids to Categories

“The Yoneda lemma is arguably the most important result in category Approaching theory, although it takes some time to explore the depths of the conse- abstract theories quences of this simple statement.”

Emily Riehl: Category Theory in Context, 2016. Approaching the Wikipedia says... Yoneda Lemma @EgriNagy

Introduction

“Yoneda Philosophy”

Groups: definition and examples

The Yoneda Lemma is a vast generalisation of Cayley’s theorem from Morphisms

theory. Cayley’s Theorem

Semigroups, It allows the embedding of any category into a category of monoids From Monoids to (contravariant set-valued functors) defined on that category. Categories

Approaching abstract theories Approaching the Yoneda Lemma

@EgriNagy

Introduction

“Yoneda Philosophy”

Groups: definition and examples Groups: definition and examples Morphisms Cayley’s Theorem

Semigroups, monoids

From Monoids to Categories

Approaching abstract theories Approaching the Abstract definition Yoneda Lemma @EgriNagy Definition Introduction

A group is a set G with a binary operation · : G × G → G called multiplication “Yoneda (composition) where Philosophy” Groups: definition I associativity holds: for all x, y, z ∈ G and examples Morphisms x · (y · z) = (x · y) · z, Cayley’s Theorem Semigroups, I there exists an element called identity 1 ∈ G, such that for all x ∈ G monoids From Monoids to Categories

x · 1 = 1 · x = x, Approaching abstract theories I for all x ∈ G there exists an inverse x −1 ∈ G such that

x · x −1 = x −1 · x = 1.

Multiplication is metaphorical, not literal. Approaching the Abstract definition Yoneda Lemma @EgriNagy Definition Introduction

A group is a set G with a binary operation G × G → G called multiplication “Yoneda (composition) where Philosophy” Groups: definition I associativity holds: for all x, y, z ∈ G and examples Morphisms x(yz) = (xy)z, Cayley’s Theorem Semigroups, I there exists an element called identity 1 ∈ G, such that for all x ∈ G monoids From Monoids to Categories

x1 = 1x = x, Approaching abstract theories I for all x ∈ G there exists an inverse x −1 ∈ G such that

xx −1 = x −1x = 1.

We usually don’t waste a symbol for the operation. Approaching the Not so good examples Yoneda Lemma @EgriNagy

Introduction

“Yoneda Philosophy”

Groups: definition and examples I (Z, +) integers under addition, identity is 0, inverse for an integer is its Morphisms negative Cayley’s Theorem Semigroups, I (Q \{0}, ·) nonzero rational numbers under multiplication, identity is 1, monoids inverses are the reciprocals From Monoids to Categories

Approaching abstract theories Approaching the Symmetry as a compression tool Yoneda Lemma @EgriNagy

Introduction

“Yoneda Philosophy”

Groups: definition and examples

Morphisms

Cayley’s Theorem

Semigroups, monoids

From Monoids to Categories

Approaching abstract theories Approaching the The slogan of Yoneda Lemma @EgriNagy

Introduction

“Yoneda Philosophy”

Groups: definition and examples

Morphisms

Cayley’s Theorem

Semigroups, “Numbers measure size, groups measure symmetry.” monoids From Monoids to Categories

Approaching abstract theories

M.A.Armstrong: Groups and Symmetry, 1988. Approaching the Which one is more symmetric? Yoneda Lemma @EgriNagy

Introduction

“Yoneda Philosophy”

Groups: definition and examples

Morphisms

Cayley’s Theorem

Semigroups, monoids

From Monoids to Categories

Approaching abstract theories Approaching the Rotations as Yoneda Lemma @EgriNagy

1 Introduction “Yoneda Philosophy”

Groups: definition 1 and examples Morphisms

Cayley’s Theorem

Semigroups, monoids

2 From Monoids to 3 Categories Approaching 3 2 abstract theories

The left shape has {(), (1, 2, 3), (1, 3, 2)} = Z3. In addition the triangle has {(2, 3), (1, 3), (1, 2)} as well giving the symmetric group S3 (all permutations on 3 points). Approaching the Is there a universal representation for groups? Yoneda Lemma @EgriNagy

Introduction

“Yoneda Philosophy”

Groups: definition and examples

Morphisms

Theorem Cayley’s Theorem Every group is isomorphic to a Semigroups, monoids group. From Monoids to Categories

What is the main idea? We need a set to act on Approaching by the group, and a group is also a set. abstract theories

Arthur Cayley (1821-1895) Approaching the Everyone knows permutations Yoneda Lemma @EgriNagy

Example (Permutation composition) Introduction “Yoneda Philosophy”

1 2 3 4 5 Groups: definition and examples

Morphisms

Cayley’s Theorem

Semigroups, monoids

From Monoids to Categories

= Approaching abstract theories

(1, 2)(3, 4, 5) · (1, 2)(3, 4) = (4, 5) Approaching the Homomorphism Yoneda Lemma @EgriNagy

For programmers: this is emulation. Introduction

“Yoneda Definition Philosophy” Groups: definition A homomorphism is a map ϕ : S → T such that for all x, y ∈ S and examples

Morphisms

ϕ(x)ϕ(y) = ϕ(xy). Cayley’s Theorem

Semigroups, monoids

From Monoids to Let’s make the type inference explicit! Categories In which structure is the composition done? Approaching abstract theories (S, ·), (T , ∗),

ϕ(x) ∗ ϕ(y) = ϕ(x · y) Approaching the Yoneda Lemma

@EgriNagy

Introduction

“Yoneda Philosophy”

Groups: definition and examples

Morphisms

Cayley’s Theorem

Semigroups, monoids

From Monoids to Categories

Approaching abstract theories Approaching the Yoneda Lemma

@EgriNagy

Introduction

“Yoneda Philosophy”

Groups: definition and examples

Morphisms Cayley’s Theorem Cayley’s Theorem Semigroups, monoids

From Monoids to Categories

Approaching abstract theories Z3, the cyclic group of order 3. The symmetries of that first shape.

Approaching the An abstract group Yoneda Lemma @EgriNagy

Introduction

composition/multiplication table “Yoneda Philosophy”

Groups: definition G = {e, a, b} and examples e a b Morphisms Cayley’s Theorem e e a b Semigroups, a a b e monoids b b e a From Monoids to Categories

Approaching e.g. ea = a, ab = e,... abstract theories What is this? Approaching the An abstract group Yoneda Lemma @EgriNagy

Introduction

composition/multiplication table “Yoneda Philosophy”

Groups: definition G = {e, a, b} and examples e a b Morphisms Cayley’s Theorem e e a b Semigroups, a a b e monoids b b e a From Monoids to Categories

Approaching e.g. ea = a, ab = e,... abstract theories What is this? Z3, the cyclic group of order 3. The symmetries of that first shape. Approaching the Observing the multiplication table Yoneda Lemma @EgriNagy

The “once and only once” rule: each row an column contains all group elements. Introduction It’s a Latin square. “Yoneda Philosophy”

Groups: definition e a b and examples

e e a b Morphisms

a a b e Cayley’s Theorem

b b e a Semigroups, monoids

Why? Pick two distinct group elements g1 and g2 and multiply it by h. From Monoids to Categories Imagine that g h = g h, so two elements in a row are the same. 1 2 Approaching Then we can multiply by the inverse of h (the crucial idea): abstract theories

−1 1 g1hh = g2hh =⇒ g11 = g21 =⇒ g1 = g2

contrary what was assumed. Approaching the Yoneda Lemma

@EgriNagy

Theorem (Cayley’s) Introduction “Yoneda Every group G is isomorphic to a permutation group. Philosophy” Groups: definition and examples

Proof: For each g ∈ G, define the Rg : G → G by the mapping Morphisms x 7→ xg. Simply Rg is the mapping done by multiplying by g on the right. Cayley’s Theorem −1 −1 Rg is onto. For any y ∈ G we have Rg (yg ) = yg g = y. We can always Semigroups, I monoids have the element that yields y under R . g From Monoids to Categories I Rg is one-to-one, x1g = x2g =⇒ x1 = x2. This is the ‘once and only once Approaching rule’. abstract theories

Therefore, Rg is a bijective mapping, a permutation of G itself. Approaching the Is α : g 7→ Rg a homomorphism? Yoneda Lemma @EgriNagy

Introduction

“Yoneda Philosophy”

Pick any two group elements g1 and g2. Groups: definition and examples Rg1 ◦ Rg2 is a (composite) function and Rg1 (Rg2 (x)) = ((xg2)g1). Morphisms Due to associativity this is x(g2g1), which is Rg2g1 . Cayley’s Theorem Oops! The order got swapped. Anti-homomorphism then! Semigroups, monoids

From Monoids to R1 is the identity map, and Rg−1 ◦ Rg also gives the identity map. Categories A bijective (anti-)homomorphism is an (anti-). Approaching  abstract theories Note: we talk about two maps: Rg : G → G and α : G → SG . Approaching the What’s Yoneda-ish about Cayley’s Theorem? Yoneda Lemma @EgriNagy

Introduction

“Yoneda Philosophy”

Groups: definition and examples One group element is defined by how it acts on all the elements of the group. Morphisms Cayley’s Theorem A group is embedded into the symmetric group of all permutations of itself as a Semigroups, monoids

set. From Monoids to Categories

Approaching abstract theories Approaching the Does Cayley’s theorem give a nice representation? Yoneda Lemma @EgriNagy No. It is often possible to have permutation representations over less points than the number of group elements. (e.g. Rubik’s cube, we can de better than having Introduction “Yoneda permutations of ≈43 quintillion points) Philosophy” Groups: definition Finding minimal degree representations is not easy at all. and examples Morphisms GAP https://www.gap-system.org/ Cayley’s Theorem Semigroups, monoids

From Monoids to Categories

Approaching abstract theories SgpDec https://gap-packages.github.io/sgpdec/ Approaching the Yoneda Lemma

@EgriNagy

Introduction

“Yoneda Philosophy”

Groups: definition and examples

Morphisms Semigroups, monoids Cayley’s Theorem Semigroups, monoids

From Monoids to Categories

Approaching abstract theories Approaching the Abstract definition Yoneda Lemma @EgriNagy

Introduction Definition (semigroup) “Yoneda Philosophy” A semigroup is a set S with a binary operation S × S → S called multiplication Groups: definition (composition) where and examples Morphisms I associativity holds: for all x, y, z ∈ S Cayley’s Theorem Semigroups, x(yz) = (xy)z, monoids From Monoids to Categories there exists an element called identity 1 ∈ S, such that for all x ∈ S such I Approaching that x1 = 1x = x, abstract theories I for all x ∈ S there exists an inverse x −1 ∈ S such that xx −1 = x −1x = 1.

No identity and consequently no inverses. Approaching the Abstract definition Yoneda Lemma @EgriNagy

Introduction

“Yoneda Definition (monoid) Philosophy”

Groups: definition A monoid is a set S with a binary operation S × S → S called multiplication and examples (composition) where Morphisms I associativity holds: for all x, y, z ∈ S Cayley’s Theorem Semigroups, monoids

x(yz) = (xy)z, From Monoids to Categories there exists an element called identity 1 ∈ S, such that for all x ∈ S such Approaching I abstract theories that x1 = 1x = x, I for all x ∈ S there exists an inverse x −1 ∈ S such that xx −1 = x −1x = 1. Approaching the T2 the full transformation semigroup on 2 points (states) Yoneda Lemma @EgriNagy Abstract semigroup Introduction e f c c “Yoneda 0 1 Philosophy”

e e f c0 c1 Groups: definition and examples f f e c0 c1 Morphisms c0 c0 c1 c0 c1 Cayley’s Theorem c1 c1 c0 c0 c1 Semigroups, Transformation semigroup monoids From Monoids to Categories

e f c0 c1 Approaching abstract theories

[01] [10] [00] [11] Approaching the T2 multiplication table Yoneda Lemma @EgriNagy

Introduction

“Yoneda e f c0 c1 Philosophy” Groups: definition and examples e e f c0 c1 Morphisms Cayley’s Theorem c c Semigroups, f f e 0 1 monoids

From Monoids to Categories c0 c0 c1 c0 c1 Approaching abstract theories c1 c1 c0 c0 c1 Approaching the Everyone knows transformations Yoneda Lemma @EgriNagy

Total functions on sets Introduction

“Yoneda Example (Transformation composition) Philosophy”

Groups: definition 1 2 3 4 5 and examples Morphisms

Cayley’s Theorem

Semigroups, monoids

From Monoids to Categories

Approaching = abstract theories Approaching the Cayley’s theorem for semigroups monoids Yoneda Lemma @EgriNagy

Introduction

“Yoneda Philosophy”

Groups: definition Theorem and examples Every monoid is isomorphic to a transformation monoid. Morphisms Cayley’s Theorem Same construction, except when we show that α : x 7→ Rx is one-to-one. For all Semigroups, a, b ∈ S, monoids 1 From Monoids to aα = bα =⇒ Ra = Rb =⇒ xa = xb for all x ∈ S Categories Approaching =⇒ 1a = 1b =⇒ a = b abstract theories Approaching the From monoids to categories Yoneda Lemma @EgriNagy

Introduction

“Yoneda A monoid is a category with a single object. Philosophy” Groups: definition 1 and examples Morphisms

Cayley’s Theorem h g Semigroups, monoids

From Monoids to gh Categories

Approaching So the homo/ we talked about are degenerate functors (mapping abstract theories the single object to another single object). Approaching the Yoneda Lemma

@EgriNagy

Introduction

“Yoneda Philosophy”

Groups: definition and examples

Morphisms Approaching abstract theories Cayley’s Theorem Semigroups, monoids

From Monoids to Categories

Approaching abstract theories Approaching the Progressive Deepening Yoneda Lemma Chess players consider the same path in the search tree repeatedly after visiting @EgriNagy other branches. They go deeper and evaluate better with the help of information Introduction gained elsewhere. “Yoneda Philosophy”

Groups: definition Don’t get stuck on the same piece of the theory! and examples

Morphisms

Cayley’s Theorem

Semigroups, monoids

From Monoids to Categories

Approaching abstract theories “The wonderful thing about abstraction is that when you get very used Approaching the to an abstract idea, it starts to feel like an actual object instead of just Yoneda Lemma being a made-up idea.” @EgriNagy Introduction

Eugenia Cheng: Cakes, Custard + Category Theory, 2015. “Yoneda Philosophy”

Groups: definition and examples

Morphisms

Cayley’s Theorem

Semigroups, monoids

From Monoids to Categories

Approaching abstract theories Approaching the Yoneda Lemma

@EgriNagy

Introduction

“Yoneda Philosophy”

Groups: definition and examples

Morphisms THANK YOU! Cayley’s Theorem Semigroups, www.egri-nagy.hu @EgriNagy monoids From Monoids to Categories

Approaching abstract theories