HOME

TheInfoList




Arity () is the number of
arguments In logic Logic (from Ancient Greek, Greek: grc, wikt:λογική, λογική, label=none, lit=possessed of reason, intellectual, dialectical, argumentative, translit=logikḗ)Also related to (''logos''), "word, thought, idea, argument, ...
or
operand In mathematics an operand is the object of a mathematical operation, i.e., it is the object or quantity that is operated on. Example The following arithmetic expression shows an example of operators and operands: :3 + 6 = 9 In the above example, ...
s taken by a
function Function or functionality may refer to: Computing * Function key A function key is a key on a computer A computer is a machine that can be programmed to carry out sequences of arithmetic or logical operations automatically. Modern comp ...
or operation in
logic Logic is an interdisciplinary field which studies truth and reasoning. Informal logic seeks to characterize Validity (logic), valid arguments informally, for instance by listing varieties of fallacies. Formal logic represents statements and ar ...

logic
,
mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and their changes (cal ...
, and
computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application. Computer science is the study of computation, automation, a ...
. In mathematics, arity may also be named ''rank'', but this word can have many other meanings in mathematics. In logic and philosophy, it is also called adicity and degree. In
linguistics Linguistics is the scientific study of language A language is a structured system of communication Communication (from Latin Latin (, or , ) is a classical language belonging to the Italic languages, Italic branch of the Indo ...

linguistics
, it is usually named valency.


Examples

The term "arity" is rarely employed in everyday usage. For example, rather than saying "the arity of the
addition Addition (usually signified by the plus symbol The plus and minus signs, and , are mathematical symbol A mathematical symbol is a figure or a combination of figures that is used to represent a mathematical object A mathematical object is an ...

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 system A numeral system (or system of numeration) is a writing system for expressing numbers; that is, a mathematical notation for representing numbers of a given set, using Numerical digit, digits or other symbols in a consistent manner. The same s ...
s such as
binary Binary may refer to: Science and technology Mathematics * Binary number In mathematics and digital electronics, a binary number is a number expressed in the base-2 numeral system or binary numeral system, which uses only two symbols: ty ...
and
hexadecimal In mathematics and computing, the hexadecimal (also base 16 or hex) numeral system is a Numeral system#Positional systems in detail, positional numeral system that represents numbers using a radix (base) of 16. Unlike the decimal system repres ...
. One combines a
Latin Latin (, or , ) is a classical language belonging to the Italic languages, Italic branch of the Indo-European languages. Latin was originally spoken in the area around Rome, known as Latium. Through the power of the Roman Republic, it became ...

Latin
prefix with the -ary ending; for example: * A nullary function takes no arguments. ** Example: f()=2 * A
unary function A unary function is a function that takes one argument In logic Logic (from Ancient Greek, Greek: grc, wikt:λογική, λογική, label=none, lit=possessed of reason, intellectual, dialectical, argumentative, translit=logikḗ)Also ...
takes one argument. ** Example: f(x)=2x * A
binary function In mathematics, a binary function (also called bivariate function, or function of two variables) is a function (mathematics), function that takes two inputs. Precisely stated, a function f is binary if there exists Set (mathematics), sets X, Y, Z ...
takes two arguments. ** Example: f(x,y)=2xy * A ternary function takes three arguments. ** Example: f(x,y,z)=2xyz * An ''n''-ary function takes ''n'' arguments. ** Example: f(x_1, x_2, \ldots, x_n)=2\prod_^n \displaystyle x_i


Nullary

Sometimes it is useful to consider a
constant Constant or The Constant may refer to: Mathematics * Constant (mathematics) In mathematics, the word constant can have multiple meanings. As an adjective, it refers to non-variance (i.e. unchanging with respect to some other Value (mathematics ...
to be an operation of arity 0, and hence call it ''nullary''. Also, in non-
functional programming In computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application. Computer science is the study of , ...
, a function without arguments can be meaningful and not necessarily constant (due to
side effect In medicine Medicine is the science Science () is a systematic enterprise that builds and organizes knowledge Knowledge is a familiarity, awareness, or understanding of someone or something, such as facts ( descriptive knowledge) ...
s). Often, such functions have in fact some ''hidden input'' which might be
global variable In computer programming Computer programming is the process of designing and building an executable In computing, executable code, an executable file, or an executable program, sometimes simply referred to as an executable or binary, causes ...
s, including the whole state of the system (time, free memory, …). The latter are important examples which usually also exist in "purely" functional programming languages.


Unary

Examples of
unary operator In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It ...
s 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 Successor is someone who, or something which succeeds or comes after (see success (disambiguation), success and Succession (disambiguation), succession) Film and TV * The Successor (film), ''The Successor'' (film), a 1996 film including Laura Girli ...
,
factorial In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers ( and ), formulas and related structures (), shapes and spaces in which they are contained (), and quantities and their changes ( and ). There is no g ...
,
reciprocal Reciprocal may refer to: In mathematics * Multiplicative inverse, in mathematics, the number 1/''x'', which multiplied by ''x'' gives the product 1, also known as a ''reciprocal'' * Reciprocal polynomial, a polynomial obtained from another poly ...

reciprocal
,
floor A floor is the bottom surface of a room or vehicle. Floors vary from simple dirt in a cave to many-layered surfaces made with modern technology. Floors may be stone, wood, bamboo, metal or any other material that can support the expected load ...

floor
,
ceiling A ceiling is an overhead interior surface that covers the upper limits of a room In a building, a room is any space Space is the boundless three-dimensional extent in which objects and events have relative position and direction. Physi ...

ceiling
,
fractional part The fractional part or decimal part of a non‐negative real number Real may refer to: * Reality, the state of things as they exist, rather than as they may appear or may be thought to be Currencies * Brazilian real (R$) * Central American Republi ...
,
sign A sign is an object Object may refer to: General meanings * Object (philosophy), a thing, being, or concept ** Entity, something that is tangible and within the grasp of the senses ** Object (abstract), an object which does not exist at ...
,
absolute value In , the absolute value or modulus of a  , denoted , is the value of  without regard to its . Namely, if is , and if is (in which case is positive), and . For example, the absolute value of 3 is 3, and the absolute value of − ...

absolute value
,
square root In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities ...

square root
(the principal square root),
complex conjugate In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers ( and ), formulas and related structures (), shapes and spaces in which they are contained (), and quantities and their changes ( and ). There is no gen ...
(unary of "one" complex number, that however has two parts at a lower level of abstraction), and
norm Norm, the Norm or NORM may refer to: In academic disciplines * Norm (geology), an estimate of the idealised mineral content of a rock * Norm (philosophy) Norms are concepts ( sentences) of practical import, oriented to effecting an action, rat ...
functions in mathematics. The
two's complement Two's complement is a mathematical operation In mathematics, an operation is a Function (mathematics), function which takes zero or more input values (called ''operands'') to a well-defined output value. The number of operands is the arity of the ...
, address reference and the logical NOT operators are examples of unary operators in math and programming. All functions in
lambda calculus Lambda calculus (also written as ''λ''-calculus) is a formal system A formal system is an used for inferring theorems from axioms according to a set of rules. These rules, which are used for carrying out the inference of theorems from axioms, ar ...
and in some
functional programming language In computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application. Computer science is the study of Alg ...
s (especially those descended from ML) are technically unary, but see
n-ary -ary may refer to: * The arity of a function, operation, or relation ** n-ary associativity, -ary associativity, a specific rule attached to -ary functions *** n-ary group, -ary group, a generalization of group * The radix of a numerical represent ...
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 Abraham Robinson (born Robinsohn; October 6, 1918 – April 11, 1974) was a mathematician A mathematician is someone who uses an extensive knowledge of mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topic ...
follows Quine's usage. In philosophy, the adjective ''monadic'' is sometimes used to describe a one-place relation such as 'is square-shaped' as opposed to a two-place relation such as 'is the sister of'.


Binary

Most operators encountered in programming and mathematics are of the
binary Binary may refer to: Science and technology Mathematics * Binary number In mathematics and digital electronics, a binary number is a number expressed in the base-2 numeral system or binary numeral system, which uses only two symbols: ty ...
form. For both programming and mathematics, these can be the
multiplication operator In operator theoryIn mathematics, operator theory is the study of linear operators on function spaces, beginning with differential operators and integral operators. The operators may be presented abstractly by their characteristics, such as bounded ...
, the radix operator, the often omitted
exponentiation Exponentiation is a mathematical Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry) ...
operator, the
logarithm In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers ( and ), formulas and related structures (), shapes and spaces in which they are contained (), and quantities and their changes ( and ). There is no ...

logarithm
operator, the addition operator, the division operator. Logical predicates such as ''OR'', ''
XOR Exclusive or or exclusive disjunction is a logical operation that is true if and only if its arguments differ (one is true, the other is false). It is symbolized by the prefix operator J and by the infix operators XOR ( or ), EOR, EXOR, ...
'', ''AND'', ''IMP'' are typically used as binary operators with two distinct operands. In
CISC CISC may refer to: *Caribbean Island Swimming Championships *Chongqing Iron and Steel Company * Clean intermittent self-catheterisation, a form of urinary catheterization *Complex instruction set computer *Criminal Intelligence Service Canada *Cana ...
architectures, it is common to have two source operands (and store result in one of them).


Ternary

Common ternary operations besides generic function in mathematics are the summatory and the productory though some other n-ary operation may be implied. The computer programming language C and its various descendants (including
C++ C++ () is a general-purpose programming language In computer software, a general-purpose programming language is a programming language dedicated to a general-purpose, designed to be used for writing software in a wide variety of application ...

C++
, C#,
Java Java ( id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 147.7 million people, Java is the world's List of ...
,
Julia Julia is usually a feminine given name. It is a Latinate feminine form of the name Julio (given name), Julio and Julius. (For further details on etymology, see wikt:Iulius#Latin, Wiktionary entry “Julius”.) The given name ''Julia'' had been ...
,
Perl Perl is a family of two high-level High-level and low-level, as technical terms, are used to classify, describe and point to specific Objective (goal), goals of a systematic operation; and are applied in a wide range of contexts, such as, for ...
, and others) provides the ternary operator ?:, also known as the conditional operator, taking three operands. The first operand (the condition) is evaluated, and if it is true, the result of the entire expression is the value of the second operand, otherwise it is the value of the third operand. The
Forth Forth or FORTH may refer to: Media * ''forth'' magazine, an English-language Irish Internet magazine * ''Forth'' (album), by the English alternative rock band The Verve * ''Forth'' (album), by the American progressive rock band Proto-Kaw * Rad ...
language also contains a ternary operator, */, which multiplies the first two (one-cell) numbers, dividing by the third, with the intermediate result being a double cell number. This is used when the intermediate result would overflow a single cell. The
Python Python may refer to: * Pythonidae The Pythonidae, commonly known as pythons, are a family of nonvenomous snakes found in Africa, Asia, and Australia. Among its members are some of the largest snakes in the world. Ten genera and 42 species ...
language has a ternary conditional expression, x if C else y. The Unix dc calculator has several ternary operators, such as , , which will pop three values from the stack and efficiently compute x^y \bmod z with arbitrary precision. Additionally, many (
RISC In computer engineering Computer engineering (CoE or CpE) is a branch of engineering Engineering is the use of scientific principles to design and build machines, structures, and other items, including bridges, tunnels, roads, v ...
)
assembly language In computer programming Computer programming is the process of designing and building an executable computer program to accomplish a specific computing result or to perform a particular task. Programming involves tasks such as analysis, gene ...
instructions are ternary (as opposed to only two operands specified in CISC); or higher, such as MOV %AX, (%BX, %CX), which will load (MOV) into register the contents of a calculated memory location that is the sum (parenthesis) of the registers and .


''n''-ary

From a mathematical point of view, a function of ''n'' arguments can always be considered as a function of one single argument which is an element of some
product space In topology s, which have only one surface and one edge, are a kind of object studied in topology. In mathematics, topology (from the Greek language, Greek words , and ) is concerned with the properties of a mathematical object, geometric objec ...
. However, it may be convenient for notation to consider ''n''-ary functions, as for example
multilinear map In linear algebra, a multilinear map is a function of several variables that is linear separately in each variable. More precisely, a multilinear map is a function :f\colon V_1 \times \cdots \times V_n \to W\text where V_1,\ldots,V_n and W ar ...
s (which are not linear maps on the product space, if ). The same is true for programming languages, where functions taking several arguments could always be defined as functions taking a single argument of some
composite type In computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application. Computer science is the study of comp ...
such as a
tuple In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). ...
, or in languages with
higher-order function In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and t ...
s, by
currying In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and t ...
.


Varying arity

In computer science, a function accepting a variable number of arguments is called '' variadic''. In logic and philosophy, predicates or relations accepting a variable number of arguments are called '' multigrade'', anadic, or variably polyadic.


Terminology

Latin Latin (, or , ) is a classical language belonging to the Italic languages, Italic branch of the Indo-European languages. Latin was originally spoken in the area around Rome, known as Latium. Through the power of the Roman Republic, it became ...

Latin
ate names are commonly used for specific arities, primarily based on Latin
distributive number In linguistics Linguistics is the science, scientific study of language. It encompasses the analysis of every aspect of language, as well as the methods for studying and modeling them. The traditional areas of linguistic analysis include ...
s meaning "in group of ''n''", though some are based on Latin
cardinal number 150px, Aleph null, the smallest infinite cardinal In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and ca ...
s or
ordinal number In set theory Set theory is the branch of that studies , which can be informally described as collections of objects. Although objects of any kind can be collected into a set, set theory, as a branch of , is mostly concerned with those that ...
s. For example, 1-ary is based on cardinal ''unus'', rather than from distributive ''singulī'' that would result in ''singulary''. ''n''-''ary'' means ''n'' operands (or parameters), but is often used as a synonym of "polyadic". These words are often used to describe anything related to that number (e.g., undenary chess is a
chess variant A chess variant is a game related to, derived from, or inspired by chess Chess is a board game Board games are tabletop game Tabletop games are game with separate sliding drawer, from 1390–1353 BC, made of glazed faience, dime ...
with an 11×11 board, or the
Millenary Petition The Millenary Petition was a list of requests given to James I by Puritans The Puritans were English Protestants in the 16th and 17th centuries who sought to purify the Church of England of Roman Catholic Roman or Romans usually refers t ...
of 1603). The arity of a relation (or
predicate Predicate or predication may refer to: Computer science *Syntactic predicate (in parser technology) guidelines the parser process Linguistics *Predicate (grammar), a grammatical component of a sentence Philosophy and logic * Predication (philo ...
) is the dimension of the
domain Domain may refer to: Mathematics *Domain of a function In mathematics, the domain of a Function (mathematics), function is the Set (mathematics), set of inputs accepted by the function. It is sometimes denoted by \operatorname(f), where is th ...
in the corresponding
Cartesian product In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and ...
. (A function of arity ''n'' thus has arity ''n''+1 considered as a relation.) In
computer programming Computer programming is the process of designing and building an executable computer program to accomplish a specific computing result or to perform a particular task. Programming involves tasks such as analysis, generating algorithms, Profilin ...
, there is often a
syntactical In linguistics, syntax () is the set of rules, principles, and processes that govern the structure of Sentence (linguistics), sentences (sentence structure) in a given Natural language, language, usually including word order. The term ''syntax'' ...
distinction between
operators Operator may refer to: Mathematics * A symbol indicating a mathematical operation In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers ( and ), formulas and related structures (), shapes and spaces in ...
and
functions Function or functionality may refer to: Computing * Function key A function key is a key on a computer A computer is a machine that can be programmed to carry out sequences of arithmetic or logical operations automatically. Modern comp ...
; 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.


See also

* Logic of relatives *
Binary relation Binary may refer to: Science and technology Mathematics * Binary number In mathematics and digital electronics Digital electronics is a field of electronics The field of electronics is a branch of physics and electrical engineeri ...
* Ternary relation *
Theory of relations In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It ...
*
Signature (logic) In logic Logic is an interdisciplinary field which studies truth and reasoning Reason is the capacity of consciously making sense of things, applying logic Logic (from Ancient Greek, Greek: grc, wikt:λογική, λογική, label= ...
*
Parameter A parameter (), generally, is any characteristic that can help in defining or classifying a particular system A system is a group of Interaction, interacting or interrelated elements that act according to a set of rules to form a unified wh ...

Parameter
* ''p''-adic number *
Cardinality In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It ...
* Valency * ''n''-ary code * ''n''-ary group


References


External links

A monograph available free online: * Burris, Stanley N., and H.P. Sankappanavar, H. P., 1981.
A Course in Universal Algebra.
' Springer-Verlag. {{ISBN, 3-540-90578-2. Especially pp. 22–24. Abstract algebra Universal algebra cs:Operace (matematika)#Arita operace