The definition of natural numbers according to Category Theory

category-theorynatural numbers

Can someone explain to me the definition of natural numbers in Category Theory in an easy-to-understand language with little to no prior knowledge of the theory if at all possible?

I checked this Wikipedia page but unfortunately couldn't understand.

Best Answer

$\require{AMScd}$You can define natural numbers as follows (or in a similar programming language that supports the same structures you need; I'm using Haskell because this comes from a lecture I gave):

data N = Z
       | Suc N
       deriving (Eq, Show)

You don't have to really understand what's going on, if you are not familiar with Haskell. This is just the way you tell Haskell that a new data type, called N contains terms ("elements") of two possible kinds: either Z (zero, of course), or an element of the form Suc n for another $n\in \mathbb N$.

This defines the type of natural numbers: there is nothing else inside $\mathbb N$ other than $0,1=Suc\; 0,2=Suc\; (Suc\; 0),\dots$; from this it follows basically everything you know about the natural numbers. For example, the plus function can be defined "by induction", because in order to define n m + you only have to tell me what is 0 m + and what is (Suc n) m +; all else follows. So:

plus :: N -> N -> N
plus Z n = n -- 0 + n = n, for all n
plus (Suc m) n = Suc (plus m n) -- (1 + m) + n = 1 + (m + n), for all m,n 

This works: for example, 1 1 + = 2:

Prelude> (Suc Z) `plus` (Suc Z)
      => Suc (Suc Z)

So far so good. We can define things using induction. But what happened exactly? Category theory is helpful to understand it.

Define a category $\textsf{Dyn}$ whose objects are triples $(X, t : X \to X,x : X)$, i.e. diagrams $$ \begin{CD} 1 @>>x> X @>>t> X \end{CD} $$ and morphisms between $(X,t,x)$ and $(Y,g,y)$ consist of functions $u : X \to Y$ such that $u(x)=y$ and $u\circ t=g\circ u$, i.e. of commutative diagrams $$ \begin{CD} 1 @>>x> X @>>t> X \\ @| @VuVV @VVuV \\ 1 @>>y> Y @>>g> Y \end{CD} $$ The object $\mathbf{N}=(\mathbb{N}, \text{s} : \mathbb N \to \mathbb N, 0 : \mathbb N)$, or rather the type N of the type declaration above, belongs to this category if we let $\text{s}$ be the function Suc :: N -> N sending a natural number to its successor.

Let $\mathbf{X} = (X,t,x)$ be any object of $\sf Dyn$; then, there is an arrow $u : \mathbf N \to\mathbf X$ in $\sf Dyn$ such that $$ \begin{CD} 1 @>>z> \mathbb N @>>> \mathbb N \\ @| @VuVV @VVuV \\ 1 @>>x> X @>>t> X \end{CD} $$ This means that given an initial value $u(0)=x$ and any endomorphism of the set $X$, there is a unique possible way to define a sequence of element $u(n)$ of $X$ recursively, by setting $u(0) = x$ and $u(n+1) = t(u(n))$.

Moreover, such a function $u$ is unique with respect to this property; if there is another sequence $v : \mathbb N \to X$ with the same property, the equality of $u,v$ can be assessed ``by induction'' using $t$: $u(0)=v(0)=x$, and $u(n+1)=t(u(n))=t(v_n)=v(n+1)$. This means precisely that $\bf N$ is an initial object of the category $\textsf{Dyn}$.

The category $\sf Dyn$ models the notion of a discrete dynamical system: a set $X$ and an initial state $x : X$ are given, together with a function $t : X \to X$ mapping evolution of the system in discrete time, according to the function $t$.

This universal property amounts exactly to the request you see in the Wikipedia page.

Related Question