Let $\mathbb{C}$ be a logic. Categories in $\mathbb{C}$ are types with self-relations, and these form a richer logic which we call $\mathrm{Cat}[\mathbb{C}]$.

<aside> ❔ In category theory, what we call “categories” are called monads. Some may have heard of the functional concept of monad, in programming, but ours is the relational concept of monad.

</aside>

Category

A category in $\mathbb{C}$ is a type $\underline{\mathrm{C}}$ and a self-relation $\mathrm{C}: \underline{\mathrm{C}}\,|\, \underline{\mathrm{C}}$

cat-1.png

which gives for each pair of elements $\mathrm{a,b}:\underline{\mathrm{C}}$ a relation $\mathrm{C(a,b)}:\mathbb{V}$, and these have composition and identity: inferences

$\mathrm{comp:C(a,b) \circ C(b,c)\to C(a,c)}$

$\mathrm{comp:C(a,b) \circ C(b,c)\to C(a,c)}$

$\mathrm{id:C_\bullet(c=c)\to C(c,c)}$

$\mathrm{id:C_\bullet(c=c)\to C(c,c)}$

so that composing is associative

cat-3-assoc-0.png

$(f\cdot g)\cdot h$

cat-3-assoc-1.png

$f\cdot (g\cdot h)$

and unital.

cat-3-unit-l.png

$\mathrm{id.a}\cdot f$

cat-3-unit-r.png

$f\cdot \mathrm{id.a}$

This is called a “monad” in category theory, and in fact virtually every kind of “category” is a monad!

When $\mathbb{C}$ is the logic of set-matrices, a category is a category.

When $\mathbb{C}$ is the logic of distance, a category is a metric space.