# Mathematical Proof and the Principles of Mathematics/Sets/Union and intersection

## Unions of sets

The construction that allows us to form sets with more than two elements is the union. It allows us to take existing sets and form a single set containing all the elements of those sets.

Axiom (Union)

Given a set ${\displaystyle S}$ of sets, there exists a set ${\displaystyle U}$ such that ${\displaystyle x\in U}$ if and only if ${\displaystyle x\in A}$ for some ${\displaystyle A\in S}$.

Definition Given a set ${\displaystyle S}$ of sets, we call a set ${\displaystyle U}$ as in the Axiom of Union, a union over ${\displaystyle S}$ and denote it ${\displaystyle \bigcup S}$.

Example Let ${\displaystyle A=\{1,2,3\}}$, ${\displaystyle B=\{1,2\}}$ and ${\displaystyle C=\{1,5\}}$. Now let ${\displaystyle S=\{A,B,C\}}$. Then ${\displaystyle \bigcup S=\{1,2,3,5\}}$. ${\displaystyle \square }$

Theorem Given a set ${\displaystyle S}$ of sets as in the Axiom of Union, the union over ${\displaystyle S}$ is unique.

Proof If ${\displaystyle U_{1}}$ and ${\displaystyle U_{2}}$ were both unions over ${\displaystyle S}$ then ${\displaystyle x\in U_{1}}$ iff ${\displaystyle x\in A}$ for some ${\displaystyle A\in S}$. Similarly ${\displaystyle x\in U_{2}}$ iff ${\displaystyle x\in A}$ for some ${\displaystyle A\in S}$. Thus ${\displaystyle x\in U_{1}}$ iff ${\displaystyle x\in U_{2}}$, and so ${\displaystyle U_{1}=U_{2}}$ by extensionality. ${\displaystyle \square }$

We recover the familiar definition of the union of two sets as follows.

Definition If ${\displaystyle S=\{A,B\}}$ we denote ${\displaystyle \bigcup S}$ by ${\displaystyle A\cup B}$ and call it the union of ${\displaystyle A}$ and ${\displaystyle B}$.

Theorem If ${\displaystyle A}$ and ${\displaystyle B}$ are sets then ${\displaystyle A\cup B}$ is a set.

Proof By the Axiom of Pair, ${\displaystyle S=\{A,B\}}$ is a set. Thus by the Axiom of Union ${\displaystyle A\cup B=\bigcup S}$ is a set. ${\displaystyle \square }$

## Comprehension

Comprehensions allow us to select elements of an existing set that have some specified property. The Axiom Schema of Comprehension says that such selections define sets.

There is very little restriction on the properties we may use in comprehensions, except that they must be specified with formulas in the language of set theory and formal logic.

We first define what we mean by a formula.

Definition A formula can contain variables ${\displaystyle x_{1},x_{2},\ldots }$ of which we are allowed an unlimited supply, and constants, i.e. specific sets ${\displaystyle A_{1},A_{2},\ldots }$ say, and must be built up using a finite number of the following:

• Expressions of the form ${\displaystyle u\in v}$ and ${\displaystyle u=v}$ are formulas, called atomic formulas, for all variables and constants ${\displaystyle u}$ and ${\displaystyle v}$.
• If ${\displaystyle P}$ and ${\displaystyle Q}$ are formulas then ${\displaystyle P\vee Q}$, ${\displaystyle P\wedge Q}$, ${\displaystyle \neg P}$, ${\displaystyle (P\rightarrow Q)}$ and ${\displaystyle (P\leftrightarrow Q)}$ are formulas.
• If ${\displaystyle P}$ is a formula then ${\displaystyle \forall x_{i}P}$ and ${\displaystyle \exists x_{i}P}$ are formulas.

Here ${\displaystyle \vee }$ stands for logical or, ${\displaystyle \wedge }$ is logical and, ${\displaystyle \neg }$ is logical negation, ${\displaystyle \rightarrow }$ is implies and ${\displaystyle \leftrightarrow }$ stands for if and only if, which we shall often abbreviate iff.

The expression ${\displaystyle \forall x}$ is called a universal quantifier. It means for all sets ${\displaystyle x}$. The expression ${\displaystyle \exists x}$ is an existential quantifier. It means there exists a set ${\displaystyle x}$.

Example Given a set ${\displaystyle A}$ the expression ${\displaystyle P(x,A)=\forall y(x\in y)\vee (x\in A)}$ is an example of a formula. ${\displaystyle \square }$

Although symbols ${\displaystyle \subseteq }$, ${\displaystyle \subset }$, etc., and ${\displaystyle \exists !}$ for there exists a unique, are not part of the formal language, we can define them in terms of the existing language of set theory.

For example, ${\displaystyle A\subseteq B}$ can be written ${\displaystyle \forall x(x\in A\rightarrow x\in B)}$. Similarly, ${\displaystyle \exists !xP(x)}$ can be written ${\displaystyle \exists x(P(x)\wedge \forall y(P(y)\rightarrow y=x))}$.

