Boolean Algebra of Sets
(Content adapted from Critchlow & Eck)
It is clear that set theory is closely related to logic. The intersection and union of sets can be defined in terms of the logical "and" and logical "or" operators. The notation makes it possible to use predicates to specify sets. And if is any set, then the formula defines a one place predicate that is true for an entity if and only if is a member of . So it should not be a surprise that many of the rules of logic have analogs in set theory.
For example, we have already noted that and are commutative operations. This fact can be verified using the rules of logic. Let and be sets. According to the definition of equality of sets, we can show that by showing that . But for any ,
| definition of | ||
| commutativity of | ||
| definition of |
The commutativity of follows in the same way from the definition of in terms of and the commutativity of , and a similar argument shows that union and intersection are associative operations.
The distributive laws for propositional logic give rise to two similar rules in set theory. Let , , and be any sets. Then
These rules are called the distributive laws for set theory. To verify the first of these laws, we just have to note that for any ,
| definition of , | ||
| distributivity of | ||
| definition of | ||
| definition of |
The second distributive law for sets follows in exactly the same way.
Complement
While is analogous to and is analogous to , we have not yet seen any operation in set theory that is analogous to the logical "not" operator, . Given a set , it is tempting to try to define , the set that contains everything that does not belong to . Unfortunately, the rules of set theory do not allow us to define such a set. The notation can only be used when the domain of discourse of is a set, so there must be an underlying set from which the elements that are/are not in are chosen, i.e. some underlying set of which is a subset. We can get around this problem by restricting the discussion to subsets of some fixed set. This set will be known as the universal set. Keep in mind that the universal set is only universal for some particular discussion. It is simply some set that is large enough to contain all the sets under discussion as subsets. Given a universal set and any subset of , we can define the set .
Let be a given universal set, and let be any subset of . We define the complement of in to be the set that is defined by .
Usually, we will refer to the complement of in simply as the complement of , but you should remember that whenever complements of sets are used, there must be some universal set in the background.
Given the complement operation on sets, we can look for analogs to the rules of logic that involve negation. For example, we know that for any proposition . It follows that for any subset of ,
| definition of | ||
| definition of complement | ||
| definition of ) | ||
the last equality following because the proposition is false for any . Similarly, we can show that and that (where is the complement of the complement of , that is, the set obtained by taking the complement of .)
The most important laws for working with complements of sets are De Morgan's Laws for sets. These laws, which follow directly from De Morgan's Laws for logic, state that for any subsets and of a universal set ,
For example, we can verify the first of these laws with the calculation
| definition of complement | ||
| definition of | ||
| definition of | ||
| De Morgan's Law for logic | ||
| definition of | ||
| definition of complement | ||
| definition of |
Comparison with Propositional Boolean Algebra
Just as the laws of logic allow us to do algebra with logical formulas, the laws of set theory allow us to do algebra with sets. Because of the close relationship between logic and set theory, their algebras are very similar. The algebra of sets, like the algebra of logic, is Boolean algebra. When George Boole wrote his 1854 book about logic, it was really as much about set theory as logic. In fact, Boole did not make a clear distinction between a predicate and the set of objects for which that predicate is true. His algebraic laws and formulas apply equally to both cases. More exactly, if we consider only subsets of some given universal set , then there is a direct correspondence between the basic symbols and operations of propositional logic and certain symbols and operations in set theory, as shown in this table:
| Logic | Set Theory |
|---|---|
Any valid logical formula or computation involving propositional variables and the symbols , , , , and can be transformed into a valid formula or computation in set theory by replacing the propositions in the formula with subsets of and replacing the logical symbols with , , , , and the complement operator.
Here are some of the laws of Boolean Algebra for sets. , , and are sets. For the laws that involve the complement operator, they are assumed to be subsets of some universal set, . For the most part, these laws correspond directly to laws of Boolean Algebra for propositional logic.
| Name | Law |
|---|---|
| Double complement | |
| Complement laws | |
| Identity laws | |
| Annihilator laws | |
| Idempotent laws | |
| Commutative laws | |
| Associative laws | |
| Distributive laws | |
| De Morgan's laws | |
Precedence
Just as in logic, the operations of set theory can be combined to form complex expressions such as . Parentheses can always be used in such expressions to specify the order in which the operations are to be performed. In the absence of parentheses, we need precedence rules to determine the order of operation. The precedence rules for the Boolean algebra of sets are carried over directly from the Boolean algebra of propositions. When union and intersection are used together without parentheses, intersection has precedence over union. Furthermore, when several operators of the same type are used without parentheses, then they are evaluated in order from left to right. (Of course, since and