Two-element Boolean algebra
The two-element Boolean algebra is the simplest Boolean algebra, one having just two elements, named 1 and 0 by convention. Paul Halmos's name for this algebra, 2, has some following among mathematicians and will be employed here.
The carrier of a Boolean algebra is the set B such that the operations of the Boolean algebra are mappings from Bn to B. There are several names and notations for the two binary operations of Boolean algebra. We will call them 'sum' and 'product', for which the infix notation is '+' and '.', respectively. '.' is often omitted, in which case the operands simply concatenate. The unary operation is always referred to as 'complementation'; we notate it by placing an overbar over its argument. All Boolean algebras are then algebras of type <2,2,1,0,0>.
'+' and '.' commute and associate, as in real-valued algebra . '.' precedes '+', but brackets may override. Hence A.B+C is parsed as (A.B)+C not A.(B+C). B is a partially ordered set, whose bounds are the distinguished elements 0 and 1. 2 is simply the Boolean algebra such that B={0,1}.
Interpreting one of 0 and 1 as True and the other as False yields classical bivalent logic in equational form. In this case, '+' is read as OR and '.' as AND. These operators are derived by analogy from numerical arithmetic, if any nonzero number is set to 1. Complementation is read as NOT. The numerical analog of the complement of x is 1-x.
Basic identities
2 can be seen as grounded in the following trivial arithmetic:
- 1+0 = 0+1 = 1 (As in numerical arithmetic)
- 0+0 = 0 (As in numerical arithmetic)
- 1+1 = 1
- 1.1 = 1 (As in numerical arithmetic)
- 0.0 = 0.1 = 1.0 = 0 (As in numerical arithmetic)
This Boolean arithmetic suffices to verify any equation of 2, including any axiom, by examining every possible assignment of 0s and 1s to each variable (see decision procedure). A little known but powerful axiom set (basis) for 2 is:
- A+B+C = B+C+A.
The following equations can now be verified:
Each of '+' and '.' distributes over the other. That is, A.(B+C) = A.B + B.B and A+B.C = (A+B).(A+C). That '.' distributes over '+' is in accord with real-valued algebra, but not '+' over '.'. For this and other reasons, a sum of products (which leads to a NAND synthesis) is more commonly employed than a product of sums (which leads to a NOR synthesis).
Other
De Morgan's theorem states that if you do the following, in the given order, to any Boolean function:
- Complement every variable;
- Swap + and . operators (taking care to add brackets to ensure the order of operations remains the same);
- Complement the result,
the result is logically equivalent to what you started with. Repeated application of De Morgan's theorem to parts of a function can be used to drive all complements down to the individual variables.
A powerful and nontrivial metatheorem states that any theorem of 2 holds for all Boolean algebras. This theorem is useful because any equation in 2 can be verified by a decision procedure. Logicians refer to this fact as "2 is decidable". In practice, the number of steps required to verify an equation via a decision procedure increases exponentially along with the number of its variables.
For an elegant alternative notation for 2, see Laws of Form.