Definition In a formula, any variable ${\displaystyle x_{i}}$ inside an expression of the form ${\displaystyle \forall x_{i}P}$ or of the form ${\displaystyle \exists x_{i}P}$ is said to be bound. All other variables in a formula are said to be free, or arguments of the formula.

We are now in a position to state the Axiom Schema of Comprehension.

Axiom Schema (Comprehension)

For a set ${\displaystyle A}$ and a property ${\displaystyle P(x,A)}$ there exists a set ${\displaystyle B}$ consisting of the ${\displaystyle x\in A}$ for which ${\displaystyle P(x,A)}$ holds.

Note that this is not just one axiom, but an axiom for each possible property. We call a collection of axioms like this an axiom schema.

Technically the formula ${\displaystyle P(x,A)}$ can have finitely many free variables, so is sometimes denoted ${\displaystyle P(x,y_{1},y_{2},\ldots ,y_{n},A)}$ where the ${\displaystyle y_{i}}$ are free variables. But we suppress this technicality for now and just write ${\displaystyle P(x,A)}$.

Theorem The set of elements of a set ${\displaystyle A}$ for which a property ${\displaystyle P(x,A)}$ holds is unique.

Proof This follows by noting that if there were two such sets${\displaystyle S_{1}}$ and ${\displaystyle S_{2}}$ then ${\displaystyle x\in S_{1}}$ iff ${\displaystyle x\in A}$ and ${\displaystyle P(x,A)}$ holds. However, this is the case iff ${\displaystyle x\in S_{2}}$. Thus ${\displaystyle x\in S_{1}}$ iff ${\displaystyle x\in S_{2}}$ and the result follows by extensionality. ${\displaystyle \square }$

Definition The set of elements of a set ${\displaystyle A}$ for which ${\displaystyle P(x,A)}$ holds is denoted ${\displaystyle \{x\in A\;|\;P(x,A)\}}$.

We can read the vertical bar as such that.

Example If ${\displaystyle A=\{1,2,3\}}$ then ${\displaystyle \{x\in A\;|\;x\neq 2\}=\{1,3\}}$.

The Axiom Schema of Comprehension is sometimes called the Subset Axiom Scheme or Axiom Schema of Specification, since it guarantees that any subset of a set specified by a formula, is a set.

## Intersections of sets

We can define the familiar intersection of two sets in terms of a comprehension.

  ${\displaystyle A\cap B=\{x\in A\cup B\;|\;x\in A\;{\mbox{and}}\;x\in B\}.}$


The formula in the comprehension consists of two predicates from the language of sets, ${\displaystyle (x\in A)}$ and ${\displaystyle (x\in B)}$, joined by the logical conjunction and from formal logic.

More generally, we have the following.

Definition Let ${\displaystyle S}$ be a set of sets. The intersection over ${\displaystyle S}$ is defined by

  ${\displaystyle \bigcap S=\{x\in \bigcup S\;|\;x\in A\;{\mbox{for all}}\;A\in S\}.}$


Example Let ${\displaystyle A=\{1,2,3\}}$, ${\displaystyle B=\{2,3,5\}}$ and ${\displaystyle C=\{1,2,3,4\}}$. If ${\displaystyle S=\{A,B,C\}}$ then ${\displaystyle \bigcap S=\{2,3\}}$.

Theorem Let ${\displaystyle S}$ be a set of sets. Then ${\displaystyle \bigcap S}$ is a set.

Proof This is a set by the axioms of union and comprehension. ${\displaystyle \square }$

The following is a useful definition.

Definition Two sets ${\displaystyle A}$ and ${\displaystyle B}$ are said to be disjoint if ${\displaystyle A\cap B=\emptyset }$.

Example The sets ${\displaystyle A=\{1,2,3\}}$ and ${\displaystyle B=\{4,5\}}$ are disjoint since their intersection is empty.

## Exercises

• Show that if ${\displaystyle A}$ and ${\displaystyle B}$ are sets then ${\displaystyle A\subseteq B}$ if and only if ${\displaystyle A\cup B=B}$.
• Let ${\displaystyle A}$, ${\displaystyle B}$ and ${\displaystyle C}$ be sets. Show that there exists a set whose elements are ${\displaystyle A}$, ${\displaystyle B}$ and ${\displaystyle C}$.
• Suppose ${\displaystyle X_{1},X_{2},\ldots ,X_{n}}$ and ${\displaystyle Y_{1},Y_{2},\ldots ,Y_{n}}$ are sets with ${\displaystyle X_{i}\subseteq Y_{i}}$ for all ${\displaystyle i}$. Let ${\displaystyle S=\{X_{1},X_{2},\ldots ,X_{n}\}}$ and ${\displaystyle T=\{Y_{1},Y_{2},\ldots ,Y_{n}\}}$. Show that ${\displaystyle \bigcap S\subseteq \bigcap T}$.