Mascot image.
← MA0 1 · Introduction to University Mathematics (Proofs)

Lesson 3

Naive Sets

Taught

Sets

In the last chapter, we introduced predicates, quantifiers, and (most importantly) sets, attempting to characterise our mathematical discourse around them as well-defined; although we now possess the necessary tools to work with them directly, we will still set out a formal framework: a system of axioms for sets, just as we established for logic in Chapter 1. The result will be a somewhat overcomplete collection of axioms (a style not typically used when teaching set theory); some of these axioms can be used to deduce others.

Axioms

The previous definition of the set as nothing more than a collection of objects, although circular as collection is merely a set under a different name, is useful and intuitive enough that to form a collection of object is to abstract from the intrinsic nature of the items themselves.

The logicians have in any case turned this into a method by asking where an object sits rather than what it is. A set, in this picture, is a “primary” box holding other “secondary” boxes, its elements, which may contain further boxes in their turn, and so on as far down as one cares to follow; the composition of the box never matters, only the arrangement of which box lies within which, so that two boxes with the same contents are the same box. The picture asks two things of us:

Axiom 3.1 (Existence).

There exists a set with no elements, Xx(xX)\exists X\,\forall x\,(x \notin X): called the empty or null set, written as {}\{\} or \emptyset.

Axiom 3.2 (Sets are objects).

If AA is a set, then AA is also an object. In particular, a box AA is itself an object and an object may go inside a box BB, and therefore it is meaningful to ask whether AA is also an element of BB.

Remark.

Georg Cantor built set theory on that move somewhere between 1870 and 1890, taking the totality of objects sharing a given property to be one new object. The subject so founded divides into two: a first-order study of the sets themselves, and a higher-order study that turns upon the first to ask how far such knowledge can reach, where it shades into metamathematics, (we wont study this far). The creation itself irritated his contemporaries, for such an object might be infinite, and to enclose an infinity within a single box was more than most would grant.

Using our picture, we summarise the two relations used to build up set theory. The first, introduced last chapter, is the membership relation xXx \in X: if xx is an object and XX is a set, then xXx \in X is either true or false (it is well defined, which we come to in a second); note that if XX is not a set then xXx \in X does not make sense, like saying π3\pi \in 3. The second is the equality relation x=yx = y: xx and yy name the same object, and its negation is written ¬(x=y)\lnot(x=y) or xyx \neq y. The equality relation obeys the three laws one expects: reflexivity, x=xx = x; symmetry, if x=yx = y then y=xy = x; and transitivity, if x=yx = y and y=zy = z then x=zx = z. The two relations, \in and ==, obey axioms we will state as we need them; when the objects named are sets, the axiom of extension below tells us how to recognise that sameness.

Remark (Substitution).

Given any two objects xx and yy with x=yx = y, the statements P(x)P(x) and P(y)P(y) are equivalent for every property PP depending on xx. This is customarily taken as the axiom of substitution, but we are not assuming anything new: a predicate had its truth value fixed by the objects assigned to its variables rather than by the terms naming them, and x=yx = y says those two terms name one object, so P(x)P(x) and P(y)P(y) are the same assignment twice over.

Axiom 3.3 (Extensionality).

If two sets AA and BB, have the exact same elements then they are equal, AB(x(xA    xB)    A=B).\forall A\forall B(\forall x(x \in A \iff x \in B) \implies A=B).

From the axiom we know that sets are unordered, as the biconditional shows, and that repetition does not count, as the box picture makes plain. There is no point in dropping two secondary boxes AA and BB into XX when, opened all the way down, they hold the same contents; they are not distinct objects, however distinct they may look.

Example 3.4.

The sets {2,2,3,4,π,}\{2, 2, 3, 4, \pi, \emptyset\} and {4,π,,2,3}\{4, \pi, \emptyset, 2, 3\} are equal.

From these axioms we prove that the equality extensionality gives us for sets obeys them too.

Theorem 3.5 (Equality of sets is an equivalence relation).

Let AA, BB and CC be sets. Then A=AA = A; if A=BA = B then B=AB = A; and if A=BA = B and B=CB = C then A=CA = C.

Since A=BA = B is the statement x((xA)    (xB))\forall x\,((x \in A) \iff (x \in B)), we prove it just as proving universal claims taught us to prove any universally quantified biconditional: take an arbitrary xx, and show that xAx \in A and xBx \in B stand or fall together.

Discussion.

Every one of the three claims has the same form once extensionality is applied: We first note that the biconditional splits into its two constituents, (xA    xB)(xB    xA)(x \in A \implies x \in B) \land (x \in B \implies x \in A), so each law fixes an arbitrary object xx, proves two implications about its membership. For reflexivity, A=AA = A, or (xA    xA)(xA    xA)(x \in A \implies x \in A) \land (x \in A \implies x \in A); there is no hypothesis to argue from, so we read the implication through the defining equivalence of the conditional as ¬(xA)(xA)\neg(x \in A) \lor (x \in A), which Complement makes \top, and a conjunction of two such is \top again. For symmetry we assume A=BA = B, or, (xA    xB)(xB    xA)(x \in A \implies x \in B) \land (x \in B \implies x \in A); by Commutativity of \land, gives us (xB    xA)(xA    xB)(x \in B \implies x \in A) \land (x \in A \implies x \in B) which is B=AB=A. For transitivity we assume A=BA = B and B=CB = C, which give four implications between three memberships: xA    xCx \in A \implies x \in C is the chain of xA    xBx \in A \implies x \in B with xB    xCx \in B \implies x \in C by hypothetical syllogism, and xC    xAx \in C \implies x \in A is the chain of the other two the same way.

Proof (element style).

Let xx be an object.

For reflexivity, we must show that xx lies in AA exactly when it lies in AA. If xAx \in A then xAx \in A, and if xAx \notin A then xAx \notin A, so the two memberships stand or fall together whichever way xx falls. As xx was arbitrary, Axiom 3.3 gives A=AA = A.

For symmetry, suppose A=BA = B. Then xA    xBx \in A \iff x \in B by substitution. If xBx \in B then that biconditional puts xx in AA, and if xAx \in A it puts xx in BB, so xB    xAx \in B \iff x \in A. As xx was arbitrary, Axiom 3.3 gives B=AB = A.

For transitivity, suppose A=BA = B and B=CB = C. Then xA    xBx \in A \iff x \in B and xB    xCx \in B \iff x \in C by substitution. If xAx \in A, the first carries it into BB and the second into CC; if xCx \in C, the second carries it back into BB and the first into AA. So xA    xCx \in A \iff x \in C, and as xx was arbitrary, Axiom 3.3 gives A=CA = C.

The axiom of extensionality also tells us that the empty set is unique.

Proposition 3.6 (Uniqueness of the empty set).

There is exactly one set with no elements.

Discussion.

By Axiom 3.1 , we know there is at least one set with no elements, so uniqueness is the claim that any two such sets are equal. Suppose \emptyset' is a different set that doesnt have any elements. By definition \emptyset must equal \emptyset', which by Axiom 3.3 , =\emptyset = \emptyset' is the statement x(x    x)\forall x\,(x \in \emptyset \iff x \in \emptyset'), for an arbitrary object xx. Neither set \emptyset, and \emptyset' has elements, so both of its sides are \bot, and     \bot \iff \bot is \top by biconditional.

Proof.

Let \emptyset and \emptyset' both be sets with no elements, and let xx be an object. Since \emptyset has no elements, xx \notin \emptyset, and since \emptyset' has no elements, xx \notin \emptyset'; both xx \in \emptyset and xx \in \emptyset' are therefore \bot. By the biconditional,     \bot \iff \bot is \top, so x    xx \in \emptyset \iff x \in \emptyset'. As xx was arbitrary, Axiom 3.3 gives =\emptyset = \emptyset'. Any two sets with no elements are equal, so there is only one, and we are entitled to speak of the empty set.

If a set is not equal to the empty set we call it non-empty. The following is a small statement, but one we will lean on often.

Proposition 3.7 (Single choice).

Let AA be a non-empty set. Then there exists an object xx such that xAx \in A.

Discussion.

The statement is existential, and proving existential claims asks for a witness, which the hypothesis AA \neq \emptyset does not name. We prove it by contradiction: denying the conclusion makes xAx \in A false for every object xx, and xx \in \emptyset is false by Axiom 3.1 , so xA    xx \in A \iff x \in \emptyset is \top by the biconditional and Axiom 3.3 gives A=A = \emptyset, against the hypothesis.

Proof.

Suppose, for contradiction, that no object xx satisfies xAx \in A. Let xx be an object. Then xAx \notin A, and by the axiom of existence xx \notin \emptyset. Both memberships are false, and as xx was arbitrary, =A\emptyset = A (by Axiom 3.3 as xA    xx \in A \iff x \in \emptyset is true), contradicting AA being non-empty, so some object xx satisfies xAx \in A.

Remark.

Firstly The emptyset is not the same thing as the number 0. One is a set; and the other a number. Secondly Proposition 3.7 is what licenses the word “choose”: given a non-empty AA we may pick out an element of it and give that element a name, and it is the hypothesis AA \neq \emptyset that earns us the right to do so. Taking one element from each of finitely many non-empty sets A1,,AnA_1, \ldots, A_n at once is a further step, and we will take it when we need it. Taking one from each of infinitely many is a different matter again: nothing we have assumed so far reaches that far, and it takes an axiom of its own, the axiom of choice, which we will keep running into.

Problem 3.1.

Let AA and BB be sets. Show that ABA \neq B if and only if there is an object belonging to one of them and not to the other.

Set-Builder Notation

We go back to last chapter, where we combined sets with predicates. To describe a set by a defining characteristic, or by carving a condition into a larger set, we use set-builder notation; a set so described takes the form

S={xP(x)}S = \{x \mid P(x)\}

read ”SS is the set of all xx such that P(x)P(x) is true”, with "\mid" meaning such that (note that some people use "::" over ”|”) and P(x)P(x) a predicate.

This right now sounds like the well-defined set we spoke of earlier, but it isnt. As written the notation is unrestricted, and Russell’s paradox is what that costs us. Define

R={xxx}R = \{x \mid x \notin x\}

We can ask a few questions, like what the elements of RR are. Any of the sets we have discussed so far would be one: the empty set contains no elements, so it certainly does not have itself as an element, and R\emptyset \in R. But what about RR itself?

  1. Suppose RRR \in R. The defining property of RR tells us that each of its elements is a set which does not have itself as an element, so RRR \notin R.
  2. Suppose RRR \notin R. Then RR is a set which does not have itself as an element, and that is the defining property, so RRR \in R.

