03 / 03 Sets and operations
  1. ← Logic, sets and proofs
  2. 01 Propositions and logical connectives
  3. 02 Predicates and quantifiers
  4. 03 Sets and operations
Logic, sets and proofs · 03 / 03

Sets and operations

How membership, inclusion and three operations turn the connectives of chapter 1 into objects you can manipulate.

In chapter 2, we spent the whole chapter talking about the “domain of discourse”, the set over which variables range, while settling for an intuitive idea: a collection of objects. The chapter even closed on a promise: "ABA \subseteq B" would be read "x, xAxB\forall x,\ x \in A \Rightarrow x \in B". It is time to keep it. But what is a set, exactly? How do we describe one, how do we test that an object belongs to it, how do we build new ones from old?

The answer is lovelier than a mere catalogue of symbols. You are about to discover that set theory is not a new territory to memorise: it is the logic of chapter 1, poured into objects. The “or” becomes union, the “and” becomes intersection, the “not” becomes complement, and the De Morgan laws you already know will reappear, identical, on sets.

Describing a set

A set Set A collection of objects, called its elements, regarded as a single whole. A set is entirely determined by its elements: two sets with exactly the same elements are equal. It is described by extension, listing its elements in braces such as {1, 2, 3}, or by comprehension, giving the property its elements satisfy, such as {x | x > 3}. is a collection of objects, its elements, regarded as a single whole.

The basic gesture, the one everything else flows from, is to ask whether an object is in or out. This relation is called membership Membership The fundamental relation between an object and a set, written ∈. "x ∈ A" reads "x belongs to A" and means that x is one of the elements of A. Its negation is written ∉. Membership is the basic predicate of set theory: everything else, inclusion and operations, is defined from it. and is written \in :

xAx \in A

reads ”xx belongs to AA”, that is ”xx is one of the elements of AA”. Its negation is written xAx \notin A. Notice that "xAx \in A" is exactly a predicate in the sense of chapter 2: depending on what we put in place of xx, it is true or false. The whole of set theory is built on this single predicate.

There are two ways to describe which objects are in a set:

  • By extension : we list the elements in braces. A={1,2,3}A = \{1, 2, 3\}. Handy for small sets.
  • By comprehension : we give the property the elements satisfy. A={xx>0 and x<4 and x integer}A = \{x \mid x > 0 \text{ and } x < 4 \text{ and } x \text{ integer}\}. Here the bar \mid reads “such that”.

The comprehension description reveals the deep link with chapter 2: a set by comprehension, {xP(x)}\{x \mid P(x)\}, is nothing but a predicate PP turned into an object. The set is the collection of all the witnesses that make PP true.

One last principle, quiet but foundational: a set is entirely determined by its elements. Two sets with exactly the same elements are the same set, no matter how they were described. So {1,2,3}\{1, 2, 3\}, {3,2,1}\{3, 2, 1\} and {1,1,2,3}\{1, 1, 2, 3\} are one and the same set: order and repetitions do not count. This principle is called extensionality, and it is what makes everything that follows possible.

Comparing: inclusion and equality

Now that we can test membership, we can compare two sets. The promise of chapter 2 arrives here. Inclusion Inclusion A relation between two sets, written ⊆. "A ⊆ B" reads "A is included in B" or "A is a subset of B", and means that every element of A is also an element of B. Its definition is a quantified statement: A ⊆ B is equivalent to "for all x, x ∈ A implies x ∈ B". Two sets are equal exactly when each is included in the other (double inclusion). , written \subseteq, says that every element of the first set is also in the second:

ABmeansx, (xAxB)A \subseteq B \quad\text{means}\quad \forall x,\ (x \in A \Rightarrow x \in B)

This equation reads: ”AA is included in BB” exactly when “for all xx, if xx belongs to AA, then xx belongs to BB”. Inclusion is therefore not one more symbol to memorise: it is a universal implication, the “for all” of chapter 2 applied to the membership predicate. We say AA is a subset of BB.

How, then, do we say that two sets are equal? By extensionality, A=BA = B means they have the same elements, that is, each is included in the other:

A=BmeansAB  and  BAA = B \quad\text{means}\quad A \subseteq B \ \text{ and } \ B \subseteq A

This split is called double inclusion. It looks harmless, but it is the most used proof tool whenever we want to show two sets are equal: we prove one inclusion, then the other. Keep it in mind, chapter 4 will make it its daily bread.

