4

I always come across this idea. It seems that constants can be considered nullary/$0$-arity functions. What is the intuition behind that?

J. W. Tanner
  • 60,406

2 Answers2

9

A function of arity $n$ on the universe $A$ is a function $$ f \colon A^n \to A. $$

Of course $A^0$ has only one point, say $*$. So a function $$ f \colon A^0 \to A $$ is the constant function with value $f(*)$.

GEdgar
  • 111,679
6

It makes sense if we consider an object to be a function of the least possible arity. Just as $x^3$ depends only on $x$ but not on $y$ so can be defined to have an arity of $1$ instead of $2$, a constant has arity $0$ (if we say so). You can think of it in programming terms (I'll use Python):

def arity_1_function(x): return x ** 3
def arity_0_function(): return 12

In general a function can have greater arity than this approach assumes, so we could think of a constant as having any non-negative arity; all we're doing here is identifying a constant with a minimum-arity function as a convention.

J.G.
  • 115,835