On Wikipedia and also after searching this forum there is stated that for each $A$ there exists a unique function $f : \emptyset \to A$ called the empty function for $A$.

In the theory of Algebraic Data Types (ADT's) and in functional programming languages (like Haskell) where one paradigma is "everything is a function" it is common to interpret constants as $0$-ary functions. A nullary function is just a function of the form $f : \emptyset \to A$, and so for every $A$ there must be such a function under this interpretation (so $|A|$ such functions) and this contradicts the uniques of one empty function for every $A$.

Also on Wikipedia I read.

The n-ary cartesian power of a set X is isomorphic to the space of functions from an n-element set to X. As a special case, the 0-ary cartesian power of X may be taken to be a singleton set, corresponding to the empty function with codomain X.

So $X^0 = \{ x \}$, but otherwise if I interpret $Y^X$ as the set of functions from $X$ to $Y$ and interpret $X^n$ as $X^{\{1,\ldots,n\}}$ then $X^0 = X^{\emptyset} = \{ f : \emptyset \to X \}$? Could someone please clarify, I am confused...

EDIT: Okay guess I got it now, but still confused. For every $A$ there is a unique $f : \emptyset \to A$, but that is not equal to $f : A^0 \to A$, with $A^0 = \{ f : \emptyset \to A \}$ there are exactly $|A|$ functions $f : A^0 \to A$. But then I guess the following one statement about the nullary product on Wikipedia is wrong, that if the index set $I$ is empty, that $$ \prod_{\emptyset} = \{ f_{\emptyset} : \emptyset \to \emptyset \}. $$ because there the set over which the product is built is lost?

  • 2
    $\begingroup$ That's right. There's a unique function $\emptyset \to X$. But a nullary function is a function $X^0 \to X$. $\endgroup$ – Zhen Lin Oct 27 '13 at 20:05
  • $\begingroup$ First, not everything is a function. Second, if you insist on viewing a constant as a function, then it is a function whose domain is a singleton set, a terminal object. Sort of like (), just without $\perp$. $\endgroup$ – Daniel Fischer Oct 27 '13 at 20:07
  • $\begingroup$ I think the right name here for what you are talking about is "map". In a function should always be $A=R$ $\endgroup$ – dmtri Jun 23 '18 at 16:00

A function $f$ from set $X$ to set $A$ is a triple $\left(X,G,A\right)$ where $G\subset X\times A$ and such that $\forall x\in X\exists!a\in A\;\left(x,a\right)\in G$.

If here $X=\emptyset$ then automatically $G=\emptyset$ and the mentioned condition is satisfied vacuously. So $\left(\emptyset,\emptyset,A\right)$is a function from $\emptyset$ to $A$ and is automatically unique. Your definition $A^{0}=A^{\emptyset}=\left\{ f\mid f:\emptyset\rightarrow A\right\} $ is correct. It contains for every $A$ (not every element of $A$) exactly one element.

Elements of $A$ can be identified with functions $f:*\rightarrow A$ where $*$ denotes a fixed singleton (not the empty set). Taking for instance $*=\left\{ 0\right\} $ we have the function $\left(\left\{ 0\right\} ,\left\{ \left(0,a\right)\right\} ,A\right)$ corresponding with element $a\in A$.


We can define $\sqcap_{i\in I}X_{i}$ as the set of functions $f:I\rightarrow\cup_{i\in I}X_{i}$ with $\forall i\in I\; f\left(i\right)\in X_{i}$, but doing so it must be kept in mind that here we are not defining the product, but a product of the family of $\left(X_{i}\right)_{i\in I}$ and this with projections $p_{i}$ defined by $f\mapsto f\left(i\right)$. If we loose that out of sight than ambiguity can arise. For instance if $\forall i\in I\; X_{i}=X$ then the product can be abreviated as $X^{I}=\mathbf{Set}\left(I,X\right)$ . If $I\neq\emptyset$ then this set equals the set $\sqcap_{i\in I}X_{i}$ defined as above. However in special case $I=\emptyset\wedge X\neq\emptyset$ it does not, because $\cup_{i\in I}X_{i}=\emptyset\neq X$. As magma states well in his comment: products are defined up to isomorphism. In category $\mathbf{Set}$ any singleton can serve as product of an empty family. The singletons are in fact the terminal objects there.

  • $\begingroup$ thx. according to your explanation for $A \ne B$ then $f:\emptyset \to A \ne g:\emptyset \to B$ because $(\emptyset,\emptyset, A) \ne (\emptyset, \emptyset, B)$, but regarding en.wikipedia.org/wiki/Empty_product $A^0$ equals $\{ f : f : \emptyset \to \emptyset \}$ which implies that all empty function are essentially the same, i.e. $f:\emptyset \to A$ should equal $g:\emptyset \to B$, comparing my comment in Itty Weiss anwser... $\endgroup$ – StefanH Oct 27 '13 at 20:35
  • $\begingroup$ The function defined in my answer is the one that is used in categories where it is demanded that homsets are disjoint. The element in hom($\emptyset$,$A$) is different from the one in hom($\emptyset$,$B$) if these sets are distinct. The set $\left\{ f\mid f:\emptyset\rightarrow\emptyset\right\} $ is in fact the set $\emptyset^{\emptyset}$ (if $A\neq\emptyset$ then not $A^{\emptyset}$). On Wikipedia they speak of 'zero raised to zero'. $\endgroup$ – drhab Oct 27 '13 at 20:45
  • $\begingroup$ in the paragraph "Nullary Cartesian product" they not just speak of "zero raised to zero", they state the general definition of cartesian product and state that just $f: \emptyset \to \emptyset$ statisfies it, this is because $\bigcup_{i\in I} X_i = \emptyset$ for $I = \emptyset$ and so $X^{\emptyset} = \{ f : \emptyset \to \emptyset \}$ and not $\{ f : \emptyset \to X \}$. $\endgroup$ – StefanH Oct 27 '13 at 20:57
  • $\begingroup$ $I=\emptyset$ and (consequently) $\cup_{i\in I}X_{i}=\emptyset$ so the empy product is the set of functions from $\emptyset$ (corresponding with $I$) to $\emptyset$ (corresponding with $\cup_{i\in I}X_{i}$). This leads to $\prod_{i\in\emptyset}X_{i}=\emptyset^{\emptyset}$ (I am going to sleep now, tomorrow I will have a second look at all this) $\endgroup$ – drhab Oct 27 '13 at 21:16
  • $\begingroup$ @Stefan your objection is correct. The problem stems from the fact that wikipedia is slighty wrong. Wikipedia should not write that the empty product is equal to....(using the equality sign), because the cartesian product is actually defined up to isomorphism and not by an equality. In other words: the equal signs that you see in the wikipedia section on nullary cartesian products should be replaced with isomrphism signs. To recap: $f \neq g$ so $A^{\emptyset} \neq B^{\emptyset}$ , but they are both isomorphic to singleton sets $\endgroup$ – magma Oct 27 '13 at 21:24

An $n$-any function on a set $X$ is a function $X^n\to X$, where $X$ is the $n$-fold cartesian product of $X$ with itself. Thus, a $0$-ary function is a function $X^0\to X$, not $\emptyset \to X$. So the question is to figure out what $X^0$ is. One way to reason about what it should be is to note that $X^n\times X^m$ is essentially the same as $X^{n+m}$ (as most people will agree is true for all $m,n>0$. To make this true also for $n=0$, we need, e.g., that $X^0\times X^m$ is essentially the same as $X^m$. Which set has $Y$ has the property that $Y\times X^m$ is essentially just $X^m$ (for $X\ne \emptyset$)? Well, a moment's thought should reveal that the answer is that $Y$ can be any singleton set.

So, to preserve some basic realizations about the cartesian product of sets, it makes sense to define $X^0$ (for nonempty $X$) to be a singleton set (whichever one you want).

Another way to argue is categorically. The cartesian product of sets is a special case of the notion of categorical product, and $X^0$ corresponds to an empty product. The universal property for the empty product is just a terminal object in the category. The terminal objects in the category of sets are precisely the singletons.

I just saw your edit: Notice that the conventions agree: $X^0=X^\emptyset =\{\emptyset \to X\}$ is a singleton set.

  • $\begingroup$ yes thanks clarifed a lot, but still have a question on the wiki-article for the empty produkt, there it is stated $\prod_{\emptyset} = \{ f : \emptyset \to \emptyset \}$, where in some sense the reference to the underlying set over which the product is taken is lost. but it makes sense if considering that $\bigcup_{\emptyset} X_i = \emptyset$, so does that mean that for every $A$ the functions $f_{\emptyset} : \emptyset \to A$ are the same (especially substituting $A = \emptyset$)? $\endgroup$ – StefanH Oct 27 '13 at 20:16
  • $\begingroup$ a function is a triple $(dom,cod,f)$, the domain, the codomain, and the function. So, for two different sets $A,B$ the corresponding empty functions are different since they have different codomains. $\endgroup$ – Ittay Weiss Oct 27 '13 at 20:58

A function from a set $A$ to a set $B$ is a subset $S$ of $A\times B$ such that for every $a \in A$, there is a unique $(a,b) \in S$. According to this definition, the empty subset $\phi$ of $\phi\times B$ is a function, and $\phi$ is the unique function from $\phi$ to $B$. Therefore, the number of functions from $A$ to $B$ (for finite sets $A,B$) is $|B|^{|A|}$, which is also consistent with the fact that the number of functions from $\phi$ to $A$ for any finite $A$ is $|A|^0 = 1$.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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