Lecture 3: Cartesian closed categories

Teacher: Paul-André Melliès

\[\newcommand\xto\xrightarrow \newcommand\xfrom\xleftarrow\]


  • 1-object categories are monoids

    • Suspension: $M ⟼ ΣM$ (elements of the monoid are made into arrows)
  • Preorders are categories with at most one arrow between two objects
  • Functors: graph morphisms that preserve composition
  • Functor between two-preorder categories = a monotone map
  • Notion of isomorphism in a category

a category where every morphism is an iso

NB: a groupoid with one object = a group.

Functors send isomorphisms to isomorphisms.

Bifunctor from $𝒞$ and $𝒟$ to ${\scr E}$:

a functor $𝒞 × 𝒟 ⟶ {\scr E}$

Equivalently: a bifunctor is given by two families of functors $F(A,\bullet)$ and $F(\bullet, B)$ for all $A, B$ such that the following diagram commutes for all $f, g$:

\[\begin{xy} \xymatrix{ F(A,B) \ar[r]^{ F(A,g) } \ar[d]_{ F(f,B) } & F(A,B') \ar[d]^{ F(f,B') } \\ F(A',B) \ar[r]_{ F(A',g) } & F(A',B') } \end{xy}\]

Definition of the cartesian product:

  • in a preorder category, corresponds to the greatest lower bound (glb) $\bigwedge$ ⟶ uniqueness in the universal property comes from the uniqueness in preorders

NB: in $Set$, you have no choice when it comes to defining $A × B$:

\[\begin{xy} \xymatrix{ A & & B \\ & A × B \ar[lu]^{π_1} \ar[ru]_{π_2} &\\ & 1 \ar[u]_{h \, ≝ \, ⟨a, b⟩} \ar@/^2pc/[luu]^{a} \ar@/_2pc/[ruu]_{b} & } \end{xy}\]

Then, replace the singleton $1$ by any $X$, and you have the universal property of the cartesian product.

Categories that have cartesian products:

  • the category of domains
  • the category of topological spaces (not so obvious):
    • $U_A × B$ and $A × U_B$ must be open sets (where $U_A, U_B$ are open sets), and they generate (as a basis) the topology of $A × B$ (i.e. the topology of $A×B$ is the smallest one containing the cylinders)

Cartesian categories

Cartesian category:

A category that has binary products $A × B$ for all $A, B$ and a terminal object $1$.

In such a cartesian category, you have:

  • weakening maps: $ε_A: A ⟶ 1$
  • diagonal maps $δ_A: A ⟶ A×A$ gotten as

    \[\begin{xy} \xymatrix{ A & & A \\ & A × A \ar[lu]^{π_1} \ar[ru]_{π_2} &\\ & A \ar[u]_{δ_A} \ar@/^2pc/[luu]^{id_A} \ar@/_2pc/[ruu]_{id_A} & } \end{xy}\]
  • symmetry maps $γ_{A,B}: A×B ⟶ B×A$ gotten as

    \[\begin{xy} \xymatrix{ B & & A \\ & B × A \ar[lu]^{π_1} \ar[ru]_{π_2} &\\ & A × B \ar[u]_{γ_{A,B}} \ar@/^2pc/[luu]^{π_2} \ar@/_2pc/[ruu]_{π_1} & } \end{xy}\]

NB: $(\bullet × \bullet): 𝒞 × 𝒞 ⟶ 𝒞$ is a bifunctor.

Show that every cartesian category $𝒞$ is equipped with a functor:

\[× \begin{cases} 𝒞 × 𝒞 &⟶ 𝒞 \\ (A,B) &⟼ A×B \end{cases}\]


  • to every pair of morphisms $(A \xto {h_A} A’, B \xto {h_B} B’)$, one associates the pairing $⟨h_A π_1, h_B π_2⟩$:

    \[\begin{xy} \xymatrix{ A' & & B' \\ & A' × B' \ar[lu]^{π_1} \ar[ru]_{π_2} &\\ & A × B \ar[u]_{⟨h_A, h_B⟩} \ar@/^2pc/[luu]^{h_A π_1} \ar@/_2pc/[ruu]_{h_B π_2} & } \end{xy}\]
  • $×$ preserves identities: $id_A × id_B = ⟨id_A π_1, id_B π_2⟩ = ⟨π_1, π_2⟩ = id_{A×B}$ as there is exactly one arrow from $A×B$ to $A×B$ (universal property of the product)

  • $×$ preserves composition: $(h_A × h_B) \circ (h_A’ × h_B’) = ⟨h_A π_1, h_B π_2⟩ \circ ⟨h_A’ π_1, h_B’ π_2⟩$

    \[\begin{xy} \xymatrix{ A'' & & B'' \\ A' \ar[u]_{h_A'} & A'' × B'' \ar@/^/[lu]^{π_1'} \ar@/_/[ru]_{π_2'} & B' \ar[u]_{h_B'} \\ & A' × B' \ar@/^/[lu]^{π_1} \ar@/_/[ru]_{π_2} \ar[u]_{⟨h_A', h_B'⟩} &\\ & A × B \ar[u]_{⟨h_A, h_B⟩} \ar@/^2pc/[luu]^{h_A π_1} \ar@/_2pc/[ruu]_{h_B π_2} & } \end{xy}\]

    And as $⟨h_A π_1, h_B π_2⟩ \circ ⟨h_A’ π_1, h_B’ π_2⟩$ makes the outer diagram commute, $⟨h_A π_1, h_B π_2⟩ \circ ⟨h_A’ π_1, h_B’ π_2⟩ = ⟨h_A’ h_A π_1, h_B’ h_B π_2⟩$ by uniqueness (universal property).

