An operation on a set is a function that takes some values from and produces a new value. An operation can take any number of values from , including zero (in which case is simply a constant) or infinitely many (in which case we call an "infinitary operation"). Common operations take a finite non-zero number of parameters. Operations often produce a value that is also in (in which case we say is closed under ), but that is not always the case.
For example, the function is a binary operation on , meaning it takes two values from and produces another. Because produces a value that is also in , we say that is closed under .
The function that maps to is a unary operation on : It takes one value from as input, and produces an output in (namely, the negation of the input). is also a unary operation on , but is not closed under (because is not in ).
The number of values that the operator takes as input is called the arity of the operator. For example, the function which takes no inputs and returns is a zero-arity operator; and the operator is a four-arity operator (which can be used on any ring, if we interpret multiplication and subtraction as ring operations).