I realize this is a bit pedantic, but I am not sure if there is a term for a function which maps from an empty domain to a range of size one. I am a programmer, and not a mathematician, but was thinking of a general case for a single variable. So something like,

f(x) = x

int f(int x) { returns x; }

is a linear mapping of the integer domain to the integer codomain. If I had:

g(x) = 4

int g(int x) { returns 4; }

that is again a linear mapping of the integer domain to the integer codomain, with range of size 1. I am not sure if this is mathematically correct to say so but if I had:

h() = 5

int h() { return 5; }

that takes no input, thus there an empty domain, but the codomain is still integers and the range is of size 1. Is there a special term for this?

this is coming from the idea that:

int i = 5;


int h() { return 5; }

are the 'same'. Thus if there is a term to describe the function h, it can describe what 'i' is.

Some background, I became interested in this question when I realized (though the definition of tensors can vary) that singular numbers are tensors of rank 0 (scalars). I want to know if singular numbers can also be described as a special case of functions.


The domain of your h is not really the empty set. If it were so, it would be impossible to get a function value out of it.

Rather, the domain of h is a set with exactly one element, and that element is the empty tuple (). (Or some other abstract representation of "here are all the $0$ arguments given in the call).

(Functional languages like ML or Haskell make this more explicit and orthogonal than typical imperative or OO languages.)

I don't think there is any particular word for such functions in mathematics. The closest mathematical expression of the situation would be to say that the function space $1\to X$ is naturally in bijection with $X$, or with different notation $X^1\cong X$ -- but those do not provide a word for the function.

  • $\begingroup$ I am a bit confused though, I thought that the domain of h is an empty set though because there is no input. If h had a domain as a set with exactly one element, wouldn't it be h(x) where x can only be one number? $\endgroup$ – Michael Choi Nov 21 '18 at 19:59
  • $\begingroup$ @MichaelChoi: Nobody says the input to a function has to be a number. For int k(int a, int b) it is two numbers, and for int j(String a) it's a string. With your int h() the input is a list with no values in it, but this list certainly a thing. And the set that contains that thing is not the empty set. $\endgroup$ – hmakholm left over Monica Nov 21 '18 at 21:23
  • $\begingroup$ @MichaelChoi: In a sense the void type in C-like languages is exactly the one-element type we're speaking of. Many languages restrict what it can be used for, but usually you can declare a function as returning void. Then when you write return; the compiler supplies the single, unnamed, element of that for you. The type is not the empty set, because by definition it would be impossible to return if you needed to pass an element of the empty set. (And in C your function would even be declared as int h(void), though that is more for profane syntactical reasons that due to theory). $\endgroup$ – hmakholm left over Monica Nov 21 '18 at 21:28
  • 1
    $\begingroup$ A type that truly corresponds to an empty set would be a bottom type. It rarely has a name in programming languages, but one might imagine a noreturn that could syntactically appear as the return type of a function. (As input it would be cannotcall, which is less practically useful). $\endgroup$ – hmakholm left over Monica Nov 21 '18 at 21:32

Although it invokes an unnecessary degree of abstraction, I suppose one could use the mathematical term global element for such a function [taking into account the necessary correction of the question in Henning Makholm's answer, of course]. Quoting user Andrea's answer to the question Elements and arrows in a category:

As you noted, in the definition of a category, objects do not have elements. However, in a category there can be arrows that act like the elements of a set would do.

In a category $\mathbf{C}$, a terminal object, call it $1$, is defined as follows. For any object $A$ of $\mathbf{C}$ there exists a unique arrow $!:A \rightarrow 1$. Terminal objects are unique up to isomorphism. In a category with a terminal object $1$, any given object $A$ then, there is a unique arrow to $1$, but there may be several arrows $a:1 \rightarrow A$ to the object. These are called global elements or points of $A$. [$\ldots$]

To see why this is interesting, lets look at $\mathbf{Sets}$, the category of sets and functions. There, the terminal object is any set containing only one element, like $1 \equiv \{1\}$. For each set $X$ there is only one function to it, ie $ \forall x \in X : x \mapsto 1$ so this is a terminal object. The [global] elements of $X$ then are the functions (arrows) from $\{1\} \rightarrow X$, and it is easy to see that the set of such arrows is isomorphic to the set of elements of $X$, In other words, for each element $x\in X$ there is an arrow $\{1\} \rightarrow X$, the function $1\mapsto x$. And for each arrow there is an element. Thus in $\mathbf{Sets}$, the [global] elements of $X$ reduce to the elements of $X$.

See also Global element - Wikipedia, or generalized element in nLab, or page 78 of Robert Goldblatt, Topoi: The Categorial Analysis of Logic (2nd ed. 1984, repr. Dover 2006) - although he just calls them elements, which would be confusing in this context!


Interesting question.

I think that speaking strictly mathematically the "function" $h$ that takes no input and returns a value is not a function, since a function is defined as a set of ardered pairs ...

It is in effect just a way to insert a constant when it's called.

Of course there is every reason to call it a function in a computer program, and even a good thing to do, since you can then change the value of that constant by changing the code for the function without having to find all the places it's called. (There are other programming strategies for this design.)

  • $\begingroup$ I am wondering then, can constants be considered in the set of empty functions? (from by answer earlier) or are they fundamentally different? $\endgroup$ – Michael Choi Nov 21 '18 at 19:33

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.