Cartesian closed category

Cartesian closed category:

a cartesian category $(𝒞, ×, 1)$ equipped with:

  • an object $A ⇒ B$
  • a morphism $eval_{A, B}: A × (A⇒B) ⟶ B$ such that for every object $X$ and morphism $f: A × X ⟶ B$, there exists a unique morphism $h: X ⟶ A⇒B$ making the following diagram commute:
\[\begin{xy} \xymatrix{ A × (A⇒B) \ar[r]^-{ eval_{A,B} } & B \\ A×X \ar[u]^{ id_A × h } \ar@{->}[ru]_{ f } & } \end{xy}\]

Reminder $L ⊣ R$: $L$ is left adjoint to $R$:

\[ℬ(LA, B) \overset{ϕ_{A,B}}{≅} 𝒜(A, RB)\]

natural in $A, B$. Unit and counit.

Example: $U: Mon ⟶ Set$ the forgetful functor, $L ≝ (\bullet)^\ast: Set ⟶ Mon$ the free-monoid functor.


\[\begin{xy} \xymatrix{ U A^\ast \ar[r]^{ f^+ } \ar@{<-}[d]_{ η_A } & U M \\ A \ar[ru]_{ f } & } \end{xy}\]

Counit (evaluation):

\[ε_M: \begin{cases} (UM)^\ast &⟶ M \\ [m_1, ⋯, m_n] &⟼ m_1 \cdot ⋯ \cdot m_n\\ [\,] &⟼ e_M\\ \end{cases}\]

So, other definition of a cartesian closed category:

Cartesian closed category:

a cartesian category $(𝒞, ×, 1)$ such that there is an adjunction $A × \bullet ⊣ A⇒ \bullet$

\[ϕ_{A, B}: \begin{cases} 𝒞(A×B, C) &\overset{≅}{⟶} 𝒞(B, A ⇒ C) \\ A×B \xto f C &⟼ B \xto {λa.f} A ⇒ C \end{cases}\]

NB: the counit $ε_A: A ×(A ⇒ B) ⟶ B$ of $A × \bullet ⊣ A⇒ \bullet$ is the evaluation map, and the unit $η_A: B ⟶ A ⇒ (A × B)$ is the coevaluation map ($b ⟼ (λa. (a,b))$).

Usefulness of this categorical idea of cartesian closed categories (CCC):

Gérard Béry’s stable functions:

  • continuity: you cannot use an infinite amount of information to compute something (computation in finite time)
  • stability: understanding the causality of computations (what part of the input is related to the output)

At first, Béry was not sure about stable functions being a good model of simply typed $λ$-calculus. He went in Edinburgh and met Plotkin, the latter said: « all you have to check is that you have a cartesian closed category ».

Naturality condition in the adjunction definition:

Prop: every category $𝒞$ induces a functor:

\[{\rm Hom}: \begin{cases} 𝒞^{op} × 𝒞 &⟶ Set \\ (A, B) &⟼ {\rm Hom}(A,B) \end{cases}\]

A morphism in $𝒞^{op} × 𝒞$ from $(A,B)$ to $(A’,B’)$, is a pair of maps $h_A: A’ ⟶ A$ and $h_B: B⟶B’$. \({\rm Hom}(h_A, h_B) ≝ h_B \circ \bullet \circ h_A\)

Prop: A group $G$ acting on a set is the same thing as a functor $ΣG ⟶ Set$

Naturality here amounts to every commutative square

\[\begin{xy} \xymatrix{ LA \ar[rr]^{ g } \ar@{<-}[d]_{ Lh_A } && B \ar[d]^{ h_B } \\ LA' \ar[rr]_{ f } && B' } \end{xy}\]

being turned into a commutative square:

\[\begin{xy} \xymatrix{ A \ar[rr]^{ ϕ_{A,B}(g) } \ar@{<-}[d]_{ h_A } && RB \ar[d]^{ Rh_B } \\ A' \ar[rr]_{ ϕ_{A',B'}(f) } && RB' } \end{xy}\]

The category of Domains is cartesian closed

  • The projection maps of the product are continuous
  • The evaluation map $eval_{A, B}: A × (A ⇒ B) ⟶ B$ is continuous
  • For every $x$ and $f: A × X ⟶ B$, there exists a unique morphism $h: X ⟶ (A ⇒ B)$ making the following diagram commute:

    \[\begin{xy} \xymatrix{ A × (A ⇒ B) \ar[r]^-{ {eval_{A,B}} } \ar[d]_{ A × h} & B \\ A × X \ar[ru]_{ f } & } \end{xy}\]

    that is, show that

    \[h: x ⟼ (a ⟼ f(a,x))\]

    is continuous when $f$ is (and then use the fact that $Set$ is cartesian closed).

NB: $U: Dom ⟶ Set$ is lax:

\[U(D × E) = U(D) × U(E)\\ U(D ⇒ E) \not ≅ UD ⇒ UE\]

NB: a functor preserving both the product and the exponential is called logical.

Leave a comment