Skip to content

Commit d03c2d8

Browse files
committed
adjoint
1 parent 9f13158 commit d03c2d8

26 files changed

Lines changed: 581 additions & 47 deletions

File tree

‎content/posts/adjoint.md‎

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
---
2+
title: "Products, Exponentials, and Adjoint Functors"
3+
date: 2026-04-25T12:40:59-07:00
4+
slug: 2026-04-25-adjoint
5+
type: posts
6+
draft: false
7+
tags:
8+
- Type Theory
9+
- Category Theory
10+
---
11+
12+
In category theory, you often think something is a certain type of thing but
13+
actually it turns out to also be a different type of thing. In a first
14+
introduction, it appears that functors are somehow one level higher than
15+
morphisms, because functors map morphisms to morphisms. Similarly, natural
16+
transformations should be one level higher than functors because they map
17+
functors to functors. This is true if you want to be closed-minded and sad. But
18+
it ignores a beautiful thing about category theory: it is so abstract and
19+
general that it can do category theory about itself.
20+
21+
A functor is only a morphism in the category of categories, and a natural
22+
transformation is only a morphism in a functor category. We can just keep going
23+
around and around, and nothing means anything anymore. We can also go in the
24+
opposite direction! If morphisms connect objects, are they one level higher than
25+
objects? Not at all! Certain categories contain exponentials, which are objects
26+
that somehow encapsulate the hom-set between two other objects.
27+
28+
## Exponentials
29+
30+
To gain a little more intuition for exponentials, consider the category
31+
$\textsf{Pos}$ of posets. For posets $A$ and $B$, the set $\textsf{Hom}(A,B)$ is
32+
the set of all monotone functions between them. Interestingly, we can define a
33+
partial ordering on these functions by comparing them pointwise. So
34+
$\textsf{Hom}(A,B)$ is a poset, which means it must be an object in
35+
$\textsf{Hom}$. This is an exponential object, which we denote $B^A$.
36+
37+
A brief aside on notation: I think it is very confusing. It helps me to think
38+
about the category $\textsf{Set}$, where $B^A$ denotes the set of functions from
39+
$A$ to $B$. The cardinality of this set is given by $|B^A|=|B|^{|A|}$ because
40+
each function picks an element of $B$ for each element of $A$. I think that's
41+
why this notation is used, but that doesn't mean I like it.
42+
43+
### Direct Definition
44+
45+
Before we talk about adjunctions, let's look at a slightly more straightforward
46+
definition of an exponential. We define an exponential as $(B^A, \epsilon)$
47+
where $B^A$ is the exponential object and $\epsilon : B^A \times A \rightarrow
48+
B$ is called the evaluation morphism. The requirement is that, for every $f : C
49+
\times A \rightarrow B$, there exists a unique morphism $\stackrel{\sim}{f} : C
50+
\rightarrow B^A$ such that the following commutes:
51+
{{< cd src="https://q.uiver.app/#q=WzAsMyxbMCwwLCJCXkEgXFx0aW1lcyBBIixbMCwwLDEwMCwxXV0sWzAsMiwiQyBcXHRpbWVzIEEiLFswLDAsMTAwLDFdXSxbMiwwLCJCIixbMCwwLDEwMCwxXV0sWzEsMCwiXFxzdGFja3JlbHtcXHNpbX17Zn1cXHRpbWVzIDFfQSIsMCx7ImNvbG91ciI6WzAsMCwxMDBdfSxbMCwwLDEwMCwxXV0sWzAsMiwiXFxlcHNpbG9uIiwwLHsiY29sb3VyIjpbMCwwLDEwMF19LFswLDAsMTAwLDFdXSxbMSwyLCJmIiwyLHsiY29sb3VyIjpbMCwwLDEwMF19LFswLDAsMTAwLDFdXV0=&embed" >}}
52+
The main thing that I think is confusing about this definition is the sudden
53+
appearance of $C$. This is a random third element that has nothing to do with
54+
the exponential of interest. The reason that we need it is because we want to
55+
deal with morphisms. If we turn a morphism $g:A\rightarrow B$ into an object, it
56+
is no longer a morphism. But by including $C$, we are able to retain the origin
57+
point of a morphism. With that in mind, we can think of $f$ as a two-argument
58+
function and $\stackrel{\sim}{f}$ in a vague sense as the curried version of
59+
that function. Then, all the diagram is saying is that we can always partially
60+
apply $f$ to its argument in $C$, bringing us to the exponential object, and
61+
then use our evaluation function to apply it to its argument in $A$. This is the
62+
same as just applying it to both arguments.
63+
64+
### Adjoint Functors
65+
66+
We can also think of exponentiation as the right adjoint to the cartesian
67+
product: for some fixed object $A$, $(- \times A) \dashv (-)^A$. This means that
68+
they kind of basically undo each other. Because they are adjoint functors, they
69+
must have a counit $\epsilon$, which is a natural transformation from $(-)^A
70+
\times A$ to the identity functor. In other words, given any object $B$, we can
71+
find a morphism $B^A \times A \rightarrow B$. But this is exactly the evaluation
72+
morphism at $B$.
73+
74+
## Dependent Sum and Product Types
75+
76+
This raises an interesting question. In dependent type theory, function types
77+
$B^A$ get lifted to product types $\Pi_{x\in A}B(x)$ and pairs $A \times B$ get
78+
lifted to sum types $\sum_{x \in A}B(x)$. When thinking of these as
79+
propositions, we can think of them as universal and existential quantification,
80+
respectively. These are duals to each other in logic. Is this duality an
81+
extension of the adjunction thing?
82+
83+
Well, kind of. We get the relationship $\sum \dashv \iota^* \dashv \prod$.
84+
The reason we don't get a direct adjunct relationship here is because in
85+
dependent type world, these functors bind variables. In other words, their
86+
source category is not the same as their target category, so they can't be
87+
considered as opposites.
88+
89+
The new functor $\iota^*$ is a weakening functor. Given a substitution $\iota :
90+
(\Gamma,x:A) \rightarrow \Gamma$, we get an induced map $\iota^* :
91+
\mathsf{Type}(\Gamma) \rightarrow \mathsf{Type}(\Gamma,x:A)$. We can think of
92+
this as binding another term in the context. Therefore, the adjoints have type
93+
$$
94+
\Pi,\Sigma : \mathsf{Type}(\Gamma,x:A) \rightarrow \mathsf{Type}(\Gamma)
95+
$$
96+
where the input is the type $B(x)$ from above, since it includes an additional
97+
binding for $x$.
98+
99+
<!-- There's a middle man now, in the form of the base change functor. -->
100+
<!-- That is, dependent sums are the left adjoint of the base change functor and -->
101+
<!-- dependent products are the right adjoint. So first, what is a base change -->
102+
<!-- functor? -->
103+
104+
<!-- ### Base Change Functor -->
105+
106+
<!-- To talk about a base change functor, we need to understand what bases we're -->
107+
<!-- changing between. Sometimes, it's helpful to think about a category focalized -->
108+
<!-- over a single element. For a category $C$ and object $A \in C$, the slice -->
109+
<!-- category $C/A$ is the category whose objects are morphisms in $C$ whose target -->
110+
<!-- are $A$, and whose morphisms are composable maps between these objects. For -->
111+
<!-- example, the following commuting diagram shows two objects $f$ and $f'$ with a -->
112+
<!-- morphism $g : f \rightarrow f'$. -->
113+
<!-- {{< cd src="https://q.uiver.app/#q=WzAsMyxbMSwxLCJBIixbMCwwLDEwMCwxXV0sWzAsMCwiWCIsWzAsMCwxMDAsMV1dLFsyLDAsIlgnIixbMCwwLDEwMCwxXV0sWzEsMCwiZiIsMix7ImNvbG91ciI6WzAsMCwxMDBdfSxbMCwwLDEwMCwxXV0sWzIsMCwiZiciLDAseyJjb2xvdXIiOlswLDAsMTAwXX0sWzAsMCwxMDAsMV1dLFsxLDIsImciLDAseyJjb2xvdXIiOlswLDAsMTAwXX0sWzAsMCwxMDAsMV1dXQ==&embed" >}} -->
114+
<!-- This is called a slice category because we can think about slicing up $X$ and -->
115+
<!-- $X'$ over $A$. If $C$ were the category $\mathsf{Set}$, these slices would be -->
116+
<!-- the fibers of $f$ and $f'$ over each element of $A$. -->
117+
118+
<!-- Now, given two slice categories $C/A$ and $C/B$, along with a morphism $f : A -->
119+
<!-- \rightarrow B$, we define the base change functor $f^* : C/B \rightarrow C/A$. -->
120+
<!-- This gives us the pullback -->
121+
<!-- {{< cd src="https://q.uiver.app/#q=WzAsNCxbMCwwLCJmXipFIixbMCwwLDEwMCwxXV0sWzEsMCwiRSIsWzAsMCwxMDAsMV1dLFswLDEsIkEiLFswLDAsMTAwLDFdXSxbMSwxLCJCIixbMCwwLDEwMCwxXV0sWzAsMiwiZl4qcCIsMCx7ImNvbG91ciI6WzAsMCwxMDBdfSxbMCwwLDEwMCwxXV0sWzEsMywicCIsMCx7ImNvbG91ciI6WzAsMCwxMDBdfSxbMCwwLDEwMCwxXV0sWzIsMywiZiIsMSx7ImNvbG91ciI6WzAsMCwxMDBdfSxbMCwwLDEwMCwxXV0sWzAsMSwiZyIsMSx7ImNvbG91ciI6WzAsMCwxMDBdfSxbMCwwLDEwMCwxXV0sWzAsMywiIiwxLHsiY29sb3VyIjpbMCwwLDEwMF0sInN0eWxlIjp7Im5hbWUiOiJjb3JuZXIifX1dXQ==&embed" >}} -->
122+
<!-- We won't go into all the details, but basically $f^*E$ should capture all fibers -->
123+
<!-- over $A$ that correspond to fibers over $B$. -->
124+
125+
<!-- ### Dependent Sums -->
126+
127+
So this adjoint-ness is kind of different. It makes sense, because the
128+
relationship between the two is clearly different. They contain more information
129+
in the form of their $B(x)$ types, so it no longer makes sense to think about
130+
them "undoing each other." They are just duals, meaning that they interact with
131+
binding in similar but opposite ways.
132+
133+
## Sources
134+
135+
1. [Steve Awodey's Notes on Type Theory](https://awodey.github.io/typetheory/notes/typetheory.pdf)
136+
2. [Dependent sum/product and the base-change functor adjunctions on MathOverflow](https://mathoverflow.net/questions/446516/dependent-sum-product-and-the-base-change-functor-adjunctions)
137+
3. [Andrej Bauer's Notes on Realizability](https://github.com/andrejbauer/notes-on-realizability/tree/master)
138+
4. The Dao of Functional Programming by Bartosz Milewski

‎hugo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
baseURL = 'https://ebobrow.github.io/'
2-
languageCode = 'en-us'
2+
locale = 'en-us'
33
title = "Elliot's Blog"
44
theme = 'smol'
55

‎layouts/_shortcodes/cd.html‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<div style="display:flex;justify-content:center;align-items:center">
2+
<iframe class="quiver-embed" src="{{.Get "src"}}" width="250" height="250" style="border-radius: 8px; border: none;"></iframe>
3+
</div>

‎public/about/index.html‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
<link rel="stylesheet" href="/css/style.css">
12-
<link rel="stylesheet" href="/css/custom.css?rnd=1775830129">
12+
<link rel="stylesheet" href="/css/custom.css?rnd=1777759614">
1313

1414
<script>
1515
MathJax = {
@@ -78,6 +78,8 @@ <h3>LATEST POSTS</h3>
7878
<div>
7979
<ul>
8080

81+
<li><a href="/posts/2026-04-25-adjoint/">Products, Exponentials, and Adjoint Functors</a></li>
82+
8183
<li><a href="/posts/2026-04-08-equality/">Equality in Type Theory</a></li>
8284

8385
<li><a href="/posts/2026-03-08-cbpv/">Why is it called Call-By-Push-Value?</a></li>
@@ -86,8 +88,6 @@ <h3>LATEST POSTS</h3>
8688

8789
<li><a href="/posts/type-theory/">What even is type theory?</a></li>
8890

89-
<li><a href="/posts/miu/">MU Puzzle in Automated Theorem Provers</a></li>
90-
9191
</ul>
9292
</div>
9393
</div>

‎public/categories/index.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
<link rel="stylesheet" href="/css/style.css">
12-
<link rel="stylesheet" href="/css/custom.css?rnd=1775830129">
12+
<link rel="stylesheet" href="/css/custom.css?rnd=1777759614">
1313
<link rel="alternate" type="application/rss+xml" href="/categories/index.xml" title="Elliot's Blog">
1414
<script>
1515
MathJax = {

‎public/index.html‎

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!DOCTYPE html>
22
<html lang="en-us">
33
<head>
4-
<meta name="generator" content="Hugo 0.160.0"><script src="/livereload.js?mindelay=10&amp;v=2&amp;port=1313&amp;path=livereload" data-no-instant defer></script>
4+
<meta name="generator" content="Hugo 0.161.0"><script src="/livereload.js?mindelay=10&amp;v=2&amp;port=1313&amp;path=livereload" data-no-instant defer></script>
55
<meta charset="UTF-8">
66
<meta name="viewport" content="width=device-width, initial-scale=1">
77
<meta http-equiv="X-UA-Compatible" content="IE=edge">
@@ -10,7 +10,7 @@
1010

1111

1212
<link rel="stylesheet" href="/css/style.css">
13-
<link rel="stylesheet" href="/css/custom.css?rnd=1775830314">
13+
<link rel="stylesheet" href="/css/custom.css?rnd=1777759614">
1414
<link rel="alternate" type="application/rss+xml" href="/index.xml" title="Elliot's Blog">
1515
<script>
1616
MathJax = {
@@ -54,6 +54,30 @@
5454
<main>
5555

5656

57+
<article>
58+
<h1><a href="http://localhost:1313/posts/2026-04-25-adjoint/">Products, Exponentials, and Adjoint Functors</a></h1>
59+
<b><time>25.04.2026</time></b>
60+
61+
<a href="/tags/type-theory">Type Theory</a>
62+
63+
<a href="/tags/category-theory">Category Theory</a>
64+
65+
<div>
66+
<p>In category theory, you often think something is a certain type of thing but
67+
actually it turns out to also be a different type of thing. In a first
68+
introduction, it appears that functors are somehow one level higher than
69+
morphisms, because functors map morphisms to morphisms. Similarly, natural
70+
transformations should be one level higher than functors because they map
71+
functors to functors. This is true if you want to be closed-minded and sad. But
72+
it ignores a beautiful thing about category theory: it is so abstract and
73+
general that it can do category theory about itself.</p>
74+
75+
<a href="http://localhost:1313/posts/2026-04-25-adjoint/">Read more...</a>
76+
77+
</div>
78+
</article>
79+
80+
5781
<article>
5882
<h1><a href="http://localhost:1313/posts/2026-04-08-equality/">Equality in Type Theory</a></h1>
5983
<b><time>08.04.2026</time></b>

‎public/index.xml‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,15 @@
66
<description>Recent content on Elliot&#39;s Blog</description>
77
<generator>Hugo</generator>
88
<language>en-us</language>
9-
<lastBuildDate>Wed, 08 Apr 2026 09:54:44 -0700</lastBuildDate>
9+
<lastBuildDate>Sat, 25 Apr 2026 12:40:59 -0700</lastBuildDate>
1010
<atom:link href="http://localhost:1313/index.xml" rel="self" type="application/rss+xml" />
11+
<item>
12+
<title>Products, Exponentials, and Adjoint Functors</title>
13+
<link>http://localhost:1313/posts/2026-04-25-adjoint/</link>
14+
<pubDate>Sat, 25 Apr 2026 12:40:59 -0700</pubDate>
15+
<guid>http://localhost:1313/posts/2026-04-25-adjoint/</guid>
16+
<description>&lt;p&gt;In category theory, you often think something is a certain type of thing but&#xA;actually it turns out to also be a different type of thing. In a first&#xA;introduction, it appears that functors are somehow one level higher than&#xA;morphisms, because functors map morphisms to morphisms. Similarly, natural&#xA;transformations should be one level higher than functors because they map&#xA;functors to functors. This is true if you want to be closed-minded and sad. But&#xA;it ignores a beautiful thing about category theory: it is so abstract and&#xA;general that it can do category theory about itself.&lt;/p&gt;</description>
17+
</item>
1118
<item>
1219
<title>Equality in Type Theory</title>
1320
<link>http://localhost:1313/posts/2026-04-08-equality/</link>

‎public/posts/2025-07-26-semantics/index.html‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
<link rel="stylesheet" href="/css/style.css">
12-
<link rel="stylesheet" href="/css/custom.css?rnd=1775830129">
12+
<link rel="stylesheet" href="/css/custom.css?rnd=1777759614">
1313

1414
<script>
1515
MathJax = {
@@ -225,6 +225,8 @@ <h3>LATEST POSTS</h3>
225225
<div>
226226
<ul>
227227

228+
<li><a href="/posts/2026-04-25-adjoint/">Products, Exponentials, and Adjoint Functors</a></li>
229+
228230
<li><a href="/posts/2026-04-08-equality/">Equality in Type Theory</a></li>
229231

230232
<li><a href="/posts/2026-03-08-cbpv/">Why is it called Call-By-Push-Value?</a></li>
@@ -233,8 +235,6 @@ <h3>LATEST POSTS</h3>
233235

234236
<li><a href="/posts/type-theory/">What even is type theory?</a></li>
235237

236-
<li><a href="/posts/miu/">MU Puzzle in Automated Theorem Provers</a></li>
237-
238238
</ul>
239239
</div>
240240
</div>

‎public/posts/2026-03-08-cbpv/index.html‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
<link rel="stylesheet" href="/css/style.css">
12-
<link rel="stylesheet" href="/css/custom.css?rnd=1775830129">
12+
<link rel="stylesheet" href="/css/custom.css?rnd=1777759614">
1313

1414
<script>
1515
MathJax = {
@@ -267,6 +267,8 @@ <h3>LATEST POSTS</h3>
267267
<div>
268268
<ul>
269269

270+
<li><a href="/posts/2026-04-25-adjoint/">Products, Exponentials, and Adjoint Functors</a></li>
271+
270272
<li><a href="/posts/2026-04-08-equality/">Equality in Type Theory</a></li>
271273

272274
<li><a href="/posts/2026-03-08-cbpv/">Why is it called Call-By-Push-Value?</a></li>
@@ -275,8 +277,6 @@ <h3>LATEST POSTS</h3>
275277

276278
<li><a href="/posts/type-theory/">What even is type theory?</a></li>
277279

278-
<li><a href="/posts/miu/">MU Puzzle in Automated Theorem Provers</a></li>
279-
280280
</ul>
281281
</div>
282282
</div>

‎public/posts/2026-04-08-equality/index.html‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
<link rel="stylesheet" href="/css/style.css">
12-
<link rel="stylesheet" href="/css/custom.css?rnd=1775830314">
12+
<link rel="stylesheet" href="/css/custom.css?rnd=1777759614">
1313

1414
<script>
1515
MathJax = {
@@ -285,6 +285,8 @@ <h3>LATEST POSTS</h3>
285285
<div>
286286
<ul>
287287

288+
<li><a href="/posts/2026-04-25-adjoint/">Products, Exponentials, and Adjoint Functors</a></li>
289+
288290
<li><a href="/posts/2026-04-08-equality/">Equality in Type Theory</a></li>
289291

290292
<li><a href="/posts/2026-03-08-cbpv/">Why is it called Call-By-Push-Value?</a></li>
@@ -293,8 +295,6 @@ <h3>LATEST POSTS</h3>
293295

294296
<li><a href="/posts/type-theory/">What even is type theory?</a></li>
295297

296-
<li><a href="/posts/miu/">MU Puzzle in Automated Theorem Provers</a></li>
297-
298298
</ul>
299299
</div>
300300
</div>

0 commit comments

Comments
 (0)