language-icon Old Web
English
Sign In

Arity

In logic, mathematics, and computer science, the arity /ˈærɪti/ (listen) of a function or operation is the number of arguments or operands that the function takes. The arity of a relation (or predicate) is the dimension of the domain in the corresponding Cartesian product. (A function of arity n thus has arity n+1 considered as a relation.) The term springs from words like unary, binary, ternary, etc. Unary functions or predicates may be also called 'monadic'; similarly, binary functions may be called 'dyadic'. In logic, mathematics, and computer science, the arity /ˈærɪti/ (listen) of a function or operation is the number of arguments or operands that the function takes. The arity of a relation (or predicate) is the dimension of the domain in the corresponding Cartesian product. (A function of arity n thus has arity n+1 considered as a relation.) The term springs from words like unary, binary, ternary, etc. Unary functions or predicates may be also called 'monadic'; similarly, binary functions may be called 'dyadic'. In mathematics, arity may also be named rank, but this word can have many other meanings in mathematics. In logic and philosophy, arity is also called adicity and degree. In linguistics, arity is usually named valency. In computer programming, there is often a syntactical distinction between operators and functions; syntactical operators usually have arity 0, 1, or 2 (the ternary operator ?: is also common). Functions vary widely in the number of arguments, though large numbers can become unwieldy. Some programming languages also offer support for variadic functions, i.e., functions syntactically accepting a variable number of arguments. The term 'arity' is rarely employed in everyday usage. For example, rather than saying 'the arity of the addition operation is 2' or 'addition is an operation of arity 2' one usually says 'addition is a binary operation'.In general, the naming of functions or operators with a given arity follows a convention similar to the one used for n-based numeral systems such as binary and hexadecimal. One combines a Latin prefix with the -ary ending; for example: Sometimes it is useful to consider a constant to be an operation of arity 0, and hence call it nullary. Also, in non-functional programming, a function without arguments can be meaningful and not necessarily constant (due to side effects). Often, such functions have in fact some hidden input which might be global variables, including the whole state of the system (time, free memory, ...). The latter are important examples which usually also exist in 'purely' functional programming languages. Examples of unary operators in mathematics and in programming include the unary minus and plus, the increment and decrement operators in C-style languages (not in logical languages), and the successor, factorial, reciprocal, floor, ceiling, fractional part, sign, absolute value, square root (the principal square root), complex conjugate (unary of 'one' complex number, that however has two parts at a lower level of abstraction), and norm functions in mathematics. The two's complement, address reference and the logical NOT operators are examples of unary operators in math and programming. All functions in lambda calculus and in some functional programming languages (especially those descended from ML) are technically unary, but see n-ary below. According to Quine, the Latin distributives being singuli, bini, terni, and so forth, the term 'singulary' is the correct adjective, rather than 'unary.'Abraham Robinson follows Quine's usage.

[ "Algorithm", "Combinatorics", "Discrete mathematics", "Algebra" ]
Parent Topic
Child Topic
    No Parent Topic