- Boolean algebra (introduction)
Boolean algebra, developed in 1854 by George Boole in his book "An Investigation of the Laws of Thought", is a variant of ordinary algebra as taught in high school. Boolean algebra differs from ordinary algebra in three ways: in the values that variables may assume, which are of a logical instead of a numeric character, prototypically 0 and 1; in the operations applicable to those values; and in the properties of those operations, that is, the laws they obey.
Values
Whereas high school algebra deals mainly with
real number s, Boolean algebra deals with the values 0 and 1. These can be thought of as two integers, or as the truth values "false" and "true" respectively. In either case they are calledbit s or binary digits, in contrast to the decimal digits 0 through 9.Boolean algebra also deals with other values on which Boolean operations can be defined, such as
set s or sequences of bits. However Boolean algebra is unlike many other systems of algebra in that it obeys exactly the same laws (equational properties), neither more nor fewer, no matter which of these other values are employed. Much of the subject can therefore be introduced without reference to any values besides 0 and 1. We therefore postpone to the section on Boolean algebras the treatment of these other values and focus on these two "prototypical" Boolean values.Operations
Basic operations
Certain operations of ordinary algebra, in particular addition "x"+"y", multiplication "xy", and negation -"x", have their counterparts in Boolean algebra, namely the Boolean operations OR, AND, and NOT respectively, also called disjunction "x"∨"y", conjunction "x"∧"y", and negation ¬"x" or sometimes !"x". Some authors use instead the same arithmetic operations as ordinary algebra reinterpreted for Boolean algebra, treating "x"+"y" as synonymous with "x"∨"y" and "xy" with "x"∧"y".
Conjunction "x"∧"y" behaves on 0 and 1 exactly as multiplication does for ordinary algebra: if either "x" or "y" is 0 then so is "x"∧"y", but if both are 1 then so is "x"∧"y". Disjunction "x"∨"y" works almost like addition, with 0∨0 = 0 and 1∨0 = 0∨1 = 1. However there is a difference: 1∨1 is not 2 but 1. This difference can be captured by defining "x"∨"y" to be "x"+"y"-"xy" rather than simply "x"+"y".
Complement resembles ordinary negation in that it exchanges values. But whereas in ordinary algebra negation interchanges 1 and -1, 2 and -2, etc. while leaving 0 fixed, in Boolean algebra complement interchanges 0 and 1. One can think of ordinary negation as reflecting about 0, and Boolean complement as reflecting about the midpoint of 0 and 1. Complement can be defined arithmetically as ¬"x" = 1−"x".
In summary the three basic Boolean operations can be defined arithmetically as follows.
+ "'Figure 1. Truth tables
For the two binary operations ∧ and ∨ the truth tables list all four possible combinations of values for "x" and "y", one per line. For each combination the truth tables tabulate the values of "x"∧"y" and "x"∨"y". The truth values of ¬"x" are tabulated similarly except that only two lines are needed because there is only one variable.
Yet another way of specifying these operations is with equations explicitly giving their values.
The first operation, "x"→"y", is called material implication. If "x" is true then the value of "x"→"y" is taken to be that of "y". But if "x" is false then we ignore the value of "y"; however we must return "some" truth value and there are only two choices, so we choose the value that entails less, namely "true". (
The second operation, "x"⊕"y", is called
The third operation, the complement of exclusive or, is equivalence or Boolean equality: "x"≡"y" is true just when "x" and "y" have the same value. Hence "x"⊕"y" as its complement can be understood as "x" ≠ "y", being true just when "x" and "y" are different.
Laws
A law of Boolean algebra is an equation such as "x"∨("y"∨"z") = ("x"∨"y")∨"z" between two Boolean terms, where a Boolean term is defined as an expression built up from variables and the constants 0 and 1 using the operations ∧, ∨, and ¬. The concept can be extended to terms involving other Boolean operations such as ⊕, →, and ≡, but such extensions are unnecessary for the purposes to which the laws are put. Such purposes include the definition of a Boolean algebra as any model of the Boolean laws, and as a means for deriving new laws from old as in the derivation of "x"∨("y"∧"z") = "x"∨("z"∧"y") from "y"∧"z" = "z"∧"y" as treated in the section on axiomatization.
Monotone laws
Boolean algebra satisfies many of the same laws as ordinary algebra when we match up ∨ with addition and ∧ with multiplication. In particular the following laws are common to both kinds of algebra.All properties of negation including the laws below follow from the above two laws alone.
In both ordinary and Boolean algebra, negation works by exchanging pairs of elements, whence in both algebras it satisfies the double negation law
Completeness
The laws "Complementation" 1 and 2, together with the monotone laws form a complete set of laws, or
Duality principle
There is nothing magic about the choice of symbols for the values of Boolean algebra. We could rename 0 and 1 to say α and β, and as long as we did so consistently throughout it would still be Boolean algebra, albeit with some obvious cosmetic differences.
But suppose we rename 0 and 1 to 1 and 0 respectively. Then it would still be Boolean algebra, and moreover operating on the same values. However it would not be identical to our original Boolean algebra because now we find ∨ behaving the way ∧ used to do and vice versa. So there are still some cosmetic differences to show that we've been fiddling with the notation, despite the fact that we're still using 0's and 1's.
But if in addition to interchanging the names of the values we also interchange the names of the two binary operations, "now" there is no trace of what we have done. The end product is completely indistinguishable from what we started with. We might notice that the columns for "x"∧"y" and "x"∨"y" in the truth tables had changed places, but that switch is immaterial.
When values and operations can be paired up in a way that leaves everything important unchanged when all pairs are switched simultaneously, we call the members of each pair dual to each other. Thus 0 and 1 are dual, and ∧ and ∨ are dual. The Duality Principle, also called De Morgan duality, asserts that Boolean algebra is unchanged when all dual pairs are interchanged.
One change we did not need to make as part of this interchange was to complement. We say that complement is a self-dual operation. The identity or do-nothing operation "x" (copy the input to the output) is also self-dual. A more complicated example of a self-dual operation is ("x"∧"y") ∨ ("y"∧"z") ∨ ("z"∧"x"). It can be shown that self-dual operations must take an odd number of arguments; thus there can be no self-dual binary operation.
Diagrammatic representations
Venn diagrams
A
The three Venn diagrams in the figure below represent respectively conjunction "x"∧"y", disjunction "x"∨"y", and complement ¬"x".For conjunction, the region inside both circles is shaded to indicate that "x"∧"y" is 1 when both variables are 1. The other regions are left unshaded to indicate that "x"∧"y" is 0 for the other three combinations.
The second diagram represents disjunction "x"∨"y" by shading those regions that lie inside either or both circles. The third diagram represents complement ¬"x" by shading the region "not" inside the circle.
While we have not shown the Venn diagrams for the constants 0 and 1, they are trivial, being respectively a white box and a dark box, neither one containing a circle. However we could put a circle for "x" in those boxes, in which case each would denote a function of one argument, "x", which returns the same value independently of "x", called a constant function. As far as their outputs are concerned, constants and constant functions are indistinguishable; the difference is that a constant takes no arguments, called a "zeroary" or "nullary" operation, while a constant function takes one argument, which it ignores, and is a "unary" operation.
Venn diagrams are helpful in visualizing laws. The commutativity laws for ∧ and ∨ can be seen from the symmetry of the diagrams: a binary operation that was not commutative would not have a symmetric diagram.
Idempotence of ∧ and ∨ can be visualized by sliding the two circles together and noting that the shaded area then becomes the whole circle, for both ∧ and ∨.
To see the first absorption law, "x"∧("x"∨"y") = "x", start with the diagram in the middle for "x"∨"y" and note that the portion of the shaded area in common with the "x" circle is the whole of the "x" circle. For the second absorption law, "x"∨("x"∧"y") = "x", start with the left diagram for "x"∧"y" and note that shading the whole of the "x" circle results in just the "x" circle being shaded, since the previous shading was inside the "x" circle.
The double negation law can be seen by complementing the shading in the third diagram for ¬"x", which shades the "x" circle.
To visualize the first De Morgan's law, (¬"x")∧(¬"y") = ¬("x"∨"y"), start with the middle diagram for "x"∨"y" and complement its shading so that only the region outside both circles is shaded, which is what the right hand side of the law describes. The result is the same as if we shaded that region which is both outside the "x" circle "and" outside the "y" circle, i.e. the conjunction of their exteriors, which is what the left hand side of the law describes.
The second De Morgan's law, (¬"x")∨(¬"y") = ¬("x"∧"y"), works the same way with the two diagrams interchanged.
The first complement law, "x"∧¬"x" = 0, says that the interior and exterior of the "x" circle have no overlap. The second complement law, "x"∨¬"x" = 1, says that everything is either inside or outside the "x" circle.
Digital logic gates
Digital logic is the application of the Boolean algebra of 0 and 1 to electronic hardware comprised of
Complement is implemented with an inverter gate. The triangle denotes the operation that simply copies the input to the output; the small circle on the output denotes the actual inversion complementing the input. The convention of putting such a circle on any port means that the signal passing through this port is complemented on the way through, whether it is an input or output port.
There being eight ways of labeling the three ports of an AND-gate or OR-gate with inverters, this convention gives a wide range of possible Boolean operations realized as such gates so decorated. Not all combinations are distinct however: any labeling of AND-gate ports with inverters realizes the same Boolean operation as the opposite labeling of OR-gate ports (a given port of the AND-gate is labeled with an inverter if and only if the corresponding port of the OR-gate is not so labeled). This follows from
If we complement all ports on every gate, and interchange AND-gates and OR-gates, as in Figure 4 below, we end up with the same operations as we started with, illustrating both
Because of the pairwise identification of gates via the Duality Principle, even though 16 schematic symbols can be manufactured from the two basic binary gates AND and OR by furnishing their ports with inverters (circles), they only represent eight Boolean operations, namely those operations with an odd number of ones in their truth table. Altogether there are 16 binary Boolean operations, the other eight being those with an even number of ones in their truth table, namely the following. The constant 0, viewed as a binary operation that ignores both its inputs, has no ones, the six operations "x", "y", ¬"x", ¬"y" (as binary operations that ignore one input), "x"⊕"y", and "x"≡"y" have two ones, and the constant 1 has four ones.
Boolean algebras
The term "algebra" denotes both a subject and an object. Whereas the foregoing has addressed the subject of Boolean algebra, this section deals with mathematical objects called Boolean algebras. We begin with a special case of the notion definable without reference to the laws of Boolean algebra, namely concrete Boolean algebras, and then pass to the general case based on those laws, namely abstract Boolean algebras.
Concrete Boolean algebras
A concrete Boolean algebra, also called a
"Example 1." The
"Example 2." The empty set and "X". This two-element algebra shows that a concrete Boolean algebra can be finite even when it consists of subsets of an infinite set. It can be seen that every field of subsets of "X" must contain the empty set and "X". Hence no smaller example is possible, other than the degenerate algebra obtained by taking "X" to be empty so as to make the empty set and "X" coincide.
"Example 3." The set of finite and
"Example 4." For a less trivial example of the point made by Example 2, consider a
ubsets as bit vectors
A subset "Y" of "X" can be identified with an
From this bit vector viewpoint, a concrete Boolean algebra can be defined equivalently as a nonempty set of bit vectors all of the same length (more generally, indexed by the same set) and closed under the bit vector operations of bitwise ∧, ∨, and ¬, as in 1010∧0110 = 0010, 1010∨0110 = 1110, and ¬1010 = 0101, the bit vector realizations of intersection, union, and complement respectively.
The prototypical Boolean algebra
The set {0,1} and its Boolean operations as treated above can be understood as the special case of bit vectors of length one, which by the identification of bit vectors with subsets can also be understood as the two subsets of a one-element set. We call this the protypical Boolean algebra, justified by the following observation.:"The laws satisfied by all concrete Boolean algebras coincide with those satisfied by the prototypical Boolean algebra."This observation is easily proved as follows. Certainly any law satisfied by all concrete Boolean algebras is satisfied by the prototypical one since it is concrete. Conversely any law that fails for some concrete Boolean algebra must have failed at a particular bit position, in which case that position by itself furnishes a one-bit counterexample to that law.
The final goal of the next section can be understood as eliminating "concrete" from the above observation. We shall however reach that goal via the surprisingly stronger observation that, up to isomorphism, all Boolean algebras are concrete.
Abstract Boolean algebras
The Boolean algebras we have seen so far have all been concrete, consisting of bit vectors or equivalently of subsets of some set. Such a Boolean algebra consists of a set and operations on that set which can be "shown" to satisfy the laws of Boolean algebra.
Instead of showing that the Boolean laws are satisfied, we can instead postulate a set "X", two binary operations on "X", and one unary operation, and "require" that those operations satisfy the laws of Boolean algebra. The elements of "X" need not be bit vectors or subsets but can be anything at all. This leads to the more general "abstract" definition.:"A Boolean algebra is any set with binary operations" ∧ "and" ∨ "and a unary operation" ¬ "thereon satisfying the Boolean laws."
For the purposes of this definition it is irrelevant how the operations came to satisfy the laws, whether by fiat or proof. All concrete Boolean algebras satisfy the laws (by proof rather than fiat), whence every concrete Boolean algebra is a Boolean algebra according to our definitions. This axiomatic definition of a Boolean algebra as a set and certain operations satisfying certain laws or axioms is entirely analogous to the abstract definitions of group, ring, field etc. characteristic of modern or
Representable Boolean algebras
Although every concrete Boolean algebra is a Boolean algebra, not every Boolean algebra need be concrete. Let "n" be a square-free positive integer, one not divisible by the square of an integer, for example 30 but not 12. The operations of greatest common divisor, least common multiple, and division into "n" (that is, ¬"x" = "n"/"x"), can be shown to satisfy all the Boolean laws when their arguments range over the positive divisors of "n". Hence those divisors form a Boolean algebra. These divisors are not subsets of a set, making the divisors of "n" a Boolean algebra that is not concrete according to our definitions.
However if we represent each divisor of "n" by the set of its prime factors, we find that this nonconcrete Boolean algebra is
The obvious next question is answered positively as follows.:"Every Boolean algebra is representable."
That is, up to isomorphism, abstract and concrete Boolean algebras are the same thing. This quite nontrivial result is treated in more detail in the article
It is weaker in the sense that it does not of itself imply representability. Boolean algebras are special here, for example a
Axiomatizing Boolean algebra
The above definition of an abstract Boolean algebra as a set and operations satisfying "the" Boolean laws raises the question, what are those laws? A simple-minded answer is "all Boolean laws," which can be defined as all equations that hold for the Boolean algebra of 0 and 1. Since there are infinitely many such laws this is not a terribly satisfactory answer in practice, leading to the next question: does it suffice to require only finitely many laws to hold?
In the case of Boolean algebras the answer is yes. In particular the finitely many equations we have listed above suffice. We say that Boolean algebra is finitely axiomatizable or finitely based.
Can this list be made shorter yet? Again the answer is yes. To begin with, some of the above laws are implied by some of the others. A sufficient subset of the above laws consists of the pairs of associativity, commutativity, and absorption laws, distributivity of ∧ over ∨ (or the other distributivity law—one suffices), and the two complement laws. In fact this is the traditional axiomatization of Boolean algebra as a complemented
By introducing additional laws not listed above it becomes possible to shorten the list yet further, see
Propositional logic
Syntactically, every Boolean term corresponds to a
The semantics of propositional logic rely on
These semantics permit a translation between tautologies of propositional logic and equational theorems of Boolean algebra. Every tautology Φ of propositional logic can be expressed as the Boolean equation Φ = 1, which will be a theorem of Boolean algebra. Conversely every theorem Φ = Ψ of Boolean algebra corresponds to the tautologies (Φ∨¬Ψ) ∧ (¬Φ∨Ψ) and (Φ∧Ψ) ∨ (¬Φ∧¬Ψ). If → is in the language these last tautologies can also be written as (Φ→Ψ) ∧ (Ψ→Φ), or as two separate theorems Φ→Ψ and Ψ→Φ; if ≡ is available then the single tautology Φ ≡ Ψ can be used.
Applications
One motivating application of propositional calculus is the analysis of propositions and deductive arguments in natural language. Whereas the proposition "if "x" = 3 then "x"+1 = 4" depends on the meanings of such symbols as + and 1, the proposition "if "x" = 3 then "x" = 3" does not; it is true merely by virtue of its structure, and remains true whether "x" = 3" is replaced by "x" = 4" or "the moon is made of green cheese." The generic or abstract form of this tautology is "if "P" then "P", or in the language of Boolean algebra, "P" → "P".
Replacing "P" by "x" = 3 or any other proposition is called instantiation of "P" by that proposition. The result of instantiating "P" in an abstract proposition is called an instance of the proposition. Thus "x" = 3 → "x" = 3" is a tautology by virtue of being an instance of the abstract tautology "P" → "P". All occurrences of the instantiated variable must be instantiated with the same proposition, to avoid such nonsense as "P" → "x" = 3 or "x" = 3 → "x" = 4.
Propositional calculus restricts attention to abstract propositions, those built up from propositional variables using Boolean operations. Instantiation is still possible within propositional calculus, but only by instantiating propositional variables by abstract propositions, such as instantiating "Q" by "Q"→"P" in "P"→("Q"→"P") to yield the instance "P"→(("Q"→"P")→"P").
(The availability of instantiation as part of the machinery of propositional calculus avoids the need for metavariables within the language of propositional calculus, since ordinary propositional variables can be considered within the language to denote arbitrary propositions. The metavariables themselves are outside the reach of instantiation, not being part of the language of propositional calculus but rather part of the same language for talking about it that this sentence is written in, where we need to be able to distinguish propositional variables and their instantiations as being distinct syntactic entities.)
Deductive systems for propositional logic
An axiomatization of propositional calculus is a set of tautologies called
Hilbert-style systems
There are many ways of axiomatizing propositional calculus. One style, called a
A typical proof would instantiate axiom A1 as "P" → (("Q"→"P")→"P") and A2 as ("P" → (("Q"→"P")→"P")) → (("P"→("Q"→"P")) → ("P"→"P")) and then apply Modus Ponens to these two instances to prove ("P"→("Q"→"P")) → ("P"→"P"). One more application of Modus Ponens to this and A1 then proves "P"→"P". The proof itself consists just of the above propositions in the order shown, with our explanations removed. To avoid any possible ambiguity as to what depends on what it is customary to leave some indication of whether a theorem has arisen as an axiom instance or from applying modus ponens, and which axioms or theorems were used to that end.
equent calculus
Another form taken by propositional calculus is
Applications
Two-valued logic
Boolean algebra as the calculus of two values is fundamental to digital logic, computer programming, and mathematical logic, and is also used in other areas of mathematics such as set theory and statistics.
Programmers programming in
Other areas where two values is a good choice are the law and mathematics. In everyday relaxed conversation, nuanced or complex answers such as "maybe" or "only on the weekend" are acceptable. In more focused situations such as a court of law or theorem-based mathematics however it is deemed advantageous to frame questions so as to admit a simple yes-or-no answer—is the defendant guilty or not guilty, is the proposition true or false—and to disallow any other answer. However much of a straitjacket this might prove in practice for the respondent, the principle of the simple yes-no question has become a central feature of both judicial and mathematical logic, making two-valued logic deserving of organization and study in its own right.
A central concept of set theory is membership. Now an organization may permit multiple degrees of membership, such as novice, associate, and full. With sets however an element is either in or out. The candidates for membership in a set work just like the wires in a digital computer: each candidate is either a member or a nonmember, just as each wire is either high or low.
Algebra being a fundamental tool in any area amenable to mathematical treatment, these considerations combine to make the algebra of two values of fundamental importance to computer hardware, mathematical logic, and set theory.
Boolean operations
The original application for Boolean operations was
Natural languages such as English have words for several Boolean operations, in particular conjunction ("and"), disjunction ("or"), negation ("not"), and implication ("implies"). "But not" is synonymous with "and not". When used to combine situational assertions such as "the block is on the table" and "cats drink milk," which naively are either true or false, the meanings of these logical connectives often have the meaning of their logical counterparts. However with descriptions of behavior such as "Jim walked through the door", one starts to notice differences such as failure of commutativity, for example the conjunction of "Jim opened the door" with "Jim walked through the door" in that order is not equivalent to their conjunction in the other order, since "and" usually means "and then" in such cases. Questions can be similar: the order "Is the sky blue, and why is the sky blue?" makes more sense than the reverse order. Conjunctive commands about behavior are like behavioral assertions, as in "get dressed and go to school". Disjunctive commands such "love me or leave me" or "fish or cut bait" tend to be asymmetric via the implication that one alternative is less preferable. Conjoined nouns such as "tea and milk" generally describe aggregation as with set union while "tea or milk" is a choice. However context can reverse these senses, as in "your choices are coffee and tea" which usually means the same as "your choices are coffee or tea" (alternatives). Double negation as in "I don't not like milk" rarely mean literally "I do like milk" but rather convey some sort of hedging, as though to imply that there is a third possibility. "Not not P" can be loosely interpreted as "surely P", and although "P" necessarily implies "not not "P" the converse is suspect in English, much as with
Boolean operations are used in
The 256-element free Boolean algebra on three generators is deployed in
Search engine queries also employ Boolean logic. For this application, each web page on the Internet may be considered to be an "element" of a "set". The following examples use a syntax supported by
* Doublequotes are used to combine whitespace-separated words into a single search term. [Doublequote-delimited search terms are called "exact phrase" searches in the Google documentation.]
* Whitespace is used to specify logical AND, as it is the default operator for joining search terms:
"Search term 1" "Search term 2"
*The OR keyword is used for logical OR:
"Search term 1" OR "Search term 2"
*The minus sign is used for logical NOT (AND NOT):
"Search term 1" -"Search term 2"
ee also
*
*
*
*
*
*
*
References
* cite book
last = Boole
first = George
authorlink = George Boole
title = An Investigation of the Laws of Thought
publisher = Prometheus Books
origyear = 1854
year = 2003
id = ISBN 978-1-59102-089-9
* cite book
last = Dwinger
first = Philip
title = Introduction to Boolean algebras
publisher = Physica Verlag
location = Würzburg
year = 1971
* cite book
last = Koppelberg
first = Sabine
chapter = General Theory of Boolean Algebras
title = Handbook of Boolean Algebras, Vol. 1 (ed. J. Donald Monk with Robert Bonnet)
publisher = North Holland
year = 1989
location = Amsterdam
id = ISBN 978-0-444-70261-6
* cite journal
last = Shannon
first = Claude
authorlink = Claude Shannon
title = The Synthesis of Two-Terminal Switching Circuits
journal = Bell System Technical Journal
volume = 28
pages = 59–98
year = 1949
id =
* cite book
last = Sikorski
first = Roman
authorlink = Roman Sikorski
title = Boolean Algebras
publisher = Springer-Verlag
location = Berlin
edition = 3/e
year = 1969
id = ISBN 978-0-387-04469-9
External links
*
* [http://sourceforge.net/projects/logicaleval/ Logical Formula Evaluator] (for Windows), a software which calculates all possible values of a logical formula
* [http://computer.howstuffworks.com/boolean.htm How Stuff Works - Boolean Logic]
* Maiki & Boaz [http://www.bdd-project.com BDD-PROJECT] , a Web Application for BDD reduction and visualization.
Wikimedia Foundation. 2010.