Cmu Categorical Semantics T Theory
Cmu Categorical Semantics T Theory
Categorical Semantics
for Proof Theory
(OPLSS 2015)
Edward Morehouse
Carnegie Mellon University
June 2015
(revised June 15, 2015)
Contents
1 Basic Categories 3
1.1 Definition of a Category . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.3 Structured Sets as Categories . . . . . . . . . . . . . . . . . . . . 6
1.3.1 Discrete Categories . . . . . . . . . . . . . . . . . . . . . . 6
1.3.2 Preorder Categories . . . . . . . . . . . . . . . . . . . . . 6
1.3.3 Monoid Categories . . . . . . . . . . . . . . . . . . . . . . 7
1.3.4 Categories of Propositions and Derivations . . . . . . . . 8
1.4 Categories of Structured Sets . . . . . . . . . . . . . . . . . . . . 9
1.4.1 The Category of Sets . . . . . . . . . . . . . . . . . . . . . 9
1.4.2 The Category of Preorders . . . . . . . . . . . . . . . . . 9
1.4.3 The Category of Monoids . . . . . . . . . . . . . . . . . . 9
1.5 Categories of Categories . . . . . . . . . . . . . . . . . . . . . . . 10
1.5.1 Functors . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.5.2 The Special Role of Sets . . . . . . . . . . . . . . . . . . . 12
1.6 New Categories from Old . . . . . . . . . . . . . . . . . . . . . . 14
1.6.1 Product Categories . . . . . . . . . . . . . . . . . . . . . . 14
1.6.2 Subcategories . . . . . . . . . . . . . . . . . . . . . . . . . 15
1.6.3 Opposite Categories . . . . . . . . . . . . . . . . . . . . . 15
1.6.4 Arrow Categories . . . . . . . . . . . . . . . . . . . . . . . 16
1.6.5 Slice Categories . . . . . . . . . . . . . . . . . . . . . . . . 18
2 Behavioral Reasoning 21
2.1 Monic and Epic Morphisms . . . . . . . . . . . . . . . . . . . . . 21
2.1.1 Monomorphisms . . . . . . . . . . . . . . . . . . . . . . . 21
2.1.2 Epimorphisms . . . . . . . . . . . . . . . . . . . . . . . . 23
2.2 Split Monic and Epic Morphisms . . . . . . . . . . . . . . . . . . 24
2.3 Isomorphisms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
3 Universal Constructions 27
3.1 Terminal and Initial Objects . . . . . . . . . . . . . . . . . . . . . 27
3.1.1 Terminal Objects . . . . . . . . . . . . . . . . . . . . . . . 27
3.1.2 Preliminary Interpretation of Truth . . . . . . . . . . . . 29
3.1.3 Global and Generalized Elements . . . . . . . . . . . . . . 29
i
ii CONTENTS
5 Dependency 79
5.1 Indexed Categories . . . . . . . . . . . . . . . . . . . . . . . . . . 79
5.1.1 Set Indexed Set Families . . . . . . . . . . . . . . . . . . . 79
5.1.2 Catgory Indexed Set Families . . . . . . . . . . . . . . . . 79
5.1.3 Catgory Indexed Category Families . . . . . . . . . . . . . 80
5.2 Interpretation of Predicate Logic . . . . . . . . . . . . . . . . . . 81
5.2.1 Interpretation of Terms . . . . . . . . . . . . . . . . . . . 81
5.2.2 Interpretation of Predicates . . . . . . . . . . . . . . . . . 83
5.3 Interpretation of Quantification . . . . . . . . . . . . . . . . . . . 84
5.3.1 Universal Quantification . . . . . . . . . . . . . . . . . . . 85
5.3.2 Existential Quantification . . . . . . . . . . . . . . . . . . 87
5.3.3 Substitution Compatibility . . . . . . . . . . . . . . . . . 90
Introduction
Category theory can be thought of as a sort of generalized set theory, where the
primitive concepts are those of set and function, rather than set and member-
ship. This shift of perspective allows categories to more directly describe many
structures, even those that are not particularly set-like. The primitive concept
of set generalizes to that of object, and function to morphism.
The only assumption that we make about these generalized functions is that
they support a composition structure, whereby any configuration of compatible
morphisms can be combined to yield a new morphism, and this operation is
associative in the sense that the details of how we go about combining parts
into a whole doesn’t matter, only the configuration of those parts does.
This is reminiscent of many aspects of our physical world. When we build
a castle out of Lego bricks, the order in which we assembled the bricks is not
recorded anywhere in the finished product, only their configuration with respect
to one another remains.
By beginning from very few assumptions, category theory permits a great deal
of axiomatic freedom. Additional postulates (e.g. the axiom of choice) can then
be selectively reintroduced in order to characterize a particular object theory of
interest (e.g. set theory).
Because categorical characterizations are based on the concepts of object and
morphism, they must describe their subjects behaviorally or externally, rather
than structurally or internally: in category theory we can’t pin down what the
objects of our study actually are, only how they relate to one another. In this
sense, category theory is the sociology of formal systems.
For example, we will see how we can characterize the cartesian product once and
for all using a universal property. This allows us to describe cartesian products of
sets, of groups, of topological spaces, of types, of propositions, and of countless
other things, all in one fell swoop, rather than on a tedious case-by-case basis.
1
2 CONTENTS
the derivations of proof theory as the morphisms of a category, and how the
meta-theory of that proof theory – which depends on the type of logic under
consideration – determines the type of category in which these morphisms live.
It will emerge that there is a structural isomorphism, similar to the celebrated
Curry-Howard correspondence, between proof theory and category theory (as
well as between type theory and category theory, but that’s a story for another
time). Further, we will see that category theory provides the means to unify
the proof theoretic behavior of the various logical connectives within a common
algebraic framework.
Chapter 1
Basic Categories
3
4 CHAPTER 1. BASIC CATEGORIES
𝑓 ⋅ id(B) = 𝑓
1.2 Diagrams
𝑓 𝑔
A B C
We may represent equations between arrows using diagrams as well. We say that
a diagram is commuting or “commutes” if the composites of parallel paths
depicted in the diagram are equal. For example, the fact that all pairs of
composable arrows have a unique composite gives us commuting composition
triangles, such as:
𝑓 B 𝑔
A C
𝑓 ⋅𝑔
𝑔1
𝑓 ℎ
A B C D
𝑔2
A 𝑓 ⋅𝑔
id 𝑓 A C
ℎ
A 𝑓 B and 𝑔
𝑓
𝑓 id B D
B 𝑔⋅ℎ
6 CHAPTER 1. BASIC CATEGORIES
In the diagram for unitality (left), the triangles representing the left and right
unit laws have been pasted along a common edge. In the diagram for associa-
tivity (right), each of the two composition triangles is whiskered by an arrow (ℎ
and 𝑓, respectively), and the resulting diagrams are pasted together along their
common boundary (𝑓 ⋅ 𝑔 ⋅ ℎ).
In the graphical language of diagrams, any node representing an object may be
duplicated and the two copies joined by an edge representing the appropriate
identity morphism. Conversely, any edge representing an identity morphism
may be collapsed, identifying the two nodes at its boundary, which necessarily
represent the same object.
Except for the sake of emphasis, we generally omit composite arrows (including
identitites, which are nullary composites) when drawing diagrams, because their
existence may always be inferred. Notice that the associative law for composi-
tion is built into the graphical language of diagrams by the fact that there is no
graphical representation for the bracketing of the arrows in a path.
In order to avoid gratuitously naming objects in diagrams, we will represent an
anonymous object as a dot (“●”). Two such dots occurring in a diagram need
not represent the same object.
The most trivial possible category has nothing in it. It is called the empty
category, and written “𝟘”. Despite having completely uninteresting structure,
we will see that this category nevertheless has a very interesting property.
Only slightly less trivially, we can consider a category with just a single object,
call it “⋆”, and no arrows other than the required identity. This describes a
singleton category, typically written “𝟙”. This category will turn out to have
a very interesting property as well.
Generalizing a bit, we can regard any set as a category. As a category, a set has
its members as objects and no arrows other than the required identities. Such
categories are called discrete.
{𝑥 ≤ 𝑦} if 𝑥 ≤ 𝑦
arrows ℙ (𝑥 → 𝑦) ≔ {
∅ otherwise
identities id(𝑥) ≔ 𝑥≤𝑥
composition 𝑥 ≤ 𝑦 ⋅ 𝑦 ≤ 𝑧 ≔ 𝑥≤𝑧
In other words, a preordered set is a category in which each hom collection is
either empty, or else a singleton; and a hom is inhabited just in case its domain
is less than or equal to its codomain according to the order relation.
A preorder need not have anything to do with our usual notion of order on a
set. For example, the integers with the “divides” relation, (ℤ, |) is a perfectly
good preordered set in which 2 ≤ −2, and also −2 ≤ 2, and yet 2 ≠ −2.
In a preorder category the unit and associative laws of composition are trivially
satisfied by the fact that all elements of a singleton or empty set are equal. In
fact, every diagram in a preorder category must commute! Preorder categories
are sometimes called “thin”.
The simplest preorder category that is not discrete has two distinct objects and
a single non-identity arrow from one to the other. It looks like this:
● ●
𝑥 ⋆ 𝑧
⋯
8 CHAPTER 1. BASIC CATEGORIES
The unit and associative laws of composition are satisfied by the corresponding
laws for the monoid operation.
If we wanted to make the simplest possible monoid category that is not discrete,
we would have to think about what it means to be simple. We can begin
by postulating a single non-identity arrow, 𝑠 ∶ ⋆ ⟶ ⋆. But because 𝑠 is an
endomorphism, we must say what 𝑠 ⋅ 𝑠, 𝑠 ⋅ 𝑠 ⋅ 𝑠, and in general, 𝑠(𝑛) are. One
possibility is to introduce no relations. This gives us the free monoid on one
generator, better known as (ℕ , + , 0).
Although we are not yet in a position to give the details, we can sketch the
outline of the sort of category we will use to interpret aspects of proof the-
ory. The objects of such a category will be interpretations of propositions, and
more generally, of propositional contexts. The arrows will be interpretations of
derivations. For a derivation,
Γ
𝒟
A
we will have ⟦𝒟⟧ ∶ ⟦Γ⟧ ⟶ ⟦A⟧.
Identity morphisms will be interpretations of identity derivations. These are
derivations in which the inhabitant of a singleton set of premises is identically
the conclusion; in other words, derivations comprised of no inference rules at
all. Syntactically, they look just like propositions.
id(⟦A⟧) ≔ ⟦A⟧
Γ
𝒟
ℰ
⟦𝒟⟧ ⋅ ⟦ℰ⟧ ≔ interpretation of A
We will fill in the details of how the interpretations of contexts and connectives
work as we go along.
In addition to (structured) sets as categories, we also have categories of (struc-
tured) sets.
1.4. CATEGORIES OF STRUCTURED SETS 9
There is a category of sets, called “Set”, whose objects are sets and whose
arrows are functions between them. Not surprisingly, we take function com-
position for the composition of arrows and identity functions for the identity
arrows. That is, given composable functions 𝑓 and 𝑔,
𝑓 ⋅𝑔 ≔ λ𝑥 . 𝑔(𝑓(𝑥)) and id ≔ λ𝑥 . 𝑥
In order to conclude that this is a category we (i.e. you) must check that the
composition of monotone functions is again monotone, and that the identity
functions are monotone. You just checked that function composition is asso-
ciative and has identity functions as units, so since monotone functions are
functions, you need not check associativity and unitality again for the special
case.
The category of monoids, Mon, has monoids as objects and monoid homo-
morphisms as arrows. A monoid homomorphism is a function between the
underlying sets of the monoids that respects the operations and units:
1.5.1 Functors
Recall that a category has collections of objects and arrows, together with an
(associative and unital) composition structure. It is precisely this composition
structure that we want an arrow between categories to preserve.
Definition 1.5.1.1 (functor) Given two categories ℂ and 𝔻, a functor F with
domain ℂ and codomain 𝔻 consists of:
• a function on objects, F0 ∶ ℂ0 ⟶ 𝔻0 ,
• a function on arrows, F1 ∶ ℂ1 ⟶ 𝔻1 ,
which respects the boundaries of arrows:
B F(B)
𝑓 𝑔 F F(𝑓) F(𝑔)
⟼
A C F(A) F(C)
𝑓 ⋅𝑔 F(𝑓 ⋅ 𝑔)
1.5. CATEGORIES OF CATEGORIES 11
Equivalently, we could take the unbiased point of view and say that a functor
respects the composition of arbitrary paths of arrows.
Functors provide a notion of morphism of categories. So we can ask about
their composition structure as well. Because functors are defined in terms of
functions, their composition structure is easy to define.
Definition 1.5.1.2 (identity functor) Given any category ℂ we can define the
identity functor on ℂ, id(ℂ) ∶ ℂ ⟶ ℂ, comprising identity functions on both
objects and arrows:
ℂ∶ id ℂ∶
A A
𝑓 𝑓
B B
ℂ∶ F 𝔻∶ G
𝔼∶
A F(A) (G ∘ F)(A)
𝑓 F(𝑓) (G ∘ F)(𝑓)
B F(B) (G ∘ F)(B)
ℂ (X → –)
ℂ ⟶ Set
A ⟼ ℂ (X → A)
𝑓 ∶A⟶B ⟼ ℂ (X → 𝑓) ≔ – ⋅ 𝑓 ∶ ℂ (X → A) ⟶ ℂ (X → B)
ℂ (X → id(A))
= [definition of representable functor]
λ 𝑎 . 𝑎 ⋅ id(A)
= [composition unit law]
λ𝑎.𝑎
= [definition of identity function]
id(ℂ (X → A))
ℂ (X → 𝑓 ⋅ 𝑔)
= [definition of representable functor]
λ𝑎.𝑎⋅𝑓 ⋅𝑔
= [β-expansion]
λ 𝑎 . (λ 𝑏 . 𝑏 ⋅ 𝑔)(𝑎 ⋅ 𝑓)
= [β-expansion]
λ 𝑎 . (λ 𝑏 . 𝑏 ⋅ 𝑔)((λ 𝑎 . 𝑎 ⋅ 𝑓)(𝑎))
= [definition of function composition]
(λ 𝑎 . 𝑎 ⋅ 𝑓) ⋅ (λ 𝑏 . 𝑏 ⋅ 𝑔)
= [definition of representable functor]
ℂ (X → 𝑓) ⋅ ℂ (X → 𝑔)
Because of the special role of the category of sets, the study of representable
functors provides one of several, ultimately equivalent, ways of understanding
categories. Due to our choice of emphasis and time constraints, it is not the one
we will pursue here, but it is worth being aware of.
14 CHAPTER 1. BASIC CATEGORIES
Now that we have met a few categories, let’s look at some ways to create new
categories out of them.
Given two categories, we may construct from them a new category whose con-
stituent parts are just ordered pairs of the respective parts of the original cate-
gories.
Definition 1.6.1.1 (product category) For categories ℂ0 and ℂ1 , define the
product category ℂ0 × ℂ1 to have the following structure:
objects (ℂ0 × ℂ1 )0 ≔ {(A0 , A1 ) | A𝑖 ∶ ℂ𝑖 }
arrows (ℂ0 × ℂ1 ) ((A0 , A1 ) → (B1 , B1 )) ≔ {(𝑓0 , 𝑓1 ) | 𝑓𝑖 ∶ ℂ𝑖 (A𝑖 → B𝑖 )}
identities id((A0 , A1 )) ≔ (id(A0 ) , id(A1 ))
composition (𝑓0 , 𝑓1 ) ⋅ (𝑔0 , 𝑔1 ) ≔ (𝑓0 ⋅ 𝑔0 , 𝑓1 ⋅ 𝑔1 )
Note that we have not broken our promise to define products behaviorally,
we have merely introduced a purely formal gadget called the “product of two
categories” that we will make use of in subsequent constructions. Soon, however,
we will be in a position to prove that this gadget does in fact have the universal
property of a product.
1.6.2 Subcategories
Just as we may restrict our attention to a subset of a given set, we may single
out a substructure of a category as well. However, since a category has more
structure than a set, we must check that the substructure in question remains
a category.
Definition 1.6.2.1 (subcategory) Given a category ℂ, we may take a subcat-
egory 𝔻 of ℂ, written “𝔻 ⊆ ℂ” by taking for 𝔻0 a subcollection of ℂ0 and for
𝔻1 a subcollection of ℂ1 , subject to the restrictions:
• if 𝑓 ∶∶ ℂ is in 𝔻1 then ∂− (𝑓) and ∂+ (𝑓) are in 𝔻0 .
• if 𝑓 , 𝑔 ∶∶ ℂ are in 𝔻1 and are composable in ℂ then 𝑓 ⋅ 𝑔 is in 𝔻1 .
• if A ∶ ℂ is in 𝔻0 then id(A) is in 𝔻1 .
The composition structure of arrows when interpreted in 𝔻 is the same as in ℂ.
The restrictions are necessary to ensure that the subcollections of ℂ0 and ℂ1
we choose do, in fact, form a category.
1.6. NEW CATEGORIES FROM OLD 15
Recall that each arrow in a category has two boundary objects, its domain and
codomain. Systematically swapping these gives rise to an involutive relation on
categories.
Definition 1.6.3.1 (opposite category) To any category ℂ, there corresponds
an opposite category, ℂ° (pronounced “ℂ-op”), having:
objects ℂ°0 ≔ ℂ0
arrows ℂ° (A → B) ≔ ℂ (B → A)
composition 𝑓 ⋅ 𝑔 ∶∶ ℂ° ≔ 𝑔 ⋅ 𝑓 ∶∶ ℂ
Exercise 1.6.3.2 Check that an opposite category satisfies the unit and asso-
ciative laws of composition, and that the opposite of an opposite category is
just the original category.
Despite being simple and purely formal, the op-construction is very useful. Be-
cause it is an involution (for any category ℂ, we have that (ℂ°)° = ℂ), op is
called a duality.
Functors respect the op duality in the sense that whenever we have a functor
F ∶ ℂ ⟶ 𝔻, we automatically also have the functor F° ∶ ℂ° ⟶ 𝔻°. F° is really
just the same functor as F, it merely lets the categories on its boundary imagine
that their arrows are going the other way round.
Identity ℂ→ -arrows are the commuting ℂ-squares with two opposite sides the
same arrow and the other two opposite sides identity arrows. Composition in
ℂ→ is the pasting of commuting squares in ℂ:
id 𝑖 𝑘
A A A C E
𝑓 𝑓 𝑓 𝑔 ℎ
B B B D F
id 𝑗 𝑙
We begin with (ℂ→ )→ -objects 𝑓 and 𝑔, which are actually the ℂ→ -arrows from 𝑎
to 𝑏 and from 𝑐 to 𝑑, respectively. These, in turn, are the ℂ-commuting squares
shown on the left and right of diagram (1.2). Now (ℂ→ )→ -arrows between these
will be ℂ→ -arrows between their domains and codomains, 𝑖 and 𝑗, which are
the ℂ-commuting squares shown on the top and bottom. But there is also the
condition that 𝑖⋅𝑔 = 𝑓 ⋅𝑗 in ℂ→ . Composition in ℂ→ is pasting in ℂ, and equality
of arrows in ℂ→ is just pairwise equality in ℂ. So we need that 𝑖0 ⋅𝑔0 = 𝑓0 ⋅𝑗0 and
𝑖1 ⋅ 𝑔1 = 𝑓1 ⋅ 𝑗1 in ℂ, making the back and front faces commute. In other words,
the top and bottom commuting ℂ-squares form a (ℂ→ )→ -arrow between the
left and right commuting ℂ-squares just in case the front and back ℂ-squares
commute as well. Then all the paths shown in diagram (1.2) commute. So
(ℂ→ )→ -arrows are ℂ-commuting cubes.
The arrow category construction provides us with three important functors, that
in a sense “mediate between dimensions”. These are the domain, codomain
and reflexivity functors:
𝑑𝑜𝑚 𝑐𝑜𝑑
ℂ→ ⟶ ℂ ℂ→ ⟶ ℂ
𝑓 ∶∶ ℂ ⟼ ∂− (𝑓) 𝑓 ∶∶ ℂ ⟼ ∂+ (𝑓)
(𝑖 , 𝑗) ⟼ 𝑖 (𝑖 , 𝑗) ⟼ 𝑗
𝑟𝑒𝑓𝑙
ℂ ⟶ ℂ→
A ⟼ id(A)
𝑓 ⟼ (𝑓 , 𝑓)
18 CHAPTER 1. BASIC CATEGORIES
We will see later that these functors play an important role in the higher-
dimensional structure of categories, but for now we will use the codomain functor
to construct another important new category from old.
𝑥 𝑦
𝑥 𝑦 𝑥⋅𝑓 𝑦⋅𝑓
A B
𝑓
Behavioral Reasoning
2.1.1 Monomorphisms
19
20 CHAPTER 2. BEHAVIORAL REASONING
It may seem that we’ve just made things worse by introducing two extraneous
functions, but now we can use the fact that two functions are equal just in
case they agree on all points to rephrase this again, doing away with the points
entirely. So a function 𝑝 is monic if:
∀ 𝑓 ,𝑔 ∶W→X.𝑓 ⋅𝑝 =𝑔⋅𝑝 ⊃ 𝑓 =𝑔
𝑓 ⋅𝑚 = 𝑔⋅𝑚 implies 𝑓 = 𝑔
Notice that we are being a bit economical here: in order for 𝑓 and 𝑔 to be
composable with 𝑚, they must be coterminal, and in order for their composites
with 𝑚 to be equal, they must also be coinitial. So the definition is only applical
to parallel 𝑓 and 𝑔 composable with 𝑚, but all that can be inferred.
In diagrams, monomorphisms are conventionally drawn with a tailed arrow:
“↣”.
Lemma 2.1.1.2 (monics and composition)
• Identity morphisms are monic.
• Composites of monics are monic.
• If the composite 𝑚 ⋅ 𝑛 is monic then so is 𝑚.
Proof.
𝑓
M N
𝑚 𝑛
A
2.1.2 Epimorphisms
Using the op duality, we can define the property dual to that of being monic.
You should check that this amounts to the following:
Definition 2.1.2.1 (epimorphism) An arrow 𝑒 ∶∶ ℂ is an epimorphism (or
“epic”) if it is pre-cancelable. That is, if for any arrows 𝑓 , 𝑔 ∶∶ ℂ,
This corresponds to the fact that a surjective function doesn’t miss any points in
its codomain, so if 𝑝 ∶ X ⟶ Y is surjective then for any parallel 𝑓 , 𝑔 ∶ Y ⟶ Z,
Monic and epic morphisms have other unsatisfactory properties, for example,
they are not necessarily preserved by functors (the existence of a forgetful functor
from monoids to sets, together with the last result implies this).
It would be perverse to name them this way unless split monics were monic and
split epics were epic, which indeed they are.
Lemma 2.2.0.5 A split monomorphism is a monomorphism (and a split epi-
morphism is an epimorphism).
𝑓 ⋅𝑠=𝑔⋅𝑠
⟹ [whiskering]
𝑓 ⋅𝑠⋅𝑟 =𝑔⋅𝑠⋅𝑟
⟹ [assumption]
𝑓 ⋅ id = 𝑔 ⋅ id
⟹ [composition unit law]
𝑓 =𝑔
F(𝑠) ⋅ F(𝑟)
= [functors preserve composition]
F(𝑠 ⋅ 𝑟)
= [assumption]
F(id)
= [functors preserve identities]
id
So F(𝑠) is split-monic.
𝑓∗
B ⟶ ℘(E) ↪ Set
𝑏 ⟼ {𝑒 ∈ E | 𝑓(𝑒) = 𝑏}
And given a family of sets, {E𝑏 }𝑏∈B , which is just an function B ⟶ Set, we can
define a function ∫ E𝑏 ⟶ B mapping 𝑒 ∈ E𝑏 ⟼ 𝑏. These two constructions
𝑏∈B
are inverse, they both just sort the elements of E by those in B:
E ● ● ● ● ● ℘(E)
𝑓 𝑓∗
B ● ● ● B
The axiom of choice states that if for each 𝑏 ∈ B the set 𝑓 ∗ (𝑏) is non-empty
then there is a way to choose from E a family of elements {𝑒𝑏 }𝑏∈B such that
∀𝑏 ∈ B . 𝑓(𝑒𝑏 ) = 𝑏 – i.e. such that there is a function 𝑠 ∶ B ⟶ E with
𝑠 ⋅ 𝑓 = id(B). Notice that the condition that the sets 𝑓 ∗ (𝑏) be non-empty is
equivalent to the requirement that 𝑓 be a surjection. So the axiom of choice
asserts that in the category Set, every epimorphism is split!
This is a behavioral characterization of a property that we may ask whether a
given category satisfies. For example, because the inclusion (ℕ,+,0) ↪ (ℤ,+,0)
is epic in the category Mon, it fails to hold there.
24 CHAPTER 2. BEHAVIORAL REASONING
2.3 Isomorphisms
When we have arrows 𝑠 ∶ A ⟶ B and 𝑟 ∶ B ⟶ A such that 𝑠 ⋅ 𝑟 = id(A) we say
that 𝑠 is a section of 𝑟 and that 𝑟 is a retraction of 𝑠. So being split monic
means having a retraction, and being split epic means having a section.
Lemma 2.3.0.7 If a morphism has both a section and a retraction then the
section and the retraction are identical.
id
𝑠
B A 𝑓 B A
𝑟
id
Universal Constructions
In the category Set, a singleton set S has the property that given any set X
there is a unique function from X to S, namely, the constant function on the
only element of S. This is a behavioral characterization that we may state in
an arbitrary category.
Definition 3.1.1.1 (terminal object) In any category, a terminal object is an
object T with the property that for any object X there is a unique morphism
𝑥 ∶ X ⟶ T.
We write “!(X)” for the unique map from an object X to a terminal object and
refer to it as a bang map.
25
26 CHAPTER 3. UNIVERSAL CONSTRUCTIONS
Proof. Suppose that T and R are two terminal objects in a category. By as-
sumption, there are unique arrows 𝑡 ∶ T ⟶ R and 𝑟 ∶ R ⟶ T and:
𝑡⋅𝑟 ∶T⟶T
= [T is terminal]
!(T) ∶ T ⟶ T
= [identity expansion for terminals]
id(T) ∶ T ⟶ T
R
𝑡 𝑟
!
T T
id
𝑖
Y X
! !
1
⟦⊤⟧ ≔ 1
⟦⊤+⟧ ≔ !(⟦–⟧)
Truth has no elimination rule. We will interpret the rest of the proof theoretic
features of truth, and of the other connectives of intuitionistic first-order logic, in
a uniform way once we have established some more category theoretic machinery.
In Set, there is a bijection between the elements of a set X and the functions
from a singleton set to X: to each 𝑥 ∈ X there corresponds the unique function
⌜𝑥⌝ ∶ 1 ⟶ X mapping ⋆ ⟼ 𝑥. We can use this behavioral characterization to
define an analogue for set membership.
28 CHAPTER 3. UNIVERSAL CONSTRUCTIONS
In Set, we can determine whether or not two functions are the same by probing
them with points because two parallel functions 𝑓 , 𝑔 ∶ Set (X → Y) are defined
to be the same if ∀𝑥 ∈ X . 𝑓(𝑥) = 𝑔(𝑥). This is the principle of function
extensionality. Here is a categorical analogue:
Definition 3.1.3.3 (well-pointed category) A category with a terminal object
is well-pointed if for every 𝑓 , 𝑔 ∶ A ⟶ B, and global element 𝑎 ∶ 1 ⟶ A ,
0
¡ ¡
X Y
𝑖
In Set, the empty set is initial. Likewise, in Cat, the empty category is. In
Mon, the trivial monoid is initial as well as terminal. (An object which is both
terminal and initial is known as a null object.)
Exercise 3.1.4.5 Dualize exercise 3.1.1.5 by working out what an initial object
is in the category PreOrd, and determine when a preordered set, as a category,
has an initial object.
⟦⊥⟧ ≔ 0
⟦⊥−† ⟧ ≔ ¡(⟦–⟧)
3.2 Products
The cartesian product of two sets is defined to be the set of their ordered pairs:
π0 ∶ A × B ⟶ A and π1 ∶ A × B ⟶ B
1 Actually, we are brushing something under the rug here having to do with contexts. But
since we haven’t talked about those yet, we’ll just leave it lurking there for now, and revisit
the issue later.
30 CHAPTER 3. UNIVERSAL CONSTRUCTIONS
such that
π0 (𝑎 , 𝑏) = 𝑎 and π1 (𝑎 , 𝑏) = 𝑏
𝑐 = (π0 𝑐 , π1 𝑐)
So having a pair of elements, one from the set A and one from the set B, is the
same thing as having a single element of the set A × B: given an 𝑎 ∈ A and
𝑏 ∈ B we make an element of A × B by forming the tuple (𝑎 , 𝑏), and given an
element 𝑐 ∈ A × B we recover an A and a B by taking the projections.
Because not every category is well-pointed – or for that matter, even has a
terminal object – to obtain a behavioral characterization of a product we need
to generalize this description using, appropriately, generalized elements.
Definition 3.2.1.1 (product of objects) In any category, a (cartesian) product
of objects A and B is a span on A and B,
𝑝0 𝑝1
A⟵P⟶B
𝑥0 𝑥1
𝑡
A P B
𝑝0 𝑝1
This says that there is a bijection between ordered pairs of maps (𝑥0 , 𝑥1 ) and
single maps 𝑡 such that the diagram commutes. We call A and B the factors of
the product, 𝑝0 and 𝑝1 its (coordinate) projections and 𝑡 the tuple of 𝑥0 and
𝑥1 and write it as “⟨𝑥0 , 𝑥1 ⟩”.
Let’s see what we can learn by probing a product with itself by choosing X ≔ P
and (𝑥0 , 𝑥1 ) ≔ (𝑝0 , 𝑝1 ).
Lemma 3.2.1.2 (identity expansion for products) If P is a product of A and B
with projections 𝑝0 and 𝑝1 , then ⟨𝑝0 , 𝑝1 ⟩ = id(P).
that, 𝑡 ⋅ 𝑝0 = 𝑝0 and 𝑡 ⋅ 𝑝1 = 𝑝1 :
𝑝0 𝑝1
⟨𝑝0 , 𝑝1 ⟩
A P B
𝑝0 𝑝1
but by the left unit law of composition, id(P) has this property.
𝑝0 𝑝1
𝑠
A Q B
𝑞0 𝑞1
𝑡
𝑝0 𝑝1
Note that unlike the case with terminal objects, there is not necessarily a unique
isomorphism between two products of the same factors. For example, in Set the
identity function, (𝑥 , 𝑦) ⟼ (𝑥 , 𝑦), and swap map, (𝑥 , 𝑦) ⟼ (𝑦 , 𝑥), are both
isomorphisms A × A ⟶ A × A. But only the former respects the coordinate
projections.
Definition 3.2.1.4 (diagonal map) For every object A, the universal property
of the product gives a canonical diagonal map, which duplicates its argument:
id id
∆
A π0
A×A π1
A
Exercise 3.2.1.5 (pre-composing with a tuple) Use the diagram below and the
universal property of a product of objects to prove the following:
𝑖 ⋅ ⟨𝑓 , 𝑔⟩ = ⟨𝑖 ⋅ 𝑓 , 𝑖 ⋅ 𝑔⟩ ∶ Y ⟶ A × B
𝑖
𝑖⋅𝑓 𝑖⋅𝑔
X
𝑓 𝑔
⟨𝑓 , 𝑔⟩
A π0
A×B π1
B
3.2. PRODUCTS 33
X π0
X×Y π1
Y
𝑓 𝑓 ×𝑔 𝑔
π0 π1
A A×B B
id id id
A0 π0
A0 × A1 π1
A1
34 CHAPTER 3. UNIVERSAL CONSTRUCTIONS
the arrow id(A0 × A1 ) makes both squares commute, so the result follows
by the definition of product of arrows.
binary composition We must show that
In the diagram,
π0 π1
A0 A0 × A 1 A1
𝑓0 𝑓0 × 𝑓 1 𝑓1
π0 π1
B0 B 0 × B1 B1
𝑔0 𝑔0 × 𝑔 1 𝑔1
C0 π0
C0 × C 1 π1
C1
the top two squares commute by the definition of 𝑓0 × 𝑓1 and the bottom
two squares commute by the definition of 𝑔0 × 𝑔1 . By pasting, the rectan-
gle comprising the two left squares commutes, and likewise the rectangle
comprising the two right squares. By definition, (𝑓0 ⋅ 𝑔0 ) × (𝑓1 ⋅ 𝑔1 ) is the
unique arrow from A0 × A1 to C0 × C1 making the outer square commute.
X
𝑓0 𝑓1
⟨𝑓0 , 𝑓1 ⟩
A0 π0
A0 × A 1 π1
A1
𝑔0 𝑔0 × 𝑔1 𝑔1
B0 π0
B0 × B1 π1
B1
⟨𝑓 , 𝑔⟩ = ∆(X) ⋅ (𝑓 × 𝑔)
3.2. PRODUCTS 35
X
id id
∆
X π0
X×X π1
X
𝑓 𝑓 ×𝑔 𝑔
A π0
A×B π1
B
⟦A ∧ B⟧ ≔ ⟦A⟧ × ⟦B⟧
which we will write as follows to emphasize that A and B are being proved from
the same assumptions,
Γ Γ
𝒟0 𝒟1
Γ A B
∧+
A∧B
is interpreted by the tuple construction:
𝑡
𝑥0 𝑥1
P
𝑝0 ⋯ 𝑝𝑛−1
A0 ⋯ A𝑛−1
⟨⟩
𝑥
⟨𝑥⟩
A π
P
the coordinate projections. But this is the same universal property enjoyed by
(A × B) × C, which has projections π0 ⋅ π0 to A, π0 ⋅ π1 to B and π1 to C. Any
span over A, B and C contains a subspan over A and B, so by the universal
property of A × B, has a unique map from the apex to this product, which
together with the C leg of the span gives us a unique map from the apex to
(A × B) × C. The product of four or more factors is analogous.
A × (B × C) ≅ (A × B) × C
𝑠 ∶ A × (B × C) ⟶ (A × B) × C and 𝑡 ∶ (A × B) × C ⟶ A × (B × C)
become clear when we draw the diagram showing how each compound product
projects to the three factors, A, B and C:
(A × B) × C
π0
π1
A×B
π0 π1
A B C
π0 π1
π0
B×C
π1
A × (B × C)
𝑠 ≔ ⟨⟨π0 , π1 ⋅ π0 ⟩ , π1 ⋅ π1 ⟩ ∶ A × (B × C) ⟶ (A × B) × C
𝑡 ≔ ⟨π0 ⋅ π0 , ⟨π0 ⋅ π1 , π1 ⟩⟩ ∶ (A × B) × C ⟶ A × (B × C)
38 CHAPTER 3. UNIVERSAL CONSTRUCTIONS
Similarly, 𝑡 ⋅ 𝑠 = id.
π0 ⋅ ⟨id(A) , !(A)⟩ ∶ A × 1 ⟶ A × 1
= [pre-composing with a tuple]
⟨π0 ⋅ id(A) , π0 ⋅ !(A)⟩
= [composition unit law and pre-composing with a bang]
⟨π0 , !(A × 1)⟩
= [universal property of a terminal object]
⟨π0 , π1 ⟩
= [identity expansion for products]
id(A × 1)
3.2. PRODUCTS 39
To have finite products – that is, 𝑛-ary products for all 𝑛 ∈ ℕ, it suffices to
have binary products and a terminal object. A category with all finite products
is called a cartesian category.
Γ ⊢ B
𝑐𝑤
Γ,A ⊢ B
id × !
⟦Γ⟧ × ⟦A⟧ ⟦Γ⟧ ⟦B⟧
Γ,A,A ⊢ B
𝑐𝑐
Γ,A ⊢ B
id × ∆
⟦Γ⟧ × ⟦A⟧ ⟦Γ⟧ × ⟦A⟧ × ⟦A⟧ ⟦B⟧
Γ,B,A ⊢ C
𝑐𝑥
Γ,A,B ⊢ C
id × σ
⟦Γ⟧ × ⟦A⟧ × ⟦B⟧ ⟦Γ⟧ × ⟦B⟧ × ⟦A⟧ ⟦C⟧
3.3. COPRODUCTS 41
3.3 Coproducts
A coproduct is the dual construction to a product. Categorically, that is all
there is to say about the matter. But because of the asymmetry of proof-
theoretic derivations – proceeding from a collection of assumptions, interpreted
conjunctively, to a single conclusion – we will have to say a bit more when it
comes to our categorical semantics for proof theory.
First, we record for convenience, but without further comment, the duals of our
main results about products. If you’re new to all this, it would be an excellent
exercise first to go back and see why these are the respective dual theorems,
and then to prove each one explicitly – that is, by actually going through the
argument, rather than by just saying, “by duality, Qed”.
𝑠
𝑥0 𝑥1
X
42 CHAPTER 3. UNIVERSAL CONSTRUCTIONS
We call A and B the cases of the coproduct, 𝑞0 and 𝑞1 its insertions and 𝑠 the
cotuple of 𝑥0 and 𝑥1 , and write it as “[𝑥0 , 𝑥1 ]”.
Probing a coproduct with itself by choosing X ≔ Q and (𝑥0 , 𝑥1 ) ≔ (𝑞0 , 𝑞1 ),
we learn:
Lemma 3.3.1.2 (identity expansion for coproducts) If Q is a coproduct of A
and B with insertions 𝑞0 and 𝑞1 , then [𝑞0 , 𝑞1 ] = id(Q).
And being characterized by a universal property, we expect:
Lemma 3.3.1.3 (uniqueness of coproducts) When they exist, coproducts of
objects are unique up to a unique insertion-preserving isomorphism.
We write “A + B” to refer to an arbitrary coproduct of A and B, When the
coproduct in question is clear from context, we refer to the two case insertions
generically as “ι0 ” and “ι1 ”.
Definition 3.3.1.4 (codiagonal map) For every object A, the universal property
of the coproduct gives a canonical codiagonal map, which forgets about case
distinction:
∇(A) ≔ [id(A) , id(A)] ∶ A + A ⟶ A
ι0 ι1
A A+A A
∇
id id
[𝑓 , 𝑔] ⋅ 𝑗 = [𝑓 ⋅ 𝑗 , 𝑔 ⋅ 𝑗] ∶ A + B ⟶ Y
ι0 ι1
A A+B B
[𝑓 , 𝑔]
𝑓 𝑔
X
𝑓 ⋅𝑗 𝑔⋅𝑗
𝑗
arrows 𝑓 + 𝑔 ∶ A + B ⟶ X + Y by:
𝑓 +𝑔 ∶ A+B⟶X+Y
𝑓 +𝑔 ≔ [𝑓 ⋅ ι0 , 𝑔 ⋅ ι1 ]
That is, 𝑓 + 𝑔 is the unique arrow making the two squares commute:
A A+B B
ι0 ι1
𝑓 𝑓 +𝑔 𝑔
ι0 ι1
X X+Y Y
ι0 ι1
A0 A0 + A 1 A1
𝑓0 𝑓0 + 𝑓 1 𝑓1
ι0 ι1
B0 B0 + B 1 B1
[𝑔0 , 𝑔1 ]
𝑔0 𝑔1
[𝑓 , 𝑔] = (𝑓 + 𝑔) ⋅ ∇(X)
44 CHAPTER 3. UNIVERSAL CONSTRUCTIONS
ι0 ι1
A A+B B
𝑓 𝑓 +𝑔 𝑔
ι0 ι1
X X+X X
∇
id id
X
⟦A ∨ B⟧ ≔ ⟦A⟧ + ⟦B⟧
Using the cotuple construction, we are able to interpret the restricted case of
disjunction elimination in which there is no ambient context:
A B
𝒟1 𝒟2
A∨B C C
∨−†
C
Γ A Γ B
𝒟1 𝒟2
Γ A∨B C C
∨−
C
𝑑𝑖𝑠𝑡 ∶ X × (A + B) ≅ (X × A) + (X × B)
3.3. COPRODUCTS 45
⟦∨−⟧ ≔ 𝑑𝑖𝑠𝑡 ⋅ [– , –]
or
X × (A + B)
𝑑𝑖𝑠𝑡 ≅
𝑞0 𝑞1
X×A (X × A) + (X × B) X×B
[𝑓 , 𝑔]
𝑓 𝑔
C
We do not yet have a justification for why the distributive law should hold in our
(admittedly underspecified) categorical setting, but we will remedy this soon.2
Dual to the case for products, we can give an unbiased description of finite co-
products, where the nullary coproduct is an initial object, a unary coproduct
is just the identity function, and for any 𝑛 ≥ 3, the 𝑛-ary coproduct is just the
iterated binary coproduct bracketed any way you like since,
Lemma 3.3.4.1 The coproduct is associative, up to isomorphism:
A + (B + C) ≅ (A + B) + C
A+0 ≅ A ≅ 0+A
A+B ≅ B+A
To have finite coproducts – that is, 𝑛-ary coproducts for all 𝑛 ∈ ℕ, it suffices
to have binary coproducts and an initial object. A category with all finite
coproducts is called a cocartesian category. A category with all finite products
and coproducts is known as bicartesian.
2 If you feel so inclined, you may go back and peak under the rug now.
46 CHAPTER 3. UNIVERSAL CONSTRUCTIONS
3.4 Exponentials
λ(𝑓)
X E
𝑓
X×A B
ε
λ(𝑓) × A
E×A
We call ε the evaluation map of the exponential, and λ(𝑓) the exponential
transpose or “curry” of 𝑓.
Notice that uniqueness together with the “such that” clause lets us recover 𝑓
from λ(𝑓): just take the product with id(A) and compose with ε. This is just
“uncurrying” to functional programmers. If this isn’t clear to you, go back to
the definitions of product and coproduct and see how the same principle allows
us to recover 𝑓 and 𝑔 from ⟨𝑓 , 𝑔⟩ and from [𝑓 , 𝑔], respectively.
Let’s see what we learn by probing an exponential with itself by choosing X ≔ E
and 𝑓 ≔ ε.
Lemma 3.4.1.2 (identity expansion for exponentials) If E is an exponential of
A and B then λ(ε) = id(E).
Proof. By assumption, λ(ε) is the unique map in the hom set E ⟶ E with the
3.4. EXPONENTIALS 47
λ(ε)
E E
ε
E×A B
ε
λ(ε) × A
E×A
To summarize:
• currying the evaluation map yields the identity on the exponential, and
• uncurrying the identity on the exponential yields the evaluation map.
Because exponentials are structures characterized by a universal property, we
expect them to be unique up to a structure-preserving isomorphism. This should
be familiar by now.
Lemma 3.4.1.3 (uniqueness of expoentials) When they exist, exponentials are
unique up to a unique evaluation-preserving isomorphism.
λ(ε′ )
E′ E
ε′
E′ × A B
ε
λ(ε′ ) × A
E×A
uncurrying it:
(λ ′ (𝑒) ⋅ λ(ε′ )) × id(A) ⋅ ε
= [product functor]
λ ′ (𝑒) × id(A) ⋅ λ(ε′ ) × id(A) ⋅ ε
= [universal property of E]
λ ′ (𝑒) × id(A) ⋅ ε′
= [universal property of E′ ]
ε
ε
λ ′ (ε) × A ε′
E×A E′ × A B
λ(ε′ ) × A ε
(λ ′ (ε) ⋅ λ(ε′ )) × A
E×A
id
X×A X×A
ε
η×A
(A ⊃ (X × A)) × A
3.4. EXPONENTIALS 49
Exercise 3.4.1.5 (pre-composing with a curry) Use the diagram and the uni-
versal property of an exponential object to prove the following:
For a exponential A ⊃ B, a curry λ𝑓 ∶ X ⟶ A ⊃ B and an arrow 𝑖 ∶ Y ⟶ X,
𝑖 ⋅ λ𝑓 = λ(𝑖 × A ⋅ 𝑓) ∶ Y ⟶ A ⊃ B
𝑖 λ(𝑓)
Y X A⊃B
𝑖×A 𝑓
Y×A X×A B
λ(𝑓) × A ε
(𝑖 ⋅ λ(𝑓)) × A
(A ⊃ B) × A
A⊃𝑔
A⊃B A⊃C
εB 𝑔
(A ⊃ B) × A B C
εC
(A ⊃ 𝑔) × A
(A ⊃ C) × A
If this definition seems rather unmotivated, it may help to recall that the curry
of an evaluation map is the identity (lemma 3.4.1.2) and to keep in mind that
the idea behind an exponential of an arrow, A ⊃ 𝑔, is to “post-compose 𝑔”.
50 CHAPTER 3. UNIVERSAL CONSTRUCTIONS
A ⊃ id(B) = id(A ⊃ B)
A ⊃ id(B)
= [definition of A ⊃ – on arrows]
λ(εB ⋅ id(B))
= [composition unit law]
λ(εB )
= [identity expansion for exponentials]
id(A ⊃ B)
A ⊃ (𝑔 ⋅ ℎ) = A ⊃ 𝑔 ⋅ A ⊃ ℎ
In the diagram,
A ⊃ (𝑔 ⋅ ℎ)
B C D
𝑔 ℎ
εB (I) εC (II) εD
(A ⊃ 𝑔) × A (A ⊃ ℎ) × A
(A ⊃ B) × A (A ⊃ C) × A (A ⊃ D) × A
(A ⊃ (𝑔 ⋅ ℎ)) × A
(A ⊃ 𝑔) × A ⋅ (A ⊃ ℎ) × A = (A ⊃ 𝑔 ⋅ A ⊃ ℎ) × A
3.4. EXPONENTIALS 51
εB ⋅ (𝑔 ⋅ ℎ) = (A ⊃ 𝑔) × A ⋅ (A ⊃ ℎ) × A ⋅ εD
⟦A ⊃ B⟧ ≔ ⟦A⟧ ⊃ ⟦B⟧
[A]
𝒟
B
⊃+
A⊃B
Γ A
𝒟
Γ B
⊃+
A⊃B
is interpreted by currying:
⟦⊃+⟧ ≔ λ(⟦–⟧)
A⊃B A
⊃−
B
⟦⊃−⟧ ≔ ε
52 CHAPTER 3. UNIVERSAL CONSTRUCTIONS
We have now met all of the universal constructions needed to interpret intu-
itionistic propositional proof theory.
A category having all finite products (i.e. a terminal object and binary prod-
ucts), as well as all exponentials is known as a cartesian closed category. A
category that is both bicartesian and cartesian closed is called a bicartesian
closed category. We will call the subcategory of Cat consisting of bicartesian
closed categories, their (bicartesian closed) structure-preserving functors “BCC”.
So far, we have introduced the interpretations of the introduction and elimi-
nation rules of the propositional connectives in a bicartesian closed category.
However, we have not yet introduced interpretations for the rest of the proof-
theoretical structure (i.e. local reductions and expansions and permutation
conversions).
If we were interested in studying only provability, rather than proofs themselves,
we could stop here. In that case, we could interpret intuitionistic propositional
logic in a bicartesian closed preorder (or poset). These structures are well-known
in lattice theory, where they are called Heyting algebras.
However, because we are interested in proof theory we will ultimately want to
interpret intuitionistic propositional logic into free bicartesian closed categories
– those whose arrows, as well as the equations between them, are exactly the
ones required by the bicartesian closed structure, with no “junk” (additional
arrows) and no “confusion” (additional equations between them).
We still have pending the issue of context distributivity. For the propositional
connective disjunction, in order to recover the proof theoretic elimination rule
from the special case of the cotuple, we need to know that the distributive
law holds. Likewise, for the propositional constant falsehood, we need nullary
context distributivity or absorption law,
𝑎𝑏𝑠 ∶ X×0 ≅ 0
It turns out that in any bicartesian closed category these isomorphisms hold.
We don’t have time to give a full explanation of why this is the case, but
the short version is that they’re consequences of the Yoneda principle, which
says essentially that for given objects X , Y ∶ ℂ, if for all objects Z, we have
ℂ (X → Z) ≅ ℂ (Y → Z) in Set then X ≅ Y in ℂ. You should think of this as
generalizing the following statement in a preordered set:
(∀Z . X ≤ Z ⟺ Y ≤ Z) implies X ≅ Y
3.5. BICARTESIAN CLOSED CATEGORIES 53
Using this principle, the (nullary and binary) distributive laws follow from:
ℂ (X × (A + B) → Z)
≅ [product symmetry]
ℂ ((A + B) × X → Z)
ℂ (X × 0 → Z) ≅ [currying]
≅ [product symmetry] ℂ (A + B → X ⊃ Z)
ℂ (0 × X → Z) ≅ [uncotupling]
≅ [currying] ℂ (A → X ⊃ Z) × ℂ (B → X ⊃ Z)
ℂ (0 → X ⊃ Z) ≅ [uncurrying]
≅ [universal property of 0] ℂ (A × X → Z) × ℂ (B × X → Z)
ℂ (0 → Z) ≅ [product symmetry]
ℂ (X × A → Z) × ℂ (X × B → Z)
≅ [cotupling]
ℂ ((X × A) + (X × B) → Z)
π1 ¡
A×0 0 A×0
id
𝑓 ¡
A 0 A
⟨id , 𝑓⟩ π1 ¡ π0
A×0 id A×0
id
54 CHAPTER 3. UNIVERSAL CONSTRUCTIONS
4.1 Naturality
Naturality is the carrier of the two-dimensional structure of categories of cate-
gories. It is a sort of coherence or uniformity property that allows us to interpret
a family of features within a particular category as a single feature in the am-
bient category of categories.
55
56 CHAPTER 4. TWO DIMENSIONAL STRUCTURE
ℂ∶ 𝔻∶
𝑓 F(𝑓)
A B F(A) F(B)
ϕ(A) ϕ(B)
G(A) G(B)
G(𝑓)
One way to think about this is that a functor “projects” an image of its domain
category into its codomain category. In this sense, a functor acts as a lens,
which may “distort” the structure of the source category by identifying distinct
objects or arrows. Under this interpretation, a component of a natural trans-
formation acts as a “homotopy” between the images of an object cast by two
parallel functors, and a naturality square ensures that these object homotopies
are consistent with the images of arrows.
You may also think of the naturality square above as a “2-dimensional arrow”
from the 1-dimensional arrow F(𝑓) to the 1-dimensional arrow G(𝑓), acting as
the “component” of φ at 𝑓. But in an ordinary (1-dimensional) category, the
only “2-dimensional arrows” available are the trivial ones – i.e. equalities.
𝔸⊃𝔹 = Fun(𝔸 , 𝔹)
4.2 2-Categories
Something subtle and profound has just happened, so let’s go through it care-
fully. Recall that when we introduced categories, we gave them structure at two
different dimensions:
But in introducing natural transformations, we just said that for any two fixed
objects, we have a whole category of functors and natural transformations be-
tween them, so the hom collections in Cat are not 0-dimensional sets, but rather
1-dimensional categories. This gives the category Cat structure at dimension 2
as well!
diagram in Cat:
F1
𝔸 ⇓α 𝔹
F2
Now we come to the question of what happens if we don’t require the pair
of objects under consideration to remain fixed. Consider the following pair of
natural transformations:
F1 G1
𝔸 ⇓α 𝔹 ⇓β ℂ
F2 G2
dimensions down, rather than the usual one dimension down with “– ⋅ –”. The reader may
amuse herself thinking about how to extend this pattern to still higher dimensions.
4.2. 2-CATEGORIES 59
Proof. To see that the two composites are indeed equal consider the component
of α at A in 𝔹. This determines a naturality square for β at α(A) in ℂ:
𝔹∶ ℂ∶
α(A) G1 (α(A))
F1 (A) F2 (A) G1 (F1 (A)) G1 (F2 (A))
G1 (α(A)) G1 (α(B))
β(F2 (A))
β(F2 (B))
G2 (F1 (A)) G2 (F1 (𝑓)) G2 (F1 (B))
G2 (α(A)) G2 (α(B))
• the left and right squares are the naturality squares of β at α(A) and α(B),
• the top and bottom squares are G1 and G2 functor-images of the natu-
rality squares of α at 𝑓,
• and the back and front squares are the naturality squares of β at F1 (𝑓)
and F2 (𝑓).
Pasting the top and front – or equivalently, of the back and bottom – squares
establishes the naturality of α ⋅ ⋅β at 𝑓.
Remark 4.2.1.2 (connection to arrow categories) The construction in the pre-
ceding proof should remind you of the double arrow category construction. This
is because the arrow category 𝔻→ is equivalent to the functor category 𝕀 ⊃ 𝔻,
where 𝕀 is the interval category.
Exercise 4.2.1.3 Check that horizontal composition respects the composition
structure of each functor category by pasting squares onto diagram 4.1.
60 CHAPTER 4. TWO DIMENSIONAL STRUCTURE
we have:
(α ⋅ β) ⋅ ⋅(γ ⋅ δ) = (α ⋅ ⋅γ) ⋅ (β ⋅ ⋅δ) ∶ F ⋅ I ⟶ H ⋅ K
There are several equivalent ways to axiomatize the notion of 2-category, but
for our purposes, this informal description will suffice.
If we take the Poincaré (or graph) dual of the 2-dimensional diagrams we have
been drawing, we obtain a very useful graphical language for 2-categories, called
string diagrams. Specifically, we will use “planar progressive” string diagrams
to represent configurations of 0-, 1-, and 2-cells.
In the graphical language of string diagrams,
0-cells (e.g. ℂ ∶ Cat) are represented as regions in the plane,
4.2. 2-CATEGORIES 61
α γ
𝔸 G 𝔹 J ℂ
β δ
H K
Typically, we omit labeling the regions as their identities can always be inferred.
The commuting of diagram 4.1 in the definition of horizontal composition of 2-
cells represents the notion of naturality as independence, depicted in string
diagrams by the property that two beads without an output-to-input connection
between them may freely “slide” past one another along their wires, and it makes
no difference which is above or below the other.
F1 F1 G1 G1
α G1 F1 β
= α β =
F2 β α G2
G2 F2 G2 F2
The idea of independence is the heart of naturality; the rest of its properties
can be recovered from this.
62 CHAPTER 4. TWO DIMENSIONAL STRUCTURE
There is a handy “trick” for transforming diagrams within a category into string
diagrams using global elements. Notice that for any object A ∶ ℂ there is a func-
tor (which we typically overload with the same name) A ∶ 𝟙 ⟶ ℂ picking out
that object, and for any arrow 𝑓 ∶ ℂ (A → B) there is a natural transformation
between the respective functors, which we can represent as the string diagram:
𝟙 𝑓 ℂ
4.3 Adjunctions
For our primary definition of adjunction we adopt the following behavioral one,
which we call the “zigzag characterization”:
Definition 4.3.1.1 (adjunction – zigzag characterization) Anti-parallel func-
tors F ∶ ℂ ⟶ 𝔻 and G ∶ 𝔻 ⟶ ℂ form an adjunction, written “F ⊣ G”, if there
exist natural transformations:
The reason for the name “zigzag” becomes apparent when the laws are drawn
as string diagrams:
η F
G = F
F ε
G η
F = G
ε G
The chirality of the zigzag laws comes from the fact that when F ⊣ G, F is
called left adjoint to G, and G is called right adjoint to F.
ℂ (A → G(B))
θ
𝔻 (F(A) → B)
–♯
𝑓 ∶ ℂ (A → G(B)) ⟼ 𝑓 ♯ ∶ 𝔻 (F(A) → B)
and
–♭
𝑔 ∶ 𝔻 (F(A) → B) ⟼ 𝑔♭ ∶ ℂ (A → G(B))
and
(𝑓 ♯ )♭ = 𝑓 and (𝑔♭ )♯ = 𝑔
We call the image of an arrow under this bijection its adjoint complement.
64 CHAPTER 4. TWO DIMENSIONAL STRUCTURE
A bijection of hom sets is natural if it extends along its boundary by the relevant
functors. In this case, that means that for any 𝑎 ∶ ℂ (A′ → A) and 𝑏 ∶ 𝔻 (B →
B′ ) we have,
𝑎 𝑓 = 𝑔♭ G(𝑏)
ℂ∶ A′ A G(B) G(B′ )
𝔻∶ F(A′ ) F(A) B B′
F(𝑎) 𝑔 = 𝑓♯ 𝑏
We can use the zigzag laws to show that –♯ and –♭ are inverse operations:
A η A A
𝑓
(𝑓 ♯ )♭ = 𝑓 F = η = 𝑓
G
G G F
B ε B ε G B G
A η A η F A F
F F G
♭ ♯ F
(𝑔 ) = 𝑔 G = ε = 𝑔
𝑔
B ε B
B
4.3. ADJUNCTIONS 65
The naturality of the bijection in the domain and codomain coordinates is also
obvious in the graphical language.
• For naturality in the codomain coordinate, given 𝑏 ∶ 𝔻 (B → B′ ) we have:
A A
F
𝑓 𝑓 F
G B
𝑓 ♯ ⋅𝑏 = B = G
= (𝑓⋅G(𝑏))♯
ε 𝑏
𝑏 ε
B′ B′
A′ A′
𝑎 η
η 𝑎
𝑎⋅𝑔♭ = A = F = (F(𝑎)⋅𝑔)♭
F A
𝑔 𝑔 G
G
B B
Exercise 4.3.2.2 With 𝑓, 𝑔, 𝑎 and 𝑏 as in the proof above, verify the following:
• (𝑔 ⋅ 𝑏)♭ = 𝑔♭ ⋅ G(𝑏)
• (𝑎 ⋅ 𝑓)♯ = F(𝑎) ⋅ 𝑓 ♯
We can work out that the adjoint complements of components of the unit and
counit of an adjunction are identities, which are easily seen in string diagrams:
G F
–♯
id(G(B)) = B G ⟼ B = ε(B)
ε
–♭ η
id(F(A)) = A F ⟼ A = η(A)
F G
(G ∘ F)(A)
G(𝑔)
η(A)
ℂ∶ A G(B)
𝑓
𝔻∶ F(A) B
𝑔
𝑔
𝔻∶ F(A) B
ε(B)
F(𝑓)
(F ∘ G)(B)
𝑔 = 𝑓♯
𝔻∶ F(A) B
β𝑟 ⇑
ε(B)
F(𝑔♭ )
(F ∘ G)(B)
The 2-cells labeled “β𝑙 ” and “β𝑟 ” are both equalities because ℂ and 𝔻 are just
ordinary (1-dimensional) categories so equality is the only possible kind of 2-
cell. But as we will see shortly, it is convenient to give them a suggestive name
and orientation.
4.3. ADJUNCTIONS 67
The universal property of the counit should immediately remind you of the
definition of an exponential object. Indeed, for a fixed object A, we have endo-
functors
–×A ∶ ℂ⟶ℂ and A⊃– ∶ ℂ⟶ℂ
and an adjunction
–×A ⊣ A⊃–
The counit of this adjunction is the evaluation map and the unit is the pairing
map. The internal picture of this adjunction looks like this:
A ⊃ (X × A)
A⊃𝑓
η(X)
ℂ∶ X A⊃B
λ(𝑓)
𝑓
ℂ∶ X×A B
β𝑟 ⇑
ε(B)
λ(𝑓) × A
(A ⊃ B) × A
Recall our interpretations for the natural deduction introduction and elimination
rules for implication in terms of exponentials:
λ(𝑓) × A ⋅ ε(B) = 𝑓
Γ A
𝒟
Γ B Γ A
⊃+
A⊃B A 𝒟
⊃− ⊃>
B ⟼ B
Identity expansion for exponentials (lemma 3.4.1.2), which gives us the adjoint
complement of an identity morphism,
id(A ⊃ B) = λ(ε)
68 CHAPTER 4. TWO DIMENSIONAL STRUCTURE
A⊃B A
⊃−
A⊃B B
⊃< ⊃+
A⊃B ⟼ A⊃B
𝑖 ⋅ λ𝑓 = λ(𝑖 × A ⋅ 𝑓)
allows us to move any derivation pre-composed with a ⊃+ rule into the hypo-
thetical subderivation. We can view this as a kind of permutation conversion:
Γ
ℰ
Γ C A C A
ℰ 𝒟 𝒟
C B Γ B
⊃+ ⊃⇄ ⊃+
A⊃B ⟼ A⊃B
Combining this with the special case of local expansion of an identity derivation
yields the general case of local expansion for implication.
Remarkably, the same pattern obtains for the other negatively-presented propo-
sitional connectives (∧ and ⊤). There is an adjunction F ⊣ G such that:
• their introduction rule is interpreted by the adjoint complement operation,
⟦∗+⟧ ≔ –♭
⟦∗−⟧ ≔ ε(–)
⟦∗ >⟧ ≔ β𝑟
⟦∗ ⇄⟧ ≔ 𝑖 ⋅ 𝑔♭ = (F(𝑖) ⋅ 𝑔)♭
And just as remarkably, modulo context distributivity, the dual pattern obtains
for the positively-presented propositional connectives (∨ and ⊥). There is an
adjunction such that:
• their introduction rule is interpreted by the component of the unit,
⟦∗+⟧ ≔ η(–)
⟦∗−⟧ ≔ –♯
⟦∗ >⟧ ≔ β𝑙
⟦∗ ⇄⟧ ≔ 𝑓 ♯ ⋅ 𝑖 = (𝑓 ⋅ G(𝑖))♯
Recall that the category Cat has products via the product category construction,
and that in any category with products we can define diagonal maps. This
implies that for any category ℂ we have a diagonal functor,
∆
ℂ ⟶ ℂ×ℂ
A ⟼ (A , A)
𝑓 ⟼ (𝑓 , 𝑓)
70 CHAPTER 4. TWO DIMENSIONAL STRUCTURE
X×X
𝑓 ×𝑔
∆(X)
ℂ∶ X A×B
⟨𝑓 , 𝑔⟩
(𝑓 , 𝑔)
ℂ×ℂ∶ ∆(X) (A , B)
β𝑟 ⇑
(π0 , π1 )(A , B)
∆⟨𝑓 , 𝑔⟩
∆(A × B)
Recall our interpretations for the natural deduction introduction and elimination
rules for conjunction in terms of products:
⟦∧+⟧ = ⟨– , –⟩ and ⟦∧−⟧ = (π0 , π1 )
The universal property of products is just the universal property of the counit
of this adjunction. Its commuting triangle β𝑟 ,
∆⟨𝑓 , 𝑔⟩ ⋅ (π0 , π1 ) = (𝑓 , 𝑔)
expresses the local reduction for conjunction:
Γ Γ Γ Γ
𝒟0 𝒟1 𝒟0 𝒟1
Γ A B Γ A B Γ Γ
∧+ ∧+
A∧B A∧B 𝒟0 𝒟1
∧−0 ∧−1 ∧>
A B ⟼ A B
Identity expansion for products (lemma 3.2.1.2), which gives us the adjoint
complement of an identity morphism,
id(A × B) = ⟨π0 , π1 ⟩
expresses the local expansion of an identity derivation:
A∧B A∧B
∧−0 ∧−1
A∧B A B
∧< ∧+
A∧B ⟼ A∧B
4.3. ADJUNCTIONS 71
Γ Γ
ℰ ℰ
Γ C C C C
ℰ 𝒟1 𝒟2 𝒟1 𝒟2
C A B Γ A B
∧+ ∧⇄ ∧+
A∧B ⟼ A∧B
Combining this with the special case of local expansion of an identity derivation
yields the general case of local expansion for conjunction.
∆(A + B)
∆[𝑓 , 𝑔]
(ι0 , ι1 )(A , B)
⇓ β𝑙
ℂ×ℂ∶ (A , B) ∆X
(𝑓 , 𝑔)
[𝑓 , 𝑔]
ℂ∶ A+B X
∇(X)
𝑓 ∨𝑔
X+X
Recall our interpretations (modulo the distributive law) for the natural deduc-
tion introduction and elimination rules for disjunction in terms of coproducts:
⟦∨+⟧ = (ι0 , ι1 ) and ⟦∨−† ⟧ = [– , –]
The universal property of coproducts is just the universal property of the unit
of this adjunction. Its commuting triangle β𝑙 ,
(ι0 , ι1 ) ⋅ ∆[𝑓 , 𝑔] = (𝑓 , 𝑔)
72 CHAPTER 4. TWO DIMENSIONAL STRUCTURE
A B A B
A 𝒟0 𝒟1 B 𝒟0 𝒟1 A B
∨+0 ∨+1
A∨B C C A∨B C C 𝒟0 𝒟1
∨−† ∨−† ∨>
C C ⟼ C C
Identity expansion for coproducts (lemma 3.3.1.2), which gives us the adjoint
complement of an identity morphism,
id(A + B) = [ι0 , ι1 ]
A B
∨+0 ∨+1
A∨B A∨B A∨B
∨< ∨−†
A∨B ⟼ A∨B
[𝑓 , 𝑔] ⋅ 𝑖 = [𝑓 ⋅ 𝑖 , 𝑔 ⋅ 𝑖]
allows us to take any derivation post-composed with a ∨− rule, copy it and move
it into the hypothetical subderivations. This is the permutation conversion for
disjunction:
A B A B
𝒟0 𝒟1 𝒟0 𝒟1
A∨B C C C C
∨−†
C ℰ ℰ
ℰ A∨B D D
∨⇄ ∨−†
D ⟼ D
Recall that the category Cat has terminal objects in the form of singleton cat-
egories, and that in any category with a terminal object we have bang maps.
This implies that for any category ℂ we have a bang functor,
!
ℂ ⟶ 𝟙
A ⟼ ⋆
𝑓 ⟼ id(⋆)
4.3. ADJUNCTIONS 73
When the category ℂ has terminal objects, the functor 1 ∶ 𝟙 ⟶ ℂ picking out
a terminal object is right adjoint to the bang functor:
! ⊣ 1
The counit of this adjunction is (trivially) the identity and the unit is the bang
map. The internal picture for this adjunction looks like this:
1
1(id(⋆))
!(X)
ℂ∶ X 1
!(X)
𝑓 = id(⋆)
𝟙∶ !(X) ⋆
β𝑟 ⇑
id
!(!(X))
!(1)
The triangle in 𝟙 is trivial because id(⋆) is the only arrow in the whole category.
Recall our interpretation for the natural deduction introduction rule for truth
in terms of terminal objects:
⟦⊤+⟧ = !(–)
⋆
𝒟
Γ ⋆
⊤+
⊤
But there is only one possible choice for ⟦𝒟⟧, namely, id(⋆).
The derived “elimination rule for truth” informs us of the existence of the mor-
phism id(⋆) in the category 𝟙, which is hardly earth-shattering news. Likewise,
the derived “local reduction for truth” tells us that id(⋆) ⋅ id(⋆) = id(⋆).
Identity expansion for terminal objects (lemma 3.1.1.2), which gives us the ad-
joint complement of an identity morphism,
id(1) = !(1)
⊤ ⋆
⊤< ⊤+
⊤ ⟼ ⊤
74 CHAPTER 4. TWO DIMENSIONAL STRUCTURE
Pre-composing with a bang (exercise 3.1.1.4), which is naturality of the hom set
bijection in its domain coordinate,
𝑖⋅! = !
allows us to take any derivation pre-composed with a ⊤+ rule, and “throw it
away” by moving its !-image – i.e. id(⋆) – to the singleton category. We can
view this as a permutation conversion:
Γ
ℰ
A ⋆ Γ ⋆
⊤+ ⊤⇄ ⊤+
⊤ ⟼ ⊤
Combining this with the special case of local expansion of an identity derivation
yields the general case of local expansion for truth.
When the category ℂ has initial objects, the functor 0 ∶ 𝟙 ⟶ ℂ picking out an
initial object is left adjoint to the bang functor:
0 ⊣ !
The unit of this adjunction is (trivially) the identity and the unit is the cobang
map. The internal picture for this adjunction looks like this:
!(0)
!(¡(X))
id
⇓ β𝑙
𝟙∶ ⋆ !(X)
𝑓 = id(⋆)
¡(X)
ℂ∶ 0 X
¡(X)
0(id(⋆))
0
⋆
𝒟
⊥ ⋆
⊥−†
A
4.3. ADJUNCTIONS 75
where again, the only possibility for ⟦𝒟⟧ is id(⋆). The derived “introduction
rule” and “local reduction” for falsehood are as uninformative as the elimination
and local reduction for truth.
Identity expansion for initial objects (lemma 3.1.4.2), which gives us the adjoint
complement of an identity morphism,
id(0) = ¡(0)
⊥ ⋆
⊥< ⊥−†
⊥ ⟼ ⊥
¡⋅𝑖 = ¡
allows us to take any derivation post-composed with a ⊥−† rule, and “throw it
away” by moving its !-image – i.e. id(⋆) – to the singleton category. This is the
permutation conversion for falsehood:
⊥ ⋆
⊥−†
A
ℰ ⊥ ⋆
⊥⇄ ⊥−†
B ⟼ B
The context distributivity laws for the positively-presented connectives, the dis-
tributive law and absorption law, are actually both instances of a more general
result about cartesian closed categories and adjoint functors called Frobenius
reciprocity.
Proposition 4.3.4.1 (Frobenius reciprocity) For anti-parallel functors F ∶ ℂ ⟶
𝔻 and G ∶ 𝔻 ⟶ ℂ between cartesian closed categories, if there is an adjunction
F ⊣ G and the right adjoint G preserves exponentials then for objects A ∶ ℂ and
X ∶ 𝔻,
X × F(A) ≅ F(G(X) × A)
The idea is that X is the interpretation of some ambient context and F is the
functor determining some positively-presented connective. Admittedly, the con-
dition that G preserves exponentials seems unmotivated, but when you try to
prove the result, you see that it is exactly what is needed to make it go through.
76 CHAPTER 4. TWO DIMENSIONAL STRUCTURE
𝔻 (X × F(A) → Z)
≅ [product symmetry]
𝔻 (F(A) × X → Z)
≅ [currying]
𝔻 (F(A) → X ⊃ Z)
≅ [adjoint complement –♭ ]
ℂ (A → G(X ⊃ Z))
≅ [assumption that G preserves exponentials]
ℂ (A → G(X) ⊃ G(Z))
≅ [uncurrying]
ℂ (A × G(X) → G(Z))
≅ [adjoint complement –♯ ]
𝔻 (F(A × G(X)) → Z)
≅ [product symmetry]
𝔻 (F(G(X) × A) → Z)
X × (A + B) ≅ (X × A) + (X × B)
–1 × F(–)
2
≅ 1
F(G(–) 2
× –)
Chapter 5
Dependency
P ∶ ℂ° ⟶ Set
1 The name “presheaf” belies the importance that such functors play in category theory,
which is a shame.
77
78 CHAPTER 5. DEPENDENCY
Set ∶
ℂ∶ Z Y X
𝑔 𝑓
ℂ (– → Z) ∶ ℂ° ⟶ Set
In this case, the set corresponding to each object in ℂ is the set of ℂ-arrows
from that object to the representative object.
We can generalize this setup even more: instead of a family of sets indexed by
a category, we can create a family of categories indexed by a category.
Definition 5.1.3.1 (indexed category) An indexed category is a contravariant
functor from a category to the 2-category of (small) categories:
P ∶ ℂ° ⟶ Cat
The category ℂ is called the base category of the indexed category P, for an
object X ∶ ℂ, the category P(X) is called the fiber of P over X, and for arrow
𝑓 ∶ ℂ (X → Y) the functor 𝑓 ∗ ∶ P(Y) ⟶ P(X) is called the reindexing functor
induced by 𝑓.
⟦X⟧ ∶ ℂ
Φ = 𝑥1 ∶ X 1 , ⋯ , 𝑥 𝑛 ∶ X 𝑛
We use the cartesian structure of ℂ to interpret typing contexts in the same way
we did for propositional contexts:
⟦∅⟧ ≔ 1
⟦Φ , 𝑥 ∶ X⟧ ≔ ⟦Φ⟧ × ⟦X⟧
The idea is that the names of the variables are immaterial, they merely act as
projections out of a product.
Weakening of typing contexts lets us forget about some of the variables in scope.
by the structural rule of context exchange, it suffices to consider just the case
of a single omission:
𝑥̂ ∶ Φ , 𝑥 ∶ X ⟼ Φ
Its interpretation is the same as that of propositional context weakening, namely
a projection, or up to isomorphism,
Open terms, or terms in context are built inductively from the function sym-
bols. We express that term 𝑡 has type X in typing context Φ as “Φ | 𝑡 ∶ X”.
In order for such a term in context to be valid, the context Φ must contain at
least the typed free variables that occur in 𝑡. However, the context Φ may also
contain additional dummy variables that do not occur free in 𝑡.
Our inductive interpretation of terms follows their inductive construction
from the function symbols:
lifted variable: for variable 𝑥𝑖 ∈ Φ,
π𝑖
⟦Φ | 𝑥𝑖 ∶ X𝑖 ⟧ ≔ ⟦Φ⟧ ⟦X⟧
⟦𝑦⟧̂ ⟦𝑡⟧
⟦Φ,𝑦 ∶ Y | 𝑡 ∶ X⟧ ≔ ⟦Φ⟧ × ⟦Y⟧ ⟦Φ⟧ ⟦X⟧
The reason that it tuples the interpretation of the substituting term with that
of its context is that in the language, applying such a substitution to a term
leaves undisturbed any other variables that may occur in the term.
5.2. INTERPRETATION OF PREDICATE LOGIC 81
Interpreting Propositions
As in the case of terms, we need to keep track of the typing context in which a
predicate (and in general, a proposition, which may contain connectives) occurs.
Thus we speak of propositions in context and write “Φ | A prop” to indicate
that A is a proposition, all of whose free variables are contained in the typing
context Φ.
Our inductive interpretation of predicates follows their inductive construc-
tion from the relation symbols:
applied relation symbol: for relation symbol R ∈ ℛ(Y1 , ⋯ , Y𝑛 ) and terms
Φ | 𝑡𝑖 ∶ Y 𝑖 ,
⟦Φ | R(𝑡1 , ⋯ , 𝑡𝑛 ) prop⟧ ≔ ⟨⟦𝑡1 ⟧ , ⋯ , ⟦𝑡𝑛 ⟧⟩∗ (⟦R⟧) ∶ P(⟦Φ⟧)
Note that in each case we simply reindex by the same morphism with which we
precomposed in the inductive interpretation of terms.
Finally, in order to interpret full predicate logic, we use the interpretations of
the connectives that we presented earlier.
82 CHAPTER 5. DEPENDENCY
This is an issue known as soundness for syntax, and there are established tech-
niques for dealing with it, but we will not have time to consider them in this
course.
BCC ∶ ⟦𝑥⟧̂ ∗
⊥
P
⟦∀𝑥⟧
ℂ∶ ⟦Φ⟧ ⟦Φ , 𝑥 ∶ X⟧
⟦𝑥⟧̂
5.3. INTERPRETATION OF QUANTIFICATION 83
Suppressing the semantic brackets for readability, the internal picture of this
adjunction looks like this:
∀𝑥 ∶ X . 𝑥̂∗ Γ
∀𝑥 ∶ X . 𝒟
η(Γ)
P(Φ) ∶ Γ ∀𝑥 ∶ X . A
𝒟♭
𝒟
P(Φ , 𝑥 ∶ X) ∶ 𝑥̂∗ Γ A
β𝑟 ⇑
ε(A)
𝑥̂∗ (𝒟♭ )
𝑥̂∗ (∀𝑥 ∶ X . A)
We can express this with the following inference rule of natural deduction:
𝑥̂∗ Γ
∗
𝑥̂ Γ 𝒟
𝒟 Γ A
–♭ ∀+†
A ⟼ ∀𝑥 ∶ X . A
The corresponding Gentzen rule allows us to conclude any instance of the for-
mula A in which a type-appropriate term 𝑡 is substituted for the variable 𝑥 and
any remaining free variables of A are left undisturbed. Categorically, this corre-
sponds to reindexing by the interpretation of the single substitution induced by
84 CHAPTER 5. DEPENDENCY
∀𝑥 ∶ X . A 𝑥̂∗ (∀𝑥 ∶ X . A) ∀𝑥 ∶ X . A
ε(A) (ε(A))[𝑥↦𝑡]
A A[𝑥↦𝑡]
𝑥̂ [𝑥↦𝑡]
Φ Φ,𝑥∶X Φ
id
The Gentzen rule gives us a stronger result by yielding a derivation in the orig-
inal typing context Φ. But it also makes a stronger demand by requiring us to
immediately choose a term of type X in that context to act as the represen-
tative of its type under consideration. The adjoint-theoretic rule takes a more
relaxed approach. It gives us the option, but not the obligation, of supplying a
representative term at some point in the future, while in the meantime choosing
the context variable 𝑥 to act as a generic representative.
To wit, the context variable 𝑥 is a term of type X, but in the extended context
Φ , 𝑥 ∶ X, and not in the original context Φ. At any point we may choose
a representative term Φ | 𝑡 ∶ X to use in place of this context variable by
performing the substitution [𝑥↦𝑡], but until we do so our derivation is valid only
in the extended context, a world in which a term of the specified type exists by
fiat, in the form of a context variable. The derived rule has the advantage that
we need not decide which term 𝑡 to substitute for 𝑥 in A at the time we apply
the rule. This has useful applications to the study of metavariables and proof
search.
The commuting triangle of the universal property of the counit,
β𝑟
𝑥∗̂ (𝒟♭ ) ⋅ ε(A) = 𝒟
expresses the local reduction for universal quantification in the category P(Φ,𝑥 ∶
X):
𝑥∗̂ Γ
𝒟
𝑥∗̂ Γ A 𝑥∗̂ Γ
𝑥∗̂ (∀+† )
𝑥∗̂ (∀𝑥 ∶ X . A) 𝒟
∀−† ∀>
A ⟼ A
We recover the Gentzen version by applying a single substitution for 𝑥 to both
sides.
5.3. INTERPRETATION OF QUANTIFICATION 85
id(∀𝑥 ∶ X . –) = (ε –)♭
𝑥∗̂ (∀𝑥 ∶ X . A)
∀−†
∀𝑥 ∶ X . A A †
∀< ∀+
∀𝑥 ∶ X . A ⟼ ∀𝑥 ∶ X . A
ℰ ⋅ 𝒟♭ = (𝑥∗̂ ℰ ⋅ 𝒟)♭
or,
𝑥∗̂ Γ
𝑥∗̂ ℰ
Γ 𝑥∗̂ C 𝑥∗̂ C
ℰ 𝒟 𝒟
C A Γ A
∀+† ∀⇄ ∀+†
∀𝑥 ∶ X . A ⟼ ∀𝑥 ∶ X . A
Again suppressing the semantic brackets for readability, the internal picture of
this adjunction looks like this:
𝑥̂∗ (∃𝑥 ∶ X . A)
𝑥̂∗ (𝒟♯ )
η(A)
⇓ β𝑙
P(Φ , 𝑥 ∶ X) ∶ A 𝑥̂∗ B
𝒟
𝒟♯
P(Φ) ∶ ∃𝑥 ∶ X . A B
ε(B)
∃𝑥 ∶ X . 𝒟
∃𝑥 ∶ X . 𝑥̂∗ B
–♯
𝒟 ∶ A ⟶ 𝑥∗̂ B ⟼ 𝒟♯ ∶ ∃𝑥 ∶ X . A ⟶ B
We can express this with the following inference rule of natural deduction:
A
A 𝒟
𝒟 ∃𝑥 ∶ X . A 𝑥∗̂ B
–♯ ∃−†
𝑥∗̂ B ⟼ B
This is our derived elimination rule for existential quantification. As with the
derived rule for universal introduction, the context variable 𝑥 plays the role
of the private variable and Gentzen’s side condition is automatically enforced
because the rest of the derivation is in the category P(Φ), where 𝑥 is not in
scope.
Indeed, this is the motivating case for that concept. Precomposing 𝑓𝑟𝑜𝑏 with
the derived rule yields Gentzen’s rule:
FIXME
Γ
ℰ 𝑥∗̂ Γ A
Γ ∃𝑥 ∶ X . A 𝒟
𝑓𝑟𝑜𝑏
∃𝑥 ∶ X . 𝑥∗̂ Γ ∧ A 𝑥∗̂ B
∃−†
B
The unit of this adjunction when written as an inference rule becomes our
derived introduction rule:
A
η
∗ ∃+†
A ⟼ 𝑥̂ (∃𝑥 ∶ X . A)
Dual to the case of ∀−† , we recover the Gentzen rule by reindexing along a
5.3. INTERPRETATION OF QUANTIFICATION 87
single substitution:
A A[𝑥↦𝑡]
η(A) (η(A))[𝑥↦𝑡]
∃𝑥 ∶ X . A 𝑥̂∗ (∃𝑥 ∶ X . A) ∃𝑥 ∶ X . A
𝑥̂ [𝑥↦𝑡]
Φ Φ,𝑥∶X Φ
id
Like ∀−† , this rule is more lenient than Gentzen’s because it does not require
us to immediately produce a witness at the time we apply the rule, but rather
allows us to temporarily use a context variable as a generic witness. This has
the effect of leaving 𝑥 as a free variable (i.e. metavariable or logic variable) to
be instantiated later, for example through unification. But it also means that
in order to obtain a derivation in the world in which we started, the typing
context Φ, we must eventually produce a witness term Φ | 𝑡 ∶ X to substitute
for the context variable 𝑥. Otherwise, we have a derivation that is valid only in
a world where such a term is assumed to exist.
The importance of knowing which fiber we are in is illustrated by the attempt
to prove the existence of a magical fairy from the well-known fact that all fairies
are magical:
Example 5.3.2.1 (magical fairies) If we allow F to represent the type of fairies
and M the predicate that 𝑥 is magical, then we may derive 𝑥 ∶ F | ∀𝑥 ∶ F . M ⊢
∃𝑥 ∶ F . M as shown.
∀𝑥 ∶ F . M 𝑥̂∗ (∀𝑥 ∶ F . M) ∀𝑥 ∶ F . M
ε∀𝑥 (M)
η∃𝑥 (M)
∃𝑥 ∶ F . M 𝑥̂∗ (∃𝑥 ∶ F . M) ∃𝑥 ∶ F . M
𝑥̂ [𝑥↦?]
∅ 𝑥∶F ∅
id
88 CHAPTER 5. DEPENDENCY
Then the fulfillment of childhood dreams awaits us in our own world – just as
soon as we are able to produce any fairy whatsoever.
The commuting triangle of the universal property of the unit,
β𝑙
η(A) ⋅ 𝑥∗̂ (𝒟♯ ) = 𝒟
expresses the local reduction for existential quantification in the category P(Φ ,
𝑥 ∶ X):
A
A 𝒟 A
∗ ∃+†
𝑥̂ (∃𝑥 ∶ X . A) 𝑥∗̂ B 𝒟
𝑥∗̂ (∃−† ) ∃>
𝑥∗̂ B ⟼ 𝑥∗̂ B
We recover the Gentzen version by precomposing 𝑓𝑟𝑜𝑏 and applying a single
substitution for 𝑥 to both sides.
The equation for the adjoint complement of a unit component,
id(∃𝑥 ∶ X . –) = (η –)♯
expresses the local expansion of an identity derivation:
A
∗ ∃+†
∃𝑥 ∶ X . A 𝑥̂ (∃𝑥 ∶ X . A)
∃< ∃−†
∃𝑥 ∶ X . A ⟼ ∃𝑥 ∶ X . A
The naturality of the hom set bijection of this adjunction in the codomain
coordinate,
𝒟♯ ⋅ ℰ = (𝒟 ⋅ 𝑥∗̂ ℰ)♯
or
[A] [A]
𝒟 𝒟
∃𝑥 ∶ X . A 𝑥∗̂ B 𝑥∗̂ B
∃−† 𝑥∗̂ ℰ
B
ℰ ∃𝑥 ∶ X . A 𝑥∗̂ C
∃⇄ ∃−†
C ⟼ C
is the permutation conversion for existential quantification.
We need to ensure that this property holds in our categorical semantics. Unlike
the case of context distributivity, there is nothing special about bicartesian
closed categories that guarantees this will be the case.
First, observe that the interpretation of a single substitution commutes with
that of a single omission:
⟦[𝑦↦𝑡]⟧
ℂ∶ ⟦Φ , 𝑥 ∶ X⟧ ⟦Φ , 𝑥 ∶ X , 𝑦 ∶ Y⟧
⟦𝑥⟧̂ ⟦𝑥⟧̂
⟦Φ⟧ ⟦Φ , 𝑦 ∶ Y⟧
⟦[𝑦↦𝑡]⟧
⟦Φ , 𝑥 ∶ X⟧ ⟦Φ , 𝑥 ∶ X , 𝑦 ∶ Y⟧
⟦[𝑦↦𝑡]⟧
Recall that ⟦∃𝑥⟧ and ⟦∀𝑥⟧ are adjoints to ⟦𝑥⟧̂ ∗ . So it would suffice if we had
a condition that guaranteed that whenever the square above commutes, for
∈ {∀ , ∃}, this one does as well:
Q
⟦[𝑦↦𝑡]⟧∗
BCC ∶ P(⟦Φ , 𝑥 ∶ X⟧) P(⟦Φ , 𝑥 ∶ X , 𝑦 ∶ Y⟧)
⟦ 𝑥⟧
Q
⟦ 𝑥⟧
Q (5.2)
A
𝔸1 𝔸2
G1 ⊢ F1 G2 ⊢ F2
𝔹1 𝔹2
B
𝔸1 ⊃ 𝔹2 (A ⋅ F2 → F1 ⋅ B)
ζ
𝔹1 ⊃ 𝔸2 (G1 ⋅ A → B ⋅ G2 )
Proof. Such a bijection is given by pasting with the respective unit and counit
of the two adjunctions:
A A id
𝔸1 𝔸2 𝔸1 𝔸2 𝔸2
ζ
F2 G1 ⇓ η2
⇓ϕ ⟼ F1 ⇓ϕ F2
F1 ⇓ ε1 G2
𝔹1 𝔹2 𝔹1 𝔹1 𝔹2
B id B
and
A id A
𝔸1 𝔸2 𝔸1 𝔸1 𝔸2
ζ−1
G1 ⇓ η1 F2
⇓ψ ⟼ G1 ⇓ψ G2
G2 F1 ⇓ ε2
𝔹1 𝔹2 𝔹1 𝔹2 𝔹2
B B id
𝔸2 𝔸1 𝔸2
A F2 A η2
G1
ζ F2
𝔸1 ϕ 𝔹2 ⟼ ϕ
F1
ε1 G2
F1 B B
𝔹1 𝔹1 𝔹2
5.3. INTERPRETATION OF QUANTIFICATION 91
and
𝔸1 𝔸1 𝔸2
G1 A η1 A
F2
ζ−1 G1
𝔹1 ψ 𝔸2 ⟼ ψ
G2
F1 ε2
B G2 B
𝔹2 𝔹1 𝔹2
In this form, it’s easy to see how the zigzag laws ensure that going back and
forth in either order amounts to the identity.
Definition 5.3.3.2 (mate) Natural transformations related by the bijection ζ
are each called the other’s mate. If we need to be more specific, we call φ the
left mate of ψ and ψ the right mate of φ, after the adjoint functors involved.
Definition 5.3.3.3 (Beck-Chevalley condition) The Beck-Chevalley condi-
tion is the requirement that the mate of a natural isomorphism is itself a natural
isomorphism.
So in order to ensure that all squares of the form 5.2 commute (at least up
to isomorphism), it suffices to require that the Beck-Chevaley condition hold
in cases where one of the adjoint functors in each adjunction is the reindexing
functor determined by a projection. Then the natural isomorphism in square 5.2
will be the mate of the identity in square 5.1, and its component at a proposition
A will be the isomorphisms between ( 𝑥 ∶ X . A)[𝑦↦𝑡] and 𝑥 ∶ X . (A[𝑦↦𝑡]).
Q Q