0
$\begingroup$

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

$\endgroup$
7
$\begingroup$

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(*)$.

$\endgroup$
4
$\begingroup$

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.

$\endgroup$

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.