Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hi have a questioning regarding the modelling of $n$-ary functions and constants.

First in the category of sets I know that the empty set $\emptyset$ is initial because for every other set $X$ there exists exactly one function $f$ such that $f: \emptyset \to X$ because there is no argument to choose from in the domain and set it's value, this function is unique.

I have some experience with functional programming languages and I heard that category theroy is applied in modelling them, but I am not so much into this stuff yet. But I asked myself how to model $n$-nary functions in category theory. My prior knowledge is

1) An $n$-nary function in mathematics could be modelled by cross-products, i.e a binary function on $\mathbb{N}$ is $f: \mathbb{N} \times \mathbb{N} \to X$.

2) In computer sciene and functional programming languages constants are sometimes modelled as $0$-ary functions (and in some algebraic approaches to model theory the constants are also interpreted as $0$-ary functions).

But here starts my conceptual confusion. First, the cross products of sets are also in the category of sets. So it would be now problem to represent a binary function by an arrow $f : \mathbb{N} \times \mathbb{N} \to X$. But what is the arity of the function $f : \emptyset \to X$. Because of $\emptyset \times X = \emptyset$, it should have all arities, i.e. it has $0$-arity, $1$-arity, binary and so on. So because it is $0$-arity too it should represent a constant, but what should this constant be?

But what really bothers me, how could the $0$-ary functions be represented in category theory (in the category of sets) as an arrows? I found some $0$-ary functions, the functions $f: \emptyset \to X$, but I am unsure how these could model constants?

Any hints or further suggestions for me, or is my attempt at modelling arity totally wrong?

share|cite|improve this question
up vote 7 down vote accepted

Your mistake is in thinking that $\mathbb N^0$ is the empty set. But actually it isn't, it is a singleton set.

Set-theoretically, $\mathbb N^0$ is the set of all functions $\{\}\to\mathbb N$, and there is exactly one such function: the empty function. So $\mathbb N^0=\{\varnothing\}=1$, not $\varnothing$ itself.

In category theory, $\varnothing$ cannot be the unit of the product operation, because, as you have noticed $\varnothing\times A$ is not isomorphic to $A$ in general.

However $1\times A$ is isomorphic to $A$ in $\mathbf{Set}$, so $1$ is the correct domain to choose for a nullary function.

And clearly the possible functions $1\to B$ correspond exactly to the elements of $B$, which is what a "nullary function" intuitively ought to be.

share|cite|improve this answer

This question has nothing to do with category theory.

A $n$-ary operation on $X$ is a map $\omega : X^n \to X$. For example, $2$-ary means binary, $1$-ary means unary. A $0$-ary operation is a map $X^0 \to X$. Since $X^0$ has exactly one element (it is the terminal object of $\mathsf{Set}$, but you don't need to know that here), this map corresponds to an element of $X$. So $0$-ary operations are constants.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.