Mathematical Proof and the Principles of Mathematics/Sets/Classes

So far, the only set we've actually proved to exist is ∅. We'd like to continue on to build up more sets such as {∅},, {∅, {∅}} , etc., and define important set operations such as union and intersection. Informally, the way to do this is using formulas such as:
 * $$\{a\} = \{x: x=a\}$$
 * $$\{a, b\} = \{x: x=a \operatorname{or} x=b\}$$
 * $$a \cup b = \{x: x\in a \operatorname{or} x\in b\}$$

The empty set can be made to fit this pattern using
 * $$\varnothing = \{x: False\}$$

More generally, given a predicate P(x), we would like to use the formula
 * $$\{x: P(x)\}$$

To mean the set containing those x for which P(x) is true. As seen in the history section though, using any predicate you want for this willy-nilly leads to paradoxes. So every time the formula is used there must be a theorem which states that there is such a set and a theorem that says that such as set is unique. We'll need some machinery to streamline this process.

Classes
Although the notion of a class is not defined formally in Zermelo-Fraenkel set theory, it is worthwhile to define it informally since it is a useful concept. Specifically, if P(x) is a predicate, then define the class P to be
 * $$P=\{x: P(x)\}$$

Logically, a class $$P$$ is just a predicate $$P(x)$$ for which $$x \in P$$ is shorthand for $$P(x)$$. We informally think of a class as the collection of all sets that satisfy its defining formula.

Much of what can be said about sets applies to classes as well, as long as you remember that restrictions apply. For one thing a class can only appear on the right side of the ∈ symbol. Also, since classes aren't objects in our universe of discourse, they can't be used in quantifiers. Finally, the = symbol is only defined between sets. We can make a similar definition which applies to classes:
 * P=Q when for all x, P(x) iff Q(x)

But keep in mind that the Axiom of Substitution does not apply for this type of equality.

Example: If Q(x) denotes the predicate
 * not $$(x \in x)$$

then Q is the "set" which causes the problem with Russel's paradox. The paradox is avoided because the statement Q∈Q, which puts Q to the left of the ∈ symbol, cannot even be formed legally.

If a is a fixed set, then we can define the predicate A(x) to be
 * $$x \in a$$

Then the class A and the set a have the same elements, in other words:
 * $$(x \in A) \operatorname{iff}\ (x \in a)$$

In some sense you could say that A=a, but we're stepping on shaky ground here because A and a are different types; a is a set while A is technically still a predicate.

Collectivizing predicates
Contrary to what you might be thinking, this has nothing to do with early 20th century Soviet agriculture. A predicate $$P(x)$$ is called collectivizing when
 * For some $$y$$, for all $$x$$, $$x \in y$$ iff $$P(x)$$.

(This is an example of a second order predicate, meaning a predicate which applies to predicates rather than objects. Such things don't exist in the logic we've been using so far, but you can think if it as just shorthand for the phrase above.) In less formal language, $$P(x)$$ is collectivizing when there is a set $$y$$ whose elements are the $$x$$ for which $$P(x)$$ is True.

For example the predicate
 * For all $$y$$, not $$y \in x$$

is collectivizing since it holds for ∅. On the other hand
 * Not $$x \in x$$

can't be collectivizing because it would allow Russell's paradox discussed in the introduction to this chapter.

To see how this is useful, define the predicate $$Q(y)$$ to mean
 * For all $$x$$, $$x \in y$$ iff $$P(x)$$.

Then $$P(x)$$ is collectivizing is the same as the existence property for $$Q(y)$$. If, in addition, we have the uniqueness property then
 * The $$Y$$ for which $$Q(Y)$$

is well defined. To prove the uniqueness property, we need
 * For all $$y$$, $$z$$, $$Q(y)$$ and $$Q(z)$$ imply $$y=z$$.

Expanded, this is
 * Theorem SO1: For all $$y$$, $$z$$, if for all $$x$$, $$x \in y$$ iff $$P(x)$$ and for all $$x$$, $$x \in z$$ iff $$P(x)$$, then $$y=z$$.

This may seem complicated, but proving it isn't hard. We'll start an outline and leave the details to the reader.

