Term for function which maps an empty set to range of size one

114 Views Asked by At

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;

and

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.

3

There are 3 best solutions below

4
On BEST ANSWER

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.

1
On

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.)

1
On

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!