In mathematics, a Boolean function is a function whose arguments and result assume values from a two-element set (usually {true, false}, {0,1} or {-1,1}). Alternative names are switching function, used especially in older computer science literature, and truth function (or logical function), used in logic. Boolean functions are the subject of Boolean algebra and switching theory. A Boolean function takes the form , where is known as the Boolean domain and is a non-negative integer called the arity of the function. In the case where , the function is a constant element of . A Boolean function with multiple outputs, with is a vectorial or vector-valued Boolean function (an S-box in symmetric cryptography). There are different Boolean functions with arguments; equal to the number of different truth tables with entries. Every -ary Boolean function can be expressed as a propositional formula in variables , and two propositional formulas are logically equivalent if and only if they express the same Boolean function. Examples The rudimentary symmetric Boolean functions (logical connectives or logic gates) are: NOT, negation or complement - which receives one input and returns true when that input is false ("not") AND or conjunction - true when all inputs are true ("both") OR or disjunction - true when any input is true ("either") XOR or exclusive disjunction - true when one of its inputs is true and the other is false ("not equal") NAND or Sheffer stroke - true when it is not the case that all inputs are true ("not both") NOR or logical nor - true when none of the inputs are true ("neither") XNOR or logical equality - true when both inputs are the same ("equal") An example of a more complicated function is the majority function (of an odd number of inputs). Representation A Boolean function may be specified in a variety of ways: Truth table: explicitly listing its value for all possible values of the arguments Marquand diagram: truth table values arranged in a two-dimensional grid (used in a Karnaugh map) Binary decision diagram, listing the truth table values at the bottom of a binary tree Venn diagram, depicting the truth table values as a colouring of regions of the plane Algebraically, as a propositional formula using rudimentary boolean functions: Negation normal form, an arbitrary mix of AND and ORs of the arguments and their complements Disjunctive normal form, as an OR of ANDs of