Choose arbitrary $$b$$ and $$c$$, we must now prove that if for all $$x$$, $$x \in b$$ iff $$P(x)$$ and for all $$x$$, $$x \in c$$ iff $$P(x)$$, then $$b=c$$. Assume for all $$x$$, $$x \in b$$ iff $$P(x)$$ and for all $$x$$, $$x \in c$$ iff $$P(x)$$. So the new goal is to prove $$b=c$$. Axiom S4 says we can do this by showing $$b \subseteq c$$ and $$c \subseteq b$$. To prove $$b \subseteq c$$ we need to prove that for all x, $$x \in b$$ implies $$x \in c$$. But for arbitrary $$a$$ we have $$a \in b$$ iff $$P(a)$$ and $$P(a)$$ iff $$a \in c$$ so $$a \in b$$ implies $$a \in c$$ by Prop. 9 in the Logical equivalence section.

Defining sets by comprehension
We can now make the following definition:
 * Definition SO2: If $$P(x)$$ is collectivizing, then define
 * $$\{x: P(x)\}$$
 * As the set for which
 * For all $$z$$, $$z \in \{x: P(x)\}$$ iff $$P(z)$$.

The resulting set is said to be defined by comprehension. For the next few sections we'll follow the same plan; state an axiom or prove a theorem which makes a certain predicate collectivizing, then define notation for the corresponding set.

If $$P(x)$$ is not collectivizing, and that can happen as we've been stressing, then technically
 * $$\{x: P(x)\}$$

is undefined. It's useful though to think if it as a set-like object called a class.

Unions
In order to get from singletons and pairs to triples, we'll use a more general method of combining sets. It's usual to start by defining the union of two sets, but this is actually a special case of a more basic operation, namely the union over a set.


 * Axiom SO3 (Axiom of unions): For all $$z$$, the predicate
 * For some $$y$$, $$x \in y$$ and $$y \in z$$
 * is collectivizing.

Less formally, this says that, given $$z$$, there is a set $$u$$ so that $$x \in u$$ iff $$x$$ is an element of some element of $$z$$.

This allows us to make the definition
 * Definition SO7: $$\bigcup z := \{x: \operatorname{for\ some} y, x \in y \operatorname{and} y \in z\}$$

The expression $$\bigcup z$$ is read "the union over $$z$$.

We leave the proofs of the following as exercises:
 * Theorem SO8: For all $$x$$, $$z$$, $$x \in z$$ implies $$x \subseteq \bigcup z$$


 * Theorem SO9: For all $$x$$, $$y$$, $$z$$, $$(x \in z \operatorname{implies} x \subseteq y) \operatorname{implies} \bigcup z \subseteq y$$

Informally, $$\bigcup z$$ contains every element of $$z$$ as a subset and is the smallest such set.

To get the usual union of two sets, combine this union with a pair:
 * Definition SO10: $$x \cup y := \bigcup \{x, y \}$$

We can then prove as a theorem the usual definition:
 * Theorem SO11: For all $$x$$, $$y$$, $$x \cup y = \{z: z \in x \operatorname{or} z \in y\}$$

As usual, the proof is left as an exercise.

It's now possible to define triples, quadruples, etc. for as many elements as needed:
 * Definition SO12: $$\{x, y, z\} := \{x, y\} \cup \{z\}$$


 * Definition SO13: $$\{x, y, z, u\} := \{x, y, z\} \cup \{u\}$$

Etc.

The proofs of the following are left as exercises:
 * Theorem SO14: $$\bigcup \varnothing = \varnothing$$


 * Theorem SO15: For all $$x$$, $$\bigcup \{x\} = x$$


 * Theorem SO16: For all $$x$$, $$y$$, $$\bigcup (x \cup y) = (\bigcup x) \cup (\bigcup y)$$


 * Theorem SO17: For all $$x$$, $$y$$, $$z$$, $$\{x, y, z\} = \{x, z, y\} = \{y, z, x\}$$

Here, $$x=y=z$$ is shorthand for $$x=y$$ and $$y=z$$.