We can also gather all the subsets of a set EE into a new set: the power set Power set The set of all subsets of a set E, written P(E). Its elements are themselves sets: the empty set and E itself always belong to it. If E has n elements, then P(E) has 2 to the power n, because each element of E is either taken or left out of a subset. For example P({a, b}) = {∅, {a}, {b}, {a, b}}. , written P(E)\mathcal{P}(E). Its elements are themselves sets. For example:

P({a,b})={, {a}, {b}, {a,b}}\mathcal{P}(\{a, b\}) = \{\, \varnothing,\ \{a\},\ \{b\},\ \{a, b\} \,\}

We always find \varnothing and EE itself in it. And a simple count: if EE has nn elements, P(E)\mathcal{P}(E) has 2n2^n, because to build a subset, each element of EE is either taken or left out, two independent choices repeated nn times.

Combining: the operations are the connectives

Here is the heart of the chapter. From two sets, we build new ones with three operations. Each is defined by its membership condition, and that condition is a connective from chapter 1.

Union Union The operation that joins two sets, written ∪. A ∪ B is the set of objects that belong to A or to B (or to both). Its membership condition is a disjunction: x ∈ A ∪ B is equivalent to "x ∈ A or x ∈ B". Union is to the logical "or" what the object is to the connective. , written \cup, gathers:

xAB    (xA)  (xB)x \in A \cup B \iff (x \in A) \ \lor \ (x \in B)

An object is in ABA \cup B if it is in AA or in BB (or in both). Union is the logical “or” turned into an object.

Intersection Intersection The operation that keeps only what two sets share, written ∩. A ∩ B is the set of objects that belong to both A and B. Its membership condition is a conjunction: x ∈ A ∩ B is equivalent to "x ∈ A and x ∈ B". When A ∩ B is empty, A and B are said to be disjoint. , written \cap, keeps only the common part:

xAB    (xA)  (xB)x \in A \cap B \iff (x \in A) \ \land \ (x \in B)

An object is in ABA \cap B if it is in AA and in BB. Intersection is the “and”. When AB=A \cap B = \varnothing, we say AA and BB are disjoint.

The complement Complement The operation that returns what is not in a set, relative to a reference universe. The complement of A, written Aᶜ (or A bar), is the set of objects of the universe that do not belong to A. Its membership condition is a negation: x ∈ Aᶜ is equivalent to "not (x ∈ A)". The complement depends on the chosen universe: without a fixed universe, it has no meaning. , written AcA^c, returns what is not in AA, relative to a reference universe UU :

xAc    ¬(xA)x \in A^c \iff \lnot (x \in A)

This is the “not”. Careful: the complement only makes sense if the universe is fixed. Without saying “not with respect to what”, AcA^c means nothing. It is the same role as the domain of discourse of chapter 2.

The table fills itself in: to each logical connective corresponds a set operation, because the two are the same idea seen from two sides.

x ∈ A ∪ B ⟺ (x ∈ A) ∨ (x ∈ B) | x ∈ A ∩ B ⟺ (x ∈ A) ∧ (x ∈ B) | x ∈ Aᶜ ⟺ ¬(x ∈ A)
Each operation is a connective applied to membership

And since the operations are connectives, the laws that govern the connectives become laws on sets. The De Morgan laws of chapter 1, ¬(PQ)¬P¬Q\lnot(P \lor Q) \equiv \lnot P \land \lnot Q, transpose word for word:

(AB)c=AcBc(AB)c=AcBc(A \cup B)^c = A^c \cap B^c \qquad (A \cap B)^c = A^c \cup B^c

Read the first one aloud: “the complement of a union is the intersection of the complements”. To not be in AA or BB, you must be neither in AA nor in BB. This is exactly the “not (P or Q) amounts to (not P) and (not Q)” of chapter 1. You are not proving a new truth: you are recognising an old one in a new costume.

Manipulating De Morgan on objects

The component below makes all this tangible. The universe is U={1,2,3,4,5,6}U = \{1, 2, 3, 4, 5, 6\}, starting with A={1,2,3}A = \{1, 2, 3\} and B={3,4,5}B = \{3, 4, 5\}. You place each element in one of the four regions by clicking on it, and you choose the operation to display: the component shows the matching membership condition and highlights the selected elements.

Your mission : turn on De Morgan mode. On the left, the component computes (AB)c(A \cup B)^c ; on the right, AcBcA^c \cap B^c. The two lists are identical, here {6}\{6\}, the only element outside both circles. Now move elements from one region to another, as much as you like: the two sides always stay equal. You have not proved anything yet, but you have watched the law resist every attempt.

Click a token to move it between the four regions: A only, A and B, B only, outside both.
Outside A and B
A A only
A and B
B B only
Operation to display