Each assumption gives us its own negation, so RR    RRR \in R \iff R \notin R. Nothing behaves this way, and the fault is not with RR but with the notation that produced it: we let the predicate range over everything at once.

Problem 3.2.

Is {xxx}\{x \mid x \neq x\} a paradoxical set? Say why or why not; (b) does it have any elements?

So currently written our set-builder notation isnt safe. The axiom below is what makes it safe, and it carves into a set we already have.

Axiom 3.8 (Comprehension).

For every set AA and every predicate P(x)P(x) there exists a set whose elements are exactly the elements of AA for which P(x)P(x) holds, ABx(xB    xAP(x))\forall A\,\exists B\,\forall x\,(x \in B \iff x \in A \land P(x)).

The predicate no longer ranges over everything; it ranges over the elements of a set we are holding already, so Russell’s RR is never formed. What we may write down instead is {xAxx}\{x \in A \mid x \notin x\}, which is a perfectly ordinary set, and asking whether it belongs to itself gets an ordinary answer.

Proposition 3.9 (The carved set is unique).

Let AA be a set and P(x)P(x) a predicate. There is exactly one set BB such that xBx \in B if and only if xAx \in A and P(x)P(x).

Discussion.

Axiom 3.8 supplies at least one such BB, so uniqueness is the claim that any two are equal. We prove this directly: We assume there is a second set BB' satisfying the same membership condition. By Axiom 3.3 , B=BB = B' is the statement x(xB    xB)\forall x\,(x \in B \iff x \in B'), and the work is that one biconditional at an arbitrary object xx. Both sets carry the same membership criterion, so each side of it is equivalent to xAP(x)x \in A \land P(x), and the two sides are joined through that.

Proof.

Let BB and BB' both satisfy the criterion, and let xx be an object. Then xB    xAP(x)x \in B' \iff x \in A \land P(x) and xAP(x)    xBx \in A \land P(x) \iff x \in B, so xB    xBx \in B' \iff x \in B by the transitivity of equivalence. As xx was arbitrary, Axiom 3.3 gives B=BB = B'.

Since there is only one such set, we may name it.

Definition 3.10 (Set-builder notation).

Let AA be a set and P(x)P(x) a predicate. The unique set BB such that xBx \in B if and only if xAx \in A and P(x)P(x) is written {xAP(x)}\{x \in A \mid P(x)\}.

The criterion settles membership one object at a time: given any object xx, whether x{xAP(x)}x \in \{x \in A \mid P(x)\} holds is decided by whether xAx \in A and P(x)P(x) do, and both of those have a truth value already.

Definition 3.11 (Well-defined set).

A set XX is well defined when xXx \in X has a truth value for every object xx.

We note that every set Axiom 3.8 builds is well defined, since PP is a predicate and a predicate has a truth value once its variable is assigned.

Problem 3.3.

Let AA and BB be sets. Show that the set of objects lying in AA and not in BB exists.

We said at the outset that our collection of axioms would be somewhat overcomplete, and here is one instance of it: Axiom 3.1 asks for a set with no elements, but comprehension will produce one from any set at all.

Proposition 3.12 (Existence from comprehension).

Suppose some set exists. Then there is a set with no elements.

Discussion.

The hypothesis names a set but says nothing about its elements, so we can neither point at an object in it nor rule one out. What Axiom 3.8 lets us do is carve that set by any predicate we please, so we pick one no object can satisfy: xxx \neq x fails for every object by the reflexivity of equality, and the set it carves out is then empty whatever we started from.

Proof.

Let AA be a set. By Axiom 3.8 , B={xAxx}B = \{x \in A \mid x \neq x\} is a set, and xB    xAxxx \in B \iff x \in A \land x \neq x for every object xx. Since x=xx = x for every object, xxx \neq x is \bot, and xBx \notin B. As xx was arbitrary, BB has no elements.

The gain from restricting the notation is a set theory that does not fall over. What we give up is the set of everything.

Proposition 3.13 (No set of all sets).

There is no set VV such that every set is an element of VV, that is, ¬VX(XV)\neg\exists V\,\forall X\,(X \in V), with XX ranging over sets.

Discussion.

The claim is a negative existence statement, so we prove it by contradiction: we assume such a VV exists and use it to build a set that cannot exist. Axiom 3.8 applied to VV and the predicate ”xx is not an element of itself” produces R={xVxx}R = \{x \in V \mid x \notin x\}, which is where Russell’s argument runs again, this time inside the axiom rather than outside it. The question is whether RRR \in R, and the membership criterion is a biconditional, xR    xVxxx \in R \iff x \in V \land x \notin x, so either answer forces the other.

Proof.

Suppose VV is a set containing every set. By Axiom 3.8 , R={xVxx}R = \{x \in V \mid x \notin x\} is a set, and since VV contains every set, RVR \in V. If RRR \in R, then by the membership criterion RR satisfies the defining predicate, so RRR \notin R; if RRR \notin R, then RVR \in V and RRR \notin R both hold, which is the criterion, so RRR \in R. Each alternative gives its own negation, so no such VV exists.

Pairs

Were these the only axioms we had, set theory would be a paper thin subject: Axiom 3.1 gives us the empty set, and Axiom 3.8 only ever carves into a set we are already holding, so every set we could name would be empty. The axioms below build.

Axiom 3.14 (Pairing).

For any two objects there is a set containing exactly those two, xyzw(wz    (w=xw=y))\forall x\,\forall y\,\exists z\,\forall w\,(w \in z \iff (w = x \lor w = y)).

Definition 3.15 (Pair and singleton).

Let xx and yy be objects. The set given by pairing them is written {x,y}\{x, y\}, and we write {x}\{x\} for {x,x}\{x, x\}, the singleton of xx.

Remark.

The axiom asserts that such a set exists; that there is only one comes from Axiom 3.3 , by the argument of Proposition 3.9 . Two sets answering to the same membership criterion agree on every object, so they are equal; the same holds for every set we name from here on.

Since {x}\{x\} is an abbreviation rather than a further axiom, no separate axiom for singletons is needed: pairing an object with itself produces one.

Remark.

From here on there are two natural styles for writing such a proof. The first chases the element through in prose, spelling out what each membership means as it goes; the second works directly on the predicates, transforming "xAx \in A" into "xBx \in B" by the laws tabulated in the first chapter. Both are correct, and tastes differ; I prefer the logical style, but I will give both throughout for completeness, and you should be able to read each.

Proposition 3.16 (Pairs are unordered and absorb repetition).

Let xx and yy be objects. Then {x,y}={y,x}\{x, y\} = \{y, x\}, and w{x}w \in \{x\} if and only if w=xw = x, for every object ww.

Discussion.

The first claim is an equality of sets, so by Axiom 3.3 it is a biconditional at an arbitrary object ww, and the membership criterion of Axiom 3.14 rewrites each side as a disjunction: w=xw=yw = x \lor w = y on the one side and w=yw=xw = y \lor w = x on the other, which the axiom of Commutativity exchanges. The second claim is not an equality of sets, since {x}\{x\} is by Definition 3.15 another name for {x,x}\{x, x\}; what has to be shown is that the pair criterion collapses, w=xw=xw = x \lor w = x reducing to w=xw = x by Idempotence, so that the singleton holds the one object and nothing else.

Proof (element style).

Let ww be an object and suppose w{x,y}w \in \{x, y\}. By Axiom 3.14 , w=xw = x or w=yw = y. In the first case ww is the second of the two objects paired to form {y,x}\{y, x\}, and in the second case it is the first, so w{y,x}w \in \{y, x\} either way. Interchanging xx and yy throughout carries an element of {y,x}\{y, x\} back to {x,y}\{x, y\}. As ww was arbitrary, Axiom 3.3 gives {x,y}={y,x}\{x, y\} = \{y, x\}. For the singleton, {x}\{x\} is {x,x}\{x, x\}. If w{x}w \in \{x\}, then by Axiom 3.14 w=xw = x or w=xw = x, and both alternatives say the same thing, so w=xw = x. Conversely, if w=xw = x then the first alternative holds, so w{x,x}w \in \{x, x\}, which is w{x}w \in \{x\}.

Proof (logical style).

Let ww be an object.

w{x,y}(w=xw=y)by Pairing(w=yw=x)by Commutativityw{y,x}by Pairing\begin{aligned} w \in \{x, y\} &\equiv (w = x \lor w = y) && \text{by Pairing} \\ &\equiv (w = y \lor w = x) && \text{by Commutativity} \\ &\equiv w \in \{y, x\} && \text{by Pairing} \end{aligned}

As ww was arbitrary, Axiom 3.3 gives {x,y}={y,x}\{x, y\} = \{y, x\}. For the singleton:

w{x}w{x,x}by the singleton notation(w=xw=x)by Pairingw=xby Idempotence\begin{aligned} w \in \{x\} &\equiv w \in \{x, x\} && \text{by the singleton notation} \\ &\equiv (w = x \lor w = x) && \text{by Pairing} \\ &\equiv w = x && \text{by Idempotence} \end{aligned}

Example 3.17.

The empty set is a set, hence an object by Axiom 3.2 , so pairing it with itself gives the singleton {}\{\emptyset\}. That in turn is an object, so we may form {{}}\{\{\emptyset\}\}, and pairing the first two gives {,{}}\{\emptyset, \{\emptyset\}\}.

Problem 3.4.

Show that \emptyset, {}\{\emptyset\}, {{}}\{\{\emptyset\}\} and {,{}}\{\emptyset, \{\emptyset\}\} are four different sets.

Every set we can build so far holds at most two elements; to grow them we take a set whose members are themselves sets and pool everything they contain.

Axiom 3.18 (Union).

Given any set of sets, there is a set containing precisely those objects which are members of some set in the collection, xyz(zy    w(zwwx))\forall x\,\exists y\,\forall z\,(z \in y \iff \exists w\,(z \in w \land w \in x)).

Definition 3.19 (Union of a system of sets).

Let SS be a set. The unique set UU such that xUx \in U if and only if xAx \in A for some ASA \in S is written S\bigcup S.

Definition 3.20 (Union of two sets).

Let AA and BB be sets. Then ABA \cup B denotes the set {A,B}\bigcup \{A, B\}.

Two axioms are at work in that second definition: pairing gathers AA and BB into one collection, and union pools what they hold. Membership in the result reads as a disjunction.

Proposition 3.21 (Membership in a union).

Let AA and BB be sets. For every object xx, xAB    (xAxB)x \in A \cup B \iff (x \in A \lor x \in B).

Discussion.

ABA \cup B is {A,B}\bigcup \{A, B\}, so Axiom 3.18 reads its membership as w(xww{A,B})\exists w\,(x \in w \land w \in \{A, B\}), an existential claim about which member of the collection holds xx. The collection has only two members, since Axiom 3.14 gives w{A,B}    (w=Aw=B)w \in \{A, B\} \iff (w = A \lor w = B), so the witness ww can only be AA or BB and the existential claim collapses into the disjunction of those two cases.

Proof (element style).

Let xx be an object and suppose xABx \in A \cup B, which is to say x{A,B}x \in \bigcup \{A, B\}. By Axiom 3.18 some set ww has xwx \in w and w{A,B}w \in \{A, B\}, and by Axiom 3.14 that ww is either AA or BB. In the first case xAx \in A and in the second xBx \in B, so xAx \in A or xBx \in B.

Conversely, suppose xAx \in A or xBx \in B. If xAx \in A, take ww to be AA: then xwx \in w, and w{A,B}w \in \{A, B\} by Axiom 3.14 , so ww is a witness and x{A,B}x \in \bigcup \{A, B\}. If instead xBx \in B, take ww to be BB and argue the same way. Either way xABx \in A \cup B.

Proof (logical style).

Let xx be an object.

xABx{A,B}by the definition of ABw(xww{A,B})by Unionw(xw(w=Aw=B))by Pairingw((xww=A)(xww=B))by Distributivityw(xww=A)w(xww=B)by -distribution(xAxB)by substitution\begin{aligned} x \in A \cup B &\equiv x \in \textstyle\bigcup \{A, B\} && \text{by the definition of } A \cup B \\ &\equiv \exists w\,(x \in w \land w \in \{A, B\}) && \text{by Union} \\ &\equiv \exists w\,\bigl(x \in w \land (w = A \lor w = B)\bigr) && \text{by Pairing} \\ &\equiv \exists w\,\bigl((x \in w \land w = A) \\ &\qquad\qquad {}\lor (x \in w \land w = B)\bigr) && \text{by Distributivity} \\ &\equiv \exists w\,(x \in w \land w = A) \\ &\qquad {}\lor \exists w\,(x \in w \land w = B) && \text{by }\exists\text{-distribution} \\ &\equiv (x \in A \lor x \in B) && \text{by substitution} \end{aligned}

The fifth step is the distribution of an existential over a disjunction from the last chapter, and the last discharges each witness by substitution, since a ww with w=Aw = A may be replaced by AA throughout.

The “or” is the disjunction of the first chapter, inclusive as always, so an object lying in both sets lies in the union too.

Proposition 3.22 (Union is well defined).

Let AA, AA' and BB be sets with A=AA = A'. Then AB=ABA \cup B = A' \cup B.

Discussion.

An operation on sets should not depend on how we happened to name its arguments, and the criterion of Proposition 3.21 is what secures that here: membership in ABA \cup B is decided by membership in AA and in BB, and A=AA = A' makes membership in AA and in AA' the same question. So the two unions meet the same criterion at every object, and Axiom 3.3 does the rest.

Proof (element style).

Let xx be an object and suppose xABx \in A \cup B. By Proposition 3.21 , xAx \in A or xBx \in B. If xAx \in A, then xAx \in A' by substitution, since A=AA = A'; if xBx \in B, there is nothing to change. Either way xAx \in A' or xBx \in B, so xABx \in A' \cup B by Proposition 3.21 .

For the converse, A=AA' = A by the symmetry of equality established in Theorem 3.5 , so the same argument run with AA' in place of AA carries an element of ABA' \cup B into ABA \cup B. As xx was arbitrary, Axiom 3.3 gives AB=ABA \cup B = A' \cup B.

Proof (logical style).

Let xx be an object.

xAB(xAxB)by membership in a union(xAxB)since A=AxABby membership in a union\begin{aligned} x \in A \cup B &\equiv (x \in A \lor x \in B) && \text{by membership in a union} \\ &\equiv (x \in A' \lor x \in B) && \text{since } A = A' \\ &\equiv x \in A' \cup B && \text{by membership in a union} \end{aligned}

As xx was arbitrary, Axiom 3.3 gives AB=ABA \cup B = A' \cup B.

With membership in a union settled, the basic properties of the operation follow from the corresponding properties of \lor.

Proposition 3.23 (Basic properties of unions).

Let aa and bb be objects and let AA, BB and CC be sets. Then

  1. {a,b}={a}{b}\{a, b\} = \{a\} \cup \{b\};
  2. AB=BAA \cup B = B \cup A;
  3. (AB)C=A(BC)(A \cup B) \cup C = A \cup (B \cup C);
  4. AA=A=A=AA \cup A = A \cup \emptyset = \emptyset \cup A = A.

Discussion.

Every claim is an equality of sets, so by Axiom 3.3 each is a biconditional at an arbitrary object xx, and Proposition 3.21 turns each side into a disjunction of memberships. What is left is a propositional identity in each case: Commutativity of \lor for the second claim, Associativity for the third, and for the fourth, Idempotence for AAA \cup A together with the axiom of Identity for the two involving \emptyset, since xx \in \emptyset is \bot by Axiom 3.1 . The first claim is the one that reaches back further: Axiom 3.14 gives x=ax=bx = a \lor x = b on the left, and Proposition 3.16 reads each singleton on the right as a single equation, so the two sides meet at the same disjunction.

Proof (element style).

Let xx be an object.

For the first claim, suppose x{a,b}x \in \{a, b\}. By Axiom 3.14 , x=ax = a or x=bx = b. In the first case x{a}x \in \{a\} by Proposition 3.16 , and in the second x{b}x \in \{b\}, so either way x{a}{b}x \in \{a\} \cup \{b\} by Proposition 3.21 . Conversely, if x{a}{b}x \in \{a\} \cup \{b\} then x{a}x \in \{a\} or x{b}x \in \{b\}, so x=ax = a or x=bx = b, and x{a,b}x \in \{a, b\}.

For the second, suppose xABx \in A \cup B. Then xAx \in A or xBx \in B, which is to say xBx \in B or xAx \in A, so xBAx \in B \cup A. The same argument with AA and BB interchanged gives the reverse.

For the third, suppose x(AB)Cx \in (A \cup B) \cup C. Then xABx \in A \cup B or xCx \in C. If xCx \in C, then xBCx \in B \cup C, and so xA(BC)x \in A \cup (B \cup C). If instead xABx \in A \cup B, then xAx \in A or xBx \in B; in the first case xA(BC)x \in A \cup (B \cup C) at once, and in the second xBCx \in B \cup C and hence xA(BC)x \in A \cup (B \cup C). So every element of (AB)C(A \cup B) \cup C lies in A(BC)A \cup (B \cup C), and a similar argument gives the reverse.

For the fourth, xAAx \in A \cup A says xAx \in A or xAx \in A, which says xAx \in A. And xAx \in A \cup \emptyset says xAx \in A or xx \in \emptyset, where the second alternative is impossible by Axiom 3.1 , so it says xAx \in A; the same holds for A\emptyset \cup A.

In each case xx was arbitrary, so Axiom 3.3 gives the four equalities.

Proof (logical style).

Let xx be an object, and write pp, qq, rr for the propositions xAx \in A, xBx \in B, xCx \in C.

x{a,b}(x=ax=b)by Pairing(x{a}x{b})by the singleton criterionx{a}{b}by membership in a union\begin{aligned} x \in \{a, b\} &\equiv (x = a \lor x = b) && \text{by Pairing} \\ &\equiv (x \in \{a\} \lor x \in \{b\}) && \text{by the singleton criterion} \\ &\equiv x \in \{a\} \cup \{b\} && \text{by membership in a union} \end{aligned}xABpqqpxBAby Commutativityx(AB)C(pq)rp(qr)xA(BC)by AssociativityxAAppxAby IdempotencexApxAby Identity\begin{aligned} x \in A \cup B &\equiv p \lor q \equiv q \lor p \equiv x \in B \cup A && \text{by Commutativity} \\ x \in (A \cup B) \cup C &\equiv (p \lor q) \lor r \\ &\equiv p \lor (q \lor r) \equiv x \in A \cup (B \cup C) && \text{by Associativity} \\ x \in A \cup A &\equiv p \lor p \equiv x \in A && \text{by Idempotence} \\ x \in A \cup \emptyset &\equiv p \lor \bot \equiv x \in A && \text{by Identity} \end{aligned}

We note that A\emptyset \cup A goes the same way after Commutativity. In each case xx was arbitrary, so Axiom 3.3 gives the equalities.

Because of associativity, we do not need to use the brackets: ABCA \cup B \cup C names one set regardless of how we group it (A(BC)A \cup (B \cup C) or (AB)C(A \cup B) \cup C, both mean the same thing), and likewise for ABCDA \cup B \cup C \cup D and longer strings.

Definition 3.24 (Triples and longer).

Let aa, bb, cc be objects. We write {a,b,c}\{a, b, c\} for {a}{b}{c}\{a\} \cup \{b\} \cup \{c\}, and {a,b,c,d}\{a, b, c, d\} for {a}{b}{c}{d}\{a\} \cup \{b\} \cup \{c\} \cup \{d\}, and so on for any string of objects written out in full.

Example 3.25.

The set {1,2}{2,3}\{1, 2\} \cup \{2, 3\} holds those objects lying in {1,2}\{1,2\}, or in {2,3}\{2,3\}, or in both, which are 11, 22 and 33. So {1,2}{2,3}={1,2,3}\{1, 2\} \cup \{2, 3\} = \{1, 2, 3\}.

The phrase “and so on” is doing work we cannot yet justify. Writing a set of nn objects for an unspecified nn means iterating the construction nn times, and we have not said what iterating a construction a given number of times amounts to; a set of infinitely many objects is further out of reach still. Later axioms will build sets that large.

Problem 3.5.

Let AA be a set. Show that {A}=A\bigcup \{A\} = A.

Subset

Comparing sets, we can see that some sit inside others, and we say the smaller one is a subset of the bigger. We write \subset for this throughout, whether or not the two sets happen to be equal.

Definition 3.26 (Subset).

Let AA and SS be sets. We say AA is a subset of SS, written ASA \subset S, if every element of AA is an element of SS. If moreover ASA \neq S, we call AA a proper subset of SS and write ASA \subsetneq S.

In logical language this is a universally quantified implication between predicates,

ASmeansx((xA)    (xS)),A \subset S \quad\text{means}\quad \forall x\,\bigl((x \in A) \implies (x \in S)\bigr),

and this reading will drive every subset proof we write: to prove ASA \subset S we take an arbitrary xx, assume xAx \in A, and reach xSx \in S.

Example 3.27.

The empty set is a subset of every set SS. The implication (x)    (xS)(x \in \emptyset) \implies (x \in S) has a hypothesis no object can satisfy, and an implication with a false hypothesis holds automatically; a promise never invoked is never broken. So S\emptyset \subset S, vacuously.

The definition uses nothing but \in and ==, and both obey substitution, so the subset relation does too: if ABA \subset B and A=AA = A', then ABA' \subset B.

Proposition 3.28 (Subsets are transitive).

Let AA, BB and CC be sets. If ABA \subset B and BCB \subset C, then ACA \subset C.

Discussion.

The conclusion ACA \subset C is itself a universally quantified implication, so we assume xAx \in A for an arbitrary object xx and must reach xCx \in C. The definition of subset is the only tool needed: ABA \subset B trades membership in AA for membership in BB, and BCB \subset C trades membership in BB for membership in CC, so the element walks through BB.

Proof (element style).

Let xAx \in A. By the definition of subset, ABA \subset B gives xBx \in B, and BCB \subset C gives xCx \in C. As xx was arbitrary, ACA \subset C.

Proof (logical style).

For any object xx,

xA    xBsince AB    xCsince BC,\begin{aligned} x \in A &\implies x \in B && \text{since } A \subset B \\ &\implies x \in C && \text{since } B \subset C, \end{aligned}

so (xA)    (xC)(x \in A) \implies (x \in C) holds for every xx, which is ACA \subset C.

Mutual inclusion is the other way of saying two sets are equal, which is what we should expect: the obvious way to define equality of sets is to say they contain exactly the same elements, and that is two implications rather than one.

Proposition 3.29 (Mutual inclusion is equality).

Let AA and BB be sets. If ABA \subset B and BAB \subset A, then A=BA = B.

Discussion.

By Axiom 3.3 the conclusion is a biconditional at an arbitrary object xx, and by the defining equivalence of the biconditional that biconditional is the conjunction of two implications. Those two implications are exactly what the two inclusions say, so the hypotheses deliver the conclusion once we have unfolded both sides into their logical form.

Proof.

Let xx be an object. By the definition of subset, ABA \subset B gives xA    xBx \in A \implies x \in B, and BAB \subset A gives xB    xAx \in B \implies x \in A. The two together say that xx lies in AA exactly when it lies in BB, so xA    xBx \in A \iff x \in B. As xx was arbitrary, Axiom 3.3 gives A=BA = B.

Proposition 3.30 (Proper subsets are transitive).

Let AA, BB and CC be sets. If ABA \subsetneq B and BCB \subsetneq C, then ACA \subsetneq C.

Discussion.

A proper inclusion is two claims, so the conclusion is two claims. The inclusion ACA \subset C is Proposition 3.28 applied to the two inclusions we are given, which leaves ACA \neq C. For that we need an object separating them, and BCB \subsetneq C supplies one: were every element of CC in BB we would have CBC \subset B, and with BCB \subset C that makes B=CB = C by Proposition 3.29 , against BCB \neq C. That object lies in CC but not in BB, so it cannot lie in AA either.

Proof.

From ABA \subset B and BCB \subset C we get ACA \subset C by Proposition 3.28 , so it remains to show ACA \neq C. Since BCB \neq C, some object cc lies in CC but not in BB: otherwise every element of CC would be an element of BB, giving CBC \subset B, and with BCB \subset C that would make B=CB = C by Proposition 3.29 . Now suppose A=CA = C. Then cAc \in A by substitution, and ABA \subset B gives cBc \in B, contradicting cBc \notin B. So ACA \neq C, and with ACA \subset C this is ACA \subsetneq C.

Problem 3.6.

Is SSS \subset S for every set SS?

Problem 3.7.

Let S={1,2}S = \{1, 2\}. Which of 1S1 \in S, {1}S\{1\} \in S and {1}S\{1\} \subset S are true?

More Set Operations

Swapping the “or” for an “and” gives the intersection, whose members must belong to both sets at once.

Definition 3.31 (Intersection).

Let SS and TT be sets. The intersection STS \cap T is the set {xSxT}\{x \in S \mid x \in T\}, so that for every object xx,

(xST)(xS)(xT).(x \in S \cap T) \equiv (x \in S) \land (x \in T).

The intersection needs no new axiom: Axiom 3.8 carves it out of SS, a set we are already holding. And since it is defined from \in and \land alone, both of which obey substitution, so does the intersection. The same remark applies to the definitions that follow, and we will not mention it again.

Proposition 3.32 (Inclusions for union and intersection).

Let SS and TT be sets. Then STSS \cap T \subset S and STTS \cap T \subset T, while SSTS \subset S \cup T and TSTT \subset S \cup T.

Discussion.

Each of the four is a universally quantified implication, so each takes an arbitrary xx, assumes the left membership and reaches the right. The two for the intersection unfold into a conjunction on the left, and Simplification extracts either conjunct. The two for the union unfold into a disjunction on the right, and Addition weakens a known truth to a disjunction.

Proof.

Let xx be an object. If xSTx \in S \cap T, then xSx \in S and xTx \in T; Simplification gives xSx \in S from that conjunction, and equally xTx \in T. As xx was arbitrary, STSS \cap T \subset S and STTS \cap T \subset T.

If instead xSx \in S, then Addition gives xSx \in S or xTx \in T, which is xSTx \in S \cup T by Proposition 3.21 . As xx was arbitrary, SSTS \subset S \cup T, and the argument for TT is the same.

Definition 3.33 (Disjoint).

Two sets AA and BB are disjoint if AB=A \cap B = \emptyset.

Remark.

Being disjoint is not the same as being distinct. The sets {1,2,3}\{1, 2, 3\} and {2,3,4}\{2, 3, 4\} are distinct, since each holds an element the other does not, but they are not disjoint, since their intersection holds 22 and 33. Meanwhile \emptyset and \emptyset are disjoint but not distinct.

Problem 3.8.

Let SS be a set. What is SS \cap \emptyset?

Theorem 3.34 (Characterising the empty set).

Let LL be a set. The following are equivalent.

  1. LML \subset M for every set MM;
  2. ML=LM \cap L = L for every set MM;
  3. LL has no elements;
  4. ML=MM \cup L = M for every set MM.

Discussion.

Four statements would ordinarily need twelve implications, but a loop is enough: we prove the chain 1    2    3    4    11 \implies 2 \implies 3 \implies 4 \implies 1, and every statement then reaches every other by going round. Step 1    21 \implies 2 is an equality of sets, so it is two inclusions, one of which we already have from Proposition 3.32 . Step 2    32 \implies 3 has no object to point at, so it goes by contradiction, and the case M=M = \emptyset is what collapses it. Step 3    43 \implies 4 is again two inclusions, and the work is splitting the “or” in xMLx \in M \cup L, where the second alternative is ruled out by the hypothesis. Step 4    14 \implies 1 is a single inclusion, read off Proposition 3.32 and the hypothesis.

Proof.

1    21 \implies 2. Assume LML \subset M. We have MLLM \cap L \subset L by Proposition 3.32 . For the reverse inclusion take xLx \in L; then xMx \in M since LML \subset M, so xMx \in M and xLx \in L, which is xMLx \in M \cap L. Hence LMLL \subset M \cap L, and Proposition 3.29 gives ML=LM \cap L = L.

2    32 \implies 3. Suppose, to the contrary, that LL has an element xx. Taking M=M = \emptyset in the second statement gives L=L\emptyset \cap L = L. But nothing belongs to L\emptyset \cap L, since anything in it would lie in \emptyset and Axiom 3.1 forbids that, so L\emptyset \cap L has no elements and LL has none either. This contradicts xLx \in L.

3    43 \implies 4. Assume LL has no elements. We have MMLM \subset M \cup L by Proposition 3.32 . For the reverse inclusion take xMLx \in M \cup L; by Proposition 3.21 either xMx \in M or xLx \in L, and the second is impossible, so xMx \in M. Hence MLMM \cup L \subset M, and Proposition 3.29 gives ML=MM \cup L = M.

4    14 \implies 1. Let MM be a set. We have LMLL \subset M \cup L by Proposition 3.32 , and ML=MM \cup L = M by the fourth statement, so LML \subset M by substitution.

Complements of Sets

If ASA \subset S, the complement of AA in SS is the set of all elements of SS that are not in AA.

Definition 3.35 (Complement).

Let ASA \subset S. The complement of AA in SS is the set

A  =def  {xSxA},\overline{A} \;\defeq\; \{x \in S \mid x \notin A\},

so that for xx ranging over SS, (xA)¬(xA)(x \in \overline{A}) \equiv \neg(x \in A).

Other texts write AcA^{c}, but we will stick with A\overline{A}. Notice that a complement means nothing until the ambient set SS is understood.

The complement removes one set from another only when the first lies inside the second. Dropping that assumption gives the difference of two arbitrary sets.

Definition 3.36 (Set difference).

For sets AA and BB, the difference ABA \setminus B is the set of elements of AA that are not in BB,

AB  =def  {xAxB},A \setminus B \;\defeq\; \{x \in A \mid x \notin B\},

with membership (xAB)(xA)¬(xB)(x \in A \setminus B) \equiv (x \in A) \land \neg(x \in B). The complement A\overline{A} is the difference SAS \setminus A in the case ASA \subset S.

Example 3.37.

{1,2,3,4}{2,4,6}={1,3}\{1, 2, 3, 4\} \setminus \{2, 4, 6\} = \{1, 3\}. The set being removed need not sit inside the set it is removed from; the elements the two do not share are simply ignored.

Problem 3.9.

With complements taken in SS, what are S\overline{S}, \overline{\emptyset} and A\overline{\overline{A}}? Name the logic law behind the last one.

Complements breed negative statements like xAx \notin A, and the standard tool for proving those is proof by contradiction: to show a statement true, assume its negation and derive a contradiction; the contradiction cannot stand, so the assumption was false and the statement we wanted holds.

Proposition 3.38 (Complements reverse inclusion).

Let A,BSA, B \subset S. If ABA \subset B, then BA\overline{B} \subset \overline{A}.

Discussion.

The conclusion is a universally quantified implication, so we take xBx \in \overline{B} and must reach xAx \in \overline{A}. Both memberships are negative statements by the definition of the complement, so what has to be shown is xAx \notin A from xBx \notin B, and that is the contrapositive of the implication ABA \subset B hands us. Elementwise the same step is a contradiction: assume xAx \in A, push it through ABA \subset B to xBx \in B, and collide with xBx \notin B.

Proof (element style).

Let xBx \in \overline{B}, so xSx \in S and xBx \notin B. Suppose xAx \in A. Then ABA \subset B gives xBx \in B, contradicting xBx \notin B, so xAx \notin A. Since xSx \in S, this is xAx \in \overline{A}. As xx was arbitrary, BA\overline{B} \subset \overline{A}.

Proof (logical style).

For any xx in SS,

xB¬(xB)by the complement    ¬(xA)by contraposition, since ABxAby the complement\begin{aligned} x \in \overline{B} &\equiv \neg(x \in B) && \text{by the complement} \\ &\implies \neg(x \in A) && \text{by contraposition, since } A \subset B \\ &\equiv x \in \overline{A} && \text{by the complement} \end{aligned}

so (xB)    (xA)(x \in \overline{B}) \implies (x \in \overline{A}) for every xx in SS, which is BA\overline{B} \subset \overline{A}.

Problem 3.10.

Let ASA \subset S, with complements taken in SS. Prove that AA=A \cap \overline{A} = \emptyset and AA=SA \cup \overline{A} = S.

Remark (The dictionary).

By now a dictionary has emerged: complement is ¬\neg, intersection is \land, union is \lor, subset is     \implies, and equality is     \iff. Any equivalence built from ¬\neg, \land and \lor alone translates through it into an identity of sets, so the table of laws in the first chapter doubles as a table of set identities.

Before taking complements of combinations we should check they may be taken at all. If SS and TT are subsets of XX, then so are STS \cup T and STS \cap T: an element of STS \cup T lies in SS or in TT and so in XX either way, and STSXS \cap T \subset S \subset X by Proposition 3.32 and Proposition 3.28 . Complements of both are therefore defined in XX.

Feeding De Morgan’s laws through the dictionary produces their set-theoretic form: the complement bar breaks over \cap and \cup, swapping one for the other.

Theorem 3.39 (De Morgan's laws for sets).

Let SS and TT be subsets of an ambient set. Then

ST=STandST=ST.\overline{S \cup T} = \overline{S} \cap \overline{T} \qquad\text{and}\qquad \overline{S \cap T} = \overline{S} \cup \overline{T}.

Discussion.

We prove the first; the second is identical work with the roles exchanged. Equality of sets is two inclusions by Proposition 3.29 , and both read the same way through the dictionary. For xx in the ambient set, membership in ST\overline{S \cup T} is the negation of the disjunction (xS)(xT)(x \in S) \lor (x \in T); the disjunctive De Morgan law rewrites that negation as the conjunction ¬(xS)¬(xT)\neg(x \in S) \land \neg(x \in T), which by the definitions of complement and intersection is membership in ST\overline{S} \cap \overline{T}. Each inclusion is one half of this biconditional, and the logical proof writes the whole equivalence down at once.

Proof (element style).

For the first inclusion, assume xSTx \in \overline{S \cup T}, so xSTx \notin S \cup T by the definition of the complement: it is not true that xSx \in S or xTx \in T. By De Morgan’s laws this means xSx \notin S and xTx \notin T, that is, xSx \in \overline{S} and xTx \in \overline{T}. Belonging to both, xx belongs to their intersection, so xSTx \in \overline{S} \cap \overline{T} and STST\overline{S \cup T} \subset \overline{S} \cap \overline{T}.

For the second inclusion, assume xSTx \in \overline{S} \cap \overline{T}, so xSx \in \overline{S} and xTx \in \overline{T}, meaning xSx \notin S and xTx \notin T. By De Morgan’s laws again, ”xSx \in S or xTx \in T” is false, so xSTx \notin S \cup T by Proposition 3.21 , and hence xSTx \in \overline{S \cup T}. Thus STST\overline{S} \cap \overline{T} \subset \overline{S \cup T}, and the two inclusions give the equality.

Proof (logical style).

For any xx in the ambient set,

xST¬(xST)by the complement¬((xS)(xT))by the union¬(xS)¬(xT)by De Morgan’s laws(xS)(xT)by the complementxSTby the intersection\begin{aligned} x \in \overline{S \cup T} &\equiv \neg(x \in S \cup T) && \text{by the complement} \\ &\equiv \neg\bigl((x \in S) \lor (x \in T)\bigr) && \text{by the union} \\ &\equiv \neg(x \in S) \land \neg(x \in T) && \text{by De Morgan's laws} \\ &\equiv (x \in \overline{S}) \land (x \in \overline{T}) && \text{by the complement} \\ &\equiv x \in \overline{S} \cap \overline{T} && \text{by the intersection} \end{aligned}

The biconditional holds for every xx, so Axiom 3.3 gives ST=ST\overline{S \cup T} = \overline{S} \cap \overline{T}.

The set law is the logic law read through the dictionary, and the logical proof is barely more than the act of reading it.

The Distributive Laws

De Morgan’s laws show union and intersection entangled through the complement; they also interact directly, one applied to the output of the other. The pattern is distribution, as with numbers, though sets are more even-handed about it: multiplication distributes over addition but not the other way round, while here each operation distributes over the other.

Theorem 3.40 (Distributive laws for sets).

Let SS, TT and RR be sets. Then

S(TR)=(ST)(SR)andS(TR)=(ST)(SR).S \cup (T \cap R) = (S \cup T) \cap (S \cup R) \qquad\text{and}\qquad S \cap (T \cup R) = (S \cap T) \cup (S \cap R).

Discussion.

We prove the first. It is an equality of sets, so two inclusions. For S(TR)(ST)(SR)S \cup (T \cap R) \subset (S \cup T) \cap (S \cup R) we assume xS(TR)x \in S \cup (T \cap R); a union assumption is an “or”, so we split into the cases xSx \in S and xTRx \in T \cap R, and in each we must put xx in both STS \cup T and SRS \cup R. For the reverse inclusion we assume x(ST)(SR)x \in (S \cup T) \cap (S \cup R), which hands us two “or” statements at once; the clean way through is to split on whether xSx \in S, since if not, each “or” is forced to its other option. The logical proof needs only the axiom of Distributivity applied to the membership predicates.

Proof (element style).

For the first inclusion, assume xS(TR)x \in S \cup (T \cap R), so xSx \in S or xTRx \in T \cap R. If xSx \in S, then xSTx \in S \cup T and xSRx \in S \cup R, so xx lies in their intersection. If instead xTRx \in T \cap R, then xTx \in T and xRx \in R; the first puts xx in STS \cup T, the second puts xx in SRS \cup R, and again xx lies in the intersection. Either case gives x(ST)(SR)x \in (S \cup T) \cap (S \cup R), so S(TR)(ST)(SR)S \cup (T \cap R) \subset (S \cup T) \cap (S \cup R).

For the second inclusion, assume x(ST)(SR)x \in (S \cup T) \cap (S \cup R), so xSTx \in S \cup T and xSRx \in S \cup R; that is, xSx \in S or xTx \in T, and at the same time xSx \in S or xRx \in R. If xSx \in S, then xS(TR)x \in S \cup (T \cap R) and we are done. If xSx \notin S, then the first “or” forces xTx \in T and the second forces xRx \in R, so xTRx \in T \cap R and again xS(TR)x \in S \cup (T \cap R). Either way (ST)(SR)S(TR)(S \cup T) \cap (S \cup R) \subset S \cup (T \cap R), and with both inclusions the sets are equal.

Proof (logical style).

Let xx be an object and write ss, tt, rr for the propositions xSx \in S, xTx \in T, xRx \in R.

xS(TR)s(tr)by the definitions(st)(sr)by Distributivity(xST)(xSR)by the unionx(ST)(SR)by the intersection\begin{aligned} x \in S \cup (T \cap R) &\equiv s \lor (t \land r) && \text{by the definitions} \\ &\equiv (s \lor t) \land (s \lor r) && \text{by Distributivity} \\ &\equiv (x \in S \cup T) \land (x \in S \cup R) && \text{by the union} \\ &\equiv x \in (S \cup T) \cap (S \cup R) && \text{by the intersection} \end{aligned}

By Axiom 3.3 we have the equality.

The comparison is a habit by now: the elementwise proof of the second inclusion needed a small idea, splitting on whether xSx \in S, while the logical proof needed no ideas at all, only the table.

Theorem 3.41 (The algebra of intersection).

Let AA, BB and CC be sets. Then

  1. AA=AA \cap A = A;
  2. AB=BAA \cap B = B \cap A;
  3. (AB)C=A(BC)(A \cap B) \cap C = A \cap (B \cap C);
  4. A(AB)=AA \cap (A \cup B) = A and A(AB)=AA \cup (A \cap B) = A;
  5. ABA \subset B if and only if AB=AA \cap B = A if and only if AB=BA \cup B = B.

Discussion.

The union halves of the first three are Proposition 3.23 , and these are the same rows of the table read with \land in place of \lor: idempotence, commutativity and associativity are the logic laws of those names, and each is one chain of equivalences. The fourth mixes the two operations, and is absorption. The fifth is different in kind, since it is not an identity but a comparison: the equivalences xAB    xAx \in A \cap B \iff x \in A and xAB    xBx \in A \cup B \iff x \in B each say exactly that xAx \in A implies xBx \in B, so we check it elementwise, with two inclusions inside each of the two biconditionals.

Proof (logical style).

Let xx be an object and write aa, bb, cc for the propositions xAx \in A, xBx \in B, xCx \in C.

xAAaaxAby IdempotencexABabbaxBAby Commutativityx(AB)C(ab)ca(bc)xA(BC)by AssociativityxA(AB)a(ab)xAby AbsorptionxA(AB)a(ab)xAby Absorption\begin{aligned} x \in A \cap A &\equiv a \land a \equiv x \in A && \text{by Idempotence} \\ x \in A \cap B &\equiv a \land b \equiv b \land a \equiv x \in B \cap A && \text{by Commutativity} \\ x \in (A \cap B) \cap C &\equiv (a \land b) \land c \\ &\equiv a \land (b \land c) \equiv x \in A \cap (B \cap C) && \text{by Associativity} \\ x \in A \cap (A \cup B) &\equiv a \land (a \lor b) \equiv x \in A && \text{by Absorption} \\ x \in A \cup (A \cap B) &\equiv a \lor (a \land b) \equiv x \in A && \text{by Absorption} \end{aligned}

Each chain is a biconditional for every xx, so Axiom 3.3 gives the corresponding equalities.

Proof (element style).

For the fifth part, suppose first that AB=AA \cap B = A. Since ABBA \cap B \subset B by Proposition 3.32 , we get ABA \subset B. Conversely, suppose ABA \subset B. We have ABAA \cap B \subset A by Proposition 3.32 , and if xAx \in A then xBx \in B, so xABx \in A \cap B; hence AABA \subset A \cap B, and Proposition 3.29 gives AB=AA \cap B = A.

For the other equivalence, suppose AB=BA \cup B = B. Then AAB=BA \subset A \cup B = B by Proposition 3.32 and substitution. Conversely, suppose ABA \subset B. We have BABB \subset A \cup B by Proposition 3.32 , and if xABx \in A \cup B then xAx \in A or xBx \in B, and in either case xBx \in B; hence ABBA \cup B \subset B, and Proposition 3.29 gives AB=BA \cup B = B. Both equivalences hold, so the three statements are equivalent.

Remark.

These identities, together with the complement laws, are what it means to say that the subsets of a fixed ambient set form a boolean algebra: the same structure the connectives ¬\neg, \land and \lor were shown to have in the first chapter, met a second time with sets in place of propositions.

Power Sets

Sets collect objects, and nothing forbids those objects from being sets themselves: here we collect all the subsets of one set into a single set, a construction we will meet far more often than its modest definition suggests.

Collecting the subsets of AA is not a case of comprehension, since it does not carve out of a set already in hand: the subsets of AA are not among the elements of AA, and there is no larger set on the table to cut them from. So the set has to be supplied.

Axiom 3.42 (Power set).

For every set SS there exists a set whose elements are exactly the subsets of SS: for all sets XX, SPX(XP    XS)\forall S\,\exists P\,\forall X\,(X \in P \iff X \subset S).

Definition 3.43 (Power set).

Let AA be a set. The power set of AA, written P(A)\mathcal{P}(A), is the unique set whose elements are exactly the subsets of AA: for every set XX, XP(A)    XAX \in \mathcal{P}(A) \iff X \subset A. We also write it {XXA}\{X \mid X \subset A\}.

Remark.

That last notation is the unrestricted form we rejected earlier, and it is safe here only because the axiom has already produced the set. The braces are naming a set we hold; writing {XXA}\{X \mid X \subset A\} with no axiom behind it would lead us back to Russell.

Example 3.44.

Let A={a,b}A = \{a, b\} with aba \neq b. Then P(A)={,{a},{b},A}\mathcal{P}(A) = \bigl\{\emptyset, \{a\}, \{b\}, A\bigr\}. The elements of P(A)\mathcal{P}(A) are sets, so we write {a}P(A)\{a\} \in \mathcal{P}(A) because {a}A\{a\} \subset A, while aP(A)a \in \mathcal{P}(A) is simply false.

Proposition 3.45 (Power set of the empty set).

P()={}\mathcal{P}(\emptyset) = \{\emptyset\}.

Discussion.

The claim is an equality of sets, so Proposition 3.29 lets us prove the two inclusions. For {}P()\{\emptyset\} \subset \mathcal{P}(\emptyset) it is enough to check that \emptyset is a member of the power set, which Definition 3.43 reduces to \emptyset \subset \emptyset. For the reverse inclusion we take an arbitrary XP()X \in \mathcal{P}(\emptyset); the same definition converts that membership into XX \subset \emptyset, and since the empty set is a subset of every set we have X\emptyset \subset X as well, so mutual inclusion forces X=X = \emptyset. The logical proof collapses the same chain into biconditionals: membership in the power set is the subset relation, which against \emptyset is equality with \emptyset, which is membership in {}\{\emptyset\}.

Proof (element style).

(    \implies) Since \emptyset \subset \emptyset, Definition 3.43 gives P()\emptyset \in \mathcal{P}(\emptyset), and hence {}P()\{\emptyset\} \subset \mathcal{P}(\emptyset).

(    \impliedby) Conversely, let XP()X \in \mathcal{P}(\emptyset). Then XX \subset \emptyset, and since X\emptyset \subset X as well, Proposition 3.29 gives X=X = \emptyset, so X{}X \in \{\emptyset\}. Thus P(){}\mathcal{P}(\emptyset) \subset \{\emptyset\}, and the two inclusions give the equality.

Proof (logical style).

For every set XX,

XP()Xby the power setX=since XX{}by the singleton criterion\begin{aligned} X \in \mathcal{P}(\emptyset) &\equiv X \subset \emptyset && \text{by the power set} \\ &\equiv X = \emptyset && \text{since } \emptyset \subset X \\ &\equiv X \in \{\emptyset\} && \text{by the singleton criterion} \end{aligned}

The biconditional holds for every XX, so Axiom 3.3 gives P()={}\mathcal{P}(\emptyset) = \{\emptyset\}.

Theorem 3.46 (Power-set laws).

Let AA and BB be sets. Then

  1. {,A}P(A)\{\emptyset, A\} \subset \mathcal{P}(A);
  2. ABA \subset B if and only if P(A)P(B)\mathcal{P}(A) \subset \mathcal{P}(B);
  3. P(A)P(B)P(AB)\mathcal{P}(A) \cup \mathcal{P}(B) \subset \mathcal{P}(A \cup B);
  4. P(A)P(B)=P(AB)\mathcal{P}(A) \cap \mathcal{P}(B) = \mathcal{P}(A \cap B).

Discussion.

Every claim reduces to Definition 3.43 : a set belongs to a power set exactly when it is a subset of the set in question. The first is immediate from A\emptyset \subset A and AAA \subset A. The second is a biconditional, so it splits: forwards, an XP(A)X \in \mathcal{P}(A) has XAX \subset A and ABA \subset B, and Proposition 3.28 chains them; backwards, the first part puts AA itself into P(A)\mathcal{P}(A), so an inclusion of power sets hands us AP(B)A \in \mathcal{P}(B), which is ABA \subset B read back through the definition. The third is one inclusion only, since a subset of AA or of BB is a subset of ABA \cup B either way, and the reverse fails in general, as the example after the proof shows. The fourth is an equality, so both inclusions, and it holds because being a subset of both AA and BB is the same thing as being a subset of ABA \cap B.

Proof.

For the first claim, A\emptyset \subset A and AAA \subset A, so P(A)\emptyset \in \mathcal{P}(A) and AP(A)A \in \mathcal{P}(A) by Definition 3.43 , and therefore {,A}P(A)\{\emptyset, A\} \subset \mathcal{P}(A).

For the second, suppose ABA \subset B and take XP(A)X \in \mathcal{P}(A). Then XAX \subset A, and with ABA \subset B this gives XBX \subset B by Proposition 3.28 , so XP(B)X \in \mathcal{P}(B). Hence P(A)P(B)\mathcal{P}(A) \subset \mathcal{P}(B). Conversely, suppose P(A)P(B)\mathcal{P}(A) \subset \mathcal{P}(B). The first claim gives AP(A)A \in \mathcal{P}(A), so AP(B)A \in \mathcal{P}(B) and therefore ABA \subset B.

For the third, let XP(A)P(B)X \in \mathcal{P}(A) \cup \mathcal{P}(B), so XP(A)X \in \mathcal{P}(A) or XP(B)X \in \mathcal{P}(B) by Proposition 3.21 . If XP(A)X \in \mathcal{P}(A) then XAX \subset A, and every element of XX then lies in AA and so in ABA \cup B; if XP(B)X \in \mathcal{P}(B) the same argument runs through BB. Either case gives XABX \subset A \cup B, that is, XP(AB)X \in \mathcal{P}(A \cup B).

For the fourth, let XP(A)P(B)X \in \mathcal{P}(A) \cap \mathcal{P}(B). Then XAX \subset A and XBX \subset B, so every element of XX lies in AA and in BB, hence in ABA \cap B. Thus XABX \subset A \cap B and XP(AB)X \in \mathcal{P}(A \cap B). Conversely, let XP(AB)X \in \mathcal{P}(A \cap B). Every element of XX lies in ABA \cap B and so lies in AA, and equally in BB, giving XAX \subset A and XBX \subset B. Hence XX belongs to both P(A)\mathcal{P}(A) and P(B)\mathcal{P}(B), and therefore to their intersection.

Example 3.47.

The inclusion in the third claim really can be strict. Let A={a}A = \{a\} and B={b}B = \{b\} with aba \neq b. Then {a,b}AB\{a, b\} \subset A \cup B, so {a,b}P(AB)\{a, b\} \in \mathcal{P}(A \cup B), but {a,b}\{a, b\} is a subset of neither AA nor BB and so lies in neither P(A)\mathcal{P}(A) nor P(B)\mathcal{P}(B).

Problem 3.11.

Let AA be a set and let xx be an object with xAx \notin A. Describe P(A{x})\mathcal{P}(A \cup \{x\}) in terms of P(A)\mathcal{P}(A).

Problem 3.12.

Can P(A)P(B)\mathcal{P}(A) \setminus \mathcal{P}(B) ever be the power set of some set? Prove your answer.

Problem 3.13.

Find a necessary and sufficient condition on AA and BB for P(AB)=P(A)\mathcal{P}(A \setminus B) = \mathcal{P}(A), and prove that your condition works in both directions.

Replacement

Everything we have built so far either cuts a set down or pools sets together. Nothing we have assumed lets us take a set and change what is in it. Suppose we hold {3,5,9}\{3, 5, 9\} and want the set holding one more than each of those, {4,6,10}\{4, 6, 10\}: comprehension carves out of a set we are holding, and none of 44, 66, 1010 lies in {3,5,9}\{3, 5, 9\}, so there is nothing to carve them from. The axiom below closes that gap by letting a statement pair each element with its replacement.

Axiom 3.48 (Replacement).

Let AA be a set, and let P(x,y)P(x, y) be a statement about an object xAx \in A and an object yy such that for each xAx \in A there is at most one yy making P(x,y)P(x, y) true. Then there exists a set BB whose elements are exactly those partners: for any object zz,

zB    P(x,z) for some xA.z \in B \iff P(x, z) \text{ for some } x \in A.

The condition that each xx have at most one partner is what keeps the axiom honest. A statement free to pair one xx with many yy could sweep in everything in sight, and we would be back with the unrestricted notation and its paradox; tying each element to a single partner means every object in the new set is the partner of something in AA, so nothing enters that AA did not put there.

Example 3.49.

Take A={3,5,9}A = \{3, 5, 9\} and let P(x,y)P(x, y) be the statement y=x+1y = x + 1. Each xx in AA has exactly one partner, so the axiom applies, and the set it hands back is {4,6,10}\{4, 6, 10\}.

Example 3.50.

Take A={3,5,9}A = \{3, 5, 9\} again, and let P(x,y)P(x, y) be the statement y=1y = 1. Each xx in AA still has exactly one partner, but it is the same partner every time, so the set produced is {1}\{1\}. The axiom may return something smaller than what we started with, since nothing forces distinct elements to have distinct partners.

Axiom 3.3 makes that BB unique, so we may name it, and we write it {y:P(x,y) for some xA}\{y : P(x, y) \text{ for some } x \in A\}. As with the power set, those braces carry no carving set and are safe for the same reason: the axiom produced the set before the notation named it. When the partner of xx is written f(x)f(x) we abbreviate further, to {f(x):xA}\{f(x) : x \in A\} or {f(x)xA}\{f(x) \mid x \in A\}.

We promised at the outset that our axioms would be overcomplete.

Proposition 3.51 (Comprehension from replacement).

Let AA be a set and QQ a predicate. Then replacement alone produces a set whose elements are exactly the elements of AA for which QQ holds.

Discussion.

Replacement builds a set by transforming elements, while comprehension builds one by selecting them, so the work is to make a transformation do the selecting. We transform each element into itself, and only when QQ holds of it: the statement P(x,y)P(x, y) saying ”x=yx = y and Q(x)Q(x)” pairs an element satisfying QQ with itself and leaves an element failing QQ with no partner at all. The at-most-one condition is then met for a reason worth noticing, since some elements have no partner rather than one, and the set of partners is exactly the set of elements we wanted to keep.

Proof.

Let P(x,y)P(x, y) be the statement ”x=yx = y and Q(x)Q(x)”, and let xAx \in A. If Q(x)Q(x) holds, the only yy with P(x,y)P(x, y) is xx itself; if Q(x)Q(x) fails, no yy satisfies P(x,y)P(x, y). Either way there is at most one such yy, so Axiom 3.48 applies and produces a set BB with zBz \in B exactly when P(x,z)P(x, z) holds for some xAx \in A.

Suppose zBz \in B. Then some xAx \in A has x=zx = z and Q(x)Q(x), so zAz \in A by substitution, and Q(z)Q(z) likewise. Conversely, if zAz \in A and Q(z)Q(z), then x=zx = z is itself a witness, so zBz \in B. Hence zB    (zAQ(z))z \in B \iff (z \in A \land Q(z)) for every object zz, which is the criterion of {xAQ(x)}\{x \in A \mid Q(x)\}.

So Axiom 3.8 could have been left out. We keep it anyway, and that is an editorial choice rather than anything the proposition settles: the discussion of Russell’s paradox turned on carving into a set we already hold, and it is the axiom we reach for constantly. The two also combine, so to build {f(x):xA, P(x)}\{f(x) : x \in A,\ P(x)\} we first form {xAP(x)}\{x \in A \mid P(x)\} by comprehension and then apply replacement to it.

Remark.

Replacement is a schema, as comprehension is: one axiom for each statement PP, not a single statement quantifying over all of them.

Regularity (Optional)

Our set-builder notation was rejected for producing a set that could not exist. The damage runs further than that one set: unrestricted, the notation also hands us the collection of every object at once, and since sets are objects by Axiom 3.2 , such a collection would contain itself. A box holding itself is not something the picture we started from can draw.

The intuition that keeps this from happening is that objects come in stages. At the bottom sit the objects that are not sets at all, such as the number 3737. Above them sit the sets built only from those, like {3,4,7}\{3, 4, 7\} and \emptyset. Above those sit the sets built from everything so far, like {3,4,7,{3,4,7}}\{3, 4, 7, \{3, 4, 7\}\}, and so on upward. A box at any stage holds only boxes opened at earlier stages, so no box ever ends up inside itself.

Writing that hierarchy down properly is a good deal of work, and we will not do it. We take instead the one consequence of it we need.

Axiom 3.52 (Regularity).

If AA is a non-empty set, then at least one element of AA is either not a set, or is disjoint from AA.

Read against the hierarchy, the axiom says that some element of AA sits low enough to hold none of the others. It asks this of one element only, not of all of them.

Example 3.53.

Let A={{3,4}, {3,4,{3,4}}}A = \bigl\{\{3, 4\},\ \{3, 4, \{3, 4\}\}\bigr\}. Its first element {3,4}\{3, 4\} holds neither of the elements of AA, since neither 33 nor 44 lies in AA, so it is disjoint from AA and the axiom is satisfied. The second element sits a stage higher and does hold an element of AA, namely {3,4}\{3, 4\}, which the axiom permits.

Problem 3.14.

Show that the unrestricted notation of the set-builder section, had we assumed it rather than rejected it, would imply Axiom 3.8 , Axiom 3.14 , Axiom 3.18 , Axiom 3.42 and Axiom 3.48 , and would therefore have spared us most of this chapter.

Problem 3.15.

Use regularity, together with Axiom 3.14 , to show that AAA \notin A for every set AA. Show further that for any two sets AA and BB, either ABA \notin B or BAB \notin A, or both.

Problem 3.16.

Show, assuming the other axioms, that the unrestricted notation is equivalent to postulating a set Ω\Omega containing every object: if the notation is permitted then such an Ω\Omega exists, and if such an Ω\Omega exists then the notation is legitimate.

The second problem is worth a second look once it is done. It says that for any set AA there is always an object outside AA, namely AA itself, so we may always add one more element and form the larger set A{A}A \cup \{A\}. It also gives a second route to Proposition 3.13 , since a set Ω\Omega holding every object would hold itself, which regularity forbids. We proved that proposition from comprehension alone, so the two arguments lean on nothing in common.

Remark.

One may fairly ask whether we need this axiom, since it is less intuitive than the others. For analysis we do not: the sets we meet are all low in the hierarchy, sets of ordinary objects or sets of those, and nothing later in these notes depends on regularity. It matters for set theory pursued for its own sake, and we state it here so the list is complete.

Exercises

 

Answers are checked in your browser, as often as you like. Nothing is sent anywhere and nothing is kept but your own work. A formula may be written with the symbols themselves or with ~ & | -> <-> ^, and \and, \or, \to expand as you type.

Exercise 3.1.

Each construction below is licensed by exactly one axiom. Name it.

From two objects xx and yy, the set {x,y}\{x, y\}.

answer one of these

From a set AA and a predicate PP, the set of those elements of AA satisfying PP.

answer one of these

That {2,3}\{2, 3\} and {3,2,2}\{3, 2, 2\} are one and the same set.

answer one of these

From a set SS whose elements are sets, the set of every object belonging to one of them.

answer one of these

Exercise 3.2.

Set-builder notation, and the restriction that makes it safe.

The statement y{xAP(x)}y \in \{x \in A \mid P(x)\} says exactly:

answer one of these

The set {xAx=x}\{x \in A \mid x = x\} is:

answer one of these

Let AA be any set and put R={xAxx}R = \{x \in A \mid x \notin x\}, which comprehension makes a set. Running Russell’s argument on RR now establishes:

answer one of these

Exercise 3.3.

Let S={1,2,3}S = \{1, 2, 3\} and T={3,4}T = \{3, 4\}, with complements taken in X={1,2,3,4,5}X = \{1, 2, 3, 4, 5\}.

STS \setminus T is:

answer one of these

ST\overline{S \cup T} is:

answer one of these

{S,T}\bigcup \{S, T\} is:

answer one of these

Exercise 3.4.

Write ss, tt and rr for the statements xSx \in S, xTx \in T and xRx \in R, with xx ranging over an ambient set containing all three. Give the membership condition of each set below.

ST\overline{S \cap T}

answer formula

S(TR)S \setminus (T \cup R)

answer formula

(ST)(TS)(S \setminus T) \cup (T \setminus S), written with \oplus and nothing else.

answer formula

Exercise 3.5.

An identity of sets fails as soon as one object falls on different sides of it, so a counterexample is a choice of which of the sets that object lies in. Write aa, bb, cc for xAx \in A, xBx \in B, xCx \in C, and place one xx in each case.

(AB)C(A \setminus B) \setminus C against A(BC)A \setminus (B \setminus C).

answer assignment
a b c

A(BC)A \cup (B \cap C) against (AB)C(A \cup B) \cap C.

answer assignment
a b c

Exercise 3.6.

Power sets, counted.

For distinct aa, bb, cc, the set P({a,b,c})\mathcal{P}(\{a, b, c\}) has how many elements?

answer one of these

P({})\mathcal{P}(\{\emptyset\}) is:

answer one of these

And P(P(P()))\mathcal{P}\bigl(\mathcal{P}(\mathcal{P}(\emptyset))\bigr) has how many elements?

answer one of these

Exercise 3.7.

Replacement, and the condition it imposes.

Take A={1,2,3}A = \{1, 2, 3\} and let P(x,y)P(x, y) be the statement y={x}y = \{x\}. The set replacement returns is:

answer one of these

Which of these statements does replacement refuse?

answer one of these

Exercise 3.8.

For sets AA and BB, the symmetric difference is

AB  =def  (AB)(BA),A \oplus B \;\defeq\; (A \setminus B) \cup (B \setminus A),

the set of objects belonging to exactly one of the two.

An object lies in (AB)C(A \oplus B) \oplus C exactly when it belongs to:

answer one of these

Write that condition in aa, bb, cc. Spelling the four cases out with \land, \lor and ¬\neg counts, and so does the short answer, which uses \oplus and one pair of brackets and nothing else. Then try the other bracketing of that short answer, and say what the two verdicts together tell you about A(BC)A \oplus (B \oplus C).

answer formula

Exercise 3.9.

Each condition below holds for some pairs of sets and not others. Say for which.

AB=A \cup B = \emptyset:

answer one of these

AB=AA \setminus B = A:

answer one of these

AB=ABA \cup B = A \cap B:

answer one of these

Exercises in Lean

 

The proofs below are checked in your browser. Nothing is sent anywhere, and nothing is stored but your own work. Type \to for →, \and for ∧, \< and \> for ⟨ ⟩.

The last two sheets were about statements. This one is about objects, and about the sets that hold them.

The editor has one type, Obj, and its terms are the objects of this chapter. Sets are objects too by Axiom 3.2 , so a set and its elements are terms of that same type, and x ∈ A is a statement about any two of them. Nothing marks off the objects that are sets from those that are not, and every exercise below is about sets.

The notation is typed with the backslash abbreviations: \in for ∈, \nin for ∉, \sub for ⊆, \cup for ∪, \cap for ∩, \emptyset for ∅ and \powerset for 𝒫. The difference A \ B is a plain backslash.

Inclusion

An inclusion is not a new kind of statement. A ⊆ B is ∀ x, x ∈ A → x ∈ B written short, so it is proved the way an implication is, by intro, and used the way an implication is, by applying it: with h : A ⊆ B and hx : x ∈ A, the term h x hx proves x ∈ B. A goal ∀ x, p x behaves the same way, intro x fixing an arbitrary x and leaving p x.

Example.

An inclusion applied to an object and to a proof that the object lies in the smaller set.

lean worked
1example (A B : Obj) (h : A  B) (x : Obj) (hx : x  A) : x  B := by
verified
goalGoals accomplished.

The operations are nothing more than their membership criteria. x ∈ A ∪ B is the disjunction x ∈ A ∨ x ∈ B, not merely equivalent to it, so left, right and rcases work on a membership in a union as they do on any disjunction. x ∈ A ∩ B is the conjunction x ∈ A ∧ x ∈ B, so ⟨_, _⟩ builds one and .left and .right take one apart.

Example.

The first intro fixes the object, the second assumes it lies in AA.

lean worked
1example (A B : Obj) : A  A  B := by
verified
goalGoals accomplished.

Example.

Half of a conjunction, reached through the criterion for the intersection.

lean worked
1example (A B : Obj) : A  B  A := by
verified
goalGoals accomplished.

Exercise 3.10.

Both criteria at once: take the conjunction apart, then choose a side of the disjunction.

lean proof
1example (A B : Obj) : A  B  A  B := by
goalA B : Obj A B A B

Exercise 3.11.

Subsets are transitive.

lean proof
1example (A B C : Obj) : A  B  B  C  A  C := by
goalA B C : Obj A B B C A C

Exercise 3.12.

A set containing both AA and BB contains their union.

lean proof
1example (A B C : Obj) : A  C  B  C  A  B  C := by
goalA B C : Obj A C B C A B C

Exercise 3.13.

And a set contained in both is contained in their intersection.

lean proof
1example (A B C : Obj) : C  A  C  B  C  A  B := by
goalA B C : Obj C A C B C A B

Equality

Two sets are equal when they have the same elements, and Set.ext is that axiom: handed ∀ x, x ∈ A ↔ x ∈ B it returns A = B. So apply Set.ext turns a goal A = B into that biconditional, intro x fixes the object, and constructor splits the biconditional into its two directions.

Example.

Idempotence of the intersection, which is idempotence of \land underneath.

lean worked
1example (A : Obj) : A  A = A := by
verified
goalGoals accomplished.

Mutual inclusion says the same thing, and Set.subset_antisymm is Proposition 3.29 . Applying it leaves the two inclusions as separate goals, which is often the shorter road, since neither of them mentions the biconditional.

Example.

Absorption. The harder inclusion splits on the union; the other one is a line.

lean worked
1example (A B : Obj) : A  (A  B) = A := by
verified
goalGoals accomplished.

have

A proof that needs a step of its own records it with have. Writing have h : p := … adds h : p to the context, and what follows := is either a term or by with a block indented under it.

Example.

The intermediate membership is named, and then taken apart.

lean worked
1example (A B C : Obj) (h : A  B  C) (x : Obj) (hx : x  A) : x  C := by
verified
goalGoals accomplished.

Exercise 3.14.

The order of a union carries no information.

lean proof
1example (A B : Obj) : A  B = B  A := by
goalA B : Obj A B = B A

Exercise 3.15.

The distributive law left unproved in Theorem 3.40 .

lean proof
1example (A B C : Obj) : A  (B  C) = (A  B)  (A  C) := by
goalA B C : Obj A (B C) = A B A C

Difference

x ∈ A \ B is x ∈ A ∧ ¬(x ∈ B), a conjunction whose right half is a negation, which is to say a function into False.

Example.

The negative half, taken out of the conjunction.

lean worked
1example (A B x : Obj) (h : x  A \ B) : x  B := by
verified
goalGoals accomplished.

And x ∈ ∅ is False itself. There is nothing to do with such a hypothesis but close the branch, which h.elim does, proving whatever the goal happens to be.

Example.

Nothing lies in the empty set, so this branch never arises.

lean worked
1example (A x : Obj) (h : x  ) : x  A := by
verified
goalGoals accomplished.

Exercise 3.16.

Taking AA out of BB first costs the union nothing.

lean proof
1example (A B : Obj) : A  (B \ A) = A  B := by
goalA B : Obj A B \ A = A B

Exercise 3.17.

De Morgan’s second law, with the complement written as a difference.

lean proof
1example (A B C : Obj) : A \ (B  C) = (A \ B)  (A \ C) := by
goalA B C : Obj A \ (B C) = A \ B A \ C

Exercise 3.18.

Its companion.

lean proof
1example (A B C : Obj) : A \ (B  C) = (A \ B)  (A \ C) := by
goalA B C : Obj A \ (B C) = (A \ B) (A \ C)

Symmetric difference

For sets AA and BB, the symmetric difference ABA \oplus B is (AB)(BA)(A \setminus B) \cup (B \setminus A), the set of objects belonging to exactly one of the two. The editor has no notation for it, so the statements below carry it written out.

An equation between sets is used with rw: from h : A = B, rw [h] replaces AA by BB in the goal, and rw [h] at k does it inside the hypothesis k.

Example.

Substitution, which is what an equation is for.

lean worked
1example (A B x : Obj) (h : A = B) (hx : x  A) : x  B := by
verified
goalGoals accomplished.

Exercise 3.19.

AA=A \oplus A = \emptyset.

lean proof
1example (A : Obj) : (A \ A)  (A \ A) =  := by
goalA : Obj A \ A A \ A =

Exercise 3.20.

A=AA \oplus \emptyset = A.

lean proof
1example (A : Obj) : (A \ )  ( \ A) = A := by
goalA : Obj A \ \ A = A

Exercise 3.21.

(AB)(AB)=BA(A \oplus B) \setminus (A \setminus B) = B \setminus A.

lean proof
1example (A B : Obj) : ((A \ B)  (B \ A)) \ (A \ B) = B \ A := by
goalA B : Obj (A \ B B \ A) \ (A \ B) = B \ A

Exercise 3.22.

If ABA \oplus B is empty then AA and BB are the same set.

lean proof
1example (A B : Obj) : (A \ B)  (B \ A) =   A = B := by
goalA B : Obj A \ B B \ A = A = B

Power sets

X ∈ 𝒫 A is X ⊆ A, which is a again, so a membership in a power set opens with intro like any other inclusion.

Example.

Every set is a subset of itself, and so an element of its own power set.

lean worked
1example (A : Obj) : A  𝒫 A := by
verified
goalGoals accomplished.

Exercise 3.23.

Half of Theorem 3.46 , part two.

lean proof
1example (A B : Obj) : A  B  𝒫 A  𝒫 B := by
goalA B : Obj A B 𝒫 A 𝒫 B

Exercise 3.24.

And part four of it.

lean proof
1example (A B : Obj) : 𝒫 (A  B) = 𝒫 A  𝒫 B := by
goalA B : Obj 𝒫 (A B) = 𝒫 A 𝒫 B

Exercise 3.25.

Since P()\mathcal{P}(\emptyset) is {}\{\emptyset\}, this is the inclusion P(AB)(P(A)P(B)){}\mathcal{P}(A \setminus B) \subset \bigl(\mathcal{P}(A) \setminus \mathcal{P}(B)\bigr) \cup \{\emptyset\}.

lean proof
1example (A B : Obj) : 𝒫 (A \ B)  (𝒫 A \ 𝒫 B)  𝒫  := by
goalA B : Obj 𝒫 (A \ B) 𝒫 A \ 𝒫 B 𝒫
What the checker understands

Tactics

intro h assume the hypothesis of an implication, naming it h
exact e give the proof outright
apply f reduce the goal to the hypotheses of f
assumption close the goal with a hypothesis already present
trivial close the goal True
exfalso replace the goal with False
by_contra h assume the negation of the goal
constructor split ∧ into both halves, or ↔ into both directions
left / right choose which half of a ∨ to prove
rcases h with a | b argue by cases on a disjunction
obtain a, b := h take a conjunction or an existential apart
cases h as above, keeping the name
refine e give the proof with holes left in it
have h : p := record an intermediate result
show p restate the goal in an equal form
use w give a witness for ∃
specialize h a instantiate a ∀ hypothesis
rw [h] rewrite with an equation, ← to go backwards
rfl both sides compute to the same thing
decide / norm_num settle a closed computation

Results you may cite

Classical.em (a : Prop), a ¬a — the law of excluded middle
Classical.byContradiction {a : Prop}, (¬a False) a — proof by contradiction; the tactic by_contra does this for you
Classical.byCases {a b : Prop}, (a b) (¬a b) b — split on whether a holds
not_not {a : Prop}, ¬¬a a — double negation
not_and_or {a b : Prop}, ¬(a b) ¬a ¬b — De Morgan
not_or {a b : Prop}, ¬(a b) ¬a ¬b — De Morgan
not_imp {a b : Prop}, ¬(a b) a ¬b
and_comm {a b : Prop}, a b b a
or_comm {a b : Prop}, a b b a
Set.ext {A B : Obj}, ( x : Obj, x A x B) A = B — extensionality: sets with the same elements are equal
Set.ext_iff {A B : Obj}, A = B ( x : Obj, x A x B) — extensionality and substitution, in one biconditional
Set.subset_antisymm {A B : Obj}, A B B A A = B — mutual inclusion is equality
Set.empty_subset {A : Obj}, A — the empty set is a subset of every set

From the logical core

And.intro {a b : Prop}, a b a b
And.left {a b : Prop}, a b a
And.right {a b : Prop}, a b b
And.symm {a b : Prop}, a b b a
Or.inl {a b : Prop}, a a b
Or.inr {a b : Prop}, b a b
Or.elim {a b c : Prop}, a b (a c) (b c) c
Or.symm {a b : Prop}, a b b a
Iff.intro {a b : Prop}, (a b) (b a) (a b)
Iff.mp {a b : Prop}, (a b) a b
Iff.mpr {a b : Prop}, (a b) b a
Iff.symm {a b : Prop}, (a b) (b a)
Iff.rfl {a : Prop}, a a
Iff.trans {a b c : Prop}, (a b) (b c) (a c)
True.intro True
False.elim {a : Prop}, False a
absurd {a b : Prop}, a ¬a b
id {a : Prop}, a a
mt {a b : Prop}, (a b) ¬b ¬a
Eq.refl {α : Type} (a : α), a = a
Eq.symm {α : Type} {a b : α}, a = b b = a
Eq.trans {α : Type} {a b c : α}, a = b b = c a = c
congrArg {α : Type} {β : Type} {a b : α} (f : α β), a = b f a = f b
Exists.intro {α : Type} {p : α Prop} (w : α), p w x : α, p x
Exists.elim {α : Type} {p : α Prop} {b : Prop}, ( x : α, p x) ( y : α, p y b) b