Axiom of separation
Before going on to intersections, we need yet another axiom to guarantee they exist. This is a restricted version of comprehension, the idea that any predicate defines a set. This gives it its alternate name, the axiom of restricted comprehension. The unrestricted, and incorrect version says, using the language of classes, that any class is a set. The restricted version says, in effect, any subclass of a set is a set. Written out a bit more formally, this says that for predicates $$P(x)$$ and $$Q(x)$$, if for all $$x$$$$P(x)$$ implies $$Q(x)$$ and $$Q(x)$$ is collectivizing, then $$P(x)$$ is collectivizing. Yet more formally:
 * Axiom SO18 (Separation): For all $$z$$, if for all x, $$P(x)$$ implies $$x \in z$$ then $$P(x)$$ is collectivizing.

If $$R(x)$$ is a predicate then $$P(x)$$ defined as $$R(x)$$ and $$x \in z$$ has the required property, so we can make the definition
 * $$\{x \in z: R(x)\} := \{x: x \in z \operatorname{and} R(x)\}$$

with no restriction on $$R(x)$$. The fact that any predicate can be used here makes the axiom very powerful, but not so powerful that is leads to a contradiction (at far as anyone knows anyway).

It may be helpful to attempt to use this axiom to reproduce Russell's paradox; presumably the attempt will fail since the idea to avoid contradictions. Let $$c$$ be a set and define
 * $$b := \{x \in c: \operatorname{not} x \in x \}$$

Now suppose $$b \in b$$. Then $$b$$ fails to meet the criterion not $$b \in b$$ and so not $$b \in b$$ a contradiction. Assume, on the other hand, not $$b \in b$$. Then one of $$b \in c$$ or not $$b \in b$$ must be false. The second possibility is true by assumption, so we have not $$b \in c$$. But this is far from a contradiction and there is no paradox this time.

Intersections
Intersections are similar to unions except that the 'For some' is replaced by 'for all'. We define intersections following the same plan as for unions. In this case though, we can use the axiom of separation to prove a theorem which replaces the axiom of unions.


 * Theorem SO19 (existence of intersections): For all $$z$$ not equal to ∅, the predicate
 * For all $$y$$, $$y \in z$$ implies $$x \in y$$
 * is collectivizing.

Less formally, this says that, given $$z$$, there is a set $$n$$ so that $$x \in n$$ iff $$x$$ is an element of every element of $$z$$. The assumption $$z$$ not equal to ∅ will be needed in the proof.
 * Proof (outline): Let $$Q(x)$$ be the predicate
 * For all $$y$$, $$y \in z$$ implies $$x \in y$$.
 * From not $$z=\varnothing$$, theorem S8 on the previous page says there is some $$w \in z$$. Pick one, say $$d \in z$$. One can now prove that $$Q(x)$$ implies $$x \in d$$, and therefore by the axiom of separation, $$Q(x)$$ is collectivizing.

This allows us to make the definition when $$z$$ is not ∅:
 * Definition SO20: $$\bigcap z := \{x: \operatorname{for\ all} y, y \in z \operatorname{implies} x \in y \}$$

The expression $$\bigcap z$$ is read "the intersecion over $$z$$. $$\bigcap \varnothing$$ is left undefined.

To get the usual intersection of two sets, combine this intersection with a pair:
 * Definition SO21: $$x \cap y := \bigcap \{x, y \}$$

We can then prove as a theorem the usual definition:
 * Theorem SO22: For all $$x$$, $$y$$, $$x \cap y = \{z: z \in x \operatorname{and} z \in y\}$$

with the proof is left as an exercise.


 * Definition SO23: $$x$$ and $$y$$ are disjoint when $$x \cap y = \varnothing$$. A set $$z$$ (usually taken to be a set of other sets) is pairwise disjoint if for all $$x$$, $$y$$, $$x \in z$$ and $$y \in z$$ imply $$x=y$$ or $$x$$ and $$y$$ are disjoint.

In other words $$x$$ and $$y$$ are disjoint when they have no elements in common, and $$z$$ is pairwise disjoint if any two different elements are disjoint.

<!--

Definitions
We define the logical statement "$$A = B$$" to be true by definition when the statement "$$x\in A \Leftrightarrow x\in B$$" (which reads "$$x$$ is contained in $$A$$ if and only if $$x$$ is contained in $$B$$") is true, and false otherwise. Intuitively this means that sets are equal if and only if they contain exactly the same elements. For example, $$\{1,2,3\}=\{1,2\}$$ is false since "$$3\in \{1,2\}$$" is false. It might be helpful to check the truth table to see that "$$3\in \{1,2,3\} \Leftrightarrow 3\in \{1,2\}$$" is a false statement. It should then be clear that "$$\{5,6,7\}=\{5,6,7\}$$" is true.

