TOPICS
Search

Boolean Function


A Boolean function of n variables is a function from {0,1}^n to {0,1}, where n is a nonnegative integer. The equivalent encoding {-1,1}^n->{-1,1} replaces each input and output value 0 by -1 (O'Donnell 2021, §1.1).

A Boolean function can be identified with the subset of input assignments on which its value is 1. These subsets form a Boolean algebra under union, intersection, and complementation (Comtet 1974, p. 185). Each Boolean function has a unique representation, up to order, as a disjunction of complete products, one for each input assignment on which the function is 1. The constant false function corresponds to the empty disjunction. There are 2^(2^n) distinct Boolean functions of n labeled variables, because each of the 2^n input assignments can independently be assigned either output value (Comtet 1974, p. 187).

Shannon (1938) proved that a two-valued Boolean algebra (whose members are most commonly denoted 0 and 1, or false and true) can describe the operation of two-valued electrical switching circuits. The following table gives the truth table for the 2^(2^2)=16 possible Boolean functions of two Boolean variables.

ABF_0F_1F_2F_3F_4F_5F_6F_7
0000000000
0100001111
1000110011
1101010101
ABF_8F_9F_(10)F_(11)F_(12)F_(13)F_(14)F_(15)
0011111111
0100001111
1000110011
1101010101

The names and symbols for these functions are given in the following table (Simpson 1987, p. 539).

operationsymbolname
F_00FALSE
F_1A ^ BAND
F_2A ^ !BA AND NOT B
F_3AA
F_4!A ^ BNOT A AND B
F_5BB
F_6A xor BXOR
F_7A v BOR
F_8A nor BNOR
F_9A XNOR BXNOR
F_(10)!BNOT B
F_(11)A v !BA OR NOT B
F_(12)!ANOT A
F_(13)!A v BNOT A OR B
F_(14)A nand BNAND
F_(15)1TRUE

A Boolean function is called monotone increasing if f(x)<=f(y) whenever x_i<=y_i for every input coordinate i. Identifying an input with the subset of coordinates whose values are 1, its minimal true inputs form an antichain of subsets of {1,2,...,n}. Conversely, every such antichain determines a unique monotone increasing Boolean function, including the empty antichain for the constant false function. Counting these functions on labeled variables is Dedekind's problem. Boolean functions can also be viewed as assignments of two labels to the vertices of an n-hypercube graph.

If Boolean functions that differ only by a permutation of variables are identified, the numbers of inequivalent monotone increasing Boolean functions for n=0, 1, 2, ... are 2, 3, 5, 10, 30, ... (Biswas and Sarkar 2025; OEIS A003182).

Let M(n,k) denote the number of distinct monotone increasing Boolean functions of n labeled variables having k minimal true inputs, where n and k are nonnegative integers. Equivalently, M(n,k) counts antichains of k subsets of an n-element set. Then

M(n,0)=1
(1)
M(n,1)=2^n
(2)
M(n,2)=2^(n-1)(2^n-1)-3^n+2^n
(3)
M(n,3)=1/6(2^n)(2^n-1)(2^n-2)-6^n+5^n+4^n-3^n.
(4)

See also

Antichain, Average Sensitivity, Block Sensitivity, Boolean Algebra, Boolean Circuit, Boolean Fourier Expansion, Boolean Function Nonlinearity, Boolean Function Sensitivity, Boolean Noise Operator, Boolean Variable, Booleans, Complete Product, Conjunction, Dedekind's Problem, Karnaugh Map, Linear Threshold Function, Monotonic Function, Polynomial Threshold Function, Query Complexity, Reed-Muller Code, Sensitivity Conjecture, Tu-Deng Conjecture

Explore with Wolfram|Alpha

References

Biswas, A. and Sarkar, P. "Counting Unate and Monotone Boolean Functions under Restrictions of Balancedness and Non-Degeneracy." J. Int. Seq. 28, 25.3.4, 2025. https://cs.uwaterloo.ca/journals/JIS/VOL28/Biswas/biswas6.html.Comtet, L. "Boolean Algebra Generated by a System of Subsets." §4.4 in Advanced Combinatorics: The Art of Finite and Infinite Expansions, rev. enl. ed. Dordrecht, Netherlands: Reidel, pp. 185-189, 1974.O'Donnell, R. Analysis of Boolean Functions. 21 May 2021. https://arxiv.org/abs/2105.10386.Shannon, C. E. "A Symbolic Analysis of Relay and Switching Circuits." Trans. Amer. Inst. Electr. Eng. 57, 713-723, 1938. https://doi.org/10.1109/T-AIEE.1938.5057767.Shapiro, H. N. "On the Counting Problem for Monotone Boolean Functions." Comm. Pure Appl. Math. 23, 299-312, 1970. https://doi.org/10.1002/cpa.3160230305.Simpson, R. E. Introductory Electronics for Scientists and Engineers, 2nd ed. Boston, MA: Allyn and Bacon, 1987.Sloane, N. J. A. Sequence A003182/M0729 in "The On-Line Encyclopedia of Integer Sequences."Wolfram, S. A New Kind of Science. Champaign, IL: Wolfram Media, pp. 616-619, 806-807, and 1096-1097, 2002.

Referenced on Wolfram|Alpha

Boolean Function

Cite this as:

Weisstein, Eric W. "Boolean Function." From MathWorld--A Wolfram Resource. https://mathworld.wolfram.com/BooleanFunction.html

Subject classifications