Membership condition

x ∈ A ∨ x ∈ B

Selected elements

{ 1, 2, 3, 4, 5 }

Three questions to ask yourself while playing:

  • Put every element in the “outside A and B” region. What is ABA \cup B ? And (AB)c(A \cup B)^c ? Does the De Morgan equality still hold on empty sets?
  • Choose the operation “difference ABA \setminus B”. Guess its membership condition before reading it: which connective matches “in AA but not in BB” ?
  • Place a single element in the intersection. How many regions does the complement of AA cover?

Building anew: the cartesian product

The three previous operations stay inside the starting universe. One last construction truly steps outside, in the literal sense: the cartesian product Cartesian product The operation that builds a set of pairs from two sets, written ×. A × B is the set of all ordered pairs (a, b) where a ∈ A and b ∈ B. Order matters: (a, b) is not (b, a). If A has m elements and B has n, then A × B has m × n. It is the starting brick of relations and functions. , written ×\times. It builds pairs:

A×B={(a,b)aA  and  bB}A \times B = \{\, (a, b) \mid a \in A \ \text{ and } \ b \in B \,\}

A×BA \times B is the set of all ordered pairs whose first coordinate comes from AA and second from BB. Order matters: (a,b)(a, b) is not (b,a)(b, a). And the count is clear: if AA has mm elements and BB has nn, then A×BA \times B has m×nm \times n, hence the name. With A={1,2}A = \{1, 2\} and B={x,y}B = \{x, y\} :

A×B={(1,x), (1,y), (2,x), (2,y)}A \times B = \{\, (1, x),\ (1, y),\ (2, x),\ (2, y) \,\}

We will not go further here, but remember where this brick leads: a pair is the seed of a relation, and a well-chosen relation is a function. The whole language of functions, which the following courses will unfold, is built on this simple ×\times.

In one sentence

A set is determined by its elements through membership; inclusion is a universal implication, union an “or”, intersection an “and”, complement a “not”, so the De Morgan laws of chapter 1 still govern sets, word for word.

Towards chapter 4

You have seen, on the component and on examples, that (AB)c=AcBc(A \cup B)^c = A^c \cap B^c. You tested it, again and again, never catching it out. But to test is not to prove: checking an identity on a universe of six elements does not prove it holds for all sets, exactly as trying a hundred numbers does not prove a universal property (remember Fermat’s counter-example in chapter 2). How do we pass from “it works every time” to “it is true, always, with no exception”?

The key is already in this chapter: to prove A=BA = B, we prove ABA \subseteq B and BAB \subseteq A ; and each inclusion is a "x, xAxB\forall x,\ x \in A \Rightarrow x \in B", hence a universal implication to prove. Chapter 4 gives precisely the techniques to prove such statements, with no example and no drawing: direct proof, contrapositive, proof by contradiction. The double inclusion of this chapter is the proof obligation the next one will teach you to honour.

Exercises

Take a sheet of paper and a pencil. The solutions are right below, look at them only after trying.

Exercise 1: prove an inclusion through membership

Show that AABA \subseteq A \cup B for all sets AA and BB. Hint: translate the inclusion into a quantified statement, then reason about an arbitrary element.

Exercise 2: check De Morgan on a finite universe

The universe is U={1,2,3,4,5,6}U = \{1, 2, 3, 4, 5, 6\}, with A={1,2,3}A = \{1, 2, 3\} and B={3,4,5}B = \{3, 4, 5\}. Compute (AB)c(A \cup B)^c on one side, then AcBcA^c \cap B^c on the other, and compare.

Quiz
  1. 1. What entirely determines a set?

  2. 2. The inclusion "A ⊆ B" translates into which statement from chapter 2?

  3. 3. "x ∈ A ∩ B" is equivalent to...

  4. 4. By the De Morgan laws on sets, (A ∪ B)ᶜ equals...

  5. 5. If E has 3 elements, how many does P(E) (the power set) have?

Sources

  • Halmos, P. (1960). Naive Set Theory. Van Nostrand. The classic reference, short and luminous, on intuitive set theory.
  • Cantor, G. (1895). “Beiträge zur Begründung der transfiniten Mengenlehre.” Mathematische Annalen 46. The founding act of set theory.

Going further

  • Velleman, D. J. (2019). How to Prove It. Cambridge University Press. Chapter 1 on sets and their operations, in the exact spirit of this course.
  • Enderton, H. (1977). Elements of Set Theory. Academic Press. For the axiomatic version, once chapter 4 is digested.