Subsets
If every element of the set $$A$$ is an element of $$B$$, we then say that $$A$$ is a subset of $$B$$.

Rigorously, we say that the statement "$$A\subset B$$" is true by definition when the statement "$$x\in A \Rightarrow x\in B$$" (which reads "If $$x$$ is contained in $$A$$ then $$x$$ is contained in $$B$$") is true.

We have seen previously that the statement $$\{1,2\}=\{1,2,3\}$$ is false, however the statement $$\{1,2\}\subset \{1,2,3\}$$ is true. It should be clear that $$\{1,2,3,5\}\subset \{1,2,3,4\}$$ is false, since the statement "$$5\in \{1,2,3,5\} \Rightarrow 5 \in \{1,2,3,4\}$$" is false.

Complement
To define the complement of the set $$A$$ we assume that the set $$A$$ is a subset of some universal set $$X$$. We say "$$A$$ lives in $$X$$". Often the universal set is implicitly clear, for example when we are studying real analysis we often just assume $$X=\mathbb{R}$$ or when studying complex analysis we assume $$X=\mathbb{C}$$.

We define the complement of a set by the superscript "$$c$$". Rigorously "$$A^c := \{x \in X | \lnot x\in A\}$$" which reads "the complement of $$A$$ in $$X$$ is the set of all elements which are contained in $$X$$ and not in $$A$$".

For example, if we assume $$X=\{1,2,3,4,5\}$$ then $$\{1,5\}^c:=\{2,3,4\}$$.

Relative complement
We define the relative complement of sets by the symbol "$$\backslash$$". Rigorously, "$$A\backslash B := \{x\in A | \lnot x\in B\}$$" which reads "the relative complement of $$B$$ in $$A$$ is by definition equal to the set containing all the elements contained in $$A$$ and is not contained in $$B$$".

For example "$$\{1,2,3,4\}\backslash \{1,4,5\} := \{2,3\}$$".

Lemma 1
$$ (A = B) \Leftrightarrow (A\subset B) \land (B\subset A)$$. Which reads "A equals B if and only if A is a subset of B AND B is a subset of A"

proof As explained in the previous chapter, $$ (A = B) \Leftrightarrow (A\subset B) \land (B\subset A)$$ will be true by adjunction when both $$ (A = B) \Rightarrow (A\subset B) \land (B\subset A)$$ and $$ (A\subset B) \land (B\subset A) \Rightarrow (A = B)$$ are true.

We prove first $$ (A = B) \Rightarrow (A\subset B) \land (B\subset A)$$.

Let $$A = B$$, then by definition we have $$x\in A \Leftrightarrow x\in B$$, which is logically equivalent to $$(x\in A \Rightarrow x\in B)\land (x\in A \Rightarrow x\in B)$$. By simplification we have that $$x\in A \Rightarrow x\in B$$ is true, and that $$x\in A \Rightarrow x\in B$$ is true. Therefore by definition $$A \subset B$$, and $$B\subset A$$ are both true. By adjunction $$(A\subset B)\land(B\subset A)$$ is true. Therefore $$ (A = B) \Rightarrow (A\subset B) \land (B\subset A)$$ is true.

Conversely, we prove $$ (A\subset B) \land (B\subset A) \Rightarrow (A = B)$$.

Let $$ (A\subset B) \land (B\subset A)$$. Then, by simplification, both $$A\subset B$$ and $$B\subset A$$ are true. By definition both $$x\in A \Rightarrow x\in B$$ and $$x\in B \Rightarrow x\in A$$ are true. By adjunction, $$(x\in A \Rightarrow x\in B) \land (x\in B \Rightarrow x\in A)$$ is true, which is logically equivalent to $$x\in A \Leftrightarrow x\in B$$. Then by definition $$A=B$$ is true. Therefore $$ (A\subset B) \land (B\subset A) \Rightarrow (A = B)$$ is true. QED.

Lemma 2
$$A\subset A\cup B$$

Lemma 3
$$A\cap B\subset A$$ and $$A\cap B\subset